Index: uspace/drv/block/isa-ide/isa-ide_hw.h
===================================================================
--- uspace/drv/block/isa-ide/isa-ide_hw.h	(revision 9faba42df60b89ae7031bd39ca9d3fb433fa989a)
+++ uspace/drv/block/isa-ide/isa-ide_hw.h	(revision 9faba42df60b89ae7031bd39ca9d3fb433fa989a)
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2025 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup pci-ide
+ * @{
+ */
+/** @file ISA IDE hardware protocol
+ */
+
+#ifndef ISA_IDE_HW_H
+#define ISA_IDE_HW_H
+
+/*
+ * PCI IDE needs to use ATA ports at fixed legacy ISA addresses.
+ * We need to know what those addresses are so that, if we are
+ * asked to attach to those *and* we know that PCI IDE is attached
+ * to legacy IDE ranges, we should not attach.
+ */
+enum {
+	leg_ide_ata_cmd_p = 0x01f0,
+	leg_ide_ata_ctl_p = 0x03f4,
+	leg_ide_ata_cmd_s = 0x0170,
+	leg_ide_ata_ctl_s = 0x0374
+};
+
+#endif
+
+/** @}
+ */
Index: uspace/drv/block/isa-ide/main.c
===================================================================
--- uspace/drv/block/isa-ide/main.c	(revision a796812c405518891216868c0051c7e9bd48cc2c)
+++ uspace/drv/block/isa-ide/main.c	(revision 9faba42df60b89ae7031bd39ca9d3fb433fa989a)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2024 Jiri Svoboda
+ * Copyright (c) 2025 Jiri Svoboda
  * All rights reserved.
  *
@@ -43,4 +43,5 @@
 
 #include "isa-ide.h"
+#include "isa-ide_hw.h"
 #include "main.h"
 
@@ -70,5 +71,5 @@
 	async_sess_t *parent_sess;
 	hw_res_list_parsed_t hw_res;
-	hw_res_flags_t flags;
+	hw_res_claims_t claims;
 	errno_t rc;
 
@@ -77,25 +78,16 @@
 		return ENOMEM;
 
-	rc = hw_res_get_flags(parent_sess, &flags);
-	if (rc != EOK)
-		return rc;
-
-	/*
-	 * Prevent attaching to the legacy ISA IDE register block
-	 * on a system with PCI not to conflict with PCI IDE.
-	 *
-	 * XXX This is a simplification. If we had a PCI-based system without
-	 * PCI-IDE or with PCI-IDE disabled and would still like to use
-	 * an ISA IDE controller, this would prevent us from doing so.
-	 */
-	if (flags & hwf_isa_bridge) {
-		ddf_msg(LVL_NOTE, "Will not attach to PCI/ISA bridge.");
-		return EIO;
+	rc = hw_res_query_legacy_io(parent_sess, &claims);
+	if (rc != EOK) {
+		ddf_msg(LVL_NOTE, "Error getting HW resource flags.");
+		return rc;
 	}
 
 	hw_res_list_parsed_init(&hw_res);
 	rc = hw_res_get_list_parsed(parent_sess, &hw_res, 0);
-	if (rc != EOK)
-		return rc;
+	if (rc != EOK) {
+		ddf_msg(LVL_NOTE, "Error getting HW resource list.");
+		return rc;
+	}
 
 	if (hw_res.io_ranges.count != 4) {
@@ -148,4 +140,16 @@
 	}
 
+	/*
+	 * Only attach to legacy ISA IDE register block if it
+	 * is not claimed by PCI IDE driver.
+	 */
+	if (res->cmd1 == leg_ide_ata_cmd_p &&
+	    res->cmd2 == leg_ide_ata_cmd_s &&
+	    (claims & hwc_isa_ide) != 0) {
+		ddf_msg(LVL_NOTE, "Will not attach to ISA legacy ports "
+		    "since they are already handled by PCI.");
+		return EBUSY;
+	}
+
 	return EOK;
 error:
@@ -167,5 +171,6 @@
 	rc = isa_ide_get_res(dev, &res);
 	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Invalid HW resource configuration.");
+		if (rc == EINVAL)
+			ddf_msg(LVL_ERROR, "Invalid HW resource configuration.");
 		return EINVAL;
 	}
Index: uspace/drv/block/pc-floppy/main.c
===================================================================
--- uspace/drv/block/pc-floppy/main.c	(revision a796812c405518891216868c0051c7e9bd48cc2c)
+++ uspace/drv/block/pc-floppy/main.c	(revision 9faba42df60b89ae7031bd39ca9d3fb433fa989a)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2024 Jiri Svoboda
+ * Copyright (c) 2025 Jiri Svoboda
  * All rights reserved.
  *
@@ -73,5 +73,4 @@
 	async_sess_t *parent_sess;
 	hw_res_list_parsed_t hw_res;
-	hw_res_flags_t flags;
 	errno_t rc;
 
@@ -79,8 +78,4 @@
 	if (parent_sess == NULL)
 		return ENOMEM;
-
-	rc = hw_res_get_flags(parent_sess, &flags);
-	if (rc != EOK)
-		return rc;
 
 	hw_res_list_parsed_init(&hw_res);
Index: uspace/drv/block/pci-ide/main.c
===================================================================
--- uspace/drv/block/pci-ide/main.c	(revision a796812c405518891216868c0051c7e9bd48cc2c)
+++ uspace/drv/block/pci-ide/main.c	(revision 9faba42df60b89ae7031bd39ca9d3fb433fa989a)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2024 Jiri Svoboda
+ * Copyright (c) 2025 Jiri Svoboda
  * All rights reserved.
  *
@@ -133,4 +133,5 @@
 	pci_ide_ctrl_t *ctrl;
 	pci_ide_hwres_t res;
+	async_sess_t *parent_sess;
 	errno_t rc;
 
@@ -164,4 +165,18 @@
 	if (rc != EOK) {
 		ddf_msg(LVL_ERROR, "Failed initializing ATA controller.");
+		rc = EIO;
+		goto error;
+	}
+
+	parent_sess = ddf_dev_parent_sess_get(dev);
+	if (parent_sess == NULL) {
+		rc = ENOMEM;
+		goto error;
+	}
+
+	/* Claim legacy I/O range to prevent ISA IDE from attaching there. */
+	rc = hw_res_claim_legacy_io(parent_sess, hwc_isa_ide);
+	if (rc != EOK) {
+		ddf_msg(LVL_ERROR, "Failed claiming legacy I/O range.");
 		rc = EIO;
 		goto error;
Index: uspace/drv/block/pci-ide/pci-ide.c
===================================================================
--- uspace/drv/block/pci-ide/pci-ide.c	(revision a796812c405518891216868c0051c7e9bd48cc2c)
+++ uspace/drv/block/pci-ide/pci-ide.c	(revision 9faba42df60b89ae7031bd39ca9d3fb433fa989a)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2024 Jiri Svoboda
+ * Copyright (c) 2025 Jiri Svoboda
  * All rights reserved.
  *
@@ -189,4 +189,6 @@
 
 	ddf_msg(LVL_DEBUG, "pci_ide_channel_init()");
+
+	memset(&params, 0, sizeof(params));
 
 	chan->ctrl = ctrl;
Index: uspace/drv/bus/isa/isa.c
===================================================================
--- uspace/drv/bus/isa/isa.c	(revision a796812c405518891216868c0051c7e9bd48cc2c)
+++ uspace/drv/bus/isa/isa.c	(revision 9faba42df60b89ae7031bd39ca9d3fb433fa989a)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2024 Jiri Svoboda
+ * Copyright (c) 2025 Jiri Svoboda
  * Copyright (c) 2010 Lenka Trochtova
  * Copyright (c) 2011 Jan Vesely
@@ -206,15 +206,44 @@
 }
 
-static errno_t isa_fun_get_flags(ddf_fun_t *fnode, hw_res_flags_t *rflags)
+/** Handle legacy IO availability query from function.
+ *
+ * @param fnode Function performing the query
+ * @param rclaims Place to store the legacy IO claims bitmask
+ * @return EOK on success or an error code
+ */
+static errno_t isa_fun_query_legacy_io(ddf_fun_t *fnode,
+    hw_res_claims_t *rclaims)
 {
 	isa_fun_t *fun = isa_fun(fnode);
-	hw_res_flags_t flags;
-
-	flags = 0;
-	if (fun->bus->pci_isa_bridge)
-		flags |= hwf_isa_bridge;
-
-	ddf_msg(LVL_NOTE, "isa_fun_get_flags: returning 0x%x", flags);
-	*rflags = flags;
+	hw_res_claims_t claims;
+	async_sess_t *sess;
+	errno_t rc;
+
+	ddf_msg(LVL_DEBUG, "isa_fun_query_legacy_io()");
+
+	sess = ddf_dev_parent_sess_get(fun->bus->dev);
+	if (sess == NULL) {
+		ddf_msg(LVL_ERROR, "isa_dev_add failed to connect to the "
+		    "parent driver.");
+		return ENOENT;
+	}
+
+	if (!fun->bus->pci_isa_bridge) {
+		ddf_msg(LVL_NOTE, "isa_fun_query_legacy_io: classic ISA - "
+		    "legacy IDE range is available");
+		/* Classic ISA, we can be sure IDE is unclaimed by PCI */
+		claims = 0;
+	} else {
+		ddf_msg(LVL_NOTE, "isa_fun_query_legacy_io: ISA bridge - "
+		    "determine legacy IDE availability from PCI bus driver");
+		rc = hw_res_query_legacy_io(sess, &claims);
+		if (rc != EOK) {
+			ddf_msg(LVL_NOTE, "Error querying legacy IO claims.");
+			return rc;
+		}
+	}
+
+	ddf_msg(LVL_DEBUG, "isa_fun_query_legacy_io: returning 0x%x", claims);
+	*rclaims = claims;
 	return EOK;
 }
@@ -227,5 +256,5 @@
 	.dma_channel_setup = isa_fun_setup_dma,
 	.dma_channel_remain = isa_fun_remain_dma,
-	.get_flags = isa_fun_get_flags
+	.query_legacy_io = isa_fun_query_legacy_io
 };
 
