2007-06-15 12:02:42 +02:00
|
|
|
/** @file
|
2009-07-28 15:25:37 +02:00
|
|
|
This file declares the Smbus PPI, which provides the basic I/O interfaces that a PEIM
|
2008-04-08 08:29:25 +02:00
|
|
|
uses to access its SMBus controller and the slave devices attached to it.
|
2007-06-15 12:02:42 +02:00
|
|
|
|
2010-04-23 17:52:13 +02:00
|
|
|
Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
|
2010-03-16 02:53:11 +01:00
|
|
|
This program and the accompanying materials are licensed and made available under
|
|
|
|
the terms and conditions of the BSD License that accompanies this distribution.
|
|
|
|
The full text of the license may be found at
|
|
|
|
http://opensource.org/licenses/bsd-license.php.
|
|
|
|
|
|
|
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
2007-06-15 12:02:42 +02:00
|
|
|
|
|
|
|
@par Revision Reference:
|
|
|
|
This PPI is defined in Framework of EFI SmBus PPI spec.
|
2010-03-16 02:53:11 +01:00
|
|
|
Version 0.9.
|
2007-06-15 12:02:42 +02:00
|
|
|
|
|
|
|
**/
|
|
|
|
|
2008-12-04 07:12:44 +01:00
|
|
|
#ifndef _PEI_SMBUS_PPI_H_
|
|
|
|
#define _PEI_SMBUS_PPI_H_
|
2007-06-15 12:02:42 +02:00
|
|
|
|
2007-07-19 07:21:21 +02:00
|
|
|
#include <Ppi/Smbus2.h>
|
2007-06-15 12:02:42 +02:00
|
|
|
|
|
|
|
#define EFI_PEI_SMBUS_PPI_GUID \
|
|
|
|
{ \
|
|
|
|
0xabd42895, 0x78cf, 0x4872, {0x84, 0x44, 0x1b, 0x5c, 0x18, 0xb, 0xfb, 0xda } \
|
|
|
|
}
|
|
|
|
|
|
|
|
typedef struct _EFI_PEI_SMBUS_PPI EFI_PEI_SMBUS_PPI;
|
|
|
|
|
|
|
|
/**
|
|
|
|
Executes an SMBus operation to an SMBus controller.
|
|
|
|
|
2009-07-06 05:15:53 +02:00
|
|
|
@param[in] PeiServices A pointer to the system PEI Services Table.
|
|
|
|
@param[in] This A pointer to the EFI_PEI_SMBUS_PPI instance.
|
|
|
|
@param[in] SlaveAddress The SMBUS hardware address to which the SMBUS
|
|
|
|
device is preassigned or allocated.
|
|
|
|
@param[in] Command This command is transmitted by the SMBus host
|
2010-03-16 02:53:11 +01:00
|
|
|
controller to the SMBus slave device, and the
|
|
|
|
interpretation is SMBus slave device specific.
|
2009-07-06 05:15:53 +02:00
|
|
|
@param[in] Operation Signifies which particular SMBus hardware protocol
|
2009-07-28 15:25:37 +02:00
|
|
|
instance to use to execute the SMBus transactions.
|
2010-03-16 02:53:11 +01:00
|
|
|
@param[in] PecCheck Defines if Packet Error Code (PEC) checking is
|
|
|
|
required for this operation.
|
|
|
|
@param[in, out] Length The number of bytes for this operation.
|
|
|
|
@param[in, out] Buffer Contains the value of data to execute to the SMBus
|
|
|
|
slave device.
|
2007-06-15 12:02:42 +02:00
|
|
|
|
|
|
|
@retval EFI_SUCCESS The last data that was returned from the access
|
|
|
|
matched the poll exit criteria.
|
2009-07-03 08:46:14 +02:00
|
|
|
@retval EFI_CRC_ERROR The checksum is not correct (PEC is incorrect).
|
2007-06-15 12:02:42 +02:00
|
|
|
@retval EFI_TIMEOUT Timeout expired before the operation was completed.
|
|
|
|
Timeout is determined by the SMBus host controller device.
|
|
|
|
@retval EFI_OUT_OF_RESOURCES The request could not be completed
|
|
|
|
due to a lack of resources.
|
2010-03-16 02:53:11 +01:00
|
|
|
@retval EFI_DEVICE_ERROR The request was not completed because a failure
|
|
|
|
was recorded in the Host Status Register bit.
|
|
|
|
@retval EFI_INVALID_PARAMETER The operation is not defined in EFI_SMBUS_OPERATION.
|
|
|
|
@retval EFI_INVALID_PARAMETER Length/Buffer is NULL for operations except for
|
|
|
|
EfiSmbusQuickRead and EfiSmbusQuickWrite. Length
|
|
|
|
is outside the range of valid values.
|
2007-06-15 12:02:42 +02:00
|
|
|
@retval EFI_UNSUPPORTED The SMBus operation or PEC is not supported.
|
|
|
|
@retval EFI_BUFFER_TOO_SMALL Buffer is not sufficient for this operation.
|
|
|
|
|
|
|
|
**/
|
|
|
|
typedef
|
|
|
|
EFI_STATUS
|
2008-07-31 09:44:54 +02:00
|
|
|
(EFIAPI *EFI_PEI_SMBUS_PPI_EXECUTE_OPERATION)(
|
2007-06-15 12:02:42 +02:00
|
|
|
IN EFI_PEI_SERVICES **PeiServices,
|
2009-02-05 09:42:01 +01:00
|
|
|
IN EFI_PEI_SMBUS_PPI *This,
|
2007-06-15 12:02:42 +02:00
|
|
|
IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
|
|
|
|
IN EFI_SMBUS_DEVICE_COMMAND Command,
|
|
|
|
IN EFI_SMBUS_OPERATION Operation,
|
|
|
|
IN BOOLEAN PecCheck,
|
|
|
|
IN OUT UINTN *Length,
|
|
|
|
IN OUT VOID *Buffer
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
2009-07-28 15:25:37 +02:00
|
|
|
This function is user-defined, and is called when the SlaveAddress/Data pair happens.
|
2009-07-09 05:03:32 +02:00
|
|
|
|
2009-07-06 05:15:53 +02:00
|
|
|
@param[in] PeiServices A pointer to the system PEI Services Table.
|
|
|
|
@param[in] This A pointer to the EFI_PEI_SMBUS_PPI instance.
|
|
|
|
@param[in] SlaveAddress The SMBUS hardware address to which the SMBUS
|
|
|
|
device is preassigned or allocated.
|
2009-07-28 15:25:37 +02:00
|
|
|
@param[in] Data Data of the SMBus host notify command, which denotes that
|
2009-07-06 05:15:53 +02:00
|
|
|
the caller wants to be called.
|
2007-06-15 12:02:42 +02:00
|
|
|
|
2009-07-03 08:46:14 +02:00
|
|
|
@return Status Code returned by callback function.
|
2007-06-15 12:02:42 +02:00
|
|
|
|
|
|
|
**/
|
|
|
|
typedef
|
|
|
|
EFI_STATUS
|
2008-07-31 09:44:54 +02:00
|
|
|
(EFIAPI *EFI_PEI_SMBUS_NOTIFY_FUNCTION)(
|
2007-06-15 12:02:42 +02:00
|
|
|
IN EFI_PEI_SERVICES **PeiServices,
|
2009-02-05 09:42:01 +01:00
|
|
|
IN EFI_PEI_SMBUS_PPI *SmbusPpi,
|
2007-06-15 12:02:42 +02:00
|
|
|
IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
|
|
|
|
IN UINTN Data
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
2009-07-28 15:25:37 +02:00
|
|
|
The ArpDevice() function enumerates either the entire bus or a specific
|
|
|
|
device identified by SmbusUdid.
|
2007-06-15 12:02:42 +02:00
|
|
|
|
2009-07-06 05:15:53 +02:00
|
|
|
@param[in] PeiServices A pointer to the system PEI Services Table.
|
|
|
|
@param[in] This A pointer to the EFI_PEI_SMBUS_PPI instance.
|
2010-03-16 02:53:11 +01:00
|
|
|
@param[in] ArpAll A Boolean expression that indicates if the host
|
|
|
|
drivers need to enumerate all the devices or to
|
|
|
|
enumerate only the device that is identified
|
|
|
|
by SmbusUdid. If ArpAll is TRUE, SmbusUdid and
|
|
|
|
SlaveAddress are optional and ignored if entered.
|
|
|
|
If ArpAll is FALSE, ArpDevice will enumerate
|
|
|
|
SmbusUdid, and the address will be at SlaveAddress.
|
2009-07-06 05:15:53 +02:00
|
|
|
@param[in] SmbusUdid The targeted SMBus Unique Device Identifier (UDID).
|
2010-03-16 02:53:11 +01:00
|
|
|
The UDID may not exist for SMBus devices with fixed
|
|
|
|
addresses.
|
2009-07-06 05:15:53 +02:00
|
|
|
@param[in, out] SlaveAddress The new SMBus address for the slave device for
|
|
|
|
which the operation is targeted.
|
2009-07-09 05:03:32 +02:00
|
|
|
This address may be NULL.
|
2007-06-15 12:02:42 +02:00
|
|
|
|
|
|
|
@retval EFI_SUCCESS The SMBus slave device address was set.
|
|
|
|
@retval EFI_INVALID_PARAMETER SlaveAddress is NULL.
|
|
|
|
@retval EFI_OUT_OF_RESOURCES The request could not be completed
|
|
|
|
due to a lack of resources.
|
|
|
|
@retval EFI_TIMEOUT The SMBus slave device did not respond.
|
|
|
|
@retval EFI_DEVICE_ERROR The request was not completed because the transaction failed.
|
2009-07-28 15:25:37 +02:00
|
|
|
@retval EFI_UNSUPPORTED ArpDevice() is not implemented by this PEIM.
|
2010-03-16 02:53:11 +01:00
|
|
|
This return value is not defined in the Framework Specification.
|
2009-07-28 15:25:37 +02:00
|
|
|
This return value was introduced in the PI Specification.
|
2007-06-15 12:02:42 +02:00
|
|
|
|
|
|
|
**/
|
|
|
|
typedef
|
|
|
|
EFI_STATUS
|
2008-07-31 09:44:54 +02:00
|
|
|
(EFIAPI *EFI_PEI_SMBUS_PPI_ARP_DEVICE)(
|
2007-06-15 12:02:42 +02:00
|
|
|
IN EFI_PEI_SERVICES **PeiServices,
|
2009-02-05 09:42:01 +01:00
|
|
|
IN EFI_PEI_SMBUS_PPI *This,
|
2007-06-15 12:02:42 +02:00
|
|
|
IN BOOLEAN ArpAll,
|
|
|
|
IN EFI_SMBUS_UDID *SmbusUdid, OPTIONAL
|
|
|
|
IN OUT EFI_SMBUS_DEVICE_ADDRESS *SlaveAddress OPTIONAL
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
The GetArpMap() function returns the mapping of all the SMBus devices
|
|
|
|
that are enumerated by the SMBus host driver.
|
|
|
|
|
2009-07-06 05:15:53 +02:00
|
|
|
@param[in] PeiServices A pointer to the system PEI Services Table.
|
|
|
|
@param[in] This A pointer to the EFI_PEI_SMBUS_PPI instance.
|
2010-03-16 02:53:11 +01:00
|
|
|
@param[in, out] Length The size of the buffer that contains the SMBus device map.
|
2009-07-06 05:15:53 +02:00
|
|
|
@param[in, out] SmbusDeviceMap The pointer to the device map as enumerated
|
|
|
|
by the SMBus controller driver.
|
2007-06-15 12:02:42 +02:00
|
|
|
|
2009-07-09 05:03:32 +02:00
|
|
|
@retval EFI_SUCCESS The device map was returned correctly in the buffer.
|
|
|
|
@retval EFI_UNSUPPORTED GetArpMap() are not implemented by this PEIM.
|
2010-03-16 02:53:11 +01:00
|
|
|
This return value was not defined in the Framework Specification.
|
2009-07-28 15:25:37 +02:00
|
|
|
This return value was introduced in the PI Specification.
|
2007-06-15 12:02:42 +02:00
|
|
|
|
|
|
|
**/
|
|
|
|
typedef
|
|
|
|
EFI_STATUS
|
2008-07-31 09:44:54 +02:00
|
|
|
(EFIAPI *EFI_PEI_SMBUS_PPI_GET_ARP_MAP)(
|
2007-06-15 12:02:42 +02:00
|
|
|
IN EFI_PEI_SERVICES **PeiServices,
|
2009-02-05 09:42:01 +01:00
|
|
|
IN EFI_PEI_SMBUS_PPI *This,
|
2007-06-15 12:02:42 +02:00
|
|
|
IN OUT UINTN *Length,
|
|
|
|
IN OUT EFI_SMBUS_DEVICE_MAP **SmbusDeviceMap
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
2009-07-03 08:46:14 +02:00
|
|
|
Allows a device driver to register for a callback when the bus driver detects a state that it needs to
|
|
|
|
propagate to other PEIMs that are registered for a callback.
|
|
|
|
|
2007-06-15 12:02:42 +02:00
|
|
|
The Notify() function registers all the callback functions to allow the
|
2010-03-16 02:53:11 +01:00
|
|
|
bus driver to call these functions when the SlaveAddress/Data pair occur.
|
2009-07-09 05:03:32 +02:00
|
|
|
All functions to be registered with EFI_PEI_SMBUS_PPI_NOTIFY must be of type
|
|
|
|
EFI_PEI_SMBUS_NOTIFY_FUNCTION.
|
2007-06-15 12:02:42 +02:00
|
|
|
|
2009-07-06 05:15:53 +02:00
|
|
|
@param[in] PeiServices A pointer to the system PEI Services Table.
|
|
|
|
@param[in] This A pointer to the EFI_PEI_SMBUS_PPI instance.
|
2010-03-16 02:53:11 +01:00
|
|
|
@param[in] SlaveAddress The address that the host controller detects as
|
2009-07-28 15:25:37 +02:00
|
|
|
sending a message and triggers all the registered functions.
|
2009-07-06 05:15:53 +02:00
|
|
|
@param[in] Data Data that the host controller detects as sending a message
|
2009-07-28 15:25:37 +02:00
|
|
|
and triggers all the registered functions.
|
2009-07-06 05:15:53 +02:00
|
|
|
@param[in] NotifyFunction The function to call when the bus driver
|
|
|
|
detects the SlaveAddress and Data pair.
|
2007-06-15 12:02:42 +02:00
|
|
|
|
2009-07-06 05:15:53 +02:00
|
|
|
@retval EFI_SUCCESS NotifyFunction has been registered.
|
2009-07-09 05:03:32 +02:00
|
|
|
@retval EFI_UNSUPPORTED Notify() are not implemented by this PEIM.
|
2010-03-16 02:53:11 +01:00
|
|
|
This return value is not defined in the Framework Specification.
|
2009-07-28 15:25:37 +02:00
|
|
|
This return value was introduced in the PI Specification.
|
2007-06-15 12:02:42 +02:00
|
|
|
|
|
|
|
**/
|
|
|
|
typedef
|
|
|
|
EFI_STATUS
|
2008-07-31 09:44:54 +02:00
|
|
|
(EFIAPI *EFI_PEI_SMBUS_PPI_NOTIFY)(
|
2009-07-03 08:46:14 +02:00
|
|
|
IN EFI_PEI_SERVICES **PeiServices,
|
|
|
|
IN EFI_PEI_SMBUS_PPI *This,
|
|
|
|
IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
|
|
|
|
IN UINTN Data,
|
2009-02-05 09:42:01 +01:00
|
|
|
IN EFI_PEI_SMBUS_NOTIFY_FUNCTION NotifyFunction
|
2007-06-15 12:02:42 +02:00
|
|
|
);
|
|
|
|
|
2009-07-03 08:46:14 +02:00
|
|
|
///
|
|
|
|
/// Provides the basic I/O interfaces that a PEIM uses to access
|
|
|
|
/// its SMBus controller and the slave devices attached to it.
|
|
|
|
///
|
2007-06-15 12:02:42 +02:00
|
|
|
struct _EFI_PEI_SMBUS_PPI {
|
2009-07-02 09:40:24 +02:00
|
|
|
///
|
|
|
|
/// Executes the SMBus operation to an SMBus slave device.
|
|
|
|
///
|
2007-06-15 12:02:42 +02:00
|
|
|
EFI_PEI_SMBUS_PPI_EXECUTE_OPERATION Execute;
|
2009-07-02 09:40:24 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
/// Allows an SMBus 2.0 device(s) to be Address Resolution Protocol (ARP)
|
|
|
|
///
|
2007-06-15 12:02:42 +02:00
|
|
|
EFI_PEI_SMBUS_PPI_ARP_DEVICE ArpDevice;
|
2009-07-02 09:40:24 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
/// Allows a PEIM to retrieve the address that was allocated by the SMBus
|
|
|
|
/// host controller during enumeration/ARP.
|
|
|
|
///
|
2007-06-15 12:02:42 +02:00
|
|
|
EFI_PEI_SMBUS_PPI_GET_ARP_MAP GetArpMap;
|
2009-07-02 09:40:24 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
/// Allows a driver to register for a callback to the SMBus host
|
|
|
|
/// controller driver when the bus issues a notification to the bus controller PEIM.
|
|
|
|
///
|
2007-06-15 12:02:42 +02:00
|
|
|
EFI_PEI_SMBUS_PPI_NOTIFY Notify;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern EFI_GUID gEfiPeiSmbusPpiGuid;
|
|
|
|
|
|
|
|
#endif
|