]>
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 <PiDxe.h>\r |
c892d846 | 21 | \r |
bad46384 | 22 | #include <Protocol/SmbusHc.h>\r |
c892d846 | 23 | \r |
bad46384 | 24 | #include <Library/SmbusLib.h>\r |
25 | #include <Library/DebugLib.h>\r | |
26 | #include <Library/UefiBootServicesTableLib.h>\r | |
27 | #include <Library/BaseMemoryLib.h>\r | |
28 | \r | |
dd51a993 | 29 | #include <IndustryStandard/Smbus.h>\r |
30 | \r | |
31 | #define SMBUS_LIB_SLAVE_ADDRESS(SmBusAddress) (((SmBusAddress) >> 1) & 0x7f)\r | |
32 | #define SMBUS_LIB_COMMAND(SmBusAddress) (((SmBusAddress) >> 8) & 0xff)\r | |
33 | #define SMBUS_LIB_LENGTH(SmBusAddress) (((SmBusAddress) >> 16) & 0x3f)\r | |
34 | #define SMBUS_LIB_PEC(SmBusAddress) ((BOOLEAN) (((SmBusAddress) & SMBUS_LIB_PEC_BIT) != 0))\r | |
35 | #define SMBUS_LIB_RESEARVED(SmBusAddress) ((SmBusAddress) & ~(((1 << 22) - 2) | SMBUS_LIB_PEC_BIT))\r | |
36 | \r | |
37 | //\r | |
38 | // Declaration for internal functions\r | |
39 | //\r | |
40 | /**\r | |
bad46384 | 41 | Executes an SMBus operation to an SMBus controller.\r |
dd51a993 | 42 | \r |
43 | This function provides a standard way to execute Smbus script\r | |
44 | as defined in the SmBus Specification. The data can either be of\r | |
45 | the Length byte, word, or a block of data.\r | |
46 | \r | |
47 | @param SmbusOperation Signifies which particular SMBus hardware protocol instance that it will use to\r | |
48 | execute the SMBus transactions.\r | |
49 | @param SmBusAddress Address that encodes the SMBUS Slave Address,\r | |
50 | SMBUS Command, SMBUS Data Length, and PEC.\r | |
51 | @param Length Signifies the number of bytes that this operation will do. The maximum number of\r | |
52 | bytes can be revision specific and operation specific.\r | |
53 | @param Buffer Contains the value of data to execute to the SMBus slave device. Not all operations\r | |
54 | require this argument. The length of this buffer is identified by Length.\r | |
55 | @param Status Return status for the executed command.\r | |
56 | This is an optional parameter and may be NULL.\r | |
57 | \r | |
58 | @return The actual number of bytes that are executed for this operation.\r | |
59 | \r | |
60 | **/\r | |
61 | UINTN\r | |
62 | InternalSmBusExec (\r | |
63 | IN EFI_SMBUS_OPERATION SmbusOperation,\r | |
64 | IN UINTN SmBusAddress,\r | |
65 | IN UINTN Length,\r | |
66 | IN OUT VOID *Buffer,\r | |
67 | OUT RETURN_STATUS *Status OPTIONAL\r | |
68 | );\r | |
69 | \r | |
a73480f6 | 70 | /**\r |
71 | The constructor function caches the pointer to Smbus protocol.\r | |
72 | \r | |
73 | The constructor function locates Smbus protocol from protocol database.\r | |
74 | It will ASSERT() if that operation fails and it will always return EFI_SUCCESS.\r | |
75 | \r | |
76 | @param ImageHandle The firmware allocated handle for the EFI image.\r | |
77 | @param SystemTable A pointer to the EFI System Table.\r | |
78 | \r | |
79 | @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.\r | |
80 | \r | |
81 | **/\r | |
82 | EFI_STATUS\r | |
83 | EFIAPI\r | |
84 | SmbusLibConstructor (\r | |
85 | IN EFI_HANDLE ImageHandle,\r | |
86 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
87 | )\r | |
88 | ;\r | |
89 | \r | |
dd51a993 | 90 | #endif\r |