xref: /titanic_41/usr/src/cmd/lms/heci/FWULCommand.h (revision 1e4c938b57d1656808e4112127ff1dce3eba5314)
1 /*******************************************************************************
2  * Copyright (C) 2004-2008 Intel Corp. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *
7  *  - Redistributions of source code must retain the above copyright notice,
8  *    this list of conditions and the following disclaimer.
9  *
10  *  - Redistributions in binary form must reproduce the above copyright notice,
11  *    this list of conditions and the following disclaimer in the documentation
12  *    and/or other materials provided with the distribution.
13  *
14  *  - Neither the name of Intel Corp. nor the names of its
15  *    contributors may be used to endorse or promote products derived from this
16  *    software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
19  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED. IN NO EVENT SHALL Intel Corp. OR THE CONTRIBUTORS
22  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28  * POSSIBILITY OF SUCH DAMAGE.
29  *******************************************************************************/
30 
31 #ifndef __FWUL_COMMAND_H__
32 #define __FWUL_COMMAND_H__
33 
34 #include "HECIUnix.h"
35 #include "StatusCodeDefinitions.h"
36 
37 #pragma pack(1)
38 
39 typedef struct _FWU_VERSION
40 {
41 	UINT16      Major;
42 	UINT16      Minor;
43 	UINT16      Hotfix;
44 	UINT16      Build;
45 } FWU_VERSION;
46 
47 typedef enum
48 {
49 	FWU_GET_VERSION = 0,
50 	FWU_GET_VERSION_REPLY,
51 	FWU_START,
52 	FWU_START_REPLY,
53 	FWU_DATA,
54 	FWU_DATA_REPLY,
55 	FWU_END,
56 	FWU_END_REPLY,
57 	FWU_GET_INFO,
58 	FWU_GET_INFO_REPLY
59 } FWU_HECI_MESSAGE_TYPE;
60 
61 typedef struct _ME_GET_FW_UPDATE_INFO_REQUEST
62 {
63 	UINT32      MessageID;
64 } ME_GET_FW_UPDATE_INFO_REQUEST;
65 
66 typedef struct _FWU_MSG_REPLY_HEADER
67 {
68 	UINT32      MessageType;
69 	UINT32      Status;
70 } FWU_MSG_REPLY_HEADER;
71 
72 typedef struct _FWU_MSG_REPLY_HEADER_V3
73 {
74 	UINT8       MessageType;
75 	UINT32      Status;
76 } FWU_MSG_REPLY_HEADER_V3;
77 
78 typedef struct _FWU_GET_VERSION_MSG_REPLY
79 {
80 	UINT32      MessageType;
81 	UINT32      Status;
82 	UINT32      Sku;
83 	UINT32      ICHVer;
84 	UINT32      MCHVer;
85 	UINT32      Vendor;
86 	UINT32      LastFwUpdateStatus;
87 	UINT32      HwSku;
88 	FWU_VERSION CodeVersion;
89 	FWU_VERSION AMTVersion;
90 	UINT16      EnabledUpdateInterfaces;
91 	UINT16      Reserved;
92 } FWU_GET_VERSION_MSG_REPLY;
93 
94 typedef struct _FWU_GET_VERSION_MSG_REPLY_V3
95 {
96 	UINT8       MessageType;
97 	UINT32      Status;
98 	UINT32      Sku;
99 	UINT32      ICHVer;
100 	UINT32      MCHVer;
101 	UINT32      Vendor;
102 	FWU_VERSION CodeVersion;
103 	FWU_VERSION RcvyVersion;
104 	UINT16      EnabledUpdateInterfaces;
105 	UINT32      LastFwUpdateStatus;
106 	UINT32      Reserved;
107 } FWU_GET_VERSION_MSG_REPLY_V3;
108 
109 typedef struct _FWU_GET_INFO_MSG_REPLY
110 {
111 	UINT32      MessageType;
112 	UINT32      Status;
113 	FWU_VERSION MEBxVersion;
114 	UINT32      FlashOverridePolicy;
115 	UINT32      ManageabilityMode;
116 	UINT32      BiosBootState;
117 	struct {
118 		UINT32          CryptoFuse   :1;
119 		UINT32          FlashProtection:1;
120 		UINT32          FwOverrideQualifier:2;
121 		UINT32          MeResetReason:2;
122 		UINT32          FwOverrideCounter:8;
123 		UINT32          reserved:18;
124 	} Fields;
125 	UINT8       BiosVersion[20];
126 } FWU_GET_INFO_MSG_REPLY;
127 
128 #pragma pack(0)
129 
130 class FWULCommand
131 {
132 public:
133 	FWULCommand(bool verbose = false);
134 	~FWULCommand();
135 
136 	HECI_STATUS GetFWUVersionAndInfo(FWU_GET_VERSION_MSG_REPLY &verMsg, FWU_GET_INFO_MSG_REPLY &infoMsg);
137 
138 	HECILinux FWULClient;
139 
140 private:
141 	HECI_STATUS _call(const unsigned char *command, UINT32 command_size, UINT8 **readBuffer, UINT32 *outBuffSize);
142 
143 	bool _verbose;
144 };
145 
146 #endif //__FWUL_COMMAND_H__
147 
148