Index: uspace/drv/bus/pci/pciintel/pci.c
===================================================================
--- uspace/drv/bus/pci/pciintel/pci.c	(revision a796812c405518891216868c0051c7e9bd48cc2c)
+++ uspace/drv/bus/pci/pciintel/pci.c	(revision 9faba42df60b89ae7031bd39ca9d3fb433fa989a)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2019 Jiri Svoboda
+ * Copyright (c) 2025 Jiri Svoboda
  * Copyright (c) 2010 Lenka Trochtova
  * All rights reserved.
@@ -143,4 +143,76 @@
 }
 
+/** Handle legacy IO availability query from function.
+ *
+ * @param fnode Function performing the query
+ * @param rclaims Place to store the legacy IO claims bitmask
+ * @return EOK on success or an error code
+ */
+static errno_t pciintel_query_legacy_io(ddf_fun_t *fnode,
+    hw_res_claims_t *rclaims)
+{
+	pci_fun_t *fun = pci_fun(fnode);
+	pci_bus_t *bus = fun->busptr;
+	pci_fun_t *f;
+	hw_res_claims_t claims;
+
+	/*
+	 * We need to wait for enumeration to complete so that we give
+	 * the PCI IDE driver a chance to claim the legacy ISA IDE
+	 * ranges.
+	 */
+	ddf_msg(LVL_DEBUG, "pciintel_query_legacy_io");
+
+	fun->querying = true;
+
+	fibril_mutex_lock(&bus->enum_done_lock);
+	while (!bus->enum_done)
+		fibril_condvar_wait(&bus->enum_done_cv, &bus->enum_done_lock);
+	fibril_mutex_unlock(&bus->enum_done_lock);
+
+	ddf_msg(LVL_DEBUG, "Wait for PCI devices to stabilize");
+
+	f = pci_fun_first(bus);
+	while (f != NULL) {
+		if (!f->querying)
+			ddf_fun_wait_stable(f->fnode);
+		f = pci_fun_next(f);
+	}
+
+	/* Devices are stable. Now we can determine if ISA IDE was claimed. */
+
+	claims = 0;
+
+	ddf_msg(LVL_DEBUG, "PCI devices stabilized, leg_ide_claimed=%d\n",
+	    (int)bus->leg_ide_claimed);
+	if (bus->leg_ide_claimed != false) {
+		ddf_msg(LVL_NOTE, "Legacy IDE I/O ports claimed by PCI driver.");
+		claims |= hwc_isa_ide;
+	}
+
+	fun->querying = false;
+	*rclaims = claims;
+	return EOK;
+}
+
+/** Handle legacy IO claim from function.
+ *
+ * @param fnode Function claiming the legacy I/O ports
+ * @param claims Bitmask of claimed I/O
+ * @return EOK on success or an error code
+ */
+static errno_t pciintel_claim_legacy_io(ddf_fun_t *fnode,
+    hw_res_claims_t claims)
+{
+	pci_fun_t *fun = pci_fun(fnode);
+	pci_bus_t *bus = fun->busptr;
+
+	ddf_msg(LVL_DEBUG, "pciintel_claim_legacy_io() claims=%x", claims);
+	if ((claims & hwc_isa_ide) != 0)
+		bus->leg_ide_claimed = true;
+
+	return EOK;
+}
+
 static pio_window_t *pciintel_get_pio_window(ddf_fun_t *fnode)
 {
@@ -211,4 +283,6 @@
 	.disable_interrupt = &pciintel_disable_interrupt,
 	.clear_interrupt = &pciintel_clear_interrupt,
+	.query_legacy_io = &pciintel_query_legacy_io,
+	.claim_legacy_io = &pciintel_claim_legacy_io
 };
 
