Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Craig Tierney <ctierney@hpti.com>
To: axp-list@redhat.com
Subject: Re: i386 drivers on alpha ?
Date: Sat, 21 Jul 2001 11:30:40 -0600	[thread overview]
Message-ID: <20010721113040.E25353@hpti.com> (raw)
In-Reply-To: <ILELJNLMEDBLJDLBCJKMOEBFCBAA.ppetrakis@alphalinux.org>; from ppetrakis@alphalinux.org on Fri, Jul 20, 2001 at 05:46:13PM -0400

...discussion about patching Qlogic's FC driver deleted.

Below is my patch.  My strategy was to find the variables
that are really dma_addr_t types, redefine those variables using that
and get rid of the #ifdefs.  Then I replaced all BITS_PER_LONG with DMA_ADDR_SIZE 
and defined DMA_ADDR_SIZE to be the correct size of dma_addr_t.

Disclaimer.  I don't claim what I did is correct, I just know that I can
get it to work reliably by doing this.

This patch is against qla2x00src-4.27Beta.tgz.

Craig

diff -urN qla2x00-4.27Beta-clean/qla2x00.c qla2x00-4.27Beta/qla2x00.c
--- qla2x00-4.27Beta-clean/qla2x00.c    Tue Apr 17 01:40:30 2001
+++ qla2x00-4.27Beta/qla2x00.c  Sat Jul 21 17:25:39 2001
@@ -395,7 +395,7 @@
 #define  QLA2100_DELAY(sec)  mdelay(sec * HZ)

 /* 4.10 */
-#if  BITS_PER_LONG > 32
+#if  DMA_BITS_SIZE > 32
 #define pci_dma_lo32(a) (a & 0xffffffff)
 #define pci_dma_hi32(a) ((a >> 32) & 0xffffffff)
 #else
@@ -405,7 +405,7 @@

 #define  VIRT_TO_BUS(a) virt_to_bus((a))

-#if  BITS_PER_LONG <= 32
+#if  DMA_BITS_SIZE <= 32
 #define  VIRT_TO_BUS_LOW(a) (uint32_t)virt_to_bus(((void *)a))
 #define  VIRT_TO_BUS_HIGH(a) (uint32_t)(0x0)
 #else
@@ -418,7 +418,7 @@

 #define  STATIC

-#if  BITS_PER_LONG <= 32
+#if  DMA_BITS_SIZE <= 32
 #define  LS_64BITS(x) (uint32_t)((unsigned long)x)
 #define  MS_64BITS(x) (uint32_t)((unsigned long) 0x0)
 #else
@@ -426,7 +426,7 @@
 #define  MS_64BITS(x) (uint32_t)(0xffffffff & (((unsigned long)x)>>32) )
 #endif

-#if  BITS_PER_LONG <= 32
+#if  DMA_BITS_SIZE <= 32
 #define  MSB(x)          (uint8_t)(((uint16_t)(x) >> 8) & 0xff)
 #define  LSB(x)          (uint8_t)(x & 0xff)
 #define  MSW(x)          (uint16_t)(((uint32_t)(x) >> 16) & 0xffff)
@@ -1593,6 +1593,7 @@
 #else
         host->base = (u_long) ha->mmpbase;
 #endif
+        printk("qla2100: MAXCHANNELS = %d\n", maxchannels);
         host->max_channel = maxchannels;
         /* fix: 07/31 host->max_lun = MAX_LUNS-1; */
         host->max_lun = ha->max_luns;
@@ -4987,7 +4988,7 @@
 #if BITS_PER_LONG > 32
     /* Enable 64bit addressing for OS/System combination supporting it   */
     /* actual NVRAM bit is: nv->cntr_flags_1.enable_64bit_addressing     */
-    /* but we will ignore it and use BITS_PER_LONG macro to setup for    */
+    /* but we will ignore it and use DMA_BITS_SIZE macro to setup for    */
     /* 64 or 32 bit access of host memory in all x86/ia-64/Alpha systems */
     ha->flags.enable_64bit_addressing = 1;
 #else
