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