]> git.proxmox.com Git - mirror_edk2.git/blame - UnixPkg/UnixFlashMapPei/FlashMap.c
Partial checkin fixing Beagle references
[mirror_edk2.git] / UnixPkg / UnixFlashMapPei / FlashMap.c
CommitLineData
804405e7 1/*++\r
2\r
c029854f 3Copyright (c) 2006 - 2010, Intel Corporation \r
804405e7 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
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
37EFI_STATUS\r
38EFIAPI\r
39PeimInitializeFlashMap (\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
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
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
65 DEBUG ((EFI_D_ERROR, "NT 32 Flash Map PEIM Loaded\n"));\r
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
7ee3b613
A
86 PcdSet32 (PcdFlashNvStorageVariableBase, PcdGet32 (PcdUnixFlashNvStorageVariableBase) + (UINT32)FdFixUp);\r
87 PcdSet32 (PcdFlashNvStorageFtwWorkingBase, PcdGet32 (PcdUnixFlashNvStorageFtwWorkingBase) + (UINT32)FdFixUp);\r
88 PcdSet32 (PcdFlashNvStorageFtwSpareBase, PcdGet32 (PcdUnixFlashNvStorageFtwSpareBase) + (UINT32)FdFixUp);\r
804405e7 89\r
90 return EFI_SUCCESS;\r
91}\r