xref: /haiku/src/add-ons/kernel/drivers/network/ether/vt612x/glue.c (revision 13581b3d2a71545960b98fefebc5225b5bf29072)
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 #include <net/if.h>
14 #include <net/if_var.h>
15 
16 #include <dev/vge/if_vgereg.h>
17 #include <dev/vge/if_vgevar.h>
18 
19 
20 HAIKU_FBSD_DRIVER_GLUE(vt612x, vge, pci);
21 HAIKU_DRIVER_REQUIREMENTS(FBSD_SWI_TASKQUEUE);
22 
23 
24 extern driver_t *DRIVER_MODULE_NAME(ciphy, miibus);
25 extern driver_t *DRIVER_MODULE_NAME(ukphy, miibus);
26 
27 
28 driver_t *
29 __haiku_select_miibus_driver(device_t dev)
30 {
31 	driver_t *drivers[] = {
32 		DRIVER_MODULE_NAME(ciphy, miibus),
33 		DRIVER_MODULE_NAME(ukphy, miibus),
34 		NULL
35 	};
36 
37 	return __haiku_probe_miibus(dev, drivers);
38 }
39 
40 
41 int
42 __haiku_disable_interrupts(device_t dev)
43 {
44 	struct vge_softc *sc = device_get_softc(dev);
45 
46 	if (CSR_READ_4(sc, VGE_ISR) == 0)
47 		return 0;
48 
49 	CSR_WRITE_4(sc, VGE_IMR, 0x00000000);
50 	return 1;
51 }
52 
53 
54 void
55 __haiku_reenable_interrupts(device_t dev)
56 {
57 	struct vge_softc *sc = device_get_softc(dev);
58 
59 	CSR_WRITE_4(sc, VGE_IMR, VGE_INTRS);
60 }
61 
62