summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Grimes <paul.grimes@amd.com>2025-09-10 18:53:38 +0300
committerPaul Grimes <70298761+pbgrimes@users.noreply.github.com>2025-09-10 19:12:33 +0300
commit4a77f3c4d21fdaef8b62eadf38e7afe41e856556 (patch)
tree9a59038bd88aa2b1d1bd6e3ac2514b9853b9ce42
parent0ce443ec1e50c140ec5b71e8bad13d055417a922 (diff)
downloadedk2-platforms-master.tar.xz
Remove Overrides for AMD Server "Genoa" PlatformsHEADmaster
Removing edk2 override files from code for AMD server "Genoa" platforms. Going forward, any required overrides to tianocore/edk2 will be implemented in AMD's NDA AGESA code and will be considered temporary. Temporary overrides will be removed from AMD's NDA AGESA code once changes that eliminate the need for an override are upstreamed to tianocore/edk2. Temporary overrides for Turin can be found in the 1.0.0.7 Turin AGESA PI Package. Note: A similar change and policy will be implemented for AMD embedded platforms. Signed-off-by: Paul Grimes <paul.grimes@amd.com>
-rw-r--r--Platform/AMD/GenoaBoard/Override/edk2-platforms/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeTestPointCheckLib.c1315
-rw-r--r--Platform/AMD/GenoaBoard/Override/edk2/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBot.h194
-rw-r--r--Platform/AMD/GenoaBoard/Override/edk2/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassImpl.c1137
-rw-r--r--Platform/AMD/GenoaBoard/Override/edk2/MdePkg/Library/SmmPciExpressLib/SmmPciExpressLib.inf43
4 files changed, 0 insertions, 2689 deletions
diff --git a/Platform/AMD/GenoaBoard/Override/edk2-platforms/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeTestPointCheckLib.c b/Platform/AMD/GenoaBoard/Override/edk2-platforms/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeTestPointCheckLib.c
deleted file mode 100644
index fb00356012..0000000000
--- a/Platform/AMD/GenoaBoard/Override/edk2-platforms/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeTestPointCheckLib.c
+++ /dev/null
@@ -1,1315 +0,0 @@
-/**
- Copyright (C) 2023-2025 Advanced Micro Devices, Inc. All rights reserved.
-**/
-
-/** @file
-Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <Uefi.h>
-#include <PiDxe.h>
-#include <Library/TestPointCheckLib.h>
-#include <Library/TestPointLib.h>
-#include <Library/DebugLib.h>
-#include <Library/UefiLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/SafeIntLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <IndustryStandard/Acpi.h>
-#include <IndustryStandard/DmaRemappingReportingTable.h>
-#include <IndustryStandard/WindowsSmmSecurityMitigationTable.h>
-#include <Protocol/SmmCommunication.h>
-#include <Guid/MemoryAttributesTable.h>
-#include <Guid/PiSmmCommunicationRegionTable.h>
-
-#include "TestPointInternal.h"
-
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID mTestPointSmmCommunciationGuid = TEST_POINT_SMM_COMMUNICATION_GUID;
-
-VOID
-TestPointDumpGcd (
- OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR **GcdMemoryMap, OPTIONAL
- OUT UINTN *GcdMemoryMapNumberOfDescriptors, OPTIONAL
- OUT EFI_GCD_IO_SPACE_DESCRIPTOR **GcdIoMap, OPTIONAL
- OUT UINTN *GcdIoMapNumberOfDescriptors, OPTIONAL
- IN BOOLEAN DumpPrint
- );
-
-VOID
-TestPointDumpUefiMemoryMap (
- OUT EFI_MEMORY_DESCRIPTOR **UefiMemoryMap, OPTIONAL
- OUT UINTN *UefiMemoryMapSize, OPTIONAL
- OUT UINTN *UefiDescriptorSize, OPTIONAL
- IN BOOLEAN DumpPrint
- );
-
-EFI_STATUS
-TestPointCheckUefiMemoryMap (
- VOID
- );
-
-EFI_STATUS
-TestPointCheckUefiMemAttribute (
- VOID
- );
-
-EFI_STATUS
-TestPointCheckPciResource (
- VOID
- );
-
-EFI_STATUS
-TestPointCheckConsoleVariable (
- VOID
- );
-
-EFI_STATUS
-TestPointCheckBootVariable (
- VOID
- );
-
-VOID
-TestPointDumpDevicePath (
- VOID
- );
-
-EFI_STATUS
-TestPointCheckMemoryTypeInformation (
- VOID
- );
-
-EFI_STATUS
-TestPointCheckAcpi (
- VOID
- );
-
-EFI_STATUS
-TestPointCheckAcpiGcdResource (
- VOID
- );
-
-EFI_STATUS
-TestPointCheckHsti (
- VOID
- );
-
-VOID
-TestPointDumpVariable (
- VOID
- );
-
-EFI_STATUS
-TestPointCheckEsrt (
- VOID
- );
-
-EFI_STATUS
-TestPointCheckSmmInfo (
- VOID
- );
-
-EFI_STATUS
-TestPointCheckPciBusMaster (
- VOID
- );
-
-EFI_STATUS
-TestPointCheckLoadedImage (
- VOID
- );
-
-EFI_STATUS
-EFIAPI
-TestPointCheckSmiHandlerInstrument (
- VOID
- );
-
-EFI_STATUS
-TestPointCheckUefiSecureBoot (
- VOID
- );
-
-EFI_STATUS
-TestPointCheckPiSignedFvBoot (
- VOID
- );
-
-EFI_STATUS
-TestPointCheckTcgTrustedBoot (
- VOID
- );
-
-EFI_STATUS
-TestPointCheckTcgMor (
- VOID
- );
-
-EFI_STATUS
-TestPointVtdEngine (
- VOID
- );
-
-VOID *
-TestPointGetAcpi (
- IN UINT32 Signature
- );
-
-GLOBAL_REMOVE_IF_UNREFERENCED ADAPTER_INFO_PLATFORM_TEST_POINT_STRUCT mTestPointStruct = {
- PLATFORM_TEST_POINT_VERSION,
- PLATFORM_TEST_POINT_ROLE_PLATFORM_IBV,
- {TEST_POINT_IMPLEMENTATION_ID_PLATFORM_DXE},
- TEST_POINT_FEATURE_SIZE,
- {0}, // FeaturesImplemented
- {0}, // FeaturesVerified
- 0,
-};
-
-GLOBAL_REMOVE_IF_UNREFERENCED UINT8 mFeatureImplemented[TEST_POINT_FEATURE_SIZE];
-
-/**
- This service verifies bus master enable (BME) is disabled after PCI enumeration.
-
- Test subject: PCI device BME.
- Test overview: Verify BME is cleared.
- Reporting mechanism: Set ADAPTER_INFO_PLATFORM_TEST_POINT_STRUCT.
- Dumps results to the debug log.
-
- @retval EFI_SUCCESS The test point check was performed successfully.
- @retval EFI_UNSUPPORTED The test point check is not supported on this platform.
-**/
-EFI_STATUS
-EFIAPI
-TestPointPciEnumerationDonePciBusMasterDisabled (
- VOID
- )
-{
- EFI_STATUS Status;
- BOOLEAN Result;
-
- if ((mFeatureImplemented[3] & TEST_POINT_BYTE3_PCI_ENUMERATION_DONE_BUS_MASTER_DISABLED) == 0) {
- return EFI_SUCCESS;
- }
-
- DEBUG ((DEBUG_INFO, "======== TestPointPciEnumerationDonePciBusMasterDisabled - Enter\n"));
-
- Result = TRUE;
- Status = TestPointCheckPciBusMaster ();
- if (EFI_ERROR(Status)) {
- Result = FALSE;
- }
-
- if (Result) {
- TestPointLibSetFeaturesVerified (
- PLATFORM_TEST_POINT_ROLE_PLATFORM_IBV,
- NULL,
- 3,
- TEST_POINT_BYTE3_PCI_ENUMERATION_DONE_BUS_MASTER_DISABLED
- );
- }
-
- DEBUG ((DEBUG_INFO, "======== TestPointPciEnumerationDonePciBusMasterDisabled - Exit\n"));
- return EFI_SUCCESS;
-}
-
-/**
- This service verifies PCI device resource assignment after PCI enumeration.
-
- Test subject: PCI device resources.
- Test overview: Verify all PCI devices have been assigned proper resources.
- Reporting mechanism: Set ADAPTER_INFO_PLATFORM_TEST_POINT_STRUCT.
- Dumps PCI resource assignments to the debug log.
-
- @retval EFI_SUCCESS The test point check was performed successfully.
- @retval EFI_UNSUPPORTED The test point check is not supported on this platform.
-**/
-EFI_STATUS
-EFIAPI
-TestPointPciEnumerationDonePciResourceAllocated (
- VOID
- )
-{
- EFI_STATUS Status;
- BOOLEAN Result;
-
- if ((mFeatureImplemented[3] & TEST_POINT_BYTE3_PCI_ENUMERATION_DONE_RESOURCE_ALLOCATED) == 0) {
- return EFI_SUCCESS;
- }
-
- DEBUG ((DEBUG_INFO, "======== TestPointPciEnumerationDonePciResourceAllocated - Enter\n"));
-
- Result = TRUE;
- Status = TestPointCheckPciResource ();
- if (EFI_ERROR(Status)) {
- Result = FALSE;
- }
-
- if (Result) {
- TestPointLibSetFeaturesVerified (
- PLATFORM_TEST_POINT_ROLE_PLATFORM_IBV,
- NULL,
- 3,
- TEST_POINT_BYTE3_PCI_ENUMERATION_DONE_RESOURCE_ALLOCATED
- );
- }
-
- DEBUG ((DEBUG_INFO, "======== TestPointPciEnumerationDonePciResourceAllocated - Exit\n"));
- return EFI_SUCCESS;
-}
-
-/**
- This service verifies the DMA ACPI table is reported at the end of DXE.
-
- Test subject: DMA protection.
- Test overview: DMA ACPI table is reported.
- Reporting mechanism: Set ADAPTER_INFO_PLATFORM_TEST_POINT_STRUCT.
- Dumps the DMA ACPI table to the debug log.
-
- @retval EFI_SUCCESS The test point check was performed successfully.
- @retval EFI_UNSUPPORTED The test point check is not supported on this platform.
-**/
-EFI_STATUS
-EFIAPI
-TestPointEndOfDxeDmaAcpiTableFunctional (
- VOID
- )
-{
- EFI_STATUS Status;
- VOID *Acpi;
-
- if ((mFeatureImplemented[3] & TEST_POINT_BYTE3_END_OF_DXE_DMA_ACPI_TABLE_FUNCTIONAL) == 0) {
- return EFI_SUCCESS;
- }
-
- DEBUG ((DEBUG_INFO, "======== TestPointEndOfDxeDmaAcpiTableFunctional - Enter\n"));
-
- Acpi = TestPointGetAcpi (EFI_ACPI_6_5_DMA_REMAPPING_TABLE_SIGNATURE);
- if (Acpi == NULL) {
- DEBUG ((DEBUG_ERROR, "No DMAR table\n"));
- TestPointLibAppendErrorString (
- PLATFORM_TEST_POINT_ROLE_PLATFORM_IBV,
- NULL,
- TEST_POINT_BYTE3_END_OF_DXE_DMA_ACPI_TABLE_FUNCTIONAL_ERROR_CODE \
- TEST_POINT_END_OF_DXE \
- TEST_POINT_BYTE3_END_OF_DXE_DMA_ACPI_TABLE_FUNCTIONAL_ERROR_STRING
- );
- Status = EFI_INVALID_PARAMETER;
- } else {
- TestPointLibSetFeaturesVerified (
- PLATFORM_TEST_POINT_ROLE_PLATFORM_IBV,
- NULL,
- 3,
- TEST_POINT_BYTE3_END_OF_DXE_DMA_ACPI_TABLE_FUNCTIONAL
- );
- Status = EFI_SUCCESS;
- }
-
- DEBUG ((DEBUG_INFO, "======== TestPointEndOfDxeDmaAcpiTableFunctional - Exit\n"));
- return Status;
-}
-
-/**
- This service verifies DMA protection configuration at the end of DXE.
-
- Test subject: DMA protection.
- Test overview: DMA protection in DXE.
- Reporting mechanism: Set ADAPTER_INFO_PLATFORM_TEST_POINT_STRUCT.
- Dumps the DMA ACPI table to the debug log.
-
- @retval EFI_SUCCESS The test point check was performed successfully.
- @retval EFI_UNSUPPORTED The test point check is not supported on this platform.
-**/
-EFI_STATUS
-EFIAPI
-TestPointEndOfDxeDmaProtectionEnabled (
- VOID
- )
-{
- EFI_STATUS Status;
- BOOLEAN Result;
-
- if ((mFeatureImplemented[3] & TEST_POINT_BYTE3_END_OF_DXE_DMA_PROTECTION_ENABLED) == 0) {
- return EFI_SUCCESS;
- }
-
- DEBUG ((DEBUG_INFO, "======== TestPointEndOfDxeDmaProtectionEnabled - Enter\n"));
-
- Result = TRUE;
- Status = TestPointVtdEngine ();
- if (EFI_ERROR(Status)) {
- Result = FALSE;
- }
-
- if (Result) {
- TestPointLibSetFeaturesVerified (
- PLATFORM_TEST_POINT_ROLE_PLATFORM_IBV,
- NULL,
- 3,
- TEST_POINT_BYTE3_END_OF_DXE_DMA_PROTECTION_ENABLED
- );
- }
-
- DEBUG ((DEBUG_INFO, "======== TestPointEndOfDxeDmaProtectionEnabled - Exit\n"));
- return EFI_SUCCESS;
-}
-
-/**
- This service verifies no 3rd party PCI option ROMs (OPROMs) were dispatched prior to the end of DXE.
-
- Test subject: 3rd party OPROMs.
- Test overview: Verify no 3rd party PCI OPROMs were .
- Reporting mechanism: Set ADAPTER_INFO_PLATFORM_TEST_POINT_STRUCT.
- Dumps PCI resource assignments to the debug log.
-
- @retval EFI_SUCCESS The test point check was performed successfully.
- @retval EFI_UNSUPPORTED The test point check is not supported on this platform.
-**/
-EFI_STATUS
-EFIAPI
-TestPointEndOfDxeNoThirdPartyPciOptionRom (
- VOID
- )
-{
- EFI_STATUS Status;
- BOOLEAN Result;
-
- if ((mFeatureImplemented[3] & TEST_POINT_BYTE3_END_OF_DXE_NO_THIRD_PARTY_PCI_OPTION_ROM) == 0) {
- return EFI_SUCCESS;
- }
-
- DEBUG ((DEBUG_INFO, "======== TestPointEndOfDxeNoThirdPartyPciOptionRom - Enter\n"));
-
- Result = TRUE;
- Status = TestPointCheckLoadedImage ();
- if (EFI_ERROR(Status)) {
- Result = FALSE;
- }
-
- if (Result) {
- TestPointLibSetFeaturesVerified (
- PLATFORM_TEST_POINT_ROLE_PLATFORM_IBV,
- NULL,
- 3,
- TEST_POINT_BYTE3_END_OF_DXE_NO_THIRD_PARTY_PCI_OPTION_ROM
- );
- }
-
- DEBUG ((DEBUG_INFO, "======== TestPointEndOfDxeNoThirdPartyPciOptionRom - Exit\n"));
- return EFI_SUCCESS;
-}
-
-/**
- This service verifies the validity of System Management RAM (SMRAM) alignment at SMM Ready To Lock.
-
- Test subject: SMRAM Information.
- Test overview: SMRAM is aligned.
- Reporting mechanism: Set ADAPTER_INFO_PLATFORM_TEST_POINT_STRUCT.
- Dumps the SMRAM region table to the debug log.
-
- @retval EFI_SUCCESS The test point check was performed successfully.
- @retval EFI_UNSUPPORTED The test point check is not supported on this platform.
-**/
-EFI_STATUS
-EFIAPI
-TestPointDxeSmmReadyToLockSmramAligned (
- VOID
- )
-{
- EFI_STATUS Status;
- BOOLEAN Result;
-
- if ((mFeatureImplemented[7] & TEST_POINT_BYTE7_DXE_SMM_READY_TO_LOCK_SMRAM_ALIGNED) == 0) {
- return EFI_SUCCESS;
- }
-
- DEBUG ((DEBUG_INFO, "======== TestPointDxeSmmReadyToLockSmramAligned - Enter\n"));
-
- Result = TRUE;
- Status = TestPointCheckSmmInfo ();
- if (EFI_ERROR(Status)) {
- Result = FALSE;
- }
-
- if (Result) {
- TestPointLibSetFeaturesVerified (
- PLATFORM_TEST_POINT_ROLE_PLATFORM_IBV,
- NULL,
- 7,
- TEST_POINT_BYTE7_DXE_SMM_READY_TO_LOCK_SMRAM_ALIGNED
- );
- }
-
- DEBUG ((DEBUG_INFO, "======== TestPointDxeSmmReadyToLockSmramAligned - Exit\n"));
- return EFI_SUCCESS;
-}
-
-/**
- This service verifies the validity of the Windows SMM Security Mitigation Table (WSMT) at SMM Ready To Lock.
-
- Test subject: Windows Security SMM Mitigation Table.
- Test overview: The table is reported in compliance with the Windows SMM Security Mitigations Table
- ACPI table specification.
- Reporting mechanism: Set ADAPTER_INFO_PLATFORM_TEST_POINT_STRUCT.
- Dumps the WSMT to the debug log.
-
- @retval EFI_SUCCESS The test point check was performed successfully.
- @retval EFI_UNSUPPORTED The test point check is not supported on this platform.
-**/
-EFI_STATUS
-EFIAPI
-TestPointDxeSmmReadyToLockWsmtTableFunctional (
- VOID
- )
-{
- EFI_STATUS Status;
- VOID *Acpi;
-
- if ((mFeatureImplemented[7] & TEST_POINT_BYTE7_DXE_SMM_READY_TO_LOCK_WSMT_TABLE_FUNCTIONAL) == 0) {
- return EFI_SUCCESS;
- }
-
- DEBUG ((DEBUG_INFO, "======== TestPointDxeSmmReadyToLockWsmtTableFunctional - Enter\n"));
-
- Acpi = TestPointGetAcpi (EFI_ACPI_WINDOWS_SMM_SECURITY_MITIGATION_TABLE_SIGNATURE);
- if (Acpi == NULL) {
- DEBUG ((DEBUG_ERROR, "No WSMT table\n"));
- TestPointLibAppendErrorString (
- PLATFORM_TEST_POINT_ROLE_PLATFORM_IBV,
- NULL,
- TEST_POINT_BYTE7_DXE_SMM_READY_TO_LOCK_WSMT_TABLE_FUNCTIONAL_ERROR_CODE \
- TEST_POINT_DXE_SMM_READY_TO_LOCK \
- TEST_POINT_BYTE7_DXE_SMM_READY_TO_LOCK_WSMT_TABLE_FUNCTIONAL_ERROR_STRING
- );
- Status = EFI_INVALID_PARAMETER;
- } else {
- TestPointLibSetFeaturesVerified (
- PLATFORM_TEST_POINT_ROLE_PLATFORM_IBV,
- NULL,
- 7,
- TEST_POINT_BYTE7_DXE_SMM_READY_TO_LOCK_WSMT_TABLE_FUNCTIONAL
- );
- Status = EFI_SUCCESS;
- }
-
- DEBUG ((DEBUG_INFO, "======== TestPointDxeSmmReadyToLockWsmtTableFunctional - Exit\n"));
- return Status;
-}
-
-/**
- This service verifies the validity of the SMM page table at Ready To Boot.
-
- Test subject: SMM page table.
- Test overview: The SMM page table settings matches the SmmMemoryAttribute table.
- Reporting mechanism: Set ADAPTER_INFO_PLATFORM_TEST_POINT_STRUCT.
- Reports an error if verification fails.
-
- @retval EFI_SUCCESS The test point check was performed successfully.
- @retval EFI_UNSUPPORTED The test point check is not supported on this platform.
-**/
-EFI_STATUS
-EFIAPI
-TestPointDxeSmmReadyToBootSmmPageProtection (
- VOID
- )
-{
- EFI_MEMORY_DESCRIPTOR *UefiMemoryMap;
- UINTN UefiMemoryMapSize;
- UINTN UefiDescriptorSize;
- EFI_GCD_MEMORY_SPACE_DESCRIPTOR *GcdMemoryMap;
- EFI_GCD_IO_SPACE_DESCRIPTOR *GcdIoMap;
- UINTN GcdMemoryMapNumberOfDescriptors;
- UINTN GcdIoMapNumberOfDescriptors;
- EFI_MEMORY_ATTRIBUTES_TABLE *MemoryAttributesTable;
- UINTN MemoryAttributesTableSize;
- EFI_STATUS Status;
- UINTN CommSize;
- UINT64 LongCommSize;
- UINT8 *CommBuffer;
- EFI_SMM_COMMUNICATE_HEADER *CommHeader;
- EFI_SMM_COMMUNICATION_PROTOCOL *SmmCommunication;
- UINTN MinimalSizeNeeded;
- EDKII_PI_SMM_COMMUNICATION_REGION_TABLE *PiSmmCommunicationRegionTable;
- UINT32 Index;
- EFI_MEMORY_DESCRIPTOR *Entry;
- UINTN Size;
- TEST_POINT_SMM_COMMUNICATION_UEFI_GCD_MAP_INFO *CommData;
-
- if ((mFeatureImplemented[6] & TEST_POINT_BYTE6_SMM_READY_TO_BOOT_SMM_PAGE_LEVEL_PROTECTION) == 0) {
- return EFI_SUCCESS;
- }
-
- DEBUG ((DEBUG_INFO, "======== TestPointDxeSmmReadyToBootSmmPageProtection - Enter\n"));
-
- TestPointDumpUefiMemoryMap (&UefiMemoryMap, &UefiMemoryMapSize, &UefiDescriptorSize, FALSE);
- TestPointDumpGcd (&GcdMemoryMap, &GcdMemoryMapNumberOfDescriptors, &GcdIoMap, &GcdIoMapNumberOfDescriptors, FALSE);
-
- MemoryAttributesTable = NULL;
- MemoryAttributesTableSize = 0;
- Status = EfiGetSystemConfigurationTable (&gEfiMemoryAttributesTableGuid, (VOID **)&MemoryAttributesTable);
- if (!EFI_ERROR (Status)) {
- MemoryAttributesTableSize = sizeof(EFI_MEMORY_ATTRIBUTES_TABLE) + MemoryAttributesTable->DescriptorSize * MemoryAttributesTable->NumberOfEntries;
- }
-
- Status = gBS->LocateProtocol(&gEfiSmmCommunicationProtocolGuid, NULL, (VOID **)&SmmCommunication);
- if (EFI_ERROR(Status)) {
- DEBUG ((DEBUG_INFO, "TestPointDxeSmmReadyToBootSmmPageProtection: Locate SmmCommunication protocol - %r\n", Status));
- return EFI_SUCCESS;
- }
-
- MinimalSizeNeeded = OFFSET_OF(EFI_SMM_COMMUNICATE_HEADER, Data) +
- sizeof(TEST_POINT_SMM_COMMUNICATION_UEFI_GCD_MAP_INFO) +
- UefiMemoryMapSize +
- GcdMemoryMapNumberOfDescriptors * sizeof(EFI_GCD_MEMORY_SPACE_DESCRIPTOR) +
- GcdIoMapNumberOfDescriptors * sizeof(EFI_GCD_IO_SPACE_DESCRIPTOR) +
- MemoryAttributesTableSize;
-
- Status = EfiGetSystemConfigurationTable(
- &gEdkiiPiSmmCommunicationRegionTableGuid,
- (VOID **)&PiSmmCommunicationRegionTable
- );
- if (EFI_ERROR(Status)) {
- DEBUG ((DEBUG_INFO, "TestPointDxeSmmReadyToBootSmmPageProtection: Get PiSmmCommunicationRegionTable - %r\n", Status));
- return EFI_SUCCESS;
- }
- 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);
- }
- // EDKII_BIOS_OVERRIDE START
- // WA, REVISIT disable the assert
- // ASSERT(Index < PiSmmCommunicationRegionTable->NumberOfEntries);
- // EDKII_BIOS_OVERRIDE END
-
- CommBuffer = (UINT8 *)(UINTN)Entry->PhysicalStart;
-
- CommHeader = (EFI_SMM_COMMUNICATE_HEADER *)&CommBuffer[0];
- CopyMem(&CommHeader->HeaderGuid, &mTestPointSmmCommunciationGuid, sizeof(mTestPointSmmCommunciationGuid));
- CommHeader->MessageLength = MinimalSizeNeeded - OFFSET_OF(EFI_SMM_COMMUNICATE_HEADER, Data);
-
- CommData = (TEST_POINT_SMM_COMMUNICATION_UEFI_GCD_MAP_INFO *)&CommBuffer[OFFSET_OF(EFI_SMM_COMMUNICATE_HEADER, Data)];
- CommData->Header.Version = TEST_POINT_SMM_COMMUNICATION_VERSION;
- CommData->Header.FuncId = TEST_POINT_SMM_COMMUNICATION_FUNC_ID_UEFI_GCD_MAP_INFO;
- CommData->Header.Size = CommHeader->MessageLength;
- CommData->UefiMemoryMapOffset = sizeof(TEST_POINT_SMM_COMMUNICATION_UEFI_GCD_MAP_INFO);
- CommData->UefiMemoryMapSize = UefiMemoryMapSize;
- CommData->GcdMemoryMapOffset = CommData->UefiMemoryMapOffset + CommData->UefiMemoryMapSize;
- CommData->GcdMemoryMapSize = GcdMemoryMapNumberOfDescriptors * sizeof(EFI_GCD_MEMORY_SPACE_DESCRIPTOR);
- CommData->GcdIoMapOffset = CommData->GcdMemoryMapOffset + CommData->GcdMemoryMapSize;
- CommData->GcdIoMapSize = GcdIoMapNumberOfDescriptors * sizeof(EFI_GCD_IO_SPACE_DESCRIPTOR);
- CommData->UefiMemoryAttributeTableOffset = CommData->GcdIoMapOffset + CommData->GcdIoMapSize;
- CommData->UefiMemoryAttributeTableSize = MemoryAttributesTableSize;
-
- CopyMem (
- (VOID *)(UINTN)((UINTN)CommData + CommData->UefiMemoryMapOffset),
- UefiMemoryMap,
- (UINTN)CommData->UefiMemoryMapSize
- );
- CopyMem (
- (VOID *)(UINTN)((UINTN)CommData + CommData->GcdMemoryMapOffset),
- GcdMemoryMap,
- (UINTN)CommData->GcdMemoryMapSize
- );
- CopyMem (
- (VOID *)(UINTN)((UINTN)CommData + CommData->GcdIoMapOffset),
- GcdIoMap,
- (UINTN)CommData->GcdIoMapSize
- );
- CopyMem (
- (VOID *)(UINTN)((UINTN)CommData + CommData->UefiMemoryAttributeTableOffset),
- MemoryAttributesTable,
- (UINTN)CommData->UefiMemoryAttributeTableSize
- );
-
- Status = SafeUint64Add (OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data), CommHeader->MessageLength, &LongCommSize);
- if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_INFO, "TestPointDxeSmmReadyToBootSmmPageProtection: LongCommSize calculation - %r\n", Status));
- return EFI_SUCCESS;
- }
-
- Status = SafeUint64ToUintn (LongCommSize, &CommSize);
- if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_INFO, "TestPointDxeSmmReadyToBootSmmPageProtection: CommSize conversion - %r\n", Status));
- return EFI_SUCCESS;
- }
-
- Status = SmmCommunication->Communicate(SmmCommunication, CommBuffer, &CommSize);
- if (EFI_ERROR(Status)) {
- DEBUG ((DEBUG_INFO, "TestPointDxeSmmReadyToBootSmmPageProtection: SmmCommunication - %r\n", Status));
- return EFI_SUCCESS;
- }
-
- DEBUG ((DEBUG_INFO, "======== TestPointDxeSmmReadyToBootSmmPageProtection - Exit\n"));
- return EFI_SUCCESS;
-}
-
-/**
- This service verifies SMI handler profiling.
-
- Test subject: SMI handler profiling.
- Test overview:
- Reporting mechanism: Set ADAPTER_INFO_PLATFORM_TEST_POINT_STRUCT.
- Dumps the SMI handler profile.
-
- @retval EFI_SUCCESS The test point check was performed successfully.
- @retval EFI_UNSUPPORTED The test point check is not supported on this platform.
-**/
-EFI_STATUS
-EFIAPI
-TestPointDxeSmmReadyToBootSmiHandlerInstrument (
- VOID
- )
-{
- EFI_STATUS Status;
- BOOLEAN Result;
-
- if ((mFeatureImplemented[7] & TEST_POINT_BYTE7_DXE_SMM_READY_TO_BOOT_SMI_HANDLER_INSTRUMENT) == 0) {
- return EFI_SUCCESS;
- }
-
- DEBUG ((DEBUG_INFO, "======== TestPointDxeSmmReadyToBootSmiHandlerInstrument - Enter\n"));
-
- Result = TRUE;
- Status = TestPointCheckSmiHandlerInstrument ();
- if (EFI_ERROR(Status)) {
- Result = FALSE;
- }
-
- if (Result) {
- TestPointLibSetFeaturesVerified (
- PLATFORM_TEST_POINT_ROLE_PLATFORM_IBV,
- NULL,
- 7,
- TEST_POINT_BYTE7_DXE_SMM_READY_TO_BOOT_SMI_HANDLER_INSTRUMENT
- );
- }
-
- DEBUG ((DEBUG_INFO, "======== TestPointDxeSmmReadyToBootSmiHandlerInstrument - Exit\n"));
- return EFI_SUCCESS;
-}
-
-/**
- This services verifies the validity of installed ACPI tables at Ready To Boot.
-
- Test subject: ACPI tables.
- Test overview: The ACPI table settings are valid.
- Reporting mechanism: Set ADAPTER_INFO_PLATFORM_TEST_POINT_STRUCT.
- Dumps the installed ACPI tables.
-
- @retval EFI_SUCCESS The test point check was performed successfully.
- @retval EFI_UNSUPPORTED The test point check is not supported on this platform.
-**/
-EFI_STATUS
-EFIAPI
-TestPointReadyToBootAcpiTableFunctional (
- VOID
- )
-{
- EFI_STATUS Status;
- BOOLEAN Result;
-
- if ((mFeatureImplemented[4] & TEST_POINT_BYTE4_READY_TO_BOOT_ACPI_TABLE_FUNCTIONAL) == 0) {
- return EFI_SUCCESS;
- }
-
- DEBUG ((DEBUG_INFO, "======== TestPointReadyToBootAcpiTableFunctional - Enter\n"));
-
- Result = TRUE;
- Status = TestPointCheckAcpi ();
- if (EFI_ERROR(Status)) {
- Result = FALSE;
- }
-
- if (Result) {
- TestPointLibSetFeaturesVerified (
- PLATFORM_TEST_POINT_ROLE_PLATFORM_IBV,
- NULL,
- 4,
- TEST_POINT_BYTE4_READY_TO_BOOT_ACPI_TABLE_FUNCTIONAL
- );
- }
-
- DEBUG ((DEBUG_INFO, "======== TestPointReadyToBootAcpiTableFunctional - Exit\n"));
- return EFI_SUCCESS;
-}
-
-/**
- This services verifies ACPI table resources are in the GCD.
-
- Test subject: ACPI memory resources.
- Test overview: Memory resources are in both ACPI and GCD.
- Reporting mechanism: Set ADAPTER_INFO_PLATFORM_TEST_POINT_STRUCT.
- Dumps the installed ACPI tables and GCD.
-
- @retval EFI_SUCCESS The test point check was performed successfully.
- @retval EFI_UNSUPPORTED The test point check is not supported on this platform.
-**/
-EFI_STATUS
-EFIAPI
-TestPointReadyToBootGcdResourceFunctional (
- VOID
- )
-{
- EFI_STATUS Status;
- BOOLEAN Result;
-
- if ((mFeatureImplemented[4] & TEST_POINT_BYTE4_READY_TO_BOOT_GCD_RESOURCE_FUNCTIONAL) == 0) {
- return EFI_SUCCESS;
- }
-
- DEBUG ((DEBUG_INFO, "======== TestPointReadyToBootGcdResourceFunctional - Enter\n"));
-
- Result = TRUE;
- Status = TestPointCheckAcpiGcdResource ();
- if (EFI_ERROR(Status)) {
- Result = FALSE;
- }
-
- if (Result) {
- TestPointLibSetFeaturesVerified (
- PLATFORM_TEST_POINT_ROLE_PLATFORM_IBV,
- NULL,
- 4,
- TEST_POINT_BYTE4_READY_TO_BOOT_GCD_RESOURCE_FUNCTIONAL
- );
- }
-
- DEBUG ((DEBUG_INFO, "======== TestPointReadyToBootGcdResourceFunctional - Exit\n"));
- return EFI_SUCCESS;
-}
-
-/**
- This service verifies the validity of the memory type information settings.
-
- Test subject: Memory type information.
- Test overview: Inspect an verify memory type information is correct.
- Confirm no fragmentation exists in the ACPI/Reserved/Runtime regions.
- Reporting mechanism: Set ADAPTER_INFO_PLATFORM_TEST_POINT_STRUCT.
- Dumps the memory type information settings to the debug log.
-
- @retval EFI_SUCCESS The test point check was performed successfully.
- @retval EFI_UNSUPPORTED The test point check is not supported on this platform.
-**/
-EFI_STATUS
-EFIAPI
-TestPointReadyToBootMemoryTypeInformationFunctional (
- VOID
- )
-{
- EFI_STATUS Status;
- BOOLEAN Result;
-
- if ((mFeatureImplemented[4] & TEST_POINT_BYTE4_READY_TO_BOOT_MEMORY_TYPE_INFORMATION_FUNCTIONAL) == 0) {
- return EFI_SUCCESS;
- }
-
- DEBUG ((DEBUG_INFO, "======== TestPointReadyToBootMemoryTypeInformationFunctional - Enter\n"));
-
- Result = TRUE;
- Status = TestPointCheckMemoryTypeInformation ();
- if (EFI_ERROR(Status)) {
- Result = FALSE;
- }
- TestPointDumpUefiMemoryMap (NULL, NULL, NULL, TRUE);
- Status = TestPointCheckUefiMemoryMap ();
- if (EFI_ERROR(Status)) {
- Result = FALSE;
- }
-
- if (Result) {
- TestPointLibSetFeaturesVerified (
- PLATFORM_TEST_POINT_ROLE_PLATFORM_IBV,
- NULL,
- 4,
- TEST_POINT_BYTE4_READY_TO_BOOT_MEMORY_TYPE_INFORMATION_FUNCTIONAL
- );
- }
-
- DEBUG ((DEBUG_INFO, "======== TestPointReadyToBootMemoryTypeInformationFunctional - Exit\n"));
- return EFI_SUCCESS;
-}
-
-/**
- This service verifies the validity of the memory type information settings.
-
- Test subject: Memory type information.
- Test overview: Inspect an verify memory type information is correct.
- Confirm no fragmentation exists in the ACPI/Reserved/Runtime regions.
- Reporting mechanism: Set ADAPTER_INFO_PLATFORM_TEST_POINT_STRUCT.
- Dumps the memory type information settings to the debug log.
-
- @retval EFI_SUCCESS The test point check was performed successfully.
- @retval EFI_UNSUPPORTED The test point check is not supported on this platform.
-**/
-EFI_STATUS
-EFIAPI
-TestPointReadyToBootUefiMemoryAttributeTableFunctional (
- VOID
- )
-{
- EFI_STATUS Status;
- BOOLEAN Result;
-
- if ((mFeatureImplemented[4] & TEST_POINT_BYTE4_READY_TO_BOOT_UEFI_MEMORY_ATTRIBUTE_TABLE_FUNCTIONAL) == 0) {
- return EFI_SUCCESS;
- }
-
- DEBUG ((DEBUG_INFO, "======== TestPointReadyToBootUefiMemoryAttributeTableFunctional - Enter\n"));
-
- Result = TRUE;
- TestPointDumpUefiMemoryMap (NULL, NULL, NULL, TRUE);
- TestPointDumpGcd (NULL, NULL, NULL, NULL, TRUE);
- Status = TestPointCheckUefiMemAttribute ();
- if (EFI_ERROR(Status)) {
- Result = FALSE;
- }
-
- if (Result) {
- TestPointLibSetFeaturesVerified (
- PLATFORM_TEST_POINT_ROLE_PLATFORM_IBV,
- NULL,
- 4,
- TEST_POINT_BYTE4_READY_TO_BOOT_UEFI_MEMORY_ATTRIBUTE_TABLE_FUNCTIONAL
- );
- }
-
- DEBUG ((DEBUG_INFO, "======== TestPointReadyToBootUefiMemoryAttributeTableFunctional - Exit\n"));
- return EFI_SUCCESS;
-}
-
-/**
- This service verifies the validity of the UEFI memory attribute table.
-
- Test subject: UEFI memory attribute table.
- Test overview: The UEFI memeory attribute table is reported. The image code/data is consistent with the table.
- Reporting mechanism: Set ADAPTER_INFO_PLATFORM_TEST_POINT_STRUCT.
- Dumps the UEFI image information and the UEFI memory attribute table.
-
- @retval EFI_SUCCESS The test point check was performed successfully.
- @retval EFI_UNSUPPORTED The test point check is not supported on this platform.
-**/
-EFI_STATUS
-EFIAPI
-TestPointReadyToBootUefiBootVariableFunctional (
- VOID
- )
-{
- EFI_STATUS Status;
- BOOLEAN Result;
-
- if ((mFeatureImplemented[4] & TEST_POINT_BYTE4_READY_TO_BOOT_UEFI_BOOT_VARIABLE_FUNCTIONAL) == 0) {
- return EFI_SUCCESS;
- }
-
- DEBUG ((DEBUG_INFO, "======== TestPointReadyToBootUefiBootVariableFunctional - Enter\n"));
-
- Result = TRUE;
- TestPointDumpDevicePath ();
- TestPointDumpVariable ();
- Status = TestPointCheckBootVariable ();
- if (EFI_ERROR(Status)) {
- Result = FALSE;
- }
-
- if (Result) {
- TestPointLibSetFeaturesVerified (
- PLATFORM_TEST_POINT_ROLE_PLATFORM_IBV,
- NULL,
- 4,
- TEST_POINT_BYTE4_READY_TO_BOOT_UEFI_BOOT_VARIABLE_FUNCTIONAL
- );
- }
-
- DEBUG ((DEBUG_INFO, "======== TestPointReadyToBootUefiBootVariableFunctional - Exit\n"));
- return EFI_SUCCESS;
-}
-
-/**
- This service verifies the consle variable information.
-
- Test subject: Console.
- Test overview: Inspect and verify the console variable information is correct.
- Reporting mechanism: Set ADAPTER_INFO_PLATFORM_TEST_POINT_STRUCT.
- Dumps the console variable information.
-
- @retval EFI_SUCCESS The test point check was performed successfully.
- @retval EFI_UNSUPPORTED The test point check is not supported on this platform.
-**/
-EFI_STATUS
-EFIAPI
-TestPointReadyToBootUefiConsoleVariableFunctional (
- VOID
- )
-{
- EFI_STATUS Status;
- BOOLEAN Result;
-
- if ((mFeatureImplemented[4] & TEST_POINT_BYTE4_READY_TO_BOOT_UEFI_CONSOLE_VARIABLE_FUNCTIONAL) == 0) {
- return EFI_SUCCESS;
- }
-
- DEBUG ((DEBUG_INFO, "======== TestPointReadyToBootUefiConsoleVariableFunctional - Enter\n"));
-
- Result = TRUE;
- TestPointDumpDevicePath ();
- TestPointDumpVariable ();
- Status = TestPointCheckConsoleVariable ();
- if (EFI_ERROR(Status)) {
- Result = FALSE;
- }
-
- if (Result) {
- TestPointLibSetFeaturesVerified (
- PLATFORM_TEST_POINT_ROLE_PLATFORM_IBV,
- NULL,
- 4,
- TEST_POINT_BYTE4_READY_TO_BOOT_UEFI_CONSOLE_VARIABLE_FUNCTIONAL
- );
- }
-
- DEBUG ((DEBUG_INFO, "======== TestPointReadyToBootUefiConsoleVariableFunctional - Exit\n"));
- return EFI_SUCCESS;
-}
-
-/**
- This service verifies the HSTI table.
-
- Test subject: HSTI table.
- Test overview: Verify the HSTI table is reported.
- Reporting mechanism: Set ADAPTER_INFO_PLATFORM_TEST_POINT_STRUCT.
- Dumps the HSTI table.
-
- @retval EFI_SUCCESS The test point check was performed successfully.
- @retval EFI_UNSUPPORTED The test point check is not supported on this platform.
-**/
-EFI_STATUS
-EFIAPI
-TestPointReadyToBootHstiTableFunctional (
- VOID
- )
-{
- EFI_STATUS Status;
- BOOLEAN Result;
-
- if ((mFeatureImplemented[8] & TEST_POINT_BYTE8_READY_TO_BOOT_HSTI_TABLE_FUNCTIONAL) == 0) {
- return EFI_SUCCESS;
- }
-
- DEBUG ((DEBUG_INFO, "======== TestPointReadyToBootHstiTableFunctional - Enter\n"));
-
- Result = TRUE;
- Status = TestPointCheckHsti ();
- if (EFI_ERROR(Status)) {
- Result = FALSE;
- }
-
- if (Result) {
- TestPointLibSetFeaturesVerified (
- PLATFORM_TEST_POINT_ROLE_PLATFORM_IBV,
- NULL,
- 8,
- TEST_POINT_BYTE8_READY_TO_BOOT_HSTI_TABLE_FUNCTIONAL
- );
- }
-
- DEBUG ((DEBUG_INFO, "======== TestPointReadyToBootHstiTableFunctional - Exit\n"));
- return EFI_SUCCESS;
-}
-
-/**
- This service verifies the ESRT table.
-
- Test subject: ESRT table.
- Test overview: Verify the ESRT table is reported.
- Reporting mechanism: Set ADAPTER_INFO_PLATFORM_TEST_POINT_STRUCT.
- Dumps the ESRT table.
-
- @retval EFI_SUCCESS The test point check was performed successfully.
- @retval EFI_UNSUPPORTED The test point check is not supported on this platform.
-**/
-EFI_STATUS
-EFIAPI
-TestPointReadyToBootEsrtTableFunctional (
- VOID
- )
-{
- EFI_STATUS Status;
- BOOLEAN Result;
-
- if ((mFeatureImplemented[8] & TEST_POINT_BYTE8_READY_TO_BOOT_ESRT_TABLE_FUNCTIONAL) == 0) {
- return EFI_SUCCESS;
- }
-
- DEBUG ((DEBUG_INFO, "======== TestPointReadyToBootEsrtTableFunctional - Enter\n"));
-
- Result = TRUE;
- Status = TestPointCheckEsrt ();
- if (EFI_ERROR(Status)) {
- Result = FALSE;
- }
-
- if (Result) {
- TestPointLibSetFeaturesVerified (
- PLATFORM_TEST_POINT_ROLE_PLATFORM_IBV,
- NULL,
- 8,
- TEST_POINT_BYTE8_READY_TO_BOOT_ESRT_TABLE_FUNCTIONAL
- );
- }
-
- DEBUG ((DEBUG_INFO, "======== TestPointReadyToBootEsrtTableFunctional - Exit\n"));
- return EFI_SUCCESS;
-}
-
-/**
- This service verifies UEFI Secure Boot is enabled.
-
- Test subject: UEFI Secure Boot.
- Test overview: Verify the SecureBoot variable is set.
- Reporting mechanism: Set ADAPTER_INFO_PLATFORM_TEST_POINT_STRUCT.
- Dumps the SecureBoot variable.
-
- @retval EFI_SUCCESS The test point check was performed successfully.
- @retval EFI_UNSUPPORTED The test point check is not supported on this platform.
-**/
-EFI_STATUS
-EFIAPI
-TestPointReadyToBootUefiSecureBootEnabled (
- VOID
- )
-{
- EFI_STATUS Status;
- BOOLEAN Result;
-
- if ((mFeatureImplemented[5] & TEST_POINT_BYTE5_READY_TO_BOOT_UEFI_SECURE_BOOT_ENABLED) == 0) {
- return EFI_SUCCESS;
- }
-
- DEBUG ((DEBUG_INFO, "======== TestPointReadyToBootUefiSecureBootEnabled - Enter\n"));
-
- Result = TRUE;
- Status = TestPointCheckUefiSecureBoot ();
- if (EFI_ERROR(Status)) {
- Result = FALSE;
- }
-
- if (Result) {
- TestPointLibSetFeaturesVerified (
- PLATFORM_TEST_POINT_ROLE_PLATFORM_IBV,
- NULL,
- 5,
- TEST_POINT_BYTE5_READY_TO_BOOT_UEFI_SECURE_BOOT_ENABLED
- );
- }
-
- DEBUG ((DEBUG_INFO, "======== TestPointReadyToBootUefiSecureBootEnabled - Exit\n"));
- return EFI_SUCCESS;
-}
-
-/**
- This service verifies Platform Initialization (PI) Signed FV Boot is enabled.
-
- Test subject: PI Signed FV Boot.
- Test overview: Verify PI signed FV boot is enabled.
- Reporting mechanism: Set ADAPTER_INFO_PLATFORM_TEST_POINT_STRUCT.
-
- @retval EFI_SUCCESS The test point check was performed successfully.
- @retval EFI_UNSUPPORTED The test point check is not supported on this platform.
-**/
-EFI_STATUS
-EFIAPI
-TestPointReadyToBootPiSignedFvBootEnabled (
- VOID
- )
-{
- EFI_STATUS Status;
- BOOLEAN Result;
-
- if ((mFeatureImplemented[5] & TEST_POINT_BYTE5_READY_TO_BOOT_PI_SIGNED_FV_BOOT_ENABLED) == 0) {
- return EFI_SUCCESS;
- }
-
- DEBUG ((DEBUG_INFO, "======== TestPointReadyToBootPiSignedFvBootEnabled - Enter\n"));
-
- Result = TRUE;
- Status = TestPointCheckPiSignedFvBoot ();
- if (EFI_ERROR(Status)) {
- Result = FALSE;
- }
-
- if (Result) {
- TestPointLibSetFeaturesVerified (
- PLATFORM_TEST_POINT_ROLE_PLATFORM_IBV,
- NULL,
- 5,
- TEST_POINT_BYTE5_READY_TO_BOOT_PI_SIGNED_FV_BOOT_ENABLED
- );
- }
-
- DEBUG ((DEBUG_INFO, "======== TestPointReadyToBootPiSignedFvBootEnabled - Exit\n"));
- return EFI_SUCCESS;
-}
-
-/**
- This service verifies TCG Trusted Boot is enabled.
-
- Test subject: TCG Trusted Boot.
- Test overview: Verify the TCG protocol is installed.
- Reporting mechanism: Set ADAPTER_INFO_PLATFORM_TEST_POINT_STRUCT.
- Dumps the TCG protocol capability.
-
- @retval EFI_SUCCESS The test point check was performed successfully.
- @retval EFI_UNSUPPORTED The test point check is not supported on this platform.
-**/
-EFI_STATUS
-EFIAPI
-TestPointReadyToBootTcgTrustedBootEnabled (
- VOID
- )
-{
- EFI_STATUS Status;
- BOOLEAN Result;
-
- if ((mFeatureImplemented[5] & TEST_POINT_BYTE5_READY_TO_BOOT_TCG_TRUSTED_BOOT_ENABLED) == 0) {
- return EFI_SUCCESS;
- }
-
- DEBUG ((DEBUG_INFO, "======== TestPointReadyToBootTcgTrustedBootEnabled - Enter\n"));
-
- Result = TRUE;
- Status = TestPointCheckTcgTrustedBoot ();
- if (EFI_ERROR(Status)) {
- Result = FALSE;
- }
-
- if (Result) {
- TestPointLibSetFeaturesVerified (
- PLATFORM_TEST_POINT_ROLE_PLATFORM_IBV,
- NULL,
- 5,
- TEST_POINT_BYTE5_READY_TO_BOOT_TCG_TRUSTED_BOOT_ENABLED
- );
- }
-
- DEBUG ((DEBUG_INFO, "======== TestPointReadyToBootTcgTrustedBootEnabled - Exit\n"));
- return EFI_SUCCESS;
-}
-
-/**
- This service verifies TCG Memory Overwrite Request (MOR) is enabled.
-
- Test subject: TCG MOR.
- Test overview: Verify the MOR UEFI variable is set.
- Reporting mechanism: Set ADAPTER_INFO_PLATFORM_TEST_POINT_STRUCT.
- Dumps the MOR UEFI variable.
-
- @retval EFI_SUCCESS The test point check was performed successfully.
- @retval EFI_UNSUPPORTED The test point check is not supported on this platform.
-**/
-EFI_STATUS
-EFIAPI
-TestPointReadyToBootTcgMorEnabled (
- VOID
- )
-{
- EFI_STATUS Status;
- BOOLEAN Result;
-
- if ((mFeatureImplemented[5] & TEST_POINT_BYTE5_READY_TO_BOOT_TCG_MOR_ENABLED) == 0) {
- return EFI_SUCCESS;
- }
-
- DEBUG ((DEBUG_INFO, "======== TestPointReadyToBootTcgMorEnabled - Enter\n"));
-
- Result = TRUE;
- Status = TestPointCheckTcgMor ();
- if (EFI_ERROR(Status)) {
- Result = FALSE;
- }
-
- if (Result) {
- TestPointLibSetFeaturesVerified (
- PLATFORM_TEST_POINT_ROLE_PLATFORM_IBV,
- NULL,
- 5,
- TEST_POINT_BYTE5_READY_TO_BOOT_TCG_MOR_ENABLED
- );
- }
-
- DEBUG ((DEBUG_INFO, "======== TestPointReadyToBootTcgMorEnabled - Exit\n"));
- return EFI_SUCCESS;
-}
-
-/**
- This service verifies the system state after Exit Boot Services is invoked.
-
- @retval EFI_SUCCESS The test point check was performed successfully.
-**/
-EFI_STATUS
-EFIAPI
-TestPointExitBootServices (
- VOID
- )
-{
- DEBUG ((DEBUG_INFO, "======== TestPointExitBootServices - Enter\n"));
-
- DEBUG ((DEBUG_INFO, "======== TestPointExitBootServices - Exit\n"));
-
- return EFI_SUCCESS;
-}
-
-/**
- Initialize feature data.
-
- @param[in] Role The test point role being requested.
-**/
-VOID
-InitData (
- IN UINT32 Role
- )
-{
- EFI_STATUS Status;
-
- ASSERT (PcdGetSize(PcdTestPointIbvPlatformFeature) == sizeof(mFeatureImplemented));
- CopyMem (mFeatureImplemented, PcdGetPtr(PcdTestPointIbvPlatformFeature), sizeof(mFeatureImplemented));
-
- mTestPointStruct.Role = Role;
- CopyMem (mTestPointStruct.FeaturesImplemented, mFeatureImplemented, sizeof(mFeatureImplemented));
- Status = TestPointLibSetTable (
- &mTestPointStruct,
- sizeof(mTestPointStruct)
- );
- if (EFI_ERROR (Status)) {
- if (Status != EFI_ALREADY_STARTED) {
- ASSERT_EFI_ERROR (Status);
- }
- }
-}
-
-/**
- The library constructor.
-
- @param ImageHandle The firmware allocated handle for the EFI image.
- @param SystemTable A pointer to the EFI System Table.
-
- @retval EFI_SUCCESS The function always return EFI_SUCCESS.
-**/
-EFI_STATUS
-EFIAPI
-DxeTestPointCheckLibConstructor (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- InitData (PLATFORM_TEST_POINT_ROLE_PLATFORM_IBV);
-
- return EFI_SUCCESS;
-}
diff --git a/Platform/AMD/GenoaBoard/Override/edk2/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBot.h b/Platform/AMD/GenoaBoard/Override/edk2/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBot.h
deleted file mode 100644
index 178ba1e3ce..0000000000
--- a/Platform/AMD/GenoaBoard/Override/edk2/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBot.h
+++ /dev/null
@@ -1,194 +0,0 @@
-/**
- Copyright (C) 2023-2025 Advanced Micro Devices, Inc. All rights reserved.
-**/
-
-/** @file
- Definition for the USB mass storage Bulk-Only Transport protocol,
- based on the "Universal Serial Bus Mass Storage Class Bulk-Only
- Transport" Revision 1.0, September 31, 1999.
-
-Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
-
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _EFI_USBMASS_BOT_H_
-#define _EFI_USBMASS_BOT_H_
-
-extern USB_MASS_TRANSPORT mUsbBotTransport;
-
-//
-// Usb Bulk-Only class specific request
-//
-#define USB_BOT_RESET_REQUEST 0xFF ///< Bulk-Only Mass Storage Reset
-#define USB_BOT_GETLUN_REQUEST 0xFE ///< Get Max Lun
-#define USB_BOT_CBW_SIGNATURE 0x43425355 ///< dCBWSignature, tag the packet as CBW
-#define USB_BOT_CSW_SIGNATURE 0x53425355 ///< dCSWSignature, tag the packet as CSW
-#define USB_BOT_MAX_LUN 0x0F ///< Lun number is from 0 to 15
-#define USB_BOT_MAX_CMDLEN 16 ///< Maximum number of command from command set
-
-//
-// Usb BOT command block status values
-//
-#define USB_BOT_COMMAND_OK 0x00 ///< Command passed, good status
-#define USB_BOT_COMMAND_FAILED 0x01 ///< Command failed
-#define USB_BOT_COMMAND_ERROR 0x02 ///< Phase error, need to reset the device
-
-//
-// Usb Bot retry to get CSW, refers to specification[BOT10-5.3, it says 2 times]
-//
-#define USB_BOT_RECV_CSW_RETRY 3
-
-//
-// Usb Bot wait device reset complete, set by experience
-//
-// AMD_EDKII_OVERRIDE START
-#define USB_BOT_RESET_DEVICE_STALL (60 * USB_MASS_1_SECOND)
-// AMD_EDKII_OVERRIDE END
-
-//
-// Usb Bot transport timeout, set by experience
-//
-#define USB_BOT_SEND_CBW_TIMEOUT (3 * USB_MASS_1_SECOND)
-#define USB_BOT_RECV_CSW_TIMEOUT (3 * USB_MASS_1_SECOND)
-#define USB_BOT_RESET_DEVICE_TIMEOUT (3 * USB_MASS_1_SECOND)
-
-#pragma pack(1)
-///
-/// The CBW (Command Block Wrapper) structures used by the USB BOT protocol.
-///
-typedef struct {
- UINT32 Signature;
- UINT32 Tag;
- UINT32 DataLen; ///< Length of data between CBW and CSW
- UINT8 Flag; ///< Bit 7, 0 ~ Data-Out, 1 ~ Data-In
- UINT8 Lun; ///< Lun number. Bits 0~3 are used
- UINT8 CmdLen; ///< Length of the command. Bits 0~4 are used
- UINT8 CmdBlock[USB_BOT_MAX_CMDLEN];
-} USB_BOT_CBW;
-
-///
-/// The and CSW (Command Status Wrapper) structures used by the USB BOT protocol.
-///
-typedef struct {
- UINT32 Signature;
- UINT32 Tag;
- UINT32 DataResidue;
- UINT8 CmdStatus;
-} USB_BOT_CSW;
-#pragma pack()
-
-typedef struct {
- //
- // Put Interface at the first field to make it easy to distinguish BOT/CBI Protocol instance
- //
- EFI_USB_INTERFACE_DESCRIPTOR Interface;
- EFI_USB_ENDPOINT_DESCRIPTOR *BulkInEndpoint;
- EFI_USB_ENDPOINT_DESCRIPTOR *BulkOutEndpoint;
- UINT32 CbwTag;
- EFI_USB_IO_PROTOCOL *UsbIo;
-} USB_BOT_PROTOCOL;
-
-/**
- Initializes USB BOT protocol.
-
- This function initializes the USB mass storage class BOT protocol.
- It will save its context which is a USB_BOT_PROTOCOL structure
- in the Context if Context isn't NULL.
-
- @param UsbIo The USB I/O Protocol instance
- @param Context The buffer to save the context to
-
- @retval EFI_SUCCESS The device is successfully initialized.
- @retval EFI_UNSUPPORTED The transport protocol doesn't support the device.
- @retval Other The USB BOT initialization fails.
-
-**/
-EFI_STATUS
-UsbBotInit (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- OUT VOID **Context OPTIONAL
- );
-
-/**
- Call the USB Mass Storage Class BOT protocol to issue
- the command/data/status circle to execute the commands.
-
- @param Context The context of the BOT protocol, that is,
- USB_BOT_PROTOCOL
- @param Cmd The high level command
- @param CmdLen The command length
- @param DataDir The direction of the data transfer
- @param Data The buffer to hold data
- @param DataLen The length of the data
- @param Lun The number of logic unit
- @param Timeout The time to wait command
- @param CmdStatus The result of high level command execution
-
- @retval EFI_SUCCESS The command is executed successfully.
- @retval Other Failed to execute command
-
-**/
-EFI_STATUS
-UsbBotExecCommand (
- IN VOID *Context,
- IN VOID *Cmd,
- IN UINT8 CmdLen,
- IN EFI_USB_DATA_DIRECTION DataDir,
- IN VOID *Data,
- IN UINT32 DataLen,
- IN UINT8 Lun,
- IN UINT32 Timeout,
- OUT UINT32 *CmdStatus
- );
-
-/**
- Reset the USB mass storage device by BOT protocol.
-
- @param Context The context of the BOT protocol, that is,
- USB_BOT_PROTOCOL.
- @param ExtendedVerification If FALSE, just issue Bulk-Only Mass Storage Reset request.
- If TRUE, additionally reset parent hub port.
-
- @retval EFI_SUCCESS The device is reset.
- @retval Others Failed to reset the device..
-
-**/
-EFI_STATUS
-UsbBotResetDevice (
- IN VOID *Context,
- IN BOOLEAN ExtendedVerification
- );
-
-/**
- Get the max LUN (Logical Unit Number) of USB mass storage device.
-
- @param Context The context of the BOT protocol, that is, USB_BOT_PROTOCOL
- @param MaxLun Return pointer to the max number of LUN. (e.g. MaxLun=1 means LUN0 and
- LUN1 in all.)
-
- @retval EFI_SUCCESS Max LUN is got successfully.
- @retval Others Fail to execute this request.
-
-**/
-EFI_STATUS
-UsbBotGetMaxLun (
- IN VOID *Context,
- OUT UINT8 *MaxLun
- );
-
-/**
- Clean up the resource used by this BOT protocol.
-
- @param Context The context of the BOT protocol, that is, USB_BOT_PROTOCOL.
-
- @retval EFI_SUCCESS The resource is cleaned up.
-
-**/
-EFI_STATUS
-UsbBotCleanUp (
- IN VOID *Context
- );
-
-#endif
diff --git a/Platform/AMD/GenoaBoard/Override/edk2/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassImpl.c b/Platform/AMD/GenoaBoard/Override/edk2/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassImpl.c
deleted file mode 100644
index 05b531e784..0000000000
--- a/Platform/AMD/GenoaBoard/Override/edk2/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassImpl.c
+++ /dev/null
@@ -1,1137 +0,0 @@
-/**
- Copyright (C) 2023-2025 Advanced Micro Devices, Inc. All rights reserved.
-**/
-
-/** @file
- USB Mass Storage Driver that manages USB Mass Storage Device and produces Block I/O Protocol.
-
-Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
-
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include "UsbMass.h"
-
-#define USB_MASS_TRANSPORT_COUNT 3
-//
-// Array of USB transport interfaces.
-//
-USB_MASS_TRANSPORT *mUsbMassTransport[USB_MASS_TRANSPORT_COUNT] = {
- &mUsbCbi0Transport,
- &mUsbCbi1Transport,
- &mUsbBotTransport,
-};
-
-EFI_DRIVER_BINDING_PROTOCOL gUSBMassDriverBinding = {
- USBMassDriverBindingSupported,
- USBMassDriverBindingStart,
- USBMassDriverBindingStop,
- 0x11,
- NULL,
- NULL
-};
-
-/**
- Reset the block device.
-
- This function implements EFI_BLOCK_IO_PROTOCOL.Reset().
- It resets the block device hardware.
- ExtendedVerification is ignored in this implementation.
-
- @param This Indicates a pointer to the calling context.
- @param ExtendedVerification Indicates that the driver may perform a more exhaustive
- verification operation of the device during reset.
-
- @retval EFI_SUCCESS The block device was reset.
- @retval EFI_DEVICE_ERROR The block device is not functioning correctly and could not be reset.
-
-**/
-EFI_STATUS
-EFIAPI
-UsbMassReset (
- IN EFI_BLOCK_IO_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-{
- USB_MASS_DEVICE *UsbMass;
- EFI_TPL OldTpl;
- EFI_STATUS Status;
-
- //
- // Raise TPL to TPL_CALLBACK to serialize all its operations
- // to protect shared data structures.
- //
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- UsbMass = USB_MASS_DEVICE_FROM_BLOCK_IO (This);
- Status = UsbMass->Transport->Reset (UsbMass->Context, ExtendedVerification);
-
- gBS->RestoreTPL (OldTpl);
-
- return Status;
-}
-
-/**
- Reads the requested number of blocks from the device.
-
- This function implements EFI_BLOCK_IO_PROTOCOL.ReadBlocks().
- It reads the requested number of blocks from the device.
- All the blocks are read, or an error is returned.
-
- @param This Indicates a pointer to the calling context.
- @param MediaId The media ID that the read request is for.
- @param Lba The starting logical block address to read from on the device.
- @param BufferSize The size of the Buffer in bytes.
- This must be a multiple of the intrinsic block size of the device.
- @param Buffer A pointer to the destination buffer for the data. The caller is
- responsible for either having implicit or explicit ownership of the buffer.
-
- @retval EFI_SUCCESS The data was read correctly from the device.
- @retval EFI_DEVICE_ERROR The device reported an error while attempting to perform the read operation.
- @retval EFI_NO_MEDIA There is no media in the device.
- @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.
- @retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of the intrinsic block size of the device.
- @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,
- or the buffer is not on proper alignment.
-
-**/
-EFI_STATUS
-EFIAPI
-UsbMassReadBlocks (
- IN EFI_BLOCK_IO_PROTOCOL *This,
- IN UINT32 MediaId,
- IN EFI_LBA Lba,
- IN UINTN BufferSize,
- OUT VOID *Buffer
- )
-{
- USB_MASS_DEVICE *UsbMass;
- EFI_BLOCK_IO_MEDIA *Media;
- EFI_STATUS Status;
- EFI_TPL OldTpl;
- UINTN TotalBlock;
-
- // AMD_EDKII_OVERRIDE START
- INT8 ResetRetryCount;
- VOID *OriginalBuffer;
- EFI_LBA OriginalLba;
- UINTN OriginalBufferSize;
-
- //
- // Raise TPL to TPL_CALLBACK to serialize all its operations
- // to protect shared data structures.
- //
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
- UsbMass = USB_MASS_DEVICE_FROM_BLOCK_IO (This);
- Media = &UsbMass->BlockIoMedia;
-
- ResetRetryCount = 3;
- OriginalBuffer = Buffer;
- OriginalBufferSize = BufferSize;
- OriginalLba = Lba;
-
- while (ResetRetryCount >= 0) {
-
- Buffer = OriginalBuffer;
- Lba = OriginalLba;
- BufferSize = OriginalBufferSize;
-
- //
- // If it is a removable media, such as CD-Rom or Usb-Floppy,
- // need to detect the media before each read/write. While some of
- // Usb-Flash is marked as removable media.
- //
- if (Media->RemovableMedia) {
- Status = UsbBootDetectMedia (UsbMass);
- if (EFI_ERROR (Status)) {
- goto ON_EXIT;
- }
- }
-
- if (!(Media->MediaPresent)) {
- Status = EFI_NO_MEDIA;
- goto ON_EXIT;
- }
-
- if (MediaId != Media->MediaId) {
- Status = EFI_MEDIA_CHANGED;
- goto ON_EXIT;
- }
-
- if (BufferSize == 0) {
- Status = EFI_SUCCESS;
- goto ON_EXIT;
- }
-
- if (Buffer == NULL) {
- Status = EFI_INVALID_PARAMETER;
- goto ON_EXIT;
- }
-
- //
- // BufferSize must be a multiple of the intrinsic block size of the device.
- //
- if ((BufferSize % Media->BlockSize) != 0) {
- Status = EFI_BAD_BUFFER_SIZE;
- goto ON_EXIT;
- }
-
- TotalBlock = BufferSize / Media->BlockSize;
-
- //
- // Make sure the range to read is valid.
- //
- if (Lba + TotalBlock - 1 > Media->LastBlock) {
- Status = EFI_INVALID_PARAMETER;
- goto ON_EXIT;
- }
-
- if (UsbMass->Cdb16Byte) {
- Status = UsbBootReadWriteBlocks16 (UsbMass, FALSE, Lba, TotalBlock, Buffer);
- } else {
- Status = UsbBootReadWriteBlocks (UsbMass, FALSE, (UINT32)Lba, TotalBlock, Buffer);
- }
-
- if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "UsbMassReadBlocks: UsbBootReadBlocks (%r) -> Reset\n", Status));
- UsbMassReset (This, TRUE);
- ResetRetryCount--;
- }
- else {
- break;
- }
- }
- // AMD_EDKII_OVERRIDE END
-ON_EXIT:
- gBS->RestoreTPL (OldTpl);
- return Status;
-}
-
-/**
- Writes a specified number of blocks to the device.
-
- This function implements EFI_BLOCK_IO_PROTOCOL.WriteBlocks().
- It writes a specified number of blocks to the device.
- All blocks are written, or an error is returned.
-
- @param This Indicates a pointer to the calling context.
- @param MediaId The media ID that the write request is for.
- @param Lba The starting logical block address to be written.
- @param BufferSize The size of the Buffer in bytes.
- This must be a multiple of the intrinsic block size of the device.
- @param Buffer Pointer to the source buffer for the data.
-
- @retval EFI_SUCCESS The data were written correctly to the device.
- @retval EFI_WRITE_PROTECTED The device cannot be written to.
- @retval EFI_NO_MEDIA There is no media in the device.
- @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.
- @retval EFI_DEVICE_ERROR The device reported an error while attempting to perform the write operation.
- @retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of the intrinsic
- block size of the device.
- @retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid,
- or the buffer is not on proper alignment.
-
-**/
-EFI_STATUS
-EFIAPI
-UsbMassWriteBlocks (
- IN EFI_BLOCK_IO_PROTOCOL *This,
- IN UINT32 MediaId,
- IN EFI_LBA Lba,
- IN UINTN BufferSize,
- IN VOID *Buffer
- )
-{
- USB_MASS_DEVICE *UsbMass;
- EFI_BLOCK_IO_MEDIA *Media;
- EFI_STATUS Status;
- EFI_TPL OldTpl;
- UINTN TotalBlock;
-
- //
- // Raise TPL to TPL_CALLBACK to serialize all its operations
- // to protect shared data structures.
- //
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
- UsbMass = USB_MASS_DEVICE_FROM_BLOCK_IO (This);
- Media = &UsbMass->BlockIoMedia;
-
- //
- // If it is a removable media, such as CD-Rom or Usb-Floppy,
- // need to detect the media before each read/write. Some of
- // USB Flash is marked as removable media.
- //
- if (Media->RemovableMedia) {
- Status = UsbBootDetectMedia (UsbMass);
- if (EFI_ERROR (Status)) {
- goto ON_EXIT;
- }
- }
-
- if (!(Media->MediaPresent)) {
- Status = EFI_NO_MEDIA;
- goto ON_EXIT;
- }
-
- if (MediaId != Media->MediaId) {
- Status = EFI_MEDIA_CHANGED;
- goto ON_EXIT;
- }
-
- if (BufferSize == 0) {
- Status = EFI_SUCCESS;
- goto ON_EXIT;
- }
-
- if (Buffer == NULL) {
- Status = EFI_INVALID_PARAMETER;
- goto ON_EXIT;
- }
-
- //
- // BufferSize must be a multiple of the intrinsic block size of the device.
- //
- if ((BufferSize % Media->BlockSize) != 0) {
- Status = EFI_BAD_BUFFER_SIZE;
- goto ON_EXIT;
- }
-
- TotalBlock = BufferSize / Media->BlockSize;
-
- //
- // Make sure the range to write is valid.
- //
- if (Lba + TotalBlock - 1 > Media->LastBlock) {
- Status = EFI_INVALID_PARAMETER;
- goto ON_EXIT;
- }
-
- //
- // Try to write the data even the device is marked as ReadOnly,
- // and clear the status should the write succeed.
- //
- if (UsbMass->Cdb16Byte) {
- Status = UsbBootReadWriteBlocks16 (UsbMass, TRUE, Lba, TotalBlock, Buffer);
- } else {
- Status = UsbBootReadWriteBlocks (UsbMass, TRUE, (UINT32)Lba, TotalBlock, Buffer);
- }
-
- if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "UsbMassWriteBlocks: UsbBootWriteBlocks (%r) -> Reset\n", Status));
- UsbMassReset (This, TRUE);
- }
-
-ON_EXIT:
- gBS->RestoreTPL (OldTpl);
- return Status;
-}
-
-/**
- Flushes all modified data to a physical block device.
-
- This function implements EFI_BLOCK_IO_PROTOCOL.FlushBlocks().
- USB mass storage device doesn't support write cache,
- so return EFI_SUCCESS directly.
-
- @param This Indicates a pointer to the calling context.
-
- @retval EFI_SUCCESS All outstanding data were written correctly to the device.
- @retval EFI_DEVICE_ERROR The device reported an error while attempting to write data.
- @retval EFI_NO_MEDIA There is no media in the device.
-
-**/
-EFI_STATUS
-EFIAPI
-UsbMassFlushBlocks (
- IN EFI_BLOCK_IO_PROTOCOL *This
- )
-{
- return EFI_SUCCESS;
-}
-
-/**
- Initialize the media parameter data for EFI_BLOCK_IO_MEDIA of Block I/O Protocol.
-
- @param UsbMass The USB mass storage device
-
- @retval EFI_SUCCESS The media parameters are updated successfully.
- @retval Others Failed to get the media parameters.
-
-**/
-EFI_STATUS
-UsbMassInitMedia (
- IN USB_MASS_DEVICE *UsbMass
- )
-{
- EFI_BLOCK_IO_MEDIA *Media;
- EFI_STATUS Status;
-
- Media = &UsbMass->BlockIoMedia;
-
- //
- // Fields of EFI_BLOCK_IO_MEDIA are defined in UEFI 2.0 spec,
- // section for Block I/O Protocol.
- //
- Media->MediaPresent = FALSE;
- Media->LogicalPartition = FALSE;
- Media->ReadOnly = FALSE;
- Media->WriteCaching = FALSE;
- Media->IoAlign = 0;
- Media->MediaId = 1;
-
- Status = UsbBootGetParams (UsbMass);
- DEBUG ((DEBUG_INFO, "UsbMassInitMedia: UsbBootGetParams (%r)\n", Status));
- if (Status == EFI_MEDIA_CHANGED) {
- //
- // Some USB storage devices may report MEDIA_CHANGED sense key when hot-plugged.
- // Treat it as SUCCESS
- //
- Status = EFI_SUCCESS;
- }
-
- return Status;
-}
-
-/**
- Initialize the USB Mass Storage transport.
-
- This function tries to find the matching USB Mass Storage transport
- protocol for USB device. If found, initializes the matching transport.
-
- @param This The USB mass driver's driver binding.
- @param Controller The device to test.
- @param Transport The pointer to pointer to USB_MASS_TRANSPORT.
- @param Context The parameter for USB_MASS_DEVICE.Context.
- @param MaxLun Get the MaxLun if is BOT dev.
-
- @retval EFI_SUCCESS The initialization is successful.
- @retval EFI_UNSUPPORTED No matching transport protocol is found.
- @retval Others Failed to initialize dev.
-
-**/
-EFI_STATUS
-UsbMassInitTransport (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- OUT USB_MASS_TRANSPORT **Transport,
- OUT VOID **Context,
- OUT UINT8 *MaxLun
- )
-{
- EFI_USB_IO_PROTOCOL *UsbIo;
- EFI_USB_INTERFACE_DESCRIPTOR Interface;
- UINT8 Index;
- EFI_STATUS Status;
-
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiUsbIoProtocolGuid,
- (VOID **)&UsbIo,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = UsbIo->UsbGetInterfaceDescriptor (UsbIo, &Interface);
- if (EFI_ERROR (Status)) {
- goto ON_EXIT;
- }
-
- Status = EFI_UNSUPPORTED;
-
- //
- // Traverse the USB_MASS_TRANSPORT arrary and try to find the
- // matching transport protocol.
- // If not found, return EFI_UNSUPPORTED.
- // If found, execute USB_MASS_TRANSPORT.Init() to initialize the transport context.
- //
- for (Index = 0; Index < USB_MASS_TRANSPORT_COUNT; Index++) {
- *Transport = mUsbMassTransport[Index];
-
- if (Interface.InterfaceProtocol == (*Transport)->Protocol) {
- Status = (*Transport)->Init (UsbIo, Context);
- break;
- }
- }
-
- if (EFI_ERROR (Status)) {
- goto ON_EXIT;
- }
-
- //
- // For BOT device, try to get its max LUN.
- // If max LUN is 0, then it is a non-lun device.
- // Otherwise, it is a multi-lun device.
- //
- if ((*Transport)->Protocol == USB_MASS_STORE_BOT) {
- (*Transport)->GetMaxLun (*Context, MaxLun);
- }
-
-ON_EXIT:
- gBS->CloseProtocol (
- Controller,
- &gEfiUsbIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- return Status;
-}
-
-/**
- Initialize data for device that supports multiple LUNSs.
-
- @param This The Driver Binding Protocol instance.
- @param Controller The device to initialize.
- @param Transport Pointer to USB_MASS_TRANSPORT.
- @param Context Parameter for USB_MASS_DEVICE.Context.
- @param DevicePath The remaining device path.
- @param MaxLun The max LUN number.
-
- @retval EFI_SUCCESS At least one LUN is initialized successfully.
- @retval EFI_NOT_FOUND Fail to initialize any of multiple LUNs.
-
-**/
-EFI_STATUS
-UsbMassInitMultiLun (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN USB_MASS_TRANSPORT *Transport,
- IN VOID *Context,
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- IN UINT8 MaxLun
- )
-{
- USB_MASS_DEVICE *UsbMass;
- EFI_USB_IO_PROTOCOL *UsbIo;
- DEVICE_LOGICAL_UNIT_DEVICE_PATH LunNode;
- UINT8 Index;
- EFI_STATUS Status;
- EFI_STATUS ReturnStatus;
-
- ASSERT (MaxLun > 0);
- ReturnStatus = EFI_NOT_FOUND;
-
- for (Index = 0; Index <= MaxLun; Index++) {
- DEBUG ((DEBUG_INFO, "UsbMassInitMultiLun: Start to initialize No.%d logic unit\n", Index));
-
- UsbIo = NULL;
- UsbMass = AllocateZeroPool (sizeof (USB_MASS_DEVICE));
- ASSERT (UsbMass != NULL);
-
- UsbMass->Signature = USB_MASS_SIGNATURE;
- UsbMass->UsbIo = UsbIo;
- UsbMass->BlockIo.Media = &UsbMass->BlockIoMedia;
- UsbMass->BlockIo.Reset = UsbMassReset;
- UsbMass->BlockIo.ReadBlocks = UsbMassReadBlocks;
- UsbMass->BlockIo.WriteBlocks = UsbMassWriteBlocks;
- UsbMass->BlockIo.FlushBlocks = UsbMassFlushBlocks;
- UsbMass->OpticalStorage = FALSE;
- UsbMass->Transport = Transport;
- UsbMass->Context = Context;
- UsbMass->Lun = Index;
-
- //
- // Initialize the media parameter data for EFI_BLOCK_IO_MEDIA of Block I/O Protocol.
- //
- Status = UsbMassInitMedia (UsbMass);
- if ((EFI_ERROR (Status)) && (Status != EFI_NO_MEDIA)) {
- DEBUG ((DEBUG_ERROR, "UsbMassInitMultiLun: UsbMassInitMedia (%r)\n", Status));
- FreePool (UsbMass);
- continue;
- }
-
- //
- // Create a device path node for device logic unit, and append it.
- //
- LunNode.Header.Type = MESSAGING_DEVICE_PATH;
- LunNode.Header.SubType = MSG_DEVICE_LOGICAL_UNIT_DP;
- LunNode.Lun = UsbMass->Lun;
-
- SetDevicePathNodeLength (&LunNode.Header, sizeof (LunNode));
-
- UsbMass->DevicePath = AppendDevicePathNode (DevicePath, &LunNode.Header);
-
- if (UsbMass->DevicePath == NULL) {
- DEBUG ((DEBUG_ERROR, "UsbMassInitMultiLun: failed to create device logic unit device path\n"));
- Status = EFI_OUT_OF_RESOURCES;
- FreePool (UsbMass);
- continue;
- }
-
- InitializeDiskInfo (UsbMass);
-
- //
- // Create a new handle for each LUN, and install Block I/O Protocol and Device Path Protocol.
- //
- Status = gBS->InstallMultipleProtocolInterfaces (
- &UsbMass->Controller,
- &gEfiDevicePathProtocolGuid,
- UsbMass->DevicePath,
- &gEfiBlockIoProtocolGuid,
- &UsbMass->BlockIo,
- &gEfiDiskInfoProtocolGuid,
- &UsbMass->DiskInfo,
- NULL
- );
-
- if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "UsbMassInitMultiLun: InstallMultipleProtocolInterfaces (%r)\n", Status));
- FreePool (UsbMass->DevicePath);
- FreePool (UsbMass);
- continue;
- }
-
- //
- // Open USB I/O Protocol by child to setup a parent-child relationship.
- //
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiUsbIoProtocolGuid,
- (VOID **)&UsbIo,
- This->DriverBindingHandle,
- UsbMass->Controller,
- EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
- );
-
- if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "UsbMassInitMultiLun: OpenUsbIoProtocol By Child (%r)\n", Status));
- gBS->UninstallMultipleProtocolInterfaces (
- UsbMass->Controller,
- &gEfiDevicePathProtocolGuid,
- UsbMass->DevicePath,
- &gEfiBlockIoProtocolGuid,
- &UsbMass->BlockIo,
- &gEfiDiskInfoProtocolGuid,
- &UsbMass->DiskInfo,
- NULL
- );
- FreePool (UsbMass->DevicePath);
- FreePool (UsbMass);
- continue;
- }
-
- ReturnStatus = EFI_SUCCESS;
- DEBUG ((DEBUG_INFO, "UsbMassInitMultiLun: Success to initialize No.%d logic unit\n", Index));
- }
-
- return ReturnStatus;
-}
-
-/**
- Initialize data for device that does not support multiple LUNSs.
-
- @param This The Driver Binding Protocol instance.
- @param Controller The device to initialize.
- @param Transport Pointer to USB_MASS_TRANSPORT.
- @param Context Parameter for USB_MASS_DEVICE.Context.
-
- @retval EFI_SUCCESS Initialization succeeds.
- @retval Other Initialization fails.
-
-**/
-EFI_STATUS
-UsbMassInitNonLun (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN USB_MASS_TRANSPORT *Transport,
- IN VOID *Context
- )
-{
- USB_MASS_DEVICE *UsbMass;
- EFI_USB_IO_PROTOCOL *UsbIo;
- EFI_STATUS Status;
-
- UsbIo = NULL;
- UsbMass = AllocateZeroPool (sizeof (USB_MASS_DEVICE));
- ASSERT (UsbMass != NULL);
-
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiUsbIoProtocolGuid,
- (VOID **)&UsbIo,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
-
- if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "UsbMassInitNonLun: OpenUsbIoProtocol By Driver (%r)\n", Status));
- goto ON_ERROR;
- }
-
- UsbMass->Signature = USB_MASS_SIGNATURE;
- UsbMass->Controller = Controller;
- UsbMass->UsbIo = UsbIo;
- UsbMass->BlockIo.Media = &UsbMass->BlockIoMedia;
- UsbMass->BlockIo.Reset = UsbMassReset;
- UsbMass->BlockIo.ReadBlocks = UsbMassReadBlocks;
- UsbMass->BlockIo.WriteBlocks = UsbMassWriteBlocks;
- UsbMass->BlockIo.FlushBlocks = UsbMassFlushBlocks;
- UsbMass->OpticalStorage = FALSE;
- UsbMass->Transport = Transport;
- UsbMass->Context = Context;
-
- //
- // Initialize the media parameter data for EFI_BLOCK_IO_MEDIA of Block I/O Protocol.
- //
- Status = UsbMassInitMedia (UsbMass);
- if ((EFI_ERROR (Status)) && (Status != EFI_NO_MEDIA)) {
- DEBUG ((DEBUG_ERROR, "UsbMassInitNonLun: UsbMassInitMedia (%r)\n", Status));
- goto ON_ERROR;
- }
-
- InitializeDiskInfo (UsbMass);
-
- Status = gBS->InstallMultipleProtocolInterfaces (
- &Controller,
- &gEfiBlockIoProtocolGuid,
- &UsbMass->BlockIo,
- &gEfiDiskInfoProtocolGuid,
- &UsbMass->DiskInfo,
- NULL
- );
- if (EFI_ERROR (Status)) {
- goto ON_ERROR;
- }
-
- return EFI_SUCCESS;
-
-ON_ERROR:
- if (UsbMass != NULL) {
- FreePool (UsbMass);
- }
-
- if (UsbIo != NULL) {
- gBS->CloseProtocol (
- Controller,
- &gEfiUsbIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- }
-
- return Status;
-}
-
-/**
- Check whether the controller is a supported USB mass storage.
-
- @param This The USB mass storage driver binding protocol.
- @param Controller The controller handle to check.
- @param RemainingDevicePath The remaining device path.
-
- @retval EFI_SUCCESS The driver supports this controller.
- @retval other This device isn't supported.
-
-**/
-EFI_STATUS
-EFIAPI
-USBMassDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-{
- EFI_USB_IO_PROTOCOL *UsbIo;
- EFI_USB_INTERFACE_DESCRIPTOR Interface;
- USB_MASS_TRANSPORT *Transport;
- EFI_STATUS Status;
- UINTN Index;
-
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiUsbIoProtocolGuid,
- (VOID **)&UsbIo,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Get the interface descriptor to check the USB class and find a transport
- // protocol handler.
- //
- Status = UsbIo->UsbGetInterfaceDescriptor (UsbIo, &Interface);
- if (EFI_ERROR (Status)) {
- goto ON_EXIT;
- }
-
- Status = EFI_UNSUPPORTED;
-
- if (Interface.InterfaceClass != USB_MASS_STORE_CLASS) {
- goto ON_EXIT;
- }
-
- //
- // Traverse the USB_MASS_TRANSPORT arrary and try to find the
- // matching transport method.
- // If not found, return EFI_UNSUPPORTED.
- // If found, execute USB_MASS_TRANSPORT.Init() to initialize the transport context.
- //
- for (Index = 0; Index < USB_MASS_TRANSPORT_COUNT; Index++) {
- Transport = mUsbMassTransport[Index];
- if (Interface.InterfaceProtocol == Transport->Protocol) {
- Status = Transport->Init (UsbIo, NULL);
- break;
- }
- }
-
-ON_EXIT:
- gBS->CloseProtocol (
- Controller,
- &gEfiUsbIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- return Status;
-}
-
-/**
- Starts the USB mass storage device with this driver.
-
- This function consumes USB I/O Protocol, initializes USB mass storage device,
- installs Block I/O Protocol, and submits Asynchronous Interrupt
- Transfer to manage the USB mass storage device.
-
- @param This The USB mass storage driver binding protocol.
- @param Controller The USB mass storage device to start on
- @param RemainingDevicePath The remaining device path.
-
- @retval EFI_SUCCESS This driver supports this device.
- @retval EFI_UNSUPPORTED This driver does not support this device.
- @retval EFI_DEVICE_ERROR This driver cannot be started due to device Error.
- @retval EFI_OUT_OF_RESOURCES Can't allocate memory resources.
- @retval EFI_ALREADY_STARTED This driver has been started.
-
-**/
-EFI_STATUS
-EFIAPI
-USBMassDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-{
- USB_MASS_TRANSPORT *Transport;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- VOID *Context;
- UINT8 MaxLun;
- EFI_STATUS Status;
- EFI_USB_IO_PROTOCOL *UsbIo;
- EFI_TPL OldTpl;
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- Transport = NULL;
- Context = NULL;
- MaxLun = 0;
-
- Status = UsbMassInitTransport (This, Controller, &Transport, &Context, &MaxLun);
-
- if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "USBMassDriverBindingStart: UsbMassInitTransport (%r)\n", Status));
- goto Exit;
- }
-
- if (MaxLun == 0) {
- //
- // Initialize data for device that does not support multiple LUNSs.
- //
- Status = UsbMassInitNonLun (This, Controller, Transport, Context);
- if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "USBMassDriverBindingStart: UsbMassInitNonLun (%r)\n", Status));
- }
- } else {
- //
- // Open device path to prepare for appending Device Logic Unit node.
- //
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- (VOID **)&DevicePath,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
-
- if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "USBMassDriverBindingStart: OpenDevicePathProtocol By Driver (%r)\n", Status));
- goto Exit;
- }
-
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiUsbIoProtocolGuid,
- (VOID **)&UsbIo,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
-
- if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "USBMassDriverBindingStart: OpenUsbIoProtocol By Driver (%r)\n", Status));
- gBS->CloseProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- goto Exit;
- }
-
- //
- // Initialize data for device that supports multiple LUNs.
- // EFI_SUCCESS is returned if at least 1 LUN is initialized successfully.
- //
- Status = UsbMassInitMultiLun (This, Controller, Transport, Context, DevicePath, MaxLun);
- if (EFI_ERROR (Status)) {
- gBS->CloseProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- gBS->CloseProtocol (
- Controller,
- &gEfiUsbIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- DEBUG ((DEBUG_ERROR, "USBMassDriverBindingStart: UsbMassInitMultiLun (%r) with Maxlun=%d\n", Status, MaxLun));
- }
- }
-
-Exit:
- gBS->RestoreTPL (OldTpl);
- return Status;
-}
-
-/**
- Stop controlling the device.
-
- @param This The USB mass storage driver binding
- @param Controller The device controller controlled by the driver.
- @param NumberOfChildren The number of children of this device
- @param ChildHandleBuffer The buffer of children handle.
-
- @retval EFI_SUCCESS The driver stopped from controlling the device.
- @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
- @retval EFI_UNSUPPORTED Block I/O Protocol is not installed on Controller.
- @retval Others Failed to stop the driver
-
-**/
-EFI_STATUS
-EFIAPI
-USBMassDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-{
- EFI_STATUS Status;
- USB_MASS_DEVICE *UsbMass;
- EFI_USB_IO_PROTOCOL *UsbIo;
- EFI_BLOCK_IO_PROTOCOL *BlockIo;
- UINTN Index;
- BOOLEAN AllChildrenStopped;
-
- //
- // This is a bus driver stop function since multi-lun is supported.
- // There are three kinds of device handles that might be passed:
- // 1st is a handle with USB I/O & Block I/O installed (non-multi-lun)
- // 2nd is a handle with Device Path & USB I/O installed (multi-lun root)
- // 3rd is a handle with Device Path & USB I/O & Block I/O installed (multi-lun).
- //
- if (NumberOfChildren == 0) {
- //
- // A handle without any children, might be 1st and 2nd type.
- //
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiBlockIoProtocolGuid,
- (VOID **)&BlockIo,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
-
- if (EFI_ERROR (Status)) {
- //
- // This is a 2nd type handle(multi-lun root), it needs to close devicepath
- // and usbio protocol.
- //
- gBS->CloseProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- gBS->CloseProtocol (
- Controller,
- &gEfiUsbIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- DEBUG ((DEBUG_INFO, "Success to stop multi-lun root handle\n"));
- return EFI_SUCCESS;
- }
-
- //
- // This is a 1st type handle(non-multi-lun), which only needs to uninstall
- // Block I/O Protocol, close USB I/O Protocol and free mass device.
- //
- UsbMass = USB_MASS_DEVICE_FROM_BLOCK_IO (BlockIo);
-
- //
- // Uninstall Block I/O protocol from the device handle,
- // then call the transport protocol to stop itself.
- //
- Status = gBS->UninstallMultipleProtocolInterfaces (
- Controller,
- &gEfiBlockIoProtocolGuid,
- &UsbMass->BlockIo,
- &gEfiDiskInfoProtocolGuid,
- &UsbMass->DiskInfo,
- NULL
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- gBS->CloseProtocol (
- Controller,
- &gEfiUsbIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- UsbMass->Transport->CleanUp (UsbMass->Context);
- FreePool (UsbMass);
-
- DEBUG ((DEBUG_INFO, "Success to stop non-multi-lun root handle\n"));
- return EFI_SUCCESS;
- }
-
- //
- // This is a 3rd type handle(multi-lun), which needs uninstall
- // Block I/O Protocol and Device Path Protocol, close USB I/O Protocol and
- // free mass device for all children.
- //
- AllChildrenStopped = TRUE;
-
- for (Index = 0; Index < NumberOfChildren; Index++) {
- Status = gBS->OpenProtocol (
- ChildHandleBuffer[Index],
- &gEfiBlockIoProtocolGuid,
- (VOID **)&BlockIo,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- AllChildrenStopped = FALSE;
- DEBUG ((DEBUG_ERROR, "Fail to stop No.%d multi-lun child handle when opening blockio\n", (UINT32)Index));
- continue;
- }
-
- UsbMass = USB_MASS_DEVICE_FROM_BLOCK_IO (BlockIo);
-
- gBS->CloseProtocol (
- Controller,
- &gEfiUsbIoProtocolGuid,
- This->DriverBindingHandle,
- ChildHandleBuffer[Index]
- );
-
- Status = gBS->UninstallMultipleProtocolInterfaces (
- ChildHandleBuffer[Index],
- &gEfiDevicePathProtocolGuid,
- UsbMass->DevicePath,
- &gEfiBlockIoProtocolGuid,
- &UsbMass->BlockIo,
- &gEfiDiskInfoProtocolGuid,
- &UsbMass->DiskInfo,
- NULL
- );
-
- if (EFI_ERROR (Status)) {
- //
- // Fail to uninstall Block I/O Protocol and Device Path Protocol, so re-open USB I/O Protocol by child.
- //
- AllChildrenStopped = FALSE;
- DEBUG ((DEBUG_ERROR, "Fail to stop No.%d multi-lun child handle when uninstalling blockio and devicepath\n", (UINT32)Index));
-
- gBS->OpenProtocol (
- Controller,
- &gEfiUsbIoProtocolGuid,
- (VOID **)&UsbIo,
- This->DriverBindingHandle,
- ChildHandleBuffer[Index],
- EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
- );
- } else {
- //
- // Succeed to stop this multi-lun handle, so go on with next child.
- //
- if (((Index + 1) == NumberOfChildren) && AllChildrenStopped) {
- UsbMass->Transport->CleanUp (UsbMass->Context);
- }
-
- FreePool (UsbMass);
- }
- }
-
- if (!AllChildrenStopped) {
- return EFI_DEVICE_ERROR;
- }
-
- DEBUG ((DEBUG_INFO, "Success to stop all %d multi-lun children handles\n", (UINT32)NumberOfChildren));
- return EFI_SUCCESS;
-}
-
-/**
- Entrypoint of USB Mass Storage Driver.
-
- This function is the entrypoint of USB Mass Storage Driver. It installs Driver Binding
- Protocol together with Component Name Protocols.
-
- @param ImageHandle The firmware allocated handle for the EFI image.
- @param SystemTable A pointer to the EFI System Table.
-
- @retval EFI_SUCCESS The entry point is executed successfully.
-
-**/
-EFI_STATUS
-EFIAPI
-USBMassStorageEntryPoint (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
-
- //
- // Install driver binding protocol
- //
- Status = EfiLibInstallDriverBindingComponentName2 (
- ImageHandle,
- SystemTable,
- &gUSBMassDriverBinding,
- ImageHandle,
- &gUsbMassStorageComponentName,
- &gUsbMassStorageComponentName2
- );
- ASSERT_EFI_ERROR (Status);
-
- return EFI_SUCCESS;
-}
diff --git a/Platform/AMD/GenoaBoard/Override/edk2/MdePkg/Library/SmmPciExpressLib/SmmPciExpressLib.inf b/Platform/AMD/GenoaBoard/Override/edk2/MdePkg/Library/SmmPciExpressLib/SmmPciExpressLib.inf
deleted file mode 100644
index 425fec22ed..0000000000
--- a/Platform/AMD/GenoaBoard/Override/edk2/MdePkg/Library/SmmPciExpressLib/SmmPciExpressLib.inf
+++ /dev/null
@@ -1,43 +0,0 @@
-#
-# Copyright (C) 2023-2025 Advanced Micro Devices, Inc. All rights reserved.
-#
-
-## @file
-# Instance of PCI Express Library using the 256 MB PCI Express MMIO window.
-#
-# PCI Express Library that uses the 256 MB PCI Express MMIO window to perform
-# PCI Configuration cycles. Layers on top of an I/O Library instance.
-#
-# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-# Portions copyright (c) 2016, American Megatrends, Inc. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = SmmPciExpressLib
- FILE_GUID = 00D24382-8231-4B18-A4F0-2D94D8FE2E81
- MODULE_TYPE = DXE_SMM_DRIVER
- VERSION_STRING = 1.0
- LIBRARY_CLASS = PciExpressLib|DXE_SMM_DRIVER SMM_CORE
- CONSTRUCTOR = SmmPciExpressLibConstructor
-
-[Sources]
- PciExpressLib.c
-
-[Packages]
- MdePkg/MdePkg.dec
-
-[LibraryClasses]
- UefiBootServicesTableLib
- BaseLib
- PcdLib
- DebugLib
- IoLib
-
-[Pcd]
- gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress ## CONSUMES
- gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseSize ## CONSUMES