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