SOURCES (LINUX_2_6_16): linux-3w-9xxx.patch - 2.26.02.010

marcus marcus at pld-linux.org
Sun Apr 6 16:06:32 CEST 2008


Author: marcus                       Date: Sun Apr  6 14:06:32 2008 GMT
Module: SOURCES                       Tag: LINUX_2_6_16
---- Log message:
- 2.26.02.010

---- Files affected:
SOURCES:
   linux-3w-9xxx.patch (1.1 -> 1.1.2.1) 

---- Diffs:

================================================================
Index: SOURCES/linux-3w-9xxx.patch
diff -u SOURCES/linux-3w-9xxx.patch:1.1 SOURCES/linux-3w-9xxx.patch:1.1.2.1
--- SOURCES/linux-3w-9xxx.patch:1.1	Fri Jun  1 00:23:33 2007
+++ SOURCES/linux-3w-9xxx.patch	Sun Apr  6 16:06:27 2008
@@ -1,6 +1,6 @@
 diff -uNr linux-2.6.16.orig/drivers/scsi/3w-9xxx.c linux-2.6.16/drivers/scsi/3w-9xxx.c
---- linux-2.6.16.orig/drivers/scsi/3w-9xxx.c	2007-05-31 23:13:02.123552000 +0200
-+++ linux-2.6.16/drivers/scsi/3w-9xxx.c	2006-10-20 22:22:02.000000000 +0200
+--- linux-2.6.16.orig/drivers/scsi/3w-9xxx.c	2008-04-06 09:38:09.863305000 +0000
++++ linux-2.6.16/drivers/scsi/3w-9xxx.c	2008-04-06 09:36:47.000000000 +0000
 @@ -2,8 +2,9 @@
     3w-9xxx.c -- 3ware 9000 Storage Controller device driver for Linux.
  
@@ -8,11 +8,11 @@
 +   Modifications By: Tom Couch <linuxraid at amcc.com>
  
 -   Copyright (C) 2004-2005 Applied Micro Circuits Corporation.
-+   Copyright (C) 2004-2006 Applied Micro Circuits Corporation.
++   Copyright (C) 2004-2007 Applied Micro Circuits Corporation.
  
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
-@@ -62,6 +63,12 @@
+@@ -62,6 +63,14 @@
     2.26.02.003 - Correctly handle single sgl's with use_sg=1.
     2.26.02.004 - Add support for 9550SX controllers.
     2.26.02.005 - Fix use_sg == 0 mapping on systems with 4GB or higher.
@@ -22,19 +22,35 @@
 +   2.26.02.008 - Free irq handler in __twa_shutdown().
 +                 Serialize reset code.
 +                 Add support for 9650SE controllers.
++   2.26.02.009 - Fix dma mask setting to fallback to 32-bit if 64-bit fails.
++   2.26.02.010 - Add support for 9690SA controllers.
  */
  
  #include <linux/module.h>
-@@ -85,7 +92,7 @@
+@@ -85,7 +94,7 @@
  #include "3w-9xxx.h"
  
  /* Globals */
 -#define TW_DRIVER_VERSION "2.26.02.007"
-+#define TW_DRIVER_VERSION "2.26.02.008"
++#define TW_DRIVER_VERSION "2.26.02.010"
  static TW_Device_Extension *twa_device_extension_list[TW_MAX_SLOT];
  static unsigned int twa_device_extension_count;
  static int twa_major = -1;
