]> git.proxmox.com Git - mirror_edk2.git/blob - EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiSmbusLib/PeiSmbusLibInternal.h
Add in the 1st version of ECP.
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Library / EdkIIGlueLib / Library / PeiSmbusLib / PeiSmbusLibInternal.h
1 /*++
2
3 Copyright (c) 2004 - 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12
13 Module Name:
14
15 PeiSmbusLibInternal.h
16
17 Abstract:
18
19 Declarations of internal functions in PeiSmbusLib.
20
21 --*/
22
23 #ifndef __PEI_SMBUS_LIB_INTERNAL_H__
24 #define __PEI_SMBUS_LIB_INTERNAL_H__
25
26 #include "EdkIIGluePeim.h"
27
28
29 #define SMBUS_LIB_SLAVE_ADDRESS(SmBusAddress) (((SmBusAddress) >> 1) & 0x7f)
30 #define SMBUS_LIB_COMMAND(SmBusAddress) (((SmBusAddress) >> 8) & 0xff)
31 #define SMBUS_LIB_LENGTH(SmBusAddress) (((SmBusAddress) >> 16) & 0x3f)
32 #define SMBUS_LIB_PEC(SmBusAddress) ((BOOLEAN) (((SmBusAddress) & SMBUS_LIB_PEC_BIT) != 0))
33 #define SMBUS_LIB_RESEARVED(SmBusAddress) ((SmBusAddress) & ~(((1 << 22) - 2) | SMBUS_LIB_PEC_BIT))
34
35 //
36 // Declaration for internal functions
37 //
38
39 /**
40 Gets Smbus PPIs.
41
42 This internal function retrieves Smbus PPI from PPI database.
43
44 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES published by the PEI Foundation.
45
46 @return The pointer to Smbus PPI.
47
48 **/
49 EFI_PEI_SMBUS_PPI *
50 InternalGetSmbusPpi (
51 EFI_PEI_SERVICES **PeiServices
52 );
53
54 /**
55 Executes an SMBus operation to an SMBus controller.
56
57 This function provides a standard way to execute Smbus script
58 as defined in the SmBus Specification. The data can either be of
59 the Length byte, word, or a block of data.
60
61 @param SmbusOperation Signifies which particular SMBus hardware protocol instance that it will use to
62 execute the SMBus transactions.
63 @param SmBusAddress Address that encodes the SMBUS Slave Address,
64 SMBUS Command, SMBUS Data Length, and PEC.
65 @param Length Signifies the number of bytes that this operation will do. The maximum number of
66 bytes can be revision specific and operation specific.
67 @param Buffer Contains the value of data to execute to the SMBus slave device. Not all operations
68 require this argument. The length of this buffer is identified by Length.
69 @param Status Return status for the executed command.
70 This is an optional parameter and may be NULL.
71
72 @return The actual number of bytes that are executed for this operation.
73
74 **/
75 UINTN
76 InternalSmBusExec (
77 IN EFI_SMBUS_OPERATION SmbusOperation,
78 IN UINTN SmBusAddress,
79 IN UINTN Length,
80 IN OUT VOID *Buffer,
81 OUT RETURN_STATUS *Status OPTIONAL
82 );
83
84 #endif