summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Universal/SmbiosDxe
diff options
context:
space:
mode:
authorandrewfish <andrewfish@6f19259b-4bc3-4df7-8a09-765794883524>2011-08-29 20:47:22 +0000
committerandrewfish <andrewfish@6f19259b-4bc3-4df7-8a09-765794883524>2011-08-29 20:47:22 +0000
commitc7ce516971c74a9786134a9427c6c97097445c9c (patch)
tree55af24a507c32a243f879e09dd6f14d140153c5a /MdeModulePkg/Universal/SmbiosDxe
parentdf1b7575ba825d994952d826008f9d006c7b2695 (diff)
downloadedk2-c7ce516971c74a9786134a9427c6c97097445c9c.tar.gz
edk2-c7ce516971c74a9786134a9427c6c97097445c9c.tar.bz2
edk2-c7ce516971c74a9786134a9427c6c97097445c9c.zip
Fix issue with SMBIOS driver assumming memory exists below 4GB.
approved-by: andrewfish reviewed-by: li-elvin git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12220 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/SmbiosDxe')
-rw-r--r--MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c37
1 files changed, 27 insertions, 10 deletions
diff --git a/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c b/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c
index c15ecb54fa..596e8b2d8b 100644
--- a/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c
+++ b/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c
@@ -103,6 +103,7 @@ SMBIOS_TABLE_ENTRY_POINT EntryPointStructureData = {
};
+
/**
Get the full size of SMBIOS structure including optional strings that follow the formatted structure.
@@ -889,7 +890,11 @@ SmbiosCreateTable (
//
SmbiosProtocol = &mPrivateData.Smbios;
- PreAllocatedPages = EFI_SIZE_TO_PAGES (EntryPointStructure->TableLength);
+ if (EntryPointStructure->TableAddress == 0) {
+ PreAllocatedPages = 0;
+ } else {
+ PreAllocatedPages = EFI_SIZE_TO_PAGES (EntryPointStructure->TableLength);
+ }
//
// Make some statistics about all the structures
@@ -957,9 +962,12 @@ SmbiosCreateTable (
&PhysicalAddress
);
if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "SmbiosCreateTable() could not allocate SMBIOS table < 4GB\n"));
+ EntryPointStructure->TableAddress = 0;
return EFI_OUT_OF_RESOURCES;
+ } else {
+ EntryPointStructure->TableAddress = (UINT32) PhysicalAddress;
}
- EntryPointStructure->TableAddress = (UINT32) PhysicalAddress;
}
//
@@ -1061,7 +1069,16 @@ SmbiosDriverEntryPoint (
&PhysicalAddress
);
if (EFI_ERROR (Status)) {
- return EFI_OUT_OF_RESOURCES;
+ DEBUG ((EFI_D_ERROR, "SmbiosDriverEntryPoint() could not allocate EntryPointStructure < 4GB\n"));
+ Status = gBS->AllocatePages (
+ AllocateAnyPages,
+ EfiReservedMemoryType,
+ EFI_SIZE_TO_PAGES (sizeof (SMBIOS_TABLE_ENTRY_POINT)),
+ &PhysicalAddress
+ );
+ if (EFI_ERROR (Status)) {
+ return EFI_OUT_OF_RESOURCES;
+ }
}
EntryPointStructure = (SMBIOS_TABLE_ENTRY_POINT *) (UINTN) PhysicalAddress;
@@ -1086,14 +1103,14 @@ SmbiosDriverEntryPoint (
&PhysicalAddress
);
if (EFI_ERROR (Status)) {
- FreePages ((VOID*) EntryPointStructure, EFI_SIZE_TO_PAGES (sizeof (SMBIOS_TABLE_ENTRY_POINT)));
- EntryPointStructure = NULL;
- return EFI_OUT_OF_RESOURCES;
+ DEBUG ((EFI_D_ERROR, "SmbiosDriverEntryPoint() could not allocate SMBIOS table < 4GB\n"));
+ EntryPointStructure->TableAddress = 0;
+ EntryPointStructure->TableLength = 0;
+ } else {
+ EntryPointStructure->TableAddress = (UINT32) PhysicalAddress;
+ EntryPointStructure->TableLength = EFI_PAGES_TO_SIZE (1);
}
-
- EntryPointStructure->TableAddress = (UINT32) PhysicalAddress;
- EntryPointStructure->TableLength = EFI_PAGES_TO_SIZE (1);
-
+
//
// Make a new handle and install the protocol
//