Skip to contentSkip to conversation

IDE handles Secondary Only incorrectly

PATCH New Jason Williams 1 participant 1 message Oct 18, 2002

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 IDE handles Secondary Only incorrectly

After some investigation, I found that the IDE System in the 2.5.43 kernel didn't handle IDE set up correctly on an interface with just the secondary channel enabled in BIOS. I thought it was a problem with the VIA controller, but it was actually a piece of code not handling a null variable properly. This variable is not being populated because one of the interfaces in the system is not enabled. The culprit is in the ide-dma.c file. Attached is a patch to act as a quick fix to this problem. It circumvents the kernel oops my checking the variable in question and ignoring it if there is only one interface. This is safe to do for development purposes, but a real fix should probably come out of the IDE folks. The behavior that I think might be what is intended is that the hwif->mate should be populated with the same values as the hwif variable itself is there is only the secondary interface enabled. Just a thought, I am not sure if it is on the right path though.

Jason Williams

ide-dma.c renamed from ide-dma.orig.c +12 -2
@@ -905,7 +905,12 @@
 		request_region(base+16, hwif->cds->extra, hwif->cds->name);
 		hwif->dma_extra = hwif->cds->extra;
 	}
-	hwif->dma_master = (hwif->channel) ? hwif->mate->dma_base : base;
+	if(hwif->channel && hwif->mate == NULL) {
+		hwif->dma_master = base;
+	}
+	else {
+		hwif->dma_master = (hwif->channel) ? hwif->mate->dma_base : base;
+	}
 	if (hwif->dma_base2) {
 		if (!check_mem_region(hwif->dma_base2, ports))
 			request_mem_region(hwif->dma_base2, ports, hwif->name);
@@ -926,7 +931,12 @@
 		request_region(base+16, hwif->cds->extra, hwif->cds->name);
 		hwif->dma_extra = hwif->cds->extra;
 	}
-	hwif->dma_master = (hwif->channel) ? hwif->mate->dma_base : base;	
+	if(hwif->mate == NULL && hwif->channel) {
+		hwif->dma_master = base;
+	}
+	else {
+		hwif->dma_master = (hwif->channel) ? hwif->mate->dma_base : base;	
+	}
 	if (hwif->dma_base2) {
 		
 		if (!request_region(hwif->dma_base2, ports, hwif->name))