[kernel] r8681 - in dists/sid/linux-2.6/debian: . arch/m68k patches/bugfix/m68k

Christian T. Steigies cts at alioth.debian.org
Mon May 21 19:39:35 UTC 2007


Author: cts
Date: Mon May 21 19:39:35 2007
New Revision: 8681

Log:
enable ATARI_SCSI and ATARI_ROM_ISA


Added:
   dists/sid/linux-2.6/debian/patches/bugfix/m68k/debian-2.6.21-2-atari-scsi.diff
   dists/sid/linux-2.6/debian/patches/bugfix/m68k/debian-2.6.21-2-rom-isa.diff
Modified:
   dists/sid/linux-2.6/debian/arch/m68k/config.atari
   dists/sid/linux-2.6/debian/changelog

Modified: dists/sid/linux-2.6/debian/arch/m68k/config.atari
==============================================================================
--- dists/sid/linux-2.6/debian/arch/m68k/config.atari	(original)
+++ dists/sid/linux-2.6/debian/arch/m68k/config.atari	Mon May 21 19:39:35 2007
@@ -107,16 +107,14 @@
 # enable new ethernet drivers
 CONFIG_ARANYM=y
 CONFIG_NATFEAT=y
-# Atari SCSI driver is buggy
-# CONFIG_ATARI_SCSI is not set
 # enable ethernet
 CONFIG_NET_ETHERNET=y
 CONFIG_ATARILANCE=y
 CONFIG_ATARI_NFETH=y
-CONFIG_ATARI_ETHERNEC=m
+CONFIG_ATARI_ETHERNEC=y
 # 2.6.21
-# disable atari_rom_isa for now
-# CONFIG_ATARI_ROM_ISA is not set
 # uses undefined isa_*
 # CONFIG_PARPORT is not set
 # CONFIG_PARPORT_PC
+CONFIG_ATARI_ROM_ISA=y
+CONFIG_ATARI_SCSI=y

