]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/Smbus.h
automagically convert ELF to PE/COFF (i386 only)
[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
0647c9ad
LG
34 @param This A pointer to the EFI_SMBUS_HC_PROTOCOL instance.\r
35 @param SlaveAddress The SMBus slave address of the device with which to communicate.\r
36 @param Command This command is transmitted by the SMBus host\r
37 controller to the SMBus slave device and the interpretation is\r
38 SMBus slave device specific.\r
39 @param Operation Signifies which particular SMBus hardware protocol\r
40 instance that it will use to execute the SMBus transactions.\r
41 @param PecCheck Defines if Packet Error Code (PEC) checking is required\r
42 for this operation.\r
43 @param Length Signifies the number of bytes that this operation will do.\r
44 @param Buffer Contains the value of data to execute to the SMBus slave device.\r
45\r
46 @retval EFI_SUCCESS The last data that was returned from the access\r
47 matched the poll exit criteria.\r
48 @retval EFI_CRC_ERROR The checksum is not correct (PEC is incorrect)\r
49 @retval EFI_TIMEOUT Timeout expired before the operation was completed.\r
50 Timeout is determined by the SMBus host controller device.\r
51 @retval EFI_OUT_OF_RESOURCES The request could not be completed\r
52 due to a lack of resources.\r
53 @retval EFI_DEVICE_ERROR The request was not completed because\r
54 a failure reflected in the Host Status Register bit.\r
878ddf1f 55 @retval EFI_INVALID_PARAMETER Operation is not defined in EFI_SMBUS_OPERATION.\r
0647c9ad
LG
56 Or Length/Buffer is NULL for operations except for EfiSmbusQuickRead and\r
57 EfiSmbusQuickWrite. Length is outside the range of valid values.\r
58 @retval EFI_UNSUPPORTED The SMBus operation or PEC is not supported.\r
59 @retval EFI_BUFFER_TOO_SMALL Buffer is not sufficient for this operation.\r
878ddf1f 60\r
61**/\r
62typedef\r
63EFI_STATUS\r
64(EFIAPI *EFI_SMBUS_HC_EXECUTE_OPERATION) (\r
65 IN EFI_SMBUS_HC_PROTOCOL *This,\r
66 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r
67 IN EFI_SMBUS_DEVICE_COMMAND Command,\r
68 IN EFI_SMBUS_OPERATION Operation,\r
69 IN BOOLEAN PecCheck,\r
70 IN OUT UINTN *Length,\r
71 IN OUT VOID *Buffer\r
72 );\r
73\r
74typedef struct {\r
75 UINT32 VendorSpecificId;\r
76 UINT16 SubsystemDeviceId;\r
77 UINT16 SubsystemVendorId;\r
78 UINT16 Interface;\r
79 UINT16 DeviceId;\r
80 UINT16 VendorId;\r
81 UINT8 VendorRevision;\r
82 UINT8 DeviceCapabilities;\r
83} EFI_SMBUS_UDID;\r
84\r
85/**\r
86 CallBack function can be registered in EFI_SMBUS_HC_PROTOCOL_NOTIFY.\r
87\r
0647c9ad
LG
88 @param SlaveAddress The SMBUS hardware address to which the SMBUS\r
89 device is preassigned or allocated.\r
90 @param Data Data of the SMBus host notify command that\r
91 the caller wants to be called.\r
878ddf1f 92\r
93 @return Status Code\r
94\r
95**/\r
96typedef\r
97EFI_STATUS\r
98(EFIAPI *EFI_SMBUS_NOTIFY_FUNCTION) (\r
99 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r
100 IN UINTN Data\r
101 );\r
102\r
103/**\r
104 Sets the SMBus slave device addresses for the device with a given unique ID \r
105 or enumerates the entire bus.\r
106\r
0647c9ad
LG
107 @param This A pointer to the EFI_SMBUS_HC_PROTOCOL instance.\r
108 @param ArpAll A Boolean expression that indicates if the host drivers need\r
109 to enumerate all the devices or enumerate only the device that is identified\r
110 by SmbusUdid. If ArpAll is TRUE, SmbusUdid and SlaveAddress are optional.\r
111 If ArpAll is FALSE, ArpDevice will enumerate SmbusUdid and the address\r
112 will be at SlaveAddress.\r
113 @param SmbusUdid The Unique Device Identifier (UDID) that is associated\r
114 with this device.\r
115 @param SlaveAddress The SMBus slave address that is associated with an SMBus UDID.\r
116\r
117 @retval EFI_SUCCESS The SMBus slave device address was set.\r
878ddf1f 118 @retval EFI_INVALID_PARAMETER SlaveAddress is NULL.\r
0647c9ad
LG
119 @retval EFI_OUT_OF_RESOURCES The request could not be completed\r
120 due to a lack of resources.\r
121 @retval EFI_TIMEOUT The SMBus slave device did not respond.\r
122 @retval EFI_DEVICE_ERROR The request was not completed because the transaction failed.\r
878ddf1f 123\r
124**/\r
125typedef\r
126EFI_STATUS\r
127(EFIAPI *EFI_SMBUS_HC_PROTOCOL_ARP_DEVICE) (\r
128 IN EFI_SMBUS_HC_PROTOCOL *This,\r
129 IN BOOLEAN ArpAll,\r
130 IN EFI_SMBUS_UDID *SmbusUdid, OPTIONAL\r
131 IN OUT EFI_SMBUS_DEVICE_ADDRESS *SlaveAddress OPTIONAL\r
132 );\r
133\r
134typedef struct {\r
135 EFI_SMBUS_DEVICE_ADDRESS SmbusDeviceAddress;\r
136 EFI_SMBUS_UDID SmbusDeviceUdid;\r
137} EFI_SMBUS_DEVICE_MAP;\r
138\r
139/**\r
140 The GetArpMap() function returns the mapping of all the SMBus devices \r
141 that are enumerated by the SMBus host driver. \r
142\r
0647c9ad
LG
143 @param This A pointer to the EFI_SMBUS_HC_PROTOCOL instance.\r
144 @param Length Size of the buffer that contains the SMBus device map.\r
145 @param SmbusDeviceMap The pointer to the device map as enumerated\r
146 by the SMBus controller driver.\r
878ddf1f 147\r
0647c9ad 148 @retval EFI_SUCCESS The device map was returned correctly in the buffer.\r
878ddf1f 149\r
150**/\r
151typedef\r
152EFI_STATUS\r
153(EFIAPI *EFI_SMBUS_HC_PROTOCOL_GET_ARP_MAP) (\r
154 IN EFI_SMBUS_HC_PROTOCOL *This,\r
155 IN OUT UINTN *Length,\r
156 IN OUT EFI_SMBUS_DEVICE_MAP **SmbusDeviceMap\r
157 );\r
158\r
159/**\r
160 The Notify() function registers all the callback functions to allow the \r
161 bus driver to call these functions when the SlaveAddress/Data pair happens.\r
162\r
0647c9ad
LG
163 @param This A pointer to the EFI_SMBUS_HC_PROTOCOL instance.\r
164 @param SlaveAddress Address that the host controller detects as\r
165 sending a message and calls all the registered functions.\r
166 @param Data Data that the host controller detects as sending a message\r
167 and calls all the registered functions.\r
168 @param NotifyFunction The function to call when the bus driver\r
169 detects the SlaveAddress and Data pair.\r
170\r
171 @retval EFI_SUCCESS NotifyFunction was registered.\r
878ddf1f 172\r
173**/\r
174typedef\r
175EFI_STATUS\r
176(EFIAPI *EFI_SMBUS_HC_PROTOCOL_NOTIFY) (\r
177 IN EFI_SMBUS_HC_PROTOCOL *This,\r
178 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r
179 IN UINTN Data,\r
180 IN EFI_SMBUS_NOTIFY_FUNCTION NotifyFunction\r
181 );\r
182\r
183/**\r
184 @par Protocol Description:\r
185 Provides basic SMBus host controller management and basic data \r
186 transactions over the SMBus.\r
187\r
188 @param Execute\r
189 Executes the SMBus operation to an SMBus slave device.\r
190\r
191 @param ArpDevice\r
192 Allows an SMBus 2.0 device(s) to be Address Resolution Protocol (ARP)\r
193\r
194 @param GetArpMap\r
195 Allows a driver to retrieve the address that was allocated by the SMBus \r
196 host controller during enumeration/ARP.\r
197\r
198 @param Notify\r
199 Allows a driver to register for a callback to the SMBus host \r
200 controller driver when the bus issues a notification to the bus controller driver.\r
201\r
202**/\r
203struct _EFI_SMBUS_HC_PROTOCOL {\r
204 EFI_SMBUS_HC_EXECUTE_OPERATION Execute;\r
205 EFI_SMBUS_HC_PROTOCOL_ARP_DEVICE ArpDevice;\r
206 EFI_SMBUS_HC_PROTOCOL_GET_ARP_MAP GetArpMap;\r
207 EFI_SMBUS_HC_PROTOCOL_NOTIFY Notify;\r
208};\r
209\r
210extern EFI_GUID gEfiSmbusProtocolGuid;\r
211#endif\r