0001
0002
0003 #ifndef ADF_TRANSPORT_ACCESS_MACROS_H
0004 #define ADF_TRANSPORT_ACCESS_MACROS_H
0005
0006 #include "adf_accel_devices.h"
0007 #define ADF_RING_CONFIG_NEAR_FULL_WM 0x0A
0008 #define ADF_RING_CONFIG_NEAR_EMPTY_WM 0x05
0009 #define ADF_COALESCING_MIN_TIME 0x1FF
0010 #define ADF_COALESCING_MAX_TIME 0xFFFFF
0011 #define ADF_COALESCING_DEF_TIME 0x27FF
0012 #define ADF_RING_NEAR_WATERMARK_512 0x08
0013 #define ADF_RING_NEAR_WATERMARK_0 0x00
0014 #define ADF_RING_EMPTY_SIG 0x7F7F7F7F
0015
0016
0017 #define ADF_RING_SIZE_128 0x01
0018 #define ADF_RING_SIZE_256 0x02
0019 #define ADF_RING_SIZE_512 0x03
0020 #define ADF_RING_SIZE_4K 0x06
0021 #define ADF_RING_SIZE_16K 0x08
0022 #define ADF_RING_SIZE_4M 0x10
0023 #define ADF_MIN_RING_SIZE ADF_RING_SIZE_128
0024 #define ADF_MAX_RING_SIZE ADF_RING_SIZE_4M
0025 #define ADF_DEFAULT_RING_SIZE ADF_RING_SIZE_16K
0026
0027
0028 #define ADF_MSG_SIZE_32 0x01
0029 #define ADF_MSG_SIZE_64 0x02
0030 #define ADF_MSG_SIZE_128 0x04
0031 #define ADF_MIN_MSG_SIZE ADF_MSG_SIZE_32
0032 #define ADF_MAX_MSG_SIZE ADF_MSG_SIZE_128
0033
0034
0035 #define ADF_MSG_SIZE_TO_BYTES(SIZE) (SIZE << 5)
0036 #define ADF_BYTES_TO_MSG_SIZE(SIZE) (SIZE >> 5)
0037 #define ADF_SIZE_TO_RING_SIZE_IN_BYTES(SIZE) ((1 << (SIZE - 1)) << 7)
0038 #define ADF_RING_SIZE_IN_BYTES_TO_SIZE(SIZE) ((1 << (SIZE - 1)) >> 7)
0039
0040
0041 #define ADF_RING_SIZE_BYTES_MIN(SIZE) \
0042 ((SIZE < ADF_SIZE_TO_RING_SIZE_IN_BYTES(ADF_RING_SIZE_4K)) ? \
0043 ADF_SIZE_TO_RING_SIZE_IN_BYTES(ADF_RING_SIZE_4K) : SIZE)
0044 #define ADF_RING_SIZE_MODULO(SIZE) (SIZE + 0x6)
0045 #define ADF_SIZE_TO_POW(SIZE) ((((SIZE & 0x4) >> 1) | ((SIZE & 0x4) >> 2) | \
0046 SIZE) & ~0x4)
0047
0048 #define ADF_MAX_INFLIGHTS(RING_SIZE, MSG_SIZE) \
0049 ((((1 << (RING_SIZE - 1)) << 3) >> ADF_SIZE_TO_POW(MSG_SIZE)) - 1)
0050 #define BUILD_RING_CONFIG(size) \
0051 ((ADF_RING_NEAR_WATERMARK_0 << ADF_RING_CONFIG_NEAR_FULL_WM) \
0052 | (ADF_RING_NEAR_WATERMARK_0 << ADF_RING_CONFIG_NEAR_EMPTY_WM) \
0053 | size)
0054 #define BUILD_RESP_RING_CONFIG(size, watermark_nf, watermark_ne) \
0055 ((watermark_nf << ADF_RING_CONFIG_NEAR_FULL_WM) \
0056 | (watermark_ne << ADF_RING_CONFIG_NEAR_EMPTY_WM) \
0057 | size)
0058 #endif