xref: /haiku/src/add-ons/kernel/drivers/network/wlan/realtekwifi/glue.c (revision 4a850ca730d8282b5b924e49e09b4ba4d6db7f54)
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 HAIKU_FBSD_WLAN_DRIVER_GLUE(realtekwifi, rtwn_pci, pci)
25 HAIKU_DRIVER_REQUIREMENTS(FBSD_WLAN);
26 HAIKU_FIRMWARE_VERSION(0);
27 HAIKU_FIRMWARE_NAME_MAP({
28 	{"rtwn-rtl8188eefw", "rtwn-rtl8188eefw.ucode"},
29 	{"rtwn-rtl8192cfwE", "rtwn-rtl8192cfwE.ucode"},
30 	{"rtwn-rtl8192cfwE_B", "rtwn-rtl8192cfwE_B.ucode"},
31 });
32 
33 NO_HAIKU_FBSD_MII_DRIVER();
34 NO_HAIKU_REENABLE_INTERRUPTS();
35 
36 
37 int
38 HAIKU_CHECK_DISABLE_INTERRUPTS(device_t dev)
39 {
40 	struct rtwn_pci_softc* pc = (struct rtwn_pci_softc*)device_get_softc(dev);
41 	int32_t status, tx_rings;
42 
43 	status = rtwn_pci_get_intr_status(pc, &tx_rings);
44 	if (status == 0 && tx_rings == 0)
45 		return 0;
46 
47 	atomic_set(&pc->pc_intr_status, status);
48 	atomic_set(&pc->pc_intr_tx_rings, tx_rings);
49 
50 	return 1;
51 }
52