]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Ppi/Smbus.h
Initial import.
[mirror_edk2.git] / MdePkg / Include / Ppi / Smbus.h
1 /** @file
2 This file declares Smbus PPI.
3
4 Copyright (c) 2006, 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 PPI is defined in Framework of EFI SmBus PPI spec.
17 Version 0.9
18
19 **/
20
21 #ifndef _PEI_SMBUS_PPI_H
22 #define _PEI_SMBUS_PPI_H
23
24 #define EFI_PEI_SMBUS_PPI_GUID \
25 { \
26 0xabd42895, 0x78cf, 0x4872, {0x84, 0x44, 0x1b, 0x5c, 0x18, 0xb, 0xfb, 0xda } \
27 }
28
29 typedef struct _EFI_PEI_SMBUS_PPI EFI_PEI_SMBUS_PPI;
30
31 /**
32 Executes an SMBus operation to an SMBus controller.
33
34 @param PeiServices A pointer to the system PEI Services Table.
35
36 @param This A pointer to the EFI_PEI_SMBUS_PPI instance.
37
38 @param SlaveAddress The SMBUS hardware address to which the SMBUS
39 device is preassigned or allocated.
40
41 @param Command This command is transmitted by the SMBus host
42 controller to the SMBus slave device and the interpretation is
43 SMBus slave device specific.
44
45 @param Operation Signifies which particular SMBus hardware protocol
46 instance that it will use to execute the SMBus transactions.
47
48 @param PecCheck Defines if Packet Error Code (PEC) checking is required
49 for this operation.
50
51 @param Length Signifies the number of bytes that this operation will do.
52
53 @param Buffer Contains the value of data to execute to the SMBus slave device.
54
55 @retval EFI_SUCCESS The last data that was returned from the access
56 matched the poll exit criteria.
57
58 @retval EFI_CRC_ERROR The checksum is not correct (PEC is incorrect)
59
60 @retval EFI_TIMEOUT Timeout expired before the operation was completed.
61 Timeout is determined by the SMBus host controller device.
62
63 @retval EFI_OUT_OF_RESOURCES The request could not be completed
64 due to a lack of resources.
65
66 @retval EFI_DEVICE_ERROR The request was not completed because
67 a failure reflected in the Host Status Register bit.
68
69 @retval EFI_INVALID_PARAMETER Operation is not defined in EFI_SMBUS_OPERATION.
70 Or Length/Buffer is NULL for operations except for EfiSmbusQuickRead and
71 EfiSmbusQuickWrite. Length is outside the range of valid values.
72
73 @retval EFI_UNSUPPORTED The SMBus operation or PEC is not supported.
74
75 @retval EFI_BUFFER_TOO_SMALL Buffer is not sufficient for this operation.
76
77 **/
78 typedef
79 EFI_STATUS
80 (EFIAPI *EFI_PEI_SMBUS_PPI_EXECUTE_OPERATION) (
81 IN EFI_PEI_SERVICES **PeiServices,
82 IN EFI_PEI_SMBUS_PPI *This,
83 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
84 IN EFI_SMBUS_DEVICE_COMMAND Command,
85 IN EFI_SMBUS_OPERATION Operation,
86 IN BOOLEAN PecCheck,
87 IN OUT UINTN *Length,
88 IN OUT VOID *Buffer
89 );
90
91 typedef struct {
92 UINT32 VendorSpecificId;
93 UINT16 SubsystemDeviceId;
94 UINT16 SubsystemVendorId;
95 UINT16 Interface;
96 UINT16 DeviceId;
97 UINT16 VendorId;
98 UINT8 VendorRevision;
99 UINT8 DeviceCapabilities;
100 } EFI_SMBUS_UDID;
101
102 /**
103 CallBack function can be registered in EFI_PEI_SMBUS_PPI_NOTIFY.
104
105 @param PeiServices A pointer to the system PEI Services Table.
106
107 @param This A pointer to the EFI_PEI_SMBUS_PPI instance.
108
109 @param SlaveAddress The SMBUS hardware address to which the SMBUS
110 device is preassigned or allocated.
111
112 @param Data Data of the SMBus host notify command that
113 the caller wants to be called.
114
115 @return Status Code
116
117 **/
118 typedef
119 EFI_STATUS
120 (EFIAPI *EFI_PEI_SMBUS_NOTIFY_FUNCTION) (
121 IN EFI_PEI_SERVICES **PeiServices,
122 IN EFI_PEI_SMBUS_PPI *SmbusPpi,
123 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
124 IN UINTN Data
125 );
126
127 /**
128 The ArpDevice() function enumerates the entire bus or enumerates a specific
129 device that is identified by SmbusUdid.
130
131 @param PeiServices A pointer to the system PEI Services Table.
132
133 @param This A pointer to the EFI_PEI_SMBUS_PPI instance.
134
135 @param ArpAll A Boolean expression that indicates if the host drivers need
136 to enumerate all the devices or enumerate only the device that is identified
137 by SmbusUdid. If ArpAll is TRUE, SmbusUdid and SlaveAddress are optional.
138 If ArpAll is FALSE, ArpDevice will enumerate SmbusUdid and the address
139 will be at SlaveAddress.
140
141 @param SmbusUdid The targeted SMBus Unique Device Identifier (UDID).
142 The UDID may not exist for SMBus devices with fixed addresses.
143
144 @param SlaveAddress The new SMBus address for the slave device for
145 which the operation is targeted.
146
147 @retval EFI_SUCCESS The SMBus slave device address was set.
148
149 @retval EFI_INVALID_PARAMETER SlaveAddress is NULL.
150
151 @retval EFI_OUT_OF_RESOURCES The request could not be completed
152 due to a lack of resources.
153
154 @retval EFI_TIMEOUT The SMBus slave device did not respond.
155
156 @retval EFI_DEVICE_ERROR The request was not completed because the transaction failed.
157
158 **/
159 typedef
160 EFI_STATUS
161 (EFIAPI *EFI_PEI_SMBUS_PPI_ARP_DEVICE) (
162 IN EFI_PEI_SERVICES **PeiServices,
163 IN EFI_PEI_SMBUS_PPI *This,
164 IN BOOLEAN ArpAll,
165 IN EFI_SMBUS_UDID *SmbusUdid, OPTIONAL
166 IN OUT EFI_SMBUS_DEVICE_ADDRESS *SlaveAddress OPTIONAL
167 );
168
169 typedef struct {
170 EFI_SMBUS_DEVICE_ADDRESS SmbusDeviceAddress;
171 EFI_SMBUS_UDID SmbusDeviceUdid;
172 } EFI_SMBUS_DEVICE_MAP;
173
174 /**
175 The GetArpMap() function returns the mapping of all the SMBus devices
176 that are enumerated by the SMBus host driver.
177
178 @param PeiServices A pointer to the system PEI Services Table.
179
180 @param This A pointer to the EFI_PEI_SMBUS_PPI instance.
181
182 @param Length Size of the buffer that contains the SMBus device map.
183
184 @param SmbusDeviceMap The pointer to the device map as enumerated
185 by the SMBus controller driver.
186
187 @retval EFI_SUCCESS The device map was returned correctly in the buffer.
188
189 **/
190 typedef
191 EFI_STATUS
192 (EFIAPI *EFI_PEI_SMBUS_PPI_GET_ARP_MAP) (
193 IN EFI_PEI_SERVICES **PeiServices,
194 IN EFI_PEI_SMBUS_PPI *This,
195 IN OUT UINTN *Length,
196 IN OUT EFI_SMBUS_DEVICE_MAP **SmbusDeviceMap
197 );
198
199 /**
200 The Notify() function registers all the callback functions to allow the
201 bus driver to call these functions when the SlaveAddress/Data pair happens.
202
203 @param PeiServices A pointer to the system PEI Services Table.
204
205 @param This A pointer to the EFI_PEI_SMBUS_PPI instance.
206
207 @param SlaveAddress Address that the host controller detects as
208 sending a message and calls all the registered functions.
209
210 @param Data Data that the host controller detects as sending a message
211 and calls all the registered functions.
212
213 @param NotifyFunction The function to call when the bus driver
214 detects the SlaveAddress and Data pair.
215
216 @retval EFI_SUCCESS NotifyFunction has been registered.
217
218 **/
219 typedef
220 EFI_STATUS
221 (EFIAPI *EFI_PEI_SMBUS_PPI_NOTIFY) (
222 IN EFI_PEI_SERVICES **PeiServices,
223 IN EFI_PEI_SMBUS_PPI *This,
224 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
225 IN UINTN Data,
226 IN EFI_PEI_SMBUS_NOTIFY_FUNCTION NotifyFunction
227 );
228
229 /**
230 @par Ppi Description:
231 Provides the basic I/O interfaces that a PEIM uses to access
232 its SMBus controller and the slave devices attached to it.
233
234 @param Execute
235 Executes the SMBus operation to an SMBus slave device.
236
237 @param ArpDevice
238 Allows an SMBus 2.0 device(s) to be Address Resolution Protocol (ARP)
239
240 @param GetArpMap
241 Allows a PEIM to retrieve the address that was allocated by the SMBus
242 host controller during enumeration/ARP.
243
244 @param Notify
245 Allows a driver to register for a callback to the SMBus host
246 controller driver when the bus issues a notification to the bus controller PEIM.
247
248 **/
249 struct _EFI_PEI_SMBUS_PPI {
250 EFI_PEI_SMBUS_PPI_EXECUTE_OPERATION Execute;
251 EFI_PEI_SMBUS_PPI_ARP_DEVICE ArpDevice;
252 EFI_PEI_SMBUS_PPI_GET_ARP_MAP GetArpMap;
253 EFI_PEI_SMBUS_PPI_NOTIFY Notify;
254 };
255
256 extern EFI_GUID gEfiPeiSmbusPpiGuid;
257
258 #endif