diff options
Diffstat (limited to 'drivers/net/hp100.c')
-rw-r--r-- | drivers/net/hp100.c | 154 |
1 files changed, 77 insertions, 77 deletions
diff --git a/drivers/net/hp100.c b/drivers/net/hp100.c index ff5a67d..03b3df3 100644 --- a/drivers/net/hp100.c +++ b/drivers/net/hp100.c @@ -1,24 +1,24 @@ /* -** hp100.c +** hp100.c ** HP CASCADE Architecture Driver for 100VG-AnyLan Network Adapters ** ** $Id: hp100.c,v 1.58 2001/09/24 18:03:01 perex Exp perex $ ** ** Based on the HP100 driver written by Jaroslav Kysela <perex@jcu.cz> -** Extended for new busmaster capable chipsets by +** Extended for new busmaster capable chipsets by ** Siegfried "Frieder" Loeffler (dg1sek) <floeff@mathematik.uni-stuttgart.de> ** ** Maintained by: Jaroslav Kysela <perex@suse.cz> -** +** ** This driver has only been tested with ** -- HP J2585B 10/100 Mbit/s PCI Busmaster -** -- HP J2585A 10/100 Mbit/s PCI +** -- HP J2585A 10/100 Mbit/s PCI ** -- HP J2970A 10 Mbit/s PCI Combo 10base-T/BNC ** -- HP J2973A 10 Mbit/s PCI 10base-T ** -- HP J2573 10/100 ISA ** -- Compex ReadyLink ENET100-VG4 10/100 Mbit/s PCI / EISA ** -- Compex FreedomLine 100/VG 10/100 Mbit/s ISA / EISA / PCI -** +** ** but it should also work with the other CASCADE based adapters. ** ** TODO: @@ -65,7 +65,7 @@ ** - timing changes in xmit routines, relogin to 100VG hub added when ** driver does reset ** - included fix for Compex FreedomLine PCI adapter -** +** ** 1.54 -> 1.55 ** - fixed bad initialization in init_module ** - added Compex FreedomLine adapter @@ -73,10 +73,10 @@ ** ** 1.53 -> 1.54 ** - added hardware multicast filter support (doesn't work) -** - little changes in hp100_sense_lan routine +** - little changes in hp100_sense_lan routine ** - added support for Coax and AUI (J2970) ** - fix for multiple cards and hp100_mode parameter (insmod) -** - fix for shared IRQ +** - fix for shared IRQ ** ** 1.52 -> 1.53 ** - fixed bug in multicast support @@ -286,7 +286,7 @@ static inline dma_addr_t virt_to_whatever(struct net_device *dev, u32 * ptr) static inline u_int pdl_map_data(struct hp100_private *lp, void *data) { - return pci_map_single(lp->pci_dev, data, + return pci_map_single(lp->pci_dev, data, MAX_ETHER_SIZE, PCI_DMA_FROMDEVICE); } @@ -353,7 +353,7 @@ static __init int hp100_isa_probe1(struct net_device *dev, int ioaddr) goto err; for (i = 0; i < ARRAY_SIZE(hp100_isa_tbl); i++) { - if (!strcmp(hp100_isa_tbl[i], sig)) + if (!strcmp(hp100_isa_tbl[i], sig)) break; } @@ -373,11 +373,11 @@ static int __init hp100_isa_probe(struct net_device *dev, int addr) { int err = -ENODEV; - /* Probe for a specific ISA address */ + /* Probe for a specific ISA address */ if (addr > 0xff && addr < 0x400) err = hp100_isa_probe1(dev, addr); - else if (addr != 0) + else if (addr != 0) err = -ENXIO; else { @@ -448,7 +448,7 @@ static int __devinit hp100_probe1(struct net_device *dev, int ioaddr, if (!request_region(ioaddr, HP100_REGION_SIZE, "hp100")) goto out1; - if (hp100_inw(HW_ID) != HP100_HW_ID_CASCADE) + if (hp100_inw(HW_ID) != HP100_HW_ID_CASCADE) goto out2; chip = hp100_inw(PAGING) & HP100_CHIPID_MASK; @@ -491,7 +491,7 @@ static int __devinit hp100_probe1(struct net_device *dev, int ioaddr, * Use the variable "hp100_mode" upon insmod or as kernel parameter to * force driver modes: * hp100_mode=1 -> default, use busmaster mode if configured. - * hp100_mode=2 -> enable shared memory mode + * hp100_mode=2 -> enable shared memory mode * hp100_mode=3 -> force use of i/o mapped mode. * hp100_mode=4 -> same as 1, but re-set the enable bit on the card. */ @@ -689,9 +689,9 @@ static int __devinit hp100_probe1(struct net_device *dev, int ioaddr, hp100_clear_stats(lp, ioaddr); /* If busmaster mode is wanted, a dma-capable memory area is needed for - * the rx and tx PDLs + * the rx and tx PDLs * PCI cards can access the whole PC memory. Therefore GFP_DMA is not - * needed for the allocation of the memory area. + * needed for the allocation of the memory area. */ /* TODO: We do not need this with old cards, where PDLs are stored @@ -718,7 +718,7 @@ static int __devinit hp100_probe1(struct net_device *dev, int ioaddr, } /* Initialise the card. */ - /* (I'm not really sure if it's a good idea to do this during probing, but + /* (I'm not really sure if it's a good idea to do this during probing, but * like this it's assured that the lan connection type can be sensed * correctly) */ @@ -778,8 +778,8 @@ static int __devinit hp100_probe1(struct net_device *dev, int ioaddr, return 0; out3: if (local_mode == 1) - pci_free_consistent(lp->pci_dev, MAX_RINGSIZE + 0x0f, - lp->page_vaddr_algn, + pci_free_consistent(lp->pci_dev, MAX_RINGSIZE + 0x0f, + lp->page_vaddr_algn, virt_to_whatever(dev, lp->page_vaddr_algn)); if (mem_ptr_virt) iounmap(mem_ptr_virt); @@ -860,7 +860,7 @@ static void hp100_hwinit(struct net_device *dev) /* Next comes code from mmuinit procedure of SCO BM driver which is * called from HWconfigure in the SCO driver. */ - /* Initialise MMU, eventually switch on Busmaster Mode, initialise + /* Initialise MMU, eventually switch on Busmaster Mode, initialise * multicast filter... */ hp100_mmuinit(dev); @@ -878,11 +878,11 @@ static void hp100_hwinit(struct net_device *dev) hp100_login_to_vg_hub(dev, 0); /* relogin */ } - -/* + +/* * mmuinit - Reinitialise Cascade MMU and MAC settings. - * Note: Must already be in reset and leaves card in reset. + * Note: Must already be in reset and leaves card in reset. */ static void hp100_mmuinit(struct net_device *dev) { @@ -908,7 +908,7 @@ static void hp100_mmuinit(struct net_device *dev) hp100_outw(0xffff, IRQ_STATUS); /* ack IRQ */ /* - * Enable Hardware + * Enable Hardware * - Clear Debug En, Rx Hdr Pipe, EE En, I/O En, Fake Int and Intr En * - Set Tri-State Int, Bus Master Rd/Wr, and Mem Map Disable * - Clear Priority, Advance Pkt and Xmit Cmd @@ -983,7 +983,7 @@ static void hp100_mmuinit(struct net_device *dev) * 4 bytes for header). We will leave NUM_RXPDLS * 508 (rounded * to the next higher 1k boundary) bytes for the rx-pdl's * Note: For non-etr chips the transmit stop register must be - * programmed on a 1k boundary, i.e. bits 9:0 must be zero. + * programmed on a 1k boundary, i.e. bits 9:0 must be zero. */ pdl_stop = lp->memory_size; xmit_stop = (pdl_stop - 508 * (MAX_RX_PDL) - 16) & ~(0x03ff); @@ -1131,10 +1131,10 @@ static int hp100_close(struct net_device *dev) return 0; } - + /* - * Configure the PDL Rx rings and LAN + * Configure the PDL Rx rings and LAN */ static void hp100_init_pdls(struct net_device *dev) { @@ -1182,7 +1182,7 @@ static void hp100_init_pdls(struct net_device *dev) } } } - + /* These functions "format" the entries in the pdl structure */ /* They return how much memory the fragments need. */ @@ -1200,10 +1200,10 @@ static int hp100_init_rxpdl(struct net_device *dev, ringptr->pdl_paddr = virt_to_whatever(dev, pdlptr + 1); ringptr->skb = (void *) NULL; - /* + /* * Write address and length of first PDL Fragment (which is used for * storing the RX-Header - * We use the 4 bytes _before_ the PDH in the pdl memory area to + * We use the 4 bytes _before_ the PDH in the pdl memory area to * store this information. (PDH is at offset 0x04) */ /* Note that pdlptr+1 and not pdlptr is the pointer to the PDH */ @@ -1230,9 +1230,9 @@ static int hp100_init_txpdl(struct net_device *dev, } /* - * hp100_build_rx_pdl allocates an skb_buff of maximum size plus two bytes + * hp100_build_rx_pdl allocates an skb_buff of maximum size plus two bytes * for possible odd word alignment rounding up to next dword and set PDL - * address for fragment#2 + * address for fragment#2 * Returns: 0 if unable to allocate skb_buff * 1 if successful */ @@ -1252,13 +1252,13 @@ static int hp100_build_rx_pdl(hp100_ring_t * ringptr, #endif /* Allocate skb buffer of maximum size */ - /* Note: This depends on the alloc_skb functions allocating more + /* Note: This depends on the alloc_skb functions allocating more * space than requested, i.e. aligning to 16bytes */ ringptr->skb = dev_alloc_skb(((MAX_ETHER_SIZE + 2 + 3) / 4) * 4); if (NULL != ringptr->skb) { - /* + /* * Reserve 2 bytes at the head of the buffer to land the IP header * on a long word boundary (According to the Network Driver section * in the Linux KHG, this should help to increase performance.) @@ -1270,10 +1270,10 @@ static int hp100_build_rx_pdl(hp100_ring_t * ringptr, /* ringptr->pdl points to the beginning of the PDL, i.e. the PDH */ /* Note: 1st Fragment is used for the 4 byte packet status - * (receive header). Its PDL entries are set up by init_rxpdl. So + * (receive header). Its PDL entries are set up by init_rxpdl. So * here we only have to set up the PDL fragment entries for the data - * part. Those 4 bytes will be stored in the DMA memory region - * directly before the PDL. + * part. Those 4 bytes will be stored in the DMA memory region + * directly before the PDL. */ #ifdef HP100_DEBUG_BM printk("hp100: %s: build_rx_pdl: PDH@0x%x, skb->data (len %d) at 0x%x\n", @@ -1285,7 +1285,7 @@ static int hp100_build_rx_pdl(hp100_ring_t * ringptr, /* Conversion to new PCI API : map skbuf data to PCI bus. * Doc says it's OK for EISA as well - Jean II */ ringptr->pdl[0] = 0x00020000; /* Write PDH */ - ringptr->pdl[3] = pdl_map_data(netdev_priv(dev), + ringptr->pdl[3] = pdl_map_data(netdev_priv(dev), ringptr->skb->data); ringptr->pdl[4] = MAX_ETHER_SIZE; /* Length of Data */ @@ -1406,7 +1406,7 @@ static void hp100_BM_shutdown(struct net_device *dev) } } else { /* Shasta or Rainier Shutdown/Reset */ /* To ensure all bus master inloading activity has ceased, - * wait for no Rx PDAs or no Rx packets on card. + * wait for no Rx PDAs or no Rx packets on card. */ hp100_page(PERFORMANCE); /* 100 ms timeout */ @@ -1422,7 +1422,7 @@ static void hp100_BM_shutdown(struct net_device *dev) /* To ensure all bus master outloading activity has ceased, * wait until the Tx PDA count goes to zero or no more Tx space - * available in the Tx region of the card. + * available in the Tx region of the card. */ /* 100 ms timeout */ for (time = 0; time < 10000; time++) { @@ -1461,7 +1461,7 @@ static int hp100_check_lan(struct net_device *dev) return 0; } -/* +/* * transmit functions */ @@ -1485,7 +1485,7 @@ static int hp100_start_xmit_bm(struct sk_buff *skb, struct net_device *dev) if (skb->len <= 0) return 0; - + if (lp->chip == HP100_CHIPID_SHASTA && skb_padto(skb, ETH_ZLEN)) return 0; @@ -1575,14 +1575,14 @@ static int hp100_start_xmit_bm(struct sk_buff *skb, struct net_device *dev) return 0; } - + /* clean_txring checks if packets have been sent by the card by reading * the TX_PDL register from the performance page and comparing it to the * number of commited packets. It then frees the skb's of the packets that * obviously have been sent to the network. * - * Needs the PERFORMANCE page selected. + * Needs the PERFORMANCE page selected. */ static void hp100_clean_txring(struct net_device *dev) { @@ -1743,15 +1743,15 @@ static int hp100_start_xmit(struct sk_buff *skb, struct net_device *dev) return 0; } - + /* * Receive Function (Non-Busmaster mode) - * Called when an "Receive Packet" interrupt occurs, i.e. the receive + * Called when an "Receive Packet" interrupt occurs, i.e. the receive * packet counter is non-zero. * For non-busmaster, this function does the whole work of transfering * the packet to the host memory and then up to higher layers via skb - * and netif_rx. + * and netif_rx. */ static void hp100_rx(struct net_device *dev) @@ -1854,7 +1854,7 @@ static void hp100_rx(struct net_device *dev) #endif } -/* +/* * Receive Function for Busmaster Mode */ static void hp100_rx_bm(struct net_device *dev) @@ -1875,7 +1875,7 @@ static void hp100_rx_bm(struct net_device *dev) printk("hp100: %s: rx_bm called although no PDLs were committed to adapter?\n", dev->name); return; } else - /* RX_PKT_CNT states how many PDLs are currently formatted and available to + /* RX_PKT_CNT states how many PDLs are currently formatted and available to * the cards BM engine */ if ((hp100_inw(RX_PKT_CNT) & 0x00ff) >= lp->rxrcommit) { printk("hp100: %s: More packets received than commited? RX_PKT_CNT=0x%x, commit=0x%x\n", @@ -1888,7 +1888,7 @@ static void hp100_rx_bm(struct net_device *dev) while ((lp->rxrcommit > hp100_inb(RX_PDL))) { /* * The packet was received into the pdl pointed to by lp->rxrhead ( - * the oldest pdl in the ring + * the oldest pdl in the ring */ /* First we get the header, which contains information about the */ @@ -2043,7 +2043,7 @@ static void hp100_clear_stats(struct hp100_private *lp, int ioaddr) hp100_page(PERFORMANCE); spin_unlock_irqrestore(&lp->lock, flags); } - + /* * multicast setup @@ -2220,9 +2220,9 @@ static irqreturn_t hp100_interrupt(int irq, void *dev_id, struct pt_regs *regs) /* We're only interested in those interrupts we really enabled. */ /* val &= hp100_inw( IRQ_MASK ); */ - /* - * RX_PDL_FILL_COMPL is set whenever a RX_PDL has been executed. A RX_PDL - * is considered executed whenever the RX_PDL data structure is no longer + /* + * RX_PDL_FILL_COMPL is set whenever a RX_PDL has been executed. A RX_PDL + * is considered executed whenever the RX_PDL data structure is no longer * needed. */ if (val & HP100_RX_PDL_FILL_COMPL) { @@ -2233,7 +2233,7 @@ static irqreturn_t hp100_interrupt(int irq, void *dev_id, struct pt_regs *regs) } } - /* + /* * The RX_PACKET interrupt is set, when the receive packet counter is * non zero. We use this interrupt for receiving in slave mode. In * busmaster mode, we use it to make sure we did not miss any rx_pdl_fill @@ -2259,10 +2259,10 @@ static irqreturn_t hp100_interrupt(int irq, void *dev_id, struct pt_regs *regs) hp100_outw(val, IRQ_STATUS); /* - * RX_ERROR is set when a packet is dropped due to no memory resources on - * the card or when a RCV_ERR occurs. - * TX_ERROR is set when a TX_ABORT condition occurs in the MAC->exists - * only in the 802.3 MAC and happens when 16 collisions occur during a TX + * RX_ERROR is set when a packet is dropped due to no memory resources on + * the card or when a RCV_ERR occurs. + * TX_ERROR is set when a TX_ABORT condition occurs in the MAC->exists + * only in the 802.3 MAC and happens when 16 collisions occur during a TX */ if (val & (HP100_TX_ERROR | HP100_RX_ERROR)) { #ifdef HP100_DEBUG_IRQ @@ -2275,20 +2275,20 @@ static irqreturn_t hp100_interrupt(int irq, void *dev_id, struct pt_regs *regs) } } - /* - * RX_PDA_ZERO is set when the PDA count goes from non-zero to zero. + /* + * RX_PDA_ZERO is set when the PDA count goes from non-zero to zero. */ if ((lp->mode == 1) && (val & (HP100_RX_PDA_ZERO))) hp100_rxfill(dev); - /* - * HP100_TX_COMPLETE interrupt occurs when packet transmitted on wire - * is completed + /* + * HP100_TX_COMPLETE interrupt occurs when packet transmitted on wire + * is completed */ if ((lp->mode == 1) && (val & (HP100_TX_COMPLETE))) hp100_clean_txring(dev); - /* + /* * MISC_ERROR is set when either the LAN link goes down or a detected * bus error occurs. */ @@ -2471,12 +2471,12 @@ static int hp100_sense_lan(struct net_device *dev) /* Those cards don't have a 100 Mbit connector */ if ( !strcmp(lp->id, "HWP1920") || - (lp->pci_dev && - lp->pci_dev->vendor == PCI_VENDOR_ID && + (lp->pci_dev && + lp->pci_dev->vendor == PCI_VENDOR_ID && (lp->pci_dev->device == PCI_DEVICE_ID_HP_J2970A || lp->pci_dev->device == PCI_DEVICE_ID_HP_J2973A))) return HP100_LAN_ERR; - + if (val_VG & HP100_LINK_CABLE_ST) /* Can hear the HUBs tone. */ return HP100_LAN_100; return HP100_LAN_ERR; @@ -2822,8 +2822,8 @@ static void cleanup_dev(struct net_device *d) release_region(d->base_addr, HP100_REGION_SIZE); if (p->mode == 1) /* busmaster */ - pci_free_consistent(p->pci_dev, MAX_RINGSIZE + 0x0f, - p->page_vaddr_algn, + pci_free_consistent(p->pci_dev, MAX_RINGSIZE + 0x0f, + p->page_vaddr_algn, virt_to_whatever(d, p->page_vaddr_algn)); if (p->mem_ptr_virt) iounmap(p->mem_ptr_virt); @@ -2849,7 +2849,7 @@ static int __init hp100_eisa_probe (struct device *gendev) goto out1; #ifdef HP100_DEBUG - printk("hp100: %s: EISA adapter found at 0x%x\n", dev->name, + printk("hp100: %s: EISA adapter found at 0x%x\n", dev->name, dev->base_addr); #endif gendev->driver_data = dev; @@ -2913,12 +2913,12 @@ static int __devinit hp100_pci_probe (struct pci_dev *pdev, pci_command |= PCI_COMMAND_MASTER; pci_write_config_word(pdev, PCI_COMMAND, pci_command); } - + ioaddr = pci_resource_start(pdev, 0); err = hp100_probe1(dev, ioaddr, HP100_BUS_PCI, pdev); - if (err) + if (err) goto out1; - + #ifdef HP100_DEBUG printk("hp100: %s: PCI adapter found at 0x%x\n", dev->name, ioaddr); #endif @@ -3003,7 +3003,7 @@ static int __init hp100_isa_init(void) return cards > 0 ? 0 : -ENODEV; } -static void __exit hp100_isa_cleanup(void) +static void __exit hp100_isa_cleanup(void) { int i; @@ -3027,12 +3027,12 @@ static int __init hp100_module_init(void) goto out; #ifdef CONFIG_EISA err = eisa_driver_register(&hp100_eisa_driver); - if (err && err != -ENODEV) + if (err && err != -ENODEV) goto out2; #endif #ifdef CONFIG_PCI err = pci_module_init(&hp100_pci_driver); - if (err && err != -ENODEV) + if (err && err != -ENODEV) goto out3; #endif out: |