Commit 1292ebb8 authored by Linus Torvalds's avatar Linus Torvalds

Merge git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6: (61 commits)
  ide: sanitize handling of IDE_HFLAG_NO_SET_MODE host flag
  sis5513: fail early for unsupported chipsets
  it821x: fix kzalloc() failure handling
  qd65xx: use IDE_HFLAG_SINGLE host flag
  qd65xx: always use ->selectproc method
  ide-cd: put proc-related functions together under single ifdef
  ide-cd: Replace __FUNCTION__ with __func__
  IDE: Coding Style fixes to drivers/ide/ide-cd.c
  IDE: Coding Style fixes to drivers/ide/pci/cy82c693.c
  IDE: Coding Style fixes to drivers/ide/pci/it8213.c
  IDE: Coding Style fixes to drivers/ide/ide-floppy.c
  IDE: Coding Style fixes to drivers/ide/legacy/ali14xx.c
  IDE: Coding Style fixes to drivers/ide/legacy/hd.c
  IDE: Coding Style fixes to drivers/ide/pci/cmd640.c
  IDE: Coding Style fixes to drivers/ide/pci/opti621.c
  IDE: Coding Style fixes to drivers/ide/ide-pnp.c
  IDE: Coding Style fixes to drivers/ide/ide-proc.c
  IDE: Coding Style fixes to drivers/ide/legacy/ide-4drives.c
  IDE: Coding Style fixes to drivers/ide/legacy/umc8672.c
  IDE: Coding Style fixes to drivers/ide/pci/generic.c
  ...
