1 /* 2 * Copyright 2018, Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT license. 4 */ 5 6 7 #include <sys/bus.h> 8 #include <sys/kernel.h> 9 10 #include <dev/pci/pcivar.h> 11 12 #include <machine/bus.h> 13 14 #include <net/if.h> 15 #include <net/if_media.h> 16 17 #include <net80211/ieee80211_var.h> 18 #include <net80211/ieee80211_amrr.h> 19 20 #include <dev/rtwn/if_rtwnvar.h> 21 #include <dev/rtwn/pci/rtwn_pci_var.h> 22 23 24 extern driver_t* DRIVER_MODULE_NAME(rtwn_pci, pci); 25 extern driver_t* DRIVER_MODULE_NAME(rtwn_usb, uhub); 26 27 HAIKU_FBSD_WLAN_DRIVERS_GLUE(realtekwifi) 28 HAIKU_DRIVER_REQUIREMENTS(FBSD_WLAN); 29 HAIKU_FIRMWARE_VERSION(0); 30 HAIKU_FIRMWARE_NAME_MAP({ 31 {"rtwn-rtl8188eefw", "rtwn-rtl8188eefw.ucode"}, 32 {"rtwn-rtl8188eufw", "rtwn-rtl8188eufw.ucode"}, 33 {"rtwn-rtl8192cfwE", "rtwn-rtl8192cfwE.ucode"}, 34 {"rtwn-rtl8192cfwE_B", "rtwn-rtl8192cfwE_B.ucode"}, 35 {"rtwn-rtl8192cfwU", "rtwn-rtl8192cfwU.ucode"}, 36 {"rtwn-rtl8192cfwT", "rtwn-rtl8192cfwT.ucode"}, 37 {"rtwn-rtl8192eufw", "rtwn-rtl8192eufw.ucode"}, 38 {"rtwn-rtl8812aufw", "rtwn-rtl8812aufw.ucode"}, 39 {"rtwn-rtl8821aufw", "rtwn-rtl8821aufw.ucode"}, 40 }); 41 42 NO_HAIKU_FBSD_MII_DRIVER(); 43 NO_HAIKU_REENABLE_INTERRUPTS(); 44 45 46 status_t 47 __haiku_handle_fbsd_drivers_list(status_t (*handler)(driver_t *[], driver_t *[])) 48 { 49 driver_t *pci_drivers[] = { 50 DRIVER_MODULE_NAME(rtwn_pci, pci), 51 NULL 52 }; 53 driver_t *usb_drivers[] = { 54 DRIVER_MODULE_NAME(rtwn_usb, uhub), 55 NULL 56 }; 57 return (*handler)(pci_drivers, usb_drivers); 58 } 59 60 61 int 62 HAIKU_CHECK_DISABLE_INTERRUPTS(device_t dev) 63 { 64 struct rtwn_pci_softc* pc = (struct rtwn_pci_softc*)device_get_softc(dev); 65 int32_t status, tx_rings; 66 67 status = rtwn_pci_get_intr_status(pc, &tx_rings); 68 if (status == 0 && tx_rings == 0) 69 return 0; 70 71 atomic_set(&pc->pc_intr_status, status); 72 atomic_set(&pc->pc_intr_tx_rings, tx_rings); 73 74 return 1; 75 } 76