diff options
-rw-r--r-- | sys/dev/ata/ata-all.c | 24 | ||||
-rw-r--r-- | sys/dev/ata/ata-disk.c | 12 | ||||
-rw-r--r-- | sys/dev/ata/ata-disk.h | 3 | ||||
-rw-r--r-- | sys/dev/ata/atapi-all.h | 2 | ||||
-rw-r--r-- | sys/dev/ata/atapi-cd.c | 1 |
5 files changed, 26 insertions, 16 deletions
diff --git a/sys/dev/ata/ata-all.c b/sys/dev/ata/ata-all.c index 2851c3c..f742261 100644 --- a/sys/dev/ata/ata-all.c +++ b/sys/dev/ata/ata-all.c @@ -854,22 +854,30 @@ ata_reinit(struct ata_channel *ch) #ifdef DEV_ATADISK if (newdev & ATA_ATA_MASTER && !ch->device[MASTER].driver) ad_attach(&ch->device[MASTER]); - else if (ch->devices & ATA_ATA_MASTER && ch->device[MASTER].driver) - ad_reinit((struct ad_softc *)ch->device[MASTER].driver); + else if (ch->devices & ATA_ATA_MASTER && ch->device[MASTER].driver) { + ata_getparam(&ch->device[MASTER], ATA_C_ATA_IDENTIFY); + ad_reinit(&ch->device[MASTER]); + } if (newdev & ATA_ATA_SLAVE && !ch->device[SLAVE].driver) ad_attach(&ch->device[SLAVE]); - else if (ch->devices & (ATA_ATA_SLAVE) && ch->device[SLAVE].driver) - ad_reinit((struct ad_softc *)ch->device[SLAVE].driver); + else if (ch->devices & (ATA_ATA_SLAVE) && ch->device[SLAVE].driver) { + ata_getparam(&ch->device[SLAVE], ATA_C_ATA_IDENTIFY); + ad_reinit(&ch->device[SLAVE]); + } #endif #if defined(DEV_ATAPICD) || defined(DEV_ATAPIFD) || defined(DEV_ATAPIST) if (newdev & ATA_ATAPI_MASTER && !ch->device[MASTER].driver) atapi_attach(&ch->device[MASTER]); - else if (ch->devices & (ATA_ATAPI_MASTER) && ch->device[MASTER].driver) - atapi_reinit(ch->device[MASTER].driver); + else if (ch->devices & (ATA_ATAPI_MASTER) && ch->device[MASTER].driver) { + ata_getparam(&ch->device[MASTER], ATA_C_ATAPI_IDENTIFY); + atapi_reinit(&ch->device[MASTER]); + } if (newdev & ATA_ATAPI_SLAVE && !ch->device[SLAVE].driver) atapi_attach(&ch->device[SLAVE]); - else if (ch->devices & (ATA_ATAPI_SLAVE) && ch->device[SLAVE].driver) - atapi_reinit(ch->device[SLAVE].driver); + else if (ch->devices & (ATA_ATAPI_SLAVE) && ch->device[SLAVE].driver) { + ata_getparam(&ch->device[SLAVE], ATA_C_ATAPI_IDENTIFY); + atapi_reinit(&ch->device[SLAVE]); + } #endif printf("done\n"); ch->active = ATA_IDLE; diff --git a/sys/dev/ata/ata-disk.c b/sys/dev/ata/ata-disk.c index e97b5df..ea3ba46 100644 --- a/sys/dev/ata/ata-disk.c +++ b/sys/dev/ata/ata-disk.c @@ -907,19 +907,21 @@ ad_timeout(struct ad_request *request) } void -ad_reinit(struct ad_softc *adp) +ad_reinit(struct ata_device *atadev) { + struct ad_softc *adp = atadev->driver; + /* reinit disk parameters */ - ad_invalidatequeue(adp, NULL); - ata_command(adp->device, ATA_C_SET_MULTI, 0, + ad_invalidatequeue(atadev->driver, NULL); + ata_command(atadev, ATA_C_SET_MULTI, 0, adp->transfersize / DEV_BSIZE, 0, ATA_WAIT_INTR); if (adp->device->mode >= ATA_DMA) - ata_dmainit(adp->device->channel, adp->device->unit, + ata_dmainit(atadev->channel, atadev->unit, ata_pmode(adp->device->param), ata_wmode(adp->device->param), ata_umode(adp->device->param)); else - ata_dmainit(adp->device->channel, adp->device->unit, + ata_dmainit(atadev->channel, atadev->unit, ata_pmode(adp->device->param), -1, -1); } diff --git a/sys/dev/ata/ata-disk.h b/sys/dev/ata/ata-disk.h index 0bf49d8..9e0c4bf 100644 --- a/sys/dev/ata/ata-disk.h +++ b/sys/dev/ata/ata-disk.h @@ -79,10 +79,9 @@ struct ad_softc { void ad_attach(struct ata_device *); void ad_detach(struct ata_device *, int); +void ad_reinit(struct ata_device *); void ad_start(struct ata_device *); int ad_transfer(struct ad_request *); int ad_interrupt(struct ad_request *); int ad_service(struct ad_softc *, int); -void ad_reinit(struct ad_softc *); void ad_print(struct ad_softc *, char *); - diff --git a/sys/dev/ata/atapi-all.h b/sys/dev/ata/atapi-all.h index 0d2df68..88e6f1a 100644 --- a/sys/dev/ata/atapi-all.h +++ b/sys/dev/ata/atapi-all.h @@ -173,11 +173,11 @@ struct atapi_request { void atapi_attach(struct ata_device *); void atapi_detach(struct ata_device *); +void atapi_reinit(struct ata_device *); void atapi_start(struct ata_device *); int atapi_transfer(struct atapi_request *); int atapi_interrupt(struct atapi_request *); int atapi_queue_cmd(struct ata_device *, int8_t [], caddr_t, int, int, int, atapi_callback_t, void *); -void atapi_reinit(struct ata_device *); int atapi_test_ready(struct ata_device *); int atapi_wait_dsc(struct ata_device *, int); void atapi_request_sense(struct ata_device *, struct atapi_reqsense *); diff --git a/sys/dev/ata/atapi-cd.c b/sys/dev/ata/atapi-cd.c index 3486b0a..440c24d 100644 --- a/sys/dev/ata/atapi-cd.c +++ b/sys/dev/ata/atapi-cd.c @@ -220,6 +220,7 @@ acddetach(struct ata_device *atadev) TAILQ_REMOVE(&cdp->dev_list, entry, chain); free(entry, M_ACD); } + destroy_dev(cdp->dev); devstat_remove_entry(cdp->stats); free(cdp->stats, M_ACD); ata_free_name(atadev); |