blob: da7e58fc78a749528f2dab4139e6efef0ffc9b9f [file] [log] [blame]
Vishal Bhoj82c80712015-12-15 21:13:33 +05301/** @file
2Internal header file for Smbus library.
3
4Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
5This program and the accompanying materials
6are licensed and made available under the terms and conditions of the BSD License
7which accompanies this distribution. The full text of the license may be found at
8http://opensource.org/licenses/bsd-license.php.
9
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13
14**/
15
16#ifndef __INTERNAL_SMBUS_LIB_H_
17#define __INTERNAL_SMBUS_LIB_H_
18
19
20#include <PiDxe.h>
21
22#include <Protocol/SmbusHc.h>
23
24#include <Library/SmbusLib.h>
25#include <Library/DebugLib.h>
26#include <Library/UefiBootServicesTableLib.h>
27#include <Library/BaseMemoryLib.h>
28
29#include <IndustryStandard/SmBus.h>
30
31//
32// Declaration for internal functions
33//
34/**
35 Executes an SMBus operation to an SMBus controller.
36
37 This function provides a standard way to execute Smbus script
38 as defined in the SmBus Specification. The data can either be of
39 the Length byte, word, or a block of data.
40
41 @param SmbusOperation Signifies which particular SMBus hardware protocol instance
42 that it will use toexecute the SMBus transactions.
43 @param SmBusAddress The address that encodes the SMBUS Slave Address,
44 SMBUS Command, SMBUS Data Length, and PEC.
45 @param Length Signifies the number of bytes that this operation will
46 do. The maximum number of bytes can be revision specific
47 and operation specific.
48 @param Buffer Contains the value of data to execute to the SMBus slave
49 device. Not all operations require this argument. The
50 length of this buffer is identified by Length.
51 @param Status Return status for the executed command.
52 This is an optional parameter and may be NULL.
53
54 @return The actual number of bytes that are executed for this operation.
55
56**/
57UINTN
58InternalSmBusExec (
59 IN EFI_SMBUS_OPERATION SmbusOperation,
60 IN UINTN SmBusAddress,
61 IN UINTN Length,
62 IN OUT VOID *Buffer,
63 OUT RETURN_STATUS *Status OPTIONAL
64 );
65
66/**
67 The constructor function caches the pointer to Smbus protocol.
68
69 The constructor function locates Smbus protocol from protocol database.
70 It will ASSERT() if that operation fails and it will always return EFI_SUCCESS.
71
72 @param ImageHandle The firmware allocated handle for the EFI image.
73 @param SystemTable A pointer to the EFI System Table.
74
75 @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
76
77**/
78EFI_STATUS
79EFIAPI
80SmbusLibConstructor (
81 IN EFI_HANDLE ImageHandle,
82 IN EFI_SYSTEM_TABLE *SystemTable
83 );
84
85#endif