]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdePkg/Include/Protocol/SmbusHc.h
update codes per MdePkg doxgen review comments.
[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 - 2009, 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 @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 <IndustryStandard/SmBus.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. \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\r
55 @param Operation Signifies the particular SMBus\r
56 hardware protocol instance it will use to\r
57 execute the SMBus transactions. This SMBus\r
58 hardware protocol is defined by the SMBus\r
59 Specification and is not related to PI\r
60 Architecture. Type EFI_SMBUS_OPERATION is\r
61 defined in EFI_PEI_SMBUS_PPI.Execute() in the\r
62 Platform Initialization SMBus PPI\r
63 Specification.\r
64\r
65 @param PecCheck Defines if Packet Error Code (PEC) checking\r
66 is required for this operation. SMBus Host\r
67 Controller Code Definitions Version 1.0\r
68 August 21, 2006 13 \r
69 \r
70 @param Length Signifies the 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 incorrect).\r
87\r
88 @retval EFI_TIMEOUT Timeout expired before the operation was\r
89 completed. Timeout is determined by the\r
90 SMBus host controller device.\r
91\r
92 @retval EFI_OUT_OF_RESOURCES The request could not be\r
93 completed due to a lack of\r
94 resources.\r
95\r
96 @retval EFI_DEVICE_ERROR The request was not completed\r
97 because a failure that was reflected\r
98 in the Host Status Register bit.\r
99 Device errors are a result of a\r
100 transaction collision, illegal\r
101 command field, unclaimed cycle (host\r
102 initiated), or bus errors\r
103 (collisions).\r
104\r
105 @retval EFI_INVALID_PARAMETER Operation is not defined in\r
106 EFI_SMBUS_OPERATION.\r
107\r
108 @retval EFI_INVALID_PARAMETER Length/Buffer is NULL for\r
109 operations except for\r
110 EfiSmbusQuickRead and\r
111 EfiSmbusQuickWrite. Length is\r
112 outside the range of valid\r
113 values.\r
114\r
115 @retval EFI_UNSUPPORTED The SMBus operation or PEC is not\r
116 supported. \r
117\r
118 @retval EFI_BUFFER_TOO_SMALL Buffer is not sufficient for\r
119 this operation.\r
120\r
121**/\r
122typedef\r
123EFI_STATUS\r
124(EFIAPI *EFI_SMBUS_HC_EXECUTE_OPERATION)(\r
125 IN CONST EFI_SMBUS_HC_PROTOCOL *This,\r
126 IN CONST EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r
127 IN CONST EFI_SMBUS_DEVICE_COMMAND Command,\r
128 IN CONST EFI_SMBUS_OPERATION Operation,\r
129 IN CONST BOOLEAN PecCheck,\r
130 IN OUT UINTN *Length,\r
131 IN OUT VOID *Buffer\r
132);\r
133\r
134\r
135\r
136/**\r
137 \r
138 The ArpDevice() function provides a standard way for a device driver to \r
139 enumerate the entire SMBus or specific devices on the bus.\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 @retval EFI_SUCCESS The last data that was returned from the\r
163 access matched the poll exit criteria.\r
164\r
165 @retval EFI_CRC_ERROR Checksum is not correct (PEC is\r
166 incorrect).\r
167\r
168 @retval EFI_TIMEOUT Timeout expired before the operation was\r
169 completed. Timeout is determined by the\r
170 SMBus host controller device.\r
171\r
172 @retval EFI_OUT_OF_RESOURCES The request could not be\r
173 completed due to a lack of\r
174 resources.\r
175\r
176 @retval EFI_DEVICE_ERROR The request was not completed\r
177 because a failure was reflected in\r
178 the Host Status Register bit. Device\r
179 Errors are a result of a transaction\r
180 collision, illegal command field,\r
181 unclaimed cycle (host initiated), or\r
182 bus errors (collisions).\r
183\r
184 @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are\r
185 not implemented by this driver.\r
186 \r
187**/\r
188typedef\r
189EFI_STATUS\r
190(EFIAPI *EFI_SMBUS_HC_PROTOCOL_ARP_DEVICE)(\r
191 IN CONST EFI_SMBUS_HC_PROTOCOL *This,\r
192 IN CONST BOOLEAN ArpAll,\r
193 IN CONST EFI_SMBUS_UDID *SmbusUdid, OPTIONAL\r
194 IN OUT EFI_SMBUS_DEVICE_ADDRESS *SlaveAddress OPTIONAL\r
195);\r
196\r
197\r
198/**\r
199 The GetArpMap() function returns the mapping of all the SMBus devices \r
200 that were enumerated by the SMBus host driver.\r
201 \r
202 @param This A pointer to the EFI_SMBUS_HC_PROTOCOL instance.\r
203 \r
204 @param Length Size of the buffer that contains the SMBus\r
205 device map.\r
206 \r
207 @param SmbusDeviceMap The pointer to the device map as\r
208 enumerated by the SMBus controller\r
209 driver.\r
210 \r
211 @retval EFI_SUCCESS The SMBus returned the current device map.\r
212 \r
213 @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are\r
214 not implemented by this driver.\r
215 \r
216**/\r
217typedef\r
218EFI_STATUS\r
219(EFIAPI *EFI_SMBUS_HC_PROTOCOL_GET_ARP_MAP)(\r
220 IN CONST EFI_SMBUS_HC_PROTOCOL *This,\r
221 IN OUT UINTN *Length,\r
222 IN OUT EFI_SMBUS_DEVICE_MAP **SmbusDeviceMap\r
223);\r
224\r
225/**\r
226 The notify function does some actions.\r
227 \r
228 @param SlaveAddress\r
229 The SMBUS hardware address to which the SMBUS device is preassigned or allocated.\r
230\r
231 @param Data\r
232 Data of the SMBus host notify command that the caller wants to be called.\r
233 \r
234 @return EFI_STATUS\r
235**/\r
236typedef\r
237EFI_STATUS\r
238(EFIAPI *EFI_SMBUS_NOTIFY_FUNCTION)(\r
239 IN CONST EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r
240 IN CONST UINTN Data\r
241);\r
242\r
243\r
244/**\r
245 \r
246 The Notify() function registers all the callback functions to\r
247 allow the bus driver to call these functions when the \r
248 SlaveAddress/Data pair happens.\r
249 \r
250 @param This A pointer to the EFI_SMBUS_HC_PROTOCOL instance.\r
251 \r
252 @param SlaveAddress Address that the host controller detects\r
253 as sending a message and calls all the registered function.\r
254\r
255 @param Data Data that the host controller detects as sending\r
256 message and calls all the registered function.\r
257\r
258\r
259 @param NotifyFunction The function to call when the bus\r
260 driver detects the SlaveAddress and\r
261 Data pair.\r
262\r
263 @retval EFI_SUCCESS NotifyFunction was registered.\r
264 \r
265 @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are\r
266 not implemented by this driver.\r
267\r
268**/\r
269typedef\r
270EFI_STATUS\r
271(EFIAPI *EFI_SMBUS_HC_PROTOCOL_NOTIFY)(\r
272 IN CONST EFI_SMBUS_HC_PROTOCOL *This,\r
273 IN CONST EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r
274 IN CONST UINTN Data,\r
275 IN CONST EFI_SMBUS_NOTIFY_FUNCTION NotifyFunction\r
276);\r
277\r
278\r
279///\r
280/// The EFI_SMBUS_HC_PROTOCOL provides SMBus host controller management and basic data\r
281/// transactions over SMBus. There is one EFI_SMBUS_HC_PROTOCOL instance for each SMBus\r
282/// host controller.\r
283///\r
284struct _EFI_SMBUS_HC_PROTOCOL {\r
285 EFI_SMBUS_HC_EXECUTE_OPERATION Execute;\r
286 EFI_SMBUS_HC_PROTOCOL_ARP_DEVICE ArpDevice;\r
287 EFI_SMBUS_HC_PROTOCOL_GET_ARP_MAP GetArpMap;\r
288 EFI_SMBUS_HC_PROTOCOL_NOTIFY Notify;\r
289};\r
290\r
291\r
292extern EFI_GUID gEfiSmbusHcProtocolGuid;\r
293\r
294#endif\r
295\r