@@ -4998,7 +4999,7 @@
         if (ha->flags.enable_64bit_addressing)
            printk("[[[ qla2x00: 64 Bit PCI Addressing Enabled ]]]\n");

-#if BITS_PER_LONG > 32
+#if DMA_BITS_SIZE > 32
            /* Update our PCI device dma_mask for full 64 bit mask */
            /* ha->pdev->dma_mask = (pci_dma_t) 0xffffffffffffffffull; */
            ha->pdev->dma_mask = 0xffffffffffffffff;
@@ -5227,10 +5228,10 @@
                 ha->flags.set_cache_line_size_1   = nv->host_p.set_cache_line_size_1;
                 ha->flags.enable_64bit_addressing = nv->host_p.enable_64bit_addressing;


-#if BITS_PER_LONG > 32
+#if DMA_BITS_SIZE > 32
     /* Enable 64bit addressing for OS/System combination supporting it   */
     /* actual NVRAM bit is: nv->cntr_flags_1.enable_64bit_addressing     */
-    /* but we will ignore it and use BITS_PER_LONG macro to setup for    */
+    /* but we will ignore it and use DMA_BITS_SIZE macro to setup for    */
     /* 64 or 32 bit access of host memory in all x86/ia-64/Alpha systems */
     ha->flags.enable_64bit_addressing = 1;
 #else
@@ -5241,7 +5242,7 @@
         if (ha->flags.enable_64bit_addressing)
            printk("[[[ qla2x00: 64 Bit PCI Addressing Enabled ]]]\n");

-#if BITS_PER_LONG > 32
+#if DMA_BITS_SIZE > 32
            /* Update our PCI device dma_mask for full 64 bit mask */
            ha->pdev->dma_mask = 0xffffffffffffffff;
 #endif
@@ -6198,11 +6199,7 @@
                 uint8_t     next_port_id[3];
                 uint8_t     host_port_id[3];
                 sns_data_t  *sns;
-#if BITS_PER_LONG > 32
-                uint64_t    phys_address = 0;
-#else
-                uint32_t    phys_address = 0;
-#endif
+                dma_addr_t   phys_address = 0;
                 uint16_t    mb[MAILBOX_REGISTER_COUNT];
                 uint8_t     use_gan = 1;
                 uint8_t     retry_count = 0;
