Index: [thread] [date] [subject] [author]
  From: Brian Julin <bri@forcade.calyx.net>
  To  : ggi-develop@eskimo.com
  Date: Tue, 14 Jul 1998 12:34:26 -0400 (EDT)

Re: Card identification.

On Sun, 12 Jul 1998, Frank W. Miller wrote:
> The only reason these routines need to be public is to provide a common set
> of services to driver writers for a given OS.  There isnt really any
> `global state' that needs to be maintained.   If you agree with this,
> you can just do something in the OS specific header files and put
> preprocessor directives around the calls.

This is the DPI (== driver programmers interface) interface I proposed 
to Andy in private e-mail -- it should be generic enough to handle any 
kernel/OS interface, though for OSes without interfaces we may need to 
steal some BSD code or something and re-implement it in the OS header.  
Best yet when I get back to my Mach32 driver, I can write the shim to 
interface with /proc/bus/pci for suidkgi.  I already have a working
suidkgi interface to /proc/ioports.  The Linux wrappers need only
pack/unpack their little structure.

(this uses the ggi_[us]* format but that's simple enough to change)

ggi_s ggi_find_PCI_class(ggi_u8 class, ggi_u16 index,
        ggi_u8 *bus, ggi_u8 *slot, ggi_u8 *fn)

ggi_s ggi_find_PCI_device(ggi_u16 vendid, ggi_u16 devid, ggi_u16 index,
        ggi_u8 *bus, ggi_u8 *slot, ggi_u8 *fn)

ggi_s ggi_PCI_out8(ggi_u8 bus, ggi_u8 slot, ggi_u8 fn,
        ggi_u8 loc, ggi_u8 val)

ggi_s ggi_PCI_out16(ggi_u8 bus, ggi_u8 slot, ggi_u8 fn,
        ggi_u8 loc, ggi_u16 val)

ggi_s ggi_PCI_out32(ggi_u8 bus, ggi_u8 slot, ggi_u8 fn,
        ggi_u8 loc, ggi_u32 val)

ggi_s ggi_PCI_in8(ggi_u8 bus, ggi_u8 slot, ggi_u8 fn,
        ggi_u8 loc, ggi_u8 *val)

ggi_s ggi_PCI_in16(ggi_u8 bus, ggi_u8 slot, ggi_u8 fn,
        ggi_u8 loc, ggi_u16 *val)

ggi_s ggi_PCI_in32(ggi_u8 bus, ggi_u8 slot, ggi_u8 fn,
        ggi_u8 loc, ggi_u32 *val)

Return value is std ggi-style error code.

I skipped a PCI_ins and PCI_outs as well, because we'd hardly
be using it, most drivers just need to poke/peek single locations. 

We should also probably standardize defines for our most needed 
registers, like the IO/MEM enable bits, to avoid replication in each
driver.

Speaking of suidkgi, a lot of the userspace services it currently
provides might be better moved to the headers under #ifndef __KERNEL__
for easy build of userspace debug tools.  Currently #ifndef __KERNEL__
you don't even have such basic things as io_outN.  However it is
currently under libggi; where/how to put/split it??

--
Brian S. Julin

Index: [thread] [date] [subject] [author]