]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/dev/lnc/if_lnc_pci.c
This commit was generated by cvs2svn to compensate for changes in r43829,
[FreeBSD/FreeBSD.git] / sys / dev / lnc / if_lnc_pci.c
1 /*
2  *
3  * Copyright (c) 1996 Stefan Esser <se@freebsd.org>
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice immediately at the beginning of the file, without modification,
11  *    this list of conditions, and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  * 3. Absolutely no warranty of function or purpose is made by the author
16  *    Stefan Esser.
17  * 4. Modifications may be freely made to this file if the above conditions
18  *    are met.
19  *
20  *      $Id: if_lnc_p.c,v 1.6 1998/07/20 17:33:01 msmith Exp $
21  */
22
23 #include "pci.h"
24 #if NPCI > 0
25
26 #include <sys/param.h>
27 #include <sys/systm.h>
28 #include <sys/malloc.h>
29 #include <sys/kernel.h>
30 #include <pci/pcireg.h>
31 #include <pci/pcivar.h>
32
33 #include "lnc.h"
34
35 #define PCI_DEVICE_ID_PCNet_PCI 0x20001022
36
37 extern void *lnc_attach_ne2100_pci __P((int unit, unsigned iobase));
38
39 static const char* lnc_pci_probe __P((pcici_t tag, pcidi_t type));
40 static void lnc_pci_attach __P((pcici_t config_id, int unit));
41
42 static u_long lnc_pci_count = NLNC;
43
44 static struct pci_device lnc_pci_driver = {
45         "lnc",
46         lnc_pci_probe,
47         lnc_pci_attach,
48         &lnc_pci_count,
49         NULL
50 };
51
52 DATA_SET (pcidevice_set, lnc_pci_driver);
53
54 static const char*
55 lnc_pci_probe (pcici_t tag, pcidi_t type)
56 {
57         switch(type) {
58         case PCI_DEVICE_ID_PCNet_PCI:
59                 return ("PCNet/PCI Ethernet adapter");
60                 break;
61         default:
62                 break;
63         }
64         return (0);
65 }
66
67 void lncintr_sc (void*);
68
69 static void
70 lnc_pci_attach(config_id, unit)
71         pcici_t config_id;
72         int     unit;
73 {
74         unsigned iobase;
75         void *lnc; /* device specific data for interrupt handler ... */
76
77         /* pci_map_port correctly initializes bridge chips -- tvf */
78
79         if ( !pci_map_port(config_id,PCI_MAP_REG_START,(u_short *)&iobase) )
80             printf("lnc%d: pci_port_map_attach failed?!\n",unit);
81
82         lnc = lnc_attach_ne2100_pci(unit, iobase);
83         if (!lnc)
84                 return;
85
86         if(!(pci_map_int(config_id, lncintr_sc, (void *)lnc, &net_imask))) {
87                 free (lnc, M_DEVBUF);
88                 return;
89         }
90
91         return;
92 }
93
94 #endif /* NPCI > 0 */
95