diff options
Diffstat (limited to 'drivers/scsi/aic7xxx/aic7xxx_core.c')
-rw-r--r-- | drivers/scsi/aic7xxx/aic7xxx_core.c | 131 |
1 files changed, 63 insertions, 68 deletions
diff --git a/drivers/scsi/aic7xxx/aic7xxx_core.c b/drivers/scsi/aic7xxx/aic7xxx_core.c index b1b852fe940b..b61a32c53645 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_core.c +++ b/drivers/scsi/aic7xxx/aic7xxx_core.c @@ -66,7 +66,7 @@ static const char *const ahc_chip_names[] = { * Hardware error codes. */ struct ahc_hard_error_entry { - uint8_t errno; + uint8_t errno; const char *errmesg; }; @@ -142,7 +142,7 @@ static void ahc_free_tstate(struct ahc_softc *ahc, #endif static const struct ahc_syncrate* ahc_devlimited_syncrate(struct ahc_softc *ahc, - struct ahc_initiator_tinfo *, + struct ahc_initiator_tinfo *, u_int *period, u_int *ppr_options, role_t role); @@ -195,7 +195,7 @@ static void ahc_setup_target_msgin(struct ahc_softc *ahc, struct scb *scb); #endif -static bus_dmamap_callback_t ahc_dmamap_cb; +static bus_dmamap_callback_t ahc_dmamap_cb; static void ahc_build_free_scb_list(struct ahc_softc *ahc); static int ahc_init_scbdata(struct ahc_softc *ahc); static void ahc_fini_scbdata(struct ahc_softc *ahc); @@ -978,7 +978,7 @@ ahc_handle_seqint(struct ahc_softc *ahc, u_int intstat) { struct scb *scb; struct ahc_devinfo devinfo; - + ahc_fetch_devinfo(ahc, &devinfo); /* @@ -1022,7 +1022,7 @@ ahc_handle_seqint(struct ahc_softc *ahc, u_int intstat) goto unpause; } - hscb = scb->hscb; + hscb = scb->hscb; /* Don't want to clobber the original sense code */ if ((scb->flags & SCB_SENSE) != 0) { @@ -1071,7 +1071,7 @@ ahc_handle_seqint(struct ahc_softc *ahc, u_int intstat) &tstate); tinfo = &targ_info->curr; sg = scb->sg_list; - sc = (struct scsi_sense *)(&hscb->shared_data.cdb); + sc = (struct scsi_sense *)(&hscb->shared_data.cdb); /* * Save off the residual if there is one. */ @@ -1117,8 +1117,8 @@ ahc_handle_seqint(struct ahc_softc *ahc, u_int intstat) * errors will be reported before any data * phases occur. */ - if (ahc_get_residual(scb) - == ahc_get_transfer_length(scb)) { + if (ahc_get_residual(scb) + == ahc_get_transfer_length(scb)) { ahc_update_neg_request(ahc, &devinfo, tstate, targ_info, AHC_NEG_IF_NON_ASYNC); @@ -1129,7 +1129,7 @@ ahc_handle_seqint(struct ahc_softc *ahc, u_int intstat) scb->flags |= SCB_AUTO_NEGOTIATE; } hscb->cdb_len = sizeof(*sc); - hscb->dataptr = sg->addr; + hscb->dataptr = sg->addr; hscb->datacnt = sg->len; hscb->sgptr = scb->sg_list_phys | SG_FULL_RESID; hscb->sgptr = ahc_htole32(hscb->sgptr); @@ -1187,13 +1187,13 @@ ahc_handle_seqint(struct ahc_softc *ahc, u_int intstat) ahc_assert_atn(ahc); break; } - case SEND_REJECT: + case SEND_REJECT: { u_int rejbyte = ahc_inb(ahc, ACCUM); printk("%s:%c:%d: Warning - unknown message received from " - "target (0x%x). Rejecting\n", + "target (0x%x). Rejecting\n", ahc_name(ahc), devinfo.channel, devinfo.target, rejbyte); - break; + break; } case PROTO_VIOLATION: { @@ -1286,8 +1286,7 @@ ahc_handle_seqint(struct ahc_softc *ahc, u_int intstat) ahc->msg_type = MSG_TYPE_TARGET_MSGOUT; ahc->msgin_index = 0; - } - else + } else ahc_setup_target_msgin(ahc, &devinfo, scb); @@ -1359,7 +1358,7 @@ ahc_handle_seqint(struct ahc_softc *ahc, u_int intstat) if (scb != NULL) ahc_set_transaction_status(scb, CAM_UNCOR_PARITY); - ahc_reset_channel(ahc, devinfo.channel, + ahc_reset_channel(ahc, devinfo.channel, /*init reset*/TRUE); } } else { @@ -1391,7 +1390,7 @@ ahc_handle_seqint(struct ahc_softc *ahc, u_int intstat) printk("data overrun detected %s." " Tag == 0x%x.\n", ahc_phase_table[i].phasemsg, - scb->hscb->tag); + scb->hscb->tag); ahc_print_path(ahc, scb); printk("%s seen Data Phase. Length = %ld. NumSGs = %d.\n", ahc_inb(ahc, SEQ_FLAGS) & DPHASE ? "Have" : "Haven't", @@ -1402,7 +1401,7 @@ ahc_handle_seqint(struct ahc_softc *ahc, u_int intstat) printk("sg[%d] - Addr 0x%x%x : Length %d\n", i, (ahc_le32toh(scb->sg_list[i].len) >> 24 - & SG_HIGH_ADDR_BITS), + & SG_HIGH_ADDR_BITS), ahc_le32toh(scb->sg_list[i].addr), ahc_le32toh(scb->sg_list[i].len) & AHC_SG_LEN_MASK); @@ -1549,7 +1548,7 @@ ahc_handle_scsiint(struct ahc_softc *ahc, u_int intstat) if (status == 0 && status0 == 0) { if ((ahc->features & AHC_TWIN) != 0) { /* Try the other channel */ - ahc_outb(ahc, SBLKCTL, ahc_inb(ahc, SBLKCTL) ^ SELBUSB); + ahc_outb(ahc, SBLKCTL, ahc_inb(ahc, SBLKCTL) ^ SELBUSB); status = ahc_inb(ahc, SSTAT1) & (SELTO|SCSIRSTI|BUSFREE|SCSIPERR); intr_channel = (cur_channel == 'A') ? 'B' : 'A'; @@ -1595,7 +1594,7 @@ ahc_handle_scsiint(struct ahc_softc *ahc, u_int intstat) printk("%s: Someone reset channel %c\n", ahc_name(ahc), intr_channel); if (intr_channel != cur_channel) - ahc_outb(ahc, SBLKCTL, ahc_inb(ahc, SBLKCTL) ^ SELBUSB); + ahc_outb(ahc, SBLKCTL, ahc_inb(ahc, SBLKCTL) ^ SELBUSB); ahc_reset_channel(ahc, intr_channel, /*Initiate Reset*/FALSE); } else if ((status & SCSIPERR) != 0) { /* @@ -1688,8 +1687,8 @@ ahc_handle_scsiint(struct ahc_softc *ahc, u_int intstat) } /* - * We've set the hardware to assert ATN if we - * get a parity error on "in" phases, so all we + * We've set the hardware to assert ATN if we + * get a parity error on "in" phases, so all we * need to do is stuff the message buffer with * the appropriate message. "In" phases have set * mesg_out to something other than MSG_NOP. @@ -1986,7 +1985,7 @@ ahc_clear_critical_section(struct ahc_softc *ahc) | (ahc_inb(ahc, SEQADDR1) << 8); /* - * Seqaddr represents the next instruction to execute, + * Seqaddr represents the next instruction to execute, * so we are really executing the instruction just * before it. */ @@ -1994,7 +1993,6 @@ ahc_clear_critical_section(struct ahc_softc *ahc) seqaddr -= 1; cs = ahc->critical_sections; for (i = 0; i < ahc->num_critical_sections; i++, cs++) { - if (cs->begin < seqaddr && cs->end >= seqaddr) break; } @@ -2064,7 +2062,7 @@ ahc_clear_intstat(struct ahc_softc *ahc) CLRREQINIT); ahc_flush_device_writes(ahc); ahc_outb(ahc, CLRSINT0, CLRSELDO|CLRSELDI|CLRSELINGO); - ahc_flush_device_writes(ahc); + ahc_flush_device_writes(ahc); ahc_outb(ahc, CLRINT, CLRSCSIINT); ahc_flush_device_writes(ahc); } @@ -2101,7 +2099,7 @@ ahc_print_scb(struct scb *scb) printk("sg[%d] - Addr 0x%x%x : Length %d\n", i, (ahc_le32toh(scb->sg_list[i].len) >> 24 - & SG_HIGH_ADDR_BITS), + & SG_HIGH_ADDR_BITS), ahc_le32toh(scb->sg_list[i].addr), ahc_le32toh(scb->sg_list[i].len)); } @@ -2223,7 +2221,7 @@ ahc_devlimited_syncrate(struct ahc_softc *ahc, */ if (role == ROLE_TARGET) transinfo = &tinfo->user; - else + else transinfo = &tinfo->goal; *ppr_options &= transinfo->ppr_options; if (transinfo->width == MSG_EXT_WDTR_BUS_8_BIT) { @@ -2655,9 +2653,9 @@ ahc_set_tags(struct ahc_softc *ahc, struct scsi_cmnd *cmd, { struct scsi_device *sdev = cmd->device; - ahc_platform_set_tags(ahc, sdev, devinfo, alg); - ahc_send_async(ahc, devinfo->channel, devinfo->target, - devinfo->lun, AC_TRANSFER_NEG); + ahc_platform_set_tags(ahc, sdev, devinfo, alg); + ahc_send_async(ahc, devinfo->channel, devinfo->target, + devinfo->lun, AC_TRANSFER_NEG); } /* @@ -2756,9 +2754,9 @@ ahc_fetch_devinfo(struct ahc_softc *ahc, struct ahc_devinfo *devinfo) role = ROLE_INITIATOR; if (role == ROLE_TARGET - && (ahc->features & AHC_MULTI_TID) != 0 - && (ahc_inb(ahc, SEQ_FLAGS) - & (CMDPHASE_PENDING|TARG_CMD_PENDING|NO_DISCONNECT)) != 0) { + && (ahc->features & AHC_MULTI_TID) != 0 + && (ahc_inb(ahc, SEQ_FLAGS) + & (CMDPHASE_PENDING|TARG_CMD_PENDING|NO_DISCONNECT)) != 0) { /* We were selected, so pull our id from TARGIDIN */ our_id = ahc_inb(ahc, TARGIDIN) & OID; } else if ((ahc->features & AHC_ULTRA2) != 0) @@ -3366,7 +3364,7 @@ reswitch: #endif ahc_assert_atn(ahc); } - } else + } else ahc->msgin_index++; if (message_done == MSGLOOP_TERMINATED) { @@ -3459,7 +3457,7 @@ reswitch: */ return; } - + ahc->msgin_index++; /* @@ -4338,7 +4336,7 @@ ahc_handle_devreset(struct ahc_softc *ahc, struct ahc_devinfo *devinfo, ahc_set_syncrate(ahc, devinfo, /*syncrate*/NULL, /*period*/0, /*offset*/0, /*ppr_options*/0, AHC_TRANS_CUR, /*paused*/TRUE); - + if (status != CAM_SEL_TIMEOUT) ahc_send_async(ahc, devinfo->channel, devinfo->target, CAM_LUN_WILDCARD, AC_SENT_BDR); @@ -4355,11 +4353,11 @@ ahc_setup_target_msgin(struct ahc_softc *ahc, struct ahc_devinfo *devinfo, struct scb *scb) { - /* + /* * To facilitate adding multiple messages together, * each routine should increment the index and len * variables instead of setting them explicitly. - */ + */ ahc->msgout_index = 0; ahc->msgout_len = 0; @@ -4432,7 +4430,7 @@ ahc_softc_init(struct ahc_softc *ahc) ahc->unpause = ahc_inb(ahc, HCNTRL) & IRQMS; else ahc->unpause = 0; - ahc->pause = ahc->unpause | PAUSE; + ahc->pause = ahc->unpause | PAUSE; /* XXX The shared scb data stuff should be deprecated */ if (ahc->scb_data == NULL) { ahc->scb_data = kzalloc(sizeof(*ahc->scb_data), GFP_ATOMIC); @@ -4554,7 +4552,7 @@ ahc_reset(struct ahc_softc *ahc, int reinit) u_int sxfrctl1_a, sxfrctl1_b; int error; int wait; - + /* * Preserve the value of the SXFRCTL1 register for all channels. * It contains settings that affect termination and we don't want @@ -4643,7 +4641,7 @@ ahc_reset(struct ahc_softc *ahc, int reinit) */ error = ahc->bus_chip_init(ahc); #ifdef AHC_DUMP_SEQ - else + else ahc_dumpseq(ahc); #endif @@ -4708,7 +4706,7 @@ ahc_build_free_scb_list(struct ahc_softc *ahc) /* Set the next pointer */ if ((ahc->flags & AHC_PAGESCBS) != 0) ahc_outb(ahc, SCB_NEXT, i+1); - else + else ahc_outb(ahc, SCB_NEXT, SCB_LIST_NULL); /* Make the tag number, SCSIID, and lun invalid */ @@ -4861,7 +4859,7 @@ ahc_init_scbdata(struct ahc_softc *ahc) /* * Note that we were successful */ - return (0); + return (0); error_exit: @@ -5004,7 +5002,7 @@ ahc_controller_info(struct ahc_softc *ahc, char *buf) len = sprintf(buf, "%s: ", ahc_chip_names[ahc->chip & AHC_CHIPID_MASK]); buf += len; if ((ahc->features & AHC_TWIN) != 0) - len = sprintf(buf, "Twin Channel, A SCSI Id=%d, " + len = sprintf(buf, "Twin Channel, A SCSI Id=%d, " "B SCSI Id=%d, primary %c, ", ahc->our_id, ahc->our_id_b, (ahc->flags & AHC_PRIMARY_CHANNEL) + 'A'); @@ -5140,7 +5138,7 @@ ahc_chip_init(struct ahc_softc *ahc) ahc_outb(ahc, CMDSIZE_TABLE + 5, 11); ahc_outb(ahc, CMDSIZE_TABLE + 6, 0); ahc_outb(ahc, CMDSIZE_TABLE + 7, 0); - + if ((ahc->features & AHC_HS_MAILBOX) != 0) ahc_outb(ahc, HS_MAILBOX, 0); @@ -5271,7 +5269,7 @@ ahc_init(struct ahc_softc *ahc) */ if ((ahc->flags & AHC_USEDEFAULTS) != 0) ahc->our_id = ahc->our_id_b = 7; - + /* * Default to allowing initiator operations. */ @@ -5289,7 +5287,7 @@ ahc_init(struct ahc_softc *ahc) * DMA tag for our command fifos and other data in system memory * the card's sequencer must be able to access. For initiator * roles, we need to allocate space for the qinfifo and qoutfifo. - * The qinfifo and qoutfifo are composed of 256 1 byte elements. + * The qinfifo and qoutfifo are composed of 256 1 byte elements. * When providing for the target mode role, we must additionally * provide space for the incoming target command fifo and an extra * byte to deal with a dma bug in some chip versions. @@ -5398,7 +5396,7 @@ ahc_init(struct ahc_softc *ahc) && (ahc->flags & AHC_INITIATORROLE) != 0) ahc->flags |= AHC_RESET_BUS_A; - ultraenb = 0; + ultraenb = 0; tagenable = ALL_TARGETS_MASK; /* Grab the disconnection disable table and invert it for our needs */ @@ -5494,9 +5492,9 @@ ahc_init(struct ahc_softc *ahc) && (ultraenb & mask) != 0) { /* Treat 10MHz as a non-ultra speed */ scsirate &= ~SXFR; - ultraenb &= ~mask; + ultraenb &= ~mask; } - tinfo->user.period = + tinfo->user.period = ahc_find_period(ahc, scsirate, (ultraenb & mask) ? AHC_SYNCRATE_ULTRA @@ -5622,7 +5620,7 @@ ahc_resume(struct ahc_softc *ahc) { ahc_reset(ahc, /*reinit*/TRUE); - ahc_intr_enable(ahc, TRUE); + ahc_intr_enable(ahc, TRUE); ahc_restart(ahc); return (0); } @@ -5639,7 +5637,7 @@ ahc_index_busy_tcl(struct ahc_softc *ahc, u_int tcl) if ((ahc->flags & AHC_SCB_BTT) != 0) { u_int saved_scbptr; - + saved_scbptr = ahc_inb(ahc, SCBPTR); ahc_outb(ahc, SCBPTR, TCL_LUN(tcl)); scbid = ahc_inb(ahc, SCB_64_BTT + TCL_TARGET_OFFSET(tcl)); @@ -5659,7 +5657,7 @@ ahc_unbusy_tcl(struct ahc_softc *ahc, u_int tcl) if ((ahc->flags & AHC_SCB_BTT) != 0) { u_int saved_scbptr; - + saved_scbptr = ahc_inb(ahc, SCBPTR); ahc_outb(ahc, SCBPTR, TCL_LUN(tcl)); ahc_outb(ahc, SCB_64_BTT+TCL_TARGET_OFFSET(tcl), SCB_LIST_NULL); @@ -5677,7 +5675,7 @@ ahc_busy_tcl(struct ahc_softc *ahc, u_int tcl, u_int scbid) if ((ahc->flags & AHC_SCB_BTT) != 0) { u_int saved_scbptr; - + saved_scbptr = ahc_inb(ahc, SCBPTR); ahc_outb(ahc, SCBPTR, TCL_LUN(tcl)); ahc_outb(ahc, SCB_64_BTT + TCL_TARGET_OFFSET(tcl), scbid); @@ -5735,7 +5733,7 @@ ahc_freeze_devq(struct ahc_softc *ahc, struct scb *scb) target = SCB_GET_TARGET(ahc, scb); lun = SCB_GET_LUN(scb); channel = SCB_GET_CHANNEL(ahc, scb); - + ahc_search_qinfifo(ahc, target, channel, lun, /*tag*/SCB_LIST_NULL, ROLE_UNKNOWN, CAM_REQUEUE_REQ, SEARCH_COMPLETE); @@ -5773,7 +5771,7 @@ ahc_qinfifo_requeue(struct ahc_softc *ahc, struct scb *prev_scb, ahc_outb(ahc, NEXT_QUEUED_SCB, scb->hscb->tag); } else { prev_scb->hscb->next = scb->hscb->tag; - ahc_sync_scb(ahc, prev_scb, + ahc_sync_scb(ahc, prev_scb, BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE); } ahc->qinfifo[ahc->qinfifonext++] = scb->hscb->tag; @@ -5989,7 +5987,6 @@ ahc_search_qinfifo(struct ahc_softc *ahc, int target, char channel, break; } } else { - prev = next; next = ahc_inb(ahc, SCB_NEXT); } @@ -6235,7 +6232,7 @@ ahc_rem_wscb(struct ahc_softc *ahc, u_int scbpos, u_int prev) /* update the waiting list */ if (prev == SCB_LIST_NULL) { /* First in the list */ - ahc_outb(ahc, WAITING_SCBH, next); + ahc_outb(ahc, WAITING_SCBH, next); /* * Ensure we aren't attempting to perform @@ -6244,7 +6241,7 @@ ahc_rem_wscb(struct ahc_softc *ahc, u_int scbpos, u_int prev) ahc_outb(ahc, SCSISEQ, (ahc_inb(ahc, SCSISEQ) & ~ENSELO)); } else { /* - * Select the scb that pointed to us + * Select the scb that pointed to us * and update its next pointer. */ ahc_outb(ahc, SCBPTR, prev); @@ -6638,7 +6635,7 @@ ahc_calc_residual(struct ahc_softc *ahc, struct scb *scb) /* * Remainder of the SG where the transfer - * stopped. + * stopped. */ resid = ahc_le32toh(spkt->residual_datacnt) & AHC_SG_LEN_MASK; sg = ahc_sg_bus_to_virt(scb, resid_sgptr & SG_PTR_MASK); @@ -6857,7 +6854,7 @@ ahc_loadseq(struct ahc_softc *ahc) if (begin_set[cs_count] == TRUE && end_set[cs_count] == FALSE) { cs_table[cs_count].end = downloaded; - end_set[cs_count] = TRUE; + end_set[cs_count] = TRUE; cs_count++; } continue; @@ -7085,7 +7082,6 @@ ahc_print_register(const ahc_reg_parse_entry_t *table, u_int num_entries, printed_mask == 0 ? ":(" : "|", table[entry].name); printed_mask |= table[entry].mask; - break; } if (entry >= num_entries) @@ -7199,7 +7195,7 @@ ahc_dump_card_state(struct ahc_softc *ahc) scb_index = ahc_inb(ahc, SCB_NEXT); } printk("\n"); - + ahc_sync_qoutfifo(ahc, BUS_DMASYNC_POSTREAD); printk("QOUTFIFO entries: "); qoutpos = ahc->qoutfifonext; @@ -7376,7 +7372,7 @@ ahc_handle_en_lun(struct ahc_softc *ahc, struct cam_sim *sim, union ccb *ccb) if ((ahc->features & AHC_MULTIROLE) != 0) { if ((ahc->features & AHC_MULTI_TID) != 0 - && (ahc->flags & AHC_INITIATORROLE) != 0) { + && (ahc->flags & AHC_INITIATORROLE) != 0) { /* * Only allow additional targets if * the initiator role is disabled. @@ -7527,7 +7523,6 @@ ahc_handle_en_lun(struct ahc_softc *ahc, struct cam_sim *sim, union ccb *ccb) targid_mask |= target_mask; ahc_outb(ahc, TARGID, targid_mask); ahc_outb(ahc, TARGID+1, (targid_mask >> 8)); - ahc_update_scsiid(ahc, targid_mask); } else { u_int our_id; @@ -7592,7 +7587,7 @@ ahc_handle_en_lun(struct ahc_softc *ahc, struct cam_sim *sim, union ccb *ccb) } ahc_lock(ahc, &s); - + ccb->ccb_h.status = CAM_REQ_CMP; LIST_FOREACH(scb, &ahc->pending_scbs, pending_links) { struct ccb_hdr *ccbh; @@ -7651,7 +7646,7 @@ ahc_handle_en_lun(struct ahc_softc *ahc, struct cam_sim *sim, union ccb *ccb) targid_mask &= ~target_mask; ahc_outb(ahc, TARGID, targid_mask); ahc_outb(ahc, TARGID+1, - (targid_mask >> 8)); + (targid_mask >> 8)); ahc_update_scsiid(ahc, targid_mask); } } @@ -7780,7 +7775,7 @@ ahc_run_tqinfifo(struct ahc_softc *ahc, int paused) ahc_outb(ahc, HS_MAILBOX, hs_mailbox); } else { if (!paused) - ahc_pause(ahc); + ahc_pause(ahc); ahc_outb(ahc, KERNEL_TQINPOS, ahc->tqinfifonext & HOST_TQINPOS); if (!paused) @@ -7879,7 +7874,7 @@ ahc_handle_target_cmd(struct ahc_softc *ahc, struct target_cmd *cmd) printk("Reserved or VU command code type encountered\n"); break; } - + memcpy(atio->cdb_io.cdb_bytes, byte, atio->cdb_len); atio->ccb_h.status |= CAM_CDB_RECVD; |