From 9ad56926398a469abf859dddb711726c59e5e662 Mon Sep 17 00:00:00 2001 From: "Project Mu UEFI Bot [bot]" <45776386+uefibot@users.noreply.github.com> Date: Tue, 29 Aug 2023 21:06:42 -0400 Subject: [PATCH 1/8] Repo File Sync: Update to Mu DevOps v6.1.0 (#187) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit synced local file(s) with [microsoft/mu_devops](https://github.com/microsoft/mu_devops). 🤖: View the [Repo File Sync Configuration File](https://github.com/microsoft/mu_devops/blob/main/.sync/Files.yml) to see how files are synced. --- This PR was created automatically by the [repo-file-sync-action](https://github.com/BetaHuhn/repo-file-sync-action) workflow run [#6018366795](https://github.com/microsoft/mu_devops/actions/runs/6018366795) Signed-off-by: Project Mu UEFI Bot --- .azurepipelines/MuDevOpsWrapper.yml | 27 +++++++++- .devcontainer/devcontainer.json | 2 +- .github/workflows/auto-approve.yml | 2 +- .github/workflows/auto-merge.yml | 2 +- .github/workflows/codeql.yml | 74 +++++++++++++++++++++++++- .github/workflows/issue-assignment.yml | 2 +- .github/workflows/label-issues.yml | 2 +- .github/workflows/label-sync.yml | 2 +- .github/workflows/release-draft.yml | 2 +- .github/workflows/stale.yml | 2 +- .github/workflows/triage-issues.yml | 2 +- 11 files changed, 107 insertions(+), 12 deletions(-) diff --git a/.azurepipelines/MuDevOpsWrapper.yml b/.azurepipelines/MuDevOpsWrapper.yml index 785ead1f66..ad90ab0482 100644 --- a/.azurepipelines/MuDevOpsWrapper.yml +++ b/.azurepipelines/MuDevOpsWrapper.yml @@ -17,7 +17,7 @@ resources: type: github endpoint: microsoft name: microsoft/mu_devops - ref: refs/tags/v5.0.6 + ref: refs/tags/v6.1.0 parameters: - name: do_ci_build @@ -67,11 +67,19 @@ parameters: displayName: Extra Jobs to be run after build type: jobList default: [] +- name: rust_build + displayName: Whether Rust code is being built + type: boolean + default: false jobs: - template: Jobs/PrGate.yml@mu_devops parameters: - linux_container_image: ghcr.io/microsoft/mu_devops/ubuntu-22-build:3bf70b5 + linux_container_image: ghcr.io/microsoft/mu_devops/ubuntu-22-build:9ab29bc + ${{ if eq(parameters.rust_build, true) }}: + linux_container_options: --security-opt seccomp=unconfined + extra_steps: + - template: Steps/RustSetupSteps.yml@mu_devops do_ci_build: ${{ parameters.do_ci_build }} do_ci_setup: ${{ parameters.do_ci_setup }} do_pr_eval: ${{ parameters.do_pr_eval }} @@ -85,5 +93,20 @@ jobs: vm_image: $(vm_image) container_build: ${{ parameters.container_build }} +- ${{ if eq(parameters.rust_build, true) }}: + - job: CargoCmds + displayName: Workspace Cargo Commands + + container: + + image: ghcr.io/microsoft/mu_devops/ubuntu-22-build:9ab29bc + options: --user root --name mu_devops_build_container --security-opt seccomp=unconfined + + steps: + - checkout: self + fetchDepth: 1 + clean: true + - template: Steps/RustCargoSteps.yml@mu_devops + - ${{ parameters.extra_jobs }} diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 63489d477f..b0bc4640af 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,6 +1,6 @@ { "image": "ghcr.io/microsoft/mu_devops/ubuntu-22-dev:latest", - "postCreateCommand": "git config --global --add safe.directory '*' && pip install --upgrade -r pip-requirements.txt", + "postCreateCommand": "git config --global --add safe.directory '*' && git config --global --add core.autocrlf false && pip install --upgrade -r pip-requirements.txt", "customizations": { "vscode": { "extensions": [ diff --git a/.github/workflows/auto-approve.yml b/.github/workflows/auto-approve.yml index 6cf1816e6f..d193b36e1b 100644 --- a/.github/workflows/auto-approve.yml +++ b/.github/workflows/auto-approve.yml @@ -25,5 +25,5 @@ jobs: approval_check: if: | github.event.pull_request.user.login == 'dependabot[bot]' || github.event.pull_request.user.login == 'uefibot' - uses: microsoft/mu_devops/.github/workflows/AutoApprover.yml@v5.0.6 + uses: microsoft/mu_devops/.github/workflows/AutoApprover.yml@v6.1.0 secrets: inherit diff --git a/.github/workflows/auto-merge.yml b/.github/workflows/auto-merge.yml index 3877ddd473..b0f35aef9d 100644 --- a/.github/workflows/auto-merge.yml +++ b/.github/workflows/auto-merge.yml @@ -26,5 +26,5 @@ jobs: merge_check: if: | github.event.pull_request.user.login == 'dependabot[bot]' || github.event.pull_request.user.login == 'uefibot' - uses: microsoft/mu_devops/.github/workflows/AutoMerger.yml@v5.0.6 + uses: microsoft/mu_devops/.github/workflows/AutoMerger.yml@v6.1.0 secrets: inherit diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 981d147e61..c3432aec6e 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -105,7 +105,7 @@ jobs: git config --system core.longpaths true - name: Install/Upgrade pip Modules - run: pip install -r pip-requirements.txt --upgrade + run: pip install -r pip-requirements.txt --upgrade requests - name: Determine CI Settings File Supported Operations id: get_ci_file_operations @@ -149,6 +149,78 @@ jobs: print(f'ci_setup_supported={str(ci_setup_supported).lower()}', file=fh) print(f'setup_supported={str(setup_supported).lower()}', file=fh) + - name: Get Cargo Tool Details + id: get_cargo_tool_details + shell: python + run: | + import os + import requests + + GITHUB_REPO = "sagiegurari/cargo-make" + API_URL = f"https://api.github.com/repos/{GITHUB_REPO}/releases/latest" + + # Default value in case getting latest fails, cache will fall + # back on this version. + latest_cargo_make_version = "0.36.13" + response = requests.get(API_URL) + + if response.status_code == 200: + latest_cargo_make_version = response.json()["tag_name"] + else: + print("::error title=GitHub Release Error!::Failed to get latest cargo-make version!") + + cache_key = f'cargo-make-{latest_cargo_make_version}' + + with open(os.environ['GITHUB_OUTPUT'], 'a') as fh: + print(f'cargo_bin_path={os.path.join(os.environ["USERPROFILE"], ".cargo", "bin")}', file=fh) + print(f'cargo_make_cache_key={cache_key}', file=fh) + print(f'cargo_make_version={latest_cargo_make_version}', file=fh) + + - name: Attempt to Load cargo-make From Cache + id: cargo_make_cache + uses: actions/cache@v3 + with: + path: ${{ steps.get_cargo_tool_details.outputs.cargo_bin_path }} + key: ${{ steps.get_cargo_tool_details.outputs.cargo_make_cache_key }} + + - name: Download cargo-make + if: steps.cargo_make_cache.outputs.cache-hit != 'true' + uses: robinraju/release-downloader@v1.8 + with: + repository: 'sagiegurari/cargo-make' + tag: '${{ steps.get_cargo_tool_details.outputs.cargo_make_version }}' + fileName: 'cargo-make-v${{ steps.get_cargo_tool_details.outputs.cargo_make_version }}-x86_64-pc-windows-msvc.zip' + out-file-path: 'cargo-make-download' + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract cargo-make + if: steps.cargo_make_cache.outputs.cache-hit != 'true' + env: + CARGO_MAKE_VERSION: ${{ steps.get_cargo_tool_details.outputs.cargo_make_version }} + DEST_DIR: ${{steps.get_cargo_tool_details.outputs.cargo_bin_path }} + shell: python + run: | + import os + import shutil + import zipfile + from pathlib import Path + + DOWNLOAD_DIR = Path(os.environ["GITHUB_WORKSPACE"], "cargo-make-download") + ZIP_FILE_NAME = f"cargo-make-v{os.environ['CARGO_MAKE_VERSION']}-x86_64-pc-windows-msvc.zip" + ZIP_FILE_PATH = Path(DOWNLOAD_DIR, ZIP_FILE_NAME) + EXTRACT_DIR = Path(DOWNLOAD_DIR, "cargo-make-contents") + + with zipfile.ZipFile(ZIP_FILE_PATH, 'r') as zip_ref: + zip_ref.extractall(EXTRACT_DIR) + + for extracted_file in EXTRACT_DIR.iterdir(): + if extracted_file.name == "cargo-make.exe": + shutil.copy2(extracted_file, os.environ["DEST_DIR"]) + break + + - name: Rust Prep + run: rustup component add rust-src + - name: Setup if: steps.get_ci_file_operations.outputs.setup_supported == 'true' run: stuart_setup -c .pytool/CISettings.py -t DEBUG -a ${{ matrix.archs }} TOOL_CHAIN_TAG=${{ matrix.tool_chain_tag }} diff --git a/.github/workflows/issue-assignment.yml b/.github/workflows/issue-assignment.yml index 7a39249548..ed6607b766 100644 --- a/.github/workflows/issue-assignment.yml +++ b/.github/workflows/issue-assignment.yml @@ -18,4 +18,4 @@ on: jobs: apply: - uses: microsoft/mu_devops/.github/workflows/IssueAssignment.yml@v5.0.6 + uses: microsoft/mu_devops/.github/workflows/IssueAssignment.yml@v6.1.0 diff --git a/.github/workflows/label-issues.yml b/.github/workflows/label-issues.yml index d1f85a97d1..882956dd58 100644 --- a/.github/workflows/label-issues.yml +++ b/.github/workflows/label-issues.yml @@ -31,4 +31,4 @@ on: jobs: apply: - uses: microsoft/mu_devops/.github/workflows/Labeler.yml@v5.0.6 + uses: microsoft/mu_devops/.github/workflows/Labeler.yml@v6.1.0 diff --git a/.github/workflows/label-sync.yml b/.github/workflows/label-sync.yml index 2a51153440..e3c8c750e2 100644 --- a/.github/workflows/label-sync.yml +++ b/.github/workflows/label-sync.yml @@ -24,4 +24,4 @@ on: jobs: sync: - uses: microsoft/mu_devops/.github/workflows/LabelSyncer.yml@v5.0.6 + uses: microsoft/mu_devops/.github/workflows/LabelSyncer.yml@v6.1.0 diff --git a/.github/workflows/release-draft.yml b/.github/workflows/release-draft.yml index 50d0d4d47c..4005c4dafe 100644 --- a/.github/workflows/release-draft.yml +++ b/.github/workflows/release-draft.yml @@ -27,5 +27,5 @@ on: jobs: draft: - uses: microsoft/mu_devops/.github/workflows/ReleaseDrafter.yml@v5.0.6 + uses: microsoft/mu_devops/.github/workflows/ReleaseDrafter.yml@v6.1.0 secrets: inherit diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index ee799b1807..a6c530e771 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -24,4 +24,4 @@ on: jobs: check: - uses: microsoft/mu_devops/.github/workflows/Stale.yml@v5.0.6 + uses: microsoft/mu_devops/.github/workflows/Stale.yml@v6.1.0 diff --git a/.github/workflows/triage-issues.yml b/.github/workflows/triage-issues.yml index a8e2479e8b..940c46849d 100644 --- a/.github/workflows/triage-issues.yml +++ b/.github/workflows/triage-issues.yml @@ -19,4 +19,4 @@ on: jobs: triage: - uses: microsoft/mu_devops/.github/workflows/IssueTriager.yml@v5.0.6 + uses: microsoft/mu_devops/.github/workflows/IssueTriager.yml@v6.1.0 From 74229565954dc33cb9b2f60f1a7307d693641762 Mon Sep 17 00:00:00 2001 From: "Project Mu UEFI Bot [bot]" <45776386+uefibot@users.noreply.github.com> Date: Thu, 31 Aug 2023 13:56:19 -0400 Subject: [PATCH 2/8] Repo File Sync: Add extra_cargo_steps parameter to MuDevOpsWrapper.yml (#188) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit synced local file(s) with [microsoft/mu_devops](https://github.com/microsoft/mu_devops). 🤖: View the [Repo File Sync Configuration File](https://github.com/microsoft/mu_devops/blob/main/.sync/Files.yml) to see how files are synced. --- This PR was created automatically by the [repo-file-sync-action](https://github.com/BetaHuhn/repo-file-sync-action) workflow run [#6035269178](https://github.com/microsoft/mu_devops/actions/runs/6035269178) Signed-off-by: Project Mu UEFI Bot --- .azurepipelines/MuDevOpsWrapper.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.azurepipelines/MuDevOpsWrapper.yml b/.azurepipelines/MuDevOpsWrapper.yml index ad90ab0482..02ad14882a 100644 --- a/.azurepipelines/MuDevOpsWrapper.yml +++ b/.azurepipelines/MuDevOpsWrapper.yml @@ -71,6 +71,11 @@ parameters: displayName: Whether Rust code is being built type: boolean default: false +- name: extra_cargo_steps + displayName: Extra Steps to Run Before Standard Cargo Steps + type: stepList + default: + - script: echo No extra cargo steps provided jobs: - template: Jobs/PrGate.yml@mu_devops @@ -106,6 +111,7 @@ jobs: - checkout: self fetchDepth: 1 clean: true + - ${{ parameters.extra_cargo_steps }} - template: Steps/RustCargoSteps.yml@mu_devops - ${{ parameters.extra_jobs }} From efad2019984b99b981176e8bc20b9f8ac9d5fb24 Mon Sep 17 00:00:00 2001 From: Michael Kubacki Date: Thu, 31 Aug 2023 14:17:55 -0400 Subject: [PATCH 3/8] Convert files in repo to CRLF --- MinPlatformPkg/Acpi/MinDsdt/MinDsdt.asl | 146 +- .../FspWrapperHobProcessLib.c | 1506 ++++++++--------- .../PeiFspWrapperHobProcessLib.inf | 166 +- MinPlatformPkg/Include/AcpiS3MemoryNvData.h | 44 +- MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc | 350 ++-- MinPlatformPkg/Include/Dsc/CoreDxeInclude.dsc | 332 ++-- MinPlatformPkg/Include/Dsc/CoreDxeLib.dsc | 228 +-- MinPlatformPkg/Include/Dsc/CorePeiInclude.dsc | 88 +- MinPlatformPkg/Include/Dsc/CorePeiLib.dsc | 126 +- .../Dsc/MinPlatformFeaturesPcd.dsc.inc | 50 +- .../Include/Fdf/CoreOsBootInclude.fdf | 66 +- .../Include/Fdf/CorePostMemoryInclude.fdf | 22 +- .../SerialPortTerminalLib.c | 262 +-- .../SerialPortTerminalLib.h | 82 +- .../SerialPortTerminalLib.inf | 100 +- MinPlatformPkg/MinPlatformPkg.dec | 818 ++++----- .../PciHostBridgeLibSimple.c | 374 ++-- .../DxeCheckSmiHandlerInstrument.c | 1338 +++++++-------- .../TestPointCheckLib/PeiCheckFvInfo.c | 330 ++-- .../Library/TestPointCheckLib/PeiCheckHob.c | 734 ++++---- 20 files changed, 3581 insertions(+), 3581 deletions(-) diff --git a/MinPlatformPkg/Acpi/MinDsdt/MinDsdt.asl b/MinPlatformPkg/Acpi/MinDsdt/MinDsdt.asl index 1563b31d92..4efb8709ac 100644 --- a/MinPlatformPkg/Acpi/MinDsdt/MinDsdt.asl +++ b/MinPlatformPkg/Acpi/MinDsdt/MinDsdt.asl @@ -1,73 +1,73 @@ -/** @file - ACPI minimum DSDT table - -Copyright (c) 2018, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -DefinitionBlock ( - "DSDT.aml", - "DSDT", - 0x01, // DSDT revision. - // A Revision field value greater than or equal to 2 signifies that integers - // declared within the Definition Block are to be evaluated as 64-bit values - "INTEL ", // OEM ID (6 byte string) - "MIN ",// OEM table ID (8 byte string) - 0x00 // OEM version of DSDT table (4 byte Integer) -) - -// BEGIN OF ASL SCOPE -{ - Scope(\_SB) { - //--------------------------------------------------------------------------- - // Begin PCI tree object scope - //--------------------------------------------------------------------------- - Device(PCI0) { // PCI Bridge "Host Bridge" - Name(_HID, EISAID("PNP0A08")) // Indicates PCI Express/PCI-X Mode2 host hierarchy - Name(_CID, EISAID("PNP0A03")) // To support legacy OS that doesn't understand the new HID - Name(_SEG, 0) - Method(^BN00, 0){ return(0x0000) } // Returns default Bus number for Peer PCI busses. Name can be overriden with control method placed directly under Device scope - Method(_BBN, 0){ return(BN00()) } // Bus number, optional for the Root PCI Bus - Name(_UID, 0x0000) // Unique Bus ID, optional - Name(BUF0,ResourceTemplate() - { - // - // I/O Region Allocation 0 ( 0x0000 - 0x0CF7 ) - // - DWordIo(ResourceProducer,MinFixed,MaxFixed,PosDecode,EntireRange, - 0x00,0x0000,0x0CF7,0x00,0x0CF8,,,PI00) - // - // PCI Configuration Registers ( 0x0CF8 - 0x0CFF ) - // - Io(Decode16,0x0CF8,0x0CF8,1,0x08) - // - // PCI MMIO space - // - DWordMemory(ResourceProducer,PosDecode,MinFixed,MaxFixed,NonCacheable, - ReadWrite,0x00,0x00,0x00,0x00,0x00,,,PM01) - }) - Method(_CRS,0,Serialized) - { - // - // Create pointers to Memory Sizing values. - // - CreateDwordField(BUF0, ^PM01._MIN,M1MN) - CreateDwordField(BUF0, ^PM01._MAX,M1MX) - CreateDwordField(BUF0, ^PM01._LEN,M1LN) - - // - // Set Memory Size Values. TLUD represents bits 31:20 of phyical - // TOM, so shift these bits into the correct position and fix up - // the Memory Region available to PCI. - // - Subtract (FixedPcdGet32(PcdPciReservedMemLimit),FixedPcdGet32(PcdPciReservedMemBase),M1LN) - Store (FixedPcdGet32(PcdPciReservedMemBase), M1MN) - Subtract (FixedPcdGet32(PcdPciReservedMemLimit), 1, M1MX) - - Return(BUF0) - } - } - } -}// End of ASL File - +/** @file + ACPI minimum DSDT table + +Copyright (c) 2018, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +DefinitionBlock ( + "DSDT.aml", + "DSDT", + 0x01, // DSDT revision. + // A Revision field value greater than or equal to 2 signifies that integers + // declared within the Definition Block are to be evaluated as 64-bit values + "INTEL ", // OEM ID (6 byte string) + "MIN ",// OEM table ID (8 byte string) + 0x00 // OEM version of DSDT table (4 byte Integer) +) + +// BEGIN OF ASL SCOPE +{ + Scope(\_SB) { + //--------------------------------------------------------------------------- + // Begin PCI tree object scope + //--------------------------------------------------------------------------- + Device(PCI0) { // PCI Bridge "Host Bridge" + Name(_HID, EISAID("PNP0A08")) // Indicates PCI Express/PCI-X Mode2 host hierarchy + Name(_CID, EISAID("PNP0A03")) // To support legacy OS that doesn't understand the new HID + Name(_SEG, 0) + Method(^BN00, 0){ return(0x0000) } // Returns default Bus number for Peer PCI busses. Name can be overriden with control method placed directly under Device scope + Method(_BBN, 0){ return(BN00()) } // Bus number, optional for the Root PCI Bus + Name(_UID, 0x0000) // Unique Bus ID, optional + Name(BUF0,ResourceTemplate() + { + // + // I/O Region Allocation 0 ( 0x0000 - 0x0CF7 ) + // + DWordIo(ResourceProducer,MinFixed,MaxFixed,PosDecode,EntireRange, + 0x00,0x0000,0x0CF7,0x00,0x0CF8,,,PI00) + // + // PCI Configuration Registers ( 0x0CF8 - 0x0CFF ) + // + Io(Decode16,0x0CF8,0x0CF8,1,0x08) + // + // PCI MMIO space + // + DWordMemory(ResourceProducer,PosDecode,MinFixed,MaxFixed,NonCacheable, + ReadWrite,0x00,0x00,0x00,0x00,0x00,,,PM01) + }) + Method(_CRS,0,Serialized) + { + // + // Create pointers to Memory Sizing values. + // + CreateDwordField(BUF0, ^PM01._MIN,M1MN) + CreateDwordField(BUF0, ^PM01._MAX,M1MX) + CreateDwordField(BUF0, ^PM01._LEN,M1LN) + + // + // Set Memory Size Values. TLUD represents bits 31:20 of phyical + // TOM, so shift these bits into the correct position and fix up + // the Memory Region available to PCI. + // + Subtract (FixedPcdGet32(PcdPciReservedMemLimit),FixedPcdGet32(PcdPciReservedMemBase),M1LN) + Store (FixedPcdGet32(PcdPciReservedMemBase), M1MN) + Subtract (FixedPcdGet32(PcdPciReservedMemLimit), 1, M1MX) + + Return(BUF0) + } + } + } +}// End of ASL File + diff --git a/MinPlatformPkg/FspWrapper/Library/PeiFspWrapperHobProcessLib/FspWrapperHobProcessLib.c b/MinPlatformPkg/FspWrapper/Library/PeiFspWrapperHobProcessLib/FspWrapperHobProcessLib.c index 06c91dfdc9..9bd6fe6290 100644 --- a/MinPlatformPkg/FspWrapper/Library/PeiFspWrapperHobProcessLib/FspWrapperHobProcessLib.c +++ b/MinPlatformPkg/FspWrapper/Library/PeiFspWrapperHobProcessLib/FspWrapperHobProcessLib.c @@ -1,753 +1,753 @@ -/** @file - Provide FSP wrapper hob process related function. - -Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -// -// Additional pages are used by DXE memory manager. -// It should be consistent between RetrieveRequiredMemorySize() and GetPeiMemSize() -// -#define PEI_ADDITIONAL_MEMORY_SIZE (16 * EFI_PAGE_SIZE) - -/** - Get the mem size in memory type infromation table. - - @param[in] PeiServices PEI Services table. - - @return the mem size in memory type infromation table. -**/ -UINT64 -GetMemorySizeInMemoryTypeInformation ( - IN EFI_PEI_SERVICES **PeiServices - ) -{ - EFI_STATUS Status; - EFI_PEI_HOB_POINTERS Hob; - EFI_MEMORY_TYPE_INFORMATION *MemoryData; - UINT8 Index; - UINTN TempPageNum; - - MemoryData = NULL; - Status = (*PeiServices)->GetHobList ((CONST EFI_PEI_SERVICES**)PeiServices, (VOID **) &Hob.Raw); - ASSERT_EFI_ERROR (Status); - while (!END_OF_HOB_LIST (Hob)) { - if (Hob.Header->HobType == EFI_HOB_TYPE_GUID_EXTENSION && - CompareGuid (&Hob.Guid->Name, &gEfiMemoryTypeInformationGuid)) { - MemoryData = (EFI_MEMORY_TYPE_INFORMATION *) (Hob.Raw + sizeof (EFI_HOB_GENERIC_HEADER) + sizeof (EFI_GUID)); - break; - } - - Hob.Raw = GET_NEXT_HOB (Hob); - } - - if (MemoryData == NULL) { - return 0; - } - - TempPageNum = 0; - for (Index = 0; MemoryData[Index].Type != EfiMaxMemoryType; Index++) { - // - // Accumulate default memory size requirements - // - TempPageNum += MemoryData[Index].NumberOfPages; - } - - return TempPageNum * EFI_PAGE_SIZE; -} - -/** - Get the mem size need to be reserved in PEI phase. - - @param[in] PeiServices PEI Services table. - - @return the mem size need to be reserved in PEI phase. -**/ -UINT64 -RetrieveRequiredMemorySize ( - IN EFI_PEI_SERVICES **PeiServices - ) -{ - UINT64 Size; - - Size = GetMemorySizeInMemoryTypeInformation (PeiServices); - return Size + PEI_ADDITIONAL_MEMORY_SIZE; -} - -/** - Get the mem size need to be consumed and reserved in PEI phase. - - @param[in] PeiServices PEI Services table. - @param[in] BootMode Current boot mode. - - @return the mem size need to be consumed and reserved in PEI phase. -**/ -UINT64 -GetPeiMemSize ( - IN EFI_PEI_SERVICES **PeiServices, - IN UINT32 BootMode - ) -{ - UINT64 Size; - UINT64 MinSize; - - if (BootMode == BOOT_IN_RECOVERY_MODE) { - return PcdGet32 (PcdPeiRecoveryMinMemSize); - } - - Size = GetMemorySizeInMemoryTypeInformation (PeiServices); - - if (BootMode == BOOT_ON_FLASH_UPDATE) { - // - // Maybe more size when in CapsuleUpdate phase ? - // - MinSize = PcdGet32 (PcdPeiMinMemSize); - } else { - MinSize = PcdGet32 (PcdPeiMinMemSize); - } - - return MinSize + Size + PEI_ADDITIONAL_MEMORY_SIZE; -} - -/** - Get S3 PEI memory information. - - @note At this point, memory is ready, and PeiServices are available to use. - Platform can get some data from SMRAM directly. - - @param[out] S3PeiMemSize PEI memory size to be installed in S3 phase. - @param[out] S3PeiMemBase PEI memory base to be installed in S3 phase. - - @return If S3 PEI memory information is got successfully. -**/ -EFI_STATUS -EFIAPI -GetS3MemoryInfo ( - OUT UINT64 *S3PeiMemSize, - OUT EFI_PHYSICAL_ADDRESS *S3PeiMemBase - ) -{ - EFI_STATUS Status; - EFI_PEI_READ_ONLY_VARIABLE2_PPI *VariablePpi; - UINTN DataSize; - ACPI_S3_MEMORY S3MemoryInfo; - - *S3PeiMemBase = 0; - *S3PeiMemSize = 0; - - Status = PeiServicesLocatePpi (&gEfiPeiReadOnlyVariable2PpiGuid, 0, NULL, (VOID **) &VariablePpi); - ASSERT_EFI_ERROR (Status); - - DataSize = sizeof (S3MemoryInfo); - Status = VariablePpi->GetVariable ( - VariablePpi, - ACPI_S3_MEMORY_NV_NAME, - &gEfiAcpiVariableGuid, - NULL, - &DataSize, - &S3MemoryInfo - ); - ASSERT_EFI_ERROR (Status); - - if (EFI_ERROR (Status)) { - return Status; - } - - *S3PeiMemBase = S3MemoryInfo.S3PeiMemBase; - *S3PeiMemSize = S3MemoryInfo.S3PeiMemSize; - return EFI_SUCCESS; -} - -/** - Post FSP-M HOB process for Memory Resource Descriptor. - - @param[in] FspHobList Pointer to the HOB data structure produced by FSP. - - @return If platform process the FSP hob list successfully. -**/ -EFI_STATUS -EFIAPI -PostFspmHobProcess ( - IN VOID *FspHobList - ) -{ - EFI_PEI_HOB_POINTERS Hob; - UINT64 PeiMemSize; - EFI_PHYSICAL_ADDRESS PeiMemBase; - EFI_STATUS Status; - EFI_BOOT_MODE BootMode; - EFI_PEI_CAPSULE_PPI *Capsule; - VOID *CapsuleBuffer; - UINTN CapsuleBufferLength; - UINT64 RequiredMemSize; - UINT64 ResourceLength; - EFI_PEI_SERVICES **PeiServices; - - PeiServices = (EFI_PEI_SERVICES **)GetPeiServicesTablePointer (); - - PeiServicesGetBootMode (&BootMode); - - PeiMemBase = 0; - PeiMemSize = 0; - RequiredMemSize = 0; - ResourceLength = 0; - // - // Parse the hob list from fsp - // Report all the resource hob except MMIO and IO resource Hob's - // - if (BootMode != BOOT_ON_S3_RESUME) { - PeiMemSize = GetPeiMemSize (PeiServices, BootMode); - RequiredMemSize = RetrieveRequiredMemorySize (PeiServices); - Hob.Raw = (UINT8 *)(UINTN)FspHobList; - DEBUG((DEBUG_INFO, "FspHobList - 0x%x\n", FspHobList)); - // - // Find the largest available system Memory and use it for PeiMemory - // - while ((Hob.Raw = GetNextHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, Hob.Raw)) != NULL) { - if ((Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) - && (Hob.ResourceDescriptor->PhysicalStart + Hob.ResourceDescriptor->ResourceLength <= BASE_4GB) - && (Hob.ResourceDescriptor->PhysicalStart >= PeiMemBase) - && (Hob.ResourceDescriptor->ResourceLength >= PeiMemSize)) { - PeiMemBase = Hob.ResourceDescriptor->PhysicalStart + Hob.ResourceDescriptor->ResourceLength - PeiMemSize; - } - Hob.Raw = GET_NEXT_HOB (Hob); - } - } - - Hob.Raw = (UINT8 *)(UINTN)FspHobList; - - // - // Skip the MMIO and IO reource map from the FSP Hob list - // - while ((Hob.Raw = GetNextHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, Hob.Raw)) != NULL) { - if ((Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_IO) || (Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_MEMORY_MAPPED_IO)) { - Hob.Raw = GET_NEXT_HOB (Hob); - continue; - } - ResourceLength = Hob.ResourceDescriptor->ResourceLength; - DEBUG((DEBUG_INFO, "Resource start %lx resource length %lx resource type %d\n",Hob.ResourceDescriptor->PhysicalStart,Hob.ResourceDescriptor->ResourceLength,Hob.ResourceDescriptor->ResourceType)); - if (BootMode != BOOT_ON_S3_RESUME) { - // - // If the system memory found in FSP Hob is determined for PeiMemory. Split the Resource descriptor Hob - // - if ((Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) - && (Hob.ResourceDescriptor->PhysicalStart <= PeiMemBase) - && (Hob.ResourceDescriptor->PhysicalStart + Hob.ResourceDescriptor->ResourceLength >= PeiMemBase + PeiMemSize) - && (Hob.ResourceDescriptor->PhysicalStart + Hob.ResourceDescriptor->ResourceLength <= BASE_4GB)) { - if ((CompareGuid (&Hob.ResourceDescriptor->Owner, &gZeroGuid))) { - BuildResourceDescriptorHob ( - Hob.ResourceDescriptor->ResourceType, - Hob.ResourceDescriptor->ResourceAttribute, - PeiMemBase, - PeiMemSize - ); - } else { - BuildResourceDescriptorWithOwnerHob ( - Hob.ResourceDescriptor->ResourceType, - Hob.ResourceDescriptor->ResourceAttribute, - PeiMemBase, - PeiMemSize, - &Hob.ResourceDescriptor->Owner - ); - } - ResourceLength = (Hob.ResourceDescriptor->ResourceLength) -(PeiMemSize); - } - } - - // - // Report the resource hob - // - if ((CompareGuid (&Hob.ResourceDescriptor->Owner, &gZeroGuid))) { - BuildResourceDescriptorHob ( - Hob.ResourceDescriptor->ResourceType, - Hob.ResourceDescriptor->ResourceAttribute, - Hob.ResourceDescriptor->PhysicalStart, - ResourceLength - ); - } else { - BuildResourceDescriptorWithOwnerHob ( - Hob.ResourceDescriptor->ResourceType, - Hob.ResourceDescriptor->ResourceAttribute, - Hob.ResourceDescriptor->PhysicalStart, - ResourceLength, - &Hob.ResourceDescriptor->Owner - ); - } - - Hob.Raw = GET_NEXT_HOB (Hob); - } - - // - // @todo: It is a W/A for SetMemorySpaceAttribute issue in PchSpi and PchReset drivers. - // We need to modify it instead of hard code here. Due to InstallEfiMemory is using hard code to - // describe memory resource, we have to hard code in here. Once InstallEfiMemory is merged, we should - // be able to remove this. - // - BuildResourceDescriptorHob ( - EFI_RESOURCE_MEMORY_MAPPED_IO, - EFI_RESOURCE_ATTRIBUTE_PRESENT | EFI_RESOURCE_ATTRIBUTE_INITIALIZED | EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE, - 0xFFA00000, - 0x80000 - ); - BuildResourceDescriptorHob ( - EFI_RESOURCE_MEMORY_MAPPED_IO, - EFI_RESOURCE_ATTRIBUTE_PRESENT | EFI_RESOURCE_ATTRIBUTE_INITIALIZED | EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE, - 0xFE000000, - 0x10000 - ); - BuildResourceDescriptorHob ( - EFI_RESOURCE_MEMORY_MAPPED_IO, - EFI_RESOURCE_ATTRIBUTE_PRESENT | EFI_RESOURCE_ATTRIBUTE_INITIALIZED | EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE, - PcdGet64 (PcdPciExpressBaseAddress), - PcdGet32 (PcdPciExpressRegionLength) - ); - BuildResourceDescriptorHob ( - EFI_RESOURCE_MEMORY_MAPPED_IO, - EFI_RESOURCE_ATTRIBUTE_PRESENT | EFI_RESOURCE_ATTRIBUTE_INITIALIZED | EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE, - 0xFE010000, - 0x1000 - ); - - if (BootMode != BOOT_ON_S3_RESUME) { - // - // Capsule mode - // - Capsule = NULL; - CapsuleBuffer = NULL; - CapsuleBufferLength = 0; - if (BootMode == BOOT_ON_FLASH_UPDATE) { - Status = PeiServicesLocatePpi ( - &gEfiPeiCapsulePpiGuid, - 0, - NULL, - (VOID **) &Capsule - ); - ASSERT_EFI_ERROR (Status); - - if (Status == EFI_SUCCESS) { - Status = PeiServicesGetHobList ((void**)&Hob.Raw); - ASSERT_EFI_ERROR (Status); - while ((Hob.Raw = GetNextHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, Hob.Raw)) != NULL) { - if ((Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) - && (Hob.ResourceDescriptor->PhysicalStart + Hob.ResourceDescriptor->ResourceLength <= BASE_4GB) - && (Hob.ResourceDescriptor->PhysicalStart >= BASE_1MB) - && (Hob.ResourceDescriptor->PhysicalStart != PeiMemBase) - && (Hob.ResourceDescriptor->ResourceLength >= CapsuleBufferLength)) { - CapsuleBufferLength = (UINTN)Hob.ResourceDescriptor->ResourceLength; - CapsuleBuffer = (VOID*)(UINTN)Hob.ResourceDescriptor->PhysicalStart; - - } - Hob.Raw = GET_NEXT_HOB (Hob); - } - - // - // Call the Capsule PPI Coalesce function to coalesce the capsule data. - // - Status = Capsule->Coalesce (PeiServices, &CapsuleBuffer, &CapsuleBufferLength); - } - } - - - DEBUG((DEBUG_INFO, "FSP wrapper PeiMemBase : 0x%08x\n", PeiMemBase)); - DEBUG((DEBUG_INFO, "FSP wrapper PeiMemSize : 0x%08x\n", PeiMemSize)); - DEBUG((DEBUG_INFO, "FSP wrapper RequiredMemSize : 0x%08x\n", RequiredMemSize)); - - - // - // Install efi memory - // - Status = PeiServicesInstallPeiMemory ( - PeiMemBase, - PeiMemSize - RequiredMemSize - ); - ASSERT_EFI_ERROR (Status); - - if (Capsule != NULL) { - Status = Capsule->CreateState ((EFI_PEI_SERVICES **)PeiServices, CapsuleBuffer, CapsuleBufferLength); - } - } else { - Status = GetS3MemoryInfo (&PeiMemSize, &PeiMemBase); - ASSERT_EFI_ERROR (Status); - - DEBUG ((DEBUG_INFO, "S3 resume PeiMemBase : 0x%08x\n", PeiMemBase)); - DEBUG ((DEBUG_INFO, "S3 resume PeiMemSize : 0x%08x\n", PeiMemSize)); - - // - // Install efi memory - // - Status = PeiServicesInstallPeiMemory ( - PeiMemBase, - PeiMemSize - ); - ASSERT_EFI_ERROR (Status); - } - - // - // Create a memory allocation HOB at fixed location for MP Services PPI AP wait loop. - // Report memory region used by FSP. - // - BuildMemoryAllocationHob ( - PcdGet32 (PcdFspCpuPeiApWakeupBufferAddr), - EFI_PAGE_SIZE, - EfiBootServicesData - ); - - return EFI_SUCCESS; -} - -/** - Process FSP HOB list - - @param[in] FspHobList Pointer to the HOB data structure produced by FSP. - -**/ -VOID -ProcessFspHobList ( - IN VOID *FspHobList - ) -{ - UINT8 PhysicalAddressBits; - UINT32 RegEax; - EFI_PEI_HOB_POINTERS FspHob; - - FspHob.Raw = FspHobList; - - AsmCpuid (0x80000000, &RegEax, NULL, NULL, NULL); - if (RegEax >= 0x80000008) { - AsmCpuid (0x80000008, &RegEax, NULL, NULL, NULL); - PhysicalAddressBits = (UINT8) RegEax; - } else { - PhysicalAddressBits = 36; - } - - /// - /// Create a CPU hand-off information - /// - BuildCpuHob (PhysicalAddressBits, 16); - - // - // Add all the HOBs from FSP binary to FSP wrapper - // - while (!END_OF_HOB_LIST (FspHob)) { - if (FspHob.Header->HobType == EFI_HOB_TYPE_GUID_EXTENSION) { - // - // Skip FSP binary creates PcdDataBaseHobGuid - // - if (!CompareGuid(&FspHob.Guid->Name, &gPcdDataBaseHobGuid)) { - BuildGuidDataHob ( - &FspHob.Guid->Name, - GET_GUID_HOB_DATA(FspHob), - GET_GUID_HOB_DATA_SIZE(FspHob) - ); - } - } - FspHob.Raw = GET_NEXT_HOB (FspHob); - } -} - -VOID -CheckFspGraphicsDeviceInfoHob ( - VOID - ) -{ - EFI_PEI_HOB_POINTERS Hob; - EFI_STATUS Status; - EFI_PEI_GRAPHICS_INFO_HOB *FspGraphicsInfo = NULL; - EFI_PEI_GRAPHICS_DEVICE_INFO_HOB *FspGraphicsDeviceInfo = NULL; - EFI_PEI_GRAPHICS_DEVICE_INFO_HOB GraphicsDeviceInfo; - - Status = PeiServicesGetHobList ((VOID **)&Hob.Raw); - if (!EFI_ERROR (Status)) { - if (Hob.Raw != NULL) { - if ((Hob.Raw = GetNextGuidHob (&gEfiGraphicsInfoHobGuid, Hob.Raw)) != NULL) { - FspGraphicsInfo = GET_GUID_HOB_DATA (Hob.Guid); - } - } - } - if (FspGraphicsInfo == NULL) { - return ; - } - - Status = PeiServicesGetHobList ((VOID **)&Hob.Raw); - if (!EFI_ERROR (Status)) { - if (Hob.Raw != NULL) { - if ((Hob.Raw = GetNextGuidHob (&gEfiGraphicsDeviceInfoHobGuid, Hob.Raw)) != NULL) { - FspGraphicsDeviceInfo = GET_GUID_HOB_DATA (Hob.Guid); - } - } - } - if (FspGraphicsDeviceInfo != NULL) { - return ; - } - - // - // FSP only publish FspGraphicsInfo, but no FspGraphicsDeviceInfo. - // - // Workaround: Need publish FspGraphicsDeviceInfo, because Intel Graphics BarIndex is 1. - // - GraphicsDeviceInfo.VendorId = MAX_UINT16; - GraphicsDeviceInfo.DeviceId = MAX_UINT16; - GraphicsDeviceInfo.SubsystemVendorId = MAX_UINT16; - GraphicsDeviceInfo.SubsystemId = MAX_UINT16; - GraphicsDeviceInfo.RevisionId = MAX_UINT8; - GraphicsDeviceInfo.BarIndex = 1; - BuildGuidDataHob ( - &gEfiGraphicsDeviceInfoHobGuid, - &GraphicsDeviceInfo, - sizeof(GraphicsDeviceInfo) - ); - - return ; -} - -/** - Dump FSP SMBIOS memory info HOB - -**/ -VOID -DumpFspSmbiosMemoryInfoHob ( - VOID - ) -{ -} - - -/** - Dump FSP SMBIOS Processor Info HOB - -**/ -VOID -DumpFspSmbiosProcessorInfoHob ( - VOID - ) -{ -} - -/** - Dump FSP SMBIOS Cache Info Hob - -**/ -VOID -DumpFspSmbiosCacheInfoHob ( - VOID - ) -{ -} - -/** - Dump FSP HOB list - -**/ -VOID -DumpFspHobList ( - VOID - ) -{ - EFI_PEI_HOB_POINTERS Hob; - EFI_STATUS Status; - - Status = PeiServicesGetHobList ((VOID **)&Hob.Raw); - ASSERT_EFI_ERROR (Status); - while (!END_OF_HOB_LIST (Hob)) { - if (Hob.Header->HobType == EFI_HOB_TYPE_GUID_EXTENSION) { - DEBUG ((DEBUG_INFO, "FSP Extended GUID HOB: {%g}\n", &(Hob.Guid->Name))); - } - if ((Hob.Header->HobType == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) && - (Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_MEMORY_RESERVED)) { - DEBUG ((DEBUG_INFO, "FSP Reserved Resource HOB: %016lX ~ %016lX\n", \ - Hob.ResourceDescriptor->PhysicalStart, Hob.ResourceDescriptor->PhysicalStart \ - + Hob.ResourceDescriptor->ResourceLength)); - } - Hob.Raw = GET_NEXT_HOB (Hob); - } -} - -/** - Dump FSP memory resource - -**/ -VOID -DumpFspMemoryResource ( - VOID - ) -{ - EFI_PEI_HOB_POINTERS Hob; - EFI_STATUS Status; - - Status = PeiServicesGetHobList ((VOID **)&Hob.Raw); - ASSERT_EFI_ERROR (Status); - DEBUG ((DEBUG_INFO, "\nFSP Memory Resource\n")); - DEBUG ((DEBUG_INFO, " Resource Range Type Attribute Owner\n")); - DEBUG ((DEBUG_INFO, "================================= ==== ================ ====================================\n")); - while ((Hob.Raw = GetNextHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, Hob.Raw)) != NULL) { - if (!CompareGuid (&(Hob.ResourceDescriptor->Owner), &gZeroGuid)) { - DEBUG ((DEBUG_INFO, "%016lx-%016lx %4x %016x %g\n", - Hob.ResourceDescriptor->PhysicalStart, - Hob.ResourceDescriptor->PhysicalStart + Hob.ResourceDescriptor->ResourceLength, - Hob.ResourceDescriptor->ResourceType, - Hob.ResourceDescriptor->ResourceAttribute, - &(Hob.ResourceDescriptor->Owner) - )); - } else { - DEBUG ((DEBUG_INFO, "%016lx-%016lx %4x %016x \n", - Hob.ResourceDescriptor->PhysicalStart, - Hob.ResourceDescriptor->PhysicalStart + Hob.ResourceDescriptor->ResourceLength, - Hob.ResourceDescriptor->ResourceType, - Hob.ResourceDescriptor->ResourceAttribute - )); - } - Hob.Raw = GET_NEXT_HOB (Hob); - } - DEBUG ((DEBUG_INFO, "\n")); -} - -/** - Dump FSP memory resource - -**/ -VOID -DumpFspGraphicsInfoHob ( - VOID - ) -{ - EFI_PEI_HOB_POINTERS Hob; - EFI_STATUS Status; - EFI_PEI_GRAPHICS_INFO_HOB *FspGraphicsInfo = NULL; - - Status = PeiServicesGetHobList ((VOID **)&Hob.Raw); - if (!EFI_ERROR (Status)) { - if (Hob.Raw != NULL) { - if ((Hob.Raw = GetNextGuidHob (&gEfiGraphicsInfoHobGuid, Hob.Raw)) != NULL) { - FspGraphicsInfo = GET_GUID_HOB_DATA (Hob.Guid); - } - } - if (FspGraphicsInfo != NULL) { - DEBUG((DEBUG_INFO, "\nGraphicsInfo\n")); - DEBUG((DEBUG_INFO, " |-> FrameBufferBase : 0x%016lx\n", FspGraphicsInfo->FrameBufferBase)); - DEBUG((DEBUG_INFO, " |-> FrameBufferSize : 0x%016lx\n", FspGraphicsInfo->FrameBufferSize)); - DEBUG((DEBUG_INFO, " |-> GraphicsMode\n")); - DEBUG((DEBUG_INFO, " |-> Version : 0x%08x\n", FspGraphicsInfo->GraphicsMode.Version)); - DEBUG((DEBUG_INFO, " |-> HorizontalResolution : %d\n", FspGraphicsInfo->GraphicsMode.HorizontalResolution)); - DEBUG((DEBUG_INFO, " |-> VerticalResolution : %d\n", FspGraphicsInfo->GraphicsMode.VerticalResolution)); - DEBUG((DEBUG_INFO, " |-> PixelFormat : %d\n", FspGraphicsInfo->GraphicsMode.PixelFormat)); - DEBUG((DEBUG_INFO, " |-> PixelInformation : %d|%d|%d|%d\n", - FspGraphicsInfo->GraphicsMode.PixelInformation.RedMask, - FspGraphicsInfo->GraphicsMode.PixelInformation.GreenMask, - FspGraphicsInfo->GraphicsMode.PixelInformation.BlueMask, - FspGraphicsInfo->GraphicsMode.PixelInformation.ReservedMask - )); - DEBUG((DEBUG_INFO, " |-> PixelsPerScanLine : %d\n", FspGraphicsInfo->GraphicsMode.PixelsPerScanLine)); - DEBUG((DEBUG_INFO, "\n")); - } else { - DEBUG((DEBUG_INFO, "\nNo GraphicsInfo\n")); - } - } -} - -VOID -DumpFspGraphicsDeviceInfoHob ( - VOID - ) -{ - EFI_PEI_HOB_POINTERS Hob; - EFI_STATUS Status; - EFI_PEI_GRAPHICS_DEVICE_INFO_HOB *FspGraphicsDeviceInfo = NULL; - - Status = PeiServicesGetHobList ((VOID **)&Hob.Raw); - if (!EFI_ERROR (Status)) { - if (Hob.Raw != NULL) { - if ((Hob.Raw = GetNextGuidHob (&gEfiGraphicsDeviceInfoHobGuid, Hob.Raw)) != NULL) { - FspGraphicsDeviceInfo = GET_GUID_HOB_DATA (Hob.Guid); - } - } - if (FspGraphicsDeviceInfo != NULL) { - DEBUG((DEBUG_INFO, "\nGraphicsDeviceInfo\n")); - DEBUG((DEBUG_INFO, " |-> VendorId : 0x%04x\n", FspGraphicsDeviceInfo->VendorId)); - DEBUG((DEBUG_INFO, " |-> DeviceId : 0x%04x\n", FspGraphicsDeviceInfo->DeviceId)); - DEBUG((DEBUG_INFO, " |-> SubsystemVendorId : 0x%04x\n", FspGraphicsDeviceInfo->SubsystemVendorId)); - DEBUG((DEBUG_INFO, " |-> SubsystemId : 0x%04x\n", FspGraphicsDeviceInfo->SubsystemId)); - DEBUG((DEBUG_INFO, " |-> RevisionId : 0x%02x\n", FspGraphicsDeviceInfo->RevisionId)); - DEBUG((DEBUG_INFO, " |-> BarIndex : 0x%02x\n", FspGraphicsDeviceInfo->BarIndex)); - DEBUG((DEBUG_INFO, "\n")); - } else { - DEBUG((DEBUG_INFO, "\nNo GraphicsDeviceInfo\n")); - } - } -} - -EFI_PEI_PPI_DESCRIPTOR mSiliconInitializedDesc = { - (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST), - &gEdkiiSiliconInitializedPpiGuid, - NULL -}; - -/** - Post FSP-S HOB process (not Memory Resource Descriptor). - - @param[in] FspHobList Pointer to the HOB data structure produced by FSP. - - @return If platform process the FSP hob list successfully. -**/ -EFI_STATUS -EFIAPI -PostFspsHobProcess ( - IN VOID *FspHobList - ) -{ - EFI_STATUS Status; - - if (PcdGet8 (PcdFspModeSelection) == 1) { - // - // Only in FSP API mode the wrapper has to build hobs basing on FSP output data. - // - ASSERT (FspHobList != NULL); - ProcessFspHobList (FspHobList); - } else { - // - // Only in FSP Dispatch mode, FSP-S should be reported to DXE dispatcher. - // - BuildFvHob ( - (EFI_PHYSICAL_ADDRESS) (UINTN) PcdGet32 (PcdFlashFvFspSBase), - PcdGet32 (PcdFlashFvFspSSize) - ); - } - CheckFspGraphicsDeviceInfoHob (); - DEBUG_CODE_BEGIN (); - DumpFspSmbiosMemoryInfoHob (); - DumpFspSmbiosProcessorInfoHob(); - DumpFspSmbiosCacheInfoHob(); - DumpFspGraphicsInfoHob (); - DumpFspGraphicsDeviceInfoHob (); - DumpFspHobList (); - DumpFspMemoryResource (); - DEBUG_CODE_END (); - - Status = PeiServicesInstallPpi (&mSiliconInitializedDesc); - ASSERT_EFI_ERROR (Status); - - return EFI_SUCCESS; -} +/** @file + Provide FSP wrapper hob process related function. + +Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +// +// Additional pages are used by DXE memory manager. +// It should be consistent between RetrieveRequiredMemorySize() and GetPeiMemSize() +// +#define PEI_ADDITIONAL_MEMORY_SIZE (16 * EFI_PAGE_SIZE) + +/** + Get the mem size in memory type infromation table. + + @param[in] PeiServices PEI Services table. + + @return the mem size in memory type infromation table. +**/ +UINT64 +GetMemorySizeInMemoryTypeInformation ( + IN EFI_PEI_SERVICES **PeiServices + ) +{ + EFI_STATUS Status; + EFI_PEI_HOB_POINTERS Hob; + EFI_MEMORY_TYPE_INFORMATION *MemoryData; + UINT8 Index; + UINTN TempPageNum; + + MemoryData = NULL; + Status = (*PeiServices)->GetHobList ((CONST EFI_PEI_SERVICES**)PeiServices, (VOID **) &Hob.Raw); + ASSERT_EFI_ERROR (Status); + while (!END_OF_HOB_LIST (Hob)) { + if (Hob.Header->HobType == EFI_HOB_TYPE_GUID_EXTENSION && + CompareGuid (&Hob.Guid->Name, &gEfiMemoryTypeInformationGuid)) { + MemoryData = (EFI_MEMORY_TYPE_INFORMATION *) (Hob.Raw + sizeof (EFI_HOB_GENERIC_HEADER) + sizeof (EFI_GUID)); + break; + } + + Hob.Raw = GET_NEXT_HOB (Hob); + } + + if (MemoryData == NULL) { + return 0; + } + + TempPageNum = 0; + for (Index = 0; MemoryData[Index].Type != EfiMaxMemoryType; Index++) { + // + // Accumulate default memory size requirements + // + TempPageNum += MemoryData[Index].NumberOfPages; + } + + return TempPageNum * EFI_PAGE_SIZE; +} + +/** + Get the mem size need to be reserved in PEI phase. + + @param[in] PeiServices PEI Services table. + + @return the mem size need to be reserved in PEI phase. +**/ +UINT64 +RetrieveRequiredMemorySize ( + IN EFI_PEI_SERVICES **PeiServices + ) +{ + UINT64 Size; + + Size = GetMemorySizeInMemoryTypeInformation (PeiServices); + return Size + PEI_ADDITIONAL_MEMORY_SIZE; +} + +/** + Get the mem size need to be consumed and reserved in PEI phase. + + @param[in] PeiServices PEI Services table. + @param[in] BootMode Current boot mode. + + @return the mem size need to be consumed and reserved in PEI phase. +**/ +UINT64 +GetPeiMemSize ( + IN EFI_PEI_SERVICES **PeiServices, + IN UINT32 BootMode + ) +{ + UINT64 Size; + UINT64 MinSize; + + if (BootMode == BOOT_IN_RECOVERY_MODE) { + return PcdGet32 (PcdPeiRecoveryMinMemSize); + } + + Size = GetMemorySizeInMemoryTypeInformation (PeiServices); + + if (BootMode == BOOT_ON_FLASH_UPDATE) { + // + // Maybe more size when in CapsuleUpdate phase ? + // + MinSize = PcdGet32 (PcdPeiMinMemSize); + } else { + MinSize = PcdGet32 (PcdPeiMinMemSize); + } + + return MinSize + Size + PEI_ADDITIONAL_MEMORY_SIZE; +} + +/** + Get S3 PEI memory information. + + @note At this point, memory is ready, and PeiServices are available to use. + Platform can get some data from SMRAM directly. + + @param[out] S3PeiMemSize PEI memory size to be installed in S3 phase. + @param[out] S3PeiMemBase PEI memory base to be installed in S3 phase. + + @return If S3 PEI memory information is got successfully. +**/ +EFI_STATUS +EFIAPI +GetS3MemoryInfo ( + OUT UINT64 *S3PeiMemSize, + OUT EFI_PHYSICAL_ADDRESS *S3PeiMemBase + ) +{ + EFI_STATUS Status; + EFI_PEI_READ_ONLY_VARIABLE2_PPI *VariablePpi; + UINTN DataSize; + ACPI_S3_MEMORY S3MemoryInfo; + + *S3PeiMemBase = 0; + *S3PeiMemSize = 0; + + Status = PeiServicesLocatePpi (&gEfiPeiReadOnlyVariable2PpiGuid, 0, NULL, (VOID **) &VariablePpi); + ASSERT_EFI_ERROR (Status); + + DataSize = sizeof (S3MemoryInfo); + Status = VariablePpi->GetVariable ( + VariablePpi, + ACPI_S3_MEMORY_NV_NAME, + &gEfiAcpiVariableGuid, + NULL, + &DataSize, + &S3MemoryInfo + ); + ASSERT_EFI_ERROR (Status); + + if (EFI_ERROR (Status)) { + return Status; + } + + *S3PeiMemBase = S3MemoryInfo.S3PeiMemBase; + *S3PeiMemSize = S3MemoryInfo.S3PeiMemSize; + return EFI_SUCCESS; +} + +/** + Post FSP-M HOB process for Memory Resource Descriptor. + + @param[in] FspHobList Pointer to the HOB data structure produced by FSP. + + @return If platform process the FSP hob list successfully. +**/ +EFI_STATUS +EFIAPI +PostFspmHobProcess ( + IN VOID *FspHobList + ) +{ + EFI_PEI_HOB_POINTERS Hob; + UINT64 PeiMemSize; + EFI_PHYSICAL_ADDRESS PeiMemBase; + EFI_STATUS Status; + EFI_BOOT_MODE BootMode; + EFI_PEI_CAPSULE_PPI *Capsule; + VOID *CapsuleBuffer; + UINTN CapsuleBufferLength; + UINT64 RequiredMemSize; + UINT64 ResourceLength; + EFI_PEI_SERVICES **PeiServices; + + PeiServices = (EFI_PEI_SERVICES **)GetPeiServicesTablePointer (); + + PeiServicesGetBootMode (&BootMode); + + PeiMemBase = 0; + PeiMemSize = 0; + RequiredMemSize = 0; + ResourceLength = 0; + // + // Parse the hob list from fsp + // Report all the resource hob except MMIO and IO resource Hob's + // + if (BootMode != BOOT_ON_S3_RESUME) { + PeiMemSize = GetPeiMemSize (PeiServices, BootMode); + RequiredMemSize = RetrieveRequiredMemorySize (PeiServices); + Hob.Raw = (UINT8 *)(UINTN)FspHobList; + DEBUG((DEBUG_INFO, "FspHobList - 0x%x\n", FspHobList)); + // + // Find the largest available system Memory and use it for PeiMemory + // + while ((Hob.Raw = GetNextHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, Hob.Raw)) != NULL) { + if ((Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) + && (Hob.ResourceDescriptor->PhysicalStart + Hob.ResourceDescriptor->ResourceLength <= BASE_4GB) + && (Hob.ResourceDescriptor->PhysicalStart >= PeiMemBase) + && (Hob.ResourceDescriptor->ResourceLength >= PeiMemSize)) { + PeiMemBase = Hob.ResourceDescriptor->PhysicalStart + Hob.ResourceDescriptor->ResourceLength - PeiMemSize; + } + Hob.Raw = GET_NEXT_HOB (Hob); + } + } + + Hob.Raw = (UINT8 *)(UINTN)FspHobList; + + // + // Skip the MMIO and IO reource map from the FSP Hob list + // + while ((Hob.Raw = GetNextHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, Hob.Raw)) != NULL) { + if ((Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_IO) || (Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_MEMORY_MAPPED_IO)) { + Hob.Raw = GET_NEXT_HOB (Hob); + continue; + } + ResourceLength = Hob.ResourceDescriptor->ResourceLength; + DEBUG((DEBUG_INFO, "Resource start %lx resource length %lx resource type %d\n",Hob.ResourceDescriptor->PhysicalStart,Hob.ResourceDescriptor->ResourceLength,Hob.ResourceDescriptor->ResourceType)); + if (BootMode != BOOT_ON_S3_RESUME) { + // + // If the system memory found in FSP Hob is determined for PeiMemory. Split the Resource descriptor Hob + // + if ((Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) + && (Hob.ResourceDescriptor->PhysicalStart <= PeiMemBase) + && (Hob.ResourceDescriptor->PhysicalStart + Hob.ResourceDescriptor->ResourceLength >= PeiMemBase + PeiMemSize) + && (Hob.ResourceDescriptor->PhysicalStart + Hob.ResourceDescriptor->ResourceLength <= BASE_4GB)) { + if ((CompareGuid (&Hob.ResourceDescriptor->Owner, &gZeroGuid))) { + BuildResourceDescriptorHob ( + Hob.ResourceDescriptor->ResourceType, + Hob.ResourceDescriptor->ResourceAttribute, + PeiMemBase, + PeiMemSize + ); + } else { + BuildResourceDescriptorWithOwnerHob ( + Hob.ResourceDescriptor->ResourceType, + Hob.ResourceDescriptor->ResourceAttribute, + PeiMemBase, + PeiMemSize, + &Hob.ResourceDescriptor->Owner + ); + } + ResourceLength = (Hob.ResourceDescriptor->ResourceLength) -(PeiMemSize); + } + } + + // + // Report the resource hob + // + if ((CompareGuid (&Hob.ResourceDescriptor->Owner, &gZeroGuid))) { + BuildResourceDescriptorHob ( + Hob.ResourceDescriptor->ResourceType, + Hob.ResourceDescriptor->ResourceAttribute, + Hob.ResourceDescriptor->PhysicalStart, + ResourceLength + ); + } else { + BuildResourceDescriptorWithOwnerHob ( + Hob.ResourceDescriptor->ResourceType, + Hob.ResourceDescriptor->ResourceAttribute, + Hob.ResourceDescriptor->PhysicalStart, + ResourceLength, + &Hob.ResourceDescriptor->Owner + ); + } + + Hob.Raw = GET_NEXT_HOB (Hob); + } + + // + // @todo: It is a W/A for SetMemorySpaceAttribute issue in PchSpi and PchReset drivers. + // We need to modify it instead of hard code here. Due to InstallEfiMemory is using hard code to + // describe memory resource, we have to hard code in here. Once InstallEfiMemory is merged, we should + // be able to remove this. + // + BuildResourceDescriptorHob ( + EFI_RESOURCE_MEMORY_MAPPED_IO, + EFI_RESOURCE_ATTRIBUTE_PRESENT | EFI_RESOURCE_ATTRIBUTE_INITIALIZED | EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE, + 0xFFA00000, + 0x80000 + ); + BuildResourceDescriptorHob ( + EFI_RESOURCE_MEMORY_MAPPED_IO, + EFI_RESOURCE_ATTRIBUTE_PRESENT | EFI_RESOURCE_ATTRIBUTE_INITIALIZED | EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE, + 0xFE000000, + 0x10000 + ); + BuildResourceDescriptorHob ( + EFI_RESOURCE_MEMORY_MAPPED_IO, + EFI_RESOURCE_ATTRIBUTE_PRESENT | EFI_RESOURCE_ATTRIBUTE_INITIALIZED | EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE, + PcdGet64 (PcdPciExpressBaseAddress), + PcdGet32 (PcdPciExpressRegionLength) + ); + BuildResourceDescriptorHob ( + EFI_RESOURCE_MEMORY_MAPPED_IO, + EFI_RESOURCE_ATTRIBUTE_PRESENT | EFI_RESOURCE_ATTRIBUTE_INITIALIZED | EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE, + 0xFE010000, + 0x1000 + ); + + if (BootMode != BOOT_ON_S3_RESUME) { + // + // Capsule mode + // + Capsule = NULL; + CapsuleBuffer = NULL; + CapsuleBufferLength = 0; + if (BootMode == BOOT_ON_FLASH_UPDATE) { + Status = PeiServicesLocatePpi ( + &gEfiPeiCapsulePpiGuid, + 0, + NULL, + (VOID **) &Capsule + ); + ASSERT_EFI_ERROR (Status); + + if (Status == EFI_SUCCESS) { + Status = PeiServicesGetHobList ((void**)&Hob.Raw); + ASSERT_EFI_ERROR (Status); + while ((Hob.Raw = GetNextHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, Hob.Raw)) != NULL) { + if ((Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) + && (Hob.ResourceDescriptor->PhysicalStart + Hob.ResourceDescriptor->ResourceLength <= BASE_4GB) + && (Hob.ResourceDescriptor->PhysicalStart >= BASE_1MB) + && (Hob.ResourceDescriptor->PhysicalStart != PeiMemBase) + && (Hob.ResourceDescriptor->ResourceLength >= CapsuleBufferLength)) { + CapsuleBufferLength = (UINTN)Hob.ResourceDescriptor->ResourceLength; + CapsuleBuffer = (VOID*)(UINTN)Hob.ResourceDescriptor->PhysicalStart; + + } + Hob.Raw = GET_NEXT_HOB (Hob); + } + + // + // Call the Capsule PPI Coalesce function to coalesce the capsule data. + // + Status = Capsule->Coalesce (PeiServices, &CapsuleBuffer, &CapsuleBufferLength); + } + } + + + DEBUG((DEBUG_INFO, "FSP wrapper PeiMemBase : 0x%08x\n", PeiMemBase)); + DEBUG((DEBUG_INFO, "FSP wrapper PeiMemSize : 0x%08x\n", PeiMemSize)); + DEBUG((DEBUG_INFO, "FSP wrapper RequiredMemSize : 0x%08x\n", RequiredMemSize)); + + + // + // Install efi memory + // + Status = PeiServicesInstallPeiMemory ( + PeiMemBase, + PeiMemSize - RequiredMemSize + ); + ASSERT_EFI_ERROR (Status); + + if (Capsule != NULL) { + Status = Capsule->CreateState ((EFI_PEI_SERVICES **)PeiServices, CapsuleBuffer, CapsuleBufferLength); + } + } else { + Status = GetS3MemoryInfo (&PeiMemSize, &PeiMemBase); + ASSERT_EFI_ERROR (Status); + + DEBUG ((DEBUG_INFO, "S3 resume PeiMemBase : 0x%08x\n", PeiMemBase)); + DEBUG ((DEBUG_INFO, "S3 resume PeiMemSize : 0x%08x\n", PeiMemSize)); + + // + // Install efi memory + // + Status = PeiServicesInstallPeiMemory ( + PeiMemBase, + PeiMemSize + ); + ASSERT_EFI_ERROR (Status); + } + + // + // Create a memory allocation HOB at fixed location for MP Services PPI AP wait loop. + // Report memory region used by FSP. + // + BuildMemoryAllocationHob ( + PcdGet32 (PcdFspCpuPeiApWakeupBufferAddr), + EFI_PAGE_SIZE, + EfiBootServicesData + ); + + return EFI_SUCCESS; +} + +/** + Process FSP HOB list + + @param[in] FspHobList Pointer to the HOB data structure produced by FSP. + +**/ +VOID +ProcessFspHobList ( + IN VOID *FspHobList + ) +{ + UINT8 PhysicalAddressBits; + UINT32 RegEax; + EFI_PEI_HOB_POINTERS FspHob; + + FspHob.Raw = FspHobList; + + AsmCpuid (0x80000000, &RegEax, NULL, NULL, NULL); + if (RegEax >= 0x80000008) { + AsmCpuid (0x80000008, &RegEax, NULL, NULL, NULL); + PhysicalAddressBits = (UINT8) RegEax; + } else { + PhysicalAddressBits = 36; + } + + /// + /// Create a CPU hand-off information + /// + BuildCpuHob (PhysicalAddressBits, 16); + + // + // Add all the HOBs from FSP binary to FSP wrapper + // + while (!END_OF_HOB_LIST (FspHob)) { + if (FspHob.Header->HobType == EFI_HOB_TYPE_GUID_EXTENSION) { + // + // Skip FSP binary creates PcdDataBaseHobGuid + // + if (!CompareGuid(&FspHob.Guid->Name, &gPcdDataBaseHobGuid)) { + BuildGuidDataHob ( + &FspHob.Guid->Name, + GET_GUID_HOB_DATA(FspHob), + GET_GUID_HOB_DATA_SIZE(FspHob) + ); + } + } + FspHob.Raw = GET_NEXT_HOB (FspHob); + } +} + +VOID +CheckFspGraphicsDeviceInfoHob ( + VOID + ) +{ + EFI_PEI_HOB_POINTERS Hob; + EFI_STATUS Status; + EFI_PEI_GRAPHICS_INFO_HOB *FspGraphicsInfo = NULL; + EFI_PEI_GRAPHICS_DEVICE_INFO_HOB *FspGraphicsDeviceInfo = NULL; + EFI_PEI_GRAPHICS_DEVICE_INFO_HOB GraphicsDeviceInfo; + + Status = PeiServicesGetHobList ((VOID **)&Hob.Raw); + if (!EFI_ERROR (Status)) { + if (Hob.Raw != NULL) { + if ((Hob.Raw = GetNextGuidHob (&gEfiGraphicsInfoHobGuid, Hob.Raw)) != NULL) { + FspGraphicsInfo = GET_GUID_HOB_DATA (Hob.Guid); + } + } + } + if (FspGraphicsInfo == NULL) { + return ; + } + + Status = PeiServicesGetHobList ((VOID **)&Hob.Raw); + if (!EFI_ERROR (Status)) { + if (Hob.Raw != NULL) { + if ((Hob.Raw = GetNextGuidHob (&gEfiGraphicsDeviceInfoHobGuid, Hob.Raw)) != NULL) { + FspGraphicsDeviceInfo = GET_GUID_HOB_DATA (Hob.Guid); + } + } + } + if (FspGraphicsDeviceInfo != NULL) { + return ; + } + + // + // FSP only publish FspGraphicsInfo, but no FspGraphicsDeviceInfo. + // + // Workaround: Need publish FspGraphicsDeviceInfo, because Intel Graphics BarIndex is 1. + // + GraphicsDeviceInfo.VendorId = MAX_UINT16; + GraphicsDeviceInfo.DeviceId = MAX_UINT16; + GraphicsDeviceInfo.SubsystemVendorId = MAX_UINT16; + GraphicsDeviceInfo.SubsystemId = MAX_UINT16; + GraphicsDeviceInfo.RevisionId = MAX_UINT8; + GraphicsDeviceInfo.BarIndex = 1; + BuildGuidDataHob ( + &gEfiGraphicsDeviceInfoHobGuid, + &GraphicsDeviceInfo, + sizeof(GraphicsDeviceInfo) + ); + + return ; +} + +/** + Dump FSP SMBIOS memory info HOB + +**/ +VOID +DumpFspSmbiosMemoryInfoHob ( + VOID + ) +{ +} + + +/** + Dump FSP SMBIOS Processor Info HOB + +**/ +VOID +DumpFspSmbiosProcessorInfoHob ( + VOID + ) +{ +} + +/** + Dump FSP SMBIOS Cache Info Hob + +**/ +VOID +DumpFspSmbiosCacheInfoHob ( + VOID + ) +{ +} + +/** + Dump FSP HOB list + +**/ +VOID +DumpFspHobList ( + VOID + ) +{ + EFI_PEI_HOB_POINTERS Hob; + EFI_STATUS Status; + + Status = PeiServicesGetHobList ((VOID **)&Hob.Raw); + ASSERT_EFI_ERROR (Status); + while (!END_OF_HOB_LIST (Hob)) { + if (Hob.Header->HobType == EFI_HOB_TYPE_GUID_EXTENSION) { + DEBUG ((DEBUG_INFO, "FSP Extended GUID HOB: {%g}\n", &(Hob.Guid->Name))); + } + if ((Hob.Header->HobType == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) && + (Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_MEMORY_RESERVED)) { + DEBUG ((DEBUG_INFO, "FSP Reserved Resource HOB: %016lX ~ %016lX\n", \ + Hob.ResourceDescriptor->PhysicalStart, Hob.ResourceDescriptor->PhysicalStart \ + + Hob.ResourceDescriptor->ResourceLength)); + } + Hob.Raw = GET_NEXT_HOB (Hob); + } +} + +/** + Dump FSP memory resource + +**/ +VOID +DumpFspMemoryResource ( + VOID + ) +{ + EFI_PEI_HOB_POINTERS Hob; + EFI_STATUS Status; + + Status = PeiServicesGetHobList ((VOID **)&Hob.Raw); + ASSERT_EFI_ERROR (Status); + DEBUG ((DEBUG_INFO, "\nFSP Memory Resource\n")); + DEBUG ((DEBUG_INFO, " Resource Range Type Attribute Owner\n")); + DEBUG ((DEBUG_INFO, "================================= ==== ================ ====================================\n")); + while ((Hob.Raw = GetNextHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, Hob.Raw)) != NULL) { + if (!CompareGuid (&(Hob.ResourceDescriptor->Owner), &gZeroGuid)) { + DEBUG ((DEBUG_INFO, "%016lx-%016lx %4x %016x %g\n", + Hob.ResourceDescriptor->PhysicalStart, + Hob.ResourceDescriptor->PhysicalStart + Hob.ResourceDescriptor->ResourceLength, + Hob.ResourceDescriptor->ResourceType, + Hob.ResourceDescriptor->ResourceAttribute, + &(Hob.ResourceDescriptor->Owner) + )); + } else { + DEBUG ((DEBUG_INFO, "%016lx-%016lx %4x %016x \n", + Hob.ResourceDescriptor->PhysicalStart, + Hob.ResourceDescriptor->PhysicalStart + Hob.ResourceDescriptor->ResourceLength, + Hob.ResourceDescriptor->ResourceType, + Hob.ResourceDescriptor->ResourceAttribute + )); + } + Hob.Raw = GET_NEXT_HOB (Hob); + } + DEBUG ((DEBUG_INFO, "\n")); +} + +/** + Dump FSP memory resource + +**/ +VOID +DumpFspGraphicsInfoHob ( + VOID + ) +{ + EFI_PEI_HOB_POINTERS Hob; + EFI_STATUS Status; + EFI_PEI_GRAPHICS_INFO_HOB *FspGraphicsInfo = NULL; + + Status = PeiServicesGetHobList ((VOID **)&Hob.Raw); + if (!EFI_ERROR (Status)) { + if (Hob.Raw != NULL) { + if ((Hob.Raw = GetNextGuidHob (&gEfiGraphicsInfoHobGuid, Hob.Raw)) != NULL) { + FspGraphicsInfo = GET_GUID_HOB_DATA (Hob.Guid); + } + } + if (FspGraphicsInfo != NULL) { + DEBUG((DEBUG_INFO, "\nGraphicsInfo\n")); + DEBUG((DEBUG_INFO, " |-> FrameBufferBase : 0x%016lx\n", FspGraphicsInfo->FrameBufferBase)); + DEBUG((DEBUG_INFO, " |-> FrameBufferSize : 0x%016lx\n", FspGraphicsInfo->FrameBufferSize)); + DEBUG((DEBUG_INFO, " |-> GraphicsMode\n")); + DEBUG((DEBUG_INFO, " |-> Version : 0x%08x\n", FspGraphicsInfo->GraphicsMode.Version)); + DEBUG((DEBUG_INFO, " |-> HorizontalResolution : %d\n", FspGraphicsInfo->GraphicsMode.HorizontalResolution)); + DEBUG((DEBUG_INFO, " |-> VerticalResolution : %d\n", FspGraphicsInfo->GraphicsMode.VerticalResolution)); + DEBUG((DEBUG_INFO, " |-> PixelFormat : %d\n", FspGraphicsInfo->GraphicsMode.PixelFormat)); + DEBUG((DEBUG_INFO, " |-> PixelInformation : %d|%d|%d|%d\n", + FspGraphicsInfo->GraphicsMode.PixelInformation.RedMask, + FspGraphicsInfo->GraphicsMode.PixelInformation.GreenMask, + FspGraphicsInfo->GraphicsMode.PixelInformation.BlueMask, + FspGraphicsInfo->GraphicsMode.PixelInformation.ReservedMask + )); + DEBUG((DEBUG_INFO, " |-> PixelsPerScanLine : %d\n", FspGraphicsInfo->GraphicsMode.PixelsPerScanLine)); + DEBUG((DEBUG_INFO, "\n")); + } else { + DEBUG((DEBUG_INFO, "\nNo GraphicsInfo\n")); + } + } +} + +VOID +DumpFspGraphicsDeviceInfoHob ( + VOID + ) +{ + EFI_PEI_HOB_POINTERS Hob; + EFI_STATUS Status; + EFI_PEI_GRAPHICS_DEVICE_INFO_HOB *FspGraphicsDeviceInfo = NULL; + + Status = PeiServicesGetHobList ((VOID **)&Hob.Raw); + if (!EFI_ERROR (Status)) { + if (Hob.Raw != NULL) { + if ((Hob.Raw = GetNextGuidHob (&gEfiGraphicsDeviceInfoHobGuid, Hob.Raw)) != NULL) { + FspGraphicsDeviceInfo = GET_GUID_HOB_DATA (Hob.Guid); + } + } + if (FspGraphicsDeviceInfo != NULL) { + DEBUG((DEBUG_INFO, "\nGraphicsDeviceInfo\n")); + DEBUG((DEBUG_INFO, " |-> VendorId : 0x%04x\n", FspGraphicsDeviceInfo->VendorId)); + DEBUG((DEBUG_INFO, " |-> DeviceId : 0x%04x\n", FspGraphicsDeviceInfo->DeviceId)); + DEBUG((DEBUG_INFO, " |-> SubsystemVendorId : 0x%04x\n", FspGraphicsDeviceInfo->SubsystemVendorId)); + DEBUG((DEBUG_INFO, " |-> SubsystemId : 0x%04x\n", FspGraphicsDeviceInfo->SubsystemId)); + DEBUG((DEBUG_INFO, " |-> RevisionId : 0x%02x\n", FspGraphicsDeviceInfo->RevisionId)); + DEBUG((DEBUG_INFO, " |-> BarIndex : 0x%02x\n", FspGraphicsDeviceInfo->BarIndex)); + DEBUG((DEBUG_INFO, "\n")); + } else { + DEBUG((DEBUG_INFO, "\nNo GraphicsDeviceInfo\n")); + } + } +} + +EFI_PEI_PPI_DESCRIPTOR mSiliconInitializedDesc = { + (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST), + &gEdkiiSiliconInitializedPpiGuid, + NULL +}; + +/** + Post FSP-S HOB process (not Memory Resource Descriptor). + + @param[in] FspHobList Pointer to the HOB data structure produced by FSP. + + @return If platform process the FSP hob list successfully. +**/ +EFI_STATUS +EFIAPI +PostFspsHobProcess ( + IN VOID *FspHobList + ) +{ + EFI_STATUS Status; + + if (PcdGet8 (PcdFspModeSelection) == 1) { + // + // Only in FSP API mode the wrapper has to build hobs basing on FSP output data. + // + ASSERT (FspHobList != NULL); + ProcessFspHobList (FspHobList); + } else { + // + // Only in FSP Dispatch mode, FSP-S should be reported to DXE dispatcher. + // + BuildFvHob ( + (EFI_PHYSICAL_ADDRESS) (UINTN) PcdGet32 (PcdFlashFvFspSBase), + PcdGet32 (PcdFlashFvFspSSize) + ); + } + CheckFspGraphicsDeviceInfoHob (); + DEBUG_CODE_BEGIN (); + DumpFspSmbiosMemoryInfoHob (); + DumpFspSmbiosProcessorInfoHob(); + DumpFspSmbiosCacheInfoHob(); + DumpFspGraphicsInfoHob (); + DumpFspGraphicsDeviceInfoHob (); + DumpFspHobList (); + DumpFspMemoryResource (); + DEBUG_CODE_END (); + + Status = PeiServicesInstallPpi (&mSiliconInitializedDesc); + ASSERT_EFI_ERROR (Status); + + return EFI_SUCCESS; +} diff --git a/MinPlatformPkg/FspWrapper/Library/PeiFspWrapperHobProcessLib/PeiFspWrapperHobProcessLib.inf b/MinPlatformPkg/FspWrapper/Library/PeiFspWrapperHobProcessLib/PeiFspWrapperHobProcessLib.inf index b507f0e0b9..e2aac36bf0 100644 --- a/MinPlatformPkg/FspWrapper/Library/PeiFspWrapperHobProcessLib/PeiFspWrapperHobProcessLib.inf +++ b/MinPlatformPkg/FspWrapper/Library/PeiFspWrapperHobProcessLib/PeiFspWrapperHobProcessLib.inf @@ -1,83 +1,83 @@ -## @file -# Provide FSP wrapper hob process related function. -# -# Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.
-# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -################################################################################ -# -# Defines Section - statements that will be processed to create a Makefile. -# -################################################################################ -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = PeiFspWrapperHobProcessLib - FILE_GUID = C7B7070B-E5A8-4b86-9110-BDCA1095F496 - MODULE_TYPE = SEC - VERSION_STRING = 1.0 - LIBRARY_CLASS = FspWrapperHobProcessLib - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - -################################################################################ -# -# Sources Section - list of files that are required for the build to succeed. -# -################################################################################ - -[Sources] - FspWrapperHobProcessLib.c - - -################################################################################ -# -# Package Dependency Section - list of Package files that are required for -# this module. -# -################################################################################ - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - IntelFsp2Pkg/IntelFsp2Pkg.dec - IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dec - MinPlatformPkg/MinPlatformPkg.dec - -[LibraryClasses] - BaseLib - BaseMemoryLib - HobLib - DebugLib - PeiServicesLib - PeiServicesTablePointerLib - -[Pcd] - gIntelFsp2WrapperTokenSpaceGuid.PcdPeiMinMemSize ## CONSUMES - gIntelFsp2WrapperTokenSpaceGuid.PcdPeiRecoveryMinMemSize ## CONSUMES - gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress - gMinPlatformPkgTokenSpaceGuid.PcdPciExpressRegionLength - gMinPlatformPkgTokenSpaceGuid.PcdFspCpuPeiApWakeupBufferAddr - gIntelFsp2WrapperTokenSpaceGuid.PcdFspModeSelection - gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSBase - gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSSize - -[Guids] - gFspReservedMemoryResourceHobGuid ## CONSUMES ## HOB - gEfiMemoryTypeInformationGuid ## CONSUMES ## GUID - gPcdDataBaseHobGuid - gZeroGuid - gEfiGraphicsInfoHobGuid - gEfiGraphicsDeviceInfoHobGuid - gEfiAcpiVariableGuid - -[Ppis] - gEfiPeiCapsulePpiGuid ## CONSUMES - gEfiPeiReadOnlyVariable2PpiGuid ## CONSUMES - gEdkiiSiliconInitializedPpiGuid ## PRODUCES +## @file +# Provide FSP wrapper hob process related function. +# +# Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +################################################################################ +# +# Defines Section - statements that will be processed to create a Makefile. +# +################################################################################ +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = PeiFspWrapperHobProcessLib + FILE_GUID = C7B7070B-E5A8-4b86-9110-BDCA1095F496 + MODULE_TYPE = SEC + VERSION_STRING = 1.0 + LIBRARY_CLASS = FspWrapperHobProcessLib + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + +################################################################################ +# +# Sources Section - list of files that are required for the build to succeed. +# +################################################################################ + +[Sources] + FspWrapperHobProcessLib.c + + +################################################################################ +# +# Package Dependency Section - list of Package files that are required for +# this module. +# +################################################################################ + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + IntelFsp2Pkg/IntelFsp2Pkg.dec + IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dec + MinPlatformPkg/MinPlatformPkg.dec + +[LibraryClasses] + BaseLib + BaseMemoryLib + HobLib + DebugLib + PeiServicesLib + PeiServicesTablePointerLib + +[Pcd] + gIntelFsp2WrapperTokenSpaceGuid.PcdPeiMinMemSize ## CONSUMES + gIntelFsp2WrapperTokenSpaceGuid.PcdPeiRecoveryMinMemSize ## CONSUMES + gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress + gMinPlatformPkgTokenSpaceGuid.PcdPciExpressRegionLength + gMinPlatformPkgTokenSpaceGuid.PcdFspCpuPeiApWakeupBufferAddr + gIntelFsp2WrapperTokenSpaceGuid.PcdFspModeSelection + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSBase + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSSize + +[Guids] + gFspReservedMemoryResourceHobGuid ## CONSUMES ## HOB + gEfiMemoryTypeInformationGuid ## CONSUMES ## GUID + gPcdDataBaseHobGuid + gZeroGuid + gEfiGraphicsInfoHobGuid + gEfiGraphicsDeviceInfoHobGuid + gEfiAcpiVariableGuid + +[Ppis] + gEfiPeiCapsulePpiGuid ## CONSUMES + gEfiPeiReadOnlyVariable2PpiGuid ## CONSUMES + gEdkiiSiliconInitializedPpiGuid ## PRODUCES diff --git a/MinPlatformPkg/Include/AcpiS3MemoryNvData.h b/MinPlatformPkg/Include/AcpiS3MemoryNvData.h index d1efe608b5..35943e2aa3 100644 --- a/MinPlatformPkg/Include/AcpiS3MemoryNvData.h +++ b/MinPlatformPkg/Include/AcpiS3MemoryNvData.h @@ -1,22 +1,22 @@ -/** @file - Header file for NV data structure definition. - -Copyright (c) 2021, Baruch Binyamin Doron -SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#ifndef __ACPI_S3_MEMORY_NV_DATA_H__ -#define __ACPI_S3_MEMORY_NV_DATA_H__ - -// -// NV data structure -// -typedef struct { - EFI_PHYSICAL_ADDRESS S3PeiMemBase; - UINT64 S3PeiMemSize; -} ACPI_S3_MEMORY; - -#define ACPI_S3_MEMORY_NV_NAME L"S3MemoryInfo" - -#endif +/** @file + Header file for NV data structure definition. + +Copyright (c) 2021, Baruch Binyamin Doron +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __ACPI_S3_MEMORY_NV_DATA_H__ +#define __ACPI_S3_MEMORY_NV_DATA_H__ + +// +// NV data structure +// +typedef struct { + EFI_PHYSICAL_ADDRESS S3PeiMemBase; + UINT64 S3PeiMemSize; +} ACPI_S3_MEMORY; + +#define ACPI_S3_MEMORY_NV_NAME L"S3MemoryInfo" + +#endif diff --git a/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc b/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc index 040c8cb3b0..3749199da7 100644 --- a/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc +++ b/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc @@ -1,175 +1,175 @@ -## @file -# Platform description. -# -# Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.
-# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - - # - # Generic EDKII Lib - # - -!include MdePkg/MdeLibs.dsc.inc - -[LibraryClasses.common] - # - # Entry point - # - PeiCoreEntryPoint|MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf - PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf - DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf - UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf - UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf - SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf - PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf - - # - # Basic - # - BaseLib|MdePkg/Library/BaseLib/BaseLib.inf - BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf - - PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf - CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf - IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf - PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf - PciLib|MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf - BasePciLibPciExpress|MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf -# PciLib|MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf - PciCf8Lib|MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf - PciExpressLib|MdePkg/Library/BasePciExpressLib/BasePciExpressLib.inf - CacheMaintenanceLib|MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf - PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf - PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf - SortLib|MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf - # - # UEFI & PI - # - UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf - UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf - UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf - UefiLib|MdePkg/Library/UefiLib/UefiLib.inf - HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf - UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf - DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf - - UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf - PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf - PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf - DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf - DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf - UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf - - # - # Framework - # - S3BootScriptLib|MdePkg/Library/BaseS3BootScriptLibNull/BaseS3BootScriptLibNull.inf - S3IoLib|MdePkg/Library/BaseS3IoLib/BaseS3IoLib.inf - S3PciLib|MdePkg/Library/BaseS3PciLib/BaseS3PciLib.inf - - # - # Generic Modules - # - UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf - UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf - - # - # Network libraries - # -!include NetworkPkg/NetworkLibs.dsc.inc - - OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf - CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf - - UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf - FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf - SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf - SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf - SmmCorePlatformHookLib|MdeModulePkg/Library/SmmCorePlatformHookLibNull/SmmCorePlatformHookLibNull.inf - IoApicLib|PcAtChipsetPkg/Library/BaseIoApicLib/BaseIoApicLib.inf - - PostCodeLib|MdePkg/Library/BasePostCodeLibPort80/BasePostCodeLibPort80.inf - - DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf - CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf - - ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf - FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf - SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf - OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf - - # - # CPU - # - MtrrLib|UefiCpuPkg/Library/MtrrLib/MtrrLib.inf - LocalApicLib|UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf - SmmCpuFeaturesLib|UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf - MicrocodeLib|UefiCpuPkg/Library/MicrocodeLib/MicrocodeLib.inf - - # - # Platform - # - TimerLib|PcAtChipsetPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf - - # - # Misc - # -!if $(TARGET) == RELEASE - DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf -!else - DebugLib|MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf -!endif - -!if $(TARGET) == RELEASE - SmiHandlerProfileLib|MdePkg/Library/SmiHandlerProfileLibNull/SmiHandlerProfileLibNull.inf -!else - SmiHandlerProfileLib|MdeModulePkg/Library/SmmSmiHandlerProfileLib/SmmSmiHandlerProfileLib.inf -!endif - - PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf - PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf - DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf - - TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf - VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf - PlatformSecureLib|SecurityPkg/Library/PlatformSecureLibNull/PlatformSecureLibNull.inf - AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf - -!if gMinPlatformPkgTokenSpaceGuid.PcdUefiSecureBootEnable == TRUE - AuthVariableLib|SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf - SecureBootVariableLib|SecurityPkg/Library/SecureBootVariableLib/SecureBootVariableLib.inf - SecureBootVariableProvisionLib|SecurityPkg/Library/SecureBootVariableProvisionLib/SecureBootVariableProvisionLib.inf - PlatformPKProtectionLib|SecurityPkg/Library/PlatformPKProtectionLibVarPolicy/PlatformPKProtectionLibVarPolicy.inf -!endif - - SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf - BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf - LargeVariableReadLib|MinPlatformPkg/Library/BaseLargeVariableLib/BaseLargeVariableReadLib.inf - LargeVariableWriteLib|MinPlatformPkg/Library/BaseLargeVariableLib/BaseLargeVariableWriteLib.inf - - # - # CryptLib - # - IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf - OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf - - RngLib|MdePkg/Library/BaseRngLib/BaseRngLib.inf - - Tpm12DeviceLib|SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12DeviceLibDTpm.inf - Tpm12CommandLib|SecurityPkg/Library/Tpm12CommandLib/Tpm12CommandLib.inf - Tpm2CommandLib|SecurityPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf - Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2DeviceLibDTpm.inf - Tcg2PhysicalPresenceLib|SecurityPkg/Library/DxeTcg2PhysicalPresenceLib/DxeTcg2PhysicalPresenceLib.inf - Tcg2PpVendorLib|SecurityPkg/Library/Tcg2PpVendorLibNull/Tcg2PpVendorLibNull.inf - - LockBoxLib|MdeModulePkg/Library/LockBoxNullLib/LockBoxNullLib.inf - - SmmMemLib|MdePkg/Library/SmmMemLib/SmmMemLib.inf - MmUnblockMemoryLib|MdePkg/Library/MmUnblockMemoryLib/MmUnblockMemoryLibNull.inf - - SmbusLib|MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf - VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf - VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf - VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf +## @file +# Platform description. +# +# Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + + # + # Generic EDKII Lib + # + +!include MdePkg/MdeLibs.dsc.inc + +[LibraryClasses.common] + # + # Entry point + # + PeiCoreEntryPoint|MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf + PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf + DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf + UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf + UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf + SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf + PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf + + # + # Basic + # + BaseLib|MdePkg/Library/BaseLib/BaseLib.inf + BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf + + PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf + CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf + IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf + PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf + PciLib|MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf + BasePciLibPciExpress|MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf +# PciLib|MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf + PciCf8Lib|MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf + PciExpressLib|MdePkg/Library/BasePciExpressLib/BasePciExpressLib.inf + CacheMaintenanceLib|MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf + PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf + PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf + SortLib|MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf + # + # UEFI & PI + # + UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf + UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf + UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf + UefiLib|MdePkg/Library/UefiLib/UefiLib.inf + HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf + UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf + DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf + + UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf + PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf + PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf + DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf + DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf + UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf + + # + # Framework + # + S3BootScriptLib|MdePkg/Library/BaseS3BootScriptLibNull/BaseS3BootScriptLibNull.inf + S3IoLib|MdePkg/Library/BaseS3IoLib/BaseS3IoLib.inf + S3PciLib|MdePkg/Library/BaseS3PciLib/BaseS3PciLib.inf + + # + # Generic Modules + # + UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf + UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf + + # + # Network libraries + # +!include NetworkPkg/NetworkLibs.dsc.inc + + OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf + CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf + + UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf + FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf + SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf + SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf + SmmCorePlatformHookLib|MdeModulePkg/Library/SmmCorePlatformHookLibNull/SmmCorePlatformHookLibNull.inf + IoApicLib|PcAtChipsetPkg/Library/BaseIoApicLib/BaseIoApicLib.inf + + PostCodeLib|MdePkg/Library/BasePostCodeLibPort80/BasePostCodeLibPort80.inf + + DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf + CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf + + ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf + FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf + SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf + OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf + + # + # CPU + # + MtrrLib|UefiCpuPkg/Library/MtrrLib/MtrrLib.inf + LocalApicLib|UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf + SmmCpuFeaturesLib|UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf + MicrocodeLib|UefiCpuPkg/Library/MicrocodeLib/MicrocodeLib.inf + + # + # Platform + # + TimerLib|PcAtChipsetPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf + + # + # Misc + # +!if $(TARGET) == RELEASE + DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf +!else + DebugLib|MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf +!endif + +!if $(TARGET) == RELEASE + SmiHandlerProfileLib|MdePkg/Library/SmiHandlerProfileLibNull/SmiHandlerProfileLibNull.inf +!else + SmiHandlerProfileLib|MdeModulePkg/Library/SmmSmiHandlerProfileLib/SmmSmiHandlerProfileLib.inf +!endif + + PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf + + TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf + VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf + PlatformSecureLib|SecurityPkg/Library/PlatformSecureLibNull/PlatformSecureLibNull.inf + AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf + +!if gMinPlatformPkgTokenSpaceGuid.PcdUefiSecureBootEnable == TRUE + AuthVariableLib|SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf + SecureBootVariableLib|SecurityPkg/Library/SecureBootVariableLib/SecureBootVariableLib.inf + SecureBootVariableProvisionLib|SecurityPkg/Library/SecureBootVariableProvisionLib/SecureBootVariableProvisionLib.inf + PlatformPKProtectionLib|SecurityPkg/Library/PlatformPKProtectionLibVarPolicy/PlatformPKProtectionLibVarPolicy.inf +!endif + + SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf + BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf + LargeVariableReadLib|MinPlatformPkg/Library/BaseLargeVariableLib/BaseLargeVariableReadLib.inf + LargeVariableWriteLib|MinPlatformPkg/Library/BaseLargeVariableLib/BaseLargeVariableWriteLib.inf + + # + # CryptLib + # + IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf + OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf + + RngLib|MdePkg/Library/BaseRngLib/BaseRngLib.inf + + Tpm12DeviceLib|SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12DeviceLibDTpm.inf + Tpm12CommandLib|SecurityPkg/Library/Tpm12CommandLib/Tpm12CommandLib.inf + Tpm2CommandLib|SecurityPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf + Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2DeviceLibDTpm.inf + Tcg2PhysicalPresenceLib|SecurityPkg/Library/DxeTcg2PhysicalPresenceLib/DxeTcg2PhysicalPresenceLib.inf + Tcg2PpVendorLib|SecurityPkg/Library/Tcg2PpVendorLibNull/Tcg2PpVendorLibNull.inf + + LockBoxLib|MdeModulePkg/Library/LockBoxNullLib/LockBoxNullLib.inf + + SmmMemLib|MdePkg/Library/SmmMemLib/SmmMemLib.inf + MmUnblockMemoryLib|MdePkg/Library/MmUnblockMemoryLib/MmUnblockMemoryLibNull.inf + + SmbusLib|MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf + VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf + VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf + VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf diff --git a/MinPlatformPkg/Include/Dsc/CoreDxeInclude.dsc b/MinPlatformPkg/Include/Dsc/CoreDxeInclude.dsc index 273031b063..3c0471d168 100644 --- a/MinPlatformPkg/Include/Dsc/CoreDxeInclude.dsc +++ b/MinPlatformPkg/Include/Dsc/CoreDxeInclude.dsc @@ -1,166 +1,166 @@ -## @file -# Platform description. -# -# Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.
-# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - - - # - # Generic EDKII Driver - # - MdeModulePkg/Core/Dxe/DxeMain.inf { - - NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf - } - MdeModulePkg/Universal/PCD/Dxe/Pcd.inf { - - PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf - } - - MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.inf - MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.inf - - UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf - MdeModulePkg/Universal/Metronome/Metronome.inf - MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf - PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf - MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf - - # - # Emulated variables for stages 1-4 - # - MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf { - - gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvModeEnable|TRUE - } - - # - # Real variables for stages 5+ - # - MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf - MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf - MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf { - - NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf - NULL|MdeModulePkg/Library/VarCheckHiiLib/VarCheckHiiLib.inf - NULL|MdeModulePkg/Library/VarCheckPolicyLib/VarCheckPolicyLib.inf - } - - MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf - - MdeModulePkg/Universal/BdsDxe/BdsDxe.inf { - -!if gMinPlatformPkgTokenSpaceGuid.PcdSerialTerminalEnable == TRUE - NULL|MinPlatformPkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.inf -!endif - } - -!if gMinPlatformPkgTokenSpaceGuid.PcdSerialTerminalEnable == TRUE - MdeModulePkg/Universal/SerialDxe/SerialDxe.inf - MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf -!endif - - MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf - MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf { - -!if gMinPlatformPkgTokenSpaceGuid.PcdUefiSecureBootEnable == TRUE - NULL|SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.inf -!endif -!if gMinPlatformPkgTokenSpaceGuid.PcdTpm2Enable == TRUE - NULL|SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.inf -!endif - } - - MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf - - #UefiCpuPkg/CpuDxe/CpuDxe.inf - - MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf - PcAtChipsetPkg/HpetTimerDxe/HpetTimerDxe.inf - - #MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf - MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf - - #MdeModulePkg/Bus/Pci/SataControllerDxe/SataControllerDxe.inf - #MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf - #MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf - MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf - MdeModulePkg/Bus/Pci/EhciDxe/EhciDxe.inf - MdeModulePkg/Bus/Pci/UhciDxe/UhciDxe.inf - MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf - MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf - MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf - - MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf - MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf - MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf - FatPkg/EnhancedFatDxe/Fat.inf - - #MdeModulePkg/Universal/Console/GraphicsOutputDxe/GraphicsOutputDxe.inf - MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf - - MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf - MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf - - MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf - - MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf - - MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf - MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf - - MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf - - MdeModulePkg/Application/UiApp/UiApp.inf { - - PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf - NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf - NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf - NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf - } - MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenuApp.inf { - - PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf - } - - MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf - MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf - - MdeModulePkg/Universal/ReportStatusCodeRouter/Smm/ReportStatusCodeRouterSmm.inf - MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerSmm.inf - - #UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf - - UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.inf - MdeModulePkg/Universal/SmmCommunicationBufferDxe/SmmCommunicationBufferDxe.inf - MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox.inf - - MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf - MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.inf - MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwarePerformanceSmm.inf - MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf - -!if gMinPlatformPkgTokenSpaceGuid.PcdUefiSecureBootEnable == TRUE - SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf -!endif - -!if gMinPlatformPkgTokenSpaceGuid.PcdTpm2Enable == TRUE - SecurityPkg/Tcg/MemoryOverwriteControl/TcgMor.inf - SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf { - - Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibRouter/Tpm2DeviceLibRouterDxe.inf - NULL|SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2InstanceLibDTpm.inf - NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.inf - } - SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.inf - SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.inf - SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf -!endif - -!if gMinPlatformPkgTokenSpaceGuid.PcdPerformanceEnable == TRUE - ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf -!endif - +## @file +# Platform description. +# +# Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + + + # + # Generic EDKII Driver + # + MdeModulePkg/Core/Dxe/DxeMain.inf { + + NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf + } + MdeModulePkg/Universal/PCD/Dxe/Pcd.inf { + + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + } + + MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.inf + MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.inf + + UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf + MdeModulePkg/Universal/Metronome/Metronome.inf + MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf + PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf + MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf + + # + # Emulated variables for stages 1-4 + # + MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf { + + gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvModeEnable|TRUE + } + + # + # Real variables for stages 5+ + # + MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf + MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf + MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf { + + NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf + NULL|MdeModulePkg/Library/VarCheckHiiLib/VarCheckHiiLib.inf + NULL|MdeModulePkg/Library/VarCheckPolicyLib/VarCheckPolicyLib.inf + } + + MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf + + MdeModulePkg/Universal/BdsDxe/BdsDxe.inf { + +!if gMinPlatformPkgTokenSpaceGuid.PcdSerialTerminalEnable == TRUE + NULL|MinPlatformPkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.inf +!endif + } + +!if gMinPlatformPkgTokenSpaceGuid.PcdSerialTerminalEnable == TRUE + MdeModulePkg/Universal/SerialDxe/SerialDxe.inf + MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf +!endif + + MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf + MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf { + +!if gMinPlatformPkgTokenSpaceGuid.PcdUefiSecureBootEnable == TRUE + NULL|SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.inf +!endif +!if gMinPlatformPkgTokenSpaceGuid.PcdTpm2Enable == TRUE + NULL|SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.inf +!endif + } + + MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf + + #UefiCpuPkg/CpuDxe/CpuDxe.inf + + MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf + PcAtChipsetPkg/HpetTimerDxe/HpetTimerDxe.inf + + #MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf + MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf + + #MdeModulePkg/Bus/Pci/SataControllerDxe/SataControllerDxe.inf + #MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf + #MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf + MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf + MdeModulePkg/Bus/Pci/EhciDxe/EhciDxe.inf + MdeModulePkg/Bus/Pci/UhciDxe/UhciDxe.inf + MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf + MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf + MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf + + MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf + MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf + MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf + FatPkg/EnhancedFatDxe/Fat.inf + + #MdeModulePkg/Universal/Console/GraphicsOutputDxe/GraphicsOutputDxe.inf + MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf + + MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf + MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf + + MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf + + MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf + + MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf + MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf + + MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf + + MdeModulePkg/Application/UiApp/UiApp.inf { + + PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf + NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf + NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf + NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf + } + MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenuApp.inf { + + PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf + } + + MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf + MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf + + MdeModulePkg/Universal/ReportStatusCodeRouter/Smm/ReportStatusCodeRouterSmm.inf + MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerSmm.inf + + #UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf + + UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.inf + MdeModulePkg/Universal/SmmCommunicationBufferDxe/SmmCommunicationBufferDxe.inf + MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox.inf + + MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf + MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.inf + MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwarePerformanceSmm.inf + MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf + +!if gMinPlatformPkgTokenSpaceGuid.PcdUefiSecureBootEnable == TRUE + SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf +!endif + +!if gMinPlatformPkgTokenSpaceGuid.PcdTpm2Enable == TRUE + SecurityPkg/Tcg/MemoryOverwriteControl/TcgMor.inf + SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf { + + Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibRouter/Tpm2DeviceLibRouterDxe.inf + NULL|SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2InstanceLibDTpm.inf + NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.inf + } + SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.inf + SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.inf + SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf +!endif + +!if gMinPlatformPkgTokenSpaceGuid.PcdPerformanceEnable == TRUE + ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf +!endif + diff --git a/MinPlatformPkg/Include/Dsc/CoreDxeLib.dsc b/MinPlatformPkg/Include/Dsc/CoreDxeLib.dsc index 0e893377b1..d851b13d45 100644 --- a/MinPlatformPkg/Include/Dsc/CoreDxeLib.dsc +++ b/MinPlatformPkg/Include/Dsc/CoreDxeLib.dsc @@ -1,114 +1,114 @@ -## @file -# Platform description. -# -# Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.
-# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - - -# -# Generic EDKII Lib -# - -# -# DXE phase common -# -[LibraryClasses.common.DXE_CORE, LibraryClasses.common.DXE_SMM_DRIVER, LibraryClasses.common.SMM_CORE, LibraryClasses.common.DXE_DRIVER, LibraryClasses.common.DXE_RUNTIME_DRIVER, LibraryClasses.common.UEFI_DRIVER, LibraryClasses.common.UEFI_APPLICATION] - HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf - PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf - MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf - ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf - ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf - - HstiLib|MdePkg/Library/DxeHstiLib/DxeHstiLib.inf - - LockBoxLib|MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxDxeLib.inf - - CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf - CpuPageTableLib|UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableLib.inf - MpInitLib|UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf - FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.inf - TimerLib|PcAtChipsetPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.inf - - TpmMeasurementLib|SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasurementLib.inf - - BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf - - Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibRouter/Tpm2DeviceLibRouterDxe.inf - HashLib|SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterDxe.inf - Tcg2PhysicalPresenceLib|SecurityPkg/Library/DxeTcg2PhysicalPresenceLib/DxeTcg2PhysicalPresenceLib.inf - - CcExitLib|UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.inf - -[LibraryClasses.common.DXE_CORE, LibraryClasses.common.DXE_DRIVER, LibraryClasses.common.DXE_RUNTIME_DRIVER, LibraryClasses.common.UEFI_DRIVER, LibraryClasses.common.UEFI_APPLICATION] - VariableReadLib|MinPlatformPkg/Library/DxeRuntimeVariableReadLib/DxeRuntimeVariableReadLib.inf - VariableWriteLib|MinPlatformPkg/Library/DxeRuntimeVariableWriteLib/DxeRuntimeVariableWriteLib.inf - -[LibraryClasses.common.DXE_DRIVER, LibraryClasses.common.DXE_RUNTIME_DRIVER, LibraryClasses.common.UEFI_DRIVER, LibraryClasses.common.UEFI_APPLICATION] -!if gMinPlatformPkgTokenSpaceGuid.PcdPerformanceEnable == TRUE - PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf -!endif - -[LibraryClasses.common.DXE_CORE, LibraryClasses.common.SMM_CORE] -!if $(TARGET) != RELEASE - DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf -!endif - -[LibraryClasses.common.DXE_CORE] - HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf - MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeCoreMemoryAllocationLib.inf - PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf - -!if gMinPlatformPkgTokenSpaceGuid.PcdPerformanceEnable == TRUE - PerformanceLib|MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf -!endif - -[LibraryClasses.common.DXE_DRIVER, LibraryClasses.common.UEFI_DRIVER] - Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibTcg2/Tpm2DeviceLibTcg2.inf - -[LibraryClasses.common.DXE_DRIVER] - TpmPlatformHierarchyLib|SecurityPkg/Library/PeiDxeTpmPlatformHierarchyLib/PeiDxeTpmPlatformHierarchyLib.inf - -[LibraryClasses.common.DXE_SMM_DRIVER] - SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf - MmServicesTableLib|MdePkg/Library/MmServicesTableLib/MmServicesTableLib.inf - ReportStatusCodeLib|MdeModulePkg/Library/SmmReportStatusCodeLib/SmmReportStatusCodeLib.inf - MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.inf - LockBoxLib|MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxSmmLib.inf - SmmMemLib|MdePkg/Library/SmmMemLib/SmmMemLib.inf - SmmPeriodicSmiLib|MdePkg/Library/SmmPeriodicSmiLib/SmmPeriodicSmiLib.inf - -!if gMinPlatformPkgTokenSpaceGuid.PcdPerformanceEnable == TRUE - PerformanceLib|MdeModulePkg/Library/SmmPerformanceLib/SmmPerformanceLib.inf -!endif - - SmmCpuPlatformHookLib|UefiCpuPkg/Library/SmmCpuPlatformHookLibNull/SmmCpuPlatformHookLibNull.inf - SmmCpuFeaturesLib|UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf - - CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.inf - Tcg2PhysicalPresenceLib|SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresenceLib.inf - BaseCryptLib|CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf - VariableReadLib|MinPlatformPkg/Library/SmmVariableReadLib/TraditionalMmVariableReadLib.inf - VariableWriteLib|MinPlatformPkg/Library/SmmVariableWriteLib/TraditionalMmVariableWriteLib.inf - -[LibraryClasses.common.SMM_CORE] - MemoryAllocationLib|MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/PiSmmCoreMemoryAllocationLib.inf - SmmServicesTableLib|MdeModulePkg/Library/PiSmmCoreSmmServicesTableLib/PiSmmCoreSmmServicesTableLib.inf - ReportStatusCodeLib|MdeModulePkg/Library/SmmReportStatusCodeLib/SmmReportStatusCodeLib.inf - SmmMemLib|MdePkg/Library/SmmMemLib/SmmMemLib.inf - -!if gMinPlatformPkgTokenSpaceGuid.PcdPerformanceEnable == TRUE - PerformanceLib|MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.inf -!endif - -[LibraryClasses.common.DXE_RUNTIME_DRIVER] - ReportStatusCodeLib|MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/RuntimeDxeReportStatusCodeLib.inf - BaseCryptLib|CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf - VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLibRuntimeDxe.inf - -[LibraryClasses.common.UEFI_APPLICATION] - ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf - FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf - SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf +## @file +# Platform description. +# +# Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + + +# +# Generic EDKII Lib +# + +# +# DXE phase common +# +[LibraryClasses.common.DXE_CORE, LibraryClasses.common.DXE_SMM_DRIVER, LibraryClasses.common.SMM_CORE, LibraryClasses.common.DXE_DRIVER, LibraryClasses.common.DXE_RUNTIME_DRIVER, LibraryClasses.common.UEFI_DRIVER, LibraryClasses.common.UEFI_APPLICATION] + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf + PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf + ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf + ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf + + HstiLib|MdePkg/Library/DxeHstiLib/DxeHstiLib.inf + + LockBoxLib|MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxDxeLib.inf + + CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf + CpuPageTableLib|UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableLib.inf + MpInitLib|UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf + FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.inf + TimerLib|PcAtChipsetPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.inf + + TpmMeasurementLib|SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasurementLib.inf + + BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf + + Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibRouter/Tpm2DeviceLibRouterDxe.inf + HashLib|SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterDxe.inf + Tcg2PhysicalPresenceLib|SecurityPkg/Library/DxeTcg2PhysicalPresenceLib/DxeTcg2PhysicalPresenceLib.inf + + CcExitLib|UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.inf + +[LibraryClasses.common.DXE_CORE, LibraryClasses.common.DXE_DRIVER, LibraryClasses.common.DXE_RUNTIME_DRIVER, LibraryClasses.common.UEFI_DRIVER, LibraryClasses.common.UEFI_APPLICATION] + VariableReadLib|MinPlatformPkg/Library/DxeRuntimeVariableReadLib/DxeRuntimeVariableReadLib.inf + VariableWriteLib|MinPlatformPkg/Library/DxeRuntimeVariableWriteLib/DxeRuntimeVariableWriteLib.inf + +[LibraryClasses.common.DXE_DRIVER, LibraryClasses.common.DXE_RUNTIME_DRIVER, LibraryClasses.common.UEFI_DRIVER, LibraryClasses.common.UEFI_APPLICATION] +!if gMinPlatformPkgTokenSpaceGuid.PcdPerformanceEnable == TRUE + PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf +!endif + +[LibraryClasses.common.DXE_CORE, LibraryClasses.common.SMM_CORE] +!if $(TARGET) != RELEASE + DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf +!endif + +[LibraryClasses.common.DXE_CORE] + HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf + MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeCoreMemoryAllocationLib.inf + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + +!if gMinPlatformPkgTokenSpaceGuid.PcdPerformanceEnable == TRUE + PerformanceLib|MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf +!endif + +[LibraryClasses.common.DXE_DRIVER, LibraryClasses.common.UEFI_DRIVER] + Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibTcg2/Tpm2DeviceLibTcg2.inf + +[LibraryClasses.common.DXE_DRIVER] + TpmPlatformHierarchyLib|SecurityPkg/Library/PeiDxeTpmPlatformHierarchyLib/PeiDxeTpmPlatformHierarchyLib.inf + +[LibraryClasses.common.DXE_SMM_DRIVER] + SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf + MmServicesTableLib|MdePkg/Library/MmServicesTableLib/MmServicesTableLib.inf + ReportStatusCodeLib|MdeModulePkg/Library/SmmReportStatusCodeLib/SmmReportStatusCodeLib.inf + MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.inf + LockBoxLib|MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxSmmLib.inf + SmmMemLib|MdePkg/Library/SmmMemLib/SmmMemLib.inf + SmmPeriodicSmiLib|MdePkg/Library/SmmPeriodicSmiLib/SmmPeriodicSmiLib.inf + +!if gMinPlatformPkgTokenSpaceGuid.PcdPerformanceEnable == TRUE + PerformanceLib|MdeModulePkg/Library/SmmPerformanceLib/SmmPerformanceLib.inf +!endif + + SmmCpuPlatformHookLib|UefiCpuPkg/Library/SmmCpuPlatformHookLibNull/SmmCpuPlatformHookLibNull.inf + SmmCpuFeaturesLib|UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf + + CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.inf + Tcg2PhysicalPresenceLib|SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresenceLib.inf + BaseCryptLib|CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf + VariableReadLib|MinPlatformPkg/Library/SmmVariableReadLib/TraditionalMmVariableReadLib.inf + VariableWriteLib|MinPlatformPkg/Library/SmmVariableWriteLib/TraditionalMmVariableWriteLib.inf + +[LibraryClasses.common.SMM_CORE] + MemoryAllocationLib|MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/PiSmmCoreMemoryAllocationLib.inf + SmmServicesTableLib|MdeModulePkg/Library/PiSmmCoreSmmServicesTableLib/PiSmmCoreSmmServicesTableLib.inf + ReportStatusCodeLib|MdeModulePkg/Library/SmmReportStatusCodeLib/SmmReportStatusCodeLib.inf + SmmMemLib|MdePkg/Library/SmmMemLib/SmmMemLib.inf + +!if gMinPlatformPkgTokenSpaceGuid.PcdPerformanceEnable == TRUE + PerformanceLib|MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.inf +!endif + +[LibraryClasses.common.DXE_RUNTIME_DRIVER] + ReportStatusCodeLib|MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/RuntimeDxeReportStatusCodeLib.inf + BaseCryptLib|CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf + VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLibRuntimeDxe.inf + +[LibraryClasses.common.UEFI_APPLICATION] + ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf + FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf + SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf diff --git a/MinPlatformPkg/Include/Dsc/CorePeiInclude.dsc b/MinPlatformPkg/Include/Dsc/CorePeiInclude.dsc index 194fa5ded8..6f5fb46e57 100644 --- a/MinPlatformPkg/Include/Dsc/CorePeiInclude.dsc +++ b/MinPlatformPkg/Include/Dsc/CorePeiInclude.dsc @@ -1,44 +1,44 @@ -## @file -# Platform description. -# -# Copyright (c) 2017, Intel Corporation. All rights reserved.
-# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - - # - # Generic EDKII Driver - # - - MdeModulePkg/Core/Pei/PeiMain.inf - - MdeModulePkg/Universal/PCD/Pei/Pcd.inf { - - PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf - } - MdeModulePkg/Universal/ReportStatusCodeRouter/Pei/ReportStatusCodeRouterPei.inf - MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.inf - - UefiCpuPkg/CpuIoPei/CpuIoPei.inf - - MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.inf - - MdeModulePkg/Universal/Variable/Pei/VariablePei.inf - - MdeModulePkg/Universal/PcatSingleSegmentPciCfg2Pei/PcatSingleSegmentPciCfg2Pei.inf - - MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf { - - NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf - } - -!if gMinPlatformPkgTokenSpaceGuid.PcdTpm2Enable == TRUE - SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf - SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.inf { - - NULL|SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2InstanceLibDTpm.inf - NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.inf - } -!endif - MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerformancePei.inf +## @file +# Platform description. +# +# Copyright (c) 2017, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + + # + # Generic EDKII Driver + # + + MdeModulePkg/Core/Pei/PeiMain.inf + + MdeModulePkg/Universal/PCD/Pei/Pcd.inf { + + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + } + MdeModulePkg/Universal/ReportStatusCodeRouter/Pei/ReportStatusCodeRouterPei.inf + MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.inf + + UefiCpuPkg/CpuIoPei/CpuIoPei.inf + + MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.inf + + MdeModulePkg/Universal/Variable/Pei/VariablePei.inf + + MdeModulePkg/Universal/PcatSingleSegmentPciCfg2Pei/PcatSingleSegmentPciCfg2Pei.inf + + MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf { + + NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf + } + +!if gMinPlatformPkgTokenSpaceGuid.PcdTpm2Enable == TRUE + SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf + SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.inf { + + NULL|SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2InstanceLibDTpm.inf + NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.inf + } +!endif + MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerformancePei.inf diff --git a/MinPlatformPkg/Include/Dsc/CorePeiLib.dsc b/MinPlatformPkg/Include/Dsc/CorePeiLib.dsc index 56b562f850..7afbb2900f 100644 --- a/MinPlatformPkg/Include/Dsc/CorePeiLib.dsc +++ b/MinPlatformPkg/Include/Dsc/CorePeiLib.dsc @@ -1,63 +1,63 @@ -## @file -# Platform description. -# -# Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.
-# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - - # - # Generic EDKII Lib - # - - # - # PEI phase common - # - -[LibraryClasses.common.SEC, LibraryClasses.common.PEI_CORE] -!if $(TARGET) != RELEASE - DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf -!endif - -[LibraryClasses.common.SEC, LibraryClasses.common.PEI_CORE, LibraryClasses.common.PEIM] - S3BootScriptLib|MdePkg/Library/BaseS3BootScriptLibNull/BaseS3BootScriptLibNull.inf - PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf - HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf - MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf - ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf - ExtractGuidedSectionLib|MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.inf - DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibBase.inf - LockBoxLib|MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxPeiLib.inf - CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf - -!if gMinPlatformPkgTokenSpaceGuid.PcdPerformanceEnable == TRUE - PerformanceLib|MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.inf -!endif - - TimerLib|PcAtChipsetPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf - CcExitLib|UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.inf - -[LibraryClasses.common.SEC] - ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf - PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf - VariableReadLib|MinPlatformPkg/Library/BaseVariableReadLibNull/BaseVariableReadLibNull.inf - -[LibraryClasses.common.PEI_CORE, LibraryClasses.common.PEIM] - TimerLib|PcAtChipsetPkg/Library/AcpiTimerLib/PeiAcpiTimerLib.inf - -[LibraryClasses.common.PEIM] - BaseCryptLib|CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf - - Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibRouter/Tpm2DeviceLibRouterPei.inf - HashLib|SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterPei.inf - Tcg2PhysicalPresenceLib|SecurityPkg/Library/PeiTcg2PhysicalPresenceLib/PeiTcg2PhysicalPresenceLib.inf - TpmPlatformHierarchyLib|SecurityPkg/Library/PeiDxeTpmPlatformHierarchyLib/PeiDxeTpmPlatformHierarchyLib.inf - - FspMeasurementLib|IntelFsp2WrapperPkg/Library/BaseFspMeasurementLib/BaseFspMeasurementLib.inf - FspWrapperPlatformMultiPhaseLib|IntelFsp2WrapperPkg/Library/BaseFspWrapperPlatformMultiPhaseLibNull/BaseFspWrapperPlatformMultiPhaseLibNull.inf - FspWrapperMultiPhaseProcessLib|IntelFsp2WrapperPkg/Library/FspWrapperMultiPhaseProcessLib/FspWrapperMultiPhaseProcessLib.inf - TcgEventLogRecordLib|SecurityPkg/Library/TcgEventLogRecordLib/TcgEventLogRecordLib.inf - TpmMeasurementLib|SecurityPkg/Library/PeiTpmMeasurementLib/PeiTpmMeasurementLib.inf - - VariableReadLib|MinPlatformPkg/Library/PeiVariableReadLib/PeiVariableReadLib.inf +## @file +# Platform description. +# +# Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + + # + # Generic EDKII Lib + # + + # + # PEI phase common + # + +[LibraryClasses.common.SEC, LibraryClasses.common.PEI_CORE] +!if $(TARGET) != RELEASE + DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf +!endif + +[LibraryClasses.common.SEC, LibraryClasses.common.PEI_CORE, LibraryClasses.common.PEIM] + S3BootScriptLib|MdePkg/Library/BaseS3BootScriptLibNull/BaseS3BootScriptLibNull.inf + PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf + HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf + MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf + ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf + ExtractGuidedSectionLib|MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.inf + DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibBase.inf + LockBoxLib|MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxPeiLib.inf + CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf + +!if gMinPlatformPkgTokenSpaceGuid.PcdPerformanceEnable == TRUE + PerformanceLib|MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.inf +!endif + + TimerLib|PcAtChipsetPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf + CcExitLib|UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.inf + +[LibraryClasses.common.SEC] + ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + VariableReadLib|MinPlatformPkg/Library/BaseVariableReadLibNull/BaseVariableReadLibNull.inf + +[LibraryClasses.common.PEI_CORE, LibraryClasses.common.PEIM] + TimerLib|PcAtChipsetPkg/Library/AcpiTimerLib/PeiAcpiTimerLib.inf + +[LibraryClasses.common.PEIM] + BaseCryptLib|CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf + + Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibRouter/Tpm2DeviceLibRouterPei.inf + HashLib|SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterPei.inf + Tcg2PhysicalPresenceLib|SecurityPkg/Library/PeiTcg2PhysicalPresenceLib/PeiTcg2PhysicalPresenceLib.inf + TpmPlatformHierarchyLib|SecurityPkg/Library/PeiDxeTpmPlatformHierarchyLib/PeiDxeTpmPlatformHierarchyLib.inf + + FspMeasurementLib|IntelFsp2WrapperPkg/Library/BaseFspMeasurementLib/BaseFspMeasurementLib.inf + FspWrapperPlatformMultiPhaseLib|IntelFsp2WrapperPkg/Library/BaseFspWrapperPlatformMultiPhaseLibNull/BaseFspWrapperPlatformMultiPhaseLibNull.inf + FspWrapperMultiPhaseProcessLib|IntelFsp2WrapperPkg/Library/FspWrapperMultiPhaseProcessLib/FspWrapperMultiPhaseProcessLib.inf + TcgEventLogRecordLib|SecurityPkg/Library/TcgEventLogRecordLib/TcgEventLogRecordLib.inf + TpmMeasurementLib|SecurityPkg/Library/PeiTpmMeasurementLib/PeiTpmMeasurementLib.inf + + VariableReadLib|MinPlatformPkg/Library/PeiVariableReadLib/PeiVariableReadLib.inf diff --git a/MinPlatformPkg/Include/Dsc/MinPlatformFeaturesPcd.dsc.inc b/MinPlatformPkg/Include/Dsc/MinPlatformFeaturesPcd.dsc.inc index 0daecc2fc4..2d665c25c5 100644 --- a/MinPlatformPkg/Include/Dsc/MinPlatformFeaturesPcd.dsc.inc +++ b/MinPlatformPkg/Include/Dsc/MinPlatformFeaturesPcd.dsc.inc @@ -1,25 +1,25 @@ -## @file -# DSC file for defining default PCD for MinPlatform features. -# -# This makes it easy for boards to initially configure their build. -# -# This initializes features to be disable by default. -# A board can enable a feature by configuring the PCD in the board DSC file -# after this file has been included. -# -# Copyright (C) 2022 Intel Corporation -# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[PcdsFeatureFlag] - gMinPlatformPkgTokenSpaceGuid.PcdStopAfterDebugInit |FALSE - gMinPlatformPkgTokenSpaceGuid.PcdStopAfterMemInit |FALSE - gMinPlatformPkgTokenSpaceGuid.PcdBootToShellOnly |FALSE - gMinPlatformPkgTokenSpaceGuid.PcdSerialTerminalEnable |FALSE - - gMinPlatformPkgTokenSpaceGuid.PcdUefiSecureBootEnable |FALSE - gMinPlatformPkgTokenSpaceGuid.PcdTpm2Enable |FALSE - - gMinPlatformPkgTokenSpaceGuid.PcdPerformanceEnable |FALSE +## @file +# DSC file for defining default PCD for MinPlatform features. +# +# This makes it easy for boards to initially configure their build. +# +# This initializes features to be disable by default. +# A board can enable a feature by configuring the PCD in the board DSC file +# after this file has been included. +# +# Copyright (C) 2022 Intel Corporation +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[PcdsFeatureFlag] + gMinPlatformPkgTokenSpaceGuid.PcdStopAfterDebugInit |FALSE + gMinPlatformPkgTokenSpaceGuid.PcdStopAfterMemInit |FALSE + gMinPlatformPkgTokenSpaceGuid.PcdBootToShellOnly |FALSE + gMinPlatformPkgTokenSpaceGuid.PcdSerialTerminalEnable |FALSE + + gMinPlatformPkgTokenSpaceGuid.PcdUefiSecureBootEnable |FALSE + gMinPlatformPkgTokenSpaceGuid.PcdTpm2Enable |FALSE + + gMinPlatformPkgTokenSpaceGuid.PcdPerformanceEnable |FALSE diff --git a/MinPlatformPkg/Include/Fdf/CoreOsBootInclude.fdf b/MinPlatformPkg/Include/Fdf/CoreOsBootInclude.fdf index 890bbb17d9..64bfcd9745 100644 --- a/MinPlatformPkg/Include/Fdf/CoreOsBootInclude.fdf +++ b/MinPlatformPkg/Include/Fdf/CoreOsBootInclude.fdf @@ -1,33 +1,33 @@ -## @file -# FDF file of Platform. -# -# Copyright (c) 2017, Intel Corporation. All rights reserved.
-# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -!if gMinPlatformPkgTokenSpaceGuid.PcdBootToShellOnly == FALSE -INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf -INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf -INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf -!endif - -!if gMinPlatformPkgTokenSpaceGuid.PcdBootToShellOnly == FALSE -INF MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf -INF MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf -INF MdeModulePkg/Universal/ReportStatusCodeRouter/Smm/ReportStatusCodeRouterSmm.inf -INF MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerSmm.inf -#INF UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf -INF UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.inf -INF MdeModulePkg/Universal/SmmCommunicationBufferDxe/SmmCommunicationBufferDxe.inf -INF MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox.inf -!endif - -!if gMinPlatformPkgTokenSpaceGuid.PcdBootToShellOnly == FALSE -INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf -INF MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.inf -INF MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwarePerformanceSmm.inf -INF MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf -!endif - +## @file +# FDF file of Platform. +# +# Copyright (c) 2017, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +!if gMinPlatformPkgTokenSpaceGuid.PcdBootToShellOnly == FALSE +INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf +INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf +INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf +!endif + +!if gMinPlatformPkgTokenSpaceGuid.PcdBootToShellOnly == FALSE +INF MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf +INF MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf +INF MdeModulePkg/Universal/ReportStatusCodeRouter/Smm/ReportStatusCodeRouterSmm.inf +INF MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerSmm.inf +#INF UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf +INF UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.inf +INF MdeModulePkg/Universal/SmmCommunicationBufferDxe/SmmCommunicationBufferDxe.inf +INF MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox.inf +!endif + +!if gMinPlatformPkgTokenSpaceGuid.PcdBootToShellOnly == FALSE +INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf +INF MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.inf +INF MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwarePerformanceSmm.inf +INF MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf +!endif + diff --git a/MinPlatformPkg/Include/Fdf/CorePostMemoryInclude.fdf b/MinPlatformPkg/Include/Fdf/CorePostMemoryInclude.fdf index 563cdfec54..6e20bd5e01 100644 --- a/MinPlatformPkg/Include/Fdf/CorePostMemoryInclude.fdf +++ b/MinPlatformPkg/Include/Fdf/CorePostMemoryInclude.fdf @@ -1,11 +1,11 @@ -## @file -# FDF file of Platform. -# -# Copyright (c) 2017, Intel Corporation. All rights reserved.
-# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## -!if gMinPlatformPkgTokenSpaceGuid.PcdBootToShellOnly == FALSE - INF MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerformancePei.inf -!endif +## @file +# FDF file of Platform. +# +# Copyright (c) 2017, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## +!if gMinPlatformPkgTokenSpaceGuid.PcdBootToShellOnly == FALSE + INF MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerformancePei.inf +!endif diff --git a/MinPlatformPkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.c b/MinPlatformPkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.c index 2ede576f85..eb127d8315 100644 --- a/MinPlatformPkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.c +++ b/MinPlatformPkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.c @@ -1,131 +1,131 @@ -/** @file - Main file for NULL named library for the Serial Port Terminal Redirection library. - - This library adds a Terminal Device connected to SerialDxe to the UEFI Console - Variables. This allows BIOS Setup, UEFI Shell, etc. to be used on a headless - system via a null modem and terminal - emulator. - - Copyright (c) 2020 - 2022, Intel Corporation. All rights reserved.
- SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include "SerialPortTerminalLib.h" -GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID *mTerminalType[] = { - &gEfiPcAnsiGuid, - &gEfiVT100Guid, - &gEfiVT100PlusGuid, - &gEfiVTUTF8Guid, - &gEfiTtyTermGuid -}; - -GLOBAL_REMOVE_IF_UNREFERENCED SERIAL_DEVICE_PATH mSerialDevicePath = { - { - { - HARDWARE_DEVICE_PATH, - HW_VENDOR_DP, - { - (UINT8) sizeof (VENDOR_DEVICE_PATH), - (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8) - } - }, - EDKII_SERIAL_PORT_LIB_VENDOR_GUID - }, - { - { - MESSAGING_DEVICE_PATH, - MSG_UART_DP, - { - (UINT8) sizeof (UART_DEVICE_PATH), - (UINT8) ((sizeof (UART_DEVICE_PATH)) >> 8) - } - }, - 0, // Reserved - 0, // BaudRate - 0, // DataBits - 0, // Parity - 0 // StopBits - }, - { - { - MESSAGING_DEVICE_PATH, - MSG_VENDOR_DP, - { - (UINT8) (sizeof (VENDOR_DEVICE_PATH)), - (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8), - } - }, - DEVICE_PATH_MESSAGING_PC_ANSI - }, - gEndEntire -}; - -/** - Updates the ConOut, ConIn, ErrOut variables with the serial terminal device path - @param none - @retval none -**/ -VOID -AddSerialTerminal ( - VOID - ) -{ - UINT8 DefaultTerminalType; - - // - // Update the Terminal Device Configuration Parameters - // - mSerialDevicePath.Uart.BaudRate = PcdGet64 (PcdUartDefaultBaudRate); - mSerialDevicePath.Uart.DataBits = PcdGet8 (PcdUartDefaultDataBits); - mSerialDevicePath.Uart.Parity = PcdGet8 (PcdUartDefaultParity); - mSerialDevicePath.Uart.StopBits = PcdGet8 (PcdUartDefaultStopBits); - DefaultTerminalType = PcdGet8 (PcdDefaultTerminalType); - DEBUG ((DEBUG_INFO, "[AddSerialPortTerminal] [%d, %d, %d, %d, %d]\n", - (int) mSerialDevicePath.Uart.BaudRate, - (int) mSerialDevicePath.Uart.DataBits, - (int) mSerialDevicePath.Uart.Parity, - (int) mSerialDevicePath.Uart.StopBits, - (int) DefaultTerminalType)); - - if (DefaultTerminalType >= 0 && - DefaultTerminalType < (sizeof (mTerminalType) / sizeof (mTerminalType[0]))) { - CopyMem ( - (VOID *) &(mSerialDevicePath.TerminalType.Guid), - (VOID *) mTerminalType[DefaultTerminalType], - sizeof (EFI_GUID) - ); - } else { - DEBUG ((DEBUG_WARN, "PcdDefaultTerminalType has invalid value: %d\n", (int) DefaultTerminalType)); - } - - // - // Append Serial Terminal into "ConIn", "ConOut", and "ErrOut" - // - EfiBootManagerUpdateConsoleVariable (ConOut, (EFI_DEVICE_PATH_PROTOCOL *) &mSerialDevicePath, NULL); - EfiBootManagerUpdateConsoleVariable (ConIn, (EFI_DEVICE_PATH_PROTOCOL *) &mSerialDevicePath, NULL); - EfiBootManagerUpdateConsoleVariable (ErrOut, (EFI_DEVICE_PATH_PROTOCOL *) &mSerialDevicePath, NULL); -} - - -/** - Constructor for the Serial Port Terminal Device library. - - @param ImageHandle The Image Handle of the process - @param SystemTable The EFI System Table pointer - - @retval EFI_SUCCESS The Serial Port Terminal Device was installed successfully -**/ -EFI_STATUS -EFIAPI -SerialPortTerminalLibConstructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - DEBUG ((DEBUG_INFO, "[SerialPortTerminalLibConstructor]\n")); - - AddSerialTerminal(); - - return EFI_SUCCESS; -} +/** @file + Main file for NULL named library for the Serial Port Terminal Redirection library. + + This library adds a Terminal Device connected to SerialDxe to the UEFI Console + Variables. This allows BIOS Setup, UEFI Shell, etc. to be used on a headless + system via a null modem and terminal + emulator. + + Copyright (c) 2020 - 2022, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "SerialPortTerminalLib.h" +GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID *mTerminalType[] = { + &gEfiPcAnsiGuid, + &gEfiVT100Guid, + &gEfiVT100PlusGuid, + &gEfiVTUTF8Guid, + &gEfiTtyTermGuid +}; + +GLOBAL_REMOVE_IF_UNREFERENCED SERIAL_DEVICE_PATH mSerialDevicePath = { + { + { + HARDWARE_DEVICE_PATH, + HW_VENDOR_DP, + { + (UINT8) sizeof (VENDOR_DEVICE_PATH), + (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8) + } + }, + EDKII_SERIAL_PORT_LIB_VENDOR_GUID + }, + { + { + MESSAGING_DEVICE_PATH, + MSG_UART_DP, + { + (UINT8) sizeof (UART_DEVICE_PATH), + (UINT8) ((sizeof (UART_DEVICE_PATH)) >> 8) + } + }, + 0, // Reserved + 0, // BaudRate + 0, // DataBits + 0, // Parity + 0 // StopBits + }, + { + { + MESSAGING_DEVICE_PATH, + MSG_VENDOR_DP, + { + (UINT8) (sizeof (VENDOR_DEVICE_PATH)), + (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8), + } + }, + DEVICE_PATH_MESSAGING_PC_ANSI + }, + gEndEntire +}; + +/** + Updates the ConOut, ConIn, ErrOut variables with the serial terminal device path + @param none + @retval none +**/ +VOID +AddSerialTerminal ( + VOID + ) +{ + UINT8 DefaultTerminalType; + + // + // Update the Terminal Device Configuration Parameters + // + mSerialDevicePath.Uart.BaudRate = PcdGet64 (PcdUartDefaultBaudRate); + mSerialDevicePath.Uart.DataBits = PcdGet8 (PcdUartDefaultDataBits); + mSerialDevicePath.Uart.Parity = PcdGet8 (PcdUartDefaultParity); + mSerialDevicePath.Uart.StopBits = PcdGet8 (PcdUartDefaultStopBits); + DefaultTerminalType = PcdGet8 (PcdDefaultTerminalType); + DEBUG ((DEBUG_INFO, "[AddSerialPortTerminal] [%d, %d, %d, %d, %d]\n", + (int) mSerialDevicePath.Uart.BaudRate, + (int) mSerialDevicePath.Uart.DataBits, + (int) mSerialDevicePath.Uart.Parity, + (int) mSerialDevicePath.Uart.StopBits, + (int) DefaultTerminalType)); + + if (DefaultTerminalType >= 0 && + DefaultTerminalType < (sizeof (mTerminalType) / sizeof (mTerminalType[0]))) { + CopyMem ( + (VOID *) &(mSerialDevicePath.TerminalType.Guid), + (VOID *) mTerminalType[DefaultTerminalType], + sizeof (EFI_GUID) + ); + } else { + DEBUG ((DEBUG_WARN, "PcdDefaultTerminalType has invalid value: %d\n", (int) DefaultTerminalType)); + } + + // + // Append Serial Terminal into "ConIn", "ConOut", and "ErrOut" + // + EfiBootManagerUpdateConsoleVariable (ConOut, (EFI_DEVICE_PATH_PROTOCOL *) &mSerialDevicePath, NULL); + EfiBootManagerUpdateConsoleVariable (ConIn, (EFI_DEVICE_PATH_PROTOCOL *) &mSerialDevicePath, NULL); + EfiBootManagerUpdateConsoleVariable (ErrOut, (EFI_DEVICE_PATH_PROTOCOL *) &mSerialDevicePath, NULL); +} + + +/** + Constructor for the Serial Port Terminal Device library. + + @param ImageHandle The Image Handle of the process + @param SystemTable The EFI System Table pointer + + @retval EFI_SUCCESS The Serial Port Terminal Device was installed successfully +**/ +EFI_STATUS +EFIAPI +SerialPortTerminalLibConstructor ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + DEBUG ((DEBUG_INFO, "[SerialPortTerminalLibConstructor]\n")); + + AddSerialTerminal(); + + return EFI_SUCCESS; +} diff --git a/MinPlatformPkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.h b/MinPlatformPkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.h index 0e585448fa..33415721cd 100644 --- a/MinPlatformPkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.h +++ b/MinPlatformPkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.h @@ -1,41 +1,41 @@ -/** @file - Header file for NULL named library for the Serial Port Terminal Redirection library. - - This library adds a Terminal Device connected to SerialDxe to the UEFI Console - Variables. This allows BIOS Setup, UEFI Shell, etc. to be used on a headless - system via a null modem and terminal - emulator. - - Copyright (c) 2020 -2022, Intel Corporation. All rights reserved.
- SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#ifndef _SERIAL_PORT_TERMINAL_LIB_H_ -#define _SERIAL_PORT_TERMINAL_LIB_H_ - -#include -#include -#include -#include -#include -#include -#include -#include - -// -// Below is the platform console device path -// -typedef struct { - VENDOR_DEVICE_PATH Guid; - UART_DEVICE_PATH Uart; - VENDOR_DEVICE_PATH TerminalType; - EFI_DEVICE_PATH_PROTOCOL End; -} SERIAL_DEVICE_PATH; - -#define gEndEntire \ - { \ - END_DEVICE_PATH_TYPE, END_ENTIRE_DEVICE_PATH_SUBTYPE, { END_DEVICE_PATH_LENGTH, 0 } \ - } - -#endif +/** @file + Header file for NULL named library for the Serial Port Terminal Redirection library. + + This library adds a Terminal Device connected to SerialDxe to the UEFI Console + Variables. This allows BIOS Setup, UEFI Shell, etc. to be used on a headless + system via a null modem and terminal + emulator. + + Copyright (c) 2020 -2022, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _SERIAL_PORT_TERMINAL_LIB_H_ +#define _SERIAL_PORT_TERMINAL_LIB_H_ + +#include +#include +#include +#include +#include +#include +#include +#include + +// +// Below is the platform console device path +// +typedef struct { + VENDOR_DEVICE_PATH Guid; + UART_DEVICE_PATH Uart; + VENDOR_DEVICE_PATH TerminalType; + EFI_DEVICE_PATH_PROTOCOL End; +} SERIAL_DEVICE_PATH; + +#define gEndEntire \ + { \ + END_DEVICE_PATH_TYPE, END_ENTIRE_DEVICE_PATH_SUBTYPE, { END_DEVICE_PATH_LENGTH, 0 } \ + } + +#endif diff --git a/MinPlatformPkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.inf b/MinPlatformPkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.inf index 056b5377cd..ac1a06b2a5 100644 --- a/MinPlatformPkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.inf +++ b/MinPlatformPkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.inf @@ -1,50 +1,50 @@ -## @file -# Component information file for the Serial Port Terminal Redirection library. -# -# This library adds a Terminal Device connected to SerialDxe to the UEFI Console -# Variables. This allows BIOS Setup, UEFI Shell, etc. to be used on a headless -# system via a null modem and terminal -# -# Copyright (c) 2020, Intel Corporation. All rights reserved.
-# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## -[Defines] - INF_VERSION = 0x00010006 - BASE_NAME = SerialPortTerminalLib - FILE_GUID = E12BFA46-95F2-4ADC-9774-7E38DE78741E - MODULE_TYPE = UEFI_DRIVER - VERSION_STRING = 1.2 - LIBRARY_CLASS = NULL|UEFI_DRIVER DXE_DRIVER DXE_RUNTIME_DRIVER - CONSTRUCTOR = SerialPortTerminalLibConstructor - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - -[Sources] - SerialPortTerminalLib.c - SerialPortTerminalLib.h - -[LibraryClasses] - BaseMemoryLib - DevicePathLib - DebugLib - UefiDriverEntryPoint - UefiBootManagerLib - UefiLib - -[Guids] - gEfiPcAnsiGuid - gEfiVT100Guid - gEfiVT100PlusGuid - gEfiVTUTF8Guid - gEfiTtyTermGuid - -[Pcd] - gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate - gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits - gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity - gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits - gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType +## @file +# Component information file for the Serial Port Terminal Redirection library. +# +# This library adds a Terminal Device connected to SerialDxe to the UEFI Console +# Variables. This allows BIOS Setup, UEFI Shell, etc. to be used on a headless +# system via a null modem and terminal +# +# Copyright (c) 2020, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## +[Defines] + INF_VERSION = 0x00010006 + BASE_NAME = SerialPortTerminalLib + FILE_GUID = E12BFA46-95F2-4ADC-9774-7E38DE78741E + MODULE_TYPE = UEFI_DRIVER + VERSION_STRING = 1.2 + LIBRARY_CLASS = NULL|UEFI_DRIVER DXE_DRIVER DXE_RUNTIME_DRIVER + CONSTRUCTOR = SerialPortTerminalLibConstructor + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + +[Sources] + SerialPortTerminalLib.c + SerialPortTerminalLib.h + +[LibraryClasses] + BaseMemoryLib + DevicePathLib + DebugLib + UefiDriverEntryPoint + UefiBootManagerLib + UefiLib + +[Guids] + gEfiPcAnsiGuid + gEfiVT100Guid + gEfiVT100PlusGuid + gEfiVTUTF8Guid + gEfiTtyTermGuid + +[Pcd] + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits + gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType diff --git a/MinPlatformPkg/MinPlatformPkg.dec b/MinPlatformPkg/MinPlatformPkg.dec index 74bad0e7b3..ebf536215e 100644 --- a/MinPlatformPkg/MinPlatformPkg.dec +++ b/MinPlatformPkg/MinPlatformPkg.dec @@ -1,409 +1,409 @@ -## @file -# This package provides the modules that build for a minimal platform. -# This MinPlatformPkg should only depend on EDKII Core packages. -# -# The DEC files are used by the utilities that parse DSC and -# INF files to generate AutoGen.c and AutoGen.h files -# for the build infrastructure. -# -# Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.
-# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
-# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - - -[Defines] - DEC_SPECIFICATION = 0x00010017 - PACKAGE_NAME = MinPlatformPkg - PACKAGE_VERSION = 0.1 - PACKAGE_GUID = 463B3B00-0D18-4a5f-90C0-D5B851D2574B - -[Includes] - Include - -[Ppis] - gEdkiiSiliconInitializedPpiGuid = {0x82a72dc8, 0x61ec, 0x403e, {0xb1, 0x5a, 0x8d, 0x7a, 0x3a, 0x71, 0x84, 0x98}} - - gPeiBaseMemoryTestPpiGuid = {0xb6ec423c, 0x21d2, 0x490d, {0x85, 0xc6, 0xdd, 0x58, 0x64, 0xea, 0xa6, 0x74}} - gPeiPlatformMemorySizePpiGuid = {0x9a7ef41e, 0xc140, 0x4bd1, {0xb8, 0x84, 0x1e, 0x11, 0x24, 0x0b, 0x4c, 0xe6}} - - gPlatformInitTempRamExitPpiGuid = {0xbae23646, 0xbd60, 0x4f8b, {0xb3, 0xf9, 0xf3, 0x91, 0xee, 0x7e, 0xe6, 0xc8}} - -[Guids] - gMinPlatformPkgTokenSpaceGuid = {0x69d13bf0, 0xaf91, 0x4d96, {0xaa, 0x9f, 0x21, 0x84, 0xc5, 0xce, 0x3b, 0xc0}} - - gAdapterInfoPlatformTestPointGuid = {0x5381e3ea, 0x0b77, 0x4580, {0xad, 0xdf, 0xa9, 0x1c, 0x08, 0x3b, 0xf2, 0x97}} - - gBoardDetectGuid = {0x1792429d, 0x9d94, 0x4e08, {0xa0, 0x99, 0x73, 0xa2, 0x86, 0xae, 0xb4, 0x35}} - gBoardPreMemInitGuid = {0x191dcfcf, 0xe16e, 0x43bb, {0x9b, 0xc3, 0x6e, 0xee, 0x6f, 0xab, 0x3a, 0x27}} - gBoardPostMemInitGuid = {0xa0e933ea, 0xa69, 0x47fb, {0xb2, 0xab, 0xa1, 0x6f, 0x71, 0x2d, 0x6f, 0x58}} - gBoardNotificationInitGuid = {0x78dbcabf, 0xc544, 0x4e6f, {0xaf, 0x3a, 0x71, 0x17, 0xd9, 0x42, 0x4e, 0xd1}} - - gBoardAcpiTableGuid = {0xd70e9f57, 0x69f, 0x4bef, {0x96, 0xc0, 0x84, 0x74, 0xf4, 0xa2, 0x5f, 0x3a}} - gBoardAcpiEnableGuid = {0x9727b610, 0xf645, 0x4429, {0x89, 0x21, 0x2c, 0x2b, 0x58, 0xdc, 0xbb, 0x0a}} - - gDefaultDataFileGuid = {0x1ae42876, 0x008f, 0x4161, {0xb2, 0xb7, 0x1c, 0x0d, 0x15, 0xc5, 0xef, 0x43}} - gDefaultDataOptSizeFileGuid = {0x003e7b41, 0x98a2, 0x4be2, {0xb2, 0x7a, 0x6c, 0x30, 0xc7, 0x65, 0x52, 0x25}} - - # BDS Hook point event Guids - gBdsEventBeforeConsoleAfterTrustedConsoleGuid = {0x51e49ff5, 0x28a9, 0x4159, { 0xac, 0x8a, 0xb8, 0xc4, 0x88, 0xa7, 0xfd, 0xee}} - gBdsEventBeforeConsoleBeforeEndOfDxeGuid = {0xfcf26e41, 0xbda6, 0x4633, { 0xb5, 0x73, 0xd4, 0xb8, 0x0e, 0x6d, 0xd0, 0x78}} - gBdsEventAfterConsoleReadyBeforeBootOptionGuid = {0x8eb3d5dc, 0xf4e7, 0x4b57, { 0xa9, 0xe7, 0x27, 0x39, 0x10, 0xf2, 0x18, 0x9f}} - gFspNvsBufferVariableGuid = {0x9c7715cd, 0x8d66, 0x4d2a, { 0x90, 0x0d, 0x01, 0x45, 0x9a, 0x57, 0x59, 0x6b}} - -[LibraryClasses] - - PeiLib|Include/Library/PeiLib.h - - AslUpdateLib|Include/Library/AslUpdateLib.h - BoardAcpiEnableLib|Include/Library/BoardAcpiEnableLib.h - BoardAcpiTableLib|Include/Library/BoardAcpiTableLib.h - - SiliconPolicyInitLib|Include/Library/SiliconPolicyInitLib.h - SiliconPolicyUpdateLib|Include/Library/SiliconPolicyUpdateLib.h - - BoardInitLib|Include/Library/BoardInitLib.h - MultiBoardInitSupportLib|Include/Library/MultiBoardInitSupportLib.h - SecBoardInitLib|Include/Library/SecBoardInitLib.h - - TpmPlatformHierarchyLib|Include/Library/TpmPlatformHierarchyLib.h - - # MU_CHANGE [BEGIN] - Support platform level configuration testing - PlatformConfigCheckLib|Include/Library/PlatformConfigCheckLib.h - # MU_CHANGE [END] - TestPointLib|Include/Library/TestPointLib.h - TestPointCheckLib|Include/Library/TestPointCheckLib.h - - SetCacheMtrrLib|Include/Library/SetCacheMtrrLib.h - - ReportCpuHobLib|Include/Library/ReportCpuHobLib.h - - BoardBootManagerLib|Include/Library/BoardBootManagerLib.h - CompressLib|Include/Library/CompressLib.h - HobVariableLib|Include/Library/HobVariableLib.h - MultiBoardAcpiSupportLib|Include/Library/MultiBoardAcpiSupportLib.h - ReportFvLib|Include/Library/ReportFvLib.h - - VariableReadLib|Include/Library/VariableReadLib.h - VariableWriteLib|Include/Library/VariableWriteLib.h - LargeVariableReadLib|Include/Library/LargeVariableReadLib.h - LargeVariableWriteLib|Include/Library/LargeVariableWriteLib.h - TestPointPciSpeedInfoLib|Include/Library/TestPointPciSpeedInfoLib.h - -[PcdsFixedAtBuild, PcdsPatchableInModule] - - gMinPlatformPkgTokenSpaceGuid.PcdFspMaxUpdSize|0x00000000|UINT32|0x80000000 - gMinPlatformPkgTokenSpaceGuid.PcdFspReservedSizeOnStackTop|0x00000040|UINT32|0x80000001 - gMinPlatformPkgTokenSpaceGuid.PcdPeiPhaseStackTop|0x00000000|UINT32|0x80000002 - - gMinPlatformPkgTokenSpaceGuid.PcdLocalApicAddress|0xFEE00000|UINT32|0x9000000B - gMinPlatformPkgTokenSpaceGuid.PcdLocalApicMmioSize|0x1000|UINT32|0x9000000C - - gMinPlatformPkgTokenSpaceGuid.PcdIoApicAddress|0xFEC00000|UINT32|0x9000000D - gMinPlatformPkgTokenSpaceGuid.PcdIoApicMmioSize|0x1000|UINT32|0x9000000E - gMinPlatformPkgTokenSpaceGuid.PcdIoApicId|0x02|UINT8|0x90000014 - - gMinPlatformPkgTokenSpaceGuid.PcdAcpiEnableSwSmi|0xF0|UINT8|0x90000012 - gMinPlatformPkgTokenSpaceGuid.PcdAcpiDisableSwSmi|0xF1|UINT8|0x90000013 - - gMinPlatformPkgTokenSpaceGuid.PcdPcIoApicCount|0|UINT8|0x90000015 - gMinPlatformPkgTokenSpaceGuid.PcdPcIoApicIdBase|0x09|UINT8|0x90000016 - gMinPlatformPkgTokenSpaceGuid.PcdPcIoApicAddressBase|0xFEC01000|UINT32|0x90000017 - gMinPlatformPkgTokenSpaceGuid.PcdPcIoApicInterruptBase|24|UINT32|0x90000018 - - gMinPlatformPkgTokenSpaceGuid.PcdMaxCpuThreadCount|2|UINT32|0x90000021 - gMinPlatformPkgTokenSpaceGuid.PcdMaxCpuCoreCount|8|UINT32|0x90000022 - gMinPlatformPkgTokenSpaceGuid.PcdMaxCpuSocketCount|4|UINT32|0x90000023 - - gMinPlatformPkgTokenSpaceGuid.PcdFadtSmiCmd|0x000000B2|UINT32|0x9000002A - - gMinPlatformPkgTokenSpaceGuid.PcdAcpiPm1AEventBlockAddress|0x1800|UINT16|0x00010035 - gMinPlatformPkgTokenSpaceGuid.PcdAcpiPm1BEventBlockAddress|0x0000|UINT16|0x00010036 - gMinPlatformPkgTokenSpaceGuid.PcdAcpiPm1AControlBlockAddress|0x1804|UINT16|0x0001037 - gMinPlatformPkgTokenSpaceGuid.PcdAcpiPm1BControlBlockAddress|0x0000|UINT16|0x00010038 - gMinPlatformPkgTokenSpaceGuid.PcdAcpiPm2ControlBlockAddress|0x1850|UINT16|0x00010039 - gMinPlatformPkgTokenSpaceGuid.PcdAcpiPmTimerBlockAddress|0x1808|UINT16|0x0001003A - gMinPlatformPkgTokenSpaceGuid.PcdAcpiGpe0BlockAddress|0x1880|UINT16|0x0001003B - gMinPlatformPkgTokenSpaceGuid.PcdAcpiGpe0BlockLength|0x00|UINT8|0x0001003C - gMinPlatformPkgTokenSpaceGuid.PcdAcpiGpe1BlockAddress|0x0000|UINT16|0x0001003D - gMinPlatformPkgTokenSpaceGuid.PcdAcpiGpe1BlockLength|0x00|UINT8|0x0001003E - gMinPlatformPkgTokenSpaceGuid.PcdAcpiGpe1Base|0x00|UINT8|0x00010040 - gMinPlatformPkgTokenSpaceGuid.PcdAcpiResetRegisterAccessSize|0x00|UINT8|0x00010042 - - gMinPlatformPkgTokenSpaceGuid.PcdAcpiXPm1aEvtBlkAccessSize|0x00|UINT8|0x00010043 - gMinPlatformPkgTokenSpaceGuid.PcdAcpiXPm1bEvtBlkAccessSize|0x00|UINT8|0x00010044 - gMinPlatformPkgTokenSpaceGuid.PcdAcpiXPm1aCntBlkAccessSize|0x00|UINT8|0x00010045 - gMinPlatformPkgTokenSpaceGuid.PcdAcpiXPm1bCntBlkAccessSize|0x00|UINT8|0x00010046 - gMinPlatformPkgTokenSpaceGuid.PcdAcpiXPm2CntBlkAccessSize|0x00|UINT8|0x00010047 - gMinPlatformPkgTokenSpaceGuid.PcdAcpiXPmTmrBlkAccessSize|0x00|UINT8|0x00010048 - gMinPlatformPkgTokenSpaceGuid.PcdAcpiXGpe0BlkAccessSize|0x00|UINT8|0x00010049 - gMinPlatformPkgTokenSpaceGuid.PcdAcpiXGpe1BlkAccessSize|0x00|UINT8|0x0001004A - gMinPlatformPkgTokenSpaceGuid.PcdAcpiXGpe1BlkRegisterBitWidth|0x00|UINT8|0x00010056 - # MU_CHANGE [BEGIN] - Update X_GPE1_BLK AddressSpaceId with PCD value - gMinPlatformPkgTokenSpaceGuid.PcdAcpiXGpe1BlkAddressSpaceId|0x00|UINT8|0x00010057 - # MU_CHANGE [END] - Update X_GPE1_BLK AddressSpaceId with PCD value - gMinPlatformPkgTokenSpaceGuid.PcdAcpiS4BiosReq|0x0000|UINT8|0x00010055 - - # - # FADT Duty Offset - The zero-based index of where the processor's duty cycle - # setting is within the processor's P_CNT register. - # - gMinPlatformPkgTokenSpaceGuid.PcdFadtDutyOffset|0x01|UINT8|0x90000028 - # - # FADT Duty Width - The bit width of the processor's duty cycle setting value in the P_CNT - # register. Each processor's duty cycle setting allows the software to select a nominal - # processor frequency below its absolute frequency. A duty width value of zero indicates - # the processor continuously runs at its base frequency. - # - # For more details about how the frequency is calculated, refer to the Fixed ACPI Description - # Table (FADT) section of the ACPI Specification. - # - gMinPlatformPkgTokenSpaceGuid.PcdFadtDutyWidth|0x00|UINT8|0x90000029 - - gMinPlatformPkgTokenSpaceGuid.PcdPlatformEfiAcpiReclaimMemorySize|0x65|UINT32|0x20000500 - gMinPlatformPkgTokenSpaceGuid.PcdPlatformEfiAcpiNvsMemorySize|0x30|UINT32|0x20000501 - gMinPlatformPkgTokenSpaceGuid.PcdPlatformEfiReservedMemorySize|0x402|UINT32|0x20000502 - gMinPlatformPkgTokenSpaceGuid.PcdPlatformEfiRtDataMemorySize|0x4b|UINT32|0x20000503 - gMinPlatformPkgTokenSpaceGuid.PcdPlatformEfiRtCodeMemorySize|0x25|UINT32|0x20000504 - - # - # The PCDs are used to control the Windows SMM Security Mitigations Table - Protection Flags - # - # BIT0: If set, expresses that for all synchronous SMM entries,SMM will validate that input and output buffers lie entirely within the expected fixed memory regions. - # BIT1: If set, expresses that for all synchronous SMM entries, SMM will validate that input and output pointers embedded within the fixed communication buffer only refer to address ranges \ - # that lie entirely within the expected fixed memory regions. - # BIT2: Firmware setting this bit is an indication that it will not allow reconfiguration of system resources via non-architectural mechanisms. - # BIT3-31: Reserved - # - gMinPlatformPkgTokenSpaceGuid.PcdWsmtProtectionFlags|0|UINT32|0x10001006 - - gMinPlatformPkgTokenSpaceGuid.PcdSecSerialPortDebugEnable|TRUE|BOOLEAN|0x00100206 - - # - # See HstiIbvFeatureBit.h for the definition - # - # #define HSTI_BYTE_ BIT - # - # It means BYTE BIT is for feature . - # - gMinPlatformPkgTokenSpaceGuid.PcdHstiIbvPlatformFeature|{0x00, 0x00, 0x00}|VOID*|0x00100301 - - # - # See TestPointCheckLib.h for the definition - # - # #define TEST_POINT_BYTE_ BIT - # - # It means BYTE BIT is for feature . - # BYTE0 BYTE1 BYTE2 BYTE3 BYTE4 BYTE5 BYTE6 BYTE7 BYTE8 - # Stage debug: {0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} - # Stage memory: {0x03, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} - # Stage UEFI boot: {0x03, 0x07, 0x03, 0x05, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} - # Stage OS boot: {0x03, 0x07, 0x03, 0x05, 0x3F, 0x00, 0x0F, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} - # Stage Secure boot: {0x03, 0x0F, 0x03, 0x1D, 0x3F, 0x0F, 0x0F, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} - # Stage Advanced: {0x03, 0x0F, 0x03, 0x1D, 0x3F, 0x0F, 0x0F, 0x07, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} - gMinPlatformPkgTokenSpaceGuid.PcdTestPointIbvPlatformFeature|{0x03, 0x0F, 0x03, 0x1D, 0x3F, 0x0F, 0x0F, 0x07, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}|VOID*|0x00100302 - - # MU_CHANGE - BEGIN - TCBZ3541 - # The platform may define a list of devices that are exempt from PCI BME testing. - # PCD Format is {SegmentNumber1, BusNumber1, DeviceNumber1, FunctionNumber1, SegmentNumber2, BusNumber2, DeviceNumber2, FunctionNumber2, ...} - gMinPlatformPkgTokenSpaceGuid.PcdTestPointIbvPlatformExemptPciBme|{0}|VOID*|0x00100303 - # MU_CHANGE - END - TCBZ3541 - - ## - ## The Flash relevant PCD are ineffective and will be patched basing on FDF definitions during build. - ## Set all of them to 0 here to prevent from confusion. - ## - gMinPlatformPkgTokenSpaceGuid.PcdFlashAreaBaseAddress|0xFF800000|UINT32|0x10000001 - gMinPlatformPkgTokenSpaceGuid.PcdFlashAreaSize|0x00800000|UINT32|0x10000002 - - ## Indicates the MMIO base address of the microcode FV in flash. - gMinPlatformPkgTokenSpaceGuid.PcdFlashFvMicrocodeBase|0xFFE60000|UINT32|0x30000004 - - ## Indicates the size of the microcode FV in flash. - gMinPlatformPkgTokenSpaceGuid.PcdFlashFvMicrocodeSize|0x000A0000|UINT32|0x30000005 - - ## Indicates the offset of the microcode FV relative to the beginning of flash. - gMinPlatformPkgTokenSpaceGuid.PcdFlashFvMicrocodeOffset|0x00660000|UINT32|0x30000006 - - ## Indicates the offset of the actual microcode content relative to the beginning of the microcode FV. - gMinPlatformPkgTokenSpaceGuid.PcdMicrocodeOffsetInFv|0x90|UINT32|0x30000007 - - gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemoryBase|0x00000000|UINT32|0x20000004 - gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemorySize|0x00000000|UINT32|0x20000005 - gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemoryOffset|0x00000000|UINT32|0x20000006 - gMinPlatformPkgTokenSpaceGuid.PcdFlashFvBspPreMemorySize|0x00000000|UINT32|0x20000030 - gMinPlatformPkgTokenSpaceGuid.PcdFlashFvBspPreMemoryBase|0x00000000|UINT32|0x20000031 - gMinPlatformPkgTokenSpaceGuid.PcdFlashFvBspPreMemoryOffset|0x00000000|UINT32|0x20000032 - - gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemoryBase|0x00000000|UINT32|0x20000007 - gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemorySize|0x00000000|UINT32|0x20000008 - gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemoryOffset|0x00000000|UINT32|0x20000009 - gMinPlatformPkgTokenSpaceGuid.PcdFlashFvBspSize|0x00000000|UINT32|0x20000033 - gMinPlatformPkgTokenSpaceGuid.PcdFlashFvBspBase|0x00000000|UINT32|0x20000034 - gMinPlatformPkgTokenSpaceGuid.PcdFlashFvBspOffset|0x00000000|UINT32|0x20000035 - - gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootBase|0x00000000|UINT32|0x2000000A - gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootSize|0x00000000|UINT32|0x2000000B - gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootOffset|0x00000000|UINT32|0x2000000C - gMinPlatformPkgTokenSpaceGuid.PcdFlashFvOsBootBase|0x00000000|UINT32|0x2000000D - gMinPlatformPkgTokenSpaceGuid.PcdFlashFvOsBootSize|0x00000000|UINT32|0x2000000E - gMinPlatformPkgTokenSpaceGuid.PcdFlashFvOsBootOffset|0x00000000|UINT32|0x2000000F - gMinPlatformPkgTokenSpaceGuid.PcdFlashFvSecurityBase|0x00000000|UINT32|0x20000010 - gMinPlatformPkgTokenSpaceGuid.PcdFlashFvSecuritySize|0x00000000|UINT32|0x20000011 - gMinPlatformPkgTokenSpaceGuid.PcdFlashFvSecurityOffset|0x00000000|UINT32|0x20000012 - gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemoryBase|0x00000000|UINT32|0x2000002D - gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemorySize|0x00000000|UINT32|0x2000002E - gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemoryOffset|0x00000000|UINT32|0x2000002F - gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedBase|0x00000000|UINT32|0x20000013 - gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedSize|0x00000000|UINT32|0x20000014 - gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedOffset|0x00000000|UINT32|0x20000015 - - gMinPlatformPkgTokenSpaceGuid.PcdFlashNvStorageBase|0x00000000|UINT32|0x20000016 - gMinPlatformPkgTokenSpaceGuid.PcdFlashNvStorageSize|0x00000000|UINT32|0x20000017 - gMinPlatformPkgTokenSpaceGuid.PcdFlashNvStorageOffset|0x00000000|UINT32|0x20000018 - gMinPlatformPkgTokenSpaceGuid.PcdFlashNvStorageVariableOffset|0x00000000|UINT32|0x20000019 - gMinPlatformPkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareOffset|0x00000000|UINT32|0x2000001A - gMinPlatformPkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingOffset|0x00000000|UINT32|0x2000001B - - gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTBase|0x00000000|UINT32|0x20000021 - gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTSize|0x00000000|UINT32|0x20000022 - gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTOffset|0x00000000|UINT32|0x20000023 - gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMBase|0x00000000|UINT32|0x20000024 - gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMSize|0x00000000|UINT32|0x20000025 - gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMOffset|0x00000000|UINT32|0x20000026 - gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSBase|0x00000000|UINT32|0x20000027 - gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSSize|0x00000000|UINT32|0x20000028 - gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSOffset|0x00000000|UINT32|0x20000029 - gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspUBase|0x00000000|UINT32|0x2000002A - gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspUSize|0x00000000|UINT32|0x2000002B - gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspUOffset|0x00000000|UINT32|0x2000002C - - # GUID of Shell file to be loaded, default value is gUefiShellFileGuid define in ShellPkg.dec - gMinPlatformPkgTokenSpaceGuid.PcdShellFile|{GUID({0x7c04a583, 0x9e3e, 0x4f1c, {0xad, 0x65, 0xe0, 0x52, 0x68, 0xd0, 0xb4, 0xd1}})}|VOID*|0x20000230 - gMinPlatformPkgTokenSpaceGuid.PcdShellFileDesc|L"Internal UEFI Shell 2.0"|VOID*|0x20000231 - -[PcdsDynamic, PcdsDynamicEx] - gMinPlatformPkgTokenSpaceGuid.PcdPcIoApicEnable|0x0|UINT32|0x90000019 - gMinPlatformPkgTokenSpaceGuid.PcdAcpiSleepControlRegisterAddressSpaceId|0x00|UINT8|0x0001004B - gMinPlatformPkgTokenSpaceGuid.PcdAcpiSleepControlRegisterBitWidth|0x00|UINT8|0x0001004C - gMinPlatformPkgTokenSpaceGuid.PcdAcpiSleepControlRegisterBitOffset|0x00|UINT8|0x0001004D - gMinPlatformPkgTokenSpaceGuid.PcdAcpiSleepControlRegisterAccessSize|0x00|UINT8|0x0001004E - gMinPlatformPkgTokenSpaceGuid.PcdAcpiSleepControlRegisterAddress|0x0000000000000000|UINT64|0x0001004F - gMinPlatformPkgTokenSpaceGuid.PcdAcpiSleepStatusRegisterAddressSpaceId|0x00|UINT8|0x00010050 - gMinPlatformPkgTokenSpaceGuid.PcdAcpiSleepStatusRegisterBitWidth|0x00|UINT8|0x00010051 - gMinPlatformPkgTokenSpaceGuid.PcdAcpiSleepStatusRegisterBitOffset|0x00|UINT8|0x00010052 - gMinPlatformPkgTokenSpaceGuid.PcdAcpiSleepStatusRegisterAccessSize|0x00|UINT8|0x00010053 - gMinPlatformPkgTokenSpaceGuid.PcdAcpiSleepStatusRegisterAddress|0x0000000000000000|UINT64|0x00010054 - -[PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx] - - ## - ## Allocate 56 KB [0x2000..0xFFFF] of I/O space for Pci Devices - ## If PcdPciReservedMemLimit =0 Pci Reserved default MMIO Limit is PciExpressBase else use PcdPciReservedMemLimit . - ## - gMinPlatformPkgTokenSpaceGuid.PcdPciReservedIobase |0x2000 |UINT16|0x40010041 - gMinPlatformPkgTokenSpaceGuid.PcdPciReservedIoLimit |0xFFFF |UINT16|0x40010042 - gMinPlatformPkgTokenSpaceGuid.PcdPciReservedMemBase |0x90000000 |UINT32|0x40010043 - gMinPlatformPkgTokenSpaceGuid.PcdPciReservedMemLimit |0x00000000 |UINT32|0x40010044 - gMinPlatformPkgTokenSpaceGuid.PcdPciReservedMemAbove4GBBase |0xFFFFFFFFFFFFFFFF |UINT64|0x40010045 - gMinPlatformPkgTokenSpaceGuid.PcdPciReservedMemAbove4GBLimit |0x0000000000000000 |UINT64|0x40010046 - gMinPlatformPkgTokenSpaceGuid.PcdPciReservedPMemBase |0xFFFFFFFF |UINT32|0x40010047 - gMinPlatformPkgTokenSpaceGuid.PcdPciReservedPMemLimit |0x00000000 |UINT32|0x40010048 - gMinPlatformPkgTokenSpaceGuid.PcdPciReservedPMemAbove4GBBase |0xFFFFFFFFFFFFFFFF |UINT64|0x40010049 - gMinPlatformPkgTokenSpaceGuid.PcdPciReservedPMemAbove4GBLimit|0x0000000000000000 |UINT64|0x4001004A - gMinPlatformPkgTokenSpaceGuid.PcdPciDmaAbove4G |FALSE|BOOLEAN|0x4001004B - gMinPlatformPkgTokenSpaceGuid.PcdPciNoExtendedConfigSpace |FALSE|BOOLEAN|0x4001004C - gMinPlatformPkgTokenSpaceGuid.PcdPciResourceAssigned |FALSE|BOOLEAN|0x4001004D - gMinPlatformPkgTokenSpaceGuid.PcdPciSegmentCount |0x1 |UINT8|0x4001004E - gMinPlatformPkgTokenSpaceGuid.PcdRandomizePlatformHierarchy |TRUE |BOOLEAN|0x4001004F - - gMinPlatformPkgTokenSpaceGuid.PcdPciExpressRegionLength|0x10000000|UINT32|0x0010004 - gMinPlatformPkgTokenSpaceGuid.PcdFspCpuPeiApWakeupBufferAddr|0x9f000|UINT32|0x30000008 - - gMinPlatformPkgTokenSpaceGuid.PcdPlatformMemoryCheckLevel|0|UINT32|0x30000009 - - ## This PCD is to control which device is the potential trusted console input device.

- # For example:
- # USB Short Form: UsbHID(0xFFFF,0xFFFF,0x1,0x1)
- # //Header VendorId ProductId Class SubClass Protocol
- # {0x03, 0x0F, 0x0B, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x03, 0x01, 0x01,
- # //Header
- # 0x7F, 0xFF, 0x04, 0x00}
- gMinPlatformPkgTokenSpaceGuid.PcdTrustedConsoleInputDevicePath|{0x03, 0x0F, 0x0B, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x03, 0x01, 0x01, 0x7F, 0xFF, 0x04, 0x00}|VOID*|0x300000A - - ## This PCD is to control which device is the potential trusted console output device.

- # For example:
- # Integrated Graphic: PciRoot(0x0)/Pci(0x2,0x0)
- # //Header HID UID
- # {0x02, 0x01, 0x0C, 0x00, 0xd0, 0x41, 0x03, 0x0A, 0x00, 0x00, 0x00, 0x00,
- # //Header Func Dev
- # 0x01, 0x01, 0x06, 0x00, 0x00, 0x02, - # //Header
- # 0x7F, 0xFF, 0x04, 0x00}
- gMinPlatformPkgTokenSpaceGuid.PcdTrustedConsoleOutputDevicePath|{0x02, 0x01, 0x0C, 0x00, 0xd0, 0x41, 0x03, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x06, 0x00, 0x00, 0x02, 0x7F, 0xFF, 0x04, 0x00}|VOID*|0x300000C - - ## This PCD is to control which device is the potential trusted storage device.

- # For example:
- # Integrated SATA: PciRoot(0x0)/Pci(0x17,0x0)
- # //Header HID UID
- # {0x02, 0x01, 0x0C, 0x00, 0xd0, 0x41, 0x03, 0x0A, 0x00, 0x00, 0x00, 0x00,
- # //Header Func Dev
- # 0x01, 0x01, 0x06, 0x00, 0x00, 0x17, - # //Header
- # 0x7F, 0xFF, 0x04, 0x00}
- gMinPlatformPkgTokenSpaceGuid.PcdTrustedStorageDevicePath|{0x02, 0x01, 0x0C, 0x00, 0xd0, 0x41, 0x03, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x06, 0x00, 0x00, 0x17, 0x7F, 0xFF, 0x04, 0x00}|VOID*|0x3000010 - gMinPlatformPkgTokenSpaceGuid.PcdEnableCompressedFspNvsBuffer|FALSE|BOOLEAN|0x30000011 - ## ACPI - gMinPlatformPkgTokenSpaceGuid.PcdFadtPreferredPmProfile|0x02|UINT8|0x90000025 - gMinPlatformPkgTokenSpaceGuid.PcdFadtIaPcBootArch|0x0001|UINT16|0x90000026 - gMinPlatformPkgTokenSpaceGuid.PcdFadtFlags|0x000086A5|UINT32|0x90000027 - -[PcdsFixedAtBuild] - - ## MinPlatform Boot Stage Selector - # Stage 1 - enable debug (system deadloop after debug init) - # Stage 2 - mem init (system deadloop after mem init) - # Stage 3 - boot to shell only - # Stage 4 - boot to OS - # Stage 5 - boot to OS with security boot enabled - # Stage 6 - boot with advanced features enabled - # - gMinPlatformPkgTokenSpaceGuid.PcdBootStage|4|UINT8|0xF00000A0 - - ## FSP Boot Mode Selector - # FALSE: The board is not a FSP wrapper (FSP binary not used) - # TRUE: The board is a FSP wrapper (FSP binary is used) - # - gMinPlatformPkgTokenSpaceGuid.PcdFspWrapperBootMode|FALSE|BOOLEAN|0x80000008 - - ## FSP Dispatch Mode: Use the PEI Main Binary Included in FSP-M - # FALSE: The PEI Main included in FvPreMemory is used to dispatch all PEIMs - # (both inside FSP and outside FSP). - # Pros: - # * PEI Main is re-built from source and is always the latest version - # * Platform code can link any desired LibraryClass to PEI Main - # (Ex: Custom DebugLib instance, SerialPortLib, etc.) - # Cons: - # * The PEI Main being used to execute FSP PEIMs is not the PEI Main - # that the FSP PEIMs were tested with, adding risk of breakage. - # * Two copies of PEI Main will exist in the final binary, - # #1 in FSP-M, #2 in FvPreMemory. The copy in FSP-M is never - # executed, wasting space. - # - # TRUE: The PEI Main included in FSP is used to dispatch all PEIMs - # (both inside FSP and outside FSP). PEI Main will not be included in - # FvPreMemory. This is the default and is the recommended choice. - # - gMinPlatformPkgTokenSpaceGuid.PcdFspDispatchModeUseFspPeiMain|TRUE|BOOLEAN|0xF00000A8 - -[PcdsFeatureFlag] - - gMinPlatformPkgTokenSpaceGuid.PcdStopAfterDebugInit |FALSE|BOOLEAN|0xF00000A1 - gMinPlatformPkgTokenSpaceGuid.PcdStopAfterMemInit |FALSE|BOOLEAN|0xF00000A2 - gMinPlatformPkgTokenSpaceGuid.PcdBootToShellOnly |FALSE|BOOLEAN|0xF00000A3 - gMinPlatformPkgTokenSpaceGuid.PcdUefiSecureBootEnable |FALSE|BOOLEAN|0xF00000A4 - gMinPlatformPkgTokenSpaceGuid.PcdTpm2Enable |FALSE|BOOLEAN|0xF00000A5 - gMinPlatformPkgTokenSpaceGuid.PcdPerformanceEnable |FALSE|BOOLEAN|0xF00000A7 - gMinPlatformPkgTokenSpaceGuid.PcdSerialTerminalEnable |FALSE|BOOLEAN|0xF00000B0 +## @file +# This package provides the modules that build for a minimal platform. +# This MinPlatformPkg should only depend on EDKII Core packages. +# +# The DEC files are used by the utilities that parse DSC and +# INF files to generate AutoGen.c and AutoGen.h files +# for the build infrastructure. +# +# Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.
+# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + + +[Defines] + DEC_SPECIFICATION = 0x00010017 + PACKAGE_NAME = MinPlatformPkg + PACKAGE_VERSION = 0.1 + PACKAGE_GUID = 463B3B00-0D18-4a5f-90C0-D5B851D2574B + +[Includes] + Include + +[Ppis] + gEdkiiSiliconInitializedPpiGuid = {0x82a72dc8, 0x61ec, 0x403e, {0xb1, 0x5a, 0x8d, 0x7a, 0x3a, 0x71, 0x84, 0x98}} + + gPeiBaseMemoryTestPpiGuid = {0xb6ec423c, 0x21d2, 0x490d, {0x85, 0xc6, 0xdd, 0x58, 0x64, 0xea, 0xa6, 0x74}} + gPeiPlatformMemorySizePpiGuid = {0x9a7ef41e, 0xc140, 0x4bd1, {0xb8, 0x84, 0x1e, 0x11, 0x24, 0x0b, 0x4c, 0xe6}} + + gPlatformInitTempRamExitPpiGuid = {0xbae23646, 0xbd60, 0x4f8b, {0xb3, 0xf9, 0xf3, 0x91, 0xee, 0x7e, 0xe6, 0xc8}} + +[Guids] + gMinPlatformPkgTokenSpaceGuid = {0x69d13bf0, 0xaf91, 0x4d96, {0xaa, 0x9f, 0x21, 0x84, 0xc5, 0xce, 0x3b, 0xc0}} + + gAdapterInfoPlatformTestPointGuid = {0x5381e3ea, 0x0b77, 0x4580, {0xad, 0xdf, 0xa9, 0x1c, 0x08, 0x3b, 0xf2, 0x97}} + + gBoardDetectGuid = {0x1792429d, 0x9d94, 0x4e08, {0xa0, 0x99, 0x73, 0xa2, 0x86, 0xae, 0xb4, 0x35}} + gBoardPreMemInitGuid = {0x191dcfcf, 0xe16e, 0x43bb, {0x9b, 0xc3, 0x6e, 0xee, 0x6f, 0xab, 0x3a, 0x27}} + gBoardPostMemInitGuid = {0xa0e933ea, 0xa69, 0x47fb, {0xb2, 0xab, 0xa1, 0x6f, 0x71, 0x2d, 0x6f, 0x58}} + gBoardNotificationInitGuid = {0x78dbcabf, 0xc544, 0x4e6f, {0xaf, 0x3a, 0x71, 0x17, 0xd9, 0x42, 0x4e, 0xd1}} + + gBoardAcpiTableGuid = {0xd70e9f57, 0x69f, 0x4bef, {0x96, 0xc0, 0x84, 0x74, 0xf4, 0xa2, 0x5f, 0x3a}} + gBoardAcpiEnableGuid = {0x9727b610, 0xf645, 0x4429, {0x89, 0x21, 0x2c, 0x2b, 0x58, 0xdc, 0xbb, 0x0a}} + + gDefaultDataFileGuid = {0x1ae42876, 0x008f, 0x4161, {0xb2, 0xb7, 0x1c, 0x0d, 0x15, 0xc5, 0xef, 0x43}} + gDefaultDataOptSizeFileGuid = {0x003e7b41, 0x98a2, 0x4be2, {0xb2, 0x7a, 0x6c, 0x30, 0xc7, 0x65, 0x52, 0x25}} + + # BDS Hook point event Guids + gBdsEventBeforeConsoleAfterTrustedConsoleGuid = {0x51e49ff5, 0x28a9, 0x4159, { 0xac, 0x8a, 0xb8, 0xc4, 0x88, 0xa7, 0xfd, 0xee}} + gBdsEventBeforeConsoleBeforeEndOfDxeGuid = {0xfcf26e41, 0xbda6, 0x4633, { 0xb5, 0x73, 0xd4, 0xb8, 0x0e, 0x6d, 0xd0, 0x78}} + gBdsEventAfterConsoleReadyBeforeBootOptionGuid = {0x8eb3d5dc, 0xf4e7, 0x4b57, { 0xa9, 0xe7, 0x27, 0x39, 0x10, 0xf2, 0x18, 0x9f}} + gFspNvsBufferVariableGuid = {0x9c7715cd, 0x8d66, 0x4d2a, { 0x90, 0x0d, 0x01, 0x45, 0x9a, 0x57, 0x59, 0x6b}} + +[LibraryClasses] + + PeiLib|Include/Library/PeiLib.h + + AslUpdateLib|Include/Library/AslUpdateLib.h + BoardAcpiEnableLib|Include/Library/BoardAcpiEnableLib.h + BoardAcpiTableLib|Include/Library/BoardAcpiTableLib.h + + SiliconPolicyInitLib|Include/Library/SiliconPolicyInitLib.h + SiliconPolicyUpdateLib|Include/Library/SiliconPolicyUpdateLib.h + + BoardInitLib|Include/Library/BoardInitLib.h + MultiBoardInitSupportLib|Include/Library/MultiBoardInitSupportLib.h + SecBoardInitLib|Include/Library/SecBoardInitLib.h + + TpmPlatformHierarchyLib|Include/Library/TpmPlatformHierarchyLib.h + + # MU_CHANGE [BEGIN] - Support platform level configuration testing + PlatformConfigCheckLib|Include/Library/PlatformConfigCheckLib.h + # MU_CHANGE [END] + TestPointLib|Include/Library/TestPointLib.h + TestPointCheckLib|Include/Library/TestPointCheckLib.h + + SetCacheMtrrLib|Include/Library/SetCacheMtrrLib.h + + ReportCpuHobLib|Include/Library/ReportCpuHobLib.h + + BoardBootManagerLib|Include/Library/BoardBootManagerLib.h + CompressLib|Include/Library/CompressLib.h + HobVariableLib|Include/Library/HobVariableLib.h + MultiBoardAcpiSupportLib|Include/Library/MultiBoardAcpiSupportLib.h + ReportFvLib|Include/Library/ReportFvLib.h + + VariableReadLib|Include/Library/VariableReadLib.h + VariableWriteLib|Include/Library/VariableWriteLib.h + LargeVariableReadLib|Include/Library/LargeVariableReadLib.h + LargeVariableWriteLib|Include/Library/LargeVariableWriteLib.h + TestPointPciSpeedInfoLib|Include/Library/TestPointPciSpeedInfoLib.h + +[PcdsFixedAtBuild, PcdsPatchableInModule] + + gMinPlatformPkgTokenSpaceGuid.PcdFspMaxUpdSize|0x00000000|UINT32|0x80000000 + gMinPlatformPkgTokenSpaceGuid.PcdFspReservedSizeOnStackTop|0x00000040|UINT32|0x80000001 + gMinPlatformPkgTokenSpaceGuid.PcdPeiPhaseStackTop|0x00000000|UINT32|0x80000002 + + gMinPlatformPkgTokenSpaceGuid.PcdLocalApicAddress|0xFEE00000|UINT32|0x9000000B + gMinPlatformPkgTokenSpaceGuid.PcdLocalApicMmioSize|0x1000|UINT32|0x9000000C + + gMinPlatformPkgTokenSpaceGuid.PcdIoApicAddress|0xFEC00000|UINT32|0x9000000D + gMinPlatformPkgTokenSpaceGuid.PcdIoApicMmioSize|0x1000|UINT32|0x9000000E + gMinPlatformPkgTokenSpaceGuid.PcdIoApicId|0x02|UINT8|0x90000014 + + gMinPlatformPkgTokenSpaceGuid.PcdAcpiEnableSwSmi|0xF0|UINT8|0x90000012 + gMinPlatformPkgTokenSpaceGuid.PcdAcpiDisableSwSmi|0xF1|UINT8|0x90000013 + + gMinPlatformPkgTokenSpaceGuid.PcdPcIoApicCount|0|UINT8|0x90000015 + gMinPlatformPkgTokenSpaceGuid.PcdPcIoApicIdBase|0x09|UINT8|0x90000016 + gMinPlatformPkgTokenSpaceGuid.PcdPcIoApicAddressBase|0xFEC01000|UINT32|0x90000017 + gMinPlatformPkgTokenSpaceGuid.PcdPcIoApicInterruptBase|24|UINT32|0x90000018 + + gMinPlatformPkgTokenSpaceGuid.PcdMaxCpuThreadCount|2|UINT32|0x90000021 + gMinPlatformPkgTokenSpaceGuid.PcdMaxCpuCoreCount|8|UINT32|0x90000022 + gMinPlatformPkgTokenSpaceGuid.PcdMaxCpuSocketCount|4|UINT32|0x90000023 + + gMinPlatformPkgTokenSpaceGuid.PcdFadtSmiCmd|0x000000B2|UINT32|0x9000002A + + gMinPlatformPkgTokenSpaceGuid.PcdAcpiPm1AEventBlockAddress|0x1800|UINT16|0x00010035 + gMinPlatformPkgTokenSpaceGuid.PcdAcpiPm1BEventBlockAddress|0x0000|UINT16|0x00010036 + gMinPlatformPkgTokenSpaceGuid.PcdAcpiPm1AControlBlockAddress|0x1804|UINT16|0x0001037 + gMinPlatformPkgTokenSpaceGuid.PcdAcpiPm1BControlBlockAddress|0x0000|UINT16|0x00010038 + gMinPlatformPkgTokenSpaceGuid.PcdAcpiPm2ControlBlockAddress|0x1850|UINT16|0x00010039 + gMinPlatformPkgTokenSpaceGuid.PcdAcpiPmTimerBlockAddress|0x1808|UINT16|0x0001003A + gMinPlatformPkgTokenSpaceGuid.PcdAcpiGpe0BlockAddress|0x1880|UINT16|0x0001003B + gMinPlatformPkgTokenSpaceGuid.PcdAcpiGpe0BlockLength|0x00|UINT8|0x0001003C + gMinPlatformPkgTokenSpaceGuid.PcdAcpiGpe1BlockAddress|0x0000|UINT16|0x0001003D + gMinPlatformPkgTokenSpaceGuid.PcdAcpiGpe1BlockLength|0x00|UINT8|0x0001003E + gMinPlatformPkgTokenSpaceGuid.PcdAcpiGpe1Base|0x00|UINT8|0x00010040 + gMinPlatformPkgTokenSpaceGuid.PcdAcpiResetRegisterAccessSize|0x00|UINT8|0x00010042 + + gMinPlatformPkgTokenSpaceGuid.PcdAcpiXPm1aEvtBlkAccessSize|0x00|UINT8|0x00010043 + gMinPlatformPkgTokenSpaceGuid.PcdAcpiXPm1bEvtBlkAccessSize|0x00|UINT8|0x00010044 + gMinPlatformPkgTokenSpaceGuid.PcdAcpiXPm1aCntBlkAccessSize|0x00|UINT8|0x00010045 + gMinPlatformPkgTokenSpaceGuid.PcdAcpiXPm1bCntBlkAccessSize|0x00|UINT8|0x00010046 + gMinPlatformPkgTokenSpaceGuid.PcdAcpiXPm2CntBlkAccessSize|0x00|UINT8|0x00010047 + gMinPlatformPkgTokenSpaceGuid.PcdAcpiXPmTmrBlkAccessSize|0x00|UINT8|0x00010048 + gMinPlatformPkgTokenSpaceGuid.PcdAcpiXGpe0BlkAccessSize|0x00|UINT8|0x00010049 + gMinPlatformPkgTokenSpaceGuid.PcdAcpiXGpe1BlkAccessSize|0x00|UINT8|0x0001004A + gMinPlatformPkgTokenSpaceGuid.PcdAcpiXGpe1BlkRegisterBitWidth|0x00|UINT8|0x00010056 + # MU_CHANGE [BEGIN] - Update X_GPE1_BLK AddressSpaceId with PCD value + gMinPlatformPkgTokenSpaceGuid.PcdAcpiXGpe1BlkAddressSpaceId|0x00|UINT8|0x00010057 + # MU_CHANGE [END] - Update X_GPE1_BLK AddressSpaceId with PCD value + gMinPlatformPkgTokenSpaceGuid.PcdAcpiS4BiosReq|0x0000|UINT8|0x00010055 + + # + # FADT Duty Offset - The zero-based index of where the processor's duty cycle + # setting is within the processor's P_CNT register. + # + gMinPlatformPkgTokenSpaceGuid.PcdFadtDutyOffset|0x01|UINT8|0x90000028 + # + # FADT Duty Width - The bit width of the processor's duty cycle setting value in the P_CNT + # register. Each processor's duty cycle setting allows the software to select a nominal + # processor frequency below its absolute frequency. A duty width value of zero indicates + # the processor continuously runs at its base frequency. + # + # For more details about how the frequency is calculated, refer to the Fixed ACPI Description + # Table (FADT) section of the ACPI Specification. + # + gMinPlatformPkgTokenSpaceGuid.PcdFadtDutyWidth|0x00|UINT8|0x90000029 + + gMinPlatformPkgTokenSpaceGuid.PcdPlatformEfiAcpiReclaimMemorySize|0x65|UINT32|0x20000500 + gMinPlatformPkgTokenSpaceGuid.PcdPlatformEfiAcpiNvsMemorySize|0x30|UINT32|0x20000501 + gMinPlatformPkgTokenSpaceGuid.PcdPlatformEfiReservedMemorySize|0x402|UINT32|0x20000502 + gMinPlatformPkgTokenSpaceGuid.PcdPlatformEfiRtDataMemorySize|0x4b|UINT32|0x20000503 + gMinPlatformPkgTokenSpaceGuid.PcdPlatformEfiRtCodeMemorySize|0x25|UINT32|0x20000504 + + # + # The PCDs are used to control the Windows SMM Security Mitigations Table - Protection Flags + # + # BIT0: If set, expresses that for all synchronous SMM entries,SMM will validate that input and output buffers lie entirely within the expected fixed memory regions. + # BIT1: If set, expresses that for all synchronous SMM entries, SMM will validate that input and output pointers embedded within the fixed communication buffer only refer to address ranges \ + # that lie entirely within the expected fixed memory regions. + # BIT2: Firmware setting this bit is an indication that it will not allow reconfiguration of system resources via non-architectural mechanisms. + # BIT3-31: Reserved + # + gMinPlatformPkgTokenSpaceGuid.PcdWsmtProtectionFlags|0|UINT32|0x10001006 + + gMinPlatformPkgTokenSpaceGuid.PcdSecSerialPortDebugEnable|TRUE|BOOLEAN|0x00100206 + + # + # See HstiIbvFeatureBit.h for the definition + # + # #define HSTI_BYTE_ BIT + # + # It means BYTE BIT is for feature . + # + gMinPlatformPkgTokenSpaceGuid.PcdHstiIbvPlatformFeature|{0x00, 0x00, 0x00}|VOID*|0x00100301 + + # + # See TestPointCheckLib.h for the definition + # + # #define TEST_POINT_BYTE_ BIT + # + # It means BYTE BIT is for feature . + # BYTE0 BYTE1 BYTE2 BYTE3 BYTE4 BYTE5 BYTE6 BYTE7 BYTE8 + # Stage debug: {0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + # Stage memory: {0x03, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + # Stage UEFI boot: {0x03, 0x07, 0x03, 0x05, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + # Stage OS boot: {0x03, 0x07, 0x03, 0x05, 0x3F, 0x00, 0x0F, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + # Stage Secure boot: {0x03, 0x0F, 0x03, 0x1D, 0x3F, 0x0F, 0x0F, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + # Stage Advanced: {0x03, 0x0F, 0x03, 0x1D, 0x3F, 0x0F, 0x0F, 0x07, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + gMinPlatformPkgTokenSpaceGuid.PcdTestPointIbvPlatformFeature|{0x03, 0x0F, 0x03, 0x1D, 0x3F, 0x0F, 0x0F, 0x07, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}|VOID*|0x00100302 + + # MU_CHANGE - BEGIN - TCBZ3541 + # The platform may define a list of devices that are exempt from PCI BME testing. + # PCD Format is {SegmentNumber1, BusNumber1, DeviceNumber1, FunctionNumber1, SegmentNumber2, BusNumber2, DeviceNumber2, FunctionNumber2, ...} + gMinPlatformPkgTokenSpaceGuid.PcdTestPointIbvPlatformExemptPciBme|{0}|VOID*|0x00100303 + # MU_CHANGE - END - TCBZ3541 + + ## + ## The Flash relevant PCD are ineffective and will be patched basing on FDF definitions during build. + ## Set all of them to 0 here to prevent from confusion. + ## + gMinPlatformPkgTokenSpaceGuid.PcdFlashAreaBaseAddress|0xFF800000|UINT32|0x10000001 + gMinPlatformPkgTokenSpaceGuid.PcdFlashAreaSize|0x00800000|UINT32|0x10000002 + + ## Indicates the MMIO base address of the microcode FV in flash. + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvMicrocodeBase|0xFFE60000|UINT32|0x30000004 + + ## Indicates the size of the microcode FV in flash. + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvMicrocodeSize|0x000A0000|UINT32|0x30000005 + + ## Indicates the offset of the microcode FV relative to the beginning of flash. + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvMicrocodeOffset|0x00660000|UINT32|0x30000006 + + ## Indicates the offset of the actual microcode content relative to the beginning of the microcode FV. + gMinPlatformPkgTokenSpaceGuid.PcdMicrocodeOffsetInFv|0x90|UINT32|0x30000007 + + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemoryBase|0x00000000|UINT32|0x20000004 + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemorySize|0x00000000|UINT32|0x20000005 + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemoryOffset|0x00000000|UINT32|0x20000006 + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvBspPreMemorySize|0x00000000|UINT32|0x20000030 + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvBspPreMemoryBase|0x00000000|UINT32|0x20000031 + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvBspPreMemoryOffset|0x00000000|UINT32|0x20000032 + + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemoryBase|0x00000000|UINT32|0x20000007 + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemorySize|0x00000000|UINT32|0x20000008 + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemoryOffset|0x00000000|UINT32|0x20000009 + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvBspSize|0x00000000|UINT32|0x20000033 + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvBspBase|0x00000000|UINT32|0x20000034 + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvBspOffset|0x00000000|UINT32|0x20000035 + + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootBase|0x00000000|UINT32|0x2000000A + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootSize|0x00000000|UINT32|0x2000000B + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootOffset|0x00000000|UINT32|0x2000000C + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvOsBootBase|0x00000000|UINT32|0x2000000D + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvOsBootSize|0x00000000|UINT32|0x2000000E + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvOsBootOffset|0x00000000|UINT32|0x2000000F + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvSecurityBase|0x00000000|UINT32|0x20000010 + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvSecuritySize|0x00000000|UINT32|0x20000011 + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvSecurityOffset|0x00000000|UINT32|0x20000012 + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemoryBase|0x00000000|UINT32|0x2000002D + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemorySize|0x00000000|UINT32|0x2000002E + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemoryOffset|0x00000000|UINT32|0x2000002F + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedBase|0x00000000|UINT32|0x20000013 + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedSize|0x00000000|UINT32|0x20000014 + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedOffset|0x00000000|UINT32|0x20000015 + + gMinPlatformPkgTokenSpaceGuid.PcdFlashNvStorageBase|0x00000000|UINT32|0x20000016 + gMinPlatformPkgTokenSpaceGuid.PcdFlashNvStorageSize|0x00000000|UINT32|0x20000017 + gMinPlatformPkgTokenSpaceGuid.PcdFlashNvStorageOffset|0x00000000|UINT32|0x20000018 + gMinPlatformPkgTokenSpaceGuid.PcdFlashNvStorageVariableOffset|0x00000000|UINT32|0x20000019 + gMinPlatformPkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareOffset|0x00000000|UINT32|0x2000001A + gMinPlatformPkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingOffset|0x00000000|UINT32|0x2000001B + + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTBase|0x00000000|UINT32|0x20000021 + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTSize|0x00000000|UINT32|0x20000022 + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTOffset|0x00000000|UINT32|0x20000023 + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMBase|0x00000000|UINT32|0x20000024 + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMSize|0x00000000|UINT32|0x20000025 + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMOffset|0x00000000|UINT32|0x20000026 + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSBase|0x00000000|UINT32|0x20000027 + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSSize|0x00000000|UINT32|0x20000028 + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSOffset|0x00000000|UINT32|0x20000029 + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspUBase|0x00000000|UINT32|0x2000002A + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspUSize|0x00000000|UINT32|0x2000002B + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspUOffset|0x00000000|UINT32|0x2000002C + + # GUID of Shell file to be loaded, default value is gUefiShellFileGuid define in ShellPkg.dec + gMinPlatformPkgTokenSpaceGuid.PcdShellFile|{GUID({0x7c04a583, 0x9e3e, 0x4f1c, {0xad, 0x65, 0xe0, 0x52, 0x68, 0xd0, 0xb4, 0xd1}})}|VOID*|0x20000230 + gMinPlatformPkgTokenSpaceGuid.PcdShellFileDesc|L"Internal UEFI Shell 2.0"|VOID*|0x20000231 + +[PcdsDynamic, PcdsDynamicEx] + gMinPlatformPkgTokenSpaceGuid.PcdPcIoApicEnable|0x0|UINT32|0x90000019 + gMinPlatformPkgTokenSpaceGuid.PcdAcpiSleepControlRegisterAddressSpaceId|0x00|UINT8|0x0001004B + gMinPlatformPkgTokenSpaceGuid.PcdAcpiSleepControlRegisterBitWidth|0x00|UINT8|0x0001004C + gMinPlatformPkgTokenSpaceGuid.PcdAcpiSleepControlRegisterBitOffset|0x00|UINT8|0x0001004D + gMinPlatformPkgTokenSpaceGuid.PcdAcpiSleepControlRegisterAccessSize|0x00|UINT8|0x0001004E + gMinPlatformPkgTokenSpaceGuid.PcdAcpiSleepControlRegisterAddress|0x0000000000000000|UINT64|0x0001004F + gMinPlatformPkgTokenSpaceGuid.PcdAcpiSleepStatusRegisterAddressSpaceId|0x00|UINT8|0x00010050 + gMinPlatformPkgTokenSpaceGuid.PcdAcpiSleepStatusRegisterBitWidth|0x00|UINT8|0x00010051 + gMinPlatformPkgTokenSpaceGuid.PcdAcpiSleepStatusRegisterBitOffset|0x00|UINT8|0x00010052 + gMinPlatformPkgTokenSpaceGuid.PcdAcpiSleepStatusRegisterAccessSize|0x00|UINT8|0x00010053 + gMinPlatformPkgTokenSpaceGuid.PcdAcpiSleepStatusRegisterAddress|0x0000000000000000|UINT64|0x00010054 + +[PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx] + + ## + ## Allocate 56 KB [0x2000..0xFFFF] of I/O space for Pci Devices + ## If PcdPciReservedMemLimit =0 Pci Reserved default MMIO Limit is PciExpressBase else use PcdPciReservedMemLimit . + ## + gMinPlatformPkgTokenSpaceGuid.PcdPciReservedIobase |0x2000 |UINT16|0x40010041 + gMinPlatformPkgTokenSpaceGuid.PcdPciReservedIoLimit |0xFFFF |UINT16|0x40010042 + gMinPlatformPkgTokenSpaceGuid.PcdPciReservedMemBase |0x90000000 |UINT32|0x40010043 + gMinPlatformPkgTokenSpaceGuid.PcdPciReservedMemLimit |0x00000000 |UINT32|0x40010044 + gMinPlatformPkgTokenSpaceGuid.PcdPciReservedMemAbove4GBBase |0xFFFFFFFFFFFFFFFF |UINT64|0x40010045 + gMinPlatformPkgTokenSpaceGuid.PcdPciReservedMemAbove4GBLimit |0x0000000000000000 |UINT64|0x40010046 + gMinPlatformPkgTokenSpaceGuid.PcdPciReservedPMemBase |0xFFFFFFFF |UINT32|0x40010047 + gMinPlatformPkgTokenSpaceGuid.PcdPciReservedPMemLimit |0x00000000 |UINT32|0x40010048 + gMinPlatformPkgTokenSpaceGuid.PcdPciReservedPMemAbove4GBBase |0xFFFFFFFFFFFFFFFF |UINT64|0x40010049 + gMinPlatformPkgTokenSpaceGuid.PcdPciReservedPMemAbove4GBLimit|0x0000000000000000 |UINT64|0x4001004A + gMinPlatformPkgTokenSpaceGuid.PcdPciDmaAbove4G |FALSE|BOOLEAN|0x4001004B + gMinPlatformPkgTokenSpaceGuid.PcdPciNoExtendedConfigSpace |FALSE|BOOLEAN|0x4001004C + gMinPlatformPkgTokenSpaceGuid.PcdPciResourceAssigned |FALSE|BOOLEAN|0x4001004D + gMinPlatformPkgTokenSpaceGuid.PcdPciSegmentCount |0x1 |UINT8|0x4001004E + gMinPlatformPkgTokenSpaceGuid.PcdRandomizePlatformHierarchy |TRUE |BOOLEAN|0x4001004F + + gMinPlatformPkgTokenSpaceGuid.PcdPciExpressRegionLength|0x10000000|UINT32|0x0010004 + gMinPlatformPkgTokenSpaceGuid.PcdFspCpuPeiApWakeupBufferAddr|0x9f000|UINT32|0x30000008 + + gMinPlatformPkgTokenSpaceGuid.PcdPlatformMemoryCheckLevel|0|UINT32|0x30000009 + + ## This PCD is to control which device is the potential trusted console input device.

+ # For example:
+ # USB Short Form: UsbHID(0xFFFF,0xFFFF,0x1,0x1)
+ # //Header VendorId ProductId Class SubClass Protocol
+ # {0x03, 0x0F, 0x0B, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x03, 0x01, 0x01,
+ # //Header
+ # 0x7F, 0xFF, 0x04, 0x00}
+ gMinPlatformPkgTokenSpaceGuid.PcdTrustedConsoleInputDevicePath|{0x03, 0x0F, 0x0B, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x03, 0x01, 0x01, 0x7F, 0xFF, 0x04, 0x00}|VOID*|0x300000A + + ## This PCD is to control which device is the potential trusted console output device.

+ # For example:
+ # Integrated Graphic: PciRoot(0x0)/Pci(0x2,0x0)
+ # //Header HID UID
+ # {0x02, 0x01, 0x0C, 0x00, 0xd0, 0x41, 0x03, 0x0A, 0x00, 0x00, 0x00, 0x00,
+ # //Header Func Dev
+ # 0x01, 0x01, 0x06, 0x00, 0x00, 0x02, + # //Header
+ # 0x7F, 0xFF, 0x04, 0x00}
+ gMinPlatformPkgTokenSpaceGuid.PcdTrustedConsoleOutputDevicePath|{0x02, 0x01, 0x0C, 0x00, 0xd0, 0x41, 0x03, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x06, 0x00, 0x00, 0x02, 0x7F, 0xFF, 0x04, 0x00}|VOID*|0x300000C + + ## This PCD is to control which device is the potential trusted storage device.

+ # For example:
+ # Integrated SATA: PciRoot(0x0)/Pci(0x17,0x0)
+ # //Header HID UID
+ # {0x02, 0x01, 0x0C, 0x00, 0xd0, 0x41, 0x03, 0x0A, 0x00, 0x00, 0x00, 0x00,
+ # //Header Func Dev
+ # 0x01, 0x01, 0x06, 0x00, 0x00, 0x17, + # //Header
+ # 0x7F, 0xFF, 0x04, 0x00}
+ gMinPlatformPkgTokenSpaceGuid.PcdTrustedStorageDevicePath|{0x02, 0x01, 0x0C, 0x00, 0xd0, 0x41, 0x03, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x06, 0x00, 0x00, 0x17, 0x7F, 0xFF, 0x04, 0x00}|VOID*|0x3000010 + gMinPlatformPkgTokenSpaceGuid.PcdEnableCompressedFspNvsBuffer|FALSE|BOOLEAN|0x30000011 + ## ACPI + gMinPlatformPkgTokenSpaceGuid.PcdFadtPreferredPmProfile|0x02|UINT8|0x90000025 + gMinPlatformPkgTokenSpaceGuid.PcdFadtIaPcBootArch|0x0001|UINT16|0x90000026 + gMinPlatformPkgTokenSpaceGuid.PcdFadtFlags|0x000086A5|UINT32|0x90000027 + +[PcdsFixedAtBuild] + + ## MinPlatform Boot Stage Selector + # Stage 1 - enable debug (system deadloop after debug init) + # Stage 2 - mem init (system deadloop after mem init) + # Stage 3 - boot to shell only + # Stage 4 - boot to OS + # Stage 5 - boot to OS with security boot enabled + # Stage 6 - boot with advanced features enabled + # + gMinPlatformPkgTokenSpaceGuid.PcdBootStage|4|UINT8|0xF00000A0 + + ## FSP Boot Mode Selector + # FALSE: The board is not a FSP wrapper (FSP binary not used) + # TRUE: The board is a FSP wrapper (FSP binary is used) + # + gMinPlatformPkgTokenSpaceGuid.PcdFspWrapperBootMode|FALSE|BOOLEAN|0x80000008 + + ## FSP Dispatch Mode: Use the PEI Main Binary Included in FSP-M + # FALSE: The PEI Main included in FvPreMemory is used to dispatch all PEIMs + # (both inside FSP and outside FSP). + # Pros: + # * PEI Main is re-built from source and is always the latest version + # * Platform code can link any desired LibraryClass to PEI Main + # (Ex: Custom DebugLib instance, SerialPortLib, etc.) + # Cons: + # * The PEI Main being used to execute FSP PEIMs is not the PEI Main + # that the FSP PEIMs were tested with, adding risk of breakage. + # * Two copies of PEI Main will exist in the final binary, + # #1 in FSP-M, #2 in FvPreMemory. The copy in FSP-M is never + # executed, wasting space. + # + # TRUE: The PEI Main included in FSP is used to dispatch all PEIMs + # (both inside FSP and outside FSP). PEI Main will not be included in + # FvPreMemory. This is the default and is the recommended choice. + # + gMinPlatformPkgTokenSpaceGuid.PcdFspDispatchModeUseFspPeiMain|TRUE|BOOLEAN|0xF00000A8 + +[PcdsFeatureFlag] + + gMinPlatformPkgTokenSpaceGuid.PcdStopAfterDebugInit |FALSE|BOOLEAN|0xF00000A1 + gMinPlatformPkgTokenSpaceGuid.PcdStopAfterMemInit |FALSE|BOOLEAN|0xF00000A2 + gMinPlatformPkgTokenSpaceGuid.PcdBootToShellOnly |FALSE|BOOLEAN|0xF00000A3 + gMinPlatformPkgTokenSpaceGuid.PcdUefiSecureBootEnable |FALSE|BOOLEAN|0xF00000A4 + gMinPlatformPkgTokenSpaceGuid.PcdTpm2Enable |FALSE|BOOLEAN|0xF00000A5 + gMinPlatformPkgTokenSpaceGuid.PcdPerformanceEnable |FALSE|BOOLEAN|0xF00000A7 + gMinPlatformPkgTokenSpaceGuid.PcdSerialTerminalEnable |FALSE|BOOLEAN|0xF00000B0 diff --git a/MinPlatformPkg/Pci/Library/PciHostBridgeLibSimple/PciHostBridgeLibSimple.c b/MinPlatformPkg/Pci/Library/PciHostBridgeLibSimple/PciHostBridgeLibSimple.c index 7480f0906f..e38975eee5 100644 --- a/MinPlatformPkg/Pci/Library/PciHostBridgeLibSimple/PciHostBridgeLibSimple.c +++ b/MinPlatformPkg/Pci/Library/PciHostBridgeLibSimple/PciHostBridgeLibSimple.c @@ -1,187 +1,187 @@ -/** @file - PciHostBridge Library - -Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -GLOBAL_REMOVE_IF_UNREFERENCED CHAR16 *mPciHostBridgeLibAcpiAddressSpaceTypeStr[] = { - L"Mem", L"I/O", L"Bus" -}; -ACPI_HID_DEVICE_PATH mRootBridgeDeviceNodeTemplate = { - { - ACPI_DEVICE_PATH, - ACPI_DP, - { - (UINT8) (sizeof (ACPI_HID_DEVICE_PATH)), - (UINT8) ((sizeof (ACPI_HID_DEVICE_PATH)) >> 8) - } - }, - EISA_PNP_ID (0x0A03), - 0 -}; - -PCI_ROOT_BRIDGE mRootBridgeTemplate = { - 0, - EFI_PCI_ATTRIBUTE_ISA_MOTHERBOARD_IO | - EFI_PCI_ATTRIBUTE_IDE_PRIMARY_IO | - EFI_PCI_ATTRIBUTE_ISA_IO | - EFI_PCI_ATTRIBUTE_ISA_IO_16 | - EFI_PCI_ATTRIBUTE_VGA_PALETTE_IO | - EFI_PCI_ATTRIBUTE_VGA_PALETTE_IO_16 | - EFI_PCI_ATTRIBUTE_VGA_MEMORY | - EFI_PCI_ATTRIBUTE_VGA_IO | - EFI_PCI_ATTRIBUTE_VGA_IO_16, // Supports; - 0, // Attributes; - FALSE, // DmaAbove4G; - FALSE, // NoExtendedConfigSpace; - FALSE, // ResourceAssigned; - EFI_PCI_HOST_BRIDGE_COMBINE_MEM_PMEM, // AllocationAttributes - { 0, 255 }, // Bus - { 0, 0 }, // Io - to be fixed later - { 0, 0 }, // Mem - to be fixed later - { 0, 0 }, // MemAbove4G - to be fixed later - { 0, 0 }, // PMem - COMBINE_MEM_PMEM indicating no PMem and PMemAbove4GB - { 0, 0 }, // PMemAbove4G - NULL // DevicePath; -}; - -/** - Return all the root bridge instances. - - @param Count Return the count of root bridge instances. - - @return All the root bridge instances, it will be NULL if system has insufficient memory - resources available and count will be zero. -**/ - -PCI_ROOT_BRIDGE * -EFIAPI -PciHostBridgeGetRootBridges ( - UINTN *Count - ) -{ - UINT8 Index; - PCI_ROOT_BRIDGE *RootBridge; - - RootBridge = AllocateZeroPool (sizeof (PCI_ROOT_BRIDGE) * PcdGet8 (PcdPciSegmentCount)); - if (RootBridge == NULL) { - DEBUG ((DEBUG_ERROR, "PciHostBridge: Out of resource\n")); - *Count = 0; - return RootBridge; - } - - mRootBridgeTemplate.Mem.Base = PcdGet32 (PcdPciReservedMemBase); - if (PcdGet32(PcdPciReservedMemLimit) != 0) { - mRootBridgeTemplate.Mem.Limit = PcdGet32 (PcdPciReservedMemLimit); - } else { - mRootBridgeTemplate.Mem.Limit = PcdGet64 (PcdPciExpressBaseAddress) - 1; - } - - mRootBridgeTemplate.MemAbove4G.Base = PcdGet64 (PcdPciReservedMemAbove4GBBase); - mRootBridgeTemplate.MemAbove4G.Limit = PcdGet64 (PcdPciReservedMemAbove4GBLimit); - - mRootBridgeTemplate.PMem.Base = PcdGet32 (PcdPciReservedPMemBase); - mRootBridgeTemplate.PMem.Limit = PcdGet32 (PcdPciReservedPMemLimit); - mRootBridgeTemplate.PMemAbove4G.Base = PcdGet64 (PcdPciReservedPMemAbove4GBBase); - mRootBridgeTemplate.PMemAbove4G.Limit = PcdGet64 (PcdPciReservedPMemAbove4GBLimit); - - if (mRootBridgeTemplate.MemAbove4G.Base < mRootBridgeTemplate.MemAbove4G.Limit) { - mRootBridgeTemplate.AllocationAttributes |= EFI_PCI_HOST_BRIDGE_MEM64_DECODE; - } - - mRootBridgeTemplate.Io.Base = PcdGet16 (PcdPciReservedIobase); - mRootBridgeTemplate.Io.Limit = PcdGet16 (PcdPciReservedIoLimit); - - mRootBridgeTemplate.DmaAbove4G = PcdGetBool (PcdPciDmaAbove4G); - mRootBridgeTemplate.NoExtendedConfigSpace = PcdGetBool (PcdPciNoExtendedConfigSpace); - mRootBridgeTemplate.ResourceAssigned = PcdGetBool (PcdPciResourceAssigned); - - for (Index = 0; Index < PcdGet8 (PcdPciSegmentCount); Index ++) { - mRootBridgeDeviceNodeTemplate.UID = Index; - mRootBridgeTemplate.Segment = Index; - mRootBridgeTemplate.DevicePath = NULL; - mRootBridgeTemplate.DevicePath = AppendDevicePathNode (NULL, &mRootBridgeDeviceNodeTemplate.Header); - CopyMem (RootBridge + Index, &mRootBridgeTemplate, sizeof (PCI_ROOT_BRIDGE)); - } - - *Count = PcdGet8 (PcdPciSegmentCount); - return RootBridge; -} - -VOID -EFIAPI -PciHostBridgeFreeRootBridges ( - PCI_ROOT_BRIDGE *Bridges, - UINTN Count - ) -{ - ASSERT (Count <= PcdGet8 (PcdPciSegmentCount)); - FreePool (Bridges->DevicePath); -} - -/** - Inform the platform that the resource conflict happens. - - @param HostBridgeHandle Handle of the Host Bridge. - @param Configuration Pointer to PCI I/O and PCI memory resource descriptors. - The Configuration contains the resources for all the - root bridges. The resource for each root bridge is - terminated with END descriptor and an additional END - is appended indicating the end of the whole resources. - The resource descriptor field values follow the description - in EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.SubmitResources(). -**/ - -VOID -EFIAPI -PciHostBridgeResourceConflict ( - EFI_HANDLE HostBridgeHandle, - VOID *Configuration - ) -{ - EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptor; - UINTN RootBridgeIndex; - DEBUG ((DEBUG_ERROR, "PciHostBridge: Resource conflict happens!\n")); - - RootBridgeIndex = 0; - Descriptor = (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *) Configuration; - while (Descriptor->Desc == ACPI_ADDRESS_SPACE_DESCRIPTOR) { - DEBUG ((DEBUG_ERROR, "RootBridge[%d]:\n", RootBridgeIndex++)); - for (; Descriptor->Desc == ACPI_ADDRESS_SPACE_DESCRIPTOR; Descriptor++) { - ASSERT (Descriptor->ResType < - sizeof (mPciHostBridgeLibAcpiAddressSpaceTypeStr) / sizeof (mPciHostBridgeLibAcpiAddressSpaceTypeStr[0]) - ); - DEBUG ((DEBUG_ERROR, " %s: Length/Alignment = 0x%lx / 0x%lx\n", - mPciHostBridgeLibAcpiAddressSpaceTypeStr[Descriptor->ResType], Descriptor->AddrLen, Descriptor->AddrRangeMax)); - if (Descriptor->ResType == ACPI_ADDRESS_SPACE_TYPE_MEM) { - DEBUG ((DEBUG_ERROR, " Granularity/SpecificFlag = %ld / %02x%s\n", - Descriptor->AddrSpaceGranularity, Descriptor->SpecificFlag, - ((Descriptor->SpecificFlag & EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_CACHEABLE_PREFETCHABLE) != 0) ? L" (Prefetchable)" : L"" - )); - } - } - // - // Skip the END descriptor for root bridge - // - ASSERT (Descriptor->Desc == ACPI_END_TAG_DESCRIPTOR); - Descriptor = (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *) ((EFI_ACPI_END_TAG_DESCRIPTOR *) Descriptor + 1); - } - - ASSERT (FALSE); -} +/** @file + PciHostBridge Library + +Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +GLOBAL_REMOVE_IF_UNREFERENCED CHAR16 *mPciHostBridgeLibAcpiAddressSpaceTypeStr[] = { + L"Mem", L"I/O", L"Bus" +}; +ACPI_HID_DEVICE_PATH mRootBridgeDeviceNodeTemplate = { + { + ACPI_DEVICE_PATH, + ACPI_DP, + { + (UINT8) (sizeof (ACPI_HID_DEVICE_PATH)), + (UINT8) ((sizeof (ACPI_HID_DEVICE_PATH)) >> 8) + } + }, + EISA_PNP_ID (0x0A03), + 0 +}; + +PCI_ROOT_BRIDGE mRootBridgeTemplate = { + 0, + EFI_PCI_ATTRIBUTE_ISA_MOTHERBOARD_IO | + EFI_PCI_ATTRIBUTE_IDE_PRIMARY_IO | + EFI_PCI_ATTRIBUTE_ISA_IO | + EFI_PCI_ATTRIBUTE_ISA_IO_16 | + EFI_PCI_ATTRIBUTE_VGA_PALETTE_IO | + EFI_PCI_ATTRIBUTE_VGA_PALETTE_IO_16 | + EFI_PCI_ATTRIBUTE_VGA_MEMORY | + EFI_PCI_ATTRIBUTE_VGA_IO | + EFI_PCI_ATTRIBUTE_VGA_IO_16, // Supports; + 0, // Attributes; + FALSE, // DmaAbove4G; + FALSE, // NoExtendedConfigSpace; + FALSE, // ResourceAssigned; + EFI_PCI_HOST_BRIDGE_COMBINE_MEM_PMEM, // AllocationAttributes + { 0, 255 }, // Bus + { 0, 0 }, // Io - to be fixed later + { 0, 0 }, // Mem - to be fixed later + { 0, 0 }, // MemAbove4G - to be fixed later + { 0, 0 }, // PMem - COMBINE_MEM_PMEM indicating no PMem and PMemAbove4GB + { 0, 0 }, // PMemAbove4G + NULL // DevicePath; +}; + +/** + Return all the root bridge instances. + + @param Count Return the count of root bridge instances. + + @return All the root bridge instances, it will be NULL if system has insufficient memory + resources available and count will be zero. +**/ + +PCI_ROOT_BRIDGE * +EFIAPI +PciHostBridgeGetRootBridges ( + UINTN *Count + ) +{ + UINT8 Index; + PCI_ROOT_BRIDGE *RootBridge; + + RootBridge = AllocateZeroPool (sizeof (PCI_ROOT_BRIDGE) * PcdGet8 (PcdPciSegmentCount)); + if (RootBridge == NULL) { + DEBUG ((DEBUG_ERROR, "PciHostBridge: Out of resource\n")); + *Count = 0; + return RootBridge; + } + + mRootBridgeTemplate.Mem.Base = PcdGet32 (PcdPciReservedMemBase); + if (PcdGet32(PcdPciReservedMemLimit) != 0) { + mRootBridgeTemplate.Mem.Limit = PcdGet32 (PcdPciReservedMemLimit); + } else { + mRootBridgeTemplate.Mem.Limit = PcdGet64 (PcdPciExpressBaseAddress) - 1; + } + + mRootBridgeTemplate.MemAbove4G.Base = PcdGet64 (PcdPciReservedMemAbove4GBBase); + mRootBridgeTemplate.MemAbove4G.Limit = PcdGet64 (PcdPciReservedMemAbove4GBLimit); + + mRootBridgeTemplate.PMem.Base = PcdGet32 (PcdPciReservedPMemBase); + mRootBridgeTemplate.PMem.Limit = PcdGet32 (PcdPciReservedPMemLimit); + mRootBridgeTemplate.PMemAbove4G.Base = PcdGet64 (PcdPciReservedPMemAbove4GBBase); + mRootBridgeTemplate.PMemAbove4G.Limit = PcdGet64 (PcdPciReservedPMemAbove4GBLimit); + + if (mRootBridgeTemplate.MemAbove4G.Base < mRootBridgeTemplate.MemAbove4G.Limit) { + mRootBridgeTemplate.AllocationAttributes |= EFI_PCI_HOST_BRIDGE_MEM64_DECODE; + } + + mRootBridgeTemplate.Io.Base = PcdGet16 (PcdPciReservedIobase); + mRootBridgeTemplate.Io.Limit = PcdGet16 (PcdPciReservedIoLimit); + + mRootBridgeTemplate.DmaAbove4G = PcdGetBool (PcdPciDmaAbove4G); + mRootBridgeTemplate.NoExtendedConfigSpace = PcdGetBool (PcdPciNoExtendedConfigSpace); + mRootBridgeTemplate.ResourceAssigned = PcdGetBool (PcdPciResourceAssigned); + + for (Index = 0; Index < PcdGet8 (PcdPciSegmentCount); Index ++) { + mRootBridgeDeviceNodeTemplate.UID = Index; + mRootBridgeTemplate.Segment = Index; + mRootBridgeTemplate.DevicePath = NULL; + mRootBridgeTemplate.DevicePath = AppendDevicePathNode (NULL, &mRootBridgeDeviceNodeTemplate.Header); + CopyMem (RootBridge + Index, &mRootBridgeTemplate, sizeof (PCI_ROOT_BRIDGE)); + } + + *Count = PcdGet8 (PcdPciSegmentCount); + return RootBridge; +} + +VOID +EFIAPI +PciHostBridgeFreeRootBridges ( + PCI_ROOT_BRIDGE *Bridges, + UINTN Count + ) +{ + ASSERT (Count <= PcdGet8 (PcdPciSegmentCount)); + FreePool (Bridges->DevicePath); +} + +/** + Inform the platform that the resource conflict happens. + + @param HostBridgeHandle Handle of the Host Bridge. + @param Configuration Pointer to PCI I/O and PCI memory resource descriptors. + The Configuration contains the resources for all the + root bridges. The resource for each root bridge is + terminated with END descriptor and an additional END + is appended indicating the end of the whole resources. + The resource descriptor field values follow the description + in EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.SubmitResources(). +**/ + +VOID +EFIAPI +PciHostBridgeResourceConflict ( + EFI_HANDLE HostBridgeHandle, + VOID *Configuration + ) +{ + EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptor; + UINTN RootBridgeIndex; + DEBUG ((DEBUG_ERROR, "PciHostBridge: Resource conflict happens!\n")); + + RootBridgeIndex = 0; + Descriptor = (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *) Configuration; + while (Descriptor->Desc == ACPI_ADDRESS_SPACE_DESCRIPTOR) { + DEBUG ((DEBUG_ERROR, "RootBridge[%d]:\n", RootBridgeIndex++)); + for (; Descriptor->Desc == ACPI_ADDRESS_SPACE_DESCRIPTOR; Descriptor++) { + ASSERT (Descriptor->ResType < + sizeof (mPciHostBridgeLibAcpiAddressSpaceTypeStr) / sizeof (mPciHostBridgeLibAcpiAddressSpaceTypeStr[0]) + ); + DEBUG ((DEBUG_ERROR, " %s: Length/Alignment = 0x%lx / 0x%lx\n", + mPciHostBridgeLibAcpiAddressSpaceTypeStr[Descriptor->ResType], Descriptor->AddrLen, Descriptor->AddrRangeMax)); + if (Descriptor->ResType == ACPI_ADDRESS_SPACE_TYPE_MEM) { + DEBUG ((DEBUG_ERROR, " Granularity/SpecificFlag = %ld / %02x%s\n", + Descriptor->AddrSpaceGranularity, Descriptor->SpecificFlag, + ((Descriptor->SpecificFlag & EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_CACHEABLE_PREFETCHABLE) != 0) ? L" (Prefetchable)" : L"" + )); + } + } + // + // Skip the END descriptor for root bridge + // + ASSERT (Descriptor->Desc == ACPI_END_TAG_DESCRIPTOR); + Descriptor = (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *) ((EFI_ACPI_END_TAG_DESCRIPTOR *) Descriptor + 1); + } + + ASSERT (FALSE); +} diff --git a/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckSmiHandlerInstrument.c b/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckSmiHandlerInstrument.c index fe14f7b4b0..3a0e4ff90b 100644 --- a/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckSmiHandlerInstrument.c +++ b/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckSmiHandlerInstrument.c @@ -1,669 +1,669 @@ -/** @file - -Copyright (c) 2017, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define PROFILE_NAME_STRING_LENGTH 64 -CHAR8 mNameString[PROFILE_NAME_STRING_LENGTH + 1]; - -VOID *mSmiHandlerProfileDatabase; -UINTN mSmiHandlerProfileDatabaseSize; - -/** - This function dump raw data. - - @param Data raw data - @param Size raw data size -**/ -VOID -InternalDumpData ( - IN UINT8 *Data, - IN UINTN Size - ); - -/** - Get SMI handler profile database. -**/ -VOID -GetSmiHandlerProfileDatabase( - VOID - ) -{ - EFI_STATUS Status; - UINTN CommSize; - UINT8 *CommBuffer; - EFI_SMM_COMMUNICATE_HEADER *CommHeader; - SMI_HANDLER_PROFILE_PARAMETER_GET_INFO *CommGetInfo; - SMI_HANDLER_PROFILE_PARAMETER_GET_DATA_BY_OFFSET *CommGetData; - EFI_SMM_COMMUNICATION_PROTOCOL *SmmCommunication; - UINTN MinimalSizeNeeded; - EDKII_PI_SMM_COMMUNICATION_REGION_TABLE *PiSmmCommunicationRegionTable; - UINT32 Index; - EFI_MEMORY_DESCRIPTOR *Entry; - VOID *Buffer; - UINTN Size; - UINTN Offset; - - Status = gBS->LocateProtocol(&gEfiSmmCommunicationProtocolGuid, NULL, (VOID **)&SmmCommunication); - if (EFI_ERROR(Status)) { - DEBUG ((DEBUG_INFO, "SmiHandlerProfile: Locate SmmCommunication protocol - %r\n", Status)); - return ; - } - - MinimalSizeNeeded = EFI_PAGE_SIZE; - - Status = EfiGetSystemConfigurationTable( - &gEdkiiPiSmmCommunicationRegionTableGuid, - (VOID **)&PiSmmCommunicationRegionTable - ); - if (EFI_ERROR(Status)) { - DEBUG ((DEBUG_INFO, "SmiHandlerProfile: Get PiSmmCommunicationRegionTable - %r\n", Status)); - return ; - } - ASSERT(PiSmmCommunicationRegionTable != NULL); - Entry = (EFI_MEMORY_DESCRIPTOR *)(PiSmmCommunicationRegionTable + 1); - Size = 0; - for (Index = 0; Index < PiSmmCommunicationRegionTable->NumberOfEntries; Index++) { - if (Entry->Type == EfiConventionalMemory) { - Size = EFI_PAGES_TO_SIZE((UINTN)Entry->NumberOfPages); - if (Size >= MinimalSizeNeeded) { - break; - } - } - Entry = (EFI_MEMORY_DESCRIPTOR *)((UINT8 *)Entry + PiSmmCommunicationRegionTable->DescriptorSize); - } - ASSERT(Index < PiSmmCommunicationRegionTable->NumberOfEntries); - CommBuffer = (UINT8 *)(UINTN)Entry->PhysicalStart; - - // - // Get Size - // - CommHeader = (EFI_SMM_COMMUNICATE_HEADER *)&CommBuffer[0]; - CopyMem(&CommHeader->HeaderGuid, &gSmiHandlerProfileGuid, sizeof(gSmiHandlerProfileGuid)); - CommHeader->MessageLength = sizeof(SMI_HANDLER_PROFILE_PARAMETER_GET_INFO); - - CommGetInfo = (SMI_HANDLER_PROFILE_PARAMETER_GET_INFO *)&CommBuffer[OFFSET_OF(EFI_SMM_COMMUNICATE_HEADER, Data)]; - CommGetInfo->Header.Command = SMI_HANDLER_PROFILE_COMMAND_GET_INFO; - CommGetInfo->Header.DataLength = sizeof(*CommGetInfo); - CommGetInfo->Header.ReturnStatus = (UINT64)-1; - CommGetInfo->DataSize = 0; - - CommSize = OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + (UINTN)CommHeader->MessageLength; - Status = SmmCommunication->Communicate(SmmCommunication, CommBuffer, &CommSize); - if (EFI_ERROR(Status)) { - DEBUG ((DEBUG_INFO, "SmiHandlerProfile: SmmCommunication - %r\n", Status)); - return ; - } - - if (CommGetInfo->Header.ReturnStatus != 0) { - DEBUG ((DEBUG_INFO, "SmiHandlerProfile: GetInfo - 0x%0x\n", CommGetInfo->Header.ReturnStatus)); - return ; - } - - mSmiHandlerProfileDatabaseSize = (UINTN)CommGetInfo->DataSize; - - // - // Get Data - // - mSmiHandlerProfileDatabase = AllocateZeroPool(mSmiHandlerProfileDatabaseSize); - if (mSmiHandlerProfileDatabase == NULL) { - Status = EFI_OUT_OF_RESOURCES; - DEBUG ((DEBUG_INFO, "SmiHandlerProfile: AllocateZeroPool (0x%x) for dump buffer - %r\n", mSmiHandlerProfileDatabaseSize, Status)); - return ; - } - - CommHeader = (EFI_SMM_COMMUNICATE_HEADER *)&CommBuffer[0]; - CopyMem(&CommHeader->HeaderGuid, &gSmiHandlerProfileGuid, sizeof(gSmiHandlerProfileGuid)); - CommHeader->MessageLength = sizeof(SMI_HANDLER_PROFILE_PARAMETER_GET_DATA_BY_OFFSET); - - CommGetData = (SMI_HANDLER_PROFILE_PARAMETER_GET_DATA_BY_OFFSET *)&CommBuffer[OFFSET_OF(EFI_SMM_COMMUNICATE_HEADER, Data)]; - CommGetData->Header.Command = SMI_HANDLER_PROFILE_COMMAND_GET_DATA_BY_OFFSET; - CommGetData->Header.DataLength = sizeof(*CommGetData); - CommGetData->Header.ReturnStatus = (UINT64)-1; - - CommSize = OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + (UINTN)CommHeader->MessageLength; - Buffer = (UINT8 *)CommHeader + CommSize; - Size -= CommSize; - - CommGetData->DataBuffer = (PHYSICAL_ADDRESS)(UINTN)Buffer; - CommGetData->DataOffset = 0; - while (CommGetData->DataOffset < mSmiHandlerProfileDatabaseSize) { - Offset = (UINTN)CommGetData->DataOffset; - if (Size <= (mSmiHandlerProfileDatabaseSize - CommGetData->DataOffset)) { - CommGetData->DataSize = (UINT64)Size; - } else { - CommGetData->DataSize = (UINT64)(mSmiHandlerProfileDatabaseSize - CommGetData->DataOffset); - } - Status = SmmCommunication->Communicate(SmmCommunication, CommBuffer, &CommSize); - ASSERT_EFI_ERROR(Status); - - if (CommGetData->Header.ReturnStatus != 0) { - FreePool(mSmiHandlerProfileDatabase); - mSmiHandlerProfileDatabase = NULL; - DEBUG ((DEBUG_INFO, "SmiHandlerProfile: GetData - 0x%x\n", CommGetData->Header.ReturnStatus)); - return ; - } - CopyMem((UINT8 *)mSmiHandlerProfileDatabase + Offset, (VOID *)(UINTN)CommGetData->DataBuffer, (UINTN)CommGetData->DataSize); - } - - DEBUG ((DEBUG_INFO, "SmiHandlerProfileSize - 0x%x\n", mSmiHandlerProfileDatabaseSize)); - - return ; -} - -/** - Get the file name portion of the Pdb File Name. - - The portion of the Pdb File Name between the last backslash and - either a following period or the end of the string is copied into - AsciiBuffer. The name is truncated, if necessary, to ensure that - AsciiBuffer is not overrun. - - @param[in] PdbFileName Pdb file name. - @param[out] AsciiBuffer The resultant Ascii File Name. - -**/ -VOID -GetShortPdbFileName ( - IN CHAR8 *PdbFileName, - OUT CHAR8 *AsciiBuffer - ) -{ - UINTN IndexPdb; // Current work location within a Pdb string. - UINTN IndexBuffer; // Current work location within a Buffer string. - UINTN StartIndex; - UINTN EndIndex; - - ZeroMem (AsciiBuffer, PROFILE_NAME_STRING_LENGTH + 1); - - if (PdbFileName == NULL) { - AsciiStrnCpyS (AsciiBuffer, PROFILE_NAME_STRING_LENGTH + 1, " ", 1); - } else { - StartIndex = 0; - for (EndIndex = 0; PdbFileName[EndIndex] != 0; EndIndex++); - for (IndexPdb = 0; PdbFileName[IndexPdb] != 0; IndexPdb++) { - if ((PdbFileName[IndexPdb] == '\\') || (PdbFileName[IndexPdb] == '/')) { - StartIndex = IndexPdb + 1; - } - - if (PdbFileName[IndexPdb] == '.') { - EndIndex = IndexPdb; - } - } - - IndexBuffer = 0; - for (IndexPdb = StartIndex; IndexPdb < EndIndex; IndexPdb++) { - AsciiBuffer[IndexBuffer] = PdbFileName[IndexPdb]; - IndexBuffer++; - if (IndexBuffer >= PROFILE_NAME_STRING_LENGTH) { - AsciiBuffer[PROFILE_NAME_STRING_LENGTH] = 0; - break; - } - } - } -} - -/** - Get a human readable name for an image. - The following methods will be tried orderly: - 1. Image PDB - 2. FFS UI section - 3. Image GUID - - @param[in] ImageStruct Point to the image structure. - - @return The resulting Ascii name string is stored in the mNameString global array. - -**/ -CHAR8 * -GetDriverNameString ( - IN SMM_CORE_IMAGE_DATABASE_STRUCTURE *ImageStruct - ) -{ - EFI_STATUS Status; - CHAR16 *NameString; - UINTN StringSize; - - if (ImageStruct == NULL) { - return "???"; - } - - // - // Method 1: Get the name string from image PDB - // - if (ImageStruct->PdbStringOffset != 0) { - GetShortPdbFileName ((CHAR8 *) ((UINTN) ImageStruct + ImageStruct->PdbStringOffset), mNameString); - return mNameString; - } - - if (!IsZeroGuid (&ImageStruct->FileGuid)) { - // - // Try to get the image's FFS UI section by image GUID - // - NameString = NULL; - StringSize = 0; - Status = GetSectionFromAnyFv ( - &ImageStruct->FileGuid, - EFI_SECTION_USER_INTERFACE, - 0, - (VOID **) &NameString, - &StringSize - ); - if (!EFI_ERROR (Status)) { - // - // Method 2: Get the name string from FFS UI section - // - if (StrLen (NameString) > PROFILE_NAME_STRING_LENGTH) { - NameString[PROFILE_NAME_STRING_LENGTH] = 0; - } - UnicodeStrToAsciiStrS (NameString, mNameString, sizeof (mNameString)); - FreePool (NameString); - return mNameString; - } - } - - // - // Method 3: Get the name string from image GUID - // - AsciiSPrint (mNameString, sizeof (mNameString), "%g", &ImageStruct->FileGuid); - return mNameString; -} - -/** - Get image structure from reference index. - - @param ImageRef the image reference index - - @return image structure -**/ -SMM_CORE_IMAGE_DATABASE_STRUCTURE * -GetImageFromRef ( - IN UINTN ImageRef - ) -{ - SMM_CORE_IMAGE_DATABASE_STRUCTURE *ImageStruct; - - ImageStruct = (VOID *)mSmiHandlerProfileDatabase; - while ((UINTN)ImageStruct < (UINTN)mSmiHandlerProfileDatabase + mSmiHandlerProfileDatabaseSize) { - if (ImageStruct->Header.Signature == SMM_CORE_IMAGE_DATABASE_SIGNATURE) { - if (ImageStruct->ImageRef == ImageRef) { - return ImageStruct; - } - } - ImageStruct = (VOID *)((UINTN)ImageStruct + ImageStruct->Header.Length); - } - - return NULL; -} - -/** - Dump SMM loaded image information. -**/ -VOID -DumpSmmLoadedImage( - VOID - ) -{ - SMM_CORE_IMAGE_DATABASE_STRUCTURE *ImageStruct; - CHAR8 *PdbString; - CHAR8 *NameString; - - ImageStruct = (VOID *)mSmiHandlerProfileDatabase; - while ((UINTN)ImageStruct < (UINTN)mSmiHandlerProfileDatabase + mSmiHandlerProfileDatabaseSize) { - if (ImageStruct->Header.Signature == SMM_CORE_IMAGE_DATABASE_SIGNATURE) { - NameString = GetDriverNameString (ImageStruct); - DEBUG ((DEBUG_INFO, " ImageBase, ImageStruct->ImageSize)); - if (ImageStruct->EntryPoint != 0) { - DEBUG ((DEBUG_INFO, " EntryPoint=\"0x%lx\"", ImageStruct->EntryPoint)); - } - DEBUG ((DEBUG_INFO, " FvFile=\"%g\"", &ImageStruct->FileGuid)); - DEBUG ((DEBUG_INFO, " RefId=\"0x%x\"", ImageStruct->ImageRef)); - DEBUG ((DEBUG_INFO, ">\n")); - if (ImageStruct->PdbStringOffset != 0) { - PdbString = (CHAR8 *)((UINTN)ImageStruct + ImageStruct->PdbStringOffset); - DEBUG ((DEBUG_INFO, " %a\n", PdbString)); - } - DEBUG ((DEBUG_INFO, " \n")); - } - - ImageStruct = (VOID *)((UINTN)ImageStruct + ImageStruct->Header.Length); - } - - return; -} - -CHAR8 *mSxTypeString[] = { - "SxS0", - "SxS1", - "SxS2", - "SxS3", - "SxS4", - "SxS5", -}; - -/** - Convert SxType to a string. - - @param Type SxType - - @return SxType string -**/ -CHAR8 * -SxTypeToString ( - IN EFI_SLEEP_TYPE Type - ) -{ - if (Type >= 0 && Type <= ARRAY_SIZE(mSxTypeString)) { - return mSxTypeString[Type]; - } else { - AsciiSPrint (mNameString, sizeof(mNameString), "0x%x", Type); - return mNameString; - } -} - -CHAR8 *mSxPhaseString[] = { - "SxEntry", - "SxExit", -}; - -/** - Convert SxPhase to a string. - - @param Phase SxPhase - - @return SxPhase string -**/ -CHAR8 * -SxPhaseToString ( - IN EFI_SLEEP_PHASE Phase - ) -{ - if (Phase >= 0 && Phase <= ARRAY_SIZE(mSxPhaseString)) { - return mSxPhaseString[Phase]; - } else { - AsciiSPrint (mNameString, sizeof(mNameString), "0x%x", Phase); - return mNameString; - } -} - -CHAR8 *mPowerButtonPhaseString[] = { - "PowerButtonEntry", - "PowerButtonExit", -}; - -/** - Convert PowerButtonPhase to a string. - - @param Phase PowerButtonPhase - - @return PowerButtonPhase string -**/ -CHAR8 * -PowerButtonPhaseToString ( - IN EFI_POWER_BUTTON_PHASE Phase - ) -{ - if (Phase >= 0 && Phase <= ARRAY_SIZE(mPowerButtonPhaseString)) { - return mPowerButtonPhaseString[Phase]; - } else { - AsciiSPrint (mNameString, sizeof(mNameString), "0x%x", Phase); - return mNameString; - } -} - -CHAR8 *mStandbyButtonPhaseString[] = { - "StandbyButtonEntry", - "StandbyButtonExit", -}; - -/** - Convert StandbyButtonPhase to a string. - - @param Phase StandbyButtonPhase - - @return StandbyButtonPhase string -**/ -CHAR8 * -StandbyButtonPhaseToString ( - IN EFI_STANDBY_BUTTON_PHASE Phase - ) -{ - if (Phase >= 0 && Phase <= ARRAY_SIZE(mStandbyButtonPhaseString)) { - return mStandbyButtonPhaseString[Phase]; - } else { - AsciiSPrint (mNameString, sizeof(mNameString), "0x%x", Phase); - return mNameString; - } -} - -CHAR8 *mIoTrapTypeString[] = { - "WriteTrap", - "ReadTrap", - "ReadWriteTrap", -}; - -/** - Convert IoTrapType to a string. - - @param Type IoTrapType - - @return IoTrapType string -**/ -CHAR8 * -IoTrapTypeToString ( - IN EFI_SMM_IO_TRAP_DISPATCH_TYPE Type - ) -{ - if (Type >= 0 && Type <= ARRAY_SIZE(mIoTrapTypeString)) { - return mIoTrapTypeString[Type]; - } else { - AsciiSPrint (mNameString, sizeof(mNameString), "0x%x", Type); - return mNameString; - } -} - -CHAR8 *mUsbTypeString[] = { - "UsbLegacy", - "UsbWake", -}; - -/** - Convert UsbType to a string. - - @param Type UsbType - - @return UsbType string -**/ -CHAR8 * -UsbTypeToString ( - IN EFI_USB_SMI_TYPE Type - ) -{ - if (Type >= 0 && Type <= ARRAY_SIZE(mUsbTypeString)) { - return mUsbTypeString[Type]; - } else { - AsciiSPrint (mNameString, sizeof(mNameString), "0x%x", Type); - return mNameString; - } -} - -/** - Dump SMI child context. - - @param HandlerType the handler type - @param Context the handler context - @param ContextSize the handler context size -**/ -VOID -DumpSmiChildContext ( - IN EFI_GUID *HandlerType, - IN VOID *Context, - IN UINTN ContextSize - ) -{ - CHAR16 *Str; - - if (CompareGuid (HandlerType, &gEfiSmmSwDispatch2ProtocolGuid)) { - DEBUG ((DEBUG_INFO, " SwSmi=\"0x%lx\"", ((SMI_HANDLER_PROFILE_SW_REGISTER_CONTEXT *)Context)->SwSmiInputValue)); - } else if (CompareGuid (HandlerType, &gEfiSmmSxDispatch2ProtocolGuid)) { - DEBUG ((DEBUG_INFO, " SxType=\"%a\"", SxTypeToString(((EFI_SMM_SX_REGISTER_CONTEXT *)Context)->Type))); - DEBUG ((DEBUG_INFO, " SxPhase=\"%a\"", SxPhaseToString(((EFI_SMM_SX_REGISTER_CONTEXT *)Context)->Phase))); - } else if (CompareGuid (HandlerType, &gEfiSmmPowerButtonDispatch2ProtocolGuid)) { - DEBUG ((DEBUG_INFO, " PowerButtonPhase=\"%a\"", PowerButtonPhaseToString(((EFI_SMM_POWER_BUTTON_REGISTER_CONTEXT *)Context)->Phase))); - } else if (CompareGuid (HandlerType, &gEfiSmmStandbyButtonDispatch2ProtocolGuid)) { - DEBUG ((DEBUG_INFO, " StandbyButtonPhase=\"%a\"", StandbyButtonPhaseToString(((EFI_SMM_STANDBY_BUTTON_REGISTER_CONTEXT *)Context)->Phase))); - } else if (CompareGuid (HandlerType, &gEfiSmmPeriodicTimerDispatch2ProtocolGuid)) { - DEBUG ((DEBUG_INFO, " PeriodicTimerPeriod=\"%ld\"", ((EFI_SMM_PERIODIC_TIMER_REGISTER_CONTEXT *)Context)->Period)); - DEBUG ((DEBUG_INFO, " PeriodicTimerSmiTickInterval=\"%ld\"", ((EFI_SMM_PERIODIC_TIMER_REGISTER_CONTEXT *)Context)->SmiTickInterval)); - } else if (CompareGuid (HandlerType, &gEfiSmmGpiDispatch2ProtocolGuid)) { - DEBUG ((DEBUG_INFO, " GpiNum=\"0x%lx\"", ((EFI_SMM_GPI_REGISTER_CONTEXT *)Context)->GpiNum)); - } else if (CompareGuid (HandlerType, &gEfiSmmIoTrapDispatch2ProtocolGuid)) { - DEBUG ((DEBUG_INFO, " IoTrapAddress=\"0x%x\"", ((EFI_SMM_IO_TRAP_REGISTER_CONTEXT *)Context)->Address)); - DEBUG ((DEBUG_INFO, " IoTrapLength=\"0x%x\"", ((EFI_SMM_IO_TRAP_REGISTER_CONTEXT *)Context)->Length)); - DEBUG ((DEBUG_INFO, " IoTrapType=\"%a\"", IoTrapTypeToString(((EFI_SMM_IO_TRAP_REGISTER_CONTEXT *)Context)->Type))); - } else if (CompareGuid (HandlerType, &gEfiSmmUsbDispatch2ProtocolGuid)) { - DEBUG ((DEBUG_INFO, " UsbType=\"0x%x\"", UsbTypeToString(((SMI_HANDLER_PROFILE_USB_REGISTER_CONTEXT *)Context)->Type))); - Str = ConvertDevicePathToText((EFI_DEVICE_PATH_PROTOCOL *)(((SMI_HANDLER_PROFILE_USB_REGISTER_CONTEXT *)Context) + 1), TRUE, TRUE); - DEBUG ((DEBUG_INFO, " UsbDevicePath=\"%s\"", Str)); - if (Str != NULL) { - FreePool (Str); - } - } else { - DEBUG ((DEBUG_INFO, " Context=\"")); - InternalDumpData (Context, ContextSize); - DEBUG ((DEBUG_INFO, "\"")); - } -} - -/** - Dump SMI handler in HandlerCategory. - - @param HandlerCategory SMI handler category -**/ -VOID -DumpSmiHandler( - IN UINT32 HandlerCategory - ) -{ - SMM_CORE_SMI_DATABASE_STRUCTURE *SmiStruct; - SMM_CORE_SMI_HANDLER_STRUCTURE *SmiHandlerStruct; - UINTN Index; - SMM_CORE_IMAGE_DATABASE_STRUCTURE *ImageStruct; - CHAR8 *NameString; - - SmiStruct = (VOID *)mSmiHandlerProfileDatabase; - while ((UINTN)SmiStruct < (UINTN)mSmiHandlerProfileDatabase + mSmiHandlerProfileDatabaseSize) { - if ((SmiStruct->Header.Signature == SMM_CORE_SMI_DATABASE_SIGNATURE) && (SmiStruct->HandlerCategory == HandlerCategory)) { - SmiHandlerStruct = (VOID *)(SmiStruct + 1); - DEBUG ((DEBUG_INFO, " HandlerType)) { - DEBUG ((DEBUG_INFO, " HandlerType=\"%g\"", &SmiStruct->HandlerType)); - } - DEBUG ((DEBUG_INFO, ">\n")); - for (Index = 0; Index < SmiStruct->HandlerCount; Index++) { - DEBUG ((DEBUG_INFO, " ContextBufferSize != 0) { - DumpSmiChildContext (&SmiStruct->HandlerType, (UINT8 *)SmiHandlerStruct + SmiHandlerStruct->ContextBufferOffset, SmiHandlerStruct->ContextBufferSize); - } - DEBUG ((DEBUG_INFO, ">\n")); - ImageStruct = GetImageFromRef((UINTN)SmiHandlerStruct->ImageRef); - NameString = GetDriverNameString (ImageStruct); - DEBUG ((DEBUG_INFO, " \n", SmiHandlerStruct->ImageRef, NameString)); - if ((ImageStruct != NULL) && (ImageStruct->PdbStringOffset != 0)) { - DEBUG ((DEBUG_INFO, " %a\n", (UINT8 *)ImageStruct + ImageStruct->PdbStringOffset)); - } - DEBUG ((DEBUG_INFO, " \n")); - DEBUG ((DEBUG_INFO, " \n", SmiHandlerStruct->Handler)); - if (ImageStruct != NULL) { - DEBUG ((DEBUG_INFO, " 0x%x\n", (UINTN) (SmiHandlerStruct->Handler - ImageStruct->ImageBase))); - } - DEBUG ((DEBUG_INFO, " \n")); - DEBUG ((DEBUG_INFO, " \n", SmiHandlerStruct->CallerAddr)); - if (ImageStruct != NULL) { - DEBUG ((DEBUG_INFO, " 0x%x\n", (UINTN) (SmiHandlerStruct->CallerAddr - ImageStruct->ImageBase))); - } - DEBUG ((DEBUG_INFO, " \n")); - SmiHandlerStruct = (VOID *)((UINTN)SmiHandlerStruct + SmiHandlerStruct->Length); - DEBUG ((DEBUG_INFO, " \n")); - } - DEBUG ((DEBUG_INFO, " \n")); - } - SmiStruct = (VOID *)((UINTN)SmiStruct + SmiStruct->Header.Length); - } - - return; -} - -EFI_STATUS -EFIAPI -TestPointCheckSmiHandlerInstrument ( - VOID - ) -{ - DEBUG ((DEBUG_INFO, "==== TestPointCheckSmiHandlerInstrument - Enter\n")); - - GetSmiHandlerProfileDatabase(); - - if (mSmiHandlerProfileDatabase == NULL) { - return EFI_SUCCESS; - } - - // - // Dump all image - // - DEBUG ((DEBUG_INFO, "\n")); - DEBUG ((DEBUG_INFO, "\n")); - DEBUG ((DEBUG_INFO, "\n")); - DEBUG ((DEBUG_INFO, " \n")); - DumpSmmLoadedImage(); - DEBUG ((DEBUG_INFO, "\n\n")); - - // - // Dump SMI Handler - // - DEBUG ((DEBUG_INFO, "\n")); - DEBUG ((DEBUG_INFO, " \n\n")); - DEBUG ((DEBUG_INFO, " \n")); - DEBUG ((DEBUG_INFO, " \n")); - DumpSmiHandler(SmmCoreSmiHandlerCategoryRootHandler); - DEBUG ((DEBUG_INFO, " \n\n")); - - DEBUG ((DEBUG_INFO, " \n")); - DEBUG ((DEBUG_INFO, " \n")); - DumpSmiHandler(SmmCoreSmiHandlerCategoryGuidHandler); - DEBUG ((DEBUG_INFO, " \n\n")); - - DEBUG ((DEBUG_INFO, " \n")); - DEBUG ((DEBUG_INFO, " \n")); - DumpSmiHandler(SmmCoreSmiHandlerCategoryHardwareHandler); - DEBUG ((DEBUG_INFO, " \n\n")); - - DEBUG ((DEBUG_INFO, "\n")); - DEBUG ((DEBUG_INFO, "\n")); - - if (mSmiHandlerProfileDatabase != NULL) { - FreePool(mSmiHandlerProfileDatabase); - } - - DEBUG ((DEBUG_INFO, "==== TestPointCheckSmiHandlerInstrument - Exit\n")); - return EFI_SUCCESS; -} +/** @file + +Copyright (c) 2017, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define PROFILE_NAME_STRING_LENGTH 64 +CHAR8 mNameString[PROFILE_NAME_STRING_LENGTH + 1]; + +VOID *mSmiHandlerProfileDatabase; +UINTN mSmiHandlerProfileDatabaseSize; + +/** + This function dump raw data. + + @param Data raw data + @param Size raw data size +**/ +VOID +InternalDumpData ( + IN UINT8 *Data, + IN UINTN Size + ); + +/** + Get SMI handler profile database. +**/ +VOID +GetSmiHandlerProfileDatabase( + VOID + ) +{ + EFI_STATUS Status; + UINTN CommSize; + UINT8 *CommBuffer; + EFI_SMM_COMMUNICATE_HEADER *CommHeader; + SMI_HANDLER_PROFILE_PARAMETER_GET_INFO *CommGetInfo; + SMI_HANDLER_PROFILE_PARAMETER_GET_DATA_BY_OFFSET *CommGetData; + EFI_SMM_COMMUNICATION_PROTOCOL *SmmCommunication; + UINTN MinimalSizeNeeded; + EDKII_PI_SMM_COMMUNICATION_REGION_TABLE *PiSmmCommunicationRegionTable; + UINT32 Index; + EFI_MEMORY_DESCRIPTOR *Entry; + VOID *Buffer; + UINTN Size; + UINTN Offset; + + Status = gBS->LocateProtocol(&gEfiSmmCommunicationProtocolGuid, NULL, (VOID **)&SmmCommunication); + if (EFI_ERROR(Status)) { + DEBUG ((DEBUG_INFO, "SmiHandlerProfile: Locate SmmCommunication protocol - %r\n", Status)); + return ; + } + + MinimalSizeNeeded = EFI_PAGE_SIZE; + + Status = EfiGetSystemConfigurationTable( + &gEdkiiPiSmmCommunicationRegionTableGuid, + (VOID **)&PiSmmCommunicationRegionTable + ); + if (EFI_ERROR(Status)) { + DEBUG ((DEBUG_INFO, "SmiHandlerProfile: Get PiSmmCommunicationRegionTable - %r\n", Status)); + return ; + } + ASSERT(PiSmmCommunicationRegionTable != NULL); + Entry = (EFI_MEMORY_DESCRIPTOR *)(PiSmmCommunicationRegionTable + 1); + Size = 0; + for (Index = 0; Index < PiSmmCommunicationRegionTable->NumberOfEntries; Index++) { + if (Entry->Type == EfiConventionalMemory) { + Size = EFI_PAGES_TO_SIZE((UINTN)Entry->NumberOfPages); + if (Size >= MinimalSizeNeeded) { + break; + } + } + Entry = (EFI_MEMORY_DESCRIPTOR *)((UINT8 *)Entry + PiSmmCommunicationRegionTable->DescriptorSize); + } + ASSERT(Index < PiSmmCommunicationRegionTable->NumberOfEntries); + CommBuffer = (UINT8 *)(UINTN)Entry->PhysicalStart; + + // + // Get Size + // + CommHeader = (EFI_SMM_COMMUNICATE_HEADER *)&CommBuffer[0]; + CopyMem(&CommHeader->HeaderGuid, &gSmiHandlerProfileGuid, sizeof(gSmiHandlerProfileGuid)); + CommHeader->MessageLength = sizeof(SMI_HANDLER_PROFILE_PARAMETER_GET_INFO); + + CommGetInfo = (SMI_HANDLER_PROFILE_PARAMETER_GET_INFO *)&CommBuffer[OFFSET_OF(EFI_SMM_COMMUNICATE_HEADER, Data)]; + CommGetInfo->Header.Command = SMI_HANDLER_PROFILE_COMMAND_GET_INFO; + CommGetInfo->Header.DataLength = sizeof(*CommGetInfo); + CommGetInfo->Header.ReturnStatus = (UINT64)-1; + CommGetInfo->DataSize = 0; + + CommSize = OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + (UINTN)CommHeader->MessageLength; + Status = SmmCommunication->Communicate(SmmCommunication, CommBuffer, &CommSize); + if (EFI_ERROR(Status)) { + DEBUG ((DEBUG_INFO, "SmiHandlerProfile: SmmCommunication - %r\n", Status)); + return ; + } + + if (CommGetInfo->Header.ReturnStatus != 0) { + DEBUG ((DEBUG_INFO, "SmiHandlerProfile: GetInfo - 0x%0x\n", CommGetInfo->Header.ReturnStatus)); + return ; + } + + mSmiHandlerProfileDatabaseSize = (UINTN)CommGetInfo->DataSize; + + // + // Get Data + // + mSmiHandlerProfileDatabase = AllocateZeroPool(mSmiHandlerProfileDatabaseSize); + if (mSmiHandlerProfileDatabase == NULL) { + Status = EFI_OUT_OF_RESOURCES; + DEBUG ((DEBUG_INFO, "SmiHandlerProfile: AllocateZeroPool (0x%x) for dump buffer - %r\n", mSmiHandlerProfileDatabaseSize, Status)); + return ; + } + + CommHeader = (EFI_SMM_COMMUNICATE_HEADER *)&CommBuffer[0]; + CopyMem(&CommHeader->HeaderGuid, &gSmiHandlerProfileGuid, sizeof(gSmiHandlerProfileGuid)); + CommHeader->MessageLength = sizeof(SMI_HANDLER_PROFILE_PARAMETER_GET_DATA_BY_OFFSET); + + CommGetData = (SMI_HANDLER_PROFILE_PARAMETER_GET_DATA_BY_OFFSET *)&CommBuffer[OFFSET_OF(EFI_SMM_COMMUNICATE_HEADER, Data)]; + CommGetData->Header.Command = SMI_HANDLER_PROFILE_COMMAND_GET_DATA_BY_OFFSET; + CommGetData->Header.DataLength = sizeof(*CommGetData); + CommGetData->Header.ReturnStatus = (UINT64)-1; + + CommSize = OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + (UINTN)CommHeader->MessageLength; + Buffer = (UINT8 *)CommHeader + CommSize; + Size -= CommSize; + + CommGetData->DataBuffer = (PHYSICAL_ADDRESS)(UINTN)Buffer; + CommGetData->DataOffset = 0; + while (CommGetData->DataOffset < mSmiHandlerProfileDatabaseSize) { + Offset = (UINTN)CommGetData->DataOffset; + if (Size <= (mSmiHandlerProfileDatabaseSize - CommGetData->DataOffset)) { + CommGetData->DataSize = (UINT64)Size; + } else { + CommGetData->DataSize = (UINT64)(mSmiHandlerProfileDatabaseSize - CommGetData->DataOffset); + } + Status = SmmCommunication->Communicate(SmmCommunication, CommBuffer, &CommSize); + ASSERT_EFI_ERROR(Status); + + if (CommGetData->Header.ReturnStatus != 0) { + FreePool(mSmiHandlerProfileDatabase); + mSmiHandlerProfileDatabase = NULL; + DEBUG ((DEBUG_INFO, "SmiHandlerProfile: GetData - 0x%x\n", CommGetData->Header.ReturnStatus)); + return ; + } + CopyMem((UINT8 *)mSmiHandlerProfileDatabase + Offset, (VOID *)(UINTN)CommGetData->DataBuffer, (UINTN)CommGetData->DataSize); + } + + DEBUG ((DEBUG_INFO, "SmiHandlerProfileSize - 0x%x\n", mSmiHandlerProfileDatabaseSize)); + + return ; +} + +/** + Get the file name portion of the Pdb File Name. + + The portion of the Pdb File Name between the last backslash and + either a following period or the end of the string is copied into + AsciiBuffer. The name is truncated, if necessary, to ensure that + AsciiBuffer is not overrun. + + @param[in] PdbFileName Pdb file name. + @param[out] AsciiBuffer The resultant Ascii File Name. + +**/ +VOID +GetShortPdbFileName ( + IN CHAR8 *PdbFileName, + OUT CHAR8 *AsciiBuffer + ) +{ + UINTN IndexPdb; // Current work location within a Pdb string. + UINTN IndexBuffer; // Current work location within a Buffer string. + UINTN StartIndex; + UINTN EndIndex; + + ZeroMem (AsciiBuffer, PROFILE_NAME_STRING_LENGTH + 1); + + if (PdbFileName == NULL) { + AsciiStrnCpyS (AsciiBuffer, PROFILE_NAME_STRING_LENGTH + 1, " ", 1); + } else { + StartIndex = 0; + for (EndIndex = 0; PdbFileName[EndIndex] != 0; EndIndex++); + for (IndexPdb = 0; PdbFileName[IndexPdb] != 0; IndexPdb++) { + if ((PdbFileName[IndexPdb] == '\\') || (PdbFileName[IndexPdb] == '/')) { + StartIndex = IndexPdb + 1; + } + + if (PdbFileName[IndexPdb] == '.') { + EndIndex = IndexPdb; + } + } + + IndexBuffer = 0; + for (IndexPdb = StartIndex; IndexPdb < EndIndex; IndexPdb++) { + AsciiBuffer[IndexBuffer] = PdbFileName[IndexPdb]; + IndexBuffer++; + if (IndexBuffer >= PROFILE_NAME_STRING_LENGTH) { + AsciiBuffer[PROFILE_NAME_STRING_LENGTH] = 0; + break; + } + } + } +} + +/** + Get a human readable name for an image. + The following methods will be tried orderly: + 1. Image PDB + 2. FFS UI section + 3. Image GUID + + @param[in] ImageStruct Point to the image structure. + + @return The resulting Ascii name string is stored in the mNameString global array. + +**/ +CHAR8 * +GetDriverNameString ( + IN SMM_CORE_IMAGE_DATABASE_STRUCTURE *ImageStruct + ) +{ + EFI_STATUS Status; + CHAR16 *NameString; + UINTN StringSize; + + if (ImageStruct == NULL) { + return "???"; + } + + // + // Method 1: Get the name string from image PDB + // + if (ImageStruct->PdbStringOffset != 0) { + GetShortPdbFileName ((CHAR8 *) ((UINTN) ImageStruct + ImageStruct->PdbStringOffset), mNameString); + return mNameString; + } + + if (!IsZeroGuid (&ImageStruct->FileGuid)) { + // + // Try to get the image's FFS UI section by image GUID + // + NameString = NULL; + StringSize = 0; + Status = GetSectionFromAnyFv ( + &ImageStruct->FileGuid, + EFI_SECTION_USER_INTERFACE, + 0, + (VOID **) &NameString, + &StringSize + ); + if (!EFI_ERROR (Status)) { + // + // Method 2: Get the name string from FFS UI section + // + if (StrLen (NameString) > PROFILE_NAME_STRING_LENGTH) { + NameString[PROFILE_NAME_STRING_LENGTH] = 0; + } + UnicodeStrToAsciiStrS (NameString, mNameString, sizeof (mNameString)); + FreePool (NameString); + return mNameString; + } + } + + // + // Method 3: Get the name string from image GUID + // + AsciiSPrint (mNameString, sizeof (mNameString), "%g", &ImageStruct->FileGuid); + return mNameString; +} + +/** + Get image structure from reference index. + + @param ImageRef the image reference index + + @return image structure +**/ +SMM_CORE_IMAGE_DATABASE_STRUCTURE * +GetImageFromRef ( + IN UINTN ImageRef + ) +{ + SMM_CORE_IMAGE_DATABASE_STRUCTURE *ImageStruct; + + ImageStruct = (VOID *)mSmiHandlerProfileDatabase; + while ((UINTN)ImageStruct < (UINTN)mSmiHandlerProfileDatabase + mSmiHandlerProfileDatabaseSize) { + if (ImageStruct->Header.Signature == SMM_CORE_IMAGE_DATABASE_SIGNATURE) { + if (ImageStruct->ImageRef == ImageRef) { + return ImageStruct; + } + } + ImageStruct = (VOID *)((UINTN)ImageStruct + ImageStruct->Header.Length); + } + + return NULL; +} + +/** + Dump SMM loaded image information. +**/ +VOID +DumpSmmLoadedImage( + VOID + ) +{ + SMM_CORE_IMAGE_DATABASE_STRUCTURE *ImageStruct; + CHAR8 *PdbString; + CHAR8 *NameString; + + ImageStruct = (VOID *)mSmiHandlerProfileDatabase; + while ((UINTN)ImageStruct < (UINTN)mSmiHandlerProfileDatabase + mSmiHandlerProfileDatabaseSize) { + if (ImageStruct->Header.Signature == SMM_CORE_IMAGE_DATABASE_SIGNATURE) { + NameString = GetDriverNameString (ImageStruct); + DEBUG ((DEBUG_INFO, " ImageBase, ImageStruct->ImageSize)); + if (ImageStruct->EntryPoint != 0) { + DEBUG ((DEBUG_INFO, " EntryPoint=\"0x%lx\"", ImageStruct->EntryPoint)); + } + DEBUG ((DEBUG_INFO, " FvFile=\"%g\"", &ImageStruct->FileGuid)); + DEBUG ((DEBUG_INFO, " RefId=\"0x%x\"", ImageStruct->ImageRef)); + DEBUG ((DEBUG_INFO, ">\n")); + if (ImageStruct->PdbStringOffset != 0) { + PdbString = (CHAR8 *)((UINTN)ImageStruct + ImageStruct->PdbStringOffset); + DEBUG ((DEBUG_INFO, " %a\n", PdbString)); + } + DEBUG ((DEBUG_INFO, " \n")); + } + + ImageStruct = (VOID *)((UINTN)ImageStruct + ImageStruct->Header.Length); + } + + return; +} + +CHAR8 *mSxTypeString[] = { + "SxS0", + "SxS1", + "SxS2", + "SxS3", + "SxS4", + "SxS5", +}; + +/** + Convert SxType to a string. + + @param Type SxType + + @return SxType string +**/ +CHAR8 * +SxTypeToString ( + IN EFI_SLEEP_TYPE Type + ) +{ + if (Type >= 0 && Type <= ARRAY_SIZE(mSxTypeString)) { + return mSxTypeString[Type]; + } else { + AsciiSPrint (mNameString, sizeof(mNameString), "0x%x", Type); + return mNameString; + } +} + +CHAR8 *mSxPhaseString[] = { + "SxEntry", + "SxExit", +}; + +/** + Convert SxPhase to a string. + + @param Phase SxPhase + + @return SxPhase string +**/ +CHAR8 * +SxPhaseToString ( + IN EFI_SLEEP_PHASE Phase + ) +{ + if (Phase >= 0 && Phase <= ARRAY_SIZE(mSxPhaseString)) { + return mSxPhaseString[Phase]; + } else { + AsciiSPrint (mNameString, sizeof(mNameString), "0x%x", Phase); + return mNameString; + } +} + +CHAR8 *mPowerButtonPhaseString[] = { + "PowerButtonEntry", + "PowerButtonExit", +}; + +/** + Convert PowerButtonPhase to a string. + + @param Phase PowerButtonPhase + + @return PowerButtonPhase string +**/ +CHAR8 * +PowerButtonPhaseToString ( + IN EFI_POWER_BUTTON_PHASE Phase + ) +{ + if (Phase >= 0 && Phase <= ARRAY_SIZE(mPowerButtonPhaseString)) { + return mPowerButtonPhaseString[Phase]; + } else { + AsciiSPrint (mNameString, sizeof(mNameString), "0x%x", Phase); + return mNameString; + } +} + +CHAR8 *mStandbyButtonPhaseString[] = { + "StandbyButtonEntry", + "StandbyButtonExit", +}; + +/** + Convert StandbyButtonPhase to a string. + + @param Phase StandbyButtonPhase + + @return StandbyButtonPhase string +**/ +CHAR8 * +StandbyButtonPhaseToString ( + IN EFI_STANDBY_BUTTON_PHASE Phase + ) +{ + if (Phase >= 0 && Phase <= ARRAY_SIZE(mStandbyButtonPhaseString)) { + return mStandbyButtonPhaseString[Phase]; + } else { + AsciiSPrint (mNameString, sizeof(mNameString), "0x%x", Phase); + return mNameString; + } +} + +CHAR8 *mIoTrapTypeString[] = { + "WriteTrap", + "ReadTrap", + "ReadWriteTrap", +}; + +/** + Convert IoTrapType to a string. + + @param Type IoTrapType + + @return IoTrapType string +**/ +CHAR8 * +IoTrapTypeToString ( + IN EFI_SMM_IO_TRAP_DISPATCH_TYPE Type + ) +{ + if (Type >= 0 && Type <= ARRAY_SIZE(mIoTrapTypeString)) { + return mIoTrapTypeString[Type]; + } else { + AsciiSPrint (mNameString, sizeof(mNameString), "0x%x", Type); + return mNameString; + } +} + +CHAR8 *mUsbTypeString[] = { + "UsbLegacy", + "UsbWake", +}; + +/** + Convert UsbType to a string. + + @param Type UsbType + + @return UsbType string +**/ +CHAR8 * +UsbTypeToString ( + IN EFI_USB_SMI_TYPE Type + ) +{ + if (Type >= 0 && Type <= ARRAY_SIZE(mUsbTypeString)) { + return mUsbTypeString[Type]; + } else { + AsciiSPrint (mNameString, sizeof(mNameString), "0x%x", Type); + return mNameString; + } +} + +/** + Dump SMI child context. + + @param HandlerType the handler type + @param Context the handler context + @param ContextSize the handler context size +**/ +VOID +DumpSmiChildContext ( + IN EFI_GUID *HandlerType, + IN VOID *Context, + IN UINTN ContextSize + ) +{ + CHAR16 *Str; + + if (CompareGuid (HandlerType, &gEfiSmmSwDispatch2ProtocolGuid)) { + DEBUG ((DEBUG_INFO, " SwSmi=\"0x%lx\"", ((SMI_HANDLER_PROFILE_SW_REGISTER_CONTEXT *)Context)->SwSmiInputValue)); + } else if (CompareGuid (HandlerType, &gEfiSmmSxDispatch2ProtocolGuid)) { + DEBUG ((DEBUG_INFO, " SxType=\"%a\"", SxTypeToString(((EFI_SMM_SX_REGISTER_CONTEXT *)Context)->Type))); + DEBUG ((DEBUG_INFO, " SxPhase=\"%a\"", SxPhaseToString(((EFI_SMM_SX_REGISTER_CONTEXT *)Context)->Phase))); + } else if (CompareGuid (HandlerType, &gEfiSmmPowerButtonDispatch2ProtocolGuid)) { + DEBUG ((DEBUG_INFO, " PowerButtonPhase=\"%a\"", PowerButtonPhaseToString(((EFI_SMM_POWER_BUTTON_REGISTER_CONTEXT *)Context)->Phase))); + } else if (CompareGuid (HandlerType, &gEfiSmmStandbyButtonDispatch2ProtocolGuid)) { + DEBUG ((DEBUG_INFO, " StandbyButtonPhase=\"%a\"", StandbyButtonPhaseToString(((EFI_SMM_STANDBY_BUTTON_REGISTER_CONTEXT *)Context)->Phase))); + } else if (CompareGuid (HandlerType, &gEfiSmmPeriodicTimerDispatch2ProtocolGuid)) { + DEBUG ((DEBUG_INFO, " PeriodicTimerPeriod=\"%ld\"", ((EFI_SMM_PERIODIC_TIMER_REGISTER_CONTEXT *)Context)->Period)); + DEBUG ((DEBUG_INFO, " PeriodicTimerSmiTickInterval=\"%ld\"", ((EFI_SMM_PERIODIC_TIMER_REGISTER_CONTEXT *)Context)->SmiTickInterval)); + } else if (CompareGuid (HandlerType, &gEfiSmmGpiDispatch2ProtocolGuid)) { + DEBUG ((DEBUG_INFO, " GpiNum=\"0x%lx\"", ((EFI_SMM_GPI_REGISTER_CONTEXT *)Context)->GpiNum)); + } else if (CompareGuid (HandlerType, &gEfiSmmIoTrapDispatch2ProtocolGuid)) { + DEBUG ((DEBUG_INFO, " IoTrapAddress=\"0x%x\"", ((EFI_SMM_IO_TRAP_REGISTER_CONTEXT *)Context)->Address)); + DEBUG ((DEBUG_INFO, " IoTrapLength=\"0x%x\"", ((EFI_SMM_IO_TRAP_REGISTER_CONTEXT *)Context)->Length)); + DEBUG ((DEBUG_INFO, " IoTrapType=\"%a\"", IoTrapTypeToString(((EFI_SMM_IO_TRAP_REGISTER_CONTEXT *)Context)->Type))); + } else if (CompareGuid (HandlerType, &gEfiSmmUsbDispatch2ProtocolGuid)) { + DEBUG ((DEBUG_INFO, " UsbType=\"0x%x\"", UsbTypeToString(((SMI_HANDLER_PROFILE_USB_REGISTER_CONTEXT *)Context)->Type))); + Str = ConvertDevicePathToText((EFI_DEVICE_PATH_PROTOCOL *)(((SMI_HANDLER_PROFILE_USB_REGISTER_CONTEXT *)Context) + 1), TRUE, TRUE); + DEBUG ((DEBUG_INFO, " UsbDevicePath=\"%s\"", Str)); + if (Str != NULL) { + FreePool (Str); + } + } else { + DEBUG ((DEBUG_INFO, " Context=\"")); + InternalDumpData (Context, ContextSize); + DEBUG ((DEBUG_INFO, "\"")); + } +} + +/** + Dump SMI handler in HandlerCategory. + + @param HandlerCategory SMI handler category +**/ +VOID +DumpSmiHandler( + IN UINT32 HandlerCategory + ) +{ + SMM_CORE_SMI_DATABASE_STRUCTURE *SmiStruct; + SMM_CORE_SMI_HANDLER_STRUCTURE *SmiHandlerStruct; + UINTN Index; + SMM_CORE_IMAGE_DATABASE_STRUCTURE *ImageStruct; + CHAR8 *NameString; + + SmiStruct = (VOID *)mSmiHandlerProfileDatabase; + while ((UINTN)SmiStruct < (UINTN)mSmiHandlerProfileDatabase + mSmiHandlerProfileDatabaseSize) { + if ((SmiStruct->Header.Signature == SMM_CORE_SMI_DATABASE_SIGNATURE) && (SmiStruct->HandlerCategory == HandlerCategory)) { + SmiHandlerStruct = (VOID *)(SmiStruct + 1); + DEBUG ((DEBUG_INFO, " HandlerType)) { + DEBUG ((DEBUG_INFO, " HandlerType=\"%g\"", &SmiStruct->HandlerType)); + } + DEBUG ((DEBUG_INFO, ">\n")); + for (Index = 0; Index < SmiStruct->HandlerCount; Index++) { + DEBUG ((DEBUG_INFO, " ContextBufferSize != 0) { + DumpSmiChildContext (&SmiStruct->HandlerType, (UINT8 *)SmiHandlerStruct + SmiHandlerStruct->ContextBufferOffset, SmiHandlerStruct->ContextBufferSize); + } + DEBUG ((DEBUG_INFO, ">\n")); + ImageStruct = GetImageFromRef((UINTN)SmiHandlerStruct->ImageRef); + NameString = GetDriverNameString (ImageStruct); + DEBUG ((DEBUG_INFO, " \n", SmiHandlerStruct->ImageRef, NameString)); + if ((ImageStruct != NULL) && (ImageStruct->PdbStringOffset != 0)) { + DEBUG ((DEBUG_INFO, " %a\n", (UINT8 *)ImageStruct + ImageStruct->PdbStringOffset)); + } + DEBUG ((DEBUG_INFO, " \n")); + DEBUG ((DEBUG_INFO, " \n", SmiHandlerStruct->Handler)); + if (ImageStruct != NULL) { + DEBUG ((DEBUG_INFO, " 0x%x\n", (UINTN) (SmiHandlerStruct->Handler - ImageStruct->ImageBase))); + } + DEBUG ((DEBUG_INFO, " \n")); + DEBUG ((DEBUG_INFO, " \n", SmiHandlerStruct->CallerAddr)); + if (ImageStruct != NULL) { + DEBUG ((DEBUG_INFO, " 0x%x\n", (UINTN) (SmiHandlerStruct->CallerAddr - ImageStruct->ImageBase))); + } + DEBUG ((DEBUG_INFO, " \n")); + SmiHandlerStruct = (VOID *)((UINTN)SmiHandlerStruct + SmiHandlerStruct->Length); + DEBUG ((DEBUG_INFO, " \n")); + } + DEBUG ((DEBUG_INFO, " \n")); + } + SmiStruct = (VOID *)((UINTN)SmiStruct + SmiStruct->Header.Length); + } + + return; +} + +EFI_STATUS +EFIAPI +TestPointCheckSmiHandlerInstrument ( + VOID + ) +{ + DEBUG ((DEBUG_INFO, "==== TestPointCheckSmiHandlerInstrument - Enter\n")); + + GetSmiHandlerProfileDatabase(); + + if (mSmiHandlerProfileDatabase == NULL) { + return EFI_SUCCESS; + } + + // + // Dump all image + // + DEBUG ((DEBUG_INFO, "\n")); + DEBUG ((DEBUG_INFO, "\n")); + DEBUG ((DEBUG_INFO, "\n")); + DEBUG ((DEBUG_INFO, " \n")); + DumpSmmLoadedImage(); + DEBUG ((DEBUG_INFO, "\n\n")); + + // + // Dump SMI Handler + // + DEBUG ((DEBUG_INFO, "\n")); + DEBUG ((DEBUG_INFO, " \n\n")); + DEBUG ((DEBUG_INFO, " \n")); + DEBUG ((DEBUG_INFO, " \n")); + DumpSmiHandler(SmmCoreSmiHandlerCategoryRootHandler); + DEBUG ((DEBUG_INFO, " \n\n")); + + DEBUG ((DEBUG_INFO, " \n")); + DEBUG ((DEBUG_INFO, " \n")); + DumpSmiHandler(SmmCoreSmiHandlerCategoryGuidHandler); + DEBUG ((DEBUG_INFO, " \n\n")); + + DEBUG ((DEBUG_INFO, " \n")); + DEBUG ((DEBUG_INFO, " \n")); + DumpSmiHandler(SmmCoreSmiHandlerCategoryHardwareHandler); + DEBUG ((DEBUG_INFO, " \n\n")); + + DEBUG ((DEBUG_INFO, "\n")); + DEBUG ((DEBUG_INFO, "\n")); + + if (mSmiHandlerProfileDatabase != NULL) { + FreePool(mSmiHandlerProfileDatabase); + } + + DEBUG ((DEBUG_INFO, "==== TestPointCheckSmiHandlerInstrument - Exit\n")); + return EFI_SUCCESS; +} diff --git a/MinPlatformPkg/Test/Library/TestPointCheckLib/PeiCheckFvInfo.c b/MinPlatformPkg/Test/Library/TestPointCheckLib/PeiCheckFvInfo.c index 7bdd101886..f8a651ee72 100644 --- a/MinPlatformPkg/Test/Library/TestPointCheckLib/PeiCheckFvInfo.c +++ b/MinPlatformPkg/Test/Library/TestPointCheckLib/PeiCheckFvInfo.c @@ -1,165 +1,165 @@ -/** @file - -Copyright (c) 2017, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -EFI_STATUS -TestPointCheckFv ( - IN EFI_FIRMWARE_VOLUME_HEADER *FvHeader, - IN UINT64 Size, - IN GUID *FvFormat - ) -{ - if (!CompareGuid (FvFormat, &FvHeader->FileSystemGuid)) { - DEBUG ((DEBUG_ERROR, "FvFormat error - 0x%lx\n", FvHeader)); - return EFI_INVALID_PARAMETER; - } - if (Size != FvHeader->FvLength) { - DEBUG ((DEBUG_ERROR, "FvLength error - 0x%lx\n", FvHeader)); - return EFI_INVALID_PARAMETER; - } - return EFI_SUCCESS; -} - -EFI_STATUS -TestPointCheckFvInfo ( - VOID - ) -{ - EFI_STATUS Status; - EFI_PEI_PPI_DESCRIPTOR *Descriptor; - EFI_PEI_FIRMWARE_VOLUME_INFO_PPI *FvInfo; - EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI *FvInfo2; - UINTN Index; - UINTN Index2; - - DEBUG ((DEBUG_INFO, "==== TestPointCheckFvInfo - Enter\n")); - DEBUG ((DEBUG_INFO, "FV Info PPI\n")); - for (Index = 0; ; Index++) { - Status = PeiServicesLocatePpi ( - &gEfiPeiFirmwareVolumeInfoPpiGuid, - Index, - &Descriptor, - (VOID **)&FvInfo - ); - if (EFI_ERROR (Status)) { - break; - } - DEBUG ((DEBUG_INFO, - " BA=%08x L=%08x Format={%g}", - (UINT32)(UINTN)FvInfo->FvInfo, - FvInfo->FvInfoSize, - &FvInfo->FvFormat - )); - if (FvInfo->ParentFvName != NULL) { - DEBUG ((DEBUG_INFO, - " ParentFv={%g}", - FvInfo->ParentFvName - )); - } - if (FvInfo->ParentFileName != NULL) { - DEBUG ((DEBUG_INFO, - " ParentFileName={%g}", - FvInfo->ParentFileName - )); - } - DEBUG ((DEBUG_INFO, "\n")); - } - - DEBUG ((DEBUG_INFO, "FV Info2 PPI\n")); - for (Index2 = 0; ; Index2++) { - Status = PeiServicesLocatePpi ( - &gEfiPeiFirmwareVolumeInfo2PpiGuid, - Index2, - &Descriptor, - (VOID **)&FvInfo2 - ); - if (EFI_ERROR (Status)) { - break; - } - DEBUG ((DEBUG_INFO, - " BA=%08x L=%08x Format={%g}", - (UINT32)(UINTN)FvInfo2->FvInfo, - FvInfo2->FvInfoSize, - &FvInfo2->FvFormat - )); - if (FvInfo2->ParentFvName != NULL) { - DEBUG ((DEBUG_INFO, - " ParentFv={%g}", - FvInfo2->ParentFvName - )); - } - if (FvInfo2->ParentFileName != NULL) { - DEBUG ((DEBUG_INFO, - " ParentFileName={%g}", - FvInfo2->ParentFileName - )); - } - DEBUG ((DEBUG_INFO, - " Auth=%08x\n", - FvInfo2->AuthenticationStatus - )); - } - DEBUG ((DEBUG_INFO, "==== TestPointCheckFvInfo - Exit\n")); - - for (Index = 0; ; Index++) { - Status = PeiServicesLocatePpi ( - &gEfiPeiFirmwareVolumeInfoPpiGuid, - Index, - &Descriptor, - (VOID **)&FvInfo - ); - if (EFI_ERROR (Status)) { - break; - } - - Status = TestPointCheckFv (FvInfo->FvInfo, FvInfo->FvInfoSize, &FvInfo->FvFormat); - if (EFI_ERROR(Status)) { - TestPointLibAppendErrorString ( - PLATFORM_TEST_POINT_ROLE_PLATFORM_IBV, - NULL, - TEST_POINT_BYTE1_MEMORY_DISCOVERED_FV_INFO_FUNCTIONAL_ERROR_CODE \ - TEST_POINT_MEMORY_DISCOVERED \ - TEST_POINT_BYTE1_MEMORY_DISCOVERED_FV_INFO_FUNCTIONAL_ERROR_STRING - ); - return EFI_INVALID_PARAMETER; - } - } - for (Index2 = 0; ; Index2++) { - Status = PeiServicesLocatePpi ( - &gEfiPeiFirmwareVolumeInfo2PpiGuid, - Index2, - &Descriptor, - (VOID **)&FvInfo2 - ); - if (EFI_ERROR (Status)) { - break; - } - - Status = TestPointCheckFv (FvInfo2->FvInfo, FvInfo2->FvInfoSize, &FvInfo2->FvFormat); - if (EFI_ERROR(Status)) { - TestPointLibAppendErrorString ( - PLATFORM_TEST_POINT_ROLE_PLATFORM_IBV, - NULL, - TEST_POINT_BYTE1_MEMORY_DISCOVERED_FV_INFO_FUNCTIONAL_ERROR_CODE \ - TEST_POINT_MEMORY_DISCOVERED \ - TEST_POINT_BYTE1_MEMORY_DISCOVERED_FV_INFO_FUNCTIONAL_ERROR_STRING - ); - return EFI_INVALID_PARAMETER; - } - } - - return EFI_SUCCESS; -} +/** @file + +Copyright (c) 2017, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +EFI_STATUS +TestPointCheckFv ( + IN EFI_FIRMWARE_VOLUME_HEADER *FvHeader, + IN UINT64 Size, + IN GUID *FvFormat + ) +{ + if (!CompareGuid (FvFormat, &FvHeader->FileSystemGuid)) { + DEBUG ((DEBUG_ERROR, "FvFormat error - 0x%lx\n", FvHeader)); + return EFI_INVALID_PARAMETER; + } + if (Size != FvHeader->FvLength) { + DEBUG ((DEBUG_ERROR, "FvLength error - 0x%lx\n", FvHeader)); + return EFI_INVALID_PARAMETER; + } + return EFI_SUCCESS; +} + +EFI_STATUS +TestPointCheckFvInfo ( + VOID + ) +{ + EFI_STATUS Status; + EFI_PEI_PPI_DESCRIPTOR *Descriptor; + EFI_PEI_FIRMWARE_VOLUME_INFO_PPI *FvInfo; + EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI *FvInfo2; + UINTN Index; + UINTN Index2; + + DEBUG ((DEBUG_INFO, "==== TestPointCheckFvInfo - Enter\n")); + DEBUG ((DEBUG_INFO, "FV Info PPI\n")); + for (Index = 0; ; Index++) { + Status = PeiServicesLocatePpi ( + &gEfiPeiFirmwareVolumeInfoPpiGuid, + Index, + &Descriptor, + (VOID **)&FvInfo + ); + if (EFI_ERROR (Status)) { + break; + } + DEBUG ((DEBUG_INFO, + " BA=%08x L=%08x Format={%g}", + (UINT32)(UINTN)FvInfo->FvInfo, + FvInfo->FvInfoSize, + &FvInfo->FvFormat + )); + if (FvInfo->ParentFvName != NULL) { + DEBUG ((DEBUG_INFO, + " ParentFv={%g}", + FvInfo->ParentFvName + )); + } + if (FvInfo->ParentFileName != NULL) { + DEBUG ((DEBUG_INFO, + " ParentFileName={%g}", + FvInfo->ParentFileName + )); + } + DEBUG ((DEBUG_INFO, "\n")); + } + + DEBUG ((DEBUG_INFO, "FV Info2 PPI\n")); + for (Index2 = 0; ; Index2++) { + Status = PeiServicesLocatePpi ( + &gEfiPeiFirmwareVolumeInfo2PpiGuid, + Index2, + &Descriptor, + (VOID **)&FvInfo2 + ); + if (EFI_ERROR (Status)) { + break; + } + DEBUG ((DEBUG_INFO, + " BA=%08x L=%08x Format={%g}", + (UINT32)(UINTN)FvInfo2->FvInfo, + FvInfo2->FvInfoSize, + &FvInfo2->FvFormat + )); + if (FvInfo2->ParentFvName != NULL) { + DEBUG ((DEBUG_INFO, + " ParentFv={%g}", + FvInfo2->ParentFvName + )); + } + if (FvInfo2->ParentFileName != NULL) { + DEBUG ((DEBUG_INFO, + " ParentFileName={%g}", + FvInfo2->ParentFileName + )); + } + DEBUG ((DEBUG_INFO, + " Auth=%08x\n", + FvInfo2->AuthenticationStatus + )); + } + DEBUG ((DEBUG_INFO, "==== TestPointCheckFvInfo - Exit\n")); + + for (Index = 0; ; Index++) { + Status = PeiServicesLocatePpi ( + &gEfiPeiFirmwareVolumeInfoPpiGuid, + Index, + &Descriptor, + (VOID **)&FvInfo + ); + if (EFI_ERROR (Status)) { + break; + } + + Status = TestPointCheckFv (FvInfo->FvInfo, FvInfo->FvInfoSize, &FvInfo->FvFormat); + if (EFI_ERROR(Status)) { + TestPointLibAppendErrorString ( + PLATFORM_TEST_POINT_ROLE_PLATFORM_IBV, + NULL, + TEST_POINT_BYTE1_MEMORY_DISCOVERED_FV_INFO_FUNCTIONAL_ERROR_CODE \ + TEST_POINT_MEMORY_DISCOVERED \ + TEST_POINT_BYTE1_MEMORY_DISCOVERED_FV_INFO_FUNCTIONAL_ERROR_STRING + ); + return EFI_INVALID_PARAMETER; + } + } + for (Index2 = 0; ; Index2++) { + Status = PeiServicesLocatePpi ( + &gEfiPeiFirmwareVolumeInfo2PpiGuid, + Index2, + &Descriptor, + (VOID **)&FvInfo2 + ); + if (EFI_ERROR (Status)) { + break; + } + + Status = TestPointCheckFv (FvInfo2->FvInfo, FvInfo2->FvInfoSize, &FvInfo2->FvFormat); + if (EFI_ERROR(Status)) { + TestPointLibAppendErrorString ( + PLATFORM_TEST_POINT_ROLE_PLATFORM_IBV, + NULL, + TEST_POINT_BYTE1_MEMORY_DISCOVERED_FV_INFO_FUNCTIONAL_ERROR_CODE \ + TEST_POINT_MEMORY_DISCOVERED \ + TEST_POINT_BYTE1_MEMORY_DISCOVERED_FV_INFO_FUNCTIONAL_ERROR_STRING + ); + return EFI_INVALID_PARAMETER; + } + } + + return EFI_SUCCESS; +} diff --git a/MinPlatformPkg/Test/Library/TestPointCheckLib/PeiCheckHob.c b/MinPlatformPkg/Test/Library/TestPointCheckLib/PeiCheckHob.c index c72980fbcf..92a14d7f40 100644 --- a/MinPlatformPkg/Test/Library/TestPointCheckLib/PeiCheckHob.c +++ b/MinPlatformPkg/Test/Library/TestPointCheckLib/PeiCheckHob.c @@ -1,367 +1,367 @@ -/** @file - -Copyright (c) 2017, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define MEMORY_ATTRIBUTE_MASK (EFI_RESOURCE_ATTRIBUTE_PRESENT | \ - EFI_RESOURCE_ATTRIBUTE_INITIALIZED | \ - EFI_RESOURCE_ATTRIBUTE_TESTED | \ - EFI_RESOURCE_ATTRIBUTE_16_BIT_IO | \ - EFI_RESOURCE_ATTRIBUTE_32_BIT_IO | \ - EFI_RESOURCE_ATTRIBUTE_64_BIT_IO \ - ) - -#define TESTED_MEMORY_ATTRIBUTES (EFI_RESOURCE_ATTRIBUTE_PRESENT | EFI_RESOURCE_ATTRIBUTE_INITIALIZED | EFI_RESOURCE_ATTRIBUTE_TESTED) - -#define INITIALIZED_MEMORY_ATTRIBUTES (EFI_RESOURCE_ATTRIBUTE_PRESENT | EFI_RESOURCE_ATTRIBUTE_INITIALIZED) - -#define PRESENT_MEMORY_ATTRIBUTES (EFI_RESOURCE_ATTRIBUTE_PRESENT) - -CHAR8 *mMemoryTypeShortName[] = { - "Reserved", - "LoaderCode", - "LoaderData", - "BS_Code", - "BS_Data", - "RT_Code", - "RT_Data", - "Available", - "Unusable", - "ACPI_Recl", - "ACPI_NVS", - "MMIO", - "MMIO_Port", - "PalCode", - "Persistent", -}; - -CHAR8 *mResourceTypeShortName[] = { - "Mem", - "MMIO", - "I/O", - "FD", - "MM Port I/O", - "Reserved Mem", - "Reserved I/O", -}; - -STATIC CHAR8 mUnknownStr[11]; - -CHAR8 * -ShortNameOfMemoryType ( - IN UINT32 Type - ) -{ - if (Type < sizeof(mMemoryTypeShortName) / sizeof(mMemoryTypeShortName[0])) { - return mMemoryTypeShortName[Type]; - } else { - AsciiSPrint(mUnknownStr, sizeof(mUnknownStr), "%08x", Type); - return mUnknownStr; - } -} - -CHAR8 * -ShortNameOfResourceType ( - IN UINT32 Type - ) -{ - if (Type < sizeof(mResourceTypeShortName) / sizeof(mResourceTypeShortName[0])) { - return mResourceTypeShortName[Type]; - } else { - AsciiSPrint(mUnknownStr, sizeof(mUnknownStr), "%08x", Type); - return mUnknownStr; - } -} - -VOID -DumpPhitHob ( - IN VOID *HobList - ) -{ - EFI_HOB_HANDOFF_INFO_TABLE *PhitHob; - - PhitHob = HobList; - ASSERT(GET_HOB_TYPE(HobList) == EFI_HOB_TYPE_HANDOFF); - DEBUG ((DEBUG_INFO, "PHIT HOB\n")); - DEBUG ((DEBUG_INFO, " PhitHob - 0x%x\n", PhitHob)); - DEBUG ((DEBUG_INFO, " BootMode - 0x%x\n", PhitHob->BootMode)); - DEBUG ((DEBUG_INFO, " EfiMemoryTop - 0x%016lx\n", PhitHob->EfiMemoryTop)); - DEBUG ((DEBUG_INFO, " EfiMemoryBottom - 0x%016lx\n", PhitHob->EfiMemoryBottom)); - DEBUG ((DEBUG_INFO, " EfiFreeMemoryTop - 0x%016lx\n", PhitHob->EfiFreeMemoryTop)); - DEBUG ((DEBUG_INFO, " EfiFreeMemoryBottom - 0x%016lx\n", PhitHob->EfiFreeMemoryBottom)); - DEBUG ((DEBUG_INFO, " EfiEndOfHobList - 0x%lx\n", PhitHob->EfiEndOfHobList)); -} - -VOID -DumpCpuHob ( - IN VOID *HobList - ) -{ - EFI_PEI_HOB_POINTERS Hob; - EFI_HOB_CPU *CpuHob; - - DEBUG ((DEBUG_INFO, "CPU HOBs\n")); - for (Hob.Raw = HobList; !END_OF_HOB_LIST(Hob); Hob.Raw = GET_NEXT_HOB(Hob)) { - if (GET_HOB_TYPE(Hob) == EFI_HOB_TYPE_CPU) { - CpuHob = Hob.Cpu; - DEBUG ((DEBUG_INFO, - " SizeOfMemorySpace=%x SizeOfIoSpace=%x\n", - CpuHob->SizeOfMemorySpace, - CpuHob->SizeOfIoSpace - )); - } - } -} - -VOID -DumpResourceHob ( - IN VOID *HobList - ) -{ - EFI_PEI_HOB_POINTERS Hob; - EFI_HOB_RESOURCE_DESCRIPTOR *ResourceHob; - - DEBUG ((DEBUG_INFO, "Resource Descriptor HOBs\n")); - for (Hob.Raw = HobList; !END_OF_HOB_LIST (Hob); Hob.Raw = GET_NEXT_HOB (Hob)) { - - if (GET_HOB_TYPE (Hob) == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) { - - ResourceHob = Hob.ResourceDescriptor; - - DEBUG ((DEBUG_INFO, - " BA=%016lx L=%016lx Attr=%08x ", - ResourceHob->PhysicalStart, - ResourceHob->ResourceLength, - ResourceHob->ResourceAttribute - )); - - DEBUG ((DEBUG_INFO, ShortNameOfResourceType(ResourceHob->ResourceType))); - switch (ResourceHob->ResourceType) { - case EFI_RESOURCE_SYSTEM_MEMORY: - if ((ResourceHob->ResourceAttribute & EFI_RESOURCE_ATTRIBUTE_PERSISTENT) != 0) { - DEBUG ((DEBUG_INFO, " (Persistent)")); - } else if ((ResourceHob->ResourceAttribute & EFI_RESOURCE_ATTRIBUTE_MORE_RELIABLE) != 0) { - DEBUG ((DEBUG_INFO, " (MoreReliable)")); - } else if ((ResourceHob->ResourceAttribute & MEMORY_ATTRIBUTE_MASK) == TESTED_MEMORY_ATTRIBUTES) { - DEBUG ((DEBUG_INFO, " (Tested)")); - } else if ((ResourceHob->ResourceAttribute & MEMORY_ATTRIBUTE_MASK) == INITIALIZED_MEMORY_ATTRIBUTES) { - DEBUG ((DEBUG_INFO, " (Init)")); - } else if ((ResourceHob->ResourceAttribute & MEMORY_ATTRIBUTE_MASK) == PRESENT_MEMORY_ATTRIBUTES) { - DEBUG ((DEBUG_INFO, " (Present)")); - } else { - DEBUG ((DEBUG_INFO, " (Unknown)")); - } - break; - default: - break; - } - DEBUG ((DEBUG_INFO, "\n")); - } - } -} - -VOID -DumpFvHob ( - IN VOID *HobList - ) -{ - EFI_PEI_HOB_POINTERS Hob; - EFI_HOB_FIRMWARE_VOLUME *FirmwareVolumeHob; - EFI_HOB_FIRMWARE_VOLUME2 *FirmwareVolume2Hob; - - DEBUG ((DEBUG_INFO, "FV HOBs\n")); - for (Hob.Raw = HobList; !END_OF_HOB_LIST (Hob); Hob.Raw = GET_NEXT_HOB (Hob)) { - if (GET_HOB_TYPE (Hob) == EFI_HOB_TYPE_FV) { - - FirmwareVolumeHob = Hob.FirmwareVolume; - - DEBUG ((DEBUG_INFO, - " BA=%016lx L=%016lx\n", - FirmwareVolumeHob->BaseAddress, - FirmwareVolumeHob->Length - )); - } - } - - DEBUG ((DEBUG_INFO, "FV2 HOBs\n")); - for (Hob.Raw = HobList; !END_OF_HOB_LIST (Hob); Hob.Raw = GET_NEXT_HOB (Hob)) { - if (GET_HOB_TYPE (Hob) == EFI_HOB_TYPE_FV2) { - - FirmwareVolume2Hob = Hob.FirmwareVolume2; - - DEBUG ((DEBUG_INFO, - " BA=%016lx L=%016lx Fv={%g} File={%g}\n", - FirmwareVolume2Hob->BaseAddress, - FirmwareVolume2Hob->Length, - &FirmwareVolume2Hob->FvName, - &FirmwareVolume2Hob->FileName - )); - } - } -} - -VOID -DumpMemoryAllocationHob ( - IN VOID *HobList - ) -{ - EFI_PEI_HOB_POINTERS Hob; - EFI_HOB_MEMORY_ALLOCATION *MemoryHob; - - DEBUG ((DEBUG_INFO, "Memory Allocation HOBs\n")); - for (Hob.Raw = HobList; !END_OF_HOB_LIST (Hob); Hob.Raw = GET_NEXT_HOB (Hob)) { - if (GET_HOB_TYPE(Hob) == EFI_HOB_TYPE_MEMORY_ALLOCATION) { - - MemoryHob = Hob.MemoryAllocation; - - DEBUG ((DEBUG_INFO, - " BA=%016lx L=%016lx ", - MemoryHob->AllocDescriptor.MemoryBaseAddress, - MemoryHob->AllocDescriptor.MemoryLength - )); - DEBUG ((DEBUG_INFO, ShortNameOfMemoryType(MemoryHob->AllocDescriptor.MemoryType))); - if (!IsZeroGuid(&MemoryHob->AllocDescriptor.Name)) { - if (CompareGuid(&gEfiHobMemoryAllocStackGuid, &MemoryHob->AllocDescriptor.Name)) { - DEBUG ((DEBUG_INFO, " {%g}", &MemoryHob->AllocDescriptor.Name)); - } else if (CompareGuid(&gEfiHobMemoryAllocBspStoreGuid, &MemoryHob->AllocDescriptor.Name)) { - DEBUG ((DEBUG_INFO, " {%g}", &MemoryHob->AllocDescriptor.Name)); - } else if (CompareGuid(&gEfiHobMemoryAllocModuleGuid, &MemoryHob->AllocDescriptor.Name)) { - DEBUG ((DEBUG_INFO, - " {Module=%g,Entry=0x%lx}", - &((EFI_HOB_MEMORY_ALLOCATION_MODULE *)MemoryHob)->ModuleName, - ((EFI_HOB_MEMORY_ALLOCATION_MODULE *)MemoryHob)->EntryPoint - )); - } else { - DEBUG ((DEBUG_INFO, - " {%g}", - &MemoryHob->AllocDescriptor.Name - )); - } - } - DEBUG ((DEBUG_INFO, "\n")); - } - } -} - -VOID -DumpGuidHob ( - IN VOID *HobList - ) -{ - EFI_PEI_HOB_POINTERS Hob; - EFI_HOB_GUID_TYPE *GuidHob; - - DEBUG ((DEBUG_INFO, "GUID HOBs\n")); - for (Hob.Raw = HobList; !END_OF_HOB_LIST (Hob); Hob.Raw = GET_NEXT_HOB (Hob)) { - if (GET_HOB_TYPE (Hob) == EFI_HOB_TYPE_GUID_EXTENSION) { - - GuidHob = Hob.Guid; - - DEBUG ((DEBUG_INFO, - " GUID=%g DataSize=0x%x\n", - &GuidHob->Name, - GET_GUID_HOB_DATA_SIZE(GuidHob) - )); - } - } -} - -VOID -TestPointDumpHob ( - IN BOOLEAN PhitHobOnly - ) -{ - VOID *HobList; - - DEBUG ((DEBUG_INFO, "==== TestPointDumpHob - Enter\n")); - // - // Get Hob list - // - HobList = GetHobList (); - - DumpPhitHob (HobList); - - if (PhitHobOnly) { - goto Done ; - } - - DumpCpuHob (HobList); - - DumpResourceHob (HobList); - - DumpFvHob (HobList); - - DumpMemoryAllocationHob (HobList); - - DumpGuidHob (HobList); - -Done: - DEBUG ((DEBUG_INFO, "==== TestPointDumpHob - Exit\n")); - - return ; -} - -EFI_STATUS -TestPointCheckMemoryResource ( - VOID - ) -{ - VOID *HobList; - EFI_PEI_HOB_POINTERS Hob; - EFI_HOB_RESOURCE_DESCRIPTOR *ResourceHob; - EFI_PEI_HOB_POINTERS Hob2; - EFI_HOB_RESOURCE_DESCRIPTOR *ResourceHob2; - - HobList = GetHobList (); - - // - // Check overlap - // - for (Hob.Raw = HobList; !END_OF_HOB_LIST (Hob); Hob.Raw = GET_NEXT_HOB (Hob)) { - if (GET_HOB_TYPE (Hob) == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) { - ResourceHob = Hob.ResourceDescriptor; - switch (ResourceHob->ResourceType) { - case EFI_RESOURCE_SYSTEM_MEMORY: - if (((ResourceHob->ResourceAttribute & MEMORY_ATTRIBUTE_MASK) == TESTED_MEMORY_ATTRIBUTES) || - ((ResourceHob->ResourceAttribute & MEMORY_ATTRIBUTE_MASK) == INITIALIZED_MEMORY_ATTRIBUTES)) { - DEBUG ((DEBUG_INFO, "Overlap Checking 0x%lx 0x%lx\n", ResourceHob->PhysicalStart, ResourceHob->ResourceLength)); - for (Hob2.Raw = GET_NEXT_HOB (Hob); !END_OF_HOB_LIST (Hob2); Hob2.Raw = GET_NEXT_HOB (Hob2)) { - ResourceHob2 = Hob2.ResourceDescriptor; - switch (ResourceHob2->ResourceType) { - case EFI_RESOURCE_SYSTEM_MEMORY: - if (((ResourceHob2->ResourceAttribute & MEMORY_ATTRIBUTE_MASK) == TESTED_MEMORY_ATTRIBUTES) || - ((ResourceHob2->ResourceAttribute & MEMORY_ATTRIBUTE_MASK) == INITIALIZED_MEMORY_ATTRIBUTES)) { - if ((ResourceHob->PhysicalStart >= ResourceHob2->PhysicalStart && ResourceHob->PhysicalStart < ResourceHob2->PhysicalStart + ResourceHob2->ResourceLength) || - (ResourceHob2->PhysicalStart >= ResourceHob->PhysicalStart && ResourceHob2->PhysicalStart < ResourceHob->PhysicalStart + ResourceHob->ResourceLength)) { - DEBUG ((DEBUG_INFO, " Overlap 0x%lx 0x%lx\n", ResourceHob2->PhysicalStart, ResourceHob2->ResourceLength)); - return EFI_INVALID_PARAMETER; - } - } - break; - default: - break; - } - } - } - break; - default: - break; - } - } - } - - return EFI_SUCCESS; -} - +/** @file + +Copyright (c) 2017, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MEMORY_ATTRIBUTE_MASK (EFI_RESOURCE_ATTRIBUTE_PRESENT | \ + EFI_RESOURCE_ATTRIBUTE_INITIALIZED | \ + EFI_RESOURCE_ATTRIBUTE_TESTED | \ + EFI_RESOURCE_ATTRIBUTE_16_BIT_IO | \ + EFI_RESOURCE_ATTRIBUTE_32_BIT_IO | \ + EFI_RESOURCE_ATTRIBUTE_64_BIT_IO \ + ) + +#define TESTED_MEMORY_ATTRIBUTES (EFI_RESOURCE_ATTRIBUTE_PRESENT | EFI_RESOURCE_ATTRIBUTE_INITIALIZED | EFI_RESOURCE_ATTRIBUTE_TESTED) + +#define INITIALIZED_MEMORY_ATTRIBUTES (EFI_RESOURCE_ATTRIBUTE_PRESENT | EFI_RESOURCE_ATTRIBUTE_INITIALIZED) + +#define PRESENT_MEMORY_ATTRIBUTES (EFI_RESOURCE_ATTRIBUTE_PRESENT) + +CHAR8 *mMemoryTypeShortName[] = { + "Reserved", + "LoaderCode", + "LoaderData", + "BS_Code", + "BS_Data", + "RT_Code", + "RT_Data", + "Available", + "Unusable", + "ACPI_Recl", + "ACPI_NVS", + "MMIO", + "MMIO_Port", + "PalCode", + "Persistent", +}; + +CHAR8 *mResourceTypeShortName[] = { + "Mem", + "MMIO", + "I/O", + "FD", + "MM Port I/O", + "Reserved Mem", + "Reserved I/O", +}; + +STATIC CHAR8 mUnknownStr[11]; + +CHAR8 * +ShortNameOfMemoryType ( + IN UINT32 Type + ) +{ + if (Type < sizeof(mMemoryTypeShortName) / sizeof(mMemoryTypeShortName[0])) { + return mMemoryTypeShortName[Type]; + } else { + AsciiSPrint(mUnknownStr, sizeof(mUnknownStr), "%08x", Type); + return mUnknownStr; + } +} + +CHAR8 * +ShortNameOfResourceType ( + IN UINT32 Type + ) +{ + if (Type < sizeof(mResourceTypeShortName) / sizeof(mResourceTypeShortName[0])) { + return mResourceTypeShortName[Type]; + } else { + AsciiSPrint(mUnknownStr, sizeof(mUnknownStr), "%08x", Type); + return mUnknownStr; + } +} + +VOID +DumpPhitHob ( + IN VOID *HobList + ) +{ + EFI_HOB_HANDOFF_INFO_TABLE *PhitHob; + + PhitHob = HobList; + ASSERT(GET_HOB_TYPE(HobList) == EFI_HOB_TYPE_HANDOFF); + DEBUG ((DEBUG_INFO, "PHIT HOB\n")); + DEBUG ((DEBUG_INFO, " PhitHob - 0x%x\n", PhitHob)); + DEBUG ((DEBUG_INFO, " BootMode - 0x%x\n", PhitHob->BootMode)); + DEBUG ((DEBUG_INFO, " EfiMemoryTop - 0x%016lx\n", PhitHob->EfiMemoryTop)); + DEBUG ((DEBUG_INFO, " EfiMemoryBottom - 0x%016lx\n", PhitHob->EfiMemoryBottom)); + DEBUG ((DEBUG_INFO, " EfiFreeMemoryTop - 0x%016lx\n", PhitHob->EfiFreeMemoryTop)); + DEBUG ((DEBUG_INFO, " EfiFreeMemoryBottom - 0x%016lx\n", PhitHob->EfiFreeMemoryBottom)); + DEBUG ((DEBUG_INFO, " EfiEndOfHobList - 0x%lx\n", PhitHob->EfiEndOfHobList)); +} + +VOID +DumpCpuHob ( + IN VOID *HobList + ) +{ + EFI_PEI_HOB_POINTERS Hob; + EFI_HOB_CPU *CpuHob; + + DEBUG ((DEBUG_INFO, "CPU HOBs\n")); + for (Hob.Raw = HobList; !END_OF_HOB_LIST(Hob); Hob.Raw = GET_NEXT_HOB(Hob)) { + if (GET_HOB_TYPE(Hob) == EFI_HOB_TYPE_CPU) { + CpuHob = Hob.Cpu; + DEBUG ((DEBUG_INFO, + " SizeOfMemorySpace=%x SizeOfIoSpace=%x\n", + CpuHob->SizeOfMemorySpace, + CpuHob->SizeOfIoSpace + )); + } + } +} + +VOID +DumpResourceHob ( + IN VOID *HobList + ) +{ + EFI_PEI_HOB_POINTERS Hob; + EFI_HOB_RESOURCE_DESCRIPTOR *ResourceHob; + + DEBUG ((DEBUG_INFO, "Resource Descriptor HOBs\n")); + for (Hob.Raw = HobList; !END_OF_HOB_LIST (Hob); Hob.Raw = GET_NEXT_HOB (Hob)) { + + if (GET_HOB_TYPE (Hob) == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) { + + ResourceHob = Hob.ResourceDescriptor; + + DEBUG ((DEBUG_INFO, + " BA=%016lx L=%016lx Attr=%08x ", + ResourceHob->PhysicalStart, + ResourceHob->ResourceLength, + ResourceHob->ResourceAttribute + )); + + DEBUG ((DEBUG_INFO, ShortNameOfResourceType(ResourceHob->ResourceType))); + switch (ResourceHob->ResourceType) { + case EFI_RESOURCE_SYSTEM_MEMORY: + if ((ResourceHob->ResourceAttribute & EFI_RESOURCE_ATTRIBUTE_PERSISTENT) != 0) { + DEBUG ((DEBUG_INFO, " (Persistent)")); + } else if ((ResourceHob->ResourceAttribute & EFI_RESOURCE_ATTRIBUTE_MORE_RELIABLE) != 0) { + DEBUG ((DEBUG_INFO, " (MoreReliable)")); + } else if ((ResourceHob->ResourceAttribute & MEMORY_ATTRIBUTE_MASK) == TESTED_MEMORY_ATTRIBUTES) { + DEBUG ((DEBUG_INFO, " (Tested)")); + } else if ((ResourceHob->ResourceAttribute & MEMORY_ATTRIBUTE_MASK) == INITIALIZED_MEMORY_ATTRIBUTES) { + DEBUG ((DEBUG_INFO, " (Init)")); + } else if ((ResourceHob->ResourceAttribute & MEMORY_ATTRIBUTE_MASK) == PRESENT_MEMORY_ATTRIBUTES) { + DEBUG ((DEBUG_INFO, " (Present)")); + } else { + DEBUG ((DEBUG_INFO, " (Unknown)")); + } + break; + default: + break; + } + DEBUG ((DEBUG_INFO, "\n")); + } + } +} + +VOID +DumpFvHob ( + IN VOID *HobList + ) +{ + EFI_PEI_HOB_POINTERS Hob; + EFI_HOB_FIRMWARE_VOLUME *FirmwareVolumeHob; + EFI_HOB_FIRMWARE_VOLUME2 *FirmwareVolume2Hob; + + DEBUG ((DEBUG_INFO, "FV HOBs\n")); + for (Hob.Raw = HobList; !END_OF_HOB_LIST (Hob); Hob.Raw = GET_NEXT_HOB (Hob)) { + if (GET_HOB_TYPE (Hob) == EFI_HOB_TYPE_FV) { + + FirmwareVolumeHob = Hob.FirmwareVolume; + + DEBUG ((DEBUG_INFO, + " BA=%016lx L=%016lx\n", + FirmwareVolumeHob->BaseAddress, + FirmwareVolumeHob->Length + )); + } + } + + DEBUG ((DEBUG_INFO, "FV2 HOBs\n")); + for (Hob.Raw = HobList; !END_OF_HOB_LIST (Hob); Hob.Raw = GET_NEXT_HOB (Hob)) { + if (GET_HOB_TYPE (Hob) == EFI_HOB_TYPE_FV2) { + + FirmwareVolume2Hob = Hob.FirmwareVolume2; + + DEBUG ((DEBUG_INFO, + " BA=%016lx L=%016lx Fv={%g} File={%g}\n", + FirmwareVolume2Hob->BaseAddress, + FirmwareVolume2Hob->Length, + &FirmwareVolume2Hob->FvName, + &FirmwareVolume2Hob->FileName + )); + } + } +} + +VOID +DumpMemoryAllocationHob ( + IN VOID *HobList + ) +{ + EFI_PEI_HOB_POINTERS Hob; + EFI_HOB_MEMORY_ALLOCATION *MemoryHob; + + DEBUG ((DEBUG_INFO, "Memory Allocation HOBs\n")); + for (Hob.Raw = HobList; !END_OF_HOB_LIST (Hob); Hob.Raw = GET_NEXT_HOB (Hob)) { + if (GET_HOB_TYPE(Hob) == EFI_HOB_TYPE_MEMORY_ALLOCATION) { + + MemoryHob = Hob.MemoryAllocation; + + DEBUG ((DEBUG_INFO, + " BA=%016lx L=%016lx ", + MemoryHob->AllocDescriptor.MemoryBaseAddress, + MemoryHob->AllocDescriptor.MemoryLength + )); + DEBUG ((DEBUG_INFO, ShortNameOfMemoryType(MemoryHob->AllocDescriptor.MemoryType))); + if (!IsZeroGuid(&MemoryHob->AllocDescriptor.Name)) { + if (CompareGuid(&gEfiHobMemoryAllocStackGuid, &MemoryHob->AllocDescriptor.Name)) { + DEBUG ((DEBUG_INFO, " {%g}", &MemoryHob->AllocDescriptor.Name)); + } else if (CompareGuid(&gEfiHobMemoryAllocBspStoreGuid, &MemoryHob->AllocDescriptor.Name)) { + DEBUG ((DEBUG_INFO, " {%g}", &MemoryHob->AllocDescriptor.Name)); + } else if (CompareGuid(&gEfiHobMemoryAllocModuleGuid, &MemoryHob->AllocDescriptor.Name)) { + DEBUG ((DEBUG_INFO, + " {Module=%g,Entry=0x%lx}", + &((EFI_HOB_MEMORY_ALLOCATION_MODULE *)MemoryHob)->ModuleName, + ((EFI_HOB_MEMORY_ALLOCATION_MODULE *)MemoryHob)->EntryPoint + )); + } else { + DEBUG ((DEBUG_INFO, + " {%g}", + &MemoryHob->AllocDescriptor.Name + )); + } + } + DEBUG ((DEBUG_INFO, "\n")); + } + } +} + +VOID +DumpGuidHob ( + IN VOID *HobList + ) +{ + EFI_PEI_HOB_POINTERS Hob; + EFI_HOB_GUID_TYPE *GuidHob; + + DEBUG ((DEBUG_INFO, "GUID HOBs\n")); + for (Hob.Raw = HobList; !END_OF_HOB_LIST (Hob); Hob.Raw = GET_NEXT_HOB (Hob)) { + if (GET_HOB_TYPE (Hob) == EFI_HOB_TYPE_GUID_EXTENSION) { + + GuidHob = Hob.Guid; + + DEBUG ((DEBUG_INFO, + " GUID=%g DataSize=0x%x\n", + &GuidHob->Name, + GET_GUID_HOB_DATA_SIZE(GuidHob) + )); + } + } +} + +VOID +TestPointDumpHob ( + IN BOOLEAN PhitHobOnly + ) +{ + VOID *HobList; + + DEBUG ((DEBUG_INFO, "==== TestPointDumpHob - Enter\n")); + // + // Get Hob list + // + HobList = GetHobList (); + + DumpPhitHob (HobList); + + if (PhitHobOnly) { + goto Done ; + } + + DumpCpuHob (HobList); + + DumpResourceHob (HobList); + + DumpFvHob (HobList); + + DumpMemoryAllocationHob (HobList); + + DumpGuidHob (HobList); + +Done: + DEBUG ((DEBUG_INFO, "==== TestPointDumpHob - Exit\n")); + + return ; +} + +EFI_STATUS +TestPointCheckMemoryResource ( + VOID + ) +{ + VOID *HobList; + EFI_PEI_HOB_POINTERS Hob; + EFI_HOB_RESOURCE_DESCRIPTOR *ResourceHob; + EFI_PEI_HOB_POINTERS Hob2; + EFI_HOB_RESOURCE_DESCRIPTOR *ResourceHob2; + + HobList = GetHobList (); + + // + // Check overlap + // + for (Hob.Raw = HobList; !END_OF_HOB_LIST (Hob); Hob.Raw = GET_NEXT_HOB (Hob)) { + if (GET_HOB_TYPE (Hob) == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) { + ResourceHob = Hob.ResourceDescriptor; + switch (ResourceHob->ResourceType) { + case EFI_RESOURCE_SYSTEM_MEMORY: + if (((ResourceHob->ResourceAttribute & MEMORY_ATTRIBUTE_MASK) == TESTED_MEMORY_ATTRIBUTES) || + ((ResourceHob->ResourceAttribute & MEMORY_ATTRIBUTE_MASK) == INITIALIZED_MEMORY_ATTRIBUTES)) { + DEBUG ((DEBUG_INFO, "Overlap Checking 0x%lx 0x%lx\n", ResourceHob->PhysicalStart, ResourceHob->ResourceLength)); + for (Hob2.Raw = GET_NEXT_HOB (Hob); !END_OF_HOB_LIST (Hob2); Hob2.Raw = GET_NEXT_HOB (Hob2)) { + ResourceHob2 = Hob2.ResourceDescriptor; + switch (ResourceHob2->ResourceType) { + case EFI_RESOURCE_SYSTEM_MEMORY: + if (((ResourceHob2->ResourceAttribute & MEMORY_ATTRIBUTE_MASK) == TESTED_MEMORY_ATTRIBUTES) || + ((ResourceHob2->ResourceAttribute & MEMORY_ATTRIBUTE_MASK) == INITIALIZED_MEMORY_ATTRIBUTES)) { + if ((ResourceHob->PhysicalStart >= ResourceHob2->PhysicalStart && ResourceHob->PhysicalStart < ResourceHob2->PhysicalStart + ResourceHob2->ResourceLength) || + (ResourceHob2->PhysicalStart >= ResourceHob->PhysicalStart && ResourceHob2->PhysicalStart < ResourceHob->PhysicalStart + ResourceHob->ResourceLength)) { + DEBUG ((DEBUG_INFO, " Overlap 0x%lx 0x%lx\n", ResourceHob2->PhysicalStart, ResourceHob2->ResourceLength)); + return EFI_INVALID_PARAMETER; + } + } + break; + default: + break; + } + } + } + break; + default: + break; + } + } + } + + return EFI_SUCCESS; +} + From c9568305183a11c17e43b427be5e2da45a719530 Mon Sep 17 00:00:00 2001 From: Zhiguang Liu Date: Thu, 6 Apr 2023 16:13:32 +0800 Subject: [PATCH 4/8] [CHERRY-PICK] MinPlatformPkg: Delete UefiCpuLib usage Delete UefiCpuLib usage because UefiCpuPkg/UefiCpuLib is merged to MdePkg/CpuLib. Cc: Chasel Chiu Cc: Nate DeSimone Cc: Isaac Oram Cc: Liming Gao Cc: Eric Dong Reviewed-by: Chasel Chiu Reviewed-by: Michael D Kinney Signed-off-by: Zhiguang Liu (cherry picked from commit 920c9b11c69dc06ca24477ededbce797bb0dbc37) --- MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc b/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc index 3749199da7..5ce21cf31e 100644 --- a/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc +++ b/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc @@ -1,7 +1,7 @@ ## @file # Platform description. # -# Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.
+# Copyright (c) 2017 - 2023, Intel Corporation. All rights reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -60,7 +60,6 @@ PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf - UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf # # Framework From 7be9be0d6feafffc04f03ac59ec7d76903db62d7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 7 Sep 2023 09:49:04 -0400 Subject: [PATCH 5/8] GitHub Action: Bump actions/checkout from 3 to 4 (#190) Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/codeql.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index c3432aec6e..41c6770061 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -43,7 +43,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install Python uses: actions/setup-python@v4 @@ -89,7 +89,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install Python uses: actions/setup-python@v4 From 697d20d42c4d89bcb072f5d5b5d0d11859c059af Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 7 Sep 2023 09:55:46 -0400 Subject: [PATCH 6/8] pip: bump antlr4-python3-runtime from 4.13.0 to 4.13.1 (#191) Bumps [antlr4-python3-runtime]() from 4.13.0 to 4.13.1. Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pip-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pip-requirements.txt b/pip-requirements.txt index e59320a875..0e3266db7d 100644 --- a/pip-requirements.txt +++ b/pip-requirements.txt @@ -15,5 +15,5 @@ edk2-pytool-library==0.17.0 edk2-pytool-extensions==0.24.0 edk2-basetools==0.1.49 -antlr4-python3-runtime==4.13.0 +antlr4-python3-runtime==4.13.1 regex From 27a94fcadd03665ba30168456e7b96d0a28bbf52 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 13 Sep 2023 10:08:13 -0400 Subject: [PATCH 7/8] pip: bump edk2-pytool-extensions from 0.24.0 to 0.24.1 (#193) Bumps [edk2-pytool-extensions](https://github.com/tianocore/edk2-pytool-extensions) from 0.24.0 to 0.24.1. Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pip-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pip-requirements.txt b/pip-requirements.txt index 0e3266db7d..fcab8967e7 100644 --- a/pip-requirements.txt +++ b/pip-requirements.txt @@ -13,7 +13,7 @@ ## edk2-pytool-library==0.17.0 -edk2-pytool-extensions==0.24.0 +edk2-pytool-extensions==0.24.1 edk2-basetools==0.1.49 antlr4-python3-runtime==4.13.1 regex From 2e42b2efc6468dbabe2002c4afd575a570a3fae4 Mon Sep 17 00:00:00 2001 From: "Project Mu UEFI Bot [bot]" <45776386+uefibot@users.noreply.github.com> Date: Mon, 18 Sep 2023 15:09:13 -0400 Subject: [PATCH 8/8] Repo File Sync: Update CodeQL GitHub workflow (#194) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit synced local file(s) with [microsoft/mu_devops](https://github.com/microsoft/mu_devops). 🤖: View the [Repo File Sync Configuration File](https://github.com/microsoft/mu_devops/blob/main/.sync/Files.yml) to see how files are synced. --- This PR was created automatically by the [repo-file-sync-action](https://github.com/BetaHuhn/repo-file-sync-action) workflow run [#6225301088](https://github.com/microsoft/mu_devops/actions/runs/6225301088) Signed-off-by: Project Mu UEFI Bot --- .github/workflows/codeql.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 41c6770061..466bda220b 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -342,6 +342,29 @@ jobs: STUART_CODEQL_PATH: ${{ steps.cache_key_gen.outputs.codeql_cli_ext_dep_dir }} run: stuart_ci_build -c .pytool/CISettings.py -t DEBUG -p ${{ matrix.package }} -a ${{ matrix.archs }} TOOL_CHAIN_TAG=${{ matrix.tool_chain_tag }} --codeql + - name: Build Cleanup + id: build_cleanup + shell: python + run: | + import os + import shutil + from pathlib import Path + + dirs_to_delete = ['ia32', 'x64', 'arm', 'aarch64'] + + def delete_dirs(path: Path): + if path.exists() and path.is_dir(): + if path.name.lower() in dirs_to_delete: + print(f'Removed {str(path)}') + shutil.rmtree(path) + return + + for child_dir in path.iterdir(): + delete_dirs(child_dir) + + build_path = Path(os.environ['GITHUB_WORKSPACE'], 'Build') + delete_dirs(build_path) + - name: Upload Build Logs As An Artifact uses: actions/upload-artifact@v3 if: success() || failure()