mirror of
https://github.com/ipxe/ipxe
synced 2025-12-16 01:21:10 +03:00
[legacy] Allocate legacy driver .bss-like segments at probe time
Some legacy drivers use large static allocations for transmit and receive buffers. To avoid bloating the .bss segment, we currently implement these as a single common symbol named "_shared_bss" (which is permissible since only one legacy driver may be active at any one time). Switch to dynamic allocation of these .bss-like segments, to avoid the requirement for using common symbols. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -35,7 +35,7 @@ static struct eisa_device_id el3_eisa_adapters[] = {
|
||||
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)" );
|
||||
|
||||
|
||||
@@ -316,7 +316,7 @@ static int t509_probe ( struct t509_device *t509 ) {
|
||||
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 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -64,7 +64,6 @@ static void t3c515_wait(unsigned int nticks)
|
||||
/* TJL definations */
|
||||
#define HZ 100
|
||||
static int if_port;
|
||||
static struct corkscrew_private *vp;
|
||||
/* Brought directly from 3c515.c by Becker */
|
||||
#define CORKSCREW 1
|
||||
|
||||
@@ -237,6 +236,7 @@ struct corkscrew_private {
|
||||
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.
|
||||
@@ -759,6 +759,6 @@ static struct isapnp_device_id t515_adapters[] = {
|
||||
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" );
|
||||
|
||||
@@ -49,7 +49,7 @@ static struct mca_device_id el3_mca_adapters[] = {
|
||||
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" );
|
||||
|
||||
|
||||
@@ -541,7 +541,7 @@ PCI_ROM(0x10b7, 0x9805, "3c9805-1", "3Com9805", 0), /* Dual Port Server
|
||||
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:
|
||||
|
||||
@@ -105,8 +105,7 @@ struct amd8111e_priv {
|
||||
struct nic *nic;
|
||||
void *mmio;
|
||||
};
|
||||
|
||||
static struct amd8111e_priv amd8111e;
|
||||
#define amd8111e NIC_FAKE_BSS ( struct amd8111e_priv )
|
||||
|
||||
|
||||
/********************************************************
|
||||
@@ -683,7 +682,7 @@ static struct pci_device_id amd8111e_nics[] = {
|
||||
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:
|
||||
|
||||
@@ -36,13 +36,14 @@ FILE_LICENCE ( GPL_ANY );
|
||||
/* 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;
|
||||
|
||||
@@ -2686,7 +2687,8 @@ static struct pci_device_id bnx2_nics[] = {
|
||||
|
||||
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 = {
|
||||
|
||||
@@ -725,7 +725,7 @@ ISA_DRIVER ( cs89x0_driver, cs89x0_probe_addrs, cs89x0_probe_addr,
|
||||
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" );
|
||||
|
||||
|
||||
@@ -134,12 +134,13 @@ static unsigned long ioaddr;
|
||||
/* 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
|
||||
@@ -698,7 +699,7 @@ PCI_ROM(0x1282, 0x9132, "davicom9132", "Davicom 9132", 0), /* Needs probably som
|
||||
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:
|
||||
|
||||
@@ -789,7 +789,7 @@ ISA_DRIVER ( depca_driver, depca_probe_addrs, depca_probe1,
|
||||
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" );
|
||||
|
||||
|
||||
@@ -209,14 +209,15 @@ static u8 SF_mode; /* Special Function: 1:VLAN, 2:RX Flow Control
|
||||
/**********************************************
|
||||
* 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
|
||||
@@ -1217,7 +1218,7 @@ static struct pci_device_id dmfe_nics[] = {
|
||||
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:
|
||||
|
||||
@@ -635,7 +635,7 @@ ISA_DRIVER ( eepro_driver, eepro_probe_addrs, eepro_probe1,
|
||||
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" );
|
||||
|
||||
|
||||
@@ -86,14 +86,15 @@ static unsigned int cur_rx, cur_tx; /* The next free ring entry */
|
||||
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
|
||||
@@ -525,7 +526,7 @@ PCI_ROM(0x10b8, 0x0006, "smc-83c175", "SMC EPIC/C 83c175", 0),
|
||||
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:
|
||||
|
||||
@@ -84,17 +84,22 @@ int legacy_probe ( void *hwdev,
|
||||
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;
|
||||
@@ -105,6 +110,15 @@ int legacy_probe ( void *hwdev,
|
||||
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;
|
||||
@@ -133,8 +147,13 @@ int legacy_probe ( void *hwdev,
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -146,6 +165,8 @@ void legacy_remove ( void *hwdev,
|
||||
|
||||
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;
|
||||
|
||||
@@ -370,6 +370,6 @@ ISA_DRIVER ( ne_driver, ne_probe_addrs, ne_probe1,
|
||||
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");
|
||||
|
||||
@@ -1022,7 +1022,7 @@ PCI_ROM(0x8e2e, 0x3000, "ktiet32p2", "KTI ET32P2", 0),
|
||||
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 */
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ PCI_ROM(0x1260, 0x3873, "prism2_pci", "Harris Semiconductor Prism2.5 clone", 0),
|
||||
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:
|
||||
|
||||
@@ -119,9 +119,8 @@ PCI_ROM(0xec80, 0xec00, "f5d6000", "Belkin F5D6000", 0),
|
||||
|
||||
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:
|
||||
|
||||
@@ -65,12 +65,13 @@ static unsigned int cur_phy;
|
||||
|
||||
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
|
||||
@@ -1291,7 +1292,7 @@ PCI_ROM(0x1039, 0x7016, "sis7016", "SIS7016", 0),
|
||||
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:
|
||||
|
||||
@@ -939,7 +939,7 @@ ISA_DRIVER ( smc9000_driver, smc9000_probe_addrs, smc9000_probe_addr,
|
||||
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" );
|
||||
|
||||
|
||||
@@ -233,10 +233,11 @@ static struct netdev_desc rx_ring[RX_RING_SIZE];
|
||||
|
||||
/* 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
|
||||
|
||||
@@ -888,7 +889,7 @@ static struct pci_device_id sundance_nics[] = {
|
||||
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:
|
||||
|
||||
@@ -179,12 +179,13 @@ struct TLanList {
|
||||
} 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
|
||||
@@ -1715,7 +1716,7 @@ static struct pci_device_id tlan_nics[] = {
|
||||
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:
|
||||
|
||||
@@ -426,13 +426,14 @@ struct tulip_private {
|
||||
|
||||
#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
|
||||
@@ -1958,7 +1959,7 @@ PCI_ROM(0x8086, 0x0039, "intel21145", "Intel Tulip", 0),
|
||||
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:
|
||||
|
||||
@@ -254,10 +254,11 @@ static struct winbond_private
|
||||
|
||||
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);
|
||||
@@ -956,7 +957,7 @@ static void init_ring(void)
|
||||
|
||||
|
||||
DRIVER ( "W89C840F", nic_driver, pci_driver, w89c840_driver,
|
||||
w89c840_probe, w89c840_disable );
|
||||
w89c840_probe, w89c840_disable, w89c840_buf );
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
|
||||
@@ -623,28 +623,6 @@ char __debug_disable(OBJECT) = ( DBGLVL_MAX & ~DBGLVL_DFLT );
|
||||
*/
|
||||
#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 */
|
||||
/** @} */
|
||||
|
||||
|
||||
@@ -57,8 +57,14 @@ struct nic {
|
||||
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 );
|
||||
@@ -90,7 +96,8 @@ extern int legacy_probe ( void *hwdev,
|
||||
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 ) );
|
||||
@@ -210,7 +217,8 @@ static inline void * legacy_isa_get_drvdata ( 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 \
|
||||
@@ -225,7 +233,8 @@ static inline void * legacy_isa_get_drvdata ( void *hwdev ) {
|
||||
_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 ) { \
|
||||
@@ -237,7 +246,8 @@ static inline void * legacy_isa_get_drvdata ( void *hwdev ) {
|
||||
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 ) { \
|
||||
@@ -249,7 +259,8 @@ static inline void * legacy_isa_get_drvdata ( void *hwdev ) {
|
||||
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 ) { \
|
||||
@@ -261,7 +272,8 @@ static inline void * legacy_isa_get_drvdata ( void *hwdev ) {
|
||||
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 ) { \
|
||||
@@ -272,7 +284,8 @@ static inline void * legacy_isa_get_drvdata ( void *hwdev ) {
|
||||
_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 ) { \
|
||||
|
||||
Reference in New Issue
Block a user