/* SPDX-License-Identifier: GPL-2.0 */ /* * Header file for sonic.c * * (C) Waldorf Electronics, Germany * Written by Andreas Busse * * NOTE: most of the structure definitions here are endian dependent. * If you want to use this driver on big endian machines, the data * and pad structure members must be exchanged. Also, the structures * need to be changed accordingly to the bus size. * * 981229 MSch: did just that for the 68k Mac port (32 bit, big endian) * * 990611 David Huggins-Daines <dhd@debian.org>: This machine abstraction * does not cope with 16-bit bus sizes very well. Therefore I have * rewritten it with ugly macros and evil inlines. * * 050625 Finn Thain: introduced more 32-bit cards and dhd's support * for 16-bit cards (from the mac68k project).
*/
/* * Some tunables for the buffer areas. Power of 2 is required * the current driver uses one receive buffer for each descriptor. * * MSch: use more buffer space for the slow m68k Macs!
*/ #define SONIC_NUM_RRS 16 /* number of receive resources */ #define SONIC_NUM_RDS SONIC_NUM_RRS /* number of receive descriptors */ #define SONIC_NUM_TDS 16 /* number of transmit descriptors */
/* Information that need to be kept for each board. */ struct sonic_local { /* Bus size. 0 == 16 bits, 1 == 32 bits. */ int dma_bitmode; /* Register offset within the longword (independent of endianness, and varies from one type of Macintosh SONIC to another
(Aarrgh)) */ int reg_offset; void *descriptors; /* Crud. These areas have to be within the same 64K. Therefore
we allocate a desriptors page, and point these to places within it. */ void *cda; /* CAM descriptor area */ void *tda; /* Transmit descriptor area */ void *rra; /* Receive resource area */ void *rda; /* Receive descriptor area */ struct sk_buff* volatile rx_skb[SONIC_NUM_RRS]; /* packets to be received */ struct sk_buff* volatile tx_skb[SONIC_NUM_TDS]; /* packets to be transmitted */ unsignedint tx_len[SONIC_NUM_TDS]; /* lengths of tx DMA mappings */ /* Logical DMA addresses on MIPS, bus addresses on m68k
* (so "laddr" is a bit misleading) */
dma_addr_t descriptors_laddr;
u32 cda_laddr; /* logical DMA address of CDA */
u32 tda_laddr; /* logical DMA address of TDA */
u32 rra_laddr; /* logical DMA address of RRA */
u32 rda_laddr; /* logical DMA address of RDA */
dma_addr_t rx_laddr[SONIC_NUM_RRS]; /* logical DMA addresses of rx skbuffs */
dma_addr_t tx_laddr[SONIC_NUM_TDS]; /* logical DMA addresses of tx skbuffs */ unsignedint cur_rx; unsignedint cur_tx; /* first unacked transmit packet */ unsignedint eol_rx; unsignedint eol_tx; /* last unacked transmit packet */ int msg_enable; struct device *device; /* generic device */ struct net_device_stats stats;
spinlock_t lock;
};
/* Internal inlines for reading/writing DMA buffers. Note that bus size and endianness matter here, whereas they don't for registers,
as far as we can tell. */ /* OpenBSD calls this "SWO". I'd like to think that sonic_buf_put()
is a much better name. */ staticinlinevoid sonic_buf_put(u16 *base, int bitmode, int offset, __u16 val)
{ if (bitmode) #ifdef __BIG_ENDIAN
__raw_writew(val, base + (offset * 2) + 1); #else
__raw_writew(val, base + (offset * 2) + 0); #endif else
__raw_writew(val, base + (offset * 1) + 0);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.