xref: /haiku/src/add-ons/kernel/drivers/network/ether/vt612x/glue.c (revision 4c8e85b316c35a9161f5a1c50ad70bc91c83a76f)
1 /*
2  * Copyright 2007, Axel Dörfler, axeld@pinc-software.de. All Rights Reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 
6 
7 #include <sys/systm.h>
8 #include <machine/bus.h>
9 #include <sys/bus.h>
10 #include <sys/rman.h>
11 #include <sys/mutex.h>
12 
13 
14 #include <dev/vge/if_vgereg.h>
15 #include <dev/vge/if_vgevar.h>
16 
17 
18 HAIKU_FBSD_DRIVER_GLUE(vt612x, vge, pci);
19 HAIKU_DRIVER_REQUIREMENTS(FBSD_TASKQUEUES | FBSD_SWI_TASKQUEUE);
20 
21 
22 extern driver_t *DRIVER_MODULE_NAME(ciphy, miibus);
23 extern driver_t *DRIVER_MODULE_NAME(ukphy, miibus);
24 
25 
26 driver_t *
27 __haiku_select_miibus_driver(device_t dev)
28 {
29 	driver_t *drivers[] = {
30 		DRIVER_MODULE_NAME(ciphy, miibus),
31 		DRIVER_MODULE_NAME(ukphy, miibus),
32 		NULL
33 	};
34 
35 	return __haiku_probe_miibus(dev, drivers);
36 }
37 
38 
39 int
40 __haiku_disable_interrupts(device_t dev)
41 {
42 	struct vge_softc *sc = device_get_softc(dev);
43 
44 	if (CSR_READ_4(sc, VGE_ISR) == 0)
45 		return 0;
46 
47 	CSR_WRITE_4(sc, VGE_IMR, 0x00000000);
48 	return 1;
49 }
50 
51 
52 void
53 __haiku_reenable_interrupts(device_t dev)
54 {
55 	struct vge_softc *sc = device_get_softc(dev);
56 
57 	CSR_WRITE_4(sc, VGE_IMR, VGE_INTRS);
58 }
59 
60