]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/SmbusHc.h
Reviewed the code comments in the Include/Protocol directory for typos, grammar issue...
[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
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
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
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
630b4187 54 @param Operation Signifies the particular SMBus\r
55 hardware protocol instance it will use to\r
d1f95000 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
630b4187 67 August 21, 2006 13 \r
68 \r
69 @param Length Signifies the number of bytes that this operation will do.\r
4ca9b6c4
LG
70 The maximum number of bytes can be revision\r
71 specific and operation specific. This field\r
72 will contain the actual number of bytes that\r
73 are executed for this operation. Not all\r
74 operations require this argument.\r
d1f95000 75\r
76 @param Buffer Contains the value of data to execute to the\r
77 SMBus slave device. Not all operations require\r
78 this argument. The length of this buffer is\r
79 identified by Length.\r
80 \r
81 \r
4ca9b6c4
LG
82 @retval EFI_SUCCESS The last data that was returned from the\r
83 access matched the poll exit criteria.\r
d1f95000 84\r
4ca9b6c4 85 @retval EFI_CRC_ERROR Checksum is not correct (PEC is incorrect).\r
d1f95000 86\r
4ca9b6c4
LG
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
d1f95000 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
4ca9b6c4
LG
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
d1f95000 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
4ca9b6c4
LG
114 @retval EFI_UNSUPPORTED The SMBus operation or PEC is not\r
115 supported. \r
d1f95000 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
8b13229b 123(EFIAPI *EFI_SMBUS_HC_EXECUTE_OPERATION)(\r
d1f95000 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
4ca9b6c4
LG
137 The ArpDevice() function provides a standard way for a device driver to \r
138 enumerate the entire SMBus or specific devices on the bus.\r
d1f95000 139 \r
4ca9b6c4
LG
140 @param This A pointer to the EFI_SMBUS_HC_PROTOCOL instance.\r
141\r
142 @param ArpAll A Boolean expression that indicates if the\r
143 host drivers need to enumerate all the devices\r
144 or enumerate only the device that is\r
145 identified by SmbusUdid. If ArpAll is TRUE,\r
146 SmbusUdid and SlaveAddress are optional. If\r
147 ArpAll is FALSE, ArpDevice will enumerate\r
148 SmbusUdid and the address will be at\r
149 SlaveAddress.\r
150\r
151 @param SmbusUdid The Unique Device Identifier (UDID) that is\r
152 associated with this device. Type\r
153 EFI_SMBUS_UDID is defined in\r
154 EFI_PEI_SMBUS_PPI.ArpDevice() in the\r
155 Platform Initialization SMBus PPI\r
156 Specification.\r
d1f95000 157\r
158 @param SlaveAddress The SMBus slave address that is\r
159 associated with an SMBus UDID.\r
160\r
4ca9b6c4
LG
161 @retval EFI_SUCCESS The last data that was returned from the\r
162 access matched the poll exit criteria.\r
d1f95000 163\r
4ca9b6c4
LG
164 @retval EFI_CRC_ERROR Checksum is not correct (PEC is\r
165 incorrect).\r
d1f95000 166\r
4ca9b6c4
LG
167 @retval EFI_TIMEOUT Timeout expired before the operation was\r
168 completed. Timeout is determined by the\r
169 SMBus host controller device.\r
d1f95000 170\r
171 @retval EFI_OUT_OF_RESOURCES The request could not be\r
172 completed due to a lack of\r
173 resources.\r
174\r
4ca9b6c4
LG
175 @retval EFI_DEVICE_ERROR The request was not completed\r
176 because a failure was reflected in\r
177 the Host Status Register bit. Device\r
178 Errors are a result of a transaction\r
179 collision, illegal command field,\r
180 unclaimed cycle (host initiated), or\r
181 bus errors (collisions).\r
d1f95000 182\r
4ca9b6c4
LG
183 @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are\r
184 not implemented by this driver.\r
d1f95000 185 \r
186**/\r
187typedef\r
188EFI_STATUS\r
8b13229b 189(EFIAPI *EFI_SMBUS_HC_PROTOCOL_ARP_DEVICE)(\r
d1f95000 190 IN CONST EFI_SMBUS_HC_PROTOCOL *This,\r
191 IN CONST BOOLEAN ArpAll,\r
192 IN CONST EFI_SMBUS_UDID *SmbusUdid, OPTIONAL\r
193 IN OUT EFI_SMBUS_DEVICE_ADDRESS *SlaveAddress OPTIONAL\r
194);\r
195\r
196\r
197/**\r
4ca9b6c4
LG
198 The GetArpMap() function returns the mapping of all the SMBus devices \r
199 that were enumerated by the SMBus host driver.\r
d1f95000 200 \r
4ca9b6c4 201 @param This A pointer to the EFI_SMBUS_HC_PROTOCOL instance.\r
d1f95000 202 \r
4ca9b6c4
LG
203 @param Length Size of the buffer that contains the SMBus\r
204 device map.\r
d1f95000 205 \r
206 @param SmbusDeviceMap The pointer to the device map as\r
207 enumerated by the SMBus controller\r
208 driver.\r
209 \r
4ca9b6c4 210 @retval EFI_SUCCESS The SMBus returned the current device map.\r
d1f95000 211 \r
212 @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are\r
213 not implemented by this driver.\r
214 \r
215**/\r
216typedef\r
217EFI_STATUS\r
8b13229b 218(EFIAPI *EFI_SMBUS_HC_PROTOCOL_GET_ARP_MAP)(\r
d1f95000 219 IN CONST EFI_SMBUS_HC_PROTOCOL *This,\r
220 IN OUT UINTN *Length,\r
221 IN OUT EFI_SMBUS_DEVICE_MAP **SmbusDeviceMap\r
222);\r
223\r
4ca9b6c4
LG
224/**\r
225 The notify function does some actions.\r
226 \r
227 @param SlaveAddress\r
228 The SMBUS hardware address to which the SMBUS device is preassigned or allocated.\r
d1f95000 229\r
4ca9b6c4
LG
230 @param Data\r
231 Data of the SMBus host notify command that the caller wants to be called.\r
232 \r
233 @return EFI_STATUS\r
234**/\r
d1f95000 235typedef\r
236EFI_STATUS\r
8b13229b 237(EFIAPI *EFI_SMBUS_NOTIFY_FUNCTION)(\r
d1f95000 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
4ca9b6c4 249 @param This A pointer to the EFI_SMBUS_HC_PROTOCOL instance.\r
d1f95000 250 \r
4ca9b6c4 251 @param SlaveAddress Address that the host controller detects\r
630b4187 252 as sending a message, and that calls all the registered function.\r
d1f95000 253\r
4ca9b6c4 254 @param Data Data that the host controller detects as sending\r
630b4187 255 message, and that calls all the registered function.\r
d1f95000 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
4ca9b6c4 262 @retval EFI_SUCCESS NotifyFunction was registered.\r
d1f95000 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
8b13229b 270(EFIAPI *EFI_SMBUS_HC_PROTOCOL_NOTIFY)(\r
d1f95000 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
44717a39 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
d1f95000 283struct _EFI_SMBUS_HC_PROTOCOL {\r
284 EFI_SMBUS_HC_EXECUTE_OPERATION Execute;\r
285 EFI_SMBUS_HC_PROTOCOL_ARP_DEVICE ArpDevice;\r
286 EFI_SMBUS_HC_PROTOCOL_GET_ARP_MAP GetArpMap;\r
287 EFI_SMBUS_HC_PROTOCOL_NOTIFY Notify;\r
288};\r
289\r
290\r
291extern EFI_GUID gEfiSmbusHcProtocolGuid;\r
292\r
293#endif\r
294\r