1 /** @file
2   Header file for the SmbiosMisc Driver.
3 
4   Based on files under Nt32Pkg/MiscSubClassPlatformDxe/
5 
6   Copyright (c) 2021, NUVIA Inc. All rights reserved.<BR>
7   Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
8   Copyright (c) 2015, Hisilicon Limited. All rights reserved.<BR>
9   Copyright (c) 2015, Linaro Limited. All rights reserved.<BR>
10   SPDX-License-Identifier: BSD-2-Clause-Patent
11 
12 **/
13 
14 #ifndef SMBIOS_MISC_H_
15 #define SMBIOS_MISC_H_
16 
17 #include <Protocol/Smbios.h>
18 #include <IndustryStandard/SmBios.h>
19 
20 //
21 // Data table entry update function.
22 //
23 typedef EFI_STATUS (EFIAPI SMBIOS_MISC_DATA_FUNCTION) (
24   IN  VOID                 *RecordData,
25   IN  EFI_SMBIOS_PROTOCOL  *Smbios
26   );
27 
28 
29 //
30 // Data table entry definition.
31 //
32 typedef struct {
33   //
34   // intermediate input data for SMBIOS record
35   //
36   VOID                          *RecordData;
37   SMBIOS_MISC_DATA_FUNCTION     *Function;
38 } SMBIOS_MISC_DATA_TABLE;
39 
40 
41 //
42 // SMBIOS table extern definitions
43 //
44 #define SMBIOS_MISC_TABLE_EXTERNS(NAME1, NAME2, NAME3) \
45 extern NAME1 NAME2 ## Data; \
46 extern SMBIOS_MISC_DATA_FUNCTION NAME3 ## Function;
47 
48 
49 //
50 // SMBIOS data table entries
51 //
52 // This is used to define a pair of table structure pointer and functions
53 // in order to iterate through the list of tables, populate them and add
54 // them into the system.
55 #define SMBIOS_MISC_TABLE_ENTRY_DATA_AND_FUNCTION(NAME1, NAME2) \
56 { \
57   & NAME1 ## Data, \
58     NAME2 ## Function \
59 }
60 
61 //
62 // Global definition macros.
63 //
64 #define SMBIOS_MISC_TABLE_DATA(NAME1, NAME2) \
65   NAME1 NAME2 ## Data
66 
67 #define SMBIOS_MISC_TABLE_FUNCTION(NAME2) \
68   EFI_STATUS EFIAPI NAME2 ## Function( \
69   IN  VOID                  *RecordData, \
70   IN  EFI_SMBIOS_PROTOCOL   *Smbios \
71   )
72 
73 //
74 // Data Table Array Entries
75 //
76 extern EFI_HII_HANDLE               mSmbiosMiscHiiHandle;
77 
78 typedef struct _SMBIOS_TYPE13_BIOS_LANGUAGE_INFORMATION_STRING{
79   UINT8                               *LanguageSignature;
80   EFI_STRING_ID                       InstallableLanguageLongString;
81   EFI_STRING_ID                       InstallableLanguageAbbreviateString;
82 } SMBIOS_TYPE13_BIOS_LANGUAGE_INFORMATION_STRING;
83 
84 
85 /**
86   Adds an SMBIOS record.
87 
88   @param  Buffer        The data for the SMBIOS record.
89                         The format of the record is determined by
90                         EFI_SMBIOS_TABLE_HEADER.Type. The size of the
91                         formatted area is defined by EFI_SMBIOS_TABLE_HEADER.Length
92                         and either followed by a double-null (0x0000) or a set
93                         of null terminated strings and a null.
94   @param  SmbiosHandle  A unique handle will be assigned to the SMBIOS record
95                         if not NULL.
96 
97   @retval EFI_SUCCESS           Record was added.
98   @retval EFI_OUT_OF_RESOURCES  Record was not added due to lack of system resources.
99   @retval EFI_ALREADY_STARTED   The SmbiosHandle passed in was already in use.
100 
101 **/
102 EFI_STATUS
103 SmbiosMiscAddRecord (
104   IN       UINT8                      *Buffer,
105   IN  OUT  EFI_SMBIOS_HANDLE          *SmbiosHandle OPTIONAL
106   );
107 
108 /**
109  Get Link Type Handle.
110 
111  @param [in]   SmbiosType     Get this Type from SMBIOS table
112  @param [out]  HandleArray    Pointer to handle array which will be freed by caller
113  @param [out]  HandleCount    Pointer to handle count
114 
115 **/
116 VOID
117 SmbiosMiscGetLinkTypeHandle(
118   IN  UINT8                 SmbiosType,
119   OUT UINT16                **HandleArray,
120   OUT UINTN                 *HandleCount
121   );
122 
123 //
124 // Data Table Array
125 //
126 extern SMBIOS_MISC_DATA_TABLE   mSmbiosMiscDataTable[];
127 
128 //
129 // Data Table Array Entries
130 //
131 extern UINTN   mSmbiosMiscDataTableEntries;
132 extern UINT8   mSmbiosMiscDxeStrings[];
133 
134 #endif // SMBIOS_MISC_H_
135