@@ -755,4 +829,6 @@
 	list_initialize(&bus->funs);
 	fibril_mutex_initialize(&bus->conf_mutex);
+	fibril_mutex_initialize(&bus->enum_done_lock);
+	fibril_condvar_initialize(&bus->enum_done_cv);
 
 	bus->dnode = dnode;
@@ -863,6 +939,12 @@
 	hw_res_clean_resource_list(&hw_resources);
 
+	ddf_msg(LVL_DEBUG, "Bus enumeration done.");
+
+	fibril_mutex_lock(&bus->enum_done_lock);
+	bus->enum_done = true;
+	fibril_mutex_unlock(&bus->enum_done_lock);
+	fibril_condvar_broadcast(&bus->enum_done_cv);
+
 	return EOK;
-
 fail:
 	if (got_res)
Index: uspace/drv/bus/pci/pciintel/pci.h
===================================================================
--- uspace/drv/bus/pci/pciintel/pci.h	(revision a796812c405518891216868c0051c7e9bd48cc2c)
+++ uspace/drv/bus/pci/pciintel/pci.h	(revision 9faba42df60b89ae7031bd39ca9d3fb433fa989a)
@@ -1,5 +1,5 @@
 /*
+ * Copyright (c) 2025 Jiri Svoboda
  * Copyright (c) 2010 Lenka Trochtova
- * Copyright (c) 2011 Jiri Svoboda
  * All rights reserved.
  *
@@ -41,4 +41,5 @@
 #include <ddf/driver.h>
 #include <fibril_synch.h>
+#include <stdbool.h>
 
 #define PCI_MAX_HW_RES 10
@@ -54,4 +55,12 @@
 	/** List of functions (of pci_fun_t) */
 	list_t funs;
+	/** Enumeration is done */
+	bool enum_done;
+	/** Synchronize enum_done */
+	fibril_mutex_t enum_done_lock;
+	/** Signal change to enum_done */
+	fibril_condvar_t enum_done_cv;
+	/** @c true iff legacy IDE range is claimed by PCI IDE driver */
+	bool leg_ide_claimed;
 } pci_bus_t;
 
@@ -72,4 +81,5 @@
 	uint8_t prog_if;
 	uint8_t revision;
+	bool querying;
 	hw_resource_list_t hw_resources;
 	hw_resource_t resources[PCI_MAX_HW_RES];
