From owner-freebsd-arm@FreeBSD.ORG Mon Apr 27 13:48:22 2015 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4BC6039B for ; Mon, 27 Apr 2015 13:48:22 +0000 (UTC) Received: from phabric-backend.isc.freebsd.org (phabric-backend.isc.freebsd.org [IPv6:2001:4f8:3:ffe0:406a:0:50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2A8D516A2 for ; Mon, 27 Apr 2015 13:48:22 +0000 (UTC) Received: from phabric-backend.isc.freebsd.org (phabric-backend.isc.freebsd.org [127.0.1.5]) by phabric-backend.isc.freebsd.org (8.14.9/8.14.9) with ESMTP id t3RDmMLr037451 for ; Mon, 27 Apr 2015 13:48:22 GMT (envelope-from daemon-user@phabric-backend.isc.freebsd.org) Received: (from daemon-user@localhost) by phabric-backend.isc.freebsd.org (8.14.9/8.14.9/Submit) id t3RDmMwP037450; Mon, 27 Apr 2015 13:48:22 GMT (envelope-from daemon-user) Date: Mon, 27 Apr 2015 13:48:22 +0000 To: freebsd-arm@freebsd.org From: "zbb (Zbigniew Bodek)" Subject: [Differential] [Request, 1, 025 lines] D2377: Introduce ARM GICv3 support Message-ID: X-Priority: 3 Thread-Topic: D2377: Introduce ARM GICv3 support X-Herald-Rules: <28>, <31>, <32>, <34>, <8> X-Phabricator-To: X-Phabricator-To: X-Phabricator-To: X-Phabricator-To: X-Phabricator-To: X-Phabricator-To: X-Phabricator-To: X-Phabricator-To: X-Phabricator-Cc: X-Phabricator-Cc: X-Phabricator-Cc: X-Phabricator-Cc: Thread-Index: MjA1ZGZkZWI5MTE4ZDk2Nzk0YzAyZGRiMWRi Precedence: bulk X-Phabricator-Sent-This-Message: Yes X-Mail-Transport-Agent: MetaMTA X-Auto-Response-Suppress: All X-Phabricator-Mail-Tags: , , , MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="b1_233c72621ad544eae2ed39aa47890a4a" X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.20 List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2015 13:48:22 -0000 --b1_233c72621ad544eae2ed39aa47890a4a Content-Type: text/plain; charset = "utf-8" Content-Transfer-Encoding: 8bit zbb created this revision. zbb added reviewers: emaste, ian, imp, andrew. zbb added a subscriber: freebsd-arm. zbb set the repository for this revision to rS FreeBSD src repository. Herald added subscribers: imp, andrew, emaste. Herald added a reviewer: manpages. REVISION SUMMARY Support for GICv3 interrupt controller used by some ARM64 based chips. Obtained from: Semihalf Sponsored by: The FreeBSD Foundation REPOSITORY rS FreeBSD src repository REVISION DETAIL https://reviews.freebsd.org/D2377 AFFECTED FILES sys/arm64/arm64/gic_v3.c sys/arm64/arm64/gic_v3_fdt.c sys/arm64/arm64/gic_v3_reg.h sys/arm64/arm64/gic_v3_var.h sys/arm64/arm64/locore.S EMAIL PREFERENCES https://reviews.freebsd.org/settings/panel/emailpreferences/ To: zbb, emaste, ian, imp, andrew, brueffer, joel, wblock Cc: emaste, andrew, imp, freebsd-arm --b1_233c72621ad544eae2ed39aa47890a4a Content-Type: text/x-patch; charset=utf-8; name="D2377.5024.patch" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="D2377.5024.patch" ZGlmZiAtLWdpdCBhL3N5cy9hcm02NC9hcm02NC9sb2NvcmUuUyBiL3N5cy9hcm02NC9hcm02NC9s b2NvcmUuUwotLS0gYS9zeXMvYXJtNjQvYXJtNjQvbG9jb3JlLlMKKysrIGIvc3lzL2FybTY0L2Fy bTY0L2xvY29yZS5TCkBAIC0zNCw2ICszNCw4IEBACiAjaW5jbHVkZSA8bWFjaGluZS9wYXJhbS5o P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FBJQyBp bnRlcmZhY2UgKi8KKwlERVZNRVRIT0QocGljX2Rpc3BhdGNoLAkJZ2ljX3YzX2Rpc3BhdGNoKSwK KwlERVZNRVRIT0QocGljX2VvaSwJCWdpY192M19lb2kpLAorCURFVk1FVEhPRChwaWNfbWFzaywJ CWdpY192M19tYXNrX2lycSksCisJREVWTUVUSE9EKHBpY191bm1hc2ssCQlnaWNfdjNfdW5tYXNr X2lycSksCisKKwkvKiBFbmQgKi8KKwlERVZNRVRIT0RfRU5ECit9OworCitzdGF0aWMgZHJpdmVy X3QgZ2ljX3YzX2RyaXZlciA9IHsKKwkiZ2ljIiwKKwlnaWNfdjNfbWV0aG9kcywKKwlzaXplb2Yo c3RydWN0IGdpY192M19zb2Z0YyksCit9OworCitFQVJMWV9EUklWRVJfTU9EVUxFKGdpY192Mywg c2ltcGxlYnVzLCBnaWNfdjNfZHJpdmVyLCBnaWNfdjNfZGV2Y2xhc3MsIDAsIDAsCisgICAgQlVT X1BBU1NfSU5URVJSVVBUICsgQlVTX1BBU1NfT1JERVJfTUlERExFKTsKK0VBUkxZX0RSSVZFUl9N T0RVTEUoZ2ljX3YzLCBvZndidXMsIGdpY192M19kcml2ZXIsIGdpY192M19kZXZjbGFzcywgMCwg MCwKKyAgICBCVVNfUEFTU19JTlRFUlJVUFQgKyBCVVNfUEFTU19PUkRFUl9NSURETEUpOworCisv KgorICogRGV2aWNlIGludGVyZmFjZS4KKyAqLworc3RhdGljIGludAorZ2ljX3YzX2ZkdF9wcm9i ZShkZXZpY2VfdCBkZXYpCit7CisKKwlpZiAoIW9md19idXNfc3RhdHVzX29rYXkoZGV2KSkKKwkJ cmV0dXJuIChFTlhJTyk7CisKKwlpZiAoIW9md19idXNfaXNfY29tcGF0aWJsZShkZXYsICJhcm0s Z2ljLXYzIikpCisJCXJldHVybiAoRU5YSU8pOworCisJZGV2aWNlX3NldF9kZXNjKGRldiwgR0lD X1YzX0RFVlNUUik7CisJcmV0dXJuIChCVVNfUFJPQkVfRE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cl9yd3Aoc2MsIFJFRElTVCk7CisKK2Vycm9yOgorCXJldHVybiAoZXJyKTsKK30KCg== --b1_233c72621ad544eae2ed39aa47890a4a--