]> git.proxmox.com Git - mirror_edk2.git/blame - UnixPkg/UnixFlashMapPei/FlashMap.c
Added support for Xcode on Snow Leopard. Upaded with bug fixes for Snow Leopard.
[mirror_edk2.git] / UnixPkg / UnixFlashMapPei / FlashMap.c
CommitLineData
804405e7 1/*++\r
2\r
3Copyright (c) 2006 - 2008, 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
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
38EFI_STATUS\r
39EFIAPI\r
40PeimInitializeFlashMap (\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
46Routine Description:\r
47 Build GUIDed HOBs for platform specific flash map\r
48 \r
49Arguments:\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
53Returns:\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