]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkPkg/Include/Ppi/Smbus.h
Updated IntelFrameworkPkg.nspd to add GUID/PPI/Protocol definitions.
[mirror_edk2.git] / IntelFrameworkPkg / Include / Ppi / Smbus.h
1 /** @file
2 This file declares Smbus PPI.
3
4 Copyright (c) 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: Smbus.h
14
15 @par Revision Reference:
16 This PPI is defined in Framework of EFI SmBus PPI spec.
17 Version 0.9
18
19 **/
20
21 #ifndef _PEI_SMBUS_PPI_H
22 #define _PEI_SMBUS_PPI_H
23
24 #include <IndustryStandard/SmBus.h>
25
26 #define EFI_PEI_SMBUS_PPI_GUID \
27 { \
28 0xabd42895, 0x78cf, 0x4872, {0x84, 0x44, 0x1b, 0x5c, 0x18, 0xb, 0xfb, 0xda } \
29 }
30
31 typedef struct _EFI_PEI_SMBUS_PPI EFI_PEI_SMBUS_PPI;
32
33 /**
34 Executes an SMBus operation to an SMBus controller.
35
36 @param PeiServices A pointer to the system PEI Services Table.
37 @param This A pointer to the EFI_PEI_SMBUS_PPI instance.
38 @param SlaveAddress The SMBUS hardware address to which the SMBUS
39 device is preassigned or allocated.
40 @param Command This command is transmitted by the SMBus host
41 controller to the SMBus slave device and the interpretation is
42 SMBus slave device specific.
43 @param Operation Signifies which particular SMBus hardware protocol
44 instance that it will use to execute the SMBus transactions.
45 @param PecCheck Defines if Packet Error Code (PEC) checking is required
46 for this operation.
47 @param Length Signifies the number of bytes that this operation will do.
48 @param Buffer Contains the value of data to execute to the SMBus slave device.
49
50 @retval EFI_SUCCESS The last data that was returned from the access
51 matched the poll exit criteria.
52 @retval EFI_CRC_ERROR The checksum is not correct (PEC is incorrect)
53 @retval EFI_TIMEOUT Timeout expired before the operation was completed.
54 Timeout is determined by the SMBus host controller device.
55 @retval EFI_OUT_OF_RESOURCES The request could not be completed
56 due to a lack of resources.
57 @retval EFI_DEVICE_ERROR The request was not completed because
58 a failure reflected in the Host Status Register bit.
59 @retval EFI_INVALID_PARAMETER Operation is not defined in EFI_SMBUS_OPERATION.
60 Or Length/Buffer is NULL for operations except for EfiSmbusQuickRead and
61 EfiSmbusQuickWrite. Length is outside the range of valid values.
62 @retval EFI_UNSUPPORTED The SMBus operation or PEC is not supported.
63 @retval EFI_BUFFER_TOO_SMALL Buffer is not sufficient for this operation.
64
65 **/
66 typedef
67 EFI_STATUS
68 (EFIAPI *EFI_PEI_SMBUS_PPI_EXECUTE_OPERATION) (
69 IN EFI_PEI_SERVICES **PeiServices,
70 IN EFI_PEI_SMBUS_PPI *This,
71 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
72 IN EFI_SMBUS_DEVICE_COMMAND Command,
73 IN EFI_SMBUS_OPERATION Operation,
74 IN BOOLEAN PecCheck,
75 IN OUT UINTN *Length,
76 IN OUT VOID *Buffer
77 );
78
79 typedef struct {
80 UINT32 VendorSpecificId;
81 UINT16 SubsystemDeviceId;
82 UINT16 SubsystemVendorId;
83 UINT16 Interface;
84 UINT16 DeviceId;
85 UINT16 VendorId;
86 UINT8 VendorRevision;
87 UINT8 DeviceCapabilities;
88 } EFI_SMBUS_UDID;
89
90 /**
91 CallBack function can be registered in EFI_PEI_SMBUS_PPI_NOTIFY.
92
93 @param PeiServices A pointer to the system PEI Services Table.
94 @param This A pointer to the EFI_PEI_SMBUS_PPI instance.
95 @param SlaveAddress The SMBUS hardware address to which the SMBUS
96 device is preassigned or allocated.
97 @param Data Data of the SMBus host notify command that
98 the caller wants to be called.
99
100 @return Status Code
101
102 **/
103 typedef
104 EFI_STATUS
105 (EFIAPI *EFI_PEI_SMBUS_NOTIFY_FUNCTION) (
106 IN EFI_PEI_SERVICES **PeiServices,
107 IN EFI_PEI_SMBUS_PPI *SmbusPpi,
108 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
109 IN UINTN Data
110 );
111
112 /**
113 The ArpDevice() function enumerates the entire bus or enumerates a specific
114 device that is identified by SmbusUdid.
115
116 @param PeiServices A pointer to the system PEI Services Table.
117 @param This A pointer to the EFI_PEI_SMBUS_PPI instance.
118 @param ArpAll A Boolean expression that indicates if the host drivers need
119 to enumerate all the devices or enumerate only the device that is identified
120 by SmbusUdid. If ArpAll is TRUE, SmbusUdid and SlaveAddress are optional.
121 If ArpAll is FALSE, ArpDevice will enumerate SmbusUdid and the address
122 will be at SlaveAddress.
123 @param SmbusUdid The targeted SMBus Unique Device Identifier (UDID).
124 The UDID may not exist for SMBus devices with fixed addresses.
125 @param SlaveAddress The new SMBus address for the slave device for
126 which the operation is targeted.
127
128 @retval EFI_SUCCESS The SMBus slave device address was set.
129 @retval EFI_INVALID_PARAMETER SlaveAddress is NULL.
130 @retval EFI_OUT_OF_RESOURCES The request could not be completed
131 due to a lack of resources.
132 @retval EFI_TIMEOUT The SMBus slave device did not respond.
133 @retval EFI_DEVICE_ERROR The request was not completed because the transaction failed.
134
135 **/
136 typedef
137 EFI_STATUS
138 (EFIAPI *EFI_PEI_SMBUS_PPI_ARP_DEVICE) (
139 IN EFI_PEI_SERVICES **PeiServices,
140 IN EFI_PEI_SMBUS_PPI *This,
141 IN BOOLEAN ArpAll,
142 IN EFI_SMBUS_UDID *SmbusUdid, OPTIONAL
143 IN OUT EFI_SMBUS_DEVICE_ADDRESS *SlaveAddress OPTIONAL
144 );
145
146 typedef struct {
147 EFI_SMBUS_DEVICE_ADDRESS SmbusDeviceAddress;
148 EFI_SMBUS_UDID SmbusDeviceUdid;
149 } EFI_SMBUS_DEVICE_MAP;
150
151 /**
152 The GetArpMap() function returns the mapping of all the SMBus devices
153 that are enumerated by the SMBus host driver.
154
155 @param PeiServices A pointer to the system PEI Services Table.
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_SMBUS_PPI_GET_ARP_MAP) (
167 IN EFI_PEI_SERVICES **PeiServices,
168 IN EFI_PEI_SMBUS_PPI *This,
169 IN OUT UINTN *Length,
170 IN OUT EFI_SMBUS_DEVICE_MAP **SmbusDeviceMap
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_SMBUS_PPI_NOTIFY) (
192 IN EFI_PEI_SERVICES **PeiServices,
193 IN EFI_PEI_SMBUS_PPI *This,
194 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
195 IN UINTN Data,
196 IN EFI_PEI_SMBUS_NOTIFY_FUNCTION NotifyFunction
197 );
198
199 /**
200 @par Ppi Description:
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 @param Execute
205 Executes the SMBus operation to an SMBus slave device.
206
207 @param ArpDevice
208 Allows an SMBus 2.0 device(s) to be Address Resolution Protocol (ARP)
209
210 @param GetArpMap
211 Allows a PEIM to retrieve the address that was allocated by the SMBus
212 host controller during enumeration/ARP.
213
214 @param Notify
215 Allows a driver to register for a callback to the SMBus host
216 controller driver when the bus issues a notification to the bus controller PEIM.
217
218 **/
219 struct _EFI_PEI_SMBUS_PPI {
220 EFI_PEI_SMBUS_PPI_EXECUTE_OPERATION Execute;
221 EFI_PEI_SMBUS_PPI_ARP_DEVICE ArpDevice;
222 EFI_PEI_SMBUS_PPI_GET_ARP_MAP GetArpMap;
223 EFI_PEI_SMBUS_PPI_NOTIFY Notify;
224 };
225
226 extern EFI_GUID gEfiPeiSmbusPpiGuid;
227
228 #endif