86 #define HP100_DEFAULT_PRIORITY_TX 0
92 #undef HP100_DEBUG_TRAINING
94 #undef HP100_DEBUG_IRQ
97 #undef HP100_MULTICAST_FILTER
99 #include <linux/module.h>
100 #include <linux/kernel.h>
101 #include <linux/sched.h>
102 #include <linux/string.h>
103 #include <linux/errno.h>
107 #include <linux/pci.h>
110 #include <linux/netdevice.h>
113 #include <linux/types.h>
116 #include <linux/bitops.h>
127 #define HP100_BUS_ISA 0
128 #define HP100_BUS_EISA 1
129 #define HP100_BUS_PCI 2
131 #define HP100_REGION_SIZE 0x20
132 #define HP100_SIG_LEN 8
134 #define HP100_MAX_PACKET_SIZE (1536+4)
135 #define HP100_MIN_PACKET_SIZE 60
137 #ifndef HP100_DEFAULT_RX_RATIO
139 #define HP100_DEFAULT_RX_RATIO 75
142 #ifndef HP100_DEFAULT_PRIORITY_TX
144 #define HP100_DEFAULT_PRIORITY_TX 0
191 static const char *hp100_isa_tbl[] = {
226 static int hp100_mode = 1;
251 static void hp100_set_multicast_list(
struct net_device *
dev);
266 register u_int * pdlptr);
269 register u_int * pdlptr);
291 return pci_map_single(lp->
pci_dev, data,
296 static void wait(
void)
311 static __devinit const char *hp100_read_id(
int ioaddr)
315 unsigned char sig[4],
sum;
320 for (i = 0; i < 4; i++) {
329 str[0] = ((sig[0] >> 2) & 0x1f) + (
'A' - 1);
330 str[1] = (((sig[0] & 3) << 3) | (sig[1] >> 5)) + (
'A' - 1);
331 str[2] = (sig[1] & 0x1f) + (
'A' - 1);
332 rev = (sig[2] << 8) | sig[3];
352 sig = hp100_read_id(ioaddr);
358 for (i = 0; i <
ARRAY_SIZE(hp100_isa_tbl); i++) {
359 if (!
strcmp(hp100_isa_tbl[i], sig))
380 if (addr > 0xff && addr < 0x400)
381 err = hp100_isa_probe1(dev, addr);
388 for (addr = 0x100; addr < 0x400; addr += 0x20) {
389 err = hp100_isa_probe1(dev, addr);
398 #if !defined(MODULE) && defined(CONFIG_ISA)
417 err = hp100_isa_probe(dev, dev->
base_addr);
429 .ndo_open = hp100_open,
430 .ndo_stop = hp100_close,
431 .ndo_start_xmit = hp100_start_xmit_bm,
432 .ndo_get_stats = hp100_get_stats,
433 .ndo_set_rx_mode = hp100_set_multicast_list,
440 .ndo_open = hp100_open,
441 .ndo_stop = hp100_close,
442 .ndo_start_xmit = hp100_start_xmit,
443 .ndo_get_stats = hp100_get_stats,
444 .ndo_set_rx_mode = hp100_set_multicast_list,
461 unsigned long mem_ptr_phys;
480 printk(
"hp100: %s: Shasta Chip detected. (This is a pre 802.12 chip)\n", dev->
name);
482 printk(
"hp100: %s: Rainier Chip detected. (This is a pre 802.12 chip)\n", dev->
name);
484 printk(
"hp100: %s: Lassen Chip detected.\n", dev->
name);
486 printk(
"hp100: %s: Warning: Unknown CASCADE chip (id=0x%.4x).\n", dev->
name, chip);
491 eid = hp100_read_id(ioaddr);
498 for (i = uc = 0; i < 7; i++)
508 hp100_load_eeprom(dev, ioaddr);
539 local_mode = hp100_mode;
540 if (local_mode < 1 || local_mode > 4)
543 printk(
"hp100: %s: original LSW = 0x%x\n", dev->
name,
547 if (local_mode == 3) {
551 printk(
"hp100: IO mapped mode forced.\n");
552 }
else if (local_mode == 2) {
556 printk(
"hp100: Shared memory mode requested.\n");
557 }
else if (local_mode == 4) {
561 printk(
"hp100: Busmaster mode requested.\n");
566 if (local_mode == 1) {
572 printk(
"hp100: %s: IO_EN bit is set on card.\n", dev->
name);
587 printk(
"hp100: Busmaster mode enabled.\n");
592 printk(
"hp100: %s: Card not configured for BM or BM not supported with this card.\n", dev->
name);
593 printk(
"hp100: %s: Trying shared memory mode.\n", dev->
name);
610 memory_size = (8192 << ((
hp100_inb(SRAM) >> 5) & 0x07));
614 if (mem_mapped || (local_mode == 1)) {
616 mem_ptr_phys &= ~0x1fff;
618 if (bus ==
HP100_BUS_ISA && (mem_ptr_phys & ~0xfffff) != 0) {
619 printk(
"hp100: Can only use programmed i/o mode.\n");
627 if (local_mode != 1) {
636 printk(
"hp100: %s: remapped 0x%x bytes high PCI memory at 0x%lx to %p.\n", dev->
name,
virt_memory_size, mem_ptr_phys, mem_ptr_virt);
642 if (mem_ptr_virt ==
NULL) {
643 printk(
"hp100: Failed to ioremap the PCI card memory. Will have to use i/o mapped mode.\n");
650 if (local_mode == 3) {
654 printk(
"hp100: Using (slow) programmed i/o mode.\n");
658 lp = netdev_priv(dev);
663 lp->
mode = local_mode;
702 for (i = uc = 0; i < 6; i++)
706 hp100_clear_stats(lp, ioaddr);
730 #ifdef HP100_DEBUG_BM
746 lp->
lan_type = hp100_sense_lan(dev);
749 printk(
"hp100: at 0x%x, IRQ %d, ", ioaddr, dev->
irq);
764 printk(
"hp100: Memory area at 0x%lx-0x%lx", mem_ptr_phys,
765 (mem_ptr_phys + (mem_ptr_phys > 0x100000 ? (
u_long) lp->
memory_size : 16 * 1024)) - 1);
767 printk(
" (virtual base %p)", mem_ptr_virt);
777 printk(
"Adapter is attached to ");
780 printk(
"100Mb/s Voice Grade AnyLAN network.\n");
783 printk(
"10Mb/s network (10baseT).\n");
786 printk(
"10Mb/s network (coax).\n");
789 printk(
"Warning! Link down.\n");
812 static void hp100_hwinit(
struct net_device *dev)
833 hp100_BM_shutdown(dev);
837 hp100_cascade_reset(dev, 1);
843 hp100_load_eeprom(dev, 0);
848 hp100_cascade_reset(dev, 1);
891 hp100_cascade_reset(dev, 0);
897 hp100_login_to_vg_hub(dev, 0);
906 static void hp100_mmuinit(
struct net_device *dev)
919 printk(
"hp100: %s: Not in reset when entering mmuinit. Fix me.\n", dev->
name);
949 }
else if (lp->
mode == 2) {
955 }
else if (lp->
mode == 3) {
994 int xmit_stop, recv_stop;
1008 xmit_stop = (pdl_stop - 508 * (
MAX_RX_PDL) - 16) & ~(0x03ff);
1009 recv_stop = (xmit_stop * (lp->
rx_ratio) / 100) & ~(0x03ff);
1010 hp100_outw((pdl_stop >> 4) - 1, PDL_MEM_STOP);
1011 #ifdef HP100_DEBUG_BM
1012 printk(
"hp100: %s: PDL_STOP = 0x%x\n", dev->
name, pdl_stop);
1022 #ifdef HP100_DEBUG_BM
1023 printk(
"hp100: %s: TX_STOP = 0x%x\n", dev->
name, xmit_stop >> 4);
1024 printk(
"hp100: %s: RX_STOP = 0x%x\n", dev->
name, recv_stop >> 4);
1038 for (i = 0; i < 6; i++)
1042 for (i = 0; i < 8; i++)
1073 hp100_init_pdls(dev);
1085 static int hp100_open(
struct net_device *dev)
1088 #ifdef HP100_DEBUG_B
1092 #ifdef HP100_DEBUG_B
1102 printk(
"hp100: %s: unable to get IRQ %d\n", dev->
name, dev->
irq);
1107 netif_start_queue(dev);
1109 lp->
lan_type = hp100_sense_lan(dev);
1114 hp100_stop_interface(dev);
1118 hp100_start_interface(dev);
1124 static int hp100_close(
struct net_device *dev)
1129 #ifdef HP100_DEBUG_B
1137 hp100_stop_interface(dev);
1140 lp->
hub_status = hp100_login_to_vg_hub(dev, 0);
1142 netif_stop_queue(dev);
1147 printk(
"hp100: %s: close LSW = 0x%x\n", dev->
name,
1158 static void hp100_init_pdls(
struct net_device *dev)
1165 #ifdef HP100_DEBUG_B
1169 #ifdef HP100_DEBUG_B
1175 printk(
"hp100: %s: Warning: lp->page_vaddr_algn not initialised!\n", dev->
name);
1191 pageptr += hp100_init_rxpdl(dev, ringptr, pageptr);
1200 pageptr += hp100_init_txpdl(dev, ringptr, pageptr);
1208 static int hp100_init_rxpdl(
struct net_device *dev,
1210 register u32 * pdlptr)
1214 if (0 != (((
unsigned long) pdlptr) & 0xf))
1215 printk(
"hp100: %s: Init rxpdl: Unaligned pdlptr 0x%lx.\n",
1216 dev->
name, (
unsigned long) pdlptr);
1218 ringptr->
pdl = pdlptr + 1;
1219 ringptr->
pdl_paddr = virt_to_whatever(dev, pdlptr + 1);
1230 *(pdlptr + 2) = (
u_int) virt_to_whatever(dev, pdlptr);
1237 static int hp100_init_txpdl(
struct net_device *dev,
1239 register u32 * pdlptr)
1241 if (0 != (((
unsigned long) pdlptr) & 0xf))
1242 printk(
"hp100: %s: Init txpdl: Unaligned pdlptr 0x%lx.\n", dev->
name, (
unsigned long) pdlptr);
1244 ringptr->
pdl = pdlptr;
1245 ringptr->
pdl_paddr = virt_to_whatever(dev, pdlptr);
1261 #ifdef HP100_DEBUG_B
1264 #ifdef HP100_DEBUG_BM
1268 #ifdef HP100_DEBUG_B
1270 printk(
"hp100: %s: build rx pdl\n", dev->
name);
1285 skb_reserve(ringptr->
skb, 2);
1296 #ifdef HP100_DEBUG_BM
1297 printk(
"hp100: %s: build_rx_pdl: PDH@0x%x, skb->data (len %d) at 0x%x\n",
1300 (
unsigned int) ringptr->
skb->data);
1305 ringptr->
pdl[0] = 0x00020000;
1306 ringptr->
pdl[3] = pdl_map_data(netdev_priv(dev),
1307 ringptr->
skb->data);
1310 #ifdef HP100_DEBUG_BM
1311 for (p = (ringptr->
pdl); p < (ringptr->
pdl + 5); p++)
1321 #ifdef HP100_DEBUG_BM
1322 printk(
"hp100: %s: build_rx_pdl: PDH@0x%x, No space for skb.\n", dev->
name, (
u_int) ringptr->
pdl);
1325 ringptr->
pdl[0] = 0x00010000;
1340 static void hp100_rxfill(
struct net_device *dev)
1347 #ifdef HP100_DEBUG_B
1359 if (0 == hp100_build_rx_pdl(ringptr, dev)) {
1365 #ifdef HP100_DEBUG_BM
1366 printk(
"hp100: %s: rxfill: Hand to card: pdl #%d @0x%x phys:0x%x, buffer: 0x%x\n",
1382 static void hp100_BM_shutdown(
struct net_device *dev)
1388 #ifdef HP100_DEBUG_B
1390 printk(
"hp100: %s: bm shutdown\n", dev->
name);
1405 if (0 != (
hp100_inw(OPTION_LSW) & HP100_HW_RST)) {
1410 for (time = 0; time < 5000; time++) {
1421 for (time = 0; time < 32000; time++) {
1431 for (time = 0; time < 10000; time++) {
1439 printk(
"hp100: %s: BM shutdown error.\n", dev->
name);
1446 for (time = 0; time < 10000; time++) {
1457 hp100_cascade_reset(dev, 1);
1464 static int hp100_check_lan(
struct net_device *dev)
1469 hp100_stop_interface(dev);
1470 if ((lp->
lan_type = hp100_sense_lan(dev)) < 0) {
1471 printk(
"hp100: %s: no connection found - check wire\n", dev->
name);
1472 hp100_start_interface(dev);
1476 lp->
hub_status = hp100_login_to_vg_hub(dev, 0);
1477 hp100_start_interface(dev);
1490 unsigned long flags;
1496 #ifdef HP100_DEBUG_B
1498 printk(
"hp100: %s: start_xmit_bm\n", dev->
name);
1510 printk(
"hp100: %s: start_xmit_bm: No TX PDL available.\n", dev->
name);
1516 if (hp100_check_lan(dev))
1521 printk(
"hp100: %s: login to 100Mb/s hub retry\n", dev->
name);
1522 hp100_stop_interface(dev);
1523 lp->
hub_status = hp100_login_to_vg_hub(dev, 0);
1524 hp100_start_interface(dev);
1528 i = hp100_sense_lan(dev);
1530 spin_unlock_irqrestore(&lp->
lock, flags);
1532 printk(
"hp100: %s: link down detected\n", dev->
name);
1535 printk(
"hp100: %s: cable change 10Mb/s <-> 100Mb/s detected\n", dev->
name);
1537 hp100_stop_interface(dev);
1539 lp->
hub_status = hp100_login_to_vg_hub(dev, 0);
1540 hp100_start_interface(dev);
1542 printk(
"hp100: %s: interface reset\n", dev->
name);
1543 hp100_stop_interface(dev);
1545 lp->
hub_status = hp100_login_to_vg_hub(dev, 0);
1546 hp100_start_interface(dev);
1566 ringptr->
pdl[0] = ((1 << 16) | i);
1569 ringptr->
pdl[2] =
i;
1572 ringptr->
pdl[2] = skb->
len;
1583 dev->
stats.tx_packets++;
1586 spin_unlock_irqrestore(&lp->
lock, flags);
1603 static void hp100_clean_txring(
struct net_device *dev)
1609 #ifdef HP100_DEBUG_B
1611 printk(
"hp100: %s: clean txring\n", dev->
name);
1619 printk(
"hp100: %s: Warning: More PDLs transmitted than committed to card???\n", dev->
name);
1622 for (; 0 != donecount; donecount--) {
1623 #ifdef HP100_DEBUG_BM
1624 printk(
"hp100: %s: Free skb: data @0x%.8x txrcommit=0x%x TXPDL=0x%x, done=0x%x\n",
1641 unsigned long flags;
1647 #ifdef HP100_DEBUG_B
1649 printk(
"hp100: %s: start_xmit\n", dev->
name);
1654 if (hp100_check_lan(dev))
1658 i =
hp100_inl(TX_MEM_FREE) & 0x7fffffff;
1659 if (!(((i / 2) - 539) > (skb->
len + 16) && (
hp100_inb(TX_PKT_CNT) < 255))) {
1661 printk(
"hp100: %s: start_xmit: tx free mem = 0x%x\n", dev->
name, i);
1666 printk(
"hp100: %s: trans_start timing problem\n",
1673 printk(
"hp100: %s: login to 100Mb/s hub retry\n", dev->
name);
1674 hp100_stop_interface(dev);
1675 lp->
hub_status = hp100_login_to_vg_hub(dev, 0);
1676 hp100_start_interface(dev);
1680 i = hp100_sense_lan(dev);
1682 spin_unlock_irqrestore(&lp->
lock, flags);
1684 printk(
"hp100: %s: link down detected\n", dev->
name);
1687 printk(
"hp100: %s: cable change 10Mb/s <-> 100Mb/s detected\n", dev->
name);
1689 hp100_stop_interface(dev);
1691 lp->
hub_status = hp100_login_to_vg_hub(dev, 0);
1692 hp100_start_interface(dev);
1694 printk(
"hp100: %s: interface reset\n", dev->
name);
1695 hp100_stop_interface(dev);
1697 lp->
hub_status = hp100_login_to_vg_hub(dev, 0);
1698 hp100_start_interface(dev);
1706 #ifdef HP100_DEBUG_TX
1707 printk(
"hp100: %s: start_xmit: busy\n", dev->
name);
1717 #ifdef HP100_DEBUG_TX
1718 printk(
"hp100: %s: start_xmit: irq_status=0x%.4x, irqmask=0x%.4x, len=%d\n",
1728 if (lp->
mode == 2) {
1735 (skb->
len + 3) >> 2);
1743 dev->
stats.tx_packets++;
1746 spin_unlock_irqrestore(&lp->
lock, flags);
1750 #ifdef HP100_DEBUG_TX
1751 printk(
"hp100: %s: start_xmit: end\n", dev->
name);
1789 #ifdef HP100_DEBUG_RX
1791 printk(
"hp100: %s: rx: waiting packets = %d\n", dev->
name, packets);
1794 while (packets-- > 0) {
1798 #ifdef HP100_DEBUG_RX
1799 printk (
"hp100: %s: rx: busy, remaining packets = %d\n", dev->
name, packets);
1805 if (lp->
mode == 2) {
1812 #ifdef HP100_DEBUG_RX
1813 printk(
"hp100: %s: rx: new packet - length=%d, errors=0x%x, dest=0x%x\n",
1815 (header >> 16) & 0xfff8, (header >> 16) & 7);
1819 skb = netdev_alloc_skb(dev, pkt_len + 2);
1822 printk(
"hp100: %s: rx: couldn't allocate a sk_buff of size %d\n",
1823 dev->
name, pkt_len);
1825 dev->
stats.rx_dropped++;
1844 #ifdef HP100_DEBUG_RX
1845 printk(
"hp100: %s: rx: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",
1846 dev->
name, ptr[0], ptr[1], ptr[2], ptr[3],
1847 ptr[4], ptr[5], ptr[6], ptr[7], ptr[8],
1848 ptr[9], ptr[10], ptr[11]);
1851 dev->
stats.rx_packets++;
1858 switch (header & 0x00070000) {
1861 dev->
stats.multicast++;
1865 #ifdef HP100_DEBUG_RX
1873 static void hp100_rx_bm(
struct net_device *dev)
1881 #ifdef HP100_DEBUG_B
1888 printk(
"hp100: %s: rx_bm called although no PDLs were committed to adapter?\n", dev->
name);
1894 printk(
"hp100: %s: More packets received than committed? RX_PKT_CNT=0x%x, commit=0x%x\n",
1912 header = *(ptr->
pdl - 1);
1918 #ifdef HP100_DEBUG_BM
1919 printk(
"hp100: %s: rx_bm: header@0x%x=0x%x length=%d, errors=0x%x, dest=0x%x\n",
1921 pkt_len, (header >> 16) & 0xfff8, (header >> 16) & 7);
1922 printk(
"hp100: %s: RX_PDL_COUNT:0x%x TX_PDL_COUNT:0x%x, RX_PKT_CNT=0x%x PDH=0x%x, Data@0x%x len=0x%x\n",
1931 printk(
"hp100: %s: rx_bm: skb null\n", dev->
name);
1933 dev->
stats.rx_dropped++;
1936 ptr->
skb->protocol =
1941 dev->
stats.rx_packets++;
1945 switch (header & 0x00070000) {
1948 dev->
stats.multicast++;
1953 printk(
"hp100: %s: rx_bm: Received bad packet (length=%d)\n", dev->
name, pkt_len);
1957 dev->
stats.rx_errors++;
1963 if (0 == hp100_build_rx_pdl(lp->
rxrtail, dev)) {
1966 printk(
"hp100: %s: rx_bm: No space for new PDL.\n", dev->
name);
1982 unsigned long flags;
1986 #ifdef HP100_DEBUG_B
1992 hp100_update_stats(dev);
1994 spin_unlock_irqrestore(&lp->
lock, flags);
1995 return &(dev->
stats);
1998 static void hp100_update_stats(
struct net_device *dev)
2003 #ifdef HP100_DEBUG_B
2005 printk(
"hp100: %s: update-stats\n", dev->
name);
2018 dev->
stats.tx_aborted_errors +=
val;
2022 static void hp100_misc_interrupt(
struct net_device *dev)
2024 #ifdef HP100_DEBUG_B
2028 #ifdef HP100_DEBUG_B
2031 printk(
"hp100: %s: misc_interrupt\n", dev->
name);
2035 dev->
stats.rx_errors++;
2036 dev->
stats.tx_errors++;
2039 static void hp100_clear_stats(
struct hp100_private *lp,
int ioaddr)
2041 unsigned long flags;
2043 #ifdef HP100_DEBUG_B
2045 printk(
"hp100: %s: clear_stats\n", dev->
name);
2054 spin_unlock_irqrestore(&lp->
lock, flags);
2066 static void hp100_set_multicast_list(
struct net_device *dev)
2068 unsigned long flags;
2072 #ifdef HP100_DEBUG_B
2074 printk(
"hp100: %s: set_mc_list\n", dev->
name);
2089 #ifdef HP100_MULTICAST_FILTER
2100 printk(
"hp100: %s: computing hash filter - mc_count = %i\n",
2106 printk(
"hp100: %s: multicast = %pM, ",
2109 for (i = idx = 0; i < 6; i++) {
2110 idx ^= *addrs++ & 0x3f;
2114 printk(
"idx = %i\n", idx);
2116 lp->
hash_bytes[idx >> 3] |= (1 << (idx & 7));
2137 for (i = 0; i < 8; i++)
2140 printk(
"hp100: %s: mac1 = 0x%x, mac2 = 0x%x, multicast hash = %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n",
2150 printk(
"hp100: %s: 100VG MAC settings have changed - relogin.\n", dev->
name);
2152 lp->
hub_status = hp100_login_to_vg_hub(dev, 1);
2156 u_char old_hash_bytes[8];
2159 for (i = 0; i < 8; i++)
2160 old_hash_bytes[i] =
hp100_inb(HASH_BYTE0 + i);
2162 for (i = 0; i < 8; i++)
2165 printk(
"hp100: %s: multicast hash = %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n",
2175 printk(
"hp100: %s: 100VG MAC settings have changed - relogin.\n", dev->
name);
2177 lp->
hub_status = hp100_login_to_vg_hub(dev, 1);
2188 spin_unlock_irqrestore(&lp->
lock, flags);
2207 spin_lock(&lp->
lock);
2211 #ifdef HP100_DEBUG_B
2217 #ifdef HP100_DEBUG_IRQ
2218 printk(
"hp100: %s: mode=%x,IRQ_STAT=0x%.4x,RXPKTCNT=0x%.2x RXPDL=0x%.2x TXPKTCNT=0x%.2x TXPDL=0x%.2x\n",
2224 spin_unlock(&lp->
lock);
2240 printk(
"hp100: %s: rx_pdl_fill_compl interrupt although not busmaster?\n", dev->
name);
2255 else if (!(val & HP100_RX_PDL_FILL_COMPL)) {
2276 #ifdef HP100_DEBUG_IRQ
2277 printk(
"hp100: %s: TX/RX Error IRQ\n", dev->
name);
2279 hp100_update_stats(dev);
2280 if (lp->
mode == 1) {
2282 hp100_clean_txring(dev);
2297 hp100_clean_txring(dev);
2304 #ifdef HP100_DEBUG_IRQ
2306 (
"hp100: %s: Misc. Error Interrupt - Check cabling.\n",
2309 if (lp->
mode == 1) {
2310 hp100_clean_txring(dev);
2313 hp100_misc_interrupt(dev);
2316 spin_unlock(&lp->
lock);
2325 static void hp100_start_interface(
struct net_device *dev)
2327 unsigned long flags;
2331 #ifdef HP100_DEBUG_B
2333 printk(
"hp100: %s: hp100_start_interface\n", dev->
name);
2348 if (lp->
mode == 1) {
2353 }
else if (lp->
mode == 2) {
2363 if (lp->
mode == 1) {
2380 spin_unlock_irqrestore(&lp->
lock, flags);
2383 hp100_set_multicast_list(dev);
2386 static void hp100_stop_interface(
struct net_device *dev)
2392 #ifdef HP100_DEBUG_B
2393 printk(
"hp100: %s: hp100_stop_interface\n", dev->
name);
2398 hp100_BM_shutdown(dev);
2409 if (!(val & HP100_HW_RST))
2412 for (val = 0; val < 6000; val++)
2417 printk(
"hp100: %s: hp100_stop_interface - timeout\n", dev->
name);
2425 int ioaddr = probe_ioaddr > 0 ? probe_ioaddr : dev->
base_addr;
2427 #ifdef HP100_DEBUG_B
2434 for (i = 0; i < 10000; i++)
2437 printk(
"hp100: %s: hp100_load_eeprom - timeout\n", dev->
name);
2445 static int hp100_sense_lan(
struct net_device *dev)
2451 #ifdef HP100_DEBUG_B
2460 printk(
"hp100: %s: sense_lan: val_VG = 0x%04x, val_10 = 0x%04x\n",
2461 dev->
name, val_VG, val_10);
2493 static int hp100_down_vg_link(
struct net_device *dev)
2498 long savelan, newlan;
2500 #ifdef HP100_DEBUG_B
2502 printk(
"hp100: %s: down_vg_link\n", dev->
name);
2533 printk(
"hp100: %s: down_vg_link: Link does not go down?\n", dev->
name);
2555 savelan = newlan =
hp100_inl(10_LAN_CFG_1);
2584 printk(
"hp100: %s: down_vg_link: timeout\n", dev->
name);
2606 #ifdef HP100_DEBUG_B
2608 printk(
"hp100: %s: login_to_vg_hub\n", dev->
name);
2617 if ((force_relogin == 1) || (
hp100_inb(MAC_CFG_4) & HP100_MAC_SEL_ST)) {
2618 #ifdef HP100_DEBUG_TRAINING
2619 printk(
"hp100: %s: Start training\n", dev->
name);
2633 #ifdef HP100_DEBUG_TRAINING
2634 printk(
"hp100: %s: Bring down the link\n", dev->
name);
2640 if (~(
hp100_inb(VG_LAN_CFG_1) & HP100_LINK_UP_ST))
2683 #ifdef HP100_DEBUG_TRAINING
2684 printk(
"hp100: %s: Link cable status not ok? Training aborted.\n", dev->
name);
2687 #ifdef HP100_DEBUG_TRAINING
2689 (
"hp100: %s: HUB tones detected. Trying to train.\n",
2696 if ((val & (HP100_LINK_UP_ST))) {
2697 #ifdef HP100_DEBUG_TRAINING
2698 printk(
"hp100: %s: Passed training.\n", dev->
name);
2709 #ifdef HP100_DEBUG_TRAINING
2710 printk(
"hp100: %s: Successfully logged into the HUB.\n", dev->
name);
2713 printk(
"hp100: %s: Card supports 100VG MAC Version \"%s\" ",
2721 printk(
"hp100: %s: Problem logging into the HUB.\n", dev->
name);
2725 #ifdef HP100_DEBUG_TRAINING
2726 printk(
"hp100: %s: MAC Configuration requested: 0x%04x, HUB allowed: 0x%04x\n", dev->
name,
hp100_inw(TRAIN_REQUEST), val);
2729 printk(
"hp100: %s: HUB access denied.\n", dev->
name);
2731 printk(
"hp100: %s: MAC Configuration is incompatible with the Network.\n", dev->
name);
2733 printk(
"hp100: %s: Duplicate MAC Address on the Network.\n", dev->
name);
2751 if (val & HP100_LINK_UP_ST)
2754 printk(
"hp100: %s: Training failed.\n", dev->
name);
2755 hp100_down_vg_link(dev);
2768 #ifdef HP100_DEBUG_B
2770 printk(
"hp100: %s: cascade_reset\n", dev->
name);
2795 void hp100_RegisterDump(
struct net_device *dev)
2802 printk(
"hp100: %s: Cascade Register Dump\n", dev->
name);
2809 for (Page = 0; Page < 8; Page++) {
2811 printk(
"page: 0x%.2x\n", Page);
2812 outw(Page, ioaddr + 0x02);
2813 for (Register = 0x8; Register < 0x22; Register += 2) {
2815 if (((Register != 0x10) && (Register != 0x12)) || (Page > 0)) {
2816 printk(
"0x%.2x = 0x%.4x\n", Register,
inw(ioaddr + Register));
2843 static int __init hp100_eisa_probe (
struct device *gendev)
2859 printk(
"hp100: %s: EISA adapter found at 0x%x\n", dev->
name,
2880 .probe = hp100_eisa_probe,
2887 static int __devinit hp100_pci_probe (
struct pci_dev *pdev,
2906 pci_read_config_word(pdev,
PCI_COMMAND, &pci_command);
2909 printk(
"hp100: %s: PCI I/O Bit has not been set. Setting...\n", dev->
name);
2912 pci_write_config_word(pdev,
PCI_COMMAND, pci_command);
2917 printk(
"hp100: %s: PCI Master Bit has not been set. Setting...\n", dev->
name);
2920 pci_write_config_word(pdev,
PCI_COMMAND, pci_command);
2929 printk(
"hp100: %s: PCI adapter found at 0x%x\n", dev->
name, ioaddr);
2931 pci_set_drvdata(pdev, dev);
2940 static void __devexit hp100_pci_remove (
struct pci_dev *pdev)
2942 struct net_device *dev = pci_get_drvdata(pdev);
2949 static struct pci_driver hp100_pci_driver = {
2951 .id_table = hp100_pci_tbl,
2952 .probe = hp100_pci_probe,
2964 MODULE_DESCRIPTION(
"HP CASCADE Architecture Driver for 100VG-AnyLan Network Adapters");
2972 #if defined(MODULE) && defined(CONFIG_ISA)
2973 #define HP100_DEVICES 5
2975 static int hp100_port[HP100_DEVICES] = { 0, [1 ... (HP100_DEVICES-1)] = -1 };
2979 static struct net_device *hp100_devlist[HP100_DEVICES];
2987 if (hp100_port[0] == 0)
2991 for (i = 0; i < HP100_DEVICES && hp100_port[
i] != -1; ++
i) {
2995 cleanup_dev(hp100_devlist[--cards]);
3000 err = hp100_isa_probe(dev, hp100_port[i]);
3002 hp100_devlist[cards++] =
dev;
3007 return cards > 0 ? 0 : -
ENODEV;
3014 for (i = 0; i < HP100_DEVICES; i++) {
3021 #define hp100_isa_init() (0)
3022 #define hp100_isa_cleanup() do { } while(0)
3025 static int __init hp100_module_init(
void)
3030 if (err && err != -
ENODEV)
3034 if (err && err != -
ENODEV)
3038 err = pci_register_driver(&hp100_pci_driver);
3039 if (err && err != -
ENODEV)
3054 static void __exit hp100_module_exit(
void)