All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH,v2] pata_legacy: Allow disabling of legacy PATA device probes on non-PCI systems
       [not found] <1480440386-20400-1-git-send-email-tedheadster@gmail.com>
@ 2016-11-30 17:20 ` Matthew Whitehead
  2016-11-30 17:24   ` Sergei Shtylyov
  2016-11-30 18:14 ` [PATCH,v3] " Matthew Whitehead
  1 sibling, 1 reply; 3+ messages in thread
From: Matthew Whitehead @ 2016-11-30 17:20 UTC (permalink / raw)
  To: linux-ide, tj, b.zolnierkie, sergei.shtylyov, gnomes; +Cc: Matthew Whitehead

If there is no PCI bus detected in drivers/ata/pata_legacy.c, it registers all
the common legacy PATA devices. This includes I/O ports (0x1f0, 0x170, 0x1e8,
0x168, 0x1e0, 0x160) and also their associated interrupts (14,15,11,10,8,12).

Unfortunately, on such systems those interrupt lines are at a premium because
there is no PCI alternative. This patch allows you to disable individual
port/interrupt pairs by providing a list of ports to skip allocating.

modprobe pata_legacy ignore_ports=0x1e8,0x168,0x1e0,0x160

Signed-off-by: Matthew Whitehead <tedheadster@gmail.com>
---
 drivers/ata/pata_legacy.c |   30 ++++++++++++++++++++++++------
 1 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/drivers/ata/pata_legacy.c b/drivers/ata/pata_legacy.c
index 4fe9d21..65a33b4 100644
--- a/drivers/ata/pata_legacy.c
+++ b/drivers/ata/pata_legacy.c
@@ -130,6 +130,8 @@ static struct legacy_data legacy_data[NR_HOST];
 static struct ata_host *legacy_host[NR_HOST];
 static int nr_legacy_host;
 
+static int ignore_ports[NR_HOST];
+static int ignore_ports_count;
 
 static int probe_all;		/* Set to check all ISA port ranges */
 static int ht6560a;		/* HT 6560A on primary 1, second 2, both 3 */
@@ -1168,6 +1170,16 @@ static __init void probe_qdi_vlb(void)
 	}
 }
 
+static bool port_ignored(int port)
+{
+	int i;
+	for (i = 0; i < ignore_ports_count; i++) {
+		if (port == ignore_ports[i])
+			return 1;
+	}
+	return 0;
+}
+
 /**
  *	legacy_init		-	attach legacy interfaces
  *
@@ -1212,17 +1224,22 @@ static __init int legacy_init(void)
 	if (winbond == 1)
 		winbond = 0x130;	/* Default port, alt is 1B0 */
 
-	if (primary == 0 || all)
+	if ((primary == 0 || all) && !port_ignored(0x1F0))
 		legacy_probe_add(0x1F0, 14, UNKNOWN, 0);
-	if (secondary == 0 || all)
+	if ((secondary == 0 || all) && !port_ignored(0x170))
 		legacy_probe_add(0x170, 15, UNKNOWN, 0);
 
 	if (probe_all || !pci_present) {
 		/* ISA/VLB extra ports */
-		legacy_probe_add(0x1E8, 11, UNKNOWN, 0);
-		legacy_probe_add(0x168, 10, UNKNOWN, 0);
-		legacy_probe_add(0x1E0, 8, UNKNOWN, 0);
-		legacy_probe_add(0x160, 12, UNKNOWN, 0);
+
+		if (!port_ignored(0x1E8))
+			legacy_probe_add(0x1E8, 11, UNKNOWN, 0);
+		if (!port_ignored(0x168))
+			legacy_probe_add(0x168, 10, UNKNOWN, 0);
+		if (!port_ignored(0x1E0))
+			legacy_probe_add(0x1E0, 8, UNKNOWN, 0);
+		if (!port_ignored(0x160))
+			legacy_probe_add(0x160, 12, UNKNOWN, 0);
 	}
 
 	if (opti82c46x)
@@ -1272,6 +1289,7 @@ module_param(qdi, int, 0);
 module_param(winbond, int, 0);
 module_param(pio_mask, int, 0);
 module_param(iordy_mask, int, 0);
+module_param_array(ignore_ports, int, &ignore_ports_count, 0444);
 
 module_init(legacy_init);
 module_exit(legacy_exit);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH,v2] pata_legacy: Allow disabling of legacy PATA device probes on non-PCI systems
  2016-11-30 17:20 ` [PATCH,v2] pata_legacy: Allow disabling of legacy PATA device probes on non-PCI systems Matthew Whitehead
