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