Deleted Added
full compact
if_ed_pci.c (22975) if_ed_pci.c (24995)
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 *
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$
20 * $Id: if_ed_p.c,v 1.8 1997/02/22 09:44:04 peter 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 "ed.h"
34
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 "ed.h"
34
35#define PCI_DEVICE_ID_RealTek_8029 0x802910ec
36#define PCI_DEVICE_ID_ProLAN_NE2000 0x09401050
37#define PCI_DEVICE_ID_Compex_NE2000 0x140111f6
35static struct _pcsid
36{
37 pcidi_t type;
38 char *desc;
39} pci_ids[] =
40{
41 { 0x802910ec, "NE2000 PCI Ethernet (RealTek 8029)" },
42 { 0x09401050, "NE2000 PCI Ethernet (ProLAN)" },
43 { 0x140111f6, "NE2000 PCI Ethernet (Compex)" },
44 { 0x30008e2e, "NE2000 PCI Ethernet (KTI)" },
45 { 0x00000000, NULL }
46};
38
39extern void *ed_attach_NE2000_pci __P((int, int));
40
41static char* ed_pci_probe __P((pcici_t tag, pcidi_t type));
42static void ed_pci_attach __P((pcici_t config_id, int unit));
43
44static u_long ed_pci_count = NED;
45
46static struct pci_device ed_pci_driver = {
47 "ed",
48 ed_pci_probe,
49 ed_pci_attach,
50 &ed_pci_count,
51 NULL
52};
53
54DATA_SET (pcidevice_set, ed_pci_driver);
55
56static char*
57ed_pci_probe (pcici_t tag, pcidi_t type)
58{
47
48extern void *ed_attach_NE2000_pci __P((int, int));
49
50static char* ed_pci_probe __P((pcici_t tag, pcidi_t type));
51static void ed_pci_attach __P((pcici_t config_id, int unit));
52
53static u_long ed_pci_count = NED;
54
55static struct pci_device ed_pci_driver = {
56 "ed",
57 ed_pci_probe,
58 ed_pci_attach,
59 &ed_pci_count,
60 NULL
61};
62
63DATA_SET (pcidevice_set, ed_pci_driver);
64
65static char*
66ed_pci_probe (pcici_t tag, pcidi_t type)
67{
59 switch(type) {
60 case PCI_DEVICE_ID_RealTek_8029:
61 return ("NE2000 PCI Ethernet (RealTek 8029)");
62 case PCI_DEVICE_ID_ProLAN_NE2000:
63 return ("NE2000 PCI Ethernet (ProLAN)");
64 case PCI_DEVICE_ID_Compex_NE2000:
65 return ("NE2000 PCI Ethernet (Compex)");
66 }
67 return (0);
68 struct _pcsid *ep =pci_ids;
69
70 while (ep->type && ep->type != type)
71 ++ep;
72 return (ep->desc);
68}
69
70void edintr_sc (void*);
71
72static void
73ed_pci_attach(config_id, unit)
74 pcici_t config_id;
75 int unit;
76{
77 int io_port;
78 void *ed; /* device specific data ... */
79
80 io_port = pci_conf_read(config_id, PCI_MAP_REG_START) & ~PCI_MAP_IO;
81
82 ed = ed_attach_NE2000_pci(unit, io_port);
83 if (!ed)
84 return;
85
86 if(!(pci_map_int(config_id, edintr_sc, (void *)ed, &net_imask))) {
87 free (ed, M_DEVBUF);
88 return;
89 }
90
91 return;
92}
93
94#endif /* NPCI > 0 */
95
73}
74
75void edintr_sc (void*);
76
77static void
78ed_pci_attach(config_id, unit)
79 pcici_t config_id;
80 int unit;
81{
82 int io_port;
83 void *ed; /* device specific data ... */
84
85 io_port = pci_conf_read(config_id, PCI_MAP_REG_START) & ~PCI_MAP_IO;
86
87 ed = ed_attach_NE2000_pci(unit, io_port);
88 if (!ed)
89 return;
90
91 if(!(pci_map_int(config_id, edintr_sc, (void *)ed, &net_imask))) {
92 free (ed, M_DEVBUF);
93 return;
94 }
95
96 return;
97}
98
99#endif /* NPCI > 0 */
100