TianoCore EDK2 master
Loading...
Searching...
No Matches
S3SmbusLib.c
Go to the documentation of this file.
1
12#include <Base.h>
13
14#include <Library/DebugLib.h>
16#include <Library/SmbusLib.h>
17#include <Library/S3SmbusLib.h>
18
36VOID
38 IN EFI_SMBUS_OPERATION SmbusOperation,
39 IN UINTN SmBusAddress,
40 IN UINTN Length,
41 IN OUT VOID *Buffer
42 )
43{
44 RETURN_STATUS Status;
45
47 SmBusAddress,
48 SmbusOperation,
49 &Length,
50 Buffer
51 );
52 ASSERT (Status == RETURN_SUCCESS);
53}
54
73VOID
74EFIAPI
76 IN UINTN SmBusAddress,
77 OUT RETURN_STATUS *Status OPTIONAL
78 )
79{
80 SmBusQuickRead (SmBusAddress, Status);
81
82 InternalSaveSmBusExecToBootScript (EfiSmbusQuickRead, SmBusAddress, 0, NULL);
83}
84
103VOID
104EFIAPI
106 IN UINTN SmBusAddress,
107 OUT RETURN_STATUS *Status OPTIONAL
108 )
109{
110 SmBusQuickWrite (SmBusAddress, Status);
111
112 InternalSaveSmBusExecToBootScript (EfiSmbusQuickWrite, SmBusAddress, 0, NULL);
113}
114
135UINT8
136EFIAPI
138 IN UINTN SmBusAddress,
139 OUT RETURN_STATUS *Status OPTIONAL
140 )
141{
142 UINT8 Byte;
143
144 Byte = SmBusReceiveByte (SmBusAddress, Status);
145
146 InternalSaveSmBusExecToBootScript (EfiSmbusReceiveByte, SmBusAddress, 1, &Byte);
147
148 return Byte;
149}
150
172UINT8
173EFIAPI
175 IN UINTN SmBusAddress,
176 IN UINT8 Value,
177 OUT RETURN_STATUS *Status OPTIONAL
178 )
179{
180 UINT8 Byte;
181
182 Byte = SmBusSendByte (SmBusAddress, Value, Status);
183
184 InternalSaveSmBusExecToBootScript (EfiSmbusSendByte, SmBusAddress, 1, &Byte);
185
186 return Byte;
187}
188
208UINT8
209EFIAPI
211 IN UINTN SmBusAddress,
212 OUT RETURN_STATUS *Status OPTIONAL
213 )
214{
215 UINT8 Byte;
216
217 Byte = SmBusReadDataByte (SmBusAddress, Status);
218
219 InternalSaveSmBusExecToBootScript (EfiSmbusReadByte, SmBusAddress, 1, &Byte);
220
221 return Byte;
222}
223
245UINT8
246EFIAPI
248 IN UINTN SmBusAddress,
249 IN UINT8 Value,
250 OUT RETURN_STATUS *Status OPTIONAL
251 )
252{
253 UINT8 Byte;
254
255 Byte = SmBusWriteDataByte (SmBusAddress, Value, Status);
256
257 InternalSaveSmBusExecToBootScript (EfiSmbusWriteByte, SmBusAddress, 1, &Byte);
258
259 return Byte;
260}
261
281UINT16
282EFIAPI
284 IN UINTN SmBusAddress,
285 OUT RETURN_STATUS *Status OPTIONAL
286 )
287{
288 UINT16 Word;
289
290 Word = SmBusReadDataWord (SmBusAddress, Status);
291
292 InternalSaveSmBusExecToBootScript (EfiSmbusReadWord, SmBusAddress, 2, &Word);
293
294 return Word;
295}
296
318UINT16
319EFIAPI
321 IN UINTN SmBusAddress,
322 IN UINT16 Value,
323 OUT RETURN_STATUS *Status OPTIONAL
324 )
325{
326 UINT16 Word;
327
328 Word = SmBusWriteDataWord (SmBusAddress, Value, Status);
329
330 InternalSaveSmBusExecToBootScript (EfiSmbusWriteWord, SmBusAddress, 2, &Word);
331
332 return Word;
333}
334
356UINT16
357EFIAPI
359 IN UINTN SmBusAddress,
360 IN UINT16 Value,
361 OUT RETURN_STATUS *Status OPTIONAL
362 )
363{
364 UINT16 Word;
365
366 Word = SmBusProcessCall (SmBusAddress, Value, Status);
367
368 InternalSaveSmBusExecToBootScript (EfiSmbusProcessCall, SmBusAddress, 2, &Value);
369
370 return Word;
371}
372
397UINTN
398EFIAPI
400 IN UINTN SmBusAddress,
401 OUT VOID *Buffer,
402 OUT RETURN_STATUS *Status OPTIONAL
403 )
404{
405 UINTN Length;
406
407 Length = SmBusReadBlock (SmBusAddress, Buffer, Status);
408
409 InternalSaveSmBusExecToBootScript (EfiSmbusReadBlock, SmBusAddress, Length, Buffer);
410
411 return Length;
412}
413
436UINTN
437EFIAPI
439 IN UINTN SmBusAddress,
440 OUT VOID *Buffer,
441 OUT RETURN_STATUS *Status OPTIONAL
442 )
443{
444 UINTN Length;
445
446 Length = SmBusWriteBlock (SmBusAddress, Buffer, Status);
447
448 InternalSaveSmBusExecToBootScript (EfiSmbusWriteBlock, SmBusAddress, SMBUS_LIB_LENGTH (SmBusAddress), Buffer);
449
450 return Length;
451}
452
478UINTN
479EFIAPI
481 IN UINTN SmBusAddress,
482 IN VOID *WriteBuffer,
483 OUT VOID *ReadBuffer,
484 OUT RETURN_STATUS *Status OPTIONAL
485 )
486{
487 UINTN Length;
488
489 Length = SmBusBlockProcessCall (SmBusAddress, WriteBuffer, ReadBuffer, Status);
490
491 InternalSaveSmBusExecToBootScript (EfiSmbusBWBRProcessCall, SmBusAddress, SMBUS_LIB_LENGTH (SmBusAddress), ReadBuffer);
492
493 return Length;
494}
UINT64 UINTN
RETURN_STATUS EFIAPI S3BootScriptSaveSmbusExecute(IN UINTN SmBusAddress, IN EFI_SMBUS_OPERATION Operation, IN UINTN *Length, IN VOID *Buffer)
#define NULL
Definition: Base.h:319
#define RETURN_SUCCESS
Definition: Base.h:1066
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
UINT8 EFIAPI S3SmBusSendByte(IN UINTN SmBusAddress, IN UINT8 Value, OUT RETURN_STATUS *Status OPTIONAL)
Definition: S3SmbusLib.c:174
UINTN EFIAPI S3SmBusWriteBlock(IN UINTN SmBusAddress, OUT VOID *Buffer, OUT RETURN_STATUS *Status OPTIONAL)
Definition: S3SmbusLib.c:438
UINT16 EFIAPI S3SmBusReadDataWord(IN UINTN SmBusAddress, OUT RETURN_STATUS *Status OPTIONAL)
Definition: S3SmbusLib.c:283
UINT16 EFIAPI S3SmBusProcessCall(IN UINTN SmBusAddress, IN UINT16 Value, OUT RETURN_STATUS *Status OPTIONAL)
Definition: S3SmbusLib.c:358
UINT8 EFIAPI S3SmBusWriteDataByte(IN UINTN SmBusAddress, IN UINT8 Value, OUT RETURN_STATUS *Status OPTIONAL)
Definition: S3SmbusLib.c:247
VOID EFIAPI S3SmBusQuickWrite(IN UINTN SmBusAddress, OUT RETURN_STATUS *Status OPTIONAL)
Definition: S3SmbusLib.c:105
UINT8 EFIAPI S3SmBusReadDataByte(IN UINTN SmBusAddress, OUT RETURN_STATUS *Status OPTIONAL)
Definition: S3SmbusLib.c:210
UINTN EFIAPI S3SmBusReadBlock(IN UINTN SmBusAddress, OUT VOID *Buffer, OUT RETURN_STATUS *Status OPTIONAL)
Definition: S3SmbusLib.c:399
UINTN EFIAPI S3SmBusBlockProcessCall(IN UINTN SmBusAddress, IN VOID *WriteBuffer, OUT VOID *ReadBuffer, OUT RETURN_STATUS *Status OPTIONAL)
Definition: S3SmbusLib.c:480
UINT16 EFIAPI S3SmBusWriteDataWord(IN UINTN SmBusAddress, IN UINT16 Value, OUT RETURN_STATUS *Status OPTIONAL)
Definition: S3SmbusLib.c:320
UINT8 EFIAPI S3SmBusReceiveByte(IN UINTN SmBusAddress, OUT RETURN_STATUS *Status OPTIONAL)
Definition: S3SmbusLib.c:137
VOID InternalSaveSmBusExecToBootScript(IN EFI_SMBUS_OPERATION SmbusOperation, IN UINTN SmBusAddress, IN UINTN Length, IN OUT VOID *Buffer)
Definition: S3SmbusLib.c:37
VOID EFIAPI S3SmBusQuickRead(IN UINTN SmBusAddress, OUT RETURN_STATUS *Status OPTIONAL)
Definition: S3SmbusLib.c:75
enum _EFI_SMBUS_OPERATION EFI_SMBUS_OPERATION
UINT16 EFIAPI SmBusReadDataWord(IN UINTN SmBusAddress, OUT RETURN_STATUS *Status OPTIONAL)
UINT8 EFIAPI SmBusWriteDataByte(IN UINTN SmBusAddress, IN UINT8 Value, OUT RETURN_STATUS *Status OPTIONAL)
#define SMBUS_LIB_LENGTH(SmBusAddress)
Definition: SmbusLib.h:53
UINTN EFIAPI SmBusWriteBlock(IN UINTN SmBusAddress, OUT VOID *Buffer, OUT RETURN_STATUS *Status OPTIONAL)
UINT16 EFIAPI SmBusProcessCall(IN UINTN SmBusAddress, IN UINT16 Value, OUT RETURN_STATUS *Status OPTIONAL)
VOID EFIAPI SmBusQuickWrite(IN UINTN SmBusAddress, OUT RETURN_STATUS *Status OPTIONAL)
UINTN EFIAPI SmBusReadBlock(IN UINTN SmBusAddress, OUT VOID *Buffer, OUT RETURN_STATUS *Status OPTIONAL)
UINT8 EFIAPI SmBusReceiveByte(IN UINTN SmBusAddress, OUT RETURN_STATUS *Status OPTIONAL)
VOID EFIAPI SmBusQuickRead(IN UINTN SmBusAddress, OUT RETURN_STATUS *Status OPTIONAL)
UINT16 EFIAPI SmBusWriteDataWord(IN UINTN SmBusAddress, IN UINT16 Value, OUT RETURN_STATUS *Status OPTIONAL)
UINTN EFIAPI SmBusBlockProcessCall(IN UINTN SmBusAddress, IN VOID *WriteBuffer, OUT VOID *ReadBuffer, OUT RETURN_STATUS *Status OPTIONAL)
UINT8 EFIAPI SmBusSendByte(IN UINTN SmBusAddress, IN UINT8 Value, OUT RETURN_STATUS *Status OPTIONAL)
UINT8 EFIAPI SmBusReadDataByte(IN UINTN SmBusAddress, OUT RETURN_STATUS *Status OPTIONAL)