]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/Smbus.h
Make variable names for protocol GUIDs consistent
[mirror_edk2.git] / MdePkg / Include / Protocol / Smbus.h
CommitLineData
878ddf1f 1/** @file\r
2 This file declares the EFI SMBus Host Controller protocol\r
3\r
4 Copyright (c) 2006, Intel Corporation \r
5 All rights reserved. This program and the accompanying materials \r
6 are licensed and made available under the terms and conditions of the BSD License \r
7 which accompanies this distribution. The full text of the license may be found at \r
8 http://opensource.org/licenses/bsd-license.php \r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
12\r
13 Module Name: Smbus.h\r
14\r
15 @par Revision Reference:\r
16 This protocol is defined in Framework of EFI SMBus Host Controller Specification\r
17 Version 0.9\r
18\r
19**/\r
20\r
21#ifndef _EFI_SMBUS_H\r
22#define _EFI_SMBUS_H\r
23\r
24#define EFI_SMBUS_HC_PROTOCOL_GUID \\r
25 { \\r
26 0xe49d33ed, 0x513d, 0x4634, {0xb6, 0x98, 0x6f, 0x55, 0xaa, 0x75, 0x1c, 0x1b } \\r
27 }\r
28\r
29typedef struct _EFI_SMBUS_HC_PROTOCOL EFI_SMBUS_HC_PROTOCOL;\r
30\r
31/**\r
32 Executes an SMBus operation to an SMBus controller.\r
33\r
34 @param This A pointer to the EFI_SMBUS_HC_PROTOCOL instance.\r
35 \r
36 @param SlaveAddress The SMBus slave address of the device with which to communicate.\r
37 \r
38 @param Command This command is transmitted by the SMBus host \r
39 controller to the SMBus slave device and the interpretation is \r
40 SMBus slave device specific.\r
41 \r
42 @param Operation Signifies which particular SMBus hardware protocol \r
43 instance that it will use to execute the SMBus transactions. \r
44 \r
45 @param PecCheck Defines if Packet Error Code (PEC) checking is required \r
46 for this operation.\r
47 \r
48 @param Length Signifies the number of bytes that this operation will do.\r
49 \r
50 @param Buffer Contains the value of data to execute to the SMBus slave device.\r
51\r
52 @retval EFI_SUCCESS The last data that was returned from the access \r
53 matched the poll exit criteria.\r
54 \r
55 @retval EFI_CRC_ERROR The checksum is not correct (PEC is incorrect)\r
56 \r
57 @retval EFI_TIMEOUT Timeout expired before the operation was completed. \r
58 Timeout is determined by the SMBus host controller device.\r
59 \r
60 @retval EFI_OUT_OF_RESOURCES The request could not be completed \r
61 due to a lack of resources.\r
62 \r
63 @retval EFI_DEVICE_ERROR The request was not completed because \r
64 a failure reflected in the Host Status Register bit.\r
65 \r
66 @retval EFI_INVALID_PARAMETER Operation is not defined in EFI_SMBUS_OPERATION.\r
67 Or Length/Buffer is NULL for operations except for EfiSmbusQuickRead and \r
68 EfiSmbusQuickWrite. Length is outside the range of valid values.\r
69 \r
70 @retval EFI_UNSUPPORTED The SMBus operation or PEC is not supported.\r
71 \r
72 @retval EFI_BUFFER_TOO_SMALL Buffer is not sufficient for this operation.\r
73\r
74**/\r
75typedef\r
76EFI_STATUS\r
77(EFIAPI *EFI_SMBUS_HC_EXECUTE_OPERATION) (\r
78 IN EFI_SMBUS_HC_PROTOCOL *This,\r
79 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r
80 IN EFI_SMBUS_DEVICE_COMMAND Command,\r
81 IN EFI_SMBUS_OPERATION Operation,\r
82 IN BOOLEAN PecCheck,\r
83 IN OUT UINTN *Length,\r
84 IN OUT VOID *Buffer\r
85 );\r
86\r
87typedef struct {\r
88 UINT32 VendorSpecificId;\r
89 UINT16 SubsystemDeviceId;\r
90 UINT16 SubsystemVendorId;\r
91 UINT16 Interface;\r
92 UINT16 DeviceId;\r
93 UINT16 VendorId;\r
94 UINT8 VendorRevision;\r
95 UINT8 DeviceCapabilities;\r
96} EFI_SMBUS_UDID;\r
97\r
98/**\r
99 CallBack function can be registered in EFI_SMBUS_HC_PROTOCOL_NOTIFY.\r
100\r
101 @param SlaveAddress The SMBUS hardware address to which the SMBUS \r
102 device is preassigned or allocated.\r
103 \r
104 @param Data Data of the SMBus host notify command that \r
105 the caller wants to be called.\r
106\r
107 @return Status Code\r
108\r
109**/\r
110typedef\r
111EFI_STATUS\r
112(EFIAPI *EFI_SMBUS_NOTIFY_FUNCTION) (\r
113 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r
114 IN UINTN Data\r
115 );\r
116\r
117/**\r
118 Sets the SMBus slave device addresses for the device with a given unique ID \r
119 or enumerates the entire bus.\r
120\r
121 @param This A pointer to the EFI_SMBUS_HC_PROTOCOL instance.\r
122 \r
123 @param ArpAll A Boolean expression that indicates if the host drivers need \r
124 to enumerate all the devices or enumerate only the device that is identified \r
125 by SmbusUdid. If ArpAll is TRUE, SmbusUdid and SlaveAddress are optional. \r
126 If ArpAll is FALSE, ArpDevice will enumerate SmbusUdid and the address \r
127 will be at SlaveAddress.\r
128 \r
129 @param SmbusUdid The Unique Device Identifier (UDID) that is associated \r
130 with this device.\r
131 \r
132 @param SlaveAddress The SMBus slave address that is associated with an SMBus UDID. \r
133\r
134 @retval EFI_SUCCESS The SMBus slave device address was set.\r
135 \r
136 @retval EFI_INVALID_PARAMETER SlaveAddress is NULL.\r
137 \r
138 @retval EFI_OUT_OF_RESOURCES The request could not be completed \r
139 due to a lack of resources.\r
140 \r
141 @retval EFI_TIMEOUT The SMBus slave device did not respond.\r
142 \r
143 @retval EFI_DEVICE_ERROR The request was not completed because the transaction failed.\r
144\r
145**/\r
146typedef\r
147EFI_STATUS\r
148(EFIAPI *EFI_SMBUS_HC_PROTOCOL_ARP_DEVICE) (\r
149 IN EFI_SMBUS_HC_PROTOCOL *This,\r
150 IN BOOLEAN ArpAll,\r
151 IN EFI_SMBUS_UDID *SmbusUdid, OPTIONAL\r
152 IN OUT EFI_SMBUS_DEVICE_ADDRESS *SlaveAddress OPTIONAL\r
153 );\r
154\r
155typedef struct {\r
156 EFI_SMBUS_DEVICE_ADDRESS SmbusDeviceAddress;\r
157 EFI_SMBUS_UDID SmbusDeviceUdid;\r
158} EFI_SMBUS_DEVICE_MAP;\r
159\r
160/**\r
161 The GetArpMap() function returns the mapping of all the SMBus devices \r
162 that are enumerated by the SMBus host driver. \r
163\r
164 @param This A pointer to the EFI_SMBUS_HC_PROTOCOL instance.\r
165 \r
166 @param Length Size of the buffer that contains the SMBus device map.\r
167 \r
168 @param SmbusDeviceMap The pointer to the device map as enumerated \r
169 by the SMBus controller driver.\r
170\r
171 @retval EFI_SUCCESS The device map was returned correctly in the buffer.\r
172\r
173**/\r
174typedef\r
175EFI_STATUS\r
176(EFIAPI *EFI_SMBUS_HC_PROTOCOL_GET_ARP_MAP) (\r
177 IN EFI_SMBUS_HC_PROTOCOL *This,\r
178 IN OUT UINTN *Length,\r
179 IN OUT EFI_SMBUS_DEVICE_MAP **SmbusDeviceMap\r
180 );\r
181\r
182/**\r
183 The Notify() function registers all the callback functions to allow the \r
184 bus driver to call these functions when the SlaveAddress/Data pair happens.\r
185\r
186 @param This A pointer to the EFI_SMBUS_HC_PROTOCOL instance.\r
187 \r
188 @param SlaveAddress Address that the host controller detects as \r
189 sending a message and calls all the registered functions.\r
190 \r
191 @param Data Data that the host controller detects as sending a message \r
192 and calls all the registered functions.\r
193 \r
194 @param NotifyFunction The function to call when the bus driver \r
195 detects the SlaveAddress and Data pair.\r
196\r
197 @retval EFI_SUCCESS NotifyFunction was registered.\r
198\r
199**/\r
200typedef\r
201EFI_STATUS\r
202(EFIAPI *EFI_SMBUS_HC_PROTOCOL_NOTIFY) (\r
203 IN EFI_SMBUS_HC_PROTOCOL *This,\r
204 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r
205 IN UINTN Data,\r
206 IN EFI_SMBUS_NOTIFY_FUNCTION NotifyFunction\r
207 );\r
208\r
209/**\r
210 @par Protocol Description:\r
211 Provides basic SMBus host controller management and basic data \r
212 transactions over the SMBus.\r
213\r
214 @param Execute\r
215 Executes the SMBus operation to an SMBus slave device.\r
216\r
217 @param ArpDevice\r
218 Allows an SMBus 2.0 device(s) to be Address Resolution Protocol (ARP)\r
219\r
220 @param GetArpMap\r
221 Allows a driver to retrieve the address that was allocated by the SMBus \r
222 host controller during enumeration/ARP.\r
223\r
224 @param Notify\r
225 Allows a driver to register for a callback to the SMBus host \r
226 controller driver when the bus issues a notification to the bus controller driver.\r
227\r
228**/\r
229struct _EFI_SMBUS_HC_PROTOCOL {\r
230 EFI_SMBUS_HC_EXECUTE_OPERATION Execute;\r
231 EFI_SMBUS_HC_PROTOCOL_ARP_DEVICE ArpDevice;\r
232 EFI_SMBUS_HC_PROTOCOL_GET_ARP_MAP GetArpMap;\r
233 EFI_SMBUS_HC_PROTOCOL_NOTIFY Notify;\r
234};\r
235\r
236extern EFI_GUID gEfiSmbusProtocolGuid;\r
237#endif\r