Date   

[edk2-platforms][PATCH v2 0/5] KabylakeOpenBoardPkg: Add AspireVn7Dash572G

Benjamin Doron
 

This patchset adds support for a Acer Aspire VN7-572G (SKL-U laptop)
board to KabylakeOpenBoardPkg, based on Kabylake RVP 3. As stated in a
later commit message, there is a second, similar board: VN7-792G.
- VN7-572G = "Rayleigh". Working, supported. Uses PCH-LP.
- VN7-792G = "Newgate". Assumed broken, not supported. Uses PCH-H.
Also known as the "Black Edition" of the Aspire V Nitro.

Because VN7-792G uses a different PCH, routing and GPIO configuration
are assumed to be different. Users are strongly warned against
attempting to flash images to VN7-792G at this time. Support may be
added later by reverse engineering, but logs from a running system will
help.

Additional build depedencies:
- https://github.com/benjamindoron/edk2-non-osi/commit/7bf736989159b74012d9bf3a13a9f941036be97a
- https://github.com/benjamindoron/edk2/commit/db888a928c1c6fc94f6a7670f3402718c10c01d2

V2 changes:
- Whitespace changes and changes for coding guidelines compliance
- KabylakeOpenBoardPkg changes merged into "duplicate KabylakeRvp3"
commit
- EC (ACPI): LGMR hooked-up (disabled), other changes.
- FSP-S configuration: Drop thermal changes not set by board, do not
override UART2 mode (PCI by policy)
- Set DspEndpointDmic so FSP produces correct configuration in HOB for
PchInitDxe. (However, 1ch array DMIC may not be supported by the
Linux driver. Also, presently NHLT is not installed in any case:
DspEnable=0 in HOB.)
- Avoid indirect function calls for GPIO configuration and deduplicate
HSIO tables
- Make board detection work and parse PCB version information
- Begin working on hardening platform and improving PCD
- DXE stack guard, NX for stack, NULL pointer detection (DXE NX is
broken)
- Measure FSP to TPM (presently skipping FSP-S, there may be a bug
where the first TPM command from this time will timeout waiting for
goIdle)
- UGA draw protocol and HII OS runtime disabled, fast PS/2 detection

Benjamin Doron (5):
KabylakeOpenBoardPkg/BaseEcLib: Add some common EC commands
KabylakeOpenBoardPkg/AspireVn7Dash572G: Duplicate KabylakeRvp3
directory
KabylakeOpenBoardPkg/AspireVn7Dash572G: Rename KabylakeRvp3 files
Platform/Intel: Early hook-up Acer Aspire VN7-572G
KabylakeOpenBoardPkg/AspireVn7Dash572G: Add initial support

Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Acpi/BoardAcpiTables.inf | 18 +
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Acpi/BoardSsdt.asl | 34 +
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Acpi/ac.asl | 16 +
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Acpi/battery.asl | 408 +++++++++++
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Acpi/ec.asl | 431 ++++++++++++
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Acpi/mainboard.asl | 79 +++
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Acpi/thermal.asl | 117 ++++
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PcieDeviceTable.c | 104 +++
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiBoardPolicyUpdate.c | 288 ++++++++
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c | 82 +++
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspPolicyUpdateLib.c | 213 ++++++
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiPchPolicyUpdate.c | 139 ++++
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiPchPolicyUpdate.h | 26 +
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiPchPolicyUpdatePreMem.c | 243 +++++++
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSaPolicyUpdate.c | 77 ++
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSaPolicyUpdate.h | 29 +
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSaPolicyUpdatePreMem.c | 66 ++
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf | 145 ++++
Platform/Intel/KabylakeOpenBoardPkg/{KabylakeRvp3 => AspireVn7Dash572G}/Include/EcCommands.h | 7 +-
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Include/Fdf/FlashMapInclude.fdf | 50 ++
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Include/Library/BoardEcLib.h | 112 +++
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardAcpiLib/DxeAspireVn7Dash572GAcpiTableLib.c | 74 ++
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardAcpiLib/DxeBoardAcpiTableLib.c | 30 +
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardAcpiLib/DxeBoardAcpiTableLib.inf | 47 ++
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardAcpiLib/SmmAspireVn7Dash572GAcpiEnableLib.c | 64 ++
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardAcpiLib/SmmBoardAcpiEnableLib.c | 55 ++
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardAcpiLib/SmmBoardAcpiEnableLib.inf | 45 ++
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardAcpiLib/SmmSiliconAcpiEnableLib.c | 166 +++++
Platform/Intel/KabylakeOpenBoardPkg/{Library/BaseEcLib/BaseEcLib.inf => AspireVn7Dash572G/Library/BoardEcLib/BoardEcLib.inf} | 13 +-
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardEcLib/EcCommands.c | 218 ++++++
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardInitLib/AspireVn7Dash572GGpioTable.c | 398 +++++++++++
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardInitLib/AspireVn7Dash572GHdaVerbTables.c | 203 ++++++
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardInitLib/AspireVn7Dash572GHsioPtssTables.c | 26 +
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardInitLib/PeiAspireVn7Dash572GDetect.c | 97 +++
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardInitLib/PeiAspireVn7Dash572GInitLib.h | 33 +
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardInitLib/PeiAspireVn7Dash572GInitPostMemLib.c | 126 ++++
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardInitLib/PeiAspireVn7Dash572GInitPreMemLib.c | 344 +++++++++
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardInitLib/PeiBoardInitPostMemLib.c | 34 +
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardInitLib/PeiBoardInitPostMemLib.inf | 47 ++
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardInitLib/PeiBoardInitPreMemLib.c | 99 +++
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardInitLib/PeiBoardInitPreMemLib.inf | 126 ++++
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/OpenBoardPkg.dsc | 674 ++++++++++++++++++
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/OpenBoardPkg.fdf | 733 ++++++++++++++++++++
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/OpenBoardPkgBuildOption.dsc | 153 ++++
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/OpenBoardPkgPcd.dsc | 546 +++++++++++++++
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/DxeSiliconPolicyUpdateLib/DxeGopPolicyInit.c | 188 +++++
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/DxeSiliconPolicyUpdateLib/DxeGopPolicyInit.h | 39 ++
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/DxeSiliconPolicyUpdateLib/DxeSaPolicyInit.h | 64 ++
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/DxeSiliconPolicyUpdateLib/DxeSaPolicyUpdate.c | 63 ++
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/DxeSiliconPolicyUpdateLib/DxeSiliconPolicyUpdateLib.c | 74 ++
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/DxeSiliconPolicyUpdateLib/DxeSiliconPolicyUpdateLib.inf | 52 ++
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/PeiSiliconPolicyUpdateLib/PeiBoardPolicyUpdate.c | 332 +++++++++
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.c | 642 +++++++++++++++++
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.inf | 107 +++
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/build_config.cfg | 35 +
Platform/Intel/KabylakeOpenBoardPkg/Include/Library/EcLib.h | 32 +
Platform/Intel/KabylakeOpenBoardPkg/Include/PlatformBoardId.h | 2 +
Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Include/EcCommands.h | 2 +
Platform/Intel/KabylakeOpenBoardPkg/Library/BaseEcLib/BaseEcLib.c | 4 +-
Platform/Intel/KabylakeOpenBoardPkg/Library/BaseEcLib/BaseEcLib.inf | 1 +
Platform/Intel/KabylakeOpenBoardPkg/Library/BaseEcLib/EcCommands.c | 76 ++
Platform/Intel/KabylakeOpenBoardPkg/OpenBoardPkg.dec | 1 +
Platform/Intel/build.cfg | 1 +
63 files changed, 8741 insertions(+), 9 deletions(-)
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Acpi/BoardAcpiTables.inf
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Acpi/BoardSsdt.asl
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Acpi/ac.asl
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Acpi/battery.asl
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Acpi/ec.asl
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Acpi/mainboard.asl
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Acpi/thermal.asl
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PcieDeviceTable.c
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiBoardPolicyUpdate.c
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspPolicyUpdateLib.c
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiPchPolicyUpdate.c
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiPchPolicyUpdate.h
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiPchPolicyUpdatePreMem.c
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSaPolicyUpdate.c
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSaPolicyUpdate.h
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSaPolicyUpdatePreMem.c
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf
copy Platform/Intel/KabylakeOpenBoardPkg/{KabylakeRvp3 => AspireVn7Dash572G}/Include/EcCommands.h (74%)
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Include/Fdf/FlashMapInclude.fdf
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Include/Library/BoardEcLib.h
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardAcpiLib/DxeAspireVn7Dash572GAcpiTableLib.c
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardAcpiLib/DxeBoardAcpiTableLib.c
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardAcpiLib/DxeBoardAcpiTableLib.inf
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardAcpiLib/SmmAspireVn7Dash572GAcpiEnableLib.c
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardAcpiLib/SmmBoardAcpiEnableLib.c
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardAcpiLib/SmmBoardAcpiEnableLib.inf
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardAcpiLib/SmmSiliconAcpiEnableLib.c
copy Platform/Intel/KabylakeOpenBoardPkg/{Library/BaseEcLib/BaseEcLib.inf => AspireVn7Dash572G/Library/BoardEcLib/BoardEcLib.inf} (58%)
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardEcLib/EcCommands.c
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardInitLib/AspireVn7Dash572GGpioTable.c
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardInitLib/AspireVn7Dash572GHdaVerbTables.c
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardInitLib/AspireVn7Dash572GHsioPtssTables.c
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardInitLib/PeiAspireVn7Dash572GDetect.c
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardInitLib/PeiAspireVn7Dash572GInitLib.h
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardInitLib/PeiAspireVn7Dash572GInitPostMemLib.c
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardInitLib/PeiAspireVn7Dash572GInitPreMemLib.c
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardInitLib/PeiBoardInitPostMemLib.c
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardInitLib/PeiBoardInitPostMemLib.inf
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardInitLib/PeiBoardInitPreMemLib.c
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardInitLib/PeiBoardInitPreMemLib.inf
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/OpenBoardPkg.dsc
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/OpenBoardPkg.fdf
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/OpenBoardPkgBuildOption.dsc
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/OpenBoardPkgPcd.dsc
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/DxeSiliconPolicyUpdateLib/DxeGopPolicyInit.c
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/DxeSiliconPolicyUpdateLib/DxeGopPolicyInit.h
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/DxeSiliconPolicyUpdateLib/DxeSaPolicyInit.h
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/DxeSiliconPolicyUpdateLib/DxeSaPolicyUpdate.c
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/DxeSiliconPolicyUpdateLib/DxeSiliconPolicyUpdateLib.c
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/DxeSiliconPolicyUpdateLib/DxeSiliconPolicyUpdateLib.inf
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/PeiSiliconPolicyUpdateLib/PeiBoardPolicyUpdate.c
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.c
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.inf
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/build_config.cfg
create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/Library/BaseEcLib/EcCommands.c

--
2.31.1


Re: [2021-gsoc-llvm-gnumake]: proposal for building using llvm/gnumake

Pedro Falcato
 

Hi Steven,

Have you considered using the --rtlib switch? It would eliminate the dependency on the system's libgcc, crtbegin/end.o and crti/o.o, for most systems. I don't know exactly how the build system works but I assume there's some way to force a compiler flag.

Best regards,

Pedro


On Fri, 13 Aug 2021 at 14:34, Steven Shi <steven.shi@...> wrote:

Liming,

The MSVC is required only because the Windows SDK Universal C runtime (UCRT) library depends on the MSVC.  Please see the dependency description here: “When you install Visual C++, Visual Studio setup installs the subset of the Windows 10 SDK required to use the UCRT.” https://docs.microsoft.com/en-us/cpp/c-runtime-library/crt-library-features?view=msvc-160.

 

If the MSVC is not installed, the ucrt will complain cannot find the msvc header files. Below is an example:

C:\Program Files\LLVM\bin\clang  -c  -I .. -I ../Include/Common -I ../Include/ -I ../Include/IndustryStandard -I ../Common/ -I .. -I . -I ../Include/X64/ -I "" -MD -fshort-wchar -fno-strict-aliasing -fwrapv -fno-delete-null-pointer-checks -Wall -Werror -Wno-deprecated-declarations -Wno-self-assign -Wno-unused-result -nostdlib -Wno-unused-function -g -m32 -O2  BasePeCoff.c -o BasePeCoff.o

In file included from BasePeCoff.c:13:

In file included from ../Common\CommonLib.h:14:

In file included from C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\assert.h:12:

C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\corecrt.h:10:10: fatal error: 'vcruntime.h' file not

      found

#include <vcruntime.h>

         ^~~~~~~~~~~~~

1 error generated.

 

 

 

BTW, the compiler dependency requirement also exists in Linux side. Below is the Linux GCC CRT library example. Although I build with clang, it still needs link the crt libraries in GCC installation. Below is an example:

$ /home/jshi19/llvm/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04/bin/clang -o ../bin/LzmaCompress   LzmaCompress.o Sdk/C/Alloc.o Sdk/C/LzFind.o Sdk/C/LzmaDec.o Sdk/C/LzmaEnc.o Sdk/C/7zFile.o Sdk/C/7zStream.o Sdk/C/Bra86.o -L../libs -lCommon -###