-@@ -208,7 +215,7 @@
+@@ -117,11 +126,11 @@
+ 			      unsigned short *fw_on_ctlr_branch, 
+ 			      unsigned short *fw_on_ctlr_build, 
+ 			      u32 *init_connect_result);
+-static void twa_load_sgl(TW_Command_Full *full_command_packet, int request_id, dma_addr_t dma_handle, int length);
++static void twa_load_sgl(TW_Device_Extension *tw_dev, TW_Command_Full *full_command_packet, int request_id, dma_addr_t dma_handle, int length);
+ static int twa_poll_response(TW_Device_Extension *tw_dev, int request_id, int seconds);
+ static int twa_poll_status_gone(TW_Device_Extension *tw_dev, u32 flag, int seconds);
+ static int twa_post_command_packet(TW_Device_Extension *tw_dev, int request_id, char internal);
+-static int twa_reset_device_extension(TW_Device_Extension *tw_dev, int ioctl_reset);
++static int twa_reset_device_extension(TW_Device_Extension *tw_dev);
+ static int twa_reset_sequence(TW_Device_Extension *tw_dev, int soft_reset);
+ static int twa_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id, char *cdb, int use_sg, TW_SG_Entry *sglistarg);
+ static void twa_scsiop_execute_scsi_complete(TW_Device_Extension *tw_dev, int request_id);
+@@ -208,7 +217,7 @@
  
  	header = (TW_Command_Apache_Header *)tw_dev->generic_buffer_virt[request_id];
  	tw_dev->posted_request_count--;
@@ -43,7 +59,7 @@
  	full_command_packet = tw_dev->command_packet_virt[request_id];
  	command_packet = &full_command_packet->command.oldcommand;
  
-@@ -305,7 +312,7 @@
+@@ -305,7 +314,7 @@
  
  		tw_dev->posted_request_count--;
  		header = (TW_Command_Apache_Header *)tw_dev->generic_buffer_virt[request_id];
@@ -52,7 +68,7 @@
  		queue = 0;
  		count++;
  
-@@ -365,7 +372,7 @@
+@@ -365,7 +374,7 @@
  			tw_dev->aen_clobber = 1;
  	}
  
@@ -61,7 +77,7 @@
  	memset(event, 0, sizeof(TW_Event));
  
  	event->severity = TW_SEV_OUT(header->status_block.severity__reserved);
-@@ -382,7 +389,7 @@
+@@ -382,7 +391,7 @@
  
  	header->err_specific_desc[sizeof(header->err_specific_desc) - 1] = '\0';
  	event->parameter_len = strlen(header->err_specific_desc);
@@ -70,7 +86,7 @@
  	if (event->severity != TW_AEN_SEVERITY_DEBUG)
  		printk(KERN_WARNING "3w-9xxx:%s AEN: %s (0x%02X:0x%04X): %s:%s.\n",
  		       host,
-@@ -462,24 +469,24 @@
+@@ -462,24 +471,24 @@
  	command_packet = &full_command_packet->command.oldcommand;
  	command_packet->opcode__sgloffset = TW_OPSGL_IN(2, TW_OP_SET_PARAM);
  	command_packet->request_id = request_id;
@@ -102,7 +118,7 @@
  
  	memcpy(param->data, &schedulertime, sizeof(u32));
  
-@@ -562,9 +569,9 @@
+@@ -562,9 +571,9 @@
  		goto out;
  	}
  
@@ -115,7 +131,7 @@
  
  	/* Try base mode compatibility */
  	if (!(init_connect_result & TW_CTLR_FW_COMPATIBLE)) {
-@@ -586,10 +593,23 @@
+@@ -586,10 +595,23 @@
  			}
  			goto out;
  		}
@@ -143,7 +159,7 @@
  	retval = 0;
  out:
  	return retval;
-@@ -627,7 +647,7 @@
+@@ -627,7 +649,7 @@
  		goto out2;
  
  	/* Check data buffer size */
@@ -152,7 +168,16 @@
  		retval = TW_IOCTL_ERROR_OS_EINVAL;
  		goto out2;
  	}
-@@ -676,13 +696,6 @@
+@@ -663,7 +685,7 @@
+ 		full_command_packet = &tw_ioctl->firmware_command;
+ 
+ 		/* Load request id and sglist for both command types */
+-		twa_load_sgl(full_command_packet, request_id, dma_handle, data_buffer_length_adjusted);
++		twa_load_sgl(tw_dev, full_command_packet, request_id, dma_handle, data_buffer_length_adjusted);
+ 
+ 		memcpy(tw_dev->command_packet_virt[request_id], &(tw_ioctl->firmware_command), sizeof(TW_Command_Full));
+ 
+@@ -676,26 +698,14 @@
  		/* Now wait for command to complete */
  		timeout = wait_event_timeout(tw_dev->ioctl_wqueue, tw_dev->chrdev_request_id == TW_IOCTL_CHRDEV_FREE, timeout);
  
