if_ex_pci.c revision 1.58 1 1.58 jdolecek /* $NetBSD: if_ex_pci.c,v 1.58 2018/12/09 11:14:02 jdolecek Exp $ */
2 1.1 fvdl
3 1.1 fvdl /*-
4 1.1 fvdl * Copyright (c) 1998 The NetBSD Foundation, Inc.
5 1.1 fvdl * All rights reserved.
6 1.1 fvdl *
7 1.1 fvdl * This code is derived from software contributed to The NetBSD Foundation
8 1.3 thorpej * by Frank van der Linden; Jason R. Thorpe of the Numerical Aerospace
9 1.3 thorpej * Simulation Facility, NASA Ames Research Center.
10 1.1 fvdl *
11 1.1 fvdl * Redistribution and use in source and binary forms, with or without
12 1.1 fvdl * modification, are permitted provided that the following conditions
13 1.1 fvdl * are met:
14 1.1 fvdl * 1. Redistributions of source code must retain the above copyright
15 1.1 fvdl * notice, this list of conditions and the following disclaimer.
16 1.1 fvdl * 2. Redistributions in binary form must reproduce the above copyright
17 1.1 fvdl * notice, this list of conditions and the following disclaimer in the
18 1.1 fvdl * documentation and/or other materials provided with the distribution.
19 1.1 fvdl *
20 1.1 fvdl * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21 1.1 fvdl * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 1.1 fvdl * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 1.1 fvdl * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24 1.1 fvdl * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 1.1 fvdl * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 1.1 fvdl * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 1.1 fvdl * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 1.1 fvdl * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 1.1 fvdl * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 1.1 fvdl * POSSIBILITY OF SUCH DAMAGE.
31 1.1 fvdl */
32 1.19 lukem
33 1.19 lukem #include <sys/cdefs.h>
34 1.58 jdolecek __KERNEL_RCSID(0, "$NetBSD: if_ex_pci.c,v 1.58 2018/12/09 11:14:02 jdolecek Exp $");
35 1.1 fvdl
36 1.1 fvdl #include <sys/param.h>
37 1.1 fvdl #include <sys/systm.h>
38 1.39 perry #include <sys/mbuf.h>
39 1.39 perry #include <sys/socket.h>
40 1.1 fvdl #include <sys/ioctl.h>
41 1.1 fvdl #include <sys/errno.h>
42 1.1 fvdl #include <sys/syslog.h>
43 1.1 fvdl #include <sys/select.h>
44 1.1 fvdl #include <sys/device.h>
45 1.1 fvdl
46 1.1 fvdl #include <net/if.h>
47 1.1 fvdl #include <net/if_dl.h>
48 1.1 fvdl #include <net/if_ether.h>
49 1.1 fvdl #include <net/if_media.h>
50 1.1 fvdl
51 1.44 ad #include <sys/cpu.h>
52 1.44 ad #include <sys/bus.h>
53 1.44 ad #include <sys/intr.h>
54 1.1 fvdl
55 1.1 fvdl #include <dev/mii/miivar.h>
56 1.1 fvdl #include <dev/mii/mii.h>
57 1.1 fvdl
58 1.1 fvdl #include <dev/ic/elink3var.h>
59 1.1 fvdl #include <dev/ic/elink3reg.h>
60 1.1 fvdl #include <dev/ic/elinkxlreg.h>
61 1.1 fvdl #include <dev/ic/elinkxlvar.h>
62 1.1 fvdl
63 1.1 fvdl #include <dev/pci/pcivar.h>
64 1.1 fvdl #include <dev/pci/pcireg.h>
65 1.1 fvdl #include <dev/pci/pcidevs.h>
66 1.1 fvdl
67 1.14 fvdl struct ex_pci_softc {
68 1.14 fvdl struct ex_softc sc_ex;
69 1.18 kanaoka
70 1.18 kanaoka /* PCI function status space. 556,556B requests it. */
71 1.18 kanaoka bus_space_tag_t sc_funct;
72 1.18 kanaoka bus_space_handle_t sc_funch;
73 1.18 kanaoka
74 1.21 thorpej pci_chipset_tag_t psc_pc; /* pci chipset tag */
75 1.38 martin pcireg_t psc_regs[0x40>>2]; /* saved PCI config regs (sparse) */
76 1.21 thorpej pcitag_t psc_tag; /* pci device tag */
77 1.14 fvdl };
78 1.14 fvdl
79 1.1 fvdl /*
80 1.1 fvdl * PCI constants.
81 1.1 fvdl * XXX These should be in a common file!
82 1.1 fvdl */
83 1.1 fvdl #define PCI_CONN 0x48 /* Connector type */
84 1.54 dyoung #define PCI_CBIO PCI_BAR(0) /* Configuration Base IO Address */
85 1.1 fvdl #define PCI_POWERCTL 0xe0
86 1.54 dyoung #define PCI_FUNCMEM PCI_BAR(2)
87 1.14 fvdl
88 1.18 kanaoka #define PCI_INTR 4
89 1.14 fvdl #define PCI_INTRACK 0x00008000
90 1.1 fvdl
91 1.47 spz static int ex_pci_match(device_t, cfdata_t, void *);
92 1.47 spz static void ex_pci_attach(device_t, device_t, void *);
93 1.37 thorpej static void ex_pci_intr_ack(struct ex_softc *);
94 1.1 fvdl
95 1.37 thorpej static int ex_pci_enable(struct ex_softc *);
96 1.21 thorpej
97 1.37 thorpej static void ex_pci_confreg_restore(struct ex_pci_softc *);
98 1.45 dyoung static int ex_d3tod0(pci_chipset_tag_t, pcitag_t, device_t, pcireg_t);
99 1.21 thorpej
100 1.47 spz CFATTACH_DECL_NEW(ex_pci, sizeof(struct ex_pci_softc),
101 1.27 thorpej ex_pci_match, ex_pci_attach, NULL, NULL);
102 1.1 fvdl
103 1.37 thorpej static const struct ex_pci_product {
104 1.48 cegger uint32_t epp_prodid; /* PCI product ID */
105 1.3 thorpej int epp_flags; /* initial softc flags */
106 1.3 thorpej const char *epp_name; /* device name */
107 1.3 thorpej } ex_pci_products[] = {
108 1.3 thorpej { PCI_PRODUCT_3COM_3C900TPO, 0,
109 1.4 thorpej "3c900-TPO Ethernet" },
110 1.3 thorpej { PCI_PRODUCT_3COM_3C900COMBO, 0,
111 1.4 thorpej "3c900-COMBO Ethernet" },
112 1.3 thorpej
113 1.3 thorpej { PCI_PRODUCT_3COM_3C905TX, EX_CONF_MII,
114 1.4 thorpej "3c905-TX 10/100 Ethernet" },
115 1.3 thorpej { PCI_PRODUCT_3COM_3C905T4, EX_CONF_MII,
116 1.4 thorpej "3c905-T4 10/100 Ethernet" },
117 1.3 thorpej
118 1.3 thorpej { PCI_PRODUCT_3COM_3C900BTPO, EX_CONF_90XB,
119 1.4 thorpej "3c900B-TPO Ethernet" },
120 1.3 thorpej { PCI_PRODUCT_3COM_3C900BCOMBO, EX_CONF_90XB,
121 1.4 thorpej "3c900B-COMBO Ethernet" },
122 1.6 fvdl { PCI_PRODUCT_3COM_3C900BTPC, EX_CONF_90XB,
123 1.6 fvdl "3c900B-TPC Ethernet" },
124 1.3 thorpej
125 1.3 thorpej { PCI_PRODUCT_3COM_3C905BTX, EX_CONF_90XB|EX_CONF_MII|EX_CONF_INTPHY,
126 1.4 thorpej "3c905B-TX 10/100 Ethernet" },
127 1.3 thorpej { PCI_PRODUCT_3COM_3C905BT4, EX_CONF_90XB|EX_CONF_MII,
128 1.4 thorpej "3c905B-T4 10/100 Ethernet" },
129 1.9 drochner { PCI_PRODUCT_3COM_3C905BCOMBO, EX_CONF_90XB/*|EX_CONF_MII|EX_CONF_INTPHY*/,
130 1.9 drochner "3c905B-COMBO 10/100 Ethernet" },
131 1.8 fvdl { PCI_PRODUCT_3COM_3C905BFX, EX_CONF_90XB,
132 1.4 thorpej "3c905B-FX 10/100 Ethernet" },
133 1.4 thorpej
134 1.4 thorpej /* XXX Internal PHY? */
135 1.10 mycroft { PCI_PRODUCT_3COM_3C980SRV, EX_CONF_90XB,
136 1.4 thorpej "3c980 Server Adapter 10/100 Ethernet" },
137 1.20 christos { PCI_PRODUCT_3COM_3C980CTXM, EX_CONF_90XB|EX_CONF_MII,
138 1.12 thorpej "3c980C-TXM 10/100 Ethernet" },
139 1.12 thorpej
140 1.7 ross { PCI_PRODUCT_3COM_3C905CTX, EX_CONF_90XB|EX_CONF_MII,
141 1.7 ross "3c905C-TX 10/100 Ethernet with mngmt" },
142 1.13 billc
143 1.13 billc { PCI_PRODUCT_3COM_3C450TX, EX_CONF_90XB,
144 1.13 billc "3c450-TX 10/100 Ethernet" },
145 1.13 billc
146 1.13 billc { PCI_PRODUCT_3COM_3CSOHO100TX, EX_CONF_90XB,
147 1.13 billc "3cSOHO100-TX 10/100 Ethernet" },
148 1.3 thorpej
149 1.14 fvdl { PCI_PRODUCT_3COM_3C555,
150 1.14 fvdl EX_CONF_90XB | EX_CONF_MII | EX_CONF_EEPROM_OFF |
151 1.14 fvdl EX_CONF_EEPROM_8BIT,
152 1.14 fvdl "3c555 MiniPCI 10/100 Ethernet" },
153 1.14 fvdl
154 1.14 fvdl { PCI_PRODUCT_3COM_3C556,
155 1.14 fvdl EX_CONF_90XB | EX_CONF_MII | EX_CONF_EEPROM_OFF |
156 1.14 fvdl EX_CONF_PCI_FUNCREG | EX_CONF_RESETHACK | EX_CONF_INV_LED_POLARITY |
157 1.14 fvdl EX_CONF_PHY_POWER | EX_CONF_EEPROM_8BIT,
158 1.14 fvdl "3c556 MiniPCI 10/100 Ethernet" },
159 1.14 fvdl
160 1.14 fvdl { PCI_PRODUCT_3COM_3C556B,
161 1.14 fvdl EX_CONF_90XB | EX_CONF_MII | EX_CONF_EEPROM_OFF |
162 1.14 fvdl EX_CONF_PCI_FUNCREG | EX_CONF_RESETHACK | EX_CONF_INV_LED_POLARITY |
163 1.35 dogcow EX_CONF_PHY_POWER | EX_CONF_NO_XCVR_PWR,
164 1.14 fvdl "3c556B MiniPCI 10/100 Ethernet" },
165 1.31 gendalia
166 1.31 gendalia { PCI_PRODUCT_3COM_3C905CXTX, EX_CONF_90XB|EX_CONF_MII,
167 1.31 gendalia "3c905CX-TX 10/100 Ethernet with mngmt" },
168 1.14 fvdl
169 1.36 junyoung { PCI_PRODUCT_3COM_3C920BEMBW, EX_CONF_90XB|EX_CONF_MII,
170 1.36 junyoung "3c920B-EMB-WNM Integrated Fast Ethernet" },
171 1.36 junyoung
172 1.3 thorpej { 0, 0,
173 1.3 thorpej NULL },
174 1.3 thorpej };
175 1.3 thorpej
176 1.37 thorpej static const struct ex_pci_product *
177 1.37 thorpej ex_pci_lookup(const struct pci_attach_args *pa)
178 1.3 thorpej {
179 1.3 thorpej const struct ex_pci_product *epp;
180 1.3 thorpej
181 1.3 thorpej if (PCI_VENDOR(pa->pa_id) != PCI_VENDOR_3COM)
182 1.3 thorpej return (NULL);
183 1.3 thorpej
184 1.3 thorpej for (epp = ex_pci_products; epp->epp_name != NULL; epp++)
185 1.3 thorpej if (PCI_PRODUCT(pa->pa_id) == epp->epp_prodid)
186 1.3 thorpej return (epp);
187 1.3 thorpej return (NULL);
188 1.3 thorpej }
189 1.3 thorpej
190 1.37 thorpej static int
191 1.47 spz ex_pci_match(device_t parent, cfdata_t match,
192 1.42 christos void *aux)
193 1.1 fvdl {
194 1.1 fvdl struct pci_attach_args *pa = (struct pci_attach_args *) aux;
195 1.1 fvdl
196 1.3 thorpej if (ex_pci_lookup(pa) != NULL)
197 1.3 thorpej return (2); /* beat ep_pci */
198 1.1 fvdl
199 1.3 thorpej return (0);
200 1.1 fvdl }
201 1.1 fvdl
202 1.37 thorpej static void
203 1.45 dyoung ex_pci_attach(device_t parent, device_t self, void *aux)
204 1.1 fvdl {
205 1.45 dyoung struct ex_pci_softc *psc = device_private(self);
206 1.45 dyoung struct ex_softc *sc = &psc->sc_ex;
207 1.1 fvdl struct pci_attach_args *pa = aux;
208 1.1 fvdl pci_chipset_tag_t pc = pa->pa_pc;
209 1.1 fvdl pci_intr_handle_t ih;
210 1.3 thorpej const struct ex_pci_product *epp;
211 1.1 fvdl const char *intrstr = NULL;
212 1.41 christos int rev;
213 1.41 christos int error;
214 1.57 christos char intrbuf[PCI_INTRSTR_LEN];
215 1.1 fvdl
216 1.32 thorpej aprint_naive(": Ethernet controller\n");
217 1.32 thorpej
218 1.47 spz sc->sc_dev = self;
219 1.47 spz
220 1.1 fvdl if (pci_mapreg_map(pa, PCI_CBIO, PCI_MAPREG_TYPE_IO, 0,
221 1.1 fvdl &sc->sc_iot, &sc->sc_ioh, NULL, NULL)) {
222 1.32 thorpej aprint_error(": can't map i/o space\n");
223 1.1 fvdl return;
224 1.1 fvdl }
225 1.1 fvdl
226 1.3 thorpej epp = ex_pci_lookup(pa);
227 1.3 thorpej if (epp == NULL) {
228 1.3 thorpej printf("\n");
229 1.3 thorpej panic("ex_pci_attach: impossible");
230 1.1 fvdl }
231 1.1 fvdl
232 1.9 drochner rev = PCI_REVISION(pci_conf_read(pc, pa->pa_tag, PCI_CLASS_REG));
233 1.32 thorpej aprint_normal(": 3Com %s (rev. 0x%x)\n", epp->epp_name, rev);
234 1.1 fvdl
235 1.3 thorpej sc->sc_dmat = pa->pa_dmat;
236 1.3 thorpej
237 1.3 thorpej sc->ex_conf = epp->epp_flags;
238 1.3 thorpej
239 1.1 fvdl /* Enable the card. */
240 1.1 fvdl pci_conf_write(pc, pa->pa_tag, PCI_COMMAND_STATUS_REG,
241 1.1 fvdl pci_conf_read(pc, pa->pa_tag, PCI_COMMAND_STATUS_REG) |
242 1.1 fvdl PCI_COMMAND_MASTER_ENABLE);
243 1.1 fvdl
244 1.21 thorpej psc->psc_pc = pc;
245 1.21 thorpej psc->psc_tag = pa->pa_tag;
246 1.39 perry psc->psc_regs[PCI_COMMAND_STATUS_REG>>2] =
247 1.21 thorpej pci_conf_read(pc, pa->pa_tag, PCI_COMMAND_STATUS_REG);
248 1.21 thorpej psc->psc_regs[PCI_BHLC_REG>>2] =
249 1.39 perry pci_conf_read(pc, pa->pa_tag, PCI_BHLC_REG);
250 1.21 thorpej psc->psc_regs[PCI_CBIO>>2] =
251 1.21 thorpej pci_conf_read(pc, pa->pa_tag, PCI_CBIO);
252 1.21 thorpej
253 1.18 kanaoka if (sc->ex_conf & EX_CONF_PCI_FUNCREG) {
254 1.18 kanaoka /* Map PCI function status window. */
255 1.18 kanaoka if (pci_mapreg_map(pa, PCI_FUNCMEM, PCI_MAPREG_TYPE_MEM, 0,
256 1.18 kanaoka &psc->sc_funct, &psc->sc_funch, NULL, NULL)) {
257 1.47 spz aprint_error_dev(self,
258 1.46 cegger "unable to map function status window\n");
259 1.18 kanaoka return;
260 1.18 kanaoka }
261 1.18 kanaoka sc->intr_ack = ex_pci_intr_ack;
262 1.21 thorpej
263 1.21 thorpej psc->psc_regs[PCI_FUNCMEM>>2] =
264 1.21 thorpej pci_conf_read(pc, pa->pa_tag, PCI_FUNCMEM);
265 1.18 kanaoka }
266 1.24 thorpej
267 1.24 thorpej psc->psc_regs[PCI_INTERRUPT_REG>>2] =
268 1.24 thorpej pci_conf_read(pc, pa->pa_tag, PCI_INTERRUPT_REG);
269 1.41 christos /* power up chip */
270 1.45 dyoung error = pci_activate(pa->pa_pc, pa->pa_tag, self, ex_d3tod0);
271 1.45 dyoung switch (error) {
272 1.41 christos case EOPNOTSUPP:
273 1.41 christos break;
274 1.55 christos case 0:
275 1.21 thorpej sc->enable = ex_pci_enable;
276 1.52 dyoung sc->disable = NULL;
277 1.41 christos break;
278 1.41 christos default:
279 1.47 spz aprint_error_dev(self, "cannot activate %d\n", error);
280 1.41 christos return;
281 1.1 fvdl }
282 1.21 thorpej sc->enabled = 1;
283 1.21 thorpej
284 1.1 fvdl /* Map and establish the interrupt. */
285 1.15 sommerfe if (pci_intr_map(pa, &ih)) {
286 1.47 spz aprint_error_dev(self, "couldn't map interrupt\n");
287 1.1 fvdl return;
288 1.1 fvdl }
289 1.14 fvdl
290 1.57 christos intrstr = pci_intr_string(pc, ih, intrbuf, sizeof(intrbuf));
291 1.58 jdolecek sc->sc_ih = pci_intr_establish_xname(pc, ih, IPL_NET, ex_intr, sc,
292 1.58 jdolecek device_xname(self));
293 1.1 fvdl if (sc->sc_ih == NULL) {
294 1.47 spz aprint_error_dev(self, "couldn't establish interrupt");
295 1.1 fvdl if (intrstr != NULL)
296 1.50 cegger aprint_error(" at %s", intrstr);
297 1.50 cegger aprint_error("\n");
298 1.1 fvdl return;
299 1.1 fvdl }
300 1.47 spz aprint_normal_dev(self, "interrupting at %s\n", intrstr);
301 1.1 fvdl
302 1.1 fvdl ex_config(sc);
303 1.18 kanaoka
304 1.18 kanaoka if (sc->ex_conf & EX_CONF_PCI_FUNCREG)
305 1.39 perry bus_space_write_4(psc->sc_funct, psc->sc_funch, PCI_INTR,
306 1.18 kanaoka PCI_INTRACK);
307 1.21 thorpej
308 1.21 thorpej if (sc->disable != NULL)
309 1.23 itojun ex_disable(sc);
310 1.14 fvdl }
311 1.14 fvdl
312 1.39 perry static void
313 1.37 thorpej ex_pci_intr_ack(struct ex_softc *sc)
314 1.14 fvdl {
315 1.14 fvdl struct ex_pci_softc *psc = (struct ex_pci_softc *)sc;
316 1.39 perry
317 1.18 kanaoka bus_space_write_4(psc->sc_funct, psc->sc_funch, PCI_INTR,
318 1.14 fvdl PCI_INTRACK);
319 1.33 christos }
320 1.33 christos
321 1.41 christos static int
322 1.45 dyoung ex_d3tod0(pci_chipset_tag_t pc, pcitag_t tag, device_t self, pcireg_t state)
323 1.33 christos {
324 1.33 christos
325 1.33 christos #define PCI_CACHE_LAT_BIST 0x0c
326 1.33 christos #define PCI_EXP_ROM_BAR 0x30
327 1.33 christos #define PCI_INT_GNT_LAT 0x3c
328 1.33 christos
329 1.48 cegger uint32_t base0;
330 1.48 cegger uint32_t base1;
331 1.48 cegger uint32_t romaddr;
332 1.48 cegger uint32_t pci_int_lat;
333 1.48 cegger uint32_t pci_cache_lat;
334 1.41 christos
335 1.41 christos if (state != PCI_PMCSR_STATE_D3)
336 1.41 christos return 0;
337 1.33 christos
338 1.47 spz aprint_normal_dev(self, "found in power state D%d, "
339 1.46 cegger "attempting to recover.\n", state);
340 1.56 martin /* XXX is this needed? */
341 1.56 martin (void)pci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG);
342 1.41 christos base0 = pci_conf_read(pc, tag, PCI_BAR0);
343 1.41 christos base1 = pci_conf_read(pc, tag, PCI_BAR1);
344 1.41 christos romaddr = pci_conf_read(pc, tag, PCI_EXP_ROM_BAR);
345 1.41 christos pci_cache_lat= pci_conf_read(pc, tag, PCI_CACHE_LAT_BIST);
346 1.41 christos pci_int_lat = pci_conf_read(pc, tag, PCI_INT_GNT_LAT);
347 1.41 christos
348 1.41 christos pci_conf_write(pc, tag, PCI_POWERCTL, 0);
349 1.41 christos pci_conf_write(pc, tag, PCI_BAR0, base0);
350 1.41 christos pci_conf_write(pc, tag, PCI_BAR1, base1);
351 1.41 christos pci_conf_write(pc, tag, PCI_EXP_ROM_BAR, romaddr);
352 1.41 christos pci_conf_write(pc, tag, PCI_INT_GNT_LAT, pci_int_lat);
353 1.41 christos pci_conf_write(pc, tag, PCI_CACHE_LAT_BIST, pci_cache_lat);
354 1.41 christos pci_conf_write(pc, tag, PCI_COMMAND_STATUS_REG,
355 1.33 christos (PCI_COMMAND_MASTER_ENABLE | PCI_COMMAND_IO_ENABLE));
356 1.47 spz aprint_normal_dev(self, "changed power state to D0.\n");
357 1.41 christos return 0;
358 1.21 thorpej }
359 1.21 thorpej
360 1.37 thorpej static void
361 1.37 thorpej ex_pci_confreg_restore(struct ex_pci_softc *psc)
362 1.21 thorpej {
363 1.21 thorpej struct ex_softc *sc = (void *) psc;
364 1.21 thorpej pcireg_t reg;
365 1.21 thorpej
366 1.21 thorpej reg = pci_conf_read(psc->psc_pc, psc->psc_tag, PCI_COMMAND_STATUS_REG);
367 1.21 thorpej
368 1.21 thorpej pci_conf_write(psc->psc_pc, psc->psc_tag,
369 1.21 thorpej PCI_COMMAND_STATUS_REG,
370 1.21 thorpej (reg & 0xffff0000) |
371 1.21 thorpej (psc->psc_regs[PCI_COMMAND_STATUS_REG>>2] & 0xffff));
372 1.21 thorpej pci_conf_write(psc->psc_pc, psc->psc_tag, PCI_BHLC_REG,
373 1.21 thorpej psc->psc_regs[PCI_BHLC_REG>>2]);
374 1.21 thorpej pci_conf_write(psc->psc_pc, psc->psc_tag, PCI_CBIO,
375 1.21 thorpej psc->psc_regs[PCI_CBIO>>2]);
376 1.21 thorpej if (sc->ex_conf & EX_CONF_PCI_FUNCREG)
377 1.21 thorpej pci_conf_write(psc->psc_pc, psc->psc_tag, PCI_FUNCMEM,
378 1.21 thorpej psc->psc_regs[PCI_FUNCMEM>>2]);
379 1.24 thorpej pci_conf_write(psc->psc_pc, psc->psc_tag, PCI_INTERRUPT_REG,
380 1.24 thorpej psc->psc_regs[PCI_INTERRUPT_REG>>2]);
381 1.21 thorpej }
382 1.21 thorpej
383 1.37 thorpej static int
384 1.37 thorpej ex_pci_enable(struct ex_softc *sc)
385 1.21 thorpej {
386 1.21 thorpej struct ex_pci_softc *psc = (void *) sc;
387 1.21 thorpej
388 1.47 spz aprint_debug_dev(sc->sc_dev, "going to power state D0\n");
389 1.21 thorpej
390 1.21 thorpej /* Now restore the configuration registers. */
391 1.21 thorpej ex_pci_confreg_restore(psc);
392 1.21 thorpej
393 1.21 thorpej return (0);
394 1.21 thorpej }
395