Subject: Re: ET4000 driver - more help needed
To: Julian Coleman <J.D.Coleman@newcastle.ac.uk>
From: Leo Weppelman <leo@wau.mis.ah.nl>
List: port-atari
Date: 01/08/1998 21:45:51
Julians question basically boils down to:
    How do I obtain the (opaque!) tags in the console probe when
    the bus is not yet probed.

As I see it, the console probing is conflicting with the 'normal' autoconf
probe. The console probe needs to actively search for a device (and be
silent about it's findings!), while the 'normal' probe walks over all
devices that it can possibly find on a bus. I have been thinking about
this a while back - actually when Andre showed up with a mach64 card.
I haven't had the time to completely flesh out this problem, so feel
free to shoot holes in it ;-)

Some design issues:
  - I don't want to scatter 'opaque' bus knowledge in different parts
    of the system. Basically, this knowledge belongs in
    .../<bus>/<bus>_machdep.c.
  - maximum reuse of code (ie. the et_probe_card() function performing
    a kind of pci-bus scan is bogus).
  - quiet and simple ;-)

I was thinking to define an 'early_<bus>_scan()' function. As an
argument, it should get a probe function. The 'early_<bus>_scan'
function calls the probe function with a '<bus>_attach_args' argument.

To make this less abstract, a pci example:

In grfabs_et.c, the functions become:
et_probe_card()
{
#if NPCI > 0
    if (early_pci_scan(et_pci_probe)) {
        /* Whee, found at least one et4000 pci card! */
    }
#endif
        ...
}

int
et_pci_probe(struct pci_attach_args *pa)
{
    switch(pa->pa_id) {
        case PCI....ET4000....:
                  /* setup some static stuff?? */
                  return(1);
        ....
        ....
}

Leo.