1 /* 2 * Copyright 2008, Jérôme Duval. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 6 #include <sys/bus.h> 7 #include <sys/malloc.h> 8 #include <sys/rman.h> 9 #include <sys/systm.h> 10 11 #include <machine/bus.h> 12 13 #include <net/if.h> 14 15 #include "if_bfereg.h" 16 17 18 HAIKU_FBSD_DRIVER_GLUE(broadcom440x, bfe, pci); 19 20 extern driver_t *DRIVER_MODULE_NAME(bmtphy, miibus); 21 22 HAIKU_DRIVER_REQUIREMENTS(FBSD_TASKQUEUES | FBSD_SWI_TASKQUEUE); 23 //HAIKU_DRIVER_REQUIREMENTS(FBSD_TASKQUEUES | FBSD_FAST_TASKQUEUE | FBSD_SWI_TASKQUEUE); 24 25 driver_t * 26 __haiku_select_miibus_driver(device_t dev) 27 { 28 driver_t *drivers[] = { 29 DRIVER_MODULE_NAME(bmtphy, miibus), 30 NULL 31 }; 32 33 return __haiku_probe_miibus(dev, drivers); 34 } 35 36 37 int 38 __haiku_disable_interrupts(device_t dev) 39 { 40 struct bfe_softc *sc = device_get_softc(dev); 41 uint32 istat; 42 HAIKU_INTR_REGISTER_STATE; 43 44 HAIKU_INTR_REGISTER_ENTER(); 45 46 istat = CSR_READ_4(sc, BFE_ISTAT); 47 if (istat == 0 || (sc->bfe_ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { 48 HAIKU_INTR_REGISTER_LEAVE(); 49 return 0; 50 } 51 52 CSR_WRITE_4(sc, BFE_IMASK, 0); 53 CSR_READ_4(sc, BFE_IMASK); 54 55 HAIKU_INTR_REGISTER_LEAVE(); 56 return 1; 57 } 58 59 60 void 61 __haiku_reenable_interrupts(device_t dev) 62 { 63 struct bfe_softc *sc = device_get_softc(dev); 64 CSR_WRITE_4(sc, BFE_IMASK, BFE_IMASK_DEF); 65 CSR_READ_4(sc, BFE_IMASK); 66 } 67 68 69