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