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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
|
/** @file
KCS Transport Hook head file.
Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License that accompanies this distribution.
The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#ifndef _EFI_KCS_BMC_H
#define _EFI_KCS_BMC_H
#include <Library/BaseLib.h>
#include <Library/IoLib.h>
#include <Library/TimerLib.h>
#define KCS_WRITE_START 0x61
#define KCS_WRITE_END 0x62
#define KCS_READ 0x68
#define KCS_GET_STATUS 0x60
#define KCS_ABORT 0x60
#define KCS_DELAY_UNIT 50 // [s] Each KSC IO delay
#define KCS_ABORT_RETRY_COUNT 1
typedef enum {
KcsIdleState,
KcsReadState,
KcsWriteState,
KcsErrorState
} KCS_STATE;
typedef union {
UINT8 RawData;
struct {
UINT8 Obf : 1;
UINT8 Ibf : 1;
UINT8 SmAtn : 1;
UINT8 CD : 1;
UINT8 Oem1 : 1;
UINT8 Oem2 : 1;
UINT8 State : 2;
} Status;
} EFI_KCS_STATUS;
//
//External Fucntion List
//
EFI_STATUS
SendDataToBmcPort (
UINT64 KcsTimeoutPeriod,
UINT16 KcsPort,
UINT8 *Data,
UINT8 DataSize
)
/*++
Routine Description:
Send data to BMC
Arguments:
Data - The data pointer to be sent
DataSize - The data size
Returns:
EFI_SUCCESS - Send out the data successfully
--*/
;
EFI_STATUS
ReceiveBmcDataFromPort (
UINT64 KcsTimeoutPeriod,
UINT16 KcsPort,
UINT8 *Data,
UINT8 *DataSize
)
/*++
Routine Description:
Routine Description:
Receive data from BMC
Arguments:
Data - The buffer pointer
DataSize - The buffer size
Returns:
EFI_SUCCESS - Received data successfully
--*/
;
//
//Internal Fucntion List
//
EFI_STATUS
KcsErrorExit (
UINT64 KcsTimeoutPeriod,
UINT16 KcsPort
)
/*++
Routine Description:
Check the KCS error status
Arguments:
KcsPort - The base port of KCS
Returns:
EFI_DEVICE_ERROR - The device error happened
EFI_SUCCESS - Successfully check the KCS error status
--*/
;
EFI_STATUS
KcsCheckStatus (
UINT64 KcsTimeoutPeriod,
UINT16 KcsPort,
KCS_STATE KcsState,
BOOLEAN *Idle
)
/*++
Routine Description:
Ckeck KCS status
Arguments:
KcsPort - The base port of KCS
KcsState - The state of KCS to be checked
Idle - If the KCS is idle
Context - The context for this operation
Returns:
EFI_SUCCESS - Checked the KCS status successfully
--*/
;
EFI_STATUS
SendDataToBmc (
UINT64 KcsTimeoutPeriod,
UINT16 KcsPort,
UINT8 *Data,
UINT8 DataSize
)
/*++
Routine Description:
Send data to BMC
Arguments:
Data - The data pointer to be sent
DataSize - The data size
Returns:
EFI_SUCCESS - Send out the data successfully
--*/
;
EFI_STATUS
ReceiveBmcData (
UINT64 KcsTimeoutPeriod,
UINT16 KcsPort,
UINT8 *Data,
UINT8 *DataSize
)
/*++
Routine Description:
Routine Description:
Receive data from BMC
Arguments:
Data - The buffer pointer
DataSize - The buffer size
Returns:
EFI_SUCCESS - Received data successfully
--*/
;
#endif
|