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