1 /*++
2 
3   Copyright (c) 2004  - 2014, Intel Corporation. All rights reserved.<BR>
4 
5 
6   This program and the accompanying materials are licensed and made available under
7 
8   the terms and conditions of the BSD License that accompanies this distribution.
9 
10   The full text of the license may be found at
11 
12   http://opensource.org/licenses/bsd-license.php.
13 
14 
15 
16   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
17 
18   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 
20 
21 
22 
23 
24 Module Name:
25 
26   BiosIdLib.h
27 
28 Abstract:
29 
30   BIOS ID library definitions.
31 
32   This library provides functions to get BIOS ID, VERSION, DATE and TIME
33 
34 --*/
35 
36 #ifndef _BIOS_ID_LIB_H_
37 #define _BIOS_ID_LIB_H_
38 
39 //
40 // BIOS ID string format:
41 //
42 // $(BOARD_ID)$(BOARD_REV).$(OEM_ID).$(VERSION_MAJOR).$(BUILD_TYPE)$(VERSION_MINOR).YYMMDDHHMM
43 //
44 // Example: "TRFTCRB1.86C.0008.D03.0506081529"
45 //
46 #pragma pack(1)
47 
48 typedef struct {
49   CHAR16  BoardId[7];               // "TRFTCRB"
50   CHAR16  BoardRev;                 // "1"
51   CHAR16  Dot1;                     // "."
52   CHAR16  OemId[3];                 // "86C"
53   CHAR16  Dot2;                     // "."
54   CHAR16  VersionMajor[4];          // "0008"
55   CHAR16  Dot3;                     // "."
56   CHAR16  BuildType;                // "D"
57   CHAR16  VersionMinor[2];          // "03"
58   CHAR16  Dot4;                     // "."
59   CHAR16  TimeStamp[10];            // "YYMMDDHHMM"
60   CHAR16  NullTerminator;           // 0x0000
61 } BIOS_ID_STRING;
62 
63 #define MEM_IFWIVER_START           0x7E0000
64 #define MEM_IFWIVER_LENGTH          0x1000
65 
66 typedef struct _MANIFEST_OEM_DATA{
67   UINT32         Signature;
68   unsigned char  FillNull[0x39];
69   UINT32         IFWIVersionLen;
70   unsigned char  IFWIVersion[32];
71 }MANIFEST_OEM_DATA;
72 
73 //
74 // A signature precedes the BIOS ID string in the FV to enable search by external tools.
75 //
76 typedef struct {
77   UINT8           Signature[8];     // "$IBIOSI$"
78   BIOS_ID_STRING  BiosIdString;     // "TRFTCRB1.86C.0008.D03.0506081529"
79 } BIOS_ID_IMAGE;
80 
81 #pragma pack()
82 
83 /**
84   This function returns BIOS ID by searching HOB or FV.
85 
86   @param[in]  BiosIdImage         The BIOS ID got from HOB or FV
87 
88   @retval  EFI_SUCCESS            All parameters were valid and BIOS ID has been got.
89   @retval  EFI_NOT_FOUND          BiosId image is not found, and no parameter will be modified.
90   @retval  EFI_INVALID_PARAMETER  The parameter is NULL.
91 
92 **/
93 EFI_STATUS
94 GetBiosId (
95   OUT BIOS_ID_IMAGE     *BiosIdImage
96   );
97 
98 /**
99   This function returns the Version & Release Date and Time by getting and converting
100   BIOS ID.
101 
102   @param[in] BiosVersion         The Bios Version out of the conversion.
103   @param[in] BiosReleaseDate     The Bios Release Date out of the conversion.
104   @param[in] BiosReleaseTime     The Bios Release Time out of the conversion.
105 
106   @retval EFI_SUCCESS            BIOS Version & Release Date and Time have been got successfully.
107   @retval EFI_NOT_FOUND          BiosId image is not found, and no parameter will be modified.
108   @retval EFI_INVALID_PARAMETER  All the parameters are NULL.
109 
110 **/
111 EFI_STATUS
112 GetBiosVersionDateTime (
113   OUT CHAR16    *BiosVersion, OPTIONAL
114   OUT CHAR16    *BiosReleaseDate, OPTIONAL
115   OUT CHAR16    *BiosReleaseTime OPTIONAL
116   );
117 
118 #endif
119