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