2007-06-19 12:12:02 +02:00
|
|
|
/** @file
|
|
|
|
The file provides basic SMBus host controller management
|
|
|
|
and basic data transactions over the SMBus.
|
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
Copyright (c) 2006 - 2008, Intel Corporation
|
2007-06-19 12:12:02 +02:00
|
|
|
All rights reserved. This program and the accompanying materials
|
|
|
|
are licensed and made available under the terms and conditions of the BSD License
|
|
|
|
which 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.
|
|
|
|
|
|
|
|
@par Revision Reference: PI
|
|
|
|
Version 1.00.
|
|
|
|
|
|
|
|
**/
|
|
|
|
|
|
|
|
#ifndef __SMBUS_HC_H__
|
|
|
|
#define __SMBUS_HC_H__
|
|
|
|
|
|
|
|
#include <Ppi/Smbus2.h>
|
|
|
|
|
|
|
|
#define EFI_SMBUS_HC_PROTOCOL_GUID \
|
|
|
|
{0xe49d33ed, 0x513d, 0x4634, { 0xb6, 0x98, 0x6f, 0x55, 0xaa, 0x75, 0x1c, 0x1b} }
|
|
|
|
|
|
|
|
typedef struct _EFI_SMBUS_HC_PROTOCOL EFI_SMBUS_HC_PROTOCOL;
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
The Execute() function provides a standard way to execute an
|
|
|
|
operation as defined in the System Management Bus (SMBus)
|
|
|
|
Specification. The resulting transaction will be either that
|
|
|
|
the SMBus slave devices accept this transaction or that this
|
|
|
|
function returns with error. Status Codes Returned
|
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
@param This A pointer to the EFI_SMBUS_HC_PROTOCOL instance.
|
|
|
|
SlaveAddress The SMBus slave address of the device
|
|
|
|
with which to communicate. Type
|
|
|
|
EFI_SMBUS_DEVICE_ADDRESS is defined in
|
|
|
|
EFI_PEI_SMBUS_PPI.Execute() in the Platform
|
|
|
|
Initialization SMBus PPI Specification.
|
2007-06-19 12:12:02 +02:00
|
|
|
|
|
|
|
@param Command This command is transmitted by the SMBus host
|
|
|
|
controller to the SMBus slave device and the
|
|
|
|
interpretation is SMBus slave device specific.
|
|
|
|
It can mean the offset to a list of functions
|
|
|
|
inside an SMBus slave device. Not all
|
|
|
|
operations or slave devices support this
|
|
|
|
command's registers. Type
|
|
|
|
EFI_SMBUS_DEVICE_COMMAND is defined in
|
|
|
|
EFI_PEI_SMBUS_PPI.Execute() in the Platform
|
|
|
|
Initialization SMBus PPI Specification.
|
|
|
|
Operation Signifies which particular SMBus
|
|
|
|
hardware protocol instance that it will use to
|
|
|
|
execute the SMBus transactions. This SMBus
|
|
|
|
hardware protocol is defined by the SMBus
|
|
|
|
Specification and is not related to PI
|
|
|
|
Architecture. Type EFI_SMBUS_OPERATION is
|
|
|
|
defined in EFI_PEI_SMBUS_PPI.Execute() in the
|
|
|
|
Platform Initialization SMBus PPI
|
|
|
|
Specification.
|
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
@param PecCheck Defines if Packet Error Code (PEC) checking
|
|
|
|
is required for this operation. SMBus Host
|
|
|
|
Controller Code Definitions Version 1.0
|
|
|
|
August 21, 2006 13 Length Signifies the
|
|
|
|
number of bytes that this operation will do.
|
|
|
|
The maximum number of bytes can be revision
|
|
|
|
specific and operation specific. This field
|
|
|
|
will contain the actual number of bytes that
|
|
|
|
are executed for this operation. Not all
|
|
|
|
operations require this argument.
|
2007-06-19 12:12:02 +02:00
|
|
|
|
|
|
|
@param Buffer Contains the value of data to execute to the
|
|
|
|
SMBus slave device. Not all operations require
|
|
|
|
this argument. The length of this buffer is
|
|
|
|
identified by Length.
|
|
|
|
|
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
@retval EFI_SUCCESS The last data that was returned from the
|
|
|
|
access matched the poll exit criteria.
|
2007-06-19 12:12:02 +02:00
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
@retval EFI_CRC_ERROR Checksum is not correct (PEC is incorrect).
|
2007-06-19 12:12:02 +02:00
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
@retval EFI_TIMEOUT Timeout expired before the operation was
|
|
|
|
completed. Timeout is determined by the
|
|
|
|
SMBus host controller device.
|
2007-06-19 12:12:02 +02:00
|
|
|
|
|
|
|
@retval EFI_OUT_OF_RESOURCES The request could not be
|
|
|
|
completed due to a lack of
|
|
|
|
resources.
|
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
@retval EFI_DEVICE_ERROR The request was not completed
|
|
|
|
because a failure that was reflected
|
|
|
|
in the Host Status Register bit.
|
|
|
|
Device errors are a result of a
|
|
|
|
transaction collision, illegal
|
|
|
|
command field, unclaimed cycle (host
|
|
|
|
initiated), or bus errors
|
|
|
|
(collisions).
|
2007-06-19 12:12:02 +02:00
|
|
|
|
|
|
|
@retval EFI_INVALID_PARAMETER 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.
|
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
@retval EFI_UNSUPPORTED The SMBus operation or PEC is not
|
|
|
|
supported.
|
2007-06-19 12:12:02 +02:00
|
|
|
|
|
|
|
@retval EFI_BUFFER_TOO_SMALL Buffer is not sufficient for
|
|
|
|
this operation.
|
|
|
|
|
|
|
|
**/
|
|
|
|
typedef
|
|
|
|
EFI_STATUS
|
2008-06-24 09:14:18 +02:00
|
|
|
(EFIAPI *EFI_SMBUS_HC_EXECUTE_OPERATION)(
|
2007-06-19 12:12:02 +02:00
|
|
|
IN CONST EFI_SMBUS_HC_PROTOCOL *This,
|
|
|
|
IN CONST EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
|
|
|
|
IN CONST EFI_SMBUS_DEVICE_COMMAND Command,
|
|
|
|
IN CONST EFI_SMBUS_OPERATION Operation,
|
|
|
|
IN CONST BOOLEAN PecCheck,
|
|
|
|
IN OUT UINTN *Length,
|
|
|
|
IN OUT VOID *Buffer
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
The ArpDevice() function provides a standard way for a device driver to
|
|
|
|
enumerate the entire SMBus or specific devices on the bus.
|
2007-06-19 12:12:02 +02:00
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
@param This A pointer to the EFI_SMBUS_HC_PROTOCOL instance.
|
|
|
|
|
|
|
|
@param ArpAll A Boolean expression that indicates if the
|
|
|
|
host drivers need to enumerate all the devices
|
|
|
|
or enumerate only the device that is
|
|
|
|
identified by SmbusUdid. If ArpAll is TRUE,
|
|
|
|
SmbusUdid and SlaveAddress are optional. If
|
|
|
|
ArpAll is FALSE, ArpDevice will enumerate
|
|
|
|
SmbusUdid and the address will be at
|
|
|
|
SlaveAddress.
|
|
|
|
|
|
|
|
@param SmbusUdid The Unique Device Identifier (UDID) that is
|
|
|
|
associated with this device. Type
|
|
|
|
EFI_SMBUS_UDID is defined in
|
|
|
|
EFI_PEI_SMBUS_PPI.ArpDevice() in the
|
|
|
|
Platform Initialization SMBus PPI
|
|
|
|
Specification.
|
2007-06-19 12:12:02 +02:00
|
|
|
|
|
|
|
@param SlaveAddress The SMBus slave address that is
|
|
|
|
associated with an SMBus UDID.
|
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
@retval EFI_SUCCESS The last data that was returned from the
|
|
|
|
access matched the poll exit criteria.
|
2007-06-19 12:12:02 +02:00
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
@retval EFI_CRC_ERROR Checksum is not correct (PEC is
|
|
|
|
incorrect).
|
2007-06-19 12:12:02 +02:00
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
@retval EFI_TIMEOUT Timeout expired before the operation was
|
|
|
|
completed. Timeout is determined by the
|
|
|
|
SMBus host controller device.
|
2007-06-19 12:12:02 +02:00
|
|
|
|
|
|
|
@retval EFI_OUT_OF_RESOURCES The request could not be
|
|
|
|
completed due to a lack of
|
|
|
|
resources.
|
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
@retval EFI_DEVICE_ERROR The request was not completed
|
|
|
|
because a failure was reflected in
|
|
|
|
the Host Status Register bit. Device
|
|
|
|
Errors are a result of a transaction
|
|
|
|
collision, illegal command field,
|
|
|
|
unclaimed cycle (host initiated), or
|
|
|
|
bus errors (collisions).
|
2007-06-19 12:12:02 +02:00
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
@retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are
|
|
|
|
not implemented by this driver.
|
2007-06-19 12:12:02 +02:00
|
|
|
|
|
|
|
**/
|
|
|
|
typedef
|
|
|
|
EFI_STATUS
|
2008-06-24 09:14:18 +02:00
|
|
|
(EFIAPI *EFI_SMBUS_HC_PROTOCOL_ARP_DEVICE)(
|
2007-06-19 12:12:02 +02:00
|
|
|
IN CONST EFI_SMBUS_HC_PROTOCOL *This,
|
|
|
|
IN CONST BOOLEAN ArpAll,
|
|
|
|
IN CONST EFI_SMBUS_UDID *SmbusUdid, OPTIONAL
|
|
|
|
IN OUT EFI_SMBUS_DEVICE_ADDRESS *SlaveAddress OPTIONAL
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2008-07-25 12:37:15 +02:00
|
|
|
The GetArpMap() function returns the mapping of all the SMBus devices
|
|
|
|
that were enumerated by the SMBus host driver.
|
2007-06-19 12:12:02 +02:00
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
@param This A pointer to the EFI_SMBUS_HC_PROTOCOL instance.
|
2007-06-19 12:12:02 +02:00
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
@param Length Size of the buffer that contains the SMBus
|
|
|
|
device map.
|
2007-06-19 12:12:02 +02:00
|
|
|
|
|
|
|
@param SmbusDeviceMap The pointer to the device map as
|
|
|
|
enumerated by the SMBus controller
|
|
|
|
driver.
|
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
@retval EFI_SUCCESS The SMBus returned the current device map.
|
2007-06-19 12:12:02 +02:00
|
|
|
|
|
|
|
@retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are
|
|
|
|
not implemented by this driver.
|
|
|
|
|
|
|
|
**/
|
|
|
|
typedef
|
|
|
|
EFI_STATUS
|
2008-06-24 09:14:18 +02:00
|
|
|
(EFIAPI *EFI_SMBUS_HC_PROTOCOL_GET_ARP_MAP)(
|
2007-06-19 12:12:02 +02:00
|
|
|
IN CONST EFI_SMBUS_HC_PROTOCOL *This,
|
|
|
|
IN OUT UINTN *Length,
|
|
|
|
IN OUT EFI_SMBUS_DEVICE_MAP **SmbusDeviceMap
|
|
|
|
);
|
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
/**
|
|
|
|
The notify function does some actions.
|
|
|
|
|
|
|
|
@param SlaveAddress
|
|
|
|
The SMBUS hardware address to which the SMBUS device is preassigned or allocated.
|
2007-06-19 12:12:02 +02:00
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
@param Data
|
|
|
|
Data of the SMBus host notify command that the caller wants to be called.
|
|
|
|
|
|
|
|
@return EFI_STATUS
|
|
|
|
**/
|
2007-06-19 12:12:02 +02:00
|
|
|
typedef
|
|
|
|
EFI_STATUS
|
2008-06-24 09:14:18 +02:00
|
|
|
(EFIAPI *EFI_SMBUS_NOTIFY_FUNCTION)(
|
2007-06-19 12:12:02 +02:00
|
|
|
IN CONST EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
|
|
|
|
IN CONST UINTN Data
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
The Notify() function registers all the callback functions to
|
|
|
|
allow the bus driver to call these functions when the
|
|
|
|
SlaveAddress/Data pair happens.
|
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
@param This A pointer to the EFI_SMBUS_HC_PROTOCOL instance.
|
2007-06-19 12:12:02 +02:00
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
@param SlaveAddress Address that the host controller detects
|
|
|
|
as sending a message and calls all the registered function.
|
2007-06-19 12:12:02 +02:00
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
@param Data Data that the host controller detects as sending
|
|
|
|
message and calls all the registered function.
|
2007-06-19 12:12:02 +02:00
|
|
|
|
|
|
|
|
|
|
|
@param NotifyFunction The function to call when the bus
|
|
|
|
driver detects the SlaveAddress and
|
|
|
|
Data pair.
|
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
@retval EFI_SUCCESS NotifyFunction was registered.
|
2007-06-19 12:12:02 +02:00
|
|
|
|
|
|
|
@retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are
|
|
|
|
not implemented by this driver.
|
|
|
|
|
|
|
|
**/
|
|
|
|
typedef
|
|
|
|
EFI_STATUS
|
2008-06-24 09:14:18 +02:00
|
|
|
(EFIAPI *EFI_SMBUS_HC_PROTOCOL_NOTIFY)(
|
2007-06-19 12:12:02 +02:00
|
|
|
IN CONST EFI_SMBUS_HC_PROTOCOL *This,
|
|
|
|
IN CONST EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
|
|
|
|
IN CONST UINTN Data,
|
|
|
|
IN CONST EFI_SMBUS_NOTIFY_FUNCTION NotifyFunction
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2008-07-25 12:37:15 +02:00
|
|
|
@par Protocol Description:
|
2007-06-19 12:12:02 +02:00
|
|
|
The EFI_SMBUS_HC_PROTOCOL provides SMBus host controller management and basic data
|
|
|
|
transactions over SMBus. There is one EFI_SMBUS_HC_PROTOCOL instance for each SMBus
|
|
|
|
host controller.
|
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
@param Execute Executes the SMBus operation to an SMBus slave
|
|
|
|
device. See the Execute() function description.
|
2007-06-19 12:12:02 +02:00
|
|
|
|
|
|
|
@param ArpDevice Allows an SMBus 2.0 device(s) to be Address
|
|
|
|
Resolution Protocol (ARP).
|
|
|
|
|
|
|
|
@param GetArpMap Allows a driver to retrieve the address that
|
|
|
|
was allocated by the SMBus host controller
|
|
|
|
during enumeration/ARP. See the GetArpMap()
|
|
|
|
function description.
|
|
|
|
|
|
|
|
@param Notify Allows a driver to register for a callback
|
|
|
|
to the SMBus host controller driver when the
|
|
|
|
bus issues a notification to the bus
|
|
|
|
controller driver. See the Notify() function
|
|
|
|
description.
|
|
|
|
**/
|
|
|
|
struct _EFI_SMBUS_HC_PROTOCOL {
|
|
|
|
EFI_SMBUS_HC_EXECUTE_OPERATION Execute;
|
|
|
|
EFI_SMBUS_HC_PROTOCOL_ARP_DEVICE ArpDevice;
|
|
|
|
EFI_SMBUS_HC_PROTOCOL_GET_ARP_MAP GetArpMap;
|
|
|
|
EFI_SMBUS_HC_PROTOCOL_NOTIFY Notify;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
extern EFI_GUID gEfiSmbusHcProtocolGuid;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|