]>
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 | |
c9f231d0 | 7 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
9b6bbcdb MK |
8 | \r |
9 | **/\r | |
10 | \r | |
11 | #ifndef _QNC_SMBUS_H_\r | |
12 | #define _QNC_SMBUS_H_\r | |
13 | \r | |
14 | #include "CommonHeader.h"\r | |
15 | \r | |
16 | //\r | |
17 | // Minimum and maximum length for SMBus bus block protocols defined in SMBus spec 2.0.\r | |
18 | //\r | |
19 | #define MIN_SMBUS_BLOCK_LEN 1\r | |
20 | #define MAX_SMBUS_BLOCK_LEN 32\r | |
21 | #define ADD_LENGTH(SmbusAddress, Length) ((SmbusAddress) + SMBUS_LIB_ADDRESS (0, 0, (Length), FALSE))\r | |
22 | \r | |
23 | /**\r | |
24 | Executes an SMBus operation to an SMBus controller. Returns when either the command has been\r | |
25 | executed or an error is encountered in doing the operation.\r | |
26 | \r | |
27 | The internal worker function provides a standard way to execute an operation as defined in the\r | |
28 | System Management Bus (SMBus) Specification. The resulting transaction will be either that the\r | |
29 | SMBus slave devices accept this transaction or that this function returns with error.\r | |
30 | \r | |
31 | @param SlaveAddress The SMBus slave address of the device with which to communicate.\r | |
32 | @param Command This command is transmitted by the SMBus host controller to the\r | |
33 | SMBus slave device and the interpretation is SMBus slave device\r | |
34 | specific. It can mean the offset to a list of functions inside an\r | |
35 | SMBus slave device. Not all operations or slave devices support\r | |
36 | this command's registers.\r | |
37 | @param Operation Signifies which particular SMBus hardware protocol instance that\r | |
38 | it will use to execute the SMBus transactions. This SMBus\r | |
39 | hardware protocol is defined by the SMBus Specification and is\r | |
40 | not related to EFI.\r | |
41 | @param PecCheck Defines if Packet Error Code (PEC) checking is required for this\r | |
42 | operation.\r | |
43 | @param Length Signifies the number of bytes that this operation will do. The\r | |
44 | maximum number of bytes can be revision specific and operation\r | |
45 | specific. This field will contain the actual number of bytes that\r | |
46 | are executed for this operation. Not all operations require this\r | |
47 | argument.\r | |
48 | @param Buffer Contains the value of data to execute to the SMBus slave device.\r | |
49 | Not all operations require this argument. The length of this\r | |
50 | buffer is identified by Length.\r | |
51 | \r | |
52 | @retval EFI_SUCCESS The last data that was returned from the access matched the poll\r | |
53 | exit criteria.\r | |
54 | @retval EFI_CRC_ERROR Checksum is not correct (PEC is incorrect).\r | |
55 | @retval EFI_TIMEOUT Timeout expired before the operation was completed. Timeout is\r | |
56 | determined by the SMBus host controller device.\r | |
57 | @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r | |
58 | @retval EFI_DEVICE_ERROR The request was not completed because a failure that was\r | |
59 | reflected in the Host Status Register bit. Device errors are a\r | |
60 | result of a transaction collision, illegal command field,\r | |
61 | unclaimed cycle (host initiated), or bus errors (collisions).\r | |
62 | @retval EFI_INVALID_PARAMETER Operation is not defined in EFI_SMBUS_OPERATION.\r | |
63 | @retval EFI_INVALID_PARAMETER Length/Buffer is NULL for operations except for EfiSmbusQuickRead\r | |
64 | and EfiSmbusQuickWrite. Length is outside the range of valid\r | |
65 | values.\r | |
66 | @retval EFI_UNSUPPORTED The SMBus operation or PEC is not supported.\r | |
67 | @retval EFI_BUFFER_TOO_SMALL Buffer is not sufficient for this operation.\r | |
68 | \r | |
69 | **/\r | |
70 | EFI_STATUS\r | |
71 | Execute (\r | |
72 | IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r | |
73 | IN EFI_SMBUS_DEVICE_COMMAND Command,\r | |
74 | IN EFI_SMBUS_OPERATION Operation,\r | |
75 | IN BOOLEAN PecCheck,\r | |
76 | IN OUT UINTN *Length,\r | |
77 | IN OUT VOID *Buffer\r | |
78 | );\r | |
79 | \r | |
80 | #endif\r |