mirror of https://github.com/acidanthera/audk.git
Replace the FlashMapHob with PCD defined in FDF on Nt32 platform. Currently, the tool can not generate correct PCD value in FDF, so in the patch, we still define the flash layout PCDs in DSC for short term.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3544 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
c8db3056ec
commit
6d3aa33ed0
|
@ -649,6 +649,8 @@ InitializeFtwLite (
|
|||
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
__asm int 3;
|
||||
|
||||
ZeroMem (FtwLiteDevice, sizeof (EFI_FTW_LITE_DEVICE));
|
||||
FtwLiteDevice->Signature = FTW_LITE_DEVICE_SIGNATURE;
|
||||
|
||||
|
|
|
@ -1281,6 +1281,7 @@ Returns:
|
|||
// Get the DXE services table
|
||||
//
|
||||
DxeServices = gDS;
|
||||
__asm int 3;
|
||||
|
||||
//
|
||||
// Allocate runtime services data for global variable, which contains
|
||||
|
|
|
@ -48,10 +48,7 @@ Abstract:
|
|||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
|
||||
#include "FlashLayout.h"
|
||||
|
||||
#define FIRMWARE_BLOCK_SIZE 0x10000
|
||||
#include <Library/PcdLib.h>
|
||||
|
||||
typedef struct {
|
||||
UINT64 FvLength;
|
||||
|
@ -62,22 +59,18 @@ typedef struct {
|
|||
EFI_FV_BLOCK_MAP_ENTRY End[1];
|
||||
} EFI_FVB_MEDIA_INFO;
|
||||
|
||||
#define FVB_MEDIA_BLOCK_SIZE FIRMWARE_BLOCK_SIZE
|
||||
#define RECOVERY_BOIS_BLOCK_NUM FIRMWARE_BLOCK_NUMBER
|
||||
#define SYSTEM_NV_BLOCK_NUM 2
|
||||
|
||||
EFI_FVB_MEDIA_INFO mPlatformFvbMediaInfo[] = {
|
||||
//
|
||||
// Recovery BOIS FVB
|
||||
//
|
||||
{
|
||||
EFI_WINNT_FIRMWARE_LENGTH,
|
||||
FixedPcdGet32 (PcdWinNtFlashFvRecoverySize),
|
||||
{
|
||||
{
|
||||
0,
|
||||
}, // ZeroVector[16]
|
||||
EFI_FIRMWARE_FILE_SYSTEM2_GUID,
|
||||
FVB_MEDIA_BLOCK_SIZE * RECOVERY_BOIS_BLOCK_NUM,
|
||||
FixedPcdGet32 (PcdWinNtFlashFvRecoverySize),
|
||||
EFI_FVH_SIGNATURE,
|
||||
EFI_FVB2_READ_ENABLED_CAP |
|
||||
EFI_FVB2_READ_STATUS |
|
||||
|
@ -92,8 +85,8 @@ EFI_FVB_MEDIA_INFO mPlatformFvbMediaInfo[] = {
|
|||
}, // Reserved[1]
|
||||
1, // Revision
|
||||
{
|
||||
RECOVERY_BOIS_BLOCK_NUM,
|
||||
FVB_MEDIA_BLOCK_SIZE,
|
||||
FixedPcdGet32 (PcdWinNtFlashFvRecoverySize)/FixedPcdGet32 (PcdWinNtFirmwareBlockSize),
|
||||
FixedPcdGet32 (PcdWinNtFirmwareBlockSize),
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -105,13 +98,19 @@ EFI_FVB_MEDIA_INFO mPlatformFvbMediaInfo[] = {
|
|||
// Systen NvStorage FVB
|
||||
//
|
||||
{
|
||||
EFI_WINNT_RUNTIME_UPDATABLE_LENGTH + EFI_WINNT_FTW_SPARE_BLOCK_LENGTH,
|
||||
FixedPcdGet32 (PcdFlashNvStorageVariableSize) +
|
||||
FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize) +
|
||||
FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize) +
|
||||
FixedPcdGet32 (PcdWinNtFlashNvStorageEventLogSize),
|
||||
{
|
||||
{
|
||||
0,
|
||||
}, // ZeroVector[16]
|
||||
EFI_SYSTEM_NV_DATA_HOB_GUID,
|
||||
FVB_MEDIA_BLOCK_SIZE * SYSTEM_NV_BLOCK_NUM,
|
||||
FixedPcdGet32 (PcdFlashNvStorageVariableSize) +
|
||||
FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize) +
|
||||
FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize) +
|
||||
FixedPcdGet32 (PcdWinNtFlashNvStorageEventLogSize),
|
||||
EFI_FVH_SIGNATURE,
|
||||
EFI_FVB2_READ_ENABLED_CAP |
|
||||
EFI_FVB2_READ_STATUS |
|
||||
|
@ -126,8 +125,11 @@ EFI_FVB_MEDIA_INFO mPlatformFvbMediaInfo[] = {
|
|||
}, // Reserved[1]
|
||||
1, // Revision
|
||||
{
|
||||
SYSTEM_NV_BLOCK_NUM,
|
||||
FVB_MEDIA_BLOCK_SIZE,
|
||||
(FixedPcdGet32 (PcdFlashNvStorageVariableSize) +
|
||||
FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize) +
|
||||
FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize) +
|
||||
FixedPcdGet32 (PcdWinNtFlashNvStorageEventLogSize)) / FixedPcdGet32 (PcdWinNtFirmwareBlockSize),
|
||||
FixedPcdGet32 (PcdWinNtFirmwareBlockSize),
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
BaseLib
|
||||
UefiDriverEntryPoint
|
||||
UefiLib
|
||||
PcdLib
|
||||
|
||||
|
||||
[Guids]
|
||||
|
@ -66,5 +67,21 @@
|
|||
gEfiFirmwareVolumeBlockProtocolGuid # PROTOCOL ALWAYS_PRODUCED
|
||||
gEfiDevicePathProtocolGuid # PROTOCOL SOMETIMES_PRODUCED
|
||||
|
||||
[PcdsFixedAtBuild.common]
|
||||
PcdWinNtFirmwareFdSize|gEfiNt32PkgTokenSpaceGuid
|
||||
PcdWinNtFirmwareBlockSize|gEfiNt32PkgTokenSpaceGuid
|
||||
|
||||
PcdWinNtFlashFvRecoveryBase|gEfiNt32PkgTokenSpaceGuid
|
||||
PcdWinNtFlashFvRecoverySize|gEfiNt32PkgTokenSpaceGuid
|
||||
PcdWinNtFlashNvStorageEventLogBase|gEfiNt32PkgTokenSpaceGuid
|
||||
PcdWinNtFlashNvStorageEventLogSize|gEfiNt32PkgTokenSpaceGuid
|
||||
|
||||
PcdFlashNvStorageFtwWorkingSize|gEfiMdeModulePkgTokenSpaceGuid
|
||||
PcdFlashNvStorageFtwWorkingBase|gEfiMdeModulePkgTokenSpaceGuid
|
||||
PcdFlashNvStorageFtwSpareSize|gEfiMdeModulePkgTokenSpaceGuid
|
||||
PcdFlashNvStorageFtwSpareBase|gEfiMdeModulePkgTokenSpaceGuid
|
||||
PcdFlashNvStorageVariableSize|gEfiMdeModulePkgTokenSpaceGuid
|
||||
PcdFlashNvStorageVariableBase|gEfiMdeModulePkgTokenSpaceGuid
|
||||
|
||||
[depex]
|
||||
TRUE
|
|
@ -1,64 +0,0 @@
|
|||
/*++
|
||||
|
||||
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.
|
||||
|
||||
Module Name:
|
||||
|
||||
FlashLayout.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Platform specific flash layout
|
||||
|
||||
BugBug: We need a better way
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef __EFI_FLASH_LAYOUT__
|
||||
#define __EFI_FLASH_LAYOUT__
|
||||
|
||||
//
|
||||
// Firmware Volume Information for Nt32
|
||||
// adding one working block before FFS FV,
|
||||
// and another one for spare block behind FFS FV
|
||||
//
|
||||
//
|
||||
// Note: When block number is changed in .dsc file,
|
||||
// this value should be changed accordingly!!!
|
||||
//
|
||||
#define FIRMWARE_BLOCK_NUMBER 0x28
|
||||
|
||||
#define EFI_WINNT_FIRMWARE_OFFSET 0x0
|
||||
#define EFI_WINNT_FIRMWARE_LENGTH (0x10000 * FIRMWARE_BLOCK_NUMBER)
|
||||
|
||||
#define EFI_WINNT_RUNTIME_UPDATABLE_OFFSET (EFI_WINNT_FIRMWARE_OFFSET + EFI_WINNT_FIRMWARE_LENGTH)
|
||||
|
||||
#define EFI_WINNT_RUNTIME_UPDATABLE_LENGTH 0x10000
|
||||
|
||||
#define EFI_WINNT_FTW_SPARE_BLOCK_OFFSET (EFI_WINNT_RUNTIME_UPDATABLE_OFFSET + EFI_WINNT_RUNTIME_UPDATABLE_LENGTH)
|
||||
|
||||
#define EFI_WINNT_FTW_SPARE_BLOCK_LENGTH 0x10000
|
||||
|
||||
#define EFI_WINNT_RUNTIME_UPDATABLE_FV_HEADER_LENGTH 0x48
|
||||
|
||||
#define EFI_VARIABLE_STORE_OFFSET EFI_WINNT_RUNTIME_UPDATABLE_OFFSET
|
||||
|
||||
#define EFI_VARIABLE_STORE_LENGTH 0x00C000
|
||||
|
||||
#define EFI_EVENT_LOG_OFFSET (EFI_VARIABLE_STORE_OFFSET + EFI_VARIABLE_STORE_LENGTH)
|
||||
|
||||
#define EFI_EVENT_LOG_LENGTH 0x002000
|
||||
|
||||
#define EFI_FTW_WORKING_OFFSET (EFI_EVENT_LOG_OFFSET + EFI_EVENT_LOG_LENGTH)
|
||||
|
||||
#define EFI_FTW_WORKING_LENGTH 0x002000
|
||||
|
||||
#endif
|
||||
|
|
@ -105,6 +105,17 @@
|
|||
PcdWinNtFirmwareVolume|0x00001009|gEfiNt32PkgTokenSpaceGuid|VOID*|L"..\\Fv\\Fv_Recovery.fd"
|
||||
PcdWinNtMemorySizeForSecMain|0x0000100c|gEfiNt32PkgTokenSpaceGuid|VOID*|L"64!64"
|
||||
|
||||
PcdWinNtFlashNvStorageEventLogBase|0x0000100e|gEfiNt32PkgTokenSpaceGuid|UINT32|0x0
|
||||
PcdWinNtFlashNvStorageEventLogSize|0x0000100f|gEfiNt32PkgTokenSpaceGuid|UINT32|0x0
|
||||
PcdWinNtFlashFvRecoveryBase|0x00001010|gEfiNt32PkgTokenSpaceGuid|UINT32|0x0
|
||||
PcdWinNtFlashFvRecoverySize|0x00001011|gEfiNt32PkgTokenSpaceGuid|UINT32|0x0
|
||||
PcdWinNtFirmwareFdSize|0x00001012|gEfiNt32PkgTokenSpaceGuid|UINT32|0x0
|
||||
PcdWinNtFirmwareBlockSize|0x00001013|gEfiNt32PkgTokenSpaceGuid|UINT32|0
|
||||
|
||||
PcdWinNtFlashNvStorageVariableBase|0x00001014|gEfiNt32PkgTokenSpaceGuid|UINT32|0x0
|
||||
PcdWinNtFlashNvStorageFtwSpareBase|0x00001015|gEfiNt32PkgTokenSpaceGuid|UINT32|0x0
|
||||
PcdWinNtFlashNvStorageFtwWorkingBase|0x00001016|gEfiNt32PkgTokenSpaceGuid|UINT32|0x0
|
||||
|
||||
[PcdsDynamic.common]
|
||||
PcdWinNtPhysicalDisk|0x00001000|gEfiNt32PkgTokenSpaceGuid|VOID*|L"E:RW;245760;512"
|
||||
PcdWinNtVirtualDisk|0x00001001|gEfiNt32PkgTokenSpaceGuid|VOID*|L"FW;40960;512"
|
||||
|
|
|
@ -273,6 +273,21 @@
|
|||
PcdStatusCodeValueUncorrectableMemoryError|gEfiMdePkgTokenSpaceGuid|0x00051003
|
||||
PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320
|
||||
|
||||
PcdWinNtFirmwareFdSize|gEfiNt32PkgTokenSpaceGuid|0x2a0000
|
||||
PcdWinNtFirmwareBlockSize|gEfiNt32PkgTokenSpaceGuid|0x10000
|
||||
PcdWinNtFlashNvStorageEventLogBase|gEfiNt32PkgTokenSpaceGuid|0x28c000
|
||||
PcdWinNtFlashNvStorageEventLogSize|gEfiNt32PkgTokenSpaceGuid|0x2000
|
||||
PcdWinNtFlashFvRecoveryBase|gEfiNt32PkgTokenSpaceGuid|0x0
|
||||
PcdWinNtFlashFvRecoverySize|gEfiNt32PkgTokenSpaceGuid|0x280000
|
||||
|
||||
PcdWinNtFlashNvStorageVariableBase|gEfiNt32PkgTokenSpaceGuid|0x280000
|
||||
PcdWinNtFlashNvStorageFtwSpareBase|gEfiNt32PkgTokenSpaceGuid|0x290000
|
||||
PcdWinNtFlashNvStorageFtwWorkingBase|gEfiNt32PkgTokenSpaceGuid|0x28e000
|
||||
|
||||
PcdFlashNvStorageFtwSpareSize|gEfiMdeModulePkgTokenSpaceGuid|0x10000
|
||||
PcdFlashNvStorageFtwWorkingSize|gEfiMdeModulePkgTokenSpaceGuid|0x2000
|
||||
PcdFlashNvStorageVariableSize|gEfiMdeModulePkgTokenSpaceGuid|0x00c000
|
||||
|
||||
[PcdsFeatureFlag.IA32]
|
||||
PcdPeiPcdDatabaseTraverseEnabled|gEfiMdeModulePkgTokenSpaceGuid|TRUE
|
||||
PcdPeiPcdDatabaseCallbackOnSetEnabled|gEfiMdeModulePkgTokenSpaceGuid|TRUE
|
||||
|
@ -329,12 +344,10 @@
|
|||
PcdWinNtMemorySize|gEfiNt32PkgTokenSpaceGuid|L"64!64"|10
|
||||
PcdWinNtPhysicalDisk|gEfiNt32PkgTokenSpaceGuid|L"a:RW;2880;512!e:RW;262144;512"|58
|
||||
PcdWinNtUga|gEfiNt32PkgTokenSpaceGuid|L"UGA Window 1!UGA Window 2"|50
|
||||
PcdFlashNvStorageFtwSpareBase|gEfiMdeModulePkgTokenSpaceGuid|0x0
|
||||
PcdFlashNvStorageFtwSpareSize|gEfiMdeModulePkgTokenSpaceGuid|0x280000
|
||||
PcdFlashNvStorageFtwWorkingBase|gEfiMdeModulePkgTokenSpaceGuid|0x28e000
|
||||
PcdFlashNvStorageFtwWorkingSize|gEfiMdeModulePkgTokenSpaceGuid|0x2000
|
||||
PcdFlashNvStorageVariableBase|gEfiMdeModulePkgTokenSpaceGuid|0x280000
|
||||
PcdFlashNvStorageVariableSize|gEfiMdeModulePkgTokenSpaceGuid|0x00c000
|
||||
|
||||
PcdFlashNvStorageFtwSpareBase|gEfiMdeModulePkgTokenSpaceGuid|0
|
||||
PcdFlashNvStorageFtwWorkingBase|gEfiMdeModulePkgTokenSpaceGuid|0
|
||||
PcdFlashNvStorageVariableBase|gEfiMdeModulePkgTokenSpaceGuid|0
|
||||
|
||||
################################################################################
|
||||
#
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#
|
||||
################################################################################
|
||||
[FD.Fv_Recovery]
|
||||
BaseAddress = 0x0|PcdFdBaseAddress #The base address of the FLASH Device.
|
||||
BaseAddress = 0x0|PcdWinNtFdBaseAddress #The base address of the FLASH Device.
|
||||
Size = 0x002a0000 #The size in bytes of the FLASH Device
|
||||
ErasePolarity = 1
|
||||
BlockSize = 0x10000
|
||||
|
@ -47,11 +47,11 @@ NumBlocks = 0x2a
|
|||
#
|
||||
################################################################################
|
||||
0x00000000|0x00280000
|
||||
PcdFlashFvRecoveryBase|PcdFlashFvRecoverySize
|
||||
PcdWinNtFlashFvRecoveryBase|PcdWinNtFlashFvRecoverySize
|
||||
FV = FvRecovery
|
||||
|
||||
0x00280000|0x0000c000
|
||||
PcdFlashNvStorageBase|PcdFlashNvStorageSize
|
||||
PcdWinNtFlashNvStorageVariableBase|PcdFlashNvStorageVariableSize
|
||||
DATA = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
|
@ -67,10 +67,10 @@ DATA = {
|
|||
}
|
||||
|
||||
0x0028c000|0x00002000
|
||||
PcdFlashNvStorageEventLogBase|PcdFlashNvStorageEventLogSize
|
||||
PcdWinNtFlashNvStorageEventLogBase|PcdWinNtFlashNvStorageEventLogSize
|
||||
|
||||
0x0028e000|0x00002000
|
||||
PcdFlashNvStorageFtwWorkingBase|PcdFlashNvStorageFtwWorkingSize
|
||||
PcdWinNtFlashNvStorageFtwWorkingBase|PcdFlashNvStorageFtwWorkingSize
|
||||
DATA = {
|
||||
0x8d, 0x2b, 0xf1, 0xff, 0x96, 0x76, 0x8b, 0x4c,
|
||||
0xa9, 0x85, 0x27, 0x47, 0x07, 0x5b, 0x4f, 0x50,
|
||||
|
@ -79,7 +79,7 @@ DATA = {
|
|||
}
|
||||
|
||||
0x00290000|0x00010000
|
||||
PcdFlashNvStorageFtwSpareBase|PcdFlashNvStorageFtwSpareBase
|
||||
PcdWinNtFlashNvStorageFtwSpareBase|PcdFlashNvStorageFtwSpareSize
|
||||
|
||||
################################################################################
|
||||
#
|
||||
|
|
|
@ -44,9 +44,22 @@
|
|||
HobLib
|
||||
PeimEntryPoint
|
||||
DebugLib
|
||||
PcdLib
|
||||
|
||||
[Ppis]
|
||||
gNtFwhPpiGuid # PPI ALWAYS_CONSUMED
|
||||
|
||||
|
||||
[PcdsFixedAtBuild.common]
|
||||
PcdWinNtFlashFvRecoveryBase|gEfiNt32PkgTokenSpaceGuid
|
||||
PcdWinNtFlashFvRecoverySize|gEfiNt32PkgTokenSpaceGuid
|
||||
PcdWinNtFlashNvStorageEventLogBase|gEfiNt32PkgTokenSpaceGuid
|
||||
PcdWinNtFlashNvStorageEventLogSize|gEfiNt32PkgTokenSpaceGuid
|
||||
PcdWinNtFlashNvStorageVariableBase|gEfiNt32PkgTokenSpaceGuid
|
||||
|
||||
PcdFlashNvStorageFtwWorkingSize|gEfiMdeModulePkgTokenSpaceGuid
|
||||
PcdFlashNvStorageFtwSpareSize|gEfiMdeModulePkgTokenSpaceGuid
|
||||
PcdFlashNvStorageVariableSize|gEfiMdeModulePkgTokenSpaceGuid
|
||||
|
||||
[depex]
|
||||
gNtFwhPpiGuid AND gEfiPeiMemoryDiscoveredPpiGuid
|
|
@ -34,9 +34,7 @@ Revision History
|
|||
#include <Library/DebugLib.h>
|
||||
#include <Library/PeimEntryPoint.h>
|
||||
#include <Library/HobLib.h>
|
||||
|
||||
#include <FlashLayout.h>
|
||||
|
||||
#include <Library/PcdLib.h>
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
|
@ -68,6 +66,7 @@ Returns:
|
|||
|
||||
DEBUG ((EFI_D_ERROR, "NT 32 Firmware Volume PEIM Loaded\n"));
|
||||
|
||||
__asm int 3;
|
||||
//
|
||||
// Get the Fwh Information PPI
|
||||
//
|
||||
|
@ -107,15 +106,24 @@ Returns:
|
|||
EFI_RESOURCE_FIRMWARE_DEVICE,
|
||||
(EFI_RESOURCE_ATTRIBUTE_PRESENT | EFI_RESOURCE_ATTRIBUTE_INITIALIZED | EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE),
|
||||
FdBase,
|
||||
(FvHeader->FvLength + EFI_WINNT_RUNTIME_UPDATABLE_LENGTH + EFI_WINNT_FTW_SPARE_BLOCK_LENGTH)
|
||||
(
|
||||
FvHeader->FvLength +
|
||||
PcdGet32 (PcdFlashNvStorageVariableSize) +
|
||||
PcdGet32 (PcdFlashNvStorageFtwWorkingSize) +
|
||||
PcdGet32 (PcdFlashNvStorageFtwSpareSize) +
|
||||
PcdGet32 (PcdWinNtFlashNvStorageEventLogSize)
|
||||
)
|
||||
);
|
||||
|
||||
//
|
||||
// Hard code the address of the spare block and variable services.
|
||||
// Assume it's a hard coded offset from FV0 in FD0.
|
||||
//
|
||||
FdBase = FdBase + EFI_WINNT_RUNTIME_UPDATABLE_OFFSET;
|
||||
FdSize = EFI_WINNT_RUNTIME_UPDATABLE_LENGTH + EFI_WINNT_FTW_SPARE_BLOCK_LENGTH;
|
||||
FdBase = FdBase + PcdGet32 (PcdWinNtFlashNvStorageVariableBase);
|
||||
FdSize =
|
||||
PcdGet32 (PcdFlashNvStorageVariableSize) +
|
||||
PcdGet32 (PcdFlashNvStorageFtwWorkingSize) +
|
||||
PcdGet32 (PcdFlashNvStorageFtwSpareSize) +
|
||||
PcdGet32 (PcdWinNtFlashNvStorageEventLogSize);
|
||||
|
||||
BuildFvHob (FdBase, FdSize);
|
||||
} else {
|
||||
|
|
|
@ -19,122 +19,20 @@ Abstract:
|
|||
|
||||
--*/
|
||||
|
||||
|
||||
//
|
||||
// The package level header files this module uses
|
||||
//
|
||||
#include <PiPei.h>
|
||||
|
||||
#include <WinNtPeim.h>
|
||||
//
|
||||
// The protocols, PPI and GUID defintions for this module
|
||||
//
|
||||
#include <Ppi/NtFwh.h>
|
||||
#include <Guid/FirmwareFileSystem2.h>
|
||||
#include <Ppi/FlashMap.h>
|
||||
#include <Guid/FlashMapHob.h>
|
||||
#include <Guid/SystemNvDataGuid.h>
|
||||
#include <Protocol/FirmwareVolumeBlock.h>
|
||||
//
|
||||
// The Library classes this module consumes
|
||||
//
|
||||
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/PeimEntryPoint.h>
|
||||
#include <Library/HobLib.h>
|
||||
#include <Library/PeiServicesLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/PcdLib.h>
|
||||
|
||||
|
||||
#include <FlashLayout.h>
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GetAreaInfo (
|
||||
IN EFI_PEI_SERVICES **PeiServices,
|
||||
IN PEI_FLASH_MAP_PPI *This,
|
||||
IN EFI_FLASH_AREA_TYPE AreaType,
|
||||
IN EFI_GUID *AreaTypeGuid,
|
||||
OUT UINT32 *NumEntries,
|
||||
OUT EFI_FLASH_SUBAREA_ENTRY **Entries
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
MemoryDiscoveredPpiNotifyCallback (
|
||||
IN EFI_PEI_SERVICES **PeiServices,
|
||||
IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
|
||||
IN VOID *Ppi
|
||||
);
|
||||
|
||||
//
|
||||
// Module globals
|
||||
//
|
||||
static PEI_FLASH_MAP_PPI mFlashMapPpi = { GetAreaInfo };
|
||||
|
||||
static EFI_PEI_PPI_DESCRIPTOR mPpiListFlashMap = {
|
||||
(EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
|
||||
&gPeiFlashMapPpiGuid,
|
||||
&mFlashMapPpi
|
||||
};
|
||||
|
||||
static EFI_FLASH_AREA_DATA mFlashAreaData[] = {
|
||||
//
|
||||
// Variable area
|
||||
//
|
||||
{
|
||||
EFI_VARIABLE_STORE_OFFSET,
|
||||
EFI_VARIABLE_STORE_LENGTH,
|
||||
EFI_FLASH_AREA_SUBFV | EFI_FLASH_AREA_MEMMAPPED_FV,
|
||||
EFI_FLASH_AREA_EFI_VARIABLES,
|
||||
0, 0, 0,
|
||||
{ 0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
|
||||
},
|
||||
//
|
||||
// FTW spare (backup) block
|
||||
//
|
||||
{
|
||||
EFI_WINNT_FTW_SPARE_BLOCK_OFFSET,
|
||||
EFI_WINNT_FTW_SPARE_BLOCK_LENGTH,
|
||||
EFI_FLASH_AREA_SUBFV | EFI_FLASH_AREA_MEMMAPPED_FV,
|
||||
EFI_FLASH_AREA_FTW_BACKUP,
|
||||
0, 0, 0,
|
||||
{ 0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
|
||||
},
|
||||
//
|
||||
// FTW private working (state) area
|
||||
//
|
||||
{
|
||||
EFI_FTW_WORKING_OFFSET,
|
||||
EFI_FTW_WORKING_LENGTH,
|
||||
EFI_FLASH_AREA_SUBFV | EFI_FLASH_AREA_MEMMAPPED_FV,
|
||||
EFI_FLASH_AREA_FTW_STATE,
|
||||
0, 0, 0,
|
||||
{ 0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
|
||||
},
|
||||
//
|
||||
// Recovery FV
|
||||
//
|
||||
{
|
||||
EFI_WINNT_FIRMWARE_OFFSET,
|
||||
EFI_WINNT_FIRMWARE_LENGTH,
|
||||
EFI_FLASH_AREA_FV | EFI_FLASH_AREA_MEMMAPPED_FV,
|
||||
EFI_FLASH_AREA_RECOVERY_BIOS,
|
||||
0, 0, 0,
|
||||
{ 0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
|
||||
},
|
||||
//
|
||||
// System Non-Volatile Storage FV
|
||||
//
|
||||
{
|
||||
EFI_WINNT_RUNTIME_UPDATABLE_OFFSET,
|
||||
EFI_WINNT_RUNTIME_UPDATABLE_LENGTH + EFI_WINNT_FTW_SPARE_BLOCK_LENGTH,
|
||||
EFI_FLASH_AREA_FV | EFI_FLASH_AREA_MEMMAPPED_FV,
|
||||
EFI_FLASH_AREA_GUID_DEFINED,
|
||||
0, 0, 0,
|
||||
EFI_SYSTEM_NV_DATA_HOB_GUID
|
||||
},
|
||||
};
|
||||
|
||||
#include <Library/PeiServicesLib.h>
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
|
@ -159,22 +57,13 @@ Returns:
|
|||
{
|
||||
EFI_STATUS Status;
|
||||
NT_FWH_PPI *NtFwhPpi;
|
||||
EFI_PEI_PPI_DESCRIPTOR *PpiDescriptor;
|
||||
EFI_PHYSICAL_ADDRESS FdBase;
|
||||
UINT64 FdSize;
|
||||
UINTN NumOfHobData;
|
||||
UINTN Index;
|
||||
EFI_FLASH_AREA_HOB_DATA FlashHobData;
|
||||
EFI_PEI_PPI_DESCRIPTOR *PpiDescriptor;
|
||||
|
||||
DEBUG ((EFI_D_ERROR, "NT 32 Flash Map PEIM Loaded\n"));
|
||||
|
||||
//
|
||||
// Install FlashMap PPI
|
||||
//
|
||||
Status = PeiServicesInstallPpi (&mPpiListFlashMap);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
|
||||
__asm int 3;
|
||||
//
|
||||
// Get the Fwh Information PPI
|
||||
//
|
||||
|
@ -195,133 +84,12 @@ Returns:
|
|||
}
|
||||
|
||||
//
|
||||
// Get number of types
|
||||
// Relocate the base of FV region
|
||||
//
|
||||
NumOfHobData = sizeof (mFlashAreaData) / sizeof (EFI_FLASH_AREA_DATA);
|
||||
|
||||
//
|
||||
// Build flash area entries as GUIDed HOBs.
|
||||
//
|
||||
for (Index = 0; Index < NumOfHobData; Index++) {
|
||||
(*PeiServices)->SetMem (&FlashHobData, sizeof (EFI_FLASH_AREA_HOB_DATA), 0);
|
||||
|
||||
FlashHobData.AreaType = mFlashAreaData[Index].AreaType;
|
||||
FlashHobData.NumberOfEntries = 1;
|
||||
FlashHobData.SubAreaData.Attributes = mFlashAreaData[Index].Attributes;
|
||||
FlashHobData.SubAreaData.Base = FdBase + (EFI_PHYSICAL_ADDRESS) (UINTN) mFlashAreaData[Index].Base;
|
||||
FlashHobData.SubAreaData.Length = (EFI_PHYSICAL_ADDRESS) (UINTN) mFlashAreaData[Index].Length;
|
||||
|
||||
//
|
||||
// We also update a PCD entry so that any driver that depend on
|
||||
// PCD entry will get the information.
|
||||
//
|
||||
if (FlashHobData.AreaType == EFI_FLASH_AREA_EFI_VARIABLES) {
|
||||
PcdSet32 (PcdFlashNvStorageVariableBase, (UINT32) FlashHobData.SubAreaData.Base);
|
||||
PcdSet32 (PcdFlashNvStorageVariableSize, (UINT32) FlashHobData.SubAreaData.Length);
|
||||
}
|
||||
|
||||
if (FlashHobData.AreaType == EFI_FLASH_AREA_FTW_STATE) {
|
||||
PcdSet32 (PcdFlashNvStorageFtwWorkingBase, (UINT32) FlashHobData.SubAreaData.Base);
|
||||
PcdSet32 (PcdFlashNvStorageFtwWorkingSize, (UINT32) FlashHobData.SubAreaData.Length);
|
||||
}
|
||||
|
||||
if (FlashHobData.AreaType == EFI_FLASH_AREA_FTW_BACKUP) {
|
||||
PcdSet32 (PcdFlashNvStorageFtwSpareBase, (UINT32) FlashHobData.SubAreaData.Base);
|
||||
PcdSet32 (PcdFlashNvStorageFtwSpareSize, (UINT32) FlashHobData.SubAreaData.Length);
|
||||
}
|
||||
|
||||
switch (FlashHobData.AreaType) {
|
||||
case EFI_FLASH_AREA_RECOVERY_BIOS:
|
||||
case EFI_FLASH_AREA_MAIN_BIOS:
|
||||
(*PeiServices)->CopyMem (
|
||||
&FlashHobData.AreaTypeGuid,
|
||||
&gEfiFirmwareFileSystem2Guid,
|
||||
sizeof (EFI_GUID)
|
||||
);
|
||||
(*PeiServices)->CopyMem (
|
||||
&FlashHobData.SubAreaData.FileSystem,
|
||||
&gEfiFirmwareVolumeBlockProtocolGuid,
|
||||
sizeof (EFI_GUID)
|
||||
);
|
||||
break;
|
||||
|
||||
case EFI_FLASH_AREA_GUID_DEFINED:
|
||||
(*PeiServices)->CopyMem (
|
||||
&FlashHobData.AreaTypeGuid,
|
||||
&mFlashAreaData[Index].AreaTypeGuid,
|
||||
sizeof (EFI_GUID)
|
||||
);
|
||||
(*PeiServices)->CopyMem (
|
||||
&FlashHobData.SubAreaData.FileSystem,
|
||||
&gEfiFirmwareVolumeBlockProtocolGuid,
|
||||
sizeof (EFI_GUID)
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
//BuildGuidDataHob (
|
||||
// &gEfiFlashMapHobGuid,
|
||||
// &FlashHobData,
|
||||
// sizeof (EFI_FLASH_AREA_HOB_DATA)
|
||||
// );
|
||||
}
|
||||
PcdSet32 (PcdFlashNvStorageVariableBase, PcdGet32 (PcdWinNtFlashNvStorageVariableBase) + (UINT32) FdBase);
|
||||
PcdSet32 (PcdFlashNvStorageFtwWorkingBase, PcdGet32 (PcdWinNtFlashNvStorageFtwWorkingBase) + (UINT32) FdBase);
|
||||
PcdSet32 (PcdFlashNvStorageFtwSpareBase, PcdGet32 (PcdWinNtFlashNvStorageFtwWorkingBase) + (UINT32) FdBase);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GetAreaInfo (
|
||||
IN EFI_PEI_SERVICES **PeiServices,
|
||||
IN PEI_FLASH_MAP_PPI *This,
|
||||
IN EFI_FLASH_AREA_TYPE AreaType,
|
||||
IN EFI_GUID *AreaTypeGuid,
|
||||
OUT UINT32 *NumEntries,
|
||||
OUT EFI_FLASH_SUBAREA_ENTRY **Entries
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Implementation of Flash Map PPI
|
||||
|
||||
--*/
|
||||
// TODO: function comment is missing 'Arguments:'
|
||||
// TODO: function comment is missing 'Returns:'
|
||||
// TODO: PeiServices - add argument and description to function comment
|
||||
// TODO: This - add argument and description to function comment
|
||||
// TODO: AreaType - add argument and description to function comment
|
||||
// TODO: AreaTypeGuid - add argument and description to function comment
|
||||
// TODO: NumEntries - add argument and description to function comment
|
||||
// TODO: Entries - add argument and description to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
// TODO: EFI_NOT_FOUND - add return value to function comment
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_PEI_HOB_POINTERS Hob;
|
||||
EFI_HOB_FLASH_MAP_ENTRY_TYPE *FlashMapEntry;
|
||||
|
||||
Status = PeiServicesGetHobList (&Hob.Raw);
|
||||
while (!END_OF_HOB_LIST (Hob)) {
|
||||
if (Hob.Header->HobType == EFI_HOB_TYPE_GUID_EXTENSION && CompareGuid (&Hob.Guid->Name, &gEfiFlashMapHobGuid)) {
|
||||
FlashMapEntry = (EFI_HOB_FLASH_MAP_ENTRY_TYPE *) Hob.Raw;
|
||||
if (AreaType == FlashMapEntry->AreaType) {
|
||||
if (AreaType == EFI_FLASH_AREA_GUID_DEFINED) {
|
||||
if (!CompareGuid (AreaTypeGuid, &FlashMapEntry->AreaTypeGuid)) {
|
||||
goto NextHob;
|
||||
}
|
||||
}
|
||||
|
||||
*NumEntries = FlashMapEntry->NumEntries;
|
||||
*Entries = FlashMapEntry->Entries;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
NextHob:
|
||||
Hob.Raw = GET_NEXT_HOB (Hob);
|
||||
}
|
||||
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
|
|
@ -70,3 +70,7 @@
|
|||
PcdFlashNvStorageVariableSize|gEfiMdeModulePkgTokenSpaceGuid
|
||||
PcdFlashNvStorageVariableBase|gEfiMdeModulePkgTokenSpaceGuid
|
||||
|
||||
PcdWinNtFlashNvStorageFtwWorkingBase|gEfiNt32PkgTokenSpaceGuid
|
||||
PcdWinNtFlashNvStorageFtwSpareBase|gEfiNt32PkgTokenSpaceGuid
|
||||
PcdWinNtFlashNvStorageVariableBase|gEfiNt32PkgTokenSpaceGuid
|
||||
|
||||
|
|
Loading…
Reference in New Issue