Bring legacy CAM target implementation back into API/KPI-coherent and even
functional state. While CTL is much more superior target from all points, there is no reason why this code should not work. Tested with ahc(4) as target side HBA. MFC after: 2 weeks
This commit is contained in:
parent
f017ca80b1
commit
1d64933fe2
@ -365,7 +365,7 @@ init_ccbs()
|
||||
for (i = 0; i < MAX_INITIATORS; i++) {
|
||||
struct ccb_accept_tio *atio;
|
||||
struct atio_descr *a_descr;
|
||||
struct ccb_immed_notify *inot;
|
||||
struct ccb_immediate_notify *inot;
|
||||
|
||||
atio = (struct ccb_accept_tio *)malloc(sizeof(*atio));
|
||||
if (atio == NULL) {
|
||||
@ -382,7 +382,7 @@ init_ccbs()
|
||||
atio->ccb_h.targ_descr = a_descr;
|
||||
send_ccb((union ccb *)atio, /*priority*/1);
|
||||
|
||||
inot = (struct ccb_immed_notify *)malloc(sizeof(*inot));
|
||||
inot = (struct ccb_immediate_notify *)malloc(sizeof(*inot));
|
||||
if (inot == NULL) {
|
||||
warn("malloc INOT");
|
||||
return (-1);
|
||||
@ -593,7 +593,7 @@ handle_read()
|
||||
oo += run_queue(c_descr->atio);
|
||||
break;
|
||||
}
|
||||
case XPT_IMMED_NOTIFY:
|
||||
case XPT_IMMEDIATE_NOTIFY:
|
||||
/* INOTs are handled with priority */
|
||||
TAILQ_INSERT_HEAD(&work_queue, &ccb->ccb_h,
|
||||
periph_links.tqe);
|
||||
@ -903,7 +903,7 @@ free_ccb(union ccb *ccb)
|
||||
case XPT_ACCEPT_TARGET_IO:
|
||||
free(ccb->ccb_h.targ_descr);
|
||||
/* FALLTHROUGH */
|
||||
case XPT_IMMED_NOTIFY:
|
||||
case XPT_IMMEDIATE_NOTIFY:
|
||||
default:
|
||||
free(ccb);
|
||||
break;
|
||||
|
@ -305,10 +305,10 @@ targbhenlun(struct cam_periph *periph)
|
||||
* so the SIM can tell us of asynchronous target mode events.
|
||||
*/
|
||||
for (i = 0; i < MAX_ACCEPT; i++) {
|
||||
struct ccb_immed_notify *inot;
|
||||
struct ccb_immediate_notify *inot;
|
||||
|
||||
inot = (struct ccb_immed_notify*)malloc(sizeof(*inot), M_SCSIBH,
|
||||
M_NOWAIT);
|
||||
inot = (struct ccb_immediate_notify*)malloc(sizeof(*inot),
|
||||
M_SCSIBH, M_NOWAIT);
|
||||
|
||||
if (inot == NULL) {
|
||||
status = CAM_RESRC_UNAVAIL;
|
||||
@ -316,7 +316,7 @@ targbhenlun(struct cam_periph *periph)
|
||||
}
|
||||
|
||||
xpt_setup_ccb(&inot->ccb_h, periph->path, CAM_PRIORITY_NORMAL);
|
||||
inot->ccb_h.func_code = XPT_IMMED_NOTIFY;
|
||||
inot->ccb_h.func_code = XPT_IMMEDIATE_NOTIFY;
|
||||
inot->ccb_h.cbfcnp = targbhdone;
|
||||
SLIST_INSERT_HEAD(&softc->immed_notify_slist, &inot->ccb_h,
|
||||
periph_links.sle);
|
||||
@ -712,7 +712,7 @@ targbhdone(struct cam_periph *periph, union ccb *done_ccb)
|
||||
}
|
||||
break;
|
||||
}
|
||||
case XPT_IMMED_NOTIFY:
|
||||
case XPT_IMMEDIATE_NOTIFY:
|
||||
{
|
||||
int frozen;
|
||||
|
||||
|
@ -551,6 +551,7 @@ targwrite(struct cdev *dev, struct uio *uio, int ioflag)
|
||||
switch (func_code) {
|
||||
case XPT_ACCEPT_TARGET_IO:
|
||||
case XPT_IMMED_NOTIFY:
|
||||
case XPT_IMMEDIATE_NOTIFY:
|
||||
cam_periph_lock(softc->periph);
|
||||
ccb = targgetccb(softc, func_code, priority);
|
||||
descr = (struct targ_cmd_descr *)ccb->ccb_h.targ_descr;
|
||||
@ -781,6 +782,7 @@ targdone(struct cam_periph *periph, union ccb *done_ccb)
|
||||
switch (done_ccb->ccb_h.func_code) {
|
||||
/* All FC_*_QUEUED CCBs go back to userland */
|
||||
case XPT_IMMED_NOTIFY:
|
||||
case XPT_IMMEDIATE_NOTIFY:
|
||||
case XPT_ACCEPT_TARGET_IO:
|
||||
case XPT_CONT_TARGET_IO:
|
||||
TAILQ_INSERT_TAIL(&softc->user_ccb_queue, &done_ccb->ccb_h,
|
||||
@ -961,6 +963,7 @@ targfreeccb(struct targ_softc *softc, union ccb *ccb)
|
||||
switch (ccb->ccb_h.func_code) {
|
||||
case XPT_ACCEPT_TARGET_IO:
|
||||
case XPT_IMMED_NOTIFY:
|
||||
case XPT_IMMEDIATE_NOTIFY:
|
||||
CAM_DEBUG_PRINT(CAM_DEBUG_PERIPH, ("freeing ccb %p\n", ccb));
|
||||
free(ccb, M_TARG);
|
||||
break;
|
||||
@ -1131,6 +1134,9 @@ targccblen(xpt_opcode func_code)
|
||||
case XPT_IMMED_NOTIFY:
|
||||
len = sizeof(struct ccb_immed_notify);
|
||||
break;
|
||||
case XPT_IMMEDIATE_NOTIFY:
|
||||
len = sizeof(struct ccb_immediate_notify);
|
||||
break;
|
||||
case XPT_REL_SIMQ:
|
||||
len = sizeof(struct ccb_relsim);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user