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.
5 Copyright (c) 2007 - 2009, 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
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.
14 @par Revision Reference:
15 This PPI is defined in Framework of EFI SmBus PPI spec.
20 #ifndef _PEI_SMBUS_PPI_H_
21 #define _PEI_SMBUS_PPI_H_
24 #include <Ppi/Smbus2.h>
26 #define EFI_PEI_SMBUS_PPI_GUID \
28 0xabd42895, 0x78cf, 0x4872, {0x84, 0x44, 0x1b, 0x5c, 0x18, 0xb, 0xfb, 0xda } \
31 typedef struct _EFI_PEI_SMBUS_PPI EFI_PEI_SMBUS_PPI
;
34 Executes an SMBus operation to an SMBus controller.
36 @param[in] PeiServices A pointer to the system PEI Services Table.
37 @param[in] This A pointer to the EFI_PEI_SMBUS_PPI instance.
38 @param[in] SlaveAddress The SMBUS hardware address to which the SMBUS
39 device is preassigned or allocated.
40 @param[in] 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[in] Operation Signifies which particular SMBus hardware protocol
44 instance that it will use to execute the SMBus transactions.
45 @param[in] PecCheck Defines if Packet Error Code (PEC) checking is required
47 @param[in, out] Length Signifies the number of bytes that this operation will do.
48 @param[in, out] Buffer Contains the value of data to execute to the SMBus slave device.
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 @retval EFI_INVALID_PARAMETER 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.
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
,
80 CallBack function can be registered in EFI_PEI_SMBUS_PPI_NOTIFY.
82 @param[in] PeiServices A pointer to the system PEI Services Table.
83 @param[in] This A pointer to the EFI_PEI_SMBUS_PPI instance.
84 @param[in] SlaveAddress The SMBUS hardware address to which the SMBUS
85 device is preassigned or allocated.
86 @param[in] Data Data of the SMBus host notify command that
87 the caller wants to be called.
89 @return Status Code returned by callback function.
94 (EFIAPI
*EFI_PEI_SMBUS_NOTIFY_FUNCTION
)(
95 IN EFI_PEI_SERVICES
**PeiServices
,
96 IN EFI_PEI_SMBUS_PPI
*SmbusPpi
,
97 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress
,
102 The ArpDevice() function enumerates the entire bus or enumerates a specific
103 device that is identified by SmbusUdid.
105 @param[in] PeiServices A pointer to the system PEI Services Table.
106 @param[in] This A pointer to the EFI_PEI_SMBUS_PPI instance.
107 @param[in] ArpAll A Boolean expression that indicates if the host drivers need
108 to enumerate all the devices or enumerate only the device that is identified
109 by SmbusUdid. If ArpAll is TRUE, SmbusUdid and SlaveAddress are optional.
110 If ArpAll is FALSE, ArpDevice will enumerate SmbusUdid and the address
111 will be at SlaveAddress.
112 @param[in] SmbusUdid The targeted SMBus Unique Device Identifier (UDID).
113 The UDID may not exist for SMBus devices with fixed addresses.
114 @param[in, out] SlaveAddress The new SMBus address for the slave device for
115 which the operation is targeted.
117 @retval EFI_SUCCESS The SMBus slave device address was set.
118 @retval EFI_INVALID_PARAMETER SlaveAddress is NULL.
119 @retval EFI_OUT_OF_RESOURCES The request could not be completed
120 due to a lack of resources.
121 @retval EFI_TIMEOUT The SMBus slave device did not respond.
122 @retval EFI_DEVICE_ERROR The request was not completed because the transaction failed.
127 (EFIAPI
*EFI_PEI_SMBUS_PPI_ARP_DEVICE
)(
128 IN EFI_PEI_SERVICES
**PeiServices
,
129 IN EFI_PEI_SMBUS_PPI
*This
,
131 IN EFI_SMBUS_UDID
*SmbusUdid
, OPTIONAL
132 IN OUT EFI_SMBUS_DEVICE_ADDRESS
*SlaveAddress OPTIONAL
136 The GetArpMap() function returns the mapping of all the SMBus devices
137 that are enumerated by the SMBus host driver.
139 @param[in] PeiServices A pointer to the system PEI Services Table.
140 @param[in] This A pointer to the EFI_PEI_SMBUS_PPI instance.
141 @param[in, out] Length Size of the buffer that contains the SMBus device map.
142 @param[in, out] SmbusDeviceMap The pointer to the device map as enumerated
143 by the SMBus controller driver.
145 @retval EFI_SUCCESS The device map was returned correctly in the buffer.
150 (EFIAPI
*EFI_PEI_SMBUS_PPI_GET_ARP_MAP
)(
151 IN EFI_PEI_SERVICES
**PeiServices
,
152 IN EFI_PEI_SMBUS_PPI
*This
,
153 IN OUT UINTN
*Length
,
154 IN OUT EFI_SMBUS_DEVICE_MAP
**SmbusDeviceMap
158 Allows a device driver to register for a callback when the bus driver detects a state that it needs to
159 propagate to other PEIMs that are registered for a callback.
161 The Notify() function registers all the callback functions to allow the
162 bus driver to call these functions when the SlaveAddress/Data pair happens.
164 @param[in] PeiServices A pointer to the system PEI Services Table.
165 @param[in] This A pointer to the EFI_PEI_SMBUS_PPI instance.
166 @param[in] SlaveAddress Address that the host controller detects as
167 sending a message and calls all the registered functions.
168 @param[in] Data Data that the host controller detects as sending a message
169 and calls all the registered functions.
170 @param[in] NotifyFunction The function to call when the bus driver
171 detects the SlaveAddress and Data pair.
173 @retval EFI_SUCCESS NotifyFunction has been registered.
178 (EFIAPI
*EFI_PEI_SMBUS_PPI_NOTIFY
)(
179 IN EFI_PEI_SERVICES
**PeiServices
,
180 IN EFI_PEI_SMBUS_PPI
*This
,
181 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress
,
183 IN EFI_PEI_SMBUS_NOTIFY_FUNCTION NotifyFunction
187 /// Provides the basic I/O interfaces that a PEIM uses to access
188 /// its SMBus controller and the slave devices attached to it.
190 struct _EFI_PEI_SMBUS_PPI
{
192 /// Executes the SMBus operation to an SMBus slave device.
194 EFI_PEI_SMBUS_PPI_EXECUTE_OPERATION Execute
;
197 /// Allows an SMBus 2.0 device(s) to be Address Resolution Protocol (ARP)
199 EFI_PEI_SMBUS_PPI_ARP_DEVICE ArpDevice
;
202 /// Allows a PEIM to retrieve the address that was allocated by the SMBus
203 /// host controller during enumeration/ARP.
205 EFI_PEI_SMBUS_PPI_GET_ARP_MAP GetArpMap
;
208 /// Allows a driver to register for a callback to the SMBus host
209 /// controller driver when the bus issues a notification to the bus controller PEIM.
211 EFI_PEI_SMBUS_PPI_NOTIFY Notify
;
214 extern EFI_GUID gEfiPeiSmbusPpiGuid
;