linux/drivers/net/ethernet/tehuti/tehuti.h

/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
 * Tehuti Networks(R) Network Driver
 * Copyright (C) 2007 Tehuti Networks Ltd. All rights reserved
 */

#ifndef _TEHUTI_H
#define _TEHUTI_H

#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/pci.h>
#include <linux/delay.h>
#include <linux/ethtool.h>
#include <linux/mii.h>
#include <linux/crc32.h>
#include <linux/uaccess.h>
#include <linux/in.h>
#include <linux/ip.h>
#include <linux/tcp.h>
#include <linux/sched.h>
#include <linux/tty.h>
#include <linux/if_vlan.h>
#include <linux/interrupt.h>
#include <linux/vmalloc.h>
#include <linux/firmware.h>
#include <asm/byteorder.h>
#include <linux/dma-mapping.h>
#include <linux/slab.h>

/* Compile Time Switches */
/* start */
#define BDX_TSO
#define BDX_LLTX
#define BDX_DELAY_WPTR
/* #define BDX_MSI */
/* end */

#if !defined CONFIG_PCI_MSI
#   undef BDX_MSI
#endif

#define BDX_DEF_MSG_ENABLE

/* ioctl ops */
#define BDX_OP_READ
#define BDX_OP_WRITE

/* RX copy break size */
#define BDX_COPYBREAK

#define DRIVER_AUTHOR
#define BDX_DRV_DESC
#define BDX_DRV_NAME
#define BDX_NIC_NAME
#define BDX_NIC2PORT_NAME
#define BDX_DRV_VERSION

#ifdef BDX_MSI
#define BDX_MSI_STRING
#else
#define BDX_MSI_STRING
#endif

/* netdev tx queue len for Luxor. default value is, btw, 1000
 * ifcontig eth1 txqueuelen 3000 - to change it at runtime */
#define BDX_NDEV_TXQ_LEN

/* Max MTU for Jumbo Frame mode, per tehutinetworks.net Features FAQ is 16k */
#define BDX_MAX_MTU

#define FIFO_SIZE
#define FIFO_EXTRA_SPACE

#if BITS_PER_LONG == 64
#define H32_64(x)
#define L32_64(x)
#elif BITS_PER_LONG == 32
#define H32_64
#define L32_64
#else				/* BITS_PER_LONG == ?? */
#    error BITS_PER_LONG is undefined. Must be 64 or 32
#endif				/* BITS_PER_LONG */

#ifdef __BIG_ENDIAN
#define CPU_CHIP_SWAP32
#define CPU_CHIP_SWAP16
#else
#define CPU_CHIP_SWAP32(x)
#define CPU_CHIP_SWAP16(x)
#endif

#define READ_REG(pp, reg)
#define WRITE_REG(pp, reg, val)

#ifndef NET_IP_ALIGN
#define NET_IP_ALIGN
#endif

#ifndef NETDEV_TX_OK
#define NETDEV_TX_OK
#endif

#define LUXOR_MAX_PORT
#define BDX_MAX_RX_DONE
#define BDX_TXF_DESC_SZ
#define BDX_MAX_TX_LEVEL
#define BDX_MIN_TX_LEVEL
#define BDX_NO_UPD_PACKETS

struct pci_nic {};

enum {};

#define PCK_TH_MULT
#define INT_COAL_MULT

#define BITS_MASK(nbits)
#define GET_BITS_SHIFT(x, nbits, nshift)
#define BITS_SHIFT_MASK(nbits, nshift)
#define BITS_SHIFT_VAL(x, nbits, nshift)
#define BITS_SHIFT_CLEAR(x, nbits, nshift)

#define GET_INT_COAL(x)
#define GET_INT_COAL_RC(x)
#define GET_RXF_TH(x)
#define GET_PCK_TH(x)

#define INT_REG_VAL(coal, coal_rc, rxf_th, pck_th)

struct fifo {};

struct txf_fifo {};

struct txd_fifo {};

struct rxf_fifo {};

struct rxd_fifo {};

struct rx_map {};

struct rxdb {};

bdx_dma_addr;

/* Entry in the db.
 * if len == 0 addr is dma
 * if len != 0 addr is skb */
struct tx_map {};

/* tx database - implemented as circular fifo buffer*/
struct txdb {};

/*Internal stats structure*/
struct bdx_stats {};

struct bdx_priv {};

/* RX FREE descriptor - 64bit*/
struct rxf_desc {};

#define GET_RXD_BC(x)
#define GET_RXD_RXFQ(x)
#define GET_RXD_TO(x)
#define GET_RXD_TYPE(x)
#define GET_RXD_ERR(x)
#define GET_RXD_RXP(x)
#define GET_RXD_PKT_ID(x)
#define GET_RXD_VTAG(x)
#define GET_RXD_VLAN_ID(x)
#define GET_RXD_VLAN_TCI(x)
#define GET_RXD_CFI(x)
#define GET_RXD_PRIO(x)

struct rxd_desc {};

/* PBL describes each virtual buffer to be */
/* transmitted from the host.*/
struct pbl {};

/* First word for TXD descriptor. It means: type = 3 for regular Tx packet,
 * hw_csum = 7 for ip+udp+tcp hw checksums */
#define TXD_W1_VAL(bc, checksum, vtag, lgsnd, vlan_id)

struct txd_desc {} __packed;

/* Register region size */
#define BDX_REGS_SIZE

