Discussion:
[edk2] [PATCH 1/6] OvmfPkg: SmbiosPlatformDxe: move IsEntryPointStructureValid() to Xen.c
Laszlo Ersek
2015-07-15 22:41:17 UTC
Permalink
This function is only called from Xen.c, so it should be defined in Xen.c
and have internal linkage (ie. STATIC).

Cc: Jordan Justen <***@intel.com>
Cc: Wei Liu <***@citrix.com>
Cc: Gabriel Somlo <***@cmu.edu>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <***@redhat.com>
---
OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h | 15 ---------
OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c | 35 --------------------
OvmfPkg/SmbiosPlatformDxe/Xen.c | 35 ++++++++++++++++++++
3 files changed, 35 insertions(+), 50 deletions(-)

diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h
index e2606e1..6210a56 100644
--- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h
+++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h
@@ -51,19 +51,4 @@ GetQemuSmbiosTables (
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
diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c
index f70db2f..29948a4 100644
--- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c
+++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c
@@ -65,41 +65,6 @@ STATIC CONST OVMF_TYPE0 mOvmfDefaultType0 = {


/**
- 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 = Checksum + (UINT8) BytePtr[Index];
- }
-
- if (Checksum != 0) {
- return FALSE;
- } else {
- return TRUE;
- }
-}
-
-
-/**
Get SMBIOS record length.

@param SmbiosTable SMBIOS pointer.
diff --git a/OvmfPkg/SmbiosPlatformDxe/Xen.c b/OvmfPkg/SmbiosPlatformDxe/Xen.c
index 6a5c3f8..3f018d6 100644
--- a/OvmfPkg/SmbiosPlatformDxe/Xen.c
+++ b/OvmfPkg/SmbiosPlatformDxe/Xen.c
@@ -22,6 +22,41 @@
#define XEN_SMBIOS_PHYSICAL_END 0x000F0000

/**
+ 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
+
+**/
+STATIC
+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 = Checksum + (UINT8) BytePtr[Index];
+ }
+
+ if (Checksum != 0) {
+ return FALSE;
+ } else {
+ return TRUE;
+ }
+}
+
+/**
Locates the Xen SMBIOS data if it exists

@return SMBIOS_TABLE_ENTRY_POINT Address of Xen SMBIOS data
--
1.8.3.1
Laszlo Ersek
2015-07-15 22:41:18 UTC
Permalink
The Xen code in SmbiosPlatformDxe is centered on the informational HOB
with GUID gEfiXenInfoGuid. This Xen hand-off mechanism is specific to the
IA32 and X64 architectures. Therefore, sequester it from the rest of the
source with appropriate preprocessing directives, arch-specific INF file
sections, and by renaming "Xen.c" to "X86Xen.c".

(That file name pattern is inspired by
"OvmfPkg/Library/XenHypercallLib/X86XenHypercall.c".)

This change enables SmbiosPlatformDxe for ARM architectures; update the
VALID_ARCHITECTURES comment accordingly.

Cc: Ard Biesheuvel <***@linaro.org>
Cc: Jordan Justen <***@intel.com>
Cc: Wei Liu <***@citrix.com>
Cc: Gabriel Somlo <***@cmu.edu>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <***@redhat.com>
---
OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf | 12 ++++++++----
OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h | 2 ++
OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c | 5 +++++
OvmfPkg/SmbiosPlatformDxe/{Xen.c => X86Xen.c} | 0
4 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
index 6596392..ac4666a 100644
--- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
+++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
@@ -25,15 +25,17 @@ [Defines]
#
# The following information is for reference only and not required by the build tools.
#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
+# VALID_ARCHITECTURES = IA32 X64 IPF EBC ARM AARCH64
#

[Sources]
SmbiosPlatformDxe.h
SmbiosPlatformDxe.c
- Xen.c
Qemu.c

+[Sources.IA32, Sources.X64]
+ X86Xen.c
+
[Packages]
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
@@ -45,14 +47,16 @@ [LibraryClasses]
BaseLib
UefiDriverEntryPoint
DebugLib
- HobLib
QemuFwCfgLib
MemoryAllocationLib

+[LibraryClasses.IA32, LibraryClasses.X64]
+ HobLib
+
[Protocols]
gEfiSmbiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED

-[Guids]
+[Guids.IA32, Guids.X64]
gEfiXenInfoGuid

[Depex]
diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h
index 6210a56..428bdcf 100644
--- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h
+++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h
@@ -28,6 +28,7 @@
#include <Library/MemoryAllocationLib.h>


+#if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)
/**
Locates the Xen SMBIOS data if it exists

@@ -38,6 +39,7 @@ SMBIOS_TABLE_ENTRY_POINT *
GetXenSmbiosTables (
VOID
);
+#endif


/**
diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c
index 29948a4..941f8cd 100644
--- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c
+++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c
@@ -195,7 +195,12 @@ SmbiosTablePublishEntry (
//
// Add Xen or QEMU SMBIOS data if found
//
+#if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)
EntryPointStructure = GetXenSmbiosTables ();
+#else
+ EntryPointStructure = NULL;
+#endif
+
if (EntryPointStructure != NULL) {
SmbiosTables = (UINT8*)(UINTN)EntryPointStructure->TableAddress;
} else {
diff --git a/OvmfPkg/SmbiosPlatformDxe/Xen.c b/OvmfPkg/SmbiosPlatformDxe/X86Xen.c
similarity index 100%
rename from OvmfPkg/SmbiosPlatformDxe/Xen.c
rename to OvmfPkg/SmbiosPlatformDxe/X86Xen.c
--
1.8.3.1
Wei Liu
2015-07-16 15:34:36 UTC
Permalink
CC Ian, Stefano and Julien who are familiar with ARM side of things.
Post by Laszlo Ersek
The Xen code in SmbiosPlatformDxe is centered on the informational HOB
with GUID gEfiXenInfoGuid. This Xen hand-off mechanism is specific to the
IA32 and X64 architectures. Therefore, sequester it from the rest of the
source with appropriate preprocessing directives, arch-specific INF file
sections, and by renaming "Xen.c" to "X86Xen.c".
(That file name pattern is inspired by
"OvmfPkg/Library/XenHypercallLib/X86XenHypercall.c".)
This change enables SmbiosPlatformDxe for ARM architectures; update the
VALID_ARCHITECTURES comment accordingly.
Contributed-under: TianoCore Contribution Agreement 1.0
---
OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf | 12 ++++++++----
OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h | 2 ++
OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c | 5 +++++
OvmfPkg/SmbiosPlatformDxe/{Xen.c => X86Xen.c} | 0
4 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
index 6596392..ac4666a 100644
--- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
+++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
@@ -25,15 +25,17 @@ [Defines]
#
# The following information is for reference only and not required by the build tools.
#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
+# VALID_ARCHITECTURES = IA32 X64 IPF EBC ARM AARCH64
#
[Sources]
SmbiosPlatformDxe.h
SmbiosPlatformDxe.c
- Xen.c
Qemu.c
+[Sources.IA32, Sources.X64]
+ X86Xen.c
+
[Packages]
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
@@ -45,14 +47,16 @@ [LibraryClasses]
BaseLib
UefiDriverEntryPoint
DebugLib
- HobLib
QemuFwCfgLib
MemoryAllocationLib
+[LibraryClasses.IA32, LibraryClasses.X64]
+ HobLib
+
[Protocols]
gEfiSmbiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED
-[Guids]
+[Guids.IA32, Guids.X64]
gEfiXenInfoGuid
[Depex]
diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h
index 6210a56..428bdcf 100644
--- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h
+++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h
@@ -28,6 +28,7 @@
#include <Library/MemoryAllocationLib.h>
+#if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)
/**
Locates the Xen SMBIOS data if it exists
@@ -38,6 +39,7 @@ SMBIOS_TABLE_ENTRY_POINT *
GetXenSmbiosTables (
VOID
);
+#endif
/**
diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c
index 29948a4..941f8cd 100644
--- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c
+++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c
@@ -195,7 +195,12 @@ SmbiosTablePublishEntry (
//
// Add Xen or QEMU SMBIOS data if found
//
+#if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)
EntryPointStructure = GetXenSmbiosTables ();
+#else
+ EntryPointStructure = NULL;
+#endif
+
if (EntryPointStructure != NULL) {
SmbiosTables = (UINT8*)(UINTN)EntryPointStructure->TableAddress;
} else {
diff --git a/OvmfPkg/SmbiosPlatformDxe/Xen.c b/OvmfPkg/SmbiosPlatformDxe/X86Xen.c
similarity index 100%
rename from OvmfPkg/SmbiosPlatformDxe/Xen.c
rename to OvmfPkg/SmbiosPlatformDxe/X86Xen.c
--
1.8.3.1
Laszlo Ersek
2015-07-16 16:03:03 UTC
Permalink
Post by Wei Liu
CC Ian, Stefano and Julien who are familiar with ARM side of things.
Right -- I Cc'd Ard too on this patch because he implemented the ARM
hypercalls.

For now, this patch series explicitly doesn't try to implement
SMBIOS-on-ARM-Xen. That could be a future feature.

In this patch I'm just separating out Xen code that will definitely not
work ARM. Refer to
"OvmfPkg/Library/XenHypercallLib/XenHypercallLib.inf": the
"gEfiXenInfoGuid" HOB is X86 specific, and here I'm just following what
I learned from reviewing Ard's code there.

Some of the code in this module works on both x86 and ARM, while some
other code (which happens to be Xen code) only works on x86. The patch
just separates the x86-only code out.

Thanks!
Laszlo
Post by Wei Liu
Post by Laszlo Ersek
The Xen code in SmbiosPlatformDxe is centered on the informational HOB
with GUID gEfiXenInfoGuid. This Xen hand-off mechanism is specific to the
IA32 and X64 architectures. Therefore, sequester it from the rest of the
source with appropriate preprocessing directives, arch-specific INF file
sections, and by renaming "Xen.c" to "X86Xen.c".
(That file name pattern is inspired by
"OvmfPkg/Library/XenHypercallLib/X86XenHypercall.c".)
This change enables SmbiosPlatformDxe for ARM architectures; update the
VALID_ARCHITECTURES comment accordingly.
Contributed-under: TianoCore Contribution Agreement 1.0
---
OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf | 12 ++++++++----
OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h | 2 ++
OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c | 5 +++++
OvmfPkg/SmbiosPlatformDxe/{Xen.c => X86Xen.c} | 0
4 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
index 6596392..ac4666a 100644
--- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
+++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
@@ -25,15 +25,17 @@ [Defines]
#
# The following information is for reference only and not required by the build tools.
#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
+# VALID_ARCHITECTURES = IA32 X64 IPF EBC ARM AARCH64
#
[Sources]
SmbiosPlatformDxe.h
SmbiosPlatformDxe.c
- Xen.c
Qemu.c
+[Sources.IA32, Sources.X64]
+ X86Xen.c
+
[Packages]
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
@@ -45,14 +47,16 @@ [LibraryClasses]
BaseLib
UefiDriverEntryPoint
DebugLib
- HobLib
QemuFwCfgLib
MemoryAllocationLib
+[LibraryClasses.IA32, LibraryClasses.X64]
+ HobLib
+
[Protocols]
gEfiSmbiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED
-[Guids]
+[Guids.IA32, Guids.X64]
gEfiXenInfoGuid
[Depex]
diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h
index 6210a56..428bdcf 100644
--- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h
+++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h
@@ -28,6 +28,7 @@
#include <Library/MemoryAllocationLib.h>
+#if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)
/**
Locates the Xen SMBIOS data if it exists
@@ -38,6 +39,7 @@ SMBIOS_TABLE_ENTRY_POINT *
GetXenSmbiosTables (
VOID
);
+#endif
/**
diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c
index 29948a4..941f8cd 100644
--- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c
+++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c
@@ -195,7 +195,12 @@ SmbiosTablePublishEntry (
//
// Add Xen or QEMU SMBIOS data if found
//
+#if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)
EntryPointStructure = GetXenSmbiosTables ();
+#else
+ EntryPointStructure = NULL;
+#endif
+
if (EntryPointStructure != NULL) {
SmbiosTables = (UINT8*)(UINTN)EntryPointStructure->TableAddress;
} else {
diff --git a/OvmfPkg/SmbiosPlatformDxe/Xen.c b/OvmfPkg/SmbiosPlatformDxe/X86Xen.c
similarity index 100%
rename from OvmfPkg/SmbiosPlatformDxe/Xen.c
rename to OvmfPkg/SmbiosPlatformDxe/X86Xen.c
--
1.8.3.1
Gabriel L. Somlo
2015-07-16 15:44:56 UTC
Permalink
Post by Laszlo Ersek
The Xen code in SmbiosPlatformDxe is centered on the informational HOB
with GUID gEfiXenInfoGuid. This Xen hand-off mechanism is specific to the
IA32 and X64 architectures. Therefore, sequester it from the rest of the
source with appropriate preprocessing directives, arch-specific INF file
sections, and by renaming "Xen.c" to "X86Xen.c".
(That file name pattern is inspired by
"OvmfPkg/Library/XenHypercallLib/X86XenHypercall.c".)
This change enables SmbiosPlatformDxe for ARM architectures; update the
VALID_ARCHITECTURES comment accordingly.
Contributed-under: TianoCore Contribution Agreement 1.0
Acked-by: Gabriel Somlo <***@cmu.edu>

Thanks,
--G
Post by Laszlo Ersek
---
OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf | 12 ++++++++----
OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h | 2 ++
OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c | 5 +++++
OvmfPkg/SmbiosPlatformDxe/{Xen.c => X86Xen.c} | 0
4 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
index 6596392..ac4666a 100644
--- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
+++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
@@ -25,15 +25,17 @@ [Defines]
#
# The following information is for reference only and not required by the build tools.
#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
+# VALID_ARCHITECTURES = IA32 X64 IPF EBC ARM AARCH64
#
[Sources]
SmbiosPlatformDxe.h
SmbiosPlatformDxe.c
- Xen.c
Qemu.c
+[Sources.IA32, Sources.X64]
+ X86Xen.c
+
[Packages]
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
@@ -45,14 +47,16 @@ [LibraryClasses]
BaseLib
UefiDriverEntryPoint
DebugLib
- HobLib
QemuFwCfgLib
MemoryAllocationLib
+[LibraryClasses.IA32, LibraryClasses.X64]
+ HobLib
+
[Protocols]
gEfiSmbiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED
-[Guids]
+[Guids.IA32, Guids.X64]
gEfiXenInfoGuid
[Depex]
diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h
index 6210a56..428bdcf 100644
--- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h
+++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h
@@ -28,6 +28,7 @@
#include <Library/MemoryAllocationLib.h>
+#if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)
/**
Locates the Xen SMBIOS data if it exists
@@ -38,6 +39,7 @@ SMBIOS_TABLE_ENTRY_POINT *
GetXenSmbiosTables (
VOID
);
+#endif
/**
diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c
index 29948a4..941f8cd 100644
--- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c
+++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c
@@ -195,7 +195,12 @@ SmbiosTablePublishEntry (
//
// Add Xen or QEMU SMBIOS data if found
//
+#if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)
EntryPointStructure = GetXenSmbiosTables ();
+#else
+ EntryPointStructure = NULL;
+#endif
+
if (EntryPointStructure != NULL) {
SmbiosTables = (UINT8*)(UINTN)EntryPointStructure->TableAddress;
} else {
diff --git a/OvmfPkg/SmbiosPlatformDxe/Xen.c b/OvmfPkg/SmbiosPlatformDxe/X86Xen.c
similarity index 100%
rename from OvmfPkg/SmbiosPlatformDxe/Xen.c
rename to OvmfPkg/SmbiosPlatformDxe/X86Xen.c
--
1.8.3.1
Laszlo Ersek
2015-07-15 22:41:19 UTC
Permalink
This driver is soon going to be built by ArmVirtPkg/ArmVirtQemu.dsc
(without any changes). Although VALID_ARCHITECTURES is not used by the
build system (it is just a comment), it is best kept up-to-date for human
readers' sake.

Cc: Feng Tian <***@intel.com>
Cc: Elvin Li <***@intel.com>
Cc: Star Zeng <***@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <***@redhat.com>
---
MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf b/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
index cabc9d7..4fd6b97 100644
--- a/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
+++ b/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
@@ -26,7 +26,7 @@ [Defines]
#
# The following information is for reference only and not required by the build tools.
#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
+# VALID_ARCHITECTURES = IA32 X64 IPF EBC ARM AARCH64
#

[Sources]
--
1.8.3.1
Zeng, Star
2015-07-16 00:36:33 UTC
Permalink
Reviewed-by: Star Zeng <***@intel.com>

-----Original Message-----
From: Laszlo Ersek [mailto:***@redhat.com]
Sent: Thursday, July 16, 2015 6:41 AM
To: edk2-***@lists.sourceforge.net
Cc: Tian, Feng; Elvin Li; Zeng, Star
Subject: [PATCH 3/6] MdeModulePkg: SmbiosDxe: ARM and AARCH64 are VALID_ARCHITECTURES

This driver is soon going to be built by ArmVirtPkg/ArmVirtQemu.dsc (without any changes). Although VALID_ARCHITECTURES is not used by the build system (it is just a comment), it is best kept up-to-date for human readers' sake.

Cc: Feng Tian <***@intel.com>
Cc: Elvin Li <***@intel.com>
Cc: Star Zeng <***@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <***@redhat.com>
---
MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf b/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
index cabc9d7..4fd6b97 100644
--- a/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
+++ b/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
@@ -26,7 +26,7 @@ [Defines]
#
# The following information is for reference only and not required by the build tools.
#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
+# VALID_ARCHITECTURES = IA32 X64 IPF EBC ARM AARCH64
#

[Sources]
--
1.8.3.1
Tian, Feng
2015-07-16 01:49:16 UTC
Permalink
Reviewed-by: Feng Tian <***@intel.com>

-----Original Message-----
From: Laszlo Ersek [mailto:***@redhat.com]
Sent: Thursday, July 16, 2015 06:41
To: edk2-***@lists.sourceforge.net
Cc: Tian, Feng; Elvin Li; Zeng, Star
Subject: [PATCH 3/6] MdeModulePkg: SmbiosDxe: ARM and AARCH64 are VALID_ARCHITECTURES

This driver is soon going to be built by ArmVirtPkg/ArmVirtQemu.dsc (without any changes). Although VALID_ARCHITECTURES is not used by the build system (it is just a comment), it is best kept up-to-date for human readers' sake.

Cc: Feng Tian <***@intel.com>
Cc: Elvin Li <***@intel.com>
Cc: Star Zeng <***@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <***@redhat.com>
---
MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf b/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
index cabc9d7..4fd6b97 100644
--- a/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
+++ b/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
@@ -26,7 +26,7 @@ [Defines]
#
# The following information is for reference only and not required by the build tools.
#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
+# VALID_ARCHITECTURES = IA32 X64 IPF EBC ARM AARCH64
#

[Sources]
--
1.8.3.1
Laszlo Ersek
2015-07-15 22:41:20 UTC
Permalink
Many universal DXE drivers in edk2 can be controlled by setting dynamic
PCDs. Such a PCD must be set before the consumer DXE driver is dispatched.

(In general we assume that the DXE driver will consume the PCD in its
entry point, or in the constructor of a library instance it links against.
In special cases this requirement can be relaxed a bit, if we know that
the DXE driver accesses the PCD only in a protocol member function that it
exports.)

On the QEMU platform, the PCD values to be set for the universal drivers
are frequently derived from fw_cfg files that QEMU exports.

In OvmfPkg we tend to handle this in the following way:

- For IA32 and X64, OvmfPkg provides a QemuFwCfgLib instance that is
usable in PEI.

- In PlatformPei, fw_cfg files can be loaded and transformed to PCD
values.

- Any DXE driver is bound to be dispatched after the PEI phase is done.

(In specific cases other ordering solutions might be possible, via Depex
or protocol notify, etc.)

In ArmVirtPkg/ArmVirtQemu, things differ a bit:

- We don't have an ArmVirtPkg-specific ("Platform") PEIM. This is actually
a good thing for now, so let's not introduce one just for this purpose.

- Even if we had such a PEIM, it could not easily access fw_cfg: the MMIO
addresses of the fw_cfg device are available only in the DTB that QEMU
exports.

(Accordingly, our QemuFwCfgLib instance is restricted to DXE_DRIVER
modules: VirtFdtDxe parses the DTB, stores the fw_cfg addresses in PCDs,
and then QemuFwCfgLib's constructor fetches those PCDs.)

There are some examples in ArmVirtPkg where early code is forced to
parse the DTB manually, but those examples are all painful, and our goal
here (controlling universal DXE drivers) doesn't justify more of that
pain.

Therefore, introduce a separate, minimal DXE driver that is dispatched
strictly after VirtFdtDxe (so that it can use QemuFwCfgLib), and strictly
before other DXE drivers (so that it can set dynamic PCDs for them).
Because VirtFdtDxe is already ordered with the APRIORI DXE file, it is
simplest to do the same for the new driver.

Actual fw_cfg files and PCDs shall be accessed in future patches.

Cc: Ard Biesheuvel <***@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <***@redhat.com>
---
ArmVirtPkg/QemuFwCfgToPcdDxe/QemuFwCfgToPcd.inf | 42 ++++++++++++++++++++
ArmVirtPkg/QemuFwCfgToPcdDxe/QemuFwCfgToPcd.c | 33 +++++++++++++++
ArmVirtPkg/ArmVirtQemu.dsc | 1 +
ArmVirtPkg/ArmVirtQemu.fdf | 2 +
4 files changed, 78 insertions(+)

diff --git a/ArmVirtPkg/QemuFwCfgToPcdDxe/QemuFwCfgToPcd.inf b/ArmVirtPkg/QemuFwCfgToPcdDxe/QemuFwCfgToPcd.inf
new file mode 100644
index 0000000..a9983be
--- /dev/null
+++ b/ArmVirtPkg/QemuFwCfgToPcdDxe/QemuFwCfgToPcd.inf
@@ -0,0 +1,42 @@
+## @file
+# An "early" DXE driver that parses well-known fw-cfg files into dynamic PCDs
+# that control other (universal) DXE drivers.
+#
+# Copyright (C) 2015, Red Hat, Inc.
+# Copyright (c) 2014, Linaro Ltd. 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 = QemuFwCfgToPcdDxe
+ FILE_GUID = 5bb7cc92-1a36-4833-84cf-db7f8258e48d
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.0
+ ENTRY_POINT = ParseQemuFwCfgToPcd
+
+[Sources]
+ QemuFwCfgToPcd.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ OvmfPkg/OvmfPkg.dec
+
+[LibraryClasses]
+ PcdLib
+ QemuFwCfgLib
+ UefiDriverEntryPoint
+
+[Pcd]
+
+[Depex]
+ TRUE
diff --git a/ArmVirtPkg/QemuFwCfgToPcdDxe/QemuFwCfgToPcd.c b/ArmVirtPkg/QemuFwCfgToPcdDxe/QemuFwCfgToPcd.c
new file mode 100644
index 0000000..8f60e21
--- /dev/null
+++ b/ArmVirtPkg/QemuFwCfgToPcdDxe/QemuFwCfgToPcd.c
@@ -0,0 +1,33 @@
+/** @file
+* An "early" DXE driver that parses well-known fw-cfg files into dynamic PCDs
+* that control other (universal) DXE drivers.
+*
+* Copyright (C) 2015, Red Hat, Inc.
+* Copyright (c) 2014, Linaro Ltd. 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 <Uefi/UefiBaseType.h>
+#include <Uefi/UefiSpec.h>
+
+#include <Library/PcdLib.h>
+#include <Library/QemuFwCfgLib.h>
+
+EFI_STATUS
+EFIAPI
+ParseQemuFwCfgToPcd (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ return EFI_SUCCESS;
+}
diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
index 573eb5f..3f5a19e 100644
--- a/ArmVirtPkg/ArmVirtQemu.dsc
+++ b/ArmVirtPkg/ArmVirtQemu.dsc
@@ -303,6 +303,7 @@ [Components.common]
# Platform Driver
#
ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf
+ ArmVirtPkg/QemuFwCfgToPcdDxe/QemuFwCfgToPcd.inf
OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
OvmfPkg/VirtioNetDxe/VirtioNet.inf
diff --git a/ArmVirtPkg/ArmVirtQemu.fdf b/ArmVirtPkg/ArmVirtQemu.fdf
index 41bcda8..5b6bda8 100644
--- a/ArmVirtPkg/ArmVirtQemu.fdf
+++ b/ArmVirtPkg/ArmVirtQemu.fdf
@@ -104,10 +104,12 @@ [FV.FvMain]
APRIORI DXE {
INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
INF ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf
+ INF ArmVirtPkg/QemuFwCfgToPcdDxe/QemuFwCfgToPcd.inf
}
INF MdeModulePkg/Core/Dxe/DxeMain.inf
INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
INF ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf
+ INF ArmVirtPkg/QemuFwCfgToPcdDxe/QemuFwCfgToPcd.inf

#
# PI DXE Drivers producing Architectural Protocols (EFI Services)
--
1.8.3.1
Laszlo Ersek
2015-07-15 22:41:21 UTC
Permalink
(This patch parallels OvmfPkg commit 37baf06b (SVN r17676).)

PcdSmbiosVersion controls the version number of the SMBIOS entry point
table (and other, related things) that the universal
"MdeModulePkg/Universal/SmbiosDxe" driver, providing EFI_SMBIOS_PROTOCOL,
installs.

The "virt" machine type of QEMU generates SMBIOS payload for the firmware
to install. The payload includes the entry point table ("anchor" table).
OvmfPkg/SmbiosPlatformDxe cannot install the anchor table (because that is
the jurisdiction of the generic "MdeModulePkg/Universal/SmbiosDxe"
driver); however, we can parse the entry point version from QEMU's anchor
table, and instruct "MdeModulePkg/Universal/SmbiosDxe" to adhere to that
version.

As default for PcdSmbiosVersion we should keep the current 0x0300 value
(ie. SMBIOS 3.0) from "MdeModulePkg/MdeModulePkg.dec"; that spec version
was specifically created for ARM / AARCH64 needs.

Cc: Ard Biesheuvel <***@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <***@redhat.com>
---
ArmVirtPkg/QemuFwCfgToPcdDxe/QemuFwCfgToPcd.inf | 4 ++
ArmVirtPkg/QemuFwCfgToPcdDxe/QemuFwCfgToPcd.c | 40 ++++++++++++++++++++
ArmVirtPkg/ArmVirtQemu.dsc | 5 +++
3 files changed, 49 insertions(+)

diff --git a/ArmVirtPkg/QemuFwCfgToPcdDxe/QemuFwCfgToPcd.inf b/ArmVirtPkg/QemuFwCfgToPcdDxe/QemuFwCfgToPcd.inf
index a9983be..649cfdc 100644
--- a/ArmVirtPkg/QemuFwCfgToPcdDxe/QemuFwCfgToPcd.inf
+++ b/ArmVirtPkg/QemuFwCfgToPcdDxe/QemuFwCfgToPcd.inf
@@ -29,14 +29,18 @@ [Sources]

[Packages]
MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
OvmfPkg/OvmfPkg.dec

[LibraryClasses]
+ BaseMemoryLib
+ DebugLib
PcdLib
QemuFwCfgLib
UefiDriverEntryPoint

[Pcd]
+ gEfiMdeModulePkgTokenSpaceGuid.PcdSmbiosVersion

[Depex]
TRUE
diff --git a/ArmVirtPkg/QemuFwCfgToPcdDxe/QemuFwCfgToPcd.c b/ArmVirtPkg/QemuFwCfgToPcdDxe/QemuFwCfgToPcd.c
index 8f60e21..814bb5c 100644
--- a/ArmVirtPkg/QemuFwCfgToPcdDxe/QemuFwCfgToPcd.c
+++ b/ArmVirtPkg/QemuFwCfgToPcdDxe/QemuFwCfgToPcd.c
@@ -19,9 +19,48 @@
#include <Uefi/UefiBaseType.h>
#include <Uefi/UefiSpec.h>

+#include <IndustryStandard/SmBios.h>
+
+#include <Library/BaseMemoryLib.h>
+#include <Library/DebugLib.h>
#include <Library/PcdLib.h>
#include <Library/QemuFwCfgLib.h>

+
+/**
+ Set the SMBIOS entry point version for the generic SmbiosDxe driver.
+**/
+STATIC
+VOID
+SmbiosVersionInitialization (
+ VOID
+ )
+{
+ FIRMWARE_CONFIG_ITEM Anchor;
+ UINTN AnchorSize;
+ SMBIOS_TABLE_ENTRY_POINT QemuAnchor;
+ UINT16 SmbiosVersion;
+
+ if (RETURN_ERROR (QemuFwCfgFindFile ("etc/smbios/smbios-anchor", &Anchor,
+ &AnchorSize)) ||
+ AnchorSize != sizeof QemuAnchor) {
+ return;
+ }
+
+ QemuFwCfgSelectItem (Anchor);
+ QemuFwCfgReadBytes (AnchorSize, &QemuAnchor);
+ if (CompareMem (QemuAnchor.AnchorString, "_SM_", 4) != 0 ||
+ CompareMem (QemuAnchor.IntermediateAnchorString, "_DMI_", 5) != 0) {
+ return;
+ }
+
+ SmbiosVersion = (UINT16)(QemuAnchor.MajorVersion << 8 |
+ QemuAnchor.MinorVersion);
+ DEBUG ((EFI_D_INFO, "%a: SMBIOS version from QEMU: 0x%04x\n", __FUNCTION__,
+ SmbiosVersion));
+ PcdSet16 (PcdSmbiosVersion, SmbiosVersion);
+}
+
EFI_STATUS
EFIAPI
ParseQemuFwCfgToPcd (
@@ -29,5 +68,6 @@ ParseQemuFwCfgToPcd (
IN EFI_SYSTEM_TABLE *SystemTable
)
{
+ SmbiosVersionInitialization ();
return EFI_SUCCESS;
}
diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
index 3f5a19e..f5dd8a3 100644
--- a/ArmVirtPkg/ArmVirtQemu.dsc
+++ b/ArmVirtPkg/ArmVirtQemu.dsc
@@ -225,6 +225,11 @@ [PcdsDynamicDefault.common]
gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoHorizontalResolution|640
gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoVerticalResolution|480

+ #
+ # SMBIOS entry point version
+ #
+ gEfiMdeModulePkgTokenSpaceGuid.PcdSmbiosVersion|0x0300
+
################################################################################
#
# Components Section - list of all EDK II Modules needed by this Platform
--
1.8.3.1
Laszlo Ersek
2015-07-15 22:41:22 UTC
Permalink
The "MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf" driver is generic, it
provides EFI_SMBIOS_PROTOCOL.

The "OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf" driver downloads the
SMBIOS payload from QEMU via fw_cfg.

Cc: Ard Biesheuvel <***@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <***@redhat.com>
---
ArmVirtPkg/ArmVirtQemu.dsc | 6 ++++++
ArmVirtPkg/ArmVirtQemu.fdf | 6 ++++++
2 files changed, 12 insertions(+)

diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
index f5dd8a3..9570cc2 100644
--- a/ArmVirtPkg/ArmVirtQemu.dsc
+++ b/ArmVirtPkg/ArmVirtQemu.dsc
@@ -339,6 +339,12 @@ [Components.common]
MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf

#
+ # SMBIOS Support
+ #
+ MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
+ OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
+
+ #
# ACPI Support
#
MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
diff --git a/ArmVirtPkg/ArmVirtQemu.fdf b/ArmVirtPkg/ArmVirtQemu.fdf
index 5b6bda8..4ef0f8b 100644
--- a/ArmVirtPkg/ArmVirtQemu.fdf
+++ b/ArmVirtPkg/ArmVirtQemu.fdf
@@ -201,6 +201,12 @@ [FV.FvMain]
INF MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf

#
+ # SMBIOS Support
+ #
+ INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
+ INF OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
+
+ #
# ACPI Support
#
INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
--
1.8.3.1
Ard Biesheuvel
2015-07-20 12:41:49 UTC
Permalink
Post by Laszlo Ersek
The "MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf" driver is generic, it
provides EFI_SMBIOS_PROTOCOL.
The "OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf" driver downloads the
SMBIOS payload from QEMU via fw_cfg.
Contributed-under: TianoCore Contribution Agreement 1.0
---
ArmVirtPkg/ArmVirtQemu.dsc | 6 ++++++
ArmVirtPkg/ArmVirtQemu.fdf | 6 ++++++
2 files changed, 12 insertions(+)
diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
index f5dd8a3..9570cc2 100644
--- a/ArmVirtPkg/ArmVirtQemu.dsc
+++ b/ArmVirtPkg/ArmVirtQemu.dsc
@@ -339,6 +339,12 @@ [Components.common]
MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
#
+ # SMBIOS Support
+ #
+ MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
+ OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
+
+ #
# ACPI Support
#
MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
diff --git a/ArmVirtPkg/ArmVirtQemu.fdf b/ArmVirtPkg/ArmVirtQemu.fdf
index 5b6bda8..4ef0f8b 100644
--- a/ArmVirtPkg/ArmVirtQemu.fdf
+++ b/ArmVirtPkg/ArmVirtQemu.fdf
@@ -201,6 +201,12 @@ [FV.FvMain]
INF MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
#
+ # SMBIOS Support
+ #
+ INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
+ INF OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
+
+ #
# ACPI Support
#
INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
--
1.8.3.1
Wei Liu
2015-07-16 15:36:28 UTC
Permalink
Post by Laszlo Ersek
This function is only called from Xen.c, so it should be defined in Xen.c
and have internal linkage (ie. STATIC).
Contributed-under: TianoCore Contribution Agreement 1.0
Reviewed-by: Wei Liu <***@citrix.com>
Gabriel L. Somlo
2015-07-16 15:43:07 UTC
Permalink
Post by Laszlo Ersek
This function is only called from Xen.c, so it should be defined in Xen.c
and have internal linkage (ie. STATIC).
Contributed-under: TianoCore Contribution Agreement 1.0
---
OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h | 15 ---------
OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c | 35 --------------------
OvmfPkg/SmbiosPlatformDxe/Xen.c | 35 ++++++++++++++++++++
3 files changed, 35 insertions(+), 50 deletions(-)
diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h
index e2606e1..6210a56 100644
--- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h
+++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h
@@ -51,19 +51,4 @@ GetQemuSmbiosTables (
VOID
);
-
-/**
- Validates the SMBIOS entry point structure
-
-
-
-**/
-BOOLEAN
-IsEntryPointStructureValid (
- IN SMBIOS_TABLE_ENTRY_POINT *EntryPointStructure
- );
-
#endif
diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c
index f70db2f..29948a4 100644
--- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c
+++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c
@@ -65,41 +65,6 @@ STATIC CONST OVMF_TYPE0 mOvmfDefaultType0 = {
/**
- Validates the SMBIOS entry point structure
-
-
-
-**/
-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 = Checksum + (UINT8) BytePtr[Index];
- }
-
- if (Checksum != 0) {
- return FALSE;
- } else {
- return TRUE;
- }
-}
-
-
-/**
Get SMBIOS record length.
@param SmbiosTable SMBIOS pointer.
diff --git a/OvmfPkg/SmbiosPlatformDxe/Xen.c b/OvmfPkg/SmbiosPlatformDxe/Xen.c
index 6a5c3f8..3f018d6 100644
--- a/OvmfPkg/SmbiosPlatformDxe/Xen.c
+++ b/OvmfPkg/SmbiosPlatformDxe/Xen.c
@@ -22,6 +22,41 @@
#define XEN_SMBIOS_PHYSICAL_END 0x000F0000
/**
+ Validates the SMBIOS entry point structure
+
+
+
+**/
+STATIC
+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 = Checksum + (UINT8) BytePtr[Index];
+ }
+
+ if (Checksum != 0) {
+ return FALSE;
+ } else {
+ return TRUE;
+ }
+}
+
+/**
Locates the Xen SMBIOS data if it exists
@return SMBIOS_TABLE_ENTRY_POINT Address of Xen SMBIOS data
--
1.8.3.1
Loading...