clang version 11.0.0 (https://github.com/llvm/llvm-project.git 0160ad802e899c2922bc9b29564080c22eb0908c)

Target: x86_64-unknown-linux-gnu

Thread model: posix

InstalledDir: /home/jshi19/llvm/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04/bin

"/usr/bin/ld" "-z" "relro" "--hash-style=gnu" "--eh-frame-hdr" "-m" "elf_x86_64" "-dynamic-linker" "/lib64/ld-linux-x86-64.so.2" "-o" "../bin/LzmaCompress" "/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/crt1.o" "/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/crti.o" "/usr/lib/gcc/x86_64-linux-gnu/10/crtbegin.o" "-L../libs" "-L/usr/lib/gcc/x86_64-linux-gnu/10" "-L/usr/lib/gcc/x86_64-linux-gnu/10/../../../../x86_64-linux-gnu/lib/../lib64" "-L/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu" "-L/lib/x86_64-linux-gnu" "-L/lib/../lib64" "-L/usr/lib/x86_64-linux-gnu" "-L/usr/lib/gcc/x86_64-linux-gnu/10/../../../../x86_64-linux-gnu/lib" "-L/usr/lib/gcc/x86_64-linux-gnu/10/../../.." "-L/home/jshi19/llvm/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04/bin/../lib" "-L/lib" "-L/usr/lib" "LzmaCompress.o" "Sdk/C/Alloc.o" "Sdk/C/LzFind.o" "Sdk/C/LzmaDec.o" "Sdk/C/LzmaEnc.o" "Sdk/C/7zFile.o" "Sdk/C/7zStream.o" "Sdk/C/Bra86.o" "-lCommon" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" "-lc" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" "/usr/lib/gcc/x86_64-linux-gnu/10/crtend.o" "/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/crtn.o"

 

 

 

 

Thanks

 

Steven Shi

Intel\SATG\SFP\FIA (Firmware Infrastructure Automation)

 

 

From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of gaoliming
Sent: Friday, August 13, 2021 9:18 AM
To: devel@edk2.groups.io; yuqi.chen@...
Subject: 回复: [edk2-devel] [2021-gsoc-llvm-gnumake]: proposal for building using llvm/gnumake

 

Yuqi:

 On Windows, can Clang + make combination drop the dependency of Visual studio? If I dont install Visual studio 2015 or 2017, I only install LLVM, can I fully compile BaseTools and Edk2 code?

 

Thanks

Liming

发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Yuqi Chen
发送时间: 2021812 9:52
收件人: devel@edk2.groups.io
主题: [edk2-devel] [2021-gsoc-llvm-gnumake]: proposal for building using llvm/gnumake

 

Hi,

 

I want to push my change to my codes to edk2-staging, yet it seems like I don’t have permission to do so:

 

My mentor and I have enabled edk2 building using llvm+make and gnumake+clang in windows command prompt. The attached patch indicates changes we made to make this happen.

 

I also attach the readme file to go through the steps to build Basetools.

 

Please review our codes and thank you very much for your time.

 

Best regards,

Yuqi

 



--
Pedro Falcato


Re: [Patch 2/2] BaseTools: a new build option for variable default value generation

Andrew Fish
 



On Aug 13, 2021, at 11:31 AM, Sean <spbrogan@...> wrote:

Bob,

Given this is a new feature that needs a lot of review and discussion can it get moved over to the edk2-basetools project. Since the Python Basetools RFC was accepted months ago and the CI system updated to use those artifacts (instead of the source), that is where Basetools/Source/Python should be enhanced going forward.


That sounds like a good plan. 



A few other comments.

There are some common types in python already supported (EfiTime, Variables, authenticated variables) here:


I think this brings up a point that we should have are more formal set of libraries for the BaseTools and some standard coding patterns If I was looking for EFI_TIME() or EfiTime() I don’t think authenticated_variables_structure_support.py would be high on my list of places to look. I’d also expect a public class for others to use to be well documented. 

https://github.com/tianocore/edk2-pytool-library/blob/5b2dbd7b315743caa626c1a4657c642d491ea8c3/edk2toollib/uefi/authenticated_variables_structure_support.py

https://github.com/tianocore/edk2-pytool-library/blob/5b2dbd7b315743caa626c1a4657c642d491ea8c3/edk2toollib/uefi/edk2/variable_format.py

I also don't understand the reason for all this in ctypes and basically writing c-code in python.  We have found that developing in native python and then at the point of binary serialization converting to/from a binary layout is a much better experience.


I’m biased as I’ve been writing C a lot longer than I’ve been writing Python but I find ctypes easier to deal with in a lot of situations than struct.pack()/struct.unpack(). I also find it easy to have bugs in the serialize/deserialize operations as they require a lot of manual work. It is not so bad for simple things, but gets to be a pain if you do something like write a PE/COFF parses (like I just did for the debugger scripts). Also we have a lot of existing C code, so often we are coding the Python while looking a C structs, and spec are written in a way that map very easily to C structs, or things are defined as C structs in the first place. 

For me it was a lot easier to just do:
class EFI_IMAGE_OPTIONAL_HEADER32(LittleEndianStructure):
    _fields_ = [
        ('Magic',                         c_uint16),
        ('MajorLinkerVersion',            c_uint8),
        ('MinorLinkerVersion',            c_uint8),
        ('SizeOfCode',                    c_uint32),
        ('SizeOfInitializedData',         c_uint32),
        ('SizeOfUninitializedData',       c_uint32),
        ('AddressOfEntryPoint',           c_uint32),
        ('BaseOfCode',                    c_uint32),
        ('BaseOfData',                    c_uint32),
        ('ImageBase',                     c_uint32),
        ('SectionAlignment',              c_uint32),
        ('FileAlignment',                 c_uint32),
        ('MajorOperatingSystemVersion',   c_uint16),
        ('MinorOperatingSystemVersion',   c_uint16),
        ('MajorImageVersion',             c_uint16),
        ('MinorImageVersion',             c_uint16),
        ('MajorSubsystemVersion',         c_uint16),
        ('MinorSubsystemVersion',         c_uint16),
        ('Win32VersionValue',             c_uint32),
        ('SizeOfImage',                   c_uint32),
        ('SizeOfHeaders',                 c_uint32),
        ('CheckSum',                      c_uint32),
        ('Subsystem',                     c_uint16),
        ('DllCharacteristics',            c_uint16),
        ('SizeOfStackReserve',            c_uint32),
        ('SizeOfStackCommit',             c_uint32),
        ('SizeOfHeapReserve',             c_uint32),
        ('SizeOfHeapCommit',              c_uint32),
        ('LoaderFlags',                   c_uint32),
        ('NumberOfRvaAndSizes',           c_uint32),
        ('DataDirectory',                 ARRAY(EFI_IMAGE_DATA_DIRECTORY, 16))
    ]


Vs. coding up. 

Class EfiImageOptionaHeader32(object):
    __init__():

    def PopulateFromFileStream(self, fs):
        # read()?

   def Write(self, fs):

   def Print(self):
       # not sure why this is not __str()__

It is a lot easier to do a quick check against the C EFI_IMAGE_OPTIONAL_HEADER32 struct than hand checking the 29 pack/unpack statements required for serialization/deserialization are correct. 

Side note: I don’t understand the naming pattern in these classes? Why not use more common Python names and patterns like read, write, __str__, to_byte, from_type, etc. 


Getting back to the big picture I agree there is a lot of value in building up a set of building blocks that can be shared, and they should live in BaseTools. I kind of realized this when I was writing my debugger agnostic Python classes. I’d also like to have some examples of tools not in BaseTools uses BaseTools to build other tools. I think a lot of platforms have their own custom build tools, and things can also be shared with debugging scripts etc. 

Thanks,

Andrew Fish

Thanks
Sean




On 8/13/2021 4:45 AM, Bob Feng wrote:
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3562
Create a new build option to enable vfrcompile to generate Json
format EFI variable information file and read it to generate
the EFI variable default value binary file.
Signed-off-by: Bob Feng <bob.c.feng@...>
Cc: Liming Gao <gaoliming@...>
Cc: Yuwei Chen <yuwei.chen@...>
---
 BaseTools/Source/Python/AutoGen/DataPipe.py   |   2 +
 .../Source/Python/AutoGen/GenDefaultVar.py    | 498 ++++++++++++++++++
 .../Source/Python/AutoGen/ModuleAutoGen.py    |   9 +
 .../Python/AutoGen/ModuleAutoGenHelper.py     |   4 +
 BaseTools/Source/Python/Common/GlobalData.py  |   5 +
 BaseTools/Source/Python/build/build.py        |  18 +
 BaseTools/Source/Python/build/buildoptions.py |   1 +
 7 files changed, 537 insertions(+)
 create mode 100644 BaseTools/Source/Python/AutoGen/GenDefaultVar.py
diff --git a/BaseTools/Source/Python/AutoGen/DataPipe.py b/BaseTools/Source/Python/AutoGen/DataPipe.py
index 86ac2b928d9c..fa0c36b98f21 100755
--- a/BaseTools/Source/Python/AutoGen/DataPipe.py
+++ b/BaseTools/Source/Python/AutoGen/DataPipe.py
@@ -165,5 +165,7 @@ class MemoryDataPipe(DataPipe):
         self.DataContainer = {"BinCacheSource":GlobalData.gBinCacheSource}
           self.DataContainer = {"BinCacheDest":GlobalData.gBinCacheDest}
           self.DataContainer = {"EnableGenfdsMultiThread":GlobalData.gEnableGenfdsMultiThread}
+
+        self.DataContainer = {"GenDefaultVarBin": GlobalData.gGenDefaultVarBin}
diff --git a/BaseTools/Source/Python/AutoGen/GenDefaultVar.py b/BaseTools/Source/Python/AutoGen/GenDefaultVar.py
new file mode 100644
index 000000000000..b82cce18ed26
--- /dev/null
+++ b/BaseTools/Source/Python/AutoGen/GenDefaultVar.py
@@ -0,0 +1,498 @@
+import json
+from ctypes import *
+import re
+import copy
+from struct import unpack
+import os
+
+class GUID(Structure):
+    _fields_ = [
+        ('Guid1',            c_uint32),
+        ('Guid2',            c_uint16),
+        ('Guid3',            c_uint16),
+        ('Guid4',            ARRAY(c_uint8, 8)),
+    ]
+
+    def from_list(self, listformat):
+        self.Guid1 = listformat[0]
+        self.Guid2 = listformat[1]
+        self.Guid3 = listformat[2]
+        for i in range(8):
+            self.Guid4[i] = listformat[i+3]
+
+    def __cmp__(self, otherguid):
+        if isinstance(otherguid, GUID):
+            return 1
+        rt = False
+        if self.Guid1 == otherguid.Guid1 and self.Guid2 == otherguid.Guid2 and self.Guid3 == otherguid.Guid3:
+            rt = True
+            for i in range(8):
+                rt = rt & (self.Guid4[i] == otherguid.Guid4[i])
+        return rt
+
+
+class TIME(Structure):
+    _fields_ = [
+        ('Year',             c_uint16),
+        ('Month',            c_uint8),
+        ('Day',              c_uint8),
+        ('Hour',             c_uint8),
+        ('Minute',           c_uint8),
+        ('Second',           c_uint8),
+        ('Pad1',             c_uint8),
+        ('Nanosecond',       c_uint32),
+        ('TimeZone',         c_uint16),
+        ('Daylight',         c_uint8),
+        ('Pad2',             c_uint8),
+    ]
+    def __init__(self):
+        self.Year = 0x0
+        self.Month = 0x0
+        self.Day = 0x0
+        self.Hour = 0x0
+        self.Minute = 0x0
+        self.Second = 0x0
+        self.Pad1 = 0x0
+        self.Nanosecond = 0x0
+        self.TimeZone = 0x0
+        self.Daylight = 0x0
+        self.Pad2 = 0x0
+
+
+EFI_VARIABLE_GUID = [0xddcf3616, 0x3275, 0x4164,
+                     0x98, 0xb6, 0xfe, 0x85, 0x70, 0x7f, 0xfe, 0x7d]
+EFI_AUTHENTICATED_VARIABLE_GUID = [
+    0xaaf32c78, 0x947b, 0x439a, 0xa1, 0x80, 0x2e, 0x14, 0x4e, 0xc3, 0x77, 0x92]
+
+AuthVarGuid = GUID()
+AuthVarGuid.from_list(EFI_AUTHENTICATED_VARIABLE_GUID)
+VarGuid = GUID()
+VarGuid.from_list(EFI_VARIABLE_GUID)
+
+# Variable Store Header Format.
+VARIABLE_STORE_FORMATTED = 0x5a
+# Variable Store Header State.
+VARIABLE_STORE_HEALTHY = 0xfe
+
+
+class VARIABLE_STORE_HEADER(Structure):
+    _fields_ = [
+        ('Signature',                GUID),
+        ('Size',                     c_uint32),
+        ('Format',                   c_uint8),
+        ('State',                    c_uint8),
+        ('Reserved',                 c_uint16),
+        ('Reserved1',                c_uint32),
+    ]
+
+
+# Variable data start flag.
+VARIABLE_DATA = 0x55AA
+
+# Variable State flags.
+VAR_IN_DELETED_TRANSITION = 0xfe
+VAR_DELETED = 0xfd
+VAR_HEADER_VALID_ONLY = 0x7f
+VAR_ADDED = 0x3f
+
+
+class VARIABLE_HEADER(Structure):
+    _fields_ = [
+        ('StartId',                  c_uint16),
+        ('State',                    c_uint8),
+        ('Reserved',                 c_uint8),
+        ('Attributes',               c_uint32),
+        ('NameSize',                 c_uint32),
+        ('DataSize',                 c_uint32),
+        ('VendorGuid',               GUID),
+    ]
+
+
+class AUTHENTICATED_VARIABLE_HEADER(Structure):
+    _fields_ = [
+        ('StartId',                  c_uint16),
+        ('State',                    c_uint8),
+        ('Reserved',                 c_uint8),
+        ('Attributes',               c_uint32),
+        ('MonotonicCount',           c_uint64),
+        ('TimeStamp',                TIME),
+        ('PubKeyIndex',              c_uint32),
+        ('NameSize',                 c_uint32),
+        ('DataSize',                 c_uint32),
+        ('VendorGuid',               GUID),
+    ]
+    _pack_ = 1
+
+
+# Alignment of Variable Data Header in Variable Store region.
+HEADER_ALIGNMENT = 4
+
+
+class DEFAULT_INFO(Structure):
+    _fields_ = [
+        ('DefaultId',                c_uint16),
+        ('BoardId',                  c_uint16),
+    ]
+
+
+class DEFAULT_DATA(Structure):
+    _fields_ = [
+        ('HeaderSize',               c_uint16),
+        ('DefaultInfo',              DEFAULT_INFO),
+    ]
+
+class DELTA_DATA(Structure):
+    _fields_ = [
+        ('Offset', c_uint16),
+        ('Value', c_uint8),
+    ]
+    _pack_ = 1
+
+array_re = re.compile(
+    "(?P<mType>[a-z_A-Z][a-z_A-Z0-9]*)\[(?P<mSize>[1-9][0-9]*)\]")
+
+
+class VarField():
+    def __init__(self):
+        self.Offset = 0
+        self.Value = 0
+        self.Size = 0
+
+    @property
+    def Type(self):
+        if self.Size == 1:
+            return "UINT8"
+        if self.Size == 2:
+            return "UINT16"
+        if self.Size == 4:
+            return "UINT32"
+        if self.Size == 8:
+            return "UINT64"
+
+        return "UINT8"
+
+
+BASIC_TYPE = {
+    "BOOLEAN": 1,
+    "UINT8": 1,
+    "UINT16": 2,
+    "UINT32": 4,
+    "UINT64": 8
+}
+class CStruct():
+
+
+    def __init__(self, typedefs):
+        self.TypeDefs = typedefs
+        self.TypeStack = copy.deepcopy(typedefs)
+        self.finalDefs = {}
+
+    def CalStuctSize(self, sType):
+        rt = 0
+        if sType in BASIC_TYPE:
+            return BASIC_TYPE[sType]
+
+        ma = array_re.match(sType)
+        if ma:
+            mType = ma.group('mType')
+            mSize = ma.group('mSize')
+            rt += int(mSize) * self.CalStuctSize(mType)
+        else:
+            for subType in self.TypeDefs[sType]:
+                rt += self.CalStuctSize(subType['Type'])
+
+        return rt
+
+    def expend(self, fielditem):
+        fieldname = fielditem['Name']
+        fieldType = fielditem['Type']
+        fieldOffset = fielditem['Offset']
+
+        ma = array_re.match(fieldType)
+        if ma:
+            mType = ma.group('mType')
+            mSize = ma.group('mSize')
+            return [{"Name": "%s[%d]" % (fieldname, i), "Type": mType, "Offset": (fieldOffset + i*self.CalStuctSize(mType))} for i in range(int(mSize))]
+        else:
+            return [{"Name": "%s.%s" % (fieldname, item['Name']), "Type":item['Type'], "Offset": (fieldOffset + item['Offset'])} for item in self.TypeDefs[fielditem['Type']]]
+
+    def ExpandTypes(self):
+        if not self.finalDefs:
+            for datatype in self.TypeStack:
+                result = []
+                mTypeStack = self.TypeStack[datatype]
+                while len(mTypeStack) > 0:
+                    item = mTypeStack.pop()
+                    if item['Type'] in self.BASIC_TYPE:
+                        result.append(item)
+                    elif item['Type'] == '(null)':
+                        continue
+                    else:
+                        for expand_item in self.expend(item):
+                            mTypeStack.append(expand_item)
+                self.finalDefs[datatype] = result
+            self.finalDefs
+        return self.finalDefs
+
+def Get_Occupied_Size(FileLength, alignment):
+    if FileLength % alignment == 0:
+        return FileLength
+    return FileLength + (alignment-(FileLength % alignment))
+
+def Occupied_Size(buffer, alignment):
+    FileLength = len(buffer)
+    if FileLength % alignment != 0:
+        buffer += b'\0' * (alignment-(FileLength % alignment))
+    return buffer
+
+def PackStruct(cStruct):
+    length = sizeof(cStruct)
+    p = cast(pointer(cStruct), POINTER(c_char * length))
+    return p.contents.raw
+
+def calculate_delta(default, theother):
+
+    if len(default) - len(theother) != 0:
+        return []
+
+    data_delta = []
+    for i in range(len(default)):
+        if default[i] != theother[i]:
+            data_delta.append([i, theother[i]])
+    return data_delta
+
+class Variable():
+    def __init__(self):
+        self.mAlign = 1
+        self.mTotalSize = 1
+        self.mValue = {}  # {defaultstore: value}
+        self.mBin = {}
+        self.fields = {}  # {defaultstore: fileds}
+        self.delta = {}
+        self.attributes = 0
+        self.mType = ''
+        self.guid = ''
+        self.mName = ''
+        self.cDefs = None
+
+    @property
+    def GuidArray(self):
+
+        guid_array = []
+        guid = self.guid.strip().strip("{").strip("}")
+        for item in guid.split(","):
+            field = item.strip().strip("{").strip("}")
+            guid_array.append(int(field,16))
+        return guid_array
+
+    def update_delta_offset(self,base):
+        for default_id in self.delta:
+            for delta_list in self.delta[default_id]:
+                delta_list[0] += base
+
+    def pack(self):
+
+        for defaultid in self.mValue:
+            var_value = self.mValue[defaultid]
+            auth_var = AUTHENTICATED_VARIABLE_HEADER()
+            auth_var.StartId = VARIABLE_DATA
+            auth_var.State = VAR_ADDED
+            auth_var.Reserved = 0x00
+            auth_var.Attributes = 0x00000007
+            auth_var.MonotonicCount = 0x0
+            auth_var.TimeStamp = TIME()
+            auth_var.PubKeyIndex = 0x0
+            var_name_buffer = self.mName.encode('utf-16le') + b'\0\0'
+            auth_var.NameSize = len(var_name_buffer)
+            auth_var.DataSize = len(var_value)
+            vendor_guid = GUID()
+            vendor_guid.from_list(self.GuidArray)
+            auth_var.VendorGuid = vendor_guid
+
+            self.mBin[defaultid] = PackStruct(auth_var) + Occupied_Size(var_name_buffer + var_value, 4)
+
+    def TypeCheck(self,data_type, data_size):
+        if BASIC_TYPE[data_type] == data_size:
+            return True
+        return False
+
+    def ValueToBytes(self,data_type,data_value,data_size):
+
+        rt = b''
+        if not self.TypeCheck(data_type, data_size):
+            print(data_type,data_value,data_size)
+
+        if data_type == "BOOLEAN" or data_type == 'UINT8':
+            p = cast(pointer(c_uint8(int(data_value,16))), POINTER(c_char * 1))
+            rt = p.contents.raw
+        elif data_type == 'UINT16':
+            p = cast(pointer(c_uint16(int(data_value,16))), POINTER(c_char * 2))
+            rt = p.contents.raw
+        elif data_type == 'UINT32':
+            p = cast(pointer(c_uint32(int(data_value,16))), POINTER(c_char * 4))
+            rt = p.contents.raw
+        elif data_type == 'UINT64':
+            p = cast(pointer(c_uint64(int(data_value,16))), POINTER(c_char * 8))
+            rt = p.contents.raw
+
+        return rt
+
+    def serial(self):
+        for defaultstore in self.fields:
+            vValue = b''
+            vfields = {vf.Offset: vf for vf in self.fields[defaultstore]}
+            i = 0
+            while i < self.mTotalSize:
+                if i in vfields:
+                    vfield = vfields[i]
+                    vValue += self.ValueToBytes(vfield.Type, vfield.Value,vfield.Size)
+                    i += vfield.Size
+                else:
+                    vValue += self.ValueToBytes('UINT8','0x00',1)
+                    i += 1
+
+            self.mValue[defaultstore] = vValue
+        standard_default = self.mValue[0]
+
+        for defaultid in self.mValue:
+            if defaultid == 0:
+                continue
+            others_default = self.mValue[defaultid]
+
+            self.delta.setdefault(defaultid, []).extend(calculate_delta(
+                standard_default, others_default))
+
+class DefaultVariableGenerator():
+    def __init__(self):
+        self.NvVarInfo = []
+
+    def LoadNvVariableInfo(self, VarInfoFilelist):
+
+        VarDataDict = {}
+        DataStruct = {}
+        VarDefine = {}
+        VarAttributes = {}
+        for VarInfoFile in VarInfoFilelist:
+            with open(VarInfoFile.strip(), "r") as fd:
+                data = json.load(fd)
+
+            DataStruct.update(data.get("DataStruct", {}))
+            Data = data.get("Data")
+            VarDefine.update(data.get("VarDefine"))
+            VarAttributes.update(data.get("DataStructAttribute"))
+
+            for vardata in Data:
+                if vardata['VendorGuid'] == 'NA':
+                    continue
+                VarDataDict.setdefault(
+                    (vardata['VendorGuid'], vardata["VarName"]), []).append(vardata)
+
+        cStructDefs = CStruct(DataStruct)
+        for guid, varname in VarDataDict:
+            v = Variable()
+            v.guid = guid
+            vardef = VarDefine.get(varname)
+            if vardef is None:
+                for var in VarDefine:
+                    if VarDefine[var]['Type'] == varname:
+                        vardef = VarDefine[var]
+                        break
+                else:
+                    continue
+            v.attributes = vardef['Attributes']
+            v.mType = vardef['Type']
+            v.mAlign = VarAttributes[v.mType]['Alignment']
+            v.mTotalSize = VarAttributes[v.mType]['TotalSize']
+            v.Struct = DataStruct[v.mType]
+            v.mName = varname
+            v.cDefs = cStructDefs
+            for fieldinfo in VarDataDict.get((guid, varname), []):
+                vf = VarField()
+                vf.Offset = fieldinfo['Offset']
+                vf.Value = fieldinfo['Value']
+                vf.Size = fieldinfo['Size']
+                v.fields.setdefault(
+                    int(fieldinfo['DefaultStore'], 10), []).append(vf)
+            v.serial()
+            v.pack()
+            self.NvVarInfo.append(v)
+
+    def PackDeltaData(self):
+
+        default_id_set = set()
+        for v in self.NvVarInfo:
+            default_id_set |= set(v.mBin.keys())
+
+        if default_id_set:
+            default_id_set.remove(0)
+        delta_buff_set = {}
+        for defaultid in default_id_set:
+            delta_buff = b''
+            for v in self.NvVarInfo:
+                delta_list = v.delta.get(defaultid,[])
+                for delta in delta_list:
+                    delta_data = DELTA_DATA()
+                    delta_data.Offset, delta_data.Value = delta
+                    delta_buff += PackStruct(delta_data)
+            delta_buff_set[defaultid] = delta_buff
+
+        return delta_buff_set
+
+    def PackDefaultData(self):
+
+        default_data_header = DEFAULT_DATA()
+        default_data_header.HeaderSize = sizeof(DEFAULT_DATA)
+        default_data_header.DefaultInfo.DefaultId = 0x0
+        default_data_header.DefaultInfo.BoardId = 0x0
+        default_data_header_buffer = PackStruct(default_data_header)
+
+
+        variable_store = VARIABLE_STORE_HEADER()
+        variable_store.Signature = AuthVarGuid
+
+        variable_store_size = Get_Occupied_Size(sizeof(DEFAULT_DATA) + sizeof(VARIABLE_STORE_HEADER), 4)
+        for v in self.NvVarInfo:
+            variable_store_size += Get_Occupied_Size(len(v.mBin[0]), 4)
+
+        variable_store.Size = variable_store_size
+        variable_store.Format = VARIABLE_STORE_FORMATTED
+        variable_store.State = VARIABLE_STORE_HEALTHY
+        variable_store.Reserved = 0x0
+        variable_store.Reserved2 = 0x0
+
+        variable_storage_header_buffer = PackStruct(variable_store)
+
+        variable_data = b''
+        v_offset = 0
+        for v in self.NvVarInfo:
+            v.update_delta_offset(v_offset)
+            variable_data += Occupied_Size(v.mBin[0],4)
+            v_offset += Get_Occupied_Size(len(v.mBin[0]),4)
+
+
+        final_buff = Occupied_Size(default_data_header_buffer + variable_storage_header_buffer,4) + variable_data
+
+        return final_buff
+
+    def generate(self, jsonlistfile,output_folder):
+        if not os.path.exists(jsonlistfile):
+            return
+        if not os.path.exists(output_folder):
+            os.makedirs(output_folder)
+        try:
+            with open(jsonlistfile,"r") as fd:
+                filelist = fd.readlines()
+            genVar = DefaultVariableGenerator()
+            genVar.LoadNvVariableInfo(filelist)
+            with open(os.path.join(output_folder, "default.bin"), "wb") as fd:
+                fd.write(genVar.PackDefaultData())
+
+            delta_set = genVar.PackDeltaData()
+            for default_id in delta_set:
+                with open(os.path.join(output_folder, "defaultdelta_%s.bin" % default_id), "wb") as fd:
+                    fd.write(delta_set[default_id])
+        except:
+            print("generate varbin file failed")
+
+
+
diff --git a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
index d70b0d7ae828..0daf3352f91b 100755
--- a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
@@ -433,10 +433,19 @@ class ModuleAutoGen(AutoGen):
     ## Return the directory to store auto-gened source files of the module
     @cached_property
     def DebugDir(self):
         return _MakeDir((self.BuildDir, "DEBUG"))
 +
+    @cached_property
+    def DefaultVarJsonFiles(self):
+        rt = []
+        for SrcFile in self.SourceFileList:
+            if SrcFile.Ext.lower() == '.vfr':
+                rt.append(os.path.join(self.DebugDir,os.path.join(os.path.dirname(SrcFile.File), "{}_var.json".format(SrcFile.BaseName))))
+        return rt
+
     ## Return the path of custom file
     @cached_property
     def CustomMakefile(self):
         RetVal = {}
         for Type in self.Module.CustomMakefile:
diff --git a/BaseTools/Source/Python/AutoGen/ModuleAutoGenHelper.py b/BaseTools/Source/Python/AutoGen/ModuleAutoGenHelper.py
index 036fdac3d7df..b46d041f58ab 100644
--- a/BaseTools/Source/Python/AutoGen/ModuleAutoGenHelper.py
+++ b/BaseTools/Source/Python/AutoGen/ModuleAutoGenHelper.py
@@ -644,10 +644,14 @@ class PlatformInfo(AutoGenInfo):
                             if Attr != 'PATH':
                                 BuildOptions[ExpandedTool][Attr] += " " + mws.handleWsMacro(Value)
                             else:
                                 BuildOptions[ExpandedTool][Attr] = mws.handleWsMacro(Value)
 +        if self.DataPipe.Get("GenDefaultVarBin"):
+            if BuildOptions.get('VFR',{}).get('FLAGS'):
+                BuildOptions['VFR']['FLAGS'] += " " + "--variable"
+
         return BuildOptions, BuildRuleOrder
       def ApplyLibraryInstance(self,module):
         alldeps = self.DataPipe.Get("DEPS")
         if alldeps is None:
diff --git a/BaseTools/Source/Python/Common/GlobalData.py b/BaseTools/Source/Python/Common/GlobalData.py
index 61ab3f7e24cd..c68ca8fbb3f7 100755
--- a/BaseTools/Source/Python/Common/GlobalData.py
+++ b/BaseTools/Source/Python/Common/GlobalData.py
@@ -88,10 +88,15 @@ gIgnoreSource = False
 #
 gFdfParser = None
   BuildOptionPcd = []
 +#
+# Build flag for generate default variable binary file
+#
+gGenDefaultVarBin = False
+
 #
 # Mixed PCD name dict
 #
 MixedPcd = {}
 diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/build/build.py
index 02b489892422..2f6fc6b20faf 100755
--- a/BaseTools/Source/Python/build/build.py
+++ b/BaseTools/Source/Python/build/build.py
@@ -750,10 +750,11 @@ class Build():
         GlobalData.gUseHashCache = BuildOptions.UseHashCache
         GlobalData.gBinCacheDest   = BuildOptions.BinCacheDest
         GlobalData.gBinCacheSource = BuildOptions.BinCacheSource
         GlobalData.gEnableGenfdsMultiThread = not BuildOptions.NoGenfdsMultiThread
         GlobalData.gDisableIncludePathCheck = BuildOptions.DisableIncludePathCheck
+        GlobalData.gGenDefaultVarBin = BuildOptions.GenDefaultVarBin
           if GlobalData.gBinCacheDest and not GlobalData.gUseHashCache:
             EdkLogger.error("build", OPTION_NOT_SUPPORTED, ExtraData="--binary-destination must be used together with --hash.")
           if GlobalData.gBinCacheSource and not GlobalData.gUseHashCache:
@@ -1459,10 +1460,14 @@ class Build():
             self.BuildModules = []
             return True
           # genfds
         if Target == 'fds':
+            if GlobalData.gGenDefaultVarBin:
+                from AutoGen.GenDefaultVar import DefaultVariableGenerator
+                variable_info_filelist = os.path.join(AutoGenObject.BuildDir,"variable_info_filelist.txt")
+                DefaultVariableGenerator().generate(variable_info_filelist,AutoGenObject.FvDir)
             if GenFdsApi(AutoGenObject.GenFdsCommandDict, self.Db):
                 EdkLogger.error("build", COMMAND_FAILURE)
             Threshold = self.GetFreeSizeThreshold()
             if Threshold:
                 self.CheckFreeSizeThreshold(Threshold, AutoGenObject.FvDir)
@@ -2247,10 +2252,19 @@ class Build():
         AutoGenIdFile = os.path.join(GlobalData.gConfDirectory,".AutoGenIdFile.txt")
         with open(AutoGenIdFile,"w") as fw:
             fw.write("Arch=%s\n" % "|".join((Wa.ArchList)))
             fw.write("BuildDir=%s\n" % Wa.BuildDir)
             fw.write("PlatformGuid=%s\n" % str(Wa.AutoGenObjectList[0].Guid))
+        variable_info_filelist = os.path.join(Wa.BuildDir,"variable_info_filelist.txt")
+        vfr_var_json = []
+        if GlobalData.gGenDefaultVarBin:
+            for ma in self.AllModules:
+                vfr_var_json.extend(ma.DefaultVarJsonFiles)
+            SaveFileOnChange(variable_info_filelist, "\n".join(vfr_var_json), False)
+        else:
+            if os.path.exists(variable_info_filelist):
+                os.remove(variable_info_filelist)
           if GlobalData.gBinCacheSource:
             BuildModules.extend(self.MakeCacheMiss)
         elif GlobalData.gUseHashCache and not GlobalData.gBinCacheDest:
             BuildModules.extend(self.PreMakeCacheMiss)
@@ -2359,10 +2373,14 @@ class Build():
                       if self.Fdf:
                         #
                         # Generate FD image if there's a FDF file found
                         #
+                        if GlobalData.gGenDefaultVarBin:
+                            from AutoGen.GenDefaultVar import DefaultVariableGenerator
+                            variable_info_filelist = os.path.join(Wa.BuildDir,"variable_info_filelist.txt")
+                            DefaultVariableGenerator().generate(variable_info_filelist,Wa.FvDir)
                         GenFdsStart = time.time()
                         if GenFdsApi(Wa.GenFdsCommandDict, self.Db):
                             EdkLogger.error("build", COMMAND_FAILURE)
                         Threshold = self.GetFreeSizeThreshold()
                         if Threshold:
diff --git a/BaseTools/Source/Python/build/buildoptions.py b/BaseTools/Source/Python/build/buildoptions.py
index 39d92cff209d..6886ba7f8eb6 100644
--- a/BaseTools/Source/Python/build/buildoptions.py
+++ b/BaseTools/Source/Python/build/buildoptions.py
@@ -99,7 +99,8 @@ class MyOptionParser():
         Parser.add_option("--hash", action="store_true", dest="UseHashCache", default=False, help="Enable hash-based caching during build process.")
         Parser.add_option("--binary-destination", action="store", type="string", dest="BinCacheDest", help="Generate a cache of binary files in the specified directory.")
         Parser.add_option("--binary-source", action="store", type="string", dest="BinCacheSource", help="Consume a cache of binary files from the specified directory.")
         Parser.add_option("--genfds-multi-thread", action="store_true", dest="GenfdsMultiThread", default=True, help="Enable GenFds multi thread to generate ffs file.")
         Parser.add_option("--no-genfds-multi-thread", action="store_true", dest="NoGenfdsMultiThread", default=False, help="Disable GenFds multi thread to generate ffs file.")
+        Parser.add_option("--gen-default-variable-bin", action="store_true", dest="GenDefaultVarBin", default=False, help="Generate default variable binary file.")
         Parser.add_option("--disable-include-path-check", action="store_true", dest="DisableIncludePathCheck", default=False, help="Disable the include path check for outside of package.")
         self.BuildOption, self.BuildTarget = Parser.parse_args()




Re: [PATCH v4 1/6] OvmfPkg/TPM: Import PeiDxeTpmPlatformHierarchyLib.c from edk2-platforms

Stefan Berger
 

On 8/13/21 2:47 PM, Sean Brogan wrote:
Thanks for the link as i missed that message.

To me this just points out more problems with how OVMF is being managed in the edk2 project and the uselessness of edk2 platforms as anything more than just a dumping ground repo to hold sample code.  But that is a problem larger than this patchset.

I guess if you are going doing option 2 can we rename the library interface you are defining in OvmfPkg so it doesn't conflict with the existing one in edk2-platforms/minplatform.  That would mean change:

I have now created v5 here with the latest code appearing in SecurityPkg again: https://github.com/stefanberger/edk2/commits/stefanberger/ovmf_disable_platform_hierarchy.v5

I can probably post that pretty quickly but I'll be out for a while. If it's urgent, someone else can pick it it up from there. I tested it on QEMU for x86 and aarch64 and test-compiled on various platforms that I touched (some didn't compile for me before the changes).

What I wasn't sure about is whether edk2-platforms is a 'holding area' for code to be imported ideally 1:1 into edk2. So I ended up making those changes already in v1 to cut out a dependency. If what I have in v5 (or also v4) is sufficient for general consumption, then let's put it into SecurityPkg.


   Stefan



* name in OvmfPkg.dec file
* header file in OvmfPkg/Include/Library
* all references in DSC file for mapping an instance
* all references in your INFs for dependency

Thanks
Sean






On 8/12/2021 3:19 PM, Stefan Berger wrote:

On 8/12/21 4:59 PM, Sean Brogan wrote:
This seems like a bad place for a general purpose lib that many other platforms may take a dependency on.

In v1 this was SecurityPkg.  OvmfPkg is a platform package and therefore not a good place to define broad interfaces.

What caused this to move here?

Option 2 from this message: https://listman.redhat.com/archives/edk2-devel-archive/2021-August/msg00398.html

   Stefan



Thanks
Sean


Re: [PATCH v4 1/6] OvmfPkg/TPM: Import PeiDxeTpmPlatformHierarchyLib.c from edk2-platforms

Sean
 

Thanks for the link as i missed that message.

To me this just points out more problems with how OVMF is being managed in the edk2 project and the uselessness of edk2 platforms as anything more than just a dumping ground repo to hold sample code. But that is a problem larger than this patchset.

I guess if you are going doing option 2 can we rename the library interface you are defining in OvmfPkg so it doesn't conflict with the existing one in edk2-platforms/minplatform. That would mean change:

* name in OvmfPkg.dec file
* header file in OvmfPkg/Include/Library
* all references in DSC file for mapping an instance
* all references in your INFs for dependency

Thanks
Sean

On 8/12/2021 3:19 PM, Stefan Berger wrote:
On 8/12/21 4:59 PM, Sean Brogan wrote:
This seems like a bad place for a general purpose lib that many other platforms may take a dependency on.

In v1 this was SecurityPkg.  OvmfPkg is a platform package and therefore not a good place to define broad interfaces.

What caused this to move here?
Option 2 from this message: https://listman.redhat.com/archives/edk2-devel-archive/2021-August/msg00398.html   Stefan


Thanks
Sean


Re: [Patch 2/2] BaseTools: a new build option for variable default value generation

Sean
 

Bob,

Given this is a new feature that needs a lot of review and discussion can it get moved over to the edk2-basetools project. Since the Python Basetools RFC was accepted months ago and the CI system updated to use those artifacts (instead of the source), that is where Basetools/Source/Python should be enhanced going forward.



A few other comments.

There are some common types in python already supported (EfiTime, Variables, authenticated variables) here:

https://github.com/tianocore/edk2-pytool-library/blob/5b2dbd7b315743caa626c1a4657c642d491ea8c3/edk2toollib/uefi/authenticated_variables_structure_support.py

https://github.com/tianocore/edk2-pytool-library/blob/5b2dbd7b315743caa626c1a4657c642d491ea8c3/edk2toollib/uefi/edk2/variable_format.py

I also don't understand the reason for all this in ctypes and basically writing c-code in python. We have found that developing in native python and then at the point of binary serialization converting to/from a binary layout is a much better experience.

Thanks
Sean

On 8/13/2021 4:45 AM, Bob Feng wrote:
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3562
Create a new build option to enable vfrcompile to generate Json
format EFI variable information file and read it to generate
the EFI variable default value binary file.
Signed-off-by: Bob Feng <bob.c.feng@...>
Cc: Liming Gao <gaoliming@...>
Cc: Yuwei Chen <yuwei.chen@...>
---
BaseTools/Source/Python/AutoGen/DataPipe.py | 2 +
.../Source/Python/AutoGen/GenDefaultVar.py | 498 ++++++++++++++++++
.../Source/Python/AutoGen/ModuleAutoGen.py | 9 +
.../Python/AutoGen/ModuleAutoGenHelper.py | 4 +
BaseTools/Source/Python/Common/GlobalData.py | 5 +
BaseTools/Source/Python/build/build.py | 18 +
BaseTools/Source/Python/build/buildoptions.py | 1 +
7 files changed, 537 insertions(+)
create mode 100644 BaseTools/Source/Python/AutoGen/GenDefaultVar.py
diff --git a/BaseTools/Source/Python/AutoGen/DataPipe.py b/BaseTools/Source/Python/AutoGen/DataPipe.py
index 86ac2b928d9c..fa0c36b98f21 100755
--- a/BaseTools/Source/Python/AutoGen/DataPipe.py
+++ b/BaseTools/Source/Python/AutoGen/DataPipe.py
@@ -165,5 +165,7 @@ class MemoryDataPipe(DataPipe):
self.DataContainer = {"BinCacheSource":GlobalData.gBinCacheSource}
self.DataContainer = {"BinCacheDest":GlobalData.gBinCacheDest}
self.DataContainer = {"EnableGenfdsMultiThread":GlobalData.gEnableGenfdsMultiThread}
+
+ self.DataContainer = {"GenDefaultVarBin": GlobalData.gGenDefaultVarBin}
diff --git a/BaseTools/Source/Python/AutoGen/GenDefaultVar.py b/BaseTools/Source/Python/AutoGen/GenDefaultVar.py
new file mode 100644
index 000000000000..b82cce18ed26
--- /dev/null
+++ b/BaseTools/Source/Python/AutoGen/GenDefaultVar.py
@@ -0,0 +1,498 @@
+import json
+from ctypes import *
+import re
+import copy
+from struct import unpack
+import os
+
+class GUID(Structure):
+ _fields_ = [
+ ('Guid1', c_uint32),
+ ('Guid2', c_uint16),
+ ('Guid3', c_uint16),
+ ('Guid4', ARRAY(c_uint8, 8)),
+ ]
+
+ def from_list(self, listformat):
+ self.Guid1 = listformat[0]
+ self.Guid2 = listformat[1]
+ self.Guid3 = listformat[2]
+ for i in range(8):
+ self.Guid4[i] = listformat[i+3]
+
+ def __cmp__(self, otherguid):
+ if isinstance(otherguid, GUID):
+ return 1
+ rt = False
+ if self.Guid1 == otherguid.Guid1 and self.Guid2 == otherguid.Guid2 and self.Guid3 == otherguid.Guid3:
+ rt = True
+ for i in range(8):
+ rt = rt & (self.Guid4[i] == otherguid.Guid4[i])
+ return rt
+
+
+class TIME(Structure):
+ _fields_ = [
+ ('Year', c_uint16),
+ ('Month', c_uint8),
+ ('Day', c_uint8),
+ ('Hour', c_uint8),
+ ('Minute', c_uint8),
+ ('Second', c_uint8),
+ ('Pad1', c_uint8),
+ ('Nanosecond', c_uint32),
+ ('TimeZone', c_uint16),
+ ('Daylight', c_uint8),
+ ('Pad2', c_uint8),
+ ]
+ def __init__(self):
+ self.Year = 0x0
+ self.Month = 0x0
+ self.Day = 0x0
+ self.Hour = 0x0
+ self.Minute = 0x0
+ self.Second = 0x0
+ self.Pad1 = 0x0
+ self.Nanosecond = 0x0
+ self.TimeZone = 0x0
+ self.Daylight = 0x0
+ self.Pad2 = 0x0
+
+
+EFI_VARIABLE_GUID = [0xddcf3616, 0x3275, 0x4164,
+ 0x98, 0xb6, 0xfe, 0x85, 0x70, 0x7f, 0xfe, 0x7d]
+EFI_AUTHENTICATED_VARIABLE_GUID = [
+ 0xaaf32c78, 0x947b, 0x439a, 0xa1, 0x80, 0x2e, 0x14, 0x4e, 0xc3, 0x77, 0x92]
+
+AuthVarGuid = GUID()
+AuthVarGuid.from_list(EFI_AUTHENTICATED_VARIABLE_GUID)
+VarGuid = GUID()
+VarGuid.from_list(EFI_VARIABLE_GUID)
+
+# Variable Store Header Format.
+VARIABLE_STORE_FORMATTED = 0x5a
+# Variable Store Header State.
+VARIABLE_STORE_HEALTHY = 0xfe
+
+
+class VARIABLE_STORE_HEADER(Structure):
+ _fields_ = [
+ ('Signature', GUID),
+ ('Size', c_uint32),
+ ('Format', c_uint8),
+ ('State', c_uint8),
+ ('Reserved', c_uint16),
+ ('Reserved1', c_uint32),
+ ]
+
+
+# Variable data start flag.
+VARIABLE_DATA = 0x55AA
+
+# Variable State flags.
+VAR_IN_DELETED_TRANSITION = 0xfe
+VAR_DELETED = 0xfd
+VAR_HEADER_VALID_ONLY = 0x7f
+VAR_ADDED = 0x3f
+
+
+class VARIABLE_HEADER(Structure):
+ _fields_ = [
+ ('StartId', c_uint16),
+ ('State', c_uint8),
+ ('Reserved', c_uint8),
+ ('Attributes', c_uint32),
+ ('NameSize', c_uint32),
+ ('DataSize', c_uint32),
+ ('VendorGuid', GUID),
+ ]
+
+
+class AUTHENTICATED_VARIABLE_HEADER(Structure):
+ _fields_ = [
+ ('StartId', c_uint16),
+ ('State', c_uint8),
+ ('Reserved', c_uint8),
+ ('Attributes', c_uint32),
+ ('MonotonicCount', c_uint64),
+ ('TimeStamp', TIME),
+ ('PubKeyIndex', c_uint32),
+ ('NameSize', c_uint32),
+ ('DataSize', c_uint32),
+ ('VendorGuid', GUID),
+ ]
+ _pack_ = 1
+
+
+# Alignment of Variable Data Header in Variable Store region.
+HEADER_ALIGNMENT = 4
+
+
+class DEFAULT_INFO(Structure):
+ _fields_ = [
+ ('DefaultId', c_uint16),
+ ('BoardId', c_uint16),
+ ]
+
+
+class DEFAULT_DATA(Structure):
+ _fields_ = [
+ ('HeaderSize', c_uint16),
+ ('DefaultInfo', DEFAULT_INFO),
+ ]
+
+class DELTA_DATA(Structure):
+ _fields_ = [
+ ('Offset', c_uint16),
+ ('Value', c_uint8),
+ ]
+ _pack_ = 1
+
+array_re = re.compile(
+ "(?P<mType>[a-z_A-Z][a-z_A-Z0-9]*)\[(?P<mSize>[1-9][0-9]*)\]")
+
+
+class VarField():
+ def __init__(self):
+ self.Offset = 0
+ self.Value = 0
+ self.Size = 0
+
+ @property
+ def Type(self):
+ if self.Size == 1:
+ return "UINT8"
+ if self.Size == 2:
+ return "UINT16"
+ if self.Size == 4:
+ return "UINT32"
+ if self.Size == 8:
+ return "UINT64"
+
+ return "UINT8"
+
+
+BASIC_TYPE = {
+ "BOOLEAN": 1,
+ "UINT8": 1,
+ "UINT16": 2,
+ "UINT32": 4,
+ "UINT64": 8
+}
+class CStruct():
+
+
+ def __init__(self, typedefs):
+ self.TypeDefs = typedefs
+ self.TypeStack = copy.deepcopy(typedefs)
+ self.finalDefs = {}
+
+ def CalStuctSize(self, sType):
+ rt = 0
+ if sType in BASIC_TYPE:
+ return BASIC_TYPE[sType]
+
+ ma = array_re.match(sType)
+ if ma:
+ mType = ma.group('mType')
+ mSize = ma.group('mSize')
+ rt += int(mSize) * self.CalStuctSize(mType)
+ else:
+ for subType in self.TypeDefs[sType]:
+ rt += self.CalStuctSize(subType['Type'])
+
+ return rt
+
+ def expend(self, fielditem):
+ fieldname = fielditem['Name']
+ fieldType = fielditem['Type']
+ fieldOffset = fielditem['Offset']
+
+ ma = array_re.match(fieldType)
+ if ma:
+ mType = ma.group('mType')
+ mSize = ma.group('mSize')
+ return [{"Name": "%s[%d]" % (fieldname, i), "Type": mType, "Offset": (fieldOffset + i*self.CalStuctSize(mType))} for i in range(int(mSize))]
+ else:
+ return [{"Name": "%s.%s" % (fieldname, item['Name']), "Type":item['Type'], "Offset": (fieldOffset + item['Offset'])} for item in self.TypeDefs[fielditem['Type']]]
+
+ def ExpandTypes(self):
+ if not self.finalDefs:
+ for datatype in self.TypeStack:
+ result = []
+ mTypeStack = self.TypeStack[datatype]
+ while len(mTypeStack) > 0:
+ item = mTypeStack.pop()
+ if item['Type'] in self.BASIC_TYPE:
+ result.append(item)
+ elif item['Type'] == '(null)':
+ continue
+ else:
+ for expand_item in self.expend(item):
+ mTypeStack.append(expand_item)
+ self.finalDefs[datatype] = result
+ self.finalDefs
+ return self.finalDefs
+
+def Get_Occupied_Size(FileLength, alignment):
+ if FileLength % alignment == 0:
+ return FileLength
+ return FileLength + (alignment-(FileLength % alignment))
+
+def Occupied_Size(buffer, alignment):
+ FileLength = len(buffer)
+ if FileLength % alignment != 0:
+ buffer += b'\0' * (alignment-(FileLength % alignment))
+ return buffer
+
+def PackStruct(cStruct):
+ length = sizeof(cStruct)
+ p = cast(pointer(cStruct), POINTER(c_char * length))
+ return p.contents.raw
+
+def calculate_delta(default, theother):
+
+ if len(default) - len(theother) != 0:
+ return []
+
+ data_delta = []
+ for i in range(len(default)):
+ if default[i] != theother[i]:
+ data_delta.append([i, theother[i]])
+ return data_delta
+
+class Variable():
+ def __init__(self):
+ self.mAlign = 1
+ self.mTotalSize = 1
+ self.mValue = {} # {defaultstore: value}
+ self.mBin = {}
+ self.fields = {} # {defaultstore: fileds}
+ self.delta = {}
+ self.attributes = 0
+ self.mType = ''
+ self.guid = ''
+ self.mName = ''
+ self.cDefs = None
+
+ @property
+ def GuidArray(self):
+
+ guid_array = []
+ guid = self.guid.strip().strip("{").strip("}")
+ for item in guid.split(","):
+ field = item.strip().strip("{").strip("}")
+ guid_array.append(int(field,16))
+ return guid_array
+
+ def update_delta_offset(self,base):
+ for default_id in self.delta:
+ for delta_list in self.delta[default_id]:
+ delta_list[0] += base
+
+ def pack(self):
+
+ for defaultid in self.mValue:
+ var_value = self.mValue[defaultid]
+ auth_var = AUTHENTICATED_VARIABLE_HEADER()
+ auth_var.StartId = VARIABLE_DATA
+ auth_var.State = VAR_ADDED
+ auth_var.Reserved = 0x00
+ auth_var.Attributes = 0x00000007
+ auth_var.MonotonicCount = 0x0
+ auth_var.TimeStamp = TIME()
+ auth_var.PubKeyIndex = 0x0
+ var_name_buffer = self.mName.encode('utf-16le') + b'\0\0'
+ auth_var.NameSize = len(var_name_buffer)
+ auth_var.DataSize = len(var_value)
+ vendor_guid = GUID()
+ vendor_guid.from_list(self.GuidArray)
+ auth_var.VendorGuid = vendor_guid
+
+ self.mBin[defaultid] = PackStruct(auth_var) + Occupied_Size(var_name_buffer + var_value, 4)
+
+ def TypeCheck(self,data_type, data_size):
+ if BASIC_TYPE[data_type] == data_size:
+ return True
+ return False
+
+ def ValueToBytes(self,data_type,data_value,data_size):
+
+ rt = b''
+ if not self.TypeCheck(data_type, data_size):
+ print(data_type,data_value,data_size)
+
+ if data_type == "BOOLEAN" or data_type == 'UINT8':
+ p = cast(pointer(c_uint8(int(data_value,16))), POINTER(c_char * 1))
+ rt = p.contents.raw
+ elif data_type == 'UINT16':
+ p = cast(pointer(c_uint16(int(data_value,16))), POINTER(c_char * 2))
+ rt = p.contents.raw
+ elif data_type == 'UINT32':
+ p = cast(pointer(c_uint32(int(data_value,16))), POINTER(c_char * 4))
+ rt = p.contents.raw
+ elif data_type == 'UINT64':
+ p = cast(pointer(c_uint64(int(data_value,16))), POINTER(c_char * 8))
+ rt = p.contents.raw
+
+ return rt
+
+ def serial(self):
+ for defaultstore in self.fields:
+ vValue = b''
+ vfields = {vf.Offset: vf for vf in self.fields[defaultstore]}
+ i = 0
+ while i < self.mTotalSize:
+ if i in vfields:
+ vfield = vfields[i]
+ vValue += self.ValueToBytes(vfield.Type, vfield.Value,vfield.Size)
+ i += vfield.Size
+ else:
+ vValue += self.ValueToBytes('UINT8','0x00',1)
+ i += 1
+
+ self.mValue[defaultstore] = vValue
+ standard_default = self.mValue[0]
+
+ for defaultid in self.mValue:
+ if defaultid == 0:
+ continue
+ others_default = self.mValue[defaultid]
+
+ self.delta.setdefault(defaultid, []).extend(calculate_delta(
+ standard_default, others_default))
+
+class DefaultVariableGenerator():
+ def __init__(self):
+ self.NvVarInfo = []
+
+ def LoadNvVariableInfo(self, VarInfoFilelist):
+
+ VarDataDict = {}
+ DataStruct = {}
+ VarDefine = {}
+ VarAttributes = {}
+ for VarInfoFile in VarInfoFilelist:
+ with open(VarInfoFile.strip(), "r") as fd:
+ data = json.load(fd)
+
+ DataStruct.update(data.get("DataStruct", {}))
+ Data = data.get("Data")
+ VarDefine.update(data.get("VarDefine"))
+ VarAttributes.update(data.get("DataStructAttribute"))
+
+ for vardata in Data:
+ if vardata['VendorGuid'] == 'NA':
+ continue
+ VarDataDict.setdefault(
+ (vardata['VendorGuid'], vardata["VarName"]), []).append(vardata)
+
+ cStructDefs = CStruct(DataStruct)
+ for guid, varname in VarDataDict:
+ v = Variable()
+ v.guid = guid
+ vardef = VarDefine.get(varname)
+ if vardef is None:
+ for var in VarDefine:
+ if VarDefine[var]['Type'] == varname:
+ vardef = VarDefine[var]
+ break
+ else:
+ continue
+ v.attributes = vardef['Attributes']
+ v.mType = vardef['Type']
+ v.mAlign = VarAttributes[v.mType]['Alignment']
+ v.mTotalSize = VarAttributes[v.mType]['TotalSize']
+ v.Struct = DataStruct[v.mType]
+ v.mName = varname
+ v.cDefs = cStructDefs
+ for fieldinfo in VarDataDict.get((guid, varname), []):
+ vf = VarField()
+ vf.Offset = fieldinfo['Offset']
+ vf.Value = fieldinfo['Value']
+ vf.Size = fieldinfo['Size']
+ v.fields.setdefault(
+ int(fieldinfo['DefaultStore'], 10), []).append(vf)
+ v.serial()
+ v.pack()
+ self.NvVarInfo.append(v)
+
+ def PackDeltaData(self):
+
+ default_id_set = set()
+ for v in self.NvVarInfo:
+ default_id_set |= set(v.mBin.keys())
+
+ if default_id_set:
+ default_id_set.remove(0)
+ delta_buff_set = {}
+ for defaultid in default_id_set:
+ delta_buff = b''
+ for v in self.NvVarInfo:
+ delta_list = v.delta.get(defaultid,[])
+ for delta in delta_list:
+ delta_data = DELTA_DATA()
+ delta_data.Offset, delta_data.Value = delta
+ delta_buff += PackStruct(delta_data)
+ delta_buff_set[defaultid] = delta_buff
+
+ return delta_buff_set
+
+ def PackDefaultData(self):
+
+ default_data_header = DEFAULT_DATA()
+ default_data_header.HeaderSize = sizeof(DEFAULT_DATA)
+ default_data_header.DefaultInfo.DefaultId = 0x0
+ default_data_header.DefaultInfo.BoardId = 0x0
+ default_data_header_buffer = PackStruct(default_data_header)
+
+
+ variable_store = VARIABLE_STORE_HEADER()
+ variable_store.Signature = AuthVarGuid
+
+ variable_store_size = Get_Occupied_Size(sizeof(DEFAULT_DATA) + sizeof(VARIABLE_STORE_HEADER), 4)
+ for v in self.NvVarInfo:
+ variable_store_size += Get_Occupied_Size(len(v.mBin[0]), 4)
+
+ variable_store.Size = variable_store_size
+ variable_store.Format = VARIABLE_STORE_FORMATTED
+ variable_store.State = VARIABLE_STORE_HEALTHY
+ variable_store.Reserved = 0x0
+ variable_store.Reserved2 = 0x0
+
+ variable_storage_header_buffer = PackStruct(variable_store)
+
+ variable_data = b''
+ v_offset = 0
+ for v in self.NvVarInfo:
+ v.update_delta_offset(v_offset)
+ variable_data += Occupied_Size(v.mBin[0],4)
+ v_offset += Get_Occupied_Size(len(v.mBin[0]),4)
+
+
+ final_buff = Occupied_Size(default_data_header_buffer + variable_storage_header_buffer,4) + variable_data
+
+ return final_buff
+
+ def generate(self, jsonlistfile,output_folder):
+ if not os.path.exists(jsonlistfile):
+ return
+ if not os.path.exists(output_folder):
+ os.makedirs(output_folder)
+ try:
+ with open(jsonlistfile,"r") as fd:
+ filelist = fd.readlines()
+ genVar = DefaultVariableGenerator()
+ genVar.LoadNvVariableInfo(filelist)
+ with open(os.path.join(output_folder, "default.bin"), "wb") as fd:
+ fd.write(genVar.PackDefaultData())
+
+ delta_set = genVar.PackDeltaData()
+ for default_id in delta_set:
+ with open(os.path.join(output_folder, "defaultdelta_%s.bin" % default_id), "wb") as fd:
+ fd.write(delta_set[default_id])
+ except:
+ print("generate varbin file failed")
+
+
+
diff --git a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
index d70b0d7ae828..0daf3352f91b 100755
--- a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
@@ -433,10 +433,19 @@ class ModuleAutoGen(AutoGen):
## Return the directory to store auto-gened source files of the module
@cached_property
def DebugDir(self):
return _MakeDir((self.BuildDir, "DEBUG"))
+
+ @cached_property
+ def DefaultVarJsonFiles(self):
+ rt = []
+ for SrcFile in self.SourceFileList:
+ if SrcFile.Ext.lower() == '.vfr':
+ rt.append(os.path.join(self.DebugDir,os.path.join(os.path.dirname(SrcFile.File), "{}_var.json".format(SrcFile.BaseName))))
+ return rt
+
## Return the path of custom file
@cached_property
def CustomMakefile(self):
RetVal = {}
for Type in self.Module.CustomMakefile:
diff --git a/BaseTools/Source/Python/AutoGen/ModuleAutoGenHelper.py b/BaseTools/Source/Python/AutoGen/ModuleAutoGenHelper.py
index 036fdac3d7df..b46d041f58ab 100644
--- a/BaseTools/Source/Python/AutoGen/ModuleAutoGenHelper.py
+++ b/BaseTools/Source/Python/AutoGen/ModuleAutoGenHelper.py
@@ -644,10 +644,14 @@ class PlatformInfo(AutoGenInfo):
if Attr != 'PATH':
BuildOptions[ExpandedTool][Attr] += " " + mws.handleWsMacro(Value)
else:
BuildOptions[ExpandedTool][Attr] = mws.handleWsMacro(Value)
+ if self.DataPipe.Get("GenDefaultVarBin"):
+ if BuildOptions.get('VFR',{}).get('FLAGS'):
+ BuildOptions['VFR']['FLAGS'] += " " + "--variable"
+
return BuildOptions, BuildRuleOrder
def ApplyLibraryInstance(self,module):
alldeps = self.DataPipe.Get("DEPS")
if alldeps is None:
diff --git a/BaseTools/Source/Python/Common/GlobalData.py b/BaseTools/Source/Python/Common/GlobalData.py
index 61ab3f7e24cd..c68ca8fbb3f7 100755
--- a/BaseTools/Source/Python/Common/GlobalData.py
+++ b/BaseTools/Source/Python/Common/GlobalData.py
@@ -88,10 +88,15 @@ gIgnoreSource = False
#
gFdfParser = None
BuildOptionPcd = []
+#
+# Build flag for generate default variable binary file
+#
+gGenDefaultVarBin = False
+
#
# Mixed PCD name dict
#
MixedPcd = {}
diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/build/build.py
index 02b489892422..2f6fc6b20faf 100755
--- a/BaseTools/Source/Python/build/build.py
+++ b/BaseTools/Source/Python/build/build.py
@@ -750,10 +750,11 @@ class Build():
GlobalData.gUseHashCache = BuildOptions.UseHashCache
GlobalData.gBinCacheDest = BuildOptions.BinCacheDest
GlobalData.gBinCacheSource = BuildOptions.BinCacheSource
GlobalData.gEnableGenfdsMultiThread = not BuildOptions.NoGenfdsMultiThread
GlobalData.gDisableIncludePathCheck = BuildOptions.DisableIncludePathCheck
+ GlobalData.gGenDefaultVarBin = BuildOptions.GenDefaultVarBin
if GlobalData.gBinCacheDest and not GlobalData.gUseHashCache:
EdkLogger.error("build", OPTION_NOT_SUPPORTED, ExtraData="--binary-destination must be used together with --hash.")
if GlobalData.gBinCacheSource and not GlobalData.gUseHashCache:
@@ -1459,10 +1460,14 @@ class Build():
self.BuildModules = []
return True
# genfds
if Target == 'fds':
+ if GlobalData.gGenDefaultVarBin:
+ from AutoGen.GenDefaultVar import DefaultVariableGenerator
+ variable_info_filelist = os.path.join(AutoGenObject.BuildDir,"variable_info_filelist.txt")
+ DefaultVariableGenerator().generate(variable_info_filelist,AutoGenObject.FvDir)
if GenFdsApi(AutoGenObject.GenFdsCommandDict, self.Db):
EdkLogger.error("build", COMMAND_FAILURE)
Threshold = self.GetFreeSizeThreshold()
if Threshold:
self.CheckFreeSizeThreshold(Threshold, AutoGenObject.FvDir)
@@ -2247,10 +2252,19 @@ class Build():
AutoGenIdFile = os.path.join(GlobalData.gConfDirectory,".AutoGenIdFile.txt")
with open(AutoGenIdFile,"w") as fw:
fw.write("Arch=%s\n" % "|".join((Wa.ArchList)))
fw.write("BuildDir=%s\n" % Wa.BuildDir)
fw.write("PlatformGuid=%s\n" % str(Wa.AutoGenObjectList[0].Guid))
+ variable_info_filelist = os.path.join(Wa.BuildDir,"variable_info_filelist.txt")
+ vfr_var_json = []
+ if GlobalData.gGenDefaultVarBin:
+ for ma in self.AllModules:
+ vfr_var_json.extend(ma.DefaultVarJsonFiles)
+ SaveFileOnChange(variable_info_filelist, "\n".join(vfr_var_json), False)
+ else:
+ if os.path.exists(variable_info_filelist):
+ os.remove(variable_info_filelist)
if GlobalData.gBinCacheSource:
BuildModules.extend(self.MakeCacheMiss)
elif GlobalData.gUseHashCache and not GlobalData.gBinCacheDest:
BuildModules.extend(self.PreMakeCacheMiss)
@@ -2359,10 +2373,14 @@ class Build():
if self.Fdf:
#
# Generate FD image if there's a FDF file found
#
+ if GlobalData.gGenDefaultVarBin:
+ from AutoGen.GenDefaultVar import DefaultVariableGenerator
+ variable_info_filelist = os.path.join(Wa.BuildDir,"variable_info_filelist.txt")
+ DefaultVariableGenerator().generate(variable_info_filelist,Wa.FvDir)
GenFdsStart = time.time()
if GenFdsApi(Wa.GenFdsCommandDict, self.Db):
EdkLogger.error("build", COMMAND_FAILURE)
Threshold = self.GetFreeSizeThreshold()
if Threshold:
diff --git a/BaseTools/Source/Python/build/buildoptions.py b/BaseTools/Source/Python/build/buildoptions.py
index 39d92cff209d..6886ba7f8eb6 100644
--- a/BaseTools/Source/Python/build/buildoptions.py
+++ b/BaseTools/Source/Python/build/buildoptions.py
@@ -99,7 +99,8 @@ class MyOptionParser():
Parser.add_option("--hash", action="store_true", dest="UseHashCache", default=False, help="Enable hash-based caching during build process.")
Parser.add_option("--binary-destination", action="store", type="string", dest="BinCacheDest", help="Generate a cache of binary files in the specified directory.")
Parser.add_option("--binary-source", action="store", type="string", dest="BinCacheSource", help="Consume a cache of binary files from the specified directory.")
Parser.add_option("--genfds-multi-thread", action="store_true", dest="GenfdsMultiThread", default=True, help="Enable GenFds multi thread to generate ffs file.")
Parser.add_option("--no-genfds-multi-thread", action="store_true", dest="NoGenfdsMultiThread", default=False, help="Disable GenFds multi thread to generate ffs file.")
+ Parser.add_option("--gen-default-variable-bin", action="store_true", dest="GenDefaultVarBin", default=False, help="Generate default variable binary file.")
Parser.add_option("--disable-include-path-check", action="store_true", dest="DisableIncludePathCheck", default=False, help="Disable the include path check for outside of package.")
self.BuildOption, self.BuildTarget = Parser.parse_args()


Re: [edk2-platforms][PATCH v2] BoardModulePkg/BoardBdsHookLib: Register UiApp as boot option

Benjamin Doron
 

Actually, mBootMenuOptionNumber could be left alone for this patch, so it would be best to keep the patches separate: get UiApp working, then cleanup BootManagerMenuApp.


Re: [edk2-platforms][PATCH v2] BoardModulePkg/BoardBdsHookLib: Register UiApp as boot option

Benjamin Doron
 

Hi Nate,
Sure, I can do that. The UiApp boot option can then also be marked hidden.

Also, because of the way this patch would change hotkey handling, I'll drop https://edk2.groups.io/g/devel/topic/84671368.

Regards,
Benjamin


[PATCH v1 1/2] ShellPkg: Update Acpiview PCCT parser to ACPI 6.4

Chris Jones
 

Bugzilla: 3563 (https://bugzilla.tianocore.org/show_bug.cgi?id=3563)

Update the Acpiview PCCT parser to use Acpi64.h.

Signed-off-by: Chris Jones <christopher.jones@...>
---
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctParser.c | 46 ++++++++++----------
ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c | 4 +-
2 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctParser.c
index ca553d5953f05651d8df4c95d1e39a73eded5129..7d3a2dd10dc928265bad3711e929d96c1ed40b1d 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctParser.c
@@ -1,11 +1,11 @@
/** @file
PCCT table parser

- Copyright (c) 2020, Arm Limited.
+ Copyright (c) 2021, Arm Limited.
SPDX-License-Identifier: BSD-2-Clause-Patent

@par Reference(s):
- - ACPI 6.3 Specification - January 2019
+ - ACPI 6.4 Specification - January 2021
**/

#include <Library/BaseMemoryLib.h>
@@ -93,9 +93,9 @@ ValidatePccType0Gas (
{
switch (*(UINT8*)Ptr) {
#if !(defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64))
- case EFI_ACPI_6_3_SYSTEM_IO:
+ case EFI_ACPI_6_4_SYSTEM_IO:
#endif //if not (defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64))
- case EFI_ACPI_6_3_SYSTEM_MEMORY:
+ case EFI_ACPI_6_4_SYSTEM_MEMORY:
return;
default:
IncrementErrorCount ();
@@ -120,10 +120,10 @@ ValidatePccGas (
{
switch (*(UINT8*)Ptr) {
#if !(defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64))
- case EFI_ACPI_6_3_SYSTEM_IO:
+ case EFI_ACPI_6_4_SYSTEM_IO:
#endif //if not (defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64))
- case EFI_ACPI_6_3_FUNCTIONAL_FIXED_HARDWARE:
- case EFI_ACPI_6_3_SYSTEM_MEMORY:
+ case EFI_ACPI_6_4_FUNCTIONAL_FIXED_HARDWARE:
+ case EFI_ACPI_6_4_SYSTEM_MEMORY:
return;
default:
IncrementErrorCount ();
@@ -148,10 +148,10 @@ ValidatePccDoorbellGas (
{
// For slave subspaces this field is optional, if not present the field
// should just contain zeros.
- if (*PccSubspaceType == EFI_ACPI_6_3_PCCT_SUBSPACE_TYPE_4_EXTENDED_PCC) {
+ if (*PccSubspaceType == EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_4_EXTENDED_PCC) {
if (IsZeroBuffer (
Ptr,
- sizeof (EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE)
+ sizeof (EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE)
)) {
return;
}
@@ -180,14 +180,14 @@ ValidatePccIntAckGas (
// edge driven the register may be omitted. A value of 0x0 on all
// 12 bytes of the GAS structure indicates the register is not
// present.
- if (((*PccGlobalFlags & EFI_ACPI_6_3_PCCT_FLAGS_PLATFORM_INTERRUPT) !=
- EFI_ACPI_6_3_PCCT_FLAGS_PLATFORM_INTERRUPT) ||
+ if (((*PccGlobalFlags & EFI_ACPI_6_4_PCCT_FLAGS_PLATFORM_INTERRUPT) !=
+ EFI_ACPI_6_4_PCCT_FLAGS_PLATFORM_INTERRUPT) ||
((*ExtendedPccSubspaceInterruptFlags &
- EFI_ACPI_6_3_PCCT_SUBSPACE_PLATFORM_INTERRUPT_FLAGS_MODE) ==
- EFI_ACPI_6_3_PCCT_SUBSPACE_PLATFORM_INTERRUPT_FLAGS_MODE)) {
+ EFI_ACPI_6_4_PCCT_SUBSPACE_PLATFORM_INTERRUPT_FLAGS_MODE) ==
+ EFI_ACPI_6_4_PCCT_SUBSPACE_PLATFORM_INTERRUPT_FLAGS_MODE)) {
if (IsZeroBuffer (
Ptr,
- sizeof (EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE)
+ sizeof (EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE)
)) {
return;
}
@@ -212,7 +212,7 @@ ValidatePccErrStatusGas (
)
{
// This field is ignored by the OSPM on slave channels.
- if (*PccSubspaceType == EFI_ACPI_6_3_PCCT_SUBSPACE_TYPE_4_EXTENDED_PCC) {
+ if (*PccSubspaceType == EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_4_EXTENDED_PCC) {
return;
}

@@ -236,9 +236,9 @@ ValidatePlatInterrupt (
{
// If a slave subspace is present in the PCCT, then the global Platform
// Interrupt flag must be set to 1.
- if ((*PccSubspaceType == EFI_ACPI_6_3_PCCT_SUBSPACE_TYPE_4_EXTENDED_PCC) &&
- ((*PccGlobalFlags & EFI_ACPI_6_3_PCCT_FLAGS_PLATFORM_INTERRUPT) !=
- EFI_ACPI_6_3_PCCT_FLAGS_PLATFORM_INTERRUPT)) {
+ if ((*PccSubspaceType == EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_4_EXTENDED_PCC) &&
+ ((*PccGlobalFlags & EFI_ACPI_6_4_PCCT_FLAGS_PLATFORM_INTERRUPT) !=
+ EFI_ACPI_6_4_PCCT_FLAGS_PLATFORM_INTERRUPT)) {
IncrementErrorCount ();
Print (
L"\nError: Global Platform interrupt flag must be set to 1" \
@@ -563,31 +563,31 @@ ParseAcpiPcct (
}

switch (*PccSubspaceType) {
- case EFI_ACPI_6_3_PCCT_SUBSPACE_TYPE_GENERIC:
+ case EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_GENERIC:
DumpPccSubspaceType0 (
PccSubspacePtr,
*PccSubspaceLength
);
break;
- case EFI_ACPI_6_3_PCCT_SUBSPACE_TYPE_1_HW_REDUCED_COMMUNICATIONS:
+ case EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_1_HW_REDUCED_COMMUNICATIONS:
DumpPccSubspaceType1 (
PccSubspacePtr,
*PccSubspaceLength
);
break;
- case EFI_ACPI_6_3_PCCT_SUBSPACE_TYPE_2_HW_REDUCED_COMMUNICATIONS:
+ case EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_2_HW_REDUCED_COMMUNICATIONS:
DumpPccSubspaceType2 (
PccSubspacePtr,
*PccSubspaceLength
);
break;
- case EFI_ACPI_6_3_PCCT_SUBSPACE_TYPE_3_EXTENDED_PCC:
+ case EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_3_EXTENDED_PCC:
DumpPccSubspaceType3 (
PccSubspacePtr,
*PccSubspaceLength
);
break;
- case EFI_ACPI_6_3_PCCT_SUBSPACE_TYPE_4_EXTENDED_PCC:
+ case EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_4_EXTENDED_PCC:
DumpPccSubspaceType4 (
PccSubspacePtr,
*PccSubspaceLength
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c
index b30ed3fc8597b229dd15b6ad4f2aab2e3d0ca583..c81e5220272ae94448203ee02ea5caacb606842c 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c
@@ -1,7 +1,7 @@
/** @file
Main file for 'acpiview' Shell command function.

- Copyright (c) 2016 - 2020, Arm Limited. All rights reserved.<BR>
+ Copyright (c) 2016 - 2021, Arm Limited. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/

@@ -60,7 +60,7 @@ ACPI_TABLE_PARSER ParserList[] = {
{EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE, ParseAcpiMadt},
{EFI_ACPI_6_2_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE,
ParseAcpiMcfg},
- {EFI_ACPI_6_2_PLATFORM_COMMUNICATIONS_CHANNEL_TABLE_SIGNATURE,
+ {EFI_ACPI_6_4_PLATFORM_COMMUNICATIONS_CHANNEL_TABLE_SIGNATURE,
ParseAcpiPcct},
{EFI_ACPI_6_2_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_STRUCTURE_SIGNATURE,
ParseAcpiPptt},
--
Guid("CE165669-3EF3-493F-B85D-6190EE5B9759")


[PATCH v1 2/2] ShellPkg: Add Type 5 PCC Subspace Structure parser

Chris Jones
 

Bugzilla: 3563 (https://bugzilla.tianocore.org/show_bug.cgi?id=3563)

Update the Acpiview PCCT parser with the HW Registers based
Communications Subspace Structure (Type 5) as defined in Section 14.1.7
of the ACPI 6.4 specification.

Signed-off-by: Chris Jones <christopher.jones@...>
---
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctParser.c | 58 +++++++++++++++++++-
1 file changed, 55 insertions(+), 3 deletions(-)

diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctParser.c
index 7d3a2dd10dc928265bad3711e929d96c1ed40b1d..6beee70b23a3b32992efa0edac48fe236591b9f5 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctParser.c
@@ -77,7 +77,7 @@ ValidateRangeLength8 (
}

/**
- This function validates address space for type 0 structure.
+ This function validates address space for Memory/IO GAS.

@param [in] Ptr Pointer to the start of the field data.
@param [in] Context Pointer to context specific information e.g. this
@@ -86,7 +86,7 @@ ValidateRangeLength8 (
STATIC
VOID
EFIAPI
-ValidatePccType0Gas (
+ValidatePccMemoryIoGas (
IN UINT8* Ptr,
IN VOID* Context
)
@@ -274,7 +274,7 @@ STATIC CONST ACPI_PARSER PccSubspaceType0Parser[] = {
{L"Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL},
{L"Memory Range Length", 8, 16, L"0x%lx", NULL, NULL, ValidateRangeLength8,
NULL},
- {L"Doorbell Register", 12, 24, NULL, DumpGas, NULL, ValidatePccType0Gas,
+ {L"Doorbell Register", 12, 24, NULL, DumpGas, NULL, ValidatePccMemoryIoGas,
NULL},
{L"Doorbell Preserve", 8, 36, L"0x%lx", NULL, NULL, NULL, NULL},
{L"Doorbell Write", 8, 44, L"0x%lx", NULL, NULL, NULL, NULL},
@@ -367,6 +367,29 @@ STATIC CONST ACPI_PARSER PccSubspaceType3Parser[] = {
{L"Error Status Mask", 8, 156, L"0x%lx", NULL, NULL, NULL, NULL},
};

+/**
+ An ACPI_PARSER array describing the HW Registers based Communications
+ Subspace Structure - Type 5
+*/
+STATIC CONST ACPI_PARSER PccSubspaceType5Parser[] = {
+ PCC_SUBSPACE_HEADER (),
+ {L"Version", 2, 2, L"0x%x", NULL, NULL, NULL, NULL},
+ {L"Base Address", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL},
+ {L"Shared Memory Range Length", 8, 12, L"0x%lx", NULL, NULL, NULL, NULL},
+ {L"Doorbell Register", 12, 20, NULL, DumpGas, NULL,
+ ValidatePccMemoryIoGas, NULL},
+ {L"Doorbell Preserve", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL},
+ {L"Doorbell Write", 8, 40, L"0x%lx", NULL, NULL, NULL, NULL},
+ {L"Command Complete Check Register", 12, 48, NULL, DumpGas, NULL,
+ ValidatePccMemoryIoGas, NULL},
+ {L"Command Complete Check Mask", 8, 60, L"0x%lx", NULL, NULL, NULL, NULL},
+ {L"Error Status Register", 12, 68, NULL, DumpGas, NULL,
+ ValidatePccMemoryIoGas, NULL},
+ {L"Error Status Mask", 8, 80, L"0x%lx", NULL, NULL, NULL, NULL},
+ {L"Nominal Latency", 4, 88, L"0x%x", NULL, NULL, NULL, NULL},
+ {L"Minimum Request Turnaround Time", 4, 92, L"0x%x", NULL, NULL, NULL, NULL}
+};
+
/**
This function parses the PCC Subspace type 0.

@@ -482,6 +505,29 @@ DumpPccSubspaceType4 (
);
}

+/**
+ This function parses the PCC Subspace type 5.
+
+ @param [in] Ptr Pointer to the start of the Subspace Structure.
+ @param [in] Length Length of the Subspace Structure.
+**/
+STATIC
+VOID
+DumpPccSubspaceType5 (
+ IN UINT8* Ptr,
+ IN UINT8 Length
+ )
+{
+ ParseAcpi (
+ TRUE,
+ 2,
+ "Subspace Type 5",
+ Ptr,
+ Length,
+ PARSER_PARAMS (PccSubspaceType5Parser)
+ );
+}
+
/**
This function parses the ACPI PCCT table including its sub-structures
of type 0 through 4.
@@ -593,6 +639,12 @@ ParseAcpiPcct (
*PccSubspaceLength
);
break;
+ case EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_5_HW_REGISTERS_COMMUNICATIONS:
+ DumpPccSubspaceType5 (
+ PccSubspacePtr,
+ *PccSubspaceLength
+ );
+ break;
default:
IncrementErrorCount ();
Print (
--
Guid("CE165669-3EF3-493F-B85D-6190EE5B9759")


[PATCH v1 0/2] Support ACPI 6.4 in Acpiview PCCT parser

Chris Jones
 

Bugzilla: 3563 (https://bugzilla.tianocore.org/show_bug.cgi?id=3563)

This patch series adds support for ACPI 6.4 to the Acpiview PCCT parser
by using Acpi64.h and adding parsing, validation and printing support
for the new 'Type 5' subspace structure.

The changes can be seen at: https://github.com/chris-jones-arm/edk2/tree/1825_64_acpi_pcct_update_v1

Chris Jones (2):
ShellPkg: Update Acpiview PCCT parser to ACPI 6.4
ShellPkg: Add Type 5 PCC Subspace Structure parser

.../Parsers/Pcct/PcctParser.c | 104 +++++++++++++-----
.../UefiShellAcpiViewCommandLib.c | 4 +-
2 files changed, 80 insertions(+), 28 deletions(-)

--
Guid("CE165669-3EF3-493F-B85D-6190EE5B9759")


Re: SecCore evacuation in PeiCore?

Michael Kubacki
 

Hi Marvin,

I apologize for the delayed response, I missed this message earlier. The function was called from EvacuateTempRam() in the initial set of patches:
[PATCH 1/6] MdeModulePkg/PeiCore: Enable T-RAM evacuation in PeiCore (CVE-2019-11098) (groups.io) <https://edk2.groups.io/g/devel/message/61823>

I was not involved in the patch series on the mailing list (job role change at the time) but as a comment in that patch notes, there was an inconsistency observed in PE32 section alignment in SEC modules. I don't see where this was resolved other than the calls being removed later in the series. SecCore migration would not occur implicitly in the PeiCore flow but there is functionality for SEC data migration in UefiCpuPkg/SecMigrationPei.

Based on what I see now, I'd be happy to send a patch to remove MigrateSecModulesInFv().

Thanks,
Michael

On 8/7/2021 2:54 PM, Marvin Häuser wrote:
Good day everyone,
Good day Michael,

The commit that introduced T-RAM evacuation [1] also introduced the function "MigrateSecModulesInFv()". It also is explicitly mentioned as part of the control flow in the commit message. As far as I can see, since then till today this function has never been called anywhere. Was this some draft function that accidentally made it into the patch, or did the caller get lost somewhere? The description makes sense to me and I'm not experienced enough with the PeiCore control flow to tell whether the PEIM migration somehow covers SecCore implicitly. Also I noticed it only supports SecCore in a PE/COFF section, not a TE section. Is there a rationale for that?

Thank you for your time!

Best regards,
Marvin


[1] https://github.com/tianocore/edk2/commit/9bedaec05b7b8ba9aee248361bb61a85a26726cb



[edk2-libc Patch] StdLib/Include/sys/syslimits.h: Increase OPEN_MAX from 20 to 255

Michael D Kinney
 

From: Jayaprakash Nevara <n.jayaprakash@...>

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3548

A port of Python 3.6.8 interpreter for UEFI uses the
standard C Library from the edk2-libc project. The python
interpreter fails with the following error when the
python interpreter is launched:

"IOError: [Errno 24] Too many open files"

Python 3.6.8 interpreter opens and loads many python modules
(files) when it is boot strapped and this is leading to the
too many open files error.

To fix the issue the OPEN_MAX limit value is increased from
20 to 255.

Cc: Daryl McDaniel <edk2-lists@...>
Cc: Jaben Carsey <jaben.carsey@...>
Cc: Michael D Kinney <michael.d.kinney@...>
Cc: Rebecca Cran <rebecca@...>
Signed-off-by: Jayaprakash Nevara <n.jayaprakash@...>
---
StdLib/Include/sys/syslimits.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/StdLib/Include/sys/syslimits.h b/StdLib/Include/sys/syslimits.h
index 9515e8f..70ec619 100644
--- a/StdLib/Include/sys/syslimits.h
+++ b/StdLib/Include/sys/syslimits.h
@@ -53,7 +53,7 @@
#define MAX_OUTPUT 255 ///< Maximum bytes in terminal output.
#define NAME_MAX 255 ///< Maximum bytes in a file name.
#ifndef OPEN_MAX
- #define OPEN_MAX 20 ///< Maximum open files per process.
+ #define OPEN_MAX 255 ///< Maximum open files per process.
#endif
#define PATH_MAX 1024 ///< Maximum bytes in pathname.
#define PIPE_BUF 512 ///< Maximum bytes for atomic pipe writes.
--
2.32.0.windows.1


Re: [Patch 2/2] BaseTools: a new build option for variable default value generation

Andrew Fish
 



On Aug 13, 2021, at 4:45 AM, Bob Feng <bob.c.feng@...> wrote:

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3562

Create a new build option to enable vfrcompile to generate Json
format EFI variable information file and read it to generate
the EFI variable default value binary file.

Signed-off-by: Bob Feng <bob.c.feng@...>
Cc: Liming Gao <gaoliming@...>
Cc: Yuwei Chen <yuwei.chen@...>
---
BaseTools/Source/Python/AutoGen/DataPipe.py   |   2 +
.../Source/Python/AutoGen/GenDefaultVar.py    | 498 ++++++++++++++++++
.../Source/Python/AutoGen/ModuleAutoGen.py    |   9 +
.../Python/AutoGen/ModuleAutoGenHelper.py     |   4 +
BaseTools/Source/Python/Common/GlobalData.py  |   5 +
BaseTools/Source/Python/build/build.py        |  18 +
BaseTools/Source/Python/build/buildoptions.py |   1 +
7 files changed, 537 insertions(+)
create mode 100644 BaseTools/Source/Python/AutoGen/GenDefaultVar.py

diff --git a/BaseTools/Source/Python/AutoGen/DataPipe.py b/BaseTools/Source/Python/AutoGen/DataPipe.py
index 86ac2b928d9c..fa0c36b98f21 100755
--- a/BaseTools/Source/Python/AutoGen/DataPipe.py
+++ b/BaseTools/Source/Python/AutoGen/DataPipe.py
@@ -165,5 +165,7 @@ class MemoryDataPipe(DataPipe):
        self.DataContainer = {"BinCacheSource":GlobalData.gBinCacheSource}

        self.DataContainer = {"BinCacheDest":GlobalData.gBinCacheDest}

        self.DataContainer = {"EnableGenfdsMultiThread":GlobalData.gEnableGenfdsMultiThread}
+
+        self.DataContainer = {"GenDefaultVarBin": GlobalData.gGenDefaultVarBin}
diff --git a/BaseTools/Source/Python/AutoGen/GenDefaultVar.py b/BaseTools/Source/Python/AutoGen/GenDefaultVar.py
new file mode 100644
index 000000000000..b82cce18ed26
--- /dev/null
+++ b/BaseTools/Source/Python/AutoGen/GenDefaultVar.py
@@ -0,0 +1,498 @@
+import json
+from ctypes import *
+import re
+import copy
+from struct import unpack
+import os
+
+class GUID(Structure):

We should use (LittleEndianStructure) vs. (Structure). Structure is the endian of the Host, and EFI is little endian. Same comment for all the ctype structs. LittleEndianStructure is like using < with struct.pack()/struct.unpack(). 

+    _fields_ = [
+        ('Guid1',            c_uint32),
+        ('Guid2',            c_uint16),
+        ('Guid3',            c_uint16),
+        ('Guid4',            ARRAY(c_uint8, 8)),
+    ]
+

I think it would be better to use the same field names as the EFI C structures. 

typedef struct {
UINT32 Data1;
UINT16 Data2;
UINT16 Data3;
UINT8 Data4[8];
} GUID

Longer term I think the BaseBools should have a GUID class that can be shared that abstracts things GUIDs. It should store GUIDs as Python uuid.UUID() or at least in the common string form, and have useful operations. 

I’ve got an example GUID class in my gdb patch set, but it also loads the GUID database and deals with C name, C GUID structure init form, and strings. But it feels like we could pull out a common lower level GUID class out of that. 

+    def from_list(self, listformat):
+        self.Guid1 = listformat[0]
+        self.Guid2 = listformat[1]
+        self.Guid3 = listformat[2]
+        for i in range(8):
+            self.Guid4[i] = listformat[i+3]
+
+    def __cmp__(self, otherguid):
+        if isinstance(otherguid, GUID):
+            return 1
+        rt = False
+        if self.Guid1 == otherguid.Guid1 and self.Guid2 == otherguid.Guid2 and self.Guid3 == otherguid.Guid3:
+            rt = True
+            for i in range(8):
+                rt = rt & (self.Guid4[i] == otherguid.Guid4[i])
+        return rt
+
+
+class TIME(Structure):
+    _fields_ = [
+        ('Year',             c_uint16),
+        ('Month',            c_uint8),
+        ('Day',              c_uint8),
+        ('Hour',             c_uint8),
+        ('Minute',           c_uint8),
+        ('Second',           c_uint8),
+        ('Pad1',             c_uint8),
+        ('Nanosecond',       c_uint32),
+        ('TimeZone',         c_uint16),
+        ('Daylight',         c_uint8),
+        ('Pad2',             c_uint8),
+    ]
+    def __init__(self):
+        self.Year = 0x0
+        self.Month = 0x0
+        self.Day = 0x0
+        self.Hour = 0x0
+        self.Minute = 0x0
+        self.Second = 0x0
+        self.Pad1 = 0x0
+        self.Nanosecond = 0x0
+        self.TimeZone = 0x0
+        self.Daylight = 0x0
+        self.Pad2 = 0x0
+
+
+EFI_VARIABLE_GUID = [0xddcf3616, 0x3275, 0x4164,
+                     0x98, 0xb6, 0xfe, 0x85, 0x70, 0x7f, 0xfe, 0x7d]
+EFI_AUTHENTICATED_VARIABLE_GUID = [
+    0xaaf32c78, 0x947b, 0x439a, 0xa1, 0x80, 0x2e, 0x14, 0x4e, 0xc3, 0x77, 0x92]
+
+AuthVarGuid = GUID()
+AuthVarGuid.from_list(EFI_AUTHENTICATED_VARIABLE_GUID)
+VarGuid = GUID()
+VarGuid.from_list(EFI_VARIABLE_GUID)
+
+# Variable Store Header Format.
+VARIABLE_STORE_FORMATTED = 0x5a
+# Variable Store Header State.
+VARIABLE_STORE_HEALTHY = 0xfe
+
+
+class VARIABLE_STORE_HEADER(Structure):
+    _fields_ = [
+        ('Signature',                GUID),
+        ('Size',                     c_uint32),
+        ('Format',                   c_uint8),
+        ('State',                    c_uint8),
+        ('Reserved',                 c_uint16),
+        ('Reserved1',                c_uint32),
+    ]
+
+
+# Variable data start flag.
+VARIABLE_DATA = 0x55AA
+
+# Variable State flags.
+VAR_IN_DELETED_TRANSITION = 0xfe
+VAR_DELETED = 0xfd
+VAR_HEADER_VALID_ONLY = 0x7f
+VAR_ADDED = 0x3f
+
+
+class VARIABLE_HEADER(Structure):
+    _fields_ = [
+        ('StartId',                  c_uint16),
+        ('State',                    c_uint8),
+        ('Reserved',                 c_uint8),
+        ('Attributes',               c_uint32),
+        ('NameSize',                 c_uint32),
+        ('DataSize',                 c_uint32),
+        ('VendorGuid',               GUID),
+    ]
+
+
+class AUTHENTICATED_VARIABLE_HEADER(Structure):
+    _fields_ = [
+        ('StartId',                  c_uint16),
+        ('State',                    c_uint8),
+        ('Reserved',                 c_uint8),
+        ('Attributes',               c_uint32),
+        ('MonotonicCount',           c_uint64),
+        ('TimeStamp',                TIME),
+        ('PubKeyIndex',              c_uint32),
+        ('NameSize',                 c_uint32),
+        ('DataSize',                 c_uint32),
+        ('VendorGuid',               GUID),
+    ]
+    _pack_ = 1
+
+
+# Alignment of Variable Data Header in Variable Store region.
+HEADER_ALIGNMENT = 4
+
+
+class DEFAULT_INFO(Structure):
+    _fields_ = [
+        ('DefaultId',                c_uint16),
+        ('BoardId',                  c_uint16),
+    ]
+
+
+class DEFAULT_DATA(Structure):
+    _fields_ = [
+        ('HeaderSize',               c_uint16),
+        ('DefaultInfo',              DEFAULT_INFO),
+    ]
+
+class DELTA_DATA(Structure):
+    _fields_ = [
+        ('Offset', c_uint16),
+        ('Value', c_uint8),
+    ]
+    _pack_ = 1
+
+array_re = re.compile(
+    "(?P<mType>[a-z_A-Z][a-z_A-Z0-9]*)\[(?P<mSize>[1-9][0-9]*)\]")
+
+
+class VarField():
+    def __init__(self):
+        self.Offset = 0
+        self.Value = 0
+        self.Size = 0
+
+    @property
+    def Type(self):
+        if self.Size == 1:
+            return "UINT8"
+        if self.Size == 2:
+            return "UINT16"
+        if self.Size == 4:
+            return "UINT32"
+        if self.Size == 8:
+            return "UINT64"
+
+        return "UINT8"
+
+
+BASIC_TYPE = {
+    "BOOLEAN": 1,
+    "UINT8": 1,
+    "UINT16": 2,
+    "UINT32": 4,
+    "UINT64": 8
+}

This might be more of a phase 2….

I think you made a lot of extra work by inventing your own type system. You should just convert to ctype as fast as you can. 

BASIC_TYPE = {
    "BOOLEAN": c_uint8,
    "UINT8": c_uint8,
    "UINT16": c_uint16,
    "UINT32": c_uint32,
    "UINT64": c_uint64
}

Then you can just sizeof() to get the size

FYI I wrote this ctype dumper in case it is useful debugging this code.  It picks off EFI_GUID so it can print it as a proper UUID using the GUID class I mentioned above, so basically a nicer print option. 

def ctype_to_str(ctype, indent='', hide_list=[]):
    '''
    Given a ctype object print out as a string by walking the _fields_
    in the cstring Class
     '''
    result = ''
    for field in ctype._fields_:
        attr = getattr(ctype, field[0])
        tname = type(attr).__name__
        if field[0] in hide_list:
            continue

        result += indent + f'{field[0]} = '
        if tname == 'EFI_GUID':
            result += GuidNames.to_name(GuidNames.to_uuid(attr)) + '\n'
        elif issubclass(type(attr), Structure):
            result += f'{tname}\n' + \
                ctype_to_str(attr, indent + '  ', hide_list)
        elif isinstance(attr, int):
            result += f'0x{attr:x}\n'
        else:
            result += f'{attr}\n'

    return result

Thanks,

Andrew Fish

+class CStruct():
+
+
+    def __init__(self, typedefs):
+        self.TypeDefs = typedefs
+        self.TypeStack = copy.deepcopy(typedefs)
+        self.finalDefs = {}
+
+    def CalStuctSize(self, sType):
+        rt = 0
+        if sType in BASIC_TYPE:
+            return BASIC_TYPE[sType]
+
+        ma = array_re.match(sType)
+        if ma:
+            mType = ma.group('mType')
+            mSize = ma.group('mSize')
+            rt += int(mSize) * self.CalStuctSize(mType)
+        else:
+            for subType in self.TypeDefs[sType]:
+                rt += self.CalStuctSize(subType['Type'])
+
+        return rt
+
+    def expend(self, fielditem):
+        fieldname = fielditem['Name']
+        fieldType = fielditem['Type']
+        fieldOffset = fielditem['Offset']
+
+        ma = array_re.match(fieldType)
+        if ma:
+            mType = ma.group('mType')
+            mSize = ma.group('mSize')
+            return [{"Name": "%s[%d]" % (fieldname, i), "Type": mType, "Offset": (fieldOffset + i*self.CalStuctSize(mType))} for i in range(int(mSize))]
+        else:
+            return [{"Name": "%s.%s" % (fieldname, item['Name']), "Type":item['Type'], "Offset": (fieldOffset + item['Offset'])} for item in self.TypeDefs[fielditem['Type']]]
+
+    def ExpandTypes(self):
+        if not self.finalDefs:
+            for datatype in self.TypeStack:
+                result = []
+                mTypeStack = self.TypeStack[datatype]
+                while len(mTypeStack) > 0:
+                    item = mTypeStack.pop()
+                    if item['Type'] in self.BASIC_TYPE:
+                        result.append(item)
+                    elif item['Type'] == '(null)':
+                        continue
+                    else:
+                        for expand_item in self.expend(item):
+                            mTypeStack.append(expand_item)
+                self.finalDefs[datatype] = result
+            self.finalDefs
+        return self.finalDefs
+
+def Get_Occupied_Size(FileLength, alignment):
+    if FileLength % alignment == 0:
+        return FileLength
+    return FileLength + (alignment-(FileLength % alignment))
+
+def Occupied_Size(buffer, alignment):
+    FileLength = len(buffer)
+    if FileLength % alignment != 0:
+        buffer += b'\0' * (alignment-(FileLength % alignment))
+    return buffer
+
+def PackStruct(cStruct):
+    length = sizeof(cStruct)
+    p = cast(pointer(cStruct), POINTER(c_char * length))
+    return p.contents.raw
+
+def calculate_delta(default, theother):
+
+    if len(default) - len(theother) != 0:
+        return []
+
+    data_delta = []
+    for i in range(len(default)):
+        if default[i] != theother[i]:
+            data_delta.append([i, theother[i]])
+    return data_delta
+
+class Variable():
+    def __init__(self):
+        self.mAlign = 1
+        self.mTotalSize = 1
+        self.mValue = {}  # {defaultstore: value}
+        self.mBin = {}
+        self.fields = {}  # {defaultstore: fileds}
+        self.delta = {}
+        self.attributes = 0
+        self.mType = ''
+        self.guid = ''
+        self.mName = ''
+        self.cDefs = None
+
+    @property
+    def GuidArray(self):
+
+        guid_array = []
+        guid = self.guid.strip().strip("{").strip("}")
+        for item in guid.split(","):
+            field = item.strip().strip("{").strip("}")
+            guid_array.append(int(field,16))
+        return guid_array
+
+    def update_delta_offset(self,base):
+        for default_id in self.delta:
+            for delta_list in self.delta[default_id]:
+                delta_list[0] += base
+
+    def pack(self):
+
+        for defaultid in self.mValue:
+            var_value = self.mValue[defaultid]
+            auth_var = AUTHENTICATED_VARIABLE_HEADER()
+            auth_var.StartId = VARIABLE_DATA
+            auth_var.State = VAR_ADDED
+            auth_var.Reserved = 0x00
+            auth_var.Attributes = 0x00000007
+            auth_var.MonotonicCount = 0x0
+            auth_var.TimeStamp = TIME()
+            auth_var.PubKeyIndex = 0x0
+            var_name_buffer = self.mName.encode('utf-16le') + b'\0\0'
+            auth_var.NameSize = len(var_name_buffer)
+            auth_var.DataSize = len(var_value)
+            vendor_guid = GUID()
+            vendor_guid.from_list(self.GuidArray)
+            auth_var.VendorGuid = vendor_guid
+
+            self.mBin[defaultid] = PackStruct(auth_var) + Occupied_Size(var_name_buffer + var_value, 4)
+
+    def TypeCheck(self,data_type, data_size):
+        if BASIC_TYPE[data_type] == data_size:
+            return True
+        return False
+
+    def ValueToBytes(self,data_type,data_value,data_size):
+
+        rt = b''
+        if not self.TypeCheck(data_type, data_size):
+            print(data_type,data_value,data_size)
+
+        if data_type == "BOOLEAN" or data_type == 'UINT8':
+            p = cast(pointer(c_uint8(int(data_value,16))), POINTER(c_char * 1))
+            rt = p.contents.raw
+        elif data_type == 'UINT16':
+            p = cast(pointer(c_uint16(int(data_value,16))), POINTER(c_char * 2))
+            rt = p.contents.raw
+        elif data_type == 'UINT32':
+            p = cast(pointer(c_uint32(int(data_value,16))), POINTER(c_char * 4))
+            rt = p.contents.raw
+        elif data_type == 'UINT64':
+            p = cast(pointer(c_uint64(int(data_value,16))), POINTER(c_char * 8))
+            rt = p.contents.raw
+
+        return rt
+
+    def serial(self):
+        for defaultstore in self.fields:
+            vValue = b''
+            vfields = {vf.Offset: vf for vf in self.fields[defaultstore]}
+            i = 0
+            while i < self.mTotalSize:
+                if i in vfields:
+                    vfield = vfields[i]
+                    vValue += self.ValueToBytes(vfield.Type, vfield.Value,vfield.Size)
+                    i += vfield.Size
+                else:
+                    vValue += self.ValueToBytes('UINT8','0x00',1)
+                    i += 1
+
+            self.mValue[defaultstore] = vValue
+        standard_default = self.mValue[0]
+
+        for defaultid in self.mValue:
+            if defaultid == 0:
+                continue
+            others_default = self.mValue[defaultid]
+
+            self.delta.setdefault(defaultid, []).extend(calculate_delta(
+                standard_default, others_default))
+
+class DefaultVariableGenerator():
+    def __init__(self):
+        self.NvVarInfo = []
+
+    def LoadNvVariableInfo(self, VarInfoFilelist):
+
+        VarDataDict = {}
+        DataStruct = {}
+        VarDefine = {}
+        VarAttributes = {}
+        for VarInfoFile in VarInfoFilelist:
+            with open(VarInfoFile.strip(), "r") as fd:
+                data = json.load(fd)
+
+            DataStruct.update(data.get("DataStruct", {}))
+            Data = data.get("Data")
+            VarDefine.update(data.get("VarDefine"))
+            VarAttributes.update(data.get("DataStructAttribute"))
+
+            for vardata in Data:
+                if vardata['VendorGuid'] == 'NA':
+                    continue
+                VarDataDict.setdefault(
+                    (vardata['VendorGuid'], vardata["VarName"]), []).append(vardata)
+
+        cStructDefs = CStruct(DataStruct)
+        for guid, varname in VarDataDict:
+            v = Variable()
+            v.guid = guid
+            vardef = VarDefine.get(varname)
+            if vardef is None:
+                for var in VarDefine:
+                    if VarDefine[var]['Type'] == varname:
+                        vardef = VarDefine[var]
+                        break
+                else:
+                    continue
+            v.attributes = vardef['Attributes']
+            v.mType = vardef['Type']
+            v.mAlign = VarAttributes[v.mType]['Alignment']
+            v.mTotalSize = VarAttributes[v.mType]['TotalSize']
+            v.Struct = DataStruct[v.mType]
+            v.mName = varname
+            v.cDefs = cStructDefs
+            for fieldinfo in VarDataDict.get((guid, varname), []):
+                vf = VarField()
+                vf.Offset = fieldinfo['Offset']
+                vf.Value = fieldinfo['Value']
+                vf.Size = fieldinfo['Size']
+                v.fields.setdefault(
+                    int(fieldinfo['DefaultStore'], 10), []).append(vf)
+            v.serial()
+            v.pack()
+            self.NvVarInfo.append(v)
+
+    def PackDeltaData(self):
+
+        default_id_set = set()
+        for v in self.NvVarInfo:
+            default_id_set |= set(v.mBin.keys())
+
+        if default_id_set:
+            default_id_set.remove(0)
+        delta_buff_set = {}
+        for defaultid in default_id_set:
+            delta_buff = b''
+            for v in self.NvVarInfo:
+                delta_list = v.delta.get(defaultid,[])
+                for delta in delta_list:
+                    delta_data = DELTA_DATA()
+                    delta_data.Offset, delta_data.Value = delta
+                    delta_buff += PackStruct(delta_data)
+            delta_buff_set[defaultid] = delta_buff
+
+        return delta_buff_set
+
+    def PackDefaultData(self):
+
+        default_data_header = DEFAULT_DATA()
+        default_data_header.HeaderSize = sizeof(DEFAULT_DATA)
+        default_data_header.DefaultInfo.DefaultId = 0x0
+        default_data_header.DefaultInfo.BoardId = 0x0
+        default_data_header_buffer = PackStruct(default_data_header)
+
+
+        variable_store = VARIABLE_STORE_HEADER()
+        variable_store.Signature = AuthVarGuid
+
+        variable_store_size = Get_Occupied_Size(sizeof(DEFAULT_DATA) + sizeof(VARIABLE_STORE_HEADER), 4)
+        for v in self.NvVarInfo:
+            variable_store_size += Get_Occupied_Size(len(v.mBin[0]), 4)
+
+        variable_store.Size = variable_store_size
+        variable_store.Format = VARIABLE_STORE_FORMATTED
+        variable_store.State = VARIABLE_STORE_HEALTHY
+        variable_store.Reserved = 0x0
+        variable_store.Reserved2 = 0x0
+
+        variable_storage_header_buffer = PackStruct(variable_store)
+
+        variable_data = b''
+        v_offset = 0
+        for v in self.NvVarInfo:
+            v.update_delta_offset(v_offset)
+            variable_data += Occupied_Size(v.mBin[0],4)
+            v_offset += Get_Occupied_Size(len(v.mBin[0]),4)
+
+
+        final_buff = Occupied_Size(default_data_header_buffer + variable_storage_header_buffer,4) + variable_data
+
+        return final_buff
+
+    def generate(self, jsonlistfile,output_folder):
+        if not os.path.exists(jsonlistfile):
+            return
+        if not os.path.exists(output_folder):
+            os.makedirs(output_folder)
+        try:
+            with open(jsonlistfile,"r") as fd:
+                filelist = fd.readlines()
+            genVar = DefaultVariableGenerator()
+            genVar.LoadNvVariableInfo(filelist)
+            with open(os.path.join(output_folder, "default.bin"), "wb") as fd:
+                fd.write(genVar.PackDefaultData())
+
+            delta_set = genVar.PackDeltaData()
+            for default_id in delta_set:
+                with open(os.path.join(output_folder, "defaultdelta_%s.bin" % default_id), "wb") as fd:
+                    fd.write(delta_set[default_id])
+        except:
+            print("generate varbin file failed")
+
+
+
diff --git a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
index d70b0d7ae828..0daf3352f91b 100755
--- a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
@@ -433,10 +433,19 @@ class ModuleAutoGen(AutoGen):
    ## Return the directory to store auto-gened source files of the module
    @cached_property
    def DebugDir(self):
        return _MakeDir((self.BuildDir, "DEBUG"))

+
+    @cached_property
+    def DefaultVarJsonFiles(self):
+        rt = []
+        for SrcFile in self.SourceFileList:
+            if SrcFile.Ext.lower() == '.vfr':
+                rt.append(os.path.join(self.DebugDir,os.path.join(os.path.dirname(SrcFile.File), "{}_var.json".format(SrcFile.BaseName))))
+        return rt
+
    ## Return the path of custom file
    @cached_property
    def CustomMakefile(self):
        RetVal = {}
        for Type in self.Module.CustomMakefile:
diff --git a/BaseTools/Source/Python/AutoGen/ModuleAutoGenHelper.py b/BaseTools/Source/Python/AutoGen/ModuleAutoGenHelper.py
index 036fdac3d7df..b46d041f58ab 100644
--- a/BaseTools/Source/Python/AutoGen/ModuleAutoGenHelper.py
+++ b/BaseTools/Source/Python/AutoGen/ModuleAutoGenHelper.py
@@ -644,10 +644,14 @@ class PlatformInfo(AutoGenInfo):
                            if Attr != 'PATH':
                                BuildOptions[ExpandedTool][Attr] += " " + mws.handleWsMacro(Value)
                            else:
                                BuildOptions[ExpandedTool][Attr] = mws.handleWsMacro(Value)

+        if self.DataPipe.Get("GenDefaultVarBin"):
+            if BuildOptions.get('VFR',{}).get('FLAGS'):
+                BuildOptions['VFR']['FLAGS'] += " " + "--variable"
+
        return BuildOptions, BuildRuleOrder

    def ApplyLibraryInstance(self,module):
        alldeps = self.DataPipe.Get("DEPS")
        if alldeps is None:
diff --git a/BaseTools/Source/Python/Common/GlobalData.py b/BaseTools/Source/Python/Common/GlobalData.py
index 61ab3f7e24cd..c68ca8fbb3f7 100755
--- a/BaseTools/Source/Python/Common/GlobalData.py
+++ b/BaseTools/Source/Python/Common/GlobalData.py
@@ -88,10 +88,15 @@ gIgnoreSource = False
#
gFdfParser = None

BuildOptionPcd = []

+#
+# Build flag for generate default variable binary file
+#
+gGenDefaultVarBin = False
+
#
# Mixed PCD name dict
#
MixedPcd = {}

diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/build/build.py
index 02b489892422..2f6fc6b20faf 100755
--- a/BaseTools/Source/Python/build/build.py
+++ b/BaseTools/Source/Python/build/build.py
@@ -750,10 +750,11 @@ class Build():
        GlobalData.gUseHashCache = BuildOptions.UseHashCache
        GlobalData.gBinCacheDest   = BuildOptions.BinCacheDest
        GlobalData.gBinCacheSource = BuildOptions.BinCacheSource
        GlobalData.gEnableGenfdsMultiThread = not BuildOptions.NoGenfdsMultiThread
        GlobalData.gDisableIncludePathCheck = BuildOptions.DisableIncludePathCheck
+        GlobalData.gGenDefaultVarBin = BuildOptions.GenDefaultVarBin

        if GlobalData.gBinCacheDest and not GlobalData.gUseHashCache:
            EdkLogger.error("build", OPTION_NOT_SUPPORTED, ExtraData="--binary-destination must be used together with --hash.")

        if GlobalData.gBinCacheSource and not GlobalData.gUseHashCache:
@@ -1459,10 +1460,14 @@ class Build():
            self.BuildModules = []
            return True

        # genfds
        if Target == 'fds':
+            if GlobalData.gGenDefaultVarBin:
+                from AutoGen.GenDefaultVar import DefaultVariableGenerator
+                variable_info_filelist = os.path.join(AutoGenObject.BuildDir,"variable_info_filelist.txt")
+                DefaultVariableGenerator().generate(variable_info_filelist,AutoGenObject.FvDir)
            if GenFdsApi(AutoGenObject.GenFdsCommandDict, self.Db):
                EdkLogger.error("build", COMMAND_FAILURE)
            Threshold = self.GetFreeSizeThreshold()
            if Threshold:
                self.CheckFreeSizeThreshold(Threshold, AutoGenObject.FvDir)
@@ -2247,10 +2252,19 @@ class Build():
        AutoGenIdFile = os.path.join(GlobalData.gConfDirectory,".AutoGenIdFile.txt")
        with open(AutoGenIdFile,"w") as fw:
            fw.write("Arch=%s\n" % "|".join((Wa.ArchList)))
            fw.write("BuildDir=%s\n" % Wa.BuildDir)
            fw.write("PlatformGuid=%s\n" % str(Wa.AutoGenObjectList[0].Guid))
+        variable_info_filelist = os.path.join(Wa.BuildDir,"variable_info_filelist.txt")
+        vfr_var_json = []
+        if GlobalData.gGenDefaultVarBin:
+            for ma in self.AllModules:
+                vfr_var_json.extend(ma.DefaultVarJsonFiles)
+            SaveFileOnChange(variable_info_filelist, "\n".join(vfr_var_json), False)
+        else:
+            if os.path.exists(variable_info_filelist):
+                os.remove(variable_info_filelist)

        if GlobalData.gBinCacheSource:
            BuildModules.extend(self.MakeCacheMiss)
        elif GlobalData.gUseHashCache and not GlobalData.gBinCacheDest:
            BuildModules.extend(self.PreMakeCacheMiss)
@@ -2359,10 +2373,14 @@ class Build():

                    if self.Fdf:
                        #
                        # Generate FD image if there's a FDF file found
                        #
+                        if GlobalData.gGenDefaultVarBin:
+                            from AutoGen.GenDefaultVar import DefaultVariableGenerator
+                            variable_info_filelist = os.path.join(Wa.BuildDir,"variable_info_filelist.txt")
+                            DefaultVariableGenerator().generate(variable_info_filelist,Wa.FvDir)
                        GenFdsStart = time.time()
                        if GenFdsApi(Wa.GenFdsCommandDict, self.Db):
                            EdkLogger.error("build", COMMAND_FAILURE)
                        Threshold = self.GetFreeSizeThreshold()
                        if Threshold:
diff --git a/BaseTools/Source/Python/build/buildoptions.py b/BaseTools/Source/Python/build/buildoptions.py
index 39d92cff209d..6886ba7f8eb6 100644
--- a/BaseTools/Source/Python/build/buildoptions.py
+++ b/BaseTools/Source/Python/build/buildoptions.py
@@ -99,7 +99,8 @@ class MyOptionParser():
        Parser.add_option("--hash", action="store_true", dest="UseHashCache", default=False, help="Enable hash-based caching during build process.")
        Parser.add_option("--binary-destination", action="store", type="string", dest="BinCacheDest", help="Generate a cache of binary files in the specified directory.")
        Parser.add_option("--binary-source", action="store", type="string", dest="BinCacheSource", help="Consume a cache of binary files from the specified directory.")
        Parser.add_option("--genfds-multi-thread", action="store_true", dest="GenfdsMultiThread", default=True, help="Enable GenFds multi thread to generate ffs file.")
        Parser.add_option("--no-genfds-multi-thread", action="store_true", dest="NoGenfdsMultiThread", default=False, help="Disable GenFds multi thread to generate ffs file.")
+        Parser.add_option("--gen-default-variable-bin", action="store_true", dest="GenDefaultVarBin", default=False, help="Generate default variable binary file.")
        Parser.add_option("--disable-include-path-check", action="store_true", dest="DisableIncludePathCheck", default=False, help="Disable the include path check for outside of package.")
        self.BuildOption, self.BuildTarget = Parser.parse_args()
--
2.18.0.windows.1








Re: [edk2-platforms PATCH] Platform/RaspberryPi: Remove unnecessary files

Samer El-Haj-Mahmoud
 

Thanks!

Reviewed-by: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@...>

-----Original Message-----
From: Marcin Wojtas <mw@...>
Sent: Friday, August 13, 2021 10:42 AM
To: devel@edk2.groups.io
Cc: leif@...; ardb+tianocore@...; Samer El-Haj-Mahmoud
<Samer.El-Haj-Mahmoud@...>; Sunny Wang
<Sunny.Wang@...>; gjb@...; upstream@...;
pete@...; Marcin Wojtas <mw@...>
Subject: [edk2-platforms PATCH] Platform/RaspberryPi: Remove
unnecessary files

Commit 2f0188b56ef4 ("Revert "Platform/RaspberryPi: Setup option for...")
mistakenly introduced to files which are residues from a
conflict resolution. Fix that.

Signed-off-by: Marcin Wojtas <mw@...>
---
Platform/RaspberryPi/RPi4/RPi4.dsc.orig | 760 --------------------
Platform/RaspberryPi/RPi4/RPi4.dsc.rej | 29 -
2 files changed, 789 deletions(-)
delete mode 100644 Platform/RaspberryPi/RPi4/RPi4.dsc.orig
delete mode 100644 Platform/RaspberryPi/RPi4/RPi4.dsc.rej

diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc.orig
b/Platform/RaspberryPi/RPi4/RPi4.dsc.orig
deleted file mode 100644
index 2c05c31118..0000000000
--- a/Platform/RaspberryPi/RPi4/RPi4.dsc.orig
+++ /dev/null
@@ -1,760 +0,0 @@
-# @file

-#

-# Copyright (c) 2011 - 2020, ARM Limited. All rights reserved.

-# Copyright (c) 2017 - 2018, Andrei Warkentin
<andrey.warkentin@...>

-# Copyright (c) 2015 - 2021, 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 = RPi4

- PLATFORM_GUID = a7eca3b4-21b0-4989-8c18-c08f3ae87837

- PLATFORM_VERSION = 1.0

- DSC_SPECIFICATION = 0x0001001A

- OUTPUT_DIRECTORY = Build/$(PLATFORM_NAME)

- SUPPORTED_ARCHITECTURES = AARCH64

- BUILD_TARGETS = DEBUG|RELEASE|NOOPT

- SKUID_IDENTIFIER = DEFAULT

- FLASH_DEFINITION =
Platform/RaspberryPi/$(PLATFORM_NAME)/$(PLATFORM_NAME).fdf

-

- #

- # Defines for default states. These can be changed on the command line.

- # -D FLAG=VALUE

- #

- DEFINE SECURE_BOOT_ENABLE = FALSE

- DEFINE INCLUDE_TFTP_COMMAND = FALSE

- DEFINE DEBUG_PRINT_ERROR_LEVEL = 0x8000004F

-

-!ifndef TFA_BUILD_ARTIFACTS

- #

- # Default TF-A binary checked into edk2-non-osi.

- #

- DEFINE TFA_BUILD_BL31 =
Platform/RaspberryPi/$(PLATFORM_NAME)/TrustedFirmware/bl31.bin

-!else

- #

- # Usually we use the checked-in binaries, but for developers working

- # on the firmware, being able to use a local TF-A build without extra copy

- # operations ends up being very helpful.

- #

- DEFINE TFA_BUILD_BL31 = $(TFA_BUILD_ARTIFACTS)/bl31.bin

-!endif

-

-
##########################################################
######################

-#

-# Library Class section - list of all Library Classes needed by this Platform.

-#

-
##########################################################
######################

-

-!include MdePkg/MdeLibs.dsc.inc

-

-[LibraryClasses.common]

-!if $(TARGET) == RELEASE

- DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf

-!else

-
DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.
inf

-!endif

-
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/Bas
eDebugPrintErrorLevelLib.inf

-

- BaseLib|MdePkg/Library/BaseLib/BaseLib.inf

- SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf

-
BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupp
ortLib.inf

-
SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchroniz
ationLib.inf

-
PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanc
eLibNull.inf

-
ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseR
eportStatusCodeLibNull.inf

- PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf

-
PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/Base
PeCoffGetEntryPointLib.inf

- PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf

- IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf

-
UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDeco
mpressLib.inf

- CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf

-

- UefiLib|MdePkg/Library/UefiLib/UefiLib.inf

- HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf

-
UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib
/UefiRuntimeServicesTableLib.inf

- DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf

-
UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBo
otServicesTableLib.inf

-
DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTabl
eLib.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/UefiHiiService
sLib.inf

- SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf

-

- UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf

-
OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeL
ib/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/BaseMemoryLib
OptDxe.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 generate
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/ArmCach
eMaintenanceLib.inf

-
DefaultExceptionHandlerLib|ArmPkg/Library/DefaultExceptionHandlerLib/D
efaultExceptionHandlerLib.inf

-
CpuExceptionHandlerLib|ArmPkg/Library/ArmExceptionLib/ArmExceptionLib
.inf

-
ArmDisassemblerLib|ArmPkg/Library/ArmDisassemblerLib/ArmDisassembler
Lib.inf

- ArmGicLib|ArmPkg/Drivers/ArmGic/ArmGicLib.inf

- ArmGicArchLib|ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf

-
DmaLib|EmbeddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.i
nf

- TimeBaseLib|EmbeddedPkg/Library/TimeBaseLib/TimeBaseLib.inf

-
ArmPlatformStackLib|ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPla
tformStackLib.inf

- ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf

- ArmHvcLib|ArmPkg/Library/ArmHvcLib/ArmHvcLib.inf

-
ArmGenericTimerCounterLib|ArmPkg/Library/ArmGenericTimerPhyCounter
Lib/ArmGenericTimerPhyCounterLib.inf

-

- # Dual serial port library

-
PL011UartClockLib|ArmPlatformPkg/Library/PL011UartClockLib/PL011UartClo
ckLib.inf

- PL011UartLib|ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.inf

-
SerialPortLib|Platform/RaspberryPi/Library/DualSerialPortLib/DebugDualSeri
alPortLib.inf

-

- # Cryptographic libraries

- RngLib|MdePkg/Library/DxeRngLib/DxeRngLib.inf

- IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf

- BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf

- OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf

- TlsLib|CryptoPkg/Library/TlsLib/TlsLib.inf

-

- #

- # Uncomment (and comment out the next line) For RealView Debugger.
The Standard IO window

- # in the debugger will show load and unload commands for symbols. You
can cut and paste this

- # into the command window to load symbols. We should be able to use a
script to do this, but

- # the version of RVD I have does not support scripts accessing system
memory.

- #

-
#PeCoffExtraActionLib|ArmPkg/Library/RvdPeCoffExtraActionLib/RvdPeCoff
ExtraActionLib.inf

-
PeCoffExtraActionLib|ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPe
CoffExtraActionLib.inf

-
#PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/Base
PeCoffExtraActionLibNull.inf

-

-
DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLi
bNull.inf

-
DebugAgentTimerLib|EmbeddedPkg/Library/DebugAgentTimerLibNull/Debu
gAgentTimerLibNull.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) == TRUE

-
TpmMeasurementLib|SecurityPkg/Library/DxeTpmMeasurementLib/DxeTp
mMeasurementLib.inf

- AuthVariableLib|SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf

-

- # re-use the UserPhysicalPresent() dummy implementation from the ovmf
tree

-
PlatformSecureLib|OvmfPkg/Library/PlatformSecureLib/PlatformSecureLib.i
nf

-!else

-
TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/Tp
mMeasurementLibNull.inf

-
AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableL
ibNull.inf

-!endif

- VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf

-
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLi
b.inf

-
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/Va
riablePolicyHelperLib.inf

- GpioLib|Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.inf

-

- #

- # PCI dependencies

- #

- # PCI root port configuation and description

-
PciHostBridgeLib|Silicon/Broadcom/Bcm27xx/Library/Bcm2711PciHostBridge
Lib/Bcm2711PciHostBridgeLib.inf

- # The "segment lib" provides the CAM accessors/etc when they aren't
ECAM standard

-
PciSegmentLib|Silicon/Broadcom/Bcm27xx/Library/Bcm2711PciSegmentLib/
PciSegmentLib.inf

-

-[LibraryClasses.common.SEC]

- PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf

- BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf

-
MemoryInitPeiLib|Platform/RaspberryPi/Library/MemoryInitPeiLib/Memory
InitPeiLib.inf

- PlatformPeiLib|ArmPlatformPkg/PlatformPei/PlatformPeiLib.inf

-
ExtractGuidedSectionLib|EmbeddedPkg/Library/PrePiExtractGuidedSectionL
ib/PrePiExtractGuidedSectionLib.inf

-
LzmaDecompressLib|MdeModulePkg/Library/LzmaCustomDecompressLib/L
zmaCustomDecompressLib.inf

- PrePiLib|EmbeddedPkg/Library/PrePiLib/PrePiLib.inf

- HobLib|EmbeddedPkg/Library/PrePiHobLib/PrePiHobLib.inf

-
PrePiHobListPointerLib|ArmPlatformPkg/Library/PrePiHobListPointerLib/Pre
PiHobListPointerLib.inf

-
MemoryAllocationLib|EmbeddedPkg/Library/PrePiMemoryAllocationLib/Pre
PiMemoryAllocationLib.inf

-

-[LibraryClasses.common.DXE_CORE]

- HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf

-
MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLi
b/DxeCoreMemoryAllocationLib.inf

-
DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint
.inf

-
ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeE
xtractGuidedSectionLib.inf

-
PerformanceLib|MdeModulePkg/Library/DxeCorePerformanceLib/DxeCore
PerformanceLib.inf

-

-[LibraryClasses.common.DXE_DRIVER]

-
SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementL
ib/DxeSecurityManagementLib.inf

-
PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerforma
nceLib.inf

-
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemo
ryAllocationLib.inf

-!if $(INCLUDE_TFTP_COMMAND) == TRUE

- ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf

- FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf

-!endif

-

-[LibraryClasses.common.UEFI_APPLICATION]

-
PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerforma
nceLib.inf

-
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemo
ryAllocationLib.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/DxeE
xtractGuidedSectionLib.inf

-
PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerforma
nceLib.inf

-
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemo
ryAllocationLib.inf

-

-[LibraryClasses.common.DXE_RUNTIME_DRIVER]

- # Runtime debug messages may crash an OS unless serial output to MMIO
mapped UARTs is inhibited

-
DebugLib|MdePkg/Library/DxeRuntimeDebugLibSerialPort/DxeRuntimeDeb
ugLibSerialPort.inf

-
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemo
ryAllocationLib.inf

-
CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.i
nf

- EfiResetSystemLib|Platform/RaspberryPi/Library/ResetLib/ResetLib.inf

- ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf

-
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLi
bRuntimeDxe.inf

-

-!if $(SECURE_BOOT_ENABLE) == 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 appended to any

-# standard flags that are defined by the build process.

-
##########################################################
#########################################

-

-[BuildOptions]

- GCC:*_*_*_CC_FLAGS = -DRPI_MODEL=4

- GCC:*_*_*_PP_FLAGS = -DRPI_MODEL=4

- GCC:*_*_*_ASLPP_FLAGS = -DRPI_MODEL=4

- GCC:*_*_*_ASLCC_FLAGS = -DRPI_MODEL=4

- GCC:*_*_*_VFRPP_FLAGS = -DRPI_MODEL=4

- GCC:RELEASE_*_*_CC_FLAGS = -DMDEPKG_NDEBUG -DNDEBUG

-

-[BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER]

- GCC:*_*_AARCH64_DLINK_FLAGS = -z common-page-size=0x10000

-

-
##########################################################
######################

-#

-# 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
Table 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

- gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport|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

-

- # 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) == 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_ER
ROR_LEVEL)

-

- 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) == 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

- gEmbeddedTokenSpaceGuid.PcdDmaDeviceLimit|0xffffffff

-

- gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString|L"EDK2-
DEV"

-

-!if $(SECURE_BOOT_ENABLE) == TRUE

- # override the default values from SecurityPkg to ensure images from all
sources are verified in secure boot

-
gEfiSecurityPkgTokenSpaceGuid.PcdOptionRomImageVerificationPolicy|0x04

-
gEfiSecurityPkgTokenSpaceGuid.PcdFixedMediaImageVerificationPolicy|0x0
4

-
gEfiSecurityPkgTokenSpaceGuid.PcdRemovableMediaImageVerificationPolic
y|0x04

-!endif

-

- gEfiNetworkPkgTokenSpaceGuid.PcdAllowHttpConnections|TRUE

-

- # Default platform supported RFC 4646 languages: (American) English

-
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLangCodes|"e
n-US"

-

-[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.i
nf

-
UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBoo
tManagerLib.inf

- BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf

-
PlatformBootManagerLib|Platform/RaspberryPi/Library/PlatformBootManag
erLib/PlatformBootManagerLib.inf

-
CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/Custo
mizedDisplayLib.inf

- FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf

- AcpiLib|EmbeddedPkg/Library/AcpiLib/AcpiLib.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|0x040000
00

- #

- # 0x00000000 - 0x001F0000 FD (PcdFdBaseAddress, PcdFdSize)

- # 0x001F0000 - 0x00200000 DTB (PcdFdtBaseAddress, PcdFdtSize)

- # 0x00200000 - ... RAM (PcdSystemMemoryBase,
PcdSystemMemorySize)

- #

- # This matches PcdFvBaseAddress, since everything less is the FD, and

- # will be reserved away.

- #

- gArmTokenSpaceGuid.PcdSystemMemoryBase|0x00200000

- gArmTokenSpaceGuid.PcdSystemMemorySize|0x3fe00000

-

- #

- # Device specific addresses

- #

- gBcm27xxTokenSpaceGuid.PcdBcm27xxRegistersAddress|0xfc000000

- gBcm27xxTokenSpaceGuid.PcdBcmGenetRegistersAddress|0xfd580000

- gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress|0xfe000000

-

- # PCIe specific addresses

- gBcm27xxTokenSpaceGuid.PcdBcm27xxPciRegBase|0xfd500000

- gBcm27xxTokenSpaceGuid.PcdBcm27xxPciBusMmioAdr|0xf8000000

- gBcm27xxTokenSpaceGuid.PcdBcm27xxPciBusMmioLen|0x3ffffff

- gBcm27xxTokenSpaceGuid.PcdBcm27xxPciCpuMmioAdr|0x600000000

-

- # UARTs

- gArmPlatformTokenSpaceGuid.PL011UartInteger|0

- gArmPlatformTokenSpaceGuid.PL011UartFractional|0

- gArmPlatformTokenSpaceGuid.PL011UartClkInHz|48000000

- gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio|TRUE

- gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterStride|4

- gEfiMdeModulePkgTokenSpaceGuid.PcdSerialClockRate|1000000000

- gEfiMdeModulePkgTokenSpaceGuid.PcdSerialFifoControl|0x27

- gEfiMdeModulePkgTokenSpaceGuid.PcdSerialExtendedTxFifoSize|8

- gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|115200

- gEfiMdePkgTokenSpaceGuid.PcdUartDefaultReceiveFifoDepth|0

-

- #

- # ARM General Interrupt Controller

- #

- gArmTokenSpaceGuid.PcdGicDistributorBase|0xFF841000

- gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase|0xFF842000

- gRaspberryPiTokenSpaceGuid.PcdGicInterruptInterfaceHBase|0xFF844000

- gRaspberryPiTokenSpaceGuid.PcdGicInterruptInterfaceVBase|0xFF846000

- gRaspberryPiTokenSpaceGuid.PcdGicGsivId|0x19

- gRaspberryPiTokenSpaceGuid.PcdGicPmuIrq0|0x30

- gRaspberryPiTokenSpaceGuid.PcdGicPmuIrq1|0x31

- gRaspberryPiTokenSpaceGuid.PcdGicPmuIrq2|0x32

- gRaspberryPiTokenSpaceGuid.PcdGicPmuIrq3|0x33

-

- #

- # Fixed CPU settings.

- #

- gRaspberryPiTokenSpaceGuid.PcdCpuLowSpeedMHz|800

- gRaspberryPiTokenSpaceGuid.PcdCpuDefSpeedMHz|1500

- gRaspberryPiTokenSpaceGuid.PcdCpuMaxSpeedMHz|2200

-

- ## Default Terminal Type

- ## 0-PCANSI, 1-VT100, 2-VT00+, 3-UTF8, 4-TTYTERM

- gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|4

-

-
gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationC
hange|FALSE

- gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{ 0x21,
0xaa, 0x2c, 0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a, 0xb6, 0xf4, 0x66,
0x23, 0x31 }

-

- gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVendor|L"EDK2"

- gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack|TRUE

-

-[PcdsDynamicHii.common.DEFAULT]

-

- #

- # Clock overrides.

- #

-

-
gRaspberryPiTokenSpaceGuid.PcdCpuClock|L"CpuClock"|gConfigDxeFormSe
tGuid|0x0|1

-
gRaspberryPiTokenSpaceGuid.PcdCustomCpuClock|L"CustomCpuClock"|gCo
nfigDxeFormSetGuid|0x0|gRaspberryPiTokenSpaceGuid.PcdCpuDefSpeedM
Hz

-

- #

- # SD-related.

- #

-

-
gRaspberryPiTokenSpaceGuid.PcdSdIsArasan|L"SdIsArasan"|gConfigDxeFor
mSetGuid|0x0|0

-
gRaspberryPiTokenSpaceGuid.PcdMmcForce1Bit|L"MmcForce1Bit"|gConfig
DxeFormSetGuid|0x0|0

-
gRaspberryPiTokenSpaceGuid.PcdMmcForceDefaultSpeed|L"MmcForceDef
aultSpeed"|gConfigDxeFormSetGuid|0x0|0

-
gRaspberryPiTokenSpaceGuid.PcdMmcSdDefaultSpeedMHz|L"MmcSdDefau
ltSpeedMHz"|gConfigDxeFormSetGuid|0x0|25

-
gRaspberryPiTokenSpaceGuid.PcdMmcSdHighSpeedMHz|L"MmcSdHighSpe
edMHz"|gConfigDxeFormSetGuid|0x0|50

-
gRaspberryPiTokenSpaceGuid.PcdMmcDisableMulti|L"MmcDisableMulti"|gC
onfigDxeFormSetGuid|0x0|0

-
gRaspberryPiTokenSpaceGuid.PcdMmcEnableDma|L"MmcEnableDma"|gCo
nfigDxeFormSetGuid|0x0|0

-

- #

- # Debug-related.

- #

-

-
gRaspberryPiTokenSpaceGuid.PcdDebugEnableJTAG|L"DebugEnableJTAG"|
gConfigDxeFormSetGuid|0x0|0

-

- #

- # Display-related.

- #

-

- #

- # Just enable native resolution by default.

- #

-
gRaspberryPiTokenSpaceGuid.PcdDisplayEnableScaledVModes|L"DisplayEna
bleScaledVModes"|gConfigDxeFormSetGuid|0x0|0x20

-
gRaspberryPiTokenSpaceGuid.PcdDisplayEnableSShot|L"DisplayEnableSShot
"|gConfigDxeFormSetGuid|0x0|1

-

- #

- # Supporting > 3GB of memory.

- #

-
gRaspberryPiTokenSpaceGuid.PcdRamMoreThan3GB|L"RamMoreThan3GB"
|gConfigDxeFormSetGuid|0x0|0

-
gRaspberryPiTokenSpaceGuid.PcdRamLimitTo3GB|L"RamLimitTo3GB"|gConf
igDxeFormSetGuid|0x0|1

-

- #

- # Device Tree and ACPI selection.

- #

- # 0 - SYSTEM_TABLE_MODE_ACPI (default)

- # 1 - SYSTEM_TABLE_MODE_BOTH

- # 2 - SYSTEM_TABLE_MODE_DT

- #

-
gRaspberryPiTokenSpaceGuid.PcdSystemTableMode|L"SystemTableMode"
|gConfigDxeFormSetGuid|0x0|0

-

- #

- # Enable a fan in the ACPI thermal zone on GPIO pin #

- #

- # 0 - DISABLED

- # 19 - Enabled on pin 19

- #

-
gRaspberryPiTokenSpaceGuid.PcdFanOnGpio|L"FanOnGpio"|gConfigDxeFor
mSetGuid|0x0|0

-
gRaspberryPiTokenSpaceGuid.PcdFanTemp|L"FanTemp"|gConfigDxeFormS
etGuid|0x0|60

-

- #

- # Reset-related.

- #

-

-
gRaspberryPiTokenSpaceGuid.PcdPlatformResetDelay|L"ResetDelay"|gRasp
berryPiTokenSpaceGuid|0x0|0

-

- #

- # Common UEFI ones.

- #

-

-
gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|L"Timeout"|gEfiGlo
balVariableGuid|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"|
gRaspberryPiTokenSpaceGuid|0x0|80

-
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn|L"Columns"|gRasp
berryPiTokenSpaceGuid|0x0|80

-
gEfiMdeModulePkgTokenSpaceGuid.PcdSetupConOutRow|L"Rows"|gRaspb
erryPiTokenSpaceGuid|0x0|25

-
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow|L"Rows"|gRaspberryPi
TokenSpaceGuid|0x0|25

-

-[PcdsDynamicDefault.common]

- #

- # Set video resolution for boot options and for text setup.

- #

- gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|0

- gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|0

-
gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoHorizontalResolution|64
0

-
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 {

- <LibraryClasses>

-
SerialPortLib|Platform/RaspberryPi/Library/DualSerialPortLib/DualSerialPortL
ib.inf

- }

-

- #

- # DXE

- #

- MdeModulePkg/Core/Dxe/DxeMain.inf {

- <LibraryClasses>

-
NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32G
uidedSectionExtractLib.inf

- }

- MdeModulePkg/Universal/PCD/Dxe/Pcd.inf {

- <LibraryClasses>

- 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.in
f

- MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
{

- <LibraryClasses>

- NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf

- DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf

- }

-!if $(SECURE_BOOT_ENABLE) == TRUE

- MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf {

- <LibraryClasses>

-
NULL|SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib
.inf

- }

-
SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfi
gDxe.inf

-!else

- MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf

-!endif

- MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf

-
MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCoun
terRuntimeDxe.inf

- EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf

- EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf {

- <LibraryClasses>

-
RealTimeClockLib|EmbeddedPkg/Library/VirtualRealTimeClockLib/VirtualRea
lTimeClockLib.inf

- }

- EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf

-

- MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf

- MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf

-
MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleD
xe.inf

- MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf

- MdeModulePkg/Universal/SerialDxe/SerialDxe.inf {

- <LibraryClasses>

-
SerialPortLib|Platform/RaspberryPi/Library/DualSerialPortLib/DualSerialPortL
ib.inf

- }

- Platform/RaspberryPi/Drivers/DisplayDxe/DisplayDxe.inf

- EmbeddedPkg/Drivers/ConsolePrefDxe/ConsolePrefDxe.inf

-

- MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.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/BootGraphicsResourceTableDxe/BootGraph
icsResourceTableDxe.inf

- Platform/RaspberryPi/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/DriverHealthManager
Dxe.inf

- MdeModulePkg/Universal/BdsDxe/BdsDxe.inf

- Platform/RaspberryPi/Drivers/LogoDxe/LogoDxe.inf

- MdeModulePkg/Application/UiApp/UiApp.inf {

- <LibraryClasses>

-
NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf

- NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf

-
NULL|Platform/RaspberryPi/Library/PlatformUiAppLib/PlatformUiAppLib.inf

-
NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMainte
nanceManagerUiLib.inf

- }

-

- #

- # SCSI Bus and Disk Driver

- #

- MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf

- MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf

-

- #

- # USB Support

- #

- MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf

- Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwUsbHostDxe.inf

- MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf

- MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf

- MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.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

- Silicon/Broadcom/Drivers/Net/BcmGenetDxe/BcmGenetDxe.inf {

- <PcdsFixedAtBuild>

- gEmbeddedTokenSpaceGuid.PcdDmaDeviceOffset|0x00000000

- gEmbeddedTokenSpaceGuid.PcdDmaDeviceLimit|0xffffffff

- }

-

- #

- # RNG

- #

- Silicon/Broadcom/Bcm283x/Drivers/Bcm2838RngDxe/Bcm2838RngDxe.inf

-

- #

- # PCI Support

- #

- ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf

- MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf

- MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf

-
EmbeddedPkg/Drivers/NonCoherentIoMmuDxe/NonCoherentIoMmuDxe.i
nf {

- <PcdsFixedAtBuild>

- gEmbeddedTokenSpaceGuid.PcdDmaDeviceOffset|0x00000000

- gEmbeddedTokenSpaceGuid.PcdDmaDeviceLimit|0xbfffffff

- }

-

- #

- # UEFI application (Shell Embedded Boot Loader)

- #

- ShellPkg/Application/Shell/Shell.inf {

- <LibraryClasses>

-
ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellComma
ndLib.inf

-
NULL|ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2Comma
ndsLib.inf

-
NULL|ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1Comma
ndsLib.inf

-
NULL|ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3Comma
ndsLib.inf

-
NULL|ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1Com
mandsLib.inf

-
NULL|ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Com
mandsLib.inf

-
NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1Com
mandsLib.inf

-
NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1
CommandsLib.inf

-
NULL|ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCo
mmandLib.inf

-
HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingL
ib.inf

- PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf

-
BcfgCommandLib|ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfg
CommandLib.inf

-

- <PcdsFixedAtBuild>

- gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0xFF

- gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE

- gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|8000

- gEfiShellPkgTokenSpaceGuid.PcdShellFileOperationSize|0x200000

- }

-!if $(INCLUDE_TFTP_COMMAND) == TRUE

-
ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.
inf {

- <PcdsFixedAtBuild>

- gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE

- }

-!endif

diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc.rej
b/Platform/RaspberryPi/RPi4/RPi4.dsc.rej
deleted file mode 100644
index 0b40df6896..0000000000
--- a/Platform/RaspberryPi/RPi4/RPi4.dsc.rej
+++ /dev/null
@@ -1,29 +0,0 @@
---- Platform/RaspberryPi/RPi4/RPi4.dsc
-+++ Platform/RaspberryPi/RPi4/RPi4.dsc
-@@ -429,7 +429,6 @@ [PcdsFixedAtBuild.common]
- gArmPlatformTokenSpaceGuid.PL011UartClkInHz|48000000
- gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio|TRUE
- gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterStride|4
-- gEfiMdeModulePkgTokenSpaceGuid.PcdSerialClockRate|1000000000
- gEfiMdeModulePkgTokenSpaceGuid.PcdSerialFifoControl|0x27
- gEfiMdeModulePkgTokenSpaceGuid.PcdSerialExtendedTxFifoSize|8
- gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|115200
-@@ -465,6 +464,9 @@ [PcdsFixedAtBuild.common]
- gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVendor|L"EDK2"
- gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack|TRUE
-
-+[PcdsPatchableInModule]
-+ gEfiMdeModulePkgTokenSpaceGuid.PcdSerialClockRate|500000000
-+
- [PcdsDynamicHii.common.DEFAULT]
-
- #
-@@ -621,7 +623,7 @@ [Components.common]
- MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
- MdeModulePkg/Universal/SerialDxe/SerialDxe.inf {
- <LibraryClasses>
--
SerialPortLib|Platform/RaspberryPi/Library/DualSerialPortLib/DualSerialPortL
ib.inf
-+
SerialPortLib|Platform/RaspberryPi/Library/DualSerialPortLib/DualSerialPort
DxeLib.inf
- }
- Platform/RaspberryPi/Drivers/DisplayDxe/DisplayDxe.inf
- EmbeddedPkg/Drivers/ConsolePrefDxe/ConsolePrefDxe.inf
--
2.29.0
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.


[edk2-platforms PATCH] Platform/RaspberryPi: Remove unnecessary files

Marcin Wojtas
 

Commit 2f0188b56ef4 ("Revert "Platform/RaspberryPi: Setup option for...")
mistakenly introduced to files which are residues from a
conflict resolution. Fix that.

Signed-off-by: Marcin Wojtas <mw@...>
---
Platform/RaspberryPi/RPi4/RPi4.dsc.orig | 760 --------------------
Platform/RaspberryPi/RPi4/RPi4.dsc.rej | 29 -
2 files changed, 789 deletions(-)
delete mode 100644 Platform/RaspberryPi/RPi4/RPi4.dsc.orig
delete mode 100644 Platform/RaspberryPi/RPi4/RPi4.dsc.rej

diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc.orig b/Platform/RaspberryPi=
/RPi4/RPi4.dsc.orig
deleted file mode 100644
index 2c05c31118..0000000000
--- a/Platform/RaspberryPi/RPi4/RPi4.dsc.orig
+++ /dev/null
@@ -1,760 +0,0 @@
-# @file=0D
-#=0D
-# Copyright (c) 2011 - 2020, ARM Limited. All rights reserved.=0D
-# Copyright (c) 2017 - 2018, Andrei Warkentin <andrey.warkentin@...=
=0D
-# Copyright (c) 2015 - 2021, Intel Corporation. All rights reserved.=0D
-# Copyright (c) 2014, Linaro Limited. All rights reserved.=0D
-#=0D
-# SPDX-License-Identifier: BSD-2-Clause-Patent=0D
-#=0D
-##=0D
-=0D
-##########################################################################=
######=0D
-#=0D
-# Defines Section - statements that will be processed to create a Makefile=
.=0D
-#=0D
-##########################################################################=
######=0D
-[Defines]=0D
- PLATFORM_NAME =3D RPi4=0D
- PLATFORM_GUID =3D a7eca3b4-21b0-4989-8c18-c08f3ae87837=
=0D
- PLATFORM_VERSION =3D 1.0=0D
- DSC_SPECIFICATION =3D 0x0001001A=0D
- OUTPUT_DIRECTORY =3D Build/$(PLATFORM_NAME)=0D
- SUPPORTED_ARCHITECTURES =3D AARCH64=0D
- BUILD_TARGETS =3D DEBUG|RELEASE|NOOPT=0D
- SKUID_IDENTIFIER =3D DEFAULT=0D
- FLASH_DEFINITION =3D Platform/RaspberryPi/$(PLATFORM_NAME)=
/$(PLATFORM_NAME).fdf=0D
-=0D
- #=0D
- # Defines for default states. These can be changed on the command line.=
=0D
- # -D FLAG=3DVALUE=0D
- #=0D
- DEFINE SECURE_BOOT_ENABLE =3D FALSE=0D
- DEFINE INCLUDE_TFTP_COMMAND =3D FALSE=0D
- DEFINE DEBUG_PRINT_ERROR_LEVEL =3D 0x8000004F=0D
-=0D
-!ifndef TFA_BUILD_ARTIFACTS=0D
- #=0D
- # Default TF-A binary checked into edk2-non-osi.=0D
- #=0D
- DEFINE TFA_BUILD_BL31 =3D Platform/RaspberryPi/$(PLATFORM_NAME)/TrustedF=
irmware/bl31.bin=0D
-!else=0D
- #=0D
- # Usually we use the checked-in binaries, but for developers working=0D
- # on the firmware, being able to use a local TF-A build without extra co=
py=0D
- # operations ends up being very helpful.=0D
- #=0D
- DEFINE TFA_BUILD_BL31 =3D $(TFA_BUILD_ARTIFACTS)/bl31.bin=0D
-!endif=0D
-=0D
-##########################################################################=
######=0D
-#=0D
-# Library Class section - list of all Library Classes needed by this Platf=
orm.=0D
-#=0D
-##########################################################################=
######=0D
-=0D
-!include MdePkg/MdeLibs.dsc.inc=0D
-=0D
-[LibraryClasses.common]=0D
-!if $(TARGET) =3D=3D RELEASE=0D
- DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf=0D
-!else=0D
- DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.in=
f=0D
-!endif=0D
- DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseD=
ebugPrintErrorLevelLib.inf=0D
-=0D
- BaseLib|MdePkg/Library/BaseLib/BaseLib.inf=0D
- SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf=0D
- BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.i=
nf=0D
- SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchroniza=
tionLib.inf=0D
- PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibN=
ull.inf=0D
- ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseRepor=
tStatusCodeLibNull.inf=0D
- PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf=0D
- PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeC=
offGetEntryPointLib.inf=0D
- PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf=0D
- IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf=0D
- UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompres=
sLib.inf=0D
- CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf=0D
-=0D
- UefiLib|MdePkg/Library/UefiLib/UefiLib.inf=0D
- HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf=0D
- UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/U=
efiRuntimeServicesTableLib.inf=0D
- DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf=0D
- UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBoo=
tServicesTableLib.inf=0D
- DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableL=
ib.inf=0D
- DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf=0D
- UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntry=
Point.inf=0D
- UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiA=
pplicationEntryPoint.inf=0D
- HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf=0D
- UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServic=
esLib.inf=0D
- SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf=0D
-=0D
- UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf=0D
- OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib=
/BaseOrderedCollectionRedBlackTreeLib.inf=0D
-=0D
- #=0D
- # Ramdisk Requirements=0D
- #=0D
- FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf=
=0D
-=0D
- # Allow dynamic PCDs=0D
- #=0D
- PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf=0D
-=0D
- # use the accelerated BaseMemoryLibOptDxe by default, overrides for SEC/=
PEI below=0D
- BaseMemoryLib|MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf=
=0D
-=0D
- #=0D
- # It is not possible to prevent the ARM compiler from inserting calls to=
intrinsic functions.=0D
- # This library provides the instrinsic functions such a compiler may gen=
erate calls to.=0D
- #=0D
- NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf=0D
-=0D
- # Add support for GCC stack protector=0D
- NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf=0D
-=0D
- # ARM Architectural Libraries=0D
- CacheMaintenanceLib|ArmPkg/Library/ArmCacheMaintenanceLib/ArmCacheMainte=
nanceLib.inf=0D
- DefaultExceptionHandlerLib|ArmPkg/Library/DefaultExceptionHandlerLib/Def=
aultExceptionHandlerLib.inf=0D
- CpuExceptionHandlerLib|ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.in=
f=0D
- ArmDisassemblerLib|ArmPkg/Library/ArmDisassemblerLib/ArmDisassemblerLib.=
inf=0D
- ArmGicLib|ArmPkg/Drivers/ArmGic/ArmGicLib.inf=0D
- ArmGicArchLib|ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf=0D
- DmaLib|EmbeddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.inf=0D
- TimeBaseLib|EmbeddedPkg/Library/TimeBaseLib/TimeBaseLib.inf=0D
- ArmPlatformStackLib|ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatfo=
rmStackLib.inf=0D
- ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf=0D
- ArmHvcLib|ArmPkg/Library/ArmHvcLib/ArmHvcLib.inf=0D
- ArmGenericTimerCounterLib|ArmPkg/Library/ArmGenericTimerPhyCounterLib/Ar=
mGenericTimerPhyCounterLib.inf=0D
-=0D
- # Dual serial port library=0D
- PL011UartClockLib|ArmPlatformPkg/Library/PL011UartClockLib/PL011UartCloc=
kLib.inf=0D
- PL011UartLib|ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.inf=0D
- SerialPortLib|Platform/RaspberryPi/Library/DualSerialPortLib/DebugDualSe=
rialPortLib.inf=0D
-=0D
- # Cryptographic libraries=0D
- RngLib|MdePkg/Library/DxeRngLib/DxeRngLib.inf=0D
- IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf=0D
- BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf=0D
- OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf=0D
- TlsLib|CryptoPkg/Library/TlsLib/TlsLib.inf=0D
-=0D
- #=0D
- # Uncomment (and comment out the next line) For RealView Debugger. The S=
tandard IO window=0D
- # in the debugger will show load and unload commands for symbols. You ca=
n cut and paste this=0D
- # into the command window to load symbols. We should be able to use a sc=
ript to do this, but=0D
- # the version of RVD I have does not support scripts accessing system me=
mory.=0D
- #=0D
- #PeCoffExtraActionLib|ArmPkg/Library/RvdPeCoffExtraActionLib/RvdPeCoffEx=
traActionLib.inf=0D
- PeCoffExtraActionLib|ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCof=
fExtraActionLib.inf=0D
- #PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePe=
CoffExtraActionLibNull.inf=0D
-=0D
- DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.i=
nf=0D
- DebugAgentTimerLib|EmbeddedPkg/Library/DebugAgentTimerLibNull/DebugAgent=
TimerLibNull.inf=0D
-=0D
- # Flattened Device Tree (FDT) access library=0D
- FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf=0D
-=0D
- # USB Libraries=0D
- UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf=0D
-=0D
- #=0D
- # Secure Boot dependencies=0D
- #=0D
-!if $(SECURE_BOOT_ENABLE) =3D=3D TRUE=0D
- TpmMeasurementLib|SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasure=
mentLib.inf=0D
- AuthVariableLib|SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf=
=0D
-=0D
- # re-use the UserPhysicalPresent() dummy implementation from the ovmf tr=
ee=0D
- PlatformSecureLib|OvmfPkg/Library/PlatformSecureLib/PlatformSecureLib.in=
f=0D
-!else=0D
- TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurem=
entLibNull.inf=0D
- AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLib=
Null.inf=0D
-!endif=0D
- VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf=0D
- VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyL=
ib.inf=0D
- VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/Var=
iablePolicyHelperLib.inf=0D
- GpioLib|Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.inf=0D
-=0D
- #=0D
- # PCI dependencies=0D
- #=0D
- # PCI root port configuation and description=0D
- PciHostBridgeLib|Silicon/Broadcom/Bcm27xx/Library/Bcm2711PciHostBridgeLi=
b/Bcm2711PciHostBridgeLib.inf=0D
- # The "segment lib" provides the CAM accessors/etc when they aren't ECAM=
standard=0D
- PciSegmentLib|Silicon/Broadcom/Bcm27xx/Library/Bcm2711PciSegmentLib/PciS=
egmentLib.inf=0D
-=0D
-[LibraryClasses.common.SEC]=0D
- PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf=0D
- BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf=0D
- MemoryInitPeiLib|Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryIni=
tPeiLib.inf=0D
- PlatformPeiLib|ArmPlatformPkg/PlatformPei/PlatformPeiLib.inf=0D
- ExtractGuidedSectionLib|EmbeddedPkg/Library/PrePiExtractGuidedSectionLib=
/PrePiExtractGuidedSectionLib.inf=0D
- LzmaDecompressLib|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCusto=
mDecompressLib.inf=0D
- PrePiLib|EmbeddedPkg/Library/PrePiLib/PrePiLib.inf=0D
- HobLib|EmbeddedPkg/Library/PrePiHobLib/PrePiHobLib.inf=0D
- PrePiHobListPointerLib|ArmPlatformPkg/Library/PrePiHobListPointerLib/Pre=
PiHobListPointerLib.inf=0D
- MemoryAllocationLib|EmbeddedPkg/Library/PrePiMemoryAllocationLib/PrePiMe=
moryAllocationLib.inf=0D
-=0D
-[LibraryClasses.common.DXE_CORE]=0D
- HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf=0D
- MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeC=
oreMemoryAllocationLib.inf=0D
- DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf=
=0D
- ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExt=
ractGuidedSectionLib.inf=0D
- PerformanceLib|MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerform=
anceLib.inf=0D
-=0D
-[LibraryClasses.common.DXE_DRIVER]=0D
- SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeS=
ecurityManagementLib.inf=0D
- PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.=
inf=0D
- MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll=
ocationLib.inf=0D
-!if $(INCLUDE_TFTP_COMMAND) =3D=3D TRUE=0D
- ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf=0D
- FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf=0D
-!endif=0D
-=0D
-[LibraryClasses.common.UEFI_APPLICATION]=0D
- PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.=
inf=0D
- MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll=
ocationLib.inf=0D
- HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf=0D
- ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf=0D
- FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf=0D
-=0D
-[LibraryClasses.common.UEFI_DRIVER]=0D
- ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExt=
ractGuidedSectionLib.inf=0D
- PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.=
inf=0D
- MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll=
ocationLib.inf=0D
-=0D
-[LibraryClasses.common.DXE_RUNTIME_DRIVER]=0D
- # Runtime debug messages may crash an OS unless serial output to MMIO ma=
pped UARTs is inhibited=0D
- DebugLib|MdePkg/Library/DxeRuntimeDebugLibSerialPort/DxeRuntimeDebugLibS=
erialPort.inf=0D
- MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll=
ocationLib.inf=0D
- CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf=
=0D
- EfiResetSystemLib|Platform/RaspberryPi/Library/ResetLib/ResetLib.inf=0D
- ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf=0D
- VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyL=
ibRuntimeDxe.inf=0D
-=0D
-!if $(SECURE_BOOT_ENABLE) =3D=3D TRUE=0D
- BaseCryptLib|CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf=0D
-!endif=0D
-=0D
-##########################################################################=
#########################=0D
-# BuildOptions Section - Define the module specific tool chain flags that =
should be used as=0D
-# the default flags for a module. These flags are a=
ppended to any=0D
-# standard flags that are defined by the build proc=
ess.=0D
-##########################################################################=
#########################=0D
-=0D
-[BuildOptions]=0D
- GCC:*_*_*_CC_FLAGS =3D -DRPI_MODEL=3D4=0D
- GCC:*_*_*_PP_FLAGS =3D -DRPI_MODEL=3D4=0D
- GCC:*_*_*_ASLPP_FLAGS =3D -DRPI_MODEL=3D4=0D
- GCC:*_*_*_ASLCC_FLAGS =3D -DRPI_MODEL=3D4=0D
- GCC:*_*_*_VFRPP_FLAGS =3D -DRPI_MODEL=3D4=0D
- GCC:RELEASE_*_*_CC_FLAGS =3D -DMDEPKG_NDEBUG -DNDEBUG=0D
-=0D
-[BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER]=0D
- GCC:*_*_AARCH64_DLINK_FLAGS =3D -z common-page-size=3D0x10000=0D
-=0D
-##########################################################################=
######=0D
-#=0D
-# Pcd Section - list of all EDK II PCD Entries defined by this Platform=0D
-#=0D
-##########################################################################=
######=0D
-=0D
-[PcdsFeatureFlag.common]=0D
- # Use the Vector Table location in CpuDxe. We will not copy the Vector T=
able at PcdCpuVectorBaseAddress=0D
- gArmTokenSpaceGuid.PcdRelocateVectorTable|FALSE=0D
-=0D
- gEmbeddedTokenSpaceGuid.PcdPrePiProduceMemoryTypeInformationHob|TRUE=0D
- gEfiMdeModulePkgTokenSpaceGuid.PcdTurnOffUsbLegacySupport|TRUE=0D
-=0D
- ## If TRUE, Graphics Output Protocol will be installed on virtual handle=
created by ConsplitterDxe.=0D
- # It could be set FALSE to save size.=0D
- gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE=0D
- gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE=0D
- gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport|FALSE=0D
-=0D
-[PcdsFixedAtBuild.common]=0D
- gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength|1000000=0D
- gEfiMdePkgTokenSpaceGuid.PcdMaximumAsciiStringLength|1000000=0D
- gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength|1000000=0D
- gEfiMdePkgTokenSpaceGuid.PcdSpinLockTimeout|10000000=0D
- gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue|0xAF=0D
- gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask|1=0D
- gEfiMdePkgTokenSpaceGuid.PcdPostCodePropertyMask|0=0D
- gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|320=0D
-=0D
- # DEBUG_ASSERT_ENABLED 0x01=0D
- # DEBUG_PRINT_ENABLED 0x02=0D
- # DEBUG_CODE_ENABLED 0x04=0D
- # CLEAR_MEMORY_ENABLED 0x08=0D
- # ASSERT_BREAKPOINT_ENABLED 0x10=0D
- # ASSERT_DEADLOOP_ENABLED 0x20=0D
-!if $(TARGET) =3D=3D RELEASE=0D
- gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x21=0D
-!else=0D
- gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x2f=0D
-!endif=0D
-=0D
- # DEBUG_INIT 0x00000001 // Initialization=0D
- # DEBUG_WARN 0x00000002 // Warnings=0D
- # DEBUG_LOAD 0x00000004 // Load events=0D
- # DEBUG_FS 0x00000008 // EFI File system=0D
- # DEBUG_POOL 0x00000010 // Alloc & Free (pool)=0D
- # DEBUG_PAGE 0x00000020 // Alloc & Free (page)=0D
- # DEBUG_INFO 0x00000040 // Informational debug messages=0D
- # DEBUG_DISPATCH 0x00000080 // PEI/DXE/SMM Dispatchers=0D
- # DEBUG_VARIABLE 0x00000100 // Variable=0D
- # DEBUG_BM 0x00000400 // Boot Manager=0D
- # DEBUG_BLKIO 0x00001000 // BlkIo Driver=0D
- # DEBUG_NET 0x00004000 // SNP Driver=0D
- # DEBUG_UNDI 0x00010000 // UNDI Driver=0D
- # DEBUG_LOADFILE 0x00020000 // LoadFile=0D
- # DEBUG_EVENT 0x00080000 // Event messages=0D
- # DEBUG_GCD 0x00100000 // Global Coherency Database changes=0D
- # DEBUG_CACHE 0x00200000 // Memory range cachability changes=0D
- # DEBUG_VERBOSE 0x00400000 // Detailed debug messages that may=0D
- # // significantly impact boot performance=
=0D
- # DEBUG_ERROR 0x80000000 // Error=0D
- gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|$(DEBUG_PRINT_ERROR_LEV=
EL)=0D
-=0D
- gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x07=0D
-=0D
- #=0D
- # Optional feature to help prevent EFI memory map fragments=0D
- # Turned on and off via: PcdPrePiProduceMemoryTypeInformationHob=0D
- # Values are in EFI Pages (4K). DXE Core will make sure that=0D
- # at least this much of each type of memory can be allocated=0D
- # from a single memory range. This way you only end up with=0D
- # maximum of two fragments for each type in the memory map=0D
- # (the memory used, and the free memory that was prereserved=0D
- # but not used).=0D
- #=0D
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory|0=0D
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS|0=0D
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType|0=0D
-!if $(SECURE_BOOT_ENABLE) =3D=3D TRUE=0D
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData|600=0D
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode|400=0D
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesCode|1500=0D
-!else=0D
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData|300=0D
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode|150=0D
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesCode|1000=0D
-!endif=0D
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesData|12000=0D
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode|20=0D
- gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData|0=0D
-=0D
- gEmbeddedTokenSpaceGuid.PcdDmaDeviceOffset|0xc0000000=0D
- gEmbeddedTokenSpaceGuid.PcdDmaDeviceLimit|0xffffffff=0D
-=0D
- gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString|L"EDK2-DEV"=0D
-=0D
-!if $(SECURE_BOOT_ENABLE) =3D=3D TRUE=0D
- # override the default values from SecurityPkg to ensure images from all=
sources are verified in secure boot=0D
- gEfiSecurityPkgTokenSpaceGuid.PcdOptionRomImageVerificationPolicy|0x04=0D
- gEfiSecurityPkgTokenSpaceGuid.PcdFixedMediaImageVerificationPolicy|0x04=
=0D
- gEfiSecurityPkgTokenSpaceGuid.PcdRemovableMediaImageVerificationPolicy|0=
x04=0D
-!endif=0D
-=0D
- gEfiNetworkPkgTokenSpaceGuid.PcdAllowHttpConnections|TRUE=0D
-=0D
- # Default platform supported RFC 4646 languages: (American) English=0D
- gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLangCodes|"en-US"=
=0D
-=0D
-[LibraryClasses.common]=0D
- ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf=0D
- ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf=0D
- ArmPlatformLib|Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf=
=0D
- TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf=0D
- CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf=
=0D
- UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManag=
erLib.inf=0D
- BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf=0D
- PlatformBootManagerLib|Platform/RaspberryPi/Library/PlatformBootManagerL=
ib/PlatformBootManagerLib.inf=0D
- CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/Customize=
dDisplayLib.inf=0D
- FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf=
=0D
- AcpiLib|EmbeddedPkg/Library/AcpiLib/AcpiLib.inf=0D
-=0D
-[LibraryClasses.common.UEFI_DRIVER]=0D
- UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf=0D
-=0D
-##########################################################################=
######=0D
-#=0D
-# Pcd Section - list of all EDK II PCD Entries defined by this Platform=0D
-#=0D
-##########################################################################=
######=0D
-=0D
-[PcdsFeatureFlag.common]=0D
- gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE=0D
- gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE=0D
- gEfiMdeModulePkgTokenSpaceGuid.PcdInstallAcpiSdtProtocol|TRUE=0D
-=0D
-[PcdsFixedAtBuild.common]=0D
- gArmPlatformTokenSpaceGuid.PcdCoreCount|4=0D
- gArmTokenSpaceGuid.PcdVFPEnabled|1=0D
-=0D
- gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize|0x4000=0D
- gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000=0D
- gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x2800=0D
-=0D
- # Size of the region used by UEFI in permanent memory (Reserved 64MB)=0D
- gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize|0x04000000=0D
- #=0D
- # 0x00000000 - 0x001F0000 FD (PcdFdBaseAddress, PcdFdSize)=0D
- # 0x001F0000 - 0x00200000 DTB (PcdFdtBaseAddress, PcdFdtSize)=0D
- # 0x00200000 - ... RAM (PcdSystemMemoryBase, PcdSystemMemorySize)=
=0D
- #=0D
- # This matches PcdFvBaseAddress, since everything less is the FD, and=0D
- # will be reserved away.=0D
- #=0D
- gArmTokenSpaceGuid.PcdSystemMemoryBase|0x00200000=0D
- gArmTokenSpaceGuid.PcdSystemMemorySize|0x3fe00000=0D
-=0D
- #=0D
- # Device specific addresses=0D
- #=0D
- gBcm27xxTokenSpaceGuid.PcdBcm27xxRegistersAddress|0xfc000000=0D
- gBcm27xxTokenSpaceGuid.PcdBcmGenetRegistersAddress|0xfd580000=0D
- gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress|0xfe000000=0D
-=0D
- # PCIe specific addresses=0D
- gBcm27xxTokenSpaceGuid.PcdBcm27xxPciRegBase|0xfd500000=0D
- gBcm27xxTokenSpaceGuid.PcdBcm27xxPciBusMmioAdr|0xf8000000=0D
- gBcm27xxTokenSpaceGuid.PcdBcm27xxPciBusMmioLen|0x3ffffff=0D
- gBcm27xxTokenSpaceGuid.PcdBcm27xxPciCpuMmioAdr|0x600000000=0D
-=0D
- # UARTs=0D
- gArmPlatformTokenSpaceGuid.PL011UartInteger|0=0D
- gArmPlatformTokenSpaceGuid.PL011UartFractional|0=0D
- gArmPlatformTokenSpaceGuid.PL011UartClkInHz|48000000=0D
- gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio|TRUE=0D
- gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterStride|4=0D
- gEfiMdeModulePkgTokenSpaceGuid.PcdSerialClockRate|1000000000=0D
- gEfiMdeModulePkgTokenSpaceGuid.PcdSerialFifoControl|0x27=0D
- gEfiMdeModulePkgTokenSpaceGuid.PcdSerialExtendedTxFifoSize|8=0D
- gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|115200=0D
- gEfiMdePkgTokenSpaceGuid.PcdUartDefaultReceiveFifoDepth|0=0D
-=0D
- #=0D
- # ARM General Interrupt Controller=0D
- #=0D
- gArmTokenSpaceGuid.PcdGicDistributorBase|0xFF841000=0D
- gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase|0xFF842000=0D
- gRaspberryPiTokenSpaceGuid.PcdGicInterruptInterfaceHBase|0xFF844000=0D
- gRaspberryPiTokenSpaceGuid.PcdGicInterruptInterfaceVBase|0xFF846000=0D
- gRaspberryPiTokenSpaceGuid.PcdGicGsivId|0x19=0D
- gRaspberryPiTokenSpaceGuid.PcdGicPmuIrq0|0x30=0D
- gRaspberryPiTokenSpaceGuid.PcdGicPmuIrq1|0x31=0D
- gRaspberryPiTokenSpaceGuid.PcdGicPmuIrq2|0x32=0D
- gRaspberryPiTokenSpaceGuid.PcdGicPmuIrq3|0x33=0D
-=0D
- #=0D
- # Fixed CPU settings.=0D
- #=0D
- gRaspberryPiTokenSpaceGuid.PcdCpuLowSpeedMHz|800=0D
- gRaspberryPiTokenSpaceGuid.PcdCpuDefSpeedMHz|1500=0D
- gRaspberryPiTokenSpaceGuid.PcdCpuMaxSpeedMHz|2200=0D
-=0D
- ## Default Terminal Type=0D
- ## 0-PCANSI, 1-VT100, 2-VT00+, 3-UTF8, 4-TTYTERM=0D
- gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|4=0D
-=0D
- gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|FAL=
SE=0D
- gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{ 0x21, 0xaa, 0x2c=
, 0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a, 0xb6, 0xf4, 0x66, 0x23, 0=
x31 }=0D
-=0D
- gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVendor|L"EDK2"=0D
- gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack|TRUE=0D
-=0D
-[PcdsDynamicHii.common.DEFAULT]=0D
-=0D
- #=0D
- # Clock overrides.=0D
- #=0D
-=0D
- gRaspberryPiTokenSpaceGuid.PcdCpuClock|L"CpuClock"|gConfigDxeFormSetGuid=
|0x0|1=0D
- gRaspberryPiTokenSpaceGuid.PcdCustomCpuClock|L"CustomCpuClock"|gConfigDx=
eFormSetGuid|0x0|gRaspberryPiTokenSpaceGuid.PcdCpuDefSpeedMHz=0D
-=0D
- #=0D
- # SD-related.=0D
- #=0D
-=0D
- gRaspberryPiTokenSpaceGuid.PcdSdIsArasan|L"SdIsArasan"|gConfigDxeFormSet=
Guid|0x0|0=0D
- gRaspberryPiTokenSpaceGuid.PcdMmcForce1Bit|L"MmcForce1Bit"|gConfigDxeFor=
mSetGuid|0x0|0=0D
- gRaspberryPiTokenSpaceGuid.PcdMmcForceDefaultSpeed|L"MmcForceDefaultSpee=
d"|gConfigDxeFormSetGuid|0x0|0=0D
- gRaspberryPiTokenSpaceGuid.PcdMmcSdDefaultSpeedMHz|L"MmcSdDefaultSpeedMH=
z"|gConfigDxeFormSetGuid|0x0|25=0D
- gRaspberryPiTokenSpaceGuid.PcdMmcSdHighSpeedMHz|L"MmcSdHighSpeedMHz"|gCo=
nfigDxeFormSetGuid|0x0|50=0D
- gRaspberryPiTokenSpaceGuid.PcdMmcDisableMulti|L"MmcDisableMulti"|gConfig=
DxeFormSetGuid|0x0|0=0D
- gRaspberryPiTokenSpaceGuid.PcdMmcEnableDma|L"MmcEnableDma"|gConfigDxeFor=
mSetGuid|0x0|0=0D
-=0D
- #=0D
- # Debug-related.=0D
- #=0D
-=0D
- gRaspberryPiTokenSpaceGuid.PcdDebugEnableJTAG|L"DebugEnableJTAG"|gConfig=
DxeFormSetGuid|0x0|0=0D
-=0D
- #=0D
- # Display-related.=0D
- #=0D
-=0D
- #=0D
- # Just enable native resolution by default.=0D
- #=0D
- gRaspberryPiTokenSpaceGuid.PcdDisplayEnableScaledVModes|L"DisplayEnableS=
caledVModes"|gConfigDxeFormSetGuid|0x0|0x20=0D
- gRaspberryPiTokenSpaceGuid.PcdDisplayEnableSShot|L"DisplayEnableSShot"|g=
ConfigDxeFormSetGuid|0x0|1=0D
-=0D
- #=0D
- # Supporting > 3GB of memory.=0D
- #=0D
- gRaspberryPiTokenSpaceGuid.PcdRamMoreThan3GB|L"RamMoreThan3GB"|gConfigDx=
eFormSetGuid|0x0|0=0D
- gRaspberryPiTokenSpaceGuid.PcdRamLimitTo3GB|L"RamLimitTo3GB"|gConfigDxeF=
ormSetGuid|0x0|1=0D
-=0D
- #=0D
- # Device Tree and ACPI selection.=0D
- #=0D
- # 0 - SYSTEM_TABLE_MODE_ACPI (default)=0D
- # 1 - SYSTEM_TABLE_MODE_BOTH=0D
- # 2 - SYSTEM_TABLE_MODE_DT=0D
- #=0D
- gRaspberryPiTokenSpaceGuid.PcdSystemTableMode|L"SystemTableMode"|gConfig=
DxeFormSetGuid|0x0|0=0D
-=0D
- #=0D
- # Enable a fan in the ACPI thermal zone on GPIO pin #=0D
- #=0D
- # 0 - DISABLED=0D
- # 19 - Enabled on pin 19=0D
- #=0D
- gRaspberryPiTokenSpaceGuid.PcdFanOnGpio|L"FanOnGpio"|gConfigDxeFormSetGu=
id|0x0|0=0D
- gRaspberryPiTokenSpaceGuid.PcdFanTemp|L"FanTemp"|gConfigDxeFormSetGuid|0=
x0|60=0D
-=0D
- #=0D
- # Reset-related.=0D
- #=0D
-=0D
- gRaspberryPiTokenSpaceGuid.PcdPlatformResetDelay|L"ResetDelay"|gRaspberr=
yPiTokenSpaceGuid|0x0|0=0D
-=0D
- #=0D
- # Common UEFI ones.=0D
- #=0D
-=0D
- gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|L"Timeout"|gEfiGlobalVar=
iableGuid|0x0|5=0D
- #=0D
- # This is silly, but by pointing SetupConXXX and ConXXX PCDs to=0D
- # the same variables, I can use the graphical configuration to=0D
- # change the mode used by ConSplitter.=0D
- #=0D
- gEfiMdeModulePkgTokenSpaceGuid.PcdSetupConOutColumn|L"Columns"|gRaspberr=
yPiTokenSpaceGuid|0x0|80=0D
- gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn|L"Columns"|gRaspberryPiTo=
kenSpaceGuid|0x0|80=0D
- gEfiMdeModulePkgTokenSpaceGuid.PcdSetupConOutRow|L"Rows"|gRaspberryPiTok=
enSpaceGuid|0x0|25=0D
- gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow|L"Rows"|gRaspberryPiTokenSpa=
ceGuid|0x0|25=0D
-=0D
-[PcdsDynamicDefault.common]=0D
- #=0D
- # Set video resolution for boot options and for text setup.=0D
- #=0D
- gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|0=0D
- gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|0=0D
- gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoHorizontalResolution|640=0D
- gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoVerticalResolution|480=0D
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0=0D
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0=0D
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0=0D
-=0D
-##########################################################################=
######=0D
-#=0D
-# Components Section - list of all EDK II Modules needed by this Platform=
=0D
-#=0D
-##########################################################################=
######=0D
-[Components.common]=0D
- #=0D
- # PEI Phase modules=0D
- #=0D
- ArmPlatformPkg/PrePi/PeiUniCore.inf {=0D
- <LibraryClasses>=0D
- SerialPortLib|Platform/RaspberryPi/Library/DualSerialPortLib/DualSer=
ialPortLib.inf=0D
- }=0D
-=0D
- #=0D
- # DXE=0D
- #=0D
- MdeModulePkg/Core/Dxe/DxeMain.inf {=0D
- <LibraryClasses>=0D
- NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32Gu=
idedSectionExtractLib.inf=0D
- }=0D
- MdeModulePkg/Universal/PCD/Dxe/Pcd.inf {=0D
- <LibraryClasses>=0D
- PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf=0D
- }=0D
-=0D
- #=0D
- # Architectural Protocols=0D
- #=0D
- ArmPkg/Drivers/CpuDxe/CpuDxe.inf=0D
- MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf=0D
- Platform/RaspberryPi/Drivers/VarBlockServiceDxe/VarBlockServiceDxe.inf=0D
- MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf=0D
- MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf {=0D
- <LibraryClasses>=0D
- NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf=0D
- DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf=0D
- }=0D
-!if $(SECURE_BOOT_ENABLE) =3D=3D TRUE=0D
- MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf {=0D
- <LibraryClasses>=0D
- NULL|SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificatio=
nLib.inf=0D
- }=0D
- SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDx=
e.inf=0D
-!else=0D
- MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf=0D
-!endif=0D
- MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf=0D
- MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntim=
eDxe.inf=0D
- EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf=0D
- EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf {=0D
- <LibraryClasses>=0D
- RealTimeClockLib|EmbeddedPkg/Library/VirtualRealTimeClockLib/Virtual=
RealTimeClockLib.inf=0D
- }=0D
- EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf=0D
-=0D
- MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf=0D
- MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf=0D
- MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf=
=0D
- MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf=0D
- MdeModulePkg/Universal/SerialDxe/SerialDxe.inf {=0D
- <LibraryClasses>=0D
- SerialPortLib|Platform/RaspberryPi/Library/DualSerialPortLib/DualSer=
ialPortLib.inf=0D
- }=0D
- Platform/RaspberryPi/Drivers/DisplayDxe/DisplayDxe.inf=0D
- EmbeddedPkg/Drivers/ConsolePrefDxe/ConsolePrefDxe.inf=0D
-=0D
- MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf=0D
-=0D
- ArmPkg/Drivers/ArmGic/ArmGicDxe.inf=0D
- Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.inf=0D
- Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.inf=0D
- Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf=0D
- ArmPkg/Drivers/TimerDxe/TimerDxe.inf=0D
- MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf=0D
- MdeModulePkg/Universal/EbcDxe/EbcDxe.inf=0D
-=0D
- #=0D
- # FAT filesystem + GPT/MBR partitioning=0D
- #=0D
- MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf=0D
- MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf=0D
- MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf=0D
- FatPkg/EnhancedFatDxe/Fat.inf=0D
-=0D
- #=0D
- # ACPI Support=0D
- #=0D
- MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf=0D
- MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsRes=
ourceTableDxe.inf=0D
- Platform/RaspberryPi/AcpiTables/AcpiTables.inf=0D
-=0D
- #=0D
- # SMBIOS Support=0D
- #=0D
- Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf=0D
- MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf=0D
-=0D
- #=0D
- # RAM Disk Support=0D
- #=0D
- MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDxe.inf=0D
-=0D
- #=0D
- # Bds=0D
- #=0D
- MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf=0D
- MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf=0D
- MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf=0D
- MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf=
=0D
- MdeModulePkg/Universal/BdsDxe/BdsDxe.inf=0D
- Platform/RaspberryPi/Drivers/LogoDxe/LogoDxe.inf=0D
- MdeModulePkg/Application/UiApp/UiApp.inf {=0D
- <LibraryClasses>=0D
- NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf=
=0D
- NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf=0D
- NULL|Platform/RaspberryPi/Library/PlatformUiAppLib/PlatformUiAppLib.=
inf=0D
- NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanc=
eManagerUiLib.inf=0D
- }=0D
-=0D
- #=0D
- # SCSI Bus and Disk Driver=0D
- #=0D
- MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf=0D
- MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf=0D
-=0D
- #=0D
- # USB Support=0D
- #=0D
- MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf=0D
- Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwUsbHostDxe.inf=0D
- MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf=0D
- MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf=0D
- MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf=0D
-=0D
- #=0D
- # SD/MMC support=0D
- #=0D
- # Platform/RaspberryPi/Drivers/SdHostDxe/SdHostDxe.inf=0D
- Platform/RaspberryPi/Drivers/ArasanMmcHostDxe/ArasanMmcHostDxe.inf=0D
- Platform/RaspberryPi/Drivers/MmcDxe/MmcDxe.inf=0D
-=0D
- #=0D
- # Networking stack=0D
- #=0D
-!include NetworkPkg/Network.dsc.inc=0D
- Silicon/Broadcom/Drivers/Net/BcmGenetDxe/BcmGenetDxe.inf {=0D
- <PcdsFixedAtBuild>=0D
- gEmbeddedTokenSpaceGuid.PcdDmaDeviceOffset|0x00000000=0D
- gEmbeddedTokenSpaceGuid.PcdDmaDeviceLimit|0xffffffff=0D
- }=0D
-=0D
- #=0D
- # RNG=0D
- #=0D
- Silicon/Broadcom/Bcm283x/Drivers/Bcm2838RngDxe/Bcm2838RngDxe.inf=0D
-=0D
- #=0D
- # PCI Support=0D
- #=0D
- ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf=0D
- MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf=0D
- MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf=0D
- EmbeddedPkg/Drivers/NonCoherentIoMmuDxe/NonCoherentIoMmuDxe.inf {=0D
- <PcdsFixedAtBuild>=0D
- gEmbeddedTokenSpaceGuid.PcdDmaDeviceOffset|0x00000000=0D
- gEmbeddedTokenSpaceGuid.PcdDmaDeviceLimit|0xbfffffff=0D
- }=0D
-=0D
- #=0D
- # UEFI application (Shell Embedded Boot Loader)=0D
- #=0D
- ShellPkg/Application/Shell/Shell.inf {=0D
- <LibraryClasses>=0D
- ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellComman=
dLib.inf=0D
- NULL|ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2Comm=
andsLib.inf=0D
- NULL|ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1Comm=
andsLib.inf=0D
- NULL|ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3Comm=
andsLib.inf=0D
- NULL|ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1Co=
mmandsLib.inf=0D
- NULL|ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Comm=
andsLib.inf=0D
- NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1=
CommandsLib.inf=0D
- NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1=
CommandsLib.inf=0D
- NULL|ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewC=
ommandLib.inf=0D
- HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandlePar=
singLib.inf=0D
- PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf=0D
- BcfgCommandLib|ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcf=
gCommandLib.inf=0D
-=0D
- <PcdsFixedAtBuild>=0D
- gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0xFF=0D
- gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE=0D
- gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|8000=0D
- gEfiShellPkgTokenSpaceGuid.PcdShellFileOperationSize|0x200000=0D
- }=0D
-!if $(INCLUDE_TFTP_COMMAND) =3D=3D TRUE=0D
- ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf {=0D
- <PcdsFixedAtBuild>=0D
- gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE=0D
- }=0D
-!endif=0D
diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc.rej b/Platform/RaspberryPi/=
RPi4/RPi4.dsc.rej
deleted file mode 100644
index 0b40df6896..0000000000
--- a/Platform/RaspberryPi/RPi4/RPi4.dsc.rej
+++ /dev/null
@@ -1,29 +0,0 @@
---- Platform/RaspberryPi/RPi4/RPi4.dsc
-+++ Platform/RaspberryPi/RPi4/RPi4.dsc
-@@ -429,7 +429,6 @@ [PcdsFixedAtBuild.common]
- gArmPlatformTokenSpaceGuid.PL011UartClkInHz|48000000
- gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio|TRUE
- gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterStride|4
-- gEfiMdeModulePkgTokenSpaceGuid.PcdSerialClockRate|1000000000
- gEfiMdeModulePkgTokenSpaceGuid.PcdSerialFifoControl|0x27
- gEfiMdeModulePkgTokenSpaceGuid.PcdSerialExtendedTxFifoSize|8
- gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|115200
-@@ -465,6 +464,9 @@ [PcdsFixedAtBuild.common]
- gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVendor|L"EDK2"
- gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack|TRUE
-=20
-+[PcdsPatchableInModule]
-+ gEfiMdeModulePkgTokenSpaceGuid.PcdSerialClockRate|500000000
-+
- [PcdsDynamicHii.common.DEFAULT]
-=20
- #
-@@ -621,7 +623,7 @@ [Components.common]
- MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
- MdeModulePkg/Universal/SerialDxe/SerialDxe.inf {
- <LibraryClasses>
-- SerialPortLib|Platform/RaspberryPi/Library/DualSerialPortLib/DualSe=
rialPortLib.inf
-+ SerialPortLib|Platform/RaspberryPi/Library/DualSerialPortLib/DualSe=
rialPortDxeLib.inf
- }
- Platform/RaspberryPi/Drivers/DisplayDxe/DisplayDxe.inf
- EmbeddedPkg/Drivers/ConsolePrefDxe/ConsolePrefDxe.inf
--=20
2.29.0


[PATCH v2] UefiCpuPkg/CpuCacheInfoLib: Correct logical for identifying cache type

Jason Lou
 

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3265

Correct the logical for identifying "Direct mapped" cache type.

Signed-off-by: Jason Lou <yun.lou@...>
Cc: Ray Ni <ray.ni@...>
Cc: Eric Dong <eric.dong@...>
Cc: Laszlo Ersek <lersek@...>
Cc: Rahul Kumar <rahul1.kumar@...>
---
UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c b/UefiCpu=
Pkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c
index ae81ea9ce2..c0077d6770 100644
--- a/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c
+++ b/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c
@@ -237,7 +237,7 @@ CpuCacheInfoCollectCoreAndCacheData (
CacheData[CacheParamLeafIndex].CacheType =3D (UINT8)CacheP=
aramEax.Bits.CacheType;=0D
CacheData[CacheParamLeafIndex].CacheWays =3D (UINT16)Cache=
ParamEbx.Bits.Ways;=0D
CacheData[CacheParamLeafIndex].FullyAssociativeCache =3D (UINT8)CacheP=
aramEax.Bits.FullyAssociativeCache;=0D
- CacheData[CacheParamLeafIndex].DirectMappedCache =3D (UINT8)CacheP=
aramEdx.Bits.ComplexCacheIndexing;=0D
+ CacheData[CacheParamLeafIndex].DirectMappedCache =3D (UINT8)(Cache=
ParamEdx.Bits.ComplexCacheIndexing =3D=3D 0);=0D
CacheData[CacheParamLeafIndex].CacheShareBits =3D (UINT16)Cache=
ParamEax.Bits.MaximumAddressableIdsForLogicalProcessors;=0D
CacheData[CacheParamLeafIndex].CacheSizeinKB =3D (CacheParamEb=
x.Bits.Ways + 1) *=0D
(CacheParamEbx.Bits.LinePartitions + 1) * (CacheParamEbx.Bits.Line=
Size + 1) * (CacheParamEcx + 1) / SIZE_1KB;=0D
--=20
2.28.0.windows.1


Re: [2021-gsoc-llvm-gnumake]: proposal for building using llvm/gnumake

Steven Shi
 

Liming,

The MSVC is required only because the Windows SDK Universal C runtime (UCRT) library depends on the MSVC.  Please see the dependency description here: “When you install Visual C++, Visual Studio setup installs the subset of the Windows 10 SDK required to use the UCRT.” https://docs.microsoft.com/en-us/cpp/c-runtime-library/crt-library-features?view=msvc-160.

 

If the MSVC is not installed, the ucrt will complain cannot find the msvc header files. Below is an example:

C:\Program Files\LLVM\bin\clang  -c  -I .. -I ../Include/Common -I ../Include/ -I ../Include/IndustryStandard -I ../Common/ -I .. -I . -I ../Include/X64/ -I "" -MD -fshort-wchar -fno-strict-aliasing -fwrapv -fno-delete-null-pointer-checks -Wall -Werror -Wno-deprecated-declarations -Wno-self-assign -Wno-unused-result -nostdlib -Wno-unused-function -g -m32 -O2  BasePeCoff.c -o BasePeCoff.o

In file included from BasePeCoff.c:13:

In file included from ../Common\CommonLib.h:14:

In file included from C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\assert.h:12:

C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\corecrt.h:10:10: fatal error: 'vcruntime.h' file not

      found

#include <vcruntime.h>

         ^~~~~~~~~~~~~

1 error generated.

 

 

 

BTW, the compiler dependency requirement also exists in Linux side. Below is the Linux GCC CRT library example. Although I build with clang, it still needs link the crt libraries in GCC installation. Below is an example:

$ /home/jshi19/llvm/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04/bin/clang -o ../bin/LzmaCompress   LzmaCompress.o Sdk/C/Alloc.o Sdk/C/LzFind.o Sdk/C/LzmaDec.o Sdk/C/LzmaEnc.o Sdk/C/7zFile.o Sdk/C/7zStream.o Sdk/C/Bra86.o -L../libs -lCommon -###

clang version 11.0.0 (https://github.com/llvm/llvm-project.git 0160ad802e899c2922bc9b29564080c22eb0908c)

Target: x86_64-unknown-linux-gnu

Thread model: posix

InstalledDir: /home/jshi19/llvm/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04/bin

"/usr/bin/ld" "-z" "relro" "--hash-style=gnu" "--eh-frame-hdr" "-m" "elf_x86_64" "-dynamic-linker" "/lib64/ld-linux-x86-64.so.2" "-o" "../bin/LzmaCompress" "/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/crt1.o" "/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/crti.o" "/usr/lib/gcc/x86_64-linux-gnu/10/crtbegin.o" "-L../libs" "-L/usr/lib/gcc/x86_64-linux-gnu/10" "-L/usr/lib/gcc/x86_64-linux-gnu/10/../../../../x86_64-linux-gnu/lib/../lib64" "-L/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu" "-L/lib/x86_64-linux-gnu" "-L/lib/../lib64" "-L/usr/lib/x86_64-linux-gnu" "-L/usr/lib/gcc/x86_64-linux-gnu/10/../../../../x86_64-linux-gnu/lib" "-L/usr/lib/gcc/x86_64-linux-gnu/10/../../.." "-L/home/jshi19/llvm/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04/bin/../lib" "-L/lib" "-L/usr/lib" "LzmaCompress.o" "Sdk/C/Alloc.o" "Sdk/C/LzFind.o" "Sdk/C/LzmaDec.o" "Sdk/C/LzmaEnc.o" "Sdk/C/7zFile.o" "Sdk/C/7zStream.o" "Sdk/C/Bra86.o" "-lCommon" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" "-lc" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" "/usr/lib/gcc/x86_64-linux-gnu/10/crtend.o" "/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/crtn.o"

 

 

 

 

Thanks

 

Steven Shi

Intel\SATG\SFP\FIA (Firmware Infrastructure Automation)

 

 

From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of gaoliming
Sent: Friday, August 13, 2021 9:18 AM
To: devel@edk2.groups.io; yuqi.chen@...
Subject: 回复: [edk2-devel] [2021-gsoc-llvm-gnumake]: proposal for building using llvm/gnumake

 

Yuqi:

 On Windows, can Clang + make combination drop the dependency of Visual studio? If I dont install Visual studio 2015 or 2017, I only install LLVM, can I fully compile BaseTools and Edk2 code?

 

Thanks

Liming

发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Yuqi Chen
发送时间: 2021812 9:52
收件人: devel@edk2.groups.io
主题: [edk2-devel] [2021-gsoc-llvm-gnumake]: proposal for building using llvm/gnumake

 

Hi,

 

I want to push my change to my codes to edk2-staging, yet it seems like I don’t have permission to do so:

 

My mentor and I have enabled edk2 building using llvm+make and gnumake+clang in windows command prompt. The attached patch indicates changes we made to make this happen.

 

I also attach the readme file to go through the steps to build Basetools.

 

Please review our codes and thank you very much for your time.

 

Best regards,

Yuqi

 


Re: [PATCH v1] UefiCpuPkg/CpuCacheInfoLib: Correct logical for identifying cache type

Jason Lou
 

Sure, I will change it in next version patch.


Re: [PATCH v4 0/6] Ovmf: Disable the TPM2 platform hierarchy

Stefan Berger
 

Yao,

  do you have any comments on this series? Would SecurityPkg be a better place for it?


    Stefan

On 8/12/21 12:59 PM, Stefan Berger wrote:
This series imports code from the edk2-platforms project related to
changing the password of the TPM2 platform hierarchy and uses it to
disable the TPM2 platform hierarchy in Ovmf and ArmVirtPkg. It
addresses the Ovmf aspects of the following bugs:

https://bugzilla.tianocore.org/show_bug.cgi?id=3510
https://bugzilla.tianocore.org/show_bug.cgi?id=3499

I have patched the .dsc files and successfully test-built with most of
them. Some I could not build because they failed for other reasons
unrelated to this series.

I tested the changes with QEMU on x86 following the build of
ArmVirtQemu.dsc and OvmfPkgX64.dsc.

The disablement of the platform hierarchy is done after possibly
handling PPI. Following TPM 2 logs on Arm, only PCR extensions are
following afterwards until GRUB takes over.

Neither one of the following commands should work anymore on first
try:

With IBM tss2 tools:
tsshierarchychangeauth -hi p -pwdn newpass

With Intel tss2 tools:
tpm2_changeauth -c platform newpass

Regards,
Stefan

v4:
- Fixed and simplified code imported from edk2-platforms

v3:
- Referencing Null implementation on Bhyve and Xen platforms
- Add support in ArmVirtPkg

Stefan Berger (6):
OvmfPkg/TPM: Import PeiDxeTpmPlatformHierarchyLib.c from
edk2-platforms
OvmfPkg/TPM: Add a NULL implementation of TpmPlatformHierarchyLib
OvmfPkg: Reference new TPM classes in the build system for compilation
OvmfPkg: Disable the TPM2 platform hierarchy
ArmVirtPkg: Reference new TPM classes in the build system for
compilation
ArmVirtPkg: Disable the TPM2 platform hierarchy

ArmVirtPkg/ArmVirtCloudHv.dsc | 1 +
ArmVirtPkg/ArmVirtQemu.dsc | 3 +
ArmVirtPkg/ArmVirtQemuKernel.dsc | 1 +
ArmVirtPkg/ArmVirtXen.dsc | 1 +
.../PlatformBootManagerLib/PlatformBm.c | 6 +
.../PlatformBootManagerLib.inf | 1 +
OvmfPkg/AmdSev/AmdSevX64.dsc | 3 +
OvmfPkg/Bhyve/BhyveX64.dsc | 1 +
.../Include/Library/TpmPlatformHierarchyLib.h | 27 +++
.../PeiDxeTpmPlatformHierarchyLib.c | 200 ++++++++++++++++++
.../PeiDxeTpmPlatformHierarchyLib.inf | 40 ++++
.../PeiDxeTpmPlatformHierarchyLib.c | 19 ++
.../PeiDxeTpmPlatformHierarchyLib.inf | 31 +++
.../PlatformBootManagerLib/BdsPlatform.c | 6 +
.../PlatformBootManagerLib.inf | 1 +
.../PlatformBootManagerLibBhyve/BdsPlatform.c | 7 +
.../PlatformBootManagerLibGrub/BdsPlatform.c | 7 +
OvmfPkg/OvmfPkgIa32.dsc | 3 +
OvmfPkg/OvmfPkgIa32X64.dsc | 3 +
OvmfPkg/OvmfPkgX64.dsc | 3 +
OvmfPkg/OvmfXen.dsc | 1 +
21 files changed, 365 insertions(+)
create mode 100644 OvmfPkg/Include/Library/TpmPlatformHierarchyLib.h
create mode 100644 OvmfPkg/Library/PeiDxeTpmPlatformHierarchyLib/PeiDxeTpmPlatformHierarchyLib.c
create mode 100644 OvmfPkg/Library/PeiDxeTpmPlatformHierarchyLib/PeiDxeTpmPlatformHierarchyLib.inf
create mode 100644 OvmfPkg/Library/PeiDxeTpmPlatformHierarchyLibNull/PeiDxeTpmPlatformHierarchyLib.c
create mode 100644 OvmfPkg/Library/PeiDxeTpmPlatformHierarchyLibNull/PeiDxeTpmPlatformHierarchyLib.inf

11741 - 11760 of 90959