Date: Sun, 23 Aug 1998 20:03:38 -0400 (EDT) From: Chuck Robey <chuckr@glue.umd.edu> To: Mark turpin <mturpin@shadow.spel.com> Cc: FreeBSD hackers <hackers@FreeBSD.ORG> Subject: Re: PCI Device driver question Message-ID: <Pine.BSF.4.00.9808232000150.361-100000@picnic.mat.net> In-Reply-To: <Pine.BSF.3.96.980823174044.13083A-100000@shadow.spel.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 23 Aug 1998, Mark turpin wrote:
> Hello,
>
> This is my first attempt at writing a device driver.. I read most
> of the other drivers in the pci directory before starting and thought I
> knew what I was doing... Well, obviously I didn't :) So, I need your
> help.. All I want to do right now is make it show that it actually found
> the device on the startup list.
>
> Please help
> Thanks
>
> Mark Turpin
>
I am looking at the example I've chosen, cy_pci.c, and the pci code
figures out what to probe via linker sets, but I don't see the line in
your code below that corresponds to the line 62 of cy_pci.c, as I show
below:
DATA_SET(pcidevice_set, cy_device);
I think maybe you might be missing this line, so the pci code never
probes your device. If I'm wrong, I'll be watching with interest for
someone to correct me.
>
> I added the following line to files
>
> pci/if_rtk.c rtk device-driver
>
> and to GENERIC in i386/conf
>
> device rtk0
>
> and here is my wonderful code....
>
>
> #include "pci.h"
> #if NPCI > 0
>
> #include <sys/param.h>
> #include <sys/systm.h>
> #include <sys/malloc.h>
> #include <sys/kernel.h>
> #include <pci/pcireg.h>
> #include <pci/pcivar.h>
>
> #include "rtk.h"
>
> static char* rtk_pci_probe __P((pcici_t, pcidi_t));
> static void rtk_pci_attach __P((pcici_t config_id, int unit));
>
> static u_long rtk_pci_count = NRTK;
>
> static struct pci_device rtk_pci_driver = {
> "rtk",
> rtk_pci_probe,
> rtk_pci_attach,
> &rtk_pci_count,
> NULL
> };
>
> static char*
> rtk_pci_probe (config_id, device_id)
> pcici_t config_id;
> pcidi_t device_id;
> {
> if (device_id && 0x813910ec)
> return ("RealTek 8139 10/100Mbps Ethernet");
>
> return NULL;
> }
>
> static void
> rtk_pci_attach (config_id, unit)
> pcici_t config_id;
> int unit;
> {
>
> /* Attach stuff goes here */
> return;
>
> }
> #endif /* NPCI > 0 */
>
>
>
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-hackers" in the body of the message
>
>
----------------------------+-----------------------------------------------
Chuck Robey | Interests include any kind of voice or data
chuckr@glue.umd.edu | communications topic, C programming, and Unix.
213 Lakeside Drive Apt T-1 |
Greenbelt, MD 20770 | I run Journey2 and picnic (FreeBSD-current)
(301) 220-2114 | and jaunt (NetBSD).
----------------------------+-----------------------------------------------
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.00.9808232000150.361-100000>
