1 /* 2 * Copyright 2007, Hugo Santos. All Rights Reserved. 3 * Copyright 2007, Axel Dörfler, axeld@pinc-software.de. All Rights Reserved. 4 * Distributed under the terms of the MIT License. 5 */ 6 7 8 #include <sys/bus.h> 9 #include <sys/mutex.h> 10 #include <sys/rman.h> 11 #include <sys/systm.h> 12 13 #include <machine/bus.h> 14 15 #include "if_skreg.h" 16 17 #include "xmaciireg.h" 18 19 HAIKU_FBSD_DRIVER_GLUE(syskonnect, skc, pci) 20 21 extern driver_t *DRIVER_MODULE_NAME(e1000phy, miibus); 22 extern driver_t *DRIVER_MODULE_NAME(ukphy, miibus); 23 extern driver_t *DRIVER_MODULE_NAME(xmphy, miibus); 24 25 HAIKU_DRIVER_REQUIREMENTS(0); 26 27 driver_t * 28 __haiku_select_miibus_driver(device_t dev) 29 { 30 driver_t *drivers[] = { 31 DRIVER_MODULE_NAME(xmphy, miibus), 32 DRIVER_MODULE_NAME(e1000phy, 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 sk_softc* sc = device_get_softc(dev); 45 u_int32_t status; 46 u_int32_t mask; 47 HAIKU_INTR_REGISTER_STATE; 48 49 mask = sc->sk_intrmask; 50 HAIKU_INTR_REGISTER_ENTER(); 51 52 status = CSR_READ_4(sc, SK_ISSR); 53 if (status == 0 || status == 0xffffffff || sc->sk_suspended) 54 { 55 HAIKU_INTR_REGISTER_LEAVE(); 56 return 0; 57 } 58 59 if (sc->sk_if[SK_PORT_A] != NULL) 60 { 61 mask &= ~SK_INTRS1; 62 } 63 64 if (sc->sk_if[SK_PORT_B] != NULL) 65 { 66 mask &= ~SK_INTRS2; 67 } 68 69 mask &= ~SK_ISR_EXTERNAL_REG; 70 CSR_WRITE_4(sc, SK_IMR, mask); 71 72 HAIKU_INTR_REGISTER_LEAVE(); 73 74 atomic_set((int32 *)&sc->sk_intstatus, status); 75 return status & sc->sk_intrmask; 76 } 77 78 void 79 __haiku_reenable_interrupts(device_t dev) 80 { 81 struct sk_softc *sc = device_get_softc(dev); 82 83 CSR_READ_4(sc, SK_ISSR); 84 CSR_WRITE_4(sc, SK_IMR, sc->sk_intrmask); 85 } 86 87 88