]>
Commit | Line | Data |
---|---|---|
804405e7 | 1 | /*++\r |
2 | \r | |
f9b8ab56 HT |
3 | Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r |
4 | This program and the accompanying materials \r | |
804405e7 | 5 | are licensed and made available under the terms and conditions of the BSD License \r |
6 | which accompanies this distribution. The full text of the license may be found at \r | |
7 | http://opensource.org/licenses/bsd-license.php \r | |
8 | \r | |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
11 | \r | |
12 | Module Name:\r | |
13 | \r | |
14 | FlashMap.c\r | |
15 | \r | |
16 | Abstract:\r | |
17 | \r | |
18 | PEIM to build GUIDed HOBs for platform specific flash map\r | |
19 | \r | |
20 | --*/\r | |
21 | \r | |
22 | \r | |
23 | #include "PiPei.h"\r | |
24 | \r | |
25 | #include <Guid/SystemNvDataGuid.h>\r | |
804405e7 | 26 | #include <Ppi/UnixFwh.h>\r |
27 | #include <Protocol/FirmwareVolumeBlock.h>\r | |
28 | \r | |
29 | #include <Library/DebugLib.h>\r | |
30 | #include <Library/PeimEntryPoint.h>\r | |
31 | #include <Library/HobLib.h>\r | |
32 | #include <Library/PeiServicesLib.h>\r | |
33 | #include <Library/PeiServicesTablePointerLib.h>\r | |
34 | #include <Library/BaseMemoryLib.h>\r | |
35 | #include <Library/PcdLib.h>\r | |
36 | \r | |
37 | EFI_STATUS\r | |
38 | EFIAPI\r | |
39 | PeimInitializeFlashMap (\r | |
baadbb84 | 40 | IN EFI_PEI_FILE_HANDLE FileHandle,\r |
41 | IN CONST EFI_PEI_SERVICES **PeiServices\r | |
804405e7 | 42 | )\r |
43 | /*++\r | |
44 | \r | |
45 | Routine Description:\r | |
46 | Build GUIDed HOBs for platform specific flash map\r | |
47 | \r | |
48 | Arguments:\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 | |
52 | Returns:\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 | |
7ee3b613 | 59 | UNIX_FWH_PPI *UnixFwhPpi;\r |
804405e7 | 60 | EFI_PEI_PPI_DESCRIPTOR *PpiDescriptor;\r |
61 | EFI_PHYSICAL_ADDRESS FdBase;\r | |
7ee3b613 | 62 | EFI_PHYSICAL_ADDRESS FdFixUp;\r |
804405e7 | 63 | UINT64 FdSize;\r |
64 | \r | |
a780c942 | 65 | DEBUG ((EFI_D_ERROR, "UnixPkg Flash Map PEIM Loaded\n"));\r |
804405e7 | 66 | \r |
67 | //\r | |
68 | // Get the Fwh Information PPI\r | |
69 | //\r | |
70 | Status = PeiServicesLocatePpi (\r | |
71 | &gUnixFwhPpiGuid, // GUID\r | |
72 | 0, // INSTANCE\r | |
73 | &PpiDescriptor, // EFI_PEI_PPI_DESCRIPTOR\r | |
74 | (VOID **)&UnixFwhPpi // PPI\r | |
75 | );\r | |
76 | ASSERT_EFI_ERROR (Status);\r | |
77 | \r | |
78 | //\r | |
79 | // Assume that FD0 contains the Flash map.\r | |
80 | //\r | |
7ee3b613 | 81 | Status = UnixFwhPpi->UnixFwh (0, &FdBase, &FdSize, &FdFixUp);\r |
804405e7 | 82 | if (EFI_ERROR (Status)) {\r |
83 | return Status;\r | |
84 | }\r | |
85 | \r | |
b9c8e50e | 86 | PcdSet64 (PcdFlashNvStorageVariableBase64, PcdGet64 (PcdUnixFlashNvStorageVariableBase) + FdFixUp);\r |
87 | PcdSet64 (PcdFlashNvStorageFtwWorkingBase64, PcdGet64 (PcdUnixFlashNvStorageFtwWorkingBase) + FdFixUp);\r | |
88 | PcdSet64 (PcdFlashNvStorageFtwSpareBase64, PcdGet64 (PcdUnixFlashNvStorageFtwSpareBase) + FdFixUp);\r | |
804405e7 | 89 | \r |
90 | return EFI_SUCCESS;\r | |
91 | }\r |