2 Detect Xen hvmloader SMBIOS data for usage by OVMF.
4 Copyright (c) 2011, Bei Guan <gbtju85@gmail.com>
5 Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
7 This program and the accompanying materials
8 are licensed and made available under the terms and conditions of the BSD License
9 which accompanies this distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 #include "SmbiosPlatformDxe.h"
18 #include <Library/HobLib.h>
19 #include <Guid/XenInfo.h>
21 #define XEN_SMBIOS_PHYSICAL_ADDRESS 0x000EB000
22 #define XEN_SMBIOS_PHYSICAL_END 0x000F0000
25 Locates the Xen SMBIOS data if it exists
27 @return SMBIOS_TABLE_ENTRY_POINT Address of Xen SMBIOS data
30 SMBIOS_TABLE_ENTRY_POINT
*
36 SMBIOS_TABLE_ENTRY_POINT
*XenSmbiosEntryPointStructure
;
37 EFI_HOB_GUID_TYPE
*GuidHob
;
40 // See if a XenInfo HOB is available
42 GuidHob
= GetFirstGuidHob (&gEfiXenInfoGuid
);
43 if (GuidHob
== NULL
) {
47 for (XenSmbiosPtr
= (UINT8
*)(UINTN
) XEN_SMBIOS_PHYSICAL_ADDRESS
;
48 XenSmbiosPtr
< (UINT8
*)(UINTN
) XEN_SMBIOS_PHYSICAL_END
;
49 XenSmbiosPtr
+= 0x10) {
51 XenSmbiosEntryPointStructure
= (SMBIOS_TABLE_ENTRY_POINT
*) XenSmbiosPtr
;
53 if (!AsciiStrnCmp ((CHAR8
*) XenSmbiosEntryPointStructure
->AnchorString
, "_SM_", 4) &&
54 !AsciiStrnCmp ((CHAR8
*) XenSmbiosEntryPointStructure
->IntermediateAnchorString
, "_DMI_", 5) &&
55 IsEntryPointStructureValid (XenSmbiosEntryPointStructure
)) {
57 return XenSmbiosEntryPointStructure
;