mirror of https://github.com/acidanthera/audk.git
OvmfPkg/SmbiosPlatformDxe: Add OVMF SMBIOS driver (with Xen support)
Locates Xen SMBIOS data and installs it using the SMBIOS protocol. Signed-off-by: gavinguan Reviewed-by: Andrei Warkentin <andreiw@motorola.com> Signed-off-by: jljusten git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12125 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
d5aff67358
commit
fb51181762
|
@ -302,7 +302,6 @@
|
||||||
MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
|
MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
|
||||||
MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
|
MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
|
||||||
MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
|
MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
|
||||||
MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
|
|
||||||
PcAtChipsetPkg/8259InterruptControllerDxe/8259.inf
|
PcAtChipsetPkg/8259InterruptControllerDxe/8259.inf
|
||||||
UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
|
UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
|
||||||
UefiCpuPkg/CpuDxe/CpuDxe.inf
|
UefiCpuPkg/CpuDxe/CpuDxe.inf
|
||||||
|
@ -366,6 +365,12 @@
|
||||||
IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2keyboardDxe.inf
|
IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2keyboardDxe.inf
|
||||||
IntelFrameworkModulePkg/Bus/Isa/IsaFloppyDxe/IsaFloppyDxe.inf
|
IntelFrameworkModulePkg/Bus/Isa/IsaFloppyDxe/IsaFloppyDxe.inf
|
||||||
|
|
||||||
|
#
|
||||||
|
# SMBIOS Support
|
||||||
|
#
|
||||||
|
MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
|
||||||
|
OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
|
||||||
|
|
||||||
#
|
#
|
||||||
# ACPI Support
|
# ACPI Support
|
||||||
#
|
#
|
||||||
|
|
|
@ -152,7 +152,6 @@ INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
|
||||||
INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
|
INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
|
||||||
INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
|
INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
|
||||||
INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
|
INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
|
||||||
INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
|
|
||||||
INF PcAtChipsetPkg/8259InterruptControllerDxe/8259.inf
|
INF PcAtChipsetPkg/8259InterruptControllerDxe/8259.inf
|
||||||
INF UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
|
INF UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
|
||||||
INF UefiCpuPkg/CpuDxe/CpuDxe.inf
|
INF UefiCpuPkg/CpuDxe/CpuDxe.inf
|
||||||
|
@ -198,6 +197,9 @@ INF IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/IsaSerialDxe.inf
|
||||||
INF IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2keyboardDxe.inf
|
INF IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2keyboardDxe.inf
|
||||||
INF IntelFrameworkModulePkg/Bus/Isa/IsaFloppyDxe/IsaFloppyDxe.inf
|
INF IntelFrameworkModulePkg/Bus/Isa/IsaFloppyDxe/IsaFloppyDxe.inf
|
||||||
|
|
||||||
|
INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
|
||||||
|
INF OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
|
||||||
|
|
||||||
INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
|
INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
|
||||||
INF MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf
|
INF MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf
|
||||||
INF RuleOverride=ACPITABLE OvmfPkg/AcpiTables/AcpiTables.inf
|
INF RuleOverride=ACPITABLE OvmfPkg/AcpiTables/AcpiTables.inf
|
||||||
|
|
|
@ -303,7 +303,6 @@
|
||||||
MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
|
MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
|
||||||
MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
|
MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
|
||||||
MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
|
MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
|
||||||
MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
|
|
||||||
PcAtChipsetPkg/8259InterruptControllerDxe/8259.inf
|
PcAtChipsetPkg/8259InterruptControllerDxe/8259.inf
|
||||||
UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
|
UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
|
||||||
UefiCpuPkg/CpuDxe/CpuDxe.inf
|
UefiCpuPkg/CpuDxe/CpuDxe.inf
|
||||||
|
@ -367,6 +366,12 @@
|
||||||
IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2keyboardDxe.inf
|
IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2keyboardDxe.inf
|
||||||
IntelFrameworkModulePkg/Bus/Isa/IsaFloppyDxe/IsaFloppyDxe.inf
|
IntelFrameworkModulePkg/Bus/Isa/IsaFloppyDxe/IsaFloppyDxe.inf
|
||||||
|
|
||||||
|
#
|
||||||
|
# SMBIOS Support
|
||||||
|
#
|
||||||
|
MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
|
||||||
|
OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
|
||||||
|
|
||||||
#
|
#
|
||||||
# ACPI Support
|
# ACPI Support
|
||||||
#
|
#
|
||||||
|
|
|
@ -152,7 +152,6 @@ INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
|
||||||
INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
|
INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
|
||||||
INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
|
INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
|
||||||
INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
|
INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
|
||||||
INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
|
|
||||||
INF PcAtChipsetPkg/8259InterruptControllerDxe/8259.inf
|
INF PcAtChipsetPkg/8259InterruptControllerDxe/8259.inf
|
||||||
INF UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
|
INF UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
|
||||||
INF UefiCpuPkg/CpuDxe/CpuDxe.inf
|
INF UefiCpuPkg/CpuDxe/CpuDxe.inf
|
||||||
|
@ -198,6 +197,9 @@ INF IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/IsaSerialDxe.inf
|
||||||
INF IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2keyboardDxe.inf
|
INF IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2keyboardDxe.inf
|
||||||
INF IntelFrameworkModulePkg/Bus/Isa/IsaFloppyDxe/IsaFloppyDxe.inf
|
INF IntelFrameworkModulePkg/Bus/Isa/IsaFloppyDxe/IsaFloppyDxe.inf
|
||||||
|
|
||||||
|
INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
|
||||||
|
INF OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
|
||||||
|
|
||||||
INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
|
INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
|
||||||
INF MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf
|
INF MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf
|
||||||
INF RuleOverride=ACPITABLE OvmfPkg/AcpiTables/AcpiTables.inf
|
INF RuleOverride=ACPITABLE OvmfPkg/AcpiTables/AcpiTables.inf
|
||||||
|
|
|
@ -302,7 +302,6 @@
|
||||||
MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
|
MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
|
||||||
MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
|
MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
|
||||||
MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
|
MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
|
||||||
MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
|
|
||||||
PcAtChipsetPkg/8259InterruptControllerDxe/8259.inf
|
PcAtChipsetPkg/8259InterruptControllerDxe/8259.inf
|
||||||
UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
|
UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
|
||||||
UefiCpuPkg/CpuDxe/CpuDxe.inf
|
UefiCpuPkg/CpuDxe/CpuDxe.inf
|
||||||
|
@ -366,6 +365,12 @@
|
||||||
IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2keyboardDxe.inf
|
IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2keyboardDxe.inf
|
||||||
IntelFrameworkModulePkg/Bus/Isa/IsaFloppyDxe/IsaFloppyDxe.inf
|
IntelFrameworkModulePkg/Bus/Isa/IsaFloppyDxe/IsaFloppyDxe.inf
|
||||||
|
|
||||||
|
#
|
||||||
|
# SMBIOS Support
|
||||||
|
#
|
||||||
|
MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
|
||||||
|
OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
|
||||||
|
|
||||||
#
|
#
|
||||||
# ACPI Support
|
# ACPI Support
|
||||||
#
|
#
|
||||||
|
|
|
@ -152,7 +152,6 @@ INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
|
||||||
INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
|
INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
|
||||||
INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
|
INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
|
||||||
INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
|
INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
|
||||||
INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
|
|
||||||
INF PcAtChipsetPkg/8259InterruptControllerDxe/8259.inf
|
INF PcAtChipsetPkg/8259InterruptControllerDxe/8259.inf
|
||||||
INF UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
|
INF UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
|
||||||
INF UefiCpuPkg/CpuDxe/CpuDxe.inf
|
INF UefiCpuPkg/CpuDxe/CpuDxe.inf
|
||||||
|
@ -198,6 +197,9 @@ INF IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/IsaSerialDxe.inf
|
||||||
INF IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2keyboardDxe.inf
|
INF IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2keyboardDxe.inf
|
||||||
INF IntelFrameworkModulePkg/Bus/Isa/IsaFloppyDxe/IsaFloppyDxe.inf
|
INF IntelFrameworkModulePkg/Bus/Isa/IsaFloppyDxe/IsaFloppyDxe.inf
|
||||||
|
|
||||||
|
INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
|
||||||
|
INF OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
|
||||||
|
|
||||||
INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
|
INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
|
||||||
INF MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf
|
INF MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf
|
||||||
INF RuleOverride=ACPITABLE OvmfPkg/AcpiTables/AcpiTables.inf
|
INF RuleOverride=ACPITABLE OvmfPkg/AcpiTables/AcpiTables.inf
|
||||||
|
|
|
@ -0,0 +1,170 @@
|
||||||
|
/** @file
|
||||||
|
This driver installs SMBIOS information for OVMF
|
||||||
|
|
||||||
|
Copyright (c) 2011, Bei Guan <gbtju85@gmail.com>
|
||||||
|
Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
||||||
|
|
||||||
|
This program and the accompanying materials
|
||||||
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include "SmbiosPlatformDxe.h"
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Validates the SMBIOS entry point structure
|
||||||
|
|
||||||
|
@param EntryPointStructure SMBIOS entry point structure
|
||||||
|
|
||||||
|
@retval TRUE The entry point structure is valid
|
||||||
|
@retval FALSE The entry point structure is not valid
|
||||||
|
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
IsEntryPointStructureValid (
|
||||||
|
IN SMBIOS_TABLE_ENTRY_POINT *EntryPointStructure
|
||||||
|
)
|
||||||
|
{
|
||||||
|
UINTN Index;
|
||||||
|
UINT8 Length;
|
||||||
|
UINT8 Checksum;
|
||||||
|
UINT8 *BytePtr;
|
||||||
|
|
||||||
|
BytePtr = (UINT8*) EntryPointStructure;
|
||||||
|
Length = EntryPointStructure->EntryPointLength;
|
||||||
|
Checksum = 0;
|
||||||
|
|
||||||
|
for (Index = 0; Index < Length; Index++) {
|
||||||
|
Checksum += BytePtr[Index];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Checksum != 0) {
|
||||||
|
return FALSE;
|
||||||
|
} else {
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get SMBIOS record length.
|
||||||
|
|
||||||
|
@param SmbiosTable SMBIOS pointer.
|
||||||
|
|
||||||
|
**/
|
||||||
|
UINTN
|
||||||
|
SmbiosTableLength (
|
||||||
|
IN SMBIOS_STRUCTURE_POINTER SmbiosTable
|
||||||
|
)
|
||||||
|
{
|
||||||
|
CHAR8 *AChar;
|
||||||
|
UINTN Length;
|
||||||
|
|
||||||
|
AChar = (CHAR8 *)(SmbiosTable.Raw + SmbiosTable.Hdr->Length);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Each structure shall be terminated by a double-null (SMBIOS spec.7.1)
|
||||||
|
//
|
||||||
|
while ((*AChar != 0) || (*(AChar + 1) != 0)) {
|
||||||
|
AChar ++;
|
||||||
|
}
|
||||||
|
Length = ((UINTN)AChar - (UINTN)SmbiosTable.Raw + 2);
|
||||||
|
|
||||||
|
return Length;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Install all structures from the given SMBIOS structures block
|
||||||
|
|
||||||
|
@param Smbios SMBIOS protocol
|
||||||
|
@param EntryPointStructure SMBIOS entry point structures block
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
InstallAllStructures (
|
||||||
|
IN EFI_SMBIOS_PROTOCOL *Smbios,
|
||||||
|
IN SMBIOS_TABLE_ENTRY_POINT *EntryPointStructure
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
SMBIOS_STRUCTURE_POINTER SmbiosTable;
|
||||||
|
EFI_SMBIOS_HANDLE SmbiosHandle;
|
||||||
|
|
||||||
|
SmbiosTable.Raw = (UINT8*)(UINTN) EntryPointStructure->TableAddress;
|
||||||
|
if (SmbiosTable.Raw == NULL) {
|
||||||
|
return EFI_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (SmbiosTable.Hdr->Type != 127) {
|
||||||
|
//
|
||||||
|
// Log the SMBIOS data for this structure
|
||||||
|
//
|
||||||
|
SmbiosHandle = 0;
|
||||||
|
Status = Smbios->Add (
|
||||||
|
Smbios,
|
||||||
|
NULL,
|
||||||
|
&SmbiosHandle,
|
||||||
|
(EFI_SMBIOS_TABLE_HEADER*) SmbiosTable.Raw
|
||||||
|
);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get the next structure address
|
||||||
|
//
|
||||||
|
SmbiosTable.Raw = (UINT8 *)(SmbiosTable.Raw + SmbiosTableLength (SmbiosTable));
|
||||||
|
}
|
||||||
|
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Installs SMBIOS information for OVMF
|
||||||
|
|
||||||
|
@param ImageHandle Module's image handle
|
||||||
|
@param SystemTable Pointer of EFI_SYSTEM_TABLE
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Smbios data successfully installed
|
||||||
|
@retval Other Smbios data was not installed
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
SmbiosTablePublishEntry (
|
||||||
|
IN EFI_HANDLE ImageHandle,
|
||||||
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
EFI_SMBIOS_PROTOCOL *Smbios;
|
||||||
|
SMBIOS_TABLE_ENTRY_POINT *EntryPointStructure;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Find the SMBIOS protocol
|
||||||
|
//
|
||||||
|
Status = gBS->LocateProtocol (
|
||||||
|
&gEfiSmbiosProtocolGuid,
|
||||||
|
NULL,
|
||||||
|
(VOID**)&Smbios
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Add Xen SMBIOS data if found
|
||||||
|
//
|
||||||
|
EntryPointStructure = GetXenSmbiosTables ();
|
||||||
|
if (EntryPointStructure != NULL) {
|
||||||
|
Status = InstallAllStructures (Smbios, EntryPointStructure);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
/** @file
|
||||||
|
This driver installs SMBIOS information for OVMF
|
||||||
|
|
||||||
|
Copyright (c) 2011, Bei Guan <gbtju85@gmail.com>
|
||||||
|
Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
||||||
|
|
||||||
|
This program and the accompanying materials
|
||||||
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#ifndef _SMBIOS_PLATFORM_DXE_H_
|
||||||
|
#define _SMBIOS_PLATFORM_DXE_H_
|
||||||
|
|
||||||
|
#include <PiDxe.h>
|
||||||
|
|
||||||
|
#include <Protocol/Smbios.h>
|
||||||
|
#include <IndustryStandard/SmBios.h>
|
||||||
|
#include <Library/DebugLib.h>
|
||||||
|
#include <Library/BaseLib.h>
|
||||||
|
#include <Library/BaseMemoryLib.h>
|
||||||
|
#include <Library/UefiBootServicesTableLib.h>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Locates the Xen SMBIOS data if it exists
|
||||||
|
|
||||||
|
@return SMBIOS_TABLE_ENTRY_POINT Address of Xen SMBIOS data
|
||||||
|
|
||||||
|
**/
|
||||||
|
SMBIOS_TABLE_ENTRY_POINT *
|
||||||
|
GetXenSmbiosTables (
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Validates the SMBIOS entry point structure
|
||||||
|
|
||||||
|
@param EntryPointStructure SMBIOS entry point structure
|
||||||
|
|
||||||
|
@retval TRUE The entry point structure is valid
|
||||||
|
@retval FALSE The entry point structure is not valid
|
||||||
|
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
IsEntryPointStructureValid (
|
||||||
|
IN SMBIOS_TABLE_ENTRY_POINT *EntryPointStructure
|
||||||
|
);
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,57 @@
|
||||||
|
## @file
|
||||||
|
# This driver installs SMBIOS information for OVMF
|
||||||
|
#
|
||||||
|
# Copyright (c) 2011, Bei Guan <gbtju85@gmail.com>
|
||||||
|
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
||||||
|
#
|
||||||
|
# This program and the accompanying materials
|
||||||
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
#
|
||||||
|
##
|
||||||
|
|
||||||
|
[Defines]
|
||||||
|
INF_VERSION = 0x00010005
|
||||||
|
BASE_NAME = SmbiosPlatformDxe
|
||||||
|
FILE_GUID = 4110465d-5ff3-4f4b-b580-24ed0d06747a
|
||||||
|
MODULE_TYPE = DXE_DRIVER
|
||||||
|
VERSION_STRING = 1.0
|
||||||
|
|
||||||
|
ENTRY_POINT = SmbiosTablePublishEntry
|
||||||
|
|
||||||
|
#
|
||||||
|
# The following information is for reference only and not required by the build tools.
|
||||||
|
#
|
||||||
|
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
||||||
|
#
|
||||||
|
|
||||||
|
[Sources]
|
||||||
|
SmbiosPlatformDxe.h
|
||||||
|
SmbiosPlatformDxe.c
|
||||||
|
Xen.c
|
||||||
|
|
||||||
|
[Packages]
|
||||||
|
MdePkg/MdePkg.dec
|
||||||
|
MdeModulePkg/MdeModulePkg.dec
|
||||||
|
OvmfPkg/OvmfPkg.dec
|
||||||
|
|
||||||
|
[LibraryClasses]
|
||||||
|
UefiBootServicesTableLib
|
||||||
|
BaseMemoryLib
|
||||||
|
BaseLib
|
||||||
|
UefiDriverEntryPoint
|
||||||
|
DebugLib
|
||||||
|
HobLib
|
||||||
|
|
||||||
|
[Protocols]
|
||||||
|
gEfiSmbiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||||
|
|
||||||
|
[Guids]
|
||||||
|
gEfiXenInfoGuid
|
||||||
|
|
||||||
|
[Depex]
|
||||||
|
gEfiSmbiosProtocolGuid
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
/** @file
|
||||||
|
Detect Xen hvmloader SMBIOS data for usage by OVMF.
|
||||||
|
|
||||||
|
Copyright (c) 2011, Bei Guan <gbtju85@gmail.com>
|
||||||
|
Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
||||||
|
|
||||||
|
This program and the accompanying materials
|
||||||
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include "SmbiosPlatformDxe.h"
|
||||||
|
#include <Library/HobLib.h>
|
||||||
|
#include <Guid/XenInfo.h>
|
||||||
|
|
||||||
|
#define XEN_SMBIOS_PHYSICAL_ADDRESS 0x000EB000
|
||||||
|
#define XEN_SMBIOS_PHYSICAL_END 0x000F0000
|
||||||
|
|
||||||
|
/**
|
||||||
|
Locates the Xen SMBIOS data if it exists
|
||||||
|
|
||||||
|
@return SMBIOS_TABLE_ENTRY_POINT Address of Xen SMBIOS data
|
||||||
|
|
||||||
|
**/
|
||||||
|
SMBIOS_TABLE_ENTRY_POINT *
|
||||||
|
GetXenSmbiosTables (
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
UINT8 *XenSmbiosPtr;
|
||||||
|
SMBIOS_TABLE_ENTRY_POINT *XenSmbiosEntryPointStructure;
|
||||||
|
EFI_HOB_GUID_TYPE *GuidHob;
|
||||||
|
|
||||||
|
//
|
||||||
|
// See if a XenInfo HOB is available
|
||||||
|
//
|
||||||
|
GuidHob = GetFirstGuidHob (&gEfiXenInfoGuid);
|
||||||
|
if (GuidHob == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (XenSmbiosPtr = (UINT8*) XEN_SMBIOS_PHYSICAL_ADDRESS;
|
||||||
|
XenSmbiosPtr < (UINT8*) XEN_SMBIOS_PHYSICAL_END;
|
||||||
|
XenSmbiosPtr += 0x10) {
|
||||||
|
|
||||||
|
XenSmbiosEntryPointStructure = (SMBIOS_TABLE_ENTRY_POINT *) XenSmbiosPtr;
|
||||||
|
|
||||||
|
if (!AsciiStrnCmp ((CHAR8 *) XenSmbiosEntryPointStructure->AnchorString, "_SM_", 4) &&
|
||||||
|
!AsciiStrnCmp ((CHAR8 *) XenSmbiosEntryPointStructure->IntermediateAnchorString, "_DMI_", 5) &&
|
||||||
|
IsEntryPointStructureValid (XenSmbiosEntryPointStructure)) {
|
||||||
|
|
||||||
|
return XenSmbiosEntryPointStructure;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
Loading…
Reference in New Issue