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:
parent
9fc852229b
commit
a384947e92
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=178856
@ -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;
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user