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