Changeset View
Changeset View
Standalone View
Standalone View
sys/cam/ata/ata_da.c
Show First 20 Lines • Show All 2,599 Lines • ▼ Show 20 Lines | adaprobedone(struct cam_periph *periph, union ccb *ccb) | ||||
} else { | } else { | ||||
cam_periph_release_locked(periph); | cam_periph_release_locked(periph); | ||||
} | } | ||||
} | } | ||||
static void | static void | ||||
adazonedone(struct cam_periph *periph, union ccb *ccb) | adazonedone(struct cam_periph *periph, union ccb *ccb) | ||||
{ | { | ||||
struct ada_softc *softc; | |||||
struct bio *bp; | struct bio *bp; | ||||
softc = periph->softc; | |||||
bp = (struct bio *)ccb->ccb_h.ccb_bp; | bp = (struct bio *)ccb->ccb_h.ccb_bp; | ||||
switch (bp->bio_zone.zone_cmd) { | switch (bp->bio_zone.zone_cmd) { | ||||
case DISK_ZONE_OPEN: | case DISK_ZONE_OPEN: | ||||
case DISK_ZONE_CLOSE: | case DISK_ZONE_CLOSE: | ||||
case DISK_ZONE_FINISH: | case DISK_ZONE_FINISH: | ||||
case DISK_ZONE_RWP: | case DISK_ZONE_RWP: | ||||
break; | break; | ||||
case DISK_ZONE_REPORT_ZONES: { | case DISK_ZONE_REPORT_ZONES: { | ||||
uint32_t avail_len; | uint32_t avail_len; | ||||
struct disk_zone_report *rep; | struct disk_zone_report *rep; | ||||
struct scsi_report_zones_hdr *hdr; | struct scsi_report_zones_hdr *hdr; | ||||
struct scsi_report_zones_desc *desc; | struct scsi_report_zones_desc *desc; | ||||
struct disk_zone_rep_entry *entry; | struct disk_zone_rep_entry *entry; | ||||
uint32_t num_alloced, hdr_len, num_avail; | uint32_t hdr_len, num_avail; | ||||
uint32_t num_to_fill, i; | uint32_t num_to_fill, i; | ||||
rep = &bp->bio_zone.zone_params.report; | rep = &bp->bio_zone.zone_params.report; | ||||
avail_len = ccb->ataio.dxfer_len - ccb->ataio.resid; | avail_len = ccb->ataio.dxfer_len - ccb->ataio.resid; | ||||
/* | /* | ||||
* Note that bio_resid isn't normally used for zone | * Note that bio_resid isn't normally used for zone | ||||
* commands, but it is used by devstat_end_transaction_bio() | * commands, but it is used by devstat_end_transaction_bio() | ||||
* to determine how much data was transferred. Because | * to determine how much data was transferred. Because | ||||
* the size of the SCSI/ATA data structures is different | * the size of the SCSI/ATA data structures is different | ||||
* than the size of the BIO interface structures, the | * than the size of the BIO interface structures, the | ||||
* amount of data actually transferred from the drive will | * amount of data actually transferred from the drive will | ||||
* be different than the amount of data transferred to | * be different than the amount of data transferred to | ||||
* the user. | * the user. | ||||
*/ | */ | ||||
num_alloced = rep->entries_allocated; | |||||
hdr = (struct scsi_report_zones_hdr *)ccb->ataio.data_ptr; | hdr = (struct scsi_report_zones_hdr *)ccb->ataio.data_ptr; | ||||
if (avail_len < sizeof(*hdr)) { | if (avail_len < sizeof(*hdr)) { | ||||
/* | /* | ||||
* Is there a better error than EIO here? We asked | * Is there a better error than EIO here? We asked | ||||
* for at least the header, and we got less than | * for at least the header, and we got less than | ||||
* that. | * that. | ||||
*/ | */ | ||||
bp->bio_error = EIO; | bp->bio_error = EIO; | ||||
▲ Show 20 Lines • Show All 882 Lines • Show Last 20 Lines |