Port EdkUnixPkg to UnixPkg. The changes are listed as follows:
1. change *.msa to *.inf, and create platform configuration files .dec&.dsc&.fdf to comply with Edk2 build process 2. using PCD mechanism to replace macro. 3. change Sec code to cowork with PI1.0 Pei Core and produce temparory memory ppi. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5380 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
91
UnixPkg/UnixFlashMapPei/FlashMap.c
Normal file
91
UnixPkg/UnixFlashMapPei/FlashMap.c
Normal file
@@ -0,0 +1,91 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006 - 2008, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
FlashMap.c
|
||||
|
||||
Abstract:
|
||||
|
||||
PEIM to build GUIDed HOBs for platform specific flash map
|
||||
|
||||
--*/
|
||||
|
||||
|
||||
#include "PiPei.h"
|
||||
|
||||
#include <Guid/SystemNvDataGuid.h>
|
||||
#include <Guid/FirmwareFileSystem.h>
|
||||
#include <Ppi/UnixFwh.h>
|
||||
#include <Protocol/FirmwareVolumeBlock.h>
|
||||
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/PeimEntryPoint.h>
|
||||
#include <Library/HobLib.h>
|
||||
#include <Library/PeiServicesLib.h>
|
||||
#include <Library/PeiServicesTablePointerLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/PcdLib.h>
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PeimInitializeFlashMap (
|
||||
IN EFI_FFS_FILE_HEADER *FfsHeader,
|
||||
IN EFI_PEI_SERVICES **PeiServices
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Build GUIDed HOBs for platform specific flash map
|
||||
|
||||
Arguments:
|
||||
FfsHeader - A pointer to the EFI_FFS_FILE_HEADER structure.
|
||||
PeiServices - General purpose services available to every PEIM.
|
||||
|
||||
Returns:
|
||||
EFI_STATUS
|
||||
|
||||
--*/
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UNIX_FWH_PPI *UnixFwhPpi;
|
||||
EFI_PEI_PPI_DESCRIPTOR *PpiDescriptor;
|
||||
EFI_PHYSICAL_ADDRESS FdBase;
|
||||
UINT64 FdSize;
|
||||
|
||||
DEBUG ((EFI_D_ERROR, "NT 32 Flash Map PEIM Loaded\n"));
|
||||
|
||||
//
|
||||
// Get the Fwh Information PPI
|
||||
//
|
||||
Status = PeiServicesLocatePpi (
|
||||
&gUnixFwhPpiGuid, // GUID
|
||||
0, // INSTANCE
|
||||
&PpiDescriptor, // EFI_PEI_PPI_DESCRIPTOR
|
||||
(VOID **)&UnixFwhPpi // PPI
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// Assume that FD0 contains the Flash map.
|
||||
//
|
||||
Status = UnixFwhPpi->UnixFwh (0, &FdBase, &FdSize);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
PcdSet32 (PcdFlashNvStorageVariableBase, PcdGet32 (PcdUnixFlashNvStorageVariableBase) + (UINT32) FdBase);
|
||||
PcdSet32 (PcdFlashNvStorageFtwWorkingBase, PcdGet32 (PcdUnixFlashNvStorageFtwWorkingBase) + (UINT32) FdBase);
|
||||
PcdSet32 (PcdFlashNvStorageFtwSpareBase, PcdGet32 (PcdUnixFlashNvStorageFtwSpareBase) + (UINT32) FdBase);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
82
UnixPkg/UnixFlashMapPei/FlashMap.inf
Normal file
82
UnixPkg/UnixFlashMapPei/FlashMap.inf
Normal file
@@ -0,0 +1,82 @@
|
||||
#/** @file
|
||||
# Component description file for FlashMap PEI module
|
||||
#
|
||||
# This module installs FlashMap PPI which is used to get flash layout information.
|
||||
# Copyright (c) 2006, Intel Corporation
|
||||
#
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#
|
||||
#
|
||||
#**/
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = PeiFlashMap
|
||||
FILE_GUID = f417814a-8985-11db-8983-0040d02b1835
|
||||
MODULE_TYPE = PEIM
|
||||
VERSION_STRING = 1.0
|
||||
EDK_RELEASE_VERSION = 0x00020000
|
||||
EFI_SPECIFICATION_VERSION = 0x00020000
|
||||
|
||||
ENTRY_POINT = PeimInitializeFlashMap
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
||||
#
|
||||
|
||||
[Sources.common]
|
||||
FlashMap.c
|
||||
|
||||
[Packages]
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
MdePkg/MdePkg.dec
|
||||
IntelFrameworkPkg/IntelFrameworkPkg.dec
|
||||
UnixPkg/UnixPkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
PcdLib
|
||||
BaseMemoryLib
|
||||
PeiServicesTablePointerLib
|
||||
PeiServicesLib
|
||||
HobLib
|
||||
PeimEntryPoint
|
||||
DebugLib
|
||||
|
||||
|
||||
[Guids]
|
||||
gEfiSystemNvDataHobGuid # ALWAYS_CONSUMED
|
||||
gEfiFirmwareFileSystemGuid # ALWAYS_CONSUMED
|
||||
gEfiFlashMapHobGuid # ALWAYS_CONSUMED
|
||||
|
||||
|
||||
[Protocols]
|
||||
gEfiFirmwareVolumeBlockProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
|
||||
|
||||
[Ppis]
|
||||
gUnixFwhPpiGuid # PPI ALWAYS_CONSUMED
|
||||
gPeiFlashMapPpiGuid # PPI ALWAYS_PRODUCED
|
||||
|
||||
|
||||
[Pcd.common]
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase
|
||||
|
||||
gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashNvStorageFtwWorkingBase
|
||||
gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashNvStorageFtwSpareBase
|
||||
gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashNvStorageVariableBase
|
||||
|
||||
[Depex]
|
||||
gPcdPpiGuid
|
||||
|
126
UnixPkg/UnixFlashMapPei/FlashMap.msa
Normal file
126
UnixPkg/UnixFlashMapPei/FlashMap.msa
Normal file
@@ -0,0 +1,126 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">
|
||||
<MsaHeader>
|
||||
<ModuleName>PeiFlashMap</ModuleName>
|
||||
<ModuleType>PEIM</ModuleType>
|
||||
<GuidValue>f417814a-8985-11db-8983-0040d02b1835</GuidValue>
|
||||
<Version>1.0</Version>
|
||||
<Abstract>Component description file for FlashMap PEI module</Abstract>
|
||||
<Description>This module installs FlashMap PPI which is used to get flash layout information.</Description>
|
||||
<Copyright>Copyright (c) 2006, Intel Corporation</Copyright>
|
||||
<License>All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
|
||||
<Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
|
||||
</MsaHeader>
|
||||
<ModuleDefinitions>
|
||||
<SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
|
||||
<BinaryModule>false</BinaryModule>
|
||||
<OutputFileBasename>PeiFlashMap</OutputFileBasename>
|
||||
</ModuleDefinitions>
|
||||
<LibraryClassDefinitions>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>DebugLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>PeimEntryPoint</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>HobLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>PeiServicesLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>PeiServicesTablePointerLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>BaseMemoryLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>PcdLib</Keyword>
|
||||
</LibraryClass>
|
||||
</LibraryClassDefinitions>
|
||||
<SourceFiles>
|
||||
<Filename>FlashMap.c</Filename>
|
||||
<Filename>FlashMap.dxs</Filename>
|
||||
</SourceFiles>
|
||||
<PackageDependencies>
|
||||
<Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
|
||||
<Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
|
||||
<Package PackageGuid="f2805c44-8985-11db-9e98-0040d02b1835"/>
|
||||
</PackageDependencies>
|
||||
<Protocols>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiFirmwareVolumeBlockProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
</Protocols>
|
||||
<PPIs>
|
||||
<Ppi Usage="ALWAYS_PRODUCED">
|
||||
<PpiCName>gPeiFlashMapPpiGuid</PpiCName>
|
||||
</Ppi>
|
||||
<Ppi Usage="ALWAYS_CONSUMED">
|
||||
<PpiCName>gUnixFwhPpiGuid</PpiCName>
|
||||
</Ppi>
|
||||
</PPIs>
|
||||
<Guids>
|
||||
<GuidCNames Usage="ALWAYS_CONSUMED">
|
||||
<GuidCName>gEfiFlashMapHobGuid</GuidCName>
|
||||
</GuidCNames>
|
||||
<GuidCNames Usage="ALWAYS_CONSUMED">
|
||||
<GuidCName>gEfiFirmwareFileSystemGuid</GuidCName>
|
||||
</GuidCNames>
|
||||
<GuidCNames Usage="ALWAYS_CONSUMED">
|
||||
<GuidCName>gEfiSystemNvDataHobGuid</GuidCName>
|
||||
</GuidCNames>
|
||||
</Guids>
|
||||
<Externs>
|
||||
<Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
|
||||
<Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
|
||||
<Extern>
|
||||
<ModuleEntryPoint>PeimInitializeFlashMap</ModuleEntryPoint>
|
||||
</Extern>
|
||||
</Externs>
|
||||
<PcdCoded>
|
||||
<PcdEntry PcdItemType="DYNAMIC">
|
||||
<C_Name>PcdFlashNvStorageVariableBase</C_Name>
|
||||
<TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
|
||||
<HelpText>The driver sets the NV Storage FV base address defined by this PCD.
|
||||
This base address point to an EFI_FIRMWARE_VOLUMN_HEADER struct. Variable PEIM
|
||||
will get the base address from this PCD. In NT emulator, this PCD is a DYNAMIC
|
||||
type, as FD is mapped to process space by WinNT OS. On real platform, it is
|
||||
normally a FIXED_AT_BUILD type as system memory map is fixed to BIOS.
|
||||
</HelpText>
|
||||
</PcdEntry>
|
||||
<PcdEntry PcdItemType="DYNAMIC">
|
||||
<C_Name>PcdFlashNvStorageVariableSize</C_Name>
|
||||
<TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
|
||||
<HelpText>
|
||||
To get the NvStorage Variable size from this PCD.
|
||||
</HelpText>
|
||||
</PcdEntry>
|
||||
<PcdEntry PcdItemType="DYNAMIC" Usage="ALWAYS_CONSUMED">
|
||||
<C_Name>PcdFlashNvStorageFtwSpareBase</C_Name>
|
||||
<TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
|
||||
<HelpText>To get base address of the FTW spare block section in NV firmware volume.</HelpText>
|
||||
</PcdEntry>
|
||||
<PcdEntry PcdItemType="DYNAMIC" Usage="ALWAYS_CONSUMED">
|
||||
<C_Name>PcdFlashNvStorageFtwSpareSize</C_Name>
|
||||
<TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
|
||||
<HelpText>To get size of the FTW spare block section in NV firmware volume.</HelpText>
|
||||
</PcdEntry>
|
||||
<PcdEntry PcdItemType="DYNAMIC" Usage="ALWAYS_CONSUMED">
|
||||
<C_Name>PcdFlashNvStorageFtwWorkingBase</C_Name>
|
||||
<TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
|
||||
<HelpText>To get base address of the FTW working block section in NV firmware volume.</HelpText>
|
||||
</PcdEntry>
|
||||
<PcdEntry PcdItemType="DYNAMIC" Usage="ALWAYS_CONSUMED">
|
||||
<C_Name>PcdFlashNvStorageFtwWorkingSize</C_Name>
|
||||
<TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
|
||||
<HelpText>To get size of the FTW working block section in NV firmware volume.</HelpText>
|
||||
</PcdEntry>
|
||||
</PcdCoded>
|
||||
</ModuleSurfaceArea>
|
Reference in New Issue
Block a user