Following UEFI spec, update SmbiosDxe to use EfiRuntimeServicesData to put SMBIOS table. Update LegacyBiosDxe to move SMBIOS table to reserved memory for backward compatibility.

Signed-off-by: Elvin Li <elvin.li@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14932 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Elvin Li
2013-12-05 05:30:27 +00:00
committed by li-elvin
parent b4e7b2d2cd
commit b68237300a
5 changed files with 197 additions and 18 deletions

View File

@@ -1,6 +1,6 @@
/** @file
Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions
@@ -33,6 +33,10 @@ UINT64 mLowWater = 0xffffffffffffffffULL;
extern BBS_TABLE *mBbsTable;
extern VOID *mRuntimeSmbiosEntryPoint;
extern EFI_PHYSICAL_ADDRESS mReserveSmbiosEntryPoint;
extern EFI_PHYSICAL_ADDRESS mStructureTableAddress;
/**
Print the BBS Table.
@@ -777,6 +781,63 @@ LegacyGetDataOrTable (
return EFI_SUCCESS;
}
/**
Copy SMBIOS table to EfiReservedMemoryType of memory for legacy boot.
**/
VOID
CreateSmbiosTableInReservedMemory (
VOID
)
{
SMBIOS_TABLE_ENTRY_POINT *EntryPointStructure;
if ((mRuntimeSmbiosEntryPoint == NULL) ||
(mReserveSmbiosEntryPoint == 0) ||
(mStructureTableAddress == 0)) {
return;
}
EntryPointStructure = (SMBIOS_TABLE_ENTRY_POINT *) mRuntimeSmbiosEntryPoint;
//
// Copy SMBIOS Entry Point Structure
//
CopyMem (
(VOID *)(UINTN) mReserveSmbiosEntryPoint,
EntryPointStructure,
EntryPointStructure->EntryPointLength
);
//
// Copy SMBIOS Structure Table into EfiReservedMemoryType memory
//
CopyMem (
(VOID *)(UINTN) mStructureTableAddress,
(VOID *)(UINTN) EntryPointStructure->TableAddress,
EntryPointStructure->TableLength
);
//
// Update TableAddress in Entry Point Structure
//
EntryPointStructure = (SMBIOS_TABLE_ENTRY_POINT *)(UINTN) mReserveSmbiosEntryPoint;
EntryPointStructure->TableAddress = (UINT32)(UINTN) mStructureTableAddress;
//
// Fixup checksums in the Entry Point Structure
//
EntryPointStructure->IntermediateChecksum = 0;
EntryPointStructure->EntryPointStructureChecksum = 0;
EntryPointStructure->IntermediateChecksum =
CalculateCheckSum8 (
(UINT8 *) EntryPointStructure + OFFSET_OF (SMBIOS_TABLE_ENTRY_POINT, IntermediateAnchorString),
EntryPointStructure->EntryPointLength - OFFSET_OF (SMBIOS_TABLE_ENTRY_POINT, IntermediateAnchorString)
);
EntryPointStructure->EntryPointStructureChecksum =
CalculateCheckSum8 ((UINT8 *) EntryPointStructure, EntryPointStructure->EntryPointLength);
}
/**
Assign drive number to legacy HDD drives prior to booting an EFI
@@ -815,7 +876,6 @@ GenericLegacyBoot (
EFI_HANDLE IdeController;
UINTN HandleCount;
EFI_HANDLE *HandleBuffer;
VOID *SmbiosTable;
VOID *AcpiTable;
UINTN ShadowAddress;
UINT32 Granularity;
@@ -904,21 +964,15 @@ GenericLegacyBoot (
);
Private->Legacy16Table->E820Length = (UINT32) CopySize;
}
//
// Get SMBIOS and ACPI table pointers
//
SmbiosTable = NULL;
EfiGetSystemConfigurationTable (
&gEfiSmbiosTableGuid,
&SmbiosTable
);
//
// We do not ASSERT if SmbiosTable not found. It is possbile that a platform does not produce SmbiosTable.
//
if (SmbiosTable == NULL) {
if (mReserveSmbiosEntryPoint == 0) {
DEBUG ((EFI_D_INFO, "Smbios table is not found!\n"));
}
EfiToLegacy16BootTable->SmbiosTable = (UINT32)(UINTN)SmbiosTable;
CreateSmbiosTableInReservedMemory ();
EfiToLegacy16BootTable->SmbiosTable = (UINT32)(UINTN)mReserveSmbiosEntryPoint;
AcpiTable = NULL;
Status = EfiGetSystemConfigurationTable (