]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkPkg/Include/Ppi/Smbus.h
IntelFrameworkPkg: Clean up source files
[mirror_edk2.git] / IntelFrameworkPkg / Include / Ppi / Smbus.h
1 /** @file
2 This file declares the Smbus PPI, which provides the basic I/O interfaces that a PEIM
3 uses to access its SMBus controller and the slave devices attached to it.
4
5 Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials are licensed and made available under
7 the terms and conditions of the BSD License that accompanies this distribution.
8 The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php.
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14 @par Revision Reference:
15 This PPI is defined in Framework of EFI SmBus PPI spec.
16 Version 0.9.
17
18 **/
19
20 #ifndef _PEI_SMBUS_PPI_H_
21 #define _PEI_SMBUS_PPI_H_
22
23 #include <Ppi/Smbus2.h>
24
25 #define EFI_PEI_SMBUS_PPI_GUID \
26 { \
27 0xabd42895, 0x78cf, 0x4872, {0x84, 0x44, 0x1b, 0x5c, 0x18, 0xb, 0xfb, 0xda } \
28 }
29
30 typedef struct _EFI_PEI_SMBUS_PPI EFI_PEI_SMBUS_PPI;
31
32 /**
33 Executes an SMBus operation to an SMBus controller.
34
35 @param[in] PeiServices A pointer to the system PEI Services Table.
36 @param[in] This A pointer to the EFI_PEI_SMBUS_PPI instance.
37 @param[in] SlaveAddress The SMBUS hardware address to which the SMBUS
38 device is preassigned or allocated.
39 @param[in] Command This command is transmitted by the SMBus host
40 controller to the SMBus slave device, and the
41 interpretation is SMBus slave device specific.
42 @param[in] Operation Signifies which particular SMBus hardware protocol
43 instance to use to execute the SMBus transactions.
44 @param[in] PecCheck Defines if Packet Error Code (PEC) checking is
45 required for this operation.
46 @param[in, out] Length The number of bytes for this operation.
47 @param[in, out] Buffer Contains the value of data to execute to the SMBus
48 slave device.
49
50 @retval EFI_SUCCESS The last data that was returned from the access
51 matched the poll exit criteria.
52 @retval EFI_CRC_ERROR The checksum is not correct (PEC is incorrect).
53 @retval EFI_TIMEOUT Timeout expired before the operation was completed.
54 Timeout is determined by the SMBus host controller device.
55 @retval EFI_OUT_OF_RESOURCES The request could not be completed
56 due to a lack of resources.
57 @retval EFI_DEVICE_ERROR The request was not completed because a failure
58 was recorded in the Host Status Register bit.
59 @retval EFI_INVALID_PARAMETER The operation is not defined in EFI_SMBUS_OPERATION.
60 @retval EFI_INVALID_PARAMETER Length/Buffer is NULL for operations except for
61 EfiSmbusQuickRead and EfiSmbusQuickWrite. Length
62 is outside the range of valid values.
63 @retval EFI_UNSUPPORTED The SMBus operation or PEC is not supported.
64 @retval EFI_BUFFER_TOO_SMALL Buffer is not sufficient for this operation.
65
66 **/
67 typedef
68 EFI_STATUS
69 (EFIAPI *EFI_PEI_SMBUS_PPI_EXECUTE_OPERATION)(
70 IN EFI_PEI_SERVICES **PeiServices,
71 IN EFI_PEI_SMBUS_PPI *This,
72 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
73 IN EFI_SMBUS_DEVICE_COMMAND Command,
74 IN EFI_SMBUS_OPERATION Operation,
75 IN BOOLEAN PecCheck,
76 IN OUT UINTN *Length,
77 IN OUT VOID *Buffer
78 );
79
80 /**
81 This function is user-defined, and is called when the SlaveAddress/Data pair happens.
82
83 @param[in] PeiServices A pointer to the system PEI Services Table.
84 @param[in] This A pointer to the EFI_PEI_SMBUS_PPI instance.
85 @param[in] SlaveAddress The SMBUS hardware address to which the SMBUS
86 device is preassigned or allocated.
87 @param[in] Data Data of the SMBus host notify command, which denotes that
88 the caller wants to be called.
89
90 @return Status Code returned by callback function.
91
92 **/
93 typedef
94 EFI_STATUS
95 (EFIAPI *EFI_PEI_SMBUS_NOTIFY_FUNCTION)(
96 IN EFI_PEI_SERVICES **PeiServices,
97 IN EFI_PEI_SMBUS_PPI *SmbusPpi,
98 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
99 IN UINTN Data
100 );
101
102 /**
103 The ArpDevice() function enumerates either the entire bus or a specific
104 device identified by SmbusUdid.
105
106 @param[in] PeiServices A pointer to the system PEI Services Table.
107 @param[in] This A pointer to the EFI_PEI_SMBUS_PPI instance.
108 @param[in] ArpAll A Boolean expression that indicates if the host
109 drivers need to enumerate all the devices or to
110 enumerate only the device that is identified
111 by SmbusUdid. If ArpAll is TRUE, SmbusUdid and
112 SlaveAddress are optional and ignored if entered.
113 If ArpAll is FALSE, ArpDevice will enumerate
114 SmbusUdid, and the address will be at SlaveAddress.
115 @param[in] SmbusUdid The targeted SMBus Unique Device Identifier (UDID).
116 The UDID may not exist for SMBus devices with fixed
117 addresses.
118 @param[in, out] SlaveAddress The new SMBus address for the slave device for
119 which the operation is targeted.
120 This address may be NULL.
121
122 @retval EFI_SUCCESS The SMBus slave device address was set.
123 @retval EFI_INVALID_PARAMETER SlaveAddress is NULL.
124 @retval EFI_OUT_OF_RESOURCES The request could not be completed
125 due to a lack of resources.
126 @retval EFI_TIMEOUT The SMBus slave device did not respond.
127 @retval EFI_DEVICE_ERROR The request was not completed because the transaction failed.
128 @retval EFI_UNSUPPORTED ArpDevice() is not implemented by this PEIM.
129 This return value is not defined in the Framework Specification.
130 This return value was introduced in the PI Specification.
131
132 **/
133 typedef
134 EFI_STATUS
135 (EFIAPI *EFI_PEI_SMBUS_PPI_ARP_DEVICE)(
136 IN EFI_PEI_SERVICES **PeiServices,
137 IN EFI_PEI_SMBUS_PPI *This,
138 IN BOOLEAN ArpAll,
139 IN EFI_SMBUS_UDID *SmbusUdid, OPTIONAL
140 IN OUT EFI_SMBUS_DEVICE_ADDRESS *SlaveAddress OPTIONAL
141 );
142
143 /**
144 The GetArpMap() function returns the mapping of all the SMBus devices
145 that are enumerated by the SMBus host driver.
146
147 @param[in] PeiServices A pointer to the system PEI Services Table.
148 @param[in] This A pointer to the EFI_PEI_SMBUS_PPI instance.
149 @param[in, out] Length The size of the buffer that contains the SMBus device map.
150 @param[in, out] SmbusDeviceMap The pointer to the device map as enumerated
151 by the SMBus controller driver.
152
153 @retval EFI_SUCCESS The device map was returned correctly in the buffer.
154 @retval EFI_UNSUPPORTED GetArpMap() are not implemented by this PEIM.
155 This return value was not defined in the Framework Specification.
156 This return value was introduced in the PI Specification.
157
158 **/
159 typedef
160 EFI_STATUS
161 (EFIAPI *EFI_PEI_SMBUS_PPI_GET_ARP_MAP)(
162 IN EFI_PEI_SERVICES **PeiServices,
163 IN EFI_PEI_SMBUS_PPI *This,
164 IN OUT UINTN *Length,
165 IN OUT EFI_SMBUS_DEVICE_MAP **SmbusDeviceMap
166 );
167
168 /**
169 Allows a device driver to register for a callback when the bus driver detects a state that it needs to
170 propagate to other PEIMs that are registered for a callback.
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 occur.
174 All functions to be registered with EFI_PEI_SMBUS_PPI_NOTIFY must be of type
175 EFI_PEI_SMBUS_NOTIFY_FUNCTION.
176
177 @param[in] PeiServices A pointer to the system PEI Services Table.
178 @param[in] This A pointer to the EFI_PEI_SMBUS_PPI instance.
179 @param[in] SlaveAddress The address that the host controller detects as
180 sending a message and triggers all the registered functions.
181 @param[in] Data Data that the host controller detects as sending a message
182 and triggers all the registered functions.
183 @param[in] NotifyFunction The function to call when the bus driver
184 detects the SlaveAddress and Data pair.
185
186 @retval EFI_SUCCESS NotifyFunction has been registered.
187 @retval EFI_UNSUPPORTED Notify() are not implemented by this PEIM.
188 This return value is not defined in the Framework Specification.
189 This return value was introduced in the PI Specification.
190
191 **/
192 typedef
193 EFI_STATUS
194 (EFIAPI *EFI_PEI_SMBUS_PPI_NOTIFY)(
195 IN EFI_PEI_SERVICES **PeiServices,
196 IN EFI_PEI_SMBUS_PPI *This,
197 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
198 IN UINTN Data,
199 IN EFI_PEI_SMBUS_NOTIFY_FUNCTION NotifyFunction
200 );
201
202 ///
203 /// Provides the basic I/O interfaces that a PEIM uses to access
204 /// its SMBus controller and the slave devices attached to it.
205 ///
206 struct _EFI_PEI_SMBUS_PPI {
207 ///
208 /// Executes the SMBus operation to an SMBus slave device.
209 ///
210 EFI_PEI_SMBUS_PPI_EXECUTE_OPERATION Execute;
211
212 ///
213 /// Allows an SMBus 2.0 device(s) to be Address Resolution Protocol (ARP)
214 ///
215 EFI_PEI_SMBUS_PPI_ARP_DEVICE ArpDevice;
216
217 ///
218 /// Allows a PEIM to retrieve the address that was allocated by the SMBus
219 /// host controller during enumeration/ARP.
220 ///
221 EFI_PEI_SMBUS_PPI_GET_ARP_MAP GetArpMap;
222
223 ///
224 /// Allows a driver to register for a callback to the SMBus host
225 /// controller driver when the bus issues a notification to the bus controller PEIM.
226 ///
227 EFI_PEI_SMBUS_PPI_NOTIFY Notify;
228 };
229
230 extern EFI_GUID gEfiPeiSmbusPpiGuid;
231
232 #endif