]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Ppi/Smbus2.h
Add the detailed descriptions for the structure data member in these protocol.
[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 introduced in PI Version 1.0.
17
18 **/
19
20 #ifndef __PEI_SMBUS2_PPI_H__
21 #define __PEI_SMBUS2_PPI_H__
22
23 #include <IndustryStandard/SmBus.h>
24
25 #define EFI_PEI_SMBUS2_PPI_GUID \
26 { 0x9ca93627, 0xb65b, 0x4324, { 0xa2, 0x2, 0xc0, 0xb4, 0x61, 0x76, 0x45, 0x43 } }
27
28
29 typedef struct _EFI_PEI_SMBUS2_PPI EFI_PEI_SMBUS2_PPI;
30
31 /**
32 Executes an SMBus operation to an SMBus controller. Returns when either
33 the command has been executed or an error is encountered in doing the operation.
34
35 @param This A pointer to the EFI_PEI_SMBUS2_PPI instance.
36 @param SlaveAddress The SMBUS hardware address to which the SMBUS device is preassigned or
37 allocated.
38 @param Command This command is transmitted by the SMBus host controller to the SMBus slave
39 device and the interpretation is SMBus slave device specific.
40 It can mean the offset to a list of functions inside
41 an SMBus slave device. Not all operations or slave devices support
42 this command's registers.
43 @param Operation Signifies which particular SMBus hardware protocol instance that it
44 will use to execute the SMBus transactions.
45 This SMBus hardware protocol is defined by the System Management Bus (SMBus)
46 Specification and is not related to UEFI.
47 @param PecCheck Defines if Packet Error Code (PEC) checking is required for this operation.
48 @param Length Signifies the number of bytes that this operation will do.
49 The maximum number of bytes can be revision specific and operation specific.
50 This parameter will contain the actual number of bytes that are executed
51 for this operation. Not all operations require this argument.
52 @param Buffer Contains the value of data to execute to the SMBus slave device.
53 Not all operations require this argument.
54 The length of this buffer is identified by Length.
55
56
57 @retval EFI_SUCCESS The last data that was returned from the access
58 matched the poll exit criteria.
59 @retval EFI_CRC_ERROR The checksum is not correct (PEC is incorrect)
60 @retval EFI_TIMEOUT Timeout expired before the operation was completed.
61 Timeout is determined by the SMBus host controller device.
62 @retval EFI_OUT_OF_RESOURCES The request could not be completed
63 due to a lack of resources.
64 @retval EFI_DEVICE_ERROR The request was not completed because
65 a failure reflected in the Host Status Register bit.
66 @retval EFI_INVALID_PARAMETER Operation is not defined in EFI_SMBUS_OPERATION.
67 Or Length/Buffer is NULL for operations except for EfiSmbusQuickRead and
68 EfiSmbusQuickWrite. Or Length is outside the range of valid values.
69 @retval EFI_UNSUPPORTED The SMBus operation or PEC is not supported.
70 @retval EFI_BUFFER_TOO_SMALL Buffer is not sufficient for this operation.
71
72 **/
73 typedef
74 EFI_STATUS
75 (EFIAPI *EFI_PEI_SMBUS2_PPI_EXECUTE_OPERATION)(
76 IN CONST EFI_PEI_SMBUS2_PPI *This,
77 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
78 IN EFI_SMBUS_DEVICE_COMMAND Command,
79 IN EFI_SMBUS_OPERATION Operation,
80 IN BOOLEAN PecCheck,
81 IN OUT UINTN *Length,
82 IN OUT VOID *Buffer
83 );
84
85 /**
86 The ArpDevice() function enumerates the entire bus or enumerates a specific
87 device that is identified by SmbusUdid.
88
89 @param This A pointer to the EFI_PEI_SMBUS2_PPI instance.
90 @param ArpAll A Boolean expression that indicates if the host drivers need
91 to enumerate all the devices or enumerate only the device that is identified
92 by SmbusUdid. If ArpAll is TRUE, SmbusUdid and SlaveAddress are optional.
93 If ArpAll is FALSE, ArpDevice will enumerate SmbusUdid and the address
94 will be at SlaveAddress.
95 @param SmbusUdid The targeted SMBus Unique Device Identifier (UDID).
96 The UDID may not exist for SMBus devices with fixed addresses.
97 @param SlaveAddress The new SMBus address for the slave device for
98 which the operation is targeted.
99
100 @retval EFI_SUCCESS The SMBus slave device address was set.
101 @retval EFI_INVALID_PARAMETER SlaveAddress is NULL.
102 @retval EFI_OUT_OF_RESOURCES The request could not be completed
103 due to a lack of resources.
104 @retval EFI_TIMEOUT The SMBus slave device did not respond.
105 @retval EFI_DEVICE_ERROR The request was not completed because the transaction failed.
106 @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are not implemented by this PEIM.
107
108 **/
109 typedef
110 EFI_STATUS
111 (EFIAPI *EFI_PEI_SMBUS2_PPI_ARP_DEVICE)(
112 IN CONST EFI_PEI_SMBUS2_PPI *This,
113 IN BOOLEAN ArpAll,
114 IN EFI_SMBUS_UDID *SmbusUdid, OPTIONAL
115 IN OUT EFI_SMBUS_DEVICE_ADDRESS *SlaveAddress OPTIONAL
116 );
117
118
119 typedef struct {
120 ///
121 /// The SMBUS hardware address to which the SMBUS device is preassigned or
122 /// allocated. Type EFI_SMBUS_DEVICE_ADDRESS is defined in EFI_PEI_SMBUS2_PPI.Execute().
123 ///
124 EFI_SMBUS_DEVICE_ADDRESS SmbusDeviceAddress;
125 ///
126 /// The SMBUS Unique Device Identifier (UDID) as defined in EFI_SMBUS_UDID.
127 /// Type EFI_SMBUS_UDID is defined in EFI_PEI_SMBUS2_PPI.ArpDevice().
128 ///
129 EFI_SMBUS_UDID SmbusDeviceUdid;
130 } EFI_SMBUS_DEVICE_MAP;
131
132 /**
133 The GetArpMap() function returns the mapping of all the SMBus devices
134 that are enumerated by the SMBus host driver.
135
136 @param This A pointer to the EFI_PEI_SMBUS2_PPI instance.
137 @param Length Size of the buffer that contains the SMBus device map.
138 @param SmbusDeviceMap The pointer to the device map as enumerated
139 by the SMBus controller driver.
140
141 @retval EFI_SUCCESS The device map was returned correctly in the buffer.
142 @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are not implemented by this PEIM.
143
144 **/
145 typedef
146 EFI_STATUS
147 (EFIAPI *EFI_PEI_SMBUS2_PPI_GET_ARP_MAP)(
148 IN CONST EFI_PEI_SMBUS2_PPI *This,
149 IN OUT UINTN *Length,
150 IN OUT EFI_SMBUS_DEVICE_MAP **SmbusDeviceMap
151 );
152
153 /**
154 CallBack function can be registered in EFI_PEI_SMBUS2_PPI_NOTIFY.
155
156 @param This A pointer to the EFI_PEI_SMBUS2_PPI instance.
157 @param SlaveAddress The SMBUS hardware address to which the SMBUS
158 device is preassigned or allocated.
159 @param Data Data of the SMBus host notify command that
160 the caller wants to be called.
161
162 @retval EFI_SUCCESS NotifyFunction has been registered.
163 @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are not
164 implemented by this PEIM.
165
166 **/
167 typedef
168 EFI_STATUS
169 (EFIAPI *EFI_PEI_SMBUS_NOTIFY2_FUNCTION)(
170 IN CONST EFI_PEI_SMBUS2_PPI *SmbusPpi,
171 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
172 IN 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 EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
196 IN UINTN Data,
197 IN EFI_PEI_SMBUS_NOTIFY2_FUNCTION NotifyFunction
198 );
199
200 ///
201 /// Provides the basic I/O interfaces that a PEIM uses to access
202 /// its SMBus controller and the slave devices attached to it.
203 ///
204 struct _EFI_PEI_SMBUS2_PPI {
205 EFI_PEI_SMBUS2_PPI_EXECUTE_OPERATION Execute;
206 EFI_PEI_SMBUS2_PPI_ARP_DEVICE ArpDevice;
207 EFI_PEI_SMBUS2_PPI_GET_ARP_MAP GetArpMap;
208 EFI_PEI_SMBUS2_PPI_NOTIFY Notify;
209 ///
210 /// Identifier which uniquely identifies this SMBus controller in a system.
211 ///
212 EFI_GUID Identifier;
213 };
214
215 extern EFI_GUID gEfiPeiSmbus2PpiGuid;
216
217 #endif