Re: atabus@wdc can't attach

"Valeriy E. Ushakov" <[email protected]> Sat, 7 Mar 2009 01:39:15 +0300
Newsgroups gmane.os.netbsd.ports.hpcsh
Message-ID <[email protected]>
[Cc'ing Matthias who made the wdc_pcmcia_enable change in question]

On Thu, Feb 26, 2009 at 18:15:20 +0900, KIYOHARA Takashi wrote:

> Hi! all,
> 
> My hpcsh machine(PERSONA HPW-50PA) can't attach atabus@wdc at current
> (20090221).  Maybe since this change.
> 
> http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dev/pcmcia/wdc_pcmcia.c.diff?r1=1.112&r2=1.113&f=h
> 
> We will have to delay attaching until kthread runs.

> Index: hd64461pcmcia.c
> ===================================================================
> RCS file: /cvsroot/src/sys/arch/hpcsh/dev/hd64461/hd64461pcmcia.c,v
> retrieving revision 1.43
> diff -u -r1.43 hd64461pcmcia.c
> --- hd64461pcmcia.c	28 Apr 2008 20:23:22 -0000	1.43
> +++ hd64461pcmcia.c	23 Feb 2009 17:49:39 -0000
> @@ -269,14 +269,6 @@
>  			       &sc->sc_event_thread,
>  			       "%s", device_xname(self));
>  	KASSERT(error == 0);
> -
> -#if !defined(HD64461PCMCIA_REORDER_ATTACH)
> -	hd64461pcmcia_attach_channel(sc, CHANNEL_0);
> -	hd64461pcmcia_attach_channel(sc, CHANNEL_1);
> -#else
> -	hd64461pcmcia_attach_channel(sc, CHANNEL_1);
> -	hd64461pcmcia_attach_channel(sc, CHANNEL_0);
> -#endif
>  }
>  
>  STATIC void
> @@ -286,6 +278,14 @@
>  	struct hd64461pcmcia_event *pe;
>  	int s;
>  
> +#if !defined(HD64461PCMCIA_REORDER_ATTACH)
> +	hd64461pcmcia_attach_channel(sc, CHANNEL_0);
> +	hd64461pcmcia_attach_channel(sc, CHANNEL_1);
> +#else
> +	hd64461pcmcia_attach_channel(sc, CHANNEL_1);
> +	hd64461pcmcia_attach_channel(sc, CHANNEL_0);
> +#endif
> +
>  	while (!sc->sc_shutdown) {
>  		tsleep(sc, PWAIT, "CSC wait", 0);
>  		s = splhigh();

I think this change is not necessary and wdc@pcmcia should be fixed
instead.

If I understand the problem correctly, revision 1.113 of wdc_pcmcia.c
broke *all* wdc@pcmcia attachments at boot time as wdc_pcmcia_attach
calls wdc_pcmcia_enable and wdc_pcmcia_enable now refuses to work when
we are cold.  It would be wrong to fix this problem in all pcmcia
controller drivers - instead wdc_pcmcia_attach should defer some of
its work with config_interrupts properly.

SY, Uwe
-- 
[email protected]                       |       Zu Grunde kommen
http://snark.ptc.spbu.ru/~uwe/          |       Ist zu Grunde gehen