Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 30 Sep 1995 21:30:38 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        hackers@FreeBSD.ORG, julian@ref.tfs.com
Subject:   Re: correctness of isa.c
Message-ID:  <199509301130.VAA32657@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>caddr_t id_maddr;       /* physical i/o memory address on bus (if any)*/

>ok so this is the Physical address of ram on the device..

>so why does isa.c pass it into the device as:

>        if (!reconfig && isdp->id_maddr) {
>                isdp->id_maddr -= 0xa0000; /* XXX should be a define */
>                isdp->id_maddr += atdevbase;

>which is the kvm mapped address of it..
>BUT ONLY IF THE DEVICE IS in the 640K-1MB hole!

>I have a device at 2GB
>needless to say, I need to 'undo' this mess when
>I'm probed, to find my original address..

2GB isn't in the isa address space :-).  You have a better case for 15MB.
Note that atdevbase already has 0xa0000 in it and subtracting 0xa0000
is just to compensate for that braindamage.  The end result is that
addresses in the 640K-1MB hole are correctly relocated by adding KERNBASE.
Addresses outside the hole aren't handled automatically by the vm system.
Some drivers (especially video drivers) aren't passed a valid id_maddr
and do their own relocations on fixed addresses.

>If I were to 'fix' this for all our drivers,
>does anyone here see a really important reason for this field
>to hold physical and virtual addresses at different times?

It should always hold the physical address.

>I have a pass over all drivers coming up to add devfs stuff..

Please wait until after I've finished prototyping everything, and run
gcc -Wall and indent on you changes (all the old devfs attachments have
an unused variable and inconsistent formatting).

>(also while we're about it, why is id_irq a bitfield?
>it's almost believable, but is there a really good reason?)

There is no good reason, at least now.  The bitmap is more general
except it doesn't allow out of bounds values, but nothing uses the
flexibility, and lots of things assume that only one bit is set
(things that do ffs(id_irq) won't work right if multiple bits are
set).

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199509301130.VAA32657>