parents b8228758 784506cb
...@@ -1031,7 +1031,7 @@ comment "Other IDE chipsets support" ...@@ -1031,7 +1031,7 @@ comment "Other IDE chipsets support"
comment "Note: most of these also require special kernel boot parameters" comment "Note: most of these also require special kernel boot parameters"
config BLK_DEV_4DRIVES config BLK_DEV_4DRIVES
bool "Generic 4 drives/port support" tristate "Generic 4 drives/port support"
help help
Certain older chipsets, including the Tekram 690CD, use a single set Certain older chipsets, including the Tekram 690CD, use a single set
of I/O ports at 0x1f0 to control up to four drives, instead of the of I/O ports at 0x1f0 to control up to four drives, instead of the
......
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
#include <asm/arch/bast-map.h> #include <asm/arch/bast-map.h>
#include <asm/arch/bast-irq.h> #include <asm/arch/bast-irq.h>
#define DRV_NAME "bast-ide"
static int __init bastide_register(unsigned int base, unsigned int aux, int irq) static int __init bastide_register(unsigned int base, unsigned int aux, int irq)
{ {
ide_hwif_t *hwif; ide_hwif_t *hwif;
...@@ -41,7 +43,7 @@ static int __init bastide_register(unsigned int base, unsigned int aux, int irq) ...@@ -41,7 +43,7 @@ static int __init bastide_register(unsigned int base, unsigned int aux, int irq)
hw.io_ports[IDE_CONTROL_OFFSET] = aux + (6 * 0x20); hw.io_ports[IDE_CONTROL_OFFSET] = aux + (6 * 0x20);
hw.irq = irq; hw.irq = irq;
hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]); hwif = ide_find_port();
if (hwif == NULL) if (hwif == NULL)
goto out; goto out;
...@@ -53,6 +55,7 @@ static int __init bastide_register(unsigned int base, unsigned int aux, int irq) ...@@ -53,6 +55,7 @@ static int __init bastide_register(unsigned int base, unsigned int aux, int irq)
ide_init_port_data(hwif, i); ide_init_port_data(hwif, i);
ide_init_port_hw(hwif, &hw); ide_init_port_hw(hwif, &hw);
hwif->mmio = 1;
hwif->quirkproc = NULL; hwif->quirkproc = NULL;
idx[0] = i; idx[0] = i;
...@@ -64,6 +67,8 @@ static int __init bastide_register(unsigned int base, unsigned int aux, int irq) ...@@ -64,6 +67,8 @@ static int __init bastide_register(unsigned int base, unsigned int aux, int irq)
static int __init bastide_init(void) static int __init bastide_init(void)
{ {
unsigned long base = BAST_VA_IDEPRI + BAST_IDE_CS;
/* we can treat the VR1000 and the BAST the same */ /* we can treat the VR1000 and the BAST the same */
if (!(machine_is_bast() || machine_is_vr1000())) if (!(machine_is_bast() || machine_is_vr1000()))
...@@ -71,6 +76,11 @@ static int __init bastide_init(void) ...@@ -71,6 +76,11 @@ static int __init bastide_init(void)
printk("BAST: IDE driver, (c) 2003-2004 Simtec Electronics\n"); printk("BAST: IDE driver, (c) 2003-2004 Simtec Electronics\n");
if (!request_mem_region(base, 0x400000, DRV_NAME)) {
printk(KERN_ERR "%s: resources busy\n", DRV_NAME);
return -EBUSY;
}
bastide_register(BAST_VA_IDEPRI, BAST_VA_IDEPRIAUX, IRQ_IDE0); bastide_register(BAST_VA_IDEPRI, BAST_VA_IDEPRIAUX, IRQ_IDE0);
bastide_register(BAST_VA_IDESEC, BAST_VA_IDESECAUX, IRQ_IDE1); bastide_register(BAST_VA_IDESEC, BAST_VA_IDESECAUX, IRQ_IDE1);
......
...@@ -400,7 +400,7 @@ icside_setup(void __iomem *base, struct cardinfo *info, struct expansion_card *e ...@@ -400,7 +400,7 @@ icside_setup(void __iomem *base, struct cardinfo *info, struct expansion_card *e
unsigned long port = (unsigned long)base + info->dataoffset; unsigned long port = (unsigned long)base + info->dataoffset;
ide_hwif_t *hwif; ide_hwif_t *hwif;
hwif = ide_find_port(port); hwif = ide_find_port();
if (hwif) { if (hwif) {
int i; int i;
......
...@@ -34,7 +34,7 @@ static int __init ide_arm_init(void) ...@@ -34,7 +34,7 @@ static int __init ide_arm_init(void)
ide_std_init_ports(&hw, IDE_ARM_IO, IDE_ARM_IO + 0x206); ide_std_init_ports(&hw, IDE_ARM_IO, IDE_ARM_IO + 0x206);
hw.irq = IDE_ARM_IRQ; hw.irq = IDE_ARM_IRQ;
hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]); hwif = ide_find_port();
if (hwif) { if (hwif) {
ide_init_port_hw(hwif, &hw); ide_init_port_hw(hwif, &hw);
idx[0] = hwif->index; idx[0] = hwif->index;
......
...@@ -96,11 +96,11 @@ static void palm_bk3710_setudmamode(void __iomem *base, unsigned int dev, ...@@ -96,11 +96,11 @@ static void palm_bk3710_setudmamode(void __iomem *base, unsigned int dev,
u16 val16; u16 val16;
/* DMA Data Setup */ /* DMA Data Setup */
t0 = (palm_bk3710_udmatimings[mode].cycletime + ide_palm_clk - 1) t0 = DIV_ROUND_UP(palm_bk3710_udmatimings[mode].cycletime,
/ ide_palm_clk - 1; ide_palm_clk) - 1;
tenv = (20 + ide_palm_clk - 1) / ide_palm_clk - 1; tenv = DIV_ROUND_UP(20, ide_palm_clk) - 1;
trp = (palm_bk3710_udmatimings[mode].rptime + ide_palm_clk - 1) trp = DIV_ROUND_UP(palm_bk3710_udmatimings[mode].rptime,
/ ide_palm_clk - 1; ide_palm_clk) - 1;
/* udmatim Register */ /* udmatim Register */
val16 = readw(base + BK3710_UDMATIM) & (dev ? 0xFF0F : 0xFFF0); val16 = readw(base + BK3710_UDMATIM) & (dev ? 0xFF0F : 0xFFF0);
...@@ -141,8 +141,8 @@ static void palm_bk3710_setdmamode(void __iomem *base, unsigned int dev, ...@@ -141,8 +141,8 @@ static void palm_bk3710_setdmamode(void __iomem *base, unsigned int dev,
cycletime = max_t(int, t->cycle, min_cycle); cycletime = max_t(int, t->cycle, min_cycle);
/* DMA Data Setup */ /* DMA Data Setup */
t0 = (cycletime + ide_palm_clk - 1) / ide_palm_clk; t0 = DIV_ROUND_UP(cycletime, ide_palm_clk);
td = (t->active + ide_palm_clk - 1) / ide_palm_clk; td = DIV_ROUND_UP(t->active, ide_palm_clk);
tkw = t0 - td - 1; tkw = t0 - td - 1;
td -= 1; td -= 1;
...@@ -168,9 +168,9 @@ static void palm_bk3710_setpiomode(void __iomem *base, ide_drive_t *mate, ...@@ -168,9 +168,9 @@ static void palm_bk3710_setpiomode(void __iomem *base, ide_drive_t *mate,
struct ide_timing *t; struct ide_timing *t;
/* PIO Data Setup */ /* PIO Data Setup */
t0 = (cycletime + ide_palm_clk - 1) / ide_palm_clk; t0 = DIV_ROUND_UP(cycletime, ide_palm_clk);
t2 = (ide_timing_find_mode(XFER_PIO_0 + mode)->active + t2 = DIV_ROUND_UP(ide_timing_find_mode(XFER_PIO_0 + mode)->active,
ide_palm_clk - 1) / ide_palm_clk; ide_palm_clk);
t2i = t0 - t2 - 1; t2i = t0 - t2 - 1;
t2 -= 1; t2 -= 1;
...@@ -192,8 +192,8 @@ static void palm_bk3710_setpiomode(void __iomem *base, ide_drive_t *mate, ...@@ -192,8 +192,8 @@ static void palm_bk3710_setpiomode(void __iomem *base, ide_drive_t *mate,
/* TASKFILE Setup */ /* TASKFILE Setup */
t = ide_timing_find_mode(XFER_PIO_0 + mode); t = ide_timing_find_mode(XFER_PIO_0 + mode);
t0 = (t->cyc8b + ide_palm_clk - 1) / ide_palm_clk; t0 = DIV_ROUND_UP(t->cyc8b, ide_palm_clk);
t2 = (t->act8b + ide_palm_clk - 1) / ide_palm_clk; t2 = DIV_ROUND_UP(t->act8b, ide_palm_clk);
t2i = t0 - t2 - 1; t2i = t0 - t2 - 1;
t2 -= 1; t2 -= 1;
...@@ -378,7 +378,7 @@ static int __devinit palm_bk3710_probe(struct platform_device *pdev) ...@@ -378,7 +378,7 @@ static int __devinit palm_bk3710_probe(struct platform_device *pdev)
hw.irq = irq->start; hw.irq = irq->start;
hw.chipset = ide_palm3710; hw.chipset = ide_palm3710;
hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]); hwif = ide_find_port();
if (hwif == NULL) if (hwif == NULL)
goto out; goto out;
......
...@@ -44,7 +44,7 @@ rapide_probe(struct expansion_card *ec, const struct ecard_id *id) ...@@ -44,7 +44,7 @@ rapide_probe(struct expansion_card *ec, const struct ecard_id *id)
goto release; goto release;
} }
hwif = ide_find_port((unsigned long)base); hwif = ide_find_port();
if (hwif) { if (hwif) {
memset(&hw, 0, sizeof(hw)); memset(&hw, 0, sizeof(hw));
rapide_setup_ports(&hw, base, base + 0x818, 1 << 6, ec->irq); rapide_setup_ports(&hw, base, base + 0x818, 1 << 6, ec->irq);
......
...@@ -804,7 +804,7 @@ static int __init init_e100_ide(void) ...@@ -804,7 +804,7 @@ static int __init init_e100_ide(void)
cris_setup_ports(&hw, cris_ide_base_address(h)); cris_setup_ports(&hw, cris_ide_base_address(h));
hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]); hwif = ide_find_port();
if (hwif == NULL) if (hwif == NULL)
continue; continue;
ide_init_port_data(hwif, hwif->index); ide_init_port_data(hwif, hwif->index);
......
...@@ -99,8 +99,7 @@ static int __init h8300_ide_init(void) ...@@ -99,8 +99,7 @@ static int __init h8300_ide_init(void)
hw_setup(&hw); hw_setup(&hw);
/* register if */ hwif = ide_find_port();
hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]);
if (hwif == NULL) { if (hwif == NULL) {
printk(KERN_ERR "ide-h8300: IDE I/F register failed\n"); printk(KERN_ERR "ide-h8300: IDE I/F register failed\n");
return -ENOENT; return -ENOENT;
......
This diff is collapsed.
...@@ -119,10 +119,6 @@ struct cdrom_info { ...@@ -119,10 +119,6 @@ struct cdrom_info {
struct atapi_toc *toc; struct atapi_toc *toc;
unsigned long sector_buffered;
unsigned long nsectors_buffered;
unsigned char *buffer;
/* The result of the last successful request sense command /* The result of the last successful request sense command
on this device. */ on this device. */
struct request_sense sense_data; struct request_sense sense_data;
......
This diff is collapsed.
...@@ -703,17 +703,8 @@ static int ide_tune_dma(ide_drive_t *drive) ...@@ -703,17 +703,8 @@ static int ide_tune_dma(ide_drive_t *drive)
speed = ide_max_dma_mode(drive); speed = ide_max_dma_mode(drive);
if (!speed) { if (!speed)
/* is this really correct/needed? */
if ((hwif->host_flags & IDE_HFLAG_CY82C693) &&
ide_dma_good_drive(drive))
return 1;
else
return 0; return 0;
}
if (hwif->host_flags & IDE_HFLAG_NO_SET_MODE)
return 1;
if (ide_set_dma_mode(drive, speed)) if (ide_set_dma_mode(drive, speed))
return 0; return 0;
......
...@@ -396,7 +396,7 @@ static void idefloppy_retry_pc(ide_drive_t *drive) ...@@ -396,7 +396,7 @@ static void idefloppy_retry_pc(ide_drive_t *drive)
} }
/* The usual interrupt handler called during a packet command. */ /* The usual interrupt handler called during a packet command. */
static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive) static ide_startstop_t idefloppy_pc_intr(ide_drive_t *drive)
{ {
idefloppy_floppy_t *floppy = drive->driver_data; idefloppy_floppy_t *floppy = drive->driver_data;
ide_hwif_t *hwif = drive->hwif; ide_hwif_t *hwif = drive->hwif;
...@@ -1602,7 +1602,7 @@ static struct block_device_operations idefloppy_ops = { ...@@ -1602,7 +1602,7 @@ static struct block_device_operations idefloppy_ops = {
.ioctl = idefloppy_ioctl, .ioctl = idefloppy_ioctl,
.getgeo = idefloppy_getgeo, .getgeo = idefloppy_getgeo,
.media_changed = idefloppy_media_changed, .media_changed = idefloppy_media_changed,
.revalidate_disk= idefloppy_revalidate_disk .revalidate_disk = idefloppy_revalidate_disk
}; };
static int ide_floppy_probe(ide_drive_t *drive) static int ide_floppy_probe(ide_drive_t *drive)
......
...@@ -33,7 +33,7 @@ static ssize_t store_add(struct class *cls, const char *buf, size_t n) ...@@ -33,7 +33,7 @@ static ssize_t store_add(struct class *cls, const char *buf, size_t n)
if (sscanf(buf, "%x:%x:%d", &base, &ctl, &irq) != 3) if (sscanf(buf, "%x:%x:%d", &base, &ctl, &irq) != 3)
return -EINVAL; return -EINVAL;
hwif = ide_find_port(base); hwif = ide_find_port();
if (hwif == NULL) if (hwif == NULL)
return -ENOENT; return -ENOENT;
...@@ -90,11 +90,21 @@ static int __init ide_generic_init(void) ...@@ -90,11 +90,21 @@ static int __init ide_generic_init(void)
int i; int i;
for (i = 0; i < MAX_HWIFS; i++) { for (i = 0; i < MAX_HWIFS; i++) {
ide_hwif_t *hwif = &ide_hwifs[i]; ide_hwif_t *hwif;
unsigned long io_addr = ide_default_io_base(i); unsigned long io_addr = ide_default_io_base(i);
hw_regs_t hw; hw_regs_t hw;
if (hwif->chipset == ide_unknown && io_addr) { if (io_addr) {
/*
* Skip probing if the corresponding
* slot is already occupied.
*/
hwif = ide_find_port();
if (hwif == NULL || hwif->index != i) {
idx[i] = 0xff;
continue;
}
memset(&hw, 0, sizeof(hw)); memset(&hw, 0, sizeof(hw));
ide_std_init_ports(&hw, io_addr, io_addr + 0x206); ide_std_init_ports(&hw, io_addr, io_addr + 0x206);
hw.irq = ide_default_irq(io_addr); hw.irq = ide_default_irq(io_addr);
......
...@@ -726,10 +726,6 @@ static ide_startstop_t do_special (ide_drive_t *drive) ...@@ -726,10 +726,6 @@ static ide_startstop_t do_special (ide_drive_t *drive)
s->b.set_tune = 0; s->b.set_tune = 0;
if (set_pio_mode_abuse(drive->hwif, req_pio)) { if (set_pio_mode_abuse(drive->hwif, req_pio)) {
if (hwif->set_pio_mode == NULL)
return ide_stopped;
/* /*
* take ide_lock for drive->[no_]unmask/[no_]io_32bit * take ide_lock for drive->[no_]unmask/[no_]io_32bit
*/ */
......
...@@ -274,16 +274,6 @@ u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode) ...@@ -274,16 +274,6 @@ u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode)
if (overridden) if (overridden)
printk(KERN_INFO "%s: tPIO > 2, assuming tPIO = 2\n", printk(KERN_INFO "%s: tPIO > 2, assuming tPIO = 2\n",
drive->name); drive->name);
/*
* Conservative "downgrade" for all pre-ATA2 drives
*/
if ((drive->hwif->host_flags & IDE_HFLAG_PIO_NO_DOWNGRADE) == 0 &&
pio_mode && pio_mode < 4) {
pio_mode--;
printk(KERN_INFO "%s: applying conservative "
"PIO \"downgrade\"\n", drive->name);
}
} }
if (pio_mode > max_mode) if (pio_mode > max_mode)
...@@ -300,7 +290,8 @@ void ide_set_pio(ide_drive_t *drive, u8 req_pio) ...@@ -300,7 +290,8 @@ void ide_set_pio(ide_drive_t *drive, u8 req_pio)
ide_hwif_t *hwif = drive->hwif; ide_hwif_t *hwif = drive->hwif;
u8 host_pio, pio; u8 host_pio, pio;
if (hwif->set_pio_mode == NULL) if (hwif->set_pio_mode == NULL ||
(hwif->host_flags & IDE_HFLAG_NO_SET_MODE))
return; return;
BUG_ON(hwif->pio_mask == 0x00); BUG_ON(hwif->pio_mask == 0x00);
...@@ -353,6 +344,9 @@ int ide_set_pio_mode(ide_drive_t *drive, const u8 mode) ...@@ -353,6 +344,9 @@ int ide_set_pio_mode(ide_drive_t *drive, const u8 mode)
{ {
ide_hwif_t *hwif = drive->hwif; ide_hwif_t *hwif = drive->hwif;
if (hwif->host_flags & IDE_HFLAG_NO_SET_MODE)
return 0;
if (hwif->set_pio_mode == NULL) if (hwif->set_pio_mode == NULL)
return -1; return -1;
...@@ -380,6 +374,9 @@ int ide_set_dma_mode(ide_drive_t *drive, const u8 mode) ...@@ -380,6 +374,9 @@ int ide_set_dma_mode(ide_drive_t *drive, const u8 mode)
{ {
ide_hwif_t *hwif = drive->hwif; ide_hwif_t *hwif = drive->hwif;
if (hwif->host_flags & IDE_HFLAG_NO_SET_MODE)
return 0;
if (hwif->set_dma_mode == NULL) if (hwif->set_dma_mode == NULL)
return -1; return -1;
...@@ -410,7 +407,8 @@ int ide_set_xfer_rate(ide_drive_t *drive, u8 rate) ...@@ -410,7 +407,8 @@ int ide_set_xfer_rate(ide_drive_t *drive, u8 rate)
{ {
ide_hwif_t *hwif = drive->hwif; ide_hwif_t *hwif = drive->hwif;
if (hwif->set_dma_mode == NULL) if (hwif->set_dma_mode == NULL ||
(hwif->host_flags & IDE_HFLAG_NO_SET_MODE))
return -1; return -1;
rate = ide_rate_filter(drive, rate); rate = ide_rate_filter(drive, rate);
......
...@@ -25,7 +25,7 @@ static struct pnp_device_id idepnp_devices[] = { ...@@ -25,7 +25,7 @@ static struct pnp_device_id idepnp_devices[] = {
{.id = ""} {.id = ""}
}; };
static int idepnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id) static int idepnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id)
{ {
hw_regs_t hw; hw_regs_t hw;
ide_hwif_t *hwif; ide_hwif_t *hwif;
...@@ -38,7 +38,7 @@ static int idepnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id ...@@ -38,7 +38,7 @@ static int idepnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id
pnp_port_start(dev, 1)); pnp_port_start(dev, 1));
hw.irq = pnp_irq(dev, 0); hw.irq = pnp_irq(dev, 0);
hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]); hwif = ide_find_port();
if (hwif) { if (hwif) {
u8 index = hwif->index; u8 index = hwif->index;
u8 idx[4] = { index, 0xff, 0xff, 0xff }; u8 idx[4] = { index, 0xff, 0xff, 0xff };
...@@ -47,7 +47,7 @@ static int idepnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id ...@@ -47,7 +47,7 @@ static int idepnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id
ide_init_port_hw(hwif, &hw); ide_init_port_hw(hwif, &hw);
printk(KERN_INFO "ide%d: generic PnP IDE interface\n", index); printk(KERN_INFO "ide%d: generic PnP IDE interface\n", index);
pnp_set_drvdata(dev,hwif); pnp_set_drvdata(dev, hwif);
ide_device_add(idx, NULL); ide_device_add(idx, NULL);
...@@ -57,7 +57,7 @@ static int idepnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id ...@@ -57,7 +57,7 @@ static int idepnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id
return -1; return -1;
} }
static void idepnp_remove(struct pnp_dev * dev) static void idepnp_remove(struct pnp_dev *dev)
{ {
ide_hwif_t *hwif = pnp_get_drvdata(dev); ide_hwif_t *hwif = pnp_get_drvdata(dev);
......
...@@ -1444,6 +1444,54 @@ static int ide_sysfs_register_port(ide_hwif_t *hwif) ...@@ -1444,6 +1444,54 @@ static int ide_sysfs_register_port(ide_hwif_t *hwif)
return rc; return rc;
} }
/**
* ide_find_port_slot - find free ide_hwifs[] slot
* @d: IDE port info
*
* Return the new hwif. If we are out of free slots return NULL.
*/
ide_hwif_t *ide_find_port_slot(const struct ide_port_info *d)
{
ide_hwif_t *hwif;
int i;
u8 bootable = (d && (d->host_flags & IDE_HFLAG_NON_BOOTABLE)) ? 0 : 1;
/*
* Claim an unassigned slot.
*
* Give preference to claiming other slots before claiming ide0/ide1,
* just in case there's another interface yet-to-be-scanned
* which uses ports 0x1f0/0x170 (the ide0/ide1 defaults).
*
* Unless there is a bootable card that does not use the standard
* ports 0x1f0/0x170 (the ide0/ide1 defaults).
*/
if (bootable) {
i = (d && (d->host_flags & IDE_HFLAG_QD_2ND_PORT)) ? 1 : 0;
for (; i < MAX_HWIFS; i++) {
hwif = &ide_hwifs[i];
if (hwif->chipset == ide_unknown)
return hwif;
}
} else {
for (i = 2; i < MAX_HWIFS; i++) {
hwif = &ide_hwifs[i];
if (hwif->chipset == ide_unknown)
return hwif;
}
for (i = 0; i < 2 && i < MAX_HWIFS; i++) {
hwif = &ide_hwifs[i];
if (hwif->chipset == ide_unknown)
return hwif;
}
}
return NULL;
}
EXPORT_SYMBOL_GPL(ide_find_port_slot);
int ide_device_add_all(u8 *idx, const struct ide_port_info *d) int ide_device_add_all(u8 *idx, const struct ide_port_info *d)
{ {
ide_hwif_t *hwif, *mate = NULL; ide_hwif_t *hwif, *mate = NULL;
......
...@@ -68,7 +68,7 @@ static int proc_ide_read_imodel ...@@ -68,7 +68,7 @@ static int proc_ide_read_imodel
default: name = "(unknown)"; break; default: name = "(unknown)"; break;
} }
len = sprintf(page, "%s\n", name); len = sprintf(page, "%s\n", name);
PROC_IDE_READ_RETURN(page,start,off,count,eof,len); PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
} }
static int proc_ide_read_mate static int proc_ide_read_mate
...@@ -81,7 +81,7 @@ static int proc_ide_read_mate ...@@ -81,7 +81,7 @@ static int proc_ide_read_mate
len = sprintf(page, "%s\n", hwif->mate->name); len = sprintf(page, "%s\n", hwif->mate->name);
else else
len = sprintf(page, "(none)\n"); len = sprintf(page, "(none)\n");
PROC_IDE_READ_RETURN(page,start,off,count,eof,len); PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
} }
static int proc_ide_read_channel static int proc_ide_read_channel
...@@ -93,7 +93,7 @@ static int proc_ide_read_channel ...@@ -93,7 +93,7 @@ static int proc_ide_read_channel
page[0] = hwif->channel ? '1' : '0'; page[0] = hwif->channel ? '1' : '0';
page[1] = '\n'; page[1] = '\n';
len = 2; len = 2;
PROC_IDE_READ_RETURN(page,start,off,count,eof,len); PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
} }
static int proc_ide_read_identify static int proc_ide_read_identify
...@@ -120,7 +120,7 @@ static int proc_ide_read_identify ...@@ -120,7 +120,7 @@ static int proc_ide_read_identify
len = out - page; len = out - page;
} }
} }
PROC_IDE_READ_RETURN(page,start,off,count,eof,len); PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
} }
/** /**
...@@ -197,7 +197,7 @@ EXPORT_SYMBOL(ide_add_setting); ...@@ -197,7 +197,7 @@ EXPORT_SYMBOL(ide_add_setting);
* The caller must hold the setting semaphore. * The caller must hold the setting semaphore.
*/ */
static void __ide_remove_setting (ide_drive_t *drive, char *name) static void __ide_remove_setting(ide_drive_t *drive, char *name)
{ {
ide_settings_t **p, *setting; ide_settings_t **p, *setting;
...@@ -205,7 +205,8 @@ static void __ide_remove_setting (ide_drive_t *drive, char *name) ...@@ -205,7 +205,8 @@ static void __ide_remove_setting (ide_drive_t *drive, char *name)
while ((*p) && strcmp((*p)->name, name)) while ((*p) && strcmp((*p)->name, name))
p = &((*p)->next); p = &((*p)->next);
if ((setting = (*p)) == NULL) setting = (*p);
if (setting == NULL)
return; return;
(*p) = setting->next; (*p) = setting->next;
...@@ -223,7 +224,7 @@ static void __ide_remove_setting (ide_drive_t *drive, char *name) ...@@ -223,7 +224,7 @@ static void __ide_remove_setting (ide_drive_t *drive, char *name)
* caller must hold ide_setting_mtx. * caller must hold ide_setting_mtx.
*/ */
static void auto_remove_settings (ide_drive_t *drive) static void auto_remove_settings(ide_drive_t *drive)
{ {
ide_settings_t *setting; ide_settings_t *setting;
repeat: repeat:
...@@ -279,7 +280,7 @@ static int ide_read_setting(ide_drive_t *drive, ide_settings_t *setting) ...@@ -279,7 +280,7 @@ static int ide_read_setting(ide_drive_t *drive, ide_settings_t *setting)
if ((setting->rw & SETTING_READ)) { if ((setting->rw & SETTING_READ)) {
spin_lock_irqsave(&ide_lock, flags); spin_lock_irqsave(&ide_lock, flags);
switch(setting->data_type) { switch (setting->data_type) {
case TYPE_BYTE: case TYPE_BYTE:
val = *((u8 *) setting->data); val = *((u8 *) setting->data);
break; break;
...@@ -390,7 +391,7 @@ void ide_add_generic_settings (ide_drive_t *drive) ...@@ -390,7 +391,7 @@ void ide_add_generic_settings (ide_drive_t *drive)
static void proc_ide_settings_warn(void) static void proc_ide_settings_warn(void)
{ {
static int warned = 0; static int warned;
if (warned) if (warned)
return; return;
...@@ -413,11 +414,12 @@ static int proc_ide_read_settings ...@@ -413,11 +414,12 @@ static int proc_ide_read_settings
mutex_lock(&ide_setting_mtx); mutex_lock(&ide_setting_mtx);
out += sprintf(out, "name\t\t\tvalue\t\tmin\t\tmax\t\tmode\n"); out += sprintf(out, "name\t\t\tvalue\t\tmin\t\tmax\t\tmode\n");
out += sprintf(out, "----\t\t\t-----\t\t---\t\t---\t\t----\n"); out += sprintf(out, "----\t\t\t-----\t\t---\t\t---\t\t----\n");
while(setting) { while (setting) {
mul_factor = setting->mul_factor; mul_factor = setting->mul_factor;
div_factor = setting->div_factor; div_factor = setting->div_factor;
out += sprintf(out, "%-24s", setting->name); out += sprintf(out, "%-24s", setting->name);
if ((rc = ide_read_setting(drive, setting)) >= 0) rc = ide_read_setting(drive, setting);
if (rc >= 0)
out += sprintf(out, "%-16d", rc * mul_factor / div_factor); out += sprintf(out, "%-16d", rc * mul_factor / div_factor);
else else
out += sprintf(out, "%-16s", "write-only"); out += sprintf(out, "%-16s", "write-only");
...@@ -431,7 +433,7 @@ static int proc_ide_read_settings ...@@ -431,7 +433,7 @@ static int proc_ide_read_settings
} }
len = out - page; len = out - page;
mutex_unlock(&ide_setting_mtx); mutex_unlock(&ide_setting_mtx);
PROC_IDE_READ_RETURN(page,start,off,count,eof,len); PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
} }
#define MAX_LEN 30 #define MAX_LEN 30
...@@ -512,8 +514,7 @@ static int proc_ide_write_settings(struct file *file, const char __user *buffer, ...@@ -512,8 +514,7 @@ static int proc_ide_write_settings(struct file *file, const char __user *buffer,
mutex_lock(&ide_setting_mtx); mutex_lock(&ide_setting_mtx);
setting = ide_find_setting_by_name(drive, name); setting = ide_find_setting_by_name(drive, name);
if (!setting) if (!setting) {
{
mutex_unlock(&ide_setting_mtx); mutex_unlock(&ide_setting_mtx);
goto parse_error; goto parse_error;
} }
...@@ -533,8 +534,8 @@ static int proc_ide_write_settings(struct file *file, const char __user *buffer, ...@@ -533,8 +534,8 @@ static int proc_ide_write_settings(struct file *file, const char __user *buffer,
int proc_ide_read_capacity int proc_ide_read_capacity
(char *page, char **start, off_t off, int count, int *eof, void *data) (char *page, char **start, off_t off, int count, int *eof, void *data)
{ {
int len = sprintf(page,"%llu\n", (long long)0x7fffffff); int len = sprintf(page, "%llu\n", (long long)0x7fffffff);
PROC_IDE_READ_RETURN(page,start,off,count,eof,len); PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
} }
EXPORT_SYMBOL_GPL(proc_ide_read_capacity); EXPORT_SYMBOL_GPL(proc_ide_read_capacity);
...@@ -546,13 +547,13 @@ int proc_ide_read_geometry ...@@ -546,13 +547,13 @@ int proc_ide_read_geometry
char *out = page; char *out = page;
int len; int len;
out += sprintf(out,"physical %d/%d/%d\n", out += sprintf(out, "physical %d/%d/%d\n",
drive->cyl, drive->head, drive->sect); drive->cyl, drive->head, drive->sect);
out += sprintf(out,"logical %d/%d/%d\n", out += sprintf(out, "logical %d/%d/%d\n",
drive->bios_cyl, drive->bios_head, drive->bios_sect); drive->bios_cyl, drive->bios_head, drive->bios_sect);
len = out - page; len = out - page;
PROC_IDE_READ_RETURN(page,start,off,count,eof,len); PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
} }
EXPORT_SYMBOL(proc_ide_read_geometry); EXPORT_SYMBOL(proc_ide_read_geometry);
...@@ -566,7 +567,7 @@ static int proc_ide_read_dmodel ...@@ -566,7 +567,7 @@ static int proc_ide_read_dmodel
len = sprintf(page, "%.40s\n", len = sprintf(page, "%.40s\n",
(id && id->model[0]) ? (char *)id->model : "(none)"); (id && id->model[0]) ? (char *)id->model : "(none)");
PROC_IDE_READ_RETURN(page,start,off,count,eof,len); PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
} }
static int proc_ide_read_driver static int proc_ide_read_driver
...@@ -583,7 +584,7 @@ static int proc_ide_read_driver ...@@ -583,7 +584,7 @@ static int proc_ide_read_driver
dev->driver->name, ide_drv->version); dev->driver->name, ide_drv->version);
} else } else
len = sprintf(page, "ide-default version 0.9.newide\n"); len = sprintf(page, "ide-default version 0.9.newide\n");
PROC_IDE_READ_RETURN(page,start,off,count,eof,len); PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
} }
static int ide_replace_subdriver(ide_drive_t *drive, const char *driver) static int ide_replace_subdriver(ide_drive_t *drive, const char *driver)
...@@ -639,30 +640,26 @@ static int proc_ide_read_media ...@@ -639,30 +640,26 @@ static int proc_ide_read_media
int len; int len;
switch (drive->media) { switch (drive->media) {
case ide_disk: media = "disk\n"; case ide_disk: media = "disk\n"; break;
break; case ide_cdrom: media = "cdrom\n"; break;
case ide_cdrom: media = "cdrom\n"; case ide_tape: media = "tape\n"; break;
break; case ide_floppy: media = "floppy\n"; break;
case ide_tape: media = "tape\n"; case ide_optical: media = "optical\n"; break;
break; default: media = "UNKNOWN\n"; break;
case ide_floppy:media = "floppy\n";
break;
case ide_optical:media = "optical\n";
break;
default: media = "UNKNOWN\n";
break;
} }
strcpy(page,media); strcpy(page, media);
len = strlen(media); len = strlen(media);
PROC_IDE_READ_RETURN(page,start,off,count,eof,len); PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
} }
static ide_proc_entry_t generic_drive_entries[] = { static ide_proc_entry_t generic_drive_entries[] = {
{ "driver", S_IFREG|S_IRUGO, proc_ide_read_driver, proc_ide_write_driver }, { "driver", S_IFREG|S_IRUGO, proc_ide_read_driver,
proc_ide_write_driver },
{ "identify", S_IFREG|S_IRUSR, proc_ide_read_identify, NULL }, { "identify", S_IFREG|S_IRUSR, proc_ide_read_identify, NULL },
{ "media", S_IFREG|S_IRUGO, proc_ide_read_media, NULL }, { "media", S_IFREG|S_IRUGO, proc_ide_read_media, NULL },
{ "model", S_IFREG|S_IRUGO, proc_ide_read_dmodel, NULL }, { "model", S_IFREG|S_IRUGO, proc_ide_read_dmodel, NULL },
{ "settings", S_IFREG|S_IRUSR|S_IWUSR,proc_ide_read_settings, proc_ide_write_settings }, { "settings", S_IFREG|S_IRUSR|S_IWUSR, proc_ide_read_settings,
proc_ide_write_settings },
{ NULL, 0, NULL, NULL } { NULL, 0, NULL, NULL }
}; };
...@@ -734,7 +731,6 @@ void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver) ...@@ -734,7 +731,6 @@ void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver)
spin_unlock_irqrestore(&ide_lock, flags); spin_unlock_irqrestore(&ide_lock, flags);
mutex_unlock(&ide_setting_mtx); mutex_unlock(&ide_setting_mtx);
} }
EXPORT_SYMBOL(ide_proc_unregister_driver); EXPORT_SYMBOL(ide_proc_unregister_driver);
void ide_proc_port_register_devices(ide_hwif_t *hwif) void ide_proc_port_register_devices(ide_hwif_t *hwif)
...@@ -755,7 +751,7 @@ void ide_proc_port_register_devices(ide_hwif_t *hwif) ...@@ -755,7 +751,7 @@ void ide_proc_port_register_devices(ide_hwif_t *hwif)
drive->proc = proc_mkdir(drive->name, parent); drive->proc = proc_mkdir(drive->name, parent);
if (drive->proc) if (drive->proc)
ide_add_proc_entries(drive->proc, generic_drive_entries, drive); ide_add_proc_entries(drive->proc, generic_drive_entries, drive);
sprintf(name,"ide%d/%s", (drive->name[2]-'a')/2, drive->name); sprintf(name, "ide%d/%s", (drive->name[2]-'a')/2, drive->name);
ent = proc_symlink(drive->name, proc_ide_root, name); ent = proc_symlink(drive->name, proc_ide_root, name);
if (!ent) return; if (!ent) return;
} }
...@@ -795,7 +791,6 @@ void ide_pci_create_host_proc(const char *name, get_info_t *get_info) ...@@ -795,7 +791,6 @@ void ide_pci_create_host_proc(const char *name, get_info_t *get_info)
{ {
create_proc_info_entry(name, 0, proc_ide_root, get_info); create_proc_info_entry(name, 0, proc_ide_root, get_info);
} }
EXPORT_SYMBOL_GPL(ide_pci_create_host_proc); EXPORT_SYMBOL_GPL(ide_pci_create_host_proc);
#endif #endif
......
...@@ -100,13 +100,8 @@ int ide_noacpitfs = 1; ...@@ -100,13 +100,8 @@ int ide_noacpitfs = 1;
int ide_noacpionboot = 1; int ide_noacpionboot = 1;
#endif #endif
/*
* This is declared extern in ide.h, for access by other IDE modules:
*/
ide_hwif_t ide_hwifs[MAX_HWIFS]; /* master data repository */ ide_hwif_t ide_hwifs[MAX_HWIFS]; /* master data repository */
EXPORT_SYMBOL(ide_hwifs);
static void ide_port_init_devices_data(ide_hwif_t *); static void ide_port_init_devices_data(ide_hwif_t *);
/* /*
...@@ -232,30 +227,6 @@ static int ide_system_bus_speed(void) ...@@ -232,30 +227,6 @@ static int ide_system_bus_speed(void)
return pci_dev_present(pci_default) ? 33 : 50; return pci_dev_present(pci_default) ? 33 : 50;
} }
ide_hwif_t * ide_find_port(unsigned long base)
{
ide_hwif_t *hwif;
int i;
for (i = 0; i < MAX_HWIFS; i++) {
hwif = &ide_hwifs[i];
if (hwif->io_ports[IDE_DATA_OFFSET] == base)
goto found;
}
for (i = 0; i < MAX_HWIFS; i++) {
hwif = &ide_hwifs[i];
if (hwif->chipset == ide_unknown)
goto found;
}
hwif = NULL;
found:
return hwif;
}
EXPORT_SYMBOL_GPL(ide_find_port);
static struct resource* hwif_request_region(ide_hwif_t *hwif, static struct resource* hwif_request_region(ide_hwif_t *hwif,
unsigned long addr, int num) unsigned long addr, int num)
{ {
...@@ -280,29 +251,21 @@ static struct resource* hwif_request_region(ide_hwif_t *hwif, ...@@ -280,29 +251,21 @@ static struct resource* hwif_request_region(ide_hwif_t *hwif,
int ide_hwif_request_regions(ide_hwif_t *hwif) int ide_hwif_request_regions(ide_hwif_t *hwif)
{ {
unsigned long addr; unsigned long addr;
unsigned int i;
if (hwif->mmio) if (hwif->mmio)
return 0; return 0;
addr = hwif->io_ports[IDE_CONTROL_OFFSET]; addr = hwif->io_ports[IDE_CONTROL_OFFSET];
if (addr && !hwif_request_region(hwif, addr, 1)) if (addr && !hwif_request_region(hwif, addr, 1))
goto control_region_busy; goto control_region_busy;
hwif->straight8 = 0;
addr = hwif->io_ports[IDE_DATA_OFFSET]; addr = hwif->io_ports[IDE_DATA_OFFSET];
if ((addr | 7) == hwif->io_ports[IDE_STATUS_OFFSET]) { BUG_ON((addr | 7) != hwif->io_ports[IDE_STATUS_OFFSET]);
if (!hwif_request_region(hwif, addr, 8)) if (!hwif_request_region(hwif, addr, 8))
goto data_region_busy; goto data_region_busy;
hwif->straight8 = 1;
return 0;
}
for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
addr = hwif->io_ports[i];
if (!hwif_request_region(hwif, addr, 1)) {
while (--i)
release_region(addr, 1);
goto data_region_busy;
}
}
return 0; return 0;
data_region_busy: data_region_busy:
...@@ -328,19 +291,13 @@ int ide_hwif_request_regions(ide_hwif_t *hwif) ...@@ -328,19 +291,13 @@ int ide_hwif_request_regions(ide_hwif_t *hwif)
void ide_hwif_release_regions(ide_hwif_t *hwif) void ide_hwif_release_regions(ide_hwif_t *hwif)
{ {
u32 i = 0;
if (hwif->mmio) if (hwif->mmio)
return; return;
if (hwif->io_ports[IDE_CONTROL_OFFSET]) if (hwif->io_ports[IDE_CONTROL_OFFSET])
release_region(hwif->io_ports[IDE_CONTROL_OFFSET], 1); release_region(hwif->io_ports[IDE_CONTROL_OFFSET], 1);
if (hwif->straight8) {
release_region(hwif->io_ports[IDE_DATA_OFFSET], 8); release_region(hwif->io_ports[IDE_DATA_OFFSET], 8);
return;
}
for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++)
if (hwif->io_ports[i])
release_region(hwif->io_ports[i], 1);
} }
void ide_remove_port_from_hwgroup(ide_hwif_t *hwif) void ide_remove_port_from_hwgroup(ide_hwif_t *hwif)
...@@ -627,11 +584,13 @@ int set_using_dma(ide_drive_t *drive, int arg) ...@@ -627,11 +584,13 @@ int set_using_dma(ide_drive_t *drive, int arg)
int set_pio_mode(ide_drive_t *drive, int arg) int set_pio_mode(ide_drive_t *drive, int arg)
{ {
struct request rq; struct request rq;
ide_hwif_t *hwif = drive->hwif;
if (arg < 0 || arg > 255) if (arg < 0 || arg > 255)
return -EINVAL; return -EINVAL;
if (drive->hwif->set_pio_mode == NULL) if (hwif->set_pio_mode == NULL ||
(hwif->host_flags & IDE_HFLAG_NO_SET_MODE))
return -ENOSYS; return -ENOSYS;
if (drive->special.b.set_tune) if (drive->special.b.set_tune)
......
...@@ -86,7 +86,7 @@ static u8 regOff; /* output to base port to close registers */ ...@@ -86,7 +86,7 @@ static u8 regOff; /* output to base port to close registers */
/* /*
* Read a controller register. * Read a controller register.
*/ */
static inline u8 inReg (u8 reg) static inline u8 inReg(u8 reg)
{ {
outb_p(reg, regPort); outb_p(reg, regPort);
return inb(dataPort); return inb(dataPort);
...@@ -95,7 +95,7 @@ static inline u8 inReg (u8 reg) ...@@ -95,7 +95,7 @@ static inline u8 inReg (u8 reg)
/* /*
* Write a controller register. * Write a controller register.
*/ */
static void outReg (u8 data, u8 reg) static void outReg(u8 data, u8 reg)
{ {
outb_p(reg, regPort); outb_p(reg, regPort);
outb_p(data, dataPort); outb_p(data, dataPort);
...@@ -143,7 +143,7 @@ static void ali14xx_set_pio_mode(ide_drive_t *drive, const u8 pio) ...@@ -143,7 +143,7 @@ static void ali14xx_set_pio_mode(ide_drive_t *drive, const u8 pio)
/* /*
* Auto-detect the IDE controller port. * Auto-detect the IDE controller port.
*/ */
static int __init findPort (void) static int __init findPort(void)
{ {
int i; int i;
u8 t; u8 t;
...@@ -175,7 +175,8 @@ static int __init findPort (void) ...@@ -175,7 +175,8 @@ static int __init findPort (void)
/* /*
* Initialize controller registers with default values. * Initialize controller registers with default values.
*/ */
static int __init initRegisters (void) { static int __init initRegisters(void)
{
const RegInitializer *p; const RegInitializer *p;
u8 t; u8 t;
unsigned long flags; unsigned long flags;
...@@ -199,7 +200,8 @@ static const struct ide_port_info ali14xx_port_info = { ...@@ -199,7 +200,8 @@ static const struct ide_port_info ali14xx_port_info = {
static int __init ali14xx_probe(void) static int __init ali14xx_probe(void)
{ {
static u8 idx[4] = { 0, 1, 0xff, 0xff }; ide_hwif_t *hwif, *mate;
static u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
hw_regs_t hw[2]; hw_regs_t hw[2];
printk(KERN_DEBUG "ali14xx: base=0x%03x, regOn=0x%02x.\n", printk(KERN_DEBUG "ali14xx: base=0x%03x, regOn=0x%02x.\n",
...@@ -219,18 +221,26 @@ static int __init ali14xx_probe(void) ...@@ -219,18 +221,26 @@ static int __init ali14xx_probe(void)
ide_std_init_ports(&hw[1], 0x170, 0x376); ide_std_init_ports(&hw[1], 0x170, 0x376);
hw[1].irq = 15; hw[1].irq = 15;
ide_init_port_hw(&ide_hwifs[0], &hw[0]); hwif = ide_find_port();
ide_init_port_hw(&ide_hwifs[1], &hw[1]); if (hwif) {
ide_init_port_hw(hwif, &hw[0]);
hwif->set_pio_mode = &ali14xx_set_pio_mode;
idx[0] = hwif->index;
}
ide_hwifs[0].set_pio_mode = &ali14xx_set_pio_mode; mate = ide_find_port();
ide_hwifs[1].set_pio_mode = &ali14xx_set_pio_mode; if (mate) {
ide_init_port_hw(mate, &hw[1]);
mate->set_pio_mode = &ali14xx_set_pio_mode;
idx[1] = mate->index;
}
ide_device_add(idx, &ali14xx_port_info); ide_device_add(idx, &ali14xx_port_info);
return 0; return 0;
} }
int probe_ali14xx = 0; int probe_ali14xx;
module_param_named(probe, probe_ali14xx, bool, 0); module_param_named(probe, probe_ali14xx, bool, 0);
MODULE_PARM_DESC(probe, "probe for ALI M14xx chipsets"); MODULE_PARM_DESC(probe, "probe for ALI M14xx chipsets");
......
...@@ -221,7 +221,7 @@ static int __init buddha_init(void) ...@@ -221,7 +221,7 @@ static int __init buddha_init(void)
buddha_setup_ports(&hw, base, ctl, irq_port, ack_intr); buddha_setup_ports(&hw, base, ctl, irq_port, ack_intr);
hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]); hwif = ide_find_port();
if (hwif) { if (hwif) {
u8 index = hwif->index; u8 index = hwif->index;
......
...@@ -102,15 +102,9 @@ static int __init dtc2278_probe(void) ...@@ -102,15 +102,9 @@ static int __init dtc2278_probe(void)
{ {
unsigned long flags; unsigned long flags;
ide_hwif_t *hwif, *mate; ide_hwif_t *hwif, *mate;
static u8 idx[4] = { 0, 1, 0xff, 0xff }; static u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
hw_regs_t hw[2]; hw_regs_t hw[2];
hwif = &ide_hwifs[0];
mate = &ide_hwifs[1];
if (hwif->chipset != ide_unknown || mate->chipset != ide_unknown)
return 1;
local_irq_save(flags); local_irq_save(flags);
/* /*
* This enables the second interface * This enables the second interface
...@@ -137,10 +131,18 @@ static int __init dtc2278_probe(void) ...@@ -137,10 +131,18 @@ static int __init dtc2278_probe(void)
ide_std_init_ports(&hw[1], 0x170, 0x376); ide_std_init_ports(&hw[1], 0x170, 0x376);
hw[1].irq = 15; hw[1].irq = 15;
hwif = ide_find_port();
if (hwif) {
ide_init_port_hw(hwif, &hw[0]); ide_init_port_hw(hwif, &hw[0]);
ide_init_port_hw(mate, &hw[1]); hwif->set_pio_mode = dtc2278_set_pio_mode;
idx[0] = hwif->index;
}
hwif->set_pio_mode = &dtc2278_set_pio_mode; mate = ide_find_port();
if (mate) {
ide_init_port_hw(mate, &hw[1]);
idx[1] = mate->index;
}
ide_device_add(idx, &dtc2278_port_info); ide_device_add(idx, &dtc2278_port_info);
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <asm/atariints.h> #include <asm/atariints.h>
#include <asm/atari_stdma.h> #include <asm/atari_stdma.h>
#define DRV_NAME "falconide"
/* /*
* Base of the IDE interface * Base of the IDE interface
...@@ -74,15 +75,21 @@ static int __init falconide_init(void) ...@@ -74,15 +75,21 @@ static int __init falconide_init(void)
printk(KERN_INFO "ide: Falcon IDE controller\n"); printk(KERN_INFO "ide: Falcon IDE controller\n");
if (!request_mem_region(ATA_HD_BASE, 0x40, DRV_NAME)) {
printk(KERN_ERR "%s: resources busy\n", DRV_NAME);
return -EBUSY;
}
falconide_setup_ports(&hw); falconide_setup_ports(&hw);
hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]); hwif = ide_find_port();
if (hwif) { if (hwif) {
u8 index = hwif->index; u8 index = hwif->index;
u8 idx[4] = { index, 0xff, 0xff, 0xff }; u8 idx[4] = { index, 0xff, 0xff, 0xff };
ide_init_port_data(hwif, index); ide_init_port_data(hwif, index);
ide_init_port_hw(hwif, &hw); ide_init_port_hw(hwif, &hw);
hwif->mmio = 1;
ide_get_lock(NULL, NULL); ide_get_lock(NULL, NULL);
ide_device_add(idx, NULL); ide_device_add(idx, NULL);
......
...@@ -175,7 +175,7 @@ static int __init gayle_init(void) ...@@ -175,7 +175,7 @@ static int __init gayle_init(void)
gayle_setup_ports(&hw, base, ctrlport, irqport, ack_intr); gayle_setup_ports(&hw, base, ctrlport, irqport, ack_intr);
hwif = ide_find_port(base); hwif = ide_find_port();
if (hwif) { if (hwif) {
u8 index = hwif->index; u8 index = hwif->index;
......
...@@ -122,7 +122,7 @@ static int hd_error; ...@@ -122,7 +122,7 @@ static int hd_error;
* This struct defines the HD's and their types. * This struct defines the HD's and their types.
*/ */
struct hd_i_struct { struct hd_i_struct {
unsigned int head,sect,cyl,wpcom,lzone,ctl; unsigned int head, sect, cyl, wpcom, lzone, ctl;
int unit; int unit;
int recalibrate; int recalibrate;
int special_op; int special_op;
...@@ -183,7 +183,7 @@ static void __init hd_setup(char *str, int *ints) ...@@ -183,7 +183,7 @@ static void __init hd_setup(char *str, int *ints)
if (ints[0] != 3) if (ints[0] != 3)
return; return;
if (hd_info[0].head != 0) if (hd_info[0].head != 0)
hdind=1; hdind = 1;
hd_info[hdind].head = ints[2]; hd_info[hdind].head = ints[2];
hd_info[hdind].sect = ints[3]; hd_info[hdind].sect = ints[3];
hd_info[hdind].cyl = ints[1]; hd_info[hdind].cyl = ints[1];
...@@ -193,7 +193,7 @@ static void __init hd_setup(char *str, int *ints) ...@@ -193,7 +193,7 @@ static void __init hd_setup(char *str, int *ints)
NR_HD = hdind+1; NR_HD = hdind+1;
} }
static void dump_status (const char *msg, unsigned int stat) static void dump_status(const char *msg, unsigned int stat)
{ {
char *name = "hd?"; char *name = "hd?";
if (CURRENT) if (CURRENT)
...@@ -291,7 +291,6 @@ static int controller_ready(unsigned int drive, unsigned int head) ...@@ -291,7 +291,6 @@ static int controller_ready(unsigned int drive, unsigned int head)
return 0; return 0;
} }
static void hd_out(struct hd_i_struct *disk, static void hd_out(struct hd_i_struct *disk,
unsigned int nsect, unsigned int nsect,
unsigned int sect, unsigned int sect,
...@@ -313,15 +312,15 @@ static void hd_out(struct hd_i_struct *disk, ...@@ -313,15 +312,15 @@ static void hd_out(struct hd_i_struct *disk,
return; return;
} }
SET_HANDLER(intr_addr); SET_HANDLER(intr_addr);
outb_p(disk->ctl,HD_CMD); outb_p(disk->ctl, HD_CMD);
port=HD_DATA; port = HD_DATA;
outb_p(disk->wpcom>>2,++port); outb_p(disk->wpcom >> 2, ++port);
outb_p(nsect,++port); outb_p(nsect, ++port);
outb_p(sect,++port); outb_p(sect, ++port);
outb_p(cyl,++port); outb_p(cyl, ++port);
outb_p(cyl>>8,++port); outb_p(cyl >> 8, ++port);
outb_p(0xA0|(disk->unit<<4)|head,++port); outb_p(0xA0 | (disk->unit << 4) | head, ++port);
outb_p(cmd,++port); outb_p(cmd, ++port);
} }
static void hd_request (void); static void hd_request (void);
...@@ -344,14 +343,14 @@ static void reset_controller(void) ...@@ -344,14 +343,14 @@ static void reset_controller(void)
{ {
int i; int i;
outb_p(4,HD_CMD); outb_p(4, HD_CMD);
for(i = 0; i < 1000; i++) barrier(); for (i = 0; i < 1000; i++) barrier();
outb_p(hd_info[0].ctl & 0x0f,HD_CMD); outb_p(hd_info[0].ctl & 0x0f, HD_CMD);
for(i = 0; i < 1000; i++) barrier(); for (i = 0; i < 1000; i++) barrier();
if (drive_busy()) if (drive_busy())
printk("hd: controller still busy\n"); printk("hd: controller still busy\n");
else if ((hd_error = inb(HD_ERROR)) != 1) else if ((hd_error = inb(HD_ERROR)) != 1)
printk("hd: controller reset failed: %02x\n",hd_error); printk("hd: controller reset failed: %02x\n", hd_error);
} }
static void reset_hd(void) static void reset_hd(void)
...@@ -371,8 +370,8 @@ static void reset_hd(void) ...@@ -371,8 +370,8 @@ static void reset_hd(void)
if (++i < NR_HD) { if (++i < NR_HD) {
struct hd_i_struct *disk = &hd_info[i]; struct hd_i_struct *disk = &hd_info[i];
disk->special_op = disk->recalibrate = 1; disk->special_op = disk->recalibrate = 1;
hd_out(disk,disk->sect,disk->sect,disk->head-1, hd_out(disk, disk->sect, disk->sect, disk->head-1,
disk->cyl,WIN_SPECIFY,&reset_hd); disk->cyl, WIN_SPECIFY, &reset_hd);
if (reset) if (reset)
goto repeat; goto repeat;
} else } else
...@@ -393,7 +392,7 @@ static void unexpected_hd_interrupt(void) ...@@ -393,7 +392,7 @@ static void unexpected_hd_interrupt(void)
unsigned int stat = inb_p(HD_STATUS); unsigned int stat = inb_p(HD_STATUS);
if (stat & (BUSY_STAT|DRQ_STAT|ECC_STAT|ERR_STAT)) { if (stat & (BUSY_STAT|DRQ_STAT|ECC_STAT|ERR_STAT)) {
dump_status ("unexpected interrupt", stat); dump_status("unexpected interrupt", stat);
SET_TIMER; SET_TIMER;
} }
} }
...@@ -453,7 +452,7 @@ static void read_intr(void) ...@@ -453,7 +452,7 @@ static void read_intr(void)
return; return;
ok_to_read: ok_to_read:
req = CURRENT; req = CURRENT;
insw(HD_DATA,req->buffer,256); insw(HD_DATA, req->buffer, 256);
req->sector++; req->sector++;
req->buffer += 512; req->buffer += 512;
req->errors = 0; req->errors = 0;
...@@ -507,7 +506,7 @@ static void write_intr(void) ...@@ -507,7 +506,7 @@ static void write_intr(void)
end_request(req, 1); end_request(req, 1);
if (i > 0) { if (i > 0) {
SET_HANDLER(&write_intr); SET_HANDLER(&write_intr);
outsw(HD_DATA,req->buffer,256); outsw(HD_DATA, req->buffer, 256);
local_irq_enable(); local_irq_enable();
} else { } else {
#if (HD_DELAY > 0) #if (HD_DELAY > 0)
...@@ -560,11 +559,11 @@ static int do_special_op(struct hd_i_struct *disk, struct request *req) ...@@ -560,11 +559,11 @@ static int do_special_op(struct hd_i_struct *disk, struct request *req)
{ {
if (disk->recalibrate) { if (disk->recalibrate) {
disk->recalibrate = 0; disk->recalibrate = 0;
hd_out(disk,disk->sect,0,0,0,WIN_RESTORE,&recal_intr); hd_out(disk, disk->sect, 0, 0, 0, WIN_RESTORE, &recal_intr);
return reset; return reset;
} }
if (disk->head > 16) { if (disk->head > 16) {
printk ("%s: cannot handle device with more than 16 heads - giving up\n", req->rq_disk->disk_name); printk("%s: cannot handle device with more than 16 heads - giving up\n", req->rq_disk->disk_name);
end_request(req, 0); end_request(req, 0);
} }
disk->special_op = 0; disk->special_op = 0;
...@@ -633,19 +632,21 @@ static void hd_request(void) ...@@ -633,19 +632,21 @@ static void hd_request(void)
if (blk_fs_request(req)) { if (blk_fs_request(req)) {
switch (rq_data_dir(req)) { switch (rq_data_dir(req)) {
case READ: case READ:
hd_out(disk,nsect,sec,head,cyl,WIN_READ,&read_intr); hd_out(disk, nsect, sec, head, cyl, WIN_READ,
&read_intr);
if (reset) if (reset)
goto repeat; goto repeat;
break; break;
case WRITE: case WRITE:
hd_out(disk,nsect,sec,head,cyl,WIN_WRITE,&write_intr); hd_out(disk, nsect, sec, head, cyl, WIN_WRITE,
&write_intr);
if (reset) if (reset)
goto repeat; goto repeat;
if (wait_DRQ()) { if (wait_DRQ()) {
bad_rw_intr(); bad_rw_intr();
goto repeat; goto repeat;
} }
outsw(HD_DATA,req->buffer,256); outsw(HD_DATA, req->buffer, 256);
break; break;
default: default:
printk("unknown hd-command\n"); printk("unknown hd-command\n");
...@@ -655,7 +656,7 @@ static void hd_request(void) ...@@ -655,7 +656,7 @@ static void hd_request(void)
} }
} }
static void do_hd_request (struct request_queue * q) static void do_hd_request(struct request_queue *q)
{ {
disable_irq(HD_IRQ); disable_irq(HD_IRQ);
hd_request(); hd_request();
...@@ -708,12 +709,12 @@ static int __init hd_init(void) ...@@ -708,12 +709,12 @@ static int __init hd_init(void)
{ {
int drive; int drive;
if (register_blkdev(MAJOR_NR,"hd")) if (register_blkdev(MAJOR_NR, "hd"))
return -1; return -1;
hd_queue = blk_init_queue(do_hd_request, &hd_lock); hd_queue = blk_init_queue(do_hd_request, &hd_lock);
if (!hd_queue) { if (!hd_queue) {
unregister_blkdev(MAJOR_NR,"hd"); unregister_blkdev(MAJOR_NR, "hd");
return -ENOMEM; return -ENOMEM;
} }
...@@ -742,7 +743,7 @@ static int __init hd_init(void) ...@@ -742,7 +743,7 @@ static int __init hd_init(void)
goto out; goto out;
} }
for (drive=0 ; drive < NR_HD ; drive++) { for (drive = 0 ; drive < NR_HD ; drive++) {
struct gendisk *disk = alloc_disk(64); struct gendisk *disk = alloc_disk(64);
struct hd_i_struct *p = &hd_info[drive]; struct hd_i_struct *p = &hd_info[drive];
if (!disk) if (!disk)
...@@ -756,7 +757,7 @@ static int __init hd_init(void) ...@@ -756,7 +757,7 @@ static int __init hd_init(void)
disk->queue = hd_queue; disk->queue = hd_queue;
p->unit = drive; p->unit = drive;
hd_gendisk[drive] = disk; hd_gendisk[drive] = disk;
printk ("%s: %luMB, CHS=%d/%d/%d\n", printk("%s: %luMB, CHS=%d/%d/%d\n",
disk->disk_name, (unsigned long)get_capacity(disk)/2048, disk->disk_name, (unsigned long)get_capacity(disk)/2048,
p->cyl, p->head, p->sect); p->cyl, p->head, p->sect);
} }
...@@ -776,7 +777,7 @@ static int __init hd_init(void) ...@@ -776,7 +777,7 @@ static int __init hd_init(void)
} }
/* Let them fly */ /* Let them fly */
for(drive=0; drive < NR_HD; drive++) for (drive = 0; drive < NR_HD; drive++)
add_disk(hd_gendisk[drive]); add_disk(hd_gendisk[drive]);
return 0; return 0;
...@@ -791,7 +792,7 @@ static int __init hd_init(void) ...@@ -791,7 +792,7 @@ static int __init hd_init(void)
NR_HD = 0; NR_HD = 0;
out: out:
del_timer(&device_timer); del_timer(&device_timer);
unregister_blkdev(MAJOR_NR,"hd"); unregister_blkdev(MAJOR_NR, "hd");
blk_cleanup_queue(hd_queue); blk_cleanup_queue(hd_queue);
return -1; return -1;
Enomem: Enomem:
...@@ -800,7 +801,8 @@ static int __init hd_init(void) ...@@ -800,7 +801,8 @@ static int __init hd_init(void)
goto out; goto out;
} }
static int __init parse_hd_setup (char *line) { static int __init parse_hd_setup(char *line)
{
int ints[6]; int ints[6];
(void) get_options(line, ARRAY_SIZE(ints), ints); (void) get_options(line, ARRAY_SIZE(ints), ints);
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
* Try: http://www.maf.iki.fi/~maf/ht6560b/ * Try: http://www.maf.iki.fi/~maf/ht6560b/
*/ */
#define DRV_NAME "ht6560b"
#define HT6560B_VERSION "v0.08" #define HT6560B_VERSION "v0.08"
#include <linux/module.h> #include <linux/module.h>
...@@ -339,16 +340,13 @@ static const struct ide_port_info ht6560b_port_info __initdata = { ...@@ -339,16 +340,13 @@ static const struct ide_port_info ht6560b_port_info __initdata = {
static int __init ht6560b_init(void) static int __init ht6560b_init(void)
{ {
ide_hwif_t *hwif, *mate; ide_hwif_t *hwif, *mate;
static u8 idx[4] = { 0, 1, 0xff, 0xff }; static u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
hw_regs_t hw[2]; hw_regs_t hw[2];
if (probe_ht6560b == 0) if (probe_ht6560b == 0)
return -ENODEV; return -ENODEV;
hwif = &ide_hwifs[0]; if (!request_region(HT_CONFIG_PORT, 1, DRV_NAME)) {
mate = &ide_hwifs[1];
if (!request_region(HT_CONFIG_PORT, 1, hwif->name)) {
printk(KERN_NOTICE "%s: HT_CONFIG_PORT not found\n", printk(KERN_NOTICE "%s: HT_CONFIG_PORT not found\n",
__FUNCTION__); __FUNCTION__);
return -ENODEV; return -ENODEV;
...@@ -367,17 +365,23 @@ static int __init ht6560b_init(void) ...@@ -367,17 +365,23 @@ static int __init ht6560b_init(void)
ide_std_init_ports(&hw[1], 0x170, 0x376); ide_std_init_ports(&hw[1], 0x170, 0x376);
hw[1].irq = 15; hw[1].irq = 15;
hwif = ide_find_port();
if (hwif) {
ide_init_port_hw(hwif, &hw[0]); ide_init_port_hw(hwif, &hw[0]);
ide_init_port_hw(mate, &hw[1]); hwif->selectproc = ht6560b_selectproc;
hwif->set_pio_mode = ht6560b_set_pio_mode;
hwif->selectproc = &ht6560b_selectproc;
hwif->set_pio_mode = &ht6560b_set_pio_mode;
mate->selectproc = &ht6560b_selectproc;
mate->set_pio_mode = &ht6560b_set_pio_mode;
hwif->port_init_devs = ht6560b_port_init_devs; hwif->port_init_devs = ht6560b_port_init_devs;
idx[0] = hwif->index;
}
mate = ide_find_port();
if (mate) {
ide_init_port_hw(mate, &hw[1]);
mate->selectproc = ht6560b_selectproc;
mate->set_pio_mode = ht6560b_set_pio_mode;
mate->port_init_devs = ht6560b_port_init_devs; mate->port_init_devs = ht6560b_port_init_devs;
idx[1] = mate->index;
}
ide_device_add(idx, &ht6560b_port_info); ide_device_add(idx, &ht6560b_port_info);
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/ide.h> #include <linux/ide.h>
int probe_4drives = 0; int probe_4drives;
module_param_named(probe, probe_4drives, bool, 0); module_param_named(probe, probe_4drives, bool, 0);
MODULE_PARM_DESC(probe, "probe for generic IDE chipset with 4 drives/port"); MODULE_PARM_DESC(probe, "probe for generic IDE chipset with 4 drives/port");
...@@ -12,31 +12,37 @@ MODULE_PARM_DESC(probe, "probe for generic IDE chipset with 4 drives/port"); ...@@ -12,31 +12,37 @@ MODULE_PARM_DESC(probe, "probe for generic IDE chipset with 4 drives/port");
static int __init ide_4drives_init(void) static int __init ide_4drives_init(void)
{ {
ide_hwif_t *hwif, *mate; ide_hwif_t *hwif, *mate;
u8 idx[4] = { 0, 1, 0xff, 0xff }; u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
hw_regs_t hw; hw_regs_t hw;
if (probe_4drives == 0) if (probe_4drives == 0)
return -ENODEV; return -ENODEV;
hwif = &ide_hwifs[0];
mate = &ide_hwifs[1];
memset(&hw, 0, sizeof(hw)); memset(&hw, 0, sizeof(hw));
ide_std_init_ports(&hw, 0x1f0, 0x3f6); ide_std_init_ports(&hw, 0x1f0, 0x3f6);
hw.irq = 14; hw.irq = 14;
hw.chipset = ide_4drives; hw.chipset = ide_4drives;
hwif = ide_find_port();
if (hwif) {
ide_init_port_hw(hwif, &hw); ide_init_port_hw(hwif, &hw);
ide_init_port_hw(mate, &hw); idx[0] = hwif->index;
}
mate = ide_find_port();
if (mate) {
ide_init_port_hw(mate, &hw);
mate->drives[0].select.all ^= 0x20; mate->drives[0].select.all ^= 0x20;
mate->drives[1].select.all ^= 0x20; mate->drives[1].select.all ^= 0x20;
idx[1] = mate->index;
if (hwif) {
hwif->mate = mate; hwif->mate = mate;
mate->mate = hwif; mate->mate = hwif;
hwif->serialized = mate->serialized = 1; hwif->serialized = mate->serialized = 1;
}
}
ide_device_add(idx, NULL); ide_device_add(idx, NULL);
......
...@@ -156,7 +156,7 @@ static int idecs_register(unsigned long io, unsigned long ctl, unsigned long irq ...@@ -156,7 +156,7 @@ static int idecs_register(unsigned long io, unsigned long ctl, unsigned long irq
hw.chipset = ide_pci; hw.chipset = ide_pci;
hw.dev = &handle->dev; hw.dev = &handle->dev;
hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]); hwif = ide_find_port();
if (hwif == NULL) if (hwif == NULL)
return -1; return -1;
......
...@@ -89,7 +89,7 @@ static int __devinit plat_ide_probe(struct platform_device *pdev) ...@@ -89,7 +89,7 @@ static int __devinit plat_ide_probe(struct platform_device *pdev)
res_alt->start, res_alt->end - res_alt->start + 1); res_alt->start, res_alt->end - res_alt->start + 1);
} }
hwif = ide_find_port((unsigned long)base); hwif = ide_find_port();
if (!hwif) { if (!hwif) {
ret = -ENODEV; ret = -ENODEV;
goto out; goto out;
...@@ -100,11 +100,10 @@ static int __devinit plat_ide_probe(struct platform_device *pdev) ...@@ -100,11 +100,10 @@ static int __devinit plat_ide_probe(struct platform_device *pdev)
hw.dev = &pdev->dev; hw.dev = &pdev->dev;
ide_init_port_hw(hwif, &hw); ide_init_port_hw(hwif, &hw);
if (mmio) {
hwif->mmio = 1; hwif->mmio = 1;
if (mmio)
default_hwif_mmiops(hwif); default_hwif_mmiops(hwif);
}
idx[0] = hwif->index; idx[0] = hwif->index;
......
...@@ -120,7 +120,7 @@ static int __init macide_init(void) ...@@ -120,7 +120,7 @@ static int __init macide_init(void)
macide_setup_ports(&hw, base, irq, ack_intr); macide_setup_ports(&hw, base, irq, ack_intr);
hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]); hwif = ide_find_port();
if (hwif) { if (hwif) {
u8 index = hwif->index; u8 index = hwif->index;
u8 idx[4] = { index, 0xff, 0xff, 0xff }; u8 idx[4] = { index, 0xff, 0xff, 0xff };
......
...@@ -137,7 +137,7 @@ static int __init q40ide_init(void) ...@@ -137,7 +137,7 @@ static int __init q40ide_init(void)
// m68kide_iops, // m68kide_iops,
q40ide_default_irq(pcide_bases[i])); q40ide_default_irq(pcide_bases[i]));
hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]); hwif = ide_find_port();
if (hwif) { if (hwif) {
ide_init_port_data(hwif, hwif->index); ide_init_port_data(hwif, hwif->index);
ide_init_port_hw(hwif, &hw); ide_init_port_hw(hwif, &hw);
......
...@@ -88,12 +88,12 @@ ...@@ -88,12 +88,12 @@
static int timings[4]={-1,-1,-1,-1}; /* stores current timing for each timer */ static int timings[4]={-1,-1,-1,-1}; /* stores current timing for each timer */
/* /*
* qd_select: * qd65xx_select:
* *
* This routine is invoked from ide.c to prepare for access to a given drive. * This routine is invoked to prepare for access to a given drive.
*/ */
static void qd_select (ide_drive_t *drive) static void qd65xx_select(ide_drive_t *drive)
{ {
u8 index = (( (QD_TIMREG(drive)) & 0x80 ) >> 7) | u8 index = (( (QD_TIMREG(drive)) & 0x80 ) >> 7) |
(QD_TIMREG(drive) & 0x02); (QD_TIMREG(drive) & 0x02);
...@@ -167,37 +167,16 @@ static int qd_find_disk_type (ide_drive_t *drive, ...@@ -167,37 +167,16 @@ static int qd_find_disk_type (ide_drive_t *drive,
return 0; return 0;
} }
/*
* qd_timing_ok:
*
* check whether timings don't conflict
*/
static int qd_timing_ok (ide_drive_t drives[])
{
return (IDE_IMPLY(drives[0].present && drives[1].present,
IDE_IMPLY(QD_TIMREG(drives) == QD_TIMREG(drives+1),
QD_TIMING(drives) == QD_TIMING(drives+1))));
/* if same timing register, must be same timing */
}
/* /*
* qd_set_timing: * qd_set_timing:
* *
* records the timing, and enables selectproc as needed * records the timing
*/ */
static void qd_set_timing (ide_drive_t *drive, u8 timing) static void qd_set_timing (ide_drive_t *drive, u8 timing)
{ {
ide_hwif_t *hwif = HWIF(drive);
drive->drive_data &= 0xff00; drive->drive_data &= 0xff00;
drive->drive_data |= timing; drive->drive_data |= timing;
if (qd_timing_ok(hwif->drives)) {
qd_select(drive); /* selects once */
hwif->selectproc = NULL;
} else
hwif->selectproc = &qd_select;
printk(KERN_DEBUG "%s: %#x\n", drive->name, timing); printk(KERN_DEBUG "%s: %#x\n", drive->name, timing);
} }
...@@ -225,10 +204,11 @@ static void qd6500_set_pio_mode(ide_drive_t *drive, const u8 pio) ...@@ -225,10 +204,11 @@ static void qd6500_set_pio_mode(ide_drive_t *drive, const u8 pio)
static void qd6580_set_pio_mode(ide_drive_t *drive, const u8 pio) static void qd6580_set_pio_mode(ide_drive_t *drive, const u8 pio)
{ {
int base = HWIF(drive)->select_data; ide_hwif_t *hwif = drive->hwif;
unsigned int cycle_time; unsigned int cycle_time;
int active_time = 175; int active_time = 175;
int recovery_time = 415; /* worst case values from the dos driver */ int recovery_time = 415; /* worst case values from the dos driver */
u8 base = (hwif->config_data & 0xff00) >> 8;
if (drive->id && !qd_find_disk_type(drive, &active_time, &recovery_time)) { if (drive->id && !qd_find_disk_type(drive, &active_time, &recovery_time)) {
cycle_time = ide_pio_cycle_time(drive, pio); cycle_time = ide_pio_cycle_time(drive, pio);
...@@ -299,21 +279,10 @@ static int __init qd_testreg(int port) ...@@ -299,21 +279,10 @@ static int __init qd_testreg(int port)
return (readreg != QD_TESTVAL); return (readreg != QD_TESTVAL);
} }
/*
* qd_setup:
*
* called to setup an ata channel : adjusts attributes & links for tuning
*/
static void __init qd_setup(ide_hwif_t *hwif, int base, int config)
{
hwif->select_data = base;
hwif->config_data = config;
}
static void __init qd6500_port_init_devs(ide_hwif_t *hwif) static void __init qd6500_port_init_devs(ide_hwif_t *hwif)
{ {
u8 base = hwif->select_data, config = QD_CONFIG(hwif); u8 base = (hwif->config_data & 0xff00) >> 8;
u8 config = QD_CONFIG(hwif);
hwif->drives[0].drive_data = QD6500_DEF_DATA; hwif->drives[0].drive_data = QD6500_DEF_DATA;
hwif->drives[1].drive_data = QD6500_DEF_DATA; hwif->drives[1].drive_data = QD6500_DEF_DATA;
...@@ -322,9 +291,10 @@ static void __init qd6500_port_init_devs(ide_hwif_t *hwif) ...@@ -322,9 +291,10 @@ static void __init qd6500_port_init_devs(ide_hwif_t *hwif)
static void __init qd6580_port_init_devs(ide_hwif_t *hwif) static void __init qd6580_port_init_devs(ide_hwif_t *hwif)
{ {
u16 t1, t2; u16 t1, t2;
u8 base = hwif->select_data, config = QD_CONFIG(hwif); u8 base = (hwif->config_data & 0xff00) >> 8;
u8 config = QD_CONFIG(hwif);
if (QD_CONTROL(hwif) & QD_CONTR_SEC_DISABLED) { if (hwif->host_flags & IDE_HFLAG_SINGLE) {
t1 = QD6580_DEF_DATA; t1 = QD6580_DEF_DATA;
t2 = QD6580_DEF_DATA2; t2 = QD6580_DEF_DATA2;
} else } else
...@@ -355,14 +325,18 @@ static int __init qd_probe(int base) ...@@ -355,14 +325,18 @@ static int __init qd_probe(int base)
u8 config, unit; u8 config, unit;
u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
hw_regs_t hw[2]; hw_regs_t hw[2];
struct ide_port_info d = qd65xx_port_info;
config = inb(QD_CONFIG_PORT); config = inb(QD_CONFIG_PORT);
if (! ((config & QD_CONFIG_BASEPORT) >> 1 == (base == 0xb0)) ) if (! ((config & QD_CONFIG_BASEPORT) >> 1 == (base == 0xb0)) )
return 1; return -ENODEV;
unit = ! (config & QD_CONFIG_IDE_BASEPORT); unit = ! (config & QD_CONFIG_IDE_BASEPORT);
if (unit)
d.host_flags |= IDE_HFLAG_QD_2ND_PORT;
memset(&hw, 0, sizeof(hw)); memset(&hw, 0, sizeof(hw));
ide_std_init_ports(&hw[0], 0x1f0, 0x3f6); ide_std_init_ports(&hw[0], 0x1f0, 0x3f6);
...@@ -373,30 +347,37 @@ static int __init qd_probe(int base) ...@@ -373,30 +347,37 @@ static int __init qd_probe(int base)
if ((config & 0xf0) == QD_CONFIG_QD6500) { if ((config & 0xf0) == QD_CONFIG_QD6500) {
if (qd_testreg(base)) return 1; /* bad register */ if (qd_testreg(base))
return -ENODEV; /* bad register */
/* qd6500 found */ /* qd6500 found */
hwif = &ide_hwifs[unit];
printk(KERN_NOTICE "%s: qd6500 at %#x\n", hwif->name, base);
printk(KERN_DEBUG "qd6500: config=%#x, ID3=%u\n",
config, QD_ID3);
if (config & QD_CONFIG_DISABLED) { if (config & QD_CONFIG_DISABLED) {
printk(KERN_WARNING "qd6500 is disabled !\n"); printk(KERN_WARNING "qd6500 is disabled !\n");
return 1; return -ENODEV;
} }
printk(KERN_NOTICE "qd6500 at %#x\n", base);
printk(KERN_DEBUG "qd6500: config=%#x, ID3=%u\n",
config, QD_ID3);
d.host_flags |= IDE_HFLAG_SINGLE;
hwif = ide_find_port_slot(&d);
if (hwif == NULL)
return -ENOENT;
ide_init_port_hw(hwif, &hw[unit]); ide_init_port_hw(hwif, &hw[unit]);
qd_setup(hwif, base, config); hwif->config_data = (base << 8) | config;
hwif->port_init_devs = qd6500_port_init_devs; hwif->port_init_devs = qd6500_port_init_devs;
hwif->set_pio_mode = &qd6500_set_pio_mode; hwif->set_pio_mode = qd6500_set_pio_mode;
hwif->selectproc = qd65xx_select;
idx[unit] = unit; idx[unit] = hwif->index;
ide_device_add(idx, &qd65xx_port_info); ide_device_add(idx, &d);
return 1; return 1;
} }
...@@ -406,8 +387,8 @@ static int __init qd_probe(int base) ...@@ -406,8 +387,8 @@ static int __init qd_probe(int base)
u8 control; u8 control;
if (qd_testreg(base) || qd_testreg(base+0x02)) return 1; if (qd_testreg(base) || qd_testreg(base + 0x02))
/* bad registers */ return -ENODEV; /* bad registers */
/* qd6580 found */ /* qd6580 found */
...@@ -422,46 +403,52 @@ static int __init qd_probe(int base) ...@@ -422,46 +403,52 @@ static int __init qd_probe(int base)
if (control & QD_CONTR_SEC_DISABLED) { if (control & QD_CONTR_SEC_DISABLED) {
/* secondary disabled */ /* secondary disabled */
hwif = &ide_hwifs[unit]; printk(KERN_INFO "qd6580: single IDE board\n");
printk(KERN_INFO "%s: qd6580: single IDE board\n",
hwif->name); d.host_flags |= IDE_HFLAG_SINGLE;
hwif = ide_find_port_slot(&d);
if (hwif == NULL)
return -ENOENT;
ide_init_port_hw(hwif, &hw[unit]); ide_init_port_hw(hwif, &hw[unit]);
qd_setup(hwif, base, config | (control << 8)); hwif->config_data = (base << 8) | config;
hwif->port_init_devs = qd6580_port_init_devs; hwif->port_init_devs = qd6580_port_init_devs;
hwif->set_pio_mode = &qd6580_set_pio_mode; hwif->set_pio_mode = qd6580_set_pio_mode;
hwif->selectproc = qd65xx_select;
idx[unit] = unit; idx[unit] = hwif->index;
ide_device_add(idx, &qd65xx_port_info); ide_device_add(idx, &d);
return 1; return 1;
} else { } else {
ide_hwif_t *mate; ide_hwif_t *mate;
hwif = &ide_hwifs[0];
mate = &ide_hwifs[1];
/* secondary enabled */ /* secondary enabled */
printk(KERN_INFO "%s&%s: qd6580: dual IDE board\n", printk(KERN_INFO "qd6580: dual IDE board\n");
hwif->name, mate->name);
hwif = ide_find_port();
if (hwif) {
ide_init_port_hw(hwif, &hw[0]); ide_init_port_hw(hwif, &hw[0]);
ide_init_port_hw(mate, &hw[1]); hwif->config_data = (base << 8) | config;
qd_setup(hwif, base, config | (control << 8));
hwif->port_init_devs = qd6580_port_init_devs; hwif->port_init_devs = qd6580_port_init_devs;
hwif->set_pio_mode = &qd6580_set_pio_mode; hwif->set_pio_mode = qd6580_set_pio_mode;
hwif->selectproc = qd65xx_select;
qd_setup(mate, base, config | (control << 8)); idx[0] = hwif->index;
}
mate = ide_find_port();
if (mate) {
ide_init_port_hw(mate, &hw[1]);
mate->config_data = (base << 8) | config;
mate->port_init_devs = qd6580_port_init_devs; mate->port_init_devs = qd6580_port_init_devs;
mate->set_pio_mode = &qd6580_set_pio_mode; mate->set_pio_mode = qd6580_set_pio_mode;
mate->selectproc = qd65xx_select;
idx[0] = 0; idx[1] = mate->index;
idx[1] = 1; }
ide_device_add(idx, &qd65xx_port_info); ide_device_add(idx, &qd65xx_port_info);
...@@ -469,7 +456,7 @@ static int __init qd_probe(int base) ...@@ -469,7 +456,7 @@ static int __init qd_probe(int base)
} }
} }
/* no qd65xx found */ /* no qd65xx found */
return 1; return -ENODEV;
} }
int probe_qd65xx = 0; int probe_qd65xx = 0;
...@@ -479,14 +466,18 @@ MODULE_PARM_DESC(probe, "probe for QD65xx chipsets"); ...@@ -479,14 +466,18 @@ MODULE_PARM_DESC(probe, "probe for QD65xx chipsets");
static int __init qd65xx_init(void) static int __init qd65xx_init(void)
{ {
int rc1, rc2 = -ENODEV;
if (probe_qd65xx == 0) if (probe_qd65xx == 0)
return -ENODEV; return -ENODEV;
if (qd_probe(0x30)) rc1 = qd_probe(0x30);
qd_probe(0xb0); if (rc1)
if (ide_hwifs[0].chipset != ide_qd65xx && rc2 = qd_probe(0xb0);
ide_hwifs[1].chipset != ide_qd65xx)
if (rc1 < 0 && rc2 < 0)
return -ENODEV; return -ENODEV;
return 0; return 0;
} }
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#define QD_ID3 ((config & QD_CONFIG_ID3)!=0) #define QD_ID3 ((config & QD_CONFIG_ID3)!=0)
#define QD_CONFIG(hwif) ((hwif)->config_data & 0x00ff) #define QD_CONFIG(hwif) ((hwif)->config_data & 0x00ff)
#define QD_CONTROL(hwif) (((hwif)->config_data & 0xff00) >> 8)
#define QD_TIMING(drive) (byte)(((drive)->drive_data) & 0x00ff) #define QD_TIMING(drive) (byte)(((drive)->drive_data) & 0x00ff)
#define QD_TIMREG(drive) (byte)((((drive)->drive_data) & 0xff00) >> 8) #define QD_TIMREG(drive) (byte)((((drive)->drive_data) & 0xff00) >> 8)
......
...@@ -60,62 +60,62 @@ ...@@ -60,62 +60,62 @@
#define UMC_DRIVE3 1 /* In case of crash reduce speed */ #define UMC_DRIVE3 1 /* In case of crash reduce speed */
static u8 current_speeds[4] = {UMC_DRIVE0, UMC_DRIVE1, UMC_DRIVE2, UMC_DRIVE3}; static u8 current_speeds[4] = {UMC_DRIVE0, UMC_DRIVE1, UMC_DRIVE2, UMC_DRIVE3};
static const u8 pio_to_umc [5] = {0,3,7,10,11}; /* rough guesses */ static const u8 pio_to_umc [5] = {0, 3, 7, 10, 11}; /* rough guesses */
/* 0 1 2 3 4 5 6 7 8 9 10 11 */ /* 0 1 2 3 4 5 6 7 8 9 10 11 */
static const u8 speedtab [3][12] = { static const u8 speedtab [3][12] = {
{0xf, 0xb, 0x2, 0x2, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1 }, {0x0f, 0x0b, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x1},
{0x3, 0x2, 0x2, 0x2, 0x2, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1 }, {0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x1},
{0xff,0xcb,0xc0,0x58,0x36,0x33,0x23,0x22,0x21,0x11,0x10,0x0}}; {0xff, 0xcb, 0xc0, 0x58, 0x36, 0x33, 0x23, 0x22, 0x21, 0x11, 0x10, 0x0}
};
static void out_umc (char port,char wert) static void out_umc(char port, char wert)
{ {
outb_p(port,0x108); outb_p(port, 0x108);
outb_p(wert,0x109); outb_p(wert, 0x109);
} }
static inline u8 in_umc (char port) static inline u8 in_umc(char port)
{ {
outb_p(port,0x108); outb_p(port, 0x108);
return inb_p(0x109); return inb_p(0x109);
} }
static void umc_set_speeds (u8 speeds[]) static void umc_set_speeds(u8 speeds[])
{ {
int i, tmp; int i, tmp;
outb_p(0x5A,0x108); /* enable umc */ outb_p(0x5A, 0x108); /* enable umc */
out_umc (0xd7,(speedtab[0][speeds[2]] | (speedtab[0][speeds[3]]<<4))); out_umc(0xd7, (speedtab[0][speeds[2]] | (speedtab[0][speeds[3]]<<4)));
out_umc (0xd6,(speedtab[0][speeds[0]] | (speedtab[0][speeds[1]]<<4))); out_umc(0xd6, (speedtab[0][speeds[0]] | (speedtab[0][speeds[1]]<<4)));
tmp = 0; tmp = 0;
for (i = 3; i >= 0; i--) { for (i = 3; i >= 0; i--)
tmp = (tmp << 2) | speedtab[1][speeds[i]]; tmp = (tmp << 2) | speedtab[1][speeds[i]];
out_umc(0xdc, tmp);
for (i = 0; i < 4; i++) {
out_umc(0xd0 + i, speedtab[2][speeds[i]]);
out_umc(0xd8 + i, speedtab[2][speeds[i]]);
} }
out_umc (0xdc,tmp); outb_p(0xa5, 0x108); /* disable umc */
for (i = 0;i < 4; i++) {
out_umc (0xd0+i,speedtab[2][speeds[i]]);
out_umc (0xd8+i,speedtab[2][speeds[i]]);
}
outb_p(0xa5,0x108); /* disable umc */
printk ("umc8672: drive speeds [0 to 11]: %d %d %d %d\n", printk("umc8672: drive speeds [0 to 11]: %d %d %d %d\n",
speeds[0], speeds[1], speeds[2], speeds[3]); speeds[0], speeds[1], speeds[2], speeds[3]);
} }
static void umc_set_pio_mode(ide_drive_t *drive, const u8 pio) static void umc_set_pio_mode(ide_drive_t *drive, const u8 pio)
{ {
ide_hwif_t *hwif = drive->hwif;
unsigned long flags; unsigned long flags;
ide_hwgroup_t *hwgroup = ide_hwifs[HWIF(drive)->index^1].hwgroup;
printk("%s: setting umc8672 to PIO mode%d (speed %d)\n", printk("%s: setting umc8672 to PIO mode%d (speed %d)\n",
drive->name, pio, pio_to_umc[pio]); drive->name, pio, pio_to_umc[pio]);
spin_lock_irqsave(&ide_lock, flags); spin_lock_irqsave(&ide_lock, flags);
if (hwgroup && hwgroup->handler != NULL) { if (hwif->mate && hwif->mate->hwgroup->handler) {
printk(KERN_ERR "umc8672: other interface is busy: exiting tune_umc()\n"); printk(KERN_ERR "umc8672: other interface is busy: exiting tune_umc()\n");
} else { } else {
current_speeds[drive->name[2] - 'a'] = pio_to_umc[pio]; current_speeds[drive->name[2] - 'a'] = pio_to_umc[pio];
umc_set_speeds (current_speeds); umc_set_speeds(current_speeds);
} }
spin_unlock_irqrestore(&ide_lock, flags); spin_unlock_irqrestore(&ide_lock, flags);
} }
...@@ -128,8 +128,9 @@ static const struct ide_port_info umc8672_port_info __initdata = { ...@@ -128,8 +128,9 @@ static const struct ide_port_info umc8672_port_info __initdata = {
static int __init umc8672_probe(void) static int __init umc8672_probe(void)
{ {
ide_hwif_t *hwif, *mate;
unsigned long flags; unsigned long flags;
static u8 idx[4] = { 0, 1, 0xff, 0xff }; static u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
hw_regs_t hw[2]; hw_regs_t hw[2];
if (!request_region(0x108, 2, "umc8672")) { if (!request_region(0x108, 2, "umc8672")) {
...@@ -137,16 +138,16 @@ static int __init umc8672_probe(void) ...@@ -137,16 +138,16 @@ static int __init umc8672_probe(void)
return 1; return 1;
} }
local_irq_save(flags); local_irq_save(flags);
outb_p(0x5A,0x108); /* enable umc */ outb_p(0x5A, 0x108); /* enable umc */
if (in_umc (0xd5) != 0xa0) { if (in_umc (0xd5) != 0xa0) {
local_irq_restore(flags); local_irq_restore(flags);
printk(KERN_ERR "umc8672: not found\n"); printk(KERN_ERR "umc8672: not found\n");
release_region(0x108, 2); release_region(0x108, 2);
return 1; return 1;
} }
outb_p(0xa5,0x108); /* disable umc */ outb_p(0xa5, 0x108); /* disable umc */
umc_set_speeds (current_speeds); umc_set_speeds(current_speeds);
local_irq_restore(flags); local_irq_restore(flags);
memset(&hw, 0, sizeof(hw)); memset(&hw, 0, sizeof(hw));
...@@ -157,18 +158,26 @@ static int __init umc8672_probe(void) ...@@ -157,18 +158,26 @@ static int __init umc8672_probe(void)
ide_std_init_ports(&hw[1], 0x170, 0x376); ide_std_init_ports(&hw[1], 0x170, 0x376);
hw[1].irq = 15; hw[1].irq = 15;
ide_init_port_hw(&ide_hwifs[0], &hw[0]); hwif = ide_find_port();
ide_init_port_hw(&ide_hwifs[1], &hw[1]); if (hwif) {
ide_init_port_hw(hwif, &hw[0]);
hwif->set_pio_mode = umc_set_pio_mode;
idx[0] = hwif->index;
}
ide_hwifs[0].set_pio_mode = &umc_set_pio_mode; mate = ide_find_port();
ide_hwifs[1].set_pio_mode = &umc_set_pio_mode; if (mate) {
ide_init_port_hw(mate, &hw[1]);
mate->set_pio_mode = umc_set_pio_mode;
idx[1] = mate->index;
}
ide_device_add(idx, &umc8672_port_info); ide_device_add(idx, &umc8672_port_info);
return 0; return 0;
} }
int probe_umc8672 = 0; int probe_umc8672;
module_param_named(probe, probe_umc8672, bool, 0); module_param_named(probe, probe_umc8672, bool, 0);
MODULE_PARM_DESC(probe, "probe for UMC8672 chipset"); MODULE_PARM_DESC(probe, "probe for UMC8672 chipset");
......
...@@ -599,9 +599,11 @@ static int au_ide_probe(struct device *dev) ...@@ -599,9 +599,11 @@ static int au_ide_probe(struct device *dev)
goto out; goto out;
} }
/* FIXME: This might possibly break PCMCIA IDE devices */ hwif = ide_find_port();
if (hwif == NULL) {
hwif = &ide_hwifs[pdev->id]; ret = -ENOENT;
goto out;
}
memset(&hw, 0, sizeof(hw)); memset(&hw, 0, sizeof(hw));
auide_setup_ports(&hw, ahwif); auide_setup_ports(&hw, ahwif);
......
...@@ -76,17 +76,12 @@ static int __devinit swarm_ide_probe(struct device *dev) ...@@ -76,17 +76,12 @@ static int __devinit swarm_ide_probe(struct device *dev)
if (!SIBYTE_HAVE_IDE) if (!SIBYTE_HAVE_IDE)
return -ENODEV; return -ENODEV;
/* Find an empty slot. */ hwif = ide_find_port();
for (i = 0; i < MAX_HWIFS; i++) if (hwif == NULL) {
if (!ide_hwifs[i].io_ports[IDE_DATA_OFFSET])
break;
if (i >= MAX_HWIFS) {
printk(KERN_ERR DRV_NAME ": no free slot for interface\n"); printk(KERN_ERR DRV_NAME ": no free slot for interface\n");
return -ENOMEM; return -ENOMEM;
} }
hwif = ide_hwifs + i;
base = ioremap(A_IO_EXT_BASE, 0x800); base = ioremap(A_IO_EXT_BASE, 0x800);
offset = __raw_readq(base + R_IO_EXT_REG(R_IO_EXT_START_ADDR, IDE_CS)); offset = __raw_readq(base + R_IO_EXT_REG(R_IO_EXT_START_ADDR, IDE_CS));
size = __raw_readq(base + R_IO_EXT_REG(R_IO_EXT_MULT_SIZE, IDE_CS)); size = __raw_readq(base + R_IO_EXT_REG(R_IO_EXT_MULT_SIZE, IDE_CS));
......
...@@ -220,7 +220,8 @@ static const struct ide_port_info aec62xx_chipsets[] __devinitdata = { ...@@ -220,7 +220,8 @@ static const struct ide_port_info aec62xx_chipsets[] __devinitdata = {
.init_hwif = init_hwif_aec62xx, .init_hwif = init_hwif_aec62xx,
.enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}},
.host_flags = IDE_HFLAG_NO_ATAPI_DMA | .host_flags = IDE_HFLAG_NO_ATAPI_DMA |
IDE_HFLAG_ABUSE_SET_DMA_MODE, IDE_HFLAG_ABUSE_SET_DMA_MODE |
IDE_HFLAG_NON_BOOTABLE,
.pio_mask = ATA_PIO4, .pio_mask = ATA_PIO4,
.mwdma_mask = ATA_MWDMA2, .mwdma_mask = ATA_MWDMA2,
.udma_mask = ATA_UDMA4, .udma_mask = ATA_UDMA4,
......
...@@ -750,7 +750,6 @@ static const struct ide_port_info ali15x3_chipset __devinitdata = { ...@@ -750,7 +750,6 @@ static const struct ide_port_info ali15x3_chipset __devinitdata = {
.init_chipset = init_chipset_ali15x3, .init_chipset = init_chipset_ali15x3,
.init_hwif = init_hwif_ali15x3, .init_hwif = init_hwif_ali15x3,
.init_dma = init_dma_ali15x3, .init_dma = init_dma_ali15x3,
.host_flags = IDE_HFLAG_BOOTABLE,
.pio_mask = ATA_PIO5, .pio_mask = ATA_PIO5,
.swdma_mask = ATA_SWDMA2, .swdma_mask = ATA_SWDMA2,
.mwdma_mask = ATA_MWDMA2, .mwdma_mask = ATA_MWDMA2,
......
...@@ -219,12 +219,10 @@ static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif) ...@@ -219,12 +219,10 @@ static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif)
#define IDE_HFLAGS_AMD \ #define IDE_HFLAGS_AMD \
(IDE_HFLAG_PIO_NO_BLACKLIST | \ (IDE_HFLAG_PIO_NO_BLACKLIST | \
IDE_HFLAG_PIO_NO_DOWNGRADE | \
IDE_HFLAG_ABUSE_SET_DMA_MODE | \ IDE_HFLAG_ABUSE_SET_DMA_MODE | \
IDE_HFLAG_POST_SET_MODE | \ IDE_HFLAG_POST_SET_MODE | \
IDE_HFLAG_IO_32BIT | \ IDE_HFLAG_IO_32BIT | \
IDE_HFLAG_UNMASK_IRQS | \ IDE_HFLAG_UNMASK_IRQS)
IDE_HFLAG_BOOTABLE)
#define DECLARE_AMD_DEV(name_str, swdma, udma) \ #define DECLARE_AMD_DEV(name_str, swdma, udma) \
{ \ { \
......
...@@ -151,7 +151,7 @@ static const struct ide_port_info atiixp_pci_info[] __devinitdata = { ...@@ -151,7 +151,7 @@ static const struct ide_port_info atiixp_pci_info[] __devinitdata = {
.name = "ATIIXP", .name = "ATIIXP",
.init_hwif = init_hwif_atiixp, .init_hwif = init_hwif_atiixp,
.enablebits = {{0x48,0x01,0x00}, {0x48,0x08,0x00}}, .enablebits = {{0x48,0x01,0x00}, {0x48,0x08,0x00}},
.host_flags = IDE_HFLAG_LEGACY_IRQS | IDE_HFLAG_BOOTABLE, .host_flags = IDE_HFLAG_LEGACY_IRQS,
.pio_mask = ATA_PIO4, .pio_mask = ATA_PIO4,
.mwdma_mask = ATA_MWDMA2, .mwdma_mask = ATA_MWDMA2,
.udma_mask = ATA_UDMA5, .udma_mask = ATA_UDMA5,
...@@ -159,8 +159,7 @@ static const struct ide_port_info atiixp_pci_info[] __devinitdata = { ...@@ -159,8 +159,7 @@ static const struct ide_port_info atiixp_pci_info[] __devinitdata = {
.name = "SB600_PATA", .name = "SB600_PATA",
.init_hwif = init_hwif_atiixp, .init_hwif = init_hwif_atiixp,
.enablebits = {{0x48,0x01,0x00}, {0x00,0x00,0x00}}, .enablebits = {{0x48,0x01,0x00}, {0x00,0x00,0x00}},
.host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_LEGACY_IRQS | .host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_LEGACY_IRQS,
IDE_HFLAG_BOOTABLE,
.pio_mask = ATA_PIO4, .pio_mask = ATA_PIO4,
.mwdma_mask = ATA_MWDMA2, .mwdma_mask = ATA_MWDMA2,
.udma_mask = ATA_UDMA5, .udma_mask = ATA_UDMA5,
......
This diff is collapsed.
...@@ -440,8 +440,7 @@ static const struct ide_port_info cmd64x_chipsets[] __devinitdata = { ...@@ -440,8 +440,7 @@ static const struct ide_port_info cmd64x_chipsets[] __devinitdata = {
.init_hwif = init_hwif_cmd64x, .init_hwif = init_hwif_cmd64x,
.enablebits = {{0x00,0x00,0x00}, {0x51,0x08,0x08}}, .enablebits = {{0x00,0x00,0x00}, {0x51,0x08,0x08}},
.host_flags = IDE_HFLAG_CLEAR_SIMPLEX | .host_flags = IDE_HFLAG_CLEAR_SIMPLEX |
IDE_HFLAG_ABUSE_PREFETCH | IDE_HFLAG_ABUSE_PREFETCH,
IDE_HFLAG_BOOTABLE,
.pio_mask = ATA_PIO5, .pio_mask = ATA_PIO5,
.mwdma_mask = ATA_MWDMA2, .mwdma_mask = ATA_MWDMA2,
.udma_mask = 0x00, /* no udma */ .udma_mask = 0x00, /* no udma */
...@@ -451,7 +450,7 @@ static const struct ide_port_info cmd64x_chipsets[] __devinitdata = { ...@@ -451,7 +450,7 @@ static const struct ide_port_info cmd64x_chipsets[] __devinitdata = {
.init_hwif = init_hwif_cmd64x, .init_hwif = init_hwif_cmd64x,
.enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}},
.chipset = ide_cmd646, .chipset = ide_cmd646,
.host_flags = IDE_HFLAG_ABUSE_PREFETCH | IDE_HFLAG_BOOTABLE, .host_flags = IDE_HFLAG_ABUSE_PREFETCH,
.pio_mask = ATA_PIO5, .pio_mask = ATA_PIO5,
.mwdma_mask = ATA_MWDMA2, .mwdma_mask = ATA_MWDMA2,
.udma_mask = ATA_UDMA2, .udma_mask = ATA_UDMA2,
...@@ -460,7 +459,7 @@ static const struct ide_port_info cmd64x_chipsets[] __devinitdata = { ...@@ -460,7 +459,7 @@ static const struct ide_port_info cmd64x_chipsets[] __devinitdata = {
.init_chipset = init_chipset_cmd64x, .init_chipset = init_chipset_cmd64x,
.init_hwif = init_hwif_cmd64x, .init_hwif = init_hwif_cmd64x,
.enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}},
.host_flags = IDE_HFLAG_ABUSE_PREFETCH | IDE_HFLAG_BOOTABLE, .host_flags = IDE_HFLAG_ABUSE_PREFETCH,
.pio_mask = ATA_PIO5, .pio_mask = ATA_PIO5,
.mwdma_mask = ATA_MWDMA2, .mwdma_mask = ATA_MWDMA2,
.udma_mask = ATA_UDMA4, .udma_mask = ATA_UDMA4,
...@@ -469,7 +468,7 @@ static const struct ide_port_info cmd64x_chipsets[] __devinitdata = { ...@@ -469,7 +468,7 @@ static const struct ide_port_info cmd64x_chipsets[] __devinitdata = {
.init_chipset = init_chipset_cmd64x, .init_chipset = init_chipset_cmd64x,
.init_hwif = init_hwif_cmd64x, .init_hwif = init_hwif_cmd64x,
.enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}},
.host_flags = IDE_HFLAG_ABUSE_PREFETCH | IDE_HFLAG_BOOTABLE, .host_flags = IDE_HFLAG_ABUSE_PREFETCH,
.pio_mask = ATA_PIO5, .pio_mask = ATA_PIO5,
.mwdma_mask = ATA_MWDMA2, .mwdma_mask = ATA_MWDMA2,
.udma_mask = ATA_UDMA5, .udma_mask = ATA_UDMA5,
......
...@@ -122,8 +122,7 @@ static void __devinit init_hwif_cs5520(ide_hwif_t *hwif) ...@@ -122,8 +122,7 @@ static void __devinit init_hwif_cs5520(ide_hwif_t *hwif)
IDE_HFLAG_CS5520 | \ IDE_HFLAG_CS5520 | \
IDE_HFLAG_VDMA | \ IDE_HFLAG_VDMA | \
IDE_HFLAG_NO_ATAPI_DMA | \ IDE_HFLAG_NO_ATAPI_DMA | \
IDE_HFLAG_ABUSE_SET_DMA_MODE |\ IDE_HFLAG_ABUSE_SET_DMA_MODE, \
IDE_HFLAG_BOOTABLE, \
.pio_mask = ATA_PIO4, \ .pio_mask = ATA_PIO4, \
} }
......
...@@ -249,8 +249,7 @@ static const struct ide_port_info cs5530_chipset __devinitdata = { ...@@ -249,8 +249,7 @@ static const struct ide_port_info cs5530_chipset __devinitdata = {
.init_chipset = init_chipset_cs5530, .init_chipset = init_chipset_cs5530,
.init_hwif = init_hwif_cs5530, .init_hwif = init_hwif_cs5530,
.host_flags = IDE_HFLAG_SERIALIZE | .host_flags = IDE_HFLAG_SERIALIZE |
IDE_HFLAG_POST_SET_MODE | IDE_HFLAG_POST_SET_MODE,
IDE_HFLAG_BOOTABLE,
.pio_mask = ATA_PIO4, .pio_mask = ATA_PIO4,
.mwdma_mask = ATA_MWDMA2, .mwdma_mask = ATA_MWDMA2,
.udma_mask = ATA_UDMA2, .udma_mask = ATA_UDMA2,
......
...@@ -186,7 +186,7 @@ static const struct ide_port_info cs5535_chipset __devinitdata = { ...@@ -186,7 +186,7 @@ static const struct ide_port_info cs5535_chipset __devinitdata = {
.name = "CS5535", .name = "CS5535",
.init_hwif = init_hwif_cs5535, .init_hwif = init_hwif_cs5535,
.host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_POST_SET_MODE | .host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_POST_SET_MODE |
IDE_HFLAG_ABUSE_SET_DMA_MODE | IDE_HFLAG_BOOTABLE, IDE_HFLAG_ABUSE_SET_DMA_MODE,
.pio_mask = ATA_PIO4, .pio_mask = ATA_PIO4,
.mwdma_mask = ATA_MWDMA2, .mwdma_mask = ATA_MWDMA2,
.udma_mask = ATA_UDMA4, .udma_mask = ATA_UDMA4,
......
...@@ -110,11 +110,11 @@ typedef struct pio_clocks_s { ...@@ -110,11 +110,11 @@ typedef struct pio_clocks_s {
* calc clocks using bus_speed * calc clocks using bus_speed
* returns (rounded up) time in bus clocks for time in ns * returns (rounded up) time in bus clocks for time in ns
*/ */
static int calc_clk (int time, int bus_speed) static int calc_clk(int time, int bus_speed)
{ {
int clocks; int clocks;
clocks = (time*bus_speed+999)/1000 -1; clocks = (time*bus_speed+999)/1000 - 1;
if (clocks < 0) if (clocks < 0)
clocks = 0; clocks = 0;
...@@ -133,7 +133,7 @@ static int calc_clk (int time, int bus_speed) ...@@ -133,7 +133,7 @@ static int calc_clk (int time, int bus_speed)
* for mode 3 and 4 drives 8 and 16-bit timings are the same * for mode 3 and 4 drives 8 and 16-bit timings are the same
* *
*/ */
static void compute_clocks (u8 pio, pio_clocks_t *p_pclk) static void compute_clocks(u8 pio, pio_clocks_t *p_pclk)
{ {
int clk1, clk2; int clk1, clk2;
int bus_speed = system_bus_clock(); /* get speed of PCI bus */ int bus_speed = system_bus_clock(); /* get speed of PCI bus */
...@@ -186,7 +186,7 @@ static void cy82c693_set_dma_mode(ide_drive_t *drive, const u8 mode) ...@@ -186,7 +186,7 @@ static void cy82c693_set_dma_mode(ide_drive_t *drive, const u8 mode)
outb(index, CY82_INDEX_PORT); outb(index, CY82_INDEX_PORT);
data = inb(CY82_DATA_PORT); data = inb(CY82_DATA_PORT);
printk (KERN_INFO "%s (ch=%d, dev=%d): DMA mode is %d (single=%d)\n", printk(KERN_INFO "%s (ch=%d, dev=%d): DMA mode is %d (single=%d)\n",
drive->name, HWIF(drive)->channel, drive->select.b.unit, drive->name, HWIF(drive)->channel, drive->select.b.unit,
(data&0x3), ((data>>2)&1)); (data&0x3), ((data>>2)&1));
#endif /* CY82C693_DEBUG_LOGS */ #endif /* CY82C693_DEBUG_LOGS */
...@@ -217,7 +217,7 @@ static void cy82c693_set_dma_mode(ide_drive_t *drive, const u8 mode) ...@@ -217,7 +217,7 @@ static void cy82c693_set_dma_mode(ide_drive_t *drive, const u8 mode)
outb(data, CY82_DATA_PORT); outb(data, CY82_DATA_PORT);
#if CY82C693_DEBUG_INFO #if CY82C693_DEBUG_INFO
printk (KERN_INFO "%s: Set IDE Bus Master TimeOut Register to 0x%X\n", printk(KERN_INFO "%s: Set IDE Bus Master TimeOut Register to 0x%X\n",
drive->name, data); drive->name, data);
#endif /* CY82C693_DEBUG_INFO */ #endif /* CY82C693_DEBUG_INFO */
} }
...@@ -374,7 +374,7 @@ static unsigned int __devinit init_chipset_cy82c693(struct pci_dev *dev, const c ...@@ -374,7 +374,7 @@ static unsigned int __devinit init_chipset_cy82c693(struct pci_dev *dev, const c
outb(data, CY82_DATA_PORT); outb(data, CY82_DATA_PORT);
#if CY82C693_DEBUG_INFO #if CY82C693_DEBUG_INFO
printk (KERN_INFO "%s: New Peripheral Configuration Register: 0x%X\n", printk(KERN_INFO "%s: New Peripheral Configuration Register: 0x%X\n",
name, data); name, data);
#endif /* CY82C693_DEBUG_INFO */ #endif /* CY82C693_DEBUG_INFO */
...@@ -410,8 +410,7 @@ static const struct ide_port_info cy82c693_chipset __devinitdata = { ...@@ -410,8 +410,7 @@ static const struct ide_port_info cy82c693_chipset __devinitdata = {
.init_iops = init_iops_cy82c693, .init_iops = init_iops_cy82c693,
.init_hwif = init_hwif_cy82c693, .init_hwif = init_hwif_cy82c693,
.chipset = ide_cy82c693, .chipset = ide_cy82c693,
.host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_CY82C693 | .host_flags = IDE_HFLAG_SINGLE,
IDE_HFLAG_BOOTABLE,
.pio_mask = ATA_PIO4, .pio_mask = ATA_PIO4,
.swdma_mask = ATA_SWDMA2, .swdma_mask = ATA_SWDMA2,
.mwdma_mask = ATA_MWDMA2, .mwdma_mask = ATA_MWDMA2,
......
...@@ -71,14 +71,13 @@ delkin_cb_probe (struct pci_dev *dev, const struct pci_device_id *id) ...@@ -71,14 +71,13 @@ delkin_cb_probe (struct pci_dev *dev, const struct pci_device_id *id)
if (setup[i]) if (setup[i])
outb(setup[i], base + i); outb(setup[i], base + i);
} }
pci_release_regions(dev); /* IDE layer handles regions itself */
memset(&hw, 0, sizeof(hw)); memset(&hw, 0, sizeof(hw));
ide_std_init_ports(&hw, base + 0x10, base + 0x1e); ide_std_init_ports(&hw, base + 0x10, base + 0x1e);
hw.irq = dev->irq; hw.irq = dev->irq;
hw.chipset = ide_pci; /* this enables IRQ sharing */ hw.chipset = ide_pci; /* this enables IRQ sharing */
hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]); hwif = ide_find_port();
if (hwif == NULL) if (hwif == NULL)
goto out_disable; goto out_disable;
...@@ -90,6 +89,7 @@ delkin_cb_probe (struct pci_dev *dev, const struct pci_device_id *id) ...@@ -90,6 +89,7 @@ delkin_cb_probe (struct pci_dev *dev, const struct pci_device_id *id)
ide_init_port_data(hwif, i); ide_init_port_data(hwif, i);
ide_init_port_hw(hwif, &hw); ide_init_port_hw(hwif, &hw);
hwif->mmio = 1;
hwif->quirkproc = &ide_undecoded_slave; hwif->quirkproc = &ide_undecoded_slave;
idx[0] = i; idx[0] = i;
...@@ -110,6 +110,7 @@ delkin_cb_probe (struct pci_dev *dev, const struct pci_device_id *id) ...@@ -110,6 +110,7 @@ delkin_cb_probe (struct pci_dev *dev, const struct pci_device_id *id)
out_disable: out_disable:
printk(KERN_ERR "delkin_cb: no IDE devices found\n"); printk(KERN_ERR "delkin_cb: no IDE devices found\n");
pci_release_regions(dev);
pci_disable_device(dev); pci_disable_device(dev);
return -ENODEV; return -ENODEV;
} }
...@@ -122,6 +123,7 @@ delkin_cb_remove (struct pci_dev *dev) ...@@ -122,6 +123,7 @@ delkin_cb_remove (struct pci_dev *dev)
if (hwif) if (hwif)
ide_unregister(hwif->index); ide_unregister(hwif->index);
pci_release_regions(dev);
pci_disable_device(dev); pci_disable_device(dev);
} }
......
...@@ -38,8 +38,7 @@ MODULE_PARM_DESC(all_generic_ide, "IDE generic will claim all unknown PCI IDE st ...@@ -38,8 +38,7 @@ MODULE_PARM_DESC(all_generic_ide, "IDE generic will claim all unknown PCI IDE st
{ \ { \
.name = name_str, \ .name = name_str, \
.host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA | \ .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA | \
extra_flags | \ extra_flags, \
IDE_HFLAG_BOOTABLE, \
.swdma_mask = ATA_SWDMA2, \ .swdma_mask = ATA_SWDMA2, \
.mwdma_mask = ATA_MWDMA2, \ .mwdma_mask = ATA_MWDMA2, \
.udma_mask = ATA_UDMA6, \ .udma_mask = ATA_UDMA6, \
...@@ -50,9 +49,8 @@ static const struct ide_port_info generic_chipsets[] __devinitdata = { ...@@ -50,9 +49,8 @@ static const struct ide_port_info generic_chipsets[] __devinitdata = {
{ /* 1 */ { /* 1 */
.name = "NS87410", .name = "NS87410",
.enablebits = {{0x43,0x08,0x08}, {0x47,0x08,0x08}}, .enablebits = { {0x43, 0x08, 0x08}, {0x47, 0x08, 0x08} },
.host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA | .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA,
IDE_HFLAG_BOOTABLE,
.swdma_mask = ATA_SWDMA2, .swdma_mask = ATA_SWDMA2,
.mwdma_mask = ATA_MWDMA2, .mwdma_mask = ATA_MWDMA2,
.udma_mask = ATA_UDMA6, .udma_mask = ATA_UDMA6,
......
...@@ -133,7 +133,7 @@ static const struct ide_port_info hpt34x_chipsets[] __devinitdata = { ...@@ -133,7 +133,7 @@ static const struct ide_port_info hpt34x_chipsets[] __devinitdata = {
.init_chipset = init_chipset_hpt34x, .init_chipset = init_chipset_hpt34x,
.init_hwif = init_hwif_hpt34x, .init_hwif = init_hwif_hpt34x,
.extra = 16, .extra = 16,
.host_flags = IDE_HFLAGS_HPT34X, .host_flags = IDE_HFLAGS_HPT34X | IDE_HFLAG_NON_BOOTABLE,
.pio_mask = ATA_PIO5, .pio_mask = ATA_PIO5,
}, },
{ /* 1 */ { /* 1 */
......
...@@ -1557,7 +1557,7 @@ static int __devinit hpt366_init_one(struct pci_dev *dev, const struct pci_devic ...@@ -1557,7 +1557,7 @@ static int __devinit hpt366_init_one(struct pci_dev *dev, const struct pci_devic
hpt374_init(dev, dev2); hpt374_init(dev, dev2);
else { else {
if (hpt36x_init(dev, dev2)) if (hpt36x_init(dev, dev2))
d.host_flags |= IDE_HFLAG_BOOTABLE; d.host_flags &= ~IDE_HFLAG_NON_BOOTABLE;
} }
ret = ide_setup_pci_devices(dev, dev2, &d); ret = ide_setup_pci_devices(dev, dev2, &d);
......
...@@ -35,7 +35,7 @@ static void it8213_set_pio_mode(ide_drive_t *drive, const u8 pio) ...@@ -35,7 +35,7 @@ static void it8213_set_pio_mode(ide_drive_t *drive, const u8 pio)
static DEFINE_SPINLOCK(tune_lock); static DEFINE_SPINLOCK(tune_lock);
int control = 0; int control = 0;
static const u8 timings[][2]= { static const u8 timings[][2] = {
{ 0, 0 }, { 0, 0 },
{ 0, 0 }, { 0, 0 },
{ 1, 0 }, { 1, 0 },
...@@ -105,11 +105,10 @@ static void it8213_set_dma_mode(ide_drive_t *drive, const u8 speed) ...@@ -105,11 +105,10 @@ static void it8213_set_dma_mode(ide_drive_t *drive, const u8 speed)
if (!(reg48 & u_flag)) if (!(reg48 & u_flag))
pci_write_config_byte(dev, 0x48, reg48 | u_flag); pci_write_config_byte(dev, 0x48, reg48 | u_flag);
if (speed >= XFER_UDMA_5) { if (speed >= XFER_UDMA_5)
pci_write_config_byte(dev, 0x55, (u8) reg55|w_flag); pci_write_config_byte(dev, 0x55, (u8) reg55|w_flag);
} else { else
pci_write_config_byte(dev, 0x55, (u8) reg55 & ~w_flag); pci_write_config_byte(dev, 0x55, (u8) reg55 & ~w_flag);
}
if ((reg4a & a_speed) != u_speed) if ((reg4a & a_speed) != u_speed)
pci_write_config_word(dev, 0x4a, (reg4a & ~a_speed) | u_speed); pci_write_config_word(dev, 0x4a, (reg4a & ~a_speed) | u_speed);
...@@ -170,9 +169,8 @@ static void __devinit init_hwif_it8213(ide_hwif_t *hwif) ...@@ -170,9 +169,8 @@ static void __devinit init_hwif_it8213(ide_hwif_t *hwif)
{ \ { \
.name = name_str, \ .name = name_str, \
.init_hwif = init_hwif_it8213, \ .init_hwif = init_hwif_it8213, \
.enablebits = {{0x41,0x80,0x80}}, \ .enablebits = { {0x41, 0x80, 0x80} }, \
.host_flags = IDE_HFLAG_SINGLE | \ .host_flags = IDE_HFLAG_SINGLE, \
IDE_HFLAG_BOOTABLE, \
.pio_mask = ATA_PIO4, \ .pio_mask = ATA_PIO4, \
.swdma_mask = ATA_SWDMA2_ONLY, \ .swdma_mask = ATA_SWDMA2_ONLY, \
.mwdma_mask = ATA_MWDMA12_ONLY, \ .mwdma_mask = ATA_MWDMA12_ONLY, \
......
...@@ -523,16 +523,12 @@ static void __devinit it821x_quirkproc(ide_drive_t *drive) ...@@ -523,16 +523,12 @@ static void __devinit it821x_quirkproc(ide_drive_t *drive)
static void __devinit init_hwif_it821x(ide_hwif_t *hwif) static void __devinit init_hwif_it821x(ide_hwif_t *hwif)
{ {
struct pci_dev *dev = to_pci_dev(hwif->dev); struct pci_dev *dev = to_pci_dev(hwif->dev);
struct it821x_dev *idev = kzalloc(sizeof(struct it821x_dev), GFP_KERNEL); struct it821x_dev **itdevs = (struct it821x_dev **)pci_get_drvdata(dev);
struct it821x_dev *idev = itdevs[hwif->channel];
u8 conf; u8 conf;
hwif->quirkproc = &it821x_quirkproc; hwif->quirkproc = &it821x_quirkproc;
if (idev == NULL) {
printk(KERN_ERR "it821x: out of memory, falling back to legacy behaviour.\n");
return;
}
ide_set_hwifdata(hwif, idev); ide_set_hwifdata(hwif, idev);
pci_read_config_byte(dev, 0x50, &conf); pci_read_config_byte(dev, 0x50, &conf);
...@@ -623,7 +619,6 @@ static unsigned int __devinit init_chipset_it821x(struct pci_dev *dev, const cha ...@@ -623,7 +619,6 @@ static unsigned int __devinit init_chipset_it821x(struct pci_dev *dev, const cha
.name = name_str, \ .name = name_str, \
.init_chipset = init_chipset_it821x, \ .init_chipset = init_chipset_it821x, \
.init_hwif = init_hwif_it821x, \ .init_hwif = init_hwif_it821x, \
.host_flags = IDE_HFLAG_BOOTABLE, \
.pio_mask = ATA_PIO4, \ .pio_mask = ATA_PIO4, \
} }
...@@ -642,6 +637,22 @@ static const struct ide_port_info it821x_chipsets[] __devinitdata = { ...@@ -642,6 +637,22 @@ static const struct ide_port_info it821x_chipsets[] __devinitdata = {
static int __devinit it821x_init_one(struct pci_dev *dev, const struct pci_device_id *id) static int __devinit it821x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{ {
struct it821x_dev *itdevs[2] = { NULL, NULL} , *itdev;
unsigned int i;
for (i = 0; i < 2; i++) {
itdev = kzalloc(sizeof(*itdev), GFP_KERNEL);
if (itdev == NULL) {
kfree(itdevs[0]);
printk(KERN_ERR "it821x: out of memory\n");
return -ENOMEM;
}
itdevs[i] = itdev;
}
pci_set_drvdata(dev, itdevs);
return ide_setup_pci_device(dev, &it821x_chipsets[id->driver_data]); return ide_setup_pci_device(dev, &it821x_chipsets[id->driver_data]);
} }
......
...@@ -63,8 +63,7 @@ static u8 __devinit ata66_jmicron(ide_hwif_t *hwif) ...@@ -63,8 +63,7 @@ static u8 __devinit ata66_jmicron(ide_hwif_t *hwif)
* actually do our cable checking etc. Thankfully we don't need * actually do our cable checking etc. Thankfully we don't need
* to do the plumbing for other cases. * to do the plumbing for other cases.
*/ */
switch (port_map[port]) switch (port_map[port]) {
{
case PORT_PATA0: case PORT_PATA0:
if (control & (1 << 3)) /* 40/80 pin primary */ if (control & (1 << 3)) /* 40/80 pin primary */
return ATA_CBL_PATA40; return ATA_CBL_PATA40;
...@@ -114,7 +113,6 @@ static void __devinit init_hwif_jmicron(ide_hwif_t *hwif) ...@@ -114,7 +113,6 @@ static void __devinit init_hwif_jmicron(ide_hwif_t *hwif)
static const struct ide_port_info jmicron_chipset __devinitdata = { static const struct ide_port_info jmicron_chipset __devinitdata = {
.name = "JMB", .name = "JMB",
.init_hwif = init_hwif_jmicron, .init_hwif = init_hwif_jmicron,
.host_flags = IDE_HFLAG_BOOTABLE,
.enablebits = { { 0x40, 0x01, 0x01 }, { 0x40, 0x10, 0x10 } }, .enablebits = { { 0x40, 0x01, 0x01 }, { 0x40, 0x10, 0x10 } },
.pio_mask = ATA_PIO5, .pio_mask = ATA_PIO5,
.mwdma_mask = ATA_MWDMA2, .mwdma_mask = ATA_MWDMA2,
......
...@@ -265,8 +265,7 @@ static const struct ide_port_info ns87415_chipset __devinitdata = { ...@@ -265,8 +265,7 @@ static const struct ide_port_info ns87415_chipset __devinitdata = {
#endif #endif
.init_hwif = init_hwif_ns87415, .init_hwif = init_hwif_ns87415,
.host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA | .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA |
IDE_HFLAG_NO_ATAPI_DMA | IDE_HFLAG_NO_ATAPI_DMA,
IDE_HFLAG_BOOTABLE,
}; };
static int __devinit ns87415_init_one(struct pci_dev *dev, const struct pci_device_id *id) static int __devinit ns87415_init_one(struct pci_dev *dev, const struct pci_device_id *id)
......
...@@ -218,19 +218,24 @@ static void compute_clocks(int pio, pio_clocks_t *clks) ...@@ -218,19 +218,24 @@ static void compute_clocks(int pio, pio_clocks_t *clks)
clks->data_time = cmpt_clk(data_pls, bus_speed); clks->data_time = cmpt_clk(data_pls, bus_speed);
clks->recovery_time = cmpt_clk(ide_pio_timings[pio].cycle_time clks->recovery_time = cmpt_clk(ide_pio_timings[pio].cycle_time
- adr_setup-data_pls, bus_speed); - adr_setup-data_pls, bus_speed);
if (clks->address_time<1) clks->address_time = 1; if (clks->address_time < 1)
if (clks->address_time>4) clks->address_time = 4; clks->address_time = 1;
if (clks->data_time<1) clks->data_time = 1; if (clks->address_time > 4)
if (clks->data_time>16) clks->data_time = 16; clks->address_time = 4;
if (clks->recovery_time<2) clks->recovery_time = 2; if (clks->data_time < 1)
if (clks->recovery_time>17) clks->recovery_time = 17; clks->data_time = 1;
if (clks->data_time > 16)
clks->data_time = 16;
if (clks->recovery_time < 2)
clks->recovery_time = 2;
if (clks->recovery_time > 17)
clks->recovery_time = 17;
} else { } else {
clks->address_time = 1; clks->address_time = 1;
clks->data_time = 1; clks->data_time = 1;
clks->recovery_time = 2; clks->recovery_time = 2;
/* minimal values */ /* minimal values */
} }
} }
static void opti621_set_pio_mode(ide_drive_t *drive, const u8 pio) static void opti621_set_pio_mode(ide_drive_t *drive, const u8 pio)
...@@ -324,7 +329,7 @@ static void __devinit opti621_port_init_devs(ide_hwif_t *hwif) ...@@ -324,7 +329,7 @@ static void __devinit opti621_port_init_devs(ide_hwif_t *hwif)
/* /*
* init_hwif_opti621() is called once for each hwif found at boot. * init_hwif_opti621() is called once for each hwif found at boot.
*/ */
static void __devinit init_hwif_opti621 (ide_hwif_t *hwif) static void __devinit init_hwif_opti621(ide_hwif_t *hwif)
{ {
hwif->port_init_devs = opti621_port_init_devs; hwif->port_init_devs = opti621_port_init_devs;
hwif->set_pio_mode = &opti621_set_pio_mode; hwif->set_pio_mode = &opti621_set_pio_mode;
...@@ -334,18 +339,16 @@ static const struct ide_port_info opti621_chipsets[] __devinitdata = { ...@@ -334,18 +339,16 @@ static const struct ide_port_info opti621_chipsets[] __devinitdata = {
{ /* 0 */ { /* 0 */
.name = "OPTI621", .name = "OPTI621",
.init_hwif = init_hwif_opti621, .init_hwif = init_hwif_opti621,
.enablebits = {{0x45,0x80,0x00}, {0x40,0x08,0x00}}, .enablebits = { {0x45, 0x80, 0x00}, {0x40, 0x08, 0x00} },
.host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA | .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA,
IDE_HFLAG_BOOTABLE,
.pio_mask = ATA_PIO3, .pio_mask = ATA_PIO3,
.swdma_mask = ATA_SWDMA2, .swdma_mask = ATA_SWDMA2,
.mwdma_mask = ATA_MWDMA2, .mwdma_mask = ATA_MWDMA2,
},{ /* 1 */ }, { /* 1 */
.name = "OPTI621X", .name = "OPTI621X",
.init_hwif = init_hwif_opti621, .init_hwif = init_hwif_opti621,
.enablebits = {{0x45,0x80,0x00}, {0x40,0x08,0x00}}, .enablebits = { {0x45, 0x80, 0x00}, {0x40, 0x08, 0x00} },
.host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA | .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA,
IDE_HFLAG_BOOTABLE,
.pio_mask = ATA_PIO3, .pio_mask = ATA_PIO3,
.swdma_mask = ATA_SWDMA2, .swdma_mask = ATA_SWDMA2,
.mwdma_mask = ATA_MWDMA2, .mwdma_mask = ATA_MWDMA2,
......
...@@ -307,9 +307,9 @@ static void __devinit init_hwif_ich(ide_hwif_t *hwif) ...@@ -307,9 +307,9 @@ static void __devinit init_hwif_ich(ide_hwif_t *hwif)
} }
#ifndef CONFIG_IA64 #ifndef CONFIG_IA64
#define IDE_HFLAGS_PIIX (IDE_HFLAG_LEGACY_IRQS | IDE_HFLAG_BOOTABLE) #define IDE_HFLAGS_PIIX IDE_HFLAG_LEGACY_IRQS
#else #else
#define IDE_HFLAGS_PIIX IDE_HFLAG_BOOTABLE #define IDE_HFLAGS_PIIX 0
#endif #endif
#define DECLARE_PIIX_DEV(name_str, udma) \ #define DECLARE_PIIX_DEV(name_str, udma) \
......
...@@ -43,7 +43,7 @@ static const struct ide_port_info rz1000_chipset __devinitdata = { ...@@ -43,7 +43,7 @@ static const struct ide_port_info rz1000_chipset __devinitdata = {
.name = "RZ100x", .name = "RZ100x",
.init_hwif = init_hwif_rz1000, .init_hwif = init_hwif_rz1000,
.chipset = ide_rz1000, .chipset = ide_rz1000,
.host_flags = IDE_HFLAG_NO_DMA | IDE_HFLAG_BOOTABLE, .host_flags = IDE_HFLAG_NO_DMA,
}; };
static int __devinit rz1000_init_one(struct pci_dev *dev, const struct pci_device_id *id) static int __devinit rz1000_init_one(struct pci_dev *dev, const struct pci_device_id *id)
......
...@@ -307,8 +307,7 @@ static const struct ide_port_info sc1200_chipset __devinitdata = { ...@@ -307,8 +307,7 @@ static const struct ide_port_info sc1200_chipset __devinitdata = {
.init_hwif = init_hwif_sc1200, .init_hwif = init_hwif_sc1200,
.host_flags = IDE_HFLAG_SERIALIZE | .host_flags = IDE_HFLAG_SERIALIZE |
IDE_HFLAG_POST_SET_MODE | IDE_HFLAG_POST_SET_MODE |
IDE_HFLAG_ABUSE_DMA_MODES | IDE_HFLAG_ABUSE_DMA_MODES,
IDE_HFLAG_BOOTABLE,
.pio_mask = ATA_PIO4, .pio_mask = ATA_PIO4,
.mwdma_mask = ATA_MWDMA2, .mwdma_mask = ATA_MWDMA2,
.udma_mask = ATA_UDMA2, .udma_mask = ATA_UDMA2,
......
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
static struct scc_ports { static struct scc_ports {
unsigned long ctl, dma; unsigned long ctl, dma;
unsigned char hwif_id; /* for removing hwif from system */ ide_hwif_t *hwif; /* for removing port from system */
} scc_ports[MAX_HWIFS]; } scc_ports[MAX_HWIFS];
/* PIO transfer mode table */ /* PIO transfer mode table */
...@@ -534,12 +534,8 @@ static int scc_ide_setup_pci_device(struct pci_dev *dev, ...@@ -534,12 +534,8 @@ static int scc_ide_setup_pci_device(struct pci_dev *dev,
u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
int i; int i;
for (i = 0; i < MAX_HWIFS; i++) { hwif = ide_find_port();
hwif = &ide_hwifs[i]; if (hwif == NULL) {
if (hwif->chipset == ide_unknown)
break; /* pick an unused entry */
}
if (i == MAX_HWIFS) {
printk(KERN_ERR "%s: too many IDE interfaces, " printk(KERN_ERR "%s: too many IDE interfaces, "
"no room in table\n", SCC_PATA_NAME); "no room in table\n", SCC_PATA_NAME);
return -ENOMEM; return -ENOMEM;
...@@ -696,7 +692,7 @@ static void __devinit init_hwif_scc(ide_hwif_t *hwif) ...@@ -696,7 +692,7 @@ static void __devinit init_hwif_scc(ide_hwif_t *hwif)
{ {
struct scc_ports *ports = ide_get_hwifdata(hwif); struct scc_ports *ports = ide_get_hwifdata(hwif);
ports->hwif_id = hwif->index; ports->hwif = hwif;
hwif->dma_command = hwif->dma_base; hwif->dma_command = hwif->dma_base;
hwif->dma_status = hwif->dma_base + 0x04; hwif->dma_status = hwif->dma_base + 0x04;
...@@ -725,8 +721,7 @@ static void __devinit init_hwif_scc(ide_hwif_t *hwif) ...@@ -725,8 +721,7 @@ static void __devinit init_hwif_scc(ide_hwif_t *hwif)
.name = name_str, \ .name = name_str, \
.init_iops = init_iops_scc, \ .init_iops = init_iops_scc, \
.init_hwif = init_hwif_scc, \ .init_hwif = init_hwif_scc, \
.host_flags = IDE_HFLAG_SINGLE | \ .host_flags = IDE_HFLAG_SINGLE, \
IDE_HFLAG_BOOTABLE, \
.pio_mask = ATA_PIO4, \ .pio_mask = ATA_PIO4, \
} }
...@@ -758,7 +753,7 @@ static int __devinit scc_init_one(struct pci_dev *dev, const struct pci_device_i ...@@ -758,7 +753,7 @@ static int __devinit scc_init_one(struct pci_dev *dev, const struct pci_device_i
static void __devexit scc_remove(struct pci_dev *dev) static void __devexit scc_remove(struct pci_dev *dev)
{ {
struct scc_ports *ports = pci_get_drvdata(dev); struct scc_ports *ports = pci_get_drvdata(dev);
ide_hwif_t *hwif = &ide_hwifs[ports->hwif_id]; ide_hwif_t *hwif = ports->hwif;
unsigned long ctl_base = pci_resource_start(dev, 0); unsigned long ctl_base = pci_resource_start(dev, 0);
unsigned long dma_base = pci_resource_start(dev, 1); unsigned long dma_base = pci_resource_start(dev, 1);
unsigned long ctl_size = pci_resource_len(dev, 0); unsigned long ctl_size = pci_resource_len(dev, 0);
......
...@@ -350,8 +350,7 @@ static void __devinit init_hwif_svwks (ide_hwif_t *hwif) ...@@ -350,8 +350,7 @@ static void __devinit init_hwif_svwks (ide_hwif_t *hwif)
#define IDE_HFLAGS_SVWKS \ #define IDE_HFLAGS_SVWKS \
(IDE_HFLAG_LEGACY_IRQS | \ (IDE_HFLAG_LEGACY_IRQS | \
IDE_HFLAG_ABUSE_SET_DMA_MODE | \ IDE_HFLAG_ABUSE_SET_DMA_MODE)
IDE_HFLAG_BOOTABLE)
static const struct ide_port_info serverworks_chipsets[] __devinitdata = { static const struct ide_port_info serverworks_chipsets[] __devinitdata = {
{ /* 0 */ { /* 0 */
...@@ -418,7 +417,7 @@ static int __devinit svwks_init_one(struct pci_dev *dev, const struct pci_device ...@@ -418,7 +417,7 @@ static int __devinit svwks_init_one(struct pci_dev *dev, const struct pci_device
else if (idx == 2 || idx == 3) { else if (idx == 2 || idx == 3) {
if ((PCI_FUNC(dev->devfn) & 1) == 0) { if ((PCI_FUNC(dev->devfn) & 1) == 0) {
if (pci_resource_start(dev, 0) != 0x01f1) if (pci_resource_start(dev, 0) != 0x01f1)
d.host_flags &= ~IDE_HFLAG_BOOTABLE; d.host_flags |= IDE_HFLAG_NON_BOOTABLE;
d.host_flags |= IDE_HFLAG_SINGLE; d.host_flags |= IDE_HFLAG_SINGLE;
} else } else
d.host_flags &= ~IDE_HFLAG_SINGLE; d.host_flags &= ~IDE_HFLAG_SINGLE;
......
...@@ -590,20 +590,12 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev) ...@@ -590,20 +590,12 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev)
unsigned long bar0, cmd_phys_base, ctl; unsigned long bar0, cmd_phys_base, ctl;
void __iomem *virt_base; void __iomem *virt_base;
ide_hwif_t *hwif; ide_hwif_t *hwif;
int h;
u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
hw_regs_t hw; hw_regs_t hw;
struct ide_port_info d = sgiioc4_port_info; struct ide_port_info d = sgiioc4_port_info;
/* hwif = ide_find_port();
* Find an empty HWIF; if none available, return -ENOMEM. if (hwif == NULL) {
*/
for (h = 0; h < MAX_HWIFS; ++h) {
hwif = &ide_hwifs[h];
if (hwif->chipset == ide_unknown)
break;
}
if (h == MAX_HWIFS) {
printk(KERN_ERR "%s: too many IDE interfaces, no room in table\n", printk(KERN_ERR "%s: too many IDE interfaces, no room in table\n",
DRV_NAME); DRV_NAME);
return -ENOMEM; return -ENOMEM;
......
...@@ -808,7 +808,6 @@ static void __devinit init_hwif_siimage(ide_hwif_t *hwif) ...@@ -808,7 +808,6 @@ static void __devinit init_hwif_siimage(ide_hwif_t *hwif)
.init_chipset = init_chipset_siimage, \ .init_chipset = init_chipset_siimage, \
.init_iops = init_iops_siimage, \ .init_iops = init_iops_siimage, \
.init_hwif = init_hwif_siimage, \ .init_hwif = init_hwif_siimage, \
.host_flags = IDE_HFLAG_BOOTABLE, \
.pio_mask = ATA_PIO4, \ .pio_mask = ATA_PIO4, \
.mwdma_mask = ATA_MWDMA2, \ .mwdma_mask = ATA_MWDMA2, \
.udma_mask = ATA_UDMA6, \ .udma_mask = ATA_UDMA6, \
......
...@@ -59,10 +59,10 @@ ...@@ -59,10 +59,10 @@
#define ATA_16 0x01 #define ATA_16 0x01
#define ATA_33 0x02 #define ATA_33 0x02
#define ATA_66 0x03 #define ATA_66 0x03
#define ATA_100a 0x04 // SiS730/SiS550 is ATA100 with ATA66 layout #define ATA_100a 0x04 /* SiS730/SiS550 is ATA100 with ATA66 layout */
#define ATA_100 0x05 #define ATA_100 0x05
#define ATA_133a 0x06 // SiS961b with 133 support #define ATA_133a 0x06 /* SiS961b with 133 support */
#define ATA_133 0x07 // SiS962/963 #define ATA_133 0x07 /* SiS962/963 */
static u8 chipset_family; static u8 chipset_family;
...@@ -111,69 +111,70 @@ static const struct { ...@@ -111,69 +111,70 @@ static const struct {
Indexed by chipset_family and (dma_mode - XFER_UDMA_0) */ Indexed by chipset_family and (dma_mode - XFER_UDMA_0) */
/* {0, ATA_16, ATA_33, ATA_66, ATA_100a, ATA_100, ATA_133} */ /* {0, ATA_16, ATA_33, ATA_66, ATA_100a, ATA_100, ATA_133} */
static u8 cycle_time_offset[] = {0,0,5,4,4,0,0}; static u8 cycle_time_offset[] = { 0, 0, 5, 4, 4, 0, 0 };
static u8 cycle_time_range[] = {0,0,2,3,3,4,4}; static u8 cycle_time_range[] = { 0, 0, 2, 3, 3, 4, 4 };
static u8 cycle_time_value[][XFER_UDMA_6 - XFER_UDMA_0 + 1] = { static u8 cycle_time_value[][XFER_UDMA_6 - XFER_UDMA_0 + 1] = {
{0,0,0,0,0,0,0}, /* no udma */ { 0, 0, 0, 0, 0, 0, 0 }, /* no UDMA */
{0,0,0,0,0,0,0}, /* no udma */ { 0, 0, 0, 0, 0, 0, 0 }, /* no UDMA */
{3,2,1,0,0,0,0}, /* ATA_33 */ { 3, 2, 1, 0, 0, 0, 0 }, /* ATA_33 */
{7,5,3,2,1,0,0}, /* ATA_66 */ { 7, 5, 3, 2, 1, 0, 0 }, /* ATA_66 */
{7,5,3,2,1,0,0}, /* ATA_100a (730 specific), differences are on cycle_time range and offset */ { 7, 5, 3, 2, 1, 0, 0 }, /* ATA_100a (730 specific),
{11,7,5,4,2,1,0}, /* ATA_100 */ different cycle_time range and offset */
{15,10,7,5,3,2,1}, /* ATA_133a (earliest 691 southbridges) */ { 11, 7, 5, 4, 2, 1, 0 }, /* ATA_100 */
{15,10,7,5,3,2,1}, /* ATA_133 */ { 15, 10, 7, 5, 3, 2, 1 }, /* ATA_133a (earliest 691 southbridges) */
{ 15, 10, 7, 5, 3, 2, 1 }, /* ATA_133 */
}; };
/* CRC Valid Setup Time vary across IDE clock setting 33/66/100/133 /* CRC Valid Setup Time vary across IDE clock setting 33/66/100/133
See SiS962 data sheet for more detail */ See SiS962 data sheet for more detail */
static u8 cvs_time_value[][XFER_UDMA_6 - XFER_UDMA_0 + 1] = { static u8 cvs_time_value[][XFER_UDMA_6 - XFER_UDMA_0 + 1] = {
{0,0,0,0,0,0,0}, /* no udma */ { 0, 0, 0, 0, 0, 0, 0 }, /* no UDMA */
{0,0,0,0,0,0,0}, /* no udma */ { 0, 0, 0, 0, 0, 0, 0 }, /* no UDMA */
{2,1,1,0,0,0,0}, { 2, 1, 1, 0, 0, 0, 0 },
{4,3,2,1,0,0,0}, { 4, 3, 2, 1, 0, 0, 0 },
{4,3,2,1,0,0,0}, { 4, 3, 2, 1, 0, 0, 0 },
{6,4,3,1,1,1,0}, { 6, 4, 3, 1, 1, 1, 0 },
{9,6,4,2,2,2,2}, { 9, 6, 4, 2, 2, 2, 2 },
{9,6,4,2,2,2,2}, { 9, 6, 4, 2, 2, 2, 2 },
}; };
/* Initialize time, Active time, Recovery time vary across /* Initialize time, Active time, Recovery time vary across
IDE clock settings. These 3 arrays hold the register value IDE clock settings. These 3 arrays hold the register value
for PIO0/1/2/3/4 and DMA0/1/2 mode in order */ for PIO0/1/2/3/4 and DMA0/1/2 mode in order */
static u8 ini_time_value[][8] = { static u8 ini_time_value[][8] = {
{0,0,0,0,0,0,0,0}, { 0, 0, 0, 0, 0, 0, 0, 0 },
{0,0,0,0,0,0,0,0}, { 0, 0, 0, 0, 0, 0, 0, 0 },
{2,1,0,0,0,1,0,0}, { 2, 1, 0, 0, 0, 1, 0, 0 },
{4,3,1,1,1,3,1,1}, { 4, 3, 1, 1, 1, 3, 1, 1 },
{4,3,1,1,1,3,1,1}, { 4, 3, 1, 1, 1, 3, 1, 1 },
{6,4,2,2,2,4,2,2}, { 6, 4, 2, 2, 2, 4, 2, 2 },
{9,6,3,3,3,6,3,3}, { 9, 6, 3, 3, 3, 6, 3, 3 },
{9,6,3,3,3,6,3,3}, { 9, 6, 3, 3, 3, 6, 3, 3 },
}; };
static u8 act_time_value[][8] = { static u8 act_time_value[][8] = {
{0,0,0,0,0,0,0,0}, { 0, 0, 0, 0, 0, 0, 0, 0 },
{0,0,0,0,0,0,0,0}, { 0, 0, 0, 0, 0, 0, 0, 0 },
{9,9,9,2,2,7,2,2}, { 9, 9, 9, 2, 2, 7, 2, 2 },
{19,19,19,5,4,14,5,4}, { 19, 19, 19, 5, 4, 14, 5, 4 },
{19,19,19,5,4,14,5,4}, { 19, 19, 19, 5, 4, 14, 5, 4 },
{28,28,28,7,6,21,7,6}, { 28, 28, 28, 7, 6, 21, 7, 6 },
{38,38,38,10,9,28,10,9}, { 38, 38, 38, 10, 9, 28, 10, 9 },
{38,38,38,10,9,28,10,9}, { 38, 38, 38, 10, 9, 28, 10, 9 },
}; };
static u8 rco_time_value[][8] = { static u8 rco_time_value[][8] = {
{0,0,0,0,0,0,0,0}, { 0, 0, 0, 0, 0, 0, 0, 0 },
{0,0,0,0,0,0,0,0}, { 0, 0, 0, 0, 0, 0, 0, 0 },
{9,2,0,2,0,7,1,1}, { 9, 2, 0, 2, 0, 7, 1, 1 },
{19,5,1,5,2,16,3,2}, { 19, 5, 1, 5, 2, 16, 3, 2 },
{19,5,1,5,2,16,3,2}, { 19, 5, 1, 5, 2, 16, 3, 2 },
{30,9,3,9,4,25,6,4}, { 30, 9, 3, 9, 4, 25, 6, 4 },
{40,12,4,12,5,34,12,5}, { 40, 12, 4, 12, 5, 34, 12, 5 },
{40,12,4,12,5,34,12,5}, { 40, 12, 4, 12, 5, 34, 12, 5 },
}; };
/* /*
* Printing configuration * Printing configuration
*/ */
/* Used for chipset type printing at boot time */ /* Used for chipset type printing at boot time */
static char* chipset_capability[] = { static char *chipset_capability[] = {
"ATA", "ATA 16", "ATA", "ATA 16",
"ATA 33", "ATA 66", "ATA 33", "ATA 66",
"ATA 100 (1st gen)", "ATA 100 (2nd gen)", "ATA 100 (1st gen)", "ATA 100 (2nd gen)",
...@@ -272,7 +273,7 @@ static void sis_program_timings(ide_drive_t *drive, const u8 mode) ...@@ -272,7 +273,7 @@ static void sis_program_timings(ide_drive_t *drive, const u8 mode)
sis_ata133_program_timings(drive, mode); sis_ata133_program_timings(drive, mode);
} }
static void config_drive_art_rwp (ide_drive_t *drive) static void config_drive_art_rwp(ide_drive_t *drive)
{ {
ide_hwif_t *hwif = HWIF(drive); ide_hwif_t *hwif = HWIF(drive);
struct pci_dev *dev = to_pci_dev(hwif->dev); struct pci_dev *dev = to_pci_dev(hwif->dev);
...@@ -358,8 +359,7 @@ static u8 sis5513_ata133_udma_filter(ide_drive_t *drive) ...@@ -358,8 +359,7 @@ static u8 sis5513_ata133_udma_filter(ide_drive_t *drive)
return (regdw & 0x08) ? ATA_UDMA6 : ATA_UDMA5; return (regdw & 0x08) ? ATA_UDMA6 : ATA_UDMA5;
} }
/* Chip detection and general config */ static int __devinit sis_find_family(struct pci_dev *dev)
static unsigned int __devinit init_chipset_sis5513 (struct pci_dev *dev, const char *name)
{ {
struct pci_dev *host; struct pci_dev *host;
int i = 0; int i = 0;
...@@ -440,18 +440,20 @@ static unsigned int __devinit init_chipset_sis5513 (struct pci_dev *dev, const c ...@@ -440,18 +440,20 @@ static unsigned int __devinit init_chipset_sis5513 (struct pci_dev *dev, const c
} }
} }
if (!chipset_family) return chipset_family;
return -1; }
static unsigned int __devinit init_chipset_sis5513(struct pci_dev *dev,
const char *name)
{
/* Make general config ops here /* Make general config ops here
1/ tell IDE channels to operate in Compatibility mode only 1/ tell IDE channels to operate in Compatibility mode only
2/ tell old chips to allow per drive IDE timings */ 2/ tell old chips to allow per drive IDE timings */
{
u8 reg; u8 reg;
u16 regw; u16 regw;
switch(chipset_family) { switch (chipset_family) {
case ATA_133: case ATA_133:
/* SiS962 operation mode */ /* SiS962 operation mode */
pci_read_config_word(dev, 0x50, &regw); pci_read_config_word(dev, 0x50, &regw);
...@@ -467,9 +469,8 @@ static unsigned int __devinit init_chipset_sis5513 (struct pci_dev *dev, const c ...@@ -467,9 +469,8 @@ static unsigned int __devinit init_chipset_sis5513 (struct pci_dev *dev, const c
pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0x80); pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0x80);
/* Set compatibility bit */ /* Set compatibility bit */
pci_read_config_byte(dev, 0x49, &reg); pci_read_config_byte(dev, 0x49, &reg);
if (!(reg & 0x01)) { if (!(reg & 0x01))
pci_write_config_byte(dev, 0x49, reg|0x01); pci_write_config_byte(dev, 0x49, reg|0x01);
}
break; break;
case ATA_100a: case ATA_100a:
case ATA_66: case ATA_66:
...@@ -478,26 +479,22 @@ static unsigned int __devinit init_chipset_sis5513 (struct pci_dev *dev, const c ...@@ -478,26 +479,22 @@ static unsigned int __devinit init_chipset_sis5513 (struct pci_dev *dev, const c
/* On ATA_66 chips the bit was elsewhere */ /* On ATA_66 chips the bit was elsewhere */
pci_read_config_byte(dev, 0x52, &reg); pci_read_config_byte(dev, 0x52, &reg);
if (!(reg & 0x04)) { if (!(reg & 0x04))
pci_write_config_byte(dev, 0x52, reg|0x04); pci_write_config_byte(dev, 0x52, reg|0x04);
}
break; break;
case ATA_33: case ATA_33:
/* On ATA_33 we didn't have a single bit to set */ /* On ATA_33 we didn't have a single bit to set */
pci_read_config_byte(dev, 0x09, &reg); pci_read_config_byte(dev, 0x09, &reg);
if ((reg & 0x0f) != 0x00) { if ((reg & 0x0f) != 0x00)
pci_write_config_byte(dev, 0x09, reg&0xf0); pci_write_config_byte(dev, 0x09, reg&0xf0);
}
case ATA_16: case ATA_16:
/* force per drive recovery and active timings /* force per drive recovery and active timings
needed on ATA_33 and below chips */ needed on ATA_33 and below chips */
pci_read_config_byte(dev, 0x52, &reg); pci_read_config_byte(dev, 0x52, &reg);
if (!(reg & 0x08)) { if (!(reg & 0x08))
pci_write_config_byte(dev, 0x52, reg|0x08); pci_write_config_byte(dev, 0x52, reg|0x08);
}
break; break;
} }
}
return 0; return 0;
} }
...@@ -546,10 +543,8 @@ static u8 __devinit ata66_sis5513(ide_hwif_t *hwif) ...@@ -546,10 +543,8 @@ static u8 __devinit ata66_sis5513(ide_hwif_t *hwif)
return ata66 ? ATA_CBL_PATA80 : ATA_CBL_PATA40; return ata66 ? ATA_CBL_PATA80 : ATA_CBL_PATA40;
} }
static void __devinit init_hwif_sis5513 (ide_hwif_t *hwif) static void __devinit init_hwif_sis5513(ide_hwif_t *hwif)
{ {
u8 udma_rates[] = { 0x00, 0x00, 0x07, 0x1f, 0x3f, 0x3f, 0x7f, 0x7f };
hwif->set_pio_mode = &sis_set_pio_mode; hwif->set_pio_mode = &sis_set_pio_mode;
hwif->set_dma_mode = &sis_set_dma_mode; hwif->set_dma_mode = &sis_set_dma_mode;
...@@ -557,27 +552,29 @@ static void __devinit init_hwif_sis5513 (ide_hwif_t *hwif) ...@@ -557,27 +552,29 @@ static void __devinit init_hwif_sis5513 (ide_hwif_t *hwif)
hwif->udma_filter = sis5513_ata133_udma_filter; hwif->udma_filter = sis5513_ata133_udma_filter;
hwif->cable_detect = ata66_sis5513; hwif->cable_detect = ata66_sis5513;
if (hwif->dma_base == 0)
return;
hwif->ultra_mask = udma_rates[chipset_family];
} }
static const struct ide_port_info sis5513_chipset __devinitdata = { static const struct ide_port_info sis5513_chipset __devinitdata = {
.name = "SIS5513", .name = "SIS5513",
.init_chipset = init_chipset_sis5513, .init_chipset = init_chipset_sis5513,
.init_hwif = init_hwif_sis5513, .init_hwif = init_hwif_sis5513,
.enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, .enablebits = { {0x4a, 0x02, 0x02}, {0x4a, 0x04, 0x04} },
.host_flags = IDE_HFLAG_LEGACY_IRQS | IDE_HFLAG_NO_AUTODMA | .host_flags = IDE_HFLAG_LEGACY_IRQS | IDE_HFLAG_NO_AUTODMA,
IDE_HFLAG_BOOTABLE,
.pio_mask = ATA_PIO4, .pio_mask = ATA_PIO4,
.mwdma_mask = ATA_MWDMA2, .mwdma_mask = ATA_MWDMA2,
}; };
static int __devinit sis5513_init_one(struct pci_dev *dev, const struct pci_device_id *id) static int __devinit sis5513_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{ {
return ide_setup_pci_device(dev, &sis5513_chipset); struct ide_port_info d = sis5513_chipset;
u8 udma_rates[] = { 0x00, 0x00, 0x07, 0x1f, 0x3f, 0x3f, 0x7f, 0x7f };
if (sis_find_family(dev) == 0)
return -ENOTSUPP;
d.udma_mask = udma_rates[chipset_family];
return ide_setup_pci_device(dev, &d);
} }
static const struct pci_device_id sis5513_pci_tbl[] = { static const struct pci_device_id sis5513_pci_tbl[] = {
......
...@@ -332,8 +332,7 @@ static const struct ide_port_info sl82c105_chipset __devinitdata = { ...@@ -332,8 +332,7 @@ static const struct ide_port_info sl82c105_chipset __devinitdata = {
#if defined(CONFIG_LOPEC) || defined(CONFIG_SANDPOINT) #if defined(CONFIG_LOPEC) || defined(CONFIG_SANDPOINT)
IDE_HFLAG_FORCE_LEGACY_IRQS | IDE_HFLAG_FORCE_LEGACY_IRQS |
#endif #endif
IDE_HFLAG_NO_AUTODMA | IDE_HFLAG_NO_AUTODMA,
IDE_HFLAG_BOOTABLE,
.pio_mask = ATA_PIO5, .pio_mask = ATA_PIO5,
}; };
......
...@@ -29,7 +29,7 @@ static void slc90e66_set_pio_mode(ide_drive_t *drive, const u8 pio) ...@@ -29,7 +29,7 @@ static void slc90e66_set_pio_mode(ide_drive_t *drive, const u8 pio)
u8 slave_data; u8 slave_data;
int control = 0; int control = 0;
/* ISP RTC */ /* ISP RTC */
static const u8 timings[][2]= { static const u8 timings[][2] = {
{ 0, 0 }, { 0, 0 },
{ 0, 0 }, { 0, 0 },
{ 1, 0 }, { 1, 0 },
...@@ -136,8 +136,8 @@ static void __devinit init_hwif_slc90e66(ide_hwif_t *hwif) ...@@ -136,8 +136,8 @@ static void __devinit init_hwif_slc90e66(ide_hwif_t *hwif)
static const struct ide_port_info slc90e66_chipset __devinitdata = { static const struct ide_port_info slc90e66_chipset __devinitdata = {
.name = "SLC90E66", .name = "SLC90E66",
.init_hwif = init_hwif_slc90e66, .init_hwif = init_hwif_slc90e66,
.enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, .enablebits = { {0x41, 0x80, 0x80}, {0x43, 0x80, 0x80} },
.host_flags = IDE_HFLAG_LEGACY_IRQS | IDE_HFLAG_BOOTABLE, .host_flags = IDE_HFLAG_LEGACY_IRQS,
.pio_mask = ATA_PIO4, .pio_mask = ATA_PIO4,
.swdma_mask = ATA_SWDMA2_ONLY, .swdma_mask = ATA_SWDMA2_ONLY,
.mwdma_mask = ATA_MWDMA12_ONLY, .mwdma_mask = ATA_MWDMA12_ONLY,
......
...@@ -97,7 +97,6 @@ static const struct ide_port_info triflex_device __devinitdata = { ...@@ -97,7 +97,6 @@ static const struct ide_port_info triflex_device __devinitdata = {
.name = "TRIFLEX", .name = "TRIFLEX",
.init_hwif = init_hwif_triflex, .init_hwif = init_hwif_triflex,
.enablebits = {{0x80, 0x01, 0x01}, {0x80, 0x02, 0x02}}, .enablebits = {{0x80, 0x01, 0x01}, {0x80, 0x02, 0x02}},
.host_flags = IDE_HFLAG_BOOTABLE,
.pio_mask = ATA_PIO4, .pio_mask = ATA_PIO4,
.swdma_mask = ATA_SWDMA2, .swdma_mask = ATA_SWDMA2,
.mwdma_mask = ATA_MWDMA2, .mwdma_mask = ATA_MWDMA2,
......
...@@ -337,7 +337,6 @@ static const struct ide_port_info trm290_chipset __devinitdata = { ...@@ -337,7 +337,6 @@ static const struct ide_port_info trm290_chipset __devinitdata = {
IDE_HFLAG_TRUST_BIOS_FOR_DMA | IDE_HFLAG_TRUST_BIOS_FOR_DMA |
#endif #endif
IDE_HFLAG_NO_AUTODMA | IDE_HFLAG_NO_AUTODMA |
IDE_HFLAG_BOOTABLE |
IDE_HFLAG_NO_LBA48, IDE_HFLAG_NO_LBA48,
}; };
......
...@@ -429,11 +429,9 @@ static const struct ide_port_info via82cxxx_chipset __devinitdata = { ...@@ -429,11 +429,9 @@ static const struct ide_port_info via82cxxx_chipset __devinitdata = {
.init_hwif = init_hwif_via82cxxx, .init_hwif = init_hwif_via82cxxx,
.enablebits = { { 0x40, 0x02, 0x02 }, { 0x40, 0x01, 0x01 } }, .enablebits = { { 0x40, 0x02, 0x02 }, { 0x40, 0x01, 0x01 } },
.host_flags = IDE_HFLAG_PIO_NO_BLACKLIST | .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST |
IDE_HFLAG_PIO_NO_DOWNGRADE |
IDE_HFLAG_ABUSE_SET_DMA_MODE | IDE_HFLAG_ABUSE_SET_DMA_MODE |
IDE_HFLAG_POST_SET_MODE | IDE_HFLAG_POST_SET_MODE |
IDE_HFLAG_IO_32BIT | IDE_HFLAG_IO_32BIT,
IDE_HFLAG_BOOTABLE,
.pio_mask = ATA_PIO5, .pio_mask = ATA_PIO5,
.swdma_mask = ATA_SWDMA2, .swdma_mask = ATA_SWDMA2,
.mwdma_mask = ATA_MWDMA2, .mwdma_mask = ATA_MWDMA2,
......
...@@ -36,6 +36,8 @@ ...@@ -36,6 +36,8 @@
#include <asm/machdep.h> #include <asm/machdep.h>
#include <asm/irq.h> #include <asm/irq.h>
#define DRV_NAME "ide-mpc8xx"
static int identify (volatile u8 *p); static int identify (volatile u8 *p);
static void print_fixed (volatile u8 *p); static void print_fixed (volatile u8 *p);
static void print_funcid (int func); static void print_funcid (int func);
...@@ -127,7 +129,7 @@ static int pcmcia_schlvl = PCMCIA_SCHLVL; ...@@ -127,7 +129,7 @@ static int pcmcia_schlvl = PCMCIA_SCHLVL;
* MPC8xx's internal PCMCIA interface * MPC8xx's internal PCMCIA interface
*/ */
#if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_IDE_8xx_DIRECT) #if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_IDE_8xx_DIRECT)
static void __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port) static int __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port)
{ {
unsigned long *p = hw->io_ports; unsigned long *p = hw->io_ports;
int i; int i;
...@@ -182,6 +184,13 @@ static void __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port) ...@@ -182,6 +184,13 @@ static void __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port)
pcmcia_phy_base, pcmcia_phy_end, pcmcia_phy_base, pcmcia_phy_end,
pcmcia_phy_end - pcmcia_phy_base); pcmcia_phy_end - pcmcia_phy_base);
if (!request_mem_region(pcmcia_phy_base,
pcmcia_phy_end - pcmcia_phy_base,
DRV_NAME)) {
printk(KERN_ERR "%s: resources busy\n", DRV_NAME);
return -EBUSY;
}
pcmcia_base=(unsigned long)ioremap(pcmcia_phy_base, pcmcia_base=(unsigned long)ioremap(pcmcia_phy_base,
pcmcia_phy_end-pcmcia_phy_base); pcmcia_phy_end-pcmcia_phy_base);
...@@ -236,7 +245,7 @@ static void __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port) ...@@ -236,7 +245,7 @@ static void __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port)
if (pcmp->pcmc_pipr & (M8XX_PCMCIA_CD1(_slot_)|M8XX_PCMCIA_CD2(_slot_))) { if (pcmp->pcmc_pipr & (M8XX_PCMCIA_CD1(_slot_)|M8XX_PCMCIA_CD2(_slot_))) {
printk ("No card in slot %c: PIPR=%08x\n", printk ("No card in slot %c: PIPR=%08x\n",
'A' + _slot_, (u32) pcmp->pcmc_pipr); 'A' + _slot_, (u32) pcmp->pcmc_pipr);
return; /* No card in slot */ return -ENODEV; /* No card in slot */
} }
check_ide_device (pcmcia_base); check_ide_device (pcmcia_base);
...@@ -279,9 +288,6 @@ static void __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port) ...@@ -279,9 +288,6 @@ static void __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port)
} }
#endif /* CONFIG_IDE_8xx_PCCARD */ #endif /* CONFIG_IDE_8xx_PCCARD */
ide_hwifs[data_port].pio_mask = ATA_PIO4;
ide_hwifs[data_port].set_pio_mode = m8xx_ide_set_pio_mode;
/* Enable Harddisk Interrupt, /* Enable Harddisk Interrupt,
* and make it edge sensitive * and make it edge sensitive
*/ */
...@@ -296,6 +302,8 @@ static void __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port) ...@@ -296,6 +302,8 @@ static void __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port)
/* Enable falling edge irq */ /* Enable falling edge irq */
pcmp->pcmc_per = 0x100000 >> (16 * _slot_); pcmp->pcmc_per = 0x100000 >> (16 * _slot_);
#endif /* CONFIG_IDE_8xx_PCCARD */ #endif /* CONFIG_IDE_8xx_PCCARD */
return 0;
} }
#endif /* CONFIG_IDE_8xx_PCCARD || CONFIG_IDE_8xx_DIRECT */ #endif /* CONFIG_IDE_8xx_PCCARD || CONFIG_IDE_8xx_DIRECT */
...@@ -304,7 +312,7 @@ static void __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port) ...@@ -304,7 +312,7 @@ static void __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port)
* MPC8xx's internal PCMCIA interface * MPC8xx's internal PCMCIA interface
*/ */
#if defined(CONFIG_IDE_EXT_DIRECT) #if defined(CONFIG_IDE_EXT_DIRECT)
static void __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port) static int __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port)
{ {
unsigned long *p = hw->io_ports; unsigned long *p = hw->io_ports;
int i; int i;
...@@ -328,6 +336,11 @@ static void __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port) ...@@ -328,6 +336,11 @@ static void __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port)
ide_phy_base, ide_phy_end, ide_phy_base, ide_phy_end,
ide_phy_end - ide_phy_base); ide_phy_end - ide_phy_base);
if (!request_mem_region(ide_phy_base, 0x200, DRV_NAME)) {
printk(KERN_ERR "%s: resources busy\n", DRV_NAME);
return -EBUSY;
}
ide_base=(unsigned long)ioremap(ide_phy_base, ide_base=(unsigned long)ioremap(ide_phy_base,
ide_phy_end-ide_phy_base); ide_phy_end-ide_phy_base);
...@@ -357,15 +370,14 @@ static void __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port) ...@@ -357,15 +370,14 @@ static void __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port)
hw->irq = ioport_dsc[data_port].irq; hw->irq = ioport_dsc[data_port].irq;
hw->ack_intr = (ide_ack_intr_t *)ide_interrupt_ack; hw->ack_intr = (ide_ack_intr_t *)ide_interrupt_ack;
ide_hwifs[data_port].pio_mask = ATA_PIO4;
ide_hwifs[data_port].set_pio_mode = m8xx_ide_set_pio_mode;
/* Enable Harddisk Interrupt, /* Enable Harddisk Interrupt,
* and make it edge sensitive * and make it edge sensitive
*/ */
/* (11-18) Set edge detect for irq, no wakeup from low power mode */ /* (11-18) Set edge detect for irq, no wakeup from low power mode */
((immap_t *) IMAP_ADDR)->im_siu_conf.sc_siel |= ((immap_t *) IMAP_ADDR)->im_siu_conf.sc_siel |=
(0x80000000 >> ioport_dsc[data_port].irq); (0x80000000 >> ioport_dsc[data_port].irq);
return 0;
} }
#endif /* CONFIG_IDE_8xx_DIRECT */ #endif /* CONFIG_IDE_8xx_DIRECT */
...@@ -794,14 +806,28 @@ static int __init mpc8xx_ide_probe(void) ...@@ -794,14 +806,28 @@ static int __init mpc8xx_ide_probe(void)
#ifdef IDE0_BASE_OFFSET #ifdef IDE0_BASE_OFFSET
memset(&hw, 0, sizeof(hw)); memset(&hw, 0, sizeof(hw));
m8xx_ide_init_ports(&hw, 0); if (!m8xx_ide_init_ports(&hw, 0)) {
ide_init_port_hw(&ide_hwifs[0], &hw); ide_hwif_t *hwif = &ide_hwifs[0];
ide_init_port_hw(hwif, &hw);
hwif->mmio = 1;
hwif->pio_mask = ATA_PIO4;
hwif->set_pio_mode = m8xx_ide_set_pio_mode;
idx[0] = 0; idx[0] = 0;
}
#ifdef IDE1_BASE_OFFSET #ifdef IDE1_BASE_OFFSET
memset(&hw, 0, sizeof(hw)); memset(&hw, 0, sizeof(hw));
m8xx_ide_init_ports(&hw, 1); if (!m8xx_ide_init_ports(&hw, 1)) {
ide_init_port_hw(&ide_hwifs[1], &hw); ide_hwif_t *mate = &ide_hwifs[1];
ide_init_port_hw(mate, &hw);
mate->mmio = 1;
mate->pio_mask = ATA_PIO4;
mate->set_pio_mode = m8xx_ide_set_pio_mode;
idx[1] = 1; idx[1] = 1;
}
#endif #endif
#endif #endif
......
...@@ -79,8 +79,6 @@ typedef struct pmac_ide_hwif { ...@@ -79,8 +79,6 @@ typedef struct pmac_ide_hwif {
} pmac_ide_hwif_t; } pmac_ide_hwif_t;
static pmac_ide_hwif_t pmac_ide[MAX_HWIFS];
enum { enum {
controller_ohare, /* OHare based */ controller_ohare, /* OHare based */
controller_heathrow, /* Heathrow/Paddington */ controller_heathrow, /* Heathrow/Paddington */
...@@ -923,7 +921,6 @@ pmac_ide_do_resume(ide_hwif_t *hwif) ...@@ -923,7 +921,6 @@ pmac_ide_do_resume(ide_hwif_t *hwif)
static const struct ide_port_info pmac_port_info = { static const struct ide_port_info pmac_port_info = {
.chipset = ide_pmac, .chipset = ide_pmac,
.host_flags = IDE_HFLAG_SET_PIO_MODE_KEEP_DMA | .host_flags = IDE_HFLAG_SET_PIO_MODE_KEEP_DMA |
IDE_HFLAG_PIO_NO_DOWNGRADE |
IDE_HFLAG_POST_SET_MODE | IDE_HFLAG_POST_SET_MODE |
IDE_HFLAG_NO_DMA | /* no SFF-style DMA */ IDE_HFLAG_NO_DMA | /* no SFF-style DMA */
IDE_HFLAG_UNMASK_IRQS, IDE_HFLAG_UNMASK_IRQS,
...@@ -1088,35 +1085,36 @@ pmac_ide_macio_attach(struct macio_dev *mdev, const struct of_device_id *match) ...@@ -1088,35 +1085,36 @@ pmac_ide_macio_attach(struct macio_dev *mdev, const struct of_device_id *match)
{ {
void __iomem *base; void __iomem *base;
unsigned long regbase; unsigned long regbase;
int irq;
ide_hwif_t *hwif; ide_hwif_t *hwif;
pmac_ide_hwif_t *pmif; pmac_ide_hwif_t *pmif;
int i, rc; int irq, rc;
hw_regs_t hw; hw_regs_t hw;
i = 0; pmif = kzalloc(sizeof(*pmif), GFP_KERNEL);
while (i < MAX_HWIFS && (ide_hwifs[i].io_ports[IDE_DATA_OFFSET] != 0 if (pmif == NULL)
|| pmac_ide[i].node != NULL)) return -ENOMEM;
++i;
if (i >= MAX_HWIFS) { hwif = ide_find_port();
if (hwif == NULL) {
printk(KERN_ERR "ide-pmac: MacIO interface attach with no slot\n"); printk(KERN_ERR "ide-pmac: MacIO interface attach with no slot\n");
printk(KERN_ERR " %s\n", mdev->ofdev.node->full_name); printk(KERN_ERR " %s\n", mdev->ofdev.node->full_name);
return -ENODEV; rc = -ENODEV;
goto out_free_pmif;
} }
pmif = &pmac_ide[i];
hwif = &ide_hwifs[i];
if (macio_resource_count(mdev) == 0) { if (macio_resource_count(mdev) == 0) {
printk(KERN_WARNING "ide%d: no address for %s\n", printk(KERN_WARNING "ide-pmac: no address for %s\n",
i, mdev->ofdev.node->full_name); mdev->ofdev.node->full_name);
return -ENXIO; rc = -ENXIO;
goto out_free_pmif;
} }
/* Request memory resource for IO ports */ /* Request memory resource for IO ports */
if (macio_request_resource(mdev, 0, "ide-pmac (ports)")) { if (macio_request_resource(mdev, 0, "ide-pmac (ports)")) {
printk(KERN_ERR "ide%d: can't request mmio resource !\n", i); printk(KERN_ERR "ide-pmac: can't request MMIO resource for "
return -EBUSY; "%s!\n", mdev->ofdev.node->full_name);
rc = -EBUSY;
goto out_free_pmif;
} }
/* XXX This is bogus. Should be fixed in the registry by checking /* XXX This is bogus. Should be fixed in the registry by checking
...@@ -1125,8 +1123,8 @@ pmac_ide_macio_attach(struct macio_dev *mdev, const struct of_device_id *match) ...@@ -1125,8 +1123,8 @@ pmac_ide_macio_attach(struct macio_dev *mdev, const struct of_device_id *match)
* where that happens though... * where that happens though...
*/ */
if (macio_irq_count(mdev) == 0) { if (macio_irq_count(mdev) == 0) {
printk(KERN_WARNING "ide%d: no intrs for device %s, using 13\n", printk(KERN_WARNING "ide-pmac: no intrs for device %s, using "
i, mdev->ofdev.node->full_name); "13\n", mdev->ofdev.node->full_name);
irq = irq_create_mapping(NULL, 13); irq = irq_create_mapping(NULL, 13);
} else } else
irq = macio_irq(mdev, 0); irq = macio_irq(mdev, 0);
...@@ -1144,7 +1142,9 @@ pmac_ide_macio_attach(struct macio_dev *mdev, const struct of_device_id *match) ...@@ -1144,7 +1142,9 @@ pmac_ide_macio_attach(struct macio_dev *mdev, const struct of_device_id *match)
#ifdef CONFIG_BLK_DEV_IDEDMA_PMAC #ifdef CONFIG_BLK_DEV_IDEDMA_PMAC
if (macio_resource_count(mdev) >= 2) { if (macio_resource_count(mdev) >= 2) {
if (macio_request_resource(mdev, 1, "ide-pmac (dma)")) if (macio_request_resource(mdev, 1, "ide-pmac (dma)"))
printk(KERN_WARNING "ide%d: can't request DMA resource !\n", i); printk(KERN_WARNING "ide-pmac: can't request DMA "
"resource for %s!\n",
mdev->ofdev.node->full_name);
else else
pmif->dma_regs = ioremap(macio_resource_start(mdev, 1), 0x1000); pmif->dma_regs = ioremap(macio_resource_start(mdev, 1), 0x1000);
} else } else
...@@ -1166,11 +1166,15 @@ pmac_ide_macio_attach(struct macio_dev *mdev, const struct of_device_id *match) ...@@ -1166,11 +1166,15 @@ pmac_ide_macio_attach(struct macio_dev *mdev, const struct of_device_id *match)
iounmap(pmif->dma_regs); iounmap(pmif->dma_regs);
macio_release_resource(mdev, 1); macio_release_resource(mdev, 1);
} }
memset(pmif, 0, sizeof(*pmif));
macio_release_resource(mdev, 0); macio_release_resource(mdev, 0);
kfree(pmif);
} }
return rc; return rc;
out_free_pmif:
kfree(pmif);
return rc;
} }
static int static int
...@@ -1215,7 +1219,7 @@ pmac_ide_pci_attach(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -1215,7 +1219,7 @@ pmac_ide_pci_attach(struct pci_dev *pdev, const struct pci_device_id *id)
pmac_ide_hwif_t *pmif; pmac_ide_hwif_t *pmif;
void __iomem *base; void __iomem *base;
unsigned long rbase, rlen; unsigned long rbase, rlen;
int i, rc; int rc;
hw_regs_t hw; hw_regs_t hw;
np = pci_device_to_OF_node(pdev); np = pci_device_to_OF_node(pdev);
...@@ -1223,30 +1227,32 @@ pmac_ide_pci_attach(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -1223,30 +1227,32 @@ pmac_ide_pci_attach(struct pci_dev *pdev, const struct pci_device_id *id)
printk(KERN_ERR "ide-pmac: cannot find MacIO node for Kauai ATA interface\n"); printk(KERN_ERR "ide-pmac: cannot find MacIO node for Kauai ATA interface\n");
return -ENODEV; return -ENODEV;
} }
i = 0;
while (i < MAX_HWIFS && (ide_hwifs[i].io_ports[IDE_DATA_OFFSET] != 0 pmif = kzalloc(sizeof(*pmif), GFP_KERNEL);
|| pmac_ide[i].node != NULL)) if (pmif == NULL)
++i; return -ENOMEM;
if (i >= MAX_HWIFS) {
hwif = ide_find_port();
if (hwif == NULL) {
printk(KERN_ERR "ide-pmac: PCI interface attach with no slot\n"); printk(KERN_ERR "ide-pmac: PCI interface attach with no slot\n");
printk(KERN_ERR " %s\n", np->full_name); printk(KERN_ERR " %s\n", np->full_name);
return -ENODEV; rc = -ENODEV;
goto out_free_pmif;
} }
pmif = &pmac_ide[i];
hwif = &ide_hwifs[i];
if (pci_enable_device(pdev)) { if (pci_enable_device(pdev)) {
printk(KERN_WARNING "ide%i: Can't enable PCI device for %s\n", printk(KERN_WARNING "ide-pmac: Can't enable PCI device for "
i, np->full_name); "%s\n", np->full_name);
return -ENXIO; rc = -ENXIO;
goto out_free_pmif;
} }
pci_set_master(pdev); pci_set_master(pdev);
if (pci_request_regions(pdev, "Kauai ATA")) { if (pci_request_regions(pdev, "Kauai ATA")) {
printk(KERN_ERR "ide%d: Cannot obtain PCI resources for %s\n", printk(KERN_ERR "ide-pmac: Cannot obtain PCI resources for "
i, np->full_name); "%s\n", np->full_name);
return -ENXIO; rc = -ENXIO;
goto out_free_pmif;
} }
hwif->dev = &pdev->dev; hwif->dev = &pdev->dev;
...@@ -1276,11 +1282,15 @@ pmac_ide_pci_attach(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -1276,11 +1282,15 @@ pmac_ide_pci_attach(struct pci_dev *pdev, const struct pci_device_id *id)
/* The inteface is released to the common IDE layer */ /* The inteface is released to the common IDE layer */
pci_set_drvdata(pdev, NULL); pci_set_drvdata(pdev, NULL);
iounmap(base); iounmap(base);
memset(pmif, 0, sizeof(*pmif));
pci_release_regions(pdev); pci_release_regions(pdev);
kfree(pmif);
} }
return rc; return rc;
out_free_pmif:
kfree(pmif);
return rc;
} }
static int static int
......
...@@ -20,73 +20,6 @@ ...@@ -20,73 +20,6 @@
#include <asm/io.h> #include <asm/io.h>
#include <asm/irq.h> #include <asm/irq.h>
/**
* ide_match_hwif - match a PCI IDE against an ide_hwif
* @io_base: I/O base of device
* @bootable: set if its bootable
* @name: name of device
*
* Match a PCI IDE port against an entry in ide_hwifs[],
* based on io_base port if possible. Return the matching hwif,
* or a new hwif. If we find an error (clashing, out of devices, etc)
* return NULL
*
* FIXME: we need to handle mmio matches here too
*/
static ide_hwif_t *ide_match_hwif(unsigned long io_base, u8 bootable, const char *name)
{
int h;
ide_hwif_t *hwif;
/*
* Look for a hwif with matching io_base default value.
* If chipset is "ide_unknown", then claim that hwif slot.
* Otherwise, some other chipset has already claimed it.. :(
*/
for (h = 0; h < MAX_HWIFS; ++h) {
hwif = &ide_hwifs[h];
if (hwif->io_ports[IDE_DATA_OFFSET] == io_base) {
if (hwif->chipset == ide_unknown)
return hwif; /* match */
printk(KERN_ERR "%s: port 0x%04lx already claimed by %s\n",
name, io_base, hwif->name);
return NULL; /* already claimed */
}
}
/*
* Okay, there is no hwif matching our io_base,
* so we'll just claim an unassigned slot.
* Give preference to claiming other slots before claiming ide0/ide1,
* just in case there's another interface yet-to-be-scanned
* which uses ports 1f0/170 (the ide0/ide1 defaults).
*
* Unless there is a bootable card that does not use the standard
* ports 1f0/170 (the ide0/ide1 defaults). The (bootable) flag.
*/
if (bootable) {
for (h = 0; h < MAX_HWIFS; ++h) {
hwif = &ide_hwifs[h];
if (hwif->chipset == ide_unknown)
return hwif; /* pick an unused entry */
}
} else {
for (h = 2; h < MAX_HWIFS; ++h) {
hwif = ide_hwifs + h;
if (hwif->chipset == ide_unknown)
return hwif; /* pick an unused entry */
}
}
for (h = 0; h < 2 && h < MAX_HWIFS; ++h) {
hwif = ide_hwifs + h;
if (hwif->chipset == ide_unknown)
return hwif; /* pick an unused entry */
}
printk(KERN_ERR "%s: too many IDE interfaces, no room in table\n", name);
return NULL;
}
/** /**
* ide_setup_pci_baseregs - place a PCI IDE controller native * ide_setup_pci_baseregs - place a PCI IDE controller native
* @dev: PCI device of interface to switch native * @dev: PCI device of interface to switch native
...@@ -100,7 +33,7 @@ static ide_hwif_t *ide_match_hwif(unsigned long io_base, u8 bootable, const char ...@@ -100,7 +33,7 @@ static ide_hwif_t *ide_match_hwif(unsigned long io_base, u8 bootable, const char
* we don't switch it back to legacy mode. Do we actually care ?? * we don't switch it back to legacy mode. Do we actually care ??
*/ */
static int ide_setup_pci_baseregs (struct pci_dev *dev, const char *name) static int ide_setup_pci_baseregs(struct pci_dev *dev, const char *name)
{ {
u8 progif = 0; u8 progif = 0;
...@@ -207,7 +140,6 @@ void ide_setup_pci_noise(struct pci_dev *dev, const struct ide_port_info *d) ...@@ -207,7 +140,6 @@ void ide_setup_pci_noise(struct pci_dev *dev, const struct ide_port_info *d)
" PCI slot %s\n", d->name, dev->vendor, dev->device, " PCI slot %s\n", d->name, dev->vendor, dev->device,
dev->revision, pci_name(dev)); dev->revision, pci_name(dev));
} }
EXPORT_SYMBOL_GPL(ide_setup_pci_noise); EXPORT_SYMBOL_GPL(ide_setup_pci_noise);
...@@ -279,8 +211,8 @@ static int ide_pci_configure(struct pci_dev *dev, const struct ide_port_info *d) ...@@ -279,8 +211,8 @@ static int ide_pci_configure(struct pci_dev *dev, const struct ide_port_info *d)
* Maybe the user deliberately *disabled* the device, * Maybe the user deliberately *disabled* the device,
* but we'll eventually ignore it again if no drives respond. * but we'll eventually ignore it again if no drives respond.
*/ */
if (ide_setup_pci_baseregs(dev, d->name) || pci_write_config_word(dev, PCI_COMMAND, pcicmd|PCI_COMMAND_IO)) if (ide_setup_pci_baseregs(dev, d->name) ||
{ pci_write_config_word(dev, PCI_COMMAND, pcicmd | PCI_COMMAND_IO)) {
printk(KERN_INFO "%s: device disabled (BIOS)\n", d->name); printk(KERN_INFO "%s: device disabled (BIOS)\n", d->name);
return -ENODEV; return -ENODEV;
} }
...@@ -301,11 +233,12 @@ static int ide_pci_configure(struct pci_dev *dev, const struct ide_port_info *d) ...@@ -301,11 +233,12 @@ static int ide_pci_configure(struct pci_dev *dev, const struct ide_port_info *d)
* @d: IDE port info * @d: IDE port info
* @bar: BAR number * @bar: BAR number
* *
* Checks if a BAR is configured and points to MMIO space. If so * Checks if a BAR is configured and points to MMIO space. If so,
* print an error and return an error code. Otherwise return 0 * return an error code. Otherwise return 0
*/ */
static int ide_pci_check_iomem(struct pci_dev *dev, const struct ide_port_info *d, int bar) static int ide_pci_check_iomem(struct pci_dev *dev, const struct ide_port_info *d,
int bar)
{ {
ulong flags = pci_resource_flags(dev, bar); ulong flags = pci_resource_flags(dev, bar);
...@@ -314,13 +247,10 @@ static int ide_pci_check_iomem(struct pci_dev *dev, const struct ide_port_info * ...@@ -314,13 +247,10 @@ static int ide_pci_check_iomem(struct pci_dev *dev, const struct ide_port_info *
return 0; return 0;
/* I/O space */ /* I/O space */
if(flags & PCI_BASE_ADDRESS_IO_MASK) if (flags & IORESOURCE_IO)
return 0; return 0;
/* Bad */ /* Bad */
printk(KERN_ERR "%s: IO baseregs (BIOS) are reported "
"as MEM, report to "
"<andre@linux-ide.org>.\n", d->name);
return -EINVAL; return -EINVAL;
} }
...@@ -344,13 +274,15 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, ...@@ -344,13 +274,15 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev,
{ {
unsigned long ctl = 0, base = 0; unsigned long ctl = 0, base = 0;
ide_hwif_t *hwif; ide_hwif_t *hwif;
u8 bootable = (d->host_flags & IDE_HFLAG_BOOTABLE) ? 1 : 0;
struct hw_regs_s hw; struct hw_regs_s hw;
if ((d->host_flags & IDE_HFLAG_ISA_PORTS) == 0) { if ((d->host_flags & IDE_HFLAG_ISA_PORTS) == 0) {
/* Possibly we should fail if these checks report true */ if (ide_pci_check_iomem(dev, d, 2 * port) ||
ide_pci_check_iomem(dev, d, 2*port); ide_pci_check_iomem(dev, d, 2 * port + 1)) {
ide_pci_check_iomem(dev, d, 2*port+1); printk(KERN_ERR "%s: I/O baseregs (BIOS) are reported "
"as MEM for port %d!\n", d->name, port);
return NULL;
}
ctl = pci_resource_start(dev, 2*port+1); ctl = pci_resource_start(dev, 2*port+1);
base = pci_resource_start(dev, 2*port); base = pci_resource_start(dev, 2*port);
...@@ -360,14 +292,18 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, ...@@ -360,14 +292,18 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev,
return NULL; return NULL;
} }
} }
if (!ctl) if (!ctl) {
{
/* Use default values */ /* Use default values */
ctl = port ? 0x374 : 0x3f4; ctl = port ? 0x374 : 0x3f4;
base = port ? 0x170 : 0x1f0; base = port ? 0x170 : 0x1f0;
} }
if ((hwif = ide_match_hwif(base, bootable, d->name)) == NULL)
return NULL; /* no room in ide_hwifs[] */ hwif = ide_find_port_slot(d);
if (hwif == NULL) {
printk(KERN_ERR "%s: too many IDE interfaces, no room in "
"table\n", d->name);
return NULL;
}
memset(&hw, 0, sizeof(hw)); memset(&hw, 0, sizeof(hw));
hw.irq = irq; hw.irq = irq;
...@@ -514,7 +450,6 @@ void ide_pci_setup_ports(struct pci_dev *dev, const struct ide_port_info *d, int ...@@ -514,7 +450,6 @@ void ide_pci_setup_ports(struct pci_dev *dev, const struct ide_port_info *d, int
*(idx + port) = hwif->index; *(idx + port) = hwif->index;
} }
} }
EXPORT_SYMBOL_GPL(ide_pci_setup_ports); EXPORT_SYMBOL_GPL(ide_pci_setup_ports);
/* /*
...@@ -597,7 +532,6 @@ int ide_setup_pci_device(struct pci_dev *dev, const struct ide_port_info *d) ...@@ -597,7 +532,6 @@ int ide_setup_pci_device(struct pci_dev *dev, const struct ide_port_info *d)
return ret; return ret;
} }
EXPORT_SYMBOL_GPL(ide_setup_pci_device); EXPORT_SYMBOL_GPL(ide_setup_pci_device);
int ide_setup_pci_devices(struct pci_dev *dev1, struct pci_dev *dev2, int ide_setup_pci_devices(struct pci_dev *dev1, struct pci_dev *dev2,
...@@ -621,5 +555,4 @@ int ide_setup_pci_devices(struct pci_dev *dev1, struct pci_dev *dev2, ...@@ -621,5 +555,4 @@ int ide_setup_pci_devices(struct pci_dev *dev1, struct pci_dev *dev2,
out: out:
return ret; return ret;
} }
EXPORT_SYMBOL_GPL(ide_setup_pci_devices); EXPORT_SYMBOL_GPL(ide_setup_pci_devices);
...@@ -210,7 +210,6 @@ unifdef-y += hayesesp.h ...@@ -210,7 +210,6 @@ unifdef-y += hayesesp.h
unifdef-y += hdlcdrv.h unifdef-y += hdlcdrv.h
unifdef-y += hdlc.h unifdef-y += hdlc.h
unifdef-y += hdreg.h unifdef-y += hdreg.h
unifdef-y += hdsmart.h
unifdef-y += hid.h unifdef-y += hid.h
unifdef-y += hiddev.h unifdef-y += hiddev.h
unifdef-y += hidraw.h unifdef-y += hidraw.h
......
/*
* linux/include/linux/hdsmart.h
*
* Copyright (C) 1999-2000 Michael Cornwell <cornwell@acm.org>
* Copyright (C) 2000 Andre Hedrick <andre@linux-ide.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* You should have received a copy of the GNU General Public License
* (for example /usr/src/linux/COPYING); if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef _LINUX_HDSMART_H
#define _LINUX_HDSMART_H
#ifndef __KERNEL__
#define OFFLINE_FULL_SCAN 0
#define SHORT_SELF_TEST 1
#define EXTEND_SELF_TEST 2
#define SHORT_CAPTIVE_SELF_TEST 129
#define EXTEND_CAPTIVE_SELF_TEST 130
/* smart_attribute is the vendor specific in SFF-8035 spec */
typedef struct ata_smart_attribute_s {
unsigned char id;
unsigned short status_flag;
unsigned char normalized;
unsigned char worse_normal;
unsigned char raw[6];
unsigned char reserv;
} __attribute__ ((packed)) ata_smart_attribute_t;
/* smart_values is format of the read drive Atrribute command */
typedef struct ata_smart_values_s {
unsigned short revnumber;
ata_smart_attribute_t vendor_attributes [30];
unsigned char offline_data_collection_status;
unsigned char self_test_exec_status;
unsigned short total_time_to_complete_off_line;
unsigned char vendor_specific_366;
unsigned char offline_data_collection_capability;
unsigned short smart_capability;
unsigned char errorlog_capability;
unsigned char vendor_specific_371;
unsigned char short_test_completion_time;
unsigned char extend_test_completion_time;
unsigned char reserved_374_385 [12];
unsigned char vendor_specific_386_509 [125];
unsigned char chksum;
} __attribute__ ((packed)) ata_smart_values_t;
/* Smart Threshold data structures */
/* Vendor attribute of SMART Threshold */
typedef struct ata_smart_threshold_entry_s {
unsigned char id;
unsigned char normalized_threshold;
unsigned char reserved[10];
} __attribute__ ((packed)) ata_smart_threshold_entry_t;
/* Format of Read SMART THreshold Command */
typedef struct ata_smart_thresholds_s {
unsigned short revnumber;
ata_smart_threshold_entry_t thres_entries[30];
unsigned char reserved[149];
unsigned char chksum;
} __attribute__ ((packed)) ata_smart_thresholds_t;
typedef struct ata_smart_errorlog_command_struct_s {
unsigned char devicecontrolreg;
unsigned char featuresreg;
unsigned char sector_count;
unsigned char sector_number;
unsigned char cylinder_low;
unsigned char cylinder_high;
unsigned char drive_head;
unsigned char commandreg;
unsigned int timestamp;
} __attribute__ ((packed)) ata_smart_errorlog_command_struct_t;
typedef struct ata_smart_errorlog_error_struct_s {
unsigned char error_condition;
unsigned char extended_error[14];
unsigned char state;
unsigned short timestamp;
} __attribute__ ((packed)) ata_smart_errorlog_error_struct_t;
typedef struct ata_smart_errorlog_struct_s {
ata_smart_errorlog_command_struct_t commands[6];
ata_smart_errorlog_error_struct_t error_struct;
} __attribute__ ((packed)) ata_smart_errorlog_struct_t;
typedef struct ata_smart_errorlog_s {
unsigned char revnumber;
unsigned char error_log_pointer;
ata_smart_errorlog_struct_t errorlog_struct[5];
unsigned short ata_error_count;
unsigned short non_fatal_count;
unsigned short drive_timeout_count;
unsigned char reserved[53];
unsigned char chksum;
} __attribute__ ((packed)) ata_smart_errorlog_t;
typedef struct ata_smart_selftestlog_struct_s {
unsigned char selftestnumber;
unsigned char selfteststatus;
unsigned short timestamp;
unsigned char selftestfailurecheckpoint;
unsigned int lbafirstfailure;
unsigned char vendorspecific[15];
} __attribute__ ((packed)) ata_smart_selftestlog_struct_t;
typedef struct ata_smart_selftestlog_s {
unsigned short revnumber;
ata_smart_selftestlog_struct_t selftest_struct[21];
unsigned char vendorspecific[2];
unsigned char mostrecenttest;
unsigned char resevered[2];
unsigned char chksum;
} __attribute__ ((packed)) ata_smart_selftestlog_t;
#endif /* __KERNEL__ */
#endif /* _LINUX_HDSMART_H */
...@@ -170,7 +170,6 @@ typedef struct hw_regs_s { ...@@ -170,7 +170,6 @@ typedef struct hw_regs_s {
struct device *dev; struct device *dev;
} hw_regs_t; } hw_regs_t;
struct hwif_s * ide_find_port(unsigned long);
void ide_init_port_data(struct hwif_s *, unsigned int); void ide_init_port_data(struct hwif_s *, unsigned int);
void ide_init_port_hw(struct hwif_s *, hw_regs_t *); void ide_init_port_hw(struct hwif_s *, hw_regs_t *);
...@@ -522,7 +521,6 @@ typedef struct hwif_s { ...@@ -522,7 +521,6 @@ typedef struct hwif_s {
unsigned reset : 1; /* reset after probe */ unsigned reset : 1; /* reset after probe */
unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */ unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */
unsigned mmio : 1; /* host uses MMIO */ unsigned mmio : 1; /* host uses MMIO */
unsigned straight8 : 1; /* Alan's straight 8 check */
struct device gendev; struct device gendev;
struct device *portdev; struct device *portdev;
...@@ -809,6 +807,13 @@ extern ide_hwif_t ide_hwifs[]; /* master data repository */ ...@@ -809,6 +807,13 @@ extern ide_hwif_t ide_hwifs[]; /* master data repository */
#endif #endif
extern int noautodma; extern int noautodma;
ide_hwif_t *ide_find_port_slot(const struct ide_port_info *);
static inline ide_hwif_t *ide_find_port(void)
{
return ide_find_port_slot(NULL);
}
extern int ide_end_request (ide_drive_t *drive, int uptodate, int nrsecs); extern int ide_end_request (ide_drive_t *drive, int uptodate, int nrsecs);
int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq, int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq,
int uptodate, int nr_sectors); int uptodate, int nr_sectors);
...@@ -1027,8 +1032,8 @@ enum { ...@@ -1027,8 +1032,8 @@ enum {
IDE_HFLAG_SINGLE = (1 << 1), IDE_HFLAG_SINGLE = (1 << 1),
/* don't use legacy PIO blacklist */ /* don't use legacy PIO blacklist */
IDE_HFLAG_PIO_NO_BLACKLIST = (1 << 2), IDE_HFLAG_PIO_NO_BLACKLIST = (1 << 2),
/* don't use conservative PIO "downgrade" */ /* set for the second port of QD65xx */
IDE_HFLAG_PIO_NO_DOWNGRADE = (1 << 3), IDE_HFLAG_QD_2ND_PORT = (1 << 3),
/* use PIO8/9 for prefetch off/on */ /* use PIO8/9 for prefetch off/on */
IDE_HFLAG_ABUSE_PREFETCH = (1 << 4), IDE_HFLAG_ABUSE_PREFETCH = (1 << 4),
/* use PIO6/7 for fast-devsel off/on */ /* use PIO6/7 for fast-devsel off/on */
...@@ -1050,8 +1055,8 @@ enum { ...@@ -1050,8 +1055,8 @@ enum {
IDE_HFLAG_VDMA = (1 << 11), IDE_HFLAG_VDMA = (1 << 11),
/* ATAPI DMA is unsupported */ /* ATAPI DMA is unsupported */
IDE_HFLAG_NO_ATAPI_DMA = (1 << 12), IDE_HFLAG_NO_ATAPI_DMA = (1 << 12),
/* set if host is a "bootable" controller */ /* set if host is a "non-bootable" controller */
IDE_HFLAG_BOOTABLE = (1 << 13), IDE_HFLAG_NON_BOOTABLE = (1 << 13),
/* host doesn't support DMA */ /* host doesn't support DMA */
IDE_HFLAG_NO_DMA = (1 << 14), IDE_HFLAG_NO_DMA = (1 << 14),
/* check if host is PCI IDE device before allowing DMA */ /* check if host is PCI IDE device before allowing DMA */
...@@ -1079,8 +1084,6 @@ enum { ...@@ -1079,8 +1084,6 @@ enum {
/* unmask IRQs */ /* unmask IRQs */
IDE_HFLAG_UNMASK_IRQS = (1 << 25), IDE_HFLAG_UNMASK_IRQS = (1 << 25),
IDE_HFLAG_ABUSE_SET_DMA_MODE = (1 << 26), IDE_HFLAG_ABUSE_SET_DMA_MODE = (1 << 26),
/* host is CY82C693 */
IDE_HFLAG_CY82C693 = (1 << 27),
/* force host out of "simplex" mode */ /* force host out of "simplex" mode */
IDE_HFLAG_CLEAR_SIMPLEX = (1 << 28), IDE_HFLAG_CLEAR_SIMPLEX = (1 << 28),
/* DSC overlap is unsupported */ /* DSC overlap is unsupported */
...@@ -1092,9 +1095,9 @@ enum { ...@@ -1092,9 +1095,9 @@ enum {
}; };
#ifdef CONFIG_BLK_DEV_OFFBOARD #ifdef CONFIG_BLK_DEV_OFFBOARD
# define IDE_HFLAG_OFF_BOARD IDE_HFLAG_BOOTABLE
#else
# define IDE_HFLAG_OFF_BOARD 0 # define IDE_HFLAG_OFF_BOARD 0
#else
# define IDE_HFLAG_OFF_BOARD IDE_HFLAG_NON_BOOTABLE
#endif #endif
struct ide_port_info { struct ide_port_info {
......
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