This source file includes following definitions.
- ppbmatch
- ppbattach
- ppbprint
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 #include <sys/param.h>
35 #include <sys/systm.h>
36 #include <sys/kernel.h>
37 #include <sys/device.h>
38
39 #include <dev/pci/pcireg.h>
40 #include <dev/pci/pcivar.h>
41 #include <dev/pci/pcidevs.h>
42 #include <dev/pci/ppbreg.h>
43
44 struct ppb_softc {
45 struct device sc_dev;
46 pci_chipset_tag_t sc_pc;
47 pcitag_t sc_tag;
48 pci_intr_handle_t sc_ih[4];
49 };
50
51 int ppbmatch(struct device *, void *, void *);
52 void ppbattach(struct device *, struct device *, void *);
53
54 struct cfattach ppb_ca = {
55 sizeof(struct ppb_softc), ppbmatch, ppbattach
56 };
57
58 struct cfdriver ppb_cd = {
59 NULL, "ppb", DV_DULL
60 };
61
62 int ppbprint(void *, const char *pnp);
63
64 int
65 ppbmatch(struct device *parent, void *match, void *aux)
66 {
67 struct pci_attach_args *pa = aux;
68
69
70
71
72 if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_VIATECH &&
73 PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_VIATECH_VT82C586_PWR)
74 return (0);
75
76
77
78
79
80 if (PCI_CLASS(pa->pa_class) == PCI_CLASS_BRIDGE &&
81 PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_BRIDGE_PCI)
82 return (1);
83
84 return (0);
85 }
86
87 void
88 ppbattach(struct device *parent, struct device *self, void *aux)
89 {
90 struct ppb_softc *sc = (void *) self;
91 struct pci_attach_args *pa = aux;
92 pci_chipset_tag_t pc = pa->pa_pc;
93 struct pcibus_attach_args pba;
94 pcireg_t busdata;
95 int pin;
96
97 printf("\n");
98
99 sc->sc_pc = pc;
100 sc->sc_tag = pa->pa_tag;
101
102 busdata = pci_conf_read(pc, pa->pa_tag, PPB_REG_BUSINFO);
103
104 if (PPB_BUSINFO_SECONDARY(busdata) == 0) {
105 printf("%s: not configured by system firmware\n",
106 self->dv_xname);
107 return;
108 }
109
110 for (pin = PCI_INTERRUPT_PIN_A; pin <= PCI_INTERRUPT_PIN_D; pin++) {
111 pa->pa_intrpin = pa->pa_rawintrpin = pin;
112 pa->pa_intrline = 0;
113 pci_intr_map(pa, &sc->sc_ih[pin - PCI_INTERRUPT_PIN_A]);
114 }
115
116 #if 0
117
118
119
120
121
122
123 if (pa->pa_bus != PPB_BUSINFO_PRIMARY(busdata))
124 panic("ppbattach: bus in tag (%d) != bus in reg (%d)",
125 pa->pa_bus, PPB_BUSINFO_PRIMARY(busdata));
126 #endif
127
128
129
130
131
132
133
134 pba.pba_busname = "pci";
135 pba.pba_iot = pa->pa_iot;
136 pba.pba_memt = pa->pa_memt;
137 pba.pba_dmat = pa->pa_dmat;
138 pba.pba_pc = pc;
139 #if 0
140 pba.pba_flags = pa->pa_flags & ~PCI_FLAGS_MRM_OKAY;
141 #endif
142 pba.pba_domain = pa->pa_domain;
143 pba.pba_bus = PPB_BUSINFO_SECONDARY(busdata);
144 pba.pba_bridgeih = sc->sc_ih;
145 pba.pba_bridgetag = &sc->sc_tag;
146 pba.pba_intrswiz = pa->pa_intrswiz;
147 pba.pba_intrtag = pa->pa_intrtag;
148
149 config_found(self, &pba, ppbprint);
150 }
151
152 int
153 ppbprint(void *aux, const char *pnp)
154 {
155 struct pcibus_attach_args *pba = aux;
156
157
158 if (pnp)
159 printf("pci at %s", pnp);
160 printf(" bus %d", pba->pba_bus);
161 return (UNCONF);
162 }