Commit 56970f58 authored by Linus Torvalds's avatar Linus Torvalds

Merge http://gkernel.bkbits.net/net-drivers-2.5

into home.transmeta.com:/home/torvalds/v2.5/linux
parents 39412eff 996dec15
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
h/w stats can be reset only by software reset h/w stats can be reset only by software reset
* Tx checksumming * Tx checksumming
* Handle netif_rx return value * Handle netif_rx return value
* ETHTOOL_GREGS, ETHTOOL_[GS]WOL, * ETHTOOL_[GS]WOL,
* Investigate using skb->priority with h/w VLAN priority * Investigate using skb->priority with h/w VLAN priority
* Investigate using High Priority Tx Queue with skb->priority * Investigate using High Priority Tx Queue with skb->priority
* Adjust Rx FIFO threshold and Max Rx DMA burst on Rx FIFO error * Adjust Rx FIFO threshold and Max Rx DMA burst on Rx FIFO error
...@@ -41,12 +41,14 @@ ...@@ -41,12 +41,14 @@
Tx descriptor bit Tx descriptor bit
* The real minimum of CP_MIN_MTU is 4 bytes. However, * The real minimum of CP_MIN_MTU is 4 bytes. However,
for this to be supported, one must(?) turn on packet padding. for this to be supported, one must(?) turn on packet padding.
* Support 8169 GMII
* Support external MII transceivers
*/ */
#define DRV_NAME "8139cp" #define DRV_NAME "8139cp"
#define DRV_VERSION "0.0.7" #define DRV_VERSION "0.1.0"
#define DRV_RELDATE "Feb 27, 2002" #define DRV_RELDATE "Jun 14, 2002"
#include <linux/config.h> #include <linux/config.h>
...@@ -99,6 +101,7 @@ MODULE_PARM_DESC (multicast_filter_limit, "8139cp maximum number of filtered mul ...@@ -99,6 +101,7 @@ MODULE_PARM_DESC (multicast_filter_limit, "8139cp maximum number of filtered mul
NETIF_MSG_PROBE | \ NETIF_MSG_PROBE | \
NETIF_MSG_LINK) NETIF_MSG_LINK)
#define CP_REGS_SIZE (0xff + 1) #define CP_REGS_SIZE (0xff + 1)
#define CP_REGS_VER 1 /* version 1 */
#define CP_RX_RING_SIZE 64 #define CP_RX_RING_SIZE 64
#define CP_TX_RING_SIZE 64 #define CP_TX_RING_SIZE 64
#define CP_RING_BYTES \ #define CP_RING_BYTES \
...@@ -152,7 +155,9 @@ enum { ...@@ -152,7 +155,9 @@ enum {
NWayExpansion = 0x6A, /* MII Expansion */ NWayExpansion = 0x6A, /* MII Expansion */
Config5 = 0xD8, /* Config5 */ Config5 = 0xD8, /* Config5 */
TxPoll = 0xD9, /* Tell chip to check Tx descriptors for work */ TxPoll = 0xD9, /* Tell chip to check Tx descriptors for work */
RxMaxSize = 0xDA, /* Max size of an Rx packet (8169 only) */
CpCmd = 0xE0, /* C+ Command register (C+ mode only) */ CpCmd = 0xE0, /* C+ Command register (C+ mode only) */
IntrMitigate = 0xE2, /* rx/tx interrupt mitigation control */
RxRingAddr = 0xE4, /* 64-bit start addr of Rx ring */ RxRingAddr = 0xE4, /* 64-bit start addr of Rx ring */
TxThresh = 0xEC, /* Early Tx threshold */ TxThresh = 0xEC, /* Early Tx threshold */
OldRxBufAddr = 0x30, /* DMA address of Rx ring buffer (C mode) */ OldRxBufAddr = 0x30, /* DMA address of Rx ring buffer (C mode) */
...@@ -313,6 +318,7 @@ struct cp_private { ...@@ -313,6 +318,7 @@ struct cp_private {
struct sk_buff *frag_skb; struct sk_buff *frag_skb;
unsigned dropping_frag : 1; unsigned dropping_frag : 1;
unsigned int board_type;
struct mii_if_info mii_if; struct mii_if_info mii_if;
}; };
...@@ -341,10 +347,28 @@ static void __cp_set_rx_mode (struct net_device *dev); ...@@ -341,10 +347,28 @@ static void __cp_set_rx_mode (struct net_device *dev);
static void cp_tx (struct cp_private *cp); static void cp_tx (struct cp_private *cp);
static void cp_clean_rings (struct cp_private *cp); static void cp_clean_rings (struct cp_private *cp);
enum board_type {
RTL8139Cp,
RTL8169,
};
static struct cp_board_info {
const char *name;
} cp_board_tbl[] __devinitdata = {
/* RTL8139Cp */
{ "RTL-8139C+" },
/* RTL8169 */
{ "RTL-8169" },
};
static struct pci_device_id cp_pci_tbl[] __devinitdata = { static struct pci_device_id cp_pci_tbl[] __devinitdata = {
{ PCI_VENDOR_ID_REALTEK, PCI_DEVICE_ID_REALTEK_8139, { PCI_VENDOR_ID_REALTEK, PCI_DEVICE_ID_REALTEK_8139,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139Cp },
#if 0
{ PCI_VENDOR_ID_REALTEK, PCI_DEVICE_ID_REALTEK_8169,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8169 },
#endif
{ }, { },
}; };
MODULE_DEVICE_TABLE(pci, cp_pci_tbl); MODULE_DEVICE_TABLE(pci, cp_pci_tbl);
...@@ -890,7 +914,10 @@ static void cp_reset_hw (struct cp_private *cp) ...@@ -890,7 +914,10 @@ static void cp_reset_hw (struct cp_private *cp)
static inline void cp_start_hw (struct cp_private *cp) static inline void cp_start_hw (struct cp_private *cp)
{ {
cpw8(Cmd, RxOn | TxOn); cpw8(Cmd, RxOn | TxOn);
cpw16(CpCmd, PCIMulRW | RxChkSum | CpRxOn | CpTxOn); if (cp->board_type == RTL8169)
cpw16(CpCmd, PCIMulRW | RxChkSum);
else
cpw16(CpCmd, PCIMulRW | RxChkSum | CpRxOn | CpTxOn);
} }
static void cp_init_hw (struct cp_private *cp) static void cp_init_hw (struct cp_private *cp)
...@@ -912,16 +939,14 @@ static void cp_init_hw (struct cp_private *cp) ...@@ -912,16 +939,14 @@ static void cp_init_hw (struct cp_private *cp)
cpw32_f (TxConfig, IFG | (TX_DMA_BURST << TxDMAShift)); cpw32_f (TxConfig, IFG | (TX_DMA_BURST << TxDMAShift));
cpw8(Config1, cpr8(Config1) | DriverLoaded | PMEnable); cpw8(Config1, cpr8(Config1) | DriverLoaded | PMEnable);
cpw8(Config3, PARMEnable); /* disables magic packet and WOL */ if (cp->board_type == RTL8139Cp)
cpw8(Config3, PARMEnable); /* disables magic packet and WOL */
cpw8(Config5, cpr8(Config5) & PMEStatus); /* disables more WOL stuff */ cpw8(Config5, cpr8(Config5) & PMEStatus); /* disables more WOL stuff */
if (cp->board_type == RTL8169)
cpw16(RxMaxSize, cp->rx_buf_sz);
cpw32_f(HiTxRingAddr, 0); cpw32_f(HiTxRingAddr, 0);
cpw32_f(HiTxRingAddr + 4, 0); cpw32_f(HiTxRingAddr + 4, 0);
cpw32_f(OldRxBufAddr, 0);
cpw32_f(OldTSD0, 0);
cpw32_f(OldTSD0 + 4, 0);
cpw32_f(OldTSD0 + 8, 0);
cpw32_f(OldTSD0 + 12, 0);
cpw32_f(RxRingAddr, cp->ring_dma); cpw32_f(RxRingAddr, cp->ring_dma);
cpw32_f(RxRingAddr + 4, 0); cpw32_f(RxRingAddr + 4, 0);
...@@ -930,9 +955,9 @@ static void cp_init_hw (struct cp_private *cp) ...@@ -930,9 +955,9 @@ static void cp_init_hw (struct cp_private *cp)
cpw16(MultiIntr, 0); cpw16(MultiIntr, 0);
cpw16(IntrMask, cp_intr_mask); cpw16_f(IntrMask, cp_intr_mask);
cpw8_f (Cfg9346, Cfg9346_Lock); cpw8_f(Cfg9346, Cfg9346_Lock);
} }
static int cp_refill_rx (struct cp_private *cp) static int cp_refill_rx (struct cp_private *cp)
...@@ -1094,6 +1119,8 @@ static int cp_change_mtu(struct net_device *dev, int new_mtu) ...@@ -1094,6 +1119,8 @@ static int cp_change_mtu(struct net_device *dev, int new_mtu)
dev->mtu = new_mtu; dev->mtu = new_mtu;
cp_set_rxbufsize(cp); /* set new rx buf size */ cp_set_rxbufsize(cp); /* set new rx buf size */
if (cp->board_type == RTL8169)
cpw16(RxMaxSize, cp->rx_buf_sz);
rc = cp_init_rings(cp); /* realloc and restart h/w */ rc = cp_init_rings(cp); /* realloc and restart h/w */
cp_start_hw(cp); cp_start_hw(cp);
...@@ -1153,6 +1180,7 @@ static int cp_ethtool_ioctl (struct cp_private *cp, void *useraddr) ...@@ -1153,6 +1180,7 @@ static int cp_ethtool_ioctl (struct cp_private *cp, void *useraddr)
strcpy (info.driver, DRV_NAME); strcpy (info.driver, DRV_NAME);
strcpy (info.version, DRV_VERSION); strcpy (info.version, DRV_VERSION);
strcpy (info.bus_info, cp->pdev->slot_name); strcpy (info.bus_info, cp->pdev->slot_name);
info.regdump_len = CP_REGS_SIZE;
if (copy_to_user (useraddr, &info, sizeof (info))) if (copy_to_user (useraddr, &info, sizeof (info)))
return -EFAULT; return -EFAULT;
return 0; return 0;
...@@ -1209,6 +1237,128 @@ static int cp_ethtool_ioctl (struct cp_private *cp, void *useraddr) ...@@ -1209,6 +1237,128 @@ static int cp_ethtool_ioctl (struct cp_private *cp, void *useraddr)
return 0; return 0;
} }
/* NIC register dump */
case ETHTOOL_GREGS: {
struct ethtool_regs regs;
u8 *regbuf = kmalloc(CP_REGS_SIZE, GFP_KERNEL);
int rc;
if (!regbuf)
return -ENOMEM;
memset(regbuf, 0, CP_REGS_SIZE);
rc = copy_from_user(&regs, useraddr, sizeof(regs));
if (rc) {
rc = -EFAULT;
goto err_out_gregs;
}
if (regs.len > CP_REGS_SIZE)
regs.len = CP_REGS_SIZE;
if (regs.len < CP_REGS_SIZE) {
rc = -EINVAL;
goto err_out_gregs;
}
regs.version = CP_REGS_VER;
rc = copy_to_user(useraddr, &regs, sizeof(regs));
if (rc) {
rc = -EFAULT;
goto err_out_gregs;
}
useraddr += offsetof(struct ethtool_regs, data);
spin_lock_irq(&cp->lock);
memcpy_fromio(regbuf, cp->regs, CP_REGS_SIZE);
spin_unlock_irq(&cp->lock);
if (copy_to_user(useraddr, regbuf, regs.len))
rc = -EFAULT;
err_out_gregs:
kfree(regbuf);
return rc;
}
/* get/set RX checksumming */
case ETHTOOL_GRXCSUM: {
struct ethtool_value edata = { ETHTOOL_GRXCSUM };
u16 cmd = cpr16(CpCmd) & RxChkSum;
edata.data = cmd ? 1 : 0;
if (copy_to_user(useraddr, &edata, sizeof(edata)))
return -EFAULT;
return 0;
}
case ETHTOOL_SRXCSUM: {
struct ethtool_value edata;
u16 cmd = cpr16(CpCmd), newcmd;
newcmd = cmd;
if (copy_from_user(&edata, useraddr, sizeof(edata)))
return -EFAULT;
if (edata.data)
newcmd |= RxChkSum;
else
newcmd &= ~RxChkSum;
if (newcmd == cmd)
return 0;
spin_lock_irq(&cp->lock);
cpw16_f(CpCmd, newcmd);
spin_unlock_irq(&cp->lock);
}
/* get/set TX checksumming */
case ETHTOOL_GTXCSUM: {
struct ethtool_value edata = { ETHTOOL_GTXCSUM };
edata.data = (cp->dev->features & NETIF_F_IP_CSUM) != 0;
if (copy_to_user(useraddr, &edata, sizeof(edata)))
return -EFAULT;
return 0;
}
case ETHTOOL_STXCSUM: {
struct ethtool_value edata;
if (copy_from_user(&edata, useraddr, sizeof(edata)))
return -EFAULT;
if (edata.data)
cp->dev->features |= NETIF_F_IP_CSUM;
else
cp->dev->features &= ~NETIF_F_IP_CSUM;
return 0;
}
/* get/set scatter-gather */
case ETHTOOL_GSG: {
struct ethtool_value edata = { ETHTOOL_GSG };
edata.data = (cp->dev->features & NETIF_F_SG) != 0;
if (copy_to_user(useraddr, &edata, sizeof(edata)))
return -EFAULT;
return 0;
}
case ETHTOOL_SSG: {
struct ethtool_value edata;
if (copy_from_user(&edata, useraddr, sizeof(edata)))
return -EFAULT;
if (edata.data)
cp->dev->features |= NETIF_F_SG;
else
cp->dev->features &= ~NETIF_F_SG;
return 0;
}
default: default:
break; break;
} }
...@@ -1332,6 +1482,7 @@ static int __devinit cp_init_one (struct pci_dev *pdev, ...@@ -1332,6 +1482,7 @@ static int __devinit cp_init_one (struct pci_dev *pdev,
unsigned addr_len, i; unsigned addr_len, i;
u8 pci_rev, cache_size; u8 pci_rev, cache_size;
u16 pci_command; u16 pci_command;
unsigned int board_type = (unsigned int) ent->driver_data;
#ifndef MODULE #ifndef MODULE
static int version_printed; static int version_printed;
...@@ -1355,6 +1506,7 @@ static int __devinit cp_init_one (struct pci_dev *pdev, ...@@ -1355,6 +1506,7 @@ static int __devinit cp_init_one (struct pci_dev *pdev,
SET_MODULE_OWNER(dev); SET_MODULE_OWNER(dev);
cp = dev->priv; cp = dev->priv;
cp->pdev = pdev; cp->pdev = pdev;
cp->board_type = board_type;
cp->dev = dev; cp->dev = dev;
cp->msg_enable = (debug < 0 ? CP_DEF_MSG_ENABLE : debug); cp->msg_enable = (debug < 0 ? CP_DEF_MSG_ENABLE : debug);
spin_lock_init (&cp->lock); spin_lock_init (&cp->lock);
...@@ -1440,7 +1592,7 @@ static int __devinit cp_init_one (struct pci_dev *pdev, ...@@ -1440,7 +1592,7 @@ static int __devinit cp_init_one (struct pci_dev *pdev,
"%02x:%02x:%02x:%02x:%02x:%02x, " "%02x:%02x:%02x:%02x:%02x:%02x, "
"IRQ %d\n", "IRQ %d\n",
dev->name, dev->name,
"RTL-8139C+", cp_board_tbl[board_type].name,
dev->base_addr, dev->base_addr,
dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[0], dev->dev_addr[1],
dev->dev_addr[2], dev->dev_addr[3], dev->dev_addr[2], dev->dev_addr[3],
......
...@@ -546,8 +546,11 @@ static unsigned long __init lance_probe1( struct net_device *dev, ...@@ -546,8 +546,11 @@ static unsigned long __init lance_probe1( struct net_device *dev,
if (lp->cardtype == PAM_CARD || if (lp->cardtype == PAM_CARD ||
memaddr == (unsigned short *)0xffe00000) { memaddr == (unsigned short *)0xffe00000) {
/* PAMs card and Riebl on ST use level 5 autovector */ /* PAMs card and Riebl on ST use level 5 autovector */
request_irq(IRQ_AUTO_5, lance_interrupt, IRQ_TYPE_PRIO, if (request_irq(IRQ_AUTO_5, lance_interrupt, IRQ_TYPE_PRIO,
"PAM/Riebl-ST Ethernet", dev); "PAM/Riebl-ST Ethernet", dev)) {
printk( "Lance: request for irq %d failed\n", IRQ_AUTO_5 );
return( 0 );
}
dev->irq = (unsigned short)IRQ_AUTO_5; dev->irq = (unsigned short)IRQ_AUTO_5;
} }
else { else {
...@@ -560,8 +563,11 @@ static unsigned long __init lance_probe1( struct net_device *dev, ...@@ -560,8 +563,11 @@ static unsigned long __init lance_probe1( struct net_device *dev,
printk( "Lance: request for VME interrupt failed\n" ); printk( "Lance: request for VME interrupt failed\n" );
return( 0 ); return( 0 );
} }
request_irq(irq, lance_interrupt, IRQ_TYPE_PRIO, if (request_irq(irq, lance_interrupt, IRQ_TYPE_PRIO,
"Riebl-VME Ethernet", dev); "Riebl-VME Ethernet", dev)) {
printk( "Lance: request for irq %d failed\n", irq );
return( 0 );
}
dev->irq = irq; dev->irq = irq;
} }
......
...@@ -257,7 +257,8 @@ write_blink_led_timer(struct file *file, const char *buffer, ...@@ -257,7 +257,8 @@ write_blink_led_timer(struct file *file, const char *buffer,
if (count > WRITE_BUF_MAX_LEN) { if (count > WRITE_BUF_MAX_LEN) {
count = WRITE_BUF_MAX_LEN; count = WRITE_BUF_MAX_LEN;
} }
copy_from_user(s_blink_op, buffer, count); if (copy_from_user(s_blink_op, buffer, count))
return -EFAULT;
s_blink_op[count] = '\0'; s_blink_op[count] = '\0';
i_blink_op = simple_strtoul(s_blink_op, &res, 0); i_blink_op = simple_strtoul(s_blink_op, &res, 0);
if (res == s_blink_op) { if (res == s_blink_op) {
......
...@@ -828,8 +828,10 @@ static int __init eepro_probe1(struct net_device *dev, short ioaddr) ...@@ -828,8 +828,10 @@ static int __init eepro_probe1(struct net_device *dev, short ioaddr)
} }
/* Grab the region so we can find another board if autoIRQ fails. */ /* Grab the region so we can find another board if autoIRQ fails. */
request_region(ioaddr, EEPRO_IO_EXTENT, dev->name); if (!request_region(ioaddr, EEPRO_IO_EXTENT, dev->name)) {
printk(KERN_WARNING "EEPRO: io-port 0x%04x in use \n", ioaddr);
goto freeall;
}
((struct eepro_local *)dev->priv)->lock = SPIN_LOCK_UNLOCKED; ((struct eepro_local *)dev->priv)->lock = SPIN_LOCK_UNLOCKED;
dev->open = eepro_open; dev->open = eepro_open;
......
...@@ -436,10 +436,26 @@ static int eexp_open(struct net_device *dev) ...@@ -436,10 +436,26 @@ static int eexp_open(struct net_device *dev)
ret = request_irq(dev->irq,&eexp_irq,0,dev->name,dev); ret = request_irq(dev->irq,&eexp_irq,0,dev->name,dev);
if (ret) return ret; if (ret) return ret;
request_region(ioaddr, EEXP_IO_EXTENT, "EtherExpress"); if (!request_region(ioaddr, EEXP_IO_EXTENT, "EtherExpress")) {
request_region(ioaddr+0x4000, 16, "EtherExpress shadow"); printk(KERN_WARNING "EtherExpress io port %x, is busy.\n"
request_region(ioaddr+0x8000, 16, "EtherExpress shadow"); , ioaddr);
request_region(ioaddr+0xc000, 16, "EtherExpress shadow"); goto err_out1;
}
if (!request_region(ioaddr+0x4000, EEXP_IO_EXTENT, "EtherExpress shadow")) {
printk(KERN_WARNING "EtherExpress io port %x, is busy.\n"
, ioaddr+0x4000);
goto err_out2;
}
if (!request_region(ioaddr+0x8000, EEXP_IO_EXTENT, "EtherExpress shadow")) {
printk(KERN_WARNING "EtherExpress io port %x, is busy.\n"
, ioaddr+0x8000);
goto err_out3;
}
if (!request_region(ioaddr+0xc000, EEXP_IO_EXTENT, "EtherExpress shadow")) {
printk(KERN_WARNING "EtherExpress io port %x, is busy.\n"
, ioaddr+0xc000);
goto err_out4;
}
if (lp->width) { if (lp->width) {
printk("%s: forcing ASIC to 8-bit mode\n", dev->name); printk("%s: forcing ASIC to 8-bit mode\n", dev->name);
...@@ -452,6 +468,16 @@ static int eexp_open(struct net_device *dev) ...@@ -452,6 +468,16 @@ static int eexp_open(struct net_device *dev)
printk(KERN_DEBUG "%s: leaving eexp_open()\n", dev->name); printk(KERN_DEBUG "%s: leaving eexp_open()\n", dev->name);
#endif #endif
return 0; return 0;
err_out4:
release_region(ioaddr+0x8000, EEXP_IO_EXTENT);
err_out3:
release_region(ioaddr+0x4000, EEXP_IO_EXTENT);
err_out2:
release_region(ioaddr, EEXP_IO_EXTENT);
err_out1:
free_irq(dev->irq, dev);
return -EBUSY;
} }
/* /*
......
...@@ -841,6 +841,7 @@ static int yam_open(struct net_device *dev) ...@@ -841,6 +841,7 @@ static int yam_open(struct net_device *dev)
struct yam_port *yp = (struct yam_port *) dev->priv; struct yam_port *yp = (struct yam_port *) dev->priv;
enum uart u; enum uart u;
int i; int i;
int ret=0;
printk(KERN_INFO "Trying %s at iobase 0x%lx irq %u\n", dev->name, dev->base_addr, dev->irq); printk(KERN_INFO "Trying %s at iobase 0x%lx irq %u\n", dev->name, dev->base_addr, dev->irq);
...@@ -850,24 +851,27 @@ static int yam_open(struct net_device *dev) ...@@ -850,24 +851,27 @@ static int yam_open(struct net_device *dev)
dev->irq < 2 || dev->irq > 15) { dev->irq < 2 || dev->irq > 15) {
return -ENXIO; return -ENXIO;
} }
if (check_region(dev->base_addr, YAM_EXTENT)) { if (!request_region(dev->base_addr, YAM_EXTENT, dev->name))
{
printk(KERN_ERR "%s: cannot 0x%lx busy\n", dev->name, dev->base_addr); printk(KERN_ERR "%s: cannot 0x%lx busy\n", dev->name, dev->base_addr);
return -EACCES; return -EACCES;
} }
if ((u = yam_check_uart(dev->base_addr)) == c_uart_unknown) { if ((u = yam_check_uart(dev->base_addr)) == c_uart_unknown) {
printk(KERN_ERR "%s: cannot find uart type\n", dev->name); printk(KERN_ERR "%s: cannot find uart type\n", dev->name);
return -EIO; ret = -EIO;
goto out_release_base;
} }
if (fpga_download(dev->base_addr, yp->bitrate)) { if (fpga_download(dev->base_addr, yp->bitrate)) {
printk(KERN_ERR "%s: cannot init FPGA\n", dev->name); printk(KERN_ERR "%s: cannot init FPGA\n", dev->name);
return -EIO; ret = -EIO;
goto out_release_base;
} }
outb(0, IER(dev->base_addr)); outb(0, IER(dev->base_addr));
if (request_irq(dev->irq, yam_interrupt, SA_INTERRUPT | SA_SHIRQ, dev->name, dev)) { if (request_irq(dev->irq, yam_interrupt, SA_INTERRUPT | SA_SHIRQ, dev->name, dev)) {
printk(KERN_ERR "%s: irq %d busy\n", dev->name, dev->irq); printk(KERN_ERR "%s: irq %d busy\n", dev->name, dev->irq);
return -EBUSY; ret = -EBUSY;
goto out_release_base;
} }
request_region(dev->base_addr, YAM_EXTENT, dev->name);
yam_set_uart(dev); yam_set_uart(dev);
...@@ -884,6 +888,10 @@ static int yam_open(struct net_device *dev) ...@@ -884,6 +888,10 @@ static int yam_open(struct net_device *dev)
printk(KERN_INFO "%s at iobase 0x%lx irq %u uart %s\n", dev->name, dev->base_addr, dev->irq, printk(KERN_INFO "%s at iobase 0x%lx irq %u uart %s\n", dev->name, dev->base_addr, dev->irq,
uart_str[u]); uart_str[u]);
return 0; return 0;
out_release_base:
release_region(dev->base_addr, YAM_EXTENT);
return ret;
} }
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
......
...@@ -353,18 +353,21 @@ static int __init ni65_probe1(struct net_device *dev,int ioaddr) ...@@ -353,18 +353,21 @@ static int __init ni65_probe1(struct net_device *dev,int ioaddr)
unsigned long flags; unsigned long flags;
for(i=0;i<NUM_CARDS;i++) { for(i=0;i<NUM_CARDS;i++) {
if(check_region(ioaddr, cards[i].total_size)) if(!request_region(ioaddr, cards[i].total_size, cards[i].cardname))
continue; continue;
if(cards[i].id_offset >= 0) { if(cards[i].id_offset >= 0) {
if(inb(ioaddr+cards[i].id_offset+0) != cards[i].id0 || if(inb(ioaddr+cards[i].id_offset+0) != cards[i].id0 ||
inb(ioaddr+cards[i].id_offset+1) != cards[i].id1) { inb(ioaddr+cards[i].id_offset+1) != cards[i].id1) {
release_region(ioaddr, cards[i].total_size);
continue; continue;
} }
} }
if(cards[i].vendor_id) { if(cards[i].vendor_id) {
for(j=0;j<3;j++) for(j=0;j<3;j++)
if(inb(ioaddr+cards[i].addr_offset+j) != cards[i].vendor_id[j]) if(inb(ioaddr+cards[i].addr_offset+j) != cards[i].vendor_id[j]) {
release_region(ioaddr, cards[i].total_size);
continue; continue;
}
} }
break; break;
} }
...@@ -374,8 +377,10 @@ static int __init ni65_probe1(struct net_device *dev,int ioaddr) ...@@ -374,8 +377,10 @@ static int __init ni65_probe1(struct net_device *dev,int ioaddr)
for(j=0;j<6;j++) for(j=0;j<6;j++)
dev->dev_addr[j] = inb(ioaddr+cards[i].addr_offset+j); dev->dev_addr[j] = inb(ioaddr+cards[i].addr_offset+j);
if( (j=ni65_alloc_buffer(dev)) < 0) if( (j=ni65_alloc_buffer(dev)) < 0) {
release_region(ioaddr, cards[i].total_size);
return j; return j;
}
p = (struct priv *) dev->priv; p = (struct priv *) dev->priv;
p->cmdr_addr = ioaddr + cards[i].cmd_offset; p->cmdr_addr = ioaddr + cards[i].cmd_offset;
p->cardno = i; p->cardno = i;
...@@ -386,6 +391,7 @@ static int __init ni65_probe1(struct net_device *dev,int ioaddr) ...@@ -386,6 +391,7 @@ static int __init ni65_probe1(struct net_device *dev,int ioaddr)
if( (j=readreg(CSR0)) != 0x4) { if( (j=readreg(CSR0)) != 0x4) {
printk(KERN_ERR "can't RESET card: %04x\n",j); printk(KERN_ERR "can't RESET card: %04x\n",j);
ni65_free_buffer(p); ni65_free_buffer(p);
release_region(ioaddr, cards[p->cardno].total_size);
return -EAGAIN; return -EAGAIN;
} }
...@@ -437,6 +443,7 @@ static int __init ni65_probe1(struct net_device *dev,int ioaddr) ...@@ -437,6 +443,7 @@ static int __init ni65_probe1(struct net_device *dev,int ioaddr)
if(i == 5) { if(i == 5) {
printk("Can't detect DMA channel!\n"); printk("Can't detect DMA channel!\n");
ni65_free_buffer(p); ni65_free_buffer(p);
release_region(ioaddr, cards[p->cardno].total_size);
return -EAGAIN; return -EAGAIN;
} }
dev->dma = dmatab[i]; dev->dma = dmatab[i];
...@@ -459,6 +466,7 @@ static int __init ni65_probe1(struct net_device *dev,int ioaddr) ...@@ -459,6 +466,7 @@ static int __init ni65_probe1(struct net_device *dev,int ioaddr)
{ {
printk("Failed to detect IRQ line!\n"); printk("Failed to detect IRQ line!\n");
ni65_free_buffer(p); ni65_free_buffer(p);
release_region(ioaddr, cards[p->cardno].total_size);
return -EAGAIN; return -EAGAIN;
} }
printk("IRQ %d (autodetected).\n",dev->irq); printk("IRQ %d (autodetected).\n",dev->irq);
...@@ -471,14 +479,10 @@ static int __init ni65_probe1(struct net_device *dev,int ioaddr) ...@@ -471,14 +479,10 @@ static int __init ni65_probe1(struct net_device *dev,int ioaddr)
{ {
printk("%s: Can't request dma-channel %d\n",dev->name,(int) dev->dma); printk("%s: Can't request dma-channel %d\n",dev->name,(int) dev->dma);
ni65_free_buffer(p); ni65_free_buffer(p);
release_region(ioaddr, cards[p->cardno].total_size);
return -EAGAIN; return -EAGAIN;
} }
/*
* Grab the region so we can find another board.
*/
request_region(ioaddr,cards[p->cardno].total_size,cards[p->cardno].cardname);
dev->base_addr = ioaddr; dev->base_addr = ioaddr;
dev->open = ni65_open; dev->open = ni65_open;
......
...@@ -1316,9 +1316,12 @@ static int ray_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -1316,9 +1316,12 @@ static int ray_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
err = -E2BIG; err = -E2BIG;
break; break;
} }
copy_from_user(card_essid, if (copy_from_user(card_essid,
wrq->u.data.pointer, wrq->u.data.pointer,
wrq->u.data.length); wrq->u.data.length)) {
err = -EFAULT;
break;
}
card_essid[IW_ESSID_MAX_SIZE] = '\0'; card_essid[IW_ESSID_MAX_SIZE] = '\0';
/* Set the ESSID in the card */ /* Set the ESSID in the card */
......
...@@ -466,16 +466,16 @@ static int COMX_open(struct net_device *dev) ...@@ -466,16 +466,16 @@ static int COMX_open(struct net_device *dev)
} }
if (!twin_open) { if (!twin_open) {
if (check_region(dev->base_addr, hw->io_extent)) { if (!request_region(dev->base_addr, hw->io_extent, dev->name)) {
return -EAGAIN; return -EAGAIN;
} }
if (request_irq(dev->irq, COMX_interrupt, 0, dev->name, if (request_irq(dev->irq, COMX_interrupt, 0, dev->name,
(void *)dev)) { (void *)dev)) {
printk(KERN_ERR "comx-hw-comx: unable to obtain irq %d\n", dev->irq); printk(KERN_ERR "comx-hw-comx: unable to obtain irq %d\n", dev->irq);
release_region(dev->base_addr, hw->io_extent);
return -EAGAIN; return -EAGAIN;
} }
ch->init_status |= IRQ_ALLOCATED; ch->init_status |= IRQ_ALLOCATED;
request_region(dev->base_addr, hw->io_extent, dev->name);
if (!ch->HW_load_board || ch->HW_load_board(dev)) { if (!ch->HW_load_board || ch->HW_load_board(dev)) {
ch->init_status &= ~IRQ_ALLOCATED; ch->init_status &= ~IRQ_ALLOCATED;
retval=-ENODEV; retval=-ENODEV;
......
...@@ -604,7 +604,13 @@ static int setup (wan_device_t* wandev, wandev_conf_t* conf) ...@@ -604,7 +604,13 @@ static int setup (wan_device_t* wandev, wandev_conf_t* conf)
/* Reserve I/O region and schedule background task */ /* Reserve I/O region and schedule background task */
if(card->hw.type != SDLA_S514 && !card->wandev.piggyback) if(card->hw.type != SDLA_S514 && !card->wandev.piggyback)
request_region(card->hw.port, card->hw.io_range, wandev->name); if (!request_region(card->hw.port, card->hw.io_range,
wandev->name)) {
printk(KERN_WARNING "port 0x%04x busy\n", card->hw.port);
release_hw(card);
wandev->state = WAN_UNCONFIGURED;
return -EBUSY;
}
/* Only use the polling routine for the X25 protocol */ /* Only use the polling routine for the X25 protocol */
......
...@@ -2039,6 +2039,7 @@ ...@@ -2039,6 +2039,7 @@
8e2e 7000 KF-230TX 8e2e 7000 KF-230TX
8e2e 7100 KF-230TX/2 8e2e 7100 KF-230TX/2
a0a0 0007 ALN-325C a0a0 0007 ALN-325C
8169 RTL-8169
10ed Ascii Corporation 10ed Ascii Corporation
7310 V7310 7310 V7310
10ee Xilinx, Inc. 10ee Xilinx, Inc.
......
...@@ -912,6 +912,7 @@ ...@@ -912,6 +912,7 @@
#define PCI_DEVICE_ID_REALTEK_8029 0x8029 #define PCI_DEVICE_ID_REALTEK_8029 0x8029
#define PCI_DEVICE_ID_REALTEK_8129 0x8129 #define PCI_DEVICE_ID_REALTEK_8129 0x8129
#define PCI_DEVICE_ID_REALTEK_8139 0x8139 #define PCI_DEVICE_ID_REALTEK_8139 0x8139
#define PCI_DEVICE_ID_REALTEK_8169 0x8169
#define PCI_VENDOR_ID_XILINX 0x10ee #define PCI_VENDOR_ID_XILINX 0x10ee
#define PCI_DEVICE_ID_TURBOPAM 0x4020 #define PCI_DEVICE_ID_TURBOPAM 0x4020
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment