This source file includes following definitions.
- dpt_pci_match
- dpt_pci_attach
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35 #include <sys/cdefs.h>
36 #ifdef __NetBSD__
37 __KERNEL_RCSID(0, "$NetBSD: dpt_pci.c,v 1.2 1999/09/29 17:33:02 ad Exp $");
38 #endif
39
40 #include <sys/param.h>
41 #include <sys/systm.h>
42 #include <sys/kernel.h>
43 #include <sys/device.h>
44 #include <sys/queue.h>
45 #include <sys/proc.h>
46
47 #include <machine/endian.h>
48 #include <machine/bus.h>
49
50 #ifdef __NetBSD__
51 #include <dev/scsipi/scsi_all.h>
52 #include <dev/scsipi/scsipi_all.h>
53 #include <dev/scsipi/scsiconf.h>
54 #endif
55 #ifdef __OpenBSD__
56 #include <scsi/scsi_all.h>
57 #include <scsi/scsiconf.h>
58 #endif
59
60 #include <dev/pci/pcidevs.h>
61 #include <dev/pci/pcivar.h>
62
63 #include <dev/ic/dptreg.h>
64 #include <dev/ic/dptvar.h>
65
66 #define PCI_CBMA 0x14
67 #define PCI_CBIO 0x10
68
69 #ifdef __NetBSD__
70 int dpt_pci_match(struct device *, struct cfdata *, void *);
71 #endif
72 #ifdef __OpenBSD__
73 int dpt_pci_match(struct device *, void *, void *);
74 #endif
75 void dpt_pci_attach(struct device *, struct device *, void *);
76
77 struct cfattach dpt_pci_ca = {
78 sizeof(struct dpt_softc), dpt_pci_match, dpt_pci_attach
79 };
80
81 int
82 dpt_pci_match(parent, match, aux)
83 struct device *parent;
84 #ifdef __NetBSD__
85 struct cfdata *match;
86 #endif
87 #ifdef __OpenBSD__
88 void *match;
89 #endif
90 void *aux;
91 {
92 struct pci_attach_args *pa = (struct pci_attach_args *) aux;
93
94 if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_DPT &&
95 PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_DPT_SC_RAID)
96 return (1);
97
98 return (0);
99 }
100
101 void
102 dpt_pci_attach(parent, self, aux)
103 struct device *parent;
104 struct device *self;
105 void *aux;
106 {
107 struct pci_attach_args *pa;
108 struct dpt_softc *sc;
109 pci_chipset_tag_t pc;
110 pci_intr_handle_t ih;
111 const char *intrstr;
112
113 sc = (struct dpt_softc *)self;
114 pa = (struct pci_attach_args *)aux;
115 pc = pa->pa_pc;
116 printf(": ");
117
118 if (pci_mapreg_map(pa, PCI_CBIO, PCI_MAPREG_TYPE_IO, 0, &sc->sc_iot,
119 &sc->sc_ioh, NULL, NULL, 0)) {
120 printf("can't map i/o space\n");
121 return;
122 }
123
124 sc->sc_dmat = pa->pa_dmat;
125
126
127 if (pci_intr_map(pa, &ih)) {
128 printf("can't map interrupt\n");
129 return;
130 }
131 intrstr = pci_intr_string(pc, ih);
132 #ifdef __NetBSD__
133 sc->sc_ih = pci_intr_establish(pc, ih, IPL_BIO, dpt_intr, sc);
134 #endif
135 #ifdef __OpenBSD__
136 sc->sc_ih = pci_intr_establish(pc, ih, IPL_BIO, dpt_intr, sc,
137 sc->sc_dv.dv_xname);
138 #endif
139 if (sc->sc_ih == NULL) {
140 printf("can't establish interrupt");
141 if (intrstr != NULL)
142 printf(" at %s", intrstr);
143 printf("\n");
144 return;
145 }
146
147
148 if (dpt_readcfg(sc)) {
149 printf("%s: readcfg failed - see dpt(4)\n",
150 sc->sc_dv.dv_xname);
151 return;
152 }
153
154
155 dpt_init(sc, intrstr);
156 }