From nobody Sun Apr 28 03:48:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+59011+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+59011+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1589146503; cv=none; d=zohomail.com; s=zohoarc; b=jpK2FF4LFu6zvrNsj6NWIdz3A28FaYhfucT7/d2zQMk9n3NGHbCgBJS36xdLuZRqJNfWZSMclsv9rEsh7HBfadoz4dqMBl5u9G1rGwTqtJVOG3MfHOdLuIsvjQN8FTYiBR44ZB/aMT8yh3jOq7KLAm3qtX85v4eF3Db34AD98GE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589146503; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=xLNalcj19gcD3fjwgF5dstO2bHdiLVwHNV11jOCur8g=; b=Mc0u8hMJpB9i9391CTb9IXLIgxAKpVL8qKfiIIt6EJRqFqZ0fXHydEyoiw3dPtCELIr8imC4LOVoRV14DVM9RobK339VdstAFIEM/JY4RR+aXLJSFCTgjjeeAgAJXKZjy2b089fwEdYXlih48EhHjbJyv6hgH5t3DOM8LupYYDA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+59011+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1589146503561325.3515146789931; Sun, 10 May 2020 14:35:03 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id BLreYY1788612xLrkB4p5ehd; Sun, 10 May 2020 14:35:03 -0700 X-Received: from mail-qt1-f193.google.com (mail-qt1-f193.google.com [209.85.160.193]) by mx.groups.io with SMTP id smtpd.web11.1441.1589146502645324685 for ; Sun, 10 May 2020 14:35:02 -0700 X-Received: by mail-qt1-f193.google.com with SMTP id y42so2949447qth.0 for ; Sun, 10 May 2020 14:35:02 -0700 (PDT) X-Gm-Message-State: moXI6KbmGoddqRHbV9YRMyHHx1787277AA= X-Google-Smtp-Source: APiQypKFnKFldJ/r8IEaA1rpt1IxfLjZz/81H2FC7IfSjYv/ciP9aop4ePY8jQTM69ZYdM3hqOFkag== X-Received: by 2002:ac8:4e1c:: with SMTP id c28mr4791762qtw.378.1589146501469; Sun, 10 May 2020 14:35:01 -0700 (PDT) X-Received: from localhost.localdomain (c-98-214-99-181.hsd1.il.comcast.net. [98.214.99.181]) by smtp.gmail.com with ESMTPSA id u3sm1895231qtk.63.2020.05.10.14.35.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 May 2020 14:35:01 -0700 (PDT) From: "Andrei Warkentin" To: devel@edk2.groups.io Cc: ard.biesheuvel@arm.com, leif@nuviainc.com, pete@akeo.ie, philmd@redhat.com Subject: [edk2-devel] [edk2-platforms][PATCH 1/2] RPi: move varstore structure defs to ConfigVars.h Date: Sun, 10 May 2020 14:34:49 -0700 Message-Id: <20200510213450.12642-2-andrey.warkentin@gmail.com> In-Reply-To: <20200510213450.12642-1-andrey.warkentin@gmail.com> References: <20200510213450.12642-1-andrey.warkentin@gmail.com> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,andrey.warkentin@gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1589146503; bh=Uv5ebCHLP/g13fcRCN5ZDQBlUqp7qi//oLRN2F5X6gM=; h=Cc:Date:From:Reply-To:Subject:To; b=AAl1MePUGsKdJ6OulMSkkkVIdQIDHSc3/74ElB+ShGa10WFsWGe+DNsjvyj+OvCvg+3 ZkY324C3YdAKdlg9lylAPsSaCtTG1R8NTo6SqBSt94gf/Oc70KWqAgWxCHFMBRUFsEWN4 +cZQW5afVdEl/phcE9aFHoyKuPEO/gus/pw= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" To avoid hardcoding constants for non-obvious fields (e.g. enum instead of basic enable/disable), move variable structure and value definitions into a separate header, ConfigVars.h. Signed-off-by: Andrei Warkentin Reviewed-by: Pete Batard --- Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 10 +- Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr | 131 +-----------= ------- Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.c | 3 +- Platform/RaspberryPi/Include/ConfigVars.h | 132 ++++++++++++= ++++++++ 4 files changed, 144 insertions(+), 132 deletions(-) diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platform/= RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c index c90c2530..8c9609f3 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" =20 #define FREQ_1_MHZ 1000000 @@ -259,10 +260,10 @@ ApplyVariables ( UINT64 SystemMemorySize; =20 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 really t= he default value * from: https://www.raspberrypi.org/documentation/configuration/confi= g-txt/overclocking.md @@ -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 (PcdCpuMaxSpeedMHz) * FREQ_1_MHZ; break; - case 3: // Custom + case CHIPSET_CPU_CLOCK_CUSTOM: Rate =3D CustomCpuClock * FREQ_1_MHZ; break; } @@ -490,5 +491,6 @@ ConfigInitialize ( Status =3D LocateAndInstallAcpiFromFv (&mAcpiTableFile); ASSERT_EFI_ERROR (Status); =20 + return EFI_SUCCESS; } diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr b/Plat= form/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr index 0a650a94..576eabe9 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr @@ -8,128 +8,7 @@ =20 #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 =20 // // EFI Variable attributes @@ -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_REQUIRED, - option text =3D STRING_TOKEN(STR_CHIPSET_CLOCK_CPU_LOW), value= =3D 0, flags =3D 0; - option text =3D STRING_TOKEN(STR_CHIPSET_CLOCK_CPU_DEF), value= =3D 1, flags =3D DEFAULT; - option text =3D STRING_TOKEN(STR_CHIPSET_CLOCK_CPU_MAX), value= =3D 2, flags =3D 0; - option text =3D STRING_TOKEN(STR_CHIPSET_CLOCK_CPU_CUSTOM), va= lue =3D 3, flags =3D 0; + option text =3D STRING_TOKEN(STR_CHIPSET_CLOCK_CPU_LOW), value= =3D CHIPSET_CPU_CLOCK_LOW, flags =3D 0; + option text =3D STRING_TOKEN(STR_CHIPSET_CLOCK_CPU_DEF), value= =3D CHIPSET_CPU_CLOCK_DEFAULT, flags =3D DEFAULT; + option text =3D STRING_TOKEN(STR_CHIPSET_CLOCK_CPU_MAX), value= =3D CHIPSET_CPU_CLOCK_MAX, flags =3D 0; + option text =3D STRING_TOKEN(STR_CHIPSET_CLOCK_CPU_CUSTOM), va= lue =3D CHIPSET_CPU_CLOCK_CUSTOM, flags =3D 0; endoneof; =20 grayoutif NOT ideqval CpuClock.Clock =3D=3D 3; diff --git a/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.c b/Platform/Raspbe= rryPi/Drivers/FdtDxe/FdtDxe.c index cb11256e..3aaa0a7f 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 =20 STATIC VOID *mFdtImage; =20 diff --git a/Platform/RaspberryPi/Include/ConfigVars.h b/Platform/Raspberry= Pi/Include/ConfigVars.h new file mode 100644 index 00000000..a0959b4b --- /dev/null +++ b/Platform/RaspberryPi/Include/ConfigVars.h @@ -0,0 +1,132 @@ +/** @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 { + /* + * 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; + +#endif /* CONFIG_VARS_H */ --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#59011): https://edk2.groups.io/g/devel/message/59011 Mute This Topic: https://groups.io/mt/74124180/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Sun Apr 28 03:48:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+59012+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+59012+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1589146504; cv=none; d=zohomail.com; s=zohoarc; b=IicdaOzXO199kf8YUy79FK8Fj8PYikawAYkdcQZF0NQk0yB4GOjxr6lCi6cdrOejbiHf4hPC3oOm7zN17pfTcq8QOvYEYh3e2Na0C0dQXwkgAFSCIXuZASouam+hptOJ/Mz+uqHvIPMTLfEHJ4bEsWN8dm9WNcDYNcfOewSfXCw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589146504; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=BG712XZ1YSYkj+/NHEkscNNLufC1dL9IAgWs5tRuqIY=; b=Z3pdXZennRehN8WTICLVUwI+OINloWIYRugdBv71GhtPiQJ2XFW3Ps4qIB3N5KK6cCVZYyGO2lOs6pJSEcMHumdvOGan1xM74rs3la7qIu3kVvvAabL2NIA2psEnOVjfag4f0uxxfWogdQ1a2prgTBEJvnD7bpESn3Xz+i6iZ/8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+59012+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1589146504582235.7069236920513; Sun, 10 May 2020 14:35:04 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id TQfiYY1788612xHI5pkGrSJz; Sun, 10 May 2020 14:35:04 -0700 X-Received: from mail-qk1-f193.google.com (mail-qk1-f193.google.com [209.85.222.193]) by mx.groups.io with SMTP id smtpd.web10.1356.1589146503633983173 for ; Sun, 10 May 2020 14:35:03 -0700 X-Received: by mail-qk1-f193.google.com with SMTP id b6so6756169qkh.11 for ; Sun, 10 May 2020 14:35:03 -0700 (PDT) X-Gm-Message-State: r2mAUwV0PqmKO3NgLRub1jaxx1787277AA= X-Google-Smtp-Source: APiQypKDhefH14u7hWncNus5LVdi7jN2JNfVEmAoqXWPoRlDYgJaVvSsfGWaQ7TrurBfjrEWFq3PWw== X-Received: by 2002:a05:620a:16d6:: with SMTP id a22mr12181924qkn.291.1589146502491; Sun, 10 May 2020 14:35:02 -0700 (PDT) X-Received: from localhost.localdomain (c-98-214-99-181.hsd1.il.comcast.net. [98.214.99.181]) by smtp.gmail.com with ESMTPSA id u3sm1895231qtk.63.2020.05.10.14.35.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 May 2020 14:35:02 -0700 (PDT) From: "Andrei Warkentin" To: devel@edk2.groups.io Cc: ard.biesheuvel@arm.com, leif@nuviainc.com, pete@akeo.ie, philmd@redhat.com Subject: [edk2-devel] [edk2-platforms][PATCH 2/2] RPi: allow selecting DT-only mode Date: Sun, 10 May 2020 14:34:50 -0700 Message-Id: <20200510213450.12642-3-andrey.warkentin@gmail.com> In-Reply-To: <20200510213450.12642-1-andrey.warkentin@gmail.com> References: <20200510213450.12642-1-andrey.warkentin@gmail.com> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,andrey.warkentin@gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1589146504; bh=TkJKp+EZFXvjgg8jipE+9ctJoeXNBY+58i6kH4zB/7c=; h=Cc:Date:From:Reply-To:Subject:To; b=qndPd3XMMCBRwz5gL6UiMetoGLnPH5TRIMA3MLidTtckYl7gk1dfOXqW70Cg0c+hPNI rvzuwIwz/7KHufMECZM6iSJCnYbUQe4zUKF/YyqKFh9NZG7fBKl0SHFEHwkaKDHIaVZXj AcMRcW2DEpioqbo1Mr4YGrO+PyuSe6fQ5kQ= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Today the Pies can be booted in a way where only ACPI is exposed, or both ACPI and DT are exposed. This adds one more mode - DT only, no ACPI. The target audience is developers. When both are exposed, it's up to the OS to decide which gets used, and that choice can differ between OSes, Note: this does _not_ change defaults. Pi 3 still defaults to ACPI + DT, while Pi 4 still defaults to ACPI only. We don't really want to remove DT + ACPI mode - it is the default on Pi 3, and removing it is bound to just annoy users - WoA and NetBSD (voa UEFI) on Pi 3 only work with ACPI, while everything else (Linux, FreeBSD) only work with DT. I'd make an analogy of MPS and ACPI being exposed for the longest time ever together on PCs. Testing: OpenBSD on Pi 4 with DT-only and ACPI-only boots. Signed-off-by: Andrei Warkentin Reviewed-by: Pete Batard --- Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 11 +++++++---- Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf | 2 +- Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni | 9 +++++---- Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr | 15 ++++++++-----= -- Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.c | 3 ++- Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.inf | 2 +- Platform/RaspberryPi/Include/ConfigVars.h | 11 +++++------ Platform/RaspberryPi/RPi3/RPi3.dsc | 8 ++++++-- Platform/RaspberryPi/RPi4/RPi4.dsc | 8 ++++++-- Platform/RaspberryPi/RaspberryPi.dec | 2 +- 10 files changed, 42 insertions(+), 29 deletions(-) diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platform/= RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c index 8c9609f3..29701db2 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c @@ -155,11 +155,11 @@ SetupVariables ( } =20 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)); } =20 Size =3D sizeof (UINT32); @@ -488,8 +488,11 @@ ConfigInitialize ( DEBUG ((DEBUG_ERROR, "Couldn't install ConfigDxe configuration pages: = %r\n", Status)); } =20 - 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); + } =20 =20 return EFI_SUCCESS; diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf b/Platfor= m/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 =20 diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni b/Plat= form/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni index 07660072..db36e200 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" =20 -#string STR_ADVANCED_DT_PROMPT #language en-US "Device Tree" -#string STR_ADVANCED_DT_HELP #language en-US "Disable this option = to force OSes such as GNU/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 "System Table Selecti= on" +#string STR_ADVANCED_SYSTAB_HELP #language en-US "ACPI/DT choice for s= pecific 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" =20 /* * MMC/SD configuration. diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr b/Plat= form/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr index 576eabe9..91a0ea2d 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr @@ -44,9 +44,9 @@ formset name =3D RamLimitTo3GB, guid =3D CONFIGDXE_FORM_SET_GUID; =20 - efivarstore ADVANCED_DEVICE_TREE_VARSTORE_DATA, + efivarstore SYSTEM_TABLE_MODE_VARSTORE_DATA, attribute =3D EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME= _ACCESS | EFI_VARIABLE_NON_VOLATILE, - name =3D OptDeviceTree, + name =3D SystemTableMode, guid =3D CONFIGDXE_FORM_SET_GUID; =20 efivarstore MMC_SD_VARSTORE_DATA, @@ -164,12 +164,13 @@ formset endoneof; endif; =20 - 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_REQUIRED, - 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), value = =3D SYSTEM_TABLE_MODE_ACPI, flags =3D 0; + option text =3D STRING_TOKEN(STR_ADVANCED_SYSTAB_BOTH), value = =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; =20 diff --git a/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.c b/Platform/Raspbe= rryPi/Drivers/FdtDxe/FdtDxe.c index 3aaa0a7f..44c6c87c 100644 --- a/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.c +++ b/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.c @@ -355,7 +355,8 @@ FdtDxeInitialize ( UINTN FdtSize; VOID *FdtImage =3D NULL; =20 - 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/Rasp= berryPi/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 =20 [Pcd] - gRaspberryPiTokenSpaceGuid.PcdOptDeviceTree + gRaspberryPiTokenSpaceGuid.PcdSystemTableMode diff --git a/Platform/RaspberryPi/Include/ConfigVars.h b/Platform/Raspberry= Pi/Include/ConfigVars.h index a0959b4b..28837f98 100644 --- a/Platform/RaspberryPi/Include/ConfigVars.h +++ b/Platform/RaspberryPi/Include/ConfigVars.h @@ -76,12 +76,11 @@ typedef struct { } ADVANCED_RAM_LIMIT_TO_3GB_VARSTORE_DATA; =20 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; +#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; =20 typedef struct { /* diff --git a/Platform/RaspberryPi/RPi3/RPi3.dsc b/Platform/RaspberryPi/RPi3= /RPi3.dsc index 563fb891..a138c874 100644 --- a/Platform/RaspberryPi/RPi3/RPi3.dsc +++ b/Platform/RaspberryPi/RPi3/RPi3.dsc @@ -481,9 +481,13 @@ gRaspberryPiTokenSpaceGuid.PcdRamLimitTo3GB|L"RamLimitTo3GB"|gConfigDxeF= ormSetGuid|0x0|0 =20 # - # Device Tree + # Device Tree and ACPI selection. # - gRaspberryPiTokenSpaceGuid.PcdOptDeviceTree|L"OptDeviceTree"|gConfigDxeF= ormSetGuid|0x0|1 + # 0 - SYSTEM_TABLE_MODE_ACPI + # 1 - SYSTEM_TABLE_MODE_BOTH (default) + # 2 - SYSTEM_TABLE_MODE_DT + # + gRaspberryPiTokenSpaceGuid.PcdSystemTableMode|L"SystemTableMode"|gConfig= DxeFormSetGuid|0x0|1 =20 # # Common UEFI ones. diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc b/Platform/RaspberryPi/RPi4= /RPi4.dsc index 4deccd9d..75867f03 100644 --- a/Platform/RaspberryPi/RPi4/RPi4.dsc +++ b/Platform/RaspberryPi/RPi4/RPi4.dsc @@ -496,9 +496,13 @@ gRaspberryPiTokenSpaceGuid.PcdRamLimitTo3GB|L"RamLimitTo3GB"|gConfigDxeF= ormSetGuid|0x0|1 =20 # - # Device Tree + # Device Tree and ACPI selection. # - gRaspberryPiTokenSpaceGuid.PcdOptDeviceTree|L"OptDeviceTree"|gConfigDxeF= ormSetGuid|0x0|0 + # 0 - SYSTEM_TABLE_MODE_ACPI (default) + # 1 - SYSTEM_TABLE_MODE_BOTH + # 2 - SYSTEM_TABLE_MODE_DT + # + gRaspberryPiTokenSpaceGuid.PcdSystemTableMode|L"SystemTableMode"|gConfig= DxeFormSetGuid|0x0|0 =20 # # Common UEFI ones. diff --git a/Platform/RaspberryPi/RaspberryPi.dec b/Platform/RaspberryPi/Ra= spberryPi.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|0x000= 00017 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 --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#59012): https://edk2.groups.io/g/devel/message/59012 Mute This Topic: https://groups.io/mt/74124181/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-