Subject: Re: Finding Kernel VA that maps given physical address?
To: Wolfgang Solfrank <>
From: Paul Goyette <>
List: tech-kern
Date: 07/21/1997 18:51:03
On Mon, 21 Jul 1997, Wolfgang Solfrank wrote:

> > I've figured out how to find the physical address given a kernel VA using
> > pmap_extract().  But I haven't found the equivalent mechanism to do the
> > reverse translation.  I realize that, in a general case, there might be
> > _several_ (or even _many_) kernel VAs that map to the same physical
> > address, but I'm pretty sure that that won;t happen in the specific case I
> > need to handle.  So it would be just peachy if there were a way to find
> > _any_ kernel virtual address that maps to a given physical address.
> What makes you think that a given physical address _does_ have a virtual
> address in the kernel address space?

Actually, I _don't_ know that such a mapping exists!  In fact, the absence
of a mapping will have the equivalent effect of a failed probe (ie, bus
error), and declare the slot associated with the physical address to be

> Why don't you map the physical address into the kernel address space yourself
> where you need it, remembering the virtual address in some driver data
> structure in case you don't want to drop the mapping again immediately?

Well, my intent here is to _not_ reinvent the wheel.  I'm implementing the
slot manager interface so that other NetBSD/Mac68k device drivers can use
the existing, on-board ROM-resident driver code and interface to it using
a documented API - Apple's own driver calls to the Read, Write, Control,
Prime, etc. entry points.

By taking this approach, I expect that the normal autoconfiguration
process will occur, and the code in nubus.c will call all appropriate
drivers to perform their own attach() calls.  Thus, I _assumed_ that the
drivers themselves would be responsible for calling pmap_map(), as is
currently the case with the video-board driver grf_mv.c (and presumably
other nubus drivers, like the ones for Ethernet cards).  All I'm looking
for is some way to find out what the driver code did (or didn't) do - is
the physical address space for a given slot mapped, and therefore is there
a driver for the card in that slot?

| Paul Goyette       | PGP Public Key fingerprint:  | E-mail addresses:     |
| Network Consultant |     0E 40 D2 FC 2A 13 74 A0  |    |
| and kernel hacker  |     E4 69 D5 BE 65 E4 56 C6  | |