3 Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
4 (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 PEIM to build GUIDed HOBs for platform specific flash map
24 // The package level header files this module uses
28 #include <WinNtPeim.h>
30 // The protocols, PPI and GUID defintions for this module
32 #include <Ppi/NtFwh.h>
34 #include <Library/DebugLib.h>
35 #include <Library/PcdLib.h>
36 #include <Library/PeiServicesLib.h>
40 PeimInitializeFlashMap (
41 IN EFI_FFS_FILE_HEADER
*FfsHeader
,
42 IN 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
61 EFI_PHYSICAL_ADDRESS FdBase
;
63 EFI_PEI_PPI_DESCRIPTOR
*PpiDescriptor
;
65 DEBUG ((EFI_D_ERROR
, "NT 32 Flash Map PEIM Loaded\n"));
68 // Get the Fwh Information PPI
70 Status
= PeiServicesLocatePpi (
71 &gNtFwhPpiGuid
, // GUID
73 &PpiDescriptor
, // EFI_PEI_PPI_DESCRIPTOR
74 (VOID
**)&NtFwhPpi
// PPI
76 ASSERT_EFI_ERROR (Status
);
79 // Assume that FD0 contains the Flash map.
81 Status
= NtFwhPpi
->NtFwh (0, &FdBase
, &FdSize
);
82 if (EFI_ERROR (Status
)) {
87 // Relocate the base of FV region
89 if (FdBase
>= BASE_4GB
) {
90 PcdSet64 (PcdFlashNvStorageVariableBase64
, PcdGet32 (PcdWinNtFlashNvStorageVariableBase
) + (UINT64
) FdBase
);
91 PcdSet64 (PcdFlashNvStorageFtwWorkingBase64
, PcdGet32 (PcdWinNtFlashNvStorageFtwWorkingBase
) + (UINT64
) FdBase
);
92 PcdSet64 (PcdFlashNvStorageFtwSpareBase64
, PcdGet32 (PcdWinNtFlashNvStorageFtwSpareBase
) + (UINT64
) FdBase
);
94 PcdSet32 (PcdFlashNvStorageVariableBase
, PcdGet32 (PcdWinNtFlashNvStorageVariableBase
) + (UINT32
) FdBase
);
95 PcdSet32 (PcdFlashNvStorageFtwWorkingBase
, PcdGet32 (PcdWinNtFlashNvStorageFtwWorkingBase
) + (UINT32
) FdBase
);
96 PcdSet32 (PcdFlashNvStorageFtwSpareBase
, PcdGet32 (PcdWinNtFlashNvStorageFtwSpareBase
) + (UINT32
) FdBase
);