]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg: Add SMBIOS 3.0 support in NetLibGetSystemGuid.
authorSamer El-Haj-Mahmoud <samer.el-haj-mahmoud@hpe.com>
Wed, 30 Sep 2015 01:06:57 +0000 (01:06 +0000)
committersfu5 <sfu5@Edk2>
Wed, 30 Sep 2015 01:06:57 +0000 (01:06 +0000)
NetLibGetSystemGuid gets the UUID from SMBIOS table to use as the System GUID
(in DHCP and other network use cases). This change adds support to get the
UUID from either SMBIOS 2.x or 3.0, since SMBIOS 3.0 uses a different GUID in
the System Configuration Table.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@hpe.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18559 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf

index 57e8f9f27b0dff0cf68a8dfac738800242180a1d..e112d45ef21c45414cf9a939183e68d25200f7ab 100644 (file)
@@ -2,6 +2,7 @@
   Network library.\r
 \r
 Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.<BR>\r
+(C) Copyright 2015 Hewlett Packard Enterprise Development LP<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
@@ -3254,22 +3255,27 @@ NetLibGetSystemGuid (
   OUT EFI_GUID              *SystemGuid\r
   )\r
 {\r
-  EFI_STATUS                Status;\r
-  SMBIOS_TABLE_ENTRY_POINT  *SmbiosTable;\r
-  SMBIOS_STRUCTURE_POINTER  Smbios;\r
-  SMBIOS_STRUCTURE_POINTER  SmbiosEnd;\r
-  CHAR8                     *String;\r
+  EFI_STATUS                    Status;\r
+  SMBIOS_TABLE_ENTRY_POINT      *SmbiosTable;\r
+  SMBIOS_TABLE_3_0_ENTRY_POINT  *Smbios30Table;\r
+  SMBIOS_STRUCTURE_POINTER      Smbios;\r
+  SMBIOS_STRUCTURE_POINTER      SmbiosEnd;\r
+  CHAR8                         *String;\r
 \r
   SmbiosTable = NULL;\r
-  Status      = EfiGetSystemConfigurationTable (&gEfiSmbiosTableGuid, (VOID **) &SmbiosTable);\r
-\r
-  if (EFI_ERROR (Status) || SmbiosTable == NULL) {\r
-    return EFI_NOT_FOUND;\r
+  Status = EfiGetSystemConfigurationTable (&gEfiSmbios3TableGuid, (VOID **) &Smbios30Table);\r
+  if (!(EFI_ERROR (Status) || Smbios30Table == NULL)) {\r
+    Smbios.Hdr = (SMBIOS_STRUCTURE *) (UINTN) Smbios30Table->TableAddress;\r
+    SmbiosEnd.Raw = (UINT8 *) (UINTN) (Smbios30Table->TableAddress + Smbios30Table->TableMaximumSize);\r
+  } else {\r
+    Status = EfiGetSystemConfigurationTable (&gEfiSmbiosTableGuid, (VOID **) &SmbiosTable);\r
+    if (EFI_ERROR (Status) || SmbiosTable == NULL) {\r
+      return EFI_NOT_FOUND;\r
+    }\r
+    Smbios.Hdr    = (SMBIOS_STRUCTURE *) (UINTN) SmbiosTable->TableAddress;\r
+    SmbiosEnd.Raw = (UINT8 *) (UINTN) (SmbiosTable->TableAddress + SmbiosTable->TableLength);\r
   }\r
 \r
-  Smbios.Hdr    = (SMBIOS_STRUCTURE *) (UINTN) SmbiosTable->TableAddress;\r
-  SmbiosEnd.Raw = (UINT8 *) (UINTN) (SmbiosTable->TableAddress + SmbiosTable->TableLength);\r
-\r
   do {\r
     if (Smbios.Hdr->Type == 1) {\r
       if (Smbios.Hdr->Length < 0x19) {\r
index 50fbcc24b5035cca4f82bb4f8c0b6b5e44712f23..1ff3a4fe556a5cc75c75aea0bf027da0f6d9f946 100644 (file)
@@ -2,6 +2,7 @@
 #  This library instance provides the basic network services.\r
 #\r
 #  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
+#  (C) Copyright 2015 Hewlett Packard Enterprise Development LP<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
@@ -52,6 +53,7 @@
 \r
 [Guids]\r
   gEfiSmbiosTableGuid                           ## SOMETIMES_CONSUMES  ## SystemTable\r
+  gEfiSmbios3TableGuid                          ## SOMETIMES_CONSUMES  ## SystemTable\r
 \r
 \r
 [Protocols]\r