]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordThunk/ConvLib.c
IntelSiliconPkg/VTdInfoPpi: Let it follow DMAR table.
[mirror_edk2.git] / EdkCompatibilityPkg / Compatibility / PiSmbiosRecordOnDataHubSmbiosRecordThunk / ConvLib.c
index 224f621e9de3a1b88da5fb61be2d7871f5f46e02..10208cecb4d551c9f6e6d93b78b33b729e25a588 100644 (file)
@@ -2,8 +2,8 @@
   Common filling functions used in translating Datahub's record\r
   to PI SMBIOS's record.\r
   \r
-Copyright (c) 2009, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
 http://opensource.org/licenses/bsd-license.php\r
@@ -158,6 +158,49 @@ SmbiosEnlargeStructureBuffer (
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+  Update the structure buffer of a structure node in SMBIOS database.\r
+  The function lead the structure pointer for SMBIOS record changed.\r
+  \r
+  @param StructureNode The structure node whose structure buffer is to be enlarged.\r
+  @param NewRecord     The new SMBIOS record.\r
+  \r
+**/\r
+VOID\r
+SmbiosUpdateStructureBuffer (\r
+  IN OUT  SMBIOS_STRUCTURE_NODE *StructureNode,\r
+  IN EFI_SMBIOS_TABLE_HEADER    *NewRecord\r
+  )\r
+{\r
+  EFI_SMBIOS_PROTOCOL       *Smbios;\r
+  EFI_STATUS                Status;\r
+  UINT8                     CountOfString;\r
+  \r
+  Smbios    = GetSmbiosProtocol();\r
+  ASSERT (Smbios != NULL);\r
+  \r
+  Status = Smbios->Remove (Smbios, StructureNode->SmbiosHandle);\r
+  ASSERT_EFI_ERROR (Status);\r
+  \r
+  //\r
+  // try to use original handle to enlarge the buffer.\r
+  //\r
+  Status = Smbios->Add (Smbios, NULL, &StructureNode->SmbiosHandle, NewRecord);\r
+  ASSERT_EFI_ERROR (Status);\r
+  \r
+  StructureNode->Structure = GetSmbiosBufferFromHandle (\r
+                               StructureNode->SmbiosHandle, \r
+                               StructureNode->SmbiosType, \r
+                               NULL\r
+                               );\r
+  GetSmbiosStructureSize (\r
+    StructureNode->Structure,\r
+    &StructureNode->StructureSize,\r
+    &CountOfString\r
+    );\r
+  return ;\r
+}\r
+\r
 /**\r
   Fill a standard Smbios string field. \r
   \r