Subject: Re: CVS commit: src/sys/arch/i386/conf
To: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
From: Jason Thorpe <thorpej@shagadelic.org>
List: source-changes
Date: 03/20/2007 14:07:20
On Mar 20, 2007, at 11:24 AM, Izumi Tsutsui wrote:

> How about this patch? (the problem is device_unit() abuse)
> With this patch, both fdc0 at isa0 and fdc1 at acpi0 work properly.

How about setting a property for this in device_register() instead?   
Let's the the NVRAM-reading stuff out of fd.c completely!

>
> ---
> 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

-- thorpej