summaryrefslogtreecommitdiff
path: root/linux
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2016-01-29 20:46:52 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2016-01-29 20:46:52 +0100
commitc29915fccda96258dbccf49b052ee4ddd7d51169 (patch)
tree52fb418fe463804a9fc3cba1682300562ec2ef55 /linux
parent0191a6b08f1d0e023994a64079be2d3b764d6232 (diff)
Disable probing legacy IDE when AHCI driver works
* linux/src/drivers/block/ide.c (default_io_base): Do not qualify const. (ide_disable_base): New function. * linux/dev/include/linux/blk.h (ide_disable_base): New declaration. * linux/dev/drivers/block/ahci.c (ahci_probe_dev): Call ide_disable_base with each I/O BAR of the AHCI PCI card.
Diffstat (limited to 'linux')
-rw-r--r--linux/dev/drivers/block/ahci.c15
-rw-r--r--linux/dev/include/linux/blk.h1
-rw-r--r--linux/src/drivers/block/ide.c11
3 files changed, 26 insertions, 1 deletions
diff --git a/linux/dev/drivers/block/ahci.c b/linux/dev/drivers/block/ahci.c
index f67ba2fb..b60f1a19 100644
--- a/linux/dev/drivers/block/ahci.c
+++ b/linux/dev/drivers/block/ahci.c
@@ -861,6 +861,21 @@ static void ahci_probe_dev(unsigned char bus, unsigned char device)
return;
}
+#ifdef CONFIG_BLK_DEV_IDE
+ /* OK, we will handle it. Disable probing on legacy IDE ports it may have. */
+ for (i = 0; i < 6; i++)
+ {
+ unsigned mybar;
+ if (pcibios_read_config_dword(bus, device, PCI_BASE_ADDRESS_0 + i*4, &mybar) == PCIBIOS_SUCCESSFUL) {
+ if (!(bar & PCI_BASE_ADDRESS_SPACE_IO))
+ /* Memory, don't care */
+ continue;
+ /* printk("ahci: %02x:%02x.%x: BAR %d is %x\n", bus, dev, fun, i, mybar); */
+ ide_disable_base(bar & PCI_BASE_ADDRESS_IO_MASK);
+ }
+ }
+#endif
+
nports = (readl(&ahci_host->cap) & 0x1f) + 1;
port_map = readl(&ahci_host->pi);
diff --git a/linux/dev/include/linux/blk.h b/linux/dev/include/linux/blk.h
index 156d91c4..b924a14f 100644
--- a/linux/dev/include/linux/blk.h
+++ b/linux/dev/include/linux/blk.h
@@ -78,6 +78,7 @@ extern int hd_init(void);
#endif
#ifdef CONFIG_BLK_DEV_IDE
extern int ide_init(void);
+extern void ide_disable_base(unsigned base);
#endif
#ifdef CONFIG_BLK_DEV_XD
extern int xd_init(void);
diff --git a/linux/src/drivers/block/ide.c b/linux/src/drivers/block/ide.c
index 41a26017..dc20fcba 100644
--- a/linux/src/drivers/block/ide.c
+++ b/linux/src/drivers/block/ide.c
@@ -325,7 +325,7 @@
#endif /* CONFIG_BLK_DEV_PROMISE */
static const byte ide_hwif_to_major[MAX_HWIFS] = {IDE0_MAJOR, IDE1_MAJOR, IDE2_MAJOR, IDE3_MAJOR};
-static const unsigned short default_io_base[MAX_HWIFS] = {0x1f0, 0x170, 0x1e8, 0x168};
+static unsigned short default_io_base[MAX_HWIFS] = {0x1f0, 0x170, 0x1e8, 0x168};
static const byte default_irqs[MAX_HWIFS] = {14, 15, 11, 10};
static int idebus_parameter; /* holds the "idebus=" parameter */
static int system_bus_speed; /* holds what we think is VESA/PCI bus speed */
@@ -367,6 +367,15 @@ static void set_recovery_timer (ide_hwif_t *hwif)
#endif /* DISK_RECOVERY_TIME */
+/* Called by other drivers to disable the legacy IDE driver on a given IDE base. */
+void ide_disable_base(unsigned base)
+{
+ unsigned i;
+ for (i = 0; i < MAX_HWIFS; i++)
+ if (default_io_base[i] == base)
+ default_io_base[i] = 0;
+}
+
/*
* Do not even *think* about calling this!