]>
Commit | Line | Data |
---|---|---|
804405e7 | 1 | /*++\r |
2 | \r | |
3 | Copyright (c) 2006 - 2008, Intel Corporation \r | |
4 | All rights reserved. This program and the accompanying materials \r | |
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 | |
26 | #include <Guid/FirmwareFileSystem.h>\r | |
27 | #include <Ppi/UnixFwh.h>\r | |
28 | #include <Protocol/FirmwareVolumeBlock.h>\r | |
29 | \r | |
30 | #include <Library/DebugLib.h>\r | |
31 | #include <Library/PeimEntryPoint.h>\r | |
32 | #include <Library/HobLib.h>\r | |
33 | #include <Library/PeiServicesLib.h>\r | |
34 | #include <Library/PeiServicesTablePointerLib.h>\r | |
35 | #include <Library/BaseMemoryLib.h>\r | |
36 | #include <Library/PcdLib.h>\r | |
37 | \r | |
38 | EFI_STATUS\r | |
39 | EFIAPI\r | |
40 | PeimInitializeFlashMap (\r | |
baadbb84 | 41 | IN EFI_PEI_FILE_HANDLE FileHandle,\r |
42 | IN CONST EFI_PEI_SERVICES **PeiServices\r | |
804405e7 | 43 | )\r |
44 | /*++\r | |
45 | \r | |
46 | Routine Description:\r | |
47 | Build GUIDed HOBs for platform specific flash map\r | |
48 | \r | |
49 | Arguments:\r | |
50 | FfsHeader - A pointer to the EFI_FFS_FILE_HEADER structure.\r | |
51 | PeiServices - General purpose services available to every PEIM.\r | |
52 | \r | |
53 | Returns:\r | |
54 | EFI_STATUS\r | |
55 | \r | |
56 | --*/\r | |
57 | // TODO: EFI_SUCCESS - add return value to function comment\r | |
58 | {\r | |
59 | EFI_STATUS Status;\r | |
7ee3b613 | 60 | UNIX_FWH_PPI *UnixFwhPpi;\r |
804405e7 | 61 | EFI_PEI_PPI_DESCRIPTOR *PpiDescriptor;\r |
62 | EFI_PHYSICAL_ADDRESS FdBase;\r | |
7ee3b613 | 63 | EFI_PHYSICAL_ADDRESS FdFixUp;\r |
804405e7 | 64 | UINT64 FdSize;\r |
65 | \r | |
66 | DEBUG ((EFI_D_ERROR, "NT 32 Flash Map PEIM Loaded\n"));\r | |
67 | \r | |
68 | //\r | |
69 | // Get the Fwh Information PPI\r | |
70 | //\r | |
71 | Status = PeiServicesLocatePpi (\r | |
72 | &gUnixFwhPpiGuid, // GUID\r | |
73 | 0, // INSTANCE\r | |
74 | &PpiDescriptor, // EFI_PEI_PPI_DESCRIPTOR\r | |
75 | (VOID **)&UnixFwhPpi // PPI\r | |
76 | );\r | |
77 | ASSERT_EFI_ERROR (Status);\r | |
78 | \r | |
79 | //\r | |
80 | // Assume that FD0 contains the Flash map.\r | |
81 | //\r | |
7ee3b613 | 82 | Status = UnixFwhPpi->UnixFwh (0, &FdBase, &FdSize, &FdFixUp);\r |
804405e7 | 83 | if (EFI_ERROR (Status)) {\r |
84 | return Status;\r | |
85 | }\r | |
86 | \r | |
7ee3b613 A |
87 | PcdSet32 (PcdFlashNvStorageVariableBase, PcdGet32 (PcdUnixFlashNvStorageVariableBase) + (UINT32)FdFixUp);\r |
88 | PcdSet32 (PcdFlashNvStorageFtwWorkingBase, PcdGet32 (PcdUnixFlashNvStorageFtwWorkingBase) + (UINT32)FdFixUp);\r | |
89 | PcdSet32 (PcdFlashNvStorageFtwSpareBase, PcdGet32 (PcdUnixFlashNvStorageFtwSpareBase) + (UINT32)FdFixUp);\r | |
804405e7 | 90 | \r |
91 | return EFI_SUCCESS;\r | |
92 | }\r |