This source file includes following definitions.
- iha_pci_probe
- iha_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/param.h>
36 #include <sys/systm.h>
37 #include <sys/device.h>
38
39 #include <dev/pci/pcidevs.h>
40 #include <dev/pci/pcivar.h>
41
42 #include <scsi/scsi_all.h>
43 #include <scsi/scsiconf.h>
44
45 #include <dev/ic/iha.h>
46
47 int iha_pci_probe(struct device *, void *, void *);
48 void iha_pci_attach(struct device *, struct device *, void *);
49
50 struct cfattach iha_pci_ca = {
51 sizeof(struct iha_softc), iha_pci_probe, iha_pci_attach
52 };
53
54 int
55 iha_pci_probe(parent, match, aux)
56 struct device *parent;
57 void *match;
58 void *aux;
59 {
60 struct pci_attach_args *pa = aux;
61
62 if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_INITIO)
63 switch (PCI_PRODUCT(pa->pa_id)) {
64 case PCI_PRODUCT_INITIO_INIC940:
65 case PCI_PRODUCT_INITIO_INIC950:
66 return (1);
67 }
68
69 if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_DTCTECH)
70 switch (PCI_PRODUCT(pa->pa_id)) {
71 case PCI_PRODUCT_DTCTECH_DMX3194U:
72 return (1);
73 }
74
75 return (0);
76 }
77
78 void
79 iha_pci_attach(parent, self, aux)
80 struct device *parent;
81 struct device *self;
82 void *aux;
83 {
84 struct pci_attach_args *pa = aux;
85 struct scsibus_attach_args saa;
86 bus_space_handle_t ioh;
87 pci_intr_handle_t ih;
88 struct iha_softc *sc = (void *)self;
89 bus_space_tag_t iot;
90 const char *intrstr;
91 int ioh_valid;
92
93
94
95
96
97 ioh_valid = pci_mapreg_map(pa, PCI_MAPREG_START, PCI_MAPREG_TYPE_IO, 0,
98 &iot, &ioh, NULL, NULL, 0);
99
100 if (ioh_valid != 0) {
101 printf("%s: unable to map registers\n", sc->sc_dev.dv_xname);
102 return;
103 }
104
105 sc->sc_iot = iot;
106 sc->sc_ioh = ioh;
107 sc->sc_dmat = pa->pa_dmat;
108
109 if (pci_intr_map(pa, &ih)) {
110 printf("%s: couldn't map interrupt\n", sc->sc_dev.dv_xname);
111 return;
112 }
113 intrstr = pci_intr_string(pa->pa_pc, ih);
114
115 sc->sc_ih = pci_intr_establish(pa->pa_pc, ih, IPL_BIO, iha_intr, sc,
116 sc->sc_dev.dv_xname);
117
118 if (sc->sc_ih == NULL) {
119 printf(": couldn't establish interrupt");
120 if (intrstr != NULL)
121 printf(" at %s", intrstr);
122 printf("\n");
123 } else {
124 if (intrstr != NULL)
125 printf(": %s\n", intrstr);
126
127 if (iha_init_tulip(sc) == 0) {
128 bzero(&saa, sizeof(saa));
129 saa.saa_sc_link = &sc->sc_link;
130 config_found(&sc->sc_dev, &saa, scsiprint);
131 }
132 }
133 }