3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 PEIM to build GUIDed HOBs for platform specific flash map
23 // The package level header files this module uses
27 #include <WinNtPeim.h>
29 // The protocols, PPI and GUID defintions for this module
31 #include <Ppi/NtFwh.h>
33 #include <Library/DebugLib.h>
34 #include <Library/PcdLib.h>
35 #include <Library/PeiServicesLib.h>
39 PeimInitializeFlashMap (
40 IN EFI_FFS_FILE_HEADER
*FfsHeader
,
41 IN EFI_PEI_SERVICES
**PeiServices
46 Build GUIDed HOBs for platform specific flash map
49 FfsHeader - A pointer to the EFI_FFS_FILE_HEADER structure.
50 PeiServices - General purpose services available to every PEIM.
56 // TODO: EFI_SUCCESS - add return value to function comment
60 EFI_PHYSICAL_ADDRESS FdBase
;
62 EFI_PEI_PPI_DESCRIPTOR
*PpiDescriptor
;
64 DEBUG ((EFI_D_ERROR
, "NT 32 Flash Map PEIM Loaded\n"));
67 // Get the Fwh Information PPI
69 Status
= PeiServicesLocatePpi (
70 &gNtFwhPpiGuid
, // GUID
72 &PpiDescriptor
, // EFI_PEI_PPI_DESCRIPTOR
75 ASSERT_EFI_ERROR (Status
);
78 // Assume that FD0 contains the Flash map.
80 Status
= NtFwhPpi
->NtFwh (0, &FdBase
, &FdSize
);
81 if (EFI_ERROR (Status
)) {
86 // Relocate the base of FV region
88 PcdSet32 (PcdFlashNvStorageVariableBase
, PcdGet32 (PcdWinNtFlashNvStorageVariableBase
) + (UINT32
) FdBase
);
89 PcdSet32 (PcdFlashNvStorageFtwWorkingBase
, PcdGet32 (PcdWinNtFlashNvStorageFtwWorkingBase
) + (UINT32
) FdBase
);
90 PcdSet32 (PcdFlashNvStorageFtwSpareBase
, PcdGet32 (PcdWinNtFlashNvStorageFtwSpareBase
) + (UINT32
) FdBase
);