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