Subject: Re: CVS commit: src/sys/arch/i386/conf
To: None <bouyer@NetBSD.org>
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
List: source-changes
Date: 03/21/2007 03:24:50
bouyer@NetBSD.org wrote:

> Module Name:	src
> Committed By:	bouyer
> Date:		Sat Mar 10 10:54:53 UTC 2007
> 
> Modified Files:
> 	src/sys/arch/i386/conf: GENERIC
> 
> Log Message:
> Comment out 'fdc* at acpi?' (it's likely that systems not supporting
> fdc0 at isa? don't have a fdc at all). Because of the 'fdc0 at isa?', on
> systems supporting ACPI the floppy controller would attach as fdc1. as fd(4)
> looks for its type in nvram using the floppy controller index, it's looking for
> the wrong controller and the default density isn't set (so /dev/fd0a doens't
> work).

How about this patch? (the problem is device_unit() abuse)
With this patch, both fdc0 at isa0 and fdc1 at acpi0 work properly.
---
Index: dev/isa/fd.c
===================================================================
RCS file: /cvsroot/src/sys/dev/isa/fd.c,v
retrieving revision 1.73
diff -u -r1.73 fd.c
--- dev/isa/fd.c	8 Mar 2007 23:23:45 -0000	1.73
+++ dev/isa/fd.c	20 Mar 2007 18:05:05 -0000
@@ -148,6 +148,7 @@
 
 #include <machine/intr.h>
 
+#include <dev/isa/isareg.h>
 #include <dev/isa/isavar.h>
 #include <dev/isa/isadmavar.h>
 
@@ -350,8 +351,7 @@
 	 * The NVRAM info only tells us about the first two disks on the
 	 * `primary' floppy controller.
 	 */
-	/* XXX device_unit() abuse */
-	if (device_unit(&fdc->sc_dev) == 0)
+	if (iot == X86_BUS_SPACE_IO && ioh == (bus_space_handle_t)IO_FD1 + 2)
 		type = mc146818_read(NULL, NVRAM_DISKETTE); /* XXX softc */
 	else
 		type = -1;

---
Izumi Tsutsui