Lines Matching +full:ati +full:- +full:target

3 	Written 1996-1999 by Donald Becker.
43 /* Set the copy breakpoint for the copy-only-tiny-frames scheme.
48 /* ARM systems perform better by disregarding the bus-master
49 transfer capability of these cards. -- rmk */
98 This is only in the support-all-kernels source code. */
117 The Boomerang size is twice as large as the Vortex -- it has additional
124 code size of a per-interface flag is not worthwhile. */
145 II. Board-specific settings
151 The EEPROM settings for media type and forced-full-duplex are observed.
158 series. The primary interface is two programmed-I/O FIFOs, with an
159 alternate single-contiguous-region bus-master transfer (see next).
161 The 3c900 "Boomerang" series uses a full-bus-master interface with separate
164 programmed-I/O interface that has been removed in 'B' and subsequent board
176 The Boomerang chip's full-bus-master interface is useful, and has the
177 currently-unused advantages over other similar chips that queued transmit
181 With full-bus-master support, this driver uses a "RX_COPYBREAK" scheme.
183 full-sized skbuffs as receive buffers. The value RX_COPYBREAK is used as
184 the copying breakpoint: it is chosen to trade-off the memory wasted by
185 passing the full-sized skbuff to the queue layer for all frames vs. the
186 copying cost of copying a frame to a correctly-sized skbuff.
189 The driver runs as two independent, single-threaded flows of control. One
190 is the send-packet routine, which enforces single-threaded use by the
191 dev->tbusy flag. The other thread is the interrupt handler, which is single
292 {"3c595 Vortex 100base-MII",
305 {"3c900B-FL Cyclone 10base-FL",
311 {"3C905B-TX Fast Etherlink XL PCI",
318 {"3c905B-FX Cyclone 100baseFx",
322 {"3c920B-EMB-WNM (ATI Radeon 9100 IGP)",
327 {"3c980C Python-T",
329 {"3cSOHO100-TX Hurricane",
357 {"3CXFEM656C Tornado+Winmodem CardBus", /* From pcmcia-cs-3.1.5 */
369 {"3c905B-T4",
371 {"3c920B-EMB-WNM Tornado",
445 32-bit 'Dwords' rather than octets. */
474 On the Vortex this window is always mapped at offsets 0x10-0x1f. */
505 ((((unsigned long)(value)) >> (offset)) & ((1 << (bitcount)) - 1))
508 (((lhs) & ~((((1 << (bitcount)) - 1)) << (offset))) | \
509 (((rhs) & ((1 << (bitcount)) - 1)) << (offset)))
584 /* Chip features we care about in vp->capabilities, read from the EEPROM. */
596 /* The Rx and Tx rings should be quad-word-aligned. */
601 /* The addresses of transmit- and receive-in-place skbuffs. */
606 struct vortex_extra_stats xstats; /* NIC-specific extra stats */
615 /* Some values here only for performance evaluation and path-coverage */
621 int options; /* User-settable misc. driver options. */
622 unsigned int media_override:4, /* Passed-in media type. */
625 bus_master:1, /* Vortex can only do a fragment bus-m. */
630 enable_wol:1, /* Wake-on-LAN is enabled */
631 pm_state_valid:1, /* pci_dev->saved_config_space has sane contents */
662 if (window != vp->window) { in window_set()
663 iowrite16(SelectWindow + window, vp->ioaddr + EL3_CMD); in window_set()
664 vp->window = window; in window_set()
674 spin_lock_irqsave(&vp->window_lock, flags); \
676 ret = ioread ## size(vp->ioaddr + addr); \
677 spin_unlock_irqrestore(&vp->window_lock, flags); \
685 spin_lock_irqsave(&vp->window_lock, flags); \
687 iowrite ## size(value, vp->ioaddr + addr); \
688 spin_unlock_irqrestore(&vp->window_lock, flags); \
701 ((struct pci_dev *) (((vp)->gendev) ? DEVICE_PCI((vp)->gendev) : NULL))
704 #define DEVICE_EISA(dev) (((dev)->bus == &eisa_bus_type) ? to_eisa_device((dev)) : NULL)
710 ((struct eisa_device *) (((vp)->gendev) ? DEVICE_EISA((vp)->gendev) : NULL))
723 mask:8, /* The transceiver-present bit in Wn3_Config.*/
736 { "MII-External", 0, 0x41, XCVR_10baseT, 3*HZ },
784 /* This driver uses 'options' to pass the media type, full-duplex flag, etc. */
785 /* Option count limit only -- unlimited interfaces are supported. */
787 static int options[MAX_UNITS] = { [0 ... MAX_UNITS-1] = -1 };
788 static int full_duplex[MAX_UNITS] = {[0 ... MAX_UNITS-1] = -1 };
789 static int hw_checksums[MAX_UNITS] = {[0 ... MAX_UNITS-1] = -1 };
790 static int flow_ctrl[MAX_UNITS] = {[0 ... MAX_UNITS-1] = -1 };
791 static int enable_wol[MAX_UNITS] = {[0 ... MAX_UNITS-1] = -1 };
792 static int use_mmio[MAX_UNITS] = {[0 ... MAX_UNITS-1] = -1 };
793 static int global_options = -1;
794 static int global_full_duplex = -1;
795 static int global_enable_wol = -1;
796 static int global_use_mmio = -1;
798 /* Variables to work-around the Compaq PCI BIOS32 problem. */
821 MODULE_PARM_DESC(debug, "3c59x debug level (0-6)");
822 MODULE_PARM_DESC(options, "3c59x: Bits 0-3: media type, bit 4: bus mastering, bit 9: full duplex");
826 MODULE_PARM_DESC(hw_checksums, "3c59x Hardware checksum checking by adapter(s) (0-1)");
827 MODULE_PARM_DESC(flow_ctrl, "3c59x 802.3x flow control usage (PAUSE only) (0-1)");
828 MODULE_PARM_DESC(enable_wol, "3c59x: Turn on Wake-on-LAN for adapter(s) (0-1)");
830 MODULE_PARM_DESC(rx_copybreak, "3c59x copy breakpoint for copy-only-tiny-frames");
837 MODULE_PARM_DESC(use_mmio, "3c59x: use memory-mapped PCI I/O resource (0-1)");
842 vortex_boomerang_interrupt(dev->irq, dev); in poll_vortex()
910 if (!request_region(edev->base_addr, VORTEX_TOTAL_SIZE, DRV_NAME)) in vortex_eisa_probe()
911 return -EBUSY; in vortex_eisa_probe()
913 ioaddr = ioport_map(edev->base_addr, VORTEX_TOTAL_SIZE); in vortex_eisa_probe()
916 edev->id.driver_data, vortex_cards_found)) { in vortex_eisa_probe()
917 release_region(edev->base_addr, VORTEX_TOTAL_SIZE); in vortex_eisa_probe()
918 return -ENODEV; in vortex_eisa_probe()
942 ioaddr = vp->ioaddr; in vortex_eisa_remove()
946 release_region(edev->base_addr, VORTEX_TOTAL_SIZE); in vortex_eisa_remove()
985 /* Special code to work-around the Compaq PCI BIOS32 problem. */ in vortex_eisa_init()
991 return vortex_cards_found - orig_cards_found + eisa_found; in vortex_eisa_init()
1015 vci = &vortex_info_tbl[ent->driver_data]; in vortex_init_one()
1016 pci_bar = vci->drv_flags & (IS_CYCLONE | IS_TORNADO) ? 1 : 0; in vortex_init_one()
1023 if (!ioaddr) /* If mapping fails, fall-back to BAR 0... */ in vortex_init_one()
1026 rc = -ENOMEM; in vortex_init_one()
1030 rc = vortex_probe1(&pdev->dev, ioaddr, pdev->irq, in vortex_init_one()
1031 ent->driver_data, unit); in vortex_init_one()
1114 print_name = dev_name(&edev->dev); in vortex_probe1()
1119 retval = -ENOMEM; in vortex_probe1()
1129 if (dev->mem_start) { in vortex_probe1()
1132 * LILO 'ether=' argument for non-modular use in vortex_probe1()
1134 option = dev->mem_start; in vortex_probe1()
1147 vp->enable_wol = 1; in vortex_probe1()
1157 vci->name, in vortex_probe1()
1160 dev->base_addr = (unsigned long)ioaddr; in vortex_probe1()
1161 dev->irq = irq; in vortex_probe1()
1162 dev->mtu = mtu; in vortex_probe1()
1163 vp->ioaddr = ioaddr; in vortex_probe1()
1164 vp->large_frames = mtu > 1500; in vortex_probe1()
1165 vp->drv_flags = vci->drv_flags; in vortex_probe1()
1166 vp->has_nway = (vci->drv_flags & HAS_NWAY) ? 1 : 0; in vortex_probe1()
1167 vp->io_size = vci->io_size; in vortex_probe1()
1168 vp->card_idx = card_idx; in vortex_probe1()
1169 vp->window = -1; in vortex_probe1()
1176 /* PCI-only startup logic */ in vortex_probe1()
1178 /* enable bus-mastering if necessary */ in vortex_probe1()
1179 if (vci->flags & PCI_USES_MASTER) in vortex_probe1()
1182 if (vci->drv_flags & IS_VORTEX) { in vortex_probe1()
1199 spin_lock_init(&vp->lock); in vortex_probe1()
1200 spin_lock_init(&vp->mii_lock); in vortex_probe1()
1201 spin_lock_init(&vp->window_lock); in vortex_probe1()
1202 vp->gendev = gendev; in vortex_probe1()
1203 vp->mii.dev = dev; in vortex_probe1()
1204 vp->mii.mdio_read = mdio_read; in vortex_probe1()
1205 vp->mii.mdio_write = mdio_write; in vortex_probe1()
1206 vp->mii.phy_id_mask = 0x1f; in vortex_probe1()
1207 vp->mii.reg_num_mask = 0x1f; in vortex_probe1()
1210 vp->rx_ring = dma_alloc_coherent(gendev, sizeof(struct boom_rx_desc) * RX_RING_SIZE in vortex_probe1()
1212 &vp->rx_ring_dma, GFP_KERNEL); in vortex_probe1()
1213 retval = -ENOMEM; in vortex_probe1()
1214 if (!vp->rx_ring) in vortex_probe1()
1217 vp->tx_ring = (struct boom_tx_desc *)(vp->rx_ring + RX_RING_SIZE); in vortex_probe1()
1218 vp->tx_ring_dma = vp->rx_ring_dma + sizeof(struct boom_rx_desc) * RX_RING_SIZE; in vortex_probe1()
1220 /* if we are a PCI driver, we store info in pdev->driver_data in vortex_probe1()
1227 vp->media_override = 7; in vortex_probe1()
1229 vp->media_override = ((option & 7) == 2) ? 0 : option & 15; in vortex_probe1()
1230 if (vp->media_override != 7) in vortex_probe1()
1231 vp->medialock = 1; in vortex_probe1()
1232 vp->full_duplex = (option & 0x200) ? 1 : 0; in vortex_probe1()
1233 vp->bus_master = (option & 16) ? 1 : 0; in vortex_probe1()
1237 vp->full_duplex = 1; in vortex_probe1()
1239 vp->enable_wol = 1; in vortex_probe1()
1243 vp->full_duplex = 1; in vortex_probe1()
1245 vp->flow_ctrl = 1; in vortex_probe1()
1247 vp->enable_wol = 1; in vortex_probe1()
1250 vp->mii.force_media = vp->full_duplex; in vortex_probe1()
1251 vp->options = option; in vortex_probe1()
1256 if (vci->drv_flags & EEPROM_8BIT) in vortex_probe1()
1258 else if (vci->drv_flags & EEPROM_OFFSET) in vortex_probe1()
1267 for (timer = 10; timer >= 0; timer--) { in vortex_probe1()
1284 if ((checksum != 0x00) && !(vci->drv_flags & IS_TORNADO)) in vortex_probe1()
1287 ((__be16 *)dev->dev_addr)[i] = htons(eeprom[i + 10]); in vortex_probe1()
1289 pr_cont(" %pM", dev->dev_addr); in vortex_probe1()
1292 if (!is_valid_ether_addr(dev->dev_addr)) { in vortex_probe1()
1293 retval = -EINVAL; in vortex_probe1()
1298 window_write8(vp, dev->dev_addr[i], 2, i); in vortex_probe1()
1301 pr_cont(", IRQ %d\n", dev->irq); in vortex_probe1()
1303 if (dev->irq <= 0 || dev->irq >= nr_irqs) in vortex_probe1()
1305 dev->irq); in vortex_probe1()
1309 pr_info(" product code %02x%02x rev %02x.%d date %02d-%02d-%02d\n", in vortex_probe1()
1315 if (pdev && vci->drv_flags & HAS_CB_FNS) { in vortex_probe1()
1318 vp->cb_fn_base = pci_iomap(pdev, 2, 0); in vortex_probe1()
1319 if (!vp->cb_fn_base) { in vortex_probe1()
1320 retval = -ENOMEM; in vortex_probe1()
1325 pr_info("%s: CardBus functions mapped %16.16llx->%p\n", in vortex_probe1()
1328 vp->cb_fn_base); in vortex_probe1()
1332 if (vp->drv_flags & INVERT_LED_PWR) in vortex_probe1()
1334 if (vp->drv_flags & INVERT_MII_PWR) in vortex_probe1()
1337 if (vp->drv_flags & WNO_XCVR_PWR) { in vortex_probe1()
1343 vp->info1 = eeprom[13]; in vortex_probe1()
1344 vp->info2 = eeprom[15]; in vortex_probe1()
1345 vp->capabilities = eeprom[16]; in vortex_probe1()
1347 if (vp->info1 & 0x8000) { in vortex_probe1()
1348 vp->full_duplex = 1; in vortex_probe1()
1356 vp->available_media = window_read16(vp, 3, Wn3_Options); in vortex_probe1()
1357 if ((vp->available_media & 0xff) == 0) /* Broken 3c916 */ in vortex_probe1()
1358 vp->available_media = 0x40; in vortex_probe1()
1363 pr_info(" %dK %s-wide RAM %s Rx:Tx split, %s%s interface.\n", in vortex_probe1()
1371 vp->default_media = XCVR(config); in vortex_probe1()
1372 if (vp->default_media == XCVR_NWAY) in vortex_probe1()
1373 vp->has_nway = 1; in vortex_probe1()
1374 vp->autoselect = AUTOSELECT(config); in vortex_probe1()
1377 if (vp->media_override != 7) { in vortex_probe1()
1379 print_name, vp->media_override, in vortex_probe1()
1380 media_tbl[vp->media_override].name); in vortex_probe1()
1381 dev->if_port = vp->media_override; in vortex_probe1()
1383 dev->if_port = vp->default_media; in vortex_probe1()
1385 if ((vp->available_media & 0x40) || (vci->drv_flags & HAS_NWAY) || in vortex_probe1()
1386 dev->if_port == XCVR_MII || dev->if_port == XCVR_NWAY) { in vortex_probe1()
1389 if (vp->drv_flags & EXTRA_PREAMBLE) in vortex_probe1()
1403 phyx = phy - 1; in vortex_probe1()
1408 vp->phys[phy_idx++] = phyx; in vortex_probe1()
1417 mii_preamble_required--; in vortex_probe1()
1420 vp->phys[0] = 24; in vortex_probe1()
1422 vp->advertising = mdio_read(dev, vp->phys[0], MII_ADVERTISE); in vortex_probe1()
1423 if (vp->full_duplex) { in vortex_probe1()
1425 vp->advertising &= ~0x02A0; in vortex_probe1()
1426 mdio_write(dev, vp->phys[0], 4, vp->advertising); in vortex_probe1()
1429 vp->mii.phy_id = vp->phys[0]; in vortex_probe1()
1432 if (vp->capabilities & CapBusMaster) { in vortex_probe1()
1433 vp->full_bus_master_tx = 1; in vortex_probe1()
1435 pr_info(" Enabling bus-master transmits and %s receives.\n", in vortex_probe1()
1436 (vp->info2 & 1) ? "early" : "whole-frame" ); in vortex_probe1()
1438 vp->full_bus_master_rx = (vp->info2 & 1) ? 1 : 2; in vortex_probe1()
1439 vp->bus_master = 0; /* AKPM: vortex only */ in vortex_probe1()
1442 /* The 3c59x-specific entries in the device structure. */ in vortex_probe1()
1443 if (vp->full_bus_master_tx) { in vortex_probe1()
1444 dev->netdev_ops = &boomrang_netdev_ops; in vortex_probe1()
1447 ((hw_checksums[card_idx] == -1 && (vp->drv_flags & HAS_HWCKSM)) || in vortex_probe1()
1449 dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG; in vortex_probe1()
1452 dev->netdev_ops = &vortex_netdev_ops; in vortex_probe1()
1457 (dev->features & NETIF_F_SG) ? "en":"dis", in vortex_probe1()
1458 (dev->features & NETIF_F_IP_CSUM) ? "en":"dis"); in vortex_probe1()
1461 dev->ethtool_ops = &vortex_ethtool_ops; in vortex_probe1()
1462 dev->watchdog_timeo = (watchdog * HZ) / 1000; in vortex_probe1()
1465 vp->pm_state_valid = 1; in vortex_probe1()
1474 dma_free_coherent(&pdev->dev, in vortex_probe1()
1477 vp->rx_ring, vp->rx_ring_dma); in vortex_probe1()
1489 void __iomem *ioaddr = vp->ioaddr; in issue_and_wait()
1503 dev->name, cmd, i * 10); in issue_and_wait()
1509 dev->name, cmd, ioread16(ioaddr + EL3_STATUS)); in issue_and_wait()
1517 pr_info("%s: setting %s-duplex.\n", in vortex_set_duplex()
1518 dev->name, (vp->full_duplex) ? "full" : "half"); in vortex_set_duplex()
1520 /* Set the full-duplex bit. */ in vortex_set_duplex()
1522 ((vp->info1 & 0x8000) || vp->full_duplex ? 0x20 : 0) | in vortex_set_duplex()
1523 (vp->large_frames ? 0x40 : 0) | in vortex_set_duplex()
1524 ((vp->full_duplex && vp->flow_ctrl && vp->partner_flow_ctrl) ? in vortex_set_duplex()
1537 if (mii_check_media(&vp->mii, ok_to_print, init)) { in vortex_check_media()
1538 vp->full_duplex = vp->mii.full_duplex; in vortex_check_media()
1549 void __iomem *ioaddr = vp->ioaddr; in vortex_up()
1555 if (vp->pm_state_valid) in vortex_up()
1559 pr_warn("%s: Could not enable device\n", dev->name); in vortex_up()
1567 if (vp->media_override != 7) { in vortex_up()
1569 dev->name, vp->media_override, in vortex_up()
1570 media_tbl[vp->media_override].name); in vortex_up()
1571 dev->if_port = vp->media_override; in vortex_up()
1572 } else if (vp->autoselect) { in vortex_up()
1573 if (vp->has_nway) { in vortex_up()
1576 dev->name, dev->if_port); in vortex_up()
1577 dev->if_port = XCVR_NWAY; in vortex_up()
1580 dev->if_port = XCVR_100baseTx; in vortex_up()
1581 while (! (vp->available_media & media_tbl[dev->if_port].mask)) in vortex_up()
1582 dev->if_port = media_tbl[dev->if_port].next; in vortex_up()
1585 dev->name, media_tbl[dev->if_port].name); in vortex_up()
1588 dev->if_port = vp->default_media; in vortex_up()
1591 dev->name, media_tbl[dev->if_port].name); in vortex_up()
1594 timer_setup(&vp->timer, vortex_timer, 0); in vortex_up()
1595 mod_timer(&vp->timer, RUN_AT(media_tbl[dev->if_port].wait)); in vortex_up()
1599 dev->name, media_tbl[dev->if_port].name); in vortex_up()
1601 vp->full_duplex = vp->mii.force_media; in vortex_up()
1602 config = BFINS(config, dev->if_port, 20, 4); in vortex_up()
1607 if (dev->if_port == XCVR_MII || dev->if_port == XCVR_NWAY) { in vortex_up()
1608 mdio_read(dev, vp->phys[0], MII_BMSR); in vortex_up()
1609 mii_reg5 = mdio_read(dev, vp->phys[0], MII_LPA); in vortex_up()
1610 vp->partner_flow_ctrl = ((mii_reg5 & 0x0400) != 0); in vortex_up()
1611 vp->mii.full_duplex = vp->full_duplex; in vortex_up()
1620 * Don't reset the PHY - that upsets autonegotiation during DHCP operations. in vortex_up()
1629 dev->name, dev->irq, window_read16(vp, 4, Wn4_Media)); in vortex_up()
1634 window_write8(vp, dev->dev_addr[i], 2, i); in vortex_up()
1638 if (vp->cb_fn_base) { in vortex_up()
1640 if (vp->drv_flags & INVERT_LED_PWR) in vortex_up()
1642 if (vp->drv_flags & INVERT_MII_PWR) in vortex_up()
1647 if (dev->if_port == XCVR_10base2) in vortex_up()
1650 if (dev->if_port != XCVR_NWAY) { in vortex_up()
1654 media_tbl[dev->if_port].media_bits, in vortex_up()
1669 if (vp->full_bus_master_rx) { /* Boomerang bus master. */ in vortex_up()
1670 vp->cur_rx = 0; in vortex_up()
1674 iowrite32(vp->rx_ring_dma, ioaddr + UpListPtr); in vortex_up()
1676 if (vp->full_bus_master_tx) { /* Boomerang bus master Tx. */ in vortex_up()
1677 vp->cur_tx = vp->dirty_tx = 0; in vortex_up()
1678 if (vp->drv_flags & IS_BOOMERANG) in vortex_up()
1682 vp->rx_ring[i].status = 0; in vortex_up()
1684 vp->tx_skbuff[i] = NULL; in vortex_up()
1687 /* Set receiver mode: presumably accept b-case and phys addr only. */ in vortex_up()
1696 vp->status_enable = SetStatusEnb | HostError|IntReq|StatsFull|TxComplete| in vortex_up()
1697 (vp->full_bus_master_tx ? DownComplete : TxAvailable) | in vortex_up()
1698 (vp->full_bus_master_rx ? UpComplete : RxComplete) | in vortex_up()
1699 (vp->bus_master ? DMADone : 0); in vortex_up()
1700 vp->intr_enable = SetIntrEnb | IntLatch | TxAvailable | in vortex_up()
1701 (vp->full_bus_master_rx ? 0 : RxComplete) | in vortex_up()
1703 | (vp->bus_master ? DMADone : 0) | UpComplete | DownComplete; in vortex_up()
1704 iowrite16(vp->status_enable, ioaddr + EL3_CMD); in vortex_up()
1708 iowrite16(vp->intr_enable, ioaddr + EL3_CMD); in vortex_up()
1709 if (vp->cb_fn_base) /* The PCMCIA people are idiots. */ in vortex_up()
1710 iowrite32(0x8000, vp->cb_fn_base + 4); in vortex_up()
1725 /* Use the now-standard shared IRQ implementation. */ in vortex_open()
1726 if ((retval = request_irq(dev->irq, vortex_boomerang_interrupt, IRQF_SHARED, dev->name, dev))) { in vortex_open()
1727 pr_err("%s: Could not reserve IRQ %d\n", dev->name, dev->irq); in vortex_open()
1731 if (vp->full_bus_master_rx) { /* Boomerang bus master. */ in vortex_open()
1733 pr_debug("%s: Filling in the Rx ring.\n", dev->name); in vortex_open()
1736 vp->rx_ring[i].next = cpu_to_le32(vp->rx_ring_dma + sizeof(struct boom_rx_desc) * (i+1)); in vortex_open()
1737 vp->rx_ring[i].status = 0; /* Clear complete bit. */ in vortex_open()
1738 vp->rx_ring[i].length = cpu_to_le32(PKT_BUF_SZ | LAST_FRAG); in vortex_open()
1742 vp->rx_skbuff[i] = skb; in vortex_open()
1747 dma = dma_map_single(vp->gendev, skb->data, in vortex_open()
1749 if (dma_mapping_error(vp->gendev, dma)) in vortex_open()
1751 vp->rx_ring[i].addr = cpu_to_le32(dma); in vortex_open()
1754 pr_emerg("%s: no memory for rx ring\n", dev->name); in vortex_open()
1755 retval = -ENOMEM; in vortex_open()
1759 vp->rx_ring[i-1].next = cpu_to_le32(vp->rx_ring_dma); in vortex_open()
1768 if (vp->rx_skbuff[i]) { in vortex_open()
1769 dev_kfree_skb(vp->rx_skbuff[i]); in vortex_open()
1770 vp->rx_skbuff[i] = NULL; in vortex_open()
1773 free_irq(dev->irq, dev); in vortex_open()
1776 pr_err("%s: vortex_open() fails: returning %d\n", dev->name, retval); in vortex_open()
1785 struct net_device *dev = vp->mii.dev; in vortex_timer()
1786 void __iomem *ioaddr = vp->ioaddr; in vortex_timer()
1793 dev->name, media_tbl[dev->if_port].name); in vortex_timer()
1794 pr_debug("dev->watchdog_timeo=%d\n", dev->watchdog_timeo); in vortex_timer()
1798 switch (dev->if_port) { in vortex_timer()
1805 dev->name, media_tbl[dev->if_port].name, media_status); in vortex_timer()
1810 dev->name, media_tbl[dev->if_port].name, media_status); in vortex_timer()
1823 dev->name, media_tbl[dev->if_port].name, media_status); in vortex_timer()
1827 if (dev->flags & IFF_SLAVE || !netif_carrier_ok(dev)) in vortex_timer()
1830 if (vp->medialock) in vortex_timer()
1836 spin_lock_irq(&vp->lock); in vortex_timer()
1839 dev->if_port = media_tbl[dev->if_port].next; in vortex_timer()
1840 } while ( ! (vp->available_media & media_tbl[dev->if_port].mask)); in vortex_timer()
1841 if (dev->if_port == XCVR_Default) { /* Go back to default. */ in vortex_timer()
1842 dev->if_port = vp->default_media; in vortex_timer()
1845 dev->name, media_tbl[dev->if_port].name); in vortex_timer()
1849 dev->name, media_tbl[dev->if_port].name); in vortex_timer()
1850 next_tick = media_tbl[dev->if_port].wait; in vortex_timer()
1854 media_tbl[dev->if_port].media_bits, in vortex_timer()
1858 config = BFINS(config, dev->if_port, 20, 4); in vortex_timer()
1861 iowrite16(dev->if_port == XCVR_10base2 ? StartCoax : StopCoax, in vortex_timer()
1867 spin_unlock_irq(&vp->lock); in vortex_timer()
1873 dev->name, media_tbl[dev->if_port].name); in vortex_timer()
1875 mod_timer(&vp->timer, RUN_AT(next_tick)); in vortex_timer()
1876 if (vp->deferred) in vortex_timer()
1883 void __iomem *ioaddr = vp->ioaddr; in vortex_tx_timeout()
1886 dev->name, ioread8(ioaddr + TxStatus), in vortex_tx_timeout()
1895 pr_err("%s: Transmitter encountered 16 collisions --" in vortex_tx_timeout()
1896 " network cable problem?\n", dev->name); in vortex_tx_timeout()
1898 pr_err("%s: Interrupt posted but not delivered --" in vortex_tx_timeout()
1899 " IRQ blocked by another device?\n", dev->name); in vortex_tx_timeout()
1901 vortex_boomerang_interrupt(dev->irq, dev); in vortex_tx_timeout()
1909 dev->stats.tx_errors++; in vortex_tx_timeout()
1910 if (vp->full_bus_master_tx) { in vortex_tx_timeout()
1911 pr_debug("%s: Resetting the Tx ring pointer.\n", dev->name); in vortex_tx_timeout()
1912 if (vp->cur_tx - vp->dirty_tx > 0 && ioread32(ioaddr + DownListPtr) == 0) in vortex_tx_timeout()
1913 iowrite32(vp->tx_ring_dma + (vp->dirty_tx % TX_RING_SIZE) * sizeof(struct boom_tx_desc), in vortex_tx_timeout()
1915 if (vp->cur_tx - vp->dirty_tx < TX_RING_SIZE) { in vortex_tx_timeout()
1919 if (vp->drv_flags & IS_BOOMERANG) in vortex_tx_timeout()
1923 dev->stats.tx_dropped++; in vortex_tx_timeout()
1940 void __iomem *ioaddr = vp->ioaddr; in vortex_error()
1945 pr_err("%s: vortex_error(), status=0x%x\n", dev->name, status); in vortex_error()
1950 /* Presumably a tx-timeout. We must merely re-enable. */ in vortex_error()
1954 dev->name, tx_status); in vortex_error()
1961 if (tx_status & 0x14) dev->stats.tx_fifo_errors++; in vortex_error()
1962 if (tx_status & 0x38) dev->stats.tx_aborted_errors++; in vortex_error()
1963 if (tx_status & 0x08) vp->xstats.tx_max_collisions++; in vortex_error()
1967 } else if ((tx_status & 0x08) && (vp->drv_flags & MAX_COLLISION_RESET)) { /* maxCollisions */ in vortex_error()
1970 } else { /* Merely re-enable the transmitter. */ in vortex_error()
1981 pr_debug("%s: Updating stats.\n", dev->name); in vortex_error()
1988 dev->name); in vortex_error()
1992 vp->intr_enable &= ~StatsFull; in vortex_error()
1997 iowrite16(vp->status_enable, ioaddr + EL3_CMD); in vortex_error()
1998 iowrite16(vp->intr_enable, ioaddr + EL3_CMD); in vortex_error()
2004 dev->name, fifo_diag); in vortex_error()
2006 if (vp->full_bus_master_tx) { in vortex_error()
2009 /* 0x40000000 PCI target abort. */ in vortex_error()
2011 pr_err("%s: PCI bus error, bus status %8.8x\n", dev->name, bus_status); in vortex_error()
2027 iowrite16(RxEnable, ioaddr + EL3_CMD); /* Re-enable the receiver. */ in vortex_error()
2035 if (!vp->full_bus_master_tx) in vortex_error()
2044 void __iomem *ioaddr = vp->ioaddr; in vortex_start_xmit()
2045 int skblen = skb->len; in vortex_start_xmit()
2048 iowrite32(skb->len, ioaddr + TX_FIFO); in vortex_start_xmit()
2049 if (vp->bus_master) { in vortex_start_xmit()
2050 /* Set the bus-master controller to transfer the packet. */ in vortex_start_xmit()
2051 int len = (skb->len + 3) & ~3; in vortex_start_xmit()
2052 vp->tx_skb_dma = dma_map_single(vp->gendev, skb->data, len, in vortex_start_xmit()
2054 if (dma_mapping_error(vp->gendev, vp->tx_skb_dma)) { in vortex_start_xmit()
2056 dev->stats.tx_dropped++; in vortex_start_xmit()
2060 spin_lock_irq(&vp->window_lock); in vortex_start_xmit()
2062 iowrite32(vp->tx_skb_dma, ioaddr + Wn7_MasterAddr); in vortex_start_xmit()
2064 spin_unlock_irq(&vp->window_lock); in vortex_start_xmit()
2065 vp->tx_skb = skb; in vortex_start_xmit()
2072 iowrite32_rep(ioaddr + TX_FIFO, skb->data, (skb->len + 3) >> 2); in vortex_start_xmit()
2077 /* Interrupt us when the FIFO has room for max-sized packet. */ in vortex_start_xmit()
2090 while (--i > 0 && (tx_status = ioread8(ioaddr + TxStatus)) > 0) { in vortex_start_xmit()
2091 if (tx_status & 0x3C) { /* A Tx-disabling error occurred. */ in vortex_start_xmit()
2094 dev->name, tx_status); in vortex_start_xmit()
2095 if (tx_status & 0x04) dev->stats.tx_fifo_errors++; in vortex_start_xmit()
2096 if (tx_status & 0x38) dev->stats.tx_aborted_errors++; in vortex_start_xmit()
2112 void __iomem *ioaddr = vp->ioaddr; in boomerang_start_xmit()
2114 int entry = vp->cur_tx % TX_RING_SIZE; in boomerang_start_xmit()
2115 int skblen = skb->len; in boomerang_start_xmit()
2116 struct boom_tx_desc *prev_entry = &vp->tx_ring[(vp->cur_tx-1) % TX_RING_SIZE]; in boomerang_start_xmit()
2123 dev->name, vp->cur_tx); in boomerang_start_xmit()
2132 if (vp->handling_irq) in boomerang_start_xmit()
2135 if (vp->cur_tx - vp->dirty_tx >= TX_RING_SIZE) { in boomerang_start_xmit()
2138 dev->name); in boomerang_start_xmit()
2143 vp->tx_skbuff[entry] = skb; in boomerang_start_xmit()
2145 vp->tx_ring[entry].next = 0; in boomerang_start_xmit()
2147 if (skb->ip_summed != CHECKSUM_PARTIAL) in boomerang_start_xmit()
2148 vp->tx_ring[entry].status = cpu_to_le32(skb->len | TxIntrUploaded); in boomerang_start_xmit()
2150 vp->tx_ring[entry].status = cpu_to_le32(skb->len | TxIntrUploaded | AddTCPChksum | AddUDPChksum); in boomerang_start_xmit()
2152 if (!skb_shinfo(skb)->nr_frags) { in boomerang_start_xmit()
2153 dma_addr = dma_map_single(vp->gendev, skb->data, skb->len, in boomerang_start_xmit()
2155 if (dma_mapping_error(vp->gendev, dma_addr)) in boomerang_start_xmit()
2158 vp->tx_ring[entry].frag[0].addr = cpu_to_le32(dma_addr); in boomerang_start_xmit()
2159 vp->tx_ring[entry].frag[0].length = cpu_to_le32(skb->len | LAST_FRAG); in boomerang_start_xmit()
2163 dma_addr = dma_map_single(vp->gendev, skb->data, in boomerang_start_xmit()
2165 if (dma_mapping_error(vp->gendev, dma_addr)) in boomerang_start_xmit()
2168 vp->tx_ring[entry].frag[0].addr = cpu_to_le32(dma_addr); in boomerang_start_xmit()
2169 vp->tx_ring[entry].frag[0].length = cpu_to_le32(skb_headlen(skb)); in boomerang_start_xmit()
2171 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { in boomerang_start_xmit()
2172 skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; in boomerang_start_xmit()
2174 dma_addr = skb_frag_dma_map(vp->gendev, frag, in boomerang_start_xmit()
2178 if (dma_mapping_error(vp->gendev, dma_addr)) { in boomerang_start_xmit()
2179 for(i = i-1; i >= 0; i--) in boomerang_start_xmit()
2180 dma_unmap_page(vp->gendev, in boomerang_start_xmit()
2181 le32_to_cpu(vp->tx_ring[entry].frag[i+1].addr), in boomerang_start_xmit()
2182 le32_to_cpu(vp->tx_ring[entry].frag[i+1].length), in boomerang_start_xmit()
2185 dma_unmap_single(vp->gendev, in boomerang_start_xmit()
2186 le32_to_cpu(vp->tx_ring[entry].frag[0].addr), in boomerang_start_xmit()
2187 le32_to_cpu(vp->tx_ring[entry].frag[0].length), in boomerang_start_xmit()
2193 vp->tx_ring[entry].frag[i+1].addr = in boomerang_start_xmit()
2196 if (i == skb_shinfo(skb)->nr_frags-1) in boomerang_start_xmit()
2197 vp->tx_ring[entry].frag[i+1].length = cpu_to_le32(skb_frag_size(frag)|LAST_FRAG); in boomerang_start_xmit()
2199 vp->tx_ring[entry].frag[i+1].length = cpu_to_le32(skb_frag_size(frag)); in boomerang_start_xmit()
2203 dma_addr = dma_map_single(vp->gendev, skb->data, skb->len, DMA_TO_DEVICE); in boomerang_start_xmit()
2204 if (dma_mapping_error(vp->gendev, dma_addr)) in boomerang_start_xmit()
2206 vp->tx_ring[entry].addr = cpu_to_le32(dma_addr); in boomerang_start_xmit()
2207 vp->tx_ring[entry].length = cpu_to_le32(skb->len | LAST_FRAG); in boomerang_start_xmit()
2208 vp->tx_ring[entry].status = cpu_to_le32(skb->len | TxIntrUploaded); in boomerang_start_xmit()
2211 spin_lock_irqsave(&vp->lock, flags); in boomerang_start_xmit()
2214 prev_entry->next = cpu_to_le32(vp->tx_ring_dma + entry * sizeof(struct boom_tx_desc)); in boomerang_start_xmit()
2216 iowrite32(vp->tx_ring_dma + entry * sizeof(struct boom_tx_desc), ioaddr + DownListPtr); in boomerang_start_xmit()
2217 vp->queued_packet++; in boomerang_start_xmit()
2220 vp->cur_tx++; in boomerang_start_xmit()
2223 if (vp->cur_tx - vp->dirty_tx > TX_RING_SIZE - 1) { in boomerang_start_xmit()
2230 prev_entry->status &= cpu_to_le32(~TxIntrUploaded); in boomerang_start_xmit()
2235 spin_unlock_irqrestore(&vp->lock, flags); in boomerang_start_xmit()
2239 dev_err(vp->gendev, "Error mapping dma buffer\n"); in boomerang_start_xmit()
2261 ioaddr = vp->ioaddr; in _vortex_interrupt()
2273 status |= vp->deferred; in _vortex_interrupt()
2274 vp->deferred = 0; in _vortex_interrupt()
2282 dev->name, status, ioread8(ioaddr + Timer)); in _vortex_interrupt()
2284 spin_lock(&vp->window_lock); in _vortex_interrupt()
2290 dev->name, status); in _vortex_interrupt()
2297 /* There's room in the FIFO for a full-sized packet. */ in _vortex_interrupt()
2305 dma_unmap_single(vp->gendev, vp->tx_skb_dma, (vp->tx_skb->len + 3) & ~3, DMA_TO_DEVICE); in _vortex_interrupt()
2307 bytes_compl += vp->tx_skb->len; in _vortex_interrupt()
2308 dev_consume_skb_irq(vp->tx_skb); /* Release the transferred buffer */ in _vortex_interrupt()
2316 } else { /* Interrupt when FIFO has room for max-sized packet. */ in _vortex_interrupt()
2328 spin_unlock(&vp->window_lock); in _vortex_interrupt()
2330 spin_lock(&vp->window_lock); in _vortex_interrupt()
2334 if (--work_done < 0) { in _vortex_interrupt()
2336 dev->name, status); in _vortex_interrupt()
2339 vp->deferred |= status; in _vortex_interrupt()
2340 iowrite16(SetStatusEnb | (~vp->deferred & vp->status_enable), in _vortex_interrupt()
2342 iowrite16(AckIntr | (vp->deferred & 0x7ff), ioaddr + EL3_CMD); in _vortex_interrupt()
2345 mod_timer(&vp->timer, jiffies + 1*HZ); in _vortex_interrupt()
2353 spin_unlock(&vp->window_lock); in _vortex_interrupt()
2357 dev->name, status); in _vortex_interrupt()
2377 ioaddr = vp->ioaddr; in _boomerang_interrupt()
2379 vp->handling_irq = 1; in _boomerang_interrupt()
2397 status |= vp->deferred; in _boomerang_interrupt()
2398 vp->deferred = 0; in _boomerang_interrupt()
2403 dev->name, status, ioread8(ioaddr + Timer)); in _boomerang_interrupt()
2407 dev->name, status); in _boomerang_interrupt()
2411 pr_debug("boomerang_interrupt->boomerang_rx\n"); in _boomerang_interrupt()
2416 unsigned int dirty_tx = vp->dirty_tx; in _boomerang_interrupt()
2419 while (vp->cur_tx - dirty_tx > 0) { in _boomerang_interrupt()
2421 #if 1 /* AKPM: the latter is faster, but cyclone-only */ in _boomerang_interrupt()
2423 vp->tx_ring_dma + entry * sizeof(struct boom_tx_desc)) in _boomerang_interrupt()
2426 if ((vp->tx_ring[entry].status & DN_COMPLETE) == 0) in _boomerang_interrupt()
2430 if (vp->tx_skbuff[entry]) { in _boomerang_interrupt()
2431 struct sk_buff *skb = vp->tx_skbuff[entry]; in _boomerang_interrupt()
2434 dma_unmap_single(vp->gendev, in _boomerang_interrupt()
2435 le32_to_cpu(vp->tx_ring[entry].frag[0].addr), in _boomerang_interrupt()
2436 le32_to_cpu(vp->tx_ring[entry].frag[0].length)&0xFFF, in _boomerang_interrupt()
2439 for (i=1; i<=skb_shinfo(skb)->nr_frags; i++) in _boomerang_interrupt()
2440 dma_unmap_page(vp->gendev, in _boomerang_interrupt()
2441 le32_to_cpu(vp->tx_ring[entry].frag[i].addr), in _boomerang_interrupt()
2442 le32_to_cpu(vp->tx_ring[entry].frag[i].length)&0xFFF, in _boomerang_interrupt()
2445 dma_unmap_single(vp->gendev, in _boomerang_interrupt()
2446 le32_to_cpu(vp->tx_ring[entry].addr), skb->len, DMA_TO_DEVICE); in _boomerang_interrupt()
2449 bytes_compl += skb->len; in _boomerang_interrupt()
2451 vp->tx_skbuff[entry] = NULL; in _boomerang_interrupt()
2455 /* dev->stats.tx_packets++; Counted below. */ in _boomerang_interrupt()
2458 vp->dirty_tx = dirty_tx; in _boomerang_interrupt()
2459 if (vp->cur_tx - dirty_tx <= TX_RING_SIZE - 1) { in _boomerang_interrupt()
2470 if (--work_done < 0) { in _boomerang_interrupt()
2472 dev->name, status); in _boomerang_interrupt()
2475 vp->deferred |= status; in _boomerang_interrupt()
2476 iowrite16(SetStatusEnb | (~vp->deferred & vp->status_enable), in _boomerang_interrupt()
2478 iowrite16(AckIntr | (vp->deferred & 0x7ff), ioaddr + EL3_CMD); in _boomerang_interrupt()
2481 mod_timer(&vp->timer, jiffies + 1*HZ); in _boomerang_interrupt()
2486 if (vp->cb_fn_base) /* The PCMCIA people are idiots. */ in _boomerang_interrupt()
2487 iowrite32(0x8000, vp->cb_fn_base + 4); in _boomerang_interrupt()
2494 dev->name, status); in _boomerang_interrupt()
2496 vp->handling_irq = 0; in _boomerang_interrupt()
2508 spin_lock_irqsave(&vp->lock, flags); in vortex_boomerang_interrupt()
2510 if (vp->full_bus_master_rx) in vortex_boomerang_interrupt()
2511 ret = _boomerang_interrupt(dev->irq, dev); in vortex_boomerang_interrupt()
2513 ret = _vortex_interrupt(dev->irq, dev); in vortex_boomerang_interrupt()
2515 spin_unlock_irqrestore(&vp->lock, flags); in vortex_boomerang_interrupt()
2523 void __iomem *ioaddr = vp->ioaddr; in vortex_rx()
2535 dev->stats.rx_errors++; in vortex_rx()
2536 if (rx_error & 0x01) dev->stats.rx_over_errors++; in vortex_rx()
2537 if (rx_error & 0x02) dev->stats.rx_length_errors++; in vortex_rx()
2538 if (rx_error & 0x04) dev->stats.rx_frame_errors++; in vortex_rx()
2539 if (rx_error & 0x08) dev->stats.rx_crc_errors++; in vortex_rx()
2540 if (rx_error & 0x10) dev->stats.rx_length_errors++; in vortex_rx()
2553 if (vp->bus_master && in vortex_rx()
2555 dma_addr_t dma = dma_map_single(vp->gendev, skb_put(skb, pkt_len), in vortex_rx()
2558 iowrite16((skb->len + 3) & ~3, ioaddr + Wn7_MasterLen); in vortex_rx()
2562 dma_unmap_single(vp->gendev, dma, pkt_len, DMA_FROM_DEVICE); in vortex_rx()
2569 skb->protocol = eth_type_trans(skb, dev); in vortex_rx()
2571 dev->stats.rx_packets++; in vortex_rx()
2573 for (i = 200; i >= 0; i--) in vortex_rx()
2579 dev->name, pkt_len); in vortex_rx()
2580 dev->stats.rx_dropped++; in vortex_rx()
2592 int entry = vp->cur_rx % RX_RING_SIZE; in boomerang_rx()
2593 void __iomem *ioaddr = vp->ioaddr; in boomerang_rx()
2600 while ((rx_status = le32_to_cpu(vp->rx_ring[entry].status)) & RxDComplete){ in boomerang_rx()
2601 if (--rx_work_limit < 0) in boomerang_rx()
2607 dev->stats.rx_errors++; in boomerang_rx()
2608 if (rx_error & 0x01) dev->stats.rx_over_errors++; in boomerang_rx()
2609 if (rx_error & 0x02) dev->stats.rx_length_errors++; in boomerang_rx()
2610 if (rx_error & 0x04) dev->stats.rx_frame_errors++; in boomerang_rx()
2611 if (rx_error & 0x08) dev->stats.rx_crc_errors++; in boomerang_rx()
2612 if (rx_error & 0x10) dev->stats.rx_length_errors++; in boomerang_rx()
2618 dma_addr_t dma = le32_to_cpu(vp->rx_ring[entry].addr); in boomerang_rx()
2629 dma_sync_single_for_cpu(vp->gendev, dma, PKT_BUF_SZ, DMA_FROM_DEVICE); in boomerang_rx()
2631 skb_put_data(skb, vp->rx_skbuff[entry]->data, in boomerang_rx()
2633 dma_sync_single_for_device(vp->gendev, dma, PKT_BUF_SZ, DMA_FROM_DEVICE); in boomerang_rx()
2634 vp->rx_copy++; in boomerang_rx()
2636 /* Pre-allocate the replacement skb. If it or its in boomerang_rx()
2642 dev->stats.rx_dropped++; in boomerang_rx()
2645 newdma = dma_map_single(vp->gendev, newskb->data, in boomerang_rx()
2647 if (dma_mapping_error(vp->gendev, newdma)) { in boomerang_rx()
2648 dev->stats.rx_dropped++; in boomerang_rx()
2654 skb = vp->rx_skbuff[entry]; in boomerang_rx()
2655 vp->rx_skbuff[entry] = newskb; in boomerang_rx()
2656 vp->rx_ring[entry].addr = cpu_to_le32(newdma); in boomerang_rx()
2658 dma_unmap_single(vp->gendev, dma, PKT_BUF_SZ, DMA_FROM_DEVICE); in boomerang_rx()
2659 vp->rx_nocopy++; in boomerang_rx()
2661 skb->protocol = eth_type_trans(skb, dev); in boomerang_rx()
2667 skb->ip_summed = CHECKSUM_UNNECESSARY; in boomerang_rx()
2668 vp->rx_csumhits++; in boomerang_rx()
2672 dev->stats.rx_packets++; in boomerang_rx()
2676 vp->rx_ring[entry].status = 0; /* Clear complete bit. */ in boomerang_rx()
2678 entry = (++vp->cur_rx) % RX_RING_SIZE; in boomerang_rx()
2687 void __iomem *ioaddr = vp->ioaddr; in vortex_down()
2692 del_timer_sync(&vp->timer); in vortex_down()
2694 /* Turn off statistics ASAP. We update dev->stats below. */ in vortex_down()
2704 if (dev->if_port == XCVR_10base2) in vortex_down()
2711 if (vp->full_bus_master_rx) in vortex_down()
2713 if (vp->full_bus_master_tx) in vortex_down()
2717 vp->pm_state_valid = 1; in vortex_down()
2727 void __iomem *ioaddr = vp->ioaddr; in vortex_close()
2735 dev->name, ioread16(ioaddr + EL3_STATUS), ioread8(ioaddr + TxStatus)); in vortex_close()
2737 " tx_queued %d Rx pre-checksummed %d.\n", in vortex_close()
2738 dev->name, vp->rx_nocopy, vp->rx_copy, vp->queued_packet, vp->rx_csumhits); in vortex_close()
2742 if (vp->rx_csumhits && in vortex_close()
2743 (vp->drv_flags & HAS_HWCKSM) == 0 && in vortex_close()
2744 (vp->card_idx >= MAX_UNITS || hw_checksums[vp->card_idx] == -1)) { in vortex_close()
2746 dev->name); in vortex_close()
2750 free_irq(dev->irq, dev); in vortex_close()
2752 if (vp->full_bus_master_rx) { /* Free Boomerang bus master Rx buffers. */ in vortex_close()
2754 if (vp->rx_skbuff[i]) { in vortex_close()
2755 dma_unmap_single(vp->gendev, le32_to_cpu(vp->rx_ring[i].addr), in vortex_close()
2757 dev_kfree_skb(vp->rx_skbuff[i]); in vortex_close()
2758 vp->rx_skbuff[i] = NULL; in vortex_close()
2761 if (vp->full_bus_master_tx) { /* Free Boomerang bus master Tx buffers. */ in vortex_close()
2763 if (vp->tx_skbuff[i]) { in vortex_close()
2764 struct sk_buff *skb = vp->tx_skbuff[i]; in vortex_close()
2768 for (k=0; k<=skb_shinfo(skb)->nr_frags; k++) in vortex_close()
2769 dma_unmap_single(vp->gendev, in vortex_close()
2770 le32_to_cpu(vp->tx_ring[i].frag[k].addr), in vortex_close()
2771 le32_to_cpu(vp->tx_ring[i].frag[k].length)&0xFFF, in vortex_close()
2774 dma_unmap_single(vp->gendev, le32_to_cpu(vp->tx_ring[i].addr), skb->len, DMA_TO_DEVICE); in vortex_close()
2777 vp->tx_skbuff[i] = NULL; in vortex_close()
2790 void __iomem *ioaddr = vp->ioaddr; in dump_tx_ring()
2792 if (vp->full_bus_master_tx) { in dump_tx_ring()
2796 pr_err(" Flags; bus-master %d, dirty %d(%d) current %d(%d)\n", in dump_tx_ring()
2797 vp->full_bus_master_tx, in dump_tx_ring()
2798 vp->dirty_tx, vp->dirty_tx % TX_RING_SIZE, in dump_tx_ring()
2799 vp->cur_tx, vp->cur_tx % TX_RING_SIZE); in dump_tx_ring()
2802 &vp->tx_ring[vp->dirty_tx % TX_RING_SIZE]); in dump_tx_ring()
2808 length = le32_to_cpu(vp->tx_ring[i].frag[0].length); in dump_tx_ring()
2810 length = le32_to_cpu(vp->tx_ring[i].length); in dump_tx_ring()
2813 i, &vp->tx_ring[i], length, in dump_tx_ring()
2814 le32_to_cpu(vp->tx_ring[i].status)); in dump_tx_ring()
2825 void __iomem *ioaddr = vp->ioaddr; in vortex_get_stats()
2829 spin_lock_irqsave (&vp->lock, flags); in vortex_get_stats()
2831 spin_unlock_irqrestore (&vp->lock, flags); in vortex_get_stats()
2833 return &dev->stats; in vortex_get_stats()
2849 dev->stats.tx_carrier_errors += window_read8(vp, 6, 0); in update_stats()
2850 dev->stats.tx_heartbeat_errors += window_read8(vp, 6, 1); in update_stats()
2851 dev->stats.tx_window_errors += window_read8(vp, 6, 4); in update_stats()
2852 dev->stats.rx_fifo_errors += window_read8(vp, 6, 5); in update_stats()
2853 dev->stats.tx_packets += window_read8(vp, 6, 6); in update_stats()
2854 dev->stats.tx_packets += (window_read8(vp, 6, 9) & in update_stats()
2860 dev->stats.rx_bytes += window_read16(vp, 6, 10); in update_stats()
2861 dev->stats.tx_bytes += window_read16(vp, 6, 12); in update_stats()
2863 vp->xstats.tx_multiple_collisions += window_read8(vp, 6, 2); in update_stats()
2864 vp->xstats.tx_single_collisions += window_read8(vp, 6, 3); in update_stats()
2865 vp->xstats.tx_deferred += window_read8(vp, 6, 8); in update_stats()
2866 vp->xstats.rx_bad_ssd += window_read8(vp, 4, 12); in update_stats()
2868 dev->stats.collisions = vp->xstats.tx_multiple_collisions in update_stats()
2869 + vp->xstats.tx_single_collisions in update_stats()
2870 + vp->xstats.tx_max_collisions; in update_stats()
2874 dev->stats.rx_bytes += (up & 0x0f) << 16; in update_stats()
2875 dev->stats.tx_bytes += (up & 0xf0) << 12; in update_stats()
2883 return mii_nway_restart(&vp->mii); in vortex_nway_reset()
2891 mii_ethtool_get_link_ksettings(&vp->mii, cmd); in vortex_get_link_ksettings()
2901 return mii_ethtool_set_link_ksettings(&vp->mii, cmd); in vortex_set_link_ksettings()
2920 return -EOPNOTSUPP; in vortex_get_sset_count()
2928 void __iomem *ioaddr = vp->ioaddr; in vortex_get_ethtool_stats()
2931 spin_lock_irqsave(&vp->lock, flags); in vortex_get_ethtool_stats()
2933 spin_unlock_irqrestore(&vp->lock, flags); in vortex_get_ethtool_stats()
2935 data[0] = vp->xstats.tx_deferred; in vortex_get_ethtool_stats()
2936 data[1] = vp->xstats.tx_max_collisions; in vortex_get_ethtool_stats()
2937 data[2] = vp->xstats.tx_multiple_collisions; in vortex_get_ethtool_stats()
2938 data[3] = vp->xstats.tx_single_collisions; in vortex_get_ethtool_stats()
2939 data[4] = vp->xstats.rx_bad_ssd; in vortex_get_ethtool_stats()
2960 strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); in vortex_get_drvinfo()
2962 strlcpy(info->bus_info, pci_name(VORTEX_PCI(vp)), in vortex_get_drvinfo()
2963 sizeof(info->bus_info)); in vortex_get_drvinfo()
2966 strlcpy(info->bus_info, dev_name(vp->gendev), in vortex_get_drvinfo()
2967 sizeof(info->bus_info)); in vortex_get_drvinfo()
2969 snprintf(info->bus_info, sizeof(info->bus_info), in vortex_get_drvinfo()
2970 "EISA 0x%lx %d", dev->base_addr, dev->irq); in vortex_get_drvinfo()
2981 wol->supported = WAKE_MAGIC; in vortex_get_wol()
2983 wol->wolopts = 0; in vortex_get_wol()
2984 if (vp->enable_wol) in vortex_get_wol()
2985 wol->wolopts |= WAKE_MAGIC; in vortex_get_wol()
2993 return -EOPNOTSUPP; in vortex_set_wol()
2995 if (wol->wolopts & ~WAKE_MAGIC) in vortex_set_wol()
2996 return -EINVAL; in vortex_set_wol()
2998 if (wol->wolopts & WAKE_MAGIC) in vortex_set_wol()
2999 vp->enable_wol = 1; in vortex_set_wol()
3001 vp->enable_wol = 0; in vortex_set_wol()
3034 state = VORTEX_PCI(vp)->current_state; in vortex_ioctl()
3040 err = generic_mii_ioctl(&vp->mii, if_mii(rq), cmd, NULL); in vortex_ioctl()
3049 /* Pre-Cyclone chips have no documented multicast filter, so the only
3055 void __iomem *ioaddr = vp->ioaddr; in set_rx_mode()
3058 if (dev->flags & IFF_PROMISC) { in set_rx_mode()
3060 pr_notice("%s: Setting promiscuous mode.\n", dev->name); in set_rx_mode()
3062 } else if (!netdev_mc_empty(dev) || dev->flags & IFF_ALLMULTI) { in set_rx_mode()
3083 if ((vp->drv_flags&IS_CYCLONE) || (vp->drv_flags&IS_TORNADO)) { in set_8021q_mode()
3087 int max_pkt_size = dev->mtu+14; /* MTU+Ethernet header */ in set_8021q_mode()
3099 vp->large_frames = dev->mtu > 1500 || enable; in set_8021q_mode()
3102 if (vp->large_frames) in set_8021q_mode()
3119 Read and write the MII registers using software-generated serial
3124 met by back-to-back PCI I/O cycles, but we insert a delay to avoid
3143 while (-- bits >= 0) { in mdio_sync()
3159 spin_lock_bh(&vp->mii_lock); in mdio_read()
3165 for (i = 14; i >= 0; i--) { in mdio_read()
3173 /* Read the two transition, 16 data, and wire-idle bits. */ in mdio_read()
3174 for (i = 19; i > 0; i--) { in mdio_read()
3185 spin_unlock_bh(&vp->mii_lock); in mdio_read()
3196 spin_lock_bh(&vp->mii_lock); in mdio_write()
3202 for (i = 31; i >= 0; i--) { in mdio_write()
3211 for (i = 1; i >= 0; i--) { in mdio_write()
3219 spin_unlock_bh(&vp->mii_lock); in mdio_write()
3223 /* Set Wake-On-LAN mode and put the board into D3 (power-down) state. */
3227 void __iomem *ioaddr = vp->ioaddr; in acpi_set_WOL()
3229 device_set_wakeup_enable(vp->gendev, vp->enable_wol); in acpi_set_WOL()
3231 if (vp->enable_wol) { in acpi_set_WOL()
3241 vp->enable_wol = 0; in acpi_set_WOL()
3245 if (VORTEX_PCI(vp)->current_state < PCI_D3hot) in acpi_set_WOL()
3266 if (vp->cb_fn_base) in vortex_remove_one()
3267 pci_iounmap(pdev, vp->cb_fn_base); in vortex_remove_one()
3272 if (vp->pm_state_valid) in vortex_remove_one()
3277 iowrite16(TotalReset | ((vp->drv_flags & EEPROM_RESET) ? 0x04 : 0x14), in vortex_remove_one()
3278 vp->ioaddr + EL3_CMD); in vortex_remove_one()
3280 pci_iounmap(pdev, vp->ioaddr); in vortex_remove_one()
3282 dma_free_coherent(&pdev->dev, in vortex_remove_one()
3285 vp->rx_ring, vp->rx_ring_dma); in vortex_remove_one()
3318 return (vortex_have_pci + vortex_have_eisa) ? 0 : -ENODEV; in vortex_init()
3332 ioaddr = ioport_map(compaq_net_device->base_addr, in vortex_eisa_cleanup()
3337 release_region(compaq_net_device->base_addr, in vortex_eisa_cleanup()