2 Internal header file for Smbus library.
4 Copyright (c) 2006, Intel Corporation<BR>
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
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.
16 #ifndef __INTERNAL_SMBUS_LIB_H
17 #define __INTERNAL_SMBUS_LIB_H
20 // The package level header files this module uses
24 // The protocols, PPI and GUID defintions for this module
26 #include <Protocol/SmbusHc.h>
28 // The Library classes this module consumes
30 #include <Library/SmbusLib.h>
31 #include <Library/DebugLib.h>
32 #include <Library/UefiBootServicesTableLib.h>
33 #include <Library/BaseMemoryLib.h>
35 #include <IndustryStandard/Smbus.h>
37 #define SMBUS_LIB_SLAVE_ADDRESS(SmBusAddress) (((SmBusAddress) >> 1) & 0x7f)
38 #define SMBUS_LIB_COMMAND(SmBusAddress) (((SmBusAddress) >> 8) & 0xff)
39 #define SMBUS_LIB_LENGTH(SmBusAddress) (((SmBusAddress) >> 16) & 0x3f)
40 #define SMBUS_LIB_PEC(SmBusAddress) ((BOOLEAN) (((SmBusAddress) & SMBUS_LIB_PEC_BIT) != 0))
41 #define SMBUS_LIB_RESEARVED(SmBusAddress) ((SmBusAddress) & ~(((1 << 22) - 2) | SMBUS_LIB_PEC_BIT))
44 // Declaration for internal functions
47 Executes an SMBus operation to an SMBus controller.
49 This function provides a standard way to execute Smbus script
50 as defined in the SmBus Specification. The data can either be of
51 the Length byte, word, or a block of data.
53 @param SmbusOperation Signifies which particular SMBus hardware protocol instance that it will use to
54 execute the SMBus transactions.
55 @param SmBusAddress Address that encodes the SMBUS Slave Address,
56 SMBUS Command, SMBUS Data Length, and PEC.
57 @param Length Signifies the number of bytes that this operation will do. The maximum number of
58 bytes can be revision specific and operation specific.
59 @param Buffer Contains the value of data to execute to the SMBus slave device. Not all operations
60 require this argument. The length of this buffer is identified by Length.
61 @param Status Return status for the executed command.
62 This is an optional parameter and may be NULL.
64 @return The actual number of bytes that are executed for this operation.
69 IN EFI_SMBUS_OPERATION SmbusOperation
,
70 IN UINTN SmBusAddress
,
73 OUT RETURN_STATUS
*Status OPTIONAL
77 The constructor function caches the pointer to Smbus protocol.
79 The constructor function locates Smbus protocol from protocol database.
80 It will ASSERT() if that operation fails and it will always return EFI_SUCCESS.
82 @param ImageHandle The firmware allocated handle for the EFI image.
83 @param SystemTable A pointer to the EFI System Table.
85 @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
91 IN EFI_HANDLE ImageHandle
,
92 IN EFI_SYSTEM_TABLE
*SystemTable