From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (NAM11-DM6-obe.outbound.protection.outlook.com [40.107.223.45]) by mx.groups.io with SMTP id smtpd.web11.81.1612805947034485264 for ; Mon, 08 Feb 2021 09:39:07 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@vmware.com header.s=selector2 header.b=Kl05kfR4; spf=pass (domain: vmware.com, ip: 40.107.223.45, mailfrom: awarkentin@vmware.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jlyffriYjuAX9sPXnp7SBVJBFyelYO6MNc88zMWez0e339di7AsbzPV1opbtDQa8rj7wAwpQ4ZQWILSDC+xU7O7729FcnOWUT4nvkzlSW/MB0I0/aL0yNzotgK1JrO8IWyhvL1T/Qm0yHgW0VCj9dc38V7/qMGqqyPpO/BdMTV03UHfFiTYMpZY1mkyfWJM6xvJOLOTURur9GxoDjmYt1/N3nvYC0j0SIyAXPx5fvw37eVf0XQPaGswqLpH5vD9x5M25p07nhbuz1bRmt/e6ElGxLS4JOOmR15dLb9Z971vNSoCbaIvhUShhOuGxU3VzULy2Y9hUxt4bIAzHZO91iQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dCYw4he3UifOdu9nClOLJSpBMCLMYY9StDqB+O4gZxQ=; b=I04OLFtlr9nvTpVj6L3+Q97sB+s0LR7z6N/NC3tpNoJMKerNkaSNINTKa8k4Cp8qs9O1X0DLdc6JFgS+piGHOMxgC/jxbAzzElDUSrXp5EWJwjxre947NR4YIMTQdXVkHGdmqTGwrnr9PGSOQx0ilJPJP21yfy3z/H/Wt4VObOk+oouYCjRVuf8WsuqQ5w4c8jq/NqCbK//LxKT614CRN399LBOdplgia8rHZtwQ19DvtQ1hoBWBaQiR+HS0vqwT7s1A1AyeoyMSo4JYbrufUCqydYCX6pM4kFoIf3dXjT5/FTkB3xKH1QIpLnj3EtELqVTLkD1B4MPaBRhDkAr1Yg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vmware.com; dmarc=pass action=none header.from=vmware.com; dkim=pass header.d=vmware.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vmware.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dCYw4he3UifOdu9nClOLJSpBMCLMYY9StDqB+O4gZxQ=; b=Kl05kfR4mcBjD7XhUpVvftk1hH/LSAlP/n9E8PuyDpYODyMHfFRSy40qLWQLZZKHnhvEh7jEFEq2P+EpdOXcKkcrWb5RaAaW30su6mq4aM8nP1VDVjfU8GL+uT4t1KcfdhdCnHeRcI9J1zOOZj+OtZrtzqxQED+otoC/noHhExY= Received: from (2603:10b6:806:f7::16) by SN6PR05MB4685.namprd05.prod.outlook.com (2603:10b6:805:98::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.10; Mon, 8 Feb 2021 17:39:02 +0000 Received: from SN7PR05MB7582.namprd05.prod.outlook.com ([fe80::d1f7:9f0e:9655:eadb]) by SN7PR05MB7582.namprd05.prod.outlook.com ([fe80::d1f7:9f0e:9655:eadb%4]) with mapi id 15.20.3846.025; Mon, 8 Feb 2021 17:39:02 +0000 From: "Andrei Warkentin" To: "devel@edk2.groups.io" , "jeremy.linton@arm.com" CC: "pete@akeo.ie" , "samer.el-haj-mahmoud@arm.com" , "leif@nuviainc.com" , "ard.biesheuvel@arm.com" Subject: Re: [edk2-devel] [RFC 1/3] rpi4: Add XHCI/PCI selection menu Thread-Topic: [edk2-devel] [RFC 1/3] rpi4: Add XHCI/PCI selection menu Thread-Index: AQHW6TIW298zXZ7D8021YtXf9SsZaqpOr+D1 Date: Mon, 8 Feb 2021 17:39:02 +0000 Message-ID: References: <20210112222708.1757044-1-jeremy.linton@arm.com>,<20210112222708.1757044-2-jeremy.linton@arm.com> In-Reply-To: <20210112222708.1757044-2-jeremy.linton@arm.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=vmware.com; x-originating-ip: [69.174.145.79] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: a2fa990b-2912-4d27-768b-08d8cc586cbe x-ms-traffictypediagnostic: SN6PR05MB4685: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: fCVj+Rk4NE/o52QkNQxHDrYOqzCBiEbfemLXINrQcNDp/0a8TZbu8vexlhrV9BSE9yT32X5rPLQw7uxxgxNMqZF41byeyq8hkE3Z1PkDkRMZ5Ov9Cv9AvNAKsekNo6FSZnXRUUWANV/3p5hHBJRUrXsgPLTwl9YTvRlPv4z0P20s+DZT4hTtRqoZ6wu+ZuaPVAWQtmFPIy3a5DM+3DgZNMc48pyH+gPREXCn62N+hDMDupz0s/XI8idG1NR14fNURXiB8cha8ZkyljfE7VSG3pjP/4Ruw1NK64z9fKS0nffI8YqRNEcoaplF36NJS/fd2Zj2HPhrSc0AJXKGKT5Gs4S9kTEBGQm+o9D/BYt4JBw3GZuMRxQQLjErhnp3Ru6CvtoqePTWjdcrlfKgr8FVZBADGtBldDO5ejkt4KuvDXKfH0tYEQfGxBNOJaCl8WsGcGSLd/v4onT4XCAMPChklC08riezzVgoWHzYHbpoOUh6/6qUD0yBD8VPIqJo971ki6q2cyJaGSHIyfzpkNHbQlqf+KSgVZXdz357GTreyA0z+cy7OHMmv3Xcj2cfL68yvMju23srrkzv5HpSTHMNIvFCQu645X7pqRRhed78H1I= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN7PR05MB7582.namprd05.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(376002)(396003)(346002)(366004)(136003)(39860400002)(186003)(66946007)(110136005)(54906003)(86362001)(2906002)(19627235002)(33656002)(19627405001)(9686003)(966005)(45080400002)(71200400001)(55016002)(8936002)(76116006)(478600001)(4326008)(6506007)(5660300002)(7696005)(52536014)(316002)(166002)(66556008)(83380400001)(26005)(66446008)(66476007)(8676002)(53546011)(64756008);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?QzHJS1hweo21vCsZE/DMHsuqeqBSw/dzj3zq9vmCUnnviLq4mFfib65cPI5E?= =?us-ascii?Q?1fOAAWl5r5TvOYXDHFtOmsMUvemkw8r3NwtoXIoKEDlQ7jlYjG/a5zHB12SD?= =?us-ascii?Q?vhEMLX8DBtXtWPup3+OaIU38DdYDfQsC0bJQW21kce/r/9uZB5tRUlw8dAn7?= =?us-ascii?Q?gRr68qDkzufM1EKljy7oA6+M5X2zSSglx3akdFmuQaizAAuQJ+IpYU3CkHCu?= =?us-ascii?Q?G2OcsEprDwGBLvZnvjNnP1mvMjTgXIBB1i5Po/d7A8Sje2Yl2hCp5nk+eT2P?= =?us-ascii?Q?WwiYkkRSvKMloD2fmCE/MNtCYjDreEIHqiuPQgTKkk75Xzsk2tq56owsmujK?= =?us-ascii?Q?XOKQF4rb5TG3HkQycuoYZ8s99Ky79h9ekERVZXsVaEMqFw9M7OzPE7u6RtEJ?= =?us-ascii?Q?VEjeXb/SF72L9m969nNMQ0dKmdajUr0+0btEs3Gu27BK5Ojn2hw2ShcI2hfV?= =?us-ascii?Q?9pBLhrfOArYEdE+9l5si4I0GBNn0N68MKbSzhawPm8C/f4fccxY7t1tO7eud?= =?us-ascii?Q?4rsv7sIlU0OZ9C0ynjrGhF+Yvb8xuGMKx5U8ENZExRCQ8BsrZNik7acSOZPZ?= =?us-ascii?Q?7B/t29TyamKPJ61JMXQZoPMBS2raaG/U1G9mYHQLmJuRu230k9N2JCwTXosJ?= =?us-ascii?Q?kYVyIKtoSFEaCv6rE4cz3qyjmTKsxhWbaokWdrOXKFvhhlCS2AuhG8uDBOrV?= =?us-ascii?Q?ywivxqdv5qCWtrkRu1vv7AuKOb6Sqx18u3QAXqfg5dQDyfQvU/s5LHU1z6ew?= =?us-ascii?Q?QOppmubd1NxenwTEqzdULb1enCKtz1WFP+79IPf37f22c7DyxxEXWeR+vYhX?= =?us-ascii?Q?UTVO3nnn+pktLjGVvP7JGxvw0dNOL57Gq7Qqx1VGOgbxaAAynQ+EnsBOpHgE?= =?us-ascii?Q?WKfZO57BP+gAQFfnLywx0O4tNiDxikIIZGfiKhW4NVnKxjhcVrV02t2WXuqM?= =?us-ascii?Q?J5TOWEmTWWWaod/2B1cHyG3iwyAIaC9KZyY623ET8MqvWl7ga4QPtbU494Iv?= =?us-ascii?Q?EPB0sXO3P8mqC1vdT/za7Nbp9pqshkvh+WaNhKrxpmnJYuKGRc+hMp4trt9y?= =?us-ascii?Q?rCqG+miXstkwTDC6TBRmH8M97dE2YFqudOXehPu42Xmkz90N6Ie+P8ztjawi?= =?us-ascii?Q?0Jv5Hb1UJL+yF08rk2C54Mh6HObNos8HeRXae2aUrxAmLLD92e2bFB9AiOBr?= =?us-ascii?Q?u1WjhOKIKly/qcp26WAjOQOQTuUYAMllhVXtAFIqDm0AaSY3SR7ssBv+QZq5?= =?us-ascii?Q?p+jrNJ3HYb/JuT2jO5w+4QJrbPzI2QXNkZnrYNOLn+uS+HkoJxN7Kw33RlTV?= =?us-ascii?Q?Q+o=3D?= x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SN7PR05MB7582.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a2fa990b-2912-4d27-768b-08d8cc586cbe X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Feb 2021 17:39:02.4922 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 4pUWuw0pcsVLCYzp8fPIidAJQlO2/KfuZPLMlORUth1jJnXfBYyvAyTDtod8QM5+/VDFh6NjBX76gfVj/s5boQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR05MB4685 Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_SN7PR05MB75828483F1098CBCF503D262B98F9SN7PR05MB7582namp_" --_000_SN7PR05MB75828483F1098CBCF503D262B98F9SN7PR05MB7582namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Suggest changing the strings to reflect that the coming PCIe functionality = relies on the SMC conduit... Reviewed-by: Andrei Warkentin ________________________________ From: devel@edk2.groups.io on behalf of Jeremy Linto= n via groups.io Sent: Tuesday, January 12, 2021 4:27 PM To: devel@edk2.groups.io Cc: pete@akeo.ie ; Andrei Warkentin ; = samer.el-haj-mahmoud@arm.com ; leif@nuviainc.= com ; ard.biesheuvel@arm.com ; J= eremy Linton Subject: [edk2-devel] [RFC 1/3] rpi4: Add XHCI/PCI selection menu ARM has standardized a SMC PCI conduit that can be used to access the PCI config space in a standardized way. This functionality doesn't yet exist in many OS/Distro's. Lets add another advanced config item that allows the user to toggle between presenting the XHCI on the base rpi4 as a platform device, or presenting this newer PCIe conduit. Signed-off-by: Jeremy Linton --- Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 32 ++++++++++++++++++= ++++ .../RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf | 3 ++ .../RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni | 5 ++++ .../RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr | 13 +++++++++ Platform/RaspberryPi/Include/ConfigVars.h | 4 +++ Platform/RaspberryPi/RPi3/RPi3.dsc | 9 ++++++ Platform/RaspberryPi/RPi4/RPi4.dsc | 11 ++++++++ Platform/RaspberryPi/RaspberryPi.dec | 3 ++ 8 files changed, 80 insertions(+) diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platform/= RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c index 6fcbdcdd17..7a3b8e9068 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c @@ -266,6 +266,38 @@ SetupVariables ( ASSERT_EFI_ERROR (Status); } + if (mModelFamily >=3D 4) { + Size =3D sizeof (UINT32); + Status =3D gRT->GetVariable (L"XhciPci", + &gConfigDxeFormSetGuid, + NULL, &Size, &Var32); + if (EFI_ERROR (Status) || (Var32 !=3D 2)) { + // enable Xhci by default + Status =3D PcdSet32S (PcdXhciPci, 1); + ASSERT_EFI_ERROR (Status); + Status =3D PcdSet32S (PcdXhci, 1); + ASSERT_EFI_ERROR (Status); + Status =3D PcdSet32S (PcdPci, 0); + ASSERT_EFI_ERROR (Status); + } else { + // enable PCIe + Status =3D PcdSet32S (PcdXhciPci, 2); + ASSERT_EFI_ERROR (Status); + Status =3D PcdSet32S (PcdXhci, 0); + ASSERT_EFI_ERROR (Status); + Status =3D PcdSet32S (PcdPci, 1); + ASSERT_EFI_ERROR (Status); + } + } else { + // disable pcie and xhci + Status =3D PcdSet32S (PcdXhciPci, 0); + ASSERT_EFI_ERROR (Status); + Status =3D PcdSet32S (PcdXhci, 0); + ASSERT_EFI_ERROR (Status); + Status =3D PcdSet32S (PcdPci, 0); + ASSERT_EFI_ERROR (Status); + } + Size =3D sizeof (AssetTagVar); Status =3D gRT->GetVariable (L"AssetTag", &gConfigDxeFormSetGuid, diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf b/Platfor= m/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf index 544e3b3e10..aa0fbc7e25 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf @@ -92,6 +92,9 @@ gRaspberryPiTokenSpaceGuid.PcdRamLimitTo3GB gRaspberryPiTokenSpaceGuid.PcdFanOnGpio gRaspberryPiTokenSpaceGuid.PcdFanTemp + gRaspberryPiTokenSpaceGuid.PcdXhciPci + gRaspberryPiTokenSpaceGuid.PcdXhci + gRaspberryPiTokenSpaceGuid.PcdPci [Depex] gPcdProtocolGuid AND gRaspberryPiFirmwareProtocolGuid diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni b/Plat= form/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni index 2afe8f32ae..34efb82f57 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni @@ -57,6 +57,11 @@ #string STR_ADVANCED_FANTEMP_PROMPT #language en-US "ACPI fan temperatur= e" #string STR_ADVANCED_FANTEMP_HELP #language en-US "Cycle a fan at C" +#string STR_ADVANCED_XHCIPCI_PROMPT #language en-US "ACPI XHCI/PCIe" +#string STR_ADVANCED_XHCIPCI_HELP #language en-US "OS sees XHCI USB pl= atform device or PCIe bridge" +#string STR_ADVANCED_XHCIPCI_XHCI #language en-US "XHCI" +#string STR_ADVANCED_XHCIPCI_PCIE #language en-US "PCIe" + #string STR_ADVANCED_ASSET_TAG_PROMPT #language en-US "Asset Tag" #string STR_ADVANCED_ASSET_TAG_HELP #language en-US "Set the system Asse= t Tag" diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr b/Plat= form/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr index de5e43471a..4d5876eb24 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr @@ -56,6 +56,11 @@ formset name =3D FanTemp, guid =3D CONFIGDXE_FORM_SET_GUID; + efivarstore ADVANCED_XHCIPCI_VARSTORE_DATA, + attribute =3D EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME= _ACCESS | EFI_VARIABLE_NON_VOLATILE, + name =3D XhciPci, + guid =3D CONFIGDXE_FORM_SET_GUID; + efivarstore SYSTEM_TABLE_MODE_VARSTORE_DATA, attribute =3D EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME= _ACCESS | EFI_VARIABLE_NON_VOLATILE, name =3D SystemTableMode, @@ -207,6 +212,14 @@ formset default =3D 60, endnumeric; endif; + + oneof varid =3D XhciPci.Value, + prompt =3D STRING_TOKEN(STR_ADVANCED_XHCIPCI_PROMPT), + help =3D STRING_TOKEN(STR_ADVANCED_XHCIPCI_HELP), + flags =3D NUMERIC_SIZE_4 | INTERACTIVE | RESET_REQUIRED, + option text =3D STRING_TOKEN(STR_ADVANCED_XHCIPCI_XHCI), value= =3D 1, flags =3D DEFAULT; + option text =3D STRING_TOKEN(STR_ADVANCED_XHCIPCI_PCIE), value= =3D 2, flags =3D 0; + endoneof; #endif string varid =3D AssetTag.AssetTag, prompt =3D STRING_TOKEN(STR_ADVANCED_ASSET_TAG_PROMPT), diff --git a/Platform/RaspberryPi/Include/ConfigVars.h b/Platform/Raspberry= Pi/Include/ConfigVars.h index c185bfe28b..eb08ad8987 100644 --- a/Platform/RaspberryPi/Include/ConfigVars.h +++ b/Platform/RaspberryPi/Include/ConfigVars.h @@ -77,6 +77,10 @@ typedef struct { } ADVANCED_FANTEMP_VARSTORE_DATA; typedef struct { + UINT32 Value; +} ADVANCED_XHCIPCI_VARSTORE_DATA; + +typedef struct { #define SYSTEM_TABLE_MODE_ACPI 0 #define SYSTEM_TABLE_MODE_BOTH 1 #define SYSTEM_TABLE_MODE_DT 2 diff --git a/Platform/RaspberryPi/RPi3/RPi3.dsc b/Platform/RaspberryPi/RPi3= /RPi3.dsc index 530b42796a..0aeb27d69d 100644 --- a/Platform/RaspberryPi/RPi3/RPi3.dsc +++ b/Platform/RaspberryPi/RPi3/RPi3.dsc @@ -514,6 +514,15 @@ gRaspberryPiTokenSpaceGuid.PcdPlatformResetDelay|L"ResetDelay"|gRaspberr= yPiTokenSpaceGuid|0x0|0 + # Select XHCI/PCIe mode (not valid on rpi3) + # + # 0 - DISABLED + # + gRaspberryPiTokenSpaceGuid.PcdXhciPci|L"XhciPci"|gConfigDxeFormSetGuid|0= x0|0 + # SSDT selectors + gRaspberryPiTokenSpaceGuid.PcdXhci|L"Xhci"|gConfigDxeFormSetGuid|0x0|0 + gRaspberryPiTokenSpaceGuid.PcdPci|L"Pci"|gConfigDxeFormSetGuid|0x0|0 + # # Common UEFI ones. # diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc b/Platform/RaspberryPi/RPi4= /RPi4.dsc index 0cd1014095..d5952288cc 100644 --- a/Platform/RaspberryPi/RPi4/RPi4.dsc +++ b/Platform/RaspberryPi/RPi4/RPi4.dsc @@ -528,6 +528,17 @@ gRaspberryPiTokenSpaceGuid.PcdPlatformResetDelay|L"ResetDelay"|gRaspberr= yPiTokenSpaceGuid|0x0|0 + # Select XHCI/PCIe mode + # + # 0 - DISABLED (not valid for rpi4) + # 1 - Xhci Enabled (default) + # 2 - Pcie Enabled + # + gRaspberryPiTokenSpaceGuid.PcdXhciPci|L"XhciPci"|gConfigDxeFormSetGuid|0= x0|1 + # SSDT selectors + gRaspberryPiTokenSpaceGuid.PcdXhci|L"Xhci"|gConfigDxeFormSetGuid|0x0|1 + gRaspberryPiTokenSpaceGuid.PcdPci|L"Pci"|gConfigDxeFormSetGuid|0x0|0 + # # Common UEFI ones. # diff --git a/Platform/RaspberryPi/RaspberryPi.dec b/Platform/RaspberryPi/Ra= spberryPi.dec index 10723036aa..6c7d4e5116 100644 --- a/Platform/RaspberryPi/RaspberryPi.dec +++ b/Platform/RaspberryPi/RaspberryPi.dec @@ -69,3 +69,6 @@ gRaspberryPiTokenSpaceGuid.PcdFanOnGpio|0|UINT32|0x0000001C gRaspberryPiTokenSpaceGuid.PcdFanTemp|0|UINT32|0x0000001D gRaspberryPiTokenSpaceGuid.PcdPlatformResetDelay|0|UINT32|0x0000001E + gRaspberryPiTokenSpaceGuid.PcdXhci|0|UINT32|0x0000001F + gRaspberryPiTokenSpaceGuid.PcdPci|0|UINT32|0x00000020 + gRaspberryPiTokenSpaceGuid.PcdXhciPci|0|UINT32|0x00000021 -- 2.13.7 -=3D-=3D-=3D-=3D-=3D-=3D Groups.io Links: You receive all messages sent to this group. View/Reply Online (#70172): https://nam04.safelinks.protection.outlook.com/= ?url=3Dhttps%3A%2F%2Fedk2.groups.io%2Fg%2Fdevel%2Fmessage%2F70172&data= =3D04%7C01%7Cawarkentin%40vmware.com%7Cd20ecaf0414040e6bc8608d8b7493732%7Cb= 39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637460872386410651%7CUnknown%7CTW= FpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3= D%7C1000&sdata=3DDqOzl1cgP82q9RDkTr3Ggu%2Bx5UxAFcQFbYyLTN08NJA%3D&r= eserved=3D0 Mute This Topic: https://nam04.safelinks.protection.outlook.com/?url=3Dhttp= s%3A%2F%2Fgroups.io%2Fmt%2F79637124%2F4387333&data=3D04%7C01%7Cawarkent= in%40vmware.com%7Cd20ecaf0414040e6bc8608d8b7493732%7Cb39138ca3cee4b4aa4d6cd= 83d9dd62f0%7C0%7C0%7C637460872386410651%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4= wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=3D= T1wTSzKlYF1qqg89llDX3oFYg65Vj9cOeAISg1yP%2BMQ%3D&reserved=3D0 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://nam04.safelinks.protection.outlook.com/?url=3Dhttps%3A= %2F%2Fedk2.groups.io%2Fg%2Fdevel%2Funsub&data=3D04%7C01%7Cawarkentin%40= vmware.com%7Cd20ecaf0414040e6bc8608d8b7493732%7Cb39138ca3cee4b4aa4d6cd83d9d= d62f0%7C0%7C0%7C637460872386410651%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAw= MDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=3DcFzGC= SBPUDEMGj%2B9QqSroDXp1WWZmFUSliapFxt182g%3D&reserved=3D0 [awarkentin@vm= ware.com] -=3D-=3D-=3D-=3D-=3D-=3D --_000_SN7PR05MB75828483F1098CBCF503D262B98F9SN7PR05MB7582namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
Suggest changing the strings to reflect that the coming PCIe functionality = relies on the SMC conduit...

Reviewed-by: Andrei Warkentin <awarkentin@vmware.com>

From: devel@edk2.groups.io = <devel@edk2.groups.io> on behalf of Jeremy Linton via groups.io <j= eremy.linton=3Darm.com@groups.io>
Sent: Tuesday, January 12, 2021 4:27 PM
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: pete@akeo.ie <pete@akeo.ie>; Andrei Warkentin <awarkent= in@vmware.com>; samer.el-haj-mahmoud@arm.com <samer.el-haj-mahmoud@ar= m.com>; leif@nuviainc.com <leif@nuviainc.com>; ard.biesheuvel@arm.= com <ard.biesheuvel@arm.com>; Jeremy Linton <jeremy.linton@arm.com= >
Subject: [edk2-devel] [RFC 1/3] rpi4: Add XHCI/PCI selection menu
 
ARM has standardized a SMC PCI conduit that can be= used
to access the PCI config space in a standardized way. This
functionality doesn't yet exist in many OS/Distro's. Lets
add another advanced config item that allows the user
to toggle between presenting the XHCI on the base rpi4
as a platform device, or presenting this newer PCIe
conduit.

Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
---
 Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 32 +++++++++++++= +++++++++
 .../RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf    |&n= bsp; 3 ++
 .../RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni |  5 ++++
 .../RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr | 13 +++++++++
 Platform/RaspberryPi/Include/ConfigVars.h    &nbs= p;     |  4 +++
 Platform/RaspberryPi/RPi3/RPi3.dsc      = ;           |  9 +++= +++
 Platform/RaspberryPi/RPi4/RPi4.dsc      = ;           | 11 ++++++++=
 Platform/RaspberryPi/RaspberryPi.dec     &nb= sp;         |  3 ++
 8 files changed, 80 insertions(+)

diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platform/= RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
index 6fcbdcdd17..7a3b8e9068 100644
--- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
+++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
@@ -266,6 +266,38 @@ SetupVariables (
     ASSERT_EFI_ERROR (Status);

   }

 

+  if (mModelFamily >=3D 4) {

+    Size =3D sizeof (UINT32);

+    Status =3D gRT->GetVariable (L"XhciPci",
+            &n= bsp;            = ;      &gConfigDxeFormSetGuid,

+            &n= bsp;            = ;      NULL, &Size, &Var32);

+    if (EFI_ERROR (Status) || (Var32 !=3D 2)) {

+      // enable Xhci by default

+      Status =3D PcdSet32S (PcdXhciPci, 1);

+      ASSERT_EFI_ERROR (Status);

+      Status =3D PcdSet32S (PcdXhci, 1);

+      ASSERT_EFI_ERROR (Status);

+      Status =3D PcdSet32S (PcdPci, 0);

+      ASSERT_EFI_ERROR (Status);

+    } else {

+      // enable PCIe

+      Status =3D PcdSet32S (PcdXhciPci, 2);

+      ASSERT_EFI_ERROR (Status);

+      Status =3D PcdSet32S (PcdXhci, 0);

+      ASSERT_EFI_ERROR (Status);

+      Status =3D PcdSet32S (PcdPci, 1);

+      ASSERT_EFI_ERROR (Status);

+    }

+  } else {

+    // disable pcie and xhci

+    Status =3D PcdSet32S (PcdXhciPci, 0);

+    ASSERT_EFI_ERROR (Status);

+    Status =3D PcdSet32S (PcdXhci, 0);

+    ASSERT_EFI_ERROR (Status);

+    Status =3D PcdSet32S (PcdPci, 0);

+    ASSERT_EFI_ERROR (Status);

+  }

+

   Size =3D sizeof (AssetTagVar);

   Status =3D gRT->GetVariable (L"AssetTag",

            &nb= sp;      &gConfigDxeFormSetGuid,

diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf b/Platfor= m/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf
index 544e3b3e10..aa0fbc7e25 100644
--- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf
+++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf
@@ -92,6 +92,9 @@
   gRaspberryPiTokenSpaceGuid.PcdRamLimitTo3GB

   gRaspberryPiTokenSpaceGuid.PcdFanOnGpio

   gRaspberryPiTokenSpaceGuid.PcdFanTemp

+  gRaspberryPiTokenSpaceGuid.PcdXhciPci

+  gRaspberryPiTokenSpaceGuid.PcdXhci

+  gRaspberryPiTokenSpaceGuid.PcdPci

 

 [Depex]

   gPcdProtocolGuid AND gRaspberryPiFirmwareProtocolGuid

diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni b/Plat= form/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni
index 2afe8f32ae..34efb82f57 100644
--- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni
+++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni
@@ -57,6 +57,11 @@
 #string STR_ADVANCED_FANTEMP_PROMPT   #language en-US "= ;ACPI fan temperature"

 #string STR_ADVANCED_FANTEMP_HELP     #language e= n-US "Cycle a fan at C"

 

+#string STR_ADVANCED_XHCIPCI_PROMPT   #language en-US "ACPI= XHCI/PCIe"

+#string STR_ADVANCED_XHCIPCI_HELP     #language en-US = "OS sees XHCI USB platform device or PCIe bridge"

+#string STR_ADVANCED_XHCIPCI_XHCI     #language en-US = "XHCI"

+#string STR_ADVANCED_XHCIPCI_PCIE     #language en-US = "PCIe"

+

 #string STR_ADVANCED_ASSET_TAG_PROMPT #language en-US "Asset Tag= "

 #string STR_ADVANCED_ASSET_TAG_HELP   #language en-US "= ;Set the system Asset Tag"

 

diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr b/Plat= form/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr
index de5e43471a..4d5876eb24 100644
--- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr
+++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr
@@ -56,6 +56,11 @@ formset
       name  =3D FanTemp,

       guid  =3D CONFIGDXE_FORM_SET_GUID= ;

 

+    efivarstore ADVANCED_XHCIPCI_VARSTORE_DATA,

+      attribute =3D EFI_VARIABLE_BOOTSERVICE_ACCE= SS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,

+      name  =3D XhciPci,

+      guid  =3D CONFIGDXE_FORM_SET_GUID;

+

     efivarstore SYSTEM_TABLE_MODE_VARSTORE_DATA,

       attribute =3D EFI_VARIABLE_BOOTSERVICE= _ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,

       name  =3D SystemTableMode,

@@ -207,6 +212,14 @@ formset
            &nb= sp;  default =3D 60,

           endnumeric;
         endif;

+

+        oneof varid =3D XhciPci.Value,<= br>
+            prompt&= nbsp;     =3D STRING_TOKEN(STR_ADVANCED_XHCIPCI_PROMPT)= ,

+            help&nb= sp;       =3D STRING_TOKEN(STR_ADVANCED_XHCIP= CI_HELP),

+            flags&n= bsp;      =3D NUMERIC_SIZE_4 | INTERACTIVE | RESET= _REQUIRED,

+            option = text =3D STRING_TOKEN(STR_ADVANCED_XHCIPCI_XHCI), value =3D 1, flags =3D DE= FAULT;

+            option = text =3D STRING_TOKEN(STR_ADVANCED_XHCIPCI_PCIE), value =3D 2, flags =3D 0;=

+        endoneof;

 #endif

         string varid =3D AssetTag.= AssetTag,

             pr= ompt  =3D STRING_TOKEN(STR_ADVANCED_ASSET_TAG_PROMPT),

diff --git a/Platform/RaspberryPi/Include/ConfigVars.h b/Platform/Raspberry= Pi/Include/ConfigVars.h
index c185bfe28b..eb08ad8987 100644
--- a/Platform/RaspberryPi/Include/ConfigVars.h
+++ b/Platform/RaspberryPi/Include/ConfigVars.h
@@ -77,6 +77,10 @@ typedef struct {
 } ADVANCED_FANTEMP_VARSTORE_DATA;

 

 typedef struct {

+  UINT32 Value;

+} ADVANCED_XHCIPCI_VARSTORE_DATA;

+

+typedef struct {

 #define SYSTEM_TABLE_MODE_ACPI 0

 #define SYSTEM_TABLE_MODE_BOTH 1

 #define SYSTEM_TABLE_MODE_DT   2

diff --git a/Platform/RaspberryPi/RPi3/RPi3.dsc b/Platform/RaspberryPi/RPi3= /RPi3.dsc
index 530b42796a..0aeb27d69d 100644
--- a/Platform/RaspberryPi/RPi3/RPi3.dsc
+++ b/Platform/RaspberryPi/RPi3/RPi3.dsc
@@ -514,6 +514,15 @@
 

   gRaspberryPiTokenSpaceGuid.PcdPlatformResetDelay|L"ResetD= elay"|gRaspberryPiTokenSpaceGuid|0x0|0

 

+  # Select XHCI/PCIe mode (not valid on rpi3)

+  #

+  # 0  - DISABLED

+  #

+  gRaspberryPiTokenSpaceGuid.PcdXhciPci|L"XhciPci"|gConfigD= xeFormSetGuid|0x0|0

+  # SSDT selectors

+  gRaspberryPiTokenSpaceGuid.PcdXhci|L"Xhci"|gConfigDxeForm= SetGuid|0x0|0

+  gRaspberryPiTokenSpaceGuid.PcdPci|L"Pci"|gConfigDxeFormSe= tGuid|0x0|0

+

   #

   # Common UEFI ones.

   #

diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc b/Platform/RaspberryPi/RPi4= /RPi4.dsc
index 0cd1014095..d5952288cc 100644
--- a/Platform/RaspberryPi/RPi4/RPi4.dsc
+++ b/Platform/RaspberryPi/RPi4/RPi4.dsc
@@ -528,6 +528,17 @@
 

   gRaspberryPiTokenSpaceGuid.PcdPlatformResetDelay|L"ResetD= elay"|gRaspberryPiTokenSpaceGuid|0x0|0

 

+  # Select XHCI/PCIe mode

+  #

+  # 0  - DISABLED (not valid for rpi4)

+  # 1  - Xhci Enabled (default)

+  # 2  - Pcie Enabled

+  #

+  gRaspberryPiTokenSpaceGuid.PcdXhciPci|L"XhciPci"|gConfigD= xeFormSetGuid|0x0|1

+  # SSDT selectors

+  gRaspberryPiTokenSpaceGuid.PcdXhci|L"Xhci"|gConfigDxeForm= SetGuid|0x0|1

+  gRaspberryPiTokenSpaceGuid.PcdPci|L"Pci"|gConfigDxeFormSe= tGuid|0x0|0

+

   #

   # Common UEFI ones.

   #

diff --git a/Platform/RaspberryPi/RaspberryPi.dec b/Platform/RaspberryPi/Ra= spberryPi.dec
index 10723036aa..6c7d4e5116 100644
--- a/Platform/RaspberryPi/RaspberryPi.dec
+++ b/Platform/RaspberryPi/RaspberryPi.dec
@@ -69,3 +69,6 @@
   gRaspberryPiTokenSpaceGuid.PcdFanOnGpio|0|UINT32|0x0000001C
   gRaspberryPiTokenSpaceGuid.PcdFanTemp|0|UINT32|0x0000001D

   gRaspberryPiTokenSpaceGuid.PcdPlatformResetDelay|0|UINT32|0x00= 00001E

+  gRaspberryPiTokenSpaceGuid.PcdXhci|0|UINT32|0x0000001F

+  gRaspberryPiTokenSpaceGuid.PcdPci|0|UINT32|0x00000020

+  gRaspberryPiTokenSpaceGuid.PcdXhciPci|0|UINT32|0x00000021

--
2.13.7



-=3D-=3D-=3D-=3D-=3D-=3D
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#70172): https://nam04.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fedk2.gr= oups.io%2Fg%2Fdevel%2Fmessage%2F70172&amp;data=3D04%7C01%7Cawarkentin%4= 0vmware.com%7Cd20ecaf0414040e6bc8608d8b7493732%7Cb39138ca3cee4b4aa4d6cd83d9= dd62f0%7C0%7C0%7C637460872386410651%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjA= wMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=3D= DqOzl1cgP82q9RDkTr3Ggu%2Bx5UxAFcQFbYyLTN08NJA%3D&amp;reserved=3D0 Mute This Topic: https://nam04.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fgroups.= io%2Fmt%2F79637124%2F4387333&amp;data=3D04%7C01%7Cawarkentin%40vmware.c= om%7Cd20ecaf0414040e6bc8608d8b7493732%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C= 0%7C0%7C637460872386410651%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQ= IjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=3DT1wTSzKlY= F1qqg89llDX3oFYg65Vj9cOeAISg1yP%2BMQ%3D&amp;reserved=3D0
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://nam04.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fedk2.gr= oups.io%2Fg%2Fdevel%2Funsub&amp;data=3D04%7C01%7Cawarkentin%40vmware.co= m%7Cd20ecaf0414040e6bc8608d8b7493732%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0= %7C0%7C637460872386410651%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQI= joiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=3DcFzGCSBPUD= EMGj%2B9QqSroDXp1WWZmFUSliapFxt182g%3D&amp;reserved=3D0 [awarkentin@vmware.com]
-=3D-=3D-=3D-=3D-=3D-=3D


--_000_SN7PR05MB75828483F1098CBCF503D262B98F9SN7PR05MB7582namp_--