forked from microsoft/mu_plus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MfciDeviceIdSupportLib.h
148 lines (120 loc) · 5.37 KB
/
MfciDeviceIdSupportLib.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/** @file
Library to optionally assist populating the MFCI device targeting variables
Refer to MfciPkg/Include/MfciVariables.h, "Targeting Variable Names" for additional details
Copyright (c) Microsoft Corporation
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef MFCI_DEVICE_ID_SUPPORT_LIB_H_
#define MFCI_DEVICE_ID_SUPPORT_LIB_H_
#include <MfciVariables.h>
/**
Function pointer definition to get a device-unique targeting value.
It is the callers responsibility to free the String buffer returned using FreePool().
@param[out] String Device targeting value, a UTF-16 little endian string.
Includes a wide NULL terminator.
Refer to MfciPkg/Include/MfciVariables.h for more details.
@param[out] StringSize (OPTIONAL) String size in bytes including the wide NULL terminator.
NULL may be supplied if the size is not requested (it is NULL terminated after all)
@retval EFI_UNSUPPORTED Likely using the NULL library instance.
@retval EFI_SUCCESS Successfully retrieved the string and length.
@retval EFI_OUT_OF_RESOURCES There is not enough memory to allocate the string.
@retval EFI_INVALID_PARAMETER The String is NULL.
**/
typedef
EFI_STATUS
(EFIAPI *MFCI_DEVICE_ID_FN)(
OUT CHAR16 **String,
OUT UINTN *StringSize OPTIONAL
);
/**
Function that returns Manufacturer Name of the device and string size upon on return.
It is the callers responsibility to free the buffer returned using FreePool().
@param[out] Manufacturer The Manufacturer string to be returned.
@param[out] ManufacturerSize The size of the Manufacturer string.
@retval EFI_SUCCESS The Manufacturer string was successfully returned.
@retval EFI_UNSUPPORTED The function is not supported.
@retval EFI_INVALID_PARAMETER The Manufacturer is NULL.
@retval EFI_OUT_OF_RESOURCES There is not enough memory to allocate the Manufacturer string.
**/
EFI_STATUS
EFIAPI
MfciIdSupportGetManufacturer (
OUT CHAR16 **Manufacturer,
OUT UINTN *ManufacturerSize OPTIONAL
);
/**
Function that returns the Product Name string and size upon on return.
It is the callers responsibility to free the buffer returned using FreePool().
@param[out] ProductName The ProductName string to be returned.
@param[out] ProductNameSize The size of the ProductName string.
@retval EFI_SUCCESS The ProductName string was successfully returned.
@retval EFI_UNSUPPORTED The function is not supported.
@retval EFI_INVALID_PARAMETER The ProductName is NULL.
@retval EFI_OUT_OF_RESOURCES There is not enough memory to allocate the ProductName string.
**/
EFI_STATUS
EFIAPI
MfciIdSupportGetProductName (
OUT CHAR16 **ProductName,
OUT UINTN *ProductNameSize OPTIONAL
);
/**
Function that returns the SerialNumber string and size upon on return.
It is the callers responsibility to free the buffer returned using FreePool().
@param[out] SerialNumber
@param[out] SerialNumberSize
@retval EFI_SUCCESS The ProductName string was successfully returned.
@retval EFI_UNSUPPORTED The function is not supported.
@retval EFI_INVALID_PARAMETER The ProductName is NULL.
@retval EFI_OUT_OF_RESOURCES There is not enough memory to allocate the ProductName string.
**/
EFI_STATUS
EFIAPI
MfciIdSupportGetSerialNumber (
OUT CHAR16 **SerialNumber,
OUT UINTN *SerialNumberSize OPTIONAL
);
/**
Function that returns the Oem1 string and size upon on return.
It is the callers responsibility to free the buffer returned using FreePool().
@param[out] Oem1 The OEM1 string to be returned.
@param[out] Oem1Size The size of the OEM1 string.
@retval EFI_SUCCESS The OEM1 string was successfully returned.
@retval EFI_UNSUPPORTED The function is not supported.
@retval EFI_INVALID_PARAMETER The Oem1 is NULL.
@retval EFI_OUT_OF_RESOURCES There is not enough memory to allocate the OEM1 string.
**/
EFI_STATUS
EFIAPI
MfciIdSupportGetOem1 (
OUT CHAR16 **Oem1,
OUT UINTN *Oem1Size OPTIONAL
);
/**
Function that returns the Oem2 string and size upon on return.
It is the callers responsibility to free the buffer returned using FreePool().
@param[out] Oem2 The OEM2 string to be returned.
@param[out] Oem2Size The size of the OEM2 string.
@retval EFI_SUCCESS The OEM2 string was successfully returned.
@retval EFI_UNSUPPORTED The function is not supported.
@retval EFI_INVALID_PARAMETER The Oem2 is NULL.
@retval EFI_OUT_OF_RESOURCES There is not enough memory to allocate the OEM2 string.
**/
EFI_STATUS
EFIAPI
MfciIdSupportGetOem2 (
OUT CHAR16 **Oem2,
OUT UINTN *Oem2Size OPTIONAL
);
//
// The following helps iterate over the functions and set the corresponding target variable names.
//
// define a structure that pairs up the function pointer with the UEFI variable name
typedef struct {
MFCI_DEVICE_ID_FN DeviceIdFn;
CHAR16 *DeviceIdVarName;
} MFCI_DEVICE_ID_FN_TO_VAR_NAME_MAP;
// populate the array of structures that pair up the functions with variable names
#define MFCI_TARGET_VAR_COUNT 5
extern CONST MFCI_DEVICE_ID_FN_TO_VAR_NAME_MAP gDeviceIdFnToTargetVarNameMap[MFCI_TARGET_VAR_COUNT];
#endif //MFCI_DEVICE_ID_SUPPORT_LIB_H_