続々 wd(4)
cold != 0 で src/sys/dev/pcmcia/wdc_pcmcia.c:wdc_pcmcia_enable() から EIO で戻って来ちゃうのか。
cold っていつ 0 になるんだっけ…。
続々々 wd(4)
cold が 0 になるのは src/sys/kern/subr_autoconf.c:configure() で cpu_configure() の後か。じゃあ、probe/attach 中は cold != 0 だなぁ。
/* * Do the machine-dependent portion of autoconfiguration. This * sets the configuration machinery here in motion by "finding" * the root bus. When this function returns, we expect interrupts * to be enabled. */ cpu_configure(); /* Initialize SSP. */ ssp_init(); /* * Now that we've found all the hardware, start the real time * and statistics clocks. */ initclocks(); cold = 0; /* clocks are running, we're warm now! */
続々々々 wd(4)
前々から zaurus の dmesg を見る度に何か違和感を感じてたんだけど、wdc at pcmcia が attach されるタイミングが早過ぎね?i386 で pcic や cardbus だと cpu_configure() 後に attach されてなかったっけ?
NetBSD 5.99.7 (GENERIC) #0: Thu Feb 12 22:47:17 JST 2009 nonaka@koharu.myhome.local:/home/nonaka/work/nbsd/src-20090203/src/sys/arch/zaurus/compile/GENERIC total memory = 65536 KB avail memory = 57992 KB timecounter: Timecounters tick every 10.000 msec mainbus0 (root) (中略) pxapcic0 at pxaip0: 2 slots pcmcia0 at pxapcic0 wdc0 at pcmcia0 function 0: <, , > wdc0: i/o mapped mode atabus0 at wdc0 channel 0 pcmcia1 at pxapcic0 pxartc0 at pxaip0: PXA2x0 Real-time Clock scoop0 at pxaip0: PCMCIA/GPIO controller scoop1 at pxaip0: PCMCIA/GPIO controller
続々々々々 wd(4)
てな訳で src/sys/arch/arm/xscale/pxa2x0_pcic.c で attach 時のカードの probe/attach 処理をイベントスレッドの先頭に移動させてあげる事で解決。
Index: pxa2x0_pcic.c =================================================================== RCS file: /cvsroot/src/sys/arch/arm/xscale/pxa2x0_pcic.c,v retrieving revision 1.5 diff -u -r1.5 pxa2x0_pcic.c --- pxa2x0_pcic.c 29 Jan 2009 12:28:15 -0000 1.5 +++ pxa2x0_pcic.c 12 Feb 2009 15:16:19 -0000 @@ -335,7 +335,6 @@ struct pcmciabus_attach_args paa; struct pxapcic_socket *so; int s[PXAPCIC_NSLOT]; - u_int cs; int i; printf(": %d slot%s\n", sc->sc_nslots, sc->sc_nslots < 2 ? "" : "s"); @@ -392,11 +391,6 @@ /* GPIO pin for interrupt */ so->irqpin = sc->sc_irqpin[s[i]]; - /* If there's a card there, attach it. */ - cs = (*so->pcictag->read)(so, PXAPCIC_CARD_STATUS); - if (cs == PXAPCIC_CARD_VALID) - pxapcic_attach_card(so); - if (kthread_create(PRI_NONE, 0, NULL, pxapcic_event_thread, so, &so->event_thread, "%s,%d", device_xname(sc->sc_dev), so->socket)) { @@ -428,6 +422,11 @@ u_int cs; int present; + /* If there's a card there, attach it. */ + cs = (*sock->pcictag->read)(sock, PXAPCIC_CARD_STATUS); + if (cs == PXAPCIC_CARD_VALID) + pxapcic_attach_card(sock); + while (sock->sc->sc_shutdown == 0) { (void) tsleep(sock, PWAIT, "pxapcicev", 0);