Changeset View
Changeset View
Standalone View
Standalone View
head/sys/cam/scsi/scsi_pass.c
Show First 20 Lines • Show All 577 Lines • ▼ Show 20 Lines | passregister(struct cam_periph *periph, void *arg) | ||||
TAILQ_INIT(&softc->incoming_queue); | TAILQ_INIT(&softc->incoming_queue); | ||||
TAILQ_INIT(&softc->active_queue); | TAILQ_INIT(&softc->active_queue); | ||||
TAILQ_INIT(&softc->abandoned_queue); | TAILQ_INIT(&softc->abandoned_queue); | ||||
TAILQ_INIT(&softc->done_queue); | TAILQ_INIT(&softc->done_queue); | ||||
snprintf(softc->zone_name, sizeof(softc->zone_name), "%s%d", | snprintf(softc->zone_name, sizeof(softc->zone_name), "%s%d", | ||||
periph->periph_name, periph->unit_number); | periph->periph_name, periph->unit_number); | ||||
snprintf(softc->io_zone_name, sizeof(softc->io_zone_name), "%s%dIO", | snprintf(softc->io_zone_name, sizeof(softc->io_zone_name), "%s%dIO", | ||||
periph->periph_name, periph->unit_number); | periph->periph_name, periph->unit_number); | ||||
softc->io_zone_size = MAXPHYS; | softc->io_zone_size = maxphys; | ||||
knlist_init_mtx(&softc->read_select.si_note, cam_periph_mtx(periph)); | knlist_init_mtx(&softc->read_select.si_note, cam_periph_mtx(periph)); | ||||
xpt_path_inq(&cpi, periph->path); | xpt_path_inq(&cpi, periph->path); | ||||
if (cpi.maxio == 0) | if (cpi.maxio == 0) | ||||
softc->maxio = DFLTPHYS; /* traditional default */ | softc->maxio = DFLTPHYS; /* traditional default */ | ||||
else if (cpi.maxio > MAXPHYS) | else if (cpi.maxio > maxphys) | ||||
softc->maxio = MAXPHYS; /* for safety */ | softc->maxio = maxphys; /* for safety */ | ||||
else | else | ||||
softc->maxio = cpi.maxio; /* real value */ | softc->maxio = cpi.maxio; /* real value */ | ||||
if (cpi.hba_misc & PIM_UNMAPPED) | if (cpi.hba_misc & PIM_UNMAPPED) | ||||
softc->flags |= PASS_FLAG_UNMAPPED_CAPABLE; | softc->flags |= PASS_FLAG_UNMAPPED_CAPABLE; | ||||
/* | /* | ||||
* We pass in 0 for a blocksize, since we don't | * We pass in 0 for a blocksize, since we don't | ||||
▲ Show 20 Lines • Show All 899 Lines • ▼ Show 20 Lines | if (lengths[0] == 0) { | ||||
xpt_print(periph->path, "%s: no dxfer_len specified, " | xpt_print(periph->path, "%s: no dxfer_len specified, " | ||||
"but CAM_DATA_SG flag is set!\n", __func__); | "but CAM_DATA_SG flag is set!\n", __func__); | ||||
error = EINVAL; | error = EINVAL; | ||||
goto bailout; | goto bailout; | ||||
} | } | ||||
/* | /* | ||||
* We allocate buffers in io_zone_size increments for an | * We allocate buffers in io_zone_size increments for an | ||||
* S/G list. This will generally be MAXPHYS. | * S/G list. This will generally be maxphys. | ||||
*/ | */ | ||||
if (lengths[0] <= softc->io_zone_size) | if (lengths[0] <= softc->io_zone_size) | ||||
num_segs_needed = 1; | num_segs_needed = 1; | ||||
else { | else { | ||||
num_segs_needed = lengths[0] / softc->io_zone_size; | num_segs_needed = lengths[0] / softc->io_zone_size; | ||||
if ((lengths[0] % softc->io_zone_size) != 0) | if ((lengths[0] % softc->io_zone_size) != 0) | ||||
num_segs_needed++; | num_segs_needed++; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 732 Lines • Show Last 20 Lines |