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