1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/******************************************************************************
3 *
4 *	(C)Copyright 1998,1999 SysKonnect,
5 *	a business unit of Schneider & Koch & Co. Datensysteme GmbH.
6 *
7 *	The information in this file is provided "AS IS" without warranty.
8 *
9 ******************************************************************************/
10
11/*
12 * Operating system-dependent definitions that have to be defined
13 * before any other header files are included.
14 */
15
16// HWM (HardWare Module) Definitions
17// -----------------------
18
19#include <asm/byteorder.h>
20
21#ifdef __LITTLE_ENDIAN
22#define LITTLE_ENDIAN
23#else
24#define BIG_ENDIAN
25#endif
26
27// this is set in the makefile
28// #define PCI			/* only PCI adapters supported by this driver */
29// #define MEM_MAPPED_IO	/* use memory mapped I/O */
30
31
32#define USE_CAN_ADDR		/* DA and SA in MAC header are canonical. */
33
34#define MB_OUTSIDE_SMC		/* SMT Mbufs outside of smc struct. */
35
36// -----------------------
37
38
39// SMT Definitions
40// -----------------------
41#define SYNC	       		/* allow synchronous frames */
42
43// #define SBA			/* Synchronous Bandwidth Allocator support */
44				/* not available as free source */
45
46#define ESS			/* SBA End Station Support */
47
48#define	SMT_PANIC(smc, nr, msg)	printk(KERN_INFO "SMT PANIC: code: %d, msg: %s\n",nr,msg)
49
50
51#ifdef DEBUG
52#define printf(s,args...) printk(KERN_INFO s, ## args)
53#endif
54
55// #define HW_PTR	u_long
56// -----------------------
57
58
59
60// HWM and OS-specific buffer definitions
61// -----------------------
62
63// default number of receive buffers.
64#define NUM_RECEIVE_BUFFERS		10
65
66// default number of transmit buffers.
67#define NUM_TRANSMIT_BUFFERS		10
68
69// Number of SMT buffers (Mbufs).
70#define NUM_SMT_BUF	4
71
72// Number of TXDs for asynchronous transmit queue.
73#define HWM_ASYNC_TXD_COUNT	(NUM_TRANSMIT_BUFFERS + NUM_SMT_BUF)
74
75// Number of TXDs for synchronous transmit queue.
76#define HWM_SYNC_TXD_COUNT	HWM_ASYNC_TXD_COUNT
77
78
79// Number of RXDs for receive queue #1.
80// Note: Workaround for ASIC Errata #7: One extra RXD is required.
81#if (NUM_RECEIVE_BUFFERS > 100)
82#define SMT_R1_RXD_COUNT	(1 + 100)
83#else
84#define SMT_R1_RXD_COUNT	(1 + NUM_RECEIVE_BUFFERS)
85#endif
86
87// Number of RXDs for receive queue #2.
88#define SMT_R2_RXD_COUNT	0	// Not used.
89// -----------------------
90
91
92
93/*
94 * OS-specific part of the transmit/receive descriptor structure (TXD/RXD).
95 *
96 * Note: The size of these structures must follow this rule:
97 *
98 *	sizeof(struct) + 2*sizeof(void*) == n * 16, n >= 1
99 *
100 * We use the dma_addr fields under Linux to keep track of the
101 * DMA address of the packet data, for later pci_unmap_single. -DaveM
102 */
103
104struct s_txd_os {	// os-specific part of transmit descriptor
105	struct sk_buff *skb;
106	dma_addr_t dma_addr;
107} ;
108
109struct s_rxd_os {	// os-specific part of receive descriptor
110	struct sk_buff *skb;
111	dma_addr_t dma_addr;
112} ;
113
114
115/*
116 * So we do not need to make too many modifications to the generic driver
117 * parts, we take advantage of the AIX byte swapping macro interface.
118 */
119
120#define AIX_REVERSE(x)		((u32)le32_to_cpu((u32)(x)))
121#define MDR_REVERSE(x)		((u32)le32_to_cpu((u32)(x)))
122