aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wilcox <matthew@wil.cx>2007-10-02 21:55:33 -0400
committerJames Bottomley <jejb@mulgrave.localdomain>2007-10-12 14:53:34 -0400
commitb352f9237622c64afbac367cadd10d23cb4c5484 (patch)
tree9884857c3e940e03ffd9a3438e9a4a7769a873e0
parentb08fc565500a6f691edae7c5ce2e0480365f848c (diff)
[SCSI] advansys: Sort out debug macros
Replace ASC_DBG{,1,2,3,4,5} with a single variadic macro ASC_DBG. As suggested by Jeff Garzik, include DRV_NAME and __FUNCTION__ in the output. Change all callers to no longer include the function name in the string. Enabling ADVANSYS_DEBUG to test this feature shows a lot of other problems that need to be fixed: - Reorder asc_prt_* functions now that their prototypes have been removed. - There is no longer a struct device in ASC_DVC_CFG/ADV_DVC_CFG, and it wasn't necessarily a PCI device to begin with. Print the bus_id from asc_board->dev instead. - isr_callback no longer exists. - ASC_DBG_PRT_SCSI_CMND isn't being used, so delete asc_prt_scsi_cmnd too. - A missing semicolon Signed-off-by: Matthew Wilcox <willy@linux.intel.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
-rw-r--r--drivers/scsi/advansys.c628
1 files changed, 262 insertions, 366 deletions
diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
index 72ed9721c44b..6bd8e835ea0f 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -75,7 +75,7 @@
75#define ADVANSYS_STATS 75#define ADVANSYS_STATS
76 76
77/* Enable driver tracing. */ 77/* Enable driver tracing. */
78/* #define ADVANSYS_DEBUG */ 78#undef ADVANSYS_DEBUG
79 79
80/* 80/*
81 * Portable Data Types 81 * Portable Data Types
@@ -2277,13 +2277,8 @@ do { \
2277 2277
2278#ifndef ADVANSYS_DEBUG 2278#ifndef ADVANSYS_DEBUG
2279 2279
2280#define ASC_DBG(lvl, s) 2280#define ASC_DBG(lvl, s...)
2281#define ASC_DBG1(lvl, s, a1)
2282#define ASC_DBG2(lvl, s, a1, a2)
2283#define ASC_DBG3(lvl, s, a1, a2, a3)
2284#define ASC_DBG4(lvl, s, a1, a2, a3, a4)
2285#define ASC_DBG_PRT_SCSI_HOST(lvl, s) 2281#define ASC_DBG_PRT_SCSI_HOST(lvl, s)
2286#define ASC_DBG_PRT_SCSI_CMND(lvl, s)
2287#define ASC_DBG_PRT_ASC_SCSI_Q(lvl, scsiqp) 2282#define ASC_DBG_PRT_ASC_SCSI_Q(lvl, scsiqp)
2288#define ASC_DBG_PRT_ADV_SCSI_REQ_Q(lvl, scsiqp) 2283#define ASC_DBG_PRT_ADV_SCSI_REQ_Q(lvl, scsiqp)
2289#define ASC_DBG_PRT_ASC_QDONE_INFO(lvl, qdone) 2284#define ASC_DBG_PRT_ASC_QDONE_INFO(lvl, qdone)
@@ -2302,40 +2297,11 @@ do { \
2302 * 2-N: Verbose Tracing 2297 * 2-N: Verbose Tracing
2303 */ 2298 */
2304 2299
2305#define ASC_DBG(lvl, s) \ 2300#define ASC_DBG(lvl, format, arg...) { \
2306 { \ 2301 if (asc_dbglvl >= (lvl)) \
2307 if (asc_dbglvl >= (lvl)) { \ 2302 printk(KERN_DEBUG "%s: %s: " format, DRV_NAME, \
2308 printk(s); \ 2303 __FUNCTION__ , ## arg); \
2309 } \ 2304}
2310 }
2311
2312#define ASC_DBG1(lvl, s, a1) \
2313 { \
2314 if (asc_dbglvl >= (lvl)) { \
2315 printk((s), (a1)); \
2316 } \
2317 }
2318
2319#define ASC_DBG2(lvl, s, a1, a2) \
2320 { \
2321 if (asc_dbglvl >= (lvl)) { \
2322 printk((s), (a1), (a2)); \
2323 } \
2324 }
2325
2326#define ASC_DBG3(lvl, s, a1, a2, a3) \
2327 { \
2328 if (asc_dbglvl >= (lvl)) { \
2329 printk((s), (a1), (a2), (a3)); \
2330 } \
2331 }
2332
2333#define ASC_DBG4(lvl, s, a1, a2, a3, a4) \
2334 { \
2335 if (asc_dbglvl >= (lvl)) { \
2336 printk((s), (a1), (a2), (a3), (a4)); \
2337 } \
2338 }
2339 2305
2340#define ASC_DBG_PRT_SCSI_HOST(lvl, s) \ 2306#define ASC_DBG_PRT_SCSI_HOST(lvl, s) \
2341 { \ 2307 { \
@@ -2344,13 +2310,6 @@ do { \
2344 } \ 2310 } \
2345 } 2311 }
2346 2312
2347#define ASC_DBG_PRT_SCSI_CMND(lvl, s) \
2348 { \
2349 if (asc_dbglvl >= (lvl)) { \
2350 asc_prt_scsi_cmnd(s); \
2351 } \
2352 }
2353
2354#define ASC_DBG_PRT_ASC_SCSI_Q(lvl, scsiqp) \ 2313#define ASC_DBG_PRT_ASC_SCSI_Q(lvl, scsiqp) \
2355 { \ 2314 { \
2356 if (asc_dbglvl >= (lvl)) { \ 2315 if (asc_dbglvl >= (lvl)) { \
@@ -2519,64 +2478,6 @@ static uchar overrun_buf[ASC_OVERRUN_BSIZE] = { 0 };
2519static int asc_dbglvl = 3; 2478static int asc_dbglvl = 3;
2520 2479
2521/* 2480/*
2522 * asc_prt_scsi_host()
2523 */
2524static void asc_prt_scsi_host(struct Scsi_Host *s)
2525{
2526 struct asc_board *boardp = shost_priv(s);
2527
2528 printk("Scsi_Host at addr 0x%lx\n", (ulong)s);
2529 printk(" host_busy %u, host_no %d, last_reset %d,\n",
2530 s->host_busy, s->host_no, (unsigned)s->last_reset);
2531
2532 printk(" base 0x%lx, io_port 0x%lx, irq 0x%x,\n",
2533 (ulong)s->base, (ulong)s->io_port, boardp->irq);
2534
2535 printk(" dma_channel %d, this_id %d, can_queue %d,\n",
2536 s->dma_channel, s->this_id, s->can_queue);
2537
2538 printk(" cmd_per_lun %d, sg_tablesize %d, unchecked_isa_dma %d\n",
2539 s->cmd_per_lun, s->sg_tablesize, s->unchecked_isa_dma);
2540
2541 if (ASC_NARROW_BOARD(boardp)) {
2542 asc_prt_asc_dvc_var(boardp->dvc_var.asc_dvc_var);
2543 asc_prt_asc_dvc_cfg(boardp->dvc_cfg.asc_dvc_cfg);
2544 } else {
2545 asc_prt_adv_dvc_var(boardp->dvc_var.adv_dvc_var);
2546 asc_prt_adv_dvc_cfg(boardp->dvc_cfg.adv_dvc_cfg);
2547 }
2548}
2549
2550/*
2551 * asc_prt_scsi_cmnd()
2552 */
2553static void asc_prt_scsi_cmnd(struct scsi_cmnd *s)
2554{
2555 printk("struct scsi_cmnd at addr 0x%lx\n", (ulong)s);
2556
2557 printk(" host 0x%lx, device 0x%lx, target %u, lun %u, channel %u,\n",
2558 (ulong)s->device->host, (ulong)s->device, s->device->id,
2559 s->device->lun, s->device->channel);
2560
2561 asc_prt_hex(" CDB", s->cmnd, s->cmd_len);
2562
2563 printk("sc_data_direction %u, resid %d\n",
2564 s->sc_data_direction, s->resid);
2565
2566 printk(" use_sg %u, sglist_len %u\n", s->use_sg, s->sglist_len);
2567
2568 printk(" serial_number 0x%x, retries %d, allowed %d\n",
2569 (unsigned)s->serial_number, s->retries, s->allowed);
2570
2571 printk(" timeout_per_command %d\n", s->timeout_per_command);
2572
2573 printk(" scsi_done 0x%p, done 0x%p, host_scribble 0x%p, result 0x%x\n",
2574 s->scsi_done, s->done, s->host_scribble, s->result);
2575
2576 printk(" tag %u, pid %u\n", (unsigned)s->tag, (unsigned)s->pid);
2577}
2578
2579/*
2580 * asc_prt_asc_dvc_var() 2481 * asc_prt_asc_dvc_var()
2581 */ 2482 */
2582static void asc_prt_asc_dvc_var(ASC_DVC_VAR *h) 2483static void asc_prt_asc_dvc_var(ASC_DVC_VAR *h)
@@ -2627,65 +2528,11 @@ static void asc_prt_asc_dvc_cfg(ASC_DVC_CFG *h)
2627 "chip_version %d,\n", h->chip_scsi_id, h->isa_dma_speed, 2528 "chip_version %d,\n", h->chip_scsi_id, h->isa_dma_speed,
2628 h->isa_dma_channel, h->chip_version); 2529 h->isa_dma_channel, h->chip_version);
2629 2530
2630 printk(" pci_device_id %d, mcode_date 0x%x, mcode_version %d, " 2531 printk(" mcode_date 0x%x, mcode_version %d, overrun_buf 0x%p\n",
2631 "overrun_buf 0x%p\n", to_pci_dev(h->dev)->device,
2632 h->mcode_date, h->mcode_version, h->overrun_buf); 2532 h->mcode_date, h->mcode_version, h->overrun_buf);
2633} 2533}
2634 2534
2635/* 2535/*
2636 * asc_prt_asc_scsi_q()
2637 */
2638static void asc_prt_asc_scsi_q(ASC_SCSI_Q *q)
2639{
2640 ASC_SG_HEAD *sgp;
2641 int i;
2642
2643 printk("ASC_SCSI_Q at addr 0x%lx\n", (ulong)q);
2644
2645 printk
2646 (" target_ix 0x%x, target_lun %u, srb_ptr 0x%lx, tag_code 0x%x,\n",
2647 q->q2.target_ix, q->q1.target_lun, (ulong)q->q2.srb_ptr,
2648 q->q2.tag_code);
2649
2650 printk
2651 (" data_addr 0x%lx, data_cnt %lu, sense_addr 0x%lx, sense_len %u,\n",
2652 (ulong)le32_to_cpu(q->q1.data_addr),
2653 (ulong)le32_to_cpu(q->q1.data_cnt),
2654 (ulong)le32_to_cpu(q->q1.sense_addr), q->q1.sense_len);
2655
2656 printk(" cdbptr 0x%lx, cdb_len %u, sg_head 0x%lx, sg_queue_cnt %u\n",
2657 (ulong)q->cdbptr, q->q2.cdb_len,
2658 (ulong)q->sg_head, q->q1.sg_queue_cnt);
2659
2660 if (q->sg_head) {
2661 sgp = q->sg_head;
2662 printk("ASC_SG_HEAD at addr 0x%lx\n", (ulong)sgp);
2663 printk(" entry_cnt %u, queue_cnt %u\n", sgp->entry_cnt,
2664 sgp->queue_cnt);
2665 for (i = 0; i < sgp->entry_cnt; i++) {
2666 printk(" [%u]: addr 0x%lx, bytes %lu\n",
2667 i, (ulong)le32_to_cpu(sgp->sg_list[i].addr),
2668 (ulong)le32_to_cpu(sgp->sg_list[i].bytes));
2669 }
2670
2671 }
2672}
2673
2674/*
2675 * asc_prt_asc_qdone_info()
2676 */
2677static void asc_prt_asc_qdone_info(ASC_QDONE_INFO *q)
2678{
2679 printk("ASC_QDONE_INFO at addr 0x%lx\n", (ulong)q);
2680 printk(" srb_ptr 0x%lx, target_ix %u, cdb_len %u, tag_code %u,\n",
2681 (ulong)q->d2.srb_ptr, q->d2.target_ix, q->d2.cdb_len,
2682 q->d2.tag_code);
2683 printk
2684 (" done_stat 0x%x, host_stat 0x%x, scsi_stat 0x%x, scsi_msg 0x%x\n",
2685 q->d3.done_stat, q->d3.host_stat, q->d3.scsi_stat, q->d3.scsi_msg);
2686}
2687
2688/*
2689 * asc_prt_adv_dvc_var() 2536 * asc_prt_adv_dvc_var()
2690 * 2537 *
2691 * Display an ADV_DVC_VAR structure. 2538 * Display an ADV_DVC_VAR structure.
@@ -2697,9 +2544,8 @@ static void asc_prt_adv_dvc_var(ADV_DVC_VAR *h)
2697 printk(" iop_base 0x%lx, err_code 0x%x, ultra_able 0x%x\n", 2544 printk(" iop_base 0x%lx, err_code 0x%x, ultra_able 0x%x\n",
2698 (ulong)h->iop_base, h->err_code, (unsigned)h->ultra_able); 2545 (ulong)h->iop_base, h->err_code, (unsigned)h->ultra_able);
2699 2546
2700 printk(" isr_callback 0x%lx, sdtr_able 0x%x, wdtr_able 0x%x\n", 2547 printk(" sdtr_able 0x%x, wdtr_able 0x%x\n",
2701 (ulong)h->isr_callback, (unsigned)h->sdtr_able, 2548 (unsigned)h->sdtr_able, (unsigned)h->wdtr_able);
2702 (unsigned)h->wdtr_able);
2703 2549
2704 printk(" start_motor 0x%x, scsi_reset_wait 0x%x\n", 2550 printk(" start_motor 0x%x, scsi_reset_wait 0x%x\n",
2705 (unsigned)h->start_motor, (unsigned)h->scsi_reset_wait); 2551 (unsigned)h->start_motor, (unsigned)h->scsi_reset_wait);
@@ -2733,87 +2579,36 @@ static void asc_prt_adv_dvc_cfg(ADV_DVC_CFG *h)
2733 printk(" chip_version 0x%x, mcode_date 0x%x\n", 2579 printk(" chip_version 0x%x, mcode_date 0x%x\n",
2734 h->chip_version, h->mcode_date); 2580 h->chip_version, h->mcode_date);
2735 2581
2736 printk(" mcode_version 0x%x, pci_device_id 0x%x\n", 2582 printk(" mcode_version 0x%x, control_flag 0x%x\n",
2737 h->mcode_version, to_pci_dev(h->dev)->device); 2583 h->mcode_version, h->control_flag);
2738
2739 printk(" control_flag 0x%x\n", h->control_flag);
2740} 2584}
2741 2585
2742/* 2586/*
2743 * asc_prt_adv_scsi_req_q() 2587 * asc_prt_scsi_host()
2744 *
2745 * Display an ADV_SCSI_REQ_Q structure.
2746 */ 2588 */
2747static void asc_prt_adv_scsi_req_q(ADV_SCSI_REQ_Q *q) 2589static void asc_prt_scsi_host(struct Scsi_Host *s)
2748{ 2590{
2749 int sg_blk_cnt; 2591 struct asc_board *boardp = shost_priv(s);
2750 struct asc_sg_block *sg_ptr;
2751
2752 printk("ADV_SCSI_REQ_Q at addr 0x%lx\n", (ulong)q);
2753
2754 printk(" target_id %u, target_lun %u, srb_ptr 0x%lx, a_flag 0x%x\n",
2755 q->target_id, q->target_lun, (ulong)q->srb_ptr, q->a_flag);
2756
2757 printk(" cntl 0x%x, data_addr 0x%lx, vdata_addr 0x%lx\n",
2758 q->cntl, (ulong)le32_to_cpu(q->data_addr), (ulong)q->vdata_addr);
2759
2760 printk(" data_cnt %lu, sense_addr 0x%lx, sense_len %u,\n",
2761 (ulong)le32_to_cpu(q->data_cnt),
2762 (ulong)le32_to_cpu(q->sense_addr), q->sense_len);
2763
2764 printk
2765 (" cdb_len %u, done_status 0x%x, host_status 0x%x, scsi_status 0x%x\n",
2766 q->cdb_len, q->done_status, q->host_status, q->scsi_status);
2767 2592
2768 printk(" sg_working_ix 0x%x, target_cmd %u\n", 2593 printk("Scsi_Host at addr 0x%p, device %s\n", s, boardp->dev->bus_id);
2769 q->sg_working_ix, q->target_cmd); 2594 printk(" host_busy %u, host_no %d, last_reset %d,\n",
2595 s->host_busy, s->host_no, (unsigned)s->last_reset);
2770 2596
2771 printk(" scsiq_rptr 0x%lx, sg_real_addr 0x%lx, sg_list_ptr 0x%lx\n", 2597 printk(" base 0x%lx, io_port 0x%lx, irq %d,\n",
2772 (ulong)le32_to_cpu(q->scsiq_rptr), 2598 (ulong)s->base, (ulong)s->io_port, boardp->irq);
2773 (ulong)le32_to_cpu(q->sg_real_addr), (ulong)q->sg_list_ptr);
2774 2599
2775 /* Display the request's ADV_SG_BLOCK structures. */ 2600 printk(" dma_channel %d, this_id %d, can_queue %d,\n",
2776 if (q->sg_list_ptr != NULL) { 2601 s->dma_channel, s->this_id, s->can_queue);
2777 sg_blk_cnt = 0;
2778 while (1) {
2779 /*
2780 * 'sg_ptr' is a physical address. Convert it to a virtual
2781 * address by indexing 'sg_blk_cnt' into the virtual address
2782 * array 'sg_list_ptr'.
2783 *
2784 * XXX - Assumes all SG physical blocks are virtually contiguous.
2785 */
2786 sg_ptr =
2787 &(((ADV_SG_BLOCK *)(q->sg_list_ptr))[sg_blk_cnt]);
2788 asc_prt_adv_sgblock(sg_blk_cnt, sg_ptr);
2789 if (sg_ptr->sg_ptr == 0) {
2790 break;
2791 }
2792 sg_blk_cnt++;
2793 }
2794 }
2795}
2796 2602
2797/* 2603 printk(" cmd_per_lun %d, sg_tablesize %d, unchecked_isa_dma %d\n",
2798 * asc_prt_adv_sgblock() 2604 s->cmd_per_lun, s->sg_tablesize, s->unchecked_isa_dma);
2799 *
2800 * Display an ADV_SG_BLOCK structure.
2801 */
2802static void asc_prt_adv_sgblock(int sgblockno, ADV_SG_BLOCK *b)
2803{
2804 int i;
2805 2605
2806 printk(" ASC_SG_BLOCK at addr 0x%lx (sgblockno %d)\n", 2606 if (ASC_NARROW_BOARD(boardp)) {
2807 (ulong)b, sgblockno); 2607 asc_prt_asc_dvc_var(&boardp->dvc_var.asc_dvc_var);
2808 printk(" sg_cnt %u, sg_ptr 0x%lx\n", 2608 asc_prt_asc_dvc_cfg(&boardp->dvc_cfg.asc_dvc_cfg);
2809 b->sg_cnt, (ulong)le32_to_cpu(b->sg_ptr)); 2609 } else {
2810 BUG_ON(b->sg_cnt > NO_OF_SG_PER_BLOCK); 2610 asc_prt_adv_dvc_var(&boardp->dvc_var.adv_dvc_var);
2811 if (b->sg_ptr != 0) 2611 asc_prt_adv_dvc_cfg(&boardp->dvc_cfg.adv_dvc_cfg);
2812 BUG_ON(b->sg_cnt != NO_OF_SG_PER_BLOCK);
2813 for (i = 0; i < b->sg_cnt; i++) {
2814 printk(" [%u]: sg_addr 0x%lx, sg_count 0x%lx\n",
2815 i, (ulong)b->sg_list[i].sg_addr,
2816 (ulong)b->sg_list[i].sg_count);
2817 } 2612 }
2818} 2613}
2819 2614
@@ -2873,6 +2668,137 @@ static void asc_prt_hex(char *f, uchar *s, int l)
2873 printk("\n"); 2668 printk("\n");
2874 } 2669 }
2875} 2670}
2671
2672/*
2673 * asc_prt_asc_scsi_q()
2674 */
2675static void asc_prt_asc_scsi_q(ASC_SCSI_Q *q)
2676{
2677 ASC_SG_HEAD *sgp;
2678 int i;
2679
2680 printk("ASC_SCSI_Q at addr 0x%lx\n", (ulong)q);
2681
2682 printk
2683 (" target_ix 0x%x, target_lun %u, srb_ptr 0x%lx, tag_code 0x%x,\n",
2684 q->q2.target_ix, q->q1.target_lun, (ulong)q->q2.srb_ptr,
2685 q->q2.tag_code);
2686
2687 printk
2688 (" data_addr 0x%lx, data_cnt %lu, sense_addr 0x%lx, sense_len %u,\n",
2689 (ulong)le32_to_cpu(q->q1.data_addr),
2690 (ulong)le32_to_cpu(q->q1.data_cnt),
2691 (ulong)le32_to_cpu(q->q1.sense_addr), q->q1.sense_len);
2692
2693 printk(" cdbptr 0x%lx, cdb_len %u, sg_head 0x%lx, sg_queue_cnt %u\n",
2694 (ulong)q->cdbptr, q->q2.cdb_len,
2695 (ulong)q->sg_head, q->q1.sg_queue_cnt);
2696
2697 if (q->sg_head) {
2698 sgp = q->sg_head;
2699 printk("ASC_SG_HEAD at addr 0x%lx\n", (ulong)sgp);
2700 printk(" entry_cnt %u, queue_cnt %u\n", sgp->entry_cnt,
2701 sgp->queue_cnt);
2702 for (i = 0; i < sgp->entry_cnt; i++) {
2703 printk(" [%u]: addr 0x%lx, bytes %lu\n",
2704 i, (ulong)le32_to_cpu(sgp->sg_list[i].addr),
2705 (ulong)le32_to_cpu(sgp->sg_list[i].bytes));
2706 }
2707
2708 }
2709}
2710
2711/*
2712 * asc_prt_asc_qdone_info()
2713 */
2714static void asc_prt_asc_qdone_info(ASC_QDONE_INFO *q)
2715{
2716 printk("ASC_QDONE_INFO at addr 0x%lx\n", (ulong)q);
2717 printk(" srb_ptr 0x%lx, target_ix %u, cdb_len %u, tag_code %u,\n",
2718 (ulong)q->d2.srb_ptr, q->d2.target_ix, q->d2.cdb_len,
2719 q->d2.tag_code);
2720 printk
2721 (" done_stat 0x%x, host_stat 0x%x, scsi_stat 0x%x, scsi_msg 0x%x\n",
2722 q->d3.done_stat, q->d3.host_stat, q->d3.scsi_stat, q->d3.scsi_msg);
2723}
2724
2725/*
2726 * asc_prt_adv_sgblock()
2727 *
2728 * Display an ADV_SG_BLOCK structure.
2729 */
2730static void asc_prt_adv_sgblock(int sgblockno, ADV_SG_BLOCK *b)
2731{
2732 int i;
2733
2734 printk(" ASC_SG_BLOCK at addr 0x%lx (sgblockno %d)\n",
2735 (ulong)b, sgblockno);
2736 printk(" sg_cnt %u, sg_ptr 0x%lx\n",
2737 b->sg_cnt, (ulong)le32_to_cpu(b->sg_ptr));
2738 BUG_ON(b->sg_cnt > NO_OF_SG_PER_BLOCK);
2739 if (b->sg_ptr != 0)
2740 BUG_ON(b->sg_cnt != NO_OF_SG_PER_BLOCK);
2741 for (i = 0; i < b->sg_cnt; i++) {
2742 printk(" [%u]: sg_addr 0x%lx, sg_count 0x%lx\n",
2743 i, (ulong)b->sg_list[i].sg_addr,
2744 (ulong)b->sg_list[i].sg_count);
2745 }
2746}
2747
2748/*
2749 * asc_prt_adv_scsi_req_q()
2750 *
2751 * Display an ADV_SCSI_REQ_Q structure.
2752 */
2753static void asc_prt_adv_scsi_req_q(ADV_SCSI_REQ_Q *q)
2754{
2755 int sg_blk_cnt;
2756 struct asc_sg_block *sg_ptr;
2757
2758 printk("ADV_SCSI_REQ_Q at addr 0x%lx\n", (ulong)q);
2759
2760 printk(" target_id %u, target_lun %u, srb_ptr 0x%lx, a_flag 0x%x\n",
2761 q->target_id, q->target_lun, (ulong)q->srb_ptr, q->a_flag);
2762
2763 printk(" cntl 0x%x, data_addr 0x%lx, vdata_addr 0x%lx\n",
2764 q->cntl, (ulong)le32_to_cpu(q->data_addr), (ulong)q->vdata_addr);
2765
2766 printk(" data_cnt %lu, sense_addr 0x%lx, sense_len %u,\n",
2767 (ulong)le32_to_cpu(q->data_cnt),
2768 (ulong)le32_to_cpu(q->sense_addr), q->sense_len);
2769
2770 printk
2771 (" cdb_len %u, done_status 0x%x, host_status 0x%x, scsi_status 0x%x\n",
2772 q->cdb_len, q->done_status, q->host_status, q->scsi_status);
2773
2774 printk(" sg_working_ix 0x%x, target_cmd %u\n",
2775 q->sg_working_ix, q->target_cmd);
2776
2777 printk(" scsiq_rptr 0x%lx, sg_real_addr 0x%lx, sg_list_ptr 0x%lx\n",
2778 (ulong)le32_to_cpu(q->scsiq_rptr),
2779 (ulong)le32_to_cpu(q->sg_real_addr), (ulong)q->sg_list_ptr);
2780
2781 /* Display the request's ADV_SG_BLOCK structures. */
2782 if (q->sg_list_ptr != NULL) {
2783 sg_blk_cnt = 0;
2784 while (1) {
2785 /*
2786 * 'sg_ptr' is a physical address. Convert it to a virtual
2787 * address by indexing 'sg_blk_cnt' into the virtual address
2788 * array 'sg_list_ptr'.
2789 *
2790 * XXX - Assumes all SG physical blocks are virtually contiguous.
2791 */
2792 sg_ptr =
2793 &(((ADV_SG_BLOCK *)(q->sg_list_ptr))[sg_blk_cnt]);
2794 asc_prt_adv_sgblock(sg_blk_cnt, sg_ptr);
2795 if (sg_ptr->sg_ptr == 0) {
2796 break;
2797 }
2798 sg_blk_cnt++;
2799 }
2800 }
2801}
2876#endif /* ADVANSYS_DEBUG */ 2802#endif /* ADVANSYS_DEBUG */
2877 2803
2878/* 2804/*
@@ -2895,7 +2821,7 @@ static const char *advansys_info(struct Scsi_Host *shost)
2895 2821
2896 if (ASC_NARROW_BOARD(boardp)) { 2822 if (ASC_NARROW_BOARD(boardp)) {
2897 asc_dvc_varp = &boardp->dvc_var.asc_dvc_var; 2823 asc_dvc_varp = &boardp->dvc_var.asc_dvc_var;
2898 ASC_DBG(1, "advansys_info: begin\n"); 2824 ASC_DBG(1, "begin\n");
2899 if (asc_dvc_varp->bus_type & ASC_IS_ISA) { 2825 if (asc_dvc_varp->bus_type & ASC_IS_ISA) {
2900 if ((asc_dvc_varp->bus_type & ASC_IS_ISAPNP) == 2826 if ((asc_dvc_varp->bus_type & ASC_IS_ISAPNP) ==
2901 ASC_IS_ISAPNP) { 2827 ASC_IS_ISAPNP) {
@@ -2955,7 +2881,7 @@ static const char *advansys_info(struct Scsi_Host *shost)
2955 (ulong)adv_dvc_varp->iop_base + boardp->asc_n_io_port - 1, boardp->irq); 2881 (ulong)adv_dvc_varp->iop_base + boardp->asc_n_io_port - 1, boardp->irq);
2956 } 2882 }
2957 BUG_ON(strlen(info) >= ASC_INFO_SIZE); 2883 BUG_ON(strlen(info) >= ASC_INFO_SIZE);
2958 ASC_DBG(1, "advansys_info: end\n"); 2884 ASC_DBG(1, "end\n");
2959 return info; 2885 return info;
2960} 2886}
2961 2887
@@ -4118,12 +4044,12 @@ asc_proc_copy(off_t advoffset, off_t offset, char *curbuf, int leftlen,
4118{ 4044{
4119 int cnt = 0; 4045 int cnt = 0;
4120 4046
4121 ASC_DBG3(2, "asc_proc_copy: offset %d, advoffset %d, cplen %d\n", 4047 ASC_DBG(2, "offset %d, advoffset %d, cplen %d\n",
4122 (unsigned)offset, (unsigned)advoffset, cplen); 4048 (unsigned)offset, (unsigned)advoffset, cplen);
4123 if (offset <= advoffset) { 4049 if (offset <= advoffset) {
4124 /* Read offset below current offset, copy everything. */ 4050 /* Read offset below current offset, copy everything. */
4125 cnt = min(cplen, leftlen); 4051 cnt = min(cplen, leftlen);
4126 ASC_DBG3(2, "asc_proc_copy: curbuf 0x%lx, cp 0x%lx, cnt %d\n", 4052 ASC_DBG(2, "curbuf 0x%lx, cp 0x%lx, cnt %d\n",
4127 (ulong)curbuf, (ulong)cp, cnt); 4053 (ulong)curbuf, (ulong)cp, cnt);
4128 memcpy(curbuf, cp, cnt); 4054 memcpy(curbuf, cp, cnt);
4129 } else if (offset < advoffset + cplen) { 4055 } else if (offset < advoffset + cplen) {
@@ -4131,7 +4057,7 @@ asc_proc_copy(off_t advoffset, off_t offset, char *curbuf, int leftlen,
4131 cnt = (advoffset + cplen) - offset; 4057 cnt = (advoffset + cplen) - offset;
4132 cp = (cp + cplen) - cnt; 4058 cp = (cp + cplen) - cnt;
4133 cnt = min(cnt, leftlen); 4059 cnt = min(cnt, leftlen);
4134 ASC_DBG3(2, "asc_proc_copy: curbuf 0x%lx, cp 0x%lx, cnt %d\n", 4060 ASC_DBG(2, "curbuf 0x%lx, cp 0x%lx, cnt %d\n",
4135 (ulong)curbuf, (ulong)cp, cnt); 4061 (ulong)curbuf, (ulong)cp, cnt);
4136 memcpy(curbuf, cp, cnt); 4062 memcpy(curbuf, cp, cnt);
4137 } 4063 }
@@ -4270,7 +4196,7 @@ advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start,
4270 char *curbuf; 4196 char *curbuf;
4271 off_t advoffset; 4197 off_t advoffset;
4272 4198
4273 ASC_DBG(1, "advansys_proc_info: begin\n"); 4199 ASC_DBG(1, "begin\n");
4274 4200
4275 /* 4201 /*
4276 * User write not supported. 4202 * User write not supported.
@@ -4302,7 +4228,7 @@ advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start,
4302 totcnt += cnt; 4228 totcnt += cnt;
4303 leftlen -= cnt; 4229 leftlen -= cnt;
4304 if (leftlen == 0) { 4230 if (leftlen == 0) {
4305 ASC_DBG1(1, "advansys_proc_info: totcnt %d\n", totcnt); 4231 ASC_DBG(1, "totcnt %d\n", totcnt);
4306 return totcnt; 4232 return totcnt;
4307 } 4233 }
4308 advoffset += cplen; 4234 advoffset += cplen;
@@ -4320,7 +4246,7 @@ advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start,
4320 totcnt += cnt; 4246 totcnt += cnt;
4321 leftlen -= cnt; 4247 leftlen -= cnt;
4322 if (leftlen == 0) { 4248 if (leftlen == 0) {
4323 ASC_DBG1(1, "advansys_proc_info: totcnt %d\n", totcnt); 4249 ASC_DBG(1, "totcnt %d\n", totcnt);
4324 return totcnt; 4250 return totcnt;
4325 } 4251 }
4326 advoffset += cplen; 4252 advoffset += cplen;
@@ -4337,7 +4263,7 @@ advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start,
4337 totcnt += cnt; 4263 totcnt += cnt;
4338 leftlen -= cnt; 4264 leftlen -= cnt;
4339 if (leftlen == 0) { 4265 if (leftlen == 0) {
4340 ASC_DBG1(1, "advansys_proc_info: totcnt %d\n", totcnt); 4266 ASC_DBG(1, "totcnt %d\n", totcnt);
4341 return totcnt; 4267 return totcnt;
4342 } 4268 }
4343 advoffset += cplen; 4269 advoffset += cplen;
@@ -4357,7 +4283,7 @@ advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start,
4357 totcnt += cnt; 4283 totcnt += cnt;
4358 leftlen -= cnt; 4284 leftlen -= cnt;
4359 if (leftlen == 0) { 4285 if (leftlen == 0) {
4360 ASC_DBG1(1, "advansys_proc_info: totcnt %d\n", totcnt); 4286 ASC_DBG(1, "totcnt %d\n", totcnt);
4361 return totcnt; 4287 return totcnt;
4362 } 4288 }
4363 advoffset += cplen; 4289 advoffset += cplen;
@@ -4373,7 +4299,7 @@ advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start,
4373 totcnt += cnt; 4299 totcnt += cnt;
4374 leftlen -= cnt; 4300 leftlen -= cnt;
4375 if (leftlen == 0) { 4301 if (leftlen == 0) {
4376 ASC_DBG1(1, "advansys_proc_info: totcnt %d\n", totcnt); 4302 ASC_DBG(1, "totcnt %d\n", totcnt);
4377 return totcnt; 4303 return totcnt;
4378 } 4304 }
4379 advoffset += cplen; 4305 advoffset += cplen;
@@ -4390,7 +4316,7 @@ advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start,
4390 totcnt += cnt; 4316 totcnt += cnt;
4391 leftlen -= cnt; 4317 leftlen -= cnt;
4392 if (leftlen == 0) { 4318 if (leftlen == 0) {
4393 ASC_DBG1(1, "advansys_proc_info: totcnt %d\n", totcnt); 4319 ASC_DBG(1, "totcnt %d\n", totcnt);
4394 return totcnt; 4320 return totcnt;
4395 } 4321 }
4396 advoffset += cplen; 4322 advoffset += cplen;
@@ -4412,13 +4338,13 @@ advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start,
4412 totcnt += cnt; 4338 totcnt += cnt;
4413 leftlen -= cnt; 4339 leftlen -= cnt;
4414 if (leftlen == 0) { 4340 if (leftlen == 0) {
4415 ASC_DBG1(1, "advansys_proc_info: totcnt %d\n", totcnt); 4341 ASC_DBG(1, "totcnt %d\n", totcnt);
4416 return totcnt; 4342 return totcnt;
4417 } 4343 }
4418 advoffset += cplen; 4344 advoffset += cplen;
4419 curbuf += cnt; 4345 curbuf += cnt;
4420 4346
4421 ASC_DBG1(1, "advansys_proc_info: totcnt %d\n", totcnt); 4347 ASC_DBG(1, "totcnt %d\n", totcnt);
4422 4348
4423 return totcnt; 4349 return totcnt;
4424} 4350}
@@ -4530,11 +4456,10 @@ static int AscFindSignature(PortAddr iop_base)
4530{ 4456{
4531 ushort sig_word; 4457 ushort sig_word;
4532 4458
4533 ASC_DBG2(1, "AscFindSignature: AscGetChipSignatureByte(0x%x) 0x%x\n", 4459 ASC_DBG(1, "AscGetChipSignatureByte(0x%x) 0x%x\n",
4534 iop_base, AscGetChipSignatureByte(iop_base)); 4460 iop_base, AscGetChipSignatureByte(iop_base));
4535 if (AscGetChipSignatureByte(iop_base) == (uchar)ASC_1000_ID1B) { 4461 if (AscGetChipSignatureByte(iop_base) == (uchar)ASC_1000_ID1B) {
4536 ASC_DBG2(1, 4462 ASC_DBG(1, "AscGetChipSignatureWord(0x%x) 0x%x\n",
4537 "AscFindSignature: AscGetChipSignatureWord(0x%x) 0x%x\n",
4538 iop_base, AscGetChipSignatureWord(iop_base)); 4463 iop_base, AscGetChipSignatureWord(iop_base));
4539 sig_word = AscGetChipSignatureWord(iop_base); 4464 sig_word = AscGetChipSignatureWord(iop_base);
4540 if ((sig_word == (ushort)ASC_1000_ID0W) || 4465 if ((sig_word == (ushort)ASC_1000_ID0W) ||
@@ -4785,18 +4710,17 @@ AscLoadMicroCode(PortAddr iop_base,
4785 AscMemWordCopyPtrToLram(iop_base, s_addr, mcode_buf, mcode_word_size); 4710 AscMemWordCopyPtrToLram(iop_base, s_addr, mcode_buf, mcode_word_size);
4786 4711
4787 chksum = AscMemSumLramWord(iop_base, s_addr, mcode_word_size); 4712 chksum = AscMemSumLramWord(iop_base, s_addr, mcode_word_size);
4788 ASC_DBG1(1, "AscLoadMicroCode: chksum 0x%lx\n", (ulong)chksum); 4713 ASC_DBG(1, "chksum 0x%lx\n", (ulong)chksum);
4789 mcode_chksum = (ushort)AscMemSumLramWord(iop_base, 4714 mcode_chksum = (ushort)AscMemSumLramWord(iop_base,
4790 (ushort)ASC_CODE_SEC_BEG, 4715 (ushort)ASC_CODE_SEC_BEG,
4791 (ushort)((mcode_size - 4716 (ushort)((mcode_size -
4792 s_addr - (ushort) 4717 s_addr - (ushort)
4793 ASC_CODE_SEC_BEG) / 4718 ASC_CODE_SEC_BEG) /
4794 2)); 4719 2));
4795 ASC_DBG1(1, "AscLoadMicroCode: mcode_chksum 0x%lx\n", 4720 ASC_DBG(1, "mcode_chksum 0x%lx\n", (ulong)mcode_chksum);
4796 (ulong)mcode_chksum);
4797 AscWriteLramWord(iop_base, ASCV_MCODE_CHKSUM_W, mcode_chksum); 4721 AscWriteLramWord(iop_base, ASCV_MCODE_CHKSUM_W, mcode_chksum);
4798 AscWriteLramWord(iop_base, ASCV_MCODE_SIZE_W, mcode_size); 4722 AscWriteLramWord(iop_base, ASCV_MCODE_SIZE_W, mcode_size);
4799 return (chksum); 4723 return chksum;
4800} 4724}
4801 4725
4802/* Microcode buffer is kept after initialization for error recovery. */ 4726/* Microcode buffer is kept after initialization for error recovery. */
@@ -6511,8 +6435,7 @@ static ushort AscInitAsc1000Driver(ASC_DVC_VAR *asc_dvc)
6511 warn_code |= AscInitLram(asc_dvc); 6435 warn_code |= AscInitLram(asc_dvc);
6512 if (asc_dvc->err_code != 0) 6436 if (asc_dvc->err_code != 0)
6513 return UW_ERR; 6437 return UW_ERR;
6514 ASC_DBG1(1, "AscInitAsc1000Driver: _asc_mcode_chksum 0x%lx\n", 6438 ASC_DBG(1, "_asc_mcode_chksum 0x%lx\n", (ulong)_asc_mcode_chksum);
6515 (ulong)_asc_mcode_chksum);
6516 if (AscLoadMicroCode(iop_base, 0, _asc_mcode_buf, 6439 if (AscLoadMicroCode(iop_base, 0, _asc_mcode_buf,
6517 _asc_mcode_size) != _asc_mcode_chksum) { 6440 _asc_mcode_size) != _asc_mcode_chksum) {
6518 asc_dvc->err_code |= ASC_IERR_MCODE_CHKSUM; 6441 asc_dvc->err_code |= ASC_IERR_MCODE_CHKSUM;
@@ -6613,7 +6536,7 @@ DvcGetPhyAddr(ADV_DVC_VAR *asc_dvc, ADV_SCSI_REQ_Q *scsiq,
6613{ 6536{
6614 ADV_PADDR paddr = virt_to_bus(vaddr); 6537 ADV_PADDR paddr = virt_to_bus(vaddr);
6615 6538
6616 ASC_DBG4(4, "DvcGetPhyAddr: vaddr 0x%p, lenp 0x%p *lenp %lu, paddr 0x%lx\n", 6539 ASC_DBG(4, "vaddr 0x%p, lenp 0x%p *lenp %lu, paddr 0x%lx\n",
6617 vaddr, lenp, (ulong)*((ulong *)lenp), (ulong)paddr); 6540 vaddr, lenp, (ulong)*((ulong *)lenp), (ulong)paddr);
6618 6541
6619 return paddr; 6542 return paddr;
@@ -8291,8 +8214,7 @@ static void adv_async_callback(ADV_DVC_VAR *adv_dvc_varp, uchar code)
8291 /* 8214 /*
8292 * The firmware detected a SCSI Bus reset. 8215 * The firmware detected a SCSI Bus reset.
8293 */ 8216 */
8294 ASC_DBG(0, 8217 ASC_DBG(0, "ADV_ASYNC_SCSI_BUS_RESET_DET\n");
8295 "adv_async_callback: ADV_ASYNC_SCSI_BUS_RESET_DET\n");
8296 break; 8218 break;
8297 8219
8298 case ADV_ASYNC_RDMA_FAILURE: 8220 case ADV_ASYNC_RDMA_FAILURE:
@@ -8301,7 +8223,7 @@ static void adv_async_callback(ADV_DVC_VAR *adv_dvc_varp, uchar code)
8301 * possibly the chip if it is unresponsive. Log the error 8223 * possibly the chip if it is unresponsive. Log the error
8302 * with a unique code. 8224 * with a unique code.
8303 */ 8225 */
8304 ASC_DBG(0, "adv_async_callback: ADV_ASYNC_RDMA_FAILURE\n"); 8226 ASC_DBG(0, "ADV_ASYNC_RDMA_FAILURE\n");
8305 AdvResetChipAndSB(adv_dvc_varp); 8227 AdvResetChipAndSB(adv_dvc_varp);
8306 break; 8228 break;
8307 8229
@@ -8309,11 +8231,11 @@ static void adv_async_callback(ADV_DVC_VAR *adv_dvc_varp, uchar code)
8309 /* 8231 /*
8310 * Host generated SCSI bus reset occurred. 8232 * Host generated SCSI bus reset occurred.
8311 */ 8233 */
8312 ASC_DBG(0, "adv_async_callback: ADV_HOST_SCSI_BUS_RESET\n"); 8234 ASC_DBG(0, "ADV_HOST_SCSI_BUS_RESET\n");
8313 break; 8235 break;
8314 8236
8315 default: 8237 default:
8316 ASC_DBG1(0, "DvcAsyncCallBack: unknown code 0x%x\n", code); 8238 ASC_DBG(0, "unknown code 0x%x\n", code);
8317 break; 8239 break;
8318 } 8240 }
8319} 8241}
@@ -8332,7 +8254,7 @@ static void adv_isr_callback(ADV_DVC_VAR *adv_dvc_varp, ADV_SCSI_REQ_Q *scsiqp)
8332 struct Scsi_Host *shost; 8254 struct Scsi_Host *shost;
8333 ADV_DCNT resid_cnt; 8255 ADV_DCNT resid_cnt;
8334 8256
8335 ASC_DBG2(1, "adv_isr_callback: adv_dvc_varp 0x%lx, scsiqp 0x%lx\n", 8257 ASC_DBG(1, "adv_dvc_varp 0x%lx, scsiqp 0x%lx\n",
8336 (ulong)adv_dvc_varp, (ulong)scsiqp); 8258 (ulong)adv_dvc_varp, (ulong)scsiqp);
8337 ASC_DBG_PRT_ADV_SCSI_REQ_Q(2, scsiqp); 8259 ASC_DBG_PRT_ADV_SCSI_REQ_Q(2, scsiqp);
8338 8260
@@ -8342,7 +8264,7 @@ static void adv_isr_callback(ADV_DVC_VAR *adv_dvc_varp, ADV_SCSI_REQ_Q *scsiqp)
8342 * completed ADV_SCSI_REQ_Q structure. 8264 * completed ADV_SCSI_REQ_Q structure.
8343 */ 8265 */
8344 reqp = (adv_req_t *)ADV_U32_TO_VADDR(scsiqp->srb_ptr); 8266 reqp = (adv_req_t *)ADV_U32_TO_VADDR(scsiqp->srb_ptr);
8345 ASC_DBG1(1, "adv_isr_callback: reqp 0x%lx\n", (ulong)reqp); 8267 ASC_DBG(1, "reqp 0x%lx\n", (ulong)reqp);
8346 if (reqp == NULL) { 8268 if (reqp == NULL) {
8347 ASC_PRINT("adv_isr_callback: reqp is NULL\n"); 8269 ASC_PRINT("adv_isr_callback: reqp is NULL\n");
8348 return; 8270 return;
@@ -8357,7 +8279,7 @@ static void adv_isr_callback(ADV_DVC_VAR *adv_dvc_varp, ADV_SCSI_REQ_Q *scsiqp)
8357 * determined. 8279 * determined.
8358 */ 8280 */
8359 scp = reqp->cmndp; 8281 scp = reqp->cmndp;
8360 ASC_DBG1(1, "adv_isr_callback: scp 0x%lx\n", (ulong)scp); 8282 ASC_DBG(1, "scp 0x%p\n", scp);
8361 if (scp == NULL) { 8283 if (scp == NULL) {
8362 ASC_PRINT 8284 ASC_PRINT
8363 ("adv_isr_callback: scp is NULL; adv_req_t dropped.\n"); 8285 ("adv_isr_callback: scp is NULL; adv_req_t dropped.\n");
@@ -8367,7 +8289,7 @@ static void adv_isr_callback(ADV_DVC_VAR *adv_dvc_varp, ADV_SCSI_REQ_Q *scsiqp)
8367 8289
8368 shost = scp->device->host; 8290 shost = scp->device->host;
8369 ASC_STATS(shost, callback); 8291 ASC_STATS(shost, callback);
8370 ASC_DBG1(1, "adv_isr_callback: shost 0x%lx\n", (ulong)shost); 8292 ASC_DBG(1, "shost 0x%p\n", shost);
8371 8293
8372 boardp = shost_priv(shost); 8294 boardp = shost_priv(shost);
8373 BUG_ON(adv_dvc_varp != &boardp->dvc_var.adv_dvc_var); 8295 BUG_ON(adv_dvc_varp != &boardp->dvc_var.adv_dvc_var);
@@ -8377,7 +8299,7 @@ static void adv_isr_callback(ADV_DVC_VAR *adv_dvc_varp, ADV_SCSI_REQ_Q *scsiqp)
8377 */ 8299 */
8378 switch (scsiqp->done_status) { 8300 switch (scsiqp->done_status) {
8379 case QD_NO_ERROR: 8301 case QD_NO_ERROR:
8380 ASC_DBG(2, "adv_isr_callback: QD_NO_ERROR\n"); 8302 ASC_DBG(2, "QD_NO_ERROR\n");
8381 scp->result = 0; 8303 scp->result = 0;
8382 8304
8383 /* 8305 /*
@@ -8389,20 +8311,18 @@ static void adv_isr_callback(ADV_DVC_VAR *adv_dvc_varp, ADV_SCSI_REQ_Q *scsiqp)
8389 resid_cnt = le32_to_cpu(scsiqp->data_cnt); 8311 resid_cnt = le32_to_cpu(scsiqp->data_cnt);
8390 if (scp->request_bufflen != 0 && resid_cnt != 0 && 8312 if (scp->request_bufflen != 0 && resid_cnt != 0 &&
8391 resid_cnt <= scp->request_bufflen) { 8313 resid_cnt <= scp->request_bufflen) {
8392 ASC_DBG1(1, 8314 ASC_DBG(1, "underrun condition %lu bytes\n",
8393 "adv_isr_callback: underrun condition %lu bytes\n",
8394 (ulong)resid_cnt); 8315 (ulong)resid_cnt);
8395 scp->resid = resid_cnt; 8316 scp->resid = resid_cnt;
8396 } 8317 }
8397 break; 8318 break;
8398 8319
8399 case QD_WITH_ERROR: 8320 case QD_WITH_ERROR:
8400 ASC_DBG(2, "adv_isr_callback: QD_WITH_ERROR\n"); 8321 ASC_DBG(2, "QD_WITH_ERROR\n");
8401 switch (scsiqp->host_status) { 8322 switch (scsiqp->host_status) {
8402 case QHSTA_NO_ERROR: 8323 case QHSTA_NO_ERROR:
8403 if (scsiqp->scsi_status == SAM_STAT_CHECK_CONDITION) { 8324 if (scsiqp->scsi_status == SAM_STAT_CHECK_CONDITION) {
8404 ASC_DBG(2, 8325 ASC_DBG(2, "SAM_STAT_CHECK_CONDITION\n");
8405 "adv_isr_callback: SAM_STAT_CHECK_CONDITION\n");
8406 ASC_DBG_PRT_SENSE(2, scp->sense_buffer, 8326 ASC_DBG_PRT_SENSE(2, scp->sense_buffer,
8407 sizeof(scp->sense_buffer)); 8327 sizeof(scp->sense_buffer));
8408 /* 8328 /*
@@ -8426,22 +8346,20 @@ static void adv_isr_callback(ADV_DVC_VAR *adv_dvc_varp, ADV_SCSI_REQ_Q *scsiqp)
8426 8346
8427 default: 8347 default:
8428 /* Some other QHSTA error occurred. */ 8348 /* Some other QHSTA error occurred. */
8429 ASC_DBG1(1, "adv_isr_callback: host_status 0x%x\n", 8349 ASC_DBG(1, "host_status 0x%x\n", scsiqp->host_status);
8430 scsiqp->host_status);
8431 scp->result = HOST_BYTE(DID_BAD_TARGET); 8350 scp->result = HOST_BYTE(DID_BAD_TARGET);
8432 break; 8351 break;
8433 } 8352 }
8434 break; 8353 break;
8435 8354
8436 case QD_ABORTED_BY_HOST: 8355 case QD_ABORTED_BY_HOST:
8437 ASC_DBG(1, "adv_isr_callback: QD_ABORTED_BY_HOST\n"); 8356 ASC_DBG(1, "QD_ABORTED_BY_HOST\n");
8438 scp->result = 8357 scp->result =
8439 HOST_BYTE(DID_ABORT) | STATUS_BYTE(scsiqp->scsi_status); 8358 HOST_BYTE(DID_ABORT) | STATUS_BYTE(scsiqp->scsi_status);
8440 break; 8359 break;
8441 8360
8442 default: 8361 default:
8443 ASC_DBG1(1, "adv_isr_callback: done_status 0x%x\n", 8362 ASC_DBG(1, "done_status 0x%x\n", scsiqp->done_status);
8444 scsiqp->done_status);
8445 scp->result = 8363 scp->result =
8446 HOST_BYTE(DID_ERROR) | STATUS_BYTE(scsiqp->scsi_status); 8364 HOST_BYTE(DID_ERROR) | STATUS_BYTE(scsiqp->scsi_status);
8447 break; 8365 break;
@@ -8479,7 +8397,7 @@ static void adv_isr_callback(ADV_DVC_VAR *adv_dvc_varp, ADV_SCSI_REQ_Q *scsiqp)
8479 reqp->next_reqp = boardp->adv_reqp; 8397 reqp->next_reqp = boardp->adv_reqp;
8480 boardp->adv_reqp = reqp; 8398 boardp->adv_reqp = reqp;
8481 8399
8482 ASC_DBG(1, "adv_isr_callback: done\n"); 8400 ASC_DBG(1, "done\n");
8483 8401
8484 return; 8402 return;
8485} 8403}
@@ -9299,8 +9217,7 @@ static void asc_isr_callback(ASC_DVC_VAR *asc_dvc_varp, ASC_QDONE_INFO *qdonep)
9299 struct scsi_cmnd *scp; 9217 struct scsi_cmnd *scp;
9300 struct Scsi_Host *shost; 9218 struct Scsi_Host *shost;
9301 9219
9302 ASC_DBG2(1, "asc_isr_callback: asc_dvc_varp 0x%lx, qdonep 0x%lx\n", 9220 ASC_DBG(1, "asc_dvc_varp 0x%p, qdonep 0x%p\n", asc_dvc_varp, qdonep);
9303 (ulong)asc_dvc_varp, (ulong)qdonep);
9304 ASC_DBG_PRT_ASC_QDONE_INFO(2, qdonep); 9221 ASC_DBG_PRT_ASC_QDONE_INFO(2, qdonep);
9305 9222
9306 /* 9223 /*
@@ -9308,7 +9225,7 @@ static void asc_isr_callback(ASC_DVC_VAR *asc_dvc_varp, ASC_QDONE_INFO *qdonep)
9308 * command that has been completed. 9225 * command that has been completed.
9309 */ 9226 */
9310 scp = (struct scsi_cmnd *)ASC_U32_TO_VADDR(qdonep->d2.srb_ptr); 9227 scp = (struct scsi_cmnd *)ASC_U32_TO_VADDR(qdonep->d2.srb_ptr);
9311 ASC_DBG1(1, "asc_isr_callback: scp 0x%lx\n", (ulong)scp); 9228 ASC_DBG(1, "scp 0x%p\n", scp);
9312 9229
9313 if (scp == NULL) { 9230 if (scp == NULL) {
9314 ASC_PRINT("asc_isr_callback: scp is NULL\n"); 9231 ASC_PRINT("asc_isr_callback: scp is NULL\n");
@@ -9318,7 +9235,7 @@ static void asc_isr_callback(ASC_DVC_VAR *asc_dvc_varp, ASC_QDONE_INFO *qdonep)
9318 9235
9319 shost = scp->device->host; 9236 shost = scp->device->host;
9320 ASC_STATS(shost, callback); 9237 ASC_STATS(shost, callback);
9321 ASC_DBG1(1, "asc_isr_callback: shost 0x%lx\n", (ulong)shost); 9238 ASC_DBG(1, "shost 0x%p\n", shost);
9322 9239
9323 boardp = shost_priv(shost); 9240 boardp = shost_priv(shost);
9324 BUG_ON(asc_dvc_varp != &boardp->dvc_var.asc_dvc_var); 9241 BUG_ON(asc_dvc_varp != &boardp->dvc_var.asc_dvc_var);
@@ -9328,7 +9245,7 @@ static void asc_isr_callback(ASC_DVC_VAR *asc_dvc_varp, ASC_QDONE_INFO *qdonep)
9328 */ 9245 */
9329 switch (qdonep->d3.done_stat) { 9246 switch (qdonep->d3.done_stat) {
9330 case QD_NO_ERROR: 9247 case QD_NO_ERROR:
9331 ASC_DBG(2, "asc_isr_callback: QD_NO_ERROR\n"); 9248 ASC_DBG(2, "QD_NO_ERROR\n");
9332 scp->result = 0; 9249 scp->result = 0;
9333 9250
9334 /* 9251 /*
@@ -9339,20 +9256,18 @@ static void asc_isr_callback(ASC_DVC_VAR *asc_dvc_varp, ASC_QDONE_INFO *qdonep)
9339 */ 9256 */
9340 if (scp->request_bufflen != 0 && qdonep->remain_bytes != 0 && 9257 if (scp->request_bufflen != 0 && qdonep->remain_bytes != 0 &&
9341 qdonep->remain_bytes <= scp->request_bufflen) { 9258 qdonep->remain_bytes <= scp->request_bufflen) {
9342 ASC_DBG1(1, 9259 ASC_DBG(1, "underrun condition %u bytes\n",
9343 "asc_isr_callback: underrun condition %u bytes\n",
9344 (unsigned)qdonep->remain_bytes); 9260 (unsigned)qdonep->remain_bytes);
9345 scp->resid = qdonep->remain_bytes; 9261 scp->resid = qdonep->remain_bytes;
9346 } 9262 }
9347 break; 9263 break;
9348 9264
9349 case QD_WITH_ERROR: 9265 case QD_WITH_ERROR:
9350 ASC_DBG(2, "asc_isr_callback: QD_WITH_ERROR\n"); 9266 ASC_DBG(2, "QD_WITH_ERROR\n");
9351 switch (qdonep->d3.host_stat) { 9267 switch (qdonep->d3.host_stat) {
9352 case QHSTA_NO_ERROR: 9268 case QHSTA_NO_ERROR:
9353 if (qdonep->d3.scsi_stat == SAM_STAT_CHECK_CONDITION) { 9269 if (qdonep->d3.scsi_stat == SAM_STAT_CHECK_CONDITION) {
9354 ASC_DBG(2, 9270 ASC_DBG(2, "SAM_STAT_CHECK_CONDITION\n");
9355 "asc_isr_callback: SAM_STAT_CHECK_CONDITION\n");
9356 ASC_DBG_PRT_SENSE(2, scp->sense_buffer, 9271 ASC_DBG_PRT_SENSE(2, scp->sense_buffer,
9357 sizeof(scp->sense_buffer)); 9272 sizeof(scp->sense_buffer));
9358 /* 9273 /*
@@ -9376,15 +9291,14 @@ static void asc_isr_callback(ASC_DVC_VAR *asc_dvc_varp, ASC_QDONE_INFO *qdonep)
9376 9291
9377 default: 9292 default:
9378 /* QHSTA error occurred */ 9293 /* QHSTA error occurred */
9379 ASC_DBG1(1, "asc_isr_callback: host_stat 0x%x\n", 9294 ASC_DBG(1, "host_stat 0x%x\n", qdonep->d3.host_stat);
9380 qdonep->d3.host_stat);
9381 scp->result = HOST_BYTE(DID_BAD_TARGET); 9295 scp->result = HOST_BYTE(DID_BAD_TARGET);
9382 break; 9296 break;
9383 } 9297 }
9384 break; 9298 break;
9385 9299
9386 case QD_ABORTED_BY_HOST: 9300 case QD_ABORTED_BY_HOST:
9387 ASC_DBG(1, "asc_isr_callback: QD_ABORTED_BY_HOST\n"); 9301 ASC_DBG(1, "QD_ABORTED_BY_HOST\n");
9388 scp->result = 9302 scp->result =
9389 HOST_BYTE(DID_ABORT) | MSG_BYTE(qdonep->d3. 9303 HOST_BYTE(DID_ABORT) | MSG_BYTE(qdonep->d3.
9390 scsi_msg) | 9304 scsi_msg) |
@@ -9392,8 +9306,7 @@ static void asc_isr_callback(ASC_DVC_VAR *asc_dvc_varp, ASC_QDONE_INFO *qdonep)
9392 break; 9306 break;
9393 9307
9394 default: 9308 default:
9395 ASC_DBG1(1, "asc_isr_callback: done_stat 0x%x\n", 9309 ASC_DBG(1, "done_stat 0x%x\n", qdonep->d3.done_stat);
9396 qdonep->d3.done_stat);
9397 scp->result = 9310 scp->result =
9398 HOST_BYTE(DID_ERROR) | MSG_BYTE(qdonep->d3. 9311 HOST_BYTE(DID_ERROR) | MSG_BYTE(qdonep->d3.
9399 scsi_msg) | 9312 scsi_msg) |
@@ -9681,7 +9594,7 @@ static int advansys_reset(struct scsi_cmnd *scp)
9681 int status; 9594 int status;
9682 int ret = SUCCESS; 9595 int ret = SUCCESS;
9683 9596
9684 ASC_DBG1(1, "advansys_reset: 0x%p\n", scp); 9597 ASC_DBG(1, "0x%p\n", scp);
9685 9598
9686 ASC_STATS(shost, reset); 9599 ASC_STATS(shost, reset);
9687 9600
@@ -9691,7 +9604,7 @@ static int advansys_reset(struct scsi_cmnd *scp)
9691 ASC_DVC_VAR *asc_dvc = &boardp->dvc_var.asc_dvc_var; 9604 ASC_DVC_VAR *asc_dvc = &boardp->dvc_var.asc_dvc_var;
9692 9605
9693 /* Reset the chip and SCSI bus. */ 9606 /* Reset the chip and SCSI bus. */
9694 ASC_DBG(1, "advansys_reset: before AscInitAsc1000Driver()\n"); 9607 ASC_DBG(1, "before AscInitAsc1000Driver()\n");
9695 status = AscInitAsc1000Driver(asc_dvc); 9608 status = AscInitAsc1000Driver(asc_dvc);
9696 9609
9697 /* Refer to ASC_IERR_* defintions for meaning of 'err_code'. */ 9610 /* Refer to ASC_IERR_* defintions for meaning of 'err_code'. */
@@ -9707,7 +9620,7 @@ static int advansys_reset(struct scsi_cmnd *scp)
9707 "successful\n"); 9620 "successful\n");
9708 } 9621 }
9709 9622
9710 ASC_DBG(1, "advansys_reset: after AscInitAsc1000Driver()\n"); 9623 ASC_DBG(1, "after AscInitAsc1000Driver()\n");
9711 spin_lock_irqsave(&boardp->lock, flags); 9624 spin_lock_irqsave(&boardp->lock, flags);
9712 } else { 9625 } else {
9713 /* 9626 /*
@@ -9719,7 +9632,7 @@ static int advansys_reset(struct scsi_cmnd *scp)
9719 /* 9632 /*
9720 * Reset the target's SCSI bus. 9633 * Reset the target's SCSI bus.
9721 */ 9634 */
9722 ASC_DBG(1, "advansys_reset: before AdvResetChipAndSB()\n"); 9635 ASC_DBG(1, "before AdvResetChipAndSB()\n");
9723 switch (AdvResetChipAndSB(adv_dvc)) { 9636 switch (AdvResetChipAndSB(adv_dvc)) {
9724 case ASC_TRUE: 9637 case ASC_TRUE:
9725 scmd_printk(KERN_INFO, scp, "SCSI bus reset " 9638 scmd_printk(KERN_INFO, scp, "SCSI bus reset "
@@ -9739,7 +9652,7 @@ static int advansys_reset(struct scsi_cmnd *scp)
9739 boardp->last_reset = jiffies; 9652 boardp->last_reset = jiffies;
9740 spin_unlock_irqrestore(&boardp->lock, flags); 9653 spin_unlock_irqrestore(&boardp->lock, flags);
9741 9654
9742 ASC_DBG1(1, "advansys_reset: ret %d\n", ret); 9655 ASC_DBG(1, "ret %d\n", ret);
9743 9656
9744 return ret; 9657 return ret;
9745} 9658}
@@ -9761,7 +9674,7 @@ advansys_biosparam(struct scsi_device *sdev, struct block_device *bdev,
9761{ 9674{
9762 struct asc_board *boardp = shost_priv(sdev->host); 9675 struct asc_board *boardp = shost_priv(sdev->host);
9763 9676
9764 ASC_DBG(1, "advansys_biosparam: begin\n"); 9677 ASC_DBG(1, "begin\n");
9765 ASC_STATS(sdev->host, biosparam); 9678 ASC_STATS(sdev->host, biosparam);
9766 if (ASC_NARROW_BOARD(boardp)) { 9679 if (ASC_NARROW_BOARD(boardp)) {
9767 if ((boardp->dvc_var.asc_dvc_var.dvc_cntl & 9680 if ((boardp->dvc_var.asc_dvc_var.dvc_cntl &
@@ -9783,7 +9696,7 @@ advansys_biosparam(struct scsi_device *sdev, struct block_device *bdev,
9783 } 9696 }
9784 } 9697 }
9785 ip[2] = (unsigned long)capacity / (ip[0] * ip[1]); 9698 ip[2] = (unsigned long)capacity / (ip[0] * ip[1]);
9786 ASC_DBG(1, "advansys_biosparam: end\n"); 9699 ASC_DBG(1, "end\n");
9787 return 0; 9700 return 0;
9788} 9701}
9789 9702
@@ -9799,17 +9712,17 @@ static irqreturn_t advansys_interrupt(int irq, void *dev_id)
9799 struct asc_board *boardp = shost_priv(shost); 9712 struct asc_board *boardp = shost_priv(shost);
9800 irqreturn_t result = IRQ_NONE; 9713 irqreturn_t result = IRQ_NONE;
9801 9714
9802 ASC_DBG1(2, "advansys_interrupt: boardp 0x%p\n", boardp); 9715 ASC_DBG(2, "boardp 0x%p\n", boardp);
9803 spin_lock_irqsave(&boardp->lock, flags); 9716 spin_lock_irqsave(&boardp->lock, flags);
9804 if (ASC_NARROW_BOARD(boardp)) { 9717 if (ASC_NARROW_BOARD(boardp)) {
9805 if (AscIsIntPending(shost->io_port)) { 9718 if (AscIsIntPending(shost->io_port)) {
9806 result = IRQ_HANDLED; 9719 result = IRQ_HANDLED;
9807 ASC_STATS(shost, interrupt); 9720 ASC_STATS(shost, interrupt);
9808 ASC_DBG(1, "advansys_interrupt: before AscISR()\n"); 9721 ASC_DBG(1, "before AscISR()\n");
9809 AscISR(&boardp->dvc_var.asc_dvc_var); 9722 AscISR(&boardp->dvc_var.asc_dvc_var);
9810 } 9723 }
9811 } else { 9724 } else {
9812 ASC_DBG(1, "advansys_interrupt: before AdvISR()\n"); 9725 ASC_DBG(1, "before AdvISR()\n");
9813 if (AdvISR(&boardp->dvc_var.adv_dvc_var)) { 9726 if (AdvISR(&boardp->dvc_var.adv_dvc_var)) {
9814 result = IRQ_HANDLED; 9727 result = IRQ_HANDLED;
9815 ASC_STATS(shost, interrupt); 9728 ASC_STATS(shost, interrupt);
@@ -9817,7 +9730,7 @@ static irqreturn_t advansys_interrupt(int irq, void *dev_id)
9817 } 9730 }
9818 spin_unlock_irqrestore(&boardp->lock, flags); 9731 spin_unlock_irqrestore(&boardp->lock, flags);
9819 9732
9820 ASC_DBG(1, "advansys_interrupt: end\n"); 9733 ASC_DBG(1, "end\n");
9821 return result; 9734 return result;
9822} 9735}
9823 9736
@@ -10186,7 +10099,7 @@ static int asc_build_req(struct asc_board *boardp, struct scsi_cmnd *scp,
10186 } 10099 }
10187 } 10100 }
10188 10101
10189 ASC_DBG_PRT_ASC_SCSI_Q(2, &asc_scsi_q); 10102 ASC_DBG_PRT_ASC_SCSI_Q(2, asc_scsi_q);
10190 ASC_DBG_PRT_CDB(1, scp->cmnd, scp->cmd_len); 10103 ASC_DBG_PRT_CDB(1, scp->cmnd, scp->cmd_len);
10191 10104
10192 return ASC_NOERROR; 10105 return ASC_NOERROR;
@@ -10229,7 +10142,7 @@ adv_get_sglist(struct asc_board *boardp, adv_req_t *reqp, struct scsi_cmnd *scp,
10229 * (15) scatter-gather elements. 10142 * (15) scatter-gather elements.
10230 */ 10143 */
10231 if ((sgblkp = boardp->adv_sgblkp) == NULL) { 10144 if ((sgblkp = boardp->adv_sgblkp) == NULL) {
10232 ASC_DBG(1, "adv_get_sglist: no free adv_sgblk_t\n"); 10145 ASC_DBG(1, "no free adv_sgblk_t\n");
10233 ASC_STATS(scp->device->host, adv_build_nosg); 10146 ASC_STATS(scp->device->host, adv_build_nosg);
10234 10147
10235 /* 10148 /*
@@ -10328,7 +10241,7 @@ adv_build_req(struct asc_board *boardp, struct scsi_cmnd *scp,
10328 * the command. 10241 * the command.
10329 */ 10242 */
10330 if (boardp->adv_reqp == NULL) { 10243 if (boardp->adv_reqp == NULL) {
10331 ASC_DBG(1, "adv_build_req: no free adv_req_t\n"); 10244 ASC_DBG(1, "no free adv_req_t\n");
10332 ASC_STATS(scp->device->host, adv_build_noreq); 10245 ASC_STATS(scp->device->host, adv_build_noreq);
10333 return ASC_BUSY; 10246 return ASC_BUSY;
10334 } else { 10247 } else {
@@ -11205,7 +11118,7 @@ static int asc_execute_scsi_cmnd(struct scsi_cmnd *scp)
11205 int ret, err_code; 11118 int ret, err_code;
11206 struct asc_board *boardp = shost_priv(scp->device->host); 11119 struct asc_board *boardp = shost_priv(scp->device->host);
11207 11120
11208 ASC_DBG1(1, "asc_execute_scsi_cmnd: scp 0x%p\n", scp); 11121 ASC_DBG(1, "scp 0x%p\n", scp);
11209 11122
11210 if (ASC_NARROW_BOARD(boardp)) { 11123 if (ASC_NARROW_BOARD(boardp)) {
11211 ASC_DVC_VAR *asc_dvc = &boardp->dvc_var.asc_dvc_var; 11124 ASC_DVC_VAR *asc_dvc = &boardp->dvc_var.asc_dvc_var;
@@ -11227,12 +11140,10 @@ static int asc_execute_scsi_cmnd(struct scsi_cmnd *scp)
11227 11140
11228 switch (adv_build_req(boardp, scp, &adv_scsiqp)) { 11141 switch (adv_build_req(boardp, scp, &adv_scsiqp)) {
11229 case ASC_NOERROR: 11142 case ASC_NOERROR:
11230 ASC_DBG(3, "asc_execute_scsi_cmnd: adv_build_req " 11143 ASC_DBG(3, "adv_build_req ASC_NOERROR\n");
11231 "ASC_NOERROR\n");
11232 break; 11144 break;
11233 case ASC_BUSY: 11145 case ASC_BUSY:
11234 ASC_DBG(1, "asc_execute_scsi_cmnd: adv_build_req " 11146 ASC_DBG(1, "adv_build_req ASC_BUSY\n");
11235 "ASC_BUSY\n");
11236 /* 11147 /*
11237 * The asc_stats fields 'adv_build_noreq' and 11148 * The asc_stats fields 'adv_build_noreq' and
11238 * 'adv_build_nosg' count wide board busy conditions. 11149 * 'adv_build_nosg' count wide board busy conditions.
@@ -11242,8 +11153,7 @@ static int asc_execute_scsi_cmnd(struct scsi_cmnd *scp)
11242 return ASC_BUSY; 11153 return ASC_BUSY;
11243 case ASC_ERROR: 11154 case ASC_ERROR:
11244 default: 11155 default:
11245 ASC_DBG(1, "asc_execute_scsi_cmnd: adv_build_req " 11156 ASC_DBG(1, "adv_build_req ASC_ERROR\n");
11246 "ASC_ERROR\n");
11247 ASC_STATS(scp->device->host, build_error); 11157 ASC_STATS(scp->device->host, build_error);
11248 return ASC_ERROR; 11158 return ASC_ERROR;
11249 } 11159 }
@@ -11260,8 +11170,7 @@ static int asc_execute_scsi_cmnd(struct scsi_cmnd *scp)
11260 * successful request counter. Wrapping doesn't matter. 11170 * successful request counter. Wrapping doesn't matter.
11261 */ 11171 */
11262 boardp->reqcnt[scp->device->id]++; 11172 boardp->reqcnt[scp->device->id]++;
11263 ASC_DBG(1, "asc_execute_scsi_cmnd: ExeScsiQueue(), " 11173 ASC_DBG(1, "ExeScsiQueue() ASC_NOERROR\n");
11264 "ASC_NOERROR\n");
11265 break; 11174 break;
11266 case ASC_BUSY: 11175 case ASC_BUSY:
11267 ASC_STATS(scp->device->host, exe_busy); 11176 ASC_STATS(scp->device->host, exe_busy);
@@ -11280,7 +11189,7 @@ static int asc_execute_scsi_cmnd(struct scsi_cmnd *scp)
11280 break; 11189 break;
11281 } 11190 }
11282 11191
11283 ASC_DBG(1, "asc_execute_scsi_cmnd: end\n"); 11192 ASC_DBG(1, "end\n");
11284 return ret; 11193 return ret;
11285} 11194}
11286 11195
@@ -11911,7 +11820,7 @@ static ushort __devinit AscInitFromEEP(ASC_DVC_VAR *asc_dvc)
11911 AscSetChipCfgMsw(iop_base, cfg_msw); 11820 AscSetChipCfgMsw(iop_base, cfg_msw);
11912 } 11821 }
11913 chksum = AscGetEEPConfig(iop_base, eep_config, asc_dvc->bus_type); 11822 chksum = AscGetEEPConfig(iop_base, eep_config, asc_dvc->bus_type);
11914 ASC_DBG1(1, "AscInitFromEEP: chksum 0x%x\n", chksum); 11823 ASC_DBG(1, "chksum 0x%x\n", chksum);
11915 if (chksum == 0) { 11824 if (chksum == 0) {
11916 chksum = 0xaa55; 11825 chksum = 0xaa55;
11917 } 11826 }
@@ -11932,13 +11841,11 @@ static ushort __devinit AscInitFromEEP(ASC_DVC_VAR *asc_dvc)
11932 } 11841 }
11933 eep_config->cfg_msw &= ~ASC_CFG_MSW_CLR_MASK; 11842 eep_config->cfg_msw &= ~ASC_CFG_MSW_CLR_MASK;
11934 eep_config->cfg_lsw |= ASC_CFG0_HOST_INT_ON; 11843 eep_config->cfg_lsw |= ASC_CFG0_HOST_INT_ON;
11935 ASC_DBG1(1, "AscInitFromEEP: eep_config->chksum 0x%x\n", 11844 ASC_DBG(1, "eep_config->chksum 0x%x\n", eep_config->chksum);
11936 eep_config->chksum);
11937 if (chksum != eep_config->chksum) { 11845 if (chksum != eep_config->chksum) {
11938 if (AscGetChipVersion(iop_base, asc_dvc->bus_type) == 11846 if (AscGetChipVersion(iop_base, asc_dvc->bus_type) ==
11939 ASC_CHIP_VER_PCI_ULTRA_3050) { 11847 ASC_CHIP_VER_PCI_ULTRA_3050) {
11940 ASC_DBG(1, 11848 ASC_DBG(1, "chksum error ignored; EEPROM-less board\n");
11941 "AscInitFromEEP: chksum error ignored; EEPROM-less board\n");
11942 eep_config->init_sdtr = 0xFF; 11849 eep_config->init_sdtr = 0xFF;
11943 eep_config->disc_enable = 0xFF; 11850 eep_config->disc_enable = 0xFF;
11944 eep_config->start_motor = 0xFF; 11851 eep_config->start_motor = 0xFF;
@@ -13517,11 +13424,11 @@ AdvInitGetConfig(struct pci_dev *pdev, struct asc_board *boardp)
13517 asc_dvc->cfg->chip_version = 13424 asc_dvc->cfg->chip_version =
13518 AdvGetChipVersion(iop_base, asc_dvc->bus_type); 13425 AdvGetChipVersion(iop_base, asc_dvc->bus_type);
13519 13426
13520 ASC_DBG2(1, "AdvInitGetConfig: iopb_chip_id_1: 0x%x 0x%x\n", 13427 ASC_DBG(1, "iopb_chip_id_1: 0x%x 0x%x\n",
13521 (ushort)AdvReadByteRegister(iop_base, IOPB_CHIP_ID_1), 13428 (ushort)AdvReadByteRegister(iop_base, IOPB_CHIP_ID_1),
13522 (ushort)ADV_CHIP_ID_BYTE); 13429 (ushort)ADV_CHIP_ID_BYTE);
13523 13430
13524 ASC_DBG2(1, "AdvInitGetConfig: iopw_chip_id_0: 0x%x 0x%x\n", 13431 ASC_DBG(1, "iopw_chip_id_0: 0x%x 0x%x\n",
13525 (ushort)AdvReadWordRegister(iop_base, IOPW_CHIP_ID_0), 13432 (ushort)AdvReadWordRegister(iop_base, IOPW_CHIP_ID_0),
13526 (ushort)ADV_CHIP_ID_WORD); 13433 (ushort)ADV_CHIP_ID_WORD);
13527 13434
@@ -13616,7 +13523,7 @@ advansys_wide_init_chip(struct asc_board *boardp, ADV_DVC_VAR *adv_dvc_varp)
13616 * is about 4 KB, so allocate all at once. 13523 * is about 4 KB, so allocate all at once.
13617 */ 13524 */
13618 boardp->carrp = kmalloc(ADV_CARRIER_BUFSIZE, GFP_KERNEL); 13525 boardp->carrp = kmalloc(ADV_CARRIER_BUFSIZE, GFP_KERNEL);
13619 ASC_DBG1(1, "advansys_wide_init_chip: carrp 0x%p\n", boardp->carrp); 13526 ASC_DBG(1, "carrp 0x%p\n", boardp->carrp);
13620 13527
13621 if (!boardp->carrp) 13528 if (!boardp->carrp)
13622 goto kmalloc_failed; 13529 goto kmalloc_failed;
@@ -13629,8 +13536,7 @@ advansys_wide_init_chip(struct asc_board *boardp, ADV_DVC_VAR *adv_dvc_varp)
13629 for (req_cnt = adv_dvc_varp->max_host_qng; req_cnt > 0; req_cnt--) { 13536 for (req_cnt = adv_dvc_varp->max_host_qng; req_cnt > 0; req_cnt--) {
13630 reqp = kmalloc(sizeof(adv_req_t) * req_cnt, GFP_KERNEL); 13537 reqp = kmalloc(sizeof(adv_req_t) * req_cnt, GFP_KERNEL);
13631 13538
13632 ASC_DBG3(1, "advansys_wide_init_chip: reqp 0x%p, req_cnt %d, " 13539 ASC_DBG(1, "reqp 0x%p, req_cnt %d, bytes %lu\n", reqp, req_cnt,
13633 "bytes %lu\n", reqp, req_cnt,
13634 (ulong)sizeof(adv_req_t) * req_cnt); 13540 (ulong)sizeof(adv_req_t) * req_cnt);
13635 13541
13636 if (reqp) 13542 if (reqp)
@@ -13658,8 +13564,7 @@ advansys_wide_init_chip(struct asc_board *boardp, ADV_DVC_VAR *adv_dvc_varp)
13658 13564
13659 } 13565 }
13660 13566
13661 ASC_DBG3(1, "advansys_wide_init_chip: sg_cnt %d * %u = %u bytes\n", 13567 ASC_DBG(1, "sg_cnt %d * %u = %u bytes\n", sg_cnt, sizeof(adv_sgblk_t),
13662 sg_cnt, sizeof(adv_sgblk_t),
13663 (unsigned)(sizeof(adv_sgblk_t) * sg_cnt)); 13568 (unsigned)(sizeof(adv_sgblk_t) * sg_cnt));
13664 13569
13665 if (!boardp->adv_sgblkp) 13570 if (!boardp->adv_sgblkp)
@@ -13679,15 +13584,13 @@ advansys_wide_init_chip(struct asc_board *boardp, ADV_DVC_VAR *adv_dvc_varp)
13679 boardp->adv_reqp = &reqp[0]; 13584 boardp->adv_reqp = &reqp[0];
13680 13585
13681 if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { 13586 if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
13682 ASC_DBG(2, "advansys_wide_init_chip: AdvInitAsc3550Driver()\n"); 13587 ASC_DBG(2, "AdvInitAsc3550Driver()\n");
13683 warn_code = AdvInitAsc3550Driver(adv_dvc_varp); 13588 warn_code = AdvInitAsc3550Driver(adv_dvc_varp);
13684 } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) { 13589 } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) {
13685 ASC_DBG(2, "advansys_wide_init_chip: AdvInitAsc38C0800Driver()" 13590 ASC_DBG(2, "AdvInitAsc38C0800Driver()\n");
13686 "\n");
13687 warn_code = AdvInitAsc38C0800Driver(adv_dvc_varp); 13591 warn_code = AdvInitAsc38C0800Driver(adv_dvc_varp);
13688 } else { 13592 } else {
13689 ASC_DBG(2, "advansys_wide_init_chip: AdvInitAsc38C1600Driver()" 13593 ASC_DBG(2, "AdvInitAsc38C1600Driver()\n");
13690 "\n");
13691 warn_code = AdvInitAsc38C1600Driver(adv_dvc_varp); 13594 warn_code = AdvInitAsc38C1600Driver(adv_dvc_varp);
13692 } 13595 }
13693 err_code = adv_dvc_varp->err_code; 13596 err_code = adv_dvc_varp->err_code;
@@ -13734,7 +13637,7 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost,
13734 pdev = (bus_type == ASC_IS_PCI) ? to_pci_dev(boardp->dev) : NULL; 13637 pdev = (bus_type == ASC_IS_PCI) ? to_pci_dev(boardp->dev) : NULL;
13735 13638
13736 if (ASC_NARROW_BOARD(boardp)) { 13639 if (ASC_NARROW_BOARD(boardp)) {
13737 ASC_DBG(1, "advansys_board_found: narrow board\n"); 13640 ASC_DBG(1, "narrow board\n");
13738 asc_dvc_varp = &boardp->dvc_var.asc_dvc_var; 13641 asc_dvc_varp = &boardp->dvc_var.asc_dvc_var;
13739 asc_dvc_varp->bus_type = bus_type; 13642 asc_dvc_varp->bus_type = bus_type;
13740 asc_dvc_varp->drv_ptr = boardp; 13643 asc_dvc_varp->drv_ptr = boardp;
@@ -13743,18 +13646,17 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost,
13743 asc_dvc_varp->iop_base = iop; 13646 asc_dvc_varp->iop_base = iop;
13744 } else { 13647 } else {
13745#ifdef CONFIG_PCI 13648#ifdef CONFIG_PCI
13746 ASC_DBG(1, "advansys_board_found: wide board\n");
13747 adv_dvc_varp = &boardp->dvc_var.adv_dvc_var; 13649 adv_dvc_varp = &boardp->dvc_var.adv_dvc_var;
13748 adv_dvc_varp->drv_ptr = boardp; 13650 adv_dvc_varp->drv_ptr = boardp;
13749 adv_dvc_varp->cfg = &boardp->dvc_cfg.adv_dvc_cfg; 13651 adv_dvc_varp->cfg = &boardp->dvc_cfg.adv_dvc_cfg;
13750 if (pdev->device == PCI_DEVICE_ID_ASP_ABP940UW) { 13652 if (pdev->device == PCI_DEVICE_ID_ASP_ABP940UW) {
13751 ASC_DBG(1, "advansys_board_found: ASC-3550\n"); 13653 ASC_DBG(1, "wide board ASC-3550\n");
13752 adv_dvc_varp->chip_type = ADV_CHIP_ASC3550; 13654 adv_dvc_varp->chip_type = ADV_CHIP_ASC3550;
13753 } else if (pdev->device == PCI_DEVICE_ID_38C0800_REV1) { 13655 } else if (pdev->device == PCI_DEVICE_ID_38C0800_REV1) {
13754 ASC_DBG(1, "advansys_board_found: ASC-38C0800\n"); 13656 ASC_DBG(1, "wide board ASC-38C0800\n");
13755 adv_dvc_varp->chip_type = ADV_CHIP_ASC38C0800; 13657 adv_dvc_varp->chip_type = ADV_CHIP_ASC38C0800;
13756 } else { 13658 } else {
13757 ASC_DBG(1, "advansys_board_found: ASC-38C1600\n"); 13659 ASC_DBG(1, "wide board ASC-38C1600\n");
13758 adv_dvc_varp->chip_type = ADV_CHIP_ASC38C1600; 13660 adv_dvc_varp->chip_type = ADV_CHIP_ASC38C1600;
13759 } 13661 }
13760 13662
@@ -13769,9 +13671,8 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost,
13769 ret = -ENODEV; 13671 ret = -ENODEV;
13770 goto err_shost; 13672 goto err_shost;
13771 } 13673 }
13772 adv_dvc_varp->iop_base = (AdvPortAddr)boardp->ioremap_addr 13674 adv_dvc_varp->iop_base = (AdvPortAddr)boardp->ioremap_addr;
13773 ASC_DBG1(1, "advansys_board_found: iop_base: 0x%lx\n", 13675 ASC_DBG(1, "iop_base: 0x%p\n", adv_dvc_varp->iop_base);
13774 adv_dvc_varp->iop_base);
13775 13676
13776 /* 13677 /*
13777 * Even though it isn't used to access wide boards, other 13678 * Even though it isn't used to access wide boards, other
@@ -13780,9 +13681,8 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost,
13780 */ 13681 */
13781 boardp->ioport = iop; 13682 boardp->ioport = iop;
13782 13683
13783 ASC_DBG2(1, "advansys_board_found: iopb_chip_id_1 0x%x, " 13684 ASC_DBG(1, "iopb_chip_id_1 0x%x, iopw_chip_id_0 0x%x\n",
13784 "iopw_chip_id_0 0x%x\n", (ushort)inp(iop + 1), 13685 (ushort)inp(iop + 1), (ushort)inpw(iop));
13785 (ushort)inpw(iop));
13786#endif /* CONFIG_PCI */ 13686#endif /* CONFIG_PCI */
13787 } 13687 }
13788 13688
@@ -13841,7 +13741,7 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost,
13841 * longer be used. If the bus_type field must be 13741 * longer be used. If the bus_type field must be
13842 * referenced only use the bit-wise AND operator "&". 13742 * referenced only use the bit-wise AND operator "&".
13843 */ 13743 */
13844 ASC_DBG(2, "advansys_board_found: AscInitGetConfig()\n"); 13744 ASC_DBG(2, "AscInitGetConfig()\n");
13845 ret = AscInitGetConfig(boardp) ? -ENODEV : 0; 13745 ret = AscInitGetConfig(boardp) ? -ENODEV : 0;
13846 } else { 13746 } else {
13847#ifdef CONFIG_PCI 13747#ifdef CONFIG_PCI
@@ -13851,7 +13751,7 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost,
13851 */ 13751 */
13852 shost->unchecked_isa_dma = FALSE; 13752 shost->unchecked_isa_dma = FALSE;
13853 share_irq = IRQF_SHARED; 13753 share_irq = IRQF_SHARED;
13854 ASC_DBG(2, "advansys_board_found: AdvInitGetConfig()\n"); 13754 ASC_DBG(2, "AdvInitGetConfig()\n");
13855 13755
13856 ret = AdvInitGetConfig(pdev, boardp) ? -ENODEV : 0; 13756 ret = AdvInitGetConfig(pdev, boardp) ? -ENODEV : 0;
13857#endif /* CONFIG_PCI */ 13757#endif /* CONFIG_PCI */
@@ -13900,7 +13800,7 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost,
13900 /* 13800 /*
13901 * Modify board configuration. 13801 * Modify board configuration.
13902 */ 13802 */
13903 ASC_DBG(2, "advansys_board_found: AscInitSetConfig()\n"); 13803 ASC_DBG(2, "AscInitSetConfig()\n");
13904 ret = AscInitSetConfig(pdev, boardp) ? -ENODEV : 0; 13804 ret = AscInitSetConfig(pdev, boardp) ? -ENODEV : 0;
13905 if (ret) 13805 if (ret)
13906 goto err_free_proc; 13806 goto err_free_proc;
@@ -14081,7 +13981,7 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost,
14081 shost->sg_tablesize = SG_ALL; 13981 shost->sg_tablesize = SG_ALL;
14082 } 13982 }
14083 13983
14084 ASC_DBG1(1, "advansys_board_found: sg_tablesize: %d\n", shost->sg_tablesize); 13984 ASC_DBG(1, "sg_tablesize: %d\n", shost->sg_tablesize);
14085 13985
14086 /* BIOS start address. */ 13986 /* BIOS start address. */
14087 if (ASC_NARROW_BOARD(boardp)) { 13987 if (ASC_NARROW_BOARD(boardp)) {
@@ -14101,12 +14001,10 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost,
14101 AdvReadWordLram(adv_dvc_varp->iop_base, 14001 AdvReadWordLram(adv_dvc_varp->iop_base,
14102 BIOS_CODELEN, boardp->bios_codelen); 14002 BIOS_CODELEN, boardp->bios_codelen);
14103 14003
14104 ASC_DBG2(1, 14004 ASC_DBG(1, "bios_signature 0x%x, bios_version 0x%x\n",
14105 "advansys_board_found: bios_signature 0x%x, bios_version 0x%x\n",
14106 boardp->bios_signature, boardp->bios_version); 14005 boardp->bios_signature, boardp->bios_version);
14107 14006
14108 ASC_DBG2(1, 14007 ASC_DBG(1, "bios_codeseg 0x%x, bios_codelen 0x%x\n",
14109 "advansys_board_found: bios_codeseg 0x%x, bios_codelen 0x%x\n",
14110 boardp->bios_codeseg, boardp->bios_codelen); 14008 boardp->bios_codeseg, boardp->bios_codelen);
14111 14009
14112 /* 14010 /*
@@ -14148,7 +14046,7 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost,
14148#endif /* CONFIG_ISA */ 14046#endif /* CONFIG_ISA */
14149 14047
14150 /* Register IRQ Number. */ 14048 /* Register IRQ Number. */
14151 ASC_DBG1(2, "advansys_board_found: request_irq() %d\n", boardp->irq); 14049 ASC_DBG(2, "request_irq(%d, %p)\n", boardp->irq, shost);
14152 14050
14153 ret = request_irq(boardp->irq, advansys_interrupt, share_irq, 14051 ret = request_irq(boardp->irq, advansys_interrupt, share_irq,
14154 DRV_NAME, shost); 14052 DRV_NAME, shost);
@@ -14174,7 +14072,7 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost,
14174 * Initialize board RISC chip and enable interrupts. 14072 * Initialize board RISC chip and enable interrupts.
14175 */ 14073 */
14176 if (ASC_NARROW_BOARD(boardp)) { 14074 if (ASC_NARROW_BOARD(boardp)) {
14177 ASC_DBG(2, "advansys_board_found: AscInitAsc1000Driver()\n"); 14075 ASC_DBG(2, "AscInitAsc1000Driver()\n");
14178 warn_code = AscInitAsc1000Driver(asc_dvc_varp); 14076 warn_code = AscInitAsc1000Driver(asc_dvc_varp);
14179 14077
14180 if (warn_code || asc_dvc_varp->err_code) { 14078 if (warn_code || asc_dvc_varp->err_code) {
@@ -14225,11 +14123,11 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost,
14225static int advansys_release(struct Scsi_Host *shost) 14123static int advansys_release(struct Scsi_Host *shost)
14226{ 14124{
14227 struct asc_board *boardp = shost_priv(shost); 14125 struct asc_board *boardp = shost_priv(shost);
14228 ASC_DBG(1, "advansys_release: begin\n"); 14126 ASC_DBG(1, "begin\n");
14229 scsi_remove_host(shost); 14127 scsi_remove_host(shost);
14230 free_irq(boardp->irq, shost); 14128 free_irq(boardp->irq, shost);
14231 if (shost->dma_channel != NO_ISA_DMA) { 14129 if (shost->dma_channel != NO_ISA_DMA) {
14232 ASC_DBG(1, "advansys_release: free_dma()\n"); 14130 ASC_DBG(1, "free_dma()\n");
14233 free_dma(shost->dma_channel); 14131 free_dma(shost->dma_channel);
14234 } 14132 }
14235 if (!ASC_NARROW_BOARD(boardp)) { 14133 if (!ASC_NARROW_BOARD(boardp)) {
@@ -14238,7 +14136,7 @@ static int advansys_release(struct Scsi_Host *shost)
14238 } 14136 }
14239 kfree(boardp->prtbuf); 14137 kfree(boardp->prtbuf);
14240 scsi_host_put(shost); 14138 scsi_host_put(shost);
14241 ASC_DBG(1, "advansys_release: end\n"); 14139 ASC_DBG(1, "end\n");
14242 return 0; 14140 return 0;
14243} 14141}
14244 14142
@@ -14273,11 +14171,10 @@ static int __devinit advansys_isa_probe(struct device *dev, unsigned int id)
14273 struct asc_board *board; 14171 struct asc_board *board;
14274 14172
14275 if (!request_region(iop_base, ASC_IOADR_GAP, DRV_NAME)) { 14173 if (!request_region(iop_base, ASC_IOADR_GAP, DRV_NAME)) {
14276 ASC_DBG1(1, "advansys_isa_match: I/O port 0x%x busy\n", 14174 ASC_DBG(1, "I/O port 0x%x busy\n", iop_base);
14277 iop_base);
14278 return -ENODEV; 14175 return -ENODEV;
14279 } 14176 }
14280 ASC_DBG1(1, "advansys_isa_match: probing I/O port 0x%x\n", iop_base); 14177 ASC_DBG(1, "probing I/O port 0x%x\n", iop_base);
14281 if (!AscFindSignature(iop_base)) 14178 if (!AscFindSignature(iop_base))
14282 goto release_region; 14179 goto release_region;
14283 if (!(AscGetChipVersion(iop_base, ASC_IS_ISA) & ASC_CHIP_VER_ISA_BIT)) 14180 if (!(AscGetChipVersion(iop_base, ASC_IS_ISA) & ASC_CHIP_VER_ISA_BIT))
@@ -14351,11 +14248,10 @@ static int __devinit advansys_vlb_probe(struct device *dev, unsigned int id)
14351 struct asc_board *board; 14248 struct asc_board *board;
14352 14249
14353 if (!request_region(iop_base, ASC_IOADR_GAP, DRV_NAME)) { 14250 if (!request_region(iop_base, ASC_IOADR_GAP, DRV_NAME)) {
14354 ASC_DBG1(1, "advansys_vlb_match: I/O port 0x%x busy\n", 14251 ASC_DBG(1, "I/O port 0x%x busy\n", iop_base);
14355 iop_base);
14356 return -ENODEV; 14252 return -ENODEV;
14357 } 14253 }
14358 ASC_DBG1(1, "advansys_vlb_match: probing I/O port 0x%x\n", iop_base); 14254 ASC_DBG(1, "probing I/O port 0x%x\n", iop_base);
14359 if (!AscFindSignature(iop_base)) 14255 if (!AscFindSignature(iop_base))
14360 goto release_region; 14256 goto release_region;
14361 /* 14257 /*