0001
0002
0003
0004 #ifndef _QTN_FMAC_PCIE_IPC_H_
0005 #define _QTN_FMAC_PCIE_IPC_H_
0006
0007 #include <linux/types.h>
0008
0009 #include "shm_ipc_defs.h"
0010
0011
0012 #define QTN_BDA_PCIE_INIT 0x01
0013 #define QTN_BDA_PCIE_RDY 0x02
0014 #define QTN_BDA_FW_LOAD_RDY 0x03
0015 #define QTN_BDA_FW_LOAD_DONE 0x04
0016 #define QTN_BDA_FW_START 0x05
0017 #define QTN_BDA_FW_RUN 0x06
0018 #define QTN_BDA_FW_HOST_RDY 0x07
0019 #define QTN_BDA_FW_TARGET_RDY 0x11
0020 #define QTN_BDA_FW_TARGET_BOOT 0x12
0021 #define QTN_BDA_FW_FLASH_BOOT 0x13
0022 #define QTN_BDA_FW_QLINK_DONE 0x14
0023 #define QTN_BDA_FW_HOST_LOAD 0x08
0024 #define QTN_BDA_FW_BLOCK_DONE 0x09
0025 #define QTN_BDA_FW_BLOCK_RDY 0x0A
0026 #define QTN_BDA_FW_EP_RDY 0x0B
0027 #define QTN_BDA_FW_BLOCK_END 0x0C
0028 #define QTN_BDA_FW_CONFIG 0x0D
0029 #define QTN_BDA_FW_RUNNING 0x0E
0030 #define QTN_BDA_PCIE_FAIL 0x82
0031 #define QTN_BDA_FW_LOAD_FAIL 0x85
0032
0033 #define QTN_BDA_RCMODE BIT(1)
0034 #define QTN_BDA_MSI BIT(2)
0035 #define QTN_BDA_HOST_CALCMD BIT(3)
0036 #define QTN_BDA_FLASH_PRESENT BIT(4)
0037 #define QTN_BDA_FLASH_BOOT BIT(5)
0038 #define QTN_BDA_XMIT_UBOOT BIT(6)
0039 #define QTN_BDA_HOST_QLINK_DRV BIT(7)
0040 #define QTN_BDA_TARGET_FBOOT_ERR BIT(8)
0041 #define QTN_BDA_TARGET_FWLOAD_ERR BIT(9)
0042 #define QTN_BDA_HOST_NOFW_ERR BIT(12)
0043 #define QTN_BDA_HOST_MEMALLOC_ERR BIT(13)
0044 #define QTN_BDA_HOST_MEMMAP_ERR BIT(14)
0045 #define QTN_BDA_VER(x) (((x) >> 4) & 0xFF)
0046 #define QTN_BDA_ERROR_MASK 0xFF00
0047
0048
0049 #if BITS_PER_LONG == 64
0050 #define QTN_HOST_HI32(a) ((u32)(((u64)a) >> 32))
0051 #define QTN_HOST_LO32(a) ((u32)(((u64)a) & 0xffffffffUL))
0052 #define QTN_HOST_ADDR(h, l) ((((u64)h) << 32) | ((u64)l))
0053 #elif BITS_PER_LONG == 32
0054 #define QTN_HOST_HI32(a) 0
0055 #define QTN_HOST_LO32(a) ((u32)(((u32)a) & 0xffffffffUL))
0056 #define QTN_HOST_ADDR(h, l) ((u32)l)
0057 #else
0058 #error Unexpected BITS_PER_LONG value
0059 #endif
0060
0061 #define QTN_PCIE_BDA_VERSION 0x1001
0062
0063 #define PCIE_BDA_NAMELEN 32
0064
0065 #define QTN_PCIE_RC_TX_QUEUE_LEN 256
0066 #define QTN_PCIE_TX_VALID_PKT 0x80000000
0067 #define QTN_PCIE_PKT_LEN_MASK 0xffff
0068
0069 #define QTN_BD_EMPTY ((uint32_t)0x00000001)
0070 #define QTN_BD_WRAP ((uint32_t)0x00000002)
0071 #define QTN_BD_MASK_LEN ((uint32_t)0xFFFF0000)
0072 #define QTN_BD_MASK_OFFSET ((uint32_t)0x0000FF00)
0073
0074 #define QTN_GET_LEN(x) (((x) >> 16) & 0xFFFF)
0075 #define QTN_GET_OFFSET(x) (((x) >> 8) & 0xFF)
0076 #define QTN_SET_LEN(len) (((len) & 0xFFFF) << 16)
0077 #define QTN_SET_OFFSET(of) (((of) & 0xFF) << 8)
0078
0079 #define RX_DONE_INTR_MSK ((0x1 << 6) - 1)
0080
0081 #define PCIE_DMA_OFFSET_ERROR 0xFFFF
0082 #define PCIE_DMA_OFFSET_ERROR_MASK 0xFFFF
0083
0084 #define QTN_PCI_ENDIAN_DETECT_DATA 0x12345678
0085 #define QTN_PCI_ENDIAN_REVERSE_DATA 0x78563412
0086 #define QTN_PCI_ENDIAN_VALID_STATUS 0x3c3c3c3c
0087 #define QTN_PCI_ENDIAN_INVALID_STATUS 0
0088 #define QTN_PCI_LITTLE_ENDIAN 0
0089 #define QTN_PCI_BIG_ENDIAN 0xffffffff
0090
0091 #define NBLOCKS(size, blksize) \
0092 ((size) / (blksize) + (((size) % (blksize) > 0) ? 1 : 0))
0093
0094 #endif