]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/SmbusHc.h
MdePkg: Apply uncrustify changes
[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
2f88bd3a 126 );\r
d1f95000 127\r
128/**\r
9095d37b
LG
129\r
130 The ArpDevice() function provides a standard way for a device driver to\r
4ca9b6c4 131 enumerate the entire SMBus or specific devices on the bus.\r
9095d37b 132\r
4ca9b6c4
LG
133 @param This A pointer to the EFI_SMBUS_HC_PROTOCOL instance.\r
134\r
135 @param ArpAll A Boolean expression that indicates if the\r
136 host drivers need to enumerate all the devices\r
137 or enumerate only the device that is\r
138 identified by SmbusUdid. If ArpAll is TRUE,\r
139 SmbusUdid and SlaveAddress are optional. If\r
140 ArpAll is FALSE, ArpDevice will enumerate\r
141 SmbusUdid and the address will be at\r
142 SlaveAddress.\r
143\r
144 @param SmbusUdid The Unique Device Identifier (UDID) that is\r
145 associated with this device. Type\r
146 EFI_SMBUS_UDID is defined in\r
147 EFI_PEI_SMBUS_PPI.ArpDevice() in the\r
148 Platform Initialization SMBus PPI\r
149 Specification.\r
d1f95000 150\r
151 @param SlaveAddress The SMBus slave address that is\r
152 associated with an SMBus UDID.\r
153\r
4ca9b6c4
LG
154 @retval EFI_SUCCESS The last data that was returned from the\r
155 access matched the poll exit criteria.\r
d1f95000 156\r
4ca9b6c4
LG
157 @retval EFI_CRC_ERROR Checksum is not correct (PEC is\r
158 incorrect).\r
d1f95000 159\r
4ca9b6c4
LG
160 @retval EFI_TIMEOUT Timeout expired before the operation was\r
161 completed. Timeout is determined by the\r
162 SMBus host controller device.\r
d1f95000 163\r
164 @retval EFI_OUT_OF_RESOURCES The request could not be\r
165 completed due to a lack of\r
166 resources.\r
167\r
4ca9b6c4
LG
168 @retval EFI_DEVICE_ERROR The request was not completed\r
169 because a failure was reflected in\r
170 the Host Status Register bit. Device\r
171 Errors are a result of a transaction\r
172 collision, illegal command field,\r
173 unclaimed cycle (host initiated), or\r
174 bus errors (collisions).\r
d1f95000 175\r
4ca9b6c4
LG
176 @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are\r
177 not implemented by this driver.\r
9095d37b 178\r
d1f95000 179**/\r
180typedef\r
181EFI_STATUS\r
8b13229b 182(EFIAPI *EFI_SMBUS_HC_PROTOCOL_ARP_DEVICE)(\r
d1f95000 183 IN CONST EFI_SMBUS_HC_PROTOCOL *This,\r
83a6cf34 184 IN BOOLEAN ArpAll,\r
d0e2f823 185 IN EFI_SMBUS_UDID *SmbusUdid OPTIONAL,\r
d1f95000 186 IN OUT EFI_SMBUS_DEVICE_ADDRESS *SlaveAddress OPTIONAL\r
2f88bd3a 187 );\r
d1f95000 188\r
189/**\r
9095d37b 190 The GetArpMap() function returns the mapping of all the SMBus devices\r
4ca9b6c4 191 that were enumerated by the SMBus host driver.\r
9095d37b 192\r
4ca9b6c4 193 @param This A pointer to the EFI_SMBUS_HC_PROTOCOL instance.\r
9095d37b 194\r
4ca9b6c4
LG
195 @param Length Size of the buffer that contains the SMBus\r
196 device map.\r
9095d37b 197\r
d1f95000 198 @param SmbusDeviceMap The pointer to the device map as\r
199 enumerated by the SMBus controller\r
200 driver.\r
9095d37b 201\r
4ca9b6c4 202 @retval EFI_SUCCESS The SMBus returned the current device map.\r
9095d37b 203\r
d1f95000 204 @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are\r
205 not implemented by this driver.\r
9095d37b 206\r
d1f95000 207**/\r
208typedef\r
209EFI_STATUS\r
8b13229b 210(EFIAPI *EFI_SMBUS_HC_PROTOCOL_GET_ARP_MAP)(\r
d1f95000 211 IN CONST EFI_SMBUS_HC_PROTOCOL *This,\r
212 IN OUT UINTN *Length,\r
213 IN OUT EFI_SMBUS_DEVICE_MAP **SmbusDeviceMap\r
2f88bd3a 214 );\r
d1f95000 215\r
4ca9b6c4
LG
216/**\r
217 The notify function does some actions.\r
9095d37b 218\r
4ca9b6c4
LG
219 @param SlaveAddress\r
220 The SMBUS hardware address to which the SMBUS device is preassigned or allocated.\r
d1f95000 221\r
4ca9b6c4
LG
222 @param Data\r
223 Data of the SMBus host notify command that the caller wants to be called.\r
9095d37b 224\r
4ca9b6c4
LG
225 @return EFI_STATUS\r
226**/\r
d1f95000 227typedef\r
228EFI_STATUS\r
8b13229b 229(EFIAPI *EFI_SMBUS_NOTIFY_FUNCTION)(\r
83a6cf34 230 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r
231 IN UINTN Data\r
2f88bd3a 232 );\r
d1f95000 233\r
234/**\r
9095d37b 235\r
d1f95000 236 The Notify() function registers all the callback functions to\r
9095d37b 237 allow the bus driver to call these functions when the\r
d1f95000 238 SlaveAddress/Data pair happens.\r
9095d37b 239\r
4ca9b6c4 240 @param This A pointer to the EFI_SMBUS_HC_PROTOCOL instance.\r
9095d37b 241\r
4ca9b6c4 242 @param SlaveAddress Address that the host controller detects\r
f754f721 243 as sending a message and calls all the registered function.\r
d1f95000 244\r
4ca9b6c4 245 @param Data Data that the host controller detects as sending\r
f754f721 246 message and calls all the registered function.\r
d1f95000 247\r
248\r
249 @param NotifyFunction The function to call when the bus\r
250 driver detects the SlaveAddress and\r
251 Data pair.\r
252\r
4ca9b6c4 253 @retval EFI_SUCCESS NotifyFunction was registered.\r
9095d37b 254\r
d1f95000 255 @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are\r
256 not implemented by this driver.\r
257\r
258**/\r
259typedef\r
260EFI_STATUS\r
8b13229b 261(EFIAPI *EFI_SMBUS_HC_PROTOCOL_NOTIFY)(\r
d1f95000 262 IN CONST EFI_SMBUS_HC_PROTOCOL *This,\r
83a6cf34 263 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r
264 IN UINTN Data,\r
265 IN EFI_SMBUS_NOTIFY_FUNCTION NotifyFunction\r
2f88bd3a 266 );\r
d1f95000 267\r
44717a39 268///\r
269/// The EFI_SMBUS_HC_PROTOCOL provides SMBus host controller management and basic data\r
270/// transactions over SMBus. There is one EFI_SMBUS_HC_PROTOCOL instance for each SMBus\r
271/// host controller.\r
272///\r
d1f95000 273struct _EFI_SMBUS_HC_PROTOCOL {\r
2f88bd3a
MK
274 EFI_SMBUS_HC_EXECUTE_OPERATION Execute;\r
275 EFI_SMBUS_HC_PROTOCOL_ARP_DEVICE ArpDevice;\r
276 EFI_SMBUS_HC_PROTOCOL_GET_ARP_MAP GetArpMap;\r
277 EFI_SMBUS_HC_PROTOCOL_NOTIFY Notify;\r
d1f95000 278};\r
279\r
2f88bd3a 280extern EFI_GUID gEfiSmbusHcProtocolGuid;\r
d1f95000 281\r
282#endif\r