3 Copyright (c) 2006 - 2008, 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
25 #include <Guid/SystemNvDataGuid.h>
26 #include <Guid/FirmwareFileSystem.h>
27 #include <Ppi/UnixFwh.h>
28 #include <Protocol/FirmwareVolumeBlock.h>
30 #include <Library/DebugLib.h>
31 #include <Library/PeimEntryPoint.h>
32 #include <Library/HobLib.h>
33 #include <Library/PeiServicesLib.h>
34 #include <Library/PeiServicesTablePointerLib.h>
35 #include <Library/BaseMemoryLib.h>
36 #include <Library/PcdLib.h>
40 PeimInitializeFlashMap (
41 IN EFI_PEI_FILE_HANDLE FileHandle
,
42 IN CONST EFI_PEI_SERVICES
**PeiServices
47 Build GUIDed HOBs for platform specific flash map
50 FfsHeader - A pointer to the EFI_FFS_FILE_HEADER structure.
51 PeiServices - General purpose services available to every PEIM.
57 // TODO: EFI_SUCCESS - add return value to function comment
60 UNIX_FWH_PPI
*UnixFwhPpi
;
61 EFI_PEI_PPI_DESCRIPTOR
*PpiDescriptor
;
62 EFI_PHYSICAL_ADDRESS FdBase
;
63 EFI_PHYSICAL_ADDRESS FdFixUp
;
66 DEBUG ((EFI_D_ERROR
, "NT 32 Flash Map PEIM Loaded\n"));
69 // Get the Fwh Information PPI
71 Status
= PeiServicesLocatePpi (
72 &gUnixFwhPpiGuid
, // GUID
74 &PpiDescriptor
, // EFI_PEI_PPI_DESCRIPTOR
75 (VOID
**)&UnixFwhPpi
// PPI
77 ASSERT_EFI_ERROR (Status
);
80 // Assume that FD0 contains the Flash map.
82 Status
= UnixFwhPpi
->UnixFwh (0, &FdBase
, &FdSize
, &FdFixUp
);
83 if (EFI_ERROR (Status
)) {
87 PcdSet32 (PcdFlashNvStorageVariableBase
, PcdGet32 (PcdUnixFlashNvStorageVariableBase
) + (UINT32
)FdFixUp
);
88 PcdSet32 (PcdFlashNvStorageFtwWorkingBase
, PcdGet32 (PcdUnixFlashNvStorageFtwWorkingBase
) + (UINT32
)FdFixUp
);
89 PcdSet32 (PcdFlashNvStorageFtwSpareBase
, PcdGet32 (PcdUnixFlashNvStorageFtwSpareBase
) + (UINT32
)FdFixUp
);