From 703e3622ff29f9f3c23cd92e2abddd2ac56b73dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20S=C3=B6ntgen?= Date: Sat, 22 Nov 2014 15:13:43 +0100 Subject: [PATCH] wifi_drv: Port of the Linux wireless stack --- repos/dde_linux/README | 35 + repos/dde_linux/include/wifi/socket_call.h | 105 + repos/dde_linux/lib/import/import-libnl.mk | 11 + repos/dde_linux/lib/mk/libnl.inc | 65 + repos/dde_linux/lib/mk/wifi.inc | 161 + repos/dde_linux/lib/mk/wpa_driver_nl80211.mk | 32 + repos/dde_linux/lib/mk/wpa_supplicant.mk | 106 + repos/dde_linux/lib/mk/x86_32/libnl.mk | 3 + repos/dde_linux/lib/mk/x86_32/wifi.mk | 3 + repos/dde_linux/lib/mk/x86_64/libnl.mk | 3 + repos/dde_linux/lib/mk/x86_64/wifi.mk | 3 + repos/dde_linux/patches/libnl.patch | 52 + repos/dde_linux/patches/wifi.patch | 883 +++ repos/dde_linux/patches/wifi_crypto.patch | 101 + repos/dde_linux/patches/wifi_mem.patch | 82 + repos/dde_linux/patches/wpa_supplicant.patch | 83 + repos/dde_linux/ports/dde_linux.hash | 2 +- repos/dde_linux/ports/dde_linux.port | 62 +- repos/dde_linux/run/wifi.run | 168 + repos/dde_linux/src/drivers/wifi/main.cc | 53 + repos/dde_linux/src/drivers/wifi/target.mk | 8 + repos/dde_linux/src/drivers/wifi/wpa.h | 44 + repos/dde_linux/src/lib/libnl/if.cc | 23 + .../lib/libnl/include/32bit/platform/types.h | 24 + .../lib/libnl/include/64bit/platform/types.h | 24 + repos/dde_linux/src/lib/libnl/include/defs.h | 28 + .../dde_linux/src/lib/libnl/include/endian.h | 3 + .../src/lib/libnl/include/libnl_emul.h | 90 + .../src/lib/libnl/include/linux/socket.h | 0 .../src/lib/libnl/include/linux/types.h | 20 + repos/dde_linux/src/lib/libnl/lxcc_emul.cc | 352 ++ repos/dde_linux/src/lib/libnl/socket.cc | 494 ++ repos/dde_linux/src/lib/wifi/dummies.cc | 563 ++ repos/dde_linux/src/lib/wifi/event.cc | 198 + .../src/lib/wifi/include/crc32table.h | 1565 +++++ .../src/lib/wifi/include/extern_c_begin.h | 26 + .../src/lib/wifi/include/extern_c_end.h | 20 + .../src/lib/wifi/include/firmware_list.h | 26 + .../src/lib/wifi/include/linux/gen_stats.h | 1 + .../src/lib/wifi/include/linux/hdlc/ioctl.h | 1 + .../src/lib/wifi/include/linux/if_bridge.h | 1 + .../src/lib/wifi/include/linux/if_packet.h | 1 + .../src/lib/wifi/include/linux/neighbour.h | 1 + .../src/lib/wifi/include/linux/nl80211.h | 1 + .../src/lib/wifi/include/linux/sockios.h | 2 + repos/dde_linux/src/lib/wifi/include/list.h | 99 + .../dde_linux/src/lib/wifi/include/lx_emul.h | 5386 +++++++++++++++++ .../src/lib/wifi/include/nic/component.h | 214 + .../src/lib/wifi/include/nic/dispatch.h | 143 + .../src/lib/wifi/include/scheduler.h | 249 + .../wifi/include/x86_32/platform/platform.h | 27 + .../lib/wifi/include/x86_32/platform/types.h | 27 + .../wifi/include/x86_64/platform/platform.h | 29 + .../lib/wifi/include/x86_64/platform/types.h | 27 + repos/dde_linux/src/lib/wifi/init.cc | 157 + repos/dde_linux/src/lib/wifi/irq.cc | 340 ++ repos/dde_linux/src/lib/wifi/lx.h | 65 + repos/dde_linux/src/lib/wifi/lxc_emul.c | 128 + repos/dde_linux/src/lib/wifi/lxcc_emul.cc | 1751 ++++++ repos/dde_linux/src/lib/wifi/nic.cc | 585 ++ repos/dde_linux/src/lib/wifi/pci_driver.cc | 477 ++ repos/dde_linux/src/lib/wifi/scheduler.cc | 262 + repos/dde_linux/src/lib/wifi/socket.c | 110 + repos/dde_linux/src/lib/wifi/socket_call.cc | 634 ++ repos/dde_linux/src/lib/wifi/symbol.map | 20 + repos/dde_linux/src/lib/wifi/timer.cc | 347 ++ repos/dde_linux/src/lib/wifi/work.cc | 281 + .../src/lib/wpa_driver_nl80211/dummies.cc | 53 + .../wpa_driver_nl80211/include/lx_user_emul.h | 232 + .../lib/wpa_driver_nl80211/include/net/if.h | 1 + .../wpa_driver_nl80211/include/net/if_arp.h | 1 + .../include/netpacket/packet.h | 1 + .../src/lib/wpa_driver_nl80211/ioctl.cc | 100 + .../src/lib/wpa_driver_nl80211/symbol.map | 18 + repos/dde_linux/src/lib/wpa_supplicant/main.c | 43 + .../src/lib/wpa_supplicant/symbol.map | 23 + repos/dde_linux/wifi.list | 330 + 77 files changed, 17685 insertions(+), 4 deletions(-) create mode 100644 repos/dde_linux/include/wifi/socket_call.h create mode 100644 repos/dde_linux/lib/import/import-libnl.mk create mode 100644 repos/dde_linux/lib/mk/libnl.inc create mode 100644 repos/dde_linux/lib/mk/wifi.inc create mode 100644 repos/dde_linux/lib/mk/wpa_driver_nl80211.mk create mode 100644 repos/dde_linux/lib/mk/wpa_supplicant.mk create mode 100644 repos/dde_linux/lib/mk/x86_32/libnl.mk create mode 100644 repos/dde_linux/lib/mk/x86_32/wifi.mk create mode 100644 repos/dde_linux/lib/mk/x86_64/libnl.mk create mode 100644 repos/dde_linux/lib/mk/x86_64/wifi.mk create mode 100644 repos/dde_linux/patches/libnl.patch create mode 100644 repos/dde_linux/patches/wifi.patch create mode 100644 repos/dde_linux/patches/wifi_crypto.patch create mode 100644 repos/dde_linux/patches/wifi_mem.patch create mode 100644 repos/dde_linux/patches/wpa_supplicant.patch create mode 100644 repos/dde_linux/run/wifi.run create mode 100644 repos/dde_linux/src/drivers/wifi/main.cc create mode 100644 repos/dde_linux/src/drivers/wifi/target.mk create mode 100644 repos/dde_linux/src/drivers/wifi/wpa.h create mode 100644 repos/dde_linux/src/lib/libnl/if.cc create mode 100644 repos/dde_linux/src/lib/libnl/include/32bit/platform/types.h create mode 100644 repos/dde_linux/src/lib/libnl/include/64bit/platform/types.h create mode 100644 repos/dde_linux/src/lib/libnl/include/defs.h create mode 100644 repos/dde_linux/src/lib/libnl/include/endian.h create mode 100644 repos/dde_linux/src/lib/libnl/include/libnl_emul.h create mode 100644 repos/dde_linux/src/lib/libnl/include/linux/socket.h create mode 100644 repos/dde_linux/src/lib/libnl/include/linux/types.h create mode 100644 repos/dde_linux/src/lib/libnl/lxcc_emul.cc create mode 100644 repos/dde_linux/src/lib/libnl/socket.cc create mode 100644 repos/dde_linux/src/lib/wifi/dummies.cc create mode 100644 repos/dde_linux/src/lib/wifi/event.cc create mode 100644 repos/dde_linux/src/lib/wifi/include/crc32table.h create mode 100644 repos/dde_linux/src/lib/wifi/include/extern_c_begin.h create mode 100644 repos/dde_linux/src/lib/wifi/include/extern_c_end.h create mode 100644 repos/dde_linux/src/lib/wifi/include/firmware_list.h create mode 100644 repos/dde_linux/src/lib/wifi/include/linux/gen_stats.h create mode 100644 repos/dde_linux/src/lib/wifi/include/linux/hdlc/ioctl.h create mode 100644 repos/dde_linux/src/lib/wifi/include/linux/if_bridge.h create mode 100644 repos/dde_linux/src/lib/wifi/include/linux/if_packet.h create mode 100644 repos/dde_linux/src/lib/wifi/include/linux/neighbour.h create mode 100644 repos/dde_linux/src/lib/wifi/include/linux/nl80211.h create mode 100644 repos/dde_linux/src/lib/wifi/include/linux/sockios.h create mode 100644 repos/dde_linux/src/lib/wifi/include/list.h create mode 100644 repos/dde_linux/src/lib/wifi/include/lx_emul.h create mode 100644 repos/dde_linux/src/lib/wifi/include/nic/component.h create mode 100644 repos/dde_linux/src/lib/wifi/include/nic/dispatch.h create mode 100644 repos/dde_linux/src/lib/wifi/include/scheduler.h create mode 100644 repos/dde_linux/src/lib/wifi/include/x86_32/platform/platform.h create mode 100644 repos/dde_linux/src/lib/wifi/include/x86_32/platform/types.h create mode 100644 repos/dde_linux/src/lib/wifi/include/x86_64/platform/platform.h create mode 100644 repos/dde_linux/src/lib/wifi/include/x86_64/platform/types.h create mode 100644 repos/dde_linux/src/lib/wifi/init.cc create mode 100644 repos/dde_linux/src/lib/wifi/irq.cc create mode 100644 repos/dde_linux/src/lib/wifi/lx.h create mode 100644 repos/dde_linux/src/lib/wifi/lxc_emul.c create mode 100644 repos/dde_linux/src/lib/wifi/lxcc_emul.cc create mode 100644 repos/dde_linux/src/lib/wifi/nic.cc create mode 100644 repos/dde_linux/src/lib/wifi/pci_driver.cc create mode 100644 repos/dde_linux/src/lib/wifi/scheduler.cc create mode 100644 repos/dde_linux/src/lib/wifi/socket.c create mode 100644 repos/dde_linux/src/lib/wifi/socket_call.cc create mode 100644 repos/dde_linux/src/lib/wifi/symbol.map create mode 100644 repos/dde_linux/src/lib/wifi/timer.cc create mode 100644 repos/dde_linux/src/lib/wifi/work.cc create mode 100644 repos/dde_linux/src/lib/wpa_driver_nl80211/dummies.cc create mode 100644 repos/dde_linux/src/lib/wpa_driver_nl80211/include/lx_user_emul.h create mode 120000 repos/dde_linux/src/lib/wpa_driver_nl80211/include/net/if.h create mode 120000 repos/dde_linux/src/lib/wpa_driver_nl80211/include/net/if_arp.h create mode 120000 repos/dde_linux/src/lib/wpa_driver_nl80211/include/netpacket/packet.h create mode 100644 repos/dde_linux/src/lib/wpa_driver_nl80211/ioctl.cc create mode 100644 repos/dde_linux/src/lib/wpa_driver_nl80211/symbol.map create mode 100644 repos/dde_linux/src/lib/wpa_supplicant/main.c create mode 100644 repos/dde_linux/src/lib/wpa_supplicant/symbol.map create mode 100644 repos/dde_linux/wifi.list diff --git a/repos/dde_linux/README b/repos/dde_linux/README index 52c44fa9a..119bcb5a8 100644 --- a/repos/dde_linux/README +++ b/repos/dde_linux/README @@ -82,3 +82,38 @@ LXIP is a port of the Linux TCP/IP stack to Genode. It is build as a shared library named 'lxip.lib.so'. The IP stack can be interfaced using Genode's version of 'libc' by linking your application to 'lxip_libc' plugin in your 'target.mk' file. + +WIFI +#### + +The wifi_drv component is a port of the Linux mac802.11 stack, including the +iwlwifi driver as well as libnl and wpa_supplicant, to Genode. + +Configuration snippet: + +! +! +! +! +! +! +! +! +! +! +! +!network={ +! id_str="foobar" +! ssid="foobar" +! key_mgmt=WPA-PSK +! psk="foobarfoobar" +!} +! +! +! +! +! +! +! +! +!\"]*\)[>\"].*/\1/" |\ + sort | uniq) +# +# Filter out original Linux headers that exist in the contrib directory +# +NO_GEN_INCLUDES := $(shell cd $(WIFI_CONTRIB_DIR)/; find include -name "*.h" |\ + sed "s/.\///" | sed "s/.*include\///") +GEN_INCLUDES := $(filter-out $(NO_GEN_INCLUDES),$(GEN_INCLUDES)) + +# +# Put Linux headers in 'GEN_INC' dir, since some include use "../../" paths use +# three level include hierarchy +# +GEN_INC := $(shell pwd)/include/include/include + +$(shell mkdir -p $(GEN_INC)) + + +GEN_INCLUDES := $(addprefix $(GEN_INC)/,$(GEN_INCLUDES)) +INC_DIR += $(GEN_INC) + +# +# Make sure to create the header symlinks prior building +# +$(SRC_C:.c=.o) $(SRC_CC:.cc=.o): $(GEN_INCLUDES) + +$(GEN_INCLUDES): + $(VERBOSE)mkdir -p $(dir $@) + $(VERBOSE)ln -s $(LIB_INC_DIR)/lx_emul.h $@ + +vpath %.c $(DRIVERS_DIR) +vpath %.c $(WIFI_CONTRIB_DIR)/drivers/net/wireless/ +vpath %.c $(WIFI_DIR) +vpath %.c $(WIFI_CONTRIB_DIR) +vpath %.c $(LIB_DIR) +vpath %.cc $(LIB_DIR) +vpath %.cc $(LIB_DIR)/signal + +# vi: set ft=make : diff --git a/repos/dde_linux/lib/mk/wpa_driver_nl80211.mk b/repos/dde_linux/lib/mk/wpa_driver_nl80211.mk new file mode 100644 index 000000000..85aceb0ee --- /dev/null +++ b/repos/dde_linux/lib/mk/wpa_driver_nl80211.mk @@ -0,0 +1,32 @@ +LIB_DIR := $(REP_DIR)/src/lib/wpa_driver_nl80211 +LIB_INC_DIR := $(LIB_DIR)/include +INC_DIR += $(LIB_INC_DIR) + +LIBS += libc libnl + +SHARED_LIB = yes +LD_OPT += --version-script=$(LIB_DIR)/symbol.map + +SRC_CC += dummies.cc ioctl.cc + +WS_CONTRIB_DIR := $(call select_from_ports,dde_linux)/src/app/wpa_supplicant + +# l2_packet +SRC_C += src/l2_packet/l2_packet_linux.c +INC_DIR += $(WS_CONTRIB_DIR)/src/l2_packet + +# nl80211 driver +SRC_C_drivers = drivers.c \ + driver_nl80211.c \ + netlink.c \ + rfkill.c +SRC_C += $(addprefix src/drivers/, $(SRC_C_drivers)) +INC_DIR += $(WS_CONTRIB_DIR)/src/drivers \ + $(WS_CONTRIB_DIR)/src/utils \ + $(WS_CONTRIB_DIR)/src + +CC_OPT += -DCONFIG_DRIVER_NL80211 +CC_OPT += -DCONFIG_LIBNL20 + +vpath %.c $(WS_CONTRIB_DIR) +vpath %.cc $(LIB_DIR) diff --git a/repos/dde_linux/lib/mk/wpa_supplicant.mk b/repos/dde_linux/lib/mk/wpa_supplicant.mk new file mode 100644 index 000000000..7baf4d361 --- /dev/null +++ b/repos/dde_linux/lib/mk/wpa_supplicant.mk @@ -0,0 +1,106 @@ +WS_CONTRIB_DIR := $(call select_from_ports,dde_linux)/src/app/wpa_supplicant +WS_DIR := $(REP_DIR)/src/lib/wpa_supplicant + +LIBS += libc libcrypto libssl wpa_driver_nl80211 vfs_jitterentropy + +SHARED_LIB = yes +LD_OPT += --version-script=$(WS_DIR)/symbol.map + +CC_OPT += -Wno-unused-function + +CC_CXX_OPT += -fpermissive + +SRC_C += main.c + +# wpa_supplicant +SRC_C_wpa_supplicant = blacklist.c \ + bss.c \ + config.c \ + config_file.c \ + eap_register.c \ + events.c \ + notify.c \ + scan.c \ + sme.c \ + wpa_supplicant.c \ + wpas_glue.c +SRC_C += $(addprefix wpa_supplicant/, $(SRC_C_wpa_supplicant)) +INC_DIR += $(WS_CONTRIB_DIR)/wpa_supplicant +CC_OPT += -DCONFIG_BACKEND_FILE -DCONFIG_NO_CONFIG_WRITE \ + -DCONFIG_SME + +INC_DIR += $(WS_CONTRIB_DIR)/src/ + +# common +SRC_C_common = ieee802_11_common.c wpa_common.c +SRC_C += $(addprefix src/common/, $(SRC_C_common)) +INC_DIR += $(WS_CONTRIB_DIR)/src/common + +# crypto +SRC_C_crypto = aes-unwrap.c \ + crypto_openssl.c \ + md5.c \ + ms_funcs.c \ + random.c \ + sha1-prf.c \ + sha1-tlsprf.c \ + tls_openssl.c +SRC_C += $(addprefix src/crypto/, $(SRC_C_crypto)) +INC_DIR += $(WS_CONTRIB_DIR)/src/crypto + +SRC_C += src/drivers/driver_common.c + +# eap_common +SRC_C_eap_common = chap.c \ + eap_common.c \ + eap_peap_common.c +SRC_C += $(addprefix src/eap_common/, $(SRC_C_eap_common)) +INC_DIR += $(WS_CONTRIB_DIR)/src/eap_common + +# eap_peer +SRC_C_eap_peer = eap.c \ + eap_gtc.c \ + eap_leap.c \ + eap_md5.c \ + eap_methods.c \ + eap_mschapv2.c \ + eap_otp.c \ + eap_peap.c \ + eap_tls.c \ + eap_tls_common.c \ + eap_ttls.c \ + mschapv2.c +SRC_C += $(addprefix src/eap_peer/, $(SRC_C_eap_peer)) +INC_DIR += $(WS_CONTRIB_DIR)/src/eap_peer +CC_OPT += -DEAP_TLS -DEAP_PEAP -DEAP_TTLS -DEAP_MD5 -DEAP_MSCHAPv2 \ + -DEAP_OTP -DEAP_LEAP + +# eapol_supp +SRC_C += src/eapol_supp/eapol_supp_sm.c +INC_DIR += $(WS_CONTRIB_DIR)/src/eapol_supp +CC_OPT += -DIEEE8021X_EAPOL + +# rsn_supp +SRC_C_rsn_supp = peerkey.c \ + pmksa_cache.c \ + preauth.c \ + wpa.c \ + wpa_ie.c +SRC_C += $(addprefix src/rsn_supp/, $(SRC_C_rsn_supp)) +INC_DIR += $(WS_CONTRIB_DIR)/src/rsn_supp +CC_OPT += -DCONFIG_PEERKEY + +# utils +SRC_C_utils = base64.c \ + common.c \ + eloop.c \ + os_unix.c \ + radiotap.c \ + wpa_debug.c \ + wpabuf.c +SRC_C += $(addprefix src/utils/, $(SRC_C_utils)) +INC_DIR += $(WS_CONTRIB_DIR)/src/utils +CC_OPT += -DCONFIG_ELOOP_POLL + +vpath %.c $(WS_CONTRIB_DIR) +vpath %.c $(WS_DIR) diff --git a/repos/dde_linux/lib/mk/x86_32/libnl.mk b/repos/dde_linux/lib/mk/x86_32/libnl.mk new file mode 100644 index 000000000..a9d76c745 --- /dev/null +++ b/repos/dde_linux/lib/mk/x86_32/libnl.mk @@ -0,0 +1,3 @@ +include $(REP_DIR)/lib/mk/libnl.inc + +INC_DIR += $(LIB_INC_DIR)/32bit $(LIB_INC_DIR)/x86_32 $(LIB_INC_DIR)/x86 diff --git a/repos/dde_linux/lib/mk/x86_32/wifi.mk b/repos/dde_linux/lib/mk/x86_32/wifi.mk new file mode 100644 index 000000000..f29dffba1 --- /dev/null +++ b/repos/dde_linux/lib/mk/x86_32/wifi.mk @@ -0,0 +1,3 @@ +include $(REP_DIR)/lib/mk/wifi.inc + +INC_DIR += $(LIB_INC_DIR)/32bit $(LIB_INC_DIR)/x86_32 $(LIB_INC_DIR)/x86 diff --git a/repos/dde_linux/lib/mk/x86_64/libnl.mk b/repos/dde_linux/lib/mk/x86_64/libnl.mk new file mode 100644 index 000000000..1ebd1d1cd --- /dev/null +++ b/repos/dde_linux/lib/mk/x86_64/libnl.mk @@ -0,0 +1,3 @@ +include $(REP_DIR)/lib/mk/libnl.inc + +INC_DIR += $(LIB_INC_DIR)/64bit $(LIB_INC_DIR)/x86_64 $(LIB_INC_DIR)/x86 diff --git a/repos/dde_linux/lib/mk/x86_64/wifi.mk b/repos/dde_linux/lib/mk/x86_64/wifi.mk new file mode 100644 index 000000000..9b6c1c5a9 --- /dev/null +++ b/repos/dde_linux/lib/mk/x86_64/wifi.mk @@ -0,0 +1,3 @@ +include $(REP_DIR)/lib/mk/wifi.inc + +INC_DIR += $(LIB_INC_DIR)/64bit $(LIB_INC_DIR)/x86_64 $(LIB_INC_DIR)/x86 diff --git a/repos/dde_linux/patches/libnl.patch b/repos/dde_linux/patches/libnl.patch new file mode 100644 index 000000000..207cf6f23 --- /dev/null +++ b/repos/dde_linux/patches/libnl.patch @@ -0,0 +1,52 @@ + include/netlink-private/netlink.h | 1 + + lib/handlers.c | 4 ++-- + lib/msg.c | 4 ++-- + 3 files changed, 5 insertions(+), 4 deletions(-) + +--- a/include/netlink-private/netlink.h ++++ b/include/netlink-private/netlink.h +@@ -100,6 +100,7 @@ struct trans_list { + fprintf(stderr, "BUG at file position %s:%d:%s\n", \ + __FILE__, __LINE__, __PRETTY_FUNCTION__); \ + assert(0); \ ++ while (7); \ + } while (0) + + #define BUG_ON(condition) \ +--- a/lib/handlers.c ++++ b/lib/handlers.c +@@ -81,8 +81,8 @@ static int nl_error_handler_verbose(struct sockaddr_nl *who, + FILE *ofd = arg ? arg : stderr; + char buf[256]; + +- fprintf(ofd, "-- Error received: %s\n-- Original message: ", +- strerror_r(-e->error, buf, sizeof(buf))); ++ strerror_r(-e->error, buf, sizeof(buf)); ++ fprintf(ofd, "-- Error received: %s\n-- Original message: ", buf); + print_header_content(ofd, &e->msg); + fprintf(ofd, "\n"); + +--- a/lib/msg.c ++++ b/lib/msg.c +@@ -916,8 +916,8 @@ static void dump_error_msg(struct nl_msg *msg, FILE *ofd) + char buf[256]; + struct nl_msg *errmsg; + +- fprintf(ofd, " .error = %d \"%s\"\n", err->error, +- strerror_r(-err->error, buf, sizeof(buf))); ++ strerror_r(-err->error, buf, sizeof(buf)); ++ fprintf(ofd, " .error = %d \"%s\"\n", err->error, buf); + fprintf(ofd, " [ORIGINAL MESSAGE] %zu octets\n", sizeof(*hdr)); + + errmsg = nlmsg_inherit(&err->msg); +--- a/include/netlink/netlink-compat.h ++++ b/include/netlink/netlink-compat.h +@@ -13,7 +13,7 @@ + #define NETLINK_COMPAT_H_ + + #if !defined _LINUX_SOCKET_H && !defined _BITS_SOCKADDR_H +-typedef unsigned short sa_family_t; ++//typedef unsigned short sa_family_t; + #endif + + #ifndef IFNAMSIZ diff --git a/repos/dde_linux/patches/wifi.patch b/repos/dde_linux/patches/wifi.patch new file mode 100644 index 000000000..66914089f --- /dev/null +++ b/repos/dde_linux/patches/wifi.patch @@ -0,0 +1,883 @@ + drivers/net/wireless/iwlwifi/iwl-debug.c | 18 +- + drivers/net/wireless/iwlwifi/mvm/mvm.h | 2 +- + drivers/net/wireless/iwlwifi/pcie/drv.c | 628 ++++++++++++++++--------------- + net/core/sock.c | 2 + + net/packet/af_packet.c | 6 + + net/wireless/core.h | 2 +- + net/wireless/sysfs.c | 2 +- + wifi/include/linux/ieee80211.h | 2 +- + wifi/include/net/cfg80211.h | 5 +- + wifi/include/net/netlink.h | 8 +- + wifi/include/net/sock.h | 4 +- + 11 files changed, 349 insertions(+), 330 deletions(-) + +--- a/drivers/net/wireless/iwlwifi/iwl-debug.c ++++ b/drivers/net/wireless/iwlwifi/iwl-debug.c +@@ -80,7 +80,9 @@ void __iwl_ ##fn(struct device *dev, const char *fmt, ...) \ + \ + va_start(args, fmt); \ + vaf.va = &args; \ +- dev_ ##fn(dev, "%pV", &vaf); \ ++ char buf[256]; \ ++ vsnprintf(buf, sizeof(buf), vaf.fmt, *vaf.va); \ ++ dev_ ##fn(dev, "%s", buf); \ + trace_iwlwifi_ ##fn(&vaf); \ + va_end(args); \ + } +@@ -103,10 +105,12 @@ void __iwl_err(struct device *dev, bool rfkill_prefix, bool trace_only, + va_start(args, fmt); + vaf.va = &args; + if (!trace_only) { ++ char buf[256]; ++ vsnprintf(buf, sizeof(buf), vaf.fmt, *vaf.va); + if (rfkill_prefix) +- dev_err(dev, "(RFKILL) %pV", &vaf); ++ dev_err(dev, "(RFKILL) %s", buf); + else +- dev_err(dev, "%pV", &vaf); ++ dev_err(dev, "%s", buf); + } + trace_iwlwifi_err(&vaf); + va_end(args); +@@ -127,9 +131,11 @@ void __iwl_dbg(struct device *dev, + vaf.va = &args; + #ifdef CONFIG_IWLWIFI_DEBUG + if (iwl_have_debug_level(level) && +- (!limit || net_ratelimit())) +- dev_dbg(dev, "%c %s %pV", in_interrupt() ? 'I' : 'U', +- function, &vaf); ++ (!limit || net_ratelimit())) { ++ char buf[256]; ++ vsnprintf(buf, sizeof(buf), vaf.fmt, *vaf.va); ++ dev_dbg(dev, "%c %s %s", in_interrupt() ? 'I' : 'U', function, buf); ++ } + #endif + trace_iwlwifi_dbg(level, in_interrupt(), function, &vaf); + va_end(args); +--- a/drivers/net/wireless/iwlwifi/mvm/mvm.h ++++ b/drivers/net/wireless/iwlwifi/mvm/mvm.h +@@ -64,7 +64,7 @@ + #ifndef __IWL_MVM_H__ + #define __IWL_MVM_H__ + +-#include ++/* #include */ + #include + #include + #include +--- a/drivers/net/wireless/iwlwifi/pcie/drv.c ++++ b/drivers/net/wireless/iwlwifi/pcie/drv.c +@@ -78,318 +78,322 @@ + + /* Hardware specific file defines the PCI IDs table for that hardware module */ + static DEFINE_PCI_DEVICE_TABLE(iwl_hw_card_ids) = { +-#if IS_ENABLED(CONFIG_IWLDVM) +- {IWL_PCI_DEVICE(0x4232, 0x1201, iwl5100_agn_cfg)}, /* Mini Card */ +- {IWL_PCI_DEVICE(0x4232, 0x1301, iwl5100_agn_cfg)}, /* Half Mini Card */ +- {IWL_PCI_DEVICE(0x4232, 0x1204, iwl5100_agn_cfg)}, /* Mini Card */ +- {IWL_PCI_DEVICE(0x4232, 0x1304, iwl5100_agn_cfg)}, /* Half Mini Card */ +- {IWL_PCI_DEVICE(0x4232, 0x1205, iwl5100_bgn_cfg)}, /* Mini Card */ +- {IWL_PCI_DEVICE(0x4232, 0x1305, iwl5100_bgn_cfg)}, /* Half Mini Card */ +- {IWL_PCI_DEVICE(0x4232, 0x1206, iwl5100_abg_cfg)}, /* Mini Card */ +- {IWL_PCI_DEVICE(0x4232, 0x1306, iwl5100_abg_cfg)}, /* Half Mini Card */ +- {IWL_PCI_DEVICE(0x4232, 0x1221, iwl5100_agn_cfg)}, /* Mini Card */ +- {IWL_PCI_DEVICE(0x4232, 0x1321, iwl5100_agn_cfg)}, /* Half Mini Card */ +- {IWL_PCI_DEVICE(0x4232, 0x1224, iwl5100_agn_cfg)}, /* Mini Card */ +- {IWL_PCI_DEVICE(0x4232, 0x1324, iwl5100_agn_cfg)}, /* Half Mini Card */ +- {IWL_PCI_DEVICE(0x4232, 0x1225, iwl5100_bgn_cfg)}, /* Mini Card */ +- {IWL_PCI_DEVICE(0x4232, 0x1325, iwl5100_bgn_cfg)}, /* Half Mini Card */ +- {IWL_PCI_DEVICE(0x4232, 0x1226, iwl5100_abg_cfg)}, /* Mini Card */ +- {IWL_PCI_DEVICE(0x4232, 0x1326, iwl5100_abg_cfg)}, /* Half Mini Card */ +- {IWL_PCI_DEVICE(0x4237, 0x1211, iwl5100_agn_cfg)}, /* Mini Card */ +- {IWL_PCI_DEVICE(0x4237, 0x1311, iwl5100_agn_cfg)}, /* Half Mini Card */ +- {IWL_PCI_DEVICE(0x4237, 0x1214, iwl5100_agn_cfg)}, /* Mini Card */ +- {IWL_PCI_DEVICE(0x4237, 0x1314, iwl5100_agn_cfg)}, /* Half Mini Card */ +- {IWL_PCI_DEVICE(0x4237, 0x1215, iwl5100_bgn_cfg)}, /* Mini Card */ +- {IWL_PCI_DEVICE(0x4237, 0x1315, iwl5100_bgn_cfg)}, /* Half Mini Card */ +- {IWL_PCI_DEVICE(0x4237, 0x1216, iwl5100_abg_cfg)}, /* Mini Card */ +- {IWL_PCI_DEVICE(0x4237, 0x1316, iwl5100_abg_cfg)}, /* Half Mini Card */ +- +-/* 5300 Series WiFi */ +- {IWL_PCI_DEVICE(0x4235, 0x1021, iwl5300_agn_cfg)}, /* Mini Card */ +- {IWL_PCI_DEVICE(0x4235, 0x1121, iwl5300_agn_cfg)}, /* Half Mini Card */ +- {IWL_PCI_DEVICE(0x4235, 0x1024, iwl5300_agn_cfg)}, /* Mini Card */ +- {IWL_PCI_DEVICE(0x4235, 0x1124, iwl5300_agn_cfg)}, /* Half Mini Card */ +- {IWL_PCI_DEVICE(0x4235, 0x1001, iwl5300_agn_cfg)}, /* Mini Card */ +- {IWL_PCI_DEVICE(0x4235, 0x1101, iwl5300_agn_cfg)}, /* Half Mini Card */ +- {IWL_PCI_DEVICE(0x4235, 0x1004, iwl5300_agn_cfg)}, /* Mini Card */ +- {IWL_PCI_DEVICE(0x4235, 0x1104, iwl5300_agn_cfg)}, /* Half Mini Card */ +- {IWL_PCI_DEVICE(0x4236, 0x1011, iwl5300_agn_cfg)}, /* Mini Card */ +- {IWL_PCI_DEVICE(0x4236, 0x1111, iwl5300_agn_cfg)}, /* Half Mini Card */ +- {IWL_PCI_DEVICE(0x4236, 0x1014, iwl5300_agn_cfg)}, /* Mini Card */ +- {IWL_PCI_DEVICE(0x4236, 0x1114, iwl5300_agn_cfg)}, /* Half Mini Card */ +- +-/* 5350 Series WiFi/WiMax */ +- {IWL_PCI_DEVICE(0x423A, 0x1001, iwl5350_agn_cfg)}, /* Mini Card */ +- {IWL_PCI_DEVICE(0x423A, 0x1021, iwl5350_agn_cfg)}, /* Mini Card */ +- {IWL_PCI_DEVICE(0x423B, 0x1011, iwl5350_agn_cfg)}, /* Mini Card */ +- +-/* 5150 Series Wifi/WiMax */ +- {IWL_PCI_DEVICE(0x423C, 0x1201, iwl5150_agn_cfg)}, /* Mini Card */ +- {IWL_PCI_DEVICE(0x423C, 0x1301, iwl5150_agn_cfg)}, /* Half Mini Card */ +- {IWL_PCI_DEVICE(0x423C, 0x1206, iwl5150_abg_cfg)}, /* Mini Card */ +- {IWL_PCI_DEVICE(0x423C, 0x1306, iwl5150_abg_cfg)}, /* Half Mini Card */ +- {IWL_PCI_DEVICE(0x423C, 0x1221, iwl5150_agn_cfg)}, /* Mini Card */ +- {IWL_PCI_DEVICE(0x423C, 0x1321, iwl5150_agn_cfg)}, /* Half Mini Card */ +- {IWL_PCI_DEVICE(0x423C, 0x1326, iwl5150_abg_cfg)}, /* Half Mini Card */ +- +- {IWL_PCI_DEVICE(0x423D, 0x1211, iwl5150_agn_cfg)}, /* Mini Card */ +- {IWL_PCI_DEVICE(0x423D, 0x1311, iwl5150_agn_cfg)}, /* Half Mini Card */ +- {IWL_PCI_DEVICE(0x423D, 0x1216, iwl5150_abg_cfg)}, /* Mini Card */ +- {IWL_PCI_DEVICE(0x423D, 0x1316, iwl5150_abg_cfg)}, /* Half Mini Card */ +- +-/* 6x00 Series */ +- {IWL_PCI_DEVICE(0x422B, 0x1101, iwl6000_3agn_cfg)}, +- {IWL_PCI_DEVICE(0x422B, 0x1108, iwl6000_3agn_cfg)}, +- {IWL_PCI_DEVICE(0x422B, 0x1121, iwl6000_3agn_cfg)}, +- {IWL_PCI_DEVICE(0x422B, 0x1128, iwl6000_3agn_cfg)}, +- {IWL_PCI_DEVICE(0x422C, 0x1301, iwl6000i_2agn_cfg)}, +- {IWL_PCI_DEVICE(0x422C, 0x1306, iwl6000i_2abg_cfg)}, +- {IWL_PCI_DEVICE(0x422C, 0x1307, iwl6000i_2bg_cfg)}, +- {IWL_PCI_DEVICE(0x422C, 0x1321, iwl6000i_2agn_cfg)}, +- {IWL_PCI_DEVICE(0x422C, 0x1326, iwl6000i_2abg_cfg)}, +- {IWL_PCI_DEVICE(0x4238, 0x1111, iwl6000_3agn_cfg)}, +- {IWL_PCI_DEVICE(0x4238, 0x1118, iwl6000_3agn_cfg)}, +- {IWL_PCI_DEVICE(0x4239, 0x1311, iwl6000i_2agn_cfg)}, +- {IWL_PCI_DEVICE(0x4239, 0x1316, iwl6000i_2abg_cfg)}, +- +-/* 6x05 Series */ +- {IWL_PCI_DEVICE(0x0082, 0x1301, iwl6005_2agn_cfg)}, +- {IWL_PCI_DEVICE(0x0082, 0x1306, iwl6005_2abg_cfg)}, +- {IWL_PCI_DEVICE(0x0082, 0x1307, iwl6005_2bg_cfg)}, +- {IWL_PCI_DEVICE(0x0082, 0x1308, iwl6005_2agn_cfg)}, +- {IWL_PCI_DEVICE(0x0082, 0x1321, iwl6005_2agn_cfg)}, +- {IWL_PCI_DEVICE(0x0082, 0x1326, iwl6005_2abg_cfg)}, +- {IWL_PCI_DEVICE(0x0082, 0x1328, iwl6005_2agn_cfg)}, +- {IWL_PCI_DEVICE(0x0085, 0x1311, iwl6005_2agn_cfg)}, +- {IWL_PCI_DEVICE(0x0085, 0x1318, iwl6005_2agn_cfg)}, +- {IWL_PCI_DEVICE(0x0085, 0x1316, iwl6005_2abg_cfg)}, +- {IWL_PCI_DEVICE(0x0082, 0xC020, iwl6005_2agn_sff_cfg)}, +- {IWL_PCI_DEVICE(0x0085, 0xC220, iwl6005_2agn_sff_cfg)}, +- {IWL_PCI_DEVICE(0x0085, 0xC228, iwl6005_2agn_sff_cfg)}, +- {IWL_PCI_DEVICE(0x0082, 0x4820, iwl6005_2agn_d_cfg)}, +- {IWL_PCI_DEVICE(0x0082, 0x1304, iwl6005_2agn_mow1_cfg)},/* low 5GHz active */ +- {IWL_PCI_DEVICE(0x0082, 0x1305, iwl6005_2agn_mow2_cfg)},/* high 5GHz active */ +- +-/* 6x30 Series */ +- {IWL_PCI_DEVICE(0x008A, 0x5305, iwl1030_bgn_cfg)}, +- {IWL_PCI_DEVICE(0x008A, 0x5307, iwl1030_bg_cfg)}, +- {IWL_PCI_DEVICE(0x008A, 0x5325, iwl1030_bgn_cfg)}, +- {IWL_PCI_DEVICE(0x008A, 0x5327, iwl1030_bg_cfg)}, +- {IWL_PCI_DEVICE(0x008B, 0x5315, iwl1030_bgn_cfg)}, +- {IWL_PCI_DEVICE(0x008B, 0x5317, iwl1030_bg_cfg)}, +- {IWL_PCI_DEVICE(0x0090, 0x5211, iwl6030_2agn_cfg)}, +- {IWL_PCI_DEVICE(0x0090, 0x5215, iwl6030_2bgn_cfg)}, +- {IWL_PCI_DEVICE(0x0090, 0x5216, iwl6030_2abg_cfg)}, +- {IWL_PCI_DEVICE(0x0091, 0x5201, iwl6030_2agn_cfg)}, +- {IWL_PCI_DEVICE(0x0091, 0x5205, iwl6030_2bgn_cfg)}, +- {IWL_PCI_DEVICE(0x0091, 0x5206, iwl6030_2abg_cfg)}, +- {IWL_PCI_DEVICE(0x0091, 0x5207, iwl6030_2bg_cfg)}, +- {IWL_PCI_DEVICE(0x0091, 0x5221, iwl6030_2agn_cfg)}, +- {IWL_PCI_DEVICE(0x0091, 0x5225, iwl6030_2bgn_cfg)}, +- {IWL_PCI_DEVICE(0x0091, 0x5226, iwl6030_2abg_cfg)}, +- +-/* 6x50 WiFi/WiMax Series */ +- {IWL_PCI_DEVICE(0x0087, 0x1301, iwl6050_2agn_cfg)}, +- {IWL_PCI_DEVICE(0x0087, 0x1306, iwl6050_2abg_cfg)}, +- {IWL_PCI_DEVICE(0x0087, 0x1321, iwl6050_2agn_cfg)}, +- {IWL_PCI_DEVICE(0x0087, 0x1326, iwl6050_2abg_cfg)}, +- {IWL_PCI_DEVICE(0x0089, 0x1311, iwl6050_2agn_cfg)}, +- {IWL_PCI_DEVICE(0x0089, 0x1316, iwl6050_2abg_cfg)}, +- +-/* 6150 WiFi/WiMax Series */ +- {IWL_PCI_DEVICE(0x0885, 0x1305, iwl6150_bgn_cfg)}, +- {IWL_PCI_DEVICE(0x0885, 0x1307, iwl6150_bg_cfg)}, +- {IWL_PCI_DEVICE(0x0885, 0x1325, iwl6150_bgn_cfg)}, +- {IWL_PCI_DEVICE(0x0885, 0x1327, iwl6150_bg_cfg)}, +- {IWL_PCI_DEVICE(0x0886, 0x1315, iwl6150_bgn_cfg)}, +- {IWL_PCI_DEVICE(0x0886, 0x1317, iwl6150_bg_cfg)}, +- +-/* 1000 Series WiFi */ +- {IWL_PCI_DEVICE(0x0083, 0x1205, iwl1000_bgn_cfg)}, +- {IWL_PCI_DEVICE(0x0083, 0x1305, iwl1000_bgn_cfg)}, +- {IWL_PCI_DEVICE(0x0083, 0x1225, iwl1000_bgn_cfg)}, +- {IWL_PCI_DEVICE(0x0083, 0x1325, iwl1000_bgn_cfg)}, +- {IWL_PCI_DEVICE(0x0084, 0x1215, iwl1000_bgn_cfg)}, +- {IWL_PCI_DEVICE(0x0084, 0x1315, iwl1000_bgn_cfg)}, +- {IWL_PCI_DEVICE(0x0083, 0x1206, iwl1000_bg_cfg)}, +- {IWL_PCI_DEVICE(0x0083, 0x1306, iwl1000_bg_cfg)}, +- {IWL_PCI_DEVICE(0x0083, 0x1226, iwl1000_bg_cfg)}, +- {IWL_PCI_DEVICE(0x0083, 0x1326, iwl1000_bg_cfg)}, +- {IWL_PCI_DEVICE(0x0084, 0x1216, iwl1000_bg_cfg)}, +- {IWL_PCI_DEVICE(0x0084, 0x1316, iwl1000_bg_cfg)}, +- +-/* 100 Series WiFi */ +- {IWL_PCI_DEVICE(0x08AE, 0x1005, iwl100_bgn_cfg)}, +- {IWL_PCI_DEVICE(0x08AE, 0x1007, iwl100_bg_cfg)}, +- {IWL_PCI_DEVICE(0x08AF, 0x1015, iwl100_bgn_cfg)}, +- {IWL_PCI_DEVICE(0x08AF, 0x1017, iwl100_bg_cfg)}, +- {IWL_PCI_DEVICE(0x08AE, 0x1025, iwl100_bgn_cfg)}, +- {IWL_PCI_DEVICE(0x08AE, 0x1027, iwl100_bg_cfg)}, +- +-/* 130 Series WiFi */ +- {IWL_PCI_DEVICE(0x0896, 0x5005, iwl130_bgn_cfg)}, +- {IWL_PCI_DEVICE(0x0896, 0x5007, iwl130_bg_cfg)}, +- {IWL_PCI_DEVICE(0x0897, 0x5015, iwl130_bgn_cfg)}, +- {IWL_PCI_DEVICE(0x0897, 0x5017, iwl130_bg_cfg)}, +- {IWL_PCI_DEVICE(0x0896, 0x5025, iwl130_bgn_cfg)}, +- {IWL_PCI_DEVICE(0x0896, 0x5027, iwl130_bg_cfg)}, +- +-/* 2x00 Series */ +- {IWL_PCI_DEVICE(0x0890, 0x4022, iwl2000_2bgn_cfg)}, +- {IWL_PCI_DEVICE(0x0891, 0x4222, iwl2000_2bgn_cfg)}, +- {IWL_PCI_DEVICE(0x0890, 0x4422, iwl2000_2bgn_cfg)}, +- {IWL_PCI_DEVICE(0x0890, 0x4822, iwl2000_2bgn_d_cfg)}, +- +-/* 2x30 Series */ +- {IWL_PCI_DEVICE(0x0887, 0x4062, iwl2030_2bgn_cfg)}, +- {IWL_PCI_DEVICE(0x0888, 0x4262, iwl2030_2bgn_cfg)}, +- {IWL_PCI_DEVICE(0x0887, 0x4462, iwl2030_2bgn_cfg)}, +- +-/* 6x35 Series */ +- {IWL_PCI_DEVICE(0x088E, 0x4060, iwl6035_2agn_cfg)}, +- {IWL_PCI_DEVICE(0x088E, 0x406A, iwl6035_2agn_sff_cfg)}, +- {IWL_PCI_DEVICE(0x088F, 0x4260, iwl6035_2agn_cfg)}, +- {IWL_PCI_DEVICE(0x088F, 0x426A, iwl6035_2agn_sff_cfg)}, +- {IWL_PCI_DEVICE(0x088E, 0x4460, iwl6035_2agn_cfg)}, +- {IWL_PCI_DEVICE(0x088E, 0x446A, iwl6035_2agn_sff_cfg)}, +- {IWL_PCI_DEVICE(0x088E, 0x4860, iwl6035_2agn_cfg)}, +- {IWL_PCI_DEVICE(0x088F, 0x5260, iwl6035_2agn_cfg)}, +- +-/* 105 Series */ +- {IWL_PCI_DEVICE(0x0894, 0x0022, iwl105_bgn_cfg)}, +- {IWL_PCI_DEVICE(0x0895, 0x0222, iwl105_bgn_cfg)}, +- {IWL_PCI_DEVICE(0x0894, 0x0422, iwl105_bgn_cfg)}, +- {IWL_PCI_DEVICE(0x0894, 0x0822, iwl105_bgn_d_cfg)}, +- +-/* 135 Series */ +- {IWL_PCI_DEVICE(0x0892, 0x0062, iwl135_bgn_cfg)}, +- {IWL_PCI_DEVICE(0x0893, 0x0262, iwl135_bgn_cfg)}, +- {IWL_PCI_DEVICE(0x0892, 0x0462, iwl135_bgn_cfg)}, +-#endif /* CONFIG_IWLDVM */ +- +-#if IS_ENABLED(CONFIG_IWLMVM) +-/* 7260 Series */ +- {IWL_PCI_DEVICE(0x08B1, 0x4070, iwl7260_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x08B1, 0x4072, iwl7260_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x08B1, 0x4170, iwl7260_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x08B1, 0x4060, iwl7260_2n_cfg)}, +- {IWL_PCI_DEVICE(0x08B1, 0x406A, iwl7260_2n_cfg)}, +- {IWL_PCI_DEVICE(0x08B1, 0x4160, iwl7260_2n_cfg)}, +- {IWL_PCI_DEVICE(0x08B1, 0x4062, iwl7260_n_cfg)}, +- {IWL_PCI_DEVICE(0x08B1, 0x4162, iwl7260_n_cfg)}, +- {IWL_PCI_DEVICE(0x08B2, 0x4270, iwl7260_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x08B2, 0x4272, iwl7260_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x08B2, 0x4260, iwl7260_2n_cfg)}, +- {IWL_PCI_DEVICE(0x08B2, 0x426A, iwl7260_2n_cfg)}, +- {IWL_PCI_DEVICE(0x08B2, 0x4262, iwl7260_n_cfg)}, +- {IWL_PCI_DEVICE(0x08B1, 0x4470, iwl7260_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x08B1, 0x4472, iwl7260_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x08B1, 0x4460, iwl7260_2n_cfg)}, +- {IWL_PCI_DEVICE(0x08B1, 0x446A, iwl7260_2n_cfg)}, +- {IWL_PCI_DEVICE(0x08B1, 0x4462, iwl7260_n_cfg)}, +- {IWL_PCI_DEVICE(0x08B1, 0x4870, iwl7260_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x08B1, 0x486E, iwl7260_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x08B1, 0x4A70, iwl7260_2ac_cfg_high_temp)}, +- {IWL_PCI_DEVICE(0x08B1, 0x4A6E, iwl7260_2ac_cfg_high_temp)}, +- {IWL_PCI_DEVICE(0x08B1, 0x4A6C, iwl7260_2ac_cfg_high_temp)}, +- {IWL_PCI_DEVICE(0x08B1, 0x4570, iwl7260_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x08B1, 0x4560, iwl7260_2n_cfg)}, +- {IWL_PCI_DEVICE(0x08B2, 0x4370, iwl7260_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x08B2, 0x4360, iwl7260_2n_cfg)}, +- {IWL_PCI_DEVICE(0x08B1, 0x5070, iwl7260_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x08B1, 0x5072, iwl7260_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x08B1, 0x5170, iwl7260_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x08B1, 0x5770, iwl7260_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x08B1, 0x4020, iwl7260_2n_cfg)}, +- {IWL_PCI_DEVICE(0x08B1, 0x402A, iwl7260_2n_cfg)}, +- {IWL_PCI_DEVICE(0x08B2, 0x4220, iwl7260_2n_cfg)}, +- {IWL_PCI_DEVICE(0x08B1, 0x4420, iwl7260_2n_cfg)}, +- {IWL_PCI_DEVICE(0x08B1, 0xC070, iwl7260_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x08B1, 0xC072, iwl7260_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x08B1, 0xC170, iwl7260_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x08B1, 0xC060, iwl7260_2n_cfg)}, +- {IWL_PCI_DEVICE(0x08B1, 0xC06A, iwl7260_2n_cfg)}, +- {IWL_PCI_DEVICE(0x08B1, 0xC160, iwl7260_2n_cfg)}, +- {IWL_PCI_DEVICE(0x08B1, 0xC062, iwl7260_n_cfg)}, +- {IWL_PCI_DEVICE(0x08B1, 0xC162, iwl7260_n_cfg)}, +- {IWL_PCI_DEVICE(0x08B1, 0xC770, iwl7260_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x08B1, 0xC760, iwl7260_2n_cfg)}, +- {IWL_PCI_DEVICE(0x08B2, 0xC270, iwl7260_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x08B2, 0xC272, iwl7260_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x08B2, 0xC260, iwl7260_2n_cfg)}, +- {IWL_PCI_DEVICE(0x08B2, 0xC26A, iwl7260_n_cfg)}, +- {IWL_PCI_DEVICE(0x08B2, 0xC262, iwl7260_n_cfg)}, +- {IWL_PCI_DEVICE(0x08B1, 0xC470, iwl7260_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x08B1, 0xC472, iwl7260_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x08B1, 0xC460, iwl7260_2n_cfg)}, +- {IWL_PCI_DEVICE(0x08B1, 0xC462, iwl7260_n_cfg)}, +- {IWL_PCI_DEVICE(0x08B1, 0xC570, iwl7260_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x08B1, 0xC560, iwl7260_2n_cfg)}, +- {IWL_PCI_DEVICE(0x08B2, 0xC370, iwl7260_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x08B1, 0xC360, iwl7260_2n_cfg)}, +- {IWL_PCI_DEVICE(0x08B1, 0xC020, iwl7260_2n_cfg)}, +- {IWL_PCI_DEVICE(0x08B1, 0xC02A, iwl7260_2n_cfg)}, +- {IWL_PCI_DEVICE(0x08B2, 0xC220, iwl7260_2n_cfg)}, +- {IWL_PCI_DEVICE(0x08B1, 0xC420, iwl7260_2n_cfg)}, +- +-/* 3160 Series */ +- {IWL_PCI_DEVICE(0x08B3, 0x0070, iwl3160_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x08B3, 0x0072, iwl3160_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x08B3, 0x0170, iwl3160_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x08B3, 0x0172, iwl3160_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x08B3, 0x0060, iwl3160_2n_cfg)}, +- {IWL_PCI_DEVICE(0x08B3, 0x0062, iwl3160_n_cfg)}, +- {IWL_PCI_DEVICE(0x08B4, 0x0270, iwl3160_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x08B4, 0x0272, iwl3160_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x08B3, 0x0470, iwl3160_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x08B3, 0x0472, iwl3160_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x08B4, 0x0370, iwl3160_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x08B3, 0x8070, iwl3160_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x08B3, 0x8072, iwl3160_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x08B3, 0x8170, iwl3160_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x08B3, 0x8172, iwl3160_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x08B3, 0x8060, iwl3160_2n_cfg)}, +- {IWL_PCI_DEVICE(0x08B3, 0x8062, iwl3160_n_cfg)}, +- {IWL_PCI_DEVICE(0x08B4, 0x8270, iwl3160_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x08B3, 0x8470, iwl3160_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x08B3, 0x8570, iwl3160_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x08B3, 0x1070, iwl3160_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x08B3, 0x1170, iwl3160_2ac_cfg)}, +- +-/* 7265 Series */ +- {IWL_PCI_DEVICE(0x095A, 0x5010, iwl7265_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x095A, 0x5110, iwl7265_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x095A, 0x5100, iwl7265_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x095B, 0x5310, iwl7265_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x095B, 0x5302, iwl7265_n_cfg)}, +- {IWL_PCI_DEVICE(0x095B, 0x5210, iwl7265_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x095A, 0x5012, iwl7265_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x095A, 0x5412, iwl7265_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x095A, 0x5410, iwl7265_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x095A, 0x5400, iwl7265_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x095A, 0x1010, iwl7265_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x095A, 0x5000, iwl7265_2n_cfg)}, +- {IWL_PCI_DEVICE(0x095A, 0x500A, iwl7265_2n_cfg)}, +- {IWL_PCI_DEVICE(0x095B, 0x5200, iwl7265_2n_cfg)}, +- {IWL_PCI_DEVICE(0x095A, 0x5002, iwl7265_n_cfg)}, +- {IWL_PCI_DEVICE(0x095B, 0x5202, iwl7265_n_cfg)}, +- {IWL_PCI_DEVICE(0x095A, 0x9010, iwl7265_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x095A, 0x9012, iwl7265_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x095A, 0x9110, iwl7265_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x095A, 0x9112, iwl7265_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x095A, 0x9210, iwl7265_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x095A, 0x9510, iwl7265_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x095A, 0x9310, iwl7265_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x095A, 0x9410, iwl7265_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x095A, 0x5020, iwl7265_2n_cfg)}, +- {IWL_PCI_DEVICE(0x095A, 0x502A, iwl7265_2n_cfg)}, +- {IWL_PCI_DEVICE(0x095A, 0x5420, iwl7265_2n_cfg)}, +- {IWL_PCI_DEVICE(0x095A, 0x5090, iwl7265_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x095A, 0x5190, iwl7265_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x095A, 0x5590, iwl7265_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x095B, 0x5290, iwl7265_2ac_cfg)}, +- {IWL_PCI_DEVICE(0x095A, 0x5490, iwl7265_2ac_cfg)}, +-#endif /* CONFIG_IWLMVM */ ++ {IWL_PCI_DEVICE(0x4238, 0x1111, iwl6000_3agn_cfg)}, /* x201 */ ++ {IWL_PCI_DEVICE(0x0085, 0x1311, iwl6005_2agn_cfg)}, /* x220 */ ++ {IWL_PCI_DEVICE(0x088E, 0x4060, iwl6035_2agn_cfg)}, /* plumbum */ ++ ++//#if IS_ENABLED(CONFIG_IWLDVM) ++// {IWL_PCI_DEVICE(0x4232, 0x1201, iwl5100_agn_cfg)}, /* Mini Card */ ++// {IWL_PCI_DEVICE(0x4232, 0x1301, iwl5100_agn_cfg)}, /* Half Mini Card */ ++// {IWL_PCI_DEVICE(0x4232, 0x1204, iwl5100_agn_cfg)}, /* Mini Card */ ++// {IWL_PCI_DEVICE(0x4232, 0x1304, iwl5100_agn_cfg)}, /* Half Mini Card */ ++// {IWL_PCI_DEVICE(0x4232, 0x1205, iwl5100_bgn_cfg)}, /* Mini Card */ ++// {IWL_PCI_DEVICE(0x4232, 0x1305, iwl5100_bgn_cfg)}, /* Half Mini Card */ ++// {IWL_PCI_DEVICE(0x4232, 0x1206, iwl5100_abg_cfg)}, /* Mini Card */ ++// {IWL_PCI_DEVICE(0x4232, 0x1306, iwl5100_abg_cfg)}, /* Half Mini Card */ ++// {IWL_PCI_DEVICE(0x4232, 0x1221, iwl5100_agn_cfg)}, /* Mini Card */ ++// {IWL_PCI_DEVICE(0x4232, 0x1321, iwl5100_agn_cfg)}, /* Half Mini Card */ ++// {IWL_PCI_DEVICE(0x4232, 0x1224, iwl5100_agn_cfg)}, /* Mini Card */ ++// {IWL_PCI_DEVICE(0x4232, 0x1324, iwl5100_agn_cfg)}, /* Half Mini Card */ ++// {IWL_PCI_DEVICE(0x4232, 0x1225, iwl5100_bgn_cfg)}, /* Mini Card */ ++// {IWL_PCI_DEVICE(0x4232, 0x1325, iwl5100_bgn_cfg)}, /* Half Mini Card */ ++// {IWL_PCI_DEVICE(0x4232, 0x1226, iwl5100_abg_cfg)}, /* Mini Card */ ++// {IWL_PCI_DEVICE(0x4232, 0x1326, iwl5100_abg_cfg)}, /* Half Mini Card */ ++// {IWL_PCI_DEVICE(0x4237, 0x1211, iwl5100_agn_cfg)}, /* Mini Card */ ++// {IWL_PCI_DEVICE(0x4237, 0x1311, iwl5100_agn_cfg)}, /* Half Mini Card */ ++// {IWL_PCI_DEVICE(0x4237, 0x1214, iwl5100_agn_cfg)}, /* Mini Card */ ++// {IWL_PCI_DEVICE(0x4237, 0x1314, iwl5100_agn_cfg)}, /* Half Mini Card */ ++// {IWL_PCI_DEVICE(0x4237, 0x1215, iwl5100_bgn_cfg)}, /* Mini Card */ ++// {IWL_PCI_DEVICE(0x4237, 0x1315, iwl5100_bgn_cfg)}, /* Half Mini Card */ ++// {IWL_PCI_DEVICE(0x4237, 0x1216, iwl5100_abg_cfg)}, /* Mini Card */ ++// {IWL_PCI_DEVICE(0x4237, 0x1316, iwl5100_abg_cfg)}, /* Half Mini Card */ ++// ++///* 5300 Series WiFi */ ++// {IWL_PCI_DEVICE(0x4235, 0x1021, iwl5300_agn_cfg)}, /* Mini Card */ ++// {IWL_PCI_DEVICE(0x4235, 0x1121, iwl5300_agn_cfg)}, /* Half Mini Card */ ++// {IWL_PCI_DEVICE(0x4235, 0x1024, iwl5300_agn_cfg)}, /* Mini Card */ ++// {IWL_PCI_DEVICE(0x4235, 0x1124, iwl5300_agn_cfg)}, /* Half Mini Card */ ++// {IWL_PCI_DEVICE(0x4235, 0x1001, iwl5300_agn_cfg)}, /* Mini Card */ ++// {IWL_PCI_DEVICE(0x4235, 0x1101, iwl5300_agn_cfg)}, /* Half Mini Card */ ++// {IWL_PCI_DEVICE(0x4235, 0x1004, iwl5300_agn_cfg)}, /* Mini Card */ ++// {IWL_PCI_DEVICE(0x4235, 0x1104, iwl5300_agn_cfg)}, /* Half Mini Card */ ++// {IWL_PCI_DEVICE(0x4236, 0x1011, iwl5300_agn_cfg)}, /* Mini Card */ ++// {IWL_PCI_DEVICE(0x4236, 0x1111, iwl5300_agn_cfg)}, /* Half Mini Card */ ++// {IWL_PCI_DEVICE(0x4236, 0x1014, iwl5300_agn_cfg)}, /* Mini Card */ ++// {IWL_PCI_DEVICE(0x4236, 0x1114, iwl5300_agn_cfg)}, /* Half Mini Card */ ++// ++///* 5350 Series WiFi/WiMax */ ++// {IWL_PCI_DEVICE(0x423A, 0x1001, iwl5350_agn_cfg)}, /* Mini Card */ ++// {IWL_PCI_DEVICE(0x423A, 0x1021, iwl5350_agn_cfg)}, /* Mini Card */ ++// {IWL_PCI_DEVICE(0x423B, 0x1011, iwl5350_agn_cfg)}, /* Mini Card */ ++// ++///* 5150 Series Wifi/WiMax */ ++// {IWL_PCI_DEVICE(0x423C, 0x1201, iwl5150_agn_cfg)}, /* Mini Card */ ++// {IWL_PCI_DEVICE(0x423C, 0x1301, iwl5150_agn_cfg)}, /* Half Mini Card */ ++// {IWL_PCI_DEVICE(0x423C, 0x1206, iwl5150_abg_cfg)}, /* Mini Card */ ++// {IWL_PCI_DEVICE(0x423C, 0x1306, iwl5150_abg_cfg)}, /* Half Mini Card */ ++// {IWL_PCI_DEVICE(0x423C, 0x1221, iwl5150_agn_cfg)}, /* Mini Card */ ++// {IWL_PCI_DEVICE(0x423C, 0x1321, iwl5150_agn_cfg)}, /* Half Mini Card */ ++// {IWL_PCI_DEVICE(0x423C, 0x1326, iwl5150_abg_cfg)}, /* Half Mini Card */ ++// ++// {IWL_PCI_DEVICE(0x423D, 0x1211, iwl5150_agn_cfg)}, /* Mini Card */ ++// {IWL_PCI_DEVICE(0x423D, 0x1311, iwl5150_agn_cfg)}, /* Half Mini Card */ ++// {IWL_PCI_DEVICE(0x423D, 0x1216, iwl5150_abg_cfg)}, /* Mini Card */ ++// {IWL_PCI_DEVICE(0x423D, 0x1316, iwl5150_abg_cfg)}, /* Half Mini Card */ ++// ++///* 6x00 Series */ ++// {IWL_PCI_DEVICE(0x422B, 0x1101, iwl6000_3agn_cfg)}, ++// {IWL_PCI_DEVICE(0x422B, 0x1108, iwl6000_3agn_cfg)}, ++// {IWL_PCI_DEVICE(0x422B, 0x1121, iwl6000_3agn_cfg)}, ++// {IWL_PCI_DEVICE(0x422B, 0x1128, iwl6000_3agn_cfg)}, ++// {IWL_PCI_DEVICE(0x422C, 0x1301, iwl6000i_2agn_cfg)}, ++// {IWL_PCI_DEVICE(0x422C, 0x1306, iwl6000i_2abg_cfg)}, ++// {IWL_PCI_DEVICE(0x422C, 0x1307, iwl6000i_2bg_cfg)}, ++// {IWL_PCI_DEVICE(0x422C, 0x1321, iwl6000i_2agn_cfg)}, ++// {IWL_PCI_DEVICE(0x422C, 0x1326, iwl6000i_2abg_cfg)}, ++// {IWL_PCI_DEVICE(0x4238, 0x1111, iwl6000_3agn_cfg)}, ++// {IWL_PCI_DEVICE(0x4238, 0x1118, iwl6000_3agn_cfg)}, ++// {IWL_PCI_DEVICE(0x4239, 0x1311, iwl6000i_2agn_cfg)}, ++// {IWL_PCI_DEVICE(0x4239, 0x1316, iwl6000i_2abg_cfg)}, ++// ++///* 6x05 Series */ ++// {IWL_PCI_DEVICE(0x0082, 0x1301, iwl6005_2agn_cfg)}, ++// {IWL_PCI_DEVICE(0x0082, 0x1306, iwl6005_2abg_cfg)}, ++// {IWL_PCI_DEVICE(0x0082, 0x1307, iwl6005_2bg_cfg)}, ++// {IWL_PCI_DEVICE(0x0082, 0x1308, iwl6005_2agn_cfg)}, ++// {IWL_PCI_DEVICE(0x0082, 0x1321, iwl6005_2agn_cfg)}, ++// {IWL_PCI_DEVICE(0x0082, 0x1326, iwl6005_2abg_cfg)}, ++// {IWL_PCI_DEVICE(0x0082, 0x1328, iwl6005_2agn_cfg)}, ++// {IWL_PCI_DEVICE(0x0085, 0x1311, iwl6005_2agn_cfg)}, ++// {IWL_PCI_DEVICE(0x0085, 0x1318, iwl6005_2agn_cfg)}, ++// {IWL_PCI_DEVICE(0x0085, 0x1316, iwl6005_2abg_cfg)}, ++// {IWL_PCI_DEVICE(0x0082, 0xC020, iwl6005_2agn_sff_cfg)}, ++// {IWL_PCI_DEVICE(0x0085, 0xC220, iwl6005_2agn_sff_cfg)}, ++// {IWL_PCI_DEVICE(0x0085, 0xC228, iwl6005_2agn_sff_cfg)}, ++// {IWL_PCI_DEVICE(0x0082, 0x4820, iwl6005_2agn_d_cfg)}, ++// {IWL_PCI_DEVICE(0x0082, 0x1304, iwl6005_2agn_mow1_cfg)},/* low 5GHz active */ ++// {IWL_PCI_DEVICE(0x0082, 0x1305, iwl6005_2agn_mow2_cfg)},/* high 5GHz active */ ++// ++///* 6x30 Series */ ++// {IWL_PCI_DEVICE(0x008A, 0x5305, iwl1030_bgn_cfg)}, ++// {IWL_PCI_DEVICE(0x008A, 0x5307, iwl1030_bg_cfg)}, ++// {IWL_PCI_DEVICE(0x008A, 0x5325, iwl1030_bgn_cfg)}, ++// {IWL_PCI_DEVICE(0x008A, 0x5327, iwl1030_bg_cfg)}, ++// {IWL_PCI_DEVICE(0x008B, 0x5315, iwl1030_bgn_cfg)}, ++// {IWL_PCI_DEVICE(0x008B, 0x5317, iwl1030_bg_cfg)}, ++// {IWL_PCI_DEVICE(0x0090, 0x5211, iwl6030_2agn_cfg)}, ++// {IWL_PCI_DEVICE(0x0090, 0x5215, iwl6030_2bgn_cfg)}, ++// {IWL_PCI_DEVICE(0x0090, 0x5216, iwl6030_2abg_cfg)}, ++// {IWL_PCI_DEVICE(0x0091, 0x5201, iwl6030_2agn_cfg)}, ++// {IWL_PCI_DEVICE(0x0091, 0x5205, iwl6030_2bgn_cfg)}, ++// {IWL_PCI_DEVICE(0x0091, 0x5206, iwl6030_2abg_cfg)}, ++// {IWL_PCI_DEVICE(0x0091, 0x5207, iwl6030_2bg_cfg)}, ++// {IWL_PCI_DEVICE(0x0091, 0x5221, iwl6030_2agn_cfg)}, ++// {IWL_PCI_DEVICE(0x0091, 0x5225, iwl6030_2bgn_cfg)}, ++// {IWL_PCI_DEVICE(0x0091, 0x5226, iwl6030_2abg_cfg)}, ++// ++///* 6x50 WiFi/WiMax Series */ ++// {IWL_PCI_DEVICE(0x0087, 0x1301, iwl6050_2agn_cfg)}, ++// {IWL_PCI_DEVICE(0x0087, 0x1306, iwl6050_2abg_cfg)}, ++// {IWL_PCI_DEVICE(0x0087, 0x1321, iwl6050_2agn_cfg)}, ++// {IWL_PCI_DEVICE(0x0087, 0x1326, iwl6050_2abg_cfg)}, ++// {IWL_PCI_DEVICE(0x0089, 0x1311, iwl6050_2agn_cfg)}, ++// {IWL_PCI_DEVICE(0x0089, 0x1316, iwl6050_2abg_cfg)}, ++// ++///* 6150 WiFi/WiMax Series */ ++// {IWL_PCI_DEVICE(0x0885, 0x1305, iwl6150_bgn_cfg)}, ++// {IWL_PCI_DEVICE(0x0885, 0x1307, iwl6150_bg_cfg)}, ++// {IWL_PCI_DEVICE(0x0885, 0x1325, iwl6150_bgn_cfg)}, ++// {IWL_PCI_DEVICE(0x0885, 0x1327, iwl6150_bg_cfg)}, ++// {IWL_PCI_DEVICE(0x0886, 0x1315, iwl6150_bgn_cfg)}, ++// {IWL_PCI_DEVICE(0x0886, 0x1317, iwl6150_bg_cfg)}, ++// ++///* 1000 Series WiFi */ ++// {IWL_PCI_DEVICE(0x0083, 0x1205, iwl1000_bgn_cfg)}, ++// {IWL_PCI_DEVICE(0x0083, 0x1305, iwl1000_bgn_cfg)}, ++// {IWL_PCI_DEVICE(0x0083, 0x1225, iwl1000_bgn_cfg)}, ++// {IWL_PCI_DEVICE(0x0083, 0x1325, iwl1000_bgn_cfg)}, ++// {IWL_PCI_DEVICE(0x0084, 0x1215, iwl1000_bgn_cfg)}, ++// {IWL_PCI_DEVICE(0x0084, 0x1315, iwl1000_bgn_cfg)}, ++// {IWL_PCI_DEVICE(0x0083, 0x1206, iwl1000_bg_cfg)}, ++// {IWL_PCI_DEVICE(0x0083, 0x1306, iwl1000_bg_cfg)}, ++// {IWL_PCI_DEVICE(0x0083, 0x1226, iwl1000_bg_cfg)}, ++// {IWL_PCI_DEVICE(0x0083, 0x1326, iwl1000_bg_cfg)}, ++// {IWL_PCI_DEVICE(0x0084, 0x1216, iwl1000_bg_cfg)}, ++// {IWL_PCI_DEVICE(0x0084, 0x1316, iwl1000_bg_cfg)}, ++// ++///* 100 Series WiFi */ ++// {IWL_PCI_DEVICE(0x08AE, 0x1005, iwl100_bgn_cfg)}, ++// {IWL_PCI_DEVICE(0x08AE, 0x1007, iwl100_bg_cfg)}, ++// {IWL_PCI_DEVICE(0x08AF, 0x1015, iwl100_bgn_cfg)}, ++// {IWL_PCI_DEVICE(0x08AF, 0x1017, iwl100_bg_cfg)}, ++// {IWL_PCI_DEVICE(0x08AE, 0x1025, iwl100_bgn_cfg)}, ++// {IWL_PCI_DEVICE(0x08AE, 0x1027, iwl100_bg_cfg)}, ++// ++///* 130 Series WiFi */ ++// {IWL_PCI_DEVICE(0x0896, 0x5005, iwl130_bgn_cfg)}, ++// {IWL_PCI_DEVICE(0x0896, 0x5007, iwl130_bg_cfg)}, ++// {IWL_PCI_DEVICE(0x0897, 0x5015, iwl130_bgn_cfg)}, ++// {IWL_PCI_DEVICE(0x0897, 0x5017, iwl130_bg_cfg)}, ++// {IWL_PCI_DEVICE(0x0896, 0x5025, iwl130_bgn_cfg)}, ++// {IWL_PCI_DEVICE(0x0896, 0x5027, iwl130_bg_cfg)}, ++// ++///* 2x00 Series */ ++// {IWL_PCI_DEVICE(0x0890, 0x4022, iwl2000_2bgn_cfg)}, ++// {IWL_PCI_DEVICE(0x0891, 0x4222, iwl2000_2bgn_cfg)}, ++// {IWL_PCI_DEVICE(0x0890, 0x4422, iwl2000_2bgn_cfg)}, ++// {IWL_PCI_DEVICE(0x0890, 0x4822, iwl2000_2bgn_d_cfg)}, ++// ++///* 2x30 Series */ ++// {IWL_PCI_DEVICE(0x0887, 0x4062, iwl2030_2bgn_cfg)}, ++// {IWL_PCI_DEVICE(0x0888, 0x4262, iwl2030_2bgn_cfg)}, ++// {IWL_PCI_DEVICE(0x0887, 0x4462, iwl2030_2bgn_cfg)}, ++// ++///* 6x35 Series */ ++// {IWL_PCI_DEVICE(0x088E, 0x4060, iwl6035_2agn_cfg)}, ++// {IWL_PCI_DEVICE(0x088E, 0x406A, iwl6035_2agn_sff_cfg)}, ++// {IWL_PCI_DEVICE(0x088F, 0x4260, iwl6035_2agn_cfg)}, ++// {IWL_PCI_DEVICE(0x088F, 0x426A, iwl6035_2agn_sff_cfg)}, ++// {IWL_PCI_DEVICE(0x088E, 0x4460, iwl6035_2agn_cfg)}, ++// {IWL_PCI_DEVICE(0x088E, 0x446A, iwl6035_2agn_sff_cfg)}, ++// {IWL_PCI_DEVICE(0x088E, 0x4860, iwl6035_2agn_cfg)}, ++// {IWL_PCI_DEVICE(0x088F, 0x5260, iwl6035_2agn_cfg)}, ++// ++///* 105 Series */ ++// {IWL_PCI_DEVICE(0x0894, 0x0022, iwl105_bgn_cfg)}, ++// {IWL_PCI_DEVICE(0x0895, 0x0222, iwl105_bgn_cfg)}, ++// {IWL_PCI_DEVICE(0x0894, 0x0422, iwl105_bgn_cfg)}, ++// {IWL_PCI_DEVICE(0x0894, 0x0822, iwl105_bgn_d_cfg)}, ++// ++///* 135 Series */ ++// {IWL_PCI_DEVICE(0x0892, 0x0062, iwl135_bgn_cfg)}, ++// {IWL_PCI_DEVICE(0x0893, 0x0262, iwl135_bgn_cfg)}, ++// {IWL_PCI_DEVICE(0x0892, 0x0462, iwl135_bgn_cfg)}, ++//#endif /* CONFIG_IWLDVM */ ++// ++//#if IS_ENABLED(CONFIG_IWLMVM) ++///* 7260 Series */ ++// {IWL_PCI_DEVICE(0x08B1, 0x4070, iwl7260_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x08B1, 0x4072, iwl7260_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x08B1, 0x4170, iwl7260_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x08B1, 0x4060, iwl7260_2n_cfg)}, ++// {IWL_PCI_DEVICE(0x08B1, 0x406A, iwl7260_2n_cfg)}, ++// {IWL_PCI_DEVICE(0x08B1, 0x4160, iwl7260_2n_cfg)}, ++// {IWL_PCI_DEVICE(0x08B1, 0x4062, iwl7260_n_cfg)}, ++// {IWL_PCI_DEVICE(0x08B1, 0x4162, iwl7260_n_cfg)}, ++// {IWL_PCI_DEVICE(0x08B2, 0x4270, iwl7260_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x08B2, 0x4272, iwl7260_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x08B2, 0x4260, iwl7260_2n_cfg)}, ++// {IWL_PCI_DEVICE(0x08B2, 0x426A, iwl7260_2n_cfg)}, ++// {IWL_PCI_DEVICE(0x08B2, 0x4262, iwl7260_n_cfg)}, ++// {IWL_PCI_DEVICE(0x08B1, 0x4470, iwl7260_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x08B1, 0x4472, iwl7260_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x08B1, 0x4460, iwl7260_2n_cfg)}, ++// {IWL_PCI_DEVICE(0x08B1, 0x446A, iwl7260_2n_cfg)}, ++// {IWL_PCI_DEVICE(0x08B1, 0x4462, iwl7260_n_cfg)}, ++// {IWL_PCI_DEVICE(0x08B1, 0x4870, iwl7260_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x08B1, 0x486E, iwl7260_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x08B1, 0x4A70, iwl7260_2ac_cfg_high_temp)}, ++// {IWL_PCI_DEVICE(0x08B1, 0x4A6E, iwl7260_2ac_cfg_high_temp)}, ++// {IWL_PCI_DEVICE(0x08B1, 0x4A6C, iwl7260_2ac_cfg_high_temp)}, ++// {IWL_PCI_DEVICE(0x08B1, 0x4570, iwl7260_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x08B1, 0x4560, iwl7260_2n_cfg)}, ++// {IWL_PCI_DEVICE(0x08B2, 0x4370, iwl7260_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x08B2, 0x4360, iwl7260_2n_cfg)}, ++// {IWL_PCI_DEVICE(0x08B1, 0x5070, iwl7260_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x08B1, 0x5072, iwl7260_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x08B1, 0x5170, iwl7260_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x08B1, 0x5770, iwl7260_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x08B1, 0x4020, iwl7260_2n_cfg)}, ++// {IWL_PCI_DEVICE(0x08B1, 0x402A, iwl7260_2n_cfg)}, ++// {IWL_PCI_DEVICE(0x08B2, 0x4220, iwl7260_2n_cfg)}, ++// {IWL_PCI_DEVICE(0x08B1, 0x4420, iwl7260_2n_cfg)}, ++// {IWL_PCI_DEVICE(0x08B1, 0xC070, iwl7260_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x08B1, 0xC072, iwl7260_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x08B1, 0xC170, iwl7260_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x08B1, 0xC060, iwl7260_2n_cfg)}, ++// {IWL_PCI_DEVICE(0x08B1, 0xC06A, iwl7260_2n_cfg)}, ++// {IWL_PCI_DEVICE(0x08B1, 0xC160, iwl7260_2n_cfg)}, ++// {IWL_PCI_DEVICE(0x08B1, 0xC062, iwl7260_n_cfg)}, ++// {IWL_PCI_DEVICE(0x08B1, 0xC162, iwl7260_n_cfg)}, ++// {IWL_PCI_DEVICE(0x08B1, 0xC770, iwl7260_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x08B1, 0xC760, iwl7260_2n_cfg)}, ++// {IWL_PCI_DEVICE(0x08B2, 0xC270, iwl7260_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x08B2, 0xC272, iwl7260_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x08B2, 0xC260, iwl7260_2n_cfg)}, ++// {IWL_PCI_DEVICE(0x08B2, 0xC26A, iwl7260_n_cfg)}, ++// {IWL_PCI_DEVICE(0x08B2, 0xC262, iwl7260_n_cfg)}, ++// {IWL_PCI_DEVICE(0x08B1, 0xC470, iwl7260_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x08B1, 0xC472, iwl7260_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x08B1, 0xC460, iwl7260_2n_cfg)}, ++// {IWL_PCI_DEVICE(0x08B1, 0xC462, iwl7260_n_cfg)}, ++// {IWL_PCI_DEVICE(0x08B1, 0xC570, iwl7260_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x08B1, 0xC560, iwl7260_2n_cfg)}, ++// {IWL_PCI_DEVICE(0x08B2, 0xC370, iwl7260_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x08B1, 0xC360, iwl7260_2n_cfg)}, ++// {IWL_PCI_DEVICE(0x08B1, 0xC020, iwl7260_2n_cfg)}, ++// {IWL_PCI_DEVICE(0x08B1, 0xC02A, iwl7260_2n_cfg)}, ++// {IWL_PCI_DEVICE(0x08B2, 0xC220, iwl7260_2n_cfg)}, ++// {IWL_PCI_DEVICE(0x08B1, 0xC420, iwl7260_2n_cfg)}, ++// ++///* 3160 Series */ ++// {IWL_PCI_DEVICE(0x08B3, 0x0070, iwl3160_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x08B3, 0x0072, iwl3160_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x08B3, 0x0170, iwl3160_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x08B3, 0x0172, iwl3160_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x08B3, 0x0060, iwl3160_2n_cfg)}, ++// {IWL_PCI_DEVICE(0x08B3, 0x0062, iwl3160_n_cfg)}, ++// {IWL_PCI_DEVICE(0x08B4, 0x0270, iwl3160_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x08B4, 0x0272, iwl3160_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x08B3, 0x0470, iwl3160_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x08B3, 0x0472, iwl3160_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x08B4, 0x0370, iwl3160_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x08B3, 0x8070, iwl3160_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x08B3, 0x8072, iwl3160_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x08B3, 0x8170, iwl3160_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x08B3, 0x8172, iwl3160_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x08B3, 0x8060, iwl3160_2n_cfg)}, ++// {IWL_PCI_DEVICE(0x08B3, 0x8062, iwl3160_n_cfg)}, ++// {IWL_PCI_DEVICE(0x08B4, 0x8270, iwl3160_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x08B3, 0x8470, iwl3160_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x08B3, 0x8570, iwl3160_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x08B3, 0x1070, iwl3160_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x08B3, 0x1170, iwl3160_2ac_cfg)}, ++// ++///* 7265 Series */ ++// {IWL_PCI_DEVICE(0x095A, 0x5010, iwl7265_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x095A, 0x5110, iwl7265_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x095A, 0x5100, iwl7265_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x095B, 0x5310, iwl7265_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x095B, 0x5302, iwl7265_n_cfg)}, ++// {IWL_PCI_DEVICE(0x095B, 0x5210, iwl7265_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x095A, 0x5012, iwl7265_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x095A, 0x5412, iwl7265_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x095A, 0x5410, iwl7265_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x095A, 0x5400, iwl7265_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x095A, 0x1010, iwl7265_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x095A, 0x5000, iwl7265_2n_cfg)}, ++// {IWL_PCI_DEVICE(0x095A, 0x500A, iwl7265_2n_cfg)}, ++// {IWL_PCI_DEVICE(0x095B, 0x5200, iwl7265_2n_cfg)}, ++// {IWL_PCI_DEVICE(0x095A, 0x5002, iwl7265_n_cfg)}, ++// {IWL_PCI_DEVICE(0x095B, 0x5202, iwl7265_n_cfg)}, ++// {IWL_PCI_DEVICE(0x095A, 0x9010, iwl7265_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x095A, 0x9012, iwl7265_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x095A, 0x9110, iwl7265_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x095A, 0x9112, iwl7265_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x095A, 0x9210, iwl7265_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x095A, 0x9510, iwl7265_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x095A, 0x9310, iwl7265_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x095A, 0x9410, iwl7265_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x095A, 0x5020, iwl7265_2n_cfg)}, ++// {IWL_PCI_DEVICE(0x095A, 0x502A, iwl7265_2n_cfg)}, ++// {IWL_PCI_DEVICE(0x095A, 0x5420, iwl7265_2n_cfg)}, ++// {IWL_PCI_DEVICE(0x095A, 0x5090, iwl7265_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x095A, 0x5190, iwl7265_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x095A, 0x5590, iwl7265_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x095B, 0x5290, iwl7265_2ac_cfg)}, ++// {IWL_PCI_DEVICE(0x095A, 0x5490, iwl7265_2ac_cfg)}, ++//#endif /* CONFIG_IWLMVM */ + + {0} + }; +--- a/net/core/sock.c ++++ b/net/core/sock.c +@@ -142,6 +142,8 @@ + + #include + ++#include ++ + static DEFINE_MUTEX(proto_list_mutex); + static LIST_HEAD(proto_list); + +--- a/net/packet/af_packet.c ++++ b/net/packet/af_packet.c +@@ -93,6 +93,8 @@ + #include + #endif + ++#include ++ + #include "internal.h" + + /* +@@ -3508,6 +3510,7 @@ static int packet_notifier(struct notifier_block *this, + struct net_device *dev = netdev_notifier_info_to_dev(ptr); + struct net *net = dev_net(dev); + ++#if 0 + rcu_read_lock(); + sk_for_each_rcu(sk, &net->packet.sklist) { + struct packet_sock *po = pkt_sk(sk); +@@ -3548,6 +3551,7 @@ static int packet_notifier(struct notifier_block *this, + } + } + rcu_read_unlock(); ++#endif + return NOTIFY_DONE; + } + +@@ -4062,8 +4066,10 @@ static int __net_init packet_net_init(struct net *net) + mutex_init(&net->packet.sklist_lock); + INIT_HLIST_HEAD(&net->packet.sklist); + ++#ifdef CONFIG_PROC_FS + if (!proc_create("packet", 0, net->proc_net, &packet_seq_fops)) + return -ENOMEM; ++#endif + + return 0; + } +--- a/net/wireless/core.h ++++ b/net/wireless/core.h +@@ -82,7 +82,7 @@ struct cfg80211_registered_device { + + /* must be last because of the way we do wiphy_priv(), + * and it should at least be aligned to NETDEV_ALIGN */ +- struct wiphy wiphy __aligned(NETDEV_ALIGN); ++ struct wiphy wiphy __attribute__((__aligned__(32))); + }; + + static inline +--- a/net/wireless/sysfs.c ++++ b/net/wireless/sysfs.c +@@ -156,7 +156,7 @@ struct class ieee80211_class = { + .resume = wiphy_resume, + #endif + .ns_type = &net_ns_type_operations, +- .namespace = wiphy_namespace, ++ ._namespace = wiphy_namespace, + }; + + int wiphy_sysfs_init(void) +--- a/include/linux/ieee80211.h ++++ b/include/linux/ieee80211.h +@@ -2231,7 +2231,7 @@ static inline bool ieee80211_is_robust_mgmt_frame(struct ieee80211_hdr *hdr) + static inline bool ieee80211_is_public_action(struct ieee80211_hdr *hdr, + size_t len) + { +- struct ieee80211_mgmt *mgmt = (void *)hdr; ++ struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)hdr; + + if (len < IEEE80211_MIN_ACTION_SIZE) + return false; +--- a/include/net/cfg80211.h ++++ b/include/net/cfg80211.h +@@ -191,6 +191,7 @@ struct ieee80211_channel { + * @IEEE80211_RATE_SUPPORTS_10MHZ: Rate can be used in 10 MHz mode + */ + enum ieee80211_rate_flags { ++ IEEE80211_RATE_NULL = 0, + IEEE80211_RATE_SHORT_PREAMBLE = 1<<0, + IEEE80211_RATE_MANDATORY_A = 1<<1, + IEEE80211_RATE_MANDATORY_B = 1<<2, +@@ -465,7 +466,7 @@ ieee80211_chandef_rate_flags(struct cfg80211_chan_def *chandef) + default: + break; + } +- return 0; ++ return IEEE80211_RATE_NULL; + } + + /** +@@ -2990,7 +2991,7 @@ struct wiphy { + const struct nl80211_vendor_cmd_info *vendor_events; + int n_vendor_commands, n_vendor_events; + +- char priv[0] __aligned(NETDEV_ALIGN); ++ char priv[0] __attribute__ ((__aligned__(32)));//__aligned(NETDEV_ALIGN); + }; + + static inline struct net *wiphy_net(struct wiphy *wiphy) +--- a/include/net/netlink.h ++++ b/include/net/netlink.h +@@ -308,7 +308,7 @@ static inline int nlmsg_len(const struct nlmsghdr *nlh) + static inline struct nlattr *nlmsg_attrdata(const struct nlmsghdr *nlh, + int hdrlen) + { +- unsigned char *data = nlmsg_data(nlh); ++ unsigned char *data = (unsigned char *)nlmsg_data(nlh); + return (struct nlattr *) (data + NLMSG_ALIGN(hdrlen)); + } + +@@ -717,7 +717,7 @@ static inline struct nlattr *nla_next(const struct nlattr *nla, int *remaining) + static inline struct nlattr * + nla_find_nested(const struct nlattr *nla, int attrtype) + { +- return nla_find(nla_data(nla), nla_len(nla), attrtype); ++ return nla_find((const struct nlattr *)nla_data(nla), nla_len(nla), attrtype); + } + + /** +@@ -733,7 +733,7 @@ static inline int nla_parse_nested(struct nlattr *tb[], int maxtype, + const struct nlattr *nla, + const struct nla_policy *policy) + { +- return nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy); ++ return nla_parse(tb, maxtype, (const struct nlattr *)nla_data(nla), nla_len(nla), policy); + } + + /** +@@ -1161,7 +1161,7 @@ static inline void nla_nest_cancel(struct sk_buff *skb, struct nlattr *start) + static inline int nla_validate_nested(const struct nlattr *start, int maxtype, + const struct nla_policy *policy) + { +- return nla_validate(nla_data(start), nla_len(start), maxtype, policy); ++ return nla_validate((const struct nlattr *)nla_data(start), nla_len(start), maxtype, policy); + } + + /** +--- a/include/net/sock.h ++++ b/include/net/sock.h +@@ -1854,7 +1854,7 @@ static inline int skb_add_data_nocache(struct sock *sk, struct sk_buff *skb, + { + int err, offset = skb->len; + +- err = skb_do_copy_data_nocache(sk, skb, from, skb_put(skb, copy), ++ err = skb_do_copy_data_nocache(sk, skb, from, (char *)skb_put(skb, copy), + copy, offset); + if (err) + __skb_trim(skb, offset); +@@ -1869,7 +1869,7 @@ static inline int skb_copy_to_page_nocache(struct sock *sk, char __user *from, + { + int err; + +- err = skb_do_copy_data_nocache(sk, skb, from, page_address(page) + off, ++ err = skb_do_copy_data_nocache(sk, skb, from, (char *)(page_address(page) + off), + copy, skb->len); + if (err) + return err; +--- a/drivers/net/wireless/iwlwifi/dvm/rs.c ++++ b/drivers/net/wireless/iwlwifi/dvm/rs.c +@@ -2309,7 +2309,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, + rate_scale_index_msk = rate_mask; + + if (!((1 << index) & rate_scale_index_msk)) { +- IWL_ERR(priv, "Current Rate is not valid\n"); ++ // IWL_ERR(priv, "Current Rate is not valid\n"); + if (lq_sta->search_better_tbl) { + /* revert to active table if search table is not valid*/ + tbl->lq_type = LQ_NONE; diff --git a/repos/dde_linux/patches/wifi_crypto.patch b/repos/dde_linux/patches/wifi_crypto.patch new file mode 100644 index 000000000..188b94502 --- /dev/null +++ b/repos/dde_linux/patches/wifi_crypto.patch @@ -0,0 +1,101 @@ +diff --git a/crypto/ccm.c b/crypto/ccm.c +index 1df8421..a5ee033 100644 +--- a/crypto/ccm.c ++++ b/crypto/ccm.c +@@ -52,7 +52,8 @@ static inline struct crypto_ccm_req_priv_ctx *crypto_ccm_reqctx( + { + unsigned long align = crypto_aead_alignmask(crypto_aead_reqtfm(req)); + +- return (void *)PTR_ALIGN((u8 *)aead_request_ctx(req), align + 1); ++ u8 *p = (u8 *) aead_request_ctx(req); ++ return (void *)PTR_ALIGN(p, (align + 1)); + } + + static int set_msg_len(u8 *block, unsigned int msglen, int csize) +@@ -681,8 +682,10 @@ static struct aead_request *crypto_rfc4309_crypt(struct aead_request *req) + struct crypto_aead *aead = crypto_aead_reqtfm(req); + struct crypto_rfc4309_ctx *ctx = crypto_aead_ctx(aead); + struct crypto_aead *child = ctx->child; +- u8 *iv = PTR_ALIGN((u8 *)(subreq + 1) + crypto_aead_reqsize(child), +- crypto_aead_alignmask(child) + 1); ++ ++ unsigned long m = crypto_aead_alignmask(child) + 1; ++ u8 *p = (u8 *)(subreq + 1) + crypto_aead_reqsize(child); ++ u8 *iv = PTR_ALIGN(p, m); + + /* L' */ + iv[0] = 3; +diff --git a/crypto/ctr.c b/crypto/ctr.c +index f2b94f2..b345689 100644 +--- a/crypto/ctr.c ++++ b/crypto/ctr.c +@@ -59,7 +59,9 @@ static void crypto_ctr_crypt_final(struct blkcipher_walk *walk, + unsigned long alignmask = crypto_cipher_alignmask(tfm); + u8 *ctrblk = walk->iv; + u8 tmp[bsize + alignmask]; +- u8 *keystream = PTR_ALIGN(tmp + 0, alignmask + 1); ++ u8 *p = (u8*)(tmp + 0); ++ unsigned long m = alignmask + 1; ++ u8 *keystream = PTR_ALIGN(p, m); + u8 *src = walk->src.virt.addr; + u8 *dst = walk->dst.virt.addr; + unsigned int nbytes = walk->nbytes; +@@ -108,7 +110,9 @@ static int crypto_ctr_crypt_inplace(struct blkcipher_walk *walk, + u8 *ctrblk = walk->iv; + u8 *src = walk->src.virt.addr; + u8 tmp[bsize + alignmask]; +- u8 *keystream = PTR_ALIGN(tmp + 0, alignmask + 1); ++ unsigned long m = alignmask + 1; ++ u8 *p = (u8*)(tmp + 0); ++ u8 *keystream = PTR_ALIGN(p , m); + + do { + /* create keystream */ +@@ -281,8 +285,11 @@ static int crypto_rfc3686_crypt(struct ablkcipher_request *req) + struct crypto_rfc3686_ctx *ctx = crypto_ablkcipher_ctx(tfm); + struct crypto_ablkcipher *child = ctx->child; + unsigned long align = crypto_ablkcipher_alignmask(tfm); ++ ++ unsigned long m = align + 1; ++ u8 *p = (u8*) ablkcipher_request_ctx(req); + struct crypto_rfc3686_req_ctx *rctx = +- (void *)PTR_ALIGN((u8 *)ablkcipher_request_ctx(req), align + 1); ++ (void *)PTR_ALIGN(p, m); + struct ablkcipher_request *subreq = &rctx->subreq; + u8 *iv = rctx->iv; + +--- a/include/crypto/algapi.h ++++ b/include/crypto/algapi.h +@@ -201,8 +201,10 @@ void __ablkcipher_walk_complete(struct ablkcipher_walk *walk); + + static inline void *crypto_tfm_ctx_aligned(struct crypto_tfm *tfm) + { +- return PTR_ALIGN(crypto_tfm_ctx(tfm), +- crypto_tfm_alg_alignmask(tfm) + 1); ++ void *p = crypto_tfm_ctx(tfm); ++ unsigned int m = crypto_tfm_alg_alignmask(tfm) + 1; ++ ++ return PTR_ALIGN(p, m); + } + + static inline struct crypto_instance *crypto_tfm_alg_instance( +--- a/crypto/algboss.c ++++ b/crypto/algboss.c +@@ -90,6 +90,8 @@ out: + crypto_alg_put(¶m->larval->alg); + kfree(param); + module_put_and_exit(0); ++ ++ return 0; + } + + static int cryptomgr_schedule_probe(struct crypto_larval *larval) +@@ -228,6 +230,8 @@ skiptest: + + kfree(param); + module_put_and_exit(0); ++ ++ return 0; + } + + static int cryptomgr_schedule_test(struct crypto_alg *alg) diff --git a/repos/dde_linux/patches/wifi_mem.patch b/repos/dde_linux/patches/wifi_mem.patch new file mode 100644 index 000000000..e5d14d5d3 --- /dev/null +++ b/repos/dde_linux/patches/wifi_mem.patch @@ -0,0 +1,82 @@ +--- a/drivers/net/wireless/iwlwifi/dvm/calib.c ++++ b/drivers/net/wireless/iwlwifi/dvm/calib.c +@@ -121,7 +121,7 @@ int iwl_calib_set(struct iwl_priv *priv, + struct iwl_calib_result *res, *tmp; + + res = kmalloc(sizeof(*res) + len - sizeof(struct iwl_calib_hdr), +- GFP_ATOMIC); ++ GFP_ATOMIC | GFP_LX_DMA); + if (!res) + return -ENOMEM; + memcpy(&res->hdr, cmd, len); +--- a/drivers/net/wireless/iwlwifi/dvm/scan.c ++++ b/drivers/net/wireless/iwlwifi/dvm/scan.c +@@ -672,7 +672,7 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) + ctx = iwl_rxon_ctx_from_vif(vif); + + if (!priv->scan_cmd) { +- priv->scan_cmd = kmalloc(scan_cmd_size, GFP_KERNEL); ++ priv->scan_cmd = kmalloc(scan_cmd_size, GFP_KERNEL | GFP_LX_DMA); + if (!priv->scan_cmd) { + IWL_DEBUG_SCAN(priv, + "fail to allocate memory for scan\n"); +--- a/drivers/net/wireless/iwlwifi/pcie/trans.c ++++ b/drivers/net/wireless/iwlwifi/pcie/trans.c +@@ -1593,7 +1593,7 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, + sizeof(struct iwl_device_cmd) + + trans->dev_cmd_headroom, + sizeof(void *), +- SLAB_HWCACHE_ALIGN, ++ SLAB_HWCACHE_ALIGN | SLAB_LX_DMA, + NULL); + + if (!trans->dev_cmd_pool) { +--- a/drivers/net/wireless/iwlwifi/pcie/tx.c ++++ b/drivers/net/wireless/iwlwifi/pcie/tx.c +@@ -492,7 +492,7 @@ static int iwl_pcie_txq_alloc(struct iwl_trans *trans, + + txq->entries = kcalloc(slots_num, + sizeof(struct iwl_pcie_txq_entry), +- GFP_KERNEL); ++ GFP_KERNEL | GFP_LX_DMA); + + if (!txq->entries) + goto error; +@@ -501,7 +501,7 @@ static int iwl_pcie_txq_alloc(struct iwl_trans *trans, + for (i = 0; i < slots_num; i++) { + txq->entries[i].cmd = + kmalloc(sizeof(struct iwl_device_cmd), +- GFP_KERNEL); ++ GFP_KERNEL | GFP_LX_DMA); + if (!txq->entries[i].cmd) + goto error; + } +@@ -840,7 +840,7 @@ static int iwl_pcie_tx_alloc(struct iwl_trans *trans) + } + + trans_pcie->txq = kcalloc(trans->cfg->base_params->num_of_queues, +- sizeof(struct iwl_txq), GFP_KERNEL); ++ sizeof(struct iwl_txq), GFP_KERNEL | GFP_LX_DMA); + if (!trans_pcie->txq) { + IWL_ERR(trans, "Not enough memory for txq\n"); + ret = -ENOMEM; +@@ -1255,7 +1255,7 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans, + } + + dup_buf = kmemdup(cmddata[i], cmdlen[i], +- GFP_ATOMIC); ++ GFP_ATOMIC | GFP_LX_DMA); + if (!dup_buf) + return -ENOMEM; + } else { +--- a/net/core/skbuff.c ++++ b/net/core/skbuff.c +@@ -125,6 +125,8 @@ static void *__kmalloc_reserve(size_t size, gfp_t flags, int node, + void *obj; + bool ret_pfmemalloc = false; + ++ flags |= GFP_LX_DMA; ++ + /* + * Try a regular allocation, when that fails and we're not entitled + * to the reserves, fail. diff --git a/repos/dde_linux/patches/wpa_supplicant.patch b/repos/dde_linux/patches/wpa_supplicant.patch new file mode 100644 index 000000000..5ac9822c3 --- /dev/null +++ b/repos/dde_linux/patches/wpa_supplicant.patch @@ -0,0 +1,83 @@ +--- a/wpa_supplicant/config.c ++++ b/wpa_supplicant/config.c +@@ -1187,6 +1187,7 @@ static int wpa_config_parse_password(const struct parse_data *data, + } + + ++#if 0 + static char * wpa_config_write_password(const struct parse_data *data, + struct wpa_ssid *ssid) + { +@@ -1221,6 +1222,7 @@ static char * wpa_config_write_password(const struct parse_data *data, + return buf; + } + #endif /* IEEE8021X_EAPOL */ ++#endif + + + static int wpa_config_parse_wep_key(u8 *key, size_t *len, int line, +@@ -2264,6 +2266,7 @@ int wpa_config_set_quoted(struct wpa_ssid *ssid, const char *var, + } + + ++#ifndef NO_CONFIG_WRITE + /** + * wpa_config_get_all - Get all options from network configuration + * @ssid: Pointer to network configuration data +@@ -2326,7 +2329,6 @@ err: + } + + +-#ifndef NO_CONFIG_WRITE + /** + * wpa_config_get - Get a variable in network configuration + * @ssid: Pointer to network configuration data +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -20,11 +20,12 @@ + #include + #include + #include +-#include +-#include +-#include ++//#include ++//#include ++//#include + #include "nl80211_copy.h" + ++ + #include "common.h" + #include "eloop.h" + #include "utils/list.h" +@@ -10924,7 +10925,7 @@ static void * nl80211_global_init(void) + if (wpa_driver_nl80211_init_nl_global(global) < 0) + goto err; + +- global->ioctl_sock = socket(PF_INET, SOCK_DGRAM, 0); ++ global->ioctl_sock = 42; + if (global->ioctl_sock < 0) { + wpa_printf(MSG_ERROR, "nl80211: socket(PF_INET,SOCK_DGRAM) failed: %s", + strerror(errno)); +--- a/src/drivers/netlink.c ++++ b/src/drivers/netlink.c +@@ -13,6 +13,8 @@ + #include "priv_netlink.h" + #include "netlink.h" + ++#define PF_NETLINK 16 ++#define AF_NETLINK PF_NETLINK + + struct netlink_data { + struct netlink_config *cfg; +--- a/src/utils/eloop.c ++++ b/src/utils/eloop.c +@@ -23,7 +23,7 @@ + #endif + + #ifdef CONFIG_ELOOP_POLL +-#include ++#include + #endif /* CONFIG_ELOOP_POLL */ + + #ifdef CONFIG_ELOOP_EPOLL diff --git a/repos/dde_linux/ports/dde_linux.hash b/repos/dde_linux/ports/dde_linux.hash index 92ed3f5e7..cc4e675c3 100644 --- a/repos/dde_linux/ports/dde_linux.hash +++ b/repos/dde_linux/ports/dde_linux.hash @@ -1 +1 @@ -47adfa6b4fe8f41b3863e3e80a753d97ad0fb701 +7f4e92802b6293f4816c0f366111b554109eec99 diff --git a/repos/dde_linux/ports/dde_linux.port b/repos/dde_linux/ports/dde_linux.port index a78da45c2..5b5bbfb79 100644 --- a/repos/dde_linux/ports/dde_linux.port +++ b/repos/dde_linux/ports/dde_linux.port @@ -1,6 +1,13 @@ LICENSE := GPL VERSION := 1 -DOWNLOADS := dwc_otg.git usb.archive lxip.archive +DOWNLOADS := dwc_otg.git usb.archive lxip.archive wifi.archive \ + libnl.archive wpa_supplicant.archive + +# +# Tools +# +FLEX ?= flex +YACC ?= bison # # The git checkout checks for the existence of SRC_DIR, which is created by the @@ -8,7 +15,6 @@ DOWNLOADS := dwc_otg.git usb.archive lxip.archive # usb.archive: dwc_otg.git - # # USB # @@ -20,7 +26,6 @@ DIR(usb) := $(SRC_DIR_USB) TAR_OPT(usb) := --strip-components=1 --files-from $(REP_DIR)/usb.list HASH_INPUT += $(REP_DIR)/usb.list - # # Raspberry Pi USB controller # @@ -28,6 +33,15 @@ URL(dwc_otg) := https://github.com/nfeske/dwc_otg.git REV(dwc_otg) := r2 DIR(dwc_otg) := $(SRC_DIR_USB)/drivers/usb/host/dwc_otg +# +# mac80211 stack, iwlwifi and iwslegacy sources +# +SRC_DIR_WIFI := src/lib/wifi +URL(wifi) := ${URL(usb)} +SHA(wifi) := ${SHA(usb)} +DIR(wifi) := $(SRC_DIR_WIFI) +TAR_OPT(wifi) := --strip-components=1 --files-from $(REP_DIR)/wifi.list +HASH_INPUT += $(REP_DIR)/wifi.list # # IP stack sources @@ -41,11 +55,40 @@ TAR_OPT(lxip) := --strip-components=1 --files-from $(REP_DIR)/lxip.list HASH_INPUT += $(REP_DIR)/lxip.list +# libnl sources +# +URL(libnl) := http://www.infradead.org/~tgr/libnl/files/libnl-3.2.25.tar.gz +SHA(libnl) := b7a4981f7edf7398256d35fd3c0b87bc84ae27d1 +DIR(libnl) := src/lib/libnl + + +default: generate_libnl_files +generate_libnl_files: $(DOWNLOADS) + @$(MSG_PREFIX)"generate libnl files " + $(VERBOSE)$(FLEX) --header-file=${DIR(libnl)}/lib/route/pktloc_grammar.h \ + -o ${DIR(libnl)}/lib/route/pktloc_grammar.c \ + ${DIR(libnl)}/lib/route/pktloc_grammar.l + $(VERBOSE)$(YACC) -d -o ${DIR(libnl)}/lib/route/pktloc_syntax.c \ + ${DIR(libnl)}/lib/route/pktloc_syntax.y + $(VERBOSE)$(FLEX) --header-file=${DIR(libnl)}/lib/route/cls/ematch_grammar.h \ + -o ${DIR(libnl)}/lib/route/cls/ematch_grammar.c \ + ${DIR(libnl)}/lib/route/cls/ematch_grammar.l + $(VERBOSE)$(YACC) -d -o ${DIR(libnl)}/lib/route/cls/ematch_syntax.c \ + ${DIR(libnl)}/lib/route/cls/ematch_syntax.y + +# +# wpa_supplicant sources +# +URL(wpa_supplicant) := http://w1.fi/releases/wpa_supplicant-2.2.tar.gz +SHA(wpa_supplicant) := 0c2ff4fd2e2f6325147cca0357d6c9f524efa26a +DIR(wpa_supplicant) := src/app/wpa_supplicant + # # Patches # PATCHES := $(addprefix patches/,$(notdir $(wildcard $(REP_DIR)/patches/*.patch))) +# USB USB_OPT = -p1 -d$(SRC_DIR_USB) PATCH_OPT(patches/usb_ax88179.patch) := $(USB_OPT) PATCH_OPT(patches/usb_csum.patch) := $(USB_OPT) @@ -54,6 +97,7 @@ PATCH_OPT(patches/usb_mem.patch) := $(USB_OPT) PATCH_OPT(patches/usb_usbnet.patch) := $(USB_OPT) PATCH_OPT(patches/usb_xchi-quirks.patch) := $(USB_OPT) +#IP stack LXIP_OPT = -p1 -d$(SRC_DIR_LXIP) PATCH_OPT(patches/lxip_icmp.patch) := $(LXIP_OPT) PATCH_OPT(patches/lxip_ip_config.patch) := $(LXIP_OPT) @@ -61,4 +105,16 @@ PATCH_OPT(patches/lxip_skbuff.patch) := $(LXIP_OPT) PATCH_OPT(patches/lxip_tcp.patch) := $(LXIP_OPT) PATCH_OPT(patches/lxip_netlink.patch) := $(LXIP_OPT) +# WIFI +WIFI_OPT = -p1 -d$(SRC_DIR_WIFI) +PATCH_OPT(patches/wifi.patch) := $(WIFI_OPT) +PATCH_OPT(patches/wifi_crypto.patch) := $(WIFI_OPT) +PATCH_OPT(patches/wifi_mem.patch) := $(WIFI_OPT) + +# libnl +PATCH_OPT(patches/libnl.patch) := -p1 -d ${DIR(libnl)} + +# WPA supplicant +PATCH_OPT(patches/wpa_supplicant.patch) := -p1 -d ${DIR(wpa_supplicant)} + # vi: set ft=make : diff --git a/repos/dde_linux/run/wifi.run b/repos/dde_linux/run/wifi.run new file mode 100644 index 000000000..88f151298 --- /dev/null +++ b/repos/dde_linux/run/wifi.run @@ -0,0 +1,168 @@ +# +# Build +# + +set build_components { + core init + drivers/pci drivers/timer drivers/wifi + drivers/rtc + test/lwip/http_srv +} + +lappend_if [have_spec acpi] build_components drivers/acpi +lappend_if [have_spec pci] build_components drivers/pci/device_pd +lappend_if [have_spec platform_arndale] build_components drivers/platform +lappend_if [have_spec gpio] build_components drivers/gpio + +build $build_components + +create_boot_directory + +# +# Generate config +# + +set config { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +network={ + id_str="foobar" + ssid="foobar" + key_mgmt=NONE + #key_mgmt=WPA-PSK + #psk="foobarfoobar" +} + + + + + + + + + } + +append_if [have_spec acpi] config { + + + + + + + + + + + + } + +append_if [have_spec platform_arndale] config { + + + + } + +append_if [have_spec gpio] config { + + + + + } + +append_if [expr ![have_spec acpi] && [have_spec pci]] config { + + + + } + +append config { + +} + +install_config $config + +if {![file exists bin/iwlwifi-6000-6.ucode] || + ![file exists bin/iwlwifi-6000g2a-6.ucode] || + ![file exists bin/iwlwifi-6000g2b-6.ucode]} { + puts "" + puts "The iwlwifi driver needs specific firmware images to work. Please download" + puts "the firmware from http://wireless.kernel.org/en/users/Drivers/iwlwifi and put" + puts "the appropiate firmware into './bin'." + exit 1 +} + + +# +# Boot modules +# + +# generic modules +set boot_modules { + core init timer rtc_drv vfs_jitterentropy.lib.so + ld.lib.so + libc.lib.so libcrypto.lib.so libssl.lib.so + wpa_driver_nl80211.lib.so wpa_supplicant.lib.so + wifi.lib.so + wifi_drv + + test-lwip_httpsrv lwip.lib.so + + iwlwifi-6000-6.ucode + iwlwifi-6000g2a-6.ucode + iwlwifi-6000g2b-6.ucode +} + +lappend_if [have_spec acpi] boot_modules acpi_drv +lappend_if [have_spec pci] boot_modules pci_drv +lappend_if [have_spec nova] boot_modules pci_device_pd +lappend_if [have_spec platform_arndale] boot_modules platform_drv +lappend_if [have_spec gpio] boot_modules gpio_drv + +build_boot_image $boot_modules + +run_genode_until forever +# vi: set ft=tcl : diff --git a/repos/dde_linux/src/drivers/wifi/main.cc b/repos/dde_linux/src/drivers/wifi/main.cc new file mode 100644 index 000000000..fa7828c57 --- /dev/null +++ b/repos/dde_linux/src/drivers/wifi/main.cc @@ -0,0 +1,53 @@ +/* + * \brief Startup Wifi driver + * \author Josef Soentgen + * \date 2014-03-03 + */ + +/* + * Copyright (C) 2014 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +/* Genode includes */ +#include +#include +#include + +/* local includes */ +#include "wpa.h" + + +extern void wifi_init(Server::Entrypoint &, Genode::Lock &); + +static Genode::Lock &wpa_startup_lock() +{ + static Genode::Lock _l(Genode::Lock::LOCKED); + return _l; +} + +struct Main +{ + Server::Entrypoint &_ep; + Wpa_thread *_wpa; + + Main(Server::Entrypoint &ep) + : + _ep(ep) + { + _wpa = new (Genode::env()->heap()) Wpa_thread(wpa_startup_lock()); + + _wpa->start(); + + wifi_init(ep, wpa_startup_lock()); + } +}; + + +namespace Server { + char const *name() { return "wifi_drv_ep"; } + size_t stack_size() { return 32 * 1024 * sizeof(long); } + void construct(Entrypoint &ep) { static Main server(ep); } +} diff --git a/repos/dde_linux/src/drivers/wifi/target.mk b/repos/dde_linux/src/drivers/wifi/target.mk new file mode 100644 index 000000000..24020a5fb --- /dev/null +++ b/repos/dde_linux/src/drivers/wifi/target.mk @@ -0,0 +1,8 @@ +TARGET = wifi_drv + +SRC_CC = main.cc + +# needed for firmware.h +INC_DIR += $(REP_DIR)/src/lib/wifi/include + +LIBS = wifi wpa_supplicant server diff --git a/repos/dde_linux/src/drivers/wifi/wpa.h b/repos/dde_linux/src/drivers/wifi/wpa.h new file mode 100644 index 000000000..063737fc7 --- /dev/null +++ b/repos/dde_linux/src/drivers/wifi/wpa.h @@ -0,0 +1,44 @@ +/* + * \brief Wpa_supplicant thread of the wifi driver + * \author Josef Soentgen + * \date 2014-03-03 + */ + +/* + * Copyright (C) 2014 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +#ifndef _WIFI__WPA_H_ +#define _WIFI__WPA_H_ + +/* Genode includes */ +#include + +/* entry function */ +extern "C" int wpa_main(void); + +class Wpa_thread : public Genode::Thread<8 * 1024 * sizeof(long)> +{ + private: + + Genode::Lock &_lock; + int _exit; + + public: + + Wpa_thread(Genode::Lock &lock) + : Thread("wpa_supplicant"), _lock(lock), _exit(-1) { } + + void entry() + { + /* wait until the wifi driver is up and running */ + _lock.lock(); + _exit = wpa_main(); + Genode::sleep_forever(); + } +}; + +#endif /* _WIFI__WPA_H_ */ diff --git a/repos/dde_linux/src/lib/libnl/if.cc b/repos/dde_linux/src/lib/libnl/if.cc new file mode 100644 index 000000000..e121b3982 --- /dev/null +++ b/repos/dde_linux/src/lib/libnl/if.cc @@ -0,0 +1,23 @@ +#include +#include + +#include + +#define WLAN_DEV "wlan0" + +extern "C" { + +unsigned int if_nametoindex(const char *ifname) +{ + /* we make sure the index is always 1 in the wifi driver */ + return 1; +} + + +char *if_indextoname(unsigned int ifindex, char *ifname) +{ + Genode::memcpy(ifname, WLAN_DEV, Genode::strlen(WLAN_DEV)); + return ifname; +} + +} /* extern "C" */ diff --git a/repos/dde_linux/src/lib/libnl/include/32bit/platform/types.h b/repos/dde_linux/src/lib/libnl/include/32bit/platform/types.h new file mode 100644 index 000000000..4b09c6314 --- /dev/null +++ b/repos/dde_linux/src/lib/libnl/include/32bit/platform/types.h @@ -0,0 +1,24 @@ +/* + * \brief Emulation of the Linux userland API + * \author Josef Soentgen + * \date 2014-07-25 + * + * The content of this file, in particular data structures, is partially + * derived from Linux headers. + */ + +/* + * Copyright (C) 2014 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +#ifndef _32BIT__PLATFORM__TYPES_H_ +#define _32BIT__PLATFORM__TYPES_H_ + + +typedef long long int64_t; +typedef unsigned long long uint64_t; + +#endif /* _32BIT__PLATFORM__TYPES_H_ */ diff --git a/repos/dde_linux/src/lib/libnl/include/64bit/platform/types.h b/repos/dde_linux/src/lib/libnl/include/64bit/platform/types.h new file mode 100644 index 000000000..3ba325e30 --- /dev/null +++ b/repos/dde_linux/src/lib/libnl/include/64bit/platform/types.h @@ -0,0 +1,24 @@ +/* + * \brief Emulation of the Linux userland API + * \author Josef Soentgen + * \date 2014-07-25 + * + * The content of this file, in particular data structures, is partially + * derived from Linux headers. + */ + +/* + * Copyright (C) 2014 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +#ifndef _64BIT__PLATFORM__TYPES_H_ +#define _64BIT__PLATFORM__TYPES_H_ + + +typedef long int64_t; +typedef unsigned long uint64_t; + +#endif /* _64BIT__PLATFORM__TYPES_H_ */ diff --git a/repos/dde_linux/src/lib/libnl/include/defs.h b/repos/dde_linux/src/lib/libnl/include/defs.h new file mode 100644 index 000000000..dd20eab67 --- /dev/null +++ b/repos/dde_linux/src/lib/libnl/include/defs.h @@ -0,0 +1,28 @@ +/* + * \brief Libnl configuration + * \author Christian Helmuth + * \date 2014-08-26 + * + * In conjunction with defs.h.in. + */ + +/* + * Copyright (C) 2014 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +#ifndef _DEFS_H_ +#define _DEFS_H_ + +/* Define to 1 to disable pthreads */ +#define DISABLE_PTHREADS 1 + +/* Define to 1 to enable debugging */ +#define NL_DEBUG 1 + +/* Version number of package */ +#define VERSION "3.2.25" + +#endif /* _DEFS_H_ */ diff --git a/repos/dde_linux/src/lib/libnl/include/endian.h b/repos/dde_linux/src/lib/libnl/include/endian.h new file mode 100644 index 000000000..04a521139 --- /dev/null +++ b/repos/dde_linux/src/lib/libnl/include/endian.h @@ -0,0 +1,3 @@ +#ifndef __LITTLE_ENDIAN +#define __LITTLE_ENDIAN 1234 +#endif diff --git a/repos/dde_linux/src/lib/libnl/include/libnl_emul.h b/repos/dde_linux/src/lib/libnl/include/libnl_emul.h new file mode 100644 index 000000000..48e82187f --- /dev/null +++ b/repos/dde_linux/src/lib/libnl/include/libnl_emul.h @@ -0,0 +1,90 @@ +/* + * \brief Emulation of the Linux userland API + * \author Josef Soentgen + * \author Christian Helmuth + * \date 2014-07-25 + * + * The content of this file, in particular data structures, is partially + * derived from Linux headers. + */ + +/* + * Copyright (C) 2014 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +#ifndef _LIBNL_EMUL_H_ +#define _LIBNL_EMUL_H_ + + +/********************* + ** asm/byteorder.h ** + *********************/ + +#define __LITTLE_ENDIAN_BITFIELD 1 + + +/******************* + ** linux/types.h ** + *******************/ + +#include + + +/********************** + ** uapi/linux/in6.h ** + **********************/ + +struct in6_addr { + union { + __u8 u6_addr8[16]; +#if __UAPI_DEF_IN6_ADDR_ALT + __be16 u6_addr16[8]; + __be32 u6_addr32[4]; +#endif + } in6_u; +#define s6_addr in6_u.u6_addr8 +#if __UAPI_DEF_IN6_ADDR_ALT +#define s6_addr16 in6_u.u6_addr16 +#define s6_addr32 in6_u.u6_addr32 +#endif +}; + +struct sockaddr_in6 { + unsigned short int sin6_family; /* AF_INET6 */ + __be16 sin6_port; /* Transport layer port # */ + __be32 sin6_flowinfo; /* IPv6 flow information */ + struct in6_addr sin6_addr; /* IPv6 address */ + __u32 sin6_scope_id; /* scope id (new in RFC2553) */ +}; + +/* + * Socket types should be taken from libc + */ +#define _BITS_SOCKADDR_H + + +/*********************** + ** uapi/asm/socket.h ** + ***********************/ + +#define SO_PASSCRED 16 + + +/******************** + ** linux/socket.h ** + ********************/ + +struct ucred { + __u32 pid; + __u32 uid; + __u32 gid; +}; + +#define AF_NETLINK 16 + +#define SCM_CREDENTIALS 0x02 + +#endif /* _LIBNL_EMUL_H_ */ diff --git a/repos/dde_linux/src/lib/libnl/include/linux/socket.h b/repos/dde_linux/src/lib/libnl/include/linux/socket.h new file mode 100644 index 000000000..e69de29bb diff --git a/repos/dde_linux/src/lib/libnl/include/linux/types.h b/repos/dde_linux/src/lib/libnl/include/linux/types.h new file mode 100644 index 000000000..ceeaa161d --- /dev/null +++ b/repos/dde_linux/src/lib/libnl/include/linux/types.h @@ -0,0 +1,20 @@ +#ifndef _LINUX_TYPES_H +#define _LINUX_TYPES_H + +#include + +typedef signed char __s8; +typedef unsigned char __u8; +typedef signed short __s16; +typedef unsigned short __u16; +typedef signed int __s32; +typedef unsigned int __u32; +typedef int64_t __s64; +typedef uint64_t __u64; + +typedef __u16 __be16; +typedef __u32 __be32; + +typedef __u16 __sum16; + +#endif /* _LINUX_TYPES_H */ diff --git a/repos/dde_linux/src/lib/libnl/lxcc_emul.cc b/repos/dde_linux/src/lib/libnl/lxcc_emul.cc new file mode 100644 index 000000000..19bfc5b7e --- /dev/null +++ b/repos/dde_linux/src/lib/libnl/lxcc_emul.cc @@ -0,0 +1,352 @@ +/** + * \brief Linux emulation code + * \author Josef Soentgen + * \date 2014-07-28 + */ + +/* + * Copyright (C) 2014 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +/* Genode */ +#include +#include + + +/************** + ** stdlib.h ** + **************/ + +static char getenv_NLDBG[] = "1"; +static char getenv_HZ[] = "100"; +static char getenv_TICKS_PER_USEC[] = "10000"; + + +extern "C" char *getenv(const char *name) +{ + if (Genode::strcmp(name, "NLDBG") == 0) return getenv_NLDBG; + if (Genode::strcmp(name, "HZ") == 0) return getenv_HZ; + if (Genode::strcmp(name, "TICKS_PER_USEC") == 0) return getenv_TICKS_PER_USEC; + + return nullptr; +} + + +#if 0 +#include +#include +#include +#include +#include +#include +#include + +#include + + +extern "C" { + +/************* + ** errno.h ** + *************/ + +int errno; + + +/************* + ** stdio.h ** + *************/ + +FILE *stdout; +FILE *stderr; + + +void *malloc(size_t size) +{ + /* align on pointer size */ + size = size + ((sizeof(Genode::addr_t)-1) & ~(sizeof(Genode::addr_t)-1)); + + size_t rsize = size + sizeof (Genode::addr_t); + + void *addr = 0; + if (!Genode::env()->heap()->alloc(size, &addr)) + return 0; + + *(Genode::addr_t*)addr = rsize; + return ((Genode::addr_t*)addr) + 1; +} + + +void *calloc(size_t nmemb, size_t size) +{ +#define MUL_NO_OVERFLOW (1UL << (sizeof(size_t) * 4)) + if ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) && + nmemb > 0 && SIZE_MAX / nmemb < size) { + return NULL; + } + + size *= nmemb; + + void *addr = malloc(size); + Genode::memset(addr, 0, size); + return addr; +} + + +void free(void *ptr) +{ + if (!ptr) + return; + + Genode::addr_t *addr = ((Genode::addr_t*)ptr) - 1; + Genode::env()->heap()->free(addr, *addr); +} + +void *realloc(void *ptr, Genode::size_t size) +{ + if (!size) + free(ptr); + + void *n = malloc(size); + size_t s = *((size_t *)ptr - 1); + + Genode::memcpy(n, ptr, Genode::min(s, size)); + + free(ptr); + + return n; +} + + +/************** + ** stdlib.h ** + **************/ + +static char getenv_HZ[] = "100"; +static char getenv_TICKS_PER_USEC[] = "10000"; + +char *getenv(const char *name) +{ + /* these values must match the ones of lx_emul wifi */ + + if (Genode::strcmp(name, "HZ") == 0) return getenv_HZ; + if (Genode::strcmp(name, "TICKS_PER_USEC") == 0) return getenv_TICKS_PER_USEC; + + return nullptr; +} + + +long int strtol(const char *nptr, char **endptr, int base) +{ + long res = 0; + Genode::ascii_to(nptr, &res, base); + return res; +} + + +double strtod(const char *nptr, char **endptr) +{ + double res = 0; + Genode::ascii_to(nptr, &res, 0); + return res; +} + + +/******************** + ** linux/string.h ** + ********************/ + +size_t strcspn(const char *s, const char *reject) +{ + for (char const *p = s; *p; p++) { + char c = *p; + + for (char const *r = reject; *r; r++) { + char d = *r; + if (c == d) + return (p - 1 - s); + } + } + return 0; +} + + +char *strdup(const char *s) +{ + size_t len = strlen(s); + + char *p = (char *) malloc(len + 1); + + return strncpy(p, s, len + 1); +} + + +size_t strlen(const char *s) +{ + return Genode::strlen(s); +} + + +int strcasecmp(const char* s1, const char *s2) +{ + return Genode::strcmp(s1, s2); +} + + +int strcmp(const char* s1, const char *s2) +{ + return Genode::strcmp(s1, s2); +} + + +int strncmp(const char *s1, const char *s2, size_t len) +{ + return Genode::strcmp(s1, s2, len); +} + + +char *strchr(const char *p, int ch) +{ + char c; + c = ch; + for (;; ++p) { + if (*p == c) + return ((char *)p); + if (*p == '\0') + break; + } + + return 0; +} + + +void *memchr(const void *s, int c, size_t n) +{ + const unsigned char *p = reinterpret_cast(s); + while (n-- != 0) { + if ((unsigned char)c == *p++) { + return (void *)(p - 1); + } + } + return NULL; +} + + +char *strnchr(const char *p, size_t count, int ch) +{ + char c; + c = ch; + for (; count; ++p, count--) { + if (*p == c) + return ((char *)p); + if (*p == '\0') + break; + } + + return 0; +} + + +char *strncat(char *dst, const char *src, size_t n) +{ + char *p = dst; + while (*p++) ; + + while ((*p = *src) && (n-- > 0)) { + ++src; + ++p; + } + + return dst; +} + + +char *strcpy(char *dst, const char *src) +{ + char *p = dst; + + while ((*dst = *src)) { + ++src; + ++dst; + } + + return p; +} + + +char *strncpy(char *dst, const char* src, size_t n) +{ + return Genode::strncpy(dst, src, n); +} + + +int snprintf(char *str, size_t size, const char *format, ...) +{ + va_list list; + + va_start(list, format); + Genode::String_console sc(str, size); + sc.vprintf(format, list); + va_end(list); + + return sc.len(); +} + + +int vsnprintf(char *str, size_t size, const char *format, va_list args) +{ + Genode::String_console sc(str, size); + sc.vprintf(format, args); + + return sc.len(); +} + + +int asprintf(char **strp, const char *fmt, ...) +{ + /* XXX for now, let's hope strings are not getting longer than 256 bytes */ + enum { MAX_STRING_LENGTH = 256 }; + char *p = (char*)malloc(MAX_STRING_LENGTH); + if (!p) + return -1; + + va_list args; + + va_start(args, fmt); + Genode::String_console sc(p, MAX_STRING_LENGTH); + sc.vprintf(fmt, args); + va_end(args); + + return strlen(p);; +} + + +/************** + ** unistd.h ** + **************/ + +int getpagesize(void) { + return 4096; } + + +pid_t getpid(void) { + return 42; } + + +/************ + ** time.h ** + ************/ + +extern unsigned long jiffies; + +time_t time(time_t *t) +{ + dde_kit_printf("%s:%d from: %p\n", __func__, __LINE__, __builtin_return_address(0)); + return jiffies; +} + +} /* extern "C" */ +#endif diff --git a/repos/dde_linux/src/lib/libnl/socket.cc b/repos/dde_linux/src/lib/libnl/socket.cc new file mode 100644 index 000000000..e3d249473 --- /dev/null +++ b/repos/dde_linux/src/lib/libnl/socket.cc @@ -0,0 +1,494 @@ +/** + * \brief Linux emulation code + * \author Josef Soentgen + * \date 2014-07-28 + */ + +/* + * Copyright (C) 2014 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +/* Genode includes */ +#include +#include +#include +#include +#include +#include + +/* Libc includes */ +#include +#include +#include +#include +#include + +#include + +extern "C" { +#include +#include +} + +/* from netlink-private/netlink.h */ +#ifndef SOL_NETLINK +#define SOL_NETLINK 270 +#endif + +/* uapi/asm-generic/socket.h */ +#ifndef SO_WIFI_STATUS +#define SO_WIFI_STATUS 41 +#endif + +/* bits/socket.h */ +#ifndef MSG_ERRQUEUE +#define MSG_ERRQUEUE 0x2000 +#endif + + +static const bool trace = true; +#define TRACE() \ + do { if (trace) \ + PDBG("called from: %p", __builtin_return_address(0)); \ + } while (0) + + +using namespace Wifi; + +extern Socket_call socket_call; + + +struct Socket_fd : public Genode::List::Element +{ + Socket *s; + int fd; + + Socket_fd(Socket *s, int fd) : s(s), fd(fd) { } +}; + + +class Socket_registry +{ + private : + + /* abritary value (it goes to eleven!) */ + enum { SOCKETS_INITIAL_VALUE = 11, }; + + static unsigned _sockets; + + static Genode::List *_list() /* XXX ptr array instead of list? */ + { + static Genode::List _l; + return &_l; + } + + public: + + static int insert(Socket *s) + { + Socket_fd *sfd = new (Genode::env()->heap()) Socket_fd(s, ++_sockets); + + _list()->insert(sfd); + + return sfd->fd; + } + + static void remove(Socket *s) + { + for (Socket_fd *sfd = _list()->first(); sfd; sfd = sfd->next()) + if (sfd->s == s) { + _list()->remove(sfd); + destroy(Genode::env()->heap(), sfd); + break; + } + } + + static Socket *find(int fd) + { + for (Socket_fd *sfd = _list()->first(); sfd; sfd = sfd->next()) + if (sfd->fd == fd) + return sfd->s; + + return 0; + } +}; + +unsigned Socket_registry::_sockets = Socket_registry::SOCKETS_INITIAL_VALUE; + + +extern "C" { + +/****************** + ** sys/socket.h ** + ******************/ + +int bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen) +{ + Socket *s = Socket_registry::find(sockfd); + if (!s) { + errno = EBADF; + return -1; + } + + /* FIXME convert to/from Sockaddr */ + int const err = socket_call.bind(s, (Wifi::Sockaddr const *)addr, addrlen); + if (err < 0) { + errno = -err; + return -1; + } + + return err; +} + + +int getsockname(int sockfd, struct sockaddr *addr, socklen_t *addrlen) +{ + Socket *s = Socket_registry::find(sockfd); + if (!s) { + errno = EBADF; + return -1; + } + + /* FIXME convert to/from Sockaddr */ + int const err = socket_call.getsockname(s, (Wifi::Sockaddr *)addr, addrlen); + if (err < 0) { + errno = -err; + return -1; + } + + return err; +} + + +ssize_t recvfrom(int sockfd, void *buf, size_t len, int flags, + struct sockaddr *src_addr, socklen_t *addrlen) +{ + Socket *s = Socket_registry::find(sockfd); + if (!s) { + PERR("sockfd %d not in registry", sockfd); + errno = EBADF; + return -1; + } + + Wifi::Msghdr w_msg; + + w_msg.msg_name = (void*)src_addr; + w_msg.msg_namelen = *addrlen; + w_msg.msg_iovlen = 1; + w_msg.msg_iov[0].iov_base = buf; + w_msg.msg_iov[0].iov_len = len; + + /* FIXME convert to/from Sockaddr */ + /* FIXME flags values */ + int const err = socket_call.recvmsg(s, &w_msg, Wifi::WIFI_F_NONE); + if (err < 0) { + errno = -err; + return -1; + } + + return err; +} + + +ssize_t recvmsg(int sockfd, struct msghdr *msg, int flags) +{ + Socket *s = Socket_registry::find(sockfd); + if (!s) { + errno = EBADF; + return -1; + } + + if (msg->msg_iovlen > Wifi::Msghdr::MAX_IOV_LEN) { + PERR("%s: %d exceeds maximum iov length (%d)", + __func__, msg->msg_iovlen, Wifi::Msghdr::MAX_IOV_LEN); + errno = EINVAL; + return -1; + } + + /* XXX support multiple flags */ + Wifi::Flags w_flags = Wifi::WIFI_F_NONE; + if (flags & MSG_ERRQUEUE) + w_flags = Wifi::WIFI_F_MSG_ERRQUEUE; + + Wifi::Msghdr w_msg; + + w_msg.msg_name = msg->msg_name; + w_msg.msg_namelen = msg->msg_namelen; + w_msg.msg_iovlen = msg->msg_iovlen; + for (unsigned i = 0; i < w_msg.msg_iovlen; ++i) { + w_msg.msg_iov[i].iov_base = msg->msg_iov[i].iov_base; + w_msg.msg_iov[i].iov_len = msg->msg_iov[i].iov_len; + } + + w_msg.msg_control = msg->msg_control; + w_msg.msg_controllen = msg->msg_controllen; + + int const err = socket_call.recvmsg(s, &w_msg, w_flags); + + if (err < 0) { + errno = -err; + return -1; + } + + if (err > 0 && msg->msg_name) + msg->msg_namelen = w_msg.msg_namelen; + + return err; +} + + +ssize_t send(int sockfd, const void *buf, size_t len, int flags) +{ + return sendto(sockfd, buf, len, flags, 0, 0); +} + + +ssize_t sendmsg(int sockfd, const struct msghdr *msg, int flags) +{ + Socket *s = Socket_registry::find(sockfd); + if (!s) { + errno = EBADF; + return -1; + } + + if (msg->msg_iovlen > Wifi::Msghdr::MAX_IOV_LEN) { + PERR("%s: %d exceeds maximum iov length (%d)", + __func__, msg->msg_iovlen, Wifi::Msghdr::MAX_IOV_LEN); + errno = EINVAL; + return -1; + } + if (msg->msg_controllen != 0) { + PERR("%s: msg_control not supported", __func__); + errno = EINVAL; + return -1; + } + if (flags != 0) { + PERR("%s: flags not supported", __func__); + errno = EOPNOTSUPP; + return -1; + } + + Wifi::Msghdr w_msg; + + w_msg.msg_name = msg->msg_name; + w_msg.msg_namelen = msg->msg_namelen; + w_msg.msg_iovlen = msg->msg_iovlen; + for (unsigned i = 0; i < w_msg.msg_iovlen; ++i) { + w_msg.msg_iov[i].iov_base = msg->msg_iov[i].iov_base; + w_msg.msg_iov[i].iov_len = msg->msg_iov[i].iov_len; + } + + int const err = socket_call.sendmsg(s, &w_msg, Wifi::WIFI_F_NONE); + + if (err < 0) { + errno = -err; + return -1; + } + + return err; +} + + +ssize_t sendto(int sockfd, const void *buf, size_t len, int flags, + const struct sockaddr *dest_addr, socklen_t addrlen) +{ + Socket *s = Socket_registry::find(sockfd); + if (!s) + return -1; + + Wifi::Msghdr w_msg; + + w_msg.msg_name = (void*)dest_addr; + w_msg.msg_namelen = addrlen; + w_msg.msg_iovlen = 1; + w_msg.msg_iov[0].iov_base = const_cast(buf); + w_msg.msg_iov[0].iov_len = len; + + /* FIXME convert to/from Sockaddr */ + /* FIXME flags values */ + int const err = socket_call.sendmsg(s, &w_msg, Wifi::WIFI_F_NONE); + if (err < 0) { + errno = -err; + return -1; + } + + return err; +} + + +namespace { struct Invalid_arg { }; } + +static Sockopt_level sockopt_level(int const in) +{ + switch (in) { + case SOL_SOCKET: return Wifi::WIFI_SOL_SOCKET; + case SOL_NETLINK: return Wifi::WIFI_SOL_NETLINK; + default: throw Invalid_arg(); + } +} + + +static Sockopt_name sockopt_name(int const level, int const in) +{ + switch (level) { + case SOL_SOCKET: + switch (in) { + case SO_SNDBUF: return Wifi::WIFI_SO_SNDBUF; + case SO_RCVBUF: return Wifi::WIFI_SO_RCVBUF; + case SO_PASSCRED: return Wifi::WIFI_SO_PASSCRED; + case SO_WIFI_STATUS: return Wifi::WIFI_SO_WIFI_STATUS; + default: throw Invalid_arg(); + } + case SOL_NETLINK: + switch (in) { + case NETLINK_ADD_MEMBERSHIP: return Wifi::WIFI_NETLINK_ADD_MEMBERSHIP; + case NETLINK_DROP_MEMBERSHIP: return Wifi::WIFI_NETLINK_DROP_MEMBERSHIP; + case NETLINK_PKTINFO: return Wifi::WIFI_NETLINK_PKTINFO; + default: throw Invalid_arg(); + } + default: throw Invalid_arg(); + } +} + + +int setsockopt(int sockfd, int level, int optname, const void *optval, + socklen_t optlen) +{ + Socket *s = Socket_registry::find(sockfd); + if (!s) + return -1; + + /* FIXME optval values */ + int const err = socket_call.setsockopt(s, + sockopt_level(level), + sockopt_name(level, optname), + optval, optlen); + if (err < 0) { + errno = -err; + return 1; + } + + return err; +} + + +int socket(int domain, int type, int protocol) +{ + /* FIXME domain, type, protocol values */ + Socket *s = socket_call.socket(domain, type, protocol); + + if (!s) + return -1; + + return Socket_registry::insert(s); +} + + +/************** + ** unistd.h ** + **************/ + +int close(int fd) +{ + Socket *s = Socket_registry::find(fd); + if (!s) + return -1; + + Socket_registry::remove(s); /* XXX all further operations on s shall fail */ + + int const err = socket_call.close(s); + if (err < 0) { + errno = -err; + return -1; + } + + return err; +} + + +/************* + ** fnctl.h ** + *************/ + +int fcntl(int fd, int cmd, ... /* arg */ ) +{ + Socket *s = Socket_registry::find(fd); + if (!s) + return -1; + + long arg; + + va_list ap; + va_start(ap, cmd); + arg = va_arg(ap, long); + va_end(ap); + + switch (cmd) { + case F_SETFL: + if (arg == O_NONBLOCK) { + socket_call.non_block(s, true); + return 0; + } + default: + PWRN("fcntl: unknown request: %d", cmd); + break; + } + + return -1; +} + + +/**************** + ** sys/poll.h ** + ****************/ + +int poll(struct pollfd *fds, nfds_t nfds, int timeout) +{ + Poll_socket_fd sockets[Wifi::MAX_POLL_SOCKETS]; + unsigned num = 0; + + for (nfds_t i = 0; i < nfds; i++) { + Socket *s = Socket_registry::find(fds[i].fd); + if (!s) continue; + + Genode::memset(&sockets[num], 0, sizeof(Poll_socket_fd)); + + sockets[num].s = s; + sockets[num].pfd = &fds[i]; + + if (fds[i].events & POLLIN) + sockets[num].events |= Wifi::WIFI_POLLIN; + if (fds[i].events & POLLOUT) + sockets[num].events |= Wifi::WIFI_POLLOUT; + if (fds[i].events & POLLPRI) + sockets[num].events |= Wifi::WIFI_POLLEX; + + num++; + } + + int nready = socket_call.poll_all(sockets, num, timeout); + if (!nready) + return 0; + if (nready < 0) + return -1; + + for (unsigned i = 0; i < num; i++) { + int revents = sockets[i].revents; + struct pollfd *pfd = static_cast(sockets[i].pfd); + + pfd->revents = 0; + if (revents & Wifi::WIFI_POLLIN) + pfd->revents |= POLLIN; + if (revents & Wifi::WIFI_POLLOUT) + pfd->revents |= POLLOUT; + if (revents & Wifi::WIFI_POLLEX) + pfd->revents |= POLLPRI; + } + + return nready; +} + +} /* extern "C" */ diff --git a/repos/dde_linux/src/lib/wifi/dummies.cc b/repos/dde_linux/src/lib/wifi/dummies.cc new file mode 100644 index 000000000..cba5e0018 --- /dev/null +++ b/repos/dde_linux/src/lib/wifi/dummies.cc @@ -0,0 +1,563 @@ +/** + * \brief Dummy functions + * \author Josef Soentgen + * \date 2014-03-03 + */ + +/* + * Copyright (C) 2014 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +#include + +extern "C" { + typedef long DUMMY; + +enum { + SHOW_DUMMY = 0, + SHOW_SKIP = 0, + SHOW_RET = 0, +}; + +#define DUMMY(retval, name) \ + DUMMY name(void) { \ + if (SHOW_DUMMY) \ + PDBG( #name " called (from %p) not implemented", __builtin_return_address(0)); \ + return retval; \ +} + +#define DUMMY_SKIP(retval, name) \ + DUMMY name(void) { \ + if (SHOW_SKIP) \ + PLOG( #name " called (from %p) skipped", __builtin_return_address(0)); \ + return retval; \ +} + +#define DUMMY_RET(retval, name) \ + DUMMY name(void) { \ + if (SHOW_RET) \ + PWRN( #name " called (from %p) return %d", __builtin_return_address(0), retval); \ + return retval; \ +} + +/* return sucessful */ +DUMMY_RET(0, netdev_kobject_init) +DUMMY_RET(0, vlan_tx_nonzero_tag_present) +DUMMY_RET(0, vlan_tx_tag_present) +DUMMY_RET(1, capable) +DUMMY_RET(1, rcu_read_lock_bh_held) +DUMMY_RET(1, softirq_count); +DUMMY_RET(1, try_module_get) +DUMMY_RET(0, security_sk_alloc) +DUMMY_RET(0, net_ratelimit) +DUMMY_RET(0, static_key_false) +DUMMY_RET(1, dma_supported) +DUMMY_RET(1, ns_capable) +DUMMY_RET(0, sock_tx_timestamp) + +/* not needed */ +DUMMY_SKIP(-1, might_sleep) +DUMMY_SKIP(-1, read_lock_bh) +DUMMY_SKIP(-1, read_unlock_bh) +DUMMY_SKIP(-1, rwlock_init) +DUMMY_SKIP(-1, spin_lock_irqsave) +DUMMY_SKIP(-1, spin_unlock_irqrestore) +DUMMY_SKIP(-1, write_lock_bh) +DUMMY_SKIP(-1, write_unlock_bh) +DUMMY_SKIP(0, debugfs_create_dir) +DUMMY_SKIP(0, debugfs_remove_recursive) +DUMMY_SKIP(0, debugfs_rename) +DUMMY_SKIP(0, destroy_workqueue) +DUMMY_SKIP(0, device_create) +DUMMY_SKIP(0, device_initialize) +DUMMY_SKIP(0, down_read) +DUMMY_SKIP(0, down_write) +DUMMY_SKIP(0, free_irq) +DUMMY_SKIP(0, init_rwsem) +DUMMY_SKIP(0, iounmap) +DUMMY_SKIP(0, kparam_block_sysfs_write) +DUMMY_SKIP(0, kparam_unblock_sysfs_write) +DUMMY_SKIP(0, pci_disable_device) +DUMMY_SKIP(0, pci_disable_link_state) +DUMMY_SKIP(0, pci_disable_msi) +DUMMY_SKIP(0, pci_enable_device) +DUMMY_SKIP(0, pci_enable_msi) +DUMMY_SKIP(0, pci_release_regions) +DUMMY_SKIP(0, pci_request_regions) +DUMMY_SKIP(0, pci_set_master) +DUMMY_SKIP(0, put_device) +DUMMY_SKIP(0, scm_destroy) +DUMMY_SKIP(0, scm_recv) +DUMMY_SKIP(0, scm_send) +DUMMY_SKIP(0, security_netlink_send) +DUMMY_SKIP(0, sk_filter) +DUMMY_SKIP(0, sk_filter_release_rcu) +DUMMY_SKIP(-1, sk_filter_size) +DUMMY_SKIP(0, spin_lock) +DUMMY_SKIP(0, spin_lock_bh) +DUMMY_SKIP(0, spin_lock_init) +DUMMY_SKIP(0, spin_lock_irq) +DUMMY_SKIP(0, spin_unlock) +DUMMY_SKIP(0, spin_unlock_bh) +DUMMY_SKIP(0, spin_unlock_irq) +DUMMY_SKIP(0, up_read) +DUMMY_SKIP(0, up_write) +DUMMY_SKIP(1, in_interrupt) /* XXX * */ +DUMMY_SKIP(0, in_softirq) /* XXX */ +DUMMY_SKIP(0, is_vmalloc_addr) /* XXX */ +DUMMY_SKIP(0, in_irq) /* XXX */ + +DUMMY_SKIP(0, local_bh_disable) +DUMMY_SKIP(0, local_bh_enable) +DUMMY_SKIP(0, dma_unmap_page) + +/*FIXME*/DUMMY(0, dma_set_coherent_mask) +/*FIXME*/DUMMY(0, dma_set_mask) +DUMMY(-1, dma_sync_single_for_cpu) +DUMMY(-1, dma_sync_single_for_device) + + +/* XXX DUMMY_SKIP safe? */ +DUMMY_SKIP(0, dma_unmap_single) +DUMMY_SKIP(0, kunmap) +DUMMY_SKIP(0, kunmap_atomic) + +DUMMY_SKIP(-1, dump_stack) +DUMMY_SKIP(-1, gfp_pfmemalloc_allowed) +DUMMY_SKIP(-1, prefetchw) +DUMMY_SKIP(-1, write_lock_irq) +DUMMY_SKIP(-1, write_lock_irqsave) +DUMMY_SKIP(-1, write_unlock_irq) +DUMMY_SKIP(-1, write_unlock_irqrestore) +DUMMY_SKIP(0, read_lock) +DUMMY_SKIP(0, read_unlock) +DUMMY_SKIP(0, sysfs_create_group) +DUMMY_SKIP(0, sysfs_remove_group) +DUMMY_SKIP(0, sysfs_create_link) +DUMMY_SKIP(0, sysfs_remove_link) +DUMMY_SKIP(0, module_put) + +DUMMY(0, device_release_driver) +DUMMY(-1, __vlan_put_tag) +DUMMY(-1, dev_printk_emit) +DUMMY(-1, gen_kill_estimator) +DUMMY(-1, generic_pipe_buf_confirm) +DUMMY(-1, generic_pipe_buf_map) +DUMMY(-1, generic_pipe_buf_unmap) +DUMMY(-1, linkwatch_fire_event) +DUMMY(-1, mod_delayed_work) +DUMMY(-1, need_resched) +DUMMY(-1, open_softirq) +DUMMY(-1, raw_notifier_chain_unregister) +DUMMY(-1, system_wq) +DUMMY(-1, vlan_do_receive) +DUMMY(-1, vlan_untag) +DUMMY(-1, yield) +DUMMY(0, IS_ERR) +DUMMY(0, __raise_softirq_irqoff) +DUMMY(0, __this_cpu_read) +DUMMY(-1, add_device_randomness) +DUMMY(0, add_uevent_var) +DUMMY(0, atomic64_read) +DUMMY(0, bitmap_empty) +DUMMY(0, call_rcu) +DUMMY(0, csum_block_add) +DUMMY(0, csum_fold) +DUMMY(0, csum_partial) +DUMMY(0, device_del) +DUMMY(0, device_rename) +DUMMY(0, device_unregister) +DUMMY(0, do_posix_clock_monotonic_gettime) +DUMMY(0, do_softirq) +DUMMY(0, flush_delayed_work) +DUMMY(0, flush_work) +DUMMY(0, flush_workqueue) +DUMMY(0, genl_dump_check_consistent) +DUMMY(0, genl_info_net) +DUMMY(0, genlmsg_cancel) +DUMMY(0, genlmsg_end) +DUMMY(0, genlmsg_multicast) +DUMMY(0, genlmsg_multicast_netns) +DUMMY(0, genlmsg_reply) +DUMMY(0, genlmsg_unicast) +DUMMY(0, get_cpu) +DUMMY(0, get_random_bytes) +DUMMY(0, get_seconds) +DUMMY(0, hweight16) +DUMMY(0, hweight64) +DUMMY(0, idr_alloc) +DUMMY(0, idr_destroy) +DUMMY(0, idr_find) +DUMMY(0, idr_for_each) +DUMMY(0, idr_init) +DUMMY(0, idr_remove) +DUMMY(0, init_timer_deferrable) +DUMMY(0, ip_hdr) +DUMMY(0, ipv4_get_dsfield) +DUMMY(0, ipv6_get_dsfield) +DUMMY(0, ipv6_hdr) +DUMMY(0, irqs_disabled) +DUMMY(0, isalpha) +DUMMY(0, jhash_2words) +DUMMY(0, kmem_cache_destroy) +DUMMY(0, kobject_uevent) +DUMMY(0, kobject_uevent_env) +DUMMY(0, kstrtoul) +DUMMY(0, linkwatch_init_dev) +DUMMY(0, local_softirq_pending) +DUMMY(0, mb) +DUMMY(0, misc_register) +DUMMY(0, mmiowb) +DUMMY(0, net_dmaengine_put) +DUMMY(0, net_info_ratelimited) +DUMMY(0, net_ns_type_operations) +DUMMY(0, netdev_pick_tx) +DUMMY(0, netdev_register_kobject) +DUMMY(0, netdev_unregister_kobject) +DUMMY(0, netpoll_poll_lock) +DUMMY(0, netpoll_poll_unlock) +DUMMY(0, netpoll_receive_skb) +DUMMY(0, netpoll_rx) +DUMMY(0, netpoll_rx_disable) +DUMMY(0, netpoll_rx_enable) +DUMMY(0, nla_data) +DUMMY(0, nla_get_be32) +DUMMY(0, nla_get_flag) +DUMMY(0, nla_get_s8) +DUMMY(0, nla_get_u16) +DUMMY(0, nla_get_u32) +DUMMY(0, nla_get_u64) +DUMMY(0, nla_get_u8) +DUMMY(0, nla_len) +DUMMY(0, nla_nest_end) +DUMMY(0, nla_nest_start) +DUMMY(0, nla_parse_nested) +DUMMY(0, nla_put_be32) +DUMMY(0, nla_put_flag) +DUMMY(0, nla_put_string) +DUMMY(0, nla_put_u16) +DUMMY(0, nla_put_u32) +DUMMY(0, nla_put_u64) +DUMMY(0, nla_put_u8) +DUMMY(0, nla_type) +DUMMY(0, nlmsg_free) +DUMMY(0, nlmsg_new) +DUMMY(0, nlmsg_parse) +DUMMY(0, nonseekable_open) +DUMMY(0, ntohs) +DUMMY(0, pci_pme_capable) +DUMMY(0, pm_qos_add_notifier) +DUMMY(0, pm_qos_remove_notifier) +DUMMY(0, pm_qos_request) +DUMMY(0, poll_wait) +DUMMY(0, preempt_disable) +DUMMY(0, preempt_enable) +DUMMY(0, put_cpu) +DUMMY(0, put_unaligned_be16) +DUMMY(0, put_unaligned_le16) +DUMMY(0, put_unaligned_le64) +DUMMY(0, qdisc_all_tx_empty) +DUMMY(0, raise_softirq_irqoff) +DUMMY(0, rcu_barrier) +DUMMY(0, rcu_read_lock_bh) +DUMMY(0, rcu_read_lock_held) +DUMMY(0, rcu_read_unlock_bh) +DUMMY(-1, release_net) +DUMMY(0, rtnl_dereference) +DUMMY(-1, seq_printf) +DUMMY(0, smp_mb) +DUMMY(0, smp_mb__before_clear_bit) +DUMMY(0, smp_processor_id) +DUMMY(0, smp_rmb) +DUMMY(0, sock_net) +DUMMY(0, sock_release) +DUMMY(0, spin_trylock) +DUMMY(0, sscanf) +DUMMY(0, synchronize_irq) +DUMMY(0, synchronize_rcu_expedited) +DUMMY(0, tasklet_disable) +DUMMY(0, tasklet_enable) +DUMMY(0, tasklet_kill) +DUMMY(0, tcp_hdrlen) +DUMMY(0, this_cpu_dec) +DUMMY(0, this_cpu_inc) +DUMMY(0, toupper) +DUMMY(0, wait_event_interruptible) +DUMMY(0, work_busy) +DUMMY(0, class_register) +DUMMY(0, class_unregister) +DUMMY(0, debugfs_remove) +DUMMY(0, dev_set_uevent_suppress) +DUMMY(0, ethtool_op_get_link) +DUMMY(0, genl_register_family_with_ops) +DUMMY(0, genl_register_mc_group) +DUMMY(0, init_utsname) +DUMMY(0, platform_device_unregister) +DUMMY(0, atomic_notifier_chain_register) +DUMMY(0, __get_free_pages) +DUMMY(0, __get_free_page) +DUMMY(0, __set_current_state) +DUMMY(0, add_wait_queue) +DUMMY(0, add_wait_queue_exclusive) +DUMMY(0, atomic_notifier_call_chain) +DUMMY(0, cond_resched) +DUMMY(0, current) +DUMMY(0, debug_check_no_locks_freed) +DUMMY(0, get_user) +DUMMY(0, jhash_1word) +DUMMY(0, kernel_sendmsg) +DUMMY(0, put_cmsg) +DUMMY(0, put_cred) +DUMMY(0, put_pid) +DUMMY(0, remove_wait_queue) +DUMMY(0, schedule) +DUMMY(-1, security_sk_free) +DUMMY(0, set_current_state) +DUMMY(0, signal_pending) +DUMMY(0, smp_wmb) +DUMMY(0, sock_update_classid) +DUMMY(0, sock_update_netprioidx) +DUMMY(0, sock_wake_async) +DUMMY(0, static_key_slow_dec) +DUMMY(0, task_tgid_vnr) +DUMMY(0, totalram_pages) +DUMMY(0, wake_up_interruptible_poll) + +DUMMY(-1, __this_cpu_write) +DUMMY(-1, csum_block_add_ext) +DUMMY(-1, csum_partial_ext) +DUMMY(-1, genl_register_family_with_ops_groups) +DUMMY(-1, ktime_sub) +DUMMY(-1, sg_init_one) +DUMMY(-1, sg_init_table) +DUMMY(-1, sg_set_buf) +DUMMY(-1, vlan_hw_offload_capable) +DUMMY(-1, vlan_tx_tag_get_id) +DUMMY(-1, vzalloc) +DUMMY(-1, tsk_restore_flags) +DUMMY(-1, put_user) + +DUMMY(-1, write_seqcount_begin) +DUMMY(-1, write_seqcount_end) +DUMMY(-1, net_dmaengine_get) +DUMMY(-1, audit_enabled) +DUMMY(-1, audit_get_sessionid) +DUMMY(-1, audit_get_loginuid) +DUMMY(-1, init_user_ns) +DUMMY(-1, from_kgid) +DUMMY(-1, from_kuid) +DUMMY(-1, pci_num_vf) +DUMMY(-1, audit_log) +DUMMY(-1, linkwatch_forget_dev) +DUMMY(-1, linkwatch_run_queue) +DUMMY(-1, on_each_cpu) +DUMMY(-1, kobject_put) +DUMMY(-1, mq_qdisc_ops) +DUMMY(-1, get_net_ns_by_pid) +DUMMY(-1, get_net_ns_by_fd) +DUMMY(-1, unregister_pernet_device) + +DUMMY(0, __hw_addr_init) +DUMMY(0, __hw_addr_sync) +DUMMY(0, __hw_addr_unsync) +DUMMY(0, dev_alloc_name) +DUMMY(0, dev_change_net_namespace) +DUMMY(0, dev_close) +DUMMY(0, dev_kfree_skb_any) +DUMMY(0, dev_net_set) +DUMMY(0, dev_open) +DUMMY_SKIP(0, dev_hold) +DUMMY_SKIP(0, dev_put) +DUMMY(0, dst_release) +DUMMY(0, free_netdev) +DUMMY(0, net_disable_timestamp) +DUMMY(0, netdev_set_default_ethtool_ops) +DUMMY(0, netif_rx_ni) +DUMMY(0, netif_start_subqueue) +DUMMY(0, netif_stop_subqueue) +DUMMY(0, netif_tx_start_all_queues) +DUMMY(0, netif_tx_stop_all_queues) +DUMMY(0, netif_wake_subqueue) +DUMMY(0, next_net_device) +DUMMY(0, synchronize_net) +DUMMY(0, unregister_netdevice_many) +DUMMY(0, unregister_netdevice_notifier) +DUMMY(0, unregister_netdevice_queue) +DUMMY(-1, task_pid_nr) +DUMMY(-1, pid_vnr) +DUMMY(-1, from_kuid_munged) +DUMMY(-1, from_kgid_munged) +DUMMY(-1, sk_get_filter) +DUMMY(-1, sk_detach_filter) +DUMMY(-1, cond_resched_softirq) +DUMMY(-1, prefetch) +DUMMY(-1, security_socket_getpeersec_stream) +DUMMY(-1, net_enable_timestamp) +DUMMY(-1, __lock_sock) +DUMMY(-1, bpf_tell_extensions) + +DUMMY(0, atomic64_set) +DUMMY(0, device_can_wakeup) +DUMMY(0, device_reprobe) +DUMMY(0, device_set_wakeup_enable) +DUMMY(0, ip_fast_csum) +DUMMY(0, iwl_mvm_sf_update) +DUMMY(0, prandom_u32) +DUMMY(0, request_firmware) +DUMMY(0, tcp_v4_check) +DUMMY(0, netif_rx) +DUMMY(0, sk_attach_filter) + +DUMMY(0, __class_create) +DUMMY(0, __module_get) +DUMMY(0, __sock_recv_timestamp) +DUMMY(0, __sock_recv_wifi_status) +DUMMY(0, _sigprocmask) +DUMMY(0, acpi_match_device) +DUMMY(0, atomic_notifier_chain_unregister) +DUMMY(0, can_checksum_protocol) +DUMMY(0, class_destroy) +DUMMY(0, clk_disable) +DUMMY(0, clk_enable) +DUMMY(0, csum_ipv6_magic) +DUMMY(0, csum_partial_copy) +DUMMY(0, csum_sub) +DUMMY(0, csum_tcpudp_nofold) +DUMMY(0, devm_clk_get) +DUMMY(0, devm_gpiod_get_index) +DUMMY(0, devm_kzalloc) +DUMMY(0, file_inode) +DUMMY(0, gpiod_direction_output) +DUMMY(0, gpiod_set_value) +DUMMY(0, hex_dump_to_buffer) +DUMMY(0, __ilog2_u32) +DUMMY(0, __ilog2_u64) +DUMMY(0, input_close_device) +DUMMY(0, input_open_device) +DUMMY(0, input_register_handle) +DUMMY(0, input_register_handler) +DUMMY(0, input_unregister_handle) +DUMMY(0, input_unregister_handler) +DUMMY(0, ip_hdrlen) +DUMMY(0, ipv6_authlen) +DUMMY(0, ipv6_optlen) +DUMMY(0, ktime_to_timespec) +DUMMY(0, ktime_to_timeval) +DUMMY(0, misc_deregister) +DUMMY(0, net_gso_ok) +DUMMY(0, nosteal_pipe_buf_ops) +DUMMY(0, pci_unregister_driver) +DUMMY(0, platform_get_drvdata) +DUMMY(0, platform_set_drvdata) +DUMMY(0, regulator_disable) +DUMMY(0, regulator_enable) +DUMMY(0, regulator_get_exclusive) +DUMMY(0, regulator_is_enabled) +DUMMY(0, regulator_put) +DUMMY(0, rfkill_epo) +DUMMY(0, rfkill_get_global_sw_state) +DUMMY(0, rfkill_is_epo_lock_active) +DUMMY(0, rfkill_remove_epo_lock) +DUMMY(0, rfkill_restore_states) +DUMMY(0, rfkill_switch_all) +DUMMY(0, send_sigurg) +DUMMY(0, sg_mark_end) +DUMMY(0, sg_set_page) +DUMMY(0, simple_strtoul) +DUMMY(0, skb_gro_len) +DUMMY(0, skb_gro_offset) +DUMMY(0, skb_network_protocol) +DUMMY(0, spin_lock_nested) +DUMMY(0, splice_to_pipe) +DUMMY(0, static_key_slow_inc) +DUMMY(0, tcp_hdr) +DUMMY(0, textsearch_find) +DUMMY(0, udp_hdr) +DUMMY(0, virt_to_page) +DUMMY(0, xfrm_sk_clone_policy) +DUMMY(0, xfrm_sk_free_policy) +DUMMY(0, strncpy) + +DUMMY(0, __ethtool_get_settings) +DUMMY(0, __netif_tx_lock_bh) +DUMMY(0, __netif_tx_unlock_bh) +DUMMY(0, __skb_get_hash) +DUMMY(0, __sock_recv_ts_and_drops) +DUMMY(0, cpu_relax) +DUMMY(0, dev_get_by_index_rcu) +DUMMY(0, dev_get_by_name) +DUMMY(0, dev_get_by_name_rcu) +DUMMY(0, dev_mc_add) +DUMMY(0, dev_mc_del) +DUMMY(0, dev_remove_pack) +DUMMY(0, dev_set_allmulti) +DUMMY(0, dev_set_promiscuity) +DUMMY(0, dev_uc_add) +DUMMY(0, dev_uc_del) +DUMMY(0, dev_xmit_complete) +DUMMY(0, ethtool_cmd_speed) +DUMMY(0, flush_dcache_page) +DUMMY(0, getnstimeofday) +DUMMY(0, ip_check_defrag) +DUMMY(0, ktime_to_timespec_cond) +DUMMY(0, netdev_get_tx_queue) +DUMMY(0, netif_skb_features) +DUMMY(0, netif_supports_nofcs) +DUMMY(0, netif_xmit_frozen_or_stopped) +DUMMY(0, offset_in_page) +DUMMY(0, prandom_u32_max) +DUMMY(0, raw_smp_processor_id) +DUMMY(0, sk_run_filter) +DUMMY(0, skb_flow_dissect) +DUMMY(0, sock_unregister) +DUMMY(0, txq_trans_update) +DUMMY(0, unregister_pernet_subsys) +DUMMY(0, vm_insert_page) +DUMMY(0, vmalloc_to_page) + +DUMMY(0, __dev_change_flags) +DUMMY(0, __dev_get_by_name) +DUMMY(0, __dev_notify_flags) +DUMMY(0, call_netdevice_notifiers) +DUMMY(0, dev_base_lock) +DUMMY(0, dev_change_carrier) +DUMMY(0, dev_change_flags) +DUMMY(0, dev_change_name) +DUMMY(0, dev_get_flags) +DUMMY(0, dev_get_phys_port_id) +DUMMY(0, dev_get_stats) +DUMMY(0, dev_mc_add_excl) +DUMMY(0, dev_set_alias) +DUMMY(0, dev_set_group) +DUMMY(0, dev_set_mac_address) +DUMMY(0, dev_set_mtu) +DUMMY(0, dev_uc_add_excl) +DUMMY(0, is_link_local_ether_addr) +DUMMY(0, jiffies_to_clock_t) +DUMMY(0, netdev_boot_setup) +DUMMY(0, netdev_master_upper_dev_get) +DUMMY(0, netdev_state_change) +DUMMY(0, netdev_unregistering_wq) +DUMMY(0, netif_dormant) + +DUMMY(0, autoremove_wake_function) +DUMMY(0, get_user_pages_fast) +DUMMY(0, iov_length) +DUMMY(0, memcpy_toiovecend) +DUMMY(0, netdev_rx_csum_fault) +DUMMY(0, release_pages) +DUMMY(0, sk_busy_loop) +DUMMY(0, sk_can_busy_loop) + +DUMMY(0, sg_next) +DUMMY(0, complete_all) +DUMMY(0, module_put_and_exit) +DUMMY(0, simple_strtol) +DUMMY(0, alg_test) + +DUMMY(0, alloc_workqueue) + +} /* extern "C" */ diff --git a/repos/dde_linux/src/lib/wifi/event.cc b/repos/dde_linux/src/lib/wifi/event.cc new file mode 100644 index 000000000..83f5b1816 --- /dev/null +++ b/repos/dde_linux/src/lib/wifi/event.cc @@ -0,0 +1,198 @@ +/* + * \brief Completions and events + * \author Christian Helmuth + * \author Josef Soentgen + * \date 2014-10-14 + */ + +/* + * Copyright (C) 2014 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +/* Genode includes */ +#include + +/* local includes */ +#include +#include + +#include +# include +#include + +static bool const verbose = false; +#define PWRNV(...) do { if (verbose) PWRN(__VA_ARGS__); } while (0) + +extern "C" { + +/************************ + ** linux/completion.h ** + ************************/ + +typedef Lx::Task::List_element Wait_le; +typedef Lx::Task::List Wait_list; + +void init_waitqueue_head(wait_queue_head_t *wq) +{ + wq->list = new (Genode::env()->heap()) Wait_list; +} + + +int waitqueue_active(wait_queue_head_t *wq) +{ + Wait_list *list = static_cast(wq->list); + if (!list) + return 0; + + return list->first() ? 1 : 0; +} + + +void __wake_up(wait_queue_head_t *wq, bool all) +{ + Wait_list *list = static_cast(wq->list); + if (!list) { + PWRNV("wait_queue_head_t is empty, wq: %p called from: %p", wq, __builtin_return_address(0)); + return; + } + + Wait_le *le = list->first(); + do { + if (!le) + return; + + le->object()->unblock(); + } while (all && (le = le->next())); +} + + +void wake_up_interruptible_sync_poll(wait_queue_head_t *wq, int) +{ + __wake_up(wq, false); +} + + +void __wait_event(wait_queue_head_t wq) +{ + Wait_list *list = static_cast(wq.list); + if (!list) { + PERR("__wait_event(): empty list in wq: %p", &wq); + Genode::sleep_forever(); + } + + Lx::Task *task = Lx::scheduler().current(); + + task->wait_enqueue(list); + task->block_and_schedule(); + task->wait_dequeue(list); +} + + +void init_completion(struct completion *work) +{ + work->done = 0; +} + + +void complete(struct completion *work) +{ + work->done = 1; +} + + +static void __wait_completion(struct completion *work) +{ + // PERR("%s:%d: FIXME", __func__, __LINE__); +} + + +unsigned long wait_for_completion_timeout(struct completion *work, + unsigned long timeout) +{ + __wait_completion(work); + return 1; +} + + +int wait_for_completion_interruptible(struct completion *work) +{ + __wait_completion(work); + return 0; +} + + +long wait_for_completion_interruptible_timeout(struct completion *work, + unsigned long timeout) +{ + __wait_completion(work); + return 1; +} + + +void wait_for_completion(struct completion *work) +{ + __wait_completion(work); +} + + +/****************** + ** linux/wait.h ** + ******************/ + +void prepare_to_wait(wait_queue_head_t *q, wait_queue_t *w, int state) +{ + if (!q) { + PWRNV("prepare_to_wait: wait_queue_head_t is 0, ignore, called from: %p", + __builtin_return_address(0)); + return; + } + + Wait_list *list = static_cast(q->list); + Lx::Task *task = Lx::scheduler().current(); + + task->wait_enqueue(list); +} + + +void prepare_to_wait_exclusive(wait_queue_head_t *q, wait_queue_t *w, int state) +{ + prepare_to_wait(q, w, state); +} + + +void finish_wait(wait_queue_head_t *q, wait_queue_t *w) +{ + if (!q) { + PWRNV("finish_wait: wait_queue_head_t is 0, ignore, called from: %p", + __builtin_return_address(0)); + return; + } + + Wait_list *list = static_cast(q->list); + Lx::Task *task = Lx::scheduler().current(); + + task->wait_dequeue(list); +} + + +/******************* + ** linux/timer.h ** + *******************/ + +signed long schedule_timeout_uninterruptible(signed long timeout) +{ + // PERR("%s:%d: FIXME", __func__, __LINE__); + return 0; +} + + +int wake_up_process(struct task_struct *tsk) +{ + // PERR("%s:%d: FIXME does task: %p needs to be woken up?", __func__, __LINE__, tsk); + return 0; +} + +} /* extern "C" */ diff --git a/repos/dde_linux/src/lib/wifi/include/crc32table.h b/repos/dde_linux/src/lib/wifi/include/crc32table.h new file mode 100644 index 000000000..a9da51ae9 --- /dev/null +++ b/repos/dde_linux/src/lib/wifi/include/crc32table.h @@ -0,0 +1,1565 @@ +/* this file is generated - do not edit */ + +static u32 __cacheline_aligned crc32table_le[8][256] = {{ +tole(0x00000000L), tole(0x77073096L), tole(0xee0e612cL), tole(0x990951baL), +tole(0x076dc419L), tole(0x706af48fL), tole(0xe963a535L), tole(0x9e6495a3L), +tole(0x0edb8832L), tole(0x79dcb8a4L), tole(0xe0d5e91eL), tole(0x97d2d988L), +tole(0x09b64c2bL), tole(0x7eb17cbdL), tole(0xe7b82d07L), tole(0x90bf1d91L), +tole(0x1db71064L), tole(0x6ab020f2L), tole(0xf3b97148L), tole(0x84be41deL), +tole(0x1adad47dL), tole(0x6ddde4ebL), tole(0xf4d4b551L), tole(0x83d385c7L), +tole(0x136c9856L), tole(0x646ba8c0L), tole(0xfd62f97aL), tole(0x8a65c9ecL), +tole(0x14015c4fL), tole(0x63066cd9L), tole(0xfa0f3d63L), tole(0x8d080df5L), +tole(0x3b6e20c8L), tole(0x4c69105eL), tole(0xd56041e4L), tole(0xa2677172L), +tole(0x3c03e4d1L), tole(0x4b04d447L), tole(0xd20d85fdL), tole(0xa50ab56bL), +tole(0x35b5a8faL), tole(0x42b2986cL), tole(0xdbbbc9d6L), tole(0xacbcf940L), +tole(0x32d86ce3L), tole(0x45df5c75L), tole(0xdcd60dcfL), tole(0xabd13d59L), +tole(0x26d930acL), tole(0x51de003aL), tole(0xc8d75180L), tole(0xbfd06116L), +tole(0x21b4f4b5L), tole(0x56b3c423L), tole(0xcfba9599L), tole(0xb8bda50fL), +tole(0x2802b89eL), tole(0x5f058808L), tole(0xc60cd9b2L), tole(0xb10be924L), +tole(0x2f6f7c87L), tole(0x58684c11L), tole(0xc1611dabL), tole(0xb6662d3dL), +tole(0x76dc4190L), tole(0x01db7106L), tole(0x98d220bcL), tole(0xefd5102aL), +tole(0x71b18589L), tole(0x06b6b51fL), tole(0x9fbfe4a5L), tole(0xe8b8d433L), +tole(0x7807c9a2L), tole(0x0f00f934L), tole(0x9609a88eL), tole(0xe10e9818L), +tole(0x7f6a0dbbL), tole(0x086d3d2dL), tole(0x91646c97L), tole(0xe6635c01L), +tole(0x6b6b51f4L), tole(0x1c6c6162L), tole(0x856530d8L), tole(0xf262004eL), +tole(0x6c0695edL), tole(0x1b01a57bL), tole(0x8208f4c1L), tole(0xf50fc457L), +tole(0x65b0d9c6L), tole(0x12b7e950L), tole(0x8bbeb8eaL), tole(0xfcb9887cL), +tole(0x62dd1ddfL), tole(0x15da2d49L), tole(0x8cd37cf3L), tole(0xfbd44c65L), +tole(0x4db26158L), tole(0x3ab551ceL), tole(0xa3bc0074L), tole(0xd4bb30e2L), +tole(0x4adfa541L), tole(0x3dd895d7L), tole(0xa4d1c46dL), tole(0xd3d6f4fbL), +tole(0x4369e96aL), tole(0x346ed9fcL), tole(0xad678846L), tole(0xda60b8d0L), +tole(0x44042d73L), tole(0x33031de5L), tole(0xaa0a4c5fL), tole(0xdd0d7cc9L), +tole(0x5005713cL), tole(0x270241aaL), tole(0xbe0b1010L), tole(0xc90c2086L), +tole(0x5768b525L), tole(0x206f85b3L), tole(0xb966d409L), tole(0xce61e49fL), +tole(0x5edef90eL), tole(0x29d9c998L), tole(0xb0d09822L), tole(0xc7d7a8b4L), +tole(0x59b33d17L), tole(0x2eb40d81L), tole(0xb7bd5c3bL), tole(0xc0ba6cadL), +tole(0xedb88320L), tole(0x9abfb3b6L), tole(0x03b6e20cL), tole(0x74b1d29aL), +tole(0xead54739L), tole(0x9dd277afL), tole(0x04db2615L), tole(0x73dc1683L), +tole(0xe3630b12L), tole(0x94643b84L), tole(0x0d6d6a3eL), tole(0x7a6a5aa8L), +tole(0xe40ecf0bL), tole(0x9309ff9dL), tole(0x0a00ae27L), tole(0x7d079eb1L), +tole(0xf00f9344L), tole(0x8708a3d2L), tole(0x1e01f268L), tole(0x6906c2feL), +tole(0xf762575dL), tole(0x806567cbL), tole(0x196c3671L), tole(0x6e6b06e7L), +tole(0xfed41b76L), tole(0x89d32be0L), tole(0x10da7a5aL), tole(0x67dd4accL), +tole(0xf9b9df6fL), tole(0x8ebeeff9L), tole(0x17b7be43L), tole(0x60b08ed5L), +tole(0xd6d6a3e8L), tole(0xa1d1937eL), tole(0x38d8c2c4L), tole(0x4fdff252L), +tole(0xd1bb67f1L), tole(0xa6bc5767L), tole(0x3fb506ddL), tole(0x48b2364bL), +tole(0xd80d2bdaL), tole(0xaf0a1b4cL), tole(0x36034af6L), tole(0x41047a60L), +tole(0xdf60efc3L), tole(0xa867df55L), tole(0x316e8eefL), tole(0x4669be79L), +tole(0xcb61b38cL), tole(0xbc66831aL), tole(0x256fd2a0L), tole(0x5268e236L), +tole(0xcc0c7795L), tole(0xbb0b4703L), tole(0x220216b9L), tole(0x5505262fL), +tole(0xc5ba3bbeL), tole(0xb2bd0b28L), tole(0x2bb45a92L), tole(0x5cb36a04L), +tole(0xc2d7ffa7L), tole(0xb5d0cf31L), tole(0x2cd99e8bL), tole(0x5bdeae1dL), +tole(0x9b64c2b0L), tole(0xec63f226L), tole(0x756aa39cL), tole(0x026d930aL), +tole(0x9c0906a9L), tole(0xeb0e363fL), tole(0x72076785L), tole(0x05005713L), +tole(0x95bf4a82L), tole(0xe2b87a14L), tole(0x7bb12baeL), tole(0x0cb61b38L), +tole(0x92d28e9bL), tole(0xe5d5be0dL), tole(0x7cdcefb7L), tole(0x0bdbdf21L), +tole(0x86d3d2d4L), tole(0xf1d4e242L), tole(0x68ddb3f8L), tole(0x1fda836eL), +tole(0x81be16cdL), tole(0xf6b9265bL), tole(0x6fb077e1L), tole(0x18b74777L), +tole(0x88085ae6L), tole(0xff0f6a70L), tole(0x66063bcaL), tole(0x11010b5cL), +tole(0x8f659effL), tole(0xf862ae69L), tole(0x616bffd3L), tole(0x166ccf45L), +tole(0xa00ae278L), tole(0xd70dd2eeL), tole(0x4e048354L), tole(0x3903b3c2L), +tole(0xa7672661L), tole(0xd06016f7L), tole(0x4969474dL), tole(0x3e6e77dbL), +tole(0xaed16a4aL), tole(0xd9d65adcL), tole(0x40df0b66L), tole(0x37d83bf0L), +tole(0xa9bcae53L), tole(0xdebb9ec5L), tole(0x47b2cf7fL), tole(0x30b5ffe9L), +tole(0xbdbdf21cL), tole(0xcabac28aL), tole(0x53b39330L), tole(0x24b4a3a6L), +tole(0xbad03605L), tole(0xcdd70693L), tole(0x54de5729L), tole(0x23d967bfL), +tole(0xb3667a2eL), tole(0xc4614ab8L), tole(0x5d681b02L), tole(0x2a6f2b94L), +tole(0xb40bbe37L), tole(0xc30c8ea1L), tole(0x5a05df1bL), tole(0x2d02ef8dL)}, +{ +tole(0x00000000L), tole(0x191b3141L), tole(0x32366282L), tole(0x2b2d53c3L), +tole(0x646cc504L), tole(0x7d77f445L), tole(0x565aa786L), tole(0x4f4196c7L), +tole(0xc8d98a08L), tole(0xd1c2bb49L), tole(0xfaefe88aL), tole(0xe3f4d9cbL), +tole(0xacb54f0cL), tole(0xb5ae7e4dL), tole(0x9e832d8eL), tole(0x87981ccfL), +tole(0x4ac21251L), tole(0x53d92310L), tole(0x78f470d3L), tole(0x61ef4192L), +tole(0x2eaed755L), tole(0x37b5e614L), tole(0x1c98b5d7L), tole(0x05838496L), +tole(0x821b9859L), tole(0x9b00a918L), tole(0xb02dfadbL), tole(0xa936cb9aL), +tole(0xe6775d5dL), tole(0xff6c6c1cL), tole(0xd4413fdfL), tole(0xcd5a0e9eL), +tole(0x958424a2L), tole(0x8c9f15e3L), tole(0xa7b24620L), tole(0xbea97761L), +tole(0xf1e8e1a6L), tole(0xe8f3d0e7L), tole(0xc3de8324L), tole(0xdac5b265L), +tole(0x5d5daeaaL), tole(0x44469febL), tole(0x6f6bcc28L), tole(0x7670fd69L), +tole(0x39316baeL), tole(0x202a5aefL), tole(0x0b07092cL), tole(0x121c386dL), +tole(0xdf4636f3L), tole(0xc65d07b2L), tole(0xed705471L), tole(0xf46b6530L), +tole(0xbb2af3f7L), tole(0xa231c2b6L), tole(0x891c9175L), tole(0x9007a034L), +tole(0x179fbcfbL), tole(0x0e848dbaL), tole(0x25a9de79L), tole(0x3cb2ef38L), +tole(0x73f379ffL), tole(0x6ae848beL), tole(0x41c51b7dL), tole(0x58de2a3cL), +tole(0xf0794f05L), tole(0xe9627e44L), tole(0xc24f2d87L), tole(0xdb541cc6L), +tole(0x94158a01L), tole(0x8d0ebb40L), tole(0xa623e883L), tole(0xbf38d9c2L), +tole(0x38a0c50dL), tole(0x21bbf44cL), tole(0x0a96a78fL), tole(0x138d96ceL), +tole(0x5ccc0009L), tole(0x45d73148L), tole(0x6efa628bL), tole(0x77e153caL), +tole(0xbabb5d54L), tole(0xa3a06c15L), tole(0x888d3fd6L), tole(0x91960e97L), +tole(0xded79850L), tole(0xc7cca911L), tole(0xece1fad2L), tole(0xf5facb93L), +tole(0x7262d75cL), tole(0x6b79e61dL), tole(0x4054b5deL), tole(0x594f849fL), +tole(0x160e1258L), tole(0x0f152319L), tole(0x243870daL), tole(0x3d23419bL), +tole(0x65fd6ba7L), tole(0x7ce65ae6L), tole(0x57cb0925L), tole(0x4ed03864L), +tole(0x0191aea3L), tole(0x188a9fe2L), tole(0x33a7cc21L), tole(0x2abcfd60L), +tole(0xad24e1afL), tole(0xb43fd0eeL), tole(0x9f12832dL), tole(0x8609b26cL), +tole(0xc94824abL), tole(0xd05315eaL), tole(0xfb7e4629L), tole(0xe2657768L), +tole(0x2f3f79f6L), tole(0x362448b7L), tole(0x1d091b74L), tole(0x04122a35L), +tole(0x4b53bcf2L), tole(0x52488db3L), tole(0x7965de70L), tole(0x607eef31L), +tole(0xe7e6f3feL), tole(0xfefdc2bfL), tole(0xd5d0917cL), tole(0xcccba03dL), +tole(0x838a36faL), tole(0x9a9107bbL), tole(0xb1bc5478L), tole(0xa8a76539L), +tole(0x3b83984bL), tole(0x2298a90aL), tole(0x09b5fac9L), tole(0x10aecb88L), +tole(0x5fef5d4fL), tole(0x46f46c0eL), tole(0x6dd93fcdL), tole(0x74c20e8cL), +tole(0xf35a1243L), tole(0xea412302L), tole(0xc16c70c1L), tole(0xd8774180L), +tole(0x9736d747L), tole(0x8e2de606L), tole(0xa500b5c5L), tole(0xbc1b8484L), +tole(0x71418a1aL), tole(0x685abb5bL), tole(0x4377e898L), tole(0x5a6cd9d9L), +tole(0x152d4f1eL), tole(0x0c367e5fL), tole(0x271b2d9cL), tole(0x3e001cddL), +tole(0xb9980012L), tole(0xa0833153L), tole(0x8bae6290L), tole(0x92b553d1L), +tole(0xddf4c516L), tole(0xc4eff457L), tole(0xefc2a794L), tole(0xf6d996d5L), +tole(0xae07bce9L), tole(0xb71c8da8L), tole(0x9c31de6bL), tole(0x852aef2aL), +tole(0xca6b79edL), tole(0xd37048acL), tole(0xf85d1b6fL), tole(0xe1462a2eL), +tole(0x66de36e1L), tole(0x7fc507a0L), tole(0x54e85463L), tole(0x4df36522L), +tole(0x02b2f3e5L), tole(0x1ba9c2a4L), tole(0x30849167L), tole(0x299fa026L), +tole(0xe4c5aeb8L), tole(0xfdde9ff9L), tole(0xd6f3cc3aL), tole(0xcfe8fd7bL), +tole(0x80a96bbcL), tole(0x99b25afdL), tole(0xb29f093eL), tole(0xab84387fL), +tole(0x2c1c24b0L), tole(0x350715f1L), tole(0x1e2a4632L), tole(0x07317773L), +tole(0x4870e1b4L), tole(0x516bd0f5L), tole(0x7a468336L), tole(0x635db277L), +tole(0xcbfad74eL), tole(0xd2e1e60fL), tole(0xf9ccb5ccL), tole(0xe0d7848dL), +tole(0xaf96124aL), tole(0xb68d230bL), tole(0x9da070c8L), tole(0x84bb4189L), +tole(0x03235d46L), tole(0x1a386c07L), tole(0x31153fc4L), tole(0x280e0e85L), +tole(0x674f9842L), tole(0x7e54a903L), tole(0x5579fac0L), tole(0x4c62cb81L), +tole(0x8138c51fL), tole(0x9823f45eL), tole(0xb30ea79dL), tole(0xaa1596dcL), +tole(0xe554001bL), tole(0xfc4f315aL), tole(0xd7626299L), tole(0xce7953d8L), +tole(0x49e14f17L), tole(0x50fa7e56L), tole(0x7bd72d95L), tole(0x62cc1cd4L), +tole(0x2d8d8a13L), tole(0x3496bb52L), tole(0x1fbbe891L), tole(0x06a0d9d0L), +tole(0x5e7ef3ecL), tole(0x4765c2adL), tole(0x6c48916eL), tole(0x7553a02fL), +tole(0x3a1236e8L), tole(0x230907a9L), tole(0x0824546aL), tole(0x113f652bL), +tole(0x96a779e4L), tole(0x8fbc48a5L), tole(0xa4911b66L), tole(0xbd8a2a27L), +tole(0xf2cbbce0L), tole(0xebd08da1L), tole(0xc0fdde62L), tole(0xd9e6ef23L), +tole(0x14bce1bdL), tole(0x0da7d0fcL), tole(0x268a833fL), tole(0x3f91b27eL), +tole(0x70d024b9L), tole(0x69cb15f8L), tole(0x42e6463bL), tole(0x5bfd777aL), +tole(0xdc656bb5L), tole(0xc57e5af4L), tole(0xee530937L), tole(0xf7483876L), +tole(0xb809aeb1L), tole(0xa1129ff0L), tole(0x8a3fcc33L), tole(0x9324fd72L)}, +{ +tole(0x00000000L), tole(0x01c26a37L), tole(0x0384d46eL), tole(0x0246be59L), +tole(0x0709a8dcL), tole(0x06cbc2ebL), tole(0x048d7cb2L), tole(0x054f1685L), +tole(0x0e1351b8L), tole(0x0fd13b8fL), tole(0x0d9785d6L), tole(0x0c55efe1L), +tole(0x091af964L), tole(0x08d89353L), tole(0x0a9e2d0aL), tole(0x0b5c473dL), +tole(0x1c26a370L), tole(0x1de4c947L), tole(0x1fa2771eL), tole(0x1e601d29L), +tole(0x1b2f0bacL), tole(0x1aed619bL), tole(0x18abdfc2L), tole(0x1969b5f5L), +tole(0x1235f2c8L), tole(0x13f798ffL), tole(0x11b126a6L), tole(0x10734c91L), +tole(0x153c5a14L), tole(0x14fe3023L), tole(0x16b88e7aL), tole(0x177ae44dL), +tole(0x384d46e0L), tole(0x398f2cd7L), tole(0x3bc9928eL), tole(0x3a0bf8b9L), +tole(0x3f44ee3cL), tole(0x3e86840bL), tole(0x3cc03a52L), tole(0x3d025065L), +tole(0x365e1758L), tole(0x379c7d6fL), tole(0x35dac336L), tole(0x3418a901L), +tole(0x3157bf84L), tole(0x3095d5b3L), tole(0x32d36beaL), tole(0x331101ddL), +tole(0x246be590L), tole(0x25a98fa7L), tole(0x27ef31feL), tole(0x262d5bc9L), +tole(0x23624d4cL), tole(0x22a0277bL), tole(0x20e69922L), tole(0x2124f315L), +tole(0x2a78b428L), tole(0x2bbade1fL), tole(0x29fc6046L), tole(0x283e0a71L), +tole(0x2d711cf4L), tole(0x2cb376c3L), tole(0x2ef5c89aL), tole(0x2f37a2adL), +tole(0x709a8dc0L), tole(0x7158e7f7L), tole(0x731e59aeL), tole(0x72dc3399L), +tole(0x7793251cL), tole(0x76514f2bL), tole(0x7417f172L), tole(0x75d59b45L), +tole(0x7e89dc78L), tole(0x7f4bb64fL), tole(0x7d0d0816L), tole(0x7ccf6221L), +tole(0x798074a4L), tole(0x78421e93L), tole(0x7a04a0caL), tole(0x7bc6cafdL), +tole(0x6cbc2eb0L), tole(0x6d7e4487L), tole(0x6f38fadeL), tole(0x6efa90e9L), +tole(0x6bb5866cL), tole(0x6a77ec5bL), tole(0x68315202L), tole(0x69f33835L), +tole(0x62af7f08L), tole(0x636d153fL), tole(0x612bab66L), tole(0x60e9c151L), +tole(0x65a6d7d4L), tole(0x6464bde3L), tole(0x662203baL), tole(0x67e0698dL), +tole(0x48d7cb20L), tole(0x4915a117L), tole(0x4b531f4eL), tole(0x4a917579L), +tole(0x4fde63fcL), tole(0x4e1c09cbL), tole(0x4c5ab792L), tole(0x4d98dda5L), +tole(0x46c49a98L), tole(0x4706f0afL), tole(0x45404ef6L), tole(0x448224c1L), +tole(0x41cd3244L), tole(0x400f5873L), tole(0x4249e62aL), tole(0x438b8c1dL), +tole(0x54f16850L), tole(0x55330267L), tole(0x5775bc3eL), tole(0x56b7d609L), +tole(0x53f8c08cL), tole(0x523aaabbL), tole(0x507c14e2L), tole(0x51be7ed5L), +tole(0x5ae239e8L), tole(0x5b2053dfL), tole(0x5966ed86L), tole(0x58a487b1L), +tole(0x5deb9134L), tole(0x5c29fb03L), tole(0x5e6f455aL), tole(0x5fad2f6dL), +tole(0xe1351b80L), tole(0xe0f771b7L), tole(0xe2b1cfeeL), tole(0xe373a5d9L), +tole(0xe63cb35cL), tole(0xe7fed96bL), tole(0xe5b86732L), tole(0xe47a0d05L), +tole(0xef264a38L), tole(0xeee4200fL), tole(0xeca29e56L), tole(0xed60f461L), +tole(0xe82fe2e4L), tole(0xe9ed88d3L), tole(0xebab368aL), tole(0xea695cbdL), +tole(0xfd13b8f0L), tole(0xfcd1d2c7L), tole(0xfe976c9eL), tole(0xff5506a9L), +tole(0xfa1a102cL), tole(0xfbd87a1bL), tole(0xf99ec442L), tole(0xf85cae75L), +tole(0xf300e948L), tole(0xf2c2837fL), tole(0xf0843d26L), tole(0xf1465711L), +tole(0xf4094194L), tole(0xf5cb2ba3L), tole(0xf78d95faL), tole(0xf64fffcdL), +tole(0xd9785d60L), tole(0xd8ba3757L), tole(0xdafc890eL), tole(0xdb3ee339L), +tole(0xde71f5bcL), tole(0xdfb39f8bL), tole(0xddf521d2L), tole(0xdc374be5L), +tole(0xd76b0cd8L), tole(0xd6a966efL), tole(0xd4efd8b6L), tole(0xd52db281L), +tole(0xd062a404L), tole(0xd1a0ce33L), tole(0xd3e6706aL), tole(0xd2241a5dL), +tole(0xc55efe10L), tole(0xc49c9427L), tole(0xc6da2a7eL), tole(0xc7184049L), +tole(0xc25756ccL), tole(0xc3953cfbL), tole(0xc1d382a2L), tole(0xc011e895L), +tole(0xcb4dafa8L), tole(0xca8fc59fL), tole(0xc8c97bc6L), tole(0xc90b11f1L), +tole(0xcc440774L), tole(0xcd866d43L), tole(0xcfc0d31aL), tole(0xce02b92dL), +tole(0x91af9640L), tole(0x906dfc77L), tole(0x922b422eL), tole(0x93e92819L), +tole(0x96a63e9cL), tole(0x976454abL), tole(0x9522eaf2L), tole(0x94e080c5L), +tole(0x9fbcc7f8L), tole(0x9e7eadcfL), tole(0x9c381396L), tole(0x9dfa79a1L), +tole(0x98b56f24L), tole(0x99770513L), tole(0x9b31bb4aL), tole(0x9af3d17dL), +tole(0x8d893530L), tole(0x8c4b5f07L), tole(0x8e0de15eL), tole(0x8fcf8b69L), +tole(0x8a809decL), tole(0x8b42f7dbL), tole(0x89044982L), tole(0x88c623b5L), +tole(0x839a6488L), tole(0x82580ebfL), tole(0x801eb0e6L), tole(0x81dcdad1L), +tole(0x8493cc54L), tole(0x8551a663L), tole(0x8717183aL), tole(0x86d5720dL), +tole(0xa9e2d0a0L), tole(0xa820ba97L), tole(0xaa6604ceL), tole(0xaba46ef9L), +tole(0xaeeb787cL), tole(0xaf29124bL), tole(0xad6fac12L), tole(0xacadc625L), +tole(0xa7f18118L), tole(0xa633eb2fL), tole(0xa4755576L), tole(0xa5b73f41L), +tole(0xa0f829c4L), tole(0xa13a43f3L), tole(0xa37cfdaaL), tole(0xa2be979dL), +tole(0xb5c473d0L), tole(0xb40619e7L), tole(0xb640a7beL), tole(0xb782cd89L), +tole(0xb2cddb0cL), tole(0xb30fb13bL), tole(0xb1490f62L), tole(0xb08b6555L), +tole(0xbbd72268L), tole(0xba15485fL), tole(0xb853f606L), tole(0xb9919c31L), +tole(0xbcde8ab4L), tole(0xbd1ce083L), tole(0xbf5a5edaL), tole(0xbe9834edL)}, +{ +tole(0x00000000L), tole(0xb8bc6765L), tole(0xaa09c88bL), tole(0x12b5afeeL), +tole(0x8f629757L), tole(0x37def032L), tole(0x256b5fdcL), tole(0x9dd738b9L), +tole(0xc5b428efL), tole(0x7d084f8aL), tole(0x6fbde064L), tole(0xd7018701L), +tole(0x4ad6bfb8L), tole(0xf26ad8ddL), tole(0xe0df7733L), tole(0x58631056L), +tole(0x5019579fL), tole(0xe8a530faL), tole(0xfa109f14L), tole(0x42acf871L), +tole(0xdf7bc0c8L), tole(0x67c7a7adL), tole(0x75720843L), tole(0xcdce6f26L), +tole(0x95ad7f70L), tole(0x2d111815L), tole(0x3fa4b7fbL), tole(0x8718d09eL), +tole(0x1acfe827L), tole(0xa2738f42L), tole(0xb0c620acL), tole(0x087a47c9L), +tole(0xa032af3eL), tole(0x188ec85bL), tole(0x0a3b67b5L), tole(0xb28700d0L), +tole(0x2f503869L), tole(0x97ec5f0cL), tole(0x8559f0e2L), tole(0x3de59787L), +tole(0x658687d1L), tole(0xdd3ae0b4L), tole(0xcf8f4f5aL), tole(0x7733283fL), +tole(0xeae41086L), tole(0x525877e3L), tole(0x40edd80dL), tole(0xf851bf68L), +tole(0xf02bf8a1L), tole(0x48979fc4L), tole(0x5a22302aL), tole(0xe29e574fL), +tole(0x7f496ff6L), tole(0xc7f50893L), tole(0xd540a77dL), tole(0x6dfcc018L), +tole(0x359fd04eL), tole(0x8d23b72bL), tole(0x9f9618c5L), tole(0x272a7fa0L), +tole(0xbafd4719L), tole(0x0241207cL), tole(0x10f48f92L), tole(0xa848e8f7L), +tole(0x9b14583dL), tole(0x23a83f58L), tole(0x311d90b6L), tole(0x89a1f7d3L), +tole(0x1476cf6aL), tole(0xaccaa80fL), tole(0xbe7f07e1L), tole(0x06c36084L), +tole(0x5ea070d2L), tole(0xe61c17b7L), tole(0xf4a9b859L), tole(0x4c15df3cL), +tole(0xd1c2e785L), tole(0x697e80e0L), tole(0x7bcb2f0eL), tole(0xc377486bL), +tole(0xcb0d0fa2L), tole(0x73b168c7L), tole(0x6104c729L), tole(0xd9b8a04cL), +tole(0x446f98f5L), tole(0xfcd3ff90L), tole(0xee66507eL), tole(0x56da371bL), +tole(0x0eb9274dL), tole(0xb6054028L), tole(0xa4b0efc6L), tole(0x1c0c88a3L), +tole(0x81dbb01aL), tole(0x3967d77fL), tole(0x2bd27891L), tole(0x936e1ff4L), +tole(0x3b26f703L), tole(0x839a9066L), tole(0x912f3f88L), tole(0x299358edL), +tole(0xb4446054L), tole(0x0cf80731L), tole(0x1e4da8dfL), tole(0xa6f1cfbaL), +tole(0xfe92dfecL), tole(0x462eb889L), tole(0x549b1767L), tole(0xec277002L), +tole(0x71f048bbL), tole(0xc94c2fdeL), tole(0xdbf98030L), tole(0x6345e755L), +tole(0x6b3fa09cL), tole(0xd383c7f9L), tole(0xc1366817L), tole(0x798a0f72L), +tole(0xe45d37cbL), tole(0x5ce150aeL), tole(0x4e54ff40L), tole(0xf6e89825L), +tole(0xae8b8873L), tole(0x1637ef16L), tole(0x048240f8L), tole(0xbc3e279dL), +tole(0x21e91f24L), tole(0x99557841L), tole(0x8be0d7afL), tole(0x335cb0caL), +tole(0xed59b63bL), tole(0x55e5d15eL), tole(0x47507eb0L), tole(0xffec19d5L), +tole(0x623b216cL), tole(0xda874609L), tole(0xc832e9e7L), tole(0x708e8e82L), +tole(0x28ed9ed4L), tole(0x9051f9b1L), tole(0x82e4565fL), tole(0x3a58313aL), +tole(0xa78f0983L), tole(0x1f336ee6L), tole(0x0d86c108L), tole(0xb53aa66dL), +tole(0xbd40e1a4L), tole(0x05fc86c1L), tole(0x1749292fL), tole(0xaff54e4aL), +tole(0x322276f3L), tole(0x8a9e1196L), tole(0x982bbe78L), tole(0x2097d91dL), +tole(0x78f4c94bL), tole(0xc048ae2eL), tole(0xd2fd01c0L), tole(0x6a4166a5L), +tole(0xf7965e1cL), tole(0x4f2a3979L), tole(0x5d9f9697L), tole(0xe523f1f2L), +tole(0x4d6b1905L), tole(0xf5d77e60L), tole(0xe762d18eL), tole(0x5fdeb6ebL), +tole(0xc2098e52L), tole(0x7ab5e937L), tole(0x680046d9L), tole(0xd0bc21bcL), +tole(0x88df31eaL), tole(0x3063568fL), tole(0x22d6f961L), tole(0x9a6a9e04L), +tole(0x07bda6bdL), tole(0xbf01c1d8L), tole(0xadb46e36L), tole(0x15080953L), +tole(0x1d724e9aL), tole(0xa5ce29ffL), tole(0xb77b8611L), tole(0x0fc7e174L), +tole(0x9210d9cdL), tole(0x2aacbea8L), tole(0x38191146L), tole(0x80a57623L), +tole(0xd8c66675L), tole(0x607a0110L), tole(0x72cfaefeL), tole(0xca73c99bL), +tole(0x57a4f122L), tole(0xef189647L), tole(0xfdad39a9L), tole(0x45115eccL), +tole(0x764dee06L), tole(0xcef18963L), tole(0xdc44268dL), tole(0x64f841e8L), +tole(0xf92f7951L), tole(0x41931e34L), tole(0x5326b1daL), tole(0xeb9ad6bfL), +tole(0xb3f9c6e9L), tole(0x0b45a18cL), tole(0x19f00e62L), tole(0xa14c6907L), +tole(0x3c9b51beL), tole(0x842736dbL), tole(0x96929935L), tole(0x2e2efe50L), +tole(0x2654b999L), tole(0x9ee8defcL), tole(0x8c5d7112L), tole(0x34e11677L), +tole(0xa9362eceL), tole(0x118a49abL), tole(0x033fe645L), tole(0xbb838120L), +tole(0xe3e09176L), tole(0x5b5cf613L), tole(0x49e959fdL), tole(0xf1553e98L), +tole(0x6c820621L), tole(0xd43e6144L), tole(0xc68bceaaL), tole(0x7e37a9cfL), +tole(0xd67f4138L), tole(0x6ec3265dL), tole(0x7c7689b3L), tole(0xc4caeed6L), +tole(0x591dd66fL), tole(0xe1a1b10aL), tole(0xf3141ee4L), tole(0x4ba87981L), +tole(0x13cb69d7L), tole(0xab770eb2L), tole(0xb9c2a15cL), tole(0x017ec639L), +tole(0x9ca9fe80L), tole(0x241599e5L), tole(0x36a0360bL), tole(0x8e1c516eL), +tole(0x866616a7L), tole(0x3eda71c2L), tole(0x2c6fde2cL), tole(0x94d3b949L), +tole(0x090481f0L), tole(0xb1b8e695L), tole(0xa30d497bL), tole(0x1bb12e1eL), +tole(0x43d23e48L), tole(0xfb6e592dL), tole(0xe9dbf6c3L), tole(0x516791a6L), +tole(0xccb0a91fL), tole(0x740cce7aL), tole(0x66b96194L), tole(0xde0506f1L)}, +{ +tole(0x00000000L), tole(0x3d6029b0L), tole(0x7ac05360L), tole(0x47a07ad0L), +tole(0xf580a6c0L), tole(0xc8e08f70L), tole(0x8f40f5a0L), tole(0xb220dc10L), +tole(0x30704bc1L), tole(0x0d106271L), tole(0x4ab018a1L), tole(0x77d03111L), +tole(0xc5f0ed01L), tole(0xf890c4b1L), tole(0xbf30be61L), tole(0x825097d1L), +tole(0x60e09782L), tole(0x5d80be32L), tole(0x1a20c4e2L), tole(0x2740ed52L), +tole(0x95603142L), tole(0xa80018f2L), tole(0xefa06222L), tole(0xd2c04b92L), +tole(0x5090dc43L), tole(0x6df0f5f3L), tole(0x2a508f23L), tole(0x1730a693L), +tole(0xa5107a83L), tole(0x98705333L), tole(0xdfd029e3L), tole(0xe2b00053L), +tole(0xc1c12f04L), tole(0xfca106b4L), tole(0xbb017c64L), tole(0x866155d4L), +tole(0x344189c4L), tole(0x0921a074L), tole(0x4e81daa4L), tole(0x73e1f314L), +tole(0xf1b164c5L), tole(0xccd14d75L), tole(0x8b7137a5L), tole(0xb6111e15L), +tole(0x0431c205L), tole(0x3951ebb5L), tole(0x7ef19165L), tole(0x4391b8d5L), +tole(0xa121b886L), tole(0x9c419136L), tole(0xdbe1ebe6L), tole(0xe681c256L), +tole(0x54a11e46L), tole(0x69c137f6L), tole(0x2e614d26L), tole(0x13016496L), +tole(0x9151f347L), tole(0xac31daf7L), tole(0xeb91a027L), tole(0xd6f18997L), +tole(0x64d15587L), tole(0x59b17c37L), tole(0x1e1106e7L), tole(0x23712f57L), +tole(0x58f35849L), tole(0x659371f9L), tole(0x22330b29L), tole(0x1f532299L), +tole(0xad73fe89L), tole(0x9013d739L), tole(0xd7b3ade9L), tole(0xead38459L), +tole(0x68831388L), tole(0x55e33a38L), tole(0x124340e8L), tole(0x2f236958L), +tole(0x9d03b548L), tole(0xa0639cf8L), tole(0xe7c3e628L), tole(0xdaa3cf98L), +tole(0x3813cfcbL), tole(0x0573e67bL), tole(0x42d39cabL), tole(0x7fb3b51bL), +tole(0xcd93690bL), tole(0xf0f340bbL), tole(0xb7533a6bL), tole(0x8a3313dbL), +tole(0x0863840aL), tole(0x3503adbaL), tole(0x72a3d76aL), tole(0x4fc3fedaL), +tole(0xfde322caL), tole(0xc0830b7aL), tole(0x872371aaL), tole(0xba43581aL), +tole(0x9932774dL), tole(0xa4525efdL), tole(0xe3f2242dL), tole(0xde920d9dL), +tole(0x6cb2d18dL), tole(0x51d2f83dL), tole(0x167282edL), tole(0x2b12ab5dL), +tole(0xa9423c8cL), tole(0x9422153cL), tole(0xd3826fecL), tole(0xeee2465cL), +tole(0x5cc29a4cL), tole(0x61a2b3fcL), tole(0x2602c92cL), tole(0x1b62e09cL), +tole(0xf9d2e0cfL), tole(0xc4b2c97fL), tole(0x8312b3afL), tole(0xbe729a1fL), +tole(0x0c52460fL), tole(0x31326fbfL), tole(0x7692156fL), tole(0x4bf23cdfL), +tole(0xc9a2ab0eL), tole(0xf4c282beL), tole(0xb362f86eL), tole(0x8e02d1deL), +tole(0x3c220dceL), tole(0x0142247eL), tole(0x46e25eaeL), tole(0x7b82771eL), +tole(0xb1e6b092L), tole(0x8c869922L), tole(0xcb26e3f2L), tole(0xf646ca42L), +tole(0x44661652L), tole(0x79063fe2L), tole(0x3ea64532L), tole(0x03c66c82L), +tole(0x8196fb53L), tole(0xbcf6d2e3L), tole(0xfb56a833L), tole(0xc6368183L), +tole(0x74165d93L), tole(0x49767423L), tole(0x0ed60ef3L), tole(0x33b62743L), +tole(0xd1062710L), tole(0xec660ea0L), tole(0xabc67470L), tole(0x96a65dc0L), +tole(0x248681d0L), tole(0x19e6a860L), tole(0x5e46d2b0L), tole(0x6326fb00L), +tole(0xe1766cd1L), tole(0xdc164561L), tole(0x9bb63fb1L), tole(0xa6d61601L), +tole(0x14f6ca11L), tole(0x2996e3a1L), tole(0x6e369971L), tole(0x5356b0c1L), +tole(0x70279f96L), tole(0x4d47b626L), tole(0x0ae7ccf6L), tole(0x3787e546L), +tole(0x85a73956L), tole(0xb8c710e6L), tole(0xff676a36L), tole(0xc2074386L), +tole(0x4057d457L), tole(0x7d37fde7L), tole(0x3a978737L), tole(0x07f7ae87L), +tole(0xb5d77297L), tole(0x88b75b27L), tole(0xcf1721f7L), tole(0xf2770847L), +tole(0x10c70814L), tole(0x2da721a4L), tole(0x6a075b74L), tole(0x576772c4L), +tole(0xe547aed4L), tole(0xd8278764L), tole(0x9f87fdb4L), tole(0xa2e7d404L), +tole(0x20b743d5L), tole(0x1dd76a65L), tole(0x5a7710b5L), tole(0x67173905L), +tole(0xd537e515L), tole(0xe857cca5L), tole(0xaff7b675L), tole(0x92979fc5L), +tole(0xe915e8dbL), tole(0xd475c16bL), tole(0x93d5bbbbL), tole(0xaeb5920bL), +tole(0x1c954e1bL), tole(0x21f567abL), tole(0x66551d7bL), tole(0x5b3534cbL), +tole(0xd965a31aL), tole(0xe4058aaaL), tole(0xa3a5f07aL), tole(0x9ec5d9caL), +tole(0x2ce505daL), tole(0x11852c6aL), tole(0x562556baL), tole(0x6b457f0aL), +tole(0x89f57f59L), tole(0xb49556e9L), tole(0xf3352c39L), tole(0xce550589L), +tole(0x7c75d999L), tole(0x4115f029L), tole(0x06b58af9L), tole(0x3bd5a349L), +tole(0xb9853498L), tole(0x84e51d28L), tole(0xc34567f8L), tole(0xfe254e48L), +tole(0x4c059258L), tole(0x7165bbe8L), tole(0x36c5c138L), tole(0x0ba5e888L), +tole(0x28d4c7dfL), tole(0x15b4ee6fL), tole(0x521494bfL), tole(0x6f74bd0fL), +tole(0xdd54611fL), tole(0xe03448afL), tole(0xa794327fL), tole(0x9af41bcfL), +tole(0x18a48c1eL), tole(0x25c4a5aeL), tole(0x6264df7eL), tole(0x5f04f6ceL), +tole(0xed242adeL), tole(0xd044036eL), tole(0x97e479beL), tole(0xaa84500eL), +tole(0x4834505dL), tole(0x755479edL), tole(0x32f4033dL), tole(0x0f942a8dL), +tole(0xbdb4f69dL), tole(0x80d4df2dL), tole(0xc774a5fdL), tole(0xfa148c4dL), +tole(0x78441b9cL), tole(0x4524322cL), tole(0x028448fcL), tole(0x3fe4614cL), +tole(0x8dc4bd5cL), tole(0xb0a494ecL), tole(0xf704ee3cL), tole(0xca64c78cL)}, +{ +tole(0x00000000L), tole(0xcb5cd3a5L), tole(0x4dc8a10bL), tole(0x869472aeL), +tole(0x9b914216L), tole(0x50cd91b3L), tole(0xd659e31dL), tole(0x1d0530b8L), +tole(0xec53826dL), tole(0x270f51c8L), tole(0xa19b2366L), tole(0x6ac7f0c3L), +tole(0x77c2c07bL), tole(0xbc9e13deL), tole(0x3a0a6170L), tole(0xf156b2d5L), +tole(0x03d6029bL), tole(0xc88ad13eL), tole(0x4e1ea390L), tole(0x85427035L), +tole(0x9847408dL), tole(0x531b9328L), tole(0xd58fe186L), tole(0x1ed33223L), +tole(0xef8580f6L), tole(0x24d95353L), tole(0xa24d21fdL), tole(0x6911f258L), +tole(0x7414c2e0L), tole(0xbf481145L), tole(0x39dc63ebL), tole(0xf280b04eL), +tole(0x07ac0536L), tole(0xccf0d693L), tole(0x4a64a43dL), tole(0x81387798L), +tole(0x9c3d4720L), tole(0x57619485L), tole(0xd1f5e62bL), tole(0x1aa9358eL), +tole(0xebff875bL), tole(0x20a354feL), tole(0xa6372650L), tole(0x6d6bf5f5L), +tole(0x706ec54dL), tole(0xbb3216e8L), tole(0x3da66446L), tole(0xf6fab7e3L), +tole(0x047a07adL), tole(0xcf26d408L), tole(0x49b2a6a6L), tole(0x82ee7503L), +tole(0x9feb45bbL), tole(0x54b7961eL), tole(0xd223e4b0L), tole(0x197f3715L), +tole(0xe82985c0L), tole(0x23755665L), tole(0xa5e124cbL), tole(0x6ebdf76eL), +tole(0x73b8c7d6L), tole(0xb8e41473L), tole(0x3e7066ddL), tole(0xf52cb578L), +tole(0x0f580a6cL), tole(0xc404d9c9L), tole(0x4290ab67L), tole(0x89cc78c2L), +tole(0x94c9487aL), tole(0x5f959bdfL), tole(0xd901e971L), tole(0x125d3ad4L), +tole(0xe30b8801L), tole(0x28575ba4L), tole(0xaec3290aL), tole(0x659ffaafL), +tole(0x789aca17L), tole(0xb3c619b2L), tole(0x35526b1cL), tole(0xfe0eb8b9L), +tole(0x0c8e08f7L), tole(0xc7d2db52L), tole(0x4146a9fcL), tole(0x8a1a7a59L), +tole(0x971f4ae1L), tole(0x5c439944L), tole(0xdad7ebeaL), tole(0x118b384fL), +tole(0xe0dd8a9aL), tole(0x2b81593fL), tole(0xad152b91L), tole(0x6649f834L), +tole(0x7b4cc88cL), tole(0xb0101b29L), tole(0x36846987L), tole(0xfdd8ba22L), +tole(0x08f40f5aL), tole(0xc3a8dcffL), tole(0x453cae51L), tole(0x8e607df4L), +tole(0x93654d4cL), tole(0x58399ee9L), tole(0xdeadec47L), tole(0x15f13fe2L), +tole(0xe4a78d37L), tole(0x2ffb5e92L), tole(0xa96f2c3cL), tole(0x6233ff99L), +tole(0x7f36cf21L), tole(0xb46a1c84L), tole(0x32fe6e2aL), tole(0xf9a2bd8fL), +tole(0x0b220dc1L), tole(0xc07ede64L), tole(0x46eaaccaL), tole(0x8db67f6fL), +tole(0x90b34fd7L), tole(0x5bef9c72L), tole(0xdd7beedcL), tole(0x16273d79L), +tole(0xe7718facL), tole(0x2c2d5c09L), tole(0xaab92ea7L), tole(0x61e5fd02L), +tole(0x7ce0cdbaL), tole(0xb7bc1e1fL), tole(0x31286cb1L), tole(0xfa74bf14L), +tole(0x1eb014d8L), tole(0xd5ecc77dL), tole(0x5378b5d3L), tole(0x98246676L), +tole(0x852156ceL), tole(0x4e7d856bL), tole(0xc8e9f7c5L), tole(0x03b52460L), +tole(0xf2e396b5L), tole(0x39bf4510L), tole(0xbf2b37beL), tole(0x7477e41bL), +tole(0x6972d4a3L), tole(0xa22e0706L), tole(0x24ba75a8L), tole(0xefe6a60dL), +tole(0x1d661643L), tole(0xd63ac5e6L), tole(0x50aeb748L), tole(0x9bf264edL), +tole(0x86f75455L), tole(0x4dab87f0L), tole(0xcb3ff55eL), tole(0x006326fbL), +tole(0xf135942eL), tole(0x3a69478bL), tole(0xbcfd3525L), tole(0x77a1e680L), +tole(0x6aa4d638L), tole(0xa1f8059dL), tole(0x276c7733L), tole(0xec30a496L), +tole(0x191c11eeL), tole(0xd240c24bL), tole(0x54d4b0e5L), tole(0x9f886340L), +tole(0x828d53f8L), tole(0x49d1805dL), tole(0xcf45f2f3L), tole(0x04192156L), +tole(0xf54f9383L), tole(0x3e134026L), tole(0xb8873288L), tole(0x73dbe12dL), +tole(0x6eded195L), tole(0xa5820230L), tole(0x2316709eL), tole(0xe84aa33bL), +tole(0x1aca1375L), tole(0xd196c0d0L), tole(0x5702b27eL), tole(0x9c5e61dbL), +tole(0x815b5163L), tole(0x4a0782c6L), tole(0xcc93f068L), tole(0x07cf23cdL), +tole(0xf6999118L), tole(0x3dc542bdL), tole(0xbb513013L), tole(0x700de3b6L), +tole(0x6d08d30eL), tole(0xa65400abL), tole(0x20c07205L), tole(0xeb9ca1a0L), +tole(0x11e81eb4L), tole(0xdab4cd11L), tole(0x5c20bfbfL), tole(0x977c6c1aL), +tole(0x8a795ca2L), tole(0x41258f07L), tole(0xc7b1fda9L), tole(0x0ced2e0cL), +tole(0xfdbb9cd9L), tole(0x36e74f7cL), tole(0xb0733dd2L), tole(0x7b2fee77L), +tole(0x662adecfL), tole(0xad760d6aL), tole(0x2be27fc4L), tole(0xe0beac61L), +tole(0x123e1c2fL), tole(0xd962cf8aL), tole(0x5ff6bd24L), tole(0x94aa6e81L), +tole(0x89af5e39L), tole(0x42f38d9cL), tole(0xc467ff32L), tole(0x0f3b2c97L), +tole(0xfe6d9e42L), tole(0x35314de7L), tole(0xb3a53f49L), tole(0x78f9ececL), +tole(0x65fcdc54L), tole(0xaea00ff1L), tole(0x28347d5fL), tole(0xe368aefaL), +tole(0x16441b82L), tole(0xdd18c827L), tole(0x5b8cba89L), tole(0x90d0692cL), +tole(0x8dd55994L), tole(0x46898a31L), tole(0xc01df89fL), tole(0x0b412b3aL), +tole(0xfa1799efL), tole(0x314b4a4aL), tole(0xb7df38e4L), tole(0x7c83eb41L), +tole(0x6186dbf9L), tole(0xaada085cL), tole(0x2c4e7af2L), tole(0xe712a957L), +tole(0x15921919L), tole(0xdececabcL), tole(0x585ab812L), tole(0x93066bb7L), +tole(0x8e035b0fL), tole(0x455f88aaL), tole(0xc3cbfa04L), tole(0x089729a1L), +tole(0xf9c19b74L), tole(0x329d48d1L), tole(0xb4093a7fL), tole(0x7f55e9daL), +tole(0x6250d962L), tole(0xa90c0ac7L), tole(0x2f987869L), tole(0xe4c4abccL)}, +{ +tole(0x00000000L), tole(0xa6770bb4L), tole(0x979f1129L), tole(0x31e81a9dL), +tole(0xf44f2413L), tole(0x52382fa7L), tole(0x63d0353aL), tole(0xc5a73e8eL), +tole(0x33ef4e67L), tole(0x959845d3L), tole(0xa4705f4eL), tole(0x020754faL), +tole(0xc7a06a74L), tole(0x61d761c0L), tole(0x503f7b5dL), tole(0xf64870e9L), +tole(0x67de9cceL), tole(0xc1a9977aL), tole(0xf0418de7L), tole(0x56368653L), +tole(0x9391b8ddL), tole(0x35e6b369L), tole(0x040ea9f4L), tole(0xa279a240L), +tole(0x5431d2a9L), tole(0xf246d91dL), tole(0xc3aec380L), tole(0x65d9c834L), +tole(0xa07ef6baL), tole(0x0609fd0eL), tole(0x37e1e793L), tole(0x9196ec27L), +tole(0xcfbd399cL), tole(0x69ca3228L), tole(0x582228b5L), tole(0xfe552301L), +tole(0x3bf21d8fL), tole(0x9d85163bL), tole(0xac6d0ca6L), tole(0x0a1a0712L), +tole(0xfc5277fbL), tole(0x5a257c4fL), tole(0x6bcd66d2L), tole(0xcdba6d66L), +tole(0x081d53e8L), tole(0xae6a585cL), tole(0x9f8242c1L), tole(0x39f54975L), +tole(0xa863a552L), tole(0x0e14aee6L), tole(0x3ffcb47bL), tole(0x998bbfcfL), +tole(0x5c2c8141L), tole(0xfa5b8af5L), tole(0xcbb39068L), tole(0x6dc49bdcL), +tole(0x9b8ceb35L), tole(0x3dfbe081L), tole(0x0c13fa1cL), tole(0xaa64f1a8L), +tole(0x6fc3cf26L), tole(0xc9b4c492L), tole(0xf85cde0fL), tole(0x5e2bd5bbL), +tole(0x440b7579L), tole(0xe27c7ecdL), tole(0xd3946450L), tole(0x75e36fe4L), +tole(0xb044516aL), tole(0x16335adeL), tole(0x27db4043L), tole(0x81ac4bf7L), +tole(0x77e43b1eL), tole(0xd19330aaL), tole(0xe07b2a37L), tole(0x460c2183L), +tole(0x83ab1f0dL), tole(0x25dc14b9L), tole(0x14340e24L), tole(0xb2430590L), +tole(0x23d5e9b7L), tole(0x85a2e203L), tole(0xb44af89eL), tole(0x123df32aL), +tole(0xd79acda4L), tole(0x71edc610L), tole(0x4005dc8dL), tole(0xe672d739L), +tole(0x103aa7d0L), tole(0xb64dac64L), tole(0x87a5b6f9L), tole(0x21d2bd4dL), +tole(0xe47583c3L), tole(0x42028877L), tole(0x73ea92eaL), tole(0xd59d995eL), +tole(0x8bb64ce5L), tole(0x2dc14751L), tole(0x1c295dccL), tole(0xba5e5678L), +tole(0x7ff968f6L), tole(0xd98e6342L), tole(0xe86679dfL), tole(0x4e11726bL), +tole(0xb8590282L), tole(0x1e2e0936L), tole(0x2fc613abL), tole(0x89b1181fL), +tole(0x4c162691L), tole(0xea612d25L), tole(0xdb8937b8L), tole(0x7dfe3c0cL), +tole(0xec68d02bL), tole(0x4a1fdb9fL), tole(0x7bf7c102L), tole(0xdd80cab6L), +tole(0x1827f438L), tole(0xbe50ff8cL), tole(0x8fb8e511L), tole(0x29cfeea5L), +tole(0xdf879e4cL), tole(0x79f095f8L), tole(0x48188f65L), tole(0xee6f84d1L), +tole(0x2bc8ba5fL), tole(0x8dbfb1ebL), tole(0xbc57ab76L), tole(0x1a20a0c2L), +tole(0x8816eaf2L), tole(0x2e61e146L), tole(0x1f89fbdbL), tole(0xb9fef06fL), +tole(0x7c59cee1L), tole(0xda2ec555L), tole(0xebc6dfc8L), tole(0x4db1d47cL), +tole(0xbbf9a495L), tole(0x1d8eaf21L), tole(0x2c66b5bcL), tole(0x8a11be08L), +tole(0x4fb68086L), tole(0xe9c18b32L), tole(0xd82991afL), tole(0x7e5e9a1bL), +tole(0xefc8763cL), tole(0x49bf7d88L), tole(0x78576715L), tole(0xde206ca1L), +tole(0x1b87522fL), tole(0xbdf0599bL), tole(0x8c184306L), tole(0x2a6f48b2L), +tole(0xdc27385bL), tole(0x7a5033efL), tole(0x4bb82972L), tole(0xedcf22c6L), +tole(0x28681c48L), tole(0x8e1f17fcL), tole(0xbff70d61L), tole(0x198006d5L), +tole(0x47abd36eL), tole(0xe1dcd8daL), tole(0xd034c247L), tole(0x7643c9f3L), +tole(0xb3e4f77dL), tole(0x1593fcc9L), tole(0x247be654L), tole(0x820cede0L), +tole(0x74449d09L), tole(0xd23396bdL), tole(0xe3db8c20L), tole(0x45ac8794L), +tole(0x800bb91aL), tole(0x267cb2aeL), tole(0x1794a833L), tole(0xb1e3a387L), +tole(0x20754fa0L), tole(0x86024414L), tole(0xb7ea5e89L), tole(0x119d553dL), +tole(0xd43a6bb3L), tole(0x724d6007L), tole(0x43a57a9aL), tole(0xe5d2712eL), +tole(0x139a01c7L), tole(0xb5ed0a73L), tole(0x840510eeL), tole(0x22721b5aL), +tole(0xe7d525d4L), tole(0x41a22e60L), tole(0x704a34fdL), tole(0xd63d3f49L), +tole(0xcc1d9f8bL), tole(0x6a6a943fL), tole(0x5b828ea2L), tole(0xfdf58516L), +tole(0x3852bb98L), tole(0x9e25b02cL), tole(0xafcdaab1L), tole(0x09baa105L), +tole(0xfff2d1ecL), tole(0x5985da58L), tole(0x686dc0c5L), tole(0xce1acb71L), +tole(0x0bbdf5ffL), tole(0xadcafe4bL), tole(0x9c22e4d6L), tole(0x3a55ef62L), +tole(0xabc30345L), tole(0x0db408f1L), tole(0x3c5c126cL), tole(0x9a2b19d8L), +tole(0x5f8c2756L), tole(0xf9fb2ce2L), tole(0xc813367fL), tole(0x6e643dcbL), +tole(0x982c4d22L), tole(0x3e5b4696L), tole(0x0fb35c0bL), tole(0xa9c457bfL), +tole(0x6c636931L), tole(0xca146285L), tole(0xfbfc7818L), tole(0x5d8b73acL), +tole(0x03a0a617L), tole(0xa5d7ada3L), tole(0x943fb73eL), tole(0x3248bc8aL), +tole(0xf7ef8204L), tole(0x519889b0L), tole(0x6070932dL), tole(0xc6079899L), +tole(0x304fe870L), tole(0x9638e3c4L), tole(0xa7d0f959L), tole(0x01a7f2edL), +tole(0xc400cc63L), tole(0x6277c7d7L), tole(0x539fdd4aL), tole(0xf5e8d6feL), +tole(0x647e3ad9L), tole(0xc209316dL), tole(0xf3e12bf0L), tole(0x55962044L), +tole(0x90311ecaL), tole(0x3646157eL), tole(0x07ae0fe3L), tole(0xa1d90457L), +tole(0x579174beL), tole(0xf1e67f0aL), tole(0xc00e6597L), tole(0x66796e23L), +tole(0xa3de50adL), tole(0x05a95b19L), tole(0x34414184L), tole(0x92364a30L)}, +{ +tole(0x00000000L), tole(0xccaa009eL), tole(0x4225077dL), tole(0x8e8f07e3L), +tole(0x844a0efaL), tole(0x48e00e64L), tole(0xc66f0987L), tole(0x0ac50919L), +tole(0xd3e51bb5L), tole(0x1f4f1b2bL), tole(0x91c01cc8L), tole(0x5d6a1c56L), +tole(0x57af154fL), tole(0x9b0515d1L), tole(0x158a1232L), tole(0xd92012acL), +tole(0x7cbb312bL), tole(0xb01131b5L), tole(0x3e9e3656L), tole(0xf23436c8L), +tole(0xf8f13fd1L), tole(0x345b3f4fL), tole(0xbad438acL), tole(0x767e3832L), +tole(0xaf5e2a9eL), tole(0x63f42a00L), tole(0xed7b2de3L), tole(0x21d12d7dL), +tole(0x2b142464L), tole(0xe7be24faL), tole(0x69312319L), tole(0xa59b2387L), +tole(0xf9766256L), tole(0x35dc62c8L), tole(0xbb53652bL), tole(0x77f965b5L), +tole(0x7d3c6cacL), tole(0xb1966c32L), tole(0x3f196bd1L), tole(0xf3b36b4fL), +tole(0x2a9379e3L), tole(0xe639797dL), tole(0x68b67e9eL), tole(0xa41c7e00L), +tole(0xaed97719L), tole(0x62737787L), tole(0xecfc7064L), tole(0x205670faL), +tole(0x85cd537dL), tole(0x496753e3L), tole(0xc7e85400L), tole(0x0b42549eL), +tole(0x01875d87L), tole(0xcd2d5d19L), tole(0x43a25afaL), tole(0x8f085a64L), +tole(0x562848c8L), tole(0x9a824856L), tole(0x140d4fb5L), tole(0xd8a74f2bL), +tole(0xd2624632L), tole(0x1ec846acL), tole(0x9047414fL), tole(0x5ced41d1L), +tole(0x299dc2edL), tole(0xe537c273L), tole(0x6bb8c590L), tole(0xa712c50eL), +tole(0xadd7cc17L), tole(0x617dcc89L), tole(0xeff2cb6aL), tole(0x2358cbf4L), +tole(0xfa78d958L), tole(0x36d2d9c6L), tole(0xb85dde25L), tole(0x74f7debbL), +tole(0x7e32d7a2L), tole(0xb298d73cL), tole(0x3c17d0dfL), tole(0xf0bdd041L), +tole(0x5526f3c6L), tole(0x998cf358L), tole(0x1703f4bbL), tole(0xdba9f425L), +tole(0xd16cfd3cL), tole(0x1dc6fda2L), tole(0x9349fa41L), tole(0x5fe3fadfL), +tole(0x86c3e873L), tole(0x4a69e8edL), tole(0xc4e6ef0eL), tole(0x084cef90L), +tole(0x0289e689L), tole(0xce23e617L), tole(0x40ace1f4L), tole(0x8c06e16aL), +tole(0xd0eba0bbL), tole(0x1c41a025L), tole(0x92cea7c6L), tole(0x5e64a758L), +tole(0x54a1ae41L), tole(0x980baedfL), tole(0x1684a93cL), tole(0xda2ea9a2L), +tole(0x030ebb0eL), tole(0xcfa4bb90L), tole(0x412bbc73L), tole(0x8d81bcedL), +tole(0x8744b5f4L), tole(0x4beeb56aL), tole(0xc561b289L), tole(0x09cbb217L), +tole(0xac509190L), tole(0x60fa910eL), tole(0xee7596edL), tole(0x22df9673L), +tole(0x281a9f6aL), tole(0xe4b09ff4L), tole(0x6a3f9817L), tole(0xa6959889L), +tole(0x7fb58a25L), tole(0xb31f8abbL), tole(0x3d908d58L), tole(0xf13a8dc6L), +tole(0xfbff84dfL), tole(0x37558441L), tole(0xb9da83a2L), tole(0x7570833cL), +tole(0x533b85daL), tole(0x9f918544L), tole(0x111e82a7L), tole(0xddb48239L), +tole(0xd7718b20L), tole(0x1bdb8bbeL), tole(0x95548c5dL), tole(0x59fe8cc3L), +tole(0x80de9e6fL), tole(0x4c749ef1L), tole(0xc2fb9912L), tole(0x0e51998cL), +tole(0x04949095L), tole(0xc83e900bL), tole(0x46b197e8L), tole(0x8a1b9776L), +tole(0x2f80b4f1L), tole(0xe32ab46fL), tole(0x6da5b38cL), tole(0xa10fb312L), +tole(0xabcaba0bL), tole(0x6760ba95L), tole(0xe9efbd76L), tole(0x2545bde8L), +tole(0xfc65af44L), tole(0x30cfafdaL), tole(0xbe40a839L), tole(0x72eaa8a7L), +tole(0x782fa1beL), tole(0xb485a120L), tole(0x3a0aa6c3L), tole(0xf6a0a65dL), +tole(0xaa4de78cL), tole(0x66e7e712L), tole(0xe868e0f1L), tole(0x24c2e06fL), +tole(0x2e07e976L), tole(0xe2ade9e8L), tole(0x6c22ee0bL), tole(0xa088ee95L), +tole(0x79a8fc39L), tole(0xb502fca7L), tole(0x3b8dfb44L), tole(0xf727fbdaL), +tole(0xfde2f2c3L), tole(0x3148f25dL), tole(0xbfc7f5beL), tole(0x736df520L), +tole(0xd6f6d6a7L), tole(0x1a5cd639L), tole(0x94d3d1daL), tole(0x5879d144L), +tole(0x52bcd85dL), tole(0x9e16d8c3L), tole(0x1099df20L), tole(0xdc33dfbeL), +tole(0x0513cd12L), tole(0xc9b9cd8cL), tole(0x4736ca6fL), tole(0x8b9ccaf1L), +tole(0x8159c3e8L), tole(0x4df3c376L), tole(0xc37cc495L), tole(0x0fd6c40bL), +tole(0x7aa64737L), tole(0xb60c47a9L), tole(0x3883404aL), tole(0xf42940d4L), +tole(0xfeec49cdL), tole(0x32464953L), tole(0xbcc94eb0L), tole(0x70634e2eL), +tole(0xa9435c82L), tole(0x65e95c1cL), tole(0xeb665bffL), tole(0x27cc5b61L), +tole(0x2d095278L), tole(0xe1a352e6L), tole(0x6f2c5505L), tole(0xa386559bL), +tole(0x061d761cL), tole(0xcab77682L), tole(0x44387161L), tole(0x889271ffL), +tole(0x825778e6L), tole(0x4efd7878L), tole(0xc0727f9bL), tole(0x0cd87f05L), +tole(0xd5f86da9L), tole(0x19526d37L), tole(0x97dd6ad4L), tole(0x5b776a4aL), +tole(0x51b26353L), tole(0x9d1863cdL), tole(0x1397642eL), tole(0xdf3d64b0L), +tole(0x83d02561L), tole(0x4f7a25ffL), tole(0xc1f5221cL), tole(0x0d5f2282L), +tole(0x079a2b9bL), tole(0xcb302b05L), tole(0x45bf2ce6L), tole(0x89152c78L), +tole(0x50353ed4L), tole(0x9c9f3e4aL), tole(0x121039a9L), tole(0xdeba3937L), +tole(0xd47f302eL), tole(0x18d530b0L), tole(0x965a3753L), tole(0x5af037cdL), +tole(0xff6b144aL), tole(0x33c114d4L), tole(0xbd4e1337L), tole(0x71e413a9L), +tole(0x7b211ab0L), tole(0xb78b1a2eL), tole(0x39041dcdL), tole(0xf5ae1d53L), +tole(0x2c8e0fffL), tole(0xe0240f61L), tole(0x6eab0882L), tole(0xa201081cL), +tole(0xa8c40105L), tole(0x646e019bL), tole(0xeae10678L), tole(0x264b06e6L)}, +}; +static u32 __cacheline_aligned crc32table_be[8][256] = {{ +tobe(0x00000000L), tobe(0x04c11db7L), tobe(0x09823b6eL), tobe(0x0d4326d9L), +tobe(0x130476dcL), tobe(0x17c56b6bL), tobe(0x1a864db2L), tobe(0x1e475005L), +tobe(0x2608edb8L), tobe(0x22c9f00fL), tobe(0x2f8ad6d6L), tobe(0x2b4bcb61L), +tobe(0x350c9b64L), tobe(0x31cd86d3L), tobe(0x3c8ea00aL), tobe(0x384fbdbdL), +tobe(0x4c11db70L), tobe(0x48d0c6c7L), tobe(0x4593e01eL), tobe(0x4152fda9L), +tobe(0x5f15adacL), tobe(0x5bd4b01bL), tobe(0x569796c2L), tobe(0x52568b75L), +tobe(0x6a1936c8L), tobe(0x6ed82b7fL), tobe(0x639b0da6L), tobe(0x675a1011L), +tobe(0x791d4014L), tobe(0x7ddc5da3L), tobe(0x709f7b7aL), tobe(0x745e66cdL), +tobe(0x9823b6e0L), tobe(0x9ce2ab57L), tobe(0x91a18d8eL), tobe(0x95609039L), +tobe(0x8b27c03cL), tobe(0x8fe6dd8bL), tobe(0x82a5fb52L), tobe(0x8664e6e5L), +tobe(0xbe2b5b58L), tobe(0xbaea46efL), tobe(0xb7a96036L), tobe(0xb3687d81L), +tobe(0xad2f2d84L), tobe(0xa9ee3033L), tobe(0xa4ad16eaL), tobe(0xa06c0b5dL), +tobe(0xd4326d90L), tobe(0xd0f37027L), tobe(0xddb056feL), tobe(0xd9714b49L), +tobe(0xc7361b4cL), tobe(0xc3f706fbL), tobe(0xceb42022L), tobe(0xca753d95L), +tobe(0xf23a8028L), tobe(0xf6fb9d9fL), tobe(0xfbb8bb46L), tobe(0xff79a6f1L), +tobe(0xe13ef6f4L), tobe(0xe5ffeb43L), tobe(0xe8bccd9aL), tobe(0xec7dd02dL), +tobe(0x34867077L), tobe(0x30476dc0L), tobe(0x3d044b19L), tobe(0x39c556aeL), +tobe(0x278206abL), tobe(0x23431b1cL), tobe(0x2e003dc5L), tobe(0x2ac12072L), +tobe(0x128e9dcfL), tobe(0x164f8078L), tobe(0x1b0ca6a1L), tobe(0x1fcdbb16L), +tobe(0x018aeb13L), tobe(0x054bf6a4L), tobe(0x0808d07dL), tobe(0x0cc9cdcaL), +tobe(0x7897ab07L), tobe(0x7c56b6b0L), tobe(0x71159069L), tobe(0x75d48ddeL), +tobe(0x6b93dddbL), tobe(0x6f52c06cL), tobe(0x6211e6b5L), tobe(0x66d0fb02L), +tobe(0x5e9f46bfL), tobe(0x5a5e5b08L), tobe(0x571d7dd1L), tobe(0x53dc6066L), +tobe(0x4d9b3063L), tobe(0x495a2dd4L), tobe(0x44190b0dL), tobe(0x40d816baL), +tobe(0xaca5c697L), tobe(0xa864db20L), tobe(0xa527fdf9L), tobe(0xa1e6e04eL), +tobe(0xbfa1b04bL), tobe(0xbb60adfcL), tobe(0xb6238b25L), tobe(0xb2e29692L), +tobe(0x8aad2b2fL), tobe(0x8e6c3698L), tobe(0x832f1041L), tobe(0x87ee0df6L), +tobe(0x99a95df3L), tobe(0x9d684044L), tobe(0x902b669dL), tobe(0x94ea7b2aL), +tobe(0xe0b41de7L), tobe(0xe4750050L), tobe(0xe9362689L), tobe(0xedf73b3eL), +tobe(0xf3b06b3bL), tobe(0xf771768cL), tobe(0xfa325055L), tobe(0xfef34de2L), +tobe(0xc6bcf05fL), tobe(0xc27dede8L), tobe(0xcf3ecb31L), tobe(0xcbffd686L), +tobe(0xd5b88683L), tobe(0xd1799b34L), tobe(0xdc3abdedL), tobe(0xd8fba05aL), +tobe(0x690ce0eeL), tobe(0x6dcdfd59L), tobe(0x608edb80L), tobe(0x644fc637L), +tobe(0x7a089632L), tobe(0x7ec98b85L), tobe(0x738aad5cL), tobe(0x774bb0ebL), +tobe(0x4f040d56L), tobe(0x4bc510e1L), tobe(0x46863638L), tobe(0x42472b8fL), +tobe(0x5c007b8aL), tobe(0x58c1663dL), tobe(0x558240e4L), tobe(0x51435d53L), +tobe(0x251d3b9eL), tobe(0x21dc2629L), tobe(0x2c9f00f0L), tobe(0x285e1d47L), +tobe(0x36194d42L), tobe(0x32d850f5L), tobe(0x3f9b762cL), tobe(0x3b5a6b9bL), +tobe(0x0315d626L), tobe(0x07d4cb91L), tobe(0x0a97ed48L), tobe(0x0e56f0ffL), +tobe(0x1011a0faL), tobe(0x14d0bd4dL), tobe(0x19939b94L), tobe(0x1d528623L), +tobe(0xf12f560eL), tobe(0xf5ee4bb9L), tobe(0xf8ad6d60L), tobe(0xfc6c70d7L), +tobe(0xe22b20d2L), tobe(0xe6ea3d65L), tobe(0xeba91bbcL), tobe(0xef68060bL), +tobe(0xd727bbb6L), tobe(0xd3e6a601L), tobe(0xdea580d8L), tobe(0xda649d6fL), +tobe(0xc423cd6aL), tobe(0xc0e2d0ddL), tobe(0xcda1f604L), tobe(0xc960ebb3L), +tobe(0xbd3e8d7eL), tobe(0xb9ff90c9L), tobe(0xb4bcb610L), tobe(0xb07daba7L), +tobe(0xae3afba2L), tobe(0xaafbe615L), tobe(0xa7b8c0ccL), tobe(0xa379dd7bL), +tobe(0x9b3660c6L), tobe(0x9ff77d71L), tobe(0x92b45ba8L), tobe(0x9675461fL), +tobe(0x8832161aL), tobe(0x8cf30badL), tobe(0x81b02d74L), tobe(0x857130c3L), +tobe(0x5d8a9099L), tobe(0x594b8d2eL), tobe(0x5408abf7L), tobe(0x50c9b640L), +tobe(0x4e8ee645L), tobe(0x4a4ffbf2L), tobe(0x470cdd2bL), tobe(0x43cdc09cL), +tobe(0x7b827d21L), tobe(0x7f436096L), tobe(0x7200464fL), tobe(0x76c15bf8L), +tobe(0x68860bfdL), tobe(0x6c47164aL), tobe(0x61043093L), tobe(0x65c52d24L), +tobe(0x119b4be9L), tobe(0x155a565eL), tobe(0x18197087L), tobe(0x1cd86d30L), +tobe(0x029f3d35L), tobe(0x065e2082L), tobe(0x0b1d065bL), tobe(0x0fdc1becL), +tobe(0x3793a651L), tobe(0x3352bbe6L), tobe(0x3e119d3fL), tobe(0x3ad08088L), +tobe(0x2497d08dL), tobe(0x2056cd3aL), tobe(0x2d15ebe3L), tobe(0x29d4f654L), +tobe(0xc5a92679L), tobe(0xc1683bceL), tobe(0xcc2b1d17L), tobe(0xc8ea00a0L), +tobe(0xd6ad50a5L), tobe(0xd26c4d12L), tobe(0xdf2f6bcbL), tobe(0xdbee767cL), +tobe(0xe3a1cbc1L), tobe(0xe760d676L), tobe(0xea23f0afL), tobe(0xeee2ed18L), +tobe(0xf0a5bd1dL), tobe(0xf464a0aaL), tobe(0xf9278673L), tobe(0xfde69bc4L), +tobe(0x89b8fd09L), tobe(0x8d79e0beL), tobe(0x803ac667L), tobe(0x84fbdbd0L), +tobe(0x9abc8bd5L), tobe(0x9e7d9662L), tobe(0x933eb0bbL), tobe(0x97ffad0cL), +tobe(0xafb010b1L), tobe(0xab710d06L), tobe(0xa6322bdfL), tobe(0xa2f33668L), +tobe(0xbcb4666dL), tobe(0xb8757bdaL), tobe(0xb5365d03L), tobe(0xb1f740b4L)}, +{ +tobe(0x00000000L), tobe(0xd219c1dcL), tobe(0xa0f29e0fL), tobe(0x72eb5fd3L), +tobe(0x452421a9L), tobe(0x973de075L), tobe(0xe5d6bfa6L), tobe(0x37cf7e7aL), +tobe(0x8a484352L), tobe(0x5851828eL), tobe(0x2abadd5dL), tobe(0xf8a31c81L), +tobe(0xcf6c62fbL), tobe(0x1d75a327L), tobe(0x6f9efcf4L), tobe(0xbd873d28L), +tobe(0x10519b13L), tobe(0xc2485acfL), tobe(0xb0a3051cL), tobe(0x62bac4c0L), +tobe(0x5575babaL), tobe(0x876c7b66L), tobe(0xf58724b5L), tobe(0x279ee569L), +tobe(0x9a19d841L), tobe(0x4800199dL), tobe(0x3aeb464eL), tobe(0xe8f28792L), +tobe(0xdf3df9e8L), tobe(0x0d243834L), tobe(0x7fcf67e7L), tobe(0xadd6a63bL), +tobe(0x20a33626L), tobe(0xf2baf7faL), tobe(0x8051a829L), tobe(0x524869f5L), +tobe(0x6587178fL), tobe(0xb79ed653L), tobe(0xc5758980L), tobe(0x176c485cL), +tobe(0xaaeb7574L), tobe(0x78f2b4a8L), tobe(0x0a19eb7bL), tobe(0xd8002aa7L), +tobe(0xefcf54ddL), tobe(0x3dd69501L), tobe(0x4f3dcad2L), tobe(0x9d240b0eL), +tobe(0x30f2ad35L), tobe(0xe2eb6ce9L), tobe(0x9000333aL), tobe(0x4219f2e6L), +tobe(0x75d68c9cL), tobe(0xa7cf4d40L), tobe(0xd5241293L), tobe(0x073dd34fL), +tobe(0xbabaee67L), tobe(0x68a32fbbL), tobe(0x1a487068L), tobe(0xc851b1b4L), +tobe(0xff9ecfceL), tobe(0x2d870e12L), tobe(0x5f6c51c1L), tobe(0x8d75901dL), +tobe(0x41466c4cL), tobe(0x935fad90L), tobe(0xe1b4f243L), tobe(0x33ad339fL), +tobe(0x04624de5L), tobe(0xd67b8c39L), tobe(0xa490d3eaL), tobe(0x76891236L), +tobe(0xcb0e2f1eL), tobe(0x1917eec2L), tobe(0x6bfcb111L), tobe(0xb9e570cdL), +tobe(0x8e2a0eb7L), tobe(0x5c33cf6bL), tobe(0x2ed890b8L), tobe(0xfcc15164L), +tobe(0x5117f75fL), tobe(0x830e3683L), tobe(0xf1e56950L), tobe(0x23fca88cL), +tobe(0x1433d6f6L), tobe(0xc62a172aL), tobe(0xb4c148f9L), tobe(0x66d88925L), +tobe(0xdb5fb40dL), tobe(0x094675d1L), tobe(0x7bad2a02L), tobe(0xa9b4ebdeL), +tobe(0x9e7b95a4L), tobe(0x4c625478L), tobe(0x3e890babL), tobe(0xec90ca77L), +tobe(0x61e55a6aL), tobe(0xb3fc9bb6L), tobe(0xc117c465L), tobe(0x130e05b9L), +tobe(0x24c17bc3L), tobe(0xf6d8ba1fL), tobe(0x8433e5ccL), tobe(0x562a2410L), +tobe(0xebad1938L), tobe(0x39b4d8e4L), tobe(0x4b5f8737L), tobe(0x994646ebL), +tobe(0xae893891L), tobe(0x7c90f94dL), tobe(0x0e7ba69eL), tobe(0xdc626742L), +tobe(0x71b4c179L), tobe(0xa3ad00a5L), tobe(0xd1465f76L), tobe(0x035f9eaaL), +tobe(0x3490e0d0L), tobe(0xe689210cL), tobe(0x94627edfL), tobe(0x467bbf03L), +tobe(0xfbfc822bL), tobe(0x29e543f7L), tobe(0x5b0e1c24L), tobe(0x8917ddf8L), +tobe(0xbed8a382L), tobe(0x6cc1625eL), tobe(0x1e2a3d8dL), tobe(0xcc33fc51L), +tobe(0x828cd898L), tobe(0x50951944L), tobe(0x227e4697L), tobe(0xf067874bL), +tobe(0xc7a8f931L), tobe(0x15b138edL), tobe(0x675a673eL), tobe(0xb543a6e2L), +tobe(0x08c49bcaL), tobe(0xdadd5a16L), tobe(0xa83605c5L), tobe(0x7a2fc419L), +tobe(0x4de0ba63L), tobe(0x9ff97bbfL), tobe(0xed12246cL), tobe(0x3f0be5b0L), +tobe(0x92dd438bL), tobe(0x40c48257L), tobe(0x322fdd84L), tobe(0xe0361c58L), +tobe(0xd7f96222L), tobe(0x05e0a3feL), tobe(0x770bfc2dL), tobe(0xa5123df1L), +tobe(0x189500d9L), tobe(0xca8cc105L), tobe(0xb8679ed6L), tobe(0x6a7e5f0aL), +tobe(0x5db12170L), tobe(0x8fa8e0acL), tobe(0xfd43bf7fL), tobe(0x2f5a7ea3L), +tobe(0xa22feebeL), tobe(0x70362f62L), tobe(0x02dd70b1L), tobe(0xd0c4b16dL), +tobe(0xe70bcf17L), tobe(0x35120ecbL), tobe(0x47f95118L), tobe(0x95e090c4L), +tobe(0x2867adecL), tobe(0xfa7e6c30L), tobe(0x889533e3L), tobe(0x5a8cf23fL), +tobe(0x6d438c45L), tobe(0xbf5a4d99L), tobe(0xcdb1124aL), tobe(0x1fa8d396L), +tobe(0xb27e75adL), tobe(0x6067b471L), tobe(0x128ceba2L), tobe(0xc0952a7eL), +tobe(0xf75a5404L), tobe(0x254395d8L), tobe(0x57a8ca0bL), tobe(0x85b10bd7L), +tobe(0x383636ffL), tobe(0xea2ff723L), tobe(0x98c4a8f0L), tobe(0x4add692cL), +tobe(0x7d121756L), tobe(0xaf0bd68aL), tobe(0xdde08959L), tobe(0x0ff94885L), +tobe(0xc3cab4d4L), tobe(0x11d37508L), tobe(0x63382adbL), tobe(0xb121eb07L), +tobe(0x86ee957dL), tobe(0x54f754a1L), tobe(0x261c0b72L), tobe(0xf405caaeL), +tobe(0x4982f786L), tobe(0x9b9b365aL), tobe(0xe9706989L), tobe(0x3b69a855L), +tobe(0x0ca6d62fL), tobe(0xdebf17f3L), tobe(0xac544820L), tobe(0x7e4d89fcL), +tobe(0xd39b2fc7L), tobe(0x0182ee1bL), tobe(0x7369b1c8L), tobe(0xa1707014L), +tobe(0x96bf0e6eL), tobe(0x44a6cfb2L), tobe(0x364d9061L), tobe(0xe45451bdL), +tobe(0x59d36c95L), tobe(0x8bcaad49L), tobe(0xf921f29aL), tobe(0x2b383346L), +tobe(0x1cf74d3cL), tobe(0xceee8ce0L), tobe(0xbc05d333L), tobe(0x6e1c12efL), +tobe(0xe36982f2L), tobe(0x3170432eL), tobe(0x439b1cfdL), tobe(0x9182dd21L), +tobe(0xa64da35bL), tobe(0x74546287L), tobe(0x06bf3d54L), tobe(0xd4a6fc88L), +tobe(0x6921c1a0L), tobe(0xbb38007cL), tobe(0xc9d35fafL), tobe(0x1bca9e73L), +tobe(0x2c05e009L), tobe(0xfe1c21d5L), tobe(0x8cf77e06L), tobe(0x5eeebfdaL), +tobe(0xf33819e1L), tobe(0x2121d83dL), tobe(0x53ca87eeL), tobe(0x81d34632L), +tobe(0xb61c3848L), tobe(0x6405f994L), tobe(0x16eea647L), tobe(0xc4f7679bL), +tobe(0x79705ab3L), tobe(0xab699b6fL), tobe(0xd982c4bcL), tobe(0x0b9b0560L), +tobe(0x3c547b1aL), tobe(0xee4dbac6L), tobe(0x9ca6e515L), tobe(0x4ebf24c9L)}, +{ +tobe(0x00000000L), tobe(0x01d8ac87L), tobe(0x03b1590eL), tobe(0x0269f589L), +tobe(0x0762b21cL), tobe(0x06ba1e9bL), tobe(0x04d3eb12L), tobe(0x050b4795L), +tobe(0x0ec56438L), tobe(0x0f1dc8bfL), tobe(0x0d743d36L), tobe(0x0cac91b1L), +tobe(0x09a7d624L), tobe(0x087f7aa3L), tobe(0x0a168f2aL), tobe(0x0bce23adL), +tobe(0x1d8ac870L), tobe(0x1c5264f7L), tobe(0x1e3b917eL), tobe(0x1fe33df9L), +tobe(0x1ae87a6cL), tobe(0x1b30d6ebL), tobe(0x19592362L), tobe(0x18818fe5L), +tobe(0x134fac48L), tobe(0x129700cfL), tobe(0x10fef546L), tobe(0x112659c1L), +tobe(0x142d1e54L), tobe(0x15f5b2d3L), tobe(0x179c475aL), tobe(0x1644ebddL), +tobe(0x3b1590e0L), tobe(0x3acd3c67L), tobe(0x38a4c9eeL), tobe(0x397c6569L), +tobe(0x3c7722fcL), tobe(0x3daf8e7bL), tobe(0x3fc67bf2L), tobe(0x3e1ed775L), +tobe(0x35d0f4d8L), tobe(0x3408585fL), tobe(0x3661add6L), tobe(0x37b90151L), +tobe(0x32b246c4L), tobe(0x336aea43L), tobe(0x31031fcaL), tobe(0x30dbb34dL), +tobe(0x269f5890L), tobe(0x2747f417L), tobe(0x252e019eL), tobe(0x24f6ad19L), +tobe(0x21fdea8cL), tobe(0x2025460bL), tobe(0x224cb382L), tobe(0x23941f05L), +tobe(0x285a3ca8L), tobe(0x2982902fL), tobe(0x2beb65a6L), tobe(0x2a33c921L), +tobe(0x2f388eb4L), tobe(0x2ee02233L), tobe(0x2c89d7baL), tobe(0x2d517b3dL), +tobe(0x762b21c0L), tobe(0x77f38d47L), tobe(0x759a78ceL), tobe(0x7442d449L), +tobe(0x714993dcL), tobe(0x70913f5bL), tobe(0x72f8cad2L), tobe(0x73206655L), +tobe(0x78ee45f8L), tobe(0x7936e97fL), tobe(0x7b5f1cf6L), tobe(0x7a87b071L), +tobe(0x7f8cf7e4L), tobe(0x7e545b63L), tobe(0x7c3daeeaL), tobe(0x7de5026dL), +tobe(0x6ba1e9b0L), tobe(0x6a794537L), tobe(0x6810b0beL), tobe(0x69c81c39L), +tobe(0x6cc35bacL), tobe(0x6d1bf72bL), tobe(0x6f7202a2L), tobe(0x6eaaae25L), +tobe(0x65648d88L), tobe(0x64bc210fL), tobe(0x66d5d486L), tobe(0x670d7801L), +tobe(0x62063f94L), tobe(0x63de9313L), tobe(0x61b7669aL), tobe(0x606fca1dL), +tobe(0x4d3eb120L), tobe(0x4ce61da7L), tobe(0x4e8fe82eL), tobe(0x4f5744a9L), +tobe(0x4a5c033cL), tobe(0x4b84afbbL), tobe(0x49ed5a32L), tobe(0x4835f6b5L), +tobe(0x43fbd518L), tobe(0x4223799fL), tobe(0x404a8c16L), tobe(0x41922091L), +tobe(0x44996704L), tobe(0x4541cb83L), tobe(0x47283e0aL), tobe(0x46f0928dL), +tobe(0x50b47950L), tobe(0x516cd5d7L), tobe(0x5305205eL), tobe(0x52dd8cd9L), +tobe(0x57d6cb4cL), tobe(0x560e67cbL), tobe(0x54679242L), tobe(0x55bf3ec5L), +tobe(0x5e711d68L), tobe(0x5fa9b1efL), tobe(0x5dc04466L), tobe(0x5c18e8e1L), +tobe(0x5913af74L), tobe(0x58cb03f3L), tobe(0x5aa2f67aL), tobe(0x5b7a5afdL), +tobe(0xec564380L), tobe(0xed8eef07L), tobe(0xefe71a8eL), tobe(0xee3fb609L), +tobe(0xeb34f19cL), tobe(0xeaec5d1bL), tobe(0xe885a892L), tobe(0xe95d0415L), +tobe(0xe29327b8L), tobe(0xe34b8b3fL), tobe(0xe1227eb6L), tobe(0xe0fad231L), +tobe(0xe5f195a4L), tobe(0xe4293923L), tobe(0xe640ccaaL), tobe(0xe798602dL), +tobe(0xf1dc8bf0L), tobe(0xf0042777L), tobe(0xf26dd2feL), tobe(0xf3b57e79L), +tobe(0xf6be39ecL), tobe(0xf766956bL), tobe(0xf50f60e2L), tobe(0xf4d7cc65L), +tobe(0xff19efc8L), tobe(0xfec1434fL), tobe(0xfca8b6c6L), tobe(0xfd701a41L), +tobe(0xf87b5dd4L), tobe(0xf9a3f153L), tobe(0xfbca04daL), tobe(0xfa12a85dL), +tobe(0xd743d360L), tobe(0xd69b7fe7L), tobe(0xd4f28a6eL), tobe(0xd52a26e9L), +tobe(0xd021617cL), tobe(0xd1f9cdfbL), tobe(0xd3903872L), tobe(0xd24894f5L), +tobe(0xd986b758L), tobe(0xd85e1bdfL), tobe(0xda37ee56L), tobe(0xdbef42d1L), +tobe(0xdee40544L), tobe(0xdf3ca9c3L), tobe(0xdd555c4aL), tobe(0xdc8df0cdL), +tobe(0xcac91b10L), tobe(0xcb11b797L), tobe(0xc978421eL), tobe(0xc8a0ee99L), +tobe(0xcdaba90cL), tobe(0xcc73058bL), tobe(0xce1af002L), tobe(0xcfc25c85L), +tobe(0xc40c7f28L), tobe(0xc5d4d3afL), tobe(0xc7bd2626L), tobe(0xc6658aa1L), +tobe(0xc36ecd34L), tobe(0xc2b661b3L), tobe(0xc0df943aL), tobe(0xc10738bdL), +tobe(0x9a7d6240L), tobe(0x9ba5cec7L), tobe(0x99cc3b4eL), tobe(0x981497c9L), +tobe(0x9d1fd05cL), tobe(0x9cc77cdbL), tobe(0x9eae8952L), tobe(0x9f7625d5L), +tobe(0x94b80678L), tobe(0x9560aaffL), tobe(0x97095f76L), tobe(0x96d1f3f1L), +tobe(0x93dab464L), tobe(0x920218e3L), tobe(0x906bed6aL), tobe(0x91b341edL), +tobe(0x87f7aa30L), tobe(0x862f06b7L), tobe(0x8446f33eL), tobe(0x859e5fb9L), +tobe(0x8095182cL), tobe(0x814db4abL), tobe(0x83244122L), tobe(0x82fceda5L), +tobe(0x8932ce08L), tobe(0x88ea628fL), tobe(0x8a839706L), tobe(0x8b5b3b81L), +tobe(0x8e507c14L), tobe(0x8f88d093L), tobe(0x8de1251aL), tobe(0x8c39899dL), +tobe(0xa168f2a0L), tobe(0xa0b05e27L), tobe(0xa2d9abaeL), tobe(0xa3010729L), +tobe(0xa60a40bcL), tobe(0xa7d2ec3bL), tobe(0xa5bb19b2L), tobe(0xa463b535L), +tobe(0xafad9698L), tobe(0xae753a1fL), tobe(0xac1ccf96L), tobe(0xadc46311L), +tobe(0xa8cf2484L), tobe(0xa9178803L), tobe(0xab7e7d8aL), tobe(0xaaa6d10dL), +tobe(0xbce23ad0L), tobe(0xbd3a9657L), tobe(0xbf5363deL), tobe(0xbe8bcf59L), +tobe(0xbb8088ccL), tobe(0xba58244bL), tobe(0xb831d1c2L), tobe(0xb9e97d45L), +tobe(0xb2275ee8L), tobe(0xb3fff26fL), tobe(0xb19607e6L), tobe(0xb04eab61L), +tobe(0xb545ecf4L), tobe(0xb49d4073L), tobe(0xb6f4b5faL), tobe(0xb72c197dL)}, +{ +tobe(0x00000000L), tobe(0xdc6d9ab7L), tobe(0xbc1a28d9L), tobe(0x6077b26eL), +tobe(0x7cf54c05L), tobe(0xa098d6b2L), tobe(0xc0ef64dcL), tobe(0x1c82fe6bL), +tobe(0xf9ea980aL), tobe(0x258702bdL), tobe(0x45f0b0d3L), tobe(0x999d2a64L), +tobe(0x851fd40fL), tobe(0x59724eb8L), tobe(0x3905fcd6L), tobe(0xe5686661L), +tobe(0xf7142da3L), tobe(0x2b79b714L), tobe(0x4b0e057aL), tobe(0x97639fcdL), +tobe(0x8be161a6L), tobe(0x578cfb11L), tobe(0x37fb497fL), tobe(0xeb96d3c8L), +tobe(0x0efeb5a9L), tobe(0xd2932f1eL), tobe(0xb2e49d70L), tobe(0x6e8907c7L), +tobe(0x720bf9acL), tobe(0xae66631bL), tobe(0xce11d175L), tobe(0x127c4bc2L), +tobe(0xeae946f1L), tobe(0x3684dc46L), tobe(0x56f36e28L), tobe(0x8a9ef49fL), +tobe(0x961c0af4L), tobe(0x4a719043L), tobe(0x2a06222dL), tobe(0xf66bb89aL), +tobe(0x1303defbL), tobe(0xcf6e444cL), tobe(0xaf19f622L), tobe(0x73746c95L), +tobe(0x6ff692feL), tobe(0xb39b0849L), tobe(0xd3ecba27L), tobe(0x0f812090L), +tobe(0x1dfd6b52L), tobe(0xc190f1e5L), tobe(0xa1e7438bL), tobe(0x7d8ad93cL), +tobe(0x61082757L), tobe(0xbd65bde0L), tobe(0xdd120f8eL), tobe(0x017f9539L), +tobe(0xe417f358L), tobe(0x387a69efL), tobe(0x580ddb81L), tobe(0x84604136L), +tobe(0x98e2bf5dL), tobe(0x448f25eaL), tobe(0x24f89784L), tobe(0xf8950d33L), +tobe(0xd1139055L), tobe(0x0d7e0ae2L), tobe(0x6d09b88cL), tobe(0xb164223bL), +tobe(0xade6dc50L), tobe(0x718b46e7L), tobe(0x11fcf489L), tobe(0xcd916e3eL), +tobe(0x28f9085fL), tobe(0xf49492e8L), tobe(0x94e32086L), tobe(0x488eba31L), +tobe(0x540c445aL), tobe(0x8861deedL), tobe(0xe8166c83L), tobe(0x347bf634L), +tobe(0x2607bdf6L), tobe(0xfa6a2741L), tobe(0x9a1d952fL), tobe(0x46700f98L), +tobe(0x5af2f1f3L), tobe(0x869f6b44L), tobe(0xe6e8d92aL), tobe(0x3a85439dL), +tobe(0xdfed25fcL), tobe(0x0380bf4bL), tobe(0x63f70d25L), tobe(0xbf9a9792L), +tobe(0xa31869f9L), tobe(0x7f75f34eL), tobe(0x1f024120L), tobe(0xc36fdb97L), +tobe(0x3bfad6a4L), tobe(0xe7974c13L), tobe(0x87e0fe7dL), tobe(0x5b8d64caL), +tobe(0x470f9aa1L), tobe(0x9b620016L), tobe(0xfb15b278L), tobe(0x277828cfL), +tobe(0xc2104eaeL), tobe(0x1e7dd419L), tobe(0x7e0a6677L), tobe(0xa267fcc0L), +tobe(0xbee502abL), tobe(0x6288981cL), tobe(0x02ff2a72L), tobe(0xde92b0c5L), +tobe(0xcceefb07L), tobe(0x108361b0L), tobe(0x70f4d3deL), tobe(0xac994969L), +tobe(0xb01bb702L), tobe(0x6c762db5L), tobe(0x0c019fdbL), tobe(0xd06c056cL), +tobe(0x3504630dL), tobe(0xe969f9baL), tobe(0x891e4bd4L), tobe(0x5573d163L), +tobe(0x49f12f08L), tobe(0x959cb5bfL), tobe(0xf5eb07d1L), tobe(0x29869d66L), +tobe(0xa6e63d1dL), tobe(0x7a8ba7aaL), tobe(0x1afc15c4L), tobe(0xc6918f73L), +tobe(0xda137118L), tobe(0x067eebafL), tobe(0x660959c1L), tobe(0xba64c376L), +tobe(0x5f0ca517L), tobe(0x83613fa0L), tobe(0xe3168dceL), tobe(0x3f7b1779L), +tobe(0x23f9e912L), tobe(0xff9473a5L), tobe(0x9fe3c1cbL), tobe(0x438e5b7cL), +tobe(0x51f210beL), tobe(0x8d9f8a09L), tobe(0xede83867L), tobe(0x3185a2d0L), +tobe(0x2d075cbbL), tobe(0xf16ac60cL), tobe(0x911d7462L), tobe(0x4d70eed5L), +tobe(0xa81888b4L), tobe(0x74751203L), tobe(0x1402a06dL), tobe(0xc86f3adaL), +tobe(0xd4edc4b1L), tobe(0x08805e06L), tobe(0x68f7ec68L), tobe(0xb49a76dfL), +tobe(0x4c0f7becL), tobe(0x9062e15bL), tobe(0xf0155335L), tobe(0x2c78c982L), +tobe(0x30fa37e9L), tobe(0xec97ad5eL), tobe(0x8ce01f30L), tobe(0x508d8587L), +tobe(0xb5e5e3e6L), tobe(0x69887951L), tobe(0x09ffcb3fL), tobe(0xd5925188L), +tobe(0xc910afe3L), tobe(0x157d3554L), tobe(0x750a873aL), tobe(0xa9671d8dL), +tobe(0xbb1b564fL), tobe(0x6776ccf8L), tobe(0x07017e96L), tobe(0xdb6ce421L), +tobe(0xc7ee1a4aL), tobe(0x1b8380fdL), tobe(0x7bf43293L), tobe(0xa799a824L), +tobe(0x42f1ce45L), tobe(0x9e9c54f2L), tobe(0xfeebe69cL), tobe(0x22867c2bL), +tobe(0x3e048240L), tobe(0xe26918f7L), tobe(0x821eaa99L), tobe(0x5e73302eL), +tobe(0x77f5ad48L), tobe(0xab9837ffL), tobe(0xcbef8591L), tobe(0x17821f26L), +tobe(0x0b00e14dL), tobe(0xd76d7bfaL), tobe(0xb71ac994L), tobe(0x6b775323L), +tobe(0x8e1f3542L), tobe(0x5272aff5L), tobe(0x32051d9bL), tobe(0xee68872cL), +tobe(0xf2ea7947L), tobe(0x2e87e3f0L), tobe(0x4ef0519eL), tobe(0x929dcb29L), +tobe(0x80e180ebL), tobe(0x5c8c1a5cL), tobe(0x3cfba832L), tobe(0xe0963285L), +tobe(0xfc14cceeL), tobe(0x20795659L), tobe(0x400ee437L), tobe(0x9c637e80L), +tobe(0x790b18e1L), tobe(0xa5668256L), tobe(0xc5113038L), tobe(0x197caa8fL), +tobe(0x05fe54e4L), tobe(0xd993ce53L), tobe(0xb9e47c3dL), tobe(0x6589e68aL), +tobe(0x9d1cebb9L), tobe(0x4171710eL), tobe(0x2106c360L), tobe(0xfd6b59d7L), +tobe(0xe1e9a7bcL), tobe(0x3d843d0bL), tobe(0x5df38f65L), tobe(0x819e15d2L), +tobe(0x64f673b3L), tobe(0xb89be904L), tobe(0xd8ec5b6aL), tobe(0x0481c1ddL), +tobe(0x18033fb6L), tobe(0xc46ea501L), tobe(0xa419176fL), tobe(0x78748dd8L), +tobe(0x6a08c61aL), tobe(0xb6655cadL), tobe(0xd612eec3L), tobe(0x0a7f7474L), +tobe(0x16fd8a1fL), tobe(0xca9010a8L), tobe(0xaae7a2c6L), tobe(0x768a3871L), +tobe(0x93e25e10L), tobe(0x4f8fc4a7L), tobe(0x2ff876c9L), tobe(0xf395ec7eL), +tobe(0xef171215L), tobe(0x337a88a2L), tobe(0x530d3accL), tobe(0x8f60a07bL)}, +{ +tobe(0x00000000L), tobe(0x490d678dL), tobe(0x921acf1aL), tobe(0xdb17a897L), +tobe(0x20f48383L), tobe(0x69f9e40eL), tobe(0xb2ee4c99L), tobe(0xfbe32b14L), +tobe(0x41e90706L), tobe(0x08e4608bL), tobe(0xd3f3c81cL), tobe(0x9afeaf91L), +tobe(0x611d8485L), tobe(0x2810e308L), tobe(0xf3074b9fL), tobe(0xba0a2c12L), +tobe(0x83d20e0cL), tobe(0xcadf6981L), tobe(0x11c8c116L), tobe(0x58c5a69bL), +tobe(0xa3268d8fL), tobe(0xea2bea02L), tobe(0x313c4295L), tobe(0x78312518L), +tobe(0xc23b090aL), tobe(0x8b366e87L), tobe(0x5021c610L), tobe(0x192ca19dL), +tobe(0xe2cf8a89L), tobe(0xabc2ed04L), tobe(0x70d54593L), tobe(0x39d8221eL), +tobe(0x036501afL), tobe(0x4a686622L), tobe(0x917fceb5L), tobe(0xd872a938L), +tobe(0x2391822cL), tobe(0x6a9ce5a1L), tobe(0xb18b4d36L), tobe(0xf8862abbL), +tobe(0x428c06a9L), tobe(0x0b816124L), tobe(0xd096c9b3L), tobe(0x999bae3eL), +tobe(0x6278852aL), tobe(0x2b75e2a7L), tobe(0xf0624a30L), tobe(0xb96f2dbdL), +tobe(0x80b70fa3L), tobe(0xc9ba682eL), tobe(0x12adc0b9L), tobe(0x5ba0a734L), +tobe(0xa0438c20L), tobe(0xe94eebadL), tobe(0x3259433aL), tobe(0x7b5424b7L), +tobe(0xc15e08a5L), tobe(0x88536f28L), tobe(0x5344c7bfL), tobe(0x1a49a032L), +tobe(0xe1aa8b26L), tobe(0xa8a7ecabL), tobe(0x73b0443cL), tobe(0x3abd23b1L), +tobe(0x06ca035eL), tobe(0x4fc764d3L), tobe(0x94d0cc44L), tobe(0xddddabc9L), +tobe(0x263e80ddL), tobe(0x6f33e750L), tobe(0xb4244fc7L), tobe(0xfd29284aL), +tobe(0x47230458L), tobe(0x0e2e63d5L), tobe(0xd539cb42L), tobe(0x9c34accfL), +tobe(0x67d787dbL), tobe(0x2edae056L), tobe(0xf5cd48c1L), tobe(0xbcc02f4cL), +tobe(0x85180d52L), tobe(0xcc156adfL), tobe(0x1702c248L), tobe(0x5e0fa5c5L), +tobe(0xa5ec8ed1L), tobe(0xece1e95cL), tobe(0x37f641cbL), tobe(0x7efb2646L), +tobe(0xc4f10a54L), tobe(0x8dfc6dd9L), tobe(0x56ebc54eL), tobe(0x1fe6a2c3L), +tobe(0xe40589d7L), tobe(0xad08ee5aL), tobe(0x761f46cdL), tobe(0x3f122140L), +tobe(0x05af02f1L), tobe(0x4ca2657cL), tobe(0x97b5cdebL), tobe(0xdeb8aa66L), +tobe(0x255b8172L), tobe(0x6c56e6ffL), tobe(0xb7414e68L), tobe(0xfe4c29e5L), +tobe(0x444605f7L), tobe(0x0d4b627aL), tobe(0xd65ccaedL), tobe(0x9f51ad60L), +tobe(0x64b28674L), tobe(0x2dbfe1f9L), tobe(0xf6a8496eL), tobe(0xbfa52ee3L), +tobe(0x867d0cfdL), tobe(0xcf706b70L), tobe(0x1467c3e7L), tobe(0x5d6aa46aL), +tobe(0xa6898f7eL), tobe(0xef84e8f3L), tobe(0x34934064L), tobe(0x7d9e27e9L), +tobe(0xc7940bfbL), tobe(0x8e996c76L), tobe(0x558ec4e1L), tobe(0x1c83a36cL), +tobe(0xe7608878L), tobe(0xae6deff5L), tobe(0x757a4762L), tobe(0x3c7720efL), +tobe(0x0d9406bcL), tobe(0x44996131L), tobe(0x9f8ec9a6L), tobe(0xd683ae2bL), +tobe(0x2d60853fL), tobe(0x646de2b2L), tobe(0xbf7a4a25L), tobe(0xf6772da8L), +tobe(0x4c7d01baL), tobe(0x05706637L), tobe(0xde67cea0L), tobe(0x976aa92dL), +tobe(0x6c898239L), tobe(0x2584e5b4L), tobe(0xfe934d23L), tobe(0xb79e2aaeL), +tobe(0x8e4608b0L), tobe(0xc74b6f3dL), tobe(0x1c5cc7aaL), tobe(0x5551a027L), +tobe(0xaeb28b33L), tobe(0xe7bfecbeL), tobe(0x3ca84429L), tobe(0x75a523a4L), +tobe(0xcfaf0fb6L), tobe(0x86a2683bL), tobe(0x5db5c0acL), tobe(0x14b8a721L), +tobe(0xef5b8c35L), tobe(0xa656ebb8L), tobe(0x7d41432fL), tobe(0x344c24a2L), +tobe(0x0ef10713L), tobe(0x47fc609eL), tobe(0x9cebc809L), tobe(0xd5e6af84L), +tobe(0x2e058490L), tobe(0x6708e31dL), tobe(0xbc1f4b8aL), tobe(0xf5122c07L), +tobe(0x4f180015L), tobe(0x06156798L), tobe(0xdd02cf0fL), tobe(0x940fa882L), +tobe(0x6fec8396L), tobe(0x26e1e41bL), tobe(0xfdf64c8cL), tobe(0xb4fb2b01L), +tobe(0x8d23091fL), tobe(0xc42e6e92L), tobe(0x1f39c605L), tobe(0x5634a188L), +tobe(0xadd78a9cL), tobe(0xe4daed11L), tobe(0x3fcd4586L), tobe(0x76c0220bL), +tobe(0xccca0e19L), tobe(0x85c76994L), tobe(0x5ed0c103L), tobe(0x17dda68eL), +tobe(0xec3e8d9aL), tobe(0xa533ea17L), tobe(0x7e244280L), tobe(0x3729250dL), +tobe(0x0b5e05e2L), tobe(0x4253626fL), tobe(0x9944caf8L), tobe(0xd049ad75L), +tobe(0x2baa8661L), tobe(0x62a7e1ecL), tobe(0xb9b0497bL), tobe(0xf0bd2ef6L), +tobe(0x4ab702e4L), tobe(0x03ba6569L), tobe(0xd8adcdfeL), tobe(0x91a0aa73L), +tobe(0x6a438167L), tobe(0x234ee6eaL), tobe(0xf8594e7dL), tobe(0xb15429f0L), +tobe(0x888c0beeL), tobe(0xc1816c63L), tobe(0x1a96c4f4L), tobe(0x539ba379L), +tobe(0xa878886dL), tobe(0xe175efe0L), tobe(0x3a624777L), tobe(0x736f20faL), +tobe(0xc9650ce8L), tobe(0x80686b65L), tobe(0x5b7fc3f2L), tobe(0x1272a47fL), +tobe(0xe9918f6bL), tobe(0xa09ce8e6L), tobe(0x7b8b4071L), tobe(0x328627fcL), +tobe(0x083b044dL), tobe(0x413663c0L), tobe(0x9a21cb57L), tobe(0xd32cacdaL), +tobe(0x28cf87ceL), tobe(0x61c2e043L), tobe(0xbad548d4L), tobe(0xf3d82f59L), +tobe(0x49d2034bL), tobe(0x00df64c6L), tobe(0xdbc8cc51L), tobe(0x92c5abdcL), +tobe(0x692680c8L), tobe(0x202be745L), tobe(0xfb3c4fd2L), tobe(0xb231285fL), +tobe(0x8be90a41L), tobe(0xc2e46dccL), tobe(0x19f3c55bL), tobe(0x50fea2d6L), +tobe(0xab1d89c2L), tobe(0xe210ee4fL), tobe(0x390746d8L), tobe(0x700a2155L), +tobe(0xca000d47L), tobe(0x830d6acaL), tobe(0x581ac25dL), tobe(0x1117a5d0L), +tobe(0xeaf48ec4L), tobe(0xa3f9e949L), tobe(0x78ee41deL), tobe(0x31e32653L)}, +{ +tobe(0x00000000L), tobe(0x1b280d78L), tobe(0x36501af0L), tobe(0x2d781788L), +tobe(0x6ca035e0L), tobe(0x77883898L), tobe(0x5af02f10L), tobe(0x41d82268L), +tobe(0xd9406bc0L), tobe(0xc26866b8L), tobe(0xef107130L), tobe(0xf4387c48L), +tobe(0xb5e05e20L), tobe(0xaec85358L), tobe(0x83b044d0L), tobe(0x989849a8L), +tobe(0xb641ca37L), tobe(0xad69c74fL), tobe(0x8011d0c7L), tobe(0x9b39ddbfL), +tobe(0xdae1ffd7L), tobe(0xc1c9f2afL), tobe(0xecb1e527L), tobe(0xf799e85fL), +tobe(0x6f01a1f7L), tobe(0x7429ac8fL), tobe(0x5951bb07L), tobe(0x4279b67fL), +tobe(0x03a19417L), tobe(0x1889996fL), tobe(0x35f18ee7L), tobe(0x2ed9839fL), +tobe(0x684289d9L), tobe(0x736a84a1L), tobe(0x5e129329L), tobe(0x453a9e51L), +tobe(0x04e2bc39L), tobe(0x1fcab141L), tobe(0x32b2a6c9L), tobe(0x299aabb1L), +tobe(0xb102e219L), tobe(0xaa2aef61L), tobe(0x8752f8e9L), tobe(0x9c7af591L), +tobe(0xdda2d7f9L), tobe(0xc68ada81L), tobe(0xebf2cd09L), tobe(0xf0dac071L), +tobe(0xde0343eeL), tobe(0xc52b4e96L), tobe(0xe853591eL), tobe(0xf37b5466L), +tobe(0xb2a3760eL), tobe(0xa98b7b76L), tobe(0x84f36cfeL), tobe(0x9fdb6186L), +tobe(0x0743282eL), tobe(0x1c6b2556L), tobe(0x311332deL), tobe(0x2a3b3fa6L), +tobe(0x6be31dceL), tobe(0x70cb10b6L), tobe(0x5db3073eL), tobe(0x469b0a46L), +tobe(0xd08513b2L), tobe(0xcbad1ecaL), tobe(0xe6d50942L), tobe(0xfdfd043aL), +tobe(0xbc252652L), tobe(0xa70d2b2aL), tobe(0x8a753ca2L), tobe(0x915d31daL), +tobe(0x09c57872L), tobe(0x12ed750aL), tobe(0x3f956282L), tobe(0x24bd6ffaL), +tobe(0x65654d92L), tobe(0x7e4d40eaL), tobe(0x53355762L), tobe(0x481d5a1aL), +tobe(0x66c4d985L), tobe(0x7decd4fdL), tobe(0x5094c375L), tobe(0x4bbcce0dL), +tobe(0x0a64ec65L), tobe(0x114ce11dL), tobe(0x3c34f695L), tobe(0x271cfbedL), +tobe(0xbf84b245L), tobe(0xa4acbf3dL), tobe(0x89d4a8b5L), tobe(0x92fca5cdL), +tobe(0xd32487a5L), tobe(0xc80c8addL), tobe(0xe5749d55L), tobe(0xfe5c902dL), +tobe(0xb8c79a6bL), tobe(0xa3ef9713L), tobe(0x8e97809bL), tobe(0x95bf8de3L), +tobe(0xd467af8bL), tobe(0xcf4fa2f3L), tobe(0xe237b57bL), tobe(0xf91fb803L), +tobe(0x6187f1abL), tobe(0x7aaffcd3L), tobe(0x57d7eb5bL), tobe(0x4cffe623L), +tobe(0x0d27c44bL), tobe(0x160fc933L), tobe(0x3b77debbL), tobe(0x205fd3c3L), +tobe(0x0e86505cL), tobe(0x15ae5d24L), tobe(0x38d64aacL), tobe(0x23fe47d4L), +tobe(0x622665bcL), tobe(0x790e68c4L), tobe(0x54767f4cL), tobe(0x4f5e7234L), +tobe(0xd7c63b9cL), tobe(0xccee36e4L), tobe(0xe196216cL), tobe(0xfabe2c14L), +tobe(0xbb660e7cL), tobe(0xa04e0304L), tobe(0x8d36148cL), tobe(0x961e19f4L), +tobe(0xa5cb3ad3L), tobe(0xbee337abL), tobe(0x939b2023L), tobe(0x88b32d5bL), +tobe(0xc96b0f33L), tobe(0xd243024bL), tobe(0xff3b15c3L), tobe(0xe41318bbL), +tobe(0x7c8b5113L), tobe(0x67a35c6bL), tobe(0x4adb4be3L), tobe(0x51f3469bL), +tobe(0x102b64f3L), tobe(0x0b03698bL), tobe(0x267b7e03L), tobe(0x3d53737bL), +tobe(0x138af0e4L), tobe(0x08a2fd9cL), tobe(0x25daea14L), tobe(0x3ef2e76cL), +tobe(0x7f2ac504L), tobe(0x6402c87cL), tobe(0x497adff4L), tobe(0x5252d28cL), +tobe(0xcaca9b24L), tobe(0xd1e2965cL), tobe(0xfc9a81d4L), tobe(0xe7b28cacL), +tobe(0xa66aaec4L), tobe(0xbd42a3bcL), tobe(0x903ab434L), tobe(0x8b12b94cL), +tobe(0xcd89b30aL), tobe(0xd6a1be72L), tobe(0xfbd9a9faL), tobe(0xe0f1a482L), +tobe(0xa12986eaL), tobe(0xba018b92L), tobe(0x97799c1aL), tobe(0x8c519162L), +tobe(0x14c9d8caL), tobe(0x0fe1d5b2L), tobe(0x2299c23aL), tobe(0x39b1cf42L), +tobe(0x7869ed2aL), tobe(0x6341e052L), tobe(0x4e39f7daL), tobe(0x5511faa2L), +tobe(0x7bc8793dL), tobe(0x60e07445L), tobe(0x4d9863cdL), tobe(0x56b06eb5L), +tobe(0x17684cddL), tobe(0x0c4041a5L), tobe(0x2138562dL), tobe(0x3a105b55L), +tobe(0xa28812fdL), tobe(0xb9a01f85L), tobe(0x94d8080dL), tobe(0x8ff00575L), +tobe(0xce28271dL), tobe(0xd5002a65L), tobe(0xf8783dedL), tobe(0xe3503095L), +tobe(0x754e2961L), tobe(0x6e662419L), tobe(0x431e3391L), tobe(0x58363ee9L), +tobe(0x19ee1c81L), tobe(0x02c611f9L), tobe(0x2fbe0671L), tobe(0x34960b09L), +tobe(0xac0e42a1L), tobe(0xb7264fd9L), tobe(0x9a5e5851L), tobe(0x81765529L), +tobe(0xc0ae7741L), tobe(0xdb867a39L), tobe(0xf6fe6db1L), tobe(0xedd660c9L), +tobe(0xc30fe356L), tobe(0xd827ee2eL), tobe(0xf55ff9a6L), tobe(0xee77f4deL), +tobe(0xafafd6b6L), tobe(0xb487dbceL), tobe(0x99ffcc46L), tobe(0x82d7c13eL), +tobe(0x1a4f8896L), tobe(0x016785eeL), tobe(0x2c1f9266L), tobe(0x37379f1eL), +tobe(0x76efbd76L), tobe(0x6dc7b00eL), tobe(0x40bfa786L), tobe(0x5b97aafeL), +tobe(0x1d0ca0b8L), tobe(0x0624adc0L), tobe(0x2b5cba48L), tobe(0x3074b730L), +tobe(0x71ac9558L), tobe(0x6a849820L), tobe(0x47fc8fa8L), tobe(0x5cd482d0L), +tobe(0xc44ccb78L), tobe(0xdf64c600L), tobe(0xf21cd188L), tobe(0xe934dcf0L), +tobe(0xa8ecfe98L), tobe(0xb3c4f3e0L), tobe(0x9ebce468L), tobe(0x8594e910L), +tobe(0xab4d6a8fL), tobe(0xb06567f7L), tobe(0x9d1d707fL), tobe(0x86357d07L), +tobe(0xc7ed5f6fL), tobe(0xdcc55217L), tobe(0xf1bd459fL), tobe(0xea9548e7L), +tobe(0x720d014fL), tobe(0x69250c37L), tobe(0x445d1bbfL), tobe(0x5f7516c7L), +tobe(0x1ead34afL), tobe(0x058539d7L), tobe(0x28fd2e5fL), tobe(0x33d52327L)}, +{ +tobe(0x00000000L), tobe(0x4f576811L), tobe(0x9eaed022L), tobe(0xd1f9b833L), +tobe(0x399cbdf3L), tobe(0x76cbd5e2L), tobe(0xa7326dd1L), tobe(0xe86505c0L), +tobe(0x73397be6L), tobe(0x3c6e13f7L), tobe(0xed97abc4L), tobe(0xa2c0c3d5L), +tobe(0x4aa5c615L), tobe(0x05f2ae04L), tobe(0xd40b1637L), tobe(0x9b5c7e26L), +tobe(0xe672f7ccL), tobe(0xa9259fddL), tobe(0x78dc27eeL), tobe(0x378b4fffL), +tobe(0xdfee4a3fL), tobe(0x90b9222eL), tobe(0x41409a1dL), tobe(0x0e17f20cL), +tobe(0x954b8c2aL), tobe(0xda1ce43bL), tobe(0x0be55c08L), tobe(0x44b23419L), +tobe(0xacd731d9L), tobe(0xe38059c8L), tobe(0x3279e1fbL), tobe(0x7d2e89eaL), +tobe(0xc824f22fL), tobe(0x87739a3eL), tobe(0x568a220dL), tobe(0x19dd4a1cL), +tobe(0xf1b84fdcL), tobe(0xbeef27cdL), tobe(0x6f169ffeL), tobe(0x2041f7efL), +tobe(0xbb1d89c9L), tobe(0xf44ae1d8L), tobe(0x25b359ebL), tobe(0x6ae431faL), +tobe(0x8281343aL), tobe(0xcdd65c2bL), tobe(0x1c2fe418L), tobe(0x53788c09L), +tobe(0x2e5605e3L), tobe(0x61016df2L), tobe(0xb0f8d5c1L), tobe(0xffafbdd0L), +tobe(0x17cab810L), tobe(0x589dd001L), tobe(0x89646832L), tobe(0xc6330023L), +tobe(0x5d6f7e05L), tobe(0x12381614L), tobe(0xc3c1ae27L), tobe(0x8c96c636L), +tobe(0x64f3c3f6L), tobe(0x2ba4abe7L), tobe(0xfa5d13d4L), tobe(0xb50a7bc5L), +tobe(0x9488f9e9L), tobe(0xdbdf91f8L), tobe(0x0a2629cbL), tobe(0x457141daL), +tobe(0xad14441aL), tobe(0xe2432c0bL), tobe(0x33ba9438L), tobe(0x7cedfc29L), +tobe(0xe7b1820fL), tobe(0xa8e6ea1eL), tobe(0x791f522dL), tobe(0x36483a3cL), +tobe(0xde2d3ffcL), tobe(0x917a57edL), tobe(0x4083efdeL), tobe(0x0fd487cfL), +tobe(0x72fa0e25L), tobe(0x3dad6634L), tobe(0xec54de07L), tobe(0xa303b616L), +tobe(0x4b66b3d6L), tobe(0x0431dbc7L), tobe(0xd5c863f4L), tobe(0x9a9f0be5L), +tobe(0x01c375c3L), tobe(0x4e941dd2L), tobe(0x9f6da5e1L), tobe(0xd03acdf0L), +tobe(0x385fc830L), tobe(0x7708a021L), tobe(0xa6f11812L), tobe(0xe9a67003L), +tobe(0x5cac0bc6L), tobe(0x13fb63d7L), tobe(0xc202dbe4L), tobe(0x8d55b3f5L), +tobe(0x6530b635L), tobe(0x2a67de24L), tobe(0xfb9e6617L), tobe(0xb4c90e06L), +tobe(0x2f957020L), tobe(0x60c21831L), tobe(0xb13ba002L), tobe(0xfe6cc813L), +tobe(0x1609cdd3L), tobe(0x595ea5c2L), tobe(0x88a71df1L), tobe(0xc7f075e0L), +tobe(0xbadefc0aL), tobe(0xf589941bL), tobe(0x24702c28L), tobe(0x6b274439L), +tobe(0x834241f9L), tobe(0xcc1529e8L), tobe(0x1dec91dbL), tobe(0x52bbf9caL), +tobe(0xc9e787ecL), tobe(0x86b0effdL), tobe(0x574957ceL), tobe(0x181e3fdfL), +tobe(0xf07b3a1fL), tobe(0xbf2c520eL), tobe(0x6ed5ea3dL), tobe(0x2182822cL), +tobe(0x2dd0ee65L), tobe(0x62878674L), tobe(0xb37e3e47L), tobe(0xfc295656L), +tobe(0x144c5396L), tobe(0x5b1b3b87L), tobe(0x8ae283b4L), tobe(0xc5b5eba5L), +tobe(0x5ee99583L), tobe(0x11befd92L), tobe(0xc04745a1L), tobe(0x8f102db0L), +tobe(0x67752870L), tobe(0x28224061L), tobe(0xf9dbf852L), tobe(0xb68c9043L), +tobe(0xcba219a9L), tobe(0x84f571b8L), tobe(0x550cc98bL), tobe(0x1a5ba19aL), +tobe(0xf23ea45aL), tobe(0xbd69cc4bL), tobe(0x6c907478L), tobe(0x23c71c69L), +tobe(0xb89b624fL), tobe(0xf7cc0a5eL), tobe(0x2635b26dL), tobe(0x6962da7cL), +tobe(0x8107dfbcL), tobe(0xce50b7adL), tobe(0x1fa90f9eL), tobe(0x50fe678fL), +tobe(0xe5f41c4aL), tobe(0xaaa3745bL), tobe(0x7b5acc68L), tobe(0x340da479L), +tobe(0xdc68a1b9L), tobe(0x933fc9a8L), tobe(0x42c6719bL), tobe(0x0d91198aL), +tobe(0x96cd67acL), tobe(0xd99a0fbdL), tobe(0x0863b78eL), tobe(0x4734df9fL), +tobe(0xaf51da5fL), tobe(0xe006b24eL), tobe(0x31ff0a7dL), tobe(0x7ea8626cL), +tobe(0x0386eb86L), tobe(0x4cd18397L), tobe(0x9d283ba4L), tobe(0xd27f53b5L), +tobe(0x3a1a5675L), tobe(0x754d3e64L), tobe(0xa4b48657L), tobe(0xebe3ee46L), +tobe(0x70bf9060L), tobe(0x3fe8f871L), tobe(0xee114042L), tobe(0xa1462853L), +tobe(0x49232d93L), tobe(0x06744582L), tobe(0xd78dfdb1L), tobe(0x98da95a0L), +tobe(0xb958178cL), tobe(0xf60f7f9dL), tobe(0x27f6c7aeL), tobe(0x68a1afbfL), +tobe(0x80c4aa7fL), tobe(0xcf93c26eL), tobe(0x1e6a7a5dL), tobe(0x513d124cL), +tobe(0xca616c6aL), tobe(0x8536047bL), tobe(0x54cfbc48L), tobe(0x1b98d459L), +tobe(0xf3fdd199L), tobe(0xbcaab988L), tobe(0x6d5301bbL), tobe(0x220469aaL), +tobe(0x5f2ae040L), tobe(0x107d8851L), tobe(0xc1843062L), tobe(0x8ed35873L), +tobe(0x66b65db3L), tobe(0x29e135a2L), tobe(0xf8188d91L), tobe(0xb74fe580L), +tobe(0x2c139ba6L), tobe(0x6344f3b7L), tobe(0xb2bd4b84L), tobe(0xfdea2395L), +tobe(0x158f2655L), tobe(0x5ad84e44L), tobe(0x8b21f677L), tobe(0xc4769e66L), +tobe(0x717ce5a3L), tobe(0x3e2b8db2L), tobe(0xefd23581L), tobe(0xa0855d90L), +tobe(0x48e05850L), tobe(0x07b73041L), tobe(0xd64e8872L), tobe(0x9919e063L), +tobe(0x02459e45L), tobe(0x4d12f654L), tobe(0x9ceb4e67L), tobe(0xd3bc2676L), +tobe(0x3bd923b6L), tobe(0x748e4ba7L), tobe(0xa577f394L), tobe(0xea209b85L), +tobe(0x970e126fL), tobe(0xd8597a7eL), tobe(0x09a0c24dL), tobe(0x46f7aa5cL), +tobe(0xae92af9cL), tobe(0xe1c5c78dL), tobe(0x303c7fbeL), tobe(0x7f6b17afL), +tobe(0xe4376989L), tobe(0xab600198L), tobe(0x7a99b9abL), tobe(0x35ced1baL), +tobe(0xddabd47aL), tobe(0x92fcbc6bL), tobe(0x43050458L), tobe(0x0c526c49L)}, +{ +tobe(0x00000000L), tobe(0x5ba1dccaL), tobe(0xb743b994L), tobe(0xece2655eL), +tobe(0x6a466e9fL), tobe(0x31e7b255L), tobe(0xdd05d70bL), tobe(0x86a40bc1L), +tobe(0xd48cdd3eL), tobe(0x8f2d01f4L), tobe(0x63cf64aaL), tobe(0x386eb860L), +tobe(0xbecab3a1L), tobe(0xe56b6f6bL), tobe(0x09890a35L), tobe(0x5228d6ffL), +tobe(0xadd8a7cbL), tobe(0xf6797b01L), tobe(0x1a9b1e5fL), tobe(0x413ac295L), +tobe(0xc79ec954L), tobe(0x9c3f159eL), tobe(0x70dd70c0L), tobe(0x2b7cac0aL), +tobe(0x79547af5L), tobe(0x22f5a63fL), tobe(0xce17c361L), tobe(0x95b61fabL), +tobe(0x1312146aL), tobe(0x48b3c8a0L), tobe(0xa451adfeL), tobe(0xfff07134L), +tobe(0x5f705221L), tobe(0x04d18eebL), tobe(0xe833ebb5L), tobe(0xb392377fL), +tobe(0x35363cbeL), tobe(0x6e97e074L), tobe(0x8275852aL), tobe(0xd9d459e0L), +tobe(0x8bfc8f1fL), tobe(0xd05d53d5L), tobe(0x3cbf368bL), tobe(0x671eea41L), +tobe(0xe1bae180L), tobe(0xba1b3d4aL), tobe(0x56f95814L), tobe(0x0d5884deL), +tobe(0xf2a8f5eaL), tobe(0xa9092920L), tobe(0x45eb4c7eL), tobe(0x1e4a90b4L), +tobe(0x98ee9b75L), tobe(0xc34f47bfL), tobe(0x2fad22e1L), tobe(0x740cfe2bL), +tobe(0x262428d4L), tobe(0x7d85f41eL), tobe(0x91679140L), tobe(0xcac64d8aL), +tobe(0x4c62464bL), tobe(0x17c39a81L), tobe(0xfb21ffdfL), tobe(0xa0802315L), +tobe(0xbee0a442L), tobe(0xe5417888L), tobe(0x09a31dd6L), tobe(0x5202c11cL), +tobe(0xd4a6caddL), tobe(0x8f071617L), tobe(0x63e57349L), tobe(0x3844af83L), +tobe(0x6a6c797cL), tobe(0x31cda5b6L), tobe(0xdd2fc0e8L), tobe(0x868e1c22L), +tobe(0x002a17e3L), tobe(0x5b8bcb29L), tobe(0xb769ae77L), tobe(0xecc872bdL), +tobe(0x13380389L), tobe(0x4899df43L), tobe(0xa47bba1dL), tobe(0xffda66d7L), +tobe(0x797e6d16L), tobe(0x22dfb1dcL), tobe(0xce3dd482L), tobe(0x959c0848L), +tobe(0xc7b4deb7L), tobe(0x9c15027dL), tobe(0x70f76723L), tobe(0x2b56bbe9L), +tobe(0xadf2b028L), tobe(0xf6536ce2L), tobe(0x1ab109bcL), tobe(0x4110d576L), +tobe(0xe190f663L), tobe(0xba312aa9L), tobe(0x56d34ff7L), tobe(0x0d72933dL), +tobe(0x8bd698fcL), tobe(0xd0774436L), tobe(0x3c952168L), tobe(0x6734fda2L), +tobe(0x351c2b5dL), tobe(0x6ebdf797L), tobe(0x825f92c9L), tobe(0xd9fe4e03L), +tobe(0x5f5a45c2L), tobe(0x04fb9908L), tobe(0xe819fc56L), tobe(0xb3b8209cL), +tobe(0x4c4851a8L), tobe(0x17e98d62L), tobe(0xfb0be83cL), tobe(0xa0aa34f6L), +tobe(0x260e3f37L), tobe(0x7dafe3fdL), tobe(0x914d86a3L), tobe(0xcaec5a69L), +tobe(0x98c48c96L), tobe(0xc365505cL), tobe(0x2f873502L), tobe(0x7426e9c8L), +tobe(0xf282e209L), tobe(0xa9233ec3L), tobe(0x45c15b9dL), tobe(0x1e608757L), +tobe(0x79005533L), tobe(0x22a189f9L), tobe(0xce43eca7L), tobe(0x95e2306dL), +tobe(0x13463bacL), tobe(0x48e7e766L), tobe(0xa4058238L), tobe(0xffa45ef2L), +tobe(0xad8c880dL), tobe(0xf62d54c7L), tobe(0x1acf3199L), tobe(0x416eed53L), +tobe(0xc7cae692L), tobe(0x9c6b3a58L), tobe(0x70895f06L), tobe(0x2b2883ccL), +tobe(0xd4d8f2f8L), tobe(0x8f792e32L), tobe(0x639b4b6cL), tobe(0x383a97a6L), +tobe(0xbe9e9c67L), tobe(0xe53f40adL), tobe(0x09dd25f3L), tobe(0x527cf939L), +tobe(0x00542fc6L), tobe(0x5bf5f30cL), tobe(0xb7179652L), tobe(0xecb64a98L), +tobe(0x6a124159L), tobe(0x31b39d93L), tobe(0xdd51f8cdL), tobe(0x86f02407L), +tobe(0x26700712L), tobe(0x7dd1dbd8L), tobe(0x9133be86L), tobe(0xca92624cL), +tobe(0x4c36698dL), tobe(0x1797b547L), tobe(0xfb75d019L), tobe(0xa0d40cd3L), +tobe(0xf2fcda2cL), tobe(0xa95d06e6L), tobe(0x45bf63b8L), tobe(0x1e1ebf72L), +tobe(0x98bab4b3L), tobe(0xc31b6879L), tobe(0x2ff90d27L), tobe(0x7458d1edL), +tobe(0x8ba8a0d9L), tobe(0xd0097c13L), tobe(0x3ceb194dL), tobe(0x674ac587L), +tobe(0xe1eece46L), tobe(0xba4f128cL), tobe(0x56ad77d2L), tobe(0x0d0cab18L), +tobe(0x5f247de7L), tobe(0x0485a12dL), tobe(0xe867c473L), tobe(0xb3c618b9L), +tobe(0x35621378L), tobe(0x6ec3cfb2L), tobe(0x8221aaecL), tobe(0xd9807626L), +tobe(0xc7e0f171L), tobe(0x9c412dbbL), tobe(0x70a348e5L), tobe(0x2b02942fL), +tobe(0xada69feeL), tobe(0xf6074324L), tobe(0x1ae5267aL), tobe(0x4144fab0L), +tobe(0x136c2c4fL), tobe(0x48cdf085L), tobe(0xa42f95dbL), tobe(0xff8e4911L), +tobe(0x792a42d0L), tobe(0x228b9e1aL), tobe(0xce69fb44L), tobe(0x95c8278eL), +tobe(0x6a3856baL), tobe(0x31998a70L), tobe(0xdd7bef2eL), tobe(0x86da33e4L), +tobe(0x007e3825L), tobe(0x5bdfe4efL), tobe(0xb73d81b1L), tobe(0xec9c5d7bL), +tobe(0xbeb48b84L), tobe(0xe515574eL), tobe(0x09f73210L), tobe(0x5256eedaL), +tobe(0xd4f2e51bL), tobe(0x8f5339d1L), tobe(0x63b15c8fL), tobe(0x38108045L), +tobe(0x9890a350L), tobe(0xc3317f9aL), tobe(0x2fd31ac4L), tobe(0x7472c60eL), +tobe(0xf2d6cdcfL), tobe(0xa9771105L), tobe(0x4595745bL), tobe(0x1e34a891L), +tobe(0x4c1c7e6eL), tobe(0x17bda2a4L), tobe(0xfb5fc7faL), tobe(0xa0fe1b30L), +tobe(0x265a10f1L), tobe(0x7dfbcc3bL), tobe(0x9119a965L), tobe(0xcab875afL), +tobe(0x3548049bL), tobe(0x6ee9d851L), tobe(0x820bbd0fL), tobe(0xd9aa61c5L), +tobe(0x5f0e6a04L), tobe(0x04afb6ceL), tobe(0xe84dd390L), tobe(0xb3ec0f5aL), +tobe(0xe1c4d9a5L), tobe(0xba65056fL), tobe(0x56876031L), tobe(0x0d26bcfbL), +tobe(0x8b82b73aL), tobe(0xd0236bf0L), tobe(0x3cc10eaeL), tobe(0x6760d264L)}, +}; +static u32 __cacheline_aligned crc32ctable_le[8][256] = {{ +tole(0x00000000L), tole(0xf26b8303L), tole(0xe13b70f7L), tole(0x1350f3f4L), +tole(0xc79a971fL), tole(0x35f1141cL), tole(0x26a1e7e8L), tole(0xd4ca64ebL), +tole(0x8ad958cfL), tole(0x78b2dbccL), tole(0x6be22838L), tole(0x9989ab3bL), +tole(0x4d43cfd0L), tole(0xbf284cd3L), tole(0xac78bf27L), tole(0x5e133c24L), +tole(0x105ec76fL), tole(0xe235446cL), tole(0xf165b798L), tole(0x030e349bL), +tole(0xd7c45070L), tole(0x25afd373L), tole(0x36ff2087L), tole(0xc494a384L), +tole(0x9a879fa0L), tole(0x68ec1ca3L), tole(0x7bbcef57L), tole(0x89d76c54L), +tole(0x5d1d08bfL), tole(0xaf768bbcL), tole(0xbc267848L), tole(0x4e4dfb4bL), +tole(0x20bd8edeL), tole(0xd2d60dddL), tole(0xc186fe29L), tole(0x33ed7d2aL), +tole(0xe72719c1L), tole(0x154c9ac2L), tole(0x061c6936L), tole(0xf477ea35L), +tole(0xaa64d611L), tole(0x580f5512L), tole(0x4b5fa6e6L), tole(0xb93425e5L), +tole(0x6dfe410eL), tole(0x9f95c20dL), tole(0x8cc531f9L), tole(0x7eaeb2faL), +tole(0x30e349b1L), tole(0xc288cab2L), tole(0xd1d83946L), tole(0x23b3ba45L), +tole(0xf779deaeL), tole(0x05125dadL), tole(0x1642ae59L), tole(0xe4292d5aL), +tole(0xba3a117eL), tole(0x4851927dL), tole(0x5b016189L), tole(0xa96ae28aL), +tole(0x7da08661L), tole(0x8fcb0562L), tole(0x9c9bf696L), tole(0x6ef07595L), +tole(0x417b1dbcL), tole(0xb3109ebfL), tole(0xa0406d4bL), tole(0x522bee48L), +tole(0x86e18aa3L), tole(0x748a09a0L), tole(0x67dafa54L), tole(0x95b17957L), +tole(0xcba24573L), tole(0x39c9c670L), tole(0x2a993584L), tole(0xd8f2b687L), +tole(0x0c38d26cL), tole(0xfe53516fL), tole(0xed03a29bL), tole(0x1f682198L), +tole(0x5125dad3L), tole(0xa34e59d0L), tole(0xb01eaa24L), tole(0x42752927L), +tole(0x96bf4dccL), tole(0x64d4cecfL), tole(0x77843d3bL), tole(0x85efbe38L), +tole(0xdbfc821cL), tole(0x2997011fL), tole(0x3ac7f2ebL), tole(0xc8ac71e8L), +tole(0x1c661503L), tole(0xee0d9600L), tole(0xfd5d65f4L), tole(0x0f36e6f7L), +tole(0x61c69362L), tole(0x93ad1061L), tole(0x80fde395L), tole(0x72966096L), +tole(0xa65c047dL), tole(0x5437877eL), tole(0x4767748aL), tole(0xb50cf789L), +tole(0xeb1fcbadL), tole(0x197448aeL), tole(0x0a24bb5aL), tole(0xf84f3859L), +tole(0x2c855cb2L), tole(0xdeeedfb1L), tole(0xcdbe2c45L), tole(0x3fd5af46L), +tole(0x7198540dL), tole(0x83f3d70eL), tole(0x90a324faL), tole(0x62c8a7f9L), +tole(0xb602c312L), tole(0x44694011L), tole(0x5739b3e5L), tole(0xa55230e6L), +tole(0xfb410cc2L), tole(0x092a8fc1L), tole(0x1a7a7c35L), tole(0xe811ff36L), +tole(0x3cdb9bddL), tole(0xceb018deL), tole(0xdde0eb2aL), tole(0x2f8b6829L), +tole(0x82f63b78L), tole(0x709db87bL), tole(0x63cd4b8fL), tole(0x91a6c88cL), +tole(0x456cac67L), tole(0xb7072f64L), tole(0xa457dc90L), tole(0x563c5f93L), +tole(0x082f63b7L), tole(0xfa44e0b4L), tole(0xe9141340L), tole(0x1b7f9043L), +tole(0xcfb5f4a8L), tole(0x3dde77abL), tole(0x2e8e845fL), tole(0xdce5075cL), +tole(0x92a8fc17L), tole(0x60c37f14L), tole(0x73938ce0L), tole(0x81f80fe3L), +tole(0x55326b08L), tole(0xa759e80bL), tole(0xb4091bffL), tole(0x466298fcL), +tole(0x1871a4d8L), tole(0xea1a27dbL), tole(0xf94ad42fL), tole(0x0b21572cL), +tole(0xdfeb33c7L), tole(0x2d80b0c4L), tole(0x3ed04330L), tole(0xccbbc033L), +tole(0xa24bb5a6L), tole(0x502036a5L), tole(0x4370c551L), tole(0xb11b4652L), +tole(0x65d122b9L), tole(0x97baa1baL), tole(0x84ea524eL), tole(0x7681d14dL), +tole(0x2892ed69L), tole(0xdaf96e6aL), tole(0xc9a99d9eL), tole(0x3bc21e9dL), +tole(0xef087a76L), tole(0x1d63f975L), tole(0x0e330a81L), tole(0xfc588982L), +tole(0xb21572c9L), tole(0x407ef1caL), tole(0x532e023eL), tole(0xa145813dL), +tole(0x758fe5d6L), tole(0x87e466d5L), tole(0x94b49521L), tole(0x66df1622L), +tole(0x38cc2a06L), tole(0xcaa7a905L), tole(0xd9f75af1L), tole(0x2b9cd9f2L), +tole(0xff56bd19L), tole(0x0d3d3e1aL), tole(0x1e6dcdeeL), tole(0xec064eedL), +tole(0xc38d26c4L), tole(0x31e6a5c7L), tole(0x22b65633L), tole(0xd0ddd530L), +tole(0x0417b1dbL), tole(0xf67c32d8L), tole(0xe52cc12cL), tole(0x1747422fL), +tole(0x49547e0bL), tole(0xbb3ffd08L), tole(0xa86f0efcL), tole(0x5a048dffL), +tole(0x8ecee914L), tole(0x7ca56a17L), tole(0x6ff599e3L), tole(0x9d9e1ae0L), +tole(0xd3d3e1abL), tole(0x21b862a8L), tole(0x32e8915cL), tole(0xc083125fL), +tole(0x144976b4L), tole(0xe622f5b7L), tole(0xf5720643L), tole(0x07198540L), +tole(0x590ab964L), tole(0xab613a67L), tole(0xb831c993L), tole(0x4a5a4a90L), +tole(0x9e902e7bL), tole(0x6cfbad78L), tole(0x7fab5e8cL), tole(0x8dc0dd8fL), +tole(0xe330a81aL), tole(0x115b2b19L), tole(0x020bd8edL), tole(0xf0605beeL), +tole(0x24aa3f05L), tole(0xd6c1bc06L), tole(0xc5914ff2L), tole(0x37faccf1L), +tole(0x69e9f0d5L), tole(0x9b8273d6L), tole(0x88d28022L), tole(0x7ab90321L), +tole(0xae7367caL), tole(0x5c18e4c9L), tole(0x4f48173dL), tole(0xbd23943eL), +tole(0xf36e6f75L), tole(0x0105ec76L), tole(0x12551f82L), tole(0xe03e9c81L), +tole(0x34f4f86aL), tole(0xc69f7b69L), tole(0xd5cf889dL), tole(0x27a40b9eL), +tole(0x79b737baL), tole(0x8bdcb4b9L), tole(0x988c474dL), tole(0x6ae7c44eL), +tole(0xbe2da0a5L), tole(0x4c4623a6L), tole(0x5f16d052L), tole(0xad7d5351L)}, +{ +tole(0x00000000L), tole(0x13a29877L), tole(0x274530eeL), tole(0x34e7a899L), +tole(0x4e8a61dcL), tole(0x5d28f9abL), tole(0x69cf5132L), tole(0x7a6dc945L), +tole(0x9d14c3b8L), tole(0x8eb65bcfL), tole(0xba51f356L), tole(0xa9f36b21L), +tole(0xd39ea264L), tole(0xc03c3a13L), tole(0xf4db928aL), tole(0xe7790afdL), +tole(0x3fc5f181L), tole(0x2c6769f6L), tole(0x1880c16fL), tole(0x0b225918L), +tole(0x714f905dL), tole(0x62ed082aL), tole(0x560aa0b3L), tole(0x45a838c4L), +tole(0xa2d13239L), tole(0xb173aa4eL), tole(0x859402d7L), tole(0x96369aa0L), +tole(0xec5b53e5L), tole(0xfff9cb92L), tole(0xcb1e630bL), tole(0xd8bcfb7cL), +tole(0x7f8be302L), tole(0x6c297b75L), tole(0x58ced3ecL), tole(0x4b6c4b9bL), +tole(0x310182deL), tole(0x22a31aa9L), tole(0x1644b230L), tole(0x05e62a47L), +tole(0xe29f20baL), tole(0xf13db8cdL), tole(0xc5da1054L), tole(0xd6788823L), +tole(0xac154166L), tole(0xbfb7d911L), tole(0x8b507188L), tole(0x98f2e9ffL), +tole(0x404e1283L), tole(0x53ec8af4L), tole(0x670b226dL), tole(0x74a9ba1aL), +tole(0x0ec4735fL), tole(0x1d66eb28L), tole(0x298143b1L), tole(0x3a23dbc6L), +tole(0xdd5ad13bL), tole(0xcef8494cL), tole(0xfa1fe1d5L), tole(0xe9bd79a2L), +tole(0x93d0b0e7L), tole(0x80722890L), tole(0xb4958009L), tole(0xa737187eL), +tole(0xff17c604L), tole(0xecb55e73L), tole(0xd852f6eaL), tole(0xcbf06e9dL), +tole(0xb19da7d8L), tole(0xa23f3fafL), tole(0x96d89736L), tole(0x857a0f41L), +tole(0x620305bcL), tole(0x71a19dcbL), tole(0x45463552L), tole(0x56e4ad25L), +tole(0x2c896460L), tole(0x3f2bfc17L), tole(0x0bcc548eL), tole(0x186eccf9L), +tole(0xc0d23785L), tole(0xd370aff2L), tole(0xe797076bL), tole(0xf4359f1cL), +tole(0x8e585659L), tole(0x9dface2eL), tole(0xa91d66b7L), tole(0xbabffec0L), +tole(0x5dc6f43dL), tole(0x4e646c4aL), tole(0x7a83c4d3L), tole(0x69215ca4L), +tole(0x134c95e1L), tole(0x00ee0d96L), tole(0x3409a50fL), tole(0x27ab3d78L), +tole(0x809c2506L), tole(0x933ebd71L), tole(0xa7d915e8L), tole(0xb47b8d9fL), +tole(0xce1644daL), tole(0xddb4dcadL), tole(0xe9537434L), tole(0xfaf1ec43L), +tole(0x1d88e6beL), tole(0x0e2a7ec9L), tole(0x3acdd650L), tole(0x296f4e27L), +tole(0x53028762L), tole(0x40a01f15L), tole(0x7447b78cL), tole(0x67e52ffbL), +tole(0xbf59d487L), tole(0xacfb4cf0L), tole(0x981ce469L), tole(0x8bbe7c1eL), +tole(0xf1d3b55bL), tole(0xe2712d2cL), tole(0xd69685b5L), tole(0xc5341dc2L), +tole(0x224d173fL), tole(0x31ef8f48L), tole(0x050827d1L), tole(0x16aabfa6L), +tole(0x6cc776e3L), tole(0x7f65ee94L), tole(0x4b82460dL), tole(0x5820de7aL), +tole(0xfbc3faf9L), tole(0xe861628eL), tole(0xdc86ca17L), tole(0xcf245260L), +tole(0xb5499b25L), tole(0xa6eb0352L), tole(0x920cabcbL), tole(0x81ae33bcL), +tole(0x66d73941L), tole(0x7575a136L), tole(0x419209afL), tole(0x523091d8L), +tole(0x285d589dL), tole(0x3bffc0eaL), tole(0x0f186873L), tole(0x1cbaf004L), +tole(0xc4060b78L), tole(0xd7a4930fL), tole(0xe3433b96L), tole(0xf0e1a3e1L), +tole(0x8a8c6aa4L), tole(0x992ef2d3L), tole(0xadc95a4aL), tole(0xbe6bc23dL), +tole(0x5912c8c0L), tole(0x4ab050b7L), tole(0x7e57f82eL), tole(0x6df56059L), +tole(0x1798a91cL), tole(0x043a316bL), tole(0x30dd99f2L), tole(0x237f0185L), +tole(0x844819fbL), tole(0x97ea818cL), tole(0xa30d2915L), tole(0xb0afb162L), +tole(0xcac27827L), tole(0xd960e050L), tole(0xed8748c9L), tole(0xfe25d0beL), +tole(0x195cda43L), tole(0x0afe4234L), tole(0x3e19eaadL), tole(0x2dbb72daL), +tole(0x57d6bb9fL), tole(0x447423e8L), tole(0x70938b71L), tole(0x63311306L), +tole(0xbb8de87aL), tole(0xa82f700dL), tole(0x9cc8d894L), tole(0x8f6a40e3L), +tole(0xf50789a6L), tole(0xe6a511d1L), tole(0xd242b948L), tole(0xc1e0213fL), +tole(0x26992bc2L), tole(0x353bb3b5L), tole(0x01dc1b2cL), tole(0x127e835bL), +tole(0x68134a1eL), tole(0x7bb1d269L), tole(0x4f567af0L), tole(0x5cf4e287L), +tole(0x04d43cfdL), tole(0x1776a48aL), tole(0x23910c13L), tole(0x30339464L), +tole(0x4a5e5d21L), tole(0x59fcc556L), tole(0x6d1b6dcfL), tole(0x7eb9f5b8L), +tole(0x99c0ff45L), tole(0x8a626732L), tole(0xbe85cfabL), tole(0xad2757dcL), +tole(0xd74a9e99L), tole(0xc4e806eeL), tole(0xf00fae77L), tole(0xe3ad3600L), +tole(0x3b11cd7cL), tole(0x28b3550bL), tole(0x1c54fd92L), tole(0x0ff665e5L), +tole(0x759baca0L), tole(0x663934d7L), tole(0x52de9c4eL), tole(0x417c0439L), +tole(0xa6050ec4L), tole(0xb5a796b3L), tole(0x81403e2aL), tole(0x92e2a65dL), +tole(0xe88f6f18L), tole(0xfb2df76fL), tole(0xcfca5ff6L), tole(0xdc68c781L), +tole(0x7b5fdfffL), tole(0x68fd4788L), tole(0x5c1aef11L), tole(0x4fb87766L), +tole(0x35d5be23L), tole(0x26772654L), tole(0x12908ecdL), tole(0x013216baL), +tole(0xe64b1c47L), tole(0xf5e98430L), tole(0xc10e2ca9L), tole(0xd2acb4deL), +tole(0xa8c17d9bL), tole(0xbb63e5ecL), tole(0x8f844d75L), tole(0x9c26d502L), +tole(0x449a2e7eL), tole(0x5738b609L), tole(0x63df1e90L), tole(0x707d86e7L), +tole(0x0a104fa2L), tole(0x19b2d7d5L), tole(0x2d557f4cL), tole(0x3ef7e73bL), +tole(0xd98eedc6L), tole(0xca2c75b1L), tole(0xfecbdd28L), tole(0xed69455fL), +tole(0x97048c1aL), tole(0x84a6146dL), tole(0xb041bcf4L), tole(0xa3e32483L)}, +{ +tole(0x00000000L), tole(0xa541927eL), tole(0x4f6f520dL), tole(0xea2ec073L), +tole(0x9edea41aL), tole(0x3b9f3664L), tole(0xd1b1f617L), tole(0x74f06469L), +tole(0x38513ec5L), tole(0x9d10acbbL), tole(0x773e6cc8L), tole(0xd27ffeb6L), +tole(0xa68f9adfL), tole(0x03ce08a1L), tole(0xe9e0c8d2L), tole(0x4ca15aacL), +tole(0x70a27d8aL), tole(0xd5e3eff4L), tole(0x3fcd2f87L), tole(0x9a8cbdf9L), +tole(0xee7cd990L), tole(0x4b3d4beeL), tole(0xa1138b9dL), tole(0x045219e3L), +tole(0x48f3434fL), tole(0xedb2d131L), tole(0x079c1142L), tole(0xa2dd833cL), +tole(0xd62de755L), tole(0x736c752bL), tole(0x9942b558L), tole(0x3c032726L), +tole(0xe144fb14L), tole(0x4405696aL), tole(0xae2ba919L), tole(0x0b6a3b67L), +tole(0x7f9a5f0eL), tole(0xdadbcd70L), tole(0x30f50d03L), tole(0x95b49f7dL), +tole(0xd915c5d1L), tole(0x7c5457afL), tole(0x967a97dcL), tole(0x333b05a2L), +tole(0x47cb61cbL), tole(0xe28af3b5L), tole(0x08a433c6L), tole(0xade5a1b8L), +tole(0x91e6869eL), tole(0x34a714e0L), tole(0xde89d493L), tole(0x7bc846edL), +tole(0x0f382284L), tole(0xaa79b0faL), tole(0x40577089L), tole(0xe516e2f7L), +tole(0xa9b7b85bL), tole(0x0cf62a25L), tole(0xe6d8ea56L), tole(0x43997828L), +tole(0x37691c41L), tole(0x92288e3fL), tole(0x78064e4cL), tole(0xdd47dc32L), +tole(0xc76580d9L), tole(0x622412a7L), tole(0x880ad2d4L), tole(0x2d4b40aaL), +tole(0x59bb24c3L), tole(0xfcfab6bdL), tole(0x16d476ceL), tole(0xb395e4b0L), +tole(0xff34be1cL), tole(0x5a752c62L), tole(0xb05bec11L), tole(0x151a7e6fL), +tole(0x61ea1a06L), tole(0xc4ab8878L), tole(0x2e85480bL), tole(0x8bc4da75L), +tole(0xb7c7fd53L), tole(0x12866f2dL), tole(0xf8a8af5eL), tole(0x5de93d20L), +tole(0x29195949L), tole(0x8c58cb37L), tole(0x66760b44L), tole(0xc337993aL), +tole(0x8f96c396L), tole(0x2ad751e8L), tole(0xc0f9919bL), tole(0x65b803e5L), +tole(0x1148678cL), tole(0xb409f5f2L), tole(0x5e273581L), tole(0xfb66a7ffL), +tole(0x26217bcdL), tole(0x8360e9b3L), tole(0x694e29c0L), tole(0xcc0fbbbeL), +tole(0xb8ffdfd7L), tole(0x1dbe4da9L), tole(0xf7908ddaL), tole(0x52d11fa4L), +tole(0x1e704508L), tole(0xbb31d776L), tole(0x511f1705L), tole(0xf45e857bL), +tole(0x80aee112L), tole(0x25ef736cL), tole(0xcfc1b31fL), tole(0x6a802161L), +tole(0x56830647L), tole(0xf3c29439L), tole(0x19ec544aL), tole(0xbcadc634L), +tole(0xc85da25dL), tole(0x6d1c3023L), tole(0x8732f050L), tole(0x2273622eL), +tole(0x6ed23882L), tole(0xcb93aafcL), tole(0x21bd6a8fL), tole(0x84fcf8f1L), +tole(0xf00c9c98L), tole(0x554d0ee6L), tole(0xbf63ce95L), tole(0x1a225cebL), +tole(0x8b277743L), tole(0x2e66e53dL), tole(0xc448254eL), tole(0x6109b730L), +tole(0x15f9d359L), tole(0xb0b84127L), tole(0x5a968154L), tole(0xffd7132aL), +tole(0xb3764986L), tole(0x1637dbf8L), tole(0xfc191b8bL), tole(0x595889f5L), +tole(0x2da8ed9cL), tole(0x88e97fe2L), tole(0x62c7bf91L), tole(0xc7862defL), +tole(0xfb850ac9L), tole(0x5ec498b7L), tole(0xb4ea58c4L), tole(0x11abcabaL), +tole(0x655baed3L), tole(0xc01a3cadL), tole(0x2a34fcdeL), tole(0x8f756ea0L), +tole(0xc3d4340cL), tole(0x6695a672L), tole(0x8cbb6601L), tole(0x29faf47fL), +tole(0x5d0a9016L), tole(0xf84b0268L), tole(0x1265c21bL), tole(0xb7245065L), +tole(0x6a638c57L), tole(0xcf221e29L), tole(0x250cde5aL), tole(0x804d4c24L), +tole(0xf4bd284dL), tole(0x51fcba33L), tole(0xbbd27a40L), tole(0x1e93e83eL), +tole(0x5232b292L), tole(0xf77320ecL), tole(0x1d5de09fL), tole(0xb81c72e1L), +tole(0xccec1688L), tole(0x69ad84f6L), tole(0x83834485L), tole(0x26c2d6fbL), +tole(0x1ac1f1ddL), tole(0xbf8063a3L), tole(0x55aea3d0L), tole(0xf0ef31aeL), +tole(0x841f55c7L), tole(0x215ec7b9L), tole(0xcb7007caL), tole(0x6e3195b4L), +tole(0x2290cf18L), tole(0x87d15d66L), tole(0x6dff9d15L), tole(0xc8be0f6bL), +tole(0xbc4e6b02L), tole(0x190ff97cL), tole(0xf321390fL), tole(0x5660ab71L), +tole(0x4c42f79aL), tole(0xe90365e4L), tole(0x032da597L), tole(0xa66c37e9L), +tole(0xd29c5380L), tole(0x77ddc1feL), tole(0x9df3018dL), tole(0x38b293f3L), +tole(0x7413c95fL), tole(0xd1525b21L), tole(0x3b7c9b52L), tole(0x9e3d092cL), +tole(0xeacd6d45L), tole(0x4f8cff3bL), tole(0xa5a23f48L), tole(0x00e3ad36L), +tole(0x3ce08a10L), tole(0x99a1186eL), tole(0x738fd81dL), tole(0xd6ce4a63L), +tole(0xa23e2e0aL), tole(0x077fbc74L), tole(0xed517c07L), tole(0x4810ee79L), +tole(0x04b1b4d5L), tole(0xa1f026abL), tole(0x4bdee6d8L), tole(0xee9f74a6L), +tole(0x9a6f10cfL), tole(0x3f2e82b1L), tole(0xd50042c2L), tole(0x7041d0bcL), +tole(0xad060c8eL), tole(0x08479ef0L), tole(0xe2695e83L), tole(0x4728ccfdL), +tole(0x33d8a894L), tole(0x96993aeaL), tole(0x7cb7fa99L), tole(0xd9f668e7L), +tole(0x9557324bL), tole(0x3016a035L), tole(0xda386046L), tole(0x7f79f238L), +tole(0x0b899651L), tole(0xaec8042fL), tole(0x44e6c45cL), tole(0xe1a75622L), +tole(0xdda47104L), tole(0x78e5e37aL), tole(0x92cb2309L), tole(0x378ab177L), +tole(0x437ad51eL), tole(0xe63b4760L), tole(0x0c158713L), tole(0xa954156dL), +tole(0xe5f54fc1L), tole(0x40b4ddbfL), tole(0xaa9a1dccL), tole(0x0fdb8fb2L), +tole(0x7b2bebdbL), tole(0xde6a79a5L), tole(0x3444b9d6L), tole(0x91052ba8L)}, +{ +tole(0x00000000L), tole(0xdd45aab8L), tole(0xbf672381L), tole(0x62228939L), +tole(0x7b2231f3L), tole(0xa6679b4bL), tole(0xc4451272L), tole(0x1900b8caL), +tole(0xf64463e6L), tole(0x2b01c95eL), tole(0x49234067L), tole(0x9466eadfL), +tole(0x8d665215L), tole(0x5023f8adL), tole(0x32017194L), tole(0xef44db2cL), +tole(0xe964b13dL), tole(0x34211b85L), tole(0x560392bcL), tole(0x8b463804L), +tole(0x924680ceL), tole(0x4f032a76L), tole(0x2d21a34fL), tole(0xf06409f7L), +tole(0x1f20d2dbL), tole(0xc2657863L), tole(0xa047f15aL), tole(0x7d025be2L), +tole(0x6402e328L), tole(0xb9474990L), tole(0xdb65c0a9L), tole(0x06206a11L), +tole(0xd725148bL), tole(0x0a60be33L), tole(0x6842370aL), tole(0xb5079db2L), +tole(0xac072578L), tole(0x71428fc0L), tole(0x136006f9L), tole(0xce25ac41L), +tole(0x2161776dL), tole(0xfc24ddd5L), tole(0x9e0654ecL), tole(0x4343fe54L), +tole(0x5a43469eL), tole(0x8706ec26L), tole(0xe524651fL), tole(0x3861cfa7L), +tole(0x3e41a5b6L), tole(0xe3040f0eL), tole(0x81268637L), tole(0x5c632c8fL), +tole(0x45639445L), tole(0x98263efdL), tole(0xfa04b7c4L), tole(0x27411d7cL), +tole(0xc805c650L), tole(0x15406ce8L), tole(0x7762e5d1L), tole(0xaa274f69L), +tole(0xb327f7a3L), tole(0x6e625d1bL), tole(0x0c40d422L), tole(0xd1057e9aL), +tole(0xaba65fe7L), tole(0x76e3f55fL), tole(0x14c17c66L), tole(0xc984d6deL), +tole(0xd0846e14L), tole(0x0dc1c4acL), tole(0x6fe34d95L), tole(0xb2a6e72dL), +tole(0x5de23c01L), tole(0x80a796b9L), tole(0xe2851f80L), tole(0x3fc0b538L), +tole(0x26c00df2L), tole(0xfb85a74aL), tole(0x99a72e73L), tole(0x44e284cbL), +tole(0x42c2eedaL), tole(0x9f874462L), tole(0xfda5cd5bL), tole(0x20e067e3L), +tole(0x39e0df29L), tole(0xe4a57591L), tole(0x8687fca8L), tole(0x5bc25610L), +tole(0xb4868d3cL), tole(0x69c32784L), tole(0x0be1aebdL), tole(0xd6a40405L), +tole(0xcfa4bccfL), tole(0x12e11677L), tole(0x70c39f4eL), tole(0xad8635f6L), +tole(0x7c834b6cL), tole(0xa1c6e1d4L), tole(0xc3e468edL), tole(0x1ea1c255L), +tole(0x07a17a9fL), tole(0xdae4d027L), tole(0xb8c6591eL), tole(0x6583f3a6L), +tole(0x8ac7288aL), tole(0x57828232L), tole(0x35a00b0bL), tole(0xe8e5a1b3L), +tole(0xf1e51979L), tole(0x2ca0b3c1L), tole(0x4e823af8L), tole(0x93c79040L), +tole(0x95e7fa51L), tole(0x48a250e9L), tole(0x2a80d9d0L), tole(0xf7c57368L), +tole(0xeec5cba2L), tole(0x3380611aL), tole(0x51a2e823L), tole(0x8ce7429bL), +tole(0x63a399b7L), tole(0xbee6330fL), tole(0xdcc4ba36L), tole(0x0181108eL), +tole(0x1881a844L), tole(0xc5c402fcL), tole(0xa7e68bc5L), tole(0x7aa3217dL), +tole(0x52a0c93fL), tole(0x8fe56387L), tole(0xedc7eabeL), tole(0x30824006L), +tole(0x2982f8ccL), tole(0xf4c75274L), tole(0x96e5db4dL), tole(0x4ba071f5L), +tole(0xa4e4aad9L), tole(0x79a10061L), tole(0x1b838958L), tole(0xc6c623e0L), +tole(0xdfc69b2aL), tole(0x02833192L), tole(0x60a1b8abL), tole(0xbde41213L), +tole(0xbbc47802L), tole(0x6681d2baL), tole(0x04a35b83L), tole(0xd9e6f13bL), +tole(0xc0e649f1L), tole(0x1da3e349L), tole(0x7f816a70L), tole(0xa2c4c0c8L), +tole(0x4d801be4L), tole(0x90c5b15cL), tole(0xf2e73865L), tole(0x2fa292ddL), +tole(0x36a22a17L), tole(0xebe780afL), tole(0x89c50996L), tole(0x5480a32eL), +tole(0x8585ddb4L), tole(0x58c0770cL), tole(0x3ae2fe35L), tole(0xe7a7548dL), +tole(0xfea7ec47L), tole(0x23e246ffL), tole(0x41c0cfc6L), tole(0x9c85657eL), +tole(0x73c1be52L), tole(0xae8414eaL), tole(0xcca69dd3L), tole(0x11e3376bL), +tole(0x08e38fa1L), tole(0xd5a62519L), tole(0xb784ac20L), tole(0x6ac10698L), +tole(0x6ce16c89L), tole(0xb1a4c631L), tole(0xd3864f08L), tole(0x0ec3e5b0L), +tole(0x17c35d7aL), tole(0xca86f7c2L), tole(0xa8a47efbL), tole(0x75e1d443L), +tole(0x9aa50f6fL), tole(0x47e0a5d7L), tole(0x25c22ceeL), tole(0xf8878656L), +tole(0xe1873e9cL), tole(0x3cc29424L), tole(0x5ee01d1dL), tole(0x83a5b7a5L), +tole(0xf90696d8L), tole(0x24433c60L), tole(0x4661b559L), tole(0x9b241fe1L), +tole(0x8224a72bL), tole(0x5f610d93L), tole(0x3d4384aaL), tole(0xe0062e12L), +tole(0x0f42f53eL), tole(0xd2075f86L), tole(0xb025d6bfL), tole(0x6d607c07L), +tole(0x7460c4cdL), tole(0xa9256e75L), tole(0xcb07e74cL), tole(0x16424df4L), +tole(0x106227e5L), tole(0xcd278d5dL), tole(0xaf050464L), tole(0x7240aedcL), +tole(0x6b401616L), tole(0xb605bcaeL), tole(0xd4273597L), tole(0x09629f2fL), +tole(0xe6264403L), tole(0x3b63eebbL), tole(0x59416782L), tole(0x8404cd3aL), +tole(0x9d0475f0L), tole(0x4041df48L), tole(0x22635671L), tole(0xff26fcc9L), +tole(0x2e238253L), tole(0xf36628ebL), tole(0x9144a1d2L), tole(0x4c010b6aL), +tole(0x5501b3a0L), tole(0x88441918L), tole(0xea669021L), tole(0x37233a99L), +tole(0xd867e1b5L), tole(0x05224b0dL), tole(0x6700c234L), tole(0xba45688cL), +tole(0xa345d046L), tole(0x7e007afeL), tole(0x1c22f3c7L), tole(0xc167597fL), +tole(0xc747336eL), tole(0x1a0299d6L), tole(0x782010efL), tole(0xa565ba57L), +tole(0xbc65029dL), tole(0x6120a825L), tole(0x0302211cL), tole(0xde478ba4L), +tole(0x31035088L), tole(0xec46fa30L), tole(0x8e647309L), tole(0x5321d9b1L), +tole(0x4a21617bL), tole(0x9764cbc3L), tole(0xf54642faL), tole(0x2803e842L)}, +{ +tole(0x00000000L), tole(0x38116facL), tole(0x7022df58L), tole(0x4833b0f4L), +tole(0xe045beb0L), tole(0xd854d11cL), tole(0x906761e8L), tole(0xa8760e44L), +tole(0xc5670b91L), tole(0xfd76643dL), tole(0xb545d4c9L), tole(0x8d54bb65L), +tole(0x2522b521L), tole(0x1d33da8dL), tole(0x55006a79L), tole(0x6d1105d5L), +tole(0x8f2261d3L), tole(0xb7330e7fL), tole(0xff00be8bL), tole(0xc711d127L), +tole(0x6f67df63L), tole(0x5776b0cfL), tole(0x1f45003bL), tole(0x27546f97L), +tole(0x4a456a42L), tole(0x725405eeL), tole(0x3a67b51aL), tole(0x0276dab6L), +tole(0xaa00d4f2L), tole(0x9211bb5eL), tole(0xda220baaL), tole(0xe2336406L), +tole(0x1ba8b557L), tole(0x23b9dafbL), tole(0x6b8a6a0fL), tole(0x539b05a3L), +tole(0xfbed0be7L), tole(0xc3fc644bL), tole(0x8bcfd4bfL), tole(0xb3debb13L), +tole(0xdecfbec6L), tole(0xe6ded16aL), tole(0xaeed619eL), tole(0x96fc0e32L), +tole(0x3e8a0076L), tole(0x069b6fdaL), tole(0x4ea8df2eL), tole(0x76b9b082L), +tole(0x948ad484L), tole(0xac9bbb28L), tole(0xe4a80bdcL), tole(0xdcb96470L), +tole(0x74cf6a34L), tole(0x4cde0598L), tole(0x04edb56cL), tole(0x3cfcdac0L), +tole(0x51eddf15L), tole(0x69fcb0b9L), tole(0x21cf004dL), tole(0x19de6fe1L), +tole(0xb1a861a5L), tole(0x89b90e09L), tole(0xc18abefdL), tole(0xf99bd151L), +tole(0x37516aaeL), tole(0x0f400502L), tole(0x4773b5f6L), tole(0x7f62da5aL), +tole(0xd714d41eL), tole(0xef05bbb2L), tole(0xa7360b46L), tole(0x9f2764eaL), +tole(0xf236613fL), tole(0xca270e93L), tole(0x8214be67L), tole(0xba05d1cbL), +tole(0x1273df8fL), tole(0x2a62b023L), tole(0x625100d7L), tole(0x5a406f7bL), +tole(0xb8730b7dL), tole(0x806264d1L), tole(0xc851d425L), tole(0xf040bb89L), +tole(0x5836b5cdL), tole(0x6027da61L), tole(0x28146a95L), tole(0x10050539L), +tole(0x7d1400ecL), tole(0x45056f40L), tole(0x0d36dfb4L), tole(0x3527b018L), +tole(0x9d51be5cL), tole(0xa540d1f0L), tole(0xed736104L), tole(0xd5620ea8L), +tole(0x2cf9dff9L), tole(0x14e8b055L), tole(0x5cdb00a1L), tole(0x64ca6f0dL), +tole(0xccbc6149L), tole(0xf4ad0ee5L), tole(0xbc9ebe11L), tole(0x848fd1bdL), +tole(0xe99ed468L), tole(0xd18fbbc4L), tole(0x99bc0b30L), tole(0xa1ad649cL), +tole(0x09db6ad8L), tole(0x31ca0574L), tole(0x79f9b580L), tole(0x41e8da2cL), +tole(0xa3dbbe2aL), tole(0x9bcad186L), tole(0xd3f96172L), tole(0xebe80edeL), +tole(0x439e009aL), tole(0x7b8f6f36L), tole(0x33bcdfc2L), tole(0x0badb06eL), +tole(0x66bcb5bbL), tole(0x5eadda17L), tole(0x169e6ae3L), tole(0x2e8f054fL), +tole(0x86f90b0bL), tole(0xbee864a7L), tole(0xf6dbd453L), tole(0xcecabbffL), +tole(0x6ea2d55cL), tole(0x56b3baf0L), tole(0x1e800a04L), tole(0x269165a8L), +tole(0x8ee76becL), tole(0xb6f60440L), tole(0xfec5b4b4L), tole(0xc6d4db18L), +tole(0xabc5decdL), tole(0x93d4b161L), tole(0xdbe70195L), tole(0xe3f66e39L), +tole(0x4b80607dL), tole(0x73910fd1L), tole(0x3ba2bf25L), tole(0x03b3d089L), +tole(0xe180b48fL), tole(0xd991db23L), tole(0x91a26bd7L), tole(0xa9b3047bL), +tole(0x01c50a3fL), tole(0x39d46593L), tole(0x71e7d567L), tole(0x49f6bacbL), +tole(0x24e7bf1eL), tole(0x1cf6d0b2L), tole(0x54c56046L), tole(0x6cd40feaL), +tole(0xc4a201aeL), tole(0xfcb36e02L), tole(0xb480def6L), tole(0x8c91b15aL), +tole(0x750a600bL), tole(0x4d1b0fa7L), tole(0x0528bf53L), tole(0x3d39d0ffL), +tole(0x954fdebbL), tole(0xad5eb117L), tole(0xe56d01e3L), tole(0xdd7c6e4fL), +tole(0xb06d6b9aL), tole(0x887c0436L), tole(0xc04fb4c2L), tole(0xf85edb6eL), +tole(0x5028d52aL), tole(0x6839ba86L), tole(0x200a0a72L), tole(0x181b65deL), +tole(0xfa2801d8L), tole(0xc2396e74L), tole(0x8a0ade80L), tole(0xb21bb12cL), +tole(0x1a6dbf68L), tole(0x227cd0c4L), tole(0x6a4f6030L), tole(0x525e0f9cL), +tole(0x3f4f0a49L), tole(0x075e65e5L), tole(0x4f6dd511L), tole(0x777cbabdL), +tole(0xdf0ab4f9L), tole(0xe71bdb55L), tole(0xaf286ba1L), tole(0x9739040dL), +tole(0x59f3bff2L), tole(0x61e2d05eL), tole(0x29d160aaL), tole(0x11c00f06L), +tole(0xb9b60142L), tole(0x81a76eeeL), tole(0xc994de1aL), tole(0xf185b1b6L), +tole(0x9c94b463L), tole(0xa485dbcfL), tole(0xecb66b3bL), tole(0xd4a70497L), +tole(0x7cd10ad3L), tole(0x44c0657fL), tole(0x0cf3d58bL), tole(0x34e2ba27L), +tole(0xd6d1de21L), tole(0xeec0b18dL), tole(0xa6f30179L), tole(0x9ee26ed5L), +tole(0x36946091L), tole(0x0e850f3dL), tole(0x46b6bfc9L), tole(0x7ea7d065L), +tole(0x13b6d5b0L), tole(0x2ba7ba1cL), tole(0x63940ae8L), tole(0x5b856544L), +tole(0xf3f36b00L), tole(0xcbe204acL), tole(0x83d1b458L), tole(0xbbc0dbf4L), +tole(0x425b0aa5L), tole(0x7a4a6509L), tole(0x3279d5fdL), tole(0x0a68ba51L), +tole(0xa21eb415L), tole(0x9a0fdbb9L), tole(0xd23c6b4dL), tole(0xea2d04e1L), +tole(0x873c0134L), tole(0xbf2d6e98L), tole(0xf71ede6cL), tole(0xcf0fb1c0L), +tole(0x6779bf84L), tole(0x5f68d028L), tole(0x175b60dcL), tole(0x2f4a0f70L), +tole(0xcd796b76L), tole(0xf56804daL), tole(0xbd5bb42eL), tole(0x854adb82L), +tole(0x2d3cd5c6L), tole(0x152dba6aL), tole(0x5d1e0a9eL), tole(0x650f6532L), +tole(0x081e60e7L), tole(0x300f0f4bL), tole(0x783cbfbfL), tole(0x402dd013L), +tole(0xe85bde57L), tole(0xd04ab1fbL), tole(0x9879010fL), tole(0xa0686ea3L)}, +{ +tole(0x00000000L), tole(0xef306b19L), tole(0xdb8ca0c3L), tole(0x34bccbdaL), +tole(0xb2f53777L), tole(0x5dc55c6eL), tole(0x697997b4L), tole(0x8649fcadL), +tole(0x6006181fL), tole(0x8f367306L), tole(0xbb8ab8dcL), tole(0x54bad3c5L), +tole(0xd2f32f68L), tole(0x3dc34471L), tole(0x097f8fabL), tole(0xe64fe4b2L), +tole(0xc00c303eL), tole(0x2f3c5b27L), tole(0x1b8090fdL), tole(0xf4b0fbe4L), +tole(0x72f90749L), tole(0x9dc96c50L), tole(0xa975a78aL), tole(0x4645cc93L), +tole(0xa00a2821L), tole(0x4f3a4338L), tole(0x7b8688e2L), tole(0x94b6e3fbL), +tole(0x12ff1f56L), tole(0xfdcf744fL), tole(0xc973bf95L), tole(0x2643d48cL), +tole(0x85f4168dL), tole(0x6ac47d94L), tole(0x5e78b64eL), tole(0xb148dd57L), +tole(0x370121faL), tole(0xd8314ae3L), tole(0xec8d8139L), tole(0x03bdea20L), +tole(0xe5f20e92L), tole(0x0ac2658bL), tole(0x3e7eae51L), tole(0xd14ec548L), +tole(0x570739e5L), tole(0xb83752fcL), tole(0x8c8b9926L), tole(0x63bbf23fL), +tole(0x45f826b3L), tole(0xaac84daaL), tole(0x9e748670L), tole(0x7144ed69L), +tole(0xf70d11c4L), tole(0x183d7addL), tole(0x2c81b107L), tole(0xc3b1da1eL), +tole(0x25fe3eacL), tole(0xcace55b5L), tole(0xfe729e6fL), tole(0x1142f576L), +tole(0x970b09dbL), tole(0x783b62c2L), tole(0x4c87a918L), tole(0xa3b7c201L), +tole(0x0e045bebL), tole(0xe13430f2L), tole(0xd588fb28L), tole(0x3ab89031L), +tole(0xbcf16c9cL), tole(0x53c10785L), tole(0x677dcc5fL), tole(0x884da746L), +tole(0x6e0243f4L), tole(0x813228edL), tole(0xb58ee337L), tole(0x5abe882eL), +tole(0xdcf77483L), tole(0x33c71f9aL), tole(0x077bd440L), tole(0xe84bbf59L), +tole(0xce086bd5L), tole(0x213800ccL), tole(0x1584cb16L), tole(0xfab4a00fL), +tole(0x7cfd5ca2L), tole(0x93cd37bbL), tole(0xa771fc61L), tole(0x48419778L), +tole(0xae0e73caL), tole(0x413e18d3L), tole(0x7582d309L), tole(0x9ab2b810L), +tole(0x1cfb44bdL), tole(0xf3cb2fa4L), tole(0xc777e47eL), tole(0x28478f67L), +tole(0x8bf04d66L), tole(0x64c0267fL), tole(0x507ceda5L), tole(0xbf4c86bcL), +tole(0x39057a11L), tole(0xd6351108L), tole(0xe289dad2L), tole(0x0db9b1cbL), +tole(0xebf65579L), tole(0x04c63e60L), tole(0x307af5baL), tole(0xdf4a9ea3L), +tole(0x5903620eL), tole(0xb6330917L), tole(0x828fc2cdL), tole(0x6dbfa9d4L), +tole(0x4bfc7d58L), tole(0xa4cc1641L), tole(0x9070dd9bL), tole(0x7f40b682L), +tole(0xf9094a2fL), tole(0x16392136L), tole(0x2285eaecL), tole(0xcdb581f5L), +tole(0x2bfa6547L), tole(0xc4ca0e5eL), tole(0xf076c584L), tole(0x1f46ae9dL), +tole(0x990f5230L), tole(0x763f3929L), tole(0x4283f2f3L), tole(0xadb399eaL), +tole(0x1c08b7d6L), tole(0xf338dccfL), tole(0xc7841715L), tole(0x28b47c0cL), +tole(0xaefd80a1L), tole(0x41cdebb8L), tole(0x75712062L), tole(0x9a414b7bL), +tole(0x7c0eafc9L), tole(0x933ec4d0L), tole(0xa7820f0aL), tole(0x48b26413L), +tole(0xcefb98beL), tole(0x21cbf3a7L), tole(0x1577387dL), tole(0xfa475364L), +tole(0xdc0487e8L), tole(0x3334ecf1L), tole(0x0788272bL), tole(0xe8b84c32L), +tole(0x6ef1b09fL), tole(0x81c1db86L), tole(0xb57d105cL), tole(0x5a4d7b45L), +tole(0xbc029ff7L), tole(0x5332f4eeL), tole(0x678e3f34L), tole(0x88be542dL), +tole(0x0ef7a880L), tole(0xe1c7c399L), tole(0xd57b0843L), tole(0x3a4b635aL), +tole(0x99fca15bL), tole(0x76ccca42L), tole(0x42700198L), tole(0xad406a81L), +tole(0x2b09962cL), tole(0xc439fd35L), tole(0xf08536efL), tole(0x1fb55df6L), +tole(0xf9fab944L), tole(0x16cad25dL), tole(0x22761987L), tole(0xcd46729eL), +tole(0x4b0f8e33L), tole(0xa43fe52aL), tole(0x90832ef0L), tole(0x7fb345e9L), +tole(0x59f09165L), tole(0xb6c0fa7cL), tole(0x827c31a6L), tole(0x6d4c5abfL), +tole(0xeb05a612L), tole(0x0435cd0bL), tole(0x308906d1L), tole(0xdfb96dc8L), +tole(0x39f6897aL), tole(0xd6c6e263L), tole(0xe27a29b9L), tole(0x0d4a42a0L), +tole(0x8b03be0dL), tole(0x6433d514L), tole(0x508f1eceL), tole(0xbfbf75d7L), +tole(0x120cec3dL), tole(0xfd3c8724L), tole(0xc9804cfeL), tole(0x26b027e7L), +tole(0xa0f9db4aL), tole(0x4fc9b053L), tole(0x7b757b89L), tole(0x94451090L), +tole(0x720af422L), tole(0x9d3a9f3bL), tole(0xa98654e1L), tole(0x46b63ff8L), +tole(0xc0ffc355L), tole(0x2fcfa84cL), tole(0x1b736396L), tole(0xf443088fL), +tole(0xd200dc03L), tole(0x3d30b71aL), tole(0x098c7cc0L), tole(0xe6bc17d9L), +tole(0x60f5eb74L), tole(0x8fc5806dL), tole(0xbb794bb7L), tole(0x544920aeL), +tole(0xb206c41cL), tole(0x5d36af05L), tole(0x698a64dfL), tole(0x86ba0fc6L), +tole(0x00f3f36bL), tole(0xefc39872L), tole(0xdb7f53a8L), tole(0x344f38b1L), +tole(0x97f8fab0L), tole(0x78c891a9L), tole(0x4c745a73L), tole(0xa344316aL), +tole(0x250dcdc7L), tole(0xca3da6deL), tole(0xfe816d04L), tole(0x11b1061dL), +tole(0xf7fee2afL), tole(0x18ce89b6L), tole(0x2c72426cL), tole(0xc3422975L), +tole(0x450bd5d8L), tole(0xaa3bbec1L), tole(0x9e87751bL), tole(0x71b71e02L), +tole(0x57f4ca8eL), tole(0xb8c4a197L), tole(0x8c786a4dL), tole(0x63480154L), +tole(0xe501fdf9L), tole(0x0a3196e0L), tole(0x3e8d5d3aL), tole(0xd1bd3623L), +tole(0x37f2d291L), tole(0xd8c2b988L), tole(0xec7e7252L), tole(0x034e194bL), +tole(0x8507e5e6L), tole(0x6a378effL), tole(0x5e8b4525L), tole(0xb1bb2e3cL)}, +{ +tole(0x00000000L), tole(0x68032cc8L), tole(0xd0065990L), tole(0xb8057558L), +tole(0xa5e0c5d1L), tole(0xcde3e919L), tole(0x75e69c41L), tole(0x1de5b089L), +tole(0x4e2dfd53L), tole(0x262ed19bL), tole(0x9e2ba4c3L), tole(0xf628880bL), +tole(0xebcd3882L), tole(0x83ce144aL), tole(0x3bcb6112L), tole(0x53c84ddaL), +tole(0x9c5bfaa6L), tole(0xf458d66eL), tole(0x4c5da336L), tole(0x245e8ffeL), +tole(0x39bb3f77L), tole(0x51b813bfL), tole(0xe9bd66e7L), tole(0x81be4a2fL), +tole(0xd27607f5L), tole(0xba752b3dL), tole(0x02705e65L), tole(0x6a7372adL), +tole(0x7796c224L), tole(0x1f95eeecL), tole(0xa7909bb4L), tole(0xcf93b77cL), +tole(0x3d5b83bdL), tole(0x5558af75L), tole(0xed5dda2dL), tole(0x855ef6e5L), +tole(0x98bb466cL), tole(0xf0b86aa4L), tole(0x48bd1ffcL), tole(0x20be3334L), +tole(0x73767eeeL), tole(0x1b755226L), tole(0xa370277eL), tole(0xcb730bb6L), +tole(0xd696bb3fL), tole(0xbe9597f7L), tole(0x0690e2afL), tole(0x6e93ce67L), +tole(0xa100791bL), tole(0xc90355d3L), tole(0x7106208bL), tole(0x19050c43L), +tole(0x04e0bccaL), tole(0x6ce39002L), tole(0xd4e6e55aL), tole(0xbce5c992L), +tole(0xef2d8448L), tole(0x872ea880L), tole(0x3f2bddd8L), tole(0x5728f110L), +tole(0x4acd4199L), tole(0x22ce6d51L), tole(0x9acb1809L), tole(0xf2c834c1L), +tole(0x7ab7077aL), tole(0x12b42bb2L), tole(0xaab15eeaL), tole(0xc2b27222L), +tole(0xdf57c2abL), tole(0xb754ee63L), tole(0x0f519b3bL), tole(0x6752b7f3L), +tole(0x349afa29L), tole(0x5c99d6e1L), tole(0xe49ca3b9L), tole(0x8c9f8f71L), +tole(0x917a3ff8L), tole(0xf9791330L), tole(0x417c6668L), tole(0x297f4aa0L), +tole(0xe6ecfddcL), tole(0x8eefd114L), tole(0x36eaa44cL), tole(0x5ee98884L), +tole(0x430c380dL), tole(0x2b0f14c5L), tole(0x930a619dL), tole(0xfb094d55L), +tole(0xa8c1008fL), tole(0xc0c22c47L), tole(0x78c7591fL), tole(0x10c475d7L), +tole(0x0d21c55eL), tole(0x6522e996L), tole(0xdd279cceL), tole(0xb524b006L), +tole(0x47ec84c7L), tole(0x2fefa80fL), tole(0x97eadd57L), tole(0xffe9f19fL), +tole(0xe20c4116L), tole(0x8a0f6ddeL), tole(0x320a1886L), tole(0x5a09344eL), +tole(0x09c17994L), tole(0x61c2555cL), tole(0xd9c72004L), tole(0xb1c40cccL), +tole(0xac21bc45L), tole(0xc422908dL), tole(0x7c27e5d5L), tole(0x1424c91dL), +tole(0xdbb77e61L), tole(0xb3b452a9L), tole(0x0bb127f1L), tole(0x63b20b39L), +tole(0x7e57bbb0L), tole(0x16549778L), tole(0xae51e220L), tole(0xc652cee8L), +tole(0x959a8332L), tole(0xfd99affaL), tole(0x459cdaa2L), tole(0x2d9ff66aL), +tole(0x307a46e3L), tole(0x58796a2bL), tole(0xe07c1f73L), tole(0x887f33bbL), +tole(0xf56e0ef4L), tole(0x9d6d223cL), tole(0x25685764L), tole(0x4d6b7bacL), +tole(0x508ecb25L), tole(0x388de7edL), tole(0x808892b5L), tole(0xe88bbe7dL), +tole(0xbb43f3a7L), tole(0xd340df6fL), tole(0x6b45aa37L), tole(0x034686ffL), +tole(0x1ea33676L), tole(0x76a01abeL), tole(0xcea56fe6L), tole(0xa6a6432eL), +tole(0x6935f452L), tole(0x0136d89aL), tole(0xb933adc2L), tole(0xd130810aL), +tole(0xccd53183L), tole(0xa4d61d4bL), tole(0x1cd36813L), tole(0x74d044dbL), +tole(0x27180901L), tole(0x4f1b25c9L), tole(0xf71e5091L), tole(0x9f1d7c59L), +tole(0x82f8ccd0L), tole(0xeafbe018L), tole(0x52fe9540L), tole(0x3afdb988L), +tole(0xc8358d49L), tole(0xa036a181L), tole(0x1833d4d9L), tole(0x7030f811L), +tole(0x6dd54898L), tole(0x05d66450L), tole(0xbdd31108L), tole(0xd5d03dc0L), +tole(0x8618701aL), tole(0xee1b5cd2L), tole(0x561e298aL), tole(0x3e1d0542L), +tole(0x23f8b5cbL), tole(0x4bfb9903L), tole(0xf3feec5bL), tole(0x9bfdc093L), +tole(0x546e77efL), tole(0x3c6d5b27L), tole(0x84682e7fL), tole(0xec6b02b7L), +tole(0xf18eb23eL), tole(0x998d9ef6L), tole(0x2188ebaeL), tole(0x498bc766L), +tole(0x1a438abcL), tole(0x7240a674L), tole(0xca45d32cL), tole(0xa246ffe4L), +tole(0xbfa34f6dL), tole(0xd7a063a5L), tole(0x6fa516fdL), tole(0x07a63a35L), +tole(0x8fd9098eL), tole(0xe7da2546L), tole(0x5fdf501eL), tole(0x37dc7cd6L), +tole(0x2a39cc5fL), tole(0x423ae097L), tole(0xfa3f95cfL), tole(0x923cb907L), +tole(0xc1f4f4ddL), tole(0xa9f7d815L), tole(0x11f2ad4dL), tole(0x79f18185L), +tole(0x6414310cL), tole(0x0c171dc4L), tole(0xb412689cL), tole(0xdc114454L), +tole(0x1382f328L), tole(0x7b81dfe0L), tole(0xc384aab8L), tole(0xab878670L), +tole(0xb66236f9L), tole(0xde611a31L), tole(0x66646f69L), tole(0x0e6743a1L), +tole(0x5daf0e7bL), tole(0x35ac22b3L), tole(0x8da957ebL), tole(0xe5aa7b23L), +tole(0xf84fcbaaL), tole(0x904ce762L), tole(0x2849923aL), tole(0x404abef2L), +tole(0xb2828a33L), tole(0xda81a6fbL), tole(0x6284d3a3L), tole(0x0a87ff6bL), +tole(0x17624fe2L), tole(0x7f61632aL), tole(0xc7641672L), tole(0xaf673abaL), +tole(0xfcaf7760L), tole(0x94ac5ba8L), tole(0x2ca92ef0L), tole(0x44aa0238L), +tole(0x594fb2b1L), tole(0x314c9e79L), tole(0x8949eb21L), tole(0xe14ac7e9L), +tole(0x2ed97095L), tole(0x46da5c5dL), tole(0xfedf2905L), tole(0x96dc05cdL), +tole(0x8b39b544L), tole(0xe33a998cL), tole(0x5b3fecd4L), tole(0x333cc01cL), +tole(0x60f48dc6L), tole(0x08f7a10eL), tole(0xb0f2d456L), tole(0xd8f1f89eL), +tole(0xc5144817L), tole(0xad1764dfL), tole(0x15121187L), tole(0x7d113d4fL)}, +{ +tole(0x00000000L), tole(0x493c7d27L), tole(0x9278fa4eL), tole(0xdb448769L), +tole(0x211d826dL), tole(0x6821ff4aL), tole(0xb3657823L), tole(0xfa590504L), +tole(0x423b04daL), tole(0x0b0779fdL), tole(0xd043fe94L), tole(0x997f83b3L), +tole(0x632686b7L), tole(0x2a1afb90L), tole(0xf15e7cf9L), tole(0xb86201deL), +tole(0x847609b4L), tole(0xcd4a7493L), tole(0x160ef3faL), tole(0x5f328eddL), +tole(0xa56b8bd9L), tole(0xec57f6feL), tole(0x37137197L), tole(0x7e2f0cb0L), +tole(0xc64d0d6eL), tole(0x8f717049L), tole(0x5435f720L), tole(0x1d098a07L), +tole(0xe7508f03L), tole(0xae6cf224L), tole(0x7528754dL), tole(0x3c14086aL), +tole(0x0d006599L), tole(0x443c18beL), tole(0x9f789fd7L), tole(0xd644e2f0L), +tole(0x2c1de7f4L), tole(0x65219ad3L), tole(0xbe651dbaL), tole(0xf759609dL), +tole(0x4f3b6143L), tole(0x06071c64L), tole(0xdd439b0dL), tole(0x947fe62aL), +tole(0x6e26e32eL), tole(0x271a9e09L), tole(0xfc5e1960L), tole(0xb5626447L), +tole(0x89766c2dL), tole(0xc04a110aL), tole(0x1b0e9663L), tole(0x5232eb44L), +tole(0xa86bee40L), tole(0xe1579367L), tole(0x3a13140eL), tole(0x732f6929L), +tole(0xcb4d68f7L), tole(0x827115d0L), tole(0x593592b9L), tole(0x1009ef9eL), +tole(0xea50ea9aL), tole(0xa36c97bdL), tole(0x782810d4L), tole(0x31146df3L), +tole(0x1a00cb32L), tole(0x533cb615L), tole(0x8878317cL), tole(0xc1444c5bL), +tole(0x3b1d495fL), tole(0x72213478L), tole(0xa965b311L), tole(0xe059ce36L), +tole(0x583bcfe8L), tole(0x1107b2cfL), tole(0xca4335a6L), tole(0x837f4881L), +tole(0x79264d85L), tole(0x301a30a2L), tole(0xeb5eb7cbL), tole(0xa262caecL), +tole(0x9e76c286L), tole(0xd74abfa1L), tole(0x0c0e38c8L), tole(0x453245efL), +tole(0xbf6b40ebL), tole(0xf6573dccL), tole(0x2d13baa5L), tole(0x642fc782L), +tole(0xdc4dc65cL), tole(0x9571bb7bL), tole(0x4e353c12L), tole(0x07094135L), +tole(0xfd504431L), tole(0xb46c3916L), tole(0x6f28be7fL), tole(0x2614c358L), +tole(0x1700aeabL), tole(0x5e3cd38cL), tole(0x857854e5L), tole(0xcc4429c2L), +tole(0x361d2cc6L), tole(0x7f2151e1L), tole(0xa465d688L), tole(0xed59abafL), +tole(0x553baa71L), tole(0x1c07d756L), tole(0xc743503fL), tole(0x8e7f2d18L), +tole(0x7426281cL), tole(0x3d1a553bL), tole(0xe65ed252L), tole(0xaf62af75L), +tole(0x9376a71fL), tole(0xda4ada38L), tole(0x010e5d51L), tole(0x48322076L), +tole(0xb26b2572L), tole(0xfb575855L), tole(0x2013df3cL), tole(0x692fa21bL), +tole(0xd14da3c5L), tole(0x9871dee2L), tole(0x4335598bL), tole(0x0a0924acL), +tole(0xf05021a8L), tole(0xb96c5c8fL), tole(0x6228dbe6L), tole(0x2b14a6c1L), +tole(0x34019664L), tole(0x7d3deb43L), tole(0xa6796c2aL), tole(0xef45110dL), +tole(0x151c1409L), tole(0x5c20692eL), tole(0x8764ee47L), tole(0xce589360L), +tole(0x763a92beL), tole(0x3f06ef99L), tole(0xe44268f0L), tole(0xad7e15d7L), +tole(0x572710d3L), tole(0x1e1b6df4L), tole(0xc55fea9dL), tole(0x8c6397baL), +tole(0xb0779fd0L), tole(0xf94be2f7L), tole(0x220f659eL), tole(0x6b3318b9L), +tole(0x916a1dbdL), tole(0xd856609aL), tole(0x0312e7f3L), tole(0x4a2e9ad4L), +tole(0xf24c9b0aL), tole(0xbb70e62dL), tole(0x60346144L), tole(0x29081c63L), +tole(0xd3511967L), tole(0x9a6d6440L), tole(0x4129e329L), tole(0x08159e0eL), +tole(0x3901f3fdL), tole(0x703d8edaL), tole(0xab7909b3L), tole(0xe2457494L), +tole(0x181c7190L), tole(0x51200cb7L), tole(0x8a648bdeL), tole(0xc358f6f9L), +tole(0x7b3af727L), tole(0x32068a00L), tole(0xe9420d69L), tole(0xa07e704eL), +tole(0x5a27754aL), tole(0x131b086dL), tole(0xc85f8f04L), tole(0x8163f223L), +tole(0xbd77fa49L), tole(0xf44b876eL), tole(0x2f0f0007L), tole(0x66337d20L), +tole(0x9c6a7824L), tole(0xd5560503L), tole(0x0e12826aL), tole(0x472eff4dL), +tole(0xff4cfe93L), tole(0xb67083b4L), tole(0x6d3404ddL), tole(0x240879faL), +tole(0xde517cfeL), tole(0x976d01d9L), tole(0x4c2986b0L), tole(0x0515fb97L), +tole(0x2e015d56L), tole(0x673d2071L), tole(0xbc79a718L), tole(0xf545da3fL), +tole(0x0f1cdf3bL), tole(0x4620a21cL), tole(0x9d642575L), tole(0xd4585852L), +tole(0x6c3a598cL), tole(0x250624abL), tole(0xfe42a3c2L), tole(0xb77edee5L), +tole(0x4d27dbe1L), tole(0x041ba6c6L), tole(0xdf5f21afL), tole(0x96635c88L), +tole(0xaa7754e2L), tole(0xe34b29c5L), tole(0x380faeacL), tole(0x7133d38bL), +tole(0x8b6ad68fL), tole(0xc256aba8L), tole(0x19122cc1L), tole(0x502e51e6L), +tole(0xe84c5038L), tole(0xa1702d1fL), tole(0x7a34aa76L), tole(0x3308d751L), +tole(0xc951d255L), tole(0x806daf72L), tole(0x5b29281bL), tole(0x1215553cL), +tole(0x230138cfL), tole(0x6a3d45e8L), tole(0xb179c281L), tole(0xf845bfa6L), +tole(0x021cbaa2L), tole(0x4b20c785L), tole(0x906440ecL), tole(0xd9583dcbL), +tole(0x613a3c15L), tole(0x28064132L), tole(0xf342c65bL), tole(0xba7ebb7cL), +tole(0x4027be78L), tole(0x091bc35fL), tole(0xd25f4436L), tole(0x9b633911L), +tole(0xa777317bL), tole(0xee4b4c5cL), tole(0x350fcb35L), tole(0x7c33b612L), +tole(0x866ab316L), tole(0xcf56ce31L), tole(0x14124958L), tole(0x5d2e347fL), +tole(0xe54c35a1L), tole(0xac704886L), tole(0x7734cfefL), tole(0x3e08b2c8L), +tole(0xc451b7ccL), tole(0x8d6dcaebL), tole(0x56294d82L), tole(0x1f1530a5L)}, +}; diff --git a/repos/dde_linux/src/lib/wifi/include/extern_c_begin.h b/repos/dde_linux/src/lib/wifi/include/extern_c_begin.h new file mode 100644 index 000000000..8fadabf14 --- /dev/null +++ b/repos/dde_linux/src/lib/wifi/include/extern_c_begin.h @@ -0,0 +1,26 @@ +/* + * \brief Include before including Linux headers in C++ + * \author Christian Helmuth + * \date 2014-08-21 + */ + +/* + * Copyright (C) 2014 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +#define extern_c_begin + +extern "C" { + +/* some warnings should only be switched of for Linux headers */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wpointer-arith" +#pragma GCC diagnostic ignored "-Wsign-compare" + +/* deal with C++ keywords used for identifiers etc. */ +#define private private_ +#define class class_ +#define new new_ diff --git a/repos/dde_linux/src/lib/wifi/include/extern_c_end.h b/repos/dde_linux/src/lib/wifi/include/extern_c_end.h new file mode 100644 index 000000000..ac6b23f8d --- /dev/null +++ b/repos/dde_linux/src/lib/wifi/include/extern_c_end.h @@ -0,0 +1,20 @@ +/* + * \brief Include after including Linux headers in C++ + * \author Christian Helmuth + * \date 2014-08-21 + */ + +/* + * Copyright (C) 2014 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +#undef new +#undef class +#undef private + +#pragma GCC diagnostic pop + +} /* extern "C" */ diff --git a/repos/dde_linux/src/lib/wifi/include/firmware_list.h b/repos/dde_linux/src/lib/wifi/include/firmware_list.h new file mode 100644 index 000000000..3fbca1354 --- /dev/null +++ b/repos/dde_linux/src/lib/wifi/include/firmware_list.h @@ -0,0 +1,26 @@ +/* + * \brief List for firmware images and their sizes + * \author Josef Soentgen + * \date 2014-03-26 + */ + +/* + * Copyright (C) 2014 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +#ifndef _FIRMWARE_LIST_H_ +#define _FIRMWARE_LIST_H_ + +typedef __SIZE_TYPE__ size_t; + +struct Firmware_list +{ + char const *name; + size_t size; +}; + +#endif /* _FIRMWARE_LIST_H_ */ + diff --git a/repos/dde_linux/src/lib/wifi/include/linux/gen_stats.h b/repos/dde_linux/src/lib/wifi/include/linux/gen_stats.h new file mode 100644 index 000000000..be44e8e9b --- /dev/null +++ b/repos/dde_linux/src/lib/wifi/include/linux/gen_stats.h @@ -0,0 +1 @@ +#include diff --git a/repos/dde_linux/src/lib/wifi/include/linux/hdlc/ioctl.h b/repos/dde_linux/src/lib/wifi/include/linux/hdlc/ioctl.h new file mode 100644 index 000000000..603ac24ce --- /dev/null +++ b/repos/dde_linux/src/lib/wifi/include/linux/hdlc/ioctl.h @@ -0,0 +1 @@ +#include diff --git a/repos/dde_linux/src/lib/wifi/include/linux/if_bridge.h b/repos/dde_linux/src/lib/wifi/include/linux/if_bridge.h new file mode 100644 index 000000000..21d91fb35 --- /dev/null +++ b/repos/dde_linux/src/lib/wifi/include/linux/if_bridge.h @@ -0,0 +1 @@ +#include diff --git a/repos/dde_linux/src/lib/wifi/include/linux/if_packet.h b/repos/dde_linux/src/lib/wifi/include/linux/if_packet.h new file mode 100644 index 000000000..606f28942 --- /dev/null +++ b/repos/dde_linux/src/lib/wifi/include/linux/if_packet.h @@ -0,0 +1 @@ +#include diff --git a/repos/dde_linux/src/lib/wifi/include/linux/neighbour.h b/repos/dde_linux/src/lib/wifi/include/linux/neighbour.h new file mode 100644 index 000000000..d7656ab19 --- /dev/null +++ b/repos/dde_linux/src/lib/wifi/include/linux/neighbour.h @@ -0,0 +1 @@ +#include diff --git a/repos/dde_linux/src/lib/wifi/include/linux/nl80211.h b/repos/dde_linux/src/lib/wifi/include/linux/nl80211.h new file mode 100644 index 000000000..b7340e626 --- /dev/null +++ b/repos/dde_linux/src/lib/wifi/include/linux/nl80211.h @@ -0,0 +1 @@ +#include diff --git a/repos/dde_linux/src/lib/wifi/include/linux/sockios.h b/repos/dde_linux/src/lib/wifi/include/linux/sockios.h new file mode 100644 index 000000000..b459fcf57 --- /dev/null +++ b/repos/dde_linux/src/lib/wifi/include/linux/sockios.h @@ -0,0 +1,2 @@ +#include +#include diff --git a/repos/dde_linux/src/lib/wifi/include/list.h b/repos/dde_linux/src/lib/wifi/include/list.h new file mode 100644 index 000000000..85696c5c8 --- /dev/null +++ b/repos/dde_linux/src/lib/wifi/include/list.h @@ -0,0 +1,99 @@ +/* + * \brief Slightly improved list + * \author Christian Helmuth + * \date 2014-09-25 + */ + +/* + * Copyright (C) 2014 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +#ifndef _LIST_H_ +#define _LIST_H_ + +#include + + +namespace Lx { + template class List; + template class List_element; +} + +template +class Lx::List : private Genode::List +{ + private: + + typedef Genode::List Base; + + public: + + using Base::Element; + + void append(LT const *le) + { + LT *at = nullptr; + + for (LT *l = first(); l; l = l->next()) + at = l; + + Base::insert(le, at); + } + + void prepend(LT const *le) + { + Base::insert(le); + } + + void insert_before(LT const *le, LT const *at) + { + if (at == first()) { + prepend(le); + return; + } + + for (LT *l = first(); l; l = l->next()) + if (l->next() == at) + at = l; + + Base::insert(le, at); + } + + + /**************************** + ** Genode::List interface ** + ****************************/ + + LT *first() { return Base::first(); } + LT const *first() const { return Base::first(); } + + void insert(LT const *le, LT const *at = 0) + { + Base::insert(le, at); + } + + void remove(LT const *le) + { + Base::remove(le); + } +}; + + +template +class Lx::List_element : public Lx::List >::Element +{ + private: + + T *_object; + + public: + + List_element(T *object) : _object(object) { } + + T *object() const { return _object; } +}; + +#endif /* _LIST_H_ */ diff --git a/repos/dde_linux/src/lib/wifi/include/lx_emul.h b/repos/dde_linux/src/lib/wifi/include/lx_emul.h new file mode 100644 index 000000000..78555ff86 --- /dev/null +++ b/repos/dde_linux/src/lib/wifi/include/lx_emul.h @@ -0,0 +1,5386 @@ +/* + * \brief Emulation of the Linux kernel API + * \author Josef Soentgen + * \date 2014-03-03 + * + * The content of this file, in particular data structures, is partially + * derived from Linux-internal headers. + */ + +/* + * Copyright (C) 2014 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +#ifndef _LX_EMUL_H_ +#define _LX_EMUL_H_ + +#if defined(__cplusplus) && !defined(extern_c_begin) +#error Include extern_c_begin.h before lx_emul.h +#endif /* __cplusplus */ + +#include + +#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) +#define LINUX_VERSION_CODE KERNEL_VERSION(3,14,5) + +#define KBUILD_MODNAME "mod-noname" + +#define DEBUG_LINUX_PRINTK 1 + + +void lx_printf(char const *, ...) __attribute__((format(printf, 1, 2))); +void lx_vprintf(char const *, va_list); + + +/*************** + ** asm/bug.h ** + ***************/ + +#define WARN_ON(condition) ({ \ + int ret = !!(condition); \ + if (ret) lx_printf("[%s] WARN_ON(" #condition ") ", __func__); \ + ret; }) + +#define WARN(condition, fmt, arg...) ({ \ + int ret = !!(condition); \ + if (ret) lx_printf("[%s] *WARN* " fmt , __func__ , ##arg); \ + ret; }) + +#define BUG() do { \ + lx_printf("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __func__); \ + while (1) ; \ +} while (0) + +#define WARN_ON_ONCE WARN_ON +#define WARN_ONCE WARN + +#define BUG_ON(condition) do { if (condition) BUG(); } while(0) + + +/********************* + ** linux/kconfig.h ** + *********************/ + +#define IS_ENABLED(x) x + + +/********************* + ** asm/processor.h ** + *********************/ + +void cpu_relax(void); + + +/***************** + ** asm/param.h ** + *****************/ + +enum { HZ = 100 }; + + +/******************* + ** asm/cmpxchg.h ** + *******************/ + +#define cmpxchg(ptr, o, n) ({ \ + typeof(*ptr) prev = *ptr; \ + *ptr = (*ptr == o) ? n : *ptr; \ + prev;\ + }) + +#define xchg(ptr, x) ({ \ + typeof(*ptr) old = *ptr; \ + *ptr = x; \ + old; \ +}) + + +/******************************* + ** asm-generic/bitsperlong.h ** + *******************************/ + +#define BITS_PER_LONG (__SIZEOF_LONG__ * 8) + + +/****************** + ** asm/atomic.h ** + ******************/ + +#include + +#define ATOMIC_INIT(i) { (i) } + +typedef struct atomic { long counter; } atomic_t; +typedef atomic_t atomic_long_t; + +static inline int atomic_read(const atomic_t *p) { return p->counter; } +static inline void atomic_set(atomic_t *p, int i) { p->counter = i; } +static inline void atomic_sub(int i, atomic_t *p) { p->counter -= i; } +static inline void atomic_add(int i, atomic_t *p) { p->counter += i; } +static inline int atomic_sub_return(int i, atomic_t *p) { p->counter -= i; return p->counter; } +static inline int atomic_add_return(int i, atomic_t *p) { p->counter += i; return p->counter; } +static inline int atomic_sub_and_test(int i, atomic_t *p) { return atomic_sub_return(i, p) == 0; } + +static inline void atomic_dec(atomic_t *p) { atomic_sub(1, p); } +static inline void atomic_inc(atomic_t *p) { atomic_add(1, p); } +static inline int atomic_dec_return(atomic_t *p) { return atomic_sub_return(1, p); } +static inline int atomic_inc_return(atomic_t *p) { return atomic_add_return(1, p); } +static inline int atomic_dec_and_test(atomic_t *p) { return atomic_sub_and_test(1, p); } +static inline int atomic_inc_not_zero(atomic_t *p) { return p->counter ? atomic_inc_return(p) : 0; } + +static inline void atomic_long_inc(atomic_long_t *p) { atomic_add(1, p); } +static inline void atomic_long_sub(int i, atomic_long_t *p) { atomic_sub(i, p); } +static inline long atomic_long_add_return(long i, atomic_long_t *p) { return atomic_add_return(i, p); } +static inline long atomic_long_read(atomic_long_t *p) { return atomic_read(p); } + +static inline int atomic_cmpxchg(atomic_t *v, int old, int n) +{ + return cmpxchg(&v->counter, old, n); +} + +static inline int atomic_inc_not_zero_hint(atomic_t *v, int hint) +{ + int val, c = hint; + + /* sanity test, should be removed by compiler if hint is a constant */ + if (!hint) + return atomic_inc_not_zero(v); + + do { + val = atomic_cmpxchg(v, c, c + 1); + if (val == c) + return 1; + c = val; + } while (c); + + return 0; +} + +static inline int atomic_add_unless(atomic_t *v, int a, int u) +{ + int ret; + unsigned long flags; + (void)flags; + + ret = v->counter; + if (ret != u) + v->counter += a; + + return ret != u; +} + +#define smp_mb__before_atomic_dec() + + +/******************************* + ** asm-generic/atomic-long.h ** + *******************************/ + +#define ATOMIC_LONG_INIT(i) ATOMIC_INIT(i) + + +/******************* + ** asm/barrier.h ** + *******************/ + +#define mb() asm volatile ("": : :"memory") +#define smp_mb() mb() +#define smp_rmb() mb() +#define smp_wmb() mb() + + +/**************** + ** asm/page.h ** + ****************/ + +/* + * For now, hardcoded + */ +#define PAGE_SIZE 4096UL +#define PAGE_MASK (~(PAGE_SIZE-1)) + +enum { + PAGE_SHIFT = 12, +}; + +struct page +{ + unsigned long flags; + int pfmemalloc; + int mapping; + atomic_t _count; + void *addr; + unsigned long private; +} __attribute((packed)); + + +/************************ + ** linux/page-flags.h ** + ************************/ + +enum pageflags +{ + PG_slab = 0x1, +}; + +#define PageSlab(page) test_bit(PG_slab, &(page)->flags) + + +/********************** + ** asm/cacheflush.h ** + **********************/ + +void flush_dcache_page(struct page *page); + + +/******************* + ** linux/types.h ** + *******************/ + +#include + +typedef uint32_t uint; +typedef unsigned long ulong; + +typedef int8_t s8; +typedef uint8_t u8; +typedef int16_t s16; +typedef uint16_t u16; +typedef int32_t s32; +typedef uint32_t u32; +typedef int64_t s64; +typedef uint64_t u64; + +typedef int8_t __s8; +typedef uint8_t __u8; +typedef int16_t __s16; +typedef uint16_t __u16; +typedef int32_t __s32; +typedef uint32_t __u32; +typedef int64_t __s64; +typedef uint64_t __u64; + +typedef __u16 __le16; +typedef __u32 __le32; +typedef __u64 __le64; +typedef __u16 __be16; +typedef __u32 __be32; +typedef __u64 __be64; + +typedef __u16 __sum16; +typedef __u32 __wsum; + +typedef u64 sector_t; +typedef int clockid_t; + +struct list_head { + struct list_head *next, *prev; +}; + +struct hlist_head { + struct hlist_node *first; +}; + +struct hlist_node { + struct hlist_node *next, **pprev; +}; + +#ifndef __cplusplus +typedef _Bool bool; +enum { true = 1, false = 0 }; +#endif /* __cplusplus */ + +#ifndef NULL +#ifdef __cplusplus +#define NULL nullptr +#else +#define NULL ((void *)0) +#endif /* __cplusplus */ +#endif /* NULL */ + +typedef unsigned gfp_t; +typedef unsigned long dma_addr_t; +typedef unsigned long pgoff_t; +typedef long long loff_t; +typedef long ssize_t; +typedef unsigned long uintptr_t; +typedef int dev_t; +typedef size_t resource_size_t; +typedef long off_t; +typedef int pid_t; +typedef unsigned fmode_t; +typedef u32 uid_t; +typedef u32 gid_t; +typedef long __kernel_time_t; +typedef unsigned short umode_t; +typedef __u16 __be16; +typedef __u32 __be32; +typedef size_t __kernel_size_t; +typedef long __kernel_time_t; +typedef long __kernel_suseconds_t; +typedef unsigned long dma_addr_t; +typedef long clock_t; + +#ifndef __cplusplus +typedef u16 wchar_t; +#endif + +#define __aligned_u64 __u64 __attribute__((aligned(8))) + +/* + * needed by include/net/cfg80211.h + */ +struct callback_head { + struct callback_head *next; + void (*func)(struct callback_head *head); +}; +#define rcu_head callback_head + +#if defined(__x86__64__) +typedef unsigned int mode_t; +#else +typedef unsigned short mode_t; +#endif + +#define DECLARE_BITMAP(name,bits) \ + unsigned long name[BITS_TO_LONGS(bits)] + + +/********************** + ** linux/compiler.h ** + **********************/ + +#define likely +#define unlikely + +#define __user +#define __iomem /* needed by drivers/net/wireless/iwlwifi/pcie/internal.h */ +#define __rcu +#define __percpu +#define __must_check +#define __force +#define __read_mostly + +#define __cond_lock(x,c) (c) /* needed by drivers/net/wireless/iwlwifi/dvm/main.c */ + +#define __releases(x) /* needed by usb/core/devio.c */ +#define __acquires(x) /* needed by usb/core/devio.c */ +#define __force +#define __maybe_unused +#define __bitwise + +# define __acquire(x) (void)0 +# define __release(x) (void)0 + +#define __must_check + +#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x)) + +#define __attribute_const__ +#undef __always_inline +#define __always_inline + +#undef __unused + +#define __printf(a, b) __attribute__((format(printf, a, b))) + +#define noinline __attribute__((noinline)) + + +/************************** + ** linux/compiler-gcc.h ** + **************************/ + +#define uninitialized_var(x) x = x +#ifdef __aligned +#undef __aligned +#endif +#define __aligned(x) __attribute__((aligned(x))) +#define __noreturn __attribute__((noreturn)) + +#define barrier() __asm__ __volatile__("": : :"memory") + +#define OPTIMIZER_HIDE_VAR(var) __asm__ ("" : "=r" (var) : "0" (var)) + +#define __visible __attribute__((externally_visible)) + + +/******************** + ** linux/poison.h ** + ********************/ + +/* + * In list.h, LIST_POISON1 and LIST_POISON2 are assigned to 'struct list_head + * *' as well as 'struct hlist_node *' pointers. Consequently, C++ compiler + * produces an error "cannot convert... in assignment". To compile 'list.h' + * included by C++ source code, we have to define these macros to the only + * value universally accepted for pointer assigments.h + */ + +#ifdef __cplusplus +#define LIST_POISON1 nullptr +#define LIST_POISON2 nullptr +#else +#define LIST_POISON1 ((void *)0x00100100) +#define LIST_POISON2 ((void *)0x00200200) +#endif /* __cplusplus */ + + +/********************** + ** linux/mm_types.h ** + **********************/ + +struct vm_operations_struct; + +struct vm_area_struct +{ + unsigned long vm_start; + unsigned long vm_end; + + const struct vm_operations_struct *vm_ops; + + unsigned long vm_pgoff; + + struct file * vm_file; +}; + + +/**************** + ** linux/mm.h ** + ****************/ + +int is_vmalloc_addr(const void *x); + +extern unsigned long totalram_pages; +extern unsigned long num_physpages; + +static inline struct page *compound_head(struct page *page) { return page; } +static inline void *page_address(struct page *page) { return page->addr; }; + +void get_page(struct page *page); +void put_page(struct page *page); + +#define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK) + +struct page *virt_to_head_page(const void *x); +struct page *virt_to_page(const void *x); +struct page *vmalloc_to_page(const void *addr); + +struct sysinfo; +void si_meminfo(struct sysinfo *); + +#define page_private(page) ((page)->private) +#define set_page_private(page, v) ((page)->private = (v)) + +struct vm_operations_struct { + void (*open)(struct vm_area_struct * area); + void (*close)(struct vm_area_struct * area); +}; + +int get_user_pages_fast(unsigned long start, int nr_pages, int write, struct page **pages); +int vm_insert_page(struct vm_area_struct *, unsigned long addr, struct page *); + + +/********************* + ** linux/vmalloc.h ** + *********************/ + +void *vmalloc(unsigned long size); +void *vzalloc(unsigned long size); +void vfree(const void *addr); + + +/********************** + ** linux/highmem.h ** + **********************/ + +static inline void *kmap(struct page *page) { return page_address(page); } +static inline void *kmap_atomic(struct page *page) { return kmap(page); } +static inline void kunmap(struct page *page) { } +static inline void kunmap_atomic(void *addr) { } + + +/***************** + ** linux/gfp.h ** + *****************/ + +enum { + __GFP_DMA = 0x00000001u, + __GFP_HIGHMEM = 0x00000002u, + __GFP_DMA32 = 0x00000004u, + __GFP_MOVABLE = 0x00000008u, + __GFP_WAIT = 0x00000010u, + __GFP_HIGH = 0x00000020u, + __GFP_IO = 0x00000040u, + __GFP_FS = 0x00000080u, + __GFP_COLD = 0x00000100u, + __GFP_NOWARN = 0x00000200u, + __GFP_REPEAT = 0x00000400u, + __GFP_NOFAIL = 0x00000800u, + __GFP_NORETRY = 0x00001000u, + __GFP_MEMALLOC = 0x00002000u, + __GFP_COMP = 0x00004000u, + __GFP_ZERO = 0x00008000u, + __GFP_NOMEMALLOC = 0x00010000u, + __GFP_HARDWALL = 0x00020000u, + __GFP_THISNODE = 0x00040000u, + __GFP_RECLAIMABLE = 0x00080000u, + __GFP_KMEMCG = 0x00100000u, + __GFP_NOTRACK = 0x00200000u, + __GFP_NO_KSWAPD = 0x00400000u, + __GFP_OTHER_NODE = 0x00800000u, + __GFP_WRITE = 0x01000000u, + + GFP_LX_DMA = 0x80000000u, + + GFP_ATOMIC = __GFP_HIGH, + GFP_DMA = __GFP_DMA, + GFP_KERNEL = __GFP_WAIT | __GFP_IO | __GFP_FS, + GFP_USER = __GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_HARDWALL, +}; + +struct page *alloc_pages_node(int nid, gfp_t gfp_mask, unsigned int order); + +struct page *alloc_pages(gfp_t gfp_mask, unsigned int order); + +#define alloc_page(gfp_mask) alloc_pages(gfp_mask, 0) + +unsigned long get_zeroed_page(gfp_t gfp_mask); +#define free_page(p) kfree((void *)p) + +bool gfp_pfmemalloc_allowed(gfp_t); +unsigned long __get_free_page(gfp_t); +unsigned long __get_free_pages(gfp_t, unsigned int); +void free_pages(unsigned long, unsigned int); +void __free_pages(struct page *page, unsigned int order); + + +/****************** + ** linux/slab.h ** + ******************/ + +#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long) + +enum { + SLAB_HWCACHE_ALIGN = 0x00002000ul, + SLAB_CACHE_DMA = 0x00004000ul, + SLAB_PANIC = 0x00040000ul, + + SLAB_LX_DMA = 0x80000000ul, +}; + +void *kzalloc(size_t size, gfp_t flags); +void kfree(const void *); +void kzfree(const void *); +void *kmalloc(size_t size, gfp_t flags); +void *kcalloc(size_t n, size_t size, gfp_t flags); + +struct kmem_cache; +struct kmem_cache *kmem_cache_create(const char *, size_t, size_t, unsigned long, void (*)(void *)); +void kmem_cache_destroy(struct kmem_cache *); +void *kmem_cache_alloc(struct kmem_cache *, gfp_t); +void *kmem_cache_zalloc(struct kmem_cache *k, gfp_t flags); +void kmem_cache_free(struct kmem_cache *, void *); +void *kmalloc_node_track_caller(size_t size, gfp_t flags, int node); + +static inline void *kmem_cache_alloc_node(struct kmem_cache *s, gfp_t flags, int node) +{ + return kmem_cache_alloc(s, flags); +} + + +/******************** + ** linux/string.h ** + ********************/ +#undef memcpy + +void *memcpy(void *d, const void *s, size_t n); +void *memset(void *s, int c, size_t n); +int memcmp(const void *, const void *, size_t); +void *memscan(void *addr, int c, size_t size); +char *strcat(char *dest, const char *src); +int strcmp(const char *s1, const char *s2); +int strncmp(const char *cs, const char *ct, size_t count); +char *strcpy(char *to, const char *from); +char *strncpy(char *, const char *, size_t); +char *strchr(const char *, int); +char *strrchr(const char *,int); +size_t strlcat(char *dest, const char *src, size_t n); +size_t strlcpy(char *dest, const char *src, size_t size); +size_t strlen(const char *); +size_t strnlen(const char *, size_t); +char * strsep(char **,const char *); +char *strstr(const char *, const char *); +char *kstrdup(const char *s, gfp_t gfp); +void *kmemdup(const void *src, size_t len, gfp_t gfp); +void *memmove(void *, const void *, size_t); +void * memchr(const void *, int, size_t); + + +/************************* + ** linux/irq_cpustat.h ** + *************************/ + +int local_softirq_pending(void); + + +/********************** + ** linux/irqflags.h ** + **********************/ + +#define local_irq_enable(a ) do { } while (0) +#define local_irq_disable() do { } while (0) +#define local_irq_save(flags) do { (void)flags; } while (0) +#define local_irq_restore(flags) do { (void)flags; } while (0) + + +/********************** + ** linux/spinlock.h ** + **********************/ + +typedef struct spinlock { } spinlock_t; +#define DEFINE_SPINLOCK(name) spinlock_t name + +void spin_lock(spinlock_t *lock); +void spin_lock_nested(spinlock_t *lock, int subclass); +void spin_unlock(spinlock_t *lock); +void spin_lock_init(spinlock_t *lock); +void spin_lock_irqsave(spinlock_t *lock, unsigned long flags); +void spin_lock_irqrestore(spinlock_t *lock, unsigned long flags); +void spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags); +void spin_lock_irq(spinlock_t *lock); +void spin_unlock_irq(spinlock_t *lock); +void assert_spin_locked(spinlock_t *lock); +void spin_lock_bh(spinlock_t *lock); +void spin_unlock_bh(spinlock_t *lock); +int spin_trylock(spinlock_t *lock); + + +/**************************** + ** linux/spinlock_types.h ** + ****************************/ + +#define __SPIN_LOCK_UNLOCKED(x) 0 + + +/******************* + ** linux/mutex.h ** + *******************/ + +struct mutex +{ + int state; + void *holder; + void *waiters; + unsigned id; /* for debugging */ +}; + +#define DEFINE_MUTEX(mutexname) \ + struct mutex mutexname; \ + static void __attribute__((constructor)) mutex_init_ ## mutexname(void) \ + { mutex_init(&mutexname); } + +void mutex_init(struct mutex *m); +void mutex_destroy(struct mutex *m); +void mutex_lock(struct mutex *m); +void mutex_unlock(struct mutex *m); +int mutex_trylock(struct mutex *m); +int mutex_is_locked(struct mutex *m); + +/* special case in net/wireless/util.c:1357 */ +#define mutex_lock_nested(lock, subclass) mutex_lock(lock) + + +/******************* + ** linux/rwsem.h ** + *******************/ + +struct rw_semaphore { int dummy; }; + +#define DECLARE_RWSEM(name) \ + struct rw_semaphore name = { 0 } + +#define init_rwsem(sem) do { (void)sem; } while (0) + +void down_read(struct rw_semaphore *sem); +void up_read(struct rw_semaphore *sem); +void down_write(struct rw_semaphore *sem); +void up_write(struct rw_semaphore *sem); + +#define __RWSEM_INITIALIZER(name) { 0 } + + +/******************* + ** linux/timer.h ** + *******************/ + +struct tvec_base; +extern struct tvec_base boot_tvec_bases; /* needed by 'dwc_common_linux.c' */ + +struct timer_list +{ + void (*function)(unsigned long); + unsigned long data; + void *timer; + unsigned long expires; + struct tvec_base *base; /* needed by 'dwc_common_linux.c' */ +}; + +void init_timer(struct timer_list *); +void init_timer_deferrable(struct timer_list *); +int mod_timer(struct timer_list *timer, unsigned long expires); +int del_timer(struct timer_list * timer); +void setup_timer(struct timer_list *timer, void (*function)(unsigned long), + unsigned long data); +int timer_pending(const struct timer_list * timer); +unsigned long round_jiffies(unsigned long j); +unsigned long round_jiffies_relative(unsigned long j); +unsigned long round_jiffies_up(unsigned long j); + +void set_timer_slack(struct timer_list *time, int slack_hz); +static inline void add_timer(struct timer_list *timer) { mod_timer(timer, timer->expires); } + +static inline +int del_timer_sync(struct timer_list * timer) { return del_timer(timer); } + + +/*********************** + ** linux/workqueue.h ** + ***********************/ + +enum { + WQ_MEM_RECLAIM, + WQ_CPU_INTENSIVE, +}; + +struct work_struct; +typedef void (*work_func_t)(struct work_struct *work); + +struct work_struct { + atomic_long_t data; + work_func_t func; + struct list_head entry; +}; + +struct delayed_work { + struct timer_list timer; + struct work_struct work; +}; + +bool cancel_work_sync(struct work_struct *work); +bool cancel_delayed_work_sync(struct delayed_work *work); +bool cancel_delayed_work(struct delayed_work *dwork); +int schedule_delayed_work(struct delayed_work *work, unsigned long delay); +int schedule_work(struct work_struct *work); + +bool flush_work(struct work_struct *work); +bool flush_work_sync(struct work_struct *work); + + +#define PREPARE_WORK(_work, _func) \ + do { (_work)->func = (_func); } while (0) + +#define PREPARE_DELAYED_WORK(_work, _func) \ + PREPARE_WORK(&(_work)->work, (_func)) + +#define __INIT_WORK(_work, _func, on_stack) \ + do { \ + INIT_LIST_HEAD(&(_work)->entry); \ + PREPARE_WORK((_work), (_func)); \ + } while (0) + +#define INIT_WORK(_work, _func)\ + do { __INIT_WORK((_work), (_func), 0); } while (0) + +#define INIT_DELAYED_WORK(_work, _func) \ + do { \ + INIT_WORK(&(_work)->work, (_func)); \ + init_timer(&(_work)->timer); \ + } while (0) + + +/* dummy for queue_delayed_work call in storage/usb.c */ +#define system_freezable_wq 0 +struct workqueue_struct { }; + +struct workqueue_struct *create_singlethread_workqueue(const char *name); +struct workqueue_struct *alloc_ordered_workqueue(const char *fmt, unsigned int flags, ...) __printf(1, 3); +struct workqueue_struct *alloc_workqueue(const char *fmt, unsigned int flags, + int max_active, ...) __printf(1, 4); +void destroy_workqueue(struct workqueue_struct *wq); +void flush_workqueue(struct workqueue_struct *wq); +bool queue_delayed_work(struct workqueue_struct *, struct delayed_work *, unsigned long); +bool flush_delayed_work(struct delayed_work *dwork); +bool queue_work(struct workqueue_struct *wq, struct work_struct *work); + +#define DECLARE_DELAYED_WORK(n, f) \ + struct delayed_work n + +bool mod_delayed_work(struct workqueue_struct *, struct delayed_work *, + unsigned long); + +extern struct workqueue_struct *system_wq; + +enum { + WORK_STRUCT_STATIC = 0, + + WORK_STRUCT_COLOR_SHIFT = 4, + WORK_STRUCT_COLOR_BITS = 4, + WORK_STRUCT_FLAG_BITS = WORK_STRUCT_COLOR_SHIFT + WORK_STRUCT_COLOR_BITS, + WORK_OFFQ_FLAG_BASE = WORK_STRUCT_FLAG_BITS, + + WORK_OFFQ_FLAG_BITS = 1, + WORK_OFFQ_POOL_SHIFT = WORK_OFFQ_FLAG_BASE + WORK_OFFQ_FLAG_BITS, + WORK_OFFQ_LEFT = BITS_PER_LONG - WORK_OFFQ_POOL_SHIFT, + WORK_OFFQ_POOL_BITS = WORK_OFFQ_LEFT <= 31 ? WORK_OFFQ_LEFT : 31, + WORK_OFFQ_POOL_NONE = (1LU << WORK_OFFQ_POOL_BITS) - 1, + + WORK_STRUCT_NO_POOL = (unsigned long)WORK_OFFQ_POOL_NONE << WORK_OFFQ_POOL_SHIFT, +}; + +#define WORK_DATA_STATIC_INIT() \ + ATOMIC_LONG_INIT(WORK_STRUCT_NO_POOL | WORK_STRUCT_STATIC) + +#define __WORK_INIT_LOCKDEP_MAP(n, k) + +#define __WORK_INITIALIZER(n, f) { \ + .data = WORK_DATA_STATIC_INIT(), \ + .entry = { &(n).entry, &(n).entry }, \ + .func = (f), \ + __WORK_INIT_LOCKDEP_MAP(#n, &(n)) \ +} + +#define DECLARE_WORK(n, f) \ + struct work_struct n = __WORK_INITIALIZER(n, f) + + +/******************** + ** linux/kernel.h ** + ********************/ + +/* + * Log tags + */ +#define KERN_ALERT "ALERT: " +#define KERN_CRIT "CRTITCAL: " +#define KERN_DEBUG "DEBUG: " +#define KERN_EMERG "EMERG: " +#define KERN_ERR "ERROR: " +#define KERN_INFO "INFO: " +#define KERN_NOTICE "NOTICE: " +#define KERN_WARNING "WARNING: " +#define KERN_WARN "WARNING: " + +/* + * Debug macros + */ +#if DEBUG_LINUX_PRINTK +#define printk _printk +#define vprintk lx_vprintf +#else +#define printk(...) +#define vprintk(...) +#endif + +static inline __printf(1, 2) void panic(const char *fmt, ...) __noreturn; +static inline void panic(const char *fmt, ...) +{ + va_list args; + va_start(args, fmt); + lx_vprintf(fmt, args); + va_end(args); + lx_printf("panic()"); + while (1) ; +} + +/* + * Bits and types + */ + +/* needed by linux/list.h */ +#define container_of(ptr, type, member) ({ \ + const typeof( ((type *)0)->member ) *__mptr = (ptr); \ + (type *)( (char *)__mptr - offsetof(type,member) );}) + +/* normally provided by linux/stddef.h, needed by linux/list.h */ +#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) + +#define max_t(type, x, y) ({ \ + type __max1 = (x); \ + type __max2 = (y); \ + __max1 > __max2 ? __max1: __max2; }) + +/** + * Return minimum of two given values + * + * XXX check how this function is used (argument types) + */ +static inline size_t min(size_t a, size_t b) { + return a < b ? a : b; } + +/** + * Return maximum of two given values + * + * XXX check how this function is used (argument types) + */ +#define max(x, y) ({ \ + typeof(x) _max1 = (x); \ + typeof(y) _max2 = (y); \ + (void) (&_max1 == &_max2); \ + _max1 > _max2 ? _max1 : _max2; }) + +#define min_t(type, x, y) ({ \ + type __min1 = (x); \ + type __min2 = (y); \ + __min1 < __min2 ? __min1: __min2; }) + +#define abs(x) ( { \ + typeof (x) _x = (x); \ + _x < 0 ? -_x : _x; }) + +#define lower_32_bits(n) ((u32)(n)) +#define upper_32_bits(n) ((u32)(((n) >> 16) >> 16)) + +#define roundup(x, y) ( \ +{ \ + const typeof(y) __y = y; \ + (((x) + (__y - 1)) / __y) * __y; \ +}) + +#define clamp_val(val, min, max) ({ \ + typeof(val) __val = (val); \ + typeof(val) __min = (min); \ + typeof(val) __max = (max); \ + __val = __val < __min ? __min: __val; \ + __val > __max ? __max: __val; }) + + +#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) + +#define BUILD_BUG_ON(condition) + +#define _RET_IP_ (unsigned long)__builtin_return_address(0) + +void might_sleep(); +#define might_sleep_if(cond) do { if (cond) might_sleep(); } while (0) + +#define INT_MAX ((int)(~0U>>1)) +#define UINT_MAX (~0U) + +char *kasprintf(gfp_t gfp, const char *fmt, ...); +int kstrtouint(const char *s, unsigned int base, unsigned int *res); + +#define clamp(val, min, max) ({ \ + typeof(val) __val = (val); \ + typeof(min) __min = (min); \ + typeof(max) __max = (max); \ + (void) (&__val == &__min); \ + (void) (&__val == &__max); \ + __val = __val < __min ? __min: __val; \ + __val > __max ? __max: __val; }) + +#define DIV_ROUND_CLOSEST(x, divisor)( \ +{ \ + typeof(x) __x = x; \ + typeof(divisor) __d = divisor; \ + (((typeof(x))-1) > 0 || \ + ((typeof(divisor))-1) > 0 || (__x) > 0) ? \ + (((__x) + ((__d) / 2)) / (__d)) : \ + (((__x) - ((__d) / 2)) / (__d)); \ +}) + +#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) + +#define PTR_ALIGN(p, a) ({ \ + unsigned long _p = (unsigned long)p; \ + _p = (_p + a - 1) & ~(a - 1); \ + p = (typeof(p))_p; \ + p; \ +}) + +static inline u32 reciprocal_scale(u32 val, u32 ep_ro) +{ + return (u32)(((u64) val * ep_ro) >> 32); +} + +int kstrtoul(const char *s, unsigned int base, unsigned long *res); + +int strict_strtoul(const char *s, unsigned int base, unsigned long *res); +long simple_strtoul(const char *cp, char **endp, unsigned int base); +long simple_strtol(const char *,char **,unsigned int); + +int hex_to_bin(char ch); + +#define INT_MIN (-INT_MAX - 1) +#define USHRT_MAX ((u16)(~0U)) +#define LONG_MAX ((long)(~0UL>>1)) + +/* needed by drivers/net/wireless/iwlwifi/iwl-drv.c */ +int vsnprintf(char *buf, size_t size, const char *fmt, va_list args) __attribute__((format(printf, 3, 0))); +int sprintf(char *buf, const char *fmt, ...) __attribute__((format(printf, 2, 3))); +int scnprintf(char *buf, size_t size, const char *fmt, ...) __attribute__((format(printf, 3, 4))); + +int sscanf(const char *, const char *, ...); + +/* XXX */ +#define ALIGN(x, a) __ALIGN_KERNEL((x), (a)) +#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1) +#define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask)) + +#define swap(a, b) \ + do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while (0) + + +/******************** + ** linux/printk.h ** + ********************/ + +static inline int _printk(const char *fmt, ...) __attribute__((format(printf, 1, 2))); +static inline int _printk(const char *fmt, ...) +{ + va_list args; + va_start(args, fmt); + lx_vprintf(fmt, args); + va_end(args); + return 0; +} + +static inline int no_printk(const char *fmt, ...) __attribute__((format(printf, 1, 2))); +static inline int no_printk(const char *fmt, ...) { return 0; } + +#define printk_ratelimit(x) (0) + +#define printk_ratelimited(fmt, ...) printk(fmt, ##__VA_ARGS__) + +#define pr_emerg(fmt, ...) printk(KERN_EMERG fmt, ##__VA_ARGS__) +#define pr_alert(fmt, ...) printk(KERN_ALERT fmt, ##__VA_ARGS__) +#define pr_crit(fmt, ...) printk(KERN_CRIT fmt, ##__VA_ARGS__) +#define pr_err(fmt, ...) printk(KERN_ERR fmt, ##__VA_ARGS__) +#define pr_warning(fmt, ...) printk(KERN_WARN fmt, ##__VA_ARGS__) +#define pr_warn(fmt, ...) printk(KERN_WARN fmt, ##__VA_ARGS__) +#define pr_notice(fmt, ...) printk(KERN_NOTICE fmt, ##__VA_ARGS__) +#define pr_info(fmt, ...) printk(KERN_INFO fmt, ##__VA_ARGS__) +#define pr_cont(fmt, ...) printk(KERN_CONT fmt, ##__VA_ARGS__) +/* pr_devel() should produce zero code unless DEBUG is defined */ +#ifdef DEBUG +#define pr_devel(fmt, ...) printk(KERN_DEBUG fmt, ##__VA_ARGS__) +#define pr_debug(fmt, ...) printk(KERN_DEBUG fmt, ##__VA_ARGS__) +#else +#define pr_devel(fmt, ...) no_printk(KERN_DEBUG fmt, ##__VA_ARGS__) +#define pr_debug(fmt, ...) no_printk(KERN_DEBUG fmt, ##__VA_ARGS__) +#endif + +enum { + DUMP_PREFIX_OFFSET +}; + +struct va_format +{ + const char *fmt; + va_list *va; +}; + +int snprintf(char *str, size_t size, const char *format, ...) __attribute__((format(printf, 3, 4))); + +static inline void print_hex_dump(const char *level, const char *prefix_str, + int prefix_type, int rowsize, int groupsize, + const void *buf, size_t len, bool ascii) +{ + printk("hex_dump: "); + size_t i; + for (i = 0; i < len; i++) { + printk("%x ", ((char*)buf)[i]); + } + printk("\n"); +} + +void hex_dump_to_buffer(const void *buf, size_t len, int rowsize, int groupsize, char *linebuf, size_t linebuflen, bool ascii); +void dump_stack(void); + + +/************************************* + ** linux/byteorder/little_endian.h ** + *************************************/ + +#include + + +/******************************* + ** linux/byteorder/generic.h ** + *******************************/ + +#define le16_to_cpu __le16_to_cpu +#define be16_to_cpu __be16_to_cpu +#define le32_to_cpu __le32_to_cpu +#define be32_to_cpu __be32_to_cpu +#define le16_to_cpus __le16_to_cpus +#define cpu_to_le16p __cpu_to_le16p +#define cpu_to_be16p __cpu_to_be16p +#define cpu_to_le16 __cpu_to_le16 +#define cpu_to_le16s __cpu_to_le16s +#define cpu_to_be16 __cpu_to_be16 +#define cpu_to_le32 __cpu_to_le32 +#define cpu_to_be32 __cpu_to_be32 +#define cpu_to_le32s __cpu_to_le32s +#define cpu_to_le64 __cpu_to_le64 +#define cpu_to_be64 __cpu_to_be64 +#define le16_to_cpup __le16_to_cpup +#define be16_to_cpup __be16_to_cpup +#define le32_to_cpup __le32_to_cpup +#define le32_to_cpus __le32_to_cpus +#define be32_to_cpup __be32_to_cpup +#define be64_to_cpup __be64_to_cpup +#define le64_to_cpu __le64_to_cpu + +#define htonl(x) __cpu_to_be32(x) +#define htons(x) __cpu_to_be16(x) +#define ntohl(x) __be32_to_cpu(x) +#define ntohs(x) __be16_to_cpu(x) + +struct __una_u16 { u16 x; } __attribute__((packed)); +struct __una_u32 { u32 x; } __attribute__((packed)); +struct __una_u64 { u64 x; } __attribute__((packed)); + +u32 __get_unaligned_cpu32(const void *p); + +void put_unaligned_le16(u16 val, void *p); +void put_unaligned_be16(u16 val, void *p); + +static inline void put_unaligned_le32(u32 val, void *p) +{ + *((__le32 *)p) = cpu_to_le32(val); +} + +static inline u16 get_unaligned_le16(const void *p) +{ + const struct __una_u16 *ptr = (const struct __una_u16 *)p; + return ptr->x; +} + +static inline u32 get_unaligned_le32(const void *p) +{ + const struct __una_u32 *ptr = (const struct __una_u32 *)p; + return ptr->x; +} + +void put_unaligned_le64(u64 val, void *p); + +#define put_unaligned(val, ptr) ({ \ + void *__gu_p = (ptr); \ + switch (sizeof(*(ptr))) { \ + case 1: \ + *(u8 *)__gu_p = (u8)(val); \ + break; \ + case 2: \ + put_unaligned_le16((u16)(val), __gu_p); \ + break; \ + case 4: \ + put_unaligned_le32((u32)(val), __gu_p); \ + break; \ + case 8: \ + put_unaligned_le64((u64)(val), __gu_p); \ + break; \ + } \ + (void)0; }) + +/* needed by net/wireless/util.c */ +#define htons(x) __cpu_to_be16(x) + +static inline void le32_add_cpu(__le32 *var, u32 val) +{ + *var = cpu_to_le32(le32_to_cpu(*var) + val); +} + + +/********************** + ** linux/if_ether.h ** + **********************/ + +enum { + ETH_ALEN = 6, /* octets in one ethernet addr */ + ETH_HLEN = 14, /* total octets in header */ + ETH_DATA_LEN = 1500, /* Max. octets in payload */ + ETH_P_8021Q = 0x8100, /* 802.1Q VLAN Extended Header */ + + ETH_FRAME_LEN = 1514, +}; + +#define ETH_P_TDLS 0x890D /* TDLS */ + + +/********************************** + ** linux/bitops.h, asm/bitops.h ** + **********************************/ + +#define BITS_PER_BYTE 8 +#define BIT(nr) (1UL << (nr)) +#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long)) + +#define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG)) +#define BIT_WORD(nr) ((nr) / BITS_PER_LONG) + +#include + +#define test_and_clear_bit(nr, addr) \ + __test_and_clear_bit(nr, (volatile unsigned long *)(addr)) +#define test_and_set_bit(nr, addr) \ + __test_and_set_bit(nr, (volatile unsigned long *)(addr)) +#define set_bit(nr, addr) \ + __set_bit(nr, (volatile unsigned long *)(addr)) +#define clear_bit(nr, addr) \ + __clear_bit(nr, (volatile unsigned long *)(addr)) + +#define smp_mb__before_clear_bit() +#define smp_mb__after_clear_bit() smp_mb() + +/** + * Find first zero bit (limit to machine word size) + */ +long find_next_zero_bit_le(const void *addr, + unsigned long size, unsigned long offset); + + +#include +#include +#include +#include +#include + +static inline unsigned fls_long(unsigned long l) +{ + if (sizeof(l) == 4) + return fls(l); + return fls64(l); +} + +static inline unsigned long __ffs64(u64 word) +{ +#if BITS_PER_LONG == 32 + if (((u32)word) == 0UL) + return __ffs((u32)(word >> 32)) + 32; +#elif BITS_PER_LONG != 64 +#error BITS_PER_LONG not 32 or 64 +#endif + return __ffs((unsigned long)word); +} + +#include + +#define for_each_set_bit(bit, addr, size) \ + for ((bit) = find_first_bit((addr), (size)); \ + (bit) < (size); \ + (bit) = find_next_bit((addr), (size), (bit) + 1)) + +static inline int get_bitmask_order(unsigned int count) { + return __builtin_clz(count) ^ 0x1f; } + +static inline __s32 sign_extend32(__u32 value, int index) +{ + __u8 shift = 31 - index; + return (__s32)(value << shift) >> shift; +} + +static inline __u32 rol32(__u32 word, unsigned int shift) +{ + return (word << shift) | (word >> (32 - shift)); +} + +static inline __u32 ror32(__u32 word, unsigned int shift) +{ + return (word >> shift) | (word << (32 - shift)); +} + +static inline __u16 ror16(__u16 word, unsigned int shift) +{ + return (word >> shift) | (word << (16 - shift)); +} + + +/**************************************** + ** asm-generic/bitops/const_hweight.h ** + ****************************************/ + +#define __const_hweight8(w) \ + ( (!!((w) & (1ULL << 0))) + \ + (!!((w) & (1ULL << 1))) + \ + (!!((w) & (1ULL << 2))) + \ + (!!((w) & (1ULL << 3))) + \ + (!!((w) & (1ULL << 4))) + \ + (!!((w) & (1ULL << 5))) + \ + (!!((w) & (1ULL << 6))) + \ + (!!((w) & (1ULL << 7))) ) + +#define hweight8(w) (__const_hweight8(w)) + +unsigned int hweight16(unsigned int w); +unsigned int hweight32(unsigned int w); +unsigned int hweight64(__u64 w); + + +/********************* + ** linux/kobject.h ** + *********************/ + +enum kobject_action +{ + KOBJ_ADD, + KOBJ_REMOVE, + KOBJ_CHANGE, +}; + +struct kobject { struct kobject *parent; }; + +void kobject_put(struct kobject *); +int kobject_uevent(struct kobject *, enum kobject_action); +int kobject_uevent_env(struct kobject *kobj, enum kobject_action action, char *envp[]); + +struct kobj_uevent_env +{ + char buf[32]; + int buflen; +}; + +struct kobj_uevent_env; + +int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...); +char *kobject_name(const struct kobject *kobj); +char *kobject_get_path(struct kobject *kobj, gfp_t gfp_mask); + + +typedef struct poll_table_struct { int dummy; } poll_table; + + +/******************* + ** linux/sysfs.h ** + *******************/ + +struct attribute { + const char *name; + mode_t mode; +}; + +struct attribute_group { + const char *name; + mode_t (*is_visible)(struct kobject *, struct attribute *, int); + struct attribute **attrs; +}; + +#define __ATTRIBUTE_GROUPS(_name) \ + static const struct attribute_group *_name##_groups[] = { \ + &_name##_group, \ + NULL, \ + } + +#define ATTRIBUTE_GROUPS(_name) \ + static const struct attribute_group _name##_group = { \ + .attrs = _name##_attrs, \ + }; \ +__ATTRIBUTE_GROUPS(_name) + +struct file; +struct bin_attribute { + struct attribute attr; + size_t size; + ssize_t (*read)(struct file *, struct kobject *, + struct bin_attribute *, char *, loff_t, size_t); +}; + +#define __ATTR(_name,_mode,_show,_store) { \ + .attr = {.name = #_name, .mode = _mode }, \ + .show = _show, \ + .store = _store, \ +} + +#define __ATTR_NULL { .attr = { .name = NULL } } +#define __ATTR_RO(name) __ATTR_NULL +#define __ATTR_RW(name) __ATTR_NULL + + +int sysfs_create_group(struct kobject *kobj, + const struct attribute_group *grp); +void sysfs_remove_group(struct kobject *kobj, + const struct attribute_group *grp); +int sysfs_create_link(struct kobject *kobj, struct kobject *target, + const char *name); +void sysfs_remove_link(struct kobject *kobj, const char *name); + + +/**************** + ** linux/pm.h ** + ****************/ + +struct device; + +typedef struct pm_message { int event; } pm_message_t; + +struct dev_pm_info { pm_message_t power_state; }; + +struct dev_pm_ops { + int (*suspend)(struct device *dev); + int (*resume)(struct device *dev); + int (*freeze)(struct device *dev); + int (*thaw)(struct device *dev); + int (*poweroff)(struct device *dev); + int (*restore)(struct device *dev); +}; + +#define PMSG_IS_AUTO(msg) 0 + +enum { PM_EVENT_AUTO_SUSPEND = 0x402 }; + +#define PM_EVENT_SUSPEND 0x0002 +#define PM_EVENT_HIBERNATE 0x0004 +#define PM_EVENT_SLEEP (PM_EVENT_SUSPEND | PM_EVENT_HIBERNATE) + +#ifdef CONFIG_PM_SLEEP +#define SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \ + .suspend = suspend_fn, \ + .resume = resume_fn, \ + .freeze = suspend_fn, \ + .thaw = resume_fn, \ + .poweroff = suspend_fn, \ + .restore = resume_fn, +#else +#define SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) +#endif + + +/* needed by drivers/net/wireless/iwlwifi/pcie/drv.c */ +#define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \ + const struct dev_pm_ops name = { \ + SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \ + } + + +/************************ + ** linux/pm_runtime.h ** + ************************/ + +int pm_runtime_set_active(struct device *dev); +void pm_suspend_ignore_children(struct device *dev, bool enable); +void pm_runtime_enable(struct device *dev); +void pm_runtime_disable(struct device *dev); +void pm_runtime_allow(struct device *dev); +void pm_runtime_forbid(struct device *dev); +void pm_runtime_set_suspended(struct device *dev); +void pm_runtime_get_noresume(struct device *dev); +void pm_runtime_put_noidle(struct device *dev); +void pm_runtime_use_autosuspend(struct device *dev); +int pm_runtime_put_sync_autosuspend(struct device *dev); +void pm_runtime_no_callbacks(struct device *dev); +void pm_runtime_set_autosuspend_delay(struct device *dev, int delay); +int pm_runtime_get_sync(struct device *dev); +int pm_runtime_put_sync(struct device *dev); +int pm_runtime_put(struct device *dev); + + +/*********************** + ** linux/pm_wakeup.h ** + ***********************/ + +int device_init_wakeup(struct device *dev, bool val); +int device_wakeup_enable(struct device *dev); +bool device_may_wakeup(struct device *dev); +int device_set_wakeup_enable(struct device *dev, bool enable); +bool device_can_wakeup(struct device *dev); + + +/******************** + ** linux/pm_qos.h ** + ********************/ + +struct pm_qos_request { }; + +enum { PM_QOS_FLAG_NO_POWER_OFF = 1 }; + +enum { PM_QOS_NETWORK_LATENCY = 2 }; + +int pm_qos_request(int pm_qos_class); +struct notifier_block; +int pm_qos_add_notifier(int pm_qos_class, struct notifier_block *notifier); +int pm_qos_remove_notifier(int pm_qos_class, struct notifier_block *notifier); + +int dev_pm_qos_expose_flags(struct device *dev, s32 value); + + +/********************** + ** linux/notifier.h ** + **********************/ + +enum { + NOTIFY_DONE = 0x0000, + NOTIFY_OK = 0x0001, + NOTIFY_STOP_MASK = 0x8000, + NOTIFY_BAD = (NOTIFY_STOP_MASK | 0x0002), + NOTIFY_STOP = (NOTIFY_OK|NOTIFY_STOP_MASK), + + NETLINK_URELEASE = 0x1, +}; + +struct notifier_block; + +typedef int (*notifier_fn_t)(struct notifier_block *nb, unsigned long action, + void *data); + + +struct notifier_block +{ + notifier_fn_t notifier_call; + struct notifier_block *next; + int priority; +}; + +struct raw_notifier_head +{ + struct notifier_block *head; +}; + +#define RAW_NOTIFIER_HEAD(name) \ + struct raw_notifier_head name; + +struct atomic_notifier_head { + spinlock_t lock; + struct notifier_block *head; +}; + +struct blocking_notifier_head { + struct rw_semaphore rwsem; + struct notifier_block *head; +}; + +#define BLOCKING_NOTIFIER_INIT(name) { \ + .rwsem = __RWSEM_INITIALIZER((name).rwsem), .head = NULL } +#define BLOCKING_NOTIFIER_HEAD(name) \ + struct blocking_notifier_head name = BLOCKING_NOTIFIER_INIT(name) + +int blocking_notifier_chain_register(struct blocking_notifier_head *nh, struct notifier_block *nb); +int blocking_notifier_chain_unregister(struct blocking_notifier_head *nh, struct notifier_block *nb); +int blocking_notifier_call_chain(struct blocking_notifier_head *nh, unsigned long val, void *v); +int atomic_notifier_chain_register(struct atomic_notifier_head *nh, struct notifier_block *nb); +int atomic_notifier_chain_unregister(struct atomic_notifier_head *nh, struct notifier_block *nb); +int atomic_notifier_call_chain(struct atomic_notifier_head *nh, unsigned long val, void *v); +int raw_notifier_chain_register(struct raw_notifier_head *nh, struct notifier_block *n); +int raw_notifier_chain_unregister(struct raw_notifier_head *nh, struct notifier_block *nb); +int blocking_notifier_call_chain(struct blocking_notifier_head *nh, unsigned long val, void *v); + +static inline int notifier_to_errno(int ret) +{ + return ret > 0 ? ret : 0; +} + +static inline int notifier_from_errno(int err) +{ + return err ? (NOTIFY_STOP_MASK | (NOTIFY_OK - err)) : NOTIFY_OK; +} + +#define ATOMIC_NOTIFIER_INIT(name) { \ + .head = NULL } + +#define ATOMIC_NOTIFIER_HEAD(name) \ + struct atomic_notifier_head name = ATOMIC_NOTIFIER_INIT(name) + + +/******************** + ** linux/device.h ** + ********************/ + +#define dev_info(dev, format, arg...) lx_printf("dev_info: " format , ## arg) +#define dev_warn(dev, format, arg...) lx_printf("dev_warn: " format , ## arg) +#define dev_WARN(dev, format, arg...) lx_printf("dev_WARN: " format , ## arg) +#define dev_err( dev, format, arg...) lx_printf("dev_error: " format , ## arg) +#define dev_notice(dev, format, arg...) lx_printf("dev_notice: " format , ## arg) +#define dev_crit(dev, format, arg...) lx_printf("dev_crit: " format , ## arg) + +#ifndef DEBUG_DEV_DBG +#define DEBUG_DEV_DBG 1 +#endif +#if DEBUG_DEV_DBG +#define dev_dbg(dev, format, arg...) lx_printf("dev_dbg: " format , ## arg) +#else +#define dev_dbg( dev, format, arg...) +#endif + +#define dev_printk(level, dev, format, arg...) \ + lx_printf("dev_printk: " format , ## arg) + +#define dev_warn_ratelimited(dev, format, arg...) \ + lx_printf("dev_warn_ratelimited: " format , ## arg) + +enum { + BUS_NOTIFY_ADD_DEVICE = 0x00000001, + BUS_NOTIFY_DEL_DEVICE = 0x00000002, +}; + +struct device; +struct device_driver; + +struct bus_type +{ + const char *name; + struct device_attribute *dev_attrs; + int (*match)(struct device *dev, struct device_driver *drv); + int (*uevent)(struct device *dev, struct kobj_uevent_env *env); + int (*probe)(struct device *dev); + int (*remove)(struct device *dev); +}; + +struct device_driver +{ + char const *name; + struct bus_type *bus; + struct module *owner; + const char *mod_name; + const struct of_device_id *of_match_table; + const struct acpi_device_id *acpi_match_table; + int (*probe) (struct device *dev); + int (*remove) (struct device *dev); + + const struct dev_pm_ops *pm; +}; + +struct kobj_uevent_env; + +struct device_type +{ + const char *name; + const struct attribute_group **groups; + void (*release)(struct device *dev); + int (*uevent)(struct device *dev, struct kobj_uevent_env *env); + char *(*devnode)(struct device *dev, mode_t *mode); + const struct dev_pm_ops *pm; +}; + +struct class +{ + const char *name; + struct module *owner; + + const struct attribute_group **dev_groups; + + int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env); + char *(*devnode)(struct device *dev, mode_t *mode); + void (*dev_release)(struct device *dev); + + int (*suspend)(struct device *dev, pm_message_t state); + int (*resume)(struct device *dev); + + const struct kobj_ns_type_operations *ns_type; + const void *(*_namespace)(struct device *dev); + + const struct dev_pm_ops *pm; +}; + +struct dma_parms; + +/* DEVICE */ +struct device { + const char *name; + struct device *parent; + struct kobject kobj; + const struct device_type *type; + struct device_driver *driver; + void *platform_data; + u64 *dma_mask; /* needed by usb/hcd.h */ + u64 coherent_dma_mask; /* omap driver */ + struct dev_pm_info power; + dev_t devt; + const struct attribute_group **groups; + void (*release)(struct device *dev); + struct bus_type *bus; + struct class *class; + void *driver_data; + struct device_node *of_node; + struct device_dma_parameters *dma_parms; + + /** + * XXX this field is not in the original struct and is only + * used by pci_{g,s}et_drvdata + */ + void *__private__; +}; + +struct device_attribute { + struct attribute attr; + ssize_t (*show)(struct device *dev, struct device_attribute *attr, + char *buf); + ssize_t (*store)(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count); +}; + +struct driver_attribute { + struct attribute attr; + ssize_t (*show)(struct device_driver *driver, char *buf); + ssize_t (*store)(struct device_driver *driver, const char *buf, + size_t count); +}; + +#define DEVICE_ATTR(_name, _mode, _show, _store) \ + struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store) + +#define DEVICE_ATTR_RO(_name) \ + struct device_attribute dev_attr_##_name = __ATTR_RO(_name) + +#define DEVICE_ATTR_RW(_name) \ + struct device_attribute dev_attr_##_name = __ATTR_RW(_name) + +#define DRIVER_ATTR(_name, _mode, _show, _store) \ + struct driver_attribute driver_attr_##_name = \ +__ATTR(_name, _mode, _show, _store) + +void *dev_get_drvdata(const struct device *dev); +int dev_set_drvdata(struct device *dev, void *data); +int dev_set_name(struct device *dev, const char *name, ...); +const char *dev_name(const struct device *dev); +int dev_to_node(struct device *dev); +void set_dev_node(struct device *dev, int node); + +struct device *device_create(struct class *cls, struct device *parent, + dev_t devt, void *drvdata, + const char *fmt, ...); +int device_add(struct device *dev); +void device_destroy(struct class *cls, dev_t devt); +int device_register(struct device *dev); +void device_unregister(struct device *dev); +void device_lock(struct device *dev); +int device_trylock(struct device *dev); +void device_unlock(struct device *dev); +void device_del(struct device *dev); +void device_initialize(struct device *dev); +int device_attach(struct device *dev); +int device_is_registered(struct device *dev); +int device_bind_driver(struct device *dev); +void device_release_driver(struct device *dev); +void device_enable_async_suspend(struct device *dev); +void device_set_wakeup_capable(struct device *dev, bool capable); +int device_create_bin_file(struct device *dev, const struct bin_attribute *attr); +void device_remove_bin_file(struct device *dev, const struct bin_attribute *attr); +int device_create_file(struct device *device, const struct device_attribute *entry); +void device_remove_file(struct device *dev, const struct device_attribute *attr); +int device_reprobe(struct device *dev); +int device_rename(struct device *dev, const char *new_name); + +void put_device(struct device *dev); +struct device *get_device(struct device *dev); + +int driver_register(struct device_driver *drv); +void driver_unregister(struct device_driver *drv); +int driver_attach(struct device_driver *drv); +int driver_create_file(struct device_driver *driver, + const struct driver_attribute *attr); +void driver_remove_file(struct device_driver *driver, + const struct driver_attribute *attr); + +struct device_driver *get_driver(struct device_driver *drv); +void put_driver(struct device_driver *drv); + +struct device *bus_find_device(struct bus_type *bus, struct device *start, + void *data, + int (*match)(struct device *dev, void *data)); +int bus_register(struct bus_type *bus); +void bus_unregister(struct bus_type *bus); +int bus_register_notifier(struct bus_type *bus, + struct notifier_block *nb); +int bus_unregister_notifier(struct bus_type *bus, + struct notifier_block *nb); + +struct lock_class_key; +struct class *__class_create(struct module *owner, + const char *name, + struct lock_class_key *key); +#define class_create(owner, name) \ + ({ \ + static struct lock_class_key __key; \ + __class_create(owner, name, &__key); \ + }) +int class_register(struct class *cls); +void class_unregister(struct class *cls); +void class_destroy(struct class *cls); + +typedef void (*dr_release_t)(struct device *dev, void *res); +typedef int (*dr_match_t)(struct device *dev, void *res, void *match_data); + +void *devres_alloc(dr_release_t release, size_t size, gfp_t gfp); +void devres_add(struct device *dev, void *res); +int devres_destroy(struct device *dev, dr_release_t release, + dr_match_t match, void *match_data); +void devres_free(void *res); + +void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp); + +static inline const char *dev_driver_string(const struct device *dev) +{ + struct device_driver *drv = dev->driver; + + return drv ? drv->name : (dev->bus ? dev->bus->name : (dev->class ? dev->class->name : "")); +} + +int dev_printk_emit(int, const struct device *, const char *, ...); + + +/************************ + ** linux/miscdevice.h ** + ************************/ + +#define MISC_DYNAMIC_MINOR 255 + +struct miscdevice { + int minor; + const char *name; + const struct file_operations *fops; + struct list_head list; + struct device *parent; + struct device *this_device; + const char *nodename; + umode_t mode; +}; + +int misc_register(struct miscdevice * misc); +int misc_deregister(struct miscdevice *misc); + + +/********************* + ** linux/uapi/if.h ** + *********************/ + +enum { + IFF_UP = 0x1, + IFF_BROADCAST = 0x2, + IFF_LOOPBACK = 0x8, + IFF_NOARP = 0x80, /* no ARP protocol */ + IFF_PROMISC = 0x100, /* receive all packets */ + IFF_ALLMULTI = 0x200, /* receive all multicast packets */ + IFF_MULTICAST = 0x1000, /* supports multicast */ + IFF_DONT_BRIDGE = 0x800, + IFF_BRIDGE_PORT = 0x4000, + IFF_TX_SKB_SHARING = 0x10000, + IFF_LIVE_ADDR_CHANGE = 0x100000, + + IFNAMSIZ = 16, + IFALIASZ = 256, +}; + +enum { + IF_OPER_UNKNOWN, + IF_OPER_NOTPRESENT, + IF_OPER_DOWN, + IF_OPER_LOWERLAYERDOWN, + IF_OPER_TESTING, + IF_OPER_DORMANT, + IF_OPER_UP, +}; + +struct ifmap { + unsigned long mem_start; + unsigned long mem_end; + unsigned short base_addr; + unsigned char irq; + unsigned char dma; + unsigned char port; + /* 3 bytes spare */ +}; + + + +/************************* + ** linux/uapi/if_arp.h ** + *************************/ + +enum { + ARPHRD_ETHER = 1, + ARPHRD_IEEE80211_RADIOTAP = 803, + ARPHRD_NETLINK = 824, +}; + + +/*************************** + ** linux/uapi/if_ether.h ** + ***************************/ + +enum { + ETH_P_IP = 0x0800, + ETH_P_IPV6 = 0x86DD, +}; + + +/**************************** + ** uapi/linux/if_packet.h ** + ****************************/ + +enum { + PACKET_HOST = 0, + PACKET_BROADCAST = 1, + PACKET_MULTICAST = 2, + PACKET_OTHERHOST = 3, + PACKET_USER = 6, + PACKET_KERNEL = 7, +}; + + +/***************************** + ** uapi/linux/virtio_net.h ** + *****************************/ + +struct virtio_net_hdr +{ +#define VIRTIO_NET_HDR_F_NEEDS_CSUM 1 // Use csum_start, csum_offset +#define VIRTIO_NET_HDR_F_DATA_VALID 2 // Csum is valid + __u8 flags; +#define VIRTIO_NET_HDR_GSO_NONE 0 // Not a GSO frame +#define VIRTIO_NET_HDR_GSO_TCPV4 1 // GSO frame, IPv4 TCP (TSO) +#define VIRTIO_NET_HDR_GSO_UDP 3 // GSO frame, IPv4 UDP (UFO) +#define VIRTIO_NET_HDR_GSO_TCPV6 4 // GSO frame, IPv6 TCP +#define VIRTIO_NET_HDR_GSO_ECN 0x80 // TCP has ECN set + __u8 gso_type; + __u16 hdr_len; /* Ethernet + IP + tcp/udp hdrs */ + __u16 gso_size; /* Bytes to append to hdr_len per frame */ + __u16 csum_start; /* Position to start checksumming from */ + __u16 csum_offset; /* Offset after that to place checksum */ +}; + + +/********************* + ** linux/ethtool.h ** + *********************/ + +enum { + DUPLEX_HALF = 0x0, + DUPLEX_FULL = 0x1, + ETHTOOL_GSET = 0x1, + ETHTOOL_FWVERS_LEN = 32, + ETHTOOL_BUSINFO_LEN = 32, + + WAKE_PHY = 0, + WAKE_UCAST = (1 << 1), + WAKE_MCAST = (1 << 2), + WAKE_BCAST = (1 << 3), + WAKE_ARP = (1 << 4), + WAKE_MAGIC = (1 << 5), + + SPEED_100 = 100, + SPEED_1000 = 1000, +}; + +#define ETH_GSTRING_LEN 32 +enum ethtool_stringset { + ETH_SS_TEST = 0, + ETH_SS_STATS, + ETH_SS_PRIV_FLAGS, + ETH_SS_NTUPLE_FILTERS, + ETH_SS_FEATURES, +}; + +struct ethtool_cmd +{ + u32 cmd; + u8 duplex; +}; + +struct ethtool_regs +{ + u32 version; + u32 len; +}; + +struct ethtool_eeprom +{ + u32 magic; + u32 offset; + u32 len; +}; + +struct ethtool_drvinfo +{ + char driver[32]; /* driver short name, "tulip", "eepro100" */ + char version[32]; /* driver version string */ + char fw_version[ETHTOOL_FWVERS_LEN]; /* firmware version string */ + char bus_info[ETHTOOL_BUSINFO_LEN]; /* Bus info for this IF. */ + /* For PCI devices, use pci_name(pci_de + * v). */ + u32 eedump_len; +}; + +struct ethtool_wolinfo { + u32 supported; + u32 wolopts; +}; + +struct ethtool_ts_info; + +struct net_device; +struct ethtool_ringparam; +struct ethtool_stats; + +struct ethtool_ops +{ + int (*get_settings)(struct net_device *, struct ethtool_cmd *); + int (*set_settings)(struct net_device *, struct ethtool_cmd *); + void (*get_drvinfo)(struct net_device *, struct ethtool_drvinfo *); + int (*get_regs_len)(struct net_device *); + void (*get_regs)(struct net_device *, struct ethtool_regs *, void *); + int (*nway_reset)(struct net_device *); + u32 (*get_link)(struct net_device *); + int (*get_eeprom_len)(struct net_device *); + int (*get_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *); + int (*set_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *); + void (*get_ringparam)(struct net_device *, struct ethtool_ringparam *); + int (*set_ringparam)(struct net_device *, struct ethtool_ringparam *); + void (*get_strings)(struct net_device *, u32 stringset, u8 *); + void (*get_ethtool_stats)(struct net_device *, struct ethtool_stats *, u64 *); + int (*get_sset_count)(struct net_device *, int); + u32 (*get_msglevel)(struct net_device *); + void (*set_msglevel)(struct net_device *, u32); + void (*get_wol)(struct net_device *, struct ethtool_wolinfo *); + int (*set_wol)(struct net_device *, struct ethtool_wolinfo *); + int (*get_ts_info)(struct net_device *, struct ethtool_ts_info *); + +}; + +__u32 ethtool_cmd_speed(const struct ethtool_cmd *); +int __ethtool_get_settings(struct net_device *dev, struct ethtool_cmd *cmd); +u32 ethtool_op_get_link(struct net_device *); +int ethtool_op_get_ts_info(struct net_device *, struct ethtool_ts_info *); + + +/************************** + ** uapi/linux/ethtool.h ** + **************************/ + +enum { + SPEED_UNKNOWN = -1, +}; + +struct ethtool_stats { + __u32 cmd; /* ETHTOOL_GSTATS */ + __u32 n_stats; /* number of u64's being returned */ + __u64 data[0]; +}; + + +struct ethtool_ringparam { + u32 rx_max_pending; + u32 tx_max_pending; + u32 rx_pending; + u32 rx_mini_pending; + u32 rx_jumbo_pending; + u32 tx_pending; +}; + +/********************* + ** linux/average.h ** + *********************/ + +struct ewma { + unsigned long internal; + unsigned long factor; + unsigned long weight; +}; + +extern void ewma_init(struct ewma *avg, unsigned long factor, + unsigned long weight); + +extern struct ewma *ewma_add(struct ewma *avg, unsigned long val); + +static inline unsigned long ewma_read(const struct ewma *avg) +{ + return avg->internal >> avg->factor; +} + + +/******************************** + ** include/uapi/linux/types.h ** + ********************************/ + +#define __bitwise__ + + +/******************************* + ** linux/errno.h and friends ** + *******************************/ + +/** + * Error codes + * + * Note that the codes do not correspond to those of the Linux kernel. + */ +enum { + /* + * The following numbers correspond to FreeBSD + */ + EPERM = 1, + ENOENT = 2, + ESRCH = 3, + EINTR = 4, + EIO = 5, + ENXIO = 6, + E2BIG = 7, + EDEADLK = 11, + ENOMEM = 12, + EACCES = 13, + EFAULT = 14, + EBUSY = 16, + EEXIST = 17, + EXDEV = 18, + ENODEV = 19, + EINVAL = 22, + ENFILE = 23, + EFBIG = 27, + ENOSPC = 28, + ESPIPE = 29, + EPIPE = 32, + EDOM = 33, + ERANGE = 34, + EAGAIN = 35, + EINPROGRESS = 36, + EALREADY = 37, + ENOTSOCK = 38, + EDESTADDRREQ = 39, + EMSGSIZE = 40, + ENOPROTOOPT = 42, + EPROTONOSUPPORT = 43, + ESOCKTNOSUPPORT = 44, + EOPNOTSUPP = 45, + EPFNOSUPPORT = 46, + EAFNOSUPPORT = 47, + EADDRINUSE = 48, + EADDRNOTAVAIL = 49, + ENETDOWN = 50, + ENETUNREACH = 51, + ECONNABORTED = 53, + ECONNRESET = 54, + ENOBUFS = 55, + EISCONN = 56, + ENOTCONN = 57, + ETIMEDOUT = 60, + ECONNREFUSED = 61, + ENAMETOOLONG = 63, + EHOSTDOWN = 64, + EHOSTUNREACH = 65, + ENOSYS = 78, + ENOMSG = 83, + EOVERFLOW = 84, + ECANCELED = 85, + EILSEQ = 86, + EBADMSG = 89, + ENOLINK = 91, + EPROTO = 92, + + /* + * The following numbers correspond to nothing + */ + EREMOTEIO = 200, + ERESTARTSYS = 201, + ENODATA = 202, + ETOOSMALL = 203, + ENOIOCTLCMD = 204, + ENONET = 205, + ENOTSUPP = 206, + ENOTUNIQ = 207, + ERFKILL = 208, + + MAX_ERRNO = 4095, +}; + + +/************************** + ** linux/preempt_mask.h ** + **************************/ + +int in_interrupt(void); +int in_softirq(void); +int in_irq(void); + +int softirq_count(void); + + +/********************* + ** linux/preempt.h ** + *********************/ + +#define preempt_disable() barrier() +#define preempt_enable() barrier() + + +/********************** + ** linux/inerrupt.h ** + **********************/ + +struct tasklet_struct +{ + void (*func)(unsigned long); + unsigned long data; +}; + +void tasklet_schedule(struct tasklet_struct *t); +void tasklet_hi_schedule(struct tasklet_struct *t); +void tasklet_kill(struct tasklet_struct *); +void tasklet_init(struct tasklet_struct *t, void (*)(unsigned long), unsigned long); + + +/***************** + ** linux/idr.h ** + *****************/ + +#define IDR_BITS 8 +#define IDR_SIZE (1 << IDR_BITS) +#define IDR_MASK ((1 << IDR_BITS)-1) + +struct idr_layer { + int prefix; /* the ID prefix of this idr_layer */ + DECLARE_BITMAP(bitmap, IDR_SIZE); /* A zero bit means "space here" */ + struct idr_layer __rcu *ary[1<rcu_head), offsetof(typeof(*(ptr)), rcu_head)) + +static inline int rcu_read_lock_held(void) { return 1; } +static inline int rcu_read_lock_bh_held(void) { return 1; } + +#define RCU_INIT_POINTER(p, v) do { p = (typeof(*v) *)v; } while (0) + +void call_rcu(struct rcu_head *head, void (*func)(struct rcu_head *head)); + + +/********************* + ** linux/rcutree.h ** + *********************/ + +void rcu_barrier(void); + + +/******************************* + ** net/mac80211/driver-ops.h ** + *******************************/ + +struct ieee80211_local; +struct ieee80211_low_level_stats; + + +/********************* + ** linux/rculist.h ** + *********************/ + +#include + +#define list_for_each_entry_rcu(pos, head, member) \ + list_for_each_entry(pos, head, member) + +static inline void list_add(struct list_head *, struct list_head *head); +static inline void list_add_tail(struct list_head *, struct list_head *head); +static inline void list_del(struct list_head *entry); +static inline void list_move_tail(struct list_head *list, struct list_head *head); + +static inline void list_add_rcu(struct list_head *n, struct list_head *head) { + list_add(n, head); } + +static inline void list_add_tail_rcu(struct list_head *n, + struct list_head *head) { + list_add_tail(n, head); } + +static inline void list_del_rcu(struct list_head *entry) { + list_del(entry); } + +#define list_entry_rcu(ptr, type, member) \ + ({typeof (*ptr) __rcu *__ptr = (typeof (*ptr) __rcu __force *)ptr; \ + container_of((typeof(ptr))rcu_dereference_raw(__ptr), type, member); \ + }) + +#define hlist_for_each_entry_rcu(pos, head, member) \ +hlist_for_each_entry(pos, head, member) +#define list_next_rcu(list) (*((struct list_head **)(&(list)->next))) + +#define list_for_each_entry_rcu(pos, head, member) \ +list_for_each_entry(pos, head, member) + +#define list_first_or_null_rcu(ptr, type, member) ({ \ +struct list_head *__ptr = (ptr); \ +struct list_head __rcu *__next = list_next_rcu(__ptr); \ +__ptr != __next ? container_of(__next, type, member) : NULL; \ +}) + +#define list_add_rcu list_add +#define list_add_tail_rcu list_add_tail +#define hlist_add_head_rcu hlist_add_head + +#define list_del_rcu list_del +#define hlist_del_rcu hlist_del + +#define hlist_del_init_rcu hlist_del_init +#define free_percpu(pdata) kfree(pdata) + +void hlist_add_after_rcu(struct hlist_node *, struct hlist_node *); +void hlist_add_before_rcu(struct hlist_node *,struct hlist_node *); + +void list_replace_rcu(struct list_head *, struct list_head *); + +#include + + +/********************* + ** linux/jiffies.h ** + *********************/ + +#define MAX_JIFFY_OFFSET ((LONG_MAX >> 1)-1) + +extern unsigned long jiffies; + +unsigned int jiffies_to_msecs(const unsigned long); +unsigned long usecs_to_jiffies(const unsigned int u); +unsigned long msecs_to_jiffies(const unsigned int); +clock_t jiffies_to_clock_t(unsigned long x); +static inline clock_t jiffies_delta_to_clock_t(long delta) +{ + return jiffies_to_clock_t(max(0L, delta)); +} + +#define time_after(a,b) ((long)((b) - (a)) < 0) +#define time_after_eq(a,b) ((long)((a) - (b)) >= 0) +#define time_before(a,b) time_after(b,a) +#define time_before_eq(a,b) time_after_eq(b,a) + +#define time_is_after_jiffies(a) time_before(jiffies, a) + + +/****************** + ** linux/time.h ** + ******************/ + +struct timeval +{ + __kernel_time_t tv_sec; + __kernel_suseconds_t tv_usec; +}; + +struct timespec { + __kernel_time_t tv_sec; + long tv_nsec; +}; + +enum { + MSEC_PER_SEC = 1000L, + USEC_PER_SEC = MSEC_PER_SEC * 1000L, + NSEC_PER_USEC = 1000L, + NSEC_PER_MSEC = NSEC_PER_USEC * 1000L, + NSEC_PER_SEC = MSEC_PER_SEC * NSEC_PER_MSEC, + USEC, + USEC_PER_MSEC = 1000L, +}; + +unsigned long get_seconds(void); +void getnstimeofday(struct timespec *); +#define do_posix_clock_monotonic_gettime(ts) ktime_get_ts(ts) + + +/******************* + ** linux/ktime.h ** + *******************/ + +union ktime { + s64 tv64; +}; + +typedef union ktime ktime_t; + +#define ktime_to_ns(kt) ((kt).tv64) + +struct timeval ktime_to_timeval(const ktime_t); +struct timespec ktime_to_timespec(const ktime_t kt); +bool ktime_to_timespec_cond(const ktime_t kt, struct timespec *ts); + +ktime_t ktime_sub(const ktime_t, const ktime_t); +ktime_t ktime_get(void); +int ktime_equal(const ktime_t, const ktime_t); +s64 ktime_us_delta(const ktime_t, const ktime_t); + +static inline ktime_t ktime_set(const long secs, const unsigned long nsecs) +{ + return (ktime_t) { .tv64 = (s64)secs * NSEC_PER_SEC + (s64)nsecs }; +} + +static inline s64 ktime_to_ms(const ktime_t kt) +{ + return kt.tv64 / NSEC_PER_MSEC; +} + +static inline ktime_t ktime_get_real(void) +{ + return (ktime_t) { .tv64 = (s64)(jiffies * (1000 / HZ) * NSEC_PER_MSEC) }; +} + +static inline void ktime_get_ts(struct timespec *ts) +{ + ts->tv_sec = jiffies * (1000/HZ); + ts->tv_nsec = 0; +} + + +/*********************** + ** linux/kmemcheck.h ** + ***********************/ + +#define kmemcheck_bitfield_begin(name) +#define kmemcheck_bitfield_end(name) +#define kmemcheck_annotate_bitfield(ptr, name) +#define kmemcheck_annotate_variable(var) + + +/****************** + ** linux/numa.h ** + ******************/ + +enum { NUMA_NO_NODE = -1 }; + + +/************************* + ** asm-generic/cache.h ** + *************************/ + +#define L1_CACHE_BYTES 32 +#define SMP_CACHE_BYTES L1_CACHE_BYTES + +#define ____cacheline_aligned __attribute__((__aligned__(SMP_CACHE_BYTES))) +#define ____cacheline_aligned_in_smp ____cacheline_aligned +#define __cacheline_aligned ____cacheline_aligned + + +/********************* + ** linux/seqlock.h ** + *********************/ + +typedef unsigned seqlock_t; + +void seqlock_init (seqlock_t *); + +#define __SEQLOCK_UNLOCKED(x) 0 + + +/****************** + ** linux/init.h ** + ******************/ + +#define __init +#define __exit +#define __devinitconst + +#define _SETUP_CONCAT(a, b) __##a##b +#define SETUP_CONCAT(a, b) _SETUP_CONCAT(a, b) +#define __setup(str, fn) static void SETUP_CONCAT(fn, SETUP_SUFFIX)(void *addrs) { fn(addrs); } + +#define core_initcall(fn) void core_##fn(void) { fn(); } +#define subsys_initcall(fn) void subsys_##fn(void) { fn(); } +#define pure_initcall(fd) void pure_##fn(void) { printk("PURE_INITCALL"); fn(); } + + +/******************** + ** linux/module.h ** + ********************/ + +#define EXPORT_SYMBOL(x) +#define EXPORT_SYMBOL_GPL(x) +#define MODULE_LICENSE(x) +#define MODULE_NAME_LEN (64 - sizeof(long)) +#define MODULE_ALIAS(name) +#define MODULE_AUTHOR(name) +#define MODULE_DESCRIPTION(desc) +#define MODULE_VERSION(version) +#define THIS_MODULE 0 +#define MODULE_FIRMWARE(_firmware) +#define MODULE_DEVICE_TABLE(type, name) + + +struct module; +#define module_init(fn) void module_##fn(void) { fn(); } +#define module_exit(fn) void module_exit_##fn(void) { fn(); } +void module_put_and_exit(int); + +void module_put(struct module *); +void __module_get(struct module *module); +int try_module_get(struct module *); + + +/************************* + ** linux/moduleparam.h ** + *************************/ + +#define module_param(name, type, perm) +#define module_param_named(name, value, type, perm) +#define MODULE_PARM_DESC(_parm, desc) +#define kparam_block_sysfs_write(name) +#define kparam_unblock_sysfs_write(name) + + +/*********************************** + ** linux/rwlock_types.h/rwlock.h ** + ***********************************/ + +typedef unsigned rwlock_t; + +#define DEFINE_RWLOCK(x) rwlock_t x; +#define __RW_LOCK_UNLOCKED(x) 0 + +void rwlock_init(rwlock_t *); + +void write_lock_bh(rwlock_t *); +void write_unlock_bh(rwlock_t *); +void write_lock(rwlock_t *); +void write_unlock(rwlock_t *); +void write_lock_irq(rwlock_t *); +void write_unlock_irq(rwlock_t *); +void write_lock_irqsave(rwlock_t *, unsigned long); +void write_unlock_irqrestore(rwlock_t *, unsigned long); + +void read_lock(rwlock_t *); +void read_unlock(rwlock_t *); +void read_lock_bh(rwlock_t *); +void read_unlock_bh(rwlock_t *); + + +/********************* + ** linux/seqlock.h ** + *********************/ + +typedef struct seqcount { + unsigned sequence; +} seqcount_t; + +unsigned read_seqbegin(const seqlock_t *sl); +unsigned read_seqretry(const seqlock_t *sl, unsigned start); +void write_seqlock_bh(seqlock_t *); +void write_sequnlock_bh(seqlock_t *); +void write_seqlock(seqlock_t *); +void write_sequnlock(seqlock_t *); +void write_seqcount_begin(seqcount_t *); +void write_seqcount_end(seqcount_t *); + + +/**************************** + ** linux/percpu_counter.h ** + ****************************/ + +struct percpu_counter +{ + s64 count; +}; + +static inline int percpu_counter_init(struct percpu_counter *fbc, s64 amount) +{ + fbc->count = amount; + return 0; +} + +static inline s64 percpu_counter_read(struct percpu_counter *fbc) +{ + return fbc->count; +} + +static inline +void percpu_counter_add(struct percpu_counter *fbc, s64 amount) +{ + fbc->count += amount; +} + +static inline +void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch) +{ + percpu_counter_add(fbc, amount); +} + +s64 percpu_counter_sum_positive(struct percpu_counter *fbc); + +static inline void percpu_counter_inc(struct percpu_counter *fbc) +{ + percpu_counter_add(fbc, 1); +} + +static inline void percpu_counter_dec(struct percpu_counter *fbc) +{ + percpu_counter_add(fbc, -1); +} + +static inline +s64 percpu_counter_read_positive(struct percpu_counter *fbc) +{ + return fbc->count; +} + +void percpu_counter_destroy(struct percpu_counter *fbc); + + +/**************************** + ** linux/u64_stats_sync.h ** + ****************************/ + +struct u64_stats_sync { }; + + +/******************** + ** linux/uidgid.h ** + ********************/ + +typedef unsigned kuid_t; +typedef unsigned kgid_t; + +#define GLOBAL_ROOT_UID (kuid_t)0 + +struct user_namespace; +extern uid_t from_kuid_munged(struct user_namespace *to, kuid_t uid); +extern gid_t from_kgid_munged(struct user_namespace *to, kgid_t gid); + + + /************************* + ** linux/bottom_half.h ** + *************************/ + +void local_bh_disable(void); +void local_bh_enable(void); + + +/*************** + ** net/scm.h ** + ***************/ + +struct scm_creds { }; + +struct scm_cookie +{ + struct scm_creds creds; +}; + +void scm_destroy(struct scm_cookie *scm); +struct socket; +struct msghdr; +void scm_recv(struct socket *sock, struct msghdr *msg, struct scm_cookie *scm, int flags); +int scm_send(struct socket *sock, struct msghdr *msg, struct scm_cookie *scm, bool forcecreds); + + +/************************* + ** linux/etherdevice.h ** + *************************/ + +struct sk_buff; + +int eth_mac_addr(struct net_device *, void *); +int eth_validate_addr(struct net_device *); +__be16 eth_type_trans(struct sk_buff *, struct net_device *); +int is_valid_ether_addr(const u8 *); + +void random_ether_addr(u8 *addr); + +struct net_device *alloc_etherdev(int); + +void eth_hw_addr_random(struct net_device *dev); +void eth_random_addr(u8 *addr); + +static inline void eth_broadcast_addr(u8 *addr) { + memset(addr, 0xff, ETH_ALEN); } + +static inline bool is_broadcast_ether_addr(const u8 *addr) +{ + return (*(const u16 *)(addr + 0) & + *(const u16 *)(addr + 2) & + *(const u16 *)(addr + 4)) == 0xffff; +} + +static inline bool ether_addr_equal(const u8 *addr1, const u8 *addr2) +{ + const u16 *a = (const u16 *)addr1; + const u16 *b = (const u16 *)addr2; + + return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2])) == 0; +} + +static inline bool is_multicast_ether_addr(const u8 *addr) +{ + return 0x01 & addr[0]; +} + +static inline bool ether_addr_equal_64bits(const u8 addr1[6+2], const u8 addr2[6+2]) +{ + u64 fold = (*(const u64 *)addr1) ^ (*(const u64 *)addr2); + + return (fold << 16) == 0; +} + + +/************************ + ** net/netns/packet.h ** + ************************/ + +struct netns_packet { + struct mutex sklist_lock; + struct hlist_head sklist; +}; + + +/************************* + ** net/net_namespace.h ** + *************************/ + +#include +#include +#include + +enum { + LOOPBACK_IFINDEX = 1, + NETDEV_HASHBITS = 8, + NETDEV_HASHENTRIES = 1 << NETDEV_HASHBITS, +}; + +struct user_namespace; +struct proc_net; + +extern struct net init_net; + +struct net +{ + atomic_t passive; + atomic_t count; + struct list_head list; + struct list_head cleanup_list; + struct list_head exit_list; + struct proc_dir_entry *proc_net; + struct list_head dev_base_head; + struct hlist_head *dev_name_head; + struct hlist_head *dev_index_head; + unsigned int dev_base_seq; + int ifindex; + unsigned int dev_unreg_count; + struct net_device *loopback_dev; + struct user_namespace *user_ns; + unsigned int proc_inum; + struct proc_dir_entry *proc_net_stat; + struct sock *rtnl; + struct sock *genl_sock; + struct netns_mib mib; + struct netns_packet packet; + struct netns_ipv4 ipv4; + struct net_generic __rcu *gen; + atomic_t rt_genid; +}; + + +struct pernet_operations +{ + struct list_head list; + int (*init)(struct net *net); + void (*exit)(struct net *net); + void (*exit_batch)(struct list_head *net_exit_list); + int *id; + size_t size; +}; + + +extern struct list_head net_namespace_list; + +#define __net_initdata +#define __net_init +#define __net_exit + +#define for_each_net(VAR) \ + for(VAR = &init_net; VAR; VAR = 0) + +#define for_each_net_rcu(VAR) \ + list_for_each_entry_rcu(VAR, &net_namespace_list, list) + + +#define read_pnet(pnet) (&init_net) +#define write_pnet(pnet, net) do { (void)(net);} while (0) + +static inline struct net *hold_net(struct net *net) { return net; } +static inline struct net *get_net(struct net *net) { return net; } +static inline void put_net(struct net *net) { } +/* always return true because there is only the init_net namespace */ +static inline int net_eq(const struct net *net1, const struct net *net2) { + return 1; } + +struct net *get_net_ns_by_pid(pid_t pid); +struct net *get_net_ns_by_fd(int pid); + +int register_pernet_subsys(struct pernet_operations *); +void unregister_pernet_subsys(struct pernet_operations *); +int register_pernet_device(struct pernet_operations *); +void unregister_pernet_device(struct pernet_operations *); +void release_net(struct net *net); + +int rt_genid(struct net *); +void rt_genid_bump(struct net *); + + +/************************* + ** net/netns/generic.h ** + *************************/ + +struct net_generic +{ + unsigned int len; + void *ptr[0]; +}; + + +/******************** + ** linux/socket.h ** + ********************/ + +struct sockaddr; + + +/**************************** + ** uapi/linux/netdevice.h ** + ****************************/ + +#define MAX_ADDR_LEN 32 + +static inline struct net *dev_net(const struct net_device *dev) { + return &init_net; } + + +/*********************** + ** linux/netdevice.h ** + ***********************/ + +enum { + NETDEV_ALIGN = 32, + + NETDEV_UP = 0x0001, + NETDEV_DOWN = 0x0002, + NETDEV_CHANGE = 0x0004, + NETDEV_REGISTER = 0x0005, + NETDEV_UNREGISTER = 0x0006, + NETDEV_CHANGEADDR = 0x0008, + NETDEV_GOING_DOWN = 0x0009, + NETDEV_CHANGENAME = 0x000A, + NETDEV_PRE_UP = 0x000D, + NETDEV_PRE_TYPE_CHANGE = 0x000E, + NETDEV_POST_INIT = 0x0010, + NETDEV_UNREGISTER_FINAL = 0x0011, + NETDEV_RELEASE = 0x0012, + NETDEV_JOIN = 0x0014, + +}; + +#include + +#define netif_err(priv, type, dev, fmt, args...) lx_printf("netif_err: " fmt, ## args); +#define netif_info(priv, type, dev, fmt, args...) lx_printf("netif_info: " fmt, ## args); + +#define netdev_err(dev, fmt, args...) lx_printf("nedev_err: " fmt, ##args) +#define netdev_warn(dev, fmt, args...) lx_printf("nedev_warn: " fmt, ##args) +#define netdev_info(dev, fmt, args...) lx_printf("nedev_info: " fmt, ##args) + +#define netdev_for_each_mc_addr(a, b) if (0) + +#if DEBUG_LINUX_PRINTK +#define netif_dbg(priv, type, dev, fmt, args...) lx_printf("netif_dbg: " fmt, ## args) +#define netdev_dbg(dev, fmt, args...) lx_printf("netdev_dbg: " fmt, ##args) +#else +#define netif_dbg(priv, type, dev, fmt, args...) +#define netdev_dbg(dev, fmt, args...) +#endif + +#define SET_NETDEV_DEV(net, pdev) ((net)->dev.parent = (pdev)) +#define SET_NETDEV_DEVTYPE(net, devtype) ((net)->dev.type = (devtype)) + +enum netdev_tx { + NETDEV_TX_OK = 0, + NETDEV_TX_BUSY = 0x10, +}; +typedef enum netdev_tx netdev_tx_t; + +enum { + NET_RX_SUCCESS = 0, + NET_ADDR_RANDOM = 1, + NET_ADDR_SET = 3, + + NET_XMIT_DROP = 0x01, + NET_XMIT_CN = 0x02, + + NETIF_MSG_DRV = 0x1, + NETIF_MSG_PROBE = 0x2, + NETIF_MSG_LINK = 0x4, + +}; + +#define net_xmit_errno(e) ((e) != NET_XMIT_CN ? -ENOBUFS : 0) + +struct ifreq; +typedef u16 (*select_queue_fallback_t)(struct net_device *dev, + struct sk_buff *skb); + +struct ifla_vf_info; +struct nlattr; +struct ndmsg; +struct netlink_callback; +struct nlmsghdr; + +struct net_device_ops +{ + int (*ndo_init)(struct net_device *dev); + void (*ndo_uninit)(struct net_device *dev); + int (*ndo_open)(struct net_device *dev); + int (*ndo_stop)(struct net_device *dev); + netdev_tx_t (*ndo_start_xmit) (struct sk_buff *skb, struct net_device *dev); + u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb, + void *accel_priv, + select_queue_fallback_t fallback); + void (*ndo_set_rx_mode)(struct net_device *dev); + int (*ndo_set_mac_address)(struct net_device *dev, void *addr); + int (*ndo_validate_addr)(struct net_device *dev); + int (*ndo_do_ioctl)(struct net_device *dev, struct ifreq *ifr, int cmd); + int (*ndo_set_config)(struct net_device *dev, + struct ifmap *map); + void (*ndo_tx_timeout) (struct net_device *dev); + int (*ndo_change_mtu)(struct net_device *dev, int new_mtu); + int (*ndo_set_features)(struct net_device *dev, netdev_features_t features); + int (*ndo_set_vf_mac)(struct net_device *dev, + int queue, u8 *mac); + int (*ndo_set_vf_vlan)(struct net_device *dev, + int queue, u16 vlan, u8 qos); + int (*ndo_set_vf_tx_rate)(struct net_device *dev, + int vf, int rate); + int (*ndo_set_vf_spoofchk)(struct net_device *dev, + int vf, bool setting); + int (*ndo_get_vf_config)(struct net_device *dev, + int vf, + struct ifla_vf_info *ivf); + int (*ndo_set_vf_link_state)(struct net_device *dev, + int vf, int link_state); + int (*ndo_set_vf_port)(struct net_device *dev, int vf, + struct nlattr *port[]); + int (*ndo_get_vf_port)(struct net_device *dev, + int vf, struct sk_buff *skb); + int (*ndo_del_slave)(struct net_device *dev, + struct net_device *slave_dev); + int (*ndo_add_slave)(struct net_device *dev, + struct net_device *slave_dev); + int (*ndo_fdb_add)(struct ndmsg *ndm, + struct nlattr *tb[], + struct net_device *dev, + const unsigned char *addr, + u16 flags); + int (*ndo_fdb_del)(struct ndmsg *ndm, + struct nlattr *tb[], + struct net_device *dev, + const unsigned char *addr); + int (*ndo_fdb_dump)(struct sk_buff *skb, + struct netlink_callback *cb, + struct net_device *dev, + int idx); + int (*ndo_bridge_setlink)(struct net_device *dev, + struct nlmsghdr *nlh); + int (*ndo_bridge_getlink)(struct sk_buff *skb, + u32 pid, u32 seq, + struct net_device *dev, + u32 filter_mask); + int (*ndo_bridge_dellink)(struct net_device *dev, + struct nlmsghdr *nlh); +}; + +struct net_device_stats +{ + unsigned long rx_packets; + unsigned long tx_packets; + unsigned long rx_bytes; + unsigned long tx_bytes; + unsigned long rx_errors; + unsigned long tx_errors; + unsigned long rx_dropped; + unsigned long tx_dropped; + unsigned long rx_length_errors; + unsigned long rx_over_errors; + unsigned long rx_crc_errors; + unsigned long rx_frame_errors; +}; + +struct netdev_hw_addr_list { + struct list_head list; + int count; +}; + +#define netdev_hw_addr_list_count(l) ((l)->count) +#define netdev_hw_addr_list_empty(l) (netdev_hw_addr_list_count(l) == 0) +#define netdev_hw_addr_list_for_each(ha, l) \ + list_for_each_entry(ha, &(l)->list, list) + + +enum { + GSO_MAX_SIZE = 65536, + GSO_MAX_SEGS = 65535, +}; + +struct Qdisc; + +struct netdev_queue +{ + struct net_device *dev; + int numa_node; +}; + +/* NET_DEVICE */ +struct net_device +{ + char name[IFNAMSIZ]; + char *ifalias; + + unsigned long mem_end; /* shared mem end */ + unsigned long mem_start; /* shared mem start */ + unsigned long base_addr; /* device I/O address */ + int irq; /* device IRQ number */ + + u32 features; + u32 hw_features; + + struct net_device_stats stats; + const struct net_device_ops *netdev_ops; + const struct ethtool_ops *ethtool_ops; + + unsigned long state; + struct list_head dev_list; + int iflink; + int ifindex; + + const struct header_ops *header_ops; + + unsigned int flags; + unsigned int priv_flags; + unsigned short gflags; + unsigned char operstate; + unsigned char link_mode; + + unsigned char if_port; /* Selectable AUI, TP,..*/ + unsigned char dma; /* DMA channel */ + unsigned short hard_header_len; /* hardware hdr length */ + unsigned int mtu; + unsigned short type; + unsigned short needed_headroom; + unsigned short needed_tailroom; + unsigned char perm_addr[MAX_ADDR_LEN]; + unsigned char addr_assign_type; + unsigned char addr_len; + struct netdev_hw_addr_list uc; /* Unicast mac addresses */ + struct netdev_hw_addr_list mc; + + unsigned int promiscuity; + struct wireless_dev *ieee80211_ptr; + + unsigned char *dev_addr; + unsigned char _dev_addr[ETH_ALEN]; + + unsigned int real_num_tx_queues; + struct netdev_queue *_tx; + + struct netdev_queue __rcu *ingress_queue; + unsigned char broadcast[MAX_ADDR_LEN]; + + unsigned int num_tx_queues; + + struct Qdisc *qdisc; + + unsigned long tx_queue_len; + unsigned long trans_start; /* Time (in jiffies) of last Tx */ + + int watchdog_timeo; /* used by dev_watchdog() */ + struct hlist_node index_hlist; + + enum { + RTNL_LINK_INITIALIZED, + RTNL_LINK_INITIALIZING, + } rtnl_link_state:16; + + void (*destructor)(struct net_device *dev); + const struct rtnl_link_ops *rtnl_link_ops; + + unsigned int gso_max_size; + u16 gso_max_segs; + + struct device dev; + void *priv; + unsigned net_ip_align; + + struct phy_device *phydev; + + int group; + + void *lx_nic_device; /* our own Nic_device */ +}; + + +struct netdev_hw_addr +{ + struct list_head list; + unsigned char addr[MAX_ADDR_LEN]; +}; + +enum netdev_state_t { + __LINK_STATE_START, + __LINK_STATE_PRESENT, + __LINK_STATE_NOCARRIER, + __LINK_STATE_LINKWATCH_PENDING, + __LINK_STATE_DORMANT, +}; + +#define netif_msg_tx_err(p) ({ printk("netif_msg_tx_err called not implemented\n"); 0; }) +#define netif_msg_rx_err(p) ({ printk("netif_msg_rx_err called not implemented\n"); 0; }) +#define netif_msg_tx_queued(p) ({ printk("netif_msg_tx_queued called not implemented\n"); 0; }) + +u32 netif_msg_init(int, int); + +static inline void *netdev_priv(const struct net_device *dev) { return dev->priv; } + +int netif_running(const struct net_device *); +int netif_carrier_ok(const struct net_device *dev); +int netif_device_present(struct net_device *); + +void netif_carrier_on(struct net_device *dev); +void netif_carrier_off(struct net_device *dev); + +void netif_device_detach(struct net_device *); +void netif_start_queue(struct net_device *); +void netif_stop_queue(struct net_device *); +void netif_wake_queue(struct net_device *); +void netif_device_attach(struct net_device *); +int dev_addr_init(struct net_device *dev); +void dev_uc_init(struct net_device *dev); +void dev_mc_init(struct net_device *dev); +void free_netdev(struct net_device *); +int netif_rx(struct sk_buff *); +int netif_rx_ni(struct sk_buff *skb); +int netif_receive_skb(struct sk_buff *skb); +void netif_tx_start_queue(struct netdev_queue *dev_queue); +void netif_tx_stop_queue(struct netdev_queue *dev_queue); +void netif_tx_start_all_queues(struct net_device *dev); +void netif_tx_stop_all_queues(struct net_device *dev); +void netif_tx_wake_all_queues(struct net_device *); +void __netif_tx_lock_bh(struct netdev_queue *txq); +void __netif_tx_unlock_bh(struct netdev_queue *txq); +void netif_start_subqueue(struct net_device *dev, u16 queue_index); +void netif_stop_subqueue(struct net_device *dev, u16 queue_index); +void netif_wake_subqueue(struct net_device *dev, u16 queue_index); +bool netif_dormant(const struct net_device *dev); +netdev_features_t netif_skb_features(struct sk_buff *skb); +bool netif_supports_nofcs(struct net_device *dev); +bool netif_xmit_frozen_or_stopped(const struct netdev_queue *dev_queue); + +static inline void netif_addr_lock_bh(struct net_device *dev) { } +static inline void netif_addr_unlock_bh(struct net_device *dev) { } + +void netdev_set_default_ethtool_ops(struct net_device *dev, const struct ethtool_ops *ops); +int netdev_mc_empty(struct net_device *); +unsigned netdev_mc_count(struct net_device * dev); +int register_netdev(struct net_device *); +void unregister_netdev(struct net_device *); +void netdev_rx_csum_fault(struct net_device *dev); +void netdev_run_todo(void); +int register_netdevice(struct net_device *dev); +void unregister_netdevice_many(struct list_head *head); +void unregister_netdevice_queue(struct net_device *dev, struct list_head *head); +static inline void unregister_netdevice(struct net_device *dev) +{ + unregister_netdevice_queue(dev, NULL); +} +struct net_device *netdev_master_upper_dev_get(struct net_device *dev); +void netdev_state_change(struct net_device *dev); +int call_netdevice_notifiers(unsigned long val, struct net_device *dev); +struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name, void (*setup)(struct net_device *), unsigned int txqs, unsigned int rxqs); +struct netdev_notifier_info; +struct net_device * netdev_notifier_info_to_dev(struct netdev_notifier_info *info); +int register_netdevice_notifier(struct notifier_block *nb); +int unregister_netdevice_notifier(struct notifier_block *nb); +struct netdev_queue *netdev_get_tx_queue(const struct net_device *dev, unsigned int index); +u16 netdev_cap_txqueue(struct net_device *dev, u16 queue_index); + +static inline bool netdev_uses_dsa_tags(struct net_device *dev) { return false; } +static inline bool netdev_uses_trailer_tags(struct net_device *dev) { return false; } +int __init netdev_boot_setup(char *str); + +void synchronize_net(void); + +void ether_setup(struct net_device *dev); + +void dev_put(struct net_device *dev); +void dev_hold(struct net_device *dev); +struct net_device *__dev_get_by_index(struct net *net, int ifindex); +struct net_device *__dev_get_by_name(struct net *net, const char *name); +struct net_device *dev_get_by_index(struct net *net, int ifindex); +struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex); +struct net_device *dev_get_by_name(struct net *net, const char *name); +struct net_device *dev_get_by_name_rcu(struct net *net, const char *name); +int dev_queue_xmit(struct sk_buff *skb); +struct netdev_phys_port_id; +int dev_get_phys_port_id(struct net_device *dev, struct netdev_phys_port_id *ppid); +unsigned int dev_get_flags(const struct net_device *); +struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev, struct rtnl_link_stats64 *storage); +int dev_change_net_namespace(struct net_device *, struct net *, const char *); +int dev_alloc_name(struct net_device *dev, const char *name); +int dev_close(struct net_device *dev); +int dev_set_mac_address(struct net_device *, struct sockaddr *); +int dev_set_mtu(struct net_device *, int); +int dev_set_promiscuity(struct net_device *dev, int inc); +int dev_set_allmulti(struct net_device *dev, int inc); +void dev_set_group(struct net_device *, int); +int dev_change_name(struct net_device *, const char *); +int dev_set_alias(struct net_device *, const char *, size_t); +int __dev_change_flags(struct net_device *, unsigned int flags); +void __dev_notify_flags(struct net_device *, unsigned int old_flags, unsigned int gchanges); +int dev_change_flags(struct net_device *, unsigned int); +int dev_change_carrier(struct net_device *, bool new_carrier); +void dev_net_set(struct net_device *dev, struct net *net); +struct packet_type; +void dev_add_pack(struct packet_type *pt); +void __dev_remove_pack(struct packet_type *pt); +void dev_remove_pack(struct packet_type *pt); +bool dev_xmit_complete(int rc); +int dev_hard_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, const void *daddr, const void *saddr, unsigned int len); +int dev_parse_header(const struct sk_buff *skb, unsigned char *haddr); +void dev_set_uevent_suppress(struct device *dev, int val); + +int dev_uc_add(struct net_device *dev, const unsigned char *addr); +int dev_uc_add_excl(struct net_device *dev, const unsigned char *addr); +int dev_uc_del(struct net_device *dev, const unsigned char *addr); +int dev_mc_add(struct net_device *dev, const unsigned char *addr); +int dev_mc_add_excl(struct net_device *dev, const unsigned char *addr); +int dev_mc_del(struct net_device *dev, const unsigned char *addr); + +enum { + LL_MAX_HEADER = 96, /* XXX check CONFIG_WLAN_MESH */ +}; + +struct hh_cache +{ + u16 hh_len; + u16 __pad; + seqlock_t hh_lock; + + /* cached hardware header; allow for machine alignment needs. */ +#define HH_DATA_MOD 16 +#define HH_DATA_OFF(__len) \ + (HH_DATA_MOD - (((__len - 1) & (HH_DATA_MOD - 1)) + 1)) +#define HH_DATA_ALIGN(__len) \ + (((__len)+(HH_DATA_MOD-1))&~(HH_DATA_MOD - 1)) + unsigned long hh_data[HH_DATA_ALIGN(LL_MAX_HEADER) / sizeof(long)]; + +}; + +extern rwlock_t dev_base_lock; + +#define for_each_netdev(net, d) \ + list_for_each_entry(d, &(net)->dev_base_head, dev_list) +#define for_each_netdev_rcu(net, d) \ + list_for_each_entry_rcu(d, &(net)->dev_base_head, dev_list) + +#define net_device_entry(lh) list_entry(lh, struct net_device, dev_list) + +static inline struct net_device *first_net_device(struct net *net) +{ + return list_empty(&net->dev_base_head) ? NULL : + net_device_entry(net->dev_base_head.next); +} + +#define NAPI_GRO_CB(skb) ((struct napi_gro_cb *)(skb)->cb) + +enum { + NAPI_GRO_FREE = 1, + NAPI_GRO_FREE_STOLEN_HEAD = 2, +}; + +struct napi_gro_cb +{ + u16 count; + u8 same_flow; + u8 free; + struct sk_buff *last; +}; + +struct neighbour; + +struct header_ops { + int (*create) (struct sk_buff *skb, struct net_device *dev, + unsigned short type, const void *daddr, + const void *saddr, unsigned int len); + int (*parse)(const struct sk_buff *skb, unsigned char *haddr); + int (*rebuild)(struct sk_buff *skb); + int (*cache)(const struct neighbour *neigh, struct hh_cache *hh, __be16 type); + void (*cache_update)(struct hh_cache *hh, + const struct net_device *dev, + const unsigned char *haddr); +}; + +extern struct kobj_ns_type_operations net_ns_type_operations; + +enum skb_free_reason { + SKB_REASON_CONSUMED, + SKB_REASON_DROPPED, +}; + +void consume_skb(struct sk_buff *skb); +unsigned int skb_gro_offset(const struct sk_buff *skb); +unsigned int skb_gro_len(const struct sk_buff *skb); +__be16 skb_network_protocol(struct sk_buff *skb, int *depth); +bool can_checksum_protocol(netdev_features_t features, __be16 protocol); + +/* XXX dev_kfree_skb_any */ +static inline void dev_kfree_skb_any(struct sk_buff *skb) +{ + dev_dbg(0, "%s called\n", __func__); + /* __dev_kfree_skb_any(skb, SKB_REASON_DROPPED); */ + consume_skb(skb); +} + +struct packet_type +{ + __be16 type; /* This is really htons(ether_type). */ + struct net_device *dev; /* NULL is wildcarded here */ + int (*func) (struct sk_buff *, + struct net_device *, + struct packet_type *, + struct net_device *); + bool (*id_match)(struct packet_type *ptype, + struct sock *sk); + void *af_packet_priv; + struct list_head list; +}; + +enum { + MAX_PHYS_PORT_ID_LEN = 32, +}; + +struct netdev_phys_port_id { + unsigned char id[MAX_PHYS_PORT_ID_LEN]; + unsigned char id_len; +}; + +/* XXX */ size_t LL_RESERVED_SPACE(struct net_device*); + +bool net_gso_ok(netdev_features_t features, int gso_type); +void net_enable_timestamp(void); +void net_disable_timestamp(void); +void txq_trans_update(struct netdev_queue *txq); +int __hw_addr_sync(struct netdev_hw_addr_list *to_list, struct netdev_hw_addr_list *from_list, int addr_len); +void __hw_addr_unsync(struct netdev_hw_addr_list *to_list, struct netdev_hw_addr_list *from_list, int addr_len); +void __hw_addr_init(struct netdev_hw_addr_list *list); + + +/************************* + ** linux/percpu-defs.h ** + *************************/ + +#define DECLARE_PER_CPU_ALIGNED(type, name) \ + extern typeof(type) name + +#define DEFINE_PER_CPU_ALIGNED(type, name) \ + typeof(type) name + +#define DEFINE_PER_CPU(type, name) \ + typeof(type) name + +#define EXPORT_PER_CPU_SYMBOL(x) + + +/********************* + ** linux/lockdep.h ** + *********************/ + +#include + + +/************************* + ** linux/etherdevice.h ** + *************************/ + +static inline bool is_unicast_ether_addr(const u8 *addr) { + return !(0x01 & addr[0]); } + +static inline bool is_zero_ether_addr(const u8 *addr) +{ + return !(addr[0] | addr[1] | addr[2] | addr[3] | addr[4] | addr[5]); +} + +/* Reserved Ethernet Addresses per IEEE 802.1Q */ +static const u8 eth_reserved_addr_base[ETH_ALEN] __aligned(2) = +{ 0x01, 0x80, 0xc2, 0x00, 0x00, 0x00 }; + +static inline bool is_link_local_ether_addr(const u8 *addr) +{ + __be16 *a = (__be16 *)addr; + static const __be16 *b = (const __be16 *)eth_reserved_addr_base; + static const __be16 m = cpu_to_be16(0xfff0); + + return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | ((a[2] ^ b[2]) & m)) == 0; +} + + +/****************** + ** linux/wait.h ** + ******************/ + +typedef struct wait_queue_head { void *list; } wait_queue_head_t; +typedef struct wait_queue { } wait_queue_t; + +#define DEFINE_WAIT(name) \ + wait_queue_t name; + +#define __WAIT_QUEUE_HEAD_INITIALIZER(name) { 0 } + +#define DECLARE_WAITQUEUE(name, tsk) \ + wait_queue_t name + +#define DECLARE_WAIT_QUEUE_HEAD(name) \ + wait_queue_head_t name = __WAIT_QUEUE_HEAD_INITIALIZER(name) + +#define DEFINE_WAIT_FUNC(name, function) \ + wait_queue_t name + +/* simplified signature */ +void __wake_up(wait_queue_head_t *q, bool all); + +#define wake_up(x) __wake_up(x, false) +#define wake_up_all(x) __wake_up(x, true) +#define wake_up_interruptible(x) __wake_up(x, false) +#define wake_up_interruptible_all(x) __wake_up(x, true) + +void init_waitqueue_head(wait_queue_head_t *); +int waitqueue_active(wait_queue_head_t *); + +/* void wake_up_interruptible(wait_queue_head_t *); */ +void wake_up_interruptible_sync_poll(wait_queue_head_t *, int); +void wake_up_interruptible_poll(wait_queue_head_t *, int); + +void prepare_to_wait(wait_queue_head_t *, wait_queue_t *, int); +void prepare_to_wait_exclusive(wait_queue_head_t *, wait_queue_t *, int); +void finish_wait(wait_queue_head_t *, wait_queue_t *); + +int autoremove_wake_function(wait_queue_t *, unsigned, int, void *); +void add_wait_queue(wait_queue_head_t *, wait_queue_t *); +void add_wait_queue_exclusive(wait_queue_head_t *, wait_queue_t *); +void remove_wait_queue(wait_queue_head_t *, wait_queue_t *); + +/* our wait event implementation - it's okay as value */ +void __wait_event(wait_queue_head_t); + +#define _wait_event(wq, condition) while (!(condition)) { __wait_event(wq); } +#define wait_event(wq, condition) ({ _wait_event(wq, condition); }) +#define wait_event_interruptible(wq, condition) ({ _wait_event(wq, condition); 0; }) + +#define _wait_event_timeout(wq, condition, timeout) \ + ({ int res = 1; \ + prepare_to_wait(&wq, 0, 0); \ + while (1) { \ + if ((condition) || !res) { \ + break; \ + } \ + res = schedule_timeout(jiffies + timeout); \ + } \ + finish_wait(&wq, 0); \ + res; \ + }) + +#define wait_event_timeout(wq, condition, timeout) \ + ({ \ + int ret = _wait_event_timeout(wq, (condition), timeout); \ + ret; \ + }) + + +/************************ + ** linux/capability.h ** + ************************/ + +enum { + CAP_NET_ADMIN = 12, + CAP_NET_RAW = 13, + CAP_SYS_ADMIN = 21, +}; + +bool capable(int cap); +bool ns_capable(struct user_namespace *ns, int cap); + + +/****************** + ** linux/stat.h ** + ******************/ + +#define S_IFMT 00170000 +#define S_IFSOCK 0140000 + +#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) + +#define S_IRUGO 00444 +#define S_IWUSR 00200 +#define S_IRUSR 00400 + + +/**************** + ** linux/fs.h ** + ****************/ + +struct fown_struct { }; + +struct file { + unsigned int f_flags; + const struct cred *f_cred; + struct fown_struct f_owner; + void *private_data; +}; + +typedef unsigned fl_owner_t; + +struct inode; + +struct inode *file_inode(struct file *f); + +struct file_operations { + struct module *owner; + int (*open) (struct inode *, struct file *); + ssize_t (*read) (struct file *, char __user *, size_t, loff_t *); + loff_t (*llseek) (struct file *, loff_t, int); + unsigned int (*poll) (struct file *, struct poll_table_struct *); + long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); + int (*flush) (struct file *, fl_owner_t id); + int (*release) (struct inode *, struct file *); + ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *); + int (*fasync) (int, struct file *, int); +}; + +static inline loff_t no_llseek(struct file *file, loff_t offset, int origin) { + return -ESPIPE; } +int nonseekable_open(struct inode * inode, struct file * filp); + +struct inode +{ + umode_t i_mode; + kuid_t i_uid; + unsigned long i_ino; +}; + +int send_sigurg(struct fown_struct *fown); + + +/************************* + ** asm-generic/fcntl.h ** + *************************/ + +enum { O_NONBLOCK = 0x4000 }; + + +/***************************** + ** linux/platform_device.h ** + *****************************/ + +struct platform_device { + char * name; + int id; + + struct device dev; + + u32 num_resources; + struct resource * resource; + +}; + +/* needed by net/rfkill/rfkill-gpio.c */ +struct platform_driver { + int (*probe)(struct platform_device *); + int (*remove)(struct platform_device *); + struct device_driver driver; +}; + +void *platform_get_drvdata(const struct platform_device *pdev); +void platform_set_drvdata(struct platform_device *pdev, void *data); +struct platform_device *platform_device_register_simple( const char *name, int id, const struct resource *res, unsigned int num); +void platform_device_unregister(struct platform_device *); + +#define module_platform_driver(x) + + +/************************ + ** linux/tracepoint.h ** + ************************/ + +#define DECLARE_EVENT_CLASS(name, proto, args, tstruct, assign, print) +#define DEFINE_EVENT(template, name, proto, args) \ + static inline void trace_##name(proto) { } +#define TRACE_EVENT(name, proto, args, struct, assign, print) \ + static inline void trace_##name(proto) { } + +/* needed by drivers/net/wireless/iwlwifi/iwl-devtrace.h */ +#define TP_PROTO(args...) args + + +/******************** + ** linux/dcache.h ** + ********************/ + +struct qstr { + const unsigned char *name; +}; + +struct dentry { + struct inode *d_inode; + struct qstr d_name; + struct list_head d_subdirs; + spinlock_t d_lock; + struct dentry *d_parent; + union { struct list_head d_child; } d_u; +}; + + +/********************* + ** linux/utsname.h ** + *********************/ + +#define __NEW_UTS_LEN 64 + +struct new_utsname { + char sysname[__NEW_UTS_LEN + 1]; + char release[__NEW_UTS_LEN + 1]; +}; + +struct new_utsname *init_utsname(void); +struct new_utsname *utsname(void); + + +/*************************** + ** linux/dma-direction.h ** + ***************************/ + +enum dma_data_direction +{ + DMA_BIDIRECTIONAL = 0, + DMA_TO_DEVICE = 1, + DMA_FROM_DEVICE = 2 +}; + + +/************************************** + ** asm-generic/dma-mapping-common.h ** + **************************************/ + +dma_addr_t dma_map_page(struct device *dev, struct page *page, size_t offset, size_t size, enum dma_data_direction dir); +void dma_unmap_page(struct device *dev, dma_addr_t addr, size_t size, enum dma_data_direction dir); +dma_addr_t dma_map_single(struct device *dev, void *ptr, size_t size, enum dma_data_direction dir); +void dma_unmap_single(struct device *dev, dma_addr_t addr, size_t size, enum dma_data_direction dir); + +struct scatterlist; +int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, enum dma_data_direction dir); +void dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nents, enum dma_data_direction dir); +void dma_sync_single_for_cpu(struct device *dev, dma_addr_t addr, size_t size, enum dma_data_direction dir); +void dma_sync_single_for_device(struct device *dev, dma_addr_t addr, size_t size, enum dma_data_direction dir); +void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems, enum dma_data_direction dir); +void dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems, enum dma_data_direction dir); + + +/*********************** + ** asm/dma-mapping.h ** + ***********************/ + +int dma_supported(struct device *hwdev, u64 mask); +int dma_set_mask(struct device *dev, u64 mask); +int dma_mapping_error(struct device *dev, dma_addr_t dma_addr); +void *dma_alloc_coherent(struct device *, size_t size, dma_addr_t *dma, gfp_t); +void dma_free_coherent(struct device *, size_t size, void *vaddr, dma_addr_t bus); + + +/************************* + ** linux/dma-mapping.h ** + *************************/ + +#define DEFINE_DMA_UNMAP_ADDR(ADDR_NAME) dma_addr_t ADDR_NAME +#define DEFINE_DMA_UNMAP_LEN(LEN_NAME) u32 LEN_NAME +#define dma_unmap_addr(PTR, ADDR_NAME) ((PTR)->ADDR_NAME) +#define dma_unmap_addr_set(PTR, ADDR_NAME, VAL) (((PTR)->ADDR_NAME) = (VAL)) +#define dma_unmap_len(PTR, LEN_NAME) ((PTR)->LEN_NAME) +#define dma_unmap_len_set(PTR, LEN_NAME, VAL) (((PTR)->LEN_NAME) = (VAL)) + +#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1)) + +int dma_set_coherent_mask(struct device *dev, u64 mask); +void *dma_zalloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t flag); + + +/************************ + ** linux/completion.h ** + ************************/ + +struct completion { unsigned done; }; + +void complete(struct completion *); +void complete_all(struct completion *); +void init_completion(struct completion *x); +unsigned long wait_for_completion_timeout(struct completion *x, unsigned long timeout); +void wait_for_completion(struct completion *x); +int wait_for_completion_interruptible(struct completion *x); +long wait_for_completion_interruptible_timeout(struct completion *x, unsigned long timeout); + + +/********************** + ** linux/firmware.h ** + **********************/ + +struct firmware { + size_t size; + const u8 *data; + struct page **pages; + + void *priv; +}; + +int request_firmware(const struct firmware **fw, const char *name, struct device *device); +void release_firmware(const struct firmware *fw); +int request_firmware_nowait( struct module *module, bool uevent, const char *name, struct device *device, gfp_t gfp, void *context, void (*cont)(const struct firmware *fw, void *context)); + + +/*********************** + ** linux/irqreturn.h ** + ***********************/ + +typedef enum irqreturn { + IRQ_NONE = 0, + IRQ_HANDLED = 1, + IRQ_WAKE_THREAD = 2, +} irqreturn_t; + + +/******************** + ** linux/ioport.h ** + ********************/ + +#define IORESOURCE_IO 0x00000100 +#define IORESOURCE_MEM 0x00000200 +#define IORESOURCE_IRQ 0x00000400 + +struct resource +{ + resource_size_t start; + resource_size_t end; + const char *name; + unsigned long flags; +}; + + +/*********************** + ** linux/interrupt.h ** + ***********************/ + +enum { + NET_TX_SOFTIRQ, + NET_RX_SOFTIRQ, + NET_SOFTIRQS, +}; + +#define IRQF_SHARED 0x00000080 +/* #define IRQF_DISABLED 0x00000020 */ + +/* void local_irq_enable(void); */ +/* void local_irq_disable(void); */ + +typedef irqreturn_t (*irq_handler_t)(int, void *); + +int request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags, const char *name, void *dev); +void free_irq(unsigned int, void *); +int request_threaded_irq(unsigned int irq, irq_handler_t handler, irq_handler_t thread_fn, unsigned long flags, const char *name, void *dev); + +void tasklet_disable(struct tasklet_struct *t); +void tasklet_enable(struct tasklet_struct *t); + + +/***************** + ** linux/pci.h ** + *****************/ + +#include +#include + +enum { + PCI_DMA_BIDIRECTIONAL = 0, + PCI_DMA_TODEVICE, + PCI_DMA_FROMDEVICE, + PCI_DMA_NONE +}; + + +enum { PCI_ANY_ID = ~0U }; +enum { DEVICE_COUNT_RESOURCE = 6 }; + + +typedef enum { + PCI_D3cold = 4 +} pci_power_t; + + +#include + +/* + * PCI types + */ +struct pci_bus; + +struct pci_dev { + unsigned int devfn; + unsigned int irq; + struct resource resource[DEVICE_COUNT_RESOURCE]; + struct pci_bus *bus; + unsigned short vendor; + unsigned short device; + unsigned short subsystem_device; + unsigned int class; + struct device dev; + u8 revision; + u8 pcie_cap; + u16 pcie_flags_reg; +}; + +struct pci_driver { + char *name; + const struct pci_device_id *id_table; + int (*probe) (struct pci_dev *dev, + const struct pci_device_id *id); + void (*remove) (struct pci_dev *dev); + struct device_driver driver; +}; + + +static inline uint32_t PCI_DEVFN(unsigned slot, unsigned func) { +return ((slot & 0x1f) << 3) | (func & 0x07); } + +int pci_bus_read_config_byte(struct pci_bus *bus, unsigned int devfn, int where, u8 *val); +int pci_bus_read_config_word(struct pci_bus *bus, unsigned int devfn, int where, u16 *val); +int pci_bus_read_config_dword(struct pci_bus *bus, unsigned int devfn, int where, u32 *val); +int pci_bus_write_config_byte(struct pci_bus *bus, unsigned int devfn, int where, u8 val); +int pci_bus_write_config_word(struct pci_bus *bus, unsigned int devfn, int where, u16 val); +int pci_bus_write_config_dword(struct pci_bus *bus, unsigned int devfn, int where, u32 val); + +static inline +int pci_read_config_byte(struct pci_dev *dev, int where, u8 *val) { +return pci_bus_read_config_byte(dev->bus, dev->devfn, where, val); } + +static inline +int pci_read_config_word(struct pci_dev *dev, int where, u16 *val) { +return pci_bus_read_config_word(dev->bus, dev->devfn, where, val); } + +static inline +int pci_read_config_dword(struct pci_dev *dev, int where, u32 *val) { +return pci_bus_read_config_dword(dev->bus, dev->devfn, where, val); } + +static inline +int pci_write_config_byte(struct pci_dev *dev, int where, u8 val) { +return pci_bus_write_config_byte(dev->bus, dev->devfn, where, val); } + +static inline +int pci_write_config_word(struct pci_dev *dev, int where, u16 val) { +return pci_bus_write_config_word(dev->bus, dev->devfn, where, val); } + +static inline +int pci_write_config_dword(struct pci_dev *dev, int where, u32 val) { +return pci_bus_write_config_dword(dev->bus, dev->devfn, where, val); } + +size_t pci_resource_len(struct pci_dev *dev, unsigned bar); +size_t pci_resource_start(struct pci_dev *dev, unsigned bar); +void pci_dev_put(struct pci_dev *dev); +struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device, struct pci_dev *from); + +int pci_enable_device(struct pci_dev *dev); +void pci_disable_device(struct pci_dev *dev); +int pci_register_driver(struct pci_driver *driver); +void pci_unregister_driver(struct pci_driver *driver); +const char *pci_name(const struct pci_dev *pdev); +bool pci_dev_run_wake(struct pci_dev *dev); +unsigned int pci_resource_flags(struct pci_dev *dev, unsigned bar); +void pci_set_master(struct pci_dev *dev); +int pci_set_mwi(struct pci_dev *dev); +bool pci_pme_capable(struct pci_dev *dev, pci_power_t state); +int pci_find_capability(struct pci_dev *dev, int cap); +struct pci_dev *pci_get_slot(struct pci_bus *bus, unsigned int devfn); +const struct pci_device_id *pci_match_id(const struct pci_device_id *ids, struct pci_dev *dev); +int pci_request_regions(struct pci_dev *dev, const char *res_name); +void pci_release_regions(struct pci_dev *dev); +void *pci_ioremap_bar(struct pci_dev *pdev, int bar); +void pci_disable_link_state(struct pci_dev *pdev, int state); + +int pci_enable_msi(struct pci_dev *dev); +void pci_disable_msi(struct pci_dev *dev); + +#define DEFINE_PCI_DEVICE_TABLE(_table) \ + const struct pci_device_id _table[] __devinitconst + +#define to_pci_dev(n) container_of(n, struct pci_dev, dev) + +int pci_register_driver(struct pci_driver *driver); + +int pcie_capability_read_word(struct pci_dev *dev, int pos, u16 *val); + +static inline void *pci_get_drvdata(struct pci_dev *pdev) +{ + return dev_get_drvdata(&pdev->dev); +} + +static inline void pci_set_drvdata(struct pci_dev *pdev, void *data) +{ + dev_set_drvdata(&pdev->dev, data); +} + +#define dev_is_pci(d) (1) + +int pci_num_vf(struct pci_dev *dev); + +/* XXX will this cast ever work? */ +#define dev_num_vf(d) ((dev_is_pci(d) ? pci_num_vf((struct pci_dev *)d) : 0)) + +#include + + +/********************** + ** linux/pci-aspm.h ** + **********************/ + +#define PCIE_LINK_STATE_L0S 1 +#define PCIE_LINK_STATE_L1 2 +#define PCIE_LINK_STATE_CLKPM 4 + + + /****************** + ** linux/kmod.h ** + ******************/ + +int __request_module(bool wait, const char *name, ...); +int request_module(const char *name, ...); +#define try_then_request_module(x, mod...) \ + ((x) ?: (__request_module(true, mod), (x))) + + + /***************** + ** linux/err.h ** + *****************/ + +#define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO) + +static inline bool IS_ERR(void const *ptr) { + return (unsigned long)(ptr) > (unsigned long)(-1000); } + +static inline void * ERR_PTR(long error) { + return (void *) error; } + +static inline void * ERR_CAST(const void *ptr) { + return (void *) ptr; } + +static inline long IS_ERR_OR_NULL(const void *ptr) { + return !ptr || IS_ERR_VALUE((unsigned long)ptr); } + +static inline long PTR_ERR(const void *ptr) { return (long) ptr; } + + +/***************** +** linux/uio.h ** +*****************/ + +enum { UIO_MAXIOV = 1024 }; + +struct iovec +{ + void *iov_base; + __kernel_size_t iov_len; +}; + +struct kvec +{ + void *iov_base; + size_t iov_len; +}; + +static inline size_t iov_length(const struct iovec *iov, unsigned long nr_segs) +{ + unsigned long seg; + size_t ret = 0; + + for (seg = 0; seg < nr_segs; seg++) + ret += iov[seg].iov_len; + return ret; +} + +int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len); +int memcpy_toiovec(struct iovec *iov, unsigned char *kdata, int len); + + +/********************** + ** asm-generic/io.h ** + **********************/ + +#define mmiowb() do { } while (0) + +void *ioremap(resource_size_t offset, unsigned long size); +void iounmap(volatile void *addr); +void *devm_ioremap(struct device *dev, resource_size_t offset, + unsigned long size); +void *devm_ioremap_nocache(struct device *dev, resource_size_t offset, + unsigned long size); + + +/** + * Map I/O memory write combined + */ +void *ioremap_wc(resource_size_t phys_addr, unsigned long size); + +#define ioremap_nocache ioremap + +void *phys_to_virt(unsigned long address); + +#define writel(value, addr) (*(volatile uint32_t *)(addr) = (value)) +#define writeb(value, addr) (*(volatile uint8_t *)(addr) = (value)) +#define readl(addr) (*(volatile uint32_t *)(addr)) +#define readb(addr) (*(volatile uint8_t *)(addr)) + + +/********************* + ** linux/if_vlan.h ** + *********************/ + +enum { + VLAN_HLEN = 4, + VLAN_PRIO_SHIFT = 13, + VLAN_PRIO_MASK = 0xe000, +}; + +struct vlan_hdr +{ + __be16 h_vlan_encapsulated_proto; +}; + + struct vlan_ethhdr +{ + __be16 h_vlan_encapsulated_proto; +}; + +static inline struct net_device *vlan_dev_real_dev(const struct net_device *dev) { return NULL; } + +#define vlan_tx_tag_get(__skb) 0 +struct sk_buff *__vlan_put_tag(struct sk_buff *, u16, u16); +struct sk_buff *vlan_untag(struct sk_buff *); +int is_vlan_dev(struct net_device *); +u16 vlan_tx_tag_present(struct sk_buff *); +bool vlan_do_receive(struct sk_buff **); +bool vlan_tx_nonzero_tag_present(struct sk_buff *); + + +/******************** + ** linux/percpu.h ** + ********************/ + +void *__alloc_percpu(size_t size, size_t align); + +#define alloc_percpu(type) \ + (typeof(type) __percpu *)__alloc_percpu(sizeof(type), __alignof__(type)) + + +#define per_cpu(var, cpu) var +#define per_cpu_ptr(ptr, cpu) ({ (void)(cpu);(typeof(*(ptr)) *)(ptr); }) +#define __get_cpu_var(var) var + +#define this_cpu_inc(pcp) pcp += 1 +#define this_cpu_dec(pcp) pcp -= 1 + +#define __this_cpu_inc(pcp) this_cpu_inc(pcp) +#define __this_cpu_dec(pcp) this_cpu_dec(pcp) + + +/********************* + ** linux/hrtimer.h ** + *********************/ + +struct hrtimer { }; + + +/******************* + ** asm/current.h ** + *******************/ + +extern struct task_struct *current; + + +/************************* + ** linux/res_counter.h ** + *************************/ + +enum { RES_USAGE }; + +struct res_counter { }; + +int res_counter_charge_nofail(struct res_counter *counter, unsigned long val, struct res_counter **limit_fail_at); +u64 res_counter_uncharge(struct res_counter *counter, unsigned long val); +u64 res_counter_read_u64(struct res_counter *counter, int member); + +/************************ + ** linux/memcontrol.h ** + ************************/ + +struct mem_cgroup; + +enum { UNDER_LIMIT, SOFT_LIMIT, OVER_LIMIT }; + +void sock_update_memcg(struct sock *sk); + + +/********************** + ** linux/mm-types.h ** + **********************/ + +struct page_frag +{ + struct page *page; + __u16 offset; + __u16 size; +}; + + +/******************* + ** linux/sched.h ** + *******************/ + +enum { + PF_MEMALLOC = 0x800, + + MAX_SCHEDULE_TIMEOUT = 1000, +}; + +enum { + TASK_RUNNING = 0, + TASK_INTERRUPTIBLE = 1, + TASK_UNINTERRUPTIBLE = 2, + TASK_COMM_LEN = 16, +}; + +struct task_struct +{ + unsigned int flags; + struct page_frag task_frag; + char comm[TASK_COMM_LEN]; + struct audit_context *audit_context; +}; + +void tsk_restore_flags(struct task_struct *task, unsigned long orig_flags, unsigned long flags); +pid_t task_pid_nr(struct task_struct *tsk); +pid_t task_tgid_vnr(struct task_struct *tsk); + +void set_current_state(int); +void __set_current_state(int); + +void schedule(void); +void yield(void); +int signal_pending(struct task_struct *p); +signed long schedule_timeout(signed long timeout); +bool need_resched(void); +int cond_resched(void); +int cond_resched_softirq(void); + + +/************************ + ** uapi/linux/sched.h ** + ************************/ + +enum { + CLONE_NEWNET = 0x40000000, +}; + + +/********************************* + ** (uapi|linux|kernel)/audit.h ** + *********************************/ + +enum { + AUDIT_ANOM_PROMISCUOUS = 1700, +}; + +extern int audit_enabled; + + +/****************** + ** linux/cred.h ** + ******************/ + +struct cred +{ + struct user_namespace *user_ns; + kuid_t euid; + kgid_t egid; +}; + +extern struct user_namespace init_user_ns; + +static inline void current_uid_gid(kuid_t *u, kgid_t *g) +{ + *u = 0; + *g =0; +} + + +extern struct user_namespace init_user_ns; +#define current_user_ns() (&init_user_ns) + +void put_cred(const struct cred *_cred); + + +/******************** + ** net/if_inet6.h ** + ********************/ + +struct inet6_dev; + + +/********************* + ** uapi/linux/in.h ** + *********************/ + +enum { + IPPROTO_TCP = 6, + IPPROTO_UDP = 17, + IPPROTO_AH = 51, +}; + + +/********************** + ** uapi/linux/in6.h ** + **********************/ + +enum { + IPPROTO_HOPOPTS = 0, + IPPROTO_ROUTING = 43, + IPPROTO_FRAGMENT = 44, + IPPROTO_DSTOPTS = 60, +}; + +struct in6_addr +{ +}; + + +/**************** + ** net/ipv6.h ** + ****************/ + +enum { + IP6_MF = 0x0001, + IP6_OFFSET = 0xfff8, +}; + + +/********************* + ** uapi/linux/ip.h ** + *********************/ + +enum { + IP_OFFSET = 0x1FFF, + IP_MF = 0x2000, +}; + +struct iphdr { + __u8 ihl:4, + version:4; + __u8 tos; + __be16 tot_len; + __be16 frag_off; + __u8 ttl; + __u8 protocol; + __sum16 check; + __be32 saddr; + __be32 daddr; +}; + +struct iphdr *ip_hdr(const struct sk_buff *skb); + +struct ip_auth_hdr +{ + __u8 nexthdr; + __u8 hdrlen; +}; + + +/*********************** + ** uapi/linux/ipv6.h ** + ***********************/ + +struct ipv6hdr +{ + __be16 payload_len; + __u8 nexthdr; + struct in6_addr saddr; + struct in6_addr daddr; + +}; + +struct ipv6hdr *ipv6_hdr(const struct sk_buff *skb); + +struct ipv6_opt_hdr +{ + __u8 nexthdr; + __u8 hdrlen; +} __attribute__((packed)); + +struct frag_hdr +{ + __u8 nexthdr; + /* __u8 reserved; */ + __be16 frag_off; + /* __be32 identification; */ +}; + + +/****************** + ** linux/ipv6.h ** + ******************/ + +#define ipv6_optlen(p) (((p)->hdrlen+1) << 3) +#define ipv6_authlen(p) (((p)->hdrlen+2) << 2) + + +/*************** + ** net/tcp.h ** + ***************/ + +__sum16 tcp_v4_check(int len, __be32 saddr, __be32 daddr, __wsum base); + + +/********************** + ** uapi/linux/tcp.h ** + **********************/ + +struct tcphdr +{ + __be16 source; + __be16 dest; + __be32 seq; + __be32 ack_seq; + __u16 res1:4, + doff:4, + fin:1, + syn:1, + rst:1, + psh:1, + ack:1, + urg:1, + ece:1, + cwr:1; + + __be16 window; + __sum16 check; +}; + +struct tcphdr *tcp_hdr(const struct sk_buff *skb); + + +/***************** + ** linux/tcp.h ** + *****************/ + +unsigned int tcp_hdrlen(const struct sk_buff *skb); + + +/********************** + ** uapi/linux/udp.h ** + **********************/ + +struct udphdr +{ + __sum16 check; +}; + +struct udphdr *udp_hdr(const struct sk_buff *skb); + + +/***************** + ** linux/cpu.h ** + *****************/ + +enum { + CPU_DEAD = 0x7, + CPU_TASKS_FROZEN = 0x10, + CPU_DEAD_FROZEN = CPU_DEAD | CPU_TASKS_FROZEN, +}; + + +/********************* + ** linux/cpumask.h ** + *********************/ + +extern const struct cpumask *const cpu_possible_mask; + +#define nr_cpu_ids 1 + +#define for_each_cpu(cpu, mask) \ +for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask) + +#define for_each_possible_cpu(cpu) for_each_cpu((cpu), cpu_possible_mask) +#define hotcpu_notifier(fn, pri) + + +/************************ + ** linux/jump_label.h ** + ************************/ + +struct static_key { }; + +#define STATIC_KEY_INIT_FALSE ((struct static_key) {}) + +bool static_key_false(struct static_key *key); +void static_key_slow_inc(struct static_key *key); +void static_key_slow_dec(struct static_key *key); + + +/*********************** + ** linux/pipe_fs_i.h ** + ***********************/ + +struct pipe_buffer +{ + struct page *page; +}; + +struct pipe_inode_info; + +struct pipe_buf_operations +{ + int can_merge; + void * (*map)(struct pipe_inode_info *, struct pipe_buffer *, int); + void (*unmap)(struct pipe_inode_info *, struct pipe_buffer *, void *); + int (*confirm)(struct pipe_inode_info *, struct pipe_buffer *); + void (*release)(struct pipe_inode_info *, struct pipe_buffer *); + int (*steal)(struct pipe_inode_info *, struct pipe_buffer *); + void (*get)(struct pipe_inode_info *, struct pipe_buffer *); +}; + +void *generic_pipe_buf_map(struct pipe_inode_info *, struct pipe_buffer *, int); +void generic_pipe_buf_unmap(struct pipe_inode_info *, struct pipe_buffer *, void *); +int generic_pipe_buf_confirm(struct pipe_inode_info *, struct pipe_buffer *); + + +/******************** + ** linux/splice.h ** + ********************/ + +struct partial_page +{ +unsigned int offset; +unsigned int len; +}; + +struct splice_pipe_desc +{ + struct page **pages; + struct partial_page *partial; + int nr_pages; + unsigned int nr_pages_max; + unsigned int flags; + const struct pipe_buf_operations *ops; + void (*spd_release)(struct splice_pipe_desc *, unsigned int); +}; + +ssize_t splice_to_pipe(struct pipe_inode_info *, struct splice_pipe_desc *); + + +/************************ + ** linux/textsearch.h ** + ************************/ + +struct ts_state +{ + char cb[40]; +}; + +struct ts_config +{ + unsigned int (*get_next_block)(unsigned int consumed, + const u8 **dst, + struct ts_config *conf, + struct ts_state *state); + void (*finish)(struct ts_config *conf, + struct ts_state *state); +}; + +unsigned int textsearch_find(struct ts_config *, struct ts_state *); + + +/***************** + ** linux/aio.h ** + *****************/ + +struct kiocb +{ + void *private; +}; + + +/************************* + ** uapi/linux/filter.h ** + *************************/ + +struct sock_filter { /* Filter block */ + __u16 code; /* Actual filter code */ + __u8 jt; /* Jump true */ + __u8 jf; /* Jump false */ + __u32 k; /* Generic multiuse field */ +}; + + +/******************** + ** linux/filter.h ** + ********************/ + +struct sk_buff; +struct sock_filter; +struct sock_fprog; +struct sk_filter +{ + atomic_t refcnt; + unsigned int len; + struct rcu_head rcu; + + struct sock_filter insns[0]; +}; + +unsigned int sk_filter_size(unsigned int proglen); +int sk_filter(struct sock *, struct sk_buff *); +unsigned int sk_run_filter(const struct sk_buff *skb, + const struct sock_filter *filter); +int sk_attach_filter(struct sock_fprog *, struct sock *); +int sk_detach_filter(struct sock *); +int sk_get_filter(struct sock *, struct sock_filter *, unsigned); + +#define SK_RUN_FILTER(FILTER, SKB) sk_run_filter(SKB, FILTER->insns) + +int bpf_tell_extensions(void); + + +/************************** + ** linux/seq_file_net.h ** + **************************/ + +struct seq_net_private { + struct net *net; +}; + +struct seq_operations { }; + + +/************************** + ** linux/seq_file.h ** + **************************/ + +struct seq_file { }; + +int seq_printf(struct seq_file *, const char *, ...); + + +/******************** + ** linux/sysctl.h ** + ********************/ + +struct ctl_table; + +typedef int proc_handler (struct ctl_table *ctl, int write, + void __user *buffer, size_t *lenp, loff_t *ppos); + + +/***************** + ** linux/pid.h ** + *****************/ + +struct pid; + +pid_t pid_vnr(struct pid *pid); +void put_pid(struct pid *pid); + + +/*************************** + ** asm-generic/uaccess.h ** + ***************************/ + +enum { VERIFY_READ = 0 }; + +#define get_user(x, ptr) ({ x = *ptr; 0; }) +#define put_user(x, ptr) ({ *ptr = x; 0; }) + +static inline long copy_from_user(void *to, const void *from, unsigned long n) +{ + memcpy(to, from, n); + return 0; +} + +static inline long copy_to_user(void *to, const void *from, unsigned long n) +{ + memcpy(to, from, n); + return 0; +} + +#define access_ok(type, addr, size) __access_ok((unsigned long)(addr),(size)) + +int __access_ok(unsigned long addr, unsigned long size); + + +/********************* + ** linux/uaccess.h ** + *********************/ + +static inline unsigned long __copy_from_user_nocache(void *to, const void __user *from, unsigned long n) +{ + return copy_from_user(to, from, n); +} + + +/******************************* + ** asm-generic/scatterlist.h ** + *******************************/ + +struct scatterlist +{ + unsigned long page_link; + unsigned int offset; + unsigned int length; +}; + +void sg_set_page(struct scatterlist *sg, struct page *page, unsigned int len, unsigned int offset); +void sg_set_buf(struct scatterlist *sg, const void *buf, unsigned int buflen); +void sg_mark_end(struct scatterlist *sg); +struct scatterlist *sg_next(struct scatterlist *); +void sg_init_table(struct scatterlist *, unsigned int); +void sg_init_one(struct scatterlist *, const void *, unsigned int); + +#define sg_is_last(sg) ((sg)->page_link & 0x02) +#define sg_chain_ptr(sg) ((struct scatterlist *) ((sg)->page_link & ~0x03)) + +static inline struct page *sg_page(struct scatterlist *sg) { + return (struct page *)((sg)->page_link & ~0x3); } + + +/************** + ** net/ip.h ** + **************/ + +enum { IP_DEFRAG_AF_PACKET }; /* XXX original value is not 0 */ + +struct inet_skb_parm { }; + +unsigned int ip_hdrlen(const struct sk_buff *skb); +struct sk_buff *ip_check_defrag(struct sk_buff *skb, u32 user); + + +/******************** + ** linux/dcache.h ** + ********************/ + +unsigned int full_name_hash(const unsigned char *, unsigned int); + + +/****************** + ** linux/hash.h ** + ******************/ + +u32 hash_32(u32 val, unsigned int); + + +/******************************* + ** asm-generic/bitops/find.h ** + *******************************/ + +unsigned long find_next_bit(const unsigned long *addr, unsigned long size, unsigned long offset); +unsigned long find_next_zero_bit(const unsigned long *addr, unsigned long size, unsigned long offset); + +#define find_first_bit(addr, size) find_next_bit((addr), (size), 0) +#define find_first_zero_bit(addr, size) find_next_zero_bit((addr), (size), 0) + + +/******************** + ** net/checksum.h ** + ********************/ + +#define CSUM_MANGLED_0 ((__sum16)0xffff) + +__wsum csum_and_copy_from_user(const void __user *src, void *dst, + int len, __wsum sum, int *err_ptr); +__wsum csum_add(__wsum csum, __wsum addend); +__wsum csum_block_add(__wsum csum, __wsum csum2, int offset); +__wsum csum_block_sub(__wsum, __wsum, int); +__wsum csum_sub(__wsum csum, __wsum addend); +__wsum csum_unfold(__sum16 n); + +__wsum csum_partial_ext(const void *buff, int len, __wsum sum); +__wsum csum_block_add_ext(__wsum csum, __wsum csum2, int offset, int len); + +void csum_replace2(__sum16 *, __be16, __be16); + + +/************************ + ** net/ip6_checksum.h ** + ************************/ + +__sum16 csum_ipv6_magic(const struct in6_addr *saddr, const struct in6_addr *daddr, __u32 len, unsigned short proto, __wsum csum); + + +/**************************** + ** asm-generic/checksum.h ** + ****************************/ + +__sum16 csum_fold(__wsum csum); +__sum16 ip_fast_csum(const void *iph, unsigned int ihl); + +__wsum csum_partial(const void *buff, int len, __wsum sum); +__wsum csum_partial_copy(const void *src, void *dst, int len, __wsum sum); +__wsum csum_partial_copy_from_user(const void __user *src, void *dst, int len, + __wsum sum, int *csum_err); + +#define csum_partial_copy_nocheck(src, dst, len, sum) \ + csum_partial_copy((src), (dst), (len), (sum)) + +#define csum_and_copy_from_user csum_partial_copy_from_user + +__wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, + unsigned short proto, __wsum sum); +static inline +__sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len, + unsigned short proto, __wsum sum) +{ + return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum)); +} + +static inline +__wsum csum_and_copy_to_user(const void *src, void __user *dst, int len, + __wsum sum, int *err_ptr) +{ + sum = csum_partial(src, len, sum); + + memcpy(dst, src, len); + return sum; +} + + +/******************* + ** linux/delay.h ** + *******************/ + +void msleep(unsigned int); +void ssleep(unsigned int); +void usleep_range(unsigned long min, unsigned long max); + + +/***************** + ** linux/smp.h ** + *****************/ + +#define smp_processor_id() 0 +#define raw_smp_processor_id() smp_processor_id() +#define put_cpu() + +typedef void (*smp_call_func_t)(void *info); + +int on_each_cpu(smp_call_func_t, void *, int); + + +/**************************** + ** uapi/linux/genetlink.h ** + ****************************/ + +/* #define GENL_NAMSIZ 16 */ +/* #define GENL_ID_GENERATE 0 */ +/* #define GENL_ADMIN_PERM 0x01 */ + +/* struct genlmsghdr { */ +/* u8 cmd; */ +/* u8 version; */ +/* u16 reserved; */ +/* }; */ + +/* #define GENL_HDRLEN NLMSG_ALIGN(sizeof(struct genlmsghdr)) */ + +/* */ +/* struct nlattr { */ +/* u16 nla_len; */ +/* u16 nla_type; */ +/* }; */ +/* */ + +/* #define NLM_F_MULTI 2 */ + +/* */ +/* struct nlmsghdr { */ +/* u32 nlmsg_len; */ +/* u16 nlmsg_type; */ +/* u16 nlmsg_flags; */ +/* u32 nlmsg_seq; */ +/* u32 nlmsg_pid; */ +/* }; */ +/* */ + +/* #define NLMSG_HDRLEN ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr))) */ + +/* #define NLMSG_ALIGNTO 4U */ +/* #define NLMSG_ALIGN(len) ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) ) */ + +/************************** + ** uapi/linux/netlink.h ** + **************************/ + +#define NLA_ALIGNTO 4 +#define NLA_ALIGN(len) (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1)) + + +/******************* + ** net/netlink.h ** + *******************/ + +/* +enum { + NLA_U8, + NLA_U16, + NLA_U32, + NLA_U64, + NLA_STRING, + NLA_FLAG, + NLA_NESTED, + NLA_NUL_STRING, + NLA_BINARY, +}; + +struct nla_policy { + u16 type; + u16 len; +}; + + +static inline int nla_ok(const struct nlattr *nla, int remaining) +{ + return remaining >= (int) sizeof(*nla) && + nla->nla_len >= sizeof(*nla) && + nla->nla_len <= remaining; +} + +static inline struct nlattr *nla_next(const struct nlattr *nla, int *remaining) +{ + int totlen = NLA_ALIGN(nla->nla_len); + *remaining -= totlen; + return (struct nlattr *) ((char *) nla + totlen); +} + +#define nla_for_each_attr(pos, head, len, rem) \ + for (pos = head, rem = len; \ + nla_ok(pos, rem); \ + pos = nla_next(pos, &(rem))) + +#define nla_for_each_nested(pos, nla, rem) \ + nla_for_each_attr(pos, nla_data(nla), nla_len(nla), rem) +*/ + + +/*********************** + ** linux/genetlink.h ** + ***********************/ + +/* struct genl_info { */ +/* u32 snd_seq; */ +/* u32 snd_portid; */ +/* struct genlmsghdr *genlhdr; */ +/* struct nlattr **attrs; */ +/* void *user_ptr[2]; */ +/* }; */ + +/* struct netlink_callback; */ + +/* struct genl_ops { */ +/* u8 cmd; */ +/* u8 internal_flags; */ +/* unsigned int flags; */ +/* const struct nla_policy *policy; */ +/* int (*doit)(struct sk_buff *skb, */ +/* struct genl_info *info); */ +/* int (*dumpit)(struct sk_buff *skb, */ +/* struct netlink_callback *cb); */ +/* int (*done)(struct netlink_callback *cb); */ +/* struct list_head ops_list; */ +/* }; */ + +/* struct genl_multicast_group { */ +/* char name[GENL_NAMSIZ]; */ +/* u32 id; */ +/* }; */ + +/* struct genl_family { */ +/* unsigned int id; */ +/* unsigned int hdrsize; */ +/* char name[GENL_NAMSIZ]; */ +/* unsigned int version; */ +/* unsigned int maxattr; */ +/* bool netnsok; */ +/* int (*pre_doit)(struct genl_ops *ops, */ +/* struct sk_buff *skb, */ +/* struct genl_info *info); */ +/* void (*post_doit)(struct genl_ops *ops, */ +/* struct sk_buff *skb, */ +/* struct genl_info *info); */ +/* struct nlattr ** attrbuf; /1* private *1/ */ +/* struct list_head ops_list; /1* private *1/ */ +/* struct list_head family_list; /1* private *1/ */ +/* struct list_head mcast_groups; /1* private *1/ */ +/* }; */ + +#define MODULE_ALIAS_GENL_FAMILY(family) \ + MODULE_ALIAS_NET_PF_PROTO_NAME(PF_NETLINK, NETLINK_GENERIC, "-family-" family) + + + +/***************************** + ** uapi/linux/net_tstamp.h ** + *****************************/ + +enum { + SOF_TIMESTAMPING_TX_HARDWARE = 1 << 0, + SOF_TIMESTAMPING_TX_SOFTWARE = 1 << 1, + SOF_TIMESTAMPING_RX_HARDWARE = 1 << 2, + SOF_TIMESTAMPING_RX_SOFTWARE = 1 << 3, + SOF_TIMESTAMPING_SOFTWARE = 1 << 4, + SOF_TIMESTAMPING_SYS_HARDWARE = 1 << 5, + SOF_TIMESTAMPING_RAW_HARDWARE = 1 << 6, + SOF_TIMESTAMPING_MASK = (SOF_TIMESTAMPING_RAW_HARDWARE - 1) | + SOF_TIMESTAMPING_RAW_HARDWARE, +}; + + +/************************* + ** uapi/linux/filter.h ** + *************************/ + +struct sock_fprog { }; + + +/* short-cut for net/core/sock.c */ +#include + + +/***************************** + ** uapi/asm-generic/poll.h ** + *****************************/ + +enum { + POLLIN = 0x1, + POLLPRI = 0x2, + POLLOUT = 0x4, + POLLERR = 0x8, + POLLHUP = 0x10, + POLLRDNORM = 0x40, + POLLRDBAND = 0x80, + POLLWRNORM = 0x100, + POLLWRBAND = 0x200, + POLLRDHUP = 0x2000, +}; + +void poll_wait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p); +bool poll_does_not_wait(const poll_table *p); + + +/********************************* + ** uapi/asm-generic/siginfo..h ** + *********************************/ + +enum +{ + POLL_IN = 1, + POLL_OUT = 2, + POLL_ERR = 4, + POLL_PRI = 5, + POLL_HUP = 6, +}; + + +size_t ksize(void *); +void * krealloc(void *, size_t, gfp_t); + + +/********************* + ** net/flow_keys.h ** + *********************/ + +struct flow_keys +{ + /* (src,dst) must be grouped, in the same way than in IP header */ + __be32 src; + __be32 dst; + union { + __be32 ports; + __be16 port16[2]; + }; + u16 thoff; + u8 ip_proto; +}; + +bool skb_flow_dissect(const struct sk_buff *skb, struct flow_keys *flow); +__be32 skb_flow_get_ports(const struct sk_buff *skb, int thoff, u8 ip_proto); + + +/*********************** + ** linux/pipe_fs_i.h ** + ***********************/ + +extern const struct pipe_buf_operations nosteal_pipe_buf_ops; + + +/****************** + ** linux/acpi.h ** + ******************/ + +#define ACPI_PTR(_ptr) (NULL) +#define ACPI_HANDLE(dev) (NULL) + +const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids, const struct device *dev); + + +/******************** + ** linux/random.h ** + ********************/ + +static inline void get_random_bytes(void *buf, int nbytes) +{ + char *b = (char *)buf; + + /* FIXME not random */ + int i; + for (i = 0; i < nbytes; ++i) + b[i] = i + 1; +} + +u32 prandom_u32(void); +static inline u32 prandom_u32_max(u32 ep_ro) { return (u32)(((u64) prandom_u32() * ep_ro) >> 32); } + + +/********************* + ** linux/proc_fs.h ** + *********************/ + +#define remove_proc_entry(name, parent) do { } while (0) + + +/********************* + ** linux/proc_ns.h ** + *********************/ + +struct nsproxy; + +struct proc_ns_operations +{ + const char *name; + int type; + void *(*get)(struct task_struct *task); + void (*put)(void *ns); + int (*install)(struct nsproxy *nsproxy, void *ns); + unsigned int (*inum)(void *ns); +}; + + +struct proc_ns +{ + void *ns; + const struct proc_ns_operations *ns_ops; +}; + +extern const struct proc_ns_operations netns_operations; + + +/********************* + ** linux/nsproxy.h ** + *********************/ + +struct nsproxy +{ + struct net *net_ns; +}; + + +/******************** + ** linux/bitmap.h ** + ********************/ + +static inline void bitmap_zero(unsigned long *dst, int nbits) +{ + if (nbits <= BITS_PER_LONG) + *dst = 0UL; + else { + int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long); + memset(dst, 0, len); + } +} + +void bitmap_fill(unsigned long *dst, int nbits); +int bitmap_empty(const unsigned long *src, int nbits); + + +/******************************* + ** uapi/asm-generic/ioctls.h ** + *******************************/ + +enum { + TIOCOUTQ = 0x5411, + FIONREAD = 0x541B, +}; + + +/******************************** + ** uapi/asm-generic/sockios.h ** + ********************************/ + +enum { + SIOCGSTAMP = 0x8906, + SIOCGSTAMPNS = 0x8907, +}; + + +/************************* + ** linux/sch_generic.h ** + *************************/ + +struct Qdisc_ops +{ + char id[IFNAMSIZ]; +}; + +struct Qdisc +{ + const struct Qdisc_ops *ops; +}; + +bool qdisc_all_tx_empty(const struct net_device *dev); + + +/********************* + ** linux/hardirq.h ** + *********************/ + +void synchronize_irq(unsigned int irq); + + +/************************** + ** asm-generic/udelay.h ** + **************************/ + +void udelay(unsigned long usecs); + + +/**************************** + ** asm-generic/getorder.h ** + ****************************/ + +int get_order(unsigned long size); + + +/************************* + ** asm-generic/div64.h ** + *************************/ + +#define do_div(n,base) ({ \ + unsigned long __base = (base); \ + unsigned long __rem; \ + __rem = ((uint64_t)(n)) % __base; \ + (n) = ((uint64_t)(n)) / __base; \ + __rem; \ +}) + + +/*************************** + ** linux/rculist_nulls.h ** + ***************************/ + +struct hlist_nulls_node; +struct hlist_nulls_head; + +void hlist_nulls_add_head_rcu(struct hlist_nulls_node *n, struct hlist_nulls_head *h); +void hlist_nulls_del_init_rcu(struct hlist_nulls_node *n); + + +/********************** + ** linux/security.h ** + **********************/ + +struct socket; + +void security_sock_graft(struct sock* sk, struct socket *parent); +int security_socket_getpeersec_stream(struct socket *sock, char __user *optval, int __user *optlen, unsigned len); +int security_sk_alloc(struct sock *sk, int family, gfp_t priority); +void security_sk_free(struct sock *sk); +int security_netlink_send(struct sock *sk, struct sk_buff *skb); + + +/********************* + ** linux/pagemap.h ** + *********************/ + +void release_pages(struct page **pages, int nr, int cold); + + +/********************* + ** net/busy_poll.h ** + *********************/ + +bool sk_can_busy_loop(struct sock *sk); +bool sk_busy_loop(struct sock *sk, int nonblock); + + +/********************** + ** linux/prefetch.h ** + **********************/ + +#define prefetch(x) __builtin_prefetch(x) +#define prefetchw(x) __builtin_prefetch(x,1) + + +/**************** + ** net/xfrm.h ** + ****************/ + +static inline void secpath_reset(struct sk_buff *skb) { } +int __xfrm_sk_clone_policy(struct sock *sk); +void xfrm_sk_free_policy(struct sock *sk); +int xfrm_sk_clone_policy(struct sock *sk); + + +/************************* + ** linux/debug_locks.h ** + *************************/ + +static inline void debug_check_no_locks_freed(const void *from, unsigned long len) { } + + +/********************** + ** net/cls_cgroup.h ** + **********************/ + +void sock_update_classid(struct sock *sk); + + +/************************** + ** net/netprio_cgroup.h ** + **************************/ + +void sock_update_netprioidx(struct sock *sk); + + +/******************* + ** linux/crc32.h ** + *******************/ + +#define CONFIG_CRC32_SLICEBY8 /* the default from lib/Kconfig */ + +extern u32 crc32_le(u32 crc, unsigned char const *p, size_t len); +extern u32 crc32_be(u32 crc, unsigned char const *p, size_t len); + + +/******************************** + ** linux/regulator/consumer.h ** + ********************************/ + +struct regulator; + +int regulator_enable(struct regulator *regulator); +int regulator_disable(struct regulator *regulator); +int regulator_is_enabled(struct regulator *regulator); +struct regulator * regulator_get_exclusive(struct device *dev, const char *id); +void regulator_put(struct regulator *regulator); + + +/*************************** + ** linux/gpio/consumer.h ** + ***************************/ + +struct gpio_desc; + +struct gpio_desc * devm_gpiod_get_index(struct device *dev, const char *con_id, unsigned int idx); +int gpiod_direction_output(struct gpio_desc *desc, int value); +void gpiod_set_value(struct gpio_desc *desc, int value); + + +/***************** + ** linux/clk.h ** + *****************/ + +struct clk; + +struct clk *devm_clk_get(struct device *dev, const char *id); +int clk_enable(struct clk *clk); +void clk_disable(struct clk *clk); + + +/*************************** + ** uapi/linux/wireless.h ** + ***************************/ + +struct iw_freq; +struct iw_point; + + +/********************** + ** net/iw_handler.h ** + **********************/ + +struct iw_request_info; + + +/********************* + ** linux/debugfs.h ** + *********************/ + +struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry, struct dentry *new_dir, const char *new_name); +struct dentry *debugfs_create_dir(const char *name, struct dentry *parent); +void debugfs_remove(struct dentry *dentry); +void debugfs_remove_recursive(struct dentry *dentry); + + +/********************* + ** linux/kthread.h ** + *********************/ + +void *kthread_run(int (*threadfn)(void *), void *data, char const *name); + + +/***************** + ** crypto test ** + *****************/ + +int alg_test(const char *driver, const char *alg, u32 type, u32 mask); + +#endif /* _LX_EMUL_H_ */ diff --git a/repos/dde_linux/src/lib/wifi/include/nic/component.h b/repos/dde_linux/src/lib/wifi/include/nic/component.h new file mode 100644 index 000000000..861b3dc3a --- /dev/null +++ b/repos/dde_linux/src/lib/wifi/include/nic/component.h @@ -0,0 +1,214 @@ +/* + * \brief Nic-session implementation for network devices + * \author Sebastian Sumpf + * \date 2012-07-05 + */ + +/* + * Copyright (C) 2012-2013 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +#ifndef _NIC__COMPONENT_H_ +#define _NIC__COMPONENT_H_ + +/* Genode includes */ +#include +#include +#include +#include + +/* local includes */ +#include + +#include +# include +#include + + +namespace Nic { + + using namespace Genode; /* FIXME */ + + struct Session_component; + struct Device; + + typedef Genode::Root_component Root_component; + + struct Root; +} + + +struct Nic::Device +{ + /** + * Transmit data to driver + */ + virtual bool tx(addr_t virt, size_t size) = 0; + + /** + * Return mac address of device + */ + virtual Mac_address mac_address() = 0; + + /** + * Return link state (true if link detected) + */ + virtual bool link_state() = 0; + + /** + * Set session belonging to this driver + */ + virtual void session(Session_component *s) = 0; + + Device() { } + virtual ~Device() { } +}; + + +class Nic::Session_component : public Nic::Packet_allocator, + public Packet_session_component +{ + private: + + Device &_device; /* device this session is using */ + Tx::Sink *_tx_sink; /* client packet sink */ + bool _tx_alloc; /* get next packet from client or use _tx_packet */ + Packet_descriptor _tx_packet; /* saved packet in case of driver errors */ + + Signal_context_capability _link_state_sigh; + + void _send_packet_avail_signal() { + Signal_transmitter(_tx.sigh_packet_avail()).submit(); } + + protected: + + void _process_packets(unsigned) + { + int tx_cnt = 0; + + /* submit received packets to lower layer */ + while (_tx_sink->packet_avail()) { + Packet_descriptor packet = _tx_alloc ? _tx_sink->get_packet() : _tx_packet; + addr_t virt = (addr_t)_tx_sink->packet_content(packet); + + /* send to driver */ + if (!(_device.tx(virt, packet.size()))) { + _send_packet_avail_signal(); + _tx_alloc = false; + _tx_packet = packet; + return; + } + + _tx_alloc = true; + tx_cnt++; + + /* acknowledge to client */ + _tx_sink->acknowledge_packet(packet); + } + + /* release acknowledged packets */ + _rx_ack(false); + + if (_tx_sink->packet_avail()) + _send_packet_avail_signal(); + } + + void _rx_ack(bool block = true) + { + while (_rx.source()->ack_avail() || block) { + Packet_descriptor packet = _rx.source()->get_acked_packet(); + + /* free packet buffer */ + _rx.source()->release_packet(packet); + block = false; + } + } + + public: + + /** + * Constructor + */ + Session_component(Dataspace_capability tx_ds, + Dataspace_capability rx_ds, + Server::Entrypoint &ep, + Device &device) + : + Nic::Packet_allocator(Genode::env()->heap()), + Packet_session_component(tx_ds, rx_ds, this, ep), + _device(device), + _tx_sink(Session_rpc_object::_tx.sink()), + _tx_alloc(true) + { _device.session(this); } + + /** + * Send packet to client (called from driver) + */ + void rx(addr_t packet, size_t psize, addr_t frag, size_t fsize) + { + size_t size = psize + fsize; + + while (true) { + try { + Packet_descriptor p =_rx.source()->alloc_packet(size); + + Genode::memcpy(_rx.source()->packet_content(p), (void*)packet, psize); + + if (fsize) + Genode::memcpy(_rx.source()->packet_content(p)+psize, (void*)frag, fsize); + + _rx.source()->submit_packet(p); + } catch (...) { + /* ack or block */ + _rx_ack(); + continue; + } + break; + } + + _rx_ack(false); + } + + /** + * Link state changed (called from driver) + */ + void link_state_changed() + { + if (_link_state_sigh.valid()) + Genode::Signal_transmitter(_link_state_sigh).submit(); + } + + /*************************** + ** Nic-session interface ** + ***************************/ + + Mac_address mac_address() override + { + return _device.mac_address(); + } + + bool link_state() // override + { + return _device.link_state(); + } + + void link_state_sigh(Genode::Signal_context_capability sigh) + { + _link_state_sigh = sigh; + } +}; + + +/** + * Root component, handling new session requests + */ +struct Nic::Root : Packet_root +{ + Root(Server::Entrypoint &ep, Allocator *md_alloc, Device &device) + : Packet_root(ep, md_alloc, device) { } +}; + +#endif /* _NIC__COMPONENT_H_ */ diff --git a/repos/dde_linux/src/lib/wifi/include/nic/dispatch.h b/repos/dde_linux/src/lib/wifi/include/nic/dispatch.h new file mode 100644 index 000000000..9c43bf889 --- /dev/null +++ b/repos/dde_linux/src/lib/wifi/include/nic/dispatch.h @@ -0,0 +1,143 @@ +/** + * \brief Packet-stream-session components + * \author Sebastian Sumpf + * \author Norman Feske + * \date 2012-07-06 + */ + +/* + * Copyright (C) 2012-2013 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +#ifndef _SIGNAL__DISPATCHER_H_ +#define _SIGNAL__DISPATCHER_H_ + +/* Genode includes */ +#include + +/* local includes */ +#include + + +/** + * Session components that overrides signal handlers + */ +template +class Packet_session_component : public SESSION_RPC_OBJECT +{ + private: + + Genode::Signal_rpc_member _tx_ready_to_ack_dispatcher; + Genode::Signal_rpc_member _tx_packet_avail_dispatcher; + Genode::Signal_rpc_member _rx_ack_avail_dispatcher; + Genode::Signal_rpc_member _rx_ready_to_submit_dispatcher; + + void _tx_ready_to_ack(unsigned) + { + _process_packets(0); + } + + void _tx_packet_avail(unsigned) + { + _process_packets(0); + } + + void _rx_ack_avail(unsigned) + { + _process_packets(0); + } + + void _rx_ready_to_submit(unsigned) + { + _process_packets(0); + } + + protected: + + virtual void _process_packets(unsigned) = 0; + + public: + + Packet_session_component(Genode::Dataspace_capability tx_ds, + Genode::Dataspace_capability rx_ds, + Genode::Range_allocator *rx_buffer_alloc, + Server::Entrypoint &ep) + : + SESSION_RPC_OBJECT(tx_ds, rx_ds, rx_buffer_alloc, ep.rpc_ep()), + _tx_ready_to_ack_dispatcher(ep, *this, &Packet_session_component::_tx_ready_to_ack), + _tx_packet_avail_dispatcher(ep, *this, &Packet_session_component::_tx_packet_avail), + _rx_ack_avail_dispatcher(ep, *this, &Packet_session_component::_rx_ack_avail), + _rx_ready_to_submit_dispatcher(ep, *this, &Packet_session_component::_rx_ready_to_submit) + { + SESSION_RPC_OBJECT::_tx.sigh_ready_to_ack(_tx_ready_to_ack_dispatcher); + SESSION_RPC_OBJECT::_tx.sigh_packet_avail(_tx_packet_avail_dispatcher); + SESSION_RPC_OBJECT::_rx.sigh_ack_avail(_rx_ack_avail_dispatcher); + SESSION_RPC_OBJECT::_rx.sigh_ready_to_submit(_rx_ready_to_submit_dispatcher); + } +}; + + +/** + * Root component, handling new session requests + */ +template +class Packet_root : public ROOT_COMPONENT +{ + private: + + Server::Entrypoint &_ep; + DEVICE &_device; + + protected: + + /** + * Always returns the singleton block-session component + */ + SESSION_COMPONENT *_create_session(const char *args) + { + using namespace Genode; + size_t ram_quota = + Arg_string::find_arg(args, "ram_quota" ).ulong_value(0); + size_t tx_buf_size = + Arg_string::find_arg(args, "tx_buf_size").ulong_value(0); + size_t rx_buf_size = + Arg_string::find_arg(args, "rx_buf_size").ulong_value(0); + + /* delete ram quota by the memory needed for the session */ + size_t session_size = max((size_t)4096, + sizeof(SESSION_COMPONENT) + + sizeof(Allocator_avl)); + if (ram_quota < session_size) + throw Root::Quota_exceeded(); + + /* + * Check if donated ram quota suffices for both communication + * buffers. Also check both sizes separately to handle a + * possible overflow of the sum of both sizes. + */ + if (tx_buf_size > ram_quota - session_size) { + PERR("insufficient 'ram_quota', got %zd, need %zd", + ram_quota, tx_buf_size + session_size); + throw Root::Quota_exceeded(); + } + + return new (ROOT_COMPONENT::md_alloc()) + SESSION_COMPONENT(Lx::backend_alloc(tx_buf_size, CACHEABILITY), + Lx::backend_alloc(rx_buf_size, CACHEABILITY), + _ep, _device); + } + + public: + + Packet_root(Server::Entrypoint &ep, Genode::Allocator *md_alloc, DEVICE &device) + : ROOT_COMPONENT(&ep.rpc_ep(), md_alloc), + _ep(ep), _device(device) { } +}; + +#endif /* _SIGNAL__DISPATCHER_H_ */ diff --git a/repos/dde_linux/src/lib/wifi/include/scheduler.h b/repos/dde_linux/src/lib/wifi/include/scheduler.h new file mode 100644 index 000000000..01017251d --- /dev/null +++ b/repos/dde_linux/src/lib/wifi/include/scheduler.h @@ -0,0 +1,249 @@ +/* + * \brief User-level scheduling + * \author Sebastian Sumpf + * \author Josef Soentgen + * \author Christian Helmuth + * \date 2012-04-25 + */ + +/* + * Copyright (C) 2012-2014 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +#ifndef _SCHEDULER_H_ +#define _SCHEDULER_H_ + +/* Genode includes */ +#include +#include +#include + +/* libc includes */ +#include + +/* local includes */ +#include + + +namespace Lx { + class Scheduler; + class Task; + + Scheduler &scheduler(); +}; + + +/** + * Allows pseudo-parallel execution of functions + */ +class Lx::Task : public Lx::List::Element +{ + public: + + /** + * TODO generalize - higher is more important + */ + enum Priority { PRIORITY_0, PRIORITY_1, PRIORITY_2, PRIORITY_3 }; + + /** + * Runtime state + * + * INIT + * | + * [run] + * v + * BLOCKED <--[block]--- RUNNING ---[mutex_block]--> MUTEX_BLOCKED + * --[unblock]-> <-[mutex_unblock]-- + * + * Transitions between BLOCKED and MUTEX_BLOCKED are not possible. + */ + enum State { STATE_INIT, STATE_RUNNING, STATE_BLOCKED, STATE_MUTEX_BLOCKED, STATE_WAIT_BLOCKED }; + + /** + * List element type + */ + typedef Lx::List_element List_element; + + /** + * List type + */ + typedef Lx::List List; + + private: + + State _state = STATE_INIT; + + /* sub-classes may overwrite the runnable condition */ + virtual bool _runnable() const; + + void *_stack = nullptr; /* stack pointer */ + jmp_buf _env; /* execution state */ + jmp_buf _saved_env; /* saved state of thread calling run() */ + + Priority _priority; + Scheduler &_scheduler; /* scheduler this task is attached to */ + + void (*_func)(void *); /* function to call*/ + void *_arg; /* argument for function */ + char const *_name; /* name of task */ + + List_element _mutex_le { this }; /* list element for mutex_blocked state */ + + List *_wait_list { 0 }; + List_element _wait_le { this }; + bool _wait_le_enqueued { false }; + + public: + + Task(void (*func)(void*), void *arg, char const *name, + Priority priority, Scheduler &scheduler); + virtual ~Task(); + + State state() const { return _state; } + Priority priority() const { return _priority; } + + void wait_enqueue(List *list) + { + if (_wait_le_enqueued) { + PERR("%p already queued in %p", this, _wait_list); + Genode::sleep_forever(); + } + + _wait_le_enqueued = true; + _wait_list = list; + _wait_list->append(&_wait_le); + } + + void wait_dequeue(List *list) + { + if (!_wait_le_enqueued) { + PERR("%p not queued", this); + Genode::sleep_forever(); + } + + if (_wait_list != list) { + PERR("especially not in list %p", list); + Genode::sleep_forever(); + } + + _wait_list->remove(&_wait_le); + _wait_list = 0; + _wait_le_enqueued = false; + } + + /******************************* + ** Runtime state transitions ** + *******************************/ + + void block() + { + if (_state == STATE_RUNNING) { + _state = STATE_BLOCKED; + } + } + + void unblock() + { + if (_state == STATE_BLOCKED) { + _state = STATE_RUNNING; + } + } + + void mutex_block(List *list) + { + if (_state == STATE_RUNNING) { + _state = STATE_MUTEX_BLOCKED; + list->append(&_mutex_le); + } + } + + void mutex_unblock(List *list) + { + if (_state == STATE_MUTEX_BLOCKED) { + _state = STATE_RUNNING; + list->remove(&_mutex_le); + } + } + + /** + * Run task until next preemption point + * + * \return true if run, false if not runnable + */ + bool run(); + + /** + * Request scheduling (of other tasks) + * + * Note, this task may not be blocked when calling schedule() depending + * on the use case. + */ + void schedule(); + + /** + * Shortcut to enter blocking state and request scheduling + */ + void block_and_schedule() + { + block(); + schedule(); + } + + /** + * Return the name of the task (mainly for debugging purposes) + */ + char const *name() { return _name; } +}; + + +/** + * Scheduler + * + * FIXME The old mechanism for removal via check_dead() was removed and has to + * be reimplemented later. + */ +class Lx::Scheduler +{ + private: + + Lx::List _present_list; + Genode::Lock _present_list_mutex; + + Task *_current = nullptr; /* currently scheduled task */ + + bool _run_task(Task *); + + public: + + Scheduler(); + ~Scheduler(); + + /** + * Return currently scheduled task + */ + Task *current(); + + /** + * Add new task to the present list + */ + void add(Task *); + + /** + * Schedule all present tasks + * + * Returns if no task is runnable. + */ + void schedule(); + + /** + * Log current state of tasks in present list (debug) + * + * Log lines are prefixed with 'prefix' + */ + void log_state(char const *prefix); +}; + +#endif /* _SCHEDULER_H_ */ diff --git a/repos/dde_linux/src/lib/wifi/include/x86_32/platform/platform.h b/repos/dde_linux/src/lib/wifi/include/x86_32/platform/platform.h new file mode 100644 index 000000000..18250a137 --- /dev/null +++ b/repos/dde_linux/src/lib/wifi/include/x86_32/platform/platform.h @@ -0,0 +1,27 @@ +/** + * \brief Platform specific code + * \author Sebastian Sumpf + * \date 2012-06-10 + */ + +/* + * Copyright (C) 2012-2013 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +#ifndef _X86_32__PLATFORM_H_ +#define _X86_32__PLATFORM_H_ + +static inline +void platform_execute(void *sp, void *func, void *arg) +{ + asm volatile ("movl %2, 0(%0);" + "movl %1, -0x4(%0);" + "movl %0, %%esp;" + "call *-4(%%esp);" + : : "r" (sp), "r" (func), "r" (arg)); +} + +#endif /* _X86_32__PLATFORM_H_ */ diff --git a/repos/dde_linux/src/lib/wifi/include/x86_32/platform/types.h b/repos/dde_linux/src/lib/wifi/include/x86_32/platform/types.h new file mode 100644 index 000000000..f567a3951 --- /dev/null +++ b/repos/dde_linux/src/lib/wifi/include/x86_32/platform/types.h @@ -0,0 +1,27 @@ +/** + * \brief Platform specific types + * \author Josef Soentgen + * \date 2014-10-17 + */ + +/* + * Copyright (C) 2014 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +#ifndef _X86_32__TYPES_H_ +#define _X86_32__TYPES_H_ + +typedef signed char int8_t; +typedef unsigned char uint8_t; +typedef short int16_t; +typedef unsigned short uint16_t; +typedef int int32_t; +typedef unsigned int uint32_t; +typedef __SIZE_TYPE__ size_t; +typedef long long int64_t; +typedef unsigned long long uint64_t; + +#endif /* _X86_32__TYPES_H_ */ diff --git a/repos/dde_linux/src/lib/wifi/include/x86_64/platform/platform.h b/repos/dde_linux/src/lib/wifi/include/x86_64/platform/platform.h new file mode 100644 index 000000000..13a367d20 --- /dev/null +++ b/repos/dde_linux/src/lib/wifi/include/x86_64/platform/platform.h @@ -0,0 +1,29 @@ +/** + * \brief Platform specific code + * \author Sebastian Sumpf + * \author Alexander Boettcher + * \date 2012-06-10 + */ + +/* + * Copyright (C) 2012-2013 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +#ifndef _X86_64__PLATFORM_H_ +#define _X86_64__PLATFORM_H_ + + +static inline +void platform_execute(void *sp, void *func, void *arg) +{ + asm volatile ("movq %2, %%rdi;" + "movq %1, 0(%0);" + "movq %0, %%rsp;" + "call *0(%%rsp);" + : "+r" (sp), "+r" (func), "+r" (arg) : : "memory"); +} + +#endif /* _X86_64__PLATFORM_H_ */ diff --git a/repos/dde_linux/src/lib/wifi/include/x86_64/platform/types.h b/repos/dde_linux/src/lib/wifi/include/x86_64/platform/types.h new file mode 100644 index 000000000..90df54ae7 --- /dev/null +++ b/repos/dde_linux/src/lib/wifi/include/x86_64/platform/types.h @@ -0,0 +1,27 @@ +/** + * \brief Platform specific types + * \author Josef Soentgen + * \date 2014-10-17 + */ + +/* + * Copyright (C) 2014 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +#ifndef _X86_64__TYPES_H_ +#define _X86_64__TYPES_H_ + +typedef signed char int8_t; +typedef unsigned char uint8_t; +typedef short int16_t; +typedef unsigned short uint16_t; +typedef int int32_t; +typedef unsigned int uint32_t; +typedef __SIZE_TYPE__ size_t; +typedef long long int64_t; +typedef unsigned long long uint64_t; + +#endif /* _X86_64__TYPES_H_ */ diff --git a/repos/dde_linux/src/lib/wifi/init.cc b/repos/dde_linux/src/lib/wifi/init.cc new file mode 100644 index 000000000..304104f73 --- /dev/null +++ b/repos/dde_linux/src/lib/wifi/init.cc @@ -0,0 +1,157 @@ +/* + * \brief Linux wireless stack + * \author Josef Soentgen + * \date 2014-03-03 + */ + +/* + * Copyright (C) 2014 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +/* Genode includes */ +#include +#include + +/* local includes */ +#include +#include + +#include +# include +#include + +extern "C" void core_netlink_proto_init(void); +extern "C" void core_sock_init(void); +extern "C" void module_packet_init(void); +extern "C" void subsys_genl_init(void); +extern "C" void subsys_rfkill_init(void); +extern "C" void subsys_cfg80211_init(void); +extern "C" void subsys_ieee80211_init(void); +extern "C" void module_iwl_drv_init(void); +extern "C" void subsys_cryptomgr_init(void); +extern "C" void module_crypto_ccm_module_init(void); +extern "C" void module_crypto_ctr_module_init(void); +extern "C" void module_aes_init(void); +extern "C" void module_arc4_init(void); +extern "C" void module_chainiv_module_init(void); +extern "C" void module_krng_mod_init(void); + +static bool mac80211_only = false; + +struct pernet_operations loopback_net_ops; + +struct net init_net; +LIST_HEAD(net_namespace_list); + + +Firmware_list fw_list[] = { + { "iwlwifi-1000-3.ucode", 335056 }, + { "iwlwifi-1000-5.ucode", 337520 }, + { "iwlwifi-105-6.ucode", 689680 }, + { "iwlwifi-135-6.ucode", 701228 }, + { "iwlwifi-2000-6.ucode", 695876 }, + { "iwlwifi-2030-6.ucode", 707392 }, + { "iwlwifi-3160-7.ucode", 670484 }, + { "iwlwifi-3160-8.ucode", 667284 }, + { "iwlwifi-3160-9.ucode", 666792 }, + { "iwlwifi-3945-2.ucode", 150100 }, + { "iwlwifi-4965-2.ucode", 187972 }, + { "iwlwifi-5000-1.ucode", 345008 }, + { "iwlwifi-5000-2.ucode", 353240 }, + { "iwlwifi-5000-5.ucode", 340696 }, + { "iwlwifi-5150-2.ucode", 337400 }, + { "iwlwifi-6000-4.ucode", 454608 }, + /** + * Actually, there is no -6 firmware. The last one is revision 4, + * but certain devices support up to revision 6 and want to use + * this one. Our fw loading mechanism sadly will not work in this + * case, therefore we add -6 to the fw whitelist have to provide + * a renamed image. + */ + { "iwlwifi-6000-6.ucode", 454608 }, /* XXX same as -4 */ + { "iwlwifi-6000g2a-5.ucode", 444128 }, + { "iwlwifi-6000g2a-6.ucode", 677296 }, + { "iwlwifi-6000g2b-5.ucode", 460236 }, + { "iwlwifi-6000g2b-6.ucode", 679436 }, + { "iwlwifi-6050-4.ucode", 463692 }, + { "iwlwifi-6050-5.ucode", 469780 }, + { "iwlwifi-7260-7.ucode", 683236 }, + { "iwlwifi-7260-8.ucode", 679780 }, + { "iwlwifi-7260-9.ucode", 679380 }, + { "iwlwifi-7265-8.ucode", 690452 } +}; + + +size_t fw_list_len = sizeof(fw_list) / sizeof(fw_list[0]); + + +static Genode::Lock *_wpa_lock; + + +static void run_linux(void *) +{ + core_sock_init(); + core_netlink_proto_init(); + module_packet_init(); + subsys_genl_init(); + subsys_rfkill_init(); + subsys_cfg80211_init(); + subsys_ieee80211_init(); + + subsys_cryptomgr_init(); + module_crypto_ccm_module_init(); + module_crypto_ctr_module_init(); + module_aes_init(); + module_arc4_init(); + module_chainiv_module_init(); + module_krng_mod_init(); + + if (!mac80211_only) { + module_iwl_drv_init(); + } + + PINF("+-----------------------+"); + PINF("| iwl driver loaded |"); + PINF("+-----------------------+"); + + _wpa_lock->unlock(); + + while (1) { + Lx::scheduler().current()->block_and_schedule(); + } +} + + +void wifi_init(Server::Entrypoint &ep, Genode::Lock &lock) +{ + /** + * For testing testing only the wireless stack with wpa_supplicant, + * amongst other on linux, we do not want to load the iwlwifi drivers. + */ + if (Genode::config()->xml_node().has_attribute("mac80211_only")) + mac80211_only = Genode::config()->xml_node().attribute("mac80211_only").has_value("yes"); + if (mac80211_only) + PINF("Initalizing only mac80211 stack without any driver!"); + + _wpa_lock = &lock; + + INIT_LIST_HEAD(&init_net.dev_base_head); + /* add init_net namespace to namespace list */ + list_add_tail_rcu(&init_net.list, &net_namespace_list); + + Lx::timer_init(ep); + Lx::irq_init(ep); + Lx::work_init(ep); + Lx::socket_init(ep); + Lx::nic_init(ep); + + /* Linux task (handles the initialization only currently) */ + static Lx::Task linux(run_linux, nullptr, "linux", + Lx::Task::PRIORITY_0, Lx::scheduler()); + + /* give all task a first kick before returning */ + Lx::scheduler().schedule(); +} diff --git a/repos/dde_linux/src/lib/wifi/irq.cc b/repos/dde_linux/src/lib/wifi/irq.cc new file mode 100644 index 000000000..3e98e70ef --- /dev/null +++ b/repos/dde_linux/src/lib/wifi/irq.cc @@ -0,0 +1,340 @@ +/* + * \brief Signal context for IRQ's + * \author Josef Soentgen + * \author Christian Helmuth + * \date 2014-10-14 + */ + +/* + * Copyright (C) 2014 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +/* Genode includes */ +#include +#include +#include +#include + +/* local includes */ +#include + +#include +# include +#include + +namespace { + + /** + * Helper utilty for composing IRQ related names + */ + struct Name_composer + { + char name[16]; + Name_composer(unsigned irq) { + Genode::snprintf(name, sizeof(name), "irq_%02x", irq); } + }; +} + +/** + * Task for interrupts + * + * Allows flagging of IRQs from other threads. + */ +struct Irq_task +{ + private: + + Lx::Task _task; + + public: + + Irq_task(void (*func)(void *), void *args, char const *name) + : _task(func, args, name, Lx::Task::PRIORITY_3, Lx::scheduler()) { } + + void unblock() { _task.unblock(); } + + char const *name() { return _task.name(); } +}; + + +/** + * This contains the Linux-driver handlers + */ +struct Lx_irq_handler : public Lx::List::Element +{ + void *dev; /* Linux device */ + irq_handler_t handler; /* Linux handler */ + irq_handler_t thread_fn; /* Linux thread function */ + + Lx_irq_handler(void *dev, irq_handler_t handler, irq_handler_t thread_fn) + : dev(dev), handler(handler), thread_fn(thread_fn) { } +}; + + +/** + * IRQ handling thread + */ +template +class Irq_thread : public Genode::Thread<1024 * sizeof(Genode::addr_t)> +{ + private: + + unsigned _irq_number; + Genode::Irq_connection _irq; + bool _enabled; + + /* XXX replace by functor? */ + T &_obj; + void (T::*_member)(void *); + void *_priv; + + public: + + Irq_thread(unsigned irq, T &obj, void (T::*member)(void*), void *priv, + char const *name) + : + Thread(name), + _irq_number(irq), _irq(_irq_number), _enabled(false), + _obj(obj), _member(member), _priv(priv) + { + start(); + } + + void enable() { _enabled = true; } + + void entry() + { + while (1) { + _irq.wait_for_irq(); + if (_enabled) (_obj.*_member)(_priv); + } + } +}; + + +namespace Lx { + class Irq; +} + +static void run_irq(void *args); + +/** + * Lx::Irq + */ +class Lx::Irq +{ + public: + + /** + * Context encapsulates the handling of an IRQ + */ + class Context : public Lx::List::Element + { + private: + + Name_composer _name; + + unsigned int _irq; /* IRQ number */ + Lx::List _handler; /* List of registered handlers */ + Irq_task _task; + Irq_thread _thread; + + Genode::Lock _irq_sync { Genode::Lock::LOCKED }; + + Genode::Signal_transmitter _sender; + Genode::Signal_rpc_member _dispatcher; + + /** + * IRQ handling thread callback + */ + void _handle_irq(void *) + { + _sender.submit(); + + /* wait for interrupt to get acked at device side */ + _irq_sync.lock(); + } + + /** + * Call one IRQ handler + */ + bool _handle_one(Lx_irq_handler *h) + { + bool handled = false; + + /* XXX the handler as well as the thread_fn are called in a synchronouse fashion */ + switch (h->handler(_irq, h->dev)) { + case IRQ_WAKE_THREAD: + { + h->thread_fn(_irq, h->dev); + } + case IRQ_HANDLED: + handled = true; + break; + case IRQ_NONE: + break; + } + + return handled; + } + + /** + * Signal handler + */ + void _handle(unsigned) + { + _task.unblock(); + + /* kick off scheduling */ + Lx::scheduler().schedule(); + } + + public: + + /** + * Constructor + */ + Context(Server::Entrypoint &ep, unsigned irq) + : + _name(irq), + _irq(irq), + _task(run_irq, this, _name.name), + _thread(irq, *this, &Context::_handle_irq, 0, _name.name), + _dispatcher(ep, *this, &Context::_handle) + { + _sender.context(_dispatcher); + + _thread.enable(); + } + + /** + * Return IRQ number + */ + unsigned irq() { return _irq; } + + /** + * Handle IRQ + */ + void handle_irq() + { + bool handled = false; + + /* report IRQ to all clients */ + for (Lx_irq_handler *h = _handler.first(); h; h = h->next()) { + if ((handled = _handle_one(h))) + break; + } + + /* interrupt should be acked at device now */ + _irq_sync.unlock(); + } + + /** + * Add linux handler to context + */ + void add_handler(Lx_irq_handler *h) { _handler.append(h); } + }; + + private: + + Server::Entrypoint &_ep; + Lx::List _list; + + Genode::Tslab _context_alloc; + Genode::Tslab _handler_alloc; + + /** + * Find context for given IRQ number + */ + Context *_find_context(unsigned int irq) + { + for (Context *i = _list.first(); i; i = i->next()) + if (i->irq() == irq) + return i; + + return 0; + } + + public: + + /** + * Constructor + */ + Irq(Server::Entrypoint &ep) + : + _ep(ep), + _context_alloc(Genode::env()->heap()), + _handler_alloc(Genode::env()->heap()) + { } + + /** + * Request an IRQ + */ + void request_irq(unsigned int irq, irq_handler_t handler, void *dev, + irq_handler_t thread_fn = 0) + { + Context *ctx = _find_context(irq); + + /* if this IRQ is not registered */ + if (!ctx) + ctx = new (&_context_alloc) Context(_ep, irq); + + /* register Linux handler */ + Lx_irq_handler *h = new (&_handler_alloc) + Lx_irq_handler(dev, handler, thread_fn); + ctx->add_handler(h); + } +}; + + +static Lx::Irq *_lx_irq; + + +void Lx::irq_init(Server::Entrypoint &ep) +{ + static Lx::Irq irq_context(ep); + _lx_irq = &irq_context; +} + + +static void run_irq(void *args) +{ + Lx::Irq::Context *ctx = static_cast(args); + + while (1) { + Lx::scheduler().current()->block_and_schedule(); + + ctx->handle_irq(); + } +} + + +extern "C" { + +/*********************** + ** linux/interrupt.h ** + ***********************/ + +int request_irq(unsigned int irq, irq_handler_t handler, + unsigned long flags, const char *name, void *dev) +{ + _lx_irq->request_irq(irq, handler, dev); + return 0; +} + + +int request_threaded_irq(unsigned int irq, irq_handler_t handler, + irq_handler_t thread_fn, + unsigned long flags, const char *name, + void *dev) +{ + _lx_irq->request_irq(irq, handler, dev, thread_fn); + return 0; +} + +} /* extern "C" */ diff --git a/repos/dde_linux/src/lib/wifi/lx.h b/repos/dde_linux/src/lib/wifi/lx.h new file mode 100644 index 000000000..d15590859 --- /dev/null +++ b/repos/dde_linux/src/lib/wifi/lx.h @@ -0,0 +1,65 @@ +/* + * \brief Lx env + * \author Josef Soentgen + * \date 2014-10-17 + */ + +/* + * Copyright (C) 2014 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +#ifndef _LX_H_ +#define _LX_H_ + +/* Genode includes */ +#include + +/* local includes */ +#include + + +#define DEBUG_COMPLETION 0 +#define DEBUG_DMA 0 +#define DEBUG_DRIVER 0 +#define DEBUG_IRQ 0 +#define DEBUG_KREF 0 +#define DEBUG_PRINTK 1 +#define DEBUG_DEV_DBG 1 +#define DEBUG_PCI 0 +#define DEBUG_SKB 0 +#define DEBUG_SLAB 0 +#define DEBUG_TIMER 0 +#define DEBUG_THREAD 0 +#define DEBUG_TRACE 0 +#define DEBUG_MUTEX 0 +#define DEBUG_SCHEDULING 0 +#define DEBUG_WORK 0 + + +namespace Lx +{ + void timer_init(Server::Entrypoint &); + void timer_update_jiffies(); + + void work_init(Server::Entrypoint &); + + void socket_init(Server::Entrypoint &); + + void nic_init(Server::Entrypoint &); + + void irq_init(Server::Entrypoint &); + + Genode::Ram_dataspace_capability backend_alloc(Genode::addr_t, Genode::Cache_attribute); + void backend_free(Genode::Ram_dataspace_capability); + + void printf(char const *fmt, ...); + void debug_printf(int level, char const *fmt, ...); + + + void get_mac_address(unsigned char *); +} + +#endif /* _LX_H_ */ diff --git a/repos/dde_linux/src/lib/wifi/lxc_emul.c b/repos/dde_linux/src/lib/wifi/lxc_emul.c new file mode 100644 index 000000000..456f015f8 --- /dev/null +++ b/repos/dde_linux/src/lib/wifi/lxc_emul.c @@ -0,0 +1,128 @@ +/** + * \brief Linux emulation code + * \author Josef Soentgen + * \date 2014-03-07 + */ + +/* + * Copyright (C) 2014 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +#include +#include +#include + + +/**************************** + ** asm-generic/getorder.h ** + ****************************/ + +int get_order(unsigned long size) +{ + int order; + + size--; + size >>= PAGE_SHIFT; + + order = __builtin_ctzl(size); + return order; +} + + +/**************************** + ** asm-generic/atomic64.h ** + ****************************/ + +/** + * This is not atomic on 32bit systems but this is not a problem + * because we will not be preempted. + */ +long long atomic64_add_return(long long i, atomic64_t *p) +{ + p->counter += i; + return p->counter; +} + + +/********************************** + ** linux/bitops.h, asm/bitops.h ** + **********************************/ + +unsigned int hweight32(unsigned int w) +{ + w -= (w >> 1) & 0x55555555; + w = (w & 0x33333333) + ((w >> 2) & 0x33333333); + w = (w + (w >> 4)) & 0x0f0f0f0f; + return (w * 0x01010101) >> 24; +} + + +/***************************** + ** linux/platform_device.h ** + *****************************/ + +int platform_device_add_resources(struct platform_device *pdev, + const struct resource *res, unsigned int num) +{ + if (!res || !num) { + pdev->resource = NULL; + pdev->num_resources = 0; + } + + struct resource *r = NULL; + + if (res) { + r = kmemdup(res, sizeof(struct resource) * num, GFP_KERNEL); + if (!r) + return -ENOMEM; + } + + kfree(pdev->resource); + pdev->resource = r; + pdev->num_resources = num; + return 0; +} + + +struct platform_device *platform_device_register_simple(const char *name, int id, + const struct resource *res, + unsigned int num) +{ + struct platform_device *pdev = kzalloc(sizeof (struct platform_device), GFP_KERNEL); + if (!pdev) + return 0; + + size_t len = strlen(name); + pdev->name = kzalloc(len + 1, GFP_KERNEL); + if (!pdev->name) + goto pdev_out; + + memcpy(pdev->name, name, len); + pdev->name[len] = 0; + pdev->id = id; + + int err = platform_device_add_resources(pdev, res, num); + if (err) + goto pdev_name_out; + + return pdev; + +pdev_name_out: + kfree(pdev->name); +pdev_out: + kfree(pdev); + + return 0; +} + + +/*********************** + ** linux/netdevice.h ** + ***********************/ + +void netdev_run_todo() { + __rtnl_unlock(); +} diff --git a/repos/dde_linux/src/lib/wifi/lxcc_emul.cc b/repos/dde_linux/src/lib/wifi/lxcc_emul.cc new file mode 100644 index 000000000..0ef7d26f1 --- /dev/null +++ b/repos/dde_linux/src/lib/wifi/lxcc_emul.cc @@ -0,0 +1,1751 @@ +/** + * \brief Linux emulation code + * \author Josef Soentgen + * \date 2014-03-07 + */ + +/* + * Copyright (C) 2014 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +/* Genode includes */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* local includes */ +#include +#include +#include + +#include +# include +#include + +static bool const verbose = false; +#define PWRNV(...) do { if (verbose) PWRN(__VA_ARGS__); } while (0) + +typedef Genode::size_t size_t; +typedef Genode::addr_t addr_t; + + +namespace Lx { + class Slab_backend_alloc; + class Slab_alloc; +} + +/** + * Back-end allocator for Genode's slab allocator + */ +class Lx::Slab_backend_alloc : public Genode::Allocator, + public Genode::Rm_connection +{ + private: + + enum { + VM_SIZE = 24 * 1024 * 1024, /* size of VM region to reserve */ + BLOCK_SIZE = 1024 * 1024, /* 1 MiB */ + ELEMENTS = VM_SIZE / BLOCK_SIZE, /* MAX number of dataspaces in VM */ + }; + + addr_t _base; /* virt. base address */ + Genode::Cache_attribute _cached; /* non-/cached RAM */ + Genode::Ram_dataspace_capability _ds_cap[ELEMENTS]; /* dataspaces to put in VM */ + addr_t _ds_phys[ELEMENTS]; /* physical bases of dataspaces */ + int _index; /* current index in ds_cap */ + Genode::Allocator_avl _range; /* manage allocations */ + + bool _alloc_block() + { + if (_index == ELEMENTS) { + PERR("Slab-backend exhausted!"); + return false; + } + + try { + _ds_cap[_index] = Lx::backend_alloc(BLOCK_SIZE, _cached); + /* attach at index * BLOCK_SIZE */ + Rm_connection::attach_at(_ds_cap[_index], _index * BLOCK_SIZE, BLOCK_SIZE, 0); + + /* lookup phys. address */ + _ds_phys[_index] = Genode::Dataspace_client(_ds_cap[_index]).phys_addr(); + } catch (...) { return false; } + + /* return base + offset in VM area */ + addr_t block_base = _base + (_index * BLOCK_SIZE); + ++_index; + + _range.add_range(block_base, BLOCK_SIZE); + return true; + } + + public: + + Slab_backend_alloc(Genode::Cache_attribute cached) + : + Rm_connection(0, VM_SIZE), + _cached(cached), _index(0), _range(Genode::env()->heap()) + { + /* reserver attach us, anywere */ + _base = Genode::env()->rm_session()->attach(dataspace()); + } + + /** + * Allocate + */ + bool alloc(size_t size, void **out_addr) + { + bool done = _range.alloc(size, out_addr); + + if (done) + return done; + + done = _alloc_block(); + if (!done) { + PERR("Backend allocator exhausted\n"); + return false; + } + + return _range.alloc(size, out_addr); + } + + void free(void *addr, size_t /* size */) { } + size_t overhead(size_t size) { return 0; } + bool need_size_for_free() const override { return false; } + + /** + * Return phys address for given virtual addr. + */ + addr_t phys_addr(addr_t addr) + { + if (addr < _base || addr >= (_base + VM_SIZE)) + return ~0UL; + + int index = (addr - _base) / BLOCK_SIZE; + + /* physical base of dataspace */ + addr_t phys = _ds_phys[index]; + + if (!phys) + return ~0UL; + + /* add offset */ + phys += (addr - _base - (index * BLOCK_SIZE)); + return phys; + } + + /** + * Translate given physical address to virtual address + * + * \return virtual address, or 0 if no translation exists + */ + addr_t virt_addr(addr_t phys) + { + for (unsigned i = 0; i < ELEMENTS; i++) { + if (_ds_cap[i].valid() && + phys >= _ds_phys[i] && phys < _ds_phys[i] + BLOCK_SIZE) + return _base + i*BLOCK_SIZE + phys - _ds_phys[i]; + } + + PWRN("virt_addr(0x%lx) - no translation", phys); + return 0; + } + + addr_t start() const { return _base; } + addr_t end() const { return _base + VM_SIZE - 1; } + + /** + * Cached memory backend allocator + */ + static Slab_backend_alloc & mem() + { + static Slab_backend_alloc inst(Genode::CACHED); + return inst; + } + + /** + * DMA memory backend allocator + */ + static Slab_backend_alloc & dma() + { + static Slab_backend_alloc inst(Genode::UNCACHED); + return inst; + } +}; + + +/** + * Slab allocator using our back-end allocator + */ +class Lx::Slab_alloc : public Genode::Slab +{ + private: + + /* + * Each slab block in the slab contains about 8 objects (slab entries) + * as proposed in the paper by Bonwick and block sizes are multiples of + * page size. + */ + static size_t _calculate_block_size(size_t object_size) + { + size_t block_size = 8 * (object_size + sizeof(Genode::Slab_entry)) + + sizeof(Genode::Slab_block); + return Genode::align_addr(block_size, 12); + } + + public: + + Slab_alloc(size_t object_size, Slab_backend_alloc &allocator) + : Slab(object_size, _calculate_block_size(object_size), 0, &allocator) { } + + /** + * Convenience slabe-entry allocation + */ + addr_t alloc() + { + addr_t result; + return (Slab::alloc(slab_size(), (void **)&result) ? result : 0); + } +}; + + +/** + * Memory interface used for Linux emulation + */ +class Malloc +{ + private: + + enum { + SLAB_START_LOG2 = 3, /* 8 B */ + SLAB_STOP_LOG2 = 16, /* 64 KiB */ + NUM_SLABS = (SLAB_STOP_LOG2 - SLAB_START_LOG2) + 1, + }; + + typedef Genode::addr_t addr_t; + typedef Lx::Slab_alloc Slab_alloc; + typedef Lx::Slab_backend_alloc Slab_backend_alloc; + + Slab_backend_alloc &_back_allocator; + Slab_alloc *_allocator[NUM_SLABS]; + Genode::Cache_attribute _cached; /* cached or un-cached memory */ + addr_t _start; /* VM region of this allocator */ + addr_t _end; + + /** + * Set 'value' at 'addr' + */ + void _set_at(addr_t addr, addr_t value) { *((addr_t *)addr) = value; } + + /** + * Retrieve slab index belonging to given address + */ + unsigned _slab_index(Genode::addr_t **addr) + { + using namespace Genode; + /* get index */ + addr_t index = *(*addr - 1); + + /* + * If index large, we use aligned memory, retrieve beginning of slab entry + * and read index from there + */ + if (index > 32) { + *addr = (addr_t *)*(*addr - 1); + index = *(*addr - 1); + } + + return index; + } + + /** + * Get the originally requested size of the allocation + */ + size_t _get_orig_size(Genode::addr_t **addr) + { + using namespace Genode; + + addr_t index = *(*addr - 1); + if (index > 32) { + *addr = (addr_t *) * (*addr - 1); + } + + return *(*addr - 2); + } + + public: + + Malloc(Slab_backend_alloc &alloc, Genode::Cache_attribute cached) + : + _back_allocator(alloc), _cached(cached), _start(alloc.start()), + _end(alloc.end()) + { + /* init slab allocators */ + for (unsigned i = SLAB_START_LOG2; i <= SLAB_STOP_LOG2; i++) + _allocator[i - SLAB_START_LOG2] = new (Genode::env()->heap()) + Slab_alloc(1U << i, alloc); + } + + /** + * Alloc in slabs + */ + void *alloc(Genode::size_t size, int align = 0, Genode::addr_t *phys = 0) + { + using namespace Genode; + + /* save requested size */ + size_t orig_size = size; + size += sizeof(addr_t); + + /* += slab index + aligment size */ + size += sizeof(addr_t) + (align > 2 ? (1 << align) : 0); + + int msb = Genode::log2(size); + + if (size > (1U << msb)) + msb++; + + if (size < (1U << SLAB_START_LOG2)) + msb = SLAB_STOP_LOG2; + + if (msb > SLAB_STOP_LOG2) { + PERR("Slab too large %u reqested %zu cached %d", 1U << msb, size, _cached); + return 0; + } + + addr_t addr = _allocator[msb - SLAB_START_LOG2]->alloc(); + if (!addr) { + PERR("Failed to get slab for %u", 1 << msb); + return 0; + } + + _set_at(addr, orig_size); + addr += sizeof(addr_t); + + _set_at(addr, msb - SLAB_START_LOG2); + addr += sizeof(addr_t); + + if (align > 2) { + /* save */ + addr_t ptr = addr; + addr_t align_val = (1U << align); + addr_t align_mask = align_val - 1; + /* align */ + addr = (addr + align_val) & ~align_mask; + /* write start address before aligned address */ + _set_at(addr - sizeof(addr_t), ptr); + } + + if (phys) + *phys = _back_allocator.phys_addr(addr); + return (addr_t *)addr; + } + + void free(void const *a) + { + using namespace Genode; + addr_t *addr = (addr_t *)a; + + /* XXX changes addr */ + unsigned nr = _slab_index(&addr); + /* we need to decrease addr by 2, orig_size and index come first */ + _allocator[nr]->free((void *)(addr - 2)); + } + + size_t size(void const *a) + { + using namespace Genode; + addr_t *addr = (addr_t *)a; + + /* XXX changes addr */ + return _get_orig_size(&addr); + } + + Genode::addr_t phys_addr(void *a) + { + return _back_allocator.phys_addr((addr_t)a); + } + + Genode::addr_t virt_addr(Genode::addr_t phys) + { + return _back_allocator.virt_addr(phys); + } + + /** + * Belongs given address to this allocator + */ + bool inside(addr_t const addr) const { return (addr > _start) && (addr <= _end); } + + /** + * Cached memory allocator + */ + static Malloc & mem() + { + static Malloc inst(Slab_backend_alloc::mem(), Genode::CACHED); + return inst; + } + + /** + * DMA memory allocator + */ + static Malloc & dma() + { + static Malloc inst(Slab_backend_alloc::dma(), Genode::UNCACHED); + return inst; + } +}; + + +void Lx::debug_printf(int level, char const *fmt, ...) +{ + if (level) { + va_list va; + va_start(va, fmt); + Genode::vprintf(fmt, va); + va_end(va); + } +} + + +void Lx::printf(char const *fmt, ...) +{ + va_list va; + va_start(va, fmt); + Genode::vprintf(fmt, va); + va_end(va); +} + + +extern "C" void lx_printf(char const *fmt, ...) +{ + va_list va; + va_start(va, fmt); + Genode::vprintf(fmt, va); + va_end(va); +} + + +extern "C" void lx_vprintf(char const *fmt, va_list va) { + Genode::vprintf(fmt, va); } + + +/******************** + ** linux/string.h ** + ********************/ + +size_t strlen(const char *s) +{ + return Genode::strlen(s); +} + + +int strcmp(const char* s1, const char *s2) +{ + return Genode::strcmp(s1, s2); +} + + +int strncmp(const char *s1, const char *s2, size_t len) +{ + return Genode::strcmp(s1, s2, len); +} + + +char *strchr(const char *p, int ch) +{ + char c; + c = ch; + for (;; ++p) { + if (*p == c) + return ((char *)p); + if (*p == '\0') + break; + } + + return 0; +} + + +void *memchr(const void *s, int c, size_t n) +{ + const unsigned char *p = (unsigned char *)s; + while (n-- != 0) { + if ((unsigned char)c == *p++) { + return (void *)(p - 1); + } + } + return NULL; +} + + +char *strnchr(const char *p, size_t count, int ch) +{ + char c; + c = ch; + for (; count; ++p, count--) { + if (*p == c) + return ((char *)p); + if (*p == '\0') + break; + } + + return 0; +} + + +char *strcpy(char *dst, const char *src) +{ + char *p = dst; + + while ((*dst = *src)) { + ++src; + ++dst; + } + + return p; +} + + +size_t strlcpy(char *dest, const char *src, size_t size) +{ + size_t ret = strlen(src); + + if (size) { + size_t len = (ret >= size) ? size - 1 : ret; + Genode::memcpy(dest, src, len); + dest[len] = '\0'; + } + return ret; +} + + +int sprintf(char *str, const char *format, ...) +{ + enum { BUFFER_LEN = 128 }; + va_list list; + + va_start(list, format); + Genode::String_console sc(str, BUFFER_LEN); + sc.vprintf(format, list); + va_end(list); + + return sc.len(); +} + + +int snprintf(char *str, size_t size, const char *format, ...) +{ + va_list list; + + va_start(list, format); + Genode::String_console sc(str, size); + sc.vprintf(format, list); + va_end(list); + + return sc.len(); +} + + +int vsnprintf(char *str, size_t size, const char *format, va_list args) +{ + Genode::String_console sc(str, size); + sc.vprintf(format, args); + + return sc.len(); +} + + +int scnprintf(char *buf, size_t size, const char *fmt, ...) +{ + va_list args; + + va_start(args, fmt); + Genode::String_console sc(buf, size); + sc.vprintf(fmt, args); + va_end(args); + + return sc.len(); +} + + +size_t strnlen(const char *s, size_t maxlen) +{ + size_t c; + for (c = 0; c 0) { + if (iov->iov_len) { + size_t copy_len = (size_t)len < iov->iov_len ? len : iov->iov_len; + Genode::memcpy(kdata, iov->iov_base, copy_len); + + len -= copy_len; + kdata += copy_len; + iov->iov_base = (unsigned char *)iov->iov_base + copy_len; + iov->iov_len -= copy_len; + } + iov++; + } + + return 0; +} + + +int memcpy_toiovec(struct iovec *iov, unsigned char *kdata, int len) +{ + while (len > 0) { + if (iov->iov_len) { + size_t copy_len = (size_t)len < iov->iov_len ? len : iov->iov_len; + Genode::memcpy(iov->iov_base, kdata, copy_len); + + len -= copy_len; + kdata += copy_len; + iov->iov_base = (unsigned char *)iov->iov_base + copy_len; + iov->iov_len -= copy_len; + } + iov++; + } + + return 0; +} + + +/******************** + ** linux/socket.h ** + ********************/ + +extern "C" int memcpy_fromiovecend(unsigned char *kdata, const struct iovec *iov, + int offset, int len) +{ + while (offset >= (int)iov->iov_len) { + offset -= iov->iov_len; + iov++; + } + + while (len > 0) { + u8 *base = ((u8*) iov->iov_base) + offset; + size_t copy_len = len < (int)iov->iov_len - offset ? len : iov->iov_len - offset; + + offset = 0; + Genode::memcpy(kdata, base, copy_len); + + len -= copy_len; + kdata += copy_len; + iov++; + } + + return 0; +} + + +/********************** + ** Memory allocation * + **********************/ + +void *kmalloc(size_t size, gfp_t flags) +{ + if (flags & __GFP_DMA) + PWRN("GFP_DMA memory (below 16 MiB) requested (%p)", __builtin_return_address(0)); + if (flags & __GFP_DMA32) + PWRN("GFP_DMA32 memory (below 4 GiB) requested (%p)", __builtin_return_address(0)); + + void *addr = flags & GFP_LX_DMA ? Malloc::dma().alloc(size, 12) + : Malloc::mem().alloc(size); + + if ((addr_t)addr & 0x3) + PERR("unaligned kmalloc %lx", (addr_t)addr); + + if (flags & __GFP_ZERO) + Genode::memset(addr, 0, size); + + return addr; +} + + +void *kzalloc(size_t size, gfp_t flags) +{ + return kmalloc(size, flags | __GFP_ZERO); +} + + +void *kzalloc_node(size_t size, gfp_t flags, int node) +{ + return kzalloc(size, 0); +} + + +void *kcalloc(size_t n, size_t size, gfp_t flags) +{ + if (size != 0 && n > (~0UL / size)) + return 0; + + return kzalloc(n * size, flags); +} + + +void kfree(void const *p) +{ + if (!p) return; + + if (Malloc::mem().inside((Genode::addr_t)p)) + Malloc::mem().free(p); + else if (Malloc::dma().inside((Genode::addr_t)p)) + Malloc::dma().free(p); + else + PERR("%s: unknown block at %p, called from %p", __func__, + p, __builtin_return_address(0)); +} + + +void kzfree(void const *p) +{ + if (!p) return; + + size_t len = ksize(const_cast(p)); + + Genode::memset((void*)p, 0, len); + + kfree(p); +} + + +void *kmalloc_node_track_caller(size_t size, gfp_t flags, int node) +{ + return kmalloc(size, flags); +} + + +static size_t _ksize(void *p) +{ + size_t size = 0; + + if (Malloc::mem().inside((Genode::addr_t)p)) + size = Malloc::mem().size(p); + else if (Malloc::dma().inside((Genode::addr_t)p)) + size = Malloc::dma().size(p); + else + PERR("%s: unknown block at %p", __func__, p); + + return size; +} + + +size_t ksize(void *p) +{ + return _ksize(p); +} + + +void *krealloc(void *p, size_t size, gfp_t flags) +{ + /* XXX handle short-cut where size == old_size */ + void *addr = kmalloc(size, flags); + + if (addr && p) { + size_t old_size = _ksize(p); + + Genode::memcpy(addr, p, old_size); + kfree(p); + } + + return addr; +} + + +void *kmemdup(const void *src, size_t size, gfp_t flags) +{ + void *addr = kmalloc(size, flags); + + if (addr) + Genode::memcpy(addr, src, size); + + return addr; +} + + +/****************** + ** linux/slab.h ** + ******************/ + +struct kmem_cache : Lx::Slab_alloc +{ + kmem_cache(size_t object_size, bool dma) + : + Lx::Slab_alloc(object_size, dma ? Lx::Slab_backend_alloc::dma() + : Lx::Slab_backend_alloc::mem()) + { } +}; + + +struct kmem_cache *kmem_cache_create(const char *name, size_t size, size_t align, + unsigned long flags, void (*ctor)(void *)) +{ + if (ctor) { + PERR("%s: ctor not supported", __func__); + return nullptr; + } + + return new (Genode::env()->heap()) kmem_cache(size, flags & SLAB_LX_DMA); +} + + +void * kmem_cache_alloc(struct kmem_cache *cache, gfp_t flags) +{ + return (void *)cache->alloc(); +} + + +void kmem_cache_free(struct kmem_cache *cache, void *objp) +{ + cache->free(objp); +} + + +/********************* + ** linux/vmalloc.h ** + *********************/ + +void *vmalloc(unsigned long size) +{ + size_t real_size = size + sizeof(size_t); + size_t *addr; + try { addr = (size_t *)Genode::env()->heap()->alloc(real_size); } + catch (...) { return 0; } + + *addr = real_size; + return addr + 1; +} + + +void vfree(const void *addr) +{ + if (!addr) return; + + size_t size = *(((size_t *)addr) - 1); + Genode::env()->heap()->free(const_cast(addr), size); +} + + +/******************** + ** linux/string.h ** + ********************/ + +int memcmp(const void *p0, const void *p1, size_t size) { + return Genode::memcmp(p0, p1, size); } + + +/******************** + ** linux/device.h ** + ********************/ + +/** + * Simple driver management class + */ +class Driver : public Genode::List::Element +{ + private: + + struct device_driver *_drv; /* Linux driver */ + + public: + + Driver(struct device_driver *drv) : _drv(drv) + { + list()->insert(this); + } + + /** + * List of all currently registered drivers + */ + static Genode::List *list() + { + static Genode::List _list; + return &_list; + } + + /** + * Match device and drivers + */ + bool match(struct device *dev) + { + /* + * Don't try if buses don't match, since drivers often use 'container_of' + * which might cast the device to non-matching type + */ + if (_drv->bus != dev->bus) + return false; + + bool ret = _drv->bus->match ? _drv->bus->match(dev, _drv) : true; + return ret; + } + + /** + * Probe device with driver + */ + int probe(struct device *dev) + { + dev->driver = _drv; + + if (dev->bus->probe) { + return dev->bus->probe(dev); + } else if (_drv->probe) { + return _drv->probe(dev); + } + + return 0; + } +}; + + +int driver_register(struct device_driver *drv) +{ + new (Genode::env()->heap()) Driver(drv); + return 0; +} + +int device_add(struct device *dev) +{ + if (dev->driver) + return 0; + + /* foreach driver match and probe device */ + for (Driver *driver = Driver::list()->first(); driver; driver = driver->next()) + if (driver->match(dev)) { + int ret = driver->probe(dev); + + if (!ret) + return 0; + } + + return 0; +} + + +int device_register(struct device *dev) +{ + //XXX: initialize DMA pools (see device_initialize) + return device_add(dev); +} + + +void *dev_get_drvdata(const struct device *dev) +{ + return dev->driver_data; +} + + +int dev_set_drvdata(struct device *dev, void *data) +{ + dev->driver_data = data; return 0; +} + + +const char *dev_name(const struct device *dev) { return dev->name; } + + +int dev_set_name(struct device *dev, const char *fmt, ...) +{ + enum { MAX_DEV_LEN = 64 }; + /* XXX needs to be freed */ + char *name = (char*)kmalloc(MAX_DEV_LEN, 0); + if (!name) + return 1; + + va_list list; + va_start(list, fmt); + Genode::String_console sc(name, MAX_DEV_LEN); + sc.vprintf(fmt, list); + + va_end(list); + + dev->name = name; + return 0; +} + + +/******************** + ** linux/kernel.h ** + ********************/ + +int strict_strtoul(const char *s, unsigned int base, unsigned long *res) +{ + unsigned long r = -EINVAL; + Genode::ascii_to(s, &r, base); + *res = r; + + return r; +} + + +/******************* + ** linux/delay.h ** + *******************/ + +static Timer::Connection _timer; + + +void udelay(unsigned long usecs) { _timer.usleep(usecs); } +void usleep_range(unsigned long min, unsigned long max) { _timer.usleep(min); } +void msleep(unsigned int msecs) { _timer.msleep(msecs); } +void mdelay(unsigned long msecs) { msleep(msecs); } + + +/********************* + ** linux/jiffies.h ** + *********************/ + +enum { + JIFFIES_TICK_MS = 1000/HZ, + JIFFIES_TICK_US = 1000*1000/HZ, +}; + +unsigned long msecs_to_jiffies(const unsigned int m) { return m / JIFFIES_TICK_MS; } +unsigned int jiffies_to_msecs(const unsigned long j) { return j * JIFFIES_TICK_MS; } +unsigned long usecs_to_jiffies(const unsigned int u) { return u / JIFFIES_TICK_US; } + + +/******************* + ** linux/timer.h ** + *******************/ + +static unsigned long round_jiffies(unsigned long j, bool force_up) +{ + unsigned remainder = j % HZ; + + /* + * from timer.c + * + * If the target jiffie is just after a whole second (which can happen + * due to delays of the timer irq, long irq off times etc etc) then + * we should round down to the whole second, not up. Use 1/4th second + * as cutoff for this rounding as an extreme upper bound for this. + * But never round down if @force_up is set. + */ + + /* per default round down */ + j = j - remainder; + + /* round up if remainder more than 1/4 second (or if we're forced to) */ + if (remainder >= HZ/4 || force_up) + j += HZ; + + return j; +} + +unsigned long round_jiffies(unsigned long j) +{ + return round_jiffies(j, false); +} + + +unsigned long round_jiffies_up(unsigned long j) +{ + return round_jiffies(j, true); +} + + +unsigned long round_jiffies_relative(unsigned long j) +{ + return round_jiffies(j + jiffies, false) - jiffies; +} + + +/*********************** + ** linux/workqueue.h ** + ***********************/ + +struct workqueue_struct *create_singlethread_workqueue(char const *) +{ + workqueue_struct *wq = (workqueue_struct *)kzalloc(sizeof(workqueue_struct), 0); + return wq; +} + +struct workqueue_struct *alloc_ordered_workqueue(char const *name , unsigned int flags, ...) +{ + return create_singlethread_workqueue(name); +} + + +/********************** + ** linux/firmware.h ** + **********************/ + +extern Firmware_list fw_list[]; +extern size_t fw_list_len; + + +int request_firmware_nowait(struct module *module, bool uevent, + const char *name, struct device *device, + gfp_t gfp, void *context, + void (*cont)(const struct firmware *, void *)) +{ + /* only try to load known firmware images */ + Firmware_list *fwl = 0; + for (size_t i = 0; i < fw_list_len; i++) { + if (Genode::strcmp(name, fw_list[i].name) == 0) { + fwl = &fw_list[i]; + break; + } + } + + if (!fwl) { + PERR("firmware '%s' is not in the firmware white list.", name); + return -1; + } + + Genode::Rom_connection rom(fwl->name); + Genode::Dataspace_capability ds_cap = rom.dataspace(); + + if (!ds_cap.valid()) + return -1; + + firmware *fw = (firmware *)kzalloc(sizeof (firmware), 0); + if (!fw) { + PERR("could not allocate memory for struct firmware"); + return -1; + } + + /* use dde_kit_large_malloc because our slab only goes up to 64KiB */ + fw->data = (u8*)Genode::env()->heap()->alloc(fwl->size); + if (!fw->data) { + PERR("could not allocate memory for firmware image"); + kfree(fw); + return -1; + } + + void const *image = Genode::env()->rm_session()->attach(ds_cap); + Genode::memcpy((void*)fw->data, image, fwl->size); + Genode::env()->rm_session()->detach(image); + + fw->size = fwl->size; + + cont(fw, context); + + return 0; +} + +void release_firmware(const struct firmware *fw) +{ + Genode::env()->heap()->free(const_cast(fw->data), fw->size); + kfree(fw); +} + + +/************************* + ** linux/dma-mapping.h ** + *************************/ + +void *dma_alloc_coherent(struct device *dev, size_t size, + dma_addr_t *dma_handle, gfp_t flag) +{ + dma_addr_t dma_addr; + void *addr = Malloc::dma().alloc(size, 12, &dma_addr); + + if (!addr) { + PERR("dma alloc: %zu failed", size); + return 0; + } + + *dma_handle = dma_addr; + + return addr; +} + + +void *dma_zalloc_coherent(struct device *dev, size_t size, + dma_addr_t *dma_handle, gfp_t flag) +{ + void *addr = dma_alloc_coherent(dev, size, dma_handle, flag); + + if (addr) + Genode::memset(addr, 0, size); + + return addr; +} + + +void dma_free_coherent(struct device *dev, size_t size, + void *vaddr, dma_addr_t dma_handle) +{ + if (Malloc::dma().inside((Genode::addr_t)vaddr)) + Malloc::dma().free(vaddr); + else + PERR("vaddr: %p is not DMA memory", vaddr); +} + + +dma_addr_t dma_map_page(struct device *dev, struct page *page, + size_t offset, size_t size, + enum dma_data_direction direction) +{ + if (!Malloc::dma().inside((Genode::addr_t)page->addr)) + PERR("page->page: %p not DMA address", page->addr); + + dma_addr_t dma_addr = (dma_addr_t) Malloc::dma().phys_addr(page->addr); + + if (dma_addr == ~0UL) + PERR("%s: virtual address %p not registered for DMA, called from: %p", + __func__, page->addr, __builtin_return_address(0)); + + return dma_addr; +} + +dma_addr_t dma_map_single(struct device *dev, void *cpu_addr, size_t size, + enum dma_data_direction direction) +{ + dma_addr_t dma_addr = (dma_addr_t) Malloc::dma().phys_addr(cpu_addr); + + if (dma_addr == ~0UL) + PERR("%s: virtual address %p not registered for DMA, called from: %p", + __func__, cpu_addr, __builtin_return_address(0)); + + + return dma_addr; +} + + +int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) +{ + return (dma_addr == ~0UL) ? 1 : 0; +} + + +/******************** + ** linux/dcache.h ** + ********************/ + +unsigned int full_name_hash(const unsigned char *name, unsigned int len) +{ + unsigned hash = 0, i; + for (i = 0; i < len; i++) + hash += name[i]; + + return hash; +} + + +/****************** + ** linux/hash.h ** + ******************/ + +u32 hash_32(u32 val, unsigned int bits) +{ + enum { GOLDEN_RATIO_PRIME_32 = 0x9e370001UL }; + u32 hash = val * GOLDEN_RATIO_PRIME_32; + + hash = hash >> (32 - bits); + return hash; +} + + +/***************** + ** linux/gfp.h ** + *****************/ + +class Addr_to_page_mapping : public Genode::List::Element +{ + private: + + unsigned long _addr { 0 }; + struct page *_page { 0 }; + + static Genode::List *_list() + { + static Genode::List _l; + return &_l; + } + + public: + + Addr_to_page_mapping(unsigned long addr, struct page *page) + : _addr(addr), _page(page) { } + + static void insert(struct page *page) + { + Addr_to_page_mapping *m = (Addr_to_page_mapping*) + Malloc::mem().alloc(sizeof (Addr_to_page_mapping)); + + m->_addr = (unsigned long)page->addr; + m->_page = page; + + _list()->insert(m); + } + + static void remove(struct page *page) + { + Addr_to_page_mapping *mp = 0; + for (Addr_to_page_mapping *m = _list()->first(); m; m = m->next()) + if (m->_page == page) + mp = m; + + if (mp) { + _list()->remove(mp); + Malloc::mem().free(mp); + } + } + + static struct page* find_page(unsigned long addr) + { + for (Addr_to_page_mapping *m = _list()->first(); m; m = m->next()) + if (m->_addr == addr) + return m->_page; + + return 0; + } +}; + + +unsigned long get_zeroed_page(gfp_t gfp_mask) +{ + struct page *p = alloc_pages(gfp_mask, 0); + if (!p) + return 0UL; + + Genode::memset(p->addr, 0, PAGE_SIZE); + + return (unsigned long)p->addr; +} + + +struct page *alloc_pages(gfp_t gfp_mask, unsigned int order) +{ + struct page *page = (struct page *)kzalloc(sizeof(struct page), 0); + + size_t size = PAGE_SIZE << order; + + page->addr = Malloc::dma().alloc(size, 12); + + if (!page->addr) { + PERR("alloc_pages: %zu failed", size); + kfree(page); + return 0; + } + + Addr_to_page_mapping::insert(page); + + atomic_set(&page->_count, 1); + + return page; +} + + +void __free_pages(struct page *page, unsigned int order) +{ + if (!atomic_dec_and_test(&page->_count)) { + PWRNV("attempting to free page %p with _count: %d, called from: %p", + page, atomic_read(&page->_count), __builtin_return_address(0)); + return; + } + + Addr_to_page_mapping::remove(page); + + Malloc::dma().free(page->addr); + kfree(page); +} + + +void free_pages(unsigned long page, unsigned int order) +{ + struct page *p = Addr_to_page_mapping::find_page(page); + __free_pages(p, order); +} + + +/**************** + ** linux/mm.h ** + ****************/ + +struct page *virt_to_head_page(const void *addr) +{ + struct page *page = Addr_to_page_mapping::find_page((unsigned long)addr); + if (!page) { + /** + * Linux uses alloc_pages() to allocate memory but passes addr + offset + * to the caller (e.g. __netdev_alloc_frag()). Therefore, we also try to + * find the aligned addr in our page mapping list. + */ + unsigned long aligned_addr = (unsigned long)addr & ~0xfff; + page = Addr_to_page_mapping::find_page(aligned_addr); + if (!page) { + PERR("BUG: addr: %p and aligned addr: %p have no page mapping, " + " called from: %p", addr, (void*)aligned_addr, + __builtin_return_address(0)); + Genode::sleep_forever(); + } + } + + return page; +} + + +void get_page(struct page *page) +{ + atomic_inc(&page->_count); +} + + +void put_page(struct page *page) +{ + if (!atomic_dec_and_test(&page->_count)) + return; + + Malloc::dma().free(page->addr); + kfree(page); +} + + +/******************************* + ** asm-generic/bitops/find.h ** + *******************************/ + +unsigned long find_next_bit(const unsigned long *addr, unsigned long size, + unsigned long offset) +{ + unsigned long i, j; + + for (i = offset; i < (size / BITS_PER_LONG); i++) + if (addr[i] == ~0UL) + break; + + if (i == size) + return size; + + for (j = 0; j < BITS_PER_LONG; j++) + if ((addr[i]) & (1UL << j)) + break; + + return (i * BITS_PER_LONG) + j; +} + + +unsigned long find_next_zero_bit(unsigned long const *addr, unsigned long size, + unsigned long offset) +{ + unsigned long i, j; + + for (i = offset; i < (size / BITS_PER_LONG); i++) + if (addr[i] != ~0UL) + break; + + if (i == size) + return size; + + for (j = 0; j < BITS_PER_LONG; j++) + if ((~addr[i]) & (1UL << j)) + break; + + return (i * BITS_PER_LONG) + j; +} + + +/********************** + ** linux/notifier.h ** + **********************/ + +int raw_notifier_chain_register(struct raw_notifier_head *nh, + struct notifier_block *n) +{ + struct notifier_block *nl = nh->head; + struct notifier_block *pr = 0; + while (nl) { + if (n->priority > nl->priority) + break; + pr = nl; + nl = nl->next; + } + + n->next = nl; + if (pr) + pr->next = n; + else + nh->head = n; + + return 0; +} + + +int raw_notifier_call_chain(struct raw_notifier_head *nh, + unsigned long val, void *v) +{ + int ret = NOTIFY_DONE; + struct notifier_block *nb = nh->head; + + while (nb) { + + ret = nb->notifier_call(nb, val, v); + if ((ret & NOTIFY_STOP_MASK) == NOTIFY_STOP_MASK) + break; + + nb = nb->next; + } + + return ret; +} + + +/******************** + ** linux/percpu.h ** + ********************/ + +void *__alloc_percpu(size_t size, size_t align) +{ + return kmalloc(size, 0); +} + + +/******************************* + ** net/core/net/namespace.h ** + *******************************/ + +int register_pernet_subsys(struct pernet_operations *ops) +{ + if (ops->init) + ops->init(&init_net); + + return 0; +} + + +int register_pernet_device(struct pernet_operations *ops) +{ + return register_pernet_subsys(ops); +} + + +/************************** + ** core/net_namespace.c ** + **************************/ + +DEFINE_MUTEX(net_mutex); + + +/******************* + ** kernel/kmod.c ** + *******************/ + +extern "C" void module_iwl_init(void); +extern "C" void module_iwl_mvm_init(void); + + +int __request_module(bool wait, char const *format, ...) +{ + va_list list; + char buf[128]; + + va_start(list, format); + Genode::String_console sc(buf, sizeof(buf)); + sc.vprintf(format, list); + va_end(list); + + return 0; +} + + +/* XXX request_module() should not hardcode module names */ +int request_module(char const* format, ...) +{ + va_list list; + char buf[128]; + + va_start(list, format); + Genode::String_console sc(buf, sizeof(buf)); + sc.vprintf(format, list); + va_end(list); + + if (Genode::strcmp(buf, "iwldvm", 6) == 0) { + module_iwl_init(); + return 0; + } + else if (Genode::strcmp(buf, "iwlmvm", 6) == 0) { + module_iwl_mvm_init(); + return 0; + } + else if (Genode::strcmp(buf, "ccm(aes)", 7) == 0) { + return 0; + } + else if (Genode::strcmp(buf, "cryptomgr", 9) == 0) { + return 0; + } + + return -1; +} + + +/**************************** + ** kernel/locking/mutex.c ** + ****************************/ + +enum { MUTEX_UNLOCKED = 1, MUTEX_LOCKED = 0, MUTEX_WAITERS = -1 }; + +void mutex_init(struct mutex *m) +{ + static unsigned id = 0; + + m->state = MUTEX_UNLOCKED; + m->holder = nullptr; + m->waiters = new (Genode::env()->heap()) Lx::Task::List; + m->id = ++id; +} + + +void mutex_destroy(struct mutex *m) +{ + /* FIXME potentially blocked tasks are not unblocked */ + + Genode::destroy(Genode::env()->heap(), static_cast(m->waiters)); + + m->holder = nullptr; + m->waiters = nullptr; + m->id = 0; +} + + +void mutex_lock(struct mutex *m) +{ + while (1) { + if (m->state == MUTEX_UNLOCKED) { + m->state = MUTEX_LOCKED; + m->holder = Lx::scheduler().current(); + + break; + } + + Lx::Task *t = reinterpret_cast(m->holder); + + if (t == Lx::scheduler().current()) { + PERR("Bug: mutex does not support recursive locking"); + Genode::sleep_forever(); + } + + /* notice that a task waits for the mutex to be released */ + m->state = MUTEX_WAITERS; + + /* block until the mutex is released (and retry then) */ + Lx::scheduler().current()->mutex_block(static_cast(m->waiters)); + Lx::scheduler().current()->schedule(); + } +} + + +void mutex_unlock(struct mutex *m) +{ + if (m->state == MUTEX_UNLOCKED) { + PERR("Bug: multiple mutex unlock detected"); + Genode::sleep_forever(); + } + if (m->holder != Lx::scheduler().current()) { + PERR("Bug: mutex unlock by task not holding the mutex"); + Genode::sleep_forever(); + } + + Lx::Task::List *waiters = static_cast(m->waiters); + + if (m->state == MUTEX_WAITERS) + while (Lx::Task::List_element *le = waiters->first()) + le->object()->mutex_unblock(waiters); + + m->state = MUTEX_UNLOCKED; + m->holder = nullptr; +} + + +int mutex_is_locked(struct mutex *m) +{ + return m->state != MUTEX_UNLOCKED; +} + + +int mutex_trylock(struct mutex *m) +{ + if (mutex_is_locked(m)) + return false; + + mutex_lock(m); + return true; +} + + +/****************** + ** linux/poll.h ** + ******************/ + +bool poll_does_not_wait(const poll_table *p) +{ + return p == nullptr; +} + + +/********************* + ** linux/kthread.h ** + *********************/ + +void *kthread_run(int (*threadfn)(void *), void *data, char const *name) +{ + threadfn(data); + + return (void*)42; +} diff --git a/repos/dde_linux/src/lib/wifi/nic.cc b/repos/dde_linux/src/lib/wifi/nic.cc new file mode 100644 index 000000000..4af56cb96 --- /dev/null +++ b/repos/dde_linux/src/lib/wifi/nic.cc @@ -0,0 +1,585 @@ +/* + * \brief Glue code for Linux network drivers + * \author Sebastian Sumpf + * \author Josef Soentgen + * \date 2012-07-05 + */ + +/* + * Copyright (C) 2012-2013 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +/* Genode includes */ +#include +#include +#include +#include +#include +#include +#include + +/* local includes */ +#include +#include + +#include +# include +# include +#include + + +enum { + HEAD_ROOM = 128, /* XXX guessed value but works */ +}; + +/** + * Net_device to session glue code + */ +class Nic_device : public Nic::Device +{ + public: /* FIXME */ + + struct net_device *_ndev; + Nic::Session_component *_session = nullptr; + bool _has_link = false; + + public: + + Nic_device(struct net_device *ndev) : _ndev(ndev) { } + + void rx(sk_buff *skb) + { + /* get mac header back */ + skb_push(skb, ETH_HLEN); + + void *packet = skb->data; + size_t packet_size = ETH_HLEN; + void *frag = 0; + size_t frag_size = 0; + + /** + * If received packets are too large (as of now 128 bytes) the actually + * payload is put into a fragment. Otherwise the payload is stored directly + * in the sk_buff. + */ + if (skb_shinfo(skb)->nr_frags) { + if (skb_shinfo(skb)->nr_frags > 1) + PERR("more than 1 fragment in skb"); + + skb_frag_t *f = &skb_shinfo(skb)->frags[0]; + frag = skb_frag_address(f); + frag_size = skb_frag_size(f); + } + else + packet_size += skb->len; + + _session->rx((Genode::addr_t)packet, packet_size, (Genode::addr_t)frag, frag_size); + } + + /** + * Report link state + */ + void link_state(bool link) + { + /* only report changes of the link state */ + if (link == _has_link) + return; + + _has_link = link; + + if (_session) + _session->link_state_changed(); + } + + /********************** + ** Device interface ** + **********************/ + + void session(Nic::Session_component *s) override { _session = s; } + + Nic::Mac_address mac_address() override + { + Nic::Mac_address m; + Genode::memcpy(&m, _ndev->perm_addr, ETH_ALEN); + return m; + } + + bool link_state() override { return _has_link; } + + bool tx(Genode::addr_t virt, Genode::size_t size) override + { + struct sk_buff *skb = ::alloc_skb(size + HEAD_ROOM, GFP_KERNEL); + skb_reserve(skb, HEAD_ROOM); + + unsigned char *data = skb_put(skb, size); + Genode::memcpy(data, (void*)virt, size); + + _ndev->netdev_ops->ndo_start_xmit(skb, _ndev); + return true; + } +}; + + +static Nic_device *_nic = 0; + +static Server::Entrypoint *_ep; + +void Lx::nic_init(Server::Entrypoint &ep) { + _ep = &ep; } + + +void Lx::get_mac_address(unsigned char *addr) +{ + Genode::memcpy(addr, _nic->_ndev->perm_addr, ETH_ALEN); +} + + +namespace Lx { + class Notifier; +} + +class Lx::Notifier +{ + private: + + struct Block : public Genode::List::Element + { + struct notifier_block *nb; + + Block(struct notifier_block *nb) : nb(nb) { } + }; + + Lx::List _list; + Genode::Tslab _block_alloc; + + public: + + Notifier() : _block_alloc(Genode::env()->heap()) { } + + void register_block(struct notifier_block *nb) + { + Block *b = new (&_block_alloc) Block(nb); + _list.insert(b); + } + + void unregister_block(struct notifier_block *nb) + { + for (Block *b = _list.first(); b; b = b->next()) + if (b->nb == nb) { + _list.remove(b); + destroy(&_block_alloc, b); + break; + } + } + + int call_all_blocks(unsigned long val, void *v) + { + int rv = NOTIFY_DONE; + for (Block *b = _list.first(); b; b = b->next()) { + rv = b->nb->notifier_call(b->nb, val, v); + if (rv & NOTIFY_STOP_MASK) + break; + } + return rv; + } +}; + + +/* XXX move blocking_notifier_call to proper location */ +/********************** + ** linux/notifier.h ** + **********************/ + +static Lx::Notifier &blocking_notifier() +{ + static Lx::Notifier inst; + return inst; +} + + +int blocking_notifier_chain_register(struct blocking_notifier_head *nh, + struct notifier_block *nb) +{ + blocking_notifier().register_block(nb); + return 0; +} + +int blocking_notifier_chain_unregister(struct blocking_notifier_head *nh, + struct notifier_block *nb) +{ + blocking_notifier().unregister_block(nb); + return 0; +} + + +int blocking_notifier_call_chain(struct blocking_notifier_head *nh, + unsigned long val, void *v) +{ + return blocking_notifier().call_all_blocks(val, v); +} + + +/*********************** + ** linux/netdevice.h ** + ***********************/ + +static Lx::Notifier &net_notifier() +{ + static Lx::Notifier inst; + return inst; +} + + +extern "C" int register_netdevice_notifier(struct notifier_block *nb) +{ + /** + * In Linux the nb is actually called upon on registration. We do not + * that semantic because we add a net_device only after all notifiers + * were registered. + */ + net_notifier().register_block(nb); + + return 0; +} + + +extern "C" int unregster_netdevice_notifier(struct notifier_block *nb) +{ + net_notifier().unregister_block(nb); + + return 0; +} + + +extern "C" struct net_device * netdev_notifier_info_to_dev(struct netdev_notifier_info *info) +{ + /* we always pass a net_device pointer to this function */ + return reinterpret_cast(info); +} + + +struct Proto_hook : public Lx::List::Element +{ + struct packet_type &pt; + + Proto_hook(struct packet_type *pt) : pt(*pt) { } +}; + + +class Proto_hook_list +{ + private: + + Lx::List _list; + Genode::Allocator &_alloc; + + public: + + Proto_hook_list(Genode::Allocator &alloc) : _alloc(alloc) { } + + void insert(struct packet_type *pt) { + _list.insert(new (&_alloc) Proto_hook(pt)); } + + void remove(struct packet_type *pt) + { + for (Proto_hook *ph = _list.first(); ph; ph = ph->next()) + if (&ph->pt == pt) { + _list.remove(ph); + destroy(&_alloc, ph); + break; + } + } + + Proto_hook* first() { return _list.first(); } +}; + + +static Proto_hook_list& proto_hook_list() +{ + static Proto_hook_list inst(*Genode::env()->heap()); + return inst; +} + + +extern "C" void dev_add_pack(struct packet_type *pt) +{ + proto_hook_list().insert(pt); +} + + +extern "C" void __dev_remove_pack(struct packet_type *pt) +{ + proto_hook_list().remove(pt); +} + + +extern "C" struct net_device *__dev_get_by_index(struct net *net, int ifindex) +{ + if (!_nic || !_nic->_ndev) { + PERR("no net device registered!"); + return 0; + } + + return _nic->_ndev; +} + + +extern "C" struct net_device *dev_get_by_index(struct net *net, int ifindex) +{ + return __dev_get_by_index(net, ifindex); +} + + +extern "C" int dev_hard_header(struct sk_buff *skb, struct net_device *dev, + unsigned short type, const void *daddr, + const void *saddr, unsigned int len) +{ + if (!dev->header_ops || !dev->header_ops->create) + return 0; + + return dev->header_ops->create(skb, dev, type, daddr, saddr, len); +} + + +extern "C" int dev_parse_header(const struct sk_buff *skb, unsigned char *haddr) +{ + struct net_device const *dev = skb->dev; + + if (!dev->header_ops || dev->header_ops->parse) + return 0; + + return dev->header_ops->parse(skb, haddr); +} + + +extern "C" int dev_queue_xmit(struct sk_buff *skb) +{ + struct net_device *dev = skb->dev; + struct net_device_ops const *ops = dev->netdev_ops; + int rv = NETDEV_TX_OK; + + if (skb->next) + PWRN("more skb's queued"); + + rv = ops->ndo_start_xmit(skb, dev); + + return rv; +} + + +extern "C" size_t LL_RESERVED_SPACE(struct net_device *dev) +{ + return dev->hard_header_len ? + (dev->hard_header_len + (HH_DATA_MOD - 1)) & ~(HH_DATA_MOD - 1) : 0; +} + + +extern "C" int register_netdevice(struct net_device *ndev) +{ + static bool already_registered = false; + + if (already_registered) { + PERR("We don't support multiple network devices in one driver instance"); + return -ENODEV; + } + + static Nic_device nic_device(ndev); + static Nic::Root nic_root(*_ep, Genode::env()->heap(), nic_device); + + /* + * XXX This is just a starting point for removing all the static stuff from + * this file... + */ + ndev->lx_nic_device = (void *)&nic_device; + _nic = &nic_device; + + already_registered = true; + + ndev->state |= 1UL << __LINK_STATE_START; + netif_carrier_off(ndev); + + /* execute all notifier blocks */ + net_notifier().call_all_blocks(NETDEV_REGISTER, ndev); + net_notifier().call_all_blocks(NETDEV_UP, ndev); + ndev->ifindex = 1; + + /* set mac adress */ + Genode::memcpy(ndev->perm_addr, ndev->ieee80211_ptr->wiphy->perm_addr, ETH_ALEN); + + int err = ndev->netdev_ops->ndo_open(ndev); + if (err) { + PERR("ndev->netdev_ops->ndo_open(ndev): %d", err); + return err; + } + + if (ndev->netdev_ops->ndo_set_rx_mode) + ndev->netdev_ops->ndo_set_rx_mode(ndev); + + Genode::env()->parent()->announce(_ep->rpc_ep().manage(&nic_root)); + + list_add_tail_rcu(&ndev->dev_list, &init_net.dev_base_head); + + return 0; +} + + +extern "C" int netif_running(const struct net_device *dev) +{ + return dev->state & (1UL << __LINK_STATE_START); +} + + +extern "C" int netif_device_present(struct net_device *dev) { return 1; } + + +extern "C" int netif_carrier_ok(const struct net_device *dev) +{ + return !(dev->state & (1UL << __LINK_STATE_NOCARRIER)); +} + + +extern "C" void netif_carrier_on(struct net_device *dev) +{ + dev->state &= ~(1UL << __LINK_STATE_NOCARRIER); + + Nic_device *nic = (Nic_device *)dev->lx_nic_device; + + nic->link_state(true); +} + + +extern "C" void netif_carrier_off(struct net_device *dev) +{ + if (!dev) + PERR("!dev %p", __builtin_return_address(0)); + + dev->state |= 1UL << __LINK_STATE_NOCARRIER; + + Nic_device *nic = (Nic_device *)dev->lx_nic_device; + + nic->link_state(false); +} + + +extern "C" int netif_receive_skb(struct sk_buff *skb) +{ + /** + * XXX check original linux implementation if it is really + * necessary to free the skb if it was not handled. + */ + + /* send EAPOL related frames only to the wpa_supplicant */ + if (ntohs(skb->protocol) == ETH_P_PAE) { + /* XXX call only AF_PACKET hook */ + for (Proto_hook* ph = proto_hook_list().first(); ph; ph = ph->next()) { + ph->pt.func(skb, _nic->_ndev, &ph->pt, _nic->_ndev); + } + return NET_RX_SUCCESS; + } + + if (_nic && _nic->_session) { + _nic->rx(skb); + } + + dev_kfree_skb(skb); + return NET_RX_SUCCESS; +} + + +extern "C" u16 netdev_cap_txqueue(struct net_device *dev, u16 queue_index) +{ + if (queue_index > dev-> real_num_tx_queues) { + PERR("error: queue_index %d out of range (%d max) called from: %p", + queue_index, dev->real_num_tx_queues, __builtin_return_address(0)); + return 0; + } + + return queue_index; +} + + +extern "C" struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name, + void (*setup)(struct net_device *), + unsigned int txqs, unsigned int rxqs) +{ + struct net_device *dev; + size_t alloc_size; + struct net_device *p; + + alloc_size = ALIGN(sizeof(struct net_device), NETDEV_ALIGN); + /* ensure 32-byte alignment of whole construct */ + alloc_size += NETDEV_ALIGN - 1; + + p = (net_device *)kzalloc(alloc_size, GFP_KERNEL | __GFP_NOWARN | __GFP_REPEAT); + if (!p) + return NULL; + + dev = PTR_ALIGN(p, NETDEV_ALIGN); + + dev->gso_max_size = GSO_MAX_SIZE; + dev->gso_max_segs = GSO_MAX_SEGS; + + setup(dev); + + /* actually set by dev_open() */ + dev->flags |= IFF_UP; + + + /* XXX our dev is always called wlan0 */ + strcpy(dev->name, "wlan0"); + + dev->dev_addr = (unsigned char *)kzalloc(ETH_ALEN, GFP_KERNEL); + if (!dev->dev_addr) + return 0; + + if (sizeof_priv) { + /* ensure 32-byte alignment of private area */ + dev->priv = kzalloc(sizeof_priv, GFP_KERNEL); + if (!dev->priv) + return 0; + } + + dev->num_tx_queues = txqs; + dev->real_num_tx_queues = txqs; + struct netdev_queue *tx = (struct netdev_queue*) + kcalloc(txqs, sizeof(struct netdev_queue), + GFP_KERNEL | GFP_LX_DMA); + if (!tx) { + PERR("could not allocate ndev_queues"); + } + + dev->_tx = tx; + for (unsigned i = 0; i < txqs; i++) { + tx[i].dev = dev; + tx[i].numa_node = NUMA_NO_NODE; + } + + return dev; +} + + +/********************** + ** linux/inerrupt.h ** + **********************/ + + + +/************************* + ** linux/etherdevice.h ** + *************************/ + +int is_valid_ether_addr(const u8 *addr) +{ + /* is multicast */ + if ((addr[0] & 0x1)) + return 0; + + /* zero */ + if (!(addr[0] | addr[1] | addr[2] | addr[3] | addr[4] | addr[5])) + return 0; + + return 1; +} diff --git a/repos/dde_linux/src/lib/wifi/pci_driver.cc b/repos/dde_linux/src/lib/wifi/pci_driver.cc new file mode 100644 index 000000000..edf26c738 --- /dev/null +++ b/repos/dde_linux/src/lib/wifi/pci_driver.cc @@ -0,0 +1,477 @@ +/* + * \brief Emulate 'pci_dev' structure + * \author Sebastian Sumpf + * \author Josef Soentgen + * \date 2012-04-02 + */ + +/* + * Copyright (C) 2012-2013 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +/* Genode inludes */ +#include +#include +#include +#include +#include + +/* local includes */ +#include + +#include +# include +#include + + +static bool const verbose = false; +#define PDBGV(...) do { if (verbose) PDBG(__VA_ARGS__); } while (0) + + +struct bus_type pci_bus_type; + + +/** + * Scan PCI bus and probe for HCDs + */ +class Pci_driver +{ + private: + + pci_driver *_drv; /* Linux PCI driver */ + Pci::Device_capability _cap; /* PCI cap */ + pci_device_id const *_id; /* matched id for this driver */ + + public: + + pci_dev *_dev; /* Linux PCI device */ + + private: + + /* offset used in PCI config space */ + enum Pci_config { IRQ = 0x3c, REV = 0x8, CMD = 0x4, + STATUS = 0x4, CAP = 0x34 }; + enum Pci_cap { CAP_LIST = 0x10, CAP_EXP = 0x10, + CAP_EXP_FLAGS = 0x2, CAP_EXP_DEVCAP = 0x4 }; + + /** + * Fill Linux device informations + */ + bool _setup_pci_device() + { + using namespace Pci; + + Device_client client(_cap); + if (client.device_id() != _id->device) + return false; + + _dev = new (Genode::env()->heap()) pci_dev; + + _dev->vendor = client.vendor_id(); + _dev->device = client.device_id(); + _dev->class_ = client.class_code(); + _dev->revision = client.config_read(REV, Device::ACCESS_8BIT); + _dev->dev.driver = &_drv->driver; + + /* dummy dma mask used to mark device as DMA capable */ + static u64 dma_mask = ~(u64)0; + _dev->dev.dma_mask = &dma_mask; + _dev->dev.coherent_dma_mask = ~0; + + /* read interrupt line */ + _dev->irq = client.config_read(IRQ, Device::ACCESS_8BIT); + + /* hide ourselfs in bus structure */ + _dev->bus = (struct pci_bus *)this; + + /* setup resources */ + bool io = false; + for (int i = 0; i < Device::NUM_RESOURCES; i++) { + Device::Resource res = client.resource(i); + if (res.type() == Device::Resource::INVALID) + continue; + + _dev->resource[i].start = res.base(); + _dev->resource[i].end = res.base() + res.size() - 1; + _dev->resource[i].flags = res.type() == Device::Resource::IO + ? IORESOURCE_IO : 0; + + PDBGV("base: %x size: %x type: %u", + res.base(), res.size(), res.type()); + + /* request I/O memory (write combined) */ + if (res.type() == Device::Resource::MEMORY) + PDBGV("I/O memory [%x-%x)", res.base(), + res.base() + res.size()); + } + + /* enable bus master and io bits */ + uint16_t cmd = client.config_read(CMD, Device::ACCESS_16BIT); + cmd |= io ? 0x1 : 0; + + /* enable bus master */ + cmd |= 0x4; + client.config_write(CMD, cmd, Device::ACCESS_16BIT); + + /* get pci express capability */ + _dev->pcie_cap = 0; + uint16_t status = client.config_read(STATUS, Device::ACCESS_32BIT) >> 16; + if (status & CAP_LIST) { + uint8_t offset = client.config_read(CAP, Device::ACCESS_8BIT); + while (offset != 0x00) { + uint8_t value = client.config_read(offset, Device::ACCESS_8BIT); + + if (value == CAP_EXP) + _dev->pcie_cap = offset; + + offset = client.config_read(offset + 1, Device::ACCESS_8BIT); + } + } + + if (_dev->pcie_cap) { + uint16_t reg_val = client.config_read(_dev->pcie_cap, Device::ACCESS_16BIT); + _dev->pcie_flags_reg = reg_val; + } + + return true; + } + + /** + * Probe device with driver + */ + bool _probe() + { + + /* only probe if the device matches */ + if (!_setup_pci_device()) + return false; + + /* PDBG("probe: %p 0x%x", _dev, _id); */ + + if (!_drv->probe(_dev, _id)) { + return true; + } + + return false; + } + + template + Pci::Device::Access_size _access_size(T t) + { + switch (sizeof(T)) + { + case 1: + return Pci::Device::ACCESS_8BIT; + case 2: + return Pci::Device::ACCESS_16BIT; + default: + return Pci::Device::ACCESS_32BIT; + } + } + + public: + + Pci_driver(pci_driver *drv, Pci::Device_capability cap, + pci_device_id const * id) + : _drv(drv), _cap(cap), _id(id), _dev(0) + { + if (!_probe()) + throw -1; + } + + ~Pci_driver() + { + if (!_dev) + return; + + destroy(Genode::env()->heap(), _dev); + } + + /** + * Read/write data from/to config space + */ + template + void config_read(unsigned int devfn, T *val) + { + Pci::Device_client client(_cap); + *val = client.config_read(devfn, _access_size(*val)); + } + + template + void config_write(unsigned int devfn, T val) + { + Pci::Device_client client(_cap); + client.config_write(devfn, val, _access_size(val)); + } +}; + + +/******************************** + ** Backend memory definitions ** + ********************************/ + +struct Memory_object_base : Genode::Object_pool::Entry +{ + Memory_object_base(Genode::Ram_dataspace_capability cap) + : Genode::Object_pool::Entry(cap) {} + virtual ~Memory_object_base() {}; + + virtual void free() = 0; + + Genode::Ram_dataspace_capability ram_cap() + { + using namespace Genode; + return reinterpret_cap_cast(cap()); + } +}; + + +struct Ram_object : Memory_object_base +{ + Ram_object(Genode::Ram_dataspace_capability cap) + : Memory_object_base(cap) {} + + void free(); +}; + + +struct Dma_object : Memory_object_base +{ + Dma_object(Genode::Ram_dataspace_capability cap) + : Memory_object_base(cap) {} + + void free(); +}; + + +/********************* + ** Linux interface ** + *********************/ + +static Pci::Device_capability pci_device_cap; +static Pci::Connection *pci() +{ + static Pci::Connection _pci; + return &_pci; +} +static Genode::Object_pool memory_pool; + + +extern "C" int pci_register_driver(struct pci_driver *drv) +{ + drv->driver.name = drv->name; + + pci_device_id const *id = drv->id_table; + if (!id) + return -ENODEV; + + using namespace Genode; + + unsigned found = 0; + + while (id->device) { + if (id->class_ == (unsigned)PCI_ANY_ID) { + id++; + continue; + } + + Pci::Device_capability cap = pci()->first_device(id->class_, + id->class_mask); + + while (cap.valid()) { + Pci_driver *pci_drv = 0; + try { + /* + * Assign cap already here, since for probing already DMA + * buffer is required and allocated by + * Genode::Mem::alloc_dma_buffer(size_t size) + */ + pci_device_cap = cap; + + /* trigger that the device get be assigned to the wifi driver */ + pci()->config_extended(cap); + + /* probe device */ + pci_drv = new (env()->heap()) Pci_driver(drv, cap, id); + pci()->on_destruction(Pci::Connection::KEEP_OPEN); + found++; + + } catch (...) { + destroy(env()->heap(), pci_drv); + pci_drv = 0; + } + + if (found) + break; + + Pci::Device_capability free_up = cap; + cap = pci()->next_device(cap, id->class_, id->class_mask); + if (!pci_drv) + pci()->release_device(free_up); + } + id++; + + /* XXX */ + if (found) + break; + } + + return found ? 0 : -ENODEV; +} + + +extern "C" size_t pci_resource_start(struct pci_dev *dev, unsigned bar) +{ + if (bar >= DEVICE_COUNT_RESOURCE) + return 0; + + return dev->resource[bar].start; +} + + +extern "C" size_t pci_resource_len(struct pci_dev *dev, unsigned bar) +{ + size_t start = pci_resource_start(dev, bar); + + if (!start) + return 0; + + return (dev->resource[bar].end - start) + 1; +} + + +extern "C" void *pci_ioremap_bar(struct pci_dev *dev, int bar) +{ + using namespace Genode; + + size_t start = pci_resource_start(dev, bar); + size_t size = pci_resource_len(dev, bar); + + if (!start) + return 0; + + Io_mem_connection *io_mem; + try { + io_mem = new (env()->heap()) Io_mem_connection(start, size, 0); + } catch (...) { + PERR("Failed to request I/O memory: [%zx,%lx)", start, start + size); + return 0; + } + + if (!io_mem->dataspace().valid()) { + PERR("I/O memory not accessible"); + return 0; + } + + addr_t map_addr = env()->rm_session()->attach(io_mem->dataspace()); + map_addr |= start & 0xfff; + + return (void*)map_addr; +} + + +extern "C" unsigned int pci_resource_flags(struct pci_dev *dev, unsigned bar) +{ + if (bar >= DEVICE_COUNT_RESOURCE) + return 0; + + return dev->resource[bar].flags; +} + + +extern "C" int pci_bus_read_config_byte(struct pci_bus *bus, unsigned int, int where, u8 *val) +{ + Pci_driver *drv = (Pci_driver *)bus; + drv->config_read(where, val); + return 0; +} + + +extern "C" int pci_bus_read_config_word(struct pci_bus *bus, unsigned int, int where, u16 *val) +{ + Pci_driver *drv = (Pci_driver *)bus; + drv->config_read(where, val); + return 0; +} + + +extern "C" int pci_bus_write_config_word(struct pci_bus *bus, unsigned int, int where, u16 val) +{ + Pci_driver *drv = (Pci_driver *)bus; + drv->config_write(where, val); + return 0; +} + + +extern "C" int pci_bus_write_config_byte(struct pci_bus *bus, unsigned int, int where, u8 val) +{ + Pci_driver *drv = (Pci_driver *)bus; + drv->config_write(where, val); + return 0; +} + + +extern "C" const char *pci_name(const struct pci_dev *pdev) +{ + /* simply return driver name */ + return "dummy"; +} + + +extern "C" int pcie_capability_read_word(struct pci_dev *pdev, int pos, u16 *val) +{ + Pci_driver *drv = (Pci_driver *)pdev->bus; + switch (pos) { + case PCI_EXP_LNKCTL: + drv->config_read(pdev->pcie_cap + PCI_EXP_LNKCTL, val); + return 0; + break; + default: + break; + } + + return 1; +} + + +void Ram_object::free() { Genode::env()->ram_session()->free(ram_cap()); } + + +void Dma_object::free() { pci()->free_dma_buffer(pci_device_cap, ram_cap()); } + + +Genode::Ram_dataspace_capability +Lx::backend_alloc(Genode::addr_t size, Genode::Cache_attribute cached) +{ + using namespace Genode; + + Memory_object_base *o; + Genode::Ram_dataspace_capability cap; + if (cached == CACHED) { + cap = env()->ram_session()->alloc(size); + o = new (env()->heap()) Ram_object(cap); + } else { + cap = pci()->alloc_dma_buffer(pci_device_cap, size); + o = new (env()->heap()) Dma_object(cap); + } + + memory_pool.insert(o); + return cap; +} + + +void Lx::backend_free(Genode::Ram_dataspace_capability cap) +{ + using namespace Genode; + + Memory_object_base *o = memory_pool.lookup_and_lock(cap); + if (!o) + return; + + o->free(); + memory_pool.remove_locked(o); + destroy(env()->heap(), o); +} diff --git a/repos/dde_linux/src/lib/wifi/scheduler.cc b/repos/dde_linux/src/lib/wifi/scheduler.cc new file mode 100644 index 000000000..1cdce9e31 --- /dev/null +++ b/repos/dde_linux/src/lib/wifi/scheduler.cc @@ -0,0 +1,262 @@ +/* + * \brief User-level scheduling + * \author Sebastian Sumpf + * \author Josef Soentgen + * \author Christian Helmuth + * \date 2012-04-25 + * + * We use a pseudo-thread implementation based on setjmp/longjmp. + */ + +/* + * Copyright (C) 2012-2014 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +/* Genode includes */ +#include + +/* local includes */ +#include +#include +#include + + +#define PDBGV(...) \ + do { if (DEBUG_SCHEDULING) PDBG(__VA_ARGS__); } while (0) + + +/********** + ** Task ** + **********/ + +bool Lx::Task::_runnable() const +{ + switch (_state) { + case STATE_INIT: return true; + case STATE_RUNNING: return true; + case STATE_BLOCKED: return false; + case STATE_MUTEX_BLOCKED: return false; + case STATE_WAIT_BLOCKED: return false; + } + + PERR("state %d not handled by switch", _state); + Genode::sleep_forever(); +} + + +bool Lx::Task::run() +{ + if (!_runnable()) + return false; + + /* + * Save the execution environment. The scheduled task returns to this point + * after execution, i.e., at the next preemption point. + */ + if (_setjmp(_saved_env)) + return true; + + if (_state == STATE_INIT) { + /* setup execution environment and call task's function */ + _state = STATE_RUNNING; + Genode::Thread_base *th = Genode::Thread_base::myself(); + + enum { STACK_SIZE = 32 * 1024 }; /* FIXME make stack size configurable */ + _stack = th->alloc_secondary_stack(_name, STACK_SIZE); + + /* switch stack and call '_func(_arg)' */ + platform_execute(_stack, (void *)_func, _arg); + } else { + /* restore execution environment */ + _longjmp(_env, 1); + } + + /* never reached */ + PERR("Unexpected return of Task"); + Genode::sleep_forever(); +} + + +void Lx::Task::schedule() +{ + /* + * Save the execution environment. The task will resume from here on next + * schedule. + */ + if (_setjmp(_env)) { + return; + } + + /* return to thread calling run() */ + _longjmp(_saved_env, 1); +} + + +Lx::Task::Task(void (*func)(void*), void *arg, char const *name, + Priority priority, Scheduler &scheduler) +: + _priority(priority), _scheduler(scheduler), + _func(func), _arg(arg), _name(name) +{ + scheduler.add(this); + + PDBGV("name: '%s' func: %p arg: %p prio: %u t: %p", name, func, arg, priority, this); +} + + +Lx::Task::~Task() +{ +// scheduler.remove(this); + if (_stack) + Genode::Thread_base::myself()->free_secondary_stack(_stack); +} + + +/*************** + ** Scheduler ** + ***************/ + +Lx::Scheduler & Lx::scheduler() +{ + static Lx::Scheduler inst; + return inst; +} + + +Lx::Task *Lx::Scheduler::current() +{ + if (!_current) { + PERR("BUG: _current is zero!"); + Genode::sleep_forever(); + } + + return _current; +} + + +void Lx::Scheduler::add(Task *task) +{ + Lx::Task *p = _present_list.first(); + for ( ; p; p = p->next()) { + if (p->priority() <= task->priority()) { + _present_list.insert_before(task, p); + break; + } + } + if (!p) + _present_list.append(task); +} + + +void Lx::Scheduler::schedule() +{ + bool at_least_one = false; + + /* + * Iterate over all tasks and run first runnable. + * + * (1) If one runnable tasks was run start over from beginning of + * list. + * + * (2) If no task is runnable quit scheduling (break endless + * loop). + */ + while (true) { + /* update jiffies before running task */ + Lx::timer_update_jiffies(); + + bool was_run = false; + for (Task *t = _present_list.first(); t; t = t->next()) { + /* update current before running task */ + _current = t; + + if ((was_run = t->run())) { + at_least_one = true; + break; + } + } + if (!was_run) + break; + } + + if (!at_least_one) { + PWRN("schedule() called without runnable tasks"); + log_state("SCHEDULE"); + } + + /* clear current as no task is running */ + _current = nullptr; +} + + +#include + +namespace { + struct Logger : Genode::Thread<0x4000> + { + Timer::Connection _timer; + Lx::Scheduler &_scheduler; + unsigned const _interval; + + Logger(Lx::Scheduler &scheduler, unsigned interval_seconds) + : + Genode::Thread<0x4000>("logger"), + _scheduler(scheduler), _interval(interval_seconds) + { + start(); + } + + void entry() + { + PWRN("Scheduler::Logger is up"); + _timer.msleep(1000 * _interval); + while (true) { + _scheduler.log_state("LOGGER"); + _timer.msleep(2000); + } + } + }; +} + +#define ANSI_ESC_RESET "\033[00m" +#define ANSI_ESC_BLACK "\033[30m" +#define ANSI_ESC_RED "\033[31m" +#define ANSI_ESC_YELLOW "\033[33m" + +static char const *state_color(Lx::Task::State state) +{ + switch (state) { + case Lx::Task::STATE_INIT: return ANSI_ESC_RESET; + case Lx::Task::STATE_RUNNING: return ANSI_ESC_RED; + case Lx::Task::STATE_BLOCKED: return ANSI_ESC_YELLOW; + case Lx::Task::STATE_MUTEX_BLOCKED: return ANSI_ESC_YELLOW; + case Lx::Task::STATE_WAIT_BLOCKED: return ANSI_ESC_YELLOW; + } + + return ANSI_ESC_BLACK; +} + + +void Lx::Scheduler::log_state(char const *prefix) +{ + unsigned i; + Lx::Task *t; + for (i = 0, t = _present_list.first(); t; t = t->next(), ++i) { + Genode::printf("%s [%u] prio: %u state: %s%u" ANSI_ESC_RESET " %s\n", + prefix, i, t->priority(), state_color(t->state()), + t->state(), t->name()); + } +} + + +Lx::Scheduler::Scheduler() +{ + if (DEBUG_SCHEDULING) + new (Genode::env()->heap()) Logger(*this, 10); +} + + +Lx::Scheduler::~Scheduler() { } diff --git a/repos/dde_linux/src/lib/wifi/socket.c b/repos/dde_linux/src/lib/wifi/socket.c new file mode 100644 index 000000000..a3606d069 --- /dev/null +++ b/repos/dde_linux/src/lib/wifi/socket.c @@ -0,0 +1,110 @@ +/** + * \brief Linux emulation code + * \author Sebastian Sumpf + * \date 2014-03-07 + */ + +/* + * Copyright (C) 2014 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +#include +#include + + +/**************** + ** net/sock.h ** + ****************/ + +static const struct net_proto_family *net_families[NPROTO]; + +int sock_register(const struct net_proto_family *ops) +{ + if (ops->family >= NPROTO) { + printk("protocol %d >= NPROTO (%d)\n", ops->family, NPROTO); + return -ENOBUFS; + } + + net_families[ops->family] = ops; + pr_info("NET: Registered protocol family %d\n", ops->family); + return 0; +} + + + +struct socket *sock_alloc(void) +{ + return (struct socket *)kmalloc(sizeof(struct socket), 0); +} + + +int sock_create_lite(int family, int type, int protocol, struct socket **res) + +{ + struct socket *sock = sock_alloc(); + + if (!sock) + return -ENOMEM; + + sock->type = type; + *res = sock; + return 0; +} + + +int sock_create_kern(int family, int type, int proto, + struct socket **res) +{ + struct socket *sock; + const struct net_proto_family *pf; + int err; + + if (family < 0 || family > NPROTO) + return -EAFNOSUPPORT; + + if (type < 0 || type > SOCK_MAX) + return -EINVAL; + + pf = net_families[family]; + + if (!pf) { + printk("No protocol found for family %d\n", family); + return -ENOPROTOOPT; + } + + if (!(sock = (struct socket *)kzalloc(sizeof(struct socket), 0))) { + printk("Could not allocate socket\n"); + return -ENFILE; + } + + sock->type = type; + + err = pf->create(&init_net, sock, proto, 1); + if (err) { + kfree(sock); + return err; + } + + *res = sock; + + return 0; +} + + +void log_sock(struct socket *socket) +{ + printk("\nNEW socket %p sk %p fsk %lx &sk %p &fsk %p\n\n", + socket, socket->sk, socket->flags, &socket->sk, &socket->flags); +} + + +static void sock_init(void) +{ + skb_init(); +} + + +core_initcall(sock_init); diff --git a/repos/dde_linux/src/lib/wifi/socket_call.cc b/repos/dde_linux/src/lib/wifi/socket_call.cc new file mode 100644 index 000000000..2624b9cff --- /dev/null +++ b/repos/dde_linux/src/lib/wifi/socket_call.cc @@ -0,0 +1,634 @@ +/** + * \brief Linux emulation code + * \author Josef Soentgen + * \date 2014-08-04 + */ + +/* + * Copyright (C) 2014 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +/* Genode includes */ +#include + +/* local includes */ +#include + +#include +# include +# include +# include +# include +#include + +#include + + +static void run_socketcall(void *); + + +/* XXX move Wifi::Socket definition to better location */ +struct Wifi::Socket +{ + void *socket = nullptr; + bool non_block = false; + + Socket() { } + + explicit Socket(void *s) : socket(s) { } +}; + + +struct Call +{ + enum Opcode { + NONE, SOCKET, CLOSE, + BIND, GETSOCKNAME, RECVMSG, SENDMSG, SENDTO, SETSOCKOPT, + GET_MAC_ADDRESS, POLL_ALL, NON_BLOCK, + }; + + Opcode opcode = NONE; + Wifi::Socket *handle = nullptr; + + union { + struct + { + int domain; + int type; + int protocol; + void *result; + } socket; + struct { /* no args */ } close; + struct + { + sockaddr const *addr; + int addrlen; + } bind; + struct + { + sockaddr *addr; + int *addrlen; + } getsockname; + struct + { + msghdr msg; + int flags; + iovec iov[Wifi::Msghdr::MAX_IOV_LEN]; + } recvmsg; + struct + { + msghdr msg; + int flags; + iovec iov[Wifi::Msghdr::MAX_IOV_LEN]; + } sendmsg; + struct { + int level; + int optname; + void const *optval; + uint32_t optlen; + } setsockopt; + struct + { + unsigned char *addr; + } get_mac_address; + struct + { + Wifi::Poll_socket_fd *sockets; + unsigned num; + int timeout; + } poll_all; + struct + { + bool value; + } non_block; + }; + + int err = 0; +}; + +static Call _call; +static Genode::Semaphore _block; + + +namespace Lx { + class Socket; +} + + +/** + * Context for socket calls + */ +class Lx::Socket +{ + private: + + + Genode::Signal_transmitter _sender; + Genode::Signal_rpc_member _dispatcher; + Lx::Task _task; + + struct socket *_call_socket() + { + struct socket *sock = static_cast(_call.handle->socket); + if (!sock) + PERR("BUG: sock is zero"); + + return sock; + } + + void _do_socket() + { + struct socket *s; + int res = sock_create_kern(_call.socket.domain, _call.socket.type, + _call.socket.protocol, &s); + if (!res) { + _call.socket.result = s; + _call.err = 0; + return; + } + + PERR("sock_create_kern failed, res: %d", res); + _call.socket.result = nullptr; + _call.err = res; + } + + void _do_close() + { + struct socket *sock = _call_socket(); + + _call.err = sock->ops->release(sock); + } + + void _do_bind() + { + struct socket *sock = _call_socket(); + + _call.err = sock->ops->bind(sock, + const_cast(_call.bind.addr), + _call.bind.addrlen); + } + + void _do_getsockname() + { + struct socket *sock = _call_socket(); + int addrlen = *_call.getsockname.addrlen; + + _call.err = sock->ops->getname(sock, _call.getsockname.addr, &addrlen, 0); + + *_call.getsockname.addrlen = addrlen; + } + + void _do_recvmsg() + { + struct socket *sock = _call_socket(); + struct msghdr *msg = &_call.recvmsg.msg; + + /* needed by AF_NETLINK */ + struct sock_iocb siocb; + Genode::memset(&siocb, 0, sizeof(struct sock_iocb)); + struct kiocb kiocb; + Genode::memset(&kiocb, 0, sizeof(struct kiocb)); + + kiocb.private_ = &siocb; + + if (_call.handle->non_block) + msg->msg_flags |= MSG_DONTWAIT; + + size_t iovlen = 0; + for (size_t i = 0; i < msg->msg_iovlen; i++) + iovlen += msg->msg_iov[i].iov_len; + + _call.err = sock->ops->recvmsg(&kiocb, sock, msg, iovlen, _call.recvmsg.flags); + } + + void _do_sendmsg() + { + struct socket *sock = _call_socket(); + struct msghdr *msg = const_cast(&_call.sendmsg.msg); + + /* needed by AF_NETLINK */ + struct sock_iocb siocb; + Genode::memset(&siocb, 0, sizeof(struct sock_iocb)); + struct kiocb kiocb; + Genode::memset(&kiocb, 0, sizeof(struct kiocb)); + + kiocb.private_ = &siocb; + + if (_call.handle->non_block) + msg->msg_flags |= MSG_DONTWAIT; + + size_t iovlen = 0; + for (size_t i = 0; i < msg->msg_iovlen; i++) + iovlen += msg->msg_iov[i].iov_len; + + _call.err = sock->ops->sendmsg(&kiocb, sock, msg, iovlen); + } + + void _do_setsockopt() + { + struct socket *sock = _call_socket(); + + /* taken from kernel_setsockopt() in net/socket.c */ + if (_call.setsockopt.level == SOL_SOCKET) + _call.err = sock_setsockopt(sock, + _call.setsockopt.level, + _call.setsockopt.optname, + (char *)_call.setsockopt.optval, + _call.setsockopt.optlen); + else + _call.err = sock->ops->setsockopt(sock, + _call.setsockopt.level, + _call.setsockopt.optname, + (char *)_call.setsockopt.optval, + _call.setsockopt.optlen); + } + + void _do_get_mac_address() + { + Lx::get_mac_address(_call.get_mac_address.addr); + } + + void _do_poll_all() + { + Wifi::Poll_socket_fd *sockets = _call.poll_all.sockets; + unsigned num = _call.poll_all.num; + int timeout = _call.poll_all.timeout; + + enum { + POLLIN_SET = (POLLRDNORM | POLLRDBAND | POLLIN | POLLHUP | POLLERR), + POLLOUT_SET = (POLLWRBAND | POLLWRNORM | POLLOUT | POLLERR), + POLLEX_SET = (POLLPRI) + }; + + int nready = 0; + bool timeout_triggered = false; + bool woken_up = false; + do { + /** + * Timeout was triggered, exit early. + */ + if (timeout_triggered) + break; + + /** + * Poll each socket and check if there is something of interest. + */ + for (unsigned i = 0; i < num; i++) { + struct socket *sock = static_cast(sockets[i].s->socket); + + int mask = sock->ops->poll(0, sock, 0); + + sockets[i].revents = 0; + if (mask & POLLIN_SET) + sockets[i].revents |= sockets[i].events & Wifi::WIFI_POLLIN ? Wifi::WIFI_POLLIN : 0; + if (mask & POLLOUT_SET) + sockets[i].revents |= sockets[i].events & Wifi::WIFI_POLLOUT ? Wifi::WIFI_POLLOUT : 0; + if (mask & POLLEX_SET) + sockets[i].revents |= sockets[i].events & Wifi::WIFI_POLLEX ? Wifi::WIFI_POLLEX : 0; + + if (sockets[i].revents) + nready++; + } + + /** + * We were woken up but there is still nothing of interest. + */ + if (woken_up) + break; + + /** + * Exit the loop if either a socket is ready or there is + * no timeout given. + */ + if (nready || !timeout) + break; + + /** + * In case of a timeout add all sockets to an artificial wait list + * so at least one is woken up an sk_data_ready() call. + */ + Lx::Task *task = Lx::scheduler().current(); + struct socket_wq wq[num]; + Lx::Task::List wait_list; + + task->wait_enqueue(&wait_list); + for (unsigned i = 0; i < num; i++) { + struct socket *sock = static_cast(sockets[i].s->socket); + wq[i].wait.list = &wait_list; + sock->sk->sk_wq = &wq[i]; + } + + long t = jiffies + msecs_to_jiffies(timeout); + timeout_triggered = !schedule_timeout(t); + + task->wait_dequeue(&wait_list); + for (unsigned i = 0; i < num; i++) { + struct socket *sock = static_cast(sockets[i].s->socket); + sock->sk->sk_wq = 0; + } + + woken_up = true; + } while (1); + + _call.err = nready; + } + + void _do_non_block() + { + _call.handle->non_block = _call.non_block.value; + } + + void _handle(unsigned) + { + _task.unblock(); + Lx::scheduler().schedule(); + } + + public: + + Socket(Server::Entrypoint &ep) + : + _dispatcher(ep, *this, &Lx::Socket::_handle), + _task(run_socketcall, nullptr, "socketcall", + Lx::Task::PRIORITY_0, Lx::scheduler()) + { + _sender.context(_dispatcher); + } + + void exec_call() + { + switch (_call.opcode) { + case Call::BIND: _do_bind(); break; + case Call::CLOSE: _do_close(); break; + case Call::GETSOCKNAME: _do_getsockname(); break; + case Call::POLL_ALL: _do_poll_all(); break; + case Call::RECVMSG: _do_recvmsg(); break; + case Call::SENDMSG: _do_sendmsg(); break; + case Call::SETSOCKOPT: _do_setsockopt(); break; + case Call::SOCKET: _do_socket(); break; + case Call::GET_MAC_ADDRESS: _do_get_mac_address(); break; + case Call::NON_BLOCK: _do_non_block(); break; + + default: + _call.err = -EINVAL; + PWRN("unknown opcode: %u", _call.opcode); + break; + } + + _call.opcode = Call::NONE; + _block.up(); + } + + void submit_and_block() + { + _sender.submit(); + _block.down(); + } +}; + + +static Lx::Socket *_socket; + + +void Lx::socket_init(Server::Entrypoint &ep) +{ + static Lx::Socket socket_ctx(ep); + _socket = &socket_ctx; +} + + +static void run_socketcall(void *) +{ + while (1) { + Lx::scheduler().current()->block_and_schedule(); + + _socket->exec_call(); + } +} + + +/************************** + ** Socket_call instance ** + **************************/ + +Wifi::Socket_call socket_call; + + +/*************************** + ** Socket_call interface ** + ***************************/ + +using namespace Wifi; + + +Wifi::Socket *Socket_call::socket(int domain, int type, int protocol) +{ + /* FIXME domain, type, protocol values */ + _call.opcode = Call::SOCKET; + _call.socket.domain = domain; + _call.socket.type = type; + _call.socket.protocol = protocol; + + _socket->submit_and_block(); + + if (_call.socket.result == 0) + return 0; + + Wifi::Socket *s = new (Genode::env()->heap()) Wifi::Socket(_call.socket.result); + + return s; +} + + +int Socket_call::close(Socket *s) +{ + _call.opcode = Call::CLOSE; + _call.handle = s; + + _socket->submit_and_block(); + + if (_call.err) + PWRN("error %d on close()", _call.err); + + destroy(Genode::env()->heap(), s); + return 0; +} + + +int Socket_call::bind(Socket *s, Wifi::Sockaddr const *addr, unsigned addrlen) +{ + /* FIXME convert to/from Sockaddr */ + _call.opcode = Call::BIND; + _call.handle = s; + _call.bind.addr = (sockaddr const *)addr; + _call.bind.addrlen = addrlen; + + _socket->submit_and_block(); + + return _call.err; +} + + +int Socket_call::getsockname(Socket *s, Wifi::Sockaddr *addr, unsigned *addrlen) +{ + /* FIXME convert to/from Sockaddr */ + /* FIXME unsigned * -> int * */ + _call.opcode = Call::GETSOCKNAME; + _call.handle = s; + _call.getsockname.addr = (sockaddr *)addr; + _call.getsockname.addrlen = (int *)addrlen; + + _socket->submit_and_block(); + + return _call.err; +} + + +int Socket_call::poll_all(Poll_socket_fd *s, unsigned num, int timeout) +{ + _call.opcode = Call::POLL_ALL; + _call.handle = 0; + _call.poll_all.sockets = s; + _call.poll_all.num = num; + _call.poll_all.timeout = timeout; + + _socket->submit_and_block(); + + return _call.err; +} + + +static int msg_flags(Wifi::Flags in) +{ + int out = Wifi::WIFI_F_NONE; + if (in & Wifi::WIFI_F_MSG_ERRQUEUE) + out |= MSG_ERRQUEUE; + + return out; +}; + + +Wifi::ssize_t Socket_call::recvmsg(Socket *s, Wifi::Msghdr *msg, Wifi::Flags flags) +{ + _call.opcode = Call::RECVMSG; + _call.handle = s; + _call.recvmsg.msg.msg_name = msg->msg_name; + _call.recvmsg.msg.msg_namelen = msg->msg_namelen; + _call.recvmsg.msg.msg_iov = _call.recvmsg.iov; + _call.recvmsg.msg.msg_iovlen = msg->msg_iovlen; + _call.recvmsg.msg.msg_control = msg->msg_control; + _call.recvmsg.msg.msg_controllen = msg->msg_controllen; + _call.recvmsg.flags = msg_flags(flags); + + for (unsigned i = 0; i < msg->msg_iovlen; ++i) { + _call.recvmsg.iov[i].iov_base = msg->msg_iov[i].iov_base; + _call.recvmsg.iov[i].iov_len = msg->msg_iov[i].iov_len; + } + + _socket->submit_and_block(); + + msg->msg_namelen = _call.recvmsg.msg.msg_namelen; + + return _call.err; +} + + +Wifi::ssize_t Socket_call::sendmsg(Socket *s, Wifi::Msghdr const *msg, Wifi::Flags flags) +{ + _call.opcode = Call::SENDMSG; + _call.handle = s; + _call.sendmsg.msg.msg_name = msg->msg_name; + _call.sendmsg.msg.msg_namelen = msg->msg_namelen; + _call.sendmsg.msg.msg_iov = _call.sendmsg.iov; + _call.sendmsg.msg.msg_iovlen = msg->msg_iovlen; + _call.sendmsg.msg.msg_control = 0; + _call.sendmsg.msg.msg_controllen = 0; + _call.sendmsg.flags = msg_flags(flags); + + for (unsigned i = 0; i < msg->msg_iovlen; ++i) { + _call.sendmsg.iov[i].iov_base = msg->msg_iov[i].iov_base; + _call.sendmsg.iov[i].iov_len = msg->msg_iov[i].iov_len; + } + + _socket->submit_and_block(); + + return _call.err; +} + + +static int sockopt_level(Sockopt_level const in) +{ + switch (in) { + case Wifi::WIFI_SOL_SOCKET: return SOL_SOCKET; + case Wifi::WIFI_SOL_NETLINK: return SOL_NETLINK; + } + + return -1; +} + + +static int sockopt_name(Sockopt_level const level, Sockopt_name const in) +{ + switch (level) { + case Wifi::WIFI_SOL_SOCKET: + switch (in) { + case Wifi::WIFI_SO_SNDBUF: return SO_SNDBUF; + case Wifi::WIFI_SO_RCVBUF: return SO_RCVBUF; + case Wifi::WIFI_SO_PASSCRED: return SO_PASSCRED; + case Wifi::WIFI_SO_WIFI_STATUS: return SO_WIFI_STATUS; + + default: return -1; + } + case Wifi::WIFI_SOL_NETLINK: + switch (in) { + case Wifi::WIFI_NETLINK_ADD_MEMBERSHIP: return NETLINK_ADD_MEMBERSHIP; + case Wifi::WIFI_NETLINK_DROP_MEMBERSHIP: return NETLINK_DROP_MEMBERSHIP; + case Wifi::WIFI_NETLINK_PKTINFO: return NETLINK_PKTINFO; + + default: return -1; + } + } + + return -1; +} + + +int Socket_call::setsockopt(Socket *s, + Wifi::Sockopt_level level, Wifi::Sockopt_name optname, + const void *optval, uint32_t optlen) +{ + /* FIXME optval values */ + _call.opcode = Call::SETSOCKOPT; + _call.handle = s; + _call.setsockopt.level = sockopt_level(level); + _call.setsockopt.optname = sockopt_name(level, optname); + _call.setsockopt.optval = optval; + _call.setsockopt.optlen = optlen; + + _socket->submit_and_block(); + + return _call.err; +} + + +void Socket_call::non_block(Socket *s, bool value) +{ + _call.opcode = Call::NON_BLOCK; + _call.handle = s; + _call.non_block.value = value; + + _socket->submit_and_block(); +} + + +void Socket_call::get_mac_address(unsigned char *addr) +{ + _call.opcode = Call::GET_MAC_ADDRESS; + _call.handle = 0; + _call.get_mac_address.addr = addr; + + _socket->submit_and_block(); +} diff --git a/repos/dde_linux/src/lib/wifi/symbol.map b/repos/dde_linux/src/lib/wifi/symbol.map new file mode 100644 index 000000000..f2a585251 --- /dev/null +++ b/repos/dde_linux/src/lib/wifi/symbol.map @@ -0,0 +1,20 @@ +/* + * + */ +{ + global: + + /* initialize function */ + _*wifi_init*; + /* Wifi::Socket_call interface */ + *Socket_call*; + /* Wifi::Socket_call instance */ + socket_call; + + /* used by libnl's time() */ + jiffies; + + local: + + *; +}; diff --git a/repos/dde_linux/src/lib/wifi/timer.cc b/repos/dde_linux/src/lib/wifi/timer.cc new file mode 100644 index 000000000..1bfc9407b --- /dev/null +++ b/repos/dde_linux/src/lib/wifi/timer.cc @@ -0,0 +1,347 @@ +/* + * \brief Signal context for timer events + * \author Josef Soentgen + * \date 2014-10-10 + */ + +/* + * Copyright (C) 2014 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +/* Genode includes */ +#include +#include +#include +#include +#include + +/* local includes */ +#include +#include + +#include +# include +#include + + +unsigned long jiffies; + + +static void run_timer(void*); + +namespace Lx { + class Timer; +} + +/** + * Lx::Timer + */ +class Lx::Timer +{ + public: + + /** + * Context encapsulates a regular linux timer_list + */ + struct Context : public Lx::List::Element + { + enum { INVALID_TIMEOUT = ~0UL }; + + struct timer_list *timer; + bool pending { false }; + unsigned long timeout { INVALID_TIMEOUT }; /* absolute in jiffies */ + bool programmed { false }; + + Context(struct timer_list *timer) : timer(timer) { } + }; + + private: + + ::Timer::Connection _timer_conn; + Lx::List _list; + Lx::Task _timer_task; + Genode::Signal_rpc_member _dispatcher; + Genode::Tslab _timer_alloc; + + /** + * Lookup local timer + */ + Context *_find_context(struct timer_list const *timer) + { + for (Context *c = _list.first(); c; c = c->next()) + if (c->timer == timer) + return c; + + return 0; + } + + /** + * Program the first timer in the list + */ + void _program_first_timer() + { + Context *ctx = _list.first(); + if (!ctx) + return; + + if (!ctx->programmed) { + ctx->programmed = true; + + /* calculate relative microseconds for trigger */ + unsigned long us = ctx->timeout > jiffies ? + jiffies_to_msecs(ctx->timeout - jiffies) * 1000 : 0; + _timer_conn.trigger_once(us); + } + } + + /** + * Schedule timer + */ + void _schedule_timer(Context *ctx, unsigned long expires) + { + _list.remove(ctx); + + ctx->timeout = expires; + ctx->pending = true; + + Context *c = _list.first(); + do { + if (!c) { + _list.insert(ctx); + break; + } + + if (ctx->timeout < c->timeout) { + _list.insert_before(ctx, c); + break; + } + + c = c->next(); + } while (c); + + _program_first_timer(); + } + + /** + * Handle trigger_once signal + */ + void _handle(unsigned) + { + _timer_task.unblock(); + + Lx::scheduler().schedule(); + } + + public: + + /** + * Constructor + */ + Timer(Server::Entrypoint &ep) + : + _timer_task(run_timer, nullptr, "timer", Lx::Task::PRIORITY_2, + Lx::scheduler()), + _dispatcher(ep, *this, &Lx::Timer::_handle), + _timer_alloc(Genode::env()->heap()) + { + _timer_conn.sigh(_dispatcher); + } + + /** + * Add new linux timer + */ + void add(struct timer_list *timer) + { + Context *t = new (&_timer_alloc) Context(timer); + _list.append(t); + } + + /** + * Delete linux timer + */ + int del(struct timer_list *timer) + { + Context *ctx = _find_context(timer); + + /** + * If the timer expired it was already cleaned up after its + * execution. + */ + if (!ctx) + return 0; + + int rv = ctx->timeout != Context::INVALID_TIMEOUT ? 1 : 0; + + _list.remove(ctx); + destroy(&_timer_alloc, ctx); + + return rv; + } + + /** + * Initial scheduling of linux timer + */ + int schedule(struct timer_list *timer, unsigned long expires) + { + Context *ctx = _find_context(timer); + if (!ctx) { + PERR("schedule unknown timer %p", timer); + return -1; /* XXX better use 0 as rv? */ + } + + /* + * If timer was already active return 1, otherwise 0. The return + * value is needed by mod_timer(). + */ + int rv = ctx->timeout != Context::INVALID_TIMEOUT ? 1 : 0; + + _schedule_timer(ctx, expires); + + return rv; + } + + /** + * Schedule next linux timer + */ + void schedule_next() { _program_first_timer(); } + + /** + * Check if the timer is currently pending + */ + bool pending(struct timer_list const *timer) + { + Context *ctx = _find_context(timer); + if (!ctx) { + return false; + } + + return ctx->pending; + } + + Context *find(struct timer_list const *timer) { + return _find_context(timer); } + + /** + * Update jiffie counter + */ + void update_jiffies() + { + jiffies = msecs_to_jiffies(_timer_conn.elapsed_ms()); + } + + /** + * Get first timer context + */ + Context* first() { return _list.first(); } +}; + + +static Lx::Timer *_lx_timer; + + +void Lx::timer_init(Server::Entrypoint &ep) +{ + /* XXX safer way preventing possible nullptr access? */ + static Lx::Timer lx_timer(ep); + _lx_timer = &lx_timer; + + /* initialize value explicitly */ + jiffies = 0UL; +} + + +void Lx::timer_update_jiffies() { + _lx_timer->update_jiffies(); } + + +static void run_timer(void *) +{ + while (1) { + Lx::scheduler().current()->block_and_schedule(); + + while (Lx::Timer::Context *ctx = _lx_timer->first()) { + if (ctx->timeout > jiffies) + break; + + ctx->timer->function(ctx->timer->data); + _lx_timer->del(ctx->timer); + } + + _lx_timer->schedule_next(); + } +} + + +/******************* + ** linux/timer.h ** + *******************/ + +void init_timer(struct timer_list *timer) { } + + +int mod_timer(struct timer_list *timer, unsigned long expires) +{ + if (!_lx_timer->find(timer)) + _lx_timer->add(timer); + + return _lx_timer->schedule(timer, expires); +} + + +void setup_timer(struct timer_list *timer,void (*function)(unsigned long), + unsigned long data) +{ + timer->function = function; + timer->data = data; + init_timer(timer); +} + + +int timer_pending(const struct timer_list *timer) +{ + bool pending = _lx_timer->pending(timer); + + return pending; +} + + +int del_timer(struct timer_list *timer) +{ + int rv = _lx_timer->del(timer); + _lx_timer->schedule_next(); + + return rv; +} + + +/******************* + ** linux/sched.h ** + *******************/ + +static void unblock_task(unsigned long task) +{ + Lx::Task *t = (Lx::Task *)task; + + t->unblock(); +} + + +signed long schedule_timeout(signed long timeout) +{ + long start = jiffies; + struct timer_list timer; + + setup_timer(&timer, unblock_task, (unsigned long)Lx::scheduler().current()); + mod_timer(&timer, timeout); + + Lx::scheduler().current()->block_and_schedule(); + + del_timer(&timer); + + timeout -= (jiffies - start); + + return timeout < 0 ? 0 : timeout; +} diff --git a/repos/dde_linux/src/lib/wifi/work.cc b/repos/dde_linux/src/lib/wifi/work.cc new file mode 100644 index 000000000..d8e457a06 --- /dev/null +++ b/repos/dde_linux/src/lib/wifi/work.cc @@ -0,0 +1,281 @@ +/* + * \brief Workqueue implementation + * \author Josef Soentgen + * \date 2014-10-14 + */ + +/* + * Copyright (C) 2014 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +/* Genode includes */ +#include +#include +#include + +/* local includes */ +#include + +#include +# include +#include + + +static void run_work(void *); +static void run_delayed_work(void *); + +namespace Lx { + class Work; +} + +/** + * Lx::Work + */ +class Lx::Work +{ + public: + + /** + * Context encapsulates a normal work item + */ + struct Context : public Lx::List::Element + { + void *work; + enum Type { NORMAL, DELAYED, TASKLET } type; + + void exec() { + switch (type) { + case NORMAL: + { + work_struct *w = static_cast(work); + w->func(w); + } + break; + case DELAYED: + { + delayed_work *w = static_cast(work); + w->work.func(&(w)->work); + } + break; + case TASKLET: + { + tasklet_struct *tasklet = static_cast(work); + tasklet->func(tasklet->data); + } + break; + } + } + + Context(delayed_work *w) : work(w), type(DELAYED) { } + Context(work_struct *w) : work(w), type(NORMAL) { } + Context(tasklet_struct *w) : work(w), type(TASKLET) { } + }; + + private: + + Lx::Task _task; + Lx::List _list; + + Genode::Tslab _work_alloc; + + public: + + Work(void (*func)(void*), char const *name) + : + _task(func, nullptr, name, Lx::Task::PRIORITY_2, Lx::scheduler()), + _work_alloc(Genode::env()->heap()) + { } + + /** + * Unblock corresponding task + */ + void unblock() { _task.unblock(); } + + /** + * Schedule work item + */ + template + void schedule(WORK *work) + { + Context *c = new (&_work_alloc) Context(work); + _list.append(c); + } + + /** + * Execute all available work items + */ + void exec() + { + while (Context *c = _list.first()) { + c->exec(); + _list.remove(c); + destroy(&_work_alloc, c); + } + } + + /** + * Cancel work item + */ + bool cancel_work(struct work_struct *work, bool sync = false) + { + for (Context *c = _list.first(); c; c = c->next()) { + if (c->work == work) { + if (sync) + c->exec(); + + _list.remove(c); + destroy(&_work_alloc, c); + return true; + } + } + + return false; + } +}; + + +static Lx::Work *_lx_work; +static Lx::Work *_lx_delayed_work; + + +void Lx::work_init(Server::Entrypoint &ep) +{ + static Lx::Work work_ctx(run_work, "work"); + _lx_work = &work_ctx; + + static Lx::Work delayed_work_ctx(run_delayed_work, "delayed_work"); + _lx_delayed_work = &delayed_work_ctx; +} + + +static void run_work(void *) +{ + while (1) { + Lx::scheduler().current()->block_and_schedule(); + + _lx_work->exec(); + } +} + + +static void run_delayed_work(void *) +{ + while (1) { + Lx::scheduler().current()->block_and_schedule(); + + _lx_delayed_work->exec(); + } +} + + +extern "C" { + +/*********************** + ** linux/workquque.h ** + ***********************/ + +int schedule_delayed_work(struct delayed_work *work, unsigned long delay) +{ + _lx_delayed_work->schedule(work); + _lx_delayed_work->unblock(); + + return 0; +} + + +int schedule_work(struct work_struct *work) +{ + _lx_work->schedule(work); + _lx_work->unblock(); + + return 1; +} + + +bool cancel_delayed_work(struct delayed_work *dwork) +{ + int pending = timer_pending(&dwork->timer); + del_timer(&dwork->timer); + + /* if the timer is still pending dwork was not executed */ + return pending; +} + + +bool cancel_delayed_work_sync(struct delayed_work *dwork) +{ + bool pending = cancel_delayed_work(dwork); + + if (pending) { + PERR("WARN: delayed_work %p is executed directly in current '%s' routine", + dwork, Lx::scheduler().current()->name()); + + dwork->work.func(&dwork->work); + } + + return pending; +} + + +static void execute_delayed_work(unsigned long dwork) +{ + _lx_delayed_work->schedule((struct delayed_work *)dwork); + _lx_delayed_work->unblock(); +} + + +bool queue_delayed_work(struct workqueue_struct *wq, + struct delayed_work *dwork, unsigned long delay) +{ + /* treat delayed work without delay like any other work */ + if (delay == 0) { + execute_delayed_work((unsigned long)dwork); + } else { + setup_timer(&dwork->timer, execute_delayed_work, (unsigned long)dwork); + mod_timer(&dwork->timer, delay); + } + return true; +} + + +bool cancel_work_sync(struct work_struct *work) +{ + return _lx_work->cancel_work(work, true); +} + + +bool queue_work(struct workqueue_struct *wq, struct work_struct *work) +{ + _lx_work->schedule(work); + _lx_work->unblock(); + + return true; +} + + +/*********************** + ** linux/interrupt.h ** + ***********************/ + +void tasklet_init(struct tasklet_struct *t, void (*f)(unsigned long), unsigned long d) +{ + t->func = f; + t->data = d; +} + + +void tasklet_schedule(struct tasklet_struct *tasklet) +{ + _lx_work->schedule(tasklet); +} + + +void tasklet_hi_schedule(struct tasklet_struct *tasklet) +{ + tasklet_schedule(tasklet); +} + +} /* extern "C" */ diff --git a/repos/dde_linux/src/lib/wpa_driver_nl80211/dummies.cc b/repos/dde_linux/src/lib/wpa_driver_nl80211/dummies.cc new file mode 100644 index 000000000..7d92d93ab --- /dev/null +++ b/repos/dde_linux/src/lib/wpa_driver_nl80211/dummies.cc @@ -0,0 +1,53 @@ +/** + * \brief Dummy functions + * \author Josef Soentgen + * \date 2014-10-02 + */ + +/* + * Copyright (C) 2014 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +#include + +extern "C" { + typedef long DUMMY; + +enum { + SHOW_DUMMY = 0, + SHOW_SKIP = 0, + SHOW_RET = 0, +}; + +#define DUMMY(retval, name) \ + DUMMY name(void) { \ + if (SHOW_DUMMY) \ + PDBG( #name " called (from %p) not implemented", __builtin_return_address(0)); \ + return retval; \ +} + +#define DUMMY_SKIP(retval, name) \ + DUMMY name(void) { \ + if (SHOW_SKIP) \ + PLOG( #name " called (from %p) skipped", __builtin_return_address(0)); \ + return retval; \ +} + +#define DUMMY_RET(retval, name) \ + DUMMY name(void) { \ + if (SHOW_RET) \ + PWRN( #name " called (from %p) return %d", __builtin_return_address(0), retval); \ + return retval; \ +} + +DUMMY(0, getprotobyname) +DUMMY(0, getprotobynumber) +DUMMY(0, nl_addr_get_binary_addr) +DUMMY(0, nl_addr_get_len) +DUMMY(0, nl_hash_any) +DUMMY(0, rint) + +} /* extern "C" */ diff --git a/repos/dde_linux/src/lib/wpa_driver_nl80211/include/lx_user_emul.h b/repos/dde_linux/src/lib/wpa_driver_nl80211/include/lx_user_emul.h new file mode 100644 index 000000000..951c27c7e --- /dev/null +++ b/repos/dde_linux/src/lib/wpa_driver_nl80211/include/lx_user_emul.h @@ -0,0 +1,232 @@ +#ifndef _LX_USER_EMUL_H_ +#define _LX_USER_EMUL_H_ + +/************************** + ** asm-generic/socket.h ** + **************************/ + +/* enum { */ +/* SOL_SOCKET = 1, */ +/* }; */ + +enum { + SO_PRIORITY = 12, + SO_ATTACH_FILTER = 26, +}; + + +/******************* + ** bits/ioctls.h ** + *******************/ + +enum { + /* SIOCGIFFLAGS = 0x8913, */ + /* SIOCSIFFLAGS = 0x8914, */ + /* SIOCGIFADDR = 0x8915, */ + SIOCSIFHWADDR = 0x8924, + SIOCGIFHWADDR = 0x8927, + /* SIOCGIFINDEX = 0x8933, */ +}; + + +/******************* + ** bits/socket.h ** + *******************/ + +enum { + PF_NETLINK = 16, + PF_PACKET = 17, +}; + +enum { + MSG_ERRQUEUE = 0x2000, +}; + +enum { + SOL_PACKET = 263, +}; + + +/****************** + ** bits/types.h ** + ******************/ + +typedef char *__caddr_t; + + +/******************** + ** linux/socket.h ** + ********************/ + +enum { + AF_BRIDGE = 7, + AF_NETLINK = 16, + AF_PACKET = 17, +}; + + +/********************** + ** linux/errqueue.h ** + **********************/ + +struct sock_extended_err +{ + unsigned int ee_errno; + unsigned char ee_origin; + unsigned char ee_type; + unsigned char ee_code; + unsigned char ee_pad; + unsigned int ee_info; + unsigned int ee_data; +}; + + +/******************** + ** linux/filter.h ** + ********************/ + +enum { + BPF_LD = 0x00, + BPF_ALU = 0x04, + BPF_JMP = 0x05, + BPF_RET = 0x06, + BPF_MISC = 0x07, + + BPF_W = 0x00, + BPF_H = 0x08, + BPF_B = 0x10, + BPF_IND = 0x40, + BPF_LEN = 0x80, + + BPF_ADD = 0x00, + BPF_OR = 0x40, + BPF_AND = 0x50, + BPF_LSH = 0x60, + BPF_RSH = 0x70, + BPF_JA = 0x00, + BPF_JEQ = 0x10, + BPF_K = 0x00, + BPF_X = 0x08, + + BPF_ABS = 0x20, + + BPF_TAX = 0x00, + +}; + +#define BPF_CLASS(code) ((code) & 0x07) + +#ifndef BPF_STMT +#define BPF_STMT(code, k) { (unsigned short)(code), 0, 0, k } +#endif +#ifndef BPF_JUMP +#define BPF_JUMP(code, k, jt, jf) { (unsigned short)(code), jt, jf, k } +#endif + +struct sock_filter +{ + unsigned short code; + unsigned char jt; + unsigned char jf; + unsigned int k; +}; + +struct sock_fprog +{ + unsigned short len; + struct sock_filter *filter; +}; + + +/*********************** + ** linux/if_packet.h ** + ***********************/ + +struct sockaddr_ll { + unsigned short sll_family; + unsigned short sll_protocol; /* BE 16b */ + int sll_ifindex; + unsigned short sll_hatype; + unsigned char sll_pkttype; + unsigned char sll_halen; + unsigned char sll_addr[8]; +}; + + +/************** + ** net/if.h ** + **************/ + +enum { + IFF_UP = 0x01, + IFF_RUNNING = 0x40, +}; + +struct ifmap +{ + unsigned long int mem_start; + unsigned long int mem_end; + unsigned short int base_addr; + unsigned char irq; + unsigned char dma; + unsigned char port; + /* 3 bytes spare */ +}; + +struct ifreq +{ +#define IFHWADDRLEN 6 +#define IF_NAMESIZE 16 +#define IFNAMSIZ IF_NAMESIZE + union + { + char ifrn_name[IFNAMSIZ]; /* Interface name, e.g. "en0". */ + } ifr_ifrn; + + union + { + struct sockaddr ifru_addr; + struct sockaddr ifru_dstaddr; + struct sockaddr ifru_broadaddr; + struct sockaddr ifru_netmask; + struct sockaddr ifru_hwaddr; + short int ifru_flags; + int ifru_ivalue; + int ifru_mtu; + struct ifmap ifru_map; + char ifru_slave[IFNAMSIZ]; /* Just fits the size */ + char ifru_newname[IFNAMSIZ]; + __caddr_t ifru_data; + } ifr_ifru; +#define ifr_name ifr_ifrn.ifrn_name /* interface name */ +#define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */ +#define ifr_addr ifr_ifru.ifru_addr /* address */ +#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-p lnk */ +#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */ +#define ifr_netmask ifr_ifru.ifru_netmask /* interface net mask */ +#define ifr_flags ifr_ifru.ifru_flags /* flags */ +#define ifr_metric ifr_ifru.ifru_ivalue /* metric */ +#define ifr_mtu ifr_ifru.ifru_mtu /* mtu */ +#define ifr_map ifr_ifru.ifru_map /* device map */ +#define ifr_slave ifr_ifru.ifru_slave /* slave device */ +#define ifr_data ifr_ifru.ifru_data /* for use by interface */ +#define ifr_ifindex ifr_ifru.ifru_ivalue /* interface index */ +#define ifr_bandwidth ifr_ifru.ifru_ivalue /* link bandwidth */ +#define ifr_qlen ifr_ifru.ifru_ivalue /* Queue length */ +#define ifr_newname ifr_ifru.ifru_newname /* New name */ +#define ifr_settings ifr_ifru.ifru_settings /* Device/proto settings*/ +}; + +unsigned int if_nametoindex(const char *ifname); +char *if_indextoname(unsigned int ifindex, char *ifname); + + +/****************** + ** net/if_arp.h ** + ******************/ + +enum { + ARPHRD_ETHER = 1, +}; + +#endif /* _LX_USER_EMUL_H_ */ diff --git a/repos/dde_linux/src/lib/wpa_driver_nl80211/include/net/if.h b/repos/dde_linux/src/lib/wpa_driver_nl80211/include/net/if.h new file mode 120000 index 000000000..e89924164 --- /dev/null +++ b/repos/dde_linux/src/lib/wpa_driver_nl80211/include/net/if.h @@ -0,0 +1 @@ +../lx_user_emul.h \ No newline at end of file diff --git a/repos/dde_linux/src/lib/wpa_driver_nl80211/include/net/if_arp.h b/repos/dde_linux/src/lib/wpa_driver_nl80211/include/net/if_arp.h new file mode 120000 index 000000000..e89924164 --- /dev/null +++ b/repos/dde_linux/src/lib/wpa_driver_nl80211/include/net/if_arp.h @@ -0,0 +1 @@ +../lx_user_emul.h \ No newline at end of file diff --git a/repos/dde_linux/src/lib/wpa_driver_nl80211/include/netpacket/packet.h b/repos/dde_linux/src/lib/wpa_driver_nl80211/include/netpacket/packet.h new file mode 120000 index 000000000..e89924164 --- /dev/null +++ b/repos/dde_linux/src/lib/wpa_driver_nl80211/include/netpacket/packet.h @@ -0,0 +1 @@ +../lx_user_emul.h \ No newline at end of file diff --git a/repos/dde_linux/src/lib/wpa_driver_nl80211/ioctl.cc b/repos/dde_linux/src/lib/wpa_driver_nl80211/ioctl.cc new file mode 100644 index 000000000..98f4d2b0a --- /dev/null +++ b/repos/dde_linux/src/lib/wpa_driver_nl80211/ioctl.cc @@ -0,0 +1,100 @@ +/** + * \brief Ioctl functions + * \author Josef Soentgen + * \date 2014-10-02 + */ + +/* + * Copyright (C) 2014 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +/* Genode includes */ +#include + +/* libc includes */ +#include +#include + +/* local includes */ +#include +#include + + +extern Wifi::Socket_call socket_call; + + +extern "C" { + +int ioctl(int fd, unsigned long request, ...) +{ + long arg; + va_list ap; + va_start(ap, request); + arg = va_arg(ap, long); + va_end(ap); + + struct ifreq *ifr = (struct ifreq *)(arg); + + switch (request) { + case SIOCGIFADDR: + PERR("ioctl: request SIOCGIFADDR not implemented."); + return -1; + case SIOCGIFINDEX: + ifr->ifr_ifindex = 1; + return 0; + case SIOCGIFHWADDR: + socket_call.get_mac_address((unsigned char*)ifr->ifr_hwaddr.sa_data); + return 0; + } + + PWRN("ioctl: request %lu not handled by switch", request); + return -1; +} + + +int linux_set_iface_flags(int sock, const char *ifname, int dev_up) +{ + return 0; +} + + +int linux_iface_up(int sock, const char *ifname) +{ + /* in our case the interface is by definition always up */ + return 1; +} + + +int linux_get_ifhwaddr(int sock, const char *ifname, unsigned char *addr) +{ + socket_call.get_mac_address(addr); + return 0; +} + + +int linux_set_ifhwaddr(int sock, const char *ifname, const unsigned char *addr) +{ + return -1; +} + + +int linux_br_add(int sock, const char *brname) { return -1; } + + +int linux_br_del(int sock, const char *brname) { return -1; } + + +int linux_br_add_if(int sock, const char *brname, const char *ifname) { + return -1; } + + +int linux_br_del_if(int sock, const char *brname, const char *ifname) { + return -1; } + + +int linux_br_get(char *brname, const char *ifname) { return -1; } + +} /* extern "C" */ diff --git a/repos/dde_linux/src/lib/wpa_driver_nl80211/symbol.map b/repos/dde_linux/src/lib/wpa_driver_nl80211/symbol.map new file mode 100644 index 000000000..7036f9efc --- /dev/null +++ b/repos/dde_linux/src/lib/wpa_driver_nl80211/symbol.map @@ -0,0 +1,18 @@ +/* + * + */ +{ + global: + + /* array containing all drivers, from drivers.c */ + wpa_drivers; + + /* ethernet frame handlin, from l2_packet_linux.c */ + l2_packet_*; + + poll; + + local: + + *; +}; diff --git a/repos/dde_linux/src/lib/wpa_supplicant/main.c b/repos/dde_linux/src/lib/wpa_supplicant/main.c new file mode 100644 index 000000000..60c50e6ee --- /dev/null +++ b/repos/dde_linux/src/lib/wpa_supplicant/main.c @@ -0,0 +1,43 @@ +/* + * WPA Supplicant / Example program entrypoint + * Copyright (c) 2003-2005, Jouni Malinen + * + * This software may be distributed under the terms of the BSD license. + * See README for more details. + */ + +#include "includes.h" + +#include "common.h" +#include "wpa_supplicant_i.h" + +int wpa_main() +{ + struct wpa_interface iface; + int exitcode = 0; + struct wpa_params params; + struct wpa_global *global; + + memset(¶ms, 0, sizeof(params)); + + params.wpa_debug_level = MSG_INFO; + + global = wpa_supplicant_init(¶ms); + if (global == NULL) + return -1; + + memset(&iface, 0, sizeof(iface)); + + iface.ifname = "wlan0"; + iface.confname = "/wpa_supplicant.conf"; + + if (wpa_supplicant_add_iface(global, &iface) == NULL) + exitcode = -1; + + if (exitcode == 0) + exitcode = wpa_supplicant_run(global); + + wpa_supplicant_deinit(global); + + return exitcode; +} diff --git a/repos/dde_linux/src/lib/wpa_supplicant/symbol.map b/repos/dde_linux/src/lib/wpa_supplicant/symbol.map new file mode 100644 index 000000000..5240f2815 --- /dev/null +++ b/repos/dde_linux/src/lib/wpa_supplicant/symbol.map @@ -0,0 +1,23 @@ +/* + * + */ +{ + global: + + /* needed by wifi_drv */ + wpa_main; + + /* needed by wpa_driver_nl80211 */ + __hide_aliasing_typecast; + eloop_*; + get_hdr_bssid; + ieee80211_freq_to_chan; + ieee80211_radiotap_*; + os_*; + wpa_*; + wpabuf_*; + + local: + + *; +}; diff --git a/repos/dde_linux/wifi.list b/repos/dde_linux/wifi.list new file mode 100644 index 000000000..609b61b96 --- /dev/null +++ b/repos/dde_linux/wifi.list @@ -0,0 +1,330 @@ +linux-3.14.5/crypto/ablkcipher.c +linux-3.14.5/crypto/aead.c +linux-3.14.5/crypto/aes_generic.c +linux-3.14.5/crypto/algapi.c +linux-3.14.5/crypto/algboss.c +linux-3.14.5/crypto/api.c +linux-3.14.5/crypto/arc4.c +linux-3.14.5/crypto/blkcipher.c +linux-3.14.5/crypto/ccm.c +linux-3.14.5/crypto/chainiv.c +linux-3.14.5/crypto/cipher.c +linux-3.14.5/crypto/compress.c +linux-3.14.5/crypto/crypto_wq.c +linux-3.14.5/crypto/ctr.c +linux-3.14.5/crypto/internal.h +linux-3.14.5/crypto/krng.c +linux-3.14.5/crypto/memneq.c +linux-3.14.5/crypto/rng.c +linux-3.14.5/crypto/scatterwalk.c +linux-3.14.5/drivers/leds/led-class.c +linux-3.14.5/drivers/leds/led-core.c +linux-3.14.5/drivers/leds/led-triggers.c +linux-3.14.5/drivers/leds/leds.h +linux-3.14.5/drivers/net/wireless/iwlegacy/3945-mac.c +linux-3.14.5/drivers/net/wireless/iwlegacy/3945-rs.c +linux-3.14.5/drivers/net/wireless/iwlegacy/3945.c +linux-3.14.5/drivers/net/wireless/iwlegacy/3945.h +linux-3.14.5/drivers/net/wireless/iwlegacy/4965-calib.c +linux-3.14.5/drivers/net/wireless/iwlegacy/4965-mac.c +linux-3.14.5/drivers/net/wireless/iwlegacy/4965-rs.c +linux-3.14.5/drivers/net/wireless/iwlegacy/4965.c +linux-3.14.5/drivers/net/wireless/iwlegacy/4965.h +linux-3.14.5/drivers/net/wireless/iwlegacy/commands.h +linux-3.14.5/drivers/net/wireless/iwlegacy/common.c +linux-3.14.5/drivers/net/wireless/iwlegacy/common.h +linux-3.14.5/drivers/net/wireless/iwlegacy/csr.h +linux-3.14.5/drivers/net/wireless/iwlegacy/iwl-spectrum.h +linux-3.14.5/drivers/net/wireless/iwlegacy/prph.h +linux-3.14.5/drivers/net/wireless/iwlwifi/dvm/agn.h +linux-3.14.5/drivers/net/wireless/iwlwifi/dvm/calib.c +linux-3.14.5/drivers/net/wireless/iwlwifi/dvm/calib.h +linux-3.14.5/drivers/net/wireless/iwlwifi/dvm/commands.h +linux-3.14.5/drivers/net/wireless/iwlwifi/dvm/dev.h +linux-3.14.5/drivers/net/wireless/iwlwifi/dvm/devices.c +linux-3.14.5/drivers/net/wireless/iwlwifi/dvm/led.c +linux-3.14.5/drivers/net/wireless/iwlwifi/dvm/led.h +linux-3.14.5/drivers/net/wireless/iwlwifi/dvm/lib.c +linux-3.14.5/drivers/net/wireless/iwlwifi/dvm/mac80211.c +linux-3.14.5/drivers/net/wireless/iwlwifi/dvm/main.c +linux-3.14.5/drivers/net/wireless/iwlwifi/dvm/power.c +linux-3.14.5/drivers/net/wireless/iwlwifi/dvm/power.h +linux-3.14.5/drivers/net/wireless/iwlwifi/dvm/rs.c +linux-3.14.5/drivers/net/wireless/iwlwifi/dvm/rs.h +linux-3.14.5/drivers/net/wireless/iwlwifi/dvm/rx.c +linux-3.14.5/drivers/net/wireless/iwlwifi/dvm/rxon.c +linux-3.14.5/drivers/net/wireless/iwlwifi/dvm/scan.c +linux-3.14.5/drivers/net/wireless/iwlwifi/dvm/sta.c +linux-3.14.5/drivers/net/wireless/iwlwifi/dvm/tt.c +linux-3.14.5/drivers/net/wireless/iwlwifi/dvm/tt.h +linux-3.14.5/drivers/net/wireless/iwlwifi/dvm/tx.c +linux-3.14.5/drivers/net/wireless/iwlwifi/dvm/ucode.c +linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-1000.c +linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-2000.c +linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-5000.c +linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-6000.c +linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-7000.c +linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-agn-hw.h +linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-config.h +linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-csr.h +linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-debug.c +linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-debug.h +linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-devtrace.h +linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-drv.c +linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-drv.h +linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.c +linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.h +linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-eeprom-read.c +linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-eeprom-read.h +linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-fh.h +linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-fw-file.h +linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-fw.h +linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-io.c +linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-io.h +linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-modparams.h +linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-notif-wait.c +linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-notif-wait.h +linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c +linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-nvm-parse.h +linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-op-mode.h +linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-phy-db.c +linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-phy-db.h +linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-prph.h +linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-trans.h +linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/binding.c +linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/bt-coex.c +linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/constants.h +linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/d3.c +linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/fw-api-bt-coex.h +linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/fw-api-d3.h +linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/fw-api-mac.h +linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/fw-api-power.h +linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/fw-api-rs.h +linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h +linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/fw-api-sta.h +linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/fw-api-tx.h +linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/fw-api.h +linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/fw.c +linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/led.c +linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c +linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/mac80211.c +linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/mvm.h +linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/nvm.c +linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/ops.c +linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/phy-ctxt.c +linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/power.c +linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/power_legacy.c +linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/quota.c +linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/rs.c +linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/rs.h +linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/rx.c +linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/scan.c +linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/sta.c +linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/sta.h +linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/testmode.h +linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/time-event.c +linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/time-event.h +linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/tt.c +linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/tx.c +linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/utils.c +linux-3.14.5/drivers/net/wireless/iwlwifi/pcie/drv.c +linux-3.14.5/drivers/net/wireless/iwlwifi/pcie/internal.h +linux-3.14.5/drivers/net/wireless/iwlwifi/pcie/rx.c +linux-3.14.5/drivers/net/wireless/iwlwifi/pcie/trans.c +linux-3.14.5/drivers/net/wireless/iwlwifi/pcie/tx.c +linux-3.14.5/include/asm-generic/atomic64.h +linux-3.14.5/include/asm-generic/bitops/__ffs.h +linux-3.14.5/include/asm-generic/bitops/__fls.h +linux-3.14.5/include/asm-generic/bitops/ffs.h +linux-3.14.5/include/asm-generic/bitops/fls.h +linux-3.14.5/include/asm-generic/bitops/fls64.h +linux-3.14.5/include/asm-generic/bitops/non-atomic.h +linux-3.14.5/include/asm-generic/pci-dma-compat.h +linux-3.14.5/include/crypto/aead.h +linux-3.14.5/include/crypto/aes.h +linux-3.14.5/include/crypto/algapi.h +linux-3.14.5/include/crypto/crypto_wq.h +linux-3.14.5/include/crypto/ctr.h +linux-3.14.5/include/crypto/internal/aead.h +linux-3.14.5/include/crypto/internal/rng.h +linux-3.14.5/include/crypto/internal/skcipher.h +linux-3.14.5/include/crypto/rng.h +linux-3.14.5/include/crypto/scatterwalk.h +linux-3.14.5/include/crypto/skcipher.h +linux-3.14.5/include/linux/crypto.h +linux-3.14.5/include/linux/cryptouser.h +linux-3.14.5/include/linux/ctype.h +linux-3.14.5/include/linux/errqueue.h +linux-3.14.5/include/linux/genetlink.h +linux-3.14.5/include/linux/hashtable.h +linux-3.14.5/include/linux/ieee80211.h +linux-3.14.5/include/linux/if_ether.h +linux-3.14.5/include/linux/if_link.h +linux-3.14.5/include/linux/input.h +linux-3.14.5/include/linux/jhash.h +linux-3.14.5/include/linux/leds.h +linux-3.14.5/include/linux/list.h +linux-3.14.5/include/linux/list_nulls.h +linux-3.14.5/include/linux/lockdep.h +linux-3.14.5/include/linux/log2.h +linux-3.14.5/include/linux/mod_devicetable.h +linux-3.14.5/include/linux/net.h +linux-3.14.5/include/linux/netdev_features.h +linux-3.14.5/include/linux/netlink.h +linux-3.14.5/include/linux/pci_ids.h +linux-3.14.5/include/linux/rbtree.h +linux-3.14.5/include/linux/rbtree_augmented.h +linux-3.14.5/include/linux/rfkill-gpio.h +linux-3.14.5/include/linux/rfkill-regulator.h +linux-3.14.5/include/linux/rfkill.h +linux-3.14.5/include/linux/rtnetlink.h +linux-3.14.5/include/linux/skbuff.h +linux-3.14.5/include/linux/socket.h +linux-3.14.5/include/linux/swab.h +linux-3.14.5/include/net/cfg80211.h +linux-3.14.5/include/net/dsfield.h +linux-3.14.5/include/net/dst.h +linux-3.14.5/include/net/dst_ops.h +linux-3.14.5/include/net/genetlink.h +linux-3.14.5/include/net/ieee80211_radiotap.h +linux-3.14.5/include/net/inet_frag.h +linux-3.14.5/include/net/mac80211.h +linux-3.14.5/include/net/neighbour.h +linux-3.14.5/include/net/netlink.h +linux-3.14.5/include/net/netns/ipv4.h +linux-3.14.5/include/net/netns/mib.h +linux-3.14.5/include/net/regulatory.h +linux-3.14.5/include/net/request_sock.h +linux-3.14.5/include/net/rtnetlink.h +linux-3.14.5/include/net/snmp.h +linux-3.14.5/include/net/sock.h +linux-3.14.5/include/net/tcp_states.h +linux-3.14.5/include/net/timewait_sock.h +linux-3.14.5/include/trace/events/skb.h +linux-3.14.5/include/trace/events/sock.h +linux-3.14.5/include/uapi/asm-generic/socket.h +linux-3.14.5/include/uapi/linux/byteorder/little_endian.h +linux-3.14.5/include/uapi/linux/errqueue.h +linux-3.14.5/include/uapi/linux/genetlink.h +linux-3.14.5/include/uapi/linux/if_bridge.h +linux-3.14.5/include/uapi/linux/if_ether.h +linux-3.14.5/include/uapi/linux/if_link.h +linux-3.14.5/include/uapi/linux/if_packet.h +linux-3.14.5/include/uapi/linux/input.h +linux-3.14.5/include/uapi/linux/neighbour.h +linux-3.14.5/include/uapi/linux/net.h +linux-3.14.5/include/uapi/linux/netlink.h +linux-3.14.5/include/uapi/linux/nl80211.h +linux-3.14.5/include/uapi/linux/pci_regs.h +linux-3.14.5/include/uapi/linux/rfkill.h +linux-3.14.5/include/uapi/linux/rtnetlink.h +linux-3.14.5/include/uapi/linux/snmp.h +linux-3.14.5/include/uapi/linux/socket.h +linux-3.14.5/include/uapi/linux/sockios.h +linux-3.14.5/include/uapi/linux/swab.h +linux-3.14.5/lib/average.c +linux-3.14.5/lib/crc32.c +linux-3.14.5/lib/crc32defs.h +linux-3.14.5/lib/ctype.c +linux-3.14.5/lib/nlattr.c +linux-3.14.5/lib/rbtree.c +linux-3.14.5/net/core/datagram.c +linux-3.14.5/net/core/rtnetlink.c +linux-3.14.5/net/core/skbuff.c +linux-3.14.5/net/core/sock.c +linux-3.14.5/net/ethernet/eth.c +linux-3.14.5/net/mac80211/aes_ccm.c +linux-3.14.5/net/mac80211/aes_ccm.h +linux-3.14.5/net/mac80211/aes_cmac.c +linux-3.14.5/net/mac80211/aes_cmac.h +linux-3.14.5/net/mac80211/agg-rx.c +linux-3.14.5/net/mac80211/agg-tx.c +linux-3.14.5/net/mac80211/cfg.c +linux-3.14.5/net/mac80211/cfg.h +linux-3.14.5/net/mac80211/chan.c +linux-3.14.5/net/mac80211/debug.h +linux-3.14.5/net/mac80211/debugfs.h +linux-3.14.5/net/mac80211/debugfs_key.h +linux-3.14.5/net/mac80211/debugfs_netdev.h +linux-3.14.5/net/mac80211/debugfs_sta.h +linux-3.14.5/net/mac80211/driver-ops.h +linux-3.14.5/net/mac80211/event.c +linux-3.14.5/net/mac80211/ht.c +linux-3.14.5/net/mac80211/ibss.c +linux-3.14.5/net/mac80211/ieee80211_i.h +linux-3.14.5/net/mac80211/iface.c +linux-3.14.5/net/mac80211/key.c +linux-3.14.5/net/mac80211/key.h +linux-3.14.5/net/mac80211/led.c +linux-3.14.5/net/mac80211/led.h +linux-3.14.5/net/mac80211/main.c +linux-3.14.5/net/mac80211/mesh.c +linux-3.14.5/net/mac80211/mesh.h +linux-3.14.5/net/mac80211/mesh_hwmp.c +linux-3.14.5/net/mac80211/mesh_pathtbl.c +linux-3.14.5/net/mac80211/mesh_plink.c +linux-3.14.5/net/mac80211/mesh_ps.c +linux-3.14.5/net/mac80211/mesh_sync.c +linux-3.14.5/net/mac80211/michael.c +linux-3.14.5/net/mac80211/michael.h +linux-3.14.5/net/mac80211/mlme.c +linux-3.14.5/net/mac80211/offchannel.c +linux-3.14.5/net/mac80211/pm.c +linux-3.14.5/net/mac80211/rate.c +linux-3.14.5/net/mac80211/rate.h +linux-3.14.5/net/mac80211/rc80211_pid.h +linux-3.14.5/net/mac80211/rc80211_pid_algo.c +linux-3.14.5/net/mac80211/rx.c +linux-3.14.5/net/mac80211/scan.c +linux-3.14.5/net/mac80211/spectmgmt.c +linux-3.14.5/net/mac80211/sta_info.c +linux-3.14.5/net/mac80211/sta_info.h +linux-3.14.5/net/mac80211/status.c +linux-3.14.5/net/mac80211/tkip.c +linux-3.14.5/net/mac80211/tkip.h +linux-3.14.5/net/mac80211/trace.c +linux-3.14.5/net/mac80211/trace.h +linux-3.14.5/net/mac80211/tx.c +linux-3.14.5/net/mac80211/util.c +linux-3.14.5/net/mac80211/vht.c +linux-3.14.5/net/mac80211/wep.c +linux-3.14.5/net/mac80211/wep.h +linux-3.14.5/net/mac80211/wme.c +linux-3.14.5/net/mac80211/wme.h +linux-3.14.5/net/mac80211/wpa.c +linux-3.14.5/net/mac80211/wpa.h +linux-3.14.5/net/netlink/af_netlink.c +linux-3.14.5/net/netlink/af_netlink.h +linux-3.14.5/net/netlink/genetlink.c +linux-3.14.5/net/packet/af_packet.c +linux-3.14.5/net/packet/internal.h +linux-3.14.5/net/rfkill/core.c +linux-3.14.5/net/rfkill/input.c +linux-3.14.5/net/rfkill/rfkill-gpio.c +linux-3.14.5/net/rfkill/rfkill-regulator.c +linux-3.14.5/net/rfkill/rfkill.h +linux-3.14.5/net/wireless/ap.c +linux-3.14.5/net/wireless/chan.c +linux-3.14.5/net/wireless/core.c +linux-3.14.5/net/wireless/core.h +linux-3.14.5/net/wireless/debugfs.h +linux-3.14.5/net/wireless/ethtool.c +linux-3.14.5/net/wireless/ethtool.h +linux-3.14.5/net/wireless/ibss.c +linux-3.14.5/net/wireless/mesh.c +linux-3.14.5/net/wireless/mlme.c +linux-3.14.5/net/wireless/nl80211.c +linux-3.14.5/net/wireless/nl80211.h +linux-3.14.5/net/wireless/radiotap.c +linux-3.14.5/net/wireless/rdev-ops.h +linux-3.14.5/net/wireless/reg.c +linux-3.14.5/net/wireless/reg.h +linux-3.14.5/net/wireless/regdb.h +linux-3.14.5/net/wireless/scan.c +linux-3.14.5/net/wireless/sme.c +linux-3.14.5/net/wireless/sysfs.c +linux-3.14.5/net/wireless/sysfs.h +linux-3.14.5/net/wireless/trace.c +linux-3.14.5/net/wireless/trace.h +linux-3.14.5/net/wireless/util.c +linux-3.14.5/net/wireless/wext-compat.h