aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/bcm570x_mm.h
blob: ff5302f47c80c0bc34ee6b9ddbbdf72550924b9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158

/******************************************************************************/
/*                                                                            */
/* Broadcom BCM5700 Linux Network Driver, Copyright (c) 2000 Broadcom         */
/* Corporation.                                                               */
/* All rights reserved.                                                       */
/*                                                                            */
/* This program is free software; you can redistribute it and/or modify       */
/* it under the terms of the GNU General Public License as published by       */
/* the Free Software Foundation, located in the file LICENSE.                 */
/*                                                                            */
/******************************************************************************/

#ifndef MM_H
#define MM_H

#define __raw_readl readl
#define __raw_writel writel

#define BIG_ENDIAN_HOST 1
#define readl(addr) (*(volatile unsigned int*)(addr))
#define writel(b,addr) ((*(volatile unsigned int *) (addr)) = (b))

/* Define memory barrier function here if needed */
#define wmb()
#define membar()
#include <common.h>
#include <asm/types.h>
#include "bcm570x_lm.h"
#include "bcm570x_queue.h"
#include "tigon3.h"
#include <pci.h>

#define FALSE 0
#define TRUE  1
#define ERROR -1

#if DBG
#define STATIC
#else
#define STATIC static
#endif

extern int MM_Packet_Desc_Size;

#define MM_PACKET_DESC_SIZE MM_Packet_Desc_Size

DECLARE_QUEUE_TYPE (UM_RX_PACKET_Q, MAX_RX_PACKET_DESC_COUNT + 1);

#define MAX_MEM 16

/* Synch */
typedef int mutex_t;
typedef int spinlock_t;

/* Embedded device control */
typedef struct _UM_DEVICE_BLOCK {
	LM_DEVICE_BLOCK lm_dev;
	pci_dev_t pdev;
	char *name;
	void *mem_list[MAX_MEM];
	dma_addr_t dma_list[MAX_MEM];
	int mem_size_list[MAX_MEM];
	int mem_list_num;
	int mtu;
	int index;
	int opened;
	int delayed_link_ind;	/* Delay link status during initial load */
	int adapter_just_inited;	/* the first few seconds after init. */
	int spurious_int;	/* new -- unsupported */
	int timer_interval;
	int adaptive_expiry;
	int crc_counter_expiry;	/* new -- unsupported */
	int poll_tib_expiry;	/* new -- unsupported */
	int tx_full;
	int tx_queued;
	int line_speed;		/* in Mbps, 0 if link is down */
	UM_RX_PACKET_Q rx_out_of_buf_q;
	int rx_out_of_buf;
	int rx_low_buf_thresh;	/* changed to rx_buf_repl_thresh */
	int rx_buf_repl_panic_thresh;
	int rx_buf_align;	/* new -- unsupported */
	int do_global_lock;
	mutex_t global_lock;
	mutex_t undi_lock;
	long undi_flags;
	volatile int interrupt;
	int tasklet_pending;
	int tasklet_busy;	/* new -- unsupported */
	int rx_pkt;
	int tx_pkt;
#ifdef NICE_SUPPORT		/* unsupported, this is a linux ioctl */
	void (*nice_rx) (void *, void *);
	void *nice_ctx;
#endif				/* NICE_SUPPORT */
	int rx_adaptive_coalesce;
	unsigned int rx_last_cnt;
	unsigned int tx_last_cnt;
	unsigned int rx_curr_coalesce_frames;
	unsigned int rx_curr_coalesce_ticks;
	unsigned int tx_curr_coalesce_frames;	/* new -- unsupported */
#if TIGON3_DEBUG		/* new -- unsupported */
	uint tx_zc_count;
	uint tx_chksum_count;
	uint tx_himem_count;
	uint rx_good_chksum_count;
#endif
	unsigned int rx_bad_chksum_count;	/* new -- unsupported */
	unsigned int rx_misc_errors;	/* new -- unsupported */
} UM_DEVICE_BLOCK, *PUM_DEVICE_BLOCK;

/* Physical/PCI DMA address */
typedef union {
	dma_addr_t dma_map;
} dma_map_t;

/* Packet */
typedef struct
    _UM_PACKET {
	LM_PACKET lm_packet;
	void *skbuff;		/* Address of packet buffer */
} UM_PACKET, *PUM_PACKET;

#define MM_ACQUIRE_UNDI_LOCK(_pDevice)
#define MM_RELEASE_UNDI_LOCK(_pDevice)
#define MM_ACQUIRE_INT_LOCK(_pDevice)
#define MM_RELEASE_INT_LOCK(_pDevice)
#define MM_UINT_PTR(_ptr)   ((unsigned long) (_ptr))

/* Macro for setting 64bit address struct */
#define set_64bit_addr(paddr, low, high) \
	(paddr)->Low = low;             \
	(paddr)->High = high;

/* Assume that PCI controller's view of host memory is same as host */

#define MEM_TO_PCI_PHYS(addr) (addr)

extern void MM_SetAddr (LM_PHYSICAL_ADDRESS * paddr, dma_addr_t addr);
extern void MM_SetT3Addr (T3_64BIT_HOST_ADDR * paddr, dma_addr_t addr);
extern void MM_MapTxDma (PLM_DEVICE_BLOCK pDevice,
			 struct _LM_PACKET *pPacket, T3_64BIT_HOST_ADDR * paddr,
			 LM_UINT32 * len, int frag);
extern void MM_MapRxDma (PLM_DEVICE_BLOCK pDevice,
			 struct _LM_PACKET *pPacket,
			 T3_64BIT_HOST_ADDR * paddr);

/* BSP needs to provide sysUsecDelay and sysSerialPrintString */
extern void sysSerialPrintString (char *s);
#define MM_Wait(usec) udelay(usec)

/* Define memory barrier function here if needed */
#define wmb()

#if 0
#define cpu_to_le32(val) LONGSWAP(val)
#endif
#endif				/* MM_H */