]> git.proxmox.com Git - mirror_edk2.git/blame - Nt32Pkg/WinNtFlashMapPei/FlashMap.c
Replace the FlashMapHob with PCD defined in FDF on Nt32 platform. Currently, the...
[mirror_edk2.git] / Nt32Pkg / WinNtFlashMapPei / FlashMap.c
CommitLineData
56a71b55 1/*++\r
2\r
3Copyright (c) 2006, Intel Corporation \r
4All rights reserved. This program and the accompanying materials \r
5are licensed and made available under the terms and conditions of the BSD License \r
6which accompanies this distribution. The full text of the license may be found at \r
7http://opensource.org/licenses/bsd-license.php \r
8 \r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
11\r
12Module Name:\r
13\r
14 FlashMap.c\r
15 \r
16Abstract:\r
17\r
18 PEIM to build GUIDed HOBs for platform specific flash map\r
19\r
20--*/\r
21\r
56a71b55 22//\r
23// The package level header files this module uses\r
24//\r
25#include <PiPei.h>\r
6d3aa33e 26\r
56a71b55 27#include <WinNtPeim.h>\r
28//\r
29// The protocols, PPI and GUID defintions for this module\r
30//\r
31#include <Ppi/NtFwh.h>\r
6d3aa33e 32\r
56a71b55 33#include <Library/DebugLib.h>\r
56a71b55 34#include <Library/PcdLib.h>\r
6d3aa33e 35#include <Library/PeiServicesLib.h>\r
56a71b55 36\r
37EFI_STATUS\r
38EFIAPI\r
39PeimInitializeFlashMap (\r
40 IN EFI_FFS_FILE_HEADER *FfsHeader,\r
41 IN EFI_PEI_SERVICES **PeiServices\r
42 )\r
43/*++\r
44\r
45Routine Description:\r
46 Build GUIDed HOBs for platform specific flash map\r
47 \r
48Arguments:\r
49 FfsHeader - A pointer to the EFI_FFS_FILE_HEADER structure.\r
50 PeiServices - General purpose services available to every PEIM.\r
51 \r
52Returns:\r
53 EFI_STATUS\r
54\r
55--*/\r
56// TODO: EFI_SUCCESS - add return value to function comment\r
57{\r
58 EFI_STATUS Status;\r
59 NT_FWH_PPI *NtFwhPpi;\r
56a71b55 60 EFI_PHYSICAL_ADDRESS FdBase;\r
61 UINT64 FdSize;\r
6d3aa33e 62 EFI_PEI_PPI_DESCRIPTOR *PpiDescriptor;\r
56a71b55 63\r
64 DEBUG ((EFI_D_ERROR, "NT 32 Flash Map PEIM Loaded\n"));\r
65\r
56a71b55 66 //\r
67 // Get the Fwh Information PPI\r
68 //\r
69 Status = PeiServicesLocatePpi (\r
70 &gNtFwhPpiGuid, // GUID\r
71 0, // INSTANCE\r
72 &PpiDescriptor, // EFI_PEI_PPI_DESCRIPTOR\r
73 &NtFwhPpi // PPI\r
74 );\r
75 ASSERT_EFI_ERROR (Status);\r
76\r
77 //\r
78 // Assume that FD0 contains the Flash map.\r
79 //\r
80 Status = NtFwhPpi->NtFwh (0, &FdBase, &FdSize);\r
81 if (EFI_ERROR (Status)) {\r
82 return Status;\r
83 }\r
84\r
85 //\r
6d3aa33e 86 // Relocate the base of FV region \r
87 // \r
88 PcdSet32 (PcdFlashNvStorageVariableBase, PcdGet32 (PcdWinNtFlashNvStorageVariableBase) + (UINT32) FdBase);\r
89 PcdSet32 (PcdFlashNvStorageFtwWorkingBase, PcdGet32 (PcdWinNtFlashNvStorageFtwWorkingBase) + (UINT32) FdBase);\r
90 PcdSet32 (PcdFlashNvStorageFtwSpareBase, PcdGet32 (PcdWinNtFlashNvStorageFtwWorkingBase) + (UINT32) FdBase);\r
56a71b55 91\r
92 return EFI_SUCCESS;\r
93}\r
94\r