xref: /haiku/src/add-ons/kernel/drivers/network/ether/rtl8139/glue.c (revision 4c8e85b316c35a9161f5a1c50ad70bc91c83a76f)
1 #include <sys/bus.h>
2 #include <sys/mutex.h>
3 #include <sys/systm.h>
4 #include <sys/taskqueue.h>
5 
6 #include <machine/bus.h>
7 
8 #include <dev/rl/if_rlreg.h>
9 
10 HAIKU_FBSD_DRIVER_GLUE(rtl8139, rl, pci);
11 HAIKU_FBSD_MII_DRIVER(rlphy);
12 HAIKU_DRIVER_REQUIREMENTS(0);
13 
14 
15 int
16 HAIKU_CHECK_DISABLE_INTERRUPTS(device_t dev)
17 {
18 	struct rl_softc *sc = device_get_softc(dev);
19 	uint16_t status;
20 
21 	status = CSR_READ_2(sc, RL_ISR);
22 	if (status == 0xffff)
23 		return 0;
24 	if (status != 0 && (status & RL_INTRS) == 0) {
25 		CSR_WRITE_2(sc, RL_ISR, status);
26 		return 0;
27 	}
28 	if ((status & RL_INTRS) == 0)
29 		return 0;
30 
31 	CSR_WRITE_2(sc, RL_IMR, 0);
32 	return 1;
33 }
34 
35 
36 void
37 HAIKU_REENABLE_INTERRUPTS(device_t dev)
38 {
39 	struct rl_softc *sc = device_get_softc(dev);
40 	RL_LOCK(sc);
41 	CSR_WRITE_2(sc, RL_IMR, RL_INTRS);
42 	RL_UNLOCK(sc);
43 }
44