Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Dec 1996 12:31:32 -0600
From:      "Eric L. Hernes" <erich@lodgenet.com>
To:        "Jin Guojun[ITG]" <jin@george.lbl.gov>
Cc:        erich@lodgenet.com, hackers@freebsd.org
Subject:   Re: Q for loadable network driver 
Message-ID:  <199612171831.MAA17829@jake.lodgenet.com>
In-Reply-To: Your message of "Mon, 16 Dec 1996 13:19:33 PST." <199612162119.NAA29129@george.lbl.gov> 

next in thread | previous in thread | raw e-mail | index | archive | help
"Jin Guojun[ITG]" writes:
>Another question is that is necessary to link the newly loaded driver to
>the kernel control block --
>-----------------------------------------------------------------
>Without an interface to get the PCI control block address -- &pcicb -- it is
>hardly to link the new information into the kernel PCI chain.
>Also, is the segment above (pci/pci.c line 704 - 819) necessary for loading
>a loadable device driver?
>

I'm kind of going out on a limb here, having never done a pci device (yet)
but...  It looks like you want to use (amongst others) the kernel support
functions pci_conf_read() and pci_conf_write(), which take pci tags.
You'll need to use pcibus->pb_tags(bus, device, func) to get a tag.
You might be able to get bus and device by looking at the /dev/pci
entry points. I *think* the pci subsystem will report your device
exists but `no driver assigned'.  pciconf should report something
like:

(ttyp1@jake)$ pciconf  -l
pci0:0:0:       class=0x060000 card=0x00000000 chip=0x04a38086 rev=0x11 
hdr=0xff
pci0:2:0:       class=0x000000 card=0x00000000 chip=0x04828086 rev=0x04 
hdr=0xff
pci0:3:0:       class=0x01010a card=0x00000000 chip=0x06401095 rev=0x02 
hdr=0xff
pci0:6:0:       class=0x010000 card=0x00000000 chip=0x1040104b rev=0x00 
hdr=0xff
pci0:7:0:       class=0x030000 card=0x00000000 chip=0x88f05333 rev=0x00 
hdr=0xff
(ttyp1@jake)$ 

One of those devices should be yours.  It may be clumsy/awkward to get
this information at first, but  you should be able to use hardcoded numbers
from the pciconf output as a `proof of concept' before you get too far.
It's probably time to get one of the PCI wizards in here...

>Thanks for any information,
>
>-Jin


eric.


-- 
erich@lodgenet.com
http://rrnet.com/~erich erich@rrnet.com






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199612171831.MAA17829>