Lines Matching refs:acb

78 static __inline struct acb*	adwgetacb(struct adw_softc *adw);
80 struct acb *acb);
95 static void adwprocesserror(struct adw_softc *adw, struct acb *acb);
102 static __inline struct acb*
105 struct acb* acb;
109 if ((acb = SLIST_FIRST(&adw->free_acb_list)) != NULL) {
113 acb = SLIST_FIRST(&adw->free_acb_list);
114 if (acb == NULL)
121 return (acb);
125 adwfreeacb(struct adw_softc *adw, struct acb *acb)
130 if ((acb->state & ACB_ACTIVE) != 0)
131 LIST_REMOVE(&acb->ccb->ccb_h, sim_links.le);
132 if ((acb->state & ACB_RELEASE_SIMQ) != 0)
133 acb->ccb->ccb_h.status |= CAM_RELEASE_SIMQ;
135 && (acb->ccb->ccb_h.status & CAM_RELEASE_SIMQ) == 0) {
136 acb->ccb->ccb_h.status |= CAM_RELEASE_SIMQ;
139 acb->state = ACB_FREE;
140 SLIST_INSERT_HEAD(&adw->free_acb_list, acb, links);
184 struct acb *next_acb;
211 acbvtob(adw, next_acb) + offsetof(struct acb, sense_data);
228 struct acb *acb;
232 acb = (struct acb *)arg;
233 ccb = acb->ccb;
246 adwfreeacb(adw, acb);
254 acb->queue.data_addr = dm_segs[0].ds_addr;
255 acb->queue.data_cnt = ccb->csio.dxfer_len;
265 sg_busaddr = acb->sg_busaddr;
268 for (sg_block = acb->sg_blocks;; sg_block++) {
292 acb->queue.sg_real_addr = acb->sg_busaddr;
294 acb->queue.sg_real_addr = 0;
302 bus_dmamap_sync(adw->buffer_dmat, acb->dmamap, op);
305 acb->queue.data_addr = 0;
306 acb->queue.data_cnt = 0;
307 acb->queue.sg_real_addr = 0;
316 bus_dmamap_unload(adw->buffer_dmat, acb->dmamap);
317 adwfreeacb(adw, acb);
322 acb->state |= ACB_ACTIVE;
325 callout_reset(&acb->timer, (ccb->ccb_h.timeout * hz) / 1000,
326 adwtimeout, acb);
328 adw_send_acb(adw, acb, acbvtob(adw, acb));
348 struct acb *acb;
361 if ((acb = adwgetacb(adw)) == NULL) {
369 /* Link acb and ccb so we can find one from the other */
370 acb->ccb = ccb;
371 ccb->ccb_h.ccb_acb_ptr = acb;
374 acb->queue.cntl = 0;
375 acb->queue.target_cmd = 0;
376 acb->queue.target_id = ccb->ccb_h.target_id;
377 acb->queue.target_lun = ccb->ccb_h.target_lun;
379 acb->queue.mflag = 0;
380 acb->queue.sense_len =
381 MIN(csio->sense_len, sizeof(acb->sense_data));
382 acb->queue.cdb_len = csio->cdb_len;
386 acb->queue.scsi_cntl = ADW_QSC_SIMPLE_Q_TAG;
389 acb->queue.scsi_cntl = ADW_QSC_HEAD_OF_Q_TAG;
392 acb->queue.scsi_cntl = ADW_QSC_ORDERED_Q_TAG;
395 acb->queue.scsi_cntl = ADW_QSC_NO_TAGMSG;
399 acb->queue.scsi_cntl = ADW_QSC_NO_TAGMSG;
402 acb->queue.scsi_cntl |= ADW_QSC_NO_DISC;
404 acb->queue.done_status = 0;
405 acb->queue.scsi_status = 0;
406 acb->queue.host_status = 0;
407 acb->queue.sg_wk_ix = 0;
411 acb->queue.cdb, csio->cdb_len);
415 adwfreeacb(adw, acb);
421 acb->queue.cdb, csio->cdb_len);
425 acb->dmamap,
428 acb, /*flags*/0);
435 acb->state |= CAM_RELEASE_SIMQ;
1043 /* DMA tag for our acb structures */
1052 /* maxsize */ adw->max_acbs * sizeof(struct acb),
1074 adw->max_acbs * sizeof(struct acb),
1078 bzero(adw->acbs, adw->max_acbs * sizeof(struct acb));
1254 struct acb *acb;
1268 acb = acbbotov(adw, adw->responseq->areq_ba);
1282 ccb = acb->ccb;
1283 callout_stop(&acb->timer);
1291 bus_dmamap_sync(adw->buffer_dmat, acb->dmamap, op);
1292 bus_dmamap_unload(adw->buffer_dmat, acb->dmamap);
1293 ccb->csio.resid = acb->queue.data_cnt;
1298 if (acb->queue.host_status == QHSTA_NO_ERROR
1299 && (acb->queue.done_status == QD_NO_ERROR
1300 || acb->queue.done_status == QD_WITH_ERROR)) {
1301 ccb->csio.scsi_status = acb->queue.scsi_status;
1309 bcopy(&acb->sense_data, &ccb->csio.sense_data,
1312 ccb->csio.sense_resid = acb->queue.sense_len;
1320 adwfreeacb(adw, acb);
1323 adwprocesserror(adw, acb);
1329 adwprocesserror(struct adw_softc *adw, struct acb *acb)
1333 ccb = acb->ccb;
1334 if (acb->queue.done_status == QD_ABORTED_BY_HOST) {
1338 switch (acb->queue.host_status) {
1398 ccb->csio.scsi_status = acb->queue.scsi_status;
1404 acb->queue.host_status);
1408 if ((acb->state & ACB_RECOVERY_ACB) != 0) {
1417 adwfreeacb(adw, acb);
1424 struct acb *acb;
1430 acb = (struct acb *)arg;
1431 ccb = acb->ccb;
1434 printf("ACB %p - timed out\n", (void *)acb);
1438 if ((acb->state & ACB_ACTIVE) == 0) {
1441 (void *)acb);
1445 acb->state |= ACB_RECOVERY_ACB;