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