Changeset View
Changeset View
Standalone View
Standalone View
sys/cam/ata/ata_da.c
Show First 20 Lines • Show All 1,113 Lines • ▼ Show 20 Lines | adadump(void *arg, void *virtual, vm_offset_t physical, off_t offset, size_t length) | ||||
periph = dp->d_drv1; | periph = dp->d_drv1; | ||||
softc = (struct ada_softc *)periph->softc; | softc = (struct ada_softc *)periph->softc; | ||||
secsize = softc->params.secsize; | secsize = softc->params.secsize; | ||||
lba = offset / secsize; | lba = offset / secsize; | ||||
count = length / secsize; | count = length / secsize; | ||||
if ((periph->flags & CAM_PERIPH_INVALID) != 0) | if ((periph->flags & CAM_PERIPH_INVALID) != 0) | ||||
return (ENXIO); | return (ENXIO); | ||||
memset(&ataio, 0, sizeof(ataio)); | memset(&ataio, 0, sizeof(ataio)); | ||||
imp: this is a bug, this should be deleted. | |||||
if (length > 0) { | if (length > 0) { | ||||
xpt_setup_ccb(&ataio.ccb_h, periph->path, CAM_PRIORITY_NORMAL); | xpt_setup_stack_ccb(&ataio.ccb_h, sizeof(ataio), periph->path, | ||||
CAM_PRIORITY_NORMAL); | |||||
ataio.ccb_h.ccb_state = ADA_CCB_DUMP; | ataio.ccb_h.ccb_state = ADA_CCB_DUMP; | ||||
cam_fill_ataio(&ataio, | cam_fill_ataio(&ataio, | ||||
0, | 0, | ||||
NULL, | NULL, | ||||
CAM_DIR_OUT, | CAM_DIR_OUT, | ||||
0, | 0, | ||||
(u_int8_t *) virtual, | (u_int8_t *) virtual, | ||||
length, | length, | ||||
Show All 11 Lines | error = cam_periph_runccb((union ccb *)&ataio, adaerror, | ||||
0, SF_NO_RECOVERY | SF_NO_RETRY, NULL); | 0, SF_NO_RECOVERY | SF_NO_RETRY, NULL); | ||||
if (error != 0) | if (error != 0) | ||||
printf("Aborting dump due to I/O error.\n"); | printf("Aborting dump due to I/O error.\n"); | ||||
return (error); | return (error); | ||||
} | } | ||||
if (softc->flags & ADA_FLAG_CAN_FLUSHCACHE) { | if (softc->flags & ADA_FLAG_CAN_FLUSHCACHE) { | ||||
xpt_setup_ccb(&ataio.ccb_h, periph->path, CAM_PRIORITY_NORMAL); | xpt_setup_stack_ccb(&ataio.ccb_h, sizeof(ataio), periph->path, | ||||
CAM_PRIORITY_NORMAL); | |||||
/* | /* | ||||
* Tell the drive to flush its internal cache. if we | * Tell the drive to flush its internal cache. if we | ||||
* can't flush in 5s we have big problems. No need to | * can't flush in 5s we have big problems. No need to | ||||
* wait the default 60s to detect problems. | * wait the default 60s to detect problems. | ||||
*/ | */ | ||||
ataio.ccb_h.ccb_state = ADA_CCB_DUMP; | ataio.ccb_h.ccb_state = ADA_CCB_DUMP; | ||||
cam_fill_ataio(&ataio, | cam_fill_ataio(&ataio, | ||||
▲ Show 20 Lines • Show All 170 Lines • ▼ Show 20 Lines | case AC_FOUND_DEVICE: | ||||
&& status != CAM_REQ_INPROG) | && status != CAM_REQ_INPROG) | ||||
printf("adaasync: Unable to attach to new device " | printf("adaasync: Unable to attach to new device " | ||||
"due to status 0x%x\n", status); | "due to status 0x%x\n", status); | ||||
break; | break; | ||||
} | } | ||||
case AC_GETDEV_CHANGED: | case AC_GETDEV_CHANGED: | ||||
{ | { | ||||
softc = (struct ada_softc *)periph->softc; | softc = (struct ada_softc *)periph->softc; | ||||
memset(&cgd, 0, sizeof(cgd)); | xpt_setup_stack_ccb(&cgd.ccb_h, sizeof(cgd), periph->path, | ||||
xpt_setup_ccb(&cgd.ccb_h, periph->path, CAM_PRIORITY_NORMAL); | CAM_PRIORITY_NORMAL); | ||||
cgd.ccb_h.func_code = XPT_GDEV_TYPE; | cgd.ccb_h.func_code = XPT_GDEV_TYPE; | ||||
xpt_action((union ccb *)&cgd); | xpt_action((union ccb *)&cgd); | ||||
/* | /* | ||||
* Update our information based on the new Identify data. | * Update our information based on the new Identify data. | ||||
*/ | */ | ||||
adasetflags(softc, &cgd); | adasetflags(softc, &cgd); | ||||
adasetgeom(softc, &cgd); | adasetgeom(softc, &cgd); | ||||
Show All 18 Lines | adaasync(void *callback_arg, u_int32_t code, | ||||
} | } | ||||
case AC_SENT_BDR: | case AC_SENT_BDR: | ||||
case AC_BUS_RESET: | case AC_BUS_RESET: | ||||
{ | { | ||||
softc = (struct ada_softc *)periph->softc; | softc = (struct ada_softc *)periph->softc; | ||||
cam_periph_async(periph, code, path, arg); | cam_periph_async(periph, code, path, arg); | ||||
if (softc->state != ADA_STATE_NORMAL) | if (softc->state != ADA_STATE_NORMAL) | ||||
break; | break; | ||||
memset(&cgd, 0, sizeof(cgd)); | xpt_setup_stack_ccb(&cgd.ccb_h, sizeof(cgd), periph->path, | ||||
xpt_setup_ccb(&cgd.ccb_h, periph->path, CAM_PRIORITY_NORMAL); | CAM_PRIORITY_NORMAL); | ||||
cgd.ccb_h.func_code = XPT_GDEV_TYPE; | cgd.ccb_h.func_code = XPT_GDEV_TYPE; | ||||
xpt_action((union ccb *)&cgd); | xpt_action((union ccb *)&cgd); | ||||
if (ADA_RA >= 0 && softc->flags & ADA_FLAG_CAN_RAHEAD) | if (ADA_RA >= 0 && softc->flags & ADA_FLAG_CAN_RAHEAD) | ||||
softc->state = ADA_STATE_RAHEAD; | softc->state = ADA_STATE_RAHEAD; | ||||
else if (ADA_WC >= 0 && softc->flags & ADA_FLAG_CAN_WCACHE) | else if (ADA_WC >= 0 && softc->flags & ADA_FLAG_CAN_WCACHE) | ||||
softc->state = ADA_STATE_WCACHE; | softc->state = ADA_STATE_WCACHE; | ||||
else if ((softc->flags & ADA_FLAG_CAN_LOG) | else if ((softc->flags & ADA_FLAG_CAN_LOG) | ||||
&& (softc->zone_mode != ADA_ZONE_NONE)) | && (softc->zone_mode != ADA_ZONE_NONE)) | ||||
▲ Show 20 Lines • Show All 2,223 Lines • ▼ Show 20 Lines | CAM_PERIPH_FOREACH(periph, &adadriver) { | ||||
if ((softc->flags & ADA_FLAG_CAN_POWERMGT) == 0) { | if ((softc->flags & ADA_FLAG_CAN_POWERMGT) == 0) { | ||||
cam_periph_unlock(periph); | cam_periph_unlock(periph); | ||||
continue; | continue; | ||||
} | } | ||||
if (bootverbose) | if (bootverbose) | ||||
xpt_print(periph->path, "spin-down\n"); | xpt_print(periph->path, "spin-down\n"); | ||||
memset(&local_ccb, 0, sizeof(local_ccb)); | xpt_setup_stack_ccb(&local_ccb.ccb_h, sizeof(local_ccb), | ||||
xpt_setup_ccb(&local_ccb.ccb_h, periph->path, CAM_PRIORITY_NORMAL); | periph->path, CAM_PRIORITY_NORMAL); | ||||
local_ccb.ccb_h.ccb_state = ADA_CCB_DUMP; | local_ccb.ccb_h.ccb_state = ADA_CCB_DUMP; | ||||
cam_fill_ataio(&local_ccb, | cam_fill_ataio(&local_ccb, | ||||
0, | 0, | ||||
NULL, | NULL, | ||||
CAM_DIR_NONE | flags, | CAM_DIR_NONE | flags, | ||||
0, | 0, | ||||
NULL, | NULL, | ||||
▲ Show 20 Lines • Show All 91 Lines • Show Last 20 Lines |
this is a bug, this should be deleted.