From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.redhat.com (mail.redhat.com [199.183.24.239]) by listman.redhat.com (Postfix) with ESMTP id 7B1C82EF9D for ; Sat, 21 Jul 2001 13:30:53 -0400 (EDT) Received: (from mail@localhost) by mail.redhat.com (8.11.0/8.8.7) id f6LHO9231749 for axp-list@listman.redhat.com; Sat, 21 Jul 2001 13:24:09 -0400 Received: from woody.fsl.noaa.gov (IDENT:root@woody.fsl.noaa.gov [137.75.132.225]) by mail.redhat.com (8.11.0/8.8.7) with ESMTP id f6LHO8g31745 for ; Sat, 21 Jul 2001 13:24:08 -0400 Received: (from tierney@localhost) by woody.fsl.noaa.gov (8.9.3/8.9.3) id LAA25495 for axp-list@redhat.com; Sat, 21 Jul 2001 11:30:40 -0600 Date: Sat, 21 Jul 2001 11:30:40 -0600 From: Craig Tierney To: axp-list@redhat.com Subject: Re: i386 drivers on alpha ? Message-ID: <20010721113040.E25353@hpti.com> References: <20010720133029.D24578@hpti.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.6i In-Reply-To: ; from ppetrakis@alphalinux.org on Fri, Jul 20, 2001 at 05:46:13PM -0400 X-Loop: axp-list@redhat.com Sender: axp-list-admin@redhat.com Errors-To: axp-list-admin@redhat.com X-BeenThere: axp-list@redhat.com X-Mailman-Version: 2.0.1 Precedence: bulk Reply-To: axp-list@redhat.com List-Help: List-Post: List-Subscribe: , List-Id: Linux and Red Hat on Alpha processors List-Unsubscribe: , List-Archive: ...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;