]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EmulatorPkg/Include/Library/SmbiosLib.h
EmulatorPkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / EmulatorPkg / Include / Library / SmbiosLib.h
index 8ee14e07dd2e947c58a847f2c5d7507fd08dcbe3..1022b48c5ecadbc6f910f8ed7493dcf566b4cf3b 100644 (file)
-/** @file
-  Provides library functions for common SMBIOS operations. Only available to DXE
-  and UEFI module types.
-
-
-Copyright (c) 2012, Apple Inc. All rights reserved.
-Portitions Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials are licensed and made available under 
-the terms and conditions of the BSD License that 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.
-
-**/
-
-#ifndef _SMBIOS_LIB_H__
-#define _SMBIOS_LIB_H__
-
-#include <IndustryStandard/SmBios.h>
-#include <Protocol/Smbios.h>
-
-
-///
-/// Cache copy of the SMBIOS Protocol pointer
-///
-extern EFI_SMBIOS_PROTOCOL *gSmbios;
-
-
-///
-/// Template for SMBIOS table initialization.
-/// The SMBIOS_TABLE_STRING types in the formated area must match the 
-/// StringArray sequene. 
-///
-typedef struct {
-  //
-  // formatted area of a given SMBIOS record
-  //
-  SMBIOS_STRUCTURE    *Entry;
-  //
-  // NULL terminated array of ASCII strings to be added to the SMBIOS record. 
-  //
-  CHAR8               **StringArray;
-} SMBIOS_TEMPLATE_ENTRY;
-
-
-/**
-  Create an initial SMBIOS Table from an array of SMBIOS_TEMPLATE_ENTRY 
-  entries. SMBIOS_TEMPLATE_ENTRY.NULL indicates the end of the table.
-
-  @param  Template   Array of SMBIOS_TEMPLATE_ENTRY entries.
-  @retval EFI_SUCCESS          New SMBIOS tables were created.
-  @retval EFI_OUT_OF_RESOURCES New SMBIOS tables were not created. 
-**/
-EFI_STATUS
-EFIAPI
-SmbiosLibInitializeFromTemplate (
-  IN  SMBIOS_TEMPLATE_ENTRY   *Template
-  );
-
-
-
-/**
-  Create SMBIOS record.
-
-  Converts a fixed SMBIOS structure and an array of pointers to strings into
-  an SMBIOS record where the strings are cat'ed on the end of the fixed record
-  and terminated via a double NULL and add to SMBIOS table.
-
-  SMBIOS_TABLE_TYPE32 gSmbiosType12 = {
-    { EFI_SMBIOS_TYPE_SYSTEM_CONFIGURATION_OPTIONS, sizeof (SMBIOS_TABLE_TYPE12), 0 },
-    1 // StringCount
-  };
-  CHAR8 *gSmbiosType12Strings[] = {
-    "Not Found",
-    NULL
-  };
-  
-  ...
-  AddSmbiosEntryFromTemplate (
-    (EFI_SMBIOS_TABLE_HEADER*)&gSmbiosType12, 
-    gSmbiosType12Strings
-    );
-
-  @param  SmbiosEntry   Fixed SMBIOS structure
-  @param  StringArray   Array of strings to convert to an SMBIOS string pack. 
-                        NULL is OK.
-
-  @retval EFI_SUCCESS          New SmbiosEntry was added to SMBIOS table.
-  @retval EFI_OUT_OF_RESOURCES SmbiosEntry was not added.
-**/
-EFI_STATUS
-EFIAPI
-SmbiosLibCreateEntry (
-  IN  SMBIOS_STRUCTURE *SmbiosEntry,
-  IN  CHAR8            **StringArray 
-  );
-
-
-/**
-  Update the string associated with an existing SMBIOS record.
-  
-  This function allows the update of specific SMBIOS strings. The number of valid strings for any
-  SMBIOS record is defined by how many strings were present when Add() was called.
-  
-  @param[in]    SmbiosHandle    SMBIOS Handle of structure that will have its string updated.
-  @param[in]    StringNumber    The non-zero string number of the string to update.
-  @param[in]    String          Update the StringNumber string with String.
-  
-  @retval EFI_SUCCESS           SmbiosHandle had its StringNumber String updated.
-  @retval EFI_INVALID_PARAMETER SmbiosHandle does not exist. Or String is invalid.
-  @retval EFI_UNSUPPORTED       String was not added because it is longer than the SMBIOS Table supports.
-  @retval EFI_NOT_FOUND         The StringNumber.is not valid for this SMBIOS record.    
-**/
-EFI_STATUS
-EFIAPI
-SmbiosLibUpdateString (
-  IN  EFI_SMBIOS_HANDLE     SmbiosHandle,
-  IN  SMBIOS_TABLE_STRING   StringNumber,
-  IN  CHAR8                 *String
-  );
-
-/**
-  Update the string associated with an existing SMBIOS record.
-  
-  This function allows the update of specific SMBIOS strings. The number of valid strings for any
-  SMBIOS record is defined by how many strings were present when Add() was called.
-  
-  @param[in]    SmbiosHandle    SMBIOS Handle of structure that will have its string updated.
-  @param[in]    StringNumber    The non-zero string number of the string to update.
-  @param[in]    String          Update the StringNumber string with String.
-  
-  @retval EFI_SUCCESS           SmbiosHandle had its StringNumber String updated.
-  @retval EFI_INVALID_PARAMETER SmbiosHandle does not exist. Or String is invalid.
-  @retval EFI_UNSUPPORTED       String was not added because it is longer than the SMBIOS Table supports.
-  @retval EFI_NOT_FOUND         The StringNumber.is not valid for this SMBIOS record.    
-**/
-EFI_STATUS
-EFIAPI
-SmbiosLibUpdateUnicodeString (
-  IN  EFI_SMBIOS_HANDLE     SmbiosHandle,
-  IN  SMBIOS_TABLE_STRING   StringNumber,
-  IN  CHAR16                *String
-  );
-
-/**
-  Allow caller to read a specific SMBIOS string
-  
-  @param[in]    Header          SMBIOS record that contains the string. 
-  @param[in[    StringNumber    Instance of SMBIOS string 1 - N. 
-
-  @retval NULL                  Instance of Type SMBIOS string was not found. 
-  @retval Other                 Pointer to matching SMBIOS string. 
-**/
-CHAR8 *
-EFIAPI
-SmbiosLibReadString (
-  IN SMBIOS_STRUCTURE   *Header,
-  IN EFI_SMBIOS_STRING  StringNumber
-  );
-
-
-/**
-  Allow the caller to discover a specific SMBIOS entry, and patch it if necissary. 
-  
-  @param[in]    Type            Type of the next SMBIOS record to return. 
-  @param[in[    Instance        Instance of SMBIOS record 0 - N-1. 
-  @param[out]   SmbiosHandle    Returns SMBIOS handle for the matching record. 
-
-  @retval NULL                  Instance of Type SMBIOS record was not found. 
-  @retval Other                 Pointer to matching SMBIOS record. 
-**/
-SMBIOS_STRUCTURE *
-EFIAPI
-SmbiosLibGetRecord (
-  IN  EFI_SMBIOS_TYPE   Type,
-  IN  UINTN             Instance,
-  OUT EFI_SMBIOS_HANDLE *SmbiosHandle
-  );
-
-/**
-  Remove an SMBIOS record.
-  
-  This function removes an SMBIOS record using the handle specified by SmbiosHandle.
-  
-  @param[in]    SmbiosHandle        The handle of the SMBIOS record to remove.
-  
-  @retval EFI_SUCCESS               SMBIOS record was removed.
-  @retval EFI_INVALID_PARAMETER     SmbiosHandle does not specify a valid SMBIOS record.
-**/
-EFI_STATUS
-EFIAPI
-SmbiosLibRemove (
-  OUT EFI_SMBIOS_HANDLE SmbiosHandle
-  );
-
-
-
-
-#endif
+/** @file\r
+  Provides library functions for common SMBIOS operations. Only available to DXE\r
+  and UEFI module types.\r
+\r
+\r
+Copyright (c) 2012, Apple Inc. All rights reserved.\r
+Portitions Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#ifndef _SMBIOS_LIB_H__\r
+#define _SMBIOS_LIB_H__\r
+\r
+#include <IndustryStandard/SmBios.h>\r
+#include <Protocol/Smbios.h>\r
+\r
+\r
+///\r
+/// Cache copy of the SMBIOS Protocol pointer\r
+///\r
+extern EFI_SMBIOS_PROTOCOL *gSmbios;\r
+\r
+\r
+///\r
+/// Template for SMBIOS table initialization.\r
+/// The SMBIOS_TABLE_STRING types in the formated area must match the\r
+/// StringArray sequene.\r
+///\r
+typedef struct {\r
+  //\r
+  // formatted area of a given SMBIOS record\r
+  //\r
+  SMBIOS_STRUCTURE    *Entry;\r
+  //\r
+  // NULL terminated array of ASCII strings to be added to the SMBIOS record.\r
+  //\r
+  CHAR8               **StringArray;\r
+} SMBIOS_TEMPLATE_ENTRY;\r
+\r
+\r
+/**\r
+  Create an initial SMBIOS Table from an array of SMBIOS_TEMPLATE_ENTRY\r
+  entries. SMBIOS_TEMPLATE_ENTRY.NULL indicates the end of the table.\r
+\r
+  @param  Template   Array of SMBIOS_TEMPLATE_ENTRY entries.\r
+\r
+  @retval EFI_SUCCESS          New SMBIOS tables were created.\r
+  @retval EFI_OUT_OF_RESOURCES New SMBIOS tables were not created.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+SmbiosLibInitializeFromTemplate (\r
+  IN  SMBIOS_TEMPLATE_ENTRY   *Template\r
+  );\r
+\r
+\r
+\r
+/**\r
+  Create SMBIOS record.\r
+\r
+  Converts a fixed SMBIOS structure and an array of pointers to strings into\r
+  an SMBIOS record where the strings are cat'ed on the end of the fixed record\r
+  and terminated via a double NULL and add to SMBIOS table.\r
+\r
+  SMBIOS_TABLE_TYPE32 gSmbiosType12 = {\r
+    { EFI_SMBIOS_TYPE_SYSTEM_CONFIGURATION_OPTIONS, sizeof (SMBIOS_TABLE_TYPE12), 0 },\r
+    1 // StringCount\r
+  };\r
+  CHAR8 *gSmbiosType12Strings[] = {\r
+    "Not Found",\r
+    NULL\r
+  };\r
+\r
+  ...\r
+  AddSmbiosEntryFromTemplate (\r
+    (EFI_SMBIOS_TABLE_HEADER*)&gSmbiosType12,\r
+    gSmbiosType12Strings\r
+    );\r
+\r
+  @param  SmbiosEntry   Fixed SMBIOS structure\r
+  @param  StringArray   Array of strings to convert to an SMBIOS string pack.\r
+                        NULL is OK.\r
+\r
+  @retval EFI_SUCCESS          New SmbiosEntry was added to SMBIOS table.\r
+  @retval EFI_OUT_OF_RESOURCES SmbiosEntry was not added.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+SmbiosLibCreateEntry (\r
+  IN  SMBIOS_STRUCTURE *SmbiosEntry,\r
+  IN  CHAR8            **StringArray\r
+  );\r
+\r
+\r
+/**\r
+  Update the string associated with an existing SMBIOS record.\r
+\r
+  This function allows the update of specific SMBIOS strings. The number of valid strings for any\r
+  SMBIOS record is defined by how many strings were present when Add() was called.\r
+\r
+  @param[in]    SmbiosHandle    SMBIOS Handle of structure that will have its string updated.\r
+  @param[in]    StringNumber    The non-zero string number of the string to update.\r
+  @param[in]    String          Update the StringNumber string with String.\r
+\r
+  @retval EFI_SUCCESS           SmbiosHandle had its StringNumber String updated.\r
+  @retval EFI_INVALID_PARAMETER SmbiosHandle does not exist. Or String is invalid.\r
+  @retval EFI_UNSUPPORTED       String was not added because it is longer than the SMBIOS Table supports.\r
+  @retval EFI_NOT_FOUND         The StringNumber.is not valid for this SMBIOS record.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+SmbiosLibUpdateString (\r
+  IN  EFI_SMBIOS_HANDLE     SmbiosHandle,\r
+  IN  SMBIOS_TABLE_STRING   StringNumber,\r
+  IN  CHAR8                 *String\r
+  );\r
+\r
+/**\r
+  Update the string associated with an existing SMBIOS record.\r
+\r
+  This function allows the update of specific SMBIOS strings. The number of valid strings for any\r
+  SMBIOS record is defined by how many strings were present when Add() was called.\r
+\r
+  @param[in]    SmbiosHandle    SMBIOS Handle of structure that will have its string updated.\r
+  @param[in]    StringNumber    The non-zero string number of the string to update.\r
+  @param[in]    String          Update the StringNumber string with String.\r
+\r
+  @retval EFI_SUCCESS           SmbiosHandle had its StringNumber String updated.\r
+  @retval EFI_INVALID_PARAMETER SmbiosHandle does not exist. Or String is invalid.\r
+  @retval EFI_UNSUPPORTED       String was not added because it is longer than the SMBIOS Table supports.\r
+  @retval EFI_NOT_FOUND         The StringNumber.is not valid for this SMBIOS record.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+SmbiosLibUpdateUnicodeString (\r
+  IN  EFI_SMBIOS_HANDLE     SmbiosHandle,\r
+  IN  SMBIOS_TABLE_STRING   StringNumber,\r
+  IN  CHAR16                *String\r
+  );\r
+\r
+/**\r
+  Allow caller to read a specific SMBIOS string\r
+\r
+  @param[in]    Header          SMBIOS record that contains the string.\r
+  @param[in[    StringNumber    Instance of SMBIOS string 1 - N.\r
+\r
+  @retval NULL                  Instance of Type SMBIOS string was not found.\r
+  @retval Other                 Pointer to matching SMBIOS string.\r
+**/\r
+CHAR8 *\r
+EFIAPI\r
+SmbiosLibReadString (\r
+  IN SMBIOS_STRUCTURE   *Header,\r
+  IN EFI_SMBIOS_STRING  StringNumber\r
+  );\r
+\r
+\r
+/**\r
+  Allow the caller to discover a specific SMBIOS entry, and patch it if necissary.\r
+\r
+  @param[in]    Type            Type of the next SMBIOS record to return.\r
+  @param[in[    Instance        Instance of SMBIOS record 0 - N-1.\r
+  @param[out]   SmbiosHandle    Returns SMBIOS handle for the matching record.\r
+\r
+  @retval NULL                  Instance of Type SMBIOS record was not found.\r
+  @retval Other                 Pointer to matching SMBIOS record.\r
+**/\r
+SMBIOS_STRUCTURE *\r
+EFIAPI\r
+SmbiosLibGetRecord (\r
+  IN  EFI_SMBIOS_TYPE   Type,\r
+  IN  UINTN             Instance,\r
+  OUT EFI_SMBIOS_HANDLE *SmbiosHandle\r
+  );\r
+\r
+/**\r
+  Remove an SMBIOS record.\r
+\r
+  This function removes an SMBIOS record using the handle specified by SmbiosHandle.\r
+\r
+  @param[in]    SmbiosHandle        The handle of the SMBIOS record to remove.\r
+\r
+  @retval EFI_SUCCESS               SMBIOS record was removed.\r
+  @retval EFI_INVALID_PARAMETER     SmbiosHandle does not specify a valid SMBIOS record.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+SmbiosLibRemove (\r
+  OUT EFI_SMBIOS_HANDLE SmbiosHandle\r
+  );\r
+\r
+\r
+\r
+\r
+#endif\r