The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* PATCH: clean up the IDE iops, add ones for a dead iface
@ 2003-02-18 18:03 Alan Cox
  2003-02-18 23:09 ` Russell King
  2003-02-20 13:16 ` Geert Uytterhoeven
  0 siblings, 2 replies; 12+ messages in thread
From: Alan Cox @ 2003-02-18 18:03 UTC (permalink / raw)
  To: torvalds, linux-kernel

Also adds the new OUTBSYNC iop

diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.61/drivers/ide/ide-iops.c linux-2.5.61-ac2/drivers/ide/ide-iops.c
--- linux-2.5.61/drivers/ide/ide-iops.c	2003-02-10 18:38:18.000000000 +0000
+++ linux-2.5.61-ac2/drivers/ide/ide-iops.c	2003-02-18 18:06:17.000000000 +0000
@@ -31,60 +31,129 @@
 #include <asm/io.h>
 #include <asm/bitops.h>
 
+/*
+ *	IDE operator we assign to an unplugged device so that
+ *	we don't trash new hardware assigned the same resources
+ */
+ 
+static u8 ide_unplugged_inb (unsigned long port)
+{
+	return 0xFF;
+}
+
+static u16 ide_unplugged_inw (unsigned long port)
+{
+	return 0xFFFF;
+}
+
+static void ide_unplugged_insw (unsigned long port, void *addr, u32 count)
+{
+}
+
+static u32 ide_unplugged_inl (unsigned long port)
+{
+	return 0xFFFFFFFF;
+}
+
+static void ide_unplugged_insl (unsigned long port, void *addr, u32 count)
+{
+}
+
+static void ide_unplugged_outb (u8 addr, unsigned long port)
+{
+}
+
+static void ide_unplugged_outw (u16 addr, unsigned long port)
+{
+}
+
+static void ide_unplugged_outsw (unsigned long port, void *addr, u32 count)
+{
+}
+
+static void ide_unplugged_outl (u32 addr, unsigned long port)
+{
+}
+
+static void ide_unplugged_outsl (unsigned long port, void *addr, u32 count)
+{
+}
 
-static u8 ide_inb (ide_ioreg_t port)
+void unplugged_hwif_iops (ide_hwif_t *hwif)
+{
+	hwif->OUTB	= ide_unplugged_outb;
+	hwif->OUTBSYNC	= ide_unplugged_outb;
+	hwif->OUTW	= ide_unplugged_outw;
+	hwif->OUTL	= ide_unplugged_outl;
+	hwif->OUTSW	= ide_unplugged_outsw;
+	hwif->OUTSL	= ide_unplugged_outsl;
+	hwif->INB	= ide_unplugged_inb;
+	hwif->INW	= ide_unplugged_inw;
+	hwif->INL	= ide_unplugged_inl;
+	hwif->INSW	= ide_unplugged_insw;
+	hwif->INSL	= ide_unplugged_insl;
+}
+
+EXPORT_SYMBOL(unplugged_hwif_iops);
+
+/*
+ *	Conventional PIO operations for ATA devices
+ */
+
+static u8 ide_inb (unsigned long port)
 {
 	return (u8) inb(port);
 }
 
-static u16 ide_inw (ide_ioreg_t port)
+static u16 ide_inw (unsigned long port)
 {
 	return (u16) inw(port);
 }
 
-static void ide_insw (ide_ioreg_t port, void *addr, u32 count)
+static void ide_insw (unsigned long port, void *addr, u32 count)
 {
 	return insw(port, addr, count);
 }
 
-static u32 ide_inl (ide_ioreg_t port)
+static u32 ide_inl (unsigned long port)
 {
 	return (u32) inl(port);
 }
 
-static void ide_insl (ide_ioreg_t port, void *addr, u32 count)
+static void ide_insl (unsigned long port, void *addr, u32 count)
 {
 	insl(port, addr, count);
 }
 
-static void ide_outb (u8 value, ide_ioreg_t port)
+static void ide_outb (u8 addr, unsigned long port)
 {
-	outb(value, port);
+	outb(addr, port);
 }
 
-static void ide_outw (u16 value, ide_ioreg_t port)
+static void ide_outw (u16 addr, unsigned long port)
 {
-	outw(value, port);
+	outw(addr, port);
 }
 
-static void ide_outsw (ide_ioreg_t port, void *addr, u32 count)
+static void ide_outsw (unsigned long port, void *addr, u32 count)
 {
 	outsw(port, addr, count);
 }
 
-static void ide_outl (u32 value, ide_ioreg_t port)
+static void ide_outl (u32 addr, unsigned long port)
 {
-	outl(value, port);
+	outl(addr, port);
 }
 
-static void ide_outsl (ide_ioreg_t port, void *addr, u32 count)
+static void ide_outsl (unsigned long port, void *addr, u32 count)
 {
-	outsl(port, addr, count);
+	return outsl(port, addr, count);
 }
 
 void default_hwif_iops (ide_hwif_t *hwif)
 {
 	hwif->OUTB	= ide_outb;
+	hwif->OUTBSYNC	= ide_outb;
 	hwif->OUTW	= ide_outw;
 	hwif->OUTL	= ide_outl;
 	hwif->OUTSW	= ide_outsw;
@@ -98,78 +167,66 @@
 
 EXPORT_SYMBOL(default_hwif_iops);
 
-static u8 ide_mm_inb (ide_ioreg_t port)
+/*
+ *	MMIO operations, typically used for SATA controllers
+ */
+
+static u8 ide_mm_inb (unsigned long port)
 {
 	return (u8) readb(port);
 }
 
-static u16 ide_mm_inw (ide_ioreg_t port)
+static u16 ide_mm_inw (unsigned long port)
 {
 	return (u16) readw(port);
 }
 
-static void ide_mm_insw (ide_ioreg_t port, void *addr, u32 count)
+static void ide_mm_insw (unsigned long port, void *addr, u32 count)
 {
-#ifdef CONFIG_PPC
-	/* Can we move the barrier out of the loop ? */
-	while (count--) { *(u16 *)addr = __raw_readw(port); iobarrier_r(); addr += 2; }
-#else /* everything else is sane benh */
-	while (count--) { *(u16 *)addr = readw(port); addr += 2; }
-#endif
+	__ide_mm_insw(port, addr, count);
 }
 
-static u32 ide_mm_inl (ide_ioreg_t port)
+static u32 ide_mm_inl (unsigned long port)
 {
 	return (u32) readl(port);
 }
 
-static void ide_mm_insl (ide_ioreg_t port, void *addr, u32 count)
+static void ide_mm_insl (unsigned long port, void *addr, u32 count)
 {
-#ifdef CONFIG_PPC
-	/* Can we move the barrier out of the loop ? */
-	while (count--) { *(u32 *)addr = __raw_readl(port); iobarrier_r(); addr += 4; }
-#else /* everything else is sane benh */
-	while (count--) { *(u32 *)addr = readl(port); addr += 4; }
-#endif
+	__ide_mm_insl(port, addr, count);
 }
 
-static void ide_mm_outb (u8 value, ide_ioreg_t port)
+static void ide_mm_outb (u8 value, unsigned long port)
 {
 	writeb(value, port);
 }
 
-static void ide_mm_outw (u16 value, ide_ioreg_t port)
+static void ide_mm_outw (u16 value, unsigned long port)
 {
 	writew(value, port);
 }
 
-static void ide_mm_outsw (ide_ioreg_t port, void *addr, u32 count)
+static void ide_mm_outsw (unsigned long port, void *addr, u32 count)
 {
-#ifdef CONFIG_PPC
-	/* Can we move the barrier out of the loop ? */
-	while (count--) { __raw_writew(*(u16 *)addr, port); iobarrier_w(); addr += 2; }
-#else /* everything else is sane benh */
-	while (count--) { writew(*(u16 *)addr, port); addr += 2; }
-#endif
+	__ide_mm_outsw(port, addr, count);
 }
 
-static void ide_mm_outl (u32 value, ide_ioreg_t port)
+static void ide_mm_outl (u32 value, unsigned long port)
 {
 	writel(value, port);
 }
 
-static void ide_mm_outsl (ide_ioreg_t port, void *addr, u32 count)
+static void ide_mm_outsl (unsigned long port, void *addr, u32 count)
 {
-#ifdef CONFIG_PPC
-	while (count--) { __raw_writel(*(u32 *)addr, port); iobarrier_w(); addr += 4; }
-#else /* everything else is sane benh */
-	while (count--) { writel(*(u32 *)addr, port); addr += 4; }
-#endif
+	__ide_mm_outsl(port, addr, count);
 }
 
 void default_hwif_mmiops (ide_hwif_t *hwif)
 {
 	hwif->OUTB	= ide_mm_outb;
+	/* Most systems will need to override OUTBSYNC, alas however
+	   this one is controller specific! */
+	hwif->OUTBSYNC	= ide_mm_outb;
 	hwif->OUTW	= ide_mm_outw;
 	hwif->OUTL	= ide_mm_outl;
 	hwif->OUTSW	= ide_mm_outsw;

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

end of thread, other threads:[~2003-02-21  9:03 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-02-18 18:03 PATCH: clean up the IDE iops, add ones for a dead iface Alan Cox
2003-02-18 23:09 ` Russell King
2003-02-19  1:53   ` Alan Cox
2003-02-19  9:39     ` Benjamin Herrenschmidt
2003-02-19 14:25       ` Alan Cox
2003-02-19 16:56       ` Linus Torvalds
2003-02-19 17:06         ` Benjamin Herrenschmidt
2003-02-19 18:22           ` Alan Cox
2003-02-19 17:26             ` Benjamin Herrenschmidt
2003-02-21  9:13         ` David Woodhouse
2003-02-20 13:16 ` Geert Uytterhoeven
2003-02-20 14:40   ` Alan Cox

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