]>
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 | |
bad46384 | 19 | //\r |
20 | // The package level header files this module uses\r | |
21 | //\r | |
22 | #include <PiPei.h>\r | |
23 | //\r | |
24 | // The protocols, PPI and GUID defintions for this module\r | |
25 | //\r | |
26 | #include <Ppi/Smbus2.h>\r | |
27 | //\r | |
28 | // The Library classes this module consumes\r | |
29 | //\r | |
30 | #include <Library/SmbusLib.h>\r | |
31 | #include <Library/DebugLib.h>\r | |
32 | #include <Library/PeiServicesTablePointerLib.h>\r | |
33 | #include <Library/BaseMemoryLib.h>\r | |
34 | \r | |
dd51a993 | 35 | #define SMBUS_LIB_SLAVE_ADDRESS(SmBusAddress) (((SmBusAddress) >> 1) & 0x7f)\r |
36 | #define SMBUS_LIB_COMMAND(SmBusAddress) (((SmBusAddress) >> 8) & 0xff)\r | |
37 | #define SMBUS_LIB_LENGTH(SmBusAddress) (((SmBusAddress) >> 16) & 0x3f)\r | |
38 | #define SMBUS_LIB_PEC(SmBusAddress) ((BOOLEAN) (((SmBusAddress) & SMBUS_LIB_PEC_BIT) != 0))\r | |
39 | #define SMBUS_LIB_RESEARVED(SmBusAddress) ((SmBusAddress) & ~(((1 << 22) - 2) | SMBUS_LIB_PEC_BIT))\r | |
40 | \r | |
41 | //\r | |
42 | // Declaration for internal functions\r | |
43 | //\r | |
44 | \r | |
45 | /**\r | |
46 | Gets Smbus PPIs.\r | |
47 | \r | |
48 | This internal function retrieves Smbus PPI from PPI database.\r | |
49 | \r | |
50 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES published by the PEI Foundation.\r | |
51 | \r | |
52 | @return The pointer to Smbus PPI.\r | |
53 | \r | |
54 | **/\r | |
55 | EFI_PEI_SMBUS2_PPI *\r | |
56 | InternalGetSmbusPpi (\r | |
57 | EFI_PEI_SERVICES **PeiServices\r | |
58 | );\r | |
59 | \r | |
60 | /**\r | |
bad46384 | 61 | Executes an SMBus operation to an SMBus controller.\r |
dd51a993 | 62 | \r |
63 | This function provides a standard way to execute Smbus script\r | |
64 | as defined in the SmBus Specification. The data can either be of\r | |
65 | the Length byte, word, or a block of data.\r | |
66 | \r | |
67 | @param SmbusOperation Signifies which particular SMBus hardware protocol instance that it will use to\r | |
68 | execute the SMBus transactions.\r | |
69 | @param SmBusAddress Address that encodes the SMBUS Slave Address,\r | |
70 | SMBUS Command, SMBUS Data Length, and PEC.\r | |
71 | @param Length Signifies the number of bytes that this operation will do. The maximum number of\r | |
72 | bytes can be revision specific and operation specific.\r | |
73 | @param Buffer Contains the value of data to execute to the SMBus slave device. Not all operations\r | |
74 | require this argument. The length of this buffer is identified by Length.\r | |
75 | @param Status Return status for the executed command.\r | |
76 | This is an optional parameter and may be NULL.\r | |
77 | \r | |
78 | @return The actual number of bytes that are executed for this operation.\r | |
79 | \r | |
80 | **/\r | |
81 | UINTN\r | |
82 | InternalSmBusExec (\r | |
83 | IN EFI_SMBUS_OPERATION SmbusOperation,\r | |
84 | IN UINTN SmBusAddress,\r | |
85 | IN UINTN Length,\r | |
86 | IN OUT VOID *Buffer,\r | |
87 | OUT RETURN_STATUS *Status OPTIONAL\r | |
88 | );\r | |
89 | \r | |
90 | #endif\r |