]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkPkg/Include/Ppi/Smbus.h
Committing changes to the comments, after review with engineers.
[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 - 2009, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. 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 interpretation is
41 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 required
45 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 slave device.
48
49 @retval EFI_SUCCESS The last data that was returned from the access
50 matched the poll exit criteria.
51 @retval EFI_CRC_ERROR The checksum is not correct (PEC is incorrect).
52 @retval EFI_TIMEOUT Timeout expired before the operation was completed.
53 Timeout is determined by the SMBus host controller device.
54 @retval EFI_OUT_OF_RESOURCES The request could not be completed
55 due to a lack of resources.
56 @retval EFI_DEVICE_ERROR The request was not completed because
57 a failure was recorded in the Host Status Register bit.
58 @retval EFI_INVALID_PARAMETER Operation is not defined in EFI_SMBUS_OPERATION.
59 @retval EFI_INVALID_PARAMETER Length/Buffer is NULL for operations except for EfiSmbusQuickRead and
60 EfiSmbusQuickWrite. Length is outside the range of valid values.
61 @retval EFI_UNSUPPORTED The SMBus operation or PEC is not supported.
62 @retval EFI_BUFFER_TOO_SMALL Buffer is not sufficient for this operation.
63
64 **/
65 typedef
66 EFI_STATUS
67 (EFIAPI *EFI_PEI_SMBUS_PPI_EXECUTE_OPERATION)(
68 IN EFI_PEI_SERVICES **PeiServices,
69 IN EFI_PEI_SMBUS_PPI *This,
70 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
71 IN EFI_SMBUS_DEVICE_COMMAND Command,
72 IN EFI_SMBUS_OPERATION Operation,
73 IN BOOLEAN PecCheck,
74 IN OUT UINTN *Length,
75 IN OUT VOID *Buffer
76 );
77
78 /**
79 This function is user-defined, and is called when the SlaveAddress/Data pair happens.
80
81 @param[in] PeiServices A pointer to the system PEI Services Table.
82 @param[in] This A pointer to the EFI_PEI_SMBUS_PPI instance.
83 @param[in] SlaveAddress The SMBUS hardware address to which the SMBUS
84 device is preassigned or allocated.
85 @param[in] Data Data of the SMBus host notify command, which denotes that
86 the caller wants to be called.
87
88 @return Status Code returned by callback function.
89
90 **/
91 typedef
92 EFI_STATUS
93 (EFIAPI *EFI_PEI_SMBUS_NOTIFY_FUNCTION)(
94 IN EFI_PEI_SERVICES **PeiServices,
95 IN EFI_PEI_SMBUS_PPI *SmbusPpi,
96 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
97 IN UINTN Data
98 );
99
100 /**
101 The ArpDevice() function enumerates either the entire bus or a specific
102 device identified by SmbusUdid.
103
104 @param[in] PeiServices A pointer to the system PEI Services Table.
105 @param[in] This A pointer to the EFI_PEI_SMBUS_PPI instance.
106 @param[in] ArpAll A Boolean expression that indicates if the host drivers need
107 to enumerate all the devices or enumerate only the device that is identified
108 by SmbusUdid. If ArpAll is TRUE, SmbusUdid and SlaveAddress are optional and ignored if entered.
109 If ArpAll is FALSE, ArpDevice will enumerate SmbusUdid and the address
110 will be at SlaveAddress.
111 @param[in] SmbusUdid The targeted SMBus Unique Device Identifier (UDID).
112 The UDID may not exist for SMBus devices with fixed addresses.
113 @param[in, out] SlaveAddress The new SMBus address for the slave device for
114 which the operation is targeted.
115 This address may be NULL.
116
117 @retval EFI_SUCCESS The SMBus slave device address was set.
118 @retval EFI_INVALID_PARAMETER SlaveAddress is NULL.
119 @retval EFI_OUT_OF_RESOURCES The request could not be completed
120 due to a lack of resources.
121 @retval EFI_TIMEOUT The SMBus slave device did not respond.
122 @retval EFI_DEVICE_ERROR The request was not completed because the transaction failed.
123 @retval EFI_UNSUPPORTED ArpDevice() is not implemented by this PEIM.
124 This return value is not defined in Framwork Specification.
125 This return value was introduced in the PI Specification.
126
127 **/
128 typedef
129 EFI_STATUS
130 (EFIAPI *EFI_PEI_SMBUS_PPI_ARP_DEVICE)(
131 IN EFI_PEI_SERVICES **PeiServices,
132 IN EFI_PEI_SMBUS_PPI *This,
133 IN BOOLEAN ArpAll,
134 IN EFI_SMBUS_UDID *SmbusUdid, OPTIONAL
135 IN OUT EFI_SMBUS_DEVICE_ADDRESS *SlaveAddress OPTIONAL
136 );
137
138 /**
139 The GetArpMap() function returns the mapping of all the SMBus devices
140 that are enumerated by the SMBus host driver.
141
142 @param[in] PeiServices A pointer to the system PEI Services Table.
143 @param[in] This A pointer to the EFI_PEI_SMBUS_PPI instance.
144 @param[in, out] Length Size of the buffer that contains the SMBus device map.
145 @param[in, out] SmbusDeviceMap The pointer to the device map as enumerated
146 by the SMBus controller driver.
147
148 @retval EFI_SUCCESS The device map was returned correctly in the buffer.
149 @retval EFI_UNSUPPORTED GetArpMap() are not implemented by this PEIM.
150 This return value was not defined in Framwork Specification.
151 This return value was introduced in the PI Specification.
152
153 **/
154 typedef
155 EFI_STATUS
156 (EFIAPI *EFI_PEI_SMBUS_PPI_GET_ARP_MAP)(
157 IN EFI_PEI_SERVICES **PeiServices,
158 IN EFI_PEI_SMBUS_PPI *This,
159 IN OUT UINTN *Length,
160 IN OUT EFI_SMBUS_DEVICE_MAP **SmbusDeviceMap
161 );
162
163 /**
164 Allows a device driver to register for a callback when the bus driver detects a state that it needs to
165 propagate to other PEIMs that are registered for a callback.
166
167 The Notify() function registers all the callback functions to allow the
168 bus driver to call these functions when the SlaveAddress/Data pair happens.
169 All functions to be registered with EFI_PEI_SMBUS_PPI_NOTIFY must be of type
170 EFI_PEI_SMBUS_NOTIFY_FUNCTION.
171
172 @param[in] PeiServices A pointer to the system PEI Services Table.
173 @param[in] This A pointer to the EFI_PEI_SMBUS_PPI instance.
174 @param[in] SlaveAddress Address that the host controller detects as
175 sending a message and triggers all the registered functions.
176 @param[in] Data Data that the host controller detects as sending a message
177 and triggers all the registered functions.
178 @param[in] NotifyFunction The function to call when the bus driver
179 detects the SlaveAddress and Data pair.
180
181 @retval EFI_SUCCESS NotifyFunction has been registered.
182 @retval EFI_UNSUPPORTED Notify() are not implemented by this PEIM.
183 This return value is not defined in Framwork Specification.
184 This return value was introduced in the PI Specification.
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 /// Provides the basic I/O interfaces that a PEIM uses to access
199 /// its SMBus controller and the slave devices attached to it.
200 ///
201 struct _EFI_PEI_SMBUS_PPI {
202 ///
203 /// Executes the SMBus operation to an SMBus slave device.
204 ///
205 EFI_PEI_SMBUS_PPI_EXECUTE_OPERATION Execute;
206
207 ///
208 /// Allows an SMBus 2.0 device(s) to be Address Resolution Protocol (ARP)
209 ///
210 EFI_PEI_SMBUS_PPI_ARP_DEVICE ArpDevice;
211
212 ///
213 /// Allows a PEIM to retrieve the address that was allocated by the SMBus
214 /// host controller during enumeration/ARP.
215 ///
216 EFI_PEI_SMBUS_PPI_GET_ARP_MAP GetArpMap;
217
218 ///
219 /// Allows a driver to register for a callback to the SMBus host
220 /// controller driver when the bus issues a notification to the bus controller PEIM.
221 ///
222 EFI_PEI_SMBUS_PPI_NOTIFY Notify;
223 };
224
225 extern EFI_GUID gEfiPeiSmbusPpiGuid;
226
227 #endif