Date: Sun, 23 Aug 1998 17:45:04 -0400 (EDT) From: Mark turpin <mturpin@shadow.spel.com> To: FreeBSD hackers <hackers@FreeBSD.ORG> Subject: PCI Device driver question Message-ID: <Pine.BSF.3.96.980823174044.13083A-100000@shadow.spel.com>
next in thread | raw e-mail | index | archive | help
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 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.980823174044.13083A-100000>
