+++ /dev/null
-/**@file\r
-\r
-Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>\r
-SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-Module Name:\r
- WinNtFwh.c\r
- \r
-Abstract:\r
- PEIM to abstract construction of firmware volume in a Windows NT environment.\r
-\r
-Revision History\r
-\r
-**/\r
-\r
-//\r
-// The package level header files this module uses\r
-//\r
-#include <PiPei.h>\r
-#include <WinNtPeim.h>\r
-//\r
-// The protocols, PPI and GUID defintions for this module\r
-//\r
-#include <Ppi/NtFwh.h>\r
-//\r
-// The Library classes this module consumes\r
-//\r
-#include <Library/DebugLib.h>\r
-#include <Library/PeimEntryPoint.h>\r
-#include <Library/HobLib.h>\r
-#include <Library/PcdLib.h>\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-PeimInitializeWinNtFwh (\r
- IN EFI_FFS_FILE_HEADER *FfsHeader,\r
- IN EFI_PEI_SERVICES **PeiServices\r
- )\r
-/*++\r
-\r
-Routine Description:\r
- Perform a call-back into the SEC simulator to get address of the Firmware Hub\r
-\r
-Arguments:\r
- FfsHeader - Ffs Header available to every PEIM\r
- PeiServices - General purpose services available to every PEIM.\r
- \r
-Returns:\r
- None\r
-\r
---*/\r
-{\r
- EFI_STATUS Status;\r
- EFI_PEI_PPI_DESCRIPTOR *PpiDescriptor;\r
- NT_FWH_PPI *FwhPpi;\r
- EFI_PHYSICAL_ADDRESS FdBase;\r
- EFI_FIRMWARE_VOLUME_HEADER *FvHeader;\r
- UINT64 FdSize;\r
- UINTN Index;\r
-\r
- DEBUG ((EFI_D_ERROR, "NT 32 Firmware Volume PEIM Loaded\n"));\r
-\r
- //\r
- // Get the Fwh Information PPI\r
- //\r
- Status = (**PeiServices).LocatePpi (\r
- (const EFI_PEI_SERVICES **)PeiServices,\r
- &gNtFwhPpiGuid, // GUID\r
- 0, // INSTANCE\r
- &PpiDescriptor, // EFI_PEI_PPI_DESCRIPTOR\r
- (VOID**)&FwhPpi // PPI\r
- );\r
- ASSERT_EFI_ERROR (Status);\r
-\r
- Index = 0;\r
- do {\r
- //\r
- // Get information about all the FD's in the system\r
- //\r
- Status = FwhPpi->NtFwh (Index, &FdBase, &FdSize);\r
- if (!EFI_ERROR (Status)) {\r
- //\r
- // Assume the FD starts with an FV header\r
- //\r
- FvHeader = (EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) FdBase;\r
-\r
- //\r
- // Make an FV Hob for the first FV in the FD\r
- //\r
- BuildFvHob (FdBase, FvHeader->FvLength);\r
-\r
- if (Index == 0) {\r
- //\r
- // Assume the first FD was produced by the NT32.DSC\r
- // All these strange offests are needed to keep in\r
- // sync with the FlashMap and NT32.dsc file\r
- //\r
- BuildResourceDescriptorHob (\r
- EFI_RESOURCE_FIRMWARE_DEVICE,\r
- (EFI_RESOURCE_ATTRIBUTE_PRESENT | EFI_RESOURCE_ATTRIBUTE_INITIALIZED | EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE),\r
- FdBase,\r
- ( \r
- FvHeader->FvLength + \r
- PcdGet32 (PcdFlashNvStorageVariableSize) +\r
- PcdGet32 (PcdFlashNvStorageFtwWorkingSize) +\r
- PcdGet32 (PcdFlashNvStorageFtwSpareSize) +\r
- PcdGet32 (PcdWinNtFlashNvStorageEventLogSize)\r
- )\r
- );\r
- //\r
- // Hard code the address of the spare block and variable services.\r
- // Assume it's a hard coded offset from FV0 in FD0.\r
- //\r
- FdSize = \r
- PcdGet32 (PcdFlashNvStorageVariableSize) +\r
- PcdGet32 (PcdFlashNvStorageFtwWorkingSize) +\r
- PcdGet32 (PcdFlashNvStorageFtwSpareSize) +\r
- PcdGet32 (PcdWinNtFlashNvStorageEventLogSize);\r
-\r
- BuildFvHob (FdBase + PcdGet32 (PcdWinNtFlashNvStorageVariableBase), FdSize);\r
- } else {\r
- //\r
- // For other FD's just map them in.\r
- //\r
- BuildResourceDescriptorHob (\r
- EFI_RESOURCE_FIRMWARE_DEVICE,\r
- (EFI_RESOURCE_ATTRIBUTE_PRESENT | EFI_RESOURCE_ATTRIBUTE_INITIALIZED | EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE),\r
- FdBase,\r
- FdSize\r
- );\r
- }\r
- }\r
-\r
- Index++;\r
- } while (!EFI_ERROR (Status));\r
-\r
- return Status;\r
-}\r