Date: Wed, 14 Aug 1996 18:13:39 +0930 (CST) From: Michael Smith <msmith@atrad.adelaide.edu.au> To: mobile@freebsd.org Subject: New ed_pccard_probe routine Message-ID: <199608140843.SAA00963@genesis.atrad.adelaide.edu.au>
next in thread | raw e-mail | index | archive | help
Ok, I finally spat the dummy and decided to try to fix the PCCARD support in the 'ed' driver. (I have no idea how it might ever have worked for anyone before). Task 1 was to make the probe work for non-shared-memory cards. I believe that I've achieved this, and I'd like testers, both from the NE2000-clone population (all I have to test with), and also from others with 'ed' PCCARDs that have shared memory. I'd be _particularly_ interested in having the Nomads try this out, as they're to blame^H^H^H^H^H^H^H^Hresponsible for the first version 8) Next task is proper suspend/resume handling without requiring a reinsert. Here's the diff (against -current): *** /sys/i386/isa/if_ed.c Wed Aug 7 17:05:39 1996 --- if_ed.c Wed Aug 14 10:25:12 1996 *************** *** 1364,1474 **** #if NCRD > 0 /* ! * Probe and vendor-specific initialization routine for PCCARDs */ static int ed_probe_pccard(isa_dev, ether) struct isa_device *isa_dev; u_char *ether; { ! struct ed_softc *sc = &ed_softc[isa_dev->id_unit]; ! int i; ! u_int memsize; ! u_char isa16bit; ! sc->nic_addr = isa_dev->id_iobase; ! sc->gone = 0; ! sc->is790 = 0; ! sc->cr_proto = ED_CR_RD2; ! sc->vendor = ED_VENDOR_PCCARD; ! sc->type = 0; ! sc->type_str = "PCCARD"; ! sc->kdc.kdc_description = "PCCARD Ethernet"; ! sc->mem_size = isa_dev->id_msize = memsize = 16384; ! sc->isa16bit = isa16bit = 1; ! for (i = 0; i < ETHER_ADDR_LEN; ++i) ! sc->arpcom.ac_enaddr[i] = ether[i]; ! ! #if ED_DEBUG ! printf("type = %x type_str=%s isa16bit=%d memsize=%d id_msize=%d\n", ! sc->type, sc->type_str, isa16bit, memsize, isa_dev->id_msize); ! #endif ! ! i = inb(sc->nic_addr + ED_PC_RESET); ! DELAY(100000); ! outb(sc->nic_addr + ED_PC_RESET,i); ! DELAY(100000); ! i = inb(sc->nic_addr + ED_PC_MISC); ! if (!i) { ! int j; ! printf("ed_probe_pccard: possible failure\n"); ! for (j=0;j<20 && !i;j++) { ! printf("."); ! DELAY(100000); ! i = inb(sc->nic_addr + ED_PC_MISC); ! } ! if (!i) { ! printf("dead :-(\n"); ! return 0; ! } ! printf("\n"); ! } ! /* ! * Set initial values for width/size. ! */ ! ! /* Make sure that we really have an 8390 based board */ ! if (!ed_probe_generic8390(sc)) { ! printf("ed_probe_generic8390 failed\n"); ! return (0); ! } ! sc->txb_cnt = 2; ! sc->tx_page_start = ED_PC_PAGE_OFFSET; ! sc->rec_page_start = sc->tx_page_start + ED_TXBUF_SIZE * sc->txb_cnt; ! sc->rec_page_stop = sc->tx_page_start + memsize / ED_PAGE_SIZE; ! ! sc->mem_shared = 1; ! sc->mem_start = (caddr_t) isa_dev->id_maddr; ! sc->mem_size = memsize; ! sc->mem_end = sc->mem_start + memsize; ! ! sc->mem_ring = sc->mem_start + ! sc->txb_cnt * ED_PAGE_SIZE * ED_TXBUF_SIZE; ! ! /* ! * Now zero memory and verify that it is clear ! */ ! bzero(sc->mem_start, memsize); ! ! for (i = 0; i < memsize; ++i) { ! if (sc->mem_start[i]) { ! printf("ed%d: failed to clear shared memory at %lx - check configuration\n", ! isa_dev->id_unit, kvtop(sc->mem_start + i)); ! ! return (0); ! } ! sc->mem_start[i] = (i - 5) & 0xff; ! } ! for (i = 0; i < memsize; ++i) { ! if ((sc->mem_start[i] & 0xff) != ((i - 5) & 0xff)) { ! printf("ed%d: shared memory failed at %lx (%x != %x) - check configuration\n", ! isa_dev->id_unit, kvtop(sc->mem_start + i), ! sc->mem_start[i], (i-5) & 0xff); ! return (0); ! ! } ! } ! ! i = inb(sc->nic_addr + ED_PC_MISC); ! if (!i) { ! printf("ed_probe_pccard: possible failure(2)\n"); ! } ! ! /* clear any pending interupts that we may have caused */ ! outb(sc->nic_addr + ED_P0_ISR, 0xff); ! ! return (ED_PC_IO_PORTS); } #endif /* NCRD > 0 */ --- 1364,1401 ---- #if NCRD > 0 /* ! * Probe framework for pccards. Replicates the standard framework, ! * minus the pccard driver registration and ignores the ether address ! * supplied (from the CIS), relying on the probe to find it instead. */ static int ed_probe_pccard(isa_dev, ether) struct isa_device *isa_dev; u_char *ether; { ! int nports; ! printf("ed_probe_pccard: try WD80x3\n"); ! nports = ed_probe_WD80x3(isa_dev); ! if (nports) ! return (nports); ! ! printf("ed_probe_pccard: try 3Com\n"); ! nports = ed_probe_3Com(isa_dev); ! if (nports) ! return (nports); ! ! printf("ed_probe_pccard: try NEx000\n"); ! nports = ed_probe_Novell(isa_dev); ! if (nports) ! return (nports); ! ! printf("ed_probe_pccard: try HP PClan\n"); ! nports = ed_probe_HP_pclanp(isa_dev); ! if (nports) ! return (nports); ! return (0); } #endif /* NCRD > 0 */ -- ]] Mike Smith, Software Engineer msmith@atrad.adelaide.edu.au [[ ]] Genesis Software genesis@atrad.adelaide.edu.au [[ ]] High-speed data acquisition and (GSM mobile) 0411-222-496 [[ ]] realtime instrument control (ph/fax) +61-8-267-3039 [[ ]] Collector of old Unix hardware. "Where are your PEZ?" The Tick [[
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199608140843.SAA00963>