@@ -166,8 +191,9 @@
  		/* We timed out, and didn't get an interrupt */
  		if (tw_dev->chrdev_request_id != TW_IOCTL_CHRDEV_FREE) {
  			/* Now we need to reset the board */
-@@ -690,11 +703,6 @@
- 			       tw_dev->host->host_no, TW_DRIVER, 0xc,
+ 			printk(KERN_WARNING "3w-9xxx: scsi%d: WARNING: (0x%02X:0x%04X): Character ioctl (0x%x) timed out, resetting card.\n",
+-			       tw_dev->host->host_no, TW_DRIVER, 0xc,
++			       tw_dev->host->host_no, TW_DRIVER, 0x37,
  			       cmd);
  			retval = TW_IOCTL_ERROR_OS_EIO;
 -			spin_lock_irqsave(tw_dev->host->host_lock, flags);
@@ -175,10 +201,12 @@
 -			twa_free_request_id(tw_dev, request_id);
 -			tw_dev->posted_request_count--;
 -			spin_unlock_irqrestore(tw_dev->host->host_lock, flags);
- 			twa_reset_device_extension(tw_dev, 1);
+-			twa_reset_device_extension(tw_dev, 1);
++			twa_reset_device_extension(tw_dev);
  			goto out3;
  		}
-@@ -713,16 +721,7 @@
+ 
+@@ -713,16 +723,7 @@
  		tw_ioctl->driver_command.status = 0;
  		/* Copy compatiblity struct into ioctl data buffer */
  		tw_compat_info = (TW_Compatibility_Info *)tw_ioctl->data_buffer;
@@ -196,17 +224,19 @@
  		break;
  	case TW_IOCTL_GET_LAST_EVENT:
  		if (tw_dev->event_queue_wrapped) {
-@@ -891,7 +890,8 @@
+@@ -891,7 +892,10 @@
  	}
  
  	if (status_reg_value & TW_STATUS_QUEUE_ERROR) {
 -		TW_PRINTK(tw_dev->host, TW_DRIVER, 0xe, "Controller Queue Error: clearing");
-+		if ((tw_dev->tw_pci_dev->device != PCI_DEVICE_ID_3WARE_9650SE) || (!test_bit(TW_IN_RESET, &tw_dev->flags)))
++		if (((tw_dev->tw_pci_dev->device != PCI_DEVICE_ID_3WARE_9650SE) &&
++		     (tw_dev->tw_pci_dev->device != PCI_DEVICE_ID_3WARE_9690SA)) ||
++		    (!test_bit(TW_IN_RESET, &tw_dev->flags)))
 +			TW_PRINTK(tw_dev->host, TW_DRIVER, 0xe, "Controller Queue Error: clearing");
  		writel(TW_CONTROL_CLEAR_QUEUE_ERROR, TW_CONTROL_REG_ADDR(tw_dev));
  	}
  