/* Registers from 0x0000-0x00fc were remapped to 0x4000-0x40fc */
#define regTXD_CFG1_0
#define regRXF_CFG1_0
#define regRXD_CFG1_0
#define regTXF_CFG1_0
#define regTXD_CFG0_0
#define regRXF_CFG0_0
#define regRXD_CFG0_0
#define regTXF_CFG0_0
#define regTXD_WPTR_0
#define regRXF_WPTR_0
#define regRXD_WPTR_0
#define regTXF_WPTR_0
#define regTXD_RPTR_0
#define regRXF_RPTR_0
#define regRXD_RPTR_0
#define regTXF_RPTR_0
#define regTXF_RPTR_3

/* hardware versioning */
#define FW_VER
#define SROM_VER
#define FPGA_VER
#define FPGA_SEED

/* Registers from 0x0100-0x0150 were remapped to 0x5100-0x5150 */
#define regISR
#define regISR0

#define regIMR
#define regIMR0

#define regRDINTCM0
#define regRDINTCM2

#define regTDINTCM0

#define regISR_MSK0

#define regINIT_SEMAPHORE
#define regINIT_STATUS

#define regMAC_LNK_STAT
#define MAC_LINK_STAT

#define regGMAC_RXF_A

#define regUNC_MAC0_A
#define regUNC_MAC1_A
#define regUNC_MAC2_A

#define regVLAN_0

#define regMAX_FRAME_A

#define regRX_MAC_MCST0
#define regRX_MAC_MCST1
#define MAC_MCST_NUM
#define regRX_MCST_HASH0
#define MAC_MCST_HASH_NUM

#define regVPC
#define regVIC
#define regVGLB

#define regCLKPLL

/*for 10G only*/
#define regREVISION
#define regSCRATCH
#define regCTRLST
#define regMAC_ADDR_0
#define regMAC_ADDR_1
#define regFRM_LENGTH
#define regPAUSE_QUANT
#define regRX_FIFO_SECTION
#define regTX_FIFO_SECTION
#define regRX_FULLNESS
#define regTX_FULLNESS
#define regHASHTABLE
#define regMDIO_ST
#define regMDIO_CTL
#define regMDIO_DATA
#define regMDIO_ADDR

#define regRST_PORT
#define regDIS_PORT
#define regRST_QU
#define regDIS_QU

#define regCTRLST_TX_ENA
#define regCTRLST_RX_ENA
#define regCTRLST_PRM_ENA
#define regCTRLST_PAD_ENA

#define regCTRLST_BASE

#define regRX_FLT

/* TXD TXF RXF RXD  CONFIG 0x0000 --- 0x007c*/
#define TX_RX_CFG1_BASE
#define TX_RX_CFG0_BASE
#define TX_RX_CFG0_RSVD
#define TX_RX_CFG0_SIZE

/*  TXD TXF RXF RXD  WRITE 0x0080 --- 0x00BC */
#define TXF_WPTR_WR_PTR

/*  TXD TXF RXF RXD  READ  0x00CO --- 0x00FC */
#define TXF_RPTR_RD_PTR

#define TXF_WPTR_MASK

/*  regISR 0x0100 */
/*  regIMR 0x0110 */
#define IMR_INPROG
#define IR_LNKCHG1
#define IR_LNKCHG0
#define IR_GPIO
#define IR_RFRSH
#define IR_RSVD
#define IR_SWI
#define IR_RX_FREE_3
#define IR_RX_FREE_2
#define IR_RX_FREE_1
#define IR_RX_FREE_0
#define IR_TX_FREE_3
#define IR_TX_FREE_2
#define IR_TX_FREE_1
#define IR_TX_FREE_0
#define IR_RX_DESC_3
#define IR_RX_DESC_2
#define IR_RX_DESC_1
#define IR_RX_DESC_0
#define IR_PSE
#define IR_TMR3
#define IR_TMR2
#define IR_TMR1
#define IR_TMR0
#define IR_VNT
#define IR_RxFL
#define IR_SDPERR
#define IR_TR
#define IR_PCIE_LINK
#define IR_PCIE_TOUT

#define IR_EXTRA
#define IR_RUN
#define IR_ALL

#define IR_LNKCHG0_ofst

#define GMAC_RX_FILTER_OSEN
#define GMAC_RX_FILTER_TXFC
#define GMAC_RX_FILTER_RSV0
#define GMAC_RX_FILTER_FDA
#define GMAC_RX_FILTER_AOF
#define GMAC_RX_FILTER_ACF
#define GMAC_RX_FILTER_ARUNT
#define GMAC_RX_FILTER_ACRC
#define GMAC_RX_FILTER_AM
#define GMAC_RX_FILTER_AB
#define GMAC_RX_FILTER_PRM

#define MAX_FRAME_AB_VAL

#define CLKPLL_PLLLKD
#define CLKPLL_RSTEND
#define CLKPLL_SFTRST

#define CLKPLL_LKD

/*
 * PCI-E Device Control Register (Offset 0x88)
 * Source: Luxor Data Sheet, 7.1.3.3.3
 */
#define PCI_DEV_CTRL_REG
#define GET_DEV_CTRL_MAXPL(x)
#define GET_DEV_CTRL_MRRS(x)

/*
 * PCI-E Link Status Register (Offset 0x92)
 * Source: Luxor Data Sheet, 7.1.3.3.7
 */
#define PCI_LINK_STATUS_REG
#define GET_LINK_STATUS_LANES(x)

/* Debugging Macros */

#define DBG2(fmt, args...)

#define BDX_ASSERT(x)

#ifdef DEBUG

#define ENTER

#define RET

#define DBG
#else
#define ENTER
#define RET(args...)
#define DBG(fmt, args...)
#endif

#endif /* _BDX__H */