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