Modified: dists/sid/linux-2.6/debian/changelog
==============================================================================
--- dists/sid/linux-2.6/debian/changelog	(original)
+++ dists/sid/linux-2.6/debian/changelog	Mon May 21 19:39:35 2007
@@ -7,7 +7,10 @@
   * sparc64: enable USB_SERIAL. (closes: #412740)
   * Apply stable 2.6.21.1.
 
- -- maximilian attems <maks at debian.org>  Mon, 21 May 2007 10:49:30 +0200
+  [ Christian T. Steigies ]
+  * m68k: enable ATARI_SCSI and ATARI_ROM_ISA
+
+ -- Christian T. Steigies <cts at debian.org>  Mon, 21 May 2007 21:37:26 +0200
 
 linux-2.6 (2.6.21-2) unstable; urgency=low
 

Added: dists/sid/linux-2.6/debian/patches/bugfix/m68k/debian-2.6.21-2-atari-scsi.diff
==============================================================================
--- (empty file)
+++ dists/sid/linux-2.6/debian/patches/bugfix/m68k/debian-2.6.21-2-atari-scsi.diff	Mon May 21 19:39:35 2007
@@ -0,0 +1,295 @@
+--- l/drivers/scsi/atari_scsi.c.org	2007-05-18 18:24:37.000000000 +0200
++++ l/drivers/scsi/atari_scsi.c	2007-05-20 21:31:46.000000000 +0200
+@@ -186,17 +186,18 @@
+ /***************************** Prototypes *****************************/
+ 
+ #ifdef REAL_DMA
+-static int scsi_dma_is_ignored_buserr(unsigned char dma_stat);
+-static void atari_scsi_fetch_restbytes(void);
+-static long atari_scsi_dma_residual(struct Scsi_Host *instance);
+-static int falcon_classify_cmd(Scsi_Cmnd *cmd);
+-static unsigned long atari_dma_xfer_len(unsigned long wanted_len,
+-					Scsi_Cmnd *cmd, int write_flag);
+-#endif
+-static irqreturn_t scsi_tt_intr(int irq, void *dummy);
+-static irqreturn_t scsi_falcon_intr(int irq, void *dummy);
+-static void falcon_release_lock_if_possible(struct NCR5380_hostdata *hostdata);
+-static void falcon_get_lock(void);
++static int scsi_dma_is_ignored_buserr( unsigned char dma_stat );
++static void atari_scsi_fetch_restbytes( void );
++static long atari_scsi_dma_residual( struct Scsi_Host *instance );
++static int falcon_classify_cmd( Scsi_Cmnd *cmd );
++static unsigned long atari_dma_xfer_len( unsigned long wanted_len,
++                                         Scsi_Cmnd *cmd, int write_flag );
++#endif
++static irqreturn_t scsi_tt_intr( int irq, void *dummy);
++static irqreturn_t scsi_falcon_intr( int irq, void *dummy);
++static void falcon_release_lock_if_possible( struct NCR5380_hostdata *
++                                             hostdata );
++static int falcon_get_lock( void );
+ #ifdef CONFIG_ATARI_SCSI_RESET_BOOT
+ static void atari_scsi_reset_boot(void);
+ #endif
+@@ -523,7 +524,9 @@
+ 		}
+ 		falcon_got_lock = 0;
+ 		stdma_release();
+-		wake_up(&falcon_fairness_wait);
++#if defined(FALCON_FAIRNESS_WAIT)
++		wake_up( &falcon_fairness_wait );
++#endif
+ 	}
+ 
+ 	local_irq_restore(flags);
+@@ -544,21 +547,38 @@
+  * Complicated, complicated.... Sigh...
+  */
+ 
+-static void falcon_get_lock(void)
++/* MSch 20061229: atari_queue_command gets called from softirq context quite
++ * heavily in the 2.6 kernel series. Since atari_queue_command might need to 
++ * sleep in order to grab the ST-DMA lock, I have modified falcon_get_lock to 
++ * immediately return with error status if called in softirq context with the 
++ * lock not currently held by the SCSI driver, and the ST-DMA locked by some 
++ * other driver. atari_queue_command then returns SCSI_MLQUEUE_HOST_BUSY and 
++ * prevents further commands from issueing. 
++ */
++
++static int falcon_get_lock(void)
+ {
+ 	unsigned long flags;
+ 
+ 	if (IS_A_TT())
+-		return;
++		return 0;
+ 
+ 	local_irq_save(flags);
+ 
+-	while (!in_irq() && falcon_got_lock && stdma_others_waiting())
+-		sleep_on(&falcon_fairness_wait);
++#if defined (FALCON_FAIRNESS_WAIT)
++	while( !in_irq() && falcon_got_lock && stdma_others_waiting() )
++		sleep_on( &falcon_fairness_wait );
++#endif
+ 
+ 	while (!falcon_got_lock) {
+ 		if (in_irq())
+ 			panic("Falcon SCSI hasn't ST-DMA lock in interrupt");
++		/* we may not sleep in soft interrupts neither, so bail out */
++		if (in_softirq() && stdma_islocked()) {
++			printk(KERN_INFO "Falcon SCSI does not hold ST-DMA lock in softirq!\n" );
++			local_irq_restore(flags);
++			return 1;
++		}
+ 		if (!falcon_trying_lock) {
+ 			falcon_trying_lock = 1;
+ 			stdma_lock(scsi_falcon_intr, NULL);
+@@ -573,6 +593,8 @@
+ 	local_irq_restore(flags);
+ 	if (!falcon_got_lock)
+ 		panic("Falcon SCSI: someone stole the lock :-(\n");
++
++	return 0;
+ }
+ 
+ 
+@@ -845,7 +867,7 @@
+ 	} else {
+ 		atari_turnon_irq(IRQ_MFP_FSCSI);
+ 	}
+-	if ((rv & SCSI_RESET_ACTION) == SCSI_RESET_SUCCESS)
++	if (rv == SUCCESS) 
+ 		falcon_release_lock_if_possible(hostdata);
+ 
+ 	return rv;
+--- l/drivers/scsi/atari_NCR5380.c.org	2007-05-18 18:24:38.000000000 +0200
++++ l/drivers/scsi/atari_NCR5380.c	2007-05-20 21:29:39.000000000 +0200
+@@ -475,12 +475,13 @@
+ 	int cnt = 1;
+ #endif
+ 
+-	for (endaddr = virt_to_phys(cmd->SCp.ptr + cmd->SCp.this_residual - 1) + 1;
+-	     cmd->SCp.buffers_residual &&
+-	     virt_to_phys(page_address(cmd->SCp.buffer[1].page) +
+-			  cmd->SCp.buffer[1].offset) == endaddr;) {
+-		MER_PRINTK("VTOP(%p) == %08lx -> merging\n",
+-			   page_address(cmd->SCp.buffer[1].page), endaddr);
++    for (endaddr = virt_to_phys(cmd->SCp.ptr + cmd->SCp.this_residual - 1) + 1;
++	 cmd->SCp.buffers_residual &&
++	 virt_to_phys(page_address(cmd->SCp.buffer[1].page)+
++		      cmd->SCp.buffer[1].offset) == endaddr; ) {
++	MER_PRINTK("VTOP(%p) == %08lx -> merging\n",
++		   page_address(cmd->SCp.buffer[1].page)+cmd->SCp.buffer[1].offset, 
++		   endaddr);
+ #if (NDEBUG & NDEBUG_MERGING)
+ 		++cnt;
+ #endif
+@@ -998,6 +999,35 @@
+ 		}
+ #endif
+ 
++	local_irq_save(flags);
++	/* ++guenther: now that the issue queue is being set up, we can lock ST-DMA.
++	 * Otherwise a running NCR5380_main may steal the lock.
++	 * Lock before actually inserting due to fairness reasons explained in
++	 * atari_scsi.c. If we insert first, then it's impossible for this driver
++	 * to release the lock.
++	 * Stop timer for this command while waiting for the lock, or timeouts
++	 * may happen (and they really do), and it's no good if the command doesn't
++	 * appear in any of the queues.
++	 * ++roman: Just disabling the NCR interrupt isn't sufficient here,
++	 * because also a timer int can trigger an abort or reset, which would
++	 * alter queues and touch the lock.
++	 */
++	if (!IS_A_TT()) {
++        	int rv;
++        	/* MSch: since we get called from softirq context here, and cannot 
++        	 * sleep safely, the return status of falcon_get_lock is now used to
++        	 * figure out if we could successfully lock, or need to bail out. 
++        	 * Signal the midlevel we're unable to queue the command in this case. 
++        	 */ 
++        	oldto = atari_scsi_update_timeout(cmd, 0);
++        	rv = falcon_get_lock();
++        	atari_scsi_update_timeout(cmd, oldto);
++        	if (rv) {
++        		local_irq_restore(flags);
++        		return SCSI_MLQUEUE_HOST_BUSY;
++		}
++	}
++
+ 	/*
+ 	 * We use the host_scribble field as a pointer to the next command
+ 	 * in a queue
+@@ -1015,24 +1045,6 @@
+ 	 * sense data is only guaranteed to be valid while the condition exists.
+ 	 */
+ 
+-	local_irq_save(flags);
+-	/* ++guenther: now that the issue queue is being set up, we can lock ST-DMA.
+-	 * Otherwise a running NCR5380_main may steal the lock.
+-	 * Lock before actually inserting due to fairness reasons explained in
+-	 * atari_scsi.c. If we insert first, then it's impossible for this driver
+-	 * to release the lock.
+-	 * Stop timer for this command while waiting for the lock, or timeouts
+-	 * may happen (and they really do), and it's no good if the command doesn't
+-	 * appear in any of the queues.
+-	 * ++roman: Just disabling the NCR interrupt isn't sufficient here,
+-	 * because also a timer int can trigger an abort or reset, which would
+-	 * alter queues and touch the lock.
+-	 */
+-	if (!IS_A_TT()) {
+-		oldto = atari_scsi_update_timeout(cmd, 0);
+-		falcon_get_lock();
+-		atari_scsi_update_timeout(cmd, oldto);
+-	}
+ 	if (!(hostdata->issue_queue) || (cmd->cmnd[0] == REQUEST_SENSE)) {
+ 		LIST(cmd, hostdata->issue_queue);
+ 		SET_NEXT(cmd, hostdata->issue_queue);
+@@ -1056,10 +1068,9 @@
+ 	 * If we're not in an interrupt, we can call NCR5380_main()
+ 	 * unconditionally, because it cannot be already running.
+ 	 */
+-	if (in_interrupt() || ((flags >> 8) & 7) >= 6)
+-		queue_main();
+-	else
+-		NCR5380_main(NULL);
++
++	queue_main();
++
+ 	return 0;
+ }
+ 
+@@ -2681,7 +2692,7 @@
+  *	host byte of the result field to, if zero DID_ABORTED is
+  *	used.
+  *
+- * Returns : 0 - success, -1 on failure.
++ * Returns : SUCCESS - success, FAILED on failure.
+  *
+  * XXX - there is no way to abort the command that is currently
+  *	 connected, you have to wait for it to complete.  If this is
+@@ -2751,11 +2762,11 @@
+ 			local_irq_restore(flags);
+ 			cmd->scsi_done(cmd);
+ 			falcon_release_lock_if_possible(hostdata);
+-			return SCSI_ABORT_SUCCESS;
++			return SUCCESS;
+ 		} else {
+ /*			local_irq_restore(flags); */
+ 			printk("scsi%d: abort of connected command failed!\n", HOSTNO);
+-			return SCSI_ABORT_ERROR;
++			return FAILED;
+ 		}
+ 	}
+ #endif
+@@ -2779,7 +2790,7 @@
+ 			 * yet... */
+ 			tmp->scsi_done(tmp);
+ 			falcon_release_lock_if_possible(hostdata);
+-			return SCSI_ABORT_SUCCESS;
++			return SUCCESS;
+ 		}
+ 	}
+ 
+@@ -2797,7 +2808,7 @@
+ 	if (hostdata->connected) {
+ 		local_irq_restore(flags);
+ 		ABRT_PRINTK("scsi%d: abort failed, command connected.\n", HOSTNO);
+-		return SCSI_ABORT_SNOOZE;
++		return FAILED;
+ 	}
+ 
+ 	/*
+@@ -2832,7 +2843,7 @@
+ 			ABRT_PRINTK("scsi%d: aborting disconnected command.\n", HOSTNO);
+ 
+ 			if (NCR5380_select(instance, cmd, (int)cmd->tag))
+-				return SCSI_ABORT_BUSY;
++				return FAILED;
+ 
+ 			ABRT_PRINTK("scsi%d: nexus reestablished.\n", HOSTNO);
+ 
+@@ -2859,7 +2870,7 @@
+ 					local_irq_restore(flags);
+ 					tmp->scsi_done(tmp);
+ 					falcon_release_lock_if_possible(hostdata);
+-					return SCSI_ABORT_SUCCESS;
++					return SUCCESS;
+ 				}
+ 			}
+ 		}
+@@ -2885,7 +2896,7 @@
+ 	 */
+ 	falcon_release_lock_if_possible(hostdata);
+ 
+-	return SCSI_ABORT_NOT_RUNNING;
++	return SUCCESS;
+ }
+ 
+ 
+@@ -2894,7 +2905,7 @@
+  *
+  * Purpose : reset the SCSI bus.
+  *
+- * Returns : SCSI_RESET_WAKEUP
++ * Returns : SUCCESS
+  *
+  */
+ 
+@@ -2984,7 +2995,7 @@
+ 	 * the midlevel code that the reset was SUCCESSFUL, and there is no
+ 	 * need to 'wake up' the commands by a request_sense
+ 	 */
+-	return SCSI_RESET_SUCCESS | SCSI_RESET_BUS_RESET;
++	return SUCCESS;
+ #else /* 1 */
+ 
+ 	/* MSch: new-style reset handling: let the mid-level do what it can */
+@@ -3032,6 +3043,6 @@
+ 	local_irq_restore(flags);
+ 
+ 	/* we did no complete reset of all commands, so a wakeup is required */
+-	return SCSI_RESET_WAKEUP | SCSI_RESET_BUS_RESET;
++	return SUCCESS;
+ #endif /* 1 */
+ }

