summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/SmbiosPlatformDxe
diff options
context:
space:
mode:
authorGabriel Somlo <somlo@cmu.edu>2015-02-13 19:50:05 +0000
committerjljusten <jljusten@Edk2>2015-02-13 19:50:05 +0000
commit24256744383fec68af3da859fc4152c3cba06c2d (patch)
tree7ff84dee1108cff28932dc6d100a61cc507fcfb9 /OvmfPkg/SmbiosPlatformDxe
parentc0a8cf34f6f83fd6bf90652a1a3f1123ed5796cd (diff)
downloadedk2-24256744383fec68af3da859fc4152c3cba06c2d.tar.gz
edk2-24256744383fec68af3da859fc4152c3cba06c2d.tar.bz2
edk2-24256744383fec68af3da859fc4152c3cba06c2d.zip
OvmfPkg/SMBIOS: Provide default Type 0 (BIOS Information) structure
Insert a default, OVMF-specific Type 0 (BIOS Information) structure into the SMBIOS table, unless the underlying guest VM supplies its own, overriding instance. As an example, QEMU, while allowing the user to specifically force generation of a Type 0 structure, will not generate one by default, considering that task to be the responsibility of the BIOS itself. Based on an earlier out-of-tree patch by Laszlo Ersek <lersek@redhat.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Gabriel Somlo <somlo@cmu.edu> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16868 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'OvmfPkg/SmbiosPlatformDxe')
-rw-r--r--OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c66
1 files changed, 66 insertions, 0 deletions
diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c
index 626f7dbbfb..bf7f717a59 100644
--- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c
+++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c
@@ -16,6 +16,51 @@
#include "SmbiosPlatformDxe.h"
+//
+// Type definition and contents of the default Type 0 SMBIOS table.
+//
+#pragma pack(1)
+typedef struct {
+ SMBIOS_TABLE_TYPE0 Base;
+ UINT8 Strings[];
+} OVMF_TYPE0;
+#pragma pack()
+
+STATIC CONST OVMF_TYPE0 mOvmfDefaultType0 = {
+ {
+ // SMBIOS_STRUCTURE Hdr
+ {
+ EFI_SMBIOS_TYPE_BIOS_INFORMATION, // UINT8 Type
+ sizeof (SMBIOS_TABLE_TYPE0), // UINT8 Length
+ },
+ 1, // SMBIOS_TABLE_STRING Vendor
+ 2, // SMBIOS_TABLE_STRING BiosVersion
+ 0xE800,// UINT16 BiosSegment
+ 3, // SMBIOS_TABLE_STRING BiosReleaseDate
+ 0, // UINT8 BiosSize
+ { // MISC_BIOS_CHARACTERISTICS BiosCharacteristics
+ 0, // Reserved :2
+ 0, // Unknown :1
+ 1, // BiosCharacteristicsNotSupported :1
+ // Remaining BiosCharacteristics bits left unset :60
+ },
+ { // BIOSCharacteristicsExtensionBytes[2]
+ 0, // BiosReserved
+ 0x1C // SystemReserved = VirtualMachineSupported |
+ // UefiSpecificationSupported |
+ // TargetContentDistributionEnabled
+ },
+ 0, // UINT8 SystemBiosMajorRelease
+ 0, // UINT8 SystemBiosMinorRelease
+ 0xFF, // UINT8 EmbeddedControllerFirmwareMajorRelease
+ 0xFF // UINT8 EmbeddedControllerFirmwareMinorRelease
+ },
+ // Text strings (unformatted area)
+ "EFI Development Kit II / OVMF\0" // Vendor
+ "0.0.0\0" // BiosVersion
+ "02/06/2015\0" // BiosReleaseDate
+};
+
/**
Validates the SMBIOS entry point structure
@@ -96,12 +141,15 @@ InstallAllStructures (
EFI_STATUS Status;
SMBIOS_STRUCTURE_POINTER SmbiosTable;
EFI_SMBIOS_HANDLE SmbiosHandle;
+ BOOLEAN NeedSmbiosType0;
SmbiosTable.Raw = TableAddress;
if (SmbiosTable.Raw == NULL) {
return EFI_INVALID_PARAMETER;
}
+ NeedSmbiosType0 = TRUE;
+
while (SmbiosTable.Hdr->Type != 127) {
//
// Log the SMBIOS data for this structure
@@ -115,12 +163,30 @@ InstallAllStructures (
);
ASSERT_EFI_ERROR (Status);
+ if (SmbiosTable.Hdr->Type == 0) {
+ NeedSmbiosType0 = FALSE;
+ }
+
//
// Get the next structure address
//
SmbiosTable.Raw = (UINT8 *)(SmbiosTable.Raw + SmbiosTableLength (SmbiosTable));
}
+ if (NeedSmbiosType0) {
+ //
+ // Add OVMF default Type 0 (BIOS Information) table
+ //
+ SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;
+ Status = Smbios->Add (
+ Smbios,
+ NULL,
+ &SmbiosHandle,
+ (EFI_SMBIOS_TABLE_HEADER*) &mOvmfDefaultType0
+ );
+ ASSERT_EFI_ERROR (Status);
+ }
+
return EFI_SUCCESS;
}