@@ -6587,11 +6584,7 @@
         STATIC uint8_t qla2100_sns_get_name( scsi_qla_host_t *ha, device_data_t *device, uint8_t flag ) {
             uint8_t     lStatus = 0;
             uint16_t    wRetryCount;
-#if BITS_PER_LONG > 32
-            uint64_t    phys_address = 0;
-#else
-            uint32_t    phys_address = 0;
-#endif
+            dma_addr_t    phys_address = 0;
             uint16_t    mb[MAILBOX_REGISTER_COUNT];
             uint16_t    subCmd, response;
             sns_data_t  *sns;
@@ -6896,11 +6889,7 @@
             uint16_t mb[MAILBOX_REGISTER_COUNT];
             port_list_entry_t *gn_list, *port_entry;
             device_data_t device;
-#if BITS_PER_LONG > 32
-            uint64_t    phys_address = 0;
-#else
-            uint32_t    phys_address = 0;
-#endif
+            dma_addr_t    phys_address = 0;
             uint16_t i, size;
             uint16_t localdevices = 0;
             int retry_needed = 0;
diff -urN qla2x00-4.27Beta-clean/qla2x00.h qla2x00-4.27Beta/qla2x00.h
--- qla2x00-4.27Beta-clean/qla2x00.h    Mon Apr 16 23:56:47 2001
+++ qla2x00-4.27Beta/qla2x00.h  Sat Jul 21 17:24:47 2001
@@ -34,12 +34,18 @@
 #define ISP2200
 #endif

+#ifdef __alpha__
+#define DMA_BITS_SIZE 32
+#else
+#define DMA_BITS_SIZE BITS_PER_LONG
+#endif
+

 /*
  * Driver debug definitions.
  */
 /* #define QL_DEBUG_LEVEL_1 */      /* Output register accesses to COM1 */
-/* #define QL_DEBUG_LEVEL_2 */      /* Output error msgs to COM1 */
+/* #define QL_DEBUG_LEVEL_2  */     /* Output error msgs to COM1 */
 /* #define QL_DEBUG_LEVEL_3 */      /* Output function trace msgs to COM1 */
 /* #define QL_DEBUG_LEVEL_4 */      /* Output NVRAM trace msgs to COM1 */
 /* #define QL_DEBUG_LEVEL_5 */      /* Output ring trace msgs to COM1 */
@@ -2180,21 +2186,15 @@
     /* Outstandings ISP commands. */
     srb_t           *outstanding_cmds[MAX_OUTSTANDING_COMMANDS];

-#if BITS_PER_LONG > 32
-    uint64_t        request_dma;        /* Physical address. */
-#else
-    uint32_t        request_dma;        /* Physical address. */
-#endif
+    dma_addr_t      request_dma;        /* Physical address */
+
     request_t       *request_ring;      /* Base virtual address */
     request_t       *request_ring_ptr;  /* Current address. */
     uint16_t        req_ring_index;     /* Current index. */
     uint16_t        req_q_cnt;          /* Number of available entries. */

-#if BITS_PER_LONG > 32
-    uint64_t        response_dma;       /* Physical address. */
-#else
-    uint32_t        response_dma;       /* Physical address. */
-#endif
+    dma_addr_t        response_dma;       /* Physical address. */
+
     response_t      *response_ring;     /* Base virtual address */
     response_t      *response_ring_ptr; /* Current address. */
     uint16_t        rsp_ring_index;     /* Current index. */
@@ -2235,11 +2235,7 @@
 #endif

     /* Firmware Initialization Control Block data */
-#if BITS_PER_LONG > 32
-    uint64_t        init_cb_dma;         /* Physical address. */
-#else
-    uint32_t        init_cb_dma;         /* Physical address. */
-#endif
+    dma_addr_t        init_cb_dma;         /* Physical address. */
     init_cb_t       *init_cb;

     /* Timeout timers. */
@@ -2344,11 +2340,8 @@
   uint8_t     IoctlPassThru_InProgress;
   uint8_t     IoctlPassFCCT_InProgress;
   void       *ioctl_mem;
-#if BITS_PER_LONG > 32
-  uint64_t      ioctl_mem_phys;
-#else
-  uint32_t      ioctl_mem_phys;
-#endif
+  dma_addr_t      ioctl_mem_phys;
+

   /* HBA serial number */
   uint8_t     serial0;




  reply	other threads:[~2001-07-21 17:30 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-20 18:46 i386 drivers on alpha ? Eugene Chu
2001-07-20 19:30 ` Craig Tierney
2001-07-20 20:21   ` 'Bryce'
2001-07-20 21:09     ` Craig Tierney
2001-07-20 21:38       ` Michal Jaegermann
2001-07-20 21:50         ` Craig Tierney
2001-07-20 22:14       ` 'Bryce'
2001-07-20 21:46   ` Peter Petrakis
2001-07-21 17:30     ` Craig Tierney [this message]
2001-07-21 18:34       ` Ruffian PC164UX and RH7.1 Peter Watkinson
  -- strict thread matches above, loose matches on Subject: below --
2001-07-20 20:03 i386 drivers on alpha ? Eugene Chu
2001-07-20 20:52 ` Maurice Hilarius
2001-07-20 21:16 ` Craig Tierney
2001-07-20 19:41 Eugene Chu
2001-07-20 19:45 ` Craig Tierney
2001-07-20 21:46   ` Peter Petrakis
2001-07-20 21:57     ` Craig Tierney
2001-07-20 19:46 ` Maurice Hilarius
2001-07-20 18:23 Eugene Chu
2001-07-20 18:32 ` Andrei A. Dergatchev
2001-07-20 19:00   ` Christopher C. Chimelis
2001-07-20 17:56 Eugene Chu
2001-07-20 18:05 ` Andrei A. Dergatchev
2001-07-20 21:46 ` Peter Petrakis
2001-07-20  8:06 kjetil.bugge
2001-07-20 11:27 ` Peter Petrakis
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox