1 | /** @file
|
---|
2 | Smbus Library Services that do SMBus transactions and also enable the operatation
|
---|
3 | to be replayed during an S3 resume. This library class maps directly on top
|
---|
4 | of the SmbusLib class.
|
---|
5 |
|
---|
6 | Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
---|
7 |
|
---|
8 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
9 |
|
---|
10 | **/
|
---|
11 |
|
---|
12 |
|
---|
13 | #include <Base.h>
|
---|
14 |
|
---|
15 | #include <Library/DebugLib.h>
|
---|
16 | #include <Library/S3BootScriptLib.h>
|
---|
17 | #include <Library/SmbusLib.h>
|
---|
18 | #include <Library/S3SmbusLib.h>
|
---|
19 |
|
---|
20 | /**
|
---|
21 | Saves an SMBus operation to S3 script to be replayed on S3 resume.
|
---|
22 |
|
---|
23 | This function provides a standard way to save SMBus operation to S3 boot Script.
|
---|
24 | The data can either be of the Length byte, word, or a block of data.
|
---|
25 | If it falis to save S3 boot script, then ASSERT ().
|
---|
26 |
|
---|
27 | @param SmbusOperation Signifies which particular SMBus hardware protocol instance that it will use to
|
---|
28 | execute the SMBus transactions.
|
---|
29 | @param SmBusAddress Address that encodes the SMBUS Slave Address,
|
---|
30 | SMBUS Command, SMBUS Data Length, and PEC.
|
---|
31 | @param Length Signifies the number of bytes that this operation will do. The maximum number of
|
---|
32 | bytes can be revision specific and operation specific.
|
---|
33 | @param Buffer Contains the value of data to execute to the SMBus slave device. Not all operations
|
---|
34 | require this argument. The length of this buffer is identified by Length.
|
---|
35 |
|
---|
36 | **/
|
---|
37 | VOID
|
---|
38 | InternalSaveSmBusExecToBootScript (
|
---|
39 | IN EFI_SMBUS_OPERATION SmbusOperation,
|
---|
40 | IN UINTN SmBusAddress,
|
---|
41 | IN UINTN Length,
|
---|
42 | IN OUT VOID *Buffer
|
---|
43 | )
|
---|
44 | {
|
---|
45 | RETURN_STATUS Status;
|
---|
46 |
|
---|
47 | Status = S3BootScriptSaveSmbusExecute (
|
---|
48 | SmBusAddress,
|
---|
49 | SmbusOperation,
|
---|
50 | &Length,
|
---|
51 | Buffer
|
---|
52 | );
|
---|
53 | ASSERT (Status == RETURN_SUCCESS);
|
---|
54 | }
|
---|
55 |
|
---|
56 | /**
|
---|
57 | Executes an SMBUS quick read command and saves the value in the S3 script to be replayed
|
---|
58 | on S3 resume.
|
---|
59 |
|
---|
60 | Executes an SMBUS quick read command on the SMBUS device specified by SmBusAddress.
|
---|
61 | Only the SMBUS slave address field of SmBusAddress is required.
|
---|
62 | If Status is not NULL, then the status of the executed command is returned in Status.
|
---|
63 | If PEC is set in SmBusAddress, then ASSERT().
|
---|
64 | If Command in SmBusAddress is not zero, then ASSERT().
|
---|
65 | If Length in SmBusAddress is not zero, then ASSERT().
|
---|
66 | If any reserved bits of SmBusAddress are set, then ASSERT().
|
---|
67 |
|
---|
68 | @param SmBusAddress Address that encodes the SMBUS Slave Address,
|
---|
69 | SMBUS Command, SMBUS Data Length, and PEC.
|
---|
70 | @param Status Return status for the executed command.
|
---|
71 | This is an optional parameter and may be NULL.
|
---|
72 |
|
---|
73 | **/
|
---|
74 | VOID
|
---|
75 | EFIAPI
|
---|
76 | S3SmBusQuickRead (
|
---|
77 | IN UINTN SmBusAddress,
|
---|
78 | OUT RETURN_STATUS *Status OPTIONAL
|
---|
79 | )
|
---|
80 | {
|
---|
81 | SmBusQuickRead (SmBusAddress, Status);
|
---|
82 |
|
---|
83 | InternalSaveSmBusExecToBootScript (EfiSmbusQuickRead, SmBusAddress, 0, NULL);
|
---|
84 | }
|
---|
85 |
|
---|
86 | /**
|
---|
87 | Executes an SMBUS quick write command and saves the value in the S3 script to be replayed
|
---|
88 | on S3 resume.
|
---|
89 |
|
---|
90 | Executes an SMBUS quick write command on the SMBUS device specified by SmBusAddress.
|
---|
91 | Only the SMBUS slave address field of SmBusAddress is required.
|
---|
92 | If Status is not NULL, then the status of the executed command is returned in Status.
|
---|
93 | If PEC is set in SmBusAddress, then ASSERT().
|
---|
94 | If Command in SmBusAddress is not zero, then ASSERT().
|
---|
95 | If Length in SmBusAddress is not zero, then ASSERT().
|
---|
96 | If any reserved bits of SmBusAddress are set, then ASSERT().
|
---|
97 |
|
---|
98 | @param SmBusAddress Address that encodes the SMBUS Slave Address,
|
---|
99 | SMBUS Command, SMBUS Data Length, and PEC.
|
---|
100 | @param Status Return status for the executed command.
|
---|
101 | This is an optional parameter and may be NULL.
|
---|
102 |
|
---|
103 | **/
|
---|
104 | VOID
|
---|
105 | EFIAPI
|
---|
106 | S3SmBusQuickWrite (
|
---|
107 | IN UINTN SmBusAddress,
|
---|
108 | OUT RETURN_STATUS *Status OPTIONAL
|
---|
109 | )
|
---|
110 | {
|
---|
111 | SmBusQuickWrite (SmBusAddress, Status);
|
---|
112 |
|
---|
113 | InternalSaveSmBusExecToBootScript (EfiSmbusQuickWrite, SmBusAddress, 0, NULL);
|
---|
114 | }
|
---|
115 |
|
---|
116 | /**
|
---|
117 | Executes an SMBUS receive byte command and saves the value in the S3 script to be replayed
|
---|
118 | on S3 resume.
|
---|
119 |
|
---|
120 | Executes an SMBUS receive byte command on the SMBUS device specified by SmBusAddress.
|
---|
121 | Only the SMBUS slave address field of SmBusAddress is required.
|
---|
122 | The byte received from the SMBUS is returned.
|
---|
123 | If Status is not NULL, then the status of the executed command is returned in Status.
|
---|
124 | If Command in SmBusAddress is not zero, then ASSERT().
|
---|
125 | If Length in SmBusAddress is not zero, then ASSERT().
|
---|
126 | If any reserved bits of SmBusAddress are set, then ASSERT().
|
---|
127 |
|
---|
128 | @param SmBusAddress Address that encodes the SMBUS Slave Address,
|
---|
129 | SMBUS Command, SMBUS Data Length, and PEC.
|
---|
130 | @param Status Return status for the executed command.
|
---|
131 | This is an optional parameter and may be NULL.
|
---|
132 |
|
---|
133 | @return The byte received from the SMBUS.
|
---|
134 |
|
---|
135 | **/
|
---|
136 | UINT8
|
---|
137 | EFIAPI
|
---|
138 | S3SmBusReceiveByte (
|
---|
139 | IN UINTN SmBusAddress,
|
---|
140 | OUT RETURN_STATUS *Status OPTIONAL
|
---|
141 | )
|
---|
142 | {
|
---|
143 | UINT8 Byte;
|
---|
144 |
|
---|
145 | Byte = SmBusReceiveByte (SmBusAddress, Status);
|
---|
146 |
|
---|
147 | InternalSaveSmBusExecToBootScript (EfiSmbusReceiveByte, SmBusAddress, 1, &Byte);
|
---|
148 |
|
---|
149 | return Byte;
|
---|
150 | }
|
---|
151 |
|
---|
152 | /**
|
---|
153 | Executes an SMBUS send byte command and saves the value in the S3 script to be replayed
|
---|
154 | on S3 resume.
|
---|
155 |
|
---|
156 | Executes an SMBUS send byte command on the SMBUS device specified by SmBusAddress.
|
---|
157 | The byte specified by Value is sent.
|
---|
158 | Only the SMBUS slave address field of SmBusAddress is required. Value is returned.
|
---|
159 | If Status is not NULL, then the status of the executed command is returned in Status.
|
---|
160 | If Command in SmBusAddress is not zero, then ASSERT().
|
---|
161 | If Length in SmBusAddress is not zero, then ASSERT().
|
---|
162 | If any reserved bits of SmBusAddress are set, then ASSERT().
|
---|
163 |
|
---|
164 | @param SmBusAddress Address that encodes the SMBUS Slave Address,
|
---|
165 | SMBUS Command, SMBUS Data Length, and PEC.
|
---|
166 | @param Value The 8-bit value to send.
|
---|
167 | @param Status Return status for the executed command.
|
---|
168 | This is an optional parameter and may be NULL.
|
---|
169 |
|
---|
170 | @return The parameter of Value.
|
---|
171 |
|
---|
172 | **/
|
---|
173 | UINT8
|
---|
174 | EFIAPI
|
---|
175 | S3SmBusSendByte (
|
---|
176 | IN UINTN SmBusAddress,
|
---|
177 | IN UINT8 Value,
|
---|
178 | OUT RETURN_STATUS *Status OPTIONAL
|
---|
179 | )
|
---|
180 | {
|
---|
181 | UINT8 Byte;
|
---|
182 |
|
---|
183 | Byte = SmBusSendByte (SmBusAddress, Value, Status);
|
---|
184 |
|
---|
185 | InternalSaveSmBusExecToBootScript (EfiSmbusSendByte, SmBusAddress, 1, &Byte);
|
---|
186 |
|
---|
187 | return Byte;
|
---|
188 | }
|
---|
189 |
|
---|
190 | /**
|
---|
191 | Executes an SMBUS read data byte command and saves the value in the S3 script to be replayed
|
---|
192 | on S3 resume.
|
---|
193 |
|
---|
194 | Executes an SMBUS read data byte command on the SMBUS device specified by SmBusAddress.
|
---|
195 | Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required.
|
---|
196 | The 8-bit value read from the SMBUS is returned.
|
---|
197 | If Status is not NULL, then the status of the executed command is returned in Status.
|
---|
198 | If Length in SmBusAddress is not zero, then ASSERT().
|
---|
199 | If any reserved bits of SmBusAddress are set, then ASSERT().
|
---|
200 |
|
---|
201 | @param SmBusAddress Address that encodes the SMBUS Slave Address,
|
---|
202 | SMBUS Command, SMBUS Data Length, and PEC.
|
---|
203 | @param Status Return status for the executed command.
|
---|
204 | This is an optional parameter and may be NULL.
|
---|
205 |
|
---|
206 | @return The byte read from the SMBUS.
|
---|
207 |
|
---|
208 | **/
|
---|
209 | UINT8
|
---|
210 | EFIAPI
|
---|
211 | S3SmBusReadDataByte (
|
---|
212 | IN UINTN SmBusAddress,
|
---|
213 | OUT RETURN_STATUS *Status OPTIONAL
|
---|
214 | )
|
---|
215 | {
|
---|
216 | UINT8 Byte;
|
---|
217 |
|
---|
218 | Byte = SmBusReadDataByte (SmBusAddress, Status);
|
---|
219 |
|
---|
220 | InternalSaveSmBusExecToBootScript (EfiSmbusReadByte, SmBusAddress, 1, &Byte);
|
---|
221 |
|
---|
222 | return Byte;
|
---|
223 | }
|
---|
224 |
|
---|
225 | /**
|
---|
226 | Executes an SMBUS write data byte command and saves the value in the S3 script to be replayed
|
---|
227 | on S3 resume.
|
---|
228 |
|
---|
229 | Executes an SMBUS write data byte command on the SMBUS device specified by SmBusAddress.
|
---|
230 | The 8-bit value specified by Value is written.
|
---|
231 | Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required.
|
---|
232 | Value is returned.
|
---|
233 | If Status is not NULL, then the status of the executed command is returned in Status.
|
---|
234 | If Length in SmBusAddress is not zero, then ASSERT().
|
---|
235 | If any reserved bits of SmBusAddress are set, then ASSERT().
|
---|
236 |
|
---|
237 | @param SmBusAddress Address that encodes the SMBUS Slave Address,
|
---|
238 | SMBUS Command, SMBUS Data Length, and PEC.
|
---|
239 | @param Value The 8-bit value to write.
|
---|
240 | @param Status Return status for the executed command.
|
---|
241 | This is an optional parameter and may be NULL.
|
---|
242 |
|
---|
243 | @return The parameter of Value.
|
---|
244 |
|
---|
245 | **/
|
---|
246 | UINT8
|
---|
247 | EFIAPI
|
---|
248 | S3SmBusWriteDataByte (
|
---|
249 | IN UINTN SmBusAddress,
|
---|
250 | IN UINT8 Value,
|
---|
251 | OUT RETURN_STATUS *Status OPTIONAL
|
---|
252 | )
|
---|
253 | {
|
---|
254 | UINT8 Byte;
|
---|
255 |
|
---|
256 | Byte = SmBusWriteDataByte (SmBusAddress, Value, Status);
|
---|
257 |
|
---|
258 | InternalSaveSmBusExecToBootScript (EfiSmbusWriteByte, SmBusAddress, 1, &Byte);
|
---|
259 |
|
---|
260 | return Byte;
|
---|
261 | }
|
---|
262 |
|
---|
263 | /**
|
---|
264 | Executes an SMBUS read data word command and saves the value in the S3 script to be replayed
|
---|
265 | on S3 resume.
|
---|
266 |
|
---|
267 | Executes an SMBUS read data word command on the SMBUS device specified by SmBusAddress.
|
---|
268 | Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required.
|
---|
269 | The 16-bit value read from the SMBUS is returned.
|
---|
270 | If Status is not NULL, then the status of the executed command is returned in Status.
|
---|
271 | If Length in SmBusAddress is not zero, then ASSERT().
|
---|
272 | If any reserved bits of SmBusAddress are set, then ASSERT().
|
---|
273 |
|
---|
274 | @param SmBusAddress Address that encodes the SMBUS Slave Address,
|
---|
275 | SMBUS Command, SMBUS Data Length, and PEC.
|
---|
276 | @param Status Return status for the executed command.
|
---|
277 | This is an optional parameter and may be NULL.
|
---|
278 |
|
---|
279 | @return The byte read from the SMBUS.
|
---|
280 |
|
---|
281 | **/
|
---|
282 | UINT16
|
---|
283 | EFIAPI
|
---|
284 | S3SmBusReadDataWord (
|
---|
285 | IN UINTN SmBusAddress,
|
---|
286 | OUT RETURN_STATUS *Status OPTIONAL
|
---|
287 | )
|
---|
288 | {
|
---|
289 | UINT16 Word;
|
---|
290 |
|
---|
291 | Word = SmBusReadDataWord (SmBusAddress, Status);
|
---|
292 |
|
---|
293 | InternalSaveSmBusExecToBootScript (EfiSmbusReadWord, SmBusAddress, 2, &Word);
|
---|
294 |
|
---|
295 | return Word;
|
---|
296 | }
|
---|
297 |
|
---|
298 | /**
|
---|
299 | Executes an SMBUS write data word command and saves the value in the S3 script to be replayed
|
---|
300 | on S3 resume.
|
---|
301 |
|
---|
302 | Executes an SMBUS write data word command on the SMBUS device specified by SmBusAddress.
|
---|
303 | The 16-bit value specified by Value is written.
|
---|
304 | Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required.
|
---|
305 | Value is returned.
|
---|
306 | If Status is not NULL, then the status of the executed command is returned in Status.
|
---|
307 | If Length in SmBusAddress is not zero, then ASSERT().
|
---|
308 | If any reserved bits of SmBusAddress are set, then ASSERT().
|
---|
309 |
|
---|
310 | @param SmBusAddress Address that encodes the SMBUS Slave Address,
|
---|
311 | SMBUS Command, SMBUS Data Length, and PEC.
|
---|
312 | @param Value The 16-bit value to write.
|
---|
313 | @param Status Return status for the executed command.
|
---|
314 | This is an optional parameter and may be NULL.
|
---|
315 |
|
---|
316 | @return The parameter of Value.
|
---|
317 |
|
---|
318 | **/
|
---|
319 | UINT16
|
---|
320 | EFIAPI
|
---|
321 | S3SmBusWriteDataWord (
|
---|
322 | IN UINTN SmBusAddress,
|
---|
323 | IN UINT16 Value,
|
---|
324 | OUT RETURN_STATUS *Status OPTIONAL
|
---|
325 | )
|
---|
326 | {
|
---|
327 | UINT16 Word;
|
---|
328 |
|
---|
329 | Word = SmBusWriteDataWord (SmBusAddress, Value, Status);
|
---|
330 |
|
---|
331 | InternalSaveSmBusExecToBootScript (EfiSmbusWriteWord, SmBusAddress, 2, &Word);
|
---|
332 |
|
---|
333 | return Word;
|
---|
334 | }
|
---|
335 |
|
---|
336 | /**
|
---|
337 | Executes an SMBUS process call command and saves the value in the S3 script to be replayed
|
---|
338 | on S3 resume.
|
---|
339 |
|
---|
340 | Executes an SMBUS process call command on the SMBUS device specified by SmBusAddress.
|
---|
341 | The 16-bit value specified by Value is written.
|
---|
342 | Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required.
|
---|
343 | The 16-bit value returned by the process call command is returned.
|
---|
344 | If Status is not NULL, then the status of the executed command is returned in Status.
|
---|
345 | If Length in SmBusAddress is not zero, then ASSERT().
|
---|
346 | If any reserved bits of SmBusAddress are set, then ASSERT().
|
---|
347 |
|
---|
348 | @param SmBusAddress Address that encodes the SMBUS Slave Address,
|
---|
349 | SMBUS Command, SMBUS Data Length, and PEC.
|
---|
350 | @param Value The 16-bit value to write.
|
---|
351 | @param Status Return status for the executed command.
|
---|
352 | This is an optional parameter and may be NULL.
|
---|
353 |
|
---|
354 | @return The 16-bit value returned by the process call command.
|
---|
355 |
|
---|
356 | **/
|
---|
357 | UINT16
|
---|
358 | EFIAPI
|
---|
359 | S3SmBusProcessCall (
|
---|
360 | IN UINTN SmBusAddress,
|
---|
361 | IN UINT16 Value,
|
---|
362 | OUT RETURN_STATUS *Status OPTIONAL
|
---|
363 | )
|
---|
364 | {
|
---|
365 | UINT16 Word;
|
---|
366 |
|
---|
367 | Word = SmBusProcessCall (SmBusAddress, Value, Status);
|
---|
368 |
|
---|
369 | InternalSaveSmBusExecToBootScript (EfiSmbusProcessCall, SmBusAddress, 2, &Value);
|
---|
370 |
|
---|
371 | return Word;
|
---|
372 | }
|
---|
373 |
|
---|
374 | /**
|
---|
375 | Executes an SMBUS read block command and saves the value in the S3 script to be replayed
|
---|
376 | on S3 resume.
|
---|
377 |
|
---|
378 | Executes an SMBUS read block command on the SMBUS device specified by SmBusAddress.
|
---|
379 | Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required.
|
---|
380 | Bytes are read from the SMBUS and stored in Buffer.
|
---|
381 | The number of bytes read is returned, and will never return a value larger than 32-bytes.
|
---|
382 | If Status is not NULL, then the status of the executed command is returned in Status.
|
---|
383 | It is the caller's responsibility to make sure Buffer is large enough for the total number of bytes read.
|
---|
384 | SMBUS supports a maximum transfer size of 32 bytes, so Buffer does not need to be any larger than 32 bytes.
|
---|
385 | If Length in SmBusAddress is not zero, then ASSERT().
|
---|
386 | If Buffer is NULL, then ASSERT().
|
---|
387 | If any reserved bits of SmBusAddress are set, then ASSERT().
|
---|
388 |
|
---|
389 | @param SmBusAddress Address that encodes the SMBUS Slave Address,
|
---|
390 | SMBUS Command, SMBUS Data Length, and PEC.
|
---|
391 | @param Buffer Pointer to the buffer to store the bytes read from the SMBUS.
|
---|
392 | @param Status Return status for the executed command.
|
---|
393 | This is an optional parameter and may be NULL.
|
---|
394 |
|
---|
395 | @return The number of bytes read.
|
---|
396 |
|
---|
397 | **/
|
---|
398 | UINTN
|
---|
399 | EFIAPI
|
---|
400 | S3SmBusReadBlock (
|
---|
401 | IN UINTN SmBusAddress,
|
---|
402 | OUT VOID *Buffer,
|
---|
403 | OUT RETURN_STATUS *Status OPTIONAL
|
---|
404 | )
|
---|
405 | {
|
---|
406 | UINTN Length;
|
---|
407 |
|
---|
408 | Length = SmBusReadBlock (SmBusAddress, Buffer, Status);
|
---|
409 |
|
---|
410 | InternalSaveSmBusExecToBootScript (EfiSmbusReadBlock, SmBusAddress, Length, Buffer);
|
---|
411 |
|
---|
412 | return Length;
|
---|
413 | }
|
---|
414 |
|
---|
415 | /**
|
---|
416 | Executes an SMBUS write block command and saves the value in the S3 script to be replayed
|
---|
417 | on S3 resume.
|
---|
418 |
|
---|
419 | Executes an SMBUS write block command on the SMBUS device specified by SmBusAddress.
|
---|
420 | The SMBUS slave address, SMBUS command, and SMBUS length fields of SmBusAddress are required.
|
---|
421 | Bytes are written to the SMBUS from Buffer.
|
---|
422 | The number of bytes written is returned, and will never return a value larger than 32-bytes.
|
---|
423 | If Status is not NULL, then the status of the executed command is returned in Status.
|
---|
424 | If Length in SmBusAddress is zero or greater than 32, then ASSERT().
|
---|
425 | If Buffer is NULL, then ASSERT().
|
---|
426 | If any reserved bits of SmBusAddress are set, then ASSERT().
|
---|
427 |
|
---|
428 | @param SmBusAddress Address that encodes the SMBUS Slave Address,
|
---|
429 | SMBUS Command, SMBUS Data Length, and PEC.
|
---|
430 | @param Buffer Pointer to the buffer to store the bytes read from the SMBUS.
|
---|
431 | @param Status Return status for the executed command.
|
---|
432 | This is an optional parameter and may be NULL.
|
---|
433 |
|
---|
434 | @return The number of bytes written.
|
---|
435 |
|
---|
436 | **/
|
---|
437 | UINTN
|
---|
438 | EFIAPI
|
---|
439 | S3SmBusWriteBlock (
|
---|
440 | IN UINTN SmBusAddress,
|
---|
441 | OUT VOID *Buffer,
|
---|
442 | OUT RETURN_STATUS *Status OPTIONAL
|
---|
443 | )
|
---|
444 | {
|
---|
445 | UINTN Length;
|
---|
446 |
|
---|
447 | Length = SmBusWriteBlock (SmBusAddress, Buffer, Status);
|
---|
448 |
|
---|
449 | InternalSaveSmBusExecToBootScript (EfiSmbusWriteBlock, SmBusAddress, SMBUS_LIB_LENGTH (SmBusAddress), Buffer);
|
---|
450 |
|
---|
451 | return Length;
|
---|
452 | }
|
---|
453 |
|
---|
454 | /**
|
---|
455 | Executes an SMBUS block process call command and saves the value in the S3 script to be replayed
|
---|
456 | on S3 resume.
|
---|
457 |
|
---|
458 | Executes an SMBUS block process call command on the SMBUS device specified by SmBusAddress.
|
---|
459 | The SMBUS slave address, SMBUS command, and SMBUS length fields of SmBusAddress are required.
|
---|
460 | Bytes are written to the SMBUS from WriteBuffer. Bytes are then read from the SMBUS into ReadBuffer.
|
---|
461 | If Status is not NULL, then the status of the executed command is returned in Status.
|
---|
462 | It is the caller's responsibility to make sure ReadBuffer is large enough for the total number of bytes read.
|
---|
463 | SMBUS supports a maximum transfer size of 32 bytes, so Buffer does not need to be any larger than 32 bytes.
|
---|
464 | If Length in SmBusAddress is zero or greater than 32, then ASSERT().
|
---|
465 | If WriteBuffer is NULL, then ASSERT().
|
---|
466 | If ReadBuffer is NULL, then ASSERT().
|
---|
467 | If any reserved bits of SmBusAddress are set, then ASSERT().
|
---|
468 |
|
---|
469 | @param SmBusAddress Address that encodes the SMBUS Slave Address,
|
---|
470 | SMBUS Command, SMBUS Data Length, and PEC.
|
---|
471 | @param WriteBuffer Pointer to the buffer of bytes to write to the SMBUS.
|
---|
472 | @param ReadBuffer Pointer to the buffer of bytes to read from the SMBUS.
|
---|
473 | @param Status Return status for the executed command.
|
---|
474 | This is an optional parameter and may be NULL.
|
---|
475 |
|
---|
476 | @return The number of bytes written.
|
---|
477 |
|
---|
478 | **/
|
---|
479 | UINTN
|
---|
480 | EFIAPI
|
---|
481 | S3SmBusBlockProcessCall (
|
---|
482 | IN UINTN SmBusAddress,
|
---|
483 | IN VOID *WriteBuffer,
|
---|
484 | OUT VOID *ReadBuffer,
|
---|
485 | OUT RETURN_STATUS *Status OPTIONAL
|
---|
486 | )
|
---|
487 | {
|
---|
488 | UINTN Length;
|
---|
489 |
|
---|
490 | Length = SmBusBlockProcessCall (SmBusAddress, WriteBuffer, ReadBuffer, Status);
|
---|
491 |
|
---|
492 | InternalSaveSmBusExecToBootScript (EfiSmbusBWBRProcessCall, SmBusAddress, SMBUS_LIB_LENGTH (SmBusAddress), ReadBuffer);
|
---|
493 |
|
---|
494 | return Length;
|
---|
495 | }
|
---|