]> git.proxmox.com Git - mirror_edk2.git/blob - EmulatorPkg/FlashMapPei/FlashMapPei.c
NetworkPkg: remove unnecessary timeout event when setting IPv6 address.
[mirror_edk2.git] / EmulatorPkg / FlashMapPei / FlashMapPei.c
1 /*++ @file
2 PEIM to build GUIDed HOBs for platform specific flash map
3
4 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
5 Portions copyright (c) 2011, Apple Inc. All rights reserved.
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14 **/
15
16
17 #include "PiPei.h"
18
19 #include <Guid/SystemNvDataGuid.h>
20 #include <Ppi/EmuThunk.h>
21
22 #include <Library/DebugLib.h>
23 #include <Library/PeimEntryPoint.h>
24 #include <Library/HobLib.h>
25 #include <Library/PeiServicesLib.h>
26 #include <Library/PeiServicesTablePointerLib.h>
27 #include <Library/BaseMemoryLib.h>
28 #include <Library/PcdLib.h>
29
30 EFI_STATUS
31 EFIAPI
32 PeimInitializeFlashMap (
33 IN EFI_PEI_FILE_HANDLE FileHandle,
34 IN CONST EFI_PEI_SERVICES **PeiServices
35 )
36 /*++
37
38 Routine Description:
39 Build GUIDed HOBs for platform specific flash map
40
41 Arguments:
42 FfsHeader - A pointer to the EFI_FFS_FILE_HEADER structure.
43 PeiServices - General purpose services available to every PEIM.
44
45 Returns:
46 EFI_STATUS
47
48 **/
49 {
50 EFI_STATUS Status;
51 EMU_THUNK_PPI *Thunk;
52 EFI_PEI_PPI_DESCRIPTOR *PpiDescriptor;
53 EFI_PHYSICAL_ADDRESS FdBase;
54 EFI_PHYSICAL_ADDRESS FdFixUp;
55 UINT64 FdSize;
56
57 DEBUG ((EFI_D_ERROR, "EmulatorPkg Flash Map PEIM Loaded\n"));
58
59 //
60 // Get the Fwh Information PPI
61 //
62 Status = PeiServicesLocatePpi (
63 &gEmuThunkPpiGuid, // GUID
64 0, // INSTANCE
65 &PpiDescriptor, // EFI_PEI_PPI_DESCRIPTOR
66 (VOID **)&Thunk // PPI
67 );
68 ASSERT_EFI_ERROR (Status);
69
70 //
71 // Assume that FD0 contains the Flash map.
72 //
73 Status = Thunk->FirmwareDevices (0, &FdBase, &FdSize, &FdFixUp);
74 if (EFI_ERROR (Status)) {
75 return Status;
76 }
77
78 PcdSet64 (PcdFlashNvStorageVariableBase64, PcdGet64 (PcdEmuFlashNvStorageVariableBase) + FdFixUp);
79 PcdSet64 (PcdFlashNvStorageFtwWorkingBase64, PcdGet64 (PcdEmuFlashNvStorageFtwWorkingBase) + FdFixUp);
80 PcdSet64 (PcdFlashNvStorageFtwSpareBase64, PcdGet64 (PcdEmuFlashNvStorageFtwSpareBase) + FdFixUp);
81
82 return EFI_SUCCESS;
83 }