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;
void baboon_irq(int, void *, struct pt_regs *);
#if 0
extern int macide_ack_intr(struct ata_channel *);
#endif
/*
* Baboon initialization.
......
......@@ -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 = {
&no_ide_default_irq,
&no_ide_default_io_base,
&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
&no_ide_init_hwif_ports
};
......@@ -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;
}
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 = {
&std_ide_default_irq,
&std_ide_default_io_base,
&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
&std_ide_init_hwif_ports
};
......@@ -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 = {
&no_ide_default_irq,
&no_ide_default_io_base,
&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
&no_ide_init_hwif_ports
};
......@@ -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;
}
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 = {
&std_ide_default_irq,
&std_ide_default_io_base,
&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
&std_ide_init_hwif_ports
};
......@@ -256,29 +256,6 @@ ppc4xx_progress(char *s, unsigned short hex)
* IDE stuff.
* 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)
static void
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,
** m8xx_setup.c, prep_setup.c use
** defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
*/
#if defined (CONFIG_IDE)
ppc_ide_md.ide_request_region = ppc4xx_ide_request_region;
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)
#ifdef CONFIG_IDE
# if defined(CONFIG_BLK_DEV_IDEPCI)
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.ide_init_hwif = nonpci_ide_init_hwif_ports;
#endif
# endif
#endif
board_init();
......
......@@ -463,33 +463,6 @@ chrp_init2(void)
#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
* 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,
ppc_md.smp_ops = &chrp_smp_ops;
#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
* can be printed. -- Cort
......
......@@ -55,24 +55,6 @@ static unsigned int cpu_6xx[16] = {
#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
/* 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
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,
ppc_md.nvram_write_val = todc_direct_write_val;
#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;
#endif
}
......
......@@ -154,13 +154,6 @@ lopec_ide_default_irq(ide_ioreg_t base)
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
lopec_ide_default_io_base(int index)
{
......@@ -169,19 +162,6 @@ lopec_ide_default_io_base(int 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
lopec_ide_init_hwif_ports(hw_regs_t *hw, ide_ioreg_t data,
ide_ioreg_t ctl, int *irq)
......@@ -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)
ppc_ide_md.default_irq = lopec_ide_default_irq;
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;
#endif
}
......@@ -322,29 +322,6 @@ mcpn765_ide_default_io_base(int 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
mcpn765_ide_init_hwif_ports(hw_regs_t *hw, ide_ioreg_t data_port,
ide_ioreg_t ctrl_port, int *irq)
......@@ -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)
ppc_ide_md.default_irq = mcpn765_ide_default_irq;
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;
#endif
......
......@@ -199,27 +199,6 @@ menf1_map_io(void)
#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
/* 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
menf1_ide_init_hwif_ports (hw_regs_t *hw, ide_ioreg_t data_port,
ide_ioreg_t ctrl_port, int *irq)
......@@ -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)
ppc_ide_md.default_io_base = menf1_ide_default_io_base;
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;
#endif
}
......@@ -601,45 +601,6 @@ pmac_halt(void)
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.
*/
......@@ -796,12 +757,6 @@ pmac_init(unsigned long r3, unsigned long r4, unsigned long r5,
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
ppc_md.progress = pmac_progress;
#endif /* CONFIG_BOOTX_TEXT */
......
......@@ -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
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,
#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_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;
#endif
......
......@@ -733,27 +733,6 @@ prep_ide_default_io_base(int index)
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
#ifdef CONFIG_SMP
......@@ -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)
ppc_ide_md.default_irq = prep_ide_default_irq;
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
#ifdef CONFIG_VT
......
......@@ -85,8 +85,8 @@ extern bd_t m8xx_board_info;
/* for pcmcia sandisk */
#ifdef CONFIG_IDE
#define MAX_HWIFS 1
#define ide_request_irq(irq,hand,flg,dev,id) request_8xxirq((irq),(hand),(flg),(dev),(id))
# define MAX_HWIFS 1
# define request_irq(irq,hand,flg,dev,id) request_8xxirq((irq),(hand),(flg),(dev),(id))
#endif
#endif
......
......@@ -72,8 +72,8 @@ extern bd_t m8xx_board_info;
#define _IO_BASE_SIZE 0x1000
#ifdef CONFIG_IDE
#define MAX_HWIFS 1
#define ide_request_irq(irq,hand,flg,dev,id) request_8xxirq((irq),(hand),(flg),(dev),(id))
# define MAX_HWIFS 1
# define request_irq(irq,hand,flg,dev,id) request_8xxirq((irq),(hand),(flg),(dev),(id))
#endif
/* We don't use the 8259.
......
......@@ -491,29 +491,6 @@ sandpoint_ide_default_io_base(int 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
sandpoint_ide_init_hwif_ports(hw_regs_t *hw, ide_ioreg_t data_port,
ide_ioreg_t ctrl_port, int *irq)
......@@ -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)
ppc_ide_md.default_irq = sandpoint_ide_default_irq;
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;
#endif
......
......@@ -5,9 +5,7 @@
* May be copied or modified under the terms of the GNU General Public License
*
* Special Thanks to Mark for his Six years of work.
*/
/*
*
* This module provides support for the bus-master IDE DMA functions
* of various PCI chipsets, including the Intel PIIX (i82371FB for
* 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)
__ide_end_request(drive, 1, rq->nr_sectors);
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);
}
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: 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;
int nents = 0;
struct ata_taskfile *args = rq->special;
if (rq->flags & REQ_DRIVE_ACB) {
struct ata_taskfile *args = rq->special;
#if 1
unsigned char *virt_addr = rq->buffer;
int sector_count = rq->nr_sectors;
unsigned char *virt_addr = rq->buffer;
int sector_count = rq->nr_sectors;
#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)
printk("ide-dma: received %d segments, build %d\n", rq->nr_segments, nents);
if (nents > rq->nr_segments)
printk("ide-dma: received %d segments, build %d\n", rq->nr_segments, nents);
#endif
if (args->command_type == IDE_DRIVE_TASK_RAW_WRITE)
ch->sg_dma_direction = PCI_DMA_TODEVICE;
else
ch->sg_dma_direction = PCI_DMA_FROMDEVICE;
if (args->command_type == IDE_DRIVE_TASK_RAW_WRITE)
ch->sg_dma_direction = PCI_DMA_TODEVICE;
else
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));
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));
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++;
sg[nents].length = sector_count * SECTOR_SIZE;
++nents;
} else {
nents = blk_rq_map_sg(rq->q, rq, ch->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)
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);
}
......@@ -295,11 +290,7 @@ int ide_build_dmatable (ide_drive_t *drive, ide_dma_action_t func)
int i;
struct scatterlist *sg;
if (HWGROUP(drive)->rq->flags & REQ_DRIVE_ACB) {
hwif->sg_nents = i = raw_build_sglist(hwif, HWGROUP(drive)->rq);
} else {
hwif->sg_nents = i = ide_build_sglist(hwif, HWGROUP(drive)->rq);
}
hwif->sg_nents = i = build_sglist(hwif, HWGROUP(drive)->rq);
if (!i)
return 0;
......@@ -333,7 +324,7 @@ int ide_build_dmatable (ide_drive_t *drive, ide_dma_action_t func)
if (is_trm290_chipset)
xcount = ((xcount >> 2) - 1) << 16;
if (xcount == 0x0000) {
/*
/*
* Most chipsets correctly interpret a length of
* 0x0000 as 64KB, but at least one (e.g. CS5530)
* misinterprets it as zero (!). So here we break
......
......@@ -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
* 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 long flags;
if (hwif->noprobe)
if (ch->noprobe)
return;
if (
#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;
}
ch->straight8 = 0;
__save_flags(flags); /* local CPU only */
__sti(); /* local CPU only; needed for jiffies and irq probing */
/*
* Second drive should only exist if first drive was found,
* but a lot of cdrom drives are configured as single slaves.
* Check for the presence of a channel by probing for drives on it.
*/
for (unit = 0; unit < MAX_DRIVES; ++unit) {
ide_drive_t *drive = &hwif->drives[unit];
probe_for_drive (drive);
if (drive->present && !hwif->present) {
hwif->present = 1;
hwif_register(hwif);
struct ata_device *drive = &ch->drives[unit];
probe_for_drive(drive);
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 */
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)
drive->channel->tuneproc(drive, 255); /* auto-tune PIO mode */
/*
* Now setup the PIO transfer modes of the drives on this channel.
*/
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)
/*
* 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;
int max_sectors = 255;
q->queuedata = HWGROUP(drive);
q->queuedata = drive->channel;
blk_init_queue(q, do_ide_request, &ide_lock);
blk_queue_segment_boundary(q, 0xffff);
......@@ -637,23 +618,24 @@ static void save_match(struct ata_channel *hwif, struct ata_channel *new,
#endif
/*
* This routine sets up the irq for an ide interface, and creates a new
* hwgroup for the irq/hwif if none was previously assigned.
* This routine sets up the irq for an ide interface, and creates a new hwgroup
* for the irq/channel if none was previously assigned.
*
* Much of the code is for correctly detecting/handling irq sharing
* and irq serialization situations. This is somewhat complex because
* it handles static as well as dynamic (PCMCIA) IDE interfaces.
* Much of the code is for correctly detecting/handling irq sharing and irq
* serialization situations. This is somewhat complex because it handles
* static as well as dynamic (PCMCIA) IDE interfaces.
*
* The SA_INTERRUPT in sa_flags means ide_intr() is always entered with
* interrupts completely disabled. This can be bad for interrupt latency,
* but anything else has led to problems on some machines. We re-enable
* interrupts as much as we can safely do in most places.
* The SA_INTERRUPT in sa_flags means ata_irq_request() is always entered with
* interrupts completely disabled. This can be bad for interrupt latency, but
* anything else has led to problems on some machines. We re-enable interrupts
* 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 int index;
ide_hwgroup_t *hwgroup, *new_hwgroup;
int i;
ide_hwgroup_t *hwgroup;
ide_hwgroup_t *new_hwgroup;
struct ata_channel *match = NULL;
......@@ -662,26 +644,27 @@ static int init_irq(struct ata_channel *hwif)
new_hwgroup = kmalloc(sizeof(ide_hwgroup_t),GFP_KERNEL);
spin_lock_irqsave(&ide_lock, flags);
hwif->hwgroup = NULL;
ch->hwgroup = NULL;
#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++) {
struct ata_channel *h = &ide_hwifs[index];
if (h->hwgroup) { /* scan only initialized hwif's */
if (hwif->irq == h->irq) {
hwif->sharing_irq = h->sharing_irq = 1;
if (hwif->chipset != ide_pci || h->chipset != ide_pci)
save_match(hwif, h, &match);
for (i = 0; i < MAX_HWIFS; ++i) {
struct ata_channel *h = &ide_hwifs[i];
if (h->hwgroup) { /* scan only initialized channels */
if (ch->irq == h->irq) {
ch->sharing_irq = h->sharing_irq = 1;
if (ch->chipset != ide_pci || h->chipset != ide_pci)
save_match(ch, h, &match);
/* FIXME: This is still confusing. What would
* happen if we match-ed two times?
*/
if (hwif->serialized || h->serialized)
save_match(hwif, h, &match);
if (ch->serialized || h->serialized)
save_match(ch, h, &match);
}
}
}
......@@ -700,80 +683,78 @@ static int init_irq(struct ata_channel *hwif)
return 1;
}
memset(hwgroup, 0, sizeof(ide_hwgroup_t));
hwgroup->hwif = hwif->next = hwif;
hwgroup->rq = NULL;
hwgroup->handler = NULL;
hwgroup->drive = NULL;
hwgroup->flags = 0;
init_timer(&hwgroup->timer);
hwgroup->timer.function = &ide_timer_expiry;
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
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
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
if (hwif->io_ports[IDE_CONTROL_OFFSET])
OUT_BYTE(0x08, hwif->io_ports[IDE_CONTROL_OFFSET]); /* clear nIEN */
if (ch->io_ports[IDE_CONTROL_OFFSET])
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)
kfree(hwgroup);
spin_unlock_irqrestore(&ide_lock, flags);
return 1;
}
}
/*
* Everything is okay, so link us into the hwgroup.
* Everything is okay.
*/
hwif->hwgroup = hwgroup;
hwif->next = hwgroup->hwif->next;
hwgroup->hwif->next = hwif;
ch->hwgroup = hwgroup;
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)
continue;
if (!hwgroup->drive)
hwgroup->drive = drive;
drive->next = hwgroup->drive->next;
hwgroup->drive->next = drive;
ide_init_queue(drive);
}
if (!hwgroup->hwif) {
hwgroup->hwif = hwgroup->drive->channel;
#ifdef DEBUG
printk("%s : Adding missed hwif to hwgroup!!\n", hwif->name);
#endif
init_device_queue(drive);
}
spin_unlock_irqrestore(&ide_lock, flags);
#if !defined(__mc68000__) && !defined(CONFIG_APUS) && !defined(__sparc__)
printk("%s at 0x%03x-0x%03x,0x%03x on irq %d", hwif->name,
hwif->io_ports[IDE_DATA_OFFSET],
hwif->io_ports[IDE_DATA_OFFSET]+7,
hwif->io_ports[IDE_CONTROL_OFFSET], hwif->irq);
printk("%s at 0x%03x-0x%03x,0x%03x on irq %d", ch->name,
ch->io_ports[IDE_DATA_OFFSET],
ch->io_ports[IDE_DATA_OFFSET]+7,
ch->io_ports[IDE_CONTROL_OFFSET], ch->irq);
#elif defined(__sparc__)
printk("%s at 0x%03lx-0x%03lx,0x%03lx on irq %s", hwif->name,
hwif->io_ports[IDE_DATA_OFFSET],
hwif->io_ports[IDE_DATA_OFFSET]+7,
hwif->io_ports[IDE_CONTROL_OFFSET], __irq_itoa(hwif->irq));
printk("%s at 0x%03lx-0x%03lx,0x%03lx on irq %s", ch->name,
ch->io_ports[IDE_DATA_OFFSET],
ch->io_ports[IDE_DATA_OFFSET]+7,
ch->io_ports[IDE_CONTROL_OFFSET], __irq_itoa(ch->irq));
#else
printk("%s at %p on irq 0x%08x", hwif->name,
hwif->io_ports[IDE_DATA_OFFSET], hwif->irq);
printk("%s at %p on irq 0x%08x", ch->name,
ch->io_ports[IDE_DATA_OFFSET], ch->irq);
#endif /* __mc68000__ && CONFIG_APUS */
if (match)
printk(" (%sed with %s)",
hwif->sharing_irq ? "shar" : "serializ", match->name);
ch->sharing_irq ? "shar" : "serializ", match->name);
printk("\n");
return 0;
}
......@@ -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);
return (hwif->present = 0);
}
#endif /* CONFIG_BLK_DEV_HD */
#endif
hwif->present = 0; /* we set it back to 1 if all is ok below */
if (devfs_register_blkdev (hwif->major, hwif->name, ide_fops)) {
printk("%s: UNABLE TO GET MAJOR NUMBER %d\n", hwif->name, hwif->major);
return (hwif->present = 0);
}
if (init_irq(hwif)) {
int i = hwif->irq;
/*
......@@ -897,7 +878,7 @@ static int hwif_init(struct ata_channel *hwif)
printk("%s: probed IRQ %d failed, using default.\n",
hwif->name, hwif->irq);
}
init_gendisk(hwif);
blk_dev[hwif->major].data = hwif;
blk_dev[hwif->major].queue = ide_get_queue;
......@@ -910,7 +891,7 @@ int ideprobe_init (void)
{
unsigned int index;
int probe[MAX_HWIFS];
memset(probe, 0, MAX_HWIFS * sizeof(int));
for (index = 0; index < MAX_HWIFS; ++index)
probe[index] = !ide_hwifs[index].present;
......
......@@ -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,
* which is shared between several drivers.
*/
static int ide_intr_lock;
static int irq_lock;
#endif
int noautodma = 0;
......@@ -369,7 +369,7 @@ int drive_is_flashcard (ide_drive_t *drive)
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;
unsigned long flags;
......@@ -388,12 +388,13 @@ int __ide_end_request(ide_drive_t *drive, int uptodate, int nr_secs)
nr_secs = rq->hard_cur_sectors;
/*
* decide whether to reenable DMA -- 3 is a random magic for now,
* if we DMA timeout more than 3 times, just stay in PIO
* 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 (drive->state == DMA_PIO_RETRY && drive->retry_pio <= 3) {
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)) {
......@@ -568,42 +569,45 @@ static ide_startstop_t reset_pollfunc (ide_drive_t *drive)
{
ide_hwgroup_t *hwgroup = HWGROUP(drive);
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)) {
BUG_ON(HWGROUP(drive)->handler);
ide_set_handler (drive, &reset_pollfunc, HZ/20, NULL);
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++;
} else {
printk("%s: reset: ", hwif->name);
if ((tmp = GET_ERR()) == 1) {
if ((stat = GET_ERR()) == 1) {
printk("success\n");
drive->failures = 0;
} else {
drive->failures++;
char *msg = "";
char *msg;
#if FANCY_STATUS_DUMPS
u8 val;
static const char *messages[5] = {
" passed",
" formatter device",
" sector buffer",
" ECC circuitry",
" controlling MPU error"
};
printk("master:");
switch (tmp & 0x7f) {
case 1: msg = " passed";
break;
case 2: msg = " formatter device";
break;
case 3: msg = " sector buffer";
break;
case 4: msg = " ECC circuitry";
break;
case 5: msg = " controlling MPU error";
break;
}
if (tmp & 0x80)
val = stat & 0x7f;
if (val >= 1 && val <= 5)
msg = messages[val -1];
else
msg = "";
if (stat & 0x80)
printk("; slave:");
#endif
printk("%s error [%02x]\n", msg, tmp);
printk("%s error [%02x]\n", msg, stat);
drive->failures++;
}
}
hwgroup->poll_timeout = 0; /* done polling */
......@@ -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.
* Unfortunately, resetting a disk drive actually resets all devices on
* the same interface, so it can really be thought of as resetting the
* interface rather than resetting the drive.
* Attempt to recover a confused drive by resetting it. Unfortunately,
* resetting a disk drive actually resets all devices on the same interface, so
* it can really be thought of as resetting the interface rather than resetting
* the drive.
*
* ATAPI devices have their own reset mechanism which allows them to be
* individually reset without clobbering other devices on the same interface.
*
* Unfortunately, the IDE interface does not generate an interrupt to let
* us 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,
* (up to 30 seconds worst case). So, instead of busy-waiting here for it,
* we set a timer to poll at 50ms intervals.
* Unfortunately, the IDE interface does not generate an interrupt to let us
* 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, (up to 30 seconds worst case). So, instead of busy-waiting here
* 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)
{
unsigned int unit;
......@@ -691,6 +696,7 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi)
#endif
__restore_flags (flags); /* local CPU only */
return ide_started;
}
......@@ -765,30 +771,33 @@ byte ide_dump_status (ide_drive_t *drive, const char *msg, byte stat)
__save_flags (flags); /* 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(" { ");
if (stat & BUSY_STAT)
printk("Busy ");
else {
if (stat & READY_STAT)
printk("DriveReady ");
if (stat & WRERR_STAT)
printk("DeviceFault ");
if (stat & SEEK_STAT)
printk("SeekComplete ");
if (stat & DRQ_STAT)
printk("DataRequest ");
if (stat & ECC_STAT)
printk("CorrectedError ");
if (stat & INDEX_STAT)
printk("Index ");
if (stat & ERR_STAT)
printk("Error ");
}
printk("}");
{
char *msg = "";
if (stat & BUSY_STAT)
msg = "Busy";
else {
if (stat & READY_STAT)
msg = "DriveReady";
if (stat & WRERR_STAT)
msg = "DeviceFault";
if (stat & SEEK_STAT)
msg = "SeekComplete";
if (stat & DRQ_STAT)
msg = "DataRequest";
if (stat & ECC_STAT)
msg = "CorrectedError";
if (stat & INDEX_STAT)
msg = "Index";
if (stat & ERR_STAT)
msg = "Error";
}
}
printk("%s }\n", msg);
#endif
printk("\n");
if ((stat & (BUSY_STAT|ERR_STAT)) == ERR_STAT) {
err = GET_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)
/*
* 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 {
if (!list_empty(&drive->queue.queue_head)
&& (!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)
best = drive;
}
}
} while ((drive = drive->next) != hwgroup->drive);
drive = drive->next;
} while (drive != cur);
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, ...)
*
* 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)
* 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.
*/
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;
struct ata_channel *hwif;
ide_hwgroup_t *hwgroup = ch->hwgroup;
struct ata_device *drive;
ide_startstop_t startstop;
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 */
while (!test_and_set_bit(IDE_BUSY, &hwgroup->flags)) {
drive = choose_drive(hwgroup);
drive = choose_drive(hwgroup->drive);
if (drive == NULL) {
unsigned long sleep = 0;
hwgroup->rq = NULL;
drive = hwgroup->drive;
do {
if (drive->PADAM_sleep && (!sleep || time_after(sleep, drive->PADAM_sleep)))
sleep = drive->PADAM_sleep;
} while ((drive = drive->next) != hwgroup->drive);
drive = drive->next;
} while (drive!= hwgroup->drive);
if (sleep) {
/*
* Take a short snooze, and then wake up this hwgroup again.
* This gives other hwgroups on the same a chance to
* play fairly with us, just in case there are big differences
* in relative throughputs.. don't want to hog the cpu too much.
* Take a short snooze, and then wake up this
* hwgroup again. This gives other hwgroups on
* the same a chance to play fairly with us,
* 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))
sleep = jiffies + WAIT_MIN_SLEEP;
......@@ -1278,22 +1295,23 @@ static void ide_do_request(ide_hwgroup_t *hwgroup, int masked_irq)
mod_timer(&hwgroup->timer, sleep);
/* we purposely leave hwgroup busy while sleeping */
} else {
/* Ugly, but how can we sleep for the lock otherwise? perhaps from tq_disk? */
ide_release_lock(&ide_intr_lock);/* for atari only */
/* Ugly, but how can we sleep for the lock
* otherwise? perhaps from tq_disk? */
ide_release_lock(&irq_lock);/* for atari only */
clear_bit(IDE_BUSY, &hwgroup->flags);
}
return; /* no more work for this hwgroup (for now) */
}
hwif = drive->channel;
if (hwgroup->hwif->sharing_irq && hwif != hwgroup->hwif && hwif->io_ports[IDE_CONTROL_OFFSET]) {
/* set nIEN for previous hwif */
ch = drive->channel;
if (hwgroup->drive->channel->sharing_irq && ch != hwgroup->drive->channel && ch->io_ports[IDE_CONTROL_OFFSET]) {
/* set nIEN for previous channel */
if (hwif->intrproc)
hwif->intrproc(drive);
if (ch->intrproc)
ch->intrproc(drive);
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;
drive->PADAM_sleep = 0;
drive->PADAM_service_start = jiffies;
......@@ -1307,21 +1325,23 @@ static void ide_do_request(ide_hwgroup_t *hwgroup, int masked_irq)
rq = hwgroup->rq = elv_next_request(&drive->queue);
/*
* Some systems have trouble with IDE IRQs arriving while
* the driver is still setting things up. So, here we disable
* the IRQ used by this interface while the request is being started.
* This may look bad at first, but pretty much the same thing
* happens anyway when any interrupt comes in, IDE or otherwise
* -- the kernel masks the IRQ while it is being handled.
* Some systems have trouble with IDE IRQs arriving while the
* driver is still setting things up. So, here we disable the
* IRQ used by this interface while the request is being
* started. This may look bad at first, but pretty much the
* same thing happens anyway when any interrupt comes in, IDE
* 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);
ide__sti(); /* allow other IRQs while we start this request */
startstop = start_request(drive, rq);
spin_lock_irq(&ide_lock);
if (masked_irq && hwif->irq != masked_irq)
enable_irq(hwif->irq);
if (masked_irq && ch->irq != masked_irq)
enable_irq(ch->irq);
if (startstop == ide_stopped)
clear_bit(IDE_BUSY, &hwgroup->flags);
}
......@@ -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)
{
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! */
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)
{
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
* all away
*/
......@@ -1405,29 +1422,33 @@ void ide_timer_expiry(unsigned long data)
unsigned long wait;
/*
* a global lock protects timers etc -- shouldn't get contention
* worth mentioning
* A global lock protects timers etc -- shouldn't get contention
* worth mentioning.
*/
spin_lock_irqsave(&ide_lock, flags);
del_timer(&hwgroup->timer);
if ((handler = hwgroup->handler) == NULL) {
/*
* Either a marginal timeout occurred
* (got the interrupt just as timer expired),
* or we were "sleeping" to give other devices a chance.
* Either way, we don't really want to complain about anything.
* Either a marginal timeout occurred (got the interrupt just
* as timer expired), or we were "sleeping" to give other
* devices a chance. Either way, we don't really want to
* complain about anything.
*/
if (test_and_clear_bit(IDE_SLEEP, &hwgroup->flags))
clear_bit(IDE_BUSY, &hwgroup->flags);
} else {
ide_drive_t *drive = hwgroup->drive;
struct ata_device *drive = hwgroup->drive;
if (!drive) {
printk("ide_timer_expiry: hwgroup->drive was NULL\n");
hwgroup->handler = NULL;
} else {
struct ata_channel *hwif;
struct ata_channel *ch;
ide_startstop_t startstop;
/* paranoia */
if (!test_and_set_bit(IDE_BUSY, &hwgroup->flags))
printk("%s: ide_timer_expiry: hwgroup was not busy??\n", drive->name);
......@@ -1448,19 +1469,19 @@ void ide_timer_expiry(unsigned long data)
* mask the specific IRQ:
*/
spin_unlock(&ide_lock);
hwif = drive->channel;
ch = drive->channel;
#if DISABLE_IRQ_NOSYNC
disable_irq_nosync(hwif->irq);
disable_irq_nosync(ch->irq);
#else
disable_irq(hwif->irq); /* disable_irq_nosync ?? */
disable_irq(ch->irq); /* disable_irq_nosync ?? */
#endif
__cli(); /* local CPU only, as if we were handling an interrupt */
if (hwgroup->poll_timeout != 0) {
startstop = handler(drive);
} else if (drive_is_ready(drive)) {
if (drive->waiting_for_dma)
(void) hwgroup->hwif->dmaproc(ide_dma_lostirq, drive);
(void)ide_ack_intr(hwif);
ch->dmaproc(ide_dma_lostirq, drive);
(void) ide_ack_intr(ch);
printk("%s: lost interrupt\n", drive->name);
startstop = handler(drive);
} else {
......@@ -1470,15 +1491,17 @@ void ide_timer_expiry(unsigned long data)
} else
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;
enable_irq(hwif->irq);
enable_irq(ch->irq);
spin_lock_irq(&ide_lock);
if (startstop == ide_stopped)
clear_bit(IDE_BUSY, &hwgroup->flags);
}
}
ide_do_request(hwgroup, 0);
ide_do_request(hwgroup->drive->channel, 0);
spin_unlock_irqrestore(&ide_lock, flags);
}
......@@ -1505,55 +1528,58 @@ void ide_timer_expiry(unsigned long data)
* 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;
struct ata_channel *hwif = hwgroup->hwif;
int i;
/*
* handle the unexpected interrupt
*/
do {
if (hwif->irq != irq)
for (i = 0; i < MAX_HWIFS; ++i) {
u8 stat;
struct ata_channel *tmp = &ide_hwifs[i];
if (!tmp->present)
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)) {
/* Try to not flood the console with msgs */
static unsigned long last_msgtime;
static int count;
++count;
if (time_after(jiffies, last_msgtime + HZ)) {
last_msgtime = jiffies;
printk("%s%s: unexpected interrupt, status=0x%02x, count=%d\n",
hwif->name, (hwif->next == hwgroup->hwif) ? "" : "(?)", stat, count);
printk("%s: unexpected interrupt, status=0x%02x, count=%d\n",
tmp->name, stat, count);
}
}
hwif = hwif->next;
} while (hwif != hwgroup->hwif);
}
}
/*
* 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;
ide_hwgroup_t *hwgroup = (ide_hwgroup_t *)dev_id;
struct ata_channel *hwif;
ide_drive_t *drive;
struct ata_device *drive;
ide_handler_t *handler;
ide_startstop_t startstop;
spin_lock_irqsave(&ide_lock, flags);
hwif = hwgroup->hwif;
if (!ide_ack_intr(hwif))
if (!ide_ack_intr(ch))
goto out_lock;
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.
* That means this could be:
......@@ -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.
*/
#ifdef CONFIG_BLK_DEV_IDEPCI
if (hwif->pci_dev && !hwif->pci_dev->vendor)
if (ch->pci_dev && !ch->pci_dev->vendor)
#endif
{
/*
* Probably not a shared PCI interrupt,
* so we can safely try to do something about it:
/* Probably not a shared PCI interrupt, so we can
* safely try to do something about it:
*/
unexpected_intr(irq, hwgroup);
unexpected_irq(irq);
#ifdef CONFIG_BLK_DEV_IDEPCI
} else {
/*
* 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
}
goto out_lock;
......@@ -1604,12 +1629,12 @@ void ide_intr(int irq, void *dev_id, struct pt_regs *regs)
}
/* paranoia */
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;
del_timer(&hwgroup->timer);
spin_unlock(&ide_lock);
if (hwif->unmask)
if (ch->unmask)
ide__sti(); /* local CPU only */
startstop = handler(drive); /* service this interrupt, may set handler for next interrupt */
spin_lock_irq(&ide_lock);
......@@ -1626,9 +1651,9 @@ void ide_intr(int irq, void *dev_id, struct pt_regs *regs)
if (startstop == ide_stopped) {
if (hwgroup->handler == NULL) { /* paranoia */
clear_bit(IDE_BUSY, &hwgroup->flags);
ide_do_request(hwgroup, hwif->irq);
ide_do_request(ch, ch->irq);
} 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
queue_head = queue_head->next;
}
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);
if (action == ide_wait) {
wait_for_completion(&wait); /* wait for it to be serviced */
......@@ -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
* 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) {
ide_release_region(hwif->io_ports[IDE_DATA_OFFSET], 8);
int i;
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 {
if (hwif->io_ports[IDE_DATA_OFFSET])
ide_release_region(hwif->io_ports[IDE_DATA_OFFSET], 1);
if (hwif->io_ports[IDE_ERROR_OFFSET])
ide_release_region(hwif->io_ports[IDE_ERROR_OFFSET], 1);
if (hwif->io_ports[IDE_NSECTOR_OFFSET])
ide_release_region(hwif->io_ports[IDE_NSECTOR_OFFSET], 1);
if (hwif->io_ports[IDE_SECTOR_OFFSET])
ide_release_region(hwif->io_ports[IDE_SECTOR_OFFSET], 1);
if (hwif->io_ports[IDE_LCYL_OFFSET])
ide_release_region(hwif->io_ports[IDE_LCYL_OFFSET], 1);
if (hwif->io_ports[IDE_HCYL_OFFSET])
ide_release_region(hwif->io_ports[IDE_HCYL_OFFSET], 1);
if (hwif->io_ports[IDE_SELECT_OFFSET])
ide_release_region(hwif->io_ports[IDE_SELECT_OFFSET], 1);
if (hwif->io_ports[IDE_STATUS_OFFSET])
ide_release_region(hwif->io_ports[IDE_STATUS_OFFSET], 1);
}
if (hwif->io_ports[IDE_CONTROL_OFFSET])
ide_release_region(hwif->io_ports[IDE_CONTROL_OFFSET], 1);
if (ch->io_ports[IDE_DATA_OFFSET])
release_region(ch->io_ports[IDE_DATA_OFFSET], 1);
if (ch->io_ports[IDE_ERROR_OFFSET])
release_region(ch->io_ports[IDE_ERROR_OFFSET], 1);
if (ch->io_ports[IDE_NSECTOR_OFFSET])
release_region(ch->io_ports[IDE_NSECTOR_OFFSET], 1);
if (ch->io_ports[IDE_SECTOR_OFFSET])
release_region(ch->io_ports[IDE_SECTOR_OFFSET], 1);
if (ch->io_ports[IDE_LCYL_OFFSET])
release_region(ch->io_ports[IDE_LCYL_OFFSET], 1);
if (ch->io_ports[IDE_HCYL_OFFSET])
release_region(ch->io_ports[IDE_HCYL_OFFSET], 1);
if (ch->io_ports[IDE_SELECT_OFFSET])
release_region(ch->io_ports[IDE_SELECT_OFFSET], 1);
if (ch->io_ports[IDE_STATUS_OFFSET])
release_region(ch->io_ports[IDE_STATUS_OFFSET], 1);
}
if (ch->io_ports[IDE_CONTROL_OFFSET])
release_region(ch->io_ports[IDE_CONTROL_OFFSET], 1);
#if defined(CONFIG_AMIGA) || defined(CONFIG_MAC)
if (hwif->io_ports[IDE_IRQ_OFFSET])
ide_release_region(hwif->io_ports[IDE_IRQ_OFFSET], 1);
if (ch->io_ports[IDE_IRQ_OFFSET])
release_region(ch->io_ports[IDE_IRQ_OFFSET], 1);
#endif
}
void ide_unregister(struct ata_channel *channel)
void ide_unregister(struct ata_channel *ch)
{
struct gendisk *gd;
ide_drive_t *drive, *d;
......@@ -1944,13 +1990,14 @@ void ide_unregister(struct ata_channel *channel)
unsigned long flags;
unsigned int p, minor;
struct ata_channel old_hwif;
int n = 0;
spin_lock_irqsave(&ide_lock, flags);
if (!channel->present)
if (!ch->present)
goto abort;
put_device(&channel->dev);
put_device(&ch->dev);
for (unit = 0; unit < MAX_DRIVES; ++unit) {
drive = &channel->drives[unit];
drive = &ch->drives[unit];
if (!drive->present)
continue;
if (drive->busy || drive->usage)
......@@ -1963,55 +2010,40 @@ void ide_unregister(struct ata_channel *channel)
ide_unregister_subdriver(drive);
}
}
channel->present = 0;
ch->present = 0;
/*
* All clear? Then blow away the buffer cache
*/
spin_unlock_irqrestore(&ide_lock, flags);
for (unit = 0; unit < MAX_DRIVES; ++unit) {
drive = &channel->drives[unit];
drive = &ch->drives[unit];
if (!drive->present)
continue;
minor = drive->select.b.unit << PARTN_BITS;
for (p = 0; p < (1<<PARTN_BITS); ++p) {
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);
}
}
}
#ifdef CONFIG_PROC_FS
destroy_proc_ide_drives(channel);
destroy_proc_ide_drives(ch);
#endif
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;
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);
hwif_unregister(ch);
/*
* Remove us from the hwgroup, and free
* the hwgroup if we were the only member
* Remove us from the hwgroup, and free the hwgroup if we were the only
* member.
*/
hwgroup = ch->hwgroup;
d = hwgroup->drive;
for (i = 0; i < MAX_DRIVES; ++i) {
drive = &channel->drives[i];
drive = &ch->drives[i];
if (drive->de) {
devfs_unregister (drive->de);
drive->de = NULL;
......@@ -2032,27 +2064,33 @@ void ide_unregister(struct ata_channel *channel)
}
if (d->present)
hwgroup->drive = d;
while (hwgroup->hwif->next != channel)
hwgroup->hwif = hwgroup->hwif->next;
hwgroup->hwif->next = channel->next;
if (hwgroup->hwif == channel)
kfree(hwgroup);
else
hwgroup->hwif = hwgroup->drive->channel;
n = 0;
for (i = 0; i < MAX_HWIFS; ++i) {
struct ata_channel *tmp = &ide_hwifs[i];
if (!tmp->present)
continue;
if (tmp->hwgroup == ch->hwgroup)
++n;
}
if (n == 1)
kfree(ch->hwgroup);
#if defined(CONFIG_BLK_DEV_IDEDMA) && !defined(CONFIG_DMA_NONPCI)
ide_release_dma(channel);
ide_release_dma(ch);
#endif
/*
* Remove us from the kernel's knowledge.
*/
unregister_blkdev(channel->major, channel->name);
kfree(blksize_size[channel->major]);
blk_dev[channel->major].data = NULL;
blk_dev[channel->major].queue = NULL;
blk_clear(channel->major);
gd = channel->gd;
unregister_blkdev(ch->major, ch->name);
kfree(blksize_size[ch->major]);
blk_dev[ch->major].data = NULL;
blk_dev[ch->major].queue = NULL;
blk_clear(ch->major);
gd = ch->gd;
if (gd) {
del_gendisk(gd);
kfree(gd->sizes);
......@@ -2062,7 +2100,7 @@ void ide_unregister(struct ata_channel *channel)
if (gd->flags)
kfree (gd->flags);
kfree(gd);
channel->gd = NULL;
ch->gd = NULL;
}
/*
......@@ -2070,42 +2108,41 @@ void ide_unregister(struct ata_channel *channel)
* it.
*/
old_hwif = *channel;
init_hwif_data(channel, channel->index);
channel->hwgroup = old_hwif.hwgroup;
channel->tuneproc = old_hwif.tuneproc;
channel->speedproc = old_hwif.speedproc;
channel->selectproc = old_hwif.selectproc;
channel->resetproc = old_hwif.resetproc;
channel->intrproc = old_hwif.intrproc;
channel->maskproc = old_hwif.maskproc;
channel->quirkproc = old_hwif.quirkproc;
channel->rwproc = old_hwif.rwproc;
channel->ata_read = old_hwif.ata_read;
channel->ata_write = old_hwif.ata_write;
channel->atapi_read = old_hwif.atapi_read;
channel->atapi_write = old_hwif.atapi_write;
channel->dmaproc = old_hwif.dmaproc;
channel->busproc = old_hwif.busproc;
channel->bus_state = old_hwif.bus_state;
channel->dma_base = old_hwif.dma_base;
channel->dma_extra = old_hwif.dma_extra;
channel->config_data = old_hwif.config_data;
channel->select_data = old_hwif.select_data;
channel->proc = old_hwif.proc;
old_hwif = *ch;
init_hwif_data(ch, ch->index);
ch->hwgroup = old_hwif.hwgroup;
ch->tuneproc = old_hwif.tuneproc;
ch->speedproc = old_hwif.speedproc;
ch->selectproc = old_hwif.selectproc;
ch->resetproc = old_hwif.resetproc;
ch->intrproc = old_hwif.intrproc;
ch->maskproc = old_hwif.maskproc;
ch->quirkproc = old_hwif.quirkproc;
ch->rwproc = old_hwif.rwproc;
ch->ata_read = old_hwif.ata_read;
ch->ata_write = old_hwif.ata_write;
ch->atapi_read = old_hwif.atapi_read;
ch->atapi_write = old_hwif.atapi_write;
ch->dmaproc = old_hwif.dmaproc;
ch->busproc = old_hwif.busproc;
ch->bus_state = old_hwif.bus_state;
ch->dma_base = old_hwif.dma_base;
ch->dma_extra = old_hwif.dma_extra;
ch->config_data = old_hwif.config_data;
ch->select_data = old_hwif.select_data;
ch->proc = old_hwif.proc;
#ifndef CONFIG_BLK_DEV_IDECS
channel->irq = old_hwif.irq;
ch->irq = old_hwif.irq;
#endif
channel->major = old_hwif.major;
channel->chipset = old_hwif.chipset;
channel->autodma = old_hwif.autodma;
channel->udma_four = old_hwif.udma_four;
ch->major = old_hwif.major;
ch->chipset = old_hwif.chipset;
ch->autodma = old_hwif.autodma;
ch->udma_four = old_hwif.udma_four;
#ifdef CONFIG_BLK_DEV_IDEPCI
channel->pci_dev = old_hwif.pci_dev;
#else
channel->pci_dev = NULL;
ch->pci_dev = old_hwif.pci_dev;
#endif
channel->straight8 = old_hwif.straight8;
ch->straight8 = old_hwif.straight8;
abort:
spin_unlock_irqrestore(&ide_lock, flags);
}
......@@ -3249,7 +3286,6 @@ devfs_handle_t ide_devfs_handle;
EXPORT_SYMBOL(ide_lock);
EXPORT_SYMBOL(drive_is_flashcard);
EXPORT_SYMBOL(ide_timer_expiry);
EXPORT_SYMBOL(ide_intr);
EXPORT_SYMBOL(ide_get_queue);
EXPORT_SYMBOL(ide_add_generic_settings);
EXPORT_SYMBOL(do_ide_request);
......@@ -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(__mc68000__) || defined(CONFIG_APUS)
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_nosync(ide_hwifs[0].irq);
}
......@@ -3438,7 +3474,7 @@ static int __init ata_module_init(void)
# if defined(__mc68000__) || defined(CONFIG_APUS)
if (ide_hwifs[0].io_ports[IDE_DATA_OFFSET]) {
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
......
......@@ -283,15 +283,6 @@ void __init ide_init_trm290(struct ata_channel *hwif)
old = inw(hwif->config_data) & ~1;
if (old != compat && inb(old+2) == 0xff) {
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;
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);
......
......@@ -105,12 +105,6 @@ typedef union {
} b;
} 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
*/
......
......@@ -44,12 +44,6 @@ typedef union {
} b;
} 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
*/
......
......@@ -119,20 +119,6 @@ typedef union {
#undef SUPPORT_SLOW_DATA_PORTS
#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
*/
......
......@@ -109,12 +109,6 @@ typedef union {
} b;
} 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
*/
......
......@@ -115,12 +115,6 @@ typedef union {
} b;
} 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
*/
......
......@@ -103,64 +103,6 @@ typedef union {
} b;
} control_t;
static __inline__ int ide_request_irq(unsigned int irq, void (*handler)(int, void *, struct pt_regs *),
unsigned long flags, const char *device, void *dev_id)
{
#ifdef CONFIG_AMIGA
if (MACH_IS_AMIGA)
return request_irq(irq, handler, 0, device, dev_id);
#endif /* CONFIG_AMIGA */
#ifdef CONFIG_Q40
if (MACH_IS_Q40)
return request_irq(irq, handler, 0, device, dev_id);
#endif /* CONFIG_Q40*/
#ifdef CONFIG_MAC
if (MACH_IS_MAC)
return request_irq(irq, handler, 0, device, dev_id);
#endif /* CONFIG_MAC */
return 0;
}
static __inline__ void ide_free_irq(unsigned int irq, void *dev_id)
{
#ifdef CONFIG_AMIGA
if (MACH_IS_AMIGA)
free_irq(irq, dev_id);
#endif /* CONFIG_AMIGA */
#ifdef CONFIG_Q40
if (MACH_IS_Q40)
free_irq(irq, dev_id);
#endif /* CONFIG_Q40*/
#ifdef CONFIG_MAC
if (MACH_IS_MAC)
free_irq(irq, dev_id);
#endif /* CONFIG_MAC */
}
/*
* We should really implement those some day.
*/
static __inline__ int ide_check_region (ide_ioreg_t from, unsigned int extent)
{
return 0;
}
static __inline__ void ide_request_region (ide_ioreg_t from, unsigned int extent, const char *name)
{
#ifdef CONFIG_Q40
if (MACH_IS_Q40)
request_region((q40ide_ioreg_t)from,extent,name);
#endif
}
static __inline__ void ide_release_region (ide_ioreg_t from, unsigned int extent)
{
#ifdef CONFIG_Q40
if (MACH_IS_Q40)
release_region((q40ide_ioreg_t)from,extent);
#endif
}
#undef SUPPORT_SLOW_DATA_PORTS
#define SUPPORT_SLOW_DATA_PORTS 0
......
......@@ -31,14 +31,6 @@ struct ide_ops {
ide_ioreg_t (*ide_default_io_base)(int index);
void (*ide_init_hwif_ports)(hw_regs_t *hw, ide_ioreg_t data_port,
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;
......@@ -112,34 +104,6 @@ typedef union {
} b;
} control_t;
static __inline__ int ide_request_irq(unsigned int irq, void (*handler)(int,void *, struct pt_regs *),
unsigned long flags, const char *device, void *dev_id)
{
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
#define SUPPORT_VLB_SYNC 0
......
......@@ -34,14 +34,6 @@ struct ide_ops {
ide_ioreg_t (*ide_default_io_base)(int index);
void (*ide_init_hwif_ports)(hw_regs_t *hw, ide_ioreg_t data_port,
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;
......@@ -99,35 +91,6 @@ typedef union {
} b;
} control_t;
static __inline__ int ide_request_irq(unsigned int irq, void (*handler)(int,void *, struct pt_regs *),
unsigned long flags, const char *device, void *dev_id)
{
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__)
#ifdef insl
......
......@@ -104,12 +104,6 @@ typedef union {
} b;
} 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
*/
......
......@@ -35,12 +35,6 @@ extern void ppc_generic_ide_fix_driveid(struct hd_driveid *id);
struct ide_machdep_calls {
int (*default_irq)(ide_ioreg_t base);
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,
ide_ioreg_t data_port,
ide_ioreg_t ctrl_port,
......@@ -118,25 +112,6 @@ static __inline__ void ide_init_default_hwifs(void)
#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 {
unsigned all : 8; /* all of the bits together */
struct {
......@@ -160,14 +135,6 @@ typedef union {
} b;
} 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
* unless direct IDE on 8xx
......
......@@ -77,12 +77,6 @@ typedef union {
} b;
} 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
*/
......
......@@ -40,12 +40,6 @@ typedef union {
} b;
} 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
*/
......
......@@ -40,12 +40,6 @@ typedef union {
} b;
} 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
*/
......
......@@ -130,12 +130,6 @@ typedef union {
} b;
} 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
*/
......
......@@ -96,33 +96,6 @@ typedef union {
} b;
} 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
#define SUPPORT_SLOW_DATA_PORTS 0
......
......@@ -92,34 +92,6 @@ typedef union {
} b;
} 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
#define SUPPORT_SLOW_DATA_PORTS 0
......
......@@ -109,12 +109,6 @@ typedef union {
} b;
} 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
*/
......
......@@ -73,7 +73,6 @@ typedef unsigned char byte; /* used everywhere */
*/
#define DMA_PIO_RETRY 1 /* retrying in PIO */
#define HWIF(drive) ((drive)->channel)
#define HWGROUP(drive) (drive->channel->hwgroup)
/*
......@@ -254,7 +253,7 @@ void ide_setup_ports(hw_regs_t *hw,
#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
......@@ -266,7 +265,10 @@ void ide_setup_ports(hw_regs_t *hw,
#define ATA_NO_LUN 0x7f
struct ide_settings_s;
/* structure describing an ATA/ATAPI device */
/*
* ATA/ATAPI device structure :
*/
typedef
struct ata_device {
struct ata_channel * channel;
......@@ -401,7 +403,6 @@ struct ata_channel {
struct device dev; /* device handle */
int unit; /* channel number */
struct ata_channel *next; /* for linked-list in ide_hwgroup_t */
struct hwgroup_s *hwgroup; /* actually (ide_hwgroup_t *) */
ide_ioreg_t io_ports[IDE_NR_PORTS]; /* task file registers */
......@@ -516,17 +517,14 @@ typedef int (ide_expiry_t)(ide_drive_t *);
#define IDE_DMA 2 /* DMA in progress */
typedef struct hwgroup_s {
ide_handler_t *handler;/* irq handler, if active */
unsigned long flags; /* BUSY, SLEEPING */
ide_drive_t *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 wrq; /* local copy of current write rq */
unsigned long poll_timeout; /* timeout value during long polls */
ide_expiry_t *expiry; /* queried upon timeouts */
ide_handler_t *handler; /* irq handler, if active */
unsigned long flags; /* BUSY, SLEEPING */
struct ata_device *drive; /* current drive */
struct request *rq; /* current request */
struct timer_list timer; /* failsafe timer */
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;
/* structure attached to the request for IDE_TASK_CMDS */
......@@ -827,7 +825,7 @@ extern int drive_is_flashcard(ide_drive_t *drive);
int ide_spin_wait_hwgroup (ide_drive_t *drive);
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 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