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