5
5
or in SMM which should use a RT or SMM library.
6
6
7
7
8
- Copyright (c) 2015 - 2019 , Intel Corporation. All rights reserved.<BR>
8
+ Copyright (c) 2015 - 2023 , Intel Corporation. All rights reserved.<BR>
9
9
SPDX-License-Identifier: BSD-2-Clause-Patent
10
10
11
11
**/
@@ -15,7 +15,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
15
15
#include <Library/HobLib.h>
16
16
#include <Library/DxeServicesLib.h>
17
17
#include <Library/BaseMemoryLib.h>
18
- #include <Library/HobLib.h>
19
18
#include <Library/MemoryAllocationLib.h>
20
19
#include <Library/DebugLib.h>
21
20
#include <Library/BiosIdLib.h>
@@ -36,16 +35,16 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
36
35
EFI_STATUS
37
36
EFIAPI
38
37
GetBiosId (
39
- OUT BIOS_ID_IMAGE * BiosIdImage OPTIONAL
38
+ OUT BIOS_ID_IMAGE * BiosIdImage OPTIONAL
40
39
)
41
40
{
42
- EFI_STATUS Status ;
43
- BIOS_ID_IMAGE TempBiosIdImage ;
44
- VOID * Address ;
45
- UINTN Size ;
41
+ EFI_STATUS Status ;
42
+ BIOS_ID_IMAGE TempBiosIdImage ;
43
+ VOID * Address ;
44
+ UINTN Size ;
46
45
47
46
Address = NULL ;
48
- Size = 0 ;
47
+ Size = 0 ;
49
48
50
49
if (BiosIdImage == NULL ) {
51
50
//
@@ -58,10 +57,10 @@ GetBiosId (
58
57
Address = GetFirstGuidHob (& gBiosIdGuid );
59
58
if (Address != NULL ) {
60
59
Size = sizeof (BIOS_ID_IMAGE );
61
- CopyMem ((VOID * ) BiosIdImage , GET_GUID_HOB_DATA (Address ), Size );
60
+ CopyMem ((VOID * )BiosIdImage , GET_GUID_HOB_DATA (Address ), Size );
62
61
63
- DEBUG ((EFI_D_INFO , "DXE get BIOS ID from HOB successfully\n" ));
64
- DEBUG ((EFI_D_INFO , "BIOS ID: %s\n" , (CHAR16 * ) (& (BiosIdImage -> BiosIdString ))));
62
+ DEBUG ((DEBUG_INFO , "DXE get BIOS ID from HOB successfully\n" ));
63
+ DEBUG ((DEBUG_INFO , "BIOS ID: %s\n" , (CHAR16 * )(& (BiosIdImage -> BiosIdString ))));
65
64
return EFI_SUCCESS ;
66
65
}
67
66
@@ -77,99 +76,17 @@ GetBiosId (
77
76
// BIOS ID image is present in FV.
78
77
//
79
78
Size = sizeof (BIOS_ID_IMAGE );
80
- CopyMem ((VOID * ) BiosIdImage , Address , Size );
79
+ CopyMem ((VOID * )BiosIdImage , Address , Size );
81
80
//
82
81
// GetSectionFromAnyFv () allocated buffer for Address, now free it.
83
82
//
84
83
FreePool (Address );
85
84
86
- DEBUG ((EFI_D_INFO , "DXE get BIOS ID from FV successfully\n" ));
87
- DEBUG ((EFI_D_INFO , "BIOS ID: %s\n" , (CHAR16 * ) (& (BiosIdImage -> BiosIdString ))));
85
+ DEBUG ((DEBUG_INFO , "DXE get BIOS ID from FV successfully\n" ));
86
+ DEBUG ((DEBUG_INFO , "BIOS ID: %s\n" , (CHAR16 * )(& (BiosIdImage -> BiosIdString ))));
88
87
return EFI_SUCCESS ;
89
88
}
90
89
91
- DEBUG ((EFI_D_ERROR , "DXE get BIOS ID failed: %r\n" , EFI_NOT_FOUND ));
90
+ DEBUG ((DEBUG_ERROR , "DXE get BIOS ID failed: %r\n" , EFI_NOT_FOUND ));
92
91
return EFI_NOT_FOUND ;
93
92
}
94
-
95
- /**
96
- This function returns the BIOS Version & Release Date and Time by getting and converting BIOS ID.
97
-
98
- @param[out] BiosVersion The Bios Version out of the conversion.
99
- @param[out] BiosReleaseDate The Bios Release Date out of the conversion.
100
- @param[out] BiosReleaseTime The Bios Release Time out of the conversion.
101
-
102
- @retval EFI_SUCCESS BIOS Version & Release Date and Time have been got successfully.
103
- @retval EFI_NOT_FOUND BIOS ID image is not found, and no parameter will be modified.
104
- @retval EFI_INVALID_PARAMETER All the parameters are NULL.
105
-
106
- **/
107
- EFI_STATUS
108
- EFIAPI
109
- GetBiosVersionDateTime (
110
- OUT CHAR16 * BiosVersion , OPTIONAL
111
- OUT CHAR16 * BiosReleaseDate , OPTIONAL
112
- OUT CHAR16 * BiosReleaseTime OPTIONAL
113
- )
114
- {
115
- EFI_STATUS Status ;
116
- BIOS_ID_IMAGE BiosIdImage ;
117
-
118
- if ((BiosVersion == NULL ) && (BiosReleaseDate == NULL ) && (BiosReleaseTime == NULL )) {
119
- return EFI_INVALID_PARAMETER ;
120
- }
121
-
122
- Status = GetBiosId (& BiosIdImage );
123
- if (EFI_ERROR (Status )) {
124
- return EFI_NOT_FOUND ;
125
- }
126
-
127
- if (BiosVersion != NULL ) {
128
- //
129
- // Fill the BiosVersion data from the BIOS ID.
130
- //
131
- CopyMem (BiosVersion , & (BiosIdImage .BiosIdString ), sizeof (BIOS_ID_STRING ));
132
- }
133
-
134
- if (BiosReleaseDate != NULL ) {
135
- //
136
- // Fill the build timestamp date from the BIOS ID in the "MM/DD/YY" format.
137
- //
138
- BiosReleaseDate [0 ] = BiosIdImage .BiosIdString .TimeStamp [2 ];
139
- BiosReleaseDate [1 ] = BiosIdImage .BiosIdString .TimeStamp [3 ];
140
- BiosReleaseDate [2 ] = (CHAR16 ) ((UINT8 ) ('/' ));
141
-
142
- BiosReleaseDate [3 ] = BiosIdImage .BiosIdString .TimeStamp [4 ];
143
- BiosReleaseDate [4 ] = BiosIdImage .BiosIdString .TimeStamp [5 ];
144
- BiosReleaseDate [5 ] = (CHAR16 ) ((UINT8 ) ('/' ));
145
-
146
- //
147
- // Add 20 for SMBIOS table
148
- // Current Linux kernel will misjudge 09 as year 0, so using 2009 for SMBIOS table
149
- //
150
- BiosReleaseDate [6 ] = '2' ;
151
- BiosReleaseDate [7 ] = '0' ;
152
- BiosReleaseDate [8 ] = BiosIdImage .BiosIdString .TimeStamp [0 ];
153
- BiosReleaseDate [9 ] = BiosIdImage .BiosIdString .TimeStamp [1 ];
154
-
155
- BiosReleaseDate [10 ] = (CHAR16 ) ((UINT8 ) ('\0' ));
156
- }
157
-
158
- if (BiosReleaseTime != NULL ) {
159
-
160
- //
161
- // Fill the build timestamp time from the BIOS ID in the "HH:MM" format.
162
- //
163
- BiosReleaseTime [0 ] = BiosIdImage .BiosIdString .TimeStamp [6 ];
164
- BiosReleaseTime [1 ] = BiosIdImage .BiosIdString .TimeStamp [7 ];
165
- BiosReleaseTime [2 ] = (CHAR16 ) ((UINT8 ) (':' ));
166
-
167
- BiosReleaseTime [3 ] = BiosIdImage .BiosIdString .TimeStamp [8 ];
168
- BiosReleaseTime [4 ] = BiosIdImage .BiosIdString .TimeStamp [9 ];
169
-
170
- BiosReleaseTime [5 ] = (CHAR16 ) ((UINT8 ) ('\0' ));
171
- }
172
-
173
- return EFI_SUCCESS ;
174
- }
175
-
0 commit comments