diff options
author | Gabriel Somlo <somlo@cmu.edu> | 2014-05-20 16:33:19 +0000 |
---|---|---|
committer | jljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524> | 2014-05-20 16:33:19 +0000 |
commit | a145e28decc529bf26981ae57c3fc2ffe0b946f2 (patch) | |
tree | efb48cc2330ec371614f251c4fda42fcbbd15526 /OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c | |
parent | 6b23d767f6c762178503cf26e4c6d066fd311f25 (diff) | |
download | edk2-platforms-a145e28decc529bf26981ae57c3fc2ffe0b946f2.tar.xz |
OvmfPkg/SMBIOS: Add QEMU support to OVMF SMBIOS driver
Locate QEMU SMBIOS data in fw_cfg and install it via the
SMBIOS protocol.
Starting with qemu-2.1, on pc/x86 machines of type >= 2.1, full
SMBIOS tables are generated and inserted into fw_cfg (i.e., no
per-field patching of locally generated structures is required).
Aside from new code to extract a SMBIOS blob from fw_cfg, this
patch utilizes the pre-existing infrastructure (already used by
Xen) to handle final SMBIOS table creation.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gabriel Somlo <somlo@cmu.edu>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15542 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c')
-rw-r--r-- | OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c index ac48fb7208..626f7dbbfb 100644 --- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c +++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c @@ -84,20 +84,20 @@ SmbiosTableLength ( Install all structures from the given SMBIOS structures block
@param Smbios SMBIOS protocol
- @param EntryPointStructure SMBIOS entry point structures block
+ @param TableAddress SMBIOS tables starting address
**/
EFI_STATUS
InstallAllStructures (
IN EFI_SMBIOS_PROTOCOL *Smbios,
- IN SMBIOS_TABLE_ENTRY_POINT *EntryPointStructure
+ IN UINT8 *TableAddress
)
{
EFI_STATUS Status;
SMBIOS_STRUCTURE_POINTER SmbiosTable;
EFI_SMBIOS_HANDLE SmbiosHandle;
- SmbiosTable.Raw = (UINT8*)(UINTN) EntryPointStructure->TableAddress;
+ SmbiosTable.Raw = TableAddress;
if (SmbiosTable.Raw == NULL) {
return EFI_INVALID_PARAMETER;
}
@@ -145,6 +145,7 @@ SmbiosTablePublishEntry ( EFI_STATUS Status;
EFI_SMBIOS_PROTOCOL *Smbios;
SMBIOS_TABLE_ENTRY_POINT *EntryPointStructure;
+ UINT8 *SmbiosTables;
//
// Find the SMBIOS protocol
@@ -159,11 +160,24 @@ SmbiosTablePublishEntry ( }
//
- // Add Xen SMBIOS data if found
+ // Add Xen or QEMU SMBIOS data if found
//
EntryPointStructure = GetXenSmbiosTables ();
if (EntryPointStructure != NULL) {
- Status = InstallAllStructures (Smbios, EntryPointStructure);
+ SmbiosTables = (UINT8*)(UINTN)EntryPointStructure->TableAddress;
+ } else {
+ SmbiosTables = GetQemuSmbiosTables ();
+ }
+
+ if (SmbiosTables != NULL) {
+ Status = InstallAllStructures (Smbios, SmbiosTables);
+
+ //
+ // Free SmbiosTables if allocated by Qemu (i.e., NOT by Xen):
+ //
+ if (EntryPointStructure == NULL) {
+ FreePool (SmbiosTables);
+ }
}
return Status;
|