Skip to contentSkip to conversation

Fix interface autodetection in legacy IDE driver

PATCH In review [email protected] 2 participants 3 messages Aug 9, 2016 1 message not in the archive libata

lore
Share & tools
lore
#1 lore raw

PATCH 1/1 Fix interface autodetection in legacy IDE driver

In reply to a message not in the archive

This patch fixes the automatic setting of ide_generic.probe_mask, when it is set to zero (like when default options are used) AND the PCI subsystem has detected primary and/or secondary interfaces.

The effect is that those interfaces go undetected under those conditions.

The former implementation misunderstands the information detected by the PCI subsystem, and may only work if one use ide_generic.probe_mask set to 0x3f (or 0x03, minimally), like the suggestion echoed to the console.

Probably this has been stayed under the radar because everybody migrated to libata. Anyway, IMHO it's worth to fix it, as the code isn't entirely dead.

If I'm not wrong, this change applies to kernels from 2009 up to now.

---

drivers/ide/ide-generic.c +0 -0
index 54d7c4685d23aa5e62ce606e7b994a57bb54b08a..419818a39c270d3ad219e8f7b5df56a9aea3d640 100644
@@ -96,10 +96,10 @@ static int __init ide_generic_init(void)

printk(KERN_INFO DRV_NAME ": please use \"probe_mask=0x3f\" " "module parameter for probing all legacy ISA IDE ports\n");

- if (primary == 0)
+ if (primary)
probe_mask |= 0x1;

- if (secondary == 0)
+ if (secondary)
probe_mask |= 0x2;
} else
printk(KERN_INFO DRV_NAME ": enforcing probing of I/O ports "

Signature · 1 line
2.8.2
#2 lore raw

Hello.

Quoted 7 lines · On 08/09/2016 01:47 PM, [email protected] wrote:

This patch fixes the automatic setting of ide_generic.probe_mask, when it is set to zero (like when default options are used) AND the PCI subsystem has detected primary and/or secondary interfaces.

The effect is that those interfaces go undetected under those conditions.

Quoted 6 lines

The former implementation misunderstands the information detected by the PCI subsystem, and may only work if one use ide_generic.probe_mask set to 0x3f (or 0x03, minimally), like the suggestion echoed to the console.

Probably this has been stayed under the radar because everybody

Has stayed, maybe?

Quoted 17 lines

migrated to libata. Anyway, IMHO it's worth to fix it, as the code isn't entirely dead.

If I'm not wrong, this change applies to kernels from 2009 up to now.

---

drivers/ide/ide-generic.c +0 -0
index 54d7c4685d23aa5e62ce606e7b994a57bb54b08a..419818a39c270d3ad219e8f7b5df56a9aea3d640 100644
@@ -96,10 +96,10 @@ static int __init ide_generic_init(void)

printk(KERN_INFO DRV_NAME ": please use \"probe_mask=0x3f\" " "module parameter for probing all legacy ISA IDE ports\n");

drivers/ide/ide-generic.c +1 -1
-               if (primary == 0)
+               if (primary)
Quoted 1 line

probe_mask |= 0x1;

Your patch is line wrapped...

Quoted 6 lines
drivers/ide/ide-generic.c +1 -1
-               if (secondary == 0)
+               if (secondary)

probe_mask |= 0x2;
} else
printk(KERN_INFO DRV_NAME ": enforcing probing of I/O ports "

... and whitespace damaged too. :-(

MBR, Sergei

#3 lore raw

Sergei:

Many thanks for your patience and careful review! I apologize for those mistakes.

Here I'll send a hopefully corrected version:

This patch fixes the automatic setting of ide_generic.probe_mask, when it is set to zero (like when default options are used) AND the PCI subsystem has detected primary and/or secondary interfaces.

The effect is that those IDE interfaces go undetected under those conditions.

The former implementation misunderstands the information detected by the PCI subsystem, and may only work if one use ide_generic.probe_mask set to 0x3f (or 0x03, minimally), like the suggestion echoed to the console.

---
 drivers/ide/ide-generic.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/ide/ide-generic.c +2 -2
index 54d7c4685d23aa5e62ce606e7b994a57bb54b08a..419818a39c270d3ad219e8f7b5df56a9aea3d640 100644
@@ -96,10 +96,10 @@ static int __init ide_generic_init(void)
 		printk(KERN_INFO DRV_NAME ": please use \"probe_mask=0x3f\" "
 		     "module parameter for probing all legacy ISA IDE ports\n");
 
-		if (primary == 0)
+		if (primary)
 			probe_mask |= 0x1;
 
-		if (secondary == 0)
+		if (secondary)
 			probe_mask |= 0x2;
 	} else
 		printk(KERN_INFO DRV_NAME ": enforcing probing of I/O ports "
Signature · 1 line
2.8.2
Quoted 52 lines · Sergei Shtylyov

Hello.

Quoted 7 lines · On 08/09/2016 01:47 PM, [email protected] wrote:

This patch fixes the automatic setting of ide_generic.probe_mask, when it is set to zero (like when default options are used) AND the PCI subsystem has detected primary and/or secondary interfaces.

The effect is that those interfaces go undetected under those conditions.

Quoted 6 lines

The former implementation misunderstands the information detected by the PCI subsystem, and may only work if one use ide_generic.probe_mask set to 0x3f (or 0x03, minimally), like the suggestion echoed to the console.

Probably this has been stayed under the radar because everybody

Has stayed, maybe?

Quoted 17 lines

migrated to libata. Anyway, IMHO it's worth to fix it, as the code isn't entirely dead.

If I'm not wrong, this change applies to kernels from 2009 up to now.

---

drivers/ide/ide-generic.c +0 -0
index 54d7c4685d23aa5e62ce606e7b994a57bb54b08a..419818a39c270d3ad219e8f7b5df56a9aea3d640 100644
@@ -96,10 +96,10 @@ static int __init ide_generic_init(void)

printk(KERN_INFO DRV_NAME ": please use \"probe_mask=0x3f\" " "module parameter for probing all legacy ISA IDE ports\n");

drivers/ide/ide-generic.c +1 -1
-               if (primary == 0)
+               if (primary)
Quoted 1 line

probe_mask |= 0x1;

Your patch is line wrapped...

Quoted 6 lines
drivers/ide/ide-generic.c +1 -1
-               if (secondary == 0)
+               if (secondary)

probe_mask |= 0x2;
} else
printk(KERN_INFO DRV_NAME ": enforcing probing of I/O ports "

   ... and whitespace damaged too. :-(

MBR, Sergei