From owner-freebsd-mobile Tue Oct 15 19:10:53 1996 Return-Path: owner-mobile Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id TAA26636 for mobile-outgoing; Tue, 15 Oct 1996 19:10:53 -0700 (PDT) Received: from genesis.atrad.adelaide.edu.au (genesis.atrad.adelaide.edu.au [129.127.96.120]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id TAA26624; Tue, 15 Oct 1996 19:10:42 -0700 (PDT) Received: from msmith@localhost by genesis.atrad.adelaide.edu.au (8.6.12/8.6.9) id LAA27978; Wed, 16 Oct 1996 11:40:34 +0930 From: Michael Smith Message-Id: <199610160210.LAA27978@genesis.atrad.adelaide.edu.au> Subject: Planned changes to if_ed.c to support NE2000 PCCARDs To: mobile@freebsd.org Date: Wed, 16 Oct 1996 11:40:34 +0930 (CST) Cc: davidg@freebsd.org, wollman@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-mobile@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Well, I've received absolutely zero response to my previous calls for testers for these patches, so I can only conclude that either it has totally exterminated all the users of the 'ed' driver with PCCARDs, or I'm the only sucker using a cheap PCC ethernet. Either way, this is the last post before I just grit my teeth and commit the rotten thing. If nothing else, that'll get some results 8) David, Garrett, I'm cc'ing you on this because you're both implicated in the 'ed' driver and I don't want to tread on your toes. Note that the printfs will go away as soon as I hear from someone else that it still detects their shared-memory PCCARD ok. This diff is against if_ed.c version 1.106. *** /sys/i386/isa/if_ed.c Sat Oct 12 06:49:48 1996 --- if_ed.c Wed Oct 16 11:25:28 1996 *************** *** 227,232 **** --- 227,242 ---- static void edsuspend(struct pccard_dev *dp) { + struct ed_softc *sc = &ed_softc[dp->isahd.id_unit]; + /* + * Some 'ed' cards will generate a interrupt as they go away, + * and by the time the interrupt handler gets to the card, + * the interrupt can't be cleared. + * By setting gone here, we tell the handler to ignore the + * interrupt when it happens. + */ + sc->gone = 1; /* avoid spinning endlessly in interrupt handler */ + printf("ed%d: suspending\n", dp->isahd.id_unit); } *************** *** 254,259 **** --- 264,271 ---- return(ENXIO); if (ed_attach_isa(&dp->isahd)==0) return(ENXIO); + } else { + sc->gone = 0; /* reenable after a suspend */ } /* * XXX TODO: *************** *** 1310,1419 **** #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->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 */ --- 1322,1359 ---- #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 [[