linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] IDE handles Secondary Only incorrectly
@ 2002-10-18 16:30 Jason Williams
  0 siblings, 0 replies; only message in thread
From: Jason Williams @ 2002-10-18 16:30 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1001 bytes --]

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



[-- Attachment #2: ide_sec_fix.patch --]
[-- Type: text/plain, Size: 1067 bytes --]

--- ide-dma.orig.c	2002-10-18 12:25:08.000000000 -0500
+++ ide-dma.c	2002-10-18 12:23:55.000000000 -0500
@@ -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))

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-10-18 16:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-18 16:30 [PATCH] IDE handles Secondary Only incorrectly Jason Williams

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).