]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Ppi/Smbus2.h
Code Scrub for header files in MdePkg/Include/Ppi and Uefi directory.
[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 #include <PiPei.h>
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. Returns when either
40 the command has been executed or an error is encountered in doing the operation.
41
42 @param This A pointer to the EFI_PEI_SMBUS2_PPI instance.
43 @param SlaveAddress The SMBUS hardware address to which the SMBUS device is preassigned or
44 allocated.
45 @param Command This command is transmitted by the SMBus host controller to the SMBus slave
46 device and the interpretation is SMBus slave device specific.
47 It can mean the offset to a list of functions inside
48 an SMBus slave device. Not all operations or slave devices support
49 this command's registers.
50
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
56 @param PecCheck Defines if Packet Error Code (PEC) checking is required for this operation.
57
58 @param Length Signifies the number of bytes that this operation will do.
59 The maximum number of bytes can be revision specific and operation specific.
60 This parameter will contain the actual number of bytes that are executed
61 for this operation. Not all operations require this argument.
62
63 @param Buffer Contains the value of data to execute to the SMBus slave device.
64 Not all operations require this argument.
65 The length of this buffer is identified by Length.
66
67
68 @retval EFI_SUCCESS The last data that was returned from the access
69 matched the poll exit criteria.
70 @retval EFI_CRC_ERROR The checksum is not correct (PEC is incorrect)
71 @retval EFI_TIMEOUT Timeout expired before the operation was completed.
72 Timeout is determined by the SMBus host controller device.
73 @retval EFI_OUT_OF_RESOURCES The request could not be completed
74 due to a lack of resources.
75 @retval EFI_DEVICE_ERROR The request was not completed because
76 a failure reflected in the Host Status Register bit.
77 @retval EFI_INVALID_PARAMETER Operation is not defined in EFI_SMBUS_OPERATION.
78 Or Length/Buffer is NULL for operations except for EfiSmbusQuickRead and
79 EfiSmbusQuickWrite. Or Length is outside the range of valid values.
80 @retval EFI_UNSUPPORTED The SMBus operation or PEC is not supported.
81 @retval EFI_BUFFER_TOO_SMALL Buffer is not sufficient for this operation.
82
83 **/
84 typedef
85 EFI_STATUS
86 (EFIAPI *EFI_PEI_SMBUS2_PPI_EXECUTE_OPERATION)(
87 IN CONST EFI_PEI_SMBUS2_PPI *This,
88 IN CONST EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
89 IN CONST EFI_SMBUS_DEVICE_COMMAND Command,
90 IN CONST EFI_SMBUS_OPERATION Operation,
91 IN CONST BOOLEAN PecCheck,
92 IN OUT UINTN *Length,
93 IN OUT VOID *Buffer
94 );
95
96 /**
97 The ArpDevice() function enumerates the entire bus or enumerates a specific
98 device that is identified by SmbusUdid.
99
100 @param This A pointer to the EFI_PEI_SMBUS2_PPI instance.
101 @param ArpAll A Boolean expression that indicates if the host drivers need
102 to enumerate all the devices or enumerate only the device that is identified
103 by SmbusUdid. If ArpAll is TRUE, SmbusUdid and SlaveAddress are optional.
104 If ArpAll is FALSE, ArpDevice will enumerate SmbusUdid and the address
105 will be at SlaveAddress.
106 @param SmbusUdid The targeted SMBus Unique Device Identifier (UDID).
107 The UDID may not exist for SMBus devices with fixed addresses.
108 @param SlaveAddress The new SMBus address for the slave device for
109 which the operation is targeted.
110
111 @retval EFI_SUCCESS The SMBus slave device address was set.
112 @retval EFI_INVALID_PARAMETER SlaveAddress is NULL.
113 @retval EFI_OUT_OF_RESOURCES The request could not be completed
114 due to a lack of resources.
115 @retval EFI_TIMEOUT The SMBus slave device did not respond.
116 @retval EFI_DEVICE_ERROR The request was not completed because the transaction failed.
117 @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are not implemented by this PEIM.
118
119 **/
120 typedef
121 EFI_STATUS
122 (EFIAPI *EFI_PEI_SMBUS2_PPI_ARP_DEVICE)(
123 IN CONST EFI_PEI_SMBUS2_PPI *This,
124 IN CONST BOOLEAN ArpAll,
125 IN CONST EFI_SMBUS_UDID *SmbusUdid, OPTIONAL
126 IN OUT EFI_SMBUS_DEVICE_ADDRESS *SlaveAddress OPTIONAL
127 );
128
129
130 typedef struct {
131 EFI_SMBUS_DEVICE_ADDRESS SmbusDeviceAddress;
132 EFI_SMBUS_UDID SmbusDeviceUdid;
133 } EFI_SMBUS_DEVICE_MAP;
134
135 /**
136 The GetArpMap() function returns the mapping of all the SMBus devices
137 that are enumerated by the SMBus host driver.
138
139 @param This A pointer to the EFI_PEI_SMBUS2_PPI instance.
140 @param Length Size of the buffer that contains the SMBus device map.
141 @param SmbusDeviceMap The pointer to the device map as enumerated
142 by the SMBus controller driver.
143
144 @retval EFI_SUCCESS The device map was returned correctly in the buffer.
145 @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are not implemented by this PEIM.
146
147 **/
148 typedef
149 EFI_STATUS
150 (EFIAPI *EFI_PEI_SMBUS2_PPI_GET_ARP_MAP)(
151 IN CONST EFI_PEI_SMBUS2_PPI *This,
152 IN OUT UINTN *Length,
153 IN OUT EFI_SMBUS_DEVICE_MAP **SmbusDeviceMap
154 );
155
156 /**
157 CallBack function can be registered in EFI_PEI_SMBUS2_PPI_NOTIFY.
158
159 @param This A pointer to the EFI_PEI_SMBUS2_PPI instance.
160 @param SlaveAddress The SMBUS hardware address to which the SMBUS
161 device is preassigned or allocated.
162 @param Data Data of the SMBus host notify command that
163 the caller wants to be called.
164
165 @return Status
166 **/
167 typedef
168 EFI_STATUS
169 (EFIAPI *EFI_PEI_SMBUS_NOTIFY2_FUNCTION)(
170 IN CONST EFI_PEI_SMBUS2_PPI *SmbusPpi,
171 IN CONST EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
172 IN CONST UINTN Data
173 );
174
175 /**
176 The Notify() function registers all the callback functions to allow the
177 bus driver to call these functions when the SlaveAddress/Data pair happens.
178
179 @param This A pointer to the EFI_PEI_SMBUS2_PPI instance.
180 @param SlaveAddress Address that the host controller detects as
181 sending a message and calls all the registered functions.
182 @param Data Data that the host controller detects as sending a message
183 and calls all the registered functions.
184 @param NotifyFunction The function to call when the bus driver
185 detects the SlaveAddress and Data pair.
186
187 @retval EFI_SUCCESS NotifyFunction has been registered.
188 @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are not
189 implemented by this PEIM.
190 **/
191 typedef
192 EFI_STATUS
193 (EFIAPI *EFI_PEI_SMBUS2_PPI_NOTIFY)(
194 IN CONST EFI_PEI_SMBUS2_PPI *This,
195 IN CONST EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
196 IN CONST UINTN Data,
197 IN CONST EFI_PEI_SMBUS_NOTIFY2_FUNCTION NotifyFunction
198 );
199
200 /**
201 @par Ppi Description:
202 Provides the basic I/O interfaces that a PEIM uses to access
203 its SMBus controller and the slave devices attached to it.
204
205 @param Execute
206 Executes the SMBus operation to an SMBus slave device.
207
208 @param ArpDevice
209 Allows an SMBus 2.0 device(s) to be Address Resolution Protocol (ARP)
210
211 @param GetArpMap
212 Allows a PEIM to retrieve the address that was allocated by the SMBus
213 host controller during enumeration/ARP.
214
215 @param Notify
216 Allows a driver to register for a callback to the SMBus host
217 controller driver when the bus issues a notification to the bus controller PEIM.
218
219 @param Identifier
220 Identifier which uniquely identifies this SMBus controller in a system.
221
222 **/
223 struct _EFI_PEI_SMBUS2_PPI {
224 EFI_PEI_SMBUS2_PPI_EXECUTE_OPERATION Execute;
225 EFI_PEI_SMBUS2_PPI_ARP_DEVICE ArpDevice;
226 EFI_PEI_SMBUS2_PPI_GET_ARP_MAP GetArpMap;
227 EFI_PEI_SMBUS2_PPI_NOTIFY Notify;
228 EFI_GUID Identifier;
229 };
230
231 extern EFI_GUID gEfiPeiSmbus2PpiGuid;
232
233 #endif