1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-16 10:20:30 +00:00

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
This commit is contained in:
Peter Grehan 2008-05-08 17:55:44 +00:00
parent 9fc852229b
commit a384947e92
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=178856
5 changed files with 10 additions and 5 deletions

View File

@ -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;

View File

@ -213,7 +213,9 @@ ata_begin_transaction(struct ata_request *request)
printf("ata_begin_transaction OOPS!!!\n");
begin_finished:
if (ch->dma.unload) {
ch->dma.unload(request);
}
return ATA_OP_FINISHED;
begin_continue:

View File

@ -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

View File

@ -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;

View File

@ -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",