Subject: How to get the firmware node into the device properties early?
To: None <tech-kern@NetBSD.org>
From: Martin Husemann <martin@duskware.de>
List: tech-kern
Date: 09/12/2006 23:51:25
I am looking for an easy way to retrieve the OpenFirmware node (phandle)
of a struct device * I get passed in device_register(). Is there any magic
way to store them in the device properties early?
I'm trying to avoid code like this:
void
device_register(struct device *dev, void *aux)
{
struct device * parent = device_parent(dev);
int node
if (parent == NULL) {
/* handle mainbus devices ... */
} else if (device_is_a(parent, "pci")) {
struct pci_attach_args *pa = aux;
/* MD way to extract OF node from pa->pa_tag */
node = ..
} else if ....
/* do something with node */
}
Is there some better way than adding the property in various ${bus}_machdep
functions? How could I do it for things like scsibus or atapibus?
Martin