]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdePkg/Include/Protocol/SmbusHc.h
MdePkg: Apply uncrustify changes
[mirror_edk2.git] / MdePkg / Include / Protocol / SmbusHc.h
... / ...
CommitLineData
1/** @file\r
2 The file provides basic SMBus host controller management\r
3 and basic data transactions over the SMBus.\r
4\r
5 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
6 SPDX-License-Identifier: BSD-2-Clause-Patent\r
7\r
8 @par Revision Reference: PI\r
9 Version 1.00.\r
10\r
11**/\r
12\r
13#ifndef __SMBUS_HC_H__\r
14#define __SMBUS_HC_H__\r
15\r
16#include <IndustryStandard/SmBus.h>\r
17\r
18#define EFI_SMBUS_HC_PROTOCOL_GUID \\r
19 {0xe49d33ed, 0x513d, 0x4634, { 0xb6, 0x98, 0x6f, 0x55, 0xaa, 0x75, 0x1c, 0x1b} }\r
20\r
21typedef struct _EFI_SMBUS_HC_PROTOCOL EFI_SMBUS_HC_PROTOCOL;\r
22\r
23/**\r
24\r
25 The Execute() function provides a standard way to execute an\r
26 operation as defined in the System Management Bus (SMBus)\r
27 Specification. The resulting transaction will be either that\r
28 the SMBus slave devices accept this transaction or that this\r
29 function returns with error.\r
30\r
31 @param This A pointer to the EFI_SMBUS_HC_PROTOCOL instance.\r
32 SlaveAddress The SMBus slave address of the device\r
33 with which to communicate. Type\r
34 EFI_SMBUS_DEVICE_ADDRESS is defined in\r
35 EFI_PEI_SMBUS_PPI.Execute() in the Platform\r
36 Initialization SMBus PPI Specification.\r
37\r
38 @param Command This command is transmitted by the SMBus host\r
39 controller to the SMBus slave device and the\r
40 interpretation is SMBus slave device specific.\r
41 It can mean the offset to a list of functions\r
42 inside an SMBus slave device. Not all\r
43 operations or slave devices support this\r
44 command's registers. Type\r
45 EFI_SMBUS_DEVICE_COMMAND is defined in\r
46 EFI_PEI_SMBUS_PPI.Execute() in the Platform\r
47 Initialization SMBus PPI Specification.\r
48\r
49 @param Operation Signifies the particular SMBus\r
50 hardware protocol instance it will use to\r
51 execute the SMBus transactions. This SMBus\r
52 hardware protocol is defined by the SMBus\r
53 Specification and is not related to PI\r
54 Architecture. Type EFI_SMBUS_OPERATION is\r
55 defined in EFI_PEI_SMBUS_PPI.Execute() in the\r
56 Platform Initialization SMBus PPI\r
57 Specification.\r
58\r
59 @param PecCheck Defines if Packet Error Code (PEC) checking\r
60 is required for this operation. SMBus Host\r
61 Controller Code Definitions Version 1.0\r
62 August 21, 2006 13\r
63\r
64 @param Length Signifies the number of bytes that this operation will do.\r
65 The maximum number of bytes can be revision\r
66 specific and operation specific. This field\r
67 will contain the actual number of bytes that\r
68 are executed for this operation. Not all\r
69 operations require this argument.\r
70\r
71 @param Buffer Contains the value of data to execute to the\r
72 SMBus slave device. Not all operations require\r
73 this argument. The length of this buffer is\r
74 identified by Length.\r
75\r
76\r
77 @retval EFI_SUCCESS The last data that was returned from the\r
78 access matched the poll exit criteria.\r
79\r
80 @retval EFI_CRC_ERROR Checksum is not correct (PEC is incorrect).\r
81\r
82 @retval EFI_TIMEOUT Timeout expired before the operation was\r
83 completed. Timeout is determined by the\r
84 SMBus host controller device.\r
85\r
86 @retval EFI_OUT_OF_RESOURCES The request could not be\r
87 completed due to a lack of\r
88 resources.\r
89\r
90 @retval EFI_DEVICE_ERROR The request was not completed\r
91 because a failure that was reflected\r
92 in the Host Status Register bit.\r
93 Device errors are a result of a\r
94 transaction collision, illegal\r
95 command field, unclaimed cycle (host\r
96 initiated), or bus errors\r
97 (collisions).\r
98\r
99 @retval EFI_INVALID_PARAMETER Operation is not defined in\r
100 EFI_SMBUS_OPERATION.\r
101\r
102 @retval EFI_INVALID_PARAMETER Length/Buffer is NULL for\r
103 operations except for\r
104 EfiSmbusQuickRead and\r
105 EfiSmbusQuickWrite. Length is\r
106 outside the range of valid\r
107 values.\r
108\r
109 @retval EFI_UNSUPPORTED The SMBus operation or PEC is not\r
110 supported.\r
111\r
112 @retval EFI_BUFFER_TOO_SMALL Buffer is not sufficient for\r
113 this operation.\r
114\r
115**/\r
116typedef\r
117EFI_STATUS\r
118(EFIAPI *EFI_SMBUS_HC_EXECUTE_OPERATION)(\r
119 IN CONST EFI_SMBUS_HC_PROTOCOL *This,\r
120 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r
121 IN EFI_SMBUS_DEVICE_COMMAND Command,\r
122 IN EFI_SMBUS_OPERATION Operation,\r
123 IN BOOLEAN PecCheck,\r
124 IN OUT UINTN *Length,\r
125 IN OUT VOID *Buffer\r
126 );\r
127\r
128/**\r
129\r
130 The ArpDevice() function provides a standard way for a device driver to\r
131 enumerate the entire SMBus or specific devices on the bus.\r
132\r
133 @param This A pointer to the EFI_SMBUS_HC_PROTOCOL instance.\r
134\r
135 @param ArpAll A Boolean expression that indicates if the\r
136 host drivers need to enumerate all the devices\r
137 or enumerate only the device that is\r
138 identified by SmbusUdid. If ArpAll is TRUE,\r
139 SmbusUdid and SlaveAddress are optional. If\r
140 ArpAll is FALSE, ArpDevice will enumerate\r
141 SmbusUdid and the address will be at\r
142 SlaveAddress.\r
143\r
144 @param SmbusUdid The Unique Device Identifier (UDID) that is\r
145 associated with this device. Type\r
146 EFI_SMBUS_UDID is defined in\r
147 EFI_PEI_SMBUS_PPI.ArpDevice() in the\r
148 Platform Initialization SMBus PPI\r
149 Specification.\r
150\r
151 @param SlaveAddress The SMBus slave address that is\r
152 associated with an SMBus UDID.\r
153\r
154 @retval EFI_SUCCESS The last data that was returned from the\r
155 access matched the poll exit criteria.\r
156\r
157 @retval EFI_CRC_ERROR Checksum is not correct (PEC is\r
158 incorrect).\r
159\r
160 @retval EFI_TIMEOUT Timeout expired before the operation was\r
161 completed. Timeout is determined by the\r
162 SMBus host controller device.\r
163\r
164 @retval EFI_OUT_OF_RESOURCES The request could not be\r
165 completed due to a lack of\r
166 resources.\r
167\r
168 @retval EFI_DEVICE_ERROR The request was not completed\r
169 because a failure was reflected in\r
170 the Host Status Register bit. Device\r
171 Errors are a result of a transaction\r
172 collision, illegal command field,\r
173 unclaimed cycle (host initiated), or\r
174 bus errors (collisions).\r
175\r
176 @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are\r
177 not implemented by this driver.\r
178\r
179**/\r
180typedef\r
181EFI_STATUS\r
182(EFIAPI *EFI_SMBUS_HC_PROTOCOL_ARP_DEVICE)(\r
183 IN CONST EFI_SMBUS_HC_PROTOCOL *This,\r
184 IN BOOLEAN ArpAll,\r
185 IN EFI_SMBUS_UDID *SmbusUdid OPTIONAL,\r
186 IN OUT EFI_SMBUS_DEVICE_ADDRESS *SlaveAddress OPTIONAL\r
187 );\r
188\r
189/**\r
190 The GetArpMap() function returns the mapping of all the SMBus devices\r
191 that were enumerated by the SMBus host driver.\r
192\r
193 @param This A pointer to the EFI_SMBUS_HC_PROTOCOL instance.\r
194\r
195 @param Length Size of the buffer that contains the SMBus\r
196 device map.\r
197\r
198 @param SmbusDeviceMap The pointer to the device map as\r
199 enumerated by the SMBus controller\r
200 driver.\r
201\r
202 @retval EFI_SUCCESS The SMBus returned the current device map.\r
203\r
204 @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are\r
205 not implemented by this driver.\r
206\r
207**/\r
208typedef\r
209EFI_STATUS\r
210(EFIAPI *EFI_SMBUS_HC_PROTOCOL_GET_ARP_MAP)(\r
211 IN CONST EFI_SMBUS_HC_PROTOCOL *This,\r
212 IN OUT UINTN *Length,\r
213 IN OUT EFI_SMBUS_DEVICE_MAP **SmbusDeviceMap\r
214 );\r
215\r
216/**\r
217 The notify function does some actions.\r
218\r
219 @param SlaveAddress\r
220 The SMBUS hardware address to which the SMBUS device is preassigned or allocated.\r
221\r
222 @param Data\r
223 Data of the SMBus host notify command that the caller wants to be called.\r
224\r
225 @return EFI_STATUS\r
226**/\r
227typedef\r
228EFI_STATUS\r
229(EFIAPI *EFI_SMBUS_NOTIFY_FUNCTION)(\r
230 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r
231 IN UINTN Data\r
232 );\r
233\r
234/**\r
235\r
236 The Notify() function registers all the callback functions to\r
237 allow the bus driver to call these functions when the\r
238 SlaveAddress/Data pair happens.\r
239\r
240 @param This A pointer to the EFI_SMBUS_HC_PROTOCOL instance.\r
241\r
242 @param SlaveAddress Address that the host controller detects\r
243 as sending a message and calls all the registered function.\r
244\r
245 @param Data Data that the host controller detects as sending\r
246 message and calls all the registered function.\r
247\r
248\r
249 @param NotifyFunction The function to call when the bus\r
250 driver detects the SlaveAddress and\r
251 Data pair.\r
252\r
253 @retval EFI_SUCCESS NotifyFunction was registered.\r
254\r
255 @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are\r
256 not implemented by this driver.\r
257\r
258**/\r
259typedef\r
260EFI_STATUS\r
261(EFIAPI *EFI_SMBUS_HC_PROTOCOL_NOTIFY)(\r
262 IN CONST EFI_SMBUS_HC_PROTOCOL *This,\r
263 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r
264 IN UINTN Data,\r
265 IN EFI_SMBUS_NOTIFY_FUNCTION NotifyFunction\r
266 );\r
267\r
268///\r
269/// The EFI_SMBUS_HC_PROTOCOL provides SMBus host controller management and basic data\r
270/// transactions over SMBus. There is one EFI_SMBUS_HC_PROTOCOL instance for each SMBus\r
271/// host controller.\r
272///\r
273struct _EFI_SMBUS_HC_PROTOCOL {\r
274 EFI_SMBUS_HC_EXECUTE_OPERATION Execute;\r
275 EFI_SMBUS_HC_PROTOCOL_ARP_DEVICE ArpDevice;\r
276 EFI_SMBUS_HC_PROTOCOL_GET_ARP_MAP GetArpMap;\r
277 EFI_SMBUS_HC_PROTOCOL_NOTIFY Notify;\r
278};\r
279\r
280extern EFI_GUID gEfiSmbusHcProtocolGuid;\r
281\r
282#endif\r