aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/aic7xxx/aic79xx_inline.h
diff options
context:
space:
mode:
authorHannes Reinecke <hare@suse.de>2006-01-12 06:05:46 -0500
committerJames Bottomley <jejb@mulgrave.(none)>2006-01-12 13:00:34 -0500
commit66a0683e4620f087e41e79d4d2be6c5a06bb206b (patch)
tree09f5b125da1bda61a582212f6ca1b2265f5b34f5 /drivers/scsi/aic7xxx/aic79xx_inline.h
parent5e46631b04382ef14255467288052f29cb77daeb (diff)
[SCSI] aic79xx: Use struct map_node
Use struct map_node instead of separate variables. Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/aic7xxx/aic79xx_inline.h')
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_inline.h34
1 files changed, 24 insertions, 10 deletions
diff --git a/drivers/scsi/aic7xxx/aic79xx_inline.h b/drivers/scsi/aic7xxx/aic79xx_inline.h
index d80bc5161fb1..2b7ff989f3d1 100644
--- a/drivers/scsi/aic7xxx/aic79xx_inline.h
+++ b/drivers/scsi/aic7xxx/aic79xx_inline.h
@@ -37,7 +37,7 @@
37 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 37 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38 * POSSIBILITY OF SUCH DAMAGES. 38 * POSSIBILITY OF SUCH DAMAGES.
39 * 39 *
40 * $Id: //depot/aic7xxx/aic7xxx/aic79xx_inline.h#51 $ 40 * $Id: //depot/aic7xxx/aic7xxx/aic79xx_inline.h#58 $
41 * 41 *
42 * $FreeBSD$ 42 * $FreeBSD$
43 */ 43 */
@@ -522,12 +522,21 @@ do { \
522static __inline uint16_t 522static __inline uint16_t
523ahd_inw(struct ahd_softc *ahd, u_int port) 523ahd_inw(struct ahd_softc *ahd, u_int port)
524{ 524{
525 /*
526 * Read high byte first as some registers increment
527 * or have other side effects when the low byte is
528 * read.
529 */
525 return ((ahd_inb(ahd, port+1) << 8) | ahd_inb(ahd, port)); 530 return ((ahd_inb(ahd, port+1) << 8) | ahd_inb(ahd, port));
526} 531}
527 532
528static __inline void 533static __inline void
529ahd_outw(struct ahd_softc *ahd, u_int port, u_int value) 534ahd_outw(struct ahd_softc *ahd, u_int port, u_int value)
530{ 535{
536 /*
537 * Write low byte first to accomodate registers
538 * such as PRGMCNT where the order maters.
539 */
531 ahd_outb(ahd, port, value & 0xFF); 540 ahd_outb(ahd, port, value & 0xFF);
532 ahd_outb(ahd, port+1, (value >> 8) & 0xFF); 541 ahd_outb(ahd, port+1, (value >> 8) & 0xFF);
533} 542}
@@ -684,7 +693,7 @@ ahd_inb_scbram(struct ahd_softc *ahd, u_int offset)
684 * Razor #528 693 * Razor #528
685 */ 694 */
686 value = ahd_inb(ahd, offset); 695 value = ahd_inb(ahd, offset);
687 if ((ahd->flags & AHD_PCIX_SCBRAM_RD_BUG) != 0) 696 if ((ahd->bugs & AHD_PCIX_SCBRAM_RD_BUG) != 0)
688 ahd_inb(ahd, MODE_PTR); 697 ahd_inb(ahd, MODE_PTR);
689 return (value); 698 return (value);
690} 699}
@@ -727,7 +736,8 @@ ahd_lookup_scb(struct ahd_softc *ahd, u_int tag)
727static __inline void 736static __inline void
728ahd_swap_with_next_hscb(struct ahd_softc *ahd, struct scb *scb) 737ahd_swap_with_next_hscb(struct ahd_softc *ahd, struct scb *scb)
729{ 738{
730 struct hardware_scb *q_hscb; 739 struct hardware_scb *q_hscb;
740 struct map_node *q_hscb_map;
731 uint32_t saved_hscb_busaddr; 741 uint32_t saved_hscb_busaddr;
732 742
733 /* 743 /*
@@ -743,6 +753,7 @@ ahd_swap_with_next_hscb(struct ahd_softc *ahd, struct scb *scb)
743 * locate the correct SCB by SCB_TAG. 753 * locate the correct SCB by SCB_TAG.
744 */ 754 */
745 q_hscb = ahd->next_queued_hscb; 755 q_hscb = ahd->next_queued_hscb;
756 q_hscb_map = ahd->next_queued_hscb_map;
746 saved_hscb_busaddr = q_hscb->hscb_busaddr; 757 saved_hscb_busaddr = q_hscb->hscb_busaddr;
747 memcpy(q_hscb, scb->hscb, sizeof(*scb->hscb)); 758 memcpy(q_hscb, scb->hscb, sizeof(*scb->hscb));
748 q_hscb->hscb_busaddr = saved_hscb_busaddr; 759 q_hscb->hscb_busaddr = saved_hscb_busaddr;
@@ -750,7 +761,9 @@ ahd_swap_with_next_hscb(struct ahd_softc *ahd, struct scb *scb)
750 761
751 /* Now swap HSCB pointers. */ 762 /* Now swap HSCB pointers. */
752 ahd->next_queued_hscb = scb->hscb; 763 ahd->next_queued_hscb = scb->hscb;
764 ahd->next_queued_hscb_map = scb->hscb_map;
753 scb->hscb = q_hscb; 765 scb->hscb = q_hscb;
766 scb->hscb_map = q_hscb_map;
754 767
755 /* Now define the mapping from tag to SCB in the scbindex */ 768 /* Now define the mapping from tag to SCB in the scbindex */
756 ahd->scb_data.scbindex[SCB_GET_TAG(scb)] = scb; 769 ahd->scb_data.scbindex[SCB_GET_TAG(scb)] = scb;
@@ -824,8 +837,9 @@ static __inline int ahd_intr(struct ahd_softc *ahd);
824static __inline void 837static __inline void
825ahd_sync_qoutfifo(struct ahd_softc *ahd, int op) 838ahd_sync_qoutfifo(struct ahd_softc *ahd, int op)
826{ 839{
827 ahd_dmamap_sync(ahd, ahd->shared_data_dmat, ahd->shared_data_dmamap, 840 ahd_dmamap_sync(ahd, ahd->shared_data_dmat, ahd->shared_data_map.dmamap,
828 /*offset*/0, /*len*/AHC_SCB_MAX * sizeof(uint16_t), op); 841 /*offset*/0,
842 /*len*/AHD_SCB_MAX * sizeof(uint16_t), op);
829} 843}
830 844
831static __inline void 845static __inline void
@@ -834,7 +848,7 @@ ahd_sync_tqinfifo(struct ahd_softc *ahd, int op)
834#ifdef AHD_TARGET_MODE 848#ifdef AHD_TARGET_MODE
835 if ((ahd->flags & AHD_TARGETROLE) != 0) { 849 if ((ahd->flags & AHD_TARGETROLE) != 0) {
836 ahd_dmamap_sync(ahd, ahd->shared_data_dmat, 850 ahd_dmamap_sync(ahd, ahd->shared_data_dmat,
837 ahd->shared_data_dmamap, 851 ahd->shared_data_map.dmamap,
838 ahd_targetcmd_offset(ahd, 0), 852 ahd_targetcmd_offset(ahd, 0),
839 sizeof(struct target_cmd) * AHD_TMODE_CMDS, 853 sizeof(struct target_cmd) * AHD_TMODE_CMDS,
840 op); 854 op);
@@ -854,9 +868,9 @@ ahd_check_cmdcmpltqueues(struct ahd_softc *ahd)
854 u_int retval; 868 u_int retval;
855 869
856 retval = 0; 870 retval = 0;
857 ahd_dmamap_sync(ahd, ahd->shared_data_dmat, ahd->shared_data_dmamap, 871 ahd_dmamap_sync(ahd, ahd->shared_data_dmat, ahd->shared_data_map.dmamap,
858 /*offset*/ahd->qoutfifonext, /*len*/2, 872 /*offset*/ahd->qoutfifonext * sizeof(*ahd->qoutfifo),
859 BUS_DMASYNC_POSTREAD); 873 /*len*/sizeof(*ahd->qoutfifo), BUS_DMASYNC_POSTREAD);
860 if ((ahd->qoutfifo[ahd->qoutfifonext] 874 if ((ahd->qoutfifo[ahd->qoutfifonext]
861 & QOUTFIFO_ENTRY_VALID_LE) == ahd->qoutfifonext_valid_tag) 875 & QOUTFIFO_ENTRY_VALID_LE) == ahd->qoutfifonext_valid_tag)
862 retval |= AHD_RUN_QOUTFIFO; 876 retval |= AHD_RUN_QOUTFIFO;
@@ -864,7 +878,7 @@ ahd_check_cmdcmpltqueues(struct ahd_softc *ahd)
864 if ((ahd->flags & AHD_TARGETROLE) != 0 878 if ((ahd->flags & AHD_TARGETROLE) != 0
865 && (ahd->flags & AHD_TQINFIFO_BLOCKED) == 0) { 879 && (ahd->flags & AHD_TQINFIFO_BLOCKED) == 0) {
866 ahd_dmamap_sync(ahd, ahd->shared_data_dmat, 880 ahd_dmamap_sync(ahd, ahd->shared_data_dmat,
867 ahd->shared_data_dmamap, 881 ahd->shared_data_map.dmamap,
868 ahd_targetcmd_offset(ahd, ahd->tqinfifofnext), 882 ahd_targetcmd_offset(ahd, ahd->tqinfifofnext),
869 /*len*/sizeof(struct target_cmd), 883 /*len*/sizeof(struct target_cmd),
870 BUS_DMASYNC_POSTREAD); 884 BUS_DMASYNC_POSTREAD);