]>
Commit | Line | Data |
---|---|---|
9b6bbcdb MK |
1 | /** @file\r |
2 | Common definitons for SMBus PEIM/DXE driver. Smbus PEI and DXE\r | |
3 | modules share the same version of this file.\r | |
4 | \r | |
5 | Copyright (c) 2013-2015 Intel Corporation.\r | |
6 | \r | |
7 | This program and the accompanying materials\r | |
8 | are licensed and made available under the terms and conditions of the BSD License\r | |
9 | which accompanies this distribution. The full text of the license may be found at\r | |
10 | http://opensource.org/licenses/bsd-license.php\r | |
11 | \r | |
12 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
13 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
14 | \r | |
15 | **/\r | |
16 | \r | |
17 | #ifndef _QNC_SMBUS_H_\r | |
18 | #define _QNC_SMBUS_H_\r | |
19 | \r | |
20 | #include "CommonHeader.h"\r | |
21 | \r | |
22 | //\r | |
23 | // Minimum and maximum length for SMBus bus block protocols defined in SMBus spec 2.0.\r | |
24 | //\r | |
25 | #define MIN_SMBUS_BLOCK_LEN 1\r | |
26 | #define MAX_SMBUS_BLOCK_LEN 32\r | |
27 | #define ADD_LENGTH(SmbusAddress, Length) ((SmbusAddress) + SMBUS_LIB_ADDRESS (0, 0, (Length), FALSE))\r | |
28 | \r | |
29 | /**\r | |
30 | Executes an SMBus operation to an SMBus controller. Returns when either the command has been\r | |
31 | executed or an error is encountered in doing the operation.\r | |
32 | \r | |
33 | The internal worker function provides a standard way to execute an operation as defined in the\r | |
34 | System Management Bus (SMBus) Specification. The resulting transaction will be either that the\r | |
35 | SMBus slave devices accept this transaction or that this function returns with error.\r | |
36 | \r | |
37 | @param SlaveAddress The SMBus slave address of the device with which to communicate.\r | |
38 | @param Command This command is transmitted by the SMBus host controller to the\r | |
39 | SMBus slave device and the interpretation is SMBus slave device\r | |
40 | specific. It can mean the offset to a list of functions inside an\r | |
41 | SMBus slave device. Not all operations or slave devices support\r | |
42 | this command's registers.\r | |
43 | @param Operation Signifies which particular SMBus hardware protocol instance that\r | |
44 | it will use to execute the SMBus transactions. This SMBus\r | |
45 | hardware protocol is defined by the SMBus Specification and is\r | |
46 | not related to EFI.\r | |
47 | @param PecCheck Defines if Packet Error Code (PEC) checking is required for this\r | |
48 | operation.\r | |
49 | @param Length Signifies the number of bytes that this operation will do. The\r | |
50 | maximum number of bytes can be revision specific and operation\r | |
51 | specific. This field will contain the actual number of bytes that\r | |
52 | are executed for this operation. Not all operations require this\r | |
53 | argument.\r | |
54 | @param Buffer Contains the value of data to execute to the SMBus slave device.\r | |
55 | Not all operations require this argument. The length of this\r | |
56 | buffer is identified by Length.\r | |
57 | \r | |
58 | @retval EFI_SUCCESS The last data that was returned from the access matched the poll\r | |
59 | exit criteria.\r | |
60 | @retval EFI_CRC_ERROR Checksum is not correct (PEC is incorrect).\r | |
61 | @retval EFI_TIMEOUT Timeout expired before the operation was completed. Timeout is\r | |
62 | determined by the SMBus host controller device.\r | |
63 | @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r | |
64 | @retval EFI_DEVICE_ERROR The request was not completed because a failure that was\r | |
65 | reflected in the Host Status Register bit. Device errors are a\r | |
66 | result of a transaction collision, illegal command field,\r | |
67 | unclaimed cycle (host initiated), or bus errors (collisions).\r | |
68 | @retval EFI_INVALID_PARAMETER Operation is not defined in EFI_SMBUS_OPERATION.\r | |
69 | @retval EFI_INVALID_PARAMETER Length/Buffer is NULL for operations except for EfiSmbusQuickRead\r | |
70 | and EfiSmbusQuickWrite. Length is outside the range of valid\r | |
71 | values.\r | |
72 | @retval EFI_UNSUPPORTED The SMBus operation or PEC is not supported.\r | |
73 | @retval EFI_BUFFER_TOO_SMALL Buffer is not sufficient for this operation.\r | |
74 | \r | |
75 | **/\r | |
76 | EFI_STATUS\r | |
77 | Execute (\r | |
78 | IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r | |
79 | IN EFI_SMBUS_DEVICE_COMMAND Command,\r | |
80 | IN EFI_SMBUS_OPERATION Operation,\r | |
81 | IN BOOLEAN PecCheck,\r | |
82 | IN OUT UINTN *Length,\r | |
83 | IN OUT VOID *Buffer\r | |
84 | );\r | |
85 | \r | |
86 | #endif\r |