@ 2016-11-30 17:24   ` Sergei Shtylyov
  0 siblings, 0 replies; 3+ messages in thread
From: Sergei Shtylyov @ 2016-11-30 17:24 UTC (permalink / raw)
  To: Matthew Whitehead, linux-ide, tj, b.zolnierkie, gnomes

Hello.

On 11/30/2016 08:20 PM, Matthew Whitehead wrote:

> If there is no PCI bus detected in drivers/ata/pata_legacy.c, it registers all
> the common legacy PATA devices. This includes I/O ports (0x1f0, 0x170, 0x1e8,
> 0x168, 0x1e0, 0x160) and also their associated interrupts (14,15,11,10,8,12).
>
> Unfortunately, on such systems those interrupt lines are at a premium because
> there is no PCI alternative. This patch allows you to disable individual
> port/interrupt pairs by providing a list of ports to skip allocating.
>
> modprobe pata_legacy ignore_ports=0x1e8,0x168,0x1e0,0x160
>
> Signed-off-by: Matthew Whitehead <tedheadster@gmail.com>
> ---
>  drivers/ata/pata_legacy.c |   30 ++++++++++++++++++++++++------
>  1 files changed, 24 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/ata/pata_legacy.c b/drivers/ata/pata_legacy.c
> index 4fe9d21..65a33b4 100644
> --- a/drivers/ata/pata_legacy.c
> +++ b/drivers/ata/pata_legacy.c
> @@ -130,6 +130,8 @@ static struct legacy_data legacy_data[NR_HOST];
>  static struct ata_host *legacy_host[NR_HOST];
>  static int nr_legacy_host;
>
> +static int ignore_ports[NR_HOST];
> +static int ignore_ports_count;

    It's ignore_port_count if my grammar serves still. :-)

>
>  static int probe_all;		/* Set to check all ISA port ranges */
>  static int ht6560a;		/* HT 6560A on primary 1, second 2, both 3 */
> @@ -1168,6 +1170,16 @@ static __init void probe_qdi_vlb(void)
>  	}
>  }
>
> +static bool port_ignored(int port)
> +{
> +	int i;

    Need empty line here.

> +	for (i = 0; i < ignore_ports_count; i++) {
> +		if (port == ignore_ports[i])
> +			return 1;

    s/1/true/.

> +	}
> +	return 0;

    s/0/false/.

[...]

MBR, Sergei


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH,v3] pata_legacy: Allow disabling of legacy PATA device probes on non-PCI systems
       [not found] <1480440386-20400-1-git-send-email-tedheadster@gmail.com>
  2016-11-30 17:20 ` [PATCH,v2] pata_legacy: Allow disabling of legacy PATA device probes on non-PCI systems Matthew Whitehead
