From owner-freebsd-hackers Tue Dec 17 10:31:52 1996 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.4/8.8.4) id KAA10976 for hackers-outgoing; Tue, 17 Dec 1996 10:31:52 -0800 (PST) Received: from bacall.lodgenet.com (bacall.lodgenet.com [205.138.147.242]) by freefall.freebsd.org (8.8.4/8.8.4) with SMTP id KAA10967 for ; Tue, 17 Dec 1996 10:31:48 -0800 (PST) Received: (from mail@localhost) by bacall.lodgenet.com (8.6.12/8.6.12) id MAA18710; Tue, 17 Dec 1996 12:30:47 -0600 Received: from garbo.lodgenet.com(204.124.123.250) by bacall via smap (V1.3) id sma018705; Tue Dec 17 12:30:38 1996 Received: from jake.lodgenet.com (jake.lodgenet.com [10.0.11.30]) by garbo.lodgenet.com (8.6.12/8.6.9) with ESMTP id MAA09327; Tue, 17 Dec 1996 12:31:00 -0600 Received: from jake.lodgenet.com (localhost [127.0.0.1]) by jake.lodgenet.com (8.8.3/8.6.12) with ESMTP id MAA17829; Tue, 17 Dec 1996 12:31:34 -0600 (CST) Message-Id: <199612171831.MAA17829@jake.lodgenet.com> X-Mailer: exmh version 1.6.9 8/22/96 To: "Jin Guojun[ITG]" cc: erich@lodgenet.com, hackers@freebsd.org Subject: Re: Q for loadable network driver In-reply-to: Your message of "Mon, 16 Dec 1996 13:19:33 PST." <199612162119.NAA29129@george.lbl.gov> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Tue, 17 Dec 1996 12:31:32 -0600 From: "Eric L. Hernes" Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk "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