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