diff options
author | grehan <grehan@FreeBSD.org> | 2008-05-08 17:55:44 +0000 |
---|---|---|
committer | grehan <grehan@FreeBSD.org> | 2008-05-08 17:55:44 +0000 |
commit | 1bdc8efe1532fb47d452acdf221653403243b1f7 (patch) | |
tree | ed27c635766096baa0d73e6b8ea680292df61554 | |
parent | 494160ee656e9d1bbcc0fb4d77980e3fd1d85da7 (diff) | |
download | FreeBSD-src-1bdc8efe1532fb47d452acdf221653403243b1f7.zip FreeBSD-src-1bdc8efe1532fb47d452acdf221653403243b1f7.tar.gz |
Fix panic and breakage for non-DMA ATA devices e.g. powermac macio cells.
Handle cases where dma function pointers may be NULL, and where
the max_iosize can't be derived from a DMA data structure. For
the latter, revert to the prior behaviour of using DFLTPHYS for
the max i/o size when there is no other data.
Reviewed by: marcel
No objection by: sos
-rw-r--r-- | sys/dev/ata/ata-disk.c | 2 | ||||
-rw-r--r-- | sys/dev/ata/ata-lowlevel.c | 4 | ||||
-rw-r--r-- | sys/dev/ata/atapi-cd.c | 5 | ||||
-rw-r--r-- | sys/dev/ata/atapi-fd.c | 2 | ||||
-rw-r--r-- | sys/dev/ata/atapi-tape.c | 2 |
5 files changed, 10 insertions, 5 deletions
diff --git a/sys/dev/ata/ata-disk.c b/sys/dev/ata/ata-disk.c index 6bf9fd9..203eb64 100644 --- a/sys/dev/ata/ata-disk.c +++ b/sys/dev/ata/ata-disk.c @@ -125,7 +125,7 @@ ad_attach(device_t dev) adp->disk->d_dump = ad_dump; adp->disk->d_name = "ad"; adp->disk->d_drv1 = dev; - adp->disk->d_maxsize = ch->dma.max_iosize; + adp->disk->d_maxsize = ch->dma.max_iosize ? ch->dma.max_iosize : DFLTPHYS; adp->disk->d_sectorsize = DEV_BSIZE; adp->disk->d_mediasize = DEV_BSIZE * (off_t)adp->total_secs; adp->disk->d_fwsectors = adp->sectors; diff --git a/sys/dev/ata/ata-lowlevel.c b/sys/dev/ata/ata-lowlevel.c index 6dd7662..c46caa6 100644 --- a/sys/dev/ata/ata-lowlevel.c +++ b/sys/dev/ata/ata-lowlevel.c @@ -213,7 +213,9 @@ ata_begin_transaction(struct ata_request *request) printf("ata_begin_transaction OOPS!!!\n"); begin_finished: - ch->dma.unload(request); + if (ch->dma.unload) { + ch->dma.unload(request); + } return ATA_OP_FINISHED; begin_continue: diff --git a/sys/dev/ata/atapi-cd.c b/sys/dev/ata/atapi-cd.c index 7bf3b9f..abd1db4 100644 --- a/sys/dev/ata/atapi-cd.c +++ b/sys/dev/ata/atapi-cd.c @@ -906,8 +906,11 @@ acd_set_ioparm(device_t dev) { struct ata_channel *ch = device_get_softc(device_get_parent(dev)); struct acd_softc *cdp = device_get_ivars(dev); + uint32_t max_iosize; - cdp->iomax = min(ch->dma.max_iosize, 65534); + max_iosize = ch->dma.max_iosize ? ch->dma.max_iosize : DFLTPHYS; + + cdp->iomax = min(max_iosize, 65534); } static void diff --git a/sys/dev/ata/atapi-fd.c b/sys/dev/ata/atapi-fd.c index 9a26399..7b3c8b7 100644 --- a/sys/dev/ata/atapi-fd.c +++ b/sys/dev/ata/atapi-fd.c @@ -105,7 +105,7 @@ afd_attach(device_t dev) fdp->disk->d_ioctl = afd_ioctl; fdp->disk->d_name = "afd"; fdp->disk->d_drv1 = dev; - fdp->disk->d_maxsize = ch->dma.max_iosize; + fdp->disk->d_maxsize = ch->dma.max_iosize ? ch->dma.max_iosize : DFLTPHYS; fdp->disk->d_unit = device_get_unit(dev); disk_create(fdp->disk, DISK_VERSION); return 0; diff --git a/sys/dev/ata/atapi-tape.c b/sys/dev/ata/atapi-tape.c index 3304907..8986069 100644 --- a/sys/dev/ata/atapi-tape.c +++ b/sys/dev/ata/atapi-tape.c @@ -142,7 +142,7 @@ ast_attach(device_t dev) UID_ROOT, GID_OPERATOR, 0640, "ast%d", device_get_unit(dev)); device->si_drv1 = dev; - device->si_iosize_max = ch->dma.max_iosize; + device->si_iosize_max = ch->dma.max_iosize ? ch->dma.max_iosize : DFLTPHYS; stp->dev1 = device; device = make_dev(&ast_cdevsw, 2 * device_get_unit(dev) + 1, UID_ROOT, GID_OPERATOR, 0640, "nast%d", |