diff options
author | Hannes Reinecke <hare@suse.de> | 2006-01-12 06:07:02 -0500 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.(none)> | 2006-01-12 13:01:09 -0500 |
commit | ba62cd2d01e401faa5d5a25fa8e990d0b1a1996a (patch) | |
tree | 46d2c35635f74fb74ebfd8b146e15525c151a075 /drivers/scsi | |
parent | 66a0683e4620f087e41e79d4d2be6c5a06bb206b (diff) |
[SCSI] aic79xx: Sanitize inb/outb handling
This patch coalesces inb/outb calls to the approriate word or long form.
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/aic7xxx/aic79xx_core.c | 80 |
1 files changed, 21 insertions, 59 deletions
diff --git a/drivers/scsi/aic7xxx/aic79xx_core.c b/drivers/scsi/aic7xxx/aic79xx_core.c index 55c44bf54050..35b51e1979f5 100644 --- a/drivers/scsi/aic7xxx/aic79xx_core.c +++ b/drivers/scsi/aic7xxx/aic79xx_core.c | |||
@@ -387,8 +387,7 @@ ahd_flush_qoutfifo(struct ahd_softc *ahd) | |||
387 | u_int fifo_mode; | 387 | u_int fifo_mode; |
388 | u_int i; | 388 | u_int i; |
389 | 389 | ||
390 | scbid = (ahd_inb(ahd, GSFIFO+1) << 8) | 390 | scbid = ahd_inw(ahd, GSFIFO); |
391 | | ahd_inb(ahd, GSFIFO); | ||
392 | scb = ahd_lookup_scb(ahd, scbid); | 391 | scb = ahd_lookup_scb(ahd, scbid); |
393 | if (scb == NULL) { | 392 | if (scb == NULL) { |
394 | printf("%s: Warning - GSFIFO SCB %d invalid\n", | 393 | printf("%s: Warning - GSFIFO SCB %d invalid\n", |
@@ -748,7 +747,7 @@ ahd_run_data_fifo(struct ahd_softc *ahd, struct scb *scb) | |||
748 | * Advertise the segment to the hardware. | 747 | * Advertise the segment to the hardware. |
749 | */ | 748 | */ |
750 | dfcntrl = ahd_inb(ahd, DFCNTRL)|PRELOADEN|HDMAEN; | 749 | dfcntrl = ahd_inb(ahd, DFCNTRL)|PRELOADEN|HDMAEN; |
751 | if ((ahd->features & AHD_NEW_DFCNTRL_OPTS)!=0) { | 750 | if ((ahd->features & AHD_NEW_DFCNTRL_OPTS) != 0) { |
752 | /* | 751 | /* |
753 | * Use SCSIENWRDIS so that SCSIEN | 752 | * Use SCSIENWRDIS so that SCSIEN |
754 | * is never modified by this | 753 | * is never modified by this |
@@ -1060,7 +1059,7 @@ ahd_handle_seqint(struct ahd_softc *ahd, u_int intstat) | |||
1060 | ahd_outb(ahd, SAVED_LUN, 0); | 1059 | ahd_outb(ahd, SAVED_LUN, 0); |
1061 | ahd_outb(ahd, SEQ_FLAGS, 0); | 1060 | ahd_outb(ahd, SEQ_FLAGS, 0); |
1062 | ahd_assert_atn(ahd); | 1061 | ahd_assert_atn(ahd); |
1063 | scb->flags &= ~(SCB_PACKETIZED); | 1062 | scb->flags &= ~SCB_PACKETIZED; |
1064 | scb->flags |= SCB_ABORT|SCB_CMDPHASE_ABORT; | 1063 | scb->flags |= SCB_ABORT|SCB_CMDPHASE_ABORT; |
1065 | ahd_freeze_devq(ahd, scb); | 1064 | ahd_freeze_devq(ahd, scb); |
1066 | ahd_set_transaction_status(scb, CAM_REQUEUE_REQ); | 1065 | ahd_set_transaction_status(scb, CAM_REQUEUE_REQ); |
@@ -2310,8 +2309,7 @@ ahd_handle_nonpkt_busfree(struct ahd_softc *ahd) | |||
2310 | "PRGMCNT == 0x%x\n", | 2309 | "PRGMCNT == 0x%x\n", |
2311 | ahd_lookup_phase_entry(lastphase)->phasemsg, | 2310 | ahd_lookup_phase_entry(lastphase)->phasemsg, |
2312 | aborted, | 2311 | aborted, |
2313 | ahd_inb(ahd, PRGMCNT) | 2312 | ahd_inw(ahd, PRGMCNT)); |
2314 | | (ahd_inb(ahd, PRGMCNT+1) << 8)); | ||
2315 | ahd_dump_card_state(ahd); | 2313 | ahd_dump_card_state(ahd); |
2316 | } | 2314 | } |
2317 | /* Always restart the sequencer. */ | 2315 | /* Always restart the sequencer. */ |
@@ -2474,8 +2472,7 @@ ahd_clear_critical_section(struct ahd_softc *ahd) | |||
2474 | u_int i; | 2472 | u_int i; |
2475 | 2473 | ||
2476 | ahd_set_modes(ahd, AHD_MODE_SCSI, AHD_MODE_SCSI); | 2474 | ahd_set_modes(ahd, AHD_MODE_SCSI, AHD_MODE_SCSI); |
2477 | seqaddr = ahd_inb(ahd, CURADDR) | 2475 | seqaddr = ahd_inw(ahd, CURADDR); |
2478 | | (ahd_inb(ahd, CURADDR+1) << 8); | ||
2479 | 2476 | ||
2480 | cs = ahd->critical_sections; | 2477 | cs = ahd->critical_sections; |
2481 | for (i = 0; i < ahd->num_critical_sections; i++, cs++) { | 2478 | for (i = 0; i < ahd->num_critical_sections; i++, cs++) { |
@@ -4909,10 +4906,7 @@ ahd_reinitialize_dataptrs(struct ahd_softc *ahd) | |||
4909 | * Determine initial values for data_addr and data_cnt | 4906 | * Determine initial values for data_addr and data_cnt |
4910 | * for resuming the data phase. | 4907 | * for resuming the data phase. |
4911 | */ | 4908 | */ |
4912 | sgptr = (ahd_inb_scbram(ahd, SCB_RESIDUAL_SGPTR + 3) << 24) | 4909 | sgptr = ahd_inl_scbram(ahd, SCB_RESIDUAL_SGPTR); |
4913 | | (ahd_inb_scbram(ahd, SCB_RESIDUAL_SGPTR + 2) << 16) | ||
4914 | | (ahd_inb_scbram(ahd, SCB_RESIDUAL_SGPTR + 1) << 8) | ||
4915 | | ahd_inb_scbram(ahd, SCB_RESIDUAL_SGPTR); | ||
4916 | sgptr &= SG_PTR_MASK; | 4910 | sgptr &= SG_PTR_MASK; |
4917 | 4911 | ||
4918 | resid = (ahd_inb_scbram(ahd, SCB_RESIDUAL_DATACNT + 2) << 16) | 4912 | resid = (ahd_inb_scbram(ahd, SCB_RESIDUAL_DATACNT + 2) << 16) |
@@ -4930,10 +4924,7 @@ ahd_reinitialize_dataptrs(struct ahd_softc *ahd) | |||
4930 | dataptr = ahd_le64toh(sg->addr) | 4924 | dataptr = ahd_le64toh(sg->addr) |
4931 | + (ahd_le32toh(sg->len) & AHD_SG_LEN_MASK) | 4925 | + (ahd_le32toh(sg->len) & AHD_SG_LEN_MASK) |
4932 | - resid; | 4926 | - resid; |
4933 | ahd_outb(ahd, HADDR + 7, dataptr >> 56); | 4927 | ahd_outl(ahd, HADDR + 4, dataptr >> 32); |
4934 | ahd_outb(ahd, HADDR + 6, dataptr >> 48); | ||
4935 | ahd_outb(ahd, HADDR + 5, dataptr >> 40); | ||
4936 | ahd_outb(ahd, HADDR + 4, dataptr >> 32); | ||
4937 | } else { | 4928 | } else { |
4938 | struct ahd_dma_seg *sg; | 4929 | struct ahd_dma_seg *sg; |
4939 | 4930 | ||
@@ -4948,10 +4939,7 @@ ahd_reinitialize_dataptrs(struct ahd_softc *ahd) | |||
4948 | ahd_outb(ahd, HADDR + 4, | 4939 | ahd_outb(ahd, HADDR + 4, |
4949 | (ahd_le32toh(sg->len) & ~AHD_SG_LEN_MASK) >> 24); | 4940 | (ahd_le32toh(sg->len) & ~AHD_SG_LEN_MASK) >> 24); |
4950 | } | 4941 | } |
4951 | ahd_outb(ahd, HADDR + 3, dataptr >> 24); | 4942 | ahd_outl(ahd, HADDR, dataptr); |
4952 | ahd_outb(ahd, HADDR + 2, dataptr >> 16); | ||
4953 | ahd_outb(ahd, HADDR + 1, dataptr >> 8); | ||
4954 | ahd_outb(ahd, HADDR, dataptr); | ||
4955 | ahd_outb(ahd, HCNT + 2, resid >> 16); | 4943 | ahd_outb(ahd, HCNT + 2, resid >> 16); |
4956 | ahd_outb(ahd, HCNT + 1, resid >> 8); | 4944 | ahd_outb(ahd, HCNT + 1, resid >> 8); |
4957 | ahd_outb(ahd, HCNT, resid); | 4945 | ahd_outb(ahd, HCNT, resid); |
@@ -6567,14 +6555,8 @@ ahd_chip_init(struct ahd_softc *ahd) | |||
6567 | * Tell the sequencer where it can find our arrays in memory. | 6555 | * Tell the sequencer where it can find our arrays in memory. |
6568 | */ | 6556 | */ |
6569 | busaddr = ahd->shared_data_map.physaddr; | 6557 | busaddr = ahd->shared_data_map.physaddr; |
6570 | ahd_outb(ahd, SHARED_DATA_ADDR, busaddr & 0xFF); | 6558 | ahd_outl(ahd, SHARED_DATA_ADDR, busaddr); |
6571 | ahd_outb(ahd, SHARED_DATA_ADDR + 1, (busaddr >> 8) & 0xFF); | 6559 | ahd_outl(ahd, QOUTFIFO_NEXT_ADDR, busaddr); |
6572 | ahd_outb(ahd, SHARED_DATA_ADDR + 2, (busaddr >> 16) & 0xFF); | ||
6573 | ahd_outb(ahd, SHARED_DATA_ADDR + 3, (busaddr >> 24) & 0xFF); | ||
6574 | ahd_outb(ahd, QOUTFIFO_NEXT_ADDR, busaddr & 0xFF); | ||
6575 | ahd_outb(ahd, QOUTFIFO_NEXT_ADDR + 1, (busaddr >> 8) & 0xFF); | ||
6576 | ahd_outb(ahd, QOUTFIFO_NEXT_ADDR + 2, (busaddr >> 16) & 0xFF); | ||
6577 | ahd_outb(ahd, QOUTFIFO_NEXT_ADDR + 3, (busaddr >> 24) & 0xFF); | ||
6578 | 6560 | ||
6579 | /* | 6561 | /* |
6580 | * Setup the allowed SCSI Sequences based on operational mode. | 6562 | * Setup the allowed SCSI Sequences based on operational mode. |
@@ -6623,10 +6605,7 @@ ahd_chip_init(struct ahd_softc *ahd) | |||
6623 | * Tell the sequencer which SCB will be the next one it receives. | 6605 | * Tell the sequencer which SCB will be the next one it receives. |
6624 | */ | 6606 | */ |
6625 | busaddr = ahd_le32toh(ahd->next_queued_hscb->hscb_busaddr); | 6607 | busaddr = ahd_le32toh(ahd->next_queued_hscb->hscb_busaddr); |
6626 | ahd_outb(ahd, NEXT_QUEUED_SCB_ADDR + 0, busaddr & 0xFF); | 6608 | ahd_outl(ahd, NEXT_QUEUED_SCB_ADDR, busaddr); |
6627 | ahd_outb(ahd, NEXT_QUEUED_SCB_ADDR + 1, (busaddr >> 8) & 0xFF); | ||
6628 | ahd_outb(ahd, NEXT_QUEUED_SCB_ADDR + 2, (busaddr >> 16) & 0xFF); | ||
6629 | ahd_outb(ahd, NEXT_QUEUED_SCB_ADDR + 3, (busaddr >> 24) & 0xFF); | ||
6630 | 6609 | ||
6631 | /* | 6610 | /* |
6632 | * Default to coalescing disabled. | 6611 | * Default to coalescing disabled. |
@@ -7159,10 +7138,7 @@ ahd_qinfifo_requeue(struct ahd_softc *ahd, struct scb *prev_scb, | |||
7159 | uint32_t busaddr; | 7138 | uint32_t busaddr; |
7160 | 7139 | ||
7161 | busaddr = ahd_le32toh(scb->hscb->hscb_busaddr); | 7140 | busaddr = ahd_le32toh(scb->hscb->hscb_busaddr); |
7162 | ahd_outb(ahd, NEXT_QUEUED_SCB_ADDR + 0, busaddr & 0xFF); | 7141 | ahd_outl(ahd, NEXT_QUEUED_SCB_ADDR, busaddr); |
7163 | ahd_outb(ahd, NEXT_QUEUED_SCB_ADDR + 1, (busaddr >> 8) & 0xFF); | ||
7164 | ahd_outb(ahd, NEXT_QUEUED_SCB_ADDR + 2, (busaddr >> 16) & 0xFF); | ||
7165 | ahd_outb(ahd, NEXT_QUEUED_SCB_ADDR + 3, (busaddr >> 24) & 0xFF); | ||
7166 | } else { | 7142 | } else { |
7167 | prev_scb->hscb->next_hscb_busaddr = scb->hscb->hscb_busaddr; | 7143 | prev_scb->hscb->next_hscb_busaddr = scb->hscb->hscb_busaddr; |
7168 | ahd_sync_scb(ahd, prev_scb, | 7144 | ahd_sync_scb(ahd, prev_scb, |
@@ -7269,10 +7245,7 @@ ahd_search_qinfifo(struct ahd_softc *ahd, int target, char channel, | |||
7269 | */ | 7245 | */ |
7270 | ahd->qinfifonext = qinstart; | 7246 | ahd->qinfifonext = qinstart; |
7271 | busaddr = ahd_le32toh(ahd->next_queued_hscb->hscb_busaddr); | 7247 | busaddr = ahd_le32toh(ahd->next_queued_hscb->hscb_busaddr); |
7272 | ahd_outb(ahd, NEXT_QUEUED_SCB_ADDR + 0, busaddr & 0xFF); | 7248 | ahd_outl(ahd, NEXT_QUEUED_SCB_ADDR, busaddr); |
7273 | ahd_outb(ahd, NEXT_QUEUED_SCB_ADDR + 1, (busaddr >> 8) & 0xFF); | ||
7274 | ahd_outb(ahd, NEXT_QUEUED_SCB_ADDR + 2, (busaddr >> 16) & 0xFF); | ||
7275 | ahd_outb(ahd, NEXT_QUEUED_SCB_ADDR + 3, (busaddr >> 24) & 0xFF); | ||
7276 | 7249 | ||
7277 | while (qinpos != qintail) { | 7250 | while (qinpos != qintail) { |
7278 | scb = ahd_lookup_scb(ahd, ahd->qinfifo[qinpos]); | 7251 | scb = ahd_lookup_scb(ahd, ahd->qinfifo[qinpos]); |
@@ -7743,7 +7716,7 @@ ahd_reset_channel(struct ahd_softc *ahd, char channel, int initiate_reset) | |||
7743 | */ | 7716 | */ |
7744 | ahd_clear_msg_state(ahd); | 7717 | ahd_clear_msg_state(ahd); |
7745 | ahd_outb(ahd, SIMODE1, | 7718 | ahd_outb(ahd, SIMODE1, |
7746 | ahd_inb(ahd, SIMODE1) & ~(ENBUSFREE|ENSCSIRST|ENBUSFREE)); | 7719 | ahd_inb(ahd, SIMODE1) & ~(ENBUSFREE|ENSCSIRST)); |
7747 | 7720 | ||
7748 | if (initiate_reset) | 7721 | if (initiate_reset) |
7749 | ahd_reset_current_bus(ahd); | 7722 | ahd_reset_current_bus(ahd); |
@@ -8321,8 +8294,7 @@ ahd_dumpseq(struct ahd_softc* ahd) | |||
8321 | max_prog = 2048; | 8294 | max_prog = 2048; |
8322 | 8295 | ||
8323 | ahd_outb(ahd, SEQCTL0, PERRORDIS|FAILDIS|FASTMODE|LOADRAM); | 8296 | ahd_outb(ahd, SEQCTL0, PERRORDIS|FAILDIS|FASTMODE|LOADRAM); |
8324 | ahd_outb(ahd, PRGMCNT, 0); | 8297 | ahd_outw(ahd, PRGMCNT, 0); |
8325 | ahd_outb(ahd, PRGMCNT+1, 0); | ||
8326 | for (i = 0; i < max_prog; i++) { | 8298 | for (i = 0; i < max_prog; i++) { |
8327 | uint8_t ins_bytes[4]; | 8299 | uint8_t ins_bytes[4]; |
8328 | 8300 | ||
@@ -8437,8 +8409,7 @@ ahd_loadseq(struct ahd_softc *ahd) | |||
8437 | downloaded = 0; | 8409 | downloaded = 0; |
8438 | skip_addr = 0; | 8410 | skip_addr = 0; |
8439 | ahd_outb(ahd, SEQCTL0, PERRORDIS|FAILDIS|FASTMODE|LOADRAM); | 8411 | ahd_outb(ahd, SEQCTL0, PERRORDIS|FAILDIS|FASTMODE|LOADRAM); |
8440 | ahd_outb(ahd, PRGMCNT, 0); | 8412 | ahd_outw(ahd, PRGMCNT, 0); |
8441 | ahd_outb(ahd, PRGMCNT+1, 0); | ||
8442 | 8413 | ||
8443 | for (i = 0; i < sizeof(seqprog)/4; i++) { | 8414 | for (i = 0; i < sizeof(seqprog)/4; i++) { |
8444 | if (ahd_check_patch(ahd, &cur_patch, i, &skip_addr) == 0) { | 8415 | if (ahd_check_patch(ahd, &cur_patch, i, &skip_addr) == 0) { |
@@ -8731,7 +8702,7 @@ ahd_dump_card_state(struct ahd_softc *ahd) | |||
8731 | printf(">>>>>>>>>>>>>>>>>> Dump Card State Begins <<<<<<<<<<<<<<<<<\n" | 8702 | printf(">>>>>>>>>>>>>>>>>> Dump Card State Begins <<<<<<<<<<<<<<<<<\n" |
8732 | "%s: Dumping Card State at program address 0x%x Mode 0x%x\n", | 8703 | "%s: Dumping Card State at program address 0x%x Mode 0x%x\n", |
8733 | ahd_name(ahd), | 8704 | ahd_name(ahd), |
8734 | ahd_inb(ahd, CURADDR) | (ahd_inb(ahd, CURADDR+1) << 8), | 8705 | ahd_inw(ahd, CURADDR), |
8735 | ahd_build_mode_state(ahd, ahd->saved_src_mode, | 8706 | ahd_build_mode_state(ahd, ahd->saved_src_mode, |
8736 | ahd->saved_dst_mode)); | 8707 | ahd->saved_dst_mode)); |
8737 | if (paused) | 8708 | if (paused) |
@@ -9427,13 +9398,9 @@ ahd_handle_en_lun(struct ahd_softc *ahd, struct cam_sim *sim, union ccb *ccb) | |||
9427 | if ((ahd->features & AHD_MULTI_TID) != 0) { | 9398 | if ((ahd->features & AHD_MULTI_TID) != 0) { |
9428 | u_int targid_mask; | 9399 | u_int targid_mask; |
9429 | 9400 | ||
9430 | targid_mask = ahd_inb(ahd, TARGID) | 9401 | targid_mask = ahd_inw(ahd, TARGID); |
9431 | | (ahd_inb(ahd, TARGID + 1) << 8); | ||
9432 | |||
9433 | targid_mask |= target_mask; | 9402 | targid_mask |= target_mask; |
9434 | ahd_outb(ahd, TARGID, targid_mask); | 9403 | ahd_outw(ahd, TARGID, targid_mask); |
9435 | ahd_outb(ahd, TARGID+1, (targid_mask >> 8)); | ||
9436 | |||
9437 | ahd_update_scsiid(ahd, targid_mask); | 9404 | ahd_update_scsiid(ahd, targid_mask); |
9438 | } else { | 9405 | } else { |
9439 | u_int our_id; | 9406 | u_int our_id; |
@@ -9547,14 +9514,9 @@ ahd_handle_en_lun(struct ahd_softc *ahd, struct cam_sim *sim, union ccb *ccb) | |||
9547 | if (ahd->features & AHD_MULTI_TID) { | 9514 | if (ahd->features & AHD_MULTI_TID) { |
9548 | u_int targid_mask; | 9515 | u_int targid_mask; |
9549 | 9516 | ||
9550 | targid_mask = ahd_inb(ahd, TARGID) | 9517 | targid_mask = ahd_inw(ahd, TARGID); |
9551 | | (ahd_inb(ahd, TARGID + 1) | ||
9552 | << 8); | ||
9553 | |||
9554 | targid_mask &= ~target_mask; | 9518 | targid_mask &= ~target_mask; |
9555 | ahd_outb(ahd, TARGID, targid_mask); | 9519 | ahd_outw(ahd, TARGID, targid_mask); |
9556 | ahd_outb(ahd, TARGID+1, | ||
9557 | (targid_mask >> 8)); | ||
9558 | ahd_update_scsiid(ahd, targid_mask); | 9520 | ahd_update_scsiid(ahd, targid_mask); |
9559 | } | 9521 | } |
9560 | } | 9522 | } |