From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (NAM10-BN7-obe.outbound.protection.outlook.com [40.107.92.61]) by mx.groups.io with SMTP id smtpd.web11.6046.1589008610350070257 for ; Sat, 09 May 2020 00:16:50 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@vmware.com header.s=selector2 header.b=RWY3sfCr; spf=pass (domain: vmware.com, ip: 40.107.92.61, mailfrom: awarkentin@vmware.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ybw/zTienssHd1KmgV0RF3TWoYF6rtGngHaPMFkrna/pvfr9RDZRAuCOYygn8Kn4ytvaFuLH7MfQL21Dh6QdMsXZyM2KdLyJ+cRQgCH79sauaJRbzSCtgCpG45L8ZQdyrc9ngu7rY06TVdbJMJ4Q1YvZO8dTo8aUX5IsO0FQfu1WefDlWNJnUKq8niE4iLreavn/rKD3c2B7Lk4WUhyU+rCiwCWrBT+WWkqfqja8r+EEGuakEdUGZ2HARfSaz2XctUbvDf74GBRqLYCDjXpwOInk966IKqggkUVS56b96xZi07WkMjBdsu+kVb/yb+p3gC4PWSuN3pAidco2Ltu4Dg== 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=2ce/kiom+rtR4EcSBV+W65gFFWvcj79L7EucfS1iDlI=; b=hO/URjUnQNS9kkRR3nvv4djh6xZ09Z5UJ+d5OyC/84GKA4aRZpSX/lrTZWrb/8Pka6H3Ha+IyuO/LwB24qPbR9FMENEiju1GDptXguqHHQkHhrVwGUGVi6wdVyq7MHiEnzi8JzWAkzX4M+AiYkuJAUYua0SM/ZiFMlHlVvqOILAd4VNvpI8b7P4CszXVY4av4HUIg1myNNUs8eZHSx4WTxjNNX6MMShIayjLnvI3PBamqSeOc6imTk547Lu3qFIBSTiFqNNiX5FqUeqD4p8/J3ivYhE7H/YlXxt32deQmnB6RZpNVr6qCMemcna/nepm2xbpeRm8lz4x18CaEvekLQ== 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=2ce/kiom+rtR4EcSBV+W65gFFWvcj79L7EucfS1iDlI=; b=RWY3sfCrJOmv72nW87WiuU2d8xMNR46PBp81NEUzTLqJDi/1PQXLh1I6Kw4JPPdiKpMUp3K87afiLES3AzFNDQhglgpj6cd93zYs7vVM5n1DtWnNS1n5si7N8oW6q/SAajEXRd1fENUlNuYmecM3WB7Q95e67ZeZQ6thIsDAnVM= Received: from BN6PR05MB3411.namprd05.prod.outlook.com (2603:10b6:405:43::23) by BN6PR05MB3187.namprd05.prod.outlook.com (2603:10b6:404:be::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.11; Sat, 9 May 2020 07:16:47 +0000 Received: from BN6PR05MB3411.namprd05.prod.outlook.com ([fe80::f463:db64:43d8:5a0f]) by BN6PR05MB3411.namprd05.prod.outlook.com ([fe80::f463:db64:43d8:5a0f%3]) with mapi id 15.20.3000.014; Sat, 9 May 2020 07:16:47 +0000 From: "Andrei Warkentin" To: "devel@edk2.groups.io" , "ard.biesheuvel@arm.com" CC: "leif@nuviainc.com" , "pete@akeo.ie" , "philmd@redhat.com" , Andrei Warkentin Subject: Re: [edk2-devel] [edk2-platforms][PATCH 1/1] RPi: allow selecting which system config tables are exposed Thread-Topic: [edk2-devel] [edk2-platforms][PATCH 1/1] RPi: allow selecting which system config tables are exposed Thread-Index: AQHWI0GnYlo9OzPr50ialS+csP0YqKiam3yAgADFkdKAA/qBkQ== Date: Sat, 9 May 2020 07:16:47 +0000 Message-ID: References: <20200506005929.84361-1-andrey.warkentin@gmail.com>,,<160C83BCD8110E81.4282@groups.io> In-Reply-To: <160C83BCD8110E81.4282@groups.io> 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: [98.214.99.181] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: acc44a53-6868-4a6a-1477-08d7f3e8efd5 x-ms-traffictypediagnostic: BN6PR05MB3187: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7219; x-forefront-prvs: 03982FDC1D x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Mk2lo9W7iJO8kWo43GKo+Nnezu/rpNFz3cm8uc5geQMGtAIgcea2vcyfLiuDmu8kWawyr3gD6IHG53a/ih54UYFpMmU6o+FnaSwFjpXAsCmVX6gMMuilyBjVZPG3/5JFkmyQlag/clNbjQK45d4E2RKvZMU9EsbjZa0mp6Rc6JSnt02tKYslG2cWWsOvQze4EN/yurssZ8SDGMbvG9fypk2ByNW481Q/O7X5QHqVnaWBEjC8XMibybeFAwznqAix1QA2RS9S88EqcvZFuhvuSlnzkwZucu44fcJH78RuXVsvyakRTy5Pwk5nyxoiUwbZkASTT9rfZAUy7vdgw90AhK6TtQZqPaOt6BUokroEXEWSt7hFi2ADbDXU4P9mUho0U1E/kLEmQKjMPakLY764PJgOjpICVUXwBHMrpje9VICVAAP0W5OsSqoZC0xhgCqF6mmzP8BQKxSlBS0x+08LP15gUIurvZQbLmO52jOCgg0o7RwRIrso8S/+mWUGwnGARi0eAfQd/+xivuuip4HM4eUBwNzonMX3TQeD9SG0goUD3+NzGepg/KIdX7qVyqhSS6GDQR9bebgVBXj6/IAQtMI0WMiNb4OB7WZc1G7wFlA= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN6PR05MB3411.namprd05.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(366004)(346002)(396003)(136003)(376002)(39860400002)(33430700001)(19627235002)(110136005)(19627405001)(76236002)(4326008)(2906002)(33656002)(66556008)(66446008)(8936002)(64756008)(66476007)(71200400001)(66946007)(86362001)(966005)(30864003)(7696005)(52536014)(478600001)(76116006)(166002)(6506007)(45080400002)(8676002)(55016002)(186003)(66574014)(316002)(54906003)(26005)(33440700001)(5660300002)(53546011)(9686003);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata: 8OyBRKzQsF23t3PfqpRtR6YS1cP6cO+So0aRFTljFtRQ/5/nzELDLa7GTu6TpCUex02PHwXM5J/O/wf5RmPSWrPreh6gYe9XpOksr8MLYg6Q06mqWmplXWwp/UmC2jD4AKLKyq27L3lyHjKuscuLhvGqmQBSoyzcMrhBW188XUr7+NdHEsrq+gT8L/Zy63Tb0vgaL/PZS8aIjO4w5LQqwTVQZgsDWcnVWtvCH7dZEQcRd0VN2NjHjlfpVI1sab1qJ3UxYqc0uLC3v5UMPhIa9AbpaySsI9HdF0FQvEnKnJOpqsgKsW7+ZP0Tg5UNI/45gLZUsFHrXwkMTSR883iVpHaxT4t2Tk1VuIp0v5J/gPg9tAg8HQf1o4Mn/qVMaGk4oKzBVO1WMt6XdxBkVZ8WBHjTrMgjQqL2GcLXeimw3+vZDrw/j4Aj7Kdv17gpdbhtGeiwxvjDVzY1irdmlci72hK8gmi6+ke3G+o+prsuMoE= x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-Network-Message-Id: acc44a53-6868-4a6a-1477-08d7f3e8efd5 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 May 2020 07:16:47.6776 (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: mIseAVleqcg+VvmXlnJ+Irg+08P2xKxOIEhyyRm7l8VPnCIc/7Jo5XDb3Z6LW7fqKc2C4bU38CBod/7ObZej3w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR05MB3187 Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_BN6PR05MB34118B7410495682723F401AB9A30BN6PR05MB3411namp_" --_000_BN6PR05MB34118B7410495682723F401AB9A30BN6PR05MB3411namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Acting out on the request, I'm having second thoughts and wanted to get fee= dback. The current behavior is "both" ACPI and DT get exposed today. I'd rather n= ot remove that option (or make it non-default) as it's just going to annoy = users - say, both the Pi 3 users running WoA (e.g. why are you defaulting t= o DT?) and the Pi 4 users running Linux/BSD via DT. And you can flip the de= faults and it won't matter since someone somewhere will have relied on the = ability of the current firmware to present whatever systab they expected. Sigh. Can I keep all 3 options? Default is still ACPI + DT, but have only ACPI a= nd only DT? These last two are more for validation/development. This really= is a replay of MPS/ACPI all over again... A ________________________________ From: devel@edk2.groups.io on behalf of Andrei Wark= entin via groups.io Sent: Wednesday, May 6, 2020 1:26 PM To: Andrei Warkentin ; devel@edk2.groups.io ; ard.biesheuvel@arm.com Cc: leif@nuviainc.com ; pete@akeo.ie ; ph= ilmd@redhat.com Subject: Re: [edk2-devel] [edk2-platforms][PATCH 1/1] RPi: allow selecting= which system config tables are exposed Ok that sounds reasonable to me. I'll remove the "both" option entirely. A ________________________________ From: devel@edk2.groups.io on behalf of Ard Biesheu= vel via groups.io Sent: Wednesday, May 6, 2020 1:38 AM To: Andrei Warkentin ; devel@edk2.groups.io Cc: leif@nuviainc.com ; pete@akeo.ie ; ph= ilmd@redhat.com Subject: Re: [edk2-devel] [edk2-platforms][PATCH 1/1] RPi: allow selecting= which system config tables are exposed On 5/6/20 2:59 AM, Andrei Warkentin wrote: > Today we just have an option to hide DT entirely, while ACPI > is always exposed. This change extends the option to > provide all three choices: > - ACPI only > - ACPI + DT > - DT only > > Why? Because not all OSes will prefer DT over ACPI when both are availab= le. > > To do this cleanly, move the variable structure and value definitions > into a separate header, ConfigVars.h. > > Signed-off-by: Andrei Warkentin I'd prefer it if DT and ACPI were mutually exclusive, so that it is never left up to the OS to reason about which one is the correct one. This aligns with other platforms we have in the tree. > --- > Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 20 +-- > Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf | 2 +- > Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni | 9 +- > Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr | 146 ++------= ------------ > Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.c | 6 +- > Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.inf | 2 +- > Platform/RaspberryPi/Include/ConfigVars.h | 131 ++++++++= ++++++++++ > Platform/RaspberryPi/RPi3/RPi3.dsc | 4 +- > Platform/RaspberryPi/RPi4/RPi4.dsc | 4 +- > Platform/RaspberryPi/RaspberryPi.dec | 2 +- > 10 files changed, 171 insertions(+), 155 deletions(-) > > diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platfo= rm/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c > index c90c2530..00867879 100644 > --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c > +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c > @@ -22,6 +22,7 @@ > #include > #include > #include > +#include > #include "ConfigDxeFormSetGuid.h" > > #define FREQ_1_MHZ 1000000 > @@ -154,11 +155,11 @@ SetupVariables ( > } > > Size =3D sizeof (UINT32); > - Status =3D gRT->GetVariable (L"OptDeviceTree", > + Status =3D gRT->GetVariable (L"SystemTableMode", > &gConfigDxeFormSetGuid, > NULL, &Size, &Var32); > if (EFI_ERROR (Status)) { > - PcdSet32 (PcdOptDeviceTree, PcdGet32 (PcdOptDeviceTree)); > + PcdSet32 (PcdSystemTableMode, PcdGet32 (PcdSystemTableMode)); > } > > Size =3D sizeof (UINT32); > @@ -259,10 +260,10 @@ ApplyVariables ( > UINT64 SystemMemorySize; > > switch (CpuClock) { > - case 0: // Low > + case CHIPSET_CPU_CLOCK_LOW: > Rate =3D FixedPcdGet32 (PcdCpuLowSpeedMHz) * FREQ_1_MHZ; > break; > - case 1: // Default > + case CHIPSET_CPU_CLOCK_DEFAULT: > /* > * What the Raspberry Pi Foundation calls "max clock rate" is real= ly the default value > * from: https://nam04.safelinks.protection.outlook.com/?url=3Dhtt= ps%3A%2F%2Fwww.raspberrypi.org%2Fdocumentation%2Fconfiguration%2Fconfig-txt= %2Foverclocking.md&data=3D02%7C01%7Cawarkentin%40vmware.com%7Cc02f0ea36= 53949b6847c08d7f1882716%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637243= 439445722301&sdata=3DBQl1mDfJ3Yt6YB%2FQGs6z6DoQ%2BQEiuGTuBAhIvsYrZ0w%3D= &reserved=3D0 > @@ -272,10 +273,10 @@ ApplyVariables ( > DEBUG ((DEBUG_ERROR, "Couldn't read default CPU speed %r\n", Sta= tus)); > } > break; > - case 2: // Max > + case CHIPSET_CPU_CLOCK_MAX: > Rate =3D FixedPcdGet32 (PcdCpuMaxSpeedMHz) * FREQ_1_MHZ; > break; > - case 3: // Custom > + case CHIPSET_CPU_CLOCK_CUSTOM: > Rate =3D CustomCpuClock * FREQ_1_MHZ; > break; > } > @@ -487,8 +488,11 @@ ConfigInitialize ( > DEBUG ((DEBUG_ERROR, "Couldn't install ConfigDxe configuration pag= es: %r\n", Status)); > } > > - Status =3D LocateAndInstallAcpiFromFv (&mAcpiTableFile); > - ASSERT_EFI_ERROR (Status); > + if (PcdGet32 (PcdSystemTableMode) =3D=3D SYSTEM_TABLE_MODE_ACPI || > + PcdGet32 (PcdSystemTableMode) =3D=3D SYSTEM_TABLE_MODE_BOTH) { > + Status =3D LocateAndInstallAcpiFromFv (&mAcpiTableFile); > + ASSERT_EFI_ERROR (Status); > + } > > return EFI_SUCCESS; > } > diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf b/Plat= form/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf > index 57963baf..e47f3af6 100644 > --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf > +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf > @@ -77,7 +77,7 @@ > gRaspberryPiTokenSpaceGuid.PcdDebugShowUEFIExit > gRaspberryPiTokenSpaceGuid.PcdDisplayEnableScaledVModes > gRaspberryPiTokenSpaceGuid.PcdDisplayEnableSShot > - gRaspberryPiTokenSpaceGuid.PcdOptDeviceTree > + gRaspberryPiTokenSpaceGuid.PcdSystemTableMode > gRaspberryPiTokenSpaceGuid.PcdRamMoreThan3GB > gRaspberryPiTokenSpaceGuid.PcdRamLimitTo3GB > > diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni b/P= latform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni > index 07660072..7195e497 100644 > --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni > +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni > @@ -41,10 +41,11 @@ > #string STR_ADVANCED_3GB_OFF #language en-US "Disabled" > #string STR_ADVANCED_3GB_ON #language en-US "Enabled" > > -#string STR_ADVANCED_DT_PROMPT #language en-US "Device Tree" > -#string STR_ADVANCED_DT_HELP #language en-US "Disable this opti= on to force OSes such as GNU/Linux to use ACPI" > -#string STR_ADVANCED_DT_OFF #language en-US "Disabled (Force A= CPI)" > -#string STR_ADVANCED_DT_ON #language en-US "Enabled" > +#string STR_ADVANCED_SYSTAB_PROMPT #language en-US "System Table Sele= ction" > +#string STR_ADVANCED_SYSTAB_HELP #language en-US "ACPI/DT choice fo= r specific OSes" > +#string STR_ADVANCED_SYSTAB_ACPI #language en-US "ACPI" > +#string STR_ADVANCED_SYSTAB_BOTH #language en-US "ACPI + Devicetree= " > +#string STR_ADVANCED_SYSTAB_DT #language en-US "Devicetree" > > /* > * MMC/SD configuration. > diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr b/P= latform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr > index 0a650a94..72cc90ae 100644 > --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr > +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr > @@ -8,128 +8,7 @@ > > #include > #include "ConfigDxeFormSetGuid.h" > - > -#pragma pack(1) > -typedef struct { > - /* > - * One bit for each scaled resolution supported, > - * these are ordered exactly like mGopModeData > - * in DisplayDxe. > - * > - * 800x600, 640x480, 1024x768, 720p, 1080p, native. > - */ > - UINT8 v640 : 1; > - UINT8 v800 : 1; > - UINT8 v1024 : 1; > - UINT8 v720p : 1; > - UINT8 v1080p : 1; > - UINT8 Physical : 1; > -} DISPLAY_ENABLE_SCALED_VMODES_VARSTORE_DATA; > -#pragma pack() > - > -typedef struct { > - /* > - * 0 - No screenshot support. > - * 1 - Screenshot support via hotkey. > - */ > - UINT32 Enable; > -} DISPLAY_ENABLE_SSHOT_VARSTORE_DATA; > - > -typedef struct { > - /* > - * 0 - No JTAG. > - * 1 - JTAG mode. > - */ > - UINT32 Enable; > -} DEBUG_ENABLE_JTAG_VARSTORE_DATA; > - > -typedef struct { > - /* > - * 0 - Don't show UEFI exit message. > - * 1 - Show UEFI exit message. > - */ > - UINT32 Show; > -} DEBUG_SHOW_UEFI_EXIT_VARSTORE_DATA; > - > -typedef struct { > - /* > - * 0 - low. > - * 1 - default. > - * 2 - maximum. > - * 3 - custom. > - */ > - UINT32 Clock; > -} CHIPSET_CPU_CLOCK_VARSTORE_DATA; > - > -typedef struct { > - UINT32 Clock; > -} CHIPSET_CUSTOM_CPU_CLOCK_VARSTORE_DATA; > - > -typedef struct { > - /* > - * Always set by ConfigDxe prior to HII init to reflect > - * platform capability. > - */ > - UINT32 Supported; > -} ADVANCED_RAM_MORE_THAN_3GB_VARSTORE_DATA; > - > -typedef struct { > - UINT32 Enabled; > -} ADVANCED_RAM_LIMIT_TO_3GB_VARSTORE_DATA; > - > -typedef struct { > - /* > - * 0 - Do not provide a Device Tree to the OS > - * 1 - Provide a Device Tree to the OS > - */ > - UINT32 Enabled; > -} ADVANCED_DEVICE_TREE_VARSTORE_DATA; > - > -typedef struct { > - /* > - * 0 - uSD slot routed to Broadcom SDHOST on Pi 3 or eMMC2 on Pi 4. > - * 1 - uSD slot routed to Arasan SDHCI. > - */ > - UINT32 Routing; > -} MMC_SD_VARSTORE_DATA; > - > -typedef struct { > - /* > - * 0 - Don't disable multi-block. > - * 1 - Disable multi-block commands. > - */ > - UINT32 DisableMulti; > -} MMC_DISMULTI_VARSTORE_DATA; > - > -typedef struct { > - /* > - * 0 - Don't force 1 bit mode. > - * 1 - Force 1 bit mode. > - */ > - UINT32 Force1Bit; > -} MMC_FORCE1BIT_VARSTORE_DATA; > - > -typedef struct { > - /* > - * 0 - Don't force default speed. > - * 1 - Force default speed. > - */ > - UINT32 ForceDS; > -} MMC_FORCEDS_VARSTORE_DATA; > - > -typedef struct { > - /* > - * Default Speed MHz override (25MHz default). > - */ > - UINT32 MHz; > -} MMC_SD_DS_MHZ_VARSTORE_DATA; > - > -typedef struct { > - /* > - * High Speed MHz override (50MHz default). > - */ > - UINT32 MHz; > -} MMC_SD_HS_MHZ_VARSTORE_DATA; > +#include > > // > // EFI Variable attributes > @@ -165,9 +44,9 @@ formset > name =3D RamLimitTo3GB, > guid =3D CONFIGDXE_FORM_SET_GUID; > > - efivarstore ADVANCED_DEVICE_TREE_VARSTORE_DATA, > + efivarstore SYSTEM_TABLE_MODE_VARSTORE_DATA, > attribute =3D EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUN= TIME_ACCESS | EFI_VARIABLE_NON_VOLATILE, > - name =3D OptDeviceTree, > + name =3D SystemTableMode, > guid =3D CONFIGDXE_FORM_SET_GUID; > > efivarstore MMC_SD_VARSTORE_DATA, > @@ -253,10 +132,10 @@ formset > prompt =3D STRING_TOKEN(STR_CHIPSET_CLOCK_CPU_PROMPT)= , > help =3D STRING_TOKEN(STR_CHIPSET_CLOCK_CPU_HELP), > flags =3D NUMERIC_SIZE_4 | INTERACTIVE | RESET_REQUI= RED, > - option text =3D STRING_TOKEN(STR_CHIPSET_CLOCK_CPU_LOW), va= lue =3D 0, flags =3D 0; > - option text =3D STRING_TOKEN(STR_CHIPSET_CLOCK_CPU_DEF), va= lue =3D 1, flags =3D DEFAULT; > - option text =3D STRING_TOKEN(STR_CHIPSET_CLOCK_CPU_MAX), va= lue =3D 2, flags =3D 0; > - option text =3D STRING_TOKEN(STR_CHIPSET_CLOCK_CPU_CUSTOM),= value =3D 3, flags =3D 0; > + option text =3D STRING_TOKEN(STR_CHIPSET_CLOCK_CPU_LOW), va= lue =3D CHIPSET_CPU_CLOCK_LOW, flags =3D 0; > + option text =3D STRING_TOKEN(STR_CHIPSET_CLOCK_CPU_DEF), va= lue =3D CHIPSET_CPU_CLOCK_DEFAULT, flags =3D DEFAULT; > + option text =3D STRING_TOKEN(STR_CHIPSET_CLOCK_CPU_MAX), va= lue =3D CHIPSET_CPU_CLOCK_MAX, flags =3D 0; > + option text =3D STRING_TOKEN(STR_CHIPSET_CLOCK_CPU_CUSTOM),= value =3D CHIPSET_CPU_CLOCK_CUSTOM, flags =3D 0; > endoneof; > > grayoutif NOT ideqval CpuClock.Clock =3D=3D 3; > @@ -285,12 +164,13 @@ formset > endoneof; > endif; > > - oneof varid =3D OptDeviceTree.Enabled, > - prompt =3D STRING_TOKEN(STR_ADVANCED_DT_PROMPT), > - help =3D STRING_TOKEN(STR_ADVANCED_DT_HELP), > + oneof varid =3D SystemTableMode.Mode, > + prompt =3D STRING_TOKEN(STR_ADVANCED_SYSTAB_PROMPT), > + help =3D STRING_TOKEN(STR_ADVANCED_SYSTAB_HELP), > flags =3D NUMERIC_SIZE_4 | INTERACTIVE | RESET_REQUI= RED, > - option text =3D STRING_TOKEN(STR_ADVANCED_DT_OFF), value = =3D 0, flags =3D 0; > - option text =3D STRING_TOKEN(STR_ADVANCED_DT_ON), value =3D= 1, flags =3D DEFAULT; > + option text =3D STRING_TOKEN(STR_ADVANCED_SYSTAB_ACPI), val= ue =3D SYSTEM_TABLE_MODE_ACPI, flags =3D 0; > + option text =3D STRING_TOKEN(STR_ADVANCED_SYSTAB_BOTH), val= ue =3D SYSTEM_TABLE_MODE_BOTH, flags =3D DEFAULT; > + option text =3D STRING_TOKEN(STR_ADVANCED_SYSTAB_DT), value= =3D SYSTEM_TABLE_MODE_DT, flags =3D DEFAULT; > endoneof; > endform; > > diff --git a/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.c b/Platform/Ras= pberryPi/Drivers/FdtDxe/FdtDxe.c > index cb11256e..0472d8ec 100644 > --- a/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.c > +++ b/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.c > @@ -15,10 +15,9 @@ > #include > #include > #include > - > #include > - > #include > +#include > > STATIC VOID *mFdtImage; > > @@ -356,7 +355,8 @@ FdtDxeInitialize ( > UINTN FdtSize; > VOID *FdtImage =3D NULL; > > - if (PcdGet32 (PcdOptDeviceTree) =3D=3D 0) { > + if (PcdGet32 (PcdSystemTableMode) !=3D SYSTEM_TABLE_MODE_BOTH && > + PcdGet32 (PcdSystemTableMode) !=3D SYSTEM_TABLE_MODE_DT) { > DEBUG ((DEBUG_INFO, "Device Tree disabled per user configuration\n= ")); > return EFI_SUCCESS; > } > diff --git a/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.inf b/Platform/R= aspberryPi/Drivers/FdtDxe/FdtDxe.inf > index 49ba5ba1..26f84e59 100644 > --- a/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.inf > +++ b/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.inf > @@ -46,4 +46,4 @@ > gRaspberryPiTokenSpaceGuid.PcdFdtBaseAddress > > [Pcd] > - gRaspberryPiTokenSpaceGuid.PcdOptDeviceTree > + gRaspberryPiTokenSpaceGuid.PcdSystemTableMode > diff --git a/Platform/RaspberryPi/Include/ConfigVars.h b/Platform/Raspbe= rryPi/Include/ConfigVars.h > new file mode 100644 > index 00000000..28837f98 > --- /dev/null > +++ b/Platform/RaspberryPi/Include/ConfigVars.h > @@ -0,0 +1,131 @@ > +/** @file > + * > + * Copyright (c) 2020, Andrei Warkentin > + * > + * SPDX-License-Identifier: BSD-2-Clause-Patent > + * > + **/ > + > +#ifndef CONFIG_VARS_H > +#define CONFIG_VARS_H > + > +#pragma pack(1) > +typedef struct { > + /* > + * One bit for each scaled resolution supported, > + * these are ordered exactly like mGopModeData > + * in DisplayDxe. > + * > + * 800x600, 640x480, 1024x768, 720p, 1080p, native. > + */ > + UINT8 v640 : 1; > + UINT8 v800 : 1; > + UINT8 v1024 : 1; > + UINT8 v720p : 1; > + UINT8 v1080p : 1; > + UINT8 Physical : 1; > +} DISPLAY_ENABLE_SCALED_VMODES_VARSTORE_DATA; > +#pragma pack() > + > +typedef struct { > + /* > + * 0 - No screenshot support. > + * 1 - Screenshot support via hotkey. > + */ > + UINT32 Enable; > +} DISPLAY_ENABLE_SSHOT_VARSTORE_DATA; > + > +typedef struct { > + /* > + * 0 - No JTAG. > + * 1 - JTAG mode. > + */ > + UINT32 Enable; > +} DEBUG_ENABLE_JTAG_VARSTORE_DATA; > + > +typedef struct { > + /* > + * 0 - Don't show UEFI exit message. > + * 1 - Show UEFI exit message. > + */ > + UINT32 Show; > +} DEBUG_SHOW_UEFI_EXIT_VARSTORE_DATA; > + > +typedef struct { > +#define CHIPSET_CPU_CLOCK_LOW 0 > +#define CHIPSET_CPU_CLOCK_DEFAULT 1 > +#define CHIPSET_CPU_CLOCK_MAX 2 > +#define CHIPSET_CPU_CLOCK_CUSTOM 3 > + UINT32 Clock; > +} CHIPSET_CPU_CLOCK_VARSTORE_DATA; > + > +typedef struct { > + UINT32 Clock; > +} CHIPSET_CUSTOM_CPU_CLOCK_VARSTORE_DATA; > + > +typedef struct { > + /* > + * Always set by ConfigDxe prior to HII init to reflect > + * platform capability. > + */ > + UINT32 Supported; > +} ADVANCED_RAM_MORE_THAN_3GB_VARSTORE_DATA; > + > +typedef struct { > + UINT32 Enabled; > +} ADVANCED_RAM_LIMIT_TO_3GB_VARSTORE_DATA; > + > +typedef struct { > +#define SYSTEM_TABLE_MODE_ACPI 0 > +#define SYSTEM_TABLE_MODE_BOTH 1 > +#define SYSTEM_TABLE_MODE_DT 2 > + UINT32 Mode; > +} SYSTEM_TABLE_MODE_VARSTORE_DATA; > + > +typedef struct { > + /* > + * 0 - uSD slot routed to Broadcom SDHOST on Pi 3 or eMMC2 on Pi 4. > + * 1 - uSD slot routed to Arasan SDHCI. > + */ > + UINT32 Routing; > +} MMC_SD_VARSTORE_DATA; > + > +typedef struct { > + /* > + * 0 - Don't disable multi-block. > + * 1 - Disable multi-block commands. > + */ > + UINT32 DisableMulti; > +} MMC_DISMULTI_VARSTORE_DATA; > + > +typedef struct { > + /* > + * 0 - Don't force 1 bit mode. > + * 1 - Force 1 bit mode. > + */ > + UINT32 Force1Bit; > +} MMC_FORCE1BIT_VARSTORE_DATA; > + > +typedef struct { > + /* > + * 0 - Don't force default speed. > + * 1 - Force default speed. > + */ > + UINT32 ForceDS; > +} MMC_FORCEDS_VARSTORE_DATA; > + > +typedef struct { > + /* > + * Default Speed MHz override (25MHz default). > + */ > + UINT32 MHz; > +} MMC_SD_DS_MHZ_VARSTORE_DATA; > + > +typedef struct { > + /* > + * High Speed MHz override (50MHz default). > + */ > + UINT32 MHz; > +} MMC_SD_HS_MHZ_VARSTORE_DATA; > + > +#endif /* CONFIG_VARS_H */ > diff --git a/Platform/RaspberryPi/RPi3/RPi3.dsc b/Platform/RaspberryPi/R= Pi3/RPi3.dsc > index 563fb891..721b8c20 100644 > --- a/Platform/RaspberryPi/RPi3/RPi3.dsc > +++ b/Platform/RaspberryPi/RPi3/RPi3.dsc > @@ -481,9 +481,9 @@ > gRaspberryPiTokenSpaceGuid.PcdRamLimitTo3GB|L"RamLimitTo3GB"|gConfig= DxeFormSetGuid|0x0|0 > > # > - # Device Tree > + # Device Tree and ACPI selection. > # > - gRaspberryPiTokenSpaceGuid.PcdOptDeviceTree|L"OptDeviceTree"|gConfigD= xeFormSetGuid|0x0|1 > + gRaspberryPiTokenSpaceGuid.PcdSystemTableMode|L"SystemTableMode"|gCon= figDxeFormSetGuid|0x0|1 > > # > # Common UEFI ones. > diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc b/Platform/RaspberryPi/R= Pi4/RPi4.dsc > index 4deccd9d..c9ab999a 100644 > --- a/Platform/RaspberryPi/RPi4/RPi4.dsc > +++ b/Platform/RaspberryPi/RPi4/RPi4.dsc > @@ -496,9 +496,9 @@ > gRaspberryPiTokenSpaceGuid.PcdRamLimitTo3GB|L"RamLimitTo3GB"|gConfig= DxeFormSetGuid|0x0|1 > > # > - # Device Tree > + # Device Tree and ACPI selection. > # > - gRaspberryPiTokenSpaceGuid.PcdOptDeviceTree|L"OptDeviceTree"|gConfigD= xeFormSetGuid|0x0|0 > + gRaspberryPiTokenSpaceGuid.PcdSystemTableMode|L"SystemTableMode"|gCon= figDxeFormSetGuid|0x0|0 > > # > # Common UEFI ones. > diff --git a/Platform/RaspberryPi/RaspberryPi.dec b/Platform/RaspberryPi= /RaspberryPi.dec > index 66ef6186..1a3c44e0 100644 > --- a/Platform/RaspberryPi/RaspberryPi.dec > +++ b/Platform/RaspberryPi/RaspberryPi.dec > @@ -65,6 +65,6 @@ > gRaspberryPiTokenSpaceGuid.PcdCustomCpuClock|0|UINT32|0x00000016 > gRaspberryPiTokenSpaceGuid.PcdDisplayEnableScaledVModes|0x3F|UINT8|0= x00000017 > gRaspberryPiTokenSpaceGuid.PcdDisplayEnableSShot|0|UINT32|0x00000018 > - gRaspberryPiTokenSpaceGuid.PcdOptDeviceTree|1|UINT32|0x0000001B > + gRaspberryPiTokenSpaceGuid.PcdSystemTableMode|1|UINT32|0x0000001B > gRaspberryPiTokenSpaceGuid.PcdRamMoreThan3GB|0|UINT32|0x00000019 > gRaspberryPiTokenSpaceGuid.PcdRamLimitTo3GB|0|UINT32|0x0000001A > --_000_BN6PR05MB34118B7410495682723F401AB9A30BN6PR05MB3411namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
Acting out on the request, I'm having second thoughts and wanted to get fe= edback.

The current behavior is "both" ACPI and DT get exposed today. I'= d rather not remove that option (or make it non-default) as it's just going= to annoy users - say, both the Pi 3 users running WoA (e.g. why are you de= faulting to DT?) and the Pi 4 users running Linux/BSD via DT. And you can flip the defaults and it won't matter since= someone somewhere will have relied on the ability of the current firmware = to present whatever systab they expected.

Sigh.

Can I keep all 3 options? Default is still ACPI + DT, but have only AC= PI and only DT? These last two are more for validation/development. This re= ally is a replay of MPS/ACPI all over again...

A

From: devel@edk2.groups.io= <devel@edk2.groups.io> on behalf of Andrei Warkentin via groups.io &= lt;awarkentin=3Dvmware.com@groups.io>
Sent: Wednesday, May 6, 2020 1:26 PM
To: Andrei Warkentin <andrey.warkentin@gmail.com>; devel@edk2= .groups.io <devel@edk2.groups.io>; ard.biesheuvel@arm.com <ard.bie= sheuvel@arm.com>
Cc: leif@nuviainc.com <leif@nuviainc.com>; pete@akeo.ie <p= ete@akeo.ie>; philmd@redhat.com <philmd@redhat.com>
Subject: Re: [edk2-devel] [edk2-platforms][PATCH 1/1] RPi: allow se= lecting which system config tables are exposed
 
Ok that sounds reasonable to me. I'll remove the "both" option e= ntirely.

A

From: devel@edk2.groups.= io <devel@edk2.groups.io> on behalf of Ard Biesheuvel via groups.io &= lt;ard.biesheuvel=3Darm.com@groups.io>
Sent: Wednesday, May 6, 2020 1:38 AM
To: Andrei Warkentin <andrey.warkentin@gmail.com>; devel@edk2= .groups.io <devel@edk2.groups.io>
Cc: leif@nuviainc.com <leif@nuviainc.com>; pete@akeo.ie <p= ete@akeo.ie>; philmd@redhat.com <philmd@redhat.com>
Subject: Re: [edk2-devel] [edk2-platforms][PATCH 1/1] RPi: allow se= lecting which system config tables are exposed
 
On 5/6/20 2:59 AM, Andrei Warkentin wrote:
> Today we just have an option to hide DT entirely, while ACPI
> is always exposed. This change extends the option to
> provide all three choices:
> - ACPI only
> - ACPI + DT
> - DT only
>
> Why? Because not all OSes will prefer DT over ACPI when both are avai= lable.
>
> To do this cleanly, move the variable structure and value definitions=
> into a separate header, ConfigVars.h.
>
> Signed-off-by: Andrei Warkentin <andrey.warkentin@gmail.com>
I'd prefer it if DT and ACPI were mutually exclusive, so that it is
never left up to the OS to reason about which one is the correct one.

This aligns with other platforms we have in the tree.

> ---
>   Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c &= nbsp;    |  20 +--
>   Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf = ;   |   2 +-
>   Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni |=    9 +-
>   Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr |= 146 ++------------------
>   Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.c  &= nbsp;         |   6 += -
>   Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.inf  = ;        |   2 +-
>   Platform/RaspberryPi/Include/ConfigVars.h  &nbs= p;            | 131 = +++++++++++++++= +++
>   Platform/RaspberryPi/RPi3/RPi3.dsc    = ;            &n= bsp;     |   4 +-
>   Platform/RaspberryPi/RPi4/RPi4.dsc    = ;            &n= bsp;     |   4 +-
>   Platform/RaspberryPi/RaspberryPi.dec   &nb= sp;            =     |   2 +-
>   10 files changed, 171 insertions(+), 155 deletions(-)=
>
> diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Pla= tform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
> index c90c2530..00867879 100644
> --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
> +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c<= br> > @@ -22,6 +22,7 @@
>   #include <IndustryStandard/Bcm2836Gpio.h>
>   #include <Library/GpioLib.h>
>   #include <Protocol/RpiFirmware.h>
> +#include <ConfigVars.h>
>   #include "ConfigDxeFormSetGuid.h"
>  
>   #define FREQ_1_MHZ 1000000
> @@ -154,11 +155,11 @@ SetupVariables (
>     }
>  
>     Size =3D sizeof (UINT32);
> -  Status =3D gRT->GetVariable (L"OptDeviceTree", > +  Status =3D gRT->GetVariable (L"SystemTableMode&qu= ot;,
>           &nbs= p;         &gConfigDxeFormSetGu= id,
>           &nbs= p;         NULL, &Size, &Va= r32);
>     if (EFI_ERROR (Status)) {
> -    PcdSet32 (PcdOptDeviceTree, PcdGet32 (PcdOptDevic= eTree));
> +    PcdSet32 (PcdSystemTableMode, PcdGet32 (PcdSy= stemTableMode));
>     }
>  
>     Size =3D sizeof (UINT32);
> @@ -259,10 +260,10 @@ ApplyVariables (
>     UINT64 SystemMemorySize;
>  
>     switch (CpuClock) {
> -  case 0: // Low
> +  case CHIPSET_CPU_CLOCK_LOW:
>       Rate =3D FixedPcdGet32 (PcdCpuLow= SpeedMHz) * FREQ_1_MHZ;
>       break;
> -  case 1: // Default
> +  case CHIPSET_CPU_CLOCK_DEFAULT:
>       /*
>        * What the Raspberry Pi Fou= ndation calls "max clock rate" is really the default value
>        * from: https://nam04.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fwww.ra= spberrypi.org%2Fdocumentation%2Fconfiguration%2Fconfig-txt%2Foverclocking.m= d&amp;data=3D02%7C01%7Cawarkentin%40vmware.com%7Cc02f0ea3653949b6847c08= d7f1882716%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637243439445722301&= amp;amp;sdata=3DBQl1mDfJ3Yt6YB%2FQGs6z6DoQ%2BQEiuGTuBAhIvsYrZ0w%3D&amp;= reserved=3D0
> @@ -272,10 +273,10 @@ ApplyVariables (
>         DEBUG ((DEBUG_ERROR, = "Couldn't read default CPU speed %r\n", Status));
>       }
>       break;
> -  case 2: // Max
> +  case CHIPSET_CPU_CLOCK_MAX:
>       Rate =3D FixedPcdGet32 (PcdCpuMax= SpeedMHz) * FREQ_1_MHZ;
>       break;
> -  case 3: // Custom
> +  case CHIPSET_CPU_CLOCK_CUSTOM:
>       Rate =3D CustomCpuClock * FREQ_1_= MHZ;
>       break;
>     }
> @@ -487,8 +488,11 @@ ConfigInitialize (
>       DEBUG ((DEBUG_ERROR, "Couldn= 't install ConfigDxe configuration pages: %r\n", Status));
>     }
>  
> -  Status =3D LocateAndInstallAcpiFromFv (&mAcpiTableFile);<= br> > -  ASSERT_EFI_ERROR (Status);
> +  if (PcdGet32 (PcdSystemTableMode) =3D=3D SYSTEM_TABLE_MOD= E_ACPI ||
> +      PcdGet32 (PcdSystemTableMode) =3D= = =3D SYSTEM_TABLE_MODE_BOTH) {
> +     Status =3D LocateAndInstallAcpiFromFv (= &mAcpiTableFile);
> +     ASSERT_EFI_ERROR (Status);
> +  }
>  
>     return EFI_SUCCESS;
>   }
> diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf b/P= latform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf
> index 57963baf..e47f3af6 100644
> --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf
> +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.in= f
> @@ -77,7 +77,7 @@
>     gRaspberryPiTokenSpaceGuid.PcdDebugShowUEFIEx= it
>     gRaspberryPiTokenSpaceGuid.PcdDisplayEnableSc= aledVModes
>     gRaspberryPiTokenSpaceGuid.PcdDisplayEnableSS= hot
> -  gRaspberryPiTokenSpaceGuid.PcdOptDeviceTree
> +  gRaspberryPiTokenSpaceGuid.PcdSystemTableMode
>     gRaspberryPiTokenSpaceGuid.PcdRamMoreThan3GB<= br> >     gRaspberryPiTokenSpaceGuid.PcdRamLimitTo3GB >  
> diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni = b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni
> index 07660072..7195e497 100644
> --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni
> +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii= .uni
> @@ -41,10 +41,11 @@
>   #string STR_ADVANCED_3GB_OFF     = ;    #language en-US "Disabled"
>   #string STR_ADVANCED_3GB_ON     =      #language en-US "Enabled"
>  
> -#string STR_ADVANCED_DT_PROMPT       #= language en-US "Device Tree"
> -#string STR_ADVANCED_DT_HELP      &nbs= p;  #language en-US "Disable this option to force OSes such as GN= U/Linux to use ACPI"
> -#string STR_ADVANCED_DT_OFF       = ;   #language en-US "Disabled (Force ACPI)"
> -#string STR_ADVANCED_DT_ON       =     #language en-US "Enabled"
> +#string STR_ADVANCED_SYSTAB_PROMPT   #language en-US &= quot;System Table Selection"
> +#string STR_ADVANCED_SYSTAB_HELP     #langua= ge en-US "ACPI/DT choice for specific OSes"
> +#string STR_ADVANCED_SYSTAB_ACPI     #langua= ge en-US "ACPI"
> +#string STR_ADVANCED_SYSTAB_BOTH     #langua= ge en-US "ACPI + Devicetree"
> +#string STR_ADVANCED_SYSTAB_DT     &nbs= p; #language en-US "Devicetree"
>  
>   /*
>    * MMC/SD configuration.
> diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr = b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr
> index 0a650a94..72cc90ae 100644
> --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr
> +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii= .vfr
> @@ -8,128 +8,7 @@
>  
>   #include <Guid/HiiPlatformSetupFormset.h>
>   #include "ConfigDxeFormSetGuid.h"
> -
> -#pragma pack(1)
> -typedef struct {
> -  /*
> -   * One bit for each scaled resolution supported,
> -   * these are ordered exactly like mGopModeData
> -   * in DisplayDxe.
> -   *
> -   * 800x600, 640x480, 1024x768, 720p, 1080p, native.
> -   */
> -   UINT8 v640   : 1;
> -   UINT8 v800   : 1;
> -   UINT8 v1024  : 1;
> -   UINT8 v720p  : 1;
> -   UINT8 v1080p : 1;
> -   UINT8 Physical : 1;
> -} DISPLAY_ENABLE_SCALED_VMODES_VARSTORE_DATA;
> -#pragma pack()
> -
> -typedef struct {
> -  /*
> -   * 0 - No screenshot support.
> -   * 1 - Screenshot support via hotkey.
> -   */
> -   UINT32 Enable;
> -} DISPLAY_ENABLE_SSHOT_VARSTORE_DATA;
> -
> -typedef struct {
> -  /*
> -   * 0 - No JTAG.
> -   * 1 - JTAG mode.
> -   */
> -   UINT32 Enable;
> -} DEBUG_ENABLE_JTAG_VARSTORE_DATA;
> -
> -typedef struct {
> -  /*
> -   * 0 - Don't show UEFI exit message.
> -   * 1 - Show UEFI exit message.
> -   */
> -   UINT32 Show;
> -} DEBUG_SHOW_UEFI_EXIT_VARSTORE_DATA;
> -
> -typedef struct {
> -  /*
> -   * 0 - low.
> -   * 1 - default.
> -   * 2 - maximum.
> -   * 3 - custom.
> -   */
> -  UINT32 Clock;
> -} CHIPSET_CPU_CLOCK_VARSTORE_DATA;
> -
> -typedef struct {
> -  UINT32 Clock;
> -} CHIPSET_CUSTOM_CPU_CLOCK_VARSTORE_DATA;
> -
> -typedef struct {
> -  /*
> -   * Always set by ConfigDxe prior to HII init to reflect<= br> > -   * platform capability.
> -   */
> -  UINT32 Supported;
> -} ADVANCED_RAM_MORE_THAN_3GB_VARSTORE_DATA;
> -
> -typedef struct {
> -  UINT32 Enabled;
> -} ADVANCED_RAM_LIMIT_TO_3GB_VARSTORE_DATA;
> -
> -typedef struct {
> -  /*
> -   * 0 - Do not provide a Device Tree to the OS
> -   * 1 - Provide a Device Tree to the OS
> -   */
> -  UINT32 Enabled;
> -} ADVANCED_DEVICE_TREE_VARSTORE_DATA;
> -
> -typedef struct {
> -  /*
> -   * 0 - uSD slot routed to Broadcom SDHOST on Pi 3 or eMM= C2 on Pi 4.
> -   * 1 - uSD slot routed to Arasan SDHCI.
> -   */
> -  UINT32 Routing;
> -} MMC_SD_VARSTORE_DATA;
> -
> -typedef struct {
> -  /*
> -   * 0 - Don't disable multi-block.
> -   * 1 - Disable multi-block commands.
> -   */
> -  UINT32 DisableMulti;
> -} MMC_DISMULTI_VARSTORE_DATA;
> -
> -typedef struct {
> -  /*
> -   * 0 - Don't force 1 bit mode.
> -   * 1 - Force 1 bit mode.
> -   */
> -  UINT32 Force1Bit;
> -} MMC_FORCE1BIT_VARSTORE_DATA;
> -
> -typedef struct {
> -  /*
> -   * 0 - Don't force default speed.
> -   * 1 - Force default speed.
> -   */
> -  UINT32 ForceDS;
> -} MMC_FORCEDS_VARSTORE_DATA;
> -
> -typedef struct {
> -  /*
> -   * Default Speed MHz override (25MHz default).
> -   */
> -  UINT32 MHz;
> -} MMC_SD_DS_MHZ_VARSTORE_DATA;
> -
> -typedef struct {
> -  /*
> -   * High Speed MHz override (50MHz default).
> -   */
> -  UINT32 MHz;
> -} MMC_SD_HS_MHZ_VARSTORE_DATA;
> +#include <ConfigVars.h>
>  
>   //
>   // EFI Variable attributes
> @@ -165,9 +44,9 @@ formset
>         name  =3D RamLim= itTo3GB,
>         guid  =3D CONFIG= DXE_FORM_SET_GUID;
>  
> -    efivarstore ADVANCED_DEVICE_TREE_VARSTORE_DATA, > +    efivarstore SYSTEM_TABLE_MODE_VARSTORE_DATA,<= br> >         attribute =3D EFI_VAR= IABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_V= OLATILE,
> -      name  =3D OptDeviceTree,
> +      name  =3D SystemTableMode, >         guid  =3D CONFIG= DXE_FORM_SET_GUID;
>  
>       efivarstore MMC_SD_VARSTORE_DATA,=
> @@ -253,10 +132,10 @@ formset
>           &nbs= p;   prompt      =3D STRING_TOKEN(STR_CH= IPSET_CLOCK_CPU_PROMPT),
>           &nbs= p;   help        =3D STRING_TO= KEN(STR_CHIPSET_CLOCK_CPU_HELP),
>           &nbs= p;   flags       =3D NUMERIC_SIZE_4= | INTERACTIVE | RESET_REQUIRED,
> -            o= ption text =3D STRING_TOKEN(STR_CHIPSET_CLOCK_CPU_LOW), value =3D 0, flags = = =3D 0;
> -            o= ption text =3D STRING_TOKEN(STR_CHIPSET_CLOCK_CPU_DEF), value =3D 1, flags = = =3D DEFAULT;
> -            o= ption text =3D STRING_TOKEN(STR_CHIPSET_CLOCK_CPU_MAX), value =3D 2, flags = = =3D 0;
> -            o= ption text =3D STRING_TOKEN(STR_CHIPSET_CLOCK_CPU_CUSTOM), value =3D 3, fla= gs =3D 0;
> +          &nbs= p; option text =3D STRING_TOKEN(STR_CHIPSET_CLOCK_CPU_LOW), value =3D CHIPS= ET_CPU_CLOCK_LOW, flags =3D 0;
> +          &nbs= p; option text =3D STRING_TOKEN(STR_CHIPSET_CLOCK_CPU_DEF), value =3D CHIPS= ET_CPU_CLOCK_DEFAULT, flags =3D DEFAULT;
> +          &nbs= p; option text =3D STRING_TOKEN(STR_CHIPSET_CLOCK_CPU_MAX), value =3D CHIPS= ET_CPU_CLOCK_MAX, flags =3D 0;
> +          &nbs= p; option text =3D STRING_TOKEN(STR_CHIPSET_CLOCK_CPU_CUSTOM), value =3D CH= IPSET_CPU_CLOCK_CUSTOM, flags =3D 0;
>           endoneof;=
>  
>           grayoutif= NOT ideqval CpuClock.Clock =3D=3D 3;
> @@ -285,12 +164,13 @@ formset
>           &nbs= p; endoneof;
>           endif; >  
> -        oneof varid =3D OptDevice= Tree.Enabled,
> -            p= rompt      =3D STRING_TOKEN(STR_ADVANCED_DT_PROMPT= ),
> -            h= elp        =3D STRING_TOKEN(STR_ADVANCED= _DT_HELP),
> +        oneof varid =3D Syste= mTableMode.Mode,
> +          &nbs= p; prompt      =3D STRING_TOKEN(STR_ADVANCED_SYSTA= B_PROMPT),
> +          &nbs= p; help        =3D STRING_TOKEN(STR_ADVA= NCED_SYSTAB_HELP),
>           &nbs= p;   flags       =3D NUMERIC_SIZE_4= | INTERACTIVE | RESET_REQUIRED,
> -            o= ption text =3D STRING_TOKEN(STR_ADVANCED_DT_OFF), value =3D 0, flags =3D 0;=
> -            o= ption text =3D STRING_TOKEN(STR_ADVANCED_DT_ON), value =3D 1, flags =3D DEF= AULT;
> +          &nbs= p; option text =3D STRING_TOKEN(STR_ADVANCED_SYSTAB_ACPI), value =3D SYSTEM= _TABLE_MODE_ACPI, flags =3D 0;
> +          &nbs= p; option text =3D STRING_TOKEN(STR_ADVANCED_SYSTAB_BOTH), value =3D SYSTEM= _TABLE_MODE_BOTH, flags =3D DEFAULT;
> +          &nbs= p; option text =3D STRING_TOKEN(STR_ADVANCED_SYSTAB_DT), value =3D SYSTEM_T= ABLE_MODE_DT, flags =3D DEFAULT;
>           endoneof;=
>       endform;
>  
> diff --git a/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.c b/Platform/= RaspberryPi/Drivers/FdtDxe/FdtDxe.c
> index cb11256e..0472d8ec 100644
> --- a/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.c
> +++ b/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.c
> @@ -15,10 +15,9 @@
>   #include <Library/UefiBootServicesTableLib.h>
>   #include <Library/UefiLib.h>
>   #include <libfdt.h>
> -
>   #include <Protocol/RpiFirmware.h>
> -
>   #include <Guid/Fdt.h>
> +#include <ConfigVars.h>
>  
>   STATIC VOID       &nbs= p;            &= nbsp;        *mFdtImage;
>  
> @@ -356,7 +355,8 @@ FdtDxeInitialize (
>     UINTN      FdtSize;<= br> >     VOID       *Fdt= Image =3D NULL;
>  
> -  if (PcdGet32 (PcdOptDeviceTree) =3D=3D 0) {
> +  if (PcdGet32 (PcdSystemTableMode) !=3D SYSTEM_TABLE_MODE_= BOTH &&
> +      PcdGet32 (PcdSystemTableMode) != =3D SYSTEM_TABLE_MODE_DT) {
>       DEBUG ((DEBUG_INFO, "Device = Tree disabled per user configuration\n"));
>       return EFI_SUCCESS;
>     }
> diff --git a/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.inf b/Platfor= m/RaspberryPi/Drivers/FdtDxe/FdtDxe.inf
> index 49ba5ba1..26f84e59 100644
> --- a/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.inf
> +++ b/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.inf
> @@ -46,4 +46,4 @@
>     gRaspberryPiTokenSpaceGuid.PcdFdtBaseAddress<= br> >  
>   [Pcd]
> -  gRaspberryPiTokenSpaceGuid.PcdOptDeviceTree
> +  gRaspberryPiTokenSpaceGuid.PcdSystemTableMode
> diff --git a/Platform/RaspberryPi/Include/ConfigVars.h b/Platform/Ras= pberryPi/Include/ConfigVars.h
> new file mode 100644
> index 00000000..28837f98
> --- /dev/null
> +++ b/Platform/RaspberryPi/Include/ConfigVars.h
> @@ -0,0 +1,131 @@
> +/** @file
> + *
> + *  Copyright (c) 2020, Andrei Warkentin <andrey.warkent= in@gmail.com>
> + *
> + *  SPDX-License-Identifier: BSD-2-Clause-Patent
> + *
> + **/
> +
> +#ifndef CONFIG_VARS_H
> +#define CONFIG_VARS_H
> +
> +#pragma pack(1)
> +typedef struct {
> +  /*
> +   * One bit for each scaled resolution supported,
> +   * these are ordered exactly like mGopModeData
> +   * in DisplayDxe.
> +   *
> +   * 800x600, 640x480, 1024x768, 720p, 1080p, native.<= br> > +   */
> +   UINT8 v640   : 1;
> +   UINT8 v800   : 1;
> +   UINT8 v1024  : 1;
> +   UINT8 v720p  : 1;
> +   UINT8 v1080p : 1;
> +   UINT8 Physical : 1;
> +} DISPLAY_ENABLE_SCALED_VMODES_VARSTORE_DATA;
> +#pragma pack()
> +
> +typedef struct {
> +  /*
> +   * 0 - No screenshot support.
> +   * 1 - Screenshot support via hotkey.
> +   */
> +   UINT32 Enable;
> +} DISPLAY_ENABLE_SSHOT_VARSTORE_DATA;
> +
> +typedef struct {
> +  /*
> +   * 0 - No JTAG.
> +   * 1 - JTAG mode.
> +   */
> +   UINT32 Enable;
> +} DEBUG_ENABLE_JTAG_VARSTORE_DATA;
> +
> +typedef struct {
> +  /*
> +   * 0 - Don't show UEFI exit message.
> +   * 1 - Show UEFI exit message.
> +   */
> +   UINT32 Show;
> +} DEBUG_SHOW_UEFI_EXIT_VARSTORE_DATA;
> +
> +typedef struct {
> +#define CHIPSET_CPU_CLOCK_LOW     0
> +#define CHIPSET_CPU_CLOCK_DEFAULT 1
> +#define CHIPSET_CPU_CLOCK_MAX     2
> +#define CHIPSET_CPU_CLOCK_CUSTOM  3
> +  UINT32 Clock;
> +} CHIPSET_CPU_CLOCK_VARSTORE_DATA;
> +
> +typedef struct {
> +  UINT32 Clock;
> +} CHIPSET_CUSTOM_CPU_CLOCK_VARSTORE_DATA;
> +
> +typedef struct {
> +  /*
> +   * Always set by ConfigDxe prior to HII init to refl= ect
> +   * platform capability.
> +   */
> +  UINT32 Supported;
> +} ADVANCED_RAM_MORE_THAN_3GB_VARSTORE_DATA;
> +
> +typedef struct {
> +  UINT32 Enabled;
> +} ADVANCED_RAM_LIMIT_TO_3GB_VARSTORE_DATA;
> +
> +typedef struct {
> +#define SYSTEM_TABLE_MODE_ACPI 0
> +#define SYSTEM_TABLE_MODE_BOTH 1
> +#define SYSTEM_TABLE_MODE_DT   2
> +  UINT32 Mode;
> +} SYSTEM_TABLE_MODE_VARSTORE_DATA;
> +
> +typedef struct {
> +  /*
> +   * 0 - uSD slot routed to Broadcom SDHOST on Pi 3 or= eMMC2 on Pi 4.
> +   * 1 - uSD slot routed to Arasan SDHCI.
> +   */
> +  UINT32 Routing;
> +} MMC_SD_VARSTORE_DATA;
> +
> +typedef struct {
> +  /*
> +   * 0 - Don't disable multi-block.
> +   * 1 - Disable multi-block commands.
> +   */
> +  UINT32 DisableMulti;
> +} MMC_DISMULTI_VARSTORE_DATA;
> +
> +typedef struct {
> +  /*
> +   * 0 - Don't force 1 bit mode.
> +   * 1 - Force 1 bit mode.
> +   */
> +  UINT32 Force1Bit;
> +} MMC_FORCE1BIT_VARSTORE_DATA;
> +
> +typedef struct {
> +  /*
> +   * 0 - Don't force default speed.
> +   * 1 - Force default speed.
> +   */
> +  UINT32 ForceDS;
> +} MMC_FORCEDS_VARSTORE_DATA;
> +
> +typedef struct {
> +  /*
> +   * Default Speed MHz override (25MHz default).
> +   */
> +  UINT32 MHz;
> +} MMC_SD_DS_MHZ_VARSTORE_DATA;
> +
> +typedef struct {
> +  /*
> +   * High Speed MHz override (50MHz default).
> +   */
> +  UINT32 MHz;
> +} MMC_SD_HS_MHZ_VARSTORE_DATA;
> +
> +#endif /* CONFIG_VARS_H */
> diff --git a/Platform/RaspberryPi/RPi3/RPi3.dsc b/Platform/RaspberryP= i/RPi3/RPi3.dsc
> index 563fb891..721b8c20 100644
> --- a/Platform/RaspberryPi/RPi3/RPi3.dsc
> +++ b/Platform/RaspberryPi/RPi3/RPi3.dsc
> @@ -481,9 +481,9 @@
>     gRaspberryPiTokenSpaceGuid.PcdRamLimitTo3GB|L= "RamLimitTo3GB"|gConfigDxeFormSetGuid|0x0|0
>  
>     #
> -  # Device Tree
> +  # Device Tree and ACPI selection.
>     #
> -  gRaspberryPiTokenSpaceGuid.PcdOptDeviceTree|L"OptDeviceT= ree"|gConfigDxeFormSetGuid|0x0|1
> +  gRaspberryPiTokenSpaceGuid.PcdSystemTableMode|L"Syst= emTableMode"|gConfigDxeFormSetGuid|0x0|1
>  
>     #
>     # Common UEFI ones.
> diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc b/Platform/RaspberryP= i/RPi4/RPi4.dsc
> index 4deccd9d..c9ab999a 100644
> --- a/Platform/RaspberryPi/RPi4/RPi4.dsc
> +++ b/Platform/RaspberryPi/RPi4/RPi4.dsc
> @@ -496,9 +496,9 @@
>     gRaspberryPiTokenSpaceGuid.PcdRamLimitTo3GB|L= "RamLimitTo3GB"|gConfigDxeFormSetGuid|0x0|1
>  
>     #
> -  # Device Tree
> +  # Device Tree and ACPI selection.
>     #
> -  gRaspberryPiTokenSpaceGuid.PcdOptDeviceTree|L"OptDeviceT= ree"|gConfigDxeFormSetGuid|0x0|0
> +  gRaspberryPiTokenSpaceGuid.PcdSystemTableMode|L"Syst= emTableMode"|gConfigDxeFormSetGuid|0x0|0
>  
>     #
>     # Common UEFI ones.
> diff --git a/Platform/RaspberryPi/RaspberryPi.dec b/Platform/Raspberr= yPi/RaspberryPi.dec
> index 66ef6186..1a3c44e0 100644
> --- a/Platform/RaspberryPi/RaspberryPi.dec
> +++ b/Platform/RaspberryPi/RaspberryPi.dec
> @@ -65,6 +65,6 @@
>     gRaspberryPiTokenSpaceGuid.PcdCustomCpuClock|= 0|UINT32|0x00000016
>     gRaspberryPiTokenSpaceGuid.PcdDisplayEnableSc= aledVModes|0x3F|UINT8|0x00000017
>     gRaspberryPiTokenSpaceGuid.PcdDisplayEnableSS= hot|0|UINT32|0x00000018
> -  gRaspberryPiTokenSpaceGuid.PcdOptDeviceTree|1|UINT32|0x000000= 1B
> +  gRaspberryPiTokenSpaceGuid.PcdSystemTableMode|1|UINT32|0x= 0000001B
>     gRaspberryPiTokenSpaceGuid.PcdRamMoreThan3GB|= 0|UINT32|0x00000019
>     gRaspberryPiTokenSpaceGuid.PcdRamLimitTo3GB|0= |UINT32|0x0000001A
>




--_000_BN6PR05MB34118B7410495682723F401AB9A30BN6PR05MB3411namp_--