]>
Commit | Line | Data |
---|---|---|
878ddf1f | 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 | Module Name: SmbusLib.c\r | |
15 | \r | |
16 | **/\r | |
17 | \r | |
18 | #ifndef __INTERNAL_SMBUS_LIB_H\r | |
19 | #define __INTERNAL_SMBUS_LIB_H\r | |
20 | \r | |
21 | #define SMBUS_LIB_PEC(SmBusAddress) ((BOOLEAN) ((SmBusAddress) & 0x01))\r | |
22 | #define SMBUS_LIB_SLAVE_ADDRESS(SmBusAddress) (((SmBusAddress) >> 1) & 0x7f)\r | |
23 | #define SMBUS_LIB_COMMAND(SmBusAddress) (((SmBusAddress) >> 8) & 0xff)\r | |
24 | #define SMBUS_LIB_LENGTH(SmBusAddress) (((SmBusAddress) >> 16) & 0x1f)\r | |
25 | #define SMBUS_LIB_RESEARVED(SmBusAddress) (((SmBusAddress) >> 21))\r | |
26 | \r | |
27 | //\r | |
28 | // Declaration for internal functions\r | |
29 | //\r | |
30 | /**\r | |
31 | Executes an SMBus operation to an SMBus controller. \r | |
32 | \r | |
33 | This function provides a standard way to execute Smbus script\r | |
34 | as defined in the SmBus Specification. The data can either be of\r | |
35 | the Length byte, word, or a block of data.\r | |
36 | \r | |
37 | @param SmbusOperation Signifies which particular SMBus hardware protocol instance that it will use to\r | |
38 | execute the SMBus transactions.\r | |
39 | @param SmBusAddress Address that encodes the SMBUS Slave Address,\r | |
40 | SMBUS Command, SMBUS Data Length, and PEC.\r | |
41 | @param Length Signifies the number of bytes that this operation will do. The maximum number of\r | |
42 | bytes can be revision specific and operation specific.\r | |
43 | @param Buffer Contains the value of data to execute to the SMBus slave device. Not all operations\r | |
44 | require this argument. The length of this buffer is identified by Length.\r | |
45 | @param Status Return status for the executed command.\r | |
46 | This is an optional parameter and may be NULL.\r | |
47 | \r | |
48 | @return The actual number of bytes that are executed for this operation..\r | |
49 | \r | |
50 | **/\r | |
51 | UINTN\r | |
52 | InternalSmBusExec (\r | |
53 | IN EFI_SMBUS_OPERATION SmbusOperation,\r | |
54 | IN UINTN SmBusAddress,\r | |
55 | IN UINTN Length,\r | |
56 | IN VOID *Buffer,\r | |
57 | OUT RETURN_STATUS *Status OPTIONAL\r | |
58 | );\r | |
59 | \r | |
60 | /**\r | |
61 | Assigns an SMBUS slave addresses.\r | |
62 | \r | |
63 | Assigns the SMBUS device specified by Uuid the slave address specified by SmBusAddress.\r | |
64 | The status of the executed command is returned.\r | |
65 | If Command in SmBusAddress is not zero, then ASSERT().\r | |
66 | If Length in SmBusAddress is not zero, then ASSERT().\r | |
67 | If PEC in SmBusAddress is set, then ASSERT().\r | |
68 | If any reserved bits of SmBusAddress are set, then ASSERT().\r | |
69 | \r | |
70 | @param SmBusAddress Address that encodes the SMBUS Slave Address,\r | |
71 | SMBUS Command, SMBUS Data Length, and PEC.\r | |
72 | @param Uuid Pointer to the UUID of the device to assign a slave address.\r | |
73 | It will assign to all SMBUS slave devices if it is NULL.\r | |
74 | \r | |
75 | @retval RETURN_SUCCESS The SMBUS command was executed.\r | |
76 | @retval RETURN_TIMEOUT A timeout occurred while executing the SMBUS command.\r | |
77 | @retval RETURN_DEVICE_ERROR The request was not completed because a failure reflected\r | |
78 | in the Host Status Register bit.\r | |
79 | Device errors are a result of a transaction collision, illegal command field,\r | |
80 | unclaimed cycle (host initiated), or bus errors (collisions).\r | |
81 | \r | |
82 | **/\r | |
83 | RETURN_STATUS\r | |
84 | InternalSmBusArpDevice (\r | |
85 | IN UINTN SmBusAddress,\r | |
86 | IN CONST GUID *Uuid OPTIONAL \r | |
87 | );\r | |
88 | \r | |
89 | /**\r | |
90 | Retrieves the mapping of all the SMBus devices.\r | |
91 | \r | |
92 | The GetArpMap() function returns the mapping of all the SMBus devices \r | |
93 | that are enumerated by the SMBus host driver. \r | |
94 | \r | |
95 | @param Length Size of the buffer that contains the SMBus device map.\r | |
96 | @param SmbusDeviceMap The pointer to the device map as enumerated by the SMBus controller driver.\r | |
97 | \r | |
98 | @retval RETURN_SUCCESS The SMBUS command was executed.\r | |
99 | @retval RETURN_TIMEOUT A timeout occurred while executing the SMBUS command.\r | |
100 | @retval RETURN_DEVICE_ERROR The request was not completed because a failure reflected\r | |
101 | in the Host Status Register bit.\r | |
102 | Device errors are a result of a transaction collision, illegal command field,\r | |
103 | unclaimed cycle (host initiated), or bus errors (collisions).\r | |
104 | \r | |
105 | **/\r | |
106 | RETURN_STATUS\r | |
107 | InternalGetArpMap (\r | |
108 | OUT UINTN *Length,\r | |
109 | OUT EFI_SMBUS_DEVICE_MAP **SmbusDeviceMap\r | |
110 | );\r | |
111 | \r | |
112 | #endif\r |