]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Ppi/Smbus2.h
Changed the name of the SPD to .nspd so as not to break the build if someone runs...
[mirror_edk2.git] / MdePkg / Include / Ppi / Smbus2.h
CommitLineData
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
13 Module Name: Smbus2.h\r
14\r
15 @par Revision Reference:\r
16 This PPI is defined in PI.\r
17 Version 1.00\r
18\r
19**/\r
20\r
21#ifndef _PEI_SMBUS2_PPI_H\r
22#define _PEI_SMBUS2_PPI_H\r
23\r
24#include <IndustryStandard/SmBus.h>\r
25\r
26#define EFI_PEI_SMBUS2_PPI_GUID \\r
27 { 0x9ca93627, 0xb65b, 0x4324, { 0xa2, 0x2, 0xc0, 0xb4, 0x61, 0x76, 0x45, 0x43 } }\r
28\r
29\r
30typedef struct _EFI_PEI_SMBUS2_PPI EFI_PEI_SMBUS2_PPI;\r
31\r
32//\r
33// EFI_SMBUS_DEVICE_COMMAND\r
34//\r
35typedef UINTN EFI_SMBUS_DEVICE_COMMAND;\r
36\r
37\r
38/*\r
39 Executes an SMBus operation to an SMBus controller.\r
40\r
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
49\r
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
54\r
55 @param PecCheck Defines if Packet Error Code (PEC) checking is required for this operation.\r
56\r
57 @param Length Signifies the number of bytes that this operation will do. \r
58 The maximum number of bytes can be revision specific and operation specific.\r
59 This parameter will contain the actual number of bytes that are executed\r
60 for this operation. Not all operations require this argument.\r
61\r
62 @param Buffer Contains the value of data to execute to the SMBus slave device. \r
63 Not all operations require this argument. \r
64 The length of this buffer is identified by Length.\r
65\r
66\r
67 @retval EFI_SUCCESS The last data that was returned from the access\r
68 matched the poll exit criteria.\r
69 @retval EFI_CRC_ERROR The checksum is not correct (PEC is incorrect)\r
70 @retval EFI_TIMEOUT Timeout expired before the operation was completed.\r
71 Timeout is determined by the SMBus host controller device.\r
72 @retval EFI_OUT_OF_RESOURCES The request could not be completed\r
73 due to a lack of resources.\r
74 @retval EFI_DEVICE_ERROR The request was not completed because\r
75 a failure reflected in the Host Status Register bit.\r
76 @retval EFI_INVALID_PARAMETER Operation is not defined in EFI_SMBUS_OPERATION.\r
77 Or Length/Buffer is NULL for operations except for EfiSmbusQuickRead and\r
78 EfiSmbusQuickWrite. Length is outside the range of valid values.\r
79 @retval EFI_UNSUPPORTED The SMBus operation or PEC is not supported.\r
80 @retval EFI_BUFFER_TOO_SMALL Buffer is not sufficient for this operation.\r
81\r
82**/\r
83typedef\r
84EFI_STATUS\r
85(EFIAPI *EFI_PEI_SMBUS2_PPI_EXECUTE_OPERATION) (\r
86 IN CONST EFI_PEI_SMBUS2_PPI *This,\r
87 IN CONST EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r
88 IN CONST EFI_SMBUS_DEVICE_COMMAND Command,\r
89 IN CONST EFI_SMBUS_OPERATION Operation,\r
90 IN CONST BOOLEAN PecCheck,\r
91 IN OUT UINTN *Length,\r
92 IN OUT VOID *Buffer\r
93);\r
94\r
95\r
96typedef struct {\r
97 UINT32 VendorSpecificId;\r
98 UINT16 SubsystemDeviceId;\r
99 UINT16 SubsystemVendorId;\r
100 UINT16 Interface;\r
101 UINT16 DeviceId;\r
102 UINT16 VendorId;\r
103 UINT8 VendorRevision;\r
104 UINT8 DeviceCapabilities;\r
105} EFI_SMBUS_UDID;\r
106\r
107/**\r
108 CallBack function can be registered in EFI_PEI_SMBUS_PPI_NOTIFY.\r
109\r
110 @param This A pointer to the EFI_PEI_SMBUS_PPI instance.\r
111 @param SlaveAddress The SMBUS hardware address to which the SMBUS\r
112 device is preassigned or allocated.\r
113 @param Data Data of the SMBus host notify command that\r
114 the caller wants to be called.\r
115\r
116 @return Status Code\r
117\r
118**/\r
119typedef\r
120EFI_STATUS\r
121(EFIAPI *EFI_PEI_SMBUS_NOTIFY2_FUNCTION) (\r
122 IN CONST EFI_PEI_SMBUS2_PPI *SmbusPpi,\r
123 IN CONST EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r
124 IN CONST UINTN Data\r
125);\r
126/**\r
127 The ArpDevice() function enumerates the entire bus or enumerates a specific \r
128 device that is identified by SmbusUdid. \r
129\r
130 @param This A pointer to the EFI_PEI_SMBUS_PPI instance.\r
131 @param ArpAll A Boolean expression that indicates if the host drivers need\r
132 to enumerate all the devices or enumerate only the device that is identified\r
133 by SmbusUdid. If ArpAll is TRUE, SmbusUdid and SlaveAddress are optional.\r
134 If ArpAll is FALSE, ArpDevice will enumerate SmbusUdid and the address\r
135 will be at SlaveAddress.\r
136 @param SmbusUdid The targeted SMBus Unique Device Identifier (UDID).\r
137 The UDID may not exist for SMBus devices with fixed addresses.\r
138 @param SlaveAddress The new SMBus address for the slave device for\r
139 which the operation is targeted.\r
140\r
141 @retval EFI_SUCCESS The SMBus slave device address was set.\r
142 @retval EFI_INVALID_PARAMETER SlaveAddress is NULL.\r
143 @retval EFI_OUT_OF_RESOURCES The request could not be completed\r
144 due to a lack of resources.\r
145 @retval EFI_TIMEOUT The SMBus slave device did not respond.\r
146 @retval EFI_DEVICE_ERROR The request was not completed because the transaction failed.\r
147\r
148**/\r
149typedef\r
150EFI_STATUS\r
151(EFIAPI *EFI_PEI_SMBUS2_PPI_ARP_DEVICE) (\r
152 IN CONST EFI_PEI_SMBUS2_PPI *This,\r
153 IN CONST BOOLEAN ArpAll,\r
154 IN CONST EFI_SMBUS_UDID *SmbusUdid, OPTIONAL\r
155 IN OUT EFI_SMBUS_DEVICE_ADDRESS *SlaveAddress OPTIONAL\r
156);\r
157\r
158\r
159typedef struct {\r
160 EFI_SMBUS_DEVICE_ADDRESS SmbusDeviceAddress;\r
161 EFI_SMBUS_UDID SmbusDeviceUdid;\r
162} EFI_SMBUS_DEVICE_MAP;\r
163\r
164/**\r
165 The GetArpMap() function returns the mapping of all the SMBus devices \r
166 that are enumerated by the SMBus host driver. \r
167\r
168 @param This A pointer to the EFI_PEI_SMBUS_PPI instance.\r
169 @param Length Size of the buffer that contains the SMBus device map.\r
170 @param SmbusDeviceMap The pointer to the device map as enumerated\r
171 by the SMBus controller driver.\r
172\r
173 @retval EFI_SUCCESS The device map was returned correctly in the buffer.\r
174\r
175**/\r
176typedef\r
177EFI_STATUS\r
178(EFIAPI *EFI_PEI_SMBUS2_PPI_GET_ARP_MAP) (\r
179 IN CONST EFI_PEI_SMBUS2_PPI *This,\r
180 IN OUT UINTN *Length,\r
181 IN OUT EFI_SMBUS_DEVICE_MAP **SmbusDeviceMap\r
182);\r
183\r
184\r
185/**\r
186 The Notify() function registers all the callback functions to allow the \r
187 bus driver to call these functions when the SlaveAddress/Data pair happens.\r
188\r
189 @param PeiServices A pointer to the system PEI Services Table.\r
190 @param This A pointer to the EFI_PEI_SMBUS_PPI instance.\r
191 @param SlaveAddress Address that the host controller detects as\r
192 sending a message and calls all the registered functions.\r
193 @param Data Data that the host controller detects as sending a message\r
194 and calls all the registered functions.\r
195 @param NotifyFunction The function to call when the bus driver\r
196 detects the SlaveAddress and Data pair.\r
197\r
198 @retval EFI_SUCCESS NotifyFunction has been registered.\r
199\r
200**/\r
201typedef\r
202EFI_STATUS\r
203(EFIAPI *EFI_PEI_SMBUS2_PPI_NOTIFY) (\r
204 IN CONST EFI_PEI_SMBUS2_PPI *This,\r
205 IN CONST EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r
206 IN CONST UINTN Data,\r
207 IN CONST EFI_PEI_SMBUS_NOTIFY2_FUNCTION NotifyFunction\r
208);\r
209\r
210/**\r
211 @par Ppi Description:\r
212 Provides the basic I/O interfaces that a PEIM uses to access \r
213 its SMBus controller and the slave devices attached to it.\r
214\r
215 @param Execute\r
216 Executes the SMBus operation to an SMBus slave device.\r
217\r
218 @param ArpDevice\r
219 Allows an SMBus 2.0 device(s) to be Address Resolution Protocol (ARP)\r
220\r
221 @param GetArpMap\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
225 @param Notify\r
226 Allows a driver to register for a callback to the SMBus host \r
227 controller driver when the bus issues a notification to the bus controller PEIM.\r
228\r
229 @param Identifier\r
230 Identifier which uniquely identifies this SMBus controller in a system.\r
231\r
232**/\r
233struct _EFI_PEI_SMBUS2_PPI {\r
234 EFI_PEI_SMBUS2_PPI_EXECUTE_OPERATION Execute;\r
235 EFI_PEI_SMBUS2_PPI_ARP_DEVICE ArpDevice;\r
236 EFI_PEI_SMBUS2_PPI_GET_ARP_MAP GetArpMap;\r
237 EFI_PEI_SMBUS2_PPI_NOTIFY Notify;\r
238 EFI_GUID Identifier;\r
239};\r
240\r
241extern EFI_GUID gEfiPeiSmbus2PpiGuid;\r
242\r
243#endif\r