Added: dists/sid/linux-2.6/debian/patches/bugfix/m68k/debian-2.6.21-2-rom-isa.diff
==============================================================================
--- (empty file)
+++ dists/sid/linux-2.6/debian/patches/bugfix/m68k/debian-2.6.21-2-rom-isa.diff	Mon May 21 19:39:35 2007
@@ -0,0 +1,84 @@
+--- l/include/asm-m68k/io.h.org	2007-05-18 18:24:41.000000000 +0200
++++ l/include/asm-m68k/io.h	2007-05-18 21:57:22.000000000 +0200
+@@ -245,9 +245,16 @@
+ #if defined(CONFIG_ATARI_ROM_ISA)
+ #define isa_rom_inb(port)      rom_in_8(isa_itb(port))
+ #define isa_rom_inw(port)      (ISA_SEX ? rom_in_be16(isa_itw(port)) : rom_in_le16(isa_itw(port)))
++#define isa_rom_inl(port)      (ISA_SEX ? rom_in_be32(isa_itw(port)) : rom_in_le32(isa_itw(port)))
+ 
+ #define isa_rom_outb(val,port) rom_out_8(isa_itb(port),(val))
+ #define isa_rom_outw(val,port) (ISA_SEX ? rom_out_be16(isa_itw(port),(val)) : rom_out_le16(isa_itw(port),(val)))
++#define isa_rom_outl(val,port) (ISA_SEX ? rom_out_be32(isa_itw(port),(val)) : rom_out_le32(isa_itw(port),(val)))
++
++#define isa_rom_readb(p)       rom_in_8(isa_mtb((unsigned long)(p)))
++#define isa_rom_readw(p)       \
++	(ISA_SEX ? rom_in_be16(isa_mtw((unsigned long)(p)))	\
++		 : rom_in_le16(isa_mtw((unsigned long)(p))))
+ 
+ #define isa_rom_writeb(val,p)  rom_out_8(isa_mtb((unsigned long)(p)),(val))
+ #define isa_rom_writew(val,p)  \
+@@ -315,12 +322,20 @@
+        (ISA_SEX ? raw_rom_insw(isa_itw(port), (u16 *)(buf), (nr)) :    \
+                   raw_rom_insw_swapw(isa_itw(port), (u16 *)(buf), (nr)))
+ 
++#define isa_rom_insl(port, buf, nr)     \
++       (ISA_SEX ? raw_rom_insl(isa_itw(port), (u32 *)(buf), (nr)) :    \
++                  raw_rom_insw_swapw(isa_itw(port), (u16 *)(buf), (nr)<<1))
++
+ #define isa_rom_outsb(port, buf, nr) raw_rom_outsb(isa_itb(port), (u8 *)(buf), (nr))
+ 
+ #define isa_rom_outsw(port, buf, nr)    \
+        (ISA_SEX ? raw_rom_outsw(isa_itw(port), (u16 *)(buf), (nr)) :  \
+                   raw_rom_outsw_swapw(isa_itw(port), (u16 *)(buf), (nr)))
+ 
++#define isa_rom_outsl(port, buf, nr)    \
++       (ISA_SEX ? raw_rom_outsl(isa_itw(port), (u32 *)(buf), (nr)) :  \
++                  raw_rom_outsw_swapw(isa_itw(port), (u16 *)(buf), (nr)<<1))
++
+ #endif
+ 
+ #endif  /* CONFIG_ISA */
+@@ -421,8 +436,16 @@
+ 
+ #define insb    isa_rom_insb
+ #define insw    isa_rom_insw
++#define insl    isa_rom_insl
+ #define outsb   isa_rom_outsb
+ #define outsw   isa_rom_outsw
++#define outsl   isa_rom_outsl
++
++#define readb   isa_readb
++#define readw   isa_readw
++#define writeb  isa_writeb
++#define writew  isa_writew
++
+ #endif
+ 
+ #if !defined(CONFIG_ISA) && !defined(CONFIG_PCI) && !defined(CONFIG_ATARI_ROM_ISA)
+--- l/include/asm-m68k/raw_io.h.org	2007-05-18 18:24:41.000000000 +0200
++++ l/include/asm-m68k/raw_io.h	2007-05-19 08:58:33.000000000 +0200
+@@ -436,6 +436,24 @@
+ 	for (i = 0; i < nr; i++)
+ 		rom_out_le16(port, *buf++);
+ }
++
++static inline void raw_rom_insl(volatile u16 __iomem *port, u32 *buf,
++				   unsigned int nr)
++{
++	unsigned int i;
++
++	for (i = 0; i < nr; i++)
++		*buf++ = rom_in_be32(port);
++}
++
++static inline void raw_rom_outsl(volatile u16 __iomem *port, const u32 *buf,
++				   unsigned int nr)
++{
++	unsigned int i;
++
++	for (i = 0; i < nr; i++)
++		rom_out_be32(port, *buf++);
++}
+ #endif /* CONFIG_ATARI_ROM_ISA */
+ 
+ #endif /* __KERNEL__ */



More information about the Kernel-svn-changes mailing list