TianoCore EDK2 master
Loading...
Searching...
No Matches
PeiSmbusLib.c
Go to the documentation of this file.
1
9#include "InternalSmbusLib.h"
10
23 VOID
24 )
25{
26 EFI_STATUS Status;
27 EFI_PEI_SMBUS2_PPI *SmbusPpi;
28
29 Status = PeiServicesLocatePpi (&gEfiPeiSmbus2PpiGuid, 0, NULL, (VOID **)&SmbusPpi);
30 ASSERT_EFI_ERROR (Status);
31 ASSERT (SmbusPpi != NULL);
32
33 return SmbusPpi;
34}
35
61 IN EFI_SMBUS_OPERATION SmbusOperation,
62 IN UINTN SmBusAddress,
63 IN UINTN Length,
64 IN OUT VOID *Buffer,
65 OUT RETURN_STATUS *Status OPTIONAL
66 )
67{
68 EFI_PEI_SMBUS2_PPI *SmbusPpi;
69 RETURN_STATUS ReturnStatus;
70 EFI_SMBUS_DEVICE_ADDRESS SmbusDeviceAddress;
71
72 SmbusPpi = InternalGetSmbusPpi ();
73 SmbusDeviceAddress.SmbusDeviceAddress = SMBUS_LIB_SLAVE_ADDRESS (SmBusAddress);
74
75 ReturnStatus = SmbusPpi->Execute (
76 SmbusPpi,
77 SmbusDeviceAddress,
78 SMBUS_LIB_COMMAND (SmBusAddress),
79 SmbusOperation,
80 SMBUS_LIB_PEC (SmBusAddress),
81 &Length,
82 Buffer
83 );
84 if (Status != NULL) {
85 *Status = ReturnStatus;
86 }
87
88 return Length;
89}
UINT64 UINTN
EFI_STATUS EFIAPI PeiServicesLocatePpi(IN CONST EFI_GUID *Guid, IN UINTN Instance, IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor, IN OUT VOID **Ppi)
#define NULL
Definition: Base.h:319
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
#define ASSERT_EFI_ERROR(StatusParameter)
Definition: DebugLib.h:462
EFI_PEI_SMBUS2_PPI * InternalGetSmbusPpi(VOID)
Definition: PeiSmbusLib.c:22
UINTN InternalSmBusExec(IN EFI_SMBUS_OPERATION SmbusOperation, IN UINTN SmBusAddress, IN UINTN Length, IN OUT VOID *Buffer, OUT RETURN_STATUS *Status OPTIONAL)
Definition: PeiSmbusLib.c:60
enum _EFI_SMBUS_OPERATION EFI_SMBUS_OPERATION
#define SMBUS_LIB_SLAVE_ADDRESS(SmBusAddress)
Definition: SmbusLib.h:39
#define SMBUS_LIB_COMMAND(SmBusAddress)
Definition: SmbusLib.h:46
#define SMBUS_LIB_PEC(SmBusAddress)
Definition: SmbusLib.h:60
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
UINTN SmbusDeviceAddress
Definition: SmBus.h:34