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