]>
Commit | Line | Data |
---|---|---|
5879b875 | 1 | /** @file\r |
2 | This file declares Smbus2 PPI.\r | |
d7132512 LG |
3 | This PPI provides the basic I/O interfaces that a PEIM uses to access its \r |
4 | SMBus controller and the slave devices attached to it.\r | |
5879b875 | 5 | \r |
d7132512 | 6 | Copyright (c) 2006 - 2008, Intel Corporation \r |
5879b875 | 7 | All rights reserved. This program and the accompanying materials \r |
8 | are licensed and made available under the terms and conditions of the BSD License \r | |
9 | which accompanies this distribution. The full text of the license may be found at \r | |
10 | http://opensource.org/licenses/bsd-license.php \r | |
11 | \r | |
12 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
13 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
14 | \r | |
5879b875 | 15 | @par Revision Reference:\r |
16 | This PPI is defined in PI.\r | |
17 | Version 1.00\r | |
18 | \r | |
19 | **/\r | |
20 | \r | |
d7132512 LG |
21 | #ifndef __PEI_SMBUS2_PPI_H__\r |
22 | #define __PEI_SMBUS2_PPI_H__\r | |
11227adb | 23 | \r |
01aef47b | 24 | #include <PiPei.h>\r |
5879b875 | 25 | #include <IndustryStandard/SmBus.h>\r |
26 | \r | |
27 | #define EFI_PEI_SMBUS2_PPI_GUID \\r | |
00edb218 | 28 | { 0x9ca93627, 0xb65b, 0x4324, { 0xa2, 0x2, 0xc0, 0xb4, 0x61, 0x76, 0x45, 0x43 } }\r |
5879b875 | 29 | \r |
30 | \r | |
31 | typedef struct _EFI_PEI_SMBUS2_PPI EFI_PEI_SMBUS2_PPI;\r | |
32 | \r | |
33 | //\r | |
34 | // EFI_SMBUS_DEVICE_COMMAND\r | |
35 | //\r | |
00edb218 | 36 | typedef UINTN EFI_SMBUS_DEVICE_COMMAND;\r |
5879b875 | 37 | \r |
38 | \r | |
39 | /*\r | |
d7132512 LG |
40 | Executes an SMBus operation to an SMBus controller. Returns when either \r |
41 | the command has been executed or an error is encountered in doing the operation.\r | |
5879b875 | 42 | \r |
00edb218 A |
43 | @param This A pointer to the EFI_PEI_SMBUS2_PPI instance.\r |
44 | @param SlaveAddress The SMBUS hardware address to which the SMBUS device is preassigned or\r | |
45 | allocated.\r | |
46 | @param Command This command is transmitted by the SMBus host controller to the SMBus slave \r | |
47 | device and the interpretation is SMBus slave device specific. \r | |
48 | It can mean the offset to a list of functions inside \r | |
49 | an SMBus slave device. Not all operations or slave devices support\r | |
50 | this command's registers.\r | |
00edb218 A |
51 | @param Operation Signifies which particular SMBus hardware protocol instance that it \r |
52 | will use to execute the SMBus transactions. \r | |
53 | This SMBus hardware protocol is defined by the System Management Bus (SMBus) \r | |
54 | Specification and is not related to UEFI.\r | |
00edb218 | 55 | @param PecCheck Defines if Packet Error Code (PEC) checking is required for this operation.\r |
00edb218 A |
56 | @param Length Signifies the number of bytes that this operation will do. \r |
57 | The maximum number of bytes can be revision specific and operation specific.\r | |
58 | This parameter will contain the actual number of bytes that are executed\r | |
59 | for this operation. Not all operations require this argument.\r | |
00edb218 A |
60 | @param Buffer Contains the value of data to execute to the SMBus slave device. \r |
61 | Not all operations require this argument. \r | |
62 | The length of this buffer is identified by Length.\r | |
5879b875 | 63 | \r |
64 | \r | |
65 | @retval EFI_SUCCESS The last data that was returned from the access\r | |
66 | matched the poll exit criteria.\r | |
67 | @retval EFI_CRC_ERROR The checksum is not correct (PEC is incorrect)\r | |
68 | @retval EFI_TIMEOUT Timeout expired before the operation was completed.\r | |
69 | Timeout is determined by the SMBus host controller device.\r | |
70 | @retval EFI_OUT_OF_RESOURCES The request could not be completed\r | |
71 | due to a lack of resources.\r | |
72 | @retval EFI_DEVICE_ERROR The request was not completed because\r | |
73 | a failure reflected in the Host Status Register bit.\r | |
74 | @retval EFI_INVALID_PARAMETER Operation is not defined in EFI_SMBUS_OPERATION.\r | |
75 | Or Length/Buffer is NULL for operations except for EfiSmbusQuickRead and\r | |
d7132512 | 76 | EfiSmbusQuickWrite. Or Length is outside the range of valid values.\r |
5879b875 | 77 | @retval EFI_UNSUPPORTED The SMBus operation or PEC is not supported.\r |
78 | @retval EFI_BUFFER_TOO_SMALL Buffer is not sufficient for this operation.\r | |
79 | \r | |
80 | **/\r | |
81 | typedef\r | |
82 | EFI_STATUS\r | |
8b13229b | 83 | (EFIAPI *EFI_PEI_SMBUS2_PPI_EXECUTE_OPERATION)(\r |
00edb218 | 84 | IN CONST EFI_PEI_SMBUS2_PPI *This,\r |
11227adb | 85 | IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r |
86 | IN EFI_SMBUS_DEVICE_COMMAND Command,\r | |
87 | IN EFI_SMBUS_OPERATION Operation,\r | |
88 | IN BOOLEAN PecCheck,\r | |
00edb218 A |
89 | IN OUT UINTN *Length,\r |
90 | IN OUT VOID *Buffer\r | |
5879b875 | 91 | );\r |
92 | \r | |
5879b875 | 93 | /**\r |
94 | The ArpDevice() function enumerates the entire bus or enumerates a specific \r | |
95 | device that is identified by SmbusUdid. \r | |
96 | \r | |
d7132512 | 97 | @param This A pointer to the EFI_PEI_SMBUS2_PPI instance.\r |
5879b875 | 98 | @param ArpAll A Boolean expression that indicates if the host drivers need\r |
99 | to enumerate all the devices or enumerate only the device that is identified\r | |
100 | by SmbusUdid. If ArpAll is TRUE, SmbusUdid and SlaveAddress are optional.\r | |
101 | If ArpAll is FALSE, ArpDevice will enumerate SmbusUdid and the address\r | |
102 | will be at SlaveAddress.\r | |
103 | @param SmbusUdid The targeted SMBus Unique Device Identifier (UDID).\r | |
104 | The UDID may not exist for SMBus devices with fixed addresses.\r | |
105 | @param SlaveAddress The new SMBus address for the slave device for\r | |
106 | which the operation is targeted.\r | |
107 | \r | |
108 | @retval EFI_SUCCESS The SMBus slave device address was set.\r | |
109 | @retval EFI_INVALID_PARAMETER SlaveAddress is NULL.\r | |
110 | @retval EFI_OUT_OF_RESOURCES The request could not be completed\r | |
111 | due to a lack of resources.\r | |
112 | @retval EFI_TIMEOUT The SMBus slave device did not respond.\r | |
113 | @retval EFI_DEVICE_ERROR The request was not completed because the transaction failed.\r | |
d7132512 | 114 | @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are not implemented by this PEIM.\r |
5879b875 | 115 | \r |
116 | **/\r | |
117 | typedef\r | |
118 | EFI_STATUS\r | |
8b13229b | 119 | (EFIAPI *EFI_PEI_SMBUS2_PPI_ARP_DEVICE)(\r |
00edb218 | 120 | IN CONST EFI_PEI_SMBUS2_PPI *This,\r |
11227adb | 121 | IN BOOLEAN ArpAll,\r |
122 | IN EFI_SMBUS_UDID *SmbusUdid, OPTIONAL\r | |
00edb218 | 123 | IN OUT EFI_SMBUS_DEVICE_ADDRESS *SlaveAddress OPTIONAL\r |
5879b875 | 124 | );\r |
125 | \r | |
126 | \r | |
127 | typedef struct {\r | |
11227adb | 128 | ///\r |
129 | /// The SMBUS hardware address to which the SMBUS device is preassigned or\r | |
130 | /// allocated. Type EFI_SMBUS_DEVICE_ADDRESS is defined in EFI_PEI_SMBUS2_PPI.Execute().\r | |
131 | ///\r | |
5879b875 | 132 | EFI_SMBUS_DEVICE_ADDRESS SmbusDeviceAddress;\r |
11227adb | 133 | ///\r |
134 | /// The SMBUS Unique Device Identifier (UDID) as defined in EFI_SMBUS_UDID.\r | |
135 | /// Type EFI_SMBUS_UDID is defined in EFI_PEI_SMBUS2_PPI.ArpDevice().\r | |
136 | ///\r | |
5879b875 | 137 | EFI_SMBUS_UDID SmbusDeviceUdid;\r |
138 | } EFI_SMBUS_DEVICE_MAP;\r | |
139 | \r | |
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 | |
d7132512 | 144 | @param This A pointer to the EFI_PEI_SMBUS2_PPI instance.\r |
5879b875 | 145 | @param Length Size of the buffer that contains the SMBus device map.\r |
146 | @param SmbusDeviceMap The pointer to the device map as enumerated\r | |
147 | by the SMBus controller driver.\r | |
148 | \r | |
149 | @retval EFI_SUCCESS The device map was returned correctly in the buffer.\r | |
d7132512 | 150 | @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are not implemented by this PEIM.\r |
5879b875 | 151 | \r |
152 | **/\r | |
153 | typedef\r | |
154 | EFI_STATUS\r | |
8b13229b | 155 | (EFIAPI *EFI_PEI_SMBUS2_PPI_GET_ARP_MAP)(\r |
00edb218 A |
156 | IN CONST EFI_PEI_SMBUS2_PPI *This,\r |
157 | IN OUT UINTN *Length,\r | |
158 | IN OUT EFI_SMBUS_DEVICE_MAP **SmbusDeviceMap\r | |
5879b875 | 159 | );\r |
160 | \r | |
d7132512 LG |
161 | /**\r |
162 | CallBack function can be registered in EFI_PEI_SMBUS2_PPI_NOTIFY.\r | |
163 | \r | |
164 | @param This A pointer to the EFI_PEI_SMBUS2_PPI instance.\r | |
165 | @param SlaveAddress The SMBUS hardware address to which the SMBUS\r | |
166 | device is preassigned or allocated.\r | |
167 | @param Data Data of the SMBus host notify command that\r | |
168 | the caller wants to be called.\r | |
169 | \r | |
11227adb | 170 | @retval EFI_SUCCESS NotifyFunction has been registered.\r |
171 | @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are not\r | |
172 | implemented by this PEIM.\r | |
173 | \r | |
d7132512 LG |
174 | **/\r |
175 | typedef\r | |
176 | EFI_STATUS\r | |
177 | (EFIAPI *EFI_PEI_SMBUS_NOTIFY2_FUNCTION)(\r | |
178 | IN CONST EFI_PEI_SMBUS2_PPI *SmbusPpi,\r | |
11227adb | 179 | IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r |
180 | IN UINTN Data\r | |
d7132512 | 181 | );\r |
5879b875 | 182 | \r |
183 | /**\r | |
184 | The Notify() function registers all the callback functions to allow the \r | |
185 | bus driver to call these functions when the SlaveAddress/Data pair happens.\r | |
186 | \r | |
d7132512 | 187 | @param This A pointer to the EFI_PEI_SMBUS2_PPI instance.\r |
5879b875 | 188 | @param SlaveAddress Address that the host controller detects as\r |
189 | sending a message and calls all the registered functions.\r | |
190 | @param Data Data that the host controller detects as sending a message\r | |
191 | and calls all the registered functions.\r | |
192 | @param NotifyFunction The function to call when the bus driver\r | |
193 | detects the SlaveAddress and Data pair.\r | |
194 | \r | |
d7132512 LG |
195 | @retval EFI_SUCCESS NotifyFunction has been registered.\r |
196 | @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are not\r | |
197 | implemented by this PEIM.\r | |
5879b875 | 198 | **/\r |
199 | typedef\r | |
200 | EFI_STATUS\r | |
8b13229b | 201 | (EFIAPI *EFI_PEI_SMBUS2_PPI_NOTIFY)(\r |
11227adb | 202 | IN CONST EFI_PEI_SMBUS2_PPI *This,\r |
203 | IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r | |
204 | IN UINTN Data,\r | |
205 | IN EFI_PEI_SMBUS_NOTIFY2_FUNCTION NotifyFunction\r | |
5879b875 | 206 | );\r |
207 | \r | |
11227adb | 208 | ///\r |
209 | /// Provides the basic I/O interfaces that a PEIM uses to access \r | |
210 | /// its SMBus controller and the slave devices attached to it.\r | |
211 | ///\r | |
5879b875 | 212 | struct _EFI_PEI_SMBUS2_PPI {\r |
11227adb | 213 | ///\r |
214 | /// Executes the SMBus operation to an SMBus slave device.\r | |
215 | ///\r | |
00edb218 | 216 | EFI_PEI_SMBUS2_PPI_EXECUTE_OPERATION Execute;\r |
11227adb | 217 | ///\r |
218 | /// Allows an SMBus 2.0 device(s) to be Address Resolution Protocol (ARP).\r | |
219 | ///\r | |
00edb218 | 220 | EFI_PEI_SMBUS2_PPI_ARP_DEVICE ArpDevice;\r |
11227adb | 221 | ///\r |
222 | /// Allows a PEIM to retrieve the address that was allocated by the SMBus \r | |
223 | /// host controller during enumeration/ARP.\r | |
224 | ///\r | |
00edb218 | 225 | EFI_PEI_SMBUS2_PPI_GET_ARP_MAP GetArpMap;\r |
11227adb | 226 | ///\r |
227 | /// Allows a driver to register for a callback to the SMBus host \r | |
228 | /// controller driver when the bus issues a notification to the bus controller PEIM.\r | |
229 | ///\r | |
00edb218 | 230 | EFI_PEI_SMBUS2_PPI_NOTIFY Notify;\r |
11227adb | 231 | ///\r |
232 | /// Identifier which uniquely identifies this SMBus controller in a system.\r | |
233 | ///\r | |
00edb218 | 234 | EFI_GUID Identifier;\r |
5879b875 | 235 | };\r |
236 | \r | |
237 | extern EFI_GUID gEfiPeiSmbus2PpiGuid;\r | |
238 | \r | |
239 | #endif\r |