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