]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Ppi/Smbus.h
automagically convert ELF to PE/COFF (i386 only)
[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 @param This A pointer to the EFI_PEI_SMBUS_PPI instance.
36 @param SlaveAddress The SMBUS hardware address to which the SMBUS
37 device is preassigned or allocated.
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_PEI_SMBUS_PPI_EXECUTE_OPERATION) (
67 IN EFI_PEI_SERVICES **PeiServices,
68 IN EFI_PEI_SMBUS_PPI *This,
69 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
70 IN EFI_SMBUS_DEVICE_COMMAND Command,
71 IN EFI_SMBUS_OPERATION Operation,
72 IN BOOLEAN PecCheck,
73 IN OUT UINTN *Length,
74 IN OUT VOID *Buffer
75 );
76
77 typedef struct {
78 UINT32 VendorSpecificId;
79 UINT16 SubsystemDeviceId;
80 UINT16 SubsystemVendorId;
81 UINT16 Interface;
82 UINT16 DeviceId;
83 UINT16 VendorId;
84 UINT8 VendorRevision;
85 UINT8 DeviceCapabilities;
86 } EFI_SMBUS_UDID;
87
88 /**
89 CallBack function can be registered in EFI_PEI_SMBUS_PPI_NOTIFY.
90
91 @param PeiServices A pointer to the system PEI Services Table.
92 @param This A pointer to the EFI_PEI_SMBUS_PPI instance.
93 @param SlaveAddress The SMBUS hardware address to which the SMBUS
94 device is preassigned or allocated.
95 @param Data Data of the SMBus host notify command that
96 the caller wants to be called.
97
98 @return Status Code
99
100 **/
101 typedef
102 EFI_STATUS
103 (EFIAPI *EFI_PEI_SMBUS_NOTIFY_FUNCTION) (
104 IN EFI_PEI_SERVICES **PeiServices,
105 IN EFI_PEI_SMBUS_PPI *SmbusPpi,
106 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
107 IN UINTN Data
108 );
109
110 /**
111 The ArpDevice() function enumerates the entire bus or enumerates a specific
112 device that is identified by SmbusUdid.
113
114 @param PeiServices A pointer to the system PEI Services Table.
115 @param This A pointer to the EFI_PEI_SMBUS_PPI instance.
116 @param ArpAll A Boolean expression that indicates if the host drivers need
117 to enumerate all the devices or enumerate only the device that is identified
118 by SmbusUdid. If ArpAll is TRUE, SmbusUdid and SlaveAddress are optional.
119 If ArpAll is FALSE, ArpDevice will enumerate SmbusUdid and the address
120 will be at SlaveAddress.
121 @param SmbusUdid The targeted SMBus Unique Device Identifier (UDID).
122 The UDID may not exist for SMBus devices with fixed addresses.
123 @param SlaveAddress The new SMBus address for the slave device for
124 which the operation is targeted.
125
126 @retval EFI_SUCCESS The SMBus slave device address was set.
127 @retval EFI_INVALID_PARAMETER SlaveAddress is NULL.
128 @retval EFI_OUT_OF_RESOURCES The request could not be completed
129 due to a lack of resources.
130 @retval EFI_TIMEOUT The SMBus slave device did not respond.
131 @retval EFI_DEVICE_ERROR The request was not completed because the transaction failed.
132
133 **/
134 typedef
135 EFI_STATUS
136 (EFIAPI *EFI_PEI_SMBUS_PPI_ARP_DEVICE) (
137 IN EFI_PEI_SERVICES **PeiServices,
138 IN EFI_PEI_SMBUS_PPI *This,
139 IN BOOLEAN ArpAll,
140 IN EFI_SMBUS_UDID *SmbusUdid, OPTIONAL
141 IN OUT EFI_SMBUS_DEVICE_ADDRESS *SlaveAddress OPTIONAL
142 );
143
144 typedef struct {
145 EFI_SMBUS_DEVICE_ADDRESS SmbusDeviceAddress;
146 EFI_SMBUS_UDID SmbusDeviceUdid;
147 } EFI_SMBUS_DEVICE_MAP;
148
149 /**
150 The GetArpMap() function returns the mapping of all the SMBus devices
151 that are enumerated by the SMBus host driver.
152
153 @param PeiServices A pointer to the system PEI Services Table.
154 @param This A pointer to the EFI_PEI_SMBUS_PPI instance.
155 @param Length Size of the buffer that contains the SMBus device map.
156 @param SmbusDeviceMap The pointer to the device map as enumerated
157 by the SMBus controller driver.
158
159 @retval EFI_SUCCESS The device map was returned correctly in the buffer.
160
161 **/
162 typedef
163 EFI_STATUS
164 (EFIAPI *EFI_PEI_SMBUS_PPI_GET_ARP_MAP) (
165 IN EFI_PEI_SERVICES **PeiServices,
166 IN EFI_PEI_SMBUS_PPI *This,
167 IN OUT UINTN *Length,
168 IN OUT EFI_SMBUS_DEVICE_MAP **SmbusDeviceMap
169 );
170
171 /**
172 The Notify() function registers all the callback functions to allow the
173 bus driver to call these functions when the SlaveAddress/Data pair happens.
174
175 @param PeiServices A pointer to the system PEI Services Table.
176 @param This A pointer to the EFI_PEI_SMBUS_PPI instance.
177 @param SlaveAddress Address that the host controller detects as
178 sending a message and calls all the registered functions.
179 @param Data Data that the host controller detects as sending a message
180 and calls all the registered functions.
181 @param NotifyFunction The function to call when the bus driver
182 detects the SlaveAddress and Data pair.
183
184 @retval EFI_SUCCESS NotifyFunction has been registered.
185
186 **/
187 typedef
188 EFI_STATUS
189 (EFIAPI *EFI_PEI_SMBUS_PPI_NOTIFY) (
190 IN EFI_PEI_SERVICES **PeiServices,
191 IN EFI_PEI_SMBUS_PPI *This,
192 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
193 IN UINTN Data,
194 IN EFI_PEI_SMBUS_NOTIFY_FUNCTION NotifyFunction
195 );
196
197 /**
198 @par Ppi Description:
199 Provides the basic I/O interfaces that a PEIM uses to access
200 its SMBus controller and the slave devices attached to it.
201
202 @param Execute
203 Executes the SMBus operation to an SMBus slave device.
204
205 @param ArpDevice
206 Allows an SMBus 2.0 device(s) to be Address Resolution Protocol (ARP)
207
208 @param GetArpMap
209 Allows a PEIM to retrieve the address that was allocated by the SMBus
210 host controller during enumeration/ARP.
211
212 @param Notify
213 Allows a driver to register for a callback to the SMBus host
214 controller driver when the bus issues a notification to the bus controller PEIM.
215
216 **/
217 struct _EFI_PEI_SMBUS_PPI {
218 EFI_PEI_SMBUS_PPI_EXECUTE_OPERATION Execute;
219 EFI_PEI_SMBUS_PPI_ARP_DEVICE ArpDevice;
220 EFI_PEI_SMBUS_PPI_GET_ARP_MAP GetArpMap;
221 EFI_PEI_SMBUS_PPI_NOTIFY Notify;
222 };
223
224 extern EFI_GUID gEfiPeiSmbusPpiGuid;
225
226 #endif