]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/PeiSmbusLibSmbus2Ppi/SmbusLib.c
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Library / PeiSmbusLibSmbus2Ppi / SmbusLib.c
1 /** @file
2 Implementation of SmBusLib class library for PEI phase.
3
4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7
8 **/
9
10 #include "InternalSmbusLib.h"
11
12 /**
13 Executes an SMBUS quick read command.
14
15 Executes an SMBUS quick read command on the SMBUS device specified by SmBusAddress.
16 Only the SMBUS slave address field of SmBusAddress is required.
17 If Status is not NULL, then the status of the executed command is returned in Status.
18 If PEC is set in SmBusAddress, then ASSERT().
19 If Command in SmBusAddress is not zero, then ASSERT().
20 If Length in SmBusAddress is not zero, then ASSERT().
21 If any reserved bits of SmBusAddress are set, then ASSERT().
22
23 @param SmBusAddress The address that encodes the SMBUS Slave Address,
24 SMBUS Command, SMBUS Data Length, and PEC.
25 @param Status Return status for the executed command.
26 This is an optional parameter and may be NULL.
27 RETURN_SUCCESS: The SMBUS command was executed.
28 RETURN_TIMEOUT: A timeout occurred while executing the
29 SMBUS command.
30 RETURN_DEVICE_ERROR: The request was not completed because
31 a failure reflected in the Host Status Register bit.
32 Device errors are a result of a transaction collision,
33 illegal command field, unclaimed cycle
34 (host initiated), or bus errors (collisions).
35 RETURN_UNSUPPORTED: The SMBus operation is not supported.
36
37 **/
38 VOID
39 EFIAPI
40 SmBusQuickRead (
41 IN UINTN SmBusAddress,
42 OUT RETURN_STATUS *Status OPTIONAL
43 )
44 {
45 ASSERT (!SMBUS_LIB_PEC (SmBusAddress));
46 ASSERT (SMBUS_LIB_COMMAND (SmBusAddress) == 0);
47 ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0);
48 ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0);
49
50 InternalSmBusExec (EfiSmbusQuickRead, SmBusAddress, 0, NULL, Status);
51 }
52
53 /**
54 Executes an SMBUS quick write command.
55
56 Executes an SMBUS quick write command on the SMBUS device specified by SmBusAddress.
57 Only the SMBUS slave address field of SmBusAddress is required.
58 If Status is not NULL, then the status of the executed command is returned in Status.
59 If PEC is set in SmBusAddress, then ASSERT().
60 If Command in SmBusAddress is not zero, then ASSERT().
61 If Length in SmBusAddress is not zero, then ASSERT().
62 If any reserved bits of SmBusAddress are set, then ASSERT().
63
64 @param SmBusAddress The address that encodes the SMBUS Slave Address,
65 SMBUS Command, SMBUS Data Length, and PEC.
66 @param Status Return status for the executed command.
67 This is an optional parameter and may be NULL.
68 RETURN_SUCCESS: The SMBUS command was executed.
69 RETURN_TIMEOUT: A timeout occurred while executing the
70 SMBUS command.
71 RETURN_DEVICE_ERROR: The request was not completed because
72 a failure reflected in the Host Status Register bit. Device
73 errors are a result of a transaction collision, illegal
74 command field, unclaimed cycle (host initiated), or bus
75 errors (collisions).
76 RETURN_UNSUPPORTED:: The SMBus operation is not supported.
77
78 **/
79 VOID
80 EFIAPI
81 SmBusQuickWrite (
82 IN UINTN SmBusAddress,
83 OUT RETURN_STATUS *Status OPTIONAL
84 )
85 {
86 ASSERT (!SMBUS_LIB_PEC (SmBusAddress));
87 ASSERT (SMBUS_LIB_COMMAND (SmBusAddress) == 0);
88 ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0);
89 ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0);
90
91 InternalSmBusExec (EfiSmbusQuickWrite, SmBusAddress, 0, NULL, Status);
92 }
93
94 /**
95 Executes an SMBUS receive byte command.
96
97 Executes an SMBUS receive byte command on the SMBUS device specified by SmBusAddress.
98 Only the SMBUS slave address field of SmBusAddress is required.
99 The byte received from the SMBUS is returned.
100 If Status is not NULL, then the status of the executed command is returned in Status.
101 If Command in SmBusAddress is not zero, then ASSERT().
102 If Length in SmBusAddress is not zero, then ASSERT().
103 If any reserved bits of SmBusAddress are set, then ASSERT().
104
105 @param SmBusAddress The address that encodes the SMBUS Slave Address,
106 SMBUS Command, SMBUS Data Length, and PEC.
107 @param Status Return status for the executed command.
108 This is an optional parameter and may be NULL.
109 RETURN_SUCCESS: The SMBUS command was executed.
110 RETURN_TIMEOUT: A timeout occurred while executing the
111 SMBUS command.
112 RETURN_DEVICE_ERROR: The request was not completed because
113 a failure reflected in the Host Status Register bit.
114 Device errors are a result of a transaction collision,
115 illegal command field, unclaimed cycle (host initiated),
116 or bus errors (collisions).
117 RETURN_CRC_ERROR: The checksum is not correct. (PEC is incorrect.)
118 RETURN_UNSUPPORTED: The SMBus operation is not supported.
119
120 @return The byte received from the SMBUS.
121
122 **/
123 UINT8
124 EFIAPI
125 SmBusReceiveByte (
126 IN UINTN SmBusAddress,
127 OUT RETURN_STATUS *Status OPTIONAL
128 )
129 {
130 UINT8 Byte;
131
132 ASSERT (SMBUS_LIB_COMMAND (SmBusAddress) == 0);
133 ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0);
134 ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0);
135
136 InternalSmBusExec (EfiSmbusReceiveByte, SmBusAddress, 1, &Byte, Status);
137
138 return Byte;
139 }
140
141 /**
142 Executes an SMBUS send byte command.
143
144 Executes an SMBUS send byte command on the SMBUS device specified by SmBusAddress.
145 The byte specified by Value is sent.
146 Only the SMBUS slave address field of SmBusAddress is required. Value is returned.
147 If Status is not NULL, then the status of the executed command is returned in Status.
148 If Command in SmBusAddress is not zero, then ASSERT().
149 If Length in SmBusAddress is not zero, then ASSERT().
150 If any reserved bits of SmBusAddress are set, then ASSERT().
151
152 @param SmBusAddress The address that encodes the SMBUS Slave Address,
153 SMBUS Command, SMBUS Data Length, and PEC.
154 @param Value The 8-bit value to send.
155 @param Status Return status for the executed command.
156 This is an optional parameter and may be NULL.
157 RETURN_SUCCESS: The SMBUS command was executed.
158 RETURN_TIMEOUT: A timeout occurred while executing the
159 SMBUS command.
160 RETURN_DEVICE_ERROR: The request was not completed because
161 a failure reflected in the Host Status Register bit. Device
162 errors are a result of a transaction collision, illegal
163 command field, unclaimed cycle (host initiated), or bus
164 errors (collisions).
165 RETURN_CRC_ERROR: The checksum is not correct. (PEC is incorrect.)
166 RETURN_UNSUPPORTED: The SMBus operation is not supported.
167
168 @return The parameter of Value.
169
170 **/
171 UINT8
172 EFIAPI
173 SmBusSendByte (
174 IN UINTN SmBusAddress,
175 IN UINT8 Value,
176 OUT RETURN_STATUS *Status OPTIONAL
177 )
178 {
179 UINT8 Byte;
180
181 ASSERT (SMBUS_LIB_COMMAND (SmBusAddress) == 0);
182 ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0);
183 ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0);
184
185 Byte = Value;
186 InternalSmBusExec (EfiSmbusSendByte, SmBusAddress, 1, &Byte, Status);
187
188 return Value;
189 }
190
191 /**
192 Executes an SMBUS read data byte command.
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 The 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 RETURN_SUCCESS: The SMBUS command was executed.
206 RETURN_TIMEOUT: A timeout occurred while executing the
207 SMBUS command.
208 RETURN_DEVICE_ERROR: The request was not completed because
209 a failure reflected in the Host Status Register bit.
210 Device errors are a result of a transaction collision,
211 illegal command field, unclaimed cycle (host initiated),
212 or bus errors (collisions).
213 RETURN_CRC_ERROR: The checksum is not correct. (PEC is incorrect.)
214 RETURN_UNSUPPORTED: The SMBus operation is not supported.
215
216 @return The byte read from the SMBUS.
217
218 **/
219 UINT8
220 EFIAPI
221 SmBusReadDataByte (
222 IN UINTN SmBusAddress,
223 OUT RETURN_STATUS *Status OPTIONAL
224 )
225 {
226 UINT8 Byte;
227
228 ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0);
229 ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0);
230
231 InternalSmBusExec (EfiSmbusReadByte, SmBusAddress, 1, &Byte, Status);
232
233 return Byte;
234 }
235
236 /**
237 Executes an SMBUS write data byte command.
238
239 Executes an SMBUS write data byte command on the SMBUS device specified by SmBusAddress.
240 The 8-bit value specified by Value is written.
241 Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required.
242 Value is returned.
243 If Status is not NULL, then the status of the executed command is returned in Status.
244 If Length in SmBusAddress is not zero, then ASSERT().
245 If any reserved bits of SmBusAddress are set, then ASSERT().
246
247 @param SmBusAddress The address that encodes the SMBUS Slave Address,
248 SMBUS Command, SMBUS Data Length, and PEC.
249 @param Value The 8-bit value to write.
250 @param Status Return status for the executed command.
251 This is an optional parameter and may be NULL.
252 RETURN_SUCCESS: The SMBUS command was executed.
253 RETURN_TIMEOUT: A timeout occurred while executing the
254 SMBUS command.
255 RETURN_DEVICE_ERROR: The request was not completed because
256 a failure reflected in the Host Status Register bit.
257 Device errors are a result of a transaction collision,
258 illegal command field, unclaimed cycle (host initiated),
259 or bus errors (collisions).
260 RETURN_CRC_ERROR: The checksum is not correct. (PEC is incorrect.)
261 RETURN_UNSUPPORTED: The SMBus operation is not supported.
262
263 @return The parameter of Value.
264
265 **/
266 UINT8
267 EFIAPI
268 SmBusWriteDataByte (
269 IN UINTN SmBusAddress,
270 IN UINT8 Value,
271 OUT RETURN_STATUS *Status OPTIONAL
272 )
273 {
274 UINT8 Byte;
275
276 ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0);
277 ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0);
278
279 Byte = Value;
280 InternalSmBusExec (EfiSmbusWriteByte, SmBusAddress, 1, &Byte, Status);
281
282 return Value;
283 }
284
285 /**
286 Executes an SMBUS read data word command.
287
288 Executes an SMBUS read data word command on the SMBUS device specified by SmBusAddress.
289 Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required.
290 The 16-bit value read from the SMBUS is returned.
291 If Status is not NULL, then the status of the executed command is returned in Status.
292 If Length in SmBusAddress is not zero, then ASSERT().
293 If any reserved bits of SmBusAddress are set, then ASSERT().
294
295 @param SmBusAddress The address that encodes the SMBUS Slave Address,
296 SMBUS Command, SMBUS Data Length, and PEC.
297 @param Status Return status for the executed command.
298 This is an optional parameter and may be NULL.
299 RETURN_SUCCESS: The SMBUS command was executed.
300 RETURN_TIMEOUT: A timeout occurred while executing the
301 SMBUS command.
302 RETURN_DEVICE_ERROR: The request was not completed because
303 a failure reflected in the Host Status Register bit.
304 Device errors are a result of a transaction collision,
305 illegal command field, unclaimed cycle (host initiated),
306 or bus errors (collisions).
307 RETURN_CRC_ERROR: The checksum is not correct. (PEC is incorrect.)
308 RETURN_UNSUPPORTED: The SMBus operation is not supported.
309
310 @return The byte read from the SMBUS.
311
312 **/
313 UINT16
314 EFIAPI
315 SmBusReadDataWord (
316 IN UINTN SmBusAddress,
317 OUT RETURN_STATUS *Status OPTIONAL
318 )
319 {
320 UINT16 Word;
321
322 ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0);
323 ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0);
324
325 InternalSmBusExec (EfiSmbusReadWord, SmBusAddress, 2, &Word, Status);
326
327 return Word;
328 }
329
330 /**
331 Executes an SMBUS write data word command.
332
333 Executes an SMBUS write data word command on the SMBUS device specified by SmBusAddress.
334 The 16-bit value specified by Value is written.
335 Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required.
336 Value is returned.
337 If Status is not NULL, then the status of the executed command is returned in Status.
338 If Length in SmBusAddress is not zero, then ASSERT().
339 If any reserved bits of SmBusAddress are set, then ASSERT().
340
341 @param SmBusAddress The address that encodes the SMBUS Slave Address,
342 SMBUS Command, SMBUS Data Length, and PEC.
343 @param Value The 16-bit value to write.
344 @param Status Return status for the executed command.
345 This is an optional parameter and may be NULL.
346 RETURN_SUCCESS: The SMBUS command was executed.
347 RETURN_TIMEOUT: A timeout occurred while executing the
348 SMBUS command.
349 RETURN_DEVICE_ERROR: The request was not completed because
350 a failure reflected in the Host Status Register bit.
351 Device errors are a result of a transaction collision,
352 illegal command field, unclaimed cycle (host initiated),
353 or bus errors (collisions).
354 RETURN_CRC_ERROR: The checksum is not correct. (PEC is incorrect.)
355 RETURN_UNSUPPORTED: The SMBus operation is not supported.
356
357 @return The parameter of Value.
358
359 **/
360 UINT16
361 EFIAPI
362 SmBusWriteDataWord (
363 IN UINTN SmBusAddress,
364 IN UINT16 Value,
365 OUT RETURN_STATUS *Status OPTIONAL
366 )
367 {
368 UINT16 Word;
369
370 ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0);
371 ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0);
372
373 Word = Value;
374 InternalSmBusExec (EfiSmbusWriteWord, SmBusAddress, 2, &Word, Status);
375
376 return Value;
377 }
378
379 /**
380 Executes an SMBUS process call command.
381
382 Executes an SMBUS process call command on the SMBUS device specified by SmBusAddress.
383 The 16-bit value specified by Value is written.
384 Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required.
385 The 16-bit value returned by the process call command is returned.
386 If Status is not NULL, then the status of the executed command is returned in Status.
387 If Length in SmBusAddress is not zero, then ASSERT().
388 If any reserved bits of SmBusAddress are set, then ASSERT().
389
390 @param SmBusAddress The address that encodes the SMBUS Slave Address,
391 SMBUS Command, SMBUS Data Length, and PEC.
392 @param Value The 16-bit value to write.
393 @param Status Return status for the executed command.
394 This is an optional parameter and may be NULL.
395 RETURN_SUCCESS: The SMBUS command was executed.
396 RETURN_TIMEOUT: A timeout occurred while executing the
397 SMBUS command.
398 RETURN_DEVICE_ERROR: The request was not completed because
399 a failure reflected in the Host Status Register bit.
400 Device errors are a result of a transaction collision,
401 illegal command field, unclaimed cycle (host initiated),
402 or bus errors (collisions).
403 RETURN_CRC_ERROR: The checksum is not correct. (PEC is incorrect.)
404 RETURN_UNSUPPORTED: The SMBus operation is not supported.
405
406 @return The 16-bit value returned by the process call command.
407
408 **/
409 UINT16
410 EFIAPI
411 SmBusProcessCall (
412 IN UINTN SmBusAddress,
413 IN UINT16 Value,
414 OUT RETURN_STATUS *Status OPTIONAL
415 )
416 {
417 ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0);
418 ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0);
419
420 InternalSmBusExec (EfiSmbusProcessCall, SmBusAddress, 2, &Value, Status);
421
422 return Value;
423 }
424
425 /**
426 Executes an SMBUS read block command.
427
428 Executes an SMBUS read block command on the SMBUS device specified by SmBusAddress.
429 Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required.
430 Bytes are read from the SMBUS and stored in Buffer.
431 The number of bytes read is returned, and will never return a value larger than 32-bytes.
432 If Status is not NULL, then the status of the executed command is returned in Status.
433 It is the caller's responsibility to make sure Buffer is large enough for the total number of bytes read.
434 SMBUS supports a maximum transfer size of 32 bytes, so Buffer does not need to be any larger than 32 bytes.
435 If Length in SmBusAddress is not zero, then ASSERT().
436 If Buffer is NULL, then ASSERT().
437 If any reserved bits of SmBusAddress are set, then ASSERT().
438
439 @param SmBusAddress The address that encodes the SMBUS Slave Address,
440 SMBUS Command, SMBUS Data Length, and PEC.
441 @param Buffer The pointer to the buffer to store the bytes read from the SMBUS.
442 @param Status Return status for the executed command.
443 This is an optional parameter and may be NULL.
444 RETURN_SUCCESS: The SMBUS command was executed.
445 RETURN_TIMEOUT: A timeout occurred while executing the
446 SMBUS command.
447 RETURN_DEVICE_ERROR: The request was not completed because
448 a failure reflected in the Host Status Register bit.
449 Device errors are a result of a transaction collision,
450 illegal command field, unclaimed cycle (host initiated),
451 or bus errors (collisions).
452 RETURN_CRC_ERROR: The checksum is not correct. (PEC is incorrect.)
453 RETURN_UNSUPPORTED: The SMBus operation is not supported.
454
455 @return The number of bytes read.
456
457 **/
458 UINTN
459 EFIAPI
460 SmBusReadBlock (
461 IN UINTN SmBusAddress,
462 OUT VOID *Buffer,
463 OUT RETURN_STATUS *Status OPTIONAL
464 )
465 {
466 ASSERT (Buffer != NULL);
467 ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0);
468 ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0);
469
470 return InternalSmBusExec (EfiSmbusReadBlock, SmBusAddress, 0x20, Buffer, Status);
471 }
472
473 /**
474 Executes an SMBUS write block command.
475
476 Executes an SMBUS write block command on the SMBUS device specified by SmBusAddress.
477 The SMBUS slave address, SMBUS command, and SMBUS length fields of SmBusAddress are required.
478 Bytes are written to the SMBUS from Buffer.
479 The number of bytes written is returned, and will never return a value larger than 32-bytes.
480 If Status is not NULL, then the status of the executed command is returned in Status.
481 If Length in SmBusAddress is zero or greater than 32, then ASSERT().
482 If Buffer is NULL, then ASSERT().
483 If any reserved bits of SmBusAddress are set, then ASSERT().
484
485 @param SmBusAddress The address that encodes the SMBUS Slave Address,
486 MBUS Command, SMBUS Data Length, and PEC.
487 @param Buffer The pointer to the buffer to store the bytes read from the SMBUS.
488 @param Status Return status for the executed command.
489 This is an optional parameter and may be NULL.
490 RETURN_TIMEOUT: A timeout occurred while executing the
491 SMBUS command.
492 RETURN_DEVICE_ERROR: The request was not completed because
493 a failure reflected in the Host Status Register bit.
494 Device errors are a result of a transaction collision,
495 illegal command field, unclaimed cycle (host initiated),
496 or bus errors (collisions).
497 RETURN_CRC_ERROR: The checksum is not correct (PEC is incorrect)
498 RETURN_UNSUPPORTED: The SMBus operation is not supported.
499
500 @return The number of bytes written.
501
502 **/
503 UINTN
504 EFIAPI
505 SmBusWriteBlock (
506 IN UINTN SmBusAddress,
507 OUT VOID *Buffer,
508 OUT RETURN_STATUS *Status OPTIONAL
509 )
510 {
511 UINTN Length;
512
513 ASSERT (Buffer != NULL);
514 ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) >= 1);
515 ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) <= 32);
516 ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0);
517
518 Length = SMBUS_LIB_LENGTH (SmBusAddress);
519 return InternalSmBusExec (EfiSmbusWriteBlock, SmBusAddress, Length, Buffer, Status);
520 }
521
522 /**
523 Executes an SMBUS block process call command.
524
525 Executes an SMBUS block process call command on the SMBUS device specified by SmBusAddress.
526 The SMBUS slave address, SMBUS command, and SMBUS length fields of SmBusAddress are required.
527 Bytes are written to the SMBUS from WriteBuffer. Bytes are then read from the SMBUS into ReadBuffer.
528 If Status is not NULL, then the status of the executed command is returned in Status.
529 It is the caller's responsibility to make sure ReadBuffer is large enough for the total number of bytes read.
530 SMBUS supports a maximum transfer size of 32 bytes, so Buffer does not need to be any larger than 32 bytes.
531 If Length in SmBusAddress is zero or greater than 32, then ASSERT().
532 If WriteBuffer is NULL, then ASSERT().
533 If ReadBuffer is NULL, then ASSERT().
534 If any reserved bits of SmBusAddress are set, then ASSERT().
535
536 @param SmBusAddress The address that encodes the SMBUS Slave Address,
537 SMBUS Command, SMBUS Data Length, and PEC.
538 @param WriteBuffer The pointer to the buffer of bytes to write to the SMBUS.
539 @param ReadBuffer The pointer to the buffer of bytes to read from the SMBUS.
540 @param Status Return status for the executed command.
541 This is an optional parameter and may be NULL.
542 RETURN_TIMEOUT: A timeout occurred while executing the
543 SMBUS command.
544 RETURN_DEVICE_ERROR: The request was not completed because
545 a failure reflected in the Host Status Register bit.
546 Device errors are a result of a transaction collision,
547 illegal command field, unclaimed cycle (host initiated),
548 or bus errors (collisions).
549 RETURN_CRC_ERROR The checksum is not correct. (PEC is incorrect.)
550 RETURN_UNSUPPORTED: The SMBus operation is not supported.
551
552 @return The number of bytes written.
553
554 **/
555 UINTN
556 EFIAPI
557 SmBusBlockProcessCall (
558 IN UINTN SmBusAddress,
559 IN VOID *WriteBuffer,
560 OUT VOID *ReadBuffer,
561 OUT RETURN_STATUS *Status OPTIONAL
562 )
563 {
564 UINTN Length;
565
566 ASSERT (WriteBuffer != NULL);
567 ASSERT (ReadBuffer != NULL);
568 ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) >= 1);
569 ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) <= 32);
570 ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0);
571
572 Length = SMBUS_LIB_LENGTH (SmBusAddress);
573 //
574 // Assuming that ReadBuffer is large enough to save another memory copy.
575 //
576 ReadBuffer = CopyMem (ReadBuffer, WriteBuffer, Length);
577 return InternalSmBusExec (EfiSmbusBWBRProcessCall, SmBusAddress, Length, ReadBuffer, Status);
578 }