BPicture: Fix archive constructor.
[haiku.git] / src / add-ons / kernel / drivers / network / rtl81xx / dev / re / glue.c
blob33f1797134a127ee7532b8ad964d6114909a0101
1 /*
2 * Copyright 2008-2010, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
4 */
7 #include <sys/bus.h>
8 #include <sys/mutex.h>
9 #include <sys/systm.h>
10 #include <sys/taskqueue.h>
12 #include <machine/bus.h>
14 #include <pci/if_rlreg.h>
17 extern driver_t *DRIVER_MODULE_NAME(rgephy, miibus);
18 extern driver_t *DRIVER_MODULE_NAME(rlphy, miibus);
21 HAIKU_FBSD_DRIVER_GLUE(rtl81xx, re, pci);
22 HAIKU_DRIVER_REQUIREMENTS(FBSD_TASKQUEUES | FBSD_FAST_TASKQUEUE);
25 driver_t *
26 __haiku_select_miibus_driver(device_t dev)
28 driver_t *drivers[] = {
29 DRIVER_MODULE_NAME(rgephy, miibus),
30 DRIVER_MODULE_NAME(rlphy, miibus),
31 NULL
34 return __haiku_probe_miibus(dev, drivers);
38 int
39 HAIKU_CHECK_DISABLE_INTERRUPTS(device_t dev)
41 struct rl_softc *sc = device_get_softc(dev);
42 uint16_t status;
44 status = CSR_READ_2(sc, RL_ISR);
45 if (status == 0xffff)
46 return 0;
47 if (status != 0 && (status & RL_INTRS) == 0) {
48 CSR_WRITE_2(sc, RL_ISR, status);
49 return 0;
51 if ((status & RL_INTRS) == 0)
52 return 0;
54 CSR_WRITE_2(sc, RL_IMR, 0);
55 return 1;
59 void
60 HAIKU_REENABLE_INTERRUPTS(device_t dev)
62 struct rl_softc *sc = device_get_softc(dev);
63 RL_LOCK(sc);
64 CSR_WRITE_2(sc, RL_IMR, RL_INTRS);
65 RL_UNLOCK(sc);