]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Ppi/Smbus2.h
Rename EFI_PEI_PCI_CFG_PPI_IO to EFI_PEI_PCI_CFG2_PPI_IO to avoid collision with...
[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 @par Revision Reference:
14 This PPI is defined in PI.
15 Version 1.00
16
17 **/
18
19 #ifndef _PEI_SMBUS2_PPI_H
20 #define _PEI_SMBUS2_PPI_H
21
22 #include <IndustryStandard/SmBus.h>
23
24 #define EFI_PEI_SMBUS2_PPI_GUID \
25 { 0x9ca93627, 0xb65b, 0x4324, { 0xa2, 0x2, 0xc0, 0xb4, 0x61, 0x76, 0x45, 0x43 } }
26
27
28 typedef struct _EFI_PEI_SMBUS2_PPI EFI_PEI_SMBUS2_PPI;
29
30 //
31 // EFI_SMBUS_DEVICE_COMMAND
32 //
33 typedef UINTN EFI_SMBUS_DEVICE_COMMAND;
34
35
36 /*
37 Executes an SMBus operation to an SMBus controller.
38
39 @param This A pointer to the EFI_PEI_SMBUS2_PPI instance.
40 @param SlaveAddress The SMBUS hardware address to which the SMBUS device is preassigned or
41 allocated.
42 @param Command This command is transmitted by the SMBus host controller to the SMBus slave
43 device and the interpretation is SMBus slave device specific.
44 It can mean the offset to a list of functions inside
45 an SMBus slave device. Not all operations or slave devices support
46 this command's registers.
47
48 @param Operation Signifies which particular SMBus hardware protocol instance that it
49 will use to execute the SMBus transactions.
50 This SMBus hardware protocol is defined by the System Management Bus (SMBus)
51 Specification and is not related to UEFI.
52
53 @param PecCheck Defines if Packet Error Code (PEC) checking is required for this operation.
54
55 @param Length Signifies the number of bytes that this operation will do.
56 The maximum number of bytes can be revision specific and operation specific.
57 This parameter will contain the actual number of bytes that are executed
58 for this operation. Not all operations require this argument.
59
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. 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 CONST EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
86 IN CONST EFI_SMBUS_DEVICE_COMMAND Command,
87 IN CONST EFI_SMBUS_OPERATION Operation,
88 IN CONST BOOLEAN PecCheck,
89 IN OUT UINTN *Length,
90 IN OUT VOID *Buffer
91 );
92
93 /**
94 CallBack function can be registered in EFI_PEI_SMBUS_PPI_NOTIFY.
95
96 @param This A pointer to the EFI_PEI_SMBUS_PPI instance.
97 @param SlaveAddress The SMBUS hardware address to which the SMBUS
98 device is preassigned or allocated.
99 @param Data Data of the SMBus host notify command that
100 the caller wants to be called.
101
102 @return Status Code
103
104 **/
105 typedef
106 EFI_STATUS
107 (EFIAPI *EFI_PEI_SMBUS_NOTIFY2_FUNCTION) (
108 IN CONST EFI_PEI_SMBUS2_PPI *SmbusPpi,
109 IN CONST EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
110 IN CONST UINTN Data
111 );
112 /**
113 The ArpDevice() function enumerates the entire bus or enumerates a specific
114 device that is identified by SmbusUdid.
115
116 @param This A pointer to the EFI_PEI_SMBUS_PPI instance.
117 @param ArpAll A Boolean expression that indicates if the host drivers need
118 to enumerate all the devices or enumerate only the device that is identified
119 by SmbusUdid. If ArpAll is TRUE, SmbusUdid and SlaveAddress are optional.
120 If ArpAll is FALSE, ArpDevice will enumerate SmbusUdid and the address
121 will be at SlaveAddress.
122 @param SmbusUdid The targeted SMBus Unique Device Identifier (UDID).
123 The UDID may not exist for SMBus devices with fixed addresses.
124 @param SlaveAddress The new SMBus address for the slave device for
125 which the operation is targeted.
126
127 @retval EFI_SUCCESS The SMBus slave device address was set.
128 @retval EFI_INVALID_PARAMETER SlaveAddress is NULL.
129 @retval EFI_OUT_OF_RESOURCES The request could not be completed
130 due to a lack of resources.
131 @retval EFI_TIMEOUT The SMBus slave device did not respond.
132 @retval EFI_DEVICE_ERROR The request was not completed because the transaction failed.
133
134 **/
135 typedef
136 EFI_STATUS
137 (EFIAPI *EFI_PEI_SMBUS2_PPI_ARP_DEVICE) (
138 IN CONST EFI_PEI_SMBUS2_PPI *This,
139 IN CONST BOOLEAN ArpAll,
140 IN CONST EFI_SMBUS_UDID *SmbusUdid, OPTIONAL
141 IN OUT EFI_SMBUS_DEVICE_ADDRESS *SlaveAddress OPTIONAL
142 );
143
144
145 typedef struct {
146 EFI_SMBUS_DEVICE_ADDRESS SmbusDeviceAddress;
147 EFI_SMBUS_UDID SmbusDeviceUdid;
148 } EFI_SMBUS_DEVICE_MAP;
149
150 /**
151 The GetArpMap() function returns the mapping of all the SMBus devices
152 that are enumerated by the SMBus host driver.
153
154 @param This A pointer to the EFI_PEI_SMBUS_PPI instance.
155 @param Length Size of the buffer that contains the SMBus device map.
156 @param SmbusDeviceMap The pointer to the device map as enumerated
157 by the SMBus controller driver.
158
159 @retval EFI_SUCCESS The device map was returned correctly in the buffer.
160
161 **/
162 typedef
163 EFI_STATUS
164 (EFIAPI *EFI_PEI_SMBUS2_PPI_GET_ARP_MAP) (
165 IN CONST EFI_PEI_SMBUS2_PPI *This,
166 IN OUT UINTN *Length,
167 IN OUT EFI_SMBUS_DEVICE_MAP **SmbusDeviceMap
168 );
169
170
171 /**
172 The Notify() function registers all the callback functions to allow the
173 bus driver to call these functions when the SlaveAddress/Data pair happens.
174
175 @param PeiServices A pointer to the system PEI Services Table.
176 @param This A pointer to the EFI_PEI_SMBUS_PPI instance.
177 @param SlaveAddress Address that the host controller detects as
178 sending a message and calls all the registered functions.
179 @param Data Data that the host controller detects as sending a message
180 and calls all the registered functions.
181 @param NotifyFunction The function to call when the bus driver
182 detects the SlaveAddress and Data pair.
183
184 @retval EFI_SUCCESS NotifyFunction has been registered.
185
186 **/
187 typedef
188 EFI_STATUS
189 (EFIAPI *EFI_PEI_SMBUS2_PPI_NOTIFY) (
190 IN CONST EFI_PEI_SMBUS2_PPI *This,
191 IN CONST EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
192 IN CONST UINTN Data,
193 IN CONST EFI_PEI_SMBUS_NOTIFY2_FUNCTION NotifyFunction
194 );
195
196 /**
197 @par Ppi Description:
198 Provides the basic I/O interfaces that a PEIM uses to access
199 its SMBus controller and the slave devices attached to it.
200
201 @param Execute
202 Executes the SMBus operation to an SMBus slave device.
203
204 @param ArpDevice
205 Allows an SMBus 2.0 device(s) to be Address Resolution Protocol (ARP)
206
207 @param GetArpMap
208 Allows a PEIM to retrieve the address that was allocated by the SMBus
209 host controller during enumeration/ARP.
210
211 @param Notify
212 Allows a driver to register for a callback to the SMBus host
213 controller driver when the bus issues a notification to the bus controller PEIM.
214
215 @param Identifier
216 Identifier which uniquely identifies this SMBus controller in a system.
217
218 **/
219 struct _EFI_PEI_SMBUS2_PPI {
220 EFI_PEI_SMBUS2_PPI_EXECUTE_OPERATION Execute;
221 EFI_PEI_SMBUS2_PPI_ARP_DEVICE ArpDevice;
222 EFI_PEI_SMBUS2_PPI_GET_ARP_MAP GetArpMap;
223 EFI_PEI_SMBUS2_PPI_NOTIFY Notify;
224 EFI_GUID Identifier;
225 };
226
227 extern EFI_GUID gEfiPeiSmbus2PpiGuid;
228
229 #endif