@ 2016-11-30 18:14 ` Matthew Whitehead
  1 sibling, 0 replies; 3+ messages in thread
From: Matthew Whitehead @ 2016-11-30 18:14 UTC (permalink / raw)
  To: linux-ide, tj, b.zolnierkie, sergei.shtylyov, gnomes; +Cc: Matthew Whitehead

If there is no PCI bus detected in drivers/ata/pata_legacy.c, it registers all
the common legacy PATA devices. This includes I/O ports (0x1f0, 0x170, 0x1e8,
0x168, 0x1e0, 0x160) and also their associated interrupts (14,15,11,10,8,12).

Unfortunately, on such systems those interrupt lines are at a premium because
there is no PCI alternative. This patch allows you to disable individual
port/interrupt pairs by providing a list of ports to skip allocating.

modprobe pata_legacy ignore_ports=0x1e8,0x168,0x1e0,0x160

Signed-off-by: Matthew Whitehead <tedheadster@gmail.com>
---
 drivers/ata/pata_legacy.c |   31 +++++++++++++++++++++++++------
 1 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/drivers/ata/pata_legacy.c b/drivers/ata/pata_legacy.c
index 4fe9d21..b9b49db 100644
--- a/drivers/ata/pata_legacy.c
+++ b/drivers/ata/pata_legacy.c
@@ -130,6 +130,8 @@ static struct legacy_data legacy_data[NR_HOST];
 static struct ata_host *legacy_host[NR_HOST];
 static int nr_legacy_host;
 
+static int ignore_ports[NR_HOST];
+static int ignore_ports_count;
 
 static int probe_all;		/* Set to check all ISA port ranges */
 static int ht6560a;		/* HT 6560A on primary 1, second 2, both 3 */
@@ -1168,6 +1170,17 @@ static __init void probe_qdi_vlb(void)
 	}
 }
 
+static bool port_ignored(int port)
+{
+	int i;
+
+	for (i = 0; i < ignore_ports_count; i++) {
+		if (port == ignore_ports[i])
+			return true;
+	}
+	return false;
+}
+
 /**
  *	legacy_init		-	attach legacy interfaces
  *
@@ -1212,17 +1225,22 @@ static __init int legacy_init(void)
 	if (winbond == 1)
 		winbond = 0x130;	/* Default port, alt is 1B0 */
 
-	if (primary == 0 || all)
+	if ((primary == 0 || all) && !port_ignored(0x1F0))
 		legacy_probe_add(0x1F0, 14, UNKNOWN, 0);
-	if (secondary == 0 || all)
+	if ((secondary == 0 || all) && !port_ignored(0x170))
 		legacy_probe_add(0x170, 15, UNKNOWN, 0);
 
 	if (probe_all || !pci_present) {
 		/* ISA/VLB extra ports */
-		legacy_probe_add(0x1E8, 11, UNKNOWN, 0);
-		legacy_probe_add(0x168, 10, UNKNOWN, 0);
-		legacy_probe_add(0x1E0, 8, UNKNOWN, 0);
-		legacy_probe_add(0x160, 12, UNKNOWN, 0);
+
+		if (!port_ignored(0x1E8))
+			legacy_probe_add(0x1E8, 11, UNKNOWN, 0);
+		if (!port_ignored(0x168))
+			legacy_probe_add(0x168, 10, UNKNOWN, 0);
+		if (!port_ignored(0x1E0))
+			legacy_probe_add(0x1E0, 8, UNKNOWN, 0);
+		if (!port_ignored(0x160))
+			legacy_probe_add(0x160, 12, UNKNOWN, 0);
 	}
 
 	if (opti82c46x)
@@ -1272,6 +1290,7 @@ module_param(qdi, int, 0);
 module_param(winbond, int, 0);
 module_param(pio_mask, int, 0);
 module_param(iordy_mask, int, 0);
+module_param_array(ignore_ports, int, &ignore_ports_count, 0444);
 
 module_init(legacy_init);
 module_exit(legacy_exit);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-11-30 18:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1480440386-20400-1-git-send-email-tedheadster@gmail.com>
2016-11-30 17:20 ` [PATCH,v2] pata_legacy: Allow disabling of legacy PATA device probes on non-PCI systems Matthew Whitehead
2016-11-30 17:24   ` Sergei Shtylyov
2016-11-30 18:14 ` [PATCH,v3] " Matthew Whitehead

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.