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