-@@ -931,26 +931,21 @@
+@@ -931,26 +935,20 @@
  /* This function will clear the pchip/response queue on 9550SX */
  static int twa_empty_response_queue_large(TW_Device_Extension *tw_dev)
  {
@@ -220,8 +250,7 @@
 +	int retval = 1;
  
 -		while (((status_reg_value & TW_STATUS_RESPONSE_QUEUE_EMPTY) == 0) && (count < TW_MAX_RESPONSE_DRAIN)) {
-+	if ((tw_dev->tw_pci_dev->device == PCI_DEVICE_ID_3WARE_9550SX) ||
-+	    (tw_dev->tw_pci_dev->device == PCI_DEVICE_ID_3WARE_9650SE)) {
++	if (tw_dev->tw_pci_dev->device != PCI_DEVICE_ID_3WARE_9000) {
 +		before = jiffies;
 +		while ((response_que_value & TW_9550SX_DRAIN_COMPLETED) != TW_9550SX_DRAIN_COMPLETED) {
  			response_que_value = readl(TW_RESPONSE_QUEUE_REG_ADDR_LARGE(tw_dev));
@@ -244,7 +273,7 @@
  		retval = 0;
  	} else
  		retval = 0;
-@@ -972,7 +967,7 @@
+@@ -972,7 +970,7 @@
  	error_str = &(full_command_packet->header.err_specific_desc[strlen(full_command_packet->header.err_specific_desc) + 1]);
  
  	/* Don't print error for Logical unit not supported during rollcall */
@@ -253,7 +282,7 @@
  	if ((error != TW_ERROR_LOGICAL_UNIT_NOT_SUPPORTED) && (error != TW_ERROR_UNIT_OFFLINE)) {
  		if (print_host)
  			printk(KERN_WARNING "3w-9xxx: scsi%d: ERROR: (0x%02X:0x%04X): %s:%s.\n",
-@@ -1030,7 +1025,7 @@
+@@ -1030,7 +1028,7 @@
  	tw_dev->free_tail = (tw_dev->free_tail + 1) % TW_Q_LENGTH;
  } /* End twa_free_request_id() */
  
@@ -262,7 +291,7 @@
  static void *twa_get_param(TW_Device_Extension *tw_dev, int request_id, int table_id, int parameter_id, int parameter_size_bytes)
  {
  	TW_Command_Full *full_command_packet;
-@@ -1047,18 +1042,18 @@
+@@ -1047,18 +1045,18 @@
  	command_packet->opcode__sgloffset = TW_OPSGL_IN(2, TW_OP_GET_PARAM);
  	command_packet->size              = TW_COMMAND_SIZE;
  	command_packet->request_id        = request_id;
@@ -287,7 +316,7 @@
  
  	/* Post the command packet to the board */
  	twa_post_command_packet(tw_dev, request_id, 1);
-@@ -1107,18 +1102,20 @@
+@@ -1107,18 +1105,20 @@
  	tw_initconnect = (TW_Initconnect *)&full_command_packet->command.oldcommand;
  	tw_initconnect->opcode__reserved = TW_OPRES_IN(0, TW_OP_INIT_CONNECTION);
  	tw_initconnect->request_id = request_id;
@@ -313,7 +342,7 @@
  	} else 
  		tw_initconnect->size = TW_INIT_COMMAND_PACKET_SIZE;
  
-@@ -1130,11 +1127,11 @@
+@@ -1130,11 +1130,11 @@
  		TW_PRINTK(tw_dev->host, TW_DRIVER, 0x15, "No valid response during init connection");
  	} else {
  		if (set_features & TW_EXTENDED_INIT_CONNECT) {
@@ -330,16 +359,15 @@
  		}
  		retval = 0;
  	}
-@@ -1193,7 +1190,7 @@
- } /* End twa_initialize_device_extension() */
- 
- /* This function is the interrupt service routine */
--static irqreturn_t twa_interrupt(int irq, void *dev_instance, struct pt_regs *regs)
-+static irqreturn_t twa_interrupt(int irq, void *dev_instance)
- {
- 	int request_id, error = 0;
+@@ -1199,7 +1199,6 @@
  	u32 status_reg_value;
-@@ -1215,6 +1212,10 @@
+ 	TW_Response_Queue response_que;
+ 	TW_Command_Full *full_command_packet;
+-	TW_Command *command_packet;
+ 	TW_Device_Extension *tw_dev = (TW_Device_Extension *)dev_instance;
+ 	int handled = 0;
+ 
+@@ -1215,6 +1214,10 @@
  
  	handled = 1;
  
@@ -350,7 +378,28 @@
  	/* Check controller for errors */
  	if (twa_check_bits(status_reg_value)) {
  		if (twa_decode_bits(tw_dev, status_reg_value)) {
-@@ -1356,12 +1357,12 @@
+@@ -1273,7 +1276,6 @@
+ 			request_id = TW_RESID_OUT(response_que.response_id);
+ 			full_command_packet = tw_dev->command_packet_virt[request_id];
+ 			error = 0;
+-			command_packet = &full_command_packet->command.oldcommand;
+ 			/* Check for command packet errors */
+ 			if (full_command_packet->command.newcommand.status != 0) {
+ 				if (tw_dev->srb[request_id] != 0) {
+@@ -1348,32 +1350,38 @@
+ } /* End twa_interrupt() */
+ 
+ /* This function will load the request id and various sgls for ioctls */
+-static void twa_load_sgl(TW_Command_Full *full_command_packet, int request_id, dma_addr_t dma_handle, int length)
++static void twa_load_sgl(TW_Device_Extension *tw_dev, TW_Command_Full *full_command_packet, int request_id, dma_addr_t dma_handle, int length)
+ {
+ 	TW_Command *oldcommand;
+ 	TW_Command_Apache *newcommand;
+ 	TW_SG_Entry *sgl;
++	unsigned int pae = 0;
++
++	if ((sizeof(long) < 8) && (sizeof(dma_addr_t) > 4))
++		pae = 1;
  
  	if (TW_OP_OUT(full_command_packet->command.newcommand.opcode__reserved) == TW_OP_EXECUTE_SCSI) {
  		newcommand = &full_command_packet->command.newcommand;
@@ -368,33 +417,33 @@
  	} else {
  		oldcommand = &full_command_packet->command.oldcommand;
  		oldcommand->request_id = request_id;
-@@ -1369,8 +1370,8 @@
+ 
  		if (TW_SGL_OUT(oldcommand->opcode__sgloffset)) {
  			/* Load the sg list */
- 			sgl = (TW_SG_Entry *)((u32 *)oldcommand+TW_SGL_OUT(oldcommand->opcode__sgloffset));
+-			sgl = (TW_SG_Entry *)((u32 *)oldcommand+TW_SGL_OUT(oldcommand->opcode__sgloffset));
 -			sgl->address = dma_handle + sizeof(TW_Ioctl_Buf_Apache) - 1;
 -			sgl->length = length;
++			if (tw_dev->tw_pci_dev->device == PCI_DEVICE_ID_3WARE_9690SA)
++				sgl = (TW_SG_Entry *)((u32 *)oldcommand+oldcommand->size - (sizeof(TW_SG_Entry)/4) + pae);
++			else
++				sgl = (TW_SG_Entry *)((u32 *)oldcommand+TW_SGL_OUT(oldcommand->opcode__sgloffset));
 +			sgl->address = TW_CPU_TO_SGL(dma_handle + sizeof(TW_Ioctl_Buf_Apache) - 1);
 +			sgl->length = cpu_to_le32(length);
  
- 			if ((sizeof(long) < 8) && (sizeof(dma_addr_t) > 4))
- 				oldcommand->size += 1;
-@@ -1389,7 +1390,7 @@
- 	if (cmd->use_sg == 0)
- 		goto out;
- 
--	use_sg = pci_map_sg(pdev, cmd->buffer, cmd->use_sg, DMA_BIDIRECTIONAL);
-+	use_sg = pci_map_sg(pdev, cmd->request_buffer, cmd->use_sg, DMA_BIDIRECTIONAL);
- 
- 	if (use_sg == 0) {
- 		TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1c, "Failed to map scatter gather list");
-@@ -1532,6 +1533,13 @@
+-			if ((sizeof(long) < 8) && (sizeof(dma_addr_t) > 4))
+-				oldcommand->size += 1;
++			oldcommand->size += pae;
+ 		}
+ 	}
+ } /* End twa_load_sgl() */
+@@ -1532,6 +1540,14 @@
  	int retval = 1;
  
  	command_que_value = tw_dev->command_packet_phys[request_id];
 +
 +	/* For 9650SE write low 4 bytes first */
-+	if (tw_dev->tw_pci_dev->device == PCI_DEVICE_ID_3WARE_9650SE) {
++	if ((tw_dev->tw_pci_dev->device == PCI_DEVICE_ID_3WARE_9650SE) ||
++	    (tw_dev->tw_pci_dev->device == PCI_DEVICE_ID_3WARE_9690SA)) {
 +		command_que_value += TW_COMMAND_OFFSET;
 +		writel((u32)command_que_value, TW_COMMAND_QUEUE_REG_ADDR_LARGE(tw_dev));
 +	}
@@ -402,7 +451,7 @@
  	status_reg_value = readl(TW_STATUS_REG_ADDR(tw_dev));
  
  	if (twa_check_bits(status_reg_value))
-@@ -1558,13 +1566,17 @@
+@@ -1558,13 +1574,18 @@
  		TW_UNMASK_COMMAND_INTERRUPT(tw_dev);
  		goto out;
  	} else {
@@ -411,7 +460,8 @@
 -			command_que_value += TW_COMMAND_OFFSET;
 -			writel((u32)command_que_value, TW_COMMAND_QUEUE_REG_ADDR(tw_dev));
 -			writel((u32)((u64)command_que_value >> 32), TW_COMMAND_QUEUE_REG_ADDR(tw_dev) + 0x4);
-+		if (tw_dev->tw_pci_dev->device == PCI_DEVICE_ID_3WARE_9650SE) {
++		if ((tw_dev->tw_pci_dev->device == PCI_DEVICE_ID_3WARE_9650SE) ||
++		    (tw_dev->tw_pci_dev->device == PCI_DEVICE_ID_3WARE_9690SA)) {
 +			/* Now write upper 4 bytes */
 +			writel((u32)((u64)command_que_value >> 32), TW_COMMAND_QUEUE_REG_ADDR_LARGE(tw_dev) + 0x4);
  		} else {
@@ -426,7 +476,16 @@
  		}
  		tw_dev->state[request_id] = TW_S_POSTED;
  		tw_dev->posted_request_count++;
-@@ -1621,14 +1633,9 @@
+@@ -1578,7 +1599,7 @@
+ } /* End twa_post_command_packet() */
+ 
+ /* This function will reset a device extension */
+-static int twa_reset_device_extension(TW_Device_Extension *tw_dev, int ioctl_reset)
++static int twa_reset_device_extension(TW_Device_Extension *tw_dev)
+ {
+ 	int i = 0;
+ 	int retval = 1;
+@@ -1621,14 +1642,9 @@
  		goto out;
  
  	TW_ENABLE_AND_CLEAR_INTERRUPTS(tw_dev);
@@ -443,7 +502,7 @@
  	retval = 0;
  out:
  	return retval;
-@@ -1737,6 +1744,9 @@
+@@ -1737,14 +1753,18 @@
  		"WARNING: (0x%02X:0x%04X): Command (0x%x) timed out, resetting card.\n",
  		TW_DRIVER, 0x2c, SCpnt->cmnd[0]);
  
@@ -451,9 +510,11 @@
 +	mutex_lock(&tw_dev->ioctl_lock);
 +
  	/* Now reset the card and some of the device extension data */
- 	if (twa_reset_device_extension(tw_dev, 0)) {
+-	if (twa_reset_device_extension(tw_dev, 0)) {
++	if (twa_reset_device_extension(tw_dev)) {
  		TW_PRINTK(tw_dev->host, TW_DRIVER, 0x2b, "Controller reset failed during scsi host reset");
-@@ -1745,6 +1755,7 @@
+ 		goto out;
+ 	}
  
  	retval = SUCCESS;
  out:
@@ -461,7 +522,7 @@
  	return retval;
  } /* End twa_scsi_eh_reset() */
  
-@@ -1754,8 +1765,14 @@
+@@ -1754,8 +1774,14 @@
  	int request_id, retval;
  	TW_Device_Extension *tw_dev = (TW_Device_Extension *)SCpnt->device->host->hostdata;
  
@@ -477,7 +538,7 @@
  		SCpnt->result = (DID_BAD_TARGET << 16);
  		done(SCpnt);
  		retval = 0;
-@@ -1828,10 +1845,10 @@
+@@ -1828,10 +1854,10 @@
  	if (srb) {
  		command_packet->unit = srb->device->id;
  		command_packet->request_id__lunl =
@@ -490,7 +551,7 @@
  		command_packet->unit = 0;
  	}
  
-@@ -1841,8 +1858,8 @@
+@@ -1841,8 +1867,8 @@
  		/* Map sglist from scsi layer to cmd packet */
  		if (tw_dev->srb[request_id]->use_sg == 0) {
  			if (tw_dev->srb[request_id]->request_bufflen < TW_MIN_SGL_LENGTH) {
@@ -501,7 +562,7 @@
  				if (tw_dev->srb[request_id]->sc_data_direction == DMA_TO_DEVICE || tw_dev->srb[request_id]->sc_data_direction == DMA_BIDIRECTIONAL)
  					memcpy(tw_dev->generic_buffer_virt[request_id], tw_dev->srb[request_id]->request_buffer, tw_dev->srb[request_id]->request_bufflen);
  			} else {
-@@ -1850,12 +1867,12 @@
+@@ -1850,12 +1876,12 @@
  				if (buffaddr == 0)
  					goto out;
  
@@ -518,7 +579,7 @@
  				TW_PRINTK(tw_dev->host, TW_DRIVER, 0x2d, "Found unaligned address during execute scsi");
  				goto out;
  			}
-@@ -1869,35 +1886,35 @@
+@@ -1869,35 +1895,35 @@
  					memcpy(tw_dev->generic_buffer_virt[request_id], buf, sg->length);
  					kunmap_atomic(buf - sg->offset, KM_IRQ0);
  				}
@@ -564,7 +625,7 @@
  	}
  
  	if (srb) {
-@@ -1961,6 +1978,9 @@
+@@ -1961,6 +1987,9 @@
  	/* Disable interrupts */
  	TW_DISABLE_INTERRUPTS(tw_dev);
  
@@ -574,7 +635,27 @@
  	printk(KERN_WARNING "3w-9xxx: Shutting down host %d.\n", tw_dev->host->host_no);
  
  	/* Tell the card we are shutting down */
-@@ -2092,21 +2112,25 @@
+@@ -2043,11 +2072,14 @@
+ 
+ 	pci_set_master(pdev);
+ 
+-	retval = pci_set_dma_mask(pdev, sizeof(dma_addr_t) > 4 ? DMA_64BIT_MASK : DMA_32BIT_MASK);
+-	if (retval) {
+-		TW_PRINTK(host, TW_DRIVER, 0x23, "Failed to set dma mask");
+-		goto out_disable_device;
+-	}
++	if (pci_set_dma_mask(pdev, DMA_64BIT_MASK)
++	    || pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK))
++		if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)
++		    || pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK)) {
++			TW_PRINTK(host, TW_DRIVER, 0x23, "Failed to set dma mask");
++			retval = -ENODEV;
++			goto out_disable_device;
++		}
+ 
+ 	host = scsi_host_alloc(&driver_template, sizeof(TW_Device_Extension));
+ 	if (!host) {
+@@ -2092,21 +2124,26 @@
  
  	/* Initialize the card */
  	if (twa_reset_sequence(tw_dev, 0))
@@ -583,7 +664,8 @@
  
  	/* Set host specific parameters */
 -	host->max_id = TW_MAX_UNITS;
-+	if (pdev->device == PCI_DEVICE_ID_3WARE_9650SE)
++	if ((pdev->device == PCI_DEVICE_ID_3WARE_9650SE) ||
++	    (pdev->device == PCI_DEVICE_ID_3WARE_9690SA))
 +		host->max_id = TW_MAX_UNITS_9650SE;
 +	else
 +		host->max_id = TW_MAX_UNITS;
@@ -604,7 +686,7 @@
  	}
  
  	pci_set_drvdata(pdev, host);
-@@ -2119,8 +2143,8 @@
+@@ -2119,8 +2156,8 @@
  				     TW_PARAM_FWVER, TW_PARAM_FWVER_LENGTH),
  	       (char *)twa_get_param(tw_dev, 1, TW_VERSION_TABLE,
  				     TW_PARAM_BIOSVER, TW_PARAM_BIOSVER_LENGTH),
@@ -615,7 +697,7 @@
  
  	/* Now setup the interrupt handler */
  	retval = request_irq(pdev->irq, twa_interrupt, SA_SHIRQ, "3w-9xxx", tw_dev);
-@@ -2146,6 +2170,8 @@
+@@ -2146,6 +2183,8 @@
  
  out_remove_host:
  	scsi_remove_host(host);
@@ -624,7 +706,7 @@
  out_release_mem_region:
  	pci_release_regions(pdev);
  out_free_device_extension:
-@@ -2171,12 +2197,12 @@
+@@ -2171,12 +2210,12 @@
  		twa_major = -1;
  	}
  
@@ -640,27 +722,20 @@
  	/* Free up the mem region */
  	pci_release_regions(pdev);
  
-@@ -2194,6 +2220,8 @@
+@@ -2194,6 +2233,10 @@
  	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
  	{ PCI_VENDOR_ID_3WARE, PCI_DEVICE_ID_3WARE_9550SX,
  	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
 +	{ PCI_VENDOR_ID_3WARE, PCI_DEVICE_ID_3WARE_9650SE,
 +	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
++	{ PCI_VENDOR_ID_3WARE, PCI_DEVICE_ID_3WARE_9690SA,
++	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
  	{ }
  };
  MODULE_DEVICE_TABLE(pci, twa_pci_tbl);
-@@ -2212,7 +2240,7 @@
- {
- 	printk(KERN_WARNING "3ware 9000 Storage Controller device driver for Linux v%s.\n", TW_DRIVER_VERSION);
- 
--	return pci_module_init(&twa_driver);
-+	return pci_register_driver(&twa_driver);
- } /* End twa_init() */
- 
- /* This function is called on driver exit */
 diff -uNr linux-2.6.16.orig/drivers/scsi/3w-9xxx.h linux-2.6.16/drivers/scsi/3w-9xxx.h
---- linux-2.6.16.orig/drivers/scsi/3w-9xxx.h	2006-03-20 06:53:29.000000000 +0100
-+++ linux-2.6.16/drivers/scsi/3w-9xxx.h	2006-10-20 22:22:02.000000000 +0200
+--- linux-2.6.16.orig/drivers/scsi/3w-9xxx.h	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/drivers/scsi/3w-9xxx.h	2008-04-06 09:36:47.000000000 +0000
 @@ -2,8 +2,9 @@
     3w-9xxx.h -- 3ware 9000 Storage Controller device driver for Linux.
  
@@ -668,7 +743,7 @@
 +   Modifications By: Tom Couch <linuxraid at amcc.com>
  
 -   Copyright (C) 2004-2005 Applied Micro Circuits Corporation.
-+   Copyright (C) 2004-2006 Applied Micro Circuits Corporation.
++   Copyright (C) 2004-2007 Applied Micro Circuits Corporation.
  
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -700,17 +775,20 @@
  #define TW_IN_ATTENTION_LOOP		      4
  #define TW_MAX_SECTORS                        256
  #define TW_AEN_WAIT_TIME                      1000
-@@ -419,6 +416,9 @@
+@@ -419,6 +416,12 @@
  #ifndef PCI_DEVICE_ID_3WARE_9550SX
  #define PCI_DEVICE_ID_3WARE_9550SX 0x1003
  #endif
 +#ifndef PCI_DEVICE_ID_3WARE_9650SE
 +#define PCI_DEVICE_ID_3WARE_9650SE 0x1004
 +#endif
++#ifndef PCI_DEVICE_ID_3WARE_9690SA
++#define PCI_DEVICE_ID_3WARE_9690SA 0x1005
++#endif
  
  /* Bitmask macros to eliminate bitfields */
  
<<Diff was trimmed, longer than 597 lines>>

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/linux-3w-9xxx.patch?r1=1.1&r2=1.1.2.1&f=u



More information about the pld-cvs-commit mailing list