From nobody Sun May 5 15:47:16 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+52114+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+52114+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1576063569; cv=none; d=zohomail.com; s=zohoarc; b=nOaCAjlj+qAtNDG3VSKJmE83OP7Vxnynj9Bs4KhLrmcCM91UlUspxf0qrcErgrAYtiBqxvKd7X1T8LtqO4GE70z63DGy7QWtkY+3SEWHEt6UUFHrAQoW002P24zJ3dDS1aDGKneiIqrVG59gXzuSRpZvqvy3lVDR3MvZ23HClbw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576063569; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=nSYN/m6jXSKVyH2sCfWO0fPpLAy4qQQZkVSUu48dk3c=; b=FWFPh8415ZMKrzU+OF7+Y44loq+332oppgjgUB8HHOUTzDuxBBC7JLffcHs1Ll19U0e2BPmG+DNZ/keKRoXuzah53srEBENF0yRJOG5O5r+/XCB8L1NK9gPD+lJu+1AYh3Kn2fsyfhl9jDuBU3CZmzAnwFEncGK6KpecToUL30E= 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+52114+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1576063569741646.022291652746; Wed, 11 Dec 2019 03:26:09 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id cB6zYY1788612xU3yIu1mRJa; Wed, 11 Dec 2019 03:26:08 -0800 X-Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by mx.groups.io with SMTP id smtpd.web09.2219.1576063567791004444 for ; Wed, 11 Dec 2019 03:26:08 -0800 X-Received: by mail-wr1-f66.google.com with SMTP id q6so2133632wro.9 for ; Wed, 11 Dec 2019 03:26:07 -0800 (PST) X-Gm-Message-State: qToFOkINA4fiH8MMcY6GPb1ux1787277AA= X-Google-Smtp-Source: APXvYqzYVjtzvYcpjy2zW5QBrAdjIH8P+BFrUZ9KU2BKvepONDjZudjtMDqiYyZ/nyvQ3HB1IeCMtQ== X-Received: by 2002:adf:dd46:: with SMTP id u6mr3330343wrm.13.1576063566005; Wed, 11 Dec 2019 03:26:06 -0800 (PST) X-Received: from localhost.localdomain ([84.203.45.230]) by smtp.gmail.com with ESMTPSA id q8sm190460wmq.3.2019.12.11.03.26.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Dec 2019 03:26:05 -0800 (PST) From: "Pete Batard" To: devel@edk2.groups.io Cc: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org, philmd@redhat.com, andrey.warkentin@gmail.com, samer.el-haj-mahmoud@arm.com Subject: [edk2-devel] [edk2-platforms][PATCH 1/5] Platform/RPi: Fix overlap of SoC registers and RAM Date: Wed, 11 Dec 2019 11:25:48 +0000 Message-Id: <20191211112552.15900-2-pete@akeo.ie> In-Reply-To: <20191211112552.15900-1-pete@akeo.ie> References: <20191211112552.15900-1-pete@akeo.ie> MIME-Version: 1.0 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,pete@akeo.ie Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1576063568; bh=k22rV16kRbJCtN9dODFmjzIKZAZZY7x0+0xuXVeknmU=; h=Cc:Date:From:Reply-To:Subject:To; b=Cj5DSHVVqhm0+X7mKIva4ganZgK4d/WslYhlf7BnyGdkcJohcspGPXr3kIUQ00JaCIf 2M0K44WHwHSLNQ9a9QPy+jGMxNYVtxO1paY+gMtBuRPu76DY0YmYiH7ncp+A8OPDNuku7 ARnLvOwxY6O2tUBiobWGQxiCKIc9vli1H0w= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Ard Biesheuvel Having RAM and SoC register regions overlap is problematic for MMIO, since, at the very least, we don't want these regions to be declared as cacheable. Signed-off-by: Pete Batard Reviewed-by: Ard Biesheuvel Reviewed-by: Philippe Mathieu-Daude --- Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c | 36 +++++++++++= ++------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c b/Pl= atform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c index cc761bea1307..781cf78b83d3 100644 --- a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c +++ b/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c @@ -60,7 +60,7 @@ ArmPlatformGetVirtualMemoryMap ( { UINTN Index =3D 0; UINTN GpuIndex; - INT64 ExtendedMemorySize; + INT64 SystemMemorySize; ARM_MEMORY_REGION_DESCRIPTOR *VirtualMemoryTable; =20 // Early output of the info we got from VideoCore can prove valuable. @@ -120,21 +120,21 @@ ArmPlatformGetVirtualMemoryMap ( VirtualMemoryInfo[Index].Type =3D RPI_MEM_RESERVED_REGION; VirtualMemoryInfo[Index++].Name =3D L"GPU Reserved"; =20 - // Compute the amount of extended RAM available on this platform - ExtendedMemorySize =3D SIZE_256MB; - ExtendedMemorySize <<=3D (mBoardRevision >> 20) & 0x07; - ExtendedMemorySize -=3D SIZE_1GB; - if (ExtendedMemorySize > 0) { - VirtualMemoryTable[Index].PhysicalBase =3D FixedPcdGet64 (PcdExtended= MemoryBase); - VirtualMemoryTable[Index].VirtualBase =3D VirtualMemoryTable[Index].= PhysicalBase; - VirtualMemoryTable[Index].Length =3D ExtendedMemorySize; - VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIBUT= E_WRITE_BACK; - VirtualMemoryInfo[Index].Type =3D RPI_MEM_BASIC_REGION; - VirtualMemoryInfo[Index++].Name =3D L"Extended System RAM"; - } + // Compute the total RAM size available on this platform + SystemMemorySize =3D SIZE_256MB; + SystemMemorySize <<=3D (mBoardRevision >> 20) & 0x07; + + // + // Ensure that what we declare as System Memory doesn't overlap with the + // Bcm2836 SoC registers. This can be achieved through a MIN () with the + // base address since SystemMemoryBase is 0 (we assert if it isn't). + // + SystemMemorySize =3D MIN(SystemMemorySize, BCM2836_SOC_REGISTERS); =20 // Extended SoC registers (PCIe, genet, ...) if (BCM2711_SOC_REGISTERS > 0) { + // Same overlap protection as above for the Bcm2711 SoC registers + SystemMemorySize =3D MIN(SystemMemorySize, BCM2= 711_SOC_REGISTERS); VirtualMemoryTable[Index].PhysicalBase =3D BCM2711_SOC_REGISTERS; VirtualMemoryTable[Index].VirtualBase =3D VirtualMemoryTable[Index].= PhysicalBase; VirtualMemoryTable[Index].Length =3D BCM2711_SOC_REGISTER_LENGT= H; @@ -155,6 +155,16 @@ ArmPlatformGetVirtualMemoryMap ( VirtualMemoryInfo[Index].Type =3D RPI_MEM_RESERVED_REGION; VirtualMemoryInfo[Index++].Name =3D L"SoC Reserved (283x)"; =20 + // If we have RAM above the 1 GB mark, declare it + if (SystemMemorySize - SIZE_1GB > 0) { + VirtualMemoryTable[Index].PhysicalBase =3D FixedPcdGet64 (PcdExtended= MemoryBase); + VirtualMemoryTable[Index].VirtualBase =3D VirtualMemoryTable[Index].= PhysicalBase; + VirtualMemoryTable[Index].Length =3D SystemMemorySize - SIZE_1G= B; + VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIBUT= E_WRITE_BACK; + VirtualMemoryInfo[Index].Type =3D RPI_MEM_BASIC_REGION; + VirtualMemoryInfo[Index++].Name =3D L"Extended System RAM"; + } + // End of Table VirtualMemoryTable[Index].PhysicalBase =3D 0; VirtualMemoryTable[Index].VirtualBase =3D 0; --=20 2.21.0.windows.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 (#52114): https://edk2.groups.io/g/devel/message/52114 Mute This Topic: https://groups.io/mt/68147481/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 May 5 15:47:16 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+52115+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+52115+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1576063571; cv=none; d=zohomail.com; s=zohoarc; b=FMfRA5KcECDshID2LoMeNBuH6nCiMuqmWs/bECbtkAlUGQmhEIffvSH+52W4U6pugdyze972q/uPgsyG8Klq8KhKuWyHI48f6NErzdxkEY/OGSShcbGbdL7Mt8m/ynpyOkavz3d6gTGdgt5Rsylw97mwvRDlDRZVL3b7T7mzS64= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576063571; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=3jRF6LvVuusbW6+85e0A4e/TjkZHk++dA0Dxx2QRZlM=; b=FSsZFCBNBKch4peAG38koJwBI3iuk660k9JTFKa6ACArMq04V8rLinOwmyVdolXheMFmaqEtG4AWIhcQQ4JVbT7fEFD7s8yOEdXpaHLTHdivimU6c+B6L2nryNwvzZAqOvfy2GS+fBzU34YIBw3Oq7q71a1bFBjkD5HDNboKNZc= 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+52115+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1576063570999421.9557384057084; Wed, 11 Dec 2019 03:26:10 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id Cnf2YY1788612xz7pKnRKA1n; Wed, 11 Dec 2019 03:26:10 -0800 X-Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by mx.groups.io with SMTP id smtpd.web11.2236.1576063568946175067 for ; Wed, 11 Dec 2019 03:26:09 -0800 X-Received: by mail-wr1-f68.google.com with SMTP id b6so23650999wrq.0 for ; Wed, 11 Dec 2019 03:26:08 -0800 (PST) X-Gm-Message-State: PfS2Sh6GDWgGMoCM0Q4HWvLpx1787277AA= X-Google-Smtp-Source: APXvYqwkDzjI+qjL5En9gHQXf/ixvfaPySxqBEdsSmMAJ4iK80WKJ1UuvB2g+yTBHJnhPWXMJrTtaw== X-Received: by 2002:a5d:62d1:: with SMTP id o17mr3481923wrv.9.1576063567218; Wed, 11 Dec 2019 03:26:07 -0800 (PST) X-Received: from localhost.localdomain ([84.203.45.230]) by smtp.gmail.com with ESMTPSA id q8sm190460wmq.3.2019.12.11.03.26.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Dec 2019 03:26:06 -0800 (PST) From: "Pete Batard" To: devel@edk2.groups.io Cc: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org, philmd@redhat.com, andrey.warkentin@gmail.com, samer.el-haj-mahmoud@arm.com Subject: [edk2-devel] [edk2-platforms][PATCH 2/5] Platform/RPi: Don't describe MMIO regions as memory Date: Wed, 11 Dec 2019 11:25:49 +0000 Message-Id: <20191211112552.15900-3-pete@akeo.ie> In-Reply-To: <20191211112552.15900-1-pete@akeo.ie> References: <20191211112552.15900-1-pete@akeo.ie> MIME-Version: 1.0 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,pete@akeo.ie Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1576063570; bh=S7ZsCasgMxzgKZDpIXFMUIXEsmWu6rzGOAkFO5yth38=; h=Cc:Date:From:Reply-To:Subject:To; b=RwMpiucW7aOXocxZvu1ecURqxSouaKkU5bdhNXmQAk5nn1n/GPjKT1rRbOpmw1GDLSD +z0ZFGguk9eM3G8qEfcyQ7SxrQPpWJSjycVkS8wrNS3ARAy2/qE9kl7HtM+Q9ns/rSIQH rk8clzh5ynxTqQnkf4dRNY1660eZOnYEmks= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Ard Biesheuvel When using ACPI OpRegions to poke device registers, Linux will use the UEFI memory map to decide which memory attributes to use, and so they should not be described as cacheable memory. Since MMIO regions that don't require an OS virtual mapping at runtime don't really belong in the UEFI memory map to begin with, omit them entirely. Signed-off-by: Pete Batard Reviewed-by: Ard Biesheuvel Reviewed-by: Philippe Mathieu-Daude --- Platform/RaspberryPi/Include/Library/RPiMem.h | 7 ++++= --- Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib.c | 10 ++++= ++++++ Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c | 6 +++-= -- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/Platform/RaspberryPi/Include/Library/RPiMem.h b/Platform/Raspb= erryPi/Include/Library/RPiMem.h index 9d38e4b6cfb3..a033af369bb0 100644 --- a/Platform/RaspberryPi/Include/Library/RPiMem.h +++ b/Platform/RaspberryPi/Include/Library/RPiMem.h @@ -9,9 +9,10 @@ #ifndef RPI_MEM_H__ #define RPI_MEM_H__ =20 -#define RPI_MEM_BASIC_REGION 0 -#define RPI_MEM_RUNTIME_REGION 1 -#define RPI_MEM_RESERVED_REGION 2 +#define RPI_MEM_UNMAPPED_REGION 0 +#define RPI_MEM_BASIC_REGION 1 +#define RPI_MEM_RUNTIME_REGION 2 +#define RPI_MEM_RESERVED_REGION 3 =20 typedef struct { CONST CHAR16* Name; diff --git a/Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib= .c b/Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib.c index 3a0f7e19e993..7ba1cc5602d2 100644 --- a/Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib.c +++ b/Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib.c @@ -72,6 +72,15 @@ AddRuntimeServicesRegion ( ); } =20 +STATIC +VOID +AddUnmappedMemoryRegion ( + IN ARM_MEMORY_REGION_DESCRIPTOR *Desc + ) +{ + // Do nothing +} + STATIC VOID AddReservedMemoryRegion ( @@ -88,6 +97,7 @@ AddReservedMemoryRegion ( } =20 void (*AddRegion[]) (IN ARM_MEMORY_REGION_DESCRIPTOR *Desc) =3D { + AddUnmappedMemoryRegion, AddBasicMemoryRegion, AddRuntimeServicesRegion, AddReservedMemoryRegion, diff --git a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c b/Pl= atform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c index 781cf78b83d3..f8223d1b94e8 100644 --- a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c +++ b/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c @@ -117,7 +117,7 @@ ArmPlatformGetVirtualMemoryMap ( VirtualMemoryTable[Index].VirtualBase =3D VirtualMemoryTable[Index].= PhysicalBase; VirtualMemoryTable[Index].Length =3D mVideoCoreSize; VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIBUT= E_DEVICE; - VirtualMemoryInfo[Index].Type =3D RPI_MEM_RESERVED_REGION; + VirtualMemoryInfo[Index].Type =3D RPI_MEM_UNMAPPED_REGION; VirtualMemoryInfo[Index++].Name =3D L"GPU Reserved"; =20 // Compute the total RAM size available on this platform @@ -139,7 +139,7 @@ ArmPlatformGetVirtualMemoryMap ( VirtualMemoryTable[Index].VirtualBase =3D VirtualMemoryTable[Index].= PhysicalBase; VirtualMemoryTable[Index].Length =3D BCM2711_SOC_REGISTER_LENGT= H; VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIBUT= E_DEVICE; - VirtualMemoryInfo[Index].Type =3D RPI_MEM_RESERVED_REGION; + VirtualMemoryInfo[Index].Type =3D RPI_MEM_UNMAPPED_REGION; VirtualMemoryInfo[Index++].Name =3D L"SoC Reserved (27xx)"; } =20 @@ -152,7 +152,7 @@ ArmPlatformGetVirtualMemoryMap ( VirtualMemoryTable[Index].VirtualBase =3D VirtualMemoryTable[Index].= PhysicalBase; VirtualMemoryTable[Index].Length =3D BCM2836_SOC_REGISTER_LENGT= H; VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIBUT= E_DEVICE; - VirtualMemoryInfo[Index].Type =3D RPI_MEM_RESERVED_REGION; + VirtualMemoryInfo[Index].Type =3D RPI_MEM_UNMAPPED_REGION; VirtualMemoryInfo[Index++].Name =3D L"SoC Reserved (283x)"; =20 // If we have RAM above the 1 GB mark, declare it --=20 2.21.0.windows.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 (#52115): https://edk2.groups.io/g/devel/message/52115 Mute This Topic: https://groups.io/mt/68147483/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 May 5 15:47:16 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+52116+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+52116+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1576063576; cv=none; d=zohomail.com; s=zohoarc; b=IcCboe0U6RsytaoLndoJSvJZv3atoVLhuzzQQ2OwiM/2w0iVrGZxDMhTUaRvA8VfUXUgyXKNBvFu/Ij6f2Wo4gj/KQojkidBIDrclQLDsZAmZAV2BFMP29pL1qAl162xb/IprarfPMcMFQ4gelSsWv6kyl8nZRUJ2SMnu3uPWKo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576063576; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=lUv6sNoi5n8EFnPekPbzB4tJKEueSClaaKOTogB86vU=; b=aedxU/augCfMJeMHK5mYD9GtqMc9ZzX6mwYLqio6F9gjh3oDbExsO9EtyPk1ht6fBZnBY4Pb5uHGcU5dS+yYmhrbDATUN/ZFVhqXHVP17f9qh6YWpMvwbJ6qHHl/C+ffcQbHejr5qoIydGceg2trf1QiOjywkzizQo+ullNQnRQ= 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+52116+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1576063576029726.7001673684298; Wed, 11 Dec 2019 03:26:16 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id sHS1YY1788612xphP1vYOb7i; Wed, 11 Dec 2019 03:26:15 -0800 X-Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by mx.groups.io with SMTP id smtpd.web11.2239.1576063574195140062 for ; Wed, 11 Dec 2019 03:26:14 -0800 X-Received: by mail-wr1-f65.google.com with SMTP id q10so23614704wrm.11 for ; Wed, 11 Dec 2019 03:26:13 -0800 (PST) X-Gm-Message-State: iwLkMWaWxDEzVbOFv5wgb8cGx1787277AA= X-Google-Smtp-Source: APXvYqw0OKycRsfA1j1md50XuPIxOi3jP7PLYVJX1TuPS8hiSkBADObPAI4kZ8ucVE5dPjtmadVaDQ== X-Received: by 2002:a5d:6652:: with SMTP id f18mr3347444wrw.246.1576063570449; Wed, 11 Dec 2019 03:26:10 -0800 (PST) X-Received: from localhost.localdomain ([84.203.45.230]) by smtp.gmail.com with ESMTPSA id q8sm190460wmq.3.2019.12.11.03.26.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Dec 2019 03:26:09 -0800 (PST) From: "Pete Batard" To: devel@edk2.groups.io Cc: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org, philmd@redhat.com, andrey.warkentin@gmail.com, samer.el-haj-mahmoud@arm.com Subject: [edk2-devel] [edk2-platforms][PATCH 3/5] Platform/RPi4: Add initial ACPI tables Date: Wed, 11 Dec 2019 11:25:50 +0000 Message-Id: <20191211112552.15900-4-pete@akeo.ie> In-Reply-To: <20191211112552.15900-1-pete@akeo.ie> References: <20191211112552.15900-1-pete@akeo.ie> MIME-Version: 1.0 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,pete@akeo.ie Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1576063575; bh=OJJWqp3EmeT83jq5RPl+X62/Rw4VpRBXzHm5UXQY+Qg=; h=Cc:Date:From:Reply-To:Subject:To; b=g9kOaEw8KN5NBAV8//U8lINmIY+EqYIga1XYhDrwnL8rKeIJaR1z7SJ5pFmizIoxH98 GbUrFoSXe0CBwrCJ3KRTheBXxFj0+IowPTB9BVXBB/XYiFPZvOvbgbhyqPcTXdVcaQ+w7 PdDoKDRed3dIDRLFNzsA+kY1NxSb2Vf+z4Y= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Samer El-Haj-Mahmoud For this initial commit, we duplicate the RPi3 ones. Signed-off-by: Pete Batard Reviewed-by: Ard Biesheuvel --- Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.h | 76 +++ Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.inf | 40 ++ Platform/RaspberryPi/RPi4/AcpiTables/Csrt.aslc | 326 +++++++++++++ Platform/RaspberryPi/RPi4/AcpiTables/Dbg2.aslc | 28 ++ Platform/RaspberryPi/RPi4/AcpiTables/Dsdt.asl | 505 ++++++++++++++++= ++++ Platform/RaspberryPi/RPi4/AcpiTables/Fadt.aslc | 46 ++ Platform/RaspberryPi/RPi4/AcpiTables/Gtdt.aslc | 27 ++ Platform/RaspberryPi/RPi4/AcpiTables/Madt.aslc | 56 +++ Platform/RaspberryPi/RPi4/AcpiTables/Pep.asl | 89 ++++ Platform/RaspberryPi/RPi4/AcpiTables/Pep.c | 78 +++ Platform/RaspberryPi/RPi4/AcpiTables/Pep.h | 120 +++++ Platform/RaspberryPi/RPi4/AcpiTables/Rhpx.asl | 195 ++++++++ Platform/RaspberryPi/RPi4/AcpiTables/Sdhc.asl | 99 ++++ Platform/RaspberryPi/RPi4/AcpiTables/Spcr.asl | 47 ++ Platform/RaspberryPi/RPi4/AcpiTables/Uart.asl | 152 ++++++ 15 files changed, 1884 insertions(+) diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.h b/Platform/R= aspberryPi/RPi4/AcpiTables/AcpiTables.h new file mode 100644 index 000000000000..958af026c8a3 --- /dev/null +++ b/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.h @@ -0,0 +1,76 @@ +/** @file + * + * RPi3 defines for constructing ACPI tables + * + * Copyright (c) 2018, Andrei Warkentin + * Copyright (c) Microsoft Corporation. All rights reserved. + * + * SPDX-License-Identifier: BSD-2-Clause-Patent + * + **/ + +#ifndef __ACPITABLES_H__ +#define __ACPITABLES_H__ + +#include + +#define EFI_ACPI_OEM_ID {'M','C','R','S','F','T'} //= OEMID 6 bytes long +#define EFI_ACPI_OEM_TABLE_ID SIGNATURE_64 ('R','P','I','3= ','E','D','K','2') // OEM table id 8 bytes long +#define EFI_ACPI_OEM_REVISION 0x02000820 +#define EFI_ACPI_CREATOR_ID SIGNATURE_32 ('R','P','I','3= ') +#define EFI_ACPI_CREATOR_REVISION 0x00000097 + +#define EFI_ACPI_VENDOR_ID SIGNATURE_32 ('M','S','F','T= ') +#define EFI_ACPI_CSRT_REVISION 0x00000005 +#define EFI_ACPI_CSRT_DEVICE_ID_DMA 0x00000009 // Fixed id +#define EFI_ACPI_CSRT_RESOURCE_ID_IN_DMA_GRP 0x0 // Count up from 0 + +#define RPI3_DMA_CHANNEL_COUNT 10 // All 10 DMA channels ar= e listed, including the reserved ones +#define RPI3_DMA_USED_CHANNEL_COUNT 5 // Use 5 DMA channels + +#define EFI_ACPI_5_0_CSRT_REVISION 0x00000000 + +typedef enum +{ + EFI_ACPI_CSRT_RESOURCE_TYPE_RESERVED, // 0 + EFI_ACPI_CSRT_RESOURCE_TYPE_INTERRUPT, // 1 + EFI_ACPI_CSRT_RESOURCE_TYPE_TIMER, // 2 + EFI_ACPI_CSRT_RESOURCE_TYPE_DMA, // 3 + EFI_ACPI_CSRT_RESOURCE_TYPE_CACHE, // 4 +} +CSRT_RESOURCE_TYPE; + +typedef enum +{ + EFI_ACPI_CSRT_RESOURCE_SUBTYPE_DMA_CHANNEL, // 0 + EFI_ACPI_CSRT_RESOURCE_SUBTYPE_DMA_CONTROLLER // 1 +} +CSRT_DMA_SUBTYPE; + +//------------------------------------------------------------------------ +// CSRT Resource Group header 24 bytes long +//------------------------------------------------------------------------ +typedef struct +{ + UINT32 Length; // Length + UINT32 VendorID; // 4 bytes + UINT32 SubVendorId; // 4 bytes + UINT16 DeviceId; // 2 bytes + UINT16 SubdeviceId; // 2 bytes + UINT16 Revision; // 2 bytes + UINT16 Reserved; // 2 bytes + UINT32 SharedInfoLength; // 4 bytes +} EFI_ACPI_5_0_CSRT_RESOURCE_GROUP_HEADER; + +//------------------------------------------------------------------------ +// CSRT Resource Descriptor 12 bytes total +//------------------------------------------------------------------------ +typedef struct +{ + UINT32 Length; // 4 bytes + UINT16 ResourceType; // 2 bytes + UINT16 ResourceSubType; // 2 bytes + UINT32 UID; // 4 bytes +} EFI_ACPI_5_0_CSRT_RESOURCE_DESCRIPTOR_HEADER; + +#endif // __ACPITABLES_H__ diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.inf b/Platform= /RaspberryPi/RPi4/AcpiTables/AcpiTables.inf new file mode 100644 index 000000000000..7ef41e79ad46 --- /dev/null +++ b/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.inf @@ -0,0 +1,40 @@ +#/** @file +# +# ACPI table data and ASL sources required to boot the platform. +# +# Copyright (c) 2017, Andrey Warkentin +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION =3D 0x0001001A + BASE_NAME =3D AcpiTables + FILE_GUID =3D 7E374E25-8E01-4FEE-87F2-390C23C606CD + MODULE_TYPE =3D USER_DEFINED + VERSION_STRING =3D 1.0 + +# +# The following information is for reference only and not required by the = build tools. +# +# VALID_ARCHITECTURES =3D AARCH64 +# + +[Sources] + AcpiTables.h + Madt.aslc + Fadt.aslc + Dbg2.aslc + Gtdt.aslc + Dsdt.asl + Csrt.aslc + Spcr.asl + +[Packages] + MdePkg/MdePkg.dec + EmbeddedPkg/EmbeddedPkg.dec + +[FixedPcd] + gEmbeddedTokenSpaceGuid.PcdInterruptBaseAddress diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Csrt.aslc b/Platform/Rasp= berryPi/RPi4/AcpiTables/Csrt.aslc new file mode 100644 index 000000000000..3b617c0a832b --- /dev/null +++ b/Platform/RaspberryPi/RPi4/AcpiTables/Csrt.aslc @@ -0,0 +1,326 @@ +/** @file + * + * Core System Resource Table (CSRT) + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * + * SPDX-License-Identifier: BSD-2-Clause-Patent + * + **/ + +#include "AcpiTables.h" + +#define DMA_MAX_REQ_LINES 32 + +#pragma pack (push, 1) + +//------------------------------------------------------------------------ +// DMA Controller Vendor Data for RPi3 +//------------------------------------------------------------------------ +typedef struct +{ + UINT32 Length; + UINT32 Type; + UINT64 ChannelsBaseAddress; + UINT32 ChannelsBaseSize; + UINT64 ControllerBaseAddress; + UINT32 ControllerBaseSize; + UINT32 ChannelCount; + UINT32 ControllerInterrupt; + UINT32 MinimumRequestLine; + UINT32 MaximumRequestLine; + BOOLEAN CacheCoherent; +} DMA_CONTROLLER_VENDOR_DATA; + +//------------------------------------------------------------------------ +// DMA Controller on RPi3 +//------------------------------------------------------------------------ +typedef struct +{ + EFI_ACPI_5_0_CSRT_RESOURCE_DESCRIPTOR_HEADER DmaControllerHeader; + DMA_CONTROLLER_VENDOR_DATA ControllerVendorData; +} RD_DMA_CONTROLLER; + +//------------------------------------------------------------------------ +// DMA Channel Vendor Data for RPi3 +//------------------------------------------------------------------------ +typedef struct +{ + UINT32 ChannelNumber; + UINT32 ChannelInterrupt; + UINT16 IsReservedChannel; + UINT16 NoSrcNoDestAddrIncr; +} DMA_CHANNEL_VENDOR_DATA; + +//------------------------------------------------------------------------ +// DMA Channel on RPi3 +//------------------------------------------------------------------------ +typedef struct +{ + EFI_ACPI_5_0_CSRT_RESOURCE_DESCRIPTOR_HEADER DmaChannelHeader; + DMA_CHANNEL_VENDOR_DATA ChannelVendorData; +} RD_DMA_CHANNEL; + +//------------------------------------------------------------------------ +// DMA Resource Group on RPi3 +//------------------------------------------------------------------------ + +typedef struct +{ + EFI_ACPI_5_0_CSRT_RESOURCE_GROUP_HEADER ResGroupHeader; + RD_DMA_CONTROLLER DmaController; + RD_DMA_CHANNEL DmaChannels[RPI3_DMA_CHANNEL_COUNT]; +} RG_DMA; + +//------------------------------------------------------------------------= ---- +// CSRT table structure for RPi3 platform - current revision only includes= DMA +//------------------------------------------------------------------------= ---- +typedef struct +{ +// Standard ACPI Header + EFI_ACPI_DESCRIPTION_HEADER CsrtHeader; + +// DMA Resource Group + RG_DMA DmaResourceGroup; + +} EFI_ACPI_5_0_CSRT_TABLE; + +EFI_ACPI_5_0_CSRT_TABLE Csrt =3D +{ + //----------------------------------------------------------------------= -- + // ACPI Table Header + //----------------------------------------------------------------------= -- + { + EFI_ACPI_5_0_CORE_SYSTEM_RESOURCE_TABLE_SIGNATURE, // Signature = "CSRT" + sizeof (EFI_ACPI_DESCRIPTION_HEADER) + sizeof (RG_DMA), // Length + EFI_ACPI_5_0_CSRT_REVISION, // Revision + 0x00, // Checksum calculated at runtime. + EFI_ACPI_OEM_ID, // OEMID is a 6 bytes long field "BC28= 36" + EFI_ACPI_OEM_TABLE_ID, // OEM table identification(8 bytes lo= ng) "RPI3EDK2" + EFI_ACPI_OEM_REVISION, // OEM revision number. + EFI_ACPI_CREATOR_ID, // ASL compiler vendor ID. + EFI_ACPI_CREATOR_REVISION // ASL compiler revision number. + }, + + //----------------------------------------------------------------------= -- + // DMA Resource Group + //----------------------------------------------------------------------= -- + { + + //--------------------------------------------------------------------= ---- + // DMA Resource Group Header + //--------------------------------------------------------------------= ---- + { + sizeof (RG_DMA), // Resource Group Length + EFI_ACPI_VENDOR_ID, // VendorId + 0, // SubvendorId + EFI_ACPI_CSRT_DEVICE_ID_DMA, // DeviceId 9 + 0, // SubdeviceId + 0, // Revision + 0, // Reserved + 0 // SharedInfoLength + }, + + //--------------------------------------------------------------------= ----------- + // Resource Descriptor - DMA Controller + //--------------------------------------------------------------------= ----------- + { + { + sizeof (RD_DMA_CONTROLLER), // Length of this R= esource Descriptor + EFI_ACPI_CSRT_RESOURCE_TYPE_DMA, // Type for this re= source 3=3DDMA + EFI_ACPI_CSRT_RESOURCE_SUBTYPE_DMA_CONTROLLER, // Subtype for this= resource 1=3DDMA Controller + EFI_ACPI_CSRT_RESOURCE_ID_IN_DMA_GRP + 0, // ResourceId - 1= st DMA controller + }, + { + sizeof (DMA_CONTROLLER_VENDOR_DATA), // Controller vendor data he= re + 1, + 0x3F007000, // Base address for channels + RPI3_DMA_CHANNEL_COUNT * 0x100, // Base size =3D Number of channel= s x 0x100 size for each channel + 0x3F007FE0, // Base address for controller + 8, // Base size =3D two registers + RPI3_DMA_USED_CHANNEL_COUNT, + 0, // cannot use controller interrupt + 0, // Minimum Request Line + DMA_MAX_REQ_LINES - 1, // Maximum Request Line + FALSE, + }, + }, + + //--------------------------------------------------------------------= ---- + // Resource Descriptor(s) - DMA Channels 0 to n-1 + //--------------------------------------------------------------------= ---- + { + + // Channel 0 + { + { + sizeof (RD_DMA_CHANNEL), // Length of this Re= source Descriptor + EFI_ACPI_CSRT_RESOURCE_TYPE_DMA, // Type for this res= ource 3=3DDMA + EFI_ACPI_CSRT_RESOURCE_SUBTYPE_DMA_CHANNEL, // Subtype for this = resource 0=3DDMA Channel + EFI_ACPI_CSRT_RESOURCE_ID_IN_DMA_GRP + 1, // ResourceId + }, + { + 0, // Channel vendor data here + 0x30, // 16+32 dma_int[0] + 0, + 0 + }, + }, + + // Channel 1 reserved + { + { + sizeof (RD_DMA_CHANNEL), + EFI_ACPI_CSRT_RESOURCE_TYPE_DMA, + EFI_ACPI_CSRT_RESOURCE_SUBTYPE_DMA_CHANNEL, + EFI_ACPI_CSRT_RESOURCE_ID_IN_DMA_GRP + 2, // ResourceId + }, + { + 1, // Channel vendor data here + 0x31, // 17+32 dma_int[1] + 1, + 0 + }, + }, + + // Channel 2 - VC4 use only + { + { + sizeof (RD_DMA_CHANNEL), + EFI_ACPI_CSRT_RESOURCE_TYPE_DMA, + EFI_ACPI_CSRT_RESOURCE_SUBTYPE_DMA_CHANNEL, + EFI_ACPI_CSRT_RESOURCE_ID_IN_DMA_GRP + 3, // ResourceId + }, + { + 2, // Channel vendor data here + 0x32, // 18+32 dma_int[2] + 1, + 0 + }, + }, + + // Channel 3 - VC4 use only + { + { + sizeof (RD_DMA_CHANNEL), + EFI_ACPI_CSRT_RESOURCE_TYPE_DMA, + EFI_ACPI_CSRT_RESOURCE_SUBTYPE_DMA_CHANNEL, + EFI_ACPI_CSRT_RESOURCE_ID_IN_DMA_GRP + 4, + }, + { + 3, // Channel vendor data here + 0x33, // 19+32 dma_int[3] + 1, + 0 + }, + }, + + // channel 4 + { + { + sizeof (RD_DMA_CHANNEL), + EFI_ACPI_CSRT_RESOURCE_TYPE_DMA, + EFI_ACPI_CSRT_RESOURCE_SUBTYPE_DMA_CHANNEL, + EFI_ACPI_CSRT_RESOURCE_ID_IN_DMA_GRP + 5, + }, + { + 4, // Channel vendor data here + 0x34, // 20+32 dma_int[4] + 0, + 1 // SD host controller candidate + }, + }, + + // Channel 5 + { + { + sizeof (RD_DMA_CHANNEL), + EFI_ACPI_CSRT_RESOURCE_TYPE_DMA, + EFI_ACPI_CSRT_RESOURCE_SUBTYPE_DMA_CHANNEL, + EFI_ACPI_CSRT_RESOURCE_ID_IN_DMA_GRP + 6, + }, + { + 5, // Channel vendor data here + 0x35, // 21+32 dma_int[5] + 0, + 0 + }, + }, + + // Channel 6 is reserved + { + { + sizeof (RD_DMA_CHANNEL), + EFI_ACPI_CSRT_RESOURCE_TYPE_DMA, + EFI_ACPI_CSRT_RESOURCE_SUBTYPE_DMA_CHANNEL, + EFI_ACPI_CSRT_RESOURCE_ID_IN_DMA_GRP + 7, + }, + { + 6, // Channel vendor data here + 0x36, // 22+32 dma_int[6] + 1, + 0 + }, + }, + + // Channel 7 is reserved + { + { + sizeof (RD_DMA_CHANNEL), + EFI_ACPI_CSRT_RESOURCE_TYPE_DMA, + EFI_ACPI_CSRT_RESOURCE_SUBTYPE_DMA_CHANNEL, + EFI_ACPI_CSRT_RESOURCE_ID_IN_DMA_GRP + 8, + }, + { + 7, // Channel vendor data here + 0x37, // 23+32 dma_int[7] + 1, + 0 + }, + }, + + // Channel 8 + { + { + sizeof (RD_DMA_CHANNEL), + EFI_ACPI_CSRT_RESOURCE_TYPE_DMA, + EFI_ACPI_CSRT_RESOURCE_SUBTYPE_DMA_CHANNEL, + EFI_ACPI_CSRT_RESOURCE_ID_IN_DMA_GRP + 9, + }, + { + 8, // Channel vendor data here + 0x38, // 24+32 dma_int[8] + 0, + 0 + }, + }, + + // Channel 9 + { + { + sizeof (RD_DMA_CHANNEL), + EFI_ACPI_CSRT_RESOURCE_TYPE_DMA, + EFI_ACPI_CSRT_RESOURCE_SUBTYPE_DMA_CHANNEL, + EFI_ACPI_CSRT_RESOURCE_ID_IN_DMA_GRP + 10, + }, + { + 9, // channel vendor data here + 0x39, // 25+32 dma_int[9] + 0, + 0 + }, + } + + } // End DMA Channels 0 to 14 + + } // End DMA Resource group + +}; + +#pragma pack(pop) + +// +// Reference the table being generated to prevent the optimizer from remov= ing the +// data structure from the executable +// +VOID* CONST ReferenceAcpiTable =3D &Csrt; diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Dbg2.aslc b/Platform/Rasp= berryPi/RPi4/AcpiTables/Dbg2.aslc new file mode 100644 index 000000000000..9315f23e0d2d --- /dev/null +++ b/Platform/RaspberryPi/RPi4/AcpiTables/Dbg2.aslc @@ -0,0 +1,28 @@ +/** @file + * + * Debug Port Table (DBG2) + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * + * SPDX-License-Identifier: BSD-2-Clause-Patent + * + **/ + +UINT8 Dbg2[92] =3D { + 0x44, 0x42, 0x47, 0x32, 0x5C, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x4D, 0x53, 0x46, 0x54, 0x20, 0x20, 0x45, 0x44, 0x4B, 0x32, + 0x20, 0x20, 0x20, 0x20, 0x01, 0x00, 0x00, 0x00, 0x4D, 0x53, + 0x46, 0x54, 0x01, 0x00, 0x00, 0x00, 0x2C, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x01, 0x0A, 0x00, + 0x26, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x80, 0x10, 0x00, + 0x00, 0x00, 0x16, 0x00, 0x22, 0x00, 0x00, 0x20, 0x00, 0x10, + 0x00, 0x50, 0x21, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x00, + 0x00, 0x00, '\\', '_', 'S', 'B', '.', 'U', 'R', 'T', + 'M', 0x00, +}; + +// +// Reference the table being generated to prevent the optimizer from remov= ing the +// data structure from the executable +// +VOID* CONST ReferenceAcpiTable =3D &Dbg2; diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Dsdt.asl b/Platform/Raspb= erryPi/RPi4/AcpiTables/Dsdt.asl new file mode 100644 index 000000000000..ab4d4bf4851f --- /dev/null +++ b/Platform/RaspberryPi/RPi4/AcpiTables/Dsdt.asl @@ -0,0 +1,505 @@ +/** @file + * + * Differentiated System Definition Table (DSDT) + * + * Copyright (c) 2018, Andrey Warkentin + * Copyright (c) Microsoft Corporation. All rights reserved. + * + * SPDX-License-Identifier: BSD-2-Clause-Patent + * + **/ + +#define BCM_ALT0 0x4 +#define BCM_ALT1 0x5 +#define BCM_ALT2 0x6 +#define BCM_ALT3 0x7 +#define BCM_ALT4 0x3 +#define BCM_ALT5 0x2 + +DefinitionBlock ("Dsdt.aml", "DSDT", 5, "MSFT", "EDK2", 2) +{ + Scope (\_SB_) + { + include ("Sdhc.asl") + include ("Pep.asl") + + Device (CPU0) + { + Name (_HID, "ACPI0007") + Name (_UID, 0x0) + Method (_STA) + { + Return (0xf) + } + } + + Device (CPU1) + { + Name (_HID, "ACPI0007") + Name (_UID, 0x1) + Method (_STA) + { + Return (0xf) + } + } + + Device (CPU2) + { + Name (_HID, "ACPI0007") + Name (_UID, 0x2) + Method (_STA) + { + Return (0xf) + } + } + + Device (CPU3) + { + Name (_HID, "ACPI0007") + Name (_UID, 0x3) + Method (_STA) + { + Return (0xf) + } + } + + // DWC OTG Controller + Device (USB0) + { + Name (_HID, "BCM2848") + Name (_CID, Package() { "DWC_OTG", "DWC2_OTG"}) + Name (_UID, 0x0) + Name (_CCA, 0x0) + Method (_STA) + { + Return (0xf) + } + Method (_CRS, 0x0, Serialized) + { + Name (RBUF, ResourceTemplate () + { + MEMORY32FIXED(ReadWrite, 0x3F980000, 0x10000,) + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x29= } + }) + Return(RBUF) + } + } + + // Video Core 4 GPU + Device (GPU0) + { + Name (_HID, "BCM2850") + Name (_CID, "VC4") + Name (_UID, 0x0) + Name (_CCA, 0x0) + Method (_STA) + { + Return(0xf) + } + Method (_CRS, 0x0, Serialized) + { + Name (RBUF, ResourceTemplate () + { + // Memory and interrupt for the GPU + MEMORY32FIXED(ReadWrite, 0x3FC00000, 0x1000,) + Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x2= A } + + // HVS - Hardware Video Scalar + MEMORY32FIXED (ReadWrite, 0x3F400000, 0x6000,) + // The HVS interrupt is reserved by the VPU + // Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { = 0x41 } + + // PixelValve0 - DSI0 or DPI + // MEMORY32FIXED (ReadWrite, 0x3F206000, 0x100,) + // Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { = 0x4D } + + // PixelValve1 - DS1 or SMI + // MEMORY32FIXED (ReadWrite, 0x73F207000, 0x100,) + // Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { = 0x4E } + + // PixelValve2 - HDMI output - connected to HVS display FIFO 1 + MEMORY32FIXED (ReadWrite, 0x3F807000, 0x100,) + Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x4= A } + + // HDMI registers + MEMORY32FIXED (ReadWrite, 0x3F902000, 0x600,) // HDMI registers + MEMORY32FIXED (ReadWrite, 0x3F808000, 0x100,) // HD registers + // hdmi_int[0] + // Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { = 0x48 } + // hdmi_int[1] + // Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { = 0x49 } + + // HDMI DDC connection + I2CSerialBus (0x50,, 100000,, "\\_SB.I2C2",,,,) // EDID + I2CSerialBus (0x30,, 100000,, "\\_SB.I2C2",,,,) // E-DDC Segmen= t Pointer + }) + Return(RBUF) + } + + // GPU Power Management Component Data + // Reference : https://github.com/Microsoft/graphics-driver-samples/= wiki/Install-Driver-in-a-Windows-VM + Method (PMCD, 0, Serialized) + { + Name (RBUF, Package () + { + 1, // Version + 1, // Number of graphics power components + Package () // Power components package + { + Package () // GPU component package + { + 0, // Component Index + 0, // DXGK_POWER_COMPONENT_MAPPING.ComponentTyp= e (0 =3D DXGK_POWER_COMPONENT_ENGINE) + 0, // DXGK_POWER_COMPONENT_MAPPING.NodeIndex + + Buffer () // DXGK_POWER_RUNTIME_COMPONENT.ComponentGuid + { // 9B2D1E26-1575-4747-8FC0-B9EB4BAA2D2B + 0x26, 0x1E, 0x2D, 0x9B, 0x75, 0x15, 0x47, 0x47, + 0x8f, 0xc0, 0xb9, 0xeb, 0x4b, 0xaa, 0x2d, 0x2b + }, + + "VC4_Engine_00",// DXGK_POWER_RUNTIME_COMPONENT.ComponentName + 2, // DXGK_POWER_RUNTIME_COMPONENT.StateCount + + Package () // DXGK_POWER_RUNTIME_COMPONENT.States[] pac= kage + { + Package () // F0 + { + 0, // DXGK_POWER_RUNTIME_STATE.TransitionLatency + 0, // DXGK_POWER_RUNTIME_STATE.ResidencyRequirem= ent + 1210000, // DXGK_POWER_RUNTIME_STATE.NominalPower (mic= rowatt) + }, + + Package () // F1 - Placeholder + { + 10000, // DXGK_POWER_RUNTIME_STATE.TransitionLatency + 10000, // DXGK_POWER_RUNTIME_STATE.ResidencyRequirem= ent + 4, // DXGK_POWER_RUNTIME_STATE.NominalPower + }, + } + } + } + }) + Return (RBUF) + } + } + + // PiQ Mailbox Driver + Device (RPIQ) + { + Name (_HID, "BCM2849") + Name (_CID, "RPIQ") + Name (_UID, 0) + Name (_CCA, 0x0) + Method (_STA) + { + Return (0xf) + } + Method (_CRS, 0x0, Serialized) + { + Name (RBUF, ResourceTemplate () + { + Memory32Fixed (ReadWrite, 0x3F00B880, 0x00000024,) + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x61= } + }) + Return (RBUF) + } + } + + // VCHIQ Driver + Device (VCIQ) + { + Name (_HID, "BCM2835") + Name (_CID, "VCIQ") + Name (_UID, 0) + Name (_CCA, 0x0) + Name (_DEP, Package() { \_SB.RPIQ }) + Method (_STA) + { + Return (0xf) + } + Method (_CRS, 0x0, Serialized) + { + Name (RBUF, ResourceTemplate () + { + Memory32Fixed (ReadWrite, 0x3F00B840, 0x00000010,) + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x62= } + }) + Return (RBUF) + } + } + + // VC Shared Memory Driver + Device (VCSM) + { + Name (_HID, "BCM2856") + Name (_CID, "VCSM") + Name (_UID, 0) + Name (_CCA, 0x0) + Name (_DEP, Package() { \_SB.VCIQ }) + Method (_STA) + { + Return (0xf) + } + } + + // Description: GPIO + Device (GPI0) + { + Name (_HID, "BCM2845") + Name (_CID, "BCMGPIO") + Name (_UID, 0x0) + Name (_CCA, 0x0) + Method (_STA) + { + Return(0xf) + } + Method (_CRS, 0x0, Serialized) + { + Name (RBUF, ResourceTemplate () + { + MEMORY32FIXED (ReadWrite, 0x3F200000, 0xB4, ) + Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) { 0x51 } + Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) { 0x53 } + }) + Return (RBUF) + } + } + + // Description: I2C + Device (I2C1) + { + Name (_HID, "BCM2841") + Name (_CID, "BCMI2C") + Name (_UID, 0x1) + Name (_CCA, 0x0) + Method (_STA) + { + Return(0xf) + } + Method (_CRS, 0x0, Serialized) + { + Name (RBUF, ResourceTemplate () + { + Memory32Fixed(ReadWrite, 0x3F804000, 0x20) + Interrupt(ResourceConsumer, Level, ActiveHigh, Shared) {0x55} + + // + // MsftFunctionConfig is encoded as the VendorLong. + // + // MsftFunctionConfig (Exclusive, PullUp, BCM_ALT0, "\\_SB.GPI0"= , 0, ResourceConsumer,) {2, 3} + // + VendorLong () // Length =3D 0x31 + { + /* 0000 */ 0x00, 0x60, 0x44, 0xD5, 0xF3, 0x1F, 0x11, 0x60, /= / .`D....` + /* 0008 */ 0x4A, 0xB8, 0xB0, 0x9C, 0x2D, 0x23, 0x30, 0xDD, /= / J...-#0. + /* 0010 */ 0x2F, 0x8D, 0x1D, 0x00, 0x01, 0x10, 0x00, 0x01, /= / /....... + /* 0018 */ 0x04, 0x00, 0x12, 0x00, 0x00, 0x16, 0x00, 0x20, /= / ........ + /* 0020 */ 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x00, 0x5C, /= / ........ + /* 0028 */ 0x5F, 0x53, 0x42, 0x2E, 0x47, 0x50, 0x49, 0x30, /= / _SB.GPI0 + /* 0030 */ 0x00 /= / . + } + }) + Return (RBUF) + } + } + + // I2C2 is the HDMI DDC connection + Device (I2C2) + { + Name (_HID, "BCM2841") + Name (_CID, "BCMI2C") + Name (_UID, 0x2) + Name (_CCA, 0x0) + Method (_STA) + { + Return (0xf) + } + Method (_CRS, 0x0, Serialized) + { + Name (RBUF, ResourceTemplate() + { + Memory32Fixed (ReadWrite, 0x3F805000, 0x20) + Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) {0x55} + }) + Return (RBUF) + } + } + + // SPI + Device (SPI0) + { + Name (_HID, "BCM2838") + Name (_CID, "BCMSPI0") + Name (_UID, 0x0) + Name (_CCA, 0x0) + Method (_STA) + { + Return (0xf) + } + Method (_CRS, 0x0, Serialized) + { + Name (RBUF, ResourceTemplate () + { + MEMORY32FIXED (ReadWrite, 0x3F204000, 0x20,) + Interrupt(ResourceConsumer, Level, ActiveHigh, Shared) {0x56} + + // + // MsftFunctionConfig is encoded as the VendorLong. + // + // MsftFunctionConfig (Exclusive, PullDown, BCM_ALT0, "\\_SB.GPI= 0", 0, ResourceConsumer, ) {9, 10, 11} // MISO, MOSI, SCLK + VendorLong () // Length =3D 0x33 + { + /* 0000 */ 0x00, 0x60, 0x44, 0xD5, 0xF3, 0x1F, 0x11, 0x60, /= / .`D....` + /* 0008 */ 0x4A, 0xB8, 0xB0, 0x9C, 0x2D, 0x23, 0x30, 0xDD, /= / J...-#0. + /* 0010 */ 0x2F, 0x8D, 0x1F, 0x00, 0x01, 0x10, 0x00, 0x02, /= / /....... + /* 0018 */ 0x04, 0x00, 0x12, 0x00, 0x00, 0x18, 0x00, 0x22, /= / ......." + /* 0020 */ 0x00, 0x00, 0x00, 0x09, 0x00, 0x0A, 0x00, 0x0B, /= / ........ + /* 0028 */ 0x00, 0x5C, 0x5F, 0x53, 0x42, 0x2E, 0x47, 0x50, /= / .\_SB.GP + /* 0030 */ 0x49, 0x30, 0x00 /= / I0. + } + + // + // MsftFunctionConfig is encoded as the VendorLong. + // + // MsftFunctionConfig (Exclusive, PullUp, BCM_ALT0, "\\_SB.GPI0"= , 0, ResourceConsumer, ) {8} // CE0 + VendorLong () // Length =3D 0x2F + { + /* 0000 */ 0x00, 0x60, 0x44, 0xD5, 0xF3, 0x1F, 0x11, 0x60, /= / .`D....` + /* 0008 */ 0x4A, 0xB8, 0xB0, 0x9C, 0x2D, 0x23, 0x30, 0xDD, /= / J...-#0. + /* 0010 */ 0x2F, 0x8D, 0x1B, 0x00, 0x01, 0x10, 0x00, 0x01, /= / /....... + /* 0018 */ 0x04, 0x00, 0x12, 0x00, 0x00, 0x14, 0x00, 0x1E, /= / ........ + /* 0020 */ 0x00, 0x00, 0x00, 0x08, 0x00, 0x5C, 0x5F, 0x53, /= / .....\_S + /* 0028 */ 0x42, 0x2E, 0x47, 0x50, 0x49, 0x30, 0x00 /= / B.GPI0. + } + + // + // MsftFunctionConfig is encoded as the VendorLong. + // + // MsftFunctionConfig (Exclusive, PullUp, BCM_ALT0, "\\_SB.GPI0"= , 0, ResourceConsumer, ) {7} // CE1 + VendorLong () // Length =3D 0x2F + { + /* 0000 */ 0x00, 0x60, 0x44, 0xD5, 0xF3, 0x1F, 0x11, 0x60, /= / .`D....` + /* 0008 */ 0x4A, 0xB8, 0xB0, 0x9C, 0x2D, 0x23, 0x30, 0xDD, /= / J...-#0. + /* 0010 */ 0x2F, 0x8D, 0x1B, 0x00, 0x01, 0x10, 0x00, 0x01, /= / /....... + /* 0018 */ 0x04, 0x00, 0x12, 0x00, 0x00, 0x14, 0x00, 0x1E, /= / ........ + /* 0020 */ 0x00, 0x00, 0x00, 0x07, 0x00, 0x5C, 0x5F, 0x53, /= / .....\_S + /* 0028 */ 0x42, 0x2E, 0x47, 0x50, 0x49, 0x30, 0x00 /= / B.GPI0. + } + }) + Return (RBUF) + } + } + + Device (SPI1) + { + Name (_HID, "BCM2839") + Name (_CID, "BCMAUXSPI") + Name (_UID, 0x1) + Name (_CCA, 0x0) + Name (_DEP, Package() { \_SB.RPIQ }) + Method (_STA) + { + Return (0xf) + } + Method (_CRS, 0x0, Serialized) + { + Name (RBUF, ResourceTemplate () + { + MEMORY32FIXED (ReadWrite, 0x3F215080, 0x40,) + Interrupt (ResourceConsumer, Level, ActiveHigh, Shared,) {0x3D} + + // + // MsftFunctionConfig is encoded as the VendorLong. + // + // MsftFunctionConfig(Exclusive, PullDown, BCM_ALT4, "\\_SB.GPI0= ", 0, ResourceConsumer, ) {19, 20, 21} // MISO, MOSI, SCLK + VendorLong () // Length =3D 0x33 + { + /* 0000 */ 0x00, 0x60, 0x44, 0xD5, 0xF3, 0x1F, 0x11, 0x60, /= / .`D....` + /* 0008 */ 0x4A, 0xB8, 0xB0, 0x9C, 0x2D, 0x23, 0x30, 0xDD, /= / J...-#0. + /* 0010 */ 0x2F, 0x8D, 0x1F, 0x00, 0x01, 0x10, 0x00, 0x02, /= / /....... + /* 0018 */ 0x03, 0x00, 0x12, 0x00, 0x00, 0x18, 0x00, 0x22, /= / ......." + /* 0020 */ 0x00, 0x00, 0x00, 0x13, 0x00, 0x14, 0x00, 0x15, /= / ........ + /* 0028 */ 0x00, 0x5C, 0x5F, 0x53, 0x42, 0x2E, 0x47, 0x50, /= / .\_SB.GP + /* 0030 */ 0x49, 0x30, 0x00 /= / I0. + } + + // + // MsftFunctionConfig is encoded as the VendorLong. + // + // MsftFunctionConfig(Exclusive, PullDown, BCM_ALT4, "\\_SB.GPI0= ", 0, ResourceConsumer, ) {16} // CE2 + VendorLong () // Length =3D 0x2F + { + /* 0000 */ 0x00, 0x60, 0x44, 0xD5, 0xF3, 0x1F, 0x11, 0x60, /= / .`D....` + /* 0008 */ 0x4A, 0xB8, 0xB0, 0x9C, 0x2D, 0x23, 0x30, 0xDD, /= / J...-#0. + /* 0010 */ 0x2F, 0x8D, 0x1B, 0x00, 0x01, 0x10, 0x00, 0x02, /= / /....... + /* 0018 */ 0x03, 0x00, 0x12, 0x00, 0x00, 0x14, 0x00, 0x1E, /= / ........ + /* 0020 */ 0x00, 0x00, 0x00, 0x10, 0x00, 0x5C, 0x5F, 0x53, /= / .....\_S + /* 0028 */ 0x42, 0x2E, 0x47, 0x50, 0x49, 0x30, 0x00 /= / B.GPI0. + } + }) + Return (RBUF) + } + } + + // SPI2 has no pins on GPIO header + // Device (SPI2) + // { + // Name (_HID, "BCM2839") + // Name (_CID, "BCMAUXSPI") + // Name (_UID, 0x2) + // Name (_CCA, 0x0) + // Name (_DEP, Package() { \_SB.RPIQ }) + // Method (_STA) + // { + // Return (0xf) // Disabled + // } + // Method (_CRS, 0x0, Serialized) + // { + // Name (RBUF, ResourceTemplate () + // { + // MEMORY32FIXED (ReadWrite, 0x3F2150C0, 0x40,) + // Interrupt (ResourceConsumer, Level, ActiveHigh, Shared,) {0x3= D} + // }) + // Return (RBUF) + // } + // } + + // PWM Driver + Device (PWM0) + { + Name (_HID, "BCM2844") + Name (_CID, "BCM2844") + Name (_UID, 0) + Name (_CCA, 0x0) + Method (_STA) + { + Return (0xf) + } + Method (_CRS, 0x0, Serialized) + { + Name (RBUF, ResourceTemplate () + { + // DMA channel 11 control + Memory32Fixed (ReadWrite, 0x3F007B00, 0x00000100,) + // PWM control + Memory32Fixed (ReadWrite, 0x3F20C000, 0x00000028,) + // PWM control bus + Memory32Fixed (ReadWrite, 0x7E20C000, 0x00000028,) + // PWM control uncached + Memory32Fixed (ReadWrite, 0xFF20C000, 0x00000028,) + // PWM clock control + Memory32Fixed (ReadWrite, 0x3F1010A0, 0x00000008,) + // Interrupt DMA channel 11 + Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x3= B } + // DMA channel 11, DREQ 5 for PWM + FixedDMA (5, 11, Width32Bit, ) + }) + Return (RBUF) + } + } + + include ("Uart.asl") + include ("Rhpx.asl") + } +} diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Fadt.aslc b/Platform/Rasp= berryPi/RPi4/AcpiTables/Fadt.aslc new file mode 100644 index 000000000000..3ef877fde5f4 --- /dev/null +++ b/Platform/RaspberryPi/RPi4/AcpiTables/Fadt.aslc @@ -0,0 +1,46 @@ +/** @file + * + * Fixed ACPI Description Table (FADT) + * + * Copyright (c) 2018, Andrey Warkentin + * Copyright (c) Microsoft Corporation. All rights reserved. + * + * SPDX-License-Identifier: BSD-2-Clause-Patent + * + **/ + +UINT8 Fadt[268] =3D { + 0x46, 0x41, 0x43, 0x50, 0x0C, 0x01, 0x00, 0x00, 0x05, 0x00, /* 0 */ + 0x42, 0x43, 0x32, 0x38, 0x33, 0x36, 0x45, 0x44, 0x4B, 0x32, /* 10 */ + 0x20, 0x20, 0x20, 0x20, 0x01, 0x00, 0x00, 0x00, 0x4D, 0x53, /* 20 */ + 0x46, 0x54, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 30 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, /* 40 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 50 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 60 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 70 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 80 */ + 0x00, 0x04, 0x00, 0x00, 0x00, 0xE3, 0x00, 0x00, 0x00, 0x00, /* 90 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, /* 100 */ + 0x00, 0x00, 0x21, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, /* 110 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, /* 120 */ + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 130 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 140 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 150 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 160 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 170 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 180 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 190 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 200 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 210 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 220 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 230 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 240 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 250 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /* 268 */ +}; + +// +// Reference the table being generated to prevent the optimizer from remov= ing the +// data structure from the executable +// +VOID* CONST ReferenceAcpiTable =3D &Fadt; diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Gtdt.aslc b/Platform/Rasp= berryPi/RPi4/AcpiTables/Gtdt.aslc new file mode 100644 index 000000000000..6551315a5502 --- /dev/null +++ b/Platform/RaspberryPi/RPi4/AcpiTables/Gtdt.aslc @@ -0,0 +1,27 @@ +/** @file + * + * Generic Timer Description Table (GTDT) + * Automatically generated by AutoAcpi + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * + * SPDX-License-Identifier: BSD-2-Clause-Patent + * + **/ + +UINT8 Gtdt[80] =3D { + 0x47, 0x54, 0x44, 0x54, 0x50, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x4D, 0x53, 0x46, 0x54, 0x20, 0x20, 0x45, 0x44, 0x4B, 0x32, + 0x20, 0x20, 0x20, 0x20, 0x01, 0x00, 0x00, 0x00, 0x4D, 0x53, + 0x46, 0x54, 0x01, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x40, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +// +// Reference the table being generated to prevent the optimizer from remov= ing the +// data structure from the executable +// +VOID* CONST ReferenceAcpiTable =3D &Gtdt; diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Madt.aslc b/Platform/Rasp= berryPi/RPi4/AcpiTables/Madt.aslc new file mode 100644 index 000000000000..39cd4c5cee6c --- /dev/null +++ b/Platform/RaspberryPi/RPi4/AcpiTables/Madt.aslc @@ -0,0 +1,56 @@ +/** @file + * + * Multiple APIC Description Table (MADT) + * + * Copyright (c) 2018, Andrey Warkentin + * Copyright (c) Microsoft Corporation. All rights reserved. + * + * SPDX-License-Identifier: BSD-2-Clause-Patent + * + **/ + +/* + * Even though the BCM283x don't contain a GIC, these + * GICC definitions enable multi-core support (with PSCI). + * + * Mind the signatures in the header, they must be kept. + */ +UINT8 Madt[] =3D { + 0x41, 0x50, 0x49, 0x43, 0x6c, 0x01, 0x00, 0x00, 0x03, 0xaf, 0x42, 0x43, + 0x32, 0x38, 0x33, 0x36, 0x45, 0x44, 0x4b, 0x32, 0x20, 0x20, 0x20, 0x20, + 0x01, 0x00, 0x00, 0x00, 0x4d, 0x53, 0x46, 0x54, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x50, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x0b, 0x50, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x0b, 0x50, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x50, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00 +}; + +// +// Reference the table being generated to prevent the optimizer from remov= ing the +// data structure from the executable +// +VOID* CONST ReferenceAcpiTable =3D &Madt; diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Pep.asl b/Platform/Raspbe= rryPi/RPi4/AcpiTables/Pep.asl new file mode 100644 index 000000000000..2ddb27bcdbb3 --- /dev/null +++ b/Platform/RaspberryPi/RPi4/AcpiTables/Pep.asl @@ -0,0 +1,89 @@ +/** @file + * + * Platform Extension Plugin (PEP). + * + * Copyright (c) 2018, Andrey Warkentin + * Copyright (c) Microsoft Corporation. All rights reserved. + * + * SPDX-License-Identifier: BSD-2-Clause-Patent + * + **/ + +Device(PEPD) +{ + // + // RPI3 PEP virtual device. + // + Name (_HID, "BCM2854") // Note: since pep on rpi3 is virtual device, + Name (_CID, "BCM2854") // its device id needs to be generated by Microso= ft + Name (_UID, 0x0) + Name (_CRS, ResourceTemplate () + { + // No hardware resources for PEP driver are needed. + }) + + // + // Processor info. PEP proprietary method to return + // PEP_PROCESSOR_TABLE_PLAT structure. + // + // See Pep.h and Pep.c. + // + Name (_GPI, Buffer() + { + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5C, 0x00, 0x5F, 0x00= , 0x53, + 0x00, 0x42, 0x00, 0x2E, 0x00, 0x43, 0x00, 0x50, 0x00, 0x55, 0x00, 0x30, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }) + + // + // Coordinated state info. PEP proprietary method to return + // PEP_COORDINATED_STATE_TABLE_PLAT structure. + // + // See Pep.h and Pep.c. + // + Name (_GCI, Buffer() + { + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00= , 0x00, + 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 + }) + + // + // Device info. PEP proprietary method to return + // PEP_DEVICE_TABLE_PLAT structure. + // + // See Pep.h and Pep.c. + // + Name (_GDI, Buffer() + { + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5C, 0x00, 0x5F, 0x00= , 0x53, + 0x00, 0x42, 0x00, 0x2E, 0x00, 0x49, 0x00, 0x32, 0x00, 0x43, 0x00, 0x30, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }) +} diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Pep.c b/Platform/Raspberr= yPi/RPi4/AcpiTables/Pep.c new file mode 100644 index 000000000000..51db779d7976 --- /dev/null +++ b/Platform/RaspberryPi/RPi4/AcpiTables/Pep.c @@ -0,0 +1,78 @@ +/** @file + * + * PEP device tables + * + * Copyright (c) 2018, Andrei Warkentin + * Copyright (c) Microsoft Corporation. All rights reserved. + * + * SPDX-License-Identifier: BSD-2-Clause-Patent + * + **/ + +#include "Pep.h" + +PEP_PROCESSOR_TABLE_PLAT RPI3Processors =3D { + 1, // Version + 1, // NumberProcessors + { // ProcessorInfo + { // [0] + L"\\_SB.CPU0", // DevicePath, wchar_t[16] + 0, // FeedbackCounterCount + 0x00000000, // Flags + 0, // NumberIdleStates + 0, // NumberPerfStates + { // IdleInfo + }, + { // perfinfo + } + } + } +}; + +PEP_COORDINATED_STATE_TABLE_PLAT RPI3CoordinatedStates =3D { + 1, // Version + 1, // CoordinatedStateCount + { // CordinatedStates[] + { // [0] + { // DependencyInfo + { // [0] + 1, // ExpectedState + 0, // TargetProcessor + 0x0 | 0x2 | 0x4, // LooseDependency =3D FALSE, InitialState =3D = TRUE, DependentState =3D TRUE + } + }, + SOC_STATE_TYPE, // StateType + 0x1, // Flags + 0, // Latency + 0, // BreakEvenDuration + 1, // DependencyCount + 1, // MaximumDependencySize + } + } +}; + +PEP_DEVICE_TABLE_PLAT RPI3Devices =3D { + 1, // Version + 1, // NumberDevices + { // DeviceInfo + { // [1] + L"\\_SB.I2C0", // DevicePath, wchar_t[16] + 0x1 | (1 << 3), // DStateSupportMask (D0 and D3) + 1, // NumberCompoenents + { // DStateRequirement + { // [0] + PowerDeviceD3 // DState + } + }, + { // FStateRequirement + { // [0] + { // FState + { // [0] + 0 + } + } + } + } + } + } +}; diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Pep.h b/Platform/Raspberr= yPi/RPi4/AcpiTables/Pep.h new file mode 100644 index 000000000000..f5f04518dec6 --- /dev/null +++ b/Platform/RaspberryPi/RPi4/AcpiTables/Pep.h @@ -0,0 +1,120 @@ +/** @file + * + * PEP device defines + * + * Copyright (c) 2018, Andrei Warkentin + * Copyright (c) Microsoft Corporation. All rights reserved. + * + * SPDX-License-Identifier: BSD-2-Clause-Patent + * + **/ + +/* + * Note: Not everything is here. At least SOC_STATE_TYPE is missing. + */ + +#ifndef _RPI3PEP_H_INCLUDED_ +#define _RPI3PEP_H_INCLUDED_ + +#include + +#define PEP_MAX_DEPENDENCIES_PER_STATE 16 +#define MAX_PROCESSOR_PATH_LENGTH 16 +#define MAX_DEVICE_PATH_LENGTH 32 +#define MAX_COMPONENT_COUNT 8 +#define P_NUMBER_PROCESSORS 1 +#define P_NUMBER_IDLE_STATES 1 +#define P_NUMBER_PERF_STATES 0 +#define P_NUMBER_DEVICES 1 +#define P_NUMBER_COORDINATED_STATS 1 + +typedef struct _PEP_PROCESSOR_IDLE_STATE_INFO { + UINT32 Ulong; + UINT32 Latency; + UINT32 BreakEvenDuration; +} PEP_PROCESSOR_IDLE_STATE_INFO, *PEP_PROCESSOR_IDLE_STATE_INFO; + +typedef struct _PEP_PROCESSOR_IDLE_INFO_PLAT { + // + // Processor idle states. + // + PEP_PROCESSOR_IDLE_STATE_INFO IdleStates[P_NUMBER_IDLE_STATES]; +} PEP_PROCESSOR_IDLE_INFO_PLAT, *PPEP_PROCESSOR_IDLE_INFO_PLAT; + +typedef struct COORDINATED_DEPENDENCY_INFO { + UINT32 ExpectedState; + UINT32 TargetProcessor; + UINT32 Ulong; +} COORDINATED_DEPENDENCY_INFO, *PCOORDINATED_DEPENDENCY_INFO; + +typedef struct { + COORDINATED_DEPENDENCY_INFO DependencyInfo[PEP_MAX_DEPENDENCIES_PER_STAT= E]; + UINT32 StateType; + UINT32 Ulong; + UINT32 Latency; + UINT32 BreakEvenDuration; + UINT32 DependencyCount; + UINT32 MaximumDependencySize; +} COORDINATED_STATE_INFO; + +typedef struct { + UINT32 Unused; +} PEP_PROCESSOR_PERF_INFO; + +typedef struct { + UINT32 FState[MAX_COMPONENT_COUNT]; +} COORDINATED_FSTATE_REQUIREMENT; + +typedef struct { + UINT32 DState; +} COORDINATED_DSTATE_REQUIREMENT; + +// +// Top level device table +// *N.B. The exact length of the structure is determined by the NumberIdle= States/NumberPerfStates variables. +// + +typedef struct _PEP_PROCESSOR_INFO_PLAT { + WCHAR DevicePath[MAX_PROCESSOR_PATH_LENGTH]; // Null-terminated ACPI name + ULONG FeedbackCounterCount; + ULONG Flags; + + // + // We are putting the idle/perf state count here (instead + // of the PEP_PROCESSOR_xxx_INFO structure for the ease of parsing. + // + ULONG NumberIdleStates; + ULONG NumberPerfStates; + + PEP_PROCESSOR_IDLE_INFO_PLAT IdleInfo; + PEP_PROCESSOR_PERF_INFO PerfInfo; +} PEP_PROCESSOR_INFO_PLAT, *PPEP_PROCESSOR_INFO_PLAT; + +typedef struct _PEP_PROCESSOR_TABLE_PLAT { + UINT32 Version; + UINT32 NumberProcessors; + PEP_PROCESSOR_INFO_PLAT ProcessorInfo[P_NUMBER_PROCESSORS]; +} PEP_PROCESSOR_TABLE_PLAT; + +typedef struct _PEP_COORDINATED_STATE_TABLE_PLAT { + ULONG Version; + ULONG CoordinatedStateCount; + COORDINATED_STATE_INFO CoordinatedStates[P_NUMBER_COORDINATED_STATS]; +} PEP_COORDINATED_STATE_TABLE_PLAT, *PPEP_COORDINATED_STATE_TABLE_PLAT; + +typedef struct _PEP_DEVICE_INFO_PLAT { + WCHAR DevicePath[MAX_DEVICE_PATH_LENGTH]; // Null-terminated ACPI name + ULONG DStateSupportMask; + ULONG NumberComponents; + + COORDINATED_DSTATE_REQUIREMENT DStateRequirement[P_NUMBER_COORDINATED_ST= ATS]; + COORDINATED_FSTATE_REQUIREMENT FStateRequirement[P_NUMBER_COORDINATED_ST= ATS]; +} PEP_DEVICE_INFO_PLAT, *PPEP_DEVICE_INFO_PLAT; + +typedef struct _PEP_DEVICE_TABLE_PLAT { + ULONG Version; + ULONG NumberDevices; + PEP_DEVICE_INFO_PLAT DeviceInfo[P_NUMBER_DEVICES]; +} PEP_DEVICE_TABLE_PLAT, *PPEP_DEVICE_TABLE_PLAT; + +#endif // _RPI3PEP_H_INCLUDED_ diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Rhpx.asl b/Platform/Raspb= erryPi/RPi4/AcpiTables/Rhpx.asl new file mode 100644 index 000000000000..0971e13ee013 --- /dev/null +++ b/Platform/RaspberryPi/RPi4/AcpiTables/Rhpx.asl @@ -0,0 +1,195 @@ +/** @file + * + * [DSDT] RHProxy device to enable WinRT API (RHPX) + * + * Copyright (c) 2018, Andrey Warkentin + * Copyright (c) Microsoft Corporation. All rights reserved. + * + * SPDX-License-Identifier: BSD-2-Clause-Patent + * + **/ + +Device (RHPX) +{ + Name (_HID, "MSFT8000") + Name (_CID, "MSFT8000") + Name (_UID, 1) + + Name(_CRS, ResourceTemplate () + { + // Index 0 + SPISerialBus ( // SCKL - GPIO 11 - Pin 23 + // MOSI - GPIO 10 - Pin 19 + // MISO - GPIO 9 - Pin 21 + // CE0 - GPIO 8 - Pin 24 + 0, // Device selection (CE0) + PolarityLow, // Device selection polarity + FourWireMode, // WireMode + 8, // DataBit len + ControllerInitiated, // Slave mode + 4000000, // Connection speed + ClockPolarityLow, // Clock polarity + ClockPhaseFirst, // Clock phase + "\\_SB.SPI0", // ResourceSource: SPI bus controller name + 0, // ResourceSourceIndex + // Resource usage + // DescriptorName: creates name for offset of= resource descriptor + ) // Vendor Data + + // Index 1 + SPISerialBus ( // SCKL - GPIO 11 - Pin 23 + // MOSI - GPIO 10 - Pin 19 + // MISO - GPIO 9 - Pin 21 + // CE1 - GPIO 7 - Pin 26 + 1, // Device selection (CE1) + PolarityLow, // Device selection polarity + FourWireMode, // WireMode + 8, // DataBit len + ControllerInitiated, // Slave mode + 4000000, // Connection speed + ClockPolarityLow, // Clock polarity + ClockPhaseFirst, // Clock phase + "\\_SB.SPI0", // ResourceSource: SPI bus controller name + 0, // ResourceSourceIndex + // Resource usage + // DescriptorName: creates name for offset of= resource descriptor + ) // Vendor Data + + // Index 2 + I2CSerialBus ( // Pin 3 (GPIO2, SDA1), 5 (GPIO3, SCL1) + 0xFFFF, // SlaveAddress: placeholder + , // SlaveMode: default to ControllerInitiated + 0, // ConnectionSpeed: placeholder + , // Addressing Mode: default to 7 bit + "\\_SB.I2C1", // ResourceSource: I2C bus controller name + , + , + , // Descriptor Name: creates name for offset o= f resource descriptor + ) // Vendor Data + + // Index 3 + SPISerialBus ( // SPI1_SCLK - GPIO21 + // SPI1_MOSI - GPIO20 + // SPI1_MISO - GPIO19 + // SPI1_CE2_N - GPIO16 + 2, // Device selection (CE2) + PolarityLow, // Device selection polarity + FourWireMode, // WireMode + 8, // DataBit len + ControllerInitiated, // Slave mode + 4000000, // Connection speed + ClockPolarityLow, // Clock polarity + ClockPhaseFirst, // Clock phase + "\\_SB.SPI1", // ResourceSource: SPI bus controller name + 0, // ResourceSourceIndex + // Resource usage + // DescriptorName: creates name for offset of= resource descriptor + ) // Vendor Data + + // GPIO 2 + GpioIO (Shared, PullUp, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, Reso= urceConsumer,,) { 2 } + GpioInt (Edge, ActiveBoth, Shared, PullUp, 0, "\\_SB.GPI0",) = { 2 } + // GPIO 3 + GpioIO (Shared, PullUp, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, Reso= urceConsumer,,) { 3 } + GpioInt (Edge, ActiveBoth, Shared, PullUp, 0, "\\_SB.GPI0",) = { 3 } + // GPIO 4 + GpioIO (Shared, PullUp, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, Reso= urceConsumer,,) { 4 } + GpioInt (Edge, ActiveBoth, Shared, PullUp, 0, "\\_SB.GPI0",) = { 4 } + // GPIO 5 + GpioIO (Shared, PullUp, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, Reso= urceConsumer,,) { 5 } + GpioInt (Edge, ActiveBoth, Shared, PullUp, 0, "\\_SB.GPI0",) = { 5 } + // GPIO 6 + GpioIO (Shared, PullUp, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, Reso= urceConsumer,,) { 6 } + GpioInt (Edge, ActiveBoth, Shared, PullUp, 0, "\\_SB.GPI0",) = { 6 } + // GPIO 7 + GpioIO (Shared, PullUp, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, Reso= urceConsumer,,) { 7 } + GpioInt (Edge, ActiveBoth, Shared, PullUp, 0, "\\_SB.GPI0",) = { 7 } + // GPIO 8 + GpioIO (Shared, PullUp, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, Reso= urceConsumer,,) { 8 } + GpioInt (Edge, ActiveBoth, Shared, PullUp, 0, "\\_SB.GPI0",) = { 8 } + // GPIO 9 + GpioIO (Shared, PullDown, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, Re= sourceConsumer,,) { 9 } + GpioInt (Edge, ActiveBoth, Shared, PullDown, 0, "\\_SB.GPI0",) = { 9 } + // GPIO 10 + GpioIO (Shared, PullDown, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, Re= sourceConsumer,,) { 10 } + GpioInt (Edge, ActiveBoth, Shared, PullDown, 0, "\\_SB.GPI0",) = { 10 } + // GPIO 11 + GpioIO (Shared, PullDown, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, Re= sourceConsumer,,) { 11 } + GpioInt (Edge, ActiveBoth, Shared, PullDown, 0, "\\_SB.GPI0",) = { 11 } + // GPIO 12 + GpioIO (Shared, PullDown, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, Re= sourceConsumer,,) { 12 } + GpioInt (Edge, ActiveBoth, Shared, PullDown, 0, "\\_SB.GPI0",) = { 12 } + // GPIO 13 + GpioIO (Shared, PullDown, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, Re= sourceConsumer,,) { 13 } + GpioInt (Edge, ActiveBoth, Shared, PullDown, 0, "\\_SB.GPI0",) = { 13 } + // NTRAID#MSFT-7141401-2016/04/7-jordanrh - disable UART muxing + // until a proper solution can be created for the dmap conflict + // GPIO 14 - UART TX + // GpioIO (Shared, PullDown, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0,= ResourceConsumer,,) { 14 } + // GpioInt (Edge, ActiveBoth, Shared, PullDown, 0, "\\_SB.GPI0",) = { 14 } + // GPIO 15 - UART RX + // GpioIO (Shared, PullDown, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0,= ResourceConsumer,,) { 15 } + // GpioInt (Edge, ActiveBoth, Shared, PullDown, 0, "\\_SB.GPI0",) = { 15 } + // GPIO 16 + GpioIO (Shared, PullDown, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, Re= sourceConsumer,,) { 16 } + GpioInt (Edge, ActiveBoth, Shared, PullDown, 0, "\\_SB.GPI0",) = { 16 } + // GPIO 17 + GpioIO (Shared, PullDown, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, Re= sourceConsumer,,) { 17 } + GpioInt (Edge, ActiveBoth, Shared, PullDown, 0, "\\_SB.GPI0",) = { 17 } + // GPIO 18 + GpioIO (Shared, PullDown, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, Re= sourceConsumer,,) { 18 } + GpioInt (Edge, ActiveBoth, Shared, PullDown, 0, "\\_SB.GPI0",) = { 18 } + // GPIO 19 + GpioIO (Shared, PullDown, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, Re= sourceConsumer,,) { 19 } + GpioInt (Edge, ActiveBoth, Shared, PullDown, 0, "\\_SB.GPI0",) = { 19 } + // GPIO 20 + GpioIO (Shared, PullDown, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, Re= sourceConsumer,,) { 20 } + GpioInt (Edge, ActiveBoth, Shared, PullDown, 0, "\\_SB.GPI0",) = { 20 } + // GPIO 21 + GpioIO (Shared, PullDown, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, Re= sourceConsumer,,) { 21 } + GpioInt (Edge, ActiveBoth, Shared, PullDown, 0, "\\_SB.GPI0",) = { 21 } + // GPIO 22 + GpioIO (Shared, PullDown, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, Re= sourceConsumer,,) { 22 } + GpioInt (Edge, ActiveBoth, Shared, PullDown, 0, "\\_SB.GPI0",) = { 22 } + // GPIO 23 + GpioIO (Shared, PullDown, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, Re= sourceConsumer,,) { 23 } + GpioInt (Edge, ActiveBoth, Shared, PullDown, 0, "\\_SB.GPI0",) = { 23 } + // GPIO 24 + GpioIO (Shared, PullDown, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, Re= sourceConsumer,,) { 24 } + GpioInt (Edge, ActiveBoth, Shared, PullDown, 0, "\\_SB.GPI0",) = { 24 } + // GPIO 25 + GpioIO (Shared, PullDown, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, Re= sourceConsumer,,) { 25 } + GpioInt (Edge, ActiveBoth, Shared, PullDown, 0, "\\_SB.GPI0",) = { 25 } + // GPIO 26 + GpioIO (Shared, PullDown, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, Re= sourceConsumer,,) { 26 } + GpioInt (Edge, ActiveBoth, Shared, PullDown, 0, "\\_SB.GPI0",) = { 26 } + // GPIO 27 + GpioIO (Shared, PullDown, 0, 0, IoRestrictionNone, "\\_SB.GPI0", 0, Re= sourceConsumer,,) { 27 } + GpioInt (Edge, ActiveBoth, Shared, PullDown, 0, "\\_SB.GPI0",) = { 27 } + }) + + Name (_DSD, Package() + { + ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () + { + // Reference http://www.raspberrypi.org/documentation/hardware/raspb= errypi/spi/README.md + // SPI 0 + Package (2) { "bus-SPI-SPI0", Package() { 0, 1 } }, = // Index 0 & 1 + Package (2) { "SPI0-MinClockInHz", 7629 }, = // 7629 Hz + Package (2) { "SPI0-MaxClockInHz", 125000000 }, = // 125 MHz + Package (2) { "SPI0-SupportedDataBitLengths", Package() { 8 } }, = // Data Bit Length + // I2C1 + Package (2) { "bus-I2C-I2C1", Package() { 2 } }, + // GPIO Pin Count and supported drive modes + Package (2) { "GPIO-PinCount", 54 }, + Package (2) { "GPIO-UseDescriptorPinNumbers", 1 }, + Package (2) { "GPIO-SupportedDriveModes", 0xf }, = // InputHighImpedance, InputPullUp, InputPullDown, OutputCmos + // SPI 1 + Package (2) { "bus-SPI-SPI1", Package() { 3 }}, = // Index 3 + Package (2) { "SPI1-MinClockInHz", 30511 }, = // 30.5 kHz + Package (2) { "SPI1-MaxClockInHz", 20000000 }, = // 20 MHz + Package (2) { "SPI1-SupportedDataBitLengths", Package() { 8 } }, = // Data Bit Length + } + }) +} diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Sdhc.asl b/Platform/Raspb= erryPi/RPi4/AcpiTables/Sdhc.asl new file mode 100644 index 000000000000..0d42db30ae22 --- /dev/null +++ b/Platform/RaspberryPi/RPi4/AcpiTables/Sdhc.asl @@ -0,0 +1,99 @@ +/** @file + * + * [DSDT] SD controller/card definition (SDHC) + * + * Copyright (c) 2018, Andrey Warkentin + * Copyright (c) Microsoft Corporation. All rights reserved. + * + * SPDX-License-Identifier: BSD-2-Clause-Patent + * + **/ + +// +// Note: UEFI can use either SDHost or Arasan. We expose both to the OS. +// + +// ArasanSD 3.0 SD Host Controller. +Device (SDC1) +{ + Name (_HID, "BCM2847") + Name (_CID, "ARASAN") + Name (_UID, 0x0) + Name (_CCA, 0x0) + Name (_S1D, 0x1) + Name (_S2D, 0x1) + Name (_S3D, 0x1) + Name (_S4D, 0x1) + Method (_STA) + { + Return(0xf) + } + Method (_CRS, 0x0, Serialized) + { + Name (RBUF, ResourceTemplate () + { + MEMORY32FIXED (ReadWrite, 0x3F300000, 0x100,) + Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x5E } + }) + Return (RBUF) + } + + // + // A child device that represents the + // sd card, which is marked as non-removable. + // + Device (SDMM) + { + Method (_ADR) + { + Return (0) + } + Method (_RMV) // Is removable + { + Return (0) // 0 - fixed + } + } +} + + +// Broadcom SDHost 2.0 SD Host Controller +Device (SDC2) +{ + Name (_HID, "BCM2855") + Name (_CID, "SDHST") + Name (_UID, 0x0) + Name (_CCA, 0x0) + Name (_S1D, 0x1) + Name (_S2D, 0x1) + Name (_S3D, 0x1) + Name (_S4D, 0x1) + Method (_STA) + { + Return (0xf) + } + Method (_CRS, 0x0, Serialized) + { + Name (RBUF, ResourceTemplate () + { + MEMORY32FIXED (ReadWrite, 0x3F202000, 0x100,) + Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x58 } + }) + Return (RBUF) + } + + // + // A child device that represents the + // sd card, which is marked as non-removable. + // + Device (SDMM) + { + Method (_ADR) + { + Return (0) + } + Method (_RMV) // Is removable + { + Return (0) // 0 - fixed + } + } +} diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Spcr.asl b/Platform/Raspb= erryPi/RPi4/AcpiTables/Spcr.asl new file mode 100644 index 000000000000..2e6a37323794 --- /dev/null +++ b/Platform/RaspberryPi/RPi4/AcpiTables/Spcr.asl @@ -0,0 +1,47 @@ +/** @file + * + * Serial Port Console Redirection Table (SPCR) + * + * Copyright (c) 2017-2018, Andrey Warkentin + * + * SPDX-License-Identifier: BSD-2-Clause-Patent + * + **/ + +[000h 0000 4] Signature : "SPCR" [Serial Port Cons= ole Redirection table] +[004h 0004 4] Table Length : 00000050 +[008h 0008 1] Revision : 02 +[009h 0009 1] Checksum : 00 +[00Ah 0010 6] Oem ID : "RPiEFI" +[010h 0016 8] Oem Table ID : "RPi3UEFI" +[018h 0024 4] Oem Revision : 00000001 +[01Ch 0028 4] Asl Compiler ID : "----" +[020h 0032 4] Asl Compiler Revision : 00000000 + +[024h 0036 1] Interface Type : 10 +[025h 0037 3] Reserved : 000000 + +[028h 0040 12] Serial Port Register : [Generic Address Structure] +[028h 0040 1] Space ID : 00 [SystemMemory] +[029h 0041 1] Bit Width : 20 +[02Ah 0042 1] Bit Offset : 00 +[02Bh 0043 1] Encoded Access Width : 03 [DWord Access:32] +[02Ch 0044 8] Address : 000000003f215000 + +[034h 0052 1] Interrupt Type : 0E +[035h 0053 1] PCAT-compatible IRQ : 00 +[036h 0054 4] Interrupt : 3D +[03Ah 0058 1] Baud Rate : 07 +[03Bh 0059 1] Parity : 00 +[03Ch 0060 1] Stop Bits : 01 +[03Dh 0061 1] Flow Control : 00 +[03Eh 0062 1] Terminal Type : 00 +[04Ch 0076 1] Reserved : 00 +[040h 0064 2] PCI Device ID : FFFF +[042h 0066 2] PCI Vendor ID : FFFF +[044h 0068 1] PCI Bus : 00 +[045h 0069 1] PCI Device : 00 +[046h 0070 1] PCI Function : 00 +[047h 0071 4] PCI Flags : 00000000 +[04Bh 0075 1] PCI Segment : 00 +[04Ch 0076 4] Reserved : 00000000 diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Uart.asl b/Platform/Raspb= erryPi/RPi4/AcpiTables/Uart.asl new file mode 100644 index 000000000000..a0067c82c661 --- /dev/null +++ b/Platform/RaspberryPi/RPi4/AcpiTables/Uart.asl @@ -0,0 +1,152 @@ +/** @file + * + * [DSDT] Serial devices (UART). + * + * Copyright (c) 2018, Andrey Warkentin + * Copyright (c) Microsoft Corporation. All rights reserved. + * + * SPDX-License-Identifier: BSD-2-Clause-Patent + * + **/ + +// PL011 based UART. +Device (URT0) +{ + Name (_HID, "BCM2837") + Name (_CID, "HID3123") + Name (_UID, 0x4) + Name (_CCA, 0x0) + Method (_STA) + { + Return (0xf) + } + Method (_CRS, 0x0, Serialized) + { + Name (RBUF, ResourceTemplate () + { + MEMORY32FIXED (ReadWrite, 0x3F201000, 0x1000,) + Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x59 } + }) + Return (RBUF) + } + + Name (CLCK, 3000000) + + Name (_DSD, Package () + { + ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), Package () + { + Package (2) { "clock-frequency", CLCK }, + } + }) +} + +// +// UART Mini. +// +// This device is referenced in the DBG2 table, which will cause the syste= m to +// not start the driver when the debugger is enabled and to mark the device +// with problem code 53 (CM_PROB_USED_BY_DEBUGGER). +// + +Device (URTM) +{ + Name (_HID, "BCM2836") + Name (_CID, "MINIUART") + Name (_UID, 0x0) + Name (_CCA, 0x0) + Method (_STA) + { + Return (0xf) + } + Method (_CRS, 0x0, Serialized) + { + Name (RBUF, ResourceTemplate () + { + MEMORY32FIXED (ReadWrite, 0x3F215000, 0x70,) + Interrupt(ResourceConsumer, Level, ActiveHigh, Shared) {0x3D} + + // NTRAID#MSFT-7141401-2016/04/7-jordanrh - disable UART muxing + // until a proper solution can be created for the dmap conflict. + // When muxing is enabled, must consider DBG2 table conflict. + // The alternate function resource needs to be reserved when + // the kernel debugger is enabled to prevent another client + // from muxing the pins away. + + // + // MsftFunctionConfig is encoded as the VendorLong. + // + // MsftFunctionConfig(Exclusive, PullDown, BCM_ALT5, "\\_SB.GPI0", 0= , ResourceConsumer, ) {14, 15} + // VendorLong () // Length =3D 0x31 + // { + // /* 0000 */ 0x00, 0x60, 0x44, 0xD5, 0xF3, 0x1F, 0x11, 0x60, //= .`D....` + // /* 0008 */ 0x4A, 0xB8, 0xB0, 0x9C, 0x2D, 0x23, 0x30, 0xDD, //= J...-#0. + // /* 0010 */ 0x2F, 0x8D, 0x1D, 0x00, 0x01, 0x10, 0x00, 0x02, //= /....... + // /* 0018 */ 0x02, 0x00, 0x12, 0x00, 0x00, 0x16, 0x00, 0x20, //= ....... + // /* 0020 */ 0x00, 0x00, 0x00, 0x0E, 0x00, 0x0F, 0x00, 0x5C, //= .......\ + // /* 0028 */ 0x5F, 0x53, 0x42, 0x2E, 0x47, 0x50, 0x49, 0x30, //= _SB.GPI0 + // /* 0030 */ 0x00 //= . + //} + + }) + Return (RBUF) + } +} + +// +// Multifunction serial bus device to support Bluetooth function. +// +Device(BTH0) +{ + Name (_HID, "BCM2EA6") + Name (_CID, "BCM2EA6") + Method (_STA) + { + Return (0xf) + } + Method (_CRS, 0x0, Serialized) + { + Name (RBUF, ResourceTemplate () + { + // BT UART: UART0 (PL011) + UARTSerialBus( + 115200, // InitialBaudRate: in BPS + , // BitsPerByte: default to 8 bits + , // StopBits: Defaults to one bit + 0x00, // LinesInUse: 8 1-bit flags to + // declare enabled control lines. + // Raspberry Pi does not exposed + // HW control signals -> not supported. + // Optional bits: + // - Bit 7 (0x80) Request To Send (RTS) + // - Bit 6 (0x40) Clear To Send (CTS) + // - Bit 5 (0x20) Data Terminal Ready (DTR) + // - Bit 4 (0x10) Data Set Ready (DSR) + // - Bit 3 (0x08) Ring Indicator (RI) + // - Bit 2 (0x04) Data Carrier Detect (DTD) + // - Bit 1 (0x02) Reserved. Must be 0. + // - Bit 0 (0x01) Reserved. Must be 0. + , // IsBigEndian: + // default to LittleEndian. + , // Parity: Defaults to no parity + , // FlowControl: Defaults to + // no flow control. + 16, // ReceiveBufferSize + 16, // TransmitBufferSize + "\\_SB.URT0", // ResourceSource: + // UART bus controller name + , // ResourceSourceIndex: assumed to be 0 + , // ResourceUsage: assumed to be + // ResourceConsumer + UAR0, // DescriptorName: creates name + // for offset of resource descriptor + ) // Vendor data + + // + // RPIQ connection for BT_ON/OFF + // + GpioIO (Shared, PullUp, 0, 0, IoRestrictionNone, "\\_SB.RPIQ", 0, Re= sourceConsumer, , ) { 128 } + }) + Return (RBUF) + } +} --=20 2.21.0.windows.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 (#52116): https://edk2.groups.io/g/devel/message/52116 Mute This Topic: https://groups.io/mt/68147486/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 May 5 15:47:16 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+52117+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+52117+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1576063578; cv=none; d=zohomail.com; s=zohoarc; b=l2JydejTVqdmW2FrCrDnW5lNIV831CxIkrevSfMwcFaWvr3lOL7Fjb+a0YVAHDbwFn+BSJK5pePuULfH95BBhs0W7ZpGviV5VcYhsoORQF4p183wVvbp5t0do74ePzq0RcOnPFVnj0KSwSDse3i8bZjeWNjYl+y3tb1gwLI88ko= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576063578; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=Mga5NkDl3IDE0qSrpONnjalHQVxpjDOvLaLARzRZok0=; b=fX9hjYlLJPciJut4qDOAn8EH9fwArVx7lvEwkFfkPNMVay6a72iGLlPPIZprC2wG3NkPPJr5WOJQtGVlfBOEpNBUvr8prtjSGuG01Romt5GgZDE6y+zJCM/TgmsQVF7VWtFDIOmsmERVTlGogvQVpo/l1FjC3H7cBrQ7qJZZPNk= 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+52117+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1576063578426292.41768879436995; Wed, 11 Dec 2019 03:26:18 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id MIKnYY1788612xknt9PC2xdY; Wed, 11 Dec 2019 03:26:17 -0800 X-Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by mx.groups.io with SMTP id smtpd.web11.2240.1576063576377793842 for ; Wed, 11 Dec 2019 03:26:16 -0800 X-Received: by mail-wr1-f67.google.com with SMTP id y17so23640716wrh.5 for ; Wed, 11 Dec 2019 03:26:16 -0800 (PST) X-Gm-Message-State: NGCDLfevfC8yEOe48BQI2E3hx1787277AA= X-Google-Smtp-Source: APXvYqxHO3KcrjuxK8Xun9qshwf5Cs5qANv3pcZsFi9uqu5/t8GcXesdkVJBuHY3TqrehO14nes9bg== X-Received: by 2002:adf:ff8a:: with SMTP id j10mr3346337wrr.312.1576063573898; Wed, 11 Dec 2019 03:26:13 -0800 (PST) X-Received: from localhost.localdomain ([84.203.45.230]) by smtp.gmail.com with ESMTPSA id q8sm190460wmq.3.2019.12.11.03.26.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Dec 2019 03:26:13 -0800 (PST) From: "Pete Batard" To: devel@edk2.groups.io Cc: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org, philmd@redhat.com, andrey.warkentin@gmail.com, samer.el-haj-mahmoud@arm.com Subject: [edk2-devel] [edk2-platforms][PATCH 4/5] Platform/RPi4: Update ACPI tables for the new platform Date: Wed, 11 Dec 2019 11:25:51 +0000 Message-Id: <20191211112552.15900-5-pete@akeo.ie> In-Reply-To: <20191211112552.15900-1-pete@akeo.ie> References: <20191211112552.15900-1-pete@akeo.ie> MIME-Version: 1.0 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,pete@akeo.ie Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1576063577; bh=VS1glBeTEkk92vWVKg0PjGSXgCwc5CtIbei9dWFvG7A=; h=Cc:Date:From:Reply-To:Subject:To; b=OuNcGPfAiGq0fpDktdlK0vIEtfPc1bdNxotZdPPY/5D0tnz0IbxnsJrLD7XPbeD1QjQ +Nn//q2/nxiKfpVOkrvxgI8PvmwxY6x/qBQlsF36bSJ0ZXT7Kz2w+3eDL8WcKDup+9aeJ NdH95Dc/q7HEkWIauDySSwNfOB3BvPRMYyY= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Andrei Warkentin Update CSRT, DSDT, GTDT, MADT, SDHC and serial tables for the new base addresses and switch ACPI to GIC. We use ACPI 5.1 for MADT because older versions of the Linux kernel can be finicky when it comes to checking the size of the GICC entries the table: depending on the FADT version (either 5, or 6 or later), the size must be exactly 76 or 80 bytes, respectively. However, using the ACPI 6.0 or 6.1 GICC macros results in 80 byte entries, which triggers a mismatch error since the FADT we are exposing is 5.1. Since GICv2 doesn't care about any of the fields that were added after ACPI 5.1, we can simply use that version to keep Linux happy. Signed-off-by: Pete Batard Reviewed-by: Ard Biesheuvel --- Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.h | 26 ++++- Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.inf | 12 ++- Platform/RaspberryPi/RPi4/AcpiTables/Csrt.aslc | 25 ++--- Platform/RaspberryPi/RPi4/AcpiTables/Dbg2.aslc | 2 +- Platform/RaspberryPi/RPi4/AcpiTables/Dsdt.asl | 40 ++++---- Platform/RaspberryPi/RPi4/AcpiTables/Gtdt.aslc | 69 +++++++++---- Platform/RaspberryPi/RPi4/AcpiTables/Madt.aslc | 102 +++++++++++-----= ---- Platform/RaspberryPi/RPi4/AcpiTables/Pep.asl | 5 +- Platform/RaspberryPi/RPi4/AcpiTables/Pep.c | 7 +- Platform/RaspberryPi/RPi4/AcpiTables/Pep.h | 7 +- Platform/RaspberryPi/RPi4/AcpiTables/Sdhc.asl | 4 +- Platform/RaspberryPi/RPi4/AcpiTables/Spcr.asl | 15 +-- Platform/RaspberryPi/RPi4/AcpiTables/Uart.asl | 12 +-- 13 files changed, 197 insertions(+), 129 deletions(-) diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.h b/Platform/R= aspberryPi/RPi4/AcpiTables/AcpiTables.h index 958af026c8a3..e61f3fa0bcfa 100644 --- a/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.h +++ b/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.h @@ -1,7 +1,8 @@ /** @file * - * RPi3 defines for constructing ACPI tables + * RPi4 defines for constructing ACPI tables * + * Copyright (c) 2019, ARM Ltd. All rights reserved. * Copyright (c) 2018, Andrei Warkentin * Copyright (c) Microsoft Corporation. All rights reserved. * @@ -15,18 +16,33 @@ #include =20 #define EFI_ACPI_OEM_ID {'M','C','R','S','F','T'} //= OEMID 6 bytes long -#define EFI_ACPI_OEM_TABLE_ID SIGNATURE_64 ('R','P','I','3= ','E','D','K','2') // OEM table id 8 bytes long +#define EFI_ACPI_OEM_TABLE_ID SIGNATURE_64 ('R','P','I','4= ','E','D','K','2') // OEM table id 8 bytes long #define EFI_ACPI_OEM_REVISION 0x02000820 -#define EFI_ACPI_CREATOR_ID SIGNATURE_32 ('R','P','I','3= ') +#define EFI_ACPI_CREATOR_ID SIGNATURE_32 ('R','P','I','4= ') #define EFI_ACPI_CREATOR_REVISION 0x00000097 =20 #define EFI_ACPI_VENDOR_ID SIGNATURE_32 ('M','S','F','T= ') + +// A macro to initialise the common header part of EFI ACPI tables as defi= ned by +// EFI_ACPI_DESCRIPTION_HEADER structure. +#define ACPI_HEADER(Signature, Type, Revision) { \ + Signature, /* UINT32 Signature */ \ + sizeof (Type), /* UINT32 Length */ \ + Revision, /* UINT8 Revision */ \ + 0, /* UINT8 Checksum */ \ + EFI_ACPI_OEM_ID, /* UINT8 OemId[6] */ \ + EFI_ACPI_OEM_TABLE_ID, /* UINT64 OemTableId */ \ + EFI_ACPI_OEM_REVISION, /* UINT32 OemRevision */ \ + EFI_ACPI_CREATOR_ID, /* UINT32 CreatorId */ \ + EFI_ACPI_CREATOR_REVISION /* UINT32 CreatorRevision */ \ + } + #define EFI_ACPI_CSRT_REVISION 0x00000005 #define EFI_ACPI_CSRT_DEVICE_ID_DMA 0x00000009 // Fixed id #define EFI_ACPI_CSRT_RESOURCE_ID_IN_DMA_GRP 0x0 // Count up from 0 =20 -#define RPI3_DMA_CHANNEL_COUNT 10 // All 10 DMA channels ar= e listed, including the reserved ones -#define RPI3_DMA_USED_CHANNEL_COUNT 5 // Use 5 DMA channels +#define RPI4_DMA_CHANNEL_COUNT 10 // All 10 DMA channels ar= e listed, including the reserved ones +#define RPI4_DMA_USED_CHANNEL_COUNT 5 // Use 5 DMA channels =20 #define EFI_ACPI_5_0_CSRT_REVISION 0x00000000 =20 diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.inf b/Platform= /RaspberryPi/RPi4/AcpiTables/AcpiTables.inf index 7ef41e79ad46..50c9f7694d84 100644 --- a/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.inf +++ b/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.inf @@ -2,6 +2,7 @@ # # ACPI table data and ASL sources required to boot the platform. # +# Copyright (c) 2019, ARM Limited. All rights reserved. # Copyright (c) 2017, Andrey Warkentin # Copyright (c) Microsoft Corporation. All rights reserved. # @@ -33,8 +34,17 @@ [Sources] Spcr.asl =20 [Packages] - MdePkg/MdePkg.dec + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec EmbeddedPkg/EmbeddedPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec =20 [FixedPcd] + gArmTokenSpaceGuid.PcdArmArchTimerIntrNum + gArmTokenSpaceGuid.PcdArmArchTimerHypIntrNum + gArmTokenSpaceGuid.PcdArmArchTimerSecIntrNum + gArmTokenSpaceGuid.PcdArmArchTimerVirtIntrNum + gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase + gArmTokenSpaceGuid.PcdGicDistributorBase gEmbeddedTokenSpaceGuid.PcdInterruptBaseAddress diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Csrt.aslc b/Platform/Rasp= berryPi/RPi4/AcpiTables/Csrt.aslc index 3b617c0a832b..22a370d04017 100644 --- a/Platform/RaspberryPi/RPi4/AcpiTables/Csrt.aslc +++ b/Platform/RaspberryPi/RPi4/AcpiTables/Csrt.aslc @@ -2,6 +2,7 @@ * * Core System Resource Table (CSRT) * + * Copyright (c) 2019, ARM Ltd. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved. * * SPDX-License-Identifier: BSD-2-Clause-Patent @@ -15,7 +16,7 @@ #pragma pack (push, 1) =20 //------------------------------------------------------------------------ -// DMA Controller Vendor Data for RPi3 +// DMA Controller Vendor Data for RPi4 //------------------------------------------------------------------------ typedef struct { @@ -33,7 +34,7 @@ typedef struct } DMA_CONTROLLER_VENDOR_DATA; =20 //------------------------------------------------------------------------ -// DMA Controller on RPi3 +// DMA Controller on RPi4 //------------------------------------------------------------------------ typedef struct { @@ -42,7 +43,7 @@ typedef struct } RD_DMA_CONTROLLER; =20 //------------------------------------------------------------------------ -// DMA Channel Vendor Data for RPi3 +// DMA Channel Vendor Data for RPi4 //------------------------------------------------------------------------ typedef struct { @@ -53,7 +54,7 @@ typedef struct } DMA_CHANNEL_VENDOR_DATA; =20 //------------------------------------------------------------------------ -// DMA Channel on RPi3 +// DMA Channel on RPi4 //------------------------------------------------------------------------ typedef struct { @@ -62,18 +63,18 @@ typedef struct } RD_DMA_CHANNEL; =20 //------------------------------------------------------------------------ -// DMA Resource Group on RPi3 +// DMA Resource Group on RPi4 //------------------------------------------------------------------------ =20 typedef struct { EFI_ACPI_5_0_CSRT_RESOURCE_GROUP_HEADER ResGroupHeader; RD_DMA_CONTROLLER DmaController; - RD_DMA_CHANNEL DmaChannels[RPI3_DMA_CHANNEL_COUNT]; + RD_DMA_CHANNEL DmaChannels[RPI4_DMA_CHANNEL_COUNT]; } RG_DMA; =20 //------------------------------------------------------------------------= ---- -// CSRT table structure for RPi3 platform - current revision only includes= DMA +// CSRT table structure for RPi4 platform - current revision only includes= DMA //------------------------------------------------------------------------= ---- typedef struct { @@ -96,7 +97,7 @@ EFI_ACPI_5_0_CSRT_TABLE Csrt =3D EFI_ACPI_5_0_CSRT_REVISION, // Revision 0x00, // Checksum calculated at runtime. EFI_ACPI_OEM_ID, // OEMID is a 6 bytes long field "BC28= 36" - EFI_ACPI_OEM_TABLE_ID, // OEM table identification(8 bytes lo= ng) "RPI3EDK2" + EFI_ACPI_OEM_TABLE_ID, // OEM table identification(8 bytes lo= ng) "RPI4EDK2" EFI_ACPI_OEM_REVISION, // OEM revision number. EFI_ACPI_CREATOR_ID, // ASL compiler vendor ID. EFI_ACPI_CREATOR_REVISION // ASL compiler revision number. @@ -134,11 +135,11 @@ EFI_ACPI_5_0_CSRT_TABLE Csrt =3D { sizeof (DMA_CONTROLLER_VENDOR_DATA), // Controller vendor data he= re 1, - 0x3F007000, // Base address for channels - RPI3_DMA_CHANNEL_COUNT * 0x100, // Base size =3D Number of channel= s x 0x100 size for each channel - 0x3F007FE0, // Base address for controller + 0xFE007000, // Base address for channels + RPI4_DMA_CHANNEL_COUNT * 0x100, // Base size =3D Number of channel= s x 0x100 size for each channel + 0xFE007FE0, // Base address for controller 8, // Base size =3D two registers - RPI3_DMA_USED_CHANNEL_COUNT, + RPI4_DMA_USED_CHANNEL_COUNT, 0, // cannot use controller interrupt 0, // Minimum Request Line DMA_MAX_REQ_LINES - 1, // Maximum Request Line diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Dbg2.aslc b/Platform/Rasp= berryPi/RPi4/AcpiTables/Dbg2.aslc index 9315f23e0d2d..849cf5134793 100644 --- a/Platform/RaspberryPi/RPi4/AcpiTables/Dbg2.aslc +++ b/Platform/RaspberryPi/RPi4/AcpiTables/Dbg2.aslc @@ -16,7 +16,7 @@ UINT8 Dbg2[92] =3D { 0x01, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x01, 0x0A, 0x00, 0x26, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x80, 0x10, 0x00, 0x00, 0x00, 0x16, 0x00, 0x22, 0x00, 0x00, 0x20, 0x00, 0x10, - 0x00, 0x50, 0x21, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x00, + 0x00, 0x50, 0x21, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, '\\', '_', 'S', 'B', '.', 'U', 'R', 'T', 'M', 0x00, }; diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Dsdt.asl b/Platform/Raspb= erryPi/RPi4/AcpiTables/Dsdt.asl index ab4d4bf4851f..42e650a3ef29 100644 --- a/Platform/RaspberryPi/RPi4/AcpiTables/Dsdt.asl +++ b/Platform/RaspberryPi/RPi4/AcpiTables/Dsdt.asl @@ -78,8 +78,8 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "MSFT", "EDK2", 2) { Name (RBUF, ResourceTemplate () { - MEMORY32FIXED(ReadWrite, 0x3F980000, 0x10000,) - Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x29= } + MEMORY32FIXED(ReadWrite, 0xFE980000, 0x10000,) + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x69= } }) Return(RBUF) } @@ -101,29 +101,29 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "MSFT", "EDK2= ", 2) Name (RBUF, ResourceTemplate () { // Memory and interrupt for the GPU - MEMORY32FIXED(ReadWrite, 0x3FC00000, 0x1000,) + MEMORY32FIXED(ReadWrite, 0xFEC00000, 0x1000,) Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x2= A } =20 // HVS - Hardware Video Scalar - MEMORY32FIXED (ReadWrite, 0x3F400000, 0x6000,) + MEMORY32FIXED (ReadWrite, 0xFE400000, 0x6000,) // The HVS interrupt is reserved by the VPU // Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { = 0x41 } =20 // PixelValve0 - DSI0 or DPI - // MEMORY32FIXED (ReadWrite, 0x3F206000, 0x100,) + // MEMORY32FIXED (ReadWrite, 0xFE206000, 0x100,) // Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { = 0x4D } =20 // PixelValve1 - DS1 or SMI - // MEMORY32FIXED (ReadWrite, 0x73F207000, 0x100,) + // MEMORY32FIXED (ReadWrite, 0xFE207000, 0x100,) // Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { = 0x4E } =20 // PixelValve2 - HDMI output - connected to HVS display FIFO 1 - MEMORY32FIXED (ReadWrite, 0x3F807000, 0x100,) + MEMORY32FIXED (ReadWrite, 0xFE807000, 0x100,) Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x4= A } =20 // HDMI registers - MEMORY32FIXED (ReadWrite, 0x3F902000, 0x600,) // HDMI registers - MEMORY32FIXED (ReadWrite, 0x3F808000, 0x100,) // HD registers + MEMORY32FIXED (ReadWrite, 0xFE902000, 0x600,) // HDMI registers + MEMORY32FIXED (ReadWrite, 0xFE808000, 0x100,) // HD registers // hdmi_int[0] // Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { = 0x48 } // hdmi_int[1] @@ -199,7 +199,7 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "MSFT", "EDK2",= 2) { Name (RBUF, ResourceTemplate () { - Memory32Fixed (ReadWrite, 0x3F00B880, 0x00000024,) + Memory32Fixed (ReadWrite, 0xFE00B880, 0x00000024,) Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x61= } }) Return (RBUF) @@ -222,7 +222,7 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "MSFT", "EDK2",= 2) { Name (RBUF, ResourceTemplate () { - Memory32Fixed (ReadWrite, 0x3F00B840, 0x00000010,) + Memory32Fixed (ReadWrite, 0xFE00B840, 0x00000010,) Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x62= } }) Return (RBUF) @@ -258,7 +258,7 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "MSFT", "EDK2",= 2) { Name (RBUF, ResourceTemplate () { - MEMORY32FIXED (ReadWrite, 0x3F200000, 0xB4, ) + MEMORY32FIXED (ReadWrite, 0xFE200000, 0xB4, ) Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) { 0x51 } Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) { 0x53 } }) @@ -281,7 +281,7 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "MSFT", "EDK2",= 2) { Name (RBUF, ResourceTemplate () { - Memory32Fixed(ReadWrite, 0x3F804000, 0x20) + Memory32Fixed(ReadWrite, 0xFE804000, 0x20) Interrupt(ResourceConsumer, Level, ActiveHigh, Shared) {0x55} =20 // @@ -319,7 +319,7 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "MSFT", "EDK2",= 2) { Name (RBUF, ResourceTemplate() { - Memory32Fixed (ReadWrite, 0x3F805000, 0x20) + Memory32Fixed (ReadWrite, 0xFE805000, 0x20) Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) {0x55} }) Return (RBUF) @@ -341,7 +341,7 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "MSFT", "EDK2",= 2) { Name (RBUF, ResourceTemplate () { - MEMORY32FIXED (ReadWrite, 0x3F204000, 0x20,) + MEMORY32FIXED (ReadWrite, 0xFE204000, 0x20,) Interrupt(ResourceConsumer, Level, ActiveHigh, Shared) {0x56} =20 // @@ -406,7 +406,7 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "MSFT", "EDK2",= 2) { Name (RBUF, ResourceTemplate () { - MEMORY32FIXED (ReadWrite, 0x3F215080, 0x40,) + MEMORY32FIXED (ReadWrite, 0xFE215080, 0x40,) Interrupt (ResourceConsumer, Level, ActiveHigh, Shared,) {0x3D} =20 // @@ -458,7 +458,7 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "MSFT", "EDK2",= 2) // { // Name (RBUF, ResourceTemplate () // { - // MEMORY32FIXED (ReadWrite, 0x3F2150C0, 0x40,) + // MEMORY32FIXED (ReadWrite, 0xFE2150C0, 0x40,) // Interrupt (ResourceConsumer, Level, ActiveHigh, Shared,) {0x3= D} // }) // Return (RBUF) @@ -481,15 +481,15 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "MSFT", "EDK2= ", 2) Name (RBUF, ResourceTemplate () { // DMA channel 11 control - Memory32Fixed (ReadWrite, 0x3F007B00, 0x00000100,) + Memory32Fixed (ReadWrite, 0xFE007B00, 0x00000100,) // PWM control - Memory32Fixed (ReadWrite, 0x3F20C000, 0x00000028,) + Memory32Fixed (ReadWrite, 0xFE20C000, 0x00000028,) // PWM control bus Memory32Fixed (ReadWrite, 0x7E20C000, 0x00000028,) // PWM control uncached Memory32Fixed (ReadWrite, 0xFF20C000, 0x00000028,) // PWM clock control - Memory32Fixed (ReadWrite, 0x3F1010A0, 0x00000008,) + Memory32Fixed (ReadWrite, 0xFE1010A0, 0x00000008,) // Interrupt DMA channel 11 Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x3= B } // DMA channel 11, DREQ 5 for PWM diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Gtdt.aslc b/Platform/Rasp= berryPi/RPi4/AcpiTables/Gtdt.aslc index 6551315a5502..293c6022d258 100644 --- a/Platform/RaspberryPi/RPi4/AcpiTables/Gtdt.aslc +++ b/Platform/RaspberryPi/RPi4/AcpiTables/Gtdt.aslc @@ -1,27 +1,56 @@ /** @file - * - * Generic Timer Description Table (GTDT) - * Automatically generated by AutoAcpi - * - * Copyright (c) Microsoft Corporation. All rights reserved. - * - * SPDX-License-Identifier: BSD-2-Clause-Patent - * - **/ +* Generic Timer Description Table (GTDT) +* +* Copyright (c) 2018, Linaro Limited. All rights reserved. +* Copyright (c) 2012 - 2016, ARM Limited. All rights reserved. +* +* SPDX-License-Identifier: BSD-2-Clause-Patent +* +**/ =20 -UINT8 Gtdt[80] =3D { - 0x47, 0x54, 0x44, 0x54, 0x50, 0x00, 0x00, 0x00, 0x01, 0x00, - 0x4D, 0x53, 0x46, 0x54, 0x20, 0x20, 0x45, 0x44, 0x4B, 0x32, - 0x20, 0x20, 0x20, 0x20, 0x01, 0x00, 0x00, 0x00, 0x4D, 0x53, - 0x46, 0x54, 0x01, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x40, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +#include +#include +#include + +#include "AcpiTables.h" + +#define SYSTEM_TIMER_BASE_ADDRESS 0xFF80001C +#define GTDT_GLOBAL_FLAGS 0 +#define GTDT_GTIMER_FLAGS EFI_ACPI_6_0_GTDT_TIMER_FLAG_TIMER_INT= ERRUPT_POLARITY + +#pragma pack (1) + +typedef struct { + EFI_ACPI_6_0_GENERIC_TIMER_DESCRIPTION_TABLE Gtdt; +} EFI_ACPI_6_0_GENERIC_TIMER_DESCRIPTION_TABLES; + +#pragma pack () + +EFI_ACPI_6_0_GENERIC_TIMER_DESCRIPTION_TABLES Gtdt =3D { + { + ACPI_HEADER( + EFI_ACPI_6_0_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE, + EFI_ACPI_6_0_GENERIC_TIMER_DESCRIPTION_TABLES, + EFI_ACPI_6_0_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION + ), + SYSTEM_TIMER_BASE_ADDRESS, // UINT64 PhysicalAddre= ss + 0, // UINT32 Reserved + FixedPcdGet32 (PcdArmArchTimerSecIntrNum), // UINT32 SecurePL1Time= rGSIV + GTDT_GTIMER_FLAGS, // UINT32 SecurePL1Time= rFlags + FixedPcdGet32 (PcdArmArchTimerIntrNum), // UINT32 NonSecurePL1T= imerGSIV + GTDT_GTIMER_FLAGS, // UINT32 NonSecurePL1T= imerFlags + FixedPcdGet32 (PcdArmArchTimerVirtIntrNum), // UINT32 VirtualTimerG= SIV + GTDT_GTIMER_FLAGS, // UINT32 VirtualTimerF= lags + FixedPcdGet32 (PcdArmArchTimerHypIntrNum), // UINT32 NonSecurePL2T= imerGSIV + GTDT_GTIMER_FLAGS, // UINT32 NonSecurePL2T= imerFlags + 0xFFFFFFFFFFFFFFFF, // UINT64 CntReadBasePh= ysicalAddress + 0, // UINT32 PlatformTimer= Count + 0 // UINT32 PlatfromTimerO= ffset + }, }; =20 // -// Reference the table being generated to prevent the optimizer from remov= ing the -// data structure from the executable +// Reference the table being generated to prevent the optimizer +// from removing the data structure from the executable // VOID* CONST ReferenceAcpiTable =3D &Gtdt; diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Madt.aslc b/Platform/Rasp= berryPi/RPi4/AcpiTables/Madt.aslc index 39cd4c5cee6c..0027cb9fe8bb 100644 --- a/Platform/RaspberryPi/RPi4/AcpiTables/Madt.aslc +++ b/Platform/RaspberryPi/RPi4/AcpiTables/Madt.aslc @@ -1,52 +1,60 @@ /** @file - * - * Multiple APIC Description Table (MADT) - * - * Copyright (c) 2018, Andrey Warkentin - * Copyright (c) Microsoft Corporation. All rights reserved. - * - * SPDX-License-Identifier: BSD-2-Clause-Patent - * - **/ +* Multiple APIC Description Table (MADT) +* +* Copyright (c) 2016 Linaro Ltd. All rights reserved. +* Copyright (c) 2012 - 2015, ARM Limited. All rights reserved. +* +* SPDX-License-Identifier: BSD-2-Clause-Patent +* +**/ =20 -/* - * Even though the BCM283x don't contain a GIC, these - * GICC definitions enable multi-core support (with PSCI). - * - * Mind the signatures in the header, they must be kept. - */ -UINT8 Madt[] =3D { - 0x41, 0x50, 0x49, 0x43, 0x6c, 0x01, 0x00, 0x00, 0x03, 0xaf, 0x42, 0x43, - 0x32, 0x38, 0x33, 0x36, 0x45, 0x44, 0x4b, 0x32, 0x20, 0x20, 0x20, 0x20, - 0x01, 0x00, 0x00, 0x00, 0x4d, 0x53, 0x46, 0x54, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x50, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x0b, 0x50, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0b, 0x50, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x50, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00 +#include "AcpiTables.h" +#include +#include +#include +#include + +// +// Multiple APIC Description Table +// +#pragma pack (1) + +typedef struct { + EFI_ACPI_5_1_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER Header; + EFI_ACPI_5_1_GIC_STRUCTURE GicInterfaces[4]; + EFI_ACPI_5_1_GIC_DISTRIBUTOR_STRUCTURE GicDistributor; +} PI_MULTIPLE_APIC_DESCRIPTION_TABLE; + +#pragma pack () + +PI_MULTIPLE_APIC_DESCRIPTION_TABLE Madt =3D { + { + ACPI_HEADER ( + EFI_ACPI_5_1_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE, + PI_MULTIPLE_APIC_DESCRIPTION_TABLE, + EFI_ACPI_5_1_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION + ), + // + // MADT specific fields + // + 0, // LocalApicAddress + 0, // Flags + }, + { + EFI_ACPI_5_1_GICC_STRUCTURE_INIT( + 0, 0, GET_MPID(0, 0), EFI_ACPI_5_1_GIC_ENABLED, 48, FixedPcdGet64 = (PcdGicInterruptInterfaceBase), + 0xFF846000, 0xFF844000, 0x19, 0), + EFI_ACPI_5_1_GICC_STRUCTURE_INIT( + 1, 1, GET_MPID(0, 1), EFI_ACPI_5_1_GIC_ENABLED, 49, FixedPcdGet64= (PcdGicInterruptInterfaceBase), + 0xFF846000, 0xFF844000, 0x19, 0), + EFI_ACPI_5_1_GICC_STRUCTURE_INIT( + 2, 2, GET_MPID(0, 2), EFI_ACPI_5_1_GIC_ENABLED, 50, FixedPcdGet64= (PcdGicInterruptInterfaceBase), + 0xFF846000, 0xFF844000, 0x19, 0), + EFI_ACPI_5_1_GICC_STRUCTURE_INIT( + 3, 3, GET_MPID(0, 3), EFI_ACPI_5_1_GIC_ENABLED, 51, FixedPcdGet64= (PcdGicInterruptInterfaceBase), + 0xFF846000, 0xFF844000, 0x19, 0), + }, + EFI_ACPI_5_0_GIC_DISTRIBUTOR_INIT(0, FixedPcdGet64 (PcdGicDistributorBas= e), 0) }; =20 // diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Pep.asl b/Platform/Raspbe= rryPi/RPi4/AcpiTables/Pep.asl index 2ddb27bcdbb3..7096109f8819 100644 --- a/Platform/RaspberryPi/RPi4/AcpiTables/Pep.asl +++ b/Platform/RaspberryPi/RPi4/AcpiTables/Pep.asl @@ -2,6 +2,7 @@ * * Platform Extension Plugin (PEP). * + * Copyright (c) 2019, ARM Ltd. All rights reserved. * Copyright (c) 2018, Andrey Warkentin * Copyright (c) Microsoft Corporation. All rights reserved. * @@ -12,9 +13,9 @@ Device(PEPD) { // - // RPI3 PEP virtual device. + // RPI4 PEP virtual device. // - Name (_HID, "BCM2854") // Note: since pep on rpi3 is virtual device, + Name (_HID, "BCM2854") // Note: since pep on rpi4 is virtual device, Name (_CID, "BCM2854") // its device id needs to be generated by Microso= ft Name (_UID, 0x0) Name (_CRS, ResourceTemplate () diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Pep.c b/Platform/Raspberr= yPi/RPi4/AcpiTables/Pep.c index 51db779d7976..1a78392f05a0 100644 --- a/Platform/RaspberryPi/RPi4/AcpiTables/Pep.c +++ b/Platform/RaspberryPi/RPi4/AcpiTables/Pep.c @@ -2,6 +2,7 @@ * * PEP device tables * + * Copyright (c) 2019, ARM Ltd. All rights reserved. * Copyright (c) 2018, Andrei Warkentin * Copyright (c) Microsoft Corporation. All rights reserved. * @@ -11,7 +12,7 @@ =20 #include "Pep.h" =20 -PEP_PROCESSOR_TABLE_PLAT RPI3Processors =3D { +PEP_PROCESSOR_TABLE_PLAT RPI4Processors =3D { 1, // Version 1, // NumberProcessors { // ProcessorInfo @@ -29,7 +30,7 @@ PEP_PROCESSOR_TABLE_PLAT RPI3Processors =3D { } }; =20 -PEP_COORDINATED_STATE_TABLE_PLAT RPI3CoordinatedStates =3D { +PEP_COORDINATED_STATE_TABLE_PLAT RPI4CoordinatedStates =3D { 1, // Version 1, // CoordinatedStateCount { // CordinatedStates[] @@ -51,7 +52,7 @@ PEP_COORDINATED_STATE_TABLE_PLAT RPI3CoordinatedStates = =3D { } }; =20 -PEP_DEVICE_TABLE_PLAT RPI3Devices =3D { +PEP_DEVICE_TABLE_PLAT RPI4Devices =3D { 1, // Version 1, // NumberDevices { // DeviceInfo diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Pep.h b/Platform/Raspberr= yPi/RPi4/AcpiTables/Pep.h index f5f04518dec6..19b801caf783 100644 --- a/Platform/RaspberryPi/RPi4/AcpiTables/Pep.h +++ b/Platform/RaspberryPi/RPi4/AcpiTables/Pep.h @@ -2,6 +2,7 @@ * * PEP device defines * + * Copyright (c) 2019, ARM Ltd. All rights reserved. * Copyright (c) 2018, Andrei Warkentin * Copyright (c) Microsoft Corporation. All rights reserved. * @@ -13,8 +14,8 @@ * Note: Not everything is here. At least SOC_STATE_TYPE is missing. */ =20 -#ifndef _RPI3PEP_H_INCLUDED_ -#define _RPI3PEP_H_INCLUDED_ +#ifndef _RPI4PEP_H_INCLUDED_ +#define _RPI4PEP_H_INCLUDED_ =20 #include =20 @@ -117,4 +118,4 @@ typedef struct _PEP_DEVICE_TABLE_PLAT { PEP_DEVICE_INFO_PLAT DeviceInfo[P_NUMBER_DEVICES]; } PEP_DEVICE_TABLE_PLAT, *PPEP_DEVICE_TABLE_PLAT; =20 -#endif // _RPI3PEP_H_INCLUDED_ +#endif // _RPI4PEP_H_INCLUDED_ diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Sdhc.asl b/Platform/Raspb= erryPi/RPi4/AcpiTables/Sdhc.asl index 0d42db30ae22..57ee411a6157 100644 --- a/Platform/RaspberryPi/RPi4/AcpiTables/Sdhc.asl +++ b/Platform/RaspberryPi/RPi4/AcpiTables/Sdhc.asl @@ -32,7 +32,7 @@ Device (SDC1) { Name (RBUF, ResourceTemplate () { - MEMORY32FIXED (ReadWrite, 0x3F300000, 0x100,) + MEMORY32FIXED (ReadWrite, 0xFE300000, 0x100,) Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x5E } }) Return (RBUF) @@ -75,7 +75,7 @@ Device (SDC2) { Name (RBUF, ResourceTemplate () { - MEMORY32FIXED (ReadWrite, 0x3F202000, 0x100,) + MEMORY32FIXED (ReadWrite, 0xFE202000, 0x100,) Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x58 } }) Return (RBUF) diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Spcr.asl b/Platform/Raspb= erryPi/RPi4/AcpiTables/Spcr.asl index 2e6a37323794..4632a4f193e7 100644 --- a/Platform/RaspberryPi/RPi4/AcpiTables/Spcr.asl +++ b/Platform/RaspberryPi/RPi4/AcpiTables/Spcr.asl @@ -2,6 +2,7 @@ * * Serial Port Console Redirection Table (SPCR) * + * Copyright (c) 2019, ARM Ltd. All rights reserved. * Copyright (c) 2017-2018, Andrey Warkentin * * SPDX-License-Identifier: BSD-2-Clause-Patent @@ -13,12 +14,12 @@ [008h 0008 1] Revision : 02 [009h 0009 1] Checksum : 00 [00Ah 0010 6] Oem ID : "RPiEFI" -[010h 0016 8] Oem Table ID : "RPi3UEFI" +[010h 0016 8] Oem Table ID : "RPi4UEFI" [018h 0024 4] Oem Revision : 00000001 [01Ch 0028 4] Asl Compiler ID : "----" [020h 0032 4] Asl Compiler Revision : 00000000 =20 -[024h 0036 1] Interface Type : 10 +[024h 0036 1] Interface Type : 10 // 0x03 =3D PL011, 0= x10 =3D BCM2835 [025h 0037 3] Reserved : 000000 =20 [028h 0040 12] Serial Port Register : [Generic Address Structure] @@ -26,16 +27,16 @@ [029h 0041 1] Bit Width : 20 [02Ah 0042 1] Bit Offset : 00 [02Bh 0043 1] Encoded Access Width : 03 [DWord Access:32] -[02Ch 0044 8] Address : 000000003f215000 +[02Ch 0044 8] Address : FE215000 =20 -[034h 0052 1] Interrupt Type : 0E +[034h 0052 1] Interrupt Type : 08 // ARMH GIC interrupt [035h 0053 1] PCAT-compatible IRQ : 00 -[036h 0054 4] Interrupt : 3D -[03Ah 0058 1] Baud Rate : 07 +[036h 0054 4] Interrupt : 7D +[03Ah 0058 1] Baud Rate : 07 // 115200 [03Bh 0059 1] Parity : 00 [03Ch 0060 1] Stop Bits : 01 [03Dh 0061 1] Flow Control : 00 -[03Eh 0062 1] Terminal Type : 00 +[03Eh 0062 1] Terminal Type : 02 // VT-UTF8 [04Ch 0076 1] Reserved : 00 [040h 0064 2] PCI Device ID : FFFF [042h 0066 2] PCI Vendor ID : FFFF diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Uart.asl b/Platform/Raspb= erryPi/RPi4/AcpiTables/Uart.asl index a0067c82c661..15149892f3b0 100644 --- a/Platform/RaspberryPi/RPi4/AcpiTables/Uart.asl +++ b/Platform/RaspberryPi/RPi4/AcpiTables/Uart.asl @@ -13,7 +13,7 @@ Device (URT0) { Name (_HID, "BCM2837") - Name (_CID, "HID3123") + Name (_CID, "ARMH0011") Name (_UID, 0x4) Name (_CCA, 0x0) Method (_STA) @@ -24,13 +24,13 @@ Device (URT0) { Name (RBUF, ResourceTemplate () { - MEMORY32FIXED (ReadWrite, 0x3F201000, 0x1000,) - Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x59 } + MEMORY32FIXED (ReadWrite, 0xFE201000, 0x1000,) + Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x99 } }) Return (RBUF) } =20 - Name (CLCK, 3000000) + Name (CLCK, 48000000) =20 Name (_DSD, Package () { @@ -63,8 +63,8 @@ Device (URTM) { Name (RBUF, ResourceTemplate () { - MEMORY32FIXED (ReadWrite, 0x3F215000, 0x70,) - Interrupt(ResourceConsumer, Level, ActiveHigh, Shared) {0x3D} + MEMORY32FIXED (ReadWrite, 0xFE215000, 0x70,) + Interrupt(ResourceConsumer, Level, ActiveHigh, Shared) { 0x7D } =20 // NTRAID#MSFT-7141401-2016/04/7-jordanrh - disable UART muxing // until a proper solution can be created for the dmap conflict. --=20 2.21.0.windows.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 (#52117): https://edk2.groups.io/g/devel/message/52117 Mute This Topic: https://groups.io/mt/68147487/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 May 5 15:47:16 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+52118+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+52118+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1576063581; cv=none; d=zohomail.com; s=zohoarc; b=EYNEfpjxFLuKzhHftc+iSCROJrcX0VKOdCPwHKY6GawWxwrlzFDgubSR0R4/cJvU6+A52fm7ZaREjuJOmoJWNPe6QquHjgrae5kgbZAmGeNDeXpWXfXhMP/SCpwXUD3Bk0jL+09FamGq1Q/fPLBPtoCLhU6L5sZ6SA9USlqFTC8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576063581; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=Gv5ETohaLYsia1XPy6vnrmz43VdSHfwg/TOVJj3ejc8=; b=XDy6vyEGkKTvCIC3jnoiELBBxK29bse90RVLwyM2DOy6DLCfYmAGjkAGJaUZr5lq5TYZAIt2Y3NnHU6VFj9JOzuGPF0auZ5kRWDbssq3Lvw8Bd321RW6tqVgEmzCTwFAu0Mm30UUQJiNdPqjoagFLIzRZagA49R5+Dz4qomgpa4= 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+52118+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1576063581253635.6696340052049; Wed, 11 Dec 2019 03:26:21 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id x6jYYY1788612x4xuRZhYiXo; Wed, 11 Dec 2019 03:26:20 -0800 X-Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) by mx.groups.io with SMTP id smtpd.web11.2241.1576063578953234436 for ; Wed, 11 Dec 2019 03:26:19 -0800 X-Received: by mail-wr1-f42.google.com with SMTP id q6so2134272wro.9 for ; Wed, 11 Dec 2019 03:26:18 -0800 (PST) X-Gm-Message-State: eJJoo36sSBCmifhqCSEhjrmXx1787277AA= X-Google-Smtp-Source: APXvYqwLTqe42DAeu18937aWBNAGPLmpcbO1d1ENl/vuXx6szVnozy8LZKrDIJkTPoHi+4i+F+UgUQ== X-Received: by 2002:a5d:6748:: with SMTP id l8mr3349620wrw.188.1576063576241; Wed, 11 Dec 2019 03:26:16 -0800 (PST) X-Received: from localhost.localdomain ([84.203.45.230]) by smtp.gmail.com with ESMTPSA id q8sm190460wmq.3.2019.12.11.03.26.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Dec 2019 03:26:15 -0800 (PST) From: "Pete Batard" To: devel@edk2.groups.io Cc: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org, philmd@redhat.com, andrey.warkentin@gmail.com, samer.el-haj-mahmoud@arm.com Subject: [edk2-devel] [edk2-platforms][PATCH 5/5] Platform/RPi4: Add base platform files Date: Wed, 11 Dec 2019 11:25:52 +0000 Message-Id: <20191211112552.15900-6-pete@akeo.ie> In-Reply-To: <20191211112552.15900-1-pete@akeo.ie> References: <20191211112552.15900-1-pete@akeo.ie> MIME-Version: 1.0 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,pete@akeo.ie Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1576063580; bh=hbqywvg5X0pngGFXJmLZD+TwOCM9W408lBZFdOduq4c=; h=Cc:Date:From:Reply-To:Subject:To; b=v8FaDcWHaz040KvlbCIHZ66e3QW+/wvE3eGUaIPDSXq80CLSp8PZJtlR5a3xz9tPYWd YSGa5fEINFvnSB/JcM3fvdJnTc8sg0r6PnOmLB+8LSnWyQjXdw9Vcko5eE5J7XVG0b2+X W+hepluxeJtcm0pBtzZ7dH8mDTb0d7la/gw= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Andrei Warkentin This enables building the initial RPi4 platform firmware. Note that PCIe and xHCI are missing at this stage and that this version of the firmware uses miniUART for serial I/O. PCIe and xHCI support will be added in a later patch series as well as the ability to switch between PL011 and miniUART for serial. Details on how to use the resulting firmware, and especially how to configure the media for boot, are provided in the Readme. Signed-off-by: Pete Batard Reviewed-by: Ard Biesheuvel --- Platform/RaspberryPi/RPi4/RPi4.dsc | 637 ++++++++++++++++++++ Platform/RaspberryPi/RPi4/RPi4.fdf | 432 +++++++++++++ Platform/RaspberryPi/RPi4/Readme.md | 110 ++++ 3 files changed, 1179 insertions(+) diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc b/Platform/RaspberryPi/RPi4= /RPi4.dsc new file mode 100644 index 000000000000..3764d1b3d794 --- /dev/null +++ b/Platform/RaspberryPi/RPi4/RPi4.dsc @@ -0,0 +1,637 @@ +# @file +# +# Copyright (c) 2011 - 2019, ARM Limited. All rights reserved. +# Copyright (c) 2017 - 2018, Andrei Warkentin +# Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved. +# Copyright (c) 2014, Linaro Limited. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +##########################################################################= ###### +# +# Defines Section - statements that will be processed to create a Makefile. +# +##########################################################################= ###### +[Defines] + PLATFORM_NAME =3D RPi4 + PLATFORM_GUID =3D a7eca3b4-21b0-4989-8c18-c08f3ae87837 + PLATFORM_VERSION =3D 1.0 + DSC_SPECIFICATION =3D 0x0001001A + OUTPUT_DIRECTORY =3D Build/$(PLATFORM_NAME) + SUPPORTED_ARCHITECTURES =3D AARCH64 + BUILD_TARGETS =3D DEBUG|RELEASE|NOOPT + SKUID_IDENTIFIER =3D DEFAULT + FLASH_DEFINITION =3D Platform/RaspberryPi/$(PLATFORM_NAME)= /$(PLATFORM_NAME).fdf + + # + # Network definition + # + DEFINE NETWORK_TLS_ENABLE =3D FALSE + DEFINE NETWORK_HTTP_BOOT_ENABLE =3D FALSE + + # + # Defines for default states. These can be changed on the command line. + # -D FLAG=3DVALUE + # + DEFINE SECURE_BOOT_ENABLE =3D FALSE + DEFINE INCLUDE_TFTP_COMMAND =3D FALSE + DEFINE DEBUG_PRINT_ERROR_LEVEL =3D 0x8000004F + +##########################################################################= ###### +# +# Library Class section - list of all Library Classes needed by this Platf= orm. +# +##########################################################################= ###### +[LibraryClasses.common] +!if $(TARGET) =3D=3D RELEASE + DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf +!else + DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf +!endif + DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseD= ebugPrintErrorLevelLib.inf + + BaseLib|MdePkg/Library/BaseLib/BaseLib.inf + SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf + BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.i= nf + SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchroniza= tionLib.inf + PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibN= ull.inf + ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseRepor= tStatusCodeLibNull.inf + PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf + PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeC= offGetEntryPointLib.inf + PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf + IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf + UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompres= sLib.inf + CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf + + UefiLib|MdePkg/Library/UefiLib/UefiLib.inf + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf + UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/U= efiRuntimeServicesTableLib.inf + DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf + UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBoo= tServicesTableLib.inf + DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableL= ib.inf + DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf + UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntry= Point.inf + UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiA= pplicationEntryPoint.inf + HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf + UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServic= esLib.inf + SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf + + UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf + OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib= /BaseOrderedCollectionRedBlackTreeLib.inf + + # + # Ramdisk Requirements + # + FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf + + # Allow dynamic PCDs + # + PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf + + # use the accelerated BaseMemoryLibOptDxe by default, overrides for SEC/= PEI below + BaseMemoryLib|MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf + + # + # It is not possible to prevent the ARM compiler from inserting calls to= intrinsic functions. + # This library provides the instrinsic functions such a compiler may gen= erate calls to. + # + NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf + + # Add support for GCC stack protector + NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf + + # ARM Architectural Libraries + CacheMaintenanceLib|ArmPkg/Library/ArmCacheMaintenanceLib/ArmCacheMainte= nanceLib.inf + DefaultExceptionHandlerLib|ArmPkg/Library/DefaultExceptionHandlerLib/Def= aultExceptionHandlerLib.inf + CpuExceptionHandlerLib|ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.inf + ArmDisassemblerLib|ArmPkg/Library/ArmDisassemblerLib/ArmDisassemblerLib.= inf + ArmGicLib|ArmPkg/Drivers/ArmGic/ArmGicLib.inf + ArmGicArchLib|ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf + DmaLib|EmbeddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.inf + TimeBaseLib|EmbeddedPkg/Library/TimeBaseLib/TimeBaseLib.inf + ArmPlatformStackLib|ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatfo= rmStackLib.inf + ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf + ArmHvcLib|ArmPkg/Library/ArmHvcLib/ArmHvcLib.inf + ArmGenericTimerCounterLib|ArmPkg/Library/ArmGenericTimerPhyCounterLib/Ar= mGenericTimerPhyCounterLib.inf + + PciCf8Lib|MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf + PciLib|MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf + PlatformHookLib|MdeModulePkg/Library/BasePlatformHookLibNull/BasePlatfor= mHookLibNull.inf + SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPort= Lib16550.inf + + # Cryptographic libraries + IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf + BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf + OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf + + # + # Uncomment (and comment out the next line) For RealView Debugger. The S= tandard IO window + # in the debugger will show load and unload commands for symbols. You ca= n cut and paste this + # into the command window to load symbols. We should be able to use a sc= ript to do this, but + # the version of RVD I have does not support scripts accessing system me= mory. + # + #PeCoffExtraActionLib|ArmPkg/Library/RvdPeCoffExtraActionLib/RvdPeCoffEx= traActionLib.inf + PeCoffExtraActionLib|ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCof= fExtraActionLib.inf + #PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePe= CoffExtraActionLibNull.inf + + DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.i= nf + DebugAgentTimerLib|EmbeddedPkg/Library/DebugAgentTimerLibNull/DebugAgent= TimerLibNull.inf + + # Flattened Device Tree (FDT) access library + FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf + + # USB Libraries + UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf + + # + # Secure Boot dependencies + # +!if $(SECURE_BOOT_ENABLE) =3D=3D TRUE + TpmMeasurementLib|SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasure= mentLib.inf + AuthVariableLib|SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf + + # re-use the UserPhysicalPresent() dummy implementation from the ovmf tr= ee + PlatformSecureLib|OvmfPkg/Library/PlatformSecureLib/PlatformSecureLib.inf +!else + TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurem= entLibNull.inf + AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLib= Null.inf +!endif + VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf + GpioLib|Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.inf + +[LibraryClasses.common.SEC] + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf + MemoryInitPeiLib|Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryIni= tPeiLib.inf + PlatformPeiLib|ArmPlatformPkg/PlatformPei/PlatformPeiLib.inf + ExtractGuidedSectionLib|EmbeddedPkg/Library/PrePiExtractGuidedSectionLib= /PrePiExtractGuidedSectionLib.inf + LzmaDecompressLib|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCusto= mDecompressLib.inf + PrePiLib|EmbeddedPkg/Library/PrePiLib/PrePiLib.inf + HobLib|EmbeddedPkg/Library/PrePiHobLib/PrePiHobLib.inf + PrePiHobListPointerLib|ArmPlatformPkg/Library/PrePiHobListPointerLib/Pre= PiHobListPointerLib.inf + MemoryAllocationLib|EmbeddedPkg/Library/PrePiMemoryAllocationLib/PrePiMe= moryAllocationLib.inf + +[LibraryClasses.common.DXE_CORE] + HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf + MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeC= oreMemoryAllocationLib.inf + DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf + ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExt= ractGuidedSectionLib.inf + PerformanceLib|MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerform= anceLib.inf + +[LibraryClasses.common.DXE_DRIVER] + SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeS= ecurityManagementLib.inf + PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.= inf + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf +!if $(INCLUDE_TFTP_COMMAND) =3D=3D TRUE + ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf + FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf +!endif + +[LibraryClasses.common.UEFI_APPLICATION] + PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.= inf + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf + HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf + ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf + FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf + +[LibraryClasses.common.UEFI_DRIVER] + ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExt= ractGuidedSectionLib.inf + PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.= inf + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf + +[LibraryClasses.common.DXE_RUNTIME_DRIVER] + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf + CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf + EfiResetSystemLib|Platform/RaspberryPi/Library/ResetLib/ResetLib.inf + ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf + +!if $(SECURE_BOOT_ENABLE) =3D=3D TRUE + BaseCryptLib|CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf +!endif + +##########################################################################= ######################### +# BuildOptions Section - Define the module specific tool chain flags that = should be used as +# the default flags for a module. These flags are a= ppended to any +# standard flags that are defined by the build proc= ess. +##########################################################################= ######################### + +[BuildOptions] + GCC:*_*_AARCH64_DLINK_FLAGS =3D -Wl,--fix-cortex-a53-843419 + GCC:RELEASE_*_*_CC_FLAGS =3D -DMDEPKG_NDEBUG -DNDEBUG + +[BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER] + GCC:*_*_AARCH64_DLINK_FLAGS =3D -z common-page-size=3D0x10000 + +##########################################################################= ###### +# +# Pcd Section - list of all EDK II PCD Entries defined by this Platform +# +##########################################################################= ###### + +[PcdsFeatureFlag.common] + # Use the Vector Table location in CpuDxe. We will not copy the Vector T= able at PcdCpuVectorBaseAddress + gArmTokenSpaceGuid.PcdRelocateVectorTable|FALSE + + gEmbeddedTokenSpaceGuid.PcdPrePiProduceMemoryTypeInformationHob|TRUE + gEfiMdeModulePkgTokenSpaceGuid.PcdTurnOffUsbLegacySupport|TRUE + + ## If TRUE, Graphics Output Protocol will be installed on virtual handle= created by ConsplitterDxe. + # It could be set FALSE to save size. + gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE + gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE + +[PcdsFixedAtBuild.common] + gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength|1000000 + gEfiMdePkgTokenSpaceGuid.PcdMaximumAsciiStringLength|1000000 + gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength|1000000 + gEfiMdePkgTokenSpaceGuid.PcdSpinLockTimeout|10000000 + gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue|0xAF + gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask|1 + gEfiMdePkgTokenSpaceGuid.PcdPostCodePropertyMask|0 + gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|320 + gRaspberryPiTokenSpaceGuid.PcdFdtBaseAddress|0x20000 + + # DEBUG_ASSERT_ENABLED 0x01 + # DEBUG_PRINT_ENABLED 0x02 + # DEBUG_CODE_ENABLED 0x04 + # CLEAR_MEMORY_ENABLED 0x08 + # ASSERT_BREAKPOINT_ENABLED 0x10 + # ASSERT_DEADLOOP_ENABLED 0x20 +!if $(TARGET) =3D=3D RELEASE + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x21 +!else + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x2f +!endif + + # DEBUG_INIT 0x00000001 // Initialization + # DEBUG_WARN 0x00000002 // Warnings + # DEBUG_LOAD 0x00000004 // Load events + # DEBUG_FS 0x00000008 // EFI File system + # DEBUG_POOL 0x00000010 // Alloc & Free (pool) + # DEBUG_PAGE 0x00000020 // Alloc & Free (page) + # DEBUG_INFO 0x00000040 // Informational debug messages + # DEBUG_DISPATCH 0x00000080 // PEI/DXE/SMM Dispatchers + # DEBUG_VARIABLE 0x00000100 // Variable + # DEBUG_BM 0x00000400 // Boot Manager + # DEBUG_BLKIO 0x00001000 // BlkIo Driver + # DEBUG_NET 0x00004000 // SNP Driver + # DEBUG_UNDI 0x00010000 // UNDI Driver + # DEBUG_LOADFILE 0x00020000 // LoadFile + # DEBUG_EVENT 0x00080000 // Event messages + # DEBUG_GCD 0x00100000 // Global Coherency Database changes + # DEBUG_CACHE 0x00200000 // Memory range cachability changes + # DEBUG_VERBOSE 0x00400000 // Detailed debug messages that may + # // significantly impact boot performance + # DEBUG_ERROR 0x80000000 // Error + gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|$(DEBUG_PRINT_ERROR_LEV= EL) + + gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x07 + + # + # Optional feature to help prevent EFI memory map fragments + # Turned on and off via: PcdPrePiProduceMemoryTypeInformationHob + # Values are in EFI Pages (4K). DXE Core will make sure that + # at least this much of each type of memory can be allocated + # from a single memory range. This way you only end up with + # maximum of two fragments for each type in the memory map + # (the memory used, and the free memory that was prereserved + # but not used). + # + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory|0 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS|0 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType|0 +!if $(SECURE_BOOT_ENABLE) =3D=3D TRUE + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData|600 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode|400 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesCode|1500 +!else + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData|300 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode|150 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesCode|1000 +!endif + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesData|12000 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode|20 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData|0 + + gEmbeddedTokenSpaceGuid.PcdDmaDeviceOffset|0xc0000000 + + gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString|L"EDK2-DEV" + +!if $(SECURE_BOOT_ENABLE) =3D=3D TRUE + # override the default values from SecurityPkg to ensure images from all= sources are verified in secure boot + gEfiSecurityPkgTokenSpaceGuid.PcdOptionRomImageVerificationPolicy|0x04 + gEfiSecurityPkgTokenSpaceGuid.PcdFixedMediaImageVerificationPolicy|0x04 + gEfiSecurityPkgTokenSpaceGuid.PcdRemovableMediaImageVerificationPolicy|0= x04 +!endif + +[LibraryClasses.common] + ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf + ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf + ArmPlatformLib|Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf + TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf + CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf + UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManag= erLib.inf + BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf + PlatformBootManagerLib|Platform/RaspberryPi/Library/PlatformBootManagerL= ib/PlatformBootManagerLib.inf + CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/Customize= dDisplayLib.inf + FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf + +[LibraryClasses.common.UEFI_DRIVER] + UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf + +##########################################################################= ###### +# +# Pcd Section - list of all EDK II PCD Entries defined by this Platform +# +##########################################################################= ###### + +[PcdsFeatureFlag.common] + gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE + gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE + gEfiMdeModulePkgTokenSpaceGuid.PcdInstallAcpiSdtProtocol|TRUE + +[PcdsFixedAtBuild.common] + gArmPlatformTokenSpaceGuid.PcdCoreCount|4 + gArmTokenSpaceGuid.PcdVFPEnabled|1 + + gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize|0x4000 + gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000 + gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x2800 + + # Size of the region used by UEFI in permanent memory (Reserved 64MB) + gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize|0x04000000 + # + # This matches PcdFvBaseAddress, since everything less is ATF, and + # will be reserved away. + # + gArmTokenSpaceGuid.PcdSystemMemoryBase|0x00400000 + gArmTokenSpaceGuid.PcdSystemMemorySize|0x3fc00000 + + # + # Device specific addresses + # + gRaspberryPiTokenSpaceGuid.PcdExtendedMemoryBase|0x40000000 + gBcm27xxTokenSpaceGuid.PcdBcm27xxRegistersAddress|0xfc000000 + gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress|0xfe000000 + + ## NS16550 compatible UART + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0xfe215040 + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio|TRUE + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterStride|4 + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialClockRate|500000000 + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialFifoControl|0x27 + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialExtendedTxFifoSize|8 + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|115200 + + # + # ARM General Interrupt Controller + # + gArmTokenSpaceGuid.PcdGicDistributorBase|0xFF841000 + gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase|0xFF842000 + + ## Default Terminal Type + ## 0-PCANSI, 1-VT100, 2-VT00+, 3-UTF8, 4-TTYTERM + gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|4 + + gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|FAL= SE + gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{ 0x21, 0xaa, 0x2c= , 0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a, 0xb6, 0xf4, 0x66, 0x23, 0= x31 } + + gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVendor|L"EDK2" + gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack|TRUE + +[PcdsDynamicHii.common.DEFAULT] + + # + # Clock overrides. + # + + gRaspberryPiTokenSpaceGuid.PcdCpuClock|L"CpuClock"|gConfigDxeFormSetGuid= |0x0|0 + gRaspberryPiTokenSpaceGuid.PcdCustomCpuClock|L"CustomCpuClock"|gConfigDx= eFormSetGuid|0x0|600 + + # + # SD-related. + # + + gRaspberryPiTokenSpaceGuid.PcdSdIsArasan|L"SdIsArasan"|gConfigDxeFormSet= Guid|0x0|1 + gRaspberryPiTokenSpaceGuid.PcdMmcForce1Bit|L"MmcForce1Bit"|gConfigDxeFor= mSetGuid|0x0|0 + gRaspberryPiTokenSpaceGuid.PcdMmcForceDefaultSpeed|L"MmcForceDefaultSpee= d"|gConfigDxeFormSetGuid|0x0|0 + gRaspberryPiTokenSpaceGuid.PcdMmcSdDefaultSpeedMHz|L"MmcSdDefaultSpeedMH= z"|gConfigDxeFormSetGuid|0x0|25 + gRaspberryPiTokenSpaceGuid.PcdMmcSdHighSpeedMHz|L"MmcSdHighSpeedMHz"|gCo= nfigDxeFormSetGuid|0x0|50 + gRaspberryPiTokenSpaceGuid.PcdMmcDisableMulti|L"MmcDisableMulti"|gConfig= DxeFormSetGuid|0x0|0 + + # + # Debug-related. + # + + gRaspberryPiTokenSpaceGuid.PcdDebugEnableJTAG|L"DebugEnableJTAG"|gConfig= DxeFormSetGuid|0x0|0 + gRaspberryPiTokenSpaceGuid.PcdDebugShowUEFIExit|L"DebugShowUEFIExit"|gCo= nfigDxeFormSetGuid|0x0|0 + + # + # Display-related. + # + gRaspberryPiTokenSpaceGuid.PcdDisplayEnableScaledVModes|L"DisplayEnableS= caledVModes"|gConfigDxeFormSetGuid|0x0|0xff + gRaspberryPiTokenSpaceGuid.PcdDisplayEnableSShot|L"DisplayEnableSShot"|g= ConfigDxeFormSetGuid|0x0|1 + + # + # Common UEFI ones. + # + + gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|L"Timeout"|gEfiGlobalVar= iableGuid|0x0|5 + # + # This is silly, but by pointing SetupConXXX and ConXXX PCDs to + # the same variables, I can use the graphical configuration to + # change the mode used by ConSplitter. + # + gEfiMdeModulePkgTokenSpaceGuid.PcdSetupConOutColumn|L"Columns"|gRaspberr= yPiTokenSpaceGuid|0x0|80 + gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn|L"Columns"|gRaspberryPiTo= kenSpaceGuid|0x0|80 + gEfiMdeModulePkgTokenSpaceGuid.PcdSetupConOutRow|L"Rows"|gRaspberryPiTok= enSpaceGuid|0x0|25 + gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow|L"Rows"|gRaspberryPiTokenSpa= ceGuid|0x0|25 + +[PcdsDynamicDefault.common] + # + # Set video resolution for boot options and for text setup. + # + gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|0 + gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|0 + gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoHorizontalResolution|640 + gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoVerticalResolution|480 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0 + +##########################################################################= ###### +# +# Components Section - list of all EDK II Modules needed by this Platform +# +##########################################################################= ###### +[Components.common] + # + # PEI Phase modules + # + ArmPlatformPkg/PrePi/PeiUniCore.inf + + # + # DXE + # + MdeModulePkg/Core/Dxe/DxeMain.inf { + + NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32Gu= idedSectionExtractLib.inf + } + MdeModulePkg/Universal/PCD/Dxe/Pcd.inf { + + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + } + + # + # Architectural Protocols + # + ArmPkg/Drivers/CpuDxe/CpuDxe.inf + MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf + Platform/RaspberryPi/Drivers/VarBlockServiceDxe/VarBlockServiceDxe.inf + MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf + MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf { + + NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf + DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf + } +!if $(SECURE_BOOT_ENABLE) =3D=3D TRUE + MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf { + + NULL|SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificatio= nLib.inf + } + SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDx= e.inf +!else + MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf +!endif + MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf + MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntim= eDxe.inf + EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf + EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf { + + RealTimeClockLib|EmbeddedPkg/Library/VirtualRealTimeClockLib/Virtual= RealTimeClockLib.inf + } + EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf + + MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf + MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf + Platform/RaspberryPi/Drivers/GraphicsConsoleDxe/GraphicsConsoleDxe.inf + MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf + MdeModulePkg/Universal/SerialDxe/SerialDxe.inf + Platform/RaspberryPi/Drivers/DisplayDxe/DisplayDxe.inf + + MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf + + UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf + ArmPkg/Drivers/ArmGic/ArmGicDxe.inf + Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.inf + Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.inf + Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf + ArmPkg/Drivers/TimerDxe/TimerDxe.inf + MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf + MdeModulePkg/Universal/EbcDxe/EbcDxe.inf + + # + # FAT filesystem + GPT/MBR partitioning + # + MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf + MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf + MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf + FatPkg/EnhancedFatDxe/Fat.inf + + # + # ACPI Support + # + MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf + MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf + MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsRes= ourceTableDxe.inf + Platform/RaspberryPi/$(PLATFORM_NAME)/AcpiTables/AcpiTables.inf + + # + # SMBIOS Support + # + Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf + MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf + + # + # RAM Disk Support + # + MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDxe.inf + + # + # Bds + # + MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf + MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf + MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf + MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf + MdeModulePkg/Universal/BdsDxe/BdsDxe.inf + Platform/RaspberryPi/Drivers/LogoDxe/LogoDxe.inf + MdeModulePkg/Application/UiApp/UiApp.inf { + + NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf + NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf + NULL|Platform/RaspberryPi/Library/PlatformUiAppLib/PlatformUiAppLib.= inf + NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanc= eManagerUiLib.inf + } + + # + # SCSI Bus and Disk Driver + # + MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf + MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf + + # + # USB Support + # + Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwUsbHostDxe.inf + MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf + MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf + MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf + Drivers/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/Ax88772b.inf + + # + # SD/MMC support + # + # Platform/RaspberryPi/Drivers/SdHostDxe/SdHostDxe.inf + Platform/RaspberryPi/Drivers/ArasanMmcHostDxe/ArasanMmcHostDxe.inf + Platform/RaspberryPi/Drivers/MmcDxe/MmcDxe.inf + + # + # Networking stack + # +!include NetworkPkg/Network.dsc.inc + + # + # RNG + # + Silicon/Broadcom/Bcm283x/Drivers/Bcm2838RngDxe/Bcm2838RngDxe.inf + + # + # UEFI application (Shell Embedded Boot Loader) + # + ShellPkg/Application/Shell/Shell.inf { + + ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellComman= dLib.inf + NULL|ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2Comm= andsLib.inf + NULL|ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1Comm= andsLib.inf + NULL|ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3Comm= andsLib.inf + NULL|ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1Co= mmandsLib.inf + NULL|ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Comm= andsLib.inf + NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1= CommandsLib.inf + NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1= CommandsLib.inf + NULL|ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewC= ommandLib.inf + HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandlePar= singLib.inf + PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf + BcfgCommandLib|ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcf= gCommandLib.inf + + + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0xFF + gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE + gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|8000 + gEfiShellPkgTokenSpaceGuid.PcdShellFileOperationSize|0x200000 + } +!if $(INCLUDE_TFTP_COMMAND) =3D=3D TRUE + ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf +!endif diff --git a/Platform/RaspberryPi/RPi4/RPi4.fdf b/Platform/RaspberryPi/RPi4= /RPi4.fdf new file mode 100644 index 000000000000..f0ab47c6c0a9 --- /dev/null +++ b/Platform/RaspberryPi/RPi4/RPi4.fdf @@ -0,0 +1,432 @@ +## @file +# +# Copyright (c) 2011 - 2019, ARM Limited. All rights reserved. +# Copyright (c) 2017 - 2018, Andrei Warkentin +# Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved. +# Copyright (c) 2014, Linaro Limited. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +##########################################################################= ###### +# +# FD Section +# The [FD] Section is made up of the definition statements and a +# description of what goes into the Flash Device Image. Each FD section +# defines one flash "device" image. A flash device image may be one of +# the following: Removable media bootable image (like a boot floppy +# image,) an Option ROM image (that would be "flashed" into an add-in +# card,) a System "Flash" image (that would be burned into a system's +# flash) or an Update ("Capsule") image that will be used to update and +# existing system flash. +# +##########################################################################= ###### + +[FD.RPI_EFI] +BaseAddress =3D 0x00000000|gArmTokenSpaceGuid.PcdFdBaseAddress +Size =3D 0x00200000|gArmTokenSpaceGuid.PcdFdSize +ErasePolarity =3D 1 + +BlockSize =3D 0x00001000|gRaspberryPiTokenSpaceGuid.PcdFirmwareBlockSi= ze +NumBlocks =3D 0x200 + +##########################################################################= ###### +# +# Following are lists of FD Region layout which correspond to the location= s of different +# images within the flash device. +# +# Regions must be defined in ascending order and may not overlap. +# +# A Layout Region start with a eight digit hex offset (leading "0x" requir= ed) followed by +# the pipe "|" character, followed by the size of the region, also in hex = with the leading +# "0x" characters. Like: +# Offset|Size +# PcdOffsetCName|PcdSizeCName +# RegionType +# +##########################################################################= ###### + +# +# ATF primary boot image +# +0x00000000|0x00020000 +FILE =3D Platform/RaspberryPi/$(PLATFORM_NAME)/TrustedFirmware/bl31_miniua= rt.bin + +# +# DTB. +# +0x00020000|0x00010000 +DATA =3D { 0x00 } + +# +# UEFI image +# +0x00030000|0x001b0000 +gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize +FV =3D FVMAIN_COMPACT + +# +# Variables (0x20000 overall). +# +# 0x001e0000 - 0x001edfff EFI_FIRMWARE_VOLUME_HEADER +# 0x001ee000 - 0x001eefff Event log +# 0x001ef000 - 0x001effff EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER- +# 0x001f0000 - 0x001fffff Data +# + +# NV_VARIABLE_STORE +0x001e0000|0x0000e000 +gRaspberryPiTokenSpaceGuid.PcdNvStorageVariableBase|gEfiMdeModulePkgTokenS= paceGuid.PcdFlashNvStorageVariableSize + +DATA =3D { + ## This is the EFI_FIRMWARE_VOLUME_HEADER + # ZeroVector [] + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + # FileSystemGuid: gEfiSystemNvDataFvGuid =3D + # { 0xFFF12B8D, 0x7696, 0x4C8B, + # { 0xA9, 0x85, 0x27, 0x47, 0x07, 0x5B, 0x4F, 0x50 }} + 0x8D, 0x2B, 0xF1, 0xFF, 0x96, 0x76, 0x8B, 0x4C, + 0xA9, 0x85, 0x27, 0x47, 0x07, 0x5B, 0x4F, 0x50, + # FvLength: 0x20000 + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, + # Signature "_FVH" # Attributes + 0x5f, 0x46, 0x56, 0x48, 0xff, 0xfe, 0x04, 0x00, + # HeaderLength + 0x48, 0x00, + # CheckSum + 0x19, 0xF9, + # ExtHeaderOffset #Reserved #Revision + 0x00, 0x00, 0x00, 0x02, + # Blockmap[0]: 0x20 Blocks * 0x1000 Bytes / Block + 0x20, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, + # Blockmap[1]: End + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + ## This is the VARIABLE_STORE_HEADER + # It is compatible with SECURE_BOOT_ENABLE =3D=3D FALSE as well. + # Signature: gEfiAuthenticatedVariableGuid =3D + # { 0xaaf32c78, 0x947b, 0x439a, + # { 0xa1, 0x80, 0x2e, 0x14, 0x4e, 0xc3, 0x77, 0x92 }} + 0x78, 0x2c, 0xf3, 0xaa, 0x7b, 0x94, 0x9a, 0x43, + 0xa1, 0x80, 0x2e, 0x14, 0x4e, 0xc3, 0x77, 0x92, + # Size: 0xe000 (gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariable= Size) - + # 0x48 (size of EFI_FIRMWARE_VOLUME_HEADER) =3D 0xdfb8 + # This can speed up the Variable Dispatch a bit. + 0xB8, 0xDF, 0x00, 0x00, + # FORMATTED: 0x5A #HEALTHY: 0xFE #Reserved: UINT16 #Reserved1: UINT32 + 0x5A, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +} + +# NV_EVENT_LOG +0x001ee000|0x00001000 +gRaspberryPiTokenSpaceGuid.PcdNvStorageEventLogBase|gRaspberryPiTokenSpace= Guid.PcdNvStorageEventLogSize + +# NV_FTW_WORKING header +0x001ef000|0x00001000 +gRaspberryPiTokenSpaceGuid.PcdNvStorageFtwWorkingBase|gEfiMdeModulePkgToke= nSpaceGuid.PcdFlashNvStorageFtwWorkingSize + +DATA =3D { + # EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER->Signature =3D gEdkiiWorkingBl= ockSignatureGuid =3D + # { 0x9e58292b, 0x7c68, 0x497d, { 0xa0, 0xce, 0x65, 0x0, 0xfd, 0x9f, 0= x1b, 0x95 }} + 0x2b, 0x29, 0x58, 0x9e, 0x68, 0x7c, 0x7d, 0x49, + 0xa0, 0xce, 0x65, 0x0, 0xfd, 0x9f, 0x1b, 0x95, + # Crc:UINT32 #WorkingBlockValid:1, WorkingBlockInvalid:1, Res= erved + 0x2c, 0xaf, 0x2c, 0x64, 0xFE, 0xFF, 0xFF, 0xFF, + # WriteQueueSize: UINT64 + 0xE0, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +} + +# NV_FTW_WORKING data +0x001f0000|0x00010000 +gRaspberryPiTokenSpaceGuid.PcdNvStorageFtwSpareBase|gEfiMdeModulePkgTokenS= paceGuid.PcdFlashNvStorageFtwSpareSize + +##########################################################################= ###### +# +# FV Section +# +# [FV] section is used to define what components or modules are placed wit= hin a flash +# device file. This section also defines order the components and modules= are positioned +# within the image. The [FV] section consists of define statements, set s= tatements and +# module statements. +# +##########################################################################= ###### + +[FV.FvMain] +FvNameGuid =3D 9a15aa37-d555-4a4e-b541-86391ff68164 +BlockSize =3D 0x40 +NumBlocks =3D 0 # This FV gets compressed so make it just= big enough +FvAlignment =3D 16 # FV alignment and FV attributes setting. +ERASE_POLARITY =3D 1 +MEMORY_MAPPED =3D TRUE +STICKY_WRITE =3D TRUE +LOCK_CAP =3D TRUE +LOCK_STATUS =3D TRUE +WRITE_DISABLED_CAP =3D TRUE +WRITE_ENABLED_CAP =3D TRUE +WRITE_STATUS =3D TRUE +WRITE_LOCK_CAP =3D TRUE +WRITE_LOCK_STATUS =3D TRUE +READ_DISABLED_CAP =3D TRUE +READ_ENABLED_CAP =3D TRUE +READ_STATUS =3D TRUE +READ_LOCK_CAP =3D TRUE +READ_LOCK_STATUS =3D TRUE + + INF MdeModulePkg/Core/Dxe/DxeMain.inf + INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf + + # + # PI DXE Drivers producing Architectural Protocols (EFI Services) + # + INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf + INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf + INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf + INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf + INF Platform/RaspberryPi/Drivers/VarBlockServiceDxe/VarBlockServiceDxe.i= nf + INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.i= nf + INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf +!if $(SECURE_BOOT_ENABLE) =3D=3D TRUE + INF SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConf= igDxe.inf +!endif + INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRu= ntimeDxe.inf + INF EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf + INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf + INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf + INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf + + # + # Multiple Console IO support + # + INF MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf + INF MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf + INF Platform/RaspberryPi/Drivers/GraphicsConsoleDxe/GraphicsConsoleDxe.i= nf + INF MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf + INF MdeModulePkg/Universal/SerialDxe/SerialDxe.inf + INF Platform/RaspberryPi/Drivers/DisplayDxe/DisplayDxe.inf + + INF UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf + INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf + INF Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.inf + INF Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.inf + INF Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf + INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf + INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf + INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf + + # + # FAT filesystem + GPT/MBR partitioning + # + INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf + INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf + INF FatPkg/EnhancedFatDxe/Fat.inf + INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.i= nf + + # + # UEFI application (Shell Embedded Boot Loader) + # + INF ShellPkg/Application/Shell/Shell.inf +!if $(INCLUDE_TFTP_COMMAND) =3D=3D TRUE + INF ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf +!endif + + # + # ACPI Support + # + INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf + INF MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf + INF MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphic= sResourceTableDxe.inf + INF RuleOverride =3D ACPITABLE Platform/RaspberryPi/$(PLATFORM_NAME)/Acp= iTables/AcpiTables.inf + + # + # SMBIOS Support + # + INF Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf + INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf + + # + # RAM Disk Support + # + INF MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDxe.inf + + # + # Bds + # + INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf + INF MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf + INF MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf + INF MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe= .inf + INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf + INF MdeModulePkg/Application/UiApp/UiApp.inf + + # + # Networking stack + # +!include NetworkPkg/Network.fdf.inc + + # + # RNG + # + INF Silicon/Broadcom/Bcm283x/Drivers/Bcm2838RngDxe/Bcm2838RngDxe.inf + + # + # SCSI Bus and Disk Driver + # + INF MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf + INF MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf + + # + # USB Support + # + INF Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwUsbHostDxe.inf + INF MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf + INF MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf + INF MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf + INF Drivers/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/Ax88772b.inf + + # + # SD/MMC support + # + # INF Platform/RaspberryPi/Drivers/SdHostDxe/SdHostDxe.inf + INF Platform/RaspberryPi/Drivers/ArasanMmcHostDxe/ArasanMmcHostDxe.inf + INF Platform/RaspberryPi/Drivers/MmcDxe/MmcDxe.inf + + # + # Pi logo (splash screen) + # + INF Platform/RaspberryPi/Drivers/LogoDxe/LogoDxe.inf + + # + # Device Tree support (used by FdtDxe) + # GUIDs should match gRaspberryPi#####FdtGuid's from the .dec + # + FILE FREEFORM =3D 80AB6833-CAE4-4CEE-B59D-EB2039B05551 { + SECTION RAW =3D Platform/RaspberryPi/$(PLATFORM_NAME)/DeviceTree/bcm27= 11-rpi-4-b.dtb + } + +[FV.FVMAIN_COMPACT] +FvAlignment =3D 16 +ERASE_POLARITY =3D 1 +MEMORY_MAPPED =3D TRUE +STICKY_WRITE =3D TRUE +LOCK_CAP =3D TRUE +LOCK_STATUS =3D TRUE +WRITE_DISABLED_CAP =3D TRUE +WRITE_ENABLED_CAP =3D TRUE +WRITE_STATUS =3D TRUE +WRITE_LOCK_CAP =3D TRUE +WRITE_LOCK_STATUS =3D TRUE +READ_DISABLED_CAP =3D TRUE +READ_ENABLED_CAP =3D TRUE +READ_STATUS =3D TRUE +READ_LOCK_CAP =3D TRUE +READ_LOCK_STATUS =3D TRUE + + INF ArmPlatformPkg/PrePi/PeiUniCore.inf + FILE FV_IMAGE =3D 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 { + SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRE= D =3D TRUE { + SECTION FV_IMAGE =3D FVMAIN + } + } + +##########################################################################= ###### +# +# Rules are use with the [FV] section's module INF type to define +# how an FFS file is created for a given INF file. The following Rule are = the default +# rules for the different module type. User can add the customized rules t= o define the +# content of the FFS file. +# +##########################################################################= ###### + + +##########################################################################= ## +# Example of a DXE_DRIVER FFS file with a Checksum encapsulation section = # +##########################################################################= ## +# +#[Rule.Common.DXE_DRIVER] +# FILE DRIVER =3D $(NAMED_GUID) { +# DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_= NAME).depex +# COMPRESS PI_STD { +# GUIDED { +# PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi +# UI STRING=3D"$(MODULE_NAME)" Optional +# VERSION STRING=3D"$(INF_VERSION)" Optional BUILD_NUM=3D$(BUILD_N= UMBER) +# } +# } +# } +# +##########################################################################= ## + +[Rule.Common.SEC] + FILE SEC =3D $(NAMED_GUID) RELOCS_STRIPPED FIXED { + TE TE Align =3D Auto $(INF_OUTPUT)/$(MODULE_NAME).efi + } + +[Rule.Common.PEI_CORE] + FILE PEI_CORE =3D $(NAMED_GUID) FIXED { + TE TE Align =3D Auto $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING =3D"$(MODULE_NAME)" Optional + } + +[Rule.Common.PEIM] + FILE PEIM =3D $(NAMED_GUID) FIXED { + PEI_DEPEX PEI_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex + TE TE Align =3D Auto $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING=3D"$(MODULE_NAME)" Optional + } + +[Rule.Common.DXE_CORE] + FILE DXE_CORE =3D $(NAMED_GUID) { + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING=3D"$(MODULE_NAME)" Optional + } + +[Rule.Common.UEFI_DRIVER] + FILE DRIVER =3D $(NAMED_GUID) { + DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NA= ME).depex + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING=3D"$(MODULE_NAME)" Optional + } + +[Rule.Common.DXE_DRIVER] + FILE DRIVER =3D $(NAMED_GUID) { + DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NA= ME).depex + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING=3D"$(MODULE_NAME)" Optional + RAW ACPI Optional |.acpi + RAW ASL Optional |.aml + } + +[Rule.Common.DXE_RUNTIME_DRIVER] + FILE DRIVER =3D $(NAMED_GUID) { + DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NA= ME).depex + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING=3D"$(MODULE_NAME)" Optional + } + +[Rule.Common.UEFI_APPLICATION] + FILE APPLICATION =3D $(NAMED_GUID) { + UI STRING =3D"$(MODULE_NAME)" Optional + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi + } + +[Rule.Common.UEFI_DRIVER.BINARY] + FILE DRIVER =3D $(NAMED_GUID) { + DXE_DEPEX DXE_DEPEX Optional |.depex + PE32 PE32 |.efi + UI STRING=3D"$(MODULE_NAME)" Optional + VERSION STRING=3D"$(INF_VERSION)" Optional BUILD_NUM=3D$(BUILD_NUMBE= R) + } + +[Rule.Common.UEFI_APPLICATION.BINARY] + FILE APPLICATION =3D $(NAMED_GUID) { + PE32 PE32 |.efi + UI STRING=3D"$(MODULE_NAME)" Optional + VERSION STRING=3D"$(INF_VERSION)" Optional BUILD_NUM=3D$(BUILD_NUMBE= R) + } + +[Rule.Common.USER_DEFINED.ACPITABLE] + FILE FREEFORM =3D $(NAMED_GUID) { + RAW ACPI |.acpi + RAW ASL |.aml + } diff --git a/Platform/RaspberryPi/RPi4/Readme.md b/Platform/RaspberryPi/RPi= 4/Readme.md new file mode 100644 index 000000000000..917f8436a382 --- /dev/null +++ b/Platform/RaspberryPi/RPi4/Readme.md @@ -0,0 +1,110 @@ +Raspberry Pi 4 Platform +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +# Summary + +This is a port of 64-bit Tiano Core UEFI firmware for the Raspberry Pi 4 p= latforms. + +This is intended to be useful 64-bit [TF-A](https://www.trustedfirmware.or= g/) + +UEFI implementation for the Raspberry Pi 4 which should be good enough for= most +kind of UEFI development, as well as for running consummer Operating Syste= ms +such as Linux or Windows. + +Raspberry Pi is a trademark of the [Raspberry Pi Foundation](https://www.r= aspberrypi.org). + +# Status + +This firmware is still in early stage of development, meaning that it come= s with +the following __major__ limitations: + +- USB is not supported yet (will be added soon) +- Booting of vanilla Operating Systems (Windows, Linux) is not supported y= et, + let alone expected to work at all. + +The only features that are expected to work with this first iteration of t= he +firmware are HDMI and serial I/O. + +## Known issues + +- The serial output from TF-A is garbled when using a `start4.elf` that was + released after 2019.11.18. This is a TF-A issue that will be fixed in a + later version. + +# Building + +Build instructions from the top level edk2-platforms Readme.md apply. + +# Booting the firmware + +1. Format a uSD card as FAT16 or FAT32 +2. Copy the generated `RPI_EFI.fd` firmware onto the partition +3. Download and copy the following files from https://github.com/raspberry= pi/firmware/tree/master/boot + - `bcm2711-rpi-4-b.dtb` + - `fixup4.dat` + - `start4.elf` +4. Create a `config.txt` with the following content: + ``` + arm_64bit=3D1 + enable_uart=3D1 + core_freq=3D250 + enable_gic=3D1 + armstub=3DRPI_EFI.fd + ``` +5. Insert the uSD card and power up the Pi. + +# Notes + +## ARM Trusted Firmware (TF-A) + +The TF-A binaries were compiled from a TF-A source over which 2 serial-out= put related +patches were applied, the first one to fix the miniUART baud rate not bein= g properly +set to 115200 bauds with recent versions of `start4.elf` and the second on= e to allow +swicthing between miniUART and PL011 at build time. + +No other alterations to the official source have been applied. + +For more details on the TF-A compilation, see the [Readme](./TrustedFirmwa= re/Readme.md) +in the `TrustedFirmware/` directory. + +## Device Tree + +You can pass a custom Device Tree and overlays using the following: + +``` +(...) +disable_commandline_tags=3D2 +device_tree_address=3D0x20000 +device_tree_end=3D0x30000 +device_tree=3Dbcm2711-rpi-4-b.dtb +``` + +Note: the address range **must** be `[0x20000:0x30000]`. +`dtoverlay` and `dtparam` parameters are also supported **when** providing= a Device Tree`. + +## Custom `bootargs` + +This firmware will honor the command line passed by the GPU via `cmdline.t= xt`. + +Note, that the ultimate contents of `/chosen/bootargs` are a combination o= f several pieces: +- Original `/chosen/bootargs` if using the internal DTB. Seems to be compl= etely discarded by GPU when booting with a custom device tree. +- GPU-passed hardware configuration. This one is always present. +- Additional boot options passed via `cmdline.txt`. + +# Limitations + +## NVRAM + +The Raspberry Pi has no NVRAM. + +NVRAM is emulated, with the non-volatile store backed by the UEFI image it= self. This +means that any changes made in UEFI proper are persisted, but changes made= from within +an Operating System aren't. + +## RTC + +The Rasberry Pi has no RTC. + +An `RtcEpochSeconds` NVRAM variable is used to store the boot time. +This should allow you to set whatever date/time you want using the Shell d= ate and +time commands. While in UEFI or HLOS, the time will tick forward. +`RtcEpochSeconds` is not updated on reboots. --=20 2.21.0.windows.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 (#52118): https://edk2.groups.io/g/devel/message/52118 Mute This Topic: https://groups.io/mt/68147489/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-