]>
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 |
5879b875 | 24 | #include <IndustryStandard/SmBus.h>\r |
25 | \r | |
26 | #define EFI_PEI_SMBUS2_PPI_GUID \\r | |
00edb218 | 27 | { 0x9ca93627, 0xb65b, 0x4324, { 0xa2, 0x2, 0xc0, 0xb4, 0x61, 0x76, 0x45, 0x43 } }\r |
5879b875 | 28 | \r |
29 | \r | |
30 | typedef struct _EFI_PEI_SMBUS2_PPI EFI_PEI_SMBUS2_PPI;\r | |
31 | \r | |
32 | //\r | |
33 | // EFI_SMBUS_DEVICE_COMMAND\r | |
34 | //\r | |
00edb218 | 35 | typedef UINTN EFI_SMBUS_DEVICE_COMMAND;\r |
5879b875 | 36 | \r |
37 | \r | |
38 | /*\r | |
d7132512 LG |
39 | Executes an SMBus operation to an SMBus controller. Returns when either \r |
40 | the command has been executed or an error is encountered in doing the operation.\r | |
5879b875 | 41 | \r |
00edb218 A |
42 | @param This A pointer to the EFI_PEI_SMBUS2_PPI instance.\r |
43 | @param SlaveAddress The SMBUS hardware address to which the SMBUS device is preassigned or\r | |
44 | allocated.\r | |
45 | @param Command This command is transmitted by the SMBus host controller to the SMBus slave \r | |
46 | device and the interpretation is SMBus slave device specific. \r | |
47 | It can mean the offset to a list of functions inside \r | |
48 | an SMBus slave device. Not all operations or slave devices support\r | |
49 | this command's registers.\r | |
00edb218 A |
50 | @param Operation Signifies which particular SMBus hardware protocol instance that it \r |
51 | will use to execute the SMBus transactions. \r | |
52 | This SMBus hardware protocol is defined by the System Management Bus (SMBus) \r | |
53 | Specification and is not related to UEFI.\r | |
00edb218 | 54 | @param PecCheck Defines if Packet Error Code (PEC) checking is required for this operation.\r |
00edb218 A |
55 | @param Length Signifies the number of bytes that this operation will do. \r |
56 | The maximum number of bytes can be revision specific and operation specific.\r | |
57 | This parameter will contain the actual number of bytes that are executed\r | |
58 | for this operation. Not all operations require this argument.\r | |
00edb218 A |
59 | @param Buffer Contains the value of data to execute to the SMBus slave device. \r |
60 | Not all operations require this argument. \r | |
61 | The length of this buffer is identified by Length.\r | |
5879b875 | 62 | \r |
63 | \r | |
64 | @retval EFI_SUCCESS The last data that was returned from the access\r | |
65 | matched the poll exit criteria.\r | |
66 | @retval EFI_CRC_ERROR The checksum is not correct (PEC is incorrect)\r | |
67 | @retval EFI_TIMEOUT Timeout expired before the operation was completed.\r | |
68 | Timeout is determined by the SMBus host controller device.\r | |
69 | @retval EFI_OUT_OF_RESOURCES The request could not be completed\r | |
70 | due to a lack of resources.\r | |
71 | @retval EFI_DEVICE_ERROR The request was not completed because\r | |
72 | a failure reflected in the Host Status Register bit.\r | |
73 | @retval EFI_INVALID_PARAMETER Operation is not defined in EFI_SMBUS_OPERATION.\r | |
74 | Or Length/Buffer is NULL for operations except for EfiSmbusQuickRead and\r | |
d7132512 | 75 | EfiSmbusQuickWrite. Or Length is outside the range of valid values.\r |
5879b875 | 76 | @retval EFI_UNSUPPORTED The SMBus operation or PEC is not supported.\r |
77 | @retval EFI_BUFFER_TOO_SMALL Buffer is not sufficient for this operation.\r | |
78 | \r | |
79 | **/\r | |
80 | typedef\r | |
81 | EFI_STATUS\r | |
8b13229b | 82 | (EFIAPI *EFI_PEI_SMBUS2_PPI_EXECUTE_OPERATION)(\r |
00edb218 | 83 | IN CONST EFI_PEI_SMBUS2_PPI *This,\r |
11227adb | 84 | IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r |
85 | IN EFI_SMBUS_DEVICE_COMMAND Command,\r | |
86 | IN EFI_SMBUS_OPERATION Operation,\r | |
87 | IN BOOLEAN PecCheck,\r | |
00edb218 A |
88 | IN OUT UINTN *Length,\r |
89 | IN OUT VOID *Buffer\r | |
5879b875 | 90 | );\r |
91 | \r | |
5879b875 | 92 | /**\r |
93 | The ArpDevice() function enumerates the entire bus or enumerates a specific \r | |
94 | device that is identified by SmbusUdid. \r | |
95 | \r | |
d7132512 | 96 | @param This A pointer to the EFI_PEI_SMBUS2_PPI instance.\r |
5879b875 | 97 | @param ArpAll A Boolean expression that indicates if the host drivers need\r |
98 | to enumerate all the devices or enumerate only the device that is identified\r | |
99 | by SmbusUdid. If ArpAll is TRUE, SmbusUdid and SlaveAddress are optional.\r | |
100 | If ArpAll is FALSE, ArpDevice will enumerate SmbusUdid and the address\r | |
101 | will be at SlaveAddress.\r | |
102 | @param SmbusUdid The targeted SMBus Unique Device Identifier (UDID).\r | |
103 | The UDID may not exist for SMBus devices with fixed addresses.\r | |
104 | @param SlaveAddress The new SMBus address for the slave device for\r | |
105 | which the operation is targeted.\r | |
106 | \r | |
107 | @retval EFI_SUCCESS The SMBus slave device address was set.\r | |
108 | @retval EFI_INVALID_PARAMETER SlaveAddress is NULL.\r | |
109 | @retval EFI_OUT_OF_RESOURCES The request could not be completed\r | |
110 | due to a lack of resources.\r | |
111 | @retval EFI_TIMEOUT The SMBus slave device did not respond.\r | |
112 | @retval EFI_DEVICE_ERROR The request was not completed because the transaction failed.\r | |
d7132512 | 113 | @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are not implemented by this PEIM.\r |
5879b875 | 114 | \r |
115 | **/\r | |
116 | typedef\r | |
117 | EFI_STATUS\r | |
8b13229b | 118 | (EFIAPI *EFI_PEI_SMBUS2_PPI_ARP_DEVICE)(\r |
00edb218 | 119 | IN CONST EFI_PEI_SMBUS2_PPI *This,\r |
11227adb | 120 | IN BOOLEAN ArpAll,\r |
121 | IN EFI_SMBUS_UDID *SmbusUdid, OPTIONAL\r | |
00edb218 | 122 | IN OUT EFI_SMBUS_DEVICE_ADDRESS *SlaveAddress OPTIONAL\r |
5879b875 | 123 | );\r |
124 | \r | |
125 | \r | |
126 | typedef struct {\r | |
11227adb | 127 | ///\r |
128 | /// The SMBUS hardware address to which the SMBUS device is preassigned or\r | |
129 | /// allocated. Type EFI_SMBUS_DEVICE_ADDRESS is defined in EFI_PEI_SMBUS2_PPI.Execute().\r | |
130 | ///\r | |
5879b875 | 131 | EFI_SMBUS_DEVICE_ADDRESS SmbusDeviceAddress;\r |
11227adb | 132 | ///\r |
133 | /// The SMBUS Unique Device Identifier (UDID) as defined in EFI_SMBUS_UDID.\r | |
134 | /// Type EFI_SMBUS_UDID is defined in EFI_PEI_SMBUS2_PPI.ArpDevice().\r | |
135 | ///\r | |
5879b875 | 136 | EFI_SMBUS_UDID SmbusDeviceUdid;\r |
137 | } EFI_SMBUS_DEVICE_MAP;\r | |
138 | \r | |
139 | /**\r | |
140 | The GetArpMap() function returns the mapping of all the SMBus devices \r | |
141 | that are enumerated by the SMBus host driver. \r | |
142 | \r | |
d7132512 | 143 | @param This A pointer to the EFI_PEI_SMBUS2_PPI instance.\r |
5879b875 | 144 | @param Length Size of the buffer that contains the SMBus device map.\r |
145 | @param 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 | |
d7132512 | 149 | @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are not implemented by this PEIM.\r |
5879b875 | 150 | \r |
151 | **/\r | |
152 | typedef\r | |
153 | EFI_STATUS\r | |
8b13229b | 154 | (EFIAPI *EFI_PEI_SMBUS2_PPI_GET_ARP_MAP)(\r |
00edb218 A |
155 | IN CONST EFI_PEI_SMBUS2_PPI *This,\r |
156 | IN OUT UINTN *Length,\r | |
157 | IN OUT EFI_SMBUS_DEVICE_MAP **SmbusDeviceMap\r | |
5879b875 | 158 | );\r |
159 | \r | |
d7132512 LG |
160 | /**\r |
161 | CallBack function can be registered in EFI_PEI_SMBUS2_PPI_NOTIFY.\r | |
162 | \r | |
163 | @param This A pointer to the EFI_PEI_SMBUS2_PPI instance.\r | |
164 | @param SlaveAddress The SMBUS hardware address to which the SMBUS\r | |
165 | device is preassigned or allocated.\r | |
166 | @param Data Data of the SMBus host notify command that\r | |
167 | the caller wants to be called.\r | |
168 | \r | |
11227adb | 169 | @retval EFI_SUCCESS NotifyFunction has been registered.\r |
170 | @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are not\r | |
171 | implemented by this PEIM.\r | |
172 | \r | |
d7132512 LG |
173 | **/\r |
174 | typedef\r | |
175 | EFI_STATUS\r | |
176 | (EFIAPI *EFI_PEI_SMBUS_NOTIFY2_FUNCTION)(\r | |
177 | IN CONST EFI_PEI_SMBUS2_PPI *SmbusPpi,\r | |
11227adb | 178 | IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r |
179 | IN UINTN Data\r | |
d7132512 | 180 | );\r |
5879b875 | 181 | \r |
182 | /**\r | |
183 | The Notify() function registers all the callback functions to allow the \r | |
184 | bus driver to call these functions when the SlaveAddress/Data pair happens.\r | |
185 | \r | |
d7132512 | 186 | @param This A pointer to the EFI_PEI_SMBUS2_PPI instance.\r |
5879b875 | 187 | @param SlaveAddress Address that the host controller detects as\r |
188 | sending a message and calls all the registered functions.\r | |
189 | @param Data Data that the host controller detects as sending a message\r | |
190 | and calls all the registered functions.\r | |
191 | @param NotifyFunction The function to call when the bus driver\r | |
192 | detects the SlaveAddress and Data pair.\r | |
193 | \r | |
d7132512 LG |
194 | @retval EFI_SUCCESS NotifyFunction has been registered.\r |
195 | @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are not\r | |
196 | implemented by this PEIM.\r | |
5879b875 | 197 | **/\r |
198 | typedef\r | |
199 | EFI_STATUS\r | |
8b13229b | 200 | (EFIAPI *EFI_PEI_SMBUS2_PPI_NOTIFY)(\r |
11227adb | 201 | IN CONST EFI_PEI_SMBUS2_PPI *This,\r |
202 | IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r | |
203 | IN UINTN Data,\r | |
204 | IN EFI_PEI_SMBUS_NOTIFY2_FUNCTION NotifyFunction\r | |
5879b875 | 205 | );\r |
206 | \r | |
11227adb | 207 | ///\r |
208 | /// Provides the basic I/O interfaces that a PEIM uses to access \r | |
209 | /// its SMBus controller and the slave devices attached to it.\r | |
210 | ///\r | |
5879b875 | 211 | struct _EFI_PEI_SMBUS2_PPI {\r |
00edb218 A |
212 | EFI_PEI_SMBUS2_PPI_EXECUTE_OPERATION Execute;\r |
213 | EFI_PEI_SMBUS2_PPI_ARP_DEVICE ArpDevice;\r | |
214 | EFI_PEI_SMBUS2_PPI_GET_ARP_MAP GetArpMap;\r | |
215 | EFI_PEI_SMBUS2_PPI_NOTIFY Notify;\r | |
11227adb | 216 | ///\r |
217 | /// Identifier which uniquely identifies this SMBus controller in a system.\r | |
218 | ///\r | |
00edb218 | 219 | EFI_GUID Identifier;\r |
5879b875 | 220 | };\r |
221 | \r | |
222 | extern EFI_GUID gEfiPeiSmbus2PpiGuid;\r | |
223 | \r | |
224 | #endif\r |