]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Ppi/Smbus2.h
c61d5c19416eb05477876f455bf6e4f29db5297b
[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 CallBack function can be registered in EFI_PEI_SMBUS_PPI_NOTIFY.
97
98 @param This A pointer to the EFI_PEI_SMBUS_PPI instance.
99 @param SlaveAddress The SMBUS hardware address to which the SMBUS
100 device is preassigned or allocated.
101 @param Data Data of the SMBus host notify command that
102 the caller wants to be called.
103
104 @return Status Code
105
106 **/
107 typedef
108 EFI_STATUS
109 (EFIAPI *EFI_PEI_SMBUS_NOTIFY2_FUNCTION) (
110 IN CONST EFI_PEI_SMBUS2_PPI *SmbusPpi,
111 IN CONST EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
112 IN CONST UINTN Data
113 );
114 /**
115 The ArpDevice() function enumerates the entire bus or enumerates a specific
116 device that is identified by SmbusUdid.
117
118 @param This A pointer to the EFI_PEI_SMBUS_PPI instance.
119 @param ArpAll A Boolean expression that indicates if the host drivers need
120 to enumerate all the devices or enumerate only the device that is identified
121 by SmbusUdid. If ArpAll is TRUE, SmbusUdid and SlaveAddress are optional.
122 If ArpAll is FALSE, ArpDevice will enumerate SmbusUdid and the address
123 will be at SlaveAddress.
124 @param SmbusUdid The targeted SMBus Unique Device Identifier (UDID).
125 The UDID may not exist for SMBus devices with fixed addresses.
126 @param SlaveAddress The new SMBus address for the slave device for
127 which the operation is targeted.
128
129 @retval EFI_SUCCESS The SMBus slave device address was set.
130 @retval EFI_INVALID_PARAMETER SlaveAddress is NULL.
131 @retval EFI_OUT_OF_RESOURCES The request could not be completed
132 due to a lack of resources.
133 @retval EFI_TIMEOUT The SMBus slave device did not respond.
134 @retval EFI_DEVICE_ERROR The request was not completed because the transaction failed.
135
136 **/
137 typedef
138 EFI_STATUS
139 (EFIAPI *EFI_PEI_SMBUS2_PPI_ARP_DEVICE) (
140 IN CONST EFI_PEI_SMBUS2_PPI *This,
141 IN CONST BOOLEAN ArpAll,
142 IN CONST EFI_SMBUS_UDID *SmbusUdid, OPTIONAL
143 IN OUT EFI_SMBUS_DEVICE_ADDRESS *SlaveAddress OPTIONAL
144 );
145
146
147 typedef struct {
148 EFI_SMBUS_DEVICE_ADDRESS SmbusDeviceAddress;
149 EFI_SMBUS_UDID SmbusDeviceUdid;
150 } EFI_SMBUS_DEVICE_MAP;
151
152 /**
153 The GetArpMap() function returns the mapping of all the SMBus devices
154 that are enumerated by the SMBus host driver.
155
156 @param This A pointer to the EFI_PEI_SMBUS_PPI instance.
157 @param Length Size of the buffer that contains the SMBus device map.
158 @param SmbusDeviceMap The pointer to the device map as enumerated
159 by the SMBus controller driver.
160
161 @retval EFI_SUCCESS The device map was returned correctly in the buffer.
162
163 **/
164 typedef
165 EFI_STATUS
166 (EFIAPI *EFI_PEI_SMBUS2_PPI_GET_ARP_MAP) (
167 IN CONST EFI_PEI_SMBUS2_PPI *This,
168 IN OUT UINTN *Length,
169 IN OUT EFI_SMBUS_DEVICE_MAP **SmbusDeviceMap
170 );
171
172
173 /**
174 The Notify() function registers all the callback functions to allow the
175 bus driver to call these functions when the SlaveAddress/Data pair happens.
176
177 @param PeiServices A pointer to the system PEI Services Table.
178 @param This A pointer to the EFI_PEI_SMBUS_PPI instance.
179 @param SlaveAddress Address that the host controller detects as
180 sending a message and calls all the registered functions.
181 @param Data Data that the host controller detects as sending a message
182 and calls all the registered functions.
183 @param NotifyFunction The function to call when the bus driver
184 detects the SlaveAddress and Data pair.
185
186 @retval EFI_SUCCESS NotifyFunction has been registered.
187
188 **/
189 typedef
190 EFI_STATUS
191 (EFIAPI *EFI_PEI_SMBUS2_PPI_NOTIFY) (
192 IN CONST EFI_PEI_SMBUS2_PPI *This,
193 IN CONST EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
194 IN CONST UINTN Data,
195 IN CONST EFI_PEI_SMBUS_NOTIFY2_FUNCTION NotifyFunction
196 );
197
198 /**
199 @par Ppi Description:
200 Provides the basic I/O interfaces that a PEIM uses to access
201 its SMBus controller and the slave devices attached to it.
202
203 @param Execute
204 Executes the SMBus operation to an SMBus slave device.
205
206 @param ArpDevice
207 Allows an SMBus 2.0 device(s) to be Address Resolution Protocol (ARP)
208
209 @param GetArpMap
210 Allows a PEIM to retrieve the address that was allocated by the SMBus
211 host controller during enumeration/ARP.
212
213 @param Notify
214 Allows a driver to register for a callback to the SMBus host
215 controller driver when the bus issues a notification to the bus controller PEIM.
216
217 @param Identifier
218 Identifier which uniquely identifies this SMBus controller in a system.
219
220 **/
221 struct _EFI_PEI_SMBUS2_PPI {
222 EFI_PEI_SMBUS2_PPI_EXECUTE_OPERATION Execute;
223 EFI_PEI_SMBUS2_PPI_ARP_DEVICE ArpDevice;
224 EFI_PEI_SMBUS2_PPI_GET_ARP_MAP GetArpMap;
225 EFI_PEI_SMBUS2_PPI_NOTIFY Notify;
226 EFI_GUID Identifier;
227 };
228
229 extern EFI_GUID gEfiPeiSmbus2PpiGuid;
230
231 #endif