Re: [edk2-devel] [edk2-platforms][PATCH v1 1/1] Silicon/Qemu: Add SMBIOS tables of types 16, 17, and 19

2022-07-29 Thread Sunny Wang
Looks good to me.
Reviewed-by: Sunny Wang 

-Original Message-
From: Dimitrije Pavlov 
Sent: 20 July 2022 23:05
To: devel@edk2.groups.io
Cc: Ard Biesheuvel ; Leif Lindholm 
; Graeme Gregory ; Radoslaw 
Biernacki ; Jeff Booher-Kaeding 
; Samer El-Haj-Mahmoud 
; Sunny Wang ; Jeremy Linton 

Subject: [edk2-platforms][PATCH v1 1/1] Silicon/Qemu: Add SMBIOS tables of 
types 16, 17, and 19

Arm SBBR specification includes the list of required and recommended
SMBIOS tables. Tables of types 16 (Physical Memory Array),
17 (Memory Device), and 19 (Memory Array Mapped Address) are required,
but are not included in the current SbsaQemu SMBIOS driver. The current
SMBIOS driver provides a limited number of tables using ArmPkg.

This patch adds SbsaQemu-specific tables of types 16, 17, and 19.

Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Cc: Graeme Gregory 
Cc: Radoslaw Biernacki 
Cc: Jeff Booher-Kaeding 
Cc: Samer El-Haj-Mahmoud 
Cc: Sunny Wang 
Cc: Jeremy Linton 

Signed-off-by: Dimitrije Pavlov 
---
 Platform/Qemu/SbsaQemu/SbsaQemu.dsc   |   1 +
 Platform/Qemu/SbsaQemu/SbsaQemu.fdf   |   1 +
 Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuSmbiosDxe/SbsaQemuSmbiosDxe.inf |  48 +++
 Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuSmbiosDxe/SbsaQemuSmbiosDxe.c   | 405 

 4 files changed, 455 insertions(+)

diff --git a/Platform/Qemu/SbsaQemu/SbsaQemu.dsc 
b/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
index 97014e2fb630..b7050d911708 100644
--- a/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
+++ b/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
@@ -721,6 +721,7 @@ [Components.common]
   ArmPkg/Universal/Smbios/SmbiosMiscDxe/SmbiosMiscDxe.inf
   EmbeddedPkg/Library/FdtLib/FdtLib.inf
   MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
+  Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuSmbiosDxe/SbsaQemuSmbiosDxe.inf

   #
   # PCI support
diff --git a/Platform/Qemu/SbsaQemu/SbsaQemu.fdf 
b/Platform/Qemu/SbsaQemu/SbsaQemu.fdf
index c35e3ed44054..9f031c3e6649 100644
--- a/Platform/Qemu/SbsaQemu/SbsaQemu.fdf
+++ b/Platform/Qemu/SbsaQemu/SbsaQemu.fdf
@@ -242,6 +242,7 @@ [FV.FvMain]
   INF ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClassDxe.inf
   INF ArmPkg/Universal/Smbios/SmbiosMiscDxe/SmbiosMiscDxe.inf
   INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
+  INF Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuSmbiosDxe/SbsaQemuSmbiosDxe.inf

   #
   # PCI support
diff --git 
a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuSmbiosDxe/SbsaQemuSmbiosDxe.inf 
b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuSmbiosDxe/SbsaQemuSmbiosDxe.inf
new file mode 100644
index ..b5d156f6654e
--- /dev/null
+++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuSmbiosDxe/SbsaQemuSmbiosDxe.inf
@@ -0,0 +1,48 @@
+#/** @file
+#
+#  Static SMBIOS tables for the SbsaQemu platform.
+#
+#  Copyright (c) 2022, ARM Limited. All rights reserved.
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#**/
+
+[Defines]
+  INF_VERSION= 0x0001001A
+  BASE_NAME  = SbsaQemuSmbiosDxe
+  FILE_GUID  = DDE1ACCB-0555-4CAA-85E7-3CBC8962026E
+  MODULE_TYPE= DXE_DRIVER
+  VERSION_STRING = 1.0
+  ENTRY_POINT= SbsaQemuSmbiosDriverEntryPoint
+
+[Sources]
+  SbsaQemuSmbiosDxe.c
+
+[Packages]
+  MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  ArmPlatformPkg/ArmPlatformPkg.dec
+  ArmPkg/ArmPkg.dec
+
+[LibraryClasses]
+  ArmLib
+  ArmPlatformLib
+  UefiBootServicesTableLib
+  MemoryAllocationLib
+  BaseMemoryLib
+  BaseLib
+  UefiLib
+  UefiDriverEntryPoint
+  DebugLib
+  PrintLib
+
+[Protocols]
+  gEfiSmbiosProtocolGuid
+
+[Depex]
+  gEfiSmbiosProtocolGuid
+
+[Pcd]
+  gArmTokenSpaceGuid.PcdSystemMemorySize
+  gArmTokenSpaceGuid.PcdSystemMemoryBase
diff --git 
a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuSmbiosDxe/SbsaQemuSmbiosDxe.c 
b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuSmbiosDxe/SbsaQemuSmbiosDxe.c
new file mode 100644
index ..9ef5168b79f6
--- /dev/null
+++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuSmbiosDxe/SbsaQemuSmbiosDxe.c
@@ -0,0 +1,405 @@
+/** @file
+ *
+ *  Static SMBIOS tables for the SbsaQemu platform.
+ *
+ *  Note: Some tables are provided by ArmPkg. The tables that are not provided 
by
+ *  ArmPkg, but are required by SBBR, are as follows:
+ *Physical Memory Array (Type 16)
+ *Memory Device (Type 17) - For each socketed system-memory Device
+ *Memory Array Mapped Address (Type 19) - One per contiguous block per 
Physical Memory Array
+ *
+ *  Copyright (c) 2022, ARM Limited. All rights reserved.
+ *
+ *  SPDX-License-Identifier: BSD-2-Clause-Patent
+ *
+ **/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/**
+  A global variable to store the SMBIOS handle for table Type 16. This 
variable should
+  only be modified by calling PhyMemArrayInfoUpdateSmbiosType16.
+**/
+STATIC 

