mirror of https://github.com/acidanthera/audk.git
ArmPlatformPkg/CTA9x4: Remove Variable Storage FD file from FDF
The Variable Storage is now formated by the NOR Flsah driver. Force the NOR Flash driver to be loaded before the Variable Service DXE driver. And check if the Non Volatile Storage exists in NOR flash. If not, the driver writes the correct header. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11471 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
53205a55e8
commit
6acb379fbc
|
@ -316,6 +316,16 @@
|
|||
|
||||
gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x07
|
||||
|
||||
#
|
||||
# NV Storage PCDs. Use base of 0x43FC0000 for NOR0 or 0x47FC0000 for NOR1 on Versatile Express
|
||||
#
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|0x47FC0000
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize|0x00010000
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0x47FD0000
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize|0x00010000
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0x47FE0000
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize|0x00010000
|
||||
|
||||
gEmbeddedTokenSpaceGuid.PcdEmbeddedAutomaticBootCommand|""
|
||||
gEmbeddedTokenSpaceGuid.PcdEmbeddedDefaultTextColor|0x07
|
||||
gEmbeddedTokenSpaceGuid.PcdEmbeddedMemVariableStoreSize|0x10000
|
||||
|
|
|
@ -87,81 +87,6 @@ gEmbeddedTokenSpaceGuid.PcdFlashFvMainBase|gEmbeddedTokenSpaceGuid.PcdFlashFvMai
|
|||
FV = FVMAIN_COMPACT
|
||||
|
||||
|
||||
[FD.NVVariableStore]
|
||||
BaseAddress = 0x47FC0000
|
||||
Size = 0x00030000
|
||||
ErasePolarity = 1
|
||||
BlockSize = 0x00010000
|
||||
NumBlocks = 0x3
|
||||
|
||||
0x00000000|0x00010000
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
|
||||
#NV_VARIABLE_STORE
|
||||
DATA = {
|
||||
## This is the EFI_FIRMWARE_VOLUME_HEADER
|
||||
# ZeroVector []
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
# FileSystemGuid: gEfiSystemNvDataFvGuid =
|
||||
# { 0xFFF12B8D, 0x7696, 0x4C8B, { 0xA9, 0x85, 0x27, 0x47, 0x07, 0x5B, 0x4F, 0x50 }}
|
||||
0x8D, 0x2B, 0xF1, 0xFF, 0x96, 0x76, 0x8B, 0x4C,
|
||||
0xA9, 0x85, 0x27, 0x47, 0x07, 0x5B, 0x4F, 0x50,
|
||||
# FvLength: 0x30000
|
||||
0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
#Signature "_FVH" #Attributes
|
||||
0x5f, 0x46, 0x56, 0x48, 0xff, 0xfe, 0x04, 0x00,
|
||||
#HeaderLength #CheckSum #ExtHeaderOffset #Reserved #Revision
|
||||
0x48, 0x00, 0x34, 0x09, 0x00, 0x00, 0x00, 0x02,
|
||||
#Blockmap[0]: 3 Blocks * 0x10000 Bytes / Block
|
||||
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
|
||||
#Blockmap[1]: End
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
|
||||
## This is the VARIABLE_STORE_HEADER
|
||||
#Signature: gEfiVariableGuid =
|
||||
# { 0xddcf3616, 0x3275, 0x4164, { 0x98, 0xb6, 0xfe, 0x85, 0x70, 0x7f, 0xfe, 0x7d }}
|
||||
0x16, 0x36, 0xcf, 0xdd, 0x75, 0x32, 0x64, 0x41,
|
||||
0x98, 0xb6, 0xfe, 0x85, 0x70, 0x7f, 0xfe, 0x7d,
|
||||
#Size: 0x10000 (gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize) - 0x48 (size of EFI_FIRMWARE_VOLUME_HEADER: HeaderLength) = 0xFFB8
|
||||
# This can speed up the Variable Dispatch a bit.
|
||||
0xB8, 0xFF, 0x00, 0x00,
|
||||
#FORMATTED: 0x5A #HEALTHY: 0xFE #Reserved: UINT16 #Reserved1: UINT32
|
||||
0x5A, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
}
|
||||
|
||||
0x00010000|0x00010000
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize
|
||||
#FTW_SPARE_STORE - See EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER
|
||||
DATA = {
|
||||
#Signature: gEfiSystemNvDataFvGuid =
|
||||
# { 0xfff12b8d, 0x7696, 0x4c8b, { 0xa9, 0x85, 0x27, 0x47, 0x07, 0x5b, 0x4f, 0x50 } }
|
||||
0x8d, 0x2b, 0xf1, 0xff, 0x96, 0x32, 0x8b, 0x4c,
|
||||
0xa9, 0x85, 0x27, 0x47, 0x07, 0x5b, 0x4f, 0x50,
|
||||
#FIXME: 32bit CRC caculated for this header.
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
# Working block valid bit
|
||||
0x00,
|
||||
# Total size of the following write queue range. (64bit)
|
||||
0xB8, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
|
||||
# Write Queue data: EFI_FAULT_TOLERANT_WRITE_HEADER
|
||||
# State
|
||||
0x00,
|
||||
# CallerId: Guid
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
# NumberOfWrites, PrivateDataSize
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
}
|
||||
|
||||
0x00020000|0x00010000
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
|
||||
DATA = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
}
|
||||
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# FV Section
|
||||
|
|
|
@ -33,6 +33,10 @@
|
|||
|
||||
[Guids.common]
|
||||
gArmVExpressTokenSpaceGuid = { 0x9c0aaed4, 0x74c5, 0x4043, { 0xb4, 0x17, 0xa3, 0x22, 0x38, 0x14, 0xce, 0x76 } }
|
||||
#
|
||||
# Following Guid must match FILE_GUID in MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
|
||||
#
|
||||
gVariableRuntimeDxeFileGuid = { 0xcbd2e4d5, 0x7068, 0x4ff5, { 0xb4, 0x62, 0x98, 0x22, 0xb4, 0xad, 0x8d, 0x60 } }
|
||||
|
||||
[PcdsFeatureFlag.common]
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/** @file NorFlashDxe.c
|
||||
|
||||
Copyright (c) 2010, ARM Ltd. All rights reserved.<BR>
|
||||
Copyright (c) 2011, ARM Ltd. All rights reserved.<BR>
|
||||
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
|
||||
|
@ -16,6 +16,7 @@
|
|||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/PcdLib.h>
|
||||
|
||||
#include "NorFlashDxe.h"
|
||||
|
||||
|
@ -31,28 +32,24 @@ NOR_FLASH_DESCRIPTION mNorFlashDescription[NOR_FLASH_LAST_DEVICE] = {
|
|||
ARM_VE_SMB_NOR0_BASE,
|
||||
SIZE_256KB * 255,
|
||||
SIZE_256KB,
|
||||
FALSE,
|
||||
{0xE7223039, 0x5836, 0x41E1, 0xB5, 0x42, 0xD7, 0xEC, 0x73, 0x6C, 0x5E, 0x59}
|
||||
},
|
||||
{ // BootMon non-volatile storage
|
||||
ARM_VE_SMB_NOR0_BASE + SIZE_256KB * 255,
|
||||
SIZE_64KB * 4,
|
||||
SIZE_64KB,
|
||||
FALSE,
|
||||
{0x02118005, 0x9DA7, 0x443A, 0x92, 0xD5, 0x78, 0x1F, 0x02, 0x2A, 0xED, 0xBB}
|
||||
},
|
||||
{ // UEFI
|
||||
ARM_VE_SMB_NOR1_BASE,
|
||||
SIZE_256KB * 255,
|
||||
SIZE_256KB,
|
||||
FALSE,
|
||||
{0x1F15DA3C, 0x37FF, 0x4070, 0xB4, 0x71, 0xBB, 0x4A, 0xF1, 0x2A, 0x72, 0x4A}
|
||||
},
|
||||
{ // UEFI Variable Services non-volatile storage
|
||||
ARM_VE_SMB_NOR1_BASE + SIZE_256KB * 255,
|
||||
SIZE_64KB * 3, //FIXME: Set 3 blocks because I did not succeed to copy 4 blocks into the ARM Versastile Express NOR Falsh in the last NOR Flash. It should be 4 blocks
|
||||
SIZE_64KB,
|
||||
TRUE,
|
||||
{0xCC2CBF29, 0x1498, 0x4CDD, 0x81, 0x71, 0xF8, 0xB6, 0xB4, 0x1D, 0x09, 0x09}
|
||||
}
|
||||
};
|
||||
|
@ -782,6 +779,7 @@ NorFlashInitialise (
|
|||
{
|
||||
EFI_STATUS Status = EFI_SUCCESS;
|
||||
UINT32 Index;
|
||||
UINTN NvStorageVariableBase = (UINTN) PcdGet32 (PcdFlashNvStorageVariableBase);
|
||||
|
||||
for (Index = 0; Index < NOR_FLASH_LAST_DEVICE; Index++) {
|
||||
Status = NorFlashCreateInstance(
|
||||
|
@ -789,7 +787,7 @@ NorFlashInitialise (
|
|||
mNorFlashDescription[Index].Size,
|
||||
Index,
|
||||
mNorFlashDescription[Index].BlockSize,
|
||||
mNorFlashDescription[Index].SupportFvb,
|
||||
(mNorFlashDescription[Index].BaseAddress == NvStorageVariableBase),
|
||||
&mNorFlashDescription[Index].Guid,
|
||||
&mNorFlashInstances[Index]
|
||||
);
|
||||
|
|
|
@ -124,7 +124,6 @@ typedef struct {
|
|||
UINTN BaseAddress;
|
||||
UINTN Size;
|
||||
UINTN BlockSize;
|
||||
BOOLEAN SupportFvb;
|
||||
EFI_GUID Guid;
|
||||
} NOR_FLASH_DESCRIPTION;
|
||||
|
||||
|
|
|
@ -48,12 +48,13 @@
|
|||
gEfiDevicePathProtocolGuid
|
||||
gEfiFirmwareVolumeBlockProtocolGuid
|
||||
|
||||
[FixedPcd.common]
|
||||
[Pcd.common]
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase
|
||||
|
||||
[Pcd.common]
|
||||
|
||||
|
||||
[Depex]
|
||||
TRUE
|
||||
#
|
||||
# NorFlashDxe must be loaded before VariableRuntimeDxe in case empty flash needs populating with default values
|
||||
#
|
||||
BEFORE gVariableRuntimeDxeFileGuid
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*++ @file NorFlashFvbDxe.c
|
||||
|
||||
Copyright (c) 2010, ARM Ltd. All rights reserved.<BR>
|
||||
Copyright (c) 2011, ARM Ltd. All rights reserved.<BR>
|
||||
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
|
||||
|
@ -60,8 +60,7 @@ InitializeFvAndVariableStoreHeaders (
|
|||
}
|
||||
|
||||
HeadersLength = sizeof(EFI_FIRMWARE_VOLUME_HEADER) + sizeof(EFI_FV_BLOCK_MAP_ENTRY) + sizeof(VARIABLE_STORE_HEADER);
|
||||
Headers = AllocatePool(HeadersLength);
|
||||
ZeroMem (&Headers,HeadersLength);
|
||||
Headers = AllocateZeroPool(HeadersLength);
|
||||
|
||||
//
|
||||
// EFI_FIRMWARE_VOLUME_HEADER
|
||||
|
@ -85,7 +84,7 @@ InitializeFvAndVariableStoreHeaders (
|
|||
FirmwareVolumeHeader->BlockMap[0].Length = Instance->Media.BlockSize;
|
||||
FirmwareVolumeHeader->BlockMap[1].NumBlocks = 0;
|
||||
FirmwareVolumeHeader->BlockMap[1].Length = 0;
|
||||
FirmwareVolumeHeader->Checksum = CalculateCheckSum16 (FirmwareVolumeHeader,FirmwareVolumeHeader->HeaderLength);
|
||||
FirmwareVolumeHeader->Checksum = CalculateCheckSum16 ((UINT16*)FirmwareVolumeHeader,FirmwareVolumeHeader->HeaderLength);
|
||||
|
||||
//
|
||||
// VARIABLE_STORE_HEADER
|
||||
|
@ -97,7 +96,7 @@ InitializeFvAndVariableStoreHeaders (
|
|||
VariableStoreHeader->State = VARIABLE_STORE_HEALTHY;
|
||||
|
||||
// Install the combined super-header in the NorFlash
|
||||
Status = FvbWrite(&Instance->FvbProtocol, 0, 0, &FirmwareVolumeHeader, Headers );
|
||||
Status = FvbWrite(&Instance->FvbProtocol, 0, 0, &HeadersLength, Headers );
|
||||
|
||||
FreePool(Headers);
|
||||
return Status;
|
||||
|
@ -133,6 +132,7 @@ ValidateFvHeader (
|
|||
|| ( FwVolHeader->Signature != EFI_FVH_SIGNATURE )
|
||||
|| ( FwVolHeader->FvLength != Instance->Media.BlockSize * (Instance->Media.LastBlock + 1) )
|
||||
) {
|
||||
DEBUG ((EFI_D_ERROR, "ValidateFvHeader: No Firmware Volume header present\n"));
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
@ -143,11 +143,11 @@ ValidateFvHeader (
|
|||
}
|
||||
|
||||
// Verify the header checksum
|
||||
/*Checksum = CalculateSum16((VOID*) FwVolHeader, FwVolHeader->HeaderLength);
|
||||
Checksum = CalculateSum16((UINT16*)FwVolHeader, FwVolHeader->HeaderLength);
|
||||
if (Checksum != 0) {
|
||||
DEBUG ((EFI_D_ERROR, "ValidateFvHeader: FV checksum is invalid (Checksum:0x%X)\n",Checksum));
|
||||
return EFI_NOT_FOUND;
|
||||
}*/
|
||||
}
|
||||
|
||||
VariableStoreHeader = (VARIABLE_STORE_HEADER*)((UINT32)FwVolHeader + FwVolHeader->HeaderLength);
|
||||
|
||||
|
@ -408,12 +408,6 @@ FvbRead(
|
|||
Status = EFI_SUCCESS;
|
||||
TempStatus = Status;
|
||||
|
||||
if (FALSE) {
|
||||
DEBUG ((EFI_D_ERROR, "FvbRead: Can not read: Device is in ReadDisabled state.\n"));
|
||||
// It is in ReadDisabled state, return an error right away
|
||||
return EFI_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
// Cache the block size to avoid de-referencing pointers all the time
|
||||
BlockSize = Instance->Media.BlockSize;
|
||||
|
||||
|
@ -777,7 +771,7 @@ NorFlashFvbInitialize (
|
|||
Status = ValidateFvHeader (Instance);
|
||||
if (EFI_ERROR(Status)) {
|
||||
// There is no valid header, so time to install one.
|
||||
DEBUG((EFI_D_ERROR,"NorFlashFvbInitialize: ERROR - The FVB Header is not valid. Install a correct one for this volume.\n"));
|
||||
DEBUG((EFI_D_ERROR,"NorFlashFvbInitialize: ERROR - The FVB Header is not valid. Installing a correct one for this volume.\n"));
|
||||
|
||||
// Erase all the NorFlash that is reserved for variable storage
|
||||
Status = FvbEraseBlocks ( &Instance->FvbProtocol, (EFI_LBA)0, (UINT32)(Instance->Media.LastBlock + 1), EFI_LBA_LIST_TERMINATOR );
|
||||
|
|
Loading…
Reference in New Issue