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 #include <sys/bus.h> 8 #include <sys/systm.h> 9 10 #include <machine/bus.h> 11 12 #include <net/if.h> 13 #include <net/if_media.h> 14 15 #include "if_xlreg.h" 16 17 18 HAIKU_FBSD_DRIVER_GLUE(3com, xl, pci); 19 HAIKU_DRIVER_REQUIREMENTS(FBSD_SWI_TASKQUEUE); 20 21 extern driver_t *DRIVER_MODULE_NAME(bmtphy, miibus); 22 extern driver_t *DRIVER_MODULE_NAME(ukphy, miibus); 23 extern driver_t *DRIVER_MODULE_NAME(xlphy, miibus); 24 25 26 driver_t * 27 __haiku_select_miibus_driver(device_t dev) 28 { 29 driver_t *drivers[] = { 30 DRIVER_MODULE_NAME(bmtphy, miibus), 31 DRIVER_MODULE_NAME(ukphy, miibus), 32 DRIVER_MODULE_NAME(xlphy, miibus), 33 NULL 34 }; 35 36 return __haiku_probe_miibus(dev, drivers); 37 } 38 39 40 int 41 HAIKU_CHECK_DISABLE_INTERRUPTS(device_t dev) 42 { 43 struct xl_softc *sc = device_get_softc(dev); 44 u_int16_t status = CSR_READ_2(sc, XL_STATUS); 45 46 if (status == 0xffff || (status & XL_INTRS) == 0) 47 return 0; 48 49 CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_STAT_ENB); 50 CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_INTR_ACK | (status & XL_INTRS)); 51 atomic_set((int32 *)&sc->xl_intr_status, status); 52 return 1; 53 } 54 55 56 void 57 HAIKU_REENABLE_INTERRUPTS(device_t dev) 58 { 59 struct xl_softc *sc = device_get_softc(dev); 60 CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_STAT_ENB | XL_INTRS); 61 } 62