Re: [edk2-devel] [edk2-platforms][PATCH v1 1/1] Silicon/Qemu: Add SMBIOS tables of types 16, 17, and 19

2022-07-27 Thread Samer El-Haj-Mahmoud
Thanks Dimitrije for the patch!

Reviewed-By: Samer El-Haj-Mahmoud 


> -Original Message-
> From: Dimitrije Pavlov 
> Sent: Wednesday, July 20, 2022 6:05 PM
> To: devel@edk2.groups.io
> Cc: Ard Biesheuvel ; Leif Lindholm
> ; Graeme Gregory ;
> Radoslaw Biernacki ; Jeff Booher-Kaeding  kaed...@arm.com>; Samer El-Haj-Mahmoud  mahm...@arm.com>; Sunny Wang ; Jeremy Linton
> 
> Subject: [edk2-platforms][PATCH v1 1/1] Silicon/Qemu: Add SMBIOS tables of
> types 16, 17, and 19
> 
> Arm SBBR specification includes the list of required and recommended
> SMBIOS tables. Tables of types 16 (Physical Memory Array),
> 17 (Memory Device), and 19 (Memory Array Mapped Address) are required,
> but are not included in the current SbsaQemu SMBIOS driver. The current
> SMBIOS driver provides a limited number of tables using ArmPkg.
> 
> This patch adds SbsaQemu-specific tables of types 16, 17, and 19.
> 
> Cc: Ard Biesheuvel 
> Cc: Leif Lindholm 
> Cc: Graeme Gregory 
> Cc: Radoslaw Biernacki 
> Cc: Jeff Booher-Kaeding 
> Cc: Samer El-Haj-Mahmoud 
> Cc: Sunny Wang 
> Cc: Jeremy Linton 
> 
> Signed-off-by: Dimitrije Pavlov 
> ---
>  Platform/Qemu/SbsaQemu/SbsaQemu.dsc   |   1 +
>  Platform/Qemu/SbsaQemu/SbsaQemu.fdf   |   1 +
> 
> Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuSmbiosDxe/SbsaQemuSmbiosDxe.i
> nf |  48 +++
> 
> Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuSmbiosDxe/SbsaQemuSmbiosDxe.c
> | 405 
>  4 files changed, 455 insertions(+)
> 
> diff --git a/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
> b/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
> index 97014e2fb630..b7050d911708 100644
> --- a/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
> +++ b/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
> @@ -721,6 +721,7 @@ [Components.common]
>ArmPkg/Universal/Smbios/SmbiosMiscDxe/SmbiosMiscDxe.inf
>EmbeddedPkg/Library/FdtLib/FdtLib.inf
>MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
> +
> Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuSmbiosDxe/SbsaQemuSmbiosDxe.i
> nf
> 
>#
># PCI support
> diff --git a/Platform/Qemu/SbsaQemu/SbsaQemu.fdf
> b/Platform/Qemu/SbsaQemu/SbsaQemu.fdf
> index c35e3ed44054..9f031c3e6649 100644
> --- a/Platform/Qemu/SbsaQemu/SbsaQemu.fdf
> +++ b/Platform/Qemu/SbsaQemu/SbsaQemu.fdf
> @@ -242,6 +242,7 @@ [FV.FvMain]
>INF
> ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClassDxe.inf
>INF ArmPkg/Universal/Smbios/SmbiosMiscDxe/SmbiosMiscDxe.inf
>INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
> +  INF
> Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuSmbiosDxe/SbsaQemuSmbiosDxe.i
> nf
> 
>#
># PCI support
> diff --git
> a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuSmbiosDxe/SbsaQemuSmbiosDx
> e.inf
> b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuSmbiosDxe/SbsaQemuSmbiosDx
> e.inf
> new file mode 100644
> index ..b5d156f6654e
> --- /dev/null
> +++
> b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuSmbiosDxe/SbsaQemuSmbiosDx
> e.inf
> @@ -0,0 +1,48 @@
> +#/** @file
> +#
> +#  Static SMBIOS tables for the SbsaQemu platform.
> +#
> +#  Copyright (c) 2022, ARM Limited. All rights reserved.
> +#
> +#  SPDX-License-Identifier: BSD-2-Clause-Patent
> +#
> +#**/
> +
> +[Defines]
> +  INF_VERSION= 0x0001001A
> +  BASE_NAME  = SbsaQemuSmbiosDxe
> +  FILE_GUID  = DDE1ACCB-0555-4CAA-85E7-3CBC8962026E
> +  MODULE_TYPE= DXE_DRIVER
> +  VERSION_STRING = 1.0
> +  ENTRY_POINT= SbsaQemuSmbiosDriverEntryPoint
> +
> +[Sources]
> +  SbsaQemuSmbiosDxe.c
> +
> +[Packages]
> +  MdePkg/MdePkg.dec
> +  MdeModulePkg/MdeModulePkg.dec
> +  ArmPlatformPkg/ArmPlatformPkg.dec
> +  ArmPkg/ArmPkg.dec
> +
> +[LibraryClasses]
> +  ArmLib
> +  ArmPlatformLib
> +  UefiBootServicesTableLib
> +  MemoryAllocationLib
> +  BaseMemoryLib
> +  BaseLib
> +  UefiLib
> +  UefiDriverEntryPoint
> +  DebugLib
> +  PrintLib
> +
> +[Protocols]
> +  gEfiSmbiosProtocolGuid
> +
> +[Depex]
> +  gEfiSmbiosProtocolGuid
> +
> +[Pcd]
> +  gArmTokenSpaceGuid.PcdSystemMemorySize
> +  gArmTokenSpaceGuid.PcdSystemMemoryBase
> diff --git
> a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuSmbiosDxe/SbsaQemuSmbiosDx
> e.c
> b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuSmbiosDxe/SbsaQemuSmbiosDx
> e.c
> new file mode 100644
> index ..9ef5168b79f6
> --- /dev/null
> +++
> b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuSmbiosDxe/SbsaQemuSmbiosDx
> e.c
> @@ -0,0 +1,405 @@
> +/** @file
> + *
> + *  Static SMBIOS tables for the SbsaQemu platform.
> + *
> + *  Note: Some tables are provided by ArmPkg. The tables that are not 
> provided
> by
> + *  ArmPkg, but are required by SBBR, are as follows:
> + *Physical Memory Array (Type 16)
> + *Memory Device (Type 17) - For each socketed system-memory Device
> + *Memory Array Mapped Address (Type 19) - One per contiguous block per
> Physical Memory Array
> + *
> + *  Copyright (c) 2022, ARM Limited. All rights reserved.
> + *
> + *  SPDX-License-Identifier: 

[edk2-devel] [edk2-platforms][PATCH v1 1/1] Silicon/Qemu: Add SMBIOS tables of types 16, 17, and 19

2022-07-20 Thread Dimitrije Pavlov
Arm SBBR specification includes the list of required and recommended
SMBIOS tables. Tables of types 16 (Physical Memory Array),
17 (Memory Device), and 19 (Memory Array Mapped Address) are required,
but are not included in the current SbsaQemu SMBIOS driver. The current
SMBIOS driver provides a limited number of tables using ArmPkg.

This patch adds SbsaQemu-specific tables of types 16, 17, and 19.

Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Cc: Graeme Gregory 
Cc: Radoslaw Biernacki 
Cc: Jeff Booher-Kaeding 
Cc: Samer El-Haj-Mahmoud 
Cc: Sunny Wang 
Cc: Jeremy Linton 

Signed-off-by: Dimitrije Pavlov 
---
 Platform/Qemu/SbsaQemu/SbsaQemu.dsc   |   1 +
 Platform/Qemu/SbsaQemu/SbsaQemu.fdf   |   1 +
 Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuSmbiosDxe/SbsaQemuSmbiosDxe.inf |  48 +++
 Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuSmbiosDxe/SbsaQemuSmbiosDxe.c   | 405 

 4 files changed, 455 insertions(+)

diff --git a/Platform/Qemu/SbsaQemu/SbsaQemu.dsc 
b/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
index 97014e2fb630..b7050d911708 100644
--- a/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
+++ b/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
@@ -721,6 +721,7 @@ [Components.common]
   ArmPkg/Universal/Smbios/SmbiosMiscDxe/SmbiosMiscDxe.inf
   EmbeddedPkg/Library/FdtLib/FdtLib.inf
   MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
+  Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuSmbiosDxe/SbsaQemuSmbiosDxe.inf

   #
   # PCI support
diff --git a/Platform/Qemu/SbsaQemu/SbsaQemu.fdf 
b/Platform/Qemu/SbsaQemu/SbsaQemu.fdf
index c35e3ed44054..9f031c3e6649 100644
--- a/Platform/Qemu/SbsaQemu/SbsaQemu.fdf
+++ b/Platform/Qemu/SbsaQemu/SbsaQemu.fdf
@@ -242,6 +242,7 @@ [FV.FvMain]
   INF ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClassDxe.inf
   INF ArmPkg/Universal/Smbios/SmbiosMiscDxe/SmbiosMiscDxe.inf
   INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
+  INF Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuSmbiosDxe/SbsaQemuSmbiosDxe.inf

   #
   # PCI support
diff --git 
a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuSmbiosDxe/SbsaQemuSmbiosDxe.inf 
b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuSmbiosDxe/SbsaQemuSmbiosDxe.inf
new file mode 100644
index ..b5d156f6654e
--- /dev/null
+++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuSmbiosDxe/SbsaQemuSmbiosDxe.inf
@@ -0,0 +1,48 @@
+#/** @file
+#
+#  Static SMBIOS tables for the SbsaQemu platform.
+#
+#  Copyright (c) 2022, ARM Limited. All rights reserved.
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#**/
+
+[Defines]
+  INF_VERSION= 0x0001001A
+  BASE_NAME  = SbsaQemuSmbiosDxe
+  FILE_GUID  = DDE1ACCB-0555-4CAA-85E7-3CBC8962026E
+  MODULE_TYPE= DXE_DRIVER
+  VERSION_STRING = 1.0
+  ENTRY_POINT= SbsaQemuSmbiosDriverEntryPoint
+
+[Sources]
+  SbsaQemuSmbiosDxe.c
+
+[Packages]
+  MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  ArmPlatformPkg/ArmPlatformPkg.dec
+  ArmPkg/ArmPkg.dec
+
+[LibraryClasses]
+  ArmLib
+  ArmPlatformLib
+  UefiBootServicesTableLib
+  MemoryAllocationLib
+  BaseMemoryLib
+  BaseLib
+  UefiLib
+  UefiDriverEntryPoint
+  DebugLib
+  PrintLib
+
+[Protocols]
+  gEfiSmbiosProtocolGuid
+
+[Depex]
+  gEfiSmbiosProtocolGuid
+
+[Pcd]
+  gArmTokenSpaceGuid.PcdSystemMemorySize
+  gArmTokenSpaceGuid.PcdSystemMemoryBase
diff --git 
a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuSmbiosDxe/SbsaQemuSmbiosDxe.c 
b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuSmbiosDxe/SbsaQemuSmbiosDxe.c
new file mode 100644
index ..9ef5168b79f6
--- /dev/null
+++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuSmbiosDxe/SbsaQemuSmbiosDxe.c
@@ -0,0 +1,405 @@
+/** @file
+ *
+ *  Static SMBIOS tables for the SbsaQemu platform.
+ *
+ *  Note: Some tables are provided by ArmPkg. The tables that are not provided 
by
+ *  ArmPkg, but are required by SBBR, are as follows:
+ *Physical Memory Array (Type 16)
+ *Memory Device (Type 17) - For each socketed system-memory Device
+ *Memory Array Mapped Address (Type 19) - One per contiguous block per 
Physical Memory Array
+ *
+ *  Copyright (c) 2022, ARM Limited. All rights reserved.
+ *
+ *  SPDX-License-Identifier: BSD-2-Clause-Patent
+ *
+ **/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/**
+  A global variable to store the SMBIOS handle for table Type 16. This 
variable should
+  only be modified by calling PhyMemArrayInfoUpdateSmbiosType16.
+**/
+STATIC SMBIOS_HANDLE mPhyMemArrayInfoType16Handle = SMBIOS_HANDLE_PI_RESERVED;
+
+/**
+  SMBIOS data definition, TYPE16, Physical Memory Array
+**/
+SMBIOS_TABLE_TYPE16 mPhyMemArrayInfoType16 = {
+  { EFI_SMBIOS_TYPE_PHYSICAL_MEMORY_ARRAY, sizeof (SMBIOS_TABLE_TYPE16), 0 },
+  MemoryArrayLocationSystemBoard,  // Location; (system board)
+  MemoryArrayUseSystemMemory,  // Use; (system memory)
+