]>
Commit | Line | Data |
---|---|---|
79964ac8 | 1 | /** @file\r |
5259c97d | 2 | This file declares the Smbus PPI, which provides the basic I/O interfaces that a PEIM \r |
4a71b21a | 3 | uses to access its SMBus controller and the slave devices attached to it.\r |
79964ac8 | 4 | \r |
2b3687db | 5 | Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>\r |
f22f941e | 6 | This program and the accompanying materials are licensed and made available under \r |
7 | the terms and conditions of the BSD License that accompanies this distribution. \r | |
8 | 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 | |
79964ac8 | 13 | \r |
79964ac8 | 14 | @par Revision Reference:\r |
15 | This PPI is defined in Framework of EFI SmBus PPI spec.\r | |
f22f941e | 16 | Version 0.9.\r |
79964ac8 | 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 | |
f22f941e | 40 | controller to the SMBus slave device, and the \r |
41 | interpretation is SMBus slave device specific.\r | |
516e9f28 | 42 | @param[in] Operation Signifies which particular SMBus hardware protocol\r |
5259c97d | 43 | instance to use to execute the SMBus transactions.\r |
f22f941e | 44 | @param[in] PecCheck Defines if Packet Error Code (PEC) checking is \r |
45 | required 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 \r | |
48 | slave device.\r | |
79964ac8 | 49 | \r |
50 | @retval EFI_SUCCESS The last data that was returned from the access\r | |
51 | matched the poll exit criteria.\r | |
9ca1b12e | 52 | @retval EFI_CRC_ERROR The checksum is not correct (PEC is incorrect).\r |
79964ac8 | 53 | @retval EFI_TIMEOUT Timeout expired before the operation was completed.\r |
54 | Timeout is determined by the SMBus host controller device.\r | |
55 | @retval EFI_OUT_OF_RESOURCES The request could not be completed\r | |
56 | due to a lack of resources.\r | |
f22f941e | 57 | @retval EFI_DEVICE_ERROR The request was not completed because a failure\r |
58 | was recorded in the Host Status Register bit.\r | |
59 | @retval EFI_INVALID_PARAMETER The operation is not defined in EFI_SMBUS_OPERATION.\r | |
60 | @retval EFI_INVALID_PARAMETER Length/Buffer is NULL for operations except for \r | |
61 | EfiSmbusQuickRead and EfiSmbusQuickWrite. Length \r | |
62 | is outside the range of valid values.\r | |
79964ac8 | 63 | @retval EFI_UNSUPPORTED The SMBus operation or PEC is not supported.\r |
64 | @retval EFI_BUFFER_TOO_SMALL Buffer is not sufficient for this operation.\r | |
65 | \r | |
66 | **/\r | |
67 | typedef\r | |
68 | EFI_STATUS\r | |
69686d56 | 69 | (EFIAPI *EFI_PEI_SMBUS_PPI_EXECUTE_OPERATION)(\r |
79964ac8 | 70 | IN EFI_PEI_SERVICES **PeiServices,\r |
700a7869 | 71 | IN EFI_PEI_SMBUS_PPI *This,\r |
79964ac8 | 72 | IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r |
73 | IN EFI_SMBUS_DEVICE_COMMAND Command,\r | |
74 | IN EFI_SMBUS_OPERATION Operation,\r | |
75 | IN BOOLEAN PecCheck,\r | |
76 | IN OUT UINTN *Length,\r | |
77 | IN OUT VOID *Buffer\r | |
78 | );\r | |
79 | \r | |
79964ac8 | 80 | /**\r |
5259c97d | 81 | This function is user-defined, and is called when the SlaveAddress/Data pair happens.\r |
2a924b00 | 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 | |
5259c97d | 87 | @param[in] Data Data of the SMBus host notify command, which denotes that\r |
516e9f28 | 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 | |
5259c97d | 103 | The ArpDevice() function enumerates either the entire bus or a specific\r |
104 | device identified by SmbusUdid.\r | |
79964ac8 | 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 | |
f22f941e | 108 | @param[in] ArpAll A Boolean expression that indicates if the host \r |
109 | drivers need to enumerate all the devices or to \r | |
110 | enumerate only the device that is identified\r | |
111 | by SmbusUdid. If ArpAll is TRUE, SmbusUdid and \r | |
112 | SlaveAddress are optional and ignored if entered.\r | |
113 | If ArpAll is FALSE, ArpDevice will enumerate \r | |
114 | SmbusUdid, and the address will be at SlaveAddress.\r | |
516e9f28 | 115 | @param[in] SmbusUdid The targeted SMBus Unique Device Identifier (UDID).\r |
f22f941e | 116 | The UDID may not exist for SMBus devices with fixed \r |
117 | addresses.\r | |
516e9f28 | 118 | @param[in, out] SlaveAddress The new SMBus address for the slave device for\r |
119 | which the operation is targeted.\r | |
2a924b00 | 120 | This address may be NULL.\r |
79964ac8 | 121 | \r |
122 | @retval EFI_SUCCESS The SMBus slave device address was set.\r | |
123 | @retval EFI_INVALID_PARAMETER SlaveAddress is NULL.\r | |
124 | @retval EFI_OUT_OF_RESOURCES The request could not be completed\r | |
125 | due to a lack of resources.\r | |
126 | @retval EFI_TIMEOUT The SMBus slave device did not respond.\r | |
127 | @retval EFI_DEVICE_ERROR The request was not completed because the transaction failed.\r | |
5259c97d | 128 | @retval EFI_UNSUPPORTED ArpDevice() is not implemented by this PEIM. \r |
f22f941e | 129 | This return value is not defined in the Framework Specification.\r |
5259c97d | 130 | This return value was introduced in the PI Specification.\r |
79964ac8 | 131 | \r |
132 | **/\r | |
133 | typedef\r | |
134 | EFI_STATUS\r | |
69686d56 | 135 | (EFIAPI *EFI_PEI_SMBUS_PPI_ARP_DEVICE)(\r |
79964ac8 | 136 | IN EFI_PEI_SERVICES **PeiServices,\r |
700a7869 | 137 | IN EFI_PEI_SMBUS_PPI *This,\r |
79964ac8 | 138 | IN BOOLEAN ArpAll,\r |
139 | IN EFI_SMBUS_UDID *SmbusUdid, OPTIONAL\r | |
140 | IN OUT EFI_SMBUS_DEVICE_ADDRESS *SlaveAddress OPTIONAL\r | |
141 | );\r | |
142 | \r | |
79964ac8 | 143 | /**\r |
144 | The GetArpMap() function returns the mapping of all the SMBus devices\r | |
145 | that are enumerated by the SMBus host driver.\r | |
146 | \r | |
516e9f28 | 147 | @param[in] PeiServices A pointer to the system PEI Services Table.\r |
148 | @param[in] This A pointer to the EFI_PEI_SMBUS_PPI instance.\r | |
f22f941e | 149 | @param[in, out] Length The size of the buffer that contains the SMBus device map.\r |
516e9f28 | 150 | @param[in, out] SmbusDeviceMap The pointer to the device map as enumerated\r |
151 | by the SMBus controller driver.\r | |
79964ac8 | 152 | \r |
2a924b00 | 153 | @retval EFI_SUCCESS The device map was returned correctly in the buffer.\r |
154 | @retval EFI_UNSUPPORTED GetArpMap() are not implemented by this PEIM. \r | |
f22f941e | 155 | This return value was not defined in the Framework Specification.\r |
5259c97d | 156 | This return value was introduced in the PI Specification.\r |
79964ac8 | 157 | \r |
158 | **/\r | |
159 | typedef\r | |
160 | EFI_STATUS\r | |
69686d56 | 161 | (EFIAPI *EFI_PEI_SMBUS_PPI_GET_ARP_MAP)(\r |
79964ac8 | 162 | IN EFI_PEI_SERVICES **PeiServices,\r |
700a7869 | 163 | IN EFI_PEI_SMBUS_PPI *This,\r |
79964ac8 | 164 | IN OUT UINTN *Length,\r |
165 | IN OUT EFI_SMBUS_DEVICE_MAP **SmbusDeviceMap\r | |
166 | );\r | |
167 | \r | |
168 | /**\r | |
9ca1b12e | 169 | Allows a device driver to register for a callback when the bus driver detects a state that it needs to \r |
170 | propagate to other PEIMs that are registered for a callback.\r | |
171 | \r | |
79964ac8 | 172 | The Notify() function registers all the callback functions to allow the\r |
f22f941e | 173 | bus driver to call these functions when the SlaveAddress/Data pair occur.\r |
2a924b00 | 174 | All functions to be registered with EFI_PEI_SMBUS_PPI_NOTIFY must be of type\r |
175 | EFI_PEI_SMBUS_NOTIFY_FUNCTION.\r | |
79964ac8 | 176 | \r |
516e9f28 | 177 | @param[in] PeiServices A pointer to the system PEI Services Table.\r |
178 | @param[in] This A pointer to the EFI_PEI_SMBUS_PPI instance.\r | |
f22f941e | 179 | @param[in] SlaveAddress The address that the host controller detects as\r |
5259c97d | 180 | sending a message and triggers all the registered functions.\r |
516e9f28 | 181 | @param[in] Data Data that the host controller detects as sending a message\r |
5259c97d | 182 | and triggers all the registered functions.\r |
516e9f28 | 183 | @param[in] NotifyFunction The function to call when the bus driver\r |
184 | detects the SlaveAddress and Data pair.\r | |
79964ac8 | 185 | \r |
516e9f28 | 186 | @retval EFI_SUCCESS NotifyFunction has been registered.\r |
2a924b00 | 187 | @retval EFI_UNSUPPORTED Notify() are not implemented by this PEIM. \r |
f22f941e | 188 | This return value is not defined in the Framework Specification.\r |
5259c97d | 189 | This return value was introduced in the PI Specification.\r |
79964ac8 | 190 | \r |
191 | **/\r | |
192 | typedef\r | |
193 | EFI_STATUS\r | |
69686d56 | 194 | (EFIAPI *EFI_PEI_SMBUS_PPI_NOTIFY)(\r |
9ca1b12e | 195 | IN EFI_PEI_SERVICES **PeiServices,\r |
196 | IN EFI_PEI_SMBUS_PPI *This,\r | |
197 | IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r | |
198 | IN UINTN Data,\r | |
700a7869 | 199 | IN EFI_PEI_SMBUS_NOTIFY_FUNCTION NotifyFunction\r |
79964ac8 | 200 | );\r |
201 | \r | |
9ca1b12e | 202 | ///\r |
203 | /// Provides the basic I/O interfaces that a PEIM uses to access\r | |
204 | /// its SMBus controller and the slave devices attached to it.\r | |
205 | ///\r | |
79964ac8 | 206 | struct _EFI_PEI_SMBUS_PPI {\r |
2bbaeb0d | 207 | ///\r |
208 | /// Executes the SMBus operation to an SMBus slave device.\r | |
209 | ///\r | |
79964ac8 | 210 | EFI_PEI_SMBUS_PPI_EXECUTE_OPERATION Execute;\r |
2bbaeb0d | 211 | \r |
212 | ///\r | |
213 | /// Allows an SMBus 2.0 device(s) to be Address Resolution Protocol (ARP)\r | |
214 | ///\r | |
79964ac8 | 215 | EFI_PEI_SMBUS_PPI_ARP_DEVICE ArpDevice;\r |
2bbaeb0d | 216 | \r |
217 | ///\r | |
218 | /// Allows a PEIM to retrieve the address that was allocated by the SMBus\r | |
219 | /// host controller during enumeration/ARP. \r | |
220 | ///\r | |
79964ac8 | 221 | EFI_PEI_SMBUS_PPI_GET_ARP_MAP GetArpMap;\r |
2bbaeb0d | 222 | \r |
223 | ///\r | |
224 | /// Allows a driver to register for a callback to the SMBus host\r | |
225 | /// controller driver when the bus issues a notification to the bus controller PEIM. \r | |
226 | ///\r | |
79964ac8 | 227 | EFI_PEI_SMBUS_PPI_NOTIFY Notify;\r |
228 | };\r | |
229 | \r | |
230 | extern EFI_GUID gEfiPeiSmbusPpiGuid;\r | |
231 | \r | |
232 | #endif\r |