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