Symbol fixups

pull/1/head
Michael Brown 2005-05-03 11:29:33 +00:00
parent 3c2851e563
commit c112f12c5b
15 changed files with 185 additions and 177 deletions

View File

@ -141,13 +141,17 @@ static unsigned long ioaddr;
/* transmit descriptor and buffer */ /* transmit descriptor and buffer */
#define NTXD 2 #define NTXD 2
static struct txdesc txd[NTXD] __attribute__ ((aligned(4)));
static unsigned char txb[BUFLEN] __attribute__ ((aligned(4)));
/* receive descriptor(s) and buffer(s) */
#define NRXD 4 #define NRXD 4
static struct rxdesc rxd[NRXD] __attribute__ ((aligned(4))); struct {
static unsigned char rxb[NRXD * BUFLEN] __attribute__ ((aligned(4))); struct txdesc txd[NTXD] __attribute__ ((aligned(4)));
unsigned char txb[BUFLEN] __attribute__ ((aligned(4)));
struct rxdesc rxd[NRXD] __attribute__ ((aligned(4)));
unsigned char rxb[NRXD * BUFLEN] __attribute__ ((aligned(4)));
} davicom_bufs __shared;
#define txd davicom_bufs.txd
#define txb davicom_bufs.txb
#define rxd davicom_bufs.rxd
#define rxb davicom_bufs.rxb
static int rxd_tail; static int rxd_tail;
static int TxPtr; static int TxPtr;

View File

@ -150,7 +150,7 @@ struct rx_desc {
u32 /* struct rx_desc * */ next_rx_desc; u32 /* struct rx_desc * */ next_rx_desc;
} __attribute__ ((aligned(32))); } __attribute__ ((aligned(32)));
struct dmfe_private { static struct dmfe_private {
u32 chip_id; /* Chip vendor/Device ID */ u32 chip_id; /* Chip vendor/Device ID */
u32 chip_revision; /* Chip revision */ u32 chip_revision; /* Chip revision */
u32 cr0_data; u32 cr0_data;
@ -214,26 +214,21 @@ static u8 SF_mode; /* Special Function: 1:VLAN, 2:RX Flow Control
/********************************************** /**********************************************
* Descriptor Ring and Buffer defination * Descriptor Ring and Buffer defination
***********************************************/ ***********************************************/
/* Define the TX Descriptor */ struct {
static struct tx_desc txd[TX_DESC_CNT] struct tx_desc txd[TX_DESC_CNT] __attribute__ ((aligned(32)));
__attribute__ ((aligned(32))); unsigned char txb[TX_BUF_ALLOC * TX_DESC_CNT]
__attribute__ ((aligned(32)));
/* Create a static buffer of size PKT_BUF_SZ for each TX Descriptor. struct rx_desc rxd[RX_DESC_CNT] __attribute__ ((aligned(32)));
All descriptors point to a part of this buffer */ unsigned char rxb[RX_ALLOC_SIZE * RX_DESC_CNT]
static unsigned char txb[TX_BUF_ALLOC * TX_DESC_CNT] __attribute__ ((aligned(32)));
__attribute__ ((aligned(32))); } dmfe_bufs __shared;
#define txd dmfe_bufs.txd
/* Define the RX Descriptor */ #define txb dmfe_bufs.txb
static struct rx_desc rxd[RX_DESC_CNT] #define rxd dmfe_bufs.rxd
__attribute__ ((aligned(32))); #define rxb dmfe_bufs.rxb
/* Create a static buffer of size PKT_BUF_SZ for each RX Descriptor.
All descriptors point to a part of this buffer */
static unsigned char rxb[RX_ALLOC_SIZE * RX_DESC_CNT]
__attribute__ ((aligned(32)));
/* NIC specific static variables go here */ /* NIC specific static variables go here */
long int BASE; static long int BASE;
static u16 read_srom_word(long ioaddr, int offset); static u16 read_srom_word(long ioaddr, int offset);
static void dmfe_init_dm910x(struct nic *nic); static void dmfe_init_dm910x(struct nic *nic);

View File

@ -89,9 +89,12 @@ static struct nic_operations e1000_operations;
static struct pci_driver e1000_driver; static struct pci_driver e1000_driver;
static struct e1000_hw hw; static struct e1000_hw hw;
static char tx_pool[128 + 16];
static char rx_pool[128 + 16]; struct {
static char packet[2096]; char tx_pool[128 + 16];
char rx_pool[128 + 16];
char packet[2096];
} e1000_bufs __shared;
static struct e1000_tx_desc *tx_base; static struct e1000_tx_desc *tx_base;
static struct e1000_rx_desc *rx_base; static struct e1000_rx_desc *rx_base;
@ -171,13 +174,13 @@ static void e1000_irq(struct nic *nic, irq_action_t action);
#define E1000_WRITE_FLUSH(a) {uint32_t x; x = E1000_READ_REG(a, STATUS);} #define E1000_WRITE_FLUSH(a) {uint32_t x; x = E1000_READ_REG(a, STATUS);}
uint32_t static inline uint32_t
e1000_io_read(struct e1000_hw *hw __unused, uint32_t port) e1000_io_read(struct e1000_hw *hw __unused, uint32_t port)
{ {
return inl(port); return inl(port);
} }
void static inline void
e1000_io_write(struct e1000_hw *hw __unused, uint32_t port, uint32_t value) e1000_io_write(struct e1000_hw *hw __unused, uint32_t port, uint32_t value)
{ {
outl(value, port); outl(value, port);
@ -724,11 +727,10 @@ e1000_clear_vfta(struct e1000_hw *hw)
* hw - Struct containing variables accessed by shared code * hw - Struct containing variables accessed by shared code
* offset - offset to write to * value - value to write * offset - offset to write to * value - value to write
*****************************************************************************/ *****************************************************************************/
void e1000_write_reg_io(struct e1000_hw *hw, uint32_t offset, uint32_t value){ static inline void e1000_write_reg_io(struct e1000_hw *hw, uint32_t offset,
uint32_t io_addr = hw->io_base; uint32_t value){
uint32_t io_data = hw->io_base + 4; e1000_io_write(hw, hw->io_base, offset);
e1000_io_write(hw, io_addr, offset); e1000_io_write(hw, hw->io_base + 4, value);
e1000_io_write(hw, io_data, value);
} }
/****************************************************************************** /******************************************************************************
@ -3362,7 +3364,7 @@ static void fill_rx (void)
rd = rx_base + rx_tail; rd = rx_base + rx_tail;
rx_tail = (rx_tail + 1) % 8; rx_tail = (rx_tail + 1) % 8;
memset (rd, 0, 16); memset (rd, 0, 16);
rd->buffer_addr = virt_to_bus(&packet); rd->buffer_addr = virt_to_bus(&e1000_bufs.packet);
E1000_WRITE_REG (&hw, RDT, rx_tail); E1000_WRITE_REG (&hw, RDT, rx_tail);
} }
@ -3371,7 +3373,7 @@ static void init_descriptor (void)
unsigned long ptr; unsigned long ptr;
unsigned long tctl; unsigned long tctl;
ptr = virt_to_phys(tx_pool); ptr = virt_to_phys(e1000_bufs.tx_pool);
if (ptr & 0xf) if (ptr & 0xf)
ptr = (ptr + 0x10) & (~0xf); ptr = (ptr + 0x10) & (~0xf);
@ -3409,7 +3411,7 @@ static void init_descriptor (void)
rx_tail = 0; rx_tail = 0;
/* disable receive */ /* disable receive */
E1000_WRITE_REG (&hw, RCTL, 0); E1000_WRITE_REG (&hw, RCTL, 0);
ptr = virt_to_phys(rx_pool); ptr = virt_to_phys(e1000_bufs.rx_pool);
if (ptr & 0xf) if (ptr & 0xf)
ptr = (ptr + 0x10) & (~0xf); ptr = (ptr + 0x10) & (~0xf);
rx_base = phys_to_virt(ptr); rx_base = phys_to_virt(ptr);
@ -3454,7 +3456,7 @@ e1000_poll (struct nic *nic, int retrieve)
if ( ! retrieve ) return 1; if ( ! retrieve ) return 1;
// printf("recv: packet %! -> %! len=%d \n", packet+6, packet,rd->Length); // printf("recv: packet %! -> %! len=%d \n", packet+6, packet,rd->Length);
memcpy (nic->packet, packet, rd->length); memcpy (nic->packet, e1000_bufs.packet, rd->length);
nic->packetlen = rd->length; nic->packetlen = rd->length;
fill_rx (); fill_rx ();

View File

@ -262,7 +262,10 @@ static struct nic_operations eepro100_operations;
static struct pci_driver eepro100_driver; static struct pci_driver eepro100_driver;
#define RXFD_COUNT 4 #define RXFD_COUNT 4
static struct RxFD rxfds[RXFD_COUNT]; struct {
struct RxFD rxfds[RXFD_COUNT];
} eepro100_bufs __shared;
#define rxfds eepro100_bufs.rxfds
static unsigned int rxfd = 0; static unsigned int rxfd = 0;
static int congenb = 0; /* Enable congestion control in the DP83840. */ static int congenb = 0; /* Enable congestion control in the DP83840. */

View File

@ -86,12 +86,18 @@ static unsigned int cur_rx, cur_tx; /* The next free ring entry */
static unsigned short eeprom[64]; static unsigned short eeprom[64];
#endif #endif
static signed char phys[4]; /* MII device addresses. */ static signed char phys[4]; /* MII device addresses. */
static struct epic_rx_desc rx_ring[RX_RING_SIZE] struct {
struct epic_rx_desc rx_ring[RX_RING_SIZE]
__attribute__ ((aligned(4))); __attribute__ ((aligned(4)));
static struct epic_tx_desc tx_ring[TX_RING_SIZE] struct epic_tx_desc tx_ring[TX_RING_SIZE]
__attribute__ ((aligned(4))); __attribute__ ((aligned(4)));
static unsigned char rx_packet[PKT_BUF_SZ * RX_RING_SIZE]; unsigned char rx_packet[PKT_BUF_SZ * RX_RING_SIZE];
static unsigned char tx_packet[PKT_BUF_SZ * TX_RING_SIZE]; unsigned char tx_packet[PKT_BUF_SZ * TX_RING_SIZE];
} epic100_bufs __shared;
#define rx_ring epic100_bufs.rx_ring
#define tx_ring epic100_bufs.tx_ring
#define rx_packet epic100_bufs.rx_packet
#define tx_packet epic100_bufs.tx_packet
/***********************************************************************/ /***********************************************************************/
/* Externally visible functions */ /* Externally visible functions */

View File

@ -71,7 +71,7 @@ typedef signed int s32;
#define virt_to_le32desc(addr) cpu_to_le32(virt_to_bus(addr)) #define virt_to_le32desc(addr) cpu_to_le32(virt_to_bus(addr))
#define le32desc_to_virt(addr) bus_to_virt(le32_to_cpu(addr)) #define le32desc_to_virt(addr) bus_to_virt(le32_to_cpu(addr))
unsigned long BASE; static unsigned long BASE;
/* NIC specific static variables go here */ /* NIC specific static variables go here */
@ -290,24 +290,20 @@ struct ring_desc {
}; };
/* Define the TX Descriptor */ /* Define the TX and RX Descriptor and Buffers */
static struct ring_desc tx_ring[TX_RING]; struct {
struct ring_desc tx_ring[TX_RING];
/* Create a static buffer of size RX_BUF_SZ for each unsigned char txb[TX_RING * RX_NIC_BUFSIZE];
TX Descriptor. All descriptors point to a struct ring_desc rx_ring[RX_RING];
part of this buffer */ unsigned char rxb[RX_RING * RX_NIC_BUFSIZE];
static unsigned char txb[TX_RING * RX_NIC_BUFSIZE]; } forcedeth_bufs __shared;
#define tx_ring forcedeth_bufs.tx_ring
/* Define the TX Descriptor */ #define rx_ring forcedeth_bufs.rx_ring
static struct ring_desc rx_ring[RX_RING]; #define txb forcedeth_bufs.txb
#define rxb forcedeth_bufs.rxb
/* Create a static buffer of size RX_BUF_SZ for each
RX Descriptor All descriptors point to a
part of this buffer */
static unsigned char rxb[RX_RING * RX_NIC_BUFSIZE];
/* Private Storage for the NIC */ /* Private Storage for the NIC */
struct forcedeth_private { static struct forcedeth_private {
/* General data: /* General data:
* Locking: spin_lock(&np->lock); */ * Locking: spin_lock(&np->lock); */
int in_shutdown; int in_shutdown;
@ -322,19 +318,13 @@ struct forcedeth_private {
/* rx specific fields. /* rx specific fields.
* Locking: Within irq hander or disable_irq+spin_lock(&np->lock); * Locking: Within irq hander or disable_irq+spin_lock(&np->lock);
*/ */
struct ring_desc *rx_ring;
unsigned int cur_rx, refill_rx; unsigned int cur_rx, refill_rx;
struct sk_buff *rx_skbuff[RX_RING];
u32 rx_dma[RX_RING];
unsigned int rx_buf_sz; unsigned int rx_buf_sz;
/* /*
* tx specific fields. * tx specific fields.
*/ */
struct ring_desc *tx_ring;
unsigned int next_tx, nic_tx; unsigned int next_tx, nic_tx;
struct sk_buff *tx_skbuff[TX_RING];
u32 tx_dma[TX_RING];
u16 tx_flags; u16 tx_flags;
} npx; } npx;

View File

@ -368,16 +368,14 @@ enum tx_desc_control_bits {
#define LinkIsUp2 0x00040000 #define LinkIsUp2 0x00040000
/* Create a static buffer of size PKT_BUF_SZ for each /* Create a static buffer of size PKT_BUF_SZ for each
TX Descriptor. All descriptors point to a RX and TX Descriptor. All descriptors point to a
part of this buffer */ part of this buffer */
static u8 txb[PKT_BUF_SZ * TX_RING_SIZE] struct {
__attribute__ ((aligned(8))); u8 txb[PKT_BUF_SZ * TX_RING_SIZE] __attribute__ ((aligned(8)));
u8 rxb[PKT_BUF_SZ * RX_RING_SIZE] __attribute__ ((aligned(8)));
/* Create a static buffer of size PKT_BUF_SZ for each } mtd80x_bufs __shared;
RX Descriptor All descriptors point to a #define txb mtd80x_bufs.txb
part of this buffer */ #define rxb mtd80x_bufs.rxb
static u8 rxb[PKT_BUF_SZ * RX_RING_SIZE]
__attribute__ ((aligned(8)));
/* The Tulip Rx and Tx buffer descriptors. */ /* The Tulip Rx and Tx buffer descriptors. */
struct mtd_desc struct mtd_desc

View File

@ -205,11 +205,16 @@ static unsigned int tx_config;
longword aligned longword aligned
*/ */
static BufferDesc txd __attribute__ ((aligned(4))); struct {
static BufferDesc rxd[NUM_RX_DESC] __attribute__ ((aligned(4))); BufferDesc txd __attribute__ ((aligned(4)));
BufferDesc rxd[NUM_RX_DESC] __attribute__ ((aligned(4)));
static unsigned char txb[TX_BUF_SIZE] __attribute__ ((aligned(4))); unsigned char txb[TX_BUF_SIZE] __attribute__ ((aligned(4)));
static unsigned char rxb[NUM_RX_DESC * RX_BUF_SIZE] __attribute__ ((aligned(4))); unsigned char rxb[NUM_RX_DESC * RX_BUF_SIZE] __attribute__ ((aligned(4)));
} natsemi_bufs __shared;
#define txd natsemi_bufs.txd
#define rxd natsemi_bufs.rxd
#define txb natsemi_bufs.txb
#define rxb natsemi_bufs.rxb
/* Function Prototypes */ /* Function Prototypes */

View File

@ -393,24 +393,18 @@ struct ns83820_private {
} nsx; } nsx;
static struct ns83820_private *ns; static struct ns83820_private *ns;
/* Define the TX Descriptor */ /* Define the TX and RX Descriptor and Buffers */
static struct ring_desc tx_ring[NR_TX_DESC] struct {
__attribute__ ((aligned(8))); struct ring_desc tx_ring[NR_TX_DESC] __attribute__ ((aligned(8)));
unsigned char txb[NR_TX_DESC * REAL_RX_BUF_SIZE];
/* Create a static buffer of size REAL_RX_BUF_SIZE for each struct ring_desc rx_ring[NR_RX_DESC] __attribute__ ((aligned(8)));
TX Descriptor. All descriptors point to a unsigned char rxb[NR_RX_DESC * REAL_RX_BUF_SIZE]
part of this buffer */ __attribute__ ((aligned(8)));
static unsigned char txb[NR_TX_DESC * REAL_RX_BUF_SIZE]; } ns83820_bufs __shared;
#define tx_ring ns83820_bufs.tx_ring
/* Define the TX Descriptor */ #define rx_ring ns83820_bufs.rx_ring
static struct ring_desc rx_ring[NR_RX_DESC] #define txb ns83820_bufs.txb
__attribute__ ((aligned(8))); #define rxb ns83820_bufs.rxb
/* Create a static buffer of size REAL_RX_BUF_SIZE for each
RX Descriptor All descriptors point to a
part of this buffer */
static unsigned char rxb[NR_RX_DESC * REAL_RX_BUF_SIZE]
__attribute__ ((aligned(8)));
static void phy_intr(struct nic *nic __unused) static void phy_intr(struct nic *nic __unused)
{ {

View File

@ -182,20 +182,6 @@ static int full_duplex[MAX_UNITS];
#define PCNET32_TOTAL_SIZE 0x20 #define PCNET32_TOTAL_SIZE 0x20
/* Buffers for the tx and Rx */
/* Create a static buffer of size PKT_BUF_SZ for each
TX Descriptor. All descriptors point to a
part of this buffer */
static unsigned char txb[PKT_BUF_SZ * TX_RING_SIZE];
// __attribute__ ((aligned(16)));
/* Create a static buffer of size PKT_BUF_SZ for each
RX Descriptor All descriptors point to a
part of this buffer */
static unsigned char rxb[RX_RING_SIZE * PKT_BUF_SZ];
// __attribute__ ((aligned(16)));
/* The PCNET32 Rx and Tx ring descriptors. */ /* The PCNET32 Rx and Tx ring descriptors. */
struct pcnet32_rx_head { struct pcnet32_rx_head {
u32 base; u32 base;
@ -235,14 +221,15 @@ struct pcnet32_access {
void (*reset) (unsigned long); void (*reset) (unsigned long);
}; };
/* Define the TX Descriptor */ /* Define the TX and RX Descriptors and Rings */
static struct pcnet32_tx_head tx_ring[TX_RING_SIZE] struct {
__attribute__ ((aligned(16))); struct pcnet32_tx_head tx_ring[TX_RING_SIZE]
__attribute__ ((aligned(16)));
struct pcnet32_rx_head rx_ring[RX_RING_SIZE]
/* Define the RX Descriptor */ __attribute__ ((aligned(16)));
static struct pcnet32_rx_head rx_ring[RX_RING_SIZE] unsigned char txb[PKT_BUF_SZ * TX_RING_SIZE];
__attribute__ ((aligned(16))); unsigned char rxb[RX_RING_SIZE * PKT_BUF_SZ];
} pcnet32_bufs __shared;
/* May need to be moved to mii.h */ /* May need to be moved to mii.h */
struct mii_if_info { struct mii_if_info {
@ -411,16 +398,17 @@ static int pcnet32_init_ring(struct nic *nic)
lp->cur_rx = lp->cur_tx = 0; lp->cur_rx = lp->cur_tx = 0;
for (i = 0; i < RX_RING_SIZE; i++) { for (i = 0; i < RX_RING_SIZE; i++) {
rx_ring[i].base = (u32) virt_to_le32desc(&rxb[i]); pcnet32_bufs.rx_ring[i].base =
rx_ring[i].buf_length = le16_to_cpu(-PKT_BUF_SZ); virt_to_le32desc(&pcnet32_bufs.rxb[i]);
rx_ring[i].status = le16_to_cpu(0x8000); pcnet32_bufs.rx_ring[i].buf_length = le16_to_cpu(-PKT_BUF_SZ);
pcnet32_bufs.rx_ring[i].status = le16_to_cpu(0x8000);
} }
/* The Tx buffer address is filled in as needed, but we do need to clear /* The Tx buffer address is filled in as needed, but we do need to clear
the upper ownership bit. */ the upper ownership bit. */
for (i = 0; i < TX_RING_SIZE; i++) { for (i = 0; i < TX_RING_SIZE; i++) {
tx_ring[i].base = 0; pcnet32_bufs.tx_ring[i].base = 0;
tx_ring[i].status = 0; pcnet32_bufs.tx_ring[i].status = 0;
} }
@ -428,8 +416,8 @@ static int pcnet32_init_ring(struct nic *nic)
le16_to_cpu(TX_RING_LEN_BITS | RX_RING_LEN_BITS); le16_to_cpu(TX_RING_LEN_BITS | RX_RING_LEN_BITS);
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
lp->init_block.phys_addr[i] = nic->node_addr[i]; lp->init_block.phys_addr[i] = nic->node_addr[i];
lp->init_block.rx_ring = (u32) virt_to_le32desc(&rx_ring[0]); lp->init_block.rx_ring = virt_to_le32desc(&pcnet32_bufs.rx_ring[0]);
lp->init_block.tx_ring = (u32) virt_to_le32desc(&tx_ring[0]); lp->init_block.tx_ring = virt_to_le32desc(&pcnet32_bufs.tx_ring[0]);
return 0; return 0;
} }
@ -547,11 +535,11 @@ static int pcnet32_poll(struct nic *nic __unused, int retrieve)
/* nic->packet should contain data on return */ /* nic->packet should contain data on return */
/* nic->packetlen should contain length of data */ /* nic->packetlen should contain length of data */
int status; signed char status;
int entry; int entry;
entry = lp->cur_rx & RX_RING_MOD_MASK; entry = lp->cur_rx & RX_RING_MOD_MASK;
status = ((short) le16_to_cpu(rx_ring[entry].status) >> 8); status = (le16_to_cpu(pcnet32_bufs.rx_ring[entry].status) >> 8);
if (status < 0) if (status < 0)
return 0; return 0;
@ -560,13 +548,16 @@ static int pcnet32_poll(struct nic *nic __unused, int retrieve)
if (status == 0x03) { if (status == 0x03) {
nic->packetlen = nic->packetlen =
(le32_to_cpu(rx_ring[entry].msg_length) & 0xfff) - 4; (le32_to_cpu(pcnet32_bufs.rx_ring[entry].msg_length)
memcpy(nic->packet, &rxb[entry], nic->packetlen); & 0xfff) - 4;
memcpy(nic->packet, &pcnet32_bufs.rxb[entry], nic->packetlen);
/* Andrew Boyd of QNX reports that some revs of the 79C765 /* Andrew Boyd of QNX reports that some revs of the 79C765
* clear the buffer length */ * clear the buffer length */
rx_ring[entry].buf_length = le16_to_cpu(-PKT_BUF_SZ); pcnet32_bufs.rx_ring[entry].buf_length
rx_ring[entry].status |= le16_to_cpu(0x8000); /* prime for next receive */ = le16_to_cpu(-PKT_BUF_SZ);
/* prime for next receive */
pcnet32_bufs.rx_ring[entry].status |= le16_to_cpu(0x8000);
/* Switch to the next Rx ring buffer */ /* Switch to the next Rx ring buffer */
lp->cur_rx++; lp->cur_rx++;
@ -594,7 +585,7 @@ static void pcnet32_transmit(struct nic *nic __unused, const char *d, /* Destina
status = 0x8300; status = 0x8300;
/* point to the current txb incase multiple tx_rings are used */ /* point to the current txb incase multiple tx_rings are used */
ptxb = txb + (lp->cur_tx * PKT_BUF_SZ); ptxb = pcnet32_bufs.txb + (lp->cur_tx * PKT_BUF_SZ);
/* copy the packet to ring buffer */ /* copy the packet to ring buffer */
memcpy(ptxb, d, ETH_ALEN); /* dst */ memcpy(ptxb, d, ETH_ALEN); /* dst */
@ -607,12 +598,12 @@ static void pcnet32_transmit(struct nic *nic __unused, const char *d, /* Destina
while (s < ETH_ZLEN) /* pad to min length */ while (s < ETH_ZLEN) /* pad to min length */
ptxb[s++] = '\0'; ptxb[s++] = '\0';
tx_ring[entry].length = le16_to_cpu(-s); pcnet32_bufs.tx_ring[entry].length = le16_to_cpu(-s);
tx_ring[entry].misc = 0x00000000; pcnet32_bufs.tx_ring[entry].misc = 0x00000000;
tx_ring[entry].base = (u32) virt_to_le32desc(ptxb); pcnet32_bufs.tx_ring[entry].base = (u32) virt_to_le32desc(ptxb);
/* we set the top byte as the very last thing */ /* we set the top byte as the very last thing */
tx_ring[entry].status = le16_to_cpu(status); pcnet32_bufs.tx_ring[entry].status = le16_to_cpu(status);
/* Trigger an immediate send poll */ /* Trigger an immediate send poll */
@ -622,14 +613,14 @@ static void pcnet32_transmit(struct nic *nic __unused, const char *d, /* Destina
lp->cur_tx = 0; /* (lp->cur_tx + 1); */ lp->cur_tx = 0; /* (lp->cur_tx + 1); */
time = currticks() + TICKS_PER_SEC; /* wait one second */ time = currticks() + TICKS_PER_SEC; /* wait one second */
while (currticks() < time && while (currticks() < time &&
((short) le16_to_cpu(tx_ring[entry].status) < 0)); ((short) le16_to_cpu(pcnet32_bufs.tx_ring[entry].status) < 0));
if ((short) le16_to_cpu(tx_ring[entry].status) < 0) if ((short) le16_to_cpu(pcnet32_bufs.tx_ring[entry].status) < 0)
printf("PCNET32 timed out on transmit\n"); printf("PCNET32 timed out on transmit\n");
/* Stop pointing at the current txb /* Stop pointing at the current txb
* otherwise the card continues to send the packet */ * otherwise the card continues to send the packet */
tx_ring[entry].base = 0; pcnet32_bufs.tx_ring[entry].base = 0;
} }
@ -882,8 +873,8 @@ static int pcnet32_probe ( struct nic *nic, struct pci_device *pci ) {
lp->init_block.phys_addr[i] = nic->node_addr[i]; lp->init_block.phys_addr[i] = nic->node_addr[i];
lp->init_block.filter[0] = 0xffffffff; lp->init_block.filter[0] = 0xffffffff;
lp->init_block.filter[1] = 0xffffffff; lp->init_block.filter[1] = 0xffffffff;
lp->init_block.rx_ring = virt_to_bus(&rx_ring); lp->init_block.rx_ring = virt_to_bus(&pcnet32_bufs.rx_ring);
lp->init_block.tx_ring = virt_to_bus(&tx_ring); lp->init_block.tx_ring = virt_to_bus(&pcnet32_bufs.tx_ring);
/* switch pcnet32 to 32bit mode */ /* switch pcnet32 to 32bit mode */
a->write_bcr(ioaddr, 20, 2); a->write_bcr(ioaddr, 20, 2);

View File

@ -169,8 +169,12 @@ enum rx_mode_bits {
static unsigned int cur_rx,cur_tx; static unsigned int cur_rx,cur_tx;
/* The RTL8139 can only transmit from a contiguous, aligned memory block. */ /* The RTL8139 can only transmit from a contiguous, aligned memory block. */
static unsigned char tx_buffer[TX_BUF_SIZE] __attribute__((aligned(4))); struct {
static unsigned char rx_ring[RX_BUF_LEN+16] __attribute__((aligned(4))); unsigned char tx_buffer[TX_BUF_SIZE] __attribute__((aligned(4)));
unsigned char rx_ring[RX_BUF_LEN+16] __attribute__((aligned(4)));
} rtl8139_bufs __shared;
#define tx_buffer rtl8139_bufs.tx_buffer
#define rx_ring rtl8139_bufs.rx_ring
static int rtl8139_probe(struct nic *nic,struct pci_device *pci); static int rtl8139_probe(struct nic *nic,struct pci_device *pci);
static int read_eeprom(struct nic *nic, int location, int addr_len); static int read_eeprom(struct nic *nic, int location, int addr_len);

View File

@ -64,10 +64,16 @@ static unsigned int cur_phy;
static unsigned int cur_rx; static unsigned int cur_rx;
static BufferDesc txd; struct {
static BufferDesc rxd[NUM_RX_DESC]; BufferDesc txd;
static unsigned char txb[TX_BUF_SIZE]; BufferDesc rxd[NUM_RX_DESC];
static unsigned char rxb[NUM_RX_DESC * RX_BUF_SIZE]; unsigned char txb[TX_BUF_SIZE];
unsigned char rxb[NUM_RX_DESC * RX_BUF_SIZE];
} sis900_bufs __shared;
#define txd sis900_bufs.txd
#define rxd sis900_bufs.rxd
#define txb sis900_bufs.txb
#define rxb sis900_bufs.rxb
#if 0 #if 0
static struct mac_chip_info { static struct mac_chip_info {

View File

@ -100,7 +100,7 @@ static void TLan_MiiSync(u16);
static void TLan_MiiWriteReg(struct nic *nic __unused, u16, u16, u16); static void TLan_MiiWriteReg(struct nic *nic __unused, u16, u16, u16);
const char *media[] = { static const char *media[] = {
"10BaseT-HD ", "10BaseT-FD ", "100baseTx-HD ", "10BaseT-HD ", "10BaseT-FD ", "100baseTx-HD ",
"100baseTx-FD", "100baseT4", 0 "100baseTx-FD", "100baseT4", 0
}; };
@ -187,21 +187,26 @@ struct TLanList {
} buffer[TLAN_BUFFERS_PER_LIST]; } buffer[TLAN_BUFFERS_PER_LIST];
}; };
struct TLanList tx_ring[TLAN_NUM_TX_LISTS]; struct {
static unsigned char txb[TLAN_MAX_FRAME_SIZE * TLAN_NUM_TX_LISTS]; struct TLanList tx_ring[TLAN_NUM_TX_LISTS];
unsigned char txb[TLAN_MAX_FRAME_SIZE * TLAN_NUM_TX_LISTS];
struct TLanList rx_ring[TLAN_NUM_RX_LISTS]; struct TLanList rx_ring[TLAN_NUM_RX_LISTS];
static unsigned char rxb[TLAN_MAX_FRAME_SIZE * TLAN_NUM_RX_LISTS]; unsigned char rxb[TLAN_MAX_FRAME_SIZE * TLAN_NUM_RX_LISTS];
} tlan_buffers __shared;
#define tx_ring tlan_buffers.tx_ring
#define txb tlan_buffers.txb
#define rx_ring tlan_buffers.rx_ring
#define rxb tlan_buffers.rxb
typedef u8 TLanBuffer[TLAN_MAX_FRAME_SIZE]; typedef u8 TLanBuffer[TLAN_MAX_FRAME_SIZE];
int chip_idx; static int chip_idx;
/***************************************************************** /*****************************************************************
* TLAN Private Information Structure * TLAN Private Information Structure
* *
****************************************************************/ ****************************************************************/
struct tlan_private { static struct tlan_private {
unsigned short vendor_id; /* PCI Vendor code */ unsigned short vendor_id; /* PCI Vendor code */
unsigned short dev_id; /* PCI Device code */ unsigned short dev_id; /* PCI Device code */
const char *nic_name; const char *nic_name;
@ -226,7 +231,7 @@ struct tlan_private {
static struct tlan_private *priv; static struct tlan_private *priv;
u32 BASE; static u32 BASE;
/*************************************************************** /***************************************************************
* TLan_ResetLists * TLan_ResetLists
@ -242,7 +247,7 @@ u32 BASE;
* *
**************************************************************/ **************************************************************/
void TLan_ResetLists(struct nic *nic __unused) static void TLan_ResetLists(struct nic *nic __unused)
{ {
int i; int i;

View File

@ -393,7 +393,7 @@ typedef struct tlan_adapter_entry {
/* Routines to access internal registers. */ /* Routines to access internal registers. */
inline u8 TLan_DioRead8(u16 base_addr, u16 internal_addr) static inline u8 TLan_DioRead8(u16 base_addr, u16 internal_addr)
{ {
outw(internal_addr, base_addr + TLAN_DIO_ADR); outw(internal_addr, base_addr + TLAN_DIO_ADR);
return (inb((base_addr + TLAN_DIO_DATA) + (internal_addr & 0x3))); return (inb((base_addr + TLAN_DIO_DATA) + (internal_addr & 0x3)));
@ -403,7 +403,7 @@ inline u8 TLan_DioRead8(u16 base_addr, u16 internal_addr)
inline u16 TLan_DioRead16(u16 base_addr, u16 internal_addr) static inline u16 TLan_DioRead16(u16 base_addr, u16 internal_addr)
{ {
outw(internal_addr, base_addr + TLAN_DIO_ADR); outw(internal_addr, base_addr + TLAN_DIO_ADR);
return (inw((base_addr + TLAN_DIO_DATA) + (internal_addr & 0x2))); return (inw((base_addr + TLAN_DIO_DATA) + (internal_addr & 0x2)));
@ -413,7 +413,7 @@ inline u16 TLan_DioRead16(u16 base_addr, u16 internal_addr)
inline u32 TLan_DioRead32(u16 base_addr, u16 internal_addr) static inline u32 TLan_DioRead32(u16 base_addr, u16 internal_addr)
{ {
outw(internal_addr, base_addr + TLAN_DIO_ADR); outw(internal_addr, base_addr + TLAN_DIO_ADR);
return (inl(base_addr + TLAN_DIO_DATA)); return (inl(base_addr + TLAN_DIO_DATA));
@ -423,7 +423,7 @@ inline u32 TLan_DioRead32(u16 base_addr, u16 internal_addr)
inline void TLan_DioWrite8(u16 base_addr, u16 internal_addr, u8 data) static inline void TLan_DioWrite8(u16 base_addr, u16 internal_addr, u8 data)
{ {
outw(internal_addr, base_addr + TLAN_DIO_ADR); outw(internal_addr, base_addr + TLAN_DIO_ADR);
outb(data, base_addr + TLAN_DIO_DATA + (internal_addr & 0x3)); outb(data, base_addr + TLAN_DIO_DATA + (internal_addr & 0x3));
@ -433,7 +433,7 @@ inline void TLan_DioWrite8(u16 base_addr, u16 internal_addr, u8 data)
inline void TLan_DioWrite16(u16 base_addr, u16 internal_addr, u16 data) static inline void TLan_DioWrite16(u16 base_addr, u16 internal_addr, u16 data)
{ {
outw(internal_addr, base_addr + TLAN_DIO_ADR); outw(internal_addr, base_addr + TLAN_DIO_ADR);
outw(data, base_addr + TLAN_DIO_DATA + (internal_addr & 0x2)); outw(data, base_addr + TLAN_DIO_DATA + (internal_addr & 0x2));
@ -443,7 +443,7 @@ inline void TLan_DioWrite16(u16 base_addr, u16 internal_addr, u16 data)
inline void TLan_DioWrite32(u16 base_addr, u16 internal_addr, u32 data) static inline void TLan_DioWrite32(u16 base_addr, u16 internal_addr, u32 data)
{ {
outw(internal_addr, base_addr + TLAN_DIO_ADR); outw(internal_addr, base_addr + TLAN_DIO_ADR);
outl(data, base_addr + TLAN_DIO_DATA + (internal_addr & 0x2)); outl(data, base_addr + TLAN_DIO_DATA + (internal_addr & 0x2));
@ -453,7 +453,7 @@ inline void TLan_DioWrite32(u16 base_addr, u16 internal_addr, u32 data)
#if 0 #if 0
inline void TLan_ClearBit(u8 bit, u16 port) static inline void TLan_ClearBit(u8 bit, u16 port)
{ {
outb_p(inb_p(port) & ~bit, port); outb_p(inb_p(port) & ~bit, port);
} }
@ -461,7 +461,7 @@ inline void TLan_ClearBit(u8 bit, u16 port)
inline int TLan_GetBit(u8 bit, u16 port) static inline int TLan_GetBit(u8 bit, u16 port)
{ {
return ((int) (inb_p(port) & bit)); return ((int) (inb_p(port) & bit));
} }
@ -469,7 +469,7 @@ inline int TLan_GetBit(u8 bit, u16 port)
inline void TLan_SetBit(u8 bit, u16 port) static inline void TLan_SetBit(u8 bit, u16 port)
{ {
outb_p(inb_p(port) | bit, port); outb_p(inb_p(port) | bit, port);
} }
@ -482,7 +482,7 @@ inline void TLan_SetBit(u8 bit, u16 port)
#ifdef I_LIKE_A_FAST_HASH_FUNCTION #ifdef I_LIKE_A_FAST_HASH_FUNCTION
/* given 6 bytes, view them as 8 6-bit numbers and return the XOR of those */ /* given 6 bytes, view them as 8 6-bit numbers and return the XOR of those */
/* the code below is about seven times as fast as the original code */ /* the code below is about seven times as fast as the original code */
inline u32 TLan_HashFunc(u8 * a) static inline u32 TLan_HashFunc(u8 * a)
{ {
u8 hash; u8 hash;
@ -498,7 +498,7 @@ inline u32 TLan_HashFunc(u8 * a)
#else /* original code */ #else /* original code */
inline u32 xor(u32 a, u32 b) static inline u32 xor(u32 a, u32 b)
{ {
return ((a && !b) || (!a && b)); return ((a && !b) || (!a && b));
} }
@ -506,7 +506,7 @@ inline u32 xor(u32 a, u32 b)
#define XOR8( a, b, c, d, e, f, g, h ) xor( a, xor( b, xor( c, xor( d, xor( e, xor( f, xor( g, h ) ) ) ) ) ) ) #define XOR8( a, b, c, d, e, f, g, h ) xor( a, xor( b, xor( c, xor( d, xor( e, xor( f, xor( g, h ) ) ) ) ) ) )
#define DA( a, bit ) ( ( (u8) a[bit/8] ) & ( (u8) ( 1 << bit%8 ) ) ) #define DA( a, bit ) ( ( (u8) a[bit/8] ) & ( (u8) ( 1 << bit%8 ) ) )
inline u32 TLan_HashFunc(u8 * a) static inline u32 TLan_HashFunc(u8 * a)
{ {
u32 hash; u32 hash;

View File

@ -400,12 +400,17 @@ static u32 ioaddr;
longword divisable */ longword divisable */
#define TX_RING_SIZE 2 #define TX_RING_SIZE 2
static struct tulip_tx_desc tx_ring[TX_RING_SIZE] __attribute__ ((aligned(4)));
static unsigned char txb[BUFLEN] __attribute__ ((aligned(4)));
#define RX_RING_SIZE 4 #define RX_RING_SIZE 4
static struct tulip_rx_desc rx_ring[RX_RING_SIZE] __attribute__ ((aligned(4))); struct {
static unsigned char rxb[RX_RING_SIZE * BUFLEN] __attribute__ ((aligned(4))); struct tulip_tx_desc tx_ring[TX_RING_SIZE];
unsigned char txb[BUFLEN];
struct tulip_rx_desc rx_ring[RX_RING_SIZE];
unsigned char rxb[RX_RING_SIZE * BUFLEN];
} tulip_buffers __shared __attribute__ ((aligned(4)));
#define tx_ring tulip_buffers.tx_ring
#define txb tulip_buffers.txb
#define rx_ring tulip_buffers.rx_ring
#define rxb tulip_buffers.rxb
static struct tulip_private { static struct tulip_private {
int cur_rx; int cur_rx;