2 The file provides basic SMBus host controller management
3 and basic data transactions over the SMBus.
5 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
8 @par Revision Reference: PI
13 #ifndef __SMBUS_HC_H__
14 #define __SMBUS_HC_H__
16 #include <IndustryStandard/SmBus.h>
18 #define EFI_SMBUS_HC_PROTOCOL_GUID \
19 {0xe49d33ed, 0x513d, 0x4634, { 0xb6, 0x98, 0x6f, 0x55, 0xaa, 0x75, 0x1c, 0x1b} }
21 typedef struct _EFI_SMBUS_HC_PROTOCOL EFI_SMBUS_HC_PROTOCOL
;
25 The Execute() function provides a standard way to execute an
26 operation as defined in the System Management Bus (SMBus)
27 Specification. The resulting transaction will be either that
28 the SMBus slave devices accept this transaction or that this
29 function returns with error.
31 @param This A pointer to the EFI_SMBUS_HC_PROTOCOL instance.
32 SlaveAddress The SMBus slave address of the device
33 with which to communicate. Type
34 EFI_SMBUS_DEVICE_ADDRESS is defined in
35 EFI_PEI_SMBUS_PPI.Execute() in the Platform
36 Initialization SMBus PPI Specification.
38 @param Command This command is transmitted by the SMBus host
39 controller to the SMBus slave device and the
40 interpretation is SMBus slave device specific.
41 It can mean the offset to a list of functions
42 inside an SMBus slave device. Not all
43 operations or slave devices support this
44 command's registers. Type
45 EFI_SMBUS_DEVICE_COMMAND is defined in
46 EFI_PEI_SMBUS_PPI.Execute() in the Platform
47 Initialization SMBus PPI Specification.
49 @param Operation Signifies the particular SMBus
50 hardware protocol instance it will use to
51 execute the SMBus transactions. This SMBus
52 hardware protocol is defined by the SMBus
53 Specification and is not related to PI
54 Architecture. Type EFI_SMBUS_OPERATION is
55 defined in EFI_PEI_SMBUS_PPI.Execute() in the
56 Platform Initialization SMBus PPI
59 @param PecCheck Defines if Packet Error Code (PEC) checking
60 is required for this operation. SMBus Host
61 Controller Code Definitions Version 1.0
64 @param Length Signifies the number of bytes that this operation will do.
65 The maximum number of bytes can be revision
66 specific and operation specific. This field
67 will contain the actual number of bytes that
68 are executed for this operation. Not all
69 operations require this argument.
71 @param Buffer Contains the value of data to execute to the
72 SMBus slave device. Not all operations require
73 this argument. The length of this buffer is
77 @retval EFI_SUCCESS The last data that was returned from the
78 access matched the poll exit criteria.
80 @retval EFI_CRC_ERROR Checksum is not correct (PEC is incorrect).
82 @retval EFI_TIMEOUT Timeout expired before the operation was
83 completed. Timeout is determined by the
84 SMBus host controller device.
86 @retval EFI_OUT_OF_RESOURCES The request could not be
87 completed due to a lack of
90 @retval EFI_DEVICE_ERROR The request was not completed
91 because a failure that was reflected
92 in the Host Status Register bit.
93 Device errors are a result of a
94 transaction collision, illegal
95 command field, unclaimed cycle (host
96 initiated), or bus errors
99 @retval EFI_INVALID_PARAMETER Operation is not defined in
102 @retval EFI_INVALID_PARAMETER Length/Buffer is NULL for
103 operations except for
104 EfiSmbusQuickRead and
105 EfiSmbusQuickWrite. Length is
106 outside the range of valid
109 @retval EFI_UNSUPPORTED The SMBus operation or PEC is not
112 @retval EFI_BUFFER_TOO_SMALL Buffer is not sufficient for
118 (EFIAPI
*EFI_SMBUS_HC_EXECUTE_OPERATION
)(
119 IN CONST EFI_SMBUS_HC_PROTOCOL
*This
,
120 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress
,
121 IN EFI_SMBUS_DEVICE_COMMAND Command
,
122 IN EFI_SMBUS_OPERATION Operation
,
124 IN OUT UINTN
*Length
,
132 The ArpDevice() function provides a standard way for a device driver to
133 enumerate the entire SMBus or specific devices on the bus.
135 @param This A pointer to the EFI_SMBUS_HC_PROTOCOL instance.
137 @param ArpAll A Boolean expression that indicates if the
138 host drivers need to enumerate all the devices
139 or enumerate only the device that is
140 identified by SmbusUdid. If ArpAll is TRUE,
141 SmbusUdid and SlaveAddress are optional. If
142 ArpAll is FALSE, ArpDevice will enumerate
143 SmbusUdid and the address will be at
146 @param SmbusUdid The Unique Device Identifier (UDID) that is
147 associated with this device. Type
148 EFI_SMBUS_UDID is defined in
149 EFI_PEI_SMBUS_PPI.ArpDevice() in the
150 Platform Initialization SMBus PPI
153 @param SlaveAddress The SMBus slave address that is
154 associated with an SMBus UDID.
156 @retval EFI_SUCCESS The last data that was returned from the
157 access matched the poll exit criteria.
159 @retval EFI_CRC_ERROR Checksum is not correct (PEC is
162 @retval EFI_TIMEOUT Timeout expired before the operation was
163 completed. Timeout is determined by the
164 SMBus host controller device.
166 @retval EFI_OUT_OF_RESOURCES The request could not be
167 completed due to a lack of
170 @retval EFI_DEVICE_ERROR The request was not completed
171 because a failure was reflected in
172 the Host Status Register bit. Device
173 Errors are a result of a transaction
174 collision, illegal command field,
175 unclaimed cycle (host initiated), or
176 bus errors (collisions).
178 @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are
179 not implemented by this driver.
184 (EFIAPI
*EFI_SMBUS_HC_PROTOCOL_ARP_DEVICE
)(
185 IN CONST EFI_SMBUS_HC_PROTOCOL
*This
,
187 IN EFI_SMBUS_UDID
*SmbusUdid OPTIONAL
,
188 IN OUT EFI_SMBUS_DEVICE_ADDRESS
*SlaveAddress OPTIONAL
193 The GetArpMap() function returns the mapping of all the SMBus devices
194 that were enumerated by the SMBus host driver.
196 @param This A pointer to the EFI_SMBUS_HC_PROTOCOL instance.
198 @param Length Size of the buffer that contains the SMBus
201 @param SmbusDeviceMap The pointer to the device map as
202 enumerated by the SMBus controller
205 @retval EFI_SUCCESS The SMBus returned the current device map.
207 @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are
208 not implemented by this driver.
213 (EFIAPI
*EFI_SMBUS_HC_PROTOCOL_GET_ARP_MAP
)(
214 IN CONST EFI_SMBUS_HC_PROTOCOL
*This
,
215 IN OUT UINTN
*Length
,
216 IN OUT EFI_SMBUS_DEVICE_MAP
**SmbusDeviceMap
220 The notify function does some actions.
223 The SMBUS hardware address to which the SMBUS device is preassigned or allocated.
226 Data of the SMBus host notify command that the caller wants to be called.
232 (EFIAPI
*EFI_SMBUS_NOTIFY_FUNCTION
)(
233 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress
,
240 The Notify() function registers all the callback functions to
241 allow the bus driver to call these functions when the
242 SlaveAddress/Data pair happens.
244 @param This A pointer to the EFI_SMBUS_HC_PROTOCOL instance.
246 @param SlaveAddress Address that the host controller detects
247 as sending a message and calls all the registered function.
249 @param Data Data that the host controller detects as sending
250 message and calls all the registered function.
253 @param NotifyFunction The function to call when the bus
254 driver detects the SlaveAddress and
257 @retval EFI_SUCCESS NotifyFunction was registered.
259 @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are
260 not implemented by this driver.
265 (EFIAPI
*EFI_SMBUS_HC_PROTOCOL_NOTIFY
)(
266 IN CONST EFI_SMBUS_HC_PROTOCOL
*This
,
267 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress
,
269 IN EFI_SMBUS_NOTIFY_FUNCTION NotifyFunction
274 /// The EFI_SMBUS_HC_PROTOCOL provides SMBus host controller management and basic data
275 /// transactions over SMBus. There is one EFI_SMBUS_HC_PROTOCOL instance for each SMBus
278 struct _EFI_SMBUS_HC_PROTOCOL
{
279 EFI_SMBUS_HC_EXECUTE_OPERATION Execute
;
280 EFI_SMBUS_HC_PROTOCOL_ARP_DEVICE ArpDevice
;
281 EFI_SMBUS_HC_PROTOCOL_GET_ARP_MAP GetArpMap
;
282 EFI_SMBUS_HC_PROTOCOL_NOTIFY Notify
;
286 extern EFI_GUID gEfiSmbusHcProtocolGuid
;