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