public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Linux-2.5.18
@ 2002-05-25  2:02 Linus Torvalds
  2002-05-27  9:34 ` [PATCH] 2.5.18 IDE 71 Martin Dalecki
                   ` (6 more replies)
  0 siblings, 7 replies; 48+ messages in thread
From: Linus Torvalds @ 2002-05-25  2:02 UTC (permalink / raw)
  To: Kernel Mailing List


Various bits here and there. 

		Linus

----

Summary of changes from v2.5.17 to v2.5.18
============================================

<Andries.Brouwer@cwi.nl>
	o usb-storage

<acme@conectiva.com.br>
	o drivers/char/rio/*.c

<beattie@beattie-home.net>
	o change USB scanner maintainer

Brian Gerst <bgerst@didntduck.org>
	o cpu_has_tsc
	o cpu_has_mmx
	o remaining cpu_has cleanups

<borisitk@fortunet.com>
	o [ARM 1146/1: Fix complilation bug in 2.5.10-rmk1 for jffs

<ccaputo@alt.net>
	o net/core/sock.c: Fix typo in sysctl_{w,m}mem_default init.

<ch@hpl.hp.com>
	o [ARM 1136/1: missing include in badge4.c
	o [ARM 1133/1: Small fixes for BadgePAD 4 pcmcia support.
	o [ARM 1137/1: additional defines for SA-1111 OHCI

<colin@gibbs.dhs.org>
	o Sparc: Do not BUG in srmmu_pte_alloc_one.
	o include/asm-sparc/pgalloc.h: In pmd_alloc_one, dont BUG just return NULL

Martin Dalecki <dalecki@evision-ventures.com>
	o 2.5.17 dquota punishment
	o 2.5.17 IDE 65-70

<davem@nuts.ninka.net>
	o Sparc: Use dma_addr_t and size_t in sparc32 DMA function args.
	o IPv4: Make pkt_too_big debug msg more informative.
	o drivers/net/sunlance.c: Make init_block_dvma a dma_addr_t
	o Tigon3: Fix typo in netgear ga320t support changes.
	o Sparc64 updates
	o Fix build fallout from namei.h/jiffies.h changes.
	o Sparc64 build fixes:

<david-b@pacbell.net>
	o cpia_usb, remove urb->next
	o usbcore, remove urb->next
	o hcds, remove urb->next
	o audio, set urb->interval

<dhowells@redhat.com>
	o rwsem update

<greg@kroah.com>
	o USB Makefile bug fix
	o USB build changes
	o USB se401, remove urb->next usage
	o USB stv680, remove urb->next usage
	o usb.h #include dependancies and whitespace cleanup
	o USB cdc-ether driver compile time fix
	o USB storage #include fixup
	o USB driver #include cleanups

Christoph Hellwig <hch@infradead.org>
	o fix bitop warnings in parallel port generic driver
	o buffermem_pages removal (1/5)
	o fix sr compile warnings
	o bfs header move around + warning fix
	o split namei.h out of fs.h
	o include buffer_head.h in actual users instead of fs.h (1/10)

<jbglaw@lug-owl.de>
	o Update to srm_env.c driver (for Alpha arch.)

<kai@tp1.ruhr-uni-bochum.de>
	o kbuild: Make USE_STANDARD_AS_RULE default
	o Fix UTS_MACHINE
	o Fix building .i / .s files for testing
	o kbuild: Stop immediately on error
	o kbuild: aic7xxx firmware build should not overwrite shipped files
	o kbuild: Regenerate include/linux/version.h only if necessary
	o kbuild: Restore build nr, improve vmlinux link
	o drivers/net: Simplify linking of subdirs
	o Simplify linking/building objects in subdirectories
	o drivers/pnp/pnpbios_core.c: Warning fix
	o kbuild: Fix command line printing
	o kbuild: Fix warning when .version doesn't exist yet
	o kbuild: Rearrange Rules.make
	o kbuild: Consistent use of [AC]FLAGS_KERNEL and MODFLAGS
	o EXPORT_SYMBOL: Remove EXPORT_NO_SYMBOLS from arch/*
	o EXPORT_SYMBOL: Remove EXPORT_NO_SYMBOLS from drivers/*
	o EXPORT_SYMBOL: Remove the option of implicitly exporting symbols
	o EXPORT_SYMBOL: Remove EXPORT_NO_SYMBOLS from fs/*
	o EXPORT_SYMBOL: Remove EXPORT_NO_SYMBOLS from net/*
	o EXPORT_SYMBOL: Remove EXPORT_NO_SYMBOLS from sound/*
	o kbuild: Use standard multi-part object declaration in drivers/char/*
	o ISDN: Fix compiler warnings
	o kbuild: Use standard multi-part object declaration in drivers/video/*
	o kbuild: Small cleanups
	o ISDN: Use 'built-in.o' instead of 'vmlinux-obj.o' as O_TARGET
	o ISDN: Move AVM Config.help entries to right dir
	o kbuild: Assorted small cleanups
	o Fix dummy gameport_{,un}register_port
	o Compiler warning fixes
	o kbuild: Clean up sound/*/Makefile
	o Add missing includes
	o kbuild: Remove now redundant 'O_TARGET := built-in.o' lines
	o kbuild: Make O_TARGET default to 'built-in.o'
	o kbuild: Beautify ACPI Makefiles
	o kbuild: Remove usage of L_TARGET in drivers/*
	o kbuild: Correct dependencies for generated soundmodem tables
	o kbuild: Use standard multi-part object declaration in lib/*
	o kbuild: Simplify linking subdirs in drivers/*/Makefile
	o kbuild: Use standard multi-part object declaration in fs/*
	o kbuild: Use standard multi-part object declaration in net/*
	o kbuild: Fix some issues I missed before

<kuznet@ms2.inr.ac.ru>
	o tcp_input.c: Really make sure rto = 3*rtt, found by Pasi Sarolahti
	o tcp_recvmsg: Fix application bug induced races with MSG_PEEK and copied_seq.

<mason@suse.com>
	o reiserfs 64 bit bug in get_virtual_node_size

<mikpe@csd.uu.se>
	o possible fix for broken floppy driver, take 2

<pavel@ucw.cz>
	o suspend-to-{RAM,disk} fixup
	o suspend-to-{RAM,disk}
	o more suspend-to-{RAM,disk} fixes
	o One more fix for swsusp
	o swsusp cleanups
	o swsusp: making myself maintainer
	o swsusp fixes

<petkan@mastika.lnxw.com>
	o USB pegasus driver, new vendor and device id.

<rmk@flint.arm.linux.org.uk>
	o [ARM] 2.5.15 PCI cleanups/fixups
	o [ARM] 2.5.15 random fixups:
	o [ARM] Make etherh.c build again - combine struct ei_device inside our
	o [ARM] Fix build errors caused by fb changes
	o [ARM] Fixups for GCC 3.x:
	o [ARM] Miscellaneous
	o [ARM] Remove old NetWinder uncompressed kernel image compatibility code.
	o [ARM] Acorn DMA/Expansion card fixups
	o [ARM] Make Acorn SCSI drivers build again.

<rml@tech9.net>
	o remove preempt_disable from pdflush
	o get/put_cpu methods

<rusty@rustcorp.com.au>
	o Tasklet cleanup
	o Futex update.
	o DMA-mapping.txt typo fix
	o printk() cleanup in ide-pnp.c
	o drivers/net/epic100.c: missing __devinit
	o drivers_net_sundance.c: missing __devinit
	o declance.c
	o Remove warning in fs/nfs/nfsroot.c
	o Fix order of #includes in init_version.c
	o check_region elimination
	o serial typo
	o MIPS min/max replacement
	o MIPS min/max replacement II
	o min/max elimination in netfilter.h
	o cris signal fix
	o sigio delivery fix
	o check_region elimination
	o MIPS/MIPS64  signal fix
	o jiffies.h
	o arch/arm/kernel/via82c505.c
	o smp_call_function doco fix
	o check_region elimination
	o check_region elimination

<shaggy@austin.ibm.com>
	o jfs_readdir does not need to grab BKL
	o JFS external journal support

<simonb@lipsyncpost.co.uk>
	o Tigon3: Add Netgear GA320T support.

<torvalds@transmeta.com>
	o Make the pte unmapping atomic wrt other threads.
	o Fix over-eager header file cleanup
	o Merge DRI CVS tree into standard kernel
	o Fix up more headers to make the drm merge compile more cleanly
	o Undo block devices changes from floppy fix: incorrect.
	o Update kernel version
	o Move check_pgt_cache() to tlb_finish_mmu().
	o Make sw-suspend compile even without ACPI sleep support.
	o Clean up tlb_start/end_vma.
	o Fix up header file

Alexander Viro <viro@math.psu.edu>
	o add proper ->getattr()
	o remove s390 procfs abuses
	o kill ->i_op->revalidate()
	o clean up readdir() for in-memory
	o new helpers for /proc
	o rd.c blocksize handling
	o removal of BKL from d_move()
	o md.c cleanup
	o kdev_t -> bdev cleanups

<zippel@linux-m68k.org>
	o m68k mmu update



^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] 2.5.18 IDE 71
  2002-05-25  2:02 Linux-2.5.18 Linus Torvalds
@ 2002-05-27  9:34 ` Martin Dalecki
  2002-05-28 14:23 ` Linux-2.5.18 Martin Dalecki
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 48+ messages in thread
From: Martin Dalecki @ 2002-05-27  9:34 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 1874 bytes --]

Fri May 24 17:50:44 CEST 2002 ide-clean-71

- Rewritten Artop host chip driver by Vojtech Pavlik. His log entries are:

   Cleanup whitespace.

   Remove superfluous chip entries in chip table.  Remove global variables to
   allow more than one controller.  Remove other forgotten stuff.

   This is a new driver for the Artop (Acard) controllers. It's completely
   untested, as I have never seen the hardware. However, I suspect it is much
   less broken than the previous one ...

   UDMA33 controller cannot detect 80-wire cable.

- Separate ioctl handling out from ide.c. It's big enough.

- Move atapi_read and atapi_write to the new atapi module.  Fix the declaration
   of those functions. The data buffer did have the void * type!

- Separate module handling code out from actual transfer handling code in to a
   new module called main.c. Slowly we are at the stage where the code indeed
   has to be organized logically and not just "sporadically" as was the case
   before.

- Apply patch by Adam Richter for the ide-scsi.c attach method implementation.
   This particular driver is still broken due to generic SCSI layer issues.

- Apply true modularization patch for qd65xx.c by Samuel Thibault. Here
   are his notes about it:

   Then, patch-modularize-2.[45] is a proposal for modularizing qd65xx.o. As a
   single module, one can choose to insmod it before being able to do some
   hdparm -p /dev/hd[a-d]. But one can't remove it while tuned, since selectproc
   may be needed.

   I am sorry I wasn't able to test it under 2.5 series, lacking a functionning
   kernel for my test computer, but it seemed to work perfectly under 2.4
   series, and patches are almost the same.

- Move PCI device id's to where they belong. Patch by Vojtech Pavlik.

- Don't use BH_Lock in ide-tape.c - somehow this driver scares me sometimes.

Scary big patch this time...

[-- Attachment #2: ide-clean-71.diff.gz --]
[-- Type: application/x-gzip, Size: 44017 bytes --]

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: Linux-2.5.18
  2002-05-25  2:02 Linux-2.5.18 Linus Torvalds
  2002-05-27  9:34 ` [PATCH] 2.5.18 IDE 71 Martin Dalecki
@ 2002-05-28 14:23 ` Martin Dalecki
  2002-05-28 15:31 ` [PATCH] airo Martin Dalecki
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 48+ messages in thread
From: Martin Dalecki @ 2002-05-28 14:23 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 549 bytes --]


Mon May 27 12:37:58 CEST 2002 ide-clean-72

- Replace ide_delay_50m with mdelay(50). There is absolutely no reason we
   should behave different behaviors whatever IDECS support is enabled or not.

- Kill last parameter of ide_register_hw(). It should return a pointer to the
   interface registered later.

- pdc202xx patches by Bartomiej onierkiewicz.

- ServerWorks chi pset support cleanup by Andrej Panin.

- Move temporarily ide_setup_ports to main.c unfold it in ide-pnp.c.

I'm trying again to make the patch chunks a bit more palatable...

[-- Attachment #2: ide-clean-72.diff --]
[-- Type: text/plain, Size: 52417 bytes --]

diff -urN linux-2.5.18/drivers/ide/buddha.c linux/drivers/ide/buddha.c
--- linux-2.5.18/drivers/ide/buddha.c	2002-05-25 03:55:25.000000000 +0200
+++ linux/drivers/ide/buddha.c	2002-05-27 16:06:44.000000000 +0200
@@ -202,9 +202,9 @@
 						xsurf_offsets, 0,
 						(ide_ioreg_t)(buddha_board+xsurf_irqports[i]),
 						xsurf_ack_intr, IRQ_AMIGA_PORTS);
-			}	
-			
-			index = ide_register_hw(&hw, NULL);
+			}
+
+			index = ide_register_hw(&hw);
 			if (index != -1) {
 				printk("ide%d: ", index);
 				switch(type) {
diff -urN linux-2.5.18/drivers/ide/falconide.c linux/drivers/ide/falconide.c
--- linux-2.5.18/drivers/ide/falconide.c	2002-05-25 03:55:25.000000000 +0200
+++ linux/drivers/ide/falconide.c	2002-05-27 16:06:54.000000000 +0200
@@ -60,7 +60,7 @@
 
 	ide_setup_ports(&hw, (ide_ioreg_t)ATA_HD_BASE, falconide_offsets,
 			0, 0, NULL, IRQ_MFP_IDE);
-	index = ide_register_hw(&hw, NULL);
+	index = ide_register_hw(&hw);
 
 	if (index != -1)
 	    printk("ide%d: Falcon IDE interface\n", index);
diff -urN linux-2.5.18/drivers/ide/gayle.c linux/drivers/ide/gayle.c
--- linux-2.5.18/drivers/ide/gayle.c	2002-05-25 03:55:21.000000000 +0200
+++ linux/drivers/ide/gayle.c	2002-05-27 16:06:00.000000000 +0200
@@ -150,7 +150,7 @@
 	ide_setup_ports(&hw, base, gayle_offsets,
 			ctrlport, irqport, ack_intr, IRQ_AMIGA_PORTS);
 
-	index = ide_register_hw(&hw, NULL);
+	index = ide_register_hw(&hw);
 	if (index != -1) {
 	    switch (i) {
 		case 0:
diff -urN linux-2.5.18/drivers/ide/ide.c linux/drivers/ide/ide.c
--- linux-2.5.18/drivers/ide/ide.c	2002-05-28 17:15:53.000000000 +0200
+++ linux/drivers/ide/ide.c	2002-05-28 13:21:53.000000000 +0200
@@ -151,6 +151,12 @@
 	return ret;
 }
 
+/* This is the default end request function as well */
+int ide_end_request(struct ata_device *drive, struct request *rq, int uptodate)
+{
+	return __ide_end_request(drive, rq, uptodate, 0);
+}
+
 /*
  * This should get invoked any time we exit the driver to
  * wait for an interrupt response from a drive.  handler() points
@@ -508,7 +514,7 @@
 	printk("} ");
 }
 #else
-#define ata_dump_bits(msgs,nr,bits) do { } while (0)
+# define ata_dump_bits(msgs,nr,bits) do { } while (0)
 #endif
 
 /*
@@ -1517,36 +1523,6 @@
 	return 0;
 }
 
-/*
- * Setup hw_regs_t structure described by parameters.  You
- * may set up the hw structure yourself OR use this routine to
- * do it for you.
- */
-void ide_setup_ports(hw_regs_t *hw,
-		ide_ioreg_t base, int *offsets,
-		ide_ioreg_t ctrl, ide_ioreg_t intr,
-		ide_ack_intr_t *ack_intr, int irq)
-{
-	int i;
-
-	for (i = 0; i < IDE_NR_PORTS; i++) {
-		if (offsets[i] != -1)
-			hw->io_ports[i] = base + offsets[i];
-		else
-			hw->io_ports[i] = 0;
-	}
-	if (offsets[IDE_CONTROL_OFFSET] == -1)
-		hw->io_ports[IDE_CONTROL_OFFSET] = ctrl;
-/* FIMXE: check if we can remove this ifdef */
-#if defined(CONFIG_AMIGA) || defined(CONFIG_MAC)
-	if (offsets[IDE_IRQ_OFFSET] == -1)
-		hw->io_ports[IDE_IRQ_OFFSET] = intr;
-#endif
-	hw->irq = irq;
-	hw->dma = NO_DMA;
-	hw->ack_intr = ack_intr;
-}
-
 int ide_spin_wait_hwgroup(struct ata_device *drive)
 {
 	/* FIXME: Wait on a proper timer. Instead of playing games on the
@@ -1572,24 +1548,6 @@
 	return 0;
 }
 
-/*
- * Delay for *at least* 50ms.  As we don't know how much time is left
- * until the next tick occurs, we wait an extra tick to be safe.
- * This is used only during the probing/polling for drives at boot time.
- *
- * However, its usefullness may be needed in other places, thus we export it now.
- * The future may change this to a millisecond setable delay.
- */
-void ide_delay_50ms (void)
-{
-#ifndef CONFIG_BLK_DEV_IDECS
-	mdelay(50);
-#else
-	__set_current_state(TASK_UNINTERRUPTIBLE);
-	schedule_timeout(HZ/20);
-#endif
-}
-
 static int ide_check_media_change(kdev_t i_rdev)
 {
 	struct ata_device *drive;
@@ -1638,12 +1596,6 @@
 		*p++ = '\0';
 }
 
-/* This is the default end request function as well */
-int ide_end_request(struct ata_device *drive, struct request *rq, int uptodate)
-{
-	return __ide_end_request(drive, rq, uptodate, 0);
-}
-
 struct block_device_operations ide_fops[] = {{
 	owner:			THIS_MODULE,
 	open:			ide_open,
@@ -1669,7 +1621,6 @@
 EXPORT_SYMBOL(ide_end_drive_cmd);
 EXPORT_SYMBOL(__ide_end_request);
 EXPORT_SYMBOL(ide_end_request);
-EXPORT_SYMBOL(ide_delay_50ms);
 EXPORT_SYMBOL(ide_stall_queue);
 
 EXPORT_SYMBOL(ide_setup_ports);
diff -urN linux-2.5.18/drivers/ide/ide-cs.c linux/drivers/ide/ide-cs.c
--- linux-2.5.18/drivers/ide/ide-cs.c	2002-05-25 03:55:23.000000000 +0200
+++ linux/drivers/ide/ide-cs.c	2002-05-27 16:06:29.000000000 +0200
@@ -233,7 +233,8 @@
         ide_init_hwif_ports(&hw, (ide_ioreg_t) arg1, (ide_ioreg_t) arg2, NULL);
         hw.irq = irq;
         hw.chipset = ide_pci; /* this enables IRQ sharing w/ PCI irqs */
-        return ide_register_hw(&hw, NULL);
+
+        return ide_register_hw(&hw);
 }
 
 void ide_config(dev_link_t *link)
diff -urN linux-2.5.18/drivers/ide/ide-features.c linux/drivers/ide/ide-features.c
--- linux-2.5.18/drivers/ide/ide-features.c	2002-05-25 03:55:28.000000000 +0200
+++ linux/drivers/ide/ide-features.c	2002-05-28 13:23:56.000000000 +0200
@@ -189,17 +189,19 @@
 	SELECT_MASK(drive->channel, drive, 1);
 	if (IDE_CONTROL_REG)
 		OUT_BYTE(drive->ctl,IDE_CONTROL_REG);
-	ide_delay_50ms();
+	mdelay(50);
 	OUT_BYTE(WIN_IDENTIFY, IDE_COMMAND_REG);
 	timeout = jiffies + WAIT_WORSTCASE;
 	do {
-		if (0 < (signed long)(jiffies - timeout)) {
+		if (time_after(jiffies, timeout)) {
 			SELECT_MASK(drive->channel, drive, 0);
 			return 0;	/* drive timed-out */
 		}
-		ide_delay_50ms();	/* give drive a breather */
+		mdelay(50);	/* give drive a breather */
 	} while (IN_BYTE(IDE_ALTSTATUS_REG) & BUSY_STAT);
-	ide_delay_50ms();	/* wait for IRQ and DRQ_STAT */
+
+	mdelay(50);	/* wait for IRQ and DRQ_STAT */
+
 	if (!OK_STAT(GET_STAT(),DRQ_STAT,BAD_R_STAT)) {
 		SELECT_MASK(drive->channel, drive, 0);
 		printk("%s: CHECK for good STATUS\n", drive->name);
diff -urN linux-2.5.18/drivers/ide/ide-pci.c linux/drivers/ide/ide-pci.c
--- linux-2.5.18/drivers/ide/ide-pci.c	2002-05-28 17:15:53.000000000 +0200
+++ linux/drivers/ide/ide-pci.c	2002-05-28 11:19:39.000000000 +0200
@@ -351,7 +351,7 @@
 		base = port ? 0x170 : 0x1f0;
 
 	if ((ch = lookup_channel(base, d->bootable, dev->name)) == NULL)
-		return -ENOMEM;	/* no room in ide_hwifs[] */
+		return -ENOMEM;	/* no room */
 
 	if (ch->io_ports[IDE_DATA_OFFSET] != base) {
 		ide_init_hwif_ports(&ch->hw, base, (ctl | 2), NULL);
diff -urN linux-2.5.18/drivers/ide/ide-pnp.c linux/drivers/ide/ide-pnp.c
--- linux-2.5.18/drivers/ide/ide-pnp.c	2002-05-28 17:15:53.000000000 +0200
+++ linux/drivers/ide/ide-pnp.c	2002-05-28 12:44:00.000000000 +0200
@@ -32,29 +32,6 @@
 
 #define DEV_NAME(dev) (dev->bus->name ? dev->bus->name : "ISA PnP")
 
-enum {
-	GENERIC_HD_DATA,
-	GENERIC_HD_ERROR,
-	GENERIC_HD_NSECTOR,
-	GENERIC_HD_SECTOR,
-	GENERIC_HD_LCYL,
-	GENERIC_HD_HCYL,
-	GENERIC_HD_SELECT,
-	GENERIC_HD_STATUS
-};
-
-static int generic_ide_offsets[IDE_NR_PORTS] __initdata = {
-	GENERIC_HD_DATA,
-	GENERIC_HD_ERROR,
-	GENERIC_HD_NSECTOR,
-	GENERIC_HD_SECTOR,
-	GENERIC_HD_LCYL,
-	GENERIC_HD_HCYL,
-	GENERIC_HD_SELECT,
-	GENERIC_HD_STATUS,
-	-1, -1
-};
-
 /* ISA PnP device table entry */
 struct pnp_dev_t {
 	unsigned short card_vendor, card_device, vendor, device;
@@ -65,8 +42,8 @@
 static int __init pnpide_generic_init(struct pci_dev *dev, int enable)
 {
 	hw_regs_t hw;
-	struct ata_channel *hwif;
 	int index;
+	int i;
 
 	if (!enable)
 		return 0;
@@ -74,15 +51,24 @@
 	if (!(DEV_IO(dev, 0) && DEV_IO(dev, 1) && DEV_IRQ(dev, 0)))
 		return 1;
 
-	ide_setup_ports(&hw, (ide_ioreg_t) DEV_IO(dev, 0),
-			generic_ide_offsets, (ide_ioreg_t) DEV_IO(dev, 1),
-			0, NULL, DEV_IRQ(dev, 0));
+	/* Initialize register access base values. */
+	for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; ++i)
+		hw.io_ports[i] = DEV_IO(dev, 0) + i;
+	hw.io_ports[IDE_CONTROL_OFFSET] = DEV_IO(dev, 1);
+
+	hw.irq = DEV_IRQ(dev, 0);
+	hw.dma = NO_DMA;
+	hw.ack_intr = NULL;
 
-	index = ide_register_hw(&hw, &hwif);
+	index = ide_register_hw(&hw);
 
 	if (index != -1) {
-		hwif->pci_dev = dev;
+		struct ata_channel *ch;
+
+		ch = &ide_hwifs[index];
+		ch->pci_dev = dev;
 		printk(KERN_INFO "ide%d: %s IDE interface\n", index, DEV_NAME(dev));
+
 		return 0;
 	}
 
diff -urN linux-2.5.18/drivers/ide/ide-probe.c linux/drivers/ide/ide-probe.c
--- linux-2.5.18/drivers/ide/ide-probe.c	2002-05-25 03:55:16.000000000 +0200
+++ linux/drivers/ide/ide-probe.c	2002-05-28 13:13:30.000000000 +0200
@@ -68,17 +68,7 @@
 	 * However let's try to get away with this...
 	 */
 
-#if 1
 	ata_read(drive, id, SECTOR_WORDS);
-#else
-        {
-                unsigned long   *ptr = (unsigned long *)id ;
-                unsigned long   lcount = 256/2 ;
-                // printk("IDE_DATA_REG = %#lx",IDE_DATA_REG);
-                while( lcount-- )
-                        *ptr++ = inl(IDE_DATA_REG);
-        }
-#endif
 	ide__sti();	/* local CPU only */
 	ide_fix_driveid(id);
 
@@ -248,7 +238,7 @@
 	rc = 1;
 	if (IDE_CONTROL_REG) {
 		/* take a deep breath */
-		ide_delay_50ms();
+		mdelay(50);
 		a = IN_BYTE(IDE_ALTSTATUS_REG);
 		s = IN_BYTE(IDE_STATUS_REG);
 		if ((a ^ s) & ~INDEX_STAT) {
@@ -258,7 +248,7 @@
 			hd_status = IDE_ALTSTATUS_REG;	/* use non-intrusive polling */
 		}
 	} else {
-		ide_delay_50ms();
+		mdelay(50);
 		hd_status = IDE_STATUS_REG;
 	}
 
@@ -281,10 +271,11 @@
 	do {
 		if (time_after(jiffies, timeout))
 			goto out;	/* drive timed-out */
-		ide_delay_50ms();		/* give drive a breather */
+		mdelay(50);		/* give drive a breather */
 	} while (IN_BYTE(hd_status) & BUSY_STAT);
 
-	ide_delay_50ms();		/* wait for IRQ and DRQ_STAT */
+	mdelay(50);		/* wait for IRQ and DRQ_STAT */
+
 	if (OK_STAT(GET_STAT(),DRQ_STAT,BAD_R_STAT)) {
 		unsigned long flags;
 		__save_flags(flags);	/* local CPU only */
@@ -345,13 +336,13 @@
 		drive->name, drive->present, drive->type,
 		(cmd == WIN_IDENTIFY) ? "ATA" : "ATAPI");
 #endif
-	ide_delay_50ms();	/* needed for some systems (e.g. crw9624 as drive0 with disk as slave) */
+	mdelay(50);	/* needed for some systems (e.g. crw9624 as drive0 with disk as slave) */
 	SELECT_DRIVE(hwif,drive);
-	ide_delay_50ms();
+	mdelay(50);
 	if (IN_BYTE(IDE_SELECT_REG) != drive->select.all && !drive->present) {
 		if (drive->select.b.unit != 0) {
 			SELECT_DRIVE(hwif,&hwif->drives[0]);	/* exit with drive0 selected */
-			ide_delay_50ms();		/* allow BUSY_STAT to assert & clear */
+			mdelay(50);		/* allow BUSY_STAT to assert & clear */
 		}
 		return 3;    /* no i/f present: mmm.. this should be a 4 -ml */
 	}
@@ -363,13 +354,13 @@
 		if (rc == 1 && cmd == WIN_PIDENTIFY && drive->autotune != 2) {
 			unsigned long timeout;
 			printk("%s: no response (status = 0x%02x), resetting drive\n", drive->name, GET_STAT());
-			ide_delay_50ms();
+			mdelay(50);
 			OUT_BYTE (drive->select.all, IDE_SELECT_REG);
-			ide_delay_50ms();
+			mdelay(50);
 			OUT_BYTE(WIN_SRST, IDE_COMMAND_REG);
 			timeout = jiffies;
 			while ((GET_STAT() & BUSY_STAT) && time_before(jiffies, timeout + WAIT_WORSTCASE))
-				ide_delay_50ms();
+				mdelay(50);
 			rc = identify(drive, cmd);
 		}
 		if (rc == 1)
@@ -380,7 +371,7 @@
 
 	if (drive->select.b.unit != 0) {
 		SELECT_DRIVE(hwif,&hwif->drives[0]);	/* exit with drive0 selected */
-		ide_delay_50ms();
+		mdelay(50);
 		(void) GET_STAT();		/* ensure drive irq is clear */
 	}
 	return rc;
@@ -392,7 +383,7 @@
 
 	printk("%s: enabling %s -- ", drive->channel->name, drive->id->model);
 	SELECT_DRIVE(drive->channel, drive);
-	ide_delay_50ms();
+	mdelay(50);
 	OUT_BYTE(EXABYTE_ENABLE_NEST, IDE_COMMAND_REG);
 	timeout = jiffies + WAIT_WORSTCASE;
 	do {
@@ -400,9 +391,9 @@
 			printk("failed (timeout)\n");
 			return;
 		}
-		ide_delay_50ms();
+		mdelay(50);
 	} while (GET_STAT() & BUSY_STAT);
-	ide_delay_50ms();
+	mdelay(50);
 	if (!OK_STAT(GET_STAT(), 0, BAD_STAT))
 		printk("failed (status = 0x%02x)\n", GET_STAT());
 	else
@@ -536,7 +527,7 @@
 		udelay(10);
 		OUT_BYTE(8, ch->io_ports[IDE_CONTROL_OFFSET]);
 		do {
-			ide_delay_50ms();
+			mdelay(50);
 			stat = IN_BYTE(ch->io_ports[IDE_STATUS_OFFSET]);
 		} while ((stat & BUSY_STAT) && time_before(jiffies, timeout));
 	}
diff -urN linux-2.5.18/drivers/ide/ide-taskfile.c linux/drivers/ide/ide-taskfile.c
--- linux-2.5.18/drivers/ide/ide-taskfile.c	2002-05-28 17:15:53.000000000 +0200
+++ linux/drivers/ide/ide-taskfile.c	2002-05-28 11:41:22.000000000 +0200
@@ -353,13 +353,20 @@
 
 	OUT_BYTE((args->taskfile.device_head & HIHI) | drive->select.all, IDE_SELECT_REG);
 	if (args->handler != NULL) {
+
+		/* This is apparently supposed to reset the wait timeout for
+		 * the interrupt to accur.
+		 */
+
 		ide_set_handler(drive, args->handler, WAIT_CMD, NULL);
 		OUT_BYTE(args->taskfile.command, IDE_COMMAND_REG);
+
 		/*
 		 * Warning check for race between handler and prehandler for
 		 * writing first block of data.  however since we are well
 		 * inside the boundaries of the seek, we should be okay.
 		 */
+
 		if (args->prehandler != NULL)
 			return args->prehandler(drive, rq);
 	} else {
@@ -579,7 +586,8 @@
 	return ide_started;
 }
 
-/* Called by ioctl to feature out type of command being called */
+/* Called to figure out the type of command being called.
+ */
 void ide_cmd_type_parser(struct ata_taskfile *args)
 {
 	struct hd_drive_task_hdr *taskfile = &args->taskfile;
diff -urN linux-2.5.18/drivers/ide/macide.c linux/drivers/ide/macide.c
--- linux-2.5.18/drivers/ide/macide.c	2002-05-25 03:55:19.000000000 +0200
+++ linux/drivers/ide/macide.c	2002-05-27 16:05:38.000000000 +0200
@@ -100,17 +100,17 @@
 	case MAC_IDE_QUADRA:
 		ide_setup_ports(&hw, (ide_ioreg_t)IDE_BASE, macide_offsets,
 				0, 0, macide_ack_intr, IRQ_NUBUS_F);
-		index = ide_register_hw(&hw, NULL);
+		index = ide_register_hw(&hw);
 		break;
 	case MAC_IDE_PB:
 		ide_setup_ports(&hw, (ide_ioreg_t)IDE_BASE, macide_offsets,
 				0, 0, macide_ack_intr, IRQ_NUBUS_C);
-		index = ide_register_hw(&hw, NULL);
+		index = ide_register_hw(&hw);
 		break;
 	case MAC_IDE_BABOON:
 		ide_setup_ports(&hw, (ide_ioreg_t)BABOON_BASE, macide_offsets,
 				0, 0, NULL, IRQ_BABOON_1);
-		index = ide_register_hw(&hw, NULL);
+		index = ide_register_hw(&hw);
 		if (index == -1) break;
 		if (macintosh_config->ident == MAC_MODEL_PB190) {
 
diff -urN linux-2.5.18/drivers/ide/main.c linux/drivers/ide/main.c
--- linux-2.5.18/drivers/ide/main.c	2002-05-28 17:15:53.000000000 +0200
+++ linux/drivers/ide/main.c	2002-05-28 12:44:05.000000000 +0200
@@ -133,6 +133,43 @@
  */
 struct ata_channel ide_hwifs[MAX_HWIFS];	/* master data repository */
 
+/*
+ * FIXME: This function should be unrolled in the palces where it get's used,
+ * since in reality it's simple architecture specific initialization.
+ *
+ * Setup hw_regs_t structure described by parameters.  You may set up the hw
+ * structure yourself OR use this routine to do it for you.
+ */
+void ide_setup_ports(hw_regs_t *hw,
+		ide_ioreg_t base,
+		int *offsets,
+		ide_ioreg_t ctrl,
+		ide_ioreg_t intr,
+		ide_ack_intr_t *ack_intr,
+		int irq)
+{
+	int i;
+
+	for (i = 0; i < IDE_NR_PORTS; i++) {
+		if (offsets[i] != -1)
+			hw->io_ports[i] = base + offsets[i];
+		else
+			hw->io_ports[i] = 0;
+	}
+	if (offsets[IDE_CONTROL_OFFSET] == -1)
+		hw->io_ports[IDE_CONTROL_OFFSET] = ctrl;
+
+	/* FIMXE: check if we can remove this ifdef */
+#if defined(CONFIG_AMIGA) || defined(CONFIG_MAC)
+	if (offsets[IDE_IRQ_OFFSET] == -1)
+		hw->io_ports[IDE_IRQ_OFFSET] = intr;
+#endif
+
+	hw->irq = irq;
+	hw->dma = NO_DMA;
+	hw->ack_intr = ack_intr;
+}
+
 static void init_hwif_data(struct ata_channel *ch, unsigned int index)
 {
 	static const unsigned int majors[] = {
@@ -148,15 +185,18 @@
 	memset(&hw, 0, sizeof(hw_regs_t));
 
 	/* fill in any non-zero initial values */
-	ch->index     = index;
+	ch->index = index;
 	ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, &ch->irq);
+
 	memcpy(&ch->hw, &hw, sizeof(hw));
 	memcpy(ch->io_ports, hw.io_ports, sizeof(hw.io_ports));
+
 	ch->noprobe	= !ch->io_ports[IDE_DATA_OFFSET];
 #ifdef CONFIG_BLK_DEV_HD
 	if (ch->io_ports[IDE_DATA_OFFSET] == HD_DATA)
 		ch->noprobe = 1; /* may be overridden by ide_setup() */
 #endif
+
 	ch->major = majors[index];
 	sprintf(ch->name, "ide%d", index);
 	ch->bus_state = BUSSTATE_ON;
@@ -576,7 +616,7 @@
  * Register an IDE interface, specifing exactly the registers etc
  * Set init=1 iff calling before probes have taken place.
  */
-int ide_register_hw(hw_regs_t *hw, struct ata_channel **hwifp)
+int ide_register_hw(hw_regs_t *hw)
 {
 	int h;
 	int retry = 1;
@@ -627,9 +667,6 @@
 			break;
 	}
 
-	if (hwifp)
-		*hwifp = ch;
-
 	return (initializing || ch->present) ? h : -1;
 }
 
diff -urN linux-2.5.18/drivers/ide/pdc202xx.c linux/drivers/ide/pdc202xx.c
--- linux-2.5.18/drivers/ide/pdc202xx.c	2002-05-25 03:55:30.000000000 +0200
+++ linux/drivers/ide/pdc202xx.c	2002-05-28 17:03:47.000000000 +0200
@@ -53,10 +53,6 @@
 #define PDC202XX_DEBUG_DRIVE_INFO		0
 #define PDC202XX_DECODE_REGISTER_INFO		0
 
-#ifndef SPLIT_BYTE
-#define SPLIT_BYTE(B,H,L)	((H)=(B>>4), (L)=(B-((B>>4)<<4)))
-#endif
-
 extern char *ide_xfer_verbose (byte xfer_rate);
 
 /* A Register */
@@ -67,103 +63,62 @@
 #define	IORDY_EN	0x20	/* PIO: IOREADY */
 #define	PREFETCH_EN	0x10	/* PIO: PREFETCH */
 
-#define	PA3		0x08	/* PIO"A" timing */
-#define	PA2		0x04	/* PIO"A" timing */
-#define	PA1		0x02	/* PIO"A" timing */
-#define	PA0		0x01	/* PIO"A" timing */
-
-/* B Register */
-
-#define	MB2		0x80	/* DMA"B" timing */
-#define	MB1		0x40	/* DMA"B" timing */
-#define	MB0		0x20	/* DMA"B" timing */
-
-#define	PB4		0x10	/* PIO_FORCE 1:0 */
-
-#define	PB3		0x08	/* PIO"B" timing */	/* PIO flow Control mode */
-#define	PB2		0x04	/* PIO"B" timing */	/* PIO 4 */
-#define	PB1		0x02	/* PIO"B" timing */	/* PIO 3 half */
-#define	PB0		0x01	/* PIO"B" timing */	/* PIO 3 other half */
-
-/* C Register */
-#define	IORDYp_NO_SPEED	0x4F
-#define	SPEED_DIS	0x0F
-
-#define	DMARQp		0x80
-#define	IORDYp		0x40
-#define	DMAR_EN		0x20
-#define	DMAW_EN		0x10
-
-#define	MC3		0x08	/* DMA"C" timing */
-#define	MC2		0x04	/* DMA"C" timing */
-#define	MC1		0x02	/* DMA"C" timing */
-#define	MC0		0x01	/* DMA"C" timing */
-
 #if PDC202XX_DECODE_REGISTER_INFO
 
-#define REG_A		0x01
-#define REG_B		0x02
-#define REG_C		0x04
-#define REG_D		0x08
+struct pdc_bit_messages {
+	u8 mask;
+	const char *msg;
+};
 
-static void decode_registers (byte registers, byte value)
+static struct pdc_bit_messages pdc_reg_A[] = {
+	{ 0x80, "SYNC_IN" },
+	{ 0x40, "ERRDY_EN" },
+	{ 0x20, "IORDY_EN" },
+	{ 0x10, "PREFETCH_EN" },
+	/* PA3-PA0 - PIO "A" timing */
+	{ 0x08, "PA3" },
+	{ 0x04, "PA2" },
+	{ 0x02, "PA1" },
+	{ 0x01, "PA0" }
+};
+
+static struct pdc_bit_messages pdc_reg_B[] = {
+	/* MB2-MB0 - DMA "B" timing */
+	{ 0x80, "MB2" },
+	{ 0x40, "MB1" },
+	{ 0x20, "MB0" },
+	{ 0x10, "PIO_FORCED/PB4" },	/* PIO_FORCE 1:0 */
+	/* PB3-PB0 - PIO "B" timing */
+	{ 0x08, "PB3" },		/* PIO flow Control mode */
+	{ 0x04, "PB2" },		/* PIO 4 */
+	{ 0x02, "PB1" },		/* PIO 3 half */
+	{ 0x01, "PB0" }			/* PIO 3 other half */
+};
+
+static struct pdc_bit_messages pdc_reg_C[] = {
+	{ 0x80, "DMARQp" },
+	{ 0x40, "IORDYp" },
+	{ 0x20, "DMAR_EN" },
+	{ 0x10, "DMAW_EN" },
+	/* MC3-MC0 - DMA "C" timing */
+	{ 0x08, "MC3" },
+	{ 0x04, "MC2" },
+	{ 0x02, "MC1" },
+	{ 0x01, "MC0" }
+};
+
+static void pdc_dump_bits(struct pdc_bit_messages *msgs, byte bits)
 {
-	byte	bit = 0, bit1 = 0, bit2 = 0;
+	int i;
 
-	switch(registers) {
-		case REG_A:
-			printk("A Register ");
-			if (value & 0x80) printk("SYNC_IN ");
-			if (value & 0x40) printk("ERRDY_EN ");
-			if (value & 0x20) printk("IORDY_EN ");
-			if (value & 0x10) printk("PREFETCH_EN ");
-			if (value & 0x08) { printk("PA3 ");bit2 |= 0x08; }
-			if (value & 0x04) { printk("PA2 ");bit2 |= 0x04; }
-			if (value & 0x02) { printk("PA1 ");bit2 |= 0x02; }
-			if (value & 0x01) { printk("PA0 ");bit2 |= 0x01; }
-			printk("PIO(A) = %d ", bit2);
-			break;
-		case REG_B:
-			printk("B Register ");
-			if (value & 0x80) { printk("MB2 ");bit1 |= 0x80; }
-			if (value & 0x40) { printk("MB1 ");bit1 |= 0x40; }
-			if (value & 0x20) { printk("MB0 ");bit1 |= 0x20; }
-			printk("DMA(B) = %d ", bit1 >> 5);
-			if (value & 0x10) printk("PIO_FORCED/PB4 ");
-			if (value & 0x08) { printk("PB3 ");bit2 |= 0x08; }
-			if (value & 0x04) { printk("PB2 ");bit2 |= 0x04; }
-			if (value & 0x02) { printk("PB1 ");bit2 |= 0x02; }
-			if (value & 0x01) { printk("PB0 ");bit2 |= 0x01; }
-			printk("PIO(B) = %d ", bit2);
-			break;
-		case REG_C:
-			printk("C Register ");
-			if (value & 0x80) printk("DMARQp ");
-			if (value & 0x40) printk("IORDYp ");
-			if (value & 0x20) printk("DMAR_EN ");
-			if (value & 0x10) printk("DMAW_EN ");
-
-			if (value & 0x08) { printk("MC3 ");bit2 |= 0x08; }
-			if (value & 0x04) { printk("MC2 ");bit2 |= 0x04; }
-			if (value & 0x02) { printk("MC1 ");bit2 |= 0x02; }
-			if (value & 0x01) { printk("MC0 ");bit2 |= 0x01; }
-			printk("DMA(C) = %d ", bit2);
-			break;
-		case REG_D:
-			printk("D Register ");
-			break;
-		default:
-			return;
-	}
-	printk("\n        %s ", (registers & REG_D) ? "DP" :
-				(registers & REG_C) ? "CP" :
-				(registers & REG_B) ? "BP" :
-				(registers & REG_A) ? "AP" : "ERROR");
-	for (bit=128;bit>0;bit/=2)
-		printk("%s", (value & bit) ? "1" : "0");
-	printk("\n");
-}
+	printk(KERN_DEBUG " { ");
+
+	for (i = 0; i < 8; i++, msgs++)
+		if (bits & msgs->mask)
+			printk(KERN_DEBUG "%s ", msgs->msg);
 
+	printk(KERN_DEBUG " }\n");
+}
 #endif /* PDC202XX_DECODE_REGISTER_INFO */
 
 int check_in_drive_lists(struct ata_device *drive)
@@ -222,13 +177,10 @@
 	byte			drive_pci, AP, BP, CP, DP;
 	byte			TA = 0, TB = 0, TC = 0;
 
-	switch (drive->dn) {
-		case 0: drive_pci = 0x60; break;
-		case 1: drive_pci = 0x64; break;
-		case 2: drive_pci = 0x68; break;
-		case 3: drive_pci = 0x6c; break;
-		default: return -1;
-	}
+	if (drive->dn > 3)
+		return -1;
+
+	drive_pci = 0x60 + (drive->dn << 2);
 
 	if ((drive->type != ATA_DISK) && (speed < XFER_SW_DMA_0))
 		return -1;
@@ -245,11 +197,8 @@
 			/* clear DMA modes of upper 842 bits of B Register */
 			/* clear PIO forced mode upper 1 bit of B Register */
 			pci_write_config_byte(dev, (drive_pci)|0x01, BP & ~0xF0);
-			pci_read_config_byte(dev, (drive_pci)|0x01, &BP);
-
 			/* clear DMA modes of lower 8421 bits of C Register */
 			pci_write_config_byte(dev, (drive_pci)|0x02, CP & ~0x0F);
-			pci_read_config_byte(dev, (drive_pci)|0x02, &CP);
 		}
 	} else {
 #else
@@ -258,14 +207,8 @@
 		if ((AP & 0x0F) || (BP & 0x07)) {
 			/* clear PIO modes of lower 8421 bits of A Register */
 			pci_write_config_byte(dev, (drive_pci), AP & ~0x0F);
-			pci_read_config_byte(dev, (drive_pci), &AP);
-
 			/* clear PIO modes of lower 421 bits of B Register */
 			pci_write_config_byte(dev, (drive_pci)|0x01, BP & ~0x07);
-			pci_read_config_byte(dev, (drive_pci)|0x01, &BP);
-
-			pci_read_config_byte(dev, (drive_pci), &AP);
-			pci_read_config_byte(dev, (drive_pci)|0x01, &BP);
 		}
 	}
 
@@ -277,17 +220,17 @@
 #ifdef CONFIG_BLK_DEV_IDEDMA
 		/* case XFER_UDMA_6: */
 		case XFER_UDMA_5:
-		case XFER_UDMA_4:	TB = 0x20; TC = 0x01; break;	/* speed 8 == UDMA mode 4 */
-		case XFER_UDMA_3:	TB = 0x40; TC = 0x02; break;	/* speed 7 == UDMA mode 3 */
-		case XFER_UDMA_2:	TB = 0x20; TC = 0x01; break;	/* speed 6 == UDMA mode 2 */
-		case XFER_UDMA_1:	TB = 0x40; TC = 0x02; break;	/* speed 5 == UDMA mode 1 */
-		case XFER_UDMA_0:	TB = 0x60; TC = 0x03; break;	/* speed 4 == UDMA mode 0 */
-		case XFER_MW_DMA_2:	TB = 0x60; TC = 0x03; break;	/* speed 4 == MDMA mode 2 */
-		case XFER_MW_DMA_1:	TB = 0x60; TC = 0x04; break;	/* speed 3 == MDMA mode 1 */
-		case XFER_MW_DMA_0:	TB = 0x60; TC = 0x05; break;	/* speed 2 == MDMA mode 0 */
-		case XFER_SW_DMA_2:	TB = 0x60; TC = 0x05; break;	/* speed 0 == SDMA mode 2 */
-		case XFER_SW_DMA_1:	TB = 0x80; TC = 0x06; break;	/* speed 1 == SDMA mode 1 */
-		case XFER_SW_DMA_0:	TB = 0xC0; TC = 0x0B; break;	/* speed 0 == SDMA mode 0 */
+		case XFER_UDMA_4:	TB = 0x20; TC = 0x01; break;
+		case XFER_UDMA_3:	TB = 0x40; TC = 0x02; break;
+		case XFER_UDMA_2:	TB = 0x20; TC = 0x01; break;
+		case XFER_UDMA_1:	TB = 0x40; TC = 0x02; break;
+		case XFER_UDMA_0:	TB = 0x60; TC = 0x03; break;
+		case XFER_MW_DMA_2:	TB = 0x60; TC = 0x03; break;
+		case XFER_MW_DMA_1:	TB = 0x60; TC = 0x04; break;
+		case XFER_MW_DMA_0:	TB = 0x60; TC = 0x05; break;
+		case XFER_SW_DMA_2:	TB = 0x60; TC = 0x05; break;
+		case XFER_SW_DMA_1:	TB = 0x80; TC = 0x06; break;
+		case XFER_SW_DMA_0:	TB = 0xC0; TC = 0x0B; break;
 #endif /* CONFIG_BLK_DEV_IDEDMA */
 		case XFER_PIO_4:	TA = 0x01; TB = 0x04; break;
 		case XFER_PIO_3:	TA = 0x02; TB = 0x06; break;
@@ -315,11 +258,18 @@
 	pci_read_config_byte(dev, (drive_pci)|0x02, &CP);
 	pci_read_config_byte(dev, (drive_pci)|0x03, &DP);
 
-	decode_registers(REG_A, AP);
-	decode_registers(REG_B, BP);
-	decode_registers(REG_C, CP);
-	decode_registers(REG_D, DP);
-#endif /* PDC202XX_DECODE_REGISTER_INFO */
+	printk(KERN_DEBUG "AP(%x): PIO(A) = %d\n", AP, AP & 0x0f);
+	pdc_dump_bits(pdc_reg_A, AP);
+
+	printk(KERN_DEBUG "BP(%x): DMA(B) = %d PIO(B) = %d\n",
+			  BP, (BP & 0xe0) >> 5, BP & 0x0f);
+	pdc_dump_bits(pdc_reg_B, BP);
+
+	printk(KERN_DEBUG "CP(%x): DMA(C) = %d\n", CP, CP & 0x0f);
+	pdc_dump_bits(pdc_reg_C, CP);
+
+	printk(KERN_DEBUG "DP(%x)\n", DP);
+#endif
 
 	if (!drive->init_speed)
 		drive->init_speed = speed;
@@ -352,8 +302,7 @@
 	unsigned long indexreg	= (hwif->dma_base + 1);
 	unsigned long datareg	= (hwif->dma_base + 3);
 #else
-	struct pci_dev *dev	= hwif->pci_dev;
-	unsigned long high_16	= pci_resource_start(dev, 4);
+	unsigned long high_16	= pci_resource_start(hwif->pci_dev, 4);
 	unsigned long indexreg	= high_16 + (hwif->unit ? 0x09 : 0x01);
 	unsigned long datareg	= (indexreg + 2);
 #endif /* CONFIG_BLK_DEV_IDEDMA */
@@ -473,6 +422,7 @@
 }
 
 #ifdef CONFIG_BLK_DEV_IDEDMA
+/* FIXME: split this for old & new chipsets (jumpbit) --bkz */
 static int config_chipset_for_dma(struct ata_device *drive, byte udma)
 {
 	struct hd_driveid *id	= drive->id;
@@ -483,19 +433,13 @@
 	unsigned long dma_base  = hwif->dma_base;
 	unsigned long indexreg	= dma_base + 1;
 	unsigned long datareg	= dma_base + 3;
-	byte iordy		= 0x13;
 	byte adj		= (drive->dn%2) ? 0x08 : 0x00;
-	byte cable		= 0;
 	byte jumpbit		= 0;
 	unsigned int		drive_conf;
-	byte drive_pci = 0, mate_pci = 0;
-	byte			test1, test2, mode = -1;
-	byte			AP;
-	unsigned short		EP;
+	byte drive_pci = 0, AP, tmp, mode = -1;
 	byte CLKSPD		= 0;
 	/* primary - second bit, secondary - fourth bit */
 	byte mask		= hwif->unit ? 0x08 : 0x02;
-	unsigned short c_mask	= hwif->unit ? (1<<11) : (1<<10);
 	int map;
 
 	byte needs_80w = ((id->dma_ultra & 0x0008) ||
@@ -504,24 +448,14 @@
 			  (id->dma_ultra & 0x0040));
 
 	switch(dev->device) {
-		case PCI_DEVICE_ID_PROMISE_20275:
-		case PCI_DEVICE_ID_PROMISE_20276:
-		case PCI_DEVICE_ID_PROMISE_20269:
-		case PCI_DEVICE_ID_PROMISE_20268R:
-		case PCI_DEVICE_ID_PROMISE_20268:
-			OUT_BYTE(0x0b, indexreg);
-			cable = ((IN_BYTE(datareg) & 0x04));
-			jumpbit = 1;
-			break;
 		case PCI_DEVICE_ID_PROMISE_20267:
 		case PCI_DEVICE_ID_PROMISE_20265:
 		case PCI_DEVICE_ID_PROMISE_20262:
-			pci_read_config_word(dev, 0x50, &EP);
-			cable = (EP & c_mask);
+		case PCI_DEVICE_ID_PROMISE_20246:
 			jumpbit = 0;
 			break;
-		default:
-			cable = 1; jumpbit = 0;
+		default: /* chipsets newer then 20268 */
+			jumpbit = 1;
 			break;
 	}
 
@@ -541,7 +475,7 @@
 	 */
 	if (needs_80w) {
 		/* FIXME: this check is wrong for 20246 --bkz */
-		if (cable) {
+		if (!hwif->udma_four) {
 			printk(KERN_WARNING "%s: channel requires an 80-pin cable.\n", hwif->name);
 			printk(KERN_WARNING "%s: reduced to UDMA(33) mode.\n", drive->name);
 			if (!jumpbit)
@@ -563,37 +497,30 @@
 		}
 	}
 
-	if (jumpbit) {
-		if (drive->type != ATA_DISK)
-			return 0;
-		if (id->capability & 4) {	/* IORDY_EN & PREFETCH_EN */
-			set_2regs(iordy, (IN_BYTE(datareg)|0x03));
-		}
-		goto jumpbit_is_set;
-	}
+	if (jumpbit)
+		goto chipset_is_set;
 
-	switch(drive->dn) {
-		case 0:	drive_pci = 0x60;
-		case 2:	drive_pci = 0x68;
-			pci_read_config_dword(dev, drive_pci, &drive_conf);
-			if ((drive_conf != 0x004ff304) && (drive_conf != 0x004ff3c4))
-				goto chipset_is_set;
-			pci_read_config_byte(dev, drive_pci, &test1);
-			if (!(test1 & SYNC_ERRDY_EN))
-				pci_write_config_byte(dev, drive_pci, test1|SYNC_ERRDY_EN);
-			break;
-		case 1:	drive_pci = 0x64; mate_pci = 0x60;
-		case 3:	drive_pci = 0x6c; mate_pci = 0x68;
-			pci_read_config_dword(dev, drive_pci, &drive_conf);
-			if ((drive_conf != 0x004ff304) && (drive_conf != 0x004ff3c4))
-				goto chipset_is_set;
-			pci_read_config_byte(dev, mate_pci, &test1);
-			pci_read_config_byte(dev, drive_pci, &test2);
-			if ((test1 & SYNC_ERRDY_EN) && !(test2 & SYNC_ERRDY_EN))
-				pci_write_config_byte(dev, drive_pci, test2|SYNC_ERRDY_EN);
-			break;
-		default:
-			return 0;
+	if (drive->dn > 3)	/* FIXME: remove this --bkz */
+		return 0;
+
+	drive_pci = 0x60 + (drive->dn << 2);
+	pci_read_config_dword(dev, drive_pci, &drive_conf);
+	if ((drive_conf != 0x004ff304) && (drive_conf != 0x004ff3c4))
+		goto chipset_is_set;
+
+	/* FIXME: what if SYNC_ERRDY is enabled for slave
+		  and disabled for master? --bkz */
+	pci_read_config_byte(dev, drive_pci, &AP);
+	if (!(AP & SYNC_ERRDY_EN)) {
+		if (drive->dn == 0 || drive->dn == 2) {
+			/* enable SYNC_ERRDY for master */
+			pci_write_config_byte(dev, drive_pci, AP|SYNC_ERRDY_EN);
+		} else {
+			/* enable SYNC_ERRDY for slave if enabled for master */
+			pci_read_config_byte(dev, drive_pci - 4, &tmp);
+			if (tmp & SYNC_ERRDY_EN)
+				pci_write_config_byte(dev, drive_pci, AP|SYNC_ERRDY_EN);
+		}
 	}
 
 chipset_is_set:
@@ -601,14 +528,18 @@
 	if (drive->type != ATA_DISK)
 		return 0;
 
-	pci_read_config_byte(dev, (drive_pci), &AP);
-	if (id->capability & 4)	/* IORDY_EN */
-		pci_write_config_byte(dev, (drive_pci), AP|IORDY_EN);
-	pci_read_config_byte(dev, (drive_pci), &AP);
-	if (drive->type == ATA_DISK)	/* PREFETCH_EN */
-		pci_write_config_byte(dev, (drive_pci), AP|PREFETCH_EN);
-
-jumpbit_is_set:
+	if (jumpbit) {
+		if (id->capability & 4) {	/* IORDY_EN & PREFETCH_EN */
+			set_2regs(0x13, (IN_BYTE(datareg)|0x03));
+		}
+	} else {
+		pci_read_config_byte(dev, drive_pci, &AP);
+		if (id->capability & 4)		/* IORDY_EN */
+			pci_write_config_byte(dev, drive_pci, AP|IORDY_EN);
+		pci_read_config_byte(dev, drive_pci, &AP);
+		if (drive->type == ATA_DISK)	/* PREFETCH_EN */
+			pci_write_config_byte(dev, drive_pci, AP|PREFETCH_EN);
+	}
 
 	if (udma) {
 		map = pdc202xx_ratemask(drive);
@@ -688,24 +619,13 @@
 
 static int pdc202xx_udma_start(struct ata_device *drive, struct request *rq)
 {
-	u8 lba48hack = 0, clock = 0;
 	struct ata_channel *ch = drive->channel;
-	struct pci_dev *dev	= ch->pci_dev;
-	unsigned long high_16	= pci_resource_start(dev, 4);
-	unsigned long atapi_reg	= high_16 + (ch->unit ? 0x24 : 0x00);
+	unsigned long high_16 = pci_resource_start(ch->pci_dev, 4);
+	unsigned long atapi_reg = high_16 + (ch->unit ? 0x24 : 0x00);
 
-	switch (dev->device) {
-		case PCI_DEVICE_ID_PROMISE_20267:
-		case PCI_DEVICE_ID_PROMISE_20265:
-		case PCI_DEVICE_ID_PROMISE_20262:
-			lba48hack = 1;
-			clock = IN_BYTE(high_16 + 0x11);
-		default:
-			break;
-	}
-
-	if (drive->addressing && lba48hack) {
+	if (drive->addressing) {
 		unsigned long word_count = 0;
+		u8 clock = IN_BYTE(high_16 + 0x11);
 
 		outb(clock|(ch->unit ? 0x08 : 0x02), high_16 + 0x11);
 		word_count = (rq->nr_sectors << 8);
@@ -725,26 +645,13 @@
 
 int pdc202xx_udma_stop(struct ata_device *drive)
 {
-	u8 lba48hack = 0, clock = 0;
 	struct ata_channel *ch = drive->channel;
-	struct pci_dev *dev	= ch->pci_dev;
-	unsigned long high_16	= pci_resource_start(dev, 4);
+	unsigned long high_16 = pci_resource_start(ch->pci_dev, 4);
 	unsigned long atapi_reg	= high_16 + (ch->unit ? 0x24 : 0x00);
 	unsigned long dma_base = ch->dma_base;
-	u8 dma_stat;
+	u8 dma_stat, clock;
 
-	switch (dev->device) {
-		case PCI_DEVICE_ID_PROMISE_20267:
-		case PCI_DEVICE_ID_PROMISE_20265:
-		case PCI_DEVICE_ID_PROMISE_20262:
-			lba48hack = 1;
-			/* FIXME: why do we need this here --bkz */
-			clock = IN_BYTE(high_16 + 0x11);
- 		default:
-			break;
-	}
-
-	if (drive->addressing && lba48hack) {
+	if (drive->addressing) {
 		outl(0, atapi_reg);	/* zero out extra */
 		clock = IN_BYTE(high_16 + 0x11);
 		OUT_BYTE(clock & ~(ch->unit ? 0x08:0x02), high_16 + 0x11);
@@ -762,34 +669,10 @@
 static int pdc202xx_udma_irq_status(struct ata_device *drive)
 {
 	struct ata_channel *ch = drive->channel;
-	u8 dma_stat = 0;
-	u8 sc1d	= 0;
-	u8 newchip = 0;
-	u8 clock = 0;
-	struct pci_dev *dev = ch->pci_dev;
-	unsigned long high_16 = pci_resource_start(dev, 4);
-	unsigned long dma_base = ch->dma_base;
-
-	switch (dev->device) {
-		case PCI_DEVICE_ID_PROMISE_20275:
-		case PCI_DEVICE_ID_PROMISE_20276:
-		case PCI_DEVICE_ID_PROMISE_20269:
-		case PCI_DEVICE_ID_PROMISE_20268R:
-		case PCI_DEVICE_ID_PROMISE_20268:
-			newchip = 1;
-			break;
-		case PCI_DEVICE_ID_PROMISE_20267:
-		case PCI_DEVICE_ID_PROMISE_20265:
-		case PCI_DEVICE_ID_PROMISE_20262:
-			/* FIXME: why do we need this here --bkz */
-			clock = IN_BYTE(high_16 + 0x11);
-		default:
-			break;
-	}
+	unsigned long high_16 = pci_resource_start(ch->pci_dev, 4);
+	u8 dma_stat, sc1d;
 
-	dma_stat = IN_BYTE(dma_base + 2);
-	if (newchip)
-		return (dma_stat & 4) == 4;
+	dma_stat = IN_BYTE(ch->dma_base + 2);
 
 	sc1d = IN_BYTE(high_16 + 0x001d);
 	if (ch->unit) {
@@ -838,6 +721,7 @@
 		drive->channel->unit ? "Secondary" : "Primary");
 }
 
+/* FIXME: should be splited for old & new chipsets --bkz */
 static unsigned int __init pdc202xx_init_chipset(struct pci_dev *dev)
 {
 	unsigned long high_16	= pci_resource_start(dev, 4);
@@ -877,6 +761,8 @@
 			set_reg_and_wait(udma_speed_flag & ~0x10, high_16 + 0x001f, 2000);   /* 2 seconds ?! */
 			break;
 		default:
+		/* FIXME: only checked for 20246 - is this right?,
+			  if it is needed it should go to ide-pci --bkz */
 			if ((dev->class >> 8) != PCI_CLASS_STORAGE_IDE) {
 				byte irq = 0, irq2 = 0;
 				pci_read_config_byte(dev, PCI_INTERRUPT_LINE, &irq);
@@ -949,6 +835,15 @@
 		case PCI_DEVICE_ID_PROMISE_20265:
 		case PCI_DEVICE_ID_PROMISE_20262:
 			hwif->resetproc	= &pdc202xx_reset;
+#ifdef CONFIG_BLK_DEV_IDEDMA
+			/* we need special functions for lba48 */
+			if (hwif->dma_base) {
+				hwif->udma_start = pdc202xx_udma_start;
+				hwif->udma_stop = pdc202xx_udma_stop;
+				hwif->udma_irq_status = pdc202xx_udma_irq_status;
+			}
+#endif
+		/* FIXME: check whether 20246 works with lba48 --bkz */
 		case PCI_DEVICE_ID_PROMISE_20246:
 			hwif->speedproc = &pdc202xx_tune_chipset;
 		default:
@@ -957,9 +852,6 @@
 
 #ifdef CONFIG_BLK_DEV_IDEDMA
 	if (hwif->dma_base) {
-		hwif->udma_start = pdc202xx_udma_start;
-		hwif->udma_stop = pdc202xx_udma_stop;
-		hwif->udma_irq_status = pdc202xx_udma_irq_status;
 		hwif->udma_irq_lost = pdc202xx_bug;
 		hwif->udma_timeout = pdc202xx_bug;
 		hwif->XXX_udma = pdc202xx_dmaproc;
diff -urN linux-2.5.18/drivers/ide/pdc4030.c linux/drivers/ide/pdc4030.c
--- linux-2.5.18/drivers/ide/pdc4030.c	2002-05-25 03:55:21.000000000 +0200
+++ linux/drivers/ide/pdc4030.c	2002-05-27 15:03:08.000000000 +0200
@@ -342,7 +342,7 @@
 	outb(0x14, IDE_SELECT_REG);
 	outb(PROMISE_EXTENDED_COMMAND, IDE_COMMAND_REG);
 
-	ide_delay_50ms();
+	mdelay(50);
 
 	if (inb(IDE_ERROR_REG) == 'P' &&
 	    inb(IDE_NSECTOR_REG) == 'T' &&
diff -urN linux-2.5.18/drivers/ide/q40ide.c linux/drivers/ide/q40ide.c
--- linux-2.5.18/drivers/ide/q40ide.c	2002-05-25 03:55:27.000000000 +0200
+++ linux/drivers/ide/q40ide.c	2002-05-27 16:07:08.000000000 +0200
@@ -82,10 +82,10 @@
     for (i = 0; i < Q40IDE_NUM_HWIFS; i++) {
 	hw_regs_t hw;
 
-	ide_setup_ports(&hw,(ide_ioreg_t) pcide_bases[i], (int *)pcide_offsets, 
-			pcide_bases[i]+0x206, 
+	ide_setup_ports(&hw,(ide_ioreg_t) pcide_bases[i], (int *)pcide_offsets,
+			pcide_bases[i] + 0x206,
 			0, NULL, q40ide_default_irq(pcide_bases[i]));
-	ide_register_hw(&hw, NULL);
+	ide_register_hw(&hw);
     }
 }
 
diff -urN linux-2.5.18/drivers/ide/rapide.c linux/drivers/ide/rapide.c
--- linux-2.5.18/drivers/ide/rapide.c	2002-05-25 03:55:22.000000000 +0200
+++ linux/drivers/ide/rapide.c	2002-05-27 16:06:08.000000000 +0200
@@ -41,7 +41,7 @@
 	hw.io_ports[IDE_CONTROL_OFFSET] = port + 0x206;
 	hw.irq = ec->irq;
 
-	return ide_register_hw(&hw, NULL);
+	return ide_register_hw(&hw);
 }
 
 int __init rapide_init(void)
diff -urN linux-2.5.18/drivers/ide/serverworks.c linux/drivers/ide/serverworks.c
--- linux-2.5.18/drivers/ide/serverworks.c	2002-05-25 03:55:27.000000000 +0200
+++ linux/drivers/ide/serverworks.c	2002-05-28 10:28:49.000000000 +0200
@@ -98,7 +98,7 @@
 #undef DISPLAY_SVWKS_TIMINGS
 #undef SVWKS_DEBUG_DRIVE_INFO
 
-static u8 svwks_revision = 0;
+static u8 svwks_revision;
 
 #if defined(DISPLAY_SVWKS_TIMINGS) && defined(CONFIG_PROC_FS)
 #include <linux/stat.h>
@@ -230,12 +230,13 @@
 				((reg40&0x005D0000)==0x005D0000)?"0":"?");
 	return p-buffer;	 /* => must be less than 4k! */
 }
+
+static byte svwks_proc;
+
 #endif  /* defined(DISPLAY_SVWKS_TIMINGS) && defined(CONFIG_PROC_FS) */
 
 #define SVWKS_CSB5_REVISION_NEW	0x92 /* min PCI_REVISION_ID for UDMA5 (A2.0) */
 
-byte svwks_proc = 0;
-
 extern char *ide_xfer_verbose (byte xfer_rate);
 
 static struct pci_dev *isa_dev;
@@ -262,7 +263,6 @@
 
 static int svwks_tune_chipset(struct ata_device *drive, byte speed)
 {
-	static u8 udma_modes[]	= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05 };
 	static u8 dma_modes[]	= { 0x77, 0x21, 0x20 };
 	static u8 pio_modes[]	= { 0x5d, 0x47, 0x34, 0x22, 0x20 };
 
@@ -271,26 +271,23 @@
 	byte unit		= (drive->select.b.unit & 0x01);
 	byte csb5		= (dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE) ? 1 : 0;
 
-	byte drive_pci		= 0x00;
-	byte drive_pci2		= 0x00;
-	byte drive_pci3		= hwif->unit ? 0x57 : 0x56;
-
-	byte ultra_enable	= 0x00;
-	byte ultra_timing	= 0x00;
-	byte dma_timing		= 0x00;
-	byte pio_timing		= 0x00;
-	unsigned short csb5_pio	= 0x00;
+	byte drive_pci, drive_pci2;
+	byte drive_pci3	= hwif->unit ? 0x57 : 0x56;
+
+	byte ultra_enable, ultra_timing, dma_timing, pio_timing;
+	unsigned short csb5_pio;
 
 	byte pio = ata_timing_mode(drive, XFER_PIO | XFER_EPIO) - XFER_PIO_0;
 
         switch (drive->dn) {
-		case 0: drive_pci = 0x41; drive_pci2 = 0x45; break;
-		case 1: drive_pci = 0x40; drive_pci2 = 0x44; break;
-		case 2: drive_pci = 0x43; drive_pci2 = 0x47; break;
-		case 3: drive_pci = 0x42; drive_pci2 = 0x46; break;
+		case 0: drive_pci = 0x41; break;
+		case 1: drive_pci = 0x40; break;
+		case 2: drive_pci = 0x43; break;
+		case 3: drive_pci = 0x42; break;
 		default:
 			return -1;
 	}
+	drive_pci2 = drive_pci + 4;
 
 	pci_read_config_byte(dev, drive_pci, &pio_timing);
 	pci_read_config_byte(dev, drive_pci2, &dma_timing);
@@ -337,7 +334,7 @@
 			pio_timing   |= pio_modes[pio];
 			csb5_pio     |= (pio << (4*drive->dn));
 			dma_timing   |= dma_modes[2];
-			ultra_timing |= ((udma_modes[speed - XFER_UDMA_0]) << (4*unit));
+			ultra_timing |= ((speed - XFER_UDMA_0) << (4*unit));
 			ultra_enable |= (0x01 << drive->dn);
 #endif
 		default:
diff -urN linux-2.5.18/drivers/macintosh/mediabay.c linux/drivers/macintosh/mediabay.c
--- linux-2.5.18/drivers/macintosh/mediabay.c	2002-05-28 17:15:53.000000000 +0200
+++ linux/drivers/macintosh/mediabay.c	2002-05-27 16:07:38.000000000 +0200
@@ -569,7 +569,7 @@
 				pmu_suspend();
 				ide_init_hwif_ports(&hw, (ide_ioreg_t) bay->cd_base, (ide_ioreg_t) 0, NULL);
 				hw.irq = bay->cd_irq;
-				bay->cd_index = ide_register_hw(&hw, NULL);
+				bay->cd_index = ide_register_hw(&hw);
 				pmu_resume();
 			}
 			if (bay->cd_index == -1) {
diff -urN linux-2.5.18/include/asm-alpha/ide.h linux/include/asm-alpha/ide.h
--- linux-2.5.18/include/asm-alpha/ide.h	2002-05-25 03:55:23.000000000 +0200
+++ linux/include/asm-alpha/ide.h	2002-05-27 16:10:37.000000000 +0200
@@ -77,7 +77,7 @@
 	for (index = 0; index < MAX_HWIFS; index++) {
 		ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, NULL);
 		hw.irq = ide_default_irq(ide_default_io_base(index));
-		ide_register_hw(&hw, NULL);
+		ide_register_hw(&hw);
 	}
 #endif
 }
diff -urN linux-2.5.18/include/asm-arm/arch-anakin/ide.h linux/include/asm-arm/arch-anakin/ide.h
--- linux-2.5.18/include/asm-arm/arch-anakin/ide.h	2002-05-25 03:55:17.000000000 +0200
+++ linux/include/asm-arm/arch-anakin/ide.h	2002-05-27 16:09:24.000000000 +0200
@@ -29,9 +29,9 @@
 		hw->io_ports[i] = reg;
 		reg += regincr;
 	}
-	
+
 	hw->io_ports[IDE_CONTROL_OFFSET] = (ide_ioreg_t) ctrl_port;
-	
+
 	if (irq)
 		*irq = 0;
 }
@@ -46,10 +46,10 @@
 {
     hw_regs_t hw;
 
-    ide_init_hwif_ports(&hw, IO_BASE + COMPACTFLASH, 
-    			IO_BASE + COMPACTFLASH + IDE_CONTROL_OFFSET, NULL);
+    ide_init_hwif_ports(&hw, IO_BASE + COMPACTFLASH,
+			IO_BASE + COMPACTFLASH + IDE_CONTROL_OFFSET, NULL);
     hw.irq = IRQ_COMPACTFLASH;
-    ide_register_hw(&hw, NULL);
+    ide_register_hw(&hw);
 }
 
 
diff -urN linux-2.5.18/include/asm-arm/arch-arc/ide.h linux/include/asm-arm/arch-arc/ide.h
--- linux-2.5.18/include/asm-arm/arch-arc/ide.h	2002-05-25 03:55:22.000000000 +0200
+++ linux/include/asm-arm/arch-arc/ide.h	2002-05-27 16:09:47.000000000 +0200
@@ -50,6 +50,6 @@
 
 		ide_init_hwif_ports(&hw, 0x1f0, 0x3f6, NULL);
 		hw.irq = IRQ_HARDDISK;
-		ide_register_hw(&hw, NULL);
+		ide_register_hw(&hw);
 	}
 }
diff -urN linux-2.5.18/include/asm-arm/arch-cl7500/ide.h linux/include/asm-arm/arch-cl7500/ide.h
--- linux-2.5.18/include/asm-arm/arch-cl7500/ide.h	2002-05-25 03:55:27.000000000 +0200
+++ linux/include/asm-arm/arch-cl7500/ide.h	2002-05-27 16:10:04.000000000 +0200
@@ -43,8 +43,8 @@
 ide_init_default_hwifs(void)
 {
 	hw_regs_t hw;
-   
+
 	ide_init_hwif_ports(&hw, ISASLOT_IO + 0x1f0, ISASLOT_IO + 0x3f6, NULL);
-   	hw.irq = IRQ_ISA_14;
-	ide_register_hw(&hw, NULL);
+	hw.irq = IRQ_ISA_14;
+	ide_register_hw(&hw);
 }
diff -urN linux-2.5.18/include/asm-arm/arch-ebsa285/ide.h linux/include/asm-arm/arch-ebsa285/ide.h
--- linux-2.5.18/include/asm-arm/arch-ebsa285/ide.h	2002-05-25 03:55:29.000000000 +0200
+++ linux/include/asm-arm/arch-ebsa285/ide.h	2002-05-27 16:09:38.000000000 +0200
@@ -44,6 +44,6 @@
 
 	ide_init_hwif_ports(&hw, 0x1f0, 0x3f6, NULL);
 	hw.irq = IRQ_HARDDISK;
-	ide_register_hw(&hw, NULL);
+	ide_register_hw(&hw);
 #endif
 }
diff -urN linux-2.5.18/include/asm-arm/arch-rpc/ide.h linux/include/asm-arm/arch-rpc/ide.h
--- linux-2.5.18/include/asm-arm/arch-rpc/ide.h	2002-05-25 03:55:25.000000000 +0200
+++ linux/include/asm-arm/arch-rpc/ide.h	2002-05-27 16:09:00.000000000 +0200
@@ -44,5 +44,5 @@
 
 	ide_init_hwif_ports(&hw, 0x1f0, 0x3f6, NULL);
 	hw.irq = IRQ_HARDDISK;
-	ide_register_hw(&hw, NULL);
+	ide_register_hw(&hw);
 }
diff -urN linux-2.5.18/include/asm-arm/arch-sa1100/ide.h linux/include/asm-arm/arch-sa1100/ide.h
--- linux-2.5.18/include/asm-arm/arch-sa1100/ide.h	2002-05-25 03:55:18.000000000 +0200
+++ linux/include/asm-arm/arch-sa1100/ide.h	2002-05-27 16:08:52.000000000 +0200
@@ -84,10 +84,10 @@
 	   doesn't match the silkscreen however. */
 	ide_init_hwif_ports(&hw, PCMCIA_IO_0_BASE + 0x40, PCMCIA_IO_0_BASE + 0x78, NULL);
 	hw.irq = EMPEG_IRQ_IDE2;
-	ide_register_hw(&hw, NULL);
+	ide_register_hw(&hw);
 	ide_init_hwif_ports(&hw, PCMCIA_IO_0_BASE + 0x00, PCMCIA_IO_0_BASE + 0x38, NULL);
 	hw.irq = ,EMPEG_IRQ_IDE1;
-	ide_register_hw(&hw, NULL);
+	ide_register_hw(&hw);
 #endif
     }
 
@@ -104,7 +104,7 @@
 
 	ide_init_hwif_ports(&hw, PCMCIA_IO_0_BASE + 0x1f0, PCMCIA_IO_0_BASE + 0x3f6, NULL);
 	hw.irq = IRQ_GPIO7;
-	ide_register_hw(&hw, NULL);
+	ide_register_hw(&hw);
 #endif
     }
     else if (machine_is_lart()) {
@@ -114,14 +114,14 @@
         /* Enable GPIO as interrupt line */
         GPDR &= ~LART_GPIO_IDE;
 	set_irq_type(LART_IRQ_IDE, IRQT_RISING);
-        
+
         /* set PCMCIA interface timing */
         MECR = 0x00060006;
 
         /* init the interface */
 	ide_init_hwif_ports(&hw, PCMCIA_IO_0_BASE + 0x0000, PCMCIA_IO_0_BASE + 0x1000, NULL);
         hw.irq = LART_IRQ_IDE;
-        ide_register_hw(&hw, NULL);
+        ide_register_hw(&hw);
 #endif
     }
 }
diff -urN linux-2.5.18/include/asm-arm/arch-shark/ide.h linux/include/asm-arm/arch-shark/ide.h
--- linux-2.5.18/include/asm-arm/arch-shark/ide.h	2002-05-25 03:55:29.000000000 +0200
+++ linux/include/asm-arm/arch-shark/ide.h	2002-05-27 16:10:11.000000000 +0200
@@ -42,6 +42,6 @@
 
 	ide_init_hwif_ports(&hw, 0x1f0, 0x3f6, NULL);
 	hw.irq = 14;
-	ide_register_hw(&hw, NULL);
+	ide_register_hw(&hw);
 }
 
diff -urN linux-2.5.18/include/asm-cris/ide.h linux/include/asm-cris/ide.h
--- linux-2.5.18/include/asm-cris/ide.h	2002-05-25 03:55:20.000000000 +0200
+++ linux/include/asm-cris/ide.h	2002-05-27 16:10:54.000000000 +0200
@@ -84,7 +84,7 @@
 	for(index = 0; index < MAX_HWIFS; index++) {
 		ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, NULL);
 		hw.irq = ide_default_irq(ide_default_io_base(index));
-		ide_register_hw(&hw, NULL);
+		ide_register_hw(&hw);
 	}
 }
 
diff -urN linux-2.5.18/include/asm-i386/ide.h linux/include/asm-i386/ide.h
--- linux-2.5.18/include/asm-i386/ide.h	2002-05-25 03:55:19.000000000 +0200
+++ linux/include/asm-i386/ide.h	2002-05-28 11:29:24.000000000 +0200
@@ -41,16 +41,9 @@
 
 static __inline__ ide_ioreg_t ide_default_io_base(int index)
 {
-	switch (index) {
-		case 0:	return 0x1f0;
-		case 1:	return 0x170;
-		case 2: return 0x1e8;
-		case 3: return 0x168;
-		case 4: return 0x1e0;
-		case 5: return 0x160;
-		default:
-			return 0;
-	}
+	static unsigned long ata_io_base[MAX_HWIFS] = { 0x1f0, 0x170, 0x1e8, 0x168, 0x1e0, 0x160 };
+
+	return ata_io_base[index];
 }
 
 static __inline__ void ide_init_hwif_ports(hw_regs_t *hw, ide_ioreg_t data_port, ide_ioreg_t ctrl_port, int *irq)
@@ -81,7 +74,7 @@
 	for(index = 0; index < MAX_HWIFS; index++) {
 		ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, NULL);
 		hw.irq = ide_default_irq(ide_default_io_base(index));
-		ide_register_hw(&hw, NULL);
+		ide_register_hw(&hw);
 	}
 #endif
 }
diff -urN linux-2.5.18/include/asm-ia64/ide.h linux/include/asm-ia64/ide.h
--- linux-2.5.18/include/asm-ia64/ide.h	2002-05-25 03:55:28.000000000 +0200
+++ linux/include/asm-ia64/ide.h	2002-05-27 16:08:01.000000000 +0200
@@ -87,7 +87,7 @@
 	for(index = 0; index < MAX_HWIFS; index++) {
 		ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, NULL);
 		hw.irq = ide_default_irq(ide_default_io_base(index));
-		ide_register_hw(&hw, NULL);
+		ide_register_hw(&hw);
 	}
 #endif
 }
diff -urN linux-2.5.18/include/asm-mips/ide.h linux/include/asm-mips/ide.h
--- linux-2.5.18/include/asm-mips/ide.h	2002-05-25 03:55:20.000000000 +0200
+++ linux/include/asm-mips/ide.h	2002-05-27 16:10:17.000000000 +0200
@@ -60,7 +60,7 @@
 	for(index = 0; index < MAX_HWIFS; index++) {
 		ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, NULL);
 		hw.irq = ide_default_irq(ide_default_io_base(index));
-		ide_register_hw(&hw, NULL);
+		ide_register_hw(&hw);
 	}
 #endif
 }
diff -urN linux-2.5.18/include/asm-mips64/ide.h linux/include/asm-mips64/ide.h
--- linux-2.5.18/include/asm-mips64/ide.h	2002-05-25 03:55:17.000000000 +0200
+++ linux/include/asm-mips64/ide.h	2002-05-27 16:11:03.000000000 +0200
@@ -63,7 +63,7 @@
 	for(index = 0; index < MAX_HWIFS; index++) {
 		ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, NULL);
 		hw.irq = ide_default_irq(ide_default_io_base(index));
-		ide_register_hw(&hw, NULL);
+		ide_register_hw(&hw);
 	}
 #endif
 }
diff -urN linux-2.5.18/include/asm-parisc/ide.h linux/include/asm-parisc/ide.h
--- linux-2.5.18/include/asm-parisc/ide.h	2002-05-25 03:55:24.000000000 +0200
+++ linux/include/asm-parisc/ide.h	2002-05-27 16:10:23.000000000 +0200
@@ -76,7 +76,7 @@
 	for(index = 0; index < MAX_HWIFS; index++) {
 		ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, NULL);
 		hw.irq = ide_default_irq(ide_default_io_base(index));
-		ide_register_hw(&hw, NULL);
+		ide_register_hw(&hw);
 	}
 #endif
 }
diff -urN linux-2.5.18/include/asm-ppc/ide.h linux/include/asm-ppc/ide.h
--- linux-2.5.18/include/asm-ppc/ide.h	2002-05-25 03:55:24.000000000 +0200
+++ linux/include/asm-ppc/ide.h	2002-05-27 16:08:17.000000000 +0200
@@ -100,7 +100,7 @@
 			continue;
 		ide_init_hwif_ports(&hw, base, 0, NULL);
 		hw.irq = ide_default_irq(base);
-		ide_register_hw(&hw, NULL);
+		ide_register_hw(&hw);
 	}
 #endif
 }
diff -urN linux-2.5.18/include/asm-sh/ide.h linux/include/asm-sh/ide.h
--- linux-2.5.18/include/asm-sh/ide.h	2002-05-25 03:55:22.000000000 +0200
+++ linux/include/asm-sh/ide.h	2002-05-27 16:11:09.000000000 +0200
@@ -102,7 +102,7 @@
 	for(index = 0; index < MAX_HWIFS; index++) {
 		ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, NULL);
 		hw.irq = ide_default_irq(ide_default_io_base(index));
-		ide_register_hw(&hw, NULL);
+		ide_register_hw(&hw);
 	}
 #endif
 }
diff -urN linux-2.5.18/include/asm-sparc/ide.h linux/include/asm-sparc/ide.h
--- linux-2.5.18/include/asm-sparc/ide.h	2002-05-25 03:55:27.000000000 +0200
+++ linux/include/asm-sparc/ide.h	2002-05-27 16:10:48.000000000 +0200
@@ -68,7 +68,7 @@
 	for (index = 0; index < MAX_HWIFS; index++) {
 		ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, NULL);
 		hw.irq = ide_default_irq(ide_default_io_base(index));
-		ide_register_hw(&hw, NULL);
+		ide_register_hw(&hw);
 	}
 #endif
 }
diff -urN linux-2.5.18/include/asm-sparc64/ide.h linux/include/asm-sparc64/ide.h
--- linux-2.5.18/include/asm-sparc64/ide.h	2002-05-25 03:55:24.000000000 +0200
+++ linux/include/asm-sparc64/ide.h	2002-05-27 16:10:31.000000000 +0200
@@ -64,7 +64,7 @@
 	for (index = 0; index < MAX_HWIFS; index++) {
 		ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, NULL);
 		hw.irq = ide_default_irq(ide_default_io_base(index));
-		ide_register_hw(&hw, NULL);
+		ide_register_hw(&hw);
 	}
 #endif
 }
diff -urN linux-2.5.18/include/asm-x86_64/ide.h linux/include/asm-x86_64/ide.h
--- linux-2.5.18/include/asm-x86_64/ide.h	2002-05-25 03:55:26.000000000 +0200
+++ linux/include/asm-x86_64/ide.h	2002-05-28 11:29:19.000000000 +0200
@@ -41,16 +41,9 @@
 
 static __inline__ ide_ioreg_t ide_default_io_base(int index)
 {
-	switch (index) {
-		case 0:	return 0x1f0;
-		case 1:	return 0x170;
-		case 2: return 0x1e8;
-		case 3: return 0x168;
-		case 4: return 0x1e0;
-		case 5: return 0x160;
-		default:
-			return 0;
-	}
+	static unsigned long ata_io_base[MAX_HWIFS] = { 0x1f0, 0x170, 0x1e8, 0x168, 0x1e0, 0x160 };
+
+	return ata_io_base[index];
 }
 
 static __inline__ void ide_init_hwif_ports(hw_regs_t *hw, ide_ioreg_t data_port, ide_ioreg_t ctrl_port, int *irq)
@@ -81,7 +74,7 @@
 	for(index = 0; index < MAX_HWIFS; index++) {
 		ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, NULL);
 		hw.irq = ide_default_irq(ide_default_io_base(index));
-		ide_register_hw(&hw, NULL);
+		ide_register_hw(&hw);
 	}
 #endif
 }
diff -urN linux-2.5.18/include/linux/ide.h linux/include/linux/ide.h
--- linux-2.5.18/include/linux/ide.h	2002-05-28 17:15:53.000000000 +0200
+++ linux/include/linux/ide.h	2002-05-28 12:44:03.000000000 +0200
@@ -71,18 +71,20 @@
 /*
  * Definitions for accessing IDE controller registers
  */
-#define IDE_NR_PORTS		(10)
 
-#define IDE_DATA_OFFSET		(0)
-#define IDE_ERROR_OFFSET	(1)
-#define IDE_NSECTOR_OFFSET	(2)
-#define IDE_SECTOR_OFFSET	(3)
-#define IDE_LCYL_OFFSET		(4)
-#define IDE_HCYL_OFFSET		(5)
-#define IDE_SELECT_OFFSET	(6)
-#define IDE_STATUS_OFFSET	(7)
-#define IDE_CONTROL_OFFSET	(8)
-#define IDE_IRQ_OFFSET		(9)
+enum {
+	IDE_DATA_OFFSET	    = 0,
+	IDE_ERROR_OFFSET    = 1,
+	IDE_NSECTOR_OFFSET  = 2,
+	IDE_SECTOR_OFFSET   = 3,
+	IDE_LCYL_OFFSET	    = 4,
+	IDE_HCYL_OFFSET	    = 5,
+	IDE_SELECT_OFFSET   = 6,
+	IDE_STATUS_OFFSET   = 7,
+	IDE_CONTROL_OFFSET  = 8,
+	IDE_IRQ_OFFSET	    = 9,
+	IDE_NR_PORTS	    = 10
+};
 
 #define IDE_FEATURE_OFFSET	IDE_ERROR_OFFSET
 #define IDE_COMMAND_OFFSET	IDE_STATUS_OFFSET
@@ -549,7 +551,7 @@
 /*
  * Register new hardware with ide
  */
-extern int ide_register_hw(hw_regs_t *hw, struct ata_channel **hwifp);
+extern int ide_register_hw(hw_regs_t *hw);
 extern void ide_unregister(struct ata_channel *hwif);
 
 struct ata_taskfile;
@@ -759,8 +761,6 @@
 extern int ide_raw_taskfile(struct ata_device *, struct ata_taskfile *);
 extern int ide_cmd_ioctl(struct ata_device *drive, unsigned long arg);
 
-void ide_delay_50ms(void);
-
 extern void ide_fix_driveid(struct hd_driveid *id);
 extern int ide_driveid_update(struct ata_device *);
 extern int ide_config_drive_speed(struct ata_device *, byte);

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] airo
  2002-05-25  2:02 Linux-2.5.18 Linus Torvalds
  2002-05-27  9:34 ` [PATCH] 2.5.18 IDE 71 Martin Dalecki
  2002-05-28 14:23 ` Linux-2.5.18 Martin Dalecki
@ 2002-05-28 15:31 ` Martin Dalecki
  2002-05-28 17:35 ` [PATCH] 2.5.18 QUEUE_EMPTY and the unpleasant friends Martin Dalecki
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 48+ messages in thread
From: Martin Dalecki @ 2002-05-28 15:31 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Kernel Mailing List, breed

[-- Attachment #1: Type: text/plain, Size: 384 bytes --]

Since apparently no body else did care thus far, and
since I'm using this driver, well here it comes:

- Adjust the airo wireless LAN card driver for the fact that modules
   don't export symbols by default any longer.

- Make some stuff which obivously should be static there static as well.
   (Plenty of code in Linux actually deserves a review for this
    far too common bug...)

[-- Attachment #2: airo-2.5.18.diff --]
[-- Type: text/plain, Size: 993 bytes --]

diff -ur linux-2.5.18/drivers/net/wireless/airo.c linux/drivers/net/wireless/airo.c
--- linux-2.5.18/drivers/net/wireless/airo.c	2002-05-25 03:55:19.000000000 +0200
+++ linux/drivers/net/wireless/airo.c	2002-05-28 18:20:41.000000000 +0200
@@ -1146,6 +1146,8 @@
 	kfree( dev );
 }
 
+EXPORT_SYMBOL(stop_airo_card);
+
 static int add_airo_dev( struct net_device *dev );
 
 struct net_device *init_airo_card( unsigned short irq, int port, int is_pcmcia )
@@ -1239,7 +1241,9 @@
 	return NULL;
 }
 
-int waitbusy (struct airo_info *ai) {
+EXPORT_SYMBOL(init_airo_card);
+
+static int waitbusy (struct airo_info *ai) {
 	int delay = 0;
 	while ((IN4500 (ai, COMMAND) & COMMAND_BUSY) & (delay < 10000)) {
 		udelay (10);
@@ -1283,7 +1287,9 @@
 	return 0;
 }
 
-int wll_header_parse(struct sk_buff *skb, unsigned char *haddr)
+EXPORT_SYMBOL(reset_airo_card);
+
+static int wll_header_parse(struct sk_buff *skb, unsigned char *haddr)
 {
 	memcpy(haddr, skb->mac.raw + 10, ETH_ALEN);
 	return ETH_ALEN;

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] 2.5.18 QUEUE_EMPTY and the unpleasant friends.
  2002-05-25  2:02 Linux-2.5.18 Linus Torvalds
                   ` (2 preceding siblings ...)
  2002-05-28 15:31 ` [PATCH] airo Martin Dalecki
@ 2002-05-28 17:35 ` Martin Dalecki
  2002-05-29 12:11 ` [PATCH] 2.5.18 IDE 73 Martin Dalecki
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 48+ messages in thread
From: Martin Dalecki @ 2002-05-28 17:35 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 540 bytes --]

Tue May 28 17:25:29 CEST 2002

- Eliminate all usages of the obscure QUEUE_EMPTY macro.

- Eliminate all unneccessary checks for RQ_INACTIVE, this can't happen during
   the time we run the request strategy routine of a single major number block
   device. Perhaps the still remaining usage in scsi and i2o_block.c should be
   killed as well, since the upper ll_rw_blk layer shouldn't pass inactive
   requests down.

Those are all places where we have deeply burried and hidden major number
indexed arrays. Let's deal with them slowly...

[-- Attachment #2: blk-2.5.18.diff --]
[-- Type: text/plain, Size: 35587 bytes --]

diff -ur linux-2.5.18/drivers/acorn/block/fd1772.c linux/drivers/acorn/block/fd1772.c
--- linux-2.5.18/drivers/acorn/block/fd1772.c	2002-05-25 03:55:23.000000000 +0200
+++ linux/drivers/acorn/block/fd1772.c	2002-05-28 20:07:24.000000000 +0200
@@ -591,7 +591,7 @@
 {
 	printk("FDC1772: fd_error\n");
 	/*panic("fd1772: fd_error"); *//* DAG tmp */
-	if (QUEUE_EMPTY)
+	if (blk_queue_empty(QUEUE))
 		return;
 	CURRENT->errors++;
 	if (CURRENT->errors >= MAX_ERRORS) {
@@ -1114,16 +1114,6 @@
 static int fd_ref[4];
 static int fd_device[4];
 
-/*
- * Current device number. Taken either from the block header or from the
- * format request descriptor.
- */
-#define CURRENT_DEVICE (CURRENT->rq_dev)
-
-/* Current error count. */
-#define CURRENT_ERRORS (CURRENT->errors)
-
-
 /* dummy for blk.h */
 static void floppy_off(unsigned int nr)
 {
@@ -1145,7 +1135,7 @@
 {
 	unsigned int drive = (dev & 0x03);
 
-	if (MAJOR(dev) != MAJOR_NR) {
+	if (major(dev) != MAJOR_NR) {
 		printk("floppy_changed: not a floppy\n");
 		return 0;
 	}
@@ -1205,7 +1195,7 @@
 	ReqData = ReqBuffer + 512 * ReqCnt;
 
 #ifdef TRACKBUFFER
-	read_track = (ReqCmd == READ && CURRENT_ERRORS == 0);
+	read_track = (ReqCmd == READ && CURRENT->errors == 0);
 #endif
 
 	DPRINT(("Request params: Si=%d Tr=%d Se=%d Data=%08lx\n", ReqSide,
@@ -1220,24 +1210,21 @@
 
 	DPRINT(("redo_fd_request: CURRENT=%08lx CURRENT->rq_dev=%04x CURRENT->sector=%ld\n",
 		(unsigned long) CURRENT, CURRENT ? CURRENT->rq_dev : 0,
-		!QUEUE_EMPTY ? CURRENT->sector : 0));
-
-	if (!QUEUE_EMPTY && CURRENT->rq_status == RQ_INACTIVE)
-		goto the_end;
+		!blk_queue_empty(QUEUE) ? CURRENT->sector : 0));
 
 repeat:
 
-	if (QUEUE_EMPTY)
+	if (blk_queue_empty(QUEUE))
 		goto the_end;
 
-	if (MAJOR(CURRENT->rq_dev) != MAJOR_NR)
+	if (major(CURRENT->rq_dev) != MAJOR_NR)
 		panic(DEVICE_NAME ": request list destroyed");
 
 	if (CURRENT->bh) {
 		if (!buffer_locked(CURRENT->bh))
 			panic(DEVICE_NAME ": block not locked");
 	}
-	device = MINOR(CURRENT_DEVICE);
+	device = minor(CURRENT->rq_dev);
 	drive = device & 3;
 	type = device >> 2;
 	floppy = &unit[drive];
@@ -1343,7 +1330,7 @@
 	int drive, device;
 
 	device = inode->i_rdev;
-	drive = MINOR(device);
+	drive = minor(device);
 	switch (cmd) {
 	case FDFMTBEG:
 		return 0;
@@ -1502,8 +1489,8 @@
 		DPRINT(("Weird, open called with filp=0\n"));
 		return -EIO;
 	}
-	drive = MINOR(inode->i_rdev) & 3;
-	if ((MINOR(inode->i_rdev) >> 2) > NUM_DISK_TYPES)
+	drive = minor(inode->i_rdev) & 3;
+	if ((minor(inode->i_rdev) >> 2) > NUM_DISK_TYPES)
 		return -ENXIO;
 
 	old_dev = fd_device[drive];
@@ -1543,7 +1530,7 @@
 
 static int floppy_release(struct inode *inode, struct file *filp)
 {
-	int drive = MINOR(inode->i_rdev) & 3;
+	int drive = minor(inode->i_rdev) & 3;
 
 	if (fd_ref[drive] < 0)
 		fd_ref[drive] = 0;
diff -ur linux-2.5.18/drivers/acorn/block/mfmhd.c linux/drivers/acorn/block/mfmhd.c
--- linux-2.5.18/drivers/acorn/block/mfmhd.c	2002-05-25 03:55:21.000000000 +0200
+++ linux/drivers/acorn/block/mfmhd.c	2002-05-28 19:46:42.000000000 +0200
@@ -756,7 +756,7 @@
 		/* No - its the end of the line */
 		/* end_request's should have happened at the end of sector DMAs */
 		/* Turns Drive LEDs off - may slow it down? */
-		if (QUEUE_EMPTY)
+		if (blk_queue_empty(QUEUE))
 			issue_command(CMD_CKV, block, 2);
 
 		Busy = 0;
diff -ur linux-2.5.18/drivers/block/acsi.c linux/drivers/block/acsi.c
--- linux-2.5.18/drivers/block/acsi.c	2002-05-25 03:55:26.000000000 +0200
+++ linux/drivers/block/acsi.c	2002-05-28 19:54:16.000000000 +0200
@@ -768,7 +768,7 @@
 static void bad_rw_intr( void )
 
 {
-	if (QUEUE_EMPTY)
+	if (blk_queue_empty(QUEUE))
 		return;
 
 	if (++CURRENT->errors >= MAX_ERRORS)
@@ -842,7 +842,8 @@
 
 	DEVICE_INTR = NULL;
 	printk( KERN_ERR "ACSI timeout\n" );
-	if (QUEUE_EMPTY) return;
+	if (blk_queue_empty(QUEUE))
+	    return;
 	if (++CURRENT->errors >= MAX_ERRORS) {
 #ifdef DEBUG
 		printk( KERN_ERR "ACSI: too many errors.\n" );
@@ -951,40 +952,20 @@
 	char 				*buffer;
 	unsigned long		pbuffer;
 	struct buffer_head	*bh;
-	
-	if (!QUEUE_EMPTY && CURRENT->rq_status == RQ_INACTIVE) {
-		if (!DEVICE_INTR) {
-			ENABLE_IRQ();
-			stdma_release();
-		}
-		return;
-	}
-
-	if (DEVICE_INTR)
-		return;
 
   repeat:
 	CLEAR_TIMER();
-	/* Another check here: An interrupt or timer event could have
-	 * happened since the last check!
-	 */
-	if (!QUEUE_EMPTY && CURRENT->rq_status == RQ_INACTIVE) {
-		if (!DEVICE_INTR) {
-			ENABLE_IRQ();
-			stdma_release();
-		}
-		return;
-	}
+
 	if (DEVICE_INTR)
 		return;
 
-	if (QUEUE_EMPTY) {
+	if (blk_queue_empty(QUEUE)) {
 		CLEAR_INTR;
 		ENABLE_IRQ();
 		stdma_release();
 		return;
 	}
-	
+
 	if (MAJOR(CURRENT->rq_dev) != MAJOR_NR)
 		panic(DEVICE_NAME ": request list destroyed");
 	if (CURRENT->bh) {
diff -ur linux-2.5.18/drivers/block/amiflop.c linux/drivers/block/amiflop.c
--- linux-2.5.18/drivers/block/amiflop.c	2002-05-25 03:55:26.000000000 +0200
+++ linux/drivers/block/amiflop.c	2002-05-28 20:13:24.000000000 +0200
@@ -209,17 +209,6 @@
 static kdev_t fd_device[4] = { NODEV, NODEV, NODEV, NODEV };
 
 /*
- * Current device number. Taken either from the block header or from the
- * format request descriptor.
- */
-#define CURRENT_DEVICE (CURRENT->rq_dev)
-
-/* Current error count. */
-#define CURRENT_ERRORS (CURRENT->errors)
-
-
-
-/*
  * Here come the actual hardware access and helper functions.
  * They are not reentrant and single threaded because all drives
  * share the same hardware and the same trackbuffer.
@@ -1383,12 +1372,8 @@
 	char *data;
 	unsigned long flags;
 
-	if (!QUEUE_EMPTY && CURRENT->rq_status == RQ_INACTIVE){
-		return;
-	}
-
  repeat:
-	if (QUEUE_EMPTY) {
+	if (blk_queue_empty(QUEUE)) {
 		/* Nothing left to do */
 		return;
 	}
@@ -1396,7 +1381,7 @@
 	if (major(CURRENT->rq_dev) != MAJOR_NR)
 		panic(DEVICE_NAME ": request list destroyed");
 
-	device = minor(CURRENT_DEVICE);
+	device = minor(CURRENT->rq_dev);
 	if (device < 8) {
 		/* manual selection */
 		drive = device & 3;
diff -ur linux-2.5.18/drivers/block/ataflop.c linux/drivers/block/ataflop.c
--- linux-2.5.18/drivers/block/ataflop.c	2002-05-25 03:55:20.000000000 +0200
+++ linux/drivers/block/ataflop.c	2002-05-28 20:10:29.000000000 +0200
@@ -625,8 +625,10 @@
 		wake_up( &format_wait );
 		return;
 	}
-		
-	if (QUEUE_EMPTY) return;
+
+	if (blk_queue_empty(QUEUE))
+		return;
+
 	CURRENT->errors++;
 	if (CURRENT->errors >= MAX_ERRORS) {
 		printk(KERN_ERR "fd%d: too many errors.\n", SelectedDrive );
@@ -1335,16 +1337,6 @@
 static int fd_ref[4] = { 0,0,0,0 };
 static int fd_device[4] = { 0,0,0,0 };
 
-/*
- * Current device number. Taken either from the block header or from the
- * format request descriptor.
- */
-#define CURRENT_DEVICE (CURRENT->rq_dev)
-
-/* Current error count. */
-#define CURRENT_ERRORS (CURRENT->errors)
-
-
 /* dummy for blk.h */
 static void floppy_off( unsigned int nr) {}
 
@@ -1437,7 +1429,7 @@
 	ReqData = ReqBuffer + 512 * ReqCnt;
 
 	if (UseTrackbuffer)
-		read_track = (ReqCmd == READ && CURRENT_ERRORS == 0);
+		read_track = (ReqCmd == READ && CURRENT->errors == 0);
 	else
 		read_track = 0;
 
@@ -1451,18 +1443,14 @@
 	int device, drive, type;
   
 	DPRINT(("redo_fd_request: CURRENT=%08lx CURRENT->dev=%04x CURRENT->sector=%ld\n",
-		(unsigned long)CURRENT, !QUEUE_EMPTY ? CURRENT->rq_dev : 0,
-		!QUEUE_EMPTY ? CURRENT->sector : 0 ));
+		(unsigned long)CURRENT, !blk_queue_empty(QUEUE) ? CURRENT->rq_dev : 0,
+		!blk_queue_empty(QUEUE) ? CURRENT->sector : 0 ));
 
 	IsFormatting = 0;
 
-	if (!QUEUE_EMPTY && CURRENT->rq_status == RQ_INACTIVE){
-		return;
-	}
-
 repeat:
-    
-	if (QUEUE_EMPTY)
+
+	if (blk_queue_empty(QUEUE))
 		goto the_end;
 
 	if (major(CURRENT->rq_dev) != MAJOR_NR)
@@ -1471,7 +1459,7 @@
 	if (CURRENT->bh && !buffer_locked(CURRENT->bh))
 		panic(DEVICE_NAME ": block not locked");
 
-	device = minor(CURRENT_DEVICE);
+	device = minor(CURRENT->rq_dev);
 	drive = device & 3;
 	type = device >> 2;
 	
diff -ur linux-2.5.18/drivers/block/floppy.c linux/drivers/block/floppy.c
--- linux-2.5.18/drivers/block/floppy.c	2002-05-25 03:55:20.000000000 +0200
+++ linux/drivers/block/floppy.c	2002-05-28 19:53:03.000000000 +0200
@@ -2918,14 +2918,8 @@
 	if (current_drive < N_DRIVE)
 		floppy_off(current_drive);
 
-	if (!QUEUE_EMPTY && CURRENT->rq_status == RQ_INACTIVE){
-		CLEAR_INTR;
-		unlock_fdc();
-		return;
-	}
-
-	while(1){
-		if (QUEUE_EMPTY) {
+	for (;;) {
+		if (blk_queue_empty(QUEUE)) {
 			CLEAR_INTR;
 			unlock_fdc();
 			return;
diff -ur linux-2.5.18/drivers/block/nbd.c linux/drivers/block/nbd.c
--- linux-2.5.18/drivers/block/nbd.c	2002-05-25 03:55:21.000000000 +0200
+++ linux/drivers/block/nbd.c	2002-05-28 19:38:03.000000000 +0200
@@ -323,7 +323,7 @@
 	int dev = 0;
 	struct nbd_device *lo;
 
-	while (!QUEUE_EMPTY) {
+	while (!blk_queue_empty(QUEUE)) {
 		req = CURRENT;
 #ifdef PARANOIA
 		if (!req)
diff -ur linux-2.5.18/drivers/block/paride/pd.c linux/drivers/block/paride/pd.c
--- linux-2.5.18/drivers/block/paride/pd.c	2002-05-25 03:55:22.000000000 +0200
+++ linux/drivers/block/paride/pd.c	2002-05-28 19:52:15.000000000 +0200
@@ -877,10 +877,9 @@
 	
 /* paranoia */
 
-	if (QUEUE_EMPTY ||
+	if (blk_queue_empty(QUEUE) ||
 	    (rq_data_dir(CURRENT) != pd_cmd) ||
 	    (minor(CURRENT->rq_dev) != pd_dev) ||
-	    (CURRENT->rq_status == RQ_INACTIVE) ||
 	    (CURRENT->sector != pd_block)) 
 		printk("%s: OUCH: request list changed unexpectedly\n",
 			PD.name);
diff -ur linux-2.5.18/drivers/block/paride/pf.c linux/drivers/block/paride/pf.c
--- linux-2.5.18/drivers/block/paride/pf.c	2002-05-25 03:55:19.000000000 +0200
+++ linux/drivers/block/paride/pf.c	2002-05-28 19:52:11.000000000 +0200
@@ -881,10 +881,9 @@
 	
 /* paranoia */
 
-	if (QUEUE_EMPTY ||
+	if (blk_queue_empty(QUEUE) ||
 	    (rq_data_dir(CURRENT) != pf_cmd) ||
 	    (DEVICE_NR(CURRENT->rq_dev) != pf_unit) ||
-	    (CURRENT->rq_status == RQ_INACTIVE) ||
 	    (CURRENT->sector != pf_block)) 
 		printk("%s: OUCH: request list changed unexpectedly\n",
 			PF.name);
diff -ur linux-2.5.18/drivers/block/ps2esdi.c linux/drivers/block/ps2esdi.c
--- linux-2.5.18/drivers/block/ps2esdi.c	2002-05-25 03:55:16.000000000 +0200
+++ linux/drivers/block/ps2esdi.c	2002-05-28 20:09:30.000000000 +0200
@@ -466,7 +466,7 @@
 #if 0
 	printk("%s:got request. device : %d minor : %d command : %d  sector : %ld count : %ld, buffer: %p\n",
 	       DEVICE_NAME,
-	       CURRENT_DEV, minor(CURRENT->rq_dev),
+	       DEVICE_NR(CURRENT->rq_dev), minor(CURRENT->rq_dev),
 	       CURRENT->cmd, CURRENT->sector,
 	       CURRENT->current_nr_sectors, CURRENT->buffer);
 #endif
@@ -482,14 +482,14 @@
 		printk("%s: DMA above 16MB not supported\n", DEVICE_NAME);
 		end_request(FAIL);
 	}			/* check for above 16Mb dmas */
-	else if ((CURRENT_DEV < ps2esdi_drives) &&
+	else if ((DEVICE_NR(CURRENT->rq_dev) < ps2esdi_drives) &&
 	    (CURRENT->sector + CURRENT->current_nr_sectors <=
 	     ps2esdi[minor(CURRENT->rq_dev)].nr_sects) &&
 	    	CURRENT->flags & REQ_CMD) {
 #if 0
 		printk("%s:got request. device : %d minor : %d command : %d  sector : %ld count : %ld\n",
 		       DEVICE_NAME,
-		       CURRENT_DEV, minor(CURRENT->rq_dev),
+		       DEVICE_NR(CURRENT->rq_dev), minor(CURRENT->rq_dev),
 		       CURRENT->cmd, CURRENT->sector,
 		       CURRENT->current_nr_sectors);
 #endif
@@ -499,10 +499,10 @@
 
 		switch (rq_data_dir(CURRENT)) {
 		case READ:
-			ps2esdi_readwrite(READ, CURRENT_DEV, block, count);
+			ps2esdi_readwrite(READ, DEVICE_NR(CURRENT->rq_dev), block, count);
 			break;
 		case WRITE:
-			ps2esdi_readwrite(WRITE, CURRENT_DEV, block, count);
+			ps2esdi_readwrite(WRITE, DEVICE_NR(CURRENT->rq_dev), block, count);
 			break;
 		default:
 			printk("%s: Unknown command\n", DEVICE_NAME);
diff -ur linux-2.5.18/drivers/block/swim3.c linux/drivers/block/swim3.c
--- linux-2.5.18/drivers/block/swim3.c	2002-05-25 03:55:24.000000000 +0200
+++ linux/drivers/block/swim3.c	2002-05-28 19:38:44.000000000 +0200
@@ -313,7 +313,7 @@
 		wake_up(&fs->wait);
 		return;
 	}
-	while (!QUEUE_EMPTY && fs->state == idle) {
+	while (!blk_queue_empty(QUEUE) && fs->state == idle) {
 		if (major(CURRENT->rq_dev) != MAJOR_NR)
 			panic(DEVICE_NAME ": request list destroyed");
 //		if (CURRENT->bh && !buffer_locked(CURRENT->bh))
diff -ur linux-2.5.18/drivers/block/swim_iop.c linux/drivers/block/swim_iop.c
--- linux-2.5.18/drivers/block/swim_iop.c	2002-05-25 03:55:17.000000000 +0200
+++ linux/drivers/block/swim_iop.c	2002-05-28 19:42:12.000000000 +0200
@@ -552,7 +552,7 @@
 		wake_up(&fs->wait);
 		return;
 	}
-	while (!QUEUE_EMPTY && fs->state == idle) {
+	while (!blk_queue_empty(QUEUE) && fs->state == idle) {
 		if (MAJOR(CURRENT->rq_dev) != MAJOR_NR)
 			panic(DEVICE_NAME ": request list destroyed");
 		if (CURRENT->bh && !buffer_locked(CURRENT->bh))
diff -ur linux-2.5.18/drivers/block/xd.c linux/drivers/block/xd.c
--- linux-2.5.18/drivers/block/xd.c	2002-05-25 03:55:22.000000000 +0200
+++ linux/drivers/block/xd.c	2002-05-28 20:11:32.000000000 +0200
@@ -286,7 +286,7 @@
 			return;
 		}
 
-		if (CURRENT_DEV < xd_drives
+		if (DEVICE_NR(CURRENT->rq_dev) < xd_drives
 		    && (CURRENT->flags & REQ_CMD)
 		    && CURRENT->sector + CURRENT->nr_sectors
 		         <= xd_struct[minor(CURRENT->rq_dev)].nr_sects) {
@@ -297,7 +297,8 @@
 				case READ:
 				case WRITE:
 					for (retry = 0; (retry < XD_RETRIES) && !code; retry++)
-						code = xd_readwrite(rq_data_dir(CURRENT),CURRENT_DEV,CURRENT->buffer,block,count);
+						code = xd_readwrite(rq_data_dir(CURRENT),DEVICE_NR(CURRENT->rq_dev),
+							CURRENT->buffer,block,count);
 					break;
 				default:
 					printk("do_xd_request: unknown request\n");
diff -ur linux-2.5.18/drivers/cdrom/aztcd.c linux/drivers/cdrom/aztcd.c
--- linux-2.5.18/drivers/cdrom/aztcd.c	2002-05-25 03:55:30.000000000 +0200
+++ linux/drivers/cdrom/aztcd.c	2002-05-28 19:34:53.000000000 +0200
@@ -226,9 +226,13 @@
 #define AZT_DEBUG_MULTISESSION
 #endif
 
-#define CURRENT_VALID \
-  (!QUEUE_EMPTY && major(CURRENT -> rq_dev) == MAJOR_NR && CURRENT -> cmd == READ \
-   && CURRENT -> sector != -1)
+static int current_valid(void)
+{
+        return !blk_queue_empty(QUEUE) &&
+	        major(CURRENT->rq_dev) == MAJOR_NR &&
+		CURRENT->cmd == READ &&
+		CURRENT->sector != -1;
+}
 
 #define AFL_STATUSorDATA (AFL_STATUS | AFL_DATA)
 #define AZT_BUF_SIZ 16
@@ -1554,34 +1558,33 @@
 #ifdef AZT_TEST
 	printk("aztcd: executing azt_transfer Time:%li\n", jiffies);
 #endif
-	if (CURRENT_VALID) {
-		while (CURRENT->nr_sectors) {
-			int bn = CURRENT->sector / 4;
-			int i;
-			for (i = 0; i < AZT_BUF_SIZ && azt_buf_bn[i] != bn;
-			     ++i);
-			if (i < AZT_BUF_SIZ) {
-				int offs =
-				    (i * 4 + (CURRENT->sector & 3)) * 512;
-				int nr_sectors = 4 - (CURRENT->sector & 3);
-				if (azt_buf_out != i) {
-					azt_buf_out = i;
-					if (azt_buf_bn[i] != bn) {
-						azt_buf_out = -1;
-						continue;
-					}
-				}
-				if (nr_sectors > CURRENT->nr_sectors)
-					nr_sectors = CURRENT->nr_sectors;
-				memcpy(CURRENT->buffer, azt_buf + offs,
-				       nr_sectors * 512);
-				CURRENT->nr_sectors -= nr_sectors;
-				CURRENT->sector += nr_sectors;
-				CURRENT->buffer += nr_sectors * 512;
-			} else {
-				azt_buf_out = -1;
-				break;
-			}
+	if (!current_valid())
+	        return;
+
+	while (CURRENT->nr_sectors) {
+		int bn = CURRENT->sector / 4;
+		int i;
+		for (i = 0; i < AZT_BUF_SIZ && azt_buf_bn[i] != bn; ++i);
+		if (i < AZT_BUF_SIZ) {
+			int offs = (i * 4 + (CURRENT->sector & 3)) * 512;
+			int nr_sectors = 4 - (CURRENT->sector & 3);
+			if (azt_buf_out != i) {
+				azt_buf_out = i;
+				if (azt_buf_bn[i] != bn) {
+					azt_buf_out = -1;
+					continue;
+				}
+			}
+			if (nr_sectors > CURRENT->nr_sectors)
+			    nr_sectors = CURRENT->nr_sectors;
+			memcpy(CURRENT->buffer, azt_buf + offs,
+				nr_sectors * 512);
+			CURRENT->nr_sectors -= nr_sectors;
+			CURRENT->sector += nr_sectors;
+			CURRENT->buffer += nr_sectors * 512;
+		} else {
+			azt_buf_out = -1;
+			break;
 		}
 	}
 }
@@ -1598,7 +1601,7 @@
 		return;
 	}
 	azt_transfer_is_active = 1;
-	while (CURRENT_VALID) {
+	while (current_valid()) {
 		azt_transfer();
 		if (CURRENT->nr_sectors == 0) {
 			end_request(1);
@@ -1607,7 +1610,7 @@
 			if (azt_state == AZT_S_IDLE) {
 				if ((!aztTocUpToDate) || aztDiskChanged) {
 					if (aztUpdateToc() < 0) {
-						while (CURRENT_VALID)
+						while (current_valid())
 							end_request(0);
 						break;
 					}
@@ -1991,7 +1994,7 @@
 				AztTries = 0;
 				loop_ctl = 0;
 			}
-			if (CURRENT_VALID)
+			if (current_valid())
 				end_request(0);
 			AztTries = 5;
 		}
@@ -2065,7 +2068,7 @@
 					break;
 				}
 				azt_state = AZT_S_IDLE;
-				while (CURRENT_VALID)
+				while (current_valid())
 					end_request(0);
 				return;
 			}
@@ -2120,12 +2123,12 @@
 					break;
 				}
 				azt_state = AZT_S_IDLE;
-				while (CURRENT_VALID)
+				while (current_valid())
 					end_request(0);
 				return;
 			}
 
-			if (CURRENT_VALID) {
+			if (current_valid()) {
 				struct azt_Play_msf msf;
 				int i;
 				azt_next_bn = CURRENT->sector / 4;
@@ -2218,7 +2221,7 @@
 						AztTries = 0;
 						break;
 					}
-					if (CURRENT_VALID)
+					if (current_valid())
 						end_request(0);
 					AztTries = 5;
 				}
@@ -2246,8 +2249,7 @@
 				}
 #endif
 				AztTries = 5;
-				if (!CURRENT_VALID
-				    && azt_buf_in == azt_buf_out) {
+				if (!current_valid() && azt_buf_in == azt_buf_out) {
 					azt_state = AZT_S_STOP;
 					loop_ctl = 1;
 					break;
@@ -2319,7 +2321,7 @@
 					}
 				}
 				if (!azt_transfer_is_active) {
-					while (CURRENT_VALID) {
+					while (current_valid()) {
 						azt_transfer();
 						if (CURRENT->nr_sectors ==
 						    0)
@@ -2329,7 +2331,7 @@
 					}
 				}
 
-				if (CURRENT_VALID
+				if (current_valid()
 				    && (CURRENT->sector / 4 < azt_next_bn
 					|| CURRENT->sector / 4 >
 					azt_next_bn + AZT_BUF_SIZ)) {
@@ -2403,10 +2405,10 @@
 
 #ifdef AZT_TEST3
 			printk("CURRENT_VALID %d azt_mode %d\n",
-			       CURRENT_VALID, azt_mode);
+			       current_valid(), azt_mode);
 #endif
 
-			if (CURRENT_VALID) {
+			if (current_valid()) {
 				if (st != -1) {
 					if (azt_mode == 1) {
 						azt_state = AZT_S_READ;
diff -ur linux-2.5.18/drivers/cdrom/cdu31a.c linux/drivers/cdrom/cdu31a.c
--- linux-2.5.18/drivers/cdrom/cdu31a.c	2002-05-25 03:55:20.000000000 +0200
+++ linux/drivers/cdrom/cdu31a.c	2002-05-28 19:57:22.000000000 +0200
@@ -1563,11 +1563,6 @@
 		interruptible_sleep_on(&sony_wait);
 		if (signal_pending(current)) {
 			restore_flags(flags);
-			if (!QUEUE_EMPTY
-			    && CURRENT->rq_status != RQ_INACTIVE) {
-				end_request(0);
-			}
-			restore_flags(flags);
 #if DEBUG
 			printk("Leaving do_cdu31a_request at %d\n",
 			       __LINE__);
diff -ur linux-2.5.18/drivers/cdrom/gscd.c linux/drivers/cdrom/gscd.c
--- linux-2.5.18/drivers/cdrom/gscd.c	2002-05-25 03:55:17.000000000 +0200
+++ linux/drivers/cdrom/gscd.c	2002-05-28 20:00:25.000000000 +0200
@@ -288,7 +288,7 @@
 	block = CURRENT->sector;
 	nsect = CURRENT->nr_sectors;
 
-	if (QUEUE_EMPTY || CURRENT->sector == -1)
+	if (CURRENT->sector == -1)
 		goto out;
 
 	if (CURRENT->cmd != READ) {
diff -ur linux-2.5.18/drivers/cdrom/mcd.c linux/drivers/cdrom/mcd.c
--- linux-2.5.18/drivers/cdrom/mcd.c	2002-05-25 03:55:18.000000000 +0200
+++ linux/drivers/cdrom/mcd.c	2002-05-28 19:24:20.000000000 +0200
@@ -119,9 +119,13 @@
 #define QUICK_LOOP_DELAY udelay(45)	/* use udelay */
 #define QUICK_LOOP_COUNT 20
 
-#define CURRENT_VALID \
-(!QUEUE_EMPTY && major(CURRENT -> rq_dev) == MAJOR_NR && CURRENT -> cmd == READ \
-&& CURRENT -> sector != -1)
+static int current_valid(void)
+{
+        return !blk_queue_empty(QUEUE) &&
+	        major(CURRENT->rq_dev) == MAJOR_NR &&
+		CURRENT->cmd == READ &&
+		CURRENT->sector != -1;
+}
 
 #define MFL_STATUSorDATA (MFL_STATUS | MFL_DATA)
 #define MCD_BUF_SIZ 16
@@ -556,33 +560,33 @@
 
 static void mcd_transfer(void)
 {
-	if (CURRENT_VALID) {
-		while (CURRENT->nr_sectors) {
-			int bn = CURRENT->sector / 4;
-			int i;
-			for (i = 0; i < MCD_BUF_SIZ && mcd_buf_bn[i] != bn;
-			     ++i);
-			if (i < MCD_BUF_SIZ) {
-				int offs =(i * 4 + (CURRENT->sector & 3)) * 512;
-				int nr_sectors = 4 - (CURRENT->sector & 3);
-				if (mcd_buf_out != i) {
-					mcd_buf_out = i;
-					if (mcd_buf_bn[i] != bn) {
-						mcd_buf_out = -1;
-						continue;
-					}
+	if (!current_valid())
+		return;
+
+	while (CURRENT->nr_sectors) {
+		int bn = CURRENT->sector / 4;
+		int i;
+		for (i = 0; i < MCD_BUF_SIZ && mcd_buf_bn[i] != bn; ++i)
+			;
+		if (i < MCD_BUF_SIZ) {
+			int offs =(i * 4 + (CURRENT->sector & 3)) * 512;
+			int nr_sectors = 4 - (CURRENT->sector & 3);
+			if (mcd_buf_out != i) {
+				mcd_buf_out = i;
+				if (mcd_buf_bn[i] != bn) {
+					mcd_buf_out = -1;
+					continue;
 				}
-				if (nr_sectors > CURRENT->nr_sectors)
-					nr_sectors = CURRENT->nr_sectors;
-				memcpy(CURRENT->buffer, mcd_buf + offs,
-				       nr_sectors * 512);
-				CURRENT->nr_sectors -= nr_sectors;
-				CURRENT->sector += nr_sectors;
-				CURRENT->buffer += nr_sectors * 512;
-			} else {
-				mcd_buf_out = -1;
-				break;
 			}
+			if (nr_sectors > CURRENT->nr_sectors)
+				nr_sectors = CURRENT->nr_sectors;
+			memcpy(CURRENT->buffer, mcd_buf + offs, nr_sectors * 512);
+			CURRENT->nr_sectors -= nr_sectors;
+			CURRENT->sector += nr_sectors;
+			CURRENT->buffer += nr_sectors * 512;
+		} else {
+		        mcd_buf_out = -1;
+			break;
 		}
 	}
 }
@@ -614,7 +618,7 @@
 	       CURRENT->nr_sectors));
 
 		mcd_transfer_is_active = 1;
-	while (CURRENT_VALID) {
+	while (current_valid()) {
 		mcd_transfer();
 		if (CURRENT->nr_sectors == 0) {
 			end_request(1);
@@ -623,7 +627,7 @@
 			if (mcd_state == MCD_S_IDLE) {
 				if (!tocUpToDate) {
 					if (updateToc() < 0) {
-						while (CURRENT_VALID)
+						while (current_valid())
 							end_request(0);
 						break;
 					}
@@ -688,7 +692,7 @@
 					McdTries = 0;
 					goto ret;
 				}
-				if (CURRENT_VALID)
+				if (current_valid())
 					end_request(0);
 				McdTries = MCD_RETRY_ATTEMPTS;
 			}
@@ -745,7 +749,7 @@
 				       "mcd: door open\n" :
 				       "mcd: disk removed\n");
 				mcd_state = MCD_S_IDLE;
-				while (CURRENT_VALID)
+				while (current_valid())
 					end_request(0);
 				goto out;
 			}
@@ -779,12 +783,12 @@
 				       "mcd: door open\n" :
 				       "mcd: disk removed\n");
 				mcd_state = MCD_S_IDLE;
-				while (CURRENT_VALID)
+				while (current_valid())
 					end_request(0);
 				goto out;
 			}
 
-			if (CURRENT_VALID) {
+			if (current_valid()) {
 				struct mcd_Play_msf msf;
 				mcd_next_bn = CURRENT->sector / 4;
 				hsg2msf(mcd_next_bn, &msf.start);
@@ -820,7 +824,7 @@
 					McdTries = 0;
 					break;
 				}
-				if (CURRENT_VALID)
+				if (current_valid())
 					end_request(0);
 				McdTries = 5;
 			}
@@ -833,7 +837,7 @@
 
 		default:
 			McdTries = 5;
-			if (!CURRENT_VALID && mcd_buf_in == mcd_buf_out) {
+			if (!current_valid() && mcd_buf_in == mcd_buf_out) {
 				mcd_state = MCD_S_STOP;
 				goto immediately;
 			}
@@ -845,7 +849,7 @@
 				mcd_buf_out = mcd_buf_in;
 			mcd_buf_in = mcd_buf_in + 1 == MCD_BUF_SIZ ? 0 : mcd_buf_in + 1;
 			if (!mcd_transfer_is_active) {
-				while (CURRENT_VALID) {
+				while (current_valid()) {
 					mcd_transfer();
 					if (CURRENT->nr_sectors == 0)
 						end_request(1);
@@ -854,7 +858,7 @@
 				}
 			}
 
-			if (CURRENT_VALID
+			if (current_valid()
 			    && (CURRENT->sector / 4 < mcd_next_bn ||
 				CURRENT->sector / 4 > mcd_next_bn + 16)) {
 				mcd_state = MCD_S_STOP;
@@ -933,8 +937,9 @@
 		st = -1;
 
 do_not_work_around_mitsumi_bug_93_2:
-		test3(printk("CURRENT_VALID %d mcd_mode %d\n", CURRENT_VALID, mcd_mode));
-		if (CURRENT_VALID) {
+		test3(printk("CURRENT_VALID %d mcd_mode %d\n", current_valid(),
+			    mcd_mode));
+		if (current_valid()) {
 			if (st != -1) {
 				if (mcd_mode == 1)
 					goto read_immediately;
diff -ur linux-2.5.18/drivers/cdrom/optcd.c linux/drivers/cdrom/optcd.c
--- linux-2.5.18/drivers/cdrom/optcd.c	2002-05-25 03:55:21.000000000 +0200
+++ linux/drivers/cdrom/optcd.c	2002-05-28 19:28:07.000000000 +0200
@@ -973,11 +973,13 @@
 \f
 /* Request handling */
 
-
-#define CURRENT_VALID \
-	(!QUEUE_EMPTY && major(CURRENT -> rq_dev) == MAJOR_NR \
-	 && CURRENT -> cmd == READ && CURRENT -> sector != -1)
-
+static int current_valid(void)
+{
+        return !blk_queue_empty(QUEUE) &&
+	        major(CURRENT->rq_dev) == MAJOR_NR &&
+		CURRENT->cmd == READ &&
+		CURRENT->sector != -1;
+}
 
 /* Buffers for block size conversion. */
 #define NOBUF		-1
@@ -1006,7 +1008,7 @@
 	printk(KERN_DEBUG "optcd: executing transfer\n");
 #endif
 
-	if (!CURRENT_VALID)
+	if (!current_valid())
 		return;
 	while (CURRENT -> nr_sectors) {
 		int bn = CURRENT -> sector / 4;
@@ -1092,7 +1094,7 @@
 				" Giving up\n", next_bn);
 			if (transfer_is_active)
 				loop_again = 0;
-			if (CURRENT_VALID)
+			if (current_valid())
 				end_request(0);
 			tries = 5;
 		}
@@ -1126,7 +1128,7 @@
 				break;
 			if (send_cmd(COMDRVST)) {
 				state = S_IDLE;
-				while (CURRENT_VALID)
+				while (current_valid())
 					end_request(0);
 				return;
 			}
@@ -1153,11 +1155,11 @@
 					? "door open"
 					: "disk removed");
 				state = S_IDLE;
-				while (CURRENT_VALID)
+				while (current_valid())
 					end_request(0);
 				return;
 			}
-			if (!CURRENT_VALID) {
+			if (!current_valid()) {
 				state = S_STOP;
 				loop_again = 1;
 				break;
@@ -1208,7 +1210,7 @@
 						tries = 0;
 						break;
 					}
-					if (CURRENT_VALID)
+					if (current_valid())
 						end_request(0);
 					tries = 5;
 				}
@@ -1219,7 +1221,7 @@
 				break;
 			default:	/* DTEN low */
 				tries = 5;
-				if (!CURRENT_VALID && buf_in == buf_out) {
+				if (!current_valid() && buf_in == buf_out) {
 					state = S_STOP;
 					loop_again = 1;
 					break;
@@ -1272,7 +1274,7 @@
 						N_BUFS ? 0 : buf_in + 1;
 				}
 				if (!transfer_is_active) {
-					while (CURRENT_VALID) {
+					while (current_valid()) {
 						transfer();
 						if (CURRENT -> nr_sectors == 0)
 							end_request(1);
@@ -1281,7 +1283,7 @@
 					}
 				}
 
-				if (CURRENT_VALID
+				if (current_valid()
 				    && (CURRENT -> sector / 4 < next_bn ||
 				    CURRENT -> sector / 4 >
 				     next_bn + N_BUFS)) {
@@ -1305,7 +1307,7 @@
 			flush_data();
 			if (send_cmd(COMDRVST)) {
 				state = S_IDLE;
-				while (CURRENT_VALID)
+				while (current_valid())
 					end_request(0);
 				return;
 			}
@@ -1320,7 +1322,7 @@
 				toc_uptodate = 0;
 				opt_invalidate_buffers();
 			}
-			if (CURRENT_VALID) {
+			if (current_valid()) {
 				if (status >= 0) {
 					state = S_READ;
 					loop_again = 1;
@@ -1346,7 +1348,7 @@
 		state = S_STOP;
 		if (exec_cmd(COMSTOP) < 0) {
 			state = S_IDLE;
-			while (CURRENT_VALID)
+			while (current_valid())
 				end_request(0);
 			return;
 		}
@@ -1368,7 +1370,7 @@
 	}
 
 	transfer_is_active = 1;
-	while (CURRENT_VALID) {
+	while (current_valid()) {
 		transfer();	/* First try to transfer block from buffers */
 		if (CURRENT -> nr_sectors == 0) {
 			end_request(1);
@@ -1377,7 +1379,7 @@
 			if (state == S_IDLE) {
 				/* %% Should this block the request queue?? */
 				if (update_toc() < 0) {
-					while (CURRENT_VALID)
+					while (current_valid())
 						end_request(0);
 					break;
 				}
diff -ur linux-2.5.18/drivers/cdrom/sbpcd.c linux/drivers/cdrom/sbpcd.c
--- linux-2.5.18/drivers/cdrom/sbpcd.c	2002-05-25 03:55:20.000000000 +0200
+++ linux/drivers/cdrom/sbpcd.c	2002-05-28 19:25:45.000000000 +0200
@@ -4902,7 +4902,7 @@
 #ifdef DEBUG_GTL
 	xnr=++xx_nr;
 
-	if(QUEUE_EMPTY)
+	if(blk_queue_empty(QUEUE))
 	{
 		printk( "do_sbpcd_request[%di](NULL), Pid:%d, Time:%li\n",
 			xnr, current->pid, jiffies);
diff -ur linux-2.5.18/drivers/cdrom/sjcd.c linux/drivers/cdrom/sjcd.c
--- linux-2.5.18/drivers/cdrom/sjcd.c	2002-05-25 03:55:28.000000000 +0200
+++ linux/drivers/cdrom/sjcd.c	2002-05-28 19:30:08.000000000 +0200
@@ -1074,16 +1074,20 @@
  * When Linux gets variable block sizes this will probably go away.
  */
 
-#define CURRENT_IS_VALID                                      \
-    ( !QUEUE_EMPTY && major( CURRENT->rq_dev ) == MAJOR_NR && \
-      CURRENT->cmd == READ && CURRENT->sector != -1 )
+static int current_valid(void)
+{
+        return !blk_queue_empty(QUEUE) &&
+	        major(CURRENT->rq_dev) == MAJOR_NR &&
+		CURRENT->cmd == READ &&
+		CURRENT->sector != -1;
+}
 
 static void sjcd_transfer(void)
 {
 #if defined( SJCD_TRACE )
 	printk("SJCD: transfer:\n");
 #endif
-	if (CURRENT_IS_VALID) {
+	if (current_valid()) {
 		while (CURRENT->nr_sectors) {
 			int i, bn = CURRENT->sector / 4;
 			for (i = 0;
@@ -1239,7 +1243,7 @@
 					}
 				}
 
-				if (CURRENT_IS_VALID) {
+				if (current_valid()) {
 					struct sjcd_play_msf msf;
 
 					sjcd_next_bn = CURRENT->sector / 4;
@@ -1307,7 +1311,7 @@
 					    ("SJCD: read block %d failed, maybe audio disk? Giving up\n",
 					     sjcd_next_bn);
 #endif
-					if (CURRENT_IS_VALID)
+					if (current_valid())
 						end_request(0);
 #if defined( SJCD_TRACE )
 					printk
@@ -1332,7 +1336,7 @@
 				 * Otherwise cdrom hangs up. Check to see if we have something to copy
 				 * to.
 				 */
-				if (!CURRENT_IS_VALID
+				if (!current_valid()
 				    && sjcd_buf_in == sjcd_buf_out) {
 #if defined( SJCD_TRACE )
 					printk
@@ -1373,7 +1377,7 @@
 					 * OK, request seems to be precessed. Continue transferring...
 					 */
 					if (!sjcd_transfer_is_active) {
-						while (CURRENT_IS_VALID) {
+						while (current_valid()) {
 							/*
 							 * Continue transferring.
 							 */
@@ -1387,7 +1391,7 @@
 								break;
 						}
 					}
-					if (CURRENT_IS_VALID &&
+					if (current_valid() &&
 					    (CURRENT->sector / 4 <
 					     sjcd_next_bn
 					     || CURRENT->sector / 4 >
@@ -1450,7 +1454,7 @@
 					sjcd_toc_uptodate = 0;
 					sjcd_invalidate_buffers();
 				}
-				if (CURRENT_IS_VALID) {
+				if (current_valid()) {
 					if (sjcd_status_valid)
 						sjcd_transfer_state =
 						    SJCD_S_READ;
@@ -1476,7 +1480,7 @@
 
 	if (--sjcd_transfer_timeout == 0) {
 		printk("SJCD: timeout in state %d\n", sjcd_transfer_state);
-		while (CURRENT_IS_VALID)
+		while (current_valid())
 			end_request(0);
 		sjcd_send_cmd(SCMD_STOP);
 		sjcd_transfer_state = SJCD_S_IDLE;
@@ -1497,7 +1501,7 @@
 	       CURRENT->sector, CURRENT->nr_sectors);
 #endif
 	sjcd_transfer_is_active = 1;
-	while (CURRENT_IS_VALID) {
+	while (current_valid()) {
 		sjcd_transfer();
 		if (CURRENT->nr_sectors == 0)
 			end_request(1);
@@ -1508,7 +1512,7 @@
 					if (sjcd_update_toc() < 0) {
 						printk
 						    ("SJCD: transfer: discard\n");
-						while (CURRENT_IS_VALID)
+						while (current_valid())
 							end_request(0);
 						break;
 					}
diff -ur linux-2.5.18/drivers/ide/hd.c linux/drivers/ide/hd.c
--- linux-2.5.18/drivers/ide/hd.c	2002-05-25 03:55:20.000000000 +0200
+++ linux/drivers/ide/hd.c	2002-05-28 20:00:11.000000000 +0200
@@ -167,7 +167,7 @@
 	unsigned long flags;
 	char devc;
 
-	devc = !QUEUE_EMPTY ? 'a' + DEVICE_NR(CURRENT->rq_dev) : '?';
+	devc = !blk_queue_empty(QUEUE) ? 'a' + DEVICE_NR(CURRENT->rq_dev) : '?';
 	save_flags (flags);
 	sti();
 #ifdef VERBOSE_ERRORS
@@ -196,7 +196,7 @@
 		if (hd_error & (BBD_ERR|ECC_ERR|ID_ERR|MARK_ERR)) {
 			printk(", CHS=%d/%d/%d", (inb(HD_HCYL)<<8) + inb(HD_LCYL),
 				inb(HD_CURRENT) & 0xf, inb(HD_SECTOR));
-			if (!QUEUE_EMPTY)
+			if (!blk_queue_empty(QUEUE))
 				printk(", sector=%ld", CURRENT->sector);
 		}
 		printk("\n");
@@ -373,7 +373,7 @@
 {
 	int dev;
 
-	if (QUEUE_EMPTY)
+	if (blk_queue_empty(QUEUE))
 		return;
 	dev = DEVICE_NR(CURRENT->rq_dev);
 	if (++CURRENT->errors >= MAX_ERRORS || (hd_error & BBD_ERR)) {
@@ -436,7 +436,7 @@
 #if (HD_DELAY > 0)
 	last_req = read_timer();
 #endif
-	if (!QUEUE_EMPTY)
+	if (!blk_queue_empty(QUEUE))
 		hd_request();
 	return;
 }
@@ -497,8 +497,10 @@
 	unsigned int dev;
 
 	DEVICE_INTR = NULL;
-	if (QUEUE_EMPTY)
+
+	if (blk_queue_empty(QUEUE))
 		return;
+
 	disable_irq(HD_IRQ);
 	sti();
 	reset = 1;
diff -ur linux-2.5.18/drivers/mtd/mtdblock.c linux/drivers/mtd/mtdblock.c
--- linux-2.5.18/drivers/mtd/mtdblock.c	2002-05-25 03:55:24.000000000 +0200
+++ linux/drivers/mtd/mtdblock.c	2002-05-28 19:44:58.000000000 +0200
@@ -19,15 +19,6 @@
 #define DEVICE_NR(device) (device)
 #define LOCAL_END_REQUEST
 #include <linux/blk.h>
-/* for old kernels... */
-#ifndef QUEUE_EMPTY
-#define QUEUE_EMPTY  (!CURRENT)
-#endif
-#if LINUX_VERSION_CODE < 0x20300
-#define QUEUE_PLUGGED (blk_dev[MAJOR_NR].plug_tq.sync)
-#else
-#define QUEUE_PLUGGED (blk_queue_plugged(QUEUE))
-#endif
 
 #ifdef CONFIG_DEVFS_FS
 #include <linux/devfs_fs_kernel.h>
@@ -486,7 +477,7 @@
 		add_wait_queue(&thr_wq, &wait);
 		set_current_state(TASK_INTERRUPTIBLE);
 		spin_lock_irq(QUEUE->queue_lock);
-		if (QUEUE_EMPTY || QUEUE_PLUGGED) {
+		if (blk_queue_empty(QUEUE) || blk_queue_plugged(QUEUE)) {
 			spin_unlock_irq(QUEUE->queue_lock);
 			schedule();
 			remove_wait_queue(&thr_wq, &wait); 
diff -ur linux-2.5.18/drivers/mtd/mtdblock_ro.c linux/drivers/mtd/mtdblock_ro.c
--- linux-2.5.18/drivers/mtd/mtdblock_ro.c	2002-05-25 03:55:26.000000000 +0200
+++ linux/drivers/mtd/mtdblock_ro.c	2002-05-28 20:10:35.000000000 +0200
@@ -132,7 +132,7 @@
 
       mtd = __get_mtd_device(NULL, minor(current_request->rq_dev));
       if (!mtd) {
-	      printk("MTD device %d doesn't appear to exist any more\n", CURRENT_DEV);
+	      printk("MTD device %d doesn't appear to exist any more\n", DEVICE_NR(CURRENT->rq_dev));
 	      mtdblock_end_request(current_request, 0);
       }
 
diff -ur linux-2.5.18/include/linux/blk.h linux/include/linux/blk.h
--- linux-2.5.18/include/linux/blk.h	2002-05-25 03:55:22.000000000 +0200
+++ linux/include/linux/blk.h	2002-05-28 20:19:50.000000000 +0200
@@ -293,20 +293,15 @@
 #if !defined(IDE_DRIVER)
 
 #ifndef CURRENT
-#define CURRENT elv_next_request(&blk_dev[MAJOR_NR].request_queue)
+# define CURRENT elv_next_request(&blk_dev[MAJOR_NR].request_queue)
 #endif
 #ifndef QUEUE
-#define QUEUE (&blk_dev[MAJOR_NR].request_queue)
-#endif
-#ifndef QUEUE_EMPTY
-#define QUEUE_EMPTY blk_queue_empty(QUEUE)
+# define QUEUE (&blk_dev[MAJOR_NR].request_queue)
 #endif
 #ifndef DEVICE_NAME
-#define DEVICE_NAME "unknown"
+# define DEVICE_NAME "unknown"
 #endif
 
-#define CURRENT_DEV DEVICE_NR(CURRENT->rq_dev)
-
 #ifdef DEVICE_INTR
 static void (*DEVICE_INTR)(void) = NULL;
 #endif

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] 2.5.18 IDE 73
  2002-05-25  2:02 Linux-2.5.18 Linus Torvalds
                   ` (3 preceding siblings ...)
  2002-05-28 17:35 ` [PATCH] 2.5.18 QUEUE_EMPTY and the unpleasant friends Martin Dalecki
@ 2002-05-29 12:11 ` Martin Dalecki
  2002-05-29 12:58   ` Zwane Mwaikambo
  2002-05-29 12:20 ` [PATCH] 2.5.18 IDE 74 Martin Dalecki
  2002-05-29 16:03 ` [PATCH] 2.5.18 IDE 75 Martin Dalecki
  6 siblings, 1 reply; 48+ messages in thread
From: Martin Dalecki @ 2002-05-29 12:11 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 1308 bytes --]

Tue May 28 17:25:29 CEST 2002 ide-clean-73

- Merge ide-probe.c and ide-features.c in to one single file.  They are
   mutually doing basically the same and in esp. in case of the device ID
   retrieval there *is* quite a lot of code duplication between them.
   ide-geometry.c fits there as well.

- Remove ide_xfer_verbose - it wasn't really used.

- Don't allow check_partition to be more clever then the writer of a driver.
   It was interfering with drivers which check partitions as they go and
   finally if we want to spew something about it - we can do it ourself.

- Eliminate ide_geninit(). We scan for partitions now inside the recently
   introduced attach method. register_disk() is broken by the way and 90% of
   places where it's used it is doing literally nothing. Either some one didn't
   finish some code or the code is basically just junk from the past.

   Anyway we grok the partitions now one by one as we detect the channels.

- ide_driveid_update is gone. We don't report the drive id through /proc/ide
   and we don't have to update it any longer on the fly. Still someone out there
   complaining that it went away!?

- Use the global driver spin-lock to protect data structure access in the
   ide_register_subdriver() function instead of blatantly disabling all
   interrupts.

[-- Attachment #2: ide-clean-73.diff.gz --]
[-- Type: application/x-gzip, Size: 31347 bytes --]

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] 2.5.18 IDE 74
  2002-05-25  2:02 Linux-2.5.18 Linus Torvalds
                   ` (4 preceding siblings ...)
  2002-05-29 12:11 ` [PATCH] 2.5.18 IDE 73 Martin Dalecki
@ 2002-05-29 12:20 ` Martin Dalecki
  2002-05-29 16:03 ` [PATCH] 2.5.18 IDE 75 Martin Dalecki
  6 siblings, 0 replies; 48+ messages in thread
From: Martin Dalecki @ 2002-05-29 12:20 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 81 bytes --]

Wed May 29 04:35:14 CEST 2002 ide-clean-74

- Simplify the ide-pci code further.

[-- Attachment #2: ide-clean-74.diff --]
[-- Type: text/plain, Size: 15376 bytes --]

diff -urN linux-2.5.18/drivers/ide/alim15x3.c linux/drivers/ide/alim15x3.c
--- linux-2.5.18/drivers/ide/alim15x3.c	2002-05-25 03:55:28.000000000 +0200
+++ linux/drivers/ide/alim15x3.c	2002-05-29 04:29:02.000000000 +0200
@@ -685,20 +685,35 @@
 
 
 /* module data table */
-static struct ata_pci_device chipset __initdata = {
-	vendor: PCI_VENDOR_ID_AL,
-        device: PCI_DEVICE_ID_AL_M5229,
-	init_chipset: ali15x3_init_chipset,
-	ata66_check: ali15x3_ata66_check,
-	init_channel: ali15x3_init_channel,
-	init_dma: ali15x3_init_dma,
-	enablebits: { {0x00,0x00,0x00}, {0x00,0x00,0x00} },
-	bootable: ON_BOARD
+static struct ata_pci_device chipsets[] __initdata = {
+	{
+		vendor: PCI_VENDOR_ID_AL,
+	        device: PCI_DEVICE_ID_AL_M5219,
+		/* FIXME: Perhaps we should use the same init routines
+		 * as below here. */
+		enablebits: { {0x00,0x00,0x00}, {0x00,0x00,0x00} },
+		bootable: ON_BOARD,
+		flags: ATA_F_SIMPLEX
+	},
+	{
+		vendor: PCI_VENDOR_ID_AL,
+	        device: PCI_DEVICE_ID_AL_M5229,
+		init_chipset: ali15x3_init_chipset,
+		ata66_check: ali15x3_ata66_check,
+		init_channel: ali15x3_init_channel,
+		init_dma: ali15x3_init_dma,
+		enablebits: { {0x00,0x00,0x00}, {0x00,0x00,0x00} },
+		bootable: ON_BOARD
+	}
 };
 
 int __init init_ali15x3(void)
 {
-	ata_register_chipset(&chipset);
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(chipsets); ++i) {
+		ata_register_chipset(&chipsets[i]);
+	}
 
         return 0;
 }
diff -urN linux-2.5.18/drivers/ide/amd74xx.c linux/drivers/ide/amd74xx.c
--- linux-2.5.18/drivers/ide/amd74xx.c	2002-05-25 03:55:28.000000000 +0200
+++ linux/drivers/ide/amd74xx.c	2002-05-29 04:16:52.000000000 +0200
@@ -443,7 +443,8 @@
 		init_channel: amd74xx_init_channel,
 		init_dma: amd74xx_init_dma,
 		enablebits: {{0x40,0x01,0x01}, {0x40,0x02,0x02}},
-		bootable: ON_BOARD
+		bootable: ON_BOARD,
+		flags: ATA_F_SIMPLEX
 	},
 	{
 		vendor:	PCI_VENDOR_ID_AMD,
diff -urN linux-2.5.18/drivers/ide/cmd64x.c linux/drivers/ide/cmd64x.c
--- linux-2.5.18/drivers/ide/cmd64x.c	2002-05-25 03:55:24.000000000 +0200
+++ linux/drivers/ide/cmd64x.c	2002-05-29 04:14:03.000000000 +0200
@@ -1099,6 +1099,7 @@
 		init_chipset: cmd64x_init_chipset,
 		init_channel: cmd64x_init_channel,
 		bootable: ON_BOARD,
+		flags: ATA_F_SIMPLEX,
 	},
 	{
 		vendor: PCI_VENDOR_ID_CMD,
diff -urN linux-2.5.18/drivers/ide/cs5530.c linux/drivers/ide/cs5530.c
--- linux-2.5.18/drivers/ide/cs5530.c	2002-05-29 02:34:39.000000000 +0200
+++ linux/drivers/ide/cs5530.c	2002-05-29 04:47:26.000000000 +0200
@@ -374,7 +374,7 @@
 	init_chipset: pci_init_cs5530,
 	init_channel: ide_init_cs5530,
 	bootable: ON_BOARD,
-	flags: ATA_F_DMA
+	flags: ATA_F_DMA | ATA_F_FDMA
 };
 
 int __init init_cs5530(void)
diff -urN linux-2.5.18/drivers/ide/ide-pci.c linux/drivers/ide/ide-pci.c
--- linux-2.5.18/drivers/ide/ide-pci.c	2002-05-28 18:22:15.000000000 +0200
+++ linux/drivers/ide/ide-pci.c	2002-05-29 04:51:47.000000000 +0200
@@ -62,85 +62,68 @@
 }
 
 /*
- * This allows off board ide-pci cards the enable a BIOS, verify interrupt
- * settings of split-mirror pci-config space, place chipset into init-mode,
- * and/or preserve an interrupt if the card is not native ide support.
- */
-static unsigned int __init trust_pci_irq(struct ata_pci_device *d, struct pci_dev *dev)
-{
-	if (d->flags & ATA_F_IRQ)
-		return dev->irq;
-
-	return 0;
-}
-
-/*
  * Match a PCI IDE port against an entry in ide_hwifs[],
  * based on io_base port if possible.
  */
 static struct ata_channel __init *lookup_channel(unsigned long io_base, int bootable, const char *name)
 {
 	int h;
-	struct ata_channel *hwif;
+	struct ata_channel *ch;
 
 	/*
-	 * Look for a hwif with matching io_base specified using
-	 * parameters to ide_setup().
+	 * Look for a channel with matching io_base default value.  If chipset is
+	 * "ide_unknown", then claim that channel slot.  Otherwise, some other
+	 * chipset has already claimed it..  :(
 	 */
 	for (h = 0; h < MAX_HWIFS; ++h) {
-		hwif = &ide_hwifs[h];
-		if (hwif->io_ports[IDE_DATA_OFFSET] == io_base) {
-			if (hwif->chipset == ide_generic)
-				return hwif; /* a perfect match */
-		}
-	}
-	/*
-	 * Look for a hwif with matching io_base default value.
-	 * If chipset is "ide_unknown", then claim that hwif slot.
-	 * Otherwise, some other chipset has already claimed it..  :(
-	 */
-	for (h = 0; h < MAX_HWIFS; ++h) {
-		hwif = &ide_hwifs[h];
-		if (hwif->io_ports[IDE_DATA_OFFSET] == io_base) {
-			if (hwif->chipset == ide_unknown)
-				return hwif; /* match */
-			printk("%s: port 0x%04lx already claimed by %s\n", name, io_base, hwif->name);
+		ch = &ide_hwifs[h];
+		if (ch->io_ports[IDE_DATA_OFFSET] == io_base) {
+			if (ch->chipset == ide_generic)
+				return ch; /* a perfect match */
+			if (ch->chipset == ide_unknown)
+				return ch; /* match */
+			printk(KERN_INFO "%s: port 0x%04lx already claimed by %s\n",
+					name, io_base, ch->name);
 			return NULL;	/* already claimed */
 		}
 	}
+
 	/*
-	 * Okay, there is no hwif matching our io_base,
-	 * so we'll just claim an unassigned slot.
+	 * Okay, there is no ch matching our io_base, so we'll just claim an
+	 * unassigned slot.
+	 *
 	 * Give preference to claiming other slots before claiming ide0/ide1,
-	 * just in case there's another interface yet-to-be-scanned
-	 * which uses ports 1f0/170 (the ide0/ide1 defaults).
+	 * just in case there's another interface yet-to-be-scanned which uses
+	 * ports 1f0/170 (the ide0/ide1 defaults).
 	 *
-	 * Unless there is a bootable card that does not use the standard
-	 * ports 1f0/170 (the ide0/ide1 defaults). The (bootable) flag.
+	 * Unless there is a bootable card that does not use the standard ports
+	 * 1f0/170 (the ide0/ide1 defaults). The (bootable) flag.
 	 */
+
 	if (bootable == ON_BOARD) {
 		for (h = 0; h < MAX_HWIFS; ++h) {
-			hwif = &ide_hwifs[h];
-			if (hwif->chipset == ide_unknown)
-				return hwif;	/* pick an unused entry */
+			ch = &ide_hwifs[h];
+			if (ch->chipset == ide_unknown)
+				return ch;	/* pick an unused entry */
 		}
 	} else {
 		for (h = 2; h < MAX_HWIFS; ++h) {
-			hwif = ide_hwifs + h;
-			if (hwif->chipset == ide_unknown)
-				return hwif;	/* pick an unused entry */
+			ch = &ide_hwifs[h];
+			if (ch->chipset == ide_unknown)
+				return ch;	/* pick an unused entry */
 		}
 	}
 	for (h = 0; h < 2; ++h) {
-		hwif = ide_hwifs + h;
-		if (hwif->chipset == ide_unknown)
-			return hwif;	/* pick an unused entry */
+		ch = &ide_hwifs[h];
+		if (ch->chipset == ide_unknown)
+			return ch;	/* pick an unused entry */
 	}
-	printk("%s: too many IDE interfaces, no room in table\n", name);
+	printk(KERN_INFO "%s: too many ATA interfaces.\n", name);
+
 	return NULL;
 }
 
-static int __init setup_pci_baseregs (struct pci_dev *dev, const char *name)
+static int __init setup_pci_baseregs(struct pci_dev *dev, const char *name)
 {
 	u8 reg;
 	u8 progif = 0;
@@ -175,110 +158,6 @@
 	return 0;
 }
 
-#ifdef CONFIG_BLK_DEV_IDEDMA
-
-/*
- * Fetch the DMA Bus-Master-I/O-Base-Address (BMIBA) from PCI space:
- */
-static unsigned long __init get_dma_base(struct ata_channel *hwif, int extra, const char *name)
-{
-	unsigned long	dma_base = 0;
-	struct pci_dev	*dev = hwif->pci_dev;
-
-	dma_base = pci_resource_start(dev, 4);
-	if (!dma_base)
-		return 0;
-
-	/* PDC20246, PDC20262, HPT343, & HPT366 */
-	if (extra) {
-		request_region(dma_base + 16, extra, name);
-		hwif->dma_extra = extra;
-	}
-
-	/* If we are on the second channel, the dma base address will be one
-	 * entry away from the primary interface.
-	 */
-	if (hwif->unit == ATA_SECONDARY)
-		dma_base += 8;
-
-	if ((dev->vendor == PCI_VENDOR_ID_AL && dev->device == PCI_DEVICE_ID_AL_M5219) ||
-			(dev->vendor == PCI_VENDOR_ID_AMD && dev->device == PCI_DEVICE_ID_AMD_VIPER_7409) ||
-			(dev->vendor == PCI_VENDOR_ID_CMD && dev->device == PCI_DEVICE_ID_CMD_643) ||
-			(dev->vendor == PCI_VENDOR_ID_SERVERWORKS && dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE)) {
-		outb(inb(dma_base + 2) & 0x60, dma_base+2);
-		if (inb(dma_base + 2) & 0x80)
-			printk(KERN_INFO "%s: simplex device: DMA forced\n", name);
-	} else {
-
-		/* If the device claims "simplex" DMA, this means only one of
-		 * the two interfaces can be trusted with DMA at any point in
-		 * time.  So we should enable DMA only on one of the two
-		 * interfaces.
-		 */
-
-		if ((inb(dma_base + 2) & 0x80)) {
-			if ((!hwif->drives[0].present && !hwif->drives[1].present) ||
-				hwif->unit == ATA_SECONDARY) {
-				printk("%s: simplex device:  DMA disabled\n", name);
-				dma_base = 0;
-			}
-		}
-	}
-
-	return dma_base;
-}
-
-/*
- * Setup DMA transfers on a channel.
- */
-static void __init setup_channel_dma(struct ata_channel *ch,
-		struct pci_dev *dev,
-		struct ata_pci_device *d,
-		int port,
-		u8 class_rev,
-		int pciirq,
-		int autodma,
-		unsigned short *pcicmd)
-{
-	unsigned long dma_base;
-
-	if (d->flags & ATA_F_NOADMA)
-		autodma = 0;
-
-	if (autodma)
-		ch->autodma = 1;
-
-	if (!((d->flags & ATA_F_DMA) || ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE && (dev->class & 0x80))))
-		return;
-
-	dma_base = get_dma_base(ch, ((port == ATA_PRIMARY) && d->extra) ? d->extra : 0, dev->name);
-	if (!dma_base) {
-		printk("%s: %s Bus-Master DMA was disabled by BIOS\n",
-				ch->name, dev->name);
-
-		return;
-	}
-	if (!(*pcicmd & PCI_COMMAND_MASTER)) {
-
-		/*
-		 * Set up BM-DMA capability (PnP BIOS should have done this already)
-		 */
-		if (!(d->vendor == PCI_VENDOR_ID_CYRIX && d->device == PCI_DEVICE_ID_CYRIX_5530_IDE))
-			ch->autodma = 0;	/* default DMA off if we had to configure it here */
-		pci_write_config_word(dev, PCI_COMMAND, *pcicmd | PCI_COMMAND_MASTER);
-		if (pci_read_config_word(dev, PCI_COMMAND, pcicmd) || !(*pcicmd & PCI_COMMAND_MASTER)) {
-			printk("%s: %s error updating PCICMD\n",
-					ch->name, dev->name);
-			dma_base = 0;
-		}
-	}
-	if (d->init_dma)
-		d->init_dma(ch, dma_base);
-	else
-		ata_init_dma(ch, dma_base);
-}
-#endif
-
 /*
  * Setup a particular port on an ATA host controller.
  *
@@ -293,6 +172,7 @@
 		unsigned short *pcicmd)
 {
 	unsigned long base = 0;
+	unsigned long dma_base;
 	unsigned long ctl = 0;
 	ide_pci_enablebit_t *e = &(d->enablebits[port]);
 	struct ata_channel *ch;
@@ -387,7 +267,79 @@
 	}
 
 #ifdef CONFIG_BLK_DEV_IDEDMA
-	setup_channel_dma(ch, dev, d, port, class_rev, pciirq, autodma, pcicmd);
+	/*
+	 * Setup DMA transfers on the channel.
+	 */
+	if (d->flags & ATA_F_NOADMA)
+		autodma = 0;
+
+	if (autodma)
+		ch->autodma = 1;
+
+	if (!((d->flags & ATA_F_DMA) || ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE && (dev->class & 0x80))))
+		goto no_dma;
+	/*
+	 * Fetch the DMA Bus-Master-I/O-Base-Address (BMIBA) from PCI space:
+	 */
+	dma_base = pci_resource_start(dev, 4);
+	if (dma_base) {
+		/* PDC20246, PDC20262, HPT343, & HPT366 */
+		if ((ch->unit == ATA_PRIMARY) && d->extra) {
+			request_region(dma_base + 16, d->extra, dev->name);
+			ch->dma_extra = d->extra;
+		}
+
+		/* If we are on the second channel, the dma base address will
+		 * be one entry away from the primary interface.
+		 */
+		if (ch->unit == ATA_SECONDARY)
+			dma_base += 8;
+
+		if (d->flags & ATA_F_SIMPLEX) {
+			outb(inb(dma_base + 2) & 0x60, dma_base + 2);
+			if (inb(dma_base + 2) & 0x80)
+				printk(KERN_INFO "%s: simplex device: DMA forced\n", dev->name);
+		} else {
+			/* If the device claims "simplex" DMA, this means only
+			 * one of the two interfaces can be trusted with DMA at
+			 * any point in time.  So we should enable DMA only on
+			 * one of the two interfaces.
+			 */
+			if ((inb(dma_base + 2) & 0x80)) {
+				if ((!ch->drives[0].present && !ch->drives[1].present) ||
+						ch->unit == ATA_SECONDARY) {
+					printk(KERN_INFO "%s: simplex device:  DMA disabled\n", dev->name);
+					dma_base = 0;
+				}
+			}
+		}
+	} else {
+		printk(KERN_INFO "%s: %s Bus-Master DMA was disabled by BIOS\n",
+				ch->name, dev->name);
+
+		goto no_dma;
+	}
+	if (!(*pcicmd & PCI_COMMAND_MASTER)) {
+		/*
+		 * Set up BM-DMA capability (PnP BIOS should have done this
+		 * already).  Default to DMA off on the drive, if we had to
+		 * configure it here.  This should most propably be enabled no
+		 * all chipsets which can be expected to be used on systems
+		 * without a BIOS equivalent.
+		 */
+		if (!(d->flags | ATA_F_FDMA))
+			ch->autodma = 0;
+		pci_write_config_word(dev, PCI_COMMAND, *pcicmd | PCI_COMMAND_MASTER);
+		if (pci_read_config_word(dev, PCI_COMMAND, pcicmd) || !(*pcicmd & PCI_COMMAND_MASTER)) {
+			printk("%s: %s error updating PCICMD\n",
+					ch->name, dev->name);
+			dma_base = 0;
+		}
+	}
+	if (d->init_dma)
+		d->init_dma(ch, dma_base);
+	else
+		ata_init_dma(ch, dma_base);
 #endif
 
 no_dma:
@@ -428,7 +380,7 @@
 
 check_if_enabled:
 	if (pci_read_config_word(dev, PCI_COMMAND, &pcicmd)) {
-		printk("%s: error accessing PCI regs\n", dev->name);
+		printk(KERN_ERR "%s: error accessing PCI regs\n", dev->name);
 		return;
 	}
 	if (!(pcicmd & PCI_COMMAND_IO)) {	/* is device disabled? */
@@ -495,8 +447,12 @@
 		 */
 		if (d->init_chipset)
 			pciirq = d->init_chipset(dev);
-		else
-			pciirq = trust_pci_irq(d, dev);
+		else {
+			if (d->flags & ATA_F_IRQ)
+				pciirq = dev->irq;
+			else
+				pciirq =  0;
+		}
 	} else if (tried_config) {
 		printk(KERN_INFO "ATA: will probe IRQs later\n");
 		pciirq = 0;
@@ -520,6 +476,10 @@
 	setup_host_channel(dev, d, ATA_SECONDARY, class_rev, pciirq, autodma, &pcicmd);
 }
 
+/*
+ * Fix crossover IRQ line setups between primary and secondary channel.  Quite
+ * a common bug apparently.
+ */
 static void __init pdc20270_device_order_fixup (struct pci_dev *dev, struct ata_pci_device *d)
 {
 	struct pci_dev *dev2 = NULL;
diff -urN linux-2.5.18/drivers/ide/pcihost.h linux/drivers/ide/pcihost.h
--- linux-2.5.18/drivers/ide/pcihost.h	2002-05-25 03:55:17.000000000 +0200
+++ linux/drivers/ide/pcihost.h	2002-05-29 14:27:18.000000000 +0200
@@ -102,14 +102,16 @@
 
 /* Flags used to untangle quirk handling.
  */
-#define ATA_F_DMA	0x01
-#define ATA_F_NODMA	0x02	/* no DMA mode supported at all */
-#define ATA_F_NOADMA	0x04	/* DMA has to be enabled explicitely */
-#define ATA_F_FIXIRQ	0x08	/* fixed irq wiring */
-#define ATA_F_SER	0x10	/* serialize on first and second channel interrupts */
-#define ATA_F_IRQ	0x20	/* trust IRQ information from config */
-#define ATA_F_PHACK	0x40	/* apply PROMISE hacks */
-#define ATA_F_HPTHACK	0x80	/* apply HPT366 hacks */
+#define ATA_F_DMA	0x001
+#define ATA_F_NODMA	0x002	/* no DMA mode supported at all */
+#define ATA_F_NOADMA	0x004	/* DMA has to be enabled explicitely */
+#define ATA_F_FDMA	0x008	/* force autodma */
+#define ATA_F_FIXIRQ	0x010	/* fixed irq wiring */
+#define ATA_F_SER	0x020	/* serialize on first and second channel interrupts */
+#define ATA_F_IRQ	0x040	/* trust IRQ information from config */
+#define ATA_F_PHACK	0x080	/* apply PROMISE hacks */
+#define ATA_F_HPTHACK	0x100	/* apply HPT366 hacks */
+#define ATA_F_SIMPLEX	0x200	/* force treatment as simple device */
 
 
 struct ata_pci_device {
diff -urN linux-2.5.18/drivers/ide/serverworks.c linux/drivers/ide/serverworks.c
--- linux-2.5.18/drivers/ide/serverworks.c	2002-05-29 02:34:39.000000000 +0200
+++ linux/drivers/ide/serverworks.c	2002-05-29 04:15:33.000000000 +0200
@@ -679,7 +679,8 @@
 		init_chipset: svwks_init_chipset,
 		ata66_check: svwks_ata66_check,
 		init_channel: ide_init_svwks,
-		bootable: ON_BOARD
+		bootable: ON_BOARD,
+		flags: ATA_F_SIMPLEX
 	},
 };
 

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] 2.5.18 IDE 73
  2002-05-29 12:58   ` Zwane Mwaikambo
@ 2002-05-29 12:52     ` Martin Dalecki
  0 siblings, 0 replies; 48+ messages in thread
From: Martin Dalecki @ 2002-05-29 12:52 UTC (permalink / raw)
  To: Zwane Mwaikambo; +Cc: Linus Torvalds, Kernel Mailing List

Zwane Mwaikambo wrote:
> Hi Marcin,
> 	Just a few comments, please don't mistake it for nitpicking, but 
> perhaps a request for clarification.

No problem at all.

> 
> On Wed, 29 May 2002, Martin Dalecki wrote:
> 
> 
>>- Don't allow check_partition to be more clever then the writer of a driver.
>>   It was interfering with drivers which check partitions as they go and
>>   finally if we want to spew something about it - we can do it ourself.
> 
> 
> Should this really be the case? Isn't the driver the one that is 
> interfering in this case?

No please have a close look at the boot sequence of
the 2.5.18 kernel without the above patch applied.
It will:

1. Spew the "Paritition checks" message ony once directly after the
    detection of the drive /dev/hda geometry and then never again.

2. It will check the partitions twice, without the above message.

After hot plugging some device the above message should be
perhaps reintroduced, but right now it won't appear at all.

The ideal thing we should do would be:

Detect a channel, detect a disk on a channel, detect partitions on it.

Right now we where doing:
Look for disks, where there are disks, assume there is a channel too.
Look for all disks goemetries.
Look for all disks partitions.

Wuite worng in the context of  aproper support for hot
plugging stuff.

So I'm *very* confident about the above change.

>>   Anyway we grok the partitions now one by one as we detect the channels.
> 
> 
> Same as above.

What's your problem here - that's the proper thing to do.


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] 2.5.18 IDE 73
  2002-05-29 12:11 ` [PATCH] 2.5.18 IDE 73 Martin Dalecki
@ 2002-05-29 12:58   ` Zwane Mwaikambo
  2002-05-29 12:52     ` Martin Dalecki
  0 siblings, 1 reply; 48+ messages in thread
From: Zwane Mwaikambo @ 2002-05-29 12:58 UTC (permalink / raw)
  To: Martin Dalecki; +Cc: Linus Torvalds, Kernel Mailing List

Hi Marcin,
	Just a few comments, please don't mistake it for nitpicking, but 
perhaps a request for clarification.

On Wed, 29 May 2002, Martin Dalecki wrote:

> - Don't allow check_partition to be more clever then the writer of a driver.
>    It was interfering with drivers which check partitions as they go and
>    finally if we want to spew something about it - we can do it ourself.

Should this really be the case? Isn't the driver the one that is 
interfering in this case?

>    Anyway we grok the partitions now one by one as we detect the channels.

Same as above.

Thanks,
	Zwane Mwaikambo

-- 
http://function.linuxpower.ca
		


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] 2.5.18 IDE 73
  2002-05-29 13:59 [PATCH] 2.5.18 IDE 73 Gerald Champagne
@ 2002-05-29 13:03 ` Martin Dalecki
  2002-05-29 14:26   ` Gerald Champagne
                     ` (2 more replies)
  0 siblings, 3 replies; 48+ messages in thread
From: Martin Dalecki @ 2002-05-29 13:03 UTC (permalink / raw)
  To: Gerald Champagne; +Cc: linux-kernel

Gerald Champagne wrote:
>>- ide_driveid_update is gone. We don't report the drive id through 
>>/proc/ide and we don't have to update it any longer on the fly. Still 
>>someone out there complaining that it went away!?
> 
> 
> But the id information is still available through the ioctl interface. 
> ide_driveid_update was used to update the dma_ultra, dma_mword, and
> dma_lword fields in the id structure after changing the rate with an
> ioctl command.  Won't these fields be wrong if the rate is changed after
> initialization?  Won't "hdparm -i" show outdated and incorrect
> information.
> 
> It's good to see the duplicate identify routine go away, but the ioctl
> shouldn't return incorrect information.  Can the remaining identify
> routine be modified and called directly from the ioctl that returns the
> id information?
> 
> Gerald

Dear Gerald please look closer. The hdparm -i is executing the
drive id command directly and does *not* rely on the internally
permanently dragged around id structure. So the change I did
is entierly fine. Just go ahead and check whatever hdparm -i /dev/hdx
reports the proper thing after changing some dma setting.
It does - I did check it :-).

BTW> The next thing to be gone is simple the fact that we drag
around the id information permanently, where infact only
some capabilitie fields are sucked out of it and the
device identification string is only needed for reporting
during boot-up.



^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] 2.5.18 IDE 73
  2002-05-29 14:35   ` Russell King
@ 2002-05-29 13:40     ` Martin Dalecki
  0 siblings, 0 replies; 48+ messages in thread
From: Martin Dalecki @ 2002-05-29 13:40 UTC (permalink / raw)
  To: Russell King; +Cc: Gerald Champagne, linux-kernel

Russell King wrote:
> On Wed, May 29, 2002 at 03:03:27PM +0200, Martin Dalecki wrote:
> 
>>Dear Gerald please look closer. The hdparm -i is executing the
>>drive id command directly and does *not* rely on the internally
> 
> 
> hdparm -i uses the HDIO_GET_IDENTITY ioctl, which returns drive->id.
> It doesn't obtain the ID from the drive.  hdparm -I asks the
> identity from the drive.

Yes. But this will be just changed soon, since there
is no reaons at all to don't just read it always from the drive, in esp.
in face of the above.

BTW.> The above function was only used when the user
invoked ioctl() - that was my point.

> hdparm --help gives some hints:
> 
>  -i   display drive identification
>  -I   read drive identification directly from drive
> 
> and the man page is quite clear:
> 
>        -i     Display the identification info that  was  obtained
>               from the drive at boot time, if available.  This is
>               a feature of modern IDE drives, and may not be sup­
>               ported  by older devices.  The data returned may or
>               may not be current,  depending  on  activity  since
>               booting  the system.  However, the current multiple
>               sector mode count is  always  shown.   For  a  more
>               detailed interpretation of the identification info,
>               refer to AT Attachment Interface  for  Disk  Drives
>               (ANSI  ASC X3T9.2 working draft, revision 4a, April
>               19/93).
> 
>        -I     Request  identification  info  directly  from   the
>               drive,  which  is displayed in its raw form with no
>               endian changes or corrections.   Text  strings  may
>               appear mangled when using -I but that is NOT a bug.
>               Otherwise similar to the -i option.
> 



-- 
- phone: +49 214 8656 283
- job:   eVision-Ventures AG, LEV .de (MY OPINIONS ARE MY OWN!)
- langs: de_DE.ISO8859-1, en_US, pl_PL.ISO8859-2, last ressort: ru_RU.KOI8-R


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] 2.5.18 IDE 73
@ 2002-05-29 13:59 Gerald Champagne
  2002-05-29 13:03 ` Martin Dalecki
  0 siblings, 1 reply; 48+ messages in thread
From: Gerald Champagne @ 2002-05-29 13:59 UTC (permalink / raw)
  To: linux-kernel; +Cc: dalecki


>- ide_driveid_update is gone. We don't report the drive id through 
> /proc/ide and we don't have to update it any longer on the fly. Still 
> someone out there complaining that it went away!?

But the id information is still available through the ioctl interface. 
ide_driveid_update was used to update the dma_ultra, dma_mword, and
dma_lword fields in the id structure after changing the rate with an
ioctl command.  Won't these fields be wrong if the rate is changed after
initialization?  Won't "hdparm -i" show outdated and incorrect
information.

It's good to see the duplicate identify routine go away, but the ioctl
shouldn't return incorrect information.  Can the remaining identify
routine be modified and called directly from the ioctl that returns the
id information?

Gerald




^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] 2.5.18 IDE 73
  2002-05-29 13:03 ` Martin Dalecki
@ 2002-05-29 14:26   ` Gerald Champagne
  2002-05-29 14:35   ` Russell King
  2002-05-29 16:33   ` Vojtech Pavlik
  2 siblings, 0 replies; 48+ messages in thread
From: Gerald Champagne @ 2002-05-29 14:26 UTC (permalink / raw)
  To: Martin Dalecki; +Cc: linux-kernel

> 
> Dear Gerald please look closer. The hdparm -i is executing the
> drive id command directly and does *not* rely on the internally
> permanently dragged around id structure. So the change I did
> is entierly fine. Just go ahead and check whatever hdparm -i /dev/hdx
> reports the proper thing after changing some dma setting.
> It does - I did check it :-).

Ah, sorry about that.  I missed that in your patch.  The previous
version of the ioctl just returned copied the values from the id
structure.  Doing the id on the fly is much more accurate and will catch
any other fields that happen to change over time.  

> BTW> The next thing to be gone is simple the fact that we drag
> around the id information permanently, where infact only
> some capabilitie fields are sucked out of it and the
> device identification string is only needed for reporting
> during boot-up.

That sounds good.  That would make it easier to see what values from the
id are actually used.

Thanks.

Gerald



^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] 2.5.18 IDE 73
  2002-05-29 13:03 ` Martin Dalecki
  2002-05-29 14:26   ` Gerald Champagne
@ 2002-05-29 14:35   ` Russell King
  2002-05-29 13:40     ` Martin Dalecki
  2002-05-29 16:33   ` Vojtech Pavlik
  2 siblings, 1 reply; 48+ messages in thread
From: Russell King @ 2002-05-29 14:35 UTC (permalink / raw)
  To: Martin Dalecki; +Cc: Gerald Champagne, linux-kernel

On Wed, May 29, 2002 at 03:03:27PM +0200, Martin Dalecki wrote:
> Dear Gerald please look closer. The hdparm -i is executing the
> drive id command directly and does *not* rely on the internally

hdparm -i uses the HDIO_GET_IDENTITY ioctl, which returns drive->id.
It doesn't obtain the ID from the drive.  hdparm -I asks the
identity from the drive.

hdparm --help gives some hints:

 -i   display drive identification
 -I   read drive identification directly from drive

and the man page is quite clear:

       -i     Display the identification info that  was  obtained
              from the drive at boot time, if available.  This is
              a feature of modern IDE drives, and may not be sup­
              ported  by older devices.  The data returned may or
              may not be current,  depending  on  activity  since
              booting  the system.  However, the current multiple
              sector mode count is  always  shown.   For  a  more
              detailed interpretation of the identification info,
              refer to AT Attachment Interface  for  Disk  Drives
              (ANSI  ASC X3T9.2 working draft, revision 4a, April
              19/93).

       -I     Request  identification  info  directly  from   the
              drive,  which  is displayed in its raw form with no
              endian changes or corrections.   Text  strings  may
              appear mangled when using -I but that is NOT a bug.
              Otherwise similar to the -i option.

-- 
Russell King (rmk@arm.linux.org.uk)                The developer of ARM Linux
             http://www.arm.linux.org.uk/personal/aboutme.html


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] 2.5.18 IDE 73
  2002-05-29 16:33   ` Vojtech Pavlik
@ 2002-05-29 15:46     ` Martin Dalecki
  2002-05-29 18:47       ` Alan Cox
  2002-05-29 17:55     ` Alan Cox
  1 sibling, 1 reply; 48+ messages in thread
From: Martin Dalecki @ 2002-05-29 15:46 UTC (permalink / raw)
  To: Vojtech Pavlik; +Cc: Gerald Champagne, linux-kernel

Vojtech Pavlik wrote:
> On Wed, May 29, 2002 at 03:03:27PM +0200, Martin Dalecki wrote:
> 
> 
>>BTW> The next thing to be gone is simple the fact that we drag
>>around the id information permanently, where infact only
>>some capabilitie fields are sucked out of it and the
>>device identification string is only needed for reporting
>>during boot-up.
> 
> 
> Also for black/whitelists. And we're going to need those, though maybe
> the current data in them is not worth much.


Indeed thanks for the reminder. However as far as I'm concerned
I would rather agree that the data currently present in those
black/whitelists is basically useless. Most of the disks
present there are simple plain just obsoleted by a great margin
or have already dyed due to the severe firmware errors they did contain.
And finally this data was basically collected during the fortunately
long bast days where cmd64x chips where prevalent on VLB 486 systems.
It's most propably not accurate for more modenr ATA host chip cells.


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] 2.5.18 IDE 75
  2002-05-25  2:02 Linux-2.5.18 Linus Torvalds
                   ` (5 preceding siblings ...)
  2002-05-29 12:20 ` [PATCH] 2.5.18 IDE 74 Martin Dalecki
@ 2002-05-29 16:03 ` Martin Dalecki
  6 siblings, 0 replies; 48+ messages in thread
From: Martin Dalecki @ 2002-05-29 16:03 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 1394 bytes --]

Wed May 29 15:13:06 CEST 2002 ide-clean-75

- Comment out config_chipset_for_pio from hpt366 driver. It seems to hang on it
   and many people consistently reported that this may be necessary.
   Well apparently this host chip is forced to be in DMA read mode anyway
   and we where undoing this there.

- Apply small cosmetics to pdc202xx.c driver by Thierry Vignaud.
   His change log entries follow:

 > - factorize constants with PDC_CLOCK and UDMA_SPEED_FLAG macros and
 >   the init_high_16() static inline functions, thus removing floating
 >   constants in code
 > - remove unused variables and pci space read
 >
 > - kill useless code in pdc202xx_udma_irq_status() resulting in
 >   removing unused variable: the code does lots of tests to check what
 >   value to return but just always return the same exact value in all
 >   code paths!
 >   this also saves a few cpu & pci bus cyles by removing a useless read
 >   in pci space
 > - simplify #if/#else resulting in code duplication
 > - make init_pdc202xx clearer
 >
 > - remove duplicated initializations in config_drive_xfer_rate() and
 >   simplify code paths
 >   check in you mail inbox for the exact demonstrations (which didn't
 >   even alter resulting binary since gcc seems to optimize out most of
 >   this useless/obscuring stuff)

- Kill unused init_speed member from ata_device struct. Spotted by
   M.H.VanLeeuwen.


[-- Attachment #2: ide-clean-75.diff --]
[-- Type: text/plain, Size: 14903 bytes --]

diff -urN linux-2.5.18/drivers/ide/aec62xx.c linux/drivers/ide/aec62xx.c
--- linux-2.5.18/drivers/ide/aec62xx.c	2002-05-28 17:15:53.000000000 +0200
+++ linux/drivers/ide/aec62xx.c	2002-05-29 18:14:27.000000000 +0200
@@ -123,8 +123,6 @@
 	else
 		aec_set_speed_new(drive->channel->pci_dev, drive->dn, &t);
 
-	if (!drive->init_speed)
-		drive->init_speed = speed;
 	drive->current_speed = speed;
 
 	return 0;
diff -urN linux-2.5.18/drivers/ide/alim15x3.c linux/drivers/ide/alim15x3.c
--- linux-2.5.18/drivers/ide/alim15x3.c	2002-05-29 18:51:29.000000000 +0200
+++ linux/drivers/ide/alim15x3.c	2002-05-29 18:13:50.000000000 +0200
@@ -377,8 +377,6 @@
 	}
 #endif /* CONFIG_BLK_DEV_IDEDMA */
 
-	if (!drive->init_speed)
-		drive->init_speed = speed;
 	drive->current_speed = speed;
 
 	return ide_config_drive_speed(drive, speed);
diff -urN linux-2.5.18/drivers/ide/amd74xx.c linux/drivers/ide/amd74xx.c
--- linux-2.5.18/drivers/ide/amd74xx.c	2002-05-29 18:51:29.000000000 +0200
+++ linux/drivers/ide/amd74xx.c	2002-05-29 18:13:50.000000000 +0200
@@ -251,8 +251,6 @@
 
 	amd_set_speed(drive->channel->pci_dev, drive->dn, &t);
 
-	if (!drive->init_speed)	
-		drive->init_speed = speed;
 	drive->current_speed = speed;
 
 	return 0;
diff -urN linux-2.5.18/drivers/ide/cmd64x.c linux/drivers/ide/cmd64x.c
--- linux-2.5.18/drivers/ide/cmd64x.c	2002-05-29 18:51:29.000000000 +0200
+++ linux/drivers/ide/cmd64x.c	2002-05-29 18:13:50.000000000 +0200
@@ -537,8 +537,6 @@
 	(void) pci_write_config_byte(dev, pciU, regU);
 #endif /* CONFIG_BLK_DEV_IDEDMA */
 
-	if (!drive->init_speed)
-		drive->init_speed = speed;
 	drive->current_speed = speed;
 
 #ifdef CONFIG_BLK_DEV_IDEDMA
@@ -657,8 +655,6 @@
 	pci_write_config_word(dev, dma_pci, multi);
 	pci_write_config_word(dev, udma_pci, ultra);
 
-	if (!drive->init_speed)
-		drive->init_speed = speed;
 	drive->current_speed = speed;
 
 	return ide_config_drive_speed(drive, speed);
diff -urN linux-2.5.18/drivers/ide/hpt34x.c linux/drivers/ide/hpt34x.c
--- linux-2.5.18/drivers/ide/hpt34x.c	2002-05-29 02:34:39.000000000 +0200
+++ linux/drivers/ide/hpt34x.c	2002-05-29 18:13:50.000000000 +0200
@@ -137,8 +137,6 @@
 		hi_speed, lo_speed, err);
 #endif
 
-	if (!drive->init_speed)
-		drive->init_speed = speed;
 	drive->current_speed = speed;
 	return ide_config_drive_speed(drive, speed);
 }
diff -urN linux-2.5.18/drivers/ide/hpt366.c linux/drivers/ide/hpt366.c
--- linux-2.5.18/drivers/ide/hpt366.c	2002-05-25 03:55:20.000000000 +0200
+++ linux/drivers/ide/hpt366.c	2002-05-29 18:13:50.000000000 +0200
@@ -486,11 +486,10 @@
 static struct pci_dev *hpt_devs[HPT366_MAX_DEVS];
 static int n_hpt_devs;
 
-static u8 hpt366_proc = 0;
-
 static unsigned int hpt_min_rev(struct pci_dev *dev, int rev);
 
 #if defined(DISPLAY_HPT366_TIMINGS) && defined(CONFIG_PROC_FS)
+static u8 hpt366_proc = 0;
 static int hpt366_get_info(char *, char **, off_t, int);
 extern int (*hpt366_display_info)(char *, char **, off_t, int); /* ide-proc.c */
 
@@ -788,9 +787,6 @@
 	if ((drive->type != ATA_DISK) && (speed < XFER_SW_DMA_0))
 		return -1;
 
-	if (!drive->init_speed)
-		drive->init_speed = speed;
-
 	if (hpt_min_rev(dev, 7)) {
 		hpt374_tune_chipset(drive, speed);
 	} else if (hpt_min_rev(dev, 5)) {
@@ -864,9 +860,6 @@
 	int map;
 	byte mode;
 
-	/* FIXME: remove this --bkz */
-	config_chipset_for_pio(drive);
-
 	if (drive->type != ATA_DISK)
 		return 0;
 
diff -urN linux-2.5.18/drivers/ide/icside.c linux/drivers/ide/icside.c
--- linux-2.5.18/drivers/ide/icside.c	2002-05-29 02:34:39.000000000 +0200
+++ linux/drivers/ide/icside.c	2002-05-29 18:13:50.000000000 +0200
@@ -362,9 +362,6 @@
 
 	drive->drive_data = cycle_time;
 
-	if (!drive->init_speed)
-		drive->init_speed = xfer_mode;
-
 	if (cycle_time && ide_config_drive_speed(drive, xfer_mode) == 0)
 		on = 1;
 	else
diff -urN linux-2.5.18/drivers/ide/ide-pmac.c linux/drivers/ide/ide-pmac.c
--- linux-2.5.18/drivers/ide/ide-pmac.c	2002-05-25 03:55:29.000000000 +0200
+++ linux/drivers/ide/ide-pmac.c	2002-05-29 18:13:50.000000000 +0200
@@ -1247,9 +1247,6 @@
 		return 0;
 	}
 
-	if (!drive->init_speed)
-		drive->init_speed = feature;
-
 	/* which drive is it ? */
 	if (drive->select.b.unit & 0x01)
 		timings = &pmac_ide[idx].timings[1];
@@ -1286,9 +1283,6 @@
 		return 0;
 	}
 
-	if (!drive->init_speed)
-		drive->init_speed = feature;
-
 	/* which drive is it ? */
 	if (drive->select.b.unit & 0x01)
 		timings = &pmac_ide[idx].timings[1];
diff -urN linux-2.5.18/drivers/ide/it8172.c linux/drivers/ide/it8172.c
--- linux-2.5.18/drivers/ide/it8172.c	2002-05-25 03:55:18.000000000 +0200
+++ linux/drivers/ide/it8172.c	2002-05-29 18:13:50.000000000 +0200
@@ -187,8 +187,6 @@
 
     it8172_tune_drive(drive, it8172_dma_2_pio(speed));
 
-    if (!drive->init_speed)
-	drive->init_speed = speed;
     err = ide_config_drive_speed(drive, speed);
     drive->current_speed = speed;
     return err;
diff -urN linux-2.5.18/drivers/ide/pdc202xx.c linux/drivers/ide/pdc202xx.c
--- linux-2.5.18/drivers/ide/pdc202xx.c	2002-05-29 02:34:39.000000000 +0200
+++ linux/drivers/ide/pdc202xx.c	2002-05-29 18:13:50.000000000 +0200
@@ -1,6 +1,6 @@
 /**** vi:set ts=8 sts=8 sw=8:************************************************
  *
- *  linux/drivers/ide/pdc202xx.c	Version 0.30	Mar. 18, 2000
+ *  linux/drivers/ide/pdc202xx.c	Version 0.30	May. 28, 2002
  *
  *  Copyright (C) 1998-2000	Andre Hedrick <andre@linux-ide.org>
  *  May be copied or modified under the terms of the GNU General Public License
@@ -61,6 +61,10 @@
 #define	IORDY_EN	0x20	/* PIO: IOREADY */
 #define	PREFETCH_EN	0x10	/* PIO: PREFETCH */
 
+
+#define PDC_CLOCK(high_16) IN_BYTE(high_16 + 0x11)
+#define UDMA_SPEED_FLAG(high_16) IN_BYTE(high_16 + 0x001f)
+
 #if PDC202XX_DECODE_REGISTER_INFO
 
 struct pdc_bit_messages {
@@ -119,6 +123,13 @@
 }
 #endif /* PDC202XX_DECODE_REGISTER_INFO */
 
+
+static inline int init_high_16 (struct pci_dev *dev)
+{
+	return pci_resource_start(dev, 4);
+}
+
+
 int check_in_drive_lists(struct ata_device *drive)
 {
 	static const char *pdc_quirk_drives[] = {
@@ -172,7 +183,7 @@
 	struct pci_dev *dev = hwif->pci_dev;
 
 	unsigned int		drive_conf;
-	byte			drive_pci, AP, BP, CP, DP;
+	byte			drive_pci, AP, BP, CP;
 	byte			TA = 0, TB = 0, TC = 0;
 
 	if (drive->dn > 3)
@@ -187,7 +198,6 @@
 	pci_read_config_byte(dev, (drive_pci), &AP);
 	pci_read_config_byte(dev, (drive_pci)|0x01, &BP);
 	pci_read_config_byte(dev, (drive_pci)|0x02, &CP);
-	pci_read_config_byte(dev, (drive_pci)|0x03, &DP);
 
 #ifdef CONFIG_BLK_DEV_IDEDMA
 	if (speed >= XFER_SW_DMA_0) {
@@ -198,10 +208,9 @@
 			/* clear DMA modes of lower 8421 bits of C Register */
 			pci_write_config_byte(dev, (drive_pci)|0x02, CP & ~0x0F);
 		}
-	} else {
-#else
-	{
+	} else
 #endif /* CONFIG_BLK_DEV_IDEDMA */
+	{
 		if ((AP & 0x0F) || (BP & 0x07)) {
 			/* clear PIO modes of lower 8421 bits of A Register */
 			pci_write_config_byte(dev, (drive_pci), AP & ~0x0F);
@@ -242,10 +251,9 @@
         if (speed >= XFER_SW_DMA_0) {
 		pci_write_config_byte(dev, (drive_pci)|0x01, BP|TB);
 		pci_write_config_byte(dev, (drive_pci)|0x02, CP|TC);
-	} else {
-#else
-	{
+	} else
 #endif /* CONFIG_BLK_DEV_IDEDMA */
+	{
 		pci_write_config_byte(dev, (drive_pci), AP|TA);
 		pci_write_config_byte(dev, (drive_pci)|0x01, BP|TB);
 	}
@@ -269,8 +277,6 @@
 	printk(KERN_DEBUG "DP(%x)\n", DP);
 #endif
 
-	if (!drive->init_speed)
-		drive->init_speed = speed;
 	drive->current_speed = speed;
 
 #if PDC202XX_DEBUG_DRIVE_INFO
@@ -300,7 +306,7 @@
 	unsigned long indexreg	= (hwif->dma_base + 1);
 	unsigned long datareg	= (hwif->dma_base + 3);
 #else
-	unsigned long high_16	= pci_resource_start(hwif->pci_dev, 4);
+	unsigned long high_16	= init_high_16(hwif->pci_dev);
 	unsigned long indexreg	= high_16 + (hwif->unit ? 0x09 : 0x01);
 	unsigned long datareg	= (indexreg + 2);
 #endif /* CONFIG_BLK_DEV_IDEDMA */
@@ -394,8 +400,6 @@
 			;
 	}
 
-	if (!drive->init_speed)
-		drive->init_speed = speed;
 	drive->current_speed = speed;
 
 	return ide_config_drive_speed(drive, speed);
@@ -427,7 +431,7 @@
 	struct ata_channel *hwif = drive->channel;
 	struct hd_driveid *mate_id = hwif->drives[!(drive->dn%2)].id;
 	struct pci_dev *dev	= hwif->pci_dev;
-	unsigned long high_16   = pci_resource_start(dev, 4);
+	unsigned long high_16   = init_high_16(dev);
 	unsigned long dma_base  = hwif->dma_base;
 	unsigned long indexreg	= dma_base + 1;
 	unsigned long datareg	= dma_base + 3;
@@ -458,7 +462,7 @@
 	}
 
 	if (!jumpbit)
-		CLKSPD = IN_BYTE(high_16 + 0x11);
+		CLKSPD = PDC_CLOCK(high_16);
 	/*
 	 * Set the control register to use the 66Mhz system
 	 * clock for UDMA 3/4 mode operation. If one drive on
@@ -568,12 +572,9 @@
 
 	if (id && (id->capability & 1) && hwif->autodma) {
 		/* Consult the list of known "bad" drives */
-		if (udma_black_list(drive)) {
-			on = 0;
-			goto fast_ata_pio;
-		}
-		on = 0;
 		verbose = 0;
+		if (udma_black_list(drive))
+			goto no_dma_set;
 		if (id->field_valid & 4) {
 			if (id->dma_ultra & 0x007F) {
 				/* Force if Capable UltraDMA */
@@ -599,13 +600,8 @@
 			on = config_chipset_for_dma(drive, 0);
 			if (!on)
 				goto no_dma_set;
-		} else {
-			goto fast_ata_pio;
-		}
+		} else goto no_dma_set;
 	} else if ((id->capability & 8) || (id->field_valid & 2)) {
-fast_ata_pio:
-		on = 0;
-		verbose = 0;
 no_dma_set:
 		config_chipset_for_pio(drive, 5);
 	}
@@ -618,12 +614,12 @@
 static int pdc202xx_udma_start(struct ata_device *drive, struct request *rq)
 {
 	struct ata_channel *ch = drive->channel;
-	unsigned long high_16 = pci_resource_start(ch->pci_dev, 4);
+	unsigned long high_16 = init_high_16(ch->pci_dev);
 	unsigned long atapi_reg = high_16 + (ch->unit ? 0x24 : 0x00);
 
 	if (drive->addressing) {
 		unsigned long word_count = 0;
-		u8 clock = IN_BYTE(high_16 + 0x11);
+		u8 clock = PDC_CLOCK(high_16);
 
 		outb(clock|(ch->unit ? 0x08 : 0x02), high_16 + 0x11);
 		word_count = (rq->nr_sectors << 8);
@@ -644,14 +640,14 @@
 int pdc202xx_udma_stop(struct ata_device *drive)
 {
 	struct ata_channel *ch = drive->channel;
-	unsigned long high_16 = pci_resource_start(ch->pci_dev, 4);
+	unsigned long high_16 = init_high_16(ch->pci_dev);
 	unsigned long atapi_reg	= high_16 + (ch->unit ? 0x24 : 0x00);
 	unsigned long dma_base = ch->dma_base;
 	u8 dma_stat, clock;
 
 	if (drive->addressing) {
 		outl(0, atapi_reg);	/* zero out extra */
-		clock = IN_BYTE(high_16 + 0x11);
+		clock = PDC_CLOCK(high_16);
 		OUT_BYTE(clock & ~(ch->unit ? 0x08:0x02), high_16 + 0x11);
 	}
 
@@ -667,22 +663,10 @@
 static int pdc202xx_udma_irq_status(struct ata_device *drive)
 {
 	struct ata_channel *ch = drive->channel;
-	unsigned long high_16 = pci_resource_start(ch->pci_dev, 4);
-	u8 dma_stat, sc1d;
+	u8 dma_stat;
 
 	dma_stat = IN_BYTE(ch->dma_base + 2);
 
-	sc1d = IN_BYTE(high_16 + 0x001d);
-	if (ch->unit) {
-		if ((sc1d & 0x50) == 0x50) goto somebody_else;
-		else if ((sc1d & 0x40) == 0x40)
-			return (dma_stat & 4) == 4;
-	} else {
-		if ((sc1d & 0x05) == 0x05) goto somebody_else;
-		else if ((sc1d & 0x04) == 0x04)
-			return (dma_stat & 4) == 4;
-	}
-somebody_else:
 	return (dma_stat & 4) == 4;	/* return 1 if INTR asserted */
 }
 
@@ -710,8 +694,8 @@
 
 void pdc202xx_reset(struct ata_device *drive)
 {
-	unsigned long high_16	= pci_resource_start(drive->channel->pci_dev, 4);
-	byte udma_speed_flag	= IN_BYTE(high_16 + 0x001f);
+	unsigned long high_16	= init_high_16(drive->channel->pci_dev);
+	byte udma_speed_flag	= UDMA_SPEED_FLAG(high_16);
 
 	set_reg_and_wait(udma_speed_flag | 0x10, high_16 + 0x001f, 100);
 	set_reg_and_wait(udma_speed_flag & ~0x10, high_16 + 0x001f, 2000);		/* 2 seconds ?! */
@@ -722,8 +706,8 @@
 /* FIXME: should be splited for old & new chipsets --bkz */
 static unsigned int __init pdc202xx_init_chipset(struct pci_dev *dev)
 {
-	unsigned long high_16	= pci_resource_start(dev, 4);
-	byte udma_speed_flag	= IN_BYTE(high_16 + 0x001f);
+	unsigned long high_16	= init_high_16(dev);
+	byte udma_speed_flag	= UDMA_SPEED_FLAG(high_16);
 	byte primary_mode	= IN_BYTE(high_16 + 0x001a);
 	byte secondary_mode	= IN_BYTE(high_16 + 0x001b);
 	byte newchip		= 0;
@@ -788,7 +772,7 @@
 	if (!(udma_speed_flag & 1)) {
 		printk("%s: FORCING BURST BIT 0x%02x -> 0x%02x ", dev->name, udma_speed_flag, (udma_speed_flag|1));
 		OUT_BYTE(udma_speed_flag|1, high_16 + 0x001f);
-		printk("%sCTIVE\n", (IN_BYTE(high_16 + 0x001f) & 1) ? "A" : "INA");
+		printk("%sCTIVE\n", (UDMA_SPEED_FLAG(high_16) & 1) ? "A" : "INA");
 	}
 #endif /* CONFIG_PDC202XX_BURST */
 
@@ -856,16 +840,13 @@
 		hwif->highmem = 1;
 		if (!noautodma)
 			hwif->autodma = 1;
-	} else {
+	} else
+#endif
+	{
 		hwif->drives[0].autotune = 1;
 		hwif->drives[1].autotune = 1;
 		hwif->autodma = 0;
 	}
-#else
-	hwif->drives[0].autotune = 1;
-	hwif->drives[1].autotune = 1;
-	hwif->autodma = 0;
-#endif
 }
 
 
@@ -980,9 +961,8 @@
 {
 	unsigned int i;
 
-	for (i = 0; i < ARRAY_SIZE(chipsets); ++i) {
+	for (i = 0; i < ARRAY_SIZE(chipsets); ++i)
 		ata_register_chipset(&chipsets[i]);
-	}
 
         return 0;
 }
diff -urN linux-2.5.18/drivers/ide/piix.c linux/drivers/ide/piix.c
--- linux-2.5.18/drivers/ide/piix.c	2002-05-25 03:55:24.000000000 +0200
+++ linux/drivers/ide/piix.c	2002-05-29 18:13:50.000000000 +0200
@@ -351,8 +351,6 @@
 
 	piix_set_speed(drive->channel->pci_dev, drive->dn, &t, umul);
 
-	if (!drive->init_speed)	
-		drive->init_speed = speed;
 	drive->current_speed = speed;
 
 	return 0;
diff -urN linux-2.5.18/drivers/ide/serverworks.c linux/drivers/ide/serverworks.c
--- linux-2.5.18/drivers/ide/serverworks.c	2002-05-29 18:51:29.000000000 +0200
+++ linux/drivers/ide/serverworks.c	2002-05-29 18:13:51.000000000 +0200
@@ -357,8 +357,6 @@
 	pci_write_config_byte(dev, drive_pci3, ultra_timing);
 	pci_write_config_byte(dev, 0x54, ultra_enable);
 #endif
-	if (!drive->init_speed)
-		drive->init_speed = speed;
 	drive->current_speed = speed;
 
 	return ide_config_drive_speed(drive, speed);
diff -urN linux-2.5.18/drivers/ide/via82cxxx.c linux/drivers/ide/via82cxxx.c
--- linux-2.5.18/drivers/ide/via82cxxx.c	2002-05-25 03:55:23.000000000 +0200
+++ linux/drivers/ide/via82cxxx.c	2002-05-29 18:13:50.000000000 +0200
@@ -332,8 +332,6 @@
 
 	via_set_speed(drive->channel->pci_dev, drive->dn, &t);
 
-	if (!drive->init_speed)
-		drive->init_speed = speed;
 	drive->current_speed = speed;
 
 	return 0;
diff -urN linux-2.5.18/include/linux/ide.h linux/include/linux/ide.h
--- linux-2.5.18/include/linux/ide.h	2002-05-29 02:34:40.000000000 +0200
+++ linux/include/linux/ide.h	2002-05-29 18:17:48.000000000 +0200
@@ -393,7 +393,6 @@
 	int		crc_count;	/* crc counter to reduce drive speed */
 	byte		quirk_list;	/* drive is considered quirky if set for a specific host */
 	byte		suspend_reset;	/* drive suspend mode flag, soft-reset recovers */
-	byte		init_speed;	/* transfer rate set at boot */
 	byte		current_speed;	/* current transfer rate set */
 	byte		dn;		/* now wide spread use */
 	byte		wcache;		/* status of write cache */

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] 2.5.18 IDE 73
  2002-05-29 17:01       ` Vojtech Pavlik
@ 2002-05-29 16:05         ` Martin Dalecki
  2002-05-29 17:05           ` Vojtech Pavlik
  2002-05-29 18:43         ` Alan Cox
  1 sibling, 1 reply; 48+ messages in thread
From: Martin Dalecki @ 2002-05-29 16:05 UTC (permalink / raw)
  To: Vojtech Pavlik; +Cc: Alan Cox, Gerald Champagne, linux-kernel

Vojtech Pavlik wrote:
> On Wed, May 29, 2002 at 06:55:38PM +0100, Alan Cox wrote:
> 
> 
>>>Also for black/whitelists. And we're going to need those, though maybe
>>>the current data in them is not worth much.
>>
>>I'm hopeful they still are. The early drives with DMA problems won't
>>have changed over time, and I've been updating the others when I get
>>data from vendors. Promise for example recently sent me a couple to add
> 
> 
> The early drives haven't changed, but the drivers for the controllers
> which they were tested on changed (or will change soon). Namely the
> lists of PIO mode limits were wrong very often. This is mainly because
> some of the (now almost unused) drivers program the timings incorrectly
> into the controller registers.
> 
> I can't say much about the more recent entries, except for that it'd be
> nice to add a date when the entry was last tested and with what result
> to each of them over time.

And plese note as well that we don't need the whole id struct, but just
the name of the drive as well. Which is much less of a hassle anyway.


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] 2.5.18 IDE 73
  2002-05-29 13:03 ` Martin Dalecki
  2002-05-29 14:26   ` Gerald Champagne
  2002-05-29 14:35   ` Russell King
@ 2002-05-29 16:33   ` Vojtech Pavlik
  2002-05-29 15:46     ` Martin Dalecki
  2002-05-29 17:55     ` Alan Cox
  2 siblings, 2 replies; 48+ messages in thread
From: Vojtech Pavlik @ 2002-05-29 16:33 UTC (permalink / raw)
  To: Martin Dalecki; +Cc: Gerald Champagne, linux-kernel

On Wed, May 29, 2002 at 03:03:27PM +0200, Martin Dalecki wrote:

> BTW> The next thing to be gone is simple the fact that we drag
> around the id information permanently, where infact only
> some capabilitie fields are sucked out of it and the
> device identification string is only needed for reporting
> during boot-up.

Also for black/whitelists. And we're going to need those, though maybe
the current data in them is not worth much.

-- 
Vojtech Pavlik
SuSE Labs

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] 2.5.18 IDE 73
  2002-05-29 17:55     ` Alan Cox
@ 2002-05-29 17:01       ` Vojtech Pavlik
  2002-05-29 16:05         ` Martin Dalecki
  2002-05-29 18:43         ` Alan Cox
  0 siblings, 2 replies; 48+ messages in thread
From: Vojtech Pavlik @ 2002-05-29 17:01 UTC (permalink / raw)
  To: Alan Cox; +Cc: Vojtech Pavlik, Martin Dalecki, Gerald Champagne, linux-kernel

On Wed, May 29, 2002 at 06:55:38PM +0100, Alan Cox wrote:

> > Also for black/whitelists. And we're going to need those, though maybe
> > the current data in them is not worth much.
> 
> I'm hopeful they still are. The early drives with DMA problems won't
> have changed over time, and I've been updating the others when I get
> data from vendors. Promise for example recently sent me a couple to add

The early drives haven't changed, but the drivers for the controllers
which they were tested on changed (or will change soon). Namely the
lists of PIO mode limits were wrong very often. This is mainly because
some of the (now almost unused) drivers program the timings incorrectly
into the controller registers.

I can't say much about the more recent entries, except for that it'd be
nice to add a date when the entry was last tested and with what result
to each of them over time.

-- 
Vojtech Pavlik
SuSE Labs

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] 2.5.18 IDE 73
  2002-05-29 16:05         ` Martin Dalecki
@ 2002-05-29 17:05           ` Vojtech Pavlik
  0 siblings, 0 replies; 48+ messages in thread
From: Vojtech Pavlik @ 2002-05-29 17:05 UTC (permalink / raw)
  To: Martin Dalecki; +Cc: Vojtech Pavlik, Alan Cox, Gerald Champagne, linux-kernel

On Wed, May 29, 2002 at 06:05:38PM +0200, Martin Dalecki wrote:
> Vojtech Pavlik wrote:
> > On Wed, May 29, 2002 at 06:55:38PM +0100, Alan Cox wrote:
> > 
> > 
> >>>Also for black/whitelists. And we're going to need those, though maybe
> >>>the current data in them is not worth much.
> >>
> >>I'm hopeful they still are. The early drives with DMA problems won't
> >>have changed over time, and I've been updating the others when I get
> >>data from vendors. Promise for example recently sent me a couple to add
> > 
> > 
> > The early drives haven't changed, but the drivers for the controllers
> > which they were tested on changed (or will change soon). Namely the
> > lists of PIO mode limits were wrong very often. This is mainly because
> > some of the (now almost unused) drivers program the timings incorrectly
> > into the controller registers.
> > 
> > I can't say much about the more recent entries, except for that it'd be
> > nice to add a date when the entry was last tested and with what result
> > to each of them over time.
> 
> And plese note as well that we don't need the whole id struct, but just
> the name of the drive as well. Which is much less of a hassle anyway.

Correct. And the manufacturer and the revision.

-- 
Vojtech Pavlik
SuSE Labs

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] 2.5.18 IDE 73
  2002-05-29 16:33   ` Vojtech Pavlik
  2002-05-29 15:46     ` Martin Dalecki
@ 2002-05-29 17:55     ` Alan Cox
  2002-05-29 17:01       ` Vojtech Pavlik
  1 sibling, 1 reply; 48+ messages in thread
From: Alan Cox @ 2002-05-29 17:55 UTC (permalink / raw)
  To: Vojtech Pavlik; +Cc: Martin Dalecki, Gerald Champagne, linux-kernel

On Wed, 2002-05-29 at 17:33, Vojtech Pavlik wrote:
> Also for black/whitelists. And we're going to need those, though maybe
> the current data in them is not worth much.

I'm hopeful they still are. The early drives with DMA problems won't
have changed over time, and I've been updating the others when I get
data from vendors. Promise for example recently sent me a couple to add


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] 2.5.18 IDE 73
@ 2002-05-29 18:07 Andries.Brouwer
  2002-05-29 21:57 ` Martin Dalecki
  0 siblings, 1 reply; 48+ messages in thread
From: Andries.Brouwer @ 2002-05-29 18:07 UTC (permalink / raw)
  To: dalecki, torvalds; +Cc: linux-kernel

    - Don't allow check_partition to be more clever then the writer of a driver.
       It was interfering with drivers which check partitions as they go and
       finally if we want to spew something about it - we can do it ourself.

    - Eliminate ide_geninit(). We scan for partitions now inside the recently
       introduced attach method. register_disk() is broken by the way and 90% of
       places where it's used it is doing literally nothing. Either some one didn't
       finish some code or the code is basically just junk from the past.

       Anyway we grok the partitions now one by one as we detect the channels.

Pity you send this gzipped, otherwise I would have looked at the code.

Yes, 90% of the uses of register_disk() are empty. I submitted a patch
to remove this cruft last year, but Al was attached to it - wanted to
make them nonempty.

About scanning for partitions I say the same thing I said to Al a few
days ago:
Several partitioning schemes exist, and reading partition tables is not
something a driver should do without getting explicit requests.
For all we know the disk contents may be completely random.

You should offer the list of disks seen to user space, and user space
should decide which disks have to be investigated, and tell the kernel
about the partitions it wants to have on these disks.
That way all knowledge about partitioning, dynamic disks, disk managers
and the like is removed from the kernel, and moved into partx-type code.


Andries

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] 2.5.18 IDE 73
@ 2002-05-29 18:16 Andries.Brouwer
  0 siblings, 0 replies; 48+ messages in thread
From: Andries.Brouwer @ 2002-05-29 18:16 UTC (permalink / raw)
  To: dalecki, gerald; +Cc: linux-kernel

> hdparm -i is executing the drive id command directly
> and does *not* rely on the internally permanently dragged around id structure.

The situation used to be that "hdparm -i" used the information read at boot time,
while "hdparm -I" read the current situation. That was sometimes useful.

Andries

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] 2.5.18 IDE 73
  2002-05-29 17:01       ` Vojtech Pavlik
  2002-05-29 16:05         ` Martin Dalecki
@ 2002-05-29 18:43         ` Alan Cox
  1 sibling, 0 replies; 48+ messages in thread
From: Alan Cox @ 2002-05-29 18:43 UTC (permalink / raw)
  To: Vojtech Pavlik; +Cc: Martin Dalecki, Gerald Champagne, linux-kernel

On Wed, 2002-05-29 at 18:01, Vojtech Pavlik wrote:
> The early drives haven't changed, but the drivers for the controllers
> which they were tested on changed (or will change soon). Namely the
> lists of PIO mode limits were wrong very often. This is mainly because
> some of the (now almost unused) drivers program the timings incorrectly
> into the controller registers.

Ok I'm not sure on the PIO ones. The DMA blacklist is a set of devices
that had actual firmware side problems on the whole and vendor confirmed
ones.
 
> I can't say much about the more recent entries, except for that it'd be
> nice to add a date when the entry was last tested and with what result
> to each of them over time.

The ones I have are from vendors whom I hope know what they are doing.
The one exception is an item which is missing which is the needed
blacklist of UDMA on the OSB4 for one vendor at least (MWDMA is fine)


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] 2.5.18 IDE 73
  2002-05-29 15:46     ` Martin Dalecki
@ 2002-05-29 18:47       ` Alan Cox
  2002-05-30  8:48         ` David Woodhouse
  0 siblings, 1 reply; 48+ messages in thread
From: Alan Cox @ 2002-05-29 18:47 UTC (permalink / raw)
  To: Martin Dalecki; +Cc: Vojtech Pavlik, Gerald Champagne, linux-kernel

On Wed, 2002-05-29 at 16:46, Martin Dalecki wrote:
> Indeed thanks for the reminder. However as far as I'm concerned
> I would rather agree that the data currently present in those
> black/whitelists is basically useless. Most of the disks
> present there are simple plain just obsoleted by a great margin

Lots of people are still using them. Removing the blacklists "because
they are old disks" is not what I'd consider good practice.

> It's most propably not accurate for more modenr ATA host chip cells.

For the DMA blacklists thats not the case. You need to get more direct
contacts with the IDE/ATA drive vendors and documentation sets. The WDC
DMA blacklist entries for example are from specific WDC issued lists of
problem drives. 

Alan


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] 2.5.18 IDE 73
  2002-05-29 18:07 Andries.Brouwer
@ 2002-05-29 21:57 ` Martin Dalecki
  0 siblings, 0 replies; 48+ messages in thread
From: Martin Dalecki @ 2002-05-29 21:57 UTC (permalink / raw)
  To: Andries.Brouwer; +Cc: torvalds, linux-kernel

Andries.Brouwer@cwi.nl wrote:
>     - Don't allow check_partition to be more clever then the writer of a driver.
>        It was interfering with drivers which check partitions as they go and
>        finally if we want to spew something about it - we can do it ourself.
> 
>     - Eliminate ide_geninit(). We scan for partitions now inside the recently
>        introduced attach method. register_disk() is broken by the way and 90% of
>        places where it's used it is doing literally nothing. Either some one didn't
>        finish some code or the code is basically just junk from the past.
> 
>        Anyway we grok the partitions now one by one as we detect the channels.
> 
> Pity you send this gzipped, otherwise I would have looked at the code.

Well otherwise it wouldn't get through lkml. And since there
are actually right now quite a lot of people interressted in
the intermediate patches I'm sending it gzip-ed.
And no I don't buy in to the fact that we need a separate
mailing list for every single topic out there.
The traffic on lkml isn't that high if you learn to filter:

1. Some very active people who are posting only garbage.
2. Some perpetuant topics which are irrelevant.

> Yes, 90% of the uses of register_disk() are empty. I submitted a patch
> to remove this cruft last year, but Al was attached to it - wanted to
> make them nonempty.

For what would that be good?
In the time between the kernel eveolved entierly in to a different
direction, *we have* now the device tree the devfs and grock
parition stuff.

> About scanning for partitions I say the same thing I said to Al a few
> days ago:
> Several partitioning schemes exist, and reading partition tables is not
> something a driver should do without getting explicit requests.
> For all we know the disk contents may be completely random.

You are right but the fact is right now we have to do it this way.
And I'm sure some people will start to wimmer about "back-ass compatibility".
But I agree with Larry that unnecessary compatibility
concerns for tools which should be considered as tightly coupled to
the system in question killed partily in the middle of the 90's UNIX
advancement somehow. For Linux this translates to:

1. util-linux
2. modutils
3. pcmci-utils
and so on...

You know that I'm one of the few who is always trying to
push such changes where they make sense. However it always turns out
that the people who don't understand this simlpe fact are just loud
enough to don't be ignored.

> You should offer the list of disks seen to user space, and user space
> should decide which disks have to be investigated, and tell the kernel
> about the partitions it wants to have on these disks.
> That way all knowledge about partitioning, dynamic disks, disk managers
> and the like is removed from the kernel, and moved into partx-type code.

But there is one thing, which isn't prette about the above sheme: races
and atomicity of operations... Well this could be solved
by making the mount system call passing this information as a parameters.
You wouldn't even need to pass any list of disks to user land - we don't
do it right now. Just notify the kernel of the avalibility of a particular
device on hot plug and let mount scan partitions and therelike itself.
It could do it perfectly fine itself.
Since the ATA code was anyway the much uglier part in the game
well there are chances that finally someone will pick up this
idea...

But no matter what right now the changes I did had to be done.


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] 2.5.18 IDE 73
  2002-05-29 23:40 Andries.Brouwer
@ 2002-05-29 22:53 ` Martin Dalecki
  0 siblings, 0 replies; 48+ messages in thread
From: Martin Dalecki @ 2002-05-29 22:53 UTC (permalink / raw)
  To: Andries.Brouwer; +Cc: linux-kernel, torvalds

Andries.Brouwer@cwi.nl wrote:
>>>About scanning for partitions:
>>>Several partitioning schemes exist, and reading partition tables is not
>>>something a driver should do without getting explicit requests.
>>>For all we know the disk contents may be completely random.
>>
> 
>>You are right but the fact is right now we have to do it this way.
> 
> 
> That is OK - I just write to make sure we all agree that this must
> only be an intermediate stage. Scanning for partitions must not be
> something obscure that happens deep down in some driver.
> 
> 
>>>You should offer the list of disks seen to user space, and user space
>>>should decide which disks have to be investigated, and tell the kernel
>>>about the partitions it wants to have on these disks.
>>>That way all knowledge about partitioning, dynamic disks, disk managers
>>>and the like is removed from the kernel, and moved into partx-type code.
>>
> 
>>But there is one thing, which isn't prette about the above sheme: races
>>and atomicity of operations... Well this could be solved
>>by making the mount system call passing this information as a parameters.
>>You wouldn't even need to pass any list of disks to user land - we don't
>>do it right now.
> 
> 
> You see, some disks belong to RAIDs, some disks are in reality very
> slow objects, like compact flash cards or so, some disk have some foreign
> partitioning scheme. There can be all kinds of reasons why we do not
> want to start reading and interpreting any random disk-like device.

Ahhh... wait a moment you are the one who is responsible for
util-linux - wouldn't you care to take a bunch of patches?!

> I know that we used to do this, but it was wrong, so we must slowly move
> to a setup where we do no longer do this.
> 
> So, user space is started on a ramdisk or so, and gets parameters
> rootdev=, rootpttype=, rootpartition=, rootfstype=.
> Now it can use rootpttype to scan rootdev, find the partitions,
> find rootpartition, mount it as type rootfstype on /.
> 
> Afterwards the existence of more devices, possibly with partitions,
> becomes of interest, for example because there is a "mount -a" somewhere.
> Here userspace needs a list of available devices. Maybe /proc/partitions.

/etc/vfstab, /etc/mtab -  are conceptually just fine.

No need to inevent here. No need to do the book keeping in kernel.
passwd doesn't need /proc/users too and many people just forget that
we are still on a UNIX like system.
The only case which deserves special treatment is the parition
where / resides.


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] 2.5.18 IDE 73
@ 2002-05-29 23:40 Andries.Brouwer
  2002-05-29 22:53 ` Martin Dalecki
  0 siblings, 1 reply; 48+ messages in thread
From: Andries.Brouwer @ 2002-05-29 23:40 UTC (permalink / raw)
  To: Andries.Brouwer, dalecki; +Cc: linux-kernel, torvalds

>> About scanning for partitions:
>> Several partitioning schemes exist, and reading partition tables is not
>> something a driver should do without getting explicit requests.
>> For all we know the disk contents may be completely random.

> You are right but the fact is right now we have to do it this way.

That is OK - I just write to make sure we all agree that this must
only be an intermediate stage. Scanning for partitions must not be
something obscure that happens deep down in some driver.

>> You should offer the list of disks seen to user space, and user space
>> should decide which disks have to be investigated, and tell the kernel
>> about the partitions it wants to have on these disks.
>> That way all knowledge about partitioning, dynamic disks, disk managers
>> and the like is removed from the kernel, and moved into partx-type code.

> But there is one thing, which isn't prette about the above sheme: races
> and atomicity of operations... Well this could be solved
> by making the mount system call passing this information as a parameters.
> You wouldn't even need to pass any list of disks to user land - we don't
> do it right now.

You see, some disks belong to RAIDs, some disks are in reality very
slow objects, like compact flash cards or so, some disk have some foreign
partitioning scheme. There can be all kinds of reasons why we do not
want to start reading and interpreting any random disk-like device.

I know that we used to do this, but it was wrong, so we must slowly move
to a setup where we do no longer do this.

So, user space is started on a ramdisk or so, and gets parameters
rootdev=, rootpttype=, rootpartition=, rootfstype=.
Now it can use rootpttype to scan rootdev, find the partitions,
find rootpartition, mount it as type rootfstype on /.

Afterwards the existence of more devices, possibly with partitions,
becomes of interest, for example because there is a "mount -a" somewhere.
Here userspace needs a list of available devices. Maybe /proc/partitions.

Andries

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] 2.5.18 IDE 73
@ 2002-05-30  0:19 Andries.Brouwer
  2002-05-30 13:02 ` Martin Dalecki
  0 siblings, 1 reply; 48+ messages in thread
From: Andries.Brouwer @ 2002-05-30  0:19 UTC (permalink / raw)
  To: Andries.Brouwer, dalecki; +Cc: linux-kernel, torvalds

    Ahhh... wait a moment you are the one who is responsible for
    util-linux - wouldn't you care to take a bunch of patches?!

Of course - improvements are always welcome.
(But I try to be slightly more careful than you are.
Util-linux runs on all libc's and all kernels, from libc4 to glibc2
and from 0.99 to 2.5. So, changes must be compatible.)

    No need to inevent here. No need to do the book keeping in kernel.

Some need. Things like mount-by-label want to know what partitions
exist in order to look at the labels on each.
Yes, we really need a list of disk-like devices.
The gendisk chain.

Andries


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] 2.5.18 IDE 73
  2002-05-29 18:47       ` Alan Cox
@ 2002-05-30  8:48         ` David Woodhouse
  2002-05-30 12:22           ` Martin Dalecki
  0 siblings, 1 reply; 48+ messages in thread
From: David Woodhouse @ 2002-05-30  8:48 UTC (permalink / raw)
  To: Alan Cox; +Cc: Martin Dalecki, Vojtech Pavlik, Gerald Champagne, linux-kernel


On the subject of blacklists -- when downgrading the speed of a drive 
because it's found a blacklist, or indeed for any other reason, please 
_print_ the reason for doing so. 

I have drives which work fine at UDMA66, but which some kernels randomly 
refuse to configure above UDMA33 without telling me why. 

Basically, any time you run a drive at a transfer speed lower than the 
minimum of the drive's and host's listed capabilities, you should say why 
you're doing so. 

--
dwmw2



^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] 2.5.18 IDE 73
  2002-05-30  8:48         ` David Woodhouse
@ 2002-05-30 12:22           ` Martin Dalecki
  0 siblings, 0 replies; 48+ messages in thread
From: Martin Dalecki @ 2002-05-30 12:22 UTC (permalink / raw)
  To: David Woodhouse; +Cc: Alan Cox, Vojtech Pavlik, Gerald Champagne, linux-kernel

David Woodhouse wrote:
> On the subject of blacklists -- when downgrading the speed of a drive 
> because it's found a blacklist, or indeed for any other reason, please 
> _print_ the reason for doing so. 
> 
> I have drives which work fine at UDMA66, but which some kernels randomly 
> refuse to configure above UDMA33 without telling me why. 

Which are those ones on which controller configuration?

> 
> Basically, any time you run a drive at a transfer speed lower than the 
> minimum of the drive's and host's listed capabilities, you should say why 
> you're doing so. 

Sure just let do one steop after other OK.



^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] 2.5.18 IDE 73
@ 2002-05-30 12:35 Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 48+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2002-05-30 12:35 UTC (permalink / raw)
  To: David Woodhouse; +Cc: alan, dalecki, vojtech, gerald, linux-kernel


> On the subject of blacklists -- when downgrading the speed of a drive
> because it's found a blacklist, or indeed for any other reason, please
> _print_ the reason for doing so.
> (...)

fully agreed, already discussed with Martin
things are going slow because first I clean this fsking mess
then add new stuff

greets
--
bkz


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] 2.5.18 IDE 73
  2002-05-30  0:19 Andries.Brouwer
@ 2002-05-30 13:02 ` Martin Dalecki
  2002-05-30 15:32   ` Alan Cox
  0 siblings, 1 reply; 48+ messages in thread
From: Martin Dalecki @ 2002-05-30 13:02 UTC (permalink / raw)
  To: Andries.Brouwer; +Cc: linux-kernel, torvalds

Andries.Brouwer@cwi.nl wrote:
>     Ahhh... wait a moment you are the one who is responsible for
>     util-linux - wouldn't you care to take a bunch of patches?!
> 
> Of course - improvements are always welcome.
> (But I try to be slightly more careful than you are.
> Util-linux runs on all libc's and all kernels, from libc4 to glibc2
> and from 0.99 to 2.5. So, changes must be compatible.)

Having them compatible acroess an insane range of kernels
is a nice but futile exercise.
Perhaps this partly explains why:

1. util-linux doesn't cover half of the system utilities needed on
    a sanely actual Linux system.

2. The Linux vendors have to apply insane number of patches to it
    util it's moderately usable.

>     No need to inevent here. No need to do the book keeping in kernel.
> 
> Some need. Things like mount-by-label want to know what partitions
> exist in order to look at the labels on each.
> Yes, we really need a list of disk-like devices.
> The gendisk chain.

No I don't see that point. Data which has to be persistant across
reboots is simple data which has to reside on disk. That's the
way it is in UNIX (PalmOS to name an example).
And after all it's rather trivial to iterate *all* disks present at boot
by hand and just going through /dev/sdaxxx chains. SCSI allocates
them consecutively anyway and there are typically not many ATA diskst around
there.
After all kudzu is performing nearly the whole job for anything else
except disks anyway for example.


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] 2.5.18 IDE 73
  2002-05-30 15:32   ` Alan Cox
@ 2002-05-30 13:54     ` Martin Dalecki
  2002-05-30 15:05       ` Tomas Szepe
                         ` (3 more replies)
  0 siblings, 4 replies; 48+ messages in thread
From: Martin Dalecki @ 2002-05-30 13:54 UTC (permalink / raw)
  To: Alan Cox; +Cc: Andries.Brouwer, linux-kernel, torvalds

Alan Cox wrote:
> On Thu, 2002-05-30 at 14:02, Martin Dalecki wrote:
> 
>>1. util-linux doesn't cover half of the system utilities needed on
>>    a sanely actual Linux system.
>>2. The Linux vendors have to apply insane number of patches to it
>>    util it's moderately usable.
> 
> 
> So now you have nothing better to do than insult someone whose code
> works, is shipped in just about every distribution. Someone whose kernel
> patches are almost without fail perfect first time.
> 
> You should learn from Andries not mock him.

rpm -i util-linux-xxx.src.rpm

and count the patches yourself. Andries could be the Pope I would
still feel free to tell him what I think about this.
Ahh and just a remainder - poking at ports in kbdrate is bad and not
quite something I would learn from.

>>And after all it's rather trivial to iterate *all* disks present at boot
>>by hand and just going through /dev/sdaxxx chains. SCSI allocates
>>them consecutively anyway and there are typically not many ATA diskst around
>>there.
> 
> 
> You still need a way to talk all the disk devices. It might be that is
> devfs /dev/disk, but in case it hasn't permeated your skull yet, in such
> a situation then -devfs- would need such a list. We also have another

I don't use and don't care about devfs - it's a misconception in my opinnion.
What you are potining at is just another symptom of this simple fact.
After several years of beeing "official" it didn't develer up on
promises. There are some reasons why the Linux vendors out there get
well along without it. It is simple not necessary and even worser
introduces more problems that it promised to solve. No matter how
vigorous the propnents of it where before Linus give in. It's just another
try to work around the too narrow major/minor number spaces of Linux
and well see below:

> flaw here - we don't export the bit position of the partition/device
> split on each device which puts lots of horrible code into user space
> thats always going out of date
> 
> Oh and for /dev/disk/... to do labels and partitions it needs the
> partition data in the list too, remarkably like we have it now actually.

All what you are talking about here are afterthoughts to the a basic simple
flaw in the linux way af looking at devices:

Major numbers are sliced up to account for the fact that some drivers
abused slices of the major number space instead of minor numbers to
discriminate between different instances of the driver. Even worser
some drivers (most prominently ide-cd) hooked up completely
different devices on the same mojor number.
And last but not least: some devices which should be viewd as "same type"
are hooked up to different major numbers instead of sharing them.
Most prominent here are the differences between SCSI disks and ATA disks
for example. From a technical point of view they don't make *any* sense.


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] 2.5.18 IDE 73
  2002-05-30 14:43 Andries.Brouwer
@ 2002-05-30 14:01 ` Martin Dalecki
  2002-05-30 15:09   ` Rene Rebe
  0 siblings, 1 reply; 48+ messages in thread
From: Martin Dalecki @ 2002-05-30 14:01 UTC (permalink / raw)
  To: Andries.Brouwer; +Cc: linux-kernel, torvalds

Andries.Brouwer@cwi.nl wrote:
>     > Of course - improvements are always welcome.
>     > (But I try to be slightly more careful than you are.
>     > Util-linux runs on all libc's and all kernels, from libc4 to glibc2
>     > and from 0.99 to 2.5. So, changes must be compatible.)
> 
>     Having them compatible acroess an insane range of kernels
>     is a nice but futile exercise.
>     Perhaps this partly explains why:
> 
>     1. util-linux doesn't cover half of the system utilities needed on
>         a sanely actual Linux system.
> 
>     2. The Linux vendors have to apply insane number of patches to it
>         util it's moderately usable.
> 
> If you do the kernel ATA stuff, I'll take care of util-linux.

Well that's actually a deal :-).

> (Does it need more utilities? Probably those are in some other package.
> Sometimes stuff is added, but not very often. However, your suggestions
> are welcome.
> Do the vendors add patches? Half of that is vendor extensions, that is
> their business. Half of that is their stupidity. They blindly copy the
> patches other vendors apply "it is a patch - must be an improvement";
> sometimes I have to reject the same buggy patch more than a dozen times.
> When I ask for the reason of a patch, they don't know themselves.)

Well somehow I have partly to agree. But however having a way to
exclude network devices from mounting during mount -a is *very* usefull,
becouse failing NFS servers will sometines prohibit your watchdog
triggered reboot to happen for example!

Or not doing swapon twice and beeing silent about it - just good
UNIX habit the user requested it to go on - well it's on, so all
is fine, no error in this.

I can stuff together what I think is usefull however...

> 
>     >     No need to invent here. No need to do the book keeping in kernel.
>     > 
>     > Some need. Things like mount-by-label want to know what partitions
>     > exist in order to look at the labels on each.
>     > Yes, we really need a list of disk-like devices.
>     > The gendisk chain.
> 
>     No I don't see that point. Data which has to be persistant across
>     reboots is simple data which has to reside on disk. That's the
>     way it is in UNIX (PalmOS to name an example).
> 
> Maybe you never heard of mount-by-label?
> 
> Andries


Urhg? I did of course hear about them!


~# ssh kozaczek
root@kozaczek's password:
Last login: Thu May 30 14:37:32 2002 from 10.0.0.1
cd [root@kozaczek root]# cd /etc
[root@kozaczek etc]# cat fstab
LABEL=/                 /                       ext3    defaults        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
/dev/fd0                /mnt/floppy             auto    noauto,owner    0 0
# /dev/loop1            /mnt/1                  auto    noauto,owner    0 0
# /dev/loop2            /mnt/2                  auto    noauto,owner    0 0
none                    /proc                   proc    defaults        0 0
none                    /tmp                    tmpfs   defaults        0 0
none                    /dev/pts                devpts  gid=5,mode=620  0 0
/dev/hda6               swap                    swap    defaults        0 0
[root@kozaczek etc]#


Hmm I didn't check whatever they can be used on swap partitions too.
If not I will fix it right away.


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] 2.5.18 IDE 73
  2002-05-30 16:13       ` Alan Cox
@ 2002-05-30 14:20         ` Martin Dalecki
  2002-05-30 15:31           ` Linus Torvalds
  2002-05-30 15:25         ` Linus Torvalds
  1 sibling, 1 reply; 48+ messages in thread
From: Martin Dalecki @ 2002-05-30 14:20 UTC (permalink / raw)
  To: Alan Cox; +Cc: Andries.Brouwer, linux-kernel, torvalds

Alan Cox wrote:
> On Thu, 2002-05-30 at 14:54, Martin Dalecki wrote:
> 
>>I don't use and don't care about devfs - it's a misconception in my opinnion.
> 
> 
> Yes but there are lots of other opinions. And it was just one of several
> examples of why you were proposing something utterly bogus
> 
> 
> 
>>And last but not least: some devices which should be viewd as "same type"
>>are hooked up to different major numbers instead of sharing them.
>>Most prominent here are the differences between SCSI disks and ATA disks
>>for example. From a technical point of view they don't make *any* sense.
> 
> 
> Linus has explicitly stated he wants to do this and make all disks
> appear the same and the same place. It actually makes lots of sense. 

LAST WARNING:

Every body out there: watch out to use LABEL= in /etc/fstab or you will
not be able to reboot between 2.4 and 2.5 soon!

Things which have to be done in front:

1. Extract device registration from SCSI code.

2. Let the ATA/ATAPI code hook up on it. (ide-cs is the most difficult one.)

3. Let the old ATA/ATAPI major go down the bin...


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] 2.5.18 IDE 73
@ 2002-05-30 14:43 Andries.Brouwer
  2002-05-30 14:01 ` Martin Dalecki
  0 siblings, 1 reply; 48+ messages in thread
From: Andries.Brouwer @ 2002-05-30 14:43 UTC (permalink / raw)
  To: Andries.Brouwer, dalecki; +Cc: linux-kernel, torvalds

    > Of course - improvements are always welcome.
    > (But I try to be slightly more careful than you are.
    > Util-linux runs on all libc's and all kernels, from libc4 to glibc2
    > and from 0.99 to 2.5. So, changes must be compatible.)

    Having them compatible acroess an insane range of kernels
    is a nice but futile exercise.
    Perhaps this partly explains why:

    1. util-linux doesn't cover half of the system utilities needed on
        a sanely actual Linux system.

    2. The Linux vendors have to apply insane number of patches to it
        util it's moderately usable.

If you do the kernel ATA stuff, I'll take care of util-linux.

(Does it need more utilities? Probably those are in some other package.
Sometimes stuff is added, but not very often. However, your suggestions
are welcome.
Do the vendors add patches? Half of that is vendor extensions, that is
their business. Half of that is their stupidity. They blindly copy the
patches other vendors apply "it is a patch - must be an improvement";
sometimes I have to reject the same buggy patch more than a dozen times.
When I ask for the reason of a patch, they don't know themselves.)

    >     No need to invent here. No need to do the book keeping in kernel.
    > 
    > Some need. Things like mount-by-label want to know what partitions
    > exist in order to look at the labels on each.
    > Yes, we really need a list of disk-like devices.
    > The gendisk chain.

    No I don't see that point. Data which has to be persistant across
    reboots is simple data which has to reside on disk. That's the
    way it is in UNIX (PalmOS to name an example).

Maybe you never heard of mount-by-label?

Andries

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] 2.5.18 IDE 73
  2002-05-30 13:54     ` Martin Dalecki
@ 2002-05-30 15:05       ` Tomas Szepe
  2002-05-30 15:13       ` Rene Rebe
                         ` (2 subsequent siblings)
  3 siblings, 0 replies; 48+ messages in thread
From: Tomas Szepe @ 2002-05-30 15:05 UTC (permalink / raw)
  To: Martin Dalecki; +Cc: Alan Cox, Andries.Brouwer, linux-kernel, torvalds

> >On Thu, 2002-05-30 at 14:02, Martin Dalecki wrote:
> >
> >>1. util-linux doesn't cover half of the system utilities needed on
> >>   a sanely actual Linux system.
> >>2. The Linux vendors have to apply insane number of patches to it
> >>   util it's moderately usable.
> >
> >So now you have nothing better to do than insult someone whose code
> >works, is shipped in just about every distribution. Someone whose kernel
> >patches are almost without fail perfect first time.
> >
> >You should learn from Andries not mock him.
> 
> rpm -i util-linux-xxx.src.rpm

... tells you exactly nothing, because redhat people would even patch
/bin/true if it could be made to do anything extra.

util-linux build procedure from SlackBuild in slackware-current:

tar xjvf $CWD/util-linux-$VERSION.tar.bz2
cd util-linux-$VERSION
zcat $CWD/util-linux.MCONFIG.diff.gz | patch -E --backup -p1 --suffix=.orig
./configure
make
<snip>

T.

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] 2.5.18 IDE 73
  2002-05-30 14:01 ` Martin Dalecki
@ 2002-05-30 15:09   ` Rene Rebe
  2002-05-31 13:25     ` Denis Vlasenko
  0 siblings, 1 reply; 48+ messages in thread
From: Rene Rebe @ 2002-05-30 15:09 UTC (permalink / raw)
  To: dalecki; +Cc: Andries.Brouwer, linux-kernel, torvalds

Hi.

On: Thu, 30 May 2002 16:01:09 +0200,
    Martin Dalecki <dalecki@evision-ventures.com> wrote:

> Well somehow I have partly to agree. But however having a way to
> exclude network devices from mounting during mount -a is *very* usefull,

mount -a -t nonfs,nocoda,noproc,nodevfs,noshm"

Ever worked for me ...

k33p h4ck1n6
  René

--  
René Rebe (Registered Linux user: #248718 <http://counter.li.org>)
e-mail:   rene.rebe@gmx.net, rene@rocklinux.org
web:      www.rocklinux.org, drocklinux.dyndns.org/rene/

Anyone sending unwanted advertising e-mail to this address will be
charged $25 for network traffic and computing time. By extracting my
address from this message or its header, you agree to these terms.

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] 2.5.18 IDE 73
  2002-05-30 13:54     ` Martin Dalecki
  2002-05-30 15:05       ` Tomas Szepe
@ 2002-05-30 15:13       ` Rene Rebe
  2002-05-30 15:39       ` Wichert Akkerman
  2002-05-30 16:13       ` Alan Cox
  3 siblings, 0 replies; 48+ messages in thread
From: Rene Rebe @ 2002-05-30 15:13 UTC (permalink / raw)
  To: dalecki; +Cc: linux-kernel

Hi.

On: Thu, 30 May 2002 15:54:50 +0200,
    Martin Dalecki <dalecki@evision-ventures.com> wrote:

> > You still need a way to talk all the disk devices. It might be that is
> > devfs /dev/disk, but in case it hasn't permeated your skull yet, in such
> > a situation then -devfs- would need such a list. We also have another
> 
> I don't use and don't care about devfs - it's a misconception in my opinnion.
> What you are potining at is just another symptom of this simple fact.
> After several years of beeing "official" it didn't develer up on
> promises. There are some reasons why the Linux vendors out there get
> well along without it. It is simple not necessary and even worser
> introduces more problems that it promised to solve. No matter how
> vigorous the propnents of it where before Linus give in. It's just another
> try to work around the too narrow major/minor number spaces of Linux
> and well see below:

DevFS is at least used by ROCK Linux and Mandrake. We never had any
problem with it (and most users really like it's features). So please
do not corrupt it. - I save my time not lising the feature list of
devfs we use ...

k33p h4ck1n6
  René

--  
René Rebe (Registered Linux user: #248718 <http://counter.li.org>)
e-mail:   rene.rebe@gmx.net, rene@rocklinux.org
web:      www.rocklinux.org, drocklinux.dyndns.org/rene/

Anyone sending unwanted advertising e-mail to this address will be
charged $25 for network traffic and computing time. By extracting my
address from this message or its header, you agree to these terms.

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] 2.5.18 IDE 73
  2002-05-30 16:13       ` Alan Cox
  2002-05-30 14:20         ` Martin Dalecki
@ 2002-05-30 15:25         ` Linus Torvalds
  1 sibling, 0 replies; 48+ messages in thread
From: Linus Torvalds @ 2002-05-30 15:25 UTC (permalink / raw)
  To: Alan Cox; +Cc: Martin Dalecki, Andries.Brouwer, linux-kernel



On 30 May 2002, Alan Cox wrote:
>
> > And last but not least: some devices which should be viewd as "same type"
> > are hooked up to different major numbers instead of sharing them.
> > Most prominent here are the differences between SCSI disks and ATA disks
> > for example. From a technical point of view they don't make *any* sense.
>
> Linus has explicitly stated he wants to do this and make all disks
> appear the same and the same place. It actually makes lots of sense.

It should be a lot easier these days, and we should be fairly close.

A device driver should really _never_ see a "device number". It should see
a request queue and a disk/controller index, so that we can arbitrarily
map different device numbers to different devices (or sometimes to the
_same_ device).

But yes, there are lots of device drivers that right now use the device
number to get the disk/controller index by themselves, so right now the
minor/major numbers mean a bit too much.

		Linus


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] 2.5.18 IDE 73
  2002-05-30 14:20         ` Martin Dalecki
@ 2002-05-30 15:31           ` Linus Torvalds
  2002-05-30 18:55             ` Martin Dalecki
  0 siblings, 1 reply; 48+ messages in thread
From: Linus Torvalds @ 2002-05-30 15:31 UTC (permalink / raw)
  To: Martin Dalecki; +Cc: Alan Cox, Andries.Brouwer, linux-kernel



On Thu, 30 May 2002, Martin Dalecki wrote:
>
> LAST WARNING:
>
> Every body out there: watch out to use LABEL= in /etc/fstab or you will
> not be able to reboot between 2.4 and 2.5 soon!

Absolutely not, Martin. We need to have people be able to upgrade easily,
we're already scaring away too many people from this.

> 1. Extract device registration from SCSI code.
>
> 2. Let the ATA/ATAPI code hook up on it. (ide-cs is the most difficult one.)
>
> 3. Let the old ATA/ATAPI major go down the bin...

The minor/major numbers should stay the same, they are just "mappings".
Device drivers shouldn't even care, and in fact we should aim for a setup
where we have a new cleaned-up "disk major", but at the same time we
should support the old major/minors so that people can easily use the same
disk images across different kernel versions.

That should be fairly easy to do, by just making sure that we (a) remove
the kdev_t from "struct request", (b) replace it with a controller and
disk index and (c) make "open()" do some fairly trivial mapping and save
that mapping in the "bdev", so that make_request() and friends can
trivially just fill in the data.

Voila, end of minor/major problems, and you can suddenly do things like
show the _same_ device on many minor/major numbers (so that you can have
it _both_ on a backwards-compatible place _and_ a new cleaned-up place).

And the device drivers wouldn't ever even _know_ what device number the
user saw on disk was.

		Linus


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] 2.5.18 IDE 73
  2002-05-30 13:02 ` Martin Dalecki
@ 2002-05-30 15:32   ` Alan Cox
  2002-05-30 13:54     ` Martin Dalecki
  0 siblings, 1 reply; 48+ messages in thread
From: Alan Cox @ 2002-05-30 15:32 UTC (permalink / raw)
  To: Martin Dalecki; +Cc: Andries.Brouwer, linux-kernel, torvalds

On Thu, 2002-05-30 at 14:02, Martin Dalecki wrote:
> 1. util-linux doesn't cover half of the system utilities needed on
>     a sanely actual Linux system.
> 2. The Linux vendors have to apply insane number of patches to it
>     util it's moderately usable.

So now you have nothing better to do than insult someone whose code
works, is shipped in just about every distribution. Someone whose kernel
patches are almost without fail perfect first time.

You should learn from Andries not mock him.

> And after all it's rather trivial to iterate *all* disks present at boot
> by hand and just going through /dev/sdaxxx chains. SCSI allocates
> them consecutively anyway and there are typically not many ATA diskst around
> there.

You still need a way to talk all the disk devices. It might be that is
devfs /dev/disk, but in case it hasn't permeated your skull yet, in such
a situation then -devfs- would need such a list. We also have another
flaw here - we don't export the bit position of the partition/device
split on each device which puts lots of horrible code into user space
thats always going out of date

Oh and for /dev/disk/... to do labels and partitions it needs the
partition data in the list too, remarkably like we have it now actually.

Alan


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] 2.5.18 IDE 73
  2002-05-30 13:54     ` Martin Dalecki
  2002-05-30 15:05       ` Tomas Szepe
  2002-05-30 15:13       ` Rene Rebe
@ 2002-05-30 15:39       ` Wichert Akkerman
  2002-05-30 16:13       ` Alan Cox
  3 siblings, 0 replies; 48+ messages in thread
From: Wichert Akkerman @ 2002-05-30 15:39 UTC (permalink / raw)
  To: linux-kernel

In article <3CF62F2A.6030009@evision-ventures.com>,
Martin Dalecki  <dalecki@evision-ventures.com> wrote:
>rpm -i util-linux-xxx.src.rpm
>
>and count the patches yourself.

That is just RedHat and not a good indication of code quality at all,
just of how many patches RedHat thinks they should use.

You really should compare with other distributions before even thinking
about making such statements. Debian for example has almost no patches
to util-linux (mostly some changes for crypto support).

Wichert.


-- 
  _________________________________________________________________
 /       Nothing is fool-proof to a sufficiently talented fool     \
| wichert@wiggy.net                   http://www.liacs.nl/~wichert/ |
| 1024D/2FA3BC2D 576E 100B 518D 2F16 36B0  2805 3CB8 9250 2FA3 BC2D |


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] 2.5.18 IDE 73
@ 2002-05-30 15:56 Andries.Brouwer
  0 siblings, 0 replies; 48+ messages in thread
From: Andries.Brouwer @ 2002-05-30 15:56 UTC (permalink / raw)
  To: alan, dalecki; +Cc: Andries.Brouwer, linux-kernel, torvalds

> LAST WARNING:

> Every body out there: watch out to use LABEL= in /etc/fstab or you will
> not be able to reboot between 2.4 and 2.5 soon!

Funny. I hope you realize that there are lots of filesystems out there
that do not support a LABEL=.

Andries

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] 2.5.18 IDE 73
  2002-05-30 13:54     ` Martin Dalecki
                         ` (2 preceding siblings ...)
  2002-05-30 15:39       ` Wichert Akkerman
@ 2002-05-30 16:13       ` Alan Cox
  2002-05-30 14:20         ` Martin Dalecki
  2002-05-30 15:25         ` Linus Torvalds
  3 siblings, 2 replies; 48+ messages in thread
From: Alan Cox @ 2002-05-30 16:13 UTC (permalink / raw)
  To: Martin Dalecki; +Cc: Andries.Brouwer, linux-kernel, torvalds

On Thu, 2002-05-30 at 14:54, Martin Dalecki wrote:
> I don't use and don't care about devfs - it's a misconception in my opinnion.

Yes but there are lots of other opinions. And it was just one of several
examples of why you were proposing something utterly bogus


> And last but not least: some devices which should be viewd as "same type"
> are hooked up to different major numbers instead of sharing them.
> Most prominent here are the differences between SCSI disks and ATA disks
> for example. From a technical point of view they don't make *any* sense.

Linus has explicitly stated he wants to do this and make all disks
appear the same and the same place. It actually makes lots of sense. 

 


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] 2.5.18 IDE 73
  2002-05-30 15:31           ` Linus Torvalds
@ 2002-05-30 18:55             ` Martin Dalecki
  0 siblings, 0 replies; 48+ messages in thread
From: Martin Dalecki @ 2002-05-30 18:55 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Alan Cox, Andries.Brouwer, linux-kernel

Linus Torvalds wrote:
> 
> On Thu, 30 May 2002, Martin Dalecki wrote:
> 
>>LAST WARNING:
>>
>>Every body out there: watch out to use LABEL= in /etc/fstab or you will
>>not be able to reboot between 2.4 and 2.5 soon!
> 
> 
> Absolutely not, Martin. We need to have people be able to upgrade easily,
> we're already scaring away too many people from this.
> 
> 
>>1. Extract device registration from SCSI code.
>>
>>2. Let the ATA/ATAPI code hook up on it. (ide-cs is the most difficult one.)
>>
>>3. Let the old ATA/ATAPI major go down the bin...
> 
> 
> The minor/major numbers should stay the same, they are just "mappings".
> Device drivers shouldn't even care, and in fact we should aim for a setup
> where we have a new cleaned-up "disk major", but at the same time we
> should support the old major/minors so that people can easily use the same
> disk images across different kernel versions.
> 
> That should be fairly easy to do, by just making sure that we (a) remove
> the kdev_t from "struct request", (b) replace it with a controller and
> disk index and (c) make "open()" do some fairly trivial mapping and save
> that mapping in the "bdev", so that make_request() and friends can
> trivially just fill in the data.
> 
> Voila, end of minor/major problems, and you can suddenly do things like
> show the _same_ device on many minor/major numbers (so that you can have
> it _both_ on a backwards-compatible place _and_ a new cleaned-up place).
> 
> And the device drivers wouldn't ever even _know_ what device number the
> user saw on disk was.

I was more thinking along the way of the way ide-scsi is highjacking the
SCSI major numbers becouse the above scheme you describe would basically
mean the we just reinvent different major/minor numbers with just new names
"controller_index", and "disk_index" where due to the driver dispatching issues
the whole IDE mess would still just preveal under the hood.
But the goal should be more along the way of trying to
actually remove the usage of those arbitrary values all around inside the
kernel.

Plese note as well that there are other IDE alike interfaces which basically
already do the same: USB solidstate, and ParPort attached IDE disks come
first in to mind.

So it's absolutely worthwhile to extract the SCSI major number
registration code and to reuse it as a generic kind of thing.
At least it would relief the dependance of the above drivers on the
SCSI code. Of course here it would make much sense to preserve some
kind of double access to the IDE stuff. Alternatively *this*
could be indeed handled by a kind of generic mapping on
device open path, since basically those major numbers would
be obsoleted, but this is just a second tought. (Yes indeed LABEL isn't
supported on quite a lot of filesystems, so one can't hope
of it to resolve the beckward compatibility or dual boot issue.)

Anyway I'm looking at the ugly childs in blk.h alreay, so
basically the DEVICE_NR macro definitions show where once would have
to do go look after.




^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] 2.5.18 IDE 73
  2002-05-30 15:09   ` Rene Rebe
@ 2002-05-31 13:25     ` Denis Vlasenko
  0 siblings, 0 replies; 48+ messages in thread
From: Denis Vlasenko @ 2002-05-31 13:25 UTC (permalink / raw)
  To: Rene Rebe, dalecki; +Cc: Andries.Brouwer, linux-kernel, torvalds

On 30 May 2002 13:09, Rene Rebe wrote:
>     Martin Dalecki <dalecki@evision-ventures.com> wrote:
> > Well somehow I have partly to agree. But however having a way to
> > exclude network devices from mounting during mount -a is *very* usefull,
>
> mount -a -t nonfs,nocoda,noproc,nodevfs,noshm"
>
> Ever worked for me ...

#man mount
...
	For example, the command:
        	mount -a -t nomsdos,ext
	mounts all file systems except those of type msdos and ext.
...

It says you shouldn't repeat 'no' prefix. 
--
vda

^ permalink raw reply	[flat|nested] 48+ messages in thread

end of thread, other threads:[~2002-05-31  8:32 UTC | newest]

Thread overview: 48+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-05-25  2:02 Linux-2.5.18 Linus Torvalds
2002-05-27  9:34 ` [PATCH] 2.5.18 IDE 71 Martin Dalecki
2002-05-28 14:23 ` Linux-2.5.18 Martin Dalecki
2002-05-28 15:31 ` [PATCH] airo Martin Dalecki
2002-05-28 17:35 ` [PATCH] 2.5.18 QUEUE_EMPTY and the unpleasant friends Martin Dalecki
2002-05-29 12:11 ` [PATCH] 2.5.18 IDE 73 Martin Dalecki
2002-05-29 12:58   ` Zwane Mwaikambo
2002-05-29 12:52     ` Martin Dalecki
2002-05-29 12:20 ` [PATCH] 2.5.18 IDE 74 Martin Dalecki
2002-05-29 16:03 ` [PATCH] 2.5.18 IDE 75 Martin Dalecki
  -- strict thread matches above, loose matches on Subject: below --
2002-05-29 13:59 [PATCH] 2.5.18 IDE 73 Gerald Champagne
2002-05-29 13:03 ` Martin Dalecki
2002-05-29 14:26   ` Gerald Champagne
2002-05-29 14:35   ` Russell King
2002-05-29 13:40     ` Martin Dalecki
2002-05-29 16:33   ` Vojtech Pavlik
2002-05-29 15:46     ` Martin Dalecki
2002-05-29 18:47       ` Alan Cox
2002-05-30  8:48         ` David Woodhouse
2002-05-30 12:22           ` Martin Dalecki
2002-05-29 17:55     ` Alan Cox
2002-05-29 17:01       ` Vojtech Pavlik
2002-05-29 16:05         ` Martin Dalecki
2002-05-29 17:05           ` Vojtech Pavlik
2002-05-29 18:43         ` Alan Cox
2002-05-29 18:07 Andries.Brouwer
2002-05-29 21:57 ` Martin Dalecki
2002-05-29 18:16 Andries.Brouwer
2002-05-29 23:40 Andries.Brouwer
2002-05-29 22:53 ` Martin Dalecki
2002-05-30  0:19 Andries.Brouwer
2002-05-30 13:02 ` Martin Dalecki
2002-05-30 15:32   ` Alan Cox
2002-05-30 13:54     ` Martin Dalecki
2002-05-30 15:05       ` Tomas Szepe
2002-05-30 15:13       ` Rene Rebe
2002-05-30 15:39       ` Wichert Akkerman
2002-05-30 16:13       ` Alan Cox
2002-05-30 14:20         ` Martin Dalecki
2002-05-30 15:31           ` Linus Torvalds
2002-05-30 18:55             ` Martin Dalecki
2002-05-30 15:25         ` Linus Torvalds
2002-05-30 12:35 Bartlomiej Zolnierkiewicz
2002-05-30 14:43 Andries.Brouwer
2002-05-30 14:01 ` Martin Dalecki
2002-05-30 15:09   ` Rene Rebe
2002-05-31 13:25     ` Denis Vlasenko
2002-05-30 15:56 Andries.Brouwer

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