xref: /openbmc/linux/drivers/net/fddi/skfp/h/hwmtm.h (revision 86d2155e)
12874c5fdSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */
233f810b2SJeff Kirsher /******************************************************************************
333f810b2SJeff Kirsher  *
433f810b2SJeff Kirsher  *	(C)Copyright 1998,1999 SysKonnect,
533f810b2SJeff Kirsher  *	a business unit of Schneider & Koch & Co. Datensysteme GmbH.
633f810b2SJeff Kirsher  *
733f810b2SJeff Kirsher  *	The information in this file is provided "AS IS" without warranty.
833f810b2SJeff Kirsher  *
933f810b2SJeff Kirsher  ******************************************************************************/
1033f810b2SJeff Kirsher 
1133f810b2SJeff Kirsher #ifndef	_HWM_
1233f810b2SJeff Kirsher #define	_HWM_
1333f810b2SJeff Kirsher 
14aab3ac26SJeff Kirsher #include "mbuf.h"
1533f810b2SJeff Kirsher 
1633f810b2SJeff Kirsher /*
1733f810b2SJeff Kirsher  * MACRO for DMA synchronization:
1833f810b2SJeff Kirsher  *	The descriptor 'desc' is flushed for the device 'flag'.
1933f810b2SJeff Kirsher  *	Devices are the CPU (DDI_DMA_SYNC_FORCPU) and the
2033f810b2SJeff Kirsher  *	adapter (DDI_DMA_SYNC_FORDEV).
2133f810b2SJeff Kirsher  *
2233f810b2SJeff Kirsher  *	'desc'	Pointer to a Rx or Tx descriptor.
2333f810b2SJeff Kirsher  *	'flag'	Flag for direction (view for CPU or DEVICE) that
2433f810b2SJeff Kirsher  *		should be synchronized.
2533f810b2SJeff Kirsher  *
2633f810b2SJeff Kirsher  *	Empty macros and defines are specified here. The real macro
2733f810b2SJeff Kirsher  *	is os-specific and should be defined in osdef1st.h.
2833f810b2SJeff Kirsher  */
2933f810b2SJeff Kirsher #ifndef DRV_BUF_FLUSH
3033f810b2SJeff Kirsher #define DRV_BUF_FLUSH(desc,flag)
3133f810b2SJeff Kirsher #define DDI_DMA_SYNC_FORCPU
3233f810b2SJeff Kirsher #define DDI_DMA_SYNC_FORDEV
3333f810b2SJeff Kirsher #endif
3433f810b2SJeff Kirsher 
3533f810b2SJeff Kirsher 	/*
3633f810b2SJeff Kirsher 	 * hardware modul dependent receive modes
3733f810b2SJeff Kirsher 	 */
3833f810b2SJeff Kirsher #define	RX_ENABLE_PASS_SMT	21
3933f810b2SJeff Kirsher #define	RX_DISABLE_PASS_SMT	22
4033f810b2SJeff Kirsher #define	RX_ENABLE_PASS_NSA	23
4133f810b2SJeff Kirsher #define	RX_DISABLE_PASS_NSA	24
4233f810b2SJeff Kirsher #define	RX_ENABLE_PASS_DB	25
4333f810b2SJeff Kirsher #define	RX_DISABLE_PASS_DB	26
4433f810b2SJeff Kirsher #define	RX_DISABLE_PASS_ALL	27
4533f810b2SJeff Kirsher #define	RX_DISABLE_LLC_PROMISC	28
4633f810b2SJeff Kirsher #define	RX_ENABLE_LLC_PROMISC	29
4733f810b2SJeff Kirsher 
4833f810b2SJeff Kirsher 
4933f810b2SJeff Kirsher #ifndef	DMA_RD
5033f810b2SJeff Kirsher #define DMA_RD		1	/* memory -> hw */
5133f810b2SJeff Kirsher #endif
5233f810b2SJeff Kirsher #ifndef DMA_WR
5333f810b2SJeff Kirsher #define DMA_WR		2	/* hw -> memory */
5433f810b2SJeff Kirsher #endif
5533f810b2SJeff Kirsher #define SMT_BUF		0x80
5633f810b2SJeff Kirsher 
5733f810b2SJeff Kirsher 	/*
5833f810b2SJeff Kirsher 	 * bits of the frame status byte
5933f810b2SJeff Kirsher 	 */
6033f810b2SJeff Kirsher #define EN_IRQ_EOF	0x02	/* get IRQ after end of frame transmission */
6133f810b2SJeff Kirsher #define	LOC_TX		0x04	/* send frame to the local SMT */
6233f810b2SJeff Kirsher #define LAST_FRAG	0x08	/* last TxD of the frame */
6333f810b2SJeff Kirsher #define	FIRST_FRAG	0x10	/* first TxD of the frame */
6433f810b2SJeff Kirsher #define	LAN_TX		0x20	/* send frame to network if set */
6533f810b2SJeff Kirsher #define RING_DOWN	0x40	/* error: unable to send, ring down */
6633f810b2SJeff Kirsher #define OUT_OF_TXD	0x80	/* error: not enough TxDs available */
6733f810b2SJeff Kirsher 
6833f810b2SJeff Kirsher 
6933f810b2SJeff Kirsher #ifndef NULL
7033f810b2SJeff Kirsher #define NULL 		0
7133f810b2SJeff Kirsher #endif
7233f810b2SJeff Kirsher 
7333f810b2SJeff Kirsher #define C_INDIC		(1L<<25)
7433f810b2SJeff Kirsher #define A_INDIC		(1L<<26)
7533f810b2SJeff Kirsher #define	RD_FS_LOCAL	0x80
7633f810b2SJeff Kirsher 
7733f810b2SJeff Kirsher 	/*
7833f810b2SJeff Kirsher 	 * DEBUG FLAGS
7933f810b2SJeff Kirsher 	 */
8033f810b2SJeff Kirsher #define	DEBUG_SMTF	1
8133f810b2SJeff Kirsher #define	DEBUG_SMT	2
8233f810b2SJeff Kirsher #define	DEBUG_ECM	3
8333f810b2SJeff Kirsher #define	DEBUG_RMT	4
8433f810b2SJeff Kirsher #define	DEBUG_CFM	5
8533f810b2SJeff Kirsher #define	DEBUG_PCM	6
8633f810b2SJeff Kirsher #define	DEBUG_SBA	7
8733f810b2SJeff Kirsher #define	DEBUG_ESS	8
8833f810b2SJeff Kirsher 
8933f810b2SJeff Kirsher #define	DB_HWM_RX	10
9033f810b2SJeff Kirsher #define	DB_HWM_TX	11
9133f810b2SJeff Kirsher #define DB_HWM_GEN	12
9233f810b2SJeff Kirsher 
9333f810b2SJeff Kirsher struct s_mbuf_pool {
9433f810b2SJeff Kirsher #ifndef	MB_OUTSIDE_SMC
9533f810b2SJeff Kirsher 	SMbuf		mb[MAX_MBUF] ;		/* mbuf pool */
9633f810b2SJeff Kirsher #endif
9733f810b2SJeff Kirsher 	SMbuf		*mb_start ;		/* points to the first mb */
9833f810b2SJeff Kirsher 	SMbuf		*mb_free ;		/* free queue */
9933f810b2SJeff Kirsher } ;
10033f810b2SJeff Kirsher 
10133f810b2SJeff Kirsher struct hwm_r {
10233f810b2SJeff Kirsher 	/*
10333f810b2SJeff Kirsher 	 * hardware modul specific receive variables
10433f810b2SJeff Kirsher 	 */
10533f810b2SJeff Kirsher 	u_int			len ;		/* length of the whole frame */
10633f810b2SJeff Kirsher 	char			*mb_pos ;	/* SMbuf receive position */
10733f810b2SJeff Kirsher } ;
10833f810b2SJeff Kirsher 
10933f810b2SJeff Kirsher struct hw_modul {
11033f810b2SJeff Kirsher 	/*
11133f810b2SJeff Kirsher 	 * All hardware modul specific variables
11233f810b2SJeff Kirsher 	 */
11333f810b2SJeff Kirsher 	struct	s_mbuf_pool	mbuf_pool ;
11433f810b2SJeff Kirsher 	struct	hwm_r	r ;
11533f810b2SJeff Kirsher 
11633f810b2SJeff Kirsher 	union s_fp_descr volatile *descr_p ; /* points to the desriptor area */
11733f810b2SJeff Kirsher 
11833f810b2SJeff Kirsher 	u_short pass_SMT ;		/* pass SMT frames */
11933f810b2SJeff Kirsher 	u_short pass_NSA ;		/* pass all NSA frames */
12033f810b2SJeff Kirsher 	u_short pass_DB ;		/* pass Direct Beacon Frames */
12133f810b2SJeff Kirsher 	u_short pass_llc_promisc ;	/* pass all llc frames (default ON) */
12233f810b2SJeff Kirsher 
12333f810b2SJeff Kirsher 	SMbuf	*llc_rx_pipe ;		/* points to the first queued llc fr */
12433f810b2SJeff Kirsher 	SMbuf	*llc_rx_tail ;		/* points to the last queued llc fr */
12533f810b2SJeff Kirsher 	int	queued_rx_frames ;	/* number of queued frames */
12633f810b2SJeff Kirsher 
12733f810b2SJeff Kirsher 	SMbuf	*txd_tx_pipe ;		/* points to first mb in the txd ring */
12833f810b2SJeff Kirsher 	SMbuf	*txd_tx_tail ;		/* points to last mb in the txd ring */
12933f810b2SJeff Kirsher 	int	queued_txd_mb ;		/* number of SMT MBufs in txd ring */
13033f810b2SJeff Kirsher 
13133f810b2SJeff Kirsher 	int	rx_break ;		/* rev. was breaked because ind. off */
13233f810b2SJeff Kirsher 	int	leave_isr ;		/* leave fddi_isr immedeately if set */
13333f810b2SJeff Kirsher 	int	isr_flag ;		/* set, when HWM is entered from isr */
13433f810b2SJeff Kirsher 	/*
13533f810b2SJeff Kirsher 	 * variables for the current transmit frame
13633f810b2SJeff Kirsher 	 */
13733f810b2SJeff Kirsher 	struct s_smt_tx_queue *tx_p ;	/* pointer to the transmit queue */
13833f810b2SJeff Kirsher 	u_long	tx_descr ;		/* tx descriptor for FORMAC+ */
13933f810b2SJeff Kirsher 	int	tx_len ;		/* tx frame length */
14033f810b2SJeff Kirsher 	SMbuf	*tx_mb ;		/* SMT tx MBuf pointer */
14133f810b2SJeff Kirsher 	char	*tx_data ;		/* data pointer to the SMT tx Mbuf */
14233f810b2SJeff Kirsher 
14333f810b2SJeff Kirsher 	int	detec_count ;		/* counter for out of RxD condition */
14433f810b2SJeff Kirsher 	u_long	rx_len_error ;		/* rx len FORMAC != sum of fragments */
14533f810b2SJeff Kirsher } ;
14633f810b2SJeff Kirsher 
14733f810b2SJeff Kirsher 
14833f810b2SJeff Kirsher /*
14933f810b2SJeff Kirsher  * DEBUG structs and macros
15033f810b2SJeff Kirsher  */
15133f810b2SJeff Kirsher 
15233f810b2SJeff Kirsher #ifdef	DEBUG
15333f810b2SJeff Kirsher struct os_debug {
15433f810b2SJeff Kirsher 	int	hwm_rx ;
15533f810b2SJeff Kirsher 	int	hwm_tx ;
15633f810b2SJeff Kirsher 	int	hwm_gen ;
15733f810b2SJeff Kirsher } ;
15833f810b2SJeff Kirsher #endif
15933f810b2SJeff Kirsher 
16033f810b2SJeff Kirsher #ifdef	DEBUG
16133f810b2SJeff Kirsher #ifdef	DEBUG_BRD
16233f810b2SJeff Kirsher #define	DB_P	smc->debug
16333f810b2SJeff Kirsher #else
16433f810b2SJeff Kirsher #define DB_P	debug
16533f810b2SJeff Kirsher #endif
16633f810b2SJeff Kirsher 
1675dbc6530SJoe Perches #define DB_RX(lev, fmt, ...)						\
1685dbc6530SJoe Perches do {									\
1695dbc6530SJoe Perches 	if (DB_P.d_os.hwm_rx >= (lev))					\
1705dbc6530SJoe Perches 		printf(fmt "\n", ##__VA_ARGS__);			\
1715dbc6530SJoe Perches } while (0)
1725dbc6530SJoe Perches #define DB_TX(lev, fmt, ...)						\
1735dbc6530SJoe Perches do {									\
1745dbc6530SJoe Perches 	if (DB_P.d_os.hwm_tx >= (lev))					\
1755dbc6530SJoe Perches 		printf(fmt "\n", ##__VA_ARGS__);			\
1765dbc6530SJoe Perches } while (0)
1775dbc6530SJoe Perches #define DB_GEN(lev, fmt, ...)						\
1785dbc6530SJoe Perches do {									\
1795dbc6530SJoe Perches 	if (DB_P.d_os.hwm_gen >= (lev))					\
1805dbc6530SJoe Perches 		printf(fmt "\n", ##__VA_ARGS__);			\
1815dbc6530SJoe Perches } while (0)
18233f810b2SJeff Kirsher #else	/* DEBUG */
1835dbc6530SJoe Perches #define DB_RX(lev, fmt, ...)	no_printk(fmt "\n", ##__VA_ARGS__)
1845dbc6530SJoe Perches #define DB_TX(lev, fmt, ...)	no_printk(fmt "\n", ##__VA_ARGS__)
1855dbc6530SJoe Perches #define DB_GEN(lev, fmt, ...)	no_printk(fmt "\n", ##__VA_ARGS__)
18633f810b2SJeff Kirsher #endif	/* DEBUG */
18733f810b2SJeff Kirsher 
18833f810b2SJeff Kirsher #ifndef	SK_BREAK
18933f810b2SJeff Kirsher #define	SK_BREAK()
19033f810b2SJeff Kirsher #endif
19133f810b2SJeff Kirsher 
19233f810b2SJeff Kirsher 
19333f810b2SJeff Kirsher /*
19433f810b2SJeff Kirsher  * HWM Macros
19533f810b2SJeff Kirsher  */
19633f810b2SJeff Kirsher 
19733f810b2SJeff Kirsher /*
19833f810b2SJeff Kirsher  *	BEGIN_MANUAL_ENTRY(HWM_GET_TX_PHYS)
19933f810b2SJeff Kirsher  *	u_long HWM_GET_TX_PHYS(txd)
20033f810b2SJeff Kirsher  *
20133f810b2SJeff Kirsher  * function	MACRO		(hardware module, hwmtm.h)
20233f810b2SJeff Kirsher  *		This macro may be invoked by the OS-specific module to read
20333f810b2SJeff Kirsher  *		the physical address of the specified TxD.
20433f810b2SJeff Kirsher  *
20533f810b2SJeff Kirsher  * para	txd	pointer to the TxD
20633f810b2SJeff Kirsher  *
20733f810b2SJeff Kirsher  *	END_MANUAL_ENTRY
20833f810b2SJeff Kirsher  */
20933f810b2SJeff Kirsher #define	HWM_GET_TX_PHYS(txd)		(u_long)AIX_REVERSE((txd)->txd_tbadr)
21033f810b2SJeff Kirsher 
21133f810b2SJeff Kirsher /*
21233f810b2SJeff Kirsher  *	BEGIN_MANUAL_ENTRY(HWM_GET_TX_LEN)
21333f810b2SJeff Kirsher  *	int HWM_GET_TX_LEN(txd)
21433f810b2SJeff Kirsher  *
21533f810b2SJeff Kirsher  * function	MACRO		(hardware module, hwmtm.h)
21633f810b2SJeff Kirsher  *		This macro may be invoked by the OS-specific module to read
21733f810b2SJeff Kirsher  *		the fragment length of the specified TxD
21833f810b2SJeff Kirsher  *
21933f810b2SJeff Kirsher  * para	rxd	pointer to the TxD
22033f810b2SJeff Kirsher  *
22133f810b2SJeff Kirsher  * return	the length of the fragment in bytes
22233f810b2SJeff Kirsher  *
22333f810b2SJeff Kirsher  *	END_MANUAL_ENTRY
22433f810b2SJeff Kirsher  */
22533f810b2SJeff Kirsher #define	HWM_GET_TX_LEN(txd)	((int)AIX_REVERSE((txd)->txd_tbctrl)& RD_LENGTH)
22633f810b2SJeff Kirsher 
22733f810b2SJeff Kirsher /*
22833f810b2SJeff Kirsher  *	BEGIN_MANUAL_ENTRY(HWM_GET_TX_USED)
22933f810b2SJeff Kirsher  *	txd *HWM_GET_TX_USED(smc,queue)
23033f810b2SJeff Kirsher  *
23133f810b2SJeff Kirsher  * function	MACRO		(hardware module, hwmtm.h)
23233f810b2SJeff Kirsher  *		This macro may be invoked by the OS-specific module to get the
23333f810b2SJeff Kirsher  *		number of used TxDs for the queue, specified by the index.
23433f810b2SJeff Kirsher  *
23533f810b2SJeff Kirsher  * para	queue	the number of the send queue: Can be specified by
23633f810b2SJeff Kirsher  *		QUEUE_A0, QUEUE_S or (frame_status & QUEUE_A0)
23733f810b2SJeff Kirsher  *
23833f810b2SJeff Kirsher  * return	number of used TxDs for this send queue
23933f810b2SJeff Kirsher  *
24033f810b2SJeff Kirsher  *	END_MANUAL_ENTRY
24133f810b2SJeff Kirsher  */
24233f810b2SJeff Kirsher #define	HWM_GET_TX_USED(smc,queue)	(int) (smc)->hw.fp.tx_q[queue].tx_used
24333f810b2SJeff Kirsher 
24433f810b2SJeff Kirsher /*
24533f810b2SJeff Kirsher  *	BEGIN_MANUAL_ENTRY(HWM_GET_CURR_TXD)
24633f810b2SJeff Kirsher  *	txd *HWM_GET_CURR_TXD(smc,queue)
24733f810b2SJeff Kirsher  *
24833f810b2SJeff Kirsher  * function	MACRO		(hardware module, hwmtm.h)
24933f810b2SJeff Kirsher  *		This macro may be invoked by the OS-specific module to get the
25033f810b2SJeff Kirsher  *		pointer to the TxD which points to the current queue put
25133f810b2SJeff Kirsher  *		position.
25233f810b2SJeff Kirsher  *
25333f810b2SJeff Kirsher  * para	queue	the number of the send queue: Can be specified by
25433f810b2SJeff Kirsher  *		QUEUE_A0, QUEUE_S or (frame_status & QUEUE_A0)
25533f810b2SJeff Kirsher  *
25633f810b2SJeff Kirsher  * return	pointer to the current TxD
25733f810b2SJeff Kirsher  *
25833f810b2SJeff Kirsher  *	END_MANUAL_ENTRY
25933f810b2SJeff Kirsher  */
26033f810b2SJeff Kirsher #define	HWM_GET_CURR_TXD(smc,queue)	(struct s_smt_fp_txd volatile *)\
26133f810b2SJeff Kirsher 					(smc)->hw.fp.tx_q[queue].tx_curr_put
26233f810b2SJeff Kirsher 
26333f810b2SJeff Kirsher /*
26433f810b2SJeff Kirsher  *	BEGIN_MANUAL_ENTRY(HWM_GET_RX_FRAG_LEN)
26533f810b2SJeff Kirsher  *	int HWM_GET_RX_FRAG_LEN(rxd)
26633f810b2SJeff Kirsher  *
26733f810b2SJeff Kirsher  * function	MACRO		(hardware module, hwmtm.h)
26833f810b2SJeff Kirsher  *		This macro may be invoked by the OS-specific module to read
26933f810b2SJeff Kirsher  *		the fragment length of the specified RxD
27033f810b2SJeff Kirsher  *
27133f810b2SJeff Kirsher  * para	rxd	pointer to the RxD
27233f810b2SJeff Kirsher  *
27333f810b2SJeff Kirsher  * return	the length of the fragment in bytes
27433f810b2SJeff Kirsher  *
27533f810b2SJeff Kirsher  *	END_MANUAL_ENTRY
27633f810b2SJeff Kirsher  */
27733f810b2SJeff Kirsher #define	HWM_GET_RX_FRAG_LEN(rxd)	((int)AIX_REVERSE((rxd)->rxd_rbctrl)& \
27833f810b2SJeff Kirsher 				RD_LENGTH)
27933f810b2SJeff Kirsher 
28033f810b2SJeff Kirsher /*
28133f810b2SJeff Kirsher  *	BEGIN_MANUAL_ENTRY(HWM_GET_RX_PHYS)
28233f810b2SJeff Kirsher  *	u_long HWM_GET_RX_PHYS(rxd)
28333f810b2SJeff Kirsher  *
28433f810b2SJeff Kirsher  * function	MACRO		(hardware module, hwmtm.h)
28533f810b2SJeff Kirsher  *		This macro may be invoked by the OS-specific module to read
28633f810b2SJeff Kirsher  *		the physical address of the specified RxD.
28733f810b2SJeff Kirsher  *
28833f810b2SJeff Kirsher  * para	rxd	pointer to the RxD
28933f810b2SJeff Kirsher  *
29033f810b2SJeff Kirsher  * return	the RxD's physical pointer to the data fragment
29133f810b2SJeff Kirsher  *
29233f810b2SJeff Kirsher  *	END_MANUAL_ENTRY
29333f810b2SJeff Kirsher  */
29433f810b2SJeff Kirsher #define	HWM_GET_RX_PHYS(rxd)	(u_long)AIX_REVERSE((rxd)->rxd_rbadr)
29533f810b2SJeff Kirsher 
29633f810b2SJeff Kirsher /*
29733f810b2SJeff Kirsher  *	BEGIN_MANUAL_ENTRY(HWM_GET_RX_USED)
29833f810b2SJeff Kirsher  *	int HWM_GET_RX_USED(smc)
29933f810b2SJeff Kirsher  *
30033f810b2SJeff Kirsher  * function	MACRO		(hardware module, hwmtm.h)
30133f810b2SJeff Kirsher  *		This macro may be invoked by the OS-specific module to get
30233f810b2SJeff Kirsher  *		the count of used RXDs in receive queue 1.
30333f810b2SJeff Kirsher  *
30433f810b2SJeff Kirsher  * return	the used RXD count of receive queue 1
30533f810b2SJeff Kirsher  *
30633f810b2SJeff Kirsher  * NOTE: Remember, because of an ASIC bug at least one RXD should be unused
30733f810b2SJeff Kirsher  *	 in the descriptor ring !
30833f810b2SJeff Kirsher  *
30933f810b2SJeff Kirsher  *	END_MANUAL_ENTRY
31033f810b2SJeff Kirsher  */
31133f810b2SJeff Kirsher #define	HWM_GET_RX_USED(smc)	((int)(smc)->hw.fp.rx_q[QUEUE_R1].rx_used)
31233f810b2SJeff Kirsher 
31333f810b2SJeff Kirsher /*
31433f810b2SJeff Kirsher  *	BEGIN_MANUAL_ENTRY(HWM_GET_RX_FREE)
31533f810b2SJeff Kirsher  *	int HWM_GET_RX_FREE(smc)
31633f810b2SJeff Kirsher  *
31733f810b2SJeff Kirsher  * function	MACRO		(hardware module, hwmtm.h)
31833f810b2SJeff Kirsher  *		This macro may be invoked by the OS-specific module to get
31933f810b2SJeff Kirsher  *		the rxd_free count of receive queue 1.
32033f810b2SJeff Kirsher  *
32133f810b2SJeff Kirsher  * return	the rxd_free count of receive queue 1
32233f810b2SJeff Kirsher  *
32333f810b2SJeff Kirsher  *	END_MANUAL_ENTRY
32433f810b2SJeff Kirsher  */
32533f810b2SJeff Kirsher #define	HWM_GET_RX_FREE(smc)	((int)(smc)->hw.fp.rx_q[QUEUE_R1].rx_free-1)
32633f810b2SJeff Kirsher 
32733f810b2SJeff Kirsher /*
32833f810b2SJeff Kirsher  *	BEGIN_MANUAL_ENTRY(HWM_GET_CURR_RXD)
32933f810b2SJeff Kirsher  *	rxd *HWM_GET_CURR_RXD(smc)
33033f810b2SJeff Kirsher  *
33133f810b2SJeff Kirsher  * function	MACRO		(hardware module, hwmtm.h)
33233f810b2SJeff Kirsher  *		This macro may be invoked by the OS-specific module to get the
33333f810b2SJeff Kirsher  *		pointer to the RxD which points to the current queue put
33433f810b2SJeff Kirsher  *		position.
33533f810b2SJeff Kirsher  *
33633f810b2SJeff Kirsher  * return	pointer to the current RxD
33733f810b2SJeff Kirsher  *
33833f810b2SJeff Kirsher  *	END_MANUAL_ENTRY
33933f810b2SJeff Kirsher  */
34033f810b2SJeff Kirsher #define	HWM_GET_CURR_RXD(smc)	(struct s_smt_fp_rxd volatile *)\
34133f810b2SJeff Kirsher 				(smc)->hw.fp.rx_q[QUEUE_R1].rx_curr_put
34233f810b2SJeff Kirsher 
34333f810b2SJeff Kirsher /*
34433f810b2SJeff Kirsher  *	BEGIN_MANUAL_ENTRY(HWM_RX_CHECK)
34533f810b2SJeff Kirsher  *	void HWM_RX_CHECK(smc,low_water)
34633f810b2SJeff Kirsher  *
34733f810b2SJeff Kirsher  * function	MACRO		(hardware module, hwmtm.h)
34833f810b2SJeff Kirsher  *		This macro is invoked by the OS-specific before it left the
34933f810b2SJeff Kirsher  *		function mac_drv_rx_complete. This macro calls mac_drv_fill_rxd
35033f810b2SJeff Kirsher  *		if the number of used RxDs is equal or lower than the
351*86d2155eSJilin Yuan  *		given low water mark.
35233f810b2SJeff Kirsher  *
35333f810b2SJeff Kirsher  * para	low_water	low water mark of used RxD's
35433f810b2SJeff Kirsher  *
35533f810b2SJeff Kirsher  *	END_MANUAL_ENTRY
35633f810b2SJeff Kirsher  */
35733f810b2SJeff Kirsher #ifndef HWM_NO_FLOW_CTL
35833f810b2SJeff Kirsher #define	HWM_RX_CHECK(smc,low_water) {\
35933f810b2SJeff Kirsher 	if ((low_water) >= (smc)->hw.fp.rx_q[QUEUE_R1].rx_used) {\
36033f810b2SJeff Kirsher 		mac_drv_fill_rxd(smc) ;\
36133f810b2SJeff Kirsher 	}\
36233f810b2SJeff Kirsher }
36333f810b2SJeff Kirsher #else
36433f810b2SJeff Kirsher #define	HWM_RX_CHECK(smc,low_water)		mac_drv_fill_rxd(smc)
36533f810b2SJeff Kirsher #endif
36633f810b2SJeff Kirsher 
36733f810b2SJeff Kirsher #ifndef	HWM_EBASE
36833f810b2SJeff Kirsher #define	HWM_EBASE	500
36933f810b2SJeff Kirsher #endif
37033f810b2SJeff Kirsher 
37133f810b2SJeff Kirsher #define	HWM_E0001	HWM_EBASE + 1
37233f810b2SJeff Kirsher #define	HWM_E0001_MSG	"HWM: Wrong size of s_rxd_os struct"
37333f810b2SJeff Kirsher #define	HWM_E0002	HWM_EBASE + 2
37433f810b2SJeff Kirsher #define	HWM_E0002_MSG	"HWM: Wrong size of s_txd_os struct"
37533f810b2SJeff Kirsher #define	HWM_E0003	HWM_EBASE + 3
37633f810b2SJeff Kirsher #define	HWM_E0003_MSG	"HWM: smt_free_mbuf() called with NULL pointer"
37733f810b2SJeff Kirsher #define	HWM_E0004	HWM_EBASE + 4
37833f810b2SJeff Kirsher #define	HWM_E0004_MSG	"HWM: Parity error rx queue 1"
37933f810b2SJeff Kirsher #define	HWM_E0005	HWM_EBASE + 5
38033f810b2SJeff Kirsher #define	HWM_E0005_MSG	"HWM: Encoding error rx queue 1"
38133f810b2SJeff Kirsher #define	HWM_E0006	HWM_EBASE + 6
38233f810b2SJeff Kirsher #define	HWM_E0006_MSG	"HWM: Encoding error async tx queue"
38333f810b2SJeff Kirsher #define	HWM_E0007	HWM_EBASE + 7
38433f810b2SJeff Kirsher #define	HWM_E0007_MSG	"HWM: Encoding error sync tx queue"
38533f810b2SJeff Kirsher #define	HWM_E0008	HWM_EBASE + 8
38633f810b2SJeff Kirsher #define	HWM_E0008_MSG	""
38733f810b2SJeff Kirsher #define	HWM_E0009	HWM_EBASE + 9
38833f810b2SJeff Kirsher #define	HWM_E0009_MSG	"HWM: Out of RxD condition detected"
38933f810b2SJeff Kirsher #define	HWM_E0010	HWM_EBASE + 10
39033f810b2SJeff Kirsher #define	HWM_E0010_MSG	"HWM: A protocol layer has tried to send a frame with an invalid frame control"
39133f810b2SJeff Kirsher #define HWM_E0011	HWM_EBASE + 11
39233f810b2SJeff Kirsher #define HWM_E0011_MSG	"HWM: mac_drv_clear_tx_queue was called although the hardware wasn't stopped"
39333f810b2SJeff Kirsher #define HWM_E0012	HWM_EBASE + 12
39433f810b2SJeff Kirsher #define HWM_E0012_MSG	"HWM: mac_drv_clear_rx_queue was called although the hardware wasn't stopped"
39533f810b2SJeff Kirsher #define HWM_E0013	HWM_EBASE + 13
39633f810b2SJeff Kirsher #define HWM_E0013_MSG	"HWM: mac_drv_repair_descr was called although the hardware wasn't stopped"
39733f810b2SJeff Kirsher 
39833f810b2SJeff Kirsher #endif
399