]> git.proxmox.com Git - mirror_edk2.git/blame - UnixPkg/UnixFlashMapPei/FlashMap.c
Reviewed the code comments in the Include/Protocol directory for typos, grammar issue...
[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
60 UNIX_FWH_PPI *UnixFwhPpi;\r
61 EFI_PEI_PPI_DESCRIPTOR *PpiDescriptor;\r
62 EFI_PHYSICAL_ADDRESS FdBase;\r
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
81 Status = UnixFwhPpi->UnixFwh (0, &FdBase, &FdSize);\r
82 if (EFI_ERROR (Status)) {\r
83 return Status;\r
84 }\r
85 \r
86 PcdSet32 (PcdFlashNvStorageVariableBase, PcdGet32 (PcdUnixFlashNvStorageVariableBase) + (UINT32) FdBase);\r
87 PcdSet32 (PcdFlashNvStorageFtwWorkingBase, PcdGet32 (PcdUnixFlashNvStorageFtwWorkingBase) + (UINT32) FdBase);\r
88 PcdSet32 (PcdFlashNvStorageFtwSpareBase, PcdGet32 (PcdUnixFlashNvStorageFtwSpareBase) + (UINT32) FdBase);\r
89\r
90 return EFI_SUCCESS;\r
91}\r