[parisc-linux-cvs] Re: DIFF 2.4.19-pa2 update 0.92 acenic.c
Grant Grundler
grundler@dsl2.external.hp.com
Mon, 05 Aug 2002 14:11:30 -0600
Grant Grundler wrote:
> latest patch from Jes Sorensen. Same code builds on 2.5.30 now.
> Still not using pci_enable_device() but his hacks work on a500.
Index: drivers/net/acenic.c
===================================================================
RCS file: /var/cvs/linux/drivers/net/acenic.c,v
retrieving revision 1.16
diff -u -p -r1.16 acenic.c
--- drivers/net/acenic.c 4 Aug 2002 22:58:28 -0000 1.16
+++ drivers/net/acenic.c 5 Aug 2002 19:55:11 -0000
@@ -121,11 +121,9 @@
#ifndef PCI_DEVICE_ID_FARALLON_PN9000SX
#define PCI_DEVICE_ID_FARALLON_PN9000SX 0x1a
#endif
-
#ifndef PCI_DEVICE_ID_FARALLON_PN9100T
#define PCI_DEVICE_ID_FARALLON_PN9100T 0xfa
#endif
-
#ifndef PCI_VENDOR_ID_SGI
#define PCI_VENDOR_ID_SGI 0x10a9
#endif
@@ -197,6 +195,12 @@ MODULE_DEVICE_TABLE(pci, acenic_pci_tbl)
#define ace_sync_irq(irq) synchronize_irq()
#endif
+#if LINUX_VERSION_CODE < 0x2051e
+#define local_irq_save(flags) do{__save_flags(flags) ; \
+ __cli();} while(0)
+#define local_irq_restore(flags) __restore_flags(flags)
+#endif
+
#if (LINUX_VERSION_CODE < 0x02030d)
#define pci_resource_start(dev, bar) dev->base_address[bar]
#elif (LINUX_VERSION_CODE < 0x02032c)
@@ -207,6 +211,7 @@ MODULE_DEVICE_TABLE(pci, acenic_pci_tbl)
#define net_device device
#endif
+
#if (LINUX_VERSION_CODE < 0x02032a)
typedef u32 dma_addr_t;
@@ -230,10 +235,6 @@ static inline void *pci_alloc_consistent
(((u64)(mask) & 0xffffffff00000000) == 0 ? 0 : -EIO)
#define pci_dma_supported(dev, mask) \
(((u64)(mask) & 0xffffffff00000000) == 0 ? 1 : 0)
-#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
-#define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
-#define pci_unmap_addr(PTR, ADDR_NAME) 0
-#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do{} while(0)
#elif (LINUX_VERSION_CODE < 0x02040d)
@@ -257,12 +258,18 @@ pci_map_page(struct pci_dev *cookie, str
}
#define pci_unmap_page(cookie, dma_addr, size, dir) \
pci_unmap_single(cookie, dma_addr, size, dir)
+#endif
+
+#if (LINUX_VERSION_CODE < 0x020412)
#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
#define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
-#define pci_unmap_addr(ptr, addr_name) ((ptr)->addr_name)
-#define pci_unmap_addr_set(ptr, addr_name, val) (((ptr)->addr_name) = (val))
+#define pci_unmap_addr(PTR, ADDR_NAME) 0
+#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do{} while(0)
+#define pci_unmap_len(PTR, LEN_NAME) 0
+#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do{} while(0)
#endif
+
#if (LINUX_VERSION_CODE < 0x02032b)
/*
* SoftNet
@@ -586,7 +593,7 @@ static int tx_ratio[ACE_MAX_MOD_PARMS];
static int dis_pci_mem_inval[ACE_MAX_MOD_PARMS] = {1, 1, 1, 1, 1, 1, 1, 1};
static char version[] __initdata =
- "acenic.c: v0.91 07/31/2002 Jes Sorensen, linux-acenic@SunSITE.dk\n"
+ "acenic.c: v0.92 08/05/2002 Jes Sorensen, linux-acenic@SunSITE.dk\n"
" http://home.cern.ch/~jes/gige/acenic.html\n";
static struct net_device *root_dev;
@@ -733,11 +740,12 @@ int __devinit acenic_probe (ACE_PROBE_AR
"Gigabit Ethernet", sizeof (ap->name));
printk(KERN_INFO "%s: Farallon PN9100-T ",
dev->name);
- break;
+ } else {
+ strncpy(ap->name, "AceNIC Gigabit Ethernet",
+ sizeof (ap->name));
+ printk(KERN_INFO "%s: Alteon AceNIC ",
+ dev->name);
}
- strncpy(ap->name, "AceNIC Gigabit Ethernet",
- sizeof (ap->name));
- printk(KERN_INFO "%s: Alteon AceNIC ", dev->name);
break;
case PCI_VENDOR_ID_3COM:
strncpy(ap->name, "3Com 3C985 Gigabit Ethernet",
@@ -884,7 +892,7 @@ static void __exit ace_module_cleanup(vo
* Then release the RX buffers - jumbo buffers were
* already released in ace_close().
*/
- ace_sync_irq(root_dev);
+ ace_sync_irq(root_dev->irq);
for (i = 0; i < RX_STD_RING_ENTRIES; i++) {
struct sk_buff *skb = ap->skb->rx_std_skbuff[i].skb;
@@ -1574,6 +1582,7 @@ static int __init ace_init(struct net_de
sizeof(struct tx_desc) / 4); i++) {
writel(0, (unsigned long)ap->tx_ring + i * 4);
}
+
set_aceaddr(&info->tx_ctrl.rngptr, TX_RING_BASE);
} else {
memset(ap->tx_ring, 0,
@@ -1590,7 +1599,6 @@ static int __init ace_init(struct net_de
*/
if (!ACE_IS_TIGON_I(ap))
tmp |= RCB_FLG_TX_HOST_RING;
-
#if TX_COAL_INTS_ONLY
tmp |= RCB_FLG_COAL_INT_ONLY;
#endif
@@ -2540,21 +2548,19 @@ static void ace_interrupt(int irq, void
}
-<<<<<<< acenic.c
#if ACENIC_DO_VLAN
static void ace_vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
{
struct ace_private *ap = dev->priv;
unsigned long flags;
- __save_flags(flags);
- __cli();
+ local_irq_save(flags);
ace_mask_irq(dev);
ap->vlgrp = grp;
ace_unmask_irq(dev);
- __restore_flags(flags);
+ local_irq_restore(flags);
}
@@ -2563,15 +2569,14 @@ static void ace_vlan_rx_kill_vid(struct
struct ace_private *ap = dev->priv;
unsigned long flags;
- __save_flags(flags);
- __cli();
+ local_irq_save(flags);
ace_mask_irq(dev);
if (ap->vlgrp)
ap->vlgrp->vlan_devices[vid] = NULL;
ace_unmask_irq(dev);
- __restore_flags(flags);
+ local_irq_restore(flags);
}
#endif /* ACENIC_DO_VLAN */
@@ -2676,8 +2681,7 @@ static int ace_close(struct net_device *
* buffers are being released by another.
*/
- __save_flags(flags);
- __cli();
+ local_irq_save(flags);
ace_mask_irq(dev);
for (i = 0; i < ACE_TX_RING_ENTRIES(ap); i++) {
@@ -2716,7 +2720,7 @@ static int ace_close(struct net_device *
}
ace_unmask_irq(dev);
- __restore_flags(flags);
+ local_irq_restore(flags);
ACE_MOD_DEC_USE_COUNT;
return 0;
@@ -3084,7 +3088,6 @@ static int ace_ioctl(struct net_device *
return -EFAULT;
return 0;
}
-
default:
break;
}
@@ -3464,14 +3467,13 @@ static int __init read_eeprom_byte(struc
* Don't take interrupts on this CPU will bit banging
* the %#%#@$ I2C device
*/
- __save_flags(flags);
- __cli();
+ local_irq_save(flags);
eeprom_start(regs);
eeprom_prep(regs, EEPROM_WRITE_SELECT);
if (eeprom_check_ack(regs)) {
- __restore_flags(flags);
+ local_irq_restore(flags);
printk(KERN_ERR "%s: Unable to sync eeprom\n", dev->name);
result = -EIO;
goto eeprom_read_error;
@@ -3479,7 +3481,7 @@ static int __init read_eeprom_byte(struc
eeprom_prep(regs, (offset >> 8) & 0xff);
if (eeprom_check_ack(regs)) {
- __restore_flags(flags);
+ local_irq_restore(flags);
printk(KERN_ERR "%s: Unable to set address byte 0\n",
dev->name);
result = -EIO;
@@ -3488,7 +3490,7 @@ static int __init read_eeprom_byte(struc
eeprom_prep(regs, offset & 0xff);
if (eeprom_check_ack(regs)) {
- __restore_flags(flags);
+ local_irq_restore(flags);
printk(KERN_ERR "%s: Unable to set address byte 1\n",
dev->name);
result = -EIO;
@@ -3498,7 +3500,7 @@ static int __init read_eeprom_byte(struc
eeprom_start(regs);
eeprom_prep(regs, EEPROM_READ_SELECT);
if (eeprom_check_ack(regs)) {
- __restore_flags(flags);
+ local_irq_restore(flags);
printk(KERN_ERR "%s: Unable to set READ_SELECT\n",
dev->name);
result = -EIO;
@@ -3551,7 +3553,7 @@ static int __init read_eeprom_byte(struc
udelay(ACE_SHORT_DELAY);
eeprom_stop(regs);
- __restore_flags(flags);
+ local_irq_restore(flags);
out:
return result;