patch-2.4.21 linux-2.4.21/include/asm-m68k/ide.h
Next file: linux-2.4.21/include/asm-m68k/io.h
Previous file: linux-2.4.21/include/asm-m68k/hdreg.h
Back to the patch index
Back to the overall index
- Lines: 371
- Date:
2003-06-13 07:51:38.000000000 -0700
- Orig file:
linux-2.4.20/include/asm-m68k/ide.h
- Orig date:
2002-08-02 17:39:45.000000000 -0700
diff -urN linux-2.4.20/include/asm-m68k/ide.h linux-2.4.21/include/asm-m68k/ide.h
@@ -66,7 +66,9 @@
* Set up a hw structure for a specified data port, control port and IRQ.
* This should follow whatever the default interface uses.
*/
-static __inline__ void ide_init_hwif_ports(hw_regs_t *hw, ide_ioreg_t data_port, ide_ioreg_t ctrl_port, int *irq)
+static __inline__ void ide_init_hwif_ports(hw_regs_t *hw,
+ ide_ioreg_t data_port,
+ ide_ioreg_t ctrl_port, int *irq)
{
if (data_port || ctrl_port)
printk("ide_init_hwif_ports: must not be called\n");
@@ -80,307 +82,94 @@
{
}
-typedef union {
- unsigned all : 8; /* all of the bits together */
- struct {
- unsigned bit7 : 1; /* always 1 */
- unsigned lba : 1; /* using LBA instead of CHS */
- unsigned bit5 : 1; /* always 1 */
- unsigned unit : 1; /* drive select number, 0 or 1 */
- unsigned head : 4; /* always zeros here */
- } b;
-} select_t;
-
-typedef union {
- unsigned all : 8; /* all of the bits together */
- struct {
- unsigned HOB : 1; /* 48-bit address ordering */
- unsigned reserved456 : 3;
- unsigned bit3 : 1; /* ATA-2 thingy */
- unsigned SRST : 1; /* host soft reset bit */
- unsigned nIEN : 1; /* device INTRQ to host */
- unsigned bit0 : 1;
- } b;
-} control_t;
-
-static __inline__ int ide_request_irq(unsigned int irq, void (*handler)(int, void *, struct pt_regs *),
- unsigned long flags, const char *device, void *dev_id)
-{
-#ifdef CONFIG_AMIGA
- if (MACH_IS_AMIGA)
- return request_irq(irq, handler, 0, device, dev_id);
-#endif /* CONFIG_AMIGA */
-#ifdef CONFIG_Q40
- if (MACH_IS_Q40)
- return request_irq(irq, handler, 0, device, dev_id);
-#endif /* CONFIG_Q40*/
-#ifdef CONFIG_MAC
- if (MACH_IS_MAC)
- return request_irq(irq, handler, 0, device, dev_id);
-#endif /* CONFIG_MAC */
- return 0;
-}
-
-static __inline__ void ide_free_irq(unsigned int irq, void *dev_id)
-{
-#ifdef CONFIG_AMIGA
- if (MACH_IS_AMIGA)
- free_irq(irq, dev_id);
-#endif /* CONFIG_AMIGA */
-#ifdef CONFIG_Q40
- if (MACH_IS_Q40)
- free_irq(irq, dev_id);
-#endif /* CONFIG_Q40*/
-#ifdef CONFIG_MAC
- if (MACH_IS_MAC)
- free_irq(irq, dev_id);
-#endif /* CONFIG_MAC */
-}
-
-/*
- * We should really implement those some day.
- */
-static __inline__ int ide_check_region (ide_ioreg_t from, unsigned int extent)
-{
- return 0;
-}
-
-static __inline__ void ide_request_region (ide_ioreg_t from, unsigned int extent, const char *name)
-{
-#ifdef CONFIG_Q40
- if (MACH_IS_Q40)
- request_region((q40ide_ioreg_t)from,extent,name);
-#endif
-}
-
-static __inline__ void ide_release_region (ide_ioreg_t from, unsigned int extent)
-{
-#ifdef CONFIG_Q40
- if (MACH_IS_Q40)
- release_region((q40ide_ioreg_t)from,extent);
-#endif
-}
-
-#undef SUPPORT_SLOW_DATA_PORTS
-#define SUPPORT_SLOW_DATA_PORTS 0
-
-#undef SUPPORT_VLB_SYNC
-#define SUPPORT_VLB_SYNC 0
-
-/* this definition is used only on startup .. */
-#undef HD_DATA
-#define HD_DATA NULL
-
-
/*
- * get rid of defs from io.h
- * ide still has some private and conflicting versions
+ * Get rid of defs from io.h - ide has its private and conflicting versions
+ * Since so far no single m68k platform uses ISA/PCI I/O space for IDE, we
+ * always use the `raw' MMIO versions
*/
+#undef inb
+#undef inw
#undef insw
+#undef inl
#undef insl
+#undef outb
+#undef outw
#undef outsw
+#undef outl
#undef outsl
-
-
-/*
- * define IO method and translation,
- * so far only Q40 has ide-if on ISA
- */
-#ifndef CONFIG_Q40
-
-#define ADDR_TRANS_B(_addr_) (_addr_)
-#define ADDR_TRANS_W(_addr_) (_addr_)
-
-#else
-
-#define ADDR_TRANS_B(_addr_) (MACH_IS_Q40 ? ((unsigned char *)Q40_ISA_IO_B(_addr_)) : (_addr_))
-#define ADDR_TRANS_W(_addr_) (MACH_IS_Q40 ? ((unsigned char *)Q40_ISA_IO_W(_addr_)) : (_addr_))
-#endif
-
-#define HAVE_ARCH_OUT_BYTE
-
-#define OUT_BYTE(v,p) out_8(ADDR_TRANS_B((p)), (v))
-#define OUT_WORD(v,p) out_be16(ADDR_TRANS_W((p)), (v))
-
-#define HAVE_ARCH_IN_BYTE
-
-#define IN_BYTE(p) in_8(ADDR_TRANS_B((p)))
-#define IN_WORD(p) in_be16(ADDR_TRANS_W((p)))
-
-#define insw(port, buf, nr) raw_insw(ADDR_TRANS_W(port), buf, nr)
-#define outsw(port, buf, nr) raw_outsw(ADDR_TRANS_W(port), buf, nr)
-
-#define insl(data_reg, buffer, wcount) insw(data_reg, buffer, (wcount)<<1)
-#define outsl(data_reg, buffer, wcount) outsw(data_reg, buffer, (wcount)<<1)
-
-
+#undef readb
+#undef readw
+#undef readl
+#undef writeb
+#undef writew
+#undef writel
+
+#define inb in_8
+#define inw in_be16
+#define insw(port, addr, n) raw_insw((u16 *)port, addr, n)
+#define inl in_be32
+#define insl(port, addr, n) raw_insl((u32 *)port, addr, n)
+#define outb(val, port) out_8(port, val)
+#define outw(val, port) out_be16(port, val)
+#define outsw(port, addr, n) raw_outsw((u16 *)port, addr, n)
+#define outl(val, port) out_be32(port, val)
+#define outsl(port, addr, n) raw_outsl((u32 *)port, addr, n)
+#define readb in_8
+#define readw in_be16
+#define __ide_mm_insw(port, addr, n) raw_insw((u16 *)port, addr, n)
+#define readl in_be32
+#define __ide_mm_insl(port, addr, n) raw_insl((u32 *)port, addr, n)
+#define writeb(val, port) out_8(port, val)
+#define writew(val, port) out_be16(port, val)
+#define __ide_mm_outsw(port, addr, n) raw_outsw((u16 *)port, addr, n)
+#define writel(val, port) out_be32(port, val)
+#define __ide_mm_outsl(port, addr, n) raw_outsl((u32 *)port, addr, n)
#if defined(CONFIG_ATARI) || defined(CONFIG_Q40)
+#define insw_swapw(port, addr, n) raw_insw_swapw((u16 *)port, addr, n)
+#define outsw_swapw(port, addr, n) raw_outsw_swapw((u16 *)port, addr, n)
+#endif
-#define insl_swapw(data_reg, buffer, wcount) \
- insw_swapw(data_reg, buffer, (wcount)<<1)
-#define outsl_swapw(data_reg, buffer, wcount) \
- outsw_swapw(data_reg, buffer, (wcount)<<1)
-
-#define insw_swapw(port, buf, nr) raw_insw_swapw(ADDR_TRANS_W(port), buf, nr)
-#define outsw_swapw(port, buf, nr) raw_outsw_swapw(ADDR_TRANS_W(port),buf,nr)
-
-#endif /* CONFIG_ATARI || CONFIG_Q40 */
-
-
-#define T_CHAR (0x0000) /* char: don't touch */
-#define T_SHORT (0x4000) /* short: 12 -> 21 */
-#define T_INT (0x8000) /* int: 1234 -> 4321 */
-#define T_TEXT (0xc000) /* text: 12 -> 21 */
-
-#define T_MASK_TYPE (0xc000)
-#define T_MASK_COUNT (0x3fff)
-
-#define D_CHAR(cnt) (T_CHAR | (cnt))
-#define D_SHORT(cnt) (T_SHORT | (cnt))
-#define D_INT(cnt) (T_INT | (cnt))
-#define D_TEXT(cnt) (T_TEXT | (cnt))
-/* Q40 and Atari have byteswapped IDE bus and since many interesting
+/* Q40 and Atari have byteswapped IDE busses and since many interesting
* values in the identification string are text, chars and words they
- * happened to be almost correct without swapping.. However *_capacity
+ * happened to be almost correct without swapping.. However *_capacity
* is needed for drives over 8 GB. RZ */
#if defined(CONFIG_Q40) || defined(CONFIG_ATARI)
#define M68K_IDE_SWAPW (MACH_IS_Q40 || MACH_IS_ATARI)
#endif
-#if defined(CONFIG_AMIGA) || defined (CONFIG_MAC) || defined(M68K_IDE_SWAPW)
-static u_short driveid_types[] = {
- D_SHORT(10), /* config - vendor2 */
- D_TEXT(20), /* serial_no */
- D_SHORT(3), /* buf_type, buf_size - ecc_bytes */
- D_TEXT(48), /* fw_rev - model */
- D_CHAR(2), /* max_multsect - vendor3 */
- D_SHORT(1), /* dword_io */
- D_CHAR(2), /* vendor4 - capability */
- D_SHORT(1), /* reserved50 */
- D_CHAR(4), /* vendor5 - tDMA */
- D_SHORT(4), /* field_valid - cur_sectors */
- D_INT(1), /* cur_capacity */
- D_CHAR(2), /* multsect - multsect_valid */
- D_INT(1), /* lba_capacity */
- D_SHORT(194) /* dma_1word - reserved */
-};
+#ifdef CONFIG_BLK_DEV_FALCON_IDE
+#define IDE_ARCH_LOCK
-#define num_driveid_types (sizeof(driveid_types)/sizeof(*driveid_types))
-#endif /* CONFIG_AMIGA */
+extern int falconide_intr_lock;
-static __inline__ void ide_fix_driveid(struct hd_driveid *id)
+static __inline__ void ide_release_lock(void)
{
-#if defined(CONFIG_AMIGA) || defined (CONFIG_MAC) || defined(M68K_IDE_SWAPW)
- u_char *p = (u_char *)id;
- int i, j, cnt;
- u_char t;
-
- if (!MACH_IS_AMIGA && !MACH_IS_MAC && !MACH_IS_Q40 && !MACH_IS_ATARI)
- return;
-#ifdef M68K_IDE_SWAPW
- if (M68K_IDE_SWAPW) /* fix bus byteorder first */
- for (i=0; i < 512; i+=2) {
- t = p[i]; p[i] = p[i+1]; p[i+1] = t;
- }
-#endif
- for (i = 0; i < num_driveid_types; i++) {
- cnt = driveid_types[i] & T_MASK_COUNT;
- switch (driveid_types[i] & T_MASK_TYPE) {
- case T_CHAR:
- p += cnt;
- break;
- case T_SHORT:
- for (j = 0; j < cnt; j++) {
- t = p[0];
- p[0] = p[1];
- p[1] = t;
- p += 2;
- }
- break;
- case T_INT:
- for (j = 0; j < cnt; j++) {
- t = p[0];
- p[0] = p[3];
- p[3] = t;
- t = p[1];
- p[1] = p[2];
- p[2] = t;
- p += 4;
- }
- break;
- case T_TEXT:
- for (j = 0; j < cnt; j += 2) {
- t = p[0];
- p[0] = p[1];
- p[1] = t;
- p += 2;
- }
- break;
- }
- }
-#endif /* CONFIG_AMIGA */
-}
-
-static __inline__ void ide_release_lock (int *ide_lock)
-{
-#ifdef CONFIG_ATARI
if (MACH_IS_ATARI) {
- if (*ide_lock == 0) {
+ if (falconide_intr_lock == 0) {
printk("ide_release_lock: bug\n");
return;
}
- *ide_lock = 0;
+ falconide_intr_lock = 0;
stdma_release();
}
-#endif /* CONFIG_ATARI */
}
-static __inline__ void ide_get_lock (int *ide_lock, void (*handler)(int, void *, struct pt_regs *), void *data)
+static __inline__ void ide_get_lock(void (*handler)(int, void *, struct pt_regs *), void *data)
{
-#ifdef CONFIG_ATARI
if (MACH_IS_ATARI) {
- if (*ide_lock == 0) {
+ if (falconide_intr_lock == 0) {
if (in_interrupt() > 0)
panic( "Falcon IDE hasn't ST-DMA lock in interrupt" );
stdma_lock(handler, data);
- *ide_lock = 1;
+ falconide_intr_lock = 1;
}
}
-#endif /* CONFIG_ATARI */
}
+#endif /* CONFIG_BLK_DEV_FALCON_IDE */
+#define IDE_ARCH_ACK_INTR
#define ide_ack_intr(hwif) ((hwif)->hw.ack_intr ? (hwif)->hw.ack_intr(hwif) : 1)
-/*
- * On the Atari, we sometimes can't enable interrupts:
- */
-
-/* MSch: changed sti() to STI() wherever possible in ide.c; moved STI() def.
- * to asm/ide.h
- */
-/* The Atari interrupt structure strictly requires that the IPL isn't lowered
- * uncontrolled in an interrupt handler. In the concrete case, the IDE
- * interrupt is already a slow int, so the irq is already disabled at the time
- * the handler is called, and the IPL has been lowered to the minimum value
- * possible. To avoid going below that, STI() checks for being called inside
- * an interrupt, and in that case it does nothing. Hope that is reasonable and
- * works. (Roman)
- */
-#ifdef MACH_ATARI_ONLY
-#define ide__sti() \
- do { \
- if (!in_interrupt()) __sti(); \
- } while(0)
-#elif defined(CONFIG_ATARI)
-#define ide__sti() \
- do { \
- if (!MACH_IS_ATARI || !in_interrupt()) sti(); \
- } while(0)
-#else /* !defined(CONFIG_ATARI) */
-#define ide__sti() __sti()
-#endif
-
#endif /* __KERNEL__ */
-
#endif /* _M68K_IDE_H */
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)