Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Oct 1996 15:56:34 +0930 (CST)
From:      Michael Smith <msmith@atrad.adelaide.edu.au>
To:        nate@mt.sri.com (Nate Williams)
Cc:        mobile@freebsd.org
Subject:   Re: Working PCMCIA/CD-ROM/Modem/ethernet?
Message-ID:  <199610140626.PAA13513@genesis.atrad.adelaide.edu.au>
In-Reply-To: <199610140618.AAA29097@rocky.mt.sri.com> from "Nate Williams" at Oct 14, 96 00:18:56 am

next in thread | previous in thread | raw e-mail | index | archive | help
Nate Williams stands accused of saying:
> 
> > I was referring
> > to this patch, which attempts to make the pccard probe in if_ed.c work
> > with non-memory-mapped cards.  Obviously the printf()s are bogus; what
> > is needed is someone with a shared-memory 'ed' card to verify that
> > this still finds their card OK.  The probe as it stands in -current
> > doesn't even consider PIO-only cards.
> 
> Can you send this to the mobile list, since I don't have any ED cards to
> test it with (either desktop or laptop).

Done.  People - anyone with an 'ed' card (PCCard or desktop), please
test this and _let_us_know_if_it_works_ for you!  (patch below).

> > This is still partly broken in that my card at least doesn't wake up
> > out of suspend properly, but it means that the system doesn't hang
> > forever when I suspend and when it comes back a remove/reinsert gets
> > the card going again.
> 
> AFAIK, *NONE* of the cards correctly wakeup out of suspend properly yet.
> I know mine doesn't (3C589[BC], as it requires the same remove/insert
> that you have to do.

I think the only sensible way to handle a suspend is to "eject" the
cards as part of the suspend process, and then treat any cards that
are present on resume as new insertions; attempting to maintain state
across suspends is just stupid.

> Nate
> 
> ps. Sorry for not getting back to you sooner with this!

That's OK; I'm sorry I haven't pursued the matter harder earlier -
I've had this patch in one form or another since July or so, but the
machine it's running on keeps getting borrowed from me and taken
elsewhere 8(


*** /sys/i386/isa/if_ed.c	Wed Aug  7 17:05:39 1996
--- if_ed.c	Wed Aug 14 11:08:43 1996
***************
*** 226,232 ****
   */
  static void
  edsuspend(struct pccard_dev *dp)
! {
  	printf("ed%d: suspending\n", dp->isahd.id_unit);
  }
  
--- 226,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,260 ****
--- 264,273 ----
  			return(ENXIO);
  		if (ed_attach_isa(&dp->isahd)==0)
  			return(ENXIO);
+ 	} else {
+ 	    sc->gone = 0;	/* reenable after a suspend */
  	}
+ 	
  	/*
  	 * XXX TODO:
  	 * If it was initialized before, the device structure
***************
*** 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 */
--- 1377,1414 ----
  #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?199610140626.PAA13513>