]>
Commit | Line | Data |
---|---|---|
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 | |
4ca9b6c4 | 5 | Copyright (c) 2006 - 2008, Intel Corporation \r |
d1f95000 | 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 | |
992f22b9 | 22 | #include <IndustryStandard/SmBus.h>\r |
d1f95000 | 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 | |
27 | typedef 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 | |
4ca9b6c4 LG |
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 | |
d1f95000 | 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 | |
4ca9b6c4 LG |
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 | |
d1f95000 | 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 | |
4ca9b6c4 LG |
81 | @retval EFI_SUCCESS The last data that was returned from the\r |
82 | access matched the poll exit criteria.\r | |
d1f95000 | 83 | \r |
4ca9b6c4 | 84 | @retval EFI_CRC_ERROR Checksum is not correct (PEC is incorrect).\r |
d1f95000 | 85 | \r |
4ca9b6c4 LG |
86 | @retval EFI_TIMEOUT Timeout expired before the operation was\r |
87 | completed. Timeout is determined by the\r | |
88 | SMBus host controller device.\r | |
d1f95000 | 89 | \r |
90 | @retval EFI_OUT_OF_RESOURCES The request could not be\r | |
91 | completed due to a lack of\r | |
92 | resources.\r | |
93 | \r | |
4ca9b6c4 LG |
94 | @retval EFI_DEVICE_ERROR The request was not completed\r |
95 | because a failure that was reflected\r | |
96 | in the Host Status Register bit.\r | |
97 | Device errors are a result of a\r | |
98 | transaction collision, illegal\r | |
99 | command field, unclaimed cycle (host\r | |
100 | initiated), or bus errors\r | |
101 | (collisions).\r | |
d1f95000 | 102 | \r |
103 | @retval EFI_INVALID_PARAMETER Operation is not defined in\r | |
104 | EFI_SMBUS_OPERATION.\r | |
105 | \r | |
106 | @retval EFI_INVALID_PARAMETER Length/Buffer is NULL for\r | |
107 | operations except for\r | |
108 | EfiSmbusQuickRead and\r | |
109 | EfiSmbusQuickWrite. Length is\r | |
110 | outside the range of valid\r | |
111 | values.\r | |
112 | \r | |
4ca9b6c4 LG |
113 | @retval EFI_UNSUPPORTED The SMBus operation or PEC is not\r |
114 | supported. \r | |
d1f95000 | 115 | \r |
116 | @retval EFI_BUFFER_TOO_SMALL Buffer is not sufficient for\r | |
117 | this operation.\r | |
118 | \r | |
119 | **/\r | |
120 | typedef\r | |
121 | EFI_STATUS\r | |
8b13229b | 122 | (EFIAPI *EFI_SMBUS_HC_EXECUTE_OPERATION)(\r |
d1f95000 | 123 | IN CONST EFI_SMBUS_HC_PROTOCOL *This,\r |
124 | IN CONST EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r | |
125 | IN CONST EFI_SMBUS_DEVICE_COMMAND Command,\r | |
126 | IN CONST EFI_SMBUS_OPERATION Operation,\r | |
127 | IN CONST BOOLEAN PecCheck,\r | |
128 | IN OUT UINTN *Length,\r | |
129 | IN OUT VOID *Buffer\r | |
130 | );\r | |
131 | \r | |
132 | \r | |
133 | \r | |
134 | /**\r | |
135 | \r | |
4ca9b6c4 LG |
136 | The ArpDevice() function provides a standard way for a device driver to \r |
137 | enumerate the entire SMBus or specific devices on the bus.\r | |
d1f95000 | 138 | \r |
4ca9b6c4 LG |
139 | @param This A pointer to the EFI_SMBUS_HC_PROTOCOL instance.\r |
140 | \r | |
141 | @param ArpAll A Boolean expression that indicates if the\r | |
142 | host drivers need to enumerate all the devices\r | |
143 | or enumerate only the device that is\r | |
144 | identified by SmbusUdid. If ArpAll is TRUE,\r | |
145 | SmbusUdid and SlaveAddress are optional. If\r | |
146 | ArpAll is FALSE, ArpDevice will enumerate\r | |
147 | SmbusUdid and the address will be at\r | |
148 | SlaveAddress.\r | |
149 | \r | |
150 | @param SmbusUdid The Unique Device Identifier (UDID) that is\r | |
151 | associated with this device. Type\r | |
152 | EFI_SMBUS_UDID is defined in\r | |
153 | EFI_PEI_SMBUS_PPI.ArpDevice() in the\r | |
154 | Platform Initialization SMBus PPI\r | |
155 | Specification.\r | |
d1f95000 | 156 | \r |
157 | @param SlaveAddress The SMBus slave address that is\r | |
158 | associated with an SMBus UDID.\r | |
159 | \r | |
4ca9b6c4 LG |
160 | @retval EFI_SUCCESS The last data that was returned from the\r |
161 | access matched the poll exit criteria.\r | |
d1f95000 | 162 | \r |
4ca9b6c4 LG |
163 | @retval EFI_CRC_ERROR Checksum is not correct (PEC is\r |
164 | incorrect).\r | |
d1f95000 | 165 | \r |
4ca9b6c4 LG |
166 | @retval EFI_TIMEOUT Timeout expired before the operation was\r |
167 | completed. Timeout is determined by the\r | |
168 | SMBus host controller device.\r | |
d1f95000 | 169 | \r |
170 | @retval EFI_OUT_OF_RESOURCES The request could not be\r | |
171 | completed due to a lack of\r | |
172 | resources.\r | |
173 | \r | |
4ca9b6c4 LG |
174 | @retval EFI_DEVICE_ERROR The request was not completed\r |
175 | because a failure was reflected in\r | |
176 | the Host Status Register bit. Device\r | |
177 | Errors are a result of a transaction\r | |
178 | collision, illegal command field,\r | |
179 | unclaimed cycle (host initiated), or\r | |
180 | bus errors (collisions).\r | |
d1f95000 | 181 | \r |
4ca9b6c4 LG |
182 | @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are\r |
183 | not implemented by this driver.\r | |
d1f95000 | 184 | \r |
185 | **/\r | |
186 | typedef\r | |
187 | EFI_STATUS\r | |
8b13229b | 188 | (EFIAPI *EFI_SMBUS_HC_PROTOCOL_ARP_DEVICE)(\r |
d1f95000 | 189 | IN CONST EFI_SMBUS_HC_PROTOCOL *This,\r |
190 | IN CONST BOOLEAN ArpAll,\r | |
191 | IN CONST EFI_SMBUS_UDID *SmbusUdid, OPTIONAL\r | |
192 | IN OUT EFI_SMBUS_DEVICE_ADDRESS *SlaveAddress OPTIONAL\r | |
193 | );\r | |
194 | \r | |
195 | \r | |
196 | /**\r | |
4ca9b6c4 LG |
197 | The GetArpMap() function returns the mapping of all the SMBus devices \r |
198 | that were enumerated by the SMBus host driver.\r | |
d1f95000 | 199 | \r |
4ca9b6c4 | 200 | @param This A pointer to the EFI_SMBUS_HC_PROTOCOL instance.\r |
d1f95000 | 201 | \r |
4ca9b6c4 LG |
202 | @param Length Size of the buffer that contains the SMBus\r |
203 | device map.\r | |
d1f95000 | 204 | \r |
205 | @param SmbusDeviceMap The pointer to the device map as\r | |
206 | enumerated by the SMBus controller\r | |
207 | driver.\r | |
208 | \r | |
4ca9b6c4 | 209 | @retval EFI_SUCCESS The SMBus returned the current device map.\r |
d1f95000 | 210 | \r |
211 | @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are\r | |
212 | not implemented by this driver.\r | |
213 | \r | |
214 | **/\r | |
215 | typedef\r | |
216 | EFI_STATUS\r | |
8b13229b | 217 | (EFIAPI *EFI_SMBUS_HC_PROTOCOL_GET_ARP_MAP)(\r |
d1f95000 | 218 | IN CONST EFI_SMBUS_HC_PROTOCOL *This,\r |
219 | IN OUT UINTN *Length,\r | |
220 | IN OUT EFI_SMBUS_DEVICE_MAP **SmbusDeviceMap\r | |
221 | );\r | |
222 | \r | |
4ca9b6c4 LG |
223 | /**\r |
224 | The notify function does some actions.\r | |
225 | \r | |
226 | @param SlaveAddress\r | |
227 | The SMBUS hardware address to which the SMBUS device is preassigned or allocated.\r | |
d1f95000 | 228 | \r |
4ca9b6c4 LG |
229 | @param Data\r |
230 | Data of the SMBus host notify command that the caller wants to be called.\r | |
231 | \r | |
232 | @return EFI_STATUS\r | |
233 | **/\r | |
d1f95000 | 234 | typedef\r |
235 | EFI_STATUS\r | |
8b13229b | 236 | (EFIAPI *EFI_SMBUS_NOTIFY_FUNCTION)(\r |
d1f95000 | 237 | IN CONST EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r |
238 | IN CONST UINTN Data\r | |
239 | );\r | |
240 | \r | |
241 | \r | |
242 | /**\r | |
243 | \r | |
244 | The Notify() function registers all the callback functions to\r | |
245 | allow the bus driver to call these functions when the \r | |
246 | SlaveAddress/Data pair happens.\r | |
247 | \r | |
4ca9b6c4 | 248 | @param This A pointer to the EFI_SMBUS_HC_PROTOCOL instance.\r |
d1f95000 | 249 | \r |
4ca9b6c4 LG |
250 | @param SlaveAddress Address that the host controller detects\r |
251 | as sending a message and calls all the registered function.\r | |
d1f95000 | 252 | \r |
4ca9b6c4 LG |
253 | @param Data Data that the host controller detects as sending\r |
254 | message and calls all the registered function.\r | |
d1f95000 | 255 | \r |
256 | \r | |
257 | @param NotifyFunction The function to call when the bus\r | |
258 | driver detects the SlaveAddress and\r | |
259 | Data pair.\r | |
260 | \r | |
4ca9b6c4 | 261 | @retval EFI_SUCCESS NotifyFunction was registered.\r |
d1f95000 | 262 | \r |
263 | @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are\r | |
264 | not implemented by this driver.\r | |
265 | \r | |
266 | **/\r | |
267 | typedef\r | |
268 | EFI_STATUS\r | |
8b13229b | 269 | (EFIAPI *EFI_SMBUS_HC_PROTOCOL_NOTIFY)(\r |
d1f95000 | 270 | IN CONST EFI_SMBUS_HC_PROTOCOL *This,\r |
271 | IN CONST EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r | |
272 | IN CONST UINTN Data,\r | |
273 | IN CONST EFI_SMBUS_NOTIFY_FUNCTION NotifyFunction\r | |
274 | );\r | |
275 | \r | |
276 | \r | |
44717a39 | 277 | ///\r |
278 | /// The EFI_SMBUS_HC_PROTOCOL provides SMBus host controller management and basic data\r | |
279 | /// transactions over SMBus. There is one EFI_SMBUS_HC_PROTOCOL instance for each SMBus\r | |
280 | /// host controller.\r | |
281 | ///\r | |
d1f95000 | 282 | struct _EFI_SMBUS_HC_PROTOCOL {\r |
283 | EFI_SMBUS_HC_EXECUTE_OPERATION Execute;\r | |
284 | EFI_SMBUS_HC_PROTOCOL_ARP_DEVICE ArpDevice;\r | |
285 | EFI_SMBUS_HC_PROTOCOL_GET_ARP_MAP GetArpMap;\r | |
286 | EFI_SMBUS_HC_PROTOCOL_NOTIFY Notify;\r | |
287 | };\r | |
288 | \r | |
289 | \r | |
290 | extern EFI_GUID gEfiSmbusHcProtocolGuid;\r | |
291 | \r | |
292 | #endif\r | |
293 | \r |