Add capsule > 4GB support. When capsule data is put above 4GB, IA32 PEI transfers to long mode to get capsule data.
Signed-off-by: li-elvin Reviewed-by: lgao4, mdkinney git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12264 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -20,7 +20,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#include <Uefi/UefiSpec.h>
|
||||
|
||||
#include <Ppi/Capsule.h>
|
||||
|
||||
#include <Ppi/LoadFile.h>
|
||||
#include <Ppi/ReadOnlyVariable2.h>
|
||||
#include <Guid/CapsuleVendor.h>
|
||||
|
||||
@@ -31,25 +31,71 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#include <Library/HobLib.h>
|
||||
#include <Library/PeiServicesTablePointerLib.h>
|
||||
#include <Library/PrintLib.h>
|
||||
#include <Library/PeCoffLib.h>
|
||||
#include <Library/PeCoffGetEntryPointLib.h>
|
||||
#include <Library/PcdLib.h>
|
||||
#include <Library/ReportStatusCodeLib.h>
|
||||
#include <IndustryStandard/PeImage.h>
|
||||
#include "Common/CommonHeader.h"
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
//
|
||||
// We want to avoid using memory at 0 for coalescing, so set a
|
||||
// min address.
|
||||
// Page-Map Level-4 Offset (PML4) and
|
||||
// Page-Directory-Pointer Offset (PDPE) entries 4K & 2MB
|
||||
//
|
||||
#define MIN_COALESCE_ADDR 0x100000
|
||||
#define MAX_SUPPORT_CAPSULE_NUM 50
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
UINT64 Present:1; // 0 = Not present in memory, 1 = Present in memory
|
||||
UINT64 ReadWrite:1; // 0 = Read-Only, 1= Read/Write
|
||||
UINT64 UserSupervisor:1; // 0 = Supervisor, 1=User
|
||||
UINT64 WriteThrough:1; // 0 = Write-Back caching, 1=Write-Through caching
|
||||
UINT64 CacheDisabled:1; // 0 = Cached, 1=Non-Cached
|
||||
UINT64 Accessed:1; // 0 = Not accessed, 1 = Accessed (set by CPU)
|
||||
UINT64 Reserved:1; // Reserved
|
||||
UINT64 MustBeZero:2; // Must Be Zero
|
||||
UINT64 Available:3; // Available for use by system software
|
||||
UINT64 PageTableBaseAddress:40; // Page Table Base Address
|
||||
UINT64 AvabilableHigh:11; // Available for use by system software
|
||||
UINT64 Nx:1; // No Execute bit
|
||||
} Bits;
|
||||
UINT64 Uint64;
|
||||
} PAGE_MAP_AND_DIRECTORY_POINTER;
|
||||
|
||||
//
|
||||
// This capsule PEIM puts its private data at the start of the
|
||||
// coalesced capsule. Here's the structure definition.
|
||||
// Page Table Entry 2MB
|
||||
//
|
||||
#define EFI_CAPSULE_PEIM_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('C', 'a', 'p', 'D')
|
||||
typedef union {
|
||||
struct {
|
||||
UINT64 Present:1; // 0 = Not present in memory, 1 = Present in memory
|
||||
UINT64 ReadWrite:1; // 0 = Read-Only, 1= Read/Write
|
||||
UINT64 UserSupervisor:1; // 0 = Supervisor, 1=User
|
||||
UINT64 WriteThrough:1; // 0 = Write-Back caching, 1=Write-Through caching
|
||||
UINT64 CacheDisabled:1; // 0 = Cached, 1=Non-Cached
|
||||
UINT64 Accessed:1; // 0 = Not accessed, 1 = Accessed (set by CPU)
|
||||
UINT64 Dirty:1; // 0 = Not Dirty, 1 = written by processor on access to page
|
||||
UINT64 MustBe1:1; // Must be 1
|
||||
UINT64 Global:1; // 0 = Not global page, 1 = global page TLB not cleared on CR3 write
|
||||
UINT64 Available:3; // Available for use by system software
|
||||
UINT64 PAT:1; //
|
||||
UINT64 MustBeZero:8; // Must be zero;
|
||||
UINT64 PageTableBaseAddress:31; // Page Table Base Address
|
||||
UINT64 AvabilableHigh:11; // Available for use by system software
|
||||
UINT64 Nx:1; // 0 = Execute Code, 1 = No Code Execution
|
||||
} Bits;
|
||||
UINT64 Uint64;
|
||||
} PAGE_TABLE_ENTRY;
|
||||
|
||||
typedef struct {
|
||||
UINT32 Signature;
|
||||
UINTN CapsuleSize;
|
||||
} EFI_CAPSULE_PEIM_PRIVATE_DATA;
|
||||
#pragma pack()
|
||||
|
||||
#define CAPSULE_TEST_SIGNATURE SIGNATURE_32('T', 'E', 'S', 'T')
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(*COALESCE_ENTRY) (
|
||||
IN EFI_PEI_SERVICES **PeiServices,
|
||||
IN EFI_CAPSULE_BLOCK_DESCRIPTOR *BlockList,
|
||||
IN OUT VOID **MemoryBase,
|
||||
IN OUT UINTN *MemorySize
|
||||
);
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user