Changeset View
Changeset View
Standalone View
Standalone View
sbin/camcontrol/fwdownload.c
Show First 20 Lines • Show All 459 Lines • ▼ Show 20 Lines | fw_validate_ibm(struct cam_device *dev, int retry_count, int timeout, int fd, | ||||
int retval = 1; | int retval = 1; | ||||
ccb = cam_getccb(dev); | ccb = cam_getccb(dev); | ||||
if (ccb == NULL) { | if (ccb == NULL) { | ||||
warnx("couldn't allocate CCB"); | warnx("couldn't allocate CCB"); | ||||
goto bailout; | goto bailout; | ||||
} | } | ||||
/* cam_getccb cleans up the header, caller has to zero the payload */ | |||||
CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio); | |||||
bzero(&vpd_page, sizeof(vpd_page)); | bzero(&vpd_page, sizeof(vpd_page)); | ||||
scsi_inquiry(&ccb->csio, | scsi_inquiry(&ccb->csio, | ||||
/*retries*/ retry_count, | /*retries*/ retry_count, | ||||
/*cbfcnp*/ NULL, | /*cbfcnp*/ NULL, | ||||
/* tag_action */ MSG_SIMPLE_Q_TAG, | /* tag_action */ MSG_SIMPLE_Q_TAG, | ||||
/* inq_buf */ (u_int8_t *)&vpd_page, | /* inq_buf */ (u_int8_t *)&vpd_page, | ||||
/* inq_len */ sizeof(vpd_page), | /* inq_len */ sizeof(vpd_page), | ||||
▲ Show 20 Lines • Show All 187 Lines • ▼ Show 20 Lines | fw_check_device_ready(struct cam_device *dev, camcontrol_devtype devtype, | ||||
size_t dxfer_len = 0; | size_t dxfer_len = 0; | ||||
if ((ccb = cam_getccb(dev)) == NULL) { | if ((ccb = cam_getccb(dev)) == NULL) { | ||||
warnx("Could not allocate CCB"); | warnx("Could not allocate CCB"); | ||||
retval = -1; | retval = -1; | ||||
goto bailout; | goto bailout; | ||||
} | } | ||||
CCB_CLEAR_ALL_EXCEPT_HDR(ccb); | |||||
if (devtype != CC_DT_SCSI) { | if (devtype != CC_DT_SCSI) { | ||||
dxfer_len = sizeof(struct ata_params); | dxfer_len = sizeof(struct ata_params); | ||||
ptr = (uint16_t *)malloc(dxfer_len); | ptr = (uint16_t *)malloc(dxfer_len); | ||||
if (ptr == NULL) { | if (ptr == NULL) { | ||||
warnx("can't malloc memory for identify"); | warnx("can't malloc memory for identify"); | ||||
retval = -1; | retval = -1; | ||||
goto bailout; | goto bailout; | ||||
▲ Show 20 Lines • Show All 112 Lines • ▼ Show 20 Lines | fw_download_img(struct cam_device *cam_dev, struct fw_vendor *vp, | ||||
if (retval != 0) | if (retval != 0) | ||||
goto bailout; | goto bailout; | ||||
if ((ccb = cam_getccb(cam_dev)) == NULL) { | if ((ccb = cam_getccb(cam_dev)) == NULL) { | ||||
warnx("Could not allocate CCB"); | warnx("Could not allocate CCB"); | ||||
retval = 1; | retval = 1; | ||||
goto bailout; | goto bailout; | ||||
} | } | ||||
CCB_CLEAR_ALL_EXCEPT_HDR(ccb); | |||||
max_pkt_size = vp->max_pkt_size; | max_pkt_size = vp->max_pkt_size; | ||||
if (max_pkt_size == 0) | if (max_pkt_size == 0) | ||||
max_pkt_size = UNKNOWN_MAX_PKT_SIZE; | max_pkt_size = UNKNOWN_MAX_PKT_SIZE; | ||||
pkt_size = max_pkt_size; | pkt_size = max_pkt_size; | ||||
progress_init(&progress, imgname, size = img_size); | progress_init(&progress, imgname, size = img_size); | ||||
/* Download single fw packets. */ | /* Download single fw packets. */ | ||||
▲ Show 20 Lines • Show All 244 Lines • Show Last 20 Lines |