Subject: Re: PCI setup problem
To: None <augustss@cs.chalmers.se, drochner@zelux6.zel.kfa-juelich.de>
From: Chris Torek <torek@BSDI.COM>
List: tech-kern
Date: 08/07/1998 18:31:14
>Aha - that is what it was good for.
The thing that led me originally to "cd_aux" was the old Unibus
configuration code, in which each Unibus driver had, in addition
to the configuration-line address, a set of "standard" addresses.
I figured the uba driver code would look something very vaguely
like (most types and such left out):
ubaattach(parent, self, aux)
...
config_search(ubaprobe, self, &probedata);
ubaprobe(parent, cf, aux0) {
struct ubaaux *aux = aux0;
struct cfdriver *cd;
struct uba_cfdriver *ud;
u_short *sp;
int found = 0;
cd = cf->cf_driver;
ud = cd->cd_aux;
... (the usual setup code) ...
/* first ask about the configured address --
note, we (a) do not use the cd_match function,
and/or (b) stick the address in aux, and/or (c)
fiddle with cf->cf_loc[]; (a) + (b) shown here
((c) is generally Evil, (b) alone is probably
best, but hey, this is just an example! :-) ). */
aux->addr = cf->cf_loc[0];
if (ud->ud_probe(parent, cf, aux) &&
(!is_dw780(uba) || !dw780_err(uba)))
found = 1;
/* now ask about "std" addresses as defined by driver */
for (sp = ud->ud_stdaddr; !found && *sp; sp++) {
aux->addr = *sp;
if (ud->ud_probe(parent, cf, aux) &&
(!is_dw780(uba) || !dw780_err(uba)))
found = 1;
}
if (found)
config_attach(parent, cf, aux, ubaprint);
return 0; /* always continue probing */
}
That this means anything that configures "at uba" has to provide
a "uba_cfdriver" as its cd_aux. So, to make a driver that could
be "at uba" and also (for a bad example) "at sbus", the cd_aux
field has to be attachment-specific. (BSD/OS does not yet have
the attachment-specific match/attach stuff from NetBSD.)
Chris