]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkPkg/Include/Ppi/Smbus.h
fix ecc report-out issues
[mirror_edk2.git] / IntelFrameworkPkg / Include / Ppi / Smbus.h
1 /** @file
2 This file declares Smbus PPI which provides the basic I/O interfaces that a PEIM
3 uses to access its SMBus controller and the slave devices attached to it.
4
5 Copyright (c) 2007, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14 Module Name: Smbus.h
15
16 @par Revision Reference:
17 This PPI is defined in Framework of EFI SmBus PPI spec.
18 Version 0.9
19
20 **/
21
22 #ifndef _PEI_SMBUS_PPI_H_
23 #define _PEI_SMBUS_PPI_H_
24
25 #include <PiPei.h>
26 #include <Ppi/Smbus2.h>
27
28 #define EFI_PEI_SMBUS_PPI_GUID \
29 { \
30 0xabd42895, 0x78cf, 0x4872, {0x84, 0x44, 0x1b, 0x5c, 0x18, 0xb, 0xfb, 0xda } \
31 }
32
33 typedef struct _EFI_PEI_SMBUS_PPI EFI_PEI_SMBUS_PPI;
34
35 /**
36 Executes an SMBus operation to an SMBus controller.
37
38 @param PeiServices A pointer to the system PEI Services Table.
39 @param This A pointer to the EFI_PEI_SMBUS_PPI instance.
40 @param SlaveAddress The SMBUS hardware address to which the SMBUS
41 device is preassigned or allocated.
42 @param Command This command is transmitted by the SMBus host
43 controller to the SMBus slave device and the interpretation is
44 SMBus slave device specific.
45 @param Operation Signifies which particular SMBus hardware protocol
46 instance that it will use to execute the SMBus transactions.
47 @param PecCheck Defines if Packet Error Code (PEC) checking is required
48 for this operation.
49 @param Length Signifies the number of bytes that this operation will do.
50 @param Buffer Contains the value of data to execute to the SMBus slave device.
51
52 @retval EFI_SUCCESS The last data that was returned from the access
53 matched the poll exit criteria.
54 @retval EFI_CRC_ERROR The checksum is not correct (PEC is incorrect)
55 @retval EFI_TIMEOUT Timeout expired before the operation was completed.
56 Timeout is determined by the SMBus host controller device.
57 @retval EFI_OUT_OF_RESOURCES The request could not be completed
58 due to a lack of resources.
59 @retval EFI_DEVICE_ERROR The request was not completed because
60 a failure reflected in the Host Status Register bit.
61 @retval EFI_INVALID_PARAMETER Operation is not defined in EFI_SMBUS_OPERATION.
62 Or Length/Buffer is NULL for operations except for EfiSmbusQuickRead and
63 EfiSmbusQuickWrite. Length is outside the range of valid values.
64 @retval EFI_UNSUPPORTED The SMBus operation or PEC is not supported.
65 @retval EFI_BUFFER_TOO_SMALL Buffer is not sufficient for this operation.
66
67 **/
68 typedef
69 EFI_STATUS
70 (EFIAPI *EFI_PEI_SMBUS_PPI_EXECUTE_OPERATION)(
71 IN EFI_PEI_SERVICES **PeiServices,
72 IN EFI_PEI_SMBUS_PPI *This,
73 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
74 IN EFI_SMBUS_DEVICE_COMMAND Command,
75 IN EFI_SMBUS_OPERATION Operation,
76 IN BOOLEAN PecCheck,
77 IN OUT UINTN *Length,
78 IN OUT VOID *Buffer
79 );
80
81 /**
82 CallBack function can be registered in EFI_PEI_SMBUS_PPI_NOTIFY.
83
84 @param PeiServices A pointer to the system PEI Services Table.
85 @param This A pointer to the EFI_PEI_SMBUS_PPI instance.
86 @param SlaveAddress The SMBUS hardware address to which the SMBUS
87 device is preassigned or allocated.
88 @param Data Data of the SMBus host notify command that
89 the caller wants to be called.
90
91 @return Status Code
92
93 **/
94 typedef
95 EFI_STATUS
96 (EFIAPI *EFI_PEI_SMBUS_NOTIFY_FUNCTION)(
97 IN EFI_PEI_SERVICES **PeiServices,
98 IN EFI_PEI_SMBUS_PPI *SmbusPpi,
99 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
100 IN UINTN Data
101 );
102
103 /**
104 The ArpDevice() function enumerates the entire bus or enumerates a specific
105 device that is identified by SmbusUdid.
106
107 @param PeiServices A pointer to the system PEI Services Table.
108 @param This A pointer to the EFI_PEI_SMBUS_PPI instance.
109 @param ArpAll A Boolean expression that indicates if the host drivers need
110 to enumerate all the devices or enumerate only the device that is identified
111 by SmbusUdid. If ArpAll is TRUE, SmbusUdid and SlaveAddress are optional.
112 If ArpAll is FALSE, ArpDevice will enumerate SmbusUdid and the address
113 will be at SlaveAddress.
114 @param SmbusUdid The targeted SMBus Unique Device Identifier (UDID).
115 The UDID may not exist for SMBus devices with fixed addresses.
116 @param SlaveAddress The new SMBus address for the slave device for
117 which the operation is targeted.
118
119 @retval EFI_SUCCESS The SMBus slave device address was set.
120 @retval EFI_INVALID_PARAMETER SlaveAddress is NULL.
121 @retval EFI_OUT_OF_RESOURCES The request could not be completed
122 due to a lack of resources.
123 @retval EFI_TIMEOUT The SMBus slave device did not respond.
124 @retval EFI_DEVICE_ERROR The request was not completed because the transaction failed.
125
126 **/
127 typedef
128 EFI_STATUS
129 (EFIAPI *EFI_PEI_SMBUS_PPI_ARP_DEVICE)(
130 IN EFI_PEI_SERVICES **PeiServices,
131 IN EFI_PEI_SMBUS_PPI *This,
132 IN BOOLEAN ArpAll,
133 IN EFI_SMBUS_UDID *SmbusUdid, OPTIONAL
134 IN OUT EFI_SMBUS_DEVICE_ADDRESS *SlaveAddress OPTIONAL
135 );
136
137 /**
138 The GetArpMap() function returns the mapping of all the SMBus devices
139 that are enumerated by the SMBus host driver.
140
141 @param PeiServices A pointer to the system PEI Services Table.
142 @param This A pointer to the EFI_PEI_SMBUS_PPI instance.
143 @param Length Size of the buffer that contains the SMBus device map.
144 @param SmbusDeviceMap The pointer to the device map as enumerated
145 by the SMBus controller driver.
146
147 @retval EFI_SUCCESS The device map was returned correctly in the buffer.
148
149 **/
150 typedef
151 EFI_STATUS
152 (EFIAPI *EFI_PEI_SMBUS_PPI_GET_ARP_MAP)(
153 IN EFI_PEI_SERVICES **PeiServices,
154 IN EFI_PEI_SMBUS_PPI *This,
155 IN OUT UINTN *Length,
156 IN OUT EFI_SMBUS_DEVICE_MAP **SmbusDeviceMap
157 );
158
159 /**
160 The Notify() function registers all the callback functions to allow the
161 bus driver to call these functions when the SlaveAddress/Data pair happens.
162
163 @param PeiServices A pointer to the system PEI Services Table.
164 @param This A pointer to the EFI_PEI_SMBUS_PPI instance.
165 @param SlaveAddress Address that the host controller detects as
166 sending a message and calls all the registered functions.
167 @param Data Data that the host controller detects as sending a message
168 and calls all the registered functions.
169 @param NotifyFunction The function to call when the bus driver
170 detects the SlaveAddress and Data pair.
171
172 @retval EFI_SUCCESS NotifyFunction has been registered.
173
174 **/
175 typedef
176 EFI_STATUS
177 (EFIAPI *EFI_PEI_SMBUS_PPI_NOTIFY)(
178 IN EFI_PEI_SERVICES **PeiServices,
179 IN EFI_PEI_SMBUS_PPI *This,
180 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
181 IN UINTN Data,
182 IN EFI_PEI_SMBUS_NOTIFY_FUNCTION NotifyFunction
183 );
184
185 /**
186 @par Ppi Description:
187 Provides the basic I/O interfaces that a PEIM uses to access
188 its SMBus controller and the slave devices attached to it.
189
190 @param Execute
191 Executes the SMBus operation to an SMBus slave device.
192
193 @param ArpDevice
194 Allows an SMBus 2.0 device(s) to be Address Resolution Protocol (ARP)
195
196 @param GetArpMap
197 Allows a PEIM to retrieve the address that was allocated by the SMBus
198 host controller during enumeration/ARP.
199
200 @param Notify
201 Allows a driver to register for a callback to the SMBus host
202 controller driver when the bus issues a notification to the bus controller PEIM.
203
204 **/
205 struct _EFI_PEI_SMBUS_PPI {
206 EFI_PEI_SMBUS_PPI_EXECUTE_OPERATION Execute;
207 EFI_PEI_SMBUS_PPI_ARP_DEVICE ArpDevice;
208 EFI_PEI_SMBUS_PPI_GET_ARP_MAP GetArpMap;
209 EFI_PEI_SMBUS_PPI_NOTIFY Notify;
210 };
211
212 extern EFI_GUID gEfiPeiSmbusPpiGuid;
213
214 #endif