TianoCore EDK2 master
Loading...
Searching...
No Matches
DxeSmbusLib.c
Go to the documentation of this file.
1
10#include "InternalSmbusLib.h"
11
12//
13// Global variable to cache pointer to Smbus protocol.
14//
16
30EFIAPI
32 IN EFI_HANDLE ImageHandle,
33 IN EFI_SYSTEM_TABLE *SystemTable
34 )
35{
36 EFI_STATUS Status;
37
38 Status = gBS->LocateProtocol (&gEfiSmbusHcProtocolGuid, NULL, (VOID **)&mSmbus);
39 ASSERT_EFI_ERROR (Status);
40 ASSERT (mSmbus != NULL);
41
42 return Status;
43}
44
70 IN EFI_SMBUS_OPERATION SmbusOperation,
71 IN UINTN SmBusAddress,
72 IN UINTN Length,
73 IN OUT VOID *Buffer,
74 OUT RETURN_STATUS *Status OPTIONAL
75 )
76{
77 RETURN_STATUS ReturnStatus;
78 EFI_SMBUS_DEVICE_ADDRESS SmbusDeviceAddress;
79
80 SmbusDeviceAddress.SmbusDeviceAddress = SMBUS_LIB_SLAVE_ADDRESS (SmBusAddress);
81
82 ReturnStatus = mSmbus->Execute (
83 mSmbus,
84 SmbusDeviceAddress,
85 SMBUS_LIB_COMMAND (SmBusAddress),
86 SmbusOperation,
87 SMBUS_LIB_PEC (SmBusAddress),
88 &Length,
89 Buffer
90 );
91 if (Status != NULL) {
92 *Status = ReturnStatus;
93 }
94
95 return Length;
96}
UINT64 UINTN
EFI_STATUS EFIAPI SmbusLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
Definition: DxeSmbusLib.c:31
UINTN InternalSmBusExec(IN EFI_SMBUS_OPERATION SmbusOperation, IN UINTN SmBusAddress, IN UINTN Length, IN OUT VOID *Buffer, OUT RETURN_STATUS *Status OPTIONAL)
Definition: DxeSmbusLib.c:69
#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
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
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
EFI_BOOT_SERVICES * gBS
UINTN SmbusDeviceAddress
Definition: SmBus.h:34