Skip to contentSkip to conversation

dpt_i2o: 64 bit support (take 3)

PATCH In review Miquel van Smoorenburg 2 participants 3 messages Apr 24, 2008 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 dpt_i2o: 64 bit support (take 3)

As requested, patch split in two. Part 1 is the 64 bit stuff, part 2 is the sysfs stuff.

This patch is an update for drivers/scsi/dpt_i2o.c. It applies to both 2.6.24.4 and 2.6.25

It contains the following changes:

* 64 bit code based on unofficial Adaptec 64 bit driver
* removes scsi_module.c dependency, adds module_init / module_exit this is needed because we need to pass the proper device to scsi_add_host(), and the scsi_module.c passes NULL. With NULL, code like arch/x64/kernel/pci-gart_64.c::need_iommu() crashes because the dev pointer it is passed is NULL.
* adds sysfs entry for /sys/class/dpt_i2o/dptiX so that udev can create /dev/dptiX dynamically

Obviously there are more cleanups that can be done to this code, but we need to start somewhere. Patch has been tested heavily on both 32 and 64 bit x86 platforms.

drivers/scsi/Kconfig renamed from linux-2.6.25/drivers/scsi/Kconfig +1 -2
diff -ruN orig/linux-2.6.25/drivers/scsi/Kconfig linux-2.6.25/drivers/scsi/Kconfig
@@ -504,10 +504,9 @@
 source "drivers/scsi/aic7xxx/Kconfig.aic79xx"
 source "drivers/scsi/aic94xx/Kconfig"
 
-# All the I2O code and drivers do not seem to be 64bit safe.
 config SCSI_DPT_I2O
 	tristate "Adaptec I2O RAID support "
-	depends on !64BIT && SCSI && PCI && VIRT_TO_BUS
+	depends on SCSI && PCI && VIRT_TO_BUS
 	help
 	  This driver supports all of Adaptec's I2O based RAID controllers as 
 	  well as the DPT SmartRaid V cards.  This is an Adaptec maintained
drivers/scsi/dpt/dptsig.h renamed from linux-2.6.25/drivers/scsi/dpt/dptsig.h +2 -0
diff -ruN orig/linux-2.6.25/drivers/scsi/dpt/dptsig.h linux-2.6.25/drivers/scsi/dpt/dptsig.h
@@ -35,6 +35,8 @@
 typedef unsigned short sigWORD;
 #if (defined(_MULTI_DATAMODEL) && defined(sun) && !defined(_ILP32))
 typedef uint32_t sigLONG;
+#elif defined(__linux__)
+typedef u32 sigLONG;
 #else
 typedef unsigned long sigLONG;
 #endif
drivers/scsi/dpt/osd_util.h renamed from linux-2.6.25/drivers/scsi/dpt/osd_util.h +4 -0
diff -ruN orig/linux-2.6.25/drivers/scsi/dpt/osd_util.h linux-2.6.25/drivers/scsi/dpt/osd_util.h
@@ -185,7 +185,11 @@
    typedef unsigned char   uCHAR;
    typedef unsigned short  uSHORT;
    typedef unsigned int    uINT;
+#if defined(__linux__)
+   typedef u32		   uLONG;
+#else
    typedef unsigned long   uLONG;
+#endif
 
    typedef union {
 	 uCHAR        u8[4];
drivers/scsi/dpt_i2o.c renamed from linux-2.6.25/drivers/scsi/dpt_i2o.c +453 -118

1,067 lines not on this page · raw message

drivers/scsi/dpti.h renamed from linux-2.6.25/drivers/scsi/dpti.h +9 -2
diff -ruN orig/linux-2.6.25/drivers/scsi/dpti.h linux-2.6.25/drivers/scsi/dpti.h
@@ -229,14 +229,19 @@
 	u32  post_fifo_size;
 	u32  reply_fifo_size;
 	u32* reply_pool;
+	dma_addr_t reply_pool_pa;
 	u32  sg_tablesize;	// Scatter/Gather List Size.       
 	u8  top_scsi_channel;
 	u8  top_scsi_id;
 	u8  top_scsi_lun;
+	u8  dma64;
 
 	i2o_status_block* status_block;
+	dma_addr_t status_block_pa;
 	i2o_hrt* hrt;
+	dma_addr_t hrt_pa;
 	i2o_lct* lct;
+	dma_addr_t lct_pa;
 	uint lct_size;
 	struct i2o_device* devices;
 	struct adpt_channel channel[MAX_CHANNEL];
@@ -249,6 +254,7 @@
 	void __iomem *FwDebugBLEDflag_P;// Virtual Addr Of FW Debug BLED
 	void __iomem *FwDebugBLEDvalue_P;// Virtual Addr Of FW Debug BLED
 	u32 FwDebugFlags;
+	u32 *ioctl_reply_context[4];
 } adpt_hba;
 
 struct sg_simple_element {
@@ -275,7 +281,8 @@
 static const char *adpt_i2o_get_class_name(int class);
 #endif
 static int adpt_i2o_issue_params(int cmd, adpt_hba* pHba, int tid, 
-		  void *opblk, int oplen, void *resblk, int reslen);
+		  void *opblk, dma_addr_t opblk_pa, int oplen,
+		  void *resblk, dma_addr_t resblk_pa, int reslen);
 static int adpt_i2o_post_wait(adpt_hba* pHba, u32* msg, int len, int timeout);
 static int adpt_i2o_lct_get(adpt_hba* pHba);
 static int adpt_i2o_parse_lct(adpt_hba* pHba);
@@ -289,7 +296,7 @@
 static s32 adpt_i2o_hrt_get(adpt_hba* pHba);
 static s32 adpt_scsi_to_i2o(adpt_hba* pHba, struct scsi_cmnd* cmd, struct adpt_device* dptdevice);
 static s32 adpt_i2o_to_scsi(void __iomem *reply, struct scsi_cmnd* cmd);
-static s32 adpt_scsi_register(adpt_hba* pHba,struct scsi_host_template * sht);
+static s32 adpt_scsi_host_alloc(adpt_hba* pHba,struct scsi_host_template * sht);
 static s32 adpt_hba_reset(adpt_hba* pHba);
 static s32 adpt_i2o_reset_hba(adpt_hba* pHba);
 static s32 adpt_rescan(adpt_hba* pHba);
maintainer
#1 lore raw

Just gave it a cursory glance, and it looks OK, except for things like this:

Quoted 1 line · Miquel van Smoorenburg

+#elif defined(__linux__)

Could you get rid it, please? For inclusion in the kernel, you can take it as read that we're operating in a Linux environment, so the symbol will always be defined (so you can just strip out the code that depends on this symbol not being defined).

Thanks,

James

#2 lore raw
Quoted 10 lines · James Bottomley

Just gave it a cursory glance, and it looks OK, except for things like this:

Quoted 1 line · Miquel van Smoorenburg

+#elif defined(__linux__)

Could you get rid it, please? For inclusion in the kernel, you can take it as read that we're operating in a Linux environment, so the symbol will always be defined (so you can just strip out the code that depends on this symbol not being defined).

Ofcourse. I did it this way because I wanted to follow the style of the existing code as much as possible, and I did not want to change the existing code too much. There's more stuff in there that needs a cleanup, but that needs to be done seperately.

I'll fix the defined(__linux__) stuff, and I'll rip out the unused reboot_notifier stuff as well.

Mike.