Deleted Added
full compact
aic7xxx_osm.c (74094) aic7xxx_osm.c (74972)
1/*
2 * Bus independent FreeBSD shim for the aic7xxx based adaptec SCSI controllers
3 *
4 * Copyright (c) 1994-2001 Justin T. Gibbs.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 16 unchanged lines hidden (view full) ---

25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 *
31 * $Id$
32 *
1/*
2 * Bus independent FreeBSD shim for the aic7xxx based adaptec SCSI controllers
3 *
4 * Copyright (c) 1994-2001 Justin T. Gibbs.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 16 unchanged lines hidden (view full) ---

25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 *
31 * $Id$
32 *
33 * $FreeBSD: head/sys/dev/aic7xxx/aic7xxx_osm.c 74094 2001-03-11 06:34:17Z gibbs $
33 * $FreeBSD: head/sys/dev/aic7xxx/aic7xxx_osm.c 74972 2001-03-29 00:36:35Z gibbs $
34 */
35
36#include <dev/aic7xxx/aic7xxx_freebsd.h>
37#include <dev/aic7xxx/aic7xxx_inline.h>
38
39#ifndef AHC_TMODE_ENABLE
40#define AHC_TMODE_ENABLE 0
41#endif

--- 241 unchanged lines hidden (view full) ---

283 op = BUS_DMASYNC_POSTREAD;
284 else
285 op = BUS_DMASYNC_POSTWRITE;
286 bus_dmamap_sync(ahc->buffer_dmat, scb->dmamap, op);
287 bus_dmamap_unload(ahc->buffer_dmat, scb->dmamap);
288 }
289
290 if (ccb->ccb_h.func_code == XPT_CONT_TARGET_IO) {
34 */
35
36#include <dev/aic7xxx/aic7xxx_freebsd.h>
37#include <dev/aic7xxx/aic7xxx_inline.h>
38
39#ifndef AHC_TMODE_ENABLE
40#define AHC_TMODE_ENABLE 0
41#endif

--- 241 unchanged lines hidden (view full) ---

283 op = BUS_DMASYNC_POSTREAD;
284 else
285 op = BUS_DMASYNC_POSTWRITE;
286 bus_dmamap_sync(ahc->buffer_dmat, scb->dmamap, op);
287 bus_dmamap_unload(ahc->buffer_dmat, scb->dmamap);
288 }
289
290 if (ccb->ccb_h.func_code == XPT_CONT_TARGET_IO) {
291 struct cam_path *ccb_path;
292
293 /*
294 * If we have finally disconnected, clean up our
295 * pending device state.
296 * XXX - There may be error states that cause where
297 * we will remain connected.
298 */
299 ccb_path = ccb->ccb_h.path;
300 if (ahc->pending_device != NULL
301 && xpt_path_comp(ahc->pending_device->path, ccb_path) == 0) {
302
303 if ((ccb->ccb_h.flags & CAM_SEND_STATUS) != 0) {
304 ahc->pending_device = NULL;
305 } else {
306 xpt_print_path(ccb->ccb_h.path);
307 printf("Still disconnected\n");
308 ahc_freeze_ccb(ccb);
309 }
310 }
311
291 if (ahc_get_transaction_status(scb) == CAM_REQ_INPROG)
292 ccb->ccb_h.status |= CAM_REQ_CMP;
293 ccb->ccb_h.status &= ~CAM_SIM_QUEUED;
294 ahc_free_scb(ahc, scb);
295 xpt_done(ccb);
296 return;
297 }
298

--- 57 unchanged lines hidden (view full) ---

356 ahc_free_scb(ahc, scb);
357 xpt_done(ccb);
358}
359
360static void
361ahc_action(struct cam_sim *sim, union ccb *ccb)
362{
363 struct ahc_softc *ahc;
312 if (ahc_get_transaction_status(scb) == CAM_REQ_INPROG)
313 ccb->ccb_h.status |= CAM_REQ_CMP;
314 ccb->ccb_h.status &= ~CAM_SIM_QUEUED;
315 ahc_free_scb(ahc, scb);
316 xpt_done(ccb);
317 return;
318 }
319

--- 57 unchanged lines hidden (view full) ---

377 ahc_free_scb(ahc, scb);
378 xpt_done(ccb);
379}
380
381static void
382ahc_action(struct cam_sim *sim, union ccb *ccb)
383{
384 struct ahc_softc *ahc;
364 struct tmode_lstate *lstate;
385 struct ahc_tmode_lstate *lstate;
365 u_int target_id;
366 u_int our_id;
367 long s;
368
369 CAM_DEBUG(ccb->ccb_h.path, CAM_DEBUG_TRACE, ("ahc_action\n"));
370
371 ahc = (struct ahc_softc *)cam_sim_softc(sim);
372
373 target_id = ccb->ccb_h.target_id;
374 our_id = SIM_SCSI_ID(ahc, sim);
375
376 switch (ccb->ccb_h.func_code) {
377 /* Common cases first */
378 case XPT_ACCEPT_TARGET_IO: /* Accept Host Target Mode CDB */
379 case XPT_CONT_TARGET_IO:/* Continue Host Target I/O Connection*/
380 {
386 u_int target_id;
387 u_int our_id;
388 long s;
389
390 CAM_DEBUG(ccb->ccb_h.path, CAM_DEBUG_TRACE, ("ahc_action\n"));
391
392 ahc = (struct ahc_softc *)cam_sim_softc(sim);
393
394 target_id = ccb->ccb_h.target_id;
395 our_id = SIM_SCSI_ID(ahc, sim);
396
397 switch (ccb->ccb_h.func_code) {
398 /* Common cases first */
399 case XPT_ACCEPT_TARGET_IO: /* Accept Host Target Mode CDB */
400 case XPT_CONT_TARGET_IO:/* Continue Host Target I/O Connection*/
401 {
381 struct tmode_tstate *tstate;
402 struct ahc_tmode_tstate *tstate;
382 cam_status status;
383
384 status = ahc_find_tmode_devs(ahc, sim, ccb, &tstate,
385 &lstate, TRUE);
386
387 if (status != CAM_REQ_CMP) {
388 if (ccb->ccb_h.func_code == XPT_CONT_TARGET_IO) {
389 /* Response from the black hole device */

--- 32 unchanged lines hidden (view full) ---

422 struct scb *scb;
423 struct hardware_scb *hscb;
424
425 if ((ahc->flags & AHC_INITIATORROLE) == 0
426 && (ccb->ccb_h.func_code == XPT_SCSI_IO
427 || ccb->ccb_h.func_code == XPT_RESET_DEV)) {
428 ccb->ccb_h.status = CAM_PROVIDE_FAIL;
429 xpt_done(ccb);
403 cam_status status;
404
405 status = ahc_find_tmode_devs(ahc, sim, ccb, &tstate,
406 &lstate, TRUE);
407
408 if (status != CAM_REQ_CMP) {
409 if (ccb->ccb_h.func_code == XPT_CONT_TARGET_IO) {
410 /* Response from the black hole device */

--- 32 unchanged lines hidden (view full) ---

443 struct scb *scb;
444 struct hardware_scb *hscb;
445
446 if ((ahc->flags & AHC_INITIATORROLE) == 0
447 && (ccb->ccb_h.func_code == XPT_SCSI_IO
448 || ccb->ccb_h.func_code == XPT_RESET_DEV)) {
449 ccb->ccb_h.status = CAM_PROVIDE_FAIL;
450 xpt_done(ccb);
451 return;
430 }
431
432 /*
433 * get an scb to use.
434 */
435 ahc_lock(ahc, &s);
436 if ((scb = ahc_get_scb(ahc)) == NULL) {
437

--- 27 unchanged lines hidden (view full) ---

465 scb->flags |= SCB_DEVICE_RESET;
466 hscb->control |= MK_MESSAGE;
467 ahc_execute_scb(scb, NULL, 0, 0);
468 } else {
469 if (ccb->ccb_h.func_code == XPT_CONT_TARGET_IO) {
470 struct target_data *tdata;
471
472 tdata = &hscb->shared_data.tdata;
452 }
453
454 /*
455 * get an scb to use.
456 */
457 ahc_lock(ahc, &s);
458 if ((scb = ahc_get_scb(ahc)) == NULL) {
459

--- 27 unchanged lines hidden (view full) ---

487 scb->flags |= SCB_DEVICE_RESET;
488 hscb->control |= MK_MESSAGE;
489 ahc_execute_scb(scb, NULL, 0, 0);
490 } else {
491 if (ccb->ccb_h.func_code == XPT_CONT_TARGET_IO) {
492 struct target_data *tdata;
493
494 tdata = &hscb->shared_data.tdata;
473 if (ahc->pending_device == lstate) {
495 if (ahc->pending_device == lstate)
474 scb->flags |= SCB_TARGET_IMMEDIATE;
496 scb->flags |= SCB_TARGET_IMMEDIATE;
475 ahc->pending_device = NULL;
476 }
477 hscb->control |= TARGET_SCB;
478 tdata->target_phases = IDENTIFY_SEEN;
479 if ((ccb->ccb_h.flags & CAM_SEND_STATUS) != 0) {
480 tdata->target_phases |= SPHASE_PENDING;
481 tdata->scsi_status =
482 ccb->csio.scsi_status;
483 }
497 hscb->control |= TARGET_SCB;
498 tdata->target_phases = IDENTIFY_SEEN;
499 if ((ccb->ccb_h.flags & CAM_SEND_STATUS) != 0) {
500 tdata->target_phases |= SPHASE_PENDING;
501 tdata->scsi_status =
502 ccb->csio.scsi_status;
503 }
504 if (ccb->ccb_h.flags & CAM_DIS_DISCONNECT)
505 tdata->target_phases |= NO_DISCONNECT;
506
484 tdata->initiator_tag = ccb->csio.tag_id;
485 }
486 if (ccb->ccb_h.flags & CAM_TAG_ACTION_VALID)
487 hscb->control |= ccb->csio.tag_action;
488
489 ahc_setup_data(ahc, sim, &ccb->csio, scb);
490 }
491 break;
492 }
493 case XPT_NOTIFY_ACK:
494 case XPT_IMMED_NOTIFY:
495 {
507 tdata->initiator_tag = ccb->csio.tag_id;
508 }
509 if (ccb->ccb_h.flags & CAM_TAG_ACTION_VALID)
510 hscb->control |= ccb->csio.tag_action;
511
512 ahc_setup_data(ahc, sim, &ccb->csio, scb);
513 }
514 break;
515 }
516 case XPT_NOTIFY_ACK:
517 case XPT_IMMED_NOTIFY:
518 {
496 struct tmode_tstate *tstate;
497 struct tmode_lstate *lstate;
519 struct ahc_tmode_tstate *tstate;
520 struct ahc_tmode_lstate *lstate;
498 cam_status status;
499
500 status = ahc_find_tmode_devs(ahc, sim, ccb, &tstate,
501 &lstate, TRUE);
502
503 if (status != CAM_REQ_CMP) {
504 ccb->ccb_h.status = status;
505 xpt_done(ccb);

--- 17 unchanged lines hidden (view full) ---

523 case XPT_SET_TRAN_SETTINGS:
524 {
525#ifdef AHC_NEW_TRAN_SETTINGS
526 struct ahc_devinfo devinfo;
527 struct ccb_trans_settings *cts;
528 struct ccb_trans_settings_scsi *scsi;
529 struct ccb_trans_settings_spi *spi;
530 struct ahc_initiator_tinfo *tinfo;
521 cam_status status;
522
523 status = ahc_find_tmode_devs(ahc, sim, ccb, &tstate,
524 &lstate, TRUE);
525
526 if (status != CAM_REQ_CMP) {
527 ccb->ccb_h.status = status;
528 xpt_done(ccb);

--- 17 unchanged lines hidden (view full) ---

546 case XPT_SET_TRAN_SETTINGS:
547 {
548#ifdef AHC_NEW_TRAN_SETTINGS
549 struct ahc_devinfo devinfo;
550 struct ccb_trans_settings *cts;
551 struct ccb_trans_settings_scsi *scsi;
552 struct ccb_trans_settings_spi *spi;
553 struct ahc_initiator_tinfo *tinfo;
531 struct tmode_tstate *tstate;
554 struct ahc_tmode_tstate *tstate;
532 uint16_t *discenable;
533 uint16_t *tagenable;
534 u_int update_type;
535
536 cts = &ccb->cts;
537 scsi = &cts->proto_specific.scsi;
538 spi = &cts->xport_specific.spi;
539 ahc_compile_devinfo(&devinfo, SIM_SCSI_ID(ahc, sim),

--- 107 unchanged lines hidden (view full) ---

647 }
648 ahc_unlock(ahc, &s);
649 ccb->ccb_h.status = CAM_REQ_CMP;
650 xpt_done(ccb);
651#else
652 struct ahc_devinfo devinfo;
653 struct ccb_trans_settings *cts;
654 struct ahc_initiator_tinfo *tinfo;
555 uint16_t *discenable;
556 uint16_t *tagenable;
557 u_int update_type;
558
559 cts = &ccb->cts;
560 scsi = &cts->proto_specific.scsi;
561 spi = &cts->xport_specific.spi;
562 ahc_compile_devinfo(&devinfo, SIM_SCSI_ID(ahc, sim),

--- 107 unchanged lines hidden (view full) ---

670 }
671 ahc_unlock(ahc, &s);
672 ccb->ccb_h.status = CAM_REQ_CMP;
673 xpt_done(ccb);
674#else
675 struct ahc_devinfo devinfo;
676 struct ccb_trans_settings *cts;
677 struct ahc_initiator_tinfo *tinfo;
655 struct tmode_tstate *tstate;
678 struct ahc_tmode_tstate *tstate;
656 uint16_t *discenable;
657 uint16_t *tagenable;
658 u_int update_type;
659 long s;
660
661 cts = &ccb->cts;
662 ahc_compile_devinfo(&devinfo, SIM_SCSI_ID(ahc, sim),
663 cts->ccb_h.target_id,

--- 226 unchanged lines hidden (view full) ---

890ahc_get_tran_settings(struct ahc_softc *ahc, int our_id, char channel,
891 struct ccb_trans_settings *cts)
892{
893#ifdef AHC_NEW_TRAN_SETTINGS
894 struct ahc_devinfo devinfo;
895 struct ccb_trans_settings_scsi *scsi;
896 struct ccb_trans_settings_spi *spi;
897 struct ahc_initiator_tinfo *targ_info;
679 uint16_t *discenable;
680 uint16_t *tagenable;
681 u_int update_type;
682 long s;
683
684 cts = &ccb->cts;
685 ahc_compile_devinfo(&devinfo, SIM_SCSI_ID(ahc, sim),
686 cts->ccb_h.target_id,

--- 226 unchanged lines hidden (view full) ---

913ahc_get_tran_settings(struct ahc_softc *ahc, int our_id, char channel,
914 struct ccb_trans_settings *cts)
915{
916#ifdef AHC_NEW_TRAN_SETTINGS
917 struct ahc_devinfo devinfo;
918 struct ccb_trans_settings_scsi *scsi;
919 struct ccb_trans_settings_spi *spi;
920 struct ahc_initiator_tinfo *targ_info;
898 struct tmode_tstate *tstate;
921 struct ahc_tmode_tstate *tstate;
899 struct ahc_transinfo *tinfo;
900
901 scsi = &cts->proto_specific.scsi;
902 spi = &cts->xport_specific.spi;
903 ahc_compile_devinfo(&devinfo, our_id,
904 cts->ccb_h.target_id,
905 cts->ccb_h.target_lun,
906 channel, ROLE_UNKNOWN);

--- 42 unchanged lines hidden (view full) ---

949 } else {
950 scsi->valid = 0;
951 }
952
953 cts->ccb_h.status = CAM_REQ_CMP;
954#else
955 struct ahc_devinfo devinfo;
956 struct ahc_initiator_tinfo *targ_info;
922 struct ahc_transinfo *tinfo;
923
924 scsi = &cts->proto_specific.scsi;
925 spi = &cts->xport_specific.spi;
926 ahc_compile_devinfo(&devinfo, our_id,
927 cts->ccb_h.target_id,
928 cts->ccb_h.target_lun,
929 channel, ROLE_UNKNOWN);

--- 42 unchanged lines hidden (view full) ---

972 } else {
973 scsi->valid = 0;
974 }
975
976 cts->ccb_h.status = CAM_REQ_CMP;
977#else
978 struct ahc_devinfo devinfo;
979 struct ahc_initiator_tinfo *targ_info;
957 struct tmode_tstate *tstate;
980 struct ahc_tmode_tstate *tstate;
958 struct ahc_transinfo *tinfo;
959 long s;
960
961 ahc_compile_devinfo(&devinfo, our_id,
962 cts->ccb_h.target_id,
963 cts->ccb_h.target_lun,
964 channel, ROLE_UNKNOWN);
965 targ_info = ahc_fetch_transinfo(ahc, devinfo.channel,

--- 80 unchanged lines hidden (view full) ---

1046static void
1047ahc_execute_scb(void *arg, bus_dma_segment_t *dm_segs, int nsegments,
1048 int error)
1049{
1050 struct scb *scb;
1051 union ccb *ccb;
1052 struct ahc_softc *ahc;
1053 struct ahc_initiator_tinfo *tinfo;
981 struct ahc_transinfo *tinfo;
982 long s;
983
984 ahc_compile_devinfo(&devinfo, our_id,
985 cts->ccb_h.target_id,
986 cts->ccb_h.target_lun,
987 channel, ROLE_UNKNOWN);
988 targ_info = ahc_fetch_transinfo(ahc, devinfo.channel,

--- 80 unchanged lines hidden (view full) ---

1069static void
1070ahc_execute_scb(void *arg, bus_dma_segment_t *dm_segs, int nsegments,
1071 int error)
1072{
1073 struct scb *scb;
1074 union ccb *ccb;
1075 struct ahc_softc *ahc;
1076 struct ahc_initiator_tinfo *tinfo;
1054 struct tmode_tstate *tstate;
1077 struct ahc_tmode_tstate *tstate;
1055 u_int mask;
1056 long s;
1057
1058 scb = (struct scb *)arg;
1059 ccb = scb->io_ctx;
1060 ahc = scb->ahc_softc;
1061
1062 if (error != 0) {

--- 118 unchanged lines hidden (view full) ---

1181 SCSIID_TARGET(ahc, scb->hscb->scsiid),
1182 &tstate);
1183
1184 mask = SCB_GET_TARGET_MASK(ahc, scb);
1185 scb->hscb->scsirate = tinfo->scsirate;
1186 scb->hscb->scsioffset = tinfo->current.offset;
1187 if ((tstate->ultraenb & mask) != 0)
1188 scb->hscb->control |= ULTRAENB;
1078 u_int mask;
1079 long s;
1080
1081 scb = (struct scb *)arg;
1082 ccb = scb->io_ctx;
1083 ahc = scb->ahc_softc;
1084
1085 if (error != 0) {

--- 118 unchanged lines hidden (view full) ---

1204 SCSIID_TARGET(ahc, scb->hscb->scsiid),
1205 &tstate);
1206
1207 mask = SCB_GET_TARGET_MASK(ahc, scb);
1208 scb->hscb->scsirate = tinfo->scsirate;
1209 scb->hscb->scsioffset = tinfo->current.offset;
1210 if ((tstate->ultraenb & mask) != 0)
1211 scb->hscb->control |= ULTRAENB;
1189
1212
1190 if ((tstate->discenable & mask) != 0
1191 && (ccb->ccb_h.flags & CAM_DIS_DISCONNECT) == 0)
1192 scb->hscb->control |= DISCENB;
1193
1194 if ((ccb->ccb_h.flags & CAM_NEGOTIATE) != 0
1195 && (tinfo->goal.width != 0
1196 || tinfo->goal.period != 0
1197 || tinfo->goal.ppr_options != 0)) {
1198 scb->flags |= SCB_NEGOTIATE;
1199 scb->hscb->control |= MK_MESSAGE;
1213 if ((tstate->discenable & mask) != 0
1214 && (ccb->ccb_h.flags & CAM_DIS_DISCONNECT) == 0)
1215 scb->hscb->control |= DISCENB;
1216
1217 if ((ccb->ccb_h.flags & CAM_NEGOTIATE) != 0
1218 && (tinfo->goal.width != 0
1219 || tinfo->goal.period != 0
1220 || tinfo->goal.ppr_options != 0)) {
1221 scb->flags |= SCB_NEGOTIATE;
1222 scb->hscb->control |= MK_MESSAGE;
1223 } else if ((tstate->auto_negotiate & mask) != 0) {
1224 scb->flags |= SCB_AUTO_NEGOTIATE;
1225 scb->hscb->control |= MK_MESSAGE;
1200 }
1201
1202 LIST_INSERT_HEAD(&ahc->pending_scbs, scb, pending_links);
1203
1204 ccb->ccb_h.status |= CAM_SIM_QUEUED;
1205
1206 if (ccb->ccb_h.timeout != CAM_TIME_INFINITY) {
1207 uint64_t time;

--- 26 unchanged lines hidden (view full) ---

1234 if (TAILQ_FIRST(untagged_q) != scb) {
1235 ahc_unlock(ahc, &s);
1236 return;
1237 }
1238 }
1239 scb->flags |= SCB_ACTIVE;
1240
1241 if ((scb->flags & SCB_TARGET_IMMEDIATE) != 0) {
1226 }
1227
1228 LIST_INSERT_HEAD(&ahc->pending_scbs, scb, pending_links);
1229
1230 ccb->ccb_h.status |= CAM_SIM_QUEUED;
1231
1232 if (ccb->ccb_h.timeout != CAM_TIME_INFINITY) {
1233 uint64_t time;

--- 26 unchanged lines hidden (view full) ---

1260 if (TAILQ_FIRST(untagged_q) != scb) {
1261 ahc_unlock(ahc, &s);
1262 return;
1263 }
1264 }
1265 scb->flags |= SCB_ACTIVE;
1266
1267 if ((scb->flags & SCB_TARGET_IMMEDIATE) != 0) {
1268 /* Define a mapping from our tag to the SCB. */
1269 ahc->scb_data->scbindex[scb->hscb->tag] = scb;
1242 ahc_pause(ahc);
1243 if ((ahc->flags & AHC_PAGESCBS) == 0)
1244 ahc_outb(ahc, SCBPTR, scb->hscb->tag);
1245 ahc_outb(ahc, SCB_TAG, scb->hscb->tag);
1246 ahc_outb(ahc, RETURN_1, CONT_MSG_LOOP);
1247 ahc_unpause(ahc);
1248 } else {
1249 ahc_queue_scb(ahc, scb);

--- 178 unchanged lines hidden (view full) ---

1428 return;
1429 }
1430
1431 target = SCB_GET_TARGET(ahc, scb);
1432 channel = SCB_GET_CHANNEL(ahc, scb);
1433 lun = SCB_GET_LUN(scb);
1434
1435 ahc_print_path(ahc, scb);
1270 ahc_pause(ahc);
1271 if ((ahc->flags & AHC_PAGESCBS) == 0)
1272 ahc_outb(ahc, SCBPTR, scb->hscb->tag);
1273 ahc_outb(ahc, SCB_TAG, scb->hscb->tag);
1274 ahc_outb(ahc, RETURN_1, CONT_MSG_LOOP);
1275 ahc_unpause(ahc);
1276 } else {
1277 ahc_queue_scb(ahc, scb);

--- 178 unchanged lines hidden (view full) ---

1456 return;
1457 }
1458
1459 target = SCB_GET_TARGET(ahc, scb);
1460 channel = SCB_GET_CHANNEL(ahc, scb);
1461 lun = SCB_GET_LUN(scb);
1462
1463 ahc_print_path(ahc, scb);
1436 printf("SCB 0x%x - timed out ", scb->hscb->tag);
1437 /*
1438 * Take a snapshot of the bus state and print out
1439 * some information so we can track down driver bugs.
1440 */
1441 last_phase = ahc_inb(ahc, LASTPHASE);
1442
1443 printf("%s", ahc_lookup_phase_entry(last_phase)->phasemsg);
1444
1445 printf(", SEQADDR == 0x%x\n",
1446 ahc_inb(ahc, SEQADDR0) | (ahc_inb(ahc, SEQADDR1) << 8));
1447
1448 printf("STACK == 0x%x, 0x%x, 0x%x, 0x%x\n",
1449 ahc_inb(ahc, STACK) | (ahc_inb(ahc, STACK) << 8),
1450 ahc_inb(ahc, STACK) | (ahc_inb(ahc, STACK) << 8),
1451 ahc_inb(ahc, STACK) | (ahc_inb(ahc, STACK) << 8),
1452 ahc_inb(ahc, STACK) | (ahc_inb(ahc, STACK) << 8));
1453
1454 printf("SXFRCTL0 == 0x%x\n", ahc_inb(ahc, SXFRCTL0));
1455
1464 printf("SCB 0x%x - timed out\n", scb->hscb->tag);
1456 ahc_dump_card_state(ahc);
1465 ahc_dump_card_state(ahc);
1466 last_phase = ahc_inb(ahc, LASTPHASE);
1457 if (scb->sg_count > 0) {
1458 for (i = 0; i < scb->sg_count; i++) {
1459 printf("sg[%d] - Addr 0x%x : Length %d\n",
1460 i,
1461 scb->sg_list[i].addr,
1462 scb->sg_list[i].len & AHC_SG_LEN_MASK);
1463 }
1464 }

--- 213 unchanged lines hidden (view full) ---

1678 union ccb *abort_ccb;
1679
1680 abort_ccb = ccb->cab.abort_ccb;
1681 switch (abort_ccb->ccb_h.func_code) {
1682 case XPT_ACCEPT_TARGET_IO:
1683 case XPT_IMMED_NOTIFY:
1684 case XPT_CONT_TARGET_IO:
1685 {
1467 if (scb->sg_count > 0) {
1468 for (i = 0; i < scb->sg_count; i++) {
1469 printf("sg[%d] - Addr 0x%x : Length %d\n",
1470 i,
1471 scb->sg_list[i].addr,
1472 scb->sg_list[i].len & AHC_SG_LEN_MASK);
1473 }
1474 }

--- 213 unchanged lines hidden (view full) ---

1688 union ccb *abort_ccb;
1689
1690 abort_ccb = ccb->cab.abort_ccb;
1691 switch (abort_ccb->ccb_h.func_code) {
1692 case XPT_ACCEPT_TARGET_IO:
1693 case XPT_IMMED_NOTIFY:
1694 case XPT_CONT_TARGET_IO:
1695 {
1686 struct tmode_tstate *tstate;
1687 struct tmode_lstate *lstate;
1696 struct ahc_tmode_tstate *tstate;
1697 struct ahc_tmode_lstate *lstate;
1688 struct ccb_hdr_slist *list;
1689 cam_status status;
1690
1691 status = ahc_find_tmode_devs(ahc, sim, abort_ccb, &tstate,
1692 &lstate, TRUE);
1693
1694 if (status != CAM_REQ_CMP) {
1695 ccb->ccb_h.status = status;

--- 117 unchanged lines hidden (view full) ---

1813
1814void
1815ahc_platform_free(struct ahc_softc *ahc)
1816{
1817 struct ahc_platform_data *pdata;
1818
1819 pdata = ahc->platform_data;
1820 if (pdata != NULL) {
1698 struct ccb_hdr_slist *list;
1699 cam_status status;
1700
1701 status = ahc_find_tmode_devs(ahc, sim, abort_ccb, &tstate,
1702 &lstate, TRUE);
1703
1704 if (status != CAM_REQ_CMP) {
1705 ccb->ccb_h.status = status;

--- 117 unchanged lines hidden (view full) ---

1823
1824void
1825ahc_platform_free(struct ahc_softc *ahc)
1826{
1827 struct ahc_platform_data *pdata;
1828
1829 pdata = ahc->platform_data;
1830 if (pdata != NULL) {
1821 device_printf(ahc->dev_softc, "Platform free\n");
1822 if (pdata->regs != NULL)
1823 bus_release_resource(ahc->dev_softc,
1824 pdata->regs_res_type,
1825 pdata->regs_res_id,
1826 pdata->regs);
1827
1828 if (pdata->irq != NULL)
1829 bus_release_resource(ahc->dev_softc,

--- 70 unchanged lines hidden ---
1831 if (pdata->regs != NULL)
1832 bus_release_resource(ahc->dev_softc,
1833 pdata->regs_res_type,
1834 pdata->regs_res_id,
1835 pdata->regs);
1836
1837 if (pdata->irq != NULL)
1838 bus_release_resource(ahc->dev_softc,

--- 70 unchanged lines hidden ---