1*4882a593Smuzhiyun /* 2*4882a593Smuzhiyun * HND Run Time Environment ioctl. 3*4882a593Smuzhiyun * 4*4882a593Smuzhiyun * Copyright (C) 2020, Broadcom. 5*4882a593Smuzhiyun * 6*4882a593Smuzhiyun * Unless you and Broadcom execute a separate written software license 7*4882a593Smuzhiyun * agreement governing use of this software, this software is licensed to you 8*4882a593Smuzhiyun * under the terms of the GNU General Public License version 2 (the "GPL"), 9*4882a593Smuzhiyun * available at http://www.broadcom.com/licenses/GPLv2.php, with the 10*4882a593Smuzhiyun * following added to such license: 11*4882a593Smuzhiyun * 12*4882a593Smuzhiyun * As a special exception, the copyright holders of this software give you 13*4882a593Smuzhiyun * permission to link this software with independent modules, and to copy and 14*4882a593Smuzhiyun * distribute the resulting executable under terms of your choice, provided that 15*4882a593Smuzhiyun * you also meet, for each linked independent module, the terms and conditions of 16*4882a593Smuzhiyun * the license of that module. An independent module is a module which is not 17*4882a593Smuzhiyun * derived from this software. The special exception does not apply to any 18*4882a593Smuzhiyun * modifications of the software. 19*4882a593Smuzhiyun * 20*4882a593Smuzhiyun * 21*4882a593Smuzhiyun * <<Broadcom-WL-IPTag/Dual:>> 22*4882a593Smuzhiyun */ 23*4882a593Smuzhiyun 24*4882a593Smuzhiyun #ifndef _dngl_ioctl_h_ 25*4882a593Smuzhiyun #define _dngl_ioctl_h_ 26*4882a593Smuzhiyun 27*4882a593Smuzhiyun /* ==== Dongle IOCTLs i.e. non-d11 IOCTLs ==== */ 28*4882a593Smuzhiyun 29*4882a593Smuzhiyun #ifndef _rte_ioctl_h_ 30*4882a593Smuzhiyun /* ================================================================ */ 31*4882a593Smuzhiyun /* These are the existing ioctls moved from src/include/rte_ioctl.h */ 32*4882a593Smuzhiyun /* ================================================================ */ 33*4882a593Smuzhiyun 34*4882a593Smuzhiyun /* RTE IOCTL definitions for generic ether devices */ 35*4882a593Smuzhiyun #define RTEIOCTLSTART 0x8901 36*4882a593Smuzhiyun #define RTEGHWADDR 0x8901 37*4882a593Smuzhiyun #define RTESHWADDR 0x8902 38*4882a593Smuzhiyun #define RTEGMTU 0x8903 39*4882a593Smuzhiyun #define RTEGSTATS 0x8904 40*4882a593Smuzhiyun #define RTEGALLMULTI 0x8905 41*4882a593Smuzhiyun #define RTESALLMULTI 0x8906 42*4882a593Smuzhiyun #define RTEGPROMISC 0x8907 43*4882a593Smuzhiyun #define RTESPROMISC 0x8908 44*4882a593Smuzhiyun #define RTESMULTILIST 0x8909 45*4882a593Smuzhiyun #define RTEGUP 0x890A 46*4882a593Smuzhiyun #define RTEGPERMADDR 0x890B 47*4882a593Smuzhiyun #define RTEDEVPWRSTCHG 0x890C /* Device pwr state change for PCIedev */ 48*4882a593Smuzhiyun #define RTEDEVPMETOGGLE 0x890D /* Toggle PME# to wake up the host */ 49*4882a593Smuzhiyun #define RTEDEVTIMESYNC 0x890E /* Device TimeSync */ 50*4882a593Smuzhiyun #define RTEDEVDSNOTIFY 0x890F /* Bus DS state notification */ 51*4882a593Smuzhiyun #define RTED11DMALPBK_INIT 0x8910 /* D11 DMA loopback init */ 52*4882a593Smuzhiyun #define RTED11DMALPBK_UNINIT 0x8911 /* D11 DMA loopback uninit */ 53*4882a593Smuzhiyun #define RTED11DMALPBK_RUN 0x8912 /* D11 DMA loopback run */ 54*4882a593Smuzhiyun #define RTEDEVTSBUFPOST 0x8913 /* Async interface for tsync buffer post */ 55*4882a593Smuzhiyun #define RTED11DMAHOSTLPBK_RUN 0x8914 /* D11 DMA host memory loopback run */ 56*4882a593Smuzhiyun #define RTEDEVGETTSF 0x8915 /* Get device TSF */ 57*4882a593Smuzhiyun #define RTEDURATIONUNIT 0x8916 /* Duration unit */ 58*4882a593Smuzhiyun #define RTEWRITE_WAR_REGS 0x8917 /* write workaround regs */ 59*4882a593Smuzhiyun #define RTEDEVRMPMK 0x8918 /* Remove PMK */ 60*4882a593Smuzhiyun #define RTEDEVDBGVAL 0x8919 /* Set debug val */ 61*4882a593Smuzhiyun /* Ensure last RTE IOCTL define val is assigned to RTEIOCTLEND */ 62*4882a593Smuzhiyun #define RTEIOCTLEND 0x8919 /* LAST RTE IOCTL value */ 63*4882a593Smuzhiyun 64*4882a593Smuzhiyun #define RTE_IOCTL_QUERY 0x00 65*4882a593Smuzhiyun #define RTE_IOCTL_SET 0x01 66*4882a593Smuzhiyun #define RTE_IOCTL_OVL_IDX_MASK 0x1e 67*4882a593Smuzhiyun #define RTE_IOCTL_OVL_RSV 0x20 68*4882a593Smuzhiyun #define RTE_IOCTL_OVL 0x40 69*4882a593Smuzhiyun #define RTE_IOCTL_OVL_IDX_SHIFT 1 70*4882a593Smuzhiyun 71*4882a593Smuzhiyun enum hnd_ioctl_cmd { 72*4882a593Smuzhiyun HND_RTE_DNGL_IS_SS = 1, /* true if device connected at super speed */ 73*4882a593Smuzhiyun 74*4882a593Smuzhiyun /* PCIEDEV specific wl <--> bus ioctls */ 75*4882a593Smuzhiyun BUS_GET_VAR = 2, 76*4882a593Smuzhiyun BUS_SET_VAR = 3, 77*4882a593Smuzhiyun BUS_FLUSH_RXREORDER_Q = 4, 78*4882a593Smuzhiyun BUS_SET_LTR_STATE = 5, 79*4882a593Smuzhiyun BUS_FLUSH_CHAINED_PKTS = 6, 80*4882a593Smuzhiyun BUS_SET_COPY_COUNT = 7, 81*4882a593Smuzhiyun BUS_UPDATE_FLOW_PKTS_MAX = 8, 82*4882a593Smuzhiyun BUS_UPDATE_EXTRA_TXLFRAGS = 9, 83*4882a593Smuzhiyun BUS_UPDATE_FRWD_RESRV_BUFCNT = 10, 84*4882a593Smuzhiyun BUS_PCIE_CONFIG_ACCESS = 11, 85*4882a593Smuzhiyun BUS_HC_EVENT_MASK_UPDATE = 12, 86*4882a593Smuzhiyun BUS_SET_MAC_WAKE_STATE = 13, 87*4882a593Smuzhiyun BUS_FRWD_PKT_RXCMPLT = 14, 88*4882a593Smuzhiyun BUS_PCIE_LATENCY_ENAB = 15, /* to enable latency feature in pcie */ 89*4882a593Smuzhiyun BUS_GET_MAXITEMS = 16, 90*4882a593Smuzhiyun BUS_SET_BUS_CSO_CAP = 17, /* Update the CSO cap from wl layer to bus layer */ 91*4882a593Smuzhiyun BUS_DUMP_RX_DMA_STALL_RELATED_INFO = 18, 92*4882a593Smuzhiyun BUS_UPDATE_RESVPOOL_STATE = 19 /* Update resvpool state */ 93*4882a593Smuzhiyun }; 94*4882a593Smuzhiyun 95*4882a593Smuzhiyun #define SDPCMDEV_SET_MAXTXPKTGLOM 1 96*4882a593Smuzhiyun #define RTE_MEMUSEINFO_VER 0x00 97*4882a593Smuzhiyun 98*4882a593Smuzhiyun typedef struct memuse_info { 99*4882a593Smuzhiyun uint16 ver; /* version of this struct */ 100*4882a593Smuzhiyun uint16 len; /* length in bytes of this structure */ 101*4882a593Smuzhiyun uint32 tot; /* Total memory */ 102*4882a593Smuzhiyun uint32 text_len; /* Size of Text segment memory */ 103*4882a593Smuzhiyun uint32 data_len; /* Size of Data segment memory */ 104*4882a593Smuzhiyun uint32 bss_len; /* Size of BSS segment memory */ 105*4882a593Smuzhiyun 106*4882a593Smuzhiyun uint32 arena_size; /* Total Heap size */ 107*4882a593Smuzhiyun uint32 arena_free; /* Heap memory available or free */ 108*4882a593Smuzhiyun uint32 inuse_size; /* Heap memory currently in use */ 109*4882a593Smuzhiyun uint32 inuse_hwm; /* High watermark of memory - reclaimed memory */ 110*4882a593Smuzhiyun uint32 inuse_overhead; /* tally of allocated mem_t blocks */ 111*4882a593Smuzhiyun uint32 inuse_total; /* Heap in-use + Heap overhead memory */ 112*4882a593Smuzhiyun uint32 free_lwm; /* Least free size since reclaim */ 113*4882a593Smuzhiyun uint32 mf_count; /* Malloc failure count */ 114*4882a593Smuzhiyun } memuse_info_t; 115*4882a593Smuzhiyun 116*4882a593Smuzhiyun /* Different DMA loopback modes */ 117*4882a593Smuzhiyun #define M2M_DMA_LOOPBACK 0 /* PCIE M2M mode */ 118*4882a593Smuzhiyun #define D11_DMA_LOOPBACK 1 /* PCIE M2M and D11 mode without ucode */ 119*4882a593Smuzhiyun #define BMC_DMA_LOOPBACK 2 /* PCIE M2M and D11 mode with ucode */ 120*4882a593Smuzhiyun #define M2M_NON_DMA_LOOPBACK 3 /* Non DMA(indirect) mode */ 121*4882a593Smuzhiyun #define D11_DMA_HOST_MEM_LPBK 4 /* D11 mode */ 122*4882a593Smuzhiyun #define M2M_DMA_WRITE_TO_RAM 6 /* PCIE M2M write to specific memory mode */ 123*4882a593Smuzhiyun #define M2M_DMA_READ_FROM_RAM 7 /* PCIE M2M read from specific memory mode */ 124*4882a593Smuzhiyun #define D11_DMA_WRITE_TO_RAM 8 /* D11 write to specific memory mode */ 125*4882a593Smuzhiyun #define D11_DMA_READ_FROM_RAM 9 /* D11 read from specific memory mode */ 126*4882a593Smuzhiyun 127*4882a593Smuzhiyun /* For D11 DMA loopback test */ 128*4882a593Smuzhiyun typedef struct d11_dmalpbk_init_args { 129*4882a593Smuzhiyun uint8 core_num; 130*4882a593Smuzhiyun uint8 lpbk_mode; 131*4882a593Smuzhiyun } d11_dmalpbk_init_args_t; 132*4882a593Smuzhiyun 133*4882a593Smuzhiyun typedef struct d11_dmalpbk_args { 134*4882a593Smuzhiyun uint8 *buf; 135*4882a593Smuzhiyun int32 len; 136*4882a593Smuzhiyun void *p; 137*4882a593Smuzhiyun uint8 core_num; 138*4882a593Smuzhiyun uint8 pad[3]; 139*4882a593Smuzhiyun } d11_dmalpbk_args_t; 140*4882a593Smuzhiyun 141*4882a593Smuzhiyun typedef enum wl_config_var { 142*4882a593Smuzhiyun WL_VAR_TX_PKTFETCH_INDUCE = 1, 143*4882a593Smuzhiyun WL_VAR_LAST 144*4882a593Smuzhiyun } wl_config_var_t; 145*4882a593Smuzhiyun 146*4882a593Smuzhiyun typedef struct wl_config_buf { 147*4882a593Smuzhiyun wl_config_var_t var; 148*4882a593Smuzhiyun uint32 val; 149*4882a593Smuzhiyun } wl_config_buf_t; 150*4882a593Smuzhiyun 151*4882a593Smuzhiyun /* ================================================================ */ 152*4882a593Smuzhiyun /* These are the existing ioctls moved from src/include/rte_ioctl.h */ 153*4882a593Smuzhiyun /* ================================================================ */ 154*4882a593Smuzhiyun #endif /* _rte_ioctl_h_ */ 155*4882a593Smuzhiyun 156*4882a593Smuzhiyun /* MPU test iovar version */ 157*4882a593Smuzhiyun #define MPU_TEST_STRUCT_VER 0 158*4882a593Smuzhiyun 159*4882a593Smuzhiyun /* MPU test OP */ 160*4882a593Smuzhiyun #define MPU_TEST_OP_READ 0 161*4882a593Smuzhiyun #define MPU_TEST_OP_WRITE 1 162*4882a593Smuzhiyun #define MPU_TEST_OP_EXECUTE 2 163*4882a593Smuzhiyun 164*4882a593Smuzhiyun /* Debug iovar for MPU testing */ 165*4882a593Smuzhiyun typedef struct mpu_test_args { 166*4882a593Smuzhiyun /* version control */ 167*4882a593Smuzhiyun uint16 ver; 168*4882a593Smuzhiyun uint16 len; /* the length of this structure */ 169*4882a593Smuzhiyun /* data */ 170*4882a593Smuzhiyun uint32 addr; 171*4882a593Smuzhiyun uint8 op; /* see MPU_TEST_OP_XXXX */ 172*4882a593Smuzhiyun uint8 rsvd; 173*4882a593Smuzhiyun uint16 size; /* valid for read/write */ 174*4882a593Smuzhiyun uint8 val[]; 175*4882a593Smuzhiyun } mpu_test_args_t; 176*4882a593Smuzhiyun 177*4882a593Smuzhiyun #endif /* _dngl_ioctl_h_ */ 178