xref: /haiku/src/add-ons/kernel/drivers/network/ether/ipro100/glue.c (revision 899e0ef82b5624ace2ccfa5f5a58c8ebee54aaef)
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/bus.h>
8 #include <sys/mutex.h>
9 #include <sys/rman.h>
10 #include <sys/systm.h>
11 
12 #include <machine/bus.h>
13 
14 #include <net/if.h>
15 #include <net/if_media.h>
16 
17 #include "if_fxpreg.h"
18 #include "if_fxpvar.h"
19 
20 
21 HAIKU_FBSD_DRIVER_GLUE(ipro100, fxp, pci)
22 HAIKU_DRIVER_REQUIREMENTS(0);
23 HAIKU_FBSD_MII_DRIVER(inphy);
24 
25 
26 int
27 HAIKU_CHECK_DISABLE_INTERRUPTS(device_t dev)
28 {
29 	struct fxp_softc *sc = device_get_softc(dev);
30 
31 	uint8_t statack = CSR_READ_1(sc, FXP_CSR_SCB_STATACK);
32 	if (statack == 0)
33 		return 0;
34 
35 	CSR_WRITE_1(sc, FXP_CSR_SCB_INTRCNTL, FXP_SCB_INTR_DISABLE);
36 	atomic_set((int32*)&sc->sc_statack, statack);
37 	return 1;
38 }
39 
40 
41 void
42 HAIKU_REENABLE_INTERRUPTS(device_t dev)
43 {
44 	struct fxp_softc *sc = device_get_softc(dev);
45 
46 	CSR_WRITE_1(sc, FXP_CSR_SCB_INTRCNTL, 0);
47 }
48