]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPkg: Add Universal/Smbios/SmbiosMiscDxe/Type32
authorRebecca Cran <rebecca@nuviainc.com>
Mon, 8 Feb 2021 00:52:52 +0000 (17:52 -0700)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Mon, 8 Feb 2021 19:35:23 +0000 (19:35 +0000)
This code provides information for the SMBIOS Type 32 table.

Signed-off-by: Rebecca Cran <rebecca@nuviainc.com>
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
Reviewed-by: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>
ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type32/MiscBootInformationData.c [new file with mode: 0644]
ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type32/MiscBootInformationFunction.c [new file with mode: 0644]

diff --git a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type32/MiscBootInformationData.c b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type32/MiscBootInformationData.c
new file mode 100644 (file)
index 0000000..ebe4ad9
--- /dev/null
@@ -0,0 +1,32 @@
+/** @file\r
+  Based on files under Nt32Pkg/MiscSubClassPlatformDxe/\r
+\r
+  Copyright (c) 2021, NUVIA Inc. All rights reserved.<BR>\r
+  Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2015, Hisilicon Limited. All rights reserved.<BR>\r
+  Copyright (c) 2015, Linaro Limited. All rights reserved.<BR>\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#include "SmbiosMisc.h"\r
+\r
+//\r
+// Static (possibly build generated) Bios Vendor data.\r
+//\r
+SMBIOS_MISC_TABLE_DATA(SMBIOS_TABLE_TYPE32, MiscBootInformation) = {\r
+  {                                                     // Hdr\r
+    EFI_SMBIOS_TYPE_SYSTEM_BOOT_INFORMATION,              // Type,\r
+    0,                                                    // Length,\r
+    0                                                     // Handle\r
+  },\r
+  {                                                     // Reserved[6]\r
+    0,\r
+    0,\r
+    0,\r
+    0,\r
+    0,\r
+    0\r
+  },\r
+  BootInformationStatusNoError                          // BootInformationStatus\r
+};\r
diff --git a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type32/MiscBootInformationFunction.c b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type32/MiscBootInformationFunction.c
new file mode 100644 (file)
index 0000000..733615b
--- /dev/null
@@ -0,0 +1,73 @@
+/** @file\r
+  boot information boot time changes.\r
+  SMBIOS type 32.\r
+\r
+  Based on files under Nt32Pkg/MiscSubClassPlatformDxe/\r
+\r
+  Copyright (c) 2021, NUVIA Inc. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2015, Hisilicon Limited. All rights reserved.<BR>\r
+  Copyright (c) 2015, Linaro Limited. All rights reserved.<BR>\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#include <Library/BaseLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/MemoryAllocationLib.h>\r
+#include <Library/UefiBootServicesTableLib.h>\r
+\r
+#include "SmbiosMisc.h"\r
+\r
+/**\r
+  This function makes boot time changes to the contents of the\r
+  MiscBootInformation (Type 32) record.\r
+\r
+  @param  RecordData                 Pointer to SMBIOS table with default values.\r
+  @param  Smbios                     SMBIOS protocol.\r
+\r
+  @retval EFI_SUCCESS                The SMBIOS table was successfully added.\r
+  @retval EFI_INVALID_PARAMETER      Invalid parameter was found.\r
+  @retval EFI_OUT_OF_RESOURCES       Failed to allocate required memory.\r
+\r
+**/\r
+SMBIOS_MISC_TABLE_FUNCTION(MiscBootInformation)\r
+{\r
+  EFI_STATUS                         Status;\r
+  SMBIOS_TABLE_TYPE32                *SmbiosRecord;\r
+  SMBIOS_TABLE_TYPE32                *InputData;\r
+\r
+  //\r
+  // First check for invalid parameters.\r
+  //\r
+  if (RecordData == NULL) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
+  InputData = (SMBIOS_TABLE_TYPE32 *)RecordData;\r
+\r
+  //\r
+  // Two zeros following the last string.\r
+  //\r
+  SmbiosRecord = AllocateZeroPool (sizeof (SMBIOS_TABLE_TYPE32) + 1 + 1);\r
+  if (SmbiosRecord == NULL) {\r
+    return EFI_OUT_OF_RESOURCES;\r
+  }\r
+\r
+  (VOID)CopyMem (SmbiosRecord, InputData, sizeof (SMBIOS_TABLE_TYPE32));\r
+\r
+  SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE32);\r
+\r
+  //\r
+  // Now we have got the full smbios record, call smbios protocol to add this record.\r
+  //\r
+  Status = SmbiosMiscAddRecord ((UINT8*)SmbiosRecord, NULL);\r
+  if (EFI_ERROR (Status)) {\r
+    DEBUG ((DEBUG_ERROR, "[%a]:[%dL] Smbios Type32 Table Log Failed! %r \n",\r
+            __FUNCTION__, __LINE__, Status));\r
+  }\r
+\r
+  FreePool (SmbiosRecord);\r
+  return Status;\r
+}\r