File: | dev/pci/if_ep_pci.c |
Warning: | line 117, column 2 Value stored to 'i' is never read |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | /* $OpenBSD: if_ep_pci.c,v 1.35 2021/03/05 12:40:13 jsg Exp $ */ |
2 | /* $NetBSD: if_ep_pci.c,v 1.13 1996/10/21 22:56:38 thorpej Exp $ */ |
3 | |
4 | /* |
5 | * Copyright (c) 1994 Herb Peyerl <hpeyerl@beer.org> |
6 | * All rights reserved. |
7 | * |
8 | * Redistribution and use in source and binary forms, with or without |
9 | * modification, are permitted provided that the following conditions |
10 | * are met: |
11 | * 1. Redistributions of source code must retain the above copyright |
12 | * notice, this list of conditions and the following disclaimer. |
13 | * 2. Redistributions in binary form must reproduce the above copyright |
14 | * notice, this list of conditions and the following disclaimer in the |
15 | * documentation and/or other materials provided with the distribution. |
16 | * 3. All advertising materials mentioning features or use of this software |
17 | * must display the following acknowledgement: |
18 | * This product includes software developed by Herb Peyerl. |
19 | * 4. The name of Herb Peyerl may not be used to endorse or promote products |
20 | * derived from this software without specific prior written permission. |
21 | * |
22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
25 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
26 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
27 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
31 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
32 | */ |
33 | |
34 | #include "bpfilter.h" |
35 | |
36 | #include <sys/param.h> |
37 | #include <sys/systm.h> |
38 | #include <sys/mbuf.h> |
39 | #include <sys/socket.h> |
40 | #include <sys/ioctl.h> |
41 | #include <sys/errno.h> |
42 | #include <sys/timeout.h> |
43 | #include <sys/syslog.h> |
44 | #include <sys/selinfo.h> |
45 | #include <sys/device.h> |
46 | |
47 | #include <net/if.h> |
48 | #include <net/if_media.h> |
49 | |
50 | #include <netinet/in.h> |
51 | #include <netinet/if_ether.h> |
52 | |
53 | #if NBPFILTER1 > 0 |
54 | #include <net/bpf.h> |
55 | #endif |
56 | |
57 | #include <machine/cpu.h> |
58 | #include <machine/bus.h> |
59 | #include <machine/intr.h> |
60 | |
61 | #include <dev/mii/miivar.h> |
62 | |
63 | #include <dev/ic/elink3var.h> |
64 | #include <dev/ic/elink3reg.h> |
65 | |
66 | #include <dev/pci/pcivar.h> |
67 | #include <dev/pci/pcireg.h> |
68 | #include <dev/pci/pcidevs.h> |
69 | |
70 | /* |
71 | * PCI constants. |
72 | * XXX These should be in a common file! |
73 | */ |
74 | #define PCI_CONN0x48 0x48 /* Connector type */ |
75 | #define PCI_CBIO0x10 0x10 /* Configuration Base IO Address */ |
76 | |
77 | int ep_pci_match(struct device *, void *, void *); |
78 | void ep_pci_attach(struct device *, struct device *, void *); |
79 | |
80 | struct cfattach ep_pci_ca = { |
81 | sizeof(struct ep_softc), ep_pci_match, ep_pci_attach |
82 | }; |
83 | |
84 | const struct pci_matchid ep_pci_devices[] = { |
85 | { PCI_VENDOR_3COM0x10b7, PCI_PRODUCT_3COM_3C5900x5900 }, |
86 | { PCI_VENDOR_3COM0x10b7, PCI_PRODUCT_3COM_3C595MII0x5952 }, |
87 | { PCI_VENDOR_3COM0x10b7, PCI_PRODUCT_3COM_3C595T40x5951 }, |
88 | { PCI_VENDOR_3COM0x10b7, PCI_PRODUCT_3COM_3C595TX0x5950 }, |
89 | }; |
90 | |
91 | int |
92 | ep_pci_match(struct device *parent, void *match, void *aux) |
93 | { |
94 | return (pci_matchbyid((struct pci_attach_args *)aux, ep_pci_devices, |
95 | nitems(ep_pci_devices)(sizeof((ep_pci_devices)) / sizeof((ep_pci_devices)[0])))); |
96 | } |
97 | |
98 | void |
99 | ep_pci_attach(struct device *parent, struct device *self, void *aux) |
100 | { |
101 | struct ep_softc *sc = (void *)self; |
102 | struct pci_attach_args *pa = aux; |
103 | pci_chipset_tag_t pc = pa->pa_pc; |
104 | bus_size_t iosize; |
105 | pci_intr_handle_t ih; |
106 | pcireg_t i; |
107 | const char *intrstr = NULL((void *)0); |
108 | |
109 | if (pci_mapreg_map(pa, PCI_CBIO0x10, PCI_MAPREG_TYPE_IO0x00000001, 0, |
110 | &sc->sc_iot, &sc->sc_ioh, NULL((void *)0), &iosize, 0)) { |
111 | printf(": can't map i/o space\n"); |
112 | return; |
113 | } |
114 | |
115 | sc->bustype = EP_BUS_PCI0x3; |
116 | |
117 | i = pci_conf_read(pc, pa->pa_tag, PCI_CONN0x48); |
Value stored to 'i' is never read | |
118 | |
119 | GO_WINDOW(0)((sc->sc_iot)->write_2((sc->sc_ioh), (0x0e), ((u_short ) (0x1<<11)|0))); |
120 | |
121 | printf(":"); |
122 | |
123 | epconfig(sc, EP_CHIPSET_VORTEX0x02, NULL((void *)0)); |
124 | |
125 | /* Map and establish the interrupt. */ |
126 | if (pci_intr_map(pa, &ih)) { |
127 | printf(", couldn't map interrupt\n"); |
128 | bus_space_unmap(sc->sc_iot, sc->sc_ioh, iosize); |
129 | return; |
130 | } |
131 | intrstr = pci_intr_string(pc, ih); |
132 | sc->sc_ih = pci_intr_establish(pc, ih, IPL_NET0x7, epintr, |
133 | sc, sc->sc_dev.dv_xname); |
134 | if (sc->sc_ih == NULL((void *)0)) { |
135 | printf(": couldn't establish interrupt"); |
136 | if (intrstr != NULL((void *)0)) |
137 | printf(" at %s", intrstr); |
138 | printf("\n"); |
139 | bus_space_unmap(sc->sc_iot, sc->sc_ioh, iosize); |
140 | return; |
141 | } |
142 | printf(" %s\n", intrstr); |
143 | } |