Changeset View
Changeset View
Standalone View
Standalone View
sys/cam/ata/ata_da.c
Show First 20 Lines • Show All 1,082 Lines • ▼ Show 20 Lines | if ((softc->flags & ADA_FLAG_CAN_48BIT) && | ||||
(lba + count >= ATA_MAX_28BIT_LBA || | (lba + count >= ATA_MAX_28BIT_LBA || | ||||
count >= 256)) { | count >= 256)) { | ||||
ata_48bit_cmd(&ccb.ataio, ATA_WRITE_DMA48, | ata_48bit_cmd(&ccb.ataio, ATA_WRITE_DMA48, | ||||
0, lba, count); | 0, lba, count); | ||||
} else { | } else { | ||||
ata_28bit_cmd(&ccb.ataio, ATA_WRITE_DMA, | ata_28bit_cmd(&ccb.ataio, ATA_WRITE_DMA, | ||||
0, lba, count); | 0, lba, count); | ||||
} | } | ||||
xpt_polled_action(&ccb); | error = cam_periph_runccb(&ccb, adaerror, | ||||
0, SF_NO_RECOVERY | SF_NO_RETRY, NULL); | |||||
error = adaerror(&ccb, | |||||
0, SF_NO_RECOVERY | SF_NO_RETRY); | |||||
if ((ccb.ccb_h.status & CAM_DEV_QFRZN) != 0) | |||||
cam_release_devq(ccb.ccb_h.path, /*relsim_flags*/0, | |||||
/*reduction*/0, /*timeout*/0, /*getcount_only*/0); | |||||
if (error != 0) | if (error != 0) | ||||
printf("Aborting dump due to I/O error.\n"); | printf("Aborting dump due to I/O error.\n"); | ||||
cam_periph_unlock(periph); | cam_periph_unlock(periph); | ||||
return (error); | return (error); | ||||
} | } | ||||
if (softc->flags & ADA_FLAG_CAN_FLUSHCACHE) { | if (softc->flags & ADA_FLAG_CAN_FLUSHCACHE) { | ||||
Show All 13 Lines | cam_fill_ataio(&ccb.ataio, | ||||
NULL, | NULL, | ||||
0, | 0, | ||||
5*1000); | 5*1000); | ||||
if (softc->flags & ADA_FLAG_CAN_48BIT) | if (softc->flags & ADA_FLAG_CAN_48BIT) | ||||
ata_48bit_cmd(&ccb.ataio, ATA_FLUSHCACHE48, 0, 0, 0); | ata_48bit_cmd(&ccb.ataio, ATA_FLUSHCACHE48, 0, 0, 0); | ||||
else | else | ||||
ata_28bit_cmd(&ccb.ataio, ATA_FLUSHCACHE, 0, 0, 0); | ata_28bit_cmd(&ccb.ataio, ATA_FLUSHCACHE, 0, 0, 0); | ||||
xpt_polled_action(&ccb); | error = cam_periph_runccb(&ccb, adaerror, | ||||
0, SF_NO_RECOVERY | SF_NO_RETRY, NULL); | |||||
error = adaerror(&ccb, | |||||
0, SF_NO_RECOVERY | SF_NO_RETRY); | |||||
if ((ccb.ccb_h.status & CAM_DEV_QFRZN) != 0) | |||||
cam_release_devq(ccb.ccb_h.path, /*relsim_flags*/0, | |||||
/*reduction*/0, /*timeout*/0, /*getcount_only*/0); | |||||
if (error != 0) | if (error != 0) | ||||
xpt_print(periph->path, "Synchronize cache failed\n"); | xpt_print(periph->path, "Synchronize cache failed\n"); | ||||
} | } | ||||
cam_periph_unlock(periph); | cam_periph_unlock(periph); | ||||
return (error); | return (error); | ||||
} | } | ||||
static void | static void | ||||
▲ Show 20 Lines • Show All 2,362 Lines • ▼ Show 20 Lines | cam_fill_ataio(&local_ccb, | ||||
0, | 0, | ||||
adadone, | adadone, | ||||
CAM_DIR_NONE | flags, | CAM_DIR_NONE | flags, | ||||
0, | 0, | ||||
NULL, | NULL, | ||||
0, | 0, | ||||
ada_default_timeout*1000); | ada_default_timeout*1000); | ||||
ata_28bit_cmd(&local_ccb, cmd, 0, 0, 0); | ata_28bit_cmd(&local_ccb, cmd, 0, 0, 0); | ||||
if (!SCHEDULER_STOPPED()) { | |||||
/* | |||||
* Not panicing, can just do the normal runccb | |||||
* XXX should make cam_periph_runccb work while | |||||
* XXX panicing... later | |||||
*/ | |||||
error = cam_periph_runccb((union ccb *)&local_ccb, adaerror, | error = cam_periph_runccb((union ccb *)&local_ccb, adaerror, | ||||
/*cam_flags*/0, /*sense_flags*/ SF_NO_RECOVERY | SF_NO_RETRY, | /*cam_flags*/0, /*sense_flags*/ SF_NO_RECOVERY | SF_NO_RETRY, | ||||
softc->disk->d_devstat); | softc->disk->d_devstat); | ||||
} else { | |||||
/* | |||||
* Panicing, so we have to do this by hand: do | |||||
* xpt_polled_action to run the request through the SIM, | |||||
* extract the error, and if the queue was frozen, | |||||
* unfreeze it. cam_periph_runccb takes care of these | |||||
* details, but xpt_polled_action doesn't. | |||||
*/ | |||||
xpt_polled_action((union ccb *)&local_ccb); | |||||
error = adaerror((union ccb *)&local_ccb, 0, | |||||
SF_NO_RECOVERY | SF_NO_RETRY); | |||||
if ((local_ccb.ccb_h.status & CAM_DEV_QFRZN) != 0) | |||||
cam_release_devq(local_ccb.ccb_h.path, | |||||
/*relsim_flags*/0, /*reduction*/0, | |||||
/*timeout*/0, /*getcount_only*/0); | |||||
} | |||||
if (error != 0) | if (error != 0) | ||||
xpt_print(periph->path, "Spin-down disk failed\n"); | xpt_print(periph->path, "Spin-down disk failed\n"); | ||||
cam_periph_unlock(periph); | cam_periph_unlock(periph); | ||||
} | } | ||||
} | } | ||||
static void | static void | ||||
adashutdown(void *arg, int howto) | adashutdown(void *arg, int howto) | ||||
▲ Show 20 Lines • Show All 77 Lines • Show Last 20 Lines |