3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 PEIM to abstract construction of firmware volume in an Unix environment.
23 #include <FlashLayout.h>
28 PeimInitializeUnixFwh (
29 IN EFI_FFS_FILE_HEADER
*FfsHeader
,
30 IN EFI_PEI_SERVICES
**PeiServices
35 Perform a call-back into the SEC simulator to get address of the Firmware Hub
38 FfsHeader - Ffs Header availible to every PEIM
39 PeiServices - General purpose services available to every PEIM.
47 EFI_PEI_PPI_DESCRIPTOR
*PpiDescriptor
;
49 EFI_PHYSICAL_ADDRESS FdBase
;
50 EFI_FIRMWARE_VOLUME_HEADER
*FvHeader
;
54 DEBUG ((EFI_D_ERROR
, "Unix Firmware Volume PEIM Loaded\n"));
57 // Get the Fwh Information PPI
59 Status
= (**PeiServices
).LocatePpi (
61 &gUnixFwhPpiGuid
, // GUID
63 &PpiDescriptor
, // EFI_PEI_PPI_DESCRIPTOR
64 (VOID
**)&FwhPpi
// PPI
66 ASSERT_EFI_ERROR (Status
);
71 // Get information about all the FD's in the system
73 Status
= FwhPpi
->UnixFwh (Index
, &FdBase
, &FdSize
);
74 if (!EFI_ERROR (Status
)) {
76 // Assume the FD starts with an FV header
78 FvHeader
= (EFI_FIRMWARE_VOLUME_HEADER
*) (UINTN
) FdBase
;
81 // Make an FV Hob for the first FV in the FD
83 BuildFvHob (FdBase
, FvHeader
->FvLength
);
87 // Assume the first FD was produced by the NT32.DSC
88 // All these strange offests are needed to keep in
89 // sync with the FlashMap and NT32.dsc file
91 BuildResourceDescriptorHob (
92 EFI_RESOURCE_FIRMWARE_DEVICE
,
93 (EFI_RESOURCE_ATTRIBUTE_PRESENT
| EFI_RESOURCE_ATTRIBUTE_INITIALIZED
| EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE
),
95 (FvHeader
->FvLength
+ EFI_WINNT_RUNTIME_UPDATABLE_LENGTH
+ EFI_WINNT_FTW_SPARE_BLOCK_LENGTH
)
99 // Hard code the address of the spare block and variable services.
100 // Assume it's a hard coded offset from FV0 in FD0.
102 FdBase
= FdBase
+ EFI_WINNT_RUNTIME_UPDATABLE_OFFSET
;
103 FdSize
= EFI_WINNT_RUNTIME_UPDATABLE_LENGTH
+ EFI_WINNT_FTW_SPARE_BLOCK_LENGTH
;
105 BuildFvHob (FdBase
, FdSize
);
108 // For other FD's just map them in.
110 BuildResourceDescriptorHob (
111 EFI_RESOURCE_FIRMWARE_DEVICE
,
112 (EFI_RESOURCE_ATTRIBUTE_PRESENT
| EFI_RESOURCE_ATTRIBUTE_INITIALIZED
| EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE
),
120 } while (!EFI_ERROR (Status
));