]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/SmbusHc.h
MdePkg: Clean up source files
[mirror_edk2.git] / MdePkg / Include / Protocol / SmbusHc.h
CommitLineData
d1f95000 1/** @file\r
9095d37b 2 The file provides basic SMBus host controller management\r
d1f95000 3 and basic data transactions over the SMBus.\r
4\r
9095d37b
LG
5 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
6 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
d1f95000 10\r
9095d37b
LG
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
d1f95000 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
9095d37b 30\r
d1f95000 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
9095d37b
LG
35 function returns with error.\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
f754f721 54\r
630b4187 55 @param Operation Signifies the particular SMBus\r
56 hardware protocol instance it will use to\r
d1f95000 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
4ca9b6c4
LG
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
9095d37b
LG
68 August 21, 2006 13\r
69\r
630b4187 70 @param Length Signifies the number of bytes that this operation will do.\r
4ca9b6c4
LG
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
d1f95000 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
9095d37b
LG
81\r
82\r
4ca9b6c4
LG
83 @retval EFI_SUCCESS The last data that was returned from the\r
84 access matched the poll exit criteria.\r
d1f95000 85\r
4ca9b6c4 86 @retval EFI_CRC_ERROR Checksum is not correct (PEC is incorrect).\r
d1f95000 87\r
4ca9b6c4
LG
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
d1f95000 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
4ca9b6c4
LG
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
d1f95000 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
4ca9b6c4 115 @retval EFI_UNSUPPORTED The SMBus operation or PEC is not\r
9095d37b 116 supported.\r
d1f95000 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
8b13229b 124(EFIAPI *EFI_SMBUS_HC_EXECUTE_OPERATION)(\r
d1f95000 125 IN CONST EFI_SMBUS_HC_PROTOCOL *This,\r
83a6cf34 126 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r
127 IN EFI_SMBUS_DEVICE_COMMAND Command,\r
128 IN EFI_SMBUS_OPERATION Operation,\r
129 IN BOOLEAN PecCheck,\r
d1f95000 130 IN OUT UINTN *Length,\r
131 IN OUT VOID *Buffer\r
132);\r
133\r
134\r
135\r
136/**\r
9095d37b
LG
137\r
138 The ArpDevice() function provides a standard way for a device driver to\r
4ca9b6c4 139 enumerate the entire SMBus or specific devices on the bus.\r
9095d37b 140\r
4ca9b6c4
LG
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
d1f95000 158\r
159 @param SlaveAddress The SMBus slave address that is\r
160 associated with an SMBus UDID.\r
161\r
4ca9b6c4
LG
162 @retval EFI_SUCCESS The last data that was returned from the\r
163 access matched the poll exit criteria.\r
d1f95000 164\r
4ca9b6c4
LG
165 @retval EFI_CRC_ERROR Checksum is not correct (PEC is\r
166 incorrect).\r
d1f95000 167\r
4ca9b6c4
LG
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
d1f95000 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
4ca9b6c4
LG
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
d1f95000 183\r
4ca9b6c4
LG
184 @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are\r
185 not implemented by this driver.\r
9095d37b 186\r
d1f95000 187**/\r
188typedef\r
189EFI_STATUS\r
8b13229b 190(EFIAPI *EFI_SMBUS_HC_PROTOCOL_ARP_DEVICE)(\r
d1f95000 191 IN CONST EFI_SMBUS_HC_PROTOCOL *This,\r
83a6cf34 192 IN BOOLEAN ArpAll,\r
193 IN EFI_SMBUS_UDID *SmbusUdid, OPTIONAL\r
d1f95000 194 IN OUT EFI_SMBUS_DEVICE_ADDRESS *SlaveAddress OPTIONAL\r
195);\r
196\r
197\r
198/**\r
9095d37b 199 The GetArpMap() function returns the mapping of all the SMBus devices\r
4ca9b6c4 200 that were enumerated by the SMBus host driver.\r
9095d37b 201\r
4ca9b6c4 202 @param This A pointer to the EFI_SMBUS_HC_PROTOCOL instance.\r
9095d37b 203\r
4ca9b6c4
LG
204 @param Length Size of the buffer that contains the SMBus\r
205 device map.\r
9095d37b 206\r
d1f95000 207 @param SmbusDeviceMap The pointer to the device map as\r
208 enumerated by the SMBus controller\r
209 driver.\r
9095d37b 210\r
4ca9b6c4 211 @retval EFI_SUCCESS The SMBus returned the current device map.\r
9095d37b 212\r
d1f95000 213 @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are\r
214 not implemented by this driver.\r
9095d37b 215\r
d1f95000 216**/\r
217typedef\r
218EFI_STATUS\r
8b13229b 219(EFIAPI *EFI_SMBUS_HC_PROTOCOL_GET_ARP_MAP)(\r
d1f95000 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
4ca9b6c4
LG
225/**\r
226 The notify function does some actions.\r
9095d37b 227\r
4ca9b6c4
LG
228 @param SlaveAddress\r
229 The SMBUS hardware address to which the SMBUS device is preassigned or allocated.\r
d1f95000 230\r
4ca9b6c4
LG
231 @param Data\r
232 Data of the SMBus host notify command that the caller wants to be called.\r
9095d37b 233\r
4ca9b6c4
LG
234 @return EFI_STATUS\r
235**/\r
d1f95000 236typedef\r
237EFI_STATUS\r
8b13229b 238(EFIAPI *EFI_SMBUS_NOTIFY_FUNCTION)(\r
83a6cf34 239 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r
240 IN UINTN Data\r
d1f95000 241);\r
242\r
243\r
244/**\r
9095d37b 245\r
d1f95000 246 The Notify() function registers all the callback functions to\r
9095d37b 247 allow the bus driver to call these functions when the\r
d1f95000 248 SlaveAddress/Data pair happens.\r
9095d37b 249\r
4ca9b6c4 250 @param This A pointer to the EFI_SMBUS_HC_PROTOCOL instance.\r
9095d37b 251\r
4ca9b6c4 252 @param SlaveAddress Address that the host controller detects\r
f754f721 253 as sending a message and calls all the registered function.\r
d1f95000 254\r
4ca9b6c4 255 @param Data Data that the host controller detects as sending\r
f754f721 256 message and calls all the registered function.\r
d1f95000 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
4ca9b6c4 263 @retval EFI_SUCCESS NotifyFunction was registered.\r
9095d37b 264\r
d1f95000 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
8b13229b 271(EFIAPI *EFI_SMBUS_HC_PROTOCOL_NOTIFY)(\r
d1f95000 272 IN CONST EFI_SMBUS_HC_PROTOCOL *This,\r
83a6cf34 273 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r
274 IN UINTN Data,\r
275 IN EFI_SMBUS_NOTIFY_FUNCTION NotifyFunction\r
d1f95000 276);\r
277\r
278\r
44717a39 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
d1f95000 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