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