Re: kern/40531 (5.0_BETA/i386 doesn't power off on Dell Latitude X1 with CF card plugged in)
"Valeriy E. Ushakov" <[email protected]> Sat, 7 Mar 2009 02:23:37 +0300
| Newsgroups | gmane.os.netbsd.ports.hpcsh |
|---|---|
| Message-ID | <[email protected]> |
On Fri, Mar 06, 2009 at 23:04:32 +0000, [email protected] wrote: > State-Changed-From-To: feedback->open > State-Changed-By: [email protected] > State-Changed-Why: > The change introduces regression for platforms with their primary disk > on wdc@pcmcia (at least all hpc* platforms, I guess). See > http://mail-index.netbsd.org/port-hpcsh/2009/02/26/msg000834.html The following patch makes my hpcsh properly attach CF at boot time. Please, review and test. --- wdc_pcmcia.c 21 Feb 2009 03:29:25 +0300 1.113 +++ wdc_pcmcia.c 07 Mar 2009 02:16:09 +0300 @@ -86,6 +86,7 @@ static int wdc_pcmcia_validate_config_io(struct pcmcia_config_entry *); static int wdc_pcmcia_validate_config_memory(struct pcmcia_config_entry *); static void wdc_pcmcia_attach(device_t, device_t, void *); +static void wdc_pcmcia_interrupts(device_t); static int wdc_pcmcia_detach(device_t, int); CFATTACH_DECL_NEW(wdc_pcmcia, sizeof(struct wdc_pcmcia_softc), @@ -302,15 +303,28 @@ sc->ata_channel.ch_ndrive = wdcp ? wdcp->wdc_ndrive : 2; wdc_init_shadow_regs(&sc->ata_channel); - error = wdc_pcmcia_enable(self, 1); - if (error) - goto fail; - /* We can enable and disable the controller. */ sc->sc_wdcdev.sc_atac.atac_atapi_adapter._generic.adapt_enable = wdc_pcmcia_enable; sc->sc_wdcdev.sc_atac.atac_atapi_adapter._generic.adapt_refcnt = 1; + config_interrupts(self, wdc_pcmcia_interrupts); + return; + +fail: + pcmcia_function_unconfigure(pa->pf); +} + +static void +wdc_pcmcia_interrupts(device_t self) +{ + struct wdc_pcmcia_softc *sc = device_private(self); + int error; + + error = wdc_pcmcia_enable(self, 1); + if (error) + goto fail; + /* * Some devices needs some more delay after power up to stabilize * and probe properly, so give them half a second. @@ -318,15 +332,15 @@ */ config_pending_incr(); tsleep(wdc_pcmcia_attach, PWAIT, "wdcattach", hz / 2); - wdcattach(&sc->ata_channel); config_pending_decr(); + ata_delref(&sc->ata_channel); sc->sc_state = WDC_PCMCIA_ATTACHED; return; fail: - pcmcia_function_unconfigure(pa->pf); + pcmcia_function_unconfigure(sc->sc_pf); } static int -uwe