Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Jan 2000 22:25:38 -0500 (EST)
From:      Andrew Gallatin <gallatin@cs.duke.edu>
To:        Mitsuru IWASAKI <iwasaki@jp.FreeBSD.org>
Cc:        imp@village.org, freebsd-mobile@FreeBSD.ORG
Subject:   Re: pc card removal lockup 
Message-ID:  <14481.3007.227360.871159@grasshopper.cs.duke.edu>
In-Reply-To: <200001271720.CAA12938@tasogare.imasy.or.jp>
References:  <200001271639.JAA45996@harmony.village.org> <200001271720.CAA12938@tasogare.imasy.or.jp>

next in thread | previous in thread | raw e-mail | index | archive | help

Mitsuru IWASAKI writes:
<...>

When I tried this, the machine did not seem to notice that ep0 was
removed.  ifconfig -a still listed the ep0 interface.  The first use
of ep0 after removing it (and not re-inserting it) caused the machine
to lock solid.  No beep this time.

Thank you,

Drew

 > OK, like this?  I've tested this by insertion/removal for about 100
 > times, no problems so far for my machine.
 > 
 > # final version?
 > 
 > Index: pccard.c
 > ===================================================================
 > RCS file: /home/ncvs/src/sys/pccard/pccard.c,v
 > retrieving revision 1.104
 > diff -u -r1.104 pccard.c
 > --- pccard.c	2000/01/16 06:44:45	1.104
 > +++ pccard.c	2000/01/27 16:56:07
 > @@ -71,12 +71,7 @@
 >  
 >  SYSCTL_NODE(_machdep, OID_AUTO, pccard, CTLFLAG_RW, 0, "pccard");
 >  
 > -static int pcic_resume_reset =
 > -#ifdef PCIC_RESUME_RESET	/* opt_pcic.h */
 > -	1;
 > -#else
 > -	0;
 > -#endif
 > +static int pcic_resume_reset = 1;
 >  
 >  SYSCTL_INT(_machdep_pccard, OID_AUTO, pcic_resume_reset, CTLFLAG_RW, 
 >  	&pcic_resume_reset, 0, "");
 > @@ -88,8 +83,7 @@
 >  static int		allocate_driver(struct slot *, struct dev_desc *);
 >  static void		inserted(void *);
 >  static void		disable_slot(struct slot *);
 > -static void		disable_slot_spl0(struct slot *);
 > -static void		disable_slot_to(void *);
 > +static void		disable_slot_to(struct slot *);
 >  static int		invalid_io_memory(unsigned long, int);
 >  static void		power_off_slot(void *);
 >  
 > @@ -184,28 +178,19 @@
 >  	slt->pwr_off_pending = 1;
 >  }
 >  
 > -static void
 > -disable_slot_to(void *argp)
 > +__inline static void
 > +disable_slot_to(struct slot *slt)
 >  {
 > -	struct slot *slt = (struct slot *) argp;
 > -
 > +	int s = splhigh();
 >  	slt->state = empty;
 >  	disable_slot(slt);
 > +	splx(s);
 >  	printf("pccard: card removed, slot %d\n", slt->slotnum);
 >  	pccard_remove_beep();
 >  	selwakeup(&slt->selp);
 >  }
 >  
 >  /*
 > - * Disables the slot later when we drop to spl0 via a timeout.
 > - */
 > -static void
 > -disable_slot_spl0(struct slot *slt)
 > -{
 > -	slt->disable_ch = timeout(disable_slot_to, (caddr_t) slt, 0);
 > -}
 > -
 > -/*
 >   *	pccard_alloc_slot - Called from controller probe
 >   *	routine, this function allocates a new PC-CARD slot
 >   *	and initialises the data structures using the data provided.
 > @@ -232,7 +217,6 @@
 >  	pccard_slots[slotno] = slt;
 >  	callout_handle_init(&slt->insert_ch);
 >  	callout_handle_init(&slt->poff_ch);
 > -	callout_handle_init(&slt->disable_ch);
 >  	return(slt);
 >  }
 >  
 > @@ -301,12 +285,12 @@
 >  	 */
 >  	slt->pwr.vcc = 50;
 >  	slt->pwr.vpp = 0;
 > +
 >  	/*
 >  	 * Disable any pending timeouts for this slot, and explicitly
 >  	 * power it off right now.  Then, re-enable the power using
 >  	 * the (possibly new) power settings.
 >  	 */
 > -	untimeout(power_off_slot, (caddr_t)slt, slt->disable_ch);
 >  	untimeout(power_off_slot, (caddr_t)slt, slt->poff_ch);
 >  	power_off_slot(slt);
 >  	slt->ctrl->power(slt);
 > @@ -338,7 +322,7 @@
 >  		 */
 >  		if (slt->state == filled) {
 >  			slt->state = empty;
 > -			disable_slot_spl0(slt);
 > +			disable_slot_to(slt);
 >  		}
 >  		break;
 >  	case card_inserted:
 > @@ -705,7 +689,6 @@
 >  	 * Disable any pending timeouts for this slot since we're
 >  	 * powering it down/disabling now.
 >  	 */
 > -	untimeout(power_off_slot, (caddr_t)slt, slt->disable_ch);
 >  	untimeout(power_off_slot, (caddr_t)slt, slt->poff_ch);
 >  	slt->ctrl->disable(slt);
 >  	return (0);
 > Index: slot.h
 > ===================================================================
 > RCS file: /home/ncvs/src/sys/pccard/slot.h,v
 > retrieving revision 1.22
 > diff -u -r1.22 slot.h
 > --- slot.h	1999/12/08 07:55:20	1.22
 > +++ slot.h	2000/01/27 16:53:24
 > @@ -110,7 +110,6 @@
 >  	unsigned int 	insert_seq;	/* Firing up under the card */
 >  	struct callout_handle insert_ch;/* Insert event timeout handle */
 >  	struct callout_handle poff_ch;	/* Power Off timeout handle */
 > -	struct callout_handle disable_ch; /* Disable spl0 kludge */
 >  
 >  	enum cardstate 	state, laststate; /* Current/last card states */
 >  	struct selinfo	selp;		/* Info for select */


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-mobile" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?14481.3007.227360.871159>