EISA_DRIVER ( el3_eisa_driver, el3_eisa_adapters );
DRIVER ( "3c509 (EISA)", nic_driver, eisa_driver, el3_eisa_driver,
- el3_eisa_probe, el3_eisa_disable );
+ el3_eisa_probe, el3_eisa_disable, no_fake_bss );
ISA_ROM ( "3c509-eisa","3c509 (EISA)" );
DBG ( "Adding 3c509 device %02x (I/O %04x)\n",
t509->tag, t509->ioaddr );
return legacy_probe ( t509, legacy_t509_set_drvdata, &t509->dev,
- legacy_t509_probe, legacy_t509_disable );
+ legacy_t509_probe, legacy_t509_disable, 0 );
}
/**
/* TJL definations */
#define HZ 100
static int if_port;
-static struct corkscrew_private *vp;
/* Brought directly from 3c515.c by Becker */
#define CORKSCREW 1
full_bus_master_tx:1, full_bus_master_rx:1, /* Boomerang */
tx_full:1;
};
+#define vp NIC_FAKE_BSS_PTR ( struct corkscrew_private )
/* The action to take with a media selection timer tick.
Note that we deviate from the 3Com order by checking 10base2 before AUI.
ISAPNP_DRIVER ( t515_driver, t515_adapters );
DRIVER ( "3c515", nic_driver, isapnp_driver, t515_driver,
- t515_probe, t515_disable );
+ t515_probe, t515_disable, *vp );
ISA_ROM ( "3c515", "3c515 Fast EtherLink ISAPnP" );
MCA_DRIVER ( t529_driver, el3_mca_adapters );
DRIVER ( "3c529", nic_driver, mca_driver, t529_driver,
- t529_probe, t529_disable );
+ t529_probe, t529_disable, no_fake_bss );
ISA_ROM( "3c529", "3c529 == MCA 3c509" );
PCI_DRIVER ( t595_driver, t595_nics, PCI_NO_CLASS );
DRIVER ( "3C595", nic_driver, pci_driver, t595_driver,
- t595_probe, t595_disable );
+ t595_probe, t595_disable, no_fake_bss );
/*
* Local variables:
struct nic *nic;
void *mmio;
};
-
-static struct amd8111e_priv amd8111e;
+#define amd8111e NIC_FAKE_BSS ( struct amd8111e_priv )
/********************************************************
PCI_DRIVER ( amd8111e_driver, amd8111e_nics, PCI_NO_CLASS );
DRIVER ( "AMD8111E", nic_driver, pci_driver, amd8111e_driver,
- amd8111e_probe, amd8111e_disable );
+ amd8111e_probe, amd8111e_disable, amd8111e );
/*
* Local variables:
/* The bnx2 seems to be picky about the alignment of the receive buffers
* and possibly the status block.
*/
-static struct bss {
+struct bss {
struct tx_bd tx_desc_ring[TX_DESC_CNT];
struct rx_bd rx_desc_ring[RX_DESC_CNT];
unsigned char rx_buf[RX_BUF_CNT][RX_BUF_SIZE];
struct status_block status_blk;
struct statistics_block stats_blk;
-} bnx2_bss;
+};
+#define bnx2_bss NIC_FAKE_BSS ( struct bss )
static struct bnx2 bnx2;
PCI_DRIVER ( bnx2_driver, bnx2_nics, PCI_NO_CLASS );
-DRIVER ( "BNX2", nic_driver, pci_driver, bnx2_driver, bnx2_probe, bnx2_remove );
+DRIVER ( "BNX2", nic_driver, pci_driver, bnx2_driver,
+ bnx2_probe, bnx2_remove, bnx2_bss );
/*
static struct pci_driver bnx2_driver __pci_driver = {
ISAPNP_VENDOR('C','S','C'), 0x0007 );
DRIVER ( "cs89x0", nic_driver, isa_driver, cs89x0_driver,
- cs89x0_probe, cs89x0_disable );
+ cs89x0_probe, cs89x0_disable, no_fake_bss );
ISA_ROM ( "cs89x0", "Crystal Semiconductor CS89x0" );
/* transmit descriptor and buffer */
#define NTXD 2
#define NRXD 4
-struct {
+struct davicom_bss {
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 davicom_bufs NIC_FAKE_BSS ( struct davicom_bss )
#define txd davicom_bufs.txd
#define txb davicom_bufs.txb
#define rxd davicom_bufs.rxd
PCI_DRIVER ( davicom_driver, davicom_nics, PCI_NO_CLASS );
DRIVER ( "DAVICOM", nic_driver, pci_driver, davicom_driver,
- davicom_probe, davicom_disable );
+ davicom_probe, davicom_disable, davicom_bufs );
/*
* Local variables:
GENERIC_ISAPNP_VENDOR, 0x80f7 );
DRIVER ( "depce", nic_driver, isa_driver, depca_driver,
- depca_probe, depca_disable );
+ depca_probe, depca_disable, no_fake_bss );
ISA_ROM ( "depca", "Digital DE100 and DE200" );
/**********************************************
* Descriptor Ring and Buffer defination
***********************************************/
-struct {
+struct dmfe_bss {
struct tx_desc txd[TX_DESC_CNT] __attribute__ ((aligned(32)));
unsigned char txb[TX_BUF_ALLOC * TX_DESC_CNT]
__attribute__ ((aligned(32)));
struct rx_desc rxd[RX_DESC_CNT] __attribute__ ((aligned(32)));
unsigned char rxb[RX_ALLOC_SIZE * RX_DESC_CNT]
__attribute__ ((aligned(32)));
-} dmfe_bufs __shared;
+};
+#define dmfe_bufs NIC_FAKE_BSS ( struct dmfe_bss )
#define txd dmfe_bufs.txd
#define txb dmfe_bufs.txb
#define rxd dmfe_bufs.rxd
PCI_DRIVER ( dmfe_driver, dmfe_nics, PCI_NO_CLASS );
DRIVER ( "DMFE/PCI", nic_driver, pci_driver, dmfe_driver,
- dmfe_probe, dmfe_disable );
+ dmfe_probe, dmfe_disable, dmfe_bufs );
/*
* Local variables:
GENERIC_ISAPNP_VENDOR, 0x828a );
DRIVER ( "eepro", nic_driver, isa_driver, eepro_driver,
- eepro_probe, eepro_disable );
+ eepro_probe, eepro_disable, no_fake_bss );
ISA_ROM ( "eepro", "Intel Etherexpress Pro/10" );
static unsigned short eeprom[64];
#endif
static signed char phys[4]; /* MII device addresses. */
-struct {
+struct epic100_bss {
struct epic_rx_desc rx_ring[RX_RING_SIZE]
__attribute__ ((aligned(4)));
struct epic_tx_desc tx_ring[TX_RING_SIZE]
__attribute__ ((aligned(4)));
unsigned char rx_packet[PKT_BUF_SZ * RX_RING_SIZE];
unsigned char tx_packet[PKT_BUF_SZ * TX_RING_SIZE];
-} epic100_bufs __shared;
+};
+#define epic100_bufs NIC_FAKE_BSS ( struct epic100_bss )
#define rx_ring epic100_bufs.rx_ring
#define tx_ring epic100_bufs.tx_ring
#define rx_packet epic100_bufs.rx_packet
PCI_DRIVER ( epic100_driver, epic100_nics, PCI_NO_CLASS );
DRIVER ( "EPIC100", nic_driver, pci_driver, epic100_driver,
- epic100_probe, epic100_disable );
+ epic100_probe, epic100_disable, epic100_bufs );
/*
* Local variables:
void ( * set_drvdata ) ( void *hwdev, void *priv ),
struct device *dev,
int ( * probe ) ( struct nic *nic, void *hwdev ),
- void ( * disable ) ( struct nic *nic, void *hwdev ) ) {
+ void ( * disable ) ( struct nic *nic, void *hwdev ),
+ size_t fake_bss_len ) {
struct net_device *netdev;
struct nic *nic;
int rc;
- if ( legacy_registered )
- return -EBUSY;
-
+ if ( legacy_registered ) {
+ rc = -EBUSY;
+ goto err_registered;
+ }
+
netdev = alloc_etherdev ( 0 );
- if ( ! netdev )
- return -ENOMEM;
+ if ( ! netdev ) {
+ rc = -ENOMEM;
+ goto err_alloc;
+ }
netdev_init ( netdev, &legacy_operations );
nic = &legacy_nic;
netdev->priv = nic;
nic->node_addr = netdev->hw_addr;
nic->irqno = dev->desc.irq;
+ if ( fake_bss_len ) {
+ nic->fake_bss = malloc_phys ( fake_bss_len, PAGE_SIZE );
+ if ( ! nic->fake_bss ) {
+ rc = -ENOMEM;
+ goto err_fake_bss;
+ }
+ }
+ nic->fake_bss_len = fake_bss_len;
+
if ( ! probe ( nic, hwdev ) ) {
rc = -ENODEV;
goto err_probe;
err_register:
disable ( nic, hwdev );
err_probe:
+ if ( fake_bss_len )
+ free_phys ( nic->fake_bss, fake_bss_len );
+ err_fake_bss:
netdev_nullify ( netdev );
netdev_put ( netdev );
+ err_alloc:
+ err_registered:
return rc;
}
unregister_netdev ( netdev );
disable ( nic, hwdev );
+ if ( nic->fake_bss_len )
+ free_phys ( nic->fake_bss, nic->fake_bss_len );
netdev_nullify ( netdev );
netdev_put ( netdev );
legacy_registered = 0;
GENERIC_ISAPNP_VENDOR, 0x0600 );
DRIVER ( "ne", nic_driver, isapnp_driver, ne_driver,
- ne_probe, ne_disable );
+ ne_probe, ne_disable, no_fake_bss );
ISA_ROM("ne","NE1000/2000 and clones");
PCI_DRIVER ( nepci_driver, nepci_nics, PCI_NO_CLASS );
DRIVER ( "NE2000/PCI", nic_driver, pci_driver, nepci_driver,
- nepci_probe, ns8390_disable );
+ nepci_probe, ns8390_disable, no_fake_bss );
#endif /* INCLUDE_NS8390 */
PCI_DRIVER ( prism2_pci_driver, prism2_pci_nics, PCI_NO_CLASS );
DRIVER ( "Prism2/PCI", nic_driver, pci_driver, prism2_pci_driver,
- prism2_pci_probe, prism2_pci_disable );
+ prism2_pci_probe, prism2_pci_disable, no_fake_bss );
/*
* Local variables:
PCI_DRIVER ( prism2_plx_driver, prism2_plx_nics, PCI_NO_CLASS );
-
DRIVER ( "Prism2/PLX", nic_driver, pci_driver, prism2_plx_driver,
- prism2_plx_probe, prism2_plx_disable );
+ prism2_plx_probe, prism2_plx_disable, no_fake_bss );
/*
* Local variables:
static unsigned int cur_rx;
-struct {
+struct sis900_bss {
BufferDesc txd;
BufferDesc rxd[NUM_RX_DESC];
unsigned char txb[TX_BUF_SIZE];
unsigned char rxb[NUM_RX_DESC * RX_BUF_SIZE];
-} sis900_bufs __shared;
+};
+#define sis900_bufs NIC_FAKE_BSS ( struct sis900_bss )
#define txd sis900_bufs.txd
#define rxd sis900_bufs.rxd
#define txb sis900_bufs.txb
PCI_DRIVER ( sis900_driver, sis900_nics, PCI_NO_CLASS );
DRIVER ( "SIS900", nic_driver, pci_driver, sis900_driver,
- sis900_probe, sis900_disable );
+ sis900_probe, sis900_disable, sis900_bufs );
/*
* Local variables:
GENERIC_ISAPNP_VENDOR, 0x8228 );
DRIVER ( "SMC9000", nic_driver, isa_driver, smc9000_driver,
- smc9000_probe, smc9000_disable );
+ smc9000_probe, smc9000_disable, no_fake_bss );
ISA_ROM ( "smc9000", "SMC9000" );
/* Create a static buffer of size PKT_BUF_SZ for each RX and TX descriptor.
All descriptors point to a part of this buffer */
-struct {
+struct sundance_bss {
unsigned char txb[PKT_BUF_SZ * TX_RING_SIZE];
unsigned char rxb[RX_RING_SIZE * PKT_BUF_SZ];
-} rx_tx_buf __shared;
+};
+#define rx_tx_buf NIC_FAKE_BSS ( struct sundance_bss )
#define rxb rx_tx_buf.rxb
#define txb rx_tx_buf.txb
PCI_DRIVER ( sundance_driver, sundance_nics, PCI_NO_CLASS );
DRIVER ( "SUNDANCE/PCI", nic_driver, pci_driver, sundance_driver,
- sundance_probe, sundance_disable );
+ sundance_probe, sundance_disable, rx_tx_buf );
/*
* Local variables:
} buffer[TLAN_BUFFERS_PER_LIST];
};
-struct {
+struct tlan_bss {
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];
unsigned char rxb[TLAN_MAX_FRAME_SIZE * TLAN_NUM_RX_LISTS];
-} tlan_buffers __shared;
+};
+#define tlan_buffers NIC_FAKE_BSS ( struct tlan_bss )
#define tx_ring tlan_buffers.tx_ring
#define txb tlan_buffers.txb
#define rx_ring tlan_buffers.rx_ring
PCI_DRIVER ( tlan_driver, tlan_nics, PCI_NO_CLASS );
DRIVER ( "TLAN/PCI", nic_driver, pci_driver, tlan_driver,
- tlan_probe, tlan_disable );
+ tlan_probe, tlan_disable, tlan_buffers );
/*
* Local variables:
#define TX_RING_SIZE 2
#define RX_RING_SIZE 4
-struct {
+struct tulip_bss {
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];
struct tulip_private tpx;
-} tulip_bss __shared __attribute__ ((aligned(4)));
+};
+#define tulip_bss NIC_FAKE_BSS ( struct tulip_bss )
#define tx_ring tulip_bss.tx_ring
#define txb tulip_bss.txb
#define rx_ring tulip_bss.rx_ring
PCI_DRIVER ( tulip_driver, tulip_nics, PCI_NO_CLASS );
DRIVER ( "Tulip", nic_driver, pci_driver, tulip_driver,
- tulip_probe, tulip_disable );
+ tulip_probe, tulip_disable, tulip_bss );
/*
* Local variables:
static int ioaddr;
static unsigned short eeprom [0x40];
-struct {
+struct w89c840_bss {
char rx_packet[PKT_BUF_SZ * RX_RING_SIZE];
char tx_packet[PKT_BUF_SZ * TX_RING_SIZE];
-} w89c840_buf __shared;
+};
+#define w89c840_buf NIC_FAKE_BSS ( struct w89c840_bss )
static int eeprom_read(long ioaddr, int location);
static int mdio_read(int base_address, int phy_id, int location);
DRIVER ( "W89C840F", nic_driver, pci_driver, w89c840_driver,
- w89c840_probe, w89c840_disable );
+ w89c840_probe, w89c840_disable, w89c840_buf );
/*
* Local variables:
*/
#define inline inline __attribute__ (( no_instrument_function ))
-/**
- * Shared data.
- *
- * To save space in the binary when multiple-driver images are
- * compiled, uninitialised data areas can be shared between drivers.
- * This will typically be used to share statically-allocated receive
- * and transmit buffers between drivers.
- *
- * Use as e.g.
- *
- * @code
- *
- * struct {
- * char rx_buf[NUM_RX_BUF][RX_BUF_SIZE];
- * char tx_buf[TX_BUF_SIZE];
- * } my_static_data __shared;
- *
- * @endcode
- *
- */
-#define __shared __asm__ ( "_shared_bss" ) __aligned
-
#endif /* ASSEMBLY */
/** @} */
unsigned int mbps;
duplex_t duplex;
void *priv_data; /* driver private data */
+ void *fake_bss;
+ size_t fake_bss_len;
};
+#define NIC_FAKE_BSS_PTR( type ) ( ( type * ) legacy_nic.fake_bss )
+#define NIC_FAKE_BSS( type ) ( * NIC_FAKE_BSS_PTR ( type ) )
+extern struct {} no_fake_bss;
+
struct nic_operations {
int ( *connect ) ( struct nic * );
int ( *poll ) ( struct nic *, int retrieve );
void ( * set_drvdata ) ( void *hwdev, void *priv ),
struct device *dev,
int ( * probe ) ( struct nic *nic, void *hwdev ),
- void ( * disable ) ( struct nic *nic, void *hwdev ));
+ void ( * disable ) ( struct nic *nic, void *hwdev ),
+ size_t fake_bss_len );
void legacy_remove ( void *hwdev,
void * ( * get_drvdata ) ( void *hwdev ),
void ( * disable ) ( struct nic *nic, void *hwdev ) );
}
#undef DRIVER
-#define DRIVER(_name_text,_unused2,_unused3,_name,_probe,_disable) \
+#define DRIVER( _name_text, _unused2, _unused3, _name, _probe, _disable, \
+ _fake_bss ) \
static __attribute__ (( unused )) const char \
_name ## _text[] = _name_text; \
static inline int \
_name ## _pci_legacy_probe ( struct pci_device *pci ) { \
return legacy_probe ( pci, legacy_pci_set_drvdata, \
&pci->dev, _name ## _probe, \
- _name ## _disable ); \
+ _name ## _disable, \
+ sizeof ( _fake_bss ) ); \
} \
static inline void \
_name ## _pci_legacy_remove ( struct pci_device *pci ) { \
const struct isapnp_device_id *id __unused ) { \
return legacy_probe ( isapnp, legacy_isapnp_set_drvdata, \
&isapnp->dev, _name ## _probe, \
- _name ## _disable ); \
+ _name ## _disable, \
+ sizeof ( _fake_bss ) ); \
} \
static inline void \
_name ## _isapnp_legacy_remove ( struct isapnp_device *isapnp ) { \
const struct eisa_device_id *id __unused ) { \
return legacy_probe ( eisa, legacy_eisa_set_drvdata, \
&eisa->dev, _name ## _probe, \
- _name ## _disable ); \
+ _name ## _disable, \
+ sizeof ( _fake_bss ) ); \
} \
static inline void \
_name ## _eisa_legacy_remove ( struct eisa_device *eisa ) { \
const struct mca_device_id *id __unused ) { \
return legacy_probe ( mca, legacy_mca_set_drvdata, \
&mca->dev, _name ## _probe, \
- _name ## _disable ); \
+ _name ## _disable, \
+ sizeof ( _fake_bss ) ); \
} \
static inline void \
_name ## _mca_legacy_remove ( struct mca_device *mca ) { \
_name ## _isa_legacy_probe ( struct isa_device *isa ) { \
return legacy_probe ( isa, legacy_isa_set_drvdata, \
&isa->dev, _name ## _probe, \
- _name ## _disable ); \
+ _name ## _disable, \
+ sizeof ( _fake_bss ) ); \
} \
static inline void \
_name ## _isa_legacy_remove ( struct isa_device *isa ) { \