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