Commit c01fc8a9 authored by Anton Altaparmakov's avatar Anton Altaparmakov

Merge bk://linuxvm.bkbits.net/linus-2.5 into cantab.net:/usr/src/tng

parents dfeb4845 045c90fe
...@@ -27,7 +27,9 @@ volatile struct baboon *baboon; ...@@ -27,7 +27,9 @@ volatile struct baboon *baboon;
void baboon_irq(int, void *, struct pt_regs *); void baboon_irq(int, void *, struct pt_regs *);
#if 0
extern int macide_ack_intr(struct ata_channel *); extern int macide_ack_intr(struct ata_channel *);
#endif
/* /*
* Baboon initialization. * Baboon initialization.
......
...@@ -30,42 +30,8 @@ static void no_ide_init_hwif_ports (hw_regs_t *hw, ide_ioreg_t data_port, ...@@ -30,42 +30,8 @@ static void no_ide_init_hwif_ports (hw_regs_t *hw, ide_ioreg_t data_port,
{ {
} }
static int no_ide_request_irq(unsigned int irq,
void (*handler)(int,void *, struct pt_regs *),
unsigned long flags, const char *device,
void *dev_id)
{
panic("no_no_ide_request_irq called - shouldn't happen");
}
static void no_ide_free_irq(unsigned int irq, void *dev_id)
{
panic("no_ide_free_irq called - shouldn't happen");
}
static int no_ide_check_region(ide_ioreg_t from, unsigned int extent)
{
panic("no_ide_check_region called - shouldn't happen");
}
static void no_ide_request_region(ide_ioreg_t from, unsigned int extent,
const char *name)
{
panic("no_ide_request_region called - shouldn't happen");
}
static void no_ide_release_region(ide_ioreg_t from, unsigned int extent)
{
panic("no_ide_release_region called - shouldn't happen");
}
struct ide_ops no_ide_ops = { struct ide_ops no_ide_ops = {
&no_ide_default_irq, &no_ide_default_irq,
&no_ide_default_io_base, &no_ide_default_io_base,
&no_ide_init_hwif_ports, &no_ide_init_hwif_ports
&no_ide_request_irq,
&no_ide_free_irq,
&no_ide_check_region,
&no_ide_request_region,
&no_ide_release_region
}; };
...@@ -62,42 +62,8 @@ static void std_ide_init_hwif_ports (hw_regs_t *hw, ide_ioreg_t data_port, ...@@ -62,42 +62,8 @@ static void std_ide_init_hwif_ports (hw_regs_t *hw, ide_ioreg_t data_port,
hw->io_ports[IDE_IRQ_OFFSET] = 0; hw->io_ports[IDE_IRQ_OFFSET] = 0;
} }
static int std_ide_request_irq(unsigned int irq,
void (*handler)(int,void *, struct pt_regs *),
unsigned long flags, const char *device,
void *dev_id)
{
return request_irq(irq, handler, flags, device, dev_id);
}
static void std_ide_free_irq(unsigned int irq, void *dev_id)
{
free_irq(irq, dev_id);
}
static int std_ide_check_region(ide_ioreg_t from, unsigned int extent)
{
return check_region(from, extent);
}
static void std_ide_request_region(ide_ioreg_t from, unsigned int extent,
const char *name)
{
request_region(from, extent, name);
}
static void std_ide_release_region(ide_ioreg_t from, unsigned int extent)
{
release_region(from, extent);
}
struct ide_ops std_ide_ops = { struct ide_ops std_ide_ops = {
&std_ide_default_irq, &std_ide_default_irq,
&std_ide_default_io_base, &std_ide_default_io_base,
&std_ide_init_hwif_ports, &std_ide_init_hwif_ports
&std_ide_request_irq,
&std_ide_free_irq,
&std_ide_check_region,
&std_ide_request_region,
&std_ide_release_region
}; };
...@@ -29,42 +29,8 @@ static void no_ide_init_hwif_ports (hw_regs_t *hw, ide_ioreg_t data_port, ...@@ -29,42 +29,8 @@ static void no_ide_init_hwif_ports (hw_regs_t *hw, ide_ioreg_t data_port,
{ {
} }
static int no_ide_request_irq(unsigned int irq,
void (*handler)(int,void *, struct pt_regs *),
unsigned long flags, const char *device,
void *dev_id)
{
panic("no_no_ide_request_irq called - shouldn't happen");
}
static void no_ide_free_irq(unsigned int irq, void *dev_id)
{
panic("no_ide_free_irq called - shouldn't happen");
}
static int no_ide_check_region(ide_ioreg_t from, unsigned int extent)
{
panic("no_ide_check_region called - shouldn't happen");
}
static void no_ide_request_region(ide_ioreg_t from, unsigned int extent,
const char *name)
{
panic("no_ide_request_region called - shouldn't happen");
}
static void no_ide_release_region(ide_ioreg_t from, unsigned int extent)
{
panic("no_ide_release_region called - shouldn't happen");
}
struct ide_ops no_ide_ops = { struct ide_ops no_ide_ops = {
&no_ide_default_irq, &no_ide_default_irq,
&no_ide_default_io_base, &no_ide_default_io_base,
&no_ide_init_hwif_ports, &no_ide_init_hwif_ports
&no_ide_request_irq,
&no_ide_free_irq,
&no_ide_check_region,
&no_ide_request_region,
&no_ide_release_region
}; };
...@@ -62,42 +62,8 @@ static void std_ide_init_hwif_ports (hw_regs_t *hw, ide_ioreg_t data_port, ...@@ -62,42 +62,8 @@ static void std_ide_init_hwif_ports (hw_regs_t *hw, ide_ioreg_t data_port,
hw->io_ports[IDE_IRQ_OFFSET] = 0; hw->io_ports[IDE_IRQ_OFFSET] = 0;
} }
static int std_ide_request_irq(unsigned int irq,
void (*handler)(int,void *, struct pt_regs *),
unsigned long flags, const char *device,
void *dev_id)
{
return request_irq(irq, handler, flags, device, dev_id);
}
static void std_ide_free_irq(unsigned int irq, void *dev_id)
{
free_irq(irq, dev_id);
}
static int std_ide_check_region(ide_ioreg_t from, unsigned int extent)
{
return check_region(from, extent);
}
static void std_ide_request_region(ide_ioreg_t from, unsigned int extent,
const char *name)
{
request_region(from, extent, name);
}
static void std_ide_release_region(ide_ioreg_t from, unsigned int extent)
{
release_region(from, extent);
}
struct ide_ops std_ide_ops = { struct ide_ops std_ide_ops = {
&std_ide_default_irq, &std_ide_default_irq,
&std_ide_default_io_base, &std_ide_default_io_base,
&std_ide_init_hwif_ports, &std_ide_init_hwif_ports
&std_ide_request_irq,
&std_ide_free_irq,
&std_ide_check_region,
&std_ide_request_region,
&std_ide_release_region
}; };
...@@ -256,29 +256,6 @@ ppc4xx_progress(char *s, unsigned short hex) ...@@ -256,29 +256,6 @@ ppc4xx_progress(char *s, unsigned short hex)
* IDE stuff. * IDE stuff.
* should be generic for every IDE PCI chipset * should be generic for every IDE PCI chipset
*/ */
#if defined(CONFIG_BLK_DEV_IDE)
static int
ppc4xx_ide_check_region(ide_ioreg_t from, unsigned int extent)
{
return check_region(from, extent);
}
static void
ppc4xx_ide_request_region(ide_ioreg_t from, unsigned int extent,
const char *name)
{
request_region(from, extent, name);
return;
}
static void
ppc4xx_ide_release_region(ide_ioreg_t from, unsigned int extent)
{
release_region(from, extent);
return;
}
#endif
#if defined(CONFIG_BLK_DEV_IDEPCI) #if defined(CONFIG_BLK_DEV_IDEPCI)
static void static void
ppc4xx_ide_init_hwif_ports(hw_regs_t * hw, ide_ioreg_t data_port, ppc4xx_ide_init_hwif_ports(hw_regs_t * hw, ide_ioreg_t data_port,
...@@ -398,16 +375,13 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5, ...@@ -398,16 +375,13 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
** m8xx_setup.c, prep_setup.c use ** m8xx_setup.c, prep_setup.c use
** defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) ** defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
*/ */
#if defined (CONFIG_IDE) #ifdef CONFIG_IDE
ppc_ide_md.ide_request_region = ppc4xx_ide_request_region; # if defined(CONFIG_BLK_DEV_IDEPCI)
ppc_ide_md.ide_release_region = ppc4xx_ide_release_region;
ppc_ide_md.ide_check_region = ppc4xx_ide_check_region;
#if defined(CONFIG_BLK_DEV_IDEPCI)
ppc_ide_md.ide_init_hwif = ppc4xx_ide_init_hwif_ports; ppc_ide_md.ide_init_hwif = ppc4xx_ide_init_hwif_ports;
#elif defined (CONFIG_DMA_NONPCI) /* ON board IDE */ # elif defined (CONFIG_DMA_NONPCI) /* ON board IDE */
ppc_ide_md.default_irq = nonpci_ide_default_irq; ppc_ide_md.default_irq = nonpci_ide_default_irq;
ppc_ide_md.ide_init_hwif = nonpci_ide_init_hwif_ports; ppc_ide_md.ide_init_hwif = nonpci_ide_init_hwif_ports;
#endif # endif
#endif #endif
board_init(); board_init();
......
...@@ -463,33 +463,6 @@ chrp_init2(void) ...@@ -463,33 +463,6 @@ chrp_init2(void)
#endif /* CONFIG_VT && (CONFIG_ADB_KEYBOARD || CONFIG_INPUT) */ #endif /* CONFIG_VT && (CONFIG_ADB_KEYBOARD || CONFIG_INPUT) */
} }
#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
/*
* IDE stuff.
*/
static int __chrp
chrp_ide_check_region(ide_ioreg_t from, unsigned int extent)
{
return check_region(from, extent);
}
static void __chrp
chrp_ide_request_region(ide_ioreg_t from,
unsigned int extent,
const char *name)
{
request_region(from, extent, name);
}
static void __chrp
chrp_ide_release_region(ide_ioreg_t from,
unsigned int extent)
{
release_region(from, extent);
}
#endif
/* /*
* One of the main thing these mappings are needed for is so that * One of the main thing these mappings are needed for is so that
* xmon can get to the serial port early on. We probably should * xmon can get to the serial port early on. We probably should
...@@ -597,12 +570,6 @@ chrp_init(unsigned long r3, unsigned long r4, unsigned long r5, ...@@ -597,12 +570,6 @@ chrp_init(unsigned long r3, unsigned long r4, unsigned long r5,
ppc_md.smp_ops = &chrp_smp_ops; ppc_md.smp_ops = &chrp_smp_ops;
#endif /* CONFIG_SMP */ #endif /* CONFIG_SMP */
#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
ppc_ide_md.ide_check_region = chrp_ide_check_region;
ppc_ide_md.ide_request_region = chrp_ide_request_region;
ppc_ide_md.ide_release_region = chrp_ide_release_region;
#endif
/* /*
* Print the banner, then scroll down so boot progress * Print the banner, then scroll down so boot progress
* can be printed. -- Cort * can be printed. -- Cort
......
...@@ -55,24 +55,6 @@ static unsigned int cpu_6xx[16] = { ...@@ -55,24 +55,6 @@ static unsigned int cpu_6xx[16] = {
#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
/* IDE functions */ /* IDE functions */
static int
k2_ide_check_region(ide_ioreg_t from, unsigned int extent)
{
return check_region(from, extent);
}
static void
k2_ide_request_region(ide_ioreg_t from, unsigned int extent,
const char *name)
{
request_region(from, extent, name);
}
static void
k2_ide_release_region(ide_ioreg_t from, unsigned int extent)
{
release_region(from, extent);
}
static void __init static void __init
k2_ide_init_hwif_ports (hw_regs_t *hw, ide_ioreg_t data_port, k2_ide_init_hwif_ports (hw_regs_t *hw, ide_ioreg_t data_port,
...@@ -373,9 +355,6 @@ void __init platform_init(unsigned long r3, unsigned long r4, ...@@ -373,9 +355,6 @@ void __init platform_init(unsigned long r3, unsigned long r4,
ppc_md.nvram_write_val = todc_direct_write_val; ppc_md.nvram_write_val = todc_direct_write_val;
#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
ppc_ide_md.ide_check_region = k2_ide_check_region;
ppc_ide_md.ide_request_region = k2_ide_request_region;
ppc_ide_md.ide_release_region = k2_ide_release_region;
ppc_ide_md.ide_init_hwif = k2_ide_init_hwif_ports; ppc_ide_md.ide_init_hwif = k2_ide_init_hwif_ports;
#endif #endif
} }
......
...@@ -154,13 +154,6 @@ lopec_ide_default_irq(ide_ioreg_t base) ...@@ -154,13 +154,6 @@ lopec_ide_default_irq(ide_ioreg_t base)
return 0; return 0;
} }
static void
lopec_ide_request_region(ide_ioreg_t from, unsigned int to,
const char *name)
{
request_region(from, to, name);
}
static ide_ioreg_t static ide_ioreg_t
lopec_ide_default_io_base(int index) lopec_ide_default_io_base(int index)
{ {
...@@ -169,19 +162,6 @@ lopec_ide_default_io_base(int index) ...@@ -169,19 +162,6 @@ lopec_ide_default_io_base(int index)
return lopec_ide_regbase[index]; return lopec_ide_regbase[index];
} }
static int
lopec_ide_check_region(ide_ioreg_t from, unsigned int to)
{
return check_region(from, to);
}
static void
lopec_ide_release_region(ide_ioreg_t from, unsigned int to)
{
release_region(from, to);
}
static void __init static void __init
lopec_ide_init_hwif_ports(hw_regs_t *hw, ide_ioreg_t data, lopec_ide_init_hwif_ports(hw_regs_t *hw, ide_ioreg_t data,
ide_ioreg_t ctl, int *irq) ide_ioreg_t ctl, int *irq)
...@@ -350,9 +330,6 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5, ...@@ -350,9 +330,6 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_ID_MODULE) #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_ID_MODULE)
ppc_ide_md.default_irq = lopec_ide_default_irq; ppc_ide_md.default_irq = lopec_ide_default_irq;
ppc_ide_md.default_io_base = lopec_ide_default_io_base; ppc_ide_md.default_io_base = lopec_ide_default_io_base;
ppc_ide_md.ide_request_region = lopec_ide_request_region;
ppc_ide_md.ide_check_region = lopec_ide_check_region;
ppc_ide_md.ide_release_region = lopec_ide_release_region;
ppc_ide_md.ide_init_hwif = lopec_ide_init_hwif_ports; ppc_ide_md.ide_init_hwif = lopec_ide_init_hwif_ports;
#endif #endif
} }
...@@ -322,29 +322,6 @@ mcpn765_ide_default_io_base(int index) ...@@ -322,29 +322,6 @@ mcpn765_ide_default_io_base(int index)
return mcpn765_ide_regbase[index]; return mcpn765_ide_regbase[index];
} }
static int
mcpn765_ide_check_region(ide_ioreg_t from, unsigned int extent)
{
return check_region(from, extent);
}
static void
mcpn765_ide_request_region(ide_ioreg_t from,
unsigned int extent,
const char *name)
{
request_region(from, extent, name);
return;
}
static void
mcpn765_ide_release_region(ide_ioreg_t from,
unsigned int extent)
{
release_region(from, extent);
return;
}
static void __init static void __init
mcpn765_ide_init_hwif_ports(hw_regs_t *hw, ide_ioreg_t data_port, mcpn765_ide_init_hwif_ports(hw_regs_t *hw, ide_ioreg_t data_port,
ide_ioreg_t ctrl_port, int *irq) ide_ioreg_t ctrl_port, int *irq)
...@@ -492,9 +469,6 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5, ...@@ -492,9 +469,6 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
ppc_ide_md.default_irq = mcpn765_ide_default_irq; ppc_ide_md.default_irq = mcpn765_ide_default_irq;
ppc_ide_md.default_io_base = mcpn765_ide_default_io_base; ppc_ide_md.default_io_base = mcpn765_ide_default_io_base;
ppc_ide_md.ide_check_region = mcpn765_ide_check_region;
ppc_ide_md.ide_request_region = mcpn765_ide_request_region;
ppc_ide_md.ide_release_region = mcpn765_ide_release_region;
ppc_ide_md.ide_init_hwif = mcpn765_ide_init_hwif_ports; ppc_ide_md.ide_init_hwif = mcpn765_ide_init_hwif_ports;
#endif #endif
......
...@@ -199,27 +199,6 @@ menf1_map_io(void) ...@@ -199,27 +199,6 @@ menf1_map_io(void)
#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
/* IDE functions */ /* IDE functions */
static int
menf1_ide_check_region(ide_ioreg_t from, unsigned int extent)
{
return check_region(from, extent);
}
static void
menf1_ide_request_region(ide_ioreg_t from,
unsigned int extent,
const char *name)
{
request_region(from, extent, name);
}
static void
menf1_ide_release_region(ide_ioreg_t from,
unsigned int extent)
{
release_region(from, extent);
}
static void __init static void __init
menf1_ide_init_hwif_ports (hw_regs_t *hw, ide_ioreg_t data_port, menf1_ide_init_hwif_ports (hw_regs_t *hw, ide_ioreg_t data_port,
ide_ioreg_t ctrl_port, int *irq) ide_ioreg_t ctrl_port, int *irq)
...@@ -305,9 +284,6 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5, ...@@ -305,9 +284,6 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
ppc_ide_md.default_io_base = menf1_ide_default_io_base; ppc_ide_md.default_io_base = menf1_ide_default_io_base;
ppc_ide_md.default_irq = menf1_ide_default_irq; ppc_ide_md.default_irq = menf1_ide_default_irq;
ppc_ide_md.ide_check_region = menf1_ide_check_region;
ppc_ide_md.ide_request_region = menf1_ide_request_region;
ppc_ide_md.ide_release_region = menf1_ide_release_region;
ppc_ide_md.ide_init_hwif = menf1_ide_init_hwif_ports; ppc_ide_md.ide_init_hwif = menf1_ide_init_hwif_ports;
#endif #endif
} }
...@@ -601,45 +601,6 @@ pmac_halt(void) ...@@ -601,45 +601,6 @@ pmac_halt(void)
pmac_power_off(); pmac_power_off();
} }
#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
/*
* IDE stuff.
*/
static int __pmac
pmac_ide_check_region(ide_ioreg_t from, unsigned int extent)
{
#ifdef CONFIG_BLK_DEV_IDE_PMAC
if (pmac_ide_check_base(from) >= 0)
return 0;
#endif
return check_region(from, extent);
}
static void __pmac
pmac_ide_request_region(ide_ioreg_t from,
unsigned int extent,
const char *name)
{
#ifdef CONFIG_BLK_DEV_IDE_PMAC
if (pmac_ide_check_base(from) >= 0)
return;
#endif
request_region(from, extent, name);
}
static void __pmac
pmac_ide_release_region(ide_ioreg_t from,
unsigned int extent)
{
#ifdef CONFIG_BLK_DEV_IDE_PMAC
if (pmac_ide_check_base(from) >= 0)
return;
#endif
release_region(from, extent);
}
#endif /* defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) */
/* /*
* Read in a property describing some pieces of memory. * Read in a property describing some pieces of memory.
*/ */
...@@ -796,12 +757,6 @@ pmac_init(unsigned long r3, unsigned long r4, unsigned long r5, ...@@ -796,12 +757,6 @@ pmac_init(unsigned long r3, unsigned long r4, unsigned long r5,
select_adb_keyboard(); select_adb_keyboard();
#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
ppc_ide_md.ide_check_region = pmac_ide_check_region;
ppc_ide_md.ide_request_region = pmac_ide_request_region;
ppc_ide_md.ide_release_region = pmac_ide_release_region;
#endif /* defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) */
#ifdef CONFIG_BOOTX_TEXT #ifdef CONFIG_BOOTX_TEXT
ppc_md.progress = pmac_progress; ppc_md.progress = pmac_progress;
#endif /* CONFIG_BOOTX_TEXT */ #endif /* CONFIG_BOOTX_TEXT */
......
...@@ -263,27 +263,6 @@ pplus_ide_default_io_base(int index) ...@@ -263,27 +263,6 @@ pplus_ide_default_io_base(int index)
} }
} }
static int
pplus_ide_check_region(ide_ioreg_t from, unsigned int extent)
{
return check_region(from, extent);
}
static void
pplus_ide_request_region(ide_ioreg_t from,
unsigned int extent,
const char *name)
{
request_region(from, extent, name);
}
static void
pplus_ide_release_region(ide_ioreg_t from,
unsigned int extent)
{
release_region(from, extent);
}
static void __init static void __init
pplus_ide_init_hwif_ports (hw_regs_t *hw, ide_ioreg_t data_port, ide_ioreg_t ctrl_port, int *irq) pplus_ide_init_hwif_ports (hw_regs_t *hw, ide_ioreg_t data_port, ide_ioreg_t ctrl_port, int *irq)
{ {
...@@ -528,9 +507,6 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5, ...@@ -528,9 +507,6 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
ppc_ide_md.default_irq = pplus_ide_default_irq; ppc_ide_md.default_irq = pplus_ide_default_irq;
ppc_ide_md.default_io_base = pplus_ide_default_io_base; ppc_ide_md.default_io_base = pplus_ide_default_io_base;
ppc_ide_md.ide_check_region = pplus_ide_check_region;
ppc_ide_md.ide_request_region = pplus_ide_request_region;
ppc_ide_md.ide_release_region = pplus_ide_release_region;
ppc_ide_md.ide_init_hwif = pplus_ide_init_hwif_ports; ppc_ide_md.ide_init_hwif = pplus_ide_init_hwif_ports;
#endif #endif
......
...@@ -733,27 +733,6 @@ prep_ide_default_io_base(int index) ...@@ -733,27 +733,6 @@ prep_ide_default_io_base(int index)
return 0; return 0;
} }
} }
static int __prep
prep_ide_check_region(ide_ioreg_t from, unsigned int extent)
{
return check_region(from, extent);
}
static void __prep
prep_ide_request_region(ide_ioreg_t from,
unsigned int extent,
const char *name)
{
request_region(from, extent, name);
}
static void __prep
prep_ide_release_region(ide_ioreg_t from,
unsigned int extent)
{
release_region(from, extent);
}
#endif #endif
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
...@@ -916,9 +895,6 @@ prep_init(unsigned long r3, unsigned long r4, unsigned long r5, ...@@ -916,9 +895,6 @@ prep_init(unsigned long r3, unsigned long r4, unsigned long r5,
#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
ppc_ide_md.default_irq = prep_ide_default_irq; ppc_ide_md.default_irq = prep_ide_default_irq;
ppc_ide_md.default_io_base = prep_ide_default_io_base; ppc_ide_md.default_io_base = prep_ide_default_io_base;
ppc_ide_md.ide_check_region = prep_ide_check_region;
ppc_ide_md.ide_request_region = prep_ide_request_region;
ppc_ide_md.ide_release_region = prep_ide_release_region;
#endif #endif
#ifdef CONFIG_VT #ifdef CONFIG_VT
......
...@@ -85,8 +85,8 @@ extern bd_t m8xx_board_info; ...@@ -85,8 +85,8 @@ extern bd_t m8xx_board_info;
/* for pcmcia sandisk */ /* for pcmcia sandisk */
#ifdef CONFIG_IDE #ifdef CONFIG_IDE
#define MAX_HWIFS 1 # define MAX_HWIFS 1
#define ide_request_irq(irq,hand,flg,dev,id) request_8xxirq((irq),(hand),(flg),(dev),(id)) # define request_irq(irq,hand,flg,dev,id) request_8xxirq((irq),(hand),(flg),(dev),(id))
#endif #endif
#endif #endif
......
...@@ -72,8 +72,8 @@ extern bd_t m8xx_board_info; ...@@ -72,8 +72,8 @@ extern bd_t m8xx_board_info;
#define _IO_BASE_SIZE 0x1000 #define _IO_BASE_SIZE 0x1000
#ifdef CONFIG_IDE #ifdef CONFIG_IDE
#define MAX_HWIFS 1 # define MAX_HWIFS 1
#define ide_request_irq(irq,hand,flg,dev,id) request_8xxirq((irq),(hand),(flg),(dev),(id)) # define request_irq(irq,hand,flg,dev,id) request_8xxirq((irq),(hand),(flg),(dev),(id))
#endif #endif
/* We don't use the 8259. /* We don't use the 8259.
......
...@@ -491,29 +491,6 @@ sandpoint_ide_default_io_base(int index) ...@@ -491,29 +491,6 @@ sandpoint_ide_default_io_base(int index)
return sandpoint_ide_regbase[index]; return sandpoint_ide_regbase[index];
} }
static int
sandpoint_ide_check_region(ide_ioreg_t from, unsigned int extent)
{
return check_region(from, extent);
}
static void
sandpoint_ide_request_region(ide_ioreg_t from,
unsigned int extent,
const char *name)
{
request_region(from, extent, name);
return;
}
static void
sandpoint_ide_release_region(ide_ioreg_t from,
unsigned int extent)
{
release_region(from, extent);
return;
}
static void __init static void __init
sandpoint_ide_init_hwif_ports(hw_regs_t *hw, ide_ioreg_t data_port, sandpoint_ide_init_hwif_ports(hw_regs_t *hw, ide_ioreg_t data_port,
ide_ioreg_t ctrl_port, int *irq) ide_ioreg_t ctrl_port, int *irq)
...@@ -684,9 +661,6 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5, ...@@ -684,9 +661,6 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
ppc_ide_md.default_irq = sandpoint_ide_default_irq; ppc_ide_md.default_irq = sandpoint_ide_default_irq;
ppc_ide_md.default_io_base = sandpoint_ide_default_io_base; ppc_ide_md.default_io_base = sandpoint_ide_default_io_base;
ppc_ide_md.ide_check_region = sandpoint_ide_check_region;
ppc_ide_md.ide_request_region = sandpoint_ide_request_region;
ppc_ide_md.ide_release_region = sandpoint_ide_release_region;
ppc_ide_md.ide_init_hwif = sandpoint_ide_init_hwif_ports; ppc_ide_md.ide_init_hwif = sandpoint_ide_init_hwif_ports;
#endif #endif
......
...@@ -5,9 +5,7 @@ ...@@ -5,9 +5,7 @@
* May be copied or modified under the terms of the GNU General Public License * May be copied or modified under the terms of the GNU General Public License
* *
* Special Thanks to Mark for his Six years of work. * Special Thanks to Mark for his Six years of work.
*/ *
/*
* This module provides support for the bus-master IDE DMA functions * This module provides support for the bus-master IDE DMA functions
* of various PCI chipsets, including the Intel PIIX (i82371FB for * of various PCI chipsets, including the Intel PIIX (i82371FB for
* the 430 FX chipset), the PIIX3 (i82371SB for the 430 HX/VX and * the 430 FX chipset), the PIIX3 (i82371SB for the 430 HX/VX and
...@@ -209,71 +207,68 @@ ide_startstop_t ide_dma_intr (ide_drive_t *drive) ...@@ -209,71 +207,68 @@ ide_startstop_t ide_dma_intr (ide_drive_t *drive)
__ide_end_request(drive, 1, rq->nr_sectors); __ide_end_request(drive, 1, rq->nr_sectors);
return ide_stopped; return ide_stopped;
} }
printk("%s: dma_intr: bad DMA status (dma_stat=%x)\n", printk("%s: dma_intr: bad DMA status (dma_stat=%x)\n",
drive->name, dma_stat); drive->name, dma_stat);
} }
return ide_error(drive, "dma_intr", stat); return ide_error(drive, "dma_intr", stat);
} }
static int ide_build_sglist(struct ata_channel *hwif, struct request *rq)
{
request_queue_t *q = &hwif->drives[DEVICE_NR(rq->rq_dev) & 1].queue;
struct scatterlist *sg = hwif->sg_table;
int nents;
nents = blk_rq_map_sg(q, rq, hwif->sg_table);
if (rq->q && nents > rq->nr_phys_segments)
printk("ide-dma: received %d phys segments, build %d\n", rq->nr_phys_segments, nents);
if (rq_data_dir(rq) == READ)
hwif->sg_dma_direction = PCI_DMA_FROMDEVICE;
else
hwif->sg_dma_direction = PCI_DMA_TODEVICE;
return pci_map_sg(hwif->pci_dev, sg, nents, hwif->sg_dma_direction);
}
/* /*
* FIXME: taskfiles should be a map of pages, not a long virt address... /jens * FIXME: taskfiles should be a map of pages, not a long virt address... /jens
* FIXME: I agree with Jens --mdcki! * FIXME: I agree with Jens --mdcki!
*/ */
static int raw_build_sglist(struct ata_channel *ch, struct request *rq) static int build_sglist(struct ata_channel *ch, struct request *rq)
{ {
struct scatterlist *sg = ch->sg_table; struct scatterlist *sg = ch->sg_table;
int nents = 0; int nents = 0;
struct ata_taskfile *args = rq->special;
if (rq->flags & REQ_DRIVE_ACB) {
struct ata_taskfile *args = rq->special;
#if 1 #if 1
unsigned char *virt_addr = rq->buffer; unsigned char *virt_addr = rq->buffer;
int sector_count = rq->nr_sectors; int sector_count = rq->nr_sectors;
#else #else
nents = blk_rq_map_sg(rq->q, rq, ch->sg_table); nents = blk_rq_map_sg(rq->q, rq, ch->sg_table);
if (nents > rq->nr_segments) if (nents > rq->nr_segments)
printk("ide-dma: received %d segments, build %d\n", rq->nr_segments, nents); printk("ide-dma: received %d segments, build %d\n", rq->nr_segments, nents);
#endif #endif
if (args->command_type == IDE_DRIVE_TASK_RAW_WRITE) if (args->command_type == IDE_DRIVE_TASK_RAW_WRITE)
ch->sg_dma_direction = PCI_DMA_TODEVICE; ch->sg_dma_direction = PCI_DMA_TODEVICE;
else else
ch->sg_dma_direction = PCI_DMA_FROMDEVICE; ch->sg_dma_direction = PCI_DMA_FROMDEVICE;
if (sector_count > 128) { /*
* FIXME: This depends upon a hard coded page size!
*/
if (sector_count > 128) {
memset(&sg[nents], 0, sizeof(*sg));
sg[nents].page = virt_to_page(virt_addr);
sg[nents].offset = (unsigned long) virt_addr & ~PAGE_MASK;
sg[nents].length = 128 * SECTOR_SIZE;
++nents;
virt_addr = virt_addr + (128 * SECTOR_SIZE);
sector_count -= 128;
}
memset(&sg[nents], 0, sizeof(*sg)); memset(&sg[nents], 0, sizeof(*sg));
sg[nents].page = virt_to_page(virt_addr); sg[nents].page = virt_to_page(virt_addr);
sg[nents].offset = (unsigned long) virt_addr & ~PAGE_MASK; sg[nents].offset = (unsigned long) virt_addr & ~PAGE_MASK;
sg[nents].length = 128 * SECTOR_SIZE; sg[nents].length = sector_count * SECTOR_SIZE;
nents++; ++nents;
virt_addr = virt_addr + (128 * SECTOR_SIZE); } else {
sector_count -= 128; nents = blk_rq_map_sg(rq->q, rq, ch->sg_table);
}
memset(&sg[nents], 0, sizeof(*sg));
sg[nents].page = virt_to_page(virt_addr);
sg[nents].offset = (unsigned long) virt_addr & ~PAGE_MASK;
sg[nents].length = sector_count * SECTOR_SIZE;
nents++;
if (rq->q && nents > rq->nr_phys_segments)
printk("ide-dma: received %d phys segments, build %d\n", rq->nr_phys_segments, nents);
if (rq_data_dir(rq) == READ)
ch->sg_dma_direction = PCI_DMA_FROMDEVICE;
else
ch->sg_dma_direction = PCI_DMA_TODEVICE;
}
return pci_map_sg(ch->pci_dev, sg, nents, ch->sg_dma_direction); return pci_map_sg(ch->pci_dev, sg, nents, ch->sg_dma_direction);
} }
...@@ -295,11 +290,7 @@ int ide_build_dmatable (ide_drive_t *drive, ide_dma_action_t func) ...@@ -295,11 +290,7 @@ int ide_build_dmatable (ide_drive_t *drive, ide_dma_action_t func)
int i; int i;
struct scatterlist *sg; struct scatterlist *sg;
if (HWGROUP(drive)->rq->flags & REQ_DRIVE_ACB) { hwif->sg_nents = i = build_sglist(hwif, HWGROUP(drive)->rq);
hwif->sg_nents = i = raw_build_sglist(hwif, HWGROUP(drive)->rq);
} else {
hwif->sg_nents = i = ide_build_sglist(hwif, HWGROUP(drive)->rq);
}
if (!i) if (!i)
return 0; return 0;
...@@ -333,7 +324,7 @@ int ide_build_dmatable (ide_drive_t *drive, ide_dma_action_t func) ...@@ -333,7 +324,7 @@ int ide_build_dmatable (ide_drive_t *drive, ide_dma_action_t func)
if (is_trm290_chipset) if (is_trm290_chipset)
xcount = ((xcount >> 2) - 1) << 16; xcount = ((xcount >> 2) - 1) << 16;
if (xcount == 0x0000) { if (xcount == 0x0000) {
/* /*
* Most chipsets correctly interpret a length of * Most chipsets correctly interpret a length of
* 0x0000 as 64KB, but at least one (e.g. CS5530) * 0x0000 as 64KB, but at least one (e.g. CS5530)
* misinterprets it as zero (!). So here we break * misinterprets it as zero (!). So here we break
......
...@@ -434,150 +434,131 @@ static inline void probe_for_drive (ide_drive_t *drive) ...@@ -434,150 +434,131 @@ static inline void probe_for_drive (ide_drive_t *drive)
} }
} }
/*
* Calculate the region that this interface occupies,
* handling interfaces where the registers may not be
* ordered sanely. We deal with the CONTROL register
* separately.
*/
static int hwif_check_regions(struct ata_channel *hwif)
{
int region_errors = 0;
hwif->straight8 = 0;
region_errors = ide_check_region(hwif->io_ports[IDE_DATA_OFFSET], 1);
region_errors += ide_check_region(hwif->io_ports[IDE_ERROR_OFFSET], 1);
region_errors += ide_check_region(hwif->io_ports[IDE_NSECTOR_OFFSET], 1);
region_errors += ide_check_region(hwif->io_ports[IDE_SECTOR_OFFSET], 1);
region_errors += ide_check_region(hwif->io_ports[IDE_LCYL_OFFSET], 1);
region_errors += ide_check_region(hwif->io_ports[IDE_HCYL_OFFSET], 1);
region_errors += ide_check_region(hwif->io_ports[IDE_SELECT_OFFSET], 1);
region_errors += ide_check_region(hwif->io_ports[IDE_STATUS_OFFSET], 1);
if (hwif->io_ports[IDE_CONTROL_OFFSET])
region_errors += ide_check_region(hwif->io_ports[IDE_CONTROL_OFFSET], 1);
#if defined(CONFIG_AMIGA) || defined(CONFIG_MAC)
if (hwif->io_ports[IDE_IRQ_OFFSET])
region_errors += ide_check_region(hwif->io_ports[IDE_IRQ_OFFSET], 1);
#endif /* (CONFIG_AMIGA) || (CONFIG_MAC) */
/*
* If any errors are return, we drop the hwif interface.
*/
return(region_errors);
}
static void hwif_register(struct ata_channel *hwif)
{
/* Register this hardware interface within the global device tree.
*/
sprintf(hwif->dev.bus_id, "%04x", hwif->io_ports[IDE_DATA_OFFSET]);
sprintf(hwif->dev.name, "ide");
hwif->dev.driver_data = hwif;
#ifdef CONFIG_BLK_DEV_IDEPCI
if (hwif->pci_dev)
hwif->dev.parent = &hwif->pci_dev->dev;
else
#endif
hwif->dev.parent = NULL; /* Would like to do = &device_legacy */
device_register(&hwif->dev);
if (((unsigned long)hwif->io_ports[IDE_DATA_OFFSET] | 7) ==
((unsigned long)hwif->io_ports[IDE_STATUS_OFFSET])) {
ide_request_region(hwif->io_ports[IDE_DATA_OFFSET], 8, hwif->name);
hwif->straight8 = 1;
} else {
if (hwif->io_ports[IDE_DATA_OFFSET])
ide_request_region(hwif->io_ports[IDE_DATA_OFFSET], 1, hwif->name);
if (hwif->io_ports[IDE_ERROR_OFFSET])
ide_request_region(hwif->io_ports[IDE_ERROR_OFFSET], 1, hwif->name);
if (hwif->io_ports[IDE_NSECTOR_OFFSET])
ide_request_region(hwif->io_ports[IDE_NSECTOR_OFFSET], 1, hwif->name);
if (hwif->io_ports[IDE_SECTOR_OFFSET])
ide_request_region(hwif->io_ports[IDE_SECTOR_OFFSET], 1, hwif->name);
if (hwif->io_ports[IDE_LCYL_OFFSET])
ide_request_region(hwif->io_ports[IDE_LCYL_OFFSET], 1, hwif->name);
if (hwif->io_ports[IDE_HCYL_OFFSET])
ide_request_region(hwif->io_ports[IDE_HCYL_OFFSET], 1, hwif->name);
if (hwif->io_ports[IDE_SELECT_OFFSET])
ide_request_region(hwif->io_ports[IDE_SELECT_OFFSET], 1, hwif->name);
if (hwif->io_ports[IDE_STATUS_OFFSET])
ide_request_region(hwif->io_ports[IDE_STATUS_OFFSET], 1, hwif->name);
}
if (hwif->io_ports[IDE_CONTROL_OFFSET])
ide_request_region(hwif->io_ports[IDE_CONTROL_OFFSET], 1, hwif->name);
#if defined(CONFIG_AMIGA) || defined(CONFIG_MAC)
if (hwif->io_ports[IDE_IRQ_OFFSET])
ide_request_region(hwif->io_ports[IDE_IRQ_OFFSET], 1, hwif->name);
#endif
}
/* /*
* This routine only knows how to look for drive units 0 and 1 * This routine only knows how to look for drive units 0 and 1
* on an interface, so any setting of MAX_DRIVES > 2 won't work here. * on an interface, so any setting of MAX_DRIVES > 2 won't work here.
*/ */
static void probe_hwif(struct ata_channel *hwif) static void probe_hwif(struct ata_channel *ch)
{ {
unsigned int unit; unsigned int unit;
unsigned long flags; unsigned long flags;
if (hwif->noprobe) if (ch->noprobe)
return; return;
if ( ch->straight8 = 0;
#if CONFIG_BLK_DEV_PDC4030
(hwif->chipset != ide_pdc4030 || hwif->unit == 0) &&
#endif
hwif_check_regions(hwif)) {
int msgout = 0;
for (unit = 0; unit < MAX_DRIVES; ++unit) {
ide_drive_t *drive = &hwif->drives[unit];
if (drive->present) {
drive->present = 0;
printk("%s: ERROR, PORTS ALREADY IN USE\n", drive->name);
msgout = 1;
}
}
if (!msgout)
printk("%s: ports already in use, skipping probe\n", hwif->name);
return;
}
__save_flags(flags); /* local CPU only */ __save_flags(flags); /* local CPU only */
__sti(); /* local CPU only; needed for jiffies and irq probing */ __sti(); /* local CPU only; needed for jiffies and irq probing */
/* /*
* Second drive should only exist if first drive was found, * Check for the presence of a channel by probing for drives on it.
* but a lot of cdrom drives are configured as single slaves.
*/ */
for (unit = 0; unit < MAX_DRIVES; ++unit) { for (unit = 0; unit < MAX_DRIVES; ++unit) {
ide_drive_t *drive = &hwif->drives[unit]; struct ata_device *drive = &ch->drives[unit];
probe_for_drive (drive);
if (drive->present && !hwif->present) { probe_for_drive(drive);
hwif->present = 1;
hwif_register(hwif); if (drive->present && !ch->present) {
ch->present = 1;
} }
} }
if (hwif->io_ports[IDE_CONTROL_OFFSET] && hwif->reset) {
unsigned long timeout = jiffies + WAIT_WORSTCASE;
byte stat;
printk("%s: reset\n", hwif->name);
OUT_BYTE(12, hwif->io_ports[IDE_CONTROL_OFFSET]);
udelay(10);
OUT_BYTE(8, hwif->io_ports[IDE_CONTROL_OFFSET]);
do {
ide_delay_50ms();
stat = IN_BYTE(hwif->io_ports[IDE_STATUS_OFFSET]);
} while ((stat & BUSY_STAT) && 0 < (signed long)(timeout - jiffies));
if (ch->present) {
int error = 0;
if (((unsigned long)ch->io_ports[IDE_DATA_OFFSET] | 7) ==
((unsigned long)ch->io_ports[IDE_STATUS_OFFSET])) {
error += !request_region(ch->io_ports[IDE_DATA_OFFSET], 8, ch->name);
ch->straight8 = 1;
} else {
if (ch->io_ports[IDE_DATA_OFFSET])
error += !request_region(ch->io_ports[IDE_DATA_OFFSET], 1, ch->name);
if (ch->io_ports[IDE_ERROR_OFFSET])
error += !request_region(ch->io_ports[IDE_ERROR_OFFSET], 1, ch->name);
if (ch->io_ports[IDE_NSECTOR_OFFSET])
error += !request_region(ch->io_ports[IDE_NSECTOR_OFFSET], 1, ch->name);
if (ch->io_ports[IDE_SECTOR_OFFSET])
error += !request_region(ch->io_ports[IDE_SECTOR_OFFSET], 1, ch->name);
if (ch->io_ports[IDE_LCYL_OFFSET])
error += !request_region(ch->io_ports[IDE_LCYL_OFFSET], 1, ch->name);
if (ch->io_ports[IDE_HCYL_OFFSET])
error += !request_region(ch->io_ports[IDE_HCYL_OFFSET], 1, ch->name);
if (ch->io_ports[IDE_SELECT_OFFSET])
error += !request_region(ch->io_ports[IDE_SELECT_OFFSET], 1, ch->name);
if (ch->io_ports[IDE_STATUS_OFFSET])
error += !request_region(ch->io_ports[IDE_STATUS_OFFSET], 1, ch->name);
}
if (ch->io_ports[IDE_CONTROL_OFFSET])
error += !request_region(ch->io_ports[IDE_CONTROL_OFFSET], 1, ch->name);
#if defined(CONFIG_AMIGA) || defined(CONFIG_MAC)
if (ch->io_ports[IDE_IRQ_OFFSET])
error += !request_region(ch->io_ports[IDE_IRQ_OFFSET], 1, ch->name);
#endif
/* Some neccessary register area was already used. Skip this
* device.
*/
if (
#if CONFIG_BLK_DEV_PDC4030
(ch->chipset != ide_pdc4030 || ch->unit == 0) &&
#endif
error) {
/* FIXME: We should be dealing properly with partial IO
* region allocations here.
*/
ch->present = 0;
printk("%s: error: ports already in use!\n", ch->name);
}
}
if (ch->present) {
/* Register this hardware interface within the global device tree.
*/
sprintf(ch->dev.bus_id, "%04x", ch->io_ports[IDE_DATA_OFFSET]);
sprintf(ch->dev.name, "ide");
ch->dev.driver_data = ch;
#ifdef CONFIG_BLK_DEV_IDEPCI
if (ch->pci_dev)
ch->dev.parent = &ch->pci_dev->dev;
else
#endif
ch->dev.parent = NULL; /* Would like to do = &device_legacy */
device_register(&ch->dev);
if (ch->io_ports[IDE_CONTROL_OFFSET] && ch->reset) {
unsigned long timeout = jiffies + WAIT_WORSTCASE;
byte stat;
printk("%s: reset\n", ch->name);
OUT_BYTE(12, ch->io_ports[IDE_CONTROL_OFFSET]);
udelay(10);
OUT_BYTE(8, ch->io_ports[IDE_CONTROL_OFFSET]);
do {
ide_delay_50ms();
stat = IN_BYTE(ch->io_ports[IDE_STATUS_OFFSET]);
} while ((stat & BUSY_STAT) && 0 < (signed long)(timeout - jiffies));
}
} }
__restore_flags(flags); /* local CPU only */ __restore_flags(flags); /* local CPU only */
for (unit = 0; unit < MAX_DRIVES; ++unit) {
ide_drive_t *drive = &hwif->drives[unit];
if (drive->present && (drive->autotune == 1)) { /*
if (drive->channel->tuneproc != NULL) * Now setup the PIO transfer modes of the drives on this channel.
drive->channel->tuneproc(drive, 255); /* auto-tune PIO mode */ */
if (ch->present) {
for (unit = 0; unit < MAX_DRIVES; ++unit) {
struct ata_device *drive = &ch->drives[unit];
if (drive->present && (drive->autotune == 1)) {
if (drive->channel->tuneproc)
drive->channel->tuneproc(drive, 255); /* auto-tune PIO mode */
}
} }
} }
} }
...@@ -585,12 +566,12 @@ static void probe_hwif(struct ata_channel *hwif) ...@@ -585,12 +566,12 @@ static void probe_hwif(struct ata_channel *hwif)
/* /*
* init request queue * init request queue
*/ */
static void ide_init_queue(ide_drive_t *drive) static void init_device_queue(struct ata_device *drive)
{ {
request_queue_t *q = &drive->queue; request_queue_t *q = &drive->queue;
int max_sectors = 255; int max_sectors = 255;
q->queuedata = HWGROUP(drive); q->queuedata = drive->channel;
blk_init_queue(q, do_ide_request, &ide_lock); blk_init_queue(q, do_ide_request, &ide_lock);
blk_queue_segment_boundary(q, 0xffff); blk_queue_segment_boundary(q, 0xffff);
...@@ -637,23 +618,24 @@ static void save_match(struct ata_channel *hwif, struct ata_channel *new, ...@@ -637,23 +618,24 @@ static void save_match(struct ata_channel *hwif, struct ata_channel *new,
#endif #endif
/* /*
* This routine sets up the irq for an ide interface, and creates a new * This routine sets up the irq for an ide interface, and creates a new hwgroup
* hwgroup for the irq/hwif if none was previously assigned. * for the irq/channel if none was previously assigned.
* *
* Much of the code is for correctly detecting/handling irq sharing * Much of the code is for correctly detecting/handling irq sharing and irq
* and irq serialization situations. This is somewhat complex because * serialization situations. This is somewhat complex because it handles
* it handles static as well as dynamic (PCMCIA) IDE interfaces. * static as well as dynamic (PCMCIA) IDE interfaces.
* *
* The SA_INTERRUPT in sa_flags means ide_intr() is always entered with * The SA_INTERRUPT in sa_flags means ata_irq_request() is always entered with
* interrupts completely disabled. This can be bad for interrupt latency, * interrupts completely disabled. This can be bad for interrupt latency, but
* but anything else has led to problems on some machines. We re-enable * anything else has led to problems on some machines. We re-enable interrupts
* interrupts as much as we can safely do in most places. * as much as we can safely do in most places.
*/ */
static int init_irq(struct ata_channel *hwif) static int init_irq(struct ata_channel *ch)
{ {
unsigned long flags; unsigned long flags;
unsigned int index; int i;
ide_hwgroup_t *hwgroup, *new_hwgroup; ide_hwgroup_t *hwgroup;
ide_hwgroup_t *new_hwgroup;
struct ata_channel *match = NULL; struct ata_channel *match = NULL;
...@@ -662,26 +644,27 @@ static int init_irq(struct ata_channel *hwif) ...@@ -662,26 +644,27 @@ static int init_irq(struct ata_channel *hwif)
new_hwgroup = kmalloc(sizeof(ide_hwgroup_t),GFP_KERNEL); new_hwgroup = kmalloc(sizeof(ide_hwgroup_t),GFP_KERNEL);
spin_lock_irqsave(&ide_lock, flags); spin_lock_irqsave(&ide_lock, flags);
hwif->hwgroup = NULL; ch->hwgroup = NULL;
#if MAX_HWIFS > 1 #if MAX_HWIFS > 1
/* /*
* Group up with any other hwifs that share our irq(s). * Group up with any other channels that share our irq(s).
*/ */
for (index = 0; index < MAX_HWIFS; index++) { for (i = 0; i < MAX_HWIFS; ++i) {
struct ata_channel *h = &ide_hwifs[index]; struct ata_channel *h = &ide_hwifs[i];
if (h->hwgroup) { /* scan only initialized hwif's */
if (hwif->irq == h->irq) { if (h->hwgroup) { /* scan only initialized channels */
hwif->sharing_irq = h->sharing_irq = 1; if (ch->irq == h->irq) {
if (hwif->chipset != ide_pci || h->chipset != ide_pci) ch->sharing_irq = h->sharing_irq = 1;
save_match(hwif, h, &match); if (ch->chipset != ide_pci || h->chipset != ide_pci)
save_match(ch, h, &match);
/* FIXME: This is still confusing. What would /* FIXME: This is still confusing. What would
* happen if we match-ed two times? * happen if we match-ed two times?
*/ */
if (hwif->serialized || h->serialized) if (ch->serialized || h->serialized)
save_match(hwif, h, &match); save_match(ch, h, &match);
} }
} }
} }
...@@ -700,80 +683,78 @@ static int init_irq(struct ata_channel *hwif) ...@@ -700,80 +683,78 @@ static int init_irq(struct ata_channel *hwif)
return 1; return 1;
} }
memset(hwgroup, 0, sizeof(ide_hwgroup_t)); memset(hwgroup, 0, sizeof(ide_hwgroup_t));
hwgroup->hwif = hwif->next = hwif;
hwgroup->rq = NULL; hwgroup->rq = NULL;
hwgroup->handler = NULL; hwgroup->handler = NULL;
hwgroup->drive = NULL; hwgroup->drive = NULL;
hwgroup->flags = 0; hwgroup->flags = 0;
init_timer(&hwgroup->timer); init_timer(&hwgroup->timer);
hwgroup->timer.function = &ide_timer_expiry; hwgroup->timer.function = &ide_timer_expiry;
hwgroup->timer.data = (unsigned long) hwgroup; hwgroup->timer.data = (unsigned long) hwgroup;
} }
/* /*
* Allocate the irq, if not already obtained for another hwif * Allocate the irq, if not already obtained for another channel
*/ */
if (!match || match->irq != hwif->irq) { if (!match || match->irq != ch->irq) {
#ifdef CONFIG_IDEPCI_SHARE_IRQ #ifdef CONFIG_IDEPCI_SHARE_IRQ
int sa = IDE_CHIPSET_IS_PCI(hwif->chipset) ? SA_SHIRQ : SA_INTERRUPT; int sa = IDE_CHIPSET_IS_PCI(ch->chipset) ? SA_SHIRQ : SA_INTERRUPT;
#else #else
int sa = IDE_CHIPSET_IS_PCI(hwif->chipset) ? SA_INTERRUPT|SA_SHIRQ : SA_INTERRUPT; int sa = IDE_CHIPSET_IS_PCI(ch->chipset) ? SA_INTERRUPT|SA_SHIRQ : SA_INTERRUPT;
#endif #endif
if (hwif->io_ports[IDE_CONTROL_OFFSET]) if (ch->io_ports[IDE_CONTROL_OFFSET])
OUT_BYTE(0x08, hwif->io_ports[IDE_CONTROL_OFFSET]); /* clear nIEN */ OUT_BYTE(0x08, ch->io_ports[IDE_CONTROL_OFFSET]); /* clear nIEN */
if (ide_request_irq(hwif->irq, &ide_intr, sa, hwif->name, hwgroup)) { if (request_irq(ch->irq, &ata_irq_request, sa, ch->name, ch)) {
if (!match) if (!match)
kfree(hwgroup); kfree(hwgroup);
spin_unlock_irqrestore(&ide_lock, flags); spin_unlock_irqrestore(&ide_lock, flags);
return 1; return 1;
} }
} }
/* /*
* Everything is okay, so link us into the hwgroup. * Everything is okay.
*/ */
hwif->hwgroup = hwgroup; ch->hwgroup = hwgroup;
hwif->next = hwgroup->hwif->next;
hwgroup->hwif->next = hwif; for (i = 0; i < MAX_DRIVES; ++i) {
struct ata_device *drive = &ch->drives[i];
for (index = 0; index < MAX_DRIVES; ++index) {
ide_drive_t *drive = &hwif->drives[index];
if (!drive->present) if (!drive->present)
continue; continue;
if (!hwgroup->drive) if (!hwgroup->drive)
hwgroup->drive = drive; hwgroup->drive = drive;
drive->next = hwgroup->drive->next; drive->next = hwgroup->drive->next;
hwgroup->drive->next = drive; hwgroup->drive->next = drive;
ide_init_queue(drive);
} init_device_queue(drive);
if (!hwgroup->hwif) {
hwgroup->hwif = hwgroup->drive->channel;
#ifdef DEBUG
printk("%s : Adding missed hwif to hwgroup!!\n", hwif->name);
#endif
} }
spin_unlock_irqrestore(&ide_lock, flags); spin_unlock_irqrestore(&ide_lock, flags);
#if !defined(__mc68000__) && !defined(CONFIG_APUS) && !defined(__sparc__) #if !defined(__mc68000__) && !defined(CONFIG_APUS) && !defined(__sparc__)
printk("%s at 0x%03x-0x%03x,0x%03x on irq %d", hwif->name, printk("%s at 0x%03x-0x%03x,0x%03x on irq %d", ch->name,
hwif->io_ports[IDE_DATA_OFFSET], ch->io_ports[IDE_DATA_OFFSET],
hwif->io_ports[IDE_DATA_OFFSET]+7, ch->io_ports[IDE_DATA_OFFSET]+7,
hwif->io_ports[IDE_CONTROL_OFFSET], hwif->irq); ch->io_ports[IDE_CONTROL_OFFSET], ch->irq);
#elif defined(__sparc__) #elif defined(__sparc__)
printk("%s at 0x%03lx-0x%03lx,0x%03lx on irq %s", hwif->name, printk("%s at 0x%03lx-0x%03lx,0x%03lx on irq %s", ch->name,
hwif->io_ports[IDE_DATA_OFFSET], ch->io_ports[IDE_DATA_OFFSET],
hwif->io_ports[IDE_DATA_OFFSET]+7, ch->io_ports[IDE_DATA_OFFSET]+7,
hwif->io_ports[IDE_CONTROL_OFFSET], __irq_itoa(hwif->irq)); ch->io_ports[IDE_CONTROL_OFFSET], __irq_itoa(ch->irq));
#else #else
printk("%s at %p on irq 0x%08x", hwif->name, printk("%s at %p on irq 0x%08x", ch->name,
hwif->io_ports[IDE_DATA_OFFSET], hwif->irq); ch->io_ports[IDE_DATA_OFFSET], ch->irq);
#endif /* __mc68000__ && CONFIG_APUS */ #endif /* __mc68000__ && CONFIG_APUS */
if (match) if (match)
printk(" (%sed with %s)", printk(" (%sed with %s)",
hwif->sharing_irq ? "shar" : "serializ", match->name); ch->sharing_irq ? "shar" : "serializ", match->name);
printk("\n"); printk("\n");
return 0; return 0;
} }
...@@ -868,15 +849,15 @@ static int hwif_init(struct ata_channel *hwif) ...@@ -868,15 +849,15 @@ static int hwif_init(struct ata_channel *hwif)
printk("%s: CANNOT SHARE IRQ WITH OLD HARDDISK DRIVER (hd.c)\n", hwif->name); printk("%s: CANNOT SHARE IRQ WITH OLD HARDDISK DRIVER (hd.c)\n", hwif->name);
return (hwif->present = 0); return (hwif->present = 0);
} }
#endif /* CONFIG_BLK_DEV_HD */ #endif
hwif->present = 0; /* we set it back to 1 if all is ok below */ hwif->present = 0; /* we set it back to 1 if all is ok below */
if (devfs_register_blkdev (hwif->major, hwif->name, ide_fops)) { if (devfs_register_blkdev (hwif->major, hwif->name, ide_fops)) {
printk("%s: UNABLE TO GET MAJOR NUMBER %d\n", hwif->name, hwif->major); printk("%s: UNABLE TO GET MAJOR NUMBER %d\n", hwif->name, hwif->major);
return (hwif->present = 0); return (hwif->present = 0);
} }
if (init_irq(hwif)) { if (init_irq(hwif)) {
int i = hwif->irq; int i = hwif->irq;
/* /*
...@@ -897,7 +878,7 @@ static int hwif_init(struct ata_channel *hwif) ...@@ -897,7 +878,7 @@ static int hwif_init(struct ata_channel *hwif)
printk("%s: probed IRQ %d failed, using default.\n", printk("%s: probed IRQ %d failed, using default.\n",
hwif->name, hwif->irq); hwif->name, hwif->irq);
} }
init_gendisk(hwif); init_gendisk(hwif);
blk_dev[hwif->major].data = hwif; blk_dev[hwif->major].data = hwif;
blk_dev[hwif->major].queue = ide_get_queue; blk_dev[hwif->major].queue = ide_get_queue;
...@@ -910,7 +891,7 @@ int ideprobe_init (void) ...@@ -910,7 +891,7 @@ int ideprobe_init (void)
{ {
unsigned int index; unsigned int index;
int probe[MAX_HWIFS]; int probe[MAX_HWIFS];
memset(probe, 0, MAX_HWIFS * sizeof(int)); memset(probe, 0, MAX_HWIFS * sizeof(int));
for (index = 0; index < MAX_HWIFS; ++index) for (index = 0; index < MAX_HWIFS; ++index)
probe[index] = !ide_hwifs[index].present; probe[index] = !ide_hwifs[index].present;
......
...@@ -215,7 +215,7 @@ static int ide_scan_direction; /* THIS was formerly 2.2.x pci=reverse */ ...@@ -215,7 +215,7 @@ static int ide_scan_direction; /* THIS was formerly 2.2.x pci=reverse */
* This is used by the Atari code to obtain access to the IDE interrupt, * This is used by the Atari code to obtain access to the IDE interrupt,
* which is shared between several drivers. * which is shared between several drivers.
*/ */
static int ide_intr_lock; static int irq_lock;
#endif #endif
int noautodma = 0; int noautodma = 0;
...@@ -369,7 +369,7 @@ int drive_is_flashcard (ide_drive_t *drive) ...@@ -369,7 +369,7 @@ int drive_is_flashcard (ide_drive_t *drive)
return 0; /* no, it is not a flash memory card */ return 0; /* no, it is not a flash memory card */
} }
int __ide_end_request(ide_drive_t *drive, int uptodate, int nr_secs) int __ide_end_request(struct ata_device *drive, int uptodate, int nr_secs)
{ {
struct request *rq; struct request *rq;
unsigned long flags; unsigned long flags;
...@@ -388,12 +388,13 @@ int __ide_end_request(ide_drive_t *drive, int uptodate, int nr_secs) ...@@ -388,12 +388,13 @@ int __ide_end_request(ide_drive_t *drive, int uptodate, int nr_secs)
nr_secs = rq->hard_cur_sectors; nr_secs = rq->hard_cur_sectors;
/* /*
* decide whether to reenable DMA -- 3 is a random magic for now, * Decide whether to reenable DMA -- 3 is a random magic for now,
* if we DMA timeout more than 3 times, just stay in PIO * if we DMA timeout more than 3 times, just stay in PIO.
*/ */
if (drive->state == DMA_PIO_RETRY && drive->retry_pio <= 3) { if (drive->state == DMA_PIO_RETRY && drive->retry_pio <= 3) {
drive->state = 0; drive->state = 0;
HWGROUP(drive)->hwif->dmaproc(ide_dma_on, drive); drive->channel->dmaproc(ide_dma_on, drive);
} }
if (!end_that_request_first(rq, uptodate, nr_secs)) { if (!end_that_request_first(rq, uptodate, nr_secs)) {
...@@ -568,42 +569,45 @@ static ide_startstop_t reset_pollfunc (ide_drive_t *drive) ...@@ -568,42 +569,45 @@ static ide_startstop_t reset_pollfunc (ide_drive_t *drive)
{ {
ide_hwgroup_t *hwgroup = HWGROUP(drive); ide_hwgroup_t *hwgroup = HWGROUP(drive);
struct ata_channel *hwif = drive->channel; struct ata_channel *hwif = drive->channel;
byte tmp; u8 stat;
if (!OK_STAT(tmp=GET_STAT(), 0, BUSY_STAT)) { if (!OK_STAT(stat=GET_STAT(), 0, BUSY_STAT)) {
if (time_before(jiffies, hwgroup->poll_timeout)) { if (time_before(jiffies, hwgroup->poll_timeout)) {
BUG_ON(HWGROUP(drive)->handler); BUG_ON(HWGROUP(drive)->handler);
ide_set_handler (drive, &reset_pollfunc, HZ/20, NULL); ide_set_handler (drive, &reset_pollfunc, HZ/20, NULL);
return ide_started; /* continue polling */ return ide_started; /* continue polling */
} }
printk("%s: reset timed-out, status=0x%02x\n", hwif->name, tmp); printk("%s: reset timed-out, status=0x%02x\n", hwif->name, stat);
drive->failures++; drive->failures++;
} else { } else {
printk("%s: reset: ", hwif->name); printk("%s: reset: ", hwif->name);
if ((tmp = GET_ERR()) == 1) { if ((stat = GET_ERR()) == 1) {
printk("success\n"); printk("success\n");
drive->failures = 0; drive->failures = 0;
} else { } else {
drive->failures++; char *msg;
char *msg = "";
#if FANCY_STATUS_DUMPS #if FANCY_STATUS_DUMPS
u8 val;
static const char *messages[5] = {
" passed",
" formatter device",
" sector buffer",
" ECC circuitry",
" controlling MPU error"
};
printk("master:"); printk("master:");
switch (tmp & 0x7f) { val = stat & 0x7f;
case 1: msg = " passed"; if (val >= 1 && val <= 5)
break; msg = messages[val -1];
case 2: msg = " formatter device"; else
break; msg = "";
case 3: msg = " sector buffer"; if (stat & 0x80)
break;
case 4: msg = " ECC circuitry";
break;
case 5: msg = " controlling MPU error";
break;
}
if (tmp & 0x80)
printk("; slave:"); printk("; slave:");
#endif #endif
printk("%s error [%02x]\n", msg, tmp); printk("%s error [%02x]\n", msg, stat);
drive->failures++;
} }
} }
hwgroup->poll_timeout = 0; /* done polling */ hwgroup->poll_timeout = 0; /* done polling */
...@@ -611,20 +615,21 @@ static ide_startstop_t reset_pollfunc (ide_drive_t *drive) ...@@ -611,20 +615,21 @@ static ide_startstop_t reset_pollfunc (ide_drive_t *drive)
} }
/* /*
* do_reset1() attempts to recover a confused drive by resetting it. * Attempt to recover a confused drive by resetting it. Unfortunately,
* Unfortunately, resetting a disk drive actually resets all devices on * resetting a disk drive actually resets all devices on the same interface, so
* the same interface, so it can really be thought of as resetting the * it can really be thought of as resetting the interface rather than resetting
* interface rather than resetting the drive. * the drive.
* *
* ATAPI devices have their own reset mechanism which allows them to be * ATAPI devices have their own reset mechanism which allows them to be
* individually reset without clobbering other devices on the same interface. * individually reset without clobbering other devices on the same interface.
* *
* Unfortunately, the IDE interface does not generate an interrupt to let * Unfortunately, the IDE interface does not generate an interrupt to let us
* us know when the reset operation has finished, so we must poll for this. * know when the reset operation has finished, so we must poll for this.
* Equally poor, though, is the fact that this may a very long time to complete, * Equally poor, though, is the fact that this may a very long time to
* (up to 30 seconds worst case). So, instead of busy-waiting here for it, * complete, (up to 30 seconds worst case). So, instead of busy-waiting here
* we set a timer to poll at 50ms intervals. * for it, we set a timer to poll at 50ms intervals.
*/ */
static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi) static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi)
{ {
unsigned int unit; unsigned int unit;
...@@ -691,6 +696,7 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi) ...@@ -691,6 +696,7 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi)
#endif #endif
__restore_flags (flags); /* local CPU only */ __restore_flags (flags); /* local CPU only */
return ide_started; return ide_started;
} }
...@@ -765,30 +771,33 @@ byte ide_dump_status (ide_drive_t *drive, const char *msg, byte stat) ...@@ -765,30 +771,33 @@ byte ide_dump_status (ide_drive_t *drive, const char *msg, byte stat)
__save_flags (flags); /* local CPU only */ __save_flags (flags); /* local CPU only */
ide__sti(); /* local CPU only */ ide__sti(); /* local CPU only */
printk("%s: %s: status=0x%02x", drive->name, msg, stat); #if !(FANCY_STATUS_DUMPS)
#if FANCY_STATUS_DUMPS printk("%s: %s: status=0x%02x\n", drive->name, msg, stat);
#else
printk(" { "); printk(" { ");
if (stat & BUSY_STAT) {
printk("Busy "); char *msg = "";
else { if (stat & BUSY_STAT)
if (stat & READY_STAT) msg = "Busy";
printk("DriveReady "); else {
if (stat & WRERR_STAT) if (stat & READY_STAT)
printk("DeviceFault "); msg = "DriveReady";
if (stat & SEEK_STAT) if (stat & WRERR_STAT)
printk("SeekComplete "); msg = "DeviceFault";
if (stat & DRQ_STAT) if (stat & SEEK_STAT)
printk("DataRequest "); msg = "SeekComplete";
if (stat & ECC_STAT) if (stat & DRQ_STAT)
printk("CorrectedError "); msg = "DataRequest";
if (stat & INDEX_STAT) if (stat & ECC_STAT)
printk("Index "); msg = "CorrectedError";
if (stat & ERR_STAT) if (stat & INDEX_STAT)
printk("Error "); msg = "Index";
} if (stat & ERR_STAT)
printk("}"); msg = "Error";
}
}
printk("%s }\n", msg);
#endif #endif
printk("\n");
if ((stat & (BUSY_STAT|ERR_STAT)) == ERR_STAT) { if ((stat & (BUSY_STAT|ERR_STAT)) == ERR_STAT) {
err = GET_ERR(); err = GET_ERR();
printk("%s: %s: error=0x%02x", drive->name, msg, err); printk("%s: %s: error=0x%02x", drive->name, msg, err);
...@@ -1189,12 +1198,11 @@ void ide_stall_queue(ide_drive_t *drive, unsigned long timeout) ...@@ -1189,12 +1198,11 @@ void ide_stall_queue(ide_drive_t *drive, unsigned long timeout)
/* /*
* Select the next drive which will be serviced. * Select the next drive which will be serviced.
*/ */
static inline ide_drive_t *choose_drive(ide_hwgroup_t *hwgroup) static struct ata_device *choose_drive(struct ata_device *cur)
{ {
ide_drive_t *drive, *best; struct ata_device *drive = cur;
struct ata_device *best = NULL;
best = NULL;
drive = hwgroup->drive;
do { do {
if (!list_empty(&drive->queue.queue_head) if (!list_empty(&drive->queue.queue_head)
&& (!drive->PADAM_sleep || time_after_eq(drive->PADAM_sleep, jiffies))) { && (!drive->PADAM_sleep || time_after_eq(drive->PADAM_sleep, jiffies))) {
...@@ -1206,12 +1214,13 @@ static inline ide_drive_t *choose_drive(ide_hwgroup_t *hwgroup) ...@@ -1206,12 +1214,13 @@ static inline ide_drive_t *choose_drive(ide_hwgroup_t *hwgroup)
best = drive; best = drive;
} }
} }
} while ((drive = drive->next) != hwgroup->drive); drive = drive->next;
} while (drive != cur);
return best; return best;
} }
/* /*
* Issue a new request to a drive from hwgroup * Issue a new request to a drive from hwgroup.
* Caller must have already done spin_lock_irqsave(&ide_lock, ...) * Caller must have already done spin_lock_irqsave(&ide_lock, ...)
* *
* A hwgroup is a serialized group of IDE interfaces. Usually there is * A hwgroup is a serialized group of IDE interfaces. Usually there is
...@@ -1240,33 +1249,41 @@ static inline ide_drive_t *choose_drive(ide_hwgroup_t *hwgroup) ...@@ -1240,33 +1249,41 @@ static inline ide_drive_t *choose_drive(ide_hwgroup_t *hwgroup)
* will start the next request from the queue. If no more work remains, * will start the next request from the queue. If no more work remains,
* the driver will clear the hwgroup->flags IDE_BUSY flag and exit. * the driver will clear the hwgroup->flags IDE_BUSY flag and exit.
*/ */
static void ide_do_request(ide_hwgroup_t *hwgroup, int masked_irq) static void ide_do_request(struct ata_channel *ch, int masked_irq)
{ {
ide_drive_t *drive; ide_hwgroup_t *hwgroup = ch->hwgroup;
struct ata_channel *hwif; struct ata_device *drive;
ide_startstop_t startstop; ide_startstop_t startstop;
struct request *rq; struct request *rq;
ide_get_lock(&ide_intr_lock, ide_intr, hwgroup);/* for atari only: POSSIBLY BROKEN HERE(?) */ ide_get_lock(&irq_lock, ata_irq_request, hwgroup);/* for atari only: POSSIBLY BROKEN HERE(?) */
__cli(); /* necessary paranoia: ensure IRQs are masked on local CPU */ __cli(); /* necessary paranoia: ensure IRQs are masked on local CPU */
while (!test_and_set_bit(IDE_BUSY, &hwgroup->flags)) { while (!test_and_set_bit(IDE_BUSY, &hwgroup->flags)) {
drive = choose_drive(hwgroup); drive = choose_drive(hwgroup->drive);
if (drive == NULL) { if (drive == NULL) {
unsigned long sleep = 0; unsigned long sleep = 0;
hwgroup->rq = NULL; hwgroup->rq = NULL;
drive = hwgroup->drive; drive = hwgroup->drive;
do { do {
if (drive->PADAM_sleep && (!sleep || time_after(sleep, drive->PADAM_sleep))) if (drive->PADAM_sleep && (!sleep || time_after(sleep, drive->PADAM_sleep)))
sleep = drive->PADAM_sleep; sleep = drive->PADAM_sleep;
} while ((drive = drive->next) != hwgroup->drive);
drive = drive->next;
} while (drive!= hwgroup->drive);
if (sleep) { if (sleep) {
/* /*
* Take a short snooze, and then wake up this hwgroup again. * Take a short snooze, and then wake up this
* This gives other hwgroups on the same a chance to * hwgroup again. This gives other hwgroups on
* play fairly with us, just in case there are big differences * the same a chance to play fairly with us,
* in relative throughputs.. don't want to hog the cpu too much. * just in case there are big differences in
* relative throughputs.. don't want to hog the
* cpu too much.
*/ */
if (0 < (signed long)(jiffies + WAIT_MIN_SLEEP - sleep)) if (0 < (signed long)(jiffies + WAIT_MIN_SLEEP - sleep))
sleep = jiffies + WAIT_MIN_SLEEP; sleep = jiffies + WAIT_MIN_SLEEP;
...@@ -1278,22 +1295,23 @@ static void ide_do_request(ide_hwgroup_t *hwgroup, int masked_irq) ...@@ -1278,22 +1295,23 @@ static void ide_do_request(ide_hwgroup_t *hwgroup, int masked_irq)
mod_timer(&hwgroup->timer, sleep); mod_timer(&hwgroup->timer, sleep);
/* we purposely leave hwgroup busy while sleeping */ /* we purposely leave hwgroup busy while sleeping */
} else { } else {
/* Ugly, but how can we sleep for the lock otherwise? perhaps from tq_disk? */ /* Ugly, but how can we sleep for the lock
ide_release_lock(&ide_intr_lock);/* for atari only */ * otherwise? perhaps from tq_disk? */
ide_release_lock(&irq_lock);/* for atari only */
clear_bit(IDE_BUSY, &hwgroup->flags); clear_bit(IDE_BUSY, &hwgroup->flags);
} }
return; /* no more work for this hwgroup (for now) */ return; /* no more work for this hwgroup (for now) */
} }
hwif = drive->channel; ch = drive->channel;
if (hwgroup->hwif->sharing_irq && hwif != hwgroup->hwif && hwif->io_ports[IDE_CONTROL_OFFSET]) {
/* set nIEN for previous hwif */ if (hwgroup->drive->channel->sharing_irq && ch != hwgroup->drive->channel && ch->io_ports[IDE_CONTROL_OFFSET]) {
/* set nIEN for previous channel */
if (hwif->intrproc) if (ch->intrproc)
hwif->intrproc(drive); ch->intrproc(drive);
else else
OUT_BYTE((drive)->ctl|2, hwif->io_ports[IDE_CONTROL_OFFSET]); OUT_BYTE((drive)->ctl|2, ch->io_ports[IDE_CONTROL_OFFSET]);
} }
hwgroup->hwif = hwif;
hwgroup->drive = drive; hwgroup->drive = drive;
drive->PADAM_sleep = 0; drive->PADAM_sleep = 0;
drive->PADAM_service_start = jiffies; drive->PADAM_service_start = jiffies;
...@@ -1307,21 +1325,23 @@ static void ide_do_request(ide_hwgroup_t *hwgroup, int masked_irq) ...@@ -1307,21 +1325,23 @@ static void ide_do_request(ide_hwgroup_t *hwgroup, int masked_irq)
rq = hwgroup->rq = elv_next_request(&drive->queue); rq = hwgroup->rq = elv_next_request(&drive->queue);
/* /*
* Some systems have trouble with IDE IRQs arriving while * Some systems have trouble with IDE IRQs arriving while the
* the driver is still setting things up. So, here we disable * driver is still setting things up. So, here we disable the
* the IRQ used by this interface while the request is being started. * IRQ used by this interface while the request is being
* This may look bad at first, but pretty much the same thing * started. This may look bad at first, but pretty much the
* happens anyway when any interrupt comes in, IDE or otherwise * same thing happens anyway when any interrupt comes in, IDE
* -- the kernel masks the IRQ while it is being handled. * or otherwise -- the kernel masks the IRQ while it is being
* handled.
*/ */
if (masked_irq && hwif->irq != masked_irq)
disable_irq_nosync(hwif->irq); if (masked_irq && ch->irq != masked_irq)
disable_irq_nosync(ch->irq);
spin_unlock(&ide_lock); spin_unlock(&ide_lock);
ide__sti(); /* allow other IRQs while we start this request */ ide__sti(); /* allow other IRQs while we start this request */
startstop = start_request(drive, rq); startstop = start_request(drive, rq);
spin_lock_irq(&ide_lock); spin_lock_irq(&ide_lock);
if (masked_irq && hwif->irq != masked_irq) if (masked_irq && ch->irq != masked_irq)
enable_irq(hwif->irq); enable_irq(ch->irq);
if (startstop == ide_stopped) if (startstop == ide_stopped)
clear_bit(IDE_BUSY, &hwgroup->flags); clear_bit(IDE_BUSY, &hwgroup->flags);
} }
...@@ -1332,22 +1352,19 @@ static void ide_do_request(ide_hwgroup_t *hwgroup, int masked_irq) ...@@ -1332,22 +1352,19 @@ static void ide_do_request(ide_hwgroup_t *hwgroup, int masked_irq)
*/ */
request_queue_t *ide_get_queue(kdev_t dev) request_queue_t *ide_get_queue(kdev_t dev)
{ {
struct ata_channel *channel = (struct ata_channel *)blk_dev[major(dev)].data; struct ata_channel *ch = (struct ata_channel *)blk_dev[major(dev)].data;
/* FIXME: ALLERT: This discriminates between master and slave! */ /* FIXME: ALLERT: This discriminates between master and slave! */
return &channel->drives[DEVICE_NR(dev) & 1].queue; return &ch->drives[DEVICE_NR(dev) & 1].queue;
} }
/*
* Passes the stuff to ide_do_request
*/
void do_ide_request(request_queue_t *q) void do_ide_request(request_queue_t *q)
{ {
ide_do_request(q->queuedata, 0); ide_do_request(q->queuedata, 0);
} }
/* /*
* un-busy the hwgroup etc, and clear any pending DMA status. we want to * Un-busy the hwgroup etc, and clear any pending DMA status. we want to
* retry the current request in PIO mode instead of risking tossing it * retry the current request in PIO mode instead of risking tossing it
* all away * all away
*/ */
...@@ -1405,29 +1422,33 @@ void ide_timer_expiry(unsigned long data) ...@@ -1405,29 +1422,33 @@ void ide_timer_expiry(unsigned long data)
unsigned long wait; unsigned long wait;
/* /*
* a global lock protects timers etc -- shouldn't get contention * A global lock protects timers etc -- shouldn't get contention
* worth mentioning * worth mentioning.
*/ */
spin_lock_irqsave(&ide_lock, flags); spin_lock_irqsave(&ide_lock, flags);
del_timer(&hwgroup->timer); del_timer(&hwgroup->timer);
if ((handler = hwgroup->handler) == NULL) { if ((handler = hwgroup->handler) == NULL) {
/* /*
* Either a marginal timeout occurred * Either a marginal timeout occurred (got the interrupt just
* (got the interrupt just as timer expired), * as timer expired), or we were "sleeping" to give other
* or we were "sleeping" to give other devices a chance. * devices a chance. Either way, we don't really want to
* Either way, we don't really want to complain about anything. * complain about anything.
*/ */
if (test_and_clear_bit(IDE_SLEEP, &hwgroup->flags)) if (test_and_clear_bit(IDE_SLEEP, &hwgroup->flags))
clear_bit(IDE_BUSY, &hwgroup->flags); clear_bit(IDE_BUSY, &hwgroup->flags);
} else { } else {
ide_drive_t *drive = hwgroup->drive; struct ata_device *drive = hwgroup->drive;
if (!drive) { if (!drive) {
printk("ide_timer_expiry: hwgroup->drive was NULL\n"); printk("ide_timer_expiry: hwgroup->drive was NULL\n");
hwgroup->handler = NULL; hwgroup->handler = NULL;
} else { } else {
struct ata_channel *hwif; struct ata_channel *ch;
ide_startstop_t startstop; ide_startstop_t startstop;
/* paranoia */ /* paranoia */
if (!test_and_set_bit(IDE_BUSY, &hwgroup->flags)) if (!test_and_set_bit(IDE_BUSY, &hwgroup->flags))
printk("%s: ide_timer_expiry: hwgroup was not busy??\n", drive->name); printk("%s: ide_timer_expiry: hwgroup was not busy??\n", drive->name);
...@@ -1448,19 +1469,19 @@ void ide_timer_expiry(unsigned long data) ...@@ -1448,19 +1469,19 @@ void ide_timer_expiry(unsigned long data)
* mask the specific IRQ: * mask the specific IRQ:
*/ */
spin_unlock(&ide_lock); spin_unlock(&ide_lock);
hwif = drive->channel; ch = drive->channel;
#if DISABLE_IRQ_NOSYNC #if DISABLE_IRQ_NOSYNC
disable_irq_nosync(hwif->irq); disable_irq_nosync(ch->irq);
#else #else
disable_irq(hwif->irq); /* disable_irq_nosync ?? */ disable_irq(ch->irq); /* disable_irq_nosync ?? */
#endif #endif
__cli(); /* local CPU only, as if we were handling an interrupt */ __cli(); /* local CPU only, as if we were handling an interrupt */
if (hwgroup->poll_timeout != 0) { if (hwgroup->poll_timeout != 0) {
startstop = handler(drive); startstop = handler(drive);
} else if (drive_is_ready(drive)) { } else if (drive_is_ready(drive)) {
if (drive->waiting_for_dma) if (drive->waiting_for_dma)
(void) hwgroup->hwif->dmaproc(ide_dma_lostirq, drive); ch->dmaproc(ide_dma_lostirq, drive);
(void)ide_ack_intr(hwif); (void) ide_ack_intr(ch);
printk("%s: lost interrupt\n", drive->name); printk("%s: lost interrupt\n", drive->name);
startstop = handler(drive); startstop = handler(drive);
} else { } else {
...@@ -1470,15 +1491,17 @@ void ide_timer_expiry(unsigned long data) ...@@ -1470,15 +1491,17 @@ void ide_timer_expiry(unsigned long data)
} else } else
startstop = ide_error(drive, "irq timeout", GET_STAT()); startstop = ide_error(drive, "irq timeout", GET_STAT());
} }
set_recovery_timer(hwif); set_recovery_timer(ch);
drive->PADAM_service_time = jiffies - drive->PADAM_service_start; drive->PADAM_service_time = jiffies - drive->PADAM_service_start;
enable_irq(hwif->irq); enable_irq(ch->irq);
spin_lock_irq(&ide_lock); spin_lock_irq(&ide_lock);
if (startstop == ide_stopped) if (startstop == ide_stopped)
clear_bit(IDE_BUSY, &hwgroup->flags); clear_bit(IDE_BUSY, &hwgroup->flags);
} }
} }
ide_do_request(hwgroup, 0);
ide_do_request(hwgroup->drive->channel, 0);
spin_unlock_irqrestore(&ide_lock, flags); spin_unlock_irqrestore(&ide_lock, flags);
} }
...@@ -1505,55 +1528,58 @@ void ide_timer_expiry(unsigned long data) ...@@ -1505,55 +1528,58 @@ void ide_timer_expiry(unsigned long data)
* accidentally invoked as a result of any valid command completion interrupt. * accidentally invoked as a result of any valid command completion interrupt.
* *
*/ */
static void unexpected_intr(int irq, ide_hwgroup_t *hwgroup) static void unexpected_irq(int irq)
{ {
u8 stat; int i;
struct ata_channel *hwif = hwgroup->hwif;
/* for (i = 0; i < MAX_HWIFS; ++i) {
* handle the unexpected interrupt u8 stat;
*/ struct ata_channel *tmp = &ide_hwifs[i];
do {
if (hwif->irq != irq) if (!tmp->present)
continue; continue;
stat = IN_BYTE(hwif->io_ports[IDE_STATUS_OFFSET]); if (tmp->irq != irq)
continue;
stat = IN_BYTE(tmp->io_ports[IDE_STATUS_OFFSET]);
if (!OK_STAT(stat, READY_STAT, BAD_STAT)) { if (!OK_STAT(stat, READY_STAT, BAD_STAT)) {
/* Try to not flood the console with msgs */ /* Try to not flood the console with msgs */
static unsigned long last_msgtime; static unsigned long last_msgtime;
static int count; static int count;
++count; ++count;
if (time_after(jiffies, last_msgtime + HZ)) { if (time_after(jiffies, last_msgtime + HZ)) {
last_msgtime = jiffies; last_msgtime = jiffies;
printk("%s%s: unexpected interrupt, status=0x%02x, count=%d\n", printk("%s: unexpected interrupt, status=0x%02x, count=%d\n",
hwif->name, (hwif->next == hwgroup->hwif) ? "" : "(?)", stat, count); tmp->name, stat, count);
} }
} }
hwif = hwif->next; }
} while (hwif != hwgroup->hwif);
} }
/* /*
* entry point for all interrupts, caller does __cli() for us * entry point for all interrupts, caller does __cli() for us
*/ */
void ide_intr(int irq, void *dev_id, struct pt_regs *regs) void ata_irq_request(int irq, void *data, struct pt_regs *regs)
{ {
struct ata_channel *ch = data;
ide_hwgroup_t *hwgroup = ch->hwgroup;
unsigned long flags; unsigned long flags;
ide_hwgroup_t *hwgroup = (ide_hwgroup_t *)dev_id; struct ata_device *drive;
struct ata_channel *hwif;
ide_drive_t *drive;
ide_handler_t *handler; ide_handler_t *handler;
ide_startstop_t startstop; ide_startstop_t startstop;
spin_lock_irqsave(&ide_lock, flags); spin_lock_irqsave(&ide_lock, flags);
hwif = hwgroup->hwif;
if (!ide_ack_intr(hwif)) if (!ide_ack_intr(ch))
goto out_lock; goto out_lock;
if ((handler = hwgroup->handler) == NULL || hwgroup->poll_timeout != 0) { if ((handler = hwgroup->handler) == NULL || hwgroup->poll_timeout != 0) {
printk(KERN_INFO "ide: unexpected interrupt %d %d\n", hwif->unit, irq); #if 0
printk(KERN_INFO "ide: unexpected interrupt %d %d\n", ch->unit, irq);
#endif
/* /*
* Not expecting an interrupt from this drive. * Not expecting an interrupt from this drive.
* That means this could be: * That means this could be:
...@@ -1567,20 +1593,19 @@ void ide_intr(int irq, void *dev_id, struct pt_regs *regs) ...@@ -1567,20 +1593,19 @@ void ide_intr(int irq, void *dev_id, struct pt_regs *regs)
* so in that case we just ignore it and hope it goes away. * so in that case we just ignore it and hope it goes away.
*/ */
#ifdef CONFIG_BLK_DEV_IDEPCI #ifdef CONFIG_BLK_DEV_IDEPCI
if (hwif->pci_dev && !hwif->pci_dev->vendor) if (ch->pci_dev && !ch->pci_dev->vendor)
#endif #endif
{ {
/* /* Probably not a shared PCI interrupt, so we can
* Probably not a shared PCI interrupt, * safely try to do something about it:
* so we can safely try to do something about it:
*/ */
unexpected_intr(irq, hwgroup); unexpected_irq(irq);
#ifdef CONFIG_BLK_DEV_IDEPCI #ifdef CONFIG_BLK_DEV_IDEPCI
} else { } else {
/* /*
* Whack the status register, just in case we have a leftover pending IRQ. * Whack the status register, just in case we have a leftover pending IRQ.
*/ */
IN_BYTE(hwif->io_ports[IDE_STATUS_OFFSET]); IN_BYTE(ch->io_ports[IDE_STATUS_OFFSET]);
#endif #endif
} }
goto out_lock; goto out_lock;
...@@ -1604,12 +1629,12 @@ void ide_intr(int irq, void *dev_id, struct pt_regs *regs) ...@@ -1604,12 +1629,12 @@ void ide_intr(int irq, void *dev_id, struct pt_regs *regs)
} }
/* paranoia */ /* paranoia */
if (!test_and_set_bit(IDE_BUSY, &hwgroup->flags)) if (!test_and_set_bit(IDE_BUSY, &hwgroup->flags))
printk("%s: ide_intr: hwgroup was not busy??\n", drive->name); printk(KERN_ERR "%s: %s: hwgroup was not busy!?\n", drive->name, __FUNCTION__);
hwgroup->handler = NULL; hwgroup->handler = NULL;
del_timer(&hwgroup->timer); del_timer(&hwgroup->timer);
spin_unlock(&ide_lock); spin_unlock(&ide_lock);
if (hwif->unmask) if (ch->unmask)
ide__sti(); /* local CPU only */ ide__sti(); /* local CPU only */
startstop = handler(drive); /* service this interrupt, may set handler for next interrupt */ startstop = handler(drive); /* service this interrupt, may set handler for next interrupt */
spin_lock_irq(&ide_lock); spin_lock_irq(&ide_lock);
...@@ -1626,9 +1651,9 @@ void ide_intr(int irq, void *dev_id, struct pt_regs *regs) ...@@ -1626,9 +1651,9 @@ void ide_intr(int irq, void *dev_id, struct pt_regs *regs)
if (startstop == ide_stopped) { if (startstop == ide_stopped) {
if (hwgroup->handler == NULL) { /* paranoia */ if (hwgroup->handler == NULL) { /* paranoia */
clear_bit(IDE_BUSY, &hwgroup->flags); clear_bit(IDE_BUSY, &hwgroup->flags);
ide_do_request(hwgroup, hwif->irq); ide_do_request(ch, ch->irq);
} else { } else {
printk("%s: ide_intr: huh? expected NULL handler on exit\n", drive->name); printk("%s: %s: huh? expected NULL handler on exit\n", drive->name, __FUNCTION__);
} }
} }
...@@ -1721,7 +1746,7 @@ int ide_do_drive_cmd(ide_drive_t *drive, struct request *rq, ide_action_t action ...@@ -1721,7 +1746,7 @@ int ide_do_drive_cmd(ide_drive_t *drive, struct request *rq, ide_action_t action
queue_head = queue_head->next; queue_head = queue_head->next;
} }
q->elevator.elevator_add_req_fn(q, rq, queue_head); q->elevator.elevator_add_req_fn(q, rq, queue_head);
ide_do_request(hwgroup, 0); ide_do_request(drive->channel, 0);
spin_unlock_irqrestore(&ide_lock, flags); spin_unlock_irqrestore(&ide_lock, flags);
if (action == ide_wait) { if (action == ide_wait) {
wait_for_completion(&wait); /* wait for it to be serviced */ wait_for_completion(&wait); /* wait for it to be serviced */
...@@ -1905,37 +1930,58 @@ ide_proc_entry_t generic_subdriver_entries[] = { ...@@ -1905,37 +1930,58 @@ ide_proc_entry_t generic_subdriver_entries[] = {
* Note that we only release the standard ports, and do not even try to handle * Note that we only release the standard ports, and do not even try to handle
* any extra ports allocated for weird IDE interface chipsets. * any extra ports allocated for weird IDE interface chipsets.
*/ */
static void hwif_unregister(struct ata_channel *hwif) static void hwif_unregister(struct ata_channel *ch)
{ {
if (hwif->straight8) { int i;
ide_release_region(hwif->io_ports[IDE_DATA_OFFSET], 8); ide_hwgroup_t *hwgroup = ch->hwgroup;
/*
* Free the irq if we were the only channel using it.
*/
int n = 0;
for (i = 0; i < MAX_HWIFS; ++i) {
struct ata_channel *tmp = &ide_hwifs[i];
if (!tmp->present)
continue;
if (tmp->irq == ch->irq)
++n;
}
if (n == 1)
free_irq(ch->irq, hwgroup);
if (ch->straight8) {
release_region(ch->io_ports[IDE_DATA_OFFSET], 8);
} else { } else {
if (hwif->io_ports[IDE_DATA_OFFSET]) if (ch->io_ports[IDE_DATA_OFFSET])
ide_release_region(hwif->io_ports[IDE_DATA_OFFSET], 1); release_region(ch->io_ports[IDE_DATA_OFFSET], 1);
if (hwif->io_ports[IDE_ERROR_OFFSET]) if (ch->io_ports[IDE_ERROR_OFFSET])
ide_release_region(hwif->io_ports[IDE_ERROR_OFFSET], 1); release_region(ch->io_ports[IDE_ERROR_OFFSET], 1);
if (hwif->io_ports[IDE_NSECTOR_OFFSET]) if (ch->io_ports[IDE_NSECTOR_OFFSET])
ide_release_region(hwif->io_ports[IDE_NSECTOR_OFFSET], 1); release_region(ch->io_ports[IDE_NSECTOR_OFFSET], 1);
if (hwif->io_ports[IDE_SECTOR_OFFSET]) if (ch->io_ports[IDE_SECTOR_OFFSET])
ide_release_region(hwif->io_ports[IDE_SECTOR_OFFSET], 1); release_region(ch->io_ports[IDE_SECTOR_OFFSET], 1);
if (hwif->io_ports[IDE_LCYL_OFFSET]) if (ch->io_ports[IDE_LCYL_OFFSET])
ide_release_region(hwif->io_ports[IDE_LCYL_OFFSET], 1); release_region(ch->io_ports[IDE_LCYL_OFFSET], 1);
if (hwif->io_ports[IDE_HCYL_OFFSET]) if (ch->io_ports[IDE_HCYL_OFFSET])
ide_release_region(hwif->io_ports[IDE_HCYL_OFFSET], 1); release_region(ch->io_ports[IDE_HCYL_OFFSET], 1);
if (hwif->io_ports[IDE_SELECT_OFFSET]) if (ch->io_ports[IDE_SELECT_OFFSET])
ide_release_region(hwif->io_ports[IDE_SELECT_OFFSET], 1); release_region(ch->io_ports[IDE_SELECT_OFFSET], 1);
if (hwif->io_ports[IDE_STATUS_OFFSET]) if (ch->io_ports[IDE_STATUS_OFFSET])
ide_release_region(hwif->io_ports[IDE_STATUS_OFFSET], 1); release_region(ch->io_ports[IDE_STATUS_OFFSET], 1);
} }
if (hwif->io_ports[IDE_CONTROL_OFFSET]) if (ch->io_ports[IDE_CONTROL_OFFSET])
ide_release_region(hwif->io_ports[IDE_CONTROL_OFFSET], 1); release_region(ch->io_ports[IDE_CONTROL_OFFSET], 1);
#if defined(CONFIG_AMIGA) || defined(CONFIG_MAC) #if defined(CONFIG_AMIGA) || defined(CONFIG_MAC)
if (hwif->io_ports[IDE_IRQ_OFFSET]) if (ch->io_ports[IDE_IRQ_OFFSET])
ide_release_region(hwif->io_ports[IDE_IRQ_OFFSET], 1); release_region(ch->io_ports[IDE_IRQ_OFFSET], 1);
#endif #endif
} }
void ide_unregister(struct ata_channel *channel) void ide_unregister(struct ata_channel *ch)
{ {
struct gendisk *gd; struct gendisk *gd;
ide_drive_t *drive, *d; ide_drive_t *drive, *d;
...@@ -1944,13 +1990,14 @@ void ide_unregister(struct ata_channel *channel) ...@@ -1944,13 +1990,14 @@ void ide_unregister(struct ata_channel *channel)
unsigned long flags; unsigned long flags;
unsigned int p, minor; unsigned int p, minor;
struct ata_channel old_hwif; struct ata_channel old_hwif;
int n = 0;
spin_lock_irqsave(&ide_lock, flags); spin_lock_irqsave(&ide_lock, flags);
if (!channel->present) if (!ch->present)
goto abort; goto abort;
put_device(&channel->dev); put_device(&ch->dev);
for (unit = 0; unit < MAX_DRIVES; ++unit) { for (unit = 0; unit < MAX_DRIVES; ++unit) {
drive = &channel->drives[unit]; drive = &ch->drives[unit];
if (!drive->present) if (!drive->present)
continue; continue;
if (drive->busy || drive->usage) if (drive->busy || drive->usage)
...@@ -1963,55 +2010,40 @@ void ide_unregister(struct ata_channel *channel) ...@@ -1963,55 +2010,40 @@ void ide_unregister(struct ata_channel *channel)
ide_unregister_subdriver(drive); ide_unregister_subdriver(drive);
} }
} }
channel->present = 0; ch->present = 0;
/* /*
* All clear? Then blow away the buffer cache * All clear? Then blow away the buffer cache
*/ */
spin_unlock_irqrestore(&ide_lock, flags); spin_unlock_irqrestore(&ide_lock, flags);
for (unit = 0; unit < MAX_DRIVES; ++unit) { for (unit = 0; unit < MAX_DRIVES; ++unit) {
drive = &channel->drives[unit]; drive = &ch->drives[unit];
if (!drive->present) if (!drive->present)
continue; continue;
minor = drive->select.b.unit << PARTN_BITS; minor = drive->select.b.unit << PARTN_BITS;
for (p = 0; p < (1<<PARTN_BITS); ++p) { for (p = 0; p < (1<<PARTN_BITS); ++p) {
if (drive->part[p].nr_sects > 0) { if (drive->part[p].nr_sects > 0) {
kdev_t devp = mk_kdev(channel->major, minor+p); kdev_t devp = mk_kdev(ch->major, minor+p);
invalidate_device(devp, 0); invalidate_device(devp, 0);
} }
} }
} }
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
destroy_proc_ide_drives(channel); destroy_proc_ide_drives(ch);
#endif #endif
spin_lock_irqsave(&ide_lock, flags); spin_lock_irqsave(&ide_lock, flags);
hwgroup = channel->hwgroup;
/*
* free the irq if we were the only hwif using it
*/
{
struct ata_channel *g;
int irq_count = 0;
g = hwgroup->hwif; hwif_unregister(ch);
do {
if (g->irq == channel->irq)
++irq_count;
g = g->next;
} while (g != hwgroup->hwif);
if (irq_count == 1)
free_irq(channel->irq, hwgroup);
}
hwif_unregister(channel);
/* /*
* Remove us from the hwgroup, and free * Remove us from the hwgroup, and free the hwgroup if we were the only
* the hwgroup if we were the only member * member.
*/ */
hwgroup = ch->hwgroup;
d = hwgroup->drive; d = hwgroup->drive;
for (i = 0; i < MAX_DRIVES; ++i) { for (i = 0; i < MAX_DRIVES; ++i) {
drive = &channel->drives[i]; drive = &ch->drives[i];
if (drive->de) { if (drive->de) {
devfs_unregister (drive->de); devfs_unregister (drive->de);
drive->de = NULL; drive->de = NULL;
...@@ -2032,27 +2064,33 @@ void ide_unregister(struct ata_channel *channel) ...@@ -2032,27 +2064,33 @@ void ide_unregister(struct ata_channel *channel)
} }
if (d->present) if (d->present)
hwgroup->drive = d; hwgroup->drive = d;
while (hwgroup->hwif->next != channel)
hwgroup->hwif = hwgroup->hwif->next; n = 0;
hwgroup->hwif->next = channel->next; for (i = 0; i < MAX_HWIFS; ++i) {
if (hwgroup->hwif == channel) struct ata_channel *tmp = &ide_hwifs[i];
kfree(hwgroup);
else if (!tmp->present)
hwgroup->hwif = hwgroup->drive->channel; continue;
if (tmp->hwgroup == ch->hwgroup)
++n;
}
if (n == 1)
kfree(ch->hwgroup);
#if defined(CONFIG_BLK_DEV_IDEDMA) && !defined(CONFIG_DMA_NONPCI) #if defined(CONFIG_BLK_DEV_IDEDMA) && !defined(CONFIG_DMA_NONPCI)
ide_release_dma(channel); ide_release_dma(ch);
#endif #endif
/* /*
* Remove us from the kernel's knowledge. * Remove us from the kernel's knowledge.
*/ */
unregister_blkdev(channel->major, channel->name); unregister_blkdev(ch->major, ch->name);
kfree(blksize_size[channel->major]); kfree(blksize_size[ch->major]);
blk_dev[channel->major].data = NULL; blk_dev[ch->major].data = NULL;
blk_dev[channel->major].queue = NULL; blk_dev[ch->major].queue = NULL;
blk_clear(channel->major); blk_clear(ch->major);
gd = channel->gd; gd = ch->gd;
if (gd) { if (gd) {
del_gendisk(gd); del_gendisk(gd);
kfree(gd->sizes); kfree(gd->sizes);
...@@ -2062,7 +2100,7 @@ void ide_unregister(struct ata_channel *channel) ...@@ -2062,7 +2100,7 @@ void ide_unregister(struct ata_channel *channel)
if (gd->flags) if (gd->flags)
kfree (gd->flags); kfree (gd->flags);
kfree(gd); kfree(gd);
channel->gd = NULL; ch->gd = NULL;
} }
/* /*
...@@ -2070,42 +2108,41 @@ void ide_unregister(struct ata_channel *channel) ...@@ -2070,42 +2108,41 @@ void ide_unregister(struct ata_channel *channel)
* it. * it.
*/ */
old_hwif = *channel; old_hwif = *ch;
init_hwif_data(channel, channel->index); init_hwif_data(ch, ch->index);
channel->hwgroup = old_hwif.hwgroup; ch->hwgroup = old_hwif.hwgroup;
channel->tuneproc = old_hwif.tuneproc; ch->tuneproc = old_hwif.tuneproc;
channel->speedproc = old_hwif.speedproc; ch->speedproc = old_hwif.speedproc;
channel->selectproc = old_hwif.selectproc; ch->selectproc = old_hwif.selectproc;
channel->resetproc = old_hwif.resetproc; ch->resetproc = old_hwif.resetproc;
channel->intrproc = old_hwif.intrproc; ch->intrproc = old_hwif.intrproc;
channel->maskproc = old_hwif.maskproc; ch->maskproc = old_hwif.maskproc;
channel->quirkproc = old_hwif.quirkproc; ch->quirkproc = old_hwif.quirkproc;
channel->rwproc = old_hwif.rwproc; ch->rwproc = old_hwif.rwproc;
channel->ata_read = old_hwif.ata_read; ch->ata_read = old_hwif.ata_read;
channel->ata_write = old_hwif.ata_write; ch->ata_write = old_hwif.ata_write;
channel->atapi_read = old_hwif.atapi_read; ch->atapi_read = old_hwif.atapi_read;
channel->atapi_write = old_hwif.atapi_write; ch->atapi_write = old_hwif.atapi_write;
channel->dmaproc = old_hwif.dmaproc; ch->dmaproc = old_hwif.dmaproc;
channel->busproc = old_hwif.busproc; ch->busproc = old_hwif.busproc;
channel->bus_state = old_hwif.bus_state; ch->bus_state = old_hwif.bus_state;
channel->dma_base = old_hwif.dma_base; ch->dma_base = old_hwif.dma_base;
channel->dma_extra = old_hwif.dma_extra; ch->dma_extra = old_hwif.dma_extra;
channel->config_data = old_hwif.config_data; ch->config_data = old_hwif.config_data;
channel->select_data = old_hwif.select_data; ch->select_data = old_hwif.select_data;
channel->proc = old_hwif.proc; ch->proc = old_hwif.proc;
#ifndef CONFIG_BLK_DEV_IDECS #ifndef CONFIG_BLK_DEV_IDECS
channel->irq = old_hwif.irq; ch->irq = old_hwif.irq;
#endif #endif
channel->major = old_hwif.major; ch->major = old_hwif.major;
channel->chipset = old_hwif.chipset; ch->chipset = old_hwif.chipset;
channel->autodma = old_hwif.autodma; ch->autodma = old_hwif.autodma;
channel->udma_four = old_hwif.udma_four; ch->udma_four = old_hwif.udma_four;
#ifdef CONFIG_BLK_DEV_IDEPCI #ifdef CONFIG_BLK_DEV_IDEPCI
channel->pci_dev = old_hwif.pci_dev; ch->pci_dev = old_hwif.pci_dev;
#else
channel->pci_dev = NULL;
#endif #endif
channel->straight8 = old_hwif.straight8; ch->straight8 = old_hwif.straight8;
abort: abort:
spin_unlock_irqrestore(&ide_lock, flags); spin_unlock_irqrestore(&ide_lock, flags);
} }
...@@ -3249,7 +3286,6 @@ devfs_handle_t ide_devfs_handle; ...@@ -3249,7 +3286,6 @@ devfs_handle_t ide_devfs_handle;
EXPORT_SYMBOL(ide_lock); EXPORT_SYMBOL(ide_lock);
EXPORT_SYMBOL(drive_is_flashcard); EXPORT_SYMBOL(drive_is_flashcard);
EXPORT_SYMBOL(ide_timer_expiry); EXPORT_SYMBOL(ide_timer_expiry);
EXPORT_SYMBOL(ide_intr);
EXPORT_SYMBOL(ide_get_queue); EXPORT_SYMBOL(ide_get_queue);
EXPORT_SYMBOL(ide_add_generic_settings); EXPORT_SYMBOL(ide_add_generic_settings);
EXPORT_SYMBOL(do_ide_request); EXPORT_SYMBOL(do_ide_request);
...@@ -3427,7 +3463,7 @@ static int __init ata_module_init(void) ...@@ -3427,7 +3463,7 @@ static int __init ata_module_init(void)
#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
# if defined(__mc68000__) || defined(CONFIG_APUS) # if defined(__mc68000__) || defined(CONFIG_APUS)
if (ide_hwifs[0].io_ports[IDE_DATA_OFFSET]) { if (ide_hwifs[0].io_ports[IDE_DATA_OFFSET]) {
ide_get_lock(&ide_intr_lock, NULL, NULL);/* for atari only */ ide_get_lock(&irq_lock, NULL, NULL);/* for atari only */
disable_irq(ide_hwifs[0].irq); /* disable_irq_nosync ?? */ disable_irq(ide_hwifs[0].irq); /* disable_irq_nosync ?? */
// disable_irq_nosync(ide_hwifs[0].irq); // disable_irq_nosync(ide_hwifs[0].irq);
} }
...@@ -3438,7 +3474,7 @@ static int __init ata_module_init(void) ...@@ -3438,7 +3474,7 @@ static int __init ata_module_init(void)
# if defined(__mc68000__) || defined(CONFIG_APUS) # if defined(__mc68000__) || defined(CONFIG_APUS)
if (ide_hwifs[0].io_ports[IDE_DATA_OFFSET]) { if (ide_hwifs[0].io_ports[IDE_DATA_OFFSET]) {
enable_irq(ide_hwifs[0].irq); enable_irq(ide_hwifs[0].irq);
ide_release_lock(&ide_intr_lock);/* for atari only */ ide_release_lock(&irq_lock);/* for atari only */
} }
# endif # endif
#endif #endif
......
...@@ -283,15 +283,6 @@ void __init ide_init_trm290(struct ata_channel *hwif) ...@@ -283,15 +283,6 @@ void __init ide_init_trm290(struct ata_channel *hwif)
old = inw(hwif->config_data) & ~1; old = inw(hwif->config_data) & ~1;
if (old != compat && inb(old+2) == 0xff) { if (old != compat && inb(old+2) == 0xff) {
compat += (next_offset += 0x400); /* leave lower 10 bits untouched */ compat += (next_offset += 0x400); /* leave lower 10 bits untouched */
#if 1
if (ide_check_region(compat + 2, 1))
printk("Aieee %s: ide_check_region failure at 0x%04x\n", hwif->name, (compat + 2));
/*
* The region check is not needed; however.........
* Since this is the checked in ide-probe.c,
* this is only an assignment.
*/
#endif
hwif->io_ports[IDE_CONTROL_OFFSET] = compat + 2; hwif->io_ports[IDE_CONTROL_OFFSET] = compat + 2;
outw(compat|1, hwif->config_data); outw(compat|1, hwif->config_data);
printk("%s: control basereg workaround: old=0x%04x, new=0x%04x\n", hwif->name, old, inw(hwif->config_data) & ~1); printk("%s: control basereg workaround: old=0x%04x, new=0x%04x\n", hwif->name, old, inw(hwif->config_data) & ~1);
......
...@@ -105,12 +105,6 @@ typedef union { ...@@ -105,12 +105,6 @@ typedef union {
} b; } b;
} control_t; } control_t;
#define ide_request_irq(irq,hand,flg,dev,id) request_irq((irq),(hand),(flg),(dev),(id))
#define ide_free_irq(irq,dev_id) free_irq((irq), (dev_id))
#define ide_check_region(from,extent) check_region((from), (extent))
#define ide_request_region(from,extent,name) request_region((from), (extent), (name))
#define ide_release_region(from,extent) release_region((from), (extent))
/* /*
* The following are not needed for the non-m68k ports * The following are not needed for the non-m68k ports
*/ */
......
...@@ -44,12 +44,6 @@ typedef union { ...@@ -44,12 +44,6 @@ typedef union {
} b; } b;
} control_t; } control_t;
#define ide_request_irq(irq,hand,flg,dev,id) request_irq((irq),(hand),(flg),(dev),(id))
#define ide_free_irq(irq,dev_id) free_irq((irq), (dev_id))
#define ide_check_region(from,extent) check_region((from), (extent))
#define ide_request_region(from,extent,name) request_region((from), (extent), (name))
#define ide_release_region(from,extent) release_region((from), (extent))
/* /*
* The following are not needed for the non-m68k ports * The following are not needed for the non-m68k ports
*/ */
......
...@@ -119,20 +119,6 @@ typedef union { ...@@ -119,20 +119,6 @@ typedef union {
#undef SUPPORT_SLOW_DATA_PORTS #undef SUPPORT_SLOW_DATA_PORTS
#define SUPPORT_SLOW_DATA_PORTS 0 #define SUPPORT_SLOW_DATA_PORTS 0
/* request and free a normal interrupt */
#define ide_request_irq(irq,hand,flg,dev,id) request_irq((irq),(hand),(flg),(dev),(id))
#define ide_free_irq(irq,dev_id) free_irq((irq), (dev_id))
/* ide-probe.c calls ide_request_region and stuff on the io_ports defined,
* but since they are not actually memory-mapped in the ETRAX driver, we don't
* do anything.
*/
#define ide_check_region(from,extent) (0)
#define ide_request_region(from,extent,name) do {} while(0)
#define ide_release_region(from,extent) do {} while(0)
/* /*
* The following are not needed for the non-m68k ports * The following are not needed for the non-m68k ports
*/ */
......
...@@ -109,12 +109,6 @@ typedef union { ...@@ -109,12 +109,6 @@ typedef union {
} b; } b;
} control_t; } control_t;
#define ide_request_irq(irq,hand,flg,dev,id) request_irq((irq),(hand),(flg),(dev),(id))
#define ide_free_irq(irq,dev_id) free_irq((irq), (dev_id))
#define ide_check_region(from,extent) check_region((from), (extent))
#define ide_request_region(from,extent,name) request_region((from), (extent), (name))
#define ide_release_region(from,extent) release_region((from), (extent))
/* /*
* The following are not needed for the non-m68k ports * The following are not needed for the non-m68k ports
*/ */
......
...@@ -115,12 +115,6 @@ typedef union { ...@@ -115,12 +115,6 @@ typedef union {
} b; } b;
} control_t; } control_t;
#define ide_request_irq(irq,hand,flg,dev,id) request_irq((irq),(hand),(flg),(dev),(id))
#define ide_free_irq(irq,dev_id) free_irq((irq), (dev_id))
#define ide_check_region(from,extent) check_region((from), (extent))
#define ide_request_region(from,extent,name) request_region((from), (extent), (name))
#define ide_release_region(from,extent) release_region((from), (extent))
/* /*
* The following are not needed for the non-m68k ports * The following are not needed for the non-m68k ports
*/ */
......
...@@ -103,64 +103,6 @@ typedef union { ...@@ -103,64 +103,6 @@ typedef union {
} b; } b;
} control_t; } 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 #undef SUPPORT_SLOW_DATA_PORTS
#define SUPPORT_SLOW_DATA_PORTS 0 #define SUPPORT_SLOW_DATA_PORTS 0
......
...@@ -31,14 +31,6 @@ struct ide_ops { ...@@ -31,14 +31,6 @@ struct ide_ops {
ide_ioreg_t (*ide_default_io_base)(int index); ide_ioreg_t (*ide_default_io_base)(int index);
void (*ide_init_hwif_ports)(hw_regs_t *hw, ide_ioreg_t data_port, void (*ide_init_hwif_ports)(hw_regs_t *hw, ide_ioreg_t data_port,
ide_ioreg_t ctrl_port, int *irq); ide_ioreg_t ctrl_port, int *irq);
int (*ide_request_irq)(unsigned int irq, void (*handler)(int, void *,
struct pt_regs *), unsigned long flags,
const char *device, void *dev_id);
void (*ide_free_irq)(unsigned int irq, void *dev_id);
int (*ide_check_region) (ide_ioreg_t from, unsigned int extent);
void (*ide_request_region)(ide_ioreg_t from, unsigned int extent,
const char *name);
void (*ide_release_region)(ide_ioreg_t from, unsigned int extent);
}; };
extern struct ide_ops *ide_ops; extern struct ide_ops *ide_ops;
...@@ -112,34 +104,6 @@ typedef union { ...@@ -112,34 +104,6 @@ typedef union {
} b; } b;
} control_t; } 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)
{
return ide_ops->ide_request_irq(irq, handler, flags, device, dev_id);
}
static __inline__ void ide_free_irq(unsigned int irq, void *dev_id)
{
ide_ops->ide_free_irq(irq, dev_id);
}
static __inline__ int ide_check_region (ide_ioreg_t from, unsigned int extent)
{
return ide_ops->ide_check_region(from, extent);
}
static __inline__ void ide_request_region(ide_ioreg_t from,
unsigned int extent, const char *name)
{
ide_ops->ide_request_region(from, extent, name);
}
static __inline__ void ide_release_region(ide_ioreg_t from,
unsigned int extent)
{
ide_ops->ide_release_region(from, extent);
}
#undef SUPPORT_VLB_SYNC #undef SUPPORT_VLB_SYNC
#define SUPPORT_VLB_SYNC 0 #define SUPPORT_VLB_SYNC 0
......
...@@ -34,14 +34,6 @@ struct ide_ops { ...@@ -34,14 +34,6 @@ struct ide_ops {
ide_ioreg_t (*ide_default_io_base)(int index); ide_ioreg_t (*ide_default_io_base)(int index);
void (*ide_init_hwif_ports)(hw_regs_t *hw, ide_ioreg_t data_port, void (*ide_init_hwif_ports)(hw_regs_t *hw, ide_ioreg_t data_port,
ide_ioreg_t ctrl_port, int *irq); ide_ioreg_t ctrl_port, int *irq);
int (*ide_request_irq)(unsigned int irq, void (*handler)(int, void *,
struct pt_regs *), unsigned long flags,
const char *device, void *dev_id);
void (*ide_free_irq)(unsigned int irq, void *dev_id);
int (*ide_check_region) (ide_ioreg_t from, unsigned int extent);
void (*ide_request_region)(ide_ioreg_t from, unsigned int extent,
const char *name);
void (*ide_release_region)(ide_ioreg_t from, unsigned int extent);
}; };
extern struct ide_ops *ide_ops; extern struct ide_ops *ide_ops;
...@@ -99,35 +91,6 @@ typedef union { ...@@ -99,35 +91,6 @@ typedef union {
} b; } b;
} control_t; } 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)
{
return ide_ops->ide_request_irq(irq, handler, flags, device, dev_id);
}
static __inline__ void ide_free_irq(unsigned int irq, void *dev_id)
{
ide_ops->ide_free_irq(irq, dev_id);
}
static __inline__ int ide_check_region (ide_ioreg_t from, unsigned int extent)
{
return ide_ops->ide_check_region(from, extent);
}
static __inline__ void ide_request_region(ide_ioreg_t from,
unsigned int extent, const char *name)
{
ide_ops->ide_request_region(from, extent, name);
}
static __inline__ void ide_release_region(ide_ioreg_t from,
unsigned int extent)
{
ide_ops->ide_release_region(from, extent);
}
#if defined(CONFIG_SWAP_IO_SPACE) && defined(__MIPSEB__) #if defined(CONFIG_SWAP_IO_SPACE) && defined(__MIPSEB__)
#ifdef insl #ifdef insl
......
...@@ -104,12 +104,6 @@ typedef union { ...@@ -104,12 +104,6 @@ typedef union {
} b; } b;
} control_t; } control_t;
#define ide_request_irq(irq,hand,flg,dev,id) request_irq((irq),(hand),(flg),(dev),(id))
#define ide_free_irq(irq,dev_id) free_irq((irq), (dev_id))
#define ide_check_region(from,extent) check_region((from), (extent))
#define ide_request_region(from,extent,name) request_region((from), (extent), (name))
#define ide_release_region(from,extent) release_region((from), (extent))
/* /*
* The following are not needed for the non-m68k ports * The following are not needed for the non-m68k ports
*/ */
......
...@@ -35,12 +35,6 @@ extern void ppc_generic_ide_fix_driveid(struct hd_driveid *id); ...@@ -35,12 +35,6 @@ extern void ppc_generic_ide_fix_driveid(struct hd_driveid *id);
struct ide_machdep_calls { struct ide_machdep_calls {
int (*default_irq)(ide_ioreg_t base); int (*default_irq)(ide_ioreg_t base);
ide_ioreg_t (*default_io_base)(int index); ide_ioreg_t (*default_io_base)(int index);
int (*ide_check_region)(ide_ioreg_t from, unsigned int extent);
void (*ide_request_region)(ide_ioreg_t from,
unsigned int extent,
const char *name);
void (*ide_release_region)(ide_ioreg_t from,
unsigned int extent);
void (*ide_init_hwif)(hw_regs_t *hw, void (*ide_init_hwif)(hw_regs_t *hw,
ide_ioreg_t data_port, ide_ioreg_t data_port,
ide_ioreg_t ctrl_port, ide_ioreg_t ctrl_port,
...@@ -118,25 +112,6 @@ static __inline__ void ide_init_default_hwifs(void) ...@@ -118,25 +112,6 @@ static __inline__ void ide_init_default_hwifs(void)
#endif /* CONFIG_BLK_DEV_IDEPCI */ #endif /* CONFIG_BLK_DEV_IDEPCI */
} }
static __inline__ int ide_check_region (ide_ioreg_t from, unsigned int extent)
{
if (ppc_ide_md.ide_check_region)
return ppc_ide_md.ide_check_region(from, extent);
return 0;
}
static __inline__ void ide_request_region (ide_ioreg_t from, unsigned int extent, const char *name)
{
if (ppc_ide_md.ide_request_region)
ppc_ide_md.ide_request_region(from, extent, name);
}
static __inline__ void ide_release_region (ide_ioreg_t from, unsigned int extent)
{
if (ppc_ide_md.ide_release_region)
ppc_ide_md.ide_release_region(from, extent);
}
typedef union { typedef union {
unsigned all : 8; /* all of the bits together */ unsigned all : 8; /* all of the bits together */
struct { struct {
...@@ -160,14 +135,6 @@ typedef union { ...@@ -160,14 +135,6 @@ typedef union {
} b; } b;
} control_t; } control_t;
#if !defined(ide_request_irq)
#define ide_request_irq(irq,hand,flg,dev,id) request_irq((irq),(hand),(flg),(dev),(id))
#endif
#if !defined(ide_free_irq)
#define ide_free_irq(irq,dev_id) free_irq((irq), (dev_id))
#endif
/* /*
* The following are not needed for the non-m68k ports * The following are not needed for the non-m68k ports
* unless direct IDE on 8xx * unless direct IDE on 8xx
......
...@@ -77,12 +77,6 @@ typedef union { ...@@ -77,12 +77,6 @@ typedef union {
} b; } b;
} control_t; } control_t;
#define ide_request_irq(irq,hand,flg,dev,id) request_irq((irq),(hand),(flg),(dev),(id))
#define ide_free_irq(irq,dev_id) free_irq((irq), (dev_id))
#define ide_check_region(from,extent) check_region((from), (extent))
#define ide_request_region(from,extent,name) request_region((from), (extent), (name))
#define ide_release_region(from,extent) release_region((from), (extent))
/* /*
* The following are not needed for the non-m68k ports * The following are not needed for the non-m68k ports
*/ */
......
...@@ -40,12 +40,6 @@ typedef union { ...@@ -40,12 +40,6 @@ typedef union {
} b; } b;
} control_t; } control_t;
#define ide_request_irq(irq,hand,flg,dev,id) do {} while (0)
#define ide_free_irq(irq,dev_id) do {} while (0)
#define ide_check_region(from,extent) do {} while (0)
#define ide_request_region(from,extent,name) do {} while (0)
#define ide_release_region(from,extent) do {} while (0)
/* /*
* The following are not needed for the non-m68k ports * The following are not needed for the non-m68k ports
*/ */
......
...@@ -40,12 +40,6 @@ typedef union { ...@@ -40,12 +40,6 @@ typedef union {
} b; } b;
} control_t; } control_t;
#define ide_request_irq(irq,hand,flg,dev,id) do {} while (0)
#define ide_free_irq(irq,dev_id) do {} while (0)
#define ide_check_region(from,extent) do {} while (0)
#define ide_request_region(from,extent,name) do {} while (0)
#define ide_release_region(from,extent) do {} while (0)
/* /*
* The following are not needed for the non-m68k ports * The following are not needed for the non-m68k ports
*/ */
......
...@@ -130,12 +130,6 @@ typedef union { ...@@ -130,12 +130,6 @@ typedef union {
} b; } b;
} control_t; } control_t;
#define ide_request_irq(irq,hand,flg,dev,id) request_irq((irq),(hand),(flg),(dev),(id))
#define ide_free_irq(irq,dev_id) free_irq((irq), (dev_id))
#define ide_check_region(from,extent) check_region((from), (extent))
#define ide_request_region(from,extent,name) request_region((from), (extent), (name))
#define ide_release_region(from,extent) release_region((from), (extent))
/* /*
* The following are not needed for the non-m68k ports * The following are not needed for the non-m68k ports
*/ */
......
...@@ -96,33 +96,6 @@ typedef union { ...@@ -96,33 +96,6 @@ typedef union {
} b; } b;
} control_t; } control_t;
static __inline__ int ide_request_irq(unsigned int irq,
void (*handler)(int, void *, struct pt_regs *),
unsigned long flags, const char *name, void *devid)
{
return request_irq(irq, handler, SA_SHIRQ, name, devid);
}
static __inline__ void ide_free_irq(unsigned int irq, void *dev_id)
{
free_irq(irq, dev_id);
}
static __inline__ int ide_check_region(ide_ioreg_t base, unsigned int size)
{
/* We leave these empty because pcic.c calls sparc_alloc_io() */
return 0;
}
static __inline__ void ide_request_region(ide_ioreg_t base, unsigned int size,
const char *name)
{
}
static __inline__ void ide_release_region(ide_ioreg_t base, unsigned int size)
{
}
#undef SUPPORT_SLOW_DATA_PORTS #undef SUPPORT_SLOW_DATA_PORTS
#define SUPPORT_SLOW_DATA_PORTS 0 #define SUPPORT_SLOW_DATA_PORTS 0
......
...@@ -92,34 +92,6 @@ typedef union { ...@@ -92,34 +92,6 @@ typedef union {
} b; } b;
} control_t; } control_t;
static __inline__ int ide_request_irq(unsigned int irq,
void (*handler)(int, void *, struct pt_regs *),
unsigned long flags, const char *name, void *devid)
{
return request_irq(irq, handler, SA_SHIRQ, name, devid);
}
static __inline__ void ide_free_irq(unsigned int irq, void *dev_id)
{
free_irq(irq, dev_id);
}
static __inline__ int ide_check_region(ide_ioreg_t base, unsigned int size)
{
return check_region(base, size);
}
static __inline__ void ide_request_region(ide_ioreg_t base, unsigned int size,
const char *name)
{
request_region(base, size, name);
}
static __inline__ void ide_release_region(ide_ioreg_t base, unsigned int size)
{
release_region(base, size);
}
#undef SUPPORT_SLOW_DATA_PORTS #undef SUPPORT_SLOW_DATA_PORTS
#define SUPPORT_SLOW_DATA_PORTS 0 #define SUPPORT_SLOW_DATA_PORTS 0
......
...@@ -109,12 +109,6 @@ typedef union { ...@@ -109,12 +109,6 @@ typedef union {
} b; } b;
} control_t; } control_t;
#define ide_request_irq(irq,hand,flg,dev,id) request_irq((irq),(hand),(flg),(dev),(id))
#define ide_free_irq(irq,dev_id) free_irq((irq), (dev_id))
#define ide_check_region(from,extent) check_region((from), (extent))
#define ide_request_region(from,extent,name) request_region((from), (extent), (name))
#define ide_release_region(from,extent) release_region((from), (extent))
/* /*
* The following are not needed for the non-m68k ports * The following are not needed for the non-m68k ports
*/ */
......
...@@ -73,7 +73,6 @@ typedef unsigned char byte; /* used everywhere */ ...@@ -73,7 +73,6 @@ typedef unsigned char byte; /* used everywhere */
*/ */
#define DMA_PIO_RETRY 1 /* retrying in PIO */ #define DMA_PIO_RETRY 1 /* retrying in PIO */
#define HWIF(drive) ((drive)->channel)
#define HWGROUP(drive) (drive->channel->hwgroup) #define HWGROUP(drive) (drive->channel->hwgroup)
/* /*
...@@ -254,7 +253,7 @@ void ide_setup_ports(hw_regs_t *hw, ...@@ -254,7 +253,7 @@ void ide_setup_ports(hw_regs_t *hw,
#endif #endif
/* /*
* Now for the data we need to maintain per-drive: ide_drive_t * Device types - the nomenclature is analogous to SCSI code.
*/ */
#define ATA_DISK 0x20 #define ATA_DISK 0x20
...@@ -266,7 +265,10 @@ void ide_setup_ports(hw_regs_t *hw, ...@@ -266,7 +265,10 @@ void ide_setup_ports(hw_regs_t *hw,
#define ATA_NO_LUN 0x7f #define ATA_NO_LUN 0x7f
struct ide_settings_s; struct ide_settings_s;
/* structure describing an ATA/ATAPI device */
/*
* ATA/ATAPI device structure :
*/
typedef typedef
struct ata_device { struct ata_device {
struct ata_channel * channel; struct ata_channel * channel;
...@@ -401,7 +403,6 @@ struct ata_channel { ...@@ -401,7 +403,6 @@ struct ata_channel {
struct device dev; /* device handle */ struct device dev; /* device handle */
int unit; /* channel number */ int unit; /* channel number */
struct ata_channel *next; /* for linked-list in ide_hwgroup_t */
struct hwgroup_s *hwgroup; /* actually (ide_hwgroup_t *) */ struct hwgroup_s *hwgroup; /* actually (ide_hwgroup_t *) */
ide_ioreg_t io_ports[IDE_NR_PORTS]; /* task file registers */ ide_ioreg_t io_ports[IDE_NR_PORTS]; /* task file registers */
...@@ -516,17 +517,14 @@ typedef int (ide_expiry_t)(ide_drive_t *); ...@@ -516,17 +517,14 @@ typedef int (ide_expiry_t)(ide_drive_t *);
#define IDE_DMA 2 /* DMA in progress */ #define IDE_DMA 2 /* DMA in progress */
typedef struct hwgroup_s { typedef struct hwgroup_s {
ide_handler_t *handler;/* irq handler, if active */ ide_handler_t *handler; /* irq handler, if active */
unsigned long flags; /* BUSY, SLEEPING */ unsigned long flags; /* BUSY, SLEEPING */
ide_drive_t *drive; /* current drive */ struct ata_device *drive; /* current drive */
struct ata_channel *hwif; /* ptr to current hwif in linked-list */ struct request *rq; /* current request */
struct timer_list timer; /* failsafe timer */
struct request *rq; /* current request */ struct request wrq; /* local copy of current write rq */
unsigned long poll_timeout; /* timeout value during long polls */
struct timer_list timer; /* failsafe timer */ ide_expiry_t *expiry; /* queried upon timeouts */
struct request wrq; /* local copy of current write rq */
unsigned long poll_timeout; /* timeout value during long polls */
ide_expiry_t *expiry; /* queried upon timeouts */
} ide_hwgroup_t; } ide_hwgroup_t;
/* structure attached to the request for IDE_TASK_CMDS */ /* structure attached to the request for IDE_TASK_CMDS */
...@@ -827,7 +825,7 @@ extern int drive_is_flashcard(ide_drive_t *drive); ...@@ -827,7 +825,7 @@ extern int drive_is_flashcard(ide_drive_t *drive);
int ide_spin_wait_hwgroup (ide_drive_t *drive); int ide_spin_wait_hwgroup (ide_drive_t *drive);
void ide_timer_expiry (unsigned long data); void ide_timer_expiry (unsigned long data);
void ide_intr (int irq, void *dev_id, struct pt_regs *regs); extern void ata_irq_request(int irq, void *data, struct pt_regs *regs);
void do_ide_request (request_queue_t * q); void do_ide_request (request_queue_t * q);
void ide_init_subdrivers (void); void ide_init_subdrivers (void);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment