]>
Commit | Line | Data |
---|---|---|
79964ac8 | 1 | /** @file\r |
4a71b21a | 2 | This file declares 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 | |
79964ac8 | 4 | \r |
2bbaeb0d | 5 | Copyright (c) 2007 - 2009, Intel Corporation\r |
79964ac8 | 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 | |
79964ac8 | 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 | |
4ebb0d9e | 20 | #ifndef _PEI_SMBUS_PPI_H_\r |
21 | #define _PEI_SMBUS_PPI_H_\r | |
79964ac8 | 22 | \r |
3f3181b4 | 23 | #include <Ppi/Smbus2.h>\r |
79964ac8 | 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 | |
516e9f28 | 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 that it will 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 Signifies the number of bytes that this operation will do.\r | |
47 | @param[in, out] Buffer Contains the value of data to execute to the SMBus slave device.\r | |
79964ac8 | 48 | \r |
49 | @retval EFI_SUCCESS The last data that was returned from the access\r | |
50 | matched the poll exit criteria.\r | |
9ca1b12e | 51 | @retval EFI_CRC_ERROR The checksum is not correct (PEC is incorrect).\r |
79964ac8 | 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 reflected in the Host Status Register bit.\r | |
58 | @retval EFI_INVALID_PARAMETER Operation is not defined in EFI_SMBUS_OPERATION.\r | |
9ca1b12e | 59 | @retval EFI_INVALID_PARAMETER Length/Buffer is NULL for operations except for EfiSmbusQuickRead and\r |
79964ac8 | 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 | |
69686d56 | 67 | (EFIAPI *EFI_PEI_SMBUS_PPI_EXECUTE_OPERATION)(\r |
79964ac8 | 68 | IN EFI_PEI_SERVICES **PeiServices,\r |
700a7869 | 69 | IN EFI_PEI_SMBUS_PPI *This,\r |
79964ac8 | 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 | |
79964ac8 | 78 | /**\r |
79 | CallBack function can be registered in EFI_PEI_SMBUS_PPI_NOTIFY.\r | |
80 | \r | |
2a924b00 | 81 | This function is user-defined and will called when the SlaveAddress/Data pair happens.\r |
82 | \r | |
516e9f28 | 83 | @param[in] PeiServices A pointer to the system PEI Services Table.\r |
84 | @param[in] This A pointer to the EFI_PEI_SMBUS_PPI instance.\r | |
85 | @param[in] SlaveAddress The SMBUS hardware address to which the SMBUS\r | |
86 | device is preassigned or allocated.\r | |
87 | @param[in] Data Data of the SMBus host notify command that\r | |
88 | the caller wants to be called.\r | |
79964ac8 | 89 | \r |
9ca1b12e | 90 | @return Status Code returned by callback function.\r |
79964ac8 | 91 | \r |
92 | **/\r | |
93 | typedef\r | |
94 | EFI_STATUS\r | |
69686d56 | 95 | (EFIAPI *EFI_PEI_SMBUS_NOTIFY_FUNCTION)(\r |
79964ac8 | 96 | IN EFI_PEI_SERVICES **PeiServices,\r |
700a7869 | 97 | IN EFI_PEI_SMBUS_PPI *SmbusPpi,\r |
79964ac8 | 98 | IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r |
99 | IN UINTN Data\r | |
100 | );\r | |
101 | \r | |
102 | /**\r | |
103 | The ArpDevice() function enumerates the entire bus or enumerates a specific\r | |
104 | device that is identified by SmbusUdid.\r | |
105 | \r | |
516e9f28 | 106 | @param[in] PeiServices A pointer to the system PEI Services Table.\r |
107 | @param[in] This A pointer to the EFI_PEI_SMBUS_PPI instance.\r | |
108 | @param[in] ArpAll A Boolean expression that indicates if the host drivers need\r | |
109 | to enumerate all the devices or enumerate only the device that is identified\r | |
110 | by SmbusUdid. If ArpAll is TRUE, SmbusUdid and SlaveAddress are optional.\r | |
111 | If ArpAll is FALSE, ArpDevice will enumerate SmbusUdid and the address\r | |
112 | will be at SlaveAddress.\r | |
113 | @param[in] SmbusUdid The targeted SMBus Unique Device Identifier (UDID).\r | |
114 | The UDID may not exist for SMBus devices with fixed addresses.\r | |
115 | @param[in, out] SlaveAddress The new SMBus address for the slave device for\r | |
116 | which the operation is targeted.\r | |
2a924b00 | 117 | This address may be NULL.\r |
79964ac8 | 118 | \r |
119 | @retval EFI_SUCCESS The SMBus slave device address was set.\r | |
120 | @retval EFI_INVALID_PARAMETER SlaveAddress is NULL.\r | |
121 | @retval EFI_OUT_OF_RESOURCES The request could not be completed\r | |
122 | due to a lack of resources.\r | |
123 | @retval EFI_TIMEOUT The SMBus slave device did not respond.\r | |
124 | @retval EFI_DEVICE_ERROR The request was not completed because the transaction failed.\r | |
2a924b00 | 125 | @retval EFI_UNSUPPORTED ArpDevice() are not implemented by this PEIM. \r |
126 | This return value is not defined in Framwork Specification.\r | |
127 | This return value had been intruduced in PI Specification.\r | |
79964ac8 | 128 | \r |
129 | **/\r | |
130 | typedef\r | |
131 | EFI_STATUS\r | |
69686d56 | 132 | (EFIAPI *EFI_PEI_SMBUS_PPI_ARP_DEVICE)(\r |
79964ac8 | 133 | IN EFI_PEI_SERVICES **PeiServices,\r |
700a7869 | 134 | IN EFI_PEI_SMBUS_PPI *This,\r |
79964ac8 | 135 | IN BOOLEAN ArpAll,\r |
136 | IN EFI_SMBUS_UDID *SmbusUdid, OPTIONAL\r | |
137 | IN OUT EFI_SMBUS_DEVICE_ADDRESS *SlaveAddress OPTIONAL\r | |
138 | );\r | |
139 | \r | |
79964ac8 | 140 | /**\r |
141 | The GetArpMap() function returns the mapping of all the SMBus devices\r | |
142 | that are enumerated by the SMBus host driver.\r | |
143 | \r | |
516e9f28 | 144 | @param[in] PeiServices A pointer to the system PEI Services Table.\r |
145 | @param[in] This A pointer to the EFI_PEI_SMBUS_PPI instance.\r | |
146 | @param[in, out] Length Size of the buffer that contains the SMBus device map.\r | |
147 | @param[in, out] SmbusDeviceMap The pointer to the device map as enumerated\r | |
148 | by the SMBus controller driver.\r | |
79964ac8 | 149 | \r |
2a924b00 | 150 | @retval EFI_SUCCESS The device map was returned correctly in the buffer.\r |
151 | @retval EFI_UNSUPPORTED GetArpMap() are not implemented by this PEIM. \r | |
152 | This return value was not defined in Framwork Specification.\r | |
153 | This return value had been intruduced in PI Specification.\r | |
79964ac8 | 154 | \r |
155 | **/\r | |
156 | typedef\r | |
157 | EFI_STATUS\r | |
69686d56 | 158 | (EFIAPI *EFI_PEI_SMBUS_PPI_GET_ARP_MAP)(\r |
79964ac8 | 159 | IN EFI_PEI_SERVICES **PeiServices,\r |
700a7869 | 160 | IN EFI_PEI_SMBUS_PPI *This,\r |
79964ac8 | 161 | IN OUT UINTN *Length,\r |
162 | IN OUT EFI_SMBUS_DEVICE_MAP **SmbusDeviceMap\r | |
163 | );\r | |
164 | \r | |
165 | /**\r | |
9ca1b12e | 166 | Allows a device driver to register for a callback when the bus driver detects a state that it needs to \r |
167 | propagate to other PEIMs that are registered for a callback.\r | |
168 | \r | |
79964ac8 | 169 | The Notify() function registers all the callback functions to allow the\r |
170 | bus driver to call these functions when the SlaveAddress/Data pair happens.\r | |
2a924b00 | 171 | All functions to be registered with EFI_PEI_SMBUS_PPI_NOTIFY must be of type\r |
172 | EFI_PEI_SMBUS_NOTIFY_FUNCTION.\r | |
79964ac8 | 173 | \r |
516e9f28 | 174 | @param[in] PeiServices A pointer to the system PEI Services Table.\r |
175 | @param[in] This A pointer to the EFI_PEI_SMBUS_PPI instance.\r | |
176 | @param[in] SlaveAddress Address that the host controller detects as\r | |
177 | sending a message and calls all the registered functions.\r | |
178 | @param[in] Data Data that the host controller detects as sending a message\r | |
179 | and calls all the registered functions.\r | |
180 | @param[in] NotifyFunction The function to call when the bus driver\r | |
181 | detects the SlaveAddress and Data pair.\r | |
79964ac8 | 182 | \r |
516e9f28 | 183 | @retval EFI_SUCCESS NotifyFunction has been registered.\r |
2a924b00 | 184 | @retval EFI_UNSUPPORTED Notify() are not implemented by this PEIM. \r |
185 | This return value is not defined in Framwork Specification.\r | |
186 | This return value had been intruduced in PI Specification.\r | |
79964ac8 | 187 | \r |
188 | **/\r | |
189 | typedef\r | |
190 | EFI_STATUS\r | |
69686d56 | 191 | (EFIAPI *EFI_PEI_SMBUS_PPI_NOTIFY)(\r |
9ca1b12e | 192 | IN EFI_PEI_SERVICES **PeiServices,\r |
193 | IN EFI_PEI_SMBUS_PPI *This,\r | |
194 | IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r | |
195 | IN UINTN Data,\r | |
700a7869 | 196 | IN EFI_PEI_SMBUS_NOTIFY_FUNCTION NotifyFunction\r |
79964ac8 | 197 | );\r |
198 | \r | |
9ca1b12e | 199 | ///\r |
200 | /// Provides the basic I/O interfaces that a PEIM uses to access\r | |
201 | /// its SMBus controller and the slave devices attached to it.\r | |
202 | ///\r | |
79964ac8 | 203 | struct _EFI_PEI_SMBUS_PPI {\r |
2bbaeb0d | 204 | ///\r |
205 | /// Executes the SMBus operation to an SMBus slave device.\r | |
206 | ///\r | |
79964ac8 | 207 | EFI_PEI_SMBUS_PPI_EXECUTE_OPERATION Execute;\r |
2bbaeb0d | 208 | \r |
209 | ///\r | |
210 | /// Allows an SMBus 2.0 device(s) to be Address Resolution Protocol (ARP)\r | |
211 | ///\r | |
79964ac8 | 212 | EFI_PEI_SMBUS_PPI_ARP_DEVICE ArpDevice;\r |
2bbaeb0d | 213 | \r |
214 | ///\r | |
215 | /// Allows a PEIM to retrieve the address that was allocated by the SMBus\r | |
216 | /// host controller during enumeration/ARP. \r | |
217 | ///\r | |
79964ac8 | 218 | EFI_PEI_SMBUS_PPI_GET_ARP_MAP GetArpMap;\r |
2bbaeb0d | 219 | \r |
220 | ///\r | |
221 | /// Allows a driver to register for a callback to the SMBus host\r | |
222 | /// controller driver when the bus issues a notification to the bus controller PEIM. \r | |
223 | ///\r | |
79964ac8 | 224 | EFI_PEI_SMBUS_PPI_NOTIFY Notify;\r |
225 | };\r | |
226 | \r | |
227 | extern EFI_GUID gEfiPeiSmbusPpiGuid;\r | |
228 | \r | |
229 | #endif\r |