bcmdhd: merge bcmdhd driver into prod kernel tree
Add bcmdhd driver Add zero-sugar-wifi-cal_defconfig (selecting bcmdhd driver (supporting wl tool) instead of brcmfmac driver). Add zero-sugar-wifi-cal.dts (selecting bcmdhd driver (supporting wl tool) instead of brcmfmac).pull/10/head
parent
3fc278d53c
commit
9535a516d1
|
@ -0,0 +1,720 @@
|
|||
/*
|
||||
* Copyright (C) 2015 Freescale Semiconductor, Inc.
|
||||
*
|
||||
* This file is dual-licensed: you can use it either under the terms
|
||||
* of the GPL or the X11 license, at your option. Note that this dual
|
||||
* licensing only applies to this file, and not this project as a
|
||||
* whole.
|
||||
*
|
||||
* a) This file is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This file is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* Or, alternatively,
|
||||
*
|
||||
* b) Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use,
|
||||
* copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/dts-v1/;
|
||||
|
||||
#include "imx7d.dtsi"
|
||||
|
||||
/ {
|
||||
model = "reMarkable 2.0 Prototype 1";
|
||||
compatible = "fsl,imx7d-sdb", "fsl,imx7d";
|
||||
|
||||
chosen {
|
||||
stdout-path = &uart1;
|
||||
};
|
||||
|
||||
memory {
|
||||
reg = <0x80000000 0x80000000>;
|
||||
};
|
||||
|
||||
reg_usb_otg1_vbus: regulator-usb-otg1-vbus {
|
||||
compatible = "regulator-fixed";
|
||||
regulator-name = "usb_otg1_vbus";
|
||||
regulator-min-microvolt = <5000000>;
|
||||
regulator-max-microvolt = <5000000>;
|
||||
/*gpio = <&gpio1 5 GPIO_ACTIVE_HIGH>;
|
||||
enable-active-high;*/
|
||||
};
|
||||
|
||||
reg_usb_otg2_vbus: regulator-usb-otg2-vbus {
|
||||
compatible = "regulator-fixed";
|
||||
regulator-name = "usb_otg2_vbus";
|
||||
regulator-min-microvolt = <5000000>;
|
||||
regulator-max-microvolt = <5000000>;
|
||||
/*gpio = <&gpio1 7 GPIO_ACTIVE_HIGH>;
|
||||
enable-active-high;*/
|
||||
};
|
||||
|
||||
reg_vref_1v8: regulator-vref-1v8 {
|
||||
compatible = "regulator-fixed";
|
||||
regulator-name = "vref-1v8";
|
||||
regulator-min-microvolt = <1800000>;
|
||||
regulator-max-microvolt = <1800000>;
|
||||
};
|
||||
|
||||
wifi_pwrseq: wifi_pwrseq {
|
||||
compatible = "mmc-pwrseq-simple";
|
||||
reset-gpios = <&gpio5 9 GPIO_ACTIVE_LOW>;
|
||||
clocks = <&clks IMX7D_CLKO2_ROOT_DIV>;
|
||||
clock-names = "32K_ext_wifi_clk";
|
||||
};
|
||||
};
|
||||
|
||||
&cpu0 {
|
||||
arm-supply = <&buck1_reg>;
|
||||
};
|
||||
|
||||
&clks {
|
||||
assigned-clocks = <&clks IMX7D_CLKO2_ROOT_SRC>,
|
||||
<&clks IMX7D_CLKO2_ROOT_DIV>;
|
||||
assigned-clock-parents = <&clks IMX7D_CKIL>;
|
||||
assigned-clock-rates = <0>, <32768>;
|
||||
};
|
||||
|
||||
&i2c1 {
|
||||
clock-frequency = <400000>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&pinctrl_i2c1>;
|
||||
status = "okay";
|
||||
|
||||
digitizer: wacom-i2c@09 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&pinctrl_wacom>;
|
||||
compatible = "wacom,wacom-i2c";
|
||||
reg = <0x09>;
|
||||
interrupt-parent = <&gpio1>;
|
||||
interrupts = <1 2>;
|
||||
reset-gpio = <&gpio1 0 1>;
|
||||
enable-gpio = <&gpio1 6 1>;
|
||||
};
|
||||
};
|
||||
|
||||
&i2c2 {
|
||||
clock-frequency = <100000>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&pinctrl_i2c2>;
|
||||
status = "okay";
|
||||
|
||||
pmic: bd7181x@4b {
|
||||
reg = <0x4b>;
|
||||
compatible = "rohm,bd71815";
|
||||
/* PMIC_INT_B GPIO6_IO16 */
|
||||
gpio_intr = <&gpio6 16 0>;
|
||||
|
||||
bd7181x,pmic-buck1-uses-i2c-dvs;
|
||||
bd7181x,pmic-buck1-dvs-voltage = <1150000>, <950000>; /* VDD_ARM */
|
||||
bd7181x,pmic-buck2-uses-i2c-dvs;
|
||||
bd7181x,pmic-buck2-dvs-voltage = <1150000>, <950000>; /* VDD_SOC */
|
||||
|
||||
gpo {
|
||||
rohm,mode = <0x30>; /* 0b0011_0000 all gpos with cmos output mode */
|
||||
};
|
||||
|
||||
regulators {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
buck1_reg: regulator@0 {
|
||||
reg = <0>;
|
||||
regulator-compatible = "buck1";
|
||||
regulator-min-microvolt = <800000>;
|
||||
regulator-max-microvolt = <2000000>;
|
||||
regulator-boot-on;
|
||||
regulator-always-on;
|
||||
regulator-ramp-delay = <1250>;
|
||||
};
|
||||
|
||||
buck2_reg: regulator@1 {
|
||||
reg = <1>;
|
||||
regulator-compatible = "buck2";
|
||||
regulator-min-microvolt = <800000>;
|
||||
regulator-max-microvolt = <2000000>;
|
||||
regulator-boot-on;
|
||||
regulator-always-on;
|
||||
regulator-ramp-delay = <1250>;
|
||||
};
|
||||
|
||||
buck3_reg: regulator@2 {
|
||||
reg = <2>;
|
||||
regulator-compatible = "buck3";
|
||||
regulator-min-microvolt = <1200000>;
|
||||
regulator-max-microvolt = <2700000>;
|
||||
regulator-boot-on;
|
||||
regulator-always-on;
|
||||
};
|
||||
|
||||
buck4_reg: regulator@3 {
|
||||
reg = <3>;
|
||||
regulator-compatible = "buck4";
|
||||
regulator-min-microvolt = <1100000>;
|
||||
regulator-max-microvolt = <1850000>;
|
||||
regulator-boot-on;
|
||||
regulator-always-on;
|
||||
};
|
||||
|
||||
buck5_reg: regulator@4 {
|
||||
reg = <4>;
|
||||
regulator-compatible = "buck5";
|
||||
regulator-min-microvolt = <1800000>;
|
||||
regulator-max-microvolt = <3300000>;
|
||||
regulator-boot-on;
|
||||
regulator-always-on;
|
||||
};
|
||||
|
||||
ldo1_reg: regulator@5 {
|
||||
reg = <5>;
|
||||
regulator-compatible = "ldo1";
|
||||
regulator-min-microvolt = <800000>;
|
||||
regulator-max-microvolt = <3300000>;
|
||||
regulator-boot-on;
|
||||
regulator-always-on;
|
||||
};
|
||||
|
||||
ldo2_reg: regulator@6 {
|
||||
reg = <6>;
|
||||
regulator-compatible = "ldo2";
|
||||
regulator-min-microvolt = <800000>;
|
||||
regulator-max-microvolt = <3300000>;
|
||||
regulator-boot-on;
|
||||
regulator-always-on;
|
||||
};
|
||||
|
||||
ldo3_reg: regulator@7 {
|
||||
reg = <7>;
|
||||
regulator-compatible = "ldo3";
|
||||
regulator-min-microvolt = <800000>;
|
||||
regulator-max-microvolt = <3300000>;
|
||||
regulator-boot-on;
|
||||
regulator-always-on;
|
||||
};
|
||||
|
||||
ldo4_reg: regulator@8 {
|
||||
reg = <8>;
|
||||
regulator-compatible = "ldo4";
|
||||
regulator-min-microvolt = <800000>;
|
||||
regulator-max-microvolt = <3300000>;
|
||||
regulator-boot-on;
|
||||
regulator-always-on;
|
||||
};
|
||||
|
||||
ldo5_reg: regulator@9 {
|
||||
reg = <9>;
|
||||
regulator-compatible = "ldo5";
|
||||
regulator-min-microvolt = <800000>;
|
||||
regulator-max-microvolt = <3300000>;
|
||||
regulator-boot-on;
|
||||
regulator-always-on;
|
||||
};
|
||||
|
||||
dvref_reg: regulator@10 {
|
||||
reg = <10>;
|
||||
regulator-compatible = "dvref";
|
||||
regulator-boot-on;
|
||||
regulator-always-on;
|
||||
};
|
||||
|
||||
lpsr_reg: regulator@11 {
|
||||
reg = <11>;
|
||||
regulator-compatible = "lpsr";
|
||||
regulator-boot-on;
|
||||
regulator-always-on;
|
||||
};
|
||||
|
||||
wled_reg: regulator@12 {
|
||||
reg = <12>;
|
||||
regulator-compatible = "wled";
|
||||
regulator-min-microamp = <10>;
|
||||
regulator-max-microamp = <25000>;
|
||||
regulator-boot-on;
|
||||
regulator-always-on;
|
||||
};
|
||||
};
|
||||
regulator-virtuals {
|
||||
compatible = "simple-bus";
|
||||
|
||||
virt-buck1 {
|
||||
compatible = "regulator-virtual";
|
||||
virtual-supply = "buck1";
|
||||
};
|
||||
virt-buck2 {
|
||||
compatible = "regulator-virtual";
|
||||
virtual-supply = "buck2";
|
||||
};
|
||||
virt-buck3 {
|
||||
compatible = "regulator-virtual";
|
||||
virtual-supply = "buck3";
|
||||
};
|
||||
virt-buck4 {
|
||||
compatible = "regulator-virtual";
|
||||
virtual-supply = "buck4";
|
||||
};
|
||||
virt-buck5 {
|
||||
compatible = "regulator-virtual";
|
||||
virtual-supply = "buck5";
|
||||
};
|
||||
virt-ldo1 {
|
||||
compatible = "regulator-virtual";
|
||||
virtual-supply = "ldo1";
|
||||
};
|
||||
virt-ldo2 {
|
||||
compatible = "regulator-virtual";
|
||||
virtual-supply = "ldo2";
|
||||
};
|
||||
virt-ldo3 {
|
||||
compatible = "regulator-virtual";
|
||||
virtual-supply = "ldo3";
|
||||
};
|
||||
virt-ldo4 {
|
||||
compatible = "regulator-virtual";
|
||||
virtual-supply = "ldo4";
|
||||
};
|
||||
virt-ldo5 {
|
||||
compatible = "regulator-virtual";
|
||||
virtual-supply = "ldo5";
|
||||
};
|
||||
user-dvref {
|
||||
compatible = "userspace_consumer";
|
||||
uc-name = "dvref";
|
||||
suck-supply = "dvref";
|
||||
};
|
||||
user-lpsr {
|
||||
compatible = "userspace_consumer";
|
||||
uc-name = "lpsr";
|
||||
suck-supply = "lpsr";
|
||||
};
|
||||
|
||||
virt-wled {
|
||||
compatible = "regulator-virtual";
|
||||
virtual-supply = "wled";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
&i2c3 {
|
||||
clock-frequency = <100000>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&pinctrl_i2c3>;
|
||||
status = "okay";
|
||||
|
||||
tsc@24 {
|
||||
status = "okay";
|
||||
compatible = "cy,cyttsp5_i2c_adapter";
|
||||
reg = <0x24>;
|
||||
interrupt-parent = <&gpio1>;
|
||||
interrupts = <14 2>;
|
||||
cy,adapter_id = "cyttsp5_i2c_adapter";
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&pinctrl_touch>;
|
||||
|
||||
cy,core {
|
||||
cy,name = "cyttsp5_core";
|
||||
|
||||
cy,irq_gpio = <&gpio1 14 0>;
|
||||
cy,rst_gpio = <&gpio1 13 0>;
|
||||
cy,hid_desc_register = <1>;
|
||||
/* CY_CORE_FLAG_RESTORE_PARAMETERS */
|
||||
cy,flags = <4>;
|
||||
/* CY_CORE_EWG_NONE */
|
||||
cy,easy_wakeup_gesture = <0>;
|
||||
cy,btn_keys = <172 /* KEY_HOMEPAGE */
|
||||
/* previously was KEY_HOME, new Android versions use KEY_HOMEPAGE */
|
||||
139 /* KEY_MENU */
|
||||
158 /* KEY_BACK */
|
||||
217 /* KEY_SEARCH */
|
||||
114 /* KEY_VOLUMEDOWN */
|
||||
115 /* KEY_VOLUMEUP */
|
||||
212 /* KEY_CAMERA */
|
||||
116>; /* KEY_POWER */
|
||||
cy,btn_keys-tag = <0>;
|
||||
|
||||
cy,mt {
|
||||
cy,name = "cyttsp5_mt";
|
||||
|
||||
cy,inp_dev_name = "cyttsp5_mt";
|
||||
cy,flags = <0>;
|
||||
cy,abs =
|
||||
/* ABS_MT_POSITION_X, CY_ABS_MIN_X, CY_ABS_MAX_X, 0, 0 */
|
||||
<0x35 0 880 0 0
|
||||
/* ABS_MT_POSITION_Y, CY_ABS_MIN_Y, CY_ABS_MAX_Y, 0, 0 */
|
||||
0x36 0 1280 0 0
|
||||
/* ABS_MT_PRESSURE, CY_ABS_MIN_P, CY_ABS_MAX_P, 0, 0 */
|
||||
0x3a 0 255 0 0
|
||||
/* CY_IGNORE_VALUE, CY_ABS_MIN_W, CY_ABS_MAX_W, 0, 0 */
|
||||
0xffff 0 255 0 0
|
||||
/* ABS_MT_TRACKING_ID, CY_ABS_MIN_T, CY_ABS_MAX_T, 0, 0 */
|
||||
0x39 0 15 0 0
|
||||
/* ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0 */
|
||||
0x30 0 255 0 0
|
||||
/* ABS_MT_TOUCH_MINOR, 0, 255, 0, 0 */
|
||||
0x31 0 255 0 0
|
||||
/* ABS_MT_ORIENTATION, -127, 127, 0, 0 */
|
||||
0x34 0xffffff81 127 0 0
|
||||
/* ABS_MT_TOOL_TYPE, 0, MT_TOOL_MAX, 0, 0 */
|
||||
0x37 0 1 0 0
|
||||
/* ABS_DISTANCE, 0, 255, 0, 0 */
|
||||
0x19 0 255 0 0>;
|
||||
|
||||
cy,vkeys_x = <720>;
|
||||
cy,vkeys_y = <1280>;
|
||||
|
||||
cy,virtual_keys = /* KeyCode CenterX CenterY Width Height */
|
||||
/* KEY_BACK */
|
||||
<158 1360 90 160 180
|
||||
/* KEY_MENU */
|
||||
139 1360 270 160 180
|
||||
/* KEY_HOMEPAGE */
|
||||
172 1360 450 160 180
|
||||
/* KEY SEARCH */
|
||||
217 1360 630 160 180>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&i2c4 {
|
||||
clock-frequency = <100000>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&pinctrl_i2c4>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&lcdif {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&pinctrl_lcdif>;
|
||||
/* TODO: enable-gpio = <&extended_io 7 GPIO_ACTIVE_LOW>; */
|
||||
display = <&display0>;
|
||||
status = "okay";
|
||||
|
||||
display0: display {
|
||||
bits-per-pixel = <24>;
|
||||
bus-width = <24>;
|
||||
|
||||
display-timings {
|
||||
native-mode = <&timing0>;
|
||||
|
||||
timing0: timing0 {
|
||||
clock-frequency = <40000000>;
|
||||
hactive = <334>;
|
||||
vactive = <1405>;
|
||||
hfront-porch = <1>;
|
||||
hback-porch = <1>;
|
||||
hsync-len = <1>;
|
||||
vback-porch = <1>;
|
||||
vfront-porch = <1>;
|
||||
vsync-len = <1>;
|
||||
hsync-active = <0>;
|
||||
vsync-active = <0>;
|
||||
de-active = <1>;
|
||||
pixelclk-active = <1>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&sdma {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&iomuxc_lpsr {
|
||||
pinctrl-names = "default";
|
||||
|
||||
imx7d-sdb {
|
||||
pinctrl_wacom: wacomgrp {
|
||||
fsl,pins = <
|
||||
/*MX7D_PAD_LPSR_GPIO1_IO00__GPIO1_IO0 0x00000074 /* WACOM RESET */
|
||||
MX7D_PAD_LPSR_GPIO1_IO01__GPIO1_IO1 0x00000034 /* WACOM INT */
|
||||
MX7D_PAD_LPSR_GPIO1_IO04__GPIO1_IO4 0x00000074 /* PDCTB */
|
||||
/*MX7D_PAD_LPSR_GPIO1_IO05__GPIO1_IO5 0x00000014 /* FWE */
|
||||
/*MX7D_PAD_LPSR_GPIO1_IO06__GPIO1_IO6 0x00000014 /* WACOM PWR ENABLE */
|
||||
>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&uart1 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&pinctrl_uart1>;
|
||||
assigned-clocks = <&clks IMX7D_UART1_ROOT_SRC>;
|
||||
assigned-clock-parents = <&clks IMX7D_OSC_24M_CLK>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
/*
|
||||
&usbotg1 {
|
||||
vbus-supply = <®_usb_otg1_vbus>;
|
||||
srp-disable;
|
||||
hnp-disable;
|
||||
adp-disable;
|
||||
status = "disabled";
|
||||
};*/
|
||||
|
||||
&usbotg2 {
|
||||
vbus-supply = <®_usb_otg2_vbus>;
|
||||
srp-disable;
|
||||
hnp-disable;
|
||||
asp-disable;
|
||||
/*dr_mode = "device";*/
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&usdhc1 {
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
&usdhc2 {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&pinctrl_usdhc2>;
|
||||
/* pinctrl-1 = <&pinctrl_usdhc2_100mhz>; */
|
||||
/* pinctrl-2 = <&pinctrl_usdhc2_200mhz>; */
|
||||
|
||||
mmc-pwrseq = <&wifi_pwrseq>;
|
||||
bus-width = <4>;
|
||||
enable-sdio-wakeup;
|
||||
non-removable;
|
||||
disable-wp;
|
||||
wifi-host;
|
||||
/* keep-power-in-suspend; */
|
||||
cap-power-off-card;
|
||||
status = "okay";
|
||||
|
||||
/* BCMDHD driver does not currently support devicetree */
|
||||
/* ... */
|
||||
};
|
||||
|
||||
&usdhc3 {
|
||||
pinctrl-names = "default", "state_100mhz", "state_200mhz";
|
||||
pinctrl-0 = <&pinctrl_usdhc3>;
|
||||
pinctrl-1 = <&pinctrl_usdhc3_100mhz>;
|
||||
pinctrl-2 = <&pinctrl_usdhc3_200mhz>;
|
||||
assigned-clocks = <&clks IMX7D_USDHC3_ROOT_CLK>;
|
||||
assigned-clock-rates = <400000000>;
|
||||
bus-width = <8>;
|
||||
non-removable;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
/*
|
||||
&wdog1 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&pinctrl_wdog>;
|
||||
fsl,ext-reset-output;
|
||||
};
|
||||
*/
|
||||
|
||||
&iomuxc {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&pinctrl_wifi>;
|
||||
|
||||
imx7d-sdb {
|
||||
|
||||
pinctrl_touch: touchgrp {
|
||||
fsl,pins = <
|
||||
/* CYTTSP interrupt */
|
||||
MX7D_PAD_GPIO1_IO14__GPIO1_IO14 0x17000
|
||||
/* CYTTSP reset */
|
||||
MX7D_PAD_GPIO1_IO13__GPIO1_IO13 0x110b0
|
||||
>;
|
||||
};
|
||||
|
||||
pinctrl_i2c1: i2c1grp {
|
||||
fsl,pins = <
|
||||
MX7D_PAD_I2C1_SDA__I2C1_SDA 0x4000007f
|
||||
MX7D_PAD_I2C1_SCL__I2C1_SCL 0x4000007f
|
||||
>;
|
||||
};
|
||||
|
||||
pinctrl_i2c2: i2c2grp {
|
||||
fsl,pins = <
|
||||
MX7D_PAD_I2C2_SDA__I2C2_SDA 0x4000007f
|
||||
MX7D_PAD_I2C2_SCL__I2C2_SCL 0x4000007f
|
||||
>;
|
||||
};
|
||||
|
||||
pinctrl_i2c3: i2c3grp {
|
||||
fsl,pins = <
|
||||
MX7D_PAD_I2C3_SDA__I2C3_SDA 0x4000007f
|
||||
MX7D_PAD_I2C3_SCL__I2C3_SCL 0x4000007f
|
||||
>;
|
||||
};
|
||||
|
||||
pinctrl_i2c4: i2c4grp {
|
||||
fsl,pins = <
|
||||
MX7D_PAD_SAI1_RX_BCLK__I2C4_SDA 0x4000007f
|
||||
MX7D_PAD_SAI1_RX_SYNC__I2C4_SCL 0x4000007f
|
||||
>;
|
||||
};
|
||||
|
||||
pinctrl_lcdif: lcdifgrp {
|
||||
fsl,pins = <
|
||||
MX7D_PAD_LCD_DATA00__LCD_DATA0 0x79
|
||||
MX7D_PAD_LCD_DATA01__LCD_DATA1 0x79
|
||||
MX7D_PAD_LCD_DATA02__LCD_DATA2 0x79
|
||||
MX7D_PAD_LCD_DATA03__LCD_DATA3 0x79
|
||||
MX7D_PAD_LCD_DATA04__LCD_DATA4 0x79
|
||||
MX7D_PAD_LCD_DATA05__LCD_DATA5 0x79
|
||||
MX7D_PAD_LCD_DATA06__LCD_DATA6 0x79
|
||||
MX7D_PAD_LCD_DATA07__LCD_DATA7 0x79
|
||||
MX7D_PAD_LCD_DATA08__LCD_DATA8 0x79
|
||||
MX7D_PAD_LCD_DATA09__LCD_DATA9 0x79
|
||||
MX7D_PAD_LCD_DATA10__LCD_DATA10 0x79
|
||||
MX7D_PAD_LCD_DATA11__LCD_DATA11 0x79
|
||||
MX7D_PAD_LCD_DATA12__LCD_DATA12 0x79
|
||||
MX7D_PAD_LCD_DATA13__LCD_DATA13 0x79
|
||||
MX7D_PAD_LCD_DATA14__LCD_DATA14 0x79
|
||||
MX7D_PAD_LCD_DATA15__LCD_DATA15 0x79
|
||||
MX7D_PAD_LCD_DATA16__LCD_DATA16 0x79
|
||||
MX7D_PAD_LCD_DATA17__LCD_DATA17 0x79
|
||||
MX7D_PAD_LCD_DATA18__LCD_DATA18 0x79
|
||||
MX7D_PAD_LCD_DATA19__LCD_DATA19 0x79
|
||||
MX7D_PAD_LCD_DATA20__LCD_DATA20 0x79
|
||||
MX7D_PAD_LCD_DATA21__LCD_DATA21 0x79
|
||||
MX7D_PAD_LCD_DATA22__LCD_DATA22 0x79
|
||||
MX7D_PAD_LCD_DATA23__LCD_DATA23 0x79
|
||||
MX7D_PAD_LCD_CLK__LCD_CLK 0x79
|
||||
MX7D_PAD_LCD_ENABLE__LCD_ENABLE 0x79
|
||||
MX7D_PAD_LCD_VSYNC__LCD_VSYNC 0x79
|
||||
MX7D_PAD_LCD_HSYNC__LCD_HSYNC 0x79
|
||||
MX7D_PAD_LCD_RESET__LCD_RESET 0x79
|
||||
>;
|
||||
};
|
||||
|
||||
pinctrl_uart1: uart1grp {
|
||||
fsl,pins = <
|
||||
MX7D_PAD_UART1_TX_DATA__UART1_DCE_TX 0x79
|
||||
MX7D_PAD_UART1_RX_DATA__UART1_DCE_RX 0x79
|
||||
>;
|
||||
};
|
||||
|
||||
pinctrl_usbotg2_pwr_1: usbotg2-1 {
|
||||
fsl,pins = <
|
||||
MX7D_PAD_UART3_CTS_B__GPIO4_IO7 0x14
|
||||
>;
|
||||
};
|
||||
|
||||
pinctrl_usdhc2: usdhc2grp {
|
||||
fsl,pins = <
|
||||
MX7D_PAD_SD2_CMD__SD2_CMD 0x59
|
||||
MX7D_PAD_SD2_CLK__SD2_CLK 0x19
|
||||
MX7D_PAD_SD2_DATA0__SD2_DATA0 0x59
|
||||
MX7D_PAD_SD2_DATA1__SD2_DATA1 0x59
|
||||
MX7D_PAD_SD2_DATA2__SD2_DATA2 0x59
|
||||
MX7D_PAD_SD2_DATA3__SD2_DATA3 0x59
|
||||
>;
|
||||
};
|
||||
|
||||
pinctrl_usdhc2_100mhz: usdhc2grp_100mhz {
|
||||
fsl,pins = <
|
||||
MX7D_PAD_SD2_CMD__SD2_CMD 0x5a
|
||||
MX7D_PAD_SD2_CLK__SD2_CLK 0x1a
|
||||
MX7D_PAD_SD2_DATA0__SD2_DATA0 0x5a
|
||||
MX7D_PAD_SD2_DATA1__SD2_DATA1 0x5a
|
||||
MX7D_PAD_SD2_DATA2__SD2_DATA2 0x5a
|
||||
MX7D_PAD_SD2_DATA3__SD2_DATA3 0x5a
|
||||
>;
|
||||
};
|
||||
|
||||
pinctrl_usdhc2_200mhz: usdhc2grp_200mhz {
|
||||
fsl,pins = <
|
||||
MX7D_PAD_SD2_CMD__SD2_CMD 0x5b
|
||||
MX7D_PAD_SD2_CLK__SD2_CLK 0x1b
|
||||
MX7D_PAD_SD2_DATA0__SD2_DATA0 0x5b
|
||||
MX7D_PAD_SD2_DATA1__SD2_DATA1 0x5b
|
||||
MX7D_PAD_SD2_DATA2__SD2_DATA2 0x5b
|
||||
MX7D_PAD_SD2_DATA3__SD2_DATA3 0x5b
|
||||
>;
|
||||
};
|
||||
|
||||
|
||||
pinctrl_usdhc3: usdhc3grp {
|
||||
fsl,pins = <
|
||||
MX7D_PAD_SD3_CMD__SD3_CMD 0x59
|
||||
MX7D_PAD_SD3_CLK__SD3_CLK 0x19
|
||||
MX7D_PAD_SD3_DATA0__SD3_DATA0 0x59
|
||||
MX7D_PAD_SD3_DATA1__SD3_DATA1 0x59
|
||||
MX7D_PAD_SD3_DATA2__SD3_DATA2 0x59
|
||||
MX7D_PAD_SD3_DATA3__SD3_DATA3 0x59
|
||||
MX7D_PAD_SD3_DATA4__SD3_DATA4 0x59
|
||||
MX7D_PAD_SD3_DATA5__SD3_DATA5 0x59
|
||||
MX7D_PAD_SD3_DATA6__SD3_DATA6 0x59
|
||||
MX7D_PAD_SD3_DATA7__SD3_DATA7 0x59
|
||||
MX7D_PAD_SD3_STROBE__SD3_STROBE 0x19
|
||||
>;
|
||||
};
|
||||
|
||||
pinctrl_usdhc3_100mhz: usdhc3grp_100mhz {
|
||||
fsl,pins = <
|
||||
MX7D_PAD_SD3_CMD__SD3_CMD 0x5a
|
||||
MX7D_PAD_SD3_CLK__SD3_CLK 0x1a
|
||||
MX7D_PAD_SD3_DATA0__SD3_DATA0 0x5a
|
||||
MX7D_PAD_SD3_DATA1__SD3_DATA1 0x5a
|
||||
MX7D_PAD_SD3_DATA2__SD3_DATA2 0x5a
|
||||
MX7D_PAD_SD3_DATA3__SD3_DATA3 0x5a
|
||||
MX7D_PAD_SD3_DATA4__SD3_DATA4 0x5a
|
||||
MX7D_PAD_SD3_DATA5__SD3_DATA5 0x5a
|
||||
MX7D_PAD_SD3_DATA6__SD3_DATA6 0x5a
|
||||
MX7D_PAD_SD3_DATA7__SD3_DATA7 0x5a
|
||||
MX7D_PAD_SD3_STROBE__SD3_STROBE 0x1a
|
||||
>;
|
||||
};
|
||||
|
||||
pinctrl_usdhc3_200mhz: usdhc3grp_200mhz {
|
||||
fsl,pins = <
|
||||
MX7D_PAD_SD3_CMD__SD3_CMD 0x5b
|
||||
MX7D_PAD_SD3_CLK__SD3_CLK 0x1b
|
||||
MX7D_PAD_SD3_DATA0__SD3_DATA0 0x5b
|
||||
MX7D_PAD_SD3_DATA1__SD3_DATA1 0x5b
|
||||
MX7D_PAD_SD3_DATA2__SD3_DATA2 0x5b
|
||||
MX7D_PAD_SD3_DATA3__SD3_DATA3 0x5b
|
||||
MX7D_PAD_SD3_DATA4__SD3_DATA4 0x5b
|
||||
MX7D_PAD_SD3_DATA5__SD3_DATA5 0x5b
|
||||
MX7D_PAD_SD3_DATA6__SD3_DATA6 0x5b
|
||||
MX7D_PAD_SD3_DATA7__SD3_DATA7 0x5b
|
||||
MX7D_PAD_SD3_STROBE__SD3_STROBE 0x1b
|
||||
>;
|
||||
};
|
||||
|
||||
pinctrl_wifi: wifigrp {
|
||||
fsl,pins = <
|
||||
/* WiFi Reg On */
|
||||
MX7D_PAD_SD2_CD_B__GPIO5_IO9 0x00000014
|
||||
/* WiFi Host Wake */
|
||||
MX7D_PAD_GPIO1_IO08__GPIO1_IO8 0x00000014
|
||||
/* WiFi Sleep 32k */
|
||||
MX7D_PAD_SD1_WP__CCM_CLKO2 0x00000014
|
||||
>;
|
||||
};
|
||||
};
|
||||
};
|
|
@ -0,0 +1,469 @@
|
|||
CONFIG_KERNEL_LZO=y
|
||||
CONFIG_SYSVIPC=y
|
||||
CONFIG_NO_HZ=y
|
||||
CONFIG_HIGH_RES_TIMERS=y
|
||||
CONFIG_IKCONFIG=y
|
||||
CONFIG_IKCONFIG_PROC=y
|
||||
CONFIG_LOG_BUF_SHIFT=18
|
||||
CONFIG_CGROUPS=y
|
||||
CONFIG_RELAY=y
|
||||
CONFIG_BLK_DEV_INITRD=y
|
||||
CONFIG_EXPERT=y
|
||||
CONFIG_KALLSYMS_ALL=y
|
||||
CONFIG_PERF_EVENTS=y
|
||||
# CONFIG_SLUB_DEBUG is not set
|
||||
# CONFIG_COMPAT_BRK is not set
|
||||
CONFIG_MODULES=y
|
||||
CONFIG_MODULE_UNLOAD=y
|
||||
CONFIG_MODVERSIONS=y
|
||||
CONFIG_MODULE_SRCVERSION_ALL=y
|
||||
# CONFIG_BLK_DEV_BSG is not set
|
||||
CONFIG_ARCH_MXC=y
|
||||
CONFIG_SOC_IMX50=y
|
||||
CONFIG_SOC_IMX53=y
|
||||
CONFIG_SOC_IMX6Q=y
|
||||
CONFIG_SOC_IMX6SL=y
|
||||
CONFIG_SOC_IMX6SX=y
|
||||
CONFIG_SOC_IMX6ULL=y
|
||||
CONFIG_SOC_IMX7D=y
|
||||
CONFIG_SOC_IMX6SLL=y
|
||||
CONFIG_SOC_IMX7ULP=y
|
||||
CONFIG_SOC_VF610=y
|
||||
# CONFIG_SWP_EMULATE is not set
|
||||
CONFIG_SMP=y
|
||||
CONFIG_VMSPLIT_2G=y
|
||||
CONFIG_ARM_PSCI=y
|
||||
CONFIG_PREEMPT=y
|
||||
CONFIG_HIGHMEM=y
|
||||
CONFIG_CMA=y
|
||||
CONFIG_CMDLINE="noinitrd console=ttymxc0,115200"
|
||||
CONFIG_CPU_FREQ=y
|
||||
CONFIG_CPU_FREQ_STAT=y
|
||||
CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
|
||||
CONFIG_CPU_FREQ_GOV_POWERSAVE=y
|
||||
CONFIG_CPU_FREQ_GOV_USERSPACE=y
|
||||
CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
|
||||
CONFIG_CPU_FREQ_GOV_INTERACTIVE=y
|
||||
CONFIG_CPUFREQ_DT=y
|
||||
CONFIG_ARM_IMX6Q_CPUFREQ=y
|
||||
CONFIG_ARM_IMX7ULP_CPUFREQ=y
|
||||
CONFIG_CPU_IDLE=y
|
||||
CONFIG_VFP=y
|
||||
CONFIG_NEON=y
|
||||
CONFIG_BINFMT_MISC=m
|
||||
CONFIG_PM_DEBUG=y
|
||||
CONFIG_PM_TEST_SUSPEND=y
|
||||
CONFIG_NET=y
|
||||
CONFIG_PACKET=y
|
||||
CONFIG_UNIX=y
|
||||
CONFIG_INET=y
|
||||
CONFIG_IP_PNP=y
|
||||
CONFIG_IP_PNP_DHCP=y
|
||||
# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
|
||||
# CONFIG_INET_XFRM_MODE_TUNNEL is not set
|
||||
# CONFIG_INET_XFRM_MODE_BEET is not set
|
||||
CONFIG_VLAN_8021Q=y
|
||||
CONFIG_LLC2=y
|
||||
CONFIG_CAN=y
|
||||
CONFIG_CAN_FLEXCAN=y
|
||||
CONFIG_CAN_M_CAN=y
|
||||
CONFIG_BT=y
|
||||
CONFIG_BT_RFCOMM=y
|
||||
CONFIG_BT_RFCOMM_TTY=y
|
||||
CONFIG_BT_BNEP=y
|
||||
CONFIG_BT_BNEP_MC_FILTER=y
|
||||
CONFIG_BT_BNEP_PROTO_FILTER=y
|
||||
CONFIG_BT_HIDP=y
|
||||
CONFIG_BT_HCIBTUSB=y
|
||||
CONFIG_BT_HCIUART=y
|
||||
CONFIG_BT_HCIUART_BCSP=y
|
||||
CONFIG_BT_HCIUART_ATH3K=y
|
||||
CONFIG_BT_HCIBCM203X=y
|
||||
CONFIG_BT_ATH3K=y
|
||||
CONFIG_CFG80211=y
|
||||
CONFIG_NL80211_TESTMODE=y
|
||||
CONFIG_CFG80211_INTERNAL_REGDB=y
|
||||
CONFIG_CFG80211_WEXT=y
|
||||
CONFIG_MAC80211=y
|
||||
CONFIG_DEVTMPFS=y
|
||||
CONFIG_DEVTMPFS_MOUNT=y
|
||||
# CONFIG_STANDALONE is not set
|
||||
CONFIG_DMA_CMA=y
|
||||
CONFIG_CMA_SIZE_MBYTES=0
|
||||
CONFIG_IMX_WEIM=y
|
||||
CONFIG_CONNECTOR=y
|
||||
CONFIG_MTD=y
|
||||
CONFIG_MTD_CMDLINE_PARTS=y
|
||||
CONFIG_MTD_BLOCK=y
|
||||
CONFIG_MTD_CFI=y
|
||||
CONFIG_MTD_JEDECPROBE=y
|
||||
CONFIG_MTD_CFI_INTELEXT=y
|
||||
CONFIG_MTD_CFI_AMDSTD=y
|
||||
CONFIG_MTD_CFI_STAA=y
|
||||
CONFIG_MTD_PHYSMAP_OF=y
|
||||
CONFIG_MTD_DATAFLASH=y
|
||||
CONFIG_MTD_M25P80=y
|
||||
CONFIG_MTD_SST25L=y
|
||||
CONFIG_MTD_NAND=y
|
||||
CONFIG_MTD_NAND_GPMI_NAND=y
|
||||
CONFIG_MTD_NAND_MXC=y
|
||||
CONFIG_MTD_SPI_NOR=y
|
||||
# CONFIG_MTD_SPI_NOR_USE_4K_SECTORS is not set
|
||||
CONFIG_SPI_FSL_QUADSPI=y
|
||||
CONFIG_MTD_UBI=y
|
||||
CONFIG_BLK_DEV_LOOP=y
|
||||
CONFIG_BLK_DEV_RAM=y
|
||||
CONFIG_BLK_DEV_RAM_SIZE=65536
|
||||
CONFIG_SENSORS_FXOS8700=y
|
||||
CONFIG_SENSORS_FXAS2100X=y
|
||||
CONFIG_EEPROM_AT24=y
|
||||
CONFIG_EEPROM_AT25=y
|
||||
# CONFIG_SCSI_PROC_FS is not set
|
||||
CONFIG_BLK_DEV_SD=y
|
||||
CONFIG_SCSI_CONSTANTS=y
|
||||
CONFIG_SCSI_LOGGING=y
|
||||
CONFIG_SCSI_SCAN_ASYNC=y
|
||||
# CONFIG_SCSI_LOWLEVEL is not set
|
||||
CONFIG_ATA=y
|
||||
CONFIG_SATA_AHCI_PLATFORM=y
|
||||
CONFIG_AHCI_IMX=y
|
||||
CONFIG_PATA_IMX=y
|
||||
CONFIG_NETDEVICES=y
|
||||
# CONFIG_NET_VENDOR_BROADCOM is not set
|
||||
CONFIG_CS89x0=y
|
||||
CONFIG_CS89x0_PLATFORM=y
|
||||
# CONFIG_NET_VENDOR_FARADAY is not set
|
||||
# CONFIG_NET_VENDOR_INTEL is not set
|
||||
# CONFIG_NET_VENDOR_MARVELL is not set
|
||||
# CONFIG_NET_VENDOR_MICREL is not set
|
||||
# CONFIG_NET_VENDOR_MICROCHIP is not set
|
||||
# CONFIG_NET_VENDOR_NATSEMI is not set
|
||||
# CONFIG_NET_VENDOR_SEEQ is not set
|
||||
CONFIG_SMC91X=y
|
||||
CONFIG_SMC911X=y
|
||||
CONFIG_SMSC911X=y
|
||||
# CONFIG_NET_VENDOR_STMICRO is not set
|
||||
CONFIG_MICREL_PHY=y
|
||||
CONFIG_USB_KAWETH=y
|
||||
CONFIG_USB_PEGASUS=y
|
||||
CONFIG_USB_RTL8150=y
|
||||
CONFIG_USB_RTL8152=y
|
||||
CONFIG_USB_USBNET=y
|
||||
CONFIG_USB_NET_CDC_EEM=m
|
||||
CONFIG_ATH6KL=m
|
||||
CONFIG_ATH6KL_SDIO=m
|
||||
CONFIG_BCMDHD=m
|
||||
CONFIG_BCMDHD_FW_PATH="/lib/firmware/brcm/fw_bcm43456c5_ag.bin"
|
||||
CONFIG_BCMDHD_NVRAM_PATH="/lib/firmware/brcm/nvram.txt"
|
||||
# CONFIG_WLAN_VENDOR_BROADCOM is not set
|
||||
CONFIG_HOSTAP=y
|
||||
CONFIG_INPUT_EVDEV=y
|
||||
CONFIG_INPUT_EVBUG=m
|
||||
CONFIG_KEYBOARD_GPIO=y
|
||||
CONFIG_KEYBOARD_RPMSG=y
|
||||
CONFIG_KEYBOARD_PF1550_ONKEY=y
|
||||
CONFIG_KEYBOARD_IMX=y
|
||||
CONFIG_MOUSE_PS2=m
|
||||
CONFIG_MOUSE_PS2_ELANTECH=y
|
||||
CONFIG_INPUT_TOUCHSCREEN=y
|
||||
CONFIG_TOUCHSCREEN_ADS7846=y
|
||||
CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5=y
|
||||
CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5_DEVICETREE_SUPPORT=y
|
||||
CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5_I2C=y
|
||||
CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5_LOADER=y
|
||||
CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5_BINARY_FW_UPGRADE=y
|
||||
CONFIG_TOUCHSCREEN_EGALAX=y
|
||||
CONFIG_TOUCHSCREEN_ELAN_TS=y
|
||||
CONFIG_TOUCHSCREEN_WACOM_I2C=y
|
||||
CONFIG_TOUCHSCREEN_MAX11801=y
|
||||
CONFIG_TOUCHSCREEN_IMX6UL_TSC=y
|
||||
CONFIG_TOUCHSCREEN_MC13783=y
|
||||
CONFIG_TOUCHSCREEN_TSC2007=y
|
||||
CONFIG_TOUCHSCREEN_STMPE=y
|
||||
CONFIG_TOUCHSCREEN_FTS=y
|
||||
CONFIG_INPUT_MISC=y
|
||||
CONFIG_INPUT_MMA8450=y
|
||||
CONFIG_INPUT_MPL3115=y
|
||||
CONFIG_SENSOR_FXLS8471=y
|
||||
CONFIG_SENSOR_IMX_RPMSG=y
|
||||
CONFIG_INPUT_ISL29023=y
|
||||
CONFIG_SERIO_SERPORT=m
|
||||
# CONFIG_LEGACY_PTYS is not set
|
||||
CONFIG_SERIAL_IMX=y
|
||||
CONFIG_SERIAL_IMX_CONSOLE=y
|
||||
CONFIG_SERIAL_FSL_LPUART=y
|
||||
CONFIG_SERIAL_FSL_LPUART_CONSOLE=y
|
||||
CONFIG_FSL_OTP=y
|
||||
CONFIG_HW_RANDOM_IMX_RNG=y
|
||||
# CONFIG_I2C_COMPAT is not set
|
||||
CONFIG_I2C_CHARDEV=y
|
||||
CONFIG_I2C_MUX_GPIO=y
|
||||
# CONFIG_I2C_HELPER_AUTO is not set
|
||||
CONFIG_I2C_ALGOPCF=m
|
||||
CONFIG_I2C_ALGOPCA=m
|
||||
CONFIG_I2C_IMX=y
|
||||
CONFIG_I2C_IMX_LPI2C=y
|
||||
CONFIG_SPI=y
|
||||
CONFIG_SPI_FSL_LPSPI=y
|
||||
CONFIG_SPI_GPIO=y
|
||||
CONFIG_SPI_IMX=y
|
||||
CONFIG_SPI_SPIDEV=y
|
||||
CONFIG_SPI_SLAVE=y
|
||||
CONFIG_SPI_SLAVE_TIME=y
|
||||
CONFIG_SPI_SLAVE_SYSTEM_CONTROL=y
|
||||
CONFIG_GPIO_SYSFS=y
|
||||
CONFIG_GPIO_IMX_RPMSG=y
|
||||
CONFIG_GPIO_BD7181X=y
|
||||
CONFIG_GPIO_MAX732X=y
|
||||
CONFIG_GPIO_PCA953X=y
|
||||
CONFIG_GPIO_74X164=y
|
||||
CONFIG_POWER_RESET=y
|
||||
CONFIG_POWER_RESET_SYSCON_POWEROFF=y
|
||||
CONFIG_POWER_SUPPLY=y
|
||||
CONFIG_BD7181X_POWER=y
|
||||
CONFIG_CHARGER_PF1550=y
|
||||
CONFIG_SABRESD_MAX8903=y
|
||||
CONFIG_SENSORS_MAX17135=y
|
||||
CONFIG_SENSORS_MAG3110=y
|
||||
CONFIG_THERMAL=y
|
||||
CONFIG_THERMAL_WRITABLE_TRIPS=y
|
||||
CONFIG_CPU_THERMAL=y
|
||||
CONFIG_IMX_THERMAL=y
|
||||
CONFIG_DEVICE_THERMAL=y
|
||||
CONFIG_WATCHDOG=y
|
||||
CONFIG_IMX2_WDT=y
|
||||
CONFIG_IMX7ULP_WDT=y
|
||||
CONFIG_MFD_DA9052_I2C=y
|
||||
CONFIG_MFD_MC13XXX_SPI=y
|
||||
CONFIG_MFD_MC13XXX_I2C=y
|
||||
CONFIG_MFD_PF1550=y
|
||||
CONFIG_MFD_MAX17135=y
|
||||
CONFIG_MFD_SI476X_CORE=y
|
||||
CONFIG_MFD_STMPE=y
|
||||
CONFIG_MFD_BD7181X=y
|
||||
CONFIG_REGULATOR=y
|
||||
CONFIG_REGULATOR_FIXED_VOLTAGE=y
|
||||
CONFIG_REGULATOR_ANATOP=y
|
||||
CONFIG_REGULATOR_BD7181X=y
|
||||
CONFIG_REGULATOR_DA9052=y
|
||||
CONFIG_REGULATOR_GPIO=y
|
||||
CONFIG_REGULATOR_MAX17135=y
|
||||
CONFIG_REGULATOR_MC13783=y
|
||||
CONFIG_REGULATOR_MC13892=y
|
||||
CONFIG_REGULATOR_PFUZE100=y
|
||||
CONFIG_REGULATOR_PF1550=y
|
||||
CONFIG_REGULATOR_PF1550_RPMSG=y
|
||||
CONFIG_RC_DEVICES=y
|
||||
CONFIG_IR_GPIO_CIR=y
|
||||
CONFIG_MEDIA_SUPPORT=y
|
||||
CONFIG_MEDIA_CAMERA_SUPPORT=y
|
||||
CONFIG_MEDIA_RADIO_SUPPORT=y
|
||||
CONFIG_MEDIA_USB_SUPPORT=y
|
||||
CONFIG_USB_VIDEO_CLASS=m
|
||||
CONFIG_V4L_PLATFORM_DRIVERS=y
|
||||
CONFIG_VIDEO_MXC_OUTPUT=y
|
||||
CONFIG_VIDEO_MXC_CAPTURE=m
|
||||
CONFIG_VIDEO_MXC_CSI_CAMERA=m
|
||||
CONFIG_MXC_VADC=m
|
||||
CONFIG_MXC_MIPI_CSI=m
|
||||
CONFIG_MXC_CAMERA_OV5640=m
|
||||
CONFIG_MXC_CAMERA_OV5640_V2=m
|
||||
CONFIG_MXC_CAMERA_OV5642=m
|
||||
CONFIG_MXC_CAMERA_OV5640_MIPI=m
|
||||
CONFIG_MXC_CAMERA_OV5640_MIPI_V2=m
|
||||
CONFIG_MXC_CAMERA_OV5647_MIPI=m
|
||||
CONFIG_MXC_TVIN_ADV7180=m
|
||||
CONFIG_MXC_IPU_DEVICE_QUEUE_SDC=m
|
||||
CONFIG_VIDEO_MXC_IPU_OUTPUT=y
|
||||
CONFIG_VIDEO_MXC_PXP_V4L2=y
|
||||
CONFIG_SOC_CAMERA=y
|
||||
CONFIG_V4L_MEM2MEM_DRIVERS=y
|
||||
CONFIG_VIDEO_CODA=y
|
||||
CONFIG_RADIO_SI476X=y
|
||||
CONFIG_DRM=y
|
||||
CONFIG_DRM_VIVANTE=y
|
||||
CONFIG_FB_MXS=y
|
||||
CONFIG_FB_MXC_SYNC_PANEL=y
|
||||
CONFIG_FB_MXC_OVERLAY=y
|
||||
CONFIG_FB_MXC_MIPI_DSI=y
|
||||
CONFIG_FB_MXC_MIPI_DSI_SAMSUNG=y
|
||||
CONFIG_FB_MXC_MIPI_DSI_NORTHWEST=y
|
||||
CONFIG_FB_MXC_TRULY_WVGA_SYNC_PANEL=y
|
||||
CONFIG_FB_MXC_TRULY_PANEL_TFT3P5079E=y
|
||||
CONFIG_FB_MXC_TRULY_PANEL_TFT3P5581E=y
|
||||
CONFIG_FB_MXC_LDB=y
|
||||
CONFIG_FB_MXC_HDMI=y
|
||||
CONFIG_FB_MXS_SII902X=y
|
||||
CONFIG_FB_MXC_DCIC=m
|
||||
CONFIG_FB_MXC_ADV7535=y
|
||||
CONFIG_HANNSTAR_CABC=y
|
||||
CONFIG_FB_MXC_EINK_PANEL=y
|
||||
CONFIG_FB_MXC_EINK_V2_PANEL=y
|
||||
CONFIG_LCD_CLASS_DEVICE=y
|
||||
CONFIG_LCD_L4F00242T03=y
|
||||
CONFIG_LCD_PLATFORM=y
|
||||
CONFIG_BACKLIGHT_PWM=y
|
||||
CONFIG_BACKLIGHT_GPIO=y
|
||||
CONFIG_FRAMEBUFFER_CONSOLE=y
|
||||
CONFIG_LOGO=y
|
||||
CONFIG_SOUND=y
|
||||
CONFIG_SND=y
|
||||
CONFIG_SND_USB_AUDIO=m
|
||||
CONFIG_SND_SOC=y
|
||||
CONFIG_SND_IMX_SOC=y
|
||||
CONFIG_SND_SOC_EUKREA_TLV320=y
|
||||
CONFIG_SND_SOC_IMX_WM8960=y
|
||||
CONFIG_SND_SOC_IMX_SII902X=y
|
||||
CONFIG_SND_SOC_IMX_WM8958=y
|
||||
CONFIG_SND_SOC_IMX_CS42888=y
|
||||
CONFIG_SND_SOC_IMX_WM8962=y
|
||||
CONFIG_SND_SOC_IMX_RPMSG=y
|
||||
CONFIG_SND_SOC_IMX_SGTL5000=y
|
||||
CONFIG_SND_SOC_IMX_MQS=y
|
||||
CONFIG_SND_SOC_IMX_SPDIF=y
|
||||
CONFIG_SND_SOC_IMX_MC13783=y
|
||||
CONFIG_SND_SOC_IMX_SI476X=y
|
||||
CONFIG_SND_SOC_IMX_HDMI=y
|
||||
CONFIG_USB=y
|
||||
CONFIG_USB_OTG_WHITELIST=y
|
||||
CONFIG_USB_EHCI_HCD=y
|
||||
CONFIG_USB_EHCI_MXC=y
|
||||
CONFIG_USB_HCD_TEST_MODE=y
|
||||
CONFIG_USB_ACM=m
|
||||
CONFIG_USB_STORAGE=y
|
||||
CONFIG_USB_CHIPIDEA=y
|
||||
CONFIG_USB_CHIPIDEA_UDC=y
|
||||
CONFIG_USB_CHIPIDEA_HOST=y
|
||||
CONFIG_USB_SERIAL=m
|
||||
CONFIG_USB_SERIAL_GENERIC=y
|
||||
CONFIG_USB_SERIAL_FTDI_SIO=m
|
||||
CONFIG_USB_SERIAL_OPTION=m
|
||||
CONFIG_USB_TEST=m
|
||||
CONFIG_USB_EHSET_TEST_FIXTURE=y
|
||||
CONFIG_NOP_USB_XCEIV=y
|
||||
CONFIG_USB_MXS_PHY=y
|
||||
CONFIG_USB_GADGET=y
|
||||
CONFIG_USB_CONFIGFS=y
|
||||
CONFIG_USB_CONFIGFS_SERIAL=y
|
||||
CONFIG_USB_CONFIGFS_ACM=y
|
||||
CONFIG_USB_CONFIGFS_OBEX=y
|
||||
CONFIG_USB_CONFIGFS_NCM=y
|
||||
CONFIG_USB_CONFIGFS_ECM=y
|
||||
CONFIG_USB_CONFIGFS_ECM_SUBSET=y
|
||||
CONFIG_USB_CONFIGFS_RNDIS=y
|
||||
CONFIG_USB_CONFIGFS_EEM=y
|
||||
CONFIG_USB_CONFIGFS_MASS_STORAGE=y
|
||||
CONFIG_FSL_UTP=y
|
||||
CONFIG_USB_CONFIGFS_F_LB_SS=y
|
||||
CONFIG_USB_CONFIGFS_F_FS=y
|
||||
CONFIG_USB_ETH=y
|
||||
CONFIG_MMC=y
|
||||
CONFIG_MMC_SDHCI=y
|
||||
CONFIG_MMC_SDHCI_PLTFM=y
|
||||
CONFIG_MMC_SDHCI_ESDHC_IMX=y
|
||||
CONFIG_MXC_SIM=y
|
||||
CONFIG_MXC_SIMv2=y
|
||||
CONFIG_MXC_IPU=y
|
||||
CONFIG_MXC_IPU_V3_PRE=y
|
||||
CONFIG_MXC_MIPI_CSI2=y
|
||||
CONFIG_MXC_HDMI_CEC=y
|
||||
CONFIG_NEW_LEDS=y
|
||||
CONFIG_LEDS_CLASS=y
|
||||
CONFIG_LEDS_GPIO=y
|
||||
CONFIG_LEDS_TRIGGERS=y
|
||||
CONFIG_LEDS_TRIGGER_TIMER=y
|
||||
CONFIG_LEDS_TRIGGER_ONESHOT=y
|
||||
CONFIG_LEDS_TRIGGER_HEARTBEAT=y
|
||||
CONFIG_LEDS_TRIGGER_BACKLIGHT=y
|
||||
CONFIG_LEDS_TRIGGER_GPIO=y
|
||||
CONFIG_RTC_CLASS=y
|
||||
CONFIG_RTC_INTF_DEV_UIE_EMUL=y
|
||||
CONFIG_RTC_DRV_BD7181X=y
|
||||
CONFIG_RTC_DRV_MC13XXX=y
|
||||
CONFIG_RTC_DRV_MXC=y
|
||||
CONFIG_RTC_DRV_SNVS=y
|
||||
CONFIG_RTC_DRV_IMX_RPMSG=y
|
||||
CONFIG_DMADEVICES=y
|
||||
CONFIG_FSL_EDMA=y
|
||||
CONFIG_IMX_SDMA=y
|
||||
CONFIG_MXS_DMA=y
|
||||
CONFIG_MXC_PXP_V2=y
|
||||
CONFIG_MXC_PXP_V3=y
|
||||
CONFIG_DMATEST=m
|
||||
CONFIG_STAGING=y
|
||||
CONFIG_STAGING_MEDIA=y
|
||||
# CONFIG_IOMMU_SUPPORT is not set
|
||||
CONFIG_EXTCON_USB_GPIO=y
|
||||
CONFIG_IIO=y
|
||||
CONFIG_IMX7D_ADC=y
|
||||
CONFIG_VF610_ADC=y
|
||||
CONFIG_PWM=y
|
||||
CONFIG_PWM_IMX=y
|
||||
CONFIG_PWM_TPM=y
|
||||
CONFIG_TEE=y
|
||||
CONFIG_OPTEE=y
|
||||
CONFIG_EXT2_FS=y
|
||||
CONFIG_EXT2_FS_XATTR=y
|
||||
CONFIG_EXT2_FS_POSIX_ACL=y
|
||||
CONFIG_EXT2_FS_SECURITY=y
|
||||
CONFIG_EXT3_FS=y
|
||||
CONFIG_EXT3_FS_POSIX_ACL=y
|
||||
CONFIG_EXT3_FS_SECURITY=y
|
||||
CONFIG_QUOTA=y
|
||||
CONFIG_QUOTA_NETLINK_INTERFACE=y
|
||||
# CONFIG_PRINT_QUOTA_WARNING is not set
|
||||
CONFIG_AUTOFS4_FS=y
|
||||
CONFIG_FUSE_FS=y
|
||||
CONFIG_ISO9660_FS=m
|
||||
CONFIG_JOLIET=y
|
||||
CONFIG_ZISOFS=y
|
||||
CONFIG_UDF_FS=m
|
||||
CONFIG_MSDOS_FS=m
|
||||
CONFIG_VFAT_FS=y
|
||||
CONFIG_TMPFS=y
|
||||
CONFIG_JFFS2_FS=y
|
||||
CONFIG_UBIFS_FS=y
|
||||
CONFIG_NFS_FS=y
|
||||
CONFIG_NFS_V3_ACL=y
|
||||
CONFIG_NFS_V4=y
|
||||
CONFIG_ROOT_NFS=y
|
||||
CONFIG_NLS_DEFAULT="cp437"
|
||||
CONFIG_NLS_CODEPAGE_437=y
|
||||
CONFIG_NLS_ASCII=y
|
||||
CONFIG_NLS_ISO8859_1=y
|
||||
CONFIG_NLS_ISO8859_15=m
|
||||
CONFIG_NLS_UTF8=y
|
||||
CONFIG_PRINTK_TIME=y
|
||||
CONFIG_DYNAMIC_DEBUG=y
|
||||
CONFIG_DEBUG_FS=y
|
||||
CONFIG_MAGIC_SYSRQ=y
|
||||
# CONFIG_SCHED_DEBUG is not set
|
||||
# CONFIG_DEBUG_BUGVERBOSE is not set
|
||||
# CONFIG_FTRACE is not set
|
||||
CONFIG_SECURITYFS=y
|
||||
CONFIG_CRYPTO_USER=y
|
||||
CONFIG_CRYPTO_TEST=m
|
||||
CONFIG_CRYPTO_CTS=y
|
||||
CONFIG_CRYPTO_LRW=y
|
||||
CONFIG_CRYPTO_XTS=y
|
||||
CONFIG_CRYPTO_MD4=y
|
||||
CONFIG_CRYPTO_MD5=y
|
||||
CONFIG_CRYPTO_RMD128=y
|
||||
CONFIG_CRYPTO_RMD160=y
|
||||
CONFIG_CRYPTO_RMD256=y
|
||||
CONFIG_CRYPTO_RMD320=y
|
||||
CONFIG_CRYPTO_SHA512=y
|
||||
CONFIG_CRYPTO_TGR192=y
|
||||
CONFIG_CRYPTO_WP512=y
|
||||
CONFIG_CRYPTO_BLOWFISH=y
|
||||
CONFIG_CRYPTO_CAMELLIA=y
|
||||
CONFIG_CRYPTO_TWOFISH=y
|
||||
CONFIG_CRYPTO_DEV_FSL_CAAM=y
|
||||
CONFIG_CRYPTO_DEV_MXS_DCP=y
|
||||
CONFIG_CRC_CCITT=m
|
||||
CONFIG_CRC_T10DIF=y
|
||||
CONFIG_CRC7=m
|
||||
CONFIG_LIBCRC32C=m
|
||||
CONFIG_FONTS=y
|
||||
CONFIG_FONT_8x8=y
|
||||
CONFIG_FONT_8x16=y
|
|
@ -33,6 +33,7 @@ config WIRELESS_WDS
|
|||
source "drivers/net/wireless/admtek/Kconfig"
|
||||
source "drivers/net/wireless/ath/Kconfig"
|
||||
source "drivers/net/wireless/atmel/Kconfig"
|
||||
source "drivers/net/wireless/bcmdhd/Kconfig"
|
||||
source "drivers/net/wireless/broadcom/Kconfig"
|
||||
source "drivers/net/wireless/cisco/Kconfig"
|
||||
source "drivers/net/wireless/intel/Kconfig"
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
obj-$(CONFIG_WLAN_VENDOR_ADMTEK) += admtek/
|
||||
obj-$(CONFIG_WLAN_VENDOR_ATH) += ath/
|
||||
obj-$(CONFIG_WLAN_VENDOR_ATMEL) += atmel/
|
||||
obj-$(CONFIG_BCMDHD) += bcmdhd/
|
||||
obj-$(CONFIG_WLAN_VENDOR_BROADCOM) += broadcom/
|
||||
obj-$(CONFIG_WLAN_VENDOR_CISCO) += cisco/
|
||||
obj-$(CONFIG_WLAN_VENDOR_INTEL) += intel/
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
config BCMDHD
|
||||
tristate "Broadcom FullMAC wireless cards support"
|
||||
---help---
|
||||
This module adds support for wireless adapters based on
|
||||
Broadcom FullMAC chipset.
|
||||
|
||||
config BCMDHD_FW_PATH
|
||||
depends on BCMDHD
|
||||
string "Firmware path"
|
||||
default "/system/etc/firmware/fw_bcmdhd.bin"
|
||||
---help---
|
||||
Path to the firmware file.
|
||||
|
||||
config BCMDHD_NVRAM_PATH
|
||||
depends on BCMDHD
|
||||
string "NVRAM path"
|
||||
default "/system/etc/firmware/nvram.txt"
|
||||
---help---
|
||||
Path to the calibration file.
|
||||
|
||||
config BCMDHD_WEXT
|
||||
bool "Enable WEXT support"
|
||||
depends on BCMDHD && CFG80211 = n
|
||||
select WIRELESS_EXT
|
||||
select WEXT_PRIV
|
||||
help
|
||||
Enables WEXT support
|
||||
|
||||
choice
|
||||
prompt "Enable Chip Interface"
|
||||
depends on BCMDHD
|
||||
---help---
|
||||
Enable Chip Interface.
|
||||
config BCMDHD_SDIO
|
||||
bool "SDIO bus interface support"
|
||||
depends on BCMDHD && MMC
|
||||
config BCMDHD_PCIE
|
||||
bool "PCIe bus interface support"
|
||||
depends on BCMDHD && PCI
|
||||
config BCMDHD_USB
|
||||
bool "USB bus interface support"
|
||||
depends on BCMDHD && USB
|
||||
endchoice
|
||||
|
||||
choice
|
||||
depends on BCMDHD && BCMDHD_SDIO
|
||||
prompt "Interrupt type"
|
||||
---help---
|
||||
Interrupt type
|
||||
config BCMDHD_OOB
|
||||
depends on BCMDHD && BCMDHD_SDIO
|
||||
bool "Out-of-Band Interrupt"
|
||||
---help---
|
||||
Interrupt from WL_HOST_WAKE.
|
||||
config BCMDHD_SDIO_IRQ
|
||||
depends on BCMDHD && BCMDHD_SDIO
|
||||
bool "In-Band Interrupt"
|
||||
---help---
|
||||
Interrupt from SDIO DAT[1]
|
||||
endchoice
|
|
@ -0,0 +1,168 @@
|
|||
# bcmdhd
|
||||
# 1. WL_IFACE_COMB_NUM_CHANNELS must be added if Android version is 4.4 with Kernel version 3.0~3.4,
|
||||
# otherwise please remove it.
|
||||
|
||||
#CONFIG_BCMDHD := m
|
||||
#CONFIG_BCMDHD_SDIO := y
|
||||
#CONFIG_BCMDHD_PCIE := y
|
||||
#CONFIG_BCMDHD_USB := y
|
||||
|
||||
#CONFIG_BCMDHD_OOB := y
|
||||
#CONFIG_BCMDHD_CUSB := y
|
||||
CONFIG_BCMDHD_PROPTXSTATUS := y
|
||||
#CONFIG_DHD_USE_STATIC_BUF := y
|
||||
#CONFIG_VTS_SUPPORT := y
|
||||
|
||||
CONFIG_MACH_PLATFORM := y
|
||||
#CONFIG_BCMDHD_DTS := y
|
||||
|
||||
DHDCFLAGS = -Wall -Wstrict-prototypes -Dlinux -DBCMDRIVER \
|
||||
-DBCMDONGLEHOST -DUNRELEASEDCHIP -DBCMDMA32 -DBCMFILEIMAGE \
|
||||
-DDHDTHREAD -DDHD_DEBUG -DSHOW_EVENTS -DBCMDBG -DGET_OTP_MAC_ENABLE \
|
||||
-DWIFI_ACT_FRAME -DARP_OFFLOAD_SUPPORT -DSUPPORT_PM2_ONLY \
|
||||
-DKEEP_ALIVE -DPKT_FILTER_SUPPORT -DPNO_SUPPORT -DDHDTCPACK_SUPPRESS \
|
||||
-DDHD_DONOT_FORWARD_BCMEVENT_AS_NETWORK_PKT \
|
||||
-DMULTIPLE_SUPPLICANT -DTSQ_MULTIPLIER -DMFP \
|
||||
-DWL_EXT_IAPSTA \
|
||||
-DENABLE_INSMOD_NO_FW_LOAD \
|
||||
-Idrivers/net/wireless/bcmdhd -Idrivers/net/wireless/bcmdhd/include
|
||||
|
||||
DHDOFILES = aiutils.o siutils.o sbutils.o bcmutils.o bcmwifi_channels.o \
|
||||
dhd_linux.o dhd_linux_platdev.o dhd_linux_sched.o dhd_pno.o \
|
||||
dhd_common.o dhd_ip.o dhd_linux_wq.o dhd_custom_gpio.o \
|
||||
bcmevent.o hndpmu.o linux_osl.o wldev_common.o wl_android.o \
|
||||
dhd_debug_linux.o dhd_debug.o dhd_mschdbg.o hnd_pktq.o hnd_pktpool.o \
|
||||
dhd_config.o wl_event.o wl_android_ext.o
|
||||
|
||||
#BCMDHD_SDIO
|
||||
ifneq ($(CONFIG_BCMDHD_SDIO),)
|
||||
DHDCFLAGS += -DBCMSDIO -DMMC_SDIO_ABORT -DBCMLXSDMMC -DUSE_SDIOFIFO_IOVAR \
|
||||
-DSDTEST -DBDC -DDHD_USE_IDLECOUNT -DCUSTOM_SDIO_F2_BLKSIZE=256 \
|
||||
-DBCMSDIOH_TXGLOM -DBCMSDIOH_TXGLOM_EXT -DRXFRAME_THREAD
|
||||
ifeq ($(CONFIG_BCMDHD_OOB),y)
|
||||
DHDCFLAGS += -DOOB_INTR_ONLY -DCUSTOMER_OOB -DHW_OOB
|
||||
ifeq ($(CONFIG_BCMDHD_DISABLE_WOWLAN),y)
|
||||
DHDCFLAGS += -DDISABLE_WOWLAN
|
||||
endif
|
||||
else
|
||||
DHDCFLAGS += -DSDIO_ISR_THREAD
|
||||
endif
|
||||
|
||||
DHDOFILES += bcmsdh.o bcmsdh_linux.o bcmsdh_sdmmc.o bcmsdh_sdmmc_linux.o \
|
||||
dhd_sdio.o dhd_cdc.o dhd_wlfc.o
|
||||
endif
|
||||
|
||||
#BCMDHD_PCIE
|
||||
ifneq ($(CONFIG_BCMDHD_PCIE),)
|
||||
DHDCFLAGS += -DPCIE_FULL_DONGLE -DBCMPCIE -DCUSTOM_DPC_PRIO_SETTING=-1 \
|
||||
-DDONGLE_ENABLE_ISOLATION
|
||||
DHDCFLAGS += -DDHD_LB -DDHD_LB_RXP -DDHD_LB_STATS #-DDHD_LB_TXP
|
||||
ifneq ($(CONFIG_PCI_MSI),)
|
||||
DHDCFLAGS += -DDHD_USE_MSI
|
||||
endif
|
||||
|
||||
DHDOFILES += dhd_pcie.o dhd_pcie_linux.o pcie_core.o dhd_flowring.o \
|
||||
dhd_msgbuf.o
|
||||
endif
|
||||
|
||||
#BCMDHD_USB
|
||||
ifneq ($(CONFIG_BCMDHD_USB),)
|
||||
DHDCFLAGS += -DUSBOS_TX_THREAD -DBCMDBUS -DBCMTRXV2 -DDBUS_USB_LOOPBACK \
|
||||
-DBDC
|
||||
DHDCFLAGS += -DBCM_REQUEST_FW -DEXTERNAL_FW_PATH
|
||||
#DHDCFLAGS :=$(filter-out -DENABLE_INSMOD_NO_FW_LOAD,$(DHDCFLAGS))
|
||||
ifneq ($(CONFIG_BCMDHD_CUSB),)
|
||||
DHDCFLAGS += -DBCMUSBDEV_COMPOSITE
|
||||
DHDCFLAGS :=$(filter-out -DENABLE_INSMOD_NO_FW_LOAD,$(DHDCFLAGS))
|
||||
endif
|
||||
|
||||
DHDOFILES += dbus.o dbus_usb.o dbus_usb_linux.o dhd_cdc.o dhd_wlfc.o
|
||||
endif
|
||||
|
||||
#PROPTXSTATUS
|
||||
ifeq ($(CONFIG_BCMDHD_PROPTXSTATUS),y)
|
||||
ifneq ($(CONFIG_BCMDHD_USB),)
|
||||
DHDCFLAGS += -DPROP_TXSTATUS
|
||||
endif
|
||||
ifneq ($(CONFIG_BCMDHD_SDIO),)
|
||||
DHDCFLAGS += -DPROP_TXSTATUS
|
||||
endif
|
||||
ifneq ($(CONFIG_CFG80211),)
|
||||
DHDCFLAGS += -DPROP_TXSTATUS_VSDB
|
||||
endif
|
||||
endif
|
||||
|
||||
#VTS_SUPPORT
|
||||
ifeq ($(CONFIG_VTS_SUPPORT),y)
|
||||
ifneq ($(CONFIG_CFG80211),)
|
||||
DHDCFLAGS += -DGSCAN_SUPPORT -DRTT_SUPPORT -DCUSTOM_FORCE_NODFS_FLAG \
|
||||
-DLINKSTAT_SUPPORT -DDEBUGABILITY -DDBG_PKT_MON \
|
||||
-DAPF -DNDO_CONFIG_SUPPORT -DRSSI_MONITOR_SUPPORT -DDHD_WAKE_STATUS \
|
||||
-DCUSTOM_COUNTRY_CODE -DDHD_FW_COREDUMP -DEXPLICIT_DISCIF_CLEANUP
|
||||
|
||||
DHDOFILES += bcmxtlv.o dhd_rtt.o bcm_app_utils.o
|
||||
endif
|
||||
endif
|
||||
|
||||
# MESH support for kernel 3.10 later
|
||||
ifeq ($(CONFIG_WL_MESH),y)
|
||||
DHDCFLAGS += -DWLMESH
|
||||
ifneq ($(CONFIG_CFG80211),)
|
||||
DHDCFLAGS += -DWLMESH_CFG80211
|
||||
endif
|
||||
ifneq ($(CONFIG_BCMDHD_PCIE),)
|
||||
DHDCFLAGS += -DBCM_HOST_BUF -DDMA_HOST_BUFFER_LEN=0x80000
|
||||
endif
|
||||
DHDCFLAGS += -DDHD_UPDATE_INTF_MAC
|
||||
DHDCFLAGS :=$(filter-out -DDHD_FW_COREDUMP,$(DHDCFLAGS))
|
||||
DHDCFLAGS :=$(filter-out -DSET_RANDOM_MAC_SOFTAP,$(DHDCFLAGS))
|
||||
endif
|
||||
|
||||
obj-$(CONFIG_BCMDHD) += bcmdhd.o
|
||||
bcmdhd-objs += $(DHDOFILES)
|
||||
|
||||
ifeq ($(CONFIG_MACH_PLATFORM),y)
|
||||
DHDOFILES += dhd_gpio.o
|
||||
ifeq ($(CONFIG_BCMDHD_DTS),y)
|
||||
DHDCFLAGS += -DCONFIG_DTS
|
||||
else
|
||||
DHDCFLAGS += -DCUSTOMER_HW -DDHD_OF_SUPPORT
|
||||
DHDCFLAGS += -DCUSTOMER_HW_PLATFORM
|
||||
endif
|
||||
# DHDCFLAGS += -DBCMWAPI_WPI -DBCMWAPI_WAI
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_BCMDHD_AG),y)
|
||||
DHDCFLAGS += -DBAND_AG
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_DHD_USE_STATIC_BUF),y)
|
||||
obj-m += dhd_static_buf.o
|
||||
DHDCFLAGS += -DSTATIC_WL_PRIV_STRUCT -DENHANCED_STATIC_BUF
|
||||
DHDCFLAGS += -DDHD_USE_STATIC_MEMDUMP -DCONFIG_DHD_USE_STATIC_BUF
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_WIRELESS_EXT),)
|
||||
DHDOFILES += wl_iw.o wl_escan.o
|
||||
DHDCFLAGS += -DSOFTAP -DWL_WIRELESS_EXT -DUSE_IW -DWL_ESCAN
|
||||
endif
|
||||
ifneq ($(CONFIG_CFG80211),)
|
||||
DHDOFILES += wl_cfg80211.o wl_cfgp2p.o wl_linux_mon.o wl_cfg_btcoex.o wl_cfgvendor.o
|
||||
DHDOFILES += dhd_cfg80211.o
|
||||
DHDCFLAGS += -DWL_CFG80211 -DWLP2P -DWL_CFG80211_STA_EVENT -DWL_ENABLE_P2P_IF
|
||||
DHDCFLAGS += -DWL_IFACE_COMB_NUM_CHANNELS
|
||||
DHDCFLAGS += -DCUSTOM_ROAM_TRIGGER_SETTING=-65
|
||||
DHDCFLAGS += -DCUSTOM_ROAM_DELTA_SETTING=15
|
||||
DHDCFLAGS += -DCUSTOM_KEEP_ALIVE_SETTING=28000
|
||||
DHDCFLAGS += -DCUSTOM_PNO_EVENT_LOCK_xTIME=7
|
||||
DHDCFLAGS += -DWL_SUPPORT_AUTO_CHANNEL
|
||||
DHDCFLAGS += -DWL_SUPPORT_BACKPORTED_KPATCHES
|
||||
DHDCFLAGS += -DESCAN_RESULT_PATCH -DESCAN_BUF_OVERFLOW_MGMT
|
||||
DHDCFLAGS += -DVSDB -DWL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST
|
||||
DHDCFLAGS += -DWLTDLS -DMIRACAST_AMPDU_SIZE=8
|
||||
DHDCFLAGS += -DWL_VIRTUAL_APSTA
|
||||
endif
|
||||
EXTRA_CFLAGS = $(DHDCFLAGS)
|
||||
ifeq ($(CONFIG_BCMDHD),m)
|
||||
EXTRA_LDFLAGS += --strip-debug
|
||||
endif
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,382 @@
|
|||
/*
|
||||
* bcmevent read-only data shared by kernel or app layers
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: bcmevent.c 707287 2017-06-27 06:44:29Z $
|
||||
*/
|
||||
|
||||
#include <typedefs.h>
|
||||
#include <bcmutils.h>
|
||||
#include <bcmendian.h>
|
||||
#include <ethernet.h>
|
||||
#include <bcmeth.h>
|
||||
#include <bcmevent.h>
|
||||
#include <802.11.h>
|
||||
|
||||
/* Table of event name strings for UIs and debugging dumps */
|
||||
typedef struct {
|
||||
uint event;
|
||||
const char *name;
|
||||
} bcmevent_name_str_t;
|
||||
|
||||
/* Use the actual name for event tracing */
|
||||
#define BCMEVENT_NAME(_event) {(_event), #_event}
|
||||
|
||||
static const bcmevent_name_str_t bcmevent_names[] = {
|
||||
BCMEVENT_NAME(WLC_E_SET_SSID),
|
||||
BCMEVENT_NAME(WLC_E_JOIN),
|
||||
BCMEVENT_NAME(WLC_E_START),
|
||||
BCMEVENT_NAME(WLC_E_AUTH),
|
||||
BCMEVENT_NAME(WLC_E_AUTH_IND),
|
||||
BCMEVENT_NAME(WLC_E_DEAUTH),
|
||||
BCMEVENT_NAME(WLC_E_DEAUTH_IND),
|
||||
BCMEVENT_NAME(WLC_E_ASSOC),
|
||||
BCMEVENT_NAME(WLC_E_ASSOC_IND),
|
||||
BCMEVENT_NAME(WLC_E_REASSOC),
|
||||
BCMEVENT_NAME(WLC_E_REASSOC_IND),
|
||||
BCMEVENT_NAME(WLC_E_DISASSOC),
|
||||
BCMEVENT_NAME(WLC_E_DISASSOC_IND),
|
||||
BCMEVENT_NAME(WLC_E_QUIET_START),
|
||||
BCMEVENT_NAME(WLC_E_QUIET_END),
|
||||
BCMEVENT_NAME(WLC_E_BEACON_RX),
|
||||
BCMEVENT_NAME(WLC_E_LINK),
|
||||
BCMEVENT_NAME(WLC_E_MIC_ERROR),
|
||||
BCMEVENT_NAME(WLC_E_NDIS_LINK),
|
||||
BCMEVENT_NAME(WLC_E_ROAM),
|
||||
BCMEVENT_NAME(WLC_E_TXFAIL),
|
||||
BCMEVENT_NAME(WLC_E_PMKID_CACHE),
|
||||
BCMEVENT_NAME(WLC_E_RETROGRADE_TSF),
|
||||
BCMEVENT_NAME(WLC_E_PRUNE),
|
||||
BCMEVENT_NAME(WLC_E_AUTOAUTH),
|
||||
BCMEVENT_NAME(WLC_E_EAPOL_MSG),
|
||||
BCMEVENT_NAME(WLC_E_SCAN_COMPLETE),
|
||||
BCMEVENT_NAME(WLC_E_ADDTS_IND),
|
||||
BCMEVENT_NAME(WLC_E_DELTS_IND),
|
||||
BCMEVENT_NAME(WLC_E_BCNSENT_IND),
|
||||
BCMEVENT_NAME(WLC_E_BCNRX_MSG),
|
||||
BCMEVENT_NAME(WLC_E_BCNLOST_MSG),
|
||||
BCMEVENT_NAME(WLC_E_ROAM_PREP),
|
||||
BCMEVENT_NAME(WLC_E_PFN_NET_FOUND),
|
||||
BCMEVENT_NAME(WLC_E_PFN_SCAN_ALLGONE),
|
||||
BCMEVENT_NAME(WLC_E_PFN_NET_LOST),
|
||||
BCMEVENT_NAME(WLC_E_JOIN_START),
|
||||
BCMEVENT_NAME(WLC_E_ROAM_START),
|
||||
BCMEVENT_NAME(WLC_E_ASSOC_START),
|
||||
#if defined(IBSS_PEER_DISCOVERY_EVENT)
|
||||
BCMEVENT_NAME(WLC_E_IBSS_ASSOC),
|
||||
#endif /* defined(IBSS_PEER_DISCOVERY_EVENT) */
|
||||
BCMEVENT_NAME(WLC_E_RADIO),
|
||||
BCMEVENT_NAME(WLC_E_PSM_WATCHDOG),
|
||||
BCMEVENT_NAME(WLC_E_PROBREQ_MSG),
|
||||
BCMEVENT_NAME(WLC_E_SCAN_CONFIRM_IND),
|
||||
BCMEVENT_NAME(WLC_E_PSK_SUP),
|
||||
BCMEVENT_NAME(WLC_E_COUNTRY_CODE_CHANGED),
|
||||
BCMEVENT_NAME(WLC_E_EXCEEDED_MEDIUM_TIME),
|
||||
BCMEVENT_NAME(WLC_E_ICV_ERROR),
|
||||
BCMEVENT_NAME(WLC_E_UNICAST_DECODE_ERROR),
|
||||
BCMEVENT_NAME(WLC_E_MULTICAST_DECODE_ERROR),
|
||||
BCMEVENT_NAME(WLC_E_TRACE),
|
||||
BCMEVENT_NAME(WLC_E_IF),
|
||||
#ifdef WLP2P
|
||||
BCMEVENT_NAME(WLC_E_P2P_DISC_LISTEN_COMPLETE),
|
||||
#endif
|
||||
BCMEVENT_NAME(WLC_E_RSSI),
|
||||
BCMEVENT_NAME(WLC_E_PFN_SCAN_COMPLETE),
|
||||
BCMEVENT_NAME(WLC_E_EXTLOG_MSG),
|
||||
BCMEVENT_NAME(WLC_E_ACTION_FRAME),
|
||||
BCMEVENT_NAME(WLC_E_ACTION_FRAME_RX),
|
||||
BCMEVENT_NAME(WLC_E_ACTION_FRAME_COMPLETE),
|
||||
#ifdef BCMWAPI_WAI
|
||||
BCMEVENT_NAME(WLC_E_WAI_STA_EVENT),
|
||||
BCMEVENT_NAME(WLC_E_WAI_MSG),
|
||||
#endif /* BCMWAPI_WAI */
|
||||
BCMEVENT_NAME(WLC_E_ESCAN_RESULT),
|
||||
BCMEVENT_NAME(WLC_E_ACTION_FRAME_OFF_CHAN_COMPLETE),
|
||||
#ifdef WLP2P
|
||||
BCMEVENT_NAME(WLC_E_PROBRESP_MSG),
|
||||
BCMEVENT_NAME(WLC_E_P2P_PROBREQ_MSG),
|
||||
#endif
|
||||
#ifdef PROP_TXSTATUS
|
||||
BCMEVENT_NAME(WLC_E_FIFO_CREDIT_MAP),
|
||||
#endif
|
||||
BCMEVENT_NAME(WLC_E_WAKE_EVENT),
|
||||
BCMEVENT_NAME(WLC_E_DCS_REQUEST),
|
||||
BCMEVENT_NAME(WLC_E_RM_COMPLETE),
|
||||
#ifdef WLMEDIA_HTSF
|
||||
BCMEVENT_NAME(WLC_E_HTSFSYNC),
|
||||
#endif
|
||||
BCMEVENT_NAME(WLC_E_OVERLAY_REQ),
|
||||
BCMEVENT_NAME(WLC_E_CSA_COMPLETE_IND),
|
||||
BCMEVENT_NAME(WLC_E_EXCESS_PM_WAKE_EVENT),
|
||||
BCMEVENT_NAME(WLC_E_PFN_SCAN_NONE),
|
||||
BCMEVENT_NAME(WLC_E_PFN_SCAN_ALLGONE),
|
||||
#ifdef SOFTAP
|
||||
BCMEVENT_NAME(WLC_E_GTK_PLUMBED),
|
||||
#endif
|
||||
BCMEVENT_NAME(WLC_E_ASSOC_REQ_IE),
|
||||
BCMEVENT_NAME(WLC_E_ASSOC_RESP_IE),
|
||||
BCMEVENT_NAME(WLC_E_BEACON_FRAME_RX),
|
||||
#ifdef WLTDLS
|
||||
BCMEVENT_NAME(WLC_E_TDLS_PEER_EVENT),
|
||||
#endif /* WLTDLS */
|
||||
BCMEVENT_NAME(WLC_E_NATIVE),
|
||||
#ifdef WLPKTDLYSTAT
|
||||
BCMEVENT_NAME(WLC_E_PKTDELAY_IND),
|
||||
#endif /* WLPKTDLYSTAT */
|
||||
BCMEVENT_NAME(WLC_E_SERVICE_FOUND),
|
||||
BCMEVENT_NAME(WLC_E_GAS_FRAGMENT_RX),
|
||||
BCMEVENT_NAME(WLC_E_GAS_COMPLETE),
|
||||
BCMEVENT_NAME(WLC_E_P2PO_ADD_DEVICE),
|
||||
BCMEVENT_NAME(WLC_E_P2PO_DEL_DEVICE),
|
||||
#ifdef WLWNM
|
||||
BCMEVENT_NAME(WLC_E_WNM_STA_SLEEP),
|
||||
#endif /* WLWNM */
|
||||
#if defined(WL_PROXDETECT)
|
||||
BCMEVENT_NAME(WLC_E_PROXD),
|
||||
#endif
|
||||
BCMEVENT_NAME(WLC_E_CCA_CHAN_QUAL),
|
||||
BCMEVENT_NAME(WLC_E_BSSID),
|
||||
#ifdef PROP_TXSTATUS
|
||||
BCMEVENT_NAME(WLC_E_BCMC_CREDIT_SUPPORT),
|
||||
#endif
|
||||
BCMEVENT_NAME(WLC_E_PSTA_PRIMARY_INTF_IND),
|
||||
BCMEVENT_NAME(WLC_E_TXFAIL_THRESH),
|
||||
#ifdef GSCAN_SUPPORT
|
||||
BCMEVENT_NAME(WLC_E_PFN_GSCAN_FULL_RESULT),
|
||||
BCMEVENT_NAME(WLC_E_PFN_SSID_EXT),
|
||||
#endif /* GSCAN_SUPPORT */
|
||||
#ifdef WLBSSLOAD_REPORT
|
||||
BCMEVENT_NAME(WLC_E_BSS_LOAD),
|
||||
#endif
|
||||
#if defined(BT_WIFI_HANDOVER) || defined(WL_TBOW)
|
||||
BCMEVENT_NAME(WLC_E_BT_WIFI_HANDOVER_REQ),
|
||||
#endif
|
||||
BCMEVENT_NAME(WLC_E_AUTHORIZED),
|
||||
BCMEVENT_NAME(WLC_E_PROBREQ_MSG_RX),
|
||||
BCMEVENT_NAME(WLC_E_CSA_START_IND),
|
||||
BCMEVENT_NAME(WLC_E_CSA_DONE_IND),
|
||||
BCMEVENT_NAME(WLC_E_CSA_FAILURE_IND),
|
||||
BCMEVENT_NAME(WLC_E_RMC_EVENT),
|
||||
BCMEVENT_NAME(WLC_E_DPSTA_INTF_IND),
|
||||
BCMEVENT_NAME(WLC_E_ALLOW_CREDIT_BORROW),
|
||||
BCMEVENT_NAME(WLC_E_MSCH),
|
||||
BCMEVENT_NAME(WLC_E_ULP),
|
||||
BCMEVENT_NAME(WLC_E_PSK_AUTH),
|
||||
BCMEVENT_NAME(WLC_E_SDB_TRANSITION),
|
||||
};
|
||||
|
||||
|
||||
const char *bcmevent_get_name(uint event_type)
|
||||
{
|
||||
/* note: first coded this as a static const but some
|
||||
* ROMs already have something called event_name so
|
||||
* changed it so we don't have a variable for the
|
||||
* 'unknown string
|
||||
*/
|
||||
const char *event_name = NULL;
|
||||
|
||||
uint idx;
|
||||
for (idx = 0; idx < (uint)ARRAYSIZE(bcmevent_names); idx++) {
|
||||
|
||||
if (bcmevent_names[idx].event == event_type) {
|
||||
event_name = bcmevent_names[idx].name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* if we find an event name in the array, return it.
|
||||
* otherwise return unknown string.
|
||||
*/
|
||||
return ((event_name) ? event_name : "Unknown Event");
|
||||
}
|
||||
|
||||
void
|
||||
wl_event_to_host_order(wl_event_msg_t * evt)
|
||||
{
|
||||
/* Event struct members passed from dongle to host are stored in network
|
||||
* byte order. Convert all members to host-order.
|
||||
*/
|
||||
evt->event_type = ntoh32(evt->event_type);
|
||||
evt->flags = ntoh16(evt->flags);
|
||||
evt->status = ntoh32(evt->status);
|
||||
evt->reason = ntoh32(evt->reason);
|
||||
evt->auth_type = ntoh32(evt->auth_type);
|
||||
evt->datalen = ntoh32(evt->datalen);
|
||||
evt->version = ntoh16(evt->version);
|
||||
}
|
||||
|
||||
void
|
||||
wl_event_to_network_order(wl_event_msg_t * evt)
|
||||
{
|
||||
/* Event struct members passed from dongle to host are stored in network
|
||||
* byte order. Convert all members to host-order.
|
||||
*/
|
||||
evt->event_type = hton32(evt->event_type);
|
||||
evt->flags = hton16(evt->flags);
|
||||
evt->status = hton32(evt->status);
|
||||
evt->reason = hton32(evt->reason);
|
||||
evt->auth_type = hton32(evt->auth_type);
|
||||
evt->datalen = hton32(evt->datalen);
|
||||
evt->version = hton16(evt->version);
|
||||
}
|
||||
|
||||
/*
|
||||
* Validate if the event is proper and if valid copy event header to event.
|
||||
* If proper event pointer is passed, to just validate, pass NULL to event.
|
||||
*
|
||||
* Return values are
|
||||
* BCME_OK - It is a BRCM event or BRCM dongle event
|
||||
* BCME_NOTFOUND - Not BRCM, not an event, may be okay
|
||||
* BCME_BADLEN - Bad length, should not process, just drop
|
||||
*/
|
||||
int
|
||||
is_wlc_event_frame(void *pktdata, uint pktlen, uint16 exp_usr_subtype,
|
||||
bcm_event_msg_u_t *out_event)
|
||||
{
|
||||
uint16 evlen = 0; /* length in bcmeth_hdr */
|
||||
uint16 subtype;
|
||||
uint16 usr_subtype;
|
||||
bcm_event_t *bcm_event;
|
||||
uint8 *pktend;
|
||||
uint8 *evend;
|
||||
int err = BCME_OK;
|
||||
uint32 data_len = 0; /* data length in bcm_event */
|
||||
|
||||
pktend = (uint8 *)pktdata + pktlen;
|
||||
bcm_event = (bcm_event_t *)pktdata;
|
||||
|
||||
/* only care about 16-bit subtype / length versions */
|
||||
if ((uint8 *)&bcm_event->bcm_hdr < pktend) {
|
||||
uint8 short_subtype = *(uint8 *)&bcm_event->bcm_hdr;
|
||||
if (!(short_subtype & 0x80)) {
|
||||
err = BCME_NOTFOUND;
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
/* must have both ether_header and bcmeth_hdr */
|
||||
if (pktlen < OFFSETOF(bcm_event_t, event)) {
|
||||
err = BCME_BADLEN;
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* check length in bcmeth_hdr */
|
||||
|
||||
/* temporary - header length not always set properly. When the below
|
||||
* !BCMDONGLEHOST is in all branches that use trunk DHD, the code
|
||||
* under BCMDONGLEHOST can be removed.
|
||||
*/
|
||||
evlen = (uint16)(pktend - (uint8 *)&bcm_event->bcm_hdr.version);
|
||||
evend = (uint8 *)&bcm_event->bcm_hdr.version + evlen;
|
||||
if (evend != pktend) {
|
||||
err = BCME_BADLEN;
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* match on subtype, oui and usr subtype for BRCM events */
|
||||
subtype = ntoh16_ua((void *)&bcm_event->bcm_hdr.subtype);
|
||||
if (subtype != BCMILCP_SUBTYPE_VENDOR_LONG) {
|
||||
err = BCME_NOTFOUND;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (bcmp(BRCM_OUI, &bcm_event->bcm_hdr.oui[0], DOT11_OUI_LEN)) {
|
||||
err = BCME_NOTFOUND;
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* if it is a bcm_event or bcm_dngl_event_t, validate it */
|
||||
usr_subtype = ntoh16_ua((void *)&bcm_event->bcm_hdr.usr_subtype);
|
||||
switch (usr_subtype) {
|
||||
case BCMILCP_BCM_SUBTYPE_EVENT:
|
||||
/* check that header length and pkt length are sufficient */
|
||||
if ((pktlen < sizeof(bcm_event_t)) ||
|
||||
(evend < ((uint8 *)bcm_event + sizeof(bcm_event_t)))) {
|
||||
err = BCME_BADLEN;
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* ensure data length in event is not beyond the packet. */
|
||||
data_len = ntoh32_ua((void *)&bcm_event->event.datalen);
|
||||
if ((sizeof(bcm_event_t) + data_len +
|
||||
BCMILCP_BCM_SUBTYPE_EVENT_DATA_PAD) != pktlen) {
|
||||
err = BCME_BADLEN;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (exp_usr_subtype && (exp_usr_subtype != usr_subtype)) {
|
||||
err = BCME_NOTFOUND;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (out_event) {
|
||||
/* ensure BRCM event pkt aligned */
|
||||
memcpy(&out_event->event, &bcm_event->event, sizeof(wl_event_msg_t));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case BCMILCP_BCM_SUBTYPE_DNGLEVENT:
|
||||
#if defined(DNGL_EVENT_SUPPORT)
|
||||
if ((pktlen < sizeof(bcm_dngl_event_t)) ||
|
||||
(evend < ((uint8 *)bcm_event + sizeof(bcm_dngl_event_t)))) {
|
||||
err = BCME_BADLEN;
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* ensure data length in event is not beyond the packet. */
|
||||
data_len = ntoh16_ua((void *)&((bcm_dngl_event_t *)pktdata)->dngl_event.datalen);
|
||||
if ((sizeof(bcm_dngl_event_t) + data_len +
|
||||
BCMILCP_BCM_SUBTYPE_EVENT_DATA_PAD) != pktlen) {
|
||||
err = BCME_BADLEN;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (exp_usr_subtype && (exp_usr_subtype != usr_subtype)) {
|
||||
err = BCME_NOTFOUND;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (out_event) {
|
||||
/* ensure BRCM dngl event pkt aligned */
|
||||
memcpy(&out_event->dngl_event, &((bcm_dngl_event_t *)pktdata)->dngl_event,
|
||||
sizeof(bcm_dngl_event_msg_t));
|
||||
}
|
||||
|
||||
break;
|
||||
#else
|
||||
err = BCME_UNSUPPORTED;
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
err = BCME_NOTFOUND;
|
||||
goto done;
|
||||
}
|
||||
|
||||
BCM_REFERENCE(data_len);
|
||||
done:
|
||||
return err;
|
||||
}
|
|
@ -0,0 +1,847 @@
|
|||
/*
|
||||
* BCMSDH interface glue
|
||||
* implement bcmsdh API for SDIOH driver
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: bcmsdh.c 671319 2016-11-21 14:27:29Z $
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file bcmsdh.c
|
||||
*/
|
||||
|
||||
/* ****************** BCMSDH Interface Functions *************************** */
|
||||
|
||||
#include <typedefs.h>
|
||||
#include <bcmdevs.h>
|
||||
#include <bcmendian.h>
|
||||
#include <bcmutils.h>
|
||||
#include <hndsoc.h>
|
||||
#include <siutils.h>
|
||||
#include <osl.h>
|
||||
|
||||
#include <bcmsdh.h> /* BRCM API for SDIO clients (such as wl, dhd) */
|
||||
#include <bcmsdbus.h> /* common SDIO/controller interface */
|
||||
#include <sbsdio.h> /* SDIO device core hardware definitions. */
|
||||
#include <sdio.h> /* SDIO Device and Protocol Specs */
|
||||
|
||||
#if defined(BT_OVER_SDIO)
|
||||
#include <dhd_bt_interface.h>
|
||||
#endif /* defined (BT_OVER_SDIO) */
|
||||
|
||||
#define SDIOH_API_ACCESS_RETRY_LIMIT 2
|
||||
const uint bcmsdh_msglevel = BCMSDH_ERROR_VAL;
|
||||
|
||||
/* local copy of bcm sd handler */
|
||||
bcmsdh_info_t * l_bcmsdh = NULL;
|
||||
|
||||
#if defined(BT_OVER_SDIO)
|
||||
struct sdio_func *func_f3 = NULL;
|
||||
static f3intr_handler processf3intr = NULL;
|
||||
static dhd_hang_notification process_dhd_hang_notification = NULL;
|
||||
static dhd_hang_state_t g_dhd_hang_state = NO_HANG_STATE;
|
||||
#endif /* defined (BT_OVER_SDIO) */
|
||||
|
||||
|
||||
#if defined(OOB_INTR_ONLY) && defined(HW_OOB) || defined(FORCE_WOWLAN)
|
||||
extern int
|
||||
sdioh_enable_hw_oob_intr(void *sdioh, bool enable);
|
||||
|
||||
void
|
||||
bcmsdh_enable_hw_oob_intr(bcmsdh_info_t *sdh, bool enable)
|
||||
{
|
||||
sdioh_enable_hw_oob_intr(sdh->sdioh, enable);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(BT_OVER_SDIO)
|
||||
void bcmsdh_btsdio_process_hang_state(dhd_hang_state_t new_state)
|
||||
{
|
||||
bool state_change = false;
|
||||
|
||||
BCMSDH_ERROR(("%s: DHD hang state changed - [%d] -> [%d]\n",
|
||||
__FUNCTION__, g_dhd_hang_state, new_state));
|
||||
|
||||
if (g_dhd_hang_state == new_state)
|
||||
return;
|
||||
|
||||
switch (g_dhd_hang_state) {
|
||||
case NO_HANG_STATE:
|
||||
if (HANG_START_STATE == new_state)
|
||||
state_change = true;
|
||||
break;
|
||||
|
||||
case HANG_START_STATE:
|
||||
if (HANG_RECOVERY_STATE == new_state ||
|
||||
NO_HANG_STATE == new_state)
|
||||
state_change = true;
|
||||
break;
|
||||
|
||||
case HANG_RECOVERY_STATE:
|
||||
if (NO_HANG_STATE == new_state)
|
||||
state_change = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
BCMSDH_ERROR(("%s: Unhandled Hang state\n", __FUNCTION__));
|
||||
break;
|
||||
}
|
||||
|
||||
if (!state_change) {
|
||||
BCMSDH_ERROR(("%s: Hang state cannot be changed\n", __FUNCTION__));
|
||||
return;
|
||||
}
|
||||
|
||||
g_dhd_hang_state = new_state;
|
||||
}
|
||||
|
||||
void bcmsdh_btsdio_process_f3_intr(void)
|
||||
{
|
||||
if (processf3intr && (g_dhd_hang_state == NO_HANG_STATE))
|
||||
processf3intr(func_f3);
|
||||
}
|
||||
|
||||
void bcmsdh_btsdio_process_dhd_hang_notification(bool wifi_recovery_completed)
|
||||
{
|
||||
bcmsdh_btsdio_process_hang_state(HANG_START_STATE);
|
||||
|
||||
if (process_dhd_hang_notification)
|
||||
process_dhd_hang_notification(func_f3, wifi_recovery_completed);
|
||||
|
||||
/* WiFi was off, so HANG_RECOVERY_STATE is not needed */
|
||||
if (wifi_recovery_completed)
|
||||
bcmsdh_btsdio_process_hang_state(NO_HANG_STATE);
|
||||
else {
|
||||
bcmsdh_btsdio_process_hang_state(HANG_RECOVERY_STATE);
|
||||
}
|
||||
}
|
||||
|
||||
void bcmsdh_btsdio_interface_init(struct sdio_func *func,
|
||||
f3intr_handler f3intr_fun, dhd_hang_notification hang_notification)
|
||||
{
|
||||
bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)l_bcmsdh;
|
||||
BCMSDH_INFO(("%s: func %p \n", __FUNCTION__, func));
|
||||
func_f3 = func;
|
||||
processf3intr = f3intr_fun;
|
||||
sdioh_sdmmc_card_enable_func_f3(bcmsdh->sdioh, func);
|
||||
process_dhd_hang_notification = hang_notification;
|
||||
|
||||
} EXPORT_SYMBOL(bcmsdh_btsdio_interface_init);
|
||||
#endif /* defined (BT_OVER_SDIO) */
|
||||
|
||||
/* Attach BCMSDH layer to SDIO Host Controller Driver
|
||||
*
|
||||
* @param osh OSL Handle.
|
||||
* @param cfghdl Configuration Handle.
|
||||
* @param regsva Virtual address of controller registers.
|
||||
* @param irq Interrupt number of SDIO controller.
|
||||
*
|
||||
* @return bcmsdh_info_t Handle to BCMSDH context.
|
||||
*/
|
||||
bcmsdh_info_t *
|
||||
bcmsdh_attach(osl_t *osh, void *sdioh, ulong *regsva)
|
||||
{
|
||||
bcmsdh_info_t *bcmsdh;
|
||||
|
||||
if ((bcmsdh = (bcmsdh_info_t *)MALLOC(osh, sizeof(bcmsdh_info_t))) == NULL) {
|
||||
BCMSDH_ERROR(("bcmsdh_attach: out of memory, malloced %d bytes\n", MALLOCED(osh)));
|
||||
return NULL;
|
||||
}
|
||||
bzero((char *)bcmsdh, sizeof(bcmsdh_info_t));
|
||||
bcmsdh->sdioh = sdioh;
|
||||
bcmsdh->osh = osh;
|
||||
bcmsdh->init_success = TRUE;
|
||||
*regsva = SI_ENUM_BASE;
|
||||
|
||||
bcmsdh_force_sbwad_calc(bcmsdh, FALSE);
|
||||
|
||||
/* Report the BAR, to fix if needed */
|
||||
bcmsdh->sbwad = SI_ENUM_BASE;
|
||||
|
||||
/* save the handler locally */
|
||||
l_bcmsdh = bcmsdh;
|
||||
|
||||
return bcmsdh;
|
||||
}
|
||||
|
||||
int
|
||||
bcmsdh_detach(osl_t *osh, void *sdh)
|
||||
{
|
||||
bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
|
||||
|
||||
if (bcmsdh != NULL) {
|
||||
MFREE(osh, bcmsdh, sizeof(bcmsdh_info_t));
|
||||
}
|
||||
|
||||
l_bcmsdh = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
bcmsdh_iovar_op(void *sdh, const char *name,
|
||||
void *params, int plen, void *arg, int len, bool set)
|
||||
{
|
||||
bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
|
||||
return sdioh_iovar_op(bcmsdh->sdioh, name, params, plen, arg, len, set);
|
||||
}
|
||||
|
||||
bool
|
||||
bcmsdh_intr_query(void *sdh)
|
||||
{
|
||||
bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
|
||||
SDIOH_API_RC status;
|
||||
bool on;
|
||||
|
||||
ASSERT(bcmsdh);
|
||||
status = sdioh_interrupt_query(bcmsdh->sdioh, &on);
|
||||
if (SDIOH_API_SUCCESS(status))
|
||||
return FALSE;
|
||||
else
|
||||
return on;
|
||||
}
|
||||
|
||||
int
|
||||
bcmsdh_intr_enable(void *sdh)
|
||||
{
|
||||
bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
|
||||
SDIOH_API_RC status;
|
||||
ASSERT(bcmsdh);
|
||||
|
||||
status = sdioh_interrupt_set(bcmsdh->sdioh, TRUE);
|
||||
return (SDIOH_API_SUCCESS(status) ? 0 : BCME_ERROR);
|
||||
}
|
||||
|
||||
int
|
||||
bcmsdh_intr_disable(void *sdh)
|
||||
{
|
||||
bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
|
||||
SDIOH_API_RC status;
|
||||
ASSERT(bcmsdh);
|
||||
|
||||
status = sdioh_interrupt_set(bcmsdh->sdioh, FALSE);
|
||||
return (SDIOH_API_SUCCESS(status) ? 0 : BCME_ERROR);
|
||||
}
|
||||
|
||||
int
|
||||
bcmsdh_intr_reg(void *sdh, bcmsdh_cb_fn_t fn, void *argh)
|
||||
{
|
||||
bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
|
||||
SDIOH_API_RC status;
|
||||
|
||||
if (!bcmsdh)
|
||||
bcmsdh = l_bcmsdh;
|
||||
|
||||
ASSERT(bcmsdh);
|
||||
|
||||
status = sdioh_interrupt_register(bcmsdh->sdioh, fn, argh);
|
||||
return (SDIOH_API_SUCCESS(status) ? 0 : BCME_ERROR);
|
||||
}
|
||||
|
||||
int
|
||||
bcmsdh_intr_dereg(void *sdh)
|
||||
{
|
||||
bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
|
||||
SDIOH_API_RC status;
|
||||
|
||||
if (!bcmsdh)
|
||||
bcmsdh = l_bcmsdh;
|
||||
|
||||
ASSERT(bcmsdh);
|
||||
|
||||
status = sdioh_interrupt_deregister(bcmsdh->sdioh);
|
||||
return (SDIOH_API_SUCCESS(status) ? 0 : BCME_ERROR);
|
||||
}
|
||||
|
||||
#if defined(DHD_DEBUG)
|
||||
bool
|
||||
bcmsdh_intr_pending(void *sdh)
|
||||
{
|
||||
bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
|
||||
|
||||
ASSERT(sdh);
|
||||
return sdioh_interrupt_pending(bcmsdh->sdioh);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
int
|
||||
bcmsdh_devremove_reg(void *sdh, bcmsdh_cb_fn_t fn, void *argh)
|
||||
{
|
||||
ASSERT(sdh);
|
||||
|
||||
/* don't support yet */
|
||||
return BCME_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read from SDIO Configuration Space
|
||||
* @param sdh SDIO Host context.
|
||||
* @param func_num Function number to read from.
|
||||
* @param addr Address to read from.
|
||||
* @param err Error return.
|
||||
* @return value read from SDIO configuration space.
|
||||
*/
|
||||
uint8
|
||||
bcmsdh_cfg_read(void *sdh, uint fnc_num, uint32 addr, int *err)
|
||||
{
|
||||
bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
|
||||
SDIOH_API_RC status;
|
||||
#ifdef SDIOH_API_ACCESS_RETRY_LIMIT
|
||||
int32 retry = 0;
|
||||
#endif
|
||||
uint8 data = 0;
|
||||
|
||||
if (!bcmsdh)
|
||||
bcmsdh = l_bcmsdh;
|
||||
|
||||
ASSERT(bcmsdh->init_success);
|
||||
|
||||
#ifdef SDIOH_API_ACCESS_RETRY_LIMIT
|
||||
do {
|
||||
if (retry) /* wait for 1 ms till bus get settled down */
|
||||
OSL_DELAY(1000);
|
||||
#endif
|
||||
status = sdioh_cfg_read(bcmsdh->sdioh, fnc_num, addr, (uint8 *)&data);
|
||||
#ifdef SDIOH_API_ACCESS_RETRY_LIMIT
|
||||
} while (!SDIOH_API_SUCCESS(status) && (retry++ < SDIOH_API_ACCESS_RETRY_LIMIT));
|
||||
#endif
|
||||
if (err)
|
||||
*err = (SDIOH_API_SUCCESS(status) ? 0 : BCME_SDIO_ERROR);
|
||||
|
||||
BCMSDH_INFO(("%s:fun = %d, addr = 0x%x, uint8data = 0x%x\n", __FUNCTION__,
|
||||
fnc_num, addr, data));
|
||||
|
||||
return data;
|
||||
} EXPORT_SYMBOL(bcmsdh_cfg_read);
|
||||
|
||||
void
|
||||
bcmsdh_cfg_write(void *sdh, uint fnc_num, uint32 addr, uint8 data, int *err)
|
||||
{
|
||||
bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
|
||||
SDIOH_API_RC status;
|
||||
#ifdef SDIOH_API_ACCESS_RETRY_LIMIT
|
||||
int32 retry = 0;
|
||||
#endif
|
||||
|
||||
if (!bcmsdh)
|
||||
bcmsdh = l_bcmsdh;
|
||||
|
||||
ASSERT(bcmsdh->init_success);
|
||||
|
||||
#ifdef SDIOH_API_ACCESS_RETRY_LIMIT
|
||||
do {
|
||||
if (retry) /* wait for 1 ms till bus get settled down */
|
||||
OSL_DELAY(1000);
|
||||
#endif
|
||||
status = sdioh_cfg_write(bcmsdh->sdioh, fnc_num, addr, (uint8 *)&data);
|
||||
#ifdef SDIOH_API_ACCESS_RETRY_LIMIT
|
||||
} while (!SDIOH_API_SUCCESS(status) && (retry++ < SDIOH_API_ACCESS_RETRY_LIMIT));
|
||||
#endif
|
||||
if (err)
|
||||
*err = SDIOH_API_SUCCESS(status) ? 0 : BCME_SDIO_ERROR;
|
||||
|
||||
BCMSDH_INFO(("%s:fun = %d, addr = 0x%x, uint8data = 0x%x\n", __FUNCTION__,
|
||||
fnc_num, addr, data));
|
||||
} EXPORT_SYMBOL(bcmsdh_cfg_write);
|
||||
|
||||
uint32
|
||||
bcmsdh_cfg_read_word(void *sdh, uint fnc_num, uint32 addr, int *err)
|
||||
{
|
||||
bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
|
||||
SDIOH_API_RC status;
|
||||
uint32 data = 0;
|
||||
|
||||
if (!bcmsdh)
|
||||
bcmsdh = l_bcmsdh;
|
||||
|
||||
ASSERT(bcmsdh->init_success);
|
||||
|
||||
status = sdioh_request_word(bcmsdh->sdioh, SDIOH_CMD_TYPE_NORMAL, SDIOH_READ, fnc_num,
|
||||
addr, &data, 4);
|
||||
|
||||
if (err)
|
||||
*err = (SDIOH_API_SUCCESS(status) ? 0 : BCME_SDIO_ERROR);
|
||||
|
||||
BCMSDH_INFO(("%s:fun = %d, addr = 0x%x, uint32data = 0x%x\n", __FUNCTION__,
|
||||
fnc_num, addr, data));
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
void
|
||||
bcmsdh_cfg_write_word(void *sdh, uint fnc_num, uint32 addr, uint32 data, int *err)
|
||||
{
|
||||
bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
|
||||
SDIOH_API_RC status;
|
||||
|
||||
if (!bcmsdh)
|
||||
bcmsdh = l_bcmsdh;
|
||||
|
||||
ASSERT(bcmsdh->init_success);
|
||||
|
||||
status = sdioh_request_word(bcmsdh->sdioh, SDIOH_CMD_TYPE_NORMAL, SDIOH_WRITE, fnc_num,
|
||||
addr, &data, 4);
|
||||
|
||||
if (err)
|
||||
*err = (SDIOH_API_SUCCESS(status) ? 0 : BCME_SDIO_ERROR);
|
||||
|
||||
BCMSDH_INFO(("%s:fun = %d, addr = 0x%x, uint32data = 0x%x\n", __FUNCTION__, fnc_num,
|
||||
addr, data));
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
bcmsdh_cis_read(void *sdh, uint func, uint8 *cis, uint length)
|
||||
{
|
||||
bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
|
||||
SDIOH_API_RC status;
|
||||
|
||||
uint8 *tmp_buf, *tmp_ptr;
|
||||
uint8 *ptr;
|
||||
bool ascii = func & ~0xf;
|
||||
func &= 0x7;
|
||||
|
||||
if (!bcmsdh)
|
||||
bcmsdh = l_bcmsdh;
|
||||
|
||||
ASSERT(bcmsdh->init_success);
|
||||
ASSERT(cis);
|
||||
ASSERT(length <= SBSDIO_CIS_SIZE_LIMIT);
|
||||
|
||||
status = sdioh_cis_read(bcmsdh->sdioh, func, cis, length);
|
||||
|
||||
if (ascii) {
|
||||
/* Move binary bits to tmp and format them into the provided buffer. */
|
||||
if ((tmp_buf = (uint8 *)MALLOC(bcmsdh->osh, length)) == NULL) {
|
||||
BCMSDH_ERROR(("%s: out of memory\n", __FUNCTION__));
|
||||
return BCME_NOMEM;
|
||||
}
|
||||
bcopy(cis, tmp_buf, length);
|
||||
for (tmp_ptr = tmp_buf, ptr = cis; ptr < (cis + length - 4); tmp_ptr++) {
|
||||
ptr += snprintf((char*)ptr, (cis + length - ptr - 4),
|
||||
"%.2x ", *tmp_ptr & 0xff);
|
||||
if ((((tmp_ptr - tmp_buf) + 1) & 0xf) == 0)
|
||||
ptr += snprintf((char *)ptr, (cis + length - ptr -4), "\n");
|
||||
}
|
||||
MFREE(bcmsdh->osh, tmp_buf, length);
|
||||
}
|
||||
|
||||
return (SDIOH_API_SUCCESS(status) ? 0 : BCME_ERROR);
|
||||
}
|
||||
|
||||
int
|
||||
bcmsdh_cisaddr_read(void *sdh, uint func, uint8 *cisd, uint32 offset)
|
||||
{
|
||||
bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
|
||||
SDIOH_API_RC status;
|
||||
|
||||
func &= 0x7;
|
||||
|
||||
if (!bcmsdh)
|
||||
bcmsdh = l_bcmsdh;
|
||||
|
||||
ASSERT(bcmsdh->init_success);
|
||||
ASSERT(cisd);
|
||||
|
||||
status = sdioh_cisaddr_read(bcmsdh->sdioh, func, cisd, offset);
|
||||
|
||||
return (SDIOH_API_SUCCESS(status) ? 0 : BCME_ERROR);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
bcmsdhsdio_set_sbaddr_window(void *sdh, uint32 address, bool force_set)
|
||||
{
|
||||
int err = 0;
|
||||
uint bar0 = address & ~SBSDIO_SB_OFT_ADDR_MASK;
|
||||
bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
|
||||
|
||||
if (bar0 != bcmsdh->sbwad || force_set) {
|
||||
bcmsdh_cfg_write(bcmsdh, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRLOW,
|
||||
(address >> 8) & SBSDIO_SBADDRLOW_MASK, &err);
|
||||
if (!err)
|
||||
bcmsdh_cfg_write(bcmsdh, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRMID,
|
||||
(address >> 16) & SBSDIO_SBADDRMID_MASK, &err);
|
||||
if (!err)
|
||||
bcmsdh_cfg_write(bcmsdh, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRHIGH,
|
||||
(address >> 24) & SBSDIO_SBADDRHIGH_MASK, &err);
|
||||
|
||||
if (!err)
|
||||
bcmsdh->sbwad = bar0;
|
||||
else
|
||||
/* invalidate cached window var */
|
||||
bcmsdh->sbwad = 0;
|
||||
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
uint32
|
||||
bcmsdh_reg_read(void *sdh, uintptr addr, uint size)
|
||||
{
|
||||
bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
|
||||
SDIOH_API_RC status;
|
||||
uint32 word = 0;
|
||||
|
||||
BCMSDH_INFO(("%s:fun = 1, addr = 0x%x\n", __FUNCTION__, (unsigned int)addr));
|
||||
|
||||
if (!bcmsdh)
|
||||
bcmsdh = l_bcmsdh;
|
||||
|
||||
ASSERT(bcmsdh->init_success);
|
||||
|
||||
if (bcmsdhsdio_set_sbaddr_window(bcmsdh, addr, FALSE)) {
|
||||
bcmsdh->regfail = TRUE; // terence 20130621: prevent dhd_dpc in dead lock
|
||||
return 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
addr &= SBSDIO_SB_OFT_ADDR_MASK;
|
||||
if (size == 4)
|
||||
addr |= SBSDIO_SB_ACCESS_2_4B_FLAG;
|
||||
|
||||
status = sdioh_request_word(bcmsdh->sdioh, SDIOH_CMD_TYPE_NORMAL,
|
||||
SDIOH_READ, SDIO_FUNC_1, addr, &word, size);
|
||||
|
||||
bcmsdh->regfail = !(SDIOH_API_SUCCESS(status));
|
||||
|
||||
BCMSDH_INFO(("uint32data = 0x%x\n", word));
|
||||
|
||||
/* if ok, return appropriately masked word */
|
||||
if (SDIOH_API_SUCCESS(status)) {
|
||||
switch (size) {
|
||||
case sizeof(uint8):
|
||||
return (word & 0xff);
|
||||
case sizeof(uint16):
|
||||
return (word & 0xffff);
|
||||
case sizeof(uint32):
|
||||
return word;
|
||||
default:
|
||||
bcmsdh->regfail = TRUE;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* otherwise, bad sdio access or invalid size */
|
||||
BCMSDH_ERROR(("%s: error reading addr 0x%x size %d\n",
|
||||
__FUNCTION__, (unsigned int)addr, size));
|
||||
return 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
uint32
|
||||
bcmsdh_reg_write(void *sdh, uintptr addr, uint size, uint32 data)
|
||||
{
|
||||
bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
|
||||
SDIOH_API_RC status;
|
||||
int err = 0;
|
||||
|
||||
BCMSDH_INFO(("%s:fun = 1, addr = 0x%x, uint%ddata = 0x%x\n",
|
||||
__FUNCTION__, (unsigned int)addr, size*8, data));
|
||||
|
||||
if (!bcmsdh)
|
||||
bcmsdh = l_bcmsdh;
|
||||
|
||||
ASSERT(bcmsdh->init_success);
|
||||
|
||||
if ((err = bcmsdhsdio_set_sbaddr_window(bcmsdh, addr, bcmsdh->force_sbwad_calc))) {
|
||||
bcmsdh->regfail = TRUE; // terence 20130621:
|
||||
return err;
|
||||
}
|
||||
|
||||
addr &= SBSDIO_SB_OFT_ADDR_MASK;
|
||||
if (size == 4)
|
||||
addr |= SBSDIO_SB_ACCESS_2_4B_FLAG;
|
||||
status = sdioh_request_word(bcmsdh->sdioh, SDIOH_CMD_TYPE_NORMAL, SDIOH_WRITE, SDIO_FUNC_1,
|
||||
addr, &data, size);
|
||||
bcmsdh->regfail = !(SDIOH_API_SUCCESS(status));
|
||||
|
||||
if (SDIOH_API_SUCCESS(status))
|
||||
return 0;
|
||||
|
||||
BCMSDH_ERROR(("%s: error writing 0x%08x to addr 0x%04x size %d\n",
|
||||
__FUNCTION__, data, (unsigned int)addr, size));
|
||||
return 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
bool
|
||||
bcmsdh_regfail(void *sdh)
|
||||
{
|
||||
return ((bcmsdh_info_t *)sdh)->regfail;
|
||||
}
|
||||
|
||||
int
|
||||
bcmsdh_recv_buf(void *sdh, uint32 addr, uint fn, uint flags,
|
||||
uint8 *buf, uint nbytes, void *pkt,
|
||||
bcmsdh_cmplt_fn_t complete_fn, void *handle)
|
||||
{
|
||||
bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
|
||||
SDIOH_API_RC status;
|
||||
uint incr_fix;
|
||||
uint width;
|
||||
int err = 0;
|
||||
|
||||
ASSERT(bcmsdh);
|
||||
ASSERT(bcmsdh->init_success);
|
||||
|
||||
BCMSDH_INFO(("%s:fun = %d, addr = 0x%x, size = %d\n",
|
||||
__FUNCTION__, fn, addr, nbytes));
|
||||
|
||||
/* Async not implemented yet */
|
||||
ASSERT(!(flags & SDIO_REQ_ASYNC));
|
||||
if (flags & SDIO_REQ_ASYNC)
|
||||
return BCME_UNSUPPORTED;
|
||||
|
||||
if ((err = bcmsdhsdio_set_sbaddr_window(bcmsdh, addr, FALSE)))
|
||||
return err;
|
||||
|
||||
addr &= SBSDIO_SB_OFT_ADDR_MASK;
|
||||
|
||||
incr_fix = (flags & SDIO_REQ_FIXED) ? SDIOH_DATA_FIX : SDIOH_DATA_INC;
|
||||
width = (flags & SDIO_REQ_4BYTE) ? 4 : 2;
|
||||
if (width == 4)
|
||||
addr |= SBSDIO_SB_ACCESS_2_4B_FLAG;
|
||||
|
||||
status = sdioh_request_buffer(bcmsdh->sdioh, SDIOH_DATA_PIO, incr_fix,
|
||||
SDIOH_READ, fn, addr, width, nbytes, buf, pkt);
|
||||
|
||||
return (SDIOH_API_SUCCESS(status) ? 0 : BCME_SDIO_ERROR);
|
||||
}
|
||||
|
||||
int
|
||||
bcmsdh_send_buf(void *sdh, uint32 addr, uint fn, uint flags,
|
||||
uint8 *buf, uint nbytes, void *pkt,
|
||||
bcmsdh_cmplt_fn_t complete_fn, void *handle)
|
||||
{
|
||||
bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
|
||||
SDIOH_API_RC status;
|
||||
uint incr_fix;
|
||||
uint width;
|
||||
int err = 0;
|
||||
|
||||
ASSERT(bcmsdh);
|
||||
ASSERT(bcmsdh->init_success);
|
||||
|
||||
BCMSDH_INFO(("%s:fun = %d, addr = 0x%x, size = %d\n",
|
||||
__FUNCTION__, fn, addr, nbytes));
|
||||
|
||||
/* Async not implemented yet */
|
||||
ASSERT(!(flags & SDIO_REQ_ASYNC));
|
||||
if (flags & SDIO_REQ_ASYNC)
|
||||
return BCME_UNSUPPORTED;
|
||||
|
||||
if ((err = bcmsdhsdio_set_sbaddr_window(bcmsdh, addr, FALSE)))
|
||||
return err;
|
||||
|
||||
addr &= SBSDIO_SB_OFT_ADDR_MASK;
|
||||
|
||||
incr_fix = (flags & SDIO_REQ_FIXED) ? SDIOH_DATA_FIX : SDIOH_DATA_INC;
|
||||
width = (flags & SDIO_REQ_4BYTE) ? 4 : 2;
|
||||
if (width == 4)
|
||||
addr |= SBSDIO_SB_ACCESS_2_4B_FLAG;
|
||||
|
||||
status = sdioh_request_buffer(bcmsdh->sdioh, SDIOH_DATA_PIO, incr_fix,
|
||||
SDIOH_WRITE, fn, addr, width, nbytes, buf, pkt);
|
||||
|
||||
return (SDIOH_API_SUCCESS(status) ? 0 : BCME_ERROR);
|
||||
}
|
||||
|
||||
int
|
||||
bcmsdh_rwdata(void *sdh, uint rw, uint32 addr, uint8 *buf, uint nbytes)
|
||||
{
|
||||
bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
|
||||
SDIOH_API_RC status;
|
||||
|
||||
ASSERT(bcmsdh);
|
||||
ASSERT(bcmsdh->init_success);
|
||||
ASSERT((addr & SBSDIO_SBWINDOW_MASK) == 0);
|
||||
|
||||
addr &= SBSDIO_SB_OFT_ADDR_MASK;
|
||||
addr |= SBSDIO_SB_ACCESS_2_4B_FLAG;
|
||||
|
||||
status = sdioh_request_buffer(bcmsdh->sdioh, SDIOH_DATA_PIO, SDIOH_DATA_INC,
|
||||
(rw ? SDIOH_WRITE : SDIOH_READ), SDIO_FUNC_1,
|
||||
addr, 4, nbytes, buf, NULL);
|
||||
|
||||
return (SDIOH_API_SUCCESS(status) ? 0 : BCME_ERROR);
|
||||
}
|
||||
|
||||
int
|
||||
bcmsdh_abort(void *sdh, uint fn)
|
||||
{
|
||||
bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
|
||||
|
||||
return sdioh_abort(bcmsdh->sdioh, fn);
|
||||
}
|
||||
|
||||
int
|
||||
bcmsdh_start(void *sdh, int stage)
|
||||
{
|
||||
bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
|
||||
|
||||
return sdioh_start(bcmsdh->sdioh, stage);
|
||||
}
|
||||
|
||||
int
|
||||
bcmsdh_stop(void *sdh)
|
||||
{
|
||||
bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
|
||||
|
||||
return sdioh_stop(bcmsdh->sdioh);
|
||||
}
|
||||
|
||||
int
|
||||
bcmsdh_waitlockfree(void *sdh)
|
||||
{
|
||||
bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
|
||||
|
||||
return sdioh_waitlockfree(bcmsdh->sdioh);
|
||||
}
|
||||
|
||||
int
|
||||
bcmsdh_query_device(void *sdh)
|
||||
{
|
||||
bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
|
||||
bcmsdh->vendevid = (VENDOR_BROADCOM << 16) | 0;
|
||||
return (bcmsdh->vendevid);
|
||||
}
|
||||
|
||||
uint
|
||||
bcmsdh_query_iofnum(void *sdh)
|
||||
{
|
||||
bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
|
||||
|
||||
if (!bcmsdh)
|
||||
bcmsdh = l_bcmsdh;
|
||||
|
||||
return (sdioh_query_iofnum(bcmsdh->sdioh));
|
||||
}
|
||||
|
||||
int
|
||||
bcmsdh_reset(bcmsdh_info_t *sdh)
|
||||
{
|
||||
bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
|
||||
|
||||
return sdioh_sdio_reset(bcmsdh->sdioh);
|
||||
}
|
||||
|
||||
void *bcmsdh_get_sdioh(bcmsdh_info_t *sdh)
|
||||
{
|
||||
ASSERT(sdh);
|
||||
return sdh->sdioh;
|
||||
}
|
||||
|
||||
/* Function to pass device-status bits to DHD. */
|
||||
uint32
|
||||
bcmsdh_get_dstatus(void *sdh)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
uint32
|
||||
bcmsdh_cur_sbwad(void *sdh)
|
||||
{
|
||||
bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
|
||||
|
||||
if (!bcmsdh)
|
||||
bcmsdh = l_bcmsdh;
|
||||
|
||||
return (bcmsdh->sbwad);
|
||||
}
|
||||
|
||||
/* example usage: if force is TRUE, forces the bcmsdhsdio_set_sbaddr_window to
|
||||
* calculate sbwad always instead of caching.
|
||||
*/
|
||||
void
|
||||
bcmsdh_force_sbwad_calc(void *sdh, bool force)
|
||||
{
|
||||
bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
|
||||
|
||||
if (!bcmsdh)
|
||||
bcmsdh = l_bcmsdh;
|
||||
bcmsdh->force_sbwad_calc = force;
|
||||
}
|
||||
|
||||
void
|
||||
bcmsdh_chipinfo(void *sdh, uint32 chip, uint32 chiprev)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
bcmsdh_sleep(void *sdh, bool enab)
|
||||
{
|
||||
#ifdef SDIOH_SLEEP_ENABLED
|
||||
bcmsdh_info_t *p = (bcmsdh_info_t *)sdh;
|
||||
sdioh_info_t *sd = (sdioh_info_t *)(p->sdioh);
|
||||
|
||||
return sdioh_sleep(sd, enab);
|
||||
#else
|
||||
return BCME_UNSUPPORTED;
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
bcmsdh_gpio_init(void *sdh)
|
||||
{
|
||||
bcmsdh_info_t *p = (bcmsdh_info_t *)sdh;
|
||||
sdioh_info_t *sd = (sdioh_info_t *)(p->sdioh);
|
||||
|
||||
return sdioh_gpio_init(sd);
|
||||
}
|
||||
|
||||
bool
|
||||
bcmsdh_gpioin(void *sdh, uint32 gpio)
|
||||
{
|
||||
bcmsdh_info_t *p = (bcmsdh_info_t *)sdh;
|
||||
sdioh_info_t *sd = (sdioh_info_t *)(p->sdioh);
|
||||
|
||||
return sdioh_gpioin(sd, gpio);
|
||||
}
|
||||
|
||||
int
|
||||
bcmsdh_gpioouten(void *sdh, uint32 gpio)
|
||||
{
|
||||
bcmsdh_info_t *p = (bcmsdh_info_t *)sdh;
|
||||
sdioh_info_t *sd = (sdioh_info_t *)(p->sdioh);
|
||||
|
||||
return sdioh_gpioouten(sd, gpio);
|
||||
}
|
||||
|
||||
int
|
||||
bcmsdh_gpioout(void *sdh, uint32 gpio, bool enab)
|
||||
{
|
||||
bcmsdh_info_t *p = (bcmsdh_info_t *)sdh;
|
||||
sdioh_info_t *sd = (sdioh_info_t *)(p->sdioh);
|
||||
|
||||
return sdioh_gpioout(sd, gpio, enab);
|
||||
}
|
||||
|
||||
uint
|
||||
bcmsdh_set_mode(void *sdh, uint mode)
|
||||
{
|
||||
bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
|
||||
return (sdioh_set_mode(bcmsdh->sdioh, mode));
|
||||
}
|
|
@ -0,0 +1,512 @@
|
|||
/*
|
||||
* SDIO access interface for drivers - linux specific (pci only)
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: bcmsdh_linux.c 672609 2016-11-29 07:00:46Z $
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file bcmsdh_linux.c
|
||||
*/
|
||||
|
||||
#define __UNDEF_NO_VERSION__
|
||||
|
||||
#include <typedefs.h>
|
||||
#include <linuxver.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/completion.h>
|
||||
|
||||
#include <osl.h>
|
||||
#include <pcicfg.h>
|
||||
#include <bcmdefs.h>
|
||||
#include <bcmdevs.h>
|
||||
#include <linux/irq.h>
|
||||
extern void dhdsdio_isr(void * args);
|
||||
#include <bcmutils.h>
|
||||
#include <dngl_stats.h>
|
||||
#include <dhd.h>
|
||||
#if defined(CONFIG_ARCH_ODIN)
|
||||
#include <linux/platform_data/gpio-odin.h>
|
||||
#endif /* defined(CONFIG_ARCH_ODIN) */
|
||||
#include <dhd_linux.h>
|
||||
|
||||
/* driver info, initialized when bcmsdh_register is called */
|
||||
static bcmsdh_driver_t drvinfo = {NULL, NULL, NULL, NULL};
|
||||
|
||||
typedef enum {
|
||||
DHD_INTR_INVALID = 0,
|
||||
DHD_INTR_INBAND,
|
||||
DHD_INTR_HWOOB,
|
||||
DHD_INTR_SWOOB
|
||||
} DHD_HOST_INTR_TYPE;
|
||||
|
||||
/* the BCMSDH module comprises the generic part (bcmsdh.c) and OS specific layer (e.g.
|
||||
* bcmsdh_linux.c). Put all OS specific variables (e.g. irq number and flags) here rather
|
||||
* than in the common structure bcmsdh_info. bcmsdh_info only keeps a handle (os_ctx) to this
|
||||
* structure.
|
||||
*/
|
||||
typedef struct bcmsdh_os_info {
|
||||
DHD_HOST_INTR_TYPE intr_type;
|
||||
int oob_irq_num; /* valid when hardware or software oob in use */
|
||||
unsigned long oob_irq_flags; /* valid when hardware or software oob in use */
|
||||
bool oob_irq_registered;
|
||||
bool oob_irq_enabled;
|
||||
bool oob_irq_wake_enabled;
|
||||
spinlock_t oob_irq_spinlock;
|
||||
bcmsdh_cb_fn_t oob_irq_handler;
|
||||
void *oob_irq_handler_context;
|
||||
void *context; /* context returned from upper layer */
|
||||
void *sdioh; /* handle to lower layer (sdioh) */
|
||||
void *dev; /* handle to the underlying device */
|
||||
bool dev_wake_enabled;
|
||||
} bcmsdh_os_info_t;
|
||||
|
||||
/* debugging macros */
|
||||
#define SDLX_MSG(x) printf x
|
||||
|
||||
/**
|
||||
* Checks to see if vendor and device IDs match a supported SDIO Host Controller.
|
||||
*/
|
||||
bool
|
||||
bcmsdh_chipmatch(uint16 vendor, uint16 device)
|
||||
{
|
||||
/* Add other vendors and devices as required */
|
||||
|
||||
#ifdef BCMSDIOH_STD
|
||||
/* Check for Arasan host controller */
|
||||
if (vendor == VENDOR_SI_IMAGE) {
|
||||
return (TRUE);
|
||||
}
|
||||
/* Check for BRCM 27XX Standard host controller */
|
||||
if (device == BCM27XX_SDIOH_ID && vendor == VENDOR_BROADCOM) {
|
||||
return (TRUE);
|
||||
}
|
||||
/* Check for BRCM Standard host controller */
|
||||
if (device == SDIOH_FPGA_ID && vendor == VENDOR_BROADCOM) {
|
||||
return (TRUE);
|
||||
}
|
||||
/* Check for TI PCIxx21 Standard host controller */
|
||||
if (device == PCIXX21_SDIOH_ID && vendor == VENDOR_TI) {
|
||||
return (TRUE);
|
||||
}
|
||||
if (device == PCIXX21_SDIOH0_ID && vendor == VENDOR_TI) {
|
||||
return (TRUE);
|
||||
}
|
||||
/* Ricoh R5C822 Standard SDIO Host */
|
||||
if (device == R5C822_SDIOH_ID && vendor == VENDOR_RICOH) {
|
||||
return (TRUE);
|
||||
}
|
||||
/* JMicron Standard SDIO Host */
|
||||
if (device == JMICRON_SDIOH_ID && vendor == VENDOR_JMICRON) {
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
#endif /* BCMSDIOH_STD */
|
||||
#ifdef BCMSDIOH_SPI
|
||||
/* This is the PciSpiHost. */
|
||||
if (device == SPIH_FPGA_ID && vendor == VENDOR_BROADCOM) {
|
||||
printf("Found PCI SPI Host Controller\n");
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
#endif /* BCMSDIOH_SPI */
|
||||
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
void* bcmsdh_probe(osl_t *osh, void *dev, void *sdioh, void *adapter_info, uint bus_type,
|
||||
uint bus_num, uint slot_num)
|
||||
{
|
||||
ulong regs;
|
||||
bcmsdh_info_t *bcmsdh;
|
||||
uint32 vendevid;
|
||||
bcmsdh_os_info_t *bcmsdh_osinfo = NULL;
|
||||
|
||||
bcmsdh = bcmsdh_attach(osh, sdioh, ®s);
|
||||
if (bcmsdh == NULL) {
|
||||
SDLX_MSG(("%s: bcmsdh_attach failed\n", __FUNCTION__));
|
||||
goto err;
|
||||
}
|
||||
bcmsdh_osinfo = MALLOC(osh, sizeof(bcmsdh_os_info_t));
|
||||
if (bcmsdh_osinfo == NULL) {
|
||||
SDLX_MSG(("%s: failed to allocate bcmsdh_os_info_t\n", __FUNCTION__));
|
||||
goto err;
|
||||
}
|
||||
bzero((char *)bcmsdh_osinfo, sizeof(bcmsdh_os_info_t));
|
||||
bcmsdh->os_cxt = bcmsdh_osinfo;
|
||||
bcmsdh_osinfo->sdioh = sdioh;
|
||||
bcmsdh_osinfo->dev = dev;
|
||||
osl_set_bus_handle(osh, bcmsdh);
|
||||
|
||||
#if !defined(CONFIG_HAS_WAKELOCK) && (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 36))
|
||||
if (dev && device_init_wakeup(dev, true) == 0)
|
||||
bcmsdh_osinfo->dev_wake_enabled = TRUE;
|
||||
#endif /* !defined(CONFIG_HAS_WAKELOCK) && (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 36)) */
|
||||
|
||||
#if defined(OOB_INTR_ONLY)
|
||||
spin_lock_init(&bcmsdh_osinfo->oob_irq_spinlock);
|
||||
/* Get customer specific OOB IRQ parametres: IRQ number as IRQ type */
|
||||
bcmsdh_osinfo->oob_irq_num = wifi_platform_get_irq_number(adapter_info,
|
||||
&bcmsdh_osinfo->oob_irq_flags);
|
||||
if (bcmsdh_osinfo->oob_irq_num < 0) {
|
||||
SDLX_MSG(("%s: Host OOB irq is not defined\n", __FUNCTION__));
|
||||
goto err;
|
||||
}
|
||||
#endif /* defined(BCMLXSDMMC) */
|
||||
|
||||
/* Read the vendor/device ID from the CIS */
|
||||
vendevid = bcmsdh_query_device(bcmsdh);
|
||||
/* try to attach to the target device */
|
||||
bcmsdh_osinfo->context = drvinfo.probe((vendevid >> 16), (vendevid & 0xFFFF), bus_num,
|
||||
slot_num, 0, bus_type, (void *)regs, osh, bcmsdh);
|
||||
if (bcmsdh_osinfo->context == NULL) {
|
||||
SDLX_MSG(("%s: device attach failed\n", __FUNCTION__));
|
||||
goto err;
|
||||
}
|
||||
|
||||
return bcmsdh;
|
||||
|
||||
/* error handling */
|
||||
err:
|
||||
if (bcmsdh != NULL)
|
||||
bcmsdh_detach(osh, bcmsdh);
|
||||
if (bcmsdh_osinfo != NULL)
|
||||
MFREE(osh, bcmsdh_osinfo, sizeof(bcmsdh_os_info_t));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int bcmsdh_remove(bcmsdh_info_t *bcmsdh)
|
||||
{
|
||||
bcmsdh_os_info_t *bcmsdh_osinfo = bcmsdh->os_cxt;
|
||||
|
||||
#if !defined(CONFIG_HAS_WAKELOCK) && (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 36))
|
||||
if (bcmsdh_osinfo->dev)
|
||||
device_init_wakeup(bcmsdh_osinfo->dev, false);
|
||||
bcmsdh_osinfo->dev_wake_enabled = FALSE;
|
||||
#endif /* !defined(CONFIG_HAS_WAKELOCK) && (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 36)) */
|
||||
|
||||
drvinfo.remove(bcmsdh_osinfo->context);
|
||||
MFREE(bcmsdh->osh, bcmsdh->os_cxt, sizeof(bcmsdh_os_info_t));
|
||||
bcmsdh_detach(bcmsdh->osh, bcmsdh);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef DHD_WAKE_STATUS
|
||||
int bcmsdh_get_total_wake(bcmsdh_info_t *bcmsdh)
|
||||
{
|
||||
return bcmsdh->total_wake_count;
|
||||
}
|
||||
|
||||
int bcmsdh_set_get_wake(bcmsdh_info_t *bcmsdh, int flag)
|
||||
{
|
||||
bcmsdh_os_info_t *bcmsdh_osinfo = bcmsdh->os_cxt;
|
||||
unsigned long flags;
|
||||
int ret;
|
||||
|
||||
spin_lock_irqsave(&bcmsdh_osinfo->oob_irq_spinlock, flags);
|
||||
|
||||
ret = bcmsdh->pkt_wake;
|
||||
bcmsdh->total_wake_count += flag;
|
||||
bcmsdh->pkt_wake = flag;
|
||||
|
||||
spin_unlock_irqrestore(&bcmsdh_osinfo->oob_irq_spinlock, flags);
|
||||
return ret;
|
||||
}
|
||||
#endif /* DHD_WAKE_STATUS */
|
||||
|
||||
int bcmsdh_suspend(bcmsdh_info_t *bcmsdh)
|
||||
{
|
||||
bcmsdh_os_info_t *bcmsdh_osinfo = bcmsdh->os_cxt;
|
||||
|
||||
if (drvinfo.suspend && drvinfo.suspend(bcmsdh_osinfo->context))
|
||||
return -EBUSY;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int bcmsdh_resume(bcmsdh_info_t *bcmsdh)
|
||||
{
|
||||
bcmsdh_os_info_t *bcmsdh_osinfo = bcmsdh->os_cxt;
|
||||
|
||||
if (drvinfo.resume)
|
||||
return drvinfo.resume(bcmsdh_osinfo->context);
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern int bcmsdh_register_client_driver(void);
|
||||
extern void bcmsdh_unregister_client_driver(void);
|
||||
extern int sdio_func_reg_notify(void* semaphore);
|
||||
extern void sdio_func_unreg_notify(void);
|
||||
|
||||
#if defined(BCMLXSDMMC)
|
||||
int bcmsdh_reg_sdio_notify(void* semaphore)
|
||||
{
|
||||
return sdio_func_reg_notify(semaphore);
|
||||
}
|
||||
|
||||
void bcmsdh_unreg_sdio_notify(void)
|
||||
{
|
||||
sdio_func_unreg_notify();
|
||||
}
|
||||
#endif /* defined(BCMLXSDMMC) */
|
||||
|
||||
int
|
||||
bcmsdh_register(bcmsdh_driver_t *driver)
|
||||
{
|
||||
int error = 0;
|
||||
|
||||
drvinfo = *driver;
|
||||
SDLX_MSG(("%s: register client driver\n", __FUNCTION__));
|
||||
error = bcmsdh_register_client_driver();
|
||||
if (error)
|
||||
SDLX_MSG(("%s: failed %d\n", __FUNCTION__, error));
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
void
|
||||
bcmsdh_unregister(void)
|
||||
{
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0))
|
||||
if (bcmsdh_pci_driver.node.next == NULL)
|
||||
return;
|
||||
#endif
|
||||
|
||||
bcmsdh_unregister_client_driver();
|
||||
}
|
||||
|
||||
void bcmsdh_dev_pm_stay_awake(bcmsdh_info_t *bcmsdh)
|
||||
{
|
||||
#if !defined(CONFIG_HAS_WAKELOCK) && (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 36))
|
||||
bcmsdh_os_info_t *bcmsdh_osinfo = bcmsdh->os_cxt;
|
||||
pm_stay_awake(bcmsdh_osinfo->dev);
|
||||
#endif /* !defined(CONFIG_HAS_WAKELOCK) && (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 36)) */
|
||||
}
|
||||
|
||||
void bcmsdh_dev_relax(bcmsdh_info_t *bcmsdh)
|
||||
{
|
||||
#if !defined(CONFIG_HAS_WAKELOCK) && (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 36))
|
||||
bcmsdh_os_info_t *bcmsdh_osinfo = bcmsdh->os_cxt;
|
||||
pm_relax(bcmsdh_osinfo->dev);
|
||||
#endif /* !defined(CONFIG_HAS_WAKELOCK) && (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 36)) */
|
||||
}
|
||||
|
||||
bool bcmsdh_dev_pm_enabled(bcmsdh_info_t *bcmsdh)
|
||||
{
|
||||
bcmsdh_os_info_t *bcmsdh_osinfo = bcmsdh->os_cxt;
|
||||
|
||||
return bcmsdh_osinfo->dev_wake_enabled;
|
||||
}
|
||||
|
||||
#if defined(OOB_INTR_ONLY)
|
||||
void bcmsdh_oob_intr_set(bcmsdh_info_t *bcmsdh, bool enable)
|
||||
{
|
||||
unsigned long flags;
|
||||
bcmsdh_os_info_t *bcmsdh_osinfo;
|
||||
|
||||
if (!bcmsdh)
|
||||
return;
|
||||
|
||||
bcmsdh_osinfo = bcmsdh->os_cxt;
|
||||
spin_lock_irqsave(&bcmsdh_osinfo->oob_irq_spinlock, flags);
|
||||
if (bcmsdh_osinfo->oob_irq_enabled != enable) {
|
||||
if (enable)
|
||||
enable_irq(bcmsdh_osinfo->oob_irq_num);
|
||||
else
|
||||
disable_irq_nosync(bcmsdh_osinfo->oob_irq_num);
|
||||
bcmsdh_osinfo->oob_irq_enabled = enable;
|
||||
}
|
||||
spin_unlock_irqrestore(&bcmsdh_osinfo->oob_irq_spinlock, flags);
|
||||
}
|
||||
|
||||
static irqreturn_t wlan_oob_irq(int irq, void *dev_id)
|
||||
{
|
||||
bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)dev_id;
|
||||
bcmsdh_os_info_t *bcmsdh_osinfo = bcmsdh->os_cxt;
|
||||
|
||||
bcmsdh_oob_intr_set(bcmsdh, FALSE);
|
||||
bcmsdh_osinfo->oob_irq_handler(bcmsdh_osinfo->oob_irq_handler_context);
|
||||
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
int bcmsdh_oob_intr_register(bcmsdh_info_t *bcmsdh, bcmsdh_cb_fn_t oob_irq_handler,
|
||||
void* oob_irq_handler_context)
|
||||
{
|
||||
int err = 0;
|
||||
bcmsdh_os_info_t *bcmsdh_osinfo = bcmsdh->os_cxt;
|
||||
|
||||
if (bcmsdh_osinfo->oob_irq_registered) {
|
||||
SDLX_MSG(("%s: irq is already registered\n", __FUNCTION__));
|
||||
return -EBUSY;
|
||||
}
|
||||
#ifdef HW_OOB
|
||||
printf("%s: HW_OOB irq=%d flags=0x%X\n", __FUNCTION__,
|
||||
(int)bcmsdh_osinfo->oob_irq_num, (int)bcmsdh_osinfo->oob_irq_flags);
|
||||
#else
|
||||
printf("%s: SW_OOB irq=%d flags=0x%X\n", __FUNCTION__,
|
||||
(int)bcmsdh_osinfo->oob_irq_num, (int)bcmsdh_osinfo->oob_irq_flags);
|
||||
#endif
|
||||
bcmsdh_osinfo->oob_irq_handler = oob_irq_handler;
|
||||
bcmsdh_osinfo->oob_irq_handler_context = oob_irq_handler_context;
|
||||
bcmsdh_osinfo->oob_irq_enabled = TRUE;
|
||||
bcmsdh_osinfo->oob_irq_registered = TRUE;
|
||||
#if defined(CONFIG_ARCH_ODIN)
|
||||
err = odin_gpio_sms_request_irq(bcmsdh_osinfo->oob_irq_num, wlan_oob_irq,
|
||||
bcmsdh_osinfo->oob_irq_flags, "bcmsdh_sdmmc", bcmsdh);
|
||||
#else
|
||||
err = request_irq(bcmsdh_osinfo->oob_irq_num, wlan_oob_irq,
|
||||
bcmsdh_osinfo->oob_irq_flags, "bcmsdh_sdmmc", bcmsdh);
|
||||
#endif /* defined(CONFIG_ARCH_ODIN) */
|
||||
if (err) {
|
||||
SDLX_MSG(("%s: request_irq failed with %d\n", __FUNCTION__, err));
|
||||
bcmsdh_osinfo->oob_irq_enabled = FALSE;
|
||||
bcmsdh_osinfo->oob_irq_registered = FALSE;
|
||||
return err;
|
||||
}
|
||||
|
||||
#if defined(DISABLE_WOWLAN)
|
||||
SDLX_MSG(("%s: disable_irq_wake\n", __FUNCTION__));
|
||||
bcmsdh_osinfo->oob_irq_wake_enabled = FALSE;
|
||||
#else
|
||||
err = enable_irq_wake(bcmsdh_osinfo->oob_irq_num);
|
||||
if (err)
|
||||
SDLX_MSG(("%s: enable_irq_wake failed with %d\n", __FUNCTION__, err));
|
||||
else
|
||||
bcmsdh_osinfo->oob_irq_wake_enabled = TRUE;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void bcmsdh_oob_intr_unregister(bcmsdh_info_t *bcmsdh)
|
||||
{
|
||||
int err = 0;
|
||||
bcmsdh_os_info_t *bcmsdh_osinfo = bcmsdh->os_cxt;
|
||||
|
||||
SDLX_MSG(("%s: Enter\n", __FUNCTION__));
|
||||
if (!bcmsdh_osinfo->oob_irq_registered) {
|
||||
SDLX_MSG(("%s: irq is not registered\n", __FUNCTION__));
|
||||
return;
|
||||
}
|
||||
if (bcmsdh_osinfo->oob_irq_wake_enabled) {
|
||||
err = disable_irq_wake(bcmsdh_osinfo->oob_irq_num);
|
||||
if (!err)
|
||||
bcmsdh_osinfo->oob_irq_wake_enabled = FALSE;
|
||||
}
|
||||
if (bcmsdh_osinfo->oob_irq_enabled) {
|
||||
disable_irq(bcmsdh_osinfo->oob_irq_num);
|
||||
bcmsdh_osinfo->oob_irq_enabled = FALSE;
|
||||
}
|
||||
free_irq(bcmsdh_osinfo->oob_irq_num, bcmsdh);
|
||||
bcmsdh_osinfo->oob_irq_registered = FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Module parameters specific to each host-controller driver */
|
||||
|
||||
extern uint sd_msglevel; /* Debug message level */
|
||||
module_param(sd_msglevel, uint, 0);
|
||||
|
||||
extern uint sd_power; /* 0 = SD Power OFF, 1 = SD Power ON. */
|
||||
module_param(sd_power, uint, 0);
|
||||
|
||||
extern uint sd_clock; /* SD Clock Control, 0 = SD Clock OFF, 1 = SD Clock ON */
|
||||
module_param(sd_clock, uint, 0);
|
||||
|
||||
extern uint sd_divisor; /* Divisor (-1 means external clock) */
|
||||
module_param(sd_divisor, uint, 0);
|
||||
|
||||
extern uint sd_sdmode; /* Default is SD4, 0=SPI, 1=SD1, 2=SD4 */
|
||||
module_param(sd_sdmode, uint, 0);
|
||||
|
||||
extern uint sd_hiok; /* Ok to use hi-speed mode */
|
||||
module_param(sd_hiok, uint, 0);
|
||||
|
||||
extern uint sd_f2_blocksize;
|
||||
module_param(sd_f2_blocksize, int, 0);
|
||||
|
||||
extern uint sd_f1_blocksize;
|
||||
module_param(sd_f1_blocksize, int, 0);
|
||||
|
||||
#ifdef BCMSDIOH_STD
|
||||
extern int sd_uhsimode;
|
||||
module_param(sd_uhsimode, int, 0);
|
||||
extern uint sd_tuning_period;
|
||||
module_param(sd_tuning_period, uint, 0);
|
||||
extern int sd_delay_value;
|
||||
module_param(sd_delay_value, uint, 0);
|
||||
|
||||
/* SDIO Drive Strength for UHSI mode specific to SDIO3.0 */
|
||||
extern char dhd_sdiod_uhsi_ds_override[2];
|
||||
module_param_string(dhd_sdiod_uhsi_ds_override, dhd_sdiod_uhsi_ds_override, 2, 0);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef BCMSDH_MODULE
|
||||
EXPORT_SYMBOL(bcmsdh_attach);
|
||||
EXPORT_SYMBOL(bcmsdh_detach);
|
||||
EXPORT_SYMBOL(bcmsdh_intr_query);
|
||||
EXPORT_SYMBOL(bcmsdh_intr_enable);
|
||||
EXPORT_SYMBOL(bcmsdh_intr_disable);
|
||||
EXPORT_SYMBOL(bcmsdh_intr_reg);
|
||||
EXPORT_SYMBOL(bcmsdh_intr_dereg);
|
||||
|
||||
#if defined(DHD_DEBUG)
|
||||
EXPORT_SYMBOL(bcmsdh_intr_pending);
|
||||
#endif
|
||||
|
||||
#if defined(BT_OVER_SDIO)
|
||||
EXPORT_SYMBOL(bcmsdh_btsdio_interface_init);
|
||||
#endif /* defined (BT_OVER_SDIO) */
|
||||
|
||||
EXPORT_SYMBOL(bcmsdh_devremove_reg);
|
||||
EXPORT_SYMBOL(bcmsdh_cfg_read);
|
||||
EXPORT_SYMBOL(bcmsdh_cfg_write);
|
||||
EXPORT_SYMBOL(bcmsdh_cis_read);
|
||||
EXPORT_SYMBOL(bcmsdh_reg_read);
|
||||
EXPORT_SYMBOL(bcmsdh_reg_write);
|
||||
EXPORT_SYMBOL(bcmsdh_regfail);
|
||||
EXPORT_SYMBOL(bcmsdh_send_buf);
|
||||
EXPORT_SYMBOL(bcmsdh_recv_buf);
|
||||
|
||||
EXPORT_SYMBOL(bcmsdh_rwdata);
|
||||
EXPORT_SYMBOL(bcmsdh_abort);
|
||||
EXPORT_SYMBOL(bcmsdh_query_device);
|
||||
EXPORT_SYMBOL(bcmsdh_query_iofnum);
|
||||
EXPORT_SYMBOL(bcmsdh_iovar_op);
|
||||
EXPORT_SYMBOL(bcmsdh_register);
|
||||
EXPORT_SYMBOL(bcmsdh_unregister);
|
||||
EXPORT_SYMBOL(bcmsdh_chipmatch);
|
||||
EXPORT_SYMBOL(bcmsdh_reset);
|
||||
EXPORT_SYMBOL(bcmsdh_waitlockfree);
|
||||
|
||||
EXPORT_SYMBOL(bcmsdh_get_dstatus);
|
||||
EXPORT_SYMBOL(bcmsdh_cfg_read_word);
|
||||
EXPORT_SYMBOL(bcmsdh_cfg_write_word);
|
||||
EXPORT_SYMBOL(bcmsdh_cur_sbwad);
|
||||
EXPORT_SYMBOL(bcmsdh_chipinfo);
|
||||
|
||||
#endif /* BCMSDH_MODULE */
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,416 @@
|
|||
/*
|
||||
* BCMSDH Function Driver for the native SDIO/MMC driver in the Linux Kernel
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Proprietary,Open:>>
|
||||
*
|
||||
* $Id: bcmsdh_sdmmc_linux.c 644124 2016-06-17 07:59:34Z $
|
||||
*/
|
||||
|
||||
#include <typedefs.h>
|
||||
#include <bcmutils.h>
|
||||
#include <sdio.h> /* SDIO Device and Protocol Specs */
|
||||
#include <bcmsdbus.h> /* bcmsdh to/from specific controller APIs */
|
||||
#include <sdiovar.h> /* to get msglevel bit values */
|
||||
|
||||
#include <linux/sched.h> /* request_irq() */
|
||||
|
||||
#include <linux/mmc/core.h>
|
||||
#include <linux/mmc/card.h>
|
||||
#include <linux/mmc/host.h>
|
||||
#include <linux/mmc/sdio_func.h>
|
||||
#include <linux/mmc/sdio_ids.h>
|
||||
#include <dhd_linux.h>
|
||||
#include <bcmsdh_sdmmc.h>
|
||||
#include <dhd_dbg.h>
|
||||
|
||||
#if !defined(SDIO_VENDOR_ID_BROADCOM)
|
||||
#define SDIO_VENDOR_ID_BROADCOM 0x02d0
|
||||
#endif /* !defined(SDIO_VENDOR_ID_BROADCOM) */
|
||||
|
||||
#define SDIO_DEVICE_ID_BROADCOM_DEFAULT 0x0000
|
||||
|
||||
#if !defined(SDIO_DEVICE_ID_BROADCOM_4325_SDGWB)
|
||||
#define SDIO_DEVICE_ID_BROADCOM_4325_SDGWB 0x0492 /* BCM94325SDGWB */
|
||||
#endif /* !defined(SDIO_DEVICE_ID_BROADCOM_4325_SDGWB) */
|
||||
#if !defined(SDIO_DEVICE_ID_BROADCOM_4325)
|
||||
#define SDIO_DEVICE_ID_BROADCOM_4325 0x0493
|
||||
#endif /* !defined(SDIO_DEVICE_ID_BROADCOM_4325) */
|
||||
#if !defined(SDIO_DEVICE_ID_BROADCOM_4329)
|
||||
#define SDIO_DEVICE_ID_BROADCOM_4329 0x4329
|
||||
#endif /* !defined(SDIO_DEVICE_ID_BROADCOM_4329) */
|
||||
#if !defined(SDIO_DEVICE_ID_BROADCOM_4319)
|
||||
#define SDIO_DEVICE_ID_BROADCOM_4319 0x4319
|
||||
#endif /* !defined(SDIO_DEVICE_ID_BROADCOM_4319) */
|
||||
#if !defined(SDIO_DEVICE_ID_BROADCOM_4330)
|
||||
#define SDIO_DEVICE_ID_BROADCOM_4330 0x4330
|
||||
#endif /* !defined(SDIO_DEVICE_ID_BROADCOM_4330) */
|
||||
#if !defined(SDIO_DEVICE_ID_BROADCOM_4334)
|
||||
#define SDIO_DEVICE_ID_BROADCOM_4334 0x4334
|
||||
#endif /* !defined(SDIO_DEVICE_ID_BROADCOM_4334) */
|
||||
#if !defined(SDIO_DEVICE_ID_BROADCOM_4324)
|
||||
#define SDIO_DEVICE_ID_BROADCOM_4324 0x4324
|
||||
#endif /* !defined(SDIO_DEVICE_ID_BROADCOM_4324) */
|
||||
#if !defined(SDIO_DEVICE_ID_BROADCOM_43239)
|
||||
#define SDIO_DEVICE_ID_BROADCOM_43239 43239
|
||||
#endif /* !defined(SDIO_DEVICE_ID_BROADCOM_43239) */
|
||||
|
||||
/* Method in imx mmc host controller driver to check if the wifi mmc host has been initiated */
|
||||
/* extern bool wifi_mmc_host_initiated(void); */
|
||||
|
||||
extern void wl_cfg80211_set_parent_dev(void *dev);
|
||||
extern void sdioh_sdmmc_devintr_off(sdioh_info_t *sd);
|
||||
extern void sdioh_sdmmc_devintr_on(sdioh_info_t *sd);
|
||||
extern void* bcmsdh_probe(osl_t *osh, void *dev, void *sdioh, void *adapter_info, uint bus_type,
|
||||
uint bus_num, uint slot_num);
|
||||
extern int bcmsdh_remove(bcmsdh_info_t *bcmsdh);
|
||||
|
||||
int sdio_function_init(void);
|
||||
void sdio_function_cleanup(void);
|
||||
|
||||
#define DESCRIPTION "bcmsdh_sdmmc Driver"
|
||||
#define AUTHOR "Broadcom Corporation"
|
||||
|
||||
/* module param defaults */
|
||||
static int clockoverride = 0;
|
||||
|
||||
module_param(clockoverride, int, 0644);
|
||||
MODULE_PARM_DESC(clockoverride, "SDIO card clock override");
|
||||
|
||||
#ifdef GLOBAL_SDMMC_INSTANCE
|
||||
PBCMSDH_SDMMC_INSTANCE gInstance;
|
||||
#endif
|
||||
|
||||
/* Maximum number of bcmsdh_sdmmc devices supported by driver */
|
||||
#define BCMSDH_SDMMC_MAX_DEVICES 1
|
||||
|
||||
extern volatile bool dhd_mmc_suspend;
|
||||
|
||||
static int sdioh_probe(struct sdio_func *func)
|
||||
{
|
||||
int host_idx = func->card->host->index;
|
||||
uint32 rca = func->card->rca;
|
||||
wifi_adapter_info_t *adapter;
|
||||
osl_t *osh = NULL;
|
||||
sdioh_info_t *sdioh = NULL;
|
||||
|
||||
printk("[---- SBA ----] sdioh_probe Enter\n");
|
||||
/*if(!wifi_mmc_host_initiated()) {
|
||||
printk("[---- SBA ----] Wifi MMC host is not initiated, deferring probe/initiation until later..\n");
|
||||
return -EPROBE_DEFER;
|
||||
}*/
|
||||
|
||||
sd_err(("bus num (host idx)=%d, slot num (rca)=%d\n", host_idx, rca));
|
||||
adapter = dhd_wifi_platform_get_adapter(SDIO_BUS, host_idx, rca);
|
||||
if (adapter != NULL) {
|
||||
sd_err(("found adapter info '%s'\n", adapter->name));
|
||||
#ifdef BUS_POWER_RESTORE
|
||||
adapter->sdio_func = func;
|
||||
#endif
|
||||
} else
|
||||
sd_err(("can't find adapter info for this chip\n"));
|
||||
|
||||
#ifdef WL_CFG80211
|
||||
wl_cfg80211_set_parent_dev(&func->dev);
|
||||
#endif
|
||||
|
||||
/* allocate SDIO Host Controller state info */
|
||||
osh = osl_attach(&func->dev, SDIO_BUS, TRUE);
|
||||
if (osh == NULL) {
|
||||
sd_err(("%s: osl_attach failed\n", __FUNCTION__));
|
||||
goto fail;
|
||||
}
|
||||
osl_static_mem_init(osh, adapter);
|
||||
sdioh = sdioh_attach(osh, func);
|
||||
if (sdioh == NULL) {
|
||||
sd_err(("%s: sdioh_attach failed\n", __FUNCTION__));
|
||||
goto fail;
|
||||
}
|
||||
sdioh->bcmsdh = bcmsdh_probe(osh, &func->dev, sdioh, adapter, SDIO_BUS, host_idx, rca);
|
||||
if (sdioh->bcmsdh == NULL) {
|
||||
sd_err(("%s: bcmsdh_probe failed\n", __FUNCTION__));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
sdio_set_drvdata(func, sdioh);
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
if (sdioh != NULL)
|
||||
sdioh_detach(osh, sdioh);
|
||||
if (osh != NULL)
|
||||
osl_detach(osh);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
static void sdioh_remove(struct sdio_func *func)
|
||||
{
|
||||
sdioh_info_t *sdioh;
|
||||
osl_t *osh;
|
||||
|
||||
sdioh = sdio_get_drvdata(func);
|
||||
if (sdioh == NULL) {
|
||||
sd_err(("%s: error, no sdioh handler found\n", __FUNCTION__));
|
||||
return;
|
||||
}
|
||||
sd_err(("%s: Enter\n", __FUNCTION__));
|
||||
|
||||
osh = sdioh->osh;
|
||||
bcmsdh_remove(sdioh->bcmsdh);
|
||||
sdioh_detach(osh, sdioh);
|
||||
osl_detach(osh);
|
||||
}
|
||||
|
||||
static int bcmsdh_sdmmc_probe(struct sdio_func *func,
|
||||
const struct sdio_device_id *id)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (func == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
printk("[---- SBA ----] bcmsdh_sdmmc_probe Enter\n");
|
||||
|
||||
sd_err(("%s: Enter num=%d\n", __FUNCTION__, func->num));
|
||||
sd_info(("sdio_bcmsdh: func->class=%x\n", func->class));
|
||||
sd_info(("sdio_vendor: 0x%04x\n", func->vendor));
|
||||
sd_info(("sdio_device: 0x%04x\n", func->device));
|
||||
sd_info(("Function#: 0x%04x\n", func->num));
|
||||
|
||||
#ifdef GLOBAL_SDMMC_INSTANCE
|
||||
gInstance->func[func->num] = func;
|
||||
#endif
|
||||
|
||||
/* 4318 doesn't have function 2 */
|
||||
if ((func->num == 2) || (func->num == 1 && func->device == 0x4))
|
||||
ret = sdioh_probe(func);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void bcmsdh_sdmmc_remove(struct sdio_func *func)
|
||||
{
|
||||
if (func == NULL) {
|
||||
sd_err(("%s is called with NULL SDIO function pointer\n", __FUNCTION__));
|
||||
return;
|
||||
}
|
||||
|
||||
sd_trace(("bcmsdh_sdmmc: %s Enter\n", __FUNCTION__));
|
||||
sd_info(("sdio_bcmsdh: func->class=%x\n", func->class));
|
||||
sd_info(("sdio_vendor: 0x%04x\n", func->vendor));
|
||||
sd_info(("sdio_device: 0x%04x\n", func->device));
|
||||
sd_info(("Function#: 0x%04x\n", func->num));
|
||||
|
||||
if ((func->num == 2) || (func->num == 1 && func->device == 0x4))
|
||||
sdioh_remove(func);
|
||||
}
|
||||
|
||||
/* devices we support, null terminated */
|
||||
static const struct sdio_device_id bcmsdh_sdmmc_ids[] = {
|
||||
{ SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_DEFAULT) },
|
||||
{ SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4325_SDGWB) },
|
||||
{ SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4325) },
|
||||
{ SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4329) },
|
||||
{ SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4319) },
|
||||
{ SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4330) },
|
||||
{ SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4334) },
|
||||
{ SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4324) },
|
||||
{ SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_43239) },
|
||||
{ SDIO_DEVICE_CLASS(SDIO_CLASS_NONE) },
|
||||
{ 0, 0, 0, 0 /* end: all zeroes */
|
||||
},
|
||||
};
|
||||
|
||||
MODULE_DEVICE_TABLE(sdio, bcmsdh_sdmmc_ids);
|
||||
|
||||
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)) && defined(CONFIG_PM)
|
||||
static int bcmsdh_sdmmc_suspend(struct device *pdev)
|
||||
{
|
||||
int err;
|
||||
sdioh_info_t *sdioh;
|
||||
struct sdio_func *func = dev_to_sdio_func(pdev);
|
||||
mmc_pm_flag_t sdio_flags;
|
||||
|
||||
printf("%s Enter func->num=%d\n", __FUNCTION__, func->num);
|
||||
if (func->num != 2)
|
||||
return 0;
|
||||
|
||||
dhd_mmc_suspend = TRUE;
|
||||
sdioh = sdio_get_drvdata(func);
|
||||
err = bcmsdh_suspend(sdioh->bcmsdh);
|
||||
if (err) {
|
||||
printf("%s bcmsdh_suspend err=%d\n", __FUNCTION__, err);
|
||||
dhd_mmc_suspend = FALSE;
|
||||
return err;
|
||||
}
|
||||
|
||||
sdio_flags = sdio_get_host_pm_caps(func);
|
||||
if (!(sdio_flags & MMC_PM_KEEP_POWER)) {
|
||||
sd_err(("%s: can't keep power while host is suspended\n", __FUNCTION__));
|
||||
dhd_mmc_suspend = FALSE;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* keep power while host suspended */
|
||||
err = sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER);
|
||||
if (err) {
|
||||
sd_err(("%s: error while trying to keep power\n", __FUNCTION__));
|
||||
dhd_mmc_suspend = FALSE;
|
||||
return err;
|
||||
}
|
||||
smp_mb();
|
||||
|
||||
printf("%s Exit\n", __FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bcmsdh_sdmmc_resume(struct device *pdev)
|
||||
{
|
||||
sdioh_info_t *sdioh;
|
||||
struct sdio_func *func = dev_to_sdio_func(pdev);
|
||||
|
||||
printf("%s Enter func->num=%d\n", __FUNCTION__, func->num);
|
||||
if (func->num != 2)
|
||||
return 0;
|
||||
|
||||
dhd_mmc_suspend = FALSE;
|
||||
sdioh = sdio_get_drvdata(func);
|
||||
bcmsdh_resume(sdioh->bcmsdh);
|
||||
|
||||
smp_mb();
|
||||
printf("%s Exit\n", __FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct dev_pm_ops bcmsdh_sdmmc_pm_ops = {
|
||||
.suspend = bcmsdh_sdmmc_suspend,
|
||||
.resume = bcmsdh_sdmmc_resume,
|
||||
};
|
||||
#endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)) && defined(CONFIG_PM) */
|
||||
|
||||
#if defined(BCMLXSDMMC)
|
||||
static struct semaphore *notify_semaphore = NULL;
|
||||
|
||||
static int dummy_probe(struct sdio_func *func,
|
||||
const struct sdio_device_id *id)
|
||||
{
|
||||
if (func && (func->num != 2)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (notify_semaphore)
|
||||
up(notify_semaphore);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void dummy_remove(struct sdio_func *func)
|
||||
{
|
||||
}
|
||||
|
||||
static struct sdio_driver dummy_sdmmc_driver = {
|
||||
.probe = dummy_probe,
|
||||
.remove = dummy_remove,
|
||||
.name = "dummy_sdmmc",
|
||||
.id_table = bcmsdh_sdmmc_ids,
|
||||
};
|
||||
|
||||
int sdio_func_reg_notify(void* semaphore)
|
||||
{
|
||||
notify_semaphore = semaphore;
|
||||
return sdio_register_driver(&dummy_sdmmc_driver);
|
||||
}
|
||||
|
||||
void sdio_func_unreg_notify(void)
|
||||
{
|
||||
OSL_SLEEP(15);
|
||||
sdio_unregister_driver(&dummy_sdmmc_driver);
|
||||
}
|
||||
|
||||
#endif /* defined(BCMLXSDMMC) */
|
||||
|
||||
static struct sdio_driver bcmsdh_sdmmc_driver = {
|
||||
.probe = bcmsdh_sdmmc_probe,
|
||||
.remove = bcmsdh_sdmmc_remove,
|
||||
.name = "bcmsdh_sdmmc",
|
||||
.id_table = bcmsdh_sdmmc_ids,
|
||||
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)) && defined(CONFIG_PM)
|
||||
.drv = {
|
||||
.pm = &bcmsdh_sdmmc_pm_ops,
|
||||
},
|
||||
#endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)) && defined(CONFIG_PM) */
|
||||
};
|
||||
|
||||
struct sdos_info {
|
||||
sdioh_info_t *sd;
|
||||
spinlock_t lock;
|
||||
};
|
||||
|
||||
/* Interrupt enable/disable */
|
||||
SDIOH_API_RC
|
||||
sdioh_interrupt_set(sdioh_info_t *sd, bool enable)
|
||||
{
|
||||
if (!sd)
|
||||
return BCME_BADARG;
|
||||
|
||||
sd_trace(("%s: %s\n", __FUNCTION__, enable ? "Enabling" : "Disabling"));
|
||||
return SDIOH_API_RC_SUCCESS;
|
||||
}
|
||||
|
||||
#ifdef BCMSDH_MODULE
|
||||
static int __init
|
||||
bcmsdh_module_init(void)
|
||||
{
|
||||
int error = 0;
|
||||
error = sdio_function_init();
|
||||
return error;
|
||||
}
|
||||
|
||||
static void __exit
|
||||
bcmsdh_module_cleanup(void)
|
||||
{
|
||||
sdio_function_cleanup();
|
||||
}
|
||||
|
||||
module_init(bcmsdh_module_init);
|
||||
module_exit(bcmsdh_module_cleanup);
|
||||
|
||||
MODULE_LICENSE("GPL v2");
|
||||
MODULE_DESCRIPTION(DESCRIPTION);
|
||||
MODULE_AUTHOR(AUTHOR);
|
||||
|
||||
#endif /* BCMSDH_MODULE */
|
||||
/*
|
||||
* module init
|
||||
*/
|
||||
int bcmsdh_register_client_driver(void)
|
||||
{
|
||||
return sdio_register_driver(&bcmsdh_sdmmc_driver);
|
||||
}
|
||||
|
||||
/*
|
||||
* module cleanup
|
||||
*/
|
||||
void bcmsdh_unregister_client_driver(void)
|
||||
{
|
||||
sdio_unregister_driver(&bcmsdh_sdmmc_driver);
|
||||
}
|
|
@ -0,0 +1,252 @@
|
|||
/*
|
||||
* Broadcom SPI Host Controller Driver - Linux Per-port
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: bcmsdspi_linux.c 514727 2014-11-12 03:02:48Z $
|
||||
*/
|
||||
|
||||
#include <typedefs.h>
|
||||
#include <bcmutils.h>
|
||||
|
||||
#include <bcmsdbus.h> /* bcmsdh to/from specific controller APIs */
|
||||
#include <sdiovar.h> /* to get msglevel bit values */
|
||||
|
||||
#include <pcicfg.h>
|
||||
#include <sdio.h> /* SDIO Device and Protocol Specs */
|
||||
#include <linux/sched.h> /* request_irq(), free_irq() */
|
||||
#include <bcmsdspi.h>
|
||||
#include <bcmspi.h>
|
||||
|
||||
extern uint sd_crc;
|
||||
module_param(sd_crc, uint, 0);
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0))
|
||||
#define KERNEL26
|
||||
#endif
|
||||
|
||||
struct sdos_info {
|
||||
sdioh_info_t *sd;
|
||||
spinlock_t lock;
|
||||
wait_queue_head_t intr_wait_queue;
|
||||
};
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0))
|
||||
#define BLOCKABLE() (!in_atomic())
|
||||
#else
|
||||
#define BLOCKABLE() (!in_interrupt())
|
||||
#endif
|
||||
|
||||
/* Interrupt handler */
|
||||
static irqreturn_t
|
||||
sdspi_isr(int irq, void *dev_id
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
|
||||
, struct pt_regs *ptregs
|
||||
#endif
|
||||
)
|
||||
{
|
||||
sdioh_info_t *sd;
|
||||
struct sdos_info *sdos;
|
||||
bool ours;
|
||||
|
||||
sd = (sdioh_info_t *)dev_id;
|
||||
sd->local_intrcount++;
|
||||
|
||||
if (!sd->card_init_done) {
|
||||
sd_err(("%s: Hey Bogus intr...not even initted: irq %d\n", __FUNCTION__, irq));
|
||||
return IRQ_RETVAL(FALSE);
|
||||
} else {
|
||||
ours = spi_check_client_intr(sd, NULL);
|
||||
|
||||
/* For local interrupts, wake the waiting process */
|
||||
if (ours && sd->got_hcint) {
|
||||
sdos = (struct sdos_info *)sd->sdos_info;
|
||||
wake_up_interruptible(&sdos->intr_wait_queue);
|
||||
}
|
||||
|
||||
return IRQ_RETVAL(ours);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Register with Linux for interrupts */
|
||||
int
|
||||
spi_register_irq(sdioh_info_t *sd, uint irq)
|
||||
{
|
||||
sd_trace(("Entering %s: irq == %d\n", __FUNCTION__, irq));
|
||||
if (request_irq(irq, sdspi_isr, IRQF_SHARED, "bcmsdspi", sd) < 0) {
|
||||
sd_err(("%s: request_irq() failed\n", __FUNCTION__));
|
||||
return ERROR;
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/* Free Linux irq */
|
||||
void
|
||||
spi_free_irq(uint irq, sdioh_info_t *sd)
|
||||
{
|
||||
free_irq(irq, sd);
|
||||
}
|
||||
|
||||
/* Map Host controller registers */
|
||||
uint32 *
|
||||
spi_reg_map(osl_t *osh, uintptr addr, int size)
|
||||
{
|
||||
return (uint32 *)REG_MAP(addr, size);
|
||||
}
|
||||
|
||||
void
|
||||
spi_reg_unmap(osl_t *osh, uintptr addr, int size)
|
||||
{
|
||||
REG_UNMAP((void*)(uintptr)addr);
|
||||
}
|
||||
|
||||
int
|
||||
spi_osinit(sdioh_info_t *sd)
|
||||
{
|
||||
struct sdos_info *sdos;
|
||||
|
||||
sdos = (struct sdos_info*)MALLOC(sd->osh, sizeof(struct sdos_info));
|
||||
sd->sdos_info = (void*)sdos;
|
||||
if (sdos == NULL)
|
||||
return BCME_NOMEM;
|
||||
|
||||
sdos->sd = sd;
|
||||
spin_lock_init(&sdos->lock);
|
||||
init_waitqueue_head(&sdos->intr_wait_queue);
|
||||
return BCME_OK;
|
||||
}
|
||||
|
||||
void
|
||||
spi_osfree(sdioh_info_t *sd)
|
||||
{
|
||||
struct sdos_info *sdos;
|
||||
ASSERT(sd && sd->sdos_info);
|
||||
|
||||
sdos = (struct sdos_info *)sd->sdos_info;
|
||||
MFREE(sd->osh, sdos, sizeof(struct sdos_info));
|
||||
}
|
||||
|
||||
/* Interrupt enable/disable */
|
||||
SDIOH_API_RC
|
||||
sdioh_interrupt_set(sdioh_info_t *sd, bool enable)
|
||||
{
|
||||
ulong flags;
|
||||
struct sdos_info *sdos;
|
||||
|
||||
sd_trace(("%s: %s\n", __FUNCTION__, enable ? "Enabling" : "Disabling"));
|
||||
|
||||
sdos = (struct sdos_info *)sd->sdos_info;
|
||||
ASSERT(sdos);
|
||||
|
||||
if (!(sd->host_init_done && sd->card_init_done)) {
|
||||
sd_err(("%s: Card & Host are not initted - bailing\n", __FUNCTION__));
|
||||
return SDIOH_API_RC_FAIL;
|
||||
}
|
||||
|
||||
if (enable && !(sd->intr_handler && sd->intr_handler_arg)) {
|
||||
sd_err(("%s: no handler registered, will not enable\n", __FUNCTION__));
|
||||
return SDIOH_API_RC_FAIL;
|
||||
}
|
||||
|
||||
/* Ensure atomicity for enable/disable calls */
|
||||
spin_lock_irqsave(&sdos->lock, flags);
|
||||
|
||||
sd->client_intr_enabled = enable;
|
||||
if (enable && !sd->lockcount)
|
||||
spi_devintr_on(sd);
|
||||
else
|
||||
spi_devintr_off(sd);
|
||||
|
||||
spin_unlock_irqrestore(&sdos->lock, flags);
|
||||
|
||||
return SDIOH_API_RC_SUCCESS;
|
||||
}
|
||||
|
||||
/* Protect against reentrancy (disable device interrupts while executing) */
|
||||
void
|
||||
spi_lock(sdioh_info_t *sd)
|
||||
{
|
||||
ulong flags;
|
||||
struct sdos_info *sdos;
|
||||
|
||||
sdos = (struct sdos_info *)sd->sdos_info;
|
||||
ASSERT(sdos);
|
||||
|
||||
sd_trace(("%s: %d\n", __FUNCTION__, sd->lockcount));
|
||||
|
||||
spin_lock_irqsave(&sdos->lock, flags);
|
||||
if (sd->lockcount) {
|
||||
sd_err(("%s: Already locked!\n", __FUNCTION__));
|
||||
ASSERT(sd->lockcount == 0);
|
||||
}
|
||||
spi_devintr_off(sd);
|
||||
sd->lockcount++;
|
||||
spin_unlock_irqrestore(&sdos->lock, flags);
|
||||
}
|
||||
|
||||
/* Enable client interrupt */
|
||||
void
|
||||
spi_unlock(sdioh_info_t *sd)
|
||||
{
|
||||
ulong flags;
|
||||
struct sdos_info *sdos;
|
||||
|
||||
sd_trace(("%s: %d, %d\n", __FUNCTION__, sd->lockcount, sd->client_intr_enabled));
|
||||
ASSERT(sd->lockcount > 0);
|
||||
|
||||
sdos = (struct sdos_info *)sd->sdos_info;
|
||||
ASSERT(sdos);
|
||||
|
||||
spin_lock_irqsave(&sdos->lock, flags);
|
||||
if (--sd->lockcount == 0 && sd->client_intr_enabled) {
|
||||
spi_devintr_on(sd);
|
||||
}
|
||||
spin_unlock_irqrestore(&sdos->lock, flags);
|
||||
}
|
||||
|
||||
void spi_waitbits(sdioh_info_t *sd, bool yield)
|
||||
{
|
||||
#ifndef BCMSDYIELD
|
||||
ASSERT(!yield);
|
||||
#endif
|
||||
sd_trace(("%s: yield %d canblock %d\n",
|
||||
__FUNCTION__, yield, BLOCKABLE()));
|
||||
|
||||
/* Clear the "interrupt happened" flag and last intrstatus */
|
||||
sd->got_hcint = FALSE;
|
||||
|
||||
#ifdef BCMSDYIELD
|
||||
if (yield && BLOCKABLE()) {
|
||||
struct sdos_info *sdos;
|
||||
sdos = (struct sdos_info *)sd->sdos_info;
|
||||
/* Wait for the indication, the interrupt will be masked when the ISR fires. */
|
||||
wait_event_interruptible(sdos->intr_wait_queue, (sd->got_hcint));
|
||||
} else
|
||||
#endif /* BCMSDYIELD */
|
||||
{
|
||||
spi_spinbits(sd);
|
||||
}
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,645 @@
|
|||
/*
|
||||
* Misc utility routines for WL and Apps
|
||||
* This header file housing the define and function prototype use by
|
||||
* both the wl driver, tools & Apps.
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: bcmwifi_channels.h 612483 2016-01-14 03:44:27Z $
|
||||
*/
|
||||
|
||||
#ifndef _bcmwifi_channels_h_
|
||||
#define _bcmwifi_channels_h_
|
||||
|
||||
|
||||
/* A chanspec holds the channel number, band, bandwidth and control sideband */
|
||||
typedef uint16 chanspec_t;
|
||||
|
||||
/* channel defines */
|
||||
#define CH_UPPER_SB 0x01
|
||||
#define CH_LOWER_SB 0x02
|
||||
#define CH_EWA_VALID 0x04
|
||||
#define CH_80MHZ_APART 16
|
||||
#define CH_40MHZ_APART 8
|
||||
#define CH_20MHZ_APART 4
|
||||
#define CH_10MHZ_APART 2
|
||||
#define CH_5MHZ_APART 1 /* 2G band channels are 5 Mhz apart */
|
||||
#define CH_MAX_2G_CHANNEL 14 /* Max channel in 2G band */
|
||||
|
||||
/* maximum # channels the s/w supports */
|
||||
#define MAXCHANNEL 224 /* max # supported channels. The max channel no is above,
|
||||
* this is that + 1 rounded up to a multiple of NBBY (8).
|
||||
* DO NOT MAKE it > 255: channels are uint8's all over
|
||||
*/
|
||||
#define MAXCHANNEL_NUM (MAXCHANNEL - 1) /* max channel number */
|
||||
|
||||
/* channel bitvec */
|
||||
typedef struct {
|
||||
uint8 vec[MAXCHANNEL/8]; /* bitvec of channels */
|
||||
} chanvec_t;
|
||||
|
||||
/* make sure channel num is within valid range */
|
||||
#define CH_NUM_VALID_RANGE(ch_num) ((ch_num) > 0 && (ch_num) <= MAXCHANNEL_NUM)
|
||||
|
||||
#define CHSPEC_CTLOVLP(sp1, sp2, sep) \
|
||||
(ABS(wf_chspec_ctlchan(sp1) - wf_chspec_ctlchan(sp2)) < (sep))
|
||||
|
||||
/* All builds use the new 11ac ratespec/chanspec */
|
||||
#undef D11AC_IOTYPES
|
||||
#define D11AC_IOTYPES
|
||||
|
||||
#define WL_CHANSPEC_CHAN_MASK 0x00ff
|
||||
#define WL_CHANSPEC_CHAN_SHIFT 0
|
||||
#define WL_CHANSPEC_CHAN1_MASK 0x000f
|
||||
#define WL_CHANSPEC_CHAN1_SHIFT 0
|
||||
#define WL_CHANSPEC_CHAN2_MASK 0x00f0
|
||||
#define WL_CHANSPEC_CHAN2_SHIFT 4
|
||||
|
||||
#define WL_CHANSPEC_CTL_SB_MASK 0x0700
|
||||
#define WL_CHANSPEC_CTL_SB_SHIFT 8
|
||||
#define WL_CHANSPEC_CTL_SB_LLL 0x0000
|
||||
#define WL_CHANSPEC_CTL_SB_LLU 0x0100
|
||||
#define WL_CHANSPEC_CTL_SB_LUL 0x0200
|
||||
#define WL_CHANSPEC_CTL_SB_LUU 0x0300
|
||||
#define WL_CHANSPEC_CTL_SB_ULL 0x0400
|
||||
#define WL_CHANSPEC_CTL_SB_ULU 0x0500
|
||||
#define WL_CHANSPEC_CTL_SB_UUL 0x0600
|
||||
#define WL_CHANSPEC_CTL_SB_UUU 0x0700
|
||||
#define WL_CHANSPEC_CTL_SB_LL WL_CHANSPEC_CTL_SB_LLL
|
||||
#define WL_CHANSPEC_CTL_SB_LU WL_CHANSPEC_CTL_SB_LLU
|
||||
#define WL_CHANSPEC_CTL_SB_UL WL_CHANSPEC_CTL_SB_LUL
|
||||
#define WL_CHANSPEC_CTL_SB_UU WL_CHANSPEC_CTL_SB_LUU
|
||||
#define WL_CHANSPEC_CTL_SB_L WL_CHANSPEC_CTL_SB_LLL
|
||||
#define WL_CHANSPEC_CTL_SB_U WL_CHANSPEC_CTL_SB_LLU
|
||||
#define WL_CHANSPEC_CTL_SB_LOWER WL_CHANSPEC_CTL_SB_LLL
|
||||
#define WL_CHANSPEC_CTL_SB_UPPER WL_CHANSPEC_CTL_SB_LLU
|
||||
#define WL_CHANSPEC_CTL_SB_NONE WL_CHANSPEC_CTL_SB_LLL
|
||||
|
||||
#define WL_CHANSPEC_BW_MASK 0x3800
|
||||
#define WL_CHANSPEC_BW_SHIFT 11
|
||||
#define WL_CHANSPEC_BW_5 0x0000
|
||||
#define WL_CHANSPEC_BW_10 0x0800
|
||||
#define WL_CHANSPEC_BW_20 0x1000
|
||||
#define WL_CHANSPEC_BW_40 0x1800
|
||||
#define WL_CHANSPEC_BW_80 0x2000
|
||||
#define WL_CHANSPEC_BW_160 0x2800
|
||||
#define WL_CHANSPEC_BW_8080 0x3000
|
||||
#define WL_CHANSPEC_BW_2P5 0x3800
|
||||
|
||||
#define WL_CHANSPEC_BAND_MASK 0xc000
|
||||
#define WL_CHANSPEC_BAND_SHIFT 14
|
||||
#define WL_CHANSPEC_BAND_2G 0x0000
|
||||
#define WL_CHANSPEC_BAND_3G 0x4000
|
||||
#define WL_CHANSPEC_BAND_4G 0x8000
|
||||
#define WL_CHANSPEC_BAND_5G 0xc000
|
||||
#define INVCHANSPEC 255
|
||||
#define MAX_CHANSPEC 0xFFFF
|
||||
|
||||
#define WL_CHANNEL_BAND(ch) (((ch) <= CH_MAX_2G_CHANNEL) ? \
|
||||
WL_CHANSPEC_BAND_2G : WL_CHANSPEC_BAND_5G)
|
||||
|
||||
/* channel defines */
|
||||
#define LOWER_20_SB(channel) (((channel) > CH_10MHZ_APART) ? \
|
||||
((channel) - CH_10MHZ_APART) : 0)
|
||||
#define UPPER_20_SB(channel) (((channel) < (MAXCHANNEL - CH_10MHZ_APART)) ? \
|
||||
((channel) + CH_10MHZ_APART) : 0)
|
||||
|
||||
#define LL_20_SB(channel) (((channel) > 3 * CH_10MHZ_APART) ? ((channel) - 3 * CH_10MHZ_APART) : 0)
|
||||
#define UU_20_SB(channel) (((channel) < (MAXCHANNEL - 3 * CH_10MHZ_APART)) ? \
|
||||
((channel) + 3 * CH_10MHZ_APART) : 0)
|
||||
#define LU_20_SB(channel) LOWER_20_SB(channel)
|
||||
#define UL_20_SB(channel) UPPER_20_SB(channel)
|
||||
|
||||
#define LOWER_40_SB(channel) ((channel) - CH_20MHZ_APART)
|
||||
#define UPPER_40_SB(channel) ((channel) + CH_20MHZ_APART)
|
||||
#define CHSPEC_WLCBANDUNIT(chspec) (CHSPEC_IS5G(chspec) ? BAND_5G_INDEX : BAND_2G_INDEX)
|
||||
#define CH20MHZ_CHSPEC(channel) (chanspec_t)((chanspec_t)(channel) | WL_CHANSPEC_BW_20 | \
|
||||
(((channel) <= CH_MAX_2G_CHANNEL) ? \
|
||||
WL_CHANSPEC_BAND_2G : WL_CHANSPEC_BAND_5G))
|
||||
#define CH2P5MHZ_CHSPEC(channel) (chanspec_t)((chanspec_t)(channel) | WL_CHANSPEC_BW_2P5 | \
|
||||
(((channel) <= CH_MAX_2G_CHANNEL) ? \
|
||||
WL_CHANSPEC_BAND_2G : WL_CHANSPEC_BAND_5G))
|
||||
#define CH5MHZ_CHSPEC(channel) (chanspec_t)((chanspec_t)(channel) | WL_CHANSPEC_BW_5 | \
|
||||
(((channel) <= CH_MAX_2G_CHANNEL) ? \
|
||||
WL_CHANSPEC_BAND_2G : WL_CHANSPEC_BAND_5G))
|
||||
#define CH10MHZ_CHSPEC(channel) (chanspec_t)((chanspec_t)(channel) | WL_CHANSPEC_BW_10 | \
|
||||
(((channel) <= CH_MAX_2G_CHANNEL) ? \
|
||||
WL_CHANSPEC_BAND_2G : WL_CHANSPEC_BAND_5G))
|
||||
#define NEXT_20MHZ_CHAN(channel) (((channel) < (MAXCHANNEL - CH_20MHZ_APART)) ? \
|
||||
((channel) + CH_20MHZ_APART) : 0)
|
||||
#define CH40MHZ_CHSPEC(channel, ctlsb) (chanspec_t) \
|
||||
((channel) | (ctlsb) | WL_CHANSPEC_BW_40 | \
|
||||
((channel) <= CH_MAX_2G_CHANNEL ? WL_CHANSPEC_BAND_2G : \
|
||||
WL_CHANSPEC_BAND_5G))
|
||||
#define CH80MHZ_CHSPEC(channel, ctlsb) (chanspec_t) \
|
||||
((channel) | (ctlsb) | \
|
||||
WL_CHANSPEC_BW_80 | WL_CHANSPEC_BAND_5G)
|
||||
#define CH160MHZ_CHSPEC(channel, ctlsb) (chanspec_t) \
|
||||
((channel) | (ctlsb) | \
|
||||
WL_CHANSPEC_BW_160 | WL_CHANSPEC_BAND_5G)
|
||||
#define CHBW_CHSPEC(bw, channel) (chanspec_t)((chanspec_t)(channel) | (bw) | \
|
||||
(((channel) <= CH_MAX_2G_CHANNEL) ? \
|
||||
WL_CHANSPEC_BAND_2G : WL_CHANSPEC_BAND_5G))
|
||||
|
||||
/* simple MACROs to get different fields of chanspec */
|
||||
#ifdef WL11AC_80P80
|
||||
#define CHSPEC_CHANNEL(chspec) wf_chspec_channel(chspec)
|
||||
#else
|
||||
#define CHSPEC_CHANNEL(chspec) ((uint8)((chspec) & WL_CHANSPEC_CHAN_MASK))
|
||||
#endif
|
||||
#define CHSPEC_CHAN1(chspec) ((chspec) & WL_CHANSPEC_CHAN1_MASK) >> WL_CHANSPEC_CHAN1_SHIFT
|
||||
#define CHSPEC_CHAN2(chspec) ((chspec) & WL_CHANSPEC_CHAN2_MASK) >> WL_CHANSPEC_CHAN2_SHIFT
|
||||
#define CHSPEC_BAND(chspec) ((chspec) & WL_CHANSPEC_BAND_MASK)
|
||||
#define CHSPEC_CTL_SB(chspec) ((chspec) & WL_CHANSPEC_CTL_SB_MASK)
|
||||
#define CHSPEC_BW(chspec) ((chspec) & WL_CHANSPEC_BW_MASK)
|
||||
|
||||
#ifdef WL11N_20MHZONLY
|
||||
#ifdef WL11ULB
|
||||
#define CHSPEC_IS2P5(chspec) (((chspec) & WL_CHANSPEC_BW_MASK) == WL_CHANSPEC_BW_2P5)
|
||||
#define CHSPEC_IS5(chspec) (((chspec) & WL_CHANSPEC_BW_MASK) == WL_CHANSPEC_BW_5)
|
||||
#define CHSPEC_IS10(chspec) (((chspec) & WL_CHANSPEC_BW_MASK) == WL_CHANSPEC_BW_10)
|
||||
#else
|
||||
#define CHSPEC_IS2P5(chspec) 0
|
||||
#define CHSPEC_IS5(chspec) 0
|
||||
#define CHSPEC_IS10(chspec) 0
|
||||
#endif
|
||||
#define CHSPEC_IS20(chspec) 1
|
||||
#define CHSPEC_IS20_2G(chspec) ((((chspec) & WL_CHANSPEC_BW_MASK) == WL_CHANSPEC_BW_20) && \
|
||||
CHSPEC_IS2G(chspec))
|
||||
#ifndef CHSPEC_IS40
|
||||
#define CHSPEC_IS40(chspec) 0
|
||||
#endif
|
||||
#ifndef CHSPEC_IS80
|
||||
#define CHSPEC_IS80(chspec) 0
|
||||
#endif
|
||||
#ifndef CHSPEC_IS160
|
||||
#define CHSPEC_IS160(chspec) 0
|
||||
#endif
|
||||
#ifndef CHSPEC_IS8080
|
||||
#define CHSPEC_IS8080(chspec) 0
|
||||
#endif
|
||||
#define BW_LE20(bw) TRUE
|
||||
#define CHSPEC_ISLE20(chspec) TRUE
|
||||
#else /* !WL11N_20MHZONLY */
|
||||
|
||||
#define CHSPEC_IS2P5(chspec) (((chspec) & WL_CHANSPEC_BW_MASK) == WL_CHANSPEC_BW_2P5)
|
||||
#define CHSPEC_IS5(chspec) (((chspec) & WL_CHANSPEC_BW_MASK) == WL_CHANSPEC_BW_5)
|
||||
#define CHSPEC_IS10(chspec) (((chspec) & WL_CHANSPEC_BW_MASK) == WL_CHANSPEC_BW_10)
|
||||
#define CHSPEC_IS20(chspec) (((chspec) & WL_CHANSPEC_BW_MASK) == WL_CHANSPEC_BW_20)
|
||||
#define CHSPEC_IS20_5G(chspec) ((((chspec) & WL_CHANSPEC_BW_MASK) == WL_CHANSPEC_BW_20) && \
|
||||
CHSPEC_IS5G(chspec))
|
||||
#ifndef CHSPEC_IS40
|
||||
#define CHSPEC_IS40(chspec) (((chspec) & WL_CHANSPEC_BW_MASK) == WL_CHANSPEC_BW_40)
|
||||
#endif
|
||||
#ifndef CHSPEC_IS80
|
||||
#define CHSPEC_IS80(chspec) (((chspec) & WL_CHANSPEC_BW_MASK) == WL_CHANSPEC_BW_80)
|
||||
#endif
|
||||
#ifndef CHSPEC_IS160
|
||||
#define CHSPEC_IS160(chspec) (((chspec) & WL_CHANSPEC_BW_MASK) == WL_CHANSPEC_BW_160)
|
||||
#endif
|
||||
#ifndef CHSPEC_IS8080
|
||||
#define CHSPEC_IS8080(chspec) (((chspec) & WL_CHANSPEC_BW_MASK) == WL_CHANSPEC_BW_8080)
|
||||
#endif
|
||||
|
||||
#ifdef WL11ULB
|
||||
#define BW_LT20(bw) (((bw) == WL_CHANSPEC_BW_2P5) || \
|
||||
((bw) == WL_CHANSPEC_BW_5) || \
|
||||
((bw) == WL_CHANSPEC_BW_10))
|
||||
#define CHSPEC_BW_LT20(chspec) (BW_LT20(CHSPEC_BW(chspec)))
|
||||
/* This MACRO is strictly to avoid abandons in existing code with ULB feature and is in no way
|
||||
* optimial to use. Should be replaced with CHSPEC_BW_LE() instead
|
||||
*/
|
||||
#define BW_LE20(bw) (((bw) == WL_CHANSPEC_BW_2P5) || \
|
||||
((bw) == WL_CHANSPEC_BW_5) || \
|
||||
((bw) == WL_CHANSPEC_BW_10) || \
|
||||
((bw) == WL_CHANSPEC_BW_20))
|
||||
#define CHSPEC_ISLE20(chspec) (BW_LE20(CHSPEC_BW(chspec)))
|
||||
|
||||
#else /* WL11ULB */
|
||||
#define BW_LE20(bw) ((bw) == WL_CHANSPEC_BW_20)
|
||||
#define CHSPEC_ISLE20(chspec) (CHSPEC_IS20(chspec))
|
||||
#endif /* WL11ULB */
|
||||
#endif /* !WL11N_20MHZONLY */
|
||||
|
||||
#define BW_LE40(bw) (BW_LE20(bw) || ((bw) == WL_CHANSPEC_BW_40))
|
||||
#define BW_LE80(bw) (BW_LE40(bw) || ((bw) == WL_CHANSPEC_BW_80))
|
||||
#define BW_LE160(bw) (BW_LE80(bw) || ((bw) == WL_CHANSPEC_BW_160))
|
||||
#define CHSPEC_BW_LE20(chspec) (BW_LE20(CHSPEC_BW(chspec)))
|
||||
#define CHSPEC_IS5G(chspec) (((chspec) & WL_CHANSPEC_BAND_MASK) == WL_CHANSPEC_BAND_5G)
|
||||
#define CHSPEC_IS2G(chspec) (((chspec) & WL_CHANSPEC_BAND_MASK) == WL_CHANSPEC_BAND_2G)
|
||||
#define CHSPEC_SB_UPPER(chspec) \
|
||||
((((chspec) & WL_CHANSPEC_CTL_SB_MASK) == WL_CHANSPEC_CTL_SB_UPPER) && \
|
||||
(((chspec) & WL_CHANSPEC_BW_MASK) == WL_CHANSPEC_BW_40))
|
||||
#define CHSPEC_SB_LOWER(chspec) \
|
||||
((((chspec) & WL_CHANSPEC_CTL_SB_MASK) == WL_CHANSPEC_CTL_SB_LOWER) && \
|
||||
(((chspec) & WL_CHANSPEC_BW_MASK) == WL_CHANSPEC_BW_40))
|
||||
#define CHSPEC2WLC_BAND(chspec) (CHSPEC_IS5G(chspec) ? WLC_BAND_5G : WLC_BAND_2G)
|
||||
|
||||
/**
|
||||
* Number of chars needed for wf_chspec_ntoa() destination character buffer.
|
||||
*/
|
||||
#define CHANSPEC_STR_LEN 20
|
||||
|
||||
|
||||
#define CHSPEC_IS_BW_160_WIDE(chspec) (CHSPEC_BW(chspec) == WL_CHANSPEC_BW_160 ||\
|
||||
CHSPEC_BW(chspec) == WL_CHANSPEC_BW_8080)
|
||||
|
||||
/* BW inequality comparisons, LE (<=), GE (>=), LT (<), GT (>), comparisons can be made
|
||||
* as simple numeric comparisons, with the exception that 160 is the same BW as 80+80,
|
||||
* but have different numeric values; (WL_CHANSPEC_BW_160 < WL_CHANSPEC_BW_8080).
|
||||
*
|
||||
* The LT/LE/GT/GE macros check first checks whether both chspec bandwidth and bw are 160 wide.
|
||||
* If both chspec bandwidth and bw is not 160 wide, then the comparison is made.
|
||||
*/
|
||||
#ifdef WL11ULB
|
||||
#define CHSPEC_BW_GE(chspec, bw) \
|
||||
(((CHSPEC_IS_BW_160_WIDE(chspec) &&\
|
||||
((bw) == WL_CHANSPEC_BW_160 || (bw) == WL_CHANSPEC_BW_8080)) ||\
|
||||
(CHSPEC_BW(chspec) >= (bw))) && \
|
||||
(!(CHSPEC_BW(chspec) == WL_CHANSPEC_BW_2P5 && (bw) != WL_CHANSPEC_BW_2P5)))
|
||||
#else /* WL11ULB */
|
||||
#define CHSPEC_BW_GE(chspec, bw) \
|
||||
((CHSPEC_IS_BW_160_WIDE(chspec) &&\
|
||||
((bw) == WL_CHANSPEC_BW_160 || (bw) == WL_CHANSPEC_BW_8080)) ||\
|
||||
(CHSPEC_BW(chspec) >= (bw)))
|
||||
#endif /* WL11ULB */
|
||||
|
||||
#ifdef WL11ULB
|
||||
#define CHSPEC_BW_LE(chspec, bw) \
|
||||
(((CHSPEC_IS_BW_160_WIDE(chspec) &&\
|
||||
((bw) == WL_CHANSPEC_BW_160 || (bw) == WL_CHANSPEC_BW_8080)) ||\
|
||||
(CHSPEC_BW(chspec) <= (bw))) || \
|
||||
(CHSPEC_BW(chspec) == WL_CHANSPEC_BW_2P5))
|
||||
#else /* WL11ULB */
|
||||
#define CHSPEC_BW_LE(chspec, bw) \
|
||||
((CHSPEC_IS_BW_160_WIDE(chspec) &&\
|
||||
((bw) == WL_CHANSPEC_BW_160 || (bw) == WL_CHANSPEC_BW_8080)) ||\
|
||||
(CHSPEC_BW(chspec) <= (bw)))
|
||||
#endif /* WL11ULB */
|
||||
|
||||
#ifdef WL11ULB
|
||||
#define CHSPEC_BW_GT(chspec, bw) \
|
||||
((!(CHSPEC_IS_BW_160_WIDE(chspec) &&\
|
||||
((bw) == WL_CHANSPEC_BW_160 || (bw) == WL_CHANSPEC_BW_8080)) &&\
|
||||
(CHSPEC_BW(chspec) > (bw))) && \
|
||||
(CHSPEC_BW(chspec) != WL_CHANSPEC_BW_2P5))
|
||||
#else /* WL11ULB */
|
||||
#define CHSPEC_BW_GT(chspec, bw) \
|
||||
(!(CHSPEC_IS_BW_160_WIDE(chspec) &&\
|
||||
((bw) == WL_CHANSPEC_BW_160 || (bw) == WL_CHANSPEC_BW_8080)) &&\
|
||||
(CHSPEC_BW(chspec) > (bw)))
|
||||
#endif /* WL11ULB */
|
||||
|
||||
#ifdef WL11ULB
|
||||
#define CHSPEC_BW_LT(chspec, bw) \
|
||||
((!(CHSPEC_IS_BW_160_WIDE(chspec) &&\
|
||||
((bw) == WL_CHANSPEC_BW_160 || (bw) == WL_CHANSPEC_BW_8080)) &&\
|
||||
(CHSPEC_BW(chspec) < (bw))) || \
|
||||
((CHSPEC_BW(chspec) == WL_CHANSPEC_BW_2P5 && (bw) != WL_CHANSPEC_BW_2P5)))
|
||||
#else /* WL11ULB */
|
||||
#define CHSPEC_BW_LT(chspec, bw) \
|
||||
(!(CHSPEC_IS_BW_160_WIDE(chspec) &&\
|
||||
((bw) == WL_CHANSPEC_BW_160 || (bw) == WL_CHANSPEC_BW_8080)) &&\
|
||||
(CHSPEC_BW(chspec) < (bw)))
|
||||
#endif /* WL11ULB */
|
||||
|
||||
/* Legacy Chanspec defines
|
||||
* These are the defines for the previous format of the chanspec_t
|
||||
*/
|
||||
#define WL_LCHANSPEC_CHAN_MASK 0x00ff
|
||||
#define WL_LCHANSPEC_CHAN_SHIFT 0
|
||||
|
||||
#define WL_LCHANSPEC_CTL_SB_MASK 0x0300
|
||||
#define WL_LCHANSPEC_CTL_SB_SHIFT 8
|
||||
#define WL_LCHANSPEC_CTL_SB_LOWER 0x0100
|
||||
#define WL_LCHANSPEC_CTL_SB_UPPER 0x0200
|
||||
#define WL_LCHANSPEC_CTL_SB_NONE 0x0300
|
||||
|
||||
#define WL_LCHANSPEC_BW_MASK 0x0C00
|
||||
#define WL_LCHANSPEC_BW_SHIFT 10
|
||||
#define WL_LCHANSPEC_BW_10 0x0400
|
||||
#define WL_LCHANSPEC_BW_20 0x0800
|
||||
#define WL_LCHANSPEC_BW_40 0x0C00
|
||||
|
||||
#define WL_LCHANSPEC_BAND_MASK 0xf000
|
||||
#define WL_LCHANSPEC_BAND_SHIFT 12
|
||||
#define WL_LCHANSPEC_BAND_5G 0x1000
|
||||
#define WL_LCHANSPEC_BAND_2G 0x2000
|
||||
|
||||
#define LCHSPEC_CHANNEL(chspec) ((uint8)((chspec) & WL_LCHANSPEC_CHAN_MASK))
|
||||
#define LCHSPEC_BAND(chspec) ((chspec) & WL_LCHANSPEC_BAND_MASK)
|
||||
#define LCHSPEC_CTL_SB(chspec) ((chspec) & WL_LCHANSPEC_CTL_SB_MASK)
|
||||
#define LCHSPEC_BW(chspec) ((chspec) & WL_LCHANSPEC_BW_MASK)
|
||||
#define LCHSPEC_IS10(chspec) (((chspec) & WL_LCHANSPEC_BW_MASK) == WL_LCHANSPEC_BW_10)
|
||||
#define LCHSPEC_IS20(chspec) (((chspec) & WL_LCHANSPEC_BW_MASK) == WL_LCHANSPEC_BW_20)
|
||||
#define LCHSPEC_IS40(chspec) (((chspec) & WL_LCHANSPEC_BW_MASK) == WL_LCHANSPEC_BW_40)
|
||||
#define LCHSPEC_IS5G(chspec) (((chspec) & WL_LCHANSPEC_BAND_MASK) == WL_LCHANSPEC_BAND_5G)
|
||||
#define LCHSPEC_IS2G(chspec) (((chspec) & WL_LCHANSPEC_BAND_MASK) == WL_LCHANSPEC_BAND_2G)
|
||||
|
||||
#define LCHSPEC_SB_UPPER(chspec) \
|
||||
((((chspec) & WL_LCHANSPEC_CTL_SB_MASK) == WL_LCHANSPEC_CTL_SB_UPPER) && \
|
||||
(((chspec) & WL_LCHANSPEC_BW_MASK) == WL_LCHANSPEC_BW_40))
|
||||
#define LCHSPEC_SB_LOWER(chspec) \
|
||||
((((chspec) & WL_LCHANSPEC_CTL_SB_MASK) == WL_LCHANSPEC_CTL_SB_LOWER) && \
|
||||
(((chspec) & WL_LCHANSPEC_BW_MASK) == WL_LCHANSPEC_BW_40))
|
||||
|
||||
#define LCHSPEC_CREATE(chan, band, bw, sb) ((uint16)((chan) | (sb) | (bw) | (band)))
|
||||
|
||||
#define CH20MHZ_LCHSPEC(channel) \
|
||||
(chanspec_t)((chanspec_t)(channel) | WL_LCHANSPEC_BW_20 | \
|
||||
WL_LCHANSPEC_CTL_SB_NONE | (((channel) <= CH_MAX_2G_CHANNEL) ? \
|
||||
WL_LCHANSPEC_BAND_2G : WL_LCHANSPEC_BAND_5G))
|
||||
|
||||
/*
|
||||
* WF_CHAN_FACTOR_* constants are used to calculate channel frequency
|
||||
* given a channel number.
|
||||
* chan_freq = chan_factor * 500Mhz + chan_number * 5
|
||||
*/
|
||||
|
||||
/**
|
||||
* Channel Factor for the starting frequence of 2.4 GHz channels.
|
||||
* The value corresponds to 2407 MHz.
|
||||
*/
|
||||
#define WF_CHAN_FACTOR_2_4_G 4814 /* 2.4 GHz band, 2407 MHz */
|
||||
|
||||
/**
|
||||
* Channel Factor for the starting frequence of 5 GHz channels.
|
||||
* The value corresponds to 5000 MHz.
|
||||
*/
|
||||
#define WF_CHAN_FACTOR_5_G 10000 /* 5 GHz band, 5000 MHz */
|
||||
|
||||
/**
|
||||
* Channel Factor for the starting frequence of 4.9 GHz channels.
|
||||
* The value corresponds to 4000 MHz.
|
||||
*/
|
||||
#define WF_CHAN_FACTOR_4_G 8000 /* 4.9 GHz band for Japan */
|
||||
|
||||
#define WLC_2G_25MHZ_OFFSET 5 /* 2.4GHz band channel offset */
|
||||
|
||||
/**
|
||||
* No of sub-band vlaue of the specified Mhz chanspec
|
||||
*/
|
||||
#define WF_NUM_SIDEBANDS_40MHZ 2
|
||||
#define WF_NUM_SIDEBANDS_80MHZ 4
|
||||
#define WF_NUM_SIDEBANDS_8080MHZ 4
|
||||
#define WF_NUM_SIDEBANDS_160MHZ 8
|
||||
|
||||
/**
|
||||
* Convert chanspec to ascii string
|
||||
*
|
||||
* @param chspec chanspec format
|
||||
* @param buf ascii string of chanspec
|
||||
*
|
||||
* @return pointer to buf with room for at least CHANSPEC_STR_LEN bytes
|
||||
* Original chanspec in case of error
|
||||
*
|
||||
* @see CHANSPEC_STR_LEN
|
||||
*/
|
||||
extern char * wf_chspec_ntoa_ex(chanspec_t chspec, char *buf);
|
||||
|
||||
/**
|
||||
* Convert chanspec to ascii string
|
||||
*
|
||||
* @param chspec chanspec format
|
||||
* @param buf ascii string of chanspec
|
||||
*
|
||||
* @return pointer to buf with room for at least CHANSPEC_STR_LEN bytes
|
||||
* NULL in case of error
|
||||
*
|
||||
* @see CHANSPEC_STR_LEN
|
||||
*/
|
||||
extern char * wf_chspec_ntoa(chanspec_t chspec, char *buf);
|
||||
|
||||
/**
|
||||
* Convert ascii string to chanspec
|
||||
*
|
||||
* @param a pointer to input string
|
||||
*
|
||||
* @return >= 0 if successful or 0 otherwise
|
||||
*/
|
||||
extern chanspec_t wf_chspec_aton(const char *a);
|
||||
|
||||
/**
|
||||
* Verify the chanspec fields are valid.
|
||||
*
|
||||
* Verify the chanspec is using a legal set field values, i.e. that the chanspec
|
||||
* specified a band, bw, ctl_sb and channel and that the combination could be
|
||||
* legal given some set of circumstances.
|
||||
*
|
||||
* @param chanspec input chanspec to verify
|
||||
*
|
||||
* @return TRUE if the chanspec is malformed, FALSE if it looks good.
|
||||
*/
|
||||
extern bool wf_chspec_malformed(chanspec_t chanspec);
|
||||
|
||||
/**
|
||||
* Verify the chanspec specifies a valid channel according to 802.11.
|
||||
*
|
||||
* @param chanspec input chanspec to verify
|
||||
*
|
||||
* @return TRUE if the chanspec is a valid 802.11 channel
|
||||
*/
|
||||
extern bool wf_chspec_valid(chanspec_t chanspec);
|
||||
|
||||
/**
|
||||
* Return the primary (control) channel.
|
||||
*
|
||||
* This function returns the channel number of the primary 20MHz channel. For
|
||||
* 20MHz channels this is just the channel number. For 40MHz or wider channels
|
||||
* it is the primary 20MHz channel specified by the chanspec.
|
||||
*
|
||||
* @param chspec input chanspec
|
||||
*
|
||||
* @return Returns the channel number of the primary 20MHz channel
|
||||
*/
|
||||
extern uint8 wf_chspec_ctlchan(chanspec_t chspec);
|
||||
|
||||
/*
|
||||
* Return the bandwidth string.
|
||||
*
|
||||
* This function returns the bandwidth string for the passed chanspec.
|
||||
*
|
||||
* @param chspec input chanspec
|
||||
*
|
||||
* @return Returns the bandwidth string
|
||||
*/
|
||||
extern const char *wf_chspec_to_bw_str(chanspec_t chspec);
|
||||
|
||||
/**
|
||||
* Return the primary (control) chanspec.
|
||||
*
|
||||
* This function returns the chanspec of the primary 20MHz channel. For 20MHz
|
||||
* channels this is just the chanspec. For 40MHz or wider channels it is the
|
||||
* chanspec of the primary 20MHZ channel specified by the chanspec.
|
||||
*
|
||||
* @param chspec input chanspec
|
||||
*
|
||||
* @return Returns the chanspec of the primary 20MHz channel
|
||||
*/
|
||||
extern chanspec_t wf_chspec_ctlchspec(chanspec_t chspec);
|
||||
|
||||
/**
|
||||
* Return a channel number corresponding to a frequency.
|
||||
*
|
||||
* This function returns the chanspec for the primary 40MHz of an 80MHz channel.
|
||||
* The control sideband specifies the same 20MHz channel that the 80MHz channel is using
|
||||
* as the primary 20MHz channel.
|
||||
*/
|
||||
extern chanspec_t wf_chspec_primary40_chspec(chanspec_t chspec);
|
||||
|
||||
/*
|
||||
* Return the channel number for a given frequency and base frequency.
|
||||
* The returned channel number is relative to the given base frequency.
|
||||
* If the given base frequency is zero, a base frequency of 5 GHz is assumed for
|
||||
* frequencies from 5 - 6 GHz, and 2.407 GHz is assumed for 2.4 - 2.5 GHz.
|
||||
*
|
||||
* Frequency is specified in MHz.
|
||||
* The base frequency is specified as (start_factor * 500 kHz).
|
||||
* Constants WF_CHAN_FACTOR_2_4_G, WF_CHAN_FACTOR_5_G are defined for
|
||||
* 2.4 GHz and 5 GHz bands.
|
||||
*
|
||||
* The returned channel will be in the range [1, 14] in the 2.4 GHz band
|
||||
* and [0, 200] otherwise.
|
||||
* -1 is returned if the start_factor is WF_CHAN_FACTOR_2_4_G and the
|
||||
* frequency is not a 2.4 GHz channel, or if the frequency is not and even
|
||||
* multiple of 5 MHz from the base frequency to the base plus 1 GHz.
|
||||
*
|
||||
* Reference 802.11 REVma, section 17.3.8.3, and 802.11B section 18.4.6.2
|
||||
*
|
||||
* @param freq frequency in MHz
|
||||
* @param start_factor base frequency in 500 kHz units, e.g. 10000 for 5 GHz
|
||||
*
|
||||
* @return Returns a channel number
|
||||
*
|
||||
* @see WF_CHAN_FACTOR_2_4_G
|
||||
* @see WF_CHAN_FACTOR_5_G
|
||||
*/
|
||||
extern int wf_mhz2channel(uint freq, uint start_factor);
|
||||
|
||||
/**
|
||||
* Return the center frequency in MHz of the given channel and base frequency.
|
||||
*
|
||||
* Return the center frequency in MHz of the given channel and base frequency.
|
||||
* The channel number is interpreted relative to the given base frequency.
|
||||
*
|
||||
* The valid channel range is [1, 14] in the 2.4 GHz band and [0, 200] otherwise.
|
||||
* The base frequency is specified as (start_factor * 500 kHz).
|
||||
* Constants WF_CHAN_FACTOR_2_4_G, WF_CHAN_FACTOR_5_G are defined for
|
||||
* 2.4 GHz and 5 GHz bands.
|
||||
* The channel range of [1, 14] is only checked for a start_factor of
|
||||
* WF_CHAN_FACTOR_2_4_G (4814).
|
||||
* Odd start_factors produce channels on .5 MHz boundaries, in which case
|
||||
* the answer is rounded down to an integral MHz.
|
||||
* -1 is returned for an out of range channel.
|
||||
*
|
||||
* Reference 802.11 REVma, section 17.3.8.3, and 802.11B section 18.4.6.2
|
||||
*
|
||||
* @param channel input channel number
|
||||
* @param start_factor base frequency in 500 kHz units, e.g. 10000 for 5 GHz
|
||||
*
|
||||
* @return Returns a frequency in MHz
|
||||
*
|
||||
* @see WF_CHAN_FACTOR_2_4_G
|
||||
* @see WF_CHAN_FACTOR_5_G
|
||||
*/
|
||||
extern int wf_channel2mhz(uint channel, uint start_factor);
|
||||
|
||||
/**
|
||||
* Returns the chanspec 80Mhz channel corresponding to the following input
|
||||
* parameters
|
||||
*
|
||||
* primary_channel - primary 20Mhz channel
|
||||
* center_channel - center frequecny of the 80Mhz channel
|
||||
*
|
||||
* The center_channel can be one of {42, 58, 106, 122, 138, 155}
|
||||
*
|
||||
* returns INVCHANSPEC in case of error
|
||||
*/
|
||||
extern chanspec_t wf_chspec_80(uint8 center_channel, uint8 primary_channel);
|
||||
|
||||
/**
|
||||
* Convert ctl chan and bw to chanspec
|
||||
*
|
||||
* @param ctl_ch channel
|
||||
* @param bw bandwidth
|
||||
*
|
||||
* @return > 0 if successful or 0 otherwise
|
||||
*
|
||||
*/
|
||||
extern uint16 wf_channel2chspec(uint ctl_ch, uint bw);
|
||||
|
||||
extern uint wf_channel2freq(uint channel);
|
||||
extern uint wf_freq2channel(uint freq);
|
||||
|
||||
/*
|
||||
* Returns the 80+80 MHz chanspec corresponding to the following input parameters
|
||||
*
|
||||
* primary_20mhz - Primary 20 MHz channel
|
||||
* chan0_80MHz - center channel number of one frequency segment
|
||||
* chan1_80MHz - center channel number of the other frequency segment
|
||||
*
|
||||
* Parameters chan0_80MHz and chan1_80MHz are channel numbers in {42, 58, 106, 122, 138, 155}.
|
||||
* The primary channel must be contained in one of the 80MHz channels. This routine
|
||||
* will determine which frequency segment is the primary 80 MHz segment.
|
||||
*
|
||||
* Returns INVCHANSPEC in case of error.
|
||||
*
|
||||
* Refer to IEEE802.11ac section 22.3.14 "Channelization".
|
||||
*/
|
||||
extern chanspec_t wf_chspec_get8080_chspec(uint8 primary_20mhz,
|
||||
uint8 chan0_80Mhz, uint8 chan1_80Mhz);
|
||||
|
||||
/*
|
||||
* Returns the primary 80 Mhz channel for the provided chanspec
|
||||
*
|
||||
* chanspec - Input chanspec for which the 80MHz primary channel has to be retrieved
|
||||
*
|
||||
* returns -1 in case the provided channel is 20/40 Mhz chanspec
|
||||
*/
|
||||
extern uint8 wf_chspec_primary80_channel(chanspec_t chanspec);
|
||||
|
||||
/*
|
||||
* Returns the secondary 80 Mhz channel for the provided chanspec
|
||||
*
|
||||
* chanspec - Input chanspec for which the 80MHz secondary channel has to be retrieved
|
||||
*
|
||||
* returns -1 in case the provided channel is 20/40 Mhz chanspec
|
||||
*/
|
||||
extern uint8 wf_chspec_secondary80_channel(chanspec_t chanspec);
|
||||
|
||||
/*
|
||||
* This function returns the chanspec for the primary 80MHz of an 160MHz or 80+80 channel.
|
||||
*/
|
||||
extern chanspec_t wf_chspec_primary80_chspec(chanspec_t chspec);
|
||||
|
||||
#ifdef WL11AC_80P80
|
||||
/*
|
||||
* This function returns the centre chanel for the given chanspec.
|
||||
* In case of 80+80 chanspec it returns the primary 80 Mhz centre channel
|
||||
*/
|
||||
extern uint8 wf_chspec_channel(chanspec_t chspec);
|
||||
#endif
|
||||
extern chanspec_t wf_channel_create_chspec_frm_opclass(uint8 opclass, uint8 channel);
|
||||
extern int wf_channel_create_opclass_frm_chspec(chanspec_t chspec);
|
||||
#endif /* _bcmwifi_channels_h_ */
|
|
@ -0,0 +1,793 @@
|
|||
/*
|
||||
* Indices for 802.11 a/b/g/n/ac 1-3 chain symmetric transmit rates
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: bcmwifi_rates.h 612483 2016-01-14 03:44:27Z $
|
||||
*/
|
||||
|
||||
#ifndef _bcmwifi_rates_h_
|
||||
#define _bcmwifi_rates_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#define WL_RATESET_SZ_DSSS 4
|
||||
#define WL_RATESET_SZ_OFDM 8
|
||||
#define WL_RATESET_SZ_VHT_MCS 10
|
||||
#define WL_RATESET_SZ_VHT_MCS_P 12
|
||||
|
||||
#if defined(WLPROPRIETARY_11N_RATES)
|
||||
#define WL_RATESET_SZ_HT_MCS WL_RATESET_SZ_VHT_MCS
|
||||
#else
|
||||
#define WL_RATESET_SZ_HT_MCS 8
|
||||
#endif
|
||||
|
||||
#define WL_RATESET_SZ_HT_IOCTL 8 /* MAC histogram, compatibility with wl utility */
|
||||
|
||||
#define WL_TX_CHAINS_MAX 4
|
||||
|
||||
#define WL_RATE_DISABLED (-128) /* Power value corresponding to unsupported rate */
|
||||
|
||||
/* Transmit channel bandwidths */
|
||||
typedef enum wl_tx_bw {
|
||||
WL_TX_BW_20,
|
||||
WL_TX_BW_40,
|
||||
WL_TX_BW_80,
|
||||
WL_TX_BW_20IN40,
|
||||
WL_TX_BW_20IN80,
|
||||
WL_TX_BW_40IN80,
|
||||
WL_TX_BW_160,
|
||||
WL_TX_BW_20IN160,
|
||||
WL_TX_BW_40IN160,
|
||||
WL_TX_BW_80IN160,
|
||||
WL_TX_BW_ALL,
|
||||
WL_TX_BW_8080,
|
||||
WL_TX_BW_8080CHAN2,
|
||||
WL_TX_BW_20IN8080,
|
||||
WL_TX_BW_40IN8080,
|
||||
WL_TX_BW_80IN8080,
|
||||
WL_TX_BW_2P5,
|
||||
WL_TX_BW_5,
|
||||
WL_TX_BW_10
|
||||
} wl_tx_bw_t;
|
||||
|
||||
|
||||
/*
|
||||
* Transmit modes.
|
||||
* Not all modes are listed here, only those required for disambiguation. e.g. SPEXP is not listed
|
||||
*/
|
||||
typedef enum wl_tx_mode {
|
||||
WL_TX_MODE_NONE,
|
||||
WL_TX_MODE_STBC,
|
||||
WL_TX_MODE_CDD,
|
||||
WL_TX_MODE_TXBF,
|
||||
WL_NUM_TX_MODES
|
||||
} wl_tx_mode_t;
|
||||
|
||||
|
||||
/* Number of transmit chains */
|
||||
typedef enum wl_tx_chains {
|
||||
WL_TX_CHAINS_1 = 1,
|
||||
WL_TX_CHAINS_2,
|
||||
WL_TX_CHAINS_3,
|
||||
WL_TX_CHAINS_4
|
||||
} wl_tx_chains_t;
|
||||
|
||||
|
||||
/* Number of transmit streams */
|
||||
typedef enum wl_tx_nss {
|
||||
WL_TX_NSS_1 = 1,
|
||||
WL_TX_NSS_2,
|
||||
WL_TX_NSS_3,
|
||||
WL_TX_NSS_4
|
||||
} wl_tx_nss_t;
|
||||
|
||||
|
||||
/* This enum maps each rate to a CLM index */
|
||||
|
||||
typedef enum clm_rates {
|
||||
/************
|
||||
* 1 chain *
|
||||
************
|
||||
*/
|
||||
|
||||
/* 1 Stream */
|
||||
WL_RATE_1X1_DSSS_1 = 0,
|
||||
WL_RATE_1X1_DSSS_2 = 1,
|
||||
WL_RATE_1X1_DSSS_5_5 = 2,
|
||||
WL_RATE_1X1_DSSS_11 = 3,
|
||||
|
||||
WL_RATE_1X1_OFDM_6 = 4,
|
||||
WL_RATE_1X1_OFDM_9 = 5,
|
||||
WL_RATE_1X1_OFDM_12 = 6,
|
||||
WL_RATE_1X1_OFDM_18 = 7,
|
||||
WL_RATE_1X1_OFDM_24 = 8,
|
||||
WL_RATE_1X1_OFDM_36 = 9,
|
||||
WL_RATE_1X1_OFDM_48 = 10,
|
||||
WL_RATE_1X1_OFDM_54 = 11,
|
||||
|
||||
WL_RATE_1X1_MCS0 = 12,
|
||||
WL_RATE_1X1_MCS1 = 13,
|
||||
WL_RATE_1X1_MCS2 = 14,
|
||||
WL_RATE_1X1_MCS3 = 15,
|
||||
WL_RATE_1X1_MCS4 = 16,
|
||||
WL_RATE_1X1_MCS5 = 17,
|
||||
WL_RATE_1X1_MCS6 = 18,
|
||||
WL_RATE_1X1_MCS7 = 19,
|
||||
WL_RATE_P_1X1_MCS87 = 20,
|
||||
WL_RATE_P_1X1_MCS88 = 21,
|
||||
|
||||
WL_RATE_1X1_VHT0SS1 = 12,
|
||||
WL_RATE_1X1_VHT1SS1 = 13,
|
||||
WL_RATE_1X1_VHT2SS1 = 14,
|
||||
WL_RATE_1X1_VHT3SS1 = 15,
|
||||
WL_RATE_1X1_VHT4SS1 = 16,
|
||||
WL_RATE_1X1_VHT5SS1 = 17,
|
||||
WL_RATE_1X1_VHT6SS1 = 18,
|
||||
WL_RATE_1X1_VHT7SS1 = 19,
|
||||
WL_RATE_1X1_VHT8SS1 = 20,
|
||||
WL_RATE_1X1_VHT9SS1 = 21,
|
||||
WL_RATE_P_1X1_VHT10SS1 = 22,
|
||||
WL_RATE_P_1X1_VHT11SS1 = 23,
|
||||
|
||||
|
||||
/************
|
||||
* 2 chains *
|
||||
************
|
||||
*/
|
||||
|
||||
/* 1 Stream expanded + 1 */
|
||||
WL_RATE_1X2_DSSS_1 = 24,
|
||||
WL_RATE_1X2_DSSS_2 = 25,
|
||||
WL_RATE_1X2_DSSS_5_5 = 26,
|
||||
WL_RATE_1X2_DSSS_11 = 27,
|
||||
|
||||
WL_RATE_1X2_CDD_OFDM_6 = 28,
|
||||
WL_RATE_1X2_CDD_OFDM_9 = 29,
|
||||
WL_RATE_1X2_CDD_OFDM_12 = 30,
|
||||
WL_RATE_1X2_CDD_OFDM_18 = 31,
|
||||
WL_RATE_1X2_CDD_OFDM_24 = 32,
|
||||
WL_RATE_1X2_CDD_OFDM_36 = 33,
|
||||
WL_RATE_1X2_CDD_OFDM_48 = 34,
|
||||
WL_RATE_1X2_CDD_OFDM_54 = 35,
|
||||
|
||||
WL_RATE_1X2_CDD_MCS0 = 36,
|
||||
WL_RATE_1X2_CDD_MCS1 = 37,
|
||||
WL_RATE_1X2_CDD_MCS2 = 38,
|
||||
WL_RATE_1X2_CDD_MCS3 = 39,
|
||||
WL_RATE_1X2_CDD_MCS4 = 40,
|
||||
WL_RATE_1X2_CDD_MCS5 = 41,
|
||||
WL_RATE_1X2_CDD_MCS6 = 42,
|
||||
WL_RATE_1X2_CDD_MCS7 = 43,
|
||||
WL_RATE_P_1X2_CDD_MCS87 = 44,
|
||||
WL_RATE_P_1X2_CDD_MCS88 = 45,
|
||||
|
||||
WL_RATE_1X2_VHT0SS1 = 36,
|
||||
WL_RATE_1X2_VHT1SS1 = 37,
|
||||
WL_RATE_1X2_VHT2SS1 = 38,
|
||||
WL_RATE_1X2_VHT3SS1 = 39,
|
||||
WL_RATE_1X2_VHT4SS1 = 40,
|
||||
WL_RATE_1X2_VHT5SS1 = 41,
|
||||
WL_RATE_1X2_VHT6SS1 = 42,
|
||||
WL_RATE_1X2_VHT7SS1 = 43,
|
||||
WL_RATE_1X2_VHT8SS1 = 44,
|
||||
WL_RATE_1X2_VHT9SS1 = 45,
|
||||
WL_RATE_P_1X2_VHT10SS1 = 46,
|
||||
WL_RATE_P_1X2_VHT11SS1 = 47,
|
||||
|
||||
/* 2 Streams */
|
||||
WL_RATE_2X2_STBC_MCS0 = 48,
|
||||
WL_RATE_2X2_STBC_MCS1 = 49,
|
||||
WL_RATE_2X2_STBC_MCS2 = 50,
|
||||
WL_RATE_2X2_STBC_MCS3 = 51,
|
||||
WL_RATE_2X2_STBC_MCS4 = 52,
|
||||
WL_RATE_2X2_STBC_MCS5 = 53,
|
||||
WL_RATE_2X2_STBC_MCS6 = 54,
|
||||
WL_RATE_2X2_STBC_MCS7 = 55,
|
||||
WL_RATE_P_2X2_STBC_MCS87 = 56,
|
||||
WL_RATE_P_2X2_STBC_MCS88 = 57,
|
||||
|
||||
WL_RATE_2X2_STBC_VHT0SS1 = 48,
|
||||
WL_RATE_2X2_STBC_VHT1SS1 = 49,
|
||||
WL_RATE_2X2_STBC_VHT2SS1 = 50,
|
||||
WL_RATE_2X2_STBC_VHT3SS1 = 51,
|
||||
WL_RATE_2X2_STBC_VHT4SS1 = 52,
|
||||
WL_RATE_2X2_STBC_VHT5SS1 = 53,
|
||||
WL_RATE_2X2_STBC_VHT6SS1 = 54,
|
||||
WL_RATE_2X2_STBC_VHT7SS1 = 55,
|
||||
WL_RATE_2X2_STBC_VHT8SS1 = 56,
|
||||
WL_RATE_2X2_STBC_VHT9SS1 = 57,
|
||||
WL_RATE_P_2X2_STBC_VHT10SS1 = 58,
|
||||
WL_RATE_P_2X2_STBC_VHT11SS1 = 59,
|
||||
|
||||
WL_RATE_2X2_SDM_MCS8 = 60,
|
||||
WL_RATE_2X2_SDM_MCS9 = 61,
|
||||
WL_RATE_2X2_SDM_MCS10 = 62,
|
||||
WL_RATE_2X2_SDM_MCS11 = 63,
|
||||
WL_RATE_2X2_SDM_MCS12 = 64,
|
||||
WL_RATE_2X2_SDM_MCS13 = 65,
|
||||
WL_RATE_2X2_SDM_MCS14 = 66,
|
||||
WL_RATE_2X2_SDM_MCS15 = 67,
|
||||
WL_RATE_P_2X2_SDM_MCS99 = 68,
|
||||
WL_RATE_P_2X2_SDM_MCS100 = 69,
|
||||
|
||||
WL_RATE_2X2_VHT0SS2 = 60,
|
||||
WL_RATE_2X2_VHT1SS2 = 61,
|
||||
WL_RATE_2X2_VHT2SS2 = 62,
|
||||
WL_RATE_2X2_VHT3SS2 = 63,
|
||||
WL_RATE_2X2_VHT4SS2 = 64,
|
||||
WL_RATE_2X2_VHT5SS2 = 65,
|
||||
WL_RATE_2X2_VHT6SS2 = 66,
|
||||
WL_RATE_2X2_VHT7SS2 = 67,
|
||||
WL_RATE_2X2_VHT8SS2 = 68,
|
||||
WL_RATE_2X2_VHT9SS2 = 69,
|
||||
WL_RATE_P_2X2_VHT10SS2 = 70,
|
||||
WL_RATE_P_2X2_VHT11SS2 = 71,
|
||||
|
||||
/****************************
|
||||
* TX Beamforming, 2 chains *
|
||||
****************************
|
||||
*/
|
||||
|
||||
/* 1 Stream expanded + 1 */
|
||||
WL_RATE_1X2_TXBF_OFDM_6 = 72,
|
||||
WL_RATE_1X2_TXBF_OFDM_9 = 73,
|
||||
WL_RATE_1X2_TXBF_OFDM_12 = 74,
|
||||
WL_RATE_1X2_TXBF_OFDM_18 = 75,
|
||||
WL_RATE_1X2_TXBF_OFDM_24 = 76,
|
||||
WL_RATE_1X2_TXBF_OFDM_36 = 77,
|
||||
WL_RATE_1X2_TXBF_OFDM_48 = 78,
|
||||
WL_RATE_1X2_TXBF_OFDM_54 = 79,
|
||||
|
||||
WL_RATE_1X2_TXBF_MCS0 = 80,
|
||||
WL_RATE_1X2_TXBF_MCS1 = 81,
|
||||
WL_RATE_1X2_TXBF_MCS2 = 82,
|
||||
WL_RATE_1X2_TXBF_MCS3 = 83,
|
||||
WL_RATE_1X2_TXBF_MCS4 = 84,
|
||||
WL_RATE_1X2_TXBF_MCS5 = 85,
|
||||
WL_RATE_1X2_TXBF_MCS6 = 86,
|
||||
WL_RATE_1X2_TXBF_MCS7 = 87,
|
||||
WL_RATE_P_1X2_TXBF_MCS87 = 88,
|
||||
WL_RATE_P_1X2_TXBF_MCS88 = 89,
|
||||
|
||||
WL_RATE_1X2_TXBF_VHT0SS1 = 80,
|
||||
WL_RATE_1X2_TXBF_VHT1SS1 = 81,
|
||||
WL_RATE_1X2_TXBF_VHT2SS1 = 82,
|
||||
WL_RATE_1X2_TXBF_VHT3SS1 = 83,
|
||||
WL_RATE_1X2_TXBF_VHT4SS1 = 84,
|
||||
WL_RATE_1X2_TXBF_VHT5SS1 = 85,
|
||||
WL_RATE_1X2_TXBF_VHT6SS1 = 86,
|
||||
WL_RATE_1X2_TXBF_VHT7SS1 = 87,
|
||||
WL_RATE_1X2_TXBF_VHT8SS1 = 88,
|
||||
WL_RATE_1X2_TXBF_VHT9SS1 = 89,
|
||||
WL_RATE_P_1X2_TXBF_VHT10SS1 = 90,
|
||||
WL_RATE_P_1X2_TXBF_VHT11SS1 = 91,
|
||||
|
||||
/* 2 Streams */
|
||||
WL_RATE_2X2_TXBF_SDM_MCS8 = 92,
|
||||
WL_RATE_2X2_TXBF_SDM_MCS9 = 93,
|
||||
WL_RATE_2X2_TXBF_SDM_MCS10 = 94,
|
||||
WL_RATE_2X2_TXBF_SDM_MCS11 = 95,
|
||||
WL_RATE_2X2_TXBF_SDM_MCS12 = 96,
|
||||
WL_RATE_2X2_TXBF_SDM_MCS13 = 97,
|
||||
WL_RATE_2X2_TXBF_SDM_MCS14 = 98,
|
||||
WL_RATE_2X2_TXBF_SDM_MCS15 = 99,
|
||||
WL_RATE_P_2X2_TXBF_SDM_MCS99 = 100,
|
||||
WL_RATE_P_2X2_TXBF_SDM_MCS100 = 101,
|
||||
|
||||
WL_RATE_2X2_TXBF_VHT0SS2 = 92,
|
||||
WL_RATE_2X2_TXBF_VHT1SS2 = 93,
|
||||
WL_RATE_2X2_TXBF_VHT2SS2 = 94,
|
||||
WL_RATE_2X2_TXBF_VHT3SS2 = 95,
|
||||
WL_RATE_2X2_TXBF_VHT4SS2 = 96,
|
||||
WL_RATE_2X2_TXBF_VHT5SS2 = 97,
|
||||
WL_RATE_2X2_TXBF_VHT6SS2 = 98,
|
||||
WL_RATE_2X2_TXBF_VHT7SS2 = 99,
|
||||
WL_RATE_2X2_TXBF_VHT8SS2 = 100,
|
||||
WL_RATE_2X2_TXBF_VHT9SS2 = 101,
|
||||
WL_RATE_P_2X2_TXBF_VHT10SS2 = 102,
|
||||
WL_RATE_P_2X2_TXBF_VHT11SS2 = 103,
|
||||
|
||||
|
||||
/************
|
||||
* 3 chains *
|
||||
************
|
||||
*/
|
||||
|
||||
/* 1 Stream expanded + 2 */
|
||||
WL_RATE_1X3_DSSS_1 = 104,
|
||||
WL_RATE_1X3_DSSS_2 = 105,
|
||||
WL_RATE_1X3_DSSS_5_5 = 106,
|
||||
WL_RATE_1X3_DSSS_11 = 107,
|
||||
|
||||
WL_RATE_1X3_CDD_OFDM_6 = 108,
|
||||
WL_RATE_1X3_CDD_OFDM_9 = 109,
|
||||
WL_RATE_1X3_CDD_OFDM_12 = 110,
|
||||
WL_RATE_1X3_CDD_OFDM_18 = 111,
|
||||
WL_RATE_1X3_CDD_OFDM_24 = 112,
|
||||
WL_RATE_1X3_CDD_OFDM_36 = 113,
|
||||
WL_RATE_1X3_CDD_OFDM_48 = 114,
|
||||
WL_RATE_1X3_CDD_OFDM_54 = 115,
|
||||
|
||||
WL_RATE_1X3_CDD_MCS0 = 116,
|
||||
WL_RATE_1X3_CDD_MCS1 = 117,
|
||||
WL_RATE_1X3_CDD_MCS2 = 118,
|
||||
WL_RATE_1X3_CDD_MCS3 = 119,
|
||||
WL_RATE_1X3_CDD_MCS4 = 120,
|
||||
WL_RATE_1X3_CDD_MCS5 = 121,
|
||||
WL_RATE_1X3_CDD_MCS6 = 122,
|
||||
WL_RATE_1X3_CDD_MCS7 = 123,
|
||||
WL_RATE_P_1X3_CDD_MCS87 = 124,
|
||||
WL_RATE_P_1X3_CDD_MCS88 = 125,
|
||||
|
||||
WL_RATE_1X3_VHT0SS1 = 116,
|
||||
WL_RATE_1X3_VHT1SS1 = 117,
|
||||
WL_RATE_1X3_VHT2SS1 = 118,
|
||||
WL_RATE_1X3_VHT3SS1 = 119,
|
||||
WL_RATE_1X3_VHT4SS1 = 120,
|
||||
WL_RATE_1X3_VHT5SS1 = 121,
|
||||
WL_RATE_1X3_VHT6SS1 = 122,
|
||||
WL_RATE_1X3_VHT7SS1 = 123,
|
||||
WL_RATE_1X3_VHT8SS1 = 124,
|
||||
WL_RATE_1X3_VHT9SS1 = 125,
|
||||
WL_RATE_P_1X3_VHT10SS1 = 126,
|
||||
WL_RATE_P_1X3_VHT11SS1 = 127,
|
||||
|
||||
/* 2 Streams expanded + 1 */
|
||||
WL_RATE_2X3_STBC_MCS0 = 128,
|
||||
WL_RATE_2X3_STBC_MCS1 = 129,
|
||||
WL_RATE_2X3_STBC_MCS2 = 130,
|
||||
WL_RATE_2X3_STBC_MCS3 = 131,
|
||||
WL_RATE_2X3_STBC_MCS4 = 132,
|
||||
WL_RATE_2X3_STBC_MCS5 = 133,
|
||||
WL_RATE_2X3_STBC_MCS6 = 134,
|
||||
WL_RATE_2X3_STBC_MCS7 = 135,
|
||||
WL_RATE_P_2X3_STBC_MCS87 = 136,
|
||||
WL_RATE_P_2X3_STBC_MCS88 = 137,
|
||||
|
||||
WL_RATE_2X3_STBC_VHT0SS1 = 128,
|
||||
WL_RATE_2X3_STBC_VHT1SS1 = 129,
|
||||
WL_RATE_2X3_STBC_VHT2SS1 = 130,
|
||||
WL_RATE_2X3_STBC_VHT3SS1 = 131,
|
||||
WL_RATE_2X3_STBC_VHT4SS1 = 132,
|
||||
WL_RATE_2X3_STBC_VHT5SS1 = 133,
|
||||
WL_RATE_2X3_STBC_VHT6SS1 = 134,
|
||||
WL_RATE_2X3_STBC_VHT7SS1 = 135,
|
||||
WL_RATE_2X3_STBC_VHT8SS1 = 136,
|
||||
WL_RATE_2X3_STBC_VHT9SS1 = 137,
|
||||
WL_RATE_P_2X3_STBC_VHT10SS1 = 138,
|
||||
WL_RATE_P_2X3_STBC_VHT11SS1 = 139,
|
||||
|
||||
WL_RATE_2X3_SDM_MCS8 = 140,
|
||||
WL_RATE_2X3_SDM_MCS9 = 141,
|
||||
WL_RATE_2X3_SDM_MCS10 = 142,
|
||||
WL_RATE_2X3_SDM_MCS11 = 143,
|
||||
WL_RATE_2X3_SDM_MCS12 = 144,
|
||||
WL_RATE_2X3_SDM_MCS13 = 145,
|
||||
WL_RATE_2X3_SDM_MCS14 = 146,
|
||||
WL_RATE_2X3_SDM_MCS15 = 147,
|
||||
WL_RATE_P_2X3_SDM_MCS99 = 148,
|
||||
WL_RATE_P_2X3_SDM_MCS100 = 149,
|
||||
|
||||
WL_RATE_2X3_VHT0SS2 = 140,
|
||||
WL_RATE_2X3_VHT1SS2 = 141,
|
||||
WL_RATE_2X3_VHT2SS2 = 142,
|
||||
WL_RATE_2X3_VHT3SS2 = 143,
|
||||
WL_RATE_2X3_VHT4SS2 = 144,
|
||||
WL_RATE_2X3_VHT5SS2 = 145,
|
||||
WL_RATE_2X3_VHT6SS2 = 146,
|
||||
WL_RATE_2X3_VHT7SS2 = 147,
|
||||
WL_RATE_2X3_VHT8SS2 = 148,
|
||||
WL_RATE_2X3_VHT9SS2 = 149,
|
||||
WL_RATE_P_2X3_VHT10SS2 = 150,
|
||||
WL_RATE_P_2X3_VHT11SS2 = 151,
|
||||
|
||||
/* 3 Streams */
|
||||
WL_RATE_3X3_SDM_MCS16 = 152,
|
||||
WL_RATE_3X3_SDM_MCS17 = 153,
|
||||
WL_RATE_3X3_SDM_MCS18 = 154,
|
||||
WL_RATE_3X3_SDM_MCS19 = 155,
|
||||
WL_RATE_3X3_SDM_MCS20 = 156,
|
||||
WL_RATE_3X3_SDM_MCS21 = 157,
|
||||
WL_RATE_3X3_SDM_MCS22 = 158,
|
||||
WL_RATE_3X3_SDM_MCS23 = 159,
|
||||
WL_RATE_P_3X3_SDM_MCS101 = 160,
|
||||
WL_RATE_P_3X3_SDM_MCS102 = 161,
|
||||
|
||||
WL_RATE_3X3_VHT0SS3 = 152,
|
||||
WL_RATE_3X3_VHT1SS3 = 153,
|
||||
WL_RATE_3X3_VHT2SS3 = 154,
|
||||
WL_RATE_3X3_VHT3SS3 = 155,
|
||||
WL_RATE_3X3_VHT4SS3 = 156,
|
||||
WL_RATE_3X3_VHT5SS3 = 157,
|
||||
WL_RATE_3X3_VHT6SS3 = 158,
|
||||
WL_RATE_3X3_VHT7SS3 = 159,
|
||||
WL_RATE_3X3_VHT8SS3 = 160,
|
||||
WL_RATE_3X3_VHT9SS3 = 161,
|
||||
WL_RATE_P_3X3_VHT10SS3 = 162,
|
||||
WL_RATE_P_3X3_VHT11SS3 = 163,
|
||||
|
||||
|
||||
/****************************
|
||||
* TX Beamforming, 3 chains *
|
||||
****************************
|
||||
*/
|
||||
|
||||
/* 1 Stream expanded + 2 */
|
||||
WL_RATE_1X3_TXBF_OFDM_6 = 164,
|
||||
WL_RATE_1X3_TXBF_OFDM_9 = 165,
|
||||
WL_RATE_1X3_TXBF_OFDM_12 = 166,
|
||||
WL_RATE_1X3_TXBF_OFDM_18 = 167,
|
||||
WL_RATE_1X3_TXBF_OFDM_24 = 168,
|
||||
WL_RATE_1X3_TXBF_OFDM_36 = 169,
|
||||
WL_RATE_1X3_TXBF_OFDM_48 = 170,
|
||||
WL_RATE_1X3_TXBF_OFDM_54 = 171,
|
||||
|
||||
WL_RATE_1X3_TXBF_MCS0 = 172,
|
||||
WL_RATE_1X3_TXBF_MCS1 = 173,
|
||||
WL_RATE_1X3_TXBF_MCS2 = 174,
|
||||
WL_RATE_1X3_TXBF_MCS3 = 175,
|
||||
WL_RATE_1X3_TXBF_MCS4 = 176,
|
||||
WL_RATE_1X3_TXBF_MCS5 = 177,
|
||||
WL_RATE_1X3_TXBF_MCS6 = 178,
|
||||
WL_RATE_1X3_TXBF_MCS7 = 179,
|
||||
WL_RATE_P_1X3_TXBF_MCS87 = 180,
|
||||
WL_RATE_P_1X3_TXBF_MCS88 = 181,
|
||||
|
||||
WL_RATE_1X3_TXBF_VHT0SS1 = 172,
|
||||
WL_RATE_1X3_TXBF_VHT1SS1 = 173,
|
||||
WL_RATE_1X3_TXBF_VHT2SS1 = 174,
|
||||
WL_RATE_1X3_TXBF_VHT3SS1 = 175,
|
||||
WL_RATE_1X3_TXBF_VHT4SS1 = 176,
|
||||
WL_RATE_1X3_TXBF_VHT5SS1 = 177,
|
||||
WL_RATE_1X3_TXBF_VHT6SS1 = 178,
|
||||
WL_RATE_1X3_TXBF_VHT7SS1 = 179,
|
||||
WL_RATE_1X3_TXBF_VHT8SS1 = 180,
|
||||
WL_RATE_1X3_TXBF_VHT9SS1 = 181,
|
||||
WL_RATE_P_1X3_TXBF_VHT10SS1 = 182,
|
||||
WL_RATE_P_1X3_TXBF_VHT11SS1 = 183,
|
||||
|
||||
/* 2 Streams expanded + 1 */
|
||||
WL_RATE_2X3_TXBF_SDM_MCS8 = 184,
|
||||
WL_RATE_2X3_TXBF_SDM_MCS9 = 185,
|
||||
WL_RATE_2X3_TXBF_SDM_MCS10 = 186,
|
||||
WL_RATE_2X3_TXBF_SDM_MCS11 = 187,
|
||||
WL_RATE_2X3_TXBF_SDM_MCS12 = 188,
|
||||
WL_RATE_2X3_TXBF_SDM_MCS13 = 189,
|
||||
WL_RATE_2X3_TXBF_SDM_MCS14 = 190,
|
||||
WL_RATE_2X3_TXBF_SDM_MCS15 = 191,
|
||||
WL_RATE_P_2X3_TXBF_SDM_MCS99 = 192,
|
||||
WL_RATE_P_2X3_TXBF_SDM_MCS100 = 193,
|
||||
|
||||
WL_RATE_2X3_TXBF_VHT0SS2 = 184,
|
||||
WL_RATE_2X3_TXBF_VHT1SS2 = 185,
|
||||
WL_RATE_2X3_TXBF_VHT2SS2 = 186,
|
||||
WL_RATE_2X3_TXBF_VHT3SS2 = 187,
|
||||
WL_RATE_2X3_TXBF_VHT4SS2 = 188,
|
||||
WL_RATE_2X3_TXBF_VHT5SS2 = 189,
|
||||
WL_RATE_2X3_TXBF_VHT6SS2 = 190,
|
||||
WL_RATE_2X3_TXBF_VHT7SS2 = 191,
|
||||
WL_RATE_2X3_TXBF_VHT8SS2 = 192,
|
||||
WL_RATE_2X3_TXBF_VHT9SS2 = 193,
|
||||
WL_RATE_P_2X3_TXBF_VHT10SS2 = 194,
|
||||
WL_RATE_P_2X3_TXBF_VHT11SS2 = 195,
|
||||
|
||||
/* 3 Streams */
|
||||
WL_RATE_3X3_TXBF_SDM_MCS16 = 196,
|
||||
WL_RATE_3X3_TXBF_SDM_MCS17 = 197,
|
||||
WL_RATE_3X3_TXBF_SDM_MCS18 = 198,
|
||||
WL_RATE_3X3_TXBF_SDM_MCS19 = 199,
|
||||
WL_RATE_3X3_TXBF_SDM_MCS20 = 200,
|
||||
WL_RATE_3X3_TXBF_SDM_MCS21 = 201,
|
||||
WL_RATE_3X3_TXBF_SDM_MCS22 = 202,
|
||||
WL_RATE_3X3_TXBF_SDM_MCS23 = 203,
|
||||
WL_RATE_P_3X3_TXBF_SDM_MCS101 = 204,
|
||||
WL_RATE_P_3X3_TXBF_SDM_MCS102 = 205,
|
||||
|
||||
WL_RATE_3X3_TXBF_VHT0SS3 = 196,
|
||||
WL_RATE_3X3_TXBF_VHT1SS3 = 197,
|
||||
WL_RATE_3X3_TXBF_VHT2SS3 = 198,
|
||||
WL_RATE_3X3_TXBF_VHT3SS3 = 199,
|
||||
WL_RATE_3X3_TXBF_VHT4SS3 = 200,
|
||||
WL_RATE_3X3_TXBF_VHT5SS3 = 201,
|
||||
WL_RATE_3X3_TXBF_VHT6SS3 = 202,
|
||||
WL_RATE_3X3_TXBF_VHT7SS3 = 203,
|
||||
WL_RATE_3X3_TXBF_VHT8SS3 = 204,
|
||||
WL_RATE_3X3_TXBF_VHT9SS3 = 205,
|
||||
WL_RATE_P_3X3_TXBF_VHT10SS3 = 206,
|
||||
WL_RATE_P_3X3_TXBF_VHT11SS3 = 207,
|
||||
|
||||
|
||||
/************
|
||||
* 4 chains *
|
||||
************
|
||||
*/
|
||||
|
||||
/* 1 Stream expanded + 3 */
|
||||
WL_RATE_1X4_DSSS_1 = 208,
|
||||
WL_RATE_1X4_DSSS_2 = 209,
|
||||
WL_RATE_1X4_DSSS_5_5 = 210,
|
||||
WL_RATE_1X4_DSSS_11 = 211,
|
||||
|
||||
WL_RATE_1X4_CDD_OFDM_6 = 212,
|
||||
WL_RATE_1X4_CDD_OFDM_9 = 213,
|
||||
WL_RATE_1X4_CDD_OFDM_12 = 214,
|
||||
WL_RATE_1X4_CDD_OFDM_18 = 215,
|
||||
WL_RATE_1X4_CDD_OFDM_24 = 216,
|
||||
WL_RATE_1X4_CDD_OFDM_36 = 217,
|
||||
WL_RATE_1X4_CDD_OFDM_48 = 218,
|
||||
WL_RATE_1X4_CDD_OFDM_54 = 219,
|
||||
|
||||
WL_RATE_1X4_CDD_MCS0 = 220,
|
||||
WL_RATE_1X4_CDD_MCS1 = 221,
|
||||
WL_RATE_1X4_CDD_MCS2 = 222,
|
||||
WL_RATE_1X4_CDD_MCS3 = 223,
|
||||
WL_RATE_1X4_CDD_MCS4 = 224,
|
||||
WL_RATE_1X4_CDD_MCS5 = 225,
|
||||
WL_RATE_1X4_CDD_MCS6 = 226,
|
||||
WL_RATE_1X4_CDD_MCS7 = 227,
|
||||
WL_RATE_P_1X4_CDD_MCS87 = 228,
|
||||
WL_RATE_P_1X4_CDD_MCS88 = 229,
|
||||
|
||||
WL_RATE_1X4_VHT0SS1 = 220,
|
||||
WL_RATE_1X4_VHT1SS1 = 221,
|
||||
WL_RATE_1X4_VHT2SS1 = 222,
|
||||
WL_RATE_1X4_VHT3SS1 = 223,
|
||||
WL_RATE_1X4_VHT4SS1 = 224,
|
||||
WL_RATE_1X4_VHT5SS1 = 225,
|
||||
WL_RATE_1X4_VHT6SS1 = 226,
|
||||
WL_RATE_1X4_VHT7SS1 = 227,
|
||||
WL_RATE_1X4_VHT8SS1 = 228,
|
||||
WL_RATE_1X4_VHT9SS1 = 229,
|
||||
WL_RATE_P_1X4_VHT10SS1 = 230,
|
||||
WL_RATE_P_1X4_VHT11SS1 = 231,
|
||||
|
||||
/* 2 Streams expanded + 2 */
|
||||
WL_RATE_2X4_STBC_MCS0 = 232,
|
||||
WL_RATE_2X4_STBC_MCS1 = 233,
|
||||
WL_RATE_2X4_STBC_MCS2 = 234,
|
||||
WL_RATE_2X4_STBC_MCS3 = 235,
|
||||
WL_RATE_2X4_STBC_MCS4 = 236,
|
||||
WL_RATE_2X4_STBC_MCS5 = 237,
|
||||
WL_RATE_2X4_STBC_MCS6 = 238,
|
||||
WL_RATE_2X4_STBC_MCS7 = 239,
|
||||
WL_RATE_P_2X4_STBC_MCS87 = 240,
|
||||
WL_RATE_P_2X4_STBC_MCS88 = 241,
|
||||
|
||||
WL_RATE_2X4_STBC_VHT0SS1 = 232,
|
||||
WL_RATE_2X4_STBC_VHT1SS1 = 233,
|
||||
WL_RATE_2X4_STBC_VHT2SS1 = 234,
|
||||
WL_RATE_2X4_STBC_VHT3SS1 = 235,
|
||||
WL_RATE_2X4_STBC_VHT4SS1 = 236,
|
||||
WL_RATE_2X4_STBC_VHT5SS1 = 237,
|
||||
WL_RATE_2X4_STBC_VHT6SS1 = 238,
|
||||
WL_RATE_2X4_STBC_VHT7SS1 = 239,
|
||||
WL_RATE_2X4_STBC_VHT8SS1 = 240,
|
||||
WL_RATE_2X4_STBC_VHT9SS1 = 241,
|
||||
WL_RATE_P_2X4_STBC_VHT10SS1 = 242,
|
||||
WL_RATE_P_2X4_STBC_VHT11SS1 = 243,
|
||||
|
||||
WL_RATE_2X4_SDM_MCS8 = 244,
|
||||
WL_RATE_2X4_SDM_MCS9 = 245,
|
||||
WL_RATE_2X4_SDM_MCS10 = 246,
|
||||
WL_RATE_2X4_SDM_MCS11 = 247,
|
||||
WL_RATE_2X4_SDM_MCS12 = 248,
|
||||
WL_RATE_2X4_SDM_MCS13 = 249,
|
||||
WL_RATE_2X4_SDM_MCS14 = 250,
|
||||
WL_RATE_2X4_SDM_MCS15 = 251,
|
||||
WL_RATE_P_2X4_SDM_MCS99 = 252,
|
||||
WL_RATE_P_2X4_SDM_MCS100 = 253,
|
||||
|
||||
WL_RATE_2X4_VHT0SS2 = 244,
|
||||
WL_RATE_2X4_VHT1SS2 = 245,
|
||||
WL_RATE_2X4_VHT2SS2 = 246,
|
||||
WL_RATE_2X4_VHT3SS2 = 247,
|
||||
WL_RATE_2X4_VHT4SS2 = 248,
|
||||
WL_RATE_2X4_VHT5SS2 = 249,
|
||||
WL_RATE_2X4_VHT6SS2 = 250,
|
||||
WL_RATE_2X4_VHT7SS2 = 251,
|
||||
WL_RATE_2X4_VHT8SS2 = 252,
|
||||
WL_RATE_2X4_VHT9SS2 = 253,
|
||||
WL_RATE_P_2X4_VHT10SS2 = 254,
|
||||
WL_RATE_P_2X4_VHT11SS2 = 255,
|
||||
|
||||
/* 3 Streams expanded + 1 */
|
||||
WL_RATE_3X4_SDM_MCS16 = 256,
|
||||
WL_RATE_3X4_SDM_MCS17 = 257,
|
||||
WL_RATE_3X4_SDM_MCS18 = 258,
|
||||
WL_RATE_3X4_SDM_MCS19 = 259,
|
||||
WL_RATE_3X4_SDM_MCS20 = 260,
|
||||
WL_RATE_3X4_SDM_MCS21 = 261,
|
||||
WL_RATE_3X4_SDM_MCS22 = 262,
|
||||
WL_RATE_3X4_SDM_MCS23 = 263,
|
||||
WL_RATE_P_3X4_SDM_MCS101 = 264,
|
||||
WL_RATE_P_3X4_SDM_MCS102 = 265,
|
||||
|
||||
WL_RATE_3X4_VHT0SS3 = 256,
|
||||
WL_RATE_3X4_VHT1SS3 = 257,
|
||||
WL_RATE_3X4_VHT2SS3 = 258,
|
||||
WL_RATE_3X4_VHT3SS3 = 259,
|
||||
WL_RATE_3X4_VHT4SS3 = 260,
|
||||
WL_RATE_3X4_VHT5SS3 = 261,
|
||||
WL_RATE_3X4_VHT6SS3 = 262,
|
||||
WL_RATE_3X4_VHT7SS3 = 263,
|
||||
WL_RATE_3X4_VHT8SS3 = 264,
|
||||
WL_RATE_3X4_VHT9SS3 = 265,
|
||||
WL_RATE_P_3X4_VHT10SS3 = 266,
|
||||
WL_RATE_P_3X4_VHT11SS3 = 267,
|
||||
|
||||
|
||||
/* 4 Streams */
|
||||
WL_RATE_4X4_SDM_MCS24 = 268,
|
||||
WL_RATE_4X4_SDM_MCS25 = 269,
|
||||
WL_RATE_4X4_SDM_MCS26 = 270,
|
||||
WL_RATE_4X4_SDM_MCS27 = 271,
|
||||
WL_RATE_4X4_SDM_MCS28 = 272,
|
||||
WL_RATE_4X4_SDM_MCS29 = 273,
|
||||
WL_RATE_4X4_SDM_MCS30 = 274,
|
||||
WL_RATE_4X4_SDM_MCS31 = 275,
|
||||
WL_RATE_P_4X4_SDM_MCS103 = 276,
|
||||
WL_RATE_P_4X4_SDM_MCS104 = 277,
|
||||
|
||||
WL_RATE_4X4_VHT0SS4 = 268,
|
||||
WL_RATE_4X4_VHT1SS4 = 269,
|
||||
WL_RATE_4X4_VHT2SS4 = 270,
|
||||
WL_RATE_4X4_VHT3SS4 = 271,
|
||||
WL_RATE_4X4_VHT4SS4 = 272,
|
||||
WL_RATE_4X4_VHT5SS4 = 273,
|
||||
WL_RATE_4X4_VHT6SS4 = 274,
|
||||
WL_RATE_4X4_VHT7SS4 = 275,
|
||||
WL_RATE_4X4_VHT8SS4 = 276,
|
||||
WL_RATE_4X4_VHT9SS4 = 277,
|
||||
WL_RATE_P_4X4_VHT10SS4 = 278,
|
||||
WL_RATE_P_4X4_VHT11SS4 = 279,
|
||||
|
||||
|
||||
/****************************
|
||||
* TX Beamforming, 4 chains *
|
||||
****************************
|
||||
*/
|
||||
|
||||
/* 1 Stream expanded + 3 */
|
||||
WL_RATE_1X4_TXBF_OFDM_6 = 280,
|
||||
WL_RATE_1X4_TXBF_OFDM_9 = 281,
|
||||
WL_RATE_1X4_TXBF_OFDM_12 = 282,
|
||||
WL_RATE_1X4_TXBF_OFDM_18 = 283,
|
||||
WL_RATE_1X4_TXBF_OFDM_24 = 284,
|
||||
WL_RATE_1X4_TXBF_OFDM_36 = 285,
|
||||
WL_RATE_1X4_TXBF_OFDM_48 = 286,
|
||||
WL_RATE_1X4_TXBF_OFDM_54 = 287,
|
||||
|
||||
WL_RATE_1X4_TXBF_MCS0 = 288,
|
||||
WL_RATE_1X4_TXBF_MCS1 = 289,
|
||||
WL_RATE_1X4_TXBF_MCS2 = 290,
|
||||
WL_RATE_1X4_TXBF_MCS3 = 291,
|
||||
WL_RATE_1X4_TXBF_MCS4 = 292,
|
||||
WL_RATE_1X4_TXBF_MCS5 = 293,
|
||||
WL_RATE_1X4_TXBF_MCS6 = 294,
|
||||
WL_RATE_1X4_TXBF_MCS7 = 295,
|
||||
WL_RATE_P_1X4_TXBF_MCS87 = 296,
|
||||
WL_RATE_P_1X4_TXBF_MCS88 = 297,
|
||||
|
||||
WL_RATE_1X4_TXBF_VHT0SS1 = 288,
|
||||
WL_RATE_1X4_TXBF_VHT1SS1 = 289,
|
||||
WL_RATE_1X4_TXBF_VHT2SS1 = 290,
|
||||
WL_RATE_1X4_TXBF_VHT3SS1 = 291,
|
||||
WL_RATE_1X4_TXBF_VHT4SS1 = 292,
|
||||
WL_RATE_1X4_TXBF_VHT5SS1 = 293,
|
||||
WL_RATE_1X4_TXBF_VHT6SS1 = 294,
|
||||
WL_RATE_1X4_TXBF_VHT7SS1 = 295,
|
||||
WL_RATE_1X4_TXBF_VHT8SS1 = 296,
|
||||
WL_RATE_1X4_TXBF_VHT9SS1 = 297,
|
||||
WL_RATE_P_1X4_TXBF_VHT10SS1 = 298,
|
||||
WL_RATE_P_1X4_TXBF_VHT11SS1 = 299,
|
||||
|
||||
/* 2 Streams expanded + 2 */
|
||||
WL_RATE_2X4_TXBF_SDM_MCS8 = 300,
|
||||
WL_RATE_2X4_TXBF_SDM_MCS9 = 301,
|
||||
WL_RATE_2X4_TXBF_SDM_MCS10 = 302,
|
||||
WL_RATE_2X4_TXBF_SDM_MCS11 = 303,
|
||||
WL_RATE_2X4_TXBF_SDM_MCS12 = 304,
|
||||
WL_RATE_2X4_TXBF_SDM_MCS13 = 305,
|
||||
WL_RATE_2X4_TXBF_SDM_MCS14 = 306,
|
||||
WL_RATE_2X4_TXBF_SDM_MCS15 = 307,
|
||||
WL_RATE_P_2X4_TXBF_SDM_MCS99 = 308,
|
||||
WL_RATE_P_2X4_TXBF_SDM_MCS100 = 309,
|
||||
|
||||
WL_RATE_2X4_TXBF_VHT0SS2 = 300,
|
||||
WL_RATE_2X4_TXBF_VHT1SS2 = 301,
|
||||
WL_RATE_2X4_TXBF_VHT2SS2 = 302,
|
||||
WL_RATE_2X4_TXBF_VHT3SS2 = 303,
|
||||
WL_RATE_2X4_TXBF_VHT4SS2 = 304,
|
||||
WL_RATE_2X4_TXBF_VHT5SS2 = 305,
|
||||
WL_RATE_2X4_TXBF_VHT6SS2 = 306,
|
||||
WL_RATE_2X4_TXBF_VHT7SS2 = 307,
|
||||
WL_RATE_2X4_TXBF_VHT8SS2 = 308,
|
||||
WL_RATE_2X4_TXBF_VHT9SS2 = 309,
|
||||
WL_RATE_P_2X4_TXBF_VHT10SS2 = 310,
|
||||
WL_RATE_P_2X4_TXBF_VHT11SS2 = 311,
|
||||
|
||||
/* 3 Streams expanded + 1 */
|
||||
WL_RATE_3X4_TXBF_SDM_MCS16 = 312,
|
||||
WL_RATE_3X4_TXBF_SDM_MCS17 = 313,
|
||||
WL_RATE_3X4_TXBF_SDM_MCS18 = 314,
|
||||
WL_RATE_3X4_TXBF_SDM_MCS19 = 315,
|
||||
WL_RATE_3X4_TXBF_SDM_MCS20 = 316,
|
||||
WL_RATE_3X4_TXBF_SDM_MCS21 = 317,
|
||||
WL_RATE_3X4_TXBF_SDM_MCS22 = 318,
|
||||
WL_RATE_3X4_TXBF_SDM_MCS23 = 319,
|
||||
WL_RATE_P_3X4_TXBF_SDM_MCS101 = 320,
|
||||
WL_RATE_P_3X4_TXBF_SDM_MCS102 = 321,
|
||||
|
||||
WL_RATE_3X4_TXBF_VHT0SS3 = 312,
|
||||
WL_RATE_3X4_TXBF_VHT1SS3 = 313,
|
||||
WL_RATE_3X4_TXBF_VHT2SS3 = 314,
|
||||
WL_RATE_3X4_TXBF_VHT3SS3 = 315,
|
||||
WL_RATE_3X4_TXBF_VHT4SS3 = 316,
|
||||
WL_RATE_3X4_TXBF_VHT5SS3 = 317,
|
||||
WL_RATE_3X4_TXBF_VHT6SS3 = 318,
|
||||
WL_RATE_3X4_TXBF_VHT7SS3 = 319,
|
||||
WL_RATE_P_3X4_TXBF_VHT8SS3 = 320,
|
||||
WL_RATE_P_3X4_TXBF_VHT9SS3 = 321,
|
||||
WL_RATE_P_3X4_TXBF_VHT10SS3 = 322,
|
||||
WL_RATE_P_3X4_TXBF_VHT11SS3 = 323,
|
||||
|
||||
/* 4 Streams */
|
||||
WL_RATE_4X4_TXBF_SDM_MCS24 = 324,
|
||||
WL_RATE_4X4_TXBF_SDM_MCS25 = 325,
|
||||
WL_RATE_4X4_TXBF_SDM_MCS26 = 326,
|
||||
WL_RATE_4X4_TXBF_SDM_MCS27 = 327,
|
||||
WL_RATE_4X4_TXBF_SDM_MCS28 = 328,
|
||||
WL_RATE_4X4_TXBF_SDM_MCS29 = 329,
|
||||
WL_RATE_4X4_TXBF_SDM_MCS30 = 330,
|
||||
WL_RATE_4X4_TXBF_SDM_MCS31 = 331,
|
||||
WL_RATE_P_4X4_TXBF_SDM_MCS103 = 332,
|
||||
WL_RATE_P_4X4_TXBF_SDM_MCS104 = 333,
|
||||
|
||||
WL_RATE_4X4_TXBF_VHT0SS4 = 324,
|
||||
WL_RATE_4X4_TXBF_VHT1SS4 = 325,
|
||||
WL_RATE_4X4_TXBF_VHT2SS4 = 326,
|
||||
WL_RATE_4X4_TXBF_VHT3SS4 = 327,
|
||||
WL_RATE_4X4_TXBF_VHT4SS4 = 328,
|
||||
WL_RATE_4X4_TXBF_VHT5SS4 = 329,
|
||||
WL_RATE_4X4_TXBF_VHT6SS4 = 330,
|
||||
WL_RATE_4X4_TXBF_VHT7SS4 = 331,
|
||||
WL_RATE_P_4X4_TXBF_VHT8SS4 = 332,
|
||||
WL_RATE_P_4X4_TXBF_VHT9SS4 = 333,
|
||||
WL_RATE_P_4X4_TXBF_VHT10SS4 = 334,
|
||||
WL_RATE_P_4X4_TXBF_VHT11SS4 = 335
|
||||
|
||||
} clm_rates_t;
|
||||
|
||||
/* Number of rate codes */
|
||||
#define WL_NUMRATES 336
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* _bcmwifi_rates_h_ */
|
|
@ -0,0 +1,457 @@
|
|||
/*
|
||||
* Driver O/S-independent utility routines
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: bcmxtlv.c 628611 2016-03-31 17:53:25Z $
|
||||
*/
|
||||
|
||||
#include <bcm_cfg.h>
|
||||
|
||||
#include <typedefs.h>
|
||||
#include <bcmdefs.h>
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifdef BCMDRIVER
|
||||
#include <osl.h>
|
||||
#else /* !BCMDRIVER */
|
||||
#include <stdlib.h> /* AS!!! */
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#ifndef ASSERT
|
||||
#define ASSERT(exp)
|
||||
#endif
|
||||
INLINE void* MALLOCZ(void *o, size_t s) { BCM_REFERENCE(o); return calloc(1, s); }
|
||||
INLINE void MFREE(void *o, void *p, size_t s) { BCM_REFERENCE(o); BCM_REFERENCE(s); free(p); }
|
||||
#endif /* !BCMDRIVER */
|
||||
|
||||
#include <bcmendian.h>
|
||||
#include <bcmutils.h>
|
||||
|
||||
static INLINE int bcm_xtlv_size_for_data(int dlen, bcm_xtlv_opts_t opts)
|
||||
{
|
||||
return ((opts & BCM_XTLV_OPTION_ALIGN32) ? ALIGN_SIZE(dlen + BCM_XTLV_HDR_SIZE, 4)
|
||||
: (dlen + BCM_XTLV_HDR_SIZE));
|
||||
}
|
||||
|
||||
bcm_xtlv_t *
|
||||
bcm_next_xtlv(bcm_xtlv_t *elt, int *buflen, bcm_xtlv_opts_t opts)
|
||||
{
|
||||
int sz;
|
||||
/* advance to next elt */
|
||||
sz = BCM_XTLV_SIZE(elt, opts);
|
||||
elt = (bcm_xtlv_t*)((uint8 *)elt + sz);
|
||||
*buflen -= sz;
|
||||
|
||||
/* validate next elt */
|
||||
if (!bcm_valid_xtlv(elt, *buflen, opts))
|
||||
return NULL;
|
||||
|
||||
return elt;
|
||||
}
|
||||
|
||||
int
|
||||
bcm_xtlv_buf_init(bcm_xtlvbuf_t *tlv_buf, uint8 *buf, uint16 len, bcm_xtlv_opts_t opts)
|
||||
{
|
||||
if (!tlv_buf || !buf || !len)
|
||||
return BCME_BADARG;
|
||||
|
||||
tlv_buf->opts = opts;
|
||||
tlv_buf->size = len;
|
||||
tlv_buf->head = buf;
|
||||
tlv_buf->buf = buf;
|
||||
return BCME_OK;
|
||||
}
|
||||
|
||||
uint16
|
||||
bcm_xtlv_buf_len(bcm_xtlvbuf_t *tbuf)
|
||||
{
|
||||
if (tbuf == NULL) return 0;
|
||||
return (uint16)(tbuf->buf - tbuf->head);
|
||||
}
|
||||
uint16
|
||||
bcm_xtlv_buf_rlen(bcm_xtlvbuf_t *tbuf)
|
||||
{
|
||||
if (tbuf == NULL) return 0;
|
||||
return tbuf->size - bcm_xtlv_buf_len(tbuf);
|
||||
}
|
||||
uint8 *
|
||||
bcm_xtlv_buf(bcm_xtlvbuf_t *tbuf)
|
||||
{
|
||||
if (tbuf == NULL) return NULL;
|
||||
return tbuf->buf;
|
||||
}
|
||||
uint8 *
|
||||
bcm_xtlv_head(bcm_xtlvbuf_t *tbuf)
|
||||
{
|
||||
if (tbuf == NULL) return NULL;
|
||||
return tbuf->head;
|
||||
}
|
||||
int
|
||||
bcm_xtlv_put_data(bcm_xtlvbuf_t *tbuf, uint16 type, const void *data, uint16 dlen)
|
||||
{
|
||||
bcm_xtlv_t *xtlv;
|
||||
int size;
|
||||
|
||||
if (tbuf == NULL)
|
||||
return BCME_BADARG;
|
||||
size = bcm_xtlv_size_for_data(dlen, tbuf->opts);
|
||||
if (bcm_xtlv_buf_rlen(tbuf) < size)
|
||||
return BCME_NOMEM;
|
||||
xtlv = (bcm_xtlv_t *)bcm_xtlv_buf(tbuf);
|
||||
xtlv->id = htol16(type);
|
||||
xtlv->len = htol16(dlen);
|
||||
memcpy(xtlv->data, data, dlen);
|
||||
tbuf->buf += size;
|
||||
return BCME_OK;
|
||||
}
|
||||
int
|
||||
bcm_xtlv_put_8(bcm_xtlvbuf_t *tbuf, uint16 type, const int8 data)
|
||||
{
|
||||
bcm_xtlv_t *xtlv;
|
||||
int size;
|
||||
|
||||
if (tbuf == NULL)
|
||||
return BCME_BADARG;
|
||||
size = bcm_xtlv_size_for_data(1, tbuf->opts);
|
||||
if (bcm_xtlv_buf_rlen(tbuf) < size)
|
||||
return BCME_NOMEM;
|
||||
xtlv = (bcm_xtlv_t *)bcm_xtlv_buf(tbuf);
|
||||
xtlv->id = htol16(type);
|
||||
xtlv->len = htol16(sizeof(data));
|
||||
xtlv->data[0] = data;
|
||||
tbuf->buf += size;
|
||||
return BCME_OK;
|
||||
}
|
||||
int
|
||||
bcm_xtlv_put_16(bcm_xtlvbuf_t *tbuf, uint16 type, const int16 data)
|
||||
{
|
||||
bcm_xtlv_t *xtlv;
|
||||
int size;
|
||||
|
||||
if (tbuf == NULL)
|
||||
return BCME_BADARG;
|
||||
size = bcm_xtlv_size_for_data(2, tbuf->opts);
|
||||
if (bcm_xtlv_buf_rlen(tbuf) < size)
|
||||
return BCME_NOMEM;
|
||||
|
||||
xtlv = (bcm_xtlv_t *)bcm_xtlv_buf(tbuf);
|
||||
xtlv->id = htol16(type);
|
||||
xtlv->len = htol16(sizeof(data));
|
||||
htol16_ua_store(data, xtlv->data);
|
||||
tbuf->buf += size;
|
||||
return BCME_OK;
|
||||
}
|
||||
int
|
||||
bcm_xtlv_put_32(bcm_xtlvbuf_t *tbuf, uint16 type, const int32 data)
|
||||
{
|
||||
bcm_xtlv_t *xtlv;
|
||||
int size;
|
||||
|
||||
if (tbuf == NULL)
|
||||
return BCME_BADARG;
|
||||
size = bcm_xtlv_size_for_data(4, tbuf->opts);
|
||||
if (bcm_xtlv_buf_rlen(tbuf) < size)
|
||||
return BCME_NOMEM;
|
||||
xtlv = (bcm_xtlv_t *)bcm_xtlv_buf(tbuf);
|
||||
xtlv->id = htol16(type);
|
||||
xtlv->len = htol16(sizeof(data));
|
||||
htol32_ua_store(data, xtlv->data);
|
||||
tbuf->buf += size;
|
||||
return BCME_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* upacks xtlv record from buf checks the type
|
||||
* copies data to callers buffer
|
||||
* advances tlv pointer to next record
|
||||
* caller's resposible for dst space check
|
||||
*/
|
||||
int
|
||||
bcm_unpack_xtlv_entry(uint8 **tlv_buf, uint16 xpct_type, uint16 xpct_len, void *dst,
|
||||
bcm_xtlv_opts_t opts)
|
||||
{
|
||||
bcm_xtlv_t *ptlv = (bcm_xtlv_t *)*tlv_buf;
|
||||
uint16 len;
|
||||
uint16 type;
|
||||
|
||||
ASSERT(ptlv);
|
||||
/* tlv headr is always packed in LE order */
|
||||
len = ltoh16(ptlv->len);
|
||||
type = ltoh16(ptlv->id);
|
||||
if (len == 0) {
|
||||
/* z-len tlv headers: allow, but don't process */
|
||||
printf("z-len, skip unpack\n");
|
||||
} else {
|
||||
if ((type != xpct_type) ||
|
||||
(len > xpct_len)) {
|
||||
printf("xtlv_unpack Error: found[type:%d,len:%d] != xpct[type:%d,len:%d]\n",
|
||||
type, len, xpct_type, xpct_len);
|
||||
return BCME_BADARG;
|
||||
}
|
||||
/* copy tlv record to caller's buffer */
|
||||
memcpy(dst, ptlv->data, ptlv->len);
|
||||
}
|
||||
*tlv_buf = (uint8*)(*tlv_buf) + BCM_XTLV_SIZE(ptlv, opts);
|
||||
return BCME_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* packs user data into tlv record
|
||||
* advances tlv pointer to next xtlv slot
|
||||
* buflen is used for tlv_buf space check
|
||||
*/
|
||||
int
|
||||
bcm_pack_xtlv_entry(uint8 **tlv_buf, uint16 *buflen, uint16 type, uint16 len, void *src,
|
||||
bcm_xtlv_opts_t opts)
|
||||
{
|
||||
bcm_xtlv_t *ptlv = (bcm_xtlv_t *)*tlv_buf;
|
||||
int size;
|
||||
|
||||
ASSERT(ptlv);
|
||||
ASSERT(src);
|
||||
|
||||
size = bcm_xtlv_size_for_data(len, opts);
|
||||
|
||||
/* copy data from tlv buffer to dst provided by user */
|
||||
if (size > *buflen) {
|
||||
printf("bcm_pack_xtlv_entry: no space tlv_buf: requested:%d, available:%d\n",
|
||||
size, *buflen);
|
||||
return BCME_BADLEN;
|
||||
}
|
||||
ptlv->id = htol16(type);
|
||||
ptlv->len = htol16(len);
|
||||
|
||||
/* copy callers data */
|
||||
memcpy(ptlv->data, src, len);
|
||||
|
||||
/* advance callers pointer to tlv buff */
|
||||
*tlv_buf = (uint8*)(*tlv_buf) + size;
|
||||
/* decrement the len */
|
||||
*buflen -= (uint16)size;
|
||||
return BCME_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* unpack all xtlv records from the issue a callback
|
||||
* to set function one call per found tlv record
|
||||
*/
|
||||
int
|
||||
bcm_unpack_xtlv_buf(void *ctx, uint8 *tlv_buf, uint16 buflen, bcm_xtlv_opts_t opts,
|
||||
bcm_xtlv_unpack_cbfn_t *cbfn)
|
||||
{
|
||||
uint16 len;
|
||||
uint16 type;
|
||||
int res = BCME_OK;
|
||||
int size;
|
||||
bcm_xtlv_t *ptlv;
|
||||
int sbuflen = buflen;
|
||||
|
||||
ASSERT(!buflen || tlv_buf);
|
||||
ASSERT(!buflen || cbfn);
|
||||
|
||||
while (sbuflen >= (int)BCM_XTLV_HDR_SIZE) {
|
||||
ptlv = (bcm_xtlv_t *)tlv_buf;
|
||||
|
||||
/* tlv header is always packed in LE order */
|
||||
len = ltoh16(ptlv->len);
|
||||
type = ltoh16(ptlv->id);
|
||||
|
||||
size = bcm_xtlv_size_for_data(len, opts);
|
||||
|
||||
sbuflen -= size;
|
||||
/* check for possible buffer overrun */
|
||||
if (sbuflen < 0)
|
||||
break;
|
||||
|
||||
if ((res = cbfn(ctx, ptlv->data, type, len)) != BCME_OK)
|
||||
break;
|
||||
tlv_buf = (uint8*)tlv_buf + size;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int
|
||||
bcm_pack_xtlv_buf(void *ctx, void *tlv_buf, uint16 buflen, bcm_xtlv_opts_t opts,
|
||||
bcm_pack_xtlv_next_info_cbfn_t get_next, bcm_pack_xtlv_pack_next_cbfn_t pack_next,
|
||||
int *outlen)
|
||||
{
|
||||
int res = BCME_OK;
|
||||
uint16 tlv_id;
|
||||
uint16 tlv_len;
|
||||
uint8 *startp;
|
||||
uint8 *endp;
|
||||
uint8 *buf;
|
||||
bool more;
|
||||
int size;
|
||||
|
||||
ASSERT(get_next && pack_next);
|
||||
|
||||
buf = (uint8 *)tlv_buf;
|
||||
startp = buf;
|
||||
endp = (uint8 *)buf + buflen;
|
||||
more = TRUE;
|
||||
while (more && (buf < endp)) {
|
||||
more = get_next(ctx, &tlv_id, &tlv_len);
|
||||
size = bcm_xtlv_size_for_data(tlv_len, opts);
|
||||
if ((buf + size) > endp) {
|
||||
res = BCME_BUFTOOSHORT;
|
||||
goto done;
|
||||
}
|
||||
|
||||
htol16_ua_store(tlv_id, buf);
|
||||
htol16_ua_store(tlv_len, buf + sizeof(tlv_id));
|
||||
pack_next(ctx, tlv_id, tlv_len, buf + BCM_XTLV_HDR_SIZE);
|
||||
buf += size;
|
||||
}
|
||||
|
||||
if (more)
|
||||
res = BCME_BUFTOOSHORT;
|
||||
|
||||
done:
|
||||
if (outlen) {
|
||||
*outlen = (int)(buf - startp);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
* pack xtlv buffer from memory according to xtlv_desc_t
|
||||
*/
|
||||
int
|
||||
bcm_pack_xtlv_buf_from_mem(void **tlv_buf, uint16 *buflen, xtlv_desc_t *items,
|
||||
bcm_xtlv_opts_t opts)
|
||||
{
|
||||
int res = BCME_OK;
|
||||
uint8 *ptlv = (uint8 *)*tlv_buf;
|
||||
|
||||
while (items->type != 0) {
|
||||
if ((items->len > 0) && (res = bcm_pack_xtlv_entry(&ptlv,
|
||||
buflen, items->type,
|
||||
items->len, items->ptr, opts) != BCME_OK)) {
|
||||
break;
|
||||
}
|
||||
items++;
|
||||
}
|
||||
*tlv_buf = ptlv; /* update the external pointer */
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
* unpack xtlv buffer to memory according to xtlv_desc_t
|
||||
*
|
||||
*/
|
||||
int
|
||||
bcm_unpack_xtlv_buf_to_mem(void *tlv_buf, int *buflen, xtlv_desc_t *items, bcm_xtlv_opts_t opts)
|
||||
{
|
||||
int res = BCME_OK;
|
||||
bcm_xtlv_t *elt;
|
||||
|
||||
elt = bcm_valid_xtlv((bcm_xtlv_t *)tlv_buf, *buflen, opts) ? (bcm_xtlv_t *)tlv_buf : NULL;
|
||||
if (!elt || !items) {
|
||||
res = BCME_BADARG;
|
||||
return res;
|
||||
}
|
||||
|
||||
for (; elt != NULL && res == BCME_OK; elt = bcm_next_xtlv(elt, buflen, opts)) {
|
||||
/* find matches in desc_t items */
|
||||
xtlv_desc_t *dst_desc = items;
|
||||
uint16 len = ltoh16(elt->len);
|
||||
|
||||
while (dst_desc->type != 0) {
|
||||
if (ltoh16(elt->id) == dst_desc->type) {
|
||||
if (len != dst_desc->len) {
|
||||
res = BCME_BADLEN;
|
||||
} else {
|
||||
memcpy(dst_desc->ptr, elt->data, len);
|
||||
}
|
||||
break;
|
||||
}
|
||||
dst_desc++;
|
||||
}
|
||||
}
|
||||
|
||||
if (res == BCME_OK && *buflen != 0)
|
||||
res = BCME_BUFTOOSHORT;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
* return data pointer of a given ID from xtlv buffer.
|
||||
* If the specified xTLV ID is found, on return *data_len_out will contain
|
||||
* the the data length of the xTLV ID.
|
||||
*/
|
||||
void *
|
||||
bcm_get_data_from_xtlv_buf(uint8 *tlv_buf, uint16 buflen, uint16 id,
|
||||
uint16 *datalen_out, bcm_xtlv_opts_t opts)
|
||||
{
|
||||
void *retptr = NULL;
|
||||
uint16 type, len;
|
||||
int size;
|
||||
bcm_xtlv_t *ptlv;
|
||||
int sbuflen = buflen;
|
||||
|
||||
while (sbuflen >= (int)BCM_XTLV_HDR_SIZE) {
|
||||
ptlv = (bcm_xtlv_t *)tlv_buf;
|
||||
|
||||
/* tlv header is always packed in LE order */
|
||||
type = ltoh16(ptlv->id);
|
||||
len = ltoh16(ptlv->len);
|
||||
size = bcm_xtlv_size_for_data(len, opts);
|
||||
|
||||
sbuflen -= size;
|
||||
/* check for possible buffer overrun */
|
||||
if (sbuflen < 0) {
|
||||
printf("%s %d: Invalid sbuflen %d\n",
|
||||
__FUNCTION__, __LINE__, sbuflen);
|
||||
break;
|
||||
}
|
||||
|
||||
if (id == type) {
|
||||
retptr = ptlv->data;
|
||||
if (datalen_out) {
|
||||
*datalen_out = len;
|
||||
}
|
||||
break;
|
||||
}
|
||||
tlv_buf += size;
|
||||
}
|
||||
|
||||
return retptr;
|
||||
}
|
||||
|
||||
int bcm_xtlv_size(const bcm_xtlv_t *elt, bcm_xtlv_opts_t opts)
|
||||
{
|
||||
int size; /* entire size of the XTLV including header, data, and optional padding */
|
||||
int len; /* XTLV's value real length wthout padding */
|
||||
|
||||
len = BCM_XTLV_LEN(elt);
|
||||
|
||||
size = bcm_xtlv_size_for_data(len, opts);
|
||||
|
||||
return size;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,295 @@
|
|||
/*
|
||||
* Header file describing the internal (inter-module) DHD interfaces.
|
||||
*
|
||||
* Provides type definitions and function prototypes used to link the
|
||||
* DHD OS, bus, and protocol modules.
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: dhd_bus.h 698895 2017-05-11 02:55:17Z $
|
||||
*/
|
||||
|
||||
#ifndef _dhd_bus_h_
|
||||
#define _dhd_bus_h_
|
||||
|
||||
extern int dbus_up(struct dhd_bus *pub);
|
||||
extern int dbus_stop(struct dhd_bus *pub);
|
||||
extern int dbus_send_ctl(struct dhd_bus *pub, uint8 *buf, int len);
|
||||
extern int dbus_recv_ctl(struct dhd_bus *pub, uint8 *buf, int len);
|
||||
/*
|
||||
* Exported from dhd bus module (dhd_usb, dhd_sdio)
|
||||
*/
|
||||
|
||||
/* Indicate (dis)interest in finding dongles. */
|
||||
extern int dhd_bus_register(void);
|
||||
extern void dhd_bus_unregister(void);
|
||||
|
||||
/* Download firmware image and nvram image */
|
||||
extern int dhd_bus_download_firmware(struct dhd_bus *bus, osl_t *osh,
|
||||
char *fw_path, char *nv_path, char *clm_path, char *conf_path);
|
||||
#if defined(BT_OVER_SDIO)
|
||||
extern int dhd_bus_download_btfw(struct dhd_bus *bus, osl_t *osh, char *btfw_path);
|
||||
#endif /* defined (BT_OVER_SDIO) */
|
||||
|
||||
/* Stop bus module: clear pending frames, disable data flow */
|
||||
extern void dhd_bus_stop(struct dhd_bus *bus, bool enforce_mutex);
|
||||
|
||||
/* Initialize bus module: prepare for communication w/dongle */
|
||||
extern int dhd_bus_init(dhd_pub_t *dhdp, bool enforce_mutex);
|
||||
|
||||
/* Get the Bus Idle Time */
|
||||
extern void dhd_bus_getidletime(dhd_pub_t *dhdp, int *idletime);
|
||||
|
||||
/* Set the Bus Idle Time */
|
||||
extern void dhd_bus_setidletime(dhd_pub_t *dhdp, int idle_time);
|
||||
|
||||
/* Size of Extended Trap data Buffer */
|
||||
#ifdef BCMPCIE
|
||||
#define BCMPCIE_EXT_TRAP_DATA_MAXLEN 4096
|
||||
#endif
|
||||
|
||||
/* Send a data frame to the dongle. Callee disposes of txp. */
|
||||
#ifdef BCMPCIE
|
||||
extern int dhd_bus_txdata(struct dhd_bus *bus, void *txp, uint8 ifidx);
|
||||
#else
|
||||
extern int dhd_bus_txdata(struct dhd_bus *bus, void *txp);
|
||||
#endif
|
||||
|
||||
extern struct device * dhd_bus_to_dev(struct dhd_bus *bus);
|
||||
|
||||
/* Send/receive a control message to/from the dongle.
|
||||
* Expects caller to enforce a single outstanding transaction.
|
||||
*/
|
||||
extern int dhd_bus_txctl(struct dhd_bus *bus, uchar *msg, uint msglen);
|
||||
extern int dhd_bus_rxctl(struct dhd_bus *bus, uchar *msg, uint msglen);
|
||||
|
||||
/* Watchdog timer function */
|
||||
extern bool dhd_bus_watchdog(dhd_pub_t *dhd);
|
||||
|
||||
extern int dhd_bus_oob_intr_register(dhd_pub_t *dhdp);
|
||||
extern void dhd_bus_oob_intr_unregister(dhd_pub_t *dhdp);
|
||||
extern void dhd_bus_oob_intr_set(dhd_pub_t *dhdp, bool enable);
|
||||
extern void dhd_bus_dev_pm_stay_awake(dhd_pub_t *dhdpub);
|
||||
extern void dhd_bus_dev_pm_relax(dhd_pub_t *dhdpub);
|
||||
extern bool dhd_bus_dev_pm_enabled(dhd_pub_t *dhdpub);
|
||||
|
||||
/* Device console input function */
|
||||
extern int dhd_bus_console_in(dhd_pub_t *dhd, uchar *msg, uint msglen);
|
||||
|
||||
/* Deferred processing for the bus, return TRUE requests reschedule */
|
||||
extern bool dhd_bus_dpc(struct dhd_bus *bus);
|
||||
extern void dhd_bus_isr(bool * InterruptRecognized, bool * QueueMiniportHandleInterrupt, void *arg);
|
||||
|
||||
|
||||
/* Check for and handle local prot-specific iovar commands */
|
||||
extern int dhd_bus_iovar_op(dhd_pub_t *dhdp, const char *name,
|
||||
void *params, int plen, void *arg, int len, bool set);
|
||||
|
||||
/* Add bus dump output to a buffer */
|
||||
extern void dhd_bus_dump(dhd_pub_t *dhdp, struct bcmstrbuf *strbuf);
|
||||
|
||||
/* Clear any bus counters */
|
||||
extern void dhd_bus_clearcounts(dhd_pub_t *dhdp);
|
||||
|
||||
/* return the dongle chipid */
|
||||
extern uint dhd_bus_chip(struct dhd_bus *bus);
|
||||
|
||||
/* return the dongle chiprev */
|
||||
extern uint dhd_bus_chiprev(struct dhd_bus *bus);
|
||||
|
||||
/* Set user-specified nvram parameters. */
|
||||
extern void dhd_bus_set_nvram_params(struct dhd_bus * bus, const char *nvram_params);
|
||||
|
||||
extern void *dhd_bus_pub(struct dhd_bus *bus);
|
||||
extern void *dhd_bus_txq(struct dhd_bus *bus);
|
||||
extern const void *dhd_bus_sih(struct dhd_bus *bus);
|
||||
extern uint dhd_bus_hdrlen(struct dhd_bus *bus);
|
||||
#ifdef BCMSDIO
|
||||
extern void dhd_bus_set_dotxinrx(struct dhd_bus *bus, bool val);
|
||||
/* return sdio io status */
|
||||
extern uint8 dhd_bus_is_ioready(struct dhd_bus *bus);
|
||||
#else
|
||||
#define dhd_bus_set_dotxinrx(a, b) do {} while (0)
|
||||
#endif
|
||||
|
||||
#define DHD_SET_BUS_STATE_DOWN(_bus) do { \
|
||||
(_bus)->dhd->busstate = DHD_BUS_DOWN; \
|
||||
} while (0)
|
||||
|
||||
/* Register a dummy SDIO client driver in order to be notified of new SDIO device */
|
||||
extern int dhd_bus_reg_sdio_notify(void* semaphore);
|
||||
extern void dhd_bus_unreg_sdio_notify(void);
|
||||
extern void dhd_txglom_enable(dhd_pub_t *dhdp, bool enable);
|
||||
extern int dhd_bus_get_ids(struct dhd_bus *bus, uint32 *bus_type, uint32 *bus_num,
|
||||
uint32 *slot_num);
|
||||
|
||||
#if defined(DHD_FW_COREDUMP) && (defined(BCMPCIE) || defined(BCMSDIO))
|
||||
extern int dhd_bus_mem_dump(dhd_pub_t *dhd);
|
||||
#else
|
||||
#define dhd_bus_mem_dump(x)
|
||||
#endif /* DHD_FW_COREDUMP && (BCMPCIE || BCMSDIO) */
|
||||
|
||||
#ifdef BCMPCIE
|
||||
enum {
|
||||
/* Scratch buffer confiuguration update */
|
||||
D2H_DMA_SCRATCH_BUF,
|
||||
D2H_DMA_SCRATCH_BUF_LEN,
|
||||
|
||||
/* DMA Indices array buffers for: H2D WR and RD, and D2H WR and RD */
|
||||
H2D_DMA_INDX_WR_BUF, /* update H2D WR dma indices buf base addr to dongle */
|
||||
H2D_DMA_INDX_RD_BUF, /* update H2D RD dma indices buf base addr to dongle */
|
||||
D2H_DMA_INDX_WR_BUF, /* update D2H WR dma indices buf base addr to dongle */
|
||||
D2H_DMA_INDX_RD_BUF, /* update D2H RD dma indices buf base addr to dongle */
|
||||
|
||||
/* DHD sets/gets WR or RD index, in host's H2D and D2H DMA indices buffer */
|
||||
H2D_DMA_INDX_WR_UPD, /* update H2D WR index in H2D WR dma indices buf */
|
||||
H2D_DMA_INDX_RD_UPD, /* update H2D RD index in H2D RD dma indices buf */
|
||||
D2H_DMA_INDX_WR_UPD, /* update D2H WR index in D2H WR dma indices buf */
|
||||
D2H_DMA_INDX_RD_UPD, /* update D2H RD index in D2H RD dma indices buf */
|
||||
|
||||
/* DHD Indices array buffers and update for: H2D flow ring WR */
|
||||
H2D_IFRM_INDX_WR_BUF, /* update H2D WR dma indices buf base addr to dongle */
|
||||
H2D_IFRM_INDX_WR_UPD, /* update H2D WR dma indices buf base addr to dongle */
|
||||
|
||||
/* H2D and D2H Mailbox data update */
|
||||
H2D_MB_DATA,
|
||||
D2H_MB_DATA,
|
||||
|
||||
/* (Common) MsgBuf Ring configuration update */
|
||||
RING_BUF_ADDR, /* update ring base address to dongle */
|
||||
RING_ITEM_LEN, /* update ring item size to dongle */
|
||||
RING_MAX_ITEMS, /* update ring max items to dongle */
|
||||
|
||||
/* Update of WR or RD index, for a MsgBuf Ring */
|
||||
RING_RD_UPD, /* update ring read index from/to dongle */
|
||||
RING_WR_UPD, /* update ring write index from/to dongle */
|
||||
|
||||
TOTAL_LFRAG_PACKET_CNT,
|
||||
MAX_HOST_RXBUFS,
|
||||
HOST_API_VERSION,
|
||||
DNGL_TO_HOST_TRAP_ADDR,
|
||||
#ifdef HOFFLOAD_MODULES
|
||||
WRT_HOST_MODULE_ADDR
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef void (*dhd_mb_ring_t) (struct dhd_bus *, uint32);
|
||||
typedef void (*dhd_mb_ring_2_t) (struct dhd_bus *, uint32, bool);
|
||||
extern void dhd_bus_cmn_writeshared(struct dhd_bus *bus, void * data, uint32 len, uint8 type,
|
||||
uint16 ringid);
|
||||
extern void dhd_bus_ringbell(struct dhd_bus *bus, uint32 value);
|
||||
extern void dhd_bus_ringbell_2(struct dhd_bus *bus, uint32 value, bool devwake);
|
||||
extern void dhd_bus_cmn_readshared(struct dhd_bus *bus, void* data, uint8 type, uint16 ringid);
|
||||
extern uint32 dhd_bus_get_sharedflags(struct dhd_bus *bus);
|
||||
extern void dhd_bus_rx_frame(struct dhd_bus *bus, void* pkt, int ifidx, uint pkt_count);
|
||||
extern void dhd_bus_start_queue(struct dhd_bus *bus);
|
||||
extern void dhd_bus_stop_queue(struct dhd_bus *bus);
|
||||
extern dhd_mb_ring_t dhd_bus_get_mbintr_fn(struct dhd_bus *bus);
|
||||
extern dhd_mb_ring_2_t dhd_bus_get_mbintr_2_fn(struct dhd_bus *bus);
|
||||
extern void dhd_bus_write_flow_ring_states(struct dhd_bus *bus,
|
||||
void * data, uint16 flowid);
|
||||
extern void dhd_bus_read_flow_ring_states(struct dhd_bus *bus,
|
||||
void * data, uint8 flowid);
|
||||
extern int dhd_bus_flow_ring_create_request(struct dhd_bus *bus, void *flow_ring_node);
|
||||
extern void dhd_bus_clean_flow_ring(struct dhd_bus *bus, void *flow_ring_node);
|
||||
extern void dhd_bus_flow_ring_create_response(struct dhd_bus *bus, uint16 flow_id, int32 status);
|
||||
extern int dhd_bus_flow_ring_delete_request(struct dhd_bus *bus, void *flow_ring_node);
|
||||
extern void dhd_bus_flow_ring_delete_response(struct dhd_bus *bus, uint16 flowid, uint32 status);
|
||||
extern int dhd_bus_flow_ring_flush_request(struct dhd_bus *bus, void *flow_ring_node);
|
||||
extern void dhd_bus_flow_ring_flush_response(struct dhd_bus *bus, uint16 flowid, uint32 status);
|
||||
extern uint32 dhd_bus_max_h2d_queues(struct dhd_bus *bus);
|
||||
extern int dhd_bus_schedule_queue(struct dhd_bus *bus, uint16 flow_id, bool txs);
|
||||
extern void dhd_bus_set_linkdown(dhd_pub_t *dhdp, bool val);
|
||||
|
||||
#ifdef IDLE_TX_FLOW_MGMT
|
||||
extern void dhd_bus_flow_ring_resume_response(struct dhd_bus *bus, uint16 flowid, int32 status);
|
||||
#endif /* IDLE_TX_FLOW_MGMT */
|
||||
|
||||
|
||||
extern int dhdpcie_bus_clock_start(struct dhd_bus *bus);
|
||||
extern int dhdpcie_bus_clock_stop(struct dhd_bus *bus);
|
||||
extern int dhdpcie_bus_enable_device(struct dhd_bus *bus);
|
||||
extern int dhdpcie_bus_disable_device(struct dhd_bus *bus);
|
||||
extern int dhdpcie_bus_alloc_resource(struct dhd_bus *bus);
|
||||
extern void dhdpcie_bus_free_resource(struct dhd_bus *bus);
|
||||
extern bool dhdpcie_bus_dongle_attach(struct dhd_bus *bus);
|
||||
extern int dhd_bus_release_dongle(struct dhd_bus *bus);
|
||||
extern int dhd_bus_request_irq(struct dhd_bus *bus);
|
||||
extern int dhdpcie_get_pcieirq(struct dhd_bus *bus, unsigned int *irq);
|
||||
|
||||
extern void dhdpcie_cto_init(struct dhd_bus *bus, bool enable);
|
||||
|
||||
|
||||
#ifdef DHD_FW_COREDUMP
|
||||
extern struct dhd_bus *g_dhd_bus;
|
||||
extern int dhd_dongle_mem_dump(void);
|
||||
#endif /* DHD_FW_COREDUMP */
|
||||
|
||||
#ifdef IDLE_TX_FLOW_MGMT
|
||||
extern void dhd_bus_idle_tx_ring_suspend(dhd_pub_t *dhd, uint16 flow_ring_id);
|
||||
#endif /* IDLE_TX_FLOW_MGMT */
|
||||
extern void dhd_bus_handle_mb_data(struct dhd_bus *bus, uint32 d2h_mb_data);
|
||||
#endif /* BCMPCIE */
|
||||
|
||||
/* dump the device trap informtation */
|
||||
extern void dhd_bus_dump_trap_info(struct dhd_bus *bus, struct bcmstrbuf *b);
|
||||
|
||||
/* Function to set default min res mask */
|
||||
extern bool dhd_bus_set_default_min_res_mask(struct dhd_bus *bus);
|
||||
|
||||
/* Function to reset PMU registers */
|
||||
extern void dhd_bus_pmu_reg_reset(dhd_pub_t *dhdp);
|
||||
|
||||
#ifdef DHD_ULP
|
||||
extern void dhd_bus_ulp_disable_console(dhd_pub_t *dhdp);
|
||||
extern void dhd_bus_ucode_download(struct dhd_bus *bus);
|
||||
#endif /* DHD_ULP */
|
||||
extern int dhd_bus_readwrite_bp_addr(dhd_pub_t *dhdp, uint addr, uint size, uint* data, bool read);
|
||||
|
||||
#ifdef BT_OVER_SDIO
|
||||
/*
|
||||
* SDIO layer clock control functions exposed to be called from other layers.
|
||||
* This is required especially in the case where the BUS is shared between
|
||||
* BT and SDIO and we have to control the clock. The callers of this function
|
||||
* are expected to hold the sdlock
|
||||
*/
|
||||
int __dhdsdio_clk_enable(struct dhd_bus *bus, bus_owner_t owner, int can_wait);
|
||||
int __dhdsdio_clk_disable(struct dhd_bus *bus, bus_owner_t owner, int can_wait);
|
||||
void dhdsdio_reset_bt_use_count(struct dhd_bus *bus);
|
||||
#endif /* BT_OVER_SDIO */
|
||||
#ifdef BCMPCIE
|
||||
extern void dhd_bus_dump_console_buffer(struct dhd_bus *bus);
|
||||
#else
|
||||
#define dhd_bus_dump_console_buffer(x)
|
||||
#endif /* BCMPCIE */
|
||||
|
||||
extern uint16 dhd_get_chipid(dhd_pub_t *dhd);
|
||||
|
||||
extern int dhd_get_idletime(dhd_pub_t *dhd);
|
||||
|
||||
#ifdef DHD_WAKE_STATUS
|
||||
extern wake_counts_t* dhd_bus_get_wakecount(dhd_pub_t *dhd);
|
||||
extern int dhd_bus_get_bus_wake(dhd_pub_t * dhd);
|
||||
#endif /* DHD_WAKE_STATUS */
|
||||
#endif /* _dhd_bus_h_ */
|
|
@ -0,0 +1,37 @@
|
|||
#ifndef _DHD_BUZZZ_H_INCLUDED_
|
||||
#define _DHD_BUZZZ_H_INCLUDED_
|
||||
|
||||
/*
|
||||
* Broadcom logging system - Empty implementaiton
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#define dhd_buzzz_attach() do { /* noop */ } while (0)
|
||||
#define dhd_buzzz_detach() do { /* noop */ } while (0)
|
||||
#define dhd_buzzz_panic(x) do { /* noop */ } while (0)
|
||||
#define BUZZZ_LOG(ID, N, ARG...) do { /* noop */ } while (0)
|
||||
|
||||
#endif /* _DHD_BUZZZ_H_INCLUDED_ */
|
|
@ -0,0 +1,962 @@
|
|||
/*
|
||||
* DHD Protocol Module for CDC and BDC.
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: dhd_cdc.c 699163 2017-05-12 05:18:23Z $
|
||||
*
|
||||
* BDC is like CDC, except it includes a header for data packets to convey
|
||||
* packet priority over the bus, and flags (e.g. to indicate checksum status
|
||||
* for dongle offload.)
|
||||
*/
|
||||
|
||||
#include <typedefs.h>
|
||||
#include <osl.h>
|
||||
|
||||
#include <bcmutils.h>
|
||||
#include <bcmcdc.h>
|
||||
#include <bcmendian.h>
|
||||
|
||||
#include <dngl_stats.h>
|
||||
#include <dhd.h>
|
||||
#include <dhd_proto.h>
|
||||
#include <dhd_bus.h>
|
||||
#include <dhd_dbg.h>
|
||||
|
||||
|
||||
#ifdef PROP_TXSTATUS
|
||||
#include <wlfc_proto.h>
|
||||
#include <dhd_wlfc.h>
|
||||
#endif
|
||||
#ifdef BCMDBUS
|
||||
#include <dhd_config.h>
|
||||
#endif /* BCMDBUS */
|
||||
|
||||
#ifdef DHD_ULP
|
||||
#include <dhd_ulp.h>
|
||||
#endif /* DHD_ULP */
|
||||
|
||||
|
||||
#define RETRIES 2 /* # of retries to retrieve matching ioctl response */
|
||||
#define BUS_HEADER_LEN (24+DHD_SDALIGN) /* Must be at least SDPCM_RESERVE
|
||||
* defined in dhd_sdio.c (amount of header tha might be added)
|
||||
* plus any space that might be needed for alignment padding.
|
||||
*/
|
||||
#define ROUND_UP_MARGIN 2048 /* Biggest SDIO block size possible for
|
||||
* round off at the end of buffer
|
||||
*/
|
||||
|
||||
typedef struct dhd_prot {
|
||||
uint16 reqid;
|
||||
uint8 pending;
|
||||
uint32 lastcmd;
|
||||
#ifdef BCMDBUS
|
||||
uint ctl_completed;
|
||||
#endif /* BCMDBUS */
|
||||
uint8 bus_header[BUS_HEADER_LEN];
|
||||
cdc_ioctl_t msg;
|
||||
unsigned char buf[WLC_IOCTL_MAXLEN + ROUND_UP_MARGIN];
|
||||
} dhd_prot_t;
|
||||
|
||||
static int
|
||||
dhdcdc_msg(dhd_pub_t *dhd)
|
||||
{
|
||||
#ifdef BCMDBUS
|
||||
int timeout = 0;
|
||||
#endif /* BCMDBUS */
|
||||
int err = 0;
|
||||
dhd_prot_t *prot = dhd->prot;
|
||||
int len = ltoh32(prot->msg.len) + sizeof(cdc_ioctl_t);
|
||||
|
||||
DHD_TRACE(("%s: Enter\n", __FUNCTION__));
|
||||
|
||||
DHD_OS_WAKE_LOCK(dhd);
|
||||
|
||||
/* NOTE : cdc->msg.len holds the desired length of the buffer to be
|
||||
* returned. Only up to CDC_MAX_MSG_SIZE of this buffer area
|
||||
* is actually sent to the dongle
|
||||
*/
|
||||
if (len > CDC_MAX_MSG_SIZE)
|
||||
len = CDC_MAX_MSG_SIZE;
|
||||
|
||||
/* Send request */
|
||||
#ifdef BCMDBUS
|
||||
DHD_OS_IOCTL_RESP_LOCK(dhd);
|
||||
prot->ctl_completed = FALSE;
|
||||
err = dbus_send_ctl(dhd->bus, (void *)&prot->msg, len);
|
||||
if (err) {
|
||||
DHD_ERROR(("dbus_send_ctl error=%d\n", err));
|
||||
DHD_OS_IOCTL_RESP_UNLOCK(dhd);
|
||||
DHD_OS_WAKE_UNLOCK(dhd);
|
||||
return err;
|
||||
}
|
||||
#else
|
||||
err = dhd_bus_txctl(dhd->bus, (uchar*)&prot->msg, len);
|
||||
#endif /* BCMDBUS */
|
||||
|
||||
#ifdef BCMDBUS
|
||||
timeout = dhd_os_ioctl_resp_wait(dhd, &prot->ctl_completed, false);
|
||||
if ((!timeout) || (!prot->ctl_completed)) {
|
||||
DHD_ERROR(("Txctl timeout %d ctl_completed %d\n",
|
||||
timeout, prot->ctl_completed));
|
||||
DHD_ERROR(("Txctl wait timed out\n"));
|
||||
err = -1;
|
||||
}
|
||||
DHD_OS_IOCTL_RESP_UNLOCK(dhd);
|
||||
#endif /* BCMDBUS */
|
||||
#if defined(BCMDBUS) && defined(INTR_EP_ENABLE)
|
||||
/* If the ctl write is successfully completed, wait for an acknowledgement
|
||||
* that indicates that it is now ok to do ctl read from the dongle
|
||||
*/
|
||||
if (err != -1) {
|
||||
DHD_OS_IOCTL_RESP_LOCK(dhd);
|
||||
prot->ctl_completed = FALSE;
|
||||
if (dbus_poll_intr(dhd->dbus)) {
|
||||
DHD_ERROR(("dbus_poll_intr not submitted\n"));
|
||||
} else {
|
||||
/* interrupt polling is sucessfully submitted. Wait for dongle to send
|
||||
* interrupt
|
||||
*/
|
||||
timeout = dhd_os_ioctl_resp_wait(dhd, &prot->ctl_completed, false);
|
||||
if (!timeout) {
|
||||
DHD_ERROR(("intr poll wait timed out\n"));
|
||||
}
|
||||
}
|
||||
DHD_OS_IOCTL_RESP_UNLOCK(dhd);
|
||||
}
|
||||
#endif /* defined(BCMDBUS) && defined(INTR_EP_ENABLE) */
|
||||
DHD_OS_WAKE_UNLOCK(dhd);
|
||||
return err;
|
||||
}
|
||||
|
||||
static int
|
||||
dhdcdc_cmplt(dhd_pub_t *dhd, uint32 id, uint32 len)
|
||||
{
|
||||
#ifdef BCMDBUS
|
||||
int timeout = 0;
|
||||
#endif /* BCMDBUS */
|
||||
int ret;
|
||||
int cdc_len = len + sizeof(cdc_ioctl_t);
|
||||
dhd_prot_t *prot = dhd->prot;
|
||||
|
||||
DHD_TRACE(("%s: Enter\n", __FUNCTION__));
|
||||
|
||||
do {
|
||||
#ifdef BCMDBUS
|
||||
DHD_OS_IOCTL_RESP_LOCK(dhd);
|
||||
prot->ctl_completed = FALSE;
|
||||
ret = dbus_recv_ctl(dhd->bus, (uchar*)&prot->msg, cdc_len);
|
||||
if (ret) {
|
||||
DHD_ERROR(("dbus_recv_ctl error=0x%x(%d)\n", ret, ret));
|
||||
DHD_OS_IOCTL_RESP_UNLOCK(dhd);
|
||||
goto done;
|
||||
}
|
||||
timeout = dhd_os_ioctl_resp_wait(dhd, &prot->ctl_completed, false);
|
||||
if ((!timeout) || (!prot->ctl_completed)) {
|
||||
DHD_ERROR(("Rxctl timeout %d ctl_completed %d\n",
|
||||
timeout, prot->ctl_completed));
|
||||
ret = -1;
|
||||
DHD_OS_IOCTL_RESP_UNLOCK(dhd);
|
||||
|
||||
goto done;
|
||||
}
|
||||
DHD_OS_IOCTL_RESP_UNLOCK(dhd);
|
||||
|
||||
ret = cdc_len;
|
||||
#else
|
||||
ret = dhd_bus_rxctl(dhd->bus, (uchar*)&prot->msg, cdc_len);
|
||||
#endif /* BCMDBUS */
|
||||
if (ret < 0)
|
||||
break;
|
||||
} while (CDC_IOC_ID(ltoh32(prot->msg.flags)) != id);
|
||||
|
||||
#ifdef BCMDBUS
|
||||
done:
|
||||
#endif /* BCMDBUS */
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
dhdcdc_query_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len, uint8 action)
|
||||
{
|
||||
dhd_prot_t *prot = dhd->prot;
|
||||
cdc_ioctl_t *msg = &prot->msg;
|
||||
int ret = 0, retries = 0;
|
||||
uint32 id, flags = 0;
|
||||
|
||||
DHD_TRACE(("%s: Enter\n", __FUNCTION__));
|
||||
DHD_CTL(("%s: cmd %d len %d\n", __FUNCTION__, cmd, len));
|
||||
|
||||
|
||||
/* Respond "bcmerror" and "bcmerrorstr" with local cache */
|
||||
if (cmd == WLC_GET_VAR && buf)
|
||||
{
|
||||
if (!strcmp((char *)buf, "bcmerrorstr"))
|
||||
{
|
||||
strncpy((char *)buf, bcmerrorstr(dhd->dongle_error), BCME_STRLEN);
|
||||
goto done;
|
||||
}
|
||||
else if (!strcmp((char *)buf, "bcmerror"))
|
||||
{
|
||||
*(int *)buf = dhd->dongle_error;
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
memset(msg, 0, sizeof(cdc_ioctl_t));
|
||||
|
||||
msg->cmd = htol32(cmd);
|
||||
msg->len = htol32(len);
|
||||
msg->flags = (++prot->reqid << CDCF_IOC_ID_SHIFT);
|
||||
CDC_SET_IF_IDX(msg, ifidx);
|
||||
/* add additional action bits */
|
||||
action &= WL_IOCTL_ACTION_MASK;
|
||||
msg->flags |= (action << CDCF_IOC_ACTION_SHIFT);
|
||||
msg->flags = htol32(msg->flags);
|
||||
|
||||
if (buf)
|
||||
memcpy(prot->buf, buf, len);
|
||||
|
||||
if ((ret = dhdcdc_msg(dhd)) < 0) {
|
||||
if (!dhd->hang_was_sent)
|
||||
DHD_ERROR(("dhdcdc_query_ioctl: dhdcdc_msg failed w/status %d\n", ret));
|
||||
goto done;
|
||||
}
|
||||
|
||||
retry:
|
||||
/* wait for interrupt and get first fragment */
|
||||
if ((ret = dhdcdc_cmplt(dhd, prot->reqid, len)) < 0)
|
||||
goto done;
|
||||
|
||||
flags = ltoh32(msg->flags);
|
||||
id = (flags & CDCF_IOC_ID_MASK) >> CDCF_IOC_ID_SHIFT;
|
||||
|
||||
if ((id < prot->reqid) && (++retries < RETRIES))
|
||||
goto retry;
|
||||
if (id != prot->reqid) {
|
||||
DHD_ERROR(("%s: %s: unexpected request id %d (expected %d)\n",
|
||||
dhd_ifname(dhd, ifidx), __FUNCTION__, id, prot->reqid));
|
||||
ret = -EINVAL;
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Copy info buffer */
|
||||
if (buf)
|
||||
{
|
||||
if (ret < (int)len)
|
||||
len = ret;
|
||||
memcpy(buf, (void*) prot->buf, len);
|
||||
}
|
||||
|
||||
/* Check the ERROR flag */
|
||||
if (flags & CDCF_IOC_ERROR)
|
||||
{
|
||||
ret = ltoh32(msg->status);
|
||||
/* Cache error from dongle */
|
||||
dhd->dongle_error = ret;
|
||||
}
|
||||
|
||||
done:
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
dhdcdc_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len, uint8 action)
|
||||
{
|
||||
dhd_prot_t *prot = dhd->prot;
|
||||
cdc_ioctl_t *msg = &prot->msg;
|
||||
int ret = 0;
|
||||
uint32 flags, id;
|
||||
|
||||
DHD_TRACE(("%s: Enter\n", __FUNCTION__));
|
||||
DHD_CTL(("%s: cmd %d len %d\n", __FUNCTION__, cmd, len));
|
||||
|
||||
if (dhd->busstate == DHD_BUS_DOWN) {
|
||||
DHD_ERROR(("%s : bus is down. we have nothing to do\n", __FUNCTION__));
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
/* don't talk to the dongle if fw is about to be reloaded */
|
||||
if (dhd->hang_was_sent) {
|
||||
DHD_ERROR(("%s: HANG was sent up earlier. Not talking to the chip\n",
|
||||
__FUNCTION__));
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
if (cmd == WLC_SET_PM) {
|
||||
DHD_TRACE_HW4(("%s: SET PM to %d\n", __FUNCTION__, buf ? *(char *)buf : 0));
|
||||
}
|
||||
|
||||
memset(msg, 0, sizeof(cdc_ioctl_t));
|
||||
|
||||
msg->cmd = htol32(cmd);
|
||||
msg->len = htol32(len);
|
||||
msg->flags = (++prot->reqid << CDCF_IOC_ID_SHIFT);
|
||||
CDC_SET_IF_IDX(msg, ifidx);
|
||||
/* add additional action bits */
|
||||
action &= WL_IOCTL_ACTION_MASK;
|
||||
msg->flags |= (action << CDCF_IOC_ACTION_SHIFT) | CDCF_IOC_SET;
|
||||
msg->flags = htol32(msg->flags);
|
||||
|
||||
if (buf)
|
||||
memcpy(prot->buf, buf, len);
|
||||
|
||||
#ifdef DHD_ULP
|
||||
if (buf && (!strncmp(buf, "ulp", sizeof("ulp")))) {
|
||||
/* force all the writes after this point to NOT to use cached sbwad value */
|
||||
dhd_ulp_disable_cached_sbwad(dhd);
|
||||
}
|
||||
#endif /* DHD_ULP */
|
||||
|
||||
if ((ret = dhdcdc_msg(dhd)) < 0) {
|
||||
DHD_ERROR(("%s: dhdcdc_msg failed w/status %d\n", __FUNCTION__, ret));
|
||||
goto done;
|
||||
}
|
||||
|
||||
if ((ret = dhdcdc_cmplt(dhd, prot->reqid, len)) < 0)
|
||||
goto done;
|
||||
|
||||
flags = ltoh32(msg->flags);
|
||||
id = (flags & CDCF_IOC_ID_MASK) >> CDCF_IOC_ID_SHIFT;
|
||||
|
||||
if (id != prot->reqid) {
|
||||
DHD_ERROR(("%s: %s: unexpected request id %d (expected %d)\n",
|
||||
dhd_ifname(dhd, ifidx), __FUNCTION__, id, prot->reqid));
|
||||
ret = -EINVAL;
|
||||
goto done;
|
||||
}
|
||||
|
||||
#ifdef DHD_ULP
|
||||
/* For ulp prototyping temporary */
|
||||
if ((ret = dhd_ulp_check_ulp_request(dhd, buf)) < 0)
|
||||
goto done;
|
||||
#endif /* DHD_ULP */
|
||||
|
||||
/* Check the ERROR flag */
|
||||
if (flags & CDCF_IOC_ERROR)
|
||||
{
|
||||
ret = ltoh32(msg->status);
|
||||
/* Cache error from dongle */
|
||||
dhd->dongle_error = ret;
|
||||
}
|
||||
|
||||
done:
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef BCMDBUS
|
||||
int
|
||||
dhd_prot_ctl_complete(dhd_pub_t *dhd)
|
||||
{
|
||||
dhd_prot_t *prot;
|
||||
|
||||
if (dhd == NULL)
|
||||
return BCME_ERROR;
|
||||
|
||||
prot = dhd->prot;
|
||||
|
||||
ASSERT(prot);
|
||||
DHD_OS_IOCTL_RESP_LOCK(dhd);
|
||||
prot->ctl_completed = TRUE;
|
||||
dhd_os_ioctl_resp_wake(dhd);
|
||||
DHD_OS_IOCTL_RESP_UNLOCK(dhd);
|
||||
return 0;
|
||||
}
|
||||
#endif /* BCMDBUS */
|
||||
|
||||
int
|
||||
dhd_prot_ioctl(dhd_pub_t *dhd, int ifidx, wl_ioctl_t * ioc, void * buf, int len)
|
||||
{
|
||||
dhd_prot_t *prot = dhd->prot;
|
||||
int ret = -1;
|
||||
uint8 action;
|
||||
static int error_cnt = 0;
|
||||
|
||||
if ((dhd->busstate == DHD_BUS_DOWN) || dhd->hang_was_sent) {
|
||||
DHD_ERROR(("%s : bus is down. we have nothing to do - bs: %d, has: %d\n",
|
||||
__FUNCTION__, dhd->busstate, dhd->hang_was_sent));
|
||||
goto done;
|
||||
}
|
||||
|
||||
DHD_TRACE(("%s: Enter\n", __FUNCTION__));
|
||||
|
||||
ASSERT(len <= WLC_IOCTL_MAXLEN);
|
||||
|
||||
if (len > WLC_IOCTL_MAXLEN)
|
||||
goto done;
|
||||
|
||||
if (prot->pending == TRUE) {
|
||||
DHD_ERROR(("CDC packet is pending!!!! cmd=0x%x (%lu) lastcmd=0x%x (%lu)\n",
|
||||
ioc->cmd, (unsigned long)ioc->cmd, prot->lastcmd,
|
||||
(unsigned long)prot->lastcmd));
|
||||
if ((ioc->cmd == WLC_SET_VAR) || (ioc->cmd == WLC_GET_VAR)) {
|
||||
DHD_TRACE(("iovar cmd=%s\n", buf ? (char*)buf : "\0"));
|
||||
}
|
||||
goto done;
|
||||
}
|
||||
|
||||
prot->pending = TRUE;
|
||||
prot->lastcmd = ioc->cmd;
|
||||
action = ioc->set;
|
||||
if (action & WL_IOCTL_ACTION_SET)
|
||||
ret = dhdcdc_set_ioctl(dhd, ifidx, ioc->cmd, buf, len, action);
|
||||
else {
|
||||
ret = dhdcdc_query_ioctl(dhd, ifidx, ioc->cmd, buf, len, action);
|
||||
if (ret > 0)
|
||||
ioc->used = ret - sizeof(cdc_ioctl_t);
|
||||
}
|
||||
// terence 20130805: send hang event to wpa_supplicant
|
||||
if (ret == -EIO) {
|
||||
error_cnt++;
|
||||
if (error_cnt > 2)
|
||||
ret = -ETIMEDOUT;
|
||||
} else
|
||||
error_cnt = 0;
|
||||
|
||||
/* Too many programs assume ioctl() returns 0 on success */
|
||||
if (ret >= 0)
|
||||
ret = 0;
|
||||
else {
|
||||
cdc_ioctl_t *msg = &prot->msg;
|
||||
ioc->needed = ltoh32(msg->len); /* len == needed when set/query fails from dongle */
|
||||
}
|
||||
|
||||
/* Intercept the wme_dp ioctl here */
|
||||
if ((!ret) && (ioc->cmd == WLC_SET_VAR) && (!strcmp(buf, "wme_dp"))) {
|
||||
int slen, val = 0;
|
||||
|
||||
slen = strlen("wme_dp") + 1;
|
||||
if (len >= (int)(slen + sizeof(int)))
|
||||
bcopy(((char *)buf + slen), &val, sizeof(int));
|
||||
dhd->wme_dp = (uint8) ltoh32(val);
|
||||
}
|
||||
|
||||
prot->pending = FALSE;
|
||||
|
||||
done:
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
dhd_prot_iovar_op(dhd_pub_t *dhdp, const char *name,
|
||||
void *params, int plen, void *arg, int len, bool set)
|
||||
{
|
||||
return BCME_UNSUPPORTED;
|
||||
}
|
||||
|
||||
void
|
||||
dhd_prot_dump(dhd_pub_t *dhdp, struct bcmstrbuf *strbuf)
|
||||
{
|
||||
if (!dhdp || !dhdp->prot) {
|
||||
return;
|
||||
}
|
||||
|
||||
bcm_bprintf(strbuf, "Protocol CDC: reqid %d\n", dhdp->prot->reqid);
|
||||
#ifdef PROP_TXSTATUS
|
||||
dhd_wlfc_dump(dhdp, strbuf);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* The FreeBSD PKTPUSH could change the packet buf pinter
|
||||
so we need to make it changable
|
||||
*/
|
||||
#define PKTBUF pktbuf
|
||||
void
|
||||
dhd_prot_hdrpush(dhd_pub_t *dhd, int ifidx, void *PKTBUF)
|
||||
{
|
||||
#ifdef BDC
|
||||
struct bdc_header *h;
|
||||
#endif /* BDC */
|
||||
|
||||
DHD_TRACE(("%s: Enter\n", __FUNCTION__));
|
||||
|
||||
#ifdef BDC
|
||||
/* Push BDC header used to convey priority for buses that don't */
|
||||
|
||||
PKTPUSH(dhd->osh, PKTBUF, BDC_HEADER_LEN);
|
||||
|
||||
h = (struct bdc_header *)PKTDATA(dhd->osh, PKTBUF);
|
||||
|
||||
h->flags = (BDC_PROTO_VER << BDC_FLAG_VER_SHIFT);
|
||||
if (PKTSUMNEEDED(PKTBUF))
|
||||
h->flags |= BDC_FLAG_SUM_NEEDED;
|
||||
|
||||
|
||||
h->priority = (PKTPRIO(PKTBUF) & BDC_PRIORITY_MASK);
|
||||
h->flags2 = 0;
|
||||
h->dataOffset = 0;
|
||||
#endif /* BDC */
|
||||
BDC_SET_IF_IDX(h, ifidx);
|
||||
}
|
||||
#undef PKTBUF /* Only defined in the above routine */
|
||||
|
||||
uint
|
||||
dhd_prot_hdrlen(dhd_pub_t *dhd, void *PKTBUF)
|
||||
{
|
||||
uint hdrlen = 0;
|
||||
#ifdef BDC
|
||||
/* Length of BDC(+WLFC) headers pushed */
|
||||
hdrlen = BDC_HEADER_LEN + (((struct bdc_header *)PKTBUF)->dataOffset * 4);
|
||||
#endif
|
||||
return hdrlen;
|
||||
}
|
||||
|
||||
int
|
||||
dhd_prot_hdrpull(dhd_pub_t *dhd, int *ifidx, void *pktbuf, uchar *reorder_buf_info,
|
||||
uint *reorder_info_len)
|
||||
{
|
||||
#ifdef BDC
|
||||
struct bdc_header *h;
|
||||
#endif
|
||||
uint8 data_offset = 0;
|
||||
|
||||
DHD_TRACE(("%s: Enter\n", __FUNCTION__));
|
||||
|
||||
#ifdef BDC
|
||||
if (reorder_info_len)
|
||||
*reorder_info_len = 0;
|
||||
/* Pop BDC header used to convey priority for buses that don't */
|
||||
|
||||
if (PKTLEN(dhd->osh, pktbuf) < BDC_HEADER_LEN) {
|
||||
DHD_ERROR(("%s: rx data too short (%d < %d)\n", __FUNCTION__,
|
||||
PKTLEN(dhd->osh, pktbuf), BDC_HEADER_LEN));
|
||||
return BCME_ERROR;
|
||||
}
|
||||
|
||||
h = (struct bdc_header *)PKTDATA(dhd->osh, pktbuf);
|
||||
|
||||
if (!ifidx) {
|
||||
/* for tx packet, skip the analysis */
|
||||
data_offset = h->dataOffset;
|
||||
PKTPULL(dhd->osh, pktbuf, BDC_HEADER_LEN);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
*ifidx = BDC_GET_IF_IDX(h);
|
||||
|
||||
if (((h->flags & BDC_FLAG_VER_MASK) >> BDC_FLAG_VER_SHIFT) != BDC_PROTO_VER) {
|
||||
DHD_ERROR(("%s: non-BDC packet received, flags = 0x%x\n",
|
||||
dhd_ifname(dhd, *ifidx), h->flags));
|
||||
if (((h->flags & BDC_FLAG_VER_MASK) >> BDC_FLAG_VER_SHIFT) == BDC_PROTO_VER_1)
|
||||
h->dataOffset = 0;
|
||||
else
|
||||
return BCME_ERROR;
|
||||
}
|
||||
|
||||
if (h->flags & BDC_FLAG_SUM_GOOD) {
|
||||
DHD_INFO(("%s: BDC packet received with good rx-csum, flags 0x%x\n",
|
||||
dhd_ifname(dhd, *ifidx), h->flags));
|
||||
PKTSETSUMGOOD(pktbuf, TRUE);
|
||||
}
|
||||
|
||||
PKTSETPRIO(pktbuf, (h->priority & BDC_PRIORITY_MASK));
|
||||
data_offset = h->dataOffset;
|
||||
PKTPULL(dhd->osh, pktbuf, BDC_HEADER_LEN);
|
||||
#endif /* BDC */
|
||||
|
||||
|
||||
#ifdef PROP_TXSTATUS
|
||||
if (!DHD_PKTTAG_PKTDIR(PKTTAG(pktbuf))) {
|
||||
/*
|
||||
- parse txstatus only for packets that came from the firmware
|
||||
*/
|
||||
dhd_wlfc_parse_header_info(dhd, pktbuf, (data_offset << 2),
|
||||
reorder_buf_info, reorder_info_len);
|
||||
|
||||
#ifdef BCMDBUS
|
||||
#ifndef DHD_WLFC_THREAD
|
||||
dhd_wlfc_commit_packets(dhd,
|
||||
(f_commitpkt_t)dhd_bus_txdata, dhd->bus, NULL, FALSE);
|
||||
#endif /* DHD_WLFC_THREAD */
|
||||
#endif /* BCMDBUS */
|
||||
}
|
||||
#endif /* PROP_TXSTATUS */
|
||||
|
||||
exit:
|
||||
PKTPULL(dhd->osh, pktbuf, (data_offset << 2));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
dhd_prot_attach(dhd_pub_t *dhd)
|
||||
{
|
||||
dhd_prot_t *cdc;
|
||||
|
||||
if (!(cdc = (dhd_prot_t *)DHD_OS_PREALLOC(dhd, DHD_PREALLOC_PROT, sizeof(dhd_prot_t)))) {
|
||||
DHD_ERROR(("%s: kmalloc failed\n", __FUNCTION__));
|
||||
goto fail;
|
||||
}
|
||||
memset(cdc, 0, sizeof(dhd_prot_t));
|
||||
|
||||
/* ensure that the msg buf directly follows the cdc msg struct */
|
||||
if ((uintptr)(&cdc->msg + 1) != (uintptr)cdc->buf) {
|
||||
DHD_ERROR(("dhd_prot_t is not correctly defined\n"));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
dhd->prot = cdc;
|
||||
#ifdef BDC
|
||||
dhd->hdrlen += BDC_HEADER_LEN;
|
||||
#endif
|
||||
dhd->maxctl = WLC_IOCTL_MAXLEN + sizeof(cdc_ioctl_t) + ROUND_UP_MARGIN;
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
if (cdc != NULL)
|
||||
DHD_OS_PREFREE(dhd, cdc, sizeof(dhd_prot_t));
|
||||
return BCME_NOMEM;
|
||||
}
|
||||
|
||||
/* ~NOTE~ What if another thread is waiting on the semaphore? Holding it? */
|
||||
void
|
||||
dhd_prot_detach(dhd_pub_t *dhd)
|
||||
{
|
||||
#ifdef PROP_TXSTATUS
|
||||
dhd_wlfc_deinit(dhd);
|
||||
#endif
|
||||
DHD_OS_PREFREE(dhd, dhd->prot, sizeof(dhd_prot_t));
|
||||
dhd->prot = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
dhd_prot_dstats(dhd_pub_t *dhd)
|
||||
{
|
||||
/* copy bus stats */
|
||||
|
||||
dhd->dstats.tx_packets = dhd->tx_packets;
|
||||
dhd->dstats.tx_errors = dhd->tx_errors;
|
||||
dhd->dstats.rx_packets = dhd->rx_packets;
|
||||
dhd->dstats.rx_errors = dhd->rx_errors;
|
||||
dhd->dstats.rx_dropped = dhd->rx_dropped;
|
||||
dhd->dstats.multicast = dhd->rx_multicast;
|
||||
return;
|
||||
}
|
||||
|
||||
int
|
||||
dhd_sync_with_dongle(dhd_pub_t *dhd)
|
||||
{
|
||||
int ret = 0;
|
||||
wlc_rev_info_t revinfo;
|
||||
DHD_TRACE(("%s: Enter\n", __FUNCTION__));
|
||||
|
||||
#ifdef DHD_FW_COREDUMP
|
||||
/* Check the memdump capability */
|
||||
dhd_get_memdump_info(dhd);
|
||||
#endif /* DHD_FW_COREDUMP */
|
||||
|
||||
#ifdef BCMASSERT_LOG
|
||||
dhd_get_assert_info(dhd);
|
||||
#endif /* BCMASSERT_LOG */
|
||||
|
||||
/* Get the device rev info */
|
||||
memset(&revinfo, 0, sizeof(revinfo));
|
||||
ret = dhd_wl_ioctl_cmd(dhd, WLC_GET_REVINFO, &revinfo, sizeof(revinfo), FALSE, 0);
|
||||
if (ret < 0)
|
||||
goto done;
|
||||
#if defined(BCMDBUS)
|
||||
if (dhd_download_fw_on_driverload) {
|
||||
dhd_conf_reset(dhd);
|
||||
dhd_conf_set_chiprev(dhd, revinfo.chipnum, revinfo.chiprev);
|
||||
dhd_conf_preinit(dhd);
|
||||
dhd_conf_read_config(dhd, dhd->conf_path);
|
||||
}
|
||||
#endif /* BCMDBUS */
|
||||
|
||||
|
||||
DHD_SSSR_DUMP_INIT(dhd);
|
||||
|
||||
dhd_process_cid_mac(dhd, TRUE);
|
||||
ret = dhd_preinit_ioctls(dhd);
|
||||
dhd_process_cid_mac(dhd, FALSE);
|
||||
|
||||
/* Always assumes wl for now */
|
||||
dhd->iswl = TRUE;
|
||||
|
||||
done:
|
||||
return ret;
|
||||
}
|
||||
|
||||
int dhd_prot_init(dhd_pub_t *dhd)
|
||||
{
|
||||
return BCME_OK;
|
||||
}
|
||||
|
||||
void
|
||||
dhd_prot_stop(dhd_pub_t *dhd)
|
||||
{
|
||||
/* Nothing to do for CDC */
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
dhd_get_hostreorder_pkts(void *osh, struct reorder_info *ptr, void **pkt,
|
||||
uint32 *pkt_count, void **pplast, uint8 start, uint8 end)
|
||||
{
|
||||
void *plast = NULL, *p;
|
||||
uint32 pkt_cnt = 0;
|
||||
|
||||
if (ptr->pend_pkts == 0) {
|
||||
DHD_REORDER(("%s: no packets in reorder queue \n", __FUNCTION__));
|
||||
*pplast = NULL;
|
||||
*pkt_count = 0;
|
||||
*pkt = NULL;
|
||||
return;
|
||||
}
|
||||
do {
|
||||
p = (void *)(ptr->p[start]);
|
||||
ptr->p[start] = NULL;
|
||||
|
||||
if (p != NULL) {
|
||||
if (plast == NULL)
|
||||
*pkt = p;
|
||||
else
|
||||
PKTSETNEXT(osh, plast, p);
|
||||
|
||||
plast = p;
|
||||
pkt_cnt++;
|
||||
}
|
||||
start++;
|
||||
if (start > ptr->max_idx)
|
||||
start = 0;
|
||||
} while (start != end);
|
||||
*pplast = plast;
|
||||
*pkt_count = pkt_cnt;
|
||||
ptr->pend_pkts -= (uint8)pkt_cnt;
|
||||
}
|
||||
|
||||
int
|
||||
dhd_process_pkt_reorder_info(dhd_pub_t *dhd, uchar *reorder_info_buf, uint reorder_info_len,
|
||||
void **pkt, uint32 *pkt_count)
|
||||
{
|
||||
uint8 flow_id, max_idx, cur_idx, exp_idx;
|
||||
struct reorder_info *ptr;
|
||||
uint8 flags;
|
||||
void *cur_pkt, *plast = NULL;
|
||||
uint32 cnt = 0;
|
||||
|
||||
if (pkt == NULL) {
|
||||
if (pkt_count != NULL)
|
||||
*pkt_count = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
flow_id = reorder_info_buf[WLHOST_REORDERDATA_FLOWID_OFFSET];
|
||||
flags = reorder_info_buf[WLHOST_REORDERDATA_FLAGS_OFFSET];
|
||||
|
||||
DHD_REORDER(("flow_id %d, flags 0x%02x, idx(%d, %d, %d)\n", flow_id, flags,
|
||||
reorder_info_buf[WLHOST_REORDERDATA_CURIDX_OFFSET],
|
||||
reorder_info_buf[WLHOST_REORDERDATA_EXPIDX_OFFSET],
|
||||
reorder_info_buf[WLHOST_REORDERDATA_MAXIDX_OFFSET]));
|
||||
|
||||
/* validate flags and flow id */
|
||||
if (flags == 0xFF) {
|
||||
DHD_ERROR(("%s: invalid flags...so ignore this packet\n", __FUNCTION__));
|
||||
*pkt_count = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
cur_pkt = *pkt;
|
||||
*pkt = NULL;
|
||||
|
||||
ptr = dhd->reorder_bufs[flow_id];
|
||||
if (flags & WLHOST_REORDERDATA_DEL_FLOW) {
|
||||
uint32 buf_size = sizeof(struct reorder_info);
|
||||
|
||||
DHD_REORDER(("%s: Flags indicating to delete a flow id %d\n",
|
||||
__FUNCTION__, flow_id));
|
||||
|
||||
if (ptr == NULL) {
|
||||
DHD_REORDER(("%s: received flags to cleanup, but no flow (%d) yet\n",
|
||||
__FUNCTION__, flow_id));
|
||||
*pkt_count = 1;
|
||||
*pkt = cur_pkt;
|
||||
return 0;
|
||||
}
|
||||
|
||||
dhd_get_hostreorder_pkts(dhd->osh, ptr, pkt, &cnt, &plast,
|
||||
ptr->exp_idx, ptr->exp_idx);
|
||||
/* set it to the last packet */
|
||||
if (plast) {
|
||||
PKTSETNEXT(dhd->osh, plast, cur_pkt);
|
||||
cnt++;
|
||||
}
|
||||
else {
|
||||
if (cnt != 0) {
|
||||
DHD_ERROR(("%s: del flow: something fishy, pending packets %d\n",
|
||||
__FUNCTION__, cnt));
|
||||
}
|
||||
*pkt = cur_pkt;
|
||||
cnt = 1;
|
||||
}
|
||||
buf_size += ((ptr->max_idx + 1) * sizeof(void *));
|
||||
MFREE(dhd->osh, ptr, buf_size);
|
||||
dhd->reorder_bufs[flow_id] = NULL;
|
||||
*pkt_count = cnt;
|
||||
return 0;
|
||||
}
|
||||
/* all the other cases depend on the existance of the reorder struct for that flow id */
|
||||
if (ptr == NULL) {
|
||||
uint32 buf_size_alloc = sizeof(reorder_info_t);
|
||||
max_idx = reorder_info_buf[WLHOST_REORDERDATA_MAXIDX_OFFSET];
|
||||
|
||||
buf_size_alloc += ((max_idx + 1) * sizeof(void*));
|
||||
/* allocate space to hold the buffers, index etc */
|
||||
|
||||
DHD_REORDER(("%s: alloc buffer of size %d size, reorder info id %d, maxidx %d\n",
|
||||
__FUNCTION__, buf_size_alloc, flow_id, max_idx));
|
||||
ptr = (struct reorder_info *)MALLOC(dhd->osh, buf_size_alloc);
|
||||
if (ptr == NULL) {
|
||||
DHD_ERROR(("%s: Malloc failed to alloc buffer\n", __FUNCTION__));
|
||||
*pkt_count = 1;
|
||||
return 0;
|
||||
}
|
||||
bzero(ptr, buf_size_alloc);
|
||||
dhd->reorder_bufs[flow_id] = ptr;
|
||||
ptr->p = (void *)(ptr+1);
|
||||
ptr->max_idx = max_idx;
|
||||
}
|
||||
if (flags & WLHOST_REORDERDATA_NEW_HOLE) {
|
||||
DHD_REORDER(("%s: new hole, so cleanup pending buffers\n", __FUNCTION__));
|
||||
if (ptr->pend_pkts) {
|
||||
dhd_get_hostreorder_pkts(dhd->osh, ptr, pkt, &cnt, &plast,
|
||||
ptr->exp_idx, ptr->exp_idx);
|
||||
ptr->pend_pkts = 0;
|
||||
}
|
||||
ptr->cur_idx = reorder_info_buf[WLHOST_REORDERDATA_CURIDX_OFFSET];
|
||||
ptr->exp_idx = reorder_info_buf[WLHOST_REORDERDATA_EXPIDX_OFFSET];
|
||||
ptr->max_idx = reorder_info_buf[WLHOST_REORDERDATA_MAXIDX_OFFSET];
|
||||
ptr->p[ptr->cur_idx] = cur_pkt;
|
||||
ptr->pend_pkts++;
|
||||
*pkt_count = cnt;
|
||||
}
|
||||
else if (flags & WLHOST_REORDERDATA_CURIDX_VALID) {
|
||||
cur_idx = reorder_info_buf[WLHOST_REORDERDATA_CURIDX_OFFSET];
|
||||
exp_idx = reorder_info_buf[WLHOST_REORDERDATA_EXPIDX_OFFSET];
|
||||
|
||||
|
||||
if ((exp_idx == ptr->exp_idx) && (cur_idx != ptr->exp_idx)) {
|
||||
/* still in the current hole */
|
||||
/* enqueue the current on the buffer chain */
|
||||
if (ptr->p[cur_idx] != NULL) {
|
||||
DHD_REORDER(("%s: HOLE: ERROR buffer pending..free it\n",
|
||||
__FUNCTION__));
|
||||
PKTFREE(dhd->osh, ptr->p[cur_idx], TRUE);
|
||||
ptr->p[cur_idx] = NULL;
|
||||
}
|
||||
ptr->p[cur_idx] = cur_pkt;
|
||||
ptr->pend_pkts++;
|
||||
ptr->cur_idx = cur_idx;
|
||||
DHD_REORDER(("%s: fill up a hole..pending packets is %d\n",
|
||||
__FUNCTION__, ptr->pend_pkts));
|
||||
*pkt_count = 0;
|
||||
*pkt = NULL;
|
||||
}
|
||||
else if (ptr->exp_idx == cur_idx) {
|
||||
/* got the right one ..flush from cur to exp and update exp */
|
||||
DHD_REORDER(("%s: got the right one now, cur_idx is %d\n",
|
||||
__FUNCTION__, cur_idx));
|
||||
if (ptr->p[cur_idx] != NULL) {
|
||||
DHD_REORDER(("%s: Error buffer pending..free it\n",
|
||||
__FUNCTION__));
|
||||
PKTFREE(dhd->osh, ptr->p[cur_idx], TRUE);
|
||||
ptr->p[cur_idx] = NULL;
|
||||
}
|
||||
ptr->p[cur_idx] = cur_pkt;
|
||||
ptr->pend_pkts++;
|
||||
|
||||
ptr->cur_idx = cur_idx;
|
||||
ptr->exp_idx = exp_idx;
|
||||
|
||||
dhd_get_hostreorder_pkts(dhd->osh, ptr, pkt, &cnt, &plast,
|
||||
cur_idx, exp_idx);
|
||||
*pkt_count = cnt;
|
||||
DHD_REORDER(("%s: freeing up buffers %d, still pending %d\n",
|
||||
__FUNCTION__, cnt, ptr->pend_pkts));
|
||||
}
|
||||
else {
|
||||
uint8 end_idx;
|
||||
bool flush_current = FALSE;
|
||||
/* both cur and exp are moved now .. */
|
||||
DHD_REORDER(("%s:, flow %d, both moved, cur %d(%d), exp %d(%d)\n",
|
||||
__FUNCTION__, flow_id, ptr->cur_idx, cur_idx,
|
||||
ptr->exp_idx, exp_idx));
|
||||
if (flags & WLHOST_REORDERDATA_FLUSH_ALL)
|
||||
end_idx = ptr->exp_idx;
|
||||
else
|
||||
end_idx = exp_idx;
|
||||
|
||||
/* flush pkts first */
|
||||
dhd_get_hostreorder_pkts(dhd->osh, ptr, pkt, &cnt, &plast,
|
||||
ptr->exp_idx, end_idx);
|
||||
|
||||
if (cur_idx == ptr->max_idx) {
|
||||
if (exp_idx == 0)
|
||||
flush_current = TRUE;
|
||||
} else {
|
||||
if (exp_idx == cur_idx + 1)
|
||||
flush_current = TRUE;
|
||||
}
|
||||
if (flush_current) {
|
||||
if (plast)
|
||||
PKTSETNEXT(dhd->osh, plast, cur_pkt);
|
||||
else
|
||||
*pkt = cur_pkt;
|
||||
cnt++;
|
||||
}
|
||||
else {
|
||||
ptr->p[cur_idx] = cur_pkt;
|
||||
ptr->pend_pkts++;
|
||||
}
|
||||
ptr->exp_idx = exp_idx;
|
||||
ptr->cur_idx = cur_idx;
|
||||
*pkt_count = cnt;
|
||||
}
|
||||
}
|
||||
else {
|
||||
uint8 end_idx;
|
||||
/* no real packet but update to exp_seq...that means explicit window move */
|
||||
exp_idx = reorder_info_buf[WLHOST_REORDERDATA_EXPIDX_OFFSET];
|
||||
|
||||
DHD_REORDER(("%s: move the window, cur_idx is %d, exp is %d, new exp is %d\n",
|
||||
__FUNCTION__, ptr->cur_idx, ptr->exp_idx, exp_idx));
|
||||
if (flags & WLHOST_REORDERDATA_FLUSH_ALL)
|
||||
end_idx = ptr->exp_idx;
|
||||
else
|
||||
end_idx = exp_idx;
|
||||
|
||||
dhd_get_hostreorder_pkts(dhd->osh, ptr, pkt, &cnt, &plast, ptr->exp_idx, end_idx);
|
||||
if (plast)
|
||||
PKTSETNEXT(dhd->osh, plast, cur_pkt);
|
||||
else
|
||||
*pkt = cur_pkt;
|
||||
cnt++;
|
||||
*pkt_count = cnt;
|
||||
/* set the new expected idx */
|
||||
ptr->exp_idx = exp_idx;
|
||||
}
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,271 @@
|
|||
/*
|
||||
* Linux cfg80211 driver - Dongle Host Driver (DHD) related
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: dhd_cfg80211.c 699163 2017-05-12 05:18:23Z $
|
||||
*/
|
||||
|
||||
#include <linux/vmalloc.h>
|
||||
#include <net/rtnetlink.h>
|
||||
|
||||
#include <bcmutils.h>
|
||||
#include <wldev_common.h>
|
||||
#include <wl_cfg80211.h>
|
||||
#include <dhd_cfg80211.h>
|
||||
|
||||
#ifdef PKT_FILTER_SUPPORT
|
||||
#include <dngl_stats.h>
|
||||
#include <dhd.h>
|
||||
#endif
|
||||
|
||||
#ifdef PKT_FILTER_SUPPORT
|
||||
extern uint dhd_pkt_filter_enable;
|
||||
extern uint dhd_master_mode;
|
||||
extern void dhd_pktfilter_offload_enable(dhd_pub_t * dhd, char *arg, int enable, int master_mode);
|
||||
#endif
|
||||
|
||||
static int dhd_dongle_up = FALSE;
|
||||
|
||||
#include <dngl_stats.h>
|
||||
#include <dhd.h>
|
||||
#include <dhdioctl.h>
|
||||
#include <wlioctl.h>
|
||||
#include <brcm_nl80211.h>
|
||||
#include <dhd_cfg80211.h>
|
||||
|
||||
static s32 wl_dongle_up(struct net_device *ndev);
|
||||
static s32 wl_dongle_down(struct net_device *ndev);
|
||||
|
||||
/**
|
||||
* Function implementations
|
||||
*/
|
||||
|
||||
s32 dhd_cfg80211_init(struct bcm_cfg80211 *cfg)
|
||||
{
|
||||
dhd_dongle_up = FALSE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 dhd_cfg80211_deinit(struct bcm_cfg80211 *cfg)
|
||||
{
|
||||
dhd_dongle_up = FALSE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 dhd_cfg80211_down(struct bcm_cfg80211 *cfg)
|
||||
{
|
||||
struct net_device *ndev;
|
||||
s32 err = 0;
|
||||
|
||||
WL_TRACE(("In\n"));
|
||||
if (!dhd_dongle_up) {
|
||||
WL_ERR(("Dongle is already down\n"));
|
||||
return err;
|
||||
}
|
||||
|
||||
ndev = bcmcfg_to_prmry_ndev(cfg);
|
||||
wl_dongle_down(ndev);
|
||||
dhd_dongle_up = FALSE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 dhd_cfg80211_set_p2p_info(struct bcm_cfg80211 *cfg, int val)
|
||||
{
|
||||
dhd_pub_t *dhd = (dhd_pub_t *)(cfg->pub);
|
||||
dhd->op_mode |= val;
|
||||
WL_ERR(("Set : op_mode=0x%04x\n", dhd->op_mode));
|
||||
#ifdef ARP_OFFLOAD_SUPPORT
|
||||
if (dhd->arp_version == 1) {
|
||||
/* IF P2P is enabled, disable arpoe */
|
||||
dhd_arp_offload_set(dhd, 0);
|
||||
dhd_arp_offload_enable(dhd, false);
|
||||
}
|
||||
#endif /* ARP_OFFLOAD_SUPPORT */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 dhd_cfg80211_clean_p2p_info(struct bcm_cfg80211 *cfg)
|
||||
{
|
||||
dhd_pub_t *dhd = (dhd_pub_t *)(cfg->pub);
|
||||
dhd->op_mode &= ~(DHD_FLAG_P2P_GC_MODE | DHD_FLAG_P2P_GO_MODE);
|
||||
WL_ERR(("Clean : op_mode=0x%04x\n", dhd->op_mode));
|
||||
|
||||
#ifdef ARP_OFFLOAD_SUPPORT
|
||||
if (dhd->arp_version == 1) {
|
||||
/* IF P2P is disabled, enable arpoe back for STA mode. */
|
||||
dhd_arp_offload_set(dhd, dhd_arp_mode);
|
||||
dhd_arp_offload_enable(dhd, true);
|
||||
}
|
||||
#endif /* ARP_OFFLOAD_SUPPORT */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct net_device* wl_cfg80211_allocate_if(struct bcm_cfg80211 *cfg, int ifidx, const char *name,
|
||||
uint8 *mac, uint8 bssidx, const char *dngl_name)
|
||||
{
|
||||
return dhd_allocate_if(cfg->pub, ifidx, name, mac, bssidx, FALSE, dngl_name);
|
||||
}
|
||||
|
||||
int wl_cfg80211_register_if(struct bcm_cfg80211 *cfg,
|
||||
int ifidx, struct net_device* ndev, bool rtnl_lock_reqd)
|
||||
{
|
||||
return dhd_register_if(cfg->pub, ifidx, rtnl_lock_reqd);
|
||||
}
|
||||
|
||||
int wl_cfg80211_remove_if(struct bcm_cfg80211 *cfg,
|
||||
int ifidx, struct net_device* ndev, bool rtnl_lock_reqd)
|
||||
{
|
||||
return dhd_remove_if(cfg->pub, ifidx, rtnl_lock_reqd);
|
||||
}
|
||||
|
||||
struct net_device * dhd_cfg80211_netdev_free(struct net_device *ndev)
|
||||
{
|
||||
if (ndev) {
|
||||
if (ndev->ieee80211_ptr) {
|
||||
kfree(ndev->ieee80211_ptr);
|
||||
ndev->ieee80211_ptr = NULL;
|
||||
}
|
||||
free_netdev(ndev);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return ndev;
|
||||
}
|
||||
|
||||
void dhd_netdev_free(struct net_device *ndev)
|
||||
{
|
||||
#ifdef WL_CFG80211
|
||||
ndev = dhd_cfg80211_netdev_free(ndev);
|
||||
#endif
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)
|
||||
if (ndev)
|
||||
free_netdev(ndev);
|
||||
#endif
|
||||
}
|
||||
|
||||
static s32
|
||||
wl_dongle_up(struct net_device *ndev)
|
||||
{
|
||||
s32 err = 0;
|
||||
u32 local_up = 0;
|
||||
|
||||
err = wldev_ioctl_set(ndev, WLC_UP, &local_up, sizeof(local_up));
|
||||
if (unlikely(err)) {
|
||||
WL_ERR(("WLC_UP error (%d)\n", err));
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
static s32
|
||||
wl_dongle_down(struct net_device *ndev)
|
||||
{
|
||||
s32 err = 0;
|
||||
u32 local_down = 0;
|
||||
|
||||
err = wldev_ioctl_set(ndev, WLC_DOWN, &local_down, sizeof(local_down));
|
||||
if (unlikely(err)) {
|
||||
WL_ERR(("WLC_DOWN error (%d)\n", err));
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
s32 dhd_config_dongle(struct bcm_cfg80211 *cfg)
|
||||
{
|
||||
#ifndef DHD_SDALIGN
|
||||
#define DHD_SDALIGN 32
|
||||
#endif
|
||||
struct net_device *ndev;
|
||||
s32 err = 0;
|
||||
|
||||
WL_TRACE(("In\n"));
|
||||
if (dhd_dongle_up) {
|
||||
WL_ERR(("Dongle is already up\n"));
|
||||
return err;
|
||||
}
|
||||
|
||||
ndev = bcmcfg_to_prmry_ndev(cfg);
|
||||
|
||||
err = wl_dongle_up(ndev);
|
||||
if (unlikely(err)) {
|
||||
WL_ERR(("wl_dongle_up failed\n"));
|
||||
goto default_conf_out;
|
||||
}
|
||||
dhd_dongle_up = true;
|
||||
|
||||
default_conf_out:
|
||||
|
||||
return err;
|
||||
|
||||
}
|
||||
|
||||
int dhd_cfgvendor_priv_string_handler(struct bcm_cfg80211 *cfg, struct wireless_dev *wdev,
|
||||
const struct bcm_nlmsg_hdr *nlioc, void *buf)
|
||||
{
|
||||
struct net_device *ndev = NULL;
|
||||
dhd_pub_t *dhd;
|
||||
dhd_ioctl_t ioc = { 0, NULL, 0, 0, 0, 0, 0};
|
||||
int ret = 0;
|
||||
int8 index;
|
||||
|
||||
WL_TRACE(("entry: cmd = %d\n", nlioc->cmd));
|
||||
|
||||
dhd = cfg->pub;
|
||||
DHD_OS_WAKE_LOCK(dhd);
|
||||
|
||||
/* send to dongle only if we are not waiting for reload already */
|
||||
if (dhd->hang_was_sent) {
|
||||
WL_ERR(("HANG was sent up earlier\n"));
|
||||
DHD_OS_WAKE_LOCK_CTRL_TIMEOUT_ENABLE(dhd, DHD_EVENT_TIMEOUT_MS);
|
||||
DHD_OS_WAKE_UNLOCK(dhd);
|
||||
return OSL_ERROR(BCME_DONGLE_DOWN);
|
||||
}
|
||||
|
||||
ndev = wdev_to_wlc_ndev(wdev, cfg);
|
||||
index = dhd_net2idx(dhd->info, ndev);
|
||||
if (index == DHD_BAD_IF) {
|
||||
WL_ERR(("Bad ifidx from wdev:%p\n", wdev));
|
||||
ret = BCME_ERROR;
|
||||
goto done;
|
||||
}
|
||||
|
||||
ioc.cmd = nlioc->cmd;
|
||||
ioc.len = nlioc->len;
|
||||
ioc.set = nlioc->set;
|
||||
ioc.driver = nlioc->magic;
|
||||
ioc.buf = buf;
|
||||
ret = dhd_ioctl_process(dhd, index, &ioc, buf);
|
||||
if (ret) {
|
||||
WL_TRACE(("dhd_ioctl_process return err %d\n", ret));
|
||||
ret = OSL_ERROR(ret);
|
||||
goto done;
|
||||
}
|
||||
|
||||
done:
|
||||
DHD_OS_WAKE_UNLOCK(dhd);
|
||||
return ret;
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* Linux cfg80211 driver - Dongle Host Driver (DHD) related
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: dhd_cfg80211.h 612483 2016-01-14 03:44:27Z $
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __DHD_CFG80211__
|
||||
#define __DHD_CFG80211__
|
||||
|
||||
#include <wl_cfg80211.h>
|
||||
#include <wl_cfgp2p.h>
|
||||
#include <brcm_nl80211.h>
|
||||
|
||||
#ifndef WL_ERR
|
||||
#define WL_ERR CFG80211_ERR
|
||||
#endif
|
||||
#ifndef WL_TRACE
|
||||
#define WL_TRACE CFG80211_TRACE
|
||||
#endif
|
||||
|
||||
s32 dhd_cfg80211_init(struct bcm_cfg80211 *cfg);
|
||||
s32 dhd_cfg80211_deinit(struct bcm_cfg80211 *cfg);
|
||||
s32 dhd_cfg80211_down(struct bcm_cfg80211 *cfg);
|
||||
s32 dhd_cfg80211_set_p2p_info(struct bcm_cfg80211 *cfg, int val);
|
||||
s32 dhd_cfg80211_clean_p2p_info(struct bcm_cfg80211 *cfg);
|
||||
s32 dhd_config_dongle(struct bcm_cfg80211 *cfg);
|
||||
int dhd_cfgvendor_priv_string_handler(struct bcm_cfg80211 *cfg,
|
||||
struct wireless_dev *wdev, const struct bcm_nlmsg_hdr *nlioc, void *data);
|
||||
|
||||
#endif /* __DHD_CFG80211__ */
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,293 @@
|
|||
|
||||
#ifndef _dhd_config_
|
||||
#define _dhd_config_
|
||||
|
||||
#include <bcmdevs.h>
|
||||
#include <dngl_stats.h>
|
||||
#include <dhd.h>
|
||||
#include <wlioctl.h>
|
||||
#include <802.11.h>
|
||||
|
||||
#define FW_TYPE_STA 0
|
||||
#define FW_TYPE_APSTA 1
|
||||
#define FW_TYPE_P2P 2
|
||||
#define FW_TYPE_MESH 3
|
||||
#define FW_TYPE_ES 4
|
||||
#define FW_TYPE_MFG 5
|
||||
#define FW_TYPE_G 0
|
||||
#define FW_TYPE_AG 1
|
||||
|
||||
#define FW_PATH_AUTO_SELECT 1
|
||||
//#define CONFIG_PATH_AUTO_SELECT
|
||||
extern char firmware_path[MOD_PARAM_PATHLEN];
|
||||
#if defined(BCMSDIO) || defined(BCMPCIE)
|
||||
extern uint dhd_rxbound;
|
||||
extern uint dhd_txbound;
|
||||
#endif
|
||||
#ifdef BCMSDIO
|
||||
#define TXGLOM_RECV_OFFSET 8
|
||||
extern uint dhd_doflow;
|
||||
extern uint dhd_slpauto;
|
||||
#endif
|
||||
|
||||
typedef struct wl_mac_range {
|
||||
uint32 oui;
|
||||
uint32 nic_start;
|
||||
uint32 nic_end;
|
||||
} wl_mac_range_t;
|
||||
|
||||
typedef struct wl_mac_list {
|
||||
int count;
|
||||
wl_mac_range_t *mac;
|
||||
char name[MOD_PARAM_PATHLEN];
|
||||
} wl_mac_list_t;
|
||||
|
||||
typedef struct wl_mac_list_ctrl {
|
||||
int count;
|
||||
struct wl_mac_list *m_mac_list_head;
|
||||
} wl_mac_list_ctrl_t;
|
||||
|
||||
typedef struct wl_chip_nv_path {
|
||||
uint chip;
|
||||
uint chiprev;
|
||||
char name[MOD_PARAM_PATHLEN];
|
||||
} wl_chip_nv_path_t;
|
||||
|
||||
typedef struct wl_chip_nv_path_list_ctrl {
|
||||
int count;
|
||||
struct wl_chip_nv_path *m_chip_nv_path_head;
|
||||
} wl_chip_nv_path_list_ctrl_t;
|
||||
|
||||
typedef struct wl_channel_list {
|
||||
uint32 count;
|
||||
uint32 channel[WL_NUMCHANNELS];
|
||||
} wl_channel_list_t;
|
||||
|
||||
typedef struct wmes_param {
|
||||
int aifsn[AC_COUNT];
|
||||
int ecwmin[AC_COUNT];
|
||||
int ecwmax[AC_COUNT];
|
||||
int txop[AC_COUNT];
|
||||
} wme_param_t;
|
||||
|
||||
#ifdef PKT_FILTER_SUPPORT
|
||||
#define DHD_CONF_FILTER_MAX 8
|
||||
#define PKT_FILTER_LEN 300
|
||||
#define MAGIC_PKT_FILTER_LEN 450
|
||||
typedef struct conf_pkt_filter_add {
|
||||
uint32 count;
|
||||
char filter[DHD_CONF_FILTER_MAX][PKT_FILTER_LEN];
|
||||
} conf_pkt_filter_add_t;
|
||||
|
||||
typedef struct conf_pkt_filter_del {
|
||||
uint32 count;
|
||||
uint32 id[DHD_CONF_FILTER_MAX];
|
||||
} conf_pkt_filter_del_t;
|
||||
#endif
|
||||
|
||||
#define CONFIG_COUNTRY_LIST_SIZE 100
|
||||
typedef struct conf_country_list {
|
||||
uint32 count;
|
||||
wl_country_t *cspec[CONFIG_COUNTRY_LIST_SIZE];
|
||||
} conf_country_list_t;
|
||||
|
||||
/* mchan_params */
|
||||
#define MCHAN_MAX_NUM 4
|
||||
#define MIRACAST_SOURCE 1
|
||||
#define MIRACAST_SINK 2
|
||||
typedef struct mchan_params {
|
||||
int bw;
|
||||
int p2p_mode;
|
||||
int miracast_mode;
|
||||
} mchan_params_t;
|
||||
|
||||
enum in4way_flags {
|
||||
NO_SCAN_IN4WAY = (1 << (0)),
|
||||
NO_BTC_IN4WAY = (1 << (1)),
|
||||
DONT_DELETE_GC_AFTER_WPS = (1 << (2)),
|
||||
WAIT_DISCONNECTED = (1 << (3)),
|
||||
};
|
||||
|
||||
enum in_suspend_flags {
|
||||
NO_EVENT_IN_SUSPEND = (1 << (0)),
|
||||
NO_TXDATA_IN_SUSPEND = (1 << (1)),
|
||||
NO_TXCTL_IN_SUSPEND = (1 << (2)),
|
||||
AP_DOWN_IN_SUSPEND = (1 << (3)),
|
||||
ROAM_OFFLOAD_IN_SUSPEND = (1 << (4)),
|
||||
AP_FILTER_IN_SUSPEND = (1 << (5)),
|
||||
WOWL_IN_SUSPEND = (1 << (6)),
|
||||
ALL_IN_SUSPEND = 0xFFFFFFFF,
|
||||
};
|
||||
|
||||
enum eapol_status {
|
||||
EAPOL_STATUS_NONE = 0,
|
||||
EAPOL_STATUS_WPS_REQID = 1,
|
||||
EAPOL_STATUS_WPS_RSPID = 2,
|
||||
EAPOL_STATUS_WPS_WSC_START = 3,
|
||||
EAPOL_STATUS_WPS_M1 = 4,
|
||||
EAPOL_STATUS_WPS_M2 = 5,
|
||||
EAPOL_STATUS_WPS_M3 = 6,
|
||||
EAPOL_STATUS_WPS_M4 = 7,
|
||||
EAPOL_STATUS_WPS_M5 = 8,
|
||||
EAPOL_STATUS_WPS_M6 = 9,
|
||||
EAPOL_STATUS_WPS_M7 = 10,
|
||||
EAPOL_STATUS_WPS_M8 = 11,
|
||||
EAPOL_STATUS_WPS_DONE = 12,
|
||||
EAPOL_STATUS_WPA_START = 13,
|
||||
EAPOL_STATUS_WPA_M1 = 14,
|
||||
EAPOL_STATUS_WPA_M2 = 15,
|
||||
EAPOL_STATUS_WPA_M3 = 16,
|
||||
EAPOL_STATUS_WPA_M4 = 17,
|
||||
EAPOL_STATUS_WPA_END = 18
|
||||
};
|
||||
|
||||
typedef struct dhd_conf {
|
||||
uint chip;
|
||||
uint chiprev;
|
||||
int fw_type;
|
||||
wl_mac_list_ctrl_t fw_by_mac;
|
||||
wl_mac_list_ctrl_t nv_by_mac;
|
||||
wl_chip_nv_path_list_ctrl_t nv_by_chip;
|
||||
conf_country_list_t country_list;
|
||||
int band;
|
||||
int bw_cap[2];
|
||||
wl_country_t cspec;
|
||||
wl_channel_list_t channels;
|
||||
uint roam_off;
|
||||
uint roam_off_suspend;
|
||||
int roam_trigger[2];
|
||||
int roam_scan_period[2];
|
||||
int roam_delta[2];
|
||||
int fullroamperiod;
|
||||
uint keep_alive_period;
|
||||
int force_wme_ac;
|
||||
wme_param_t wme_sta;
|
||||
wme_param_t wme_ap;
|
||||
int phy_oclscdenable;
|
||||
#ifdef PKT_FILTER_SUPPORT
|
||||
conf_pkt_filter_add_t pkt_filter_add;
|
||||
conf_pkt_filter_del_t pkt_filter_del;
|
||||
char *magic_pkt_filter_add;
|
||||
#endif
|
||||
int srl;
|
||||
int lrl;
|
||||
uint bcn_timeout;
|
||||
int txbf;
|
||||
int disable_proptx;
|
||||
int dhd_poll;
|
||||
#ifdef BCMSDIO
|
||||
int use_rxchain;
|
||||
bool bus_rxglom;
|
||||
bool txglom_ext; /* Only for 43362/4330/43340/43341/43241 */
|
||||
/* terence 20161011:
|
||||
1) conf->tx_max_offset = 1 to fix credict issue in adaptivity testing
|
||||
2) conf->tx_max_offset = 1 will cause to UDP Tx not work in rxglom supported,
|
||||
but not happened in sw txglom
|
||||
*/
|
||||
int tx_max_offset;
|
||||
uint txglomsize;
|
||||
int txctl_tmo_fix;
|
||||
bool txglom_mode;
|
||||
uint deferred_tx_len;
|
||||
/*txglom_bucket_size:
|
||||
* 43362/4330: 1680
|
||||
* 43340/43341/43241: 1684
|
||||
*/
|
||||
int txglom_bucket_size;
|
||||
int txinrx_thres;
|
||||
int dhd_txminmax; // -1=DATABUFCNT(bus)
|
||||
uint sd_f2_blocksize;
|
||||
bool oob_enabled_later;
|
||||
#endif
|
||||
#ifdef BCMPCIE
|
||||
int bus_deepsleep_disable;
|
||||
#endif
|
||||
int dpc_cpucore;
|
||||
int rxf_cpucore;
|
||||
int frameburst;
|
||||
bool deepsleep;
|
||||
int pm;
|
||||
int pm_in_suspend;
|
||||
int suspend_bcn_li_dtim;
|
||||
#ifdef DHDTCPACK_SUPPRESS
|
||||
uint8 tcpack_sup_mode;
|
||||
#endif
|
||||
int pktprio8021x;
|
||||
uint insuspend;
|
||||
bool suspended;
|
||||
#ifdef SUSPEND_EVENT
|
||||
char resume_eventmask[WL_EVENTING_MASK_LEN];
|
||||
struct ether_addr bssid_insuspend;
|
||||
bool wlfc;
|
||||
#endif
|
||||
#ifdef IDHCP
|
||||
int dhcpc_enable;
|
||||
int dhcpd_enable;
|
||||
struct ipv4_addr dhcpd_ip_addr;
|
||||
struct ipv4_addr dhcpd_ip_mask;
|
||||
struct ipv4_addr dhcpd_ip_start;
|
||||
struct ipv4_addr dhcpd_ip_end;
|
||||
#endif
|
||||
#ifdef ISAM_PREINIT
|
||||
char isam_init[50];
|
||||
char isam_config[300];
|
||||
char isam_enable[50];
|
||||
#endif
|
||||
int ctrl_resched;
|
||||
int dhd_ioctl_timeout_msec;
|
||||
struct mchan_params mchan[MCHAN_MAX_NUM];
|
||||
char *wl_preinit;
|
||||
int tsq;
|
||||
int orphan_move;
|
||||
uint eapol_status;
|
||||
uint in4way;
|
||||
uint max_wait_gc_time;
|
||||
#ifdef WL_EXT_WOWL
|
||||
uint wowl;
|
||||
#endif
|
||||
} dhd_conf_t;
|
||||
|
||||
#ifdef BCMSDIO
|
||||
int dhd_conf_get_mac(dhd_pub_t *dhd, bcmsdh_info_t *sdh, uint8 *mac);
|
||||
#if defined(HW_OOB) || defined(FORCE_WOWLAN)
|
||||
void dhd_conf_set_hw_oob_intr(bcmsdh_info_t *sdh, uint chip);
|
||||
#endif
|
||||
void dhd_conf_set_txglom_params(dhd_pub_t *dhd, bool enable);
|
||||
int dhd_conf_set_blksize(bcmsdh_info_t *sdh);
|
||||
#endif
|
||||
void dhd_conf_set_path_params(dhd_pub_t *dhd, void *sdh,
|
||||
char *fw_path, char *nv_path);
|
||||
int dhd_conf_set_intiovar(dhd_pub_t *dhd, uint cmd, char *name, int val,
|
||||
int def, bool down);
|
||||
int dhd_conf_get_band(dhd_pub_t *dhd);
|
||||
int dhd_conf_set_country(dhd_pub_t *dhd, wl_country_t *cspec);
|
||||
int dhd_conf_get_country(dhd_pub_t *dhd, wl_country_t *cspec);
|
||||
int dhd_conf_map_country_list(dhd_pub_t *dhd, wl_country_t *cspec);
|
||||
int dhd_conf_fix_country(dhd_pub_t *dhd);
|
||||
bool dhd_conf_match_channel(dhd_pub_t *dhd, uint32 channel);
|
||||
void dhd_conf_set_wme(dhd_pub_t *dhd, int ifidx, int mode);
|
||||
void dhd_conf_set_mchan_bw(dhd_pub_t *dhd, int go, int source);
|
||||
void dhd_conf_add_pkt_filter(dhd_pub_t *dhd);
|
||||
bool dhd_conf_del_pkt_filter(dhd_pub_t *dhd, uint32 id);
|
||||
void dhd_conf_discard_pkt_filter(dhd_pub_t *dhd);
|
||||
int dhd_conf_read_config(dhd_pub_t *dhd, char *conf_path);
|
||||
int dhd_conf_set_chiprev(dhd_pub_t *dhd, uint chip, uint chiprev);
|
||||
uint dhd_conf_get_chip(void *context);
|
||||
uint dhd_conf_get_chiprev(void *context);
|
||||
int dhd_conf_get_pm(dhd_pub_t *dhd);
|
||||
int dhd_conf_check_hostsleep(dhd_pub_t *dhd, int cmd, void *buf, int len,
|
||||
int *hostsleep_set, int *hostsleep_val, int *ret);
|
||||
void dhd_conf_get_hostsleep(dhd_pub_t *dhd,
|
||||
int hostsleep_set, int hostsleep_val, int ret);
|
||||
#ifdef PROP_TXSTATUS
|
||||
int dhd_conf_get_disable_proptx(dhd_pub_t *dhd);
|
||||
#endif
|
||||
uint dhd_conf_get_insuspend(dhd_pub_t *dhd, uint mask);
|
||||
int dhd_conf_set_suspend_resume(dhd_pub_t *dhd, int suspend);
|
||||
void dhd_conf_postinit_ioctls(dhd_pub_t *dhd);
|
||||
int dhd_conf_preinit(dhd_pub_t *dhd);
|
||||
int dhd_conf_reset(dhd_pub_t *dhd);
|
||||
int dhd_conf_attach(dhd_pub_t *dhd);
|
||||
void dhd_conf_detach(dhd_pub_t *dhd);
|
||||
void *dhd_get_pub(struct net_device *dev);
|
||||
#endif /* _dhd_config_ */
|
|
@ -0,0 +1,299 @@
|
|||
/*
|
||||
* Customer code to add GPIO control during WLAN start/stop
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: dhd_custom_gpio.c 664997 2016-10-14 11:56:35Z $
|
||||
*/
|
||||
|
||||
#include <typedefs.h>
|
||||
#include <linuxver.h>
|
||||
#include <osl.h>
|
||||
#include <bcmutils.h>
|
||||
#include <dngl_stats.h>
|
||||
#include <dhd.h>
|
||||
#include <dhd_linux.h>
|
||||
|
||||
#include <wlioctl.h>
|
||||
|
||||
#define WL_ERROR(x) printf x
|
||||
#define WL_TRACE(x)
|
||||
|
||||
#if defined(OOB_INTR_ONLY)
|
||||
|
||||
#if defined(BCMLXSDMMC)
|
||||
extern int sdioh_mmc_irq(int irq);
|
||||
#endif /* (BCMLXSDMMC) */
|
||||
|
||||
/* Customer specific Host GPIO defintion */
|
||||
static int dhd_oob_gpio_num = -1;
|
||||
|
||||
module_param(dhd_oob_gpio_num, int, 0644);
|
||||
MODULE_PARM_DESC(dhd_oob_gpio_num, "DHD oob gpio number");
|
||||
|
||||
/* This function will return:
|
||||
* 1) return : Host gpio interrupt number per customer platform
|
||||
* 2) irq_flags_ptr : Type of Host interrupt as Level or Edge
|
||||
*
|
||||
* NOTE :
|
||||
* Customer should check his platform definitions
|
||||
* and his Host Interrupt spec
|
||||
* to figure out the proper setting for his platform.
|
||||
* Broadcom provides just reference settings as example.
|
||||
*
|
||||
*/
|
||||
int dhd_customer_oob_irq_map(void *adapter, unsigned long *irq_flags_ptr)
|
||||
{
|
||||
int host_oob_irq = 0;
|
||||
|
||||
#if defined(CUSTOMER_HW2)
|
||||
host_oob_irq = wifi_platform_get_irq_number(adapter, irq_flags_ptr);
|
||||
|
||||
#else
|
||||
#if defined(CUSTOM_OOB_GPIO_NUM)
|
||||
if (dhd_oob_gpio_num < 0) {
|
||||
dhd_oob_gpio_num = CUSTOM_OOB_GPIO_NUM;
|
||||
}
|
||||
#endif /* CUSTOMER_OOB_GPIO_NUM */
|
||||
|
||||
if (dhd_oob_gpio_num < 0) {
|
||||
WL_ERROR(("%s: ERROR customer specific Host GPIO is NOT defined \n",
|
||||
__FUNCTION__));
|
||||
return (dhd_oob_gpio_num);
|
||||
}
|
||||
|
||||
WL_ERROR(("%s: customer specific Host GPIO number is (%d)\n",
|
||||
__FUNCTION__, dhd_oob_gpio_num));
|
||||
|
||||
#endif
|
||||
|
||||
return (host_oob_irq);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Customer function to control hw specific wlan gpios */
|
||||
int
|
||||
dhd_customer_gpio_wlan_ctrl(void *adapter, int onoff)
|
||||
{
|
||||
int err = 0;
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
#ifdef GET_CUSTOM_MAC_ENABLE
|
||||
/* Function to get custom MAC address */
|
||||
int
|
||||
dhd_custom_get_mac_address(void *adapter, unsigned char *buf)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
WL_TRACE(("%s Enter\n", __FUNCTION__));
|
||||
if (!buf)
|
||||
return -EINVAL;
|
||||
|
||||
/* Customer access to MAC address stored outside of DHD driver */
|
||||
#if defined(CUSTOMER_HW2) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35))
|
||||
ret = wifi_platform_get_mac_addr(adapter, buf);
|
||||
#endif
|
||||
|
||||
#ifdef EXAMPLE_GET_MAC
|
||||
/* EXAMPLE code */
|
||||
{
|
||||
struct ether_addr ea_example = {{0x00, 0x11, 0x22, 0x33, 0x44, 0xFF}};
|
||||
bcopy((char *)&ea_example, buf, sizeof(struct ether_addr));
|
||||
}
|
||||
#endif /* EXAMPLE_GET_MAC */
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif /* GET_CUSTOM_MAC_ENABLE */
|
||||
|
||||
/* Customized Locale table : OPTIONAL feature */
|
||||
const struct cntry_locales_custom translate_custom_table[] = {
|
||||
/* Table should be filled out based on custom platform regulatory requirement */
|
||||
#ifdef EXAMPLE_TABLE
|
||||
{"", "XY", 4}, /* Universal if Country code is unknown or empty */
|
||||
{"US", "US", 69}, /* input ISO "US" to : US regrev 69 */
|
||||
{"CA", "US", 69}, /* input ISO "CA" to : US regrev 69 */
|
||||
{"EU", "EU", 5}, /* European union countries to : EU regrev 05 */
|
||||
{"AT", "EU", 5},
|
||||
{"BE", "EU", 5},
|
||||
{"BG", "EU", 5},
|
||||
{"CY", "EU", 5},
|
||||
{"CZ", "EU", 5},
|
||||
{"DK", "EU", 5},
|
||||
{"EE", "EU", 5},
|
||||
{"FI", "EU", 5},
|
||||
{"FR", "EU", 5},
|
||||
{"DE", "EU", 5},
|
||||
{"GR", "EU", 5},
|
||||
{"HU", "EU", 5},
|
||||
{"IE", "EU", 5},
|
||||
{"IT", "EU", 5},
|
||||
{"LV", "EU", 5},
|
||||
{"LI", "EU", 5},
|
||||
{"LT", "EU", 5},
|
||||
{"LU", "EU", 5},
|
||||
{"MT", "EU", 5},
|
||||
{"NL", "EU", 5},
|
||||
{"PL", "EU", 5},
|
||||
{"PT", "EU", 5},
|
||||
{"RO", "EU", 5},
|
||||
{"SK", "EU", 5},
|
||||
{"SI", "EU", 5},
|
||||
{"ES", "EU", 5},
|
||||
{"SE", "EU", 5},
|
||||
{"GB", "EU", 5},
|
||||
{"KR", "XY", 3},
|
||||
{"AU", "XY", 3},
|
||||
{"CN", "XY", 3}, /* input ISO "CN" to : XY regrev 03 */
|
||||
{"TW", "XY", 3},
|
||||
{"AR", "XY", 3},
|
||||
{"MX", "XY", 3},
|
||||
{"IL", "IL", 0},
|
||||
{"CH", "CH", 0},
|
||||
{"TR", "TR", 0},
|
||||
{"NO", "NO", 0},
|
||||
#endif /* EXMAPLE_TABLE */
|
||||
#if defined(CUSTOMER_HW2)
|
||||
#if defined(BCM4335_CHIP)
|
||||
{"", "XZ", 11}, /* Universal if Country code is unknown or empty */
|
||||
#endif
|
||||
{"AE", "AE", 1},
|
||||
{"AR", "AR", 1},
|
||||
{"AT", "AT", 1},
|
||||
{"AU", "AU", 2},
|
||||
{"BE", "BE", 1},
|
||||
{"BG", "BG", 1},
|
||||
{"BN", "BN", 1},
|
||||
{"CA", "CA", 2},
|
||||
{"CH", "CH", 1},
|
||||
{"CY", "CY", 1},
|
||||
{"CZ", "CZ", 1},
|
||||
{"DE", "DE", 3},
|
||||
{"DK", "DK", 1},
|
||||
{"EE", "EE", 1},
|
||||
{"ES", "ES", 1},
|
||||
{"FI", "FI", 1},
|
||||
{"FR", "FR", 1},
|
||||
{"GB", "GB", 1},
|
||||
{"GR", "GR", 1},
|
||||
{"HR", "HR", 1},
|
||||
{"HU", "HU", 1},
|
||||
{"IE", "IE", 1},
|
||||
{"IS", "IS", 1},
|
||||
{"IT", "IT", 1},
|
||||
{"ID", "ID", 1},
|
||||
{"JP", "JP", 8},
|
||||
{"KR", "KR", 24},
|
||||
{"KW", "KW", 1},
|
||||
{"LI", "LI", 1},
|
||||
{"LT", "LT", 1},
|
||||
{"LU", "LU", 1},
|
||||
{"LV", "LV", 1},
|
||||
{"MA", "MA", 1},
|
||||
{"MT", "MT", 1},
|
||||
{"MX", "MX", 1},
|
||||
{"NL", "NL", 1},
|
||||
{"NO", "NO", 1},
|
||||
{"PL", "PL", 1},
|
||||
{"PT", "PT", 1},
|
||||
{"PY", "PY", 1},
|
||||
{"RO", "RO", 1},
|
||||
{"SE", "SE", 1},
|
||||
{"SI", "SI", 1},
|
||||
{"SK", "SK", 1},
|
||||
{"TR", "TR", 7},
|
||||
{"TW", "TW", 1},
|
||||
{"IR", "XZ", 11}, /* Universal if Country code is IRAN, (ISLAMIC REPUBLIC OF) */
|
||||
{"SD", "XZ", 11}, /* Universal if Country code is SUDAN */
|
||||
{"SY", "XZ", 11}, /* Universal if Country code is SYRIAN ARAB REPUBLIC */
|
||||
{"GL", "XZ", 11}, /* Universal if Country code is GREENLAND */
|
||||
{"PS", "XZ", 11}, /* Universal if Country code is PALESTINIAN TERRITORY, OCCUPIED */
|
||||
{"TL", "XZ", 11}, /* Universal if Country code is TIMOR-LESTE (EAST TIMOR) */
|
||||
{"MH", "XZ", 11}, /* Universal if Country code is MARSHALL ISLANDS */
|
||||
#ifdef BCM4330_CHIP
|
||||
{"RU", "RU", 1},
|
||||
{"US", "US", 5}
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
/* Customized Locale convertor
|
||||
* input : ISO 3166-1 country abbreviation
|
||||
* output: customized cspec
|
||||
*/
|
||||
void
|
||||
#ifdef CUSTOM_COUNTRY_CODE
|
||||
get_customized_country_code(void *adapter, char *country_iso_code,
|
||||
wl_country_t *cspec, u32 flags)
|
||||
#else
|
||||
get_customized_country_code(void *adapter, char *country_iso_code, wl_country_t *cspec)
|
||||
#endif /* CUSTOM_COUNTRY_CODE */
|
||||
{
|
||||
#if (defined(CUSTOMER_HW) || defined(CUSTOMER_HW2)) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39))
|
||||
|
||||
struct cntry_locales_custom *cloc_ptr;
|
||||
|
||||
if (!cspec)
|
||||
return;
|
||||
#ifdef CUSTOM_COUNTRY_CODE
|
||||
cloc_ptr = wifi_platform_get_country_code(adapter, country_iso_code, flags);
|
||||
#else
|
||||
cloc_ptr = wifi_platform_get_country_code(adapter, country_iso_code);
|
||||
#endif /* CUSTOM_COUNTRY_CODE */
|
||||
|
||||
if (cloc_ptr) {
|
||||
strlcpy(cspec->ccode, cloc_ptr->custom_locale, WLC_CNTRY_BUF_SZ);
|
||||
cspec->rev = cloc_ptr->custom_locale_rev;
|
||||
}
|
||||
return;
|
||||
#else
|
||||
int size, i;
|
||||
|
||||
size = ARRAYSIZE(translate_custom_table);
|
||||
|
||||
if (cspec == 0)
|
||||
return;
|
||||
|
||||
if (size == 0)
|
||||
return;
|
||||
|
||||
for (i = 0; i < size; i++) {
|
||||
if (strcmp(country_iso_code, translate_custom_table[i].iso_abbrev) == 0) {
|
||||
memcpy(cspec->ccode,
|
||||
translate_custom_table[i].custom_locale, WLC_CNTRY_BUF_SZ);
|
||||
cspec->rev = translate_custom_table[i].custom_locale_rev;
|
||||
return;
|
||||
}
|
||||
}
|
||||
#ifdef EXAMPLE_TABLE
|
||||
/* if no country code matched return first universal code from translate_custom_table */
|
||||
memcpy(cspec->ccode, translate_custom_table[0].custom_locale, WLC_CNTRY_BUF_SZ);
|
||||
cspec->rev = translate_custom_table[0].custom_locale_rev;
|
||||
#endif /* EXMAPLE_TABLE */
|
||||
return;
|
||||
#endif /* defined(CUSTOMER_HW2) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)) */
|
||||
}
|
|
@ -0,0 +1,513 @@
|
|||
/*
|
||||
* Platform Dependent file for usage of Preallocted Memory
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: dhd_custom_memprealloc.c 707595 2017-06-28 08:28:30Z $
|
||||
*/
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/miscdevice.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/unistd.h>
|
||||
#include <linux/bug.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/init.h>
|
||||
|
||||
#ifdef CONFIG_BROADCOM_WIFI_RESERVED_MEM
|
||||
|
||||
#define WLAN_STATIC_SCAN_BUF0 5
|
||||
#define WLAN_STATIC_SCAN_BUF1 6
|
||||
#define WLAN_STATIC_DHD_INFO_BUF 7
|
||||
#define WLAN_STATIC_DHD_WLFC_BUF 8
|
||||
#define WLAN_STATIC_DHD_IF_FLOW_LKUP 9
|
||||
#define WLAN_STATIC_DHD_MEMDUMP_RAM 11
|
||||
#define WLAN_STATIC_DHD_WLFC_HANGER 12
|
||||
#define WLAN_STATIC_DHD_PKTID_MAP 13
|
||||
#define WLAN_STATIC_DHD_PKTID_IOCTL_MAP 14
|
||||
#define WLAN_STATIC_DHD_LOG_DUMP_BUF 15
|
||||
#define WLAN_STATIC_DHD_LOG_DUMP_BUF_EX 16
|
||||
#define WLAN_STATIC_DHD_PKTLOG_DUMP_BUF 17
|
||||
#define WLAN_STATIC_STAT_REPORT_BUF 18
|
||||
|
||||
#define WLAN_SCAN_BUF_SIZE (64 * 1024)
|
||||
|
||||
#if defined(CONFIG_64BIT)
|
||||
#define WLAN_DHD_INFO_BUF_SIZE (32 * 1024)
|
||||
#define WLAN_DHD_WLFC_BUF_SIZE (64 * 1024)
|
||||
#define WLAN_DHD_IF_FLOW_LKUP_SIZE (64 * 1024)
|
||||
#else
|
||||
#define WLAN_DHD_INFO_BUF_SIZE (32 * 1024)
|
||||
#define WLAN_DHD_WLFC_BUF_SIZE (16 * 1024)
|
||||
#define WLAN_DHD_IF_FLOW_LKUP_SIZE (20 * 1024)
|
||||
#endif /* CONFIG_64BIT */
|
||||
#define WLAN_DHD_MEMDUMP_SIZE (1536 * 1024)
|
||||
|
||||
#define PREALLOC_WLAN_SEC_NUM 4
|
||||
#define PREALLOC_WLAN_BUF_NUM 160
|
||||
#define PREALLOC_WLAN_SECTION_HEADER 24
|
||||
|
||||
#ifdef CONFIG_BCMDHD_PCIE
|
||||
#define DHD_SKB_1PAGE_BUFSIZE (PAGE_SIZE*1)
|
||||
#define DHD_SKB_2PAGE_BUFSIZE (PAGE_SIZE*2)
|
||||
#define DHD_SKB_4PAGE_BUFSIZE (PAGE_SIZE*4)
|
||||
|
||||
#define WLAN_SECTION_SIZE_0 (PREALLOC_WLAN_BUF_NUM * 128)
|
||||
#define WLAN_SECTION_SIZE_1 0
|
||||
#define WLAN_SECTION_SIZE_2 0
|
||||
#define WLAN_SECTION_SIZE_3 (PREALLOC_WLAN_BUF_NUM * 1024)
|
||||
|
||||
#define DHD_SKB_1PAGE_BUF_NUM 0
|
||||
#define DHD_SKB_2PAGE_BUF_NUM 128
|
||||
#define DHD_SKB_4PAGE_BUF_NUM 0
|
||||
|
||||
#else
|
||||
#define DHD_SKB_HDRSIZE 336
|
||||
#define DHD_SKB_1PAGE_BUFSIZE ((PAGE_SIZE*1)-DHD_SKB_HDRSIZE)
|
||||
#define DHD_SKB_2PAGE_BUFSIZE ((PAGE_SIZE*2)-DHD_SKB_HDRSIZE)
|
||||
#define DHD_SKB_4PAGE_BUFSIZE ((PAGE_SIZE*4)-DHD_SKB_HDRSIZE)
|
||||
|
||||
#define WLAN_SECTION_SIZE_0 (PREALLOC_WLAN_BUF_NUM * 128)
|
||||
#define WLAN_SECTION_SIZE_1 (PREALLOC_WLAN_BUF_NUM * 128)
|
||||
#define WLAN_SECTION_SIZE_2 (PREALLOC_WLAN_BUF_NUM * 512)
|
||||
#define WLAN_SECTION_SIZE_3 (PREALLOC_WLAN_BUF_NUM * 1024)
|
||||
|
||||
#define DHD_SKB_1PAGE_BUF_NUM 8
|
||||
#define DHD_SKB_2PAGE_BUF_NUM 8
|
||||
#define DHD_SKB_4PAGE_BUF_NUM 1
|
||||
#endif /* CONFIG_BCMDHD_PCIE */
|
||||
|
||||
#define WLAN_SKB_1_2PAGE_BUF_NUM ((DHD_SKB_1PAGE_BUF_NUM) + \
|
||||
(DHD_SKB_2PAGE_BUF_NUM))
|
||||
#define WLAN_SKB_BUF_NUM ((WLAN_SKB_1_2PAGE_BUF_NUM) + \
|
||||
(DHD_SKB_4PAGE_BUF_NUM))
|
||||
|
||||
#define WLAN_MAX_PKTID_ITEMS (8192)
|
||||
#define WLAN_DHD_PKTID_MAP_HDR_SIZE (20 + 4*(WLAN_MAX_PKTID_ITEMS + 1))
|
||||
#define WLAN_DHD_PKTID_MAP_ITEM_SIZE (32)
|
||||
#define WLAN_DHD_PKTID_MAP_SIZE ((WLAN_DHD_PKTID_MAP_HDR_SIZE) + \
|
||||
((WLAN_MAX_PKTID_ITEMS+1) * WLAN_DHD_PKTID_MAP_ITEM_SIZE))
|
||||
|
||||
#define WLAN_MAX_PKTID_IOCTL_ITEMS (32)
|
||||
#define WLAN_DHD_PKTID_IOCTL_MAP_HDR_SIZE (20 + 4*(WLAN_MAX_PKTID_IOCTL_ITEMS + 1))
|
||||
#define WLAN_DHD_PKTID_IOCTL_MAP_ITEM_SIZE (32)
|
||||
#define WLAN_DHD_PKTID_IOCTL_MAP_SIZE ((WLAN_DHD_PKTID_IOCTL_MAP_HDR_SIZE) + \
|
||||
((WLAN_MAX_PKTID_IOCTL_ITEMS+1) * WLAN_DHD_PKTID_IOCTL_MAP_ITEM_SIZE))
|
||||
|
||||
#define DHD_LOG_DUMP_BUF_SIZE (1024 * 1024)
|
||||
#define DHD_LOG_DUMP_BUF_EX_SIZE (8 * 1024)
|
||||
|
||||
#define DHD_PKTLOG_DUMP_BUF_SIZE (64 * 1024)
|
||||
|
||||
#define DHD_STAT_REPORT_BUF_SIZE (128 * 1024)
|
||||
|
||||
#define WLAN_DHD_WLFC_HANGER_MAXITEMS 3072
|
||||
#define WLAN_DHD_WLFC_HANGER_ITEM_SIZE 32
|
||||
#define WLAN_DHD_WLFC_HANGER_SIZE ((WLAN_DHD_WLFC_HANGER_ITEM_SIZE) + \
|
||||
((WLAN_DHD_WLFC_HANGER_MAXITEMS) * (WLAN_DHD_WLFC_HANGER_ITEM_SIZE)))
|
||||
|
||||
static struct sk_buff *wlan_static_skb[WLAN_SKB_BUF_NUM];
|
||||
|
||||
struct wlan_mem_prealloc {
|
||||
void *mem_ptr;
|
||||
unsigned long size;
|
||||
};
|
||||
|
||||
static struct wlan_mem_prealloc wlan_mem_array[PREALLOC_WLAN_SEC_NUM] = {
|
||||
{NULL, (WLAN_SECTION_SIZE_0 + PREALLOC_WLAN_SECTION_HEADER)},
|
||||
{NULL, (WLAN_SECTION_SIZE_1 + PREALLOC_WLAN_SECTION_HEADER)},
|
||||
{NULL, (WLAN_SECTION_SIZE_2 + PREALLOC_WLAN_SECTION_HEADER)},
|
||||
{NULL, (WLAN_SECTION_SIZE_3 + PREALLOC_WLAN_SECTION_HEADER)}
|
||||
};
|
||||
|
||||
static void *wlan_static_scan_buf0 = NULL;
|
||||
static void *wlan_static_scan_buf1 = NULL;
|
||||
static void *wlan_static_dhd_info_buf = NULL;
|
||||
static void *wlan_static_dhd_wlfc_buf = NULL;
|
||||
static void *wlan_static_if_flow_lkup = NULL;
|
||||
static void *wlan_static_dhd_memdump_ram = NULL;
|
||||
static void *wlan_static_dhd_wlfc_hanger = NULL;
|
||||
static void *wlan_static_dhd_pktid_map = NULL;
|
||||
static void *wlan_static_dhd_pktid_ioctl_map = NULL;
|
||||
static void *wlan_static_dhd_log_dump_buf = NULL;
|
||||
static void *wlan_static_dhd_log_dump_buf_ex = NULL;
|
||||
static void *wlan_static_dhd_pktlog_dump_buf = NULL;
|
||||
static void *wlan_static_stat_report_buf = NULL;
|
||||
|
||||
#define GET_STATIC_BUF(section, config_size, req_size, buf) ({\
|
||||
void *__ret; \
|
||||
if (req_size > config_size) {\
|
||||
pr_err("request " #section " size(%lu) is bigger than" \
|
||||
" static size(%d)\n", \
|
||||
req_size, config_size); \
|
||||
__ret = NULL; \
|
||||
} else { __ret = buf;} \
|
||||
__ret; \
|
||||
})
|
||||
|
||||
void
|
||||
*dhd_wlan_mem_prealloc(int section, unsigned long size)
|
||||
{
|
||||
if (section == PREALLOC_WLAN_SEC_NUM) {
|
||||
return wlan_static_skb;
|
||||
}
|
||||
|
||||
if (section == WLAN_STATIC_SCAN_BUF0) {
|
||||
return wlan_static_scan_buf0;
|
||||
}
|
||||
|
||||
if (section == WLAN_STATIC_SCAN_BUF1) {
|
||||
return wlan_static_scan_buf1;
|
||||
}
|
||||
|
||||
if (section == WLAN_STATIC_DHD_INFO_BUF) {
|
||||
if (size > WLAN_DHD_INFO_BUF_SIZE) {
|
||||
pr_err("request DHD_INFO size(%lu) is bigger than"
|
||||
" static size(%d).\n", size,
|
||||
WLAN_DHD_INFO_BUF_SIZE);
|
||||
return NULL;
|
||||
}
|
||||
return wlan_static_dhd_info_buf;
|
||||
}
|
||||
|
||||
if (section == WLAN_STATIC_DHD_WLFC_BUF) {
|
||||
if (size > WLAN_DHD_WLFC_BUF_SIZE) {
|
||||
pr_err("request DHD_WLFC size(%lu) is bigger than"
|
||||
" static size(%d).\n",
|
||||
size, WLAN_DHD_WLFC_BUF_SIZE);
|
||||
return NULL;
|
||||
}
|
||||
return wlan_static_dhd_wlfc_buf;
|
||||
}
|
||||
|
||||
if (section == WLAN_STATIC_DHD_WLFC_HANGER) {
|
||||
if (size > WLAN_DHD_WLFC_HANGER_SIZE) {
|
||||
pr_err("request DHD_WLFC_HANGER size(%lu) is bigger than"
|
||||
" static size(%d).\n",
|
||||
size, WLAN_DHD_WLFC_HANGER_SIZE);
|
||||
return NULL;
|
||||
}
|
||||
return wlan_static_dhd_wlfc_hanger;
|
||||
}
|
||||
|
||||
if (section == WLAN_STATIC_DHD_IF_FLOW_LKUP) {
|
||||
if (size > WLAN_DHD_IF_FLOW_LKUP_SIZE) {
|
||||
pr_err("request DHD_WLFC size(%lu) is bigger than"
|
||||
" static size(%d).\n",
|
||||
size, WLAN_DHD_WLFC_BUF_SIZE);
|
||||
return NULL;
|
||||
}
|
||||
return wlan_static_if_flow_lkup;
|
||||
}
|
||||
|
||||
if (section == WLAN_STATIC_DHD_MEMDUMP_RAM) {
|
||||
if (size > WLAN_DHD_MEMDUMP_SIZE) {
|
||||
pr_err("request DHD_MEMDUMP_RAM size(%lu) is bigger"
|
||||
" than static size(%d).\n",
|
||||
size, WLAN_DHD_MEMDUMP_SIZE);
|
||||
return NULL;
|
||||
}
|
||||
return wlan_static_dhd_memdump_ram;
|
||||
}
|
||||
|
||||
if (section == WLAN_STATIC_DHD_PKTID_MAP) {
|
||||
if (size > WLAN_DHD_PKTID_MAP_SIZE) {
|
||||
pr_err("request DHD_PKTID_MAP size(%lu) is bigger than"
|
||||
" static size(%d).\n",
|
||||
size, WLAN_DHD_PKTID_MAP_SIZE);
|
||||
return NULL;
|
||||
}
|
||||
return wlan_static_dhd_pktid_map;
|
||||
}
|
||||
|
||||
|
||||
if (section == WLAN_STATIC_DHD_PKTID_IOCTL_MAP) {
|
||||
if (size > WLAN_DHD_PKTID_IOCTL_MAP_SIZE) {
|
||||
pr_err("request DHD_PKTID_IOCTL_MAP size(%lu) is bigger than"
|
||||
" static size(%d).\n",
|
||||
size, WLAN_DHD_PKTID_IOCTL_MAP_SIZE);
|
||||
return NULL;
|
||||
}
|
||||
return wlan_static_dhd_pktid_ioctl_map;
|
||||
}
|
||||
|
||||
if (section == WLAN_STATIC_DHD_LOG_DUMP_BUF) {
|
||||
if (size > DHD_LOG_DUMP_BUF_SIZE) {
|
||||
pr_err("request DHD_LOG_DUMP_BUF size(%lu) is bigger then"
|
||||
" static size(%d).\n",
|
||||
size, DHD_LOG_DUMP_BUF_SIZE);
|
||||
return NULL;
|
||||
}
|
||||
return wlan_static_dhd_log_dump_buf;
|
||||
}
|
||||
|
||||
if (section == WLAN_STATIC_DHD_LOG_DUMP_BUF_EX) {
|
||||
if (size > DHD_LOG_DUMP_BUF_EX_SIZE) {
|
||||
pr_err("request DHD_LOG_DUMP_BUF_EX size(%lu) is bigger then"
|
||||
" static size(%d).\n",
|
||||
size, DHD_LOG_DUMP_BUF_EX_SIZE);
|
||||
return NULL;
|
||||
}
|
||||
return wlan_static_dhd_log_dump_buf_ex;
|
||||
}
|
||||
|
||||
if (section == WLAN_STATIC_DHD_PKTLOG_DUMP_BUF) {
|
||||
if (size > DHD_PKTLOG_DUMP_BUF_SIZE) {
|
||||
pr_err("request DHD_PKTLOG_DUMP_BUF size(%lu) is bigger then"
|
||||
" static size(%d).\n",
|
||||
size, DHD_PKTLOG_DUMP_BUF_SIZE);
|
||||
return NULL;
|
||||
}
|
||||
return wlan_static_dhd_pktlog_dump_buf;
|
||||
}
|
||||
|
||||
if (section == WLAN_STATIC_STAT_REPORT_BUF) {
|
||||
return GET_STATIC_BUF(WLAN_STATIC_STAT_REPORT_BUF,
|
||||
DHD_STAT_REPORT_BUF_SIZE, size, wlan_static_stat_report_buf);
|
||||
}
|
||||
|
||||
if ((section < 0) || (section >= PREALLOC_WLAN_SEC_NUM)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (wlan_mem_array[section].size < size) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return wlan_mem_array[section].mem_ptr;
|
||||
}
|
||||
EXPORT_SYMBOL(dhd_wlan_mem_prealloc);
|
||||
|
||||
int
|
||||
dhd_init_wlan_mem(void)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
|
||||
for (i = 0; i < DHD_SKB_1PAGE_BUF_NUM; i++) {
|
||||
wlan_static_skb[i] = dev_alloc_skb(DHD_SKB_1PAGE_BUFSIZE);
|
||||
if (!wlan_static_skb[i]) {
|
||||
goto err_skb_alloc;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = DHD_SKB_1PAGE_BUF_NUM; i < WLAN_SKB_1_2PAGE_BUF_NUM; i++) {
|
||||
wlan_static_skb[i] = dev_alloc_skb(DHD_SKB_2PAGE_BUFSIZE);
|
||||
if (!wlan_static_skb[i]) {
|
||||
goto err_skb_alloc;
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(CONFIG_BCMDHD_PCIE)
|
||||
wlan_static_skb[i] = dev_alloc_skb(DHD_SKB_4PAGE_BUFSIZE);
|
||||
if (!wlan_static_skb[i]) {
|
||||
goto err_skb_alloc;
|
||||
}
|
||||
#endif /* !CONFIG_BCMDHD_PCIE */
|
||||
|
||||
for (i = 0; i < PREALLOC_WLAN_SEC_NUM; i++) {
|
||||
if (wlan_mem_array[i].size > 0) {
|
||||
wlan_mem_array[i].mem_ptr =
|
||||
kmalloc(wlan_mem_array[i].size, GFP_KERNEL);
|
||||
|
||||
if (!wlan_mem_array[i].mem_ptr) {
|
||||
goto err_mem_alloc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wlan_static_scan_buf0 = kmalloc(WLAN_SCAN_BUF_SIZE, GFP_KERNEL);
|
||||
if (!wlan_static_scan_buf0) {
|
||||
pr_err("Failed to alloc wlan_static_scan_buf0\n");
|
||||
goto err_mem_alloc;
|
||||
}
|
||||
|
||||
wlan_static_scan_buf1 = kmalloc(WLAN_SCAN_BUF_SIZE, GFP_KERNEL);
|
||||
if (!wlan_static_scan_buf1) {
|
||||
pr_err("Failed to alloc wlan_static_scan_buf1\n");
|
||||
goto err_mem_alloc;
|
||||
}
|
||||
|
||||
wlan_static_dhd_log_dump_buf = kmalloc(DHD_LOG_DUMP_BUF_SIZE, GFP_KERNEL);
|
||||
if (!wlan_static_dhd_log_dump_buf) {
|
||||
pr_err("Failed to alloc wlan_static_dhd_log_dump_buf\n");
|
||||
goto err_mem_alloc;
|
||||
}
|
||||
|
||||
wlan_static_dhd_log_dump_buf_ex = kmalloc(DHD_LOG_DUMP_BUF_EX_SIZE, GFP_KERNEL);
|
||||
if (!wlan_static_dhd_log_dump_buf_ex) {
|
||||
pr_err("Failed to alloc wlan_static_dhd_log_dump_buf_ex\n");
|
||||
goto err_mem_alloc;
|
||||
}
|
||||
|
||||
wlan_static_dhd_info_buf = kmalloc(WLAN_DHD_INFO_BUF_SIZE, GFP_KERNEL);
|
||||
if (!wlan_static_dhd_info_buf) {
|
||||
pr_err("Failed to alloc wlan_static_dhd_info_buf\n");
|
||||
goto err_mem_alloc;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_BCMDHD_PCIE
|
||||
wlan_static_if_flow_lkup = kmalloc(WLAN_DHD_IF_FLOW_LKUP_SIZE,
|
||||
GFP_KERNEL);
|
||||
if (!wlan_static_if_flow_lkup) {
|
||||
pr_err("Failed to alloc wlan_static_if_flow_lkup\n");
|
||||
goto err_mem_alloc;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_BCMDHD_PREALLOC_PKTIDMAP
|
||||
wlan_static_dhd_pktid_map = kmalloc(WLAN_DHD_PKTID_MAP_SIZE,
|
||||
GFP_KERNEL);
|
||||
if (!wlan_static_dhd_pktid_map) {
|
||||
pr_err("Failed to alloc wlan_static_dhd_pktid_map\n");
|
||||
goto err_mem_alloc;
|
||||
}
|
||||
|
||||
wlan_static_dhd_pktid_ioctl_map = kmalloc(WLAN_DHD_PKTID_IOCTL_MAP_SIZE,
|
||||
GFP_KERNEL);
|
||||
if (!wlan_static_dhd_pktid_ioctl_map) {
|
||||
pr_err("Failed to alloc wlan_static_dhd_pktid_ioctl_map\n");
|
||||
goto err_mem_alloc;
|
||||
}
|
||||
#endif /* CONFIG_BCMDHD_PREALLOC_PKTIDMAP */
|
||||
#else
|
||||
wlan_static_dhd_wlfc_buf = kmalloc(WLAN_DHD_WLFC_BUF_SIZE,
|
||||
GFP_KERNEL);
|
||||
if (!wlan_static_dhd_wlfc_buf) {
|
||||
pr_err("Failed to alloc wlan_static_dhd_wlfc_buf\n");
|
||||
goto err_mem_alloc;
|
||||
}
|
||||
|
||||
wlan_static_dhd_wlfc_hanger = kmalloc(WLAN_DHD_WLFC_HANGER_SIZE,
|
||||
GFP_KERNEL);
|
||||
if (!wlan_static_dhd_wlfc_hanger) {
|
||||
pr_err("Failed to alloc wlan_static_dhd_wlfc_hanger\n");
|
||||
goto err_mem_alloc;
|
||||
}
|
||||
#endif /* CONFIG_BCMDHD_PCIE */
|
||||
|
||||
#ifdef CONFIG_BCMDHD_PREALLOC_MEMDUMP
|
||||
wlan_static_dhd_memdump_ram = kmalloc(WLAN_DHD_MEMDUMP_SIZE, GFP_KERNEL);
|
||||
if (!wlan_static_dhd_memdump_ram) {
|
||||
pr_err("Failed to alloc wlan_static_dhd_memdump_ram\n");
|
||||
goto err_mem_alloc;
|
||||
}
|
||||
#endif /* CONFIG_BCMDHD_PREALLOC_MEMDUMP */
|
||||
|
||||
wlan_static_dhd_pktlog_dump_buf = kmalloc(DHD_PKTLOG_DUMP_BUF_SIZE, GFP_KERNEL);
|
||||
if (!wlan_static_dhd_pktlog_dump_buf) {
|
||||
pr_err("Failed to alloc wlan_static_dhd_pktlog_dump_buf\n");
|
||||
goto err_mem_alloc;
|
||||
}
|
||||
|
||||
wlan_static_stat_report_buf = kmalloc(DHD_STAT_REPORT_BUF_SIZE, GFP_KERNEL);
|
||||
if (!wlan_static_stat_report_buf) {
|
||||
pr_err("Failed to alloc wlan_static_stat_report_buf\n");
|
||||
goto err_mem_alloc;
|
||||
}
|
||||
|
||||
pr_err("%s: WIFI MEM Allocated\n", __FUNCTION__);
|
||||
return 0;
|
||||
|
||||
err_mem_alloc:
|
||||
#ifdef CONFIG_BCMDHD_PREALLOC_MEMDUMP
|
||||
if (wlan_static_dhd_memdump_ram) {
|
||||
kfree(wlan_static_dhd_memdump_ram);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_BCMDHD_PREALLOC_MEMDUMP */
|
||||
|
||||
#ifdef CONFIG_BCMDHD_PCIE
|
||||
if (wlan_static_if_flow_lkup) {
|
||||
kfree(wlan_static_if_flow_lkup);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_BCMDHD_PREALLOC_PKTIDMAP
|
||||
if (wlan_static_dhd_pktid_map) {
|
||||
kfree(wlan_static_dhd_pktid_map);
|
||||
}
|
||||
|
||||
if (wlan_static_dhd_pktid_ioctl_map) {
|
||||
kfree(wlan_static_dhd_pktid_ioctl_map);
|
||||
}
|
||||
#endif /* CONFIG_BCMDHD_PREALLOC_PKTIDMAP */
|
||||
#else
|
||||
if (wlan_static_dhd_wlfc_buf) {
|
||||
kfree(wlan_static_dhd_wlfc_buf);
|
||||
}
|
||||
|
||||
if (wlan_static_dhd_wlfc_hanger) {
|
||||
kfree(wlan_static_dhd_wlfc_hanger);
|
||||
}
|
||||
#endif /* CONFIG_BCMDHD_PCIE */
|
||||
if (wlan_static_dhd_info_buf) {
|
||||
kfree(wlan_static_dhd_info_buf);
|
||||
}
|
||||
|
||||
if (wlan_static_dhd_log_dump_buf) {
|
||||
kfree(wlan_static_dhd_log_dump_buf);
|
||||
}
|
||||
|
||||
if (wlan_static_dhd_log_dump_buf_ex) {
|
||||
kfree(wlan_static_dhd_log_dump_buf_ex);
|
||||
}
|
||||
|
||||
if (wlan_static_scan_buf1) {
|
||||
kfree(wlan_static_scan_buf1);
|
||||
}
|
||||
|
||||
if (wlan_static_scan_buf0) {
|
||||
kfree(wlan_static_scan_buf0);
|
||||
}
|
||||
|
||||
if (wlan_static_dhd_pktlog_dump_buf) {
|
||||
kfree(wlan_static_dhd_pktlog_dump_buf);
|
||||
}
|
||||
|
||||
if (wlan_static_stat_report_buf) {
|
||||
kfree(wlan_static_stat_report_buf);
|
||||
}
|
||||
|
||||
pr_err("Failed to mem_alloc for WLAN\n");
|
||||
|
||||
for (j = 0; j < i; j++) {
|
||||
kfree(wlan_mem_array[j].mem_ptr);
|
||||
}
|
||||
|
||||
i = WLAN_SKB_BUF_NUM;
|
||||
|
||||
err_skb_alloc:
|
||||
pr_err("Failed to skb_alloc for WLAN\n");
|
||||
for (j = 0; j < i; j++) {
|
||||
dev_kfree_skb(wlan_static_skb[j]);
|
||||
}
|
||||
|
||||
return -ENOMEM;
|
||||
}
|
||||
EXPORT_SYMBOL(dhd_init_wlan_mem);
|
||||
#endif /* CONFIG_BROADCOM_WIFI_RESERVED_MEM */
|
|
@ -0,0 +1,253 @@
|
|||
/*
|
||||
* Platform Dependent file for Qualcomm MSM/APQ
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: dhd_custom_msm.c 674523 2016-12-09 04:05:27Z $
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/wlan_plat.h>
|
||||
#include <linux/mmc/host.h>
|
||||
#include <linux/msm_pcie.h>
|
||||
#include <linux/fcntl.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/of_gpio.h>
|
||||
#if defined(CONFIG_ARCH_MSM8996) || defined(CONFIG_ARCH_MSM8998)
|
||||
#include <linux/msm_pcie.h>
|
||||
#endif /* CONFIG_ARCH_MSM8996 || CONFIG_ARCH_MSM8998 */
|
||||
|
||||
#ifdef CONFIG_BROADCOM_WIFI_RESERVED_MEM
|
||||
extern int dhd_init_wlan_mem(void);
|
||||
extern void *dhd_wlan_mem_prealloc(int section, unsigned long size);
|
||||
#endif /* CONFIG_BROADCOM_WIFI_RESERVED_MEM */
|
||||
|
||||
#define WIFI_TURNON_DELAY 200
|
||||
static int wlan_reg_on = -1;
|
||||
#define DHD_DT_COMPAT_ENTRY "android,bcmdhd_wlan"
|
||||
#ifdef CUSTOMER_HW2
|
||||
#define WIFI_WL_REG_ON_PROPNAME "wl_reg_on"
|
||||
#else
|
||||
#define WIFI_WL_REG_ON_PROPNAME "wlan-en-gpio"
|
||||
#endif /* CUSTOMER_HW2 */
|
||||
|
||||
#if defined(CONFIG_ARCH_MSM8996) || defined(CONFIG_ARCH_MSM8998)
|
||||
#define MSM_PCIE_CH_NUM 0
|
||||
#else
|
||||
#define MSM_PCIE_CH_NUM 1
|
||||
#endif /* CONFIG_ARCH_MSM8996 || CONFIG_ARCH_MSM8998 */
|
||||
|
||||
#ifdef CONFIG_BCMDHD_OOB_HOST_WAKE
|
||||
static int wlan_host_wake_up = -1;
|
||||
static int wlan_host_wake_irq = 0;
|
||||
#ifdef CUSTOMER_HW2
|
||||
#define WIFI_WLAN_HOST_WAKE_PROPNAME "wl_host_wake"
|
||||
#else
|
||||
#define WIFI_WLAN_HOST_WAKE_PROPNAME "wlan-host-wake-gpio"
|
||||
#endif /* CUSTOMER_HW2 */
|
||||
#endif /* CONFIG_BCMDHD_OOB_HOST_WAKE */
|
||||
|
||||
int __init
|
||||
dhd_wifi_init_gpio(void)
|
||||
{
|
||||
char *wlan_node = DHD_DT_COMPAT_ENTRY;
|
||||
struct device_node *root_node = NULL;
|
||||
|
||||
root_node = of_find_compatible_node(NULL, NULL, wlan_node);
|
||||
if (!root_node) {
|
||||
WARN(1, "failed to get device node of BRCM WLAN\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* ========== WLAN_PWR_EN ============ */
|
||||
wlan_reg_on = of_get_named_gpio(root_node, WIFI_WL_REG_ON_PROPNAME, 0);
|
||||
printk(KERN_INFO "%s: gpio_wlan_power : %d\n", __FUNCTION__, wlan_reg_on);
|
||||
|
||||
if (gpio_request_one(wlan_reg_on, GPIOF_OUT_INIT_LOW, "WL_REG_ON")) {
|
||||
printk(KERN_ERR "%s: Faiiled to request gpio %d for WL_REG_ON\n",
|
||||
__FUNCTION__, wlan_reg_on);
|
||||
} else {
|
||||
printk(KERN_ERR "%s: gpio_request WL_REG_ON done - WLAN_EN: GPIO %d\n",
|
||||
__FUNCTION__, wlan_reg_on);
|
||||
}
|
||||
|
||||
if (gpio_direction_output(wlan_reg_on, 1)) {
|
||||
printk(KERN_ERR "%s: WL_REG_ON failed to pull up\n", __FUNCTION__);
|
||||
} else {
|
||||
printk(KERN_ERR "%s: WL_REG_ON is pulled up\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
if (gpio_get_value(wlan_reg_on)) {
|
||||
printk(KERN_INFO "%s: Initial WL_REG_ON: [%d]\n",
|
||||
__FUNCTION__, gpio_get_value(wlan_reg_on));
|
||||
}
|
||||
|
||||
/* Wait for WIFI_TURNON_DELAY due to power stability */
|
||||
msleep(WIFI_TURNON_DELAY);
|
||||
|
||||
#ifdef CONFIG_BCMDHD_OOB_HOST_WAKE
|
||||
/* ========== WLAN_HOST_WAKE ============ */
|
||||
wlan_host_wake_up = of_get_named_gpio(root_node, WIFI_WLAN_HOST_WAKE_PROPNAME, 0);
|
||||
printk(KERN_INFO "%s: gpio_wlan_host_wake : %d\n", __FUNCTION__, wlan_host_wake_up);
|
||||
|
||||
#ifndef CUSTOMER_HW2
|
||||
if (gpio_request_one(wlan_host_wake_up, GPIOF_IN, "WLAN_HOST_WAKE")) {
|
||||
printk(KERN_ERR "%s: Failed to request gpio %d for WLAN_HOST_WAKE\n",
|
||||
__FUNCTION__, wlan_host_wake_up);
|
||||
return -ENODEV;
|
||||
} else {
|
||||
printk(KERN_ERR "%s: gpio_request WLAN_HOST_WAKE done"
|
||||
" - WLAN_HOST_WAKE: GPIO %d\n",
|
||||
__FUNCTION__, wlan_host_wake_up);
|
||||
}
|
||||
#endif /* !CUSTOMER_HW2 */
|
||||
|
||||
gpio_direction_input(wlan_host_wake_up);
|
||||
wlan_host_wake_irq = gpio_to_irq(wlan_host_wake_up);
|
||||
#endif /* CONFIG_BCMDHD_OOB_HOST_WAKE */
|
||||
|
||||
#if defined(CONFIG_BCM4359) || defined(CONFIG_BCM4361)
|
||||
printk(KERN_INFO "%s: Call msm_pcie_enumerate\n", __FUNCTION__);
|
||||
msm_pcie_enumerate(MSM_PCIE_CH_NUM);
|
||||
#endif /* CONFIG_BCM4359 || CONFIG_BCM4361 */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
dhd_wlan_power(int onoff)
|
||||
{
|
||||
printk(KERN_INFO"------------------------------------------------");
|
||||
printk(KERN_INFO"------------------------------------------------\n");
|
||||
printk(KERN_INFO"%s Enter: power %s\n", __func__, onoff ? "on" : "off");
|
||||
|
||||
if (onoff) {
|
||||
if (gpio_direction_output(wlan_reg_on, 1)) {
|
||||
printk(KERN_ERR "%s: WL_REG_ON is failed to pull up\n", __FUNCTION__);
|
||||
return -EIO;
|
||||
}
|
||||
if (gpio_get_value(wlan_reg_on)) {
|
||||
printk(KERN_INFO"WL_REG_ON on-step-2 : [%d]\n",
|
||||
gpio_get_value(wlan_reg_on));
|
||||
} else {
|
||||
printk("[%s] gpio value is 0. We need reinit.\n", __func__);
|
||||
if (gpio_direction_output(wlan_reg_on, 1)) {
|
||||
printk(KERN_ERR "%s: WL_REG_ON is "
|
||||
"failed to pull up\n", __func__);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (gpio_direction_output(wlan_reg_on, 0)) {
|
||||
printk(KERN_ERR "%s: WL_REG_ON is failed to pull up\n", __FUNCTION__);
|
||||
return -EIO;
|
||||
}
|
||||
if (gpio_get_value(wlan_reg_on)) {
|
||||
printk(KERN_INFO"WL_REG_ON on-step-2 : [%d]\n",
|
||||
gpio_get_value(wlan_reg_on));
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(dhd_wlan_power);
|
||||
|
||||
static int
|
||||
dhd_wlan_reset(int onoff)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
dhd_wlan_set_carddetect(int val)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct resource dhd_wlan_resources = {
|
||||
.name = "bcmdhd_wlan_irq",
|
||||
.start = 0, /* Dummy */
|
||||
.end = 0, /* Dummy */
|
||||
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_SHAREABLE |
|
||||
#ifdef CONFIG_BCMDHD_PCIE
|
||||
IORESOURCE_IRQ_HIGHEDGE,
|
||||
#else
|
||||
IORESOURCE_IRQ_HIGHLEVEL,
|
||||
#endif /* CONFIG_BCMDHD_PCIE */
|
||||
};
|
||||
EXPORT_SYMBOL(dhd_wlan_resources);
|
||||
|
||||
struct wifi_platform_data dhd_wlan_control = {
|
||||
.set_power = dhd_wlan_power,
|
||||
.set_reset = dhd_wlan_reset,
|
||||
.set_carddetect = dhd_wlan_set_carddetect,
|
||||
#ifdef CONFIG_BROADCOM_WIFI_RESERVED_MEM
|
||||
.mem_prealloc = dhd_wlan_mem_prealloc,
|
||||
#endif /* CONFIG_BROADCOM_WIFI_RESERVED_MEM */
|
||||
};
|
||||
EXPORT_SYMBOL(dhd_wlan_control);
|
||||
|
||||
int __init
|
||||
dhd_wlan_init(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
printk(KERN_INFO"%s: START.......\n", __FUNCTION__);
|
||||
ret = dhd_wifi_init_gpio();
|
||||
if (ret < 0) {
|
||||
printk(KERN_ERR "%s: failed to initiate GPIO, ret=%d\n",
|
||||
__FUNCTION__, ret);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_BCMDHD_OOB_HOST_WAKE
|
||||
dhd_wlan_resources.start = wlan_host_wake_irq;
|
||||
dhd_wlan_resources.end = wlan_host_wake_irq;
|
||||
#endif /* CONFIG_BCMDHD_OOB_HOST_WAKE */
|
||||
|
||||
#ifdef CONFIG_BROADCOM_WIFI_RESERVED_MEM
|
||||
ret = dhd_init_wlan_mem();
|
||||
if (ret < 0) {
|
||||
printk(KERN_ERR "%s: failed to alloc reserved memory,"
|
||||
" ret=%d\n", __FUNCTION__, ret);
|
||||
}
|
||||
#endif /* CONFIG_BROADCOM_WIFI_RESERVED_MEM */
|
||||
|
||||
fail:
|
||||
printk(KERN_INFO"%s: FINISH.......\n", __FUNCTION__);
|
||||
return ret;
|
||||
}
|
||||
#if defined(CONFIG_ARCH_MSM8996) || defined(CONFIG_ARCH_MSM8998)
|
||||
#if defined(CONFIG_DEFERRED_INITCALLS)
|
||||
deferred_module_init(dhd_wlan_init);
|
||||
#else
|
||||
late_initcall(dhd_wlan_init);
|
||||
#endif /* CONFIG_DEFERRED_INITCALLS */
|
||||
#else
|
||||
device_initcall(dhd_wlan_init);
|
||||
#endif /* CONFIG_ARCH_MSM8996 || CONFIG_ARCH_MSM8998 */
|
|
@ -0,0 +1,347 @@
|
|||
/*
|
||||
* Debug/trace/assert driver definitions for Dongle Host Driver.
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: dhd_dbg.h 667145 2016-10-26 04:27:53Z $
|
||||
*/
|
||||
|
||||
#ifndef _dhd_dbg_
|
||||
#define _dhd_dbg_
|
||||
|
||||
|
||||
#if defined(DHD_EFI) && defined(DHD_LOG_DUMP)
|
||||
extern void dhd_log_dump_print(const char *fmt, ...);
|
||||
extern void dhd_log_dump_print_drv(const char *fmt, ...);
|
||||
#endif
|
||||
|
||||
#if defined(DHD_DEBUG)
|
||||
|
||||
#ifdef DHD_LOG_DUMP
|
||||
extern void dhd_log_dump_write(int type, const char *fmt, ...);
|
||||
extern char *dhd_log_dump_get_timestamp(void);
|
||||
#ifndef _DHD_LOG_DUMP_DEFINITIONS_
|
||||
#define _DHD_LOG_DUMP_DEFINITIONS_
|
||||
#define DLD_BUF_TYPE_GENERAL 0
|
||||
#define DLD_BUF_TYPE_SPECIAL 1
|
||||
#define DHD_LOG_DUMP_WRITE(fmt, ...) dhd_log_dump_write(DLD_BUF_TYPE_GENERAL, fmt, ##__VA_ARGS__)
|
||||
#define DHD_LOG_DUMP_WRITE_EX(fmt, ...) dhd_log_dump_write(DLD_BUF_TYPE_SPECIAL, fmt, ##__VA_ARGS__)
|
||||
#endif /* !_DHD_LOG_DUMP_DEFINITIONS_ */
|
||||
|
||||
#ifdef DHD_EFI
|
||||
#define DHD_ERROR(args) \
|
||||
do { \
|
||||
if (dhd_msg_level & DHD_ERROR_VAL) { \
|
||||
printf args; \
|
||||
dhd_log_dump_print_drv("[%s] %s: ", dhd_log_dump_get_timestamp(), __FUNCTION__); \
|
||||
dhd_log_dump_print_drv args; \
|
||||
} \
|
||||
} while (0)
|
||||
#define DHD_INFO(args) \
|
||||
do { \
|
||||
if (dhd_msg_level & DHD_INFO_VAL) { \
|
||||
printf args; \
|
||||
dhd_log_dump_print_drv("[%s] %s: ", dhd_log_dump_get_timestamp(), __FUNCTION__); \
|
||||
dhd_log_dump_print_drv args; \
|
||||
} \
|
||||
} while (0)
|
||||
#else /* DHD_EFI */
|
||||
#define DHD_ERROR(args) \
|
||||
do { \
|
||||
if (dhd_msg_level & DHD_ERROR_VAL) { \
|
||||
printf args; \
|
||||
DHD_LOG_DUMP_WRITE("[%s] %s: ", dhd_log_dump_get_timestamp(), __func__); \
|
||||
DHD_LOG_DUMP_WRITE args; \
|
||||
} \
|
||||
} while (0)
|
||||
#define DHD_INFO(args) do {if (dhd_msg_level & DHD_INFO_VAL) printf args;} while (0)
|
||||
#endif /* DHD_EFI */
|
||||
#else /* DHD_LOG_DUMP */
|
||||
#define DHD_ERROR(args) do {if (dhd_msg_level & DHD_ERROR_VAL) printf args;} while (0)
|
||||
#define DHD_INFO(args) do {if (dhd_msg_level & DHD_INFO_VAL) printf args;} while (0)
|
||||
#endif /* DHD_LOG_DUMP */
|
||||
#define DHD_TRACE(args) do {if (dhd_msg_level & DHD_TRACE_VAL) printf args;} while (0)
|
||||
|
||||
#define DHD_DATA(args) do {if (dhd_msg_level & DHD_DATA_VAL) printf args;} while (0)
|
||||
#define DHD_CTL(args) do {if (dhd_msg_level & DHD_CTL_VAL) printf args;} while (0)
|
||||
#define DHD_TIMER(args) do {if (dhd_msg_level & DHD_TIMER_VAL) printf args;} while (0)
|
||||
#define DHD_HDRS(args) do {if (dhd_msg_level & DHD_HDRS_VAL) printf args;} while (0)
|
||||
#define DHD_BYTES(args) do {if (dhd_msg_level & DHD_BYTES_VAL) printf args;} while (0)
|
||||
#define DHD_INTR(args) do {if (dhd_msg_level & DHD_INTR_VAL) printf args;} while (0)
|
||||
#define DHD_GLOM(args) do {if (dhd_msg_level & DHD_GLOM_VAL) printf args;} while (0)
|
||||
#ifdef DHD_LOG_DUMP
|
||||
#ifndef DHD_EFI
|
||||
#define DHD_EVENT(args) \
|
||||
do { \
|
||||
if (dhd_msg_level & DHD_EVENT_VAL) { \
|
||||
printf args; \
|
||||
DHD_LOG_DUMP_WRITE("[%s] %s: ", dhd_log_dump_get_timestamp(), __func__); \
|
||||
DHD_LOG_DUMP_WRITE args; \
|
||||
} \
|
||||
} while (0)
|
||||
#else
|
||||
#define DHD_EVENT(args) \
|
||||
do { \
|
||||
if (dhd_msg_level & DHD_EVENT_VAL) { \
|
||||
dhd_log_dump_print("[%s] %s: ", dhd_log_dump_get_timestamp(), __FUNCTION__); \
|
||||
dhd_log_dump_print args; \
|
||||
} \
|
||||
} while (0)
|
||||
#endif /* !DHD_EFI */
|
||||
#else
|
||||
#define DHD_EVENT(args) do {if (dhd_msg_level & DHD_EVENT_VAL) printf args;} while (0)
|
||||
#endif /* DHD_LOG_DUMP */
|
||||
#define DHD_ISCAN(args) do {if (dhd_msg_level & DHD_ISCAN_VAL) printf args;} while (0)
|
||||
#define DHD_ARPOE(args) do {if (dhd_msg_level & DHD_ARPOE_VAL) printf args;} while (0)
|
||||
#define DHD_REORDER(args) do {if (dhd_msg_level & DHD_REORDER_VAL) printf args;} while (0)
|
||||
#define DHD_PNO(args) do {if (dhd_msg_level & DHD_PNO_VAL) printf args;} while (0)
|
||||
#define DHD_RTT(args) do {if (dhd_msg_level & DHD_RTT_VAL) printf args;} while (0)
|
||||
#define DHD_PKT_MON(args) do {if (dhd_msg_level & DHD_PKT_MON_VAL) printf args;} while (0)
|
||||
#ifdef DHD_LOG_DUMP
|
||||
#ifndef DHD_EFI
|
||||
#define DHD_MSGTRACE_LOG(args) \
|
||||
do { \
|
||||
if (dhd_msg_level & DHD_MSGTRACE_VAL) { \
|
||||
printf args; \
|
||||
DHD_LOG_DUMP_WRITE("[%s] %s: ", dhd_log_dump_get_timestamp(), __func__); \
|
||||
DHD_LOG_DUMP_WRITE args; \
|
||||
} \
|
||||
} while (0)
|
||||
#else
|
||||
#define DHD_MSGTRACE_LOG(args) \
|
||||
do { \
|
||||
if (dhd_msg_level & DHD_MSGTRACE_VAL) { \
|
||||
dhd_log_dump_print("[%s] %s: ", dhd_log_dump_get_timestamp(), __FUNCTION__); \
|
||||
dhd_log_dump_print args; \
|
||||
} \
|
||||
} while (0)
|
||||
#endif /* !DHD_EFI */
|
||||
#else
|
||||
#define DHD_MSGTRACE_LOG(args) do {if (dhd_msg_level & DHD_MSGTRACE_VAL) printf args;} while (0)
|
||||
#endif /* DHD_LOG_DUMP */
|
||||
|
||||
#if defined(DHD_LOG_DUMP) && defined(DHD_EFI)
|
||||
#define DHD_FWLOG(args) DHD_MSGTRACE_LOG(args)
|
||||
#else
|
||||
|
||||
#define DHD_FWLOG(args) do {if (dhd_msg_level & DHD_FWLOG_VAL) printf args;} while (0)
|
||||
#endif /* DHD_LOG_DUMP & DHD_EFI */
|
||||
#define DHD_DBGIF(args) do {if (dhd_msg_level & DHD_DBGIF_VAL) printf args;} while (0)
|
||||
|
||||
#ifdef DHD_LOG_DUMP
|
||||
#ifdef DHD_EFI
|
||||
#define DHD_ERROR_MEM(args) \
|
||||
do { \
|
||||
if (dhd_msg_level & DHD_ERROR_VAL) { \
|
||||
dhd_log_dump_print_drv("[%s] %s: ", dhd_log_dump_get_timestamp(), __FUNCTION__); \
|
||||
dhd_log_dump_print_drv args; \
|
||||
} \
|
||||
} while (0)
|
||||
#define DHD_ERROR_EX(args) DHD_ERROR(args)
|
||||
#else
|
||||
#define DHD_ERROR_MEM(args) \
|
||||
do { \
|
||||
if (dhd_msg_level & DHD_ERROR_VAL) { \
|
||||
if (dhd_msg_level & DHD_ERROR_MEM_VAL) { \
|
||||
printf args; \
|
||||
} \
|
||||
DHD_LOG_DUMP_WRITE("[%s] %s: ", dhd_log_dump_get_timestamp(), __FUNCTION__); \
|
||||
DHD_LOG_DUMP_WRITE args; \
|
||||
} \
|
||||
} while (0)
|
||||
#define DHD_ERROR_EX(args) \
|
||||
do { \
|
||||
if (dhd_msg_level & DHD_ERROR_VAL) { \
|
||||
printf args; \
|
||||
DHD_LOG_DUMP_WRITE_EX("[%s] %s: ", dhd_log_dump_get_timestamp(), __FUNCTION__); \
|
||||
DHD_LOG_DUMP_WRITE_EX args; \
|
||||
} \
|
||||
} while (0)
|
||||
#endif /* DHD_EFI */
|
||||
#else
|
||||
#define DHD_ERROR_MEM(args) DHD_ERROR(args)
|
||||
#define DHD_ERROR_EX(args) DHD_ERROR(args)
|
||||
#endif /* DHD_LOG_DUMP */
|
||||
|
||||
#ifdef CUSTOMER_HW4_DEBUG
|
||||
#define DHD_TRACE_HW4 DHD_ERROR
|
||||
#define DHD_INFO_HW4 DHD_ERROR
|
||||
#else
|
||||
#define DHD_TRACE_HW4 DHD_TRACE
|
||||
#define DHD_INFO_HW4 DHD_INFO
|
||||
#endif /* CUSTOMER_HW4_DEBUG */
|
||||
|
||||
#define DHD_ERROR_ON() (dhd_msg_level & DHD_ERROR_VAL)
|
||||
#define DHD_TRACE_ON() (dhd_msg_level & DHD_TRACE_VAL)
|
||||
#define DHD_INFO_ON() (dhd_msg_level & DHD_INFO_VAL)
|
||||
#define DHD_DATA_ON() (dhd_msg_level & DHD_DATA_VAL)
|
||||
#define DHD_CTL_ON() (dhd_msg_level & DHD_CTL_VAL)
|
||||
#define DHD_TIMER_ON() (dhd_msg_level & DHD_TIMER_VAL)
|
||||
#define DHD_HDRS_ON() (dhd_msg_level & DHD_HDRS_VAL)
|
||||
#define DHD_BYTES_ON() (dhd_msg_level & DHD_BYTES_VAL)
|
||||
#define DHD_INTR_ON() (dhd_msg_level & DHD_INTR_VAL)
|
||||
#define DHD_GLOM_ON() (dhd_msg_level & DHD_GLOM_VAL)
|
||||
#define DHD_EVENT_ON() (dhd_msg_level & DHD_EVENT_VAL)
|
||||
#define DHD_ISCAN_ON() (dhd_msg_level & DHD_ISCAN_VAL)
|
||||
#define DHD_ARPOE_ON() (dhd_msg_level & DHD_ARPOE_VAL)
|
||||
#define DHD_REORDER_ON() (dhd_msg_level & DHD_REORDER_VAL)
|
||||
#define DHD_NOCHECKDIED_ON() (dhd_msg_level & DHD_NOCHECKDIED_VAL)
|
||||
#define DHD_PNO_ON() (dhd_msg_level & DHD_PNO_VAL)
|
||||
#define DHD_RTT_ON() (dhd_msg_level & DHD_RTT_VAL)
|
||||
#define DHD_MSGTRACE_ON() (dhd_msg_level & DHD_MSGTRACE_VAL)
|
||||
#define DHD_FWLOG_ON() (dhd_msg_level & DHD_FWLOG_VAL)
|
||||
#define DHD_DBGIF_ON() (dhd_msg_level & DHD_DBGIF_VAL)
|
||||
#define DHD_PKT_MON_ON() (dhd_msg_level & DHD_PKT_MON_VAL)
|
||||
#define DHD_PKT_MON_DUMP_ON() (dhd_msg_level & DHD_PKT_MON_DUMP_VAL)
|
||||
|
||||
#else /* defined(BCMDBG) || defined(DHD_DEBUG) */
|
||||
|
||||
#if defined(DHD_EFI)
|
||||
extern void dhd_log_dump_print_drv(const char *fmt, ...);
|
||||
extern char *dhd_log_dump_get_timestamp(void);
|
||||
#define DHD_ERROR(args) \
|
||||
do { \
|
||||
if (dhd_msg_level & DHD_ERROR_VAL) { \
|
||||
printf args; \
|
||||
dhd_log_dump_print_drv("[%s] %s: ", dhd_log_dump_get_timestamp(), __FUNCTION__); \
|
||||
dhd_log_dump_print_drv args; \
|
||||
} \
|
||||
} while (0)
|
||||
#define DHD_INFO(args) \
|
||||
do { \
|
||||
if (dhd_msg_level & DHD_INFO_VAL) { \
|
||||
printf args; \
|
||||
dhd_log_dump_print_drv("[%s] %s: ", dhd_log_dump_get_timestamp(), __FUNCTION__); \
|
||||
dhd_log_dump_print_drv args; \
|
||||
} \
|
||||
} while (0)
|
||||
#define DHD_TRACE(args)
|
||||
#else /* DHD_EFI */
|
||||
|
||||
#define DHD_ERROR(args) do {if (dhd_msg_level & DHD_ERROR_VAL) \
|
||||
printf args;} while (0)
|
||||
#define DHD_TRACE(args)
|
||||
#define DHD_INFO(args)
|
||||
#endif
|
||||
|
||||
#define DHD_DATA(args)
|
||||
#define DHD_CTL(args)
|
||||
#define DHD_TIMER(args)
|
||||
#define DHD_HDRS(args)
|
||||
#define DHD_BYTES(args)
|
||||
#define DHD_INTR(args)
|
||||
#define DHD_GLOM(args)
|
||||
|
||||
#if defined(DHD_EFI) && defined(DHD_LOG_DUMP)
|
||||
#define DHD_EVENT(args) \
|
||||
do { \
|
||||
if (dhd_msg_level & DHD_EVENT_VAL) { \
|
||||
dhd_log_dump_print("[%s] %s: ", dhd_log_dump_get_timestamp(), __FUNCTION__); \
|
||||
dhd_log_dump_print args; \
|
||||
} \
|
||||
} while (0)
|
||||
#else
|
||||
#define DHD_EVENT(args)
|
||||
#endif /* DHD_EFI && DHD_LOG_DUMP */
|
||||
|
||||
#define DHD_ISCAN(args)
|
||||
#define DHD_ARPOE(args)
|
||||
#define DHD_REORDER(args)
|
||||
#define DHD_PNO(args)
|
||||
#define DHD_RTT(args)
|
||||
#define DHD_PKT_MON(args)
|
||||
|
||||
#if defined(DHD_EFI) && defined(DHD_LOG_DUMP)
|
||||
#define DHD_MSGTRACE_LOG(args) \
|
||||
do { \
|
||||
if (dhd_msg_level & DHD_MSGTRACE_VAL) { \
|
||||
dhd_log_dump_print("[%s] %s: ", dhd_log_dump_get_timestamp(), __FUNCTION__); \
|
||||
dhd_log_dump_print args; \
|
||||
} \
|
||||
} while (0)
|
||||
#define DHD_FWLOG(args) DHD_MSGTRACE_LOG(args)
|
||||
#else
|
||||
#define DHD_MSGTRACE_LOG(args)
|
||||
#define DHD_FWLOG(args)
|
||||
#endif /* DHD_EFI && DHD_LOG_DUMP */
|
||||
|
||||
#define DHD_DBGIF(args)
|
||||
|
||||
#if defined(DHD_EFI) && defined(DHD_LOG_DUMP)
|
||||
#define DHD_ERROR_MEM(args) \
|
||||
do { \
|
||||
if (dhd_msg_level & DHD_ERROR_VAL) { \
|
||||
dhd_log_dump_print("[%s] %s: ", dhd_log_dump_get_timestamp(), __FUNCTION__); \
|
||||
dhd_log_dump_print args; \
|
||||
} \
|
||||
} while (0)
|
||||
#define DHD_ERROR_EX(args) DHD_ERROR(args)
|
||||
#else
|
||||
#define DHD_ERROR_MEM(args) DHD_ERROR(args)
|
||||
#define DHD_ERROR_EX(args) DHD_ERROR(args)
|
||||
#endif /* DHD_EFI && DHD_LOG_DUMP */
|
||||
|
||||
#ifdef CUSTOMER_HW4_DEBUG
|
||||
#define DHD_TRACE_HW4 DHD_ERROR
|
||||
#define DHD_INFO_HW4 DHD_ERROR
|
||||
#else
|
||||
#define DHD_TRACE_HW4 DHD_TRACE
|
||||
#define DHD_INFO_HW4 DHD_INFO
|
||||
#endif /* CUSTOMER_HW4_DEBUG */
|
||||
|
||||
#define DHD_ERROR_ON() 0
|
||||
#define DHD_TRACE_ON() 0
|
||||
#define DHD_INFO_ON() 0
|
||||
#define DHD_DATA_ON() 0
|
||||
#define DHD_CTL_ON() 0
|
||||
#define DHD_TIMER_ON() 0
|
||||
#define DHD_HDRS_ON() 0
|
||||
#define DHD_BYTES_ON() 0
|
||||
#define DHD_INTR_ON() 0
|
||||
#define DHD_GLOM_ON() 0
|
||||
#define DHD_EVENT_ON() 0
|
||||
#define DHD_ISCAN_ON() 0
|
||||
#define DHD_ARPOE_ON() 0
|
||||
#define DHD_REORDER_ON() 0
|
||||
#define DHD_NOCHECKDIED_ON() 0
|
||||
#define DHD_PNO_ON() 0
|
||||
#define DHD_RTT_ON() 0
|
||||
#define DHD_PKT_MON_ON() 0
|
||||
#define DHD_PKT_MON_DUMP_ON() 0
|
||||
#define DHD_MSGTRACE_ON() 0
|
||||
#define DHD_FWLOG_ON() 0
|
||||
#define DHD_DBGIF_ON() 0
|
||||
#endif
|
||||
|
||||
#define DHD_LOG(args)
|
||||
|
||||
#define DHD_BLOG(cp, size)
|
||||
|
||||
#define DHD_NONE(args)
|
||||
extern int dhd_msg_level;
|
||||
|
||||
/* Defines msg bits */
|
||||
#include <dhdioctl.h>
|
||||
|
||||
#endif /* _dhd_dbg_ */
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,868 @@
|
|||
/*
|
||||
* DHD debugability header file
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
* $Id: dhd_debug.h 705824 2017-06-19 13:58:39Z $
|
||||
*/
|
||||
|
||||
#ifndef _dhd_debug_h_
|
||||
#define _dhd_debug_h_
|
||||
#include <event_log.h>
|
||||
#include <bcmutils.h>
|
||||
|
||||
enum {
|
||||
DEBUG_RING_ID_INVALID = 0,
|
||||
FW_VERBOSE_RING_ID,
|
||||
FW_EVENT_RING_ID,
|
||||
DHD_EVENT_RING_ID,
|
||||
NAN_EVENT_RING_ID,
|
||||
/* add new id here */
|
||||
DEBUG_RING_ID_MAX
|
||||
};
|
||||
|
||||
enum {
|
||||
/* Feature set */
|
||||
DBG_MEMORY_DUMP_SUPPORTED = (1 << (0)), /* Memory dump of FW */
|
||||
DBG_PER_PACKET_TX_RX_STATUS_SUPPORTED = (1 << (1)), /* PKT Status */
|
||||
DBG_CONNECT_EVENT_SUPPORTED = (1 << (2)), /* Connectivity Event */
|
||||
DBG_POWER_EVENT_SUPOORTED = (1 << (3)), /* POWER of Driver */
|
||||
DBG_WAKE_LOCK_SUPPORTED = (1 << (4)), /* WAKE LOCK of Driver */
|
||||
DBG_VERBOSE_LOG_SUPPORTED = (1 << (5)), /* verbose log of FW */
|
||||
DBG_HEALTH_CHECK_SUPPORTED = (1 << (6)), /* monitor the health of FW */
|
||||
DBG_DRIVER_DUMP_SUPPORTED = (1 << (7)), /* dumps driver state */
|
||||
DBG_PACKET_FATE_SUPPORTED = (1 << (8)), /* tracks connection packets' fate */
|
||||
DBG_NAN_EVENT_SUPPORTED = (1 << (9)), /* NAN Events */
|
||||
};
|
||||
|
||||
enum {
|
||||
/* set for binary entries */
|
||||
DBG_RING_ENTRY_FLAGS_HAS_BINARY = (1 << (0)),
|
||||
/* set if 64 bits timestamp is present */
|
||||
DBG_RING_ENTRY_FLAGS_HAS_TIMESTAMP = (1 << (1))
|
||||
};
|
||||
|
||||
#define DBGRING_NAME_MAX 32
|
||||
/* firmware verbose ring, ring id 1 */
|
||||
#define FW_VERBOSE_RING_NAME "fw_verbose"
|
||||
#define FW_VERBOSE_RING_SIZE (64 * 1024)
|
||||
/* firmware event ring, ring id 2 */
|
||||
#define FW_EVENT_RING_NAME "fw_event"
|
||||
#define FW_EVENT_RING_SIZE (64 * 1024)
|
||||
/* DHD connection event ring, ring id 3 */
|
||||
#define DHD_EVENT_RING_NAME "dhd_event"
|
||||
#define DHD_EVENT_RING_SIZE (64 * 1024)
|
||||
|
||||
/* NAN event ring, ring id 4 */
|
||||
#define NAN_EVENT_RING_NAME "nan_event"
|
||||
#define NAN_EVENT_RING_SIZE (64 * 1024)
|
||||
|
||||
#define TLV_LOG_SIZE(tlv) ((tlv) ? (sizeof(tlv_log) + (tlv)->len) : 0)
|
||||
|
||||
#define TLV_LOG_NEXT(tlv) \
|
||||
((tlv) ? ((tlv_log *)((uint8 *)tlv + TLV_LOG_SIZE(tlv))) : 0)
|
||||
|
||||
#define DBG_RING_STATUS_SIZE (sizeof(dhd_dbg_ring_status_t))
|
||||
|
||||
#define VALID_RING(id) \
|
||||
((id > DEBUG_RING_ID_INVALID) && (id < DEBUG_RING_ID_MAX))
|
||||
|
||||
#ifdef DEBUGABILITY
|
||||
#define DBG_RING_ACTIVE(dhdp, ring_id) \
|
||||
((dhdp)->dbg->dbg_rings[(ring_id)].state == RING_ACTIVE)
|
||||
#else
|
||||
#define DBG_RING_ACTIVE(dhdp, ring_id) 0
|
||||
#endif /* DEBUGABILITY */
|
||||
|
||||
#define TXACTIVESZ(r, w, d) (((r) <= (w)) ? ((w) - (r)) : ((d) - (r) + (w)))
|
||||
#define DBG_RING_READ_AVAIL_SPACE(w, r, d) (((w) >= (r)) ? ((w) - (r)) : ((d) - (r)))
|
||||
#define DBG_RING_WRITE_SPACE_AVAIL_CONT(r, w, d) (((w) >= (r)) ? ((d) - (w)) : ((r) - (w)))
|
||||
#define DBG_RING_WRITE_SPACE_AVAIL(r, w, d) (d - (TXACTIVESZ(r, w, d)))
|
||||
#define DBG_RING_CHECK_WRITE_SPACE(r, w, d) \
|
||||
MIN(DBG_RING_WRITE_SPACE_AVAIL(r, w, d), DBG_RING_WRITE_SPACE_AVAIL_CONT(r, w, d))
|
||||
|
||||
enum {
|
||||
/* driver receive association command from kernel */
|
||||
WIFI_EVENT_ASSOCIATION_REQUESTED = 0,
|
||||
WIFI_EVENT_AUTH_COMPLETE,
|
||||
WIFI_EVENT_ASSOC_COMPLETE,
|
||||
/* received firmware event indicating auth frames are sent */
|
||||
WIFI_EVENT_FW_AUTH_STARTED,
|
||||
/* received firmware event indicating assoc frames are sent */
|
||||
WIFI_EVENT_FW_ASSOC_STARTED,
|
||||
/* received firmware event indicating reassoc frames are sent */
|
||||
WIFI_EVENT_FW_RE_ASSOC_STARTED,
|
||||
WIFI_EVENT_DRIVER_SCAN_REQUESTED,
|
||||
WIFI_EVENT_DRIVER_SCAN_RESULT_FOUND,
|
||||
WIFI_EVENT_DRIVER_SCAN_COMPLETE,
|
||||
WIFI_EVENT_G_SCAN_STARTED,
|
||||
WIFI_EVENT_G_SCAN_COMPLETE,
|
||||
WIFI_EVENT_DISASSOCIATION_REQUESTED,
|
||||
WIFI_EVENT_RE_ASSOCIATION_REQUESTED,
|
||||
WIFI_EVENT_ROAM_REQUESTED,
|
||||
/* received beacon from AP (event enabled only in verbose mode) */
|
||||
WIFI_EVENT_BEACON_RECEIVED,
|
||||
/* firmware has triggered a roam scan (not g-scan) */
|
||||
WIFI_EVENT_ROAM_SCAN_STARTED,
|
||||
/* firmware has completed a roam scan (not g-scan) */
|
||||
WIFI_EVENT_ROAM_SCAN_COMPLETE,
|
||||
/* firmware has started searching for roam candidates (with reason =xx) */
|
||||
WIFI_EVENT_ROAM_SEARCH_STARTED,
|
||||
/* firmware has stopped searching for roam candidates (with reason =xx) */
|
||||
WIFI_EVENT_ROAM_SEARCH_STOPPED,
|
||||
WIFI_EVENT_UNUSED_0,
|
||||
/* received channel switch anouncement from AP */
|
||||
WIFI_EVENT_CHANNEL_SWITCH_ANOUNCEMENT,
|
||||
/* fw start transmit eapol frame, with EAPOL index 1-4 */
|
||||
WIFI_EVENT_FW_EAPOL_FRAME_TRANSMIT_START,
|
||||
/* fw gives up eapol frame, with rate, success/failure and number retries */
|
||||
WIFI_EVENT_FW_EAPOL_FRAME_TRANSMIT_STOP,
|
||||
/* kernel queue EAPOL for transmission in driver with EAPOL index 1-4 */
|
||||
WIFI_EVENT_DRIVER_EAPOL_FRAME_TRANSMIT_REQUESTED,
|
||||
/* with rate, regardless of the fact that EAPOL frame is accepted or
|
||||
* rejected by firmware
|
||||
*/
|
||||
WIFI_EVENT_FW_EAPOL_FRAME_RECEIVED,
|
||||
WIFI_EVENT_UNUSED_1,
|
||||
/* with rate, and eapol index, driver has received */
|
||||
/* EAPOL frame and will queue it up to wpa_supplicant */
|
||||
WIFI_EVENT_DRIVER_EAPOL_FRAME_RECEIVED,
|
||||
/* with success/failure, parameters */
|
||||
WIFI_EVENT_BLOCK_ACK_NEGOTIATION_COMPLETE,
|
||||
WIFI_EVENT_BT_COEX_BT_SCO_START,
|
||||
WIFI_EVENT_BT_COEX_BT_SCO_STOP,
|
||||
/* for paging/scan etc..., when BT starts transmiting twice per BT slot */
|
||||
WIFI_EVENT_BT_COEX_BT_SCAN_START,
|
||||
WIFI_EVENT_BT_COEX_BT_SCAN_STOP,
|
||||
WIFI_EVENT_BT_COEX_BT_HID_START,
|
||||
WIFI_EVENT_BT_COEX_BT_HID_STOP,
|
||||
/* firmware sends auth frame in roaming to next candidate */
|
||||
WIFI_EVENT_ROAM_AUTH_STARTED,
|
||||
/* firmware receive auth confirm from ap */
|
||||
WIFI_EVENT_ROAM_AUTH_COMPLETE,
|
||||
/* firmware sends assoc/reassoc frame in */
|
||||
WIFI_EVENT_ROAM_ASSOC_STARTED,
|
||||
/* firmware receive assoc/reassoc confirm from ap */
|
||||
WIFI_EVENT_ROAM_ASSOC_COMPLETE,
|
||||
/* firmware sends stop G_SCAN */
|
||||
WIFI_EVENT_G_SCAN_STOP,
|
||||
/* firmware indicates G_SCAN scan cycle started */
|
||||
WIFI_EVENT_G_SCAN_CYCLE_STARTED,
|
||||
/* firmware indicates G_SCAN scan cycle completed */
|
||||
WIFI_EVENT_G_SCAN_CYCLE_COMPLETED,
|
||||
/* firmware indicates G_SCAN scan start for a particular bucket */
|
||||
WIFI_EVENT_G_SCAN_BUCKET_STARTED,
|
||||
/* firmware indicates G_SCAN scan completed for particular bucket */
|
||||
WIFI_EVENT_G_SCAN_BUCKET_COMPLETED,
|
||||
/* Event received from firmware about G_SCAN scan results being available */
|
||||
WIFI_EVENT_G_SCAN_RESULTS_AVAILABLE,
|
||||
/* Event received from firmware with G_SCAN capabilities */
|
||||
WIFI_EVENT_G_SCAN_CAPABILITIES,
|
||||
/* Event received from firmware when eligible candidate is found */
|
||||
WIFI_EVENT_ROAM_CANDIDATE_FOUND,
|
||||
/* Event received from firmware when roam scan configuration gets enabled or disabled */
|
||||
WIFI_EVENT_ROAM_SCAN_CONFIG,
|
||||
/* firmware/driver timed out authentication */
|
||||
WIFI_EVENT_AUTH_TIMEOUT,
|
||||
/* firmware/driver timed out association */
|
||||
WIFI_EVENT_ASSOC_TIMEOUT,
|
||||
/* firmware/driver encountered allocation failure */
|
||||
WIFI_EVENT_MEM_ALLOC_FAILURE,
|
||||
/* driver added a PNO network in firmware */
|
||||
WIFI_EVENT_DRIVER_PNO_ADD,
|
||||
/* driver removed a PNO network in firmware */
|
||||
WIFI_EVENT_DRIVER_PNO_REMOVE,
|
||||
/* driver received PNO networks found indication from firmware */
|
||||
WIFI_EVENT_DRIVER_PNO_NETWORK_FOUND,
|
||||
/* driver triggered a scan for PNO networks */
|
||||
WIFI_EVENT_DRIVER_PNO_SCAN_REQUESTED,
|
||||
/* driver received scan results of PNO networks */
|
||||
WIFI_EVENT_DRIVER_PNO_SCAN_RESULT_FOUND,
|
||||
/* driver updated scan results from PNO candidates to cfg */
|
||||
WIFI_EVENT_DRIVER_PNO_SCAN_COMPLETE
|
||||
};
|
||||
|
||||
enum {
|
||||
WIFI_TAG_VENDOR_SPECIFIC = 0, /* take a byte stream as parameter */
|
||||
WIFI_TAG_BSSID, /* takes a 6 bytes MAC address as parameter */
|
||||
WIFI_TAG_ADDR, /* takes a 6 bytes MAC address as parameter */
|
||||
WIFI_TAG_SSID, /* takes a 32 bytes SSID address as parameter */
|
||||
WIFI_TAG_STATUS, /* takes an integer as parameter */
|
||||
WIFI_TAG_CHANNEL_SPEC, /* takes one or more wifi_channel_spec as parameter */
|
||||
WIFI_TAG_WAKE_LOCK_EVENT, /* takes a wake_lock_event struct as parameter */
|
||||
WIFI_TAG_ADDR1, /* takes a 6 bytes MAC address as parameter */
|
||||
WIFI_TAG_ADDR2, /* takes a 6 bytes MAC address as parameter */
|
||||
WIFI_TAG_ADDR3, /* takes a 6 bytes MAC address as parameter */
|
||||
WIFI_TAG_ADDR4, /* takes a 6 bytes MAC address as parameter */
|
||||
WIFI_TAG_TSF, /* take a 64 bits TSF value as parameter */
|
||||
WIFI_TAG_IE,
|
||||
/* take one or more specific 802.11 IEs parameter, IEs are in turn
|
||||
* indicated in TLV format as per 802.11 spec
|
||||
*/
|
||||
WIFI_TAG_INTERFACE, /* take interface name as parameter */
|
||||
WIFI_TAG_REASON_CODE, /* take a reason code as per 802.11 as parameter */
|
||||
WIFI_TAG_RATE_MBPS, /* take a wifi rate in 0.5 mbps */
|
||||
WIFI_TAG_REQUEST_ID, /* take an integer as parameter */
|
||||
WIFI_TAG_BUCKET_ID, /* take an integer as parameter */
|
||||
WIFI_TAG_GSCAN_PARAMS, /* takes a wifi_scan_cmd_params struct as parameter */
|
||||
WIFI_TAG_GSCAN_CAPABILITIES, /* takes a wifi_gscan_capabilities struct as parameter */
|
||||
WIFI_TAG_SCAN_ID, /* take an integer as parameter */
|
||||
WIFI_TAG_RSSI, /* takes s16 as parameter */
|
||||
WIFI_TAG_CHANNEL, /* takes u16 as parameter */
|
||||
WIFI_TAG_LINK_ID, /* take an integer as parameter */
|
||||
WIFI_TAG_LINK_ROLE, /* take an integer as parameter */
|
||||
WIFI_TAG_LINK_STATE, /* take an integer as parameter */
|
||||
WIFI_TAG_LINK_TYPE, /* take an integer as parameter */
|
||||
WIFI_TAG_TSCO, /* take an integer as parameter */
|
||||
WIFI_TAG_RSCO, /* take an integer as parameter */
|
||||
WIFI_TAG_EAPOL_MESSAGE_TYPE /* take an integer as parameter */
|
||||
};
|
||||
|
||||
/* NAN events */
|
||||
typedef enum {
|
||||
NAN_EVENT_INVALID = 0,
|
||||
NAN_EVENT_CLUSTER_STARTED = 1,
|
||||
NAN_EVENT_CLUSTER_JOINED = 2,
|
||||
NAN_EVENT_CLUSTER_MERGED = 3,
|
||||
NAN_EVENT_ROLE_CHANGED = 4,
|
||||
NAN_EVENT_SCAN_COMPLETE = 5,
|
||||
NAN_EVENT_STATUS_CHNG = 6,
|
||||
/* ADD new events before this line */
|
||||
NAN_EVENT_MAX
|
||||
} nan_event_id_t;
|
||||
|
||||
typedef struct {
|
||||
uint16 tag;
|
||||
uint16 len; /* length of value */
|
||||
uint8 value[0];
|
||||
} tlv_log;
|
||||
|
||||
typedef struct per_packet_status_entry {
|
||||
uint8 flags;
|
||||
uint8 tid; /* transmit or received tid */
|
||||
uint16 MCS; /* modulation and bandwidth */
|
||||
/*
|
||||
* TX: RSSI of ACK for that packet
|
||||
* RX: RSSI of packet
|
||||
*/
|
||||
uint8 rssi;
|
||||
uint8 num_retries; /* number of attempted retries */
|
||||
uint16 last_transmit_rate; /* last transmit rate in .5 mbps */
|
||||
/* transmit/reeive sequence for that MPDU packet */
|
||||
uint16 link_layer_transmit_sequence;
|
||||
/*
|
||||
* TX: firmware timestamp (us) when packet is queued within firmware buffer
|
||||
* for SDIO/HSIC or into PCIe buffer
|
||||
* RX : firmware receive timestamp
|
||||
*/
|
||||
uint64 firmware_entry_timestamp;
|
||||
/*
|
||||
* firmware timestamp (us) when packet start contending for the
|
||||
* medium for the first time, at head of its AC queue,
|
||||
* or as part of an MPDU or A-MPDU. This timestamp is not updated
|
||||
* for each retry, only the first transmit attempt.
|
||||
*/
|
||||
uint64 start_contention_timestamp;
|
||||
/*
|
||||
* fimrware timestamp (us) when packet is successfully transmitted
|
||||
* or aborted because it has exhausted its maximum number of retries
|
||||
*/
|
||||
uint64 transmit_success_timestamp;
|
||||
/*
|
||||
* packet data. The length of packet data is determined by the entry_size field of
|
||||
* the wifi_ring_buffer_entry structure. It is expected that first bytes of the
|
||||
* packet, or packet headers only (up to TCP or RTP/UDP headers) will be copied into the ring
|
||||
*/
|
||||
uint8 *data;
|
||||
} per_packet_status_entry_t;
|
||||
|
||||
#define PACKED_STRUCT __attribute__ ((packed))
|
||||
typedef struct log_conn_event {
|
||||
uint16 event;
|
||||
tlv_log *tlvs;
|
||||
/*
|
||||
* separate parameter structure per event to be provided and optional data
|
||||
* the event_data is expected to include an official android part, with some
|
||||
* parameter as transmit rate, num retries, num scan result found etc...
|
||||
* as well, event_data can include a vendor proprietary part which is
|
||||
* understood by the developer only.
|
||||
*/
|
||||
} PACKED_STRUCT log_conn_event_t;
|
||||
|
||||
/*
|
||||
* Ring buffer name for power events ring. note that power event are extremely frequents
|
||||
* and thus should be stored in their own ring/file so as not to clobber connectivity events
|
||||
*/
|
||||
|
||||
typedef struct wake_lock_event {
|
||||
uint32 status; /* 0 taken, 1 released */
|
||||
uint32 reason; /* reason why this wake lock is taken */
|
||||
char *name; /* null terminated */
|
||||
} wake_lock_event_t;
|
||||
|
||||
typedef struct wifi_power_event {
|
||||
uint16 event;
|
||||
tlv_log *tlvs;
|
||||
} wifi_power_event_t;
|
||||
|
||||
#define NAN_EVENT_VERSION 1
|
||||
typedef struct log_nan_event {
|
||||
uint8 version;
|
||||
uint8 pad;
|
||||
uint16 event;
|
||||
tlv_log *tlvs;
|
||||
} log_nan_event_t;
|
||||
|
||||
/* entry type */
|
||||
enum {
|
||||
DBG_RING_ENTRY_EVENT_TYPE = 1,
|
||||
DBG_RING_ENTRY_PKT_TYPE,
|
||||
DBG_RING_ENTRY_WAKE_LOCK_EVENT_TYPE,
|
||||
DBG_RING_ENTRY_POWER_EVENT_TYPE,
|
||||
DBG_RING_ENTRY_DATA_TYPE,
|
||||
DBG_RING_ENTRY_NAN_EVENT_TYPE
|
||||
};
|
||||
|
||||
typedef struct dhd_dbg_ring_entry {
|
||||
uint16 len; /* payload length excluding the header */
|
||||
uint8 flags;
|
||||
uint8 type; /* Per ring specific */
|
||||
uint64 timestamp; /* present if has_timestamp bit is set. */
|
||||
} PACKED_STRUCT dhd_dbg_ring_entry_t;
|
||||
|
||||
#define DBG_RING_ENTRY_SIZE (sizeof(dhd_dbg_ring_entry_t))
|
||||
|
||||
#define ENTRY_LENGTH(hdr) ((hdr)->len + DBG_RING_ENTRY_SIZE)
|
||||
|
||||
#define PAYLOAD_MAX_LEN 65535
|
||||
|
||||
typedef struct dhd_dbg_ring_status {
|
||||
uint8 name[DBGRING_NAME_MAX];
|
||||
uint32 flags;
|
||||
int ring_id; /* unique integer representing the ring */
|
||||
/* total memory size allocated for the buffer */
|
||||
uint32 ring_buffer_byte_size;
|
||||
uint32 verbose_level;
|
||||
/* number of bytes that was written to the buffer by driver */
|
||||
uint32 written_bytes;
|
||||
/* number of bytes that was read from the buffer by user land */
|
||||
uint32 read_bytes;
|
||||
/* number of records that was read from the buffer by user land */
|
||||
uint32 written_records;
|
||||
} dhd_dbg_ring_status_t;
|
||||
|
||||
struct log_level_table {
|
||||
int log_level;
|
||||
uint16 tag;
|
||||
uint8 sets;
|
||||
char *desc;
|
||||
};
|
||||
|
||||
#ifdef DEBUGABILITY
|
||||
#define DBG_EVENT_LOG(dhdp, connect_state) \
|
||||
{ \
|
||||
do { \
|
||||
uint16 state = connect_state; \
|
||||
if (DBG_RING_ACTIVE(dhdp, DHD_EVENT_RING_ID)) \
|
||||
dhd_os_push_push_ring_data(dhdp, DHD_EVENT_RING_ID, \
|
||||
&state, sizeof(state)); \
|
||||
} while (0); \
|
||||
}
|
||||
#else
|
||||
#define DBG_EVENT_LOG(dhdp, connect_state)
|
||||
#endif /* DEBUGABILITY */
|
||||
|
||||
|
||||
#define MD5_PREFIX_LEN 4
|
||||
#define MAX_FATE_LOG_LEN 32
|
||||
|
||||
#define MAX_FRAME_LEN_ETHERNET 1518
|
||||
#define MAX_FRAME_LEN_80211_MGMT 2352 /* 802.11-2012 Fig. 8-34 */
|
||||
|
||||
typedef enum {
|
||||
/* Sent over air and ACKed. */
|
||||
TX_PKT_FATE_ACKED,
|
||||
|
||||
/* Sent over air but not ACKed. (Normal for broadcast/multicast.) */
|
||||
TX_PKT_FATE_SENT,
|
||||
|
||||
/* Queued within firmware, but not yet sent over air. */
|
||||
TX_PKT_FATE_FW_QUEUED,
|
||||
|
||||
/*
|
||||
* Dropped by firmware as invalid. E.g. bad source address,
|
||||
* bad checksum, or invalid for current state.
|
||||
*/
|
||||
TX_PKT_FATE_FW_DROP_INVALID,
|
||||
|
||||
/* Dropped by firmware due to lack of buffer space. */
|
||||
TX_PKT_FATE_FW_DROP_NOBUFS,
|
||||
|
||||
/*
|
||||
* Dropped by firmware for any other reason. Includes
|
||||
* frames that were sent by driver to firmware, but
|
||||
* unaccounted for by firmware.
|
||||
*/
|
||||
TX_PKT_FATE_FW_DROP_OTHER,
|
||||
|
||||
/* Queued within driver, not yet sent to firmware. */
|
||||
TX_PKT_FATE_DRV_QUEUED,
|
||||
|
||||
/*
|
||||
* Dropped by driver as invalid. E.g. bad source address,
|
||||
* or invalid for current state.
|
||||
*/
|
||||
TX_PKT_FATE_DRV_DROP_INVALID,
|
||||
|
||||
/* Dropped by driver due to lack of buffer space. */
|
||||
TX_PKT_FATE_DRV_DROP_NOBUFS,
|
||||
|
||||
/* Dropped by driver for any other reason. */
|
||||
TX_PKT_FATE_DRV_DROP_OTHER,
|
||||
|
||||
} wifi_tx_packet_fate;
|
||||
|
||||
typedef enum {
|
||||
/* Valid and delivered to network stack (e.g., netif_rx()). */
|
||||
RX_PKT_FATE_SUCCESS,
|
||||
|
||||
/* Queued within firmware, but not yet sent to driver. */
|
||||
RX_PKT_FATE_FW_QUEUED,
|
||||
|
||||
/* Dropped by firmware due to host-programmable filters. */
|
||||
RX_PKT_FATE_FW_DROP_FILTER,
|
||||
|
||||
/*
|
||||
* Dropped by firmware as invalid. E.g. bad checksum,
|
||||
* decrypt failed, or invalid for current state.
|
||||
*/
|
||||
RX_PKT_FATE_FW_DROP_INVALID,
|
||||
|
||||
/* Dropped by firmware due to lack of buffer space. */
|
||||
RX_PKT_FATE_FW_DROP_NOBUFS,
|
||||
|
||||
/* Dropped by firmware for any other reason. */
|
||||
RX_PKT_FATE_FW_DROP_OTHER,
|
||||
|
||||
/* Queued within driver, not yet delivered to network stack. */
|
||||
RX_PKT_FATE_DRV_QUEUED,
|
||||
|
||||
/* Dropped by driver due to filter rules. */
|
||||
RX_PKT_FATE_DRV_DROP_FILTER,
|
||||
|
||||
/* Dropped by driver as invalid. E.g. not permitted in current state. */
|
||||
RX_PKT_FATE_DRV_DROP_INVALID,
|
||||
|
||||
/* Dropped by driver due to lack of buffer space. */
|
||||
RX_PKT_FATE_DRV_DROP_NOBUFS,
|
||||
|
||||
/* Dropped by driver for any other reason. */
|
||||
RX_PKT_FATE_DRV_DROP_OTHER,
|
||||
|
||||
} wifi_rx_packet_fate;
|
||||
|
||||
typedef enum {
|
||||
FRAME_TYPE_UNKNOWN,
|
||||
FRAME_TYPE_ETHERNET_II,
|
||||
FRAME_TYPE_80211_MGMT,
|
||||
} frame_type;
|
||||
|
||||
typedef struct wifi_frame_info {
|
||||
/*
|
||||
* The type of MAC-layer frame that this frame_info holds.
|
||||
* - For data frames, use FRAME_TYPE_ETHERNET_II.
|
||||
* - For management frames, use FRAME_TYPE_80211_MGMT.
|
||||
* - If the type of the frame is unknown, use FRAME_TYPE_UNKNOWN.
|
||||
*/
|
||||
frame_type payload_type;
|
||||
|
||||
/*
|
||||
* The number of bytes included in |frame_content|. If the frame
|
||||
* contents are missing (e.g. RX frame dropped in firmware),
|
||||
* |frame_len| should be set to 0.
|
||||
*/
|
||||
size_t frame_len;
|
||||
|
||||
/*
|
||||
* Host clock when this frame was received by the driver (either
|
||||
* outbound from the host network stack, or inbound from the
|
||||
* firmware).
|
||||
* - The timestamp should be taken from a clock which includes time
|
||||
* the host spent suspended (e.g. ktime_get_boottime()).
|
||||
* - If no host timestamp is available (e.g. RX frame was dropped in
|
||||
* firmware), this field should be set to 0.
|
||||
*/
|
||||
uint32 driver_timestamp_usec;
|
||||
|
||||
/*
|
||||
* Firmware clock when this frame was received by the firmware
|
||||
* (either outbound from the host, or inbound from a remote
|
||||
* station).
|
||||
* - The timestamp should be taken from a clock which includes time
|
||||
* firmware spent suspended (if applicable).
|
||||
* - If no firmware timestamp is available (e.g. TX frame was
|
||||
* dropped by driver), this field should be set to 0.
|
||||
* - Consumers of |frame_info| should _not_ assume any
|
||||
* synchronization between driver and firmware clocks.
|
||||
*/
|
||||
uint32 firmware_timestamp_usec;
|
||||
|
||||
/*
|
||||
* Actual frame content.
|
||||
* - Should be provided for TX frames originated by the host.
|
||||
* - Should be provided for RX frames received by the driver.
|
||||
* - Optionally provided for TX frames originated by firmware. (At
|
||||
* discretion of HAL implementation.)
|
||||
* - Optionally provided for RX frames dropped in firmware. (At
|
||||
* discretion of HAL implementation.)
|
||||
* - If frame content is not provided, |frame_len| should be set
|
||||
* to 0.
|
||||
*/
|
||||
union {
|
||||
char ethernet_ii[MAX_FRAME_LEN_ETHERNET];
|
||||
char ieee_80211_mgmt[MAX_FRAME_LEN_80211_MGMT];
|
||||
} frame_content;
|
||||
} wifi_frame_info_t;
|
||||
|
||||
typedef struct wifi_tx_report {
|
||||
/*
|
||||
* Prefix of MD5 hash of |frame_inf.frame_content|. If frame
|
||||
* content is not provided, prefix of MD5 hash over the same data
|
||||
* that would be in frame_content, if frame content were provided.
|
||||
*/
|
||||
char md5_prefix[MD5_PREFIX_LEN];
|
||||
wifi_tx_packet_fate fate;
|
||||
wifi_frame_info_t frame_inf;
|
||||
} wifi_tx_report_t;
|
||||
|
||||
typedef struct wifi_rx_report {
|
||||
/*
|
||||
* Prefix of MD5 hash of |frame_inf.frame_content|. If frame
|
||||
* content is not provided, prefix of MD5 hash over the same data
|
||||
* that would be in frame_content, if frame content were provided.
|
||||
*/
|
||||
char md5_prefix[MD5_PREFIX_LEN];
|
||||
wifi_rx_packet_fate fate;
|
||||
wifi_frame_info_t frame_inf;
|
||||
} wifi_rx_report_t;
|
||||
|
||||
typedef struct compat_wifi_frame_info {
|
||||
frame_type payload_type;
|
||||
|
||||
uint32 frame_len;
|
||||
|
||||
uint32 driver_timestamp_usec;
|
||||
|
||||
uint32 firmware_timestamp_usec;
|
||||
|
||||
union {
|
||||
char ethernet_ii[MAX_FRAME_LEN_ETHERNET];
|
||||
char ieee_80211_mgmt[MAX_FRAME_LEN_80211_MGMT];
|
||||
} frame_content;
|
||||
} compat_wifi_frame_info_t;
|
||||
|
||||
|
||||
typedef struct compat_wifi_tx_report {
|
||||
char md5_prefix[MD5_PREFIX_LEN];
|
||||
wifi_tx_packet_fate fate;
|
||||
compat_wifi_frame_info_t frame_inf;
|
||||
} compat_wifi_tx_report_t;
|
||||
|
||||
typedef struct compat_wifi_rx_report {
|
||||
char md5_prefix[MD5_PREFIX_LEN];
|
||||
wifi_rx_packet_fate fate;
|
||||
compat_wifi_frame_info_t frame_inf;
|
||||
} compat_wifi_rx_report_t;
|
||||
|
||||
|
||||
/*
|
||||
* Packet logging - internal data
|
||||
*/
|
||||
|
||||
typedef enum dhd_dbg_pkt_mon_state {
|
||||
PKT_MON_INVALID = 0,
|
||||
PKT_MON_ATTACHED,
|
||||
PKT_MON_STARTING,
|
||||
PKT_MON_STARTED,
|
||||
PKT_MON_STOPPING,
|
||||
PKT_MON_STOPPED,
|
||||
PKT_MON_DETACHED,
|
||||
} dhd_dbg_pkt_mon_state_t;
|
||||
|
||||
typedef struct dhd_dbg_pkt_info {
|
||||
frame_type payload_type;
|
||||
size_t pkt_len;
|
||||
uint32 driver_ts;
|
||||
uint32 firmware_ts;
|
||||
uint32 pkt_hash;
|
||||
void *pkt;
|
||||
} dhd_dbg_pkt_info_t;
|
||||
|
||||
typedef struct compat_dhd_dbg_pkt_info {
|
||||
frame_type payload_type;
|
||||
uint32 pkt_len;
|
||||
uint32 driver_ts;
|
||||
uint32 firmware_ts;
|
||||
uint32 pkt_hash;
|
||||
void *pkt;
|
||||
} compat_dhd_dbg_pkt_info_t;
|
||||
|
||||
typedef struct dhd_dbg_tx_info
|
||||
{
|
||||
wifi_tx_packet_fate fate;
|
||||
dhd_dbg_pkt_info_t info;
|
||||
} dhd_dbg_tx_info_t;
|
||||
|
||||
typedef struct dhd_dbg_rx_info
|
||||
{
|
||||
wifi_rx_packet_fate fate;
|
||||
dhd_dbg_pkt_info_t info;
|
||||
} dhd_dbg_rx_info_t;
|
||||
|
||||
typedef struct dhd_dbg_tx_report
|
||||
{
|
||||
dhd_dbg_tx_info_t *tx_pkts;
|
||||
uint16 pkt_pos;
|
||||
uint16 status_pos;
|
||||
} dhd_dbg_tx_report_t;
|
||||
|
||||
typedef struct dhd_dbg_rx_report
|
||||
{
|
||||
dhd_dbg_rx_info_t *rx_pkts;
|
||||
uint16 pkt_pos;
|
||||
} dhd_dbg_rx_report_t;
|
||||
|
||||
typedef void (*dbg_pullreq_t)(void *os_priv, const int ring_id);
|
||||
typedef void (*dbg_urgent_noti_t) (dhd_pub_t *dhdp, const void *data, const uint32 len);
|
||||
typedef int (*dbg_mon_tx_pkts_t) (dhd_pub_t *dhdp, void *pkt, uint32 pktid);
|
||||
typedef int (*dbg_mon_tx_status_t) (dhd_pub_t *dhdp, void *pkt,
|
||||
uint32 pktid, uint16 status);
|
||||
typedef int (*dbg_mon_rx_pkts_t) (dhd_pub_t *dhdp, void *pkt);
|
||||
|
||||
typedef struct dhd_dbg_pkt_mon
|
||||
{
|
||||
dhd_dbg_tx_report_t *tx_report;
|
||||
dhd_dbg_rx_report_t *rx_report;
|
||||
dhd_dbg_pkt_mon_state_t tx_pkt_state;
|
||||
dhd_dbg_pkt_mon_state_t tx_status_state;
|
||||
dhd_dbg_pkt_mon_state_t rx_pkt_state;
|
||||
|
||||
/* call backs */
|
||||
dbg_mon_tx_pkts_t tx_pkt_mon;
|
||||
dbg_mon_tx_status_t tx_status_mon;
|
||||
dbg_mon_rx_pkts_t rx_pkt_mon;
|
||||
} dhd_dbg_pkt_mon_t;
|
||||
|
||||
enum dbg_ring_state {
|
||||
RING_STOP = 0, /* ring is not initialized */
|
||||
RING_ACTIVE, /* ring is live and logging */
|
||||
RING_SUSPEND /* ring is initialized but not logging */
|
||||
};
|
||||
|
||||
struct ring_statistics {
|
||||
/* number of bytes that was written to the buffer by driver */
|
||||
uint32 written_bytes;
|
||||
/* number of bytes that was read from the buffer by user land */
|
||||
uint32 read_bytes;
|
||||
/* number of records that was written to the buffer by driver */
|
||||
uint32 written_records;
|
||||
};
|
||||
|
||||
typedef struct dhd_dbg_ring {
|
||||
int id; /* ring id */
|
||||
uint8 name[DBGRING_NAME_MAX]; /* name string */
|
||||
uint32 ring_size; /* numbers of item in ring */
|
||||
uint32 wp; /* write pointer */
|
||||
uint32 rp; /* read pointer */
|
||||
uint32 log_level; /* log_level */
|
||||
uint32 threshold; /* threshold bytes */
|
||||
void * ring_buf; /* pointer of actually ring buffer */
|
||||
void * lock; /* spin lock for ring access */
|
||||
struct ring_statistics stat; /* statistics */
|
||||
enum dbg_ring_state state; /* ring state enum */
|
||||
bool tail_padded; /* writer does not have enough space */
|
||||
uint32 rem_len; /* number of bytes from wp_pad to end */
|
||||
bool sched_pull; /* schedule reader immediately */
|
||||
} dhd_dbg_ring_t;
|
||||
|
||||
typedef struct dhd_dbg {
|
||||
dhd_dbg_ring_t dbg_rings[DEBUG_RING_ID_MAX];
|
||||
void *private; /* os private_data */
|
||||
dhd_dbg_pkt_mon_t pkt_mon;
|
||||
void *pkt_mon_lock; /* spin lock for packet monitoring */
|
||||
dbg_pullreq_t pullreq;
|
||||
dbg_urgent_noti_t urgent_notifier;
|
||||
} dhd_dbg_t;
|
||||
|
||||
#define PKT_MON_ATTACHED(state) \
|
||||
(((state) > PKT_MON_INVALID) && ((state) < PKT_MON_DETACHED))
|
||||
#define PKT_MON_DETACHED(state) \
|
||||
(((state) == PKT_MON_INVALID) || ((state) == PKT_MON_DETACHED))
|
||||
#define PKT_MON_STARTED(state) ((state) == PKT_MON_STARTED)
|
||||
#define PKT_MON_STOPPED(state) ((state) == PKT_MON_STOPPED)
|
||||
#define PKT_MON_NOT_OPERATIONAL(state) \
|
||||
(((state) != PKT_MON_STARTED) && ((state) != PKT_MON_STOPPED))
|
||||
#define PKT_MON_SAFE_TO_FREE(state) \
|
||||
(((state) == PKT_MON_STARTING) || ((state) == PKT_MON_STOPPED))
|
||||
#define PKT_MON_PKT_FULL(pkt_count) ((pkt_count) >= MAX_FATE_LOG_LEN)
|
||||
#define PKT_MON_STATUS_FULL(pkt_count, status_count) \
|
||||
(((status_count) >= (pkt_count)) || ((status_count) >= MAX_FATE_LOG_LEN))
|
||||
|
||||
#ifdef DBG_PKT_MON
|
||||
#define DHD_DBG_PKT_MON_TX(dhdp, pkt, pktid) \
|
||||
do { \
|
||||
if ((dhdp) && (dhdp)->dbg && (dhdp)->dbg->pkt_mon.tx_pkt_mon && (pkt)) { \
|
||||
(dhdp)->dbg->pkt_mon.tx_pkt_mon((dhdp), (pkt), (pktid)); \
|
||||
} \
|
||||
} while (0);
|
||||
#define DHD_DBG_PKT_MON_TX_STATUS(dhdp, pkt, pktid, status) \
|
||||
do { \
|
||||
if ((dhdp) && (dhdp)->dbg && (dhdp)->dbg->pkt_mon.tx_status_mon && (pkt)) { \
|
||||
(dhdp)->dbg->pkt_mon.tx_status_mon((dhdp), (pkt), (pktid), (status)); \
|
||||
} \
|
||||
} while (0);
|
||||
#define DHD_DBG_PKT_MON_RX(dhdp, pkt) \
|
||||
do { \
|
||||
if ((dhdp) && (dhdp)->dbg && (dhdp)->dbg->pkt_mon.rx_pkt_mon && (pkt)) { \
|
||||
if (ntoh16((pkt)->protocol) != ETHER_TYPE_BRCM) { \
|
||||
(dhdp)->dbg->pkt_mon.rx_pkt_mon((dhdp), (pkt)); \
|
||||
} \
|
||||
} \
|
||||
} while (0);
|
||||
|
||||
#define DHD_DBG_PKT_MON_START(dhdp) \
|
||||
dhd_os_dbg_start_pkt_monitor((dhdp));
|
||||
#define DHD_DBG_PKT_MON_STOP(dhdp) \
|
||||
dhd_os_dbg_stop_pkt_monitor((dhdp));
|
||||
#else
|
||||
#define DHD_DBG_PKT_MON_TX(dhdp, pkt, pktid)
|
||||
#define DHD_DBG_PKT_MON_TX_STATUS(dhdp, pkt, pktid, status)
|
||||
#define DHD_DBG_PKT_MON_RX(dhdp, pkt)
|
||||
#define DHD_DBG_PKT_MON_START(dhdp)
|
||||
#define DHD_DBG_PKT_MON_STOP(dhdp)
|
||||
#endif /* DBG_PKT_MON */
|
||||
|
||||
#ifdef DUMP_IOCTL_IOV_LIST
|
||||
typedef struct dhd_iov_li {
|
||||
dll_t list;
|
||||
uint32 cmd;
|
||||
char buff[100];
|
||||
} dhd_iov_li_t;
|
||||
|
||||
#define IOV_LIST_MAX_LEN 5
|
||||
#endif /* DUMP_IOCTL_IOV_LIST */
|
||||
|
||||
#ifdef DHD_DEBUG
|
||||
typedef struct {
|
||||
dll_t list;
|
||||
uint32 id; /* wasted chunk id */
|
||||
uint32 handle; /* wasted chunk handle */
|
||||
uint32 size; /* wasted chunk size */
|
||||
} dhd_dbg_mwli_t;
|
||||
#endif /* DHD_DEBUG */
|
||||
|
||||
/* dhd_dbg functions */
|
||||
extern void dhd_dbg_trace_evnt_handler(dhd_pub_t *dhdp, void *event_data,
|
||||
void *raw_event_ptr, uint datalen);
|
||||
extern int dhd_dbg_attach(dhd_pub_t *dhdp, dbg_pullreq_t os_pullreq,
|
||||
dbg_urgent_noti_t os_urgent_notifier, void *os_priv);
|
||||
extern void dhd_dbg_detach(dhd_pub_t *dhdp);
|
||||
extern int dhd_dbg_start(dhd_pub_t *dhdp, bool start);
|
||||
extern int dhd_dbg_set_configuration(dhd_pub_t *dhdp, int ring_id,
|
||||
int log_level, int flags, uint32 threshold);
|
||||
extern int dhd_dbg_get_ring_status(dhd_pub_t *dhdp, int ring_id,
|
||||
dhd_dbg_ring_status_t *dbg_ring_status);
|
||||
extern int dhd_dbg_ring_push(dhd_pub_t *dhdp, int ring_id, dhd_dbg_ring_entry_t *hdr, void *data);
|
||||
extern int dhd_dbg_ring_pull(dhd_pub_t *dhdp, int ring_id, void *data, uint32 buf_len);
|
||||
extern int dhd_dbg_ring_pull_single(dhd_pub_t *dhdp, int ring_id, void *data, uint32 buf_len,
|
||||
bool strip_header);
|
||||
extern int dhd_dbg_find_ring_id(dhd_pub_t *dhdp, char *ring_name);
|
||||
extern void *dhd_dbg_get_priv(dhd_pub_t *dhdp);
|
||||
extern int dhd_dbg_send_urgent_evt(dhd_pub_t *dhdp, const void *data, const uint32 len);
|
||||
extern void dhd_dbg_verboselog_printf(dhd_pub_t *dhdp, event_log_hdr_t *hdr,
|
||||
void *raw_event_ptr, uint32 *log_ptr);
|
||||
|
||||
#ifdef DBG_PKT_MON
|
||||
extern int dhd_dbg_attach_pkt_monitor(dhd_pub_t *dhdp,
|
||||
dbg_mon_tx_pkts_t tx_pkt_mon,
|
||||
dbg_mon_tx_status_t tx_status_mon,
|
||||
dbg_mon_rx_pkts_t rx_pkt_mon);
|
||||
extern int dhd_dbg_start_pkt_monitor(dhd_pub_t *dhdp);
|
||||
extern int dhd_dbg_monitor_tx_pkts(dhd_pub_t *dhdp, void *pkt, uint32 pktid);
|
||||
extern int dhd_dbg_monitor_tx_status(dhd_pub_t *dhdp, void *pkt,
|
||||
uint32 pktid, uint16 status);
|
||||
extern int dhd_dbg_monitor_rx_pkts(dhd_pub_t *dhdp, void *pkt);
|
||||
extern int dhd_dbg_stop_pkt_monitor(dhd_pub_t *dhdp);
|
||||
extern int dhd_dbg_monitor_get_tx_pkts(dhd_pub_t *dhdp, void __user *user_buf,
|
||||
uint16 req_count, uint16 *resp_count);
|
||||
extern int dhd_dbg_monitor_get_rx_pkts(dhd_pub_t *dhdp, void __user *user_buf,
|
||||
uint16 req_count, uint16 *resp_count);
|
||||
extern int dhd_dbg_detach_pkt_monitor(dhd_pub_t *dhdp);
|
||||
#endif /* DBG_PKT_MON */
|
||||
|
||||
/* os wrapper function */
|
||||
extern int dhd_os_dbg_attach(dhd_pub_t *dhdp);
|
||||
extern void dhd_os_dbg_detach(dhd_pub_t *dhdp);
|
||||
extern int dhd_os_dbg_register_callback(int ring_id,
|
||||
void (*dbg_ring_sub_cb)(void *ctx, const int ring_id, const void *data,
|
||||
const uint32 len, const dhd_dbg_ring_status_t dbg_ring_status));
|
||||
extern int dhd_os_dbg_register_urgent_notifier(dhd_pub_t *dhdp,
|
||||
void (*urgent_noti)(void *ctx, const void *data, const uint32 len, const uint32 fw_len));
|
||||
|
||||
extern int dhd_os_start_logging(dhd_pub_t *dhdp, char *ring_name, int log_level,
|
||||
int flags, int time_intval, int threshold);
|
||||
extern int dhd_os_reset_logging(dhd_pub_t *dhdp);
|
||||
extern int dhd_os_suppress_logging(dhd_pub_t *dhdp, bool suppress);
|
||||
|
||||
extern int dhd_os_get_ring_status(dhd_pub_t *dhdp, int ring_id,
|
||||
dhd_dbg_ring_status_t *dbg_ring_status);
|
||||
extern int dhd_os_trigger_get_ring_data(dhd_pub_t *dhdp, char *ring_name);
|
||||
extern int dhd_os_push_push_ring_data(dhd_pub_t *dhdp, int ring_id, void *data, int32 data_len);
|
||||
extern int dhd_os_dbg_get_feature(dhd_pub_t *dhdp, int32 *features);
|
||||
|
||||
#ifdef DBG_PKT_MON
|
||||
extern int dhd_os_dbg_attach_pkt_monitor(dhd_pub_t *dhdp);
|
||||
extern int dhd_os_dbg_start_pkt_monitor(dhd_pub_t *dhdp);
|
||||
extern int dhd_os_dbg_monitor_tx_pkts(dhd_pub_t *dhdp, void *pkt,
|
||||
uint32 pktid);
|
||||
extern int dhd_os_dbg_monitor_tx_status(dhd_pub_t *dhdp, void *pkt,
|
||||
uint32 pktid, uint16 status);
|
||||
extern int dhd_os_dbg_monitor_rx_pkts(dhd_pub_t *dhdp, void *pkt);
|
||||
extern int dhd_os_dbg_stop_pkt_monitor(dhd_pub_t *dhdp);
|
||||
extern int dhd_os_dbg_monitor_get_tx_pkts(dhd_pub_t *dhdp,
|
||||
void __user *user_buf, uint16 req_count, uint16 *resp_count);
|
||||
extern int dhd_os_dbg_monitor_get_rx_pkts(dhd_pub_t *dhdp,
|
||||
void __user *user_buf, uint16 req_count, uint16 *resp_count);
|
||||
extern int dhd_os_dbg_detach_pkt_monitor(dhd_pub_t *dhdp);
|
||||
#endif /* DBG_PKT_MON */
|
||||
|
||||
#ifdef DUMP_IOCTL_IOV_LIST
|
||||
extern void dhd_iov_li_append(dhd_pub_t *dhd, dll_t *list_head, dll_t *node);
|
||||
extern void dhd_iov_li_print(dll_t *list_head);
|
||||
extern void dhd_iov_li_delete(dhd_pub_t *dhd, dll_t *list_head);
|
||||
#endif /* DUMP_IOCTL_IOV_LIST */
|
||||
|
||||
#ifdef DHD_DEBUG
|
||||
extern void dhd_mw_list_delete(dhd_pub_t *dhd, dll_t *list_head);
|
||||
#endif /* DHD_DEBUG */
|
||||
#endif /* _dhd_debug_h_ */
|
|
@ -0,0 +1,512 @@
|
|||
/*
|
||||
* DHD debugability Linux os layer
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
* $Id: dhd_debug_linux.c 710862 2017-07-14 07:43:59Z $
|
||||
*/
|
||||
|
||||
#include <typedefs.h>
|
||||
#include <osl.h>
|
||||
#include <bcmutils.h>
|
||||
#include <bcmendian.h>
|
||||
#include <dngl_stats.h>
|
||||
#include <dhd.h>
|
||||
#include <dhd_dbg.h>
|
||||
#include <dhd_debug.h>
|
||||
|
||||
#include <net/cfg80211.h>
|
||||
#include <wl_cfgvendor.h>
|
||||
|
||||
typedef void (*dbg_ring_send_sub_t)(void *ctx, const int ring_id, const void *data,
|
||||
const uint32 len, const dhd_dbg_ring_status_t ring_status);
|
||||
typedef void (*dbg_urgent_noti_sub_t)(void *ctx, const void *data,
|
||||
const uint32 len, const uint32 fw_len);
|
||||
|
||||
static dbg_ring_send_sub_t ring_send_sub_cb[DEBUG_RING_ID_MAX];
|
||||
static dbg_urgent_noti_sub_t urgent_noti_sub_cb;
|
||||
typedef struct dhd_dbg_os_ring_info {
|
||||
dhd_pub_t *dhdp;
|
||||
int ring_id;
|
||||
int log_level;
|
||||
unsigned long interval;
|
||||
struct delayed_work work;
|
||||
uint64 tsoffset;
|
||||
} linux_dbgring_info_t;
|
||||
|
||||
struct log_level_table dhd_event_map[] = {
|
||||
{1, WIFI_EVENT_DRIVER_EAPOL_FRAME_TRANSMIT_REQUESTED, 0, "DRIVER EAPOL TX REQ"},
|
||||
{1, WIFI_EVENT_DRIVER_EAPOL_FRAME_RECEIVED, 0, "DRIVER EAPOL RX"},
|
||||
{2, WIFI_EVENT_DRIVER_SCAN_REQUESTED, 0, "SCAN_REQUESTED"},
|
||||
{2, WIFI_EVENT_DRIVER_SCAN_COMPLETE, 0, "SCAN COMPELETE"},
|
||||
{3, WIFI_EVENT_DRIVER_SCAN_RESULT_FOUND, 0, "SCAN RESULT FOUND"},
|
||||
{2, WIFI_EVENT_DRIVER_PNO_ADD, 0, "PNO ADD"},
|
||||
{2, WIFI_EVENT_DRIVER_PNO_REMOVE, 0, "PNO REMOVE"},
|
||||
{2, WIFI_EVENT_DRIVER_PNO_NETWORK_FOUND, 0, "PNO NETWORK FOUND"},
|
||||
{2, WIFI_EVENT_DRIVER_PNO_SCAN_REQUESTED, 0, "PNO SCAN_REQUESTED"},
|
||||
{1, WIFI_EVENT_DRIVER_PNO_SCAN_RESULT_FOUND, 0, "PNO SCAN RESULT FOUND"},
|
||||
{1, WIFI_EVENT_DRIVER_PNO_SCAN_COMPLETE, 0, "PNO SCAN COMPELETE"}
|
||||
};
|
||||
|
||||
static void
|
||||
debug_data_send(dhd_pub_t *dhdp, int ring_id, const void *data, const uint32 len,
|
||||
const dhd_dbg_ring_status_t ring_status)
|
||||
{
|
||||
struct net_device *ndev;
|
||||
dbg_ring_send_sub_t ring_sub_send;
|
||||
ndev = dhd_linux_get_primary_netdev(dhdp);
|
||||
if (!ndev)
|
||||
return;
|
||||
if (ring_send_sub_cb[ring_id]) {
|
||||
ring_sub_send = ring_send_sub_cb[ring_id];
|
||||
ring_sub_send(ndev, ring_id, data, len, ring_status);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
dhd_os_dbg_urgent_notifier(dhd_pub_t *dhdp, const void *data, const uint32 len)
|
||||
{
|
||||
struct net_device *ndev;
|
||||
ndev = dhd_linux_get_primary_netdev(dhdp);
|
||||
if (!ndev)
|
||||
return;
|
||||
if (urgent_noti_sub_cb) {
|
||||
urgent_noti_sub_cb(ndev, data, len, dhdp->soc_ram_length);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
dbg_ring_poll_worker(struct work_struct *work)
|
||||
{
|
||||
struct delayed_work *d_work = to_delayed_work(work);
|
||||
bool sched = TRUE;
|
||||
dhd_dbg_ring_t *ring;
|
||||
#if defined(STRICT_GCC_WARNINGS) && defined(__GNUC__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wcast-qual"
|
||||
#endif
|
||||
linux_dbgring_info_t *ring_info =
|
||||
container_of(d_work, linux_dbgring_info_t, work);
|
||||
#if defined(STRICT_GCC_WARNINGS) && defined(__GNUC__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
dhd_pub_t *dhdp = ring_info->dhdp;
|
||||
int ringid = ring_info->ring_id;
|
||||
dhd_dbg_ring_status_t ring_status;
|
||||
void *buf;
|
||||
dhd_dbg_ring_entry_t *hdr;
|
||||
uint32 buflen, rlen;
|
||||
unsigned long flags;
|
||||
|
||||
ring = &dhdp->dbg->dbg_rings[ringid];
|
||||
flags = dhd_os_spin_lock(ring->lock);
|
||||
dhd_dbg_get_ring_status(dhdp, ringid, &ring_status);
|
||||
|
||||
if (ring->wp > ring->rp) {
|
||||
buflen = ring->wp - ring->rp;
|
||||
} else if (ring->wp < ring->rp) {
|
||||
buflen = ring->ring_size - ring->rp + ring->wp;
|
||||
} else {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (buflen > ring->ring_size) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
buf = MALLOCZ(dhdp->osh, buflen);
|
||||
if (!buf) {
|
||||
DHD_ERROR(("%s failed to allocate read buf\n", __FUNCTION__));
|
||||
sched = FALSE;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
rlen = dhd_dbg_ring_pull(dhdp, ringid, buf, buflen);
|
||||
if (!ring->sched_pull) {
|
||||
ring->sched_pull = TRUE;
|
||||
}
|
||||
|
||||
hdr = (dhd_dbg_ring_entry_t *)buf;
|
||||
while (rlen > 0) {
|
||||
ring_status.read_bytes += ENTRY_LENGTH(hdr);
|
||||
/* offset fw ts to host ts */
|
||||
hdr->timestamp += ring_info->tsoffset;
|
||||
debug_data_send(dhdp, ringid, hdr, ENTRY_LENGTH(hdr),
|
||||
ring_status);
|
||||
rlen -= ENTRY_LENGTH(hdr);
|
||||
hdr = (dhd_dbg_ring_entry_t *)((char *)hdr + ENTRY_LENGTH(hdr));
|
||||
}
|
||||
MFREE(dhdp->osh, buf, buflen);
|
||||
|
||||
exit:
|
||||
if (sched) {
|
||||
/* retrigger the work at same interval */
|
||||
if ((ring_status.written_bytes == ring_status.read_bytes) &&
|
||||
(ring_info->interval)) {
|
||||
schedule_delayed_work(d_work, ring_info->interval);
|
||||
}
|
||||
}
|
||||
|
||||
dhd_os_spin_unlock(ring->lock, flags);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int
|
||||
dhd_os_dbg_register_callback(int ring_id, dbg_ring_send_sub_t callback)
|
||||
{
|
||||
if (!VALID_RING(ring_id))
|
||||
return BCME_RANGE;
|
||||
|
||||
ring_send_sub_cb[ring_id] = callback;
|
||||
return BCME_OK;
|
||||
}
|
||||
|
||||
int
|
||||
dhd_os_dbg_register_urgent_notifier(dhd_pub_t *dhdp, dbg_urgent_noti_sub_t urgent_noti_sub)
|
||||
{
|
||||
if (!dhdp || !urgent_noti_sub)
|
||||
return BCME_BADARG;
|
||||
urgent_noti_sub_cb = urgent_noti_sub;
|
||||
|
||||
return BCME_OK;
|
||||
}
|
||||
|
||||
int
|
||||
dhd_os_start_logging(dhd_pub_t *dhdp, char *ring_name, int log_level,
|
||||
int flags, int time_intval, int threshold)
|
||||
{
|
||||
int ret = BCME_OK;
|
||||
int ring_id;
|
||||
linux_dbgring_info_t *os_priv, *ring_info;
|
||||
uint32 ms;
|
||||
|
||||
ring_id = dhd_dbg_find_ring_id(dhdp, ring_name);
|
||||
if (!VALID_RING(ring_id))
|
||||
return BCME_UNSUPPORTED;
|
||||
|
||||
DHD_DBGIF(("%s , log_level : %d, time_intval : %d, threshod %d Bytes\n",
|
||||
__FUNCTION__, log_level, time_intval, threshold));
|
||||
|
||||
/* change the configuration */
|
||||
ret = dhd_dbg_set_configuration(dhdp, ring_id, log_level, flags, threshold);
|
||||
if (ret) {
|
||||
DHD_ERROR(("dhd_set_configuration is failed : %d\n", ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
os_priv = dhd_dbg_get_priv(dhdp);
|
||||
if (!os_priv)
|
||||
return BCME_ERROR;
|
||||
ring_info = &os_priv[ring_id];
|
||||
ring_info->log_level = log_level;
|
||||
if (ring_id == FW_VERBOSE_RING_ID || ring_id == FW_EVENT_RING_ID) {
|
||||
ring_info->tsoffset = local_clock();
|
||||
if (dhd_wl_ioctl_get_intiovar(dhdp, "rte_timesync", &ms, WLC_GET_VAR,
|
||||
FALSE, 0))
|
||||
DHD_ERROR(("%s rte_timesync failed\n", __FUNCTION__));
|
||||
do_div(ring_info->tsoffset, 1000000);
|
||||
ring_info->tsoffset -= ms;
|
||||
}
|
||||
if (time_intval == 0 || log_level == 0) {
|
||||
ring_info->interval = 0;
|
||||
cancel_delayed_work_sync(&ring_info->work);
|
||||
} else {
|
||||
ring_info->interval = msecs_to_jiffies(time_intval * MSEC_PER_SEC);
|
||||
cancel_delayed_work_sync(&ring_info->work);
|
||||
schedule_delayed_work(&ring_info->work, ring_info->interval);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
dhd_os_reset_logging(dhd_pub_t *dhdp)
|
||||
{
|
||||
int ret = BCME_OK;
|
||||
int ring_id;
|
||||
linux_dbgring_info_t *os_priv, *ring_info;
|
||||
|
||||
os_priv = dhd_dbg_get_priv(dhdp);
|
||||
if (!os_priv)
|
||||
return BCME_ERROR;
|
||||
|
||||
/* Stop all rings */
|
||||
for (ring_id = DEBUG_RING_ID_INVALID + 1; ring_id < DEBUG_RING_ID_MAX; ring_id++) {
|
||||
DHD_DBGIF(("%s: Stop ring buffer %d\n", __FUNCTION__, ring_id));
|
||||
|
||||
ring_info = &os_priv[ring_id];
|
||||
/* cancel any pending work */
|
||||
cancel_delayed_work_sync(&ring_info->work);
|
||||
/* log level zero makes stop logging on that ring */
|
||||
ring_info->log_level = 0;
|
||||
ring_info->interval = 0;
|
||||
/* change the configuration */
|
||||
ret = dhd_dbg_set_configuration(dhdp, ring_id, 0, 0, 0);
|
||||
if (ret) {
|
||||
DHD_ERROR(("dhd_set_configuration is failed : %d\n", ret));
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#define SUPPRESS_LOG_LEVEL 1
|
||||
int
|
||||
dhd_os_suppress_logging(dhd_pub_t *dhdp, bool suppress)
|
||||
{
|
||||
int ret = BCME_OK;
|
||||
int max_log_level;
|
||||
int enable = (suppress) ? 0 : 1;
|
||||
linux_dbgring_info_t *os_priv;
|
||||
|
||||
os_priv = dhd_dbg_get_priv(dhdp);
|
||||
if (!os_priv)
|
||||
return BCME_ERROR;
|
||||
|
||||
max_log_level = MAX(os_priv[FW_VERBOSE_RING_ID].log_level,
|
||||
os_priv[FW_EVENT_RING_ID].log_level);
|
||||
if (max_log_level == SUPPRESS_LOG_LEVEL) {
|
||||
/* suppress the logging in FW not to wake up host while device in suspend mode */
|
||||
ret = dhd_iovar(dhdp, 0, "logtrace", (char *)&enable, sizeof(enable), NULL, 0,
|
||||
TRUE);
|
||||
if (ret < 0 && (ret != BCME_UNSUPPORTED)) {
|
||||
DHD_ERROR(("logtrace is failed : %d\n", ret));
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
dhd_os_get_ring_status(dhd_pub_t *dhdp, int ring_id, dhd_dbg_ring_status_t *dbg_ring_status)
|
||||
{
|
||||
return dhd_dbg_get_ring_status(dhdp, ring_id, dbg_ring_status);
|
||||
}
|
||||
|
||||
int
|
||||
dhd_os_trigger_get_ring_data(dhd_pub_t *dhdp, char *ring_name)
|
||||
{
|
||||
int ret = BCME_OK;
|
||||
int ring_id;
|
||||
linux_dbgring_info_t *os_priv, *ring_info;
|
||||
ring_id = dhd_dbg_find_ring_id(dhdp, ring_name);
|
||||
if (!VALID_RING(ring_id))
|
||||
return BCME_UNSUPPORTED;
|
||||
os_priv = dhd_dbg_get_priv(dhdp);
|
||||
if (os_priv) {
|
||||
ring_info = &os_priv[ring_id];
|
||||
if (ring_info->interval) {
|
||||
cancel_delayed_work_sync(&ring_info->work);
|
||||
}
|
||||
schedule_delayed_work(&ring_info->work, 0);
|
||||
} else {
|
||||
DHD_ERROR(("%s : os_priv is NULL\n", __FUNCTION__));
|
||||
ret = BCME_ERROR;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
dhd_os_push_push_ring_data(dhd_pub_t *dhdp, int ring_id, void *data, int32 data_len)
|
||||
{
|
||||
int ret = BCME_OK, i;
|
||||
dhd_dbg_ring_entry_t msg_hdr;
|
||||
log_conn_event_t *event_data = (log_conn_event_t *)data;
|
||||
linux_dbgring_info_t *os_priv, *ring_info = NULL;
|
||||
|
||||
if (!VALID_RING(ring_id))
|
||||
return BCME_UNSUPPORTED;
|
||||
os_priv = dhd_dbg_get_priv(dhdp);
|
||||
|
||||
if (os_priv) {
|
||||
ring_info = &os_priv[ring_id];
|
||||
} else
|
||||
return BCME_NORESOURCE;
|
||||
|
||||
memset(&msg_hdr, 0, sizeof(dhd_dbg_ring_entry_t));
|
||||
|
||||
if (ring_id == DHD_EVENT_RING_ID) {
|
||||
msg_hdr.type = DBG_RING_ENTRY_EVENT_TYPE;
|
||||
msg_hdr.flags |= DBG_RING_ENTRY_FLAGS_HAS_TIMESTAMP;
|
||||
msg_hdr.flags |= DBG_RING_ENTRY_FLAGS_HAS_BINARY;
|
||||
msg_hdr.timestamp = local_clock();
|
||||
/* convert to ms */
|
||||
do_div(msg_hdr.timestamp, 1000000);
|
||||
msg_hdr.len = data_len;
|
||||
/* filter the event for higher log level with current log level */
|
||||
for (i = 0; i < ARRAYSIZE(dhd_event_map); i++) {
|
||||
if ((dhd_event_map[i].tag == event_data->event) &&
|
||||
dhd_event_map[i].log_level > ring_info->log_level) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
ret = dhd_dbg_ring_push(dhdp, ring_id, &msg_hdr, event_data);
|
||||
if (ret) {
|
||||
DHD_ERROR(("%s : failed to push data into the ring (%d) with ret(%d)\n",
|
||||
__FUNCTION__, ring_id, ret));
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef DBG_PKT_MON
|
||||
int
|
||||
dhd_os_dbg_attach_pkt_monitor(dhd_pub_t *dhdp)
|
||||
{
|
||||
return dhd_dbg_attach_pkt_monitor(dhdp, dhd_os_dbg_monitor_tx_pkts,
|
||||
dhd_os_dbg_monitor_tx_status, dhd_os_dbg_monitor_rx_pkts);
|
||||
}
|
||||
|
||||
int
|
||||
dhd_os_dbg_start_pkt_monitor(dhd_pub_t *dhdp)
|
||||
{
|
||||
return dhd_dbg_start_pkt_monitor(dhdp);
|
||||
}
|
||||
|
||||
int
|
||||
dhd_os_dbg_monitor_tx_pkts(dhd_pub_t *dhdp, void *pkt, uint32 pktid)
|
||||
{
|
||||
return dhd_dbg_monitor_tx_pkts(dhdp, pkt, pktid);
|
||||
}
|
||||
|
||||
int
|
||||
dhd_os_dbg_monitor_tx_status(dhd_pub_t *dhdp, void *pkt, uint32 pktid,
|
||||
uint16 status)
|
||||
{
|
||||
return dhd_dbg_monitor_tx_status(dhdp, pkt, pktid, status);
|
||||
}
|
||||
|
||||
int
|
||||
dhd_os_dbg_monitor_rx_pkts(dhd_pub_t *dhdp, void *pkt)
|
||||
{
|
||||
return dhd_dbg_monitor_rx_pkts(dhdp, pkt);
|
||||
}
|
||||
|
||||
int
|
||||
dhd_os_dbg_stop_pkt_monitor(dhd_pub_t *dhdp)
|
||||
{
|
||||
return dhd_dbg_stop_pkt_monitor(dhdp);
|
||||
}
|
||||
|
||||
int
|
||||
dhd_os_dbg_monitor_get_tx_pkts(dhd_pub_t *dhdp, void __user *user_buf,
|
||||
uint16 req_count, uint16 *resp_count)
|
||||
{
|
||||
return dhd_dbg_monitor_get_tx_pkts(dhdp, user_buf, req_count, resp_count);
|
||||
}
|
||||
|
||||
int
|
||||
dhd_os_dbg_monitor_get_rx_pkts(dhd_pub_t *dhdp, void __user *user_buf,
|
||||
uint16 req_count, uint16 *resp_count)
|
||||
{
|
||||
return dhd_dbg_monitor_get_rx_pkts(dhdp, user_buf, req_count, resp_count);
|
||||
}
|
||||
|
||||
int
|
||||
dhd_os_dbg_detach_pkt_monitor(dhd_pub_t *dhdp)
|
||||
{
|
||||
return dhd_dbg_detach_pkt_monitor(dhdp);
|
||||
}
|
||||
#endif /* DBG_PKT_MON */
|
||||
|
||||
int
|
||||
dhd_os_dbg_get_feature(dhd_pub_t *dhdp, int32 *features)
|
||||
{
|
||||
int ret = BCME_OK;
|
||||
*features = 0;
|
||||
*features |= DBG_MEMORY_DUMP_SUPPORTED;
|
||||
if (FW_SUPPORTED(dhdp, logtrace)) {
|
||||
*features |= DBG_CONNECT_EVENT_SUPPORTED;
|
||||
*features |= DBG_VERBOSE_LOG_SUPPORTED;
|
||||
}
|
||||
if (FW_SUPPORTED(dhdp, hchk)) {
|
||||
*features |= DBG_HEALTH_CHECK_SUPPORTED;
|
||||
}
|
||||
#ifdef DBG_PKT_MON
|
||||
if (FW_SUPPORTED(dhdp, d11status)) {
|
||||
*features |= DBG_PACKET_FATE_SUPPORTED;
|
||||
}
|
||||
#endif /* DBG_PKT_MON */
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
dhd_os_dbg_pullreq(void *os_priv, int ring_id)
|
||||
{
|
||||
linux_dbgring_info_t *ring_info;
|
||||
|
||||
ring_info = &((linux_dbgring_info_t *)os_priv)[ring_id];
|
||||
cancel_delayed_work(&ring_info->work);
|
||||
schedule_delayed_work(&ring_info->work, 0);
|
||||
}
|
||||
|
||||
int
|
||||
dhd_os_dbg_attach(dhd_pub_t *dhdp)
|
||||
{
|
||||
int ret = BCME_OK;
|
||||
linux_dbgring_info_t *os_priv, *ring_info;
|
||||
int ring_id;
|
||||
|
||||
/* os_dbg data */
|
||||
os_priv = MALLOCZ(dhdp->osh, sizeof(*os_priv) * DEBUG_RING_ID_MAX);
|
||||
if (!os_priv)
|
||||
return BCME_NOMEM;
|
||||
|
||||
for (ring_id = DEBUG_RING_ID_INVALID + 1; ring_id < DEBUG_RING_ID_MAX;
|
||||
ring_id++) {
|
||||
ring_info = &os_priv[ring_id];
|
||||
INIT_DELAYED_WORK(&ring_info->work, dbg_ring_poll_worker);
|
||||
ring_info->dhdp = dhdp;
|
||||
ring_info->ring_id = ring_id;
|
||||
}
|
||||
|
||||
ret = dhd_dbg_attach(dhdp, dhd_os_dbg_pullreq, dhd_os_dbg_urgent_notifier, os_priv);
|
||||
if (ret)
|
||||
MFREE(dhdp->osh, os_priv, sizeof(*os_priv) * DEBUG_RING_ID_MAX);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
dhd_os_dbg_detach(dhd_pub_t *dhdp)
|
||||
{
|
||||
linux_dbgring_info_t *os_priv, *ring_info;
|
||||
int ring_id;
|
||||
/* free os_dbg data */
|
||||
os_priv = dhd_dbg_get_priv(dhdp);
|
||||
if (!os_priv)
|
||||
return;
|
||||
/* abort pending any job */
|
||||
for (ring_id = DEBUG_RING_ID_INVALID + 1; ring_id < DEBUG_RING_ID_MAX; ring_id++) {
|
||||
ring_info = &os_priv[ring_id];
|
||||
if (ring_info->interval) {
|
||||
ring_info->interval = 0;
|
||||
cancel_delayed_work_sync(&ring_info->work);
|
||||
}
|
||||
}
|
||||
MFREE(dhdp->osh, os_priv, sizeof(*os_priv) * DEBUG_RING_ID_MAX);
|
||||
|
||||
return dhd_dbg_detach(dhdp);
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,275 @@
|
|||
/*
|
||||
* @file Header file describing the flow rings DHD interfaces.
|
||||
*
|
||||
* Flow rings are transmit traffic (=propagating towards antenna) related entities.
|
||||
*
|
||||
* Provides type definitions and function prototypes used to create, delete and manage flow rings at
|
||||
* high level.
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: dhd_flowring.h 672438 2016-11-28 12:35:24Z $
|
||||
*/
|
||||
|
||||
|
||||
/****************
|
||||
* Common types *
|
||||
*/
|
||||
|
||||
#ifndef _dhd_flowrings_h_
|
||||
#define _dhd_flowrings_h_
|
||||
|
||||
/* Max pkts held in a flow ring's backup queue */
|
||||
#define FLOW_RING_QUEUE_THRESHOLD (2048)
|
||||
|
||||
/* Number of H2D common rings */
|
||||
#define FLOW_RING_COMMON BCMPCIE_H2D_COMMON_MSGRINGS
|
||||
|
||||
#define FLOWID_INVALID (ID16_INVALID)
|
||||
#define FLOWID_RESERVED (FLOW_RING_COMMON)
|
||||
|
||||
#define FLOW_RING_STATUS_OPEN 0
|
||||
#define FLOW_RING_STATUS_CREATE_PENDING 1
|
||||
#define FLOW_RING_STATUS_CLOSED 2
|
||||
#define FLOW_RING_STATUS_DELETE_PENDING 3
|
||||
#define FLOW_RING_STATUS_FLUSH_PENDING 4
|
||||
|
||||
#ifdef IDLE_TX_FLOW_MGMT
|
||||
#define FLOW_RING_STATUS_SUSPENDED 5
|
||||
#define FLOW_RING_STATUS_RESUME_PENDING 6
|
||||
#endif /* IDLE_TX_FLOW_MGMT */
|
||||
#define FLOW_RING_STATUS_STA_FREEING 7
|
||||
|
||||
#ifdef DHD_EFI
|
||||
#define DHD_FLOWRING_RX_BUFPOST_PKTSZ 1600
|
||||
#else
|
||||
#define DHD_FLOWRING_RX_BUFPOST_PKTSZ 2048
|
||||
#endif
|
||||
|
||||
#define DHD_FLOW_PRIO_AC_MAP 0
|
||||
#define DHD_FLOW_PRIO_TID_MAP 1
|
||||
/* Flow ring prority map for lossless roaming */
|
||||
#define DHD_FLOW_PRIO_LLR_MAP 2
|
||||
|
||||
/* Hashing a MacAddress for lkup into a per interface flow hash table */
|
||||
#define DHD_FLOWRING_HASH_SIZE 256
|
||||
#define DHD_FLOWRING_HASHINDEX(ea, prio) \
|
||||
((((uint8 *)(ea))[3] ^ ((uint8 *)(ea))[4] ^ ((uint8 *)(ea))[5] ^ ((uint8)(prio))) \
|
||||
% DHD_FLOWRING_HASH_SIZE)
|
||||
|
||||
#define DHD_IF_ROLE(pub, idx) (((if_flow_lkup_t *)(pub)->if_flow_lkup)[idx].role)
|
||||
#define DHD_IF_ROLE_AP(pub, idx) (DHD_IF_ROLE(pub, idx) == WLC_E_IF_ROLE_AP)
|
||||
#define DHD_IF_ROLE_STA(pub, idx) (DHD_IF_ROLE(pub, idx) == WLC_E_IF_ROLE_STA)
|
||||
#define DHD_IF_ROLE_P2PGO(pub, idx) (DHD_IF_ROLE(pub, idx) == WLC_E_IF_ROLE_P2P_GO)
|
||||
#define DHD_IF_ROLE_WDS(pub, idx) (DHD_IF_ROLE(pub, idx) == WLC_E_IF_ROLE_WDS)
|
||||
#define DHD_FLOW_RING(dhdp, flowid) \
|
||||
(flow_ring_node_t *)&(((flow_ring_node_t *)((dhdp)->flow_ring_table))[flowid])
|
||||
|
||||
struct flow_queue;
|
||||
|
||||
/* Flow Ring Queue Enqueue overflow callback */
|
||||
typedef int (*flow_queue_cb_t)(struct flow_queue * queue, void * pkt);
|
||||
|
||||
/**
|
||||
* Each flow ring has an associated (tx flow controlled) queue. 802.3 packets are transferred
|
||||
* between queue and ring. A packet from the host stack is first added to the queue, and in a later
|
||||
* stage transferred to the flow ring. Packets in the queue are dhd owned, whereas packets in the
|
||||
* flow ring are device owned.
|
||||
*/
|
||||
typedef struct flow_queue {
|
||||
dll_t list; /* manage a flowring queue in a double linked list */
|
||||
void * head; /* first packet in the queue */
|
||||
void * tail; /* last packet in the queue */
|
||||
uint16 len; /* number of packets in the queue */
|
||||
uint16 max; /* maximum or min budget (used in cumm) */
|
||||
uint32 threshold; /* parent's cummulative length threshold */
|
||||
void * clen_ptr; /* parent's cummulative length counter */
|
||||
uint32 failures; /* enqueue failures due to queue overflow */
|
||||
flow_queue_cb_t cb; /* callback invoked on threshold crossing */
|
||||
uint32 l2threshold; /* grandparent's (level 2) cummulative length threshold */
|
||||
void * l2clen_ptr; /* grandparent's (level 2) cummulative length counter */
|
||||
} flow_queue_t;
|
||||
|
||||
#define DHD_FLOW_QUEUE_LEN(queue) ((int)(queue)->len)
|
||||
#define DHD_FLOW_QUEUE_MAX(queue) ((int)(queue)->max)
|
||||
#define DHD_FLOW_QUEUE_THRESHOLD(queue) ((int)(queue)->threshold)
|
||||
#define DHD_FLOW_QUEUE_L2THRESHOLD(queue) ((int)(queue)->l2threshold)
|
||||
#define DHD_FLOW_QUEUE_EMPTY(queue) ((queue)->len == 0)
|
||||
#define DHD_FLOW_QUEUE_FAILURES(queue) ((queue)->failures)
|
||||
|
||||
#define DHD_FLOW_QUEUE_AVAIL(queue) ((int)((queue)->max - (queue)->len))
|
||||
#define DHD_FLOW_QUEUE_FULL(queue) ((queue)->len >= (queue)->max)
|
||||
|
||||
#define DHD_FLOW_QUEUE_OVFL(queue, budget) \
|
||||
(((queue)->len) > budget)
|
||||
|
||||
#define DHD_FLOW_QUEUE_SET_MAX(queue, budget) \
|
||||
((queue)->max) = ((budget) - 1)
|
||||
|
||||
/* Queue's cummulative threshold. */
|
||||
#define DHD_FLOW_QUEUE_SET_THRESHOLD(queue, cumm_threshold) \
|
||||
((queue)->threshold) = ((cumm_threshold) - 1)
|
||||
|
||||
/* Queue's cummulative length object accessor. */
|
||||
#define DHD_FLOW_QUEUE_CLEN_PTR(queue) ((queue)->clen_ptr)
|
||||
|
||||
/* Set a queue's cumm_len point to a parent's cumm_ctr_t cummulative length */
|
||||
#define DHD_FLOW_QUEUE_SET_CLEN(queue, parent_clen_ptr) \
|
||||
((queue)->clen_ptr) = (void *)(parent_clen_ptr)
|
||||
|
||||
/* Queue's level 2 cummulative threshold. */
|
||||
#define DHD_FLOW_QUEUE_SET_L2THRESHOLD(queue, l2cumm_threshold) \
|
||||
((queue)->l2threshold) = ((l2cumm_threshold) - 1)
|
||||
|
||||
/* Queue's level 2 cummulative length object accessor. */
|
||||
#define DHD_FLOW_QUEUE_L2CLEN_PTR(queue) ((queue)->l2clen_ptr)
|
||||
|
||||
/* Set a queue's level 2 cumm_len point to a grandparent's cumm_ctr_t cummulative length */
|
||||
#define DHD_FLOW_QUEUE_SET_L2CLEN(queue, grandparent_clen_ptr) \
|
||||
((queue)->l2clen_ptr) = (void *)(grandparent_clen_ptr)
|
||||
|
||||
/* see wlfc_proto.h for tx status details */
|
||||
#define DHD_FLOWRING_MAXSTATUS_MSGS 5
|
||||
#define DHD_FLOWRING_TXSTATUS_CNT_UPDATE(bus, flowid, txstatus)
|
||||
|
||||
/* Pkttag not compatible with PROP_TXSTATUS or WLFC */
|
||||
typedef struct dhd_pkttag_fr {
|
||||
uint16 flowid;
|
||||
uint16 ifid;
|
||||
int dataoff;
|
||||
dmaaddr_t physaddr;
|
||||
uint32 pa_len;
|
||||
} dhd_pkttag_fr_t;
|
||||
|
||||
#define DHD_PKTTAG_SET_IFID(tag, idx) ((tag)->ifid = (uint16)(idx))
|
||||
#define DHD_PKTTAG_SET_PA(tag, pa) ((tag)->physaddr = (pa))
|
||||
#define DHD_PKTTAG_SET_PA_LEN(tag, palen) ((tag)->pa_len = (palen))
|
||||
#define DHD_PKTTAG_IFID(tag) ((tag)->ifid)
|
||||
#define DHD_PKTTAG_PA(tag) ((tag)->physaddr)
|
||||
#define DHD_PKTTAG_PA_LEN(tag) ((tag)->pa_len)
|
||||
|
||||
|
||||
/** each flow ring is dedicated to a tid/sa/da combination */
|
||||
typedef struct flow_info {
|
||||
uint8 tid;
|
||||
uint8 ifindex;
|
||||
char sa[ETHER_ADDR_LEN];
|
||||
char da[ETHER_ADDR_LEN];
|
||||
} flow_info_t;
|
||||
|
||||
/** a flow ring is used for outbound (towards antenna) 802.3 packets */
|
||||
typedef struct flow_ring_node {
|
||||
dll_t list; /* manage a constructed flowring in a dll, must be at first place */
|
||||
flow_queue_t queue; /* queues packets before they enter the flow ring, flow control */
|
||||
bool active;
|
||||
uint8 status;
|
||||
/*
|
||||
* flowid: unique ID of a flow ring, which can either be unicast or broadcast/multicast. For
|
||||
* unicast flow rings, the flow id accelerates ARM 802.3->802.11 header translation.
|
||||
*/
|
||||
uint16 flowid;
|
||||
flow_info_t flow_info;
|
||||
void *prot_info;
|
||||
void *lock; /* lock for flowring access protection */
|
||||
|
||||
#ifdef IDLE_TX_FLOW_MGMT
|
||||
uint64 last_active_ts; /* contains last active timestamp */
|
||||
#endif /* IDLE_TX_FLOW_MGMT */
|
||||
#ifdef DEVICE_TX_STUCK_DETECT
|
||||
/* Time stamp(msec) when last time a Tx packet completion is received on this flow ring */
|
||||
uint32 tx_cmpl;
|
||||
/*
|
||||
* Holds the tx_cmpl which was read during the previous
|
||||
* iteration of the stuck detection algo
|
||||
*/
|
||||
uint32 tx_cmpl_prev;
|
||||
/* counter to decide if this particlur flow is stuck or not */
|
||||
uint32 stuck_count;
|
||||
#endif /* DEVICE_TX_STUCK_DETECT */
|
||||
|
||||
} flow_ring_node_t;
|
||||
|
||||
typedef flow_ring_node_t flow_ring_table_t;
|
||||
|
||||
typedef struct flow_hash_info {
|
||||
uint16 flowid;
|
||||
flow_info_t flow_info;
|
||||
struct flow_hash_info *next;
|
||||
} flow_hash_info_t;
|
||||
|
||||
typedef struct if_flow_lkup {
|
||||
bool status;
|
||||
uint8 role; /* Interface role: STA/AP */
|
||||
flow_hash_info_t *fl_hash[DHD_FLOWRING_HASH_SIZE]; /* Lkup Hash table */
|
||||
} if_flow_lkup_t;
|
||||
|
||||
static INLINE flow_ring_node_t *
|
||||
dhd_constlist_to_flowring(dll_t *item)
|
||||
{
|
||||
return ((flow_ring_node_t *)item);
|
||||
}
|
||||
|
||||
/* Exported API */
|
||||
|
||||
/* Flow ring's queue management functions */
|
||||
extern flow_ring_node_t * dhd_flow_ring_node(dhd_pub_t *dhdp, uint16 flowid);
|
||||
extern flow_queue_t * dhd_flow_queue(dhd_pub_t *dhdp, uint16 flowid);
|
||||
|
||||
extern void dhd_flow_queue_init(dhd_pub_t *dhdp, flow_queue_t *queue, int max);
|
||||
extern void dhd_flow_queue_reinit(dhd_pub_t *dhdp, flow_queue_t *queue, int max);
|
||||
extern void dhd_flow_queue_register(flow_queue_t *queue, flow_queue_cb_t cb);
|
||||
extern int dhd_flow_queue_enqueue(dhd_pub_t *dhdp, flow_queue_t *queue, void *pkt);
|
||||
extern void * dhd_flow_queue_dequeue(dhd_pub_t *dhdp, flow_queue_t *queue);
|
||||
extern void dhd_flow_queue_reinsert(dhd_pub_t *dhdp, flow_queue_t *queue, void *pkt);
|
||||
|
||||
extern void dhd_flow_ring_config_thresholds(dhd_pub_t *dhdp, uint16 flowid,
|
||||
int queue_budget, int cumm_threshold, void *cumm_ctr,
|
||||
int l2cumm_threshold, void *l2cumm_ctr);
|
||||
extern int dhd_flow_rings_init(dhd_pub_t *dhdp, uint32 num_flow_rings);
|
||||
|
||||
extern void dhd_flow_rings_deinit(dhd_pub_t *dhdp);
|
||||
|
||||
extern int dhd_flowid_update(dhd_pub_t *dhdp, uint8 ifindex, uint8 prio,
|
||||
void *pktbuf);
|
||||
|
||||
extern void dhd_flowid_free(dhd_pub_t *dhdp, uint8 ifindex, uint16 flowid);
|
||||
|
||||
extern void dhd_flow_rings_delete(dhd_pub_t *dhdp, uint8 ifindex);
|
||||
extern void dhd_flow_rings_flush(dhd_pub_t *dhdp, uint8 ifindex);
|
||||
|
||||
extern void dhd_flow_rings_delete_for_peer(dhd_pub_t *dhdp, uint8 ifindex,
|
||||
char *addr);
|
||||
|
||||
/* Handle Interface ADD, DEL operations */
|
||||
extern void dhd_update_interface_flow_info(dhd_pub_t *dhdp, uint8 ifindex,
|
||||
uint8 op, uint8 role);
|
||||
|
||||
/* Handle a STA interface link status update */
|
||||
extern int dhd_update_interface_link_status(dhd_pub_t *dhdp, uint8 ifindex,
|
||||
uint8 status);
|
||||
extern int dhd_flow_prio_map(dhd_pub_t *dhd, uint8 *map, bool set);
|
||||
extern int dhd_update_flow_prio_map(dhd_pub_t *dhdp, uint8 map);
|
||||
|
||||
extern uint8 dhd_flow_rings_ifindex2role(dhd_pub_t *dhdp, uint8 ifindex);
|
||||
#endif /* _dhd_flowrings_h_ */
|
|
@ -0,0 +1,337 @@
|
|||
|
||||
#include <osl.h>
|
||||
#include <dhd_linux.h>
|
||||
#include <linux/gpio.h>
|
||||
|
||||
#ifdef CUSTOMER_HW_PLATFORM
|
||||
/* #include <plat/sdhci.h> */
|
||||
extern void wifi_card_detect(bool on); /* DEFINED IN IMX SDHCI DRIVER */
|
||||
#endif /* CUSTOMER_HW_PLATFORM */
|
||||
|
||||
#if defined(BUS_POWER_RESTORE) && defined(BCMSDIO)
|
||||
#include <linux/mmc/core.h>
|
||||
#include <linux/mmc/card.h>
|
||||
#include <linux/mmc/host.h>
|
||||
#include <linux/mmc/sdio_func.h>
|
||||
#endif /* defined(BUS_POWER_RESTORE) && defined(BCMSDIO) */
|
||||
|
||||
#ifdef CONFIG_DHD_USE_STATIC_BUF
|
||||
extern void *dhd_wlan_mem_prealloc(int section, unsigned long size);
|
||||
#endif /* CONFIG_DHD_USE_STATIC_BUF */
|
||||
|
||||
static int gpio_wl_reg_on = 137; // WL_REG_ON is input pin of WLAN module
|
||||
#ifdef CUSTOMER_OOB
|
||||
static int gpio_wl_host_wake = 8; // WL_HOST_WAKE is output pin of WLAN module
|
||||
#endif
|
||||
|
||||
static int
|
||||
dhd_wlan_set_power(int on
|
||||
#ifdef BUS_POWER_RESTORE
|
||||
, wifi_adapter_info_t *adapter
|
||||
#endif /* BUS_POWER_RESTORE */
|
||||
)
|
||||
{
|
||||
int err = 0;
|
||||
gpio_wl_reg_on = 137;
|
||||
gpio_wl_host_wake = 8;
|
||||
|
||||
if (on) {
|
||||
printf("======== PULL WL_REG_ON(%d) HIGH! ========\n", gpio_wl_reg_on);
|
||||
if (gpio_wl_reg_on >= 0) {
|
||||
err = gpio_direction_output(gpio_wl_reg_on, 1);
|
||||
if (err) {
|
||||
printf("%s: WL_REG_ON didn't output high\n", __FUNCTION__);
|
||||
return -EIO;
|
||||
}
|
||||
}
|
||||
#if defined(BUS_POWER_RESTORE)
|
||||
#if defined(BCMSDIO) && (LINUX_VERSION_CODE < KERNEL_VERSION(4, 19, 0))
|
||||
if (adapter->sdio_func && adapter->sdio_func->card && adapter->sdio_func->card->host) {
|
||||
mdelay(100);
|
||||
printf("======== mmc_power_restore_host! ========\n");
|
||||
mmc_power_restore_host(adapter->sdio_func->card->host);
|
||||
}
|
||||
#elif defined(BCMPCIE)
|
||||
if (adapter->pci_dev) {
|
||||
mdelay(100);
|
||||
printf("======== pci_set_power_state PCI_D0! ========\n");
|
||||
pci_set_power_state(adapter->pci_dev, PCI_D0);
|
||||
if (adapter->pci_saved_state)
|
||||
pci_load_and_free_saved_state(adapter->pci_dev, &adapter->pci_saved_state);
|
||||
pci_restore_state(adapter->pci_dev);
|
||||
err = pci_enable_device(adapter->pci_dev);
|
||||
if (err < 0)
|
||||
printf("%s: PCI enable device failed", __FUNCTION__);
|
||||
pci_set_master(adapter->pci_dev);
|
||||
}
|
||||
#endif /* BCMPCIE */
|
||||
#endif /* BUS_POWER_RESTORE */
|
||||
/* Lets customer power to get stable */
|
||||
mdelay(100);
|
||||
} else {
|
||||
#if defined(BUS_POWER_RESTORE)
|
||||
#if defined(BCMSDIO) && (LINUX_VERSION_CODE < KERNEL_VERSION(4, 19, 0))
|
||||
if (adapter->sdio_func && adapter->sdio_func->card && adapter->sdio_func->card->host) {
|
||||
printf("======== mmc_power_save_host! ========\n");
|
||||
mmc_power_save_host(adapter->sdio_func->card->host);
|
||||
}
|
||||
#elif defined(BCMPCIE)
|
||||
if (adapter->pci_dev) {
|
||||
printf("======== pci_set_power_state PCI_D3hot! ========\n");
|
||||
pci_save_state(adapter->pci_dev);
|
||||
adapter->pci_saved_state = pci_store_saved_state(adapter->pci_dev);
|
||||
if (pci_is_enabled(adapter->pci_dev))
|
||||
pci_disable_device(adapter->pci_dev);
|
||||
pci_set_power_state(adapter->pci_dev, PCI_D3hot);
|
||||
}
|
||||
#endif /* BCMPCIE */
|
||||
#endif /* BUS_POWER_RESTORE */
|
||||
printf("======== PULL WL_REG_ON(%d) LOW! ========\n", gpio_wl_reg_on);
|
||||
if (gpio_wl_reg_on >= 0) {
|
||||
err = gpio_direction_output(gpio_wl_reg_on, 0);
|
||||
if (err) {
|
||||
printf("%s: WL_REG_ON didn't output low\n", __FUNCTION__);
|
||||
return -EIO;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static int dhd_wlan_set_reset(int onoff)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dhd_wlan_set_carddetect(int present)
|
||||
{
|
||||
int err = 0;
|
||||
|
||||
#if !defined(BUS_POWER_RESTORE)
|
||||
if (present) {
|
||||
#if defined(BCMSDIO)
|
||||
printf("======== Card detection to detect SDIO card! ========\n");
|
||||
#ifdef CUSTOMER_HW_PLATFORM
|
||||
printk("[---- SBA ----] Calling wifi_card_detect(1) ..\n");
|
||||
wifi_card_detect(1);
|
||||
#endif /* CUSTOMER_HW_PLATFORM */
|
||||
#elif defined(BCMPCIE)
|
||||
printf("======== Card detection to detect PCIE card! ========\n");
|
||||
#endif
|
||||
} else {
|
||||
#if defined(BCMSDIO)
|
||||
printf("======== Card detection to remove SDIO card! ========\n");
|
||||
#ifdef CUSTOMER_HW_PLATFORM
|
||||
printk("[---- SBA ----] Calling wifi_card_detect(0) ..\n");
|
||||
wifi_card_detect(0);
|
||||
#endif /* CUSTOMER_HW_PLATFORM */
|
||||
#elif defined(BCMPCIE)
|
||||
printf("======== Card detection to remove PCIE card! ========\n");
|
||||
#endif
|
||||
}
|
||||
#endif /* BUS_POWER_RESTORE */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dhd_wlan_get_mac_addr(unsigned char *buf)
|
||||
{
|
||||
int err = 0;
|
||||
|
||||
printf("======== %s ========\n", __FUNCTION__);
|
||||
#ifdef EXAMPLE_GET_MAC
|
||||
/* EXAMPLE code */
|
||||
{
|
||||
struct ether_addr ea_example = {{0x00, 0x11, 0x22, 0x33, 0x44, 0xFF}};
|
||||
bcopy((char *)&ea_example, buf, sizeof(struct ether_addr));
|
||||
}
|
||||
#endif /* EXAMPLE_GET_MAC */
|
||||
#ifdef EXAMPLE_GET_MAC_VER2
|
||||
/* EXAMPLE code */
|
||||
{
|
||||
char macpad[56]= {
|
||||
0x00,0xaa,0x9c,0x84,0xc7,0xbc,0x9b,0xf6,
|
||||
0x02,0x33,0xa9,0x4d,0x5c,0xb4,0x0a,0x5d,
|
||||
0xa8,0xef,0xb0,0xcf,0x8e,0xbf,0x24,0x8a,
|
||||
0x87,0x0f,0x6f,0x0d,0xeb,0x83,0x6a,0x70,
|
||||
0x4a,0xeb,0xf6,0xe6,0x3c,0xe7,0x5f,0xfc,
|
||||
0x0e,0xa7,0xb3,0x0f,0x00,0xe4,0x4a,0xaf,
|
||||
0x87,0x08,0x16,0x6d,0x3a,0xe3,0xc7,0x80};
|
||||
bcopy(macpad, buf+6, sizeof(macpad));
|
||||
}
|
||||
#endif /* EXAMPLE_GET_MAC_VER2 */
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static struct cntry_locales_custom brcm_wlan_translate_custom_table[] = {
|
||||
/* Table should be filled out based on custom platform regulatory requirement */
|
||||
#ifdef EXAMPLE_TABLE
|
||||
{"", "XT", 49}, /* Universal if Country code is unknown or empty */
|
||||
{"US", "US", 0},
|
||||
#endif /* EXMAPLE_TABLE */
|
||||
};
|
||||
|
||||
#ifdef CUSTOM_FORCE_NODFS_FLAG
|
||||
struct cntry_locales_custom brcm_wlan_translate_nodfs_table[] = {
|
||||
#ifdef EXAMPLE_TABLE
|
||||
{"", "XT", 50}, /* Universal if Country code is unknown or empty */
|
||||
{"US", "US", 0},
|
||||
#endif /* EXMAPLE_TABLE */
|
||||
};
|
||||
#endif
|
||||
|
||||
static void *dhd_wlan_get_country_code(char *ccode
|
||||
#ifdef CUSTOM_FORCE_NODFS_FLAG
|
||||
, u32 flags
|
||||
#endif
|
||||
)
|
||||
{
|
||||
struct cntry_locales_custom *locales;
|
||||
int size;
|
||||
int i;
|
||||
|
||||
if (!ccode)
|
||||
return NULL;
|
||||
|
||||
#ifdef CUSTOM_FORCE_NODFS_FLAG
|
||||
if (flags & WLAN_PLAT_NODFS_FLAG) {
|
||||
locales = brcm_wlan_translate_nodfs_table;
|
||||
size = ARRAY_SIZE(brcm_wlan_translate_nodfs_table);
|
||||
} else {
|
||||
#endif
|
||||
locales = brcm_wlan_translate_custom_table;
|
||||
size = ARRAY_SIZE(brcm_wlan_translate_custom_table);
|
||||
#ifdef CUSTOM_FORCE_NODFS_FLAG
|
||||
}
|
||||
#endif
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
if (strcmp(ccode, locales[i].iso_abbrev) == 0)
|
||||
return &locales[i];
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct resource dhd_wlan_resources[] = {
|
||||
[0] = {
|
||||
.name = "bcmdhd_wlan_irq",
|
||||
.start = 0, /* Dummy */
|
||||
.end = 0, /* Dummy */
|
||||
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_SHAREABLE
|
||||
| IORESOURCE_IRQ_HIGHLEVEL, /* Dummy */
|
||||
},
|
||||
};
|
||||
|
||||
struct wifi_platform_data dhd_wlan_control = {
|
||||
.set_power = dhd_wlan_set_power,
|
||||
.set_reset = dhd_wlan_set_reset,
|
||||
.set_carddetect = dhd_wlan_set_carddetect,
|
||||
.get_mac_addr = dhd_wlan_get_mac_addr,
|
||||
#ifdef CONFIG_DHD_USE_STATIC_BUF
|
||||
.mem_prealloc = dhd_wlan_mem_prealloc,
|
||||
#endif /* CONFIG_DHD_USE_STATIC_BUF */
|
||||
.get_country_code = dhd_wlan_get_country_code,
|
||||
};
|
||||
|
||||
int dhd_wlan_init_gpio(void)
|
||||
{
|
||||
int err = 0;
|
||||
#ifdef CUSTOMER_OOB
|
||||
int host_oob_irq = -1;
|
||||
uint host_oob_irq_flags = 0;
|
||||
#endif
|
||||
|
||||
/* Please check your schematic and fill right GPIO number which connected to
|
||||
* WL_REG_ON and WL_HOST_WAKE.
|
||||
*/
|
||||
gpio_wl_reg_on = 137;
|
||||
gpio_wl_host_wake = 8;
|
||||
|
||||
if (gpio_wl_reg_on >= 0) {
|
||||
err = gpio_request(gpio_wl_reg_on, "WL_REG_ON");
|
||||
if (err < 0) {
|
||||
printf("%s: gpio_request(%d) for WL_REG_ON failed\n",
|
||||
__FUNCTION__, gpio_wl_reg_on);
|
||||
gpio_wl_reg_on = -1;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CUSTOMER_OOB
|
||||
if (gpio_wl_host_wake >= 0) {
|
||||
err = gpio_request(gpio_wl_host_wake, "bcmdhd");
|
||||
if (err < 0) {
|
||||
printf("%s: gpio_request(%d) for WL_HOST_WAKE failed\n",
|
||||
__FUNCTION__, gpio_wl_host_wake);
|
||||
return -1;
|
||||
}
|
||||
err = gpio_direction_input(gpio_wl_host_wake);
|
||||
if (err < 0) {
|
||||
printf("%s: gpio_direction_input(%d) for WL_HOST_WAKE failed\n",
|
||||
__FUNCTION__, gpio_wl_host_wake);
|
||||
gpio_free(gpio_wl_host_wake);
|
||||
return -1;
|
||||
}
|
||||
host_oob_irq = gpio_to_irq(gpio_wl_host_wake);
|
||||
if (host_oob_irq < 0) {
|
||||
printf("%s: gpio_to_irq(%d) for WL_HOST_WAKE failed\n",
|
||||
__FUNCTION__, gpio_wl_host_wake);
|
||||
gpio_free(gpio_wl_host_wake);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HW_OOB
|
||||
#ifdef HW_OOB_LOW_LEVEL
|
||||
host_oob_irq_flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL | IORESOURCE_IRQ_SHAREABLE;
|
||||
#else
|
||||
host_oob_irq_flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL | IORESOURCE_IRQ_SHAREABLE;
|
||||
#endif
|
||||
#else
|
||||
host_oob_irq_flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE | IORESOURCE_IRQ_SHAREABLE;
|
||||
#endif
|
||||
|
||||
dhd_wlan_resources[0].start = dhd_wlan_resources[0].end = host_oob_irq;
|
||||
dhd_wlan_resources[0].flags = host_oob_irq_flags;
|
||||
printf("%s: WL_HOST_WAKE=%d, oob_irq=%d, oob_irq_flags=0x%x\n", __FUNCTION__,
|
||||
gpio_wl_host_wake, host_oob_irq, host_oob_irq_flags);
|
||||
#endif /* CUSTOMER_OOB */
|
||||
printf("%s: WL_REG_ON=%d\n", __FUNCTION__, gpio_wl_reg_on);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void dhd_wlan_deinit_gpio(void)
|
||||
{
|
||||
gpio_wl_reg_on = 137;
|
||||
gpio_wl_host_wake = 8;
|
||||
|
||||
if (gpio_wl_reg_on >= 0) {
|
||||
printf("%s: gpio_free(WL_REG_ON %d)\n", __FUNCTION__, gpio_wl_reg_on);
|
||||
gpio_free(gpio_wl_reg_on);
|
||||
gpio_wl_reg_on = -1;
|
||||
}
|
||||
#ifdef CUSTOMER_OOB
|
||||
if (gpio_wl_host_wake >= 0) {
|
||||
printf("%s: gpio_free(WL_HOST_WAKE %d)\n", __FUNCTION__, gpio_wl_host_wake);
|
||||
gpio_free(gpio_wl_host_wake);
|
||||
gpio_wl_host_wake = -1;
|
||||
}
|
||||
#endif /* CUSTOMER_OOB */
|
||||
}
|
||||
|
||||
int dhd_wlan_init_plat_data(void)
|
||||
{
|
||||
int err = 0;
|
||||
|
||||
printf("======== %s ========\n", __FUNCTION__);
|
||||
err = dhd_wlan_init_gpio();
|
||||
return err;
|
||||
}
|
||||
|
||||
void dhd_wlan_deinit_plat_data(wifi_adapter_info_t *adapter)
|
||||
{
|
||||
printf("======== %s ========\n", __FUNCTION__);
|
||||
dhd_wlan_deinit_gpio();
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
* Header file describing the common ip parser function.
|
||||
*
|
||||
* Provides type definitions and function prototypes used to parse ip packet.
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: dhd_ip.h 536854 2015-02-24 13:17:29Z $
|
||||
*/
|
||||
|
||||
#ifndef _dhd_ip_h_
|
||||
#define _dhd_ip_h_
|
||||
|
||||
#ifdef DHDTCPACK_SUPPRESS
|
||||
#include <dngl_stats.h>
|
||||
#include <bcmutils.h>
|
||||
#include <dhd.h>
|
||||
#endif /* DHDTCPACK_SUPPRESS */
|
||||
|
||||
typedef enum pkt_frag
|
||||
{
|
||||
DHD_PKT_FRAG_NONE = 0,
|
||||
DHD_PKT_FRAG_FIRST,
|
||||
DHD_PKT_FRAG_CONT,
|
||||
DHD_PKT_FRAG_LAST
|
||||
} pkt_frag_t;
|
||||
|
||||
extern pkt_frag_t pkt_frag_info(osl_t *osh, void *p);
|
||||
|
||||
#ifdef DHDTCPACK_SUPPRESS
|
||||
#define TCPACKSZMIN (ETHER_HDR_LEN + IPV4_MIN_HEADER_LEN + TCP_MIN_HEADER_LEN)
|
||||
/* Size of MAX possible TCP ACK packet. Extra bytes for IP/TCP option fields */
|
||||
#define TCPACKSZMAX (TCPACKSZMIN + 100)
|
||||
|
||||
/* Max number of TCP streams that have own src/dst IP addrs and TCP ports */
|
||||
#define TCPACK_INFO_MAXNUM 4
|
||||
#define TCPDATA_INFO_MAXNUM 4
|
||||
#define TCPDATA_PSH_INFO_MAXNUM (8 * TCPDATA_INFO_MAXNUM)
|
||||
|
||||
#define TCPDATA_INFO_TIMEOUT 5000 /* Remove tcpdata_info if inactive for this time (in ms) */
|
||||
|
||||
#define DEFAULT_TCPACK_SUPP_RATIO 3
|
||||
#ifndef CUSTOM_TCPACK_SUPP_RATIO
|
||||
#define CUSTOM_TCPACK_SUPP_RATIO DEFAULT_TCPACK_SUPP_RATIO
|
||||
#endif /* CUSTOM_TCPACK_SUPP_RATIO */
|
||||
|
||||
#define DEFAULT_TCPACK_DELAY_TIME 10 /* ms */
|
||||
#ifndef CUSTOM_TCPACK_DELAY_TIME
|
||||
#define CUSTOM_TCPACK_DELAY_TIME DEFAULT_TCPACK_DELAY_TIME
|
||||
#endif /* CUSTOM_TCPACK_DELAY_TIME */
|
||||
|
||||
extern int dhd_tcpack_suppress_set(dhd_pub_t *dhdp, uint8 on);
|
||||
extern void dhd_tcpack_info_tbl_clean(dhd_pub_t *dhdp);
|
||||
extern int dhd_tcpack_check_xmit(dhd_pub_t *dhdp, void *pkt);
|
||||
extern bool dhd_tcpack_suppress(dhd_pub_t *dhdp, void *pkt);
|
||||
extern bool dhd_tcpdata_info_get(dhd_pub_t *dhdp, void *pkt);
|
||||
extern bool dhd_tcpack_hold(dhd_pub_t *dhdp, void *pkt, int ifidx);
|
||||
/* #define DHDTCPACK_SUP_DBG */
|
||||
#if defined(DEBUG_COUNTER) && defined(DHDTCPACK_SUP_DBG)
|
||||
extern counter_tbl_t tack_tbl;
|
||||
#endif /* DEBUG_COUNTER && DHDTCPACK_SUP_DBG */
|
||||
#endif /* DHDTCPACK_SUPPRESS */
|
||||
|
||||
#endif /* _dhd_ip_h_ */
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,187 @@
|
|||
/*
|
||||
* DHD Linux header file (dhd_linux exports for cfg80211 and other components)
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: dhd_linux.h 699532 2017-05-15 11:00:39Z $
|
||||
*/
|
||||
|
||||
/* wifi platform functions for power, interrupt and pre-alloc, either
|
||||
* from Android-like platform device data, or Broadcom wifi platform
|
||||
* device data.
|
||||
*
|
||||
*/
|
||||
#ifndef __DHD_LINUX_H__
|
||||
#define __DHD_LINUX_H__
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/fs.h>
|
||||
#include <dngl_stats.h>
|
||||
#include <dhd.h>
|
||||
#ifdef DHD_WMF
|
||||
#include <dhd_wmf_linux.h>
|
||||
#endif
|
||||
/* Linux wireless extension support */
|
||||
#if defined(WL_WIRELESS_EXT)
|
||||
#include <wl_iw.h>
|
||||
#endif /* defined(WL_WIRELESS_EXT) */
|
||||
#if defined(CONFIG_HAS_EARLYSUSPEND) && defined(DHD_USE_EARLYSUSPEND)
|
||||
#include <linux/earlysuspend.h>
|
||||
#endif /* defined(CONFIG_HAS_EARLYSUSPEND) && defined(DHD_USE_EARLYSUSPEND) */
|
||||
|
||||
/* dongle status */
|
||||
enum wifi_adapter_status {
|
||||
WIFI_STATUS_POWER_ON = 0,
|
||||
WIFI_STATUS_ATTACH,
|
||||
WIFI_STATUS_FW_READY,
|
||||
WIFI_STATUS_DETTACH
|
||||
};
|
||||
#define wifi_chk_adapter_status(adapter, stat) (test_bit(stat, &(adapter)->status))
|
||||
#define wifi_get_adapter_status(adapter, stat) (test_bit(stat, &(adapter)->status))
|
||||
#define wifi_set_adapter_status(adapter, stat) (set_bit(stat, &(adapter)->status))
|
||||
#define wifi_clr_adapter_status(adapter, stat) (clear_bit(stat, &(adapter)->status))
|
||||
#define wifi_chg_adapter_status(adapter, stat) (change_bit(stat, &(adapter)->status))
|
||||
|
||||
#define DHD_REGISTRATION_TIMEOUT 12000 /* msec : allowed time to finished dhd registration */
|
||||
#define DHD_FW_READY_TIMEOUT 5000 /* msec : allowed time to finished fw download */
|
||||
|
||||
typedef struct wifi_adapter_info {
|
||||
const char *name;
|
||||
uint irq_num;
|
||||
uint intr_flags;
|
||||
const char *fw_path;
|
||||
const char *nv_path;
|
||||
const char *clm_path;
|
||||
const char *conf_path;
|
||||
void *wifi_plat_data; /* wifi ctrl func, for backward compatibility */
|
||||
uint bus_type;
|
||||
uint bus_num;
|
||||
uint slot_num;
|
||||
wait_queue_head_t status_event;
|
||||
unsigned long status;
|
||||
#if defined(BT_OVER_SDIO)
|
||||
const char *btfw_path;
|
||||
#endif /* defined (BT_OVER_SDIO) */
|
||||
#ifdef BUS_POWER_RESTORE
|
||||
#if defined(BCMSDIO)
|
||||
struct sdio_func *sdio_func;
|
||||
#endif /* BCMSDIO */
|
||||
#if defined(BCMPCIE)
|
||||
struct pci_dev *pci_dev;
|
||||
struct pci_saved_state *pci_saved_state;
|
||||
#endif /* BCMPCIE */
|
||||
#endif
|
||||
} wifi_adapter_info_t;
|
||||
|
||||
#define WLAN_PLAT_NODFS_FLAG 0x01
|
||||
#define WLAN_PLAT_AP_FLAG 0x02
|
||||
struct wifi_platform_data {
|
||||
#ifdef BUS_POWER_RESTORE
|
||||
int (*set_power)(int val, wifi_adapter_info_t *adapter);
|
||||
#else
|
||||
int (*set_power)(int val);
|
||||
#endif
|
||||
int (*set_reset)(int val);
|
||||
int (*set_carddetect)(int val);
|
||||
void *(*mem_prealloc)(int section, unsigned long size);
|
||||
int (*get_mac_addr)(unsigned char *buf);
|
||||
#if defined(CUSTOM_COUNTRY_CODE)
|
||||
void *(*get_country_code)(char *ccode, u32 flags);
|
||||
#else /* defined (CUSTOM_COUNTRY_CODE) */
|
||||
void *(*get_country_code)(char *ccode);
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef struct bcmdhd_wifi_platdata {
|
||||
uint num_adapters;
|
||||
wifi_adapter_info_t *adapters;
|
||||
} bcmdhd_wifi_platdata_t;
|
||||
|
||||
/** Per STA params. A list of dhd_sta objects are managed in dhd_if */
|
||||
typedef struct dhd_sta {
|
||||
cumm_ctr_t cumm_ctr; /* cummulative queue length of child flowrings */
|
||||
uint16 flowid[NUMPRIO]; /* allocated flow ring ids (by priority) */
|
||||
void * ifp; /* associated dhd_if */
|
||||
struct ether_addr ea; /* stations ethernet mac address */
|
||||
struct list_head list; /* link into dhd_if::sta_list */
|
||||
int idx; /* index of self in dhd_pub::sta_pool[] */
|
||||
int ifidx; /* index of interface in dhd */
|
||||
#ifdef DHD_WMF
|
||||
struct dhd_sta *psta_prim; /* primary index of psta interface */
|
||||
#endif /* DHD_WMF */
|
||||
} dhd_sta_t;
|
||||
typedef dhd_sta_t dhd_sta_pool_t;
|
||||
|
||||
int dhd_wifi_platform_register_drv(void);
|
||||
void dhd_wifi_platform_unregister_drv(void);
|
||||
wifi_adapter_info_t* dhd_wifi_platform_attach_adapter(uint32 bus_type,
|
||||
uint32 bus_num, uint32 slot_num, unsigned long status);
|
||||
wifi_adapter_info_t* dhd_wifi_platform_get_adapter(uint32 bus_type, uint32 bus_num,
|
||||
uint32 slot_num);
|
||||
int wifi_platform_set_power(wifi_adapter_info_t *adapter, bool on, unsigned long msec);
|
||||
int wifi_platform_bus_enumerate(wifi_adapter_info_t *adapter, bool device_present);
|
||||
int wifi_platform_get_irq_number(wifi_adapter_info_t *adapter, unsigned long *irq_flags_ptr);
|
||||
int wifi_platform_get_mac_addr(wifi_adapter_info_t *adapter, unsigned char *buf);
|
||||
#ifdef CUSTOM_COUNTRY_CODE
|
||||
void *wifi_platform_get_country_code(wifi_adapter_info_t *adapter, char *ccode,
|
||||
u32 flags);
|
||||
#else
|
||||
void *wifi_platform_get_country_code(wifi_adapter_info_t *adapter, char *ccode);
|
||||
#endif /* CUSTOM_COUNTRY_CODE */
|
||||
void* wifi_platform_prealloc(wifi_adapter_info_t *adapter, int section, unsigned long size);
|
||||
void* wifi_platform_get_prealloc_func_ptr(wifi_adapter_info_t *adapter);
|
||||
|
||||
int dhd_get_fw_mode(struct dhd_info *dhdinfo);
|
||||
bool dhd_update_fw_nv_path(struct dhd_info *dhdinfo);
|
||||
|
||||
#ifdef DHD_WMF
|
||||
dhd_wmf_t* dhd_wmf_conf(dhd_pub_t *dhdp, uint32 idx);
|
||||
int dhd_get_wmf_psta_disable(dhd_pub_t *dhdp, uint32 idx);
|
||||
int dhd_set_wmf_psta_disable(dhd_pub_t *dhdp, uint32 idx, int val);
|
||||
void dhd_update_psta_interface_for_sta(dhd_pub_t *dhdp, char* ifname,
|
||||
void* mac_addr, void* event_data);
|
||||
#endif /* DHD_WMF */
|
||||
#if defined(BT_OVER_SDIO)
|
||||
int dhd_net_bus_get(struct net_device *dev);
|
||||
int dhd_net_bus_put(struct net_device *dev);
|
||||
#endif /* BT_OVER_SDIO */
|
||||
#ifdef HOFFLOAD_MODULES
|
||||
extern void dhd_free_module_memory(struct dhd_bus *bus, struct module_metadata *hmem);
|
||||
extern void* dhd_alloc_module_memory(struct dhd_bus *bus, uint32_t size,
|
||||
struct module_metadata *hmem);
|
||||
#endif /* HOFFLOAD_MODULES */
|
||||
#if defined(WLADPS) || defined(WLADPS_PRIVATE_CMD)
|
||||
#define ADPS_ENABLE 1
|
||||
#define ADPS_DISABLE 0
|
||||
typedef struct bcm_iov_buf {
|
||||
uint16 version;
|
||||
uint16 len;
|
||||
uint16 id;
|
||||
uint16 data[1];
|
||||
} bcm_iov_buf_t;
|
||||
|
||||
int dhd_enable_adps(dhd_pub_t *dhd, uint8 on);
|
||||
#endif /* WLADPS || WLADPS_PRIVATE_CMD */
|
||||
#endif /* __DHD_LINUX_H__ */
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Expose some of the kernel scheduler routines
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: dhd_linux_sched.c 514727 2014-11-12 03:02:48Z $
|
||||
*/
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/sched.h>
|
||||
#include <typedefs.h>
|
||||
#include <linuxver.h>
|
||||
|
||||
int setScheduler(struct task_struct *p, int policy, struct sched_param *param)
|
||||
{
|
||||
int rc = 0;
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0))
|
||||
rc = sched_setscheduler(p, policy, param);
|
||||
#endif /* LinuxVer */
|
||||
return rc;
|
||||
}
|
||||
|
||||
int get_scheduler_policy(struct task_struct *p)
|
||||
{
|
||||
int rc = SCHED_NORMAL;
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0))
|
||||
rc = p->policy;
|
||||
#endif /* LinuxVer */
|
||||
return rc;
|
||||
}
|
|
@ -0,0 +1,379 @@
|
|||
/*
|
||||
* Broadcom Dongle Host Driver (DHD), Generic work queue framework
|
||||
* Generic interface to handle dhd deferred work events
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: dhd_linux_wq.c 641330 2016-06-02 06:55:00Z $
|
||||
*/
|
||||
|
||||
#include <linux/init.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/fcntl.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/ip.h>
|
||||
#include <linux/kfifo.h>
|
||||
|
||||
#include <linuxver.h>
|
||||
#include <osl.h>
|
||||
#include <bcmutils.h>
|
||||
#include <bcmendian.h>
|
||||
#include <bcmdevs.h>
|
||||
#include <dngl_stats.h>
|
||||
#include <dhd.h>
|
||||
#include <dhd_dbg.h>
|
||||
#include <dhd_linux_wq.h>
|
||||
|
||||
typedef struct dhd_deferred_event {
|
||||
u8 event; /* holds the event */
|
||||
void *event_data; /* holds event specific data */
|
||||
event_handler_t event_handler;
|
||||
unsigned long pad; /* for memory alignment to power of 2 */
|
||||
} dhd_deferred_event_t;
|
||||
|
||||
#define DEFRD_EVT_SIZE (sizeof(dhd_deferred_event_t))
|
||||
|
||||
/*
|
||||
* work events may occur simultaneously.
|
||||
* can hold upto 64 low priority events and 16 high priority events
|
||||
*/
|
||||
#define DHD_PRIO_WORK_FIFO_SIZE (16 * DEFRD_EVT_SIZE)
|
||||
#define DHD_WORK_FIFO_SIZE (64 * DEFRD_EVT_SIZE)
|
||||
|
||||
#define DHD_FIFO_HAS_FREE_SPACE(fifo) \
|
||||
((fifo) && (kfifo_avail(fifo) >= DEFRD_EVT_SIZE))
|
||||
#define DHD_FIFO_HAS_ENOUGH_DATA(fifo) \
|
||||
((fifo) && (kfifo_len(fifo) >= DEFRD_EVT_SIZE))
|
||||
|
||||
struct dhd_deferred_wq {
|
||||
struct work_struct deferred_work; /* should be the first member */
|
||||
|
||||
struct kfifo *prio_fifo;
|
||||
struct kfifo *work_fifo;
|
||||
u8 *prio_fifo_buf;
|
||||
u8 *work_fifo_buf;
|
||||
spinlock_t work_lock;
|
||||
void *dhd_info; /* review: does it require */
|
||||
};
|
||||
|
||||
static inline struct kfifo*
|
||||
dhd_kfifo_init(u8 *buf, int size, spinlock_t *lock)
|
||||
{
|
||||
struct kfifo *fifo;
|
||||
gfp_t flags = CAN_SLEEP() ? GFP_KERNEL : GFP_ATOMIC;
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33))
|
||||
fifo = kfifo_init(buf, size, flags, lock);
|
||||
#else
|
||||
fifo = (struct kfifo *)kzalloc(sizeof(struct kfifo), flags);
|
||||
if (!fifo) {
|
||||
return NULL;
|
||||
}
|
||||
kfifo_init(fifo, buf, size);
|
||||
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)) */
|
||||
return fifo;
|
||||
}
|
||||
|
||||
static inline void
|
||||
dhd_kfifo_free(struct kfifo *fifo)
|
||||
{
|
||||
kfifo_free(fifo);
|
||||
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 31))
|
||||
/* FC11 releases the fifo memory */
|
||||
kfree(fifo);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* deferred work functions */
|
||||
static void dhd_deferred_work_handler(struct work_struct *data);
|
||||
|
||||
void*
|
||||
dhd_deferred_work_init(void *dhd_info)
|
||||
{
|
||||
struct dhd_deferred_wq *work = NULL;
|
||||
u8* buf;
|
||||
unsigned long fifo_size = 0;
|
||||
gfp_t flags = CAN_SLEEP() ? GFP_KERNEL : GFP_ATOMIC;
|
||||
|
||||
if (!dhd_info) {
|
||||
DHD_ERROR(("%s: dhd info not initialized\n", __FUNCTION__));
|
||||
goto return_null;
|
||||
}
|
||||
|
||||
work = (struct dhd_deferred_wq *)kzalloc(sizeof(struct dhd_deferred_wq),
|
||||
flags);
|
||||
if (!work) {
|
||||
DHD_ERROR(("%s: work queue creation failed\n", __FUNCTION__));
|
||||
goto return_null;
|
||||
}
|
||||
|
||||
INIT_WORK((struct work_struct *)work, dhd_deferred_work_handler);
|
||||
|
||||
/* initialize event fifo */
|
||||
spin_lock_init(&work->work_lock);
|
||||
|
||||
/* allocate buffer to hold prio events */
|
||||
fifo_size = DHD_PRIO_WORK_FIFO_SIZE;
|
||||
fifo_size = is_power_of_2(fifo_size) ? fifo_size :
|
||||
roundup_pow_of_two(fifo_size);
|
||||
buf = (u8*)kzalloc(fifo_size, flags);
|
||||
if (!buf) {
|
||||
DHD_ERROR(("%s: prio work fifo allocation failed\n",
|
||||
__FUNCTION__));
|
||||
goto return_null;
|
||||
}
|
||||
|
||||
/* Initialize prio event fifo */
|
||||
work->prio_fifo = dhd_kfifo_init(buf, fifo_size, &work->work_lock);
|
||||
if (!work->prio_fifo) {
|
||||
kfree(buf);
|
||||
goto return_null;
|
||||
}
|
||||
|
||||
/* allocate buffer to hold work events */
|
||||
fifo_size = DHD_WORK_FIFO_SIZE;
|
||||
fifo_size = is_power_of_2(fifo_size) ? fifo_size :
|
||||
roundup_pow_of_two(fifo_size);
|
||||
buf = (u8*)kzalloc(fifo_size, flags);
|
||||
if (!buf) {
|
||||
DHD_ERROR(("%s: work fifo allocation failed\n", __FUNCTION__));
|
||||
goto return_null;
|
||||
}
|
||||
|
||||
/* Initialize event fifo */
|
||||
work->work_fifo = dhd_kfifo_init(buf, fifo_size, &work->work_lock);
|
||||
if (!work->work_fifo) {
|
||||
kfree(buf);
|
||||
goto return_null;
|
||||
}
|
||||
|
||||
work->dhd_info = dhd_info;
|
||||
DHD_ERROR(("%s: work queue initialized\n", __FUNCTION__));
|
||||
return work;
|
||||
|
||||
return_null:
|
||||
if (work) {
|
||||
dhd_deferred_work_deinit(work);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
dhd_deferred_work_deinit(void *work)
|
||||
{
|
||||
struct dhd_deferred_wq *deferred_work = work;
|
||||
|
||||
|
||||
if (!deferred_work) {
|
||||
DHD_ERROR(("%s: deferred work has been freed already\n",
|
||||
__FUNCTION__));
|
||||
return;
|
||||
}
|
||||
|
||||
/* cancel the deferred work handling */
|
||||
cancel_work_sync((struct work_struct *)deferred_work);
|
||||
|
||||
/*
|
||||
* free work event fifo.
|
||||
* kfifo_free frees locally allocated fifo buffer
|
||||
*/
|
||||
if (deferred_work->prio_fifo) {
|
||||
dhd_kfifo_free(deferred_work->prio_fifo);
|
||||
}
|
||||
|
||||
if (deferred_work->work_fifo) {
|
||||
dhd_kfifo_free(deferred_work->work_fifo);
|
||||
}
|
||||
|
||||
kfree(deferred_work);
|
||||
}
|
||||
|
||||
/* select kfifo according to priority */
|
||||
static inline struct kfifo *
|
||||
dhd_deferred_work_select_kfifo(struct dhd_deferred_wq *deferred_wq,
|
||||
u8 priority)
|
||||
{
|
||||
if (priority == DHD_WQ_WORK_PRIORITY_HIGH) {
|
||||
return deferred_wq->prio_fifo;
|
||||
} else if (priority == DHD_WQ_WORK_PRIORITY_LOW) {
|
||||
return deferred_wq->work_fifo;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Prepares event to be queued
|
||||
* Schedules the event
|
||||
*/
|
||||
int
|
||||
dhd_deferred_schedule_work(void *workq, void *event_data, u8 event,
|
||||
event_handler_t event_handler, u8 priority)
|
||||
{
|
||||
struct dhd_deferred_wq *deferred_wq = (struct dhd_deferred_wq *)workq;
|
||||
struct kfifo *fifo;
|
||||
dhd_deferred_event_t deferred_event;
|
||||
int bytes_copied = 0;
|
||||
|
||||
if (!deferred_wq) {
|
||||
DHD_ERROR(("%s: work queue not initialized\n", __FUNCTION__));
|
||||
ASSERT(0);
|
||||
return DHD_WQ_STS_UNINITIALIZED;
|
||||
}
|
||||
|
||||
if (!event || (event >= DHD_MAX_WQ_EVENTS)) {
|
||||
DHD_ERROR(("%s: unknown event, event=%d\n", __FUNCTION__,
|
||||
event));
|
||||
return DHD_WQ_STS_UNKNOWN_EVENT;
|
||||
}
|
||||
|
||||
if (!priority || (priority >= DHD_WQ_MAX_PRIORITY)) {
|
||||
DHD_ERROR(("%s: unknown priority, priority=%d\n",
|
||||
__FUNCTION__, priority));
|
||||
return DHD_WQ_STS_UNKNOWN_PRIORITY;
|
||||
}
|
||||
|
||||
/*
|
||||
* default element size is 1, which can be changed
|
||||
* using kfifo_esize(). Older kernel(FC11) doesn't support
|
||||
* changing element size. For compatibility changing
|
||||
* element size is not prefered
|
||||
*/
|
||||
ASSERT(kfifo_esize(deferred_wq->prio_fifo) == 1);
|
||||
ASSERT(kfifo_esize(deferred_wq->work_fifo) == 1);
|
||||
|
||||
deferred_event.event = event;
|
||||
deferred_event.event_data = event_data;
|
||||
deferred_event.event_handler = event_handler;
|
||||
|
||||
fifo = dhd_deferred_work_select_kfifo(deferred_wq, priority);
|
||||
if (DHD_FIFO_HAS_FREE_SPACE(fifo)) {
|
||||
bytes_copied = kfifo_in_spinlocked(fifo, &deferred_event,
|
||||
DEFRD_EVT_SIZE, &deferred_wq->work_lock);
|
||||
}
|
||||
if (bytes_copied != DEFRD_EVT_SIZE) {
|
||||
DHD_ERROR(("%s: failed to schedule deferred work, "
|
||||
"priority=%d, bytes_copied=%d\n", __FUNCTION__,
|
||||
priority, bytes_copied));
|
||||
return DHD_WQ_STS_SCHED_FAILED;
|
||||
}
|
||||
schedule_work((struct work_struct *)deferred_wq);
|
||||
return DHD_WQ_STS_OK;
|
||||
}
|
||||
|
||||
static bool
|
||||
dhd_get_scheduled_work(struct dhd_deferred_wq *deferred_wq,
|
||||
dhd_deferred_event_t *event)
|
||||
{
|
||||
int bytes_copied = 0;
|
||||
|
||||
if (!deferred_wq) {
|
||||
DHD_ERROR(("%s: work queue not initialized\n", __FUNCTION__));
|
||||
return DHD_WQ_STS_UNINITIALIZED;
|
||||
}
|
||||
|
||||
/*
|
||||
* default element size is 1 byte, which can be changed
|
||||
* using kfifo_esize(). Older kernel(FC11) doesn't support
|
||||
* changing element size. For compatibility changing
|
||||
* element size is not prefered
|
||||
*/
|
||||
ASSERT(kfifo_esize(deferred_wq->prio_fifo) == 1);
|
||||
ASSERT(kfifo_esize(deferred_wq->work_fifo) == 1);
|
||||
|
||||
/* handle priority work */
|
||||
if (DHD_FIFO_HAS_ENOUGH_DATA(deferred_wq->prio_fifo)) {
|
||||
bytes_copied = kfifo_out_spinlocked(deferred_wq->prio_fifo,
|
||||
event, DEFRD_EVT_SIZE, &deferred_wq->work_lock);
|
||||
}
|
||||
|
||||
/* handle normal work if priority work doesn't have enough data */
|
||||
if ((bytes_copied != DEFRD_EVT_SIZE) &&
|
||||
DHD_FIFO_HAS_ENOUGH_DATA(deferred_wq->work_fifo)) {
|
||||
bytes_copied = kfifo_out_spinlocked(deferred_wq->work_fifo,
|
||||
event, DEFRD_EVT_SIZE, &deferred_wq->work_lock);
|
||||
}
|
||||
|
||||
return (bytes_copied == DEFRD_EVT_SIZE);
|
||||
}
|
||||
|
||||
static inline void
|
||||
dhd_deferred_dump_work_event(dhd_deferred_event_t *work_event)
|
||||
{
|
||||
if (!work_event) {
|
||||
DHD_ERROR(("%s: work_event is null\n", __FUNCTION__));
|
||||
return;
|
||||
}
|
||||
|
||||
DHD_ERROR(("%s: work_event->event = %d\n", __FUNCTION__,
|
||||
work_event->event));
|
||||
DHD_ERROR(("%s: work_event->event_data = %p\n", __FUNCTION__,
|
||||
work_event->event_data));
|
||||
DHD_ERROR(("%s: work_event->event_handler = %p\n", __FUNCTION__,
|
||||
work_event->event_handler));
|
||||
}
|
||||
|
||||
/*
|
||||
* Called when work is scheduled
|
||||
*/
|
||||
static void
|
||||
dhd_deferred_work_handler(struct work_struct *work)
|
||||
{
|
||||
struct dhd_deferred_wq *deferred_work = (struct dhd_deferred_wq *)work;
|
||||
dhd_deferred_event_t work_event;
|
||||
|
||||
if (!deferred_work) {
|
||||
DHD_ERROR(("%s: work queue not initialized\n", __FUNCTION__));
|
||||
return;
|
||||
}
|
||||
|
||||
do {
|
||||
if (!dhd_get_scheduled_work(deferred_work, &work_event)) {
|
||||
DHD_TRACE(("%s: no event to handle\n", __FUNCTION__));
|
||||
break;
|
||||
}
|
||||
|
||||
if (work_event.event >= DHD_MAX_WQ_EVENTS) {
|
||||
DHD_ERROR(("%s: unknown event\n", __FUNCTION__));
|
||||
dhd_deferred_dump_work_event(&work_event);
|
||||
ASSERT(work_event.event < DHD_MAX_WQ_EVENTS);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (work_event.event_handler) {
|
||||
work_event.event_handler(deferred_work->dhd_info,
|
||||
work_event.event_data, work_event.event);
|
||||
} else {
|
||||
DHD_ERROR(("%s: event handler is null\n",
|
||||
__FUNCTION__));
|
||||
dhd_deferred_dump_work_event(&work_event);
|
||||
ASSERT(work_event.event_handler != NULL);
|
||||
}
|
||||
} while (1);
|
||||
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
* Broadcom Dongle Host Driver (DHD), Generic work queue framework
|
||||
* Generic interface to handle dhd deferred work events
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: dhd_linux_wq.h 704361 2017-06-13 08:50:38Z $
|
||||
*/
|
||||
#ifndef _dhd_linux_wq_h_
|
||||
#define _dhd_linux_wq_h_
|
||||
/*
|
||||
* Work event definitions
|
||||
*/
|
||||
enum _wq_event {
|
||||
DHD_WQ_WORK_IF_ADD = 1,
|
||||
DHD_WQ_WORK_IF_DEL,
|
||||
DHD_WQ_WORK_SET_MAC,
|
||||
DHD_WQ_WORK_SET_MCAST_LIST,
|
||||
DHD_WQ_WORK_IPV6_NDO,
|
||||
DHD_WQ_WORK_HANG_MSG,
|
||||
DHD_WQ_WORK_SOC_RAM_DUMP,
|
||||
DHD_WQ_WORK_DHD_LOG_DUMP,
|
||||
DHD_WQ_WORK_INFORM_DHD_MON,
|
||||
DHD_WQ_WORK_EVENT_LOGTRACE,
|
||||
DHD_WQ_WORK_DMA_LB_MEM_REL,
|
||||
DHD_WQ_WORK_DEBUG_UART_DUMP,
|
||||
DHD_WQ_WORK_SSSR_DUMP,
|
||||
DHD_WQ_WORK_PKTLOG_DUMP,
|
||||
#ifdef DHD_UPDATE_INTF_MAC
|
||||
DHD_WQ_WORK_IF_UPDATE,
|
||||
#endif /* DHD_UPDATE_INTF_MAC */
|
||||
DHD_MAX_WQ_EVENTS
|
||||
};
|
||||
|
||||
/*
|
||||
* Work event priority
|
||||
*/
|
||||
enum wq_priority {
|
||||
DHD_WQ_WORK_PRIORITY_LOW = 1,
|
||||
DHD_WQ_WORK_PRIORITY_HIGH,
|
||||
DHD_WQ_MAX_PRIORITY
|
||||
};
|
||||
|
||||
/*
|
||||
* Error definitions
|
||||
*/
|
||||
#define DHD_WQ_STS_OK 0
|
||||
#define DHD_WQ_STS_FAILED -1 /* General failure */
|
||||
#define DHD_WQ_STS_UNINITIALIZED -2
|
||||
#define DHD_WQ_STS_SCHED_FAILED -3
|
||||
#define DHD_WQ_STS_UNKNOWN_EVENT -4
|
||||
#define DHD_WQ_STS_UNKNOWN_PRIORITY -5
|
||||
|
||||
typedef void (*event_handler_t)(void *handle, void *event_data, u8 event);
|
||||
|
||||
void *dhd_deferred_work_init(void *dhd);
|
||||
void dhd_deferred_work_deinit(void *workq);
|
||||
int dhd_deferred_schedule_work(void *workq, void *event_data, u8 event,
|
||||
event_handler_t evt_handler, u8 priority);
|
||||
#endif /* _dhd_linux_wq_h_ */
|
|
@ -0,0 +1,747 @@
|
|||
/*
|
||||
* DHD debugability support
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
* $Id: dhd_mschdbg.c 639872 2016-05-25 05:39:30Z $
|
||||
*/
|
||||
#ifdef SHOW_LOGTRACE
|
||||
#include <typedefs.h>
|
||||
#include <osl.h>
|
||||
#include <bcmutils.h>
|
||||
#include <bcmendian.h>
|
||||
#include <dngl_stats.h>
|
||||
#include <dhd.h>
|
||||
#include <dhd_dbg.h>
|
||||
#include <dhd_debug.h>
|
||||
#include <dhd_mschdbg.h>
|
||||
|
||||
#include <event_log.h>
|
||||
#include <event_trace.h>
|
||||
#include <msgtrace.h>
|
||||
|
||||
static const char *head_log = "";
|
||||
#define MSCH_EVENT_HEAD(space) \
|
||||
do { \
|
||||
MSCH_EVENT(("%s_E: ", head_log)); \
|
||||
if (space > 0) { \
|
||||
int ii; \
|
||||
for (ii = 0; ii < space; ii += 4) MSCH_EVENT((" ")); \
|
||||
} \
|
||||
} while (0)
|
||||
#define MSCH_EVENT(args) do {if (dhd_msg_level & DHD_EVENT_VAL) printf args;} while (0)
|
||||
|
||||
static uint64 solt_start_time[4], req_start_time[4], profiler_start_time[4];
|
||||
static uint32 solt_chanspec[4] = {0, }, req_start[4] = {0, };
|
||||
static bool lastMessages = FALSE;
|
||||
|
||||
#define US_PRE_SEC 1000000
|
||||
|
||||
static void dhd_mschdbg_us_to_sec(uint32 time_h, uint32 time_l, uint32 *sec, uint32 *remain)
|
||||
{
|
||||
uint64 cur_time = ((uint64)(ntoh32(time_h)) << 32) | ntoh32(time_l);
|
||||
uint64 r, u = 0;
|
||||
|
||||
r = cur_time;
|
||||
while (time_h != 0) {
|
||||
u += (uint64)((0xffffffff / US_PRE_SEC)) * time_h;
|
||||
r = cur_time - u * US_PRE_SEC;
|
||||
time_h = (uint32)(r >> 32);
|
||||
}
|
||||
|
||||
*sec = (uint32)(u + ((uint32)(r) / US_PRE_SEC));
|
||||
*remain = (uint32)(r) % US_PRE_SEC;
|
||||
}
|
||||
|
||||
static char *dhd_mschdbg_display_time(uint32 time_h, uint32 time_l)
|
||||
{
|
||||
static char display_time[32];
|
||||
uint32 s, ss;
|
||||
|
||||
if (time_h == 0xffffffff && time_l == 0xffffffff) {
|
||||
snprintf(display_time, 31, "-1");
|
||||
} else {
|
||||
dhd_mschdbg_us_to_sec(time_h, time_l, &s, &ss);
|
||||
snprintf(display_time, 31, "%d.%06d", s, ss);
|
||||
}
|
||||
return display_time;
|
||||
}
|
||||
|
||||
static void
|
||||
dhd_mschdbg_chanspec_list(int sp, char *data, uint16 ptr, uint16 chanspec_cnt)
|
||||
{
|
||||
int i, cnt = (int)ntoh16(chanspec_cnt);
|
||||
uint16 *chanspec_list = (uint16 *)(data + ntoh16(ptr));
|
||||
char buf[CHANSPEC_STR_LEN];
|
||||
chanspec_t c;
|
||||
|
||||
MSCH_EVENT_HEAD(sp);
|
||||
MSCH_EVENT(("<chanspec_list>:"));
|
||||
for (i = 0; i < cnt; i++) {
|
||||
c = (chanspec_t)ntoh16(chanspec_list[i]);
|
||||
MSCH_EVENT((" %s", wf_chspec_ntoa(c, buf)));
|
||||
}
|
||||
MSCH_EVENT(("\n"));
|
||||
}
|
||||
|
||||
static void
|
||||
dhd_mschdbg_elem_list(int sp, char *title, char *data, uint16 ptr, uint16 list_cnt)
|
||||
{
|
||||
int i, cnt = (int)ntoh16(list_cnt);
|
||||
uint32 *list = (uint32 *)(data + ntoh16(ptr));
|
||||
|
||||
MSCH_EVENT_HEAD(sp);
|
||||
MSCH_EVENT(("%s_list: ", title));
|
||||
for (i = 0; i < cnt; i++) {
|
||||
MSCH_EVENT(("0x%08x->", ntoh32(list[i])));
|
||||
}
|
||||
MSCH_EVENT(("null\n"));
|
||||
}
|
||||
|
||||
static void
|
||||
dhd_mschdbg_req_param_profiler_event_data(int sp, int ver, char *data, uint16 ptr)
|
||||
{
|
||||
int sn = sp + 4;
|
||||
msch_req_param_profiler_event_data_t *p =
|
||||
(msch_req_param_profiler_event_data_t *)(data + ntoh16(ptr));
|
||||
uint32 type, flags;
|
||||
|
||||
MSCH_EVENT_HEAD(sp);
|
||||
MSCH_EVENT(("<request parameters>\n"));
|
||||
MSCH_EVENT_HEAD(sn);
|
||||
MSCH_EVENT(("req_type: "));
|
||||
|
||||
type = p->req_type;
|
||||
if (type < 4) {
|
||||
char *req_type[] = {"fixed", "start-flexible", "duration-flexible",
|
||||
"both-flexible"};
|
||||
MSCH_EVENT(("%s", req_type[type]));
|
||||
}
|
||||
else
|
||||
MSCH_EVENT(("unknown(%d)", type));
|
||||
|
||||
flags = ntoh16(p->flags);
|
||||
if (flags & WL_MSCH_REQ_FLAGS_CHAN_CONTIGUOUS)
|
||||
MSCH_EVENT((", CHAN_CONTIGUOUS"));
|
||||
if (flags & WL_MSCH_REQ_FLAGS_MERGE_CONT_SLOTS)
|
||||
MSCH_EVENT((", MERGE_CONT_SLOTS"));
|
||||
if (flags & WL_MSCH_REQ_FLAGS_PREMTABLE)
|
||||
MSCH_EVENT((", PREMTABLE"));
|
||||
if (flags & WL_MSCH_REQ_FLAGS_PREMT_CURTS)
|
||||
MSCH_EVENT((", PREMT_CURTS"));
|
||||
if (flags & WL_MSCH_REQ_FLAGS_PREMT_IMMEDIATE)
|
||||
MSCH_EVENT((", PREMT_IMMEDIATE"));
|
||||
MSCH_EVENT((", priority: %d\n", p->priority));
|
||||
|
||||
MSCH_EVENT_HEAD(sn);
|
||||
MSCH_EVENT(("start-time: %s, duration: %d(us), interval: %d(us)\n",
|
||||
dhd_mschdbg_display_time(p->start_time_h, p->start_time_l),
|
||||
ntoh32(p->duration), ntoh32(p->interval)));
|
||||
|
||||
if (type == WL_MSCH_RT_DUR_FLEX) {
|
||||
MSCH_EVENT_HEAD(sn);
|
||||
MSCH_EVENT(("dur_flex: %d(us)\n", ntoh32(p->flex.dur_flex)));
|
||||
} else if (type == WL_MSCH_RT_BOTH_FLEX) {
|
||||
MSCH_EVENT_HEAD(sn);
|
||||
MSCH_EVENT(("min_dur: %d(us), max_away_dur: %d(us)\n",
|
||||
ntoh32(p->flex.bf.min_dur), ntoh32(p->flex.bf.max_away_dur)));
|
||||
|
||||
MSCH_EVENT_HEAD(sn);
|
||||
MSCH_EVENT(("hi_prio_time: %s, hi_prio_interval: %d(us)\n",
|
||||
dhd_mschdbg_display_time(p->flex.bf.hi_prio_time_h,
|
||||
p->flex.bf.hi_prio_time_l),
|
||||
ntoh32(p->flex.bf.hi_prio_interval)));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
dhd_mschdbg_timeslot_profiler_event_data(int sp, int ver, char *title, char *data,
|
||||
uint16 ptr, bool empty)
|
||||
{
|
||||
int s, sn = sp + 4;
|
||||
msch_timeslot_profiler_event_data_t *p =
|
||||
(msch_timeslot_profiler_event_data_t *)(data + ntoh16(ptr));
|
||||
char *state[] = {"NONE", "CHN_SW", "ONCHAN_FIRE", "OFF_CHN_PREP",
|
||||
"OFF_CHN_DONE", "TS_COMPLETE"};
|
||||
|
||||
MSCH_EVENT_HEAD(sp);
|
||||
MSCH_EVENT(("<%s timeslot>: ", title));
|
||||
if (empty) {
|
||||
MSCH_EVENT((" null\n"));
|
||||
return;
|
||||
}
|
||||
else
|
||||
MSCH_EVENT(("0x%08x\n", ntoh32(p->p_timeslot)));
|
||||
|
||||
s = (int)(ntoh32(p->state));
|
||||
if (s > 5) s = 0;
|
||||
|
||||
MSCH_EVENT_HEAD(sn);
|
||||
MSCH_EVENT(("id: %d, state[%d]: %s, chan_ctxt: [0x%08x]\n",
|
||||
ntoh32(p->timeslot_id), ntoh32(p->state), state[s], ntoh32(p->p_chan_ctxt)));
|
||||
|
||||
MSCH_EVENT_HEAD(sn);
|
||||
MSCH_EVENT(("fire_time: %s",
|
||||
dhd_mschdbg_display_time(p->fire_time_h, p->fire_time_l)));
|
||||
|
||||
MSCH_EVENT((", pre_start_time: %s",
|
||||
dhd_mschdbg_display_time(p->pre_start_time_h, p->pre_start_time_l)));
|
||||
|
||||
MSCH_EVENT((", end_time: %s",
|
||||
dhd_mschdbg_display_time(p->end_time_h, p->end_time_l)));
|
||||
|
||||
MSCH_EVENT((", sch_dur: %s\n",
|
||||
dhd_mschdbg_display_time(p->sch_dur_h, p->sch_dur_l)));
|
||||
}
|
||||
|
||||
static void
|
||||
dhd_mschdbg_req_timing_profiler_event_data(int sp, int ver, char *title, char *data,
|
||||
uint16 ptr, bool empty)
|
||||
{
|
||||
int sn = sp + 4;
|
||||
msch_req_timing_profiler_event_data_t *p =
|
||||
(msch_req_timing_profiler_event_data_t *)(data + ntoh16(ptr));
|
||||
uint32 type;
|
||||
|
||||
MSCH_EVENT_HEAD(sp);
|
||||
MSCH_EVENT(("<%s req_timing>: ", title));
|
||||
if (empty) {
|
||||
MSCH_EVENT((" null\n"));
|
||||
return;
|
||||
}
|
||||
else
|
||||
MSCH_EVENT(("0x%08x (prev 0x%08x, next 0x%08x)\n",
|
||||
ntoh32(p->p_req_timing), ntoh32(p->p_prev), ntoh32(p->p_next)));
|
||||
|
||||
MSCH_EVENT_HEAD(sn);
|
||||
MSCH_EVENT(("flags:"));
|
||||
type = ntoh16(p->flags);
|
||||
if ((type & 0x7f) == 0)
|
||||
MSCH_EVENT((" NONE"));
|
||||
else {
|
||||
if (type & WL_MSCH_RC_FLAGS_ONCHAN_FIRE)
|
||||
MSCH_EVENT((" ONCHAN_FIRE"));
|
||||
if (type & WL_MSCH_RC_FLAGS_START_FIRE_DONE)
|
||||
MSCH_EVENT((" START_FIRE"));
|
||||
if (type & WL_MSCH_RC_FLAGS_END_FIRE_DONE)
|
||||
MSCH_EVENT((" END_FIRE"));
|
||||
if (type & WL_MSCH_RC_FLAGS_ONFIRE_DONE)
|
||||
MSCH_EVENT((" ONFIRE_DONE"));
|
||||
if (type & WL_MSCH_RC_FLAGS_SPLIT_SLOT_START)
|
||||
MSCH_EVENT((" SPLIT_SLOT_START"));
|
||||
if (type & WL_MSCH_RC_FLAGS_SPLIT_SLOT_END)
|
||||
MSCH_EVENT((" SPLIT_SLOT_END"));
|
||||
if (type & WL_MSCH_RC_FLAGS_PRE_ONFIRE_DONE)
|
||||
MSCH_EVENT((" PRE_ONFIRE_DONE"));
|
||||
}
|
||||
MSCH_EVENT(("\n"));
|
||||
|
||||
MSCH_EVENT_HEAD(sn);
|
||||
MSCH_EVENT(("pre_start_time: %s",
|
||||
dhd_mschdbg_display_time(p->pre_start_time_h, p->pre_start_time_l)));
|
||||
|
||||
MSCH_EVENT((", start_time: %s",
|
||||
dhd_mschdbg_display_time(p->start_time_h, p->start_time_l)));
|
||||
|
||||
MSCH_EVENT((", end_time: %s\n",
|
||||
dhd_mschdbg_display_time(p->end_time_h, p->end_time_l)));
|
||||
|
||||
if (p->p_timeslot && (p->timeslot_ptr == 0)) {
|
||||
MSCH_EVENT_HEAD(sn);
|
||||
MSCH_EVENT(("<%s timeslot>: 0x%08x\n", title, ntoh32(p->p_timeslot)));
|
||||
} else
|
||||
dhd_mschdbg_timeslot_profiler_event_data(sn, ver, title, data, p->timeslot_ptr,
|
||||
(p->timeslot_ptr == 0));
|
||||
}
|
||||
|
||||
static void
|
||||
dhd_mschdbg_chan_ctxt_profiler_event_data(int sp, int ver, char *data, uint16 ptr, bool empty)
|
||||
{
|
||||
int sn = sp + 4;
|
||||
msch_chan_ctxt_profiler_event_data_t *p =
|
||||
(msch_chan_ctxt_profiler_event_data_t *)(data + ntoh16(ptr));
|
||||
chanspec_t c;
|
||||
char buf[CHANSPEC_STR_LEN];
|
||||
|
||||
MSCH_EVENT_HEAD(sp);
|
||||
MSCH_EVENT(("<chan_ctxt>: "));
|
||||
if (empty) {
|
||||
MSCH_EVENT((" null\n"));
|
||||
return;
|
||||
}
|
||||
else
|
||||
MSCH_EVENT(("0x%08x (prev 0x%08x, next 0x%08x)\n",
|
||||
ntoh32(p->p_chan_ctxt), ntoh32(p->p_prev), ntoh32(p->p_next)));
|
||||
|
||||
c = (chanspec_t)ntoh16(p->chanspec);
|
||||
|
||||
MSCH_EVENT_HEAD(sn);
|
||||
MSCH_EVENT(("channel: %s, bf_sch_pending: %s, bf_skipped: %d\n",
|
||||
wf_chspec_ntoa(c, buf), p->bf_sch_pending? "TRUE" : "FALSE",
|
||||
ntoh32(p->bf_skipped_count)));
|
||||
|
||||
MSCH_EVENT_HEAD(sn);
|
||||
MSCH_EVENT(("bf_link: prev 0x%08x, next 0x%08x\n",
|
||||
ntoh32(p->bf_link_prev), ntoh32(p->bf_link_next)));
|
||||
|
||||
MSCH_EVENT_HEAD(sn);
|
||||
MSCH_EVENT(("onchan_time: %s",
|
||||
dhd_mschdbg_display_time(p->onchan_time_h, p->onchan_time_l)));
|
||||
MSCH_EVENT((", actual_onchan_dur: %s",
|
||||
dhd_mschdbg_display_time(p->actual_onchan_dur_h, p->actual_onchan_dur_l)));
|
||||
MSCH_EVENT((", pend_onchan_dur: %s\n",
|
||||
dhd_mschdbg_display_time(p->pend_onchan_dur_h, p->pend_onchan_dur_l)));
|
||||
|
||||
dhd_mschdbg_elem_list(sn, "req_entity", data, p->req_entity_list_ptr,
|
||||
p->req_entity_list_cnt);
|
||||
dhd_mschdbg_elem_list(sn, "bf_entity", data, p->bf_entity_list_ptr,
|
||||
p->bf_entity_list_cnt);
|
||||
}
|
||||
|
||||
static void
|
||||
dhd_mschdbg_req_entity_profiler_event_data(int sp, int ver, char *data, uint16 ptr, bool empty)
|
||||
{
|
||||
int sn = sp + 4;
|
||||
msch_req_entity_profiler_event_data_t *p =
|
||||
(msch_req_entity_profiler_event_data_t *)(data + ntoh16(ptr));
|
||||
char buf[CHANSPEC_STR_LEN];
|
||||
chanspec_t c;
|
||||
uint32 flags;
|
||||
|
||||
MSCH_EVENT_HEAD(sp);
|
||||
MSCH_EVENT(("<req_entity>: "));
|
||||
if (empty) {
|
||||
MSCH_EVENT((" null\n"));
|
||||
return;
|
||||
}
|
||||
else
|
||||
MSCH_EVENT(("0x%08x (prev 0x%08x, next 0x%08x)\n",
|
||||
ntoh32(p->p_req_entity), ntoh32(p->req_hdl_link_prev),
|
||||
ntoh32(p->req_hdl_link_next)));
|
||||
|
||||
MSCH_EVENT_HEAD(sn);
|
||||
MSCH_EVENT(("req_hdl: [0x%08x]\n", ntoh32(p->p_req_hdl)));
|
||||
|
||||
MSCH_EVENT_HEAD(sn);
|
||||
MSCH_EVENT(("chan_ctxt_link: prev 0x%08x, next 0x%08x\n",
|
||||
ntoh32(p->chan_ctxt_link_prev), ntoh32(p->chan_ctxt_link_next)));
|
||||
MSCH_EVENT_HEAD(sn);
|
||||
MSCH_EVENT(("rt_specific_link: prev 0x%08x, next 0x%08x\n",
|
||||
ntoh32(p->rt_specific_link_prev), ntoh32(p->rt_specific_link_next)));
|
||||
MSCH_EVENT_HEAD(sn);
|
||||
MSCH_EVENT(("start_fixed_link: prev 0x%08x, next 0x%08x\n",
|
||||
ntoh32(p->start_fixed_link_prev), ntoh32(p->start_fixed_link_next)));
|
||||
MSCH_EVENT_HEAD(sn);
|
||||
MSCH_EVENT(("both_flex_list: prev 0x%08x, next 0x%08x\n",
|
||||
ntoh32(p->both_flex_list_prev), ntoh32(p->both_flex_list_next)));
|
||||
|
||||
c = (chanspec_t)ntoh16(p->chanspec);
|
||||
MSCH_EVENT_HEAD(sn);
|
||||
if (ver >= 2) {
|
||||
MSCH_EVENT(("channel: %s, onchan Id %d, current chan Id %d, priority %d",
|
||||
wf_chspec_ntoa(c, buf), ntoh16(p->onchan_chn_idx), ntoh16(p->cur_chn_idx),
|
||||
ntoh16(p->priority)));
|
||||
flags = ntoh32(p->flags);
|
||||
if (flags & WL_MSCH_ENTITY_FLAG_MULTI_INSTANCE)
|
||||
MSCH_EVENT((" : MULTI_INSTANCE\n"));
|
||||
else
|
||||
MSCH_EVENT(("\n"));
|
||||
MSCH_EVENT_HEAD(sn);
|
||||
MSCH_EVENT(("actual_start_time: %s, ",
|
||||
dhd_mschdbg_display_time(p->actual_start_time_h, p->actual_start_time_l)));
|
||||
MSCH_EVENT(("curts_fire_time: %s, ",
|
||||
dhd_mschdbg_display_time(p->curts_fire_time_h, p->curts_fire_time_l)));
|
||||
} else {
|
||||
MSCH_EVENT(("channel: %s, priority %d, ", wf_chspec_ntoa(c, buf),
|
||||
ntoh16(p->priority)));
|
||||
}
|
||||
MSCH_EVENT(("bf_last_serv_time: %s\n",
|
||||
dhd_mschdbg_display_time(p->bf_last_serv_time_h, p->bf_last_serv_time_l)));
|
||||
|
||||
dhd_mschdbg_req_timing_profiler_event_data(sn, ver, "current", data, p->cur_slot_ptr,
|
||||
(p->cur_slot_ptr == 0));
|
||||
dhd_mschdbg_req_timing_profiler_event_data(sn, ver, "pending", data, p->pend_slot_ptr,
|
||||
(p->pend_slot_ptr == 0));
|
||||
|
||||
if (p->p_chan_ctxt && (p->chan_ctxt_ptr == 0)) {
|
||||
MSCH_EVENT_HEAD(sn);
|
||||
MSCH_EVENT(("<chan_ctxt>: 0x%08x\n", ntoh32(p->p_chan_ctxt)));
|
||||
}
|
||||
else
|
||||
dhd_mschdbg_chan_ctxt_profiler_event_data(sn, ver, data, p->chan_ctxt_ptr,
|
||||
(p->chan_ctxt_ptr == 0));
|
||||
}
|
||||
|
||||
static void
|
||||
dhd_mschdbg_req_handle_profiler_event_data(int sp, int ver, char *data, uint16 ptr, bool empty)
|
||||
{
|
||||
int sn = sp + 4;
|
||||
msch_req_handle_profiler_event_data_t *p =
|
||||
(msch_req_handle_profiler_event_data_t *)(data + ntoh16(ptr));
|
||||
uint32 flags;
|
||||
|
||||
MSCH_EVENT_HEAD(sp);
|
||||
MSCH_EVENT(("<req_handle>: "));
|
||||
if (empty) {
|
||||
MSCH_EVENT((" null\n"));
|
||||
return;
|
||||
}
|
||||
else
|
||||
MSCH_EVENT(("0x%08x (prev 0x%08x, next 0x%08x)\n",
|
||||
ntoh32(p->p_req_handle), ntoh32(p->p_prev), ntoh32(p->p_next)));
|
||||
|
||||
dhd_mschdbg_elem_list(sn, "req_entity", data, p->req_entity_list_ptr,
|
||||
p->req_entity_list_cnt);
|
||||
MSCH_EVENT_HEAD(sn);
|
||||
MSCH_EVENT(("cb_func: [0x%08x], cb_func: [0x%08x]",
|
||||
ntoh32(p->cb_func), ntoh32(p->cb_ctxt)));
|
||||
if (ver < 2) {
|
||||
MSCH_EVENT((", chan_cnt: %d", ntoh16(p->chan_cnt)));
|
||||
}
|
||||
flags = ntoh32(p->flags);
|
||||
if (flags & WL_MSCH_REQ_HDL_FLAGS_NEW_REQ)
|
||||
MSCH_EVENT((", NEW_REQ"));
|
||||
MSCH_EVENT(("\n"));
|
||||
|
||||
dhd_mschdbg_req_param_profiler_event_data(sn, ver, data, p->req_param_ptr);
|
||||
|
||||
if (ver >= 2) {
|
||||
MSCH_EVENT_HEAD(sn);
|
||||
MSCH_EVENT(("req_time: %s\n",
|
||||
dhd_mschdbg_display_time(p->req_time_h, p->req_time_l)));
|
||||
MSCH_EVENT_HEAD(sn);
|
||||
MSCH_EVENT(("chan_cnt: %d, chan idx %d, last chan idx %d\n",
|
||||
ntoh16(p->chan_cnt), ntoh16(p->chan_idx), ntoh16(p->last_chan_idx)));
|
||||
if (p->chanspec_list && p->chanspec_cnt) {
|
||||
dhd_mschdbg_chanspec_list(sn, data, p->chanspec_list, p->chanspec_cnt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
dhd_mschdbg_profiler_profiler_event_data(int sp, int ver, char *data, uint16 ptr)
|
||||
{
|
||||
msch_profiler_profiler_event_data_t *p =
|
||||
(msch_profiler_profiler_event_data_t *)(data + ntoh16(ptr));
|
||||
uint32 flags;
|
||||
|
||||
MSCH_EVENT_HEAD(sp);
|
||||
MSCH_EVENT(("free list: req_hdl 0x%08x, req_entity 0x%08x,"
|
||||
" chan_ctxt 0x%08x, chanspec 0x%08x\n",
|
||||
ntoh32(p->free_req_hdl_list), ntoh32(p->free_req_entity_list),
|
||||
ntoh32(p->free_chan_ctxt_list), ntoh32(p->free_chanspec_list)));
|
||||
|
||||
MSCH_EVENT_HEAD(sp);
|
||||
MSCH_EVENT(("alloc count: chanspec %d, req_entity %d, req_hdl %d, "
|
||||
"chan_ctxt %d, timeslot %d\n",
|
||||
ntoh16(p->msch_chanspec_alloc_cnt), ntoh16(p->msch_req_entity_alloc_cnt),
|
||||
ntoh16(p->msch_req_hdl_alloc_cnt), ntoh16(p->msch_chan_ctxt_alloc_cnt),
|
||||
ntoh16(p->msch_timeslot_alloc_cnt)));
|
||||
|
||||
dhd_mschdbg_elem_list(sp, "req_hdl", data, p->msch_req_hdl_list_ptr,
|
||||
p->msch_req_hdl_list_cnt);
|
||||
dhd_mschdbg_elem_list(sp, "chan_ctxt", data, p->msch_chan_ctxt_list_ptr,
|
||||
p->msch_chan_ctxt_list_cnt);
|
||||
dhd_mschdbg_elem_list(sp, "req_timing", data, p->msch_req_timing_list_ptr,
|
||||
p->msch_req_timing_list_cnt);
|
||||
dhd_mschdbg_elem_list(sp, "start_fixed", data, p->msch_start_fixed_list_ptr,
|
||||
p->msch_start_fixed_list_cnt);
|
||||
dhd_mschdbg_elem_list(sp, "both_flex_req_entity", data,
|
||||
p->msch_both_flex_req_entity_list_ptr,
|
||||
p->msch_both_flex_req_entity_list_cnt);
|
||||
dhd_mschdbg_elem_list(sp, "start_flex", data, p->msch_start_flex_list_ptr,
|
||||
p->msch_start_flex_list_cnt);
|
||||
dhd_mschdbg_elem_list(sp, "both_flex", data, p->msch_both_flex_list_ptr,
|
||||
p->msch_both_flex_list_cnt);
|
||||
|
||||
if (p->p_cur_msch_timeslot && (p->cur_msch_timeslot_ptr == 0)) {
|
||||
MSCH_EVENT_HEAD(sp);
|
||||
MSCH_EVENT(("<cur_msch timeslot>: 0x%08x\n",
|
||||
ntoh32(p->p_cur_msch_timeslot)));
|
||||
} else
|
||||
dhd_mschdbg_timeslot_profiler_event_data(sp, ver, "cur_msch", data,
|
||||
p->cur_msch_timeslot_ptr, (p->cur_msch_timeslot_ptr == 0));
|
||||
|
||||
if (p->p_next_timeslot && (p->next_timeslot_ptr == 0)) {
|
||||
MSCH_EVENT_HEAD(sp);
|
||||
MSCH_EVENT(("<next timeslot>: 0x%08x\n",
|
||||
ntoh32(p->p_next_timeslot)));
|
||||
} else
|
||||
dhd_mschdbg_timeslot_profiler_event_data(sp, ver, "next", data,
|
||||
p->next_timeslot_ptr, (p->next_timeslot_ptr == 0));
|
||||
|
||||
MSCH_EVENT_HEAD(sp);
|
||||
MSCH_EVENT(("ts_id: %d, ", ntoh32(p->ts_id)));
|
||||
flags = ntoh32(p->flags);
|
||||
if (flags & WL_MSCH_STATE_IN_TIEMR_CTXT)
|
||||
MSCH_EVENT(("IN_TIEMR_CTXT, "));
|
||||
if (flags & WL_MSCH_STATE_SCHD_PENDING)
|
||||
MSCH_EVENT(("SCHD_PENDING, "));
|
||||
MSCH_EVENT(("slotskip_flags: %d, cur_armed_timeslot: 0x%08x\n",
|
||||
(ver >= 2)? ntoh32(p->slotskip_flag) : 0, ntoh32(p->cur_armed_timeslot)));
|
||||
MSCH_EVENT_HEAD(sp);
|
||||
MSCH_EVENT(("flex_list_cnt: %d, service_interval: %d, "
|
||||
"max_lo_prio_interval: %d\n",
|
||||
ntoh16(p->flex_list_cnt), ntoh32(p->service_interval),
|
||||
ntoh32(p->max_lo_prio_interval)));
|
||||
}
|
||||
|
||||
static void dhd_mschdbg_dump_data(dhd_pub_t *dhdp, void *raw_event_ptr, int type,
|
||||
char *data, int len)
|
||||
{
|
||||
uint64 t = 0, tt = 0;
|
||||
uint32 s = 0, ss = 0;
|
||||
int wlc_index, ver;
|
||||
|
||||
ver = (type & WL_MSCH_PROFILER_VER_MASK) >> WL_MSCH_PROFILER_VER_SHIFT;
|
||||
wlc_index = (type & WL_MSCH_PROFILER_WLINDEX_MASK) >> WL_MSCH_PROFILER_WLINDEX_SHIFT;
|
||||
if (wlc_index >= 4)
|
||||
return;
|
||||
|
||||
type &= WL_MSCH_PROFILER_TYPE_MASK;
|
||||
if (type <= WL_MSCH_PROFILER_PROFILE_END) {
|
||||
msch_profiler_event_data_t *pevent = (msch_profiler_event_data_t *)data;
|
||||
tt = ((uint64)(ntoh32(pevent->time_hi)) << 32) | ntoh32(pevent->time_lo);
|
||||
dhd_mschdbg_us_to_sec(pevent->time_hi, pevent->time_lo, &s, &ss);
|
||||
}
|
||||
|
||||
if (lastMessages && (type != WL_MSCH_PROFILER_MESSAGE) &&
|
||||
(type != WL_MSCH_PROFILER_EVENT_LOG)) {
|
||||
MSCH_EVENT_HEAD(0);
|
||||
MSCH_EVENT(("\n"));
|
||||
lastMessages = FALSE;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case WL_MSCH_PROFILER_START:
|
||||
MSCH_EVENT_HEAD(0);
|
||||
MSCH_EVENT(("%06d.%06d START\n", s, ss));
|
||||
break;
|
||||
|
||||
case WL_MSCH_PROFILER_EXIT:
|
||||
MSCH_EVENT_HEAD(0);
|
||||
MSCH_EVENT(("%06d.%06d EXIT\n", s, ss));
|
||||
break;
|
||||
|
||||
case WL_MSCH_PROFILER_REQ:
|
||||
{
|
||||
msch_req_profiler_event_data_t *p = (msch_req_profiler_event_data_t *)data;
|
||||
MSCH_EVENT_HEAD(0);
|
||||
MSCH_EVENT(("\n"));
|
||||
MSCH_EVENT_HEAD(0);
|
||||
MSCH_EVENT(("===============================\n"));
|
||||
MSCH_EVENT_HEAD(0);
|
||||
MSCH_EVENT(("%06d.%06d [wl%d] REGISTER:\n", s, ss, wlc_index));
|
||||
dhd_mschdbg_req_param_profiler_event_data(4, ver, data, p->req_param_ptr);
|
||||
dhd_mschdbg_chanspec_list(4, data, p->chanspec_ptr, p->chanspec_cnt);
|
||||
MSCH_EVENT_HEAD(0);
|
||||
MSCH_EVENT(("===============================\n"));
|
||||
MSCH_EVENT_HEAD(0);
|
||||
MSCH_EVENT(("\n"));
|
||||
}
|
||||
break;
|
||||
|
||||
case WL_MSCH_PROFILER_CALLBACK:
|
||||
{
|
||||
msch_callback_profiler_event_data_t *p =
|
||||
(msch_callback_profiler_event_data_t *)data;
|
||||
char buf[CHANSPEC_STR_LEN];
|
||||
chanspec_t chanspec;
|
||||
uint16 cbtype;
|
||||
|
||||
MSCH_EVENT_HEAD(0);
|
||||
MSCH_EVENT(("%06d.%06d [wl%d] CALLBACK: ", s, ss, wlc_index));
|
||||
chanspec = (chanspec_t)ntoh16(p->chanspec);
|
||||
MSCH_EVENT(("req_hdl[0x%08x], channel %s --",
|
||||
ntoh32(p->p_req_hdl), wf_chspec_ntoa(chanspec, buf)));
|
||||
|
||||
cbtype = ntoh16(p->type);
|
||||
if (cbtype & WL_MSCH_CT_ON_CHAN)
|
||||
MSCH_EVENT((" ON_CHAN"));
|
||||
if (cbtype & WL_MSCH_CT_OFF_CHAN)
|
||||
MSCH_EVENT((" OFF_CHAN"));
|
||||
if (cbtype & WL_MSCH_CT_REQ_START)
|
||||
MSCH_EVENT((" REQ_START"));
|
||||
if (cbtype & WL_MSCH_CT_REQ_END)
|
||||
MSCH_EVENT((" REQ_END"));
|
||||
if (cbtype & WL_MSCH_CT_SLOT_START)
|
||||
MSCH_EVENT((" SLOT_START"));
|
||||
if (cbtype & WL_MSCH_CT_SLOT_SKIP)
|
||||
MSCH_EVENT((" SLOT_SKIP"));
|
||||
if (cbtype & WL_MSCH_CT_SLOT_END)
|
||||
MSCH_EVENT((" SLOT_END"));
|
||||
if (cbtype & WL_MSCH_CT_OFF_CHAN_DONE)
|
||||
MSCH_EVENT((" OFF_CHAN_DONE"));
|
||||
if (cbtype & WL_MSCH_CT_PARTIAL)
|
||||
MSCH_EVENT((" PARTIAL"));
|
||||
if (cbtype & WL_MSCH_CT_PRE_ONCHAN)
|
||||
MSCH_EVENT((" PRE_ONCHAN"));
|
||||
if (cbtype & WL_MSCH_CT_PRE_REQ_START)
|
||||
MSCH_EVENT((" PRE_REQ_START"));
|
||||
|
||||
if (cbtype & WL_MSCH_CT_REQ_START) {
|
||||
req_start[wlc_index] = 1;
|
||||
req_start_time[wlc_index] = tt;
|
||||
} else if (cbtype & WL_MSCH_CT_REQ_END) {
|
||||
if (req_start[wlc_index]) {
|
||||
MSCH_EVENT((" : REQ duration %d",
|
||||
(uint32)(tt - req_start_time[wlc_index])));
|
||||
req_start[wlc_index] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (cbtype & WL_MSCH_CT_SLOT_START) {
|
||||
solt_chanspec[wlc_index] = p->chanspec;
|
||||
solt_start_time[wlc_index] = tt;
|
||||
} else if (cbtype & WL_MSCH_CT_SLOT_END) {
|
||||
if (p->chanspec == solt_chanspec[wlc_index]) {
|
||||
MSCH_EVENT((" : SLOT duration %d",
|
||||
(uint32)(tt - solt_start_time[wlc_index])));
|
||||
solt_chanspec[wlc_index] = 0;
|
||||
}
|
||||
}
|
||||
MSCH_EVENT(("\n"));
|
||||
|
||||
if (cbtype & (WL_MSCH_CT_ON_CHAN | WL_MSCH_CT_SLOT_SKIP)) {
|
||||
MSCH_EVENT_HEAD(4);
|
||||
if (cbtype & WL_MSCH_CT_ON_CHAN) {
|
||||
MSCH_EVENT(("ID %d onchan idx %d cur_chan_seq_start %s ",
|
||||
ntoh32(p->timeslot_id), ntoh32(p->onchan_idx),
|
||||
dhd_mschdbg_display_time(p->cur_chan_seq_start_time_h,
|
||||
p->cur_chan_seq_start_time_l)));
|
||||
}
|
||||
t = ((uint64)(ntoh32(p->start_time_h)) << 32) |
|
||||
ntoh32(p->start_time_l);
|
||||
MSCH_EVENT(("start %s ",
|
||||
dhd_mschdbg_display_time(p->start_time_h,
|
||||
p->start_time_l)));
|
||||
tt = ((uint64)(ntoh32(p->end_time_h)) << 32) | ntoh32(p->end_time_l);
|
||||
MSCH_EVENT(("end %s duration %d\n",
|
||||
dhd_mschdbg_display_time(p->end_time_h, p->end_time_l),
|
||||
(p->end_time_h == 0xffffffff && p->end_time_l == 0xffffffff)?
|
||||
-1 : (int)(tt - t)));
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case WL_MSCH_PROFILER_EVENT_LOG:
|
||||
{
|
||||
while (len > 0) {
|
||||
msch_event_log_profiler_event_data_t *p =
|
||||
(msch_event_log_profiler_event_data_t *)data;
|
||||
int size = WL_MSCH_EVENT_LOG_HEAD_SIZE + p->hdr.count * sizeof(uint32);
|
||||
data += size;
|
||||
len -= size;
|
||||
dhd_mschdbg_us_to_sec(p->time_hi, p->time_lo, &s, &ss);
|
||||
MSCH_EVENT_HEAD(0);
|
||||
MSCH_EVENT(("%06d.%06d [wl%d]: ", s, ss, p->hdr.tag));
|
||||
p->hdr.tag = EVENT_LOG_TAG_MSCHPROFILE;
|
||||
p->hdr.fmt_num = ntoh16(p->hdr.fmt_num);
|
||||
dhd_dbg_verboselog_printf(dhdp, &p->hdr, raw_event_ptr, p->data);
|
||||
}
|
||||
lastMessages = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
case WL_MSCH_PROFILER_MESSAGE:
|
||||
{
|
||||
msch_message_profiler_event_data_t *p = (msch_message_profiler_event_data_t *)data;
|
||||
MSCH_EVENT_HEAD(0);
|
||||
MSCH_EVENT(("%06d.%06d [wl%d]: %s", s, ss, wlc_index, p->message));
|
||||
lastMessages = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
case WL_MSCH_PROFILER_PROFILE_START:
|
||||
profiler_start_time[wlc_index] = tt;
|
||||
MSCH_EVENT_HEAD(0);
|
||||
MSCH_EVENT(("-------------------------------\n"));
|
||||
MSCH_EVENT_HEAD(0);
|
||||
MSCH_EVENT(("%06d.%06d [wl%d] PROFILE DATA:\n", s, ss, wlc_index));
|
||||
dhd_mschdbg_profiler_profiler_event_data(4, ver, data, 0);
|
||||
break;
|
||||
|
||||
case WL_MSCH_PROFILER_PROFILE_END:
|
||||
MSCH_EVENT_HEAD(0);
|
||||
MSCH_EVENT(("%06d.%06d [wl%d] PROFILE END: take time %d\n", s, ss,
|
||||
wlc_index, (uint32)(tt - profiler_start_time[wlc_index])));
|
||||
MSCH_EVENT_HEAD(0);
|
||||
MSCH_EVENT(("-------------------------------\n"));
|
||||
MSCH_EVENT_HEAD(0);
|
||||
MSCH_EVENT(("\n"));
|
||||
break;
|
||||
|
||||
case WL_MSCH_PROFILER_REQ_HANDLE:
|
||||
dhd_mschdbg_req_handle_profiler_event_data(4, ver, data, 0, FALSE);
|
||||
break;
|
||||
|
||||
case WL_MSCH_PROFILER_REQ_ENTITY:
|
||||
dhd_mschdbg_req_entity_profiler_event_data(4, ver, data, 0, FALSE);
|
||||
break;
|
||||
|
||||
case WL_MSCH_PROFILER_CHAN_CTXT:
|
||||
dhd_mschdbg_chan_ctxt_profiler_event_data(4, ver, data, 0, FALSE);
|
||||
break;
|
||||
|
||||
case WL_MSCH_PROFILER_REQ_TIMING:
|
||||
dhd_mschdbg_req_timing_profiler_event_data(4, ver, "msch", data, 0, FALSE);
|
||||
break;
|
||||
|
||||
default:
|
||||
MSCH_EVENT_HEAD(0);
|
||||
MSCH_EVENT(("[wl%d] ERROR: unsupported EVENT reason code:%d; ",
|
||||
wlc_index, type));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
wl_mschdbg_event_handler(dhd_pub_t *dhdp, void *raw_event_ptr, int type, void *data, int len)
|
||||
{
|
||||
head_log = "MSCH";
|
||||
dhd_mschdbg_dump_data(dhdp, raw_event_ptr, type, (char *)data, len);
|
||||
}
|
||||
|
||||
void
|
||||
wl_mschdbg_verboselog_handler(dhd_pub_t *dhdp, void *raw_event_ptr, int tag, uint32 *log_ptr)
|
||||
{
|
||||
head_log = "CONSOLE";
|
||||
if (tag == EVENT_LOG_TAG_MSCHPROFILE) {
|
||||
msch_event_log_profiler_event_data_t *p =
|
||||
(msch_event_log_profiler_event_data_t *)log_ptr;
|
||||
uint32 s, ss;
|
||||
dhd_mschdbg_us_to_sec(p->time_hi, p->time_lo, &s, &ss);
|
||||
MSCH_EVENT_HEAD(0);
|
||||
MSCH_EVENT(("%06d.%06d [wl%d]: ", s, ss, p->hdr.tag));
|
||||
p->hdr.tag = EVENT_LOG_TAG_MSCHPROFILE;
|
||||
p->hdr.fmt_num = ntoh16(p->hdr.fmt_num);
|
||||
dhd_dbg_verboselog_printf(dhdp, &p->hdr, raw_event_ptr, p->data);
|
||||
} else {
|
||||
msch_collect_tlv_t *p = (msch_collect_tlv_t *)log_ptr;
|
||||
int type = ntoh16(p->type);
|
||||
int len = ntoh16(p->size);
|
||||
dhd_mschdbg_dump_data(dhdp, raw_event_ptr, type, p->value, len);
|
||||
}
|
||||
}
|
||||
#endif /* SHOW_LOGTRACE */
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* DHD debugability header file
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
* $Id: dhd_mschdbg.h 571265 2015-07-14 20:50:18Z $
|
||||
*/
|
||||
|
||||
#ifndef _dhd_mschdbg_h_
|
||||
#define _dhd_mschdbg_h_
|
||||
|
||||
#ifdef SHOW_LOGTRACE
|
||||
extern void wl_mschdbg_event_handler(dhd_pub_t *dhdp, void *raw_event_ptr, int type,
|
||||
void *data, int len);
|
||||
extern void wl_mschdbg_verboselog_handler(dhd_pub_t *dhdp, void *raw_event_ptr, int tag,
|
||||
uint32 *log_ptr);
|
||||
#endif /* SHOW_LOGTRACE */
|
||||
|
||||
#endif /* _dhd_mschdbg_h_ */
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,607 @@
|
|||
/*
|
||||
* Linux DHD Bus Module for PCIE
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: dhd_pcie.h 707536 2017-06-28 04:23:48Z $
|
||||
*/
|
||||
|
||||
|
||||
#ifndef dhd_pcie_h
|
||||
#define dhd_pcie_h
|
||||
|
||||
#include <bcmpcie.h>
|
||||
#include <hnd_cons.h>
|
||||
#ifdef SUPPORT_LINKDOWN_RECOVERY
|
||||
#ifdef CONFIG_ARCH_MSM
|
||||
#ifdef CONFIG_PCI_MSM
|
||||
#include <linux/msm_pcie.h>
|
||||
#else
|
||||
#include <mach/msm_pcie.h>
|
||||
#endif /* CONFIG_PCI_MSM */
|
||||
#endif /* CONFIG_ARCH_MSM */
|
||||
#ifdef EXYNOS_PCIE_LINKDOWN_RECOVERY
|
||||
#if defined(CONFIG_SOC_EXYNOS8890) || defined(CONFIG_SOC_EXYNOS8895)
|
||||
#include <linux/exynos-pci-noti.h>
|
||||
extern int exynos_pcie_register_event(struct exynos_pcie_register_event *reg);
|
||||
extern int exynos_pcie_deregister_event(struct exynos_pcie_register_event *reg);
|
||||
#endif /* CONFIG_SOC_EXYNOS8890 || CONFIG_SOC_EXYNOS8895 */
|
||||
#endif /* EXYNOS_PCIE_LINKDOWN_RECOVERY */
|
||||
#endif /* SUPPORT_LINKDOWN_RECOVERY */
|
||||
|
||||
#ifdef DHD_PCIE_RUNTIMEPM
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/wait.h>
|
||||
|
||||
#define DEFAULT_DHD_RUNTIME_MS 100
|
||||
#ifndef CUSTOM_DHD_RUNTIME_MS
|
||||
#define CUSTOM_DHD_RUNTIME_MS DEFAULT_DHD_RUNTIME_MS
|
||||
#endif /* CUSTOM_DHD_RUNTIME_MS */
|
||||
|
||||
|
||||
#ifndef MAX_IDLE_COUNT
|
||||
#define MAX_IDLE_COUNT 16
|
||||
#endif /* MAX_IDLE_COUNT */
|
||||
|
||||
#ifndef MAX_RESUME_WAIT
|
||||
#define MAX_RESUME_WAIT 100
|
||||
#endif /* MAX_RESUME_WAIT */
|
||||
#endif /* DHD_PCIE_RUNTIMEPM */
|
||||
|
||||
/* defines */
|
||||
|
||||
#define PCMSGBUF_HDRLEN 0
|
||||
#define DONGLE_REG_MAP_SIZE (32 * 1024)
|
||||
#define DONGLE_TCM_MAP_SIZE (4096 * 1024)
|
||||
#define DONGLE_MIN_MEMSIZE (128 *1024)
|
||||
#ifdef DHD_DEBUG
|
||||
#define DHD_PCIE_SUCCESS 0
|
||||
#define DHD_PCIE_FAILURE 1
|
||||
#endif /* DHD_DEBUG */
|
||||
#define REMAP_ENAB(bus) ((bus)->remap)
|
||||
#define REMAP_ISADDR(bus, a) (((a) >= ((bus)->orig_ramsize)) && ((a) < ((bus)->ramsize)))
|
||||
|
||||
#ifdef SUPPORT_LINKDOWN_RECOVERY
|
||||
#ifdef CONFIG_ARCH_MSM
|
||||
#define struct_pcie_notify struct msm_pcie_notify
|
||||
#define struct_pcie_register_event struct msm_pcie_register_event
|
||||
#endif /* CONFIG_ARCH_MSM */
|
||||
#ifdef EXYNOS_PCIE_LINKDOWN_RECOVERY
|
||||
#if defined(CONFIG_SOC_EXYNOS8890) || defined(CONFIG_SOC_EXYNOS8895)
|
||||
#define struct_pcie_notify struct exynos_pcie_notify
|
||||
#define struct_pcie_register_event struct exynos_pcie_register_event
|
||||
#endif /* CONFIG_SOC_EXYNOS8890 || CONFIG_SOC_EXYNOS8895 */
|
||||
#endif /* EXYNOS_PCIE_LINKDOWN_RECOVERY */
|
||||
#endif /* SUPPORT_LINKDOWN_RECOVERY */
|
||||
|
||||
#define MAX_DHD_TX_FLOWS 320
|
||||
|
||||
/* user defined data structures */
|
||||
/* Device console log buffer state */
|
||||
#define CONSOLE_LINE_MAX 192
|
||||
#define CONSOLE_BUFFER_MAX (8 * 1024)
|
||||
|
||||
#ifdef IDLE_TX_FLOW_MGMT
|
||||
#define IDLE_FLOW_LIST_TIMEOUT 5000
|
||||
#define IDLE_FLOW_RING_TIMEOUT 5000
|
||||
#endif /* IDLE_TX_FLOW_MGMT */
|
||||
|
||||
#ifdef DEVICE_TX_STUCK_DETECT
|
||||
#define DEVICE_TX_STUCK_CKECK_TIMEOUT 1000 /* 1 sec */
|
||||
#define DEVICE_TX_STUCK_TIMEOUT 10000 /* 10 secs */
|
||||
#define DEVICE_TX_STUCK_WARN_DURATION (DEVICE_TX_STUCK_TIMEOUT / DEVICE_TX_STUCK_CKECK_TIMEOUT)
|
||||
#define DEVICE_TX_STUCK_DURATION (DEVICE_TX_STUCK_WARN_DURATION * 2)
|
||||
#endif /* DEVICE_TX_STUCK_DETECT */
|
||||
|
||||
/* implicit DMA for h2d wr and d2h rd indice from Host memory to TCM */
|
||||
#define IDMA_ENAB(dhd) ((dhd)->idma_enable)
|
||||
#define IDMA_ACTIVE(dhd) (((dhd)->idma_enable) && ((dhd)->idma_inited))
|
||||
|
||||
#define IDMA_DS_ENAB(dhd) ((dhd)->idma_retention_ds)
|
||||
#define IDMA_DS_ACTIVE(dhd) ((dhd)->bus->dongle_in_ds)
|
||||
|
||||
/* IFRM (Implicit Flow Ring Manager enable and inited */
|
||||
#define IFRM_ENAB(dhd) ((dhd)->ifrm_enable)
|
||||
#define IFRM_ACTIVE(dhd) (((dhd)->ifrm_enable) && ((dhd)->ifrm_inited))
|
||||
|
||||
/* PCIE CTO Prevention and Recovery */
|
||||
#define PCIECTO_ENAB(dhd) ((dhd)->cto_enable)
|
||||
|
||||
/* Implicit DMA index usage :
|
||||
* Index 0 for h2d write index transfer
|
||||
* Index 1 for d2h read index transfer
|
||||
*/
|
||||
#define IDMA_IDX0 0
|
||||
#define IDMA_IDX1 1
|
||||
#define IDMA_IDX2 2
|
||||
#define IDMA_IDX3 3
|
||||
|
||||
#define DHDPCIE_CONFIG_HDR_SIZE 16
|
||||
#define DHDPCIE_CONFIG_CHECK_DELAY_MS 10 /* 10ms */
|
||||
#define DHDPCIE_CONFIG_CHECK_RETRY_COUNT 20
|
||||
#define DHDPCIE_DONGLE_PWR_TOGGLE_DELAY 1000 /* 1ms in units of us */
|
||||
#define DHDPCIE_PM_D3_DELAY 200000 /* 200ms in units of us */
|
||||
#define DHDPCIE_PM_D2_DELAY 200 /* 200us */
|
||||
|
||||
typedef struct dhd_console {
|
||||
uint count; /* Poll interval msec counter */
|
||||
uint log_addr; /* Log struct address (fixed) */
|
||||
hnd_log_t log; /* Log struct (host copy) */
|
||||
uint bufsize; /* Size of log buffer */
|
||||
uint8 *buf; /* Log buffer (host copy) */
|
||||
uint last; /* Last buffer read index */
|
||||
} dhd_console_t;
|
||||
|
||||
typedef struct ring_sh_info {
|
||||
uint32 ring_mem_addr;
|
||||
uint32 ring_state_w;
|
||||
uint32 ring_state_r;
|
||||
} ring_sh_info_t;
|
||||
|
||||
|
||||
#define DEVICE_WAKE_NONE 0
|
||||
#define DEVICE_WAKE_OOB 1
|
||||
#define DEVICE_WAKE_INB 2
|
||||
|
||||
#define INBAND_DW_ENAB(bus) ((bus)->dw_option == DEVICE_WAKE_INB)
|
||||
#define OOB_DW_ENAB(bus) ((bus)->dw_option == DEVICE_WAKE_OOB)
|
||||
#define NO_DW_ENAB(bus) ((bus)->dw_option == DEVICE_WAKE_NONE)
|
||||
|
||||
struct dhd_bus;
|
||||
|
||||
struct dhd_pcie_rev {
|
||||
uint8 fw_rev;
|
||||
void (*handle_mb_data)(struct dhd_bus *);
|
||||
};
|
||||
|
||||
typedef struct dhdpcie_config_save
|
||||
{
|
||||
uint32 header[DHDPCIE_CONFIG_HDR_SIZE];
|
||||
/* pmcsr save */
|
||||
uint32 pmcsr;
|
||||
/* express save */
|
||||
uint32 exp_dev_ctrl_stat;
|
||||
uint32 exp_link_ctrl_stat;
|
||||
uint32 exp_dev_ctrl_stat2;
|
||||
uint32 exp_link_ctrl_stat2;
|
||||
/* msi save */
|
||||
uint32 msi_cap;
|
||||
uint32 msi_addr0;
|
||||
uint32 msi_addr1;
|
||||
uint32 msi_data;
|
||||
/* l1pm save */
|
||||
uint32 l1pm0;
|
||||
uint32 l1pm1;
|
||||
/* ltr save */
|
||||
uint32 ltr;
|
||||
/* aer save */
|
||||
uint32 aer_caps_ctrl; /* 0x18 */
|
||||
uint32 aer_severity; /* 0x0C */
|
||||
uint32 aer_umask; /* 0x08 */
|
||||
uint32 aer_cmask; /* 0x14 */
|
||||
uint32 aer_root_cmd; /* 0x2c */
|
||||
/* BAR0 and BAR1 windows */
|
||||
uint32 bar0_win;
|
||||
uint32 bar1_win;
|
||||
} dhdpcie_config_save_t;
|
||||
|
||||
typedef struct dhd_bus {
|
||||
dhd_pub_t *dhd;
|
||||
struct pci_dev *rc_dev; /* pci RC device handle */
|
||||
struct pci_dev *dev; /* pci device handle */
|
||||
#ifdef DHD_EFI
|
||||
void *pcie_dev;
|
||||
#endif
|
||||
|
||||
dll_t flowring_active_list; /* constructed list of tx flowring queues */
|
||||
#ifdef IDLE_TX_FLOW_MGMT
|
||||
uint64 active_list_last_process_ts;
|
||||
/* stores the timestamp of active list processing */
|
||||
#endif /* IDLE_TX_FLOW_MGMT */
|
||||
|
||||
#ifdef DEVICE_TX_STUCK_DETECT
|
||||
/* Flag to enable/disable device tx stuck monitor by DHD IOVAR dev_tx_stuck_monitor */
|
||||
uint32 dev_tx_stuck_monitor;
|
||||
/* Stores the timestamp (msec) of the last device Tx stuck check */
|
||||
uint32 device_tx_stuck_check;
|
||||
#endif /* DEVICE_TX_STUCK_DETECT */
|
||||
|
||||
si_t *sih; /* Handle for SI calls */
|
||||
char *vars; /* Variables (from CIS and/or other) */
|
||||
uint varsz; /* Size of variables buffer */
|
||||
uint32 sbaddr; /* Current SB window pointer (-1, invalid) */
|
||||
sbpcieregs_t *reg; /* Registers for PCIE core */
|
||||
|
||||
uint armrev; /* CPU core revision */
|
||||
uint ramrev; /* SOCRAM core revision */
|
||||
uint32 ramsize; /* Size of RAM in SOCRAM (bytes) */
|
||||
uint32 orig_ramsize; /* Size of RAM in SOCRAM (bytes) */
|
||||
bool ramsize_adjusted; /* flag to note adjustment, so that
|
||||
* adjustment routine and file io
|
||||
* are avoided on D3 cold -> D0
|
||||
*/
|
||||
uint32 srmemsize; /* Size of SRMEM */
|
||||
|
||||
uint32 bus; /* gSPI or SDIO bus */
|
||||
uint32 intstatus; /* Intstatus bits (events) pending */
|
||||
bool dpc_sched; /* Indicates DPC schedule (intrpt rcvd) */
|
||||
bool fcstate; /* State of dongle flow-control */
|
||||
|
||||
uint16 cl_devid; /* cached devid for dhdsdio_probe_attach() */
|
||||
char *fw_path; /* module_param: path to firmware image */
|
||||
char *nv_path; /* module_param: path to nvram vars file */
|
||||
#ifdef CACHE_FW_IMAGES
|
||||
int processed_nvram_params_len; /* Modified len of NVRAM info */
|
||||
#endif
|
||||
|
||||
|
||||
struct pktq txq; /* Queue length used for flow-control */
|
||||
|
||||
bool intr; /* Use interrupts */
|
||||
bool poll; /* Use polling */
|
||||
bool ipend; /* Device interrupt is pending */
|
||||
bool intdis; /* Interrupts disabled by isr */
|
||||
uint intrcount; /* Count of device interrupt callbacks */
|
||||
uint lastintrs; /* Count as of last watchdog timer */
|
||||
|
||||
dhd_console_t console; /* Console output polling support */
|
||||
uint console_addr; /* Console address from shared struct */
|
||||
|
||||
bool alp_only; /* Don't use HT clock (ALP only) */
|
||||
|
||||
bool remap; /* Contiguous 1MB RAM: 512K socram + 512K devram
|
||||
* Available with socram rev 16
|
||||
* Remap region not DMA-able
|
||||
*/
|
||||
uint32 resetinstr;
|
||||
uint32 dongle_ram_base;
|
||||
|
||||
ulong shared_addr;
|
||||
pciedev_shared_t *pcie_sh;
|
||||
bool bus_flowctrl;
|
||||
uint32 dma_rxoffset;
|
||||
volatile char *regs; /* pci device memory va */
|
||||
volatile char *tcm; /* pci device memory va */
|
||||
osl_t *osh;
|
||||
uint32 nvram_csm; /* Nvram checksum */
|
||||
uint16 pollrate;
|
||||
uint16 polltick;
|
||||
|
||||
volatile uint32 *pcie_mb_intr_addr;
|
||||
volatile uint32 *pcie_mb_intr_2_addr;
|
||||
void *pcie_mb_intr_osh;
|
||||
bool sleep_allowed;
|
||||
|
||||
wake_counts_t wake_counts;
|
||||
|
||||
/* version 3 shared struct related info start */
|
||||
ring_sh_info_t ring_sh[BCMPCIE_COMMON_MSGRINGS + MAX_DHD_TX_FLOWS];
|
||||
|
||||
uint8 h2d_ring_count;
|
||||
uint8 d2h_ring_count;
|
||||
uint32 ringmem_ptr;
|
||||
uint32 ring_state_ptr;
|
||||
|
||||
uint32 d2h_dma_scratch_buffer_mem_addr;
|
||||
|
||||
uint32 h2d_mb_data_ptr_addr;
|
||||
uint32 d2h_mb_data_ptr_addr;
|
||||
/* version 3 shared struct related info end */
|
||||
|
||||
uint32 def_intmask;
|
||||
bool ltrsleep_on_unload;
|
||||
uint wait_for_d3_ack;
|
||||
uint16 max_tx_flowrings;
|
||||
uint16 max_submission_rings;
|
||||
uint16 max_completion_rings;
|
||||
uint16 max_cmn_rings;
|
||||
uint32 rw_index_sz;
|
||||
bool db1_for_mb;
|
||||
|
||||
dhd_timeout_t doorbell_timer;
|
||||
bool device_wake_state;
|
||||
#ifdef PCIE_OOB
|
||||
bool oob_enabled;
|
||||
#endif /* PCIE_OOB */
|
||||
bool irq_registered;
|
||||
#ifdef SUPPORT_LINKDOWN_RECOVERY
|
||||
#if defined(CONFIG_ARCH_MSM) || (defined(EXYNOS_PCIE_LINKDOWN_RECOVERY) && \
|
||||
defined(CONFIG_SOC_EXYNOS8890) || defined(CONFIG_SOC_EXYNOS8895))
|
||||
#ifdef CONFIG_ARCH_MSM
|
||||
uint8 no_cfg_restore;
|
||||
#endif /* CONFIG_ARCH_MSM */
|
||||
struct_pcie_register_event pcie_event;
|
||||
#endif /* CONFIG_ARCH_MSM || (EXYNOS_PCIE_LINKDOWN_RECOVERY &&
|
||||
* (CONFIG_SOC_EXYNOS8890 || CONFIG_SOC_EXYNOS8895))
|
||||
*/
|
||||
bool read_shm_fail;
|
||||
#endif /* SUPPORT_LINKDOWN_RECOVERY */
|
||||
int32 idletime; /* Control for activity timeout */
|
||||
#ifdef DHD_PCIE_RUNTIMEPM
|
||||
int32 idlecount; /* Activity timeout counter */
|
||||
int32 bus_wake; /* For wake up the bus */
|
||||
bool runtime_resume_done; /* For check runtime suspend end */
|
||||
struct mutex pm_lock; /* Synchronize for system PM & runtime PM */
|
||||
wait_queue_head_t rpm_queue; /* wait-queue for bus wake up */
|
||||
#endif /* DHD_PCIE_RUNTIMEPM */
|
||||
uint32 d3_inform_cnt;
|
||||
uint32 d0_inform_cnt;
|
||||
uint32 d0_inform_in_use_cnt;
|
||||
uint8 force_suspend;
|
||||
uint8 is_linkdown;
|
||||
#ifdef IDLE_TX_FLOW_MGMT
|
||||
bool enable_idle_flowring_mgmt;
|
||||
#endif /* IDLE_TX_FLOW_MGMT */
|
||||
struct dhd_pcie_rev api;
|
||||
bool use_mailbox;
|
||||
bool d3_suspend_pending;
|
||||
bool use_d0_inform;
|
||||
uint32 hostready_count; /* Number of hostready issued */
|
||||
#if defined(PCIE_OOB) || defined(BCMPCIE_OOB_HOST_WAKE)
|
||||
bool oob_presuspend;
|
||||
#endif /* PCIE_OOB || BCMPCIE_OOB_HOST_WAKE */
|
||||
bool dongle_in_ds;
|
||||
uint8 dw_option;
|
||||
#ifdef PCIE_INB_DW
|
||||
bool inb_enabled;
|
||||
uint32 ds_exit_timeout;
|
||||
uint32 host_sleep_exit_timeout;
|
||||
uint wait_for_ds_exit;
|
||||
uint32 inband_dw_assert_cnt; /* # of inband device_wake assert */
|
||||
uint32 inband_dw_deassert_cnt; /* # of inband device_wake deassert */
|
||||
uint32 inband_ds_exit_host_cnt; /* # of DS-EXIT , host initiated */
|
||||
uint32 inband_ds_exit_device_cnt; /* # of DS-EXIT , device initiated */
|
||||
uint32 inband_ds_exit_to_cnt; /* # of DS-EXIT timeout */
|
||||
uint32 inband_host_sleep_exit_to_cnt; /* # of Host_Sleep exit timeout */
|
||||
void *inb_lock; /* Lock to serialize in band device wake activity */
|
||||
/* # of contexts in the host which currently want a FW transaction */
|
||||
uint32 host_active_cnt;
|
||||
#endif /* PCIE_INB_DW */
|
||||
dhdpcie_config_save_t saved_config;
|
||||
ulong resume_intr_enable_count;
|
||||
ulong dpc_intr_enable_count;
|
||||
ulong isr_intr_disable_count;
|
||||
ulong suspend_intr_disable_count;
|
||||
ulong dpc_return_busdown_count;
|
||||
bool idma_enabled;
|
||||
bool ifrm_enabled;
|
||||
#if defined(PCIE_OOB) || defined(PCIE_INB_DW)
|
||||
bool ds_enabled;
|
||||
#endif
|
||||
#ifdef DHD_PCIE_RUNTIMEPM
|
||||
bool chk_pm; /* To avoid counting of wake up from Runtime PM */
|
||||
#endif /* DHD_PCIE_RUNTIMEPM */
|
||||
} dhd_bus_t;
|
||||
|
||||
/* function declarations */
|
||||
|
||||
extern uint32* dhdpcie_bus_reg_map(osl_t *osh, ulong addr, int size);
|
||||
extern int dhdpcie_bus_register(void);
|
||||
extern void dhdpcie_bus_unregister(void);
|
||||
extern bool dhdpcie_chipmatch(uint16 vendor, uint16 device);
|
||||
|
||||
extern struct dhd_bus* dhdpcie_bus_attach(osl_t *osh,
|
||||
volatile char *regs, volatile char *tcm, void *pci_dev);
|
||||
extern uint32 dhdpcie_bus_cfg_read_dword(struct dhd_bus *bus, uint32 addr, uint32 size);
|
||||
extern void dhdpcie_bus_cfg_write_dword(struct dhd_bus *bus, uint32 addr, uint32 size, uint32 data);
|
||||
extern void dhdpcie_bus_intr_enable(struct dhd_bus *bus);
|
||||
extern void dhdpcie_bus_intr_disable(struct dhd_bus *bus);
|
||||
extern int dhpcie_bus_mask_interrupt(dhd_bus_t *bus);
|
||||
extern void dhdpcie_bus_release(struct dhd_bus *bus);
|
||||
extern int32 dhdpcie_bus_isr(struct dhd_bus *bus);
|
||||
extern void dhdpcie_free_irq(dhd_bus_t *bus);
|
||||
extern void dhdpcie_bus_ringbell_fast(struct dhd_bus *bus, uint32 value);
|
||||
extern void dhdpcie_bus_ringbell_2_fast(struct dhd_bus *bus, uint32 value, bool devwake);
|
||||
extern int dhdpcie_bus_suspend(struct dhd_bus *bus, bool state);
|
||||
extern int dhdpcie_pci_suspend_resume(struct dhd_bus *bus, bool state);
|
||||
extern uint32 dhdpcie_force_alp(struct dhd_bus *bus, bool enable);
|
||||
extern uint32 dhdpcie_set_l1_entry_time(struct dhd_bus *bus, int force_l1_entry_time);
|
||||
extern bool dhdpcie_tcm_valid(dhd_bus_t *bus);
|
||||
extern void dhdpcie_pme_active(osl_t *osh, bool enable);
|
||||
extern bool dhdpcie_pme_cap(osl_t *osh);
|
||||
extern uint32 dhdpcie_lcreg(osl_t *osh, uint32 mask, uint32 val);
|
||||
extern void dhdpcie_set_pmu_min_res_mask(struct dhd_bus *bus, uint min_res_mask);
|
||||
extern uint8 dhdpcie_clkreq(osl_t *osh, uint32 mask, uint32 val);
|
||||
extern int dhdpcie_disable_irq(dhd_bus_t *bus);
|
||||
extern int dhdpcie_disable_irq_nosync(dhd_bus_t *bus);
|
||||
extern int dhdpcie_enable_irq(dhd_bus_t *bus);
|
||||
extern uint32 dhdpcie_rc_config_read(dhd_bus_t *bus, uint offset);
|
||||
extern uint32 dhdpcie_rc_access_cap(dhd_bus_t *bus, int cap, uint offset, bool is_ext,
|
||||
bool is_write, uint32 writeval);
|
||||
extern uint32 dhd_debug_get_rc_linkcap(dhd_bus_t *bus);
|
||||
extern int dhdpcie_start_host_pcieclock(dhd_bus_t *bus);
|
||||
extern int dhdpcie_stop_host_pcieclock(dhd_bus_t *bus);
|
||||
extern int dhdpcie_disable_device(dhd_bus_t *bus);
|
||||
extern int dhdpcie_alloc_resource(dhd_bus_t *bus);
|
||||
extern void dhdpcie_free_resource(dhd_bus_t *bus);
|
||||
extern int dhdpcie_bus_request_irq(struct dhd_bus *bus);
|
||||
extern int dhdpcie_enable_device(dhd_bus_t *bus);
|
||||
#ifdef BCMPCIE_OOB_HOST_WAKE
|
||||
extern int dhdpcie_oob_intr_register(dhd_bus_t *bus);
|
||||
extern void dhdpcie_oob_intr_unregister(dhd_bus_t *bus);
|
||||
extern void dhdpcie_oob_intr_set(dhd_bus_t *bus, bool enable);
|
||||
#endif /* BCMPCIE_OOB_HOST_WAKE */
|
||||
#ifdef PCIE_OOB
|
||||
extern void dhd_oob_set_bt_reg_on(struct dhd_bus *bus, bool val);
|
||||
extern int dhd_oob_get_bt_reg_on(struct dhd_bus *bus);
|
||||
extern void dhdpcie_oob_init(dhd_bus_t *bus);
|
||||
extern void dhd_bus_doorbell_timeout_reset(struct dhd_bus *bus);
|
||||
extern int dhd_os_oob_set_device_wake(struct dhd_bus *bus, bool val);
|
||||
extern void dhd_os_ib_set_device_wake(struct dhd_bus *bus, bool val);
|
||||
#endif /* PCIE_OOB */
|
||||
|
||||
#if defined(CONFIG_ARCH_EXYNOS)
|
||||
#define SAMSUNG_PCIE_VENDOR_ID 0x144d
|
||||
#if defined(CONFIG_MACH_UNIVERSAL5433)
|
||||
#define SAMSUNG_PCIE_DEVICE_ID 0xa5e3
|
||||
#define SAMSUNG_PCIE_CH_NUM
|
||||
#elif defined(CONFIG_MACH_UNIVERSAL7420)
|
||||
#define SAMSUNG_PCIE_DEVICE_ID 0xa575
|
||||
#define SAMSUNG_PCIE_CH_NUM 1
|
||||
#elif defined(CONFIG_SOC_EXYNOS8890)
|
||||
#define SAMSUNG_PCIE_DEVICE_ID 0xa544
|
||||
#define SAMSUNG_PCIE_CH_NUM 0
|
||||
#elif defined(CONFIG_SOC_EXYNOS7420)
|
||||
#define SAMSUNG_PCIE_DEVICE_ID 0xa575
|
||||
#define SAMSUNG_PCIE_CH_NUM 1
|
||||
#elif defined(CONFIG_SOC_EXYNOS8895)
|
||||
#define SAMSUNG_PCIE_DEVICE_ID 0xecec
|
||||
#define SAMSUNG_PCIE_CH_NUM 0
|
||||
#else
|
||||
#error "Not supported platform"
|
||||
#endif /* CONFIG_SOC_EXYNOSXXXX & CONFIG_MACH_UNIVERSALXXXX */
|
||||
#endif /* CONFIG_ARCH_EXYNOS */
|
||||
|
||||
#if defined(CONFIG_ARCH_MSM)
|
||||
#define MSM_PCIE_VENDOR_ID 0x17cb
|
||||
#if defined(CONFIG_ARCH_APQ8084)
|
||||
#define MSM_PCIE_DEVICE_ID 0x0101
|
||||
#elif defined(CONFIG_ARCH_MSM8994)
|
||||
#define MSM_PCIE_DEVICE_ID 0x0300
|
||||
#elif defined(CONFIG_ARCH_MSM8996)
|
||||
#define MSM_PCIE_DEVICE_ID 0x0104
|
||||
#elif defined(CONFIG_ARCH_MSM8998)
|
||||
#define MSM_PCIE_DEVICE_ID 0x0105
|
||||
#else
|
||||
#error "Not supported platform"
|
||||
#endif
|
||||
#endif /* CONFIG_ARCH_MSM */
|
||||
|
||||
#if defined(CONFIG_X86)
|
||||
#define X86_PCIE_VENDOR_ID 0x8086
|
||||
#define X86_PCIE_DEVICE_ID 0x9c1a
|
||||
#endif /* CONFIG_X86 */
|
||||
|
||||
#if defined(CONFIG_ARCH_TEGRA)
|
||||
#define TEGRA_PCIE_VENDOR_ID 0x14e4
|
||||
#define TEGRA_PCIE_DEVICE_ID 0x4347
|
||||
#endif /* CONFIG_ARCH_TEGRA */
|
||||
|
||||
#if defined(CONFIG_ARCH_EXYNOS)
|
||||
#define PCIE_RC_VENDOR_ID SAMSUNG_PCIE_VENDOR_ID
|
||||
#define PCIE_RC_DEVICE_ID SAMSUNG_PCIE_DEVICE_ID
|
||||
#elif defined(CONFIG_ARCH_MSM)
|
||||
#define PCIE_RC_VENDOR_ID MSM_PCIE_VENDOR_ID
|
||||
#define PCIE_RC_DEVICE_ID MSM_PCIE_DEVICE_ID
|
||||
#elif defined(CONFIG_X86)
|
||||
#define PCIE_RC_VENDOR_ID X86_PCIE_VENDOR_ID
|
||||
#define PCIE_RC_DEVICE_ID X86_PCIE_DEVICE_ID
|
||||
#elif defined(CONFIG_ARCH_TEGRA)
|
||||
#define PCIE_RC_VENDOR_ID TEGRA_PCIE_VENDOR_ID
|
||||
#define PCIE_RC_DEVICE_ID TEGRA_PCIE_DEVICE_ID
|
||||
#endif /* CONFIG_ARCH_EXYNOS */
|
||||
|
||||
#ifdef USE_EXYNOS_PCIE_RC_PMPATCH
|
||||
#ifdef CONFIG_MACH_UNIVERSAL5433
|
||||
extern int exynos_pcie_pm_suspend(void);
|
||||
extern int exynos_pcie_pm_resume(void);
|
||||
#else
|
||||
extern int exynos_pcie_pm_suspend(int ch_num);
|
||||
extern int exynos_pcie_pm_resume(int ch_num);
|
||||
#endif /* CONFIG_MACH_UNIVERSAL5433 */
|
||||
#endif /* USE_EXYNOS_PCIE_RC_PMPATCH */
|
||||
|
||||
#ifdef CONFIG_ARCH_TEGRA
|
||||
extern int tegra_pcie_pm_suspend(void);
|
||||
extern int tegra_pcie_pm_resume(void);
|
||||
#endif /* CONFIG_ARCH_TEGRA */
|
||||
|
||||
extern int dhd_buzzz_dump_dngl(dhd_bus_t *bus);
|
||||
#ifdef IDLE_TX_FLOW_MGMT
|
||||
extern int dhd_bus_flow_ring_resume_request(struct dhd_bus *bus, void *arg);
|
||||
extern void dhd_bus_flow_ring_resume_response(struct dhd_bus *bus, uint16 flowid, int32 status);
|
||||
extern int dhd_bus_flow_ring_suspend_request(struct dhd_bus *bus, void *arg);
|
||||
extern void dhd_bus_flow_ring_suspend_response(struct dhd_bus *bus, uint16 flowid, uint32 status);
|
||||
extern void dhd_flow_ring_move_to_active_list_head(struct dhd_bus *bus,
|
||||
flow_ring_node_t *flow_ring_node);
|
||||
extern void dhd_flow_ring_add_to_active_list(struct dhd_bus *bus,
|
||||
flow_ring_node_t *flow_ring_node);
|
||||
extern void dhd_flow_ring_delete_from_active_list(struct dhd_bus *bus,
|
||||
flow_ring_node_t *flow_ring_node);
|
||||
extern void __dhd_flow_ring_delete_from_active_list(struct dhd_bus *bus,
|
||||
flow_ring_node_t *flow_ring_node);
|
||||
#endif /* IDLE_TX_FLOW_MGMT */
|
||||
|
||||
extern int dhdpcie_send_mb_data(dhd_bus_t *bus, uint32 h2d_mb_data);
|
||||
|
||||
#ifdef DHD_WAKE_STATUS
|
||||
int bcmpcie_get_total_wake(struct dhd_bus *bus);
|
||||
int bcmpcie_set_get_wake(struct dhd_bus *bus, int flag);
|
||||
#endif /* DHD_WAKE_STATUS */
|
||||
extern bool dhdpcie_bus_get_pcie_hostready_supported(dhd_bus_t *bus);
|
||||
extern void dhd_bus_hostready(struct dhd_bus *bus);
|
||||
#ifdef PCIE_OOB
|
||||
extern bool dhdpcie_bus_get_pcie_oob_dw_supported(dhd_bus_t *bus);
|
||||
#endif /* PCIE_OOB */
|
||||
#ifdef PCIE_INB_DW
|
||||
extern bool dhdpcie_bus_get_pcie_inband_dw_supported(dhd_bus_t *bus);
|
||||
extern void dhdpcie_bus_set_pcie_inband_dw_state(dhd_bus_t *bus,
|
||||
enum dhd_bus_ds_state state);
|
||||
extern enum dhd_bus_ds_state dhdpcie_bus_get_pcie_inband_dw_state(dhd_bus_t *bus);
|
||||
extern const char * dhd_convert_inb_state_names(enum dhd_bus_ds_state inbstate);
|
||||
extern const char * dhd_convert_dsval(uint32 val, bool d2h);
|
||||
extern int dhd_bus_inb_set_device_wake(struct dhd_bus *bus, bool val);
|
||||
extern void dhd_bus_inb_ack_pending_ds_req(dhd_bus_t *bus);
|
||||
#endif /* PCIE_INB_DW */
|
||||
extern void dhdpcie_bus_enab_pcie_dw(dhd_bus_t *bus, uint8 dw_option);
|
||||
extern bool dhdpcie_irq_enabled(struct dhd_bus *bus);
|
||||
extern bool dhdpcie_bus_get_pcie_idma_supported(dhd_bus_t *bus);
|
||||
extern bool dhdpcie_bus_get_pcie_ifrm_supported(dhd_bus_t *bus);
|
||||
|
||||
static INLINE uint32
|
||||
dhd_pcie_config_read(osl_t *osh, uint offset, uint size)
|
||||
{
|
||||
OSL_DELAY(100);
|
||||
return OSL_PCI_READ_CONFIG(osh, offset, size);
|
||||
}
|
||||
|
||||
static INLINE uint32
|
||||
dhd_pcie_corereg_read(si_t *sih, uint val)
|
||||
{
|
||||
OSL_DELAY(100);
|
||||
si_corereg(sih, sih->buscoreidx, OFFSETOF(sbpcieregs_t, configaddr), ~0, val);
|
||||
return si_corereg(sih, sih->buscoreidx, OFFSETOF(sbpcieregs_t, configdata), 0, 0);
|
||||
}
|
||||
|
||||
#ifdef DHD_SSSR_DUMP
|
||||
extern int dhdpcie_sssr_dump(dhd_pub_t *dhd);
|
||||
#endif /* DHD_SSSR_DUMP */
|
||||
|
||||
#ifdef DHD_EFI
|
||||
extern int dhd_os_wifi_platform_set_power(uint32 value);
|
||||
int dhd_control_signal(dhd_bus_t *bus, char *arg, int set);
|
||||
extern int dhd_wifi_properties(struct dhd_bus *bus, char *arg);
|
||||
extern bool dhdpcie_is_arm_halted(struct dhd_bus *bus);
|
||||
extern void dhdpcie_dongle_pwr_toggle(dhd_bus_t *bus);
|
||||
extern int dhd_otp_dump(dhd_bus_t *bus, char *arg);
|
||||
#else
|
||||
static INLINE int dhd_os_wifi_platform_set_power(uint32 value) {return BCME_OK; }
|
||||
static INLINE bool dhdpcie_is_arm_halted(struct dhd_bus *bus) {return TRUE;}
|
||||
#endif /* DHD_EFI */
|
||||
int dhdpcie_config_check(dhd_bus_t *bus);
|
||||
int dhdpcie_config_restore(dhd_bus_t *bus, bool restore_pmcsr);
|
||||
int dhdpcie_config_save(dhd_bus_t *bus);
|
||||
int dhdpcie_set_pwr_state(dhd_bus_t *bus, uint state);
|
||||
|
||||
#endif /* dhd_pcie_h */
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,572 @@
|
|||
/*
|
||||
* Header file of Broadcom Dongle Host Driver (DHD)
|
||||
* Prefered Network Offload code and Wi-Fi Location Service(WLS) code.
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: dhd_pno.h 707287 2017-06-27 06:44:29Z $
|
||||
*/
|
||||
|
||||
#ifndef __DHD_PNO_H__
|
||||
#define __DHD_PNO_H__
|
||||
|
||||
#if defined(PNO_SUPPORT)
|
||||
#define PNO_TLV_PREFIX 'S'
|
||||
#define PNO_TLV_VERSION '1'
|
||||
#define PNO_TLV_SUBTYPE_LEGACY_PNO '2'
|
||||
#define PNO_TLV_RESERVED '0'
|
||||
|
||||
#define PNO_BATCHING_SET "SET"
|
||||
#define PNO_BATCHING_GET "GET"
|
||||
#define PNO_BATCHING_STOP "STOP"
|
||||
|
||||
#define PNO_PARAMS_DELIMETER " "
|
||||
#define PNO_PARAM_CHANNEL_DELIMETER ","
|
||||
#define PNO_PARAM_VALUE_DELLIMETER '='
|
||||
#define PNO_PARAM_SCANFREQ "SCANFREQ"
|
||||
#define PNO_PARAM_BESTN "BESTN"
|
||||
#define PNO_PARAM_MSCAN "MSCAN"
|
||||
#define PNO_PARAM_CHANNEL "CHANNEL"
|
||||
#define PNO_PARAM_RTT "RTT"
|
||||
|
||||
#define PNO_TLV_TYPE_SSID_IE 'S'
|
||||
#define PNO_TLV_TYPE_TIME 'T'
|
||||
#define PNO_TLV_FREQ_REPEAT 'R'
|
||||
#define PNO_TLV_FREQ_EXPO_MAX 'M'
|
||||
|
||||
#define MAXNUM_SSID_PER_ADD 16
|
||||
#define MAXNUM_PNO_PARAMS 2
|
||||
#define PNO_TLV_COMMON_LENGTH 1
|
||||
#define DEFAULT_BATCH_MSCAN 16
|
||||
|
||||
#define RESULTS_END_MARKER "----\n"
|
||||
#define SCAN_END_MARKER "####\n"
|
||||
#define AP_END_MARKER "====\n"
|
||||
#define PNO_RSSI_MARGIN_DBM 30
|
||||
|
||||
#define CSCAN_COMMAND "CSCAN "
|
||||
#define CSCAN_TLV_PREFIX 'S'
|
||||
#define CSCAN_TLV_VERSION 1
|
||||
#define CSCAN_TLV_SUBVERSION 0
|
||||
#define CSCAN_TLV_TYPE_SSID_IE 'S'
|
||||
#define CSCAN_TLV_TYPE_CHANNEL_IE 'C'
|
||||
#define CSCAN_TLV_TYPE_NPROBE_IE 'N'
|
||||
#define CSCAN_TLV_TYPE_ACTIVE_IE 'A'
|
||||
#define CSCAN_TLV_TYPE_PASSIVE_IE 'P'
|
||||
#define CSCAN_TLV_TYPE_HOME_IE 'H'
|
||||
#define CSCAN_TLV_TYPE_STYPE_IE 'T'
|
||||
|
||||
#define WL_SCAN_PARAMS_SSID_MAX 10
|
||||
#define GET_SSID "SSID="
|
||||
#define GET_CHANNEL "CH="
|
||||
#define GET_NPROBE "NPROBE="
|
||||
#define GET_ACTIVE_ASSOC_DWELL "ACTIVE="
|
||||
#define GET_PASSIVE_ASSOC_DWELL "PASSIVE="
|
||||
#define GET_HOME_DWELL "HOME="
|
||||
#define GET_SCAN_TYPE "TYPE="
|
||||
|
||||
#if defined(GSCAN_SUPPORT) || defined(DHD_GET_VALID_CHANNELS)
|
||||
#define GSCAN_MAX_CH_BUCKETS 8
|
||||
#define GSCAN_MAX_CHANNELS_IN_BUCKET 32
|
||||
#define GSCAN_MAX_AP_CACHE_PER_SCAN 32
|
||||
#define GSCAN_MAX_AP_CACHE 320
|
||||
#define GSCAN_BG_BAND_MASK (1 << 0)
|
||||
#define GSCAN_A_BAND_MASK (1 << 1)
|
||||
#define GSCAN_DFS_MASK (1 << 2)
|
||||
#define GSCAN_ABG_BAND_MASK (GSCAN_A_BAND_MASK | GSCAN_BG_BAND_MASK)
|
||||
#define GSCAN_BAND_MASK (GSCAN_ABG_BAND_MASK | GSCAN_DFS_MASK)
|
||||
|
||||
#define GSCAN_FLUSH_HOTLIST_CFG (1 << 0)
|
||||
#define GSCAN_FLUSH_SIGNIFICANT_CFG (1 << 1)
|
||||
#define GSCAN_FLUSH_SCAN_CFG (1 << 2)
|
||||
#define GSCAN_FLUSH_EPNO_CFG (1 << 3)
|
||||
#define GSCAN_FLUSH_ALL_CFG (GSCAN_FLUSH_SCAN_CFG | \
|
||||
GSCAN_FLUSH_SIGNIFICANT_CFG | \
|
||||
GSCAN_FLUSH_HOTLIST_CFG | \
|
||||
GSCAN_FLUSH_EPNO_CFG)
|
||||
#define DHD_EPNO_HIDDEN_SSID (1 << 0)
|
||||
#define DHD_EPNO_A_BAND_TRIG (1 << 1)
|
||||
#define DHD_EPNO_BG_BAND_TRIG (1 << 2)
|
||||
#define DHD_EPNO_STRICT_MATCH (1 << 3)
|
||||
#define DHD_EPNO_SAME_NETWORK (1 << 4)
|
||||
#define DHD_PNO_USE_SSID (DHD_EPNO_HIDDEN_SSID | DHD_EPNO_STRICT_MATCH)
|
||||
|
||||
/* Do not change GSCAN_BATCH_RETRIEVAL_COMPLETE */
|
||||
#define GSCAN_BATCH_RETRIEVAL_COMPLETE 0
|
||||
#define GSCAN_BATCH_RETRIEVAL_IN_PROGRESS 1
|
||||
#define GSCAN_BATCH_NO_THR_SET 101
|
||||
#define GSCAN_LOST_AP_WINDOW_DEFAULT 4
|
||||
#define GSCAN_MIN_BSSID_TIMEOUT 90
|
||||
#define GSCAN_BATCH_GET_MAX_WAIT 500
|
||||
#define CHANNEL_BUCKET_EMPTY_INDEX 0xFFFF
|
||||
#define GSCAN_RETRY_THRESHOLD 3
|
||||
|
||||
#define MAX_EPNO_SSID_NUM 64
|
||||
#endif /* GSCAN_SUPPORT || DHD_GET_VALID_CHANNELS */
|
||||
|
||||
enum scan_status {
|
||||
/* SCAN ABORT by other scan */
|
||||
PNO_STATUS_ABORT,
|
||||
/* RTT is presence or not */
|
||||
PNO_STATUS_RTT_PRESENCE,
|
||||
/* Disable PNO by Driver */
|
||||
PNO_STATUS_DISABLE,
|
||||
/* NORMAL BATCHING GET */
|
||||
PNO_STATUS_NORMAL,
|
||||
/* WLC_E_PFN_BEST_BATCHING */
|
||||
PNO_STATUS_EVENT,
|
||||
PNO_STATUS_MAX
|
||||
};
|
||||
#define PNO_STATUS_ABORT_MASK 0x0001
|
||||
#define PNO_STATUS_RTT_MASK 0x0002
|
||||
#define PNO_STATUS_DISABLE_MASK 0x0004
|
||||
#define PNO_STATUS_OOM_MASK 0x0010
|
||||
|
||||
enum index_mode {
|
||||
INDEX_OF_LEGACY_PARAMS,
|
||||
INDEX_OF_BATCH_PARAMS,
|
||||
INDEX_OF_HOTLIST_PARAMS,
|
||||
/* GSCAN includes hotlist scan and they do not run
|
||||
* independent of each other
|
||||
*/
|
||||
INDEX_OF_GSCAN_PARAMS = INDEX_OF_HOTLIST_PARAMS,
|
||||
INDEX_MODE_MAX
|
||||
};
|
||||
enum dhd_pno_status {
|
||||
DHD_PNO_DISABLED,
|
||||
DHD_PNO_ENABLED,
|
||||
DHD_PNO_SUSPEND
|
||||
};
|
||||
typedef struct cmd_tlv {
|
||||
char prefix;
|
||||
char version;
|
||||
char subtype;
|
||||
char reserved;
|
||||
} cmd_tlv_t;
|
||||
#if defined(GSCAN_SUPPORT) || defined(DHD_GET_VALID_CHANNELS)
|
||||
typedef enum {
|
||||
WIFI_BAND_UNSPECIFIED,
|
||||
WIFI_BAND_BG = 1, /* 2.4 GHz */
|
||||
WIFI_BAND_A = 2, /* 5 GHz without DFS */
|
||||
WIFI_BAND_A_DFS = 4, /* 5 GHz DFS only */
|
||||
WIFI_BAND_A_WITH_DFS = 6, /* 5 GHz with DFS */
|
||||
WIFI_BAND_ABG = 3, /* 2.4 GHz + 5 GHz; no DFS */
|
||||
WIFI_BAND_ABG_WITH_DFS = 7, /* 2.4 GHz + 5 GHz with DFS */
|
||||
} gscan_wifi_band_t;
|
||||
|
||||
typedef enum {
|
||||
HOTLIST_LOST,
|
||||
HOTLIST_FOUND
|
||||
} hotlist_type_t;
|
||||
|
||||
typedef enum dhd_pno_gscan_cmd_cfg {
|
||||
DHD_PNO_BATCH_SCAN_CFG_ID = 0,
|
||||
DHD_PNO_GEOFENCE_SCAN_CFG_ID,
|
||||
DHD_PNO_SIGNIFICANT_SCAN_CFG_ID,
|
||||
DHD_PNO_SCAN_CFG_ID,
|
||||
DHD_PNO_GET_CAPABILITIES,
|
||||
DHD_PNO_GET_BATCH_RESULTS,
|
||||
DHD_PNO_GET_CHANNEL_LIST,
|
||||
DHD_PNO_GET_NEW_EPNO_SSID_ELEM,
|
||||
DHD_PNO_EPNO_CFG_ID,
|
||||
DHD_PNO_GET_AUTOJOIN_CAPABILITIES,
|
||||
DHD_PNO_EPNO_PARAMS_ID
|
||||
} dhd_pno_gscan_cmd_cfg_t;
|
||||
|
||||
typedef enum dhd_pno_mode {
|
||||
/* Wi-Fi Legacy PNO Mode */
|
||||
DHD_PNO_NONE_MODE = 0,
|
||||
DHD_PNO_LEGACY_MODE = (1 << (0)),
|
||||
/* Wi-Fi Android BATCH SCAN Mode */
|
||||
DHD_PNO_BATCH_MODE = (1 << (1)),
|
||||
/* Wi-Fi Android Hotlist SCAN Mode */
|
||||
DHD_PNO_HOTLIST_MODE = (1 << (2)),
|
||||
/* Wi-Fi Google Android SCAN Mode */
|
||||
DHD_PNO_GSCAN_MODE = (1 << (3))
|
||||
} dhd_pno_mode_t;
|
||||
#else
|
||||
typedef enum dhd_pno_mode {
|
||||
/* Wi-Fi Legacy PNO Mode */
|
||||
DHD_PNO_NONE_MODE = 0,
|
||||
DHD_PNO_LEGACY_MODE = (1 << (0)),
|
||||
/* Wi-Fi Android BATCH SCAN Mode */
|
||||
DHD_PNO_BATCH_MODE = (1 << (1)),
|
||||
/* Wi-Fi Android Hotlist SCAN Mode */
|
||||
DHD_PNO_HOTLIST_MODE = (1 << (2))
|
||||
} dhd_pno_mode_t;
|
||||
#endif /* GSCAN_SUPPORT || DHD_GET_VALID_CHANNELS */
|
||||
|
||||
typedef struct dhd_pno_ssid {
|
||||
bool hidden;
|
||||
int8 rssi_thresh;
|
||||
uint8 dummy;
|
||||
uint16 SSID_len;
|
||||
uint32 flags;
|
||||
int32 wpa_auth;
|
||||
uchar SSID[DOT11_MAX_SSID_LEN];
|
||||
struct list_head list;
|
||||
} dhd_pno_ssid_t;
|
||||
|
||||
struct dhd_pno_bssid {
|
||||
struct ether_addr macaddr;
|
||||
/* Bit4: suppress_lost, Bit3: suppress_found */
|
||||
uint16 flags;
|
||||
struct list_head list;
|
||||
};
|
||||
|
||||
typedef struct dhd_pno_bestnet_entry {
|
||||
struct ether_addr BSSID;
|
||||
uint8 SSID_len;
|
||||
uint8 SSID[DOT11_MAX_SSID_LEN];
|
||||
int8 RSSI;
|
||||
uint8 channel;
|
||||
uint32 timestamp;
|
||||
uint16 rtt0; /* distance_cm based on RTT */
|
||||
uint16 rtt1; /* distance_cm based on sample standard deviation */
|
||||
unsigned long recorded_time;
|
||||
struct list_head list;
|
||||
} dhd_pno_bestnet_entry_t;
|
||||
#define BESTNET_ENTRY_SIZE (sizeof(dhd_pno_bestnet_entry_t))
|
||||
|
||||
typedef struct dhd_pno_bestnet_header {
|
||||
struct dhd_pno_bestnet_header *next;
|
||||
uint8 reason;
|
||||
uint32 tot_cnt;
|
||||
uint32 tot_size;
|
||||
struct list_head entry_list;
|
||||
} dhd_pno_best_header_t;
|
||||
#define BEST_HEADER_SIZE (sizeof(dhd_pno_best_header_t))
|
||||
|
||||
typedef struct dhd_pno_scan_results {
|
||||
dhd_pno_best_header_t *bestnetheader;
|
||||
uint8 cnt_header;
|
||||
struct list_head list;
|
||||
} dhd_pno_scan_results_t;
|
||||
#define SCAN_RESULTS_SIZE (sizeof(dhd_pno_scan_results_t))
|
||||
|
||||
struct dhd_pno_get_batch_info {
|
||||
/* info related to get batch */
|
||||
char *buf;
|
||||
bool batch_started;
|
||||
uint32 tot_scan_cnt;
|
||||
uint32 expired_tot_scan_cnt;
|
||||
uint32 top_node_cnt;
|
||||
uint32 bufsize;
|
||||
uint32 bytes_written;
|
||||
int reason;
|
||||
struct list_head scan_results_list;
|
||||
struct list_head expired_scan_results_list;
|
||||
};
|
||||
struct dhd_pno_legacy_params {
|
||||
uint16 scan_fr;
|
||||
uint16 chan_list[WL_NUMCHANNELS];
|
||||
uint16 nchan;
|
||||
int pno_repeat;
|
||||
int pno_freq_expo_max;
|
||||
int nssid;
|
||||
struct list_head ssid_list;
|
||||
};
|
||||
struct dhd_pno_batch_params {
|
||||
int32 scan_fr;
|
||||
uint8 bestn;
|
||||
uint8 mscan;
|
||||
uint8 band;
|
||||
uint16 chan_list[WL_NUMCHANNELS];
|
||||
uint16 nchan;
|
||||
uint16 rtt;
|
||||
struct dhd_pno_get_batch_info get_batch;
|
||||
};
|
||||
struct dhd_pno_hotlist_params {
|
||||
uint8 band;
|
||||
int32 scan_fr;
|
||||
uint16 chan_list[WL_NUMCHANNELS];
|
||||
uint16 nchan;
|
||||
uint16 nbssid;
|
||||
struct list_head bssid_list;
|
||||
};
|
||||
#if defined(GSCAN_SUPPORT) || defined(DHD_GET_VALID_CHANNELS)
|
||||
#define DHD_PNO_REPORT_NO_BATCH (1 << 2)
|
||||
|
||||
typedef struct dhd_pno_gscan_channel_bucket {
|
||||
uint16 bucket_freq_multiple;
|
||||
/* band = 1 All bg band channels,
|
||||
* band = 2 All a band channels,
|
||||
* band = 0 chan_list channels
|
||||
*/
|
||||
uint16 band;
|
||||
uint8 report_flag;
|
||||
uint8 num_channels;
|
||||
uint16 repeat;
|
||||
uint16 bucket_max_multiple;
|
||||
uint16 chan_list[GSCAN_MAX_CHANNELS_IN_BUCKET];
|
||||
} dhd_pno_gscan_channel_bucket_t;
|
||||
|
||||
|
||||
#define DHD_PNO_AUTH_CODE_OPEN 1 /* Open */
|
||||
#define DHD_PNO_AUTH_CODE_PSK 2 /* WPA_PSK or WPA2PSK */
|
||||
#define DHD_PNO_AUTH_CODE_EAPOL 4 /* any EAPOL */
|
||||
|
||||
#define DHD_EPNO_DEFAULT_INDEX 0xFFFFFFFF
|
||||
|
||||
typedef struct dhd_epno_params {
|
||||
uint8 ssid[DOT11_MAX_SSID_LEN];
|
||||
uint8 ssid_len;
|
||||
int8 rssi_thresh;
|
||||
uint8 flags;
|
||||
uint8 auth;
|
||||
/* index required only for visble ssid */
|
||||
uint32 index;
|
||||
struct list_head list;
|
||||
} dhd_epno_params_t;
|
||||
|
||||
typedef struct dhd_epno_results {
|
||||
uint8 ssid[DOT11_MAX_SSID_LEN];
|
||||
uint8 ssid_len;
|
||||
int8 rssi;
|
||||
uint16 channel;
|
||||
uint16 flags;
|
||||
struct ether_addr bssid;
|
||||
} dhd_epno_results_t;
|
||||
|
||||
typedef struct wifi_gscan_result {
|
||||
uint64 ts; /* Time of discovery */
|
||||
char ssid[DOT11_MAX_SSID_LEN+1]; /* null terminated */
|
||||
struct ether_addr macaddr; /* BSSID */
|
||||
uint32 channel; /* channel frequency in MHz */
|
||||
int32 rssi; /* in db */
|
||||
uint64 rtt; /* in nanoseconds */
|
||||
uint64 rtt_sd; /* standard deviation in rtt */
|
||||
uint16 beacon_period; /* units are Kusec */
|
||||
uint16 capability; /* Capability information */
|
||||
uint32 pad;
|
||||
} wifi_gscan_result_t;
|
||||
|
||||
typedef struct wifi_gscan_full_result {
|
||||
wifi_gscan_result_t fixed;
|
||||
uint32 scan_ch_bucket;
|
||||
uint32 ie_length; /* byte length of Information Elements */
|
||||
char ie_data[1]; /* IE data to follow */
|
||||
} wifi_gscan_full_result_t;
|
||||
|
||||
typedef struct gscan_results_cache {
|
||||
struct gscan_results_cache *next;
|
||||
uint8 scan_id;
|
||||
uint8 flag;
|
||||
uint8 tot_count;
|
||||
uint8 tot_consumed;
|
||||
uint32 scan_ch_bucket;
|
||||
wifi_gscan_result_t results[1];
|
||||
} gscan_results_cache_t;
|
||||
|
||||
typedef struct dhd_pno_gscan_capabilities {
|
||||
int max_scan_cache_size;
|
||||
int max_scan_buckets;
|
||||
int max_ap_cache_per_scan;
|
||||
int max_rssi_sample_size;
|
||||
int max_scan_reporting_threshold;
|
||||
int max_hotlist_aps;
|
||||
int max_significant_wifi_change_aps;
|
||||
int max_epno_ssid_crc32;
|
||||
int max_epno_hidden_ssid;
|
||||
int max_white_list_ssid;
|
||||
} dhd_pno_gscan_capabilities_t;
|
||||
|
||||
typedef struct dhd_epno_ssid_cfg {
|
||||
wl_pfn_ssid_params_t params;
|
||||
uint32 num_epno_ssid;
|
||||
struct list_head epno_ssid_list;
|
||||
} dhd_epno_ssid_cfg_t;
|
||||
|
||||
struct dhd_pno_gscan_params {
|
||||
int32 scan_fr;
|
||||
uint8 bestn;
|
||||
uint8 mscan;
|
||||
uint8 buffer_threshold;
|
||||
uint8 lost_ap_window;
|
||||
uint8 nchannel_buckets;
|
||||
uint8 reason;
|
||||
uint8 get_batch_flag;
|
||||
uint8 send_all_results_flag;
|
||||
uint16 max_ch_bucket_freq;
|
||||
gscan_results_cache_t *gscan_batch_cache;
|
||||
gscan_results_cache_t *gscan_hotlist_found;
|
||||
gscan_results_cache_t *gscan_hotlist_lost;
|
||||
uint16 nbssid_hotlist;
|
||||
struct dhd_pno_gscan_channel_bucket channel_bucket[GSCAN_MAX_CH_BUCKETS];
|
||||
struct list_head hotlist_bssid_list;
|
||||
dhd_epno_ssid_cfg_t epno_cfg;
|
||||
uint32 scan_id;
|
||||
};
|
||||
|
||||
typedef struct gscan_scan_params {
|
||||
int32 scan_fr;
|
||||
uint16 nchannel_buckets;
|
||||
struct dhd_pno_gscan_channel_bucket channel_bucket[GSCAN_MAX_CH_BUCKETS];
|
||||
} gscan_scan_params_t;
|
||||
|
||||
typedef struct gscan_batch_params {
|
||||
uint8 bestn;
|
||||
uint8 mscan;
|
||||
uint8 buffer_threshold;
|
||||
} gscan_batch_params_t;
|
||||
|
||||
struct bssid_t {
|
||||
struct ether_addr macaddr;
|
||||
int16 rssi_reporting_threshold; /* 0 -> no reporting threshold */
|
||||
};
|
||||
|
||||
typedef struct gscan_hotlist_scan_params {
|
||||
uint16 lost_ap_window; /* number of scans to declare LOST */
|
||||
uint16 nbssid; /* number of bssids */
|
||||
struct bssid_t bssid[1]; /* n bssids to follow */
|
||||
} gscan_hotlist_scan_params_t;
|
||||
|
||||
#endif /* GSCAN_SUPPORT || DHD_GET_VALID_CHANNELS */
|
||||
typedef union dhd_pno_params {
|
||||
struct dhd_pno_legacy_params params_legacy;
|
||||
struct dhd_pno_batch_params params_batch;
|
||||
struct dhd_pno_hotlist_params params_hotlist;
|
||||
#if defined(GSCAN_SUPPORT) || defined(DHD_GET_VALID_CHANNELS)
|
||||
struct dhd_pno_gscan_params params_gscan;
|
||||
#endif /* GSCAN_SUPPORT || DHD_GET_VALID_CHANNELS */
|
||||
} dhd_pno_params_t;
|
||||
typedef struct dhd_pno_status_info {
|
||||
dhd_pub_t *dhd;
|
||||
struct work_struct work;
|
||||
struct mutex pno_mutex;
|
||||
#ifdef GSCAN_SUPPORT
|
||||
wait_queue_head_t batch_get_wait;
|
||||
#endif /* GSCAN_SUPPORT */
|
||||
struct completion get_batch_done;
|
||||
bool wls_supported; /* wifi location service supported or not */
|
||||
enum dhd_pno_status pno_status;
|
||||
enum dhd_pno_mode pno_mode;
|
||||
dhd_pno_params_t pno_params_arr[INDEX_MODE_MAX];
|
||||
struct list_head head_list;
|
||||
} dhd_pno_status_info_t;
|
||||
|
||||
/* wrapper functions */
|
||||
extern int
|
||||
dhd_dev_pno_enable(struct net_device *dev, int enable);
|
||||
|
||||
extern int
|
||||
dhd_dev_pno_stop_for_ssid(struct net_device *dev);
|
||||
|
||||
extern int
|
||||
dhd_dev_pno_set_for_ssid(struct net_device *dev, wlc_ssid_ext_t* ssids_local, int nssid,
|
||||
uint16 scan_fr, int pno_repeat, int pno_freq_expo_max, uint16 *channel_list, int nchan);
|
||||
|
||||
extern int
|
||||
dhd_dev_pno_set_for_batch(struct net_device *dev,
|
||||
struct dhd_pno_batch_params *batch_params);
|
||||
|
||||
extern int
|
||||
dhd_dev_pno_get_for_batch(struct net_device *dev, char *buf, int bufsize);
|
||||
|
||||
extern int
|
||||
dhd_dev_pno_stop_for_batch(struct net_device *dev);
|
||||
|
||||
extern int
|
||||
dhd_dev_pno_set_for_hotlist(struct net_device *dev, wl_pfn_bssid_t *p_pfn_bssid,
|
||||
struct dhd_pno_hotlist_params *hotlist_params);
|
||||
extern bool dhd_dev_is_legacy_pno_enabled(struct net_device *dev);
|
||||
#if defined(GSCAN_SUPPORT) || defined(DHD_GET_VALID_CHANNELS)
|
||||
extern void *
|
||||
dhd_dev_pno_get_gscan(struct net_device *dev, dhd_pno_gscan_cmd_cfg_t type, void *info,
|
||||
uint32 *len);
|
||||
#endif /* GSCAN_SUPPORT || DHD_GET_VALID_CHANNELS */
|
||||
#ifdef GSCAN_SUPPORT
|
||||
extern int
|
||||
dhd_dev_pno_set_cfg_gscan(struct net_device *dev, dhd_pno_gscan_cmd_cfg_t type,
|
||||
void *buf, bool flush);
|
||||
int dhd_dev_pno_lock_access_batch_results(struct net_device *dev);
|
||||
void dhd_dev_pno_unlock_access_batch_results(struct net_device *dev);
|
||||
extern int dhd_dev_pno_run_gscan(struct net_device *dev, bool run, bool flush);
|
||||
extern int dhd_dev_pno_enable_full_scan_result(struct net_device *dev, bool real_time);
|
||||
int dhd_retreive_batch_scan_results(dhd_pub_t *dhd);
|
||||
extern void * dhd_dev_hotlist_scan_event(struct net_device *dev,
|
||||
const void *data, int *send_evt_bytes, hotlist_type_t type);
|
||||
void * dhd_dev_process_full_gscan_result(struct net_device *dev,
|
||||
const void *data, uint32 len, int *send_evt_bytes);
|
||||
extern int dhd_dev_gscan_batch_cache_cleanup(struct net_device *dev);
|
||||
extern void dhd_dev_gscan_hotlist_cache_cleanup(struct net_device *dev, hotlist_type_t type);
|
||||
extern int dhd_dev_wait_batch_results_complete(struct net_device *dev);
|
||||
extern void * dhd_dev_process_epno_result(struct net_device *dev,
|
||||
const void *data, uint32 event, int *send_evt_bytes);
|
||||
extern int dhd_dev_set_epno(struct net_device *dev);
|
||||
extern int dhd_dev_flush_fw_epno(struct net_device *dev);
|
||||
#endif /* GSCAN_SUPPORT */
|
||||
/* dhd pno fuctions */
|
||||
extern int dhd_pno_stop_for_ssid(dhd_pub_t *dhd);
|
||||
extern int dhd_pno_enable(dhd_pub_t *dhd, int enable);
|
||||
extern int dhd_pno_set_for_ssid(dhd_pub_t *dhd, wlc_ssid_ext_t* ssid_list, int nssid,
|
||||
uint16 scan_fr, int pno_repeat, int pno_freq_expo_max, uint16 *channel_list, int nchan);
|
||||
|
||||
extern int dhd_pno_set_for_batch(dhd_pub_t *dhd, struct dhd_pno_batch_params *batch_params);
|
||||
|
||||
extern int dhd_pno_get_for_batch(dhd_pub_t *dhd, char *buf, int bufsize, int reason);
|
||||
|
||||
|
||||
extern int dhd_pno_stop_for_batch(dhd_pub_t *dhd);
|
||||
|
||||
extern int dhd_pno_set_for_hotlist(dhd_pub_t *dhd, wl_pfn_bssid_t *p_pfn_bssid,
|
||||
struct dhd_pno_hotlist_params *hotlist_params);
|
||||
|
||||
extern int dhd_pno_stop_for_hotlist(dhd_pub_t *dhd);
|
||||
|
||||
extern int dhd_pno_event_handler(dhd_pub_t *dhd, wl_event_msg_t *event, void *event_data);
|
||||
extern int dhd_pno_init(dhd_pub_t *dhd);
|
||||
extern int dhd_pno_deinit(dhd_pub_t *dhd);
|
||||
extern bool dhd_is_pno_supported(dhd_pub_t *dhd);
|
||||
extern bool dhd_is_legacy_pno_enabled(dhd_pub_t *dhd);
|
||||
#if defined(GSCAN_SUPPORT) || defined(DHD_GET_VALID_CHANNELS)
|
||||
extern void * dhd_pno_get_gscan(dhd_pub_t *dhd, dhd_pno_gscan_cmd_cfg_t type, void *info,
|
||||
uint32 *len);
|
||||
#endif /* GSCAN_SUPPORT || DHD_GET_VALID_CHANNELS */
|
||||
#ifdef GSCAN_SUPPORT
|
||||
extern int dhd_pno_set_cfg_gscan(dhd_pub_t *dhd, dhd_pno_gscan_cmd_cfg_t type,
|
||||
void *buf, bool flush);
|
||||
extern int dhd_pno_lock_batch_results(dhd_pub_t *dhd);
|
||||
extern void dhd_pno_unlock_batch_results(dhd_pub_t *dhd);
|
||||
extern int dhd_pno_initiate_gscan_request(dhd_pub_t *dhd, bool run, bool flush);
|
||||
extern int dhd_pno_enable_full_scan_result(dhd_pub_t *dhd, bool real_time_flag);
|
||||
extern int dhd_pno_cfg_gscan(dhd_pub_t *dhd, dhd_pno_gscan_cmd_cfg_t type, void *buf);
|
||||
extern int dhd_dev_retrieve_batch_scan(struct net_device *dev);
|
||||
extern void *dhd_handle_hotlist_scan_evt(dhd_pub_t *dhd, const void *event_data,
|
||||
int *send_evt_bytes, hotlist_type_t type);
|
||||
extern void *dhd_process_full_gscan_result(dhd_pub_t *dhd, const void *event_data,
|
||||
uint32 len, int *send_evt_bytes);
|
||||
extern int dhd_gscan_batch_cache_cleanup(dhd_pub_t *dhd);
|
||||
extern void dhd_gscan_hotlist_cache_cleanup(dhd_pub_t *dhd, hotlist_type_t type);
|
||||
extern int dhd_wait_batch_results_complete(dhd_pub_t *dhd);
|
||||
extern void * dhd_pno_process_epno_result(dhd_pub_t *dhd, const void *data,
|
||||
uint32 event, int *size);
|
||||
extern void dhd_pno_translate_epno_fw_flags(uint32 *flags);
|
||||
extern int dhd_pno_set_epno(dhd_pub_t *dhd);
|
||||
extern int dhd_pno_flush_fw_epno(dhd_pub_t *dhd);
|
||||
extern void dhd_pno_set_epno_auth_flag(uint32 *wpa_auth);
|
||||
#endif /* GSCAN_SUPPORT */
|
||||
#endif
|
||||
|
||||
#endif /* __DHD_PNO_H__ */
|
|
@ -0,0 +1,201 @@
|
|||
/*
|
||||
* Header file describing the internal (inter-module) DHD interfaces.
|
||||
*
|
||||
* Provides type definitions and function prototypes used to link the
|
||||
* DHD OS, bus, and protocol modules.
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: dhd_proto.h 678890 2017-01-11 11:48:36Z $
|
||||
*/
|
||||
|
||||
#ifndef _dhd_proto_h_
|
||||
#define _dhd_proto_h_
|
||||
|
||||
#include <dhdioctl.h>
|
||||
#include <wlioctl.h>
|
||||
#ifdef BCMPCIE
|
||||
#include <dhd_flowring.h>
|
||||
#endif
|
||||
|
||||
#define DEFAULT_IOCTL_RESP_TIMEOUT 4000
|
||||
#ifndef IOCTL_RESP_TIMEOUT
|
||||
/* In milli second default value for Production FW */
|
||||
#define IOCTL_RESP_TIMEOUT DEFAULT_IOCTL_RESP_TIMEOUT
|
||||
#endif /* IOCTL_RESP_TIMEOUT */
|
||||
|
||||
#ifndef MFG_IOCTL_RESP_TIMEOUT
|
||||
#define MFG_IOCTL_RESP_TIMEOUT 20000 /* In milli second default value for MFG FW */
|
||||
#endif /* MFG_IOCTL_RESP_TIMEOUT */
|
||||
|
||||
#define DEFAULT_D3_ACK_RESP_TIMEOUT 1000
|
||||
#ifndef D3_ACK_RESP_TIMEOUT
|
||||
#define D3_ACK_RESP_TIMEOUT DEFAULT_D3_ACK_RESP_TIMEOUT
|
||||
#endif /* D3_ACK_RESP_TIMEOUT */
|
||||
|
||||
#define DEFAULT_DHD_BUS_BUSY_TIMEOUT (IOCTL_RESP_TIMEOUT + 1000)
|
||||
#ifndef DHD_BUS_BUSY_TIMEOUT
|
||||
#define DHD_BUS_BUSY_TIMEOUT DEFAULT_DHD_BUS_BUSY_TIMEOUT
|
||||
#endif /* DEFAULT_DHD_BUS_BUSY_TIMEOUT */
|
||||
|
||||
#define DS_EXIT_TIMEOUT 1000 /* In ms */
|
||||
#define DS_ENTER_TIMEOUT 1000 /* In ms */
|
||||
|
||||
#define IOCTL_DISABLE_TIMEOUT 0
|
||||
|
||||
/*
|
||||
* Exported from the dhd protocol module (dhd_cdc, dhd_rndis)
|
||||
*/
|
||||
|
||||
/* Linkage, sets prot link and updates hdrlen in pub */
|
||||
extern int dhd_prot_attach(dhd_pub_t *dhdp);
|
||||
|
||||
/* Initilizes the index block for dma'ing indices */
|
||||
extern int dhd_prot_dma_indx_init(dhd_pub_t *dhdp, uint32 rw_index_sz,
|
||||
uint8 type, uint32 length);
|
||||
|
||||
/* Unlink, frees allocated protocol memory (including dhd_prot) */
|
||||
extern void dhd_prot_detach(dhd_pub_t *dhdp);
|
||||
|
||||
/* Initialize protocol: sync w/dongle state.
|
||||
* Sets dongle media info (iswl, drv_version, mac address).
|
||||
*/
|
||||
extern int dhd_sync_with_dongle(dhd_pub_t *dhdp);
|
||||
|
||||
/* Protocol initialization needed for IOCTL/IOVAR path */
|
||||
extern int dhd_prot_init(dhd_pub_t *dhd);
|
||||
|
||||
/* Stop protocol: sync w/dongle state. */
|
||||
extern void dhd_prot_stop(dhd_pub_t *dhdp);
|
||||
|
||||
/* Add any protocol-specific data header.
|
||||
* Caller must reserve prot_hdrlen prepend space.
|
||||
*/
|
||||
extern void dhd_prot_hdrpush(dhd_pub_t *, int ifidx, void *txp);
|
||||
extern uint dhd_prot_hdrlen(dhd_pub_t *, void *txp);
|
||||
|
||||
/* Remove any protocol-specific data header. */
|
||||
extern int dhd_prot_hdrpull(dhd_pub_t *, int *ifidx, void *rxp, uchar *buf, uint *len);
|
||||
|
||||
/* Use protocol to issue ioctl to dongle */
|
||||
extern int dhd_prot_ioctl(dhd_pub_t *dhd, int ifidx, wl_ioctl_t * ioc, void * buf, int len);
|
||||
|
||||
/* Handles a protocol control response asynchronously */
|
||||
extern int dhd_prot_ctl_complete(dhd_pub_t *dhd);
|
||||
|
||||
/* Check for and handle local prot-specific iovar commands */
|
||||
extern int dhd_prot_iovar_op(dhd_pub_t *dhdp, const char *name,
|
||||
void *params, int plen, void *arg, int len, bool set);
|
||||
|
||||
/* Add prot dump output to a buffer */
|
||||
extern void dhd_prot_dump(dhd_pub_t *dhdp, struct bcmstrbuf *strbuf);
|
||||
|
||||
/* Dump extended trap data */
|
||||
extern int dhd_prot_dump_extended_trap(dhd_pub_t *dhdp, struct bcmstrbuf *b, bool raw);
|
||||
|
||||
/* Update local copy of dongle statistics */
|
||||
extern void dhd_prot_dstats(dhd_pub_t *dhdp);
|
||||
|
||||
extern int dhd_ioctl(dhd_pub_t * dhd_pub, dhd_ioctl_t *ioc, void * buf, uint buflen);
|
||||
|
||||
extern int dhd_preinit_ioctls(dhd_pub_t *dhd);
|
||||
|
||||
extern int dhd_process_pkt_reorder_info(dhd_pub_t *dhd, uchar *reorder_info_buf,
|
||||
uint reorder_info_len, void **pkt, uint32 *free_buf_count);
|
||||
|
||||
#ifdef BCMPCIE
|
||||
extern bool dhd_prot_process_msgbuf_txcpl(dhd_pub_t *dhd, uint bound);
|
||||
extern bool dhd_prot_process_msgbuf_rxcpl(dhd_pub_t *dhd, uint bound);
|
||||
extern bool dhd_prot_process_msgbuf_infocpl(dhd_pub_t *dhd, uint bound);
|
||||
extern int dhd_prot_process_ctrlbuf(dhd_pub_t * dhd);
|
||||
extern int dhd_prot_process_trapbuf(dhd_pub_t * dhd);
|
||||
extern bool dhd_prot_dtohsplit(dhd_pub_t * dhd);
|
||||
extern int dhd_post_dummy_msg(dhd_pub_t *dhd);
|
||||
extern int dhdmsgbuf_lpbk_req(dhd_pub_t *dhd, uint len);
|
||||
extern void dhd_prot_rx_dataoffset(dhd_pub_t *dhd, uint32 offset);
|
||||
extern int dhd_prot_txdata(dhd_pub_t *dhd, void *p, uint8 ifidx);
|
||||
extern int dhdmsgbuf_dmaxfer_req(dhd_pub_t *dhd,
|
||||
uint len, uint srcdelay, uint destdelay, uint d11_lpbk);
|
||||
|
||||
extern void dhd_dma_buf_init(dhd_pub_t *dhd, void *dma_buf,
|
||||
void *va, uint32 len, dmaaddr_t pa, void *dmah, void *secdma);
|
||||
extern void dhd_prot_flowrings_pool_release(dhd_pub_t *dhd,
|
||||
uint16 flowid, void *msgbuf_ring);
|
||||
extern int dhd_prot_flow_ring_create(dhd_pub_t *dhd, flow_ring_node_t *flow_ring_node);
|
||||
extern int dhd_post_tx_ring_item(dhd_pub_t *dhd, void *PKTBUF, uint8 ifindex);
|
||||
extern int dhd_prot_flow_ring_delete(dhd_pub_t *dhd, flow_ring_node_t *flow_ring_node);
|
||||
extern int dhd_prot_flow_ring_flush(dhd_pub_t *dhd, flow_ring_node_t *flow_ring_node);
|
||||
extern int dhd_prot_ringupd_dump(dhd_pub_t *dhd, struct bcmstrbuf *b);
|
||||
extern uint32 dhd_prot_metadata_dbg_set(dhd_pub_t *dhd, bool val);
|
||||
extern uint32 dhd_prot_metadata_dbg_get(dhd_pub_t *dhd);
|
||||
extern uint32 dhd_prot_metadatalen_set(dhd_pub_t *dhd, uint32 val, bool rx);
|
||||
extern uint32 dhd_prot_metadatalen_get(dhd_pub_t *dhd, bool rx);
|
||||
extern void dhd_prot_print_flow_ring(dhd_pub_t *dhd, void *msgbuf_flow_info,
|
||||
struct bcmstrbuf *strbuf, const char * fmt);
|
||||
extern void dhd_prot_print_info(dhd_pub_t *dhd, struct bcmstrbuf *strbuf);
|
||||
extern void dhd_prot_update_txflowring(dhd_pub_t *dhdp, uint16 flow_id, void *msgring_info);
|
||||
extern void dhd_prot_txdata_write_flush(dhd_pub_t *dhd, uint16 flow_id, bool in_lock);
|
||||
extern uint32 dhd_prot_txp_threshold(dhd_pub_t *dhd, bool set, uint32 val);
|
||||
extern void dhd_prot_reset(dhd_pub_t *dhd);
|
||||
|
||||
#ifdef IDLE_TX_FLOW_MGMT
|
||||
extern int dhd_prot_flow_ring_batch_suspend_request(dhd_pub_t *dhd, uint16 *ringid, uint16 count);
|
||||
extern int dhd_prot_flow_ring_resume(dhd_pub_t *dhd, flow_ring_node_t *flow_ring_node);
|
||||
#endif /* IDLE_TX_FLOW_MGMT */
|
||||
extern int dhd_prot_init_info_rings(dhd_pub_t *dhd);
|
||||
|
||||
#endif /* BCMPCIE */
|
||||
|
||||
#ifdef DHD_LB
|
||||
extern void dhd_lb_tx_compl_handler(unsigned long data);
|
||||
extern void dhd_lb_rx_compl_handler(unsigned long data);
|
||||
extern void dhd_lb_rx_process_handler(unsigned long data);
|
||||
#endif /* DHD_LB */
|
||||
extern int dhd_prot_h2d_mbdata_send_ctrlmsg(dhd_pub_t *dhd, uint32 mb_data);
|
||||
|
||||
#ifdef BCMPCIE
|
||||
extern int dhd_prot_send_host_timestamp(dhd_pub_t *dhdp, uchar *tlv, uint16 tlv_len,
|
||||
uint16 seq, uint16 xt_id);
|
||||
extern bool dhd_prot_data_path_tx_timestamp_logging(dhd_pub_t *dhd, bool enable, bool set);
|
||||
extern bool dhd_prot_data_path_rx_timestamp_logging(dhd_pub_t *dhd, bool enable, bool set);
|
||||
#else /* BCMPCIE */
|
||||
#define dhd_prot_send_host_timestamp(a, b, c, d, e) 0
|
||||
#define dhd_prot_data_path_tx_timestamp_logging(a, b, c) 0
|
||||
#define dhd_prot_data_path_rx_timestamp_logging(a, b, c) 0
|
||||
#endif /* BCMPCIE */
|
||||
|
||||
extern void dhd_prot_dma_indx_free(dhd_pub_t *dhd);
|
||||
|
||||
/********************************
|
||||
* For version-string expansion *
|
||||
*/
|
||||
#if defined(BDC)
|
||||
#define DHD_PROTOCOL "bdc"
|
||||
#elif defined(CDC)
|
||||
#define DHD_PROTOCOL "cdc"
|
||||
#else
|
||||
#define DHD_PROTOCOL "unknown"
|
||||
#endif /* proto */
|
||||
|
||||
#endif /* _dhd_proto_h_ */
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,387 @@
|
|||
/*
|
||||
* Broadcom Dongle Host Driver (DHD), RTT
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
#ifndef __DHD_RTT_H__
|
||||
#define __DHD_RTT_H__
|
||||
|
||||
#include "dngl_stats.h"
|
||||
|
||||
#define RTT_MAX_TARGET_CNT 50
|
||||
#define RTT_MAX_FRAME_CNT 25
|
||||
#define RTT_MAX_RETRY_CNT 10
|
||||
#define DEFAULT_FTM_CNT 6
|
||||
#define DEFAULT_RETRY_CNT 6
|
||||
#define DEFAULT_FTM_FREQ 5180
|
||||
#define DEFAULT_FTM_CNTR_FREQ0 5210
|
||||
|
||||
#define TARGET_INFO_SIZE(count) (sizeof(rtt_target_info_t) * count)
|
||||
|
||||
#define TARGET_TYPE(target) (target->type)
|
||||
|
||||
#ifndef BIT
|
||||
#define BIT(x) (1 << (x))
|
||||
#endif
|
||||
|
||||
/* DSSS, CCK and 802.11n rates in [500kbps] units */
|
||||
#define WL_MAXRATE 108 /* in 500kbps units */
|
||||
#define WL_RATE_1M 2 /* in 500kbps units */
|
||||
#define WL_RATE_2M 4 /* in 500kbps units */
|
||||
#define WL_RATE_5M5 11 /* in 500kbps units */
|
||||
#define WL_RATE_11M 22 /* in 500kbps units */
|
||||
#define WL_RATE_6M 12 /* in 500kbps units */
|
||||
#define WL_RATE_9M 18 /* in 500kbps units */
|
||||
#define WL_RATE_12M 24 /* in 500kbps units */
|
||||
#define WL_RATE_18M 36 /* in 500kbps units */
|
||||
#define WL_RATE_24M 48 /* in 500kbps units */
|
||||
#define WL_RATE_36M 72 /* in 500kbps units */
|
||||
#define WL_RATE_48M 96 /* in 500kbps units */
|
||||
#define WL_RATE_54M 108 /* in 500kbps units */
|
||||
#define GET_RTTSTATE(dhd) ((rtt_status_info_t *)dhd->rtt_state)
|
||||
|
||||
enum rtt_role {
|
||||
RTT_INITIATOR = 0,
|
||||
RTT_TARGET = 1
|
||||
};
|
||||
enum rtt_status {
|
||||
RTT_STOPPED = 0,
|
||||
RTT_STARTED = 1,
|
||||
RTT_ENABLED = 2
|
||||
};
|
||||
typedef int64_t wifi_timestamp; /* In microseconds (us) */
|
||||
typedef int64_t wifi_timespan;
|
||||
typedef int32 wifi_rssi_rtt;
|
||||
|
||||
typedef enum {
|
||||
RTT_INVALID,
|
||||
RTT_ONE_WAY,
|
||||
RTT_TWO_WAY,
|
||||
RTT_AUTO
|
||||
} rtt_type_t;
|
||||
|
||||
typedef enum {
|
||||
RTT_PEER_STA,
|
||||
RTT_PEER_AP,
|
||||
RTT_PEER_P2P,
|
||||
RTT_PEER_NAN,
|
||||
RTT_PEER_INVALID
|
||||
} rtt_peer_type_t;
|
||||
|
||||
typedef enum rtt_reason {
|
||||
RTT_REASON_SUCCESS,
|
||||
RTT_REASON_FAILURE,
|
||||
RTT_REASON_FAIL_NO_RSP,
|
||||
RTT_REASON_FAIL_INVALID_TS, /* Invalid timestamp */
|
||||
RTT_REASON_FAIL_PROTOCOL, /* 11mc protocol failed */
|
||||
RTT_REASON_FAIL_REJECTED,
|
||||
RTT_REASON_FAIL_NOT_SCHEDULED_YET,
|
||||
RTT_REASON_FAIL_SCHEDULE, /* schedule failed */
|
||||
RTT_REASON_FAIL_TM_TIMEOUT,
|
||||
RTT_REASON_FAIL_AP_ON_DIFF_CHANNEL,
|
||||
RTT_REASON_FAIL_NO_CAPABILITY,
|
||||
RTT_REASON_FAIL_BUSY_TRY_LATER,
|
||||
RTT_REASON_ABORTED
|
||||
} rtt_reason_t;
|
||||
|
||||
enum {
|
||||
RTT_CAP_ONE_WAY = BIT(0),
|
||||
/* IEEE802.11mc */
|
||||
RTT_CAP_FTM_WAY = BIT(1)
|
||||
};
|
||||
|
||||
enum {
|
||||
RTT_FEATURE_LCI = BIT(0),
|
||||
RTT_FEATURE_LCR = BIT(1),
|
||||
RTT_FEATURE_PREAMBLE = BIT(2),
|
||||
RTT_FEATURE_BW = BIT(3)
|
||||
};
|
||||
|
||||
enum {
|
||||
RTT_PREAMBLE_LEGACY = BIT(0),
|
||||
RTT_PREAMBLE_HT = BIT(1),
|
||||
RTT_PREAMBLE_VHT = BIT(2)
|
||||
};
|
||||
|
||||
|
||||
enum {
|
||||
RTT_BW_5 = BIT(0),
|
||||
RTT_BW_10 = BIT(1),
|
||||
RTT_BW_20 = BIT(2),
|
||||
RTT_BW_40 = BIT(3),
|
||||
RTT_BW_80 = BIT(4),
|
||||
RTT_BW_160 = BIT(5)
|
||||
};
|
||||
#define FTM_MAX_NUM_BURST_EXP 14
|
||||
#define HAS_11MC_CAP(cap) (cap & RTT_CAP_FTM_WAY)
|
||||
#define HAS_ONEWAY_CAP(cap) (cap & RTT_CAP_ONE_WAY)
|
||||
#define HAS_RTT_CAP(cap) (HAS_ONEWAY_CAP(cap) || HAS_11MC_CAP(cap))
|
||||
|
||||
typedef struct wifi_channel_info {
|
||||
wifi_channel_width_t width;
|
||||
wifi_channel center_freq; /* primary 20 MHz channel */
|
||||
wifi_channel center_freq0; /* center freq (MHz) first segment */
|
||||
wifi_channel center_freq1; /* center freq (MHz) second segment valid for 80 + 80 */
|
||||
} wifi_channel_info_t;
|
||||
|
||||
typedef struct wifi_rate {
|
||||
uint32 preamble :3; /* 0: OFDM, 1: CCK, 2 : HT, 3: VHT, 4..7 reserved */
|
||||
uint32 nss :2; /* 1 : 1x1, 2: 2x2, 3: 3x3, 4: 4x4 */
|
||||
uint32 bw :3; /* 0: 20Mhz, 1: 40Mhz, 2: 80Mhz, 3: 160Mhz */
|
||||
/* OFDM/CCK rate code would be as per IEEE std in the unit of 0.5 mb
|
||||
* HT/VHT it would be mcs index
|
||||
*/
|
||||
uint32 rateMcsIdx :8;
|
||||
uint32 reserved :16; /* reserved */
|
||||
uint32 bitrate; /* unit of 100 Kbps */
|
||||
} wifi_rate_t;
|
||||
|
||||
typedef struct rtt_target_info {
|
||||
struct ether_addr addr;
|
||||
rtt_type_t type; /* rtt_type */
|
||||
rtt_peer_type_t peer; /* peer type */
|
||||
wifi_channel_info_t channel; /* channel information */
|
||||
chanspec_t chanspec; /* chanspec for channel */
|
||||
bool disable; /* disable for RTT measurement */
|
||||
/*
|
||||
* Time interval between bursts (units: 100 ms).
|
||||
* Applies to 1-sided and 2-sided RTT multi-burst requests.
|
||||
* Range: 0-31, 0: no preference by initiator (2-sided RTT)
|
||||
*/
|
||||
uint32 burst_period;
|
||||
/*
|
||||
* Total number of RTT bursts to be executed. It will be
|
||||
* specified in the same way as the parameter "Number of
|
||||
* Burst Exponent" found in the FTM frame format. It
|
||||
* applies to both: 1-sided RTT and 2-sided RTT. Valid
|
||||
* values are 0 to 15 as defined in 802.11mc std.
|
||||
* 0 means single shot
|
||||
* The implication of this parameter on the maximum
|
||||
* number of RTT results is the following:
|
||||
* for 1-sided RTT: max num of RTT results = (2^num_burst)*(num_frames_per_burst)
|
||||
* for 2-sided RTT: max num of RTT results = (2^num_burst)*(num_frames_per_burst - 1)
|
||||
*/
|
||||
uint16 num_burst;
|
||||
/*
|
||||
* num of frames per burst.
|
||||
* Minimum value = 1, Maximum value = 31
|
||||
* For 2-sided this equals the number of FTM frames
|
||||
* to be attempted in a single burst. This also
|
||||
* equals the number of FTM frames that the
|
||||
* initiator will request that the responder send
|
||||
* in a single frame
|
||||
*/
|
||||
uint32 num_frames_per_burst;
|
||||
/* num of frames in each RTT burst
|
||||
* for single side, measurement result num = frame number
|
||||
* for 2 side RTT, measurement result num = frame number - 1
|
||||
*/
|
||||
uint32 num_retries_per_ftm; /* retry time for RTT measurment frame */
|
||||
/* following fields are only valid for 2 side RTT */
|
||||
uint32 num_retries_per_ftmr;
|
||||
uint8 LCI_request;
|
||||
uint8 LCR_request;
|
||||
/*
|
||||
* Applies to 1-sided and 2-sided RTT. Valid values will
|
||||
* be 2-11 and 15 as specified by the 802.11mc std for
|
||||
* the FTM parameter burst duration. In a multi-burst
|
||||
* request, if responder overrides with larger value,
|
||||
* the initiator will return failure. In a single-burst
|
||||
* request if responder overrides with larger value,
|
||||
* the initiator will sent TMR_STOP to terminate RTT
|
||||
* at the end of the burst_duration it requested.
|
||||
*/
|
||||
uint32 burst_duration;
|
||||
uint8 preamble; /* 1 - Legacy, 2 - HT, 4 - VHT */
|
||||
uint8 bw; /* 5, 10, 20, 40, 80, 160 */
|
||||
} rtt_target_info_t;
|
||||
|
||||
typedef struct rtt_config_params {
|
||||
int8 rtt_target_cnt;
|
||||
rtt_target_info_t *target_info;
|
||||
} rtt_config_params_t;
|
||||
|
||||
typedef struct rtt_status_info {
|
||||
dhd_pub_t *dhd;
|
||||
int8 status; /* current status for the current entry */
|
||||
int8 txchain; /* current device tx chain */
|
||||
int8 mpc; /* indicate we change mpc mode */
|
||||
int pm; /* to save current value of pm */
|
||||
int8 pm_restore; /* flag to reset the old value of pm */
|
||||
int8 cur_idx; /* current entry to do RTT */
|
||||
bool all_cancel; /* cancel all request once we got the cancel requet */
|
||||
uint32 flags; /* indicate whether device is configured as initiator or target */
|
||||
struct capability {
|
||||
int32 proto :8;
|
||||
int32 feature :8;
|
||||
int32 preamble :8;
|
||||
int32 bw :8;
|
||||
} rtt_capa; /* rtt capability */
|
||||
struct mutex rtt_mutex;
|
||||
rtt_config_params_t rtt_config;
|
||||
struct work_struct work;
|
||||
struct list_head noti_fn_list;
|
||||
struct list_head rtt_results_cache; /* store results for RTT */
|
||||
} rtt_status_info_t;
|
||||
|
||||
typedef struct rtt_report {
|
||||
struct ether_addr addr;
|
||||
unsigned int burst_num; /* # of burst inside a multi-burst request */
|
||||
unsigned int ftm_num; /* total RTT measurement frames attempted */
|
||||
unsigned int success_num; /* total successful RTT measurement frames */
|
||||
uint8 num_per_burst_peer; /* max number of FTM number per burst the peer support */
|
||||
rtt_reason_t status; /* raging status */
|
||||
/* in s, 11mc only, only for RTT_REASON_FAIL_BUSY_TRY_LATER, 1- 31s */
|
||||
uint8 retry_after_duration;
|
||||
rtt_type_t type; /* rtt type */
|
||||
wifi_rssi_rtt rssi; /* average rssi in 0.5 dB steps e.g. 143 implies -71.5 dB */
|
||||
wifi_rssi_rtt rssi_spread; /* rssi spread in 0.5 db steps e.g. 5 implies 2.5 spread */
|
||||
/*
|
||||
* 1-sided RTT: TX rate of RTT frame.
|
||||
* 2-sided RTT: TX rate of initiator's Ack in response to FTM frame.
|
||||
*/
|
||||
wifi_rate_t tx_rate;
|
||||
/*
|
||||
* 1-sided RTT: TX rate of Ack from other side.
|
||||
* 2-sided RTT: TX rate of FTM frame coming from responder.
|
||||
*/
|
||||
wifi_rate_t rx_rate;
|
||||
wifi_timespan rtt; /* round trip time in 0.1 nanoseconds */
|
||||
wifi_timespan rtt_sd; /* rtt standard deviation in 0.1 nanoseconds */
|
||||
wifi_timespan rtt_spread; /* difference between max and min rtt times recorded */
|
||||
int distance; /* distance in cm (optional) */
|
||||
int distance_sd; /* standard deviation in cm (optional) */
|
||||
int distance_spread; /* difference between max and min distance recorded (optional) */
|
||||
wifi_timestamp ts; /* time of the measurement (in microseconds since boot) */
|
||||
int burst_duration; /* in ms, how long the FW time is to fininish one burst measurement */
|
||||
int negotiated_burst_num; /* Number of bursts allowed by the responder */
|
||||
bcm_tlv_t *LCI; /* LCI Report */
|
||||
bcm_tlv_t *LCR; /* Location Civic Report */
|
||||
} rtt_report_t;
|
||||
#define RTT_REPORT_SIZE (sizeof(rtt_report_t))
|
||||
|
||||
/* rtt_results_header to maintain rtt result list per mac address */
|
||||
typedef struct rtt_results_header {
|
||||
struct ether_addr peer_mac;
|
||||
uint32 result_cnt;
|
||||
uint32 result_tot_len; /* sum of report_len of rtt_result */
|
||||
struct list_head list;
|
||||
struct list_head result_list;
|
||||
} rtt_results_header_t;
|
||||
|
||||
/* rtt_result to link all of rtt_report */
|
||||
typedef struct rtt_result {
|
||||
struct list_head list;
|
||||
struct rtt_report report;
|
||||
int32 report_len; /* total length of rtt_report */
|
||||
} rtt_result_t;
|
||||
|
||||
/* RTT Capabilities */
|
||||
typedef struct rtt_capabilities {
|
||||
uint8 rtt_one_sided_supported; /* if 1-sided rtt data collection is supported */
|
||||
uint8 rtt_ftm_supported; /* if ftm rtt data collection is supported */
|
||||
uint8 lci_support; /* location configuration information */
|
||||
uint8 lcr_support; /* Civic Location */
|
||||
uint8 preamble_support; /* bit mask indicate what preamble is supported */
|
||||
uint8 bw_support; /* bit mask indicate what BW is supported */
|
||||
} rtt_capabilities_t;
|
||||
|
||||
|
||||
/* RTT responder information */
|
||||
typedef struct wifi_rtt_responder {
|
||||
wifi_channel_info channel; /* channel of responder */
|
||||
uint8 preamble; /* preamble supported by responder */
|
||||
} wifi_rtt_responder_t;
|
||||
|
||||
typedef void (*dhd_rtt_compl_noti_fn)(void *ctx, void *rtt_data);
|
||||
/* Linux wrapper to call common dhd_rtt_set_cfg */
|
||||
int
|
||||
dhd_dev_rtt_set_cfg(struct net_device *dev, void *buf);
|
||||
|
||||
int
|
||||
dhd_dev_rtt_cancel_cfg(struct net_device *dev, struct ether_addr *mac_list, int mac_cnt);
|
||||
|
||||
int
|
||||
dhd_dev_rtt_register_noti_callback(struct net_device *dev, void *ctx,
|
||||
dhd_rtt_compl_noti_fn noti_fn);
|
||||
|
||||
int
|
||||
dhd_dev_rtt_unregister_noti_callback(struct net_device *dev, dhd_rtt_compl_noti_fn noti_fn);
|
||||
|
||||
int
|
||||
dhd_dev_rtt_capability(struct net_device *dev, rtt_capabilities_t *capa);
|
||||
|
||||
#ifdef WL_CFG80211
|
||||
int
|
||||
dhd_dev_rtt_avail_channel(struct net_device *dev, wifi_channel_info *channel_info);
|
||||
#endif /* WL_CFG80211 */
|
||||
|
||||
int
|
||||
dhd_dev_rtt_enable_responder(struct net_device *dev, wifi_channel_info *channel_info);
|
||||
|
||||
int
|
||||
dhd_dev_rtt_cancel_responder(struct net_device *dev);
|
||||
/* export to upper layer */
|
||||
chanspec_t
|
||||
dhd_rtt_convert_to_chspec(wifi_channel_info_t channel);
|
||||
|
||||
int
|
||||
dhd_rtt_idx_to_burst_duration(uint idx);
|
||||
|
||||
int
|
||||
dhd_rtt_set_cfg(dhd_pub_t *dhd, rtt_config_params_t *params);
|
||||
|
||||
int
|
||||
dhd_rtt_stop(dhd_pub_t *dhd, struct ether_addr *mac_list, int mac_cnt);
|
||||
|
||||
|
||||
int
|
||||
dhd_rtt_register_noti_callback(dhd_pub_t *dhd, void *ctx, dhd_rtt_compl_noti_fn noti_fn);
|
||||
|
||||
int
|
||||
dhd_rtt_unregister_noti_callback(dhd_pub_t *dhd, dhd_rtt_compl_noti_fn noti_fn);
|
||||
|
||||
int
|
||||
dhd_rtt_event_handler(dhd_pub_t *dhd, wl_event_msg_t *event, void *event_data);
|
||||
|
||||
int
|
||||
dhd_rtt_capability(dhd_pub_t *dhd, rtt_capabilities_t *capa);
|
||||
|
||||
int
|
||||
dhd_rtt_avail_channel(dhd_pub_t *dhd, wifi_channel_info *channel_info);
|
||||
|
||||
int
|
||||
dhd_rtt_enable_responder(dhd_pub_t *dhd, wifi_channel_info *channel_info);
|
||||
|
||||
int
|
||||
dhd_rtt_cancel_responder(dhd_pub_t *dhd);
|
||||
|
||||
int
|
||||
dhd_rtt_init(dhd_pub_t *dhd);
|
||||
|
||||
int
|
||||
dhd_rtt_deinit(dhd_pub_t *dhd);
|
||||
#endif /* __DHD_RTT_H__ */
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,535 @@
|
|||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/skbuff.h>
|
||||
|
||||
#define DHD_STATIC_VERSION_STR "1.579.77.41.9"
|
||||
|
||||
#define BCMDHD_SDIO
|
||||
#define BCMDHD_PCIE
|
||||
|
||||
enum dhd_prealloc_index {
|
||||
DHD_PREALLOC_PROT = 0,
|
||||
#if defined(BCMDHD_SDIO)
|
||||
DHD_PREALLOC_RXBUF = 1,
|
||||
DHD_PREALLOC_DATABUF = 2,
|
||||
#endif
|
||||
DHD_PREALLOC_OSL_BUF = 3,
|
||||
DHD_PREALLOC_SKB_BUF = 4,
|
||||
DHD_PREALLOC_WIPHY_ESCAN0 = 5,
|
||||
DHD_PREALLOC_WIPHY_ESCAN1 = 6,
|
||||
DHD_PREALLOC_DHD_INFO = 7,
|
||||
DHD_PREALLOC_DHD_WLFC_INFO = 8,
|
||||
#ifdef BCMDHD_PCIE
|
||||
DHD_PREALLOC_IF_FLOW_LKUP = 9,
|
||||
#endif
|
||||
DHD_PREALLOC_MEMDUMP_BUF = 10,
|
||||
DHD_PREALLOC_MEMDUMP_RAM = 11,
|
||||
DHD_PREALLOC_DHD_WLFC_HANGER = 12,
|
||||
DHD_PREALLOC_PKTID_MAP = 13,
|
||||
DHD_PREALLOC_PKTID_MAP_IOCTL = 14,
|
||||
DHD_PREALLOC_DHD_LOG_DUMP_BUF = 15,
|
||||
DHD_PREALLOC_DHD_LOG_DUMP_BUF_EX = 16,
|
||||
DHD_PREALLOC_DHD_PKTLOG_DUMP_BUF = 17,
|
||||
DHD_PREALLOC_STAT_REPORT_BUF = 18,
|
||||
DHD_PREALLOC_WL_WEXT_INFO = 19,
|
||||
DHD_PREALLOC_FW_VERBOSE_RING = 20,
|
||||
DHD_PREALLOC_FW_EVENT_RING = 21,
|
||||
DHD_PREALLOC_DHD_EVENT_RING = 22,
|
||||
DHD_PREALLOC_NAN_EVENT_RING = 23,
|
||||
DHD_PREALLOC_MAX
|
||||
};
|
||||
|
||||
#define STATIC_BUF_MAX_NUM 20
|
||||
#define STATIC_BUF_SIZE (PAGE_SIZE*2)
|
||||
|
||||
#define DHD_PREALLOC_PROT_SIZE (16 * 1024)
|
||||
#define DHD_PREALLOC_RXBUF_SIZE (24 * 1024)
|
||||
#define DHD_PREALLOC_DATABUF_SIZE (64 * 1024)
|
||||
#define DHD_PREALLOC_OSL_BUF_SIZE (STATIC_BUF_MAX_NUM * STATIC_BUF_SIZE)
|
||||
#define DHD_PREALLOC_WIPHY_ESCAN0_SIZE (64 * 1024)
|
||||
#define DHD_PREALLOC_DHD_INFO_SIZE (32 * 1024)
|
||||
#define DHD_PREALLOC_MEMDUMP_RAM_SIZE (810 * 1024)
|
||||
#define DHD_PREALLOC_DHD_WLFC_HANGER_SIZE (73 * 1024)
|
||||
#define DHD_PREALLOC_WL_WEXT_INFO_SIZE (70 * 1024)
|
||||
#ifdef CONFIG_64BIT
|
||||
#define DHD_PREALLOC_IF_FLOW_LKUP_SIZE (20 * 1024 * 2)
|
||||
#else
|
||||
#define DHD_PREALLOC_IF_FLOW_LKUP_SIZE (20 * 1024)
|
||||
#endif
|
||||
#define FW_VERBOSE_RING_SIZE (64 * 1024)
|
||||
#define FW_EVENT_RING_SIZE (64 * 1024)
|
||||
#define DHD_EVENT_RING_SIZE (64 * 1024)
|
||||
#define NAN_EVENT_RING_SIZE (64 * 1024)
|
||||
|
||||
#if defined(CONFIG_64BIT)
|
||||
#define WLAN_DHD_INFO_BUF_SIZE (24 * 1024)
|
||||
#define WLAN_DHD_WLFC_BUF_SIZE (64 * 1024)
|
||||
#define WLAN_DHD_IF_FLOW_LKUP_SIZE (64 * 1024)
|
||||
#else
|
||||
#define WLAN_DHD_INFO_BUF_SIZE (16 * 1024)
|
||||
#define WLAN_DHD_WLFC_BUF_SIZE (24 * 1024)
|
||||
#define WLAN_DHD_IF_FLOW_LKUP_SIZE (20 * 1024)
|
||||
#endif /* CONFIG_64BIT */
|
||||
#define WLAN_DHD_MEMDUMP_SIZE (800 * 1024)
|
||||
|
||||
#define DHD_SKB_1PAGE_BUFSIZE (PAGE_SIZE*1)
|
||||
#define DHD_SKB_2PAGE_BUFSIZE (PAGE_SIZE*2)
|
||||
#define DHD_SKB_4PAGE_BUFSIZE (PAGE_SIZE*4)
|
||||
|
||||
#define DHD_SKB_1PAGE_BUF_NUM 8
|
||||
#ifdef BCMDHD_PCIE
|
||||
#define DHD_SKB_2PAGE_BUF_NUM 64
|
||||
#elif defined(BCMDHD_SDIO)
|
||||
#define DHD_SKB_2PAGE_BUF_NUM 8
|
||||
#endif
|
||||
#define DHD_SKB_4PAGE_BUF_NUM 1
|
||||
|
||||
/* The number is defined in linux_osl.c
|
||||
* WLAN_SKB_1_2PAGE_BUF_NUM => STATIC_PKT_1_2PAGE_NUM
|
||||
* WLAN_SKB_BUF_NUM => STATIC_PKT_MAX_NUM
|
||||
*/
|
||||
#define WLAN_SKB_1_2PAGE_BUF_NUM ((DHD_SKB_1PAGE_BUF_NUM) + \
|
||||
(DHD_SKB_2PAGE_BUF_NUM))
|
||||
#define WLAN_SKB_BUF_NUM ((WLAN_SKB_1_2PAGE_BUF_NUM) + (DHD_SKB_4PAGE_BUF_NUM))
|
||||
|
||||
void *wlan_static_prot = NULL;
|
||||
void *wlan_static_rxbuf = NULL;
|
||||
void *wlan_static_databuf = NULL;
|
||||
void *wlan_static_osl_buf = NULL;
|
||||
void *wlan_static_scan_buf0 = NULL;
|
||||
void *wlan_static_scan_buf1 = NULL;
|
||||
void *wlan_static_dhd_info_buf = NULL;
|
||||
void *wlan_static_dhd_wlfc_info_buf = NULL;
|
||||
void *wlan_static_if_flow_lkup = NULL;
|
||||
void *wlan_static_dhd_memdump_ram_buf = NULL;
|
||||
void *wlan_static_dhd_wlfc_hanger_buf = NULL;
|
||||
void *wlan_static_wl_escan_info_buf = NULL;
|
||||
void *wlan_static_fw_verbose_ring_buf = NULL;
|
||||
void *wlan_static_fw_event_ring_buf = NULL;
|
||||
void *wlan_static_dhd_event_ring_buf = NULL;
|
||||
void *wlan_static_nan_event_ring_buf = NULL;
|
||||
|
||||
static struct sk_buff *wlan_static_skb[WLAN_SKB_BUF_NUM];
|
||||
|
||||
void *dhd_wlan_mem_prealloc(int section, unsigned long size)
|
||||
{
|
||||
pr_err("%s: sectoin %d, %ld\n", __func__, section, size);
|
||||
if (section == DHD_PREALLOC_PROT)
|
||||
return wlan_static_prot;
|
||||
|
||||
#if defined(BCMDHD_SDIO)
|
||||
if (section == DHD_PREALLOC_RXBUF)
|
||||
return wlan_static_rxbuf;
|
||||
|
||||
if (section == DHD_PREALLOC_DATABUF)
|
||||
return wlan_static_databuf;
|
||||
#endif /* BCMDHD_SDIO */
|
||||
|
||||
if (section == DHD_PREALLOC_SKB_BUF)
|
||||
return wlan_static_skb;
|
||||
|
||||
if (section == DHD_PREALLOC_WIPHY_ESCAN0)
|
||||
return wlan_static_scan_buf0;
|
||||
|
||||
if (section == DHD_PREALLOC_WIPHY_ESCAN1)
|
||||
return wlan_static_scan_buf1;
|
||||
|
||||
if (section == DHD_PREALLOC_OSL_BUF) {
|
||||
if (size > DHD_PREALLOC_OSL_BUF_SIZE) {
|
||||
pr_err("request OSL_BUF(%lu) > %ld\n",
|
||||
size, DHD_PREALLOC_OSL_BUF_SIZE);
|
||||
return NULL;
|
||||
}
|
||||
return wlan_static_osl_buf;
|
||||
}
|
||||
|
||||
if (section == DHD_PREALLOC_DHD_INFO) {
|
||||
if (size > DHD_PREALLOC_DHD_INFO_SIZE) {
|
||||
pr_err("request DHD_INFO size(%lu) > %d\n",
|
||||
size, DHD_PREALLOC_DHD_INFO_SIZE);
|
||||
return NULL;
|
||||
}
|
||||
return wlan_static_dhd_info_buf;
|
||||
}
|
||||
if (section == DHD_PREALLOC_DHD_WLFC_INFO) {
|
||||
if (size > WLAN_DHD_WLFC_BUF_SIZE) {
|
||||
pr_err("request DHD_WLFC_INFO size(%lu) > %d\n",
|
||||
size, WLAN_DHD_WLFC_BUF_SIZE);
|
||||
return NULL;
|
||||
}
|
||||
return wlan_static_dhd_wlfc_info_buf;
|
||||
}
|
||||
#ifdef BCMDHD_PCIE
|
||||
if (section == DHD_PREALLOC_IF_FLOW_LKUP) {
|
||||
if (size > DHD_PREALLOC_IF_FLOW_LKUP_SIZE) {
|
||||
pr_err("request DHD_IF_FLOW_LKUP size(%lu) > %d\n",
|
||||
size, DHD_PREALLOC_IF_FLOW_LKUP_SIZE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return wlan_static_if_flow_lkup;
|
||||
}
|
||||
#endif /* BCMDHD_PCIE */
|
||||
if (section == DHD_PREALLOC_MEMDUMP_RAM) {
|
||||
if (size > DHD_PREALLOC_MEMDUMP_RAM_SIZE) {
|
||||
pr_err("request DHD_PREALLOC_MEMDUMP_RAM_SIZE(%lu) > %d\n",
|
||||
size, DHD_PREALLOC_MEMDUMP_RAM_SIZE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return wlan_static_dhd_memdump_ram_buf;
|
||||
}
|
||||
if (section == DHD_PREALLOC_DHD_WLFC_HANGER) {
|
||||
if (size > DHD_PREALLOC_DHD_WLFC_HANGER_SIZE) {
|
||||
pr_err("request DHD_WLFC_HANGER size(%lu) > %d\n",
|
||||
size, DHD_PREALLOC_DHD_WLFC_HANGER_SIZE);
|
||||
return NULL;
|
||||
}
|
||||
return wlan_static_dhd_wlfc_hanger_buf;
|
||||
}
|
||||
if (section == DHD_PREALLOC_WL_WEXT_INFO) {
|
||||
if (size > DHD_PREALLOC_WL_WEXT_INFO_SIZE) {
|
||||
pr_err("request DHD_PREALLOC_WL_WEXT_INFO_SIZE(%lu) > %d\n",
|
||||
size, DHD_PREALLOC_WL_WEXT_INFO_SIZE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return wlan_static_wl_escan_info_buf;
|
||||
}
|
||||
if (section == DHD_PREALLOC_FW_VERBOSE_RING) {
|
||||
if (size > FW_VERBOSE_RING_SIZE) {
|
||||
pr_err("request DHD_PREALLOC_FW_VERBOSE_RING(%lu) > %d\n",
|
||||
size, FW_VERBOSE_RING_SIZE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return wlan_static_fw_verbose_ring_buf;
|
||||
}
|
||||
if (section == DHD_PREALLOC_FW_EVENT_RING) {
|
||||
if (size > FW_EVENT_RING_SIZE) {
|
||||
pr_err("request DHD_PREALLOC_FW_EVENT_RING(%lu) > %d\n",
|
||||
size, FW_EVENT_RING_SIZE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return wlan_static_fw_event_ring_buf;
|
||||
}
|
||||
if (section == DHD_PREALLOC_DHD_EVENT_RING) {
|
||||
if (size > DHD_EVENT_RING_SIZE) {
|
||||
pr_err("request DHD_PREALLOC_DHD_EVENT_RING(%lu) > %d\n",
|
||||
size, DHD_EVENT_RING_SIZE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return wlan_static_dhd_event_ring_buf;
|
||||
}
|
||||
if (section == DHD_PREALLOC_NAN_EVENT_RING) {
|
||||
if (size > NAN_EVENT_RING_SIZE) {
|
||||
pr_err("request DHD_PREALLOC_NAN_EVENT_RING(%lu) > %d\n",
|
||||
size, NAN_EVENT_RING_SIZE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return wlan_static_nan_event_ring_buf;
|
||||
}
|
||||
if ((section < 0) || (section > DHD_PREALLOC_MAX))
|
||||
pr_err("request section id(%d) is out of max index %d\n",
|
||||
section, DHD_PREALLOC_MAX);
|
||||
|
||||
pr_err("%s: failed to alloc section %d, size=%ld\n",
|
||||
__func__, section, size);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
EXPORT_SYMBOL(dhd_wlan_mem_prealloc);
|
||||
|
||||
static int dhd_init_wlan_mem(void)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
printk(KERN_ERR "%s(): %s\n", __func__, DHD_STATIC_VERSION_STR);
|
||||
|
||||
for (i = 0; i < DHD_SKB_1PAGE_BUF_NUM; i++) {
|
||||
wlan_static_skb[i] = dev_alloc_skb(DHD_SKB_1PAGE_BUFSIZE);
|
||||
if (!wlan_static_skb[i]) {
|
||||
goto err_skb_alloc;
|
||||
}
|
||||
pr_err("%s: sectoin %d skb[%d], size=%ld\n", __func__,
|
||||
DHD_PREALLOC_SKB_BUF, i, DHD_SKB_1PAGE_BUFSIZE);
|
||||
}
|
||||
|
||||
for (i = DHD_SKB_1PAGE_BUF_NUM; i < WLAN_SKB_1_2PAGE_BUF_NUM; i++) {
|
||||
wlan_static_skb[i] = dev_alloc_skb(DHD_SKB_2PAGE_BUFSIZE);
|
||||
if (!wlan_static_skb[i]) {
|
||||
goto err_skb_alloc;
|
||||
}
|
||||
pr_err("%s: sectoin %d skb[%d], size=%ld\n", __func__,
|
||||
DHD_PREALLOC_SKB_BUF, i, DHD_SKB_2PAGE_BUFSIZE);
|
||||
}
|
||||
|
||||
#if defined(BCMDHD_SDIO)
|
||||
wlan_static_skb[i] = dev_alloc_skb(DHD_SKB_4PAGE_BUFSIZE);
|
||||
if (!wlan_static_skb[i])
|
||||
goto err_skb_alloc;
|
||||
pr_err("%s: sectoin %d skb[%d], size=%ld\n", __func__,
|
||||
DHD_PREALLOC_SKB_BUF, i, DHD_SKB_4PAGE_BUFSIZE);
|
||||
#endif /* BCMDHD_SDIO */
|
||||
|
||||
wlan_static_prot = kmalloc(DHD_PREALLOC_PROT_SIZE, GFP_KERNEL);
|
||||
if (!wlan_static_prot)
|
||||
goto err_mem_alloc;
|
||||
pr_err("%s: sectoin %d, size=%d\n", __func__,
|
||||
DHD_PREALLOC_PROT, DHD_PREALLOC_PROT_SIZE);
|
||||
|
||||
#if defined(BCMDHD_SDIO)
|
||||
wlan_static_rxbuf = kmalloc(DHD_PREALLOC_RXBUF_SIZE, GFP_KERNEL);
|
||||
if (!wlan_static_rxbuf)
|
||||
goto err_mem_alloc;
|
||||
pr_err("%s: sectoin %d, size=%d\n", __func__,
|
||||
DHD_PREALLOC_RXBUF, DHD_PREALLOC_RXBUF_SIZE);
|
||||
|
||||
wlan_static_databuf = kmalloc(DHD_PREALLOC_DATABUF_SIZE, GFP_KERNEL);
|
||||
if (!wlan_static_databuf)
|
||||
goto err_mem_alloc;
|
||||
pr_err("%s: sectoin %d, size=%d\n", __func__,
|
||||
DHD_PREALLOC_DATABUF, DHD_PREALLOC_DATABUF_SIZE);
|
||||
#endif /* BCMDHD_SDIO */
|
||||
|
||||
wlan_static_osl_buf = kmalloc(DHD_PREALLOC_OSL_BUF_SIZE, GFP_KERNEL);
|
||||
if (!wlan_static_osl_buf)
|
||||
goto err_mem_alloc;
|
||||
pr_err("%s: sectoin %d, size=%ld\n", __func__,
|
||||
DHD_PREALLOC_OSL_BUF, DHD_PREALLOC_OSL_BUF_SIZE);
|
||||
|
||||
wlan_static_scan_buf0 = kmalloc(DHD_PREALLOC_WIPHY_ESCAN0_SIZE, GFP_KERNEL);
|
||||
if (!wlan_static_scan_buf0)
|
||||
goto err_mem_alloc;
|
||||
pr_err("%s: sectoin %d, size=%d\n", __func__,
|
||||
DHD_PREALLOC_WIPHY_ESCAN0, DHD_PREALLOC_WIPHY_ESCAN0_SIZE);
|
||||
|
||||
wlan_static_dhd_info_buf = kmalloc(DHD_PREALLOC_DHD_INFO_SIZE, GFP_KERNEL);
|
||||
if (!wlan_static_dhd_info_buf)
|
||||
goto err_mem_alloc;
|
||||
pr_err("%s: sectoin %d, size=%d\n", __func__,
|
||||
DHD_PREALLOC_DHD_INFO, DHD_PREALLOC_DHD_INFO_SIZE);
|
||||
|
||||
wlan_static_dhd_wlfc_info_buf = kmalloc(WLAN_DHD_WLFC_BUF_SIZE, GFP_KERNEL);
|
||||
if (!wlan_static_dhd_wlfc_info_buf)
|
||||
goto err_mem_alloc;
|
||||
pr_err("%s: sectoin %d, size=%d\n", __func__,
|
||||
DHD_PREALLOC_DHD_WLFC_INFO, WLAN_DHD_WLFC_BUF_SIZE);
|
||||
|
||||
#ifdef BCMDHD_PCIE
|
||||
wlan_static_if_flow_lkup = kmalloc(DHD_PREALLOC_IF_FLOW_LKUP_SIZE, GFP_KERNEL);
|
||||
if (!wlan_static_if_flow_lkup)
|
||||
goto err_mem_alloc;
|
||||
pr_err("%s: sectoin %d, size=%d\n", __func__,
|
||||
DHD_PREALLOC_IF_FLOW_LKUP, DHD_PREALLOC_IF_FLOW_LKUP_SIZE);
|
||||
#endif /* BCMDHD_PCIE */
|
||||
|
||||
wlan_static_dhd_memdump_ram_buf = kmalloc(DHD_PREALLOC_MEMDUMP_RAM_SIZE, GFP_KERNEL);
|
||||
if (!wlan_static_dhd_memdump_ram_buf)
|
||||
goto err_mem_alloc;
|
||||
pr_err("%s: sectoin %d, size=%d\n", __func__,
|
||||
DHD_PREALLOC_MEMDUMP_RAM, DHD_PREALLOC_MEMDUMP_RAM_SIZE);
|
||||
|
||||
wlan_static_dhd_wlfc_hanger_buf = kmalloc(DHD_PREALLOC_DHD_WLFC_HANGER_SIZE, GFP_KERNEL);
|
||||
if (!wlan_static_dhd_wlfc_hanger_buf)
|
||||
goto err_mem_alloc;
|
||||
pr_err("%s: sectoin %d, size=%d\n", __func__,
|
||||
DHD_PREALLOC_DHD_WLFC_HANGER, DHD_PREALLOC_DHD_WLFC_HANGER_SIZE);
|
||||
|
||||
wlan_static_wl_escan_info_buf = kmalloc(DHD_PREALLOC_WL_WEXT_INFO_SIZE, GFP_KERNEL);
|
||||
if (!wlan_static_wl_escan_info_buf)
|
||||
goto err_mem_alloc;
|
||||
pr_err("%s: sectoin %d, size=%d\n", __func__,
|
||||
DHD_PREALLOC_WL_WEXT_INFO, DHD_PREALLOC_WL_WEXT_INFO_SIZE);
|
||||
|
||||
wlan_static_fw_verbose_ring_buf = kmalloc(FW_VERBOSE_RING_SIZE, GFP_KERNEL);
|
||||
if (!wlan_static_fw_verbose_ring_buf)
|
||||
goto err_mem_alloc;
|
||||
pr_err("%s: sectoin %d, size=%d\n", __func__,
|
||||
DHD_PREALLOC_FW_VERBOSE_RING, FW_VERBOSE_RING_SIZE);
|
||||
|
||||
wlan_static_fw_event_ring_buf = kmalloc(FW_EVENT_RING_SIZE, GFP_KERNEL);
|
||||
if (!wlan_static_fw_event_ring_buf)
|
||||
goto err_mem_alloc;
|
||||
pr_err("%s: sectoin %d, size=%d\n", __func__,
|
||||
DHD_PREALLOC_FW_EVENT_RING, FW_EVENT_RING_SIZE);
|
||||
|
||||
wlan_static_dhd_event_ring_buf = kmalloc(DHD_EVENT_RING_SIZE, GFP_KERNEL);
|
||||
if (!wlan_static_dhd_event_ring_buf)
|
||||
goto err_mem_alloc;
|
||||
pr_err("%s: sectoin %d, size=%d\n", __func__,
|
||||
DHD_PREALLOC_DHD_EVENT_RING, DHD_EVENT_RING_SIZE);
|
||||
|
||||
wlan_static_nan_event_ring_buf = kmalloc(NAN_EVENT_RING_SIZE, GFP_KERNEL);
|
||||
if (!wlan_static_nan_event_ring_buf)
|
||||
goto err_mem_alloc;
|
||||
pr_err("%s: sectoin %d, size=%d\n", __func__,
|
||||
DHD_PREALLOC_NAN_EVENT_RING, NAN_EVENT_RING_SIZE);
|
||||
|
||||
return 0;
|
||||
|
||||
err_mem_alloc:
|
||||
|
||||
if (wlan_static_prot)
|
||||
kfree(wlan_static_prot);
|
||||
|
||||
#if defined(BCMDHD_SDIO)
|
||||
if (wlan_static_rxbuf)
|
||||
kfree(wlan_static_rxbuf);
|
||||
|
||||
if (wlan_static_databuf)
|
||||
kfree(wlan_static_databuf);
|
||||
#endif /* BCMDHD_SDIO */
|
||||
|
||||
if (wlan_static_osl_buf)
|
||||
kfree(wlan_static_osl_buf);
|
||||
|
||||
if (wlan_static_scan_buf0)
|
||||
kfree(wlan_static_scan_buf0);
|
||||
|
||||
if (wlan_static_scan_buf1)
|
||||
kfree(wlan_static_scan_buf1);
|
||||
|
||||
if (wlan_static_dhd_info_buf)
|
||||
kfree(wlan_static_dhd_info_buf);
|
||||
|
||||
if (wlan_static_dhd_wlfc_info_buf)
|
||||
kfree(wlan_static_dhd_wlfc_info_buf);
|
||||
|
||||
#ifdef BCMDHD_PCIE
|
||||
if (wlan_static_if_flow_lkup)
|
||||
kfree(wlan_static_if_flow_lkup);
|
||||
#endif /* BCMDHD_PCIE */
|
||||
|
||||
if (wlan_static_dhd_memdump_ram_buf)
|
||||
kfree(wlan_static_dhd_memdump_ram_buf);
|
||||
|
||||
if (wlan_static_dhd_wlfc_hanger_buf)
|
||||
kfree(wlan_static_dhd_wlfc_hanger_buf);
|
||||
|
||||
if (wlan_static_wl_escan_info_buf)
|
||||
kfree(wlan_static_wl_escan_info_buf);
|
||||
|
||||
#ifdef BCMDHD_PCIE
|
||||
if (wlan_static_fw_verbose_ring_buf)
|
||||
kfree(wlan_static_fw_verbose_ring_buf);
|
||||
|
||||
if (wlan_static_fw_event_ring_buf)
|
||||
kfree(wlan_static_fw_event_ring_buf);
|
||||
|
||||
if (wlan_static_dhd_event_ring_buf)
|
||||
kfree(wlan_static_dhd_event_ring_buf);
|
||||
|
||||
if (wlan_static_nan_event_ring_buf)
|
||||
kfree(wlan_static_nan_event_ring_buf);
|
||||
#endif /* BCMDHD_PCIE */
|
||||
|
||||
pr_err("%s: Failed to mem_alloc for WLAN\n", __func__);
|
||||
|
||||
i = WLAN_SKB_BUF_NUM;
|
||||
|
||||
err_skb_alloc:
|
||||
pr_err("%s: Failed to skb_alloc for WLAN\n", __func__);
|
||||
for (j = 0; j < i; j++)
|
||||
dev_kfree_skb(wlan_static_skb[j]);
|
||||
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
static int __init
|
||||
dhd_static_buf_init(void)
|
||||
{
|
||||
dhd_init_wlan_mem();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __exit
|
||||
dhd_static_buf_exit(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
pr_err("%s()\n", __FUNCTION__);
|
||||
|
||||
for (i = 0; i < DHD_SKB_1PAGE_BUF_NUM; i++) {
|
||||
if (wlan_static_skb[i])
|
||||
dev_kfree_skb(wlan_static_skb[i]);
|
||||
}
|
||||
|
||||
for (i = DHD_SKB_1PAGE_BUF_NUM; i < WLAN_SKB_1_2PAGE_BUF_NUM; i++) {
|
||||
if (wlan_static_skb[i])
|
||||
dev_kfree_skb(wlan_static_skb[i]);
|
||||
}
|
||||
|
||||
#if defined(BCMDHD_SDIO)
|
||||
if (wlan_static_skb[i])
|
||||
dev_kfree_skb(wlan_static_skb[i]);
|
||||
#endif /* BCMDHD_SDIO */
|
||||
|
||||
if (wlan_static_prot)
|
||||
kfree(wlan_static_prot);
|
||||
|
||||
#if defined(BCMDHD_SDIO)
|
||||
if (wlan_static_rxbuf)
|
||||
kfree(wlan_static_rxbuf);
|
||||
|
||||
if (wlan_static_databuf)
|
||||
kfree(wlan_static_databuf);
|
||||
#endif /* BCMDHD_SDIO */
|
||||
|
||||
if (wlan_static_osl_buf)
|
||||
kfree(wlan_static_osl_buf);
|
||||
|
||||
if (wlan_static_scan_buf0)
|
||||
kfree(wlan_static_scan_buf0);
|
||||
|
||||
if (wlan_static_scan_buf1)
|
||||
kfree(wlan_static_scan_buf1);
|
||||
|
||||
if (wlan_static_dhd_info_buf)
|
||||
kfree(wlan_static_dhd_info_buf);
|
||||
|
||||
if (wlan_static_dhd_wlfc_info_buf)
|
||||
kfree(wlan_static_dhd_wlfc_info_buf);
|
||||
|
||||
#ifdef BCMDHD_PCIE
|
||||
if (wlan_static_if_flow_lkup)
|
||||
kfree(wlan_static_if_flow_lkup);
|
||||
#endif /* BCMDHD_PCIE */
|
||||
|
||||
if (wlan_static_dhd_memdump_ram_buf)
|
||||
kfree(wlan_static_dhd_memdump_ram_buf);
|
||||
|
||||
if (wlan_static_dhd_wlfc_hanger_buf)
|
||||
kfree(wlan_static_dhd_wlfc_hanger_buf);
|
||||
|
||||
if (wlan_static_wl_escan_info_buf)
|
||||
kfree(wlan_static_wl_escan_info_buf);
|
||||
|
||||
#ifdef BCMDHD_PCIE
|
||||
if (wlan_static_fw_verbose_ring_buf)
|
||||
kfree(wlan_static_fw_verbose_ring_buf);
|
||||
|
||||
if (wlan_static_fw_event_ring_buf)
|
||||
kfree(wlan_static_fw_event_ring_buf);
|
||||
|
||||
if (wlan_static_dhd_event_ring_buf)
|
||||
kfree(wlan_static_dhd_event_ring_buf);
|
||||
|
||||
if (wlan_static_nan_event_ring_buf)
|
||||
kfree(wlan_static_nan_event_ring_buf);
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
module_init(dhd_static_buf_init);
|
||||
|
||||
module_exit(dhd_static_buf_exit);
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,562 @@
|
|||
/*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: dhd_wlfc.h 671530 2016-11-22 08:43:33Z $
|
||||
*
|
||||
*/
|
||||
#ifndef __wlfc_host_driver_definitions_h__
|
||||
#define __wlfc_host_driver_definitions_h__
|
||||
|
||||
|
||||
/* #define OOO_DEBUG */
|
||||
|
||||
#define KERNEL_THREAD_RETURN_TYPE int
|
||||
|
||||
typedef int (*f_commitpkt_t)(void* ctx, void* p);
|
||||
typedef bool (*f_processpkt_t)(void* p, void* arg);
|
||||
|
||||
#define WLFC_UNSUPPORTED -9999
|
||||
|
||||
#define WLFC_NO_TRAFFIC -1
|
||||
#define WLFC_MULTI_TRAFFIC 0
|
||||
|
||||
#define BUS_RETRIES 1 /* # of retries before aborting a bus tx operation */
|
||||
|
||||
/** 16 bits will provide an absolute max of 65536 slots */
|
||||
#define WLFC_HANGER_MAXITEMS 3072
|
||||
|
||||
#define WLFC_HANGER_ITEM_STATE_FREE 1
|
||||
#define WLFC_HANGER_ITEM_STATE_INUSE 2
|
||||
#define WLFC_HANGER_ITEM_STATE_INUSE_SUPPRESSED 3
|
||||
#define WLFC_HANGER_ITEM_STATE_FLUSHED 4
|
||||
|
||||
#define WLFC_HANGER_PKT_STATE_TXSTATUS 1
|
||||
#define WLFC_HANGER_PKT_STATE_BUSRETURNED 2
|
||||
#define WLFC_HANGER_PKT_STATE_COMPLETE \
|
||||
(WLFC_HANGER_PKT_STATE_TXSTATUS | WLFC_HANGER_PKT_STATE_BUSRETURNED)
|
||||
|
||||
typedef enum {
|
||||
Q_TYPE_PSQ, /**< Power Save Queue, contains both delayed and suppressed packets */
|
||||
Q_TYPE_AFQ /**< At Firmware Queue */
|
||||
} q_type_t;
|
||||
|
||||
typedef enum ewlfc_packet_state {
|
||||
eWLFC_PKTTYPE_NEW, /**< unused in the code (Jan 2015) */
|
||||
eWLFC_PKTTYPE_DELAYED, /**< packet did not enter wlfc yet */
|
||||
eWLFC_PKTTYPE_SUPPRESSED, /**< packet entered wlfc and was suppressed by the dongle */
|
||||
eWLFC_PKTTYPE_MAX
|
||||
} ewlfc_packet_state_t;
|
||||
|
||||
typedef enum ewlfc_mac_entry_action {
|
||||
eWLFC_MAC_ENTRY_ACTION_ADD,
|
||||
eWLFC_MAC_ENTRY_ACTION_DEL,
|
||||
eWLFC_MAC_ENTRY_ACTION_UPDATE,
|
||||
eWLFC_MAC_ENTRY_ACTION_MAX
|
||||
} ewlfc_mac_entry_action_t;
|
||||
|
||||
typedef struct wlfc_hanger_item {
|
||||
uint8 state;
|
||||
uint8 gen;
|
||||
uint8 pkt_state; /**< bitmask containing eg WLFC_HANGER_PKT_STATE_TXCOMPLETE */
|
||||
uint8 pkt_txstatus;
|
||||
uint32 identifier;
|
||||
void* pkt;
|
||||
#ifdef PROP_TXSTATUS_DEBUG
|
||||
uint32 push_time;
|
||||
#endif
|
||||
struct wlfc_hanger_item *next;
|
||||
} wlfc_hanger_item_t;
|
||||
|
||||
/** hanger contains packets that have been posted by the dhd to the dongle and are expected back */
|
||||
typedef struct wlfc_hanger {
|
||||
int max_items;
|
||||
uint32 pushed;
|
||||
uint32 popped;
|
||||
uint32 failed_to_push;
|
||||
uint32 failed_to_pop;
|
||||
uint32 failed_slotfind;
|
||||
uint32 slot_pos;
|
||||
wlfc_hanger_item_t items[1];
|
||||
} wlfc_hanger_t;
|
||||
|
||||
#define WLFC_HANGER_SIZE(n) ((sizeof(wlfc_hanger_t) - \
|
||||
sizeof(wlfc_hanger_item_t)) + ((n)*sizeof(wlfc_hanger_item_t)))
|
||||
|
||||
#define WLFC_STATE_OPEN 1 /**< remote MAC is able to receive packets */
|
||||
#define WLFC_STATE_CLOSE 2 /**< remote MAC is in power save mode */
|
||||
|
||||
#define WLFC_PSQ_PREC_COUNT ((AC_COUNT + 1) * 2) /**< 2 for each AC traffic and bc/mc */
|
||||
#define WLFC_AFQ_PREC_COUNT (AC_COUNT + 1)
|
||||
|
||||
#define WLFC_PSQ_LEN (4096 * 8)
|
||||
|
||||
#ifdef BCMDBUS
|
||||
#define WLFC_FLOWCONTROL_HIWATER 512
|
||||
#define WLFC_FLOWCONTROL_LOWATER (WLFC_FLOWCONTROL_HIWATER / 4)
|
||||
#else
|
||||
#define WLFC_FLOWCONTROL_HIWATER ((4096 * 8) - 256)
|
||||
#define WLFC_FLOWCONTROL_LOWATER 256
|
||||
#endif
|
||||
|
||||
#if (WLFC_FLOWCONTROL_HIWATER >= (WLFC_PSQ_LEN - 256))
|
||||
#undef WLFC_FLOWCONTROL_HIWATER
|
||||
#define WLFC_FLOWCONTROL_HIWATER (WLFC_PSQ_LEN - 256)
|
||||
#undef WLFC_FLOWCONTROL_LOWATER
|
||||
#define WLFC_FLOWCONTROL_LOWATER (WLFC_FLOWCONTROL_HIWATER / 4)
|
||||
#endif
|
||||
|
||||
#define WLFC_LOG_BUF_SIZE (1024*1024)
|
||||
|
||||
/** Properties related to a remote MAC entity */
|
||||
typedef struct wlfc_mac_descriptor {
|
||||
uint8 occupied; /**< if 0, this descriptor is unused and thus can be (re)used */
|
||||
uint8 interface_id;
|
||||
uint8 iftype; /**< eg WLC_E_IF_ROLE_STA */
|
||||
uint8 state; /**< eg WLFC_STATE_OPEN */
|
||||
uint8 ac_bitmap; /**< automatic power save delivery (APSD) */
|
||||
uint8 requested_credit;
|
||||
uint8 requested_packet; /**< unit: [number of packets] */
|
||||
uint8 ea[ETHER_ADDR_LEN];
|
||||
|
||||
/** maintain (MAC,AC) based seq count for packets going to the device. As well as bc/mc. */
|
||||
uint8 seq[AC_COUNT + 1];
|
||||
uint8 generation; /**< toggles between 0 and 1 */
|
||||
struct pktq psq; /**< contains both 'delayed' and 'suppressed' packets */
|
||||
/** packets at firmware queue */
|
||||
struct pktq afq;
|
||||
/** The AC pending bitmap that was reported to the fw at last change */
|
||||
uint8 traffic_lastreported_bmp;
|
||||
/** The new AC pending bitmap */
|
||||
uint8 traffic_pending_bmp;
|
||||
/** 1= send on next opportunity */
|
||||
uint8 send_tim_signal;
|
||||
uint8 mac_handle; /**< mac handles are assigned by the dongle */
|
||||
/** Number of packets at dongle for this entry. */
|
||||
int transit_count;
|
||||
/** Number of suppression to wait before evict from delayQ */
|
||||
int suppr_transit_count;
|
||||
/** pkt sent to bus but no bus TX complete yet */
|
||||
int onbus_pkts_count;
|
||||
/** flag. TRUE when remote MAC is in suppressed state */
|
||||
uint8 suppressed;
|
||||
|
||||
|
||||
#ifdef PROP_TXSTATUS_DEBUG
|
||||
uint32 dstncredit_sent_packets;
|
||||
uint32 dstncredit_acks;
|
||||
uint32 opened_ct;
|
||||
uint32 closed_ct;
|
||||
#endif
|
||||
struct wlfc_mac_descriptor* prev;
|
||||
struct wlfc_mac_descriptor* next;
|
||||
} wlfc_mac_descriptor_t;
|
||||
|
||||
/** A 'commit' is the hand over of a packet from the host OS layer to the layer below (eg DBUS) */
|
||||
typedef struct dhd_wlfc_commit_info {
|
||||
uint8 needs_hdr;
|
||||
uint8 ac_fifo_credit_spent;
|
||||
ewlfc_packet_state_t pkt_type;
|
||||
wlfc_mac_descriptor_t* mac_entry;
|
||||
void* p;
|
||||
} dhd_wlfc_commit_info_t;
|
||||
|
||||
#define WLFC_DECR_SEQCOUNT(entry, prec) do { if (entry->seq[(prec)] == 0) {\
|
||||
entry->seq[prec] = 0xff; } else entry->seq[prec]--;} while (0)
|
||||
|
||||
#define WLFC_INCR_SEQCOUNT(entry, prec) entry->seq[(prec)]++
|
||||
#define WLFC_SEQCOUNT(entry, prec) entry->seq[(prec)]
|
||||
|
||||
typedef struct athost_wl_stat_counters {
|
||||
uint32 pktin;
|
||||
uint32 pktout;
|
||||
uint32 pkt2bus;
|
||||
uint32 pktdropped;
|
||||
uint32 tlv_parse_failed;
|
||||
uint32 rollback;
|
||||
uint32 rollback_failed;
|
||||
uint32 delayq_full_error;
|
||||
uint32 credit_request_failed;
|
||||
uint32 packet_request_failed;
|
||||
uint32 mac_update_failed;
|
||||
uint32 psmode_update_failed;
|
||||
uint32 interface_update_failed;
|
||||
uint32 wlfc_header_only_pkt;
|
||||
uint32 txstatus_in;
|
||||
uint32 d11_suppress;
|
||||
uint32 wl_suppress;
|
||||
uint32 bad_suppress;
|
||||
uint32 pkt_freed;
|
||||
uint32 pkt_free_err;
|
||||
uint32 psq_wlsup_retx;
|
||||
uint32 psq_wlsup_enq;
|
||||
uint32 psq_d11sup_retx;
|
||||
uint32 psq_d11sup_enq;
|
||||
uint32 psq_hostq_retx;
|
||||
uint32 psq_hostq_enq;
|
||||
uint32 mac_handle_notfound;
|
||||
uint32 wlc_tossed_pkts;
|
||||
uint32 dhd_hdrpulls;
|
||||
uint32 generic_error;
|
||||
/* an extra one for bc/mc traffic */
|
||||
uint32 send_pkts[AC_COUNT + 1];
|
||||
uint32 drop_pkts[WLFC_PSQ_PREC_COUNT];
|
||||
uint32 ooo_pkts[AC_COUNT + 1];
|
||||
#ifdef PROP_TXSTATUS_DEBUG
|
||||
/** all pkt2bus -> txstatus latency accumulated */
|
||||
uint32 latency_sample_count;
|
||||
uint32 total_status_latency;
|
||||
uint32 latency_most_recent;
|
||||
int idx_delta;
|
||||
uint32 deltas[10];
|
||||
uint32 fifo_credits_sent[6];
|
||||
uint32 fifo_credits_back[6];
|
||||
uint32 dropped_qfull[6];
|
||||
uint32 signal_only_pkts_sent;
|
||||
uint32 signal_only_pkts_freed;
|
||||
#endif
|
||||
uint32 cleanup_txq_cnt;
|
||||
uint32 cleanup_psq_cnt;
|
||||
uint32 cleanup_fw_cnt;
|
||||
} athost_wl_stat_counters_t;
|
||||
|
||||
#ifdef PROP_TXSTATUS_DEBUG
|
||||
#define WLFC_HOST_FIFO_CREDIT_INC_SENTCTRS(ctx, ac) do { \
|
||||
(ctx)->stats.fifo_credits_sent[(ac)]++;} while (0)
|
||||
#define WLFC_HOST_FIFO_CREDIT_INC_BACKCTRS(ctx, ac) do { \
|
||||
(ctx)->stats.fifo_credits_back[(ac)]++;} while (0)
|
||||
#define WLFC_HOST_FIFO_DROPPEDCTR_INC(ctx, ac) do { \
|
||||
(ctx)->stats.dropped_qfull[(ac)]++;} while (0)
|
||||
#else
|
||||
#define WLFC_HOST_FIFO_CREDIT_INC_SENTCTRS(ctx, ac) do {} while (0)
|
||||
#define WLFC_HOST_FIFO_CREDIT_INC_BACKCTRS(ctx, ac) do {} while (0)
|
||||
#define WLFC_HOST_FIFO_DROPPEDCTR_INC(ctx, ac) do {} while (0)
|
||||
#endif
|
||||
#define WLFC_PACKET_BOUND 10
|
||||
#define WLFC_FCMODE_NONE 0
|
||||
#define WLFC_FCMODE_IMPLIED_CREDIT 1
|
||||
#define WLFC_FCMODE_EXPLICIT_CREDIT 2
|
||||
#define WLFC_ONLY_AMPDU_HOSTREORDER 3
|
||||
|
||||
/** Reserved credits ratio when borrowed by hihger priority */
|
||||
#define WLFC_BORROW_LIMIT_RATIO 4
|
||||
|
||||
/** How long to defer borrowing in milliseconds */
|
||||
#define WLFC_BORROW_DEFER_PERIOD_MS 100
|
||||
|
||||
/** How long to defer flow control in milliseconds */
|
||||
#define WLFC_FC_DEFER_PERIOD_MS 200
|
||||
|
||||
/** How long to detect occurance per AC in miliseconds */
|
||||
#define WLFC_RX_DETECTION_THRESHOLD_MS 100
|
||||
|
||||
/** Mask to represent available ACs (note: BC/MC is ignored) */
|
||||
#define WLFC_AC_MASK 0xF
|
||||
|
||||
/** flow control specific information, only 1 instance during driver lifetime */
|
||||
typedef struct athost_wl_status_info {
|
||||
uint8 last_seqid_to_wlc;
|
||||
|
||||
/** OSL handle */
|
||||
osl_t *osh;
|
||||
/** dhd public struct pointer */
|
||||
void *dhdp;
|
||||
|
||||
f_commitpkt_t fcommit;
|
||||
void* commit_ctx;
|
||||
|
||||
/** statistics */
|
||||
athost_wl_stat_counters_t stats;
|
||||
|
||||
/** incremented on eg receiving a credit map event from the dongle */
|
||||
int Init_FIFO_credit[AC_COUNT + 2];
|
||||
/** the additional ones are for bc/mc and ATIM FIFO */
|
||||
int FIFO_credit[AC_COUNT + 2];
|
||||
/** Credit borrow counts for each FIFO from each of the other FIFOs */
|
||||
int credits_borrowed[AC_COUNT + 2][AC_COUNT + 2];
|
||||
|
||||
/** packet hanger and MAC->handle lookup table */
|
||||
void *hanger;
|
||||
|
||||
struct {
|
||||
/** table for individual nodes */
|
||||
wlfc_mac_descriptor_t nodes[WLFC_MAC_DESC_TABLE_SIZE];
|
||||
/** table for interfaces */
|
||||
wlfc_mac_descriptor_t interfaces[WLFC_MAX_IFNUM];
|
||||
/* OS may send packets to unknown (unassociated) destinations */
|
||||
/** A place holder for bc/mc and packets to unknown destinations */
|
||||
wlfc_mac_descriptor_t other;
|
||||
} destination_entries;
|
||||
|
||||
wlfc_mac_descriptor_t *active_entry_head; /**< a chain of MAC descriptors */
|
||||
int active_entry_count;
|
||||
|
||||
wlfc_mac_descriptor_t *requested_entry[WLFC_MAC_DESC_TABLE_SIZE];
|
||||
int requested_entry_count;
|
||||
|
||||
/* pkt counts for each interface and ac */
|
||||
int pkt_cnt_in_q[WLFC_MAX_IFNUM][AC_COUNT+1];
|
||||
int pkt_cnt_per_ac[AC_COUNT+1];
|
||||
int pkt_cnt_in_drv[WLFC_MAX_IFNUM][AC_COUNT+1];
|
||||
int pkt_cnt_in_psq;
|
||||
uint8 allow_fc; /**< Boolean */
|
||||
uint32 fc_defer_timestamp;
|
||||
uint32 rx_timestamp[AC_COUNT+1];
|
||||
|
||||
/** ON/OFF state for flow control to the host network interface */
|
||||
uint8 hostif_flow_state[WLFC_MAX_IFNUM];
|
||||
uint8 host_ifidx;
|
||||
|
||||
/** to flow control an OS interface */
|
||||
uint8 toggle_host_if;
|
||||
|
||||
/** To borrow credits */
|
||||
uint8 allow_credit_borrow;
|
||||
|
||||
/** ac number for the first single ac traffic */
|
||||
uint8 single_ac;
|
||||
|
||||
/** Timestamp for the first single ac traffic */
|
||||
uint32 single_ac_timestamp;
|
||||
|
||||
bool bcmc_credit_supported;
|
||||
|
||||
} athost_wl_status_info_t;
|
||||
|
||||
/** Please be mindful that total pkttag space is 32 octets only */
|
||||
typedef struct dhd_pkttag {
|
||||
|
||||
#ifdef BCM_OBJECT_TRACE
|
||||
/* if use this field, keep it at the first 4 bytes */
|
||||
uint32 sn;
|
||||
#endif /* BCM_OBJECT_TRACE */
|
||||
|
||||
/**
|
||||
b[15] - 1 = wlfc packet
|
||||
b[14:13] - encryption exemption
|
||||
b[12 ] - 1 = event channel
|
||||
b[11 ] - 1 = this packet was sent in response to one time packet request,
|
||||
do not increment credit on status for this one. [WLFC_CTL_TYPE_MAC_REQUEST_PACKET].
|
||||
b[10 ] - 1 = signal-only-packet to firmware [i.e. nothing to piggyback on]
|
||||
b[9 ] - 1 = packet is host->firmware (transmit direction)
|
||||
- 0 = packet received from firmware (firmware->host)
|
||||
b[8 ] - 1 = packet was sent due to credit_request (pspoll),
|
||||
packet does not count against FIFO credit.
|
||||
- 0 = normal transaction, packet counts against FIFO credit
|
||||
b[7 ] - 1 = AP, 0 = STA
|
||||
b[6:4] - AC FIFO number
|
||||
b[3:0] - interface index
|
||||
*/
|
||||
uint16 if_flags;
|
||||
|
||||
/**
|
||||
* destination MAC address for this packet so that not every module needs to open the packet
|
||||
* to find this
|
||||
*/
|
||||
uint8 dstn_ether[ETHER_ADDR_LEN];
|
||||
|
||||
/** This 32-bit goes from host to device for every packet. */
|
||||
uint32 htod_tag;
|
||||
|
||||
/** This 16-bit is original d11seq number for every suppressed packet. */
|
||||
uint16 htod_seq;
|
||||
|
||||
/** This address is mac entry for every packet. */
|
||||
void *entry;
|
||||
|
||||
/** bus specific stuff */
|
||||
union {
|
||||
struct {
|
||||
void *stuff;
|
||||
uint32 thing1;
|
||||
uint32 thing2;
|
||||
} sd;
|
||||
|
||||
struct {
|
||||
void *bus;
|
||||
void *urb;
|
||||
} usb;
|
||||
} bus_specific;
|
||||
} dhd_pkttag_t;
|
||||
|
||||
#define DHD_PKTTAG_WLFCPKT_MASK 0x1
|
||||
#define DHD_PKTTAG_WLFCPKT_SHIFT 15
|
||||
#define DHD_PKTTAG_WLFCPKT_SET(tag, value) ((dhd_pkttag_t*)(tag))->if_flags = \
|
||||
(((dhd_pkttag_t*)(tag))->if_flags & \
|
||||
~(DHD_PKTTAG_WLFCPKT_MASK << DHD_PKTTAG_WLFCPKT_SHIFT)) | \
|
||||
(((value) & DHD_PKTTAG_WLFCPKT_MASK) << DHD_PKTTAG_WLFCPKT_SHIFT)
|
||||
#define DHD_PKTTAG_WLFCPKT(tag) ((((dhd_pkttag_t*)(tag))->if_flags >> \
|
||||
DHD_PKTTAG_WLFCPKT_SHIFT) & DHD_PKTTAG_WLFCPKT_MASK)
|
||||
|
||||
#define DHD_PKTTAG_EXEMPT_MASK 0x3
|
||||
#define DHD_PKTTAG_EXEMPT_SHIFT 13
|
||||
#define DHD_PKTTAG_EXEMPT_SET(tag, value) ((dhd_pkttag_t*)(tag))->if_flags = \
|
||||
(((dhd_pkttag_t*)(tag))->if_flags & \
|
||||
~(DHD_PKTTAG_EXEMPT_MASK << DHD_PKTTAG_EXEMPT_SHIFT)) | \
|
||||
(((value) & DHD_PKTTAG_EXEMPT_MASK) << DHD_PKTTAG_EXEMPT_SHIFT)
|
||||
#define DHD_PKTTAG_EXEMPT(tag) ((((dhd_pkttag_t*)(tag))->if_flags >> \
|
||||
DHD_PKTTAG_EXEMPT_SHIFT) & DHD_PKTTAG_EXEMPT_MASK)
|
||||
|
||||
#define DHD_PKTTAG_EVENT_MASK 0x1
|
||||
#define DHD_PKTTAG_EVENT_SHIFT 12
|
||||
#define DHD_PKTTAG_SETEVENT(tag, event) ((dhd_pkttag_t*)(tag))->if_flags = \
|
||||
(((dhd_pkttag_t*)(tag))->if_flags & \
|
||||
~(DHD_PKTTAG_EVENT_MASK << DHD_PKTTAG_EVENT_SHIFT)) | \
|
||||
(((event) & DHD_PKTTAG_EVENT_MASK) << DHD_PKTTAG_EVENT_SHIFT)
|
||||
#define DHD_PKTTAG_EVENT(tag) ((((dhd_pkttag_t*)(tag))->if_flags >> \
|
||||
DHD_PKTTAG_EVENT_SHIFT) & DHD_PKTTAG_EVENT_MASK)
|
||||
|
||||
#define DHD_PKTTAG_ONETIMEPKTRQST_MASK 0x1
|
||||
#define DHD_PKTTAG_ONETIMEPKTRQST_SHIFT 11
|
||||
#define DHD_PKTTAG_SETONETIMEPKTRQST(tag) ((dhd_pkttag_t*)(tag))->if_flags = \
|
||||
(((dhd_pkttag_t*)(tag))->if_flags & \
|
||||
~(DHD_PKTTAG_ONETIMEPKTRQST_MASK << DHD_PKTTAG_ONETIMEPKTRQST_SHIFT)) | \
|
||||
(1 << DHD_PKTTAG_ONETIMEPKTRQST_SHIFT)
|
||||
#define DHD_PKTTAG_ONETIMEPKTRQST(tag) ((((dhd_pkttag_t*)(tag))->if_flags >> \
|
||||
DHD_PKTTAG_ONETIMEPKTRQST_SHIFT) & DHD_PKTTAG_ONETIMEPKTRQST_MASK)
|
||||
|
||||
#define DHD_PKTTAG_SIGNALONLY_MASK 0x1
|
||||
#define DHD_PKTTAG_SIGNALONLY_SHIFT 10
|
||||
#define DHD_PKTTAG_SETSIGNALONLY(tag, signalonly) ((dhd_pkttag_t*)(tag))->if_flags = \
|
||||
(((dhd_pkttag_t*)(tag))->if_flags & \
|
||||
~(DHD_PKTTAG_SIGNALONLY_MASK << DHD_PKTTAG_SIGNALONLY_SHIFT)) | \
|
||||
(((signalonly) & DHD_PKTTAG_SIGNALONLY_MASK) << DHD_PKTTAG_SIGNALONLY_SHIFT)
|
||||
#define DHD_PKTTAG_SIGNALONLY(tag) ((((dhd_pkttag_t*)(tag))->if_flags >> \
|
||||
DHD_PKTTAG_SIGNALONLY_SHIFT) & DHD_PKTTAG_SIGNALONLY_MASK)
|
||||
|
||||
#define DHD_PKTTAG_PKTDIR_MASK 0x1
|
||||
#define DHD_PKTTAG_PKTDIR_SHIFT 9
|
||||
#define DHD_PKTTAG_SETPKTDIR(tag, dir) ((dhd_pkttag_t*)(tag))->if_flags = \
|
||||
(((dhd_pkttag_t*)(tag))->if_flags & \
|
||||
~(DHD_PKTTAG_PKTDIR_MASK << DHD_PKTTAG_PKTDIR_SHIFT)) | \
|
||||
(((dir) & DHD_PKTTAG_PKTDIR_MASK) << DHD_PKTTAG_PKTDIR_SHIFT)
|
||||
#define DHD_PKTTAG_PKTDIR(tag) ((((dhd_pkttag_t*)(tag))->if_flags >> \
|
||||
DHD_PKTTAG_PKTDIR_SHIFT) & DHD_PKTTAG_PKTDIR_MASK)
|
||||
|
||||
#define DHD_PKTTAG_CREDITCHECK_MASK 0x1
|
||||
#define DHD_PKTTAG_CREDITCHECK_SHIFT 8
|
||||
#define DHD_PKTTAG_SETCREDITCHECK(tag, check) ((dhd_pkttag_t*)(tag))->if_flags = \
|
||||
(((dhd_pkttag_t*)(tag))->if_flags & \
|
||||
~(DHD_PKTTAG_CREDITCHECK_MASK << DHD_PKTTAG_CREDITCHECK_SHIFT)) | \
|
||||
(((check) & DHD_PKTTAG_CREDITCHECK_MASK) << DHD_PKTTAG_CREDITCHECK_SHIFT)
|
||||
#define DHD_PKTTAG_CREDITCHECK(tag) ((((dhd_pkttag_t*)(tag))->if_flags >> \
|
||||
DHD_PKTTAG_CREDITCHECK_SHIFT) & DHD_PKTTAG_CREDITCHECK_MASK)
|
||||
|
||||
#define DHD_PKTTAG_IFTYPE_MASK 0x1
|
||||
#define DHD_PKTTAG_IFTYPE_SHIFT 7
|
||||
#define DHD_PKTTAG_SETIFTYPE(tag, isAP) ((dhd_pkttag_t*)(tag))->if_flags = \
|
||||
(((dhd_pkttag_t*)(tag))->if_flags & \
|
||||
~(DHD_PKTTAG_IFTYPE_MASK << DHD_PKTTAG_IFTYPE_SHIFT)) | \
|
||||
(((isAP) & DHD_PKTTAG_IFTYPE_MASK) << DHD_PKTTAG_IFTYPE_SHIFT)
|
||||
#define DHD_PKTTAG_IFTYPE(tag) ((((dhd_pkttag_t*)(tag))->if_flags >> \
|
||||
DHD_PKTTAG_IFTYPE_SHIFT) & DHD_PKTTAG_IFTYPE_MASK)
|
||||
|
||||
#define DHD_PKTTAG_FIFO_MASK 0x7
|
||||
#define DHD_PKTTAG_FIFO_SHIFT 4
|
||||
#define DHD_PKTTAG_SETFIFO(tag, fifo) ((dhd_pkttag_t*)(tag))->if_flags = \
|
||||
(((dhd_pkttag_t*)(tag))->if_flags & ~(DHD_PKTTAG_FIFO_MASK << DHD_PKTTAG_FIFO_SHIFT)) | \
|
||||
(((fifo) & DHD_PKTTAG_FIFO_MASK) << DHD_PKTTAG_FIFO_SHIFT)
|
||||
#define DHD_PKTTAG_FIFO(tag) ((((dhd_pkttag_t*)(tag))->if_flags >> \
|
||||
DHD_PKTTAG_FIFO_SHIFT) & DHD_PKTTAG_FIFO_MASK)
|
||||
|
||||
#define DHD_PKTTAG_IF_MASK 0xf
|
||||
#define DHD_PKTTAG_IF_SHIFT 0
|
||||
#define DHD_PKTTAG_SETIF(tag, if) ((dhd_pkttag_t*)(tag))->if_flags = \
|
||||
(((dhd_pkttag_t*)(tag))->if_flags & ~(DHD_PKTTAG_IF_MASK << DHD_PKTTAG_IF_SHIFT)) | \
|
||||
(((if) & DHD_PKTTAG_IF_MASK) << DHD_PKTTAG_IF_SHIFT)
|
||||
#define DHD_PKTTAG_IF(tag) ((((dhd_pkttag_t*)(tag))->if_flags >> \
|
||||
DHD_PKTTAG_IF_SHIFT) & DHD_PKTTAG_IF_MASK)
|
||||
|
||||
#define DHD_PKTTAG_SETDSTN(tag, dstn_MAC_ea) memcpy(((dhd_pkttag_t*)((tag)))->dstn_ether, \
|
||||
(dstn_MAC_ea), ETHER_ADDR_LEN)
|
||||
#define DHD_PKTTAG_DSTN(tag) ((dhd_pkttag_t*)(tag))->dstn_ether
|
||||
|
||||
#define DHD_PKTTAG_SET_H2DTAG(tag, h2dvalue) ((dhd_pkttag_t*)(tag))->htod_tag = (h2dvalue)
|
||||
#define DHD_PKTTAG_H2DTAG(tag) (((dhd_pkttag_t*)(tag))->htod_tag)
|
||||
|
||||
#define DHD_PKTTAG_SET_H2DSEQ(tag, seq) ((dhd_pkttag_t*)(tag))->htod_seq = (seq)
|
||||
#define DHD_PKTTAG_H2DSEQ(tag) (((dhd_pkttag_t*)(tag))->htod_seq)
|
||||
|
||||
#define DHD_PKTTAG_SET_ENTRY(tag, entry) ((dhd_pkttag_t*)(tag))->entry = (entry)
|
||||
#define DHD_PKTTAG_ENTRY(tag) (((dhd_pkttag_t*)(tag))->entry)
|
||||
|
||||
#define PSQ_SUP_IDX(x) (x * 2 + 1)
|
||||
#define PSQ_DLY_IDX(x) (x * 2)
|
||||
|
||||
#ifdef PROP_TXSTATUS_DEBUG
|
||||
#define DHD_WLFC_CTRINC_MAC_CLOSE(entry) do { (entry)->closed_ct++; } while (0)
|
||||
#define DHD_WLFC_CTRINC_MAC_OPEN(entry) do { (entry)->opened_ct++; } while (0)
|
||||
#else
|
||||
#define DHD_WLFC_CTRINC_MAC_CLOSE(entry) do {} while (0)
|
||||
#define DHD_WLFC_CTRINC_MAC_OPEN(entry) do {} while (0)
|
||||
#endif
|
||||
|
||||
#ifdef BCM_OBJECT_TRACE
|
||||
#define DHD_PKTTAG_SET_SN(tag, val) ((dhd_pkttag_t*)(tag))->sn = (val)
|
||||
#define DHD_PKTTAG_SN(tag) (((dhd_pkttag_t*)(tag))->sn)
|
||||
#endif /* BCM_OBJECT_TRACE */
|
||||
|
||||
/* public functions */
|
||||
int dhd_wlfc_parse_header_info(dhd_pub_t *dhd, void* pktbuf, int tlv_hdr_len,
|
||||
uchar *reorder_info_buf, uint *reorder_info_len);
|
||||
KERNEL_THREAD_RETURN_TYPE dhd_wlfc_transfer_packets(void *data);
|
||||
int dhd_wlfc_commit_packets(dhd_pub_t *dhdp, f_commitpkt_t fcommit,
|
||||
void* commit_ctx, void *pktbuf, bool need_toggle_host_if);
|
||||
int dhd_wlfc_txcomplete(dhd_pub_t *dhd, void *txp, bool success);
|
||||
int dhd_wlfc_init(dhd_pub_t *dhd);
|
||||
#ifdef SUPPORT_P2P_GO_PS
|
||||
int dhd_wlfc_suspend(dhd_pub_t *dhd);
|
||||
int dhd_wlfc_resume(dhd_pub_t *dhd);
|
||||
#endif /* SUPPORT_P2P_GO_PS */
|
||||
int dhd_wlfc_hostreorder_init(dhd_pub_t *dhd);
|
||||
int dhd_wlfc_cleanup_txq(dhd_pub_t *dhd, f_processpkt_t fn, void *arg);
|
||||
int dhd_wlfc_cleanup(dhd_pub_t *dhd, f_processpkt_t fn, void* arg);
|
||||
int dhd_wlfc_deinit(dhd_pub_t *dhd);
|
||||
int dhd_wlfc_interface_event(dhd_pub_t *dhdp, uint8 action, uint8 ifid, uint8 iftype, uint8* ea);
|
||||
int dhd_wlfc_FIFOcreditmap_event(dhd_pub_t *dhdp, uint8* event_data);
|
||||
#ifdef LIMIT_BORROW
|
||||
int dhd_wlfc_disable_credit_borrow_event(dhd_pub_t *dhdp, uint8* event_data);
|
||||
#endif /* LIMIT_BORROW */
|
||||
int dhd_wlfc_BCMCCredit_support_event(dhd_pub_t *dhdp);
|
||||
int dhd_wlfc_enable(dhd_pub_t *dhdp);
|
||||
int dhd_wlfc_dump(dhd_pub_t *dhdp, struct bcmstrbuf *strbuf);
|
||||
int dhd_wlfc_clear_counts(dhd_pub_t *dhd);
|
||||
int dhd_wlfc_get_enable(dhd_pub_t *dhd, bool *val);
|
||||
int dhd_wlfc_get_mode(dhd_pub_t *dhd, int *val);
|
||||
int dhd_wlfc_set_mode(dhd_pub_t *dhd, int val);
|
||||
bool dhd_wlfc_is_supported(dhd_pub_t *dhd);
|
||||
bool dhd_wlfc_is_header_only_pkt(dhd_pub_t * dhd, void *pktbuf);
|
||||
int dhd_wlfc_flowcontrol(dhd_pub_t *dhdp, bool state, bool bAcquireLock);
|
||||
int dhd_wlfc_save_rxpath_ac_time(dhd_pub_t * dhd, uint8 prio);
|
||||
|
||||
int dhd_wlfc_get_module_ignore(dhd_pub_t *dhd, int *val);
|
||||
int dhd_wlfc_set_module_ignore(dhd_pub_t *dhd, int val);
|
||||
int dhd_wlfc_get_credit_ignore(dhd_pub_t *dhd, int *val);
|
||||
int dhd_wlfc_set_credit_ignore(dhd_pub_t *dhd, int val);
|
||||
int dhd_wlfc_get_txstatus_ignore(dhd_pub_t *dhd, int *val);
|
||||
int dhd_wlfc_set_txstatus_ignore(dhd_pub_t *dhd, int val);
|
||||
|
||||
int dhd_wlfc_get_rxpkt_chk(dhd_pub_t *dhd, int *val);
|
||||
int dhd_wlfc_set_rxpkt_chk(dhd_pub_t *dhd, int val);
|
||||
|
||||
#endif /* __wlfc_host_driver_definitions_h__ */
|
|
@ -0,0 +1,383 @@
|
|||
/*
|
||||
* Common stats definitions for clients of dongle
|
||||
* ports
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: dngl_stats.h 681171 2017-01-25 05:27:08Z $
|
||||
*/
|
||||
|
||||
#ifndef _dngl_stats_h_
|
||||
#define _dngl_stats_h_
|
||||
|
||||
#include <ethernet.h>
|
||||
#include <802.11.h>
|
||||
|
||||
typedef struct {
|
||||
unsigned long rx_packets; /* total packets received */
|
||||
unsigned long tx_packets; /* total packets transmitted */
|
||||
unsigned long rx_bytes; /* total bytes received */
|
||||
unsigned long tx_bytes; /* total bytes transmitted */
|
||||
unsigned long rx_errors; /* bad packets received */
|
||||
unsigned long tx_errors; /* packet transmit problems */
|
||||
unsigned long rx_dropped; /* packets dropped by dongle */
|
||||
unsigned long tx_dropped; /* packets dropped by dongle */
|
||||
unsigned long multicast; /* multicast packets received */
|
||||
} dngl_stats_t;
|
||||
|
||||
typedef int32 wifi_radio;
|
||||
typedef int32 wifi_channel;
|
||||
typedef int32 wifi_rssi;
|
||||
typedef struct { uint16 version; uint16 length; } ver_len;
|
||||
|
||||
typedef enum wifi_channel_width {
|
||||
WIFI_CHAN_WIDTH_20 = 0,
|
||||
WIFI_CHAN_WIDTH_40 = 1,
|
||||
WIFI_CHAN_WIDTH_80 = 2,
|
||||
WIFI_CHAN_WIDTH_160 = 3,
|
||||
WIFI_CHAN_WIDTH_80P80 = 4,
|
||||
WIFI_CHAN_WIDTH_5 = 5,
|
||||
WIFI_CHAN_WIDTH_10 = 6,
|
||||
WIFI_CHAN_WIDTH_INVALID = -1
|
||||
} wifi_channel_width_t;
|
||||
|
||||
typedef enum {
|
||||
WIFI_DISCONNECTED = 0,
|
||||
WIFI_AUTHENTICATING = 1,
|
||||
WIFI_ASSOCIATING = 2,
|
||||
WIFI_ASSOCIATED = 3,
|
||||
WIFI_EAPOL_STARTED = 4, /* if done by firmware/driver */
|
||||
WIFI_EAPOL_COMPLETED = 5, /* if done by firmware/driver */
|
||||
} wifi_connection_state;
|
||||
|
||||
typedef enum {
|
||||
WIFI_ROAMING_IDLE = 0,
|
||||
WIFI_ROAMING_ACTIVE = 1
|
||||
} wifi_roam_state;
|
||||
|
||||
typedef enum {
|
||||
WIFI_INTERFACE_STA = 0,
|
||||
WIFI_INTERFACE_SOFTAP = 1,
|
||||
WIFI_INTERFACE_IBSS = 2,
|
||||
WIFI_INTERFACE_P2P_CLIENT = 3,
|
||||
WIFI_INTERFACE_P2P_GO = 4,
|
||||
WIFI_INTERFACE_NAN = 5,
|
||||
WIFI_INTERFACE_MESH = 6
|
||||
} wifi_interface_mode;
|
||||
|
||||
#define WIFI_CAPABILITY_QOS 0x00000001 /* set for QOS association */
|
||||
#define WIFI_CAPABILITY_PROTECTED 0x00000002 /* set for protected association (802.11
|
||||
* beacon frame control protected bit set)
|
||||
*/
|
||||
#define WIFI_CAPABILITY_INTERWORKING 0x00000004 /* set if 802.11 Extended Capabilities
|
||||
* element interworking bit is set
|
||||
*/
|
||||
#define WIFI_CAPABILITY_HS20 0x00000008 /* set for HS20 association */
|
||||
#define WIFI_CAPABILITY_SSID_UTF8 0x00000010 /* set is 802.11 Extended Capabilities
|
||||
* element UTF-8 SSID bit is set
|
||||
*/
|
||||
#define WIFI_CAPABILITY_COUNTRY 0x00000020 /* set is 802.11 Country Element is present */
|
||||
#define PACK_ATTRIBUTE __attribute__ ((packed))
|
||||
typedef struct {
|
||||
wifi_interface_mode mode; /* interface mode */
|
||||
uint8 mac_addr[6]; /* interface mac address (self) */
|
||||
wifi_connection_state state; /* connection state (valid for STA, CLI only) */
|
||||
wifi_roam_state roaming; /* roaming state */
|
||||
uint32 capabilities; /* WIFI_CAPABILITY_XXX (self) */
|
||||
uint8 ssid[DOT11_MAX_SSID_LEN+1]; /* null terminated SSID */
|
||||
uint8 bssid[ETHER_ADDR_LEN]; /* bssid */
|
||||
uint8 ap_country_str[3]; /* country string advertised by AP */
|
||||
uint8 country_str[3]; /* country string for this association */
|
||||
} wifi_interface_info;
|
||||
|
||||
typedef wifi_interface_info *wifi_interface_handle;
|
||||
|
||||
/* channel information */
|
||||
typedef struct {
|
||||
wifi_channel_width_t width; /* channel width (20, 40, 80, 80+80, 160) */
|
||||
wifi_channel center_freq; /* primary 20 MHz channel */
|
||||
wifi_channel center_freq0; /* center frequency (MHz) first segment */
|
||||
wifi_channel center_freq1; /* center frequency (MHz) second segment */
|
||||
} wifi_channel_info;
|
||||
|
||||
/* wifi rate */
|
||||
typedef struct {
|
||||
uint32 preamble; /* 0: OFDM, 1:CCK, 2:HT 3:VHT 4..7 reserved */
|
||||
uint32 nss; /* 0:1x1, 1:2x2, 3:3x3, 4:4x4 */
|
||||
uint32 bw; /* 0:20MHz, 1:40Mhz, 2:80Mhz, 3:160Mhz */
|
||||
uint32 rateMcsIdx; /* OFDM/CCK rate code would be as per ieee std
|
||||
* in the units of 0.5mbps
|
||||
*/
|
||||
/* HT/VHT it would be mcs index */
|
||||
uint32 reserved; /* reserved */
|
||||
uint32 bitrate; /* units of 100 Kbps */
|
||||
} wifi_rate;
|
||||
|
||||
typedef struct {
|
||||
uint32 preamble :3; /* 0: OFDM, 1:CCK, 2:HT 3:VHT 4..7 reserved */
|
||||
uint32 nss :2; /* 0:1x1, 1:2x2, 3:3x3, 4:4x4 */
|
||||
uint32 bw :3; /* 0:20MHz, 1:40Mhz, 2:80Mhz, 3:160Mhz */
|
||||
uint32 rateMcsIdx :8; /* OFDM/CCK rate code would be as per ieee std
|
||||
* in the units of 0.5mbps HT/VHT it would be
|
||||
* mcs index
|
||||
*/
|
||||
uint32 reserved :16; /* reserved */
|
||||
uint32 bitrate; /* units of 100 Kbps */
|
||||
} wifi_rate_v1;
|
||||
|
||||
/* channel statistics */
|
||||
typedef struct {
|
||||
wifi_channel_info channel; /* channel */
|
||||
uint32 on_time; /* msecs the radio is awake (32 bits number
|
||||
* accruing over time)
|
||||
*/
|
||||
uint32 cca_busy_time; /* msecs the CCA register is busy (32 bits number
|
||||
* accruing over time)
|
||||
*/
|
||||
} wifi_channel_stat;
|
||||
|
||||
/* radio statistics */
|
||||
typedef struct {
|
||||
struct {
|
||||
uint16 version;
|
||||
uint16 length;
|
||||
};
|
||||
wifi_radio radio; /* wifi radio (if multiple radio supported) */
|
||||
uint32 on_time; /* msecs the radio is awake (32 bits number
|
||||
* accruing over time)
|
||||
*/
|
||||
uint32 tx_time; /* msecs the radio is transmitting (32 bits
|
||||
* number accruing over time)
|
||||
*/
|
||||
uint32 rx_time; /* msecs the radio is in active receive (32 bits
|
||||
* number accruing over time)
|
||||
*/
|
||||
uint32 on_time_scan; /* msecs the radio is awake due to all scan (32 bits
|
||||
* number accruing over time)
|
||||
*/
|
||||
uint32 on_time_nbd; /* msecs the radio is awake due to NAN (32 bits
|
||||
* number accruing over time)
|
||||
*/
|
||||
uint32 on_time_gscan; /* msecs the radio is awake due to G?scan (32 bits
|
||||
* number accruing over time)
|
||||
*/
|
||||
uint32 on_time_roam_scan; /* msecs the radio is awake due to roam?scan (32 bits
|
||||
* number accruing over time)
|
||||
*/
|
||||
uint32 on_time_pno_scan; /* msecs the radio is awake due to PNO scan (32 bits
|
||||
* number accruing over time)
|
||||
*/
|
||||
uint32 on_time_hs20; /* msecs the radio is awake due to HS2.0 scans and
|
||||
* GAS exchange (32 bits number accruing over time)
|
||||
*/
|
||||
uint32 num_channels; /* number of channels */
|
||||
wifi_channel_stat channels[1]; /* channel statistics */
|
||||
} wifi_radio_stat;
|
||||
|
||||
typedef struct {
|
||||
wifi_radio radio;
|
||||
uint32 on_time;
|
||||
uint32 tx_time;
|
||||
uint32 rx_time;
|
||||
uint32 on_time_scan;
|
||||
uint32 on_time_nbd;
|
||||
uint32 on_time_gscan;
|
||||
uint32 on_time_roam_scan;
|
||||
uint32 on_time_pno_scan;
|
||||
uint32 on_time_hs20;
|
||||
uint32 num_channels;
|
||||
} wifi_radio_stat_h;
|
||||
|
||||
/* per rate statistics */
|
||||
typedef struct {
|
||||
wifi_rate_v1 rate; /* rate information */
|
||||
uint32 tx_mpdu; /* number of successfully transmitted data pkts (ACK rcvd) */
|
||||
uint32 rx_mpdu; /* number of received data pkts */
|
||||
uint32 mpdu_lost; /* number of data packet losses (no ACK) */
|
||||
uint32 retries; /* total number of data pkt retries */
|
||||
uint32 retries_short; /* number of short data pkt retries */
|
||||
uint32 retries_long; /* number of long data pkt retries */
|
||||
} wifi_rate_stat_v1;
|
||||
|
||||
typedef struct {
|
||||
uint16 version;
|
||||
uint16 length;
|
||||
uint32 tx_mpdu; /* number of successfully transmitted data pkts (ACK rcvd) */
|
||||
uint32 rx_mpdu; /* number of received data pkts */
|
||||
uint32 mpdu_lost; /* number of data packet losses (no ACK) */
|
||||
uint32 retries; /* total number of data pkt retries */
|
||||
uint32 retries_short; /* number of short data pkt retries */
|
||||
uint32 retries_long; /* number of long data pkt retries */
|
||||
wifi_rate rate;
|
||||
} wifi_rate_stat;
|
||||
|
||||
/* access categories */
|
||||
typedef enum {
|
||||
WIFI_AC_VO = 0,
|
||||
WIFI_AC_VI = 1,
|
||||
WIFI_AC_BE = 2,
|
||||
WIFI_AC_BK = 3,
|
||||
WIFI_AC_MAX = 4
|
||||
} wifi_traffic_ac;
|
||||
|
||||
/* wifi peer type */
|
||||
typedef enum
|
||||
{
|
||||
WIFI_PEER_STA,
|
||||
WIFI_PEER_AP,
|
||||
WIFI_PEER_P2P_GO,
|
||||
WIFI_PEER_P2P_CLIENT,
|
||||
WIFI_PEER_NAN,
|
||||
WIFI_PEER_TDLS,
|
||||
WIFI_PEER_INVALID
|
||||
} wifi_peer_type;
|
||||
|
||||
/* per peer statistics */
|
||||
typedef struct {
|
||||
wifi_peer_type type; /* peer type (AP, TDLS, GO etc.) */
|
||||
uint8 peer_mac_address[6]; /* mac address */
|
||||
uint32 capabilities; /* peer WIFI_CAPABILITY_XXX */
|
||||
uint32 num_rate; /* number of rates */
|
||||
wifi_rate_stat rate_stats[1]; /* per rate statistics, number of entries = num_rate */
|
||||
} wifi_peer_info;
|
||||
|
||||
/* per access category statistics */
|
||||
typedef struct {
|
||||
wifi_traffic_ac ac; /* access category (VI, VO, BE, BK) */
|
||||
uint32 tx_mpdu; /* number of successfully transmitted unicast data pkts
|
||||
* (ACK rcvd)
|
||||
*/
|
||||
uint32 rx_mpdu; /* number of received unicast mpdus */
|
||||
uint32 tx_mcast; /* number of succesfully transmitted multicast
|
||||
* data packets
|
||||
*/
|
||||
/* STA case: implies ACK received from AP for the
|
||||
* unicast packet in which mcast pkt was sent
|
||||
*/
|
||||
uint32 rx_mcast; /* number of received multicast data packets */
|
||||
uint32 rx_ampdu; /* number of received unicast a-mpdus */
|
||||
uint32 tx_ampdu; /* number of transmitted unicast a-mpdus */
|
||||
uint32 mpdu_lost; /* number of data pkt losses (no ACK) */
|
||||
uint32 retries; /* total number of data pkt retries */
|
||||
uint32 retries_short; /* number of short data pkt retries */
|
||||
uint32 retries_long; /* number of long data pkt retries */
|
||||
uint32 contention_time_min; /* data pkt min contention time (usecs) */
|
||||
uint32 contention_time_max; /* data pkt max contention time (usecs) */
|
||||
uint32 contention_time_avg; /* data pkt avg contention time (usecs) */
|
||||
uint32 contention_num_samples; /* num of data pkts used for contention statistics */
|
||||
} wifi_wmm_ac_stat;
|
||||
|
||||
/* interface statistics */
|
||||
typedef struct {
|
||||
wifi_interface_handle iface; /* wifi interface */
|
||||
wifi_interface_info info; /* current state of the interface */
|
||||
uint32 beacon_rx; /* access point beacon received count from
|
||||
* connected AP
|
||||
*/
|
||||
uint64 average_tsf_offset; /* average beacon offset encountered (beacon_TSF - TBTT)
|
||||
* The average_tsf_offset field is used so as to calculate
|
||||
* the typical beacon contention time on the channel as well
|
||||
* may be used to debug beacon synchronization and related
|
||||
* power consumption issue
|
||||
*/
|
||||
uint32 leaky_ap_detected; /* indicate that this AP
|
||||
* typically leaks packets beyond
|
||||
* the driver guard time.
|
||||
*/
|
||||
uint32 leaky_ap_avg_num_frames_leaked; /* average number of frame leaked by AP after
|
||||
* frame with PM bit set was ACK'ed by AP
|
||||
*/
|
||||
uint32 leaky_ap_guard_time; /* guard time currently in force
|
||||
* (when implementing IEEE power management
|
||||
* based on frame control PM bit), How long
|
||||
* driver waits before shutting down the radio and after
|
||||
* receiving an ACK for a data frame with PM bit set)
|
||||
*/
|
||||
uint32 mgmt_rx; /* access point mgmt frames received count from
|
||||
* connected AP (including Beacon)
|
||||
*/
|
||||
uint32 mgmt_action_rx; /* action frames received count */
|
||||
uint32 mgmt_action_tx; /* action frames transmit count */
|
||||
wifi_rssi rssi_mgmt; /* access Point Beacon and Management frames RSSI
|
||||
* (averaged)
|
||||
*/
|
||||
wifi_rssi rssi_data; /* access Point Data Frames RSSI (averaged) from
|
||||
* connected AP
|
||||
*/
|
||||
wifi_rssi rssi_ack; /* access Point ACK RSSI (averaged) from
|
||||
* connected AP
|
||||
*/
|
||||
wifi_wmm_ac_stat ac[WIFI_AC_MAX]; /* per ac data packet statistics */
|
||||
uint32 num_peers; /* number of peers */
|
||||
wifi_peer_info peer_info[1]; /* per peer statistics */
|
||||
} wifi_iface_stat;
|
||||
|
||||
#ifdef CONFIG_COMPAT
|
||||
/* interface statistics */
|
||||
typedef struct {
|
||||
compat_uptr_t iface; /* wifi interface */
|
||||
wifi_interface_info info; /* current state of the interface */
|
||||
uint32 beacon_rx; /* access point beacon received count from
|
||||
* connected AP
|
||||
*/
|
||||
uint64 average_tsf_offset; /* average beacon offset encountered (beacon_TSF - TBTT)
|
||||
* The average_tsf_offset field is used so as to calculate
|
||||
* the typical beacon contention time on the channel as well
|
||||
* may be used to debug beacon synchronization and related
|
||||
* power consumption issue
|
||||
*/
|
||||
uint32 leaky_ap_detected; /* indicate that this AP
|
||||
* typically leaks packets beyond
|
||||
* the driver guard time.
|
||||
*/
|
||||
uint32 leaky_ap_avg_num_frames_leaked; /* average number of frame leaked by AP after
|
||||
* frame with PM bit set was ACK'ed by AP
|
||||
*/
|
||||
uint32 leaky_ap_guard_time; /* guard time currently in force
|
||||
* (when implementing IEEE power management
|
||||
* based on frame control PM bit), How long
|
||||
* driver waits before shutting down the radio and after
|
||||
* receiving an ACK for a data frame with PM bit set)
|
||||
*/
|
||||
uint32 mgmt_rx; /* access point mgmt frames received count from
|
||||
* connected AP (including Beacon)
|
||||
*/
|
||||
uint32 mgmt_action_rx; /* action frames received count */
|
||||
uint32 mgmt_action_tx; /* action frames transmit count */
|
||||
wifi_rssi rssi_mgmt; /* access Point Beacon and Management frames RSSI
|
||||
* (averaged)
|
||||
*/
|
||||
wifi_rssi rssi_data; /* access Point Data Frames RSSI (averaged) from
|
||||
* connected AP
|
||||
*/
|
||||
wifi_rssi rssi_ack; /* access Point ACK RSSI (averaged) from
|
||||
* connected AP
|
||||
*/
|
||||
wifi_wmm_ac_stat ac[WIFI_AC_MAX]; /* per ac data packet statistics */
|
||||
uint32 num_peers; /* number of peers */
|
||||
wifi_peer_info peer_info[1]; /* per peer statistics */
|
||||
} compat_wifi_iface_stat;
|
||||
#endif /* CONFIG_COMPAT */
|
||||
|
||||
#endif /* _dngl_stats_h_ */
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Dongle WL Header definitions
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: dngl_wlhdr.h 514727 2014-11-12 03:02:48Z $
|
||||
*/
|
||||
|
||||
#ifndef _dngl_wlhdr_h_
|
||||
#define _dngl_wlhdr_h_
|
||||
|
||||
typedef struct wl_header {
|
||||
uint8 type; /* Header type */
|
||||
uint8 version; /* Header version */
|
||||
int8 rssi; /* RSSI */
|
||||
uint8 pad; /* Unused */
|
||||
} wl_header_t;
|
||||
|
||||
#define WL_HEADER_LEN sizeof(wl_header_t)
|
||||
#define WL_HEADER_TYPE 0
|
||||
#define WL_HEADER_VER 1
|
||||
#endif /* _dngl_wlhdr_h_ */
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,973 @@
|
|||
/*
|
||||
* HND generic pktq operation primitives
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: hnd_pktq.c 644628 2016-06-21 06:25:58Z $
|
||||
*/
|
||||
|
||||
#include <typedefs.h>
|
||||
#include <osl.h>
|
||||
#include <osl_ext.h>
|
||||
#include <bcmutils.h>
|
||||
#include <hnd_pktq.h>
|
||||
|
||||
/* mutex macros for thread safe */
|
||||
#ifdef HND_PKTQ_THREAD_SAFE
|
||||
#define HND_PKTQ_MUTEX_CREATE(name, mutex) osl_ext_mutex_create(name, mutex)
|
||||
#define HND_PKTQ_MUTEX_DELETE(mutex) osl_ext_mutex_delete(mutex)
|
||||
#define HND_PKTQ_MUTEX_ACQUIRE(mutex, msec) osl_ext_mutex_acquire(mutex, msec)
|
||||
#define HND_PKTQ_MUTEX_RELEASE(mutex) osl_ext_mutex_release(mutex)
|
||||
#else
|
||||
#define HND_PKTQ_MUTEX_CREATE(name, mutex) OSL_EXT_SUCCESS
|
||||
#define HND_PKTQ_MUTEX_DELETE(mutex) OSL_EXT_SUCCESS
|
||||
#define HND_PKTQ_MUTEX_ACQUIRE(mutex, msec) OSL_EXT_SUCCESS
|
||||
#define HND_PKTQ_MUTEX_RELEASE(mutex) OSL_EXT_SUCCESS
|
||||
#endif /* */
|
||||
|
||||
/*
|
||||
* osl multiple-precedence packet queue
|
||||
* hi_prec is always >= the number of the highest non-empty precedence
|
||||
*/
|
||||
void * BCMFASTPATH
|
||||
pktq_penq(struct pktq *pq, int prec, void *p)
|
||||
{
|
||||
struct pktq_prec *q;
|
||||
|
||||
/* protect shared resource */
|
||||
if (HND_PKTQ_MUTEX_ACQUIRE(&pq->mutex, OSL_EXT_TIME_FOREVER) != OSL_EXT_SUCCESS)
|
||||
return NULL;
|
||||
|
||||
ASSERT(prec >= 0 && prec < pq->num_prec);
|
||||
ASSERT(PKTLINK(p) == NULL); /* queueing chains not allowed */
|
||||
|
||||
ASSERT(!pktq_full(pq));
|
||||
ASSERT(!pktq_pfull(pq, prec));
|
||||
|
||||
q = &pq->q[prec];
|
||||
|
||||
if (q->head)
|
||||
PKTSETLINK(q->tail, p);
|
||||
else
|
||||
q->head = p;
|
||||
|
||||
q->tail = p;
|
||||
q->len++;
|
||||
|
||||
pq->len++;
|
||||
|
||||
if (pq->hi_prec < prec)
|
||||
pq->hi_prec = (uint8)prec;
|
||||
|
||||
/* protect shared resource */
|
||||
if (HND_PKTQ_MUTEX_RELEASE(&pq->mutex) != OSL_EXT_SUCCESS)
|
||||
return NULL;
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
void * BCMFASTPATH
|
||||
pktq_penq_head(struct pktq *pq, int prec, void *p)
|
||||
{
|
||||
struct pktq_prec *q;
|
||||
|
||||
/* protect shared resource */
|
||||
if (HND_PKTQ_MUTEX_ACQUIRE(&pq->mutex, OSL_EXT_TIME_FOREVER) != OSL_EXT_SUCCESS)
|
||||
return NULL;
|
||||
|
||||
ASSERT(prec >= 0 && prec < pq->num_prec);
|
||||
ASSERT(PKTLINK(p) == NULL); /* queueing chains not allowed */
|
||||
|
||||
ASSERT(!pktq_full(pq));
|
||||
ASSERT(!pktq_pfull(pq, prec));
|
||||
|
||||
q = &pq->q[prec];
|
||||
|
||||
if (q->head == NULL)
|
||||
q->tail = p;
|
||||
|
||||
PKTSETLINK(p, q->head);
|
||||
q->head = p;
|
||||
q->len++;
|
||||
|
||||
pq->len++;
|
||||
|
||||
if (pq->hi_prec < prec)
|
||||
pq->hi_prec = (uint8)prec;
|
||||
|
||||
/* protect shared resource */
|
||||
if (HND_PKTQ_MUTEX_RELEASE(&pq->mutex) != OSL_EXT_SUCCESS)
|
||||
return NULL;
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
/*
|
||||
* Append spktq 'list' to the tail of pktq 'pq'
|
||||
*/
|
||||
void BCMFASTPATH
|
||||
pktq_append(struct pktq *pq, int prec, struct spktq *list)
|
||||
{
|
||||
struct pktq_prec *q;
|
||||
struct pktq_prec *list_q;
|
||||
|
||||
/* protect shared resource */
|
||||
if (HND_PKTQ_MUTEX_ACQUIRE(&pq->mutex, OSL_EXT_TIME_FOREVER) != OSL_EXT_SUCCESS)
|
||||
return;
|
||||
|
||||
list_q = &list->q[0];
|
||||
|
||||
/* empty list check */
|
||||
if (list_q->head == NULL)
|
||||
goto done;
|
||||
|
||||
ASSERT(prec >= 0 && prec < pq->num_prec);
|
||||
ASSERT(PKTLINK(list_q->tail) == NULL); /* terminated list */
|
||||
|
||||
ASSERT(!pktq_full(pq));
|
||||
ASSERT(!pktq_pfull(pq, prec));
|
||||
|
||||
q = &pq->q[prec];
|
||||
|
||||
if (q->head)
|
||||
PKTSETLINK(q->tail, list_q->head);
|
||||
else
|
||||
q->head = list_q->head;
|
||||
|
||||
q->tail = list_q->tail;
|
||||
q->len += list_q->len;
|
||||
pq->len += list_q->len;
|
||||
|
||||
if (pq->hi_prec < prec)
|
||||
pq->hi_prec = (uint8)prec;
|
||||
|
||||
list_q->head = NULL;
|
||||
list_q->tail = NULL;
|
||||
list_q->len = 0;
|
||||
list->len = 0;
|
||||
|
||||
done:
|
||||
/* protect shared resource */
|
||||
if (HND_PKTQ_MUTEX_RELEASE(&pq->mutex) != OSL_EXT_SUCCESS)
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Prepend spktq 'list' to the head of pktq 'pq'
|
||||
*/
|
||||
void BCMFASTPATH
|
||||
pktq_prepend(struct pktq *pq, int prec, struct spktq *list)
|
||||
{
|
||||
struct pktq_prec *q;
|
||||
struct pktq_prec *list_q;
|
||||
|
||||
/* protect shared resource */
|
||||
if (HND_PKTQ_MUTEX_ACQUIRE(&pq->mutex, OSL_EXT_TIME_FOREVER) != OSL_EXT_SUCCESS)
|
||||
return;
|
||||
|
||||
list_q = &list->q[0];
|
||||
|
||||
/* empty list check */
|
||||
if (list_q->head == NULL)
|
||||
goto done;
|
||||
|
||||
ASSERT(prec >= 0 && prec < pq->num_prec);
|
||||
ASSERT(PKTLINK(list_q->tail) == NULL); /* terminated list */
|
||||
|
||||
ASSERT(!pktq_full(pq));
|
||||
ASSERT(!pktq_pfull(pq, prec));
|
||||
|
||||
q = &pq->q[prec];
|
||||
|
||||
/* set the tail packet of list to point at the former pq head */
|
||||
PKTSETLINK(list_q->tail, q->head);
|
||||
/* the new q head is the head of list */
|
||||
q->head = list_q->head;
|
||||
|
||||
/* If the q tail was non-null, then it stays as is.
|
||||
* If the q tail was null, it is now the tail of list
|
||||
*/
|
||||
if (q->tail == NULL) {
|
||||
q->tail = list_q->tail;
|
||||
}
|
||||
|
||||
q->len += list_q->len;
|
||||
pq->len += list_q->len;
|
||||
|
||||
if (pq->hi_prec < prec)
|
||||
pq->hi_prec = (uint8)prec;
|
||||
|
||||
list_q->head = NULL;
|
||||
list_q->tail = NULL;
|
||||
list_q->len = 0;
|
||||
list->len = 0;
|
||||
|
||||
done:
|
||||
/* protect shared resource */
|
||||
if (HND_PKTQ_MUTEX_RELEASE(&pq->mutex) != OSL_EXT_SUCCESS)
|
||||
return;
|
||||
}
|
||||
|
||||
void * BCMFASTPATH
|
||||
pktq_pdeq(struct pktq *pq, int prec)
|
||||
{
|
||||
struct pktq_prec *q;
|
||||
void *p;
|
||||
|
||||
/* protect shared resource */
|
||||
if (HND_PKTQ_MUTEX_ACQUIRE(&pq->mutex, OSL_EXT_TIME_FOREVER) != OSL_EXT_SUCCESS)
|
||||
return NULL;
|
||||
|
||||
ASSERT(prec >= 0 && prec < pq->num_prec);
|
||||
|
||||
q = &pq->q[prec];
|
||||
|
||||
if ((p = q->head) == NULL)
|
||||
goto done;
|
||||
|
||||
if ((q->head = PKTLINK(p)) == NULL)
|
||||
q->tail = NULL;
|
||||
|
||||
q->len--;
|
||||
|
||||
pq->len--;
|
||||
|
||||
PKTSETLINK(p, NULL);
|
||||
|
||||
done:
|
||||
/* protect shared resource */
|
||||
if (HND_PKTQ_MUTEX_RELEASE(&pq->mutex) != OSL_EXT_SUCCESS)
|
||||
return NULL;
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
void * BCMFASTPATH
|
||||
pktq_pdeq_prev(struct pktq *pq, int prec, void *prev_p)
|
||||
{
|
||||
struct pktq_prec *q;
|
||||
void *p = NULL;
|
||||
|
||||
/* protect shared resource */
|
||||
if (HND_PKTQ_MUTEX_ACQUIRE(&pq->mutex, OSL_EXT_TIME_FOREVER) != OSL_EXT_SUCCESS)
|
||||
return NULL;
|
||||
|
||||
ASSERT(prec >= 0 && prec < pq->num_prec);
|
||||
|
||||
q = &pq->q[prec];
|
||||
|
||||
if (prev_p == NULL)
|
||||
goto done;
|
||||
|
||||
if ((p = PKTLINK(prev_p)) == NULL)
|
||||
goto done;
|
||||
|
||||
q->len--;
|
||||
|
||||
pq->len--;
|
||||
|
||||
PKTSETLINK(prev_p, PKTLINK(p));
|
||||
PKTSETLINK(p, NULL);
|
||||
|
||||
done:
|
||||
/* protect shared resource */
|
||||
if (HND_PKTQ_MUTEX_RELEASE(&pq->mutex) != OSL_EXT_SUCCESS)
|
||||
return NULL;
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
void * BCMFASTPATH
|
||||
pktq_pdeq_with_fn(struct pktq *pq, int prec, ifpkt_cb_t fn, int arg)
|
||||
{
|
||||
struct pktq_prec *q;
|
||||
void *p, *prev = NULL;
|
||||
|
||||
/* protect shared resource */
|
||||
if (HND_PKTQ_MUTEX_ACQUIRE(&pq->mutex, OSL_EXT_TIME_FOREVER) != OSL_EXT_SUCCESS)
|
||||
return NULL;
|
||||
|
||||
ASSERT(prec >= 0 && prec < pq->num_prec);
|
||||
|
||||
q = &pq->q[prec];
|
||||
p = q->head;
|
||||
|
||||
while (p) {
|
||||
if (fn == NULL || (*fn)(p, arg)) {
|
||||
break;
|
||||
} else {
|
||||
prev = p;
|
||||
p = PKTLINK(p);
|
||||
}
|
||||
}
|
||||
if (p == NULL)
|
||||
goto done;
|
||||
|
||||
if (prev == NULL) {
|
||||
if ((q->head = PKTLINK(p)) == NULL) {
|
||||
q->tail = NULL;
|
||||
}
|
||||
} else {
|
||||
PKTSETLINK(prev, PKTLINK(p));
|
||||
if (q->tail == p) {
|
||||
q->tail = prev;
|
||||
}
|
||||
}
|
||||
|
||||
q->len--;
|
||||
|
||||
pq->len--;
|
||||
|
||||
PKTSETLINK(p, NULL);
|
||||
|
||||
done:
|
||||
/* protect shared resource */
|
||||
if (HND_PKTQ_MUTEX_RELEASE(&pq->mutex) != OSL_EXT_SUCCESS)
|
||||
return NULL;
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
void * BCMFASTPATH
|
||||
pktq_pdeq_tail(struct pktq *pq, int prec)
|
||||
{
|
||||
struct pktq_prec *q;
|
||||
void *p, *prev;
|
||||
|
||||
/* protect shared resource */
|
||||
if (HND_PKTQ_MUTEX_ACQUIRE(&pq->mutex, OSL_EXT_TIME_FOREVER) != OSL_EXT_SUCCESS)
|
||||
return NULL;
|
||||
|
||||
ASSERT(prec >= 0 && prec < pq->num_prec);
|
||||
|
||||
q = &pq->q[prec];
|
||||
|
||||
if ((p = q->head) == NULL)
|
||||
goto done;
|
||||
|
||||
for (prev = NULL; p != q->tail; p = PKTLINK(p))
|
||||
prev = p;
|
||||
|
||||
if (prev)
|
||||
PKTSETLINK(prev, NULL);
|
||||
else
|
||||
q->head = NULL;
|
||||
|
||||
q->tail = prev;
|
||||
q->len--;
|
||||
|
||||
pq->len--;
|
||||
|
||||
done:
|
||||
/* protect shared resource */
|
||||
if (HND_PKTQ_MUTEX_RELEASE(&pq->mutex) != OSL_EXT_SUCCESS)
|
||||
return NULL;
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
bool BCMFASTPATH
|
||||
pktq_pdel(struct pktq *pq, void *pktbuf, int prec)
|
||||
{
|
||||
bool ret = FALSE;
|
||||
struct pktq_prec *q;
|
||||
void *p = NULL;
|
||||
|
||||
/* protect shared resource */
|
||||
if (HND_PKTQ_MUTEX_ACQUIRE(&pq->mutex, OSL_EXT_TIME_FOREVER) != OSL_EXT_SUCCESS)
|
||||
return FALSE;
|
||||
|
||||
ASSERT(prec >= 0 && prec < pq->num_prec);
|
||||
|
||||
/* Should this just assert pktbuf? */
|
||||
if (!pktbuf)
|
||||
goto done;
|
||||
|
||||
q = &pq->q[prec];
|
||||
|
||||
if (q->head == pktbuf) {
|
||||
if ((q->head = PKTLINK(pktbuf)) == NULL)
|
||||
q->tail = NULL;
|
||||
} else {
|
||||
for (p = q->head; p && PKTLINK(p) != pktbuf; p = PKTLINK(p))
|
||||
;
|
||||
if (p == NULL)
|
||||
goto done;
|
||||
|
||||
PKTSETLINK(p, PKTLINK(pktbuf));
|
||||
if (q->tail == pktbuf)
|
||||
q->tail = p;
|
||||
}
|
||||
|
||||
q->len--;
|
||||
pq->len--;
|
||||
PKTSETLINK(pktbuf, NULL);
|
||||
ret = TRUE;
|
||||
|
||||
done:
|
||||
/* protect shared resource */
|
||||
if (HND_PKTQ_MUTEX_RELEASE(&pq->mutex) != OSL_EXT_SUCCESS)
|
||||
return FALSE;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
_pktq_pfilter(struct pktq *pq, int prec, pktq_filter_t fltr, void* fltr_ctx,
|
||||
defer_free_pkt_fn_t defer, void *defer_ctx)
|
||||
{
|
||||
struct pktq_prec wq;
|
||||
struct pktq_prec *q;
|
||||
void *p;
|
||||
|
||||
/* protect shared resource */
|
||||
if (HND_PKTQ_MUTEX_ACQUIRE(&pq->mutex, OSL_EXT_TIME_FOREVER) != OSL_EXT_SUCCESS)
|
||||
return;
|
||||
|
||||
/* move the prec queue aside to a work queue */
|
||||
q = &pq->q[prec];
|
||||
|
||||
wq = *q;
|
||||
|
||||
q->head = NULL;
|
||||
q->tail = NULL;
|
||||
q->len = 0;
|
||||
|
||||
pq->len -= wq.len;
|
||||
|
||||
/* protect shared resource */
|
||||
if (HND_PKTQ_MUTEX_RELEASE(&pq->mutex) != OSL_EXT_SUCCESS)
|
||||
return;
|
||||
|
||||
/* start with the head of the work queue */
|
||||
while ((p = wq.head) != NULL) {
|
||||
/* unlink the current packet from the list */
|
||||
wq.head = PKTLINK(p);
|
||||
PKTSETLINK(p, NULL);
|
||||
wq.len--;
|
||||
|
||||
/* call the filter function on current packet */
|
||||
ASSERT(fltr != NULL);
|
||||
switch ((*fltr)(fltr_ctx, p)) {
|
||||
case PKT_FILTER_NOACTION:
|
||||
/* put this packet back */
|
||||
pktq_penq(pq, prec, p);
|
||||
break;
|
||||
|
||||
case PKT_FILTER_DELETE:
|
||||
/* delete this packet */
|
||||
ASSERT(defer != NULL);
|
||||
(*defer)(defer_ctx, p);
|
||||
break;
|
||||
|
||||
case PKT_FILTER_REMOVE:
|
||||
/* pkt already removed from list */
|
||||
break;
|
||||
|
||||
default:
|
||||
ASSERT(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ASSERT(wq.len == 0);
|
||||
}
|
||||
|
||||
void
|
||||
pktq_pfilter(struct pktq *pq, int prec, pktq_filter_t fltr, void* fltr_ctx,
|
||||
defer_free_pkt_fn_t defer, void *defer_ctx, flush_free_pkt_fn_t flush, void *flush_ctx)
|
||||
{
|
||||
_pktq_pfilter(pq, prec, fltr, fltr_ctx, defer, defer_ctx);
|
||||
|
||||
ASSERT(flush != NULL);
|
||||
(*flush)(flush_ctx);
|
||||
}
|
||||
|
||||
void
|
||||
pktq_filter(struct pktq *pq, pktq_filter_t fltr, void* fltr_ctx,
|
||||
defer_free_pkt_fn_t defer, void *defer_ctx, flush_free_pkt_fn_t flush, void *flush_ctx)
|
||||
{
|
||||
bool filter = FALSE;
|
||||
|
||||
/* protect shared resource */
|
||||
if (HND_PKTQ_MUTEX_ACQUIRE(&pq->mutex, OSL_EXT_TIME_FOREVER) != OSL_EXT_SUCCESS)
|
||||
return;
|
||||
|
||||
/* Optimize if pktq len = 0, just return.
|
||||
* pktq len of 0 means pktq's prec q's are all empty.
|
||||
*/
|
||||
if (pq->len > 0) {
|
||||
filter = TRUE;
|
||||
}
|
||||
|
||||
/* protect shared resource */
|
||||
if (HND_PKTQ_MUTEX_RELEASE(&pq->mutex) != OSL_EXT_SUCCESS)
|
||||
return;
|
||||
|
||||
if (filter) {
|
||||
int prec;
|
||||
|
||||
PKTQ_PREC_ITER(pq, prec) {
|
||||
_pktq_pfilter(pq, prec, fltr, fltr_ctx, defer, defer_ctx);
|
||||
}
|
||||
|
||||
ASSERT(flush != NULL);
|
||||
(*flush)(flush_ctx);
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
pktq_init(struct pktq *pq, int num_prec, int max_len)
|
||||
{
|
||||
int prec;
|
||||
|
||||
if (HND_PKTQ_MUTEX_CREATE("pktq", &pq->mutex) != OSL_EXT_SUCCESS)
|
||||
return FALSE;
|
||||
|
||||
ASSERT(num_prec > 0 && num_prec <= PKTQ_MAX_PREC);
|
||||
|
||||
/* pq is variable size; only zero out what's requested */
|
||||
bzero(pq, OFFSETOF(struct pktq, q) + (sizeof(struct pktq_prec) * num_prec));
|
||||
|
||||
pq->num_prec = (uint16)num_prec;
|
||||
|
||||
pq->max = (uint16)max_len;
|
||||
|
||||
for (prec = 0; prec < num_prec; prec++)
|
||||
pq->q[prec].max = pq->max;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool
|
||||
pktq_deinit(struct pktq *pq)
|
||||
{
|
||||
BCM_REFERENCE(pq);
|
||||
if (HND_PKTQ_MUTEX_DELETE(&pq->mutex) != OSL_EXT_SUCCESS)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
pktq_set_max_plen(struct pktq *pq, int prec, int max_len)
|
||||
{
|
||||
ASSERT(prec >= 0 && prec < pq->num_prec);
|
||||
|
||||
/* protect shared resource */
|
||||
if (HND_PKTQ_MUTEX_ACQUIRE(&pq->mutex, OSL_EXT_TIME_FOREVER) != OSL_EXT_SUCCESS)
|
||||
return;
|
||||
|
||||
if (prec < pq->num_prec)
|
||||
pq->q[prec].max = (uint16)max_len;
|
||||
|
||||
/* protect shared resource */
|
||||
if (HND_PKTQ_MUTEX_RELEASE(&pq->mutex) != OSL_EXT_SUCCESS)
|
||||
return;
|
||||
}
|
||||
|
||||
void * BCMFASTPATH
|
||||
pktq_deq(struct pktq *pq, int *prec_out)
|
||||
{
|
||||
struct pktq_prec *q;
|
||||
void *p = NULL;
|
||||
int prec;
|
||||
|
||||
/* protect shared resource */
|
||||
if (HND_PKTQ_MUTEX_ACQUIRE(&pq->mutex, OSL_EXT_TIME_FOREVER) != OSL_EXT_SUCCESS)
|
||||
return NULL;
|
||||
|
||||
if (pq->len == 0)
|
||||
goto done;
|
||||
|
||||
while ((prec = pq->hi_prec) > 0 && pq->q[prec].head == NULL)
|
||||
pq->hi_prec--;
|
||||
|
||||
q = &pq->q[prec];
|
||||
|
||||
if ((p = q->head) == NULL)
|
||||
goto done;
|
||||
|
||||
if ((q->head = PKTLINK(p)) == NULL)
|
||||
q->tail = NULL;
|
||||
|
||||
q->len--;
|
||||
|
||||
pq->len--;
|
||||
|
||||
if (prec_out)
|
||||
*prec_out = prec;
|
||||
|
||||
PKTSETLINK(p, NULL);
|
||||
|
||||
done:
|
||||
/* protect shared resource */
|
||||
if (HND_PKTQ_MUTEX_RELEASE(&pq->mutex) != OSL_EXT_SUCCESS)
|
||||
return NULL;
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
void * BCMFASTPATH
|
||||
pktq_deq_tail(struct pktq *pq, int *prec_out)
|
||||
{
|
||||
struct pktq_prec *q;
|
||||
void *p = NULL, *prev;
|
||||
int prec;
|
||||
|
||||
/* protect shared resource */
|
||||
if (HND_PKTQ_MUTEX_ACQUIRE(&pq->mutex, OSL_EXT_TIME_FOREVER) != OSL_EXT_SUCCESS)
|
||||
return NULL;
|
||||
|
||||
if (pq->len == 0)
|
||||
goto done;
|
||||
|
||||
for (prec = 0; prec < pq->hi_prec; prec++)
|
||||
if (pq->q[prec].head)
|
||||
break;
|
||||
|
||||
q = &pq->q[prec];
|
||||
|
||||
if ((p = q->head) == NULL)
|
||||
goto done;
|
||||
|
||||
for (prev = NULL; p != q->tail; p = PKTLINK(p))
|
||||
prev = p;
|
||||
|
||||
if (prev)
|
||||
PKTSETLINK(prev, NULL);
|
||||
else
|
||||
q->head = NULL;
|
||||
|
||||
q->tail = prev;
|
||||
q->len--;
|
||||
|
||||
pq->len--;
|
||||
|
||||
if (prec_out)
|
||||
*prec_out = prec;
|
||||
|
||||
PKTSETLINK(p, NULL);
|
||||
|
||||
done:
|
||||
/* protect shared resource */
|
||||
if (HND_PKTQ_MUTEX_RELEASE(&pq->mutex) != OSL_EXT_SUCCESS)
|
||||
return NULL;
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
void *
|
||||
pktq_peek(struct pktq *pq, int *prec_out)
|
||||
{
|
||||
int prec;
|
||||
void *p = NULL;
|
||||
|
||||
/* protect shared resource */
|
||||
if (HND_PKTQ_MUTEX_ACQUIRE(&pq->mutex, OSL_EXT_TIME_FOREVER) != OSL_EXT_SUCCESS)
|
||||
return NULL;
|
||||
|
||||
if (pq->len == 0)
|
||||
goto done;
|
||||
|
||||
while ((prec = pq->hi_prec) > 0 && pq->q[prec].head == NULL)
|
||||
pq->hi_prec--;
|
||||
|
||||
if (prec_out)
|
||||
*prec_out = prec;
|
||||
|
||||
p = pq->q[prec].head;
|
||||
|
||||
done:
|
||||
/* protect shared resource */
|
||||
if (HND_PKTQ_MUTEX_RELEASE(&pq->mutex) != OSL_EXT_SUCCESS)
|
||||
return NULL;
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
void *
|
||||
pktq_peek_tail(struct pktq *pq, int *prec_out)
|
||||
{
|
||||
int prec;
|
||||
void *p = NULL;
|
||||
|
||||
/* protect shared resource */
|
||||
if (HND_PKTQ_MUTEX_ACQUIRE(&pq->mutex, OSL_EXT_TIME_FOREVER) != OSL_EXT_SUCCESS)
|
||||
return NULL;
|
||||
|
||||
if (pq->len == 0)
|
||||
goto done;
|
||||
|
||||
for (prec = 0; prec < pq->hi_prec; prec++)
|
||||
if (pq->q[prec].head)
|
||||
break;
|
||||
|
||||
if (prec_out)
|
||||
*prec_out = prec;
|
||||
|
||||
p = pq->q[prec].tail;
|
||||
|
||||
done:
|
||||
/* protect shared resource */
|
||||
if (HND_PKTQ_MUTEX_RELEASE(&pq->mutex) != OSL_EXT_SUCCESS)
|
||||
return NULL;
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
void
|
||||
pktq_pflush(osl_t *osh, struct pktq *pq, int prec, bool dir)
|
||||
{
|
||||
void *p;
|
||||
|
||||
/* no need for a mutex protection! */
|
||||
|
||||
/* start with the head of the list */
|
||||
while ((p = pktq_pdeq(pq, prec)) != NULL) {
|
||||
|
||||
/* delete this packet */
|
||||
PKTFREE(osh, p, dir);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
pktq_flush(osl_t *osh, struct pktq *pq, bool dir)
|
||||
{
|
||||
bool flush = FALSE;
|
||||
|
||||
/* protect shared resource */
|
||||
if (HND_PKTQ_MUTEX_ACQUIRE(&pq->mutex, OSL_EXT_TIME_FOREVER) != OSL_EXT_SUCCESS)
|
||||
return;
|
||||
|
||||
/* Optimize flush, if pktq len = 0, just return.
|
||||
* pktq len of 0 means pktq's prec q's are all empty.
|
||||
*/
|
||||
if (pq->len > 0) {
|
||||
flush = TRUE;
|
||||
}
|
||||
|
||||
/* protect shared resource */
|
||||
if (HND_PKTQ_MUTEX_RELEASE(&pq->mutex) != OSL_EXT_SUCCESS)
|
||||
return;
|
||||
|
||||
if (flush) {
|
||||
int prec;
|
||||
|
||||
PKTQ_PREC_ITER(pq, prec) {
|
||||
pktq_pflush(osh, pq, prec, dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Return sum of lengths of a specific set of precedences */
|
||||
int
|
||||
pktq_mlen(struct pktq *pq, uint prec_bmp)
|
||||
{
|
||||
int prec, len;
|
||||
|
||||
/* protect shared resource */
|
||||
if (HND_PKTQ_MUTEX_ACQUIRE(&pq->mutex, OSL_EXT_TIME_FOREVER) != OSL_EXT_SUCCESS)
|
||||
return 0;
|
||||
|
||||
len = 0;
|
||||
|
||||
for (prec = 0; prec <= pq->hi_prec; prec++)
|
||||
if (prec_bmp & (1 << prec))
|
||||
len += pq->q[prec].len;
|
||||
|
||||
/* protect shared resource */
|
||||
if (HND_PKTQ_MUTEX_RELEASE(&pq->mutex) != OSL_EXT_SUCCESS)
|
||||
return 0;
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
/* Priority peek from a specific set of precedences */
|
||||
void * BCMFASTPATH
|
||||
pktq_mpeek(struct pktq *pq, uint prec_bmp, int *prec_out)
|
||||
{
|
||||
struct pktq_prec *q;
|
||||
void *p = NULL;
|
||||
int prec;
|
||||
|
||||
/* protect shared resource */
|
||||
if (HND_PKTQ_MUTEX_ACQUIRE(&pq->mutex, OSL_EXT_TIME_FOREVER) != OSL_EXT_SUCCESS)
|
||||
return NULL;
|
||||
|
||||
if (pq->len == 0)
|
||||
goto done;
|
||||
|
||||
while ((prec = pq->hi_prec) > 0 && pq->q[prec].head == NULL)
|
||||
pq->hi_prec--;
|
||||
|
||||
while ((prec_bmp & (1 << prec)) == 0 || pq->q[prec].head == NULL)
|
||||
if (prec-- == 0)
|
||||
goto done;
|
||||
|
||||
q = &pq->q[prec];
|
||||
|
||||
if ((p = q->head) == NULL)
|
||||
goto done;
|
||||
|
||||
if (prec_out)
|
||||
*prec_out = prec;
|
||||
|
||||
done:
|
||||
/* protect shared resource */
|
||||
if (HND_PKTQ_MUTEX_RELEASE(&pq->mutex) != OSL_EXT_SUCCESS)
|
||||
return NULL;
|
||||
|
||||
return p;
|
||||
}
|
||||
/* Priority dequeue from a specific set of precedences */
|
||||
void * BCMFASTPATH
|
||||
pktq_mdeq(struct pktq *pq, uint prec_bmp, int *prec_out)
|
||||
{
|
||||
struct pktq_prec *q;
|
||||
void *p = NULL;
|
||||
int prec;
|
||||
|
||||
/* protect shared resource */
|
||||
if (HND_PKTQ_MUTEX_ACQUIRE(&pq->mutex, OSL_EXT_TIME_FOREVER) != OSL_EXT_SUCCESS)
|
||||
return NULL;
|
||||
|
||||
if (pq->len == 0)
|
||||
goto done;
|
||||
|
||||
while ((prec = pq->hi_prec) > 0 && pq->q[prec].head == NULL)
|
||||
pq->hi_prec--;
|
||||
|
||||
while ((pq->q[prec].head == NULL) || ((prec_bmp & (1 << prec)) == 0))
|
||||
if (prec-- == 0)
|
||||
goto done;
|
||||
|
||||
q = &pq->q[prec];
|
||||
|
||||
if ((p = q->head) == NULL)
|
||||
goto done;
|
||||
|
||||
if ((q->head = PKTLINK(p)) == NULL)
|
||||
q->tail = NULL;
|
||||
|
||||
q->len--;
|
||||
|
||||
// terence 20150308: fix for non-null pointer of skb->prev sent from ndo_start_xmit
|
||||
if (q->len == 0) {
|
||||
q->head = NULL;
|
||||
q->tail = NULL;
|
||||
}
|
||||
|
||||
if (prec_out)
|
||||
*prec_out = prec;
|
||||
|
||||
pq->len--;
|
||||
|
||||
PKTSETLINK(p, NULL);
|
||||
|
||||
done:
|
||||
/* protect shared resource */
|
||||
if (HND_PKTQ_MUTEX_RELEASE(&pq->mutex) != OSL_EXT_SUCCESS)
|
||||
return NULL;
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
#ifdef HND_PKTQ_THREAD_SAFE
|
||||
int
|
||||
pktq_pavail(struct pktq *pq, int prec)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* protect shared resource */
|
||||
if (HND_PKTQ_MUTEX_ACQUIRE(&pq->mutex, OSL_EXT_TIME_FOREVER) != OSL_EXT_SUCCESS)
|
||||
return 0;
|
||||
|
||||
ASSERT(prec >= 0 && prec < pq->num_prec);
|
||||
|
||||
ret = pq->q[prec].max - pq->q[prec].len;
|
||||
|
||||
/* protect shared resource */
|
||||
if (HND_PKTQ_MUTEX_RELEASE(&pq->mutex) != OSL_EXT_SUCCESS)
|
||||
return 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool
|
||||
pktq_pfull(struct pktq *pq, int prec)
|
||||
{
|
||||
bool ret;
|
||||
|
||||
/* protect shared resource */
|
||||
if (HND_PKTQ_MUTEX_ACQUIRE(&pq->mutex, OSL_EXT_TIME_FOREVER) != OSL_EXT_SUCCESS)
|
||||
return FALSE;
|
||||
|
||||
ASSERT(prec >= 0 && prec < pq->num_prec);
|
||||
|
||||
ret = pq->q[prec].len >= pq->q[prec].max;
|
||||
|
||||
/* protect shared resource */
|
||||
if (HND_PKTQ_MUTEX_RELEASE(&pq->mutex) != OSL_EXT_SUCCESS)
|
||||
return FALSE;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
pktq_avail(struct pktq *pq)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* protect shared resource */
|
||||
if (HND_PKTQ_MUTEX_ACQUIRE(&pq->mutex, OSL_EXT_TIME_FOREVER) != OSL_EXT_SUCCESS)
|
||||
return 0;
|
||||
|
||||
ret = pq->max - pq->len;
|
||||
|
||||
/* protect shared resource */
|
||||
if (HND_PKTQ_MUTEX_RELEASE(&pq->mutex) != OSL_EXT_SUCCESS)
|
||||
return 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool
|
||||
pktq_full(struct pktq *pq)
|
||||
{
|
||||
bool ret;
|
||||
|
||||
/* protect shared resource */
|
||||
if (HND_PKTQ_MUTEX_ACQUIRE(&pq->mutex, OSL_EXT_TIME_FOREVER) != OSL_EXT_SUCCESS)
|
||||
return FALSE;
|
||||
|
||||
ret = pq->len >= pq->max;
|
||||
|
||||
/* protect shared resource */
|
||||
if (HND_PKTQ_MUTEX_RELEASE(&pq->mutex) != OSL_EXT_SUCCESS)
|
||||
return FALSE;
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif /* HND_PKTQ_THREAD_SAFE */
|
|
@ -0,0 +1,382 @@
|
|||
/*
|
||||
* Misc utility routines for accessing PMU corerev specific features
|
||||
* of the SiliconBackplane-based Broadcom chips.
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: hndpmu.c 657872 2016-09-02 22:17:34Z $
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Note: this file contains PLL/FLL related functions. A chip can contain multiple PLLs/FLLs.
|
||||
* However, in the context of this file the baseband ('BB') PLL/FLL is referred to.
|
||||
*
|
||||
* Throughout this code, the prefixes 'pmu0_', 'pmu1_' and 'pmu2_' are used.
|
||||
* They refer to different revisions of the PMU (which is at revision 18 @ Apr 25, 2012)
|
||||
* pmu1_ marks the transition from PLL to ADFLL (Digital Frequency Locked Loop). It supports
|
||||
* fractional frequency generation. pmu2_ does not support fractional frequency generation.
|
||||
*/
|
||||
|
||||
#include <bcm_cfg.h>
|
||||
#include <typedefs.h>
|
||||
#include <bcmdefs.h>
|
||||
#include <osl.h>
|
||||
#include <bcmutils.h>
|
||||
#include <siutils.h>
|
||||
#include <bcmdevs.h>
|
||||
#include <hndsoc.h>
|
||||
#include <sbchipc.h>
|
||||
#include <hndpmu.h>
|
||||
#if defined(BCMULP)
|
||||
#include <ulp.h>
|
||||
#endif /* defined(BCMULP) */
|
||||
#include <sbgci.h>
|
||||
#ifdef EVENT_LOG_COMPILE
|
||||
#include <event_log.h>
|
||||
#endif
|
||||
#include <sbgci.h>
|
||||
|
||||
#define PMU_ERROR(args)
|
||||
|
||||
#define PMU_MSG(args)
|
||||
|
||||
/* To check in verbose debugging messages not intended
|
||||
* to be on except on private builds.
|
||||
*/
|
||||
#define PMU_NONE(args)
|
||||
|
||||
/** contains resource bit positions for a specific chip */
|
||||
struct rsc_per_chip_s {
|
||||
uint8 ht_avail;
|
||||
uint8 macphy_clkavail;
|
||||
uint8 ht_start;
|
||||
uint8 otp_pu;
|
||||
};
|
||||
|
||||
typedef struct rsc_per_chip_s rsc_per_chip_t;
|
||||
|
||||
|
||||
/* SDIO Pad drive strength to select value mappings.
|
||||
* The last strength value in each table must be 0 (the tri-state value).
|
||||
*/
|
||||
typedef struct {
|
||||
uint8 strength; /* Pad Drive Strength in mA */
|
||||
uint8 sel; /* Chip-specific select value */
|
||||
} sdiod_drive_str_t;
|
||||
|
||||
/* SDIO Drive Strength to sel value table for PMU Rev 1 */
|
||||
static const sdiod_drive_str_t sdiod_drive_strength_tab1[] = {
|
||||
{4, 0x2},
|
||||
{2, 0x3},
|
||||
{1, 0x0},
|
||||
{0, 0x0} };
|
||||
|
||||
/* SDIO Drive Strength to sel value table for PMU Rev 2, 3 */
|
||||
static const sdiod_drive_str_t sdiod_drive_strength_tab2[] = {
|
||||
{12, 0x7},
|
||||
{10, 0x6},
|
||||
{8, 0x5},
|
||||
{6, 0x4},
|
||||
{4, 0x2},
|
||||
{2, 0x1},
|
||||
{0, 0x0} };
|
||||
|
||||
|
||||
/* SDIO Drive Strength to sel value table for PMU Rev 8 (1.8V) */
|
||||
static const sdiod_drive_str_t sdiod_drive_strength_tab3[] = {
|
||||
{32, 0x7},
|
||||
{26, 0x6},
|
||||
{22, 0x5},
|
||||
{16, 0x4},
|
||||
{12, 0x3},
|
||||
{8, 0x2},
|
||||
{4, 0x1},
|
||||
{0, 0x0} };
|
||||
|
||||
/* SDIO Drive Strength to sel value table for PMU Rev 11 (1.8v) */
|
||||
static const sdiod_drive_str_t sdiod_drive_strength_tab4_1v8[] = {
|
||||
{32, 0x6},
|
||||
{26, 0x7},
|
||||
{22, 0x4},
|
||||
{16, 0x5},
|
||||
{12, 0x2},
|
||||
{8, 0x3},
|
||||
{4, 0x0},
|
||||
{0, 0x1} };
|
||||
|
||||
/* SDIO Drive Strength to sel value table for PMU Rev 11 (1.2v) */
|
||||
|
||||
/* SDIO Drive Strength to sel value table for PMU Rev 11 (2.5v) */
|
||||
|
||||
/* SDIO Drive Strength to sel value table for PMU Rev 13 (1.8v) */
|
||||
static const sdiod_drive_str_t sdiod_drive_strength_tab5_1v8[] = {
|
||||
{6, 0x7},
|
||||
{5, 0x6},
|
||||
{4, 0x5},
|
||||
{3, 0x4},
|
||||
{2, 0x2},
|
||||
{1, 0x1},
|
||||
{0, 0x0} };
|
||||
|
||||
/* SDIO Drive Strength to sel value table for PMU Rev 13 (3.3v) */
|
||||
|
||||
/** SDIO Drive Strength to sel value table for PMU Rev 17 (1.8v) */
|
||||
static const sdiod_drive_str_t sdiod_drive_strength_tab6_1v8[] = {
|
||||
{3, 0x3},
|
||||
{2, 0x2},
|
||||
{1, 0x1},
|
||||
{0, 0x0} };
|
||||
|
||||
|
||||
/**
|
||||
* SDIO Drive Strength to sel value table for 43143 PMU Rev 17, see Confluence 43143 Toplevel
|
||||
* architecture page, section 'PMU Chip Control 1 Register definition', click link to picture
|
||||
* BCM43143_sel_sdio_signals.jpg. Valid after PMU Chip Control 0 Register, bit31 (override) has
|
||||
* been written '1'.
|
||||
*/
|
||||
#if !defined(BCM_SDIO_VDDIO) || BCM_SDIO_VDDIO == 33
|
||||
|
||||
static const sdiod_drive_str_t sdiod_drive_strength_tab7_3v3[] = {
|
||||
/* note: for 14, 10, 6 and 2mA hw timing is not met according to rtl team */
|
||||
{16, 0x7},
|
||||
{12, 0x5},
|
||||
{8, 0x3},
|
||||
{4, 0x1} }; /* note: 43143 does not support tristate */
|
||||
|
||||
#else
|
||||
|
||||
static const sdiod_drive_str_t sdiod_drive_strength_tab7_1v8[] = {
|
||||
/* note: for 7, 5, 3 and 1mA hw timing is not met according to rtl team */
|
||||
{8, 0x7},
|
||||
{6, 0x5},
|
||||
{4, 0x3},
|
||||
{2, 0x1} }; /* note: 43143 does not support tristate */
|
||||
|
||||
#endif /* BCM_SDIO_VDDIO */
|
||||
|
||||
#define SDIOD_DRVSTR_KEY(chip, pmu) (((chip) << 16) | (pmu))
|
||||
|
||||
/**
|
||||
* Balance between stable SDIO operation and power consumption is achieved using this function.
|
||||
* Note that each drive strength table is for a specific VDDIO of the SDIO pads, ideally this
|
||||
* function should read the VDDIO itself to select the correct table. For now it has been solved
|
||||
* with the 'BCM_SDIO_VDDIO' preprocessor constant.
|
||||
*
|
||||
* 'drivestrength': desired pad drive strength in mA. Drive strength of 0 requests tri-state (if
|
||||
* hardware supports this), if no hw support drive strength is not programmed.
|
||||
*/
|
||||
void
|
||||
si_sdiod_drive_strength_init(si_t *sih, osl_t *osh, uint32 drivestrength)
|
||||
{
|
||||
sdiod_drive_str_t *str_tab = NULL;
|
||||
uint32 str_mask = 0; /* only alter desired bits in PMU chipcontrol 1 register */
|
||||
uint32 str_shift = 0;
|
||||
uint32 str_ovr_pmuctl = PMU_CHIPCTL0; /* PMU chipcontrol register containing override bit */
|
||||
uint32 str_ovr_pmuval = 0; /* position of bit within this register */
|
||||
pmuregs_t *pmu;
|
||||
uint origidx;
|
||||
|
||||
if (!(sih->cccaps & CC_CAP_PMU)) {
|
||||
return;
|
||||
}
|
||||
BCM_REFERENCE(sdiod_drive_strength_tab1);
|
||||
BCM_REFERENCE(sdiod_drive_strength_tab2);
|
||||
/* Remember original core before switch to chipc/pmu */
|
||||
origidx = si_coreidx(sih);
|
||||
if (AOB_ENAB(sih)) {
|
||||
pmu = si_setcore(sih, PMU_CORE_ID, 0);
|
||||
} else {
|
||||
pmu = si_setcoreidx(sih, SI_CC_IDX);
|
||||
}
|
||||
ASSERT(pmu != NULL);
|
||||
|
||||
switch (SDIOD_DRVSTR_KEY(CHIPID(sih->chip), PMUREV(sih->pmurev))) {
|
||||
case SDIOD_DRVSTR_KEY(BCM4336_CHIP_ID, 8):
|
||||
case SDIOD_DRVSTR_KEY(BCM4336_CHIP_ID, 11):
|
||||
if (PMUREV(sih->pmurev) == 8) {
|
||||
str_tab = (sdiod_drive_str_t *)&sdiod_drive_strength_tab3;
|
||||
} else if (PMUREV(sih->pmurev) == 11) {
|
||||
str_tab = (sdiod_drive_str_t *)&sdiod_drive_strength_tab4_1v8;
|
||||
}
|
||||
str_mask = 0x00003800;
|
||||
str_shift = 11;
|
||||
break;
|
||||
case SDIOD_DRVSTR_KEY(BCM4330_CHIP_ID, 12):
|
||||
str_tab = (sdiod_drive_str_t *)&sdiod_drive_strength_tab4_1v8;
|
||||
str_mask = 0x00003800;
|
||||
str_shift = 11;
|
||||
break;
|
||||
case SDIOD_DRVSTR_KEY(BCM43362_CHIP_ID, 13):
|
||||
str_tab = (sdiod_drive_str_t *)&sdiod_drive_strength_tab5_1v8;
|
||||
str_mask = 0x00003800;
|
||||
str_shift = 11;
|
||||
break;
|
||||
case SDIOD_DRVSTR_KEY(BCM4334_CHIP_ID, 17):
|
||||
str_tab = (sdiod_drive_str_t *)&sdiod_drive_strength_tab6_1v8;
|
||||
str_mask = 0x00001800;
|
||||
str_shift = 11;
|
||||
break;
|
||||
case SDIOD_DRVSTR_KEY(BCM43143_CHIP_ID, 17):
|
||||
#if !defined(BCM_SDIO_VDDIO) || BCM_SDIO_VDDIO == 33
|
||||
if (drivestrength >= ARRAYLAST(sdiod_drive_strength_tab7_3v3)->strength) {
|
||||
str_tab = (sdiod_drive_str_t *)&sdiod_drive_strength_tab7_3v3;
|
||||
}
|
||||
#else
|
||||
if (drivestrength >= ARRAYLAST(sdiod_drive_strength_tab7_1v8)->strength) {
|
||||
str_tab = (sdiod_drive_str_t *)&sdiod_drive_strength_tab7_1v8;
|
||||
}
|
||||
#endif /* BCM_SDIO_VDDIO */
|
||||
str_mask = 0x00000007;
|
||||
str_ovr_pmuval = PMU43143_CC0_SDIO_DRSTR_OVR;
|
||||
break;
|
||||
default:
|
||||
PMU_MSG(("No SDIO Drive strength init done for chip %s rev %d pmurev %d\n",
|
||||
bcm_chipname(
|
||||
CHIPID(sih->chip), chn, 8), CHIPREV(sih->chiprev), PMUREV(sih->pmurev)));
|
||||
break;
|
||||
}
|
||||
|
||||
if (str_tab != NULL) {
|
||||
uint32 cc_data_temp;
|
||||
int i;
|
||||
|
||||
/* Pick the lowest available drive strength equal or greater than the
|
||||
* requested strength. Drive strength of 0 requests tri-state.
|
||||
*/
|
||||
for (i = 0; drivestrength < str_tab[i].strength; i++)
|
||||
;
|
||||
|
||||
if (i > 0 && drivestrength > str_tab[i].strength)
|
||||
i--;
|
||||
|
||||
W_REG(osh, &pmu->chipcontrol_addr, PMU_CHIPCTL1);
|
||||
cc_data_temp = R_REG(osh, &pmu->chipcontrol_data);
|
||||
cc_data_temp &= ~str_mask;
|
||||
cc_data_temp |= str_tab[i].sel << str_shift;
|
||||
W_REG(osh, &pmu->chipcontrol_data, cc_data_temp);
|
||||
if (str_ovr_pmuval) { /* enables the selected drive strength */
|
||||
W_REG(osh, &pmu->chipcontrol_addr, str_ovr_pmuctl);
|
||||
OR_REG(osh, &pmu->chipcontrol_data, str_ovr_pmuval);
|
||||
}
|
||||
PMU_MSG(("SDIO: %dmA drive strength requested; set to %dmA\n",
|
||||
drivestrength, str_tab[i].strength));
|
||||
}
|
||||
|
||||
/* Return to original core */
|
||||
si_setcoreidx(sih, origidx);
|
||||
} /* si_sdiod_drive_strength_init */
|
||||
|
||||
|
||||
#if defined(BCMULP)
|
||||
int
|
||||
si_pmu_ulp_register(si_t *sih)
|
||||
{
|
||||
return ulp_p1_module_register(ULP_MODULE_ID_PMU, &ulp_pmu_ctx, (void *)sih);
|
||||
}
|
||||
|
||||
static uint
|
||||
si_pmu_ulp_get_retention_size_cb(void *handle, ulp_ext_info_t *einfo)
|
||||
{
|
||||
ULP_DBG(("%s: sz: %d\n", __FUNCTION__, sizeof(si_pmu_ulp_cr_dat_t)));
|
||||
return sizeof(si_pmu_ulp_cr_dat_t);
|
||||
}
|
||||
|
||||
static int
|
||||
si_pmu_ulp_enter_cb(void *handle, ulp_ext_info_t *einfo, uint8 *cache_data)
|
||||
{
|
||||
si_pmu_ulp_cr_dat_t crinfo = {0};
|
||||
crinfo.ilpcycles_per_sec = ilpcycles_per_sec;
|
||||
ULP_DBG(("%s: ilpcycles_per_sec: %x\n", __FUNCTION__, ilpcycles_per_sec));
|
||||
memcpy(cache_data, (void*)&crinfo, sizeof(crinfo));
|
||||
return BCME_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
si_pmu_ulp_exit_cb(void *handle, uint8 *cache_data,
|
||||
uint8 *p2_cache_data)
|
||||
{
|
||||
si_pmu_ulp_cr_dat_t *crinfo = (si_pmu_ulp_cr_dat_t *)cache_data;
|
||||
|
||||
ilpcycles_per_sec = crinfo->ilpcycles_per_sec;
|
||||
ULP_DBG(("%s: ilpcycles_per_sec: %x, cache_data: %p\n", __FUNCTION__,
|
||||
ilpcycles_per_sec, cache_data));
|
||||
return BCME_OK;
|
||||
}
|
||||
|
||||
void
|
||||
si_pmu_ulp_ilp_config(si_t *sih, osl_t *osh, uint32 ilp_period)
|
||||
{
|
||||
pmuregs_t *pmu;
|
||||
pmu = si_setcoreidx(sih, si_findcoreidx(sih, PMU_CORE_ID, 0));
|
||||
W_REG(osh, &pmu->ILPPeriod, ilp_period);
|
||||
}
|
||||
#endif /* defined(BCMULP) */
|
||||
|
||||
|
||||
|
||||
void si_pmu_set_min_res_mask(si_t *sih, osl_t *osh, uint min_res_mask)
|
||||
{
|
||||
pmuregs_t *pmu;
|
||||
uint origidx;
|
||||
|
||||
/* Remember original core before switch to chipc/pmu */
|
||||
origidx = si_coreidx(sih);
|
||||
if (AOB_ENAB(sih)) {
|
||||
pmu = si_setcore(sih, PMU_CORE_ID, 0);
|
||||
}
|
||||
else {
|
||||
pmu = si_setcoreidx(sih, SI_CC_IDX);
|
||||
}
|
||||
ASSERT(pmu != NULL);
|
||||
|
||||
W_REG(osh, &pmu->min_res_mask, min_res_mask);
|
||||
OSL_DELAY(100);
|
||||
|
||||
/* Return to original core */
|
||||
si_setcoreidx(sih, origidx);
|
||||
}
|
||||
|
||||
bool
|
||||
si_pmu_cap_fast_lpo(si_t *sih)
|
||||
{
|
||||
return (PMU_REG(sih, core_cap_ext, 0, 0) & PCAP_EXT_USE_MUXED_ILP_CLK_MASK) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
int
|
||||
si_pmu_fast_lpo_disable(si_t *sih)
|
||||
{
|
||||
if (!si_pmu_cap_fast_lpo(sih)) {
|
||||
PMU_ERROR(("%s: No Fast LPO capability\n", __FUNCTION__));
|
||||
return BCME_ERROR;
|
||||
}
|
||||
|
||||
PMU_REG(sih, pmucontrol_ext,
|
||||
PCTL_EXT_FASTLPO_ENAB |
|
||||
PCTL_EXT_FASTLPO_SWENAB |
|
||||
PCTL_EXT_FASTLPO_PCIE_SWENAB,
|
||||
0);
|
||||
OSL_DELAY(1000);
|
||||
return BCME_OK;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,134 @@
|
|||
/*
|
||||
* 802.11e protocol header file
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: 802.11e.h 700076 2017-05-17 14:42:22Z $
|
||||
*/
|
||||
|
||||
#ifndef _802_11e_H_
|
||||
#define _802_11e_H_
|
||||
|
||||
#ifndef _TYPEDEFS_H_
|
||||
#include <typedefs.h>
|
||||
#endif
|
||||
|
||||
/* This marks the start of a packed structure section. */
|
||||
#include <packed_section_start.h>
|
||||
|
||||
/* WME Traffic Specification (TSPEC) element */
|
||||
#define WME_TSPEC_HDR_LEN 2 /* WME TSPEC header length */
|
||||
#define WME_TSPEC_BODY_OFF 2 /* WME TSPEC body offset */
|
||||
|
||||
#define WME_CATEGORY_CODE_OFFSET 0 /* WME Category code offset */
|
||||
#define WME_ACTION_CODE_OFFSET 1 /* WME Action code offset */
|
||||
#define WME_TOKEN_CODE_OFFSET 2 /* WME Token code offset */
|
||||
#define WME_STATUS_CODE_OFFSET 3 /* WME Status code offset */
|
||||
|
||||
BWL_PRE_PACKED_STRUCT struct tsinfo {
|
||||
uint8 octets[3];
|
||||
} BWL_POST_PACKED_STRUCT;
|
||||
|
||||
typedef struct tsinfo tsinfo_t;
|
||||
|
||||
/* 802.11e TSPEC IE */
|
||||
typedef BWL_PRE_PACKED_STRUCT struct tspec {
|
||||
uint8 oui[DOT11_OUI_LEN]; /* WME_OUI */
|
||||
uint8 type; /* WME_TYPE */
|
||||
uint8 subtype; /* WME_SUBTYPE_TSPEC */
|
||||
uint8 version; /* WME_VERSION */
|
||||
tsinfo_t tsinfo; /* TS Info bit field */
|
||||
uint16 nom_msdu_size; /* (Nominal or fixed) MSDU Size (bytes) */
|
||||
uint16 max_msdu_size; /* Maximum MSDU Size (bytes) */
|
||||
uint32 min_srv_interval; /* Minimum Service Interval (us) */
|
||||
uint32 max_srv_interval; /* Maximum Service Interval (us) */
|
||||
uint32 inactivity_interval; /* Inactivity Interval (us) */
|
||||
uint32 suspension_interval; /* Suspension Interval (us) */
|
||||
uint32 srv_start_time; /* Service Start Time (us) */
|
||||
uint32 min_data_rate; /* Minimum Data Rate (bps) */
|
||||
uint32 mean_data_rate; /* Mean Data Rate (bps) */
|
||||
uint32 peak_data_rate; /* Peak Data Rate (bps) */
|
||||
uint32 max_burst_size; /* Maximum Burst Size (bytes) */
|
||||
uint32 delay_bound; /* Delay Bound (us) */
|
||||
uint32 min_phy_rate; /* Minimum PHY Rate (bps) */
|
||||
uint16 surplus_bw; /* Surplus Bandwidth Allowance (range 1.0-8.0) */
|
||||
uint16 medium_time; /* Medium Time (32 us/s periods) */
|
||||
} BWL_POST_PACKED_STRUCT tspec_t;
|
||||
|
||||
#define WME_TSPEC_LEN (sizeof(tspec_t)) /* not including 2-bytes of header */
|
||||
|
||||
/* ts_info */
|
||||
/* 802.1D priority is duplicated - bits 13-11 AND bits 3-1 */
|
||||
#define TS_INFO_TID_SHIFT 1 /* TS info. TID shift */
|
||||
#define TS_INFO_TID_MASK (0xf << TS_INFO_TID_SHIFT) /* TS info. TID mask */
|
||||
#define TS_INFO_CONTENTION_SHIFT 7 /* TS info. contention shift */
|
||||
#define TS_INFO_CONTENTION_MASK (0x1 << TS_INFO_CONTENTION_SHIFT) /* TS info. contention mask */
|
||||
#define TS_INFO_DIRECTION_SHIFT 5 /* TS info. direction shift */
|
||||
#define TS_INFO_DIRECTION_MASK (0x3 << TS_INFO_DIRECTION_SHIFT) /* TS info. direction mask */
|
||||
#define TS_INFO_PSB_SHIFT 2 /* TS info. PSB bit Shift */
|
||||
#define TS_INFO_PSB_MASK (1 << TS_INFO_PSB_SHIFT) /* TS info. PSB mask */
|
||||
#define TS_INFO_UPLINK (0 << TS_INFO_DIRECTION_SHIFT) /* TS info. uplink */
|
||||
#define TS_INFO_DOWNLINK (1 << TS_INFO_DIRECTION_SHIFT) /* TS info. downlink */
|
||||
#define TS_INFO_BIDIRECTIONAL (3 << TS_INFO_DIRECTION_SHIFT) /* TS info. bidirectional */
|
||||
#define TS_INFO_USER_PRIO_SHIFT 3 /* TS info. user priority shift */
|
||||
/* TS info. user priority mask */
|
||||
#define TS_INFO_USER_PRIO_MASK (0x7 << TS_INFO_USER_PRIO_SHIFT)
|
||||
|
||||
/* Macro to get/set bit(s) field in TSINFO */
|
||||
#define WLC_CAC_GET_TID(pt) ((((pt).octets[0]) & TS_INFO_TID_MASK) >> TS_INFO_TID_SHIFT)
|
||||
#define WLC_CAC_GET_DIR(pt) ((((pt).octets[0]) & \
|
||||
TS_INFO_DIRECTION_MASK) >> TS_INFO_DIRECTION_SHIFT)
|
||||
#define WLC_CAC_GET_PSB(pt) ((((pt).octets[1]) & TS_INFO_PSB_MASK) >> TS_INFO_PSB_SHIFT)
|
||||
#define WLC_CAC_GET_USER_PRIO(pt) ((((pt).octets[1]) & \
|
||||
TS_INFO_USER_PRIO_MASK) >> TS_INFO_USER_PRIO_SHIFT)
|
||||
|
||||
#define WLC_CAC_SET_TID(pt, id) ((((pt).octets[0]) & (~TS_INFO_TID_MASK)) | \
|
||||
((id) << TS_INFO_TID_SHIFT))
|
||||
#define WLC_CAC_SET_USER_PRIO(pt, prio) ((((pt).octets[0]) & (~TS_INFO_USER_PRIO_MASK)) | \
|
||||
((prio) << TS_INFO_USER_PRIO_SHIFT))
|
||||
|
||||
/* 802.11e QBSS Load IE */
|
||||
#define QBSS_LOAD_IE_LEN 5 /* QBSS Load IE length */
|
||||
#define QBSS_LOAD_AAC_OFF 3 /* AAC offset in IE */
|
||||
|
||||
#define CAC_ADDTS_RESP_TIMEOUT 1000 /* default ADDTS response timeout in ms */
|
||||
/* DEFVAL dot11ADDTSResponseTimeout = 1s */
|
||||
|
||||
/* 802.11e ADDTS status code */
|
||||
#define DOT11E_STATUS_ADMISSION_ACCEPTED 0 /* TSPEC Admission accepted status */
|
||||
#define DOT11E_STATUS_ADDTS_INVALID_PARAM 1 /* TSPEC invalid parameter status */
|
||||
#define DOT11E_STATUS_ADDTS_REFUSED_NSBW 3 /* ADDTS refused (non-sufficient BW) */
|
||||
#define DOT11E_STATUS_ADDTS_REFUSED_AWHILE 47 /* ADDTS refused but could retry later */
|
||||
|
||||
/* 802.11e DELTS status code */
|
||||
#define DOT11E_STATUS_QSTA_LEAVE_QBSS 36 /* STA leave QBSS */
|
||||
#define DOT11E_STATUS_END_TS 37 /* END TS */
|
||||
#define DOT11E_STATUS_UNKNOWN_TS 38 /* UNKNOWN TS */
|
||||
#define DOT11E_STATUS_QSTA_REQ_TIMEOUT 39 /* STA ADDTS request timeout */
|
||||
|
||||
|
||||
/* This marks the end of a packed structure section. */
|
||||
#include <packed_section_end.h>
|
||||
|
||||
#endif /* _802_11e_CAC_H_ */
|
|
@ -0,0 +1,336 @@
|
|||
/*
|
||||
* Fundamental types and constants relating to 802.11s Mesh
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: 802.11s.h 700076 2017-05-17 14:42:22Z $
|
||||
*/
|
||||
|
||||
#ifndef _802_11s_h_
|
||||
#define _802_11s_h_
|
||||
|
||||
/* This marks the start of a packed structure section. */
|
||||
#include <packed_section_start.h>
|
||||
|
||||
#define DOT11_MESH_FLAGS_AE_MASK 0x3
|
||||
#define DOT11_MESH_FLAGS_AE_SHIFT 0
|
||||
|
||||
#define DOT11_MESH_CONNECTED_AS_SET 7
|
||||
#define DOT11_MESH_NUMBER_PEERING_SET 1
|
||||
#define DOT11_MESH_MESH_GWSET 0
|
||||
|
||||
#define DOT11_MESH_ACTION_LINK_MET_REP 0
|
||||
#define DOT11_MESH_ACTION_PATH_SEL 1
|
||||
#define DOT11_MESH_ACTION_GATE_ANN 2
|
||||
#define DOT11_MESH_ACTION_CONG_CONT_NOTIF 3
|
||||
#define DOT11_MESH_ACTION_MCCA_SETUP_REQ 4
|
||||
#define DOT11_MESH_ACTION_MCCA_SETUP_REP 5
|
||||
#define DOT11_MESH_ACTION_MCCA_ADVT_REQ 6
|
||||
#define DOT11_MESH_ACTION_MCCA_ADVT 7
|
||||
#define DOT11_MESH_ACTION_MCCA_TEARDOWN 8
|
||||
#define DOT11_MESH_ACTION_TBTT_ADJ_REQ 9
|
||||
#define DOT11_MESH_ACTION_TBTT_ADJ_RESP 10
|
||||
|
||||
/* self-protected action field values: 7-57v24 */
|
||||
#define DOT11_SELFPROT_ACTION_MESH_PEER_OPEN 1
|
||||
#define DOT11_SELFPROT_ACTION_MESH_PEER_CONFM 2
|
||||
#define DOT11_SELFPROT_ACTION_MESH_PEER_CLOSE 3
|
||||
#define DOT11_SELFPROT_ACTION_MESH_PEER_GK_INF 4
|
||||
#define DOT11_SELFPROT_ACTION_MESH_PEER_GK_ACK 5
|
||||
|
||||
#define DOT11_MESH_AUTH_PROTO_NONE 0
|
||||
#define DOT11_MESH_AUTH_PROTO_SAE 1
|
||||
#define DOT11_MESH_AUTH_PROTO_8021X 2
|
||||
#define DOT11_MESH_AUTH_PROTO_VS 255
|
||||
|
||||
#define DOT11_MESH_PATHSEL_LEN 2
|
||||
#define DOT11_MESH_PERR_LEN1 2 /* Least PERR length fixed */
|
||||
#define DOT11_MESH_PERR_LEN2 13 /* Least PERR length variable */
|
||||
#define DOT11_MESH_PREP_LEN 31 /* Least PREP length */
|
||||
#define DOT11_MESH_PREQ_LEN 37 /* Least PREQ length */
|
||||
|
||||
#define DOT11_MESH_PATHSEL_PROTID_HWMP 1
|
||||
#define DOT11_MESH_PATHSEL_METRICID_ALM 1 /* Air link metric */
|
||||
#define DOT11_MESH_CONGESTCTRL_NONE 0
|
||||
#define DOT11_MESH_CONGESTCTRL_SP 1
|
||||
#define DOT11_MESH_SYNCMETHOD_NOFFSET 1
|
||||
|
||||
BWL_PRE_PACKED_STRUCT struct dot11_meshctrl_hdr {
|
||||
uint8 flags; /* flag bits such as ae etc */
|
||||
uint8 ttl; /* time to live */
|
||||
uint32 seq; /* sequence control */
|
||||
struct ether_addr a5; /* optional address 5 */
|
||||
struct ether_addr a6; /* optional address 6 */
|
||||
} BWL_POST_PACKED_STRUCT;
|
||||
|
||||
/* Mesh Path Selection Action Frame */
|
||||
BWL_PRE_PACKED_STRUCT struct dot11_mesh_pathsel {
|
||||
uint8 category;
|
||||
uint8 meshaction;
|
||||
uint8 data[];
|
||||
} BWL_POST_PACKED_STRUCT;
|
||||
typedef struct dot11_mesh_pathsel dot11_mesh_pathsel_t;
|
||||
|
||||
/* Mesh PREQ IE */
|
||||
BWL_PRE_PACKED_STRUCT struct mesh_preq_ie {
|
||||
uint8 id;
|
||||
uint8 len;
|
||||
uint8 flags;
|
||||
uint8 hop_count;
|
||||
uint8 ttl;
|
||||
uint32 pathdis_id;
|
||||
struct ether_addr originator_addr;
|
||||
uint32 originator_seq;
|
||||
union {
|
||||
BWL_PRE_PACKED_STRUCT struct {
|
||||
struct ether_addr target_ext_add;
|
||||
uint32 lifetime;
|
||||
uint32 metric;
|
||||
uint8 target_count;
|
||||
uint8 data[];
|
||||
} BWL_POST_PACKED_STRUCT oea;
|
||||
|
||||
BWL_PRE_PACKED_STRUCT struct {
|
||||
uint32 lifetime;
|
||||
uint32 metric;
|
||||
uint8 target_count;
|
||||
uint8 data[];
|
||||
} BWL_POST_PACKED_STRUCT noea;
|
||||
} u;
|
||||
} BWL_POST_PACKED_STRUCT;
|
||||
typedef struct mesh_preq_ie mesh_preq_ie_t;
|
||||
|
||||
/* Target info (part of Mesh PREQ IE) */
|
||||
BWL_PRE_PACKED_STRUCT struct mesh_targetinfo {
|
||||
uint8 target_flag;
|
||||
struct ether_addr target_addr;
|
||||
uint32 target_seq;
|
||||
} BWL_POST_PACKED_STRUCT;
|
||||
typedef struct mesh_targetinfo mesh_targetinfo_t;
|
||||
|
||||
|
||||
/* Mesh PREP IE */
|
||||
BWL_PRE_PACKED_STRUCT struct mesh_prep_ie {
|
||||
uint8 id;
|
||||
uint8 len;
|
||||
uint8 flags;
|
||||
uint8 hop_count;
|
||||
uint8 ttl;
|
||||
struct ether_addr target_addr;
|
||||
uint32 target_seq;
|
||||
union {
|
||||
BWL_PRE_PACKED_STRUCT struct {
|
||||
struct ether_addr target_ext_add;
|
||||
uint32 lifetime;
|
||||
uint32 metric;
|
||||
uint8 target_count;
|
||||
struct ether_addr originator_addr;
|
||||
uint32 originator_seq;
|
||||
} BWL_POST_PACKED_STRUCT oea;
|
||||
|
||||
BWL_PRE_PACKED_STRUCT struct {
|
||||
uint32 lifetime;
|
||||
uint32 metric;
|
||||
uint8 target_count;
|
||||
struct ether_addr originator_addr;
|
||||
uint32 originator_seq;
|
||||
} BWL_POST_PACKED_STRUCT noea;
|
||||
} u;
|
||||
} BWL_POST_PACKED_STRUCT;
|
||||
typedef struct mesh_prep_ie mesh_prep_ie_t;
|
||||
|
||||
|
||||
/* Mesh PERR IE */
|
||||
struct mesh_perr_ie {
|
||||
uint8 id;
|
||||
uint8 len;
|
||||
uint8 ttl;
|
||||
uint8 num_dest;
|
||||
uint8 data[];
|
||||
};
|
||||
typedef struct mesh_perr_ie mesh_perr_ie_t;
|
||||
|
||||
/* Destination info is part of PERR IE */
|
||||
BWL_PRE_PACKED_STRUCT struct mesh_perr_destinfo {
|
||||
uint8 flags;
|
||||
struct ether_addr destination_addr;
|
||||
uint32 dest_seq;
|
||||
union {
|
||||
BWL_PRE_PACKED_STRUCT struct {
|
||||
struct ether_addr dest_ext_addr;
|
||||
} BWL_POST_PACKED_STRUCT dea;
|
||||
|
||||
BWL_PRE_PACKED_STRUCT struct {
|
||||
/* 1 byte reason code to be populated manually in software */
|
||||
uint16 reason_code;
|
||||
} BWL_POST_PACKED_STRUCT nodea;
|
||||
} u;
|
||||
} BWL_POST_PACKED_STRUCT;
|
||||
typedef struct mesh_perr_destinfo mesh_perr_destinfo_t;
|
||||
|
||||
/* Mesh peering action frame hdr */
|
||||
BWL_PRE_PACKED_STRUCT struct mesh_peering_frmhdr {
|
||||
uint8 category;
|
||||
uint8 action;
|
||||
union {
|
||||
struct {
|
||||
uint16 capability;
|
||||
} open;
|
||||
struct {
|
||||
uint16 capability;
|
||||
uint16 AID;
|
||||
} confirm;
|
||||
uint8 data[1];
|
||||
} u;
|
||||
} BWL_POST_PACKED_STRUCT;
|
||||
typedef struct mesh_peering_frmhdr mesh_peering_frmhdr_t;
|
||||
|
||||
/* Mesh peering mgmt IE */
|
||||
BWL_PRE_PACKED_STRUCT struct mesh_peer_mgmt_ie_common {
|
||||
uint16 mesh_peer_prot_id;
|
||||
uint16 local_link_id;
|
||||
} BWL_POST_PACKED_STRUCT;
|
||||
typedef struct mesh_peer_mgmt_ie_common mesh_peer_mgmt_ie_common_t;
|
||||
#define MESH_PEER_MGMT_IE_OPEN_LEN (4)
|
||||
|
||||
BWL_PRE_PACKED_STRUCT struct mesh_peer_mgmt_ie_cfm {
|
||||
mesh_peer_mgmt_ie_common_t common;
|
||||
uint16 peer_link_id;
|
||||
} BWL_POST_PACKED_STRUCT;
|
||||
typedef struct mesh_peer_mgmt_ie_cfm mesh_peer_mgmt_ie_cfm_t;
|
||||
#define MESH_PEER_MGMT_IE_CONF_LEN (6)
|
||||
|
||||
BWL_PRE_PACKED_STRUCT struct mesh_peer_mgmt_ie_close {
|
||||
mesh_peer_mgmt_ie_common_t common;
|
||||
/* uint16 peer_link_id;
|
||||
* simplicity: not supported, TODO for future
|
||||
*/
|
||||
uint16 reason_code;
|
||||
} BWL_POST_PACKED_STRUCT;
|
||||
typedef struct mesh_peer_mgmt_ie_close mesh_peer_mgmt_ie_close_t;
|
||||
#define MESH_PEER_MGMT_IE_CLOSE_LEN (6)
|
||||
|
||||
struct mesh_config_ie {
|
||||
uint8 activ_path_sel_prot_id;
|
||||
uint8 activ_path_sel_metric_id;
|
||||
uint8 cong_ctl_mode_id;
|
||||
uint8 sync_method_id;
|
||||
uint8 auth_prot_id;
|
||||
uint8 mesh_formation_info;
|
||||
uint8 mesh_cap;
|
||||
};
|
||||
typedef struct mesh_config_ie mesh_config_ie_t;
|
||||
#define MESH_CONFIG_IE_LEN (7)
|
||||
|
||||
/* Mesh peering states */
|
||||
#define MESH_PEERING_IDLE 0
|
||||
#define MESH_PEERING_OPEN_SNT 1
|
||||
#define MESH_PEERING_CNF_RCVD 2
|
||||
#define MESH_PEERING_OPEN_RCVD 3
|
||||
#define MESH_PEERING_ESTAB 4
|
||||
#define MESH_PEERING_HOLDING 5
|
||||
#define MESH_PEERING_LAST_STATE 6
|
||||
/* for debugging: mapping strings */
|
||||
#define MESH_PEERING_STATE_STRINGS \
|
||||
{"IDLE ", "OPNSNT", "CNFRCV", "OPNRCV", "ESTAB ", "HOLDNG"}
|
||||
|
||||
#ifdef WLMESH
|
||||
typedef BWL_PRE_PACKED_STRUCT struct mesh_peer_info {
|
||||
/* mesh_peer_instance as given in the spec. Note that, peer address
|
||||
* is stored in scb
|
||||
*/
|
||||
uint16 mesh_peer_prot_id;
|
||||
uint16 local_link_id;
|
||||
uint16 peer_link_id;
|
||||
/* AID generated by *peer* to self & received in peer_confirm */
|
||||
uint16 peer_aid;
|
||||
|
||||
/* TODO: no mention in spec? possibly used in PS case. Note that aid generated
|
||||
* from self to peer is stored in scb.
|
||||
*/
|
||||
uint8 state;
|
||||
/* TODO: struct mesh_peer_info *next; this field is required
|
||||
* if multiple peerings per same src is allowed, which is
|
||||
* true as per spec.
|
||||
*/
|
||||
} BWL_POST_PACKED_STRUCT mesh_peer_info_t;
|
||||
|
||||
typedef BWL_PRE_PACKED_STRUCT struct mesh_peer_info_ext {
|
||||
mesh_peer_info_t peer_info;
|
||||
uint16 local_aid; /* AID generated by *local* to peer */
|
||||
struct ether_addr ea; /* peer ea */
|
||||
uint32 entry_state; /* see MESH_PEER_ENTRY_STATE_ACTIVE etc; valid
|
||||
* ONLY for internal peering requests
|
||||
*/
|
||||
int rssi;
|
||||
} BWL_POST_PACKED_STRUCT mesh_peer_info_ext_t;
|
||||
|
||||
/* #ifdef WLMESH */
|
||||
typedef BWL_PRE_PACKED_STRUCT struct mesh_peer_info_dump {
|
||||
uint32 buflen;
|
||||
uint32 version;
|
||||
uint32 count; /* number of results */
|
||||
mesh_peer_info_ext_t mpi_ext[1];
|
||||
} BWL_POST_PACKED_STRUCT mesh_peer_info_dump_t;
|
||||
#define WL_MESH_PEER_RES_FIXED_SIZE (sizeof(mesh_peer_info_dump_t) - sizeof(mesh_peer_info_ext_t))
|
||||
|
||||
#endif /* WLMESH */
|
||||
|
||||
/* once an entry is added into mesh_peer_list, if peering is lost, it will
|
||||
* get retried for peering, MAX_MESH_PEER_ENTRY_RETRIES times. after wards, it
|
||||
* wont get retried and will be moved to MESH_PEER_ENTRY_STATE_TIMEDOUT state,
|
||||
* until user adds it again explicitely, when its entry_state is changed
|
||||
* to MESH_PEER_ENTRY_STATE_ACTIVE and tried again.
|
||||
*/
|
||||
#define MAX_MESH_SELF_PEER_ENTRY_RETRIES 3
|
||||
#define MESH_SELF_PEER_ENTRY_STATE_ACTIVE 1
|
||||
#define MESH_SELF_PEER_ENTRY_STATE_TIMEDOUT 2
|
||||
|
||||
/** Mesh Channel Switch Parameter IE data structure */
|
||||
BWL_PRE_PACKED_STRUCT struct dot11_mcsp_body {
|
||||
uint8 ttl; /* remaining number of hops allowed for this element. */
|
||||
uint8 flags; /* attributes of this channel switch attempt */
|
||||
uint8 reason; /* reason for the mesh channel switch */
|
||||
uint16 precedence; /* random value in the range 0 to 65535 */
|
||||
} BWL_POST_PACKED_STRUCT;
|
||||
|
||||
#define DOT11_MCSP_TTL_DEFAULT 1
|
||||
#define DOT11_MCSP_FLAG_TRANS_RESTRICT 0x1 /* no transmit except frames with mcsp */
|
||||
#define DOT11_MCSP_FLAG_INIT 0x2 /* initiates the channel switch attempt */
|
||||
#define DOT11_MCSP_FLAG_REASON 0x4 /* validity of reason code field */
|
||||
#define DOT11_MCSP_REASON_REGULATORY 0 /* meet regulatory requirements */
|
||||
#define DOT11_MCSP_REASON_UNSPECIFIED 1 /* unspecified reason */
|
||||
|
||||
BWL_PRE_PACKED_STRUCT struct dot11_mesh_csp {
|
||||
uint8 id; /* id DOT11_MNG_MESH_CSP_ID */
|
||||
uint8 len; /* length of IE */
|
||||
struct dot11_mcsp_body body; /* body of the ie */
|
||||
} BWL_POST_PACKED_STRUCT;
|
||||
typedef struct dot11_mesh_csp dot11_mesh_csp_ie_t;
|
||||
#define DOT11_MESH_CSP_IE_LEN 5 /* length of mesh channel switch parameter IE body */
|
||||
|
||||
/* This marks the end of a packed structure section. */
|
||||
#include <packed_section_end.h>
|
||||
|
||||
#endif /* #ifndef _802_11s_H_ */
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* Fundamental types and constants relating to 802.1D
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: 802.1d.h 700076 2017-05-17 14:42:22Z $
|
||||
*/
|
||||
|
||||
#ifndef _802_1_D_
|
||||
#define _802_1_D_
|
||||
|
||||
/* 802.1D priority defines */
|
||||
#define PRIO_8021D_NONE 2 /* None = - */
|
||||
#define PRIO_8021D_BK 1 /* BK - Background */
|
||||
#define PRIO_8021D_BE 0 /* BE - Best-effort */
|
||||
#define PRIO_8021D_EE 3 /* EE - Excellent-effort */
|
||||
#define PRIO_8021D_CL 4 /* CL - Controlled Load */
|
||||
#define PRIO_8021D_VI 5 /* Vi - Video */
|
||||
#define PRIO_8021D_VO 6 /* Vo - Voice */
|
||||
#define PRIO_8021D_NC 7 /* NC - Network Control */
|
||||
#define MAXPRIO 7 /* 0-7 */
|
||||
#define NUMPRIO (MAXPRIO + 1)
|
||||
|
||||
#define ALLPRIO -1 /* All prioirty */
|
||||
|
||||
/* Converts prio to precedence since the numerical value of
|
||||
* PRIO_8021D_BE and PRIO_8021D_NONE are swapped.
|
||||
*/
|
||||
#define PRIO2PREC(prio) \
|
||||
(((prio) == PRIO_8021D_NONE || (prio) == PRIO_8021D_BE) ? ((prio^2)) : (prio))
|
||||
|
||||
#endif /* _802_1_D__ */
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* Fundamental constants relating to 802.3
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: 802.3.h 700076 2017-05-17 14:42:22Z $
|
||||
*/
|
||||
|
||||
#ifndef _802_3_h_
|
||||
#define _802_3_h_
|
||||
|
||||
/* This marks the start of a packed structure section. */
|
||||
#include <packed_section_start.h>
|
||||
|
||||
#define SNAP_HDR_LEN 6 /* 802.3 SNAP header length */
|
||||
#define DOT3_OUI_LEN 3 /* 802.3 oui length */
|
||||
|
||||
BWL_PRE_PACKED_STRUCT struct dot3_mac_llc_snap_header {
|
||||
uint8 ether_dhost[ETHER_ADDR_LEN]; /* dest mac */
|
||||
uint8 ether_shost[ETHER_ADDR_LEN]; /* src mac */
|
||||
uint16 length; /* frame length incl header */
|
||||
uint8 dsap; /* always 0xAA */
|
||||
uint8 ssap; /* always 0xAA */
|
||||
uint8 ctl; /* always 0x03 */
|
||||
uint8 oui[DOT3_OUI_LEN]; /* RFC1042: 0x00 0x00 0x00
|
||||
* Bridge-Tunnel: 0x00 0x00 0xF8
|
||||
*/
|
||||
uint16 type; /* ethertype */
|
||||
} BWL_POST_PACKED_STRUCT;
|
||||
|
||||
/* This marks the end of a packed structure section. */
|
||||
#include <packed_section_end.h>
|
||||
|
||||
#endif /* #ifndef _802_3_h_ */
|
|
@ -0,0 +1,424 @@
|
|||
/*
|
||||
* Broadcom AMBA Interconnect definitions.
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: aidmp.h 614820 2016-01-23 17:16:17Z $
|
||||
*/
|
||||
|
||||
#ifndef _AIDMP_H
|
||||
#define _AIDMP_H
|
||||
|
||||
/* Manufacturer Ids */
|
||||
#define MFGID_ARM 0x43b
|
||||
#define MFGID_BRCM 0x4bf
|
||||
#define MFGID_MIPS 0x4a7
|
||||
|
||||
/* Component Classes */
|
||||
#define CC_SIM 0
|
||||
#define CC_EROM 1
|
||||
#define CC_CORESIGHT 9
|
||||
#define CC_VERIF 0xb
|
||||
#define CC_OPTIMO 0xd
|
||||
#define CC_GEN 0xe
|
||||
#define CC_PRIMECELL 0xf
|
||||
|
||||
/* Enumeration ROM registers */
|
||||
#define ER_EROMENTRY 0x000
|
||||
#define ER_REMAPCONTROL 0xe00
|
||||
#define ER_REMAPSELECT 0xe04
|
||||
#define ER_MASTERSELECT 0xe10
|
||||
#define ER_ITCR 0xf00
|
||||
#define ER_ITIP 0xf04
|
||||
|
||||
/* Erom entries */
|
||||
#define ER_TAG 0xe
|
||||
#define ER_TAG1 0x6
|
||||
#define ER_VALID 1
|
||||
#define ER_CI 0
|
||||
#define ER_MP 2
|
||||
#define ER_ADD 4
|
||||
#define ER_END 0xe
|
||||
#define ER_BAD 0xffffffff
|
||||
#define ER_SZ_MAX 4096 /* 4KB */
|
||||
|
||||
/* EROM CompIdentA */
|
||||
#define CIA_MFG_MASK 0xfff00000
|
||||
#define CIA_MFG_SHIFT 20
|
||||
#define CIA_CID_MASK 0x000fff00
|
||||
#define CIA_CID_SHIFT 8
|
||||
#define CIA_CCL_MASK 0x000000f0
|
||||
#define CIA_CCL_SHIFT 4
|
||||
|
||||
/* EROM CompIdentB */
|
||||
#define CIB_REV_MASK 0xff000000
|
||||
#define CIB_REV_SHIFT 24
|
||||
#define CIB_NSW_MASK 0x00f80000
|
||||
#define CIB_NSW_SHIFT 19
|
||||
#define CIB_NMW_MASK 0x0007c000
|
||||
#define CIB_NMW_SHIFT 14
|
||||
#define CIB_NSP_MASK 0x00003e00
|
||||
#define CIB_NSP_SHIFT 9
|
||||
#define CIB_NMP_MASK 0x000001f0
|
||||
#define CIB_NMP_SHIFT 4
|
||||
|
||||
/* EROM MasterPortDesc */
|
||||
#define MPD_MUI_MASK 0x0000ff00
|
||||
#define MPD_MUI_SHIFT 8
|
||||
#define MPD_MP_MASK 0x000000f0
|
||||
#define MPD_MP_SHIFT 4
|
||||
|
||||
/* EROM AddrDesc */
|
||||
#define AD_ADDR_MASK 0xfffff000
|
||||
#define AD_SP_MASK 0x00000f00
|
||||
#define AD_SP_SHIFT 8
|
||||
#define AD_ST_MASK 0x000000c0
|
||||
#define AD_ST_SHIFT 6
|
||||
#define AD_ST_SLAVE 0x00000000
|
||||
#define AD_ST_BRIDGE 0x00000040
|
||||
#define AD_ST_SWRAP 0x00000080
|
||||
#define AD_ST_MWRAP 0x000000c0
|
||||
#define AD_SZ_MASK 0x00000030
|
||||
#define AD_SZ_SHIFT 4
|
||||
#define AD_SZ_4K 0x00000000
|
||||
#define AD_SZ_8K 0x00000010
|
||||
#define AD_SZ_16K 0x00000020
|
||||
#define AD_SZ_SZD 0x00000030
|
||||
#define AD_AG32 0x00000008
|
||||
#define AD_ADDR_ALIGN 0x00000fff
|
||||
#define AD_SZ_BASE 0x00001000 /* 4KB */
|
||||
|
||||
/* EROM SizeDesc */
|
||||
#define SD_SZ_MASK 0xfffff000
|
||||
#define SD_SG32 0x00000008
|
||||
#define SD_SZ_ALIGN 0x00000fff
|
||||
|
||||
|
||||
#if !defined(_LANGUAGE_ASSEMBLY) && !defined(__ASSEMBLY__)
|
||||
|
||||
typedef volatile struct _aidmp {
|
||||
uint32 oobselina30; /* 0x000 */
|
||||
uint32 oobselina74; /* 0x004 */
|
||||
uint32 PAD[6];
|
||||
uint32 oobselinb30; /* 0x020 */
|
||||
uint32 oobselinb74; /* 0x024 */
|
||||
uint32 PAD[6];
|
||||
uint32 oobselinc30; /* 0x040 */
|
||||
uint32 oobselinc74; /* 0x044 */
|
||||
uint32 PAD[6];
|
||||
uint32 oobselind30; /* 0x060 */
|
||||
uint32 oobselind74; /* 0x064 */
|
||||
uint32 PAD[38];
|
||||
uint32 oobselouta30; /* 0x100 */
|
||||
uint32 oobselouta74; /* 0x104 */
|
||||
uint32 PAD[6];
|
||||
uint32 oobseloutb30; /* 0x120 */
|
||||
uint32 oobseloutb74; /* 0x124 */
|
||||
uint32 PAD[6];
|
||||
uint32 oobseloutc30; /* 0x140 */
|
||||
uint32 oobseloutc74; /* 0x144 */
|
||||
uint32 PAD[6];
|
||||
uint32 oobseloutd30; /* 0x160 */
|
||||
uint32 oobseloutd74; /* 0x164 */
|
||||
uint32 PAD[38];
|
||||
uint32 oobsynca; /* 0x200 */
|
||||
uint32 oobseloutaen; /* 0x204 */
|
||||
uint32 PAD[6];
|
||||
uint32 oobsyncb; /* 0x220 */
|
||||
uint32 oobseloutben; /* 0x224 */
|
||||
uint32 PAD[6];
|
||||
uint32 oobsyncc; /* 0x240 */
|
||||
uint32 oobseloutcen; /* 0x244 */
|
||||
uint32 PAD[6];
|
||||
uint32 oobsyncd; /* 0x260 */
|
||||
uint32 oobseloutden; /* 0x264 */
|
||||
uint32 PAD[38];
|
||||
uint32 oobaextwidth; /* 0x300 */
|
||||
uint32 oobainwidth; /* 0x304 */
|
||||
uint32 oobaoutwidth; /* 0x308 */
|
||||
uint32 PAD[5];
|
||||
uint32 oobbextwidth; /* 0x320 */
|
||||
uint32 oobbinwidth; /* 0x324 */
|
||||
uint32 oobboutwidth; /* 0x328 */
|
||||
uint32 PAD[5];
|
||||
uint32 oobcextwidth; /* 0x340 */
|
||||
uint32 oobcinwidth; /* 0x344 */
|
||||
uint32 oobcoutwidth; /* 0x348 */
|
||||
uint32 PAD[5];
|
||||
uint32 oobdextwidth; /* 0x360 */
|
||||
uint32 oobdinwidth; /* 0x364 */
|
||||
uint32 oobdoutwidth; /* 0x368 */
|
||||
uint32 PAD[37];
|
||||
uint32 ioctrlset; /* 0x400 */
|
||||
uint32 ioctrlclear; /* 0x404 */
|
||||
uint32 ioctrl; /* 0x408 */
|
||||
uint32 PAD[61];
|
||||
uint32 iostatus; /* 0x500 */
|
||||
uint32 PAD[127];
|
||||
uint32 ioctrlwidth; /* 0x700 */
|
||||
uint32 iostatuswidth; /* 0x704 */
|
||||
uint32 PAD[62];
|
||||
uint32 resetctrl; /* 0x800 */
|
||||
uint32 resetstatus; /* 0x804 */
|
||||
uint32 resetreadid; /* 0x808 */
|
||||
uint32 resetwriteid; /* 0x80c */
|
||||
uint32 PAD[60];
|
||||
uint32 errlogctrl; /* 0x900 */
|
||||
uint32 errlogdone; /* 0x904 */
|
||||
uint32 errlogstatus; /* 0x908 */
|
||||
uint32 errlogaddrlo; /* 0x90c */
|
||||
uint32 errlogaddrhi; /* 0x910 */
|
||||
uint32 errlogid; /* 0x914 */
|
||||
uint32 errloguser; /* 0x918 */
|
||||
uint32 errlogflags; /* 0x91c */
|
||||
uint32 PAD[56];
|
||||
uint32 intstatus; /* 0xa00 */
|
||||
uint32 PAD[255];
|
||||
uint32 config; /* 0xe00 */
|
||||
uint32 PAD[63];
|
||||
uint32 itcr; /* 0xf00 */
|
||||
uint32 PAD[3];
|
||||
uint32 itipooba; /* 0xf10 */
|
||||
uint32 itipoobb; /* 0xf14 */
|
||||
uint32 itipoobc; /* 0xf18 */
|
||||
uint32 itipoobd; /* 0xf1c */
|
||||
uint32 PAD[4];
|
||||
uint32 itipoobaout; /* 0xf30 */
|
||||
uint32 itipoobbout; /* 0xf34 */
|
||||
uint32 itipoobcout; /* 0xf38 */
|
||||
uint32 itipoobdout; /* 0xf3c */
|
||||
uint32 PAD[4];
|
||||
uint32 itopooba; /* 0xf50 */
|
||||
uint32 itopoobb; /* 0xf54 */
|
||||
uint32 itopoobc; /* 0xf58 */
|
||||
uint32 itopoobd; /* 0xf5c */
|
||||
uint32 PAD[4];
|
||||
uint32 itopoobain; /* 0xf70 */
|
||||
uint32 itopoobbin; /* 0xf74 */
|
||||
uint32 itopoobcin; /* 0xf78 */
|
||||
uint32 itopoobdin; /* 0xf7c */
|
||||
uint32 PAD[4];
|
||||
uint32 itopreset; /* 0xf90 */
|
||||
uint32 PAD[15];
|
||||
uint32 peripherialid4; /* 0xfd0 */
|
||||
uint32 peripherialid5; /* 0xfd4 */
|
||||
uint32 peripherialid6; /* 0xfd8 */
|
||||
uint32 peripherialid7; /* 0xfdc */
|
||||
uint32 peripherialid0; /* 0xfe0 */
|
||||
uint32 peripherialid1; /* 0xfe4 */
|
||||
uint32 peripherialid2; /* 0xfe8 */
|
||||
uint32 peripherialid3; /* 0xfec */
|
||||
uint32 componentid0; /* 0xff0 */
|
||||
uint32 componentid1; /* 0xff4 */
|
||||
uint32 componentid2; /* 0xff8 */
|
||||
uint32 componentid3; /* 0xffc */
|
||||
} aidmp_t;
|
||||
|
||||
#endif /* !_LANGUAGE_ASSEMBLY && !__ASSEMBLY__ */
|
||||
|
||||
/* Out-of-band Router registers */
|
||||
#define OOB_BUSCONFIG 0x020
|
||||
#define OOB_STATUSA 0x100
|
||||
#define OOB_STATUSB 0x104
|
||||
#define OOB_STATUSC 0x108
|
||||
#define OOB_STATUSD 0x10c
|
||||
#define OOB_ENABLEA0 0x200
|
||||
#define OOB_ENABLEA1 0x204
|
||||
#define OOB_ENABLEA2 0x208
|
||||
#define OOB_ENABLEA3 0x20c
|
||||
#define OOB_ENABLEB0 0x280
|
||||
#define OOB_ENABLEB1 0x284
|
||||
#define OOB_ENABLEB2 0x288
|
||||
#define OOB_ENABLEB3 0x28c
|
||||
#define OOB_ENABLEC0 0x300
|
||||
#define OOB_ENABLEC1 0x304
|
||||
#define OOB_ENABLEC2 0x308
|
||||
#define OOB_ENABLEC3 0x30c
|
||||
#define OOB_ENABLED0 0x380
|
||||
#define OOB_ENABLED1 0x384
|
||||
#define OOB_ENABLED2 0x388
|
||||
#define OOB_ENABLED3 0x38c
|
||||
#define OOB_ITCR 0xf00
|
||||
#define OOB_ITIPOOBA 0xf10
|
||||
#define OOB_ITIPOOBB 0xf14
|
||||
#define OOB_ITIPOOBC 0xf18
|
||||
#define OOB_ITIPOOBD 0xf1c
|
||||
#define OOB_ITOPOOBA 0xf30
|
||||
#define OOB_ITOPOOBB 0xf34
|
||||
#define OOB_ITOPOOBC 0xf38
|
||||
#define OOB_ITOPOOBD 0xf3c
|
||||
|
||||
/* DMP wrapper registers */
|
||||
#define AI_OOBSELINA30 0x000
|
||||
#define AI_OOBSELINA74 0x004
|
||||
#define AI_OOBSELINB30 0x020
|
||||
#define AI_OOBSELINB74 0x024
|
||||
#define AI_OOBSELINC30 0x040
|
||||
#define AI_OOBSELINC74 0x044
|
||||
#define AI_OOBSELIND30 0x060
|
||||
#define AI_OOBSELIND74 0x064
|
||||
#define AI_OOBSELOUTA30 0x100
|
||||
#define AI_OOBSELOUTA74 0x104
|
||||
#define AI_OOBSELOUTB30 0x120
|
||||
#define AI_OOBSELOUTB74 0x124
|
||||
#define AI_OOBSELOUTC30 0x140
|
||||
#define AI_OOBSELOUTC74 0x144
|
||||
#define AI_OOBSELOUTD30 0x160
|
||||
#define AI_OOBSELOUTD74 0x164
|
||||
#define AI_OOBSYNCA 0x200
|
||||
#define AI_OOBSELOUTAEN 0x204
|
||||
#define AI_OOBSYNCB 0x220
|
||||
#define AI_OOBSELOUTBEN 0x224
|
||||
#define AI_OOBSYNCC 0x240
|
||||
#define AI_OOBSELOUTCEN 0x244
|
||||
#define AI_OOBSYNCD 0x260
|
||||
#define AI_OOBSELOUTDEN 0x264
|
||||
#define AI_OOBAEXTWIDTH 0x300
|
||||
#define AI_OOBAINWIDTH 0x304
|
||||
#define AI_OOBAOUTWIDTH 0x308
|
||||
#define AI_OOBBEXTWIDTH 0x320
|
||||
#define AI_OOBBINWIDTH 0x324
|
||||
#define AI_OOBBOUTWIDTH 0x328
|
||||
#define AI_OOBCEXTWIDTH 0x340
|
||||
#define AI_OOBCINWIDTH 0x344
|
||||
#define AI_OOBCOUTWIDTH 0x348
|
||||
#define AI_OOBDEXTWIDTH 0x360
|
||||
#define AI_OOBDINWIDTH 0x364
|
||||
#define AI_OOBDOUTWIDTH 0x368
|
||||
|
||||
|
||||
#define AI_IOCTRLSET 0x400
|
||||
#define AI_IOCTRLCLEAR 0x404
|
||||
#define AI_IOCTRL 0x408
|
||||
#define AI_IOSTATUS 0x500
|
||||
#define AI_RESETCTRL 0x800
|
||||
#define AI_RESETSTATUS 0x804
|
||||
|
||||
#define AI_IOCTRLWIDTH 0x700
|
||||
#define AI_IOSTATUSWIDTH 0x704
|
||||
|
||||
#define AI_RESETREADID 0x808
|
||||
#define AI_RESETWRITEID 0x80c
|
||||
#define AI_ERRLOGCTRL 0x900
|
||||
#define AI_ERRLOGDONE 0x904
|
||||
#define AI_ERRLOGSTATUS 0x908
|
||||
#define AI_ERRLOGADDRLO 0x90c
|
||||
#define AI_ERRLOGADDRHI 0x910
|
||||
#define AI_ERRLOGID 0x914
|
||||
#define AI_ERRLOGUSER 0x918
|
||||
#define AI_ERRLOGFLAGS 0x91c
|
||||
#define AI_INTSTATUS 0xa00
|
||||
#define AI_CONFIG 0xe00
|
||||
#define AI_ITCR 0xf00
|
||||
#define AI_ITIPOOBA 0xf10
|
||||
#define AI_ITIPOOBB 0xf14
|
||||
#define AI_ITIPOOBC 0xf18
|
||||
#define AI_ITIPOOBD 0xf1c
|
||||
#define AI_ITIPOOBAOUT 0xf30
|
||||
#define AI_ITIPOOBBOUT 0xf34
|
||||
#define AI_ITIPOOBCOUT 0xf38
|
||||
#define AI_ITIPOOBDOUT 0xf3c
|
||||
#define AI_ITOPOOBA 0xf50
|
||||
#define AI_ITOPOOBB 0xf54
|
||||
#define AI_ITOPOOBC 0xf58
|
||||
#define AI_ITOPOOBD 0xf5c
|
||||
#define AI_ITOPOOBAIN 0xf70
|
||||
#define AI_ITOPOOBBIN 0xf74
|
||||
#define AI_ITOPOOBCIN 0xf78
|
||||
#define AI_ITOPOOBDIN 0xf7c
|
||||
#define AI_ITOPRESET 0xf90
|
||||
#define AI_PERIPHERIALID4 0xfd0
|
||||
#define AI_PERIPHERIALID5 0xfd4
|
||||
#define AI_PERIPHERIALID6 0xfd8
|
||||
#define AI_PERIPHERIALID7 0xfdc
|
||||
#define AI_PERIPHERIALID0 0xfe0
|
||||
#define AI_PERIPHERIALID1 0xfe4
|
||||
#define AI_PERIPHERIALID2 0xfe8
|
||||
#define AI_PERIPHERIALID3 0xfec
|
||||
#define AI_COMPONENTID0 0xff0
|
||||
#define AI_COMPONENTID1 0xff4
|
||||
#define AI_COMPONENTID2 0xff8
|
||||
#define AI_COMPONENTID3 0xffc
|
||||
|
||||
/* resetctrl */
|
||||
#define AIRC_RESET 1
|
||||
|
||||
/* errlogctrl */
|
||||
#define AIELC_TO_EXP_MASK 0x0000001f0 /* backplane timeout exponent */
|
||||
#define AIELC_TO_EXP_SHIFT 4
|
||||
#define AIELC_TO_ENAB_SHIFT 9 /* backplane timeout enable */
|
||||
|
||||
/* errlogdone */
|
||||
#define AIELD_ERRDONE_MASK 0x3
|
||||
|
||||
/* errlogstatus */
|
||||
#define AIELS_SLAVE_ERR 0x1
|
||||
#define AIELS_TIMEOUT 0x2
|
||||
#define AIELS_DECODE 0x3
|
||||
#define AIELS_TIMEOUT_MASK 0x3
|
||||
|
||||
/* errorlog status bit map, for SW use */
|
||||
#define AXI_WRAP_STS_NONE (0)
|
||||
#define AXI_WRAP_STS_TIMEOUT (1<<0)
|
||||
#define AXI_WRAP_STS_SLAVE_ERR (1<<1)
|
||||
#define AXI_WRAP_STS_DECODE_ERR (1<<2)
|
||||
#define AXI_WRAP_STS_PCI_RD_ERR (1<<3)
|
||||
#define AXI_WRAP_STS_WRAP_RD_ERR (1<<4)
|
||||
#define AXI_WRAP_STS_SET_CORE_FAIL (1<<5)
|
||||
|
||||
/* errlogFrags */
|
||||
#define AXI_ERRLOG_FLAGS_WRITE_REQ (1<<24)
|
||||
|
||||
/* config */
|
||||
#define AICFG_OOB 0x00000020
|
||||
#define AICFG_IOS 0x00000010
|
||||
#define AICFG_IOC 0x00000008
|
||||
#define AICFG_TO 0x00000004
|
||||
#define AICFG_ERRL 0x00000002
|
||||
#define AICFG_RST 0x00000001
|
||||
|
||||
/* bit defines for AI_OOBSELOUTB74 reg */
|
||||
#define OOB_SEL_OUTEN_B_5 15
|
||||
#define OOB_SEL_OUTEN_B_6 23
|
||||
|
||||
/* AI_OOBSEL for A/B/C/D, 0-7 */
|
||||
#define AI_OOBSEL_MASK 0x1F
|
||||
#define AI_OOBSEL_0_SHIFT 0
|
||||
#define AI_OOBSEL_1_SHIFT 8
|
||||
#define AI_OOBSEL_2_SHIFT 16
|
||||
#define AI_OOBSEL_3_SHIFT 24
|
||||
#define AI_OOBSEL_4_SHIFT 0
|
||||
#define AI_OOBSEL_5_SHIFT 8
|
||||
#define AI_OOBSEL_6_SHIFT 16
|
||||
#define AI_OOBSEL_7_SHIFT 24
|
||||
#define AI_IOCTRL_ENABLE_D11_PME (1 << 14)
|
||||
|
||||
/* mask for interrupts from each core to wrapper */
|
||||
#define AI_OOBSELINA74_CORE_MASK 0x80808080
|
||||
#define AI_OOBSELINA30_CORE_MASK 0x80808080
|
||||
|
||||
/* axi id mask in the error log id */
|
||||
#define AI_ERRLOGID_AXI_ID_MASK 0x07
|
||||
|
||||
#endif /* _AIDMP_H */
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* BCM common config options
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: bcm_cfg.h 514727 2014-11-12 03:02:48Z $
|
||||
*/
|
||||
|
||||
#ifndef _bcm_cfg_h_
|
||||
#define _bcm_cfg_h_
|
||||
#endif /* _bcm_cfg_h_ */
|
|
@ -0,0 +1,364 @@
|
|||
/*
|
||||
* Memory pools library, Public interface
|
||||
*
|
||||
* API Overview
|
||||
*
|
||||
* This package provides a memory allocation subsystem based on pools of
|
||||
* homogenous objects.
|
||||
*
|
||||
* Instrumentation is available for reporting memory utilization both
|
||||
* on a per-data-structure basis and system wide.
|
||||
*
|
||||
* There are two main types defined in this API.
|
||||
*
|
||||
* pool manager: A singleton object that acts as a factory for
|
||||
* pool allocators. It also is used for global
|
||||
* instrumentation, such as reporting all blocks
|
||||
* in use across all data structures. The pool manager
|
||||
* creates and provides individual memory pools
|
||||
* upon request to application code.
|
||||
*
|
||||
* memory pool: An object for allocating homogenous memory blocks.
|
||||
*
|
||||
* Global identifiers in this module use the following prefixes:
|
||||
* bcm_mpm_* Memory pool manager
|
||||
* bcm_mp_* Memory pool
|
||||
*
|
||||
* There are two main types of memory pools:
|
||||
*
|
||||
* prealloc: The contiguous memory block of objects can either be supplied
|
||||
* by the client or malloc'ed by the memory manager. The objects are
|
||||
* allocated out of a block of memory and freed back to the block.
|
||||
*
|
||||
* heap: The memory pool allocator uses the heap (malloc/free) for memory.
|
||||
* In this case, the pool allocator is just providing statistics
|
||||
* and instrumentation on top of the heap, without modifying the heap
|
||||
* allocation implementation.
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: bcm_mpool_pub.h 535090 2015-02-17 04:49:01Z $
|
||||
*/
|
||||
|
||||
#ifndef _BCM_MPOOL_PUB_H
|
||||
#define _BCM_MPOOL_PUB_H 1
|
||||
|
||||
#include <typedefs.h> /* needed for uint16 */
|
||||
|
||||
|
||||
/*
|
||||
**************************************************************************
|
||||
*
|
||||
* Type definitions, handles
|
||||
*
|
||||
**************************************************************************
|
||||
*/
|
||||
|
||||
/* Forward declaration of OSL handle. */
|
||||
struct osl_info;
|
||||
|
||||
/* Forward declaration of string buffer. */
|
||||
struct bcmstrbuf;
|
||||
|
||||
/*
|
||||
* Opaque type definition for the pool manager handle. This object is used for global
|
||||
* memory pool operations such as obtaining a new pool, deleting a pool, iterating and
|
||||
* instrumentation/debugging.
|
||||
*/
|
||||
struct bcm_mpm_mgr;
|
||||
typedef struct bcm_mpm_mgr *bcm_mpm_mgr_h;
|
||||
|
||||
/*
|
||||
* Opaque type definition for an instance of a pool. This handle is used for allocating
|
||||
* and freeing memory through the pool, as well as management/instrumentation on this
|
||||
* specific pool.
|
||||
*/
|
||||
struct bcm_mp_pool;
|
||||
typedef struct bcm_mp_pool *bcm_mp_pool_h;
|
||||
|
||||
|
||||
/*
|
||||
* To make instrumentation more readable, every memory
|
||||
* pool must have a readable name. Pool names are up to
|
||||
* 8 bytes including '\0' termination. (7 printable characters.)
|
||||
*/
|
||||
#define BCM_MP_NAMELEN 8
|
||||
|
||||
|
||||
/*
|
||||
* Type definition for pool statistics.
|
||||
*/
|
||||
typedef struct bcm_mp_stats {
|
||||
char name[BCM_MP_NAMELEN]; /* Name of this pool. */
|
||||
unsigned int objsz; /* Object size allocated in this pool */
|
||||
uint16 nobj; /* Total number of objects in this pool */
|
||||
uint16 num_alloc; /* Number of objects currently allocated */
|
||||
uint16 high_water; /* Max number of allocated objects. */
|
||||
uint16 failed_alloc; /* Failed allocations. */
|
||||
} bcm_mp_stats_t;
|
||||
|
||||
|
||||
/*
|
||||
**************************************************************************
|
||||
*
|
||||
* API Routines on the pool manager.
|
||||
*
|
||||
**************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
* bcm_mpm_init() - initialize the whole memory pool system.
|
||||
*
|
||||
* Parameters:
|
||||
* osh: INPUT Operating system handle. Needed for heap memory allocation.
|
||||
* max_pools: INPUT Maximum number of mempools supported.
|
||||
* mgr: OUTPUT The handle is written with the new pools manager object/handle.
|
||||
*
|
||||
* Returns:
|
||||
* BCME_OK Object initialized successfully. May be used.
|
||||
* BCME_NOMEM Initialization failed due to no memory. Object must not be used.
|
||||
*/
|
||||
int bcm_mpm_init(struct osl_info *osh, int max_pools, bcm_mpm_mgr_h *mgrp);
|
||||
|
||||
|
||||
/*
|
||||
* bcm_mpm_deinit() - de-initialize the whole memory pool system.
|
||||
*
|
||||
* Parameters:
|
||||
* mgr: INPUT Pointer to pool manager handle.
|
||||
*
|
||||
* Returns:
|
||||
* BCME_OK Memory pool manager successfully de-initialized.
|
||||
* other Indicated error occured during de-initialization.
|
||||
*/
|
||||
int bcm_mpm_deinit(bcm_mpm_mgr_h *mgrp);
|
||||
|
||||
/*
|
||||
* bcm_mpm_create_prealloc_pool() - Create a new pool for fixed size objects. The
|
||||
* pool uses a contiguous block of pre-alloced
|
||||
* memory. The memory block may either be provided
|
||||
* by the client or dynamically allocated by the
|
||||
* pool manager.
|
||||
*
|
||||
* Parameters:
|
||||
* mgr: INPUT The handle to the pool manager
|
||||
* obj_sz: INPUT Size of objects that will be allocated by the new pool
|
||||
* Must be >= sizeof(void *).
|
||||
* nobj: INPUT Maximum number of concurrently existing objects to support
|
||||
* memstart INPUT Pointer to the memory to use, or NULL to malloc()
|
||||
* memsize INPUT Number of bytes referenced from memstart (for error checking).
|
||||
* Must be 0 if 'memstart' is NULL.
|
||||
* poolname INPUT For instrumentation, the name of the pool
|
||||
* newp: OUTPUT The handle for the new pool, if creation is successful
|
||||
*
|
||||
* Returns:
|
||||
* BCME_OK Pool created ok.
|
||||
* other Pool not created due to indicated error. newpoolp set to NULL.
|
||||
*
|
||||
*
|
||||
*/
|
||||
int bcm_mpm_create_prealloc_pool(bcm_mpm_mgr_h mgr,
|
||||
unsigned int obj_sz,
|
||||
int nobj,
|
||||
void *memstart,
|
||||
unsigned int memsize,
|
||||
const char poolname[BCM_MP_NAMELEN],
|
||||
bcm_mp_pool_h *newp);
|
||||
|
||||
|
||||
/*
|
||||
* bcm_mpm_delete_prealloc_pool() - Delete a memory pool. This should only be called after
|
||||
* all memory objects have been freed back to the pool.
|
||||
*
|
||||
* Parameters:
|
||||
* mgr: INPUT The handle to the pools manager
|
||||
* pool: INPUT The handle of the pool to delete
|
||||
*
|
||||
* Returns:
|
||||
* BCME_OK Pool deleted ok.
|
||||
* other Pool not deleted due to indicated error.
|
||||
*
|
||||
*/
|
||||
int bcm_mpm_delete_prealloc_pool(bcm_mpm_mgr_h mgr, bcm_mp_pool_h *poolp);
|
||||
|
||||
/*
|
||||
* bcm_mpm_create_heap_pool() - Create a new pool for fixed size objects. The memory
|
||||
* pool allocator uses the heap (malloc/free) for memory.
|
||||
* In this case, the pool allocator is just providing
|
||||
* statistics and instrumentation on top of the heap,
|
||||
* without modifying the heap allocation implementation.
|
||||
*
|
||||
* Parameters:
|
||||
* mgr: INPUT The handle to the pool manager
|
||||
* obj_sz: INPUT Size of objects that will be allocated by the new pool
|
||||
* poolname INPUT For instrumentation, the name of the pool
|
||||
* newp: OUTPUT The handle for the new pool, if creation is successful
|
||||
*
|
||||
* Returns:
|
||||
* BCME_OK Pool created ok.
|
||||
* other Pool not created due to indicated error. newpoolp set to NULL.
|
||||
*
|
||||
*
|
||||
*/
|
||||
int bcm_mpm_create_heap_pool(bcm_mpm_mgr_h mgr, unsigned int obj_sz,
|
||||
const char poolname[BCM_MP_NAMELEN],
|
||||
bcm_mp_pool_h *newp);
|
||||
|
||||
|
||||
/*
|
||||
* bcm_mpm_delete_heap_pool() - Delete a memory pool. This should only be called after
|
||||
* all memory objects have been freed back to the pool.
|
||||
*
|
||||
* Parameters:
|
||||
* mgr: INPUT The handle to the pools manager
|
||||
* pool: INPUT The handle of the pool to delete
|
||||
*
|
||||
* Returns:
|
||||
* BCME_OK Pool deleted ok.
|
||||
* other Pool not deleted due to indicated error.
|
||||
*
|
||||
*/
|
||||
int bcm_mpm_delete_heap_pool(bcm_mpm_mgr_h mgr, bcm_mp_pool_h *poolp);
|
||||
|
||||
|
||||
/*
|
||||
* bcm_mpm_stats() - Return stats for all pools
|
||||
*
|
||||
* Parameters:
|
||||
* mgr: INPUT The handle to the pools manager
|
||||
* stats: OUTPUT Array of pool statistics.
|
||||
* nentries: MOD Max elements in 'stats' array on INPUT. Actual number
|
||||
* of array elements copied to 'stats' on OUTPUT.
|
||||
*
|
||||
* Returns:
|
||||
* BCME_OK Ok
|
||||
* other Error getting stats.
|
||||
*
|
||||
*/
|
||||
int bcm_mpm_stats(bcm_mpm_mgr_h mgr, bcm_mp_stats_t *stats, int *nentries);
|
||||
|
||||
|
||||
/*
|
||||
* bcm_mpm_dump() - Display statistics on all pools
|
||||
*
|
||||
* Parameters:
|
||||
* mgr: INPUT The handle to the pools manager
|
||||
* b: OUTPUT Output buffer.
|
||||
*
|
||||
* Returns:
|
||||
* BCME_OK Ok
|
||||
* other Error during dump.
|
||||
*
|
||||
*/
|
||||
int bcm_mpm_dump(bcm_mpm_mgr_h mgr, struct bcmstrbuf *b);
|
||||
|
||||
|
||||
/*
|
||||
* bcm_mpm_get_obj_size() - The size of memory objects may need to be padded to
|
||||
* compensate for alignment requirements of the objects.
|
||||
* This function provides the padded object size. If clients
|
||||
* pre-allocate a memory slab for a memory pool, the
|
||||
* padded object size should be used by the client to allocate
|
||||
* the memory slab (in order to provide sufficent space for
|
||||
* the maximum number of objects).
|
||||
*
|
||||
* Parameters:
|
||||
* mgr: INPUT The handle to the pools manager.
|
||||
* obj_sz: INPUT Input object size.
|
||||
* padded_obj_sz: OUTPUT Padded object size.
|
||||
*
|
||||
* Returns:
|
||||
* BCME_OK Ok
|
||||
* BCME_BADARG Bad arguments.
|
||||
*
|
||||
*/
|
||||
int bcm_mpm_get_obj_size(bcm_mpm_mgr_h mgr, unsigned int obj_sz, unsigned int *padded_obj_sz);
|
||||
|
||||
|
||||
/*
|
||||
***************************************************************************
|
||||
*
|
||||
* API Routines on a specific pool.
|
||||
*
|
||||
***************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* bcm_mp_alloc() - Allocate a memory pool object.
|
||||
*
|
||||
* Parameters:
|
||||
* pool: INPUT The handle to the pool.
|
||||
*
|
||||
* Returns:
|
||||
* A pointer to the new object. NULL on error.
|
||||
*
|
||||
*/
|
||||
void* bcm_mp_alloc(bcm_mp_pool_h pool);
|
||||
|
||||
/*
|
||||
* bcm_mp_free() - Free a memory pool object.
|
||||
*
|
||||
* Parameters:
|
||||
* pool: INPUT The handle to the pool.
|
||||
* objp: INPUT A pointer to the object to free.
|
||||
*
|
||||
* Returns:
|
||||
* BCME_OK Ok
|
||||
* other Error during free.
|
||||
*
|
||||
*/
|
||||
int bcm_mp_free(bcm_mp_pool_h pool, void *objp);
|
||||
|
||||
/*
|
||||
* bcm_mp_stats() - Return stats for this pool
|
||||
*
|
||||
* Parameters:
|
||||
* pool: INPUT The handle to the pool
|
||||
* stats: OUTPUT Pool statistics
|
||||
*
|
||||
* Returns:
|
||||
* BCME_OK Ok
|
||||
* other Error getting statistics.
|
||||
*
|
||||
*/
|
||||
void bcm_mp_stats(bcm_mp_pool_h pool, bcm_mp_stats_t *stats);
|
||||
|
||||
|
||||
/*
|
||||
* bcm_mp_dump() - Dump a pool
|
||||
*
|
||||
* Parameters:
|
||||
* pool: INPUT The handle to the pool
|
||||
* b OUTPUT Output buffer
|
||||
*
|
||||
* Returns:
|
||||
* BCME_OK Ok
|
||||
* other Error during dump.
|
||||
*
|
||||
*/
|
||||
int bcm_mp_dump(bcm_mp_pool_h pool, struct bcmstrbuf *b);
|
||||
|
||||
|
||||
#endif /* _BCM_MPOOL_PUB_H */
|
|
@ -0,0 +1,634 @@
|
|||
/*
|
||||
* bcm_ring.h : Ring context abstraction
|
||||
* The ring context tracks the WRITE and READ indices where elements may be
|
||||
* produced and consumed respectively. All elements in the ring need to be
|
||||
* fixed size.
|
||||
*
|
||||
* NOTE: A ring of size N, may only hold N-1 elements.
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: bcm_ring.h 596126 2015-10-29 19:53:48Z $
|
||||
*/
|
||||
#ifndef __bcm_ring_included__
|
||||
#define __bcm_ring_included__
|
||||
/*
|
||||
* API Notes:
|
||||
*
|
||||
* Ring manipulation API allows for:
|
||||
* Pending operations: Often before some work can be completed, it may be
|
||||
* desired that several resources are available, e.g. space for production in
|
||||
* a ring. Approaches such as, #1) reserve resources one by one and return them
|
||||
* if another required resource is not available, or #2) employ a two pass
|
||||
* algorithm of first testing whether all resources are available, have a
|
||||
* an impact on performance critical code. The approach taken here is more akin
|
||||
* to approach #2, where a test for resource availability essentially also
|
||||
* provides the index for production in an un-committed state.
|
||||
* The same approach is taken for the consumer side.
|
||||
*
|
||||
* - Pending production: Fetch the next index where a ring element may be
|
||||
* produced. The caller may not commit the WRITE of the element.
|
||||
* - Pending consumption: Fetch the next index where a ring element may be
|
||||
* consumed. The caller may not commut the READ of the element.
|
||||
*
|
||||
* Producer side API:
|
||||
* - bcm_ring_is_full : Test whether ring is full
|
||||
* - bcm_ring_prod : Fetch index where an element may be produced (commit)
|
||||
* - bcm_ring_prod_pend: Fetch index where an element may be produced (pending)
|
||||
* - bcm_ring_prod_done: Commit a previous pending produce fetch
|
||||
* - bcm_ring_prod_avail: Fetch total number free slots eligible for production
|
||||
*
|
||||
* Consumer side API:
|
||||
* - bcm_ring_is_empty : Test whether ring is empty
|
||||
* - bcm_ring_cons : Fetch index where an element may be consumed (commit)
|
||||
* - bcm_ring_cons_pend: Fetch index where an element may be consumed (pending)
|
||||
* - bcm_ring_cons_done: Commit a previous pending consume fetch
|
||||
* - bcm_ring_cons_avail: Fetch total number elements eligible for consumption
|
||||
*
|
||||
* - bcm_ring_sync_read: Sync read offset in peer ring, from local ring
|
||||
* - bcm_ring_sync_write: Sync write offset in peer ring, from local ring
|
||||
*
|
||||
* +----------------------------------------------------------------------------
|
||||
*
|
||||
* Design Notes:
|
||||
* Following items are not tracked in a ring context (design decision)
|
||||
* - width of a ring element.
|
||||
* - depth of the ring.
|
||||
* - base of the buffer, where the elements are stored.
|
||||
* - count of number of free slots in the ring
|
||||
*
|
||||
* Implementation Notes:
|
||||
* - When BCM_RING_DEBUG is enabled, need explicit bcm_ring_init().
|
||||
* - BCM_RING_EMPTY and BCM_RING_FULL are (-1)
|
||||
*
|
||||
* +----------------------------------------------------------------------------
|
||||
*
|
||||
* Usage Notes:
|
||||
* An application may incarnate a ring of some fixed sized elements, by defining
|
||||
* - a ring data buffer to store the ring elements.
|
||||
* - depth of the ring (max number of elements managed by ring context).
|
||||
* Preferrably, depth may be represented as a constant.
|
||||
* - width of a ring element: to be used in pointer arithmetic with the ring's
|
||||
* data buffer base and an index to fetch the ring element.
|
||||
*
|
||||
* Use bcm_workq_t to instantiate a pair of workq constructs, one for the
|
||||
* producer and the other for the consumer, both pointing to the same circular
|
||||
* buffer. The producer may operate on it's own local workq and flush the write
|
||||
* index to the consumer. Likewise the consumer may use its local workq and
|
||||
* flush the read index to the producer. This way we do not repeatedly access
|
||||
* the peer's context. The two peers may reside on different CPU cores with a
|
||||
* private L1 data cache.
|
||||
* +----------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
* $Id: bcm_ring.h 596126 2015-10-29 19:53:48Z $
|
||||
*
|
||||
* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
|
||||
* vim: set ts=4 noet sw=4 tw=80:
|
||||
*
|
||||
* +----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifdef ____cacheline_aligned
|
||||
#define __ring_aligned ____cacheline_aligned
|
||||
#else
|
||||
#define __ring_aligned
|
||||
#endif
|
||||
|
||||
/* Conditional compile for debug */
|
||||
/* #define BCM_RING_DEBUG */
|
||||
|
||||
#define BCM_RING_EMPTY (-1)
|
||||
#define BCM_RING_FULL (-1)
|
||||
#define BCM_RING_NULL ((bcm_ring_t *)NULL)
|
||||
|
||||
#if defined(BCM_RING_DEBUG)
|
||||
#define RING_ASSERT(exp) ASSERT(exp)
|
||||
#define BCM_RING_IS_VALID(ring) (((ring) != BCM_RING_NULL) && \
|
||||
((ring)->self == (ring)))
|
||||
#else /* ! BCM_RING_DEBUG */
|
||||
#define RING_ASSERT(exp) do {} while (0)
|
||||
#define BCM_RING_IS_VALID(ring) ((ring) != BCM_RING_NULL)
|
||||
#endif /* ! BCM_RING_DEBUG */
|
||||
|
||||
#define BCM_RING_SIZE_IS_VALID(ring_size) ((ring_size) > 0)
|
||||
|
||||
/*
|
||||
* +----------------------------------------------------------------------------
|
||||
* Ring Context
|
||||
* +----------------------------------------------------------------------------
|
||||
*/
|
||||
typedef struct bcm_ring { /* Ring context */
|
||||
#if defined(BCM_RING_DEBUG)
|
||||
struct bcm_ring *self; /* ptr to self for IS VALID test */
|
||||
#endif /* BCM_RING_DEBUG */
|
||||
int write __ring_aligned; /* WRITE index in a circular ring */
|
||||
int read __ring_aligned; /* READ index in a circular ring */
|
||||
} bcm_ring_t;
|
||||
|
||||
|
||||
static INLINE void bcm_ring_init(bcm_ring_t *ring);
|
||||
static INLINE void bcm_ring_copy(bcm_ring_t *to, bcm_ring_t *from);
|
||||
static INLINE bool bcm_ring_is_empty(bcm_ring_t *ring);
|
||||
|
||||
static INLINE int __bcm_ring_next_write(bcm_ring_t *ring, const int ring_size);
|
||||
|
||||
static INLINE bool __bcm_ring_full(bcm_ring_t *ring, int next_write);
|
||||
static INLINE bool bcm_ring_is_full(bcm_ring_t *ring, const int ring_size);
|
||||
|
||||
static INLINE void bcm_ring_prod_done(bcm_ring_t *ring, int write);
|
||||
static INLINE int bcm_ring_prod_pend(bcm_ring_t *ring, int *pend_write,
|
||||
const int ring_size);
|
||||
static INLINE int bcm_ring_prod(bcm_ring_t *ring, const int ring_size);
|
||||
|
||||
static INLINE void bcm_ring_cons_done(bcm_ring_t *ring, int read);
|
||||
static INLINE int bcm_ring_cons_pend(bcm_ring_t *ring, int *pend_read,
|
||||
const int ring_size);
|
||||
static INLINE int bcm_ring_cons(bcm_ring_t *ring, const int ring_size);
|
||||
|
||||
static INLINE void bcm_ring_sync_read(bcm_ring_t *peer, const bcm_ring_t *self);
|
||||
static INLINE void bcm_ring_sync_write(bcm_ring_t *peer, const bcm_ring_t *self);
|
||||
|
||||
static INLINE int bcm_ring_prod_avail(const bcm_ring_t *ring,
|
||||
const int ring_size);
|
||||
static INLINE int bcm_ring_cons_avail(const bcm_ring_t *ring,
|
||||
const int ring_size);
|
||||
static INLINE void bcm_ring_cons_all(bcm_ring_t *ring);
|
||||
|
||||
|
||||
/**
|
||||
* bcm_ring_init - initialize a ring context.
|
||||
* @ring: pointer to a ring context
|
||||
*/
|
||||
static INLINE void
|
||||
bcm_ring_init(bcm_ring_t *ring)
|
||||
{
|
||||
ASSERT(ring != (bcm_ring_t *)NULL);
|
||||
#if defined(BCM_RING_DEBUG)
|
||||
ring->self = ring;
|
||||
#endif /* BCM_RING_DEBUG */
|
||||
ring->write = 0;
|
||||
ring->read = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* bcm_ring_copy - copy construct a ring
|
||||
* @to: pointer to the new ring context
|
||||
* @from: pointer to orig ring context
|
||||
*/
|
||||
static INLINE void
|
||||
bcm_ring_copy(bcm_ring_t *to, bcm_ring_t *from)
|
||||
{
|
||||
bcm_ring_init(to);
|
||||
|
||||
to->write = from->write;
|
||||
to->read = from->read;
|
||||
}
|
||||
|
||||
/**
|
||||
* bcm_ring_is_empty - "Boolean" test whether ring is empty.
|
||||
* @ring: pointer to a ring context
|
||||
*
|
||||
* PS. does not return BCM_RING_EMPTY value.
|
||||
*/
|
||||
static INLINE bool
|
||||
bcm_ring_is_empty(bcm_ring_t *ring)
|
||||
{
|
||||
RING_ASSERT(BCM_RING_IS_VALID(ring));
|
||||
return (ring->read == ring->write);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* __bcm_ring_next_write - determine the index where the next write may occur
|
||||
* (with wrap-around).
|
||||
* @ring: pointer to a ring context
|
||||
* @ring_size: size of the ring
|
||||
*
|
||||
* PRIVATE INTERNAL USE ONLY.
|
||||
*/
|
||||
static INLINE int
|
||||
__bcm_ring_next_write(bcm_ring_t *ring, const int ring_size)
|
||||
{
|
||||
RING_ASSERT(BCM_RING_IS_VALID(ring) && BCM_RING_SIZE_IS_VALID(ring_size));
|
||||
return ((ring->write + 1) % ring_size);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* __bcm_ring_full - support function for ring full test.
|
||||
* @ring: pointer to a ring context
|
||||
* @next_write: next location in ring where an element is to be produced
|
||||
*
|
||||
* PRIVATE INTERNAL USE ONLY.
|
||||
*/
|
||||
static INLINE bool
|
||||
__bcm_ring_full(bcm_ring_t *ring, int next_write)
|
||||
{
|
||||
return (next_write == ring->read);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* bcm_ring_is_full - "Boolean" test whether a ring is full.
|
||||
* @ring: pointer to a ring context
|
||||
* @ring_size: size of the ring
|
||||
*
|
||||
* PS. does not return BCM_RING_FULL value.
|
||||
*/
|
||||
static INLINE bool
|
||||
bcm_ring_is_full(bcm_ring_t *ring, const int ring_size)
|
||||
{
|
||||
int next_write;
|
||||
RING_ASSERT(BCM_RING_IS_VALID(ring) && BCM_RING_SIZE_IS_VALID(ring_size));
|
||||
next_write = __bcm_ring_next_write(ring, ring_size);
|
||||
return __bcm_ring_full(ring, next_write);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* bcm_ring_prod_done - commit a previously pending index where production
|
||||
* was requested.
|
||||
* @ring: pointer to a ring context
|
||||
* @write: index into ring upto where production was done.
|
||||
* +----------------------------------------------------------------------------
|
||||
*/
|
||||
static INLINE void
|
||||
bcm_ring_prod_done(bcm_ring_t *ring, int write)
|
||||
{
|
||||
RING_ASSERT(BCM_RING_IS_VALID(ring));
|
||||
ring->write = write;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* bcm_ring_prod_pend - Fetch in "pend" mode, the index where an element may be
|
||||
* produced.
|
||||
* @ring: pointer to a ring context
|
||||
* @pend_write: next index, after the returned index
|
||||
* @ring_size: size of the ring
|
||||
*/
|
||||
static INLINE int
|
||||
bcm_ring_prod_pend(bcm_ring_t *ring, int *pend_write, const int ring_size)
|
||||
{
|
||||
int rtn;
|
||||
RING_ASSERT(BCM_RING_IS_VALID(ring) && BCM_RING_SIZE_IS_VALID(ring_size));
|
||||
*pend_write = __bcm_ring_next_write(ring, ring_size);
|
||||
if (__bcm_ring_full(ring, *pend_write)) {
|
||||
*pend_write = BCM_RING_FULL;
|
||||
rtn = BCM_RING_FULL;
|
||||
} else {
|
||||
/* production is not committed, caller needs to explicitly commit */
|
||||
rtn = ring->write;
|
||||
}
|
||||
return rtn;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* bcm_ring_prod - Fetch and "commit" the next index where a ring element may
|
||||
* be produced.
|
||||
* @ring: pointer to a ring context
|
||||
* @ring_size: size of the ring
|
||||
*/
|
||||
static INLINE int
|
||||
bcm_ring_prod(bcm_ring_t *ring, const int ring_size)
|
||||
{
|
||||
int next_write, prod_write;
|
||||
RING_ASSERT(BCM_RING_IS_VALID(ring) && BCM_RING_SIZE_IS_VALID(ring_size));
|
||||
|
||||
next_write = __bcm_ring_next_write(ring, ring_size);
|
||||
if (__bcm_ring_full(ring, next_write)) {
|
||||
prod_write = BCM_RING_FULL;
|
||||
} else {
|
||||
prod_write = ring->write;
|
||||
bcm_ring_prod_done(ring, next_write); /* "commit" production */
|
||||
}
|
||||
return prod_write;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* bcm_ring_cons_done - commit a previously pending read
|
||||
* @ring: pointer to a ring context
|
||||
* @read: index upto which elements have been consumed.
|
||||
*/
|
||||
static INLINE void
|
||||
bcm_ring_cons_done(bcm_ring_t *ring, int read)
|
||||
{
|
||||
RING_ASSERT(BCM_RING_IS_VALID(ring));
|
||||
ring->read = read;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* bcm_ring_cons_pend - fetch in "pend" mode, the next index where a ring
|
||||
* element may be consumed.
|
||||
* @ring: pointer to a ring context
|
||||
* @pend_read: index into ring upto which elements may be consumed.
|
||||
* @ring_size: size of the ring
|
||||
*/
|
||||
static INLINE int
|
||||
bcm_ring_cons_pend(bcm_ring_t *ring, int *pend_read, const int ring_size)
|
||||
{
|
||||
int rtn;
|
||||
RING_ASSERT(BCM_RING_IS_VALID(ring) && BCM_RING_SIZE_IS_VALID(ring_size));
|
||||
if (bcm_ring_is_empty(ring)) {
|
||||
*pend_read = BCM_RING_EMPTY;
|
||||
rtn = BCM_RING_EMPTY;
|
||||
} else {
|
||||
*pend_read = (ring->read + 1) % ring_size;
|
||||
/* production is not committed, caller needs to explicitly commit */
|
||||
rtn = ring->read;
|
||||
}
|
||||
return rtn;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* bcm_ring_cons - fetch and "commit" the next index where a ring element may
|
||||
* be consumed.
|
||||
* @ring: pointer to a ring context
|
||||
* @ring_size: size of the ring
|
||||
*/
|
||||
static INLINE int
|
||||
bcm_ring_cons(bcm_ring_t *ring, const int ring_size)
|
||||
{
|
||||
int cons_read;
|
||||
RING_ASSERT(BCM_RING_IS_VALID(ring) && BCM_RING_SIZE_IS_VALID(ring_size));
|
||||
if (bcm_ring_is_empty(ring)) {
|
||||
cons_read = BCM_RING_EMPTY;
|
||||
} else {
|
||||
cons_read = ring->read;
|
||||
ring->read = (ring->read + 1) % ring_size; /* read is committed */
|
||||
}
|
||||
return cons_read;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* bcm_ring_sync_read - on consumption, update peer's read index.
|
||||
* @peer: pointer to peer's producer ring context
|
||||
* @self: pointer to consumer's ring context
|
||||
*/
|
||||
static INLINE void
|
||||
bcm_ring_sync_read(bcm_ring_t *peer, const bcm_ring_t *self)
|
||||
{
|
||||
RING_ASSERT(BCM_RING_IS_VALID(peer));
|
||||
RING_ASSERT(BCM_RING_IS_VALID(self));
|
||||
peer->read = self->read; /* flush read update to peer producer */
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* bcm_ring_sync_write - on consumption, update peer's write index.
|
||||
* @peer: pointer to peer's consumer ring context
|
||||
* @self: pointer to producer's ring context
|
||||
*/
|
||||
static INLINE void
|
||||
bcm_ring_sync_write(bcm_ring_t *peer, const bcm_ring_t *self)
|
||||
{
|
||||
RING_ASSERT(BCM_RING_IS_VALID(peer));
|
||||
RING_ASSERT(BCM_RING_IS_VALID(self));
|
||||
peer->write = self->write; /* flush write update to peer consumer */
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* bcm_ring_prod_avail - fetch total number of available empty slots in the
|
||||
* ring for production.
|
||||
* @ring: pointer to a ring context
|
||||
* @ring_size: size of the ring
|
||||
*/
|
||||
static INLINE int
|
||||
bcm_ring_prod_avail(const bcm_ring_t *ring, const int ring_size)
|
||||
{
|
||||
int prod_avail;
|
||||
RING_ASSERT(BCM_RING_IS_VALID(ring) && BCM_RING_SIZE_IS_VALID(ring_size));
|
||||
if (ring->write >= ring->read) {
|
||||
prod_avail = (ring_size - (ring->write - ring->read) - 1);
|
||||
} else {
|
||||
prod_avail = (ring->read - (ring->write + 1));
|
||||
}
|
||||
ASSERT(prod_avail < ring_size);
|
||||
return prod_avail;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* bcm_ring_cons_avail - fetch total number of available elements for consumption.
|
||||
* @ring: pointer to a ring context
|
||||
* @ring_size: size of the ring
|
||||
*/
|
||||
static INLINE int
|
||||
bcm_ring_cons_avail(const bcm_ring_t *ring, const int ring_size)
|
||||
{
|
||||
int cons_avail;
|
||||
RING_ASSERT(BCM_RING_IS_VALID(ring) && BCM_RING_SIZE_IS_VALID(ring_size));
|
||||
if (ring->read == ring->write) {
|
||||
cons_avail = 0;
|
||||
} else if (ring->read > ring->write) {
|
||||
cons_avail = ((ring_size - ring->read) + ring->write);
|
||||
} else {
|
||||
cons_avail = ring->write - ring->read;
|
||||
}
|
||||
ASSERT(cons_avail < ring_size);
|
||||
return cons_avail;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* bcm_ring_cons_all - set ring in state where all elements are consumed.
|
||||
* @ring: pointer to a ring context
|
||||
*/
|
||||
static INLINE void
|
||||
bcm_ring_cons_all(bcm_ring_t *ring)
|
||||
{
|
||||
ring->read = ring->write;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Work Queue
|
||||
* A work Queue is composed of a ring of work items, of a specified depth.
|
||||
* It HAS-A bcm_ring object, comprising of a RD and WR offset, to implement a
|
||||
* producer/consumer circular ring.
|
||||
*/
|
||||
|
||||
struct bcm_workq {
|
||||
bcm_ring_t ring; /* Ring context abstraction */
|
||||
struct bcm_workq *peer; /* Peer workq context */
|
||||
void *buffer; /* Buffer storage for work items in workQ */
|
||||
int ring_size; /* Depth of workQ */
|
||||
} __ring_aligned;
|
||||
|
||||
typedef struct bcm_workq bcm_workq_t;
|
||||
|
||||
|
||||
/* #define BCM_WORKQ_DEBUG */
|
||||
#if defined(BCM_WORKQ_DEBUG)
|
||||
#define WORKQ_ASSERT(exp) ASSERT(exp)
|
||||
#else /* ! BCM_WORKQ_DEBUG */
|
||||
#define WORKQ_ASSERT(exp) do {} while (0)
|
||||
#endif /* ! BCM_WORKQ_DEBUG */
|
||||
|
||||
#define WORKQ_AUDIT(workq) \
|
||||
WORKQ_ASSERT((workq) != BCM_WORKQ_NULL); \
|
||||
WORKQ_ASSERT(WORKQ_PEER(workq) != BCM_WORKQ_NULL); \
|
||||
WORKQ_ASSERT((workq)->buffer == WORKQ_PEER(workq)->buffer); \
|
||||
WORKQ_ASSERT((workq)->ring_size == WORKQ_PEER(workq)->ring_size);
|
||||
|
||||
#define BCM_WORKQ_NULL ((bcm_workq_t *)NULL)
|
||||
|
||||
#define WORKQ_PEER(workq) ((workq)->peer)
|
||||
#define WORKQ_RING(workq) (&((workq)->ring))
|
||||
#define WORKQ_PEER_RING(workq) (&((workq)->peer->ring))
|
||||
|
||||
#define WORKQ_ELEMENT(__elem_type, __workq, __index) ({ \
|
||||
WORKQ_ASSERT((__workq) != BCM_WORKQ_NULL); \
|
||||
WORKQ_ASSERT((__index) < ((__workq)->ring_size)); \
|
||||
((__elem_type *)((__workq)->buffer)) + (__index); \
|
||||
})
|
||||
|
||||
|
||||
static INLINE void bcm_workq_init(bcm_workq_t *workq, bcm_workq_t *workq_peer,
|
||||
void *buffer, int ring_size);
|
||||
|
||||
static INLINE bool bcm_workq_is_empty(bcm_workq_t *workq_prod);
|
||||
|
||||
static INLINE void bcm_workq_prod_sync(bcm_workq_t *workq_prod);
|
||||
static INLINE void bcm_workq_cons_sync(bcm_workq_t *workq_cons);
|
||||
|
||||
static INLINE void bcm_workq_prod_refresh(bcm_workq_t *workq_prod);
|
||||
static INLINE void bcm_workq_cons_refresh(bcm_workq_t *workq_cons);
|
||||
|
||||
/**
|
||||
* bcm_workq_init - initialize a workq
|
||||
* @workq: pointer to a workq context
|
||||
* @buffer: pointer to a pre-allocated circular buffer to serve as a ring
|
||||
* @ring_size: size of the ring in terms of max number of elements.
|
||||
*/
|
||||
static INLINE void
|
||||
bcm_workq_init(bcm_workq_t *workq, bcm_workq_t *workq_peer,
|
||||
void *buffer, int ring_size)
|
||||
{
|
||||
ASSERT(workq != BCM_WORKQ_NULL);
|
||||
ASSERT(workq_peer != BCM_WORKQ_NULL);
|
||||
ASSERT(buffer != NULL);
|
||||
ASSERT(ring_size > 0);
|
||||
|
||||
WORKQ_PEER(workq) = workq_peer;
|
||||
WORKQ_PEER(workq_peer) = workq;
|
||||
|
||||
bcm_ring_init(WORKQ_RING(workq));
|
||||
bcm_ring_init(WORKQ_RING(workq_peer));
|
||||
|
||||
workq->buffer = workq_peer->buffer = buffer;
|
||||
workq->ring_size = workq_peer->ring_size = ring_size;
|
||||
}
|
||||
|
||||
/**
|
||||
* bcm_workq_empty - test whether there is work
|
||||
* @workq_prod: producer's workq
|
||||
*/
|
||||
static INLINE bool
|
||||
bcm_workq_is_empty(bcm_workq_t *workq_prod)
|
||||
{
|
||||
return bcm_ring_is_empty(WORKQ_RING(workq_prod));
|
||||
}
|
||||
|
||||
/**
|
||||
* bcm_workq_prod_sync - Commit the producer write index to peer workq's ring
|
||||
* @workq_prod: producer's workq whose write index must be synced to peer
|
||||
*/
|
||||
static INLINE void
|
||||
bcm_workq_prod_sync(bcm_workq_t *workq_prod)
|
||||
{
|
||||
WORKQ_AUDIT(workq_prod);
|
||||
|
||||
/* cons::write <--- prod::write */
|
||||
bcm_ring_sync_write(WORKQ_PEER_RING(workq_prod), WORKQ_RING(workq_prod));
|
||||
}
|
||||
|
||||
/**
|
||||
* bcm_workq_cons_sync - Commit the consumer read index to the peer workq's ring
|
||||
* @workq_cons: consumer's workq whose read index must be synced to peer
|
||||
*/
|
||||
static INLINE void
|
||||
bcm_workq_cons_sync(bcm_workq_t *workq_cons)
|
||||
{
|
||||
WORKQ_AUDIT(workq_cons);
|
||||
|
||||
/* prod::read <--- cons::read */
|
||||
bcm_ring_sync_read(WORKQ_PEER_RING(workq_cons), WORKQ_RING(workq_cons));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* bcm_workq_prod_refresh - Fetch the updated consumer's read index
|
||||
* @workq_prod: producer's workq whose read index must be refreshed from peer
|
||||
*/
|
||||
static INLINE void
|
||||
bcm_workq_prod_refresh(bcm_workq_t *workq_prod)
|
||||
{
|
||||
WORKQ_AUDIT(workq_prod);
|
||||
|
||||
/* prod::read <--- cons::read */
|
||||
bcm_ring_sync_read(WORKQ_RING(workq_prod), WORKQ_PEER_RING(workq_prod));
|
||||
}
|
||||
|
||||
/**
|
||||
* bcm_workq_cons_refresh - Fetch the updated producer's write index
|
||||
* @workq_cons: consumer's workq whose write index must be refreshed from peer
|
||||
*/
|
||||
static INLINE void
|
||||
bcm_workq_cons_refresh(bcm_workq_t *workq_cons)
|
||||
{
|
||||
WORKQ_AUDIT(workq_cons);
|
||||
|
||||
/* cons::write <--- prod::write */
|
||||
bcm_ring_sync_write(WORKQ_RING(workq_cons), WORKQ_PEER_RING(workq_cons));
|
||||
}
|
||||
|
||||
|
||||
#endif /* ! __bcm_ring_h_included__ */
|
|
@ -0,0 +1,135 @@
|
|||
/*
|
||||
* CDC network driver ioctl/indication encoding
|
||||
* Broadcom 802.11abg Networking Device Driver
|
||||
*
|
||||
* Definitions subject to change without notice.
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: bcmcdc.h 676811 2016-12-24 20:48:46Z $
|
||||
*/
|
||||
#ifndef _bcmcdc_h_
|
||||
#define _bcmcdc_h_
|
||||
#include <ethernet.h>
|
||||
|
||||
typedef struct cdc_ioctl {
|
||||
uint32 cmd; /* ioctl command value */
|
||||
uint32 len; /* lower 16: output buflen; upper 16: input buflen (excludes header) */
|
||||
uint32 flags; /* flag defns given below */
|
||||
uint32 status; /* status code returned from the device */
|
||||
} cdc_ioctl_t;
|
||||
|
||||
/* Max valid buffer size that can be sent to the dongle */
|
||||
#define CDC_MAX_MSG_SIZE ETHER_MAX_LEN
|
||||
|
||||
/* len field is divided into input and output buffer lengths */
|
||||
#define CDCL_IOC_OUTLEN_MASK 0x0000FFFF /* maximum or expected response length, */
|
||||
/* excluding IOCTL header */
|
||||
#define CDCL_IOC_OUTLEN_SHIFT 0
|
||||
#define CDCL_IOC_INLEN_MASK 0xFFFF0000 /* input buffer length, excluding IOCTL header */
|
||||
#define CDCL_IOC_INLEN_SHIFT 16
|
||||
|
||||
/* CDC flag definitions */
|
||||
#define CDCF_IOC_ERROR 0x01 /* 0=success, 1=ioctl cmd failed */
|
||||
#define CDCF_IOC_SET 0x02 /* 0=get, 1=set cmd */
|
||||
#define CDCF_IOC_OVL_IDX_MASK 0x3c /* overlay region index mask */
|
||||
#define CDCF_IOC_OVL_RSV 0x40 /* 1=reserve this overlay region */
|
||||
#define CDCF_IOC_OVL 0x80 /* 1=this ioctl corresponds to an overlay */
|
||||
#define CDCF_IOC_ACTION_MASK 0xfe /* SET/GET, OVL_IDX, OVL_RSV, OVL mask */
|
||||
#define CDCF_IOC_ACTION_SHIFT 1 /* SET/GET, OVL_IDX, OVL_RSV, OVL shift */
|
||||
#define CDCF_IOC_IF_MASK 0xF000 /* I/F index */
|
||||
#define CDCF_IOC_IF_SHIFT 12
|
||||
#define CDCF_IOC_ID_MASK 0xFFFF0000 /* used to uniquely id an ioctl req/resp pairing */
|
||||
#define CDCF_IOC_ID_SHIFT 16 /* # of bits of shift for ID Mask */
|
||||
|
||||
#define CDC_IOC_IF_IDX(flags) (((flags) & CDCF_IOC_IF_MASK) >> CDCF_IOC_IF_SHIFT)
|
||||
#define CDC_IOC_ID(flags) (((flags) & CDCF_IOC_ID_MASK) >> CDCF_IOC_ID_SHIFT)
|
||||
|
||||
#define CDC_GET_IF_IDX(hdr) \
|
||||
((int)((((hdr)->flags) & CDCF_IOC_IF_MASK) >> CDCF_IOC_IF_SHIFT))
|
||||
#define CDC_SET_IF_IDX(hdr, idx) \
|
||||
((hdr)->flags = (((hdr)->flags & ~CDCF_IOC_IF_MASK) | ((idx) << CDCF_IOC_IF_SHIFT)))
|
||||
|
||||
/*
|
||||
* BDC header
|
||||
*
|
||||
* The BDC header is used on data packets to convey priority across USB.
|
||||
*/
|
||||
|
||||
struct bdc_header {
|
||||
uint8 flags; /* Flags */
|
||||
uint8 priority; /* 802.1d Priority 0:2 bits, 4:7 USB flow control info */
|
||||
uint8 flags2;
|
||||
uint8 dataOffset; /* Offset from end of BDC header to packet data, in
|
||||
* 4-byte words. Leaves room for optional headers.
|
||||
*/
|
||||
};
|
||||
|
||||
#define BDC_HEADER_LEN 4
|
||||
|
||||
/* flags field bitmap */
|
||||
#define BDC_FLAG_80211_PKT 0x01 /* Packet is in 802.11 format (dongle -> host) */
|
||||
#define BDC_FLAG_SUM_GOOD 0x04 /* Dongle has verified good RX checksums */
|
||||
#define BDC_FLAG_SUM_NEEDED 0x08 /* Dongle needs to do TX checksums: host->device */
|
||||
#define BDC_FLAG_EVENT_MSG 0x08 /* Payload contains an event msg: device->host */
|
||||
#define BDC_FLAG_VER_MASK 0xf0 /* Protocol version mask */
|
||||
#define BDC_FLAG_VER_SHIFT 4 /* Protocol version shift */
|
||||
|
||||
/* priority field bitmap */
|
||||
#define BDC_PRIORITY_MASK 0x07
|
||||
#define BDC_PRIORITY_FC_MASK 0xf0 /* flow control info mask */
|
||||
#define BDC_PRIORITY_FC_SHIFT 4 /* flow control info shift */
|
||||
|
||||
/* flags2 field bitmap */
|
||||
#define BDC_FLAG2_IF_MASK 0x0f /* interface index (host <-> dongle) */
|
||||
#define BDC_FLAG2_IF_SHIFT 0
|
||||
#define BDC_FLAG2_FC_FLAG 0x10 /* flag to indicate if pkt contains */
|
||||
/* FLOW CONTROL info only */
|
||||
|
||||
/* version numbers */
|
||||
#define BDC_PROTO_VER_1 1 /* Old Protocol version */
|
||||
#define BDC_PROTO_VER 2 /* Protocol version */
|
||||
|
||||
/* flags2.if field access macros */
|
||||
#define BDC_GET_IF_IDX(hdr) \
|
||||
((int)((((hdr)->flags2) & BDC_FLAG2_IF_MASK) >> BDC_FLAG2_IF_SHIFT))
|
||||
#define BDC_SET_IF_IDX(hdr, idx) \
|
||||
((hdr)->flags2 = (((hdr)->flags2 & ~BDC_FLAG2_IF_MASK) | ((idx) << BDC_FLAG2_IF_SHIFT)))
|
||||
|
||||
#define BDC_FLAG2_PAD_MASK 0xf0
|
||||
#define BDC_FLAG_PAD_MASK 0x03
|
||||
#define BDC_FLAG2_PAD_SHIFT 2
|
||||
#define BDC_FLAG_PAD_SHIFT 0
|
||||
#define BDC_FLAG2_PAD_IDX 0x3c
|
||||
#define BDC_FLAG_PAD_IDX 0x03
|
||||
#define BDC_GET_PAD_LEN(hdr) \
|
||||
((int)(((((hdr)->flags2) & BDC_FLAG2_PAD_MASK) >> BDC_FLAG2_PAD_SHIFT) | \
|
||||
((((hdr)->flags) & BDC_FLAG_PAD_MASK) >> BDC_FLAG_PAD_SHIFT)))
|
||||
#define BDC_SET_PAD_LEN(hdr, idx) \
|
||||
((hdr)->flags2 = (((hdr)->flags2 & ~BDC_FLAG2_PAD_MASK) | \
|
||||
(((idx) & BDC_FLAG2_PAD_IDX) << BDC_FLAG2_PAD_SHIFT))); \
|
||||
((hdr)->flags = (((hdr)->flags & ~BDC_FLAG_PAD_MASK) | \
|
||||
(((idx) & BDC_FLAG_PAD_IDX) << BDC_FLAG_PAD_SHIFT)))
|
||||
|
||||
#endif /* _bcmcdc_h_ */
|
|
@ -0,0 +1,462 @@
|
|||
/*
|
||||
* Misc system wide definitions
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: bcmdefs.h 657791 2016-09-02 15:14:42Z $
|
||||
*/
|
||||
|
||||
#ifndef _bcmdefs_h_
|
||||
#define _bcmdefs_h_
|
||||
|
||||
/*
|
||||
* One doesn't need to include this file explicitly, gets included automatically if
|
||||
* typedefs.h is included.
|
||||
*/
|
||||
|
||||
/* Use BCM_REFERENCE to suppress warnings about intentionally-unused function
|
||||
* arguments or local variables.
|
||||
*/
|
||||
#define BCM_REFERENCE(data) ((void)(data))
|
||||
|
||||
/* Allow for suppressing unused variable warnings. */
|
||||
#ifdef __GNUC__
|
||||
#define UNUSED_VAR __attribute__ ((unused))
|
||||
#else
|
||||
#define UNUSED_VAR
|
||||
#endif
|
||||
|
||||
/* Compile-time assert can be used in place of ASSERT if the expression evaluates
|
||||
* to a constant at compile time.
|
||||
*/
|
||||
#define STATIC_ASSERT(expr) { \
|
||||
/* Make sure the expression is constant. */ \
|
||||
typedef enum { _STATIC_ASSERT_NOT_CONSTANT = (expr) } _static_assert_e UNUSED_VAR; \
|
||||
/* Make sure the expression is true. */ \
|
||||
typedef char STATIC_ASSERT_FAIL[(expr) ? 1 : -1] UNUSED_VAR; \
|
||||
}
|
||||
|
||||
/* Reclaiming text and data :
|
||||
* The following macros specify special linker sections that can be reclaimed
|
||||
* after a system is considered 'up'.
|
||||
* BCMATTACHFN is also used for detach functions (it's not worth having a BCMDETACHFN,
|
||||
* as in most cases, the attach function calls the detach function to clean up on error).
|
||||
*/
|
||||
#if defined(BCM_RECLAIM)
|
||||
|
||||
extern bool bcm_reclaimed;
|
||||
extern bool bcm_attach_part_reclaimed;
|
||||
extern bool bcm_preattach_part_reclaimed;
|
||||
|
||||
#if defined(BCM_RECLAIM_ATTACH_FN_DATA)
|
||||
#define _data __attribute__ ((__section__ (".dataini2." #_data))) _data
|
||||
#define _fn __attribute__ ((__section__ (".textini2." #_fn), noinline)) _fn
|
||||
|
||||
/* Relocate attach symbols to save-restore region to increase pre-reclaim heap size. */
|
||||
#define BCM_SRM_ATTACH_DATA(_data) __attribute__ ((__section__ (".datasrm." #_data))) _data
|
||||
#define BCM_SRM_ATTACH_FN(_fn) __attribute__ ((__section__ (".textsrm." #_fn), noinline)) _fn
|
||||
|
||||
#ifndef PREATTACH_NORECLAIM
|
||||
#define BCMPREATTACHDATA(_data) __attribute__ ((__section__ (".dataini3." #_data))) _data
|
||||
#define BCMPREATTACHFN(_fn) __attribute__ ((__section__ (".textini3." #_fn), noinline)) _fn
|
||||
#else
|
||||
#define BCMPREATTACHDATA(_data) __attribute__ ((__section__ (".dataini2." #_data))) _data
|
||||
#define BCMPREATTACHFN(_fn) __attribute__ ((__section__ (".textini2." #_fn), noinline)) _fn
|
||||
#endif /* PREATTACH_NORECLAIM */
|
||||
#else /* BCM_RECLAIM_ATTACH_FN_DATA */
|
||||
#define _data _data
|
||||
#define _fn _fn
|
||||
#define BCMPREATTACHDATA(_data) _data
|
||||
#define BCMPREATTACHFN(_fn) _fn
|
||||
#endif /* BCM_RECLAIM_ATTACH_FN_DATA */
|
||||
|
||||
#if defined(BCM_RECLAIM_INIT_FN_DATA)
|
||||
#define _data __attribute__ ((__section__ (".dataini1." #_data))) _data
|
||||
#define _fn __attribute__ ((__section__ (".textini1." #_fn), noinline)) _fn
|
||||
#define CONST
|
||||
#else /* BCM_RECLAIM_INIT_FN_DATA */
|
||||
#define _data _data
|
||||
#define _fn _fn
|
||||
#ifndef CONST
|
||||
#define CONST const
|
||||
#endif
|
||||
#endif /* BCM_RECLAIM_INIT_FN_DATA */
|
||||
|
||||
/* Non-manufacture or internal attach function/dat */
|
||||
#define BCMNMIATTACHFN(_fn) _fn
|
||||
#define BCMNMIATTACHDATA(_data) _data
|
||||
|
||||
#ifdef BCMNODOWN
|
||||
#define _fn _fn
|
||||
#else
|
||||
#define _fn _fn
|
||||
#endif
|
||||
|
||||
#else /* BCM_RECLAIM */
|
||||
|
||||
#define bcm_reclaimed 0
|
||||
#define _data _data
|
||||
#define _fn _fn
|
||||
#define BCM_SRM_ATTACH_DATA(_data) _data
|
||||
#define BCM_SRM_ATTACH_FN(_fn) _fn
|
||||
#define BCMPREATTACHDATA(_data) _data
|
||||
#define BCMPREATTACHFN(_fn) _fn
|
||||
#define _data _data
|
||||
#define _fn _fn
|
||||
#define _fn _fn
|
||||
#define BCMNMIATTACHFN(_fn) _fn
|
||||
#define BCMNMIATTACHDATA(_data) _data
|
||||
#define CONST const
|
||||
|
||||
#endif /* BCM_RECLAIM */
|
||||
|
||||
#if !defined STB
|
||||
#undef BCM47XX_CA9
|
||||
#endif /* STB */
|
||||
|
||||
/* BCMFASTPATH Related Macro defines
|
||||
*/
|
||||
#ifndef BCMFASTPATH
|
||||
#if defined(STB)
|
||||
#define BCMFASTPATH __attribute__ ((__section__ (".text.fastpath")))
|
||||
#define BCMFASTPATH_HOST __attribute__ ((__section__ (".text.fastpath_host")))
|
||||
#else
|
||||
#define BCMFASTPATH
|
||||
#define BCMFASTPATH_HOST
|
||||
#endif
|
||||
#endif /* BCMFASTPATH */
|
||||
|
||||
|
||||
/* Use the BCMRAMFN() macro to tag functions in source that must be included in RAM (excluded from
|
||||
* ROM). This should eliminate the need to manually specify these functions in the ROM config file.
|
||||
* It should only be used in special cases where the function must be in RAM for *all* ROM-based
|
||||
* chips.
|
||||
*/
|
||||
#define BCMRAMFN(_fn) _fn
|
||||
|
||||
#define STATIC static
|
||||
|
||||
/* Bus types */
|
||||
#define SI_BUS 0 /* SOC Interconnect */
|
||||
#define PCI_BUS 1 /* PCI target */
|
||||
#define PCMCIA_BUS 2 /* PCMCIA target */
|
||||
#define SDIO_BUS 3 /* SDIO target */
|
||||
#define JTAG_BUS 4 /* JTAG */
|
||||
#define USB_BUS 5 /* USB (does not support R/W REG) */
|
||||
#define SPI_BUS 6 /* gSPI target */
|
||||
#define RPC_BUS 7 /* RPC target */
|
||||
|
||||
/* Allows size optimization for single-bus image */
|
||||
#ifdef BCMBUSTYPE
|
||||
#define BUSTYPE(bus) (BCMBUSTYPE)
|
||||
#else
|
||||
#define BUSTYPE(bus) (bus)
|
||||
#endif
|
||||
|
||||
#ifdef BCMBUSCORETYPE
|
||||
#define BUSCORETYPE(ct) (BCMBUSCORETYPE)
|
||||
#else
|
||||
#define BUSCORETYPE(ct) (ct)
|
||||
#endif
|
||||
|
||||
/* Allows size optimization for single-backplane image */
|
||||
#ifdef BCMCHIPTYPE
|
||||
#define CHIPTYPE(bus) (BCMCHIPTYPE)
|
||||
#else
|
||||
#define CHIPTYPE(bus) (bus)
|
||||
#endif
|
||||
|
||||
|
||||
/* Allows size optimization for SPROM support */
|
||||
#if defined(BCMSPROMBUS)
|
||||
#define SPROMBUS (BCMSPROMBUS)
|
||||
#elif defined(SI_PCMCIA_SROM)
|
||||
#define SPROMBUS (PCMCIA_BUS)
|
||||
#else
|
||||
#define SPROMBUS (PCI_BUS)
|
||||
#endif
|
||||
|
||||
/* Allows size optimization for single-chip image */
|
||||
#ifdef BCMCHIPID
|
||||
#define CHIPID(chip) (BCMCHIPID)
|
||||
#else
|
||||
#define CHIPID(chip) (chip)
|
||||
#endif
|
||||
|
||||
#ifdef BCMCHIPREV
|
||||
#define CHIPREV(rev) (BCMCHIPREV)
|
||||
#else
|
||||
#define CHIPREV(rev) (rev)
|
||||
#endif
|
||||
|
||||
#ifdef BCMPCIEREV
|
||||
#define PCIECOREREV(rev) (BCMPCIEREV)
|
||||
#else
|
||||
#define PCIECOREREV(rev) (rev)
|
||||
#endif
|
||||
|
||||
#ifdef BCMPMUREV
|
||||
#define PMUREV(rev) (BCMPMUREV)
|
||||
#else
|
||||
#define PMUREV(rev) (rev)
|
||||
#endif
|
||||
|
||||
#ifdef BCMCCREV
|
||||
#define CCREV(rev) (BCMCCREV)
|
||||
#else
|
||||
#define CCREV(rev) (rev)
|
||||
#endif
|
||||
|
||||
#ifdef BCMGCIREV
|
||||
#define GCIREV(rev) (BCMGCIREV)
|
||||
#else
|
||||
#define GCIREV(rev) (rev)
|
||||
#endif
|
||||
|
||||
/* Defines for DMA Address Width - Shared between OSL and HNDDMA */
|
||||
#define DMADDR_MASK_32 0x0 /* Address mask for 32-bits */
|
||||
#define DMADDR_MASK_30 0xc0000000 /* Address mask for 30-bits */
|
||||
#define DMADDR_MASK_26 0xFC000000 /* Address maks for 26-bits */
|
||||
#define DMADDR_MASK_0 0xffffffff /* Address mask for 0-bits (hi-part) */
|
||||
|
||||
#define DMADDRWIDTH_26 26 /* 26-bit addressing capability */
|
||||
#define DMADDRWIDTH_30 30 /* 30-bit addressing capability */
|
||||
#define DMADDRWIDTH_32 32 /* 32-bit addressing capability */
|
||||
#define DMADDRWIDTH_63 63 /* 64-bit addressing capability */
|
||||
#define DMADDRWIDTH_64 64 /* 64-bit addressing capability */
|
||||
|
||||
typedef struct {
|
||||
uint32 loaddr;
|
||||
uint32 hiaddr;
|
||||
} dma64addr_t;
|
||||
|
||||
#define PHYSADDR64HI(_pa) ((_pa).hiaddr)
|
||||
#define PHYSADDR64HISET(_pa, _val) \
|
||||
do { \
|
||||
(_pa).hiaddr = (_val); \
|
||||
} while (0)
|
||||
#define PHYSADDR64LO(_pa) ((_pa).loaddr)
|
||||
#define PHYSADDR64LOSET(_pa, _val) \
|
||||
do { \
|
||||
(_pa).loaddr = (_val); \
|
||||
} while (0)
|
||||
|
||||
#ifdef BCMDMA64OSL
|
||||
typedef dma64addr_t dmaaddr_t;
|
||||
#define PHYSADDRHI(_pa) PHYSADDR64HI(_pa)
|
||||
#define PHYSADDRHISET(_pa, _val) PHYSADDR64HISET(_pa, _val)
|
||||
#define PHYSADDRLO(_pa) PHYSADDR64LO(_pa)
|
||||
#define PHYSADDRLOSET(_pa, _val) PHYSADDR64LOSET(_pa, _val)
|
||||
#define PHYSADDRTOULONG(_pa, _ulong) \
|
||||
do { \
|
||||
_ulong = ((unsigned long long)(_pa).hiaddr << 32) | ((_pa).loaddr); \
|
||||
} while (0)
|
||||
|
||||
#else
|
||||
typedef unsigned long dmaaddr_t;
|
||||
#define PHYSADDRHI(_pa) (0)
|
||||
#define PHYSADDRHISET(_pa, _val)
|
||||
#define PHYSADDRLO(_pa) ((_pa))
|
||||
#define PHYSADDRLOSET(_pa, _val) \
|
||||
do { \
|
||||
(_pa) = (_val); \
|
||||
} while (0)
|
||||
#endif /* BCMDMA64OSL */
|
||||
#define PHYSADDRISZERO(_pa) (PHYSADDRLO(_pa) == 0 && PHYSADDRHI(_pa) == 0)
|
||||
|
||||
/* One physical DMA segment */
|
||||
typedef struct {
|
||||
dmaaddr_t addr;
|
||||
uint32 length;
|
||||
} hnddma_seg_t;
|
||||
|
||||
#define MAX_DMA_SEGS 8
|
||||
|
||||
|
||||
typedef struct {
|
||||
void *oshdmah; /* Opaque handle for OSL to store its information */
|
||||
uint origsize; /* Size of the virtual packet */
|
||||
uint nsegs;
|
||||
hnddma_seg_t segs[MAX_DMA_SEGS];
|
||||
} hnddma_seg_map_t;
|
||||
|
||||
|
||||
/* packet headroom necessary to accommodate the largest header in the system, (i.e TXOFF).
|
||||
* By doing, we avoid the need to allocate an extra buffer for the header when bridging to WL.
|
||||
* There is a compile time check in wlc.c which ensure that this value is at least as big
|
||||
* as TXOFF. This value is used in dma_rxfill (hnddma.c).
|
||||
*/
|
||||
|
||||
#if defined(BCM_RPC_NOCOPY) || defined(BCM_RCP_TXNOCOPY)
|
||||
/* add 40 bytes to allow for extra RPC header and info */
|
||||
#define BCMEXTRAHDROOM 260
|
||||
#else /* BCM_RPC_NOCOPY || BCM_RPC_TXNOCOPY */
|
||||
#if defined(STB)
|
||||
#if defined(BCM_GMAC3)
|
||||
#define BCMEXTRAHDROOM 32 /* For FullDongle, no D11 headroom space required. */
|
||||
#else
|
||||
#define BCMEXTRAHDROOM 224
|
||||
#endif /* ! BCM_GMAC3 */
|
||||
#else
|
||||
#define BCMEXTRAHDROOM 204
|
||||
#endif
|
||||
#endif /* BCM_RPC_NOCOPY || BCM_RPC_TXNOCOPY */
|
||||
|
||||
/* Packet alignment for most efficient SDIO (can change based on platform) */
|
||||
#ifndef SDALIGN
|
||||
#define SDALIGN 32
|
||||
#endif
|
||||
|
||||
/* Headroom required for dongle-to-host communication. Packets allocated
|
||||
* locally in the dongle (e.g. for CDC ioctls or RNDIS messages) should
|
||||
* leave this much room in front for low-level message headers which may
|
||||
* be needed to get across the dongle bus to the host. (These messages
|
||||
* don't go over the network, so room for the full WL header above would
|
||||
* be a waste.).
|
||||
*/
|
||||
#define BCMDONGLEHDRSZ 12
|
||||
#define BCMDONGLEPADSZ 16
|
||||
|
||||
#define BCMDONGLEOVERHEAD (BCMDONGLEHDRSZ + BCMDONGLEPADSZ)
|
||||
|
||||
|
||||
#if defined(NO_BCMDBG_ASSERT)
|
||||
# undef BCMDBG_ASSERT
|
||||
# undef BCMASSERT_LOG
|
||||
#endif
|
||||
|
||||
#if defined(BCMASSERT_LOG)
|
||||
#define BCMASSERT_SUPPORT
|
||||
#endif
|
||||
|
||||
/* Macros for doing definition and get/set of bitfields
|
||||
* Usage example, e.g. a three-bit field (bits 4-6):
|
||||
* #define <NAME>_M BITFIELD_MASK(3)
|
||||
* #define <NAME>_S 4
|
||||
* ...
|
||||
* regval = R_REG(osh, ®s->regfoo);
|
||||
* field = GFIELD(regval, <NAME>);
|
||||
* regval = SFIELD(regval, <NAME>, 1);
|
||||
* W_REG(osh, ®s->regfoo, regval);
|
||||
*/
|
||||
#define BITFIELD_MASK(width) \
|
||||
(((unsigned)1 << (width)) - 1)
|
||||
#define GFIELD(val, field) \
|
||||
(((val) >> field ## _S) & field ## _M)
|
||||
#define SFIELD(val, field, bits) \
|
||||
(((val) & (~(field ## _M << field ## _S))) | \
|
||||
((unsigned)(bits) << field ## _S))
|
||||
|
||||
/* define BCMSMALL to remove misc features for memory-constrained environments */
|
||||
#ifdef BCMSMALL
|
||||
#undef BCMSPACE
|
||||
#define bcmspace FALSE /* if (bcmspace) code is discarded */
|
||||
#else
|
||||
#define BCMSPACE
|
||||
#define bcmspace TRUE /* if (bcmspace) code is retained */
|
||||
#endif
|
||||
|
||||
/* Max. nvram variable table size */
|
||||
#ifndef MAXSZ_NVRAM_VARS
|
||||
#ifdef LARGE_NVRAM_MAXSZ
|
||||
#define MAXSZ_NVRAM_VARS LARGE_NVRAM_MAXSZ
|
||||
#else
|
||||
/* SROM12 changes */
|
||||
#define MAXSZ_NVRAM_VARS 6144
|
||||
#endif /* LARGE_NVRAM_MAXSZ */
|
||||
#endif /* !MAXSZ_NVRAM_VARS */
|
||||
|
||||
|
||||
|
||||
/* WL_ENAB_RUNTIME_CHECK may be set based upon the #define below (for ROM builds). It may also
|
||||
* be defined via makefiles (e.g. ROM auto abandon unoptimized compiles).
|
||||
*/
|
||||
|
||||
|
||||
#ifdef BCMLFRAG /* BCMLFRAG support enab macros */
|
||||
extern bool _bcmlfrag;
|
||||
#if defined(WL_ENAB_RUNTIME_CHECK) || !defined(DONGLEBUILD)
|
||||
#define BCMLFRAG_ENAB() (_bcmlfrag)
|
||||
#elif defined(BCMLFRAG_DISABLED)
|
||||
#define BCMLFRAG_ENAB() (0)
|
||||
#else
|
||||
#define BCMLFRAG_ENAB() (1)
|
||||
#endif
|
||||
#else
|
||||
#define BCMLFRAG_ENAB() (0)
|
||||
#endif /* BCMLFRAG_ENAB */
|
||||
|
||||
#ifdef BCMPCIEDEV /* BCMPCIEDEV support enab macros */
|
||||
extern bool _pciedevenab;
|
||||
#if defined(WL_ENAB_RUNTIME_CHECK)
|
||||
#define BCMPCIEDEV_ENAB() (_pciedevenab)
|
||||
#elif defined(BCMPCIEDEV_ENABLED)
|
||||
#define BCMPCIEDEV_ENAB() 1
|
||||
#else
|
||||
#define BCMPCIEDEV_ENAB() 0
|
||||
#endif
|
||||
#else
|
||||
#define BCMPCIEDEV_ENAB() 0
|
||||
#endif /* BCMPCIEDEV */
|
||||
|
||||
#define BCMSDIODEV_ENAB() 0
|
||||
|
||||
/* Max size for reclaimable NVRAM array */
|
||||
#ifdef DL_NVRAM
|
||||
#define NVRAM_ARRAY_MAXSIZE DL_NVRAM
|
||||
#else
|
||||
#define NVRAM_ARRAY_MAXSIZE MAXSZ_NVRAM_VARS
|
||||
#endif /* DL_NVRAM */
|
||||
|
||||
extern uint32 gFWID;
|
||||
|
||||
/* Chip related low power flags (lpflags) */
|
||||
#define LPFLAGS_SI_GLOBAL_DISABLE (1 << 0)
|
||||
#define LPFLAGS_SI_MEM_STDBY_DISABLE (1 << 1)
|
||||
#define LPFLAGS_SI_SFLASH_DISABLE (1 << 2)
|
||||
#define LPFLAGS_SI_BTLDO3P3_DISABLE (1 << 3)
|
||||
#define LPFLAGS_SI_GCI_FORCE_REGCLK_DISABLE (1 << 4)
|
||||
#define LPFLAGS_SI_FORCE_PWM_WHEN_RADIO_ON (1 << 5)
|
||||
#define LPFLAGS_PHY_GLOBAL_DISABLE (1 << 16)
|
||||
#define LPFLAGS_PHY_LP_DISABLE (1 << 17)
|
||||
#define LPFLAGS_PSM_PHY_CTL (1 << 18)
|
||||
|
||||
/* Chip related Cbuck modes */
|
||||
#define PMU_43012_VREG8_DYNAMIC_CBUCK_MODE0 0x00001c03
|
||||
#define PMU_43012_VREG9_DYNAMIC_CBUCK_MODE0 0x00492490
|
||||
#define PMU_43012_VREG8_DYNAMIC_CBUCK_MODE1 0x00001c03
|
||||
#define PMU_43012_VREG9_DYNAMIC_CBUCK_MODE1 0x00490410
|
||||
|
||||
/* Chip related dynamic cbuck mode mask */
|
||||
|
||||
#define PMU_43012_VREG8_DYNAMIC_CBUCK_MODE_MASK 0xFFFFFC00
|
||||
#define PMU_43012_VREG9_DYNAMIC_CBUCK_MODE_MASK 0xFFFFFFFF
|
||||
|
||||
#ifndef PAD
|
||||
#define _PADLINE(line) pad ## line
|
||||
#define _XSTR(line) _PADLINE(line)
|
||||
#define PAD _XSTR(__LINE__)
|
||||
#endif
|
||||
|
||||
#endif /* _bcmdefs_h_ */
|
|
@ -0,0 +1,933 @@
|
|||
/*
|
||||
* Broadcom device-specific manifest constants.
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: bcmdevs.h 625027 2016-03-15 08:20:18Z $
|
||||
*/
|
||||
|
||||
#ifndef _BCMDEVS_H
|
||||
#define _BCMDEVS_H
|
||||
|
||||
/* PCI vendor IDs */
|
||||
#define VENDOR_EPIGRAM 0xfeda
|
||||
#define VENDOR_BROADCOM 0x14e4
|
||||
#define VENDOR_3COM 0x10b7
|
||||
#define VENDOR_NETGEAR 0x1385
|
||||
#define VENDOR_DIAMOND 0x1092
|
||||
#define VENDOR_INTEL 0x8086
|
||||
#define VENDOR_DELL 0x1028
|
||||
#define VENDOR_HP 0x103c
|
||||
#define VENDOR_HP_COMPAQ 0x0e11
|
||||
#define VENDOR_APPLE 0x106b
|
||||
#define VENDOR_SI_IMAGE 0x1095 /* Silicon Image, used by Arasan SDIO Host */
|
||||
#define VENDOR_BUFFALO 0x1154 /* Buffalo vendor id */
|
||||
#define VENDOR_TI 0x104c /* Texas Instruments */
|
||||
#define VENDOR_RICOH 0x1180 /* Ricoh */
|
||||
#define VENDOR_JMICRON 0x197b
|
||||
|
||||
|
||||
/* PCMCIA vendor IDs */
|
||||
#define VENDOR_BROADCOM_PCMCIA 0x02d0
|
||||
|
||||
/* SDIO vendor IDs */
|
||||
#define VENDOR_BROADCOM_SDIO 0x00BF
|
||||
|
||||
/* DONGLE VID/PIDs */
|
||||
#define BCM_DNGL_VID 0x0a5c
|
||||
#define BCM_DNGL_BL_PID_4328 0xbd12
|
||||
#define BCM_DNGL_BL_PID_4322 0xbd13
|
||||
#define BCM_DNGL_BL_PID_4319 0xbd16
|
||||
#define BCM_DNGL_BL_PID_43236 0xbd17
|
||||
#define BCM_DNGL_BL_PID_4332 0xbd18
|
||||
#define BCM_DNGL_BL_PID_4330 0xbd19
|
||||
#define BCM_DNGL_BL_PID_4334 0xbd1a
|
||||
#define BCM_DNGL_BL_PID_43239 0xbd1b
|
||||
#define BCM_DNGL_BL_PID_4324 0xbd1c
|
||||
#define BCM_DNGL_BL_PID_4360 0xbd1d
|
||||
#define BCM_DNGL_BL_PID_43143 0xbd1e
|
||||
#define BCM_DNGL_BL_PID_43242 0xbd1f
|
||||
#define BCM_DNGL_BL_PID_43342 0xbd21
|
||||
#define BCM_DNGL_BL_PID_4335 0xbd20
|
||||
#define BCM_DNGL_BL_PID_43341 0xbd22
|
||||
#define BCM_DNGL_BL_PID_4350 0xbd23
|
||||
#define BCM_DNGL_BL_PID_4345 0xbd24
|
||||
#define BCM_DNGL_BL_PID_4349 0xbd25
|
||||
#define BCM_DNGL_BL_PID_4354 0xbd26
|
||||
#define BCM_DNGL_BL_PID_43569 0xbd27
|
||||
#define BCM_DNGL_BL_PID_43909 0xbd28
|
||||
#define BCM_DNGL_BL_PID_4373 0xbd29
|
||||
|
||||
#define BCM_DNGL_BDC_PID 0x0bdc
|
||||
#define BCM_DNGL_JTAG_PID 0x4a44
|
||||
|
||||
/* HW USB BLOCK [CPULESS USB] PIDs */
|
||||
#define BCM_HWUSB_PID_43239 43239
|
||||
|
||||
/* PCI Device IDs */
|
||||
#ifdef DEPRECATED /* These products have been deprecated */
|
||||
#define BCM4210_DEVICE_ID 0x1072 /* never used */
|
||||
#define BCM4230_DEVICE_ID 0x1086 /* never used */
|
||||
#define BCM4401_ENET_ID 0x170c /* 4401b0 production enet cards */
|
||||
#define BCM3352_DEVICE_ID 0x3352 /* bcm3352 device id */
|
||||
#define BCM3360_DEVICE_ID 0x3360 /* bcm3360 device id */
|
||||
#define BCM4211_DEVICE_ID 0x4211
|
||||
#define BCM4231_DEVICE_ID 0x4231
|
||||
#define BCM4303_D11B_ID 0x4303 /* 4303 802.11b */
|
||||
#define BCM4311_D11G_ID 0x4311 /* 4311 802.11b/g id */
|
||||
#define BCM4311_D11DUAL_ID 0x4312 /* 4311 802.11a/b/g id */
|
||||
#define BCM4311_D11A_ID 0x4313 /* 4311 802.11a id */
|
||||
#define BCM4328_D11DUAL_ID 0x4314 /* 4328/4312 802.11a/g id */
|
||||
#define BCM4328_D11G_ID 0x4315 /* 4328/4312 802.11g id */
|
||||
#define BCM4328_D11A_ID 0x4316 /* 4328/4312 802.11a id */
|
||||
#define BCM4318_D11A_ID 0x431a /* 4318 802.11a id */
|
||||
#define BCM4325_D11DUAL_ID 0x431b /* 4325 802.11a/g id */
|
||||
#define BCM4325_D11G_ID 0x431c /* 4325 802.11g id */
|
||||
#define BCM4325_D11A_ID 0x431d /* 4325 802.11a id */
|
||||
#define BCM4306_UART_ID 0x4322 /* 4306 uart */
|
||||
#define BCM4306_V90_ID 0x4323 /* 4306 v90 codec */
|
||||
#define BCM4306_D11G_ID2 0x4325 /* BCM4306_D11G_ID; INF w/loose binding war */
|
||||
#define BCM4321_D11N_ID 0x4328 /* 4321 802.11n dualband id */
|
||||
#define BCM4321_D11N2G_ID 0x4329 /* 4321 802.11n 2.4Ghz band id */
|
||||
#define BCM4321_D11N5G_ID 0x432a /* 4321 802.11n 5Ghz band id */
|
||||
#define BCM4322_D11N_ID 0x432b /* 4322 802.11n dualband device */
|
||||
#define BCM4322_D11N2G_ID 0x432c /* 4322 802.11n 2.4GHz device */
|
||||
#define BCM4322_D11N5G_ID 0x432d /* 4322 802.11n 5GHz device */
|
||||
#define BCM4329_D11N_ID 0x432e /* 4329 802.11n dualband device */
|
||||
#define BCM4329_D11N2G_ID 0x432f /* 4329 802.11n 2.4G device */
|
||||
#define BCM4329_D11N5G_ID 0x4330 /* 4329 802.11n 5G device */
|
||||
#define BCM4315_D11DUAL_ID 0x4334 /* 4315 802.11a/g id */
|
||||
#define BCM4315_D11G_ID 0x4335 /* 4315 802.11g id */
|
||||
#define BCM4315_D11A_ID 0x4336 /* 4315 802.11a id */
|
||||
#define BCM4319_D11N_ID 0x4337 /* 4319 802.11n dualband device */
|
||||
#define BCM4319_D11N2G_ID 0x4338 /* 4319 802.11n 2.4G device */
|
||||
#define BCM4319_D11N5G_ID 0x4339 /* 4319 802.11n 5G device */
|
||||
#define BCM43231_D11N2G_ID 0x4340 /* 43231 802.11n 2.4GHz device */
|
||||
#define BCM43221_D11N2G_ID 0x4341 /* 43221 802.11n 2.4GHz device */
|
||||
#define BCM43222_D11N_ID 0x4350 /* 43222 802.11n dualband device */
|
||||
#define BCM43222_D11N2G_ID 0x4351 /* 43222 802.11n 2.4GHz device */
|
||||
#define BCM43222_D11N5G_ID 0x4352 /* 43222 802.11n 5GHz device */
|
||||
#define BCM43226_D11N_ID 0x4354 /* 43226 802.11n dualband device */
|
||||
#endif /* DEPRECATED */
|
||||
/* DEPRECATED but used */
|
||||
#define BCM4306_D11G_ID 0x4320 /* 4306 802.11g */
|
||||
#define BCM4306_D11A_ID 0x4321 /* 4306 802.11a */
|
||||
#define BCM4306_D11DUAL_ID 0x4324 /* 4306 dual A+B */
|
||||
#define BCM4318_D11G_ID 0x4318 /* 4318 802.11b/g id */
|
||||
#define BCM4318_D11DUAL_ID 0x4319 /* 4318 802.11a/b/g id */
|
||||
/* DEPRECATED */
|
||||
|
||||
#define BCM53572_D11N2G_ID 0x4329 /* 53572 802.11n 2.4Ghz band id (same as BCM4321) */
|
||||
#define BCM43224_D11N_ID 0x4353 /* 43224 802.11n dualband device */
|
||||
#define BCM43224_D11N_ID_VEN1 0x0576 /* Vendor specific 43224 802.11n db device */
|
||||
#define BCM43236_D11N_ID 0x4346 /* 43236 802.11n dualband device */
|
||||
#define BCM43236_D11N2G_ID 0x4347 /* 43236 802.11n 2.4GHz device */
|
||||
#define BCM43236_D11N5G_ID 0x4348 /* 43236 802.11n 5GHz device */
|
||||
#define BCM43225_D11N2G_ID 0x4357 /* 43225 802.11n 2.4GHz device */
|
||||
#define BCM43421_D11N_ID 0xA99D /* 43421 802.11n dualband device */
|
||||
#define BCM4313_D11N2G_ID 0x4727 /* 4313 802.11n 2.4G device */
|
||||
#define BCM4330_D11N_ID 0x4360 /* 4330 802.11n dualband device */
|
||||
#define BCM4330_D11N2G_ID 0x4361 /* 4330 802.11n 2.4G device */
|
||||
#define BCM4330_D11N5G_ID 0x4362 /* 4330 802.11n 5G device */
|
||||
#define BCM4336_D11N_ID 0x4343 /* 4336 802.11n 2.4GHz device */
|
||||
#define BCM6362_D11N_ID 0x435f /* 6362 802.11n dualband device */
|
||||
#define BCM6362_D11N2G_ID 0x433f /* 6362 802.11n 2.4Ghz band id */
|
||||
#define BCM6362_D11N5G_ID 0x434f /* 6362 802.11n 5Ghz band id */
|
||||
#define BCM4331_D11N_ID 0x4331 /* 4331 802.11n dualband id */
|
||||
#define BCM4331_D11N2G_ID 0x4332 /* 4331 802.11n 2.4Ghz band id */
|
||||
#define BCM4331_D11N5G_ID 0x4333 /* 4331 802.11n 5Ghz band id */
|
||||
#define BCM43237_D11N_ID 0x4355 /* 43237 802.11n dualband device */
|
||||
#define BCM43237_D11N5G_ID 0x4356 /* 43237 802.11n 5GHz device */
|
||||
#define BCM43227_D11N2G_ID 0x4358 /* 43228 802.11n 2.4GHz device */
|
||||
#define BCM43228_D11N_ID 0x4359 /* 43228 802.11n DualBand device */
|
||||
#define BCM43228_D11N5G_ID 0x435a /* 43228 802.11n 5GHz device */
|
||||
#define BCM43362_D11N_ID 0x4363 /* 43362 802.11n 2.4GHz device */
|
||||
#define BCM43239_D11N_ID 0x4370 /* 43239 802.11n dualband device */
|
||||
#define BCM4324_D11N_ID 0x4374 /* 4324 802.11n dualband device */
|
||||
#define BCM43217_D11N2G_ID 0x43a9 /* 43217 802.11n 2.4GHz device */
|
||||
#define BCM43131_D11N2G_ID 0x43aa /* 43131 802.11n 2.4GHz device */
|
||||
#define BCM4314_D11N2G_ID 0x4364 /* 4314 802.11n 2.4G device */
|
||||
#define BCM43142_D11N2G_ID 0x4365 /* 43142 802.11n 2.4G device */
|
||||
#define BCM43143_D11N2G_ID 0x4366 /* 43143 802.11n 2.4G device */
|
||||
#define BCM4334_D11N_ID 0x4380 /* 4334 802.11n dualband device */
|
||||
#define BCM4334_D11N2G_ID 0x4381 /* 4334 802.11n 2.4G device */
|
||||
#define BCM4334_D11N5G_ID 0x4382 /* 4334 802.11n 5G device */
|
||||
#define BCM43342_D11N_ID 0x4383 /* 43342 802.11n dualband device */
|
||||
#define BCM43342_D11N2G_ID 0x4384 /* 43342 802.11n 2.4G device */
|
||||
#define BCM43342_D11N5G_ID 0x4385 /* 43342 802.11n 5G device */
|
||||
#define BCM43341_D11N_ID 0x4386 /* 43341 802.11n dualband device */
|
||||
#define BCM43341_D11N2G_ID 0x4387 /* 43341 802.11n 2.4G device */
|
||||
#define BCM43341_D11N5G_ID 0x4388 /* 43341 802.11n 5G device */
|
||||
#define BCM4360_D11AC_ID 0x43a0
|
||||
#define BCM4360_D11AC2G_ID 0x43a1
|
||||
#define BCM4360_D11AC5G_ID 0x43a2
|
||||
#define BCM4345_D11AC_ID 0x43ab /* 4345 802.11ac dualband device */
|
||||
#define BCM4345_D11AC2G_ID 0x43ac /* 4345 802.11ac 2.4G device */
|
||||
#define BCM4345_D11AC5G_ID 0x43ad /* 4345 802.11ac 5G device */
|
||||
#define BCM43455_D11AC_ID 0x43e3 /* 43455 802.11ac dualband device */
|
||||
#define BCM43455_D11AC2G_ID 0x43e4 /* 43455 802.11ac 2.4G device */
|
||||
#define BCM43455_D11AC5G_ID 0x43e5 /* 43455 802.11ac 5G device */
|
||||
#define BCM4335_D11AC_ID 0x43ae
|
||||
#define BCM4335_D11AC2G_ID 0x43af
|
||||
#define BCM4335_D11AC5G_ID 0x43b0
|
||||
#define BCM4352_D11AC_ID 0x43b1 /* 4352 802.11ac dualband device */
|
||||
#define BCM4352_D11AC2G_ID 0x43b2 /* 4352 802.11ac 2.4G device */
|
||||
#define BCM4352_D11AC5G_ID 0x43b3 /* 4352 802.11ac 5G device */
|
||||
#define BCM43602_D11AC_ID 0x43ba /* ac dualband PCI devid SPROM programmed */
|
||||
#define BCM43602_D11AC2G_ID 0x43bb /* 43602 802.11ac 2.4G device */
|
||||
#define BCM43602_D11AC5G_ID 0x43bc /* 43602 802.11ac 5G device */
|
||||
#define BCM4349_D11AC_ID 0x4349 /* 4349 802.11ac dualband device */
|
||||
#define BCM4349_D11AC2G_ID 0x43dd /* 4349 802.11ac 2.4G device */
|
||||
#define BCM4349_D11AC5G_ID 0x43de /* 4349 802.11ac 5G device */
|
||||
#define BCM53573_D11AC_ID 0x43b4 /* 53573 802.11ac dualband device */
|
||||
#define BCM53573_D11AC2G_ID 0x43b5 /* 53573 802.11ac 2.4G device */
|
||||
#define BCM53573_D11AC5G_ID 0x43b6 /* 53573 802.11ac 5G device */
|
||||
#define BCM47189_D11AC_ID 0x43c6 /* 47189 802.11ac dualband device */
|
||||
#define BCM47189_D11AC2G_ID 0x43c7 /* 47189 802.11ac 2.4G device */
|
||||
#define BCM47189_D11AC5G_ID 0x43c8 /* 47189 802.11ac 5G device */
|
||||
#define BCM4355_D11AC_ID 0x43dc /* 4355 802.11ac dualband device */
|
||||
#define BCM4355_D11AC2G_ID 0x43fc /* 4355 802.11ac 2.4G device */
|
||||
#define BCM4355_D11AC5G_ID 0x43fd /* 4355 802.11ac 5G device */
|
||||
#define BCM4359_D11AC_ID 0x43ef /* 4359 802.11ac dualband device */
|
||||
#define BCM4359_D11AC2G_ID 0x43fe /* 4359 802.11ac 2.4G device */
|
||||
#define BCM4359_D11AC5G_ID 0x43ff /* 4359 802.11ac 5G device */
|
||||
#define BCM43596_D11AC_ID 0x4415 /* 43596 802.11ac dualband device */
|
||||
#define BCM43596_D11AC2G_ID 0x4416 /* 43596 802.11ac 2.4G device */
|
||||
#define BCM43596_D11AC5G_ID 0x4417 /* 43596 802.11ac 5G device */
|
||||
#define BCM43597_D11AC_ID 0x441c /* 43597 802.11ac dualband device */
|
||||
#define BCM43597_D11AC2G_ID 0x441d /* 43597 802.11ac 2.4G device */
|
||||
#define BCM43597_D11AC5G_ID 0x441e /* 43597 802.11ac 5G device */
|
||||
#define BCM43909_D11AC_ID 0x43d0 /* 43909 802.11ac dualband device */
|
||||
#define BCM43909_D11AC2G_ID 0x43d1 /* 43909 802.11ac 2.4G device */
|
||||
#define BCM43909_D11AC5G_ID 0x43d2 /* 43909 802.11ac 5G device */
|
||||
#define BCM43012_D11N_ID 0xA804 /* 43012 802.11n dualband device */
|
||||
#define BCM43012_D11N2G_ID 0xA805 /* 43012 802.11n 2.4G device */
|
||||
#define BCM43012_D11N5G_ID 0xA806 /* 43012 802.11n 5G device */
|
||||
|
||||
/* PCI Subsystem ID */
|
||||
#define BCM943228HMB_SSID_VEN1 0x0607
|
||||
#define BCM94313HMGBL_SSID_VEN1 0x0608
|
||||
#define BCM94313HMG_SSID_VEN1 0x0609
|
||||
#define BCM943142HM_SSID_VEN1 0x0611
|
||||
|
||||
#define BCM43143_D11N2G_ID 0x4366 /* 43143 802.11n 2.4G device */
|
||||
|
||||
#define BCM43242_D11N_ID 0x4367 /* 43242 802.11n dualband device */
|
||||
#define BCM43242_D11N2G_ID 0x4368 /* 43242 802.11n 2.4G device */
|
||||
#define BCM43242_D11N5G_ID 0x4369 /* 43242 802.11n 5G device */
|
||||
|
||||
#define BCM4350_D11AC_ID 0x43a3
|
||||
#define BCM4350_D11AC2G_ID 0x43a4
|
||||
#define BCM4350_D11AC5G_ID 0x43a5
|
||||
|
||||
#define BCM43556_D11AC_ID 0x43b7
|
||||
#define BCM43556_D11AC2G_ID 0x43b8
|
||||
#define BCM43556_D11AC5G_ID 0x43b9
|
||||
|
||||
#define BCM43558_D11AC_ID 0x43c0
|
||||
#define BCM43558_D11AC2G_ID 0x43c1
|
||||
#define BCM43558_D11AC5G_ID 0x43c2
|
||||
|
||||
#define BCM43566_D11AC_ID 0x43d3
|
||||
#define BCM43566_D11AC2G_ID 0x43d4
|
||||
#define BCM43566_D11AC5G_ID 0x43d5
|
||||
|
||||
#define BCM43568_D11AC_ID 0x43d6
|
||||
#define BCM43568_D11AC2G_ID 0x43d7
|
||||
#define BCM43568_D11AC5G_ID 0x43d8
|
||||
|
||||
#define BCM43569_D11AC_ID 0x43d9
|
||||
#define BCM43569_D11AC2G_ID 0x43da
|
||||
#define BCM43569_D11AC5G_ID 0x43db
|
||||
|
||||
#define BCM43570_D11AC_ID 0x43d9
|
||||
#define BCM43570_D11AC2G_ID 0x43da
|
||||
#define BCM43570_D11AC5G_ID 0x43db
|
||||
|
||||
#define BCM4354_D11AC_ID 0x43df /* 4354 802.11ac dualband device */
|
||||
#define BCM4354_D11AC2G_ID 0x43e0 /* 4354 802.11ac 2.4G device */
|
||||
#define BCM4354_D11AC5G_ID 0x43e1 /* 4354 802.11ac 5G device */
|
||||
#define BCM43430_D11N2G_ID 0x43e2 /* 43430 802.11n 2.4G device */
|
||||
#define BCM43018_D11N2G_ID 0x441b /* 43018 802.11n 2.4G device */
|
||||
|
||||
|
||||
#define BCM4347_D11AC_ID 0x440a /* 4347 802.11ac dualband device */
|
||||
#define BCM4347_D11AC2G_ID 0x440b /* 4347 802.11ac 2.4G device */
|
||||
#define BCM4347_D11AC5G_ID 0x440c /* 4347 802.11ac 5G device */
|
||||
|
||||
#define BCM4361_D11AC_ID 0x441f /* 4361 802.11ac dualband device */
|
||||
#define BCM4361_D11AC2G_ID 0x4420 /* 4361 802.11ac 2.4G device */
|
||||
#define BCM4361_D11AC5G_ID 0x4421 /* 4361 802.11ac 5G device */
|
||||
|
||||
#define BCM4362_D11AX_ID 0x4490 /* 4362 802.11ax dualband device */
|
||||
#define BCM4362_D11AX2G_ID 0x4491 /* 4362 802.11ax 2.4G device */
|
||||
#define BCM4362_D11AX5G_ID 0x4492 /* 4362 802.11ax 5G device */
|
||||
|
||||
#define BCM4364_D11AC_ID 0x4464 /* 4364 802.11ac dualband device */
|
||||
#define BCM4364_D11AC2G_ID 0x446a /* 4364 802.11ac 2.4G device */
|
||||
#define BCM4364_D11AC5G_ID 0x446b /* 4364 802.11ac 5G device */
|
||||
|
||||
#define BCM4365_D11AC_ID 0x43ca
|
||||
#define BCM4365_D11AC2G_ID 0x43cb
|
||||
#define BCM4365_D11AC5G_ID 0x43cc
|
||||
|
||||
#define BCM4366_D11AC_ID 0x43c3
|
||||
#define BCM4366_D11AC2G_ID 0x43c4
|
||||
#define BCM4366_D11AC5G_ID 0x43c5
|
||||
|
||||
#define BCM43349_D11N_ID 0x43e6 /* 43349 802.11n dualband id */
|
||||
#define BCM43349_D11N2G_ID 0x43e7 /* 43349 802.11n 2.4Ghz band id */
|
||||
#define BCM43349_D11N5G_ID 0x43e8 /* 43349 802.11n 5Ghz band id */
|
||||
|
||||
#define BCM4358_D11AC_ID 0x43e9 /* 4358 802.11ac dualband device */
|
||||
#define BCM4358_D11AC2G_ID 0x43ea /* 4358 802.11ac 2.4G device */
|
||||
#define BCM4358_D11AC5G_ID 0x43eb /* 4358 802.11ac 5G device */
|
||||
|
||||
#define BCM4356_D11AC_ID 0x43ec /* 4356 802.11ac dualband device */
|
||||
#define BCM4356_D11AC2G_ID 0x43ed /* 4356 802.11ac 2.4G device */
|
||||
#define BCM4356_D11AC5G_ID 0x43ee /* 4356 802.11ac 5G device */
|
||||
|
||||
#define BCM4371_D11AC_ID 0x440d /* 4371 802.11ac dualband device */
|
||||
#define BCM4371_D11AC2G_ID 0x440e /* 4371 802.11ac 2.4G device */
|
||||
#define BCM4371_D11AC5G_ID 0x440f /* 4371 802.11ac 5G device */
|
||||
#define BCM7271_D11AC_ID 0x4410 /* 7271 802.11ac dualband device */
|
||||
#define BCM7271_D11AC2G_ID 0x4411 /* 7271 802.11ac 2.4G device */
|
||||
#define BCM7271_D11AC5G_ID 0x4412 /* 7271 802.11ac 5G device */
|
||||
|
||||
#define BCM4373_D11AC_ID 0x4418 /* 4373 802.11ac dualband device */
|
||||
#define BCM4373_D11AC2G_ID 0x4419 /* 4373 802.11ac 2.4G device */
|
||||
#define BCM4373_D11AC5G_ID 0x441a /* 4373 802.11ac 5G device */
|
||||
|
||||
#define BCMGPRS_UART_ID 0x4333 /* Uart id used by 4306/gprs card */
|
||||
#define BCMGPRS2_UART_ID 0x4344 /* Uart id used by 4306/gprs card */
|
||||
#define FPGA_JTAGM_ID 0x43f0 /* FPGA jtagm device id */
|
||||
#define BCM_JTAGM_ID 0x43f1 /* BCM jtagm device id */
|
||||
#define SDIOH_FPGA_ID 0x43f2 /* sdio host fpga */
|
||||
#define BCM_SDIOH_ID 0x43f3 /* BCM sdio host id */
|
||||
#define SDIOD_FPGA_ID 0x43f4 /* sdio device fpga */
|
||||
#define SPIH_FPGA_ID 0x43f5 /* PCI SPI Host Controller FPGA */
|
||||
#define BCM_SPIH_ID 0x43f6 /* Synopsis SPI Host Controller */
|
||||
#define MIMO_FPGA_ID 0x43f8 /* FPGA mimo minimacphy device id */
|
||||
#define BCM_JTAGM2_ID 0x43f9 /* BCM alternate jtagm device id */
|
||||
#define SDHCI_FPGA_ID 0x43fa /* Standard SDIO Host Controller FPGA */
|
||||
#define BCM4402_ENET_ID 0x4402 /* 4402 enet */
|
||||
#define BCM4402_V90_ID 0x4403 /* 4402 v90 codec */
|
||||
#define BCM4410_DEVICE_ID 0x4410 /* bcm44xx family pci iline */
|
||||
#define BCM4412_DEVICE_ID 0x4412 /* bcm44xx family pci enet */
|
||||
#define BCM4430_DEVICE_ID 0x4430 /* bcm44xx family cardbus iline */
|
||||
#define BCM4432_DEVICE_ID 0x4432 /* bcm44xx family cardbus enet */
|
||||
#define BCM4704_ENET_ID 0x4706 /* 4704 enet (Use 47XX_ENET_ID instead!) */
|
||||
#define BCM4710_DEVICE_ID 0x4710 /* 4710 primary function 0 */
|
||||
#define BCM47XX_AUDIO_ID 0x4711 /* 47xx audio codec */
|
||||
#define BCM47XX_V90_ID 0x4712 /* 47xx v90 codec */
|
||||
#define BCM47XX_ENET_ID 0x4713 /* 47xx enet */
|
||||
#define BCM47XX_EXT_ID 0x4714 /* 47xx external i/f */
|
||||
#define BCM47XX_GMAC_ID 0x4715 /* 47xx Unimac based GbE */
|
||||
#define BCM47XX_USBH_ID 0x4716 /* 47xx usb host */
|
||||
#define BCM47XX_USBD_ID 0x4717 /* 47xx usb device */
|
||||
#define BCM47XX_IPSEC_ID 0x4718 /* 47xx ipsec */
|
||||
#define BCM47XX_ROBO_ID 0x4719 /* 47xx/53xx roboswitch core */
|
||||
#define BCM47XX_USB20H_ID 0x471a /* 47xx usb 2.0 host */
|
||||
#define BCM47XX_USB20D_ID 0x471b /* 47xx usb 2.0 device */
|
||||
#define BCM47XX_ATA100_ID 0x471d /* 47xx parallel ATA */
|
||||
#define BCM47XX_SATAXOR_ID 0x471e /* 47xx serial ATA & XOR DMA */
|
||||
#define BCM47XX_GIGETH_ID 0x471f /* 47xx GbE (5700) */
|
||||
#ifdef DEPRECATED /* These products have been deprecated */
|
||||
#define BCM4712_MIPS_ID 0x4720 /* 4712 base devid */
|
||||
#define BCM4716_DEVICE_ID 0x4722 /* 4716 base devid */
|
||||
#endif /* DEPRECATED */
|
||||
#define BCM47XX_USB30H_ID 0x472a /* 47xx usb 3.0 host */
|
||||
#define BCM47XX_USB30D_ID 0x472b /* 47xx usb 3.0 device */
|
||||
#define BCM47XX_USBHUB_ID 0x472c /* 47xx usb hub */
|
||||
#define BCM47XX_SMBUS_EMU_ID 0x47fe /* 47xx emulated SMBus device */
|
||||
#define BCM47XX_XOR_EMU_ID 0x47ff /* 47xx emulated XOR engine */
|
||||
#define EPI41210_DEVICE_ID 0xa0fa /* bcm4210 */
|
||||
#define EPI41230_DEVICE_ID 0xa10e /* bcm4230 */
|
||||
#define JINVANI_SDIOH_ID 0x4743 /* Jinvani SDIO Gold Host */
|
||||
#define BCM27XX_SDIOH_ID 0x2702 /* BCM27xx Standard SDIO Host */
|
||||
#define PCIXX21_FLASHMEDIA_ID 0x803b /* TI PCI xx21 Standard Host Controller */
|
||||
#define PCIXX21_SDIOH_ID 0x803c /* TI PCI xx21 Standard Host Controller */
|
||||
#define R5C822_SDIOH_ID 0x0822 /* Ricoh Co Ltd R5C822 SD/SDIO/MMC/MS/MSPro Host */
|
||||
#define JMICRON_SDIOH_ID 0x2381 /* JMicron Standard SDIO Host Controller */
|
||||
|
||||
#define BCM43452_D11AC_ID 0x47ab /* 43452 802.11ac dualband device */
|
||||
#define BCM43452_D11AC2G_ID 0x47ac /* 43452 802.11ac 2.4G device */
|
||||
#define BCM43452_D11AC5G_ID 0x47ad /* 43452 802.11ac 5G device */
|
||||
|
||||
/* Chip IDs */
|
||||
#ifdef DEPRECATED /* These products have been deprecated */
|
||||
#define BCM4306_CHIP_ID 0x4306 /* 4306 chipcommon chipid */
|
||||
#define BCM4311_CHIP_ID 0x4311 /* 4311 PCIe 802.11a/b/g */
|
||||
#define BCM43111_CHIP_ID 43111 /* 43111 chipcommon chipid (OTP chipid) */
|
||||
#define BCM43112_CHIP_ID 43112 /* 43112 chipcommon chipid (OTP chipid) */
|
||||
#define BCM4312_CHIP_ID 0x4312 /* 4312 chipcommon chipid */
|
||||
#define BCM4315_CHIP_ID 0x4315 /* 4315 chip id */
|
||||
#define BCM4318_CHIP_ID 0x4318 /* 4318 chipcommon chipid */
|
||||
#define BCM4319_CHIP_ID 0x4319 /* 4319 chip id */
|
||||
#define BCM4320_CHIP_ID 0x4320 /* 4320 chipcommon chipid */
|
||||
#define BCM4321_CHIP_ID 0x4321 /* 4321 chipcommon chipid */
|
||||
#define BCM4322_CHIP_ID 0x4322 /* 4322 chipcommon chipid */
|
||||
#define BCM43221_CHIP_ID 43221 /* 43221 chipcommon chipid (OTP chipid) */
|
||||
#define BCM43222_CHIP_ID 43222 /* 43222 chipcommon chipid */
|
||||
#define BCM43226_CHIP_ID 43226 /* 43226 chipcommon chipid */
|
||||
#define BCM43231_CHIP_ID 43231 /* 43231 chipcommon chipid (OTP chipid) */
|
||||
#define BCM4342_CHIP_ID 4342 /* 4342 chipcommon chipid (OTP, RBBU) */
|
||||
#define BCM4325_CHIP_ID 0x4325 /* 4325 chip id */
|
||||
#define BCM4328_CHIP_ID 0x4328 /* 4328 chip id */
|
||||
#define BCM4329_CHIP_ID 0x4329 /* 4329 chipcommon chipid */
|
||||
#define BCM4712_CHIP_ID 0x4712 /* 4712 chipcommon chipid */
|
||||
#endif /* DEPRECATED */
|
||||
|
||||
/* DEPRECATED but still referenced in components - start */
|
||||
#define BCM4716_CHIP_ID 0x4716 /* 4716 chipcommon chipid */
|
||||
#define BCM4748_CHIP_ID 0x4748 /* 4716 chipcommon chipid (OTP, RBBU) */
|
||||
#define BCM47162_CHIP_ID 47162 /* 47162 chipcommon chipid */
|
||||
#define BCM5354_CHIP_ID 0x5354 /* 5354 chipcommon chipid */
|
||||
/* DEPRECATED but still referenced in components - end */
|
||||
|
||||
#define BCM43224_CHIP_ID 43224 /* 43224 chipcommon chipid */
|
||||
#define BCM43225_CHIP_ID 43225 /* 43225 chipcommon chipid */
|
||||
#define BCM43227_CHIP_ID 43227 /* 43227 chipcommon chipid */
|
||||
#define BCM43228_CHIP_ID 43228 /* 43228 chipcommon chipid */
|
||||
#define BCM43217_CHIP_ID 43217 /* 43217 chip id (OTP chipid) */
|
||||
#define BCM4313_CHIP_ID 0x4313 /* 4313 chip id */
|
||||
#define BCM43131_CHIP_ID 43131 /* 43131 chip id (OTP chipid) */
|
||||
#define BCM43234_CHIP_ID 43234 /* 43234 chipcommon chipid */
|
||||
#define BCM43235_CHIP_ID 43235 /* 43235 chipcommon chipid */
|
||||
#define BCM43236_CHIP_ID 43236 /* 43236 chipcommon chipid */
|
||||
#define BCM43237_CHIP_ID 43237 /* 43237 chipcommon chipid */
|
||||
#define BCM43238_CHIP_ID 43238 /* 43238 chipcommon chipid */
|
||||
#define BCM43239_CHIP_ID 43239 /* 43239 chipcommon chipid */
|
||||
#define BCM43420_CHIP_ID 43420 /* 43222 chipcommon chipid (OTP, RBBU) */
|
||||
#define BCM43421_CHIP_ID 43421 /* 43224 chipcommon chipid (OTP, RBBU) */
|
||||
#define BCM43428_CHIP_ID 43428 /* 43228 chipcommon chipid (OTP, RBBU) */
|
||||
#define BCM43431_CHIP_ID 43431 /* 4331 chipcommon chipid (OTP, RBBU) */
|
||||
#define BCM43460_CHIP_ID 43460 /* 4360 chipcommon chipid (OTP, RBBU) */
|
||||
#define BCM4331_CHIP_ID 0x4331 /* 4331 chipcommon chipid */
|
||||
#define BCM4336_CHIP_ID 0x4336 /* 4336 chipcommon chipid */
|
||||
#define BCM43362_CHIP_ID 43362 /* 43362 chipcommon chipid */
|
||||
#define BCM4330_CHIP_ID 0x4330 /* 4330 chipcommon chipid */
|
||||
#define BCM6362_CHIP_ID 0x6362 /* 6362 chipcommon chipid */
|
||||
#define BCM4314_CHIP_ID 0x4314 /* 4314 chipcommon chipid */
|
||||
#define BCM43142_CHIP_ID 43142 /* 43142 chipcommon chipid */
|
||||
#define BCM43143_CHIP_ID 43143 /* 43143 chipcommon chipid */
|
||||
#define BCM4324_CHIP_ID 0x4324 /* 4324 chipcommon chipid */
|
||||
#define BCM43242_CHIP_ID 43242 /* 43242 chipcommon chipid */
|
||||
#define BCM43243_CHIP_ID 43243 /* 43243 chipcommon chipid */
|
||||
#define BCM4334_CHIP_ID 0x4334 /* 4334 chipcommon chipid */
|
||||
#define BCM4335_CHIP_ID 0x4335 /* 4335 chipcommon chipid */
|
||||
#define BCM4339_CHIP_ID 0x4339 /* 4339 chipcommon chipid */
|
||||
#define BCM43349_CHIP_ID 43349 /* 43349(0xA955) chipcommon chipid */
|
||||
#define BCM4360_CHIP_ID 0x4360 /* 4360 chipcommon chipid */
|
||||
#define BCM4364_CHIP_ID 0x4364 /* 4364 chipcommon chipid */
|
||||
#define BCM4352_CHIP_ID 0x4352 /* 4352 chipcommon chipid */
|
||||
#define BCM43526_CHIP_ID 0xAA06
|
||||
#define BCM43340_CHIP_ID 43340 /* 43340 chipcommon chipid */
|
||||
#define BCM43341_CHIP_ID 43341 /* 43341 chipcommon chipid */
|
||||
#define BCM43342_CHIP_ID 43342 /* 43342 chipcommon chipid */
|
||||
#define BCM4350_CHIP_ID 0x4350 /* 4350 chipcommon chipid */
|
||||
#define BCM4354_CHIP_ID 0x4354 /* 4354 chipcommon chipid */
|
||||
#define BCM4356_CHIP_ID 0x4356 /* 4356 chipcommon chipid */
|
||||
#define BCM4371_CHIP_ID 0x4371 /* 4371 chipcommon chipid */
|
||||
#define BCM43556_CHIP_ID 0xAA24 /* 43556 chipcommon chipid */
|
||||
#define BCM43558_CHIP_ID 0xAA26 /* 43558 chipcommon chipid */
|
||||
#define BCM43562_CHIP_ID 0xAA2A /* 43562 chipcommon chipid */
|
||||
#define BCM43566_CHIP_ID 0xAA2E /* 43566 chipcommon chipid */
|
||||
#define BCM43567_CHIP_ID 0xAA2F /* 43567 chipcommon chipid */
|
||||
#define BCM43568_CHIP_ID 0xAA30 /* 43568 chipcommon chipid */
|
||||
#define BCM43569_CHIP_ID 0xAA31 /* 43569 chipcommon chipid */
|
||||
#define BCM43570_CHIP_ID 0xAA32 /* 43570 chipcommon chipid */
|
||||
#define BCM4358_CHIP_ID 0x4358 /* 4358 chipcommon chipid */
|
||||
#define BCM4371_CHIP_ID 0x4371 /* 4371 chipcommon chipid */
|
||||
#define BCM43012_CHIP_ID 0xA804 /* 43012 chipcommon chipid */
|
||||
#define BCM4350_CHIP(chipid) ((CHIPID(chipid) == BCM4350_CHIP_ID) || \
|
||||
(CHIPID(chipid) == BCM4354_CHIP_ID) || \
|
||||
(CHIPID(chipid) == BCM43556_CHIP_ID) || \
|
||||
(CHIPID(chipid) == BCM43558_CHIP_ID) || \
|
||||
(CHIPID(chipid) == BCM43566_CHIP_ID) || \
|
||||
(CHIPID(chipid) == BCM43567_CHIP_ID) || \
|
||||
(CHIPID(chipid) == BCM43568_CHIP_ID) || \
|
||||
(CHIPID(chipid) == BCM43569_CHIP_ID) || \
|
||||
(CHIPID(chipid) == BCM43570_CHIP_ID) || \
|
||||
(CHIPID(chipid) == BCM4358_CHIP_ID)) /* 4350 variations */
|
||||
|
||||
#define BCM4345_CHIP_ID 0x4345 /* 4345 chipcommon chipid */
|
||||
#define BCM43454_CHIP_ID 43454 /* 43454 chipcommon chipid */
|
||||
#define BCM43455_CHIP_ID 43455 /* 43455 chipcommon chipid */
|
||||
#define BCM43457_CHIP_ID 43457 /* 43457 chipcommon chipid */
|
||||
#define BCM43458_CHIP_ID 43458 /* 43458 chipcommon chipid */
|
||||
|
||||
#define BCM4345_CHIP(chipid) (CHIPID(chipid) == BCM4345_CHIP_ID || \
|
||||
CHIPID(chipid) == BCM43454_CHIP_ID || \
|
||||
CHIPID(chipid) == BCM43455_CHIP_ID || \
|
||||
CHIPID(chipid) == BCM43457_CHIP_ID || \
|
||||
CHIPID(chipid) == BCM43458_CHIP_ID)
|
||||
|
||||
#define CASE_BCM4345_CHIP case BCM4345_CHIP_ID: /* fallthrough */ \
|
||||
case BCM43454_CHIP_ID: /* fallthrough */ \
|
||||
case BCM43455_CHIP_ID: /* fallthrough */ \
|
||||
case BCM43457_CHIP_ID: /* fallthrough */ \
|
||||
case BCM43458_CHIP_ID
|
||||
|
||||
#define BCM43430_CHIP_ID 43430 /* 43430 chipcommon chipid */
|
||||
#define BCM43018_CHIP_ID 43018 /* 43018 chipcommon chipid */
|
||||
#define BCM4349_CHIP_ID 0x4349 /* 4349 chipcommon chipid */
|
||||
#define BCM4355_CHIP_ID 0x4355 /* 4355 chipcommon chipid */
|
||||
#define BCM4359_CHIP_ID 0x4359 /* 4359 chipcommon chipid */
|
||||
#define BCM4349_CHIP(chipid) ((CHIPID(chipid) == BCM4349_CHIP_ID) || \
|
||||
(CHIPID(chipid) == BCM4355_CHIP_ID) || \
|
||||
(CHIPID(chipid) == BCM4359_CHIP_ID))
|
||||
#define BCM4349_CHIP_GRPID BCM4349_CHIP_ID: \
|
||||
case BCM4355_CHIP_ID: \
|
||||
case BCM4359_CHIP_ID
|
||||
#define BCM43596_CHIP_ID 43596 /* 43596 chipcommon chipid */
|
||||
#define BCM4347_CHIP_ID 0x4347 /* 4347 chipcommon chipid */
|
||||
#define BCM4357_CHIP_ID 0x4357 /* 4357 chipcommon chipid */
|
||||
#define BCM4361_CHIP_ID 0x4361 /* 4361 chipcommon chipid */
|
||||
#define BCM4362_CHIP_ID 0x4362 /* 4362 chipcommon chipid */
|
||||
#define BCM4347_CHIP(chipid) ((CHIPID(chipid) == BCM4347_CHIP_ID) || \
|
||||
(CHIPID(chipid) == BCM4357_CHIP_ID) || \
|
||||
(CHIPID(chipid) == BCM4361_CHIP_ID))
|
||||
#define BCM4347_CHIP_GRPID BCM4347_CHIP_ID: \
|
||||
case BCM4357_CHIP_ID: \
|
||||
case BCM4361_CHIP_ID
|
||||
|
||||
#define BCM4365_CHIP_ID 0x4365 /* 4365 chipcommon chipid */
|
||||
#define BCM4366_CHIP_ID 0x4366 /* 4366 chipcommon chipid */
|
||||
#define BCM4365_CHIP(chipid) ((CHIPID(chipid) == BCM4365_CHIP_ID) || \
|
||||
(CHIPID(chipid) == BCM4366_CHIP_ID))
|
||||
|
||||
|
||||
#define BCM43909_CHIP_ID 0xab85 /* 43909 chipcommon chipid */
|
||||
|
||||
#define BCM43602_CHIP_ID 0xaa52 /* 43602 chipcommon chipid */
|
||||
#define BCM43462_CHIP_ID 0xa9c6 /* 43462 chipcommon chipid */
|
||||
#define BCM43522_CHIP_ID 0xaa02 /* 43522 chipcommon chipid */
|
||||
#define BCM43602_CHIP(chipid) ((CHIPID(chipid) == BCM43602_CHIP_ID) || \
|
||||
(CHIPID(chipid) == BCM43462_CHIP_ID) || \
|
||||
(CHIPID(chipid) == BCM43522_CHIP_ID)) /* 43602 variations */
|
||||
#define BCM43012_CHIP(chipid) (CHIPID(chipid) == BCM43012_CHIP_ID)
|
||||
#define CASE_BCM43602_CHIP case BCM43602_CHIP_ID: /* fallthrough */ \
|
||||
case BCM43462_CHIP_ID: /* fallthrough */ \
|
||||
case BCM43522_CHIP_ID
|
||||
|
||||
#define BCM4402_CHIP_ID 0x4402 /* 4402 chipid */
|
||||
#define BCM4704_CHIP_ID 0x4704 /* 4704 chipcommon chipid */
|
||||
#define BCM4706_CHIP_ID 0x5300 /* 4706 chipcommon chipid */
|
||||
#define BCM4707_CHIP_ID 53010 /* 4707 chipcommon chipid */
|
||||
#define BCM47094_CHIP_ID 53030 /* 47094 chipcommon chipid */
|
||||
#define BCM53018_CHIP_ID 53018 /* 53018 chipcommon chipid */
|
||||
#define BCM4707_CHIP(chipid) (((chipid) == BCM4707_CHIP_ID) || \
|
||||
((chipid) == BCM53018_CHIP_ID) || \
|
||||
((chipid) == BCM47094_CHIP_ID))
|
||||
#define BCM4710_CHIP_ID 0x4710 /* 4710 chipid */
|
||||
#define BCM4749_CHIP_ID 0x4749 /* 5357 chipcommon chipid (OTP, RBBU) */
|
||||
#define BCM4785_CHIP_ID 0x4785 /* 4785 chipcommon chipid */
|
||||
#define BCM5350_CHIP_ID 0x5350 /* 5350 chipcommon chipid */
|
||||
#define BCM5352_CHIP_ID 0x5352 /* 5352 chipcommon chipid */
|
||||
#define BCM5365_CHIP_ID 0x5365 /* 5365 chipcommon chipid */
|
||||
#define BCM5356_CHIP_ID 0x5356 /* 5356 chipcommon chipid */
|
||||
#define BCM5357_CHIP_ID 0x5357 /* 5357 chipcommon chipid */
|
||||
#define BCM53572_CHIP_ID 53572 /* 53572 chipcommon chipid */
|
||||
#define BCM53573_CHIP_ID 53573 /* 53573 chipcommon chipid */
|
||||
#define BCM53574_CHIP_ID 53574 /* 53574 chipcommon chipid */
|
||||
#define BCM53573_CHIP(chipid) ((CHIPID(chipid) == BCM53573_CHIP_ID) || \
|
||||
(CHIPID(chipid) == BCM53574_CHIP_ID))
|
||||
#define BCM53573_CHIP_GRPID BCM53573_CHIP_ID : \
|
||||
case BCM53574_CHIP_ID
|
||||
#define BCM53573_DEVICE(devid) (((devid) == BCM53573_D11AC_ID) || \
|
||||
((devid) == BCM53573_D11AC2G_ID) || \
|
||||
((devid) == BCM53573_D11AC5G_ID) || \
|
||||
((devid) == BCM47189_D11AC_ID) || \
|
||||
((devid) == BCM47189_D11AC2G_ID) || \
|
||||
((devid) == BCM47189_D11AC5G_ID))
|
||||
|
||||
#define BCM7271_CHIP_ID 0x05c9 /* 7271 chipcommon chipid */
|
||||
#define BCM4373_CHIP_ID 0x4373 /* 4373 chipcommon chipid */
|
||||
|
||||
/* Package IDs */
|
||||
#ifdef DEPRECATED /* These products have been deprecated */
|
||||
#define BCM4303_PKG_ID 2 /* 4303 package id */
|
||||
#define BCM4309_PKG_ID 1 /* 4309 package id */
|
||||
#define BCM4712LARGE_PKG_ID 0 /* 340pin 4712 package id */
|
||||
#define BCM4712SMALL_PKG_ID 1 /* 200pin 4712 package id */
|
||||
#define BCM4712MID_PKG_ID 2 /* 225pin 4712 package id */
|
||||
#define BCM4328USBD11G_PKG_ID 2 /* 4328 802.11g USB package id */
|
||||
#define BCM4328USBDUAL_PKG_ID 3 /* 4328 802.11a/g USB package id */
|
||||
#define BCM4328SDIOD11G_PKG_ID 4 /* 4328 802.11g SDIO package id */
|
||||
#define BCM4328SDIODUAL_PKG_ID 5 /* 4328 802.11a/g SDIO package id */
|
||||
#define BCM4329_289PIN_PKG_ID 0 /* 4329 289-pin package id */
|
||||
#define BCM4329_182PIN_PKG_ID 1 /* 4329N 182-pin package id */
|
||||
#define BCM5354E_PKG_ID 1 /* 5354E package id */
|
||||
#define BCM4716_PKG_ID 8 /* 4716 package id */
|
||||
#define BCM4717_PKG_ID 9 /* 4717 package id */
|
||||
#define BCM4718_PKG_ID 10 /* 4718 package id */
|
||||
#endif /* DEPRECATED */
|
||||
#define BCM5356_PKG_NONMODE 1 /* 5356 package without nmode suppport */
|
||||
#define BCM5358U_PKG_ID 8 /* 5358U package id */
|
||||
#define BCM5358_PKG_ID 9 /* 5358 package id */
|
||||
#define BCM47186_PKG_ID 10 /* 47186 package id */
|
||||
#define BCM5357_PKG_ID 11 /* 5357 package id */
|
||||
#define BCM5356U_PKG_ID 12 /* 5356U package id */
|
||||
#define BCM53572_PKG_ID 8 /* 53572 package id */
|
||||
#define BCM5357C0_PKG_ID 8 /* 5357c0 package id (the same as 53572) */
|
||||
#define BCM47188_PKG_ID 9 /* 47188 package id */
|
||||
#define BCM5358C0_PKG_ID 0xa /* 5358c0 package id */
|
||||
#define BCM5356C0_PKG_ID 0xb /* 5356c0 package id */
|
||||
#define BCM4331TT_PKG_ID 8 /* 4331 12x12 package id */
|
||||
#define BCM4331TN_PKG_ID 9 /* 4331 12x9 package id */
|
||||
#define BCM4331TNA0_PKG_ID 0xb /* 4331 12x9 package id */
|
||||
#define BCM47189_PKG_ID 1 /* 47189 package id */
|
||||
#define BCM53573_PKG_ID 0 /* 53573 package id */
|
||||
#define BCM4706L_PKG_ID 1 /* 4706L package id */
|
||||
|
||||
#define HDLSIM5350_PKG_ID 1 /* HDL simulator package id for a 5350 */
|
||||
#define HDLSIM_PKG_ID 14 /* HDL simulator package id */
|
||||
#define HWSIM_PKG_ID 15 /* Hardware simulator package id */
|
||||
#define BCM43224_FAB_CSM 0x8 /* the chip is manufactured by CSM */
|
||||
#define BCM43224_FAB_SMIC 0xa /* the chip is manufactured by SMIC */
|
||||
#define BCM4336_WLBGA_PKG_ID 0x8
|
||||
#define BCM4330_WLBGA_PKG_ID 0x0
|
||||
#define BCM4314PCIE_ARM_PKG_ID (8 | 0) /* 4314 QFN PCI package id, bit 3 tie high */
|
||||
#define BCM4314SDIO_PKG_ID (8 | 1) /* 4314 QFN SDIO package id */
|
||||
#define BCM4314PCIE_PKG_ID (8 | 2) /* 4314 QFN PCI (ARM-less) package id */
|
||||
#define BCM4314SDIO_ARM_PKG_ID (8 | 3) /* 4314 QFN SDIO (ARM-less) package id */
|
||||
#define BCM4314SDIO_FPBGA_PKG_ID (8 | 4) /* 4314 FpBGA SDIO package id */
|
||||
#define BCM4314DEV_PKG_ID (8 | 6) /* 4314 Developement package id */
|
||||
|
||||
#define BCM4707_PKG_ID 1 /* 4707 package id */
|
||||
#define BCM4708_PKG_ID 2 /* 4708 package id */
|
||||
#define BCM4709_PKG_ID 0 /* 4709 package id */
|
||||
|
||||
#define PCIXX21_FLASHMEDIA0_ID 0x8033 /* TI PCI xx21 Standard Host Controller */
|
||||
#define PCIXX21_SDIOH0_ID 0x8034 /* TI PCI xx21 Standard Host Controller */
|
||||
|
||||
#define BCM4335_WLCSP_PKG_ID (0x0) /* WLCSP Module/Mobile SDIO/HSIC. */
|
||||
#define BCM4335_FCBGA_PKG_ID (0x1) /* FCBGA PC/Embeded/Media PCIE/SDIO */
|
||||
#define BCM4335_WLBGA_PKG_ID (0x2) /* WLBGA COB/Mobile SDIO/HSIC. */
|
||||
#define BCM4335_FCBGAD_PKG_ID (0x3) /* FCBGA Debug Debug/Dev All if's. */
|
||||
#define BCM4335_PKG_MASK (0x3)
|
||||
#define BCM43602_12x12_PKG_ID (0x1) /* 12x12 pins package, used for e.g. router designs */
|
||||
|
||||
/* boardflags */
|
||||
#define BFL_BTC2WIRE 0x00000001 /* old 2wire Bluetooth coexistence, OBSOLETE */
|
||||
#define BFL_BTCOEX 0x00000001 /* Board supports BTCOEX */
|
||||
#define BFL_PACTRL 0x00000002 /* Board has gpio 9 controlling the PA */
|
||||
#define BFL_AIRLINEMODE 0x00000004 /* Board implements gpio radio disable indication */
|
||||
#define BFL_ADCDIV 0x00000008 /* Board has the rssi ADC divider */
|
||||
#define BFL_DIS_256QAM 0x00000008
|
||||
#define BFL_ENETROBO 0x00000010 /* Board has robo switch or core */
|
||||
#define BFL_TSSIAVG 0x00000010 /* TSSI averaging for ACPHY chips */
|
||||
#define BFL_NOPLLDOWN 0x00000020 /* Not ok to power down the chip pll and oscillator */
|
||||
#define BFL_CCKHIPWR 0x00000040 /* Can do high-power CCK transmission */
|
||||
#define BFL_ENETADM 0x00000080 /* Board has ADMtek switch */
|
||||
#define BFL_ENETVLAN 0x00000100 /* Board has VLAN capability */
|
||||
#define BFL_LTECOEX 0x00000200 /* LTE Coex enabled */
|
||||
#define BFL_NOPCI 0x00000400 /* Board leaves PCI floating */
|
||||
#define BFL_FEM 0x00000800 /* Board supports the Front End Module */
|
||||
#define BFL_EXTLNA 0x00001000 /* Board has an external LNA in 2.4GHz band */
|
||||
#define BFL_HGPA 0x00002000 /* Board has a high gain PA */
|
||||
#define BFL_BTC2WIRE_ALTGPIO 0x00004000 /* Board's BTC 2wire is in the alternate gpios */
|
||||
#define BFL_ALTIQ 0x00008000 /* Alternate I/Q settings */
|
||||
#define BFL_NOPA 0x00010000 /* Board has no PA */
|
||||
#define BFL_RSSIINV 0x00020000 /* Board's RSSI uses positive slope(not TSSI) */
|
||||
#define BFL_PAREF 0x00040000 /* Board uses the PARef LDO */
|
||||
#define BFL_3TSWITCH 0x00080000 /* Board uses a triple throw switch shared with BT */
|
||||
#define BFL_PHASESHIFT 0x00100000 /* Board can support phase shifter */
|
||||
#define BFL_BUCKBOOST 0x00200000 /* Power topology uses BUCKBOOST */
|
||||
#define BFL_FEM_BT 0x00400000 /* Board has FEM and switch to share antenna w/ BT */
|
||||
#define BFL_NOCBUCK 0x00800000 /* Power topology doesn't use CBUCK */
|
||||
#define BFL_CCKFAVOREVM 0x01000000 /* Favor CCK EVM over spectral mask */
|
||||
#define BFL_PALDO 0x02000000 /* Power topology uses PALDO */
|
||||
#define BFL_LNLDO2_2P5 0x04000000 /* Select 2.5V as LNLDO2 output voltage */
|
||||
#define BFL_FASTPWR 0x08000000
|
||||
#define BFL_UCPWRCTL_MININDX 0x08000000 /* Enforce min power index to avoid FEM damage */
|
||||
#define BFL_EXTLNA_5GHz 0x10000000 /* Board has an external LNA in 5GHz band */
|
||||
#define BFL_TRSW_1by2 0x20000000 /* Board has 2 TRSW's in 1by2 designs */
|
||||
#define BFL_GAINBOOSTA01 0x20000000 /* 5g Gainboost for core0 and core1 */
|
||||
#define BFL_LO_TRSW_R_5GHz 0x40000000 /* In 5G do not throw TRSW to T for clipLO gain */
|
||||
#define BFL_ELNA_GAINDEF 0x80000000 /* Backoff InitGain based on elna_2g/5g field
|
||||
* when this flag is set
|
||||
*/
|
||||
#define BFL_EXTLNA_TX 0x20000000 /* Temp boardflag to indicate to */
|
||||
|
||||
/* boardflags2 */
|
||||
#define BFL2_RXBB_INT_REG_DIS 0x00000001 /* Board has an external rxbb regulator */
|
||||
#define BFL2_APLL_WAR 0x00000002 /* Flag to implement alternative A-band PLL settings */
|
||||
#define BFL2_TXPWRCTRL_EN 0x00000004 /* Board permits enabling TX Power Control */
|
||||
#define BFL2_2X4_DIV 0x00000008 /* Board supports the 2X4 diversity switch */
|
||||
#define BFL2_5G_PWRGAIN 0x00000010 /* Board supports 5G band power gain */
|
||||
#define BFL2_PCIEWAR_OVR 0x00000020 /* Board overrides ASPM and Clkreq settings */
|
||||
#define BFL2_CAESERS_BRD 0x00000040 /* Board is Caesers brd (unused by sw) */
|
||||
#define BFL2_BTC3WIRE 0x00000080 /* Board support legacy 3 wire or 4 wire */
|
||||
#define BFL2_BTCLEGACY 0x00000080 /* Board support legacy 3/4 wire, to replace
|
||||
* BFL2_BTC3WIRE
|
||||
*/
|
||||
#define BFL2_SKWRKFEM_BRD 0x00000100 /* 4321mcm93 board uses Skyworks FEM */
|
||||
#define BFL2_SPUR_WAR 0x00000200 /* Board has a WAR for clock-harmonic spurs */
|
||||
#define BFL2_GPLL_WAR 0x00000400 /* Flag to narrow G-band PLL loop b/w */
|
||||
#define BFL2_TRISTATE_LED 0x00000800 /* Tri-state the LED */
|
||||
#define BFL2_SINGLEANT_CCK 0x00001000 /* Tx CCK pkts on Ant 0 only */
|
||||
#define BFL2_2G_SPUR_WAR 0x00002000 /* WAR to reduce and avoid clock-harmonic spurs in 2G */
|
||||
#define BFL2_BPHY_ALL_TXCORES 0x00004000 /* Transmit bphy frames using all tx cores */
|
||||
#define BFL2_FCC_BANDEDGE_WAR 0x00008000 /* Activates WAR to improve FCC bandedge performance */
|
||||
#define BFL2_DAC_SPUR_IMPROVEMENT 0x00008000 /* Reducing DAC Spurs */
|
||||
#define BFL2_GPLL_WAR2 0x00010000 /* Flag to widen G-band PLL loop b/w */
|
||||
#define BFL2_REDUCED_PA_TURNONTIME 0x00010000 /* Flag to reduce PA turn on Time */
|
||||
#define BFL2_IPALVLSHIFT_3P3 0x00020000
|
||||
#define BFL2_INTERNDET_TXIQCAL 0x00040000 /* Use internal envelope detector for TX IQCAL */
|
||||
#define BFL2_XTALBUFOUTEN 0x00080000 /* Keep the buffered Xtal output from radio on */
|
||||
/* Most drivers will turn it off without this flag */
|
||||
/* to save power. */
|
||||
|
||||
#define BFL2_ANAPACTRL_2G 0x00100000 /* 2G ext PAs are controlled by analog PA ctrl lines */
|
||||
#define BFL2_ANAPACTRL_5G 0x00200000 /* 5G ext PAs are controlled by analog PA ctrl lines */
|
||||
#define BFL2_ELNACTRL_TRSW_2G 0x00400000 /* AZW4329: 2G gmode_elna_gain controls TR Switch */
|
||||
#define BFL2_BT_SHARE_ANT0 0x00800000 /* share core0 antenna with BT */
|
||||
#define BFL2_TEMPSENSE_HIGHER 0x01000000 /* The tempsense threshold can sustain higher value
|
||||
* than programmed. The exact delta is decided by
|
||||
* driver per chip/boardtype. This can be used
|
||||
* when tempsense qualification happens after shipment
|
||||
*/
|
||||
#define BFL2_BTC3WIREONLY 0x02000000 /* standard 3 wire btc only. 4 wire not supported */
|
||||
#define BFL2_PWR_NOMINAL 0x04000000 /* 0: power reduction on, 1: no power reduction */
|
||||
#define BFL2_EXTLNA_PWRSAVE 0x08000000 /* boardflag to enable ucode to apply power save */
|
||||
/* ucode control of eLNA during Tx */
|
||||
#define BFL2_4313_RADIOREG 0x10000000
|
||||
/* board rework */
|
||||
#define BFL2_DYNAMIC_VMID 0x10000000 /* enable dynamic Vmid in idle TSSI CAL for 4331 */
|
||||
|
||||
#define BFL2_SDR_EN 0x20000000 /* SDR enabled or disabled */
|
||||
#define BFL2_DYNAMIC_VMID 0x10000000 /* boardflag to enable dynamic Vmid idle TSSI CAL */
|
||||
#define BFL2_LNA1BYPFORTR2G 0x40000000 /* acphy, enable lna1 bypass for clip gain, 2g */
|
||||
#define BFL2_LNA1BYPFORTR5G 0x80000000 /* acphy, enable lna1 bypass for clip gain, 5g */
|
||||
|
||||
/* SROM 11 - 11ac boardflag definitions */
|
||||
#define BFL_SROM11_BTCOEX 0x00000001 /* Board supports BTCOEX */
|
||||
#define BFL_SROM11_WLAN_BT_SH_XTL 0x00000002 /* bluetooth and wlan share same crystal */
|
||||
#define BFL_SROM11_EXTLNA 0x00001000 /* Board has an external LNA in 2.4GHz band */
|
||||
#define BFL_SROM11_EPA_TURNON_TIME 0x00018000 /* 2 bits for different PA turn on times */
|
||||
#define BFL_SROM11_EPA_TURNON_TIME_SHIFT 15
|
||||
#define BFL_SROM11_PRECAL_TX_IDX 0x00040000 /* Dedicated TX IQLOCAL IDX values */
|
||||
/* per subband, as derived from 43602A1 MCH5 */
|
||||
#define BFL_SROM11_EXTLNA_5GHz 0x10000000 /* Board has an external LNA in 5GHz band */
|
||||
#define BFL_SROM11_GAINBOOSTA01 0x20000000 /* 5g Gainboost for core0 and core1 */
|
||||
#define BFL2_SROM11_APLL_WAR 0x00000002 /* Flag to implement alternative A-band PLL settings */
|
||||
#define BFL2_SROM11_ANAPACTRL_2G 0x00100000 /* 2G ext PAs are ctrl-ed by analog PA ctrl lines */
|
||||
#define BFL2_SROM11_ANAPACTRL_5G 0x00200000 /* 5G ext PAs are ctrl-ed by analog PA ctrl lines */
|
||||
#define BFL2_SROM11_SINGLEANT_CCK 0x00001000 /* Tx CCK pkts on Ant 0 only */
|
||||
#define BFL2_SROM11_EPA_ON_DURING_TXIQLOCAL 0x00020000 /* Keep ext. PA's on in TX IQLO CAL */
|
||||
|
||||
/* boardflags3 */
|
||||
#define BFL3_FEMCTRL_SUB 0x00000007 /* acphy, subrevs of femctrl on top of srom_femctrl */
|
||||
#define BFL3_RCAL_WAR 0x00000008 /* acphy, rcal war active on this board (4335a0) */
|
||||
#define BFL3_TXGAINTBLID 0x00000070 /* acphy, txgain table id */
|
||||
#define BFL3_TXGAINTBLID_SHIFT 0x4 /* acphy, txgain table id shift bit */
|
||||
#define BFL3_TSSI_DIV_WAR 0x00000080 /* acphy, Seperate paparam for 20/40/80 */
|
||||
#define BFL3_TSSI_DIV_WAR_SHIFT 0x7 /* acphy, Seperate paparam for 20/40/80 shift bit */
|
||||
#define BFL3_FEMTBL_FROM_NVRAM 0x00000100 /* acphy, femctrl table is read from nvram */
|
||||
#define BFL3_FEMTBL_FROM_NVRAM_SHIFT 0x8 /* acphy, femctrl table is read from nvram */
|
||||
#define BFL3_AGC_CFG_2G 0x00000200 /* acphy, gain control configuration for 2G */
|
||||
#define BFL3_AGC_CFG_5G 0x00000400 /* acphy, gain control configuration for 5G */
|
||||
#define BFL3_PPR_BIT_EXT 0x00000800 /* acphy, bit position for 1bit extension for ppr */
|
||||
#define BFL3_PPR_BIT_EXT_SHIFT 11 /* acphy, bit shift for 1bit extension for ppr */
|
||||
#define BFL3_BBPLL_SPR_MODE_DIS 0x00001000 /* acphy, disables bbpll spur modes */
|
||||
#define BFL3_RCAL_OTP_VAL_EN 0x00002000 /* acphy, to read rcal_trim value from otp */
|
||||
#define BFL3_2GTXGAINTBL_BLANK 0x00004000 /* acphy, blank the first X ticks of 2g gaintbl */
|
||||
#define BFL3_2GTXGAINTBL_BLANK_SHIFT 14 /* acphy, blank the first X ticks of 2g gaintbl */
|
||||
#define BFL3_5GTXGAINTBL_BLANK 0x00008000 /* acphy, blank the first X ticks of 5g gaintbl */
|
||||
#define BFL3_5GTXGAINTBL_BLANK_SHIFT 15 /* acphy, blank the first X ticks of 5g gaintbl */
|
||||
#define BFL3_PHASETRACK_MAX_ALPHABETA 0x00010000 /* acphy, to max out alpha,beta to 511 */
|
||||
#define BFL3_PHASETRACK_MAX_ALPHABETA_SHIFT 16 /* acphy, to max out alpha,beta to 511 */
|
||||
/* acphy, to use backed off gaintbl for lte-coex */
|
||||
#define BFL3_LTECOEX_GAINTBL_EN 0x00060000
|
||||
/* acphy, to use backed off gaintbl for lte-coex */
|
||||
#define BFL3_LTECOEX_GAINTBL_EN_SHIFT 17
|
||||
#define BFL3_5G_SPUR_WAR 0x00080000 /* acphy, enable spur WAR in 5G band */
|
||||
#define BFL3_1X1_RSDB_ANT 0x01000000 /* to find if 2-ant RSDB board or 1-ant RSDB board */
|
||||
#define BFL3_1X1_RSDB_ANT_SHIFT 24
|
||||
|
||||
/* acphy: lpmode2g and lpmode_5g related boardflags */
|
||||
#define BFL3_ACPHY_LPMODE_2G 0x00300000 /* bits 20:21 for lpmode_2g choice */
|
||||
#define BFL3_ACPHY_LPMODE_2G_SHIFT 20
|
||||
|
||||
#define BFL3_ACPHY_LPMODE_5G 0x00C00000 /* bits 22:23 for lpmode_5g choice */
|
||||
#define BFL3_ACPHY_LPMODE_5G_SHIFT 22
|
||||
|
||||
#define BFL3_EXT_LPO_ISCLOCK 0x02000000 /* External LPO is clock, not x-tal */
|
||||
#define BFL3_FORCE_INT_LPO_SEL 0x04000000 /* Force internal lpo */
|
||||
#define BFL3_FORCE_EXT_LPO_SEL 0x08000000 /* Force external lpo */
|
||||
|
||||
#define BFL3_EN_BRCM_IMPBF 0x10000000 /* acphy, Allow BRCM Implicit TxBF */
|
||||
#define BFL3_AVVMID_FROM_NVRAM 0x40000000 /* Read Av Vmid from NVRAM */
|
||||
#define BFL3_VLIN_EN_FROM_NVRAM 0x80000000 /* Read Vlin En from NVRAM */
|
||||
|
||||
#define BFL3_AVVMID_FROM_NVRAM_SHIFT 30 /* Read Av Vmid from NVRAM */
|
||||
#define BFL3_VLIN_EN_FROM_NVRAM_SHIFT 31 /* Enable Vlin from NVRAM */
|
||||
|
||||
/* boardflags4 for SROM12 */
|
||||
#define BFL4_SROM12_4dBPAD (1 << 0) /* To distinguigh between normal and 4dB pad board */
|
||||
#define BFL4_SROM12_2G_DETTYPE (1 << 1) /* Determine power detector type for 2G */
|
||||
#define BFL4_SROM12_5G_DETTYPE (1 << 2) /* Determine power detector type for 5G */
|
||||
#define BFL4_4364_HARPOON 0x0100 /* Harpoon module 4364 */
|
||||
#define BFL4_4364_GODZILLA 0x0200 /* Godzilla module 4364 */
|
||||
|
||||
|
||||
/* papd params */
|
||||
#define PAPD_TX_ATTN_2G 0xFF
|
||||
#define PAPD_TX_ATTN_5G 0xFF00
|
||||
#define PAPD_TX_ATTN_5G_SHIFT 8
|
||||
#define PAPD_RX_ATTN_2G 0xFF
|
||||
#define PAPD_RX_ATTN_5G 0xFF00
|
||||
#define PAPD_RX_ATTN_5G_SHIFT 8
|
||||
#define PAPD_CAL_IDX_2G 0xFF
|
||||
#define PAPD_CAL_IDX_5G 0xFF00
|
||||
#define PAPD_CAL_IDX_5G_SHIFT 8
|
||||
#define PAPD_BBMULT_2G 0xFF
|
||||
#define PAPD_BBMULT_5G 0xFF00
|
||||
#define PAPD_BBMULT_5G_SHIFT 8
|
||||
#define TIA_GAIN_MODE_2G 0xFF
|
||||
#define TIA_GAIN_MODE_5G 0xFF00
|
||||
#define TIA_GAIN_MODE_5G_SHIFT 8
|
||||
#define PAPD_EPS_OFFSET_2G 0xFFFF
|
||||
#define PAPD_EPS_OFFSET_5G 0xFFFF0000
|
||||
#define PAPD_EPS_OFFSET_5G_SHIFT 16
|
||||
#define PAPD_CALREF_DB_2G 0xFF
|
||||
#define PAPD_CALREF_DB_5G 0xFF00
|
||||
#define PAPD_CALREF_DB_5G_SHIFT 8
|
||||
|
||||
|
||||
/* board specific GPIO assignment, gpio 0-3 are also customer-configurable led */
|
||||
#define BOARD_GPIO_BTC3W_IN 0x850 /* bit 4 is RF_ACTIVE, bit 6 is STATUS, bit 11 is PRI */
|
||||
#define BOARD_GPIO_BTC3W_OUT 0x020 /* bit 5 is TX_CONF */
|
||||
#define BOARD_GPIO_BTCMOD_IN 0x010 /* bit 4 is the alternate BT Coexistence Input */
|
||||
#define BOARD_GPIO_BTCMOD_OUT 0x020 /* bit 5 is the alternate BT Coexistence Out */
|
||||
#define BOARD_GPIO_BTC_IN 0x080 /* bit 7 is BT Coexistence Input */
|
||||
#define BOARD_GPIO_BTC_OUT 0x100 /* bit 8 is BT Coexistence Out */
|
||||
#define BOARD_GPIO_PACTRL 0x200 /* bit 9 controls the PA on new 4306 boards */
|
||||
#define BOARD_GPIO_12 0x1000 /* gpio 12 */
|
||||
#define BOARD_GPIO_13 0x2000 /* gpio 13 */
|
||||
#define BOARD_GPIO_BTC4_IN 0x0800 /* gpio 11, coex4, in */
|
||||
#define BOARD_GPIO_BTC4_BT 0x2000 /* gpio 12, coex4, bt active */
|
||||
#define BOARD_GPIO_BTC4_STAT 0x4000 /* gpio 14, coex4, status */
|
||||
#define BOARD_GPIO_BTC4_WLAN 0x8000 /* gpio 15, coex4, wlan active */
|
||||
#define BOARD_GPIO_1_WLAN_PWR 0x02 /* throttle WLAN power on X21 board */
|
||||
#define BOARD_GPIO_2_WLAN_PWR 0x04 /* throttle WLAN power on X29C board */
|
||||
#define BOARD_GPIO_3_WLAN_PWR 0x08 /* throttle WLAN power on X28 board */
|
||||
#define BOARD_GPIO_4_WLAN_PWR 0x10 /* throttle WLAN power on X19 board */
|
||||
#define BOARD_GPIO_13_WLAN_PWR 0x2000 /* throttle WLAN power on X14 board */
|
||||
|
||||
#define GPIO_BTC4W_OUT_4312 0x010 /* bit 4 is BT_IODISABLE */
|
||||
#define GPIO_BTC4W_OUT_43224 0x020 /* bit 5 is BT_IODISABLE */
|
||||
#define GPIO_BTC4W_OUT_43224_SHARED 0x0e0 /* bit 5 is BT_IODISABLE */
|
||||
#define GPIO_BTC4W_OUT_43225 0x0e0 /* bit 5 BT_IODISABLE, bit 6 SW_BT, bit 7 SW_WL */
|
||||
#define GPIO_BTC4W_OUT_43421 0x020 /* bit 5 is BT_IODISABLE */
|
||||
#define GPIO_BTC4W_OUT_4313 0x060 /* bit 5 SW_BT, bit 6 SW_WL */
|
||||
#define GPIO_BTC4W_OUT_4331_SHARED 0x010 /* GPIO 4 */
|
||||
|
||||
#define PCI_CFG_GPIO_SCS 0x10 /* PCI config space bit 4 for 4306c0 slow clock source */
|
||||
#define PCI_CFG_GPIO_HWRAD 0x20 /* PCI config space GPIO 13 for hw radio disable */
|
||||
#define PCI_CFG_GPIO_XTAL 0x40 /* PCI config space GPIO 14 for Xtal power-up */
|
||||
#define PCI_CFG_GPIO_PLL 0x80 /* PCI config space GPIO 15 for PLL power-down */
|
||||
|
||||
/* power control defines */
|
||||
#define PLL_DELAY 150 /* us pll on delay */
|
||||
#define FREF_DELAY 200 /* us fref change delay */
|
||||
#define MIN_SLOW_CLK 32 /* us Slow clock period */
|
||||
#define XTAL_ON_DELAY 1000 /* us crystal power-on delay */
|
||||
|
||||
|
||||
/* 43341 Boards */
|
||||
#define BCM943341WLABGS_SSID 0x062d
|
||||
|
||||
/* 43342 Boards */
|
||||
#define BCM943342FCAGBI_SSID 0x0641
|
||||
|
||||
/* 43012 wlbga Board */
|
||||
#define BCM943012WLREF_SSID 0x07d7
|
||||
|
||||
/* 43012 fcbga Board */
|
||||
#define BCM943012FCREF_SSID 0x07d4
|
||||
|
||||
/* 43602 Boards, unclear yet what boards will be created. */
|
||||
#define BCM943602RSVD1_SSID 0x06a5
|
||||
#define BCM943602RSVD2_SSID 0x06a6
|
||||
#define BCM943602X87 0X0133
|
||||
#define BCM943602X87P2 0X0152
|
||||
#define BCM943602X87P3 0X0153
|
||||
#define BCM943602X238 0X0132
|
||||
#define BCM943602X238D 0X014A
|
||||
#define BCM943602X238DP2 0X0155
|
||||
#define BCM943602X238DP3 0X0156
|
||||
#define BCM943602X100 0x0761
|
||||
#define BCM943602X100GS 0x0157
|
||||
#define BCM943602X100P2 0x015A
|
||||
|
||||
/* # of GPIO pins */
|
||||
#define GPIO_NUMPINS 32
|
||||
|
||||
/* These values are used by dhd host driver. */
|
||||
#define RDL_RAM_BASE_4319 0x60000000
|
||||
#define RDL_RAM_BASE_4329 0x60000000
|
||||
#define RDL_RAM_SIZE_4319 0x48000
|
||||
#define RDL_RAM_SIZE_4329 0x48000
|
||||
#define RDL_RAM_SIZE_43236 0x70000
|
||||
#define RDL_RAM_BASE_43236 0x60000000
|
||||
#define RDL_RAM_SIZE_4328 0x60000
|
||||
#define RDL_RAM_BASE_4328 0x80000000
|
||||
#define RDL_RAM_SIZE_4322 0x60000
|
||||
#define RDL_RAM_BASE_4322 0x60000000
|
||||
#define RDL_RAM_SIZE_4360 0xA0000
|
||||
#define RDL_RAM_BASE_4360 0x60000000
|
||||
#define RDL_RAM_SIZE_43242 0x90000
|
||||
#define RDL_RAM_BASE_43242 0x60000000
|
||||
#define RDL_RAM_SIZE_43143 0x70000
|
||||
#define RDL_RAM_BASE_43143 0x60000000
|
||||
#define RDL_RAM_SIZE_4350 0xC0000
|
||||
#define RDL_RAM_BASE_4350 0x180800
|
||||
|
||||
/* generic defs for nvram "muxenab" bits
|
||||
* Note: these differ for 4335a0. refer bcmchipc.h for specific mux options.
|
||||
*/
|
||||
#define MUXENAB_UART 0x00000001
|
||||
#define MUXENAB_GPIO 0x00000002
|
||||
#define MUXENAB_ERCX 0x00000004 /* External Radio BT coex */
|
||||
#define MUXENAB_JTAG 0x00000008
|
||||
#define MUXENAB_HOST_WAKE 0x00000010 /* configure GPIO for SDIO host_wake */
|
||||
#define MUXENAB_I2S_EN 0x00000020
|
||||
#define MUXENAB_I2S_MASTER 0x00000040
|
||||
#define MUXENAB_I2S_FULL 0x00000080
|
||||
#define MUXENAB_SFLASH 0x00000100
|
||||
#define MUXENAB_RFSWCTRL0 0x00000200
|
||||
#define MUXENAB_RFSWCTRL1 0x00000400
|
||||
#define MUXENAB_RFSWCTRL2 0x00000800
|
||||
#define MUXENAB_SECI 0x00001000
|
||||
#define MUXENAB_BT_LEGACY 0x00002000
|
||||
#define MUXENAB_HOST_WAKE1 0x00004000 /* configure alternative GPIO for SDIO host_wake */
|
||||
|
||||
/* Boot flags */
|
||||
#define FLASH_KERNEL_NFLASH 0x00000001
|
||||
#define FLASH_BOOT_NFLASH 0x00000002
|
||||
|
||||
#endif /* _BCMDEVS_H */
|
|
@ -0,0 +1,92 @@
|
|||
/*
|
||||
* Fundamental constants relating to DHCP Protocol
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: bcmdhcp.h 700076 2017-05-17 14:42:22Z $
|
||||
*/
|
||||
|
||||
#ifndef _bcmdhcp_h_
|
||||
#define _bcmdhcp_h_
|
||||
|
||||
/* DHCP params */
|
||||
#define DHCP_TYPE_OFFSET 0 /* DHCP type (request|reply) offset */
|
||||
#define DHCP_TID_OFFSET 4 /* DHCP transition id offset */
|
||||
#define DHCP_FLAGS_OFFSET 10 /* DHCP flags offset */
|
||||
#define DHCP_CIADDR_OFFSET 12 /* DHCP client IP address offset */
|
||||
#define DHCP_YIADDR_OFFSET 16 /* DHCP your IP address offset */
|
||||
#define DHCP_GIADDR_OFFSET 24 /* DHCP relay agent IP address offset */
|
||||
#define DHCP_CHADDR_OFFSET 28 /* DHCP client h/w address offset */
|
||||
#define DHCP_OPT_OFFSET 236 /* DHCP options offset */
|
||||
|
||||
#define DHCP_OPT_MSGTYPE 53 /* DHCP message type */
|
||||
#define DHCP_OPT_MSGTYPE_REQ 3
|
||||
#define DHCP_OPT_MSGTYPE_ACK 5 /* DHCP message type - ACK */
|
||||
|
||||
#define DHCP_OPT_CODE_OFFSET 0 /* Option identifier */
|
||||
#define DHCP_OPT_LEN_OFFSET 1 /* Option data length */
|
||||
#define DHCP_OPT_DATA_OFFSET 2 /* Option data */
|
||||
|
||||
#define DHCP_OPT_CODE_CLIENTID 61 /* Option identifier */
|
||||
|
||||
#define DHCP_TYPE_REQUEST 1 /* DHCP request (discover|request) */
|
||||
#define DHCP_TYPE_REPLY 2 /* DHCP reply (offset|ack) */
|
||||
|
||||
#define DHCP_PORT_SERVER 67 /* DHCP server UDP port */
|
||||
#define DHCP_PORT_CLIENT 68 /* DHCP client UDP port */
|
||||
|
||||
#define DHCP_FLAG_BCAST 0x8000 /* DHCP broadcast flag */
|
||||
|
||||
#define DHCP_FLAGS_LEN 2 /* DHCP flags field length */
|
||||
|
||||
#define DHCP6_TYPE_SOLICIT 1 /* DHCP6 solicit */
|
||||
#define DHCP6_TYPE_ADVERTISE 2 /* DHCP6 advertise */
|
||||
#define DHCP6_TYPE_REQUEST 3 /* DHCP6 request */
|
||||
#define DHCP6_TYPE_CONFIRM 4 /* DHCP6 confirm */
|
||||
#define DHCP6_TYPE_RENEW 5 /* DHCP6 renew */
|
||||
#define DHCP6_TYPE_REBIND 6 /* DHCP6 rebind */
|
||||
#define DHCP6_TYPE_REPLY 7 /* DHCP6 reply */
|
||||
#define DHCP6_TYPE_RELEASE 8 /* DHCP6 release */
|
||||
#define DHCP6_TYPE_DECLINE 9 /* DHCP6 decline */
|
||||
#define DHCP6_TYPE_RECONFIGURE 10 /* DHCP6 reconfigure */
|
||||
#define DHCP6_TYPE_INFOREQ 11 /* DHCP6 information request */
|
||||
#define DHCP6_TYPE_RELAYFWD 12 /* DHCP6 relay forward */
|
||||
#define DHCP6_TYPE_RELAYREPLY 13 /* DHCP6 relay reply */
|
||||
|
||||
#define DHCP6_TYPE_OFFSET 0 /* DHCP6 type offset */
|
||||
|
||||
#define DHCP6_MSG_OPT_OFFSET 4 /* Offset of options in client server messages */
|
||||
#define DHCP6_RELAY_OPT_OFFSET 34 /* Offset of options in relay messages */
|
||||
|
||||
#define DHCP6_OPT_CODE_OFFSET 0 /* Option identifier */
|
||||
#define DHCP6_OPT_LEN_OFFSET 2 /* Option data length */
|
||||
#define DHCP6_OPT_DATA_OFFSET 4 /* Option data */
|
||||
|
||||
#define DHCP6_OPT_CODE_CLIENTID 1 /* DHCP6 CLIENTID option */
|
||||
#define DHCP6_OPT_CODE_SERVERID 2 /* DHCP6 SERVERID option */
|
||||
|
||||
#define DHCP6_PORT_SERVER 547 /* DHCP6 server UDP port */
|
||||
#define DHCP6_PORT_CLIENT 546 /* DHCP6 client UDP port */
|
||||
|
||||
#endif /* #ifndef _bcmdhcp_h_ */
|
|
@ -0,0 +1,332 @@
|
|||
/*
|
||||
* Byte order utilities
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: bcmendian.h 514727 2014-11-12 03:02:48Z $
|
||||
*
|
||||
* This file by default provides proper behavior on little-endian architectures.
|
||||
* On big-endian architectures, IL_BIGENDIAN should be defined.
|
||||
*/
|
||||
|
||||
#ifndef _BCMENDIAN_H_
|
||||
#define _BCMENDIAN_H_
|
||||
|
||||
#include <typedefs.h>
|
||||
|
||||
/* Reverse the bytes in a 16-bit value */
|
||||
#define BCMSWAP16(val) \
|
||||
((uint16)((((uint16)(val) & (uint16)0x00ffU) << 8) | \
|
||||
(((uint16)(val) & (uint16)0xff00U) >> 8)))
|
||||
|
||||
/* Reverse the bytes in a 32-bit value */
|
||||
#define BCMSWAP32(val) \
|
||||
((uint32)((((uint32)(val) & (uint32)0x000000ffU) << 24) | \
|
||||
(((uint32)(val) & (uint32)0x0000ff00U) << 8) | \
|
||||
(((uint32)(val) & (uint32)0x00ff0000U) >> 8) | \
|
||||
(((uint32)(val) & (uint32)0xff000000U) >> 24)))
|
||||
|
||||
/* Reverse the two 16-bit halves of a 32-bit value */
|
||||
#define BCMSWAP32BY16(val) \
|
||||
((uint32)((((uint32)(val) & (uint32)0x0000ffffU) << 16) | \
|
||||
(((uint32)(val) & (uint32)0xffff0000U) >> 16)))
|
||||
|
||||
/* Reverse the bytes in a 64-bit value */
|
||||
#define BCMSWAP64(val) \
|
||||
((uint64)((((uint64)(val) & 0x00000000000000ffULL) << 56) | \
|
||||
(((uint64)(val) & 0x000000000000ff00ULL) << 40) | \
|
||||
(((uint64)(val) & 0x0000000000ff0000ULL) << 24) | \
|
||||
(((uint64)(val) & 0x00000000ff000000ULL) << 8) | \
|
||||
(((uint64)(val) & 0x000000ff00000000ULL) >> 8) | \
|
||||
(((uint64)(val) & 0x0000ff0000000000ULL) >> 24) | \
|
||||
(((uint64)(val) & 0x00ff000000000000ULL) >> 40) | \
|
||||
(((uint64)(val) & 0xff00000000000000ULL) >> 56)))
|
||||
|
||||
/* Reverse the two 32-bit halves of a 64-bit value */
|
||||
#define BCMSWAP64BY32(val) \
|
||||
((uint64)((((uint64)(val) & 0x00000000ffffffffULL) << 32) | \
|
||||
(((uint64)(val) & 0xffffffff00000000ULL) >> 32)))
|
||||
|
||||
|
||||
/* Byte swapping macros
|
||||
* Host <=> Network (Big Endian) for 16- and 32-bit values
|
||||
* Host <=> Little-Endian for 16- and 32-bit values
|
||||
*/
|
||||
#ifndef hton16
|
||||
#define HTON16(i) BCMSWAP16(i)
|
||||
#define hton16(i) bcmswap16(i)
|
||||
#define HTON32(i) BCMSWAP32(i)
|
||||
#define hton32(i) bcmswap32(i)
|
||||
#define NTOH16(i) BCMSWAP16(i)
|
||||
#define ntoh16(i) bcmswap16(i)
|
||||
#define NTOH32(i) BCMSWAP32(i)
|
||||
#define ntoh32(i) bcmswap32(i)
|
||||
#define LTOH16(i) (i)
|
||||
#define ltoh16(i) (i)
|
||||
#define LTOH32(i) (i)
|
||||
#define ltoh32(i) (i)
|
||||
#define HTOL16(i) (i)
|
||||
#define htol16(i) (i)
|
||||
#define HTOL32(i) (i)
|
||||
#define htol32(i) (i)
|
||||
#define HTOL64(i) (i)
|
||||
#define htol64(i) (i)
|
||||
#endif /* hton16 */
|
||||
|
||||
#define ltoh16_buf(buf, i)
|
||||
#define htol16_buf(buf, i)
|
||||
|
||||
/* Unaligned loads and stores in host byte order */
|
||||
#define load32_ua(a) ltoh32_ua(a)
|
||||
#define store32_ua(a, v) htol32_ua_store(v, a)
|
||||
#define load16_ua(a) ltoh16_ua(a)
|
||||
#define store16_ua(a, v) htol16_ua_store(v, a)
|
||||
|
||||
#define _LTOH16_UA(cp) ((cp)[0] | ((cp)[1] << 8))
|
||||
#define _LTOH32_UA(cp) ((cp)[0] | ((cp)[1] << 8) | ((cp)[2] << 16) | ((cp)[3] << 24))
|
||||
#define _NTOH16_UA(cp) (((cp)[0] << 8) | (cp)[1])
|
||||
#define _NTOH32_UA(cp) (((cp)[0] << 24) | ((cp)[1] << 16) | ((cp)[2] << 8) | (cp)[3])
|
||||
|
||||
#define ltoh_ua(ptr) \
|
||||
(sizeof(*(ptr)) == sizeof(uint8) ? *(const uint8 *)(ptr) : \
|
||||
sizeof(*(ptr)) == sizeof(uint16) ? _LTOH16_UA((const uint8 *)(ptr)) : \
|
||||
sizeof(*(ptr)) == sizeof(uint32) ? _LTOH32_UA((const uint8 *)(ptr)) : \
|
||||
*(uint8 *)0)
|
||||
|
||||
#define ntoh_ua(ptr) \
|
||||
(sizeof(*(ptr)) == sizeof(uint8) ? *(const uint8 *)(ptr) : \
|
||||
sizeof(*(ptr)) == sizeof(uint16) ? _NTOH16_UA((const uint8 *)(ptr)) : \
|
||||
sizeof(*(ptr)) == sizeof(uint32) ? _NTOH32_UA((const uint8 *)(ptr)) : \
|
||||
*(uint8 *)0)
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
||||
/* GNU macro versions avoid referencing the argument multiple times, while also
|
||||
* avoiding the -fno-inline used in ROM builds.
|
||||
*/
|
||||
|
||||
#define bcmswap16(val) ({ \
|
||||
uint16 _val = (val); \
|
||||
BCMSWAP16(_val); \
|
||||
})
|
||||
|
||||
#define bcmswap32(val) ({ \
|
||||
uint32 _val = (val); \
|
||||
BCMSWAP32(_val); \
|
||||
})
|
||||
|
||||
#define bcmswap64(val) ({ \
|
||||
uint64 _val = (val); \
|
||||
BCMSWAP64(_val); \
|
||||
})
|
||||
|
||||
#define bcmswap32by16(val) ({ \
|
||||
uint32 _val = (val); \
|
||||
BCMSWAP32BY16(_val); \
|
||||
})
|
||||
|
||||
#define bcmswap16_buf(buf, len) ({ \
|
||||
uint16 *_buf = (uint16 *)(buf); \
|
||||
uint _wds = (len) / 2; \
|
||||
while (_wds--) { \
|
||||
*_buf = bcmswap16(*_buf); \
|
||||
_buf++; \
|
||||
} \
|
||||
})
|
||||
|
||||
#define htol16_ua_store(val, bytes) ({ \
|
||||
uint16 _val = (val); \
|
||||
uint8 *_bytes = (uint8 *)(bytes); \
|
||||
_bytes[0] = _val & 0xff; \
|
||||
_bytes[1] = _val >> 8; \
|
||||
})
|
||||
|
||||
#define htol32_ua_store(val, bytes) ({ \
|
||||
uint32 _val = (val); \
|
||||
uint8 *_bytes = (uint8 *)(bytes); \
|
||||
_bytes[0] = _val & 0xff; \
|
||||
_bytes[1] = (_val >> 8) & 0xff; \
|
||||
_bytes[2] = (_val >> 16) & 0xff; \
|
||||
_bytes[3] = _val >> 24; \
|
||||
})
|
||||
|
||||
#define hton16_ua_store(val, bytes) ({ \
|
||||
uint16 _val = (val); \
|
||||
uint8 *_bytes = (uint8 *)(bytes); \
|
||||
_bytes[0] = _val >> 8; \
|
||||
_bytes[1] = _val & 0xff; \
|
||||
})
|
||||
|
||||
#define hton32_ua_store(val, bytes) ({ \
|
||||
uint32 _val = (val); \
|
||||
uint8 *_bytes = (uint8 *)(bytes); \
|
||||
_bytes[0] = _val >> 24; \
|
||||
_bytes[1] = (_val >> 16) & 0xff; \
|
||||
_bytes[2] = (_val >> 8) & 0xff; \
|
||||
_bytes[3] = _val & 0xff; \
|
||||
})
|
||||
|
||||
#define ltoh16_ua(bytes) ({ \
|
||||
const uint8 *_bytes = (const uint8 *)(bytes); \
|
||||
_LTOH16_UA(_bytes); \
|
||||
})
|
||||
|
||||
#define ltoh32_ua(bytes) ({ \
|
||||
const uint8 *_bytes = (const uint8 *)(bytes); \
|
||||
_LTOH32_UA(_bytes); \
|
||||
})
|
||||
|
||||
#define ntoh16_ua(bytes) ({ \
|
||||
const uint8 *_bytes = (const uint8 *)(bytes); \
|
||||
_NTOH16_UA(_bytes); \
|
||||
})
|
||||
|
||||
#define ntoh32_ua(bytes) ({ \
|
||||
const uint8 *_bytes = (const uint8 *)(bytes); \
|
||||
_NTOH32_UA(_bytes); \
|
||||
})
|
||||
|
||||
#else /* !__GNUC__ */
|
||||
|
||||
/* Inline versions avoid referencing the argument multiple times */
|
||||
static INLINE uint16
|
||||
bcmswap16(uint16 val)
|
||||
{
|
||||
return BCMSWAP16(val);
|
||||
}
|
||||
|
||||
static INLINE uint32
|
||||
bcmswap32(uint32 val)
|
||||
{
|
||||
return BCMSWAP32(val);
|
||||
}
|
||||
|
||||
static INLINE uint64
|
||||
bcmswap64(uint64 val)
|
||||
{
|
||||
return BCMSWAP64(val);
|
||||
}
|
||||
|
||||
static INLINE uint32
|
||||
bcmswap32by16(uint32 val)
|
||||
{
|
||||
return BCMSWAP32BY16(val);
|
||||
}
|
||||
|
||||
/* Reverse pairs of bytes in a buffer (not for high-performance use) */
|
||||
/* buf - start of buffer of shorts to swap */
|
||||
/* len - byte length of buffer */
|
||||
static INLINE void
|
||||
bcmswap16_buf(uint16 *buf, uint len)
|
||||
{
|
||||
len = len / 2;
|
||||
|
||||
while (len--) {
|
||||
*buf = bcmswap16(*buf);
|
||||
buf++;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Store 16-bit value to unaligned little-endian byte array.
|
||||
*/
|
||||
static INLINE void
|
||||
htol16_ua_store(uint16 val, uint8 *bytes)
|
||||
{
|
||||
bytes[0] = val & 0xff;
|
||||
bytes[1] = val >> 8;
|
||||
}
|
||||
|
||||
/*
|
||||
* Store 32-bit value to unaligned little-endian byte array.
|
||||
*/
|
||||
static INLINE void
|
||||
htol32_ua_store(uint32 val, uint8 *bytes)
|
||||
{
|
||||
bytes[0] = val & 0xff;
|
||||
bytes[1] = (val >> 8) & 0xff;
|
||||
bytes[2] = (val >> 16) & 0xff;
|
||||
bytes[3] = val >> 24;
|
||||
}
|
||||
|
||||
/*
|
||||
* Store 16-bit value to unaligned network-(big-)endian byte array.
|
||||
*/
|
||||
static INLINE void
|
||||
hton16_ua_store(uint16 val, uint8 *bytes)
|
||||
{
|
||||
bytes[0] = val >> 8;
|
||||
bytes[1] = val & 0xff;
|
||||
}
|
||||
|
||||
/*
|
||||
* Store 32-bit value to unaligned network-(big-)endian byte array.
|
||||
*/
|
||||
static INLINE void
|
||||
hton32_ua_store(uint32 val, uint8 *bytes)
|
||||
{
|
||||
bytes[0] = val >> 24;
|
||||
bytes[1] = (val >> 16) & 0xff;
|
||||
bytes[2] = (val >> 8) & 0xff;
|
||||
bytes[3] = val & 0xff;
|
||||
}
|
||||
|
||||
/*
|
||||
* Load 16-bit value from unaligned little-endian byte array.
|
||||
*/
|
||||
static INLINE uint16
|
||||
ltoh16_ua(const void *bytes)
|
||||
{
|
||||
return _LTOH16_UA((const uint8 *)bytes);
|
||||
}
|
||||
|
||||
/*
|
||||
* Load 32-bit value from unaligned little-endian byte array.
|
||||
*/
|
||||
static INLINE uint32
|
||||
ltoh32_ua(const void *bytes)
|
||||
{
|
||||
return _LTOH32_UA((const uint8 *)bytes);
|
||||
}
|
||||
|
||||
/*
|
||||
* Load 16-bit value from unaligned big-(network-)endian byte array.
|
||||
*/
|
||||
static INLINE uint16
|
||||
ntoh16_ua(const void *bytes)
|
||||
{
|
||||
return _NTOH16_UA((const uint8 *)bytes);
|
||||
}
|
||||
|
||||
/*
|
||||
* Load 32-bit value from unaligned big-(network-)endian byte array.
|
||||
*/
|
||||
static INLINE uint32
|
||||
ntoh32_ua(const void *bytes)
|
||||
{
|
||||
return _NTOH32_UA((const uint8 *)bytes);
|
||||
}
|
||||
|
||||
#endif /* !__GNUC__ */
|
||||
#endif /* !_BCMENDIAN_H_ */
|
|
@ -0,0 +1,117 @@
|
|||
/*
|
||||
* Broadcom Ethernettype protocol definitions
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: bcmeth.h 701825 2017-05-26 16:45:27Z $
|
||||
*/
|
||||
|
||||
/*
|
||||
* Broadcom Ethernet protocol defines
|
||||
*/
|
||||
|
||||
#ifndef _BCMETH_H_
|
||||
#define _BCMETH_H_
|
||||
|
||||
#ifndef _TYPEDEFS_H_
|
||||
#include <typedefs.h>
|
||||
#endif
|
||||
|
||||
/* This marks the start of a packed structure section. */
|
||||
#include <packed_section_start.h>
|
||||
|
||||
/* ETHER_TYPE_BRCM is defined in ethernet.h */
|
||||
|
||||
/*
|
||||
* Following the 2byte BRCM ether_type is a 16bit BRCM subtype field
|
||||
* in one of two formats: (only subtypes 32768-65535 are in use now)
|
||||
*
|
||||
* subtypes 0-32767:
|
||||
* 8 bit subtype (0-127)
|
||||
* 8 bit length in bytes (0-255)
|
||||
*
|
||||
* subtypes 32768-65535:
|
||||
* 16 bit big-endian subtype
|
||||
* 16 bit big-endian length in bytes (0-65535)
|
||||
*
|
||||
* length is the number of additional bytes beyond the 4 or 6 byte header
|
||||
*
|
||||
* Reserved values:
|
||||
* 0 reserved
|
||||
* 5-15 reserved for iLine protocol assignments
|
||||
* 17-126 reserved, assignable
|
||||
* 127 reserved
|
||||
* 32768 reserved
|
||||
* 32769-65534 reserved, assignable
|
||||
* 65535 reserved
|
||||
*/
|
||||
|
||||
/*
|
||||
* While adding the subtypes and their specific processing code make sure
|
||||
* bcmeth_bcm_hdr_t is the first data structure in the user specific data structure definition
|
||||
*/
|
||||
|
||||
#define BCMILCP_SUBTYPE_RATE 1
|
||||
#define BCMILCP_SUBTYPE_LINK 2
|
||||
#define BCMILCP_SUBTYPE_CSA 3
|
||||
#define BCMILCP_SUBTYPE_LARQ 4
|
||||
#define BCMILCP_SUBTYPE_VENDOR 5
|
||||
#define BCMILCP_SUBTYPE_FLH 17
|
||||
|
||||
#define BCMILCP_SUBTYPE_VENDOR_LONG 32769
|
||||
#define BCMILCP_SUBTYPE_CERT 32770
|
||||
#define BCMILCP_SUBTYPE_SES 32771
|
||||
|
||||
|
||||
#define BCMILCP_BCM_SUBTYPE_RESERVED 0
|
||||
#define BCMILCP_BCM_SUBTYPE_EVENT 1
|
||||
#define BCMILCP_BCM_SUBTYPE_SES 2
|
||||
/*
|
||||
* The EAPOL type is not used anymore. Instead EAPOL messages are now embedded
|
||||
* within BCMILCP_BCM_SUBTYPE_EVENT type messages
|
||||
*/
|
||||
/* #define BCMILCP_BCM_SUBTYPE_EAPOL 3 */
|
||||
#define BCMILCP_BCM_SUBTYPE_DPT 4
|
||||
#define BCMILCP_BCM_SUBTYPE_DNGLEVENT 5
|
||||
|
||||
#define BCMILCP_BCM_SUBTYPEHDR_MINLENGTH 8
|
||||
#define BCMILCP_BCM_SUBTYPEHDR_VERSION 0
|
||||
#define BCMILCP_BCM_SUBTYPE_EVENT_DATA_PAD 2
|
||||
|
||||
/* These fields are stored in network order */
|
||||
typedef BWL_PRE_PACKED_STRUCT struct bcmeth_hdr
|
||||
{
|
||||
uint16 subtype; /* Vendor specific..32769 */
|
||||
uint16 length;
|
||||
uint8 version; /* Version is 0 */
|
||||
uint8 oui[3]; /* Broadcom OUI */
|
||||
/* user specific Data */
|
||||
uint16 usr_subtype;
|
||||
} BWL_POST_PACKED_STRUCT bcmeth_hdr_t;
|
||||
|
||||
|
||||
/* This marks the end of a packed structure section. */
|
||||
#include <packed_section_end.h>
|
||||
|
||||
#endif /* _BCMETH_H_ */
|
|
@ -0,0 +1,948 @@
|
|||
/*
|
||||
* Broadcom Event protocol definitions
|
||||
*
|
||||
* Dependencies: bcmeth.h
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: bcmevent.h 700076 2017-05-17 14:42:22Z $
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Broadcom Ethernet Events protocol defines
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _BCMEVENT_H_
|
||||
#define _BCMEVENT_H_
|
||||
|
||||
#include <typedefs.h>
|
||||
/* #include <ethernet.h> -- TODO: req., excluded to overwhelming coupling (break up ethernet.h) */
|
||||
#include <bcmeth.h>
|
||||
#if defined(DNGL_EVENT_SUPPORT)
|
||||
#include <dnglevent.h>
|
||||
#endif
|
||||
|
||||
/* This marks the start of a packed structure section. */
|
||||
#include <packed_section_start.h>
|
||||
|
||||
#define BCM_EVENT_MSG_VERSION 2 /* wl_event_msg_t struct version */
|
||||
#define BCM_MSG_IFNAME_MAX 16 /* max length of interface name */
|
||||
|
||||
/* flags */
|
||||
#define WLC_EVENT_MSG_LINK 0x01 /* link is up */
|
||||
#define WLC_EVENT_MSG_FLUSHTXQ 0x02 /* flush tx queue on MIC error */
|
||||
#define WLC_EVENT_MSG_GROUP 0x04 /* group MIC error */
|
||||
#define WLC_EVENT_MSG_UNKBSS 0x08 /* unknown source bsscfg */
|
||||
#define WLC_EVENT_MSG_UNKIF 0x10 /* unknown source OS i/f */
|
||||
|
||||
/* these fields are stored in network order */
|
||||
|
||||
/* version 1 */
|
||||
typedef BWL_PRE_PACKED_STRUCT struct
|
||||
{
|
||||
uint16 version;
|
||||
uint16 flags; /* see flags below */
|
||||
uint32 event_type; /* Message (see below) */
|
||||
uint32 status; /* Status code (see below) */
|
||||
uint32 reason; /* Reason code (if applicable) */
|
||||
uint32 auth_type; /* WLC_E_AUTH */
|
||||
uint32 datalen; /* data buf */
|
||||
struct ether_addr addr; /* Station address (if applicable) */
|
||||
char ifname[BCM_MSG_IFNAME_MAX]; /* name of the packet incoming interface */
|
||||
} BWL_POST_PACKED_STRUCT wl_event_msg_v1_t;
|
||||
|
||||
/* the current version */
|
||||
typedef BWL_PRE_PACKED_STRUCT struct
|
||||
{
|
||||
uint16 version;
|
||||
uint16 flags; /* see flags below */
|
||||
uint32 event_type; /* Message (see below) */
|
||||
uint32 status; /* Status code (see below) */
|
||||
uint32 reason; /* Reason code (if applicable) */
|
||||
uint32 auth_type; /* WLC_E_AUTH */
|
||||
uint32 datalen; /* data buf */
|
||||
struct ether_addr addr; /* Station address (if applicable) */
|
||||
char ifname[BCM_MSG_IFNAME_MAX]; /* name of the packet incoming interface */
|
||||
uint8 ifidx; /* destination OS i/f index */
|
||||
uint8 bsscfgidx; /* source bsscfg index */
|
||||
} BWL_POST_PACKED_STRUCT wl_event_msg_t;
|
||||
|
||||
/* used by driver msgs */
|
||||
typedef BWL_PRE_PACKED_STRUCT struct bcm_event {
|
||||
struct ether_header eth;
|
||||
bcmeth_hdr_t bcm_hdr;
|
||||
wl_event_msg_t event;
|
||||
/* data portion follows */
|
||||
} BWL_POST_PACKED_STRUCT bcm_event_t;
|
||||
|
||||
/*
|
||||
* used by host event
|
||||
* note: if additional event types are added, it should go with is_wlc_event_frame() as well.
|
||||
*/
|
||||
typedef union bcm_event_msg_u {
|
||||
wl_event_msg_t event;
|
||||
#if defined(DNGL_EVENT_SUPPORT)
|
||||
bcm_dngl_event_msg_t dngl_event;
|
||||
#endif
|
||||
|
||||
/* add new event here */
|
||||
} bcm_event_msg_u_t;
|
||||
|
||||
#define BCM_MSG_LEN (sizeof(bcm_event_t) - sizeof(bcmeth_hdr_t) - sizeof(struct ether_header))
|
||||
|
||||
/* Event messages */
|
||||
#define WLC_E_SET_SSID 0 /* indicates status of set SSID */
|
||||
#define WLC_E_JOIN 1 /* differentiates join IBSS from found (WLC_E_START) IBSS */
|
||||
#define WLC_E_START 2 /* STA founded an IBSS or AP started a BSS */
|
||||
#define WLC_E_AUTH 3 /* 802.11 AUTH request */
|
||||
#define WLC_E_AUTH_IND 4 /* 802.11 AUTH indication */
|
||||
#define WLC_E_DEAUTH 5 /* 802.11 DEAUTH request */
|
||||
#define WLC_E_DEAUTH_IND 6 /* 802.11 DEAUTH indication */
|
||||
#define WLC_E_ASSOC 7 /* 802.11 ASSOC request */
|
||||
#define WLC_E_ASSOC_IND 8 /* 802.11 ASSOC indication */
|
||||
#define WLC_E_REASSOC 9 /* 802.11 REASSOC request */
|
||||
#define WLC_E_REASSOC_IND 10 /* 802.11 REASSOC indication */
|
||||
#define WLC_E_DISASSOC 11 /* 802.11 DISASSOC request */
|
||||
#define WLC_E_DISASSOC_IND 12 /* 802.11 DISASSOC indication */
|
||||
#define WLC_E_QUIET_START 13 /* 802.11h Quiet period started */
|
||||
#define WLC_E_QUIET_END 14 /* 802.11h Quiet period ended */
|
||||
#define WLC_E_BEACON_RX 15 /* BEACONS received/lost indication */
|
||||
#define WLC_E_LINK 16 /* generic link indication */
|
||||
#define WLC_E_MIC_ERROR 17 /* TKIP MIC error occurred */
|
||||
#define WLC_E_NDIS_LINK 18 /* NDIS style link indication */
|
||||
#define WLC_E_ROAM 19 /* roam complete: indicate status & reason */
|
||||
#define WLC_E_TXFAIL 20 /* change in dot11FailedCount (txfail) */
|
||||
#define WLC_E_PMKID_CACHE 21 /* WPA2 pmkid cache indication */
|
||||
#define WLC_E_RETROGRADE_TSF 22 /* current AP's TSF value went backward */
|
||||
#define WLC_E_PRUNE 23 /* AP was pruned from join list for reason */
|
||||
#define WLC_E_AUTOAUTH 24 /* report AutoAuth table entry match for join attempt */
|
||||
#define WLC_E_EAPOL_MSG 25 /* Event encapsulating an EAPOL message */
|
||||
#define WLC_E_SCAN_COMPLETE 26 /* Scan results are ready or scan was aborted */
|
||||
#define WLC_E_ADDTS_IND 27 /* indicate to host addts fail/success */
|
||||
#define WLC_E_DELTS_IND 28 /* indicate to host delts fail/success */
|
||||
#define WLC_E_BCNSENT_IND 29 /* indicate to host of beacon transmit */
|
||||
#define WLC_E_BCNRX_MSG 30 /* Send the received beacon up to the host */
|
||||
#define WLC_E_BCNLOST_MSG 31 /* indicate to host loss of beacon */
|
||||
#define WLC_E_ROAM_PREP 32 /* before attempting to roam association */
|
||||
#define WLC_E_PFN_NET_FOUND 33 /* PFN network found event */
|
||||
#define WLC_E_PFN_NET_LOST 34 /* PFN network lost event */
|
||||
#define WLC_E_RESET_COMPLETE 35
|
||||
#define WLC_E_JOIN_START 36
|
||||
#define WLC_E_ROAM_START 37 /* roam attempt started: indicate reason */
|
||||
#define WLC_E_ASSOC_START 38
|
||||
#define WLC_E_IBSS_ASSOC 39
|
||||
#define WLC_E_RADIO 40
|
||||
#define WLC_E_PSM_WATCHDOG 41 /* PSM microcode watchdog fired */
|
||||
|
||||
#define WLC_E_PROBREQ_MSG 44 /* probe request received */
|
||||
#define WLC_E_SCAN_CONFIRM_IND 45
|
||||
#define WLC_E_PSK_SUP 46 /* WPA Handshake fail */
|
||||
#define WLC_E_COUNTRY_CODE_CHANGED 47
|
||||
#define WLC_E_EXCEEDED_MEDIUM_TIME 48 /* WMMAC excedded medium time */
|
||||
#define WLC_E_ICV_ERROR 49 /* WEP ICV error occurred */
|
||||
#define WLC_E_UNICAST_DECODE_ERROR 50 /* Unsupported unicast encrypted frame */
|
||||
#define WLC_E_MULTICAST_DECODE_ERROR 51 /* Unsupported multicast encrypted frame */
|
||||
#define WLC_E_TRACE 52
|
||||
#define WLC_E_IF 54 /* I/F change (for dongle host notification) */
|
||||
#define WLC_E_P2P_DISC_LISTEN_COMPLETE 55 /* listen state expires */
|
||||
#define WLC_E_RSSI 56 /* indicate RSSI change based on configured levels */
|
||||
#define WLC_E_PFN_BEST_BATCHING 57 /* PFN best network batching event */
|
||||
#define WLC_E_EXTLOG_MSG 58
|
||||
#define WLC_E_ACTION_FRAME 59 /* Action frame Rx */
|
||||
#define WLC_E_ACTION_FRAME_COMPLETE 60 /* Action frame Tx complete */
|
||||
#define WLC_E_PRE_ASSOC_IND 61 /* assoc request received */
|
||||
#define WLC_E_PRE_REASSOC_IND 62 /* re-assoc request received */
|
||||
#define WLC_E_CHANNEL_ADOPTED 63
|
||||
#define WLC_E_AP_STARTED 64 /* AP started */
|
||||
#define WLC_E_DFS_AP_STOP 65 /* AP stopped due to DFS */
|
||||
#define WLC_E_DFS_AP_RESUME 66 /* AP resumed due to DFS */
|
||||
#define WLC_E_WAI_STA_EVENT 67 /* WAI stations event */
|
||||
#define WLC_E_WAI_MSG 68 /* event encapsulating an WAI message */
|
||||
#define WLC_E_ESCAN_RESULT 69 /* escan result event */
|
||||
#define WLC_E_ACTION_FRAME_OFF_CHAN_COMPLETE 70 /* action frame off channel complete */
|
||||
#define WLC_E_PROBRESP_MSG 71 /* probe response received */
|
||||
#define WLC_E_P2P_PROBREQ_MSG 72 /* P2P Probe request received */
|
||||
#define WLC_E_DCS_REQUEST 73
|
||||
#define WLC_E_FIFO_CREDIT_MAP 74 /* credits for D11 FIFOs. [AC0,AC1,AC2,AC3,BC_MC,ATIM] */
|
||||
#define WLC_E_ACTION_FRAME_RX 75 /* Received action frame event WITH
|
||||
* wl_event_rx_frame_data_t header
|
||||
*/
|
||||
#define WLC_E_WAKE_EVENT 76 /* Wake Event timer fired, used for wake WLAN test mode */
|
||||
#define WLC_E_RM_COMPLETE 77 /* Radio measurement complete */
|
||||
#define WLC_E_HTSFSYNC 78 /* Synchronize TSF with the host */
|
||||
#define WLC_E_OVERLAY_REQ 79 /* request an overlay IOCTL/iovar from the host */
|
||||
#define WLC_E_CSA_COMPLETE_IND 80 /* 802.11 CHANNEL SWITCH ACTION completed */
|
||||
#define WLC_E_EXCESS_PM_WAKE_EVENT 81 /* excess PM Wake Event to inform host */
|
||||
#define WLC_E_PFN_SCAN_NONE 82 /* no PFN networks around */
|
||||
/* PFN BSSID network found event, conflict/share with WLC_E_PFN_SCAN_NONE */
|
||||
#define WLC_E_PFN_BSSID_NET_FOUND 82
|
||||
#define WLC_E_PFN_SCAN_ALLGONE 83 /* last found PFN network gets lost */
|
||||
/* PFN BSSID network lost event, conflict/share with WLC_E_PFN_SCAN_ALLGONE */
|
||||
#define WLC_E_PFN_BSSID_NET_LOST 83
|
||||
#define WLC_E_GTK_PLUMBED 84
|
||||
#define WLC_E_ASSOC_IND_NDIS 85 /* 802.11 ASSOC indication for NDIS only */
|
||||
#define WLC_E_REASSOC_IND_NDIS 86 /* 802.11 REASSOC indication for NDIS only */
|
||||
#define WLC_E_ASSOC_REQ_IE 87
|
||||
#define WLC_E_ASSOC_RESP_IE 88
|
||||
#define WLC_E_ASSOC_RECREATED 89 /* association recreated on resume */
|
||||
#define WLC_E_ACTION_FRAME_RX_NDIS 90 /* rx action frame event for NDIS only */
|
||||
#define WLC_E_AUTH_REQ 91 /* authentication request received */
|
||||
#define WLC_E_TDLS_PEER_EVENT 92 /* discovered peer, connected/disconnected peer */
|
||||
#define WLC_E_SPEEDY_RECREATE_FAIL 93 /* fast assoc recreation failed */
|
||||
#define WLC_E_NATIVE 94 /* port-specific event and payload (e.g. NDIS) */
|
||||
#define WLC_E_PKTDELAY_IND 95 /* event for tx pkt delay suddently jump */
|
||||
#define WLC_E_PSTA_PRIMARY_INTF_IND 99 /* psta primary interface indication */
|
||||
#define WLC_E_NAN 100 /* NAN event - Reserved for future */
|
||||
#define WLC_E_BEACON_FRAME_RX 101
|
||||
#define WLC_E_SERVICE_FOUND 102 /* desired service found */
|
||||
#define WLC_E_GAS_FRAGMENT_RX 103 /* GAS fragment received */
|
||||
#define WLC_E_GAS_COMPLETE 104 /* GAS sessions all complete */
|
||||
#define WLC_E_P2PO_ADD_DEVICE 105 /* New device found by p2p offload */
|
||||
#define WLC_E_P2PO_DEL_DEVICE 106 /* device has been removed by p2p offload */
|
||||
#define WLC_E_WNM_STA_SLEEP 107 /* WNM event to notify STA enter sleep mode */
|
||||
#define WLC_E_TXFAIL_THRESH 108 /* Indication of MAC tx failures (exhaustion of
|
||||
* 802.11 retries) exceeding threshold(s)
|
||||
*/
|
||||
#define WLC_E_PROXD 109 /* Proximity Detection event */
|
||||
#define WLC_E_IBSS_COALESCE 110 /* IBSS Coalescing */
|
||||
#define WLC_E_AIBSS_TXFAIL 110 /* TXFAIL event for AIBSS, re using event 110 */
|
||||
#define WLC_E_BSS_LOAD 114 /* Inform host of beacon bss load */
|
||||
#define WLC_E_MIMO_PWR_SAVE 115 /* Inform host MIMO PWR SAVE learning events */
|
||||
#define WLC_E_LEAKY_AP_STATS 116 /* Inform host leaky Ap stats events */
|
||||
#define WLC_E_ALLOW_CREDIT_BORROW 117 /* Allow or disallow wlfc credit borrowing in DHD */
|
||||
#define WLC_E_MSCH 120 /* Multiple channel scheduler event */
|
||||
#define WLC_E_CSA_START_IND 121
|
||||
#define WLC_E_CSA_DONE_IND 122
|
||||
#define WLC_E_CSA_FAILURE_IND 123
|
||||
#define WLC_E_CCA_CHAN_QUAL 124 /* CCA based channel quality report */
|
||||
#define WLC_E_BSSID 125 /* to report change in BSSID while roaming */
|
||||
#define WLC_E_TX_STAT_ERROR 126 /* tx error indication */
|
||||
#define WLC_E_BCMC_CREDIT_SUPPORT 127 /* credit check for BCMC supported */
|
||||
#define WLC_E_PEER_TIMEOUT 128 /* silently drop a STA because of inactivity */
|
||||
#define WLC_E_BT_WIFI_HANDOVER_REQ 130 /* Handover Request Initiated */
|
||||
#define WLC_E_SPW_TXINHIBIT 131 /* Southpaw TxInhibit notification */
|
||||
#define WLC_E_FBT_AUTH_REQ_IND 132 /* FBT Authentication Request Indication */
|
||||
#define WLC_E_RSSI_LQM 133 /* Enhancement addition for WLC_E_RSSI */
|
||||
#define WLC_E_PFN_GSCAN_FULL_RESULT 134 /* Full probe/beacon (IEs etc) results */
|
||||
#define WLC_E_PFN_SWC 135 /* Significant change in rssi of bssids being tracked */
|
||||
#define WLC_E_AUTHORIZED 136 /* a STA been authroized for traffic */
|
||||
#define WLC_E_PROBREQ_MSG_RX 137 /* probe req with wl_event_rx_frame_data_t header */
|
||||
#define WLC_E_PFN_SCAN_COMPLETE 138 /* PFN completed scan of network list */
|
||||
#define WLC_E_RMC_EVENT 139 /* RMC Event */
|
||||
#define WLC_E_DPSTA_INTF_IND 140 /* DPSTA interface indication */
|
||||
#define WLC_E_RRM 141 /* RRM Event */
|
||||
#define WLC_E_PFN_SSID_EXT 142 /* SSID EXT event */
|
||||
#define WLC_E_ROAM_EXP_EVENT 143 /* Expanded roam event */
|
||||
#define WLC_E_ULP 146 /* ULP entered indication */
|
||||
#define WLC_E_MACDBG 147 /* Ucode debugging event */
|
||||
#define WLC_E_RESERVED 148 /* reserved */
|
||||
#define WLC_E_PRE_ASSOC_RSEP_IND 149 /* assoc resp received */
|
||||
#define WLC_E_PSK_AUTH 150 /* PSK AUTH WPA2-PSK 4 WAY Handshake failure */
|
||||
#define WLC_E_TKO 151 /* TCP keepalive offload */
|
||||
#define WLC_E_SDB_TRANSITION 152 /* SDB mode-switch event */
|
||||
#define WLC_E_NATOE_NFCT 153 /* natoe event */
|
||||
#define WLC_E_TEMP_THROTTLE 154 /* Temperature throttling control event */
|
||||
#define WLC_E_LINK_QUALITY 155 /* Link quality measurement complete */
|
||||
#define WLC_E_BSSTRANS_RESP 156 /* BSS Transition Response received */
|
||||
#define WLC_E_TWT_SETUP 157 /* TWT Setup Complete event */
|
||||
#define WLC_E_HE_TWT_SETUP 157 /* TODO:Remove after merging TWT changes to trunk */
|
||||
#define WLC_E_NAN_CRITICAL 158 /* NAN Critical Event */
|
||||
#define WLC_E_NAN_NON_CRITICAL 159 /* NAN Non-Critical Event */
|
||||
#define WLC_E_RADAR_DETECTED 160 /* Radar Detected event */
|
||||
#define WLC_E_RANGING_EVENT 161 /* Ranging event */
|
||||
#define WLC_E_INVALID_IE 162 /* Received invalid IE */
|
||||
#define WLC_E_MODE_SWITCH 163 /* Mode switch event */
|
||||
#define WLC_E_PKT_FILTER 164 /* Packet filter event */
|
||||
#define WLC_E_DMA_TXFLUSH_COMPLETE 165 /* TxFlush done before changing
|
||||
* tx/rxchain
|
||||
*/
|
||||
#define WLC_E_FBT 166 /* FBT event */
|
||||
#define WLC_E_PFN_SCAN_BACKOFF 167 /* PFN SCAN Backoff event */
|
||||
#define WLC_E_PFN_BSSID_SCAN_BACKOFF 168 /* PFN BSSID SCAN BAckoff event */
|
||||
#define WLC_E_AGGR_EVENT 169 /* Aggregated event */
|
||||
#define WLC_E_TVPM_MITIGATION 171 /* Change in mitigation applied by TVPM */
|
||||
#define WLC_E_LAST 172 /* highest val + 1 for range checking */
|
||||
#if (WLC_E_LAST > 172)
|
||||
#error "WLC_E_LAST: Invalid value for last event; must be <= 172."
|
||||
#endif /* WLC_E_LAST */
|
||||
|
||||
/* define an API for getting the string name of an event */
|
||||
extern const char *bcmevent_get_name(uint event_type);
|
||||
extern void wl_event_to_host_order(wl_event_msg_t * evt);
|
||||
extern void wl_event_to_network_order(wl_event_msg_t * evt);
|
||||
|
||||
/* validate if the event is proper and if valid copy event header to event */
|
||||
extern int is_wlc_event_frame(void *pktdata, uint pktlen, uint16 exp_usr_subtype,
|
||||
bcm_event_msg_u_t *out_event);
|
||||
|
||||
/* conversion between host and network order for events */
|
||||
void wl_event_to_host_order(wl_event_msg_t * evt);
|
||||
void wl_event_to_network_order(wl_event_msg_t * evt);
|
||||
|
||||
|
||||
/* Event status codes */
|
||||
#define WLC_E_STATUS_SUCCESS 0 /* operation was successful */
|
||||
#define WLC_E_STATUS_FAIL 1 /* operation failed */
|
||||
#define WLC_E_STATUS_TIMEOUT 2 /* operation timed out */
|
||||
#define WLC_E_STATUS_NO_NETWORKS 3 /* failed due to no matching network found */
|
||||
#define WLC_E_STATUS_ABORT 4 /* operation was aborted */
|
||||
#define WLC_E_STATUS_NO_ACK 5 /* protocol failure: packet not ack'd */
|
||||
#define WLC_E_STATUS_UNSOLICITED 6 /* AUTH or ASSOC packet was unsolicited */
|
||||
#define WLC_E_STATUS_ATTEMPT 7 /* attempt to assoc to an auto auth configuration */
|
||||
#define WLC_E_STATUS_PARTIAL 8 /* scan results are incomplete */
|
||||
#define WLC_E_STATUS_NEWSCAN 9 /* scan aborted by another scan */
|
||||
#define WLC_E_STATUS_NEWASSOC 10 /* scan aborted due to assoc in progress */
|
||||
#define WLC_E_STATUS_11HQUIET 11 /* 802.11h quiet period started */
|
||||
#define WLC_E_STATUS_SUPPRESS 12 /* user disabled scanning (WLC_SET_SCANSUPPRESS) */
|
||||
#define WLC_E_STATUS_NOCHANS 13 /* no allowable channels to scan */
|
||||
#define WLC_E_STATUS_CS_ABORT 15 /* abort channel select */
|
||||
#define WLC_E_STATUS_ERROR 16 /* request failed due to error */
|
||||
#define WLC_E_STATUS_INVALID 0xff /* Invalid status code to init variables. */
|
||||
|
||||
/* 4-way handshake event type */
|
||||
#define WLC_E_PSK_AUTH_SUB_EAPOL_START 1 /* EAPOL start */
|
||||
#define WLC_E_PSK_AUTH_SUB_EAPOL_DONE 2 /* EAPOL end */
|
||||
/* GTK event type */
|
||||
#define WLC_E_PSK_AUTH_SUB_GTK_DONE 3 /* GTK end */
|
||||
|
||||
/* 4-way handshake event status code */
|
||||
#define WLC_E_STATUS_PSK_AUTH_WPA_TIMOUT 1 /* operation timed out */
|
||||
#define WLC_E_STATUS_PSK_AUTH_MIC_WPA_ERR 2 /* MIC error */
|
||||
#define WLC_E_STATUS_PSK_AUTH_IE_MISMATCH_ERR 3 /* IE Missmatch error */
|
||||
#define WLC_E_STATUS_PSK_AUTH_REPLAY_COUNT_ERR 4
|
||||
#define WLC_E_STATUS_PSK_AUTH_PEER_BLACKISTED 5 /* Blaclisted peer */
|
||||
#define WLC_E_STATUS_PSK_AUTH_GTK_REKEY_FAIL 6 /* GTK event status code */
|
||||
|
||||
/* SDB transition status code */
|
||||
#define WLC_E_STATUS_SDB_START 1
|
||||
#define WLC_E_STATUS_SDB_COMPLETE 2
|
||||
/* Slice-swap status code */
|
||||
#define WLC_E_STATUS_SLICE_SWAP_START 3
|
||||
#define WLC_E_STATUS_SLICE_SWAP_COMPLETE 4
|
||||
|
||||
|
||||
/* SDB transition reason code */
|
||||
#define WLC_E_REASON_HOST_DIRECT 0
|
||||
#define WLC_E_REASON_INFRA_ASSOC 1
|
||||
#define WLC_E_REASON_INFRA_ROAM 2
|
||||
#define WLC_E_REASON_INFRA_DISASSOC 3
|
||||
#define WLC_E_REASON_NO_MODE_CHANGE_NEEDED 4
|
||||
#define WLC_E_REASON_AWDL_ENABLE 5
|
||||
#define WLC_E_REASON_AWDL_DISABLE 6
|
||||
|
||||
/* WLC_E_SDB_TRANSITION event data */
|
||||
#define WL_MAX_BSSCFG 4
|
||||
#define WL_EVENT_SDB_TRANSITION_VER 1
|
||||
typedef struct wl_event_sdb_data {
|
||||
uint8 wlunit; /* Core index */
|
||||
uint8 is_iftype; /* Interface Type(Station, SoftAP, P2P_GO, P2P_GC */
|
||||
uint16 chanspec; /* Interface Channel/Chanspec */
|
||||
char ssidbuf[(4 * 32) + 1]; /* SSID_FMT_BUF_LEN: ((4 * DOT11_MAX_SSID_LEN) + 1) */
|
||||
} wl_event_sdb_data_t;
|
||||
|
||||
typedef struct wl_event_sdb_trans {
|
||||
uint8 version; /* Event Data Version */
|
||||
uint8 rsdb_mode;
|
||||
uint8 enable_bsscfg;
|
||||
uint8 reserved;
|
||||
struct wl_event_sdb_data values[WL_MAX_BSSCFG];
|
||||
} wl_event_sdb_trans_t;
|
||||
|
||||
/* roam reason codes */
|
||||
#define WLC_E_REASON_INITIAL_ASSOC 0 /* initial assoc */
|
||||
#define WLC_E_REASON_LOW_RSSI 1 /* roamed due to low RSSI */
|
||||
#define WLC_E_REASON_DEAUTH 2 /* roamed due to DEAUTH indication */
|
||||
#define WLC_E_REASON_DISASSOC 3 /* roamed due to DISASSOC indication */
|
||||
#define WLC_E_REASON_BCNS_LOST 4 /* roamed due to lost beacons */
|
||||
|
||||
#define WLC_E_REASON_FAST_ROAM_FAILED 5 /* roamed due to fast roam failure */
|
||||
#define WLC_E_REASON_DIRECTED_ROAM 6 /* roamed due to request by AP */
|
||||
#define WLC_E_REASON_TSPEC_REJECTED 7 /* roamed due to TSPEC rejection */
|
||||
#define WLC_E_REASON_BETTER_AP 8 /* roamed due to finding better AP */
|
||||
#define WLC_E_REASON_MINTXRATE 9 /* roamed because at mintxrate for too long */
|
||||
#define WLC_E_REASON_TXFAIL 10 /* We can hear AP, but AP can't hear us */
|
||||
/* retained for precommit auto-merging errors; remove once all branches are synced */
|
||||
#define WLC_E_REASON_REQUESTED_ROAM 11
|
||||
#define WLC_E_REASON_BSSTRANS_REQ 11 /* roamed due to BSS Transition request by AP */
|
||||
#define WLC_E_REASON_LOW_RSSI_CU 12 /* roamed due to low RSSI and Channel Usage */
|
||||
#define WLC_E_REASON_RADAR_DETECTED 13 /* roamed due to radar detection by STA */
|
||||
|
||||
/* prune reason codes */
|
||||
#define WLC_E_PRUNE_ENCR_MISMATCH 1 /* encryption mismatch */
|
||||
#define WLC_E_PRUNE_BCAST_BSSID 2 /* AP uses a broadcast BSSID */
|
||||
#define WLC_E_PRUNE_MAC_DENY 3 /* STA's MAC addr is in AP's MAC deny list */
|
||||
#define WLC_E_PRUNE_MAC_NA 4 /* STA's MAC addr is not in AP's MAC allow list */
|
||||
#define WLC_E_PRUNE_REG_PASSV 5 /* AP not allowed due to regulatory restriction */
|
||||
#define WLC_E_PRUNE_SPCT_MGMT 6 /* AP does not support STA locale spectrum mgmt */
|
||||
#define WLC_E_PRUNE_RADAR 7 /* AP is on a radar channel of STA locale */
|
||||
#define WLC_E_RSN_MISMATCH 8 /* STA does not support AP's RSN */
|
||||
#define WLC_E_PRUNE_NO_COMMON_RATES 9 /* No rates in common with AP */
|
||||
#define WLC_E_PRUNE_BASIC_RATES 10 /* STA does not support all basic rates of BSS */
|
||||
#define WLC_E_PRUNE_CIPHER_NA 12 /* BSS's cipher not supported */
|
||||
#define WLC_E_PRUNE_KNOWN_STA 13 /* AP is already known to us as a STA */
|
||||
#define WLC_E_PRUNE_WDS_PEER 15 /* AP is already known to us as a WDS peer */
|
||||
#define WLC_E_PRUNE_QBSS_LOAD 16 /* QBSS LOAD - AAC is too low */
|
||||
#define WLC_E_PRUNE_HOME_AP 17 /* prune home AP */
|
||||
#define WLC_E_PRUNE_AUTH_RESP_MAC 20 /* suppress auth resp by MAC filter */
|
||||
|
||||
/* WPA failure reason codes carried in the WLC_E_PSK_SUP event */
|
||||
#define WLC_E_SUP_OTHER 0 /* Other reason */
|
||||
#define WLC_E_SUP_DECRYPT_KEY_DATA 1 /* Decryption of key data failed */
|
||||
#define WLC_E_SUP_BAD_UCAST_WEP128 2 /* Illegal use of ucast WEP128 */
|
||||
#define WLC_E_SUP_BAD_UCAST_WEP40 3 /* Illegal use of ucast WEP40 */
|
||||
#define WLC_E_SUP_UNSUP_KEY_LEN 4 /* Unsupported key length */
|
||||
#define WLC_E_SUP_PW_KEY_CIPHER 5 /* Unicast cipher mismatch in pairwise key */
|
||||
#define WLC_E_SUP_MSG3_TOO_MANY_IE 6 /* WPA IE contains > 1 RSN IE in key msg 3 */
|
||||
#define WLC_E_SUP_MSG3_IE_MISMATCH 7 /* WPA IE mismatch in key message 3 */
|
||||
#define WLC_E_SUP_NO_INSTALL_FLAG 8 /* INSTALL flag unset in 4-way msg */
|
||||
#define WLC_E_SUP_MSG3_NO_GTK 9 /* encapsulated GTK missing from msg 3 */
|
||||
#define WLC_E_SUP_GRP_KEY_CIPHER 10 /* Multicast cipher mismatch in group key */
|
||||
#define WLC_E_SUP_GRP_MSG1_NO_GTK 11 /* encapsulated GTK missing from group msg 1 */
|
||||
#define WLC_E_SUP_GTK_DECRYPT_FAIL 12 /* GTK decrypt failure */
|
||||
#define WLC_E_SUP_SEND_FAIL 13 /* message send failure */
|
||||
#define WLC_E_SUP_DEAUTH 14 /* received FC_DEAUTH */
|
||||
#define WLC_E_SUP_WPA_PSK_TMO 15 /* WPA PSK 4-way handshake timeout */
|
||||
#define WLC_E_SUP_WPA_PSK_M1_TMO 16 /* WPA PSK 4-way handshake M1 timeout */
|
||||
#define WLC_E_SUP_WPA_PSK_M3_TMO 17 /* WPA PSK 4-way handshake M3 timeout */
|
||||
|
||||
|
||||
/* Ucode reason codes carried in the WLC_E_MACDBG event */
|
||||
#define WLC_E_MACDBG_LIST_PSM 0 /* Dump list update for PSM registers */
|
||||
#define WLC_E_MACDBG_LIST_PSMX 1 /* Dump list update for PSMx registers */
|
||||
#define WLC_E_MACDBG_REGALL 2 /* Dump all registers */
|
||||
|
||||
/* Event data for events that include frames received over the air */
|
||||
/* WLC_E_PROBRESP_MSG
|
||||
* WLC_E_P2P_PROBREQ_MSG
|
||||
* WLC_E_ACTION_FRAME_RX
|
||||
*/
|
||||
typedef BWL_PRE_PACKED_STRUCT struct wl_event_rx_frame_data {
|
||||
uint16 version;
|
||||
uint16 channel; /* Matches chanspec_t format from bcmwifi_channels.h */
|
||||
int32 rssi;
|
||||
uint32 mactime;
|
||||
uint32 rate;
|
||||
} BWL_POST_PACKED_STRUCT wl_event_rx_frame_data_t;
|
||||
|
||||
#define BCM_RX_FRAME_DATA_VERSION 1
|
||||
|
||||
/* WLC_E_IF event data */
|
||||
typedef struct wl_event_data_if {
|
||||
uint8 ifidx; /* RTE virtual device index (for dongle) */
|
||||
uint8 opcode; /* see I/F opcode */
|
||||
uint8 reserved; /* bit mask (WLC_E_IF_FLAGS_XXX ) */
|
||||
uint8 bssidx; /* bsscfg index */
|
||||
uint8 role; /* see I/F role */
|
||||
} wl_event_data_if_t;
|
||||
|
||||
/* WLC_E_NATOE event data */
|
||||
typedef struct wl_event_data_natoe {
|
||||
uint32 natoe_active;
|
||||
uint32 sta_ip;
|
||||
uint16 start_port;
|
||||
uint16 end_port;
|
||||
} wl_event_data_natoe_t;
|
||||
|
||||
/* opcode in WLC_E_IF event */
|
||||
#define WLC_E_IF_ADD 1 /* bsscfg add */
|
||||
#define WLC_E_IF_DEL 2 /* bsscfg delete */
|
||||
#define WLC_E_IF_CHANGE 3 /* bsscfg role change */
|
||||
|
||||
/* I/F role code in WLC_E_IF event */
|
||||
#define WLC_E_IF_ROLE_STA 0 /* Infra STA */
|
||||
#define WLC_E_IF_ROLE_AP 1 /* Access Point */
|
||||
#define WLC_E_IF_ROLE_WDS 2 /* WDS link */
|
||||
#define WLC_E_IF_ROLE_P2P_GO 3 /* P2P Group Owner */
|
||||
#define WLC_E_IF_ROLE_P2P_CLIENT 4 /* P2P Client */
|
||||
#define WLC_E_IF_ROLE_IBSS 8 /* IBSS */
|
||||
#define WLC_E_IF_ROLE_NAN 9 /* NAN */
|
||||
|
||||
/* WLC_E_RSSI event data */
|
||||
typedef struct wl_event_data_rssi {
|
||||
int32 rssi;
|
||||
int32 snr;
|
||||
int32 noise;
|
||||
} wl_event_data_rssi_t;
|
||||
|
||||
/* WLC_E_IF flag */
|
||||
#define WLC_E_IF_FLAGS_BSSCFG_NOIF 0x1 /* no host I/F creation needed */
|
||||
|
||||
/* Reason codes for LINK */
|
||||
#define WLC_E_LINK_BCN_LOSS 1 /* Link down because of beacon loss */
|
||||
#define WLC_E_LINK_DISASSOC 2 /* Link down because of disassoc */
|
||||
#define WLC_E_LINK_ASSOC_REC 3 /* Link down because assoc recreate failed */
|
||||
#define WLC_E_LINK_BSSCFG_DIS 4 /* Link down due to bsscfg down */
|
||||
|
||||
|
||||
/* WLC_E_NDIS_LINK event data */
|
||||
typedef BWL_PRE_PACKED_STRUCT struct ndis_link_parms {
|
||||
struct ether_addr peer_mac; /* 6 bytes */
|
||||
uint16 chanspec; /* 2 bytes */
|
||||
uint32 link_speed; /* current datarate in units of 500 Kbit/s */
|
||||
uint32 max_link_speed; /* max possible datarate for link in units of 500 Kbit/s */
|
||||
int32 rssi; /* average rssi */
|
||||
} BWL_POST_PACKED_STRUCT ndis_link_parms_t;
|
||||
|
||||
/* reason codes for WLC_E_OVERLAY_REQ event */
|
||||
#define WLC_E_OVL_DOWNLOAD 0 /* overlay download request */
|
||||
#define WLC_E_OVL_UPDATE_IND 1 /* device indication of host overlay update */
|
||||
|
||||
/* reason codes for WLC_E_TDLS_PEER_EVENT event */
|
||||
#define WLC_E_TDLS_PEER_DISCOVERED 0 /* peer is ready to establish TDLS */
|
||||
#define WLC_E_TDLS_PEER_CONNECTED 1
|
||||
#define WLC_E_TDLS_PEER_DISCONNECTED 2
|
||||
|
||||
/* reason codes for WLC_E_RMC_EVENT event */
|
||||
#define WLC_E_REASON_RMC_NONE 0
|
||||
#define WLC_E_REASON_RMC_AR_LOST 1
|
||||
#define WLC_E_REASON_RMC_AR_NO_ACK 2
|
||||
|
||||
#ifdef WLTDLS
|
||||
/* TDLS Action Category code */
|
||||
#define TDLS_AF_CATEGORY 12
|
||||
/* Wi-Fi Display (WFD) Vendor Specific Category */
|
||||
/* used for WFD Tunneled Probe Request and Response */
|
||||
#define TDLS_VENDOR_SPECIFIC 127
|
||||
/* TDLS Action Field Values */
|
||||
#define TDLS_ACTION_SETUP_REQ 0
|
||||
#define TDLS_ACTION_SETUP_RESP 1
|
||||
#define TDLS_ACTION_SETUP_CONFIRM 2
|
||||
#define TDLS_ACTION_TEARDOWN 3
|
||||
#define WLAN_TDLS_SET_PROBE_WFD_IE 11
|
||||
#define WLAN_TDLS_SET_SETUP_WFD_IE 12
|
||||
#define WLAN_TDLS_SET_WFD_ENABLED 13
|
||||
#define WLAN_TDLS_SET_WFD_DISABLED 14
|
||||
#endif
|
||||
|
||||
/* WLC_E_RANGING_EVENT subtypes */
|
||||
#define WLC_E_RANGING_RESULTS 0
|
||||
|
||||
|
||||
/* GAS event data */
|
||||
typedef BWL_PRE_PACKED_STRUCT struct wl_event_gas {
|
||||
uint16 channel; /* channel of GAS protocol */
|
||||
uint8 dialog_token; /* GAS dialog token */
|
||||
uint8 fragment_id; /* fragment id */
|
||||
uint16 status_code; /* status code on GAS completion */
|
||||
uint16 data_len; /* length of data to follow */
|
||||
uint8 data[1]; /* variable length specified by data_len */
|
||||
} BWL_POST_PACKED_STRUCT wl_event_gas_t;
|
||||
|
||||
/* service discovery TLV */
|
||||
typedef BWL_PRE_PACKED_STRUCT struct wl_sd_tlv {
|
||||
uint16 length; /* length of response_data */
|
||||
uint8 protocol; /* service protocol type */
|
||||
uint8 transaction_id; /* service transaction id */
|
||||
uint8 status_code; /* status code */
|
||||
uint8 data[1]; /* response data */
|
||||
} BWL_POST_PACKED_STRUCT wl_sd_tlv_t;
|
||||
|
||||
/* service discovery event data */
|
||||
typedef BWL_PRE_PACKED_STRUCT struct wl_event_sd {
|
||||
uint16 channel; /* channel */
|
||||
uint8 count; /* number of tlvs */
|
||||
wl_sd_tlv_t tlv[1]; /* service discovery TLV */
|
||||
} BWL_POST_PACKED_STRUCT wl_event_sd_t;
|
||||
|
||||
/* WLC_E_PKT_FILTER event sub-classification codes */
|
||||
#define WLC_E_PKT_FILTER_TIMEOUT 1 /* Matching packet not received in last timeout seconds */
|
||||
|
||||
/* Note: proxd has a new API (ver 3.0) deprecates the following */
|
||||
|
||||
/* Reason codes for WLC_E_PROXD */
|
||||
#define WLC_E_PROXD_FOUND 1 /* Found a proximity device */
|
||||
#define WLC_E_PROXD_GONE 2 /* Lost a proximity device */
|
||||
#define WLC_E_PROXD_START 3 /* used by: target */
|
||||
#define WLC_E_PROXD_STOP 4 /* used by: target */
|
||||
#define WLC_E_PROXD_COMPLETED 5 /* used by: initiator completed */
|
||||
#define WLC_E_PROXD_ERROR 6 /* used by both initiator and target */
|
||||
#define WLC_E_PROXD_COLLECT_START 7 /* used by: target & initiator */
|
||||
#define WLC_E_PROXD_COLLECT_STOP 8 /* used by: target */
|
||||
#define WLC_E_PROXD_COLLECT_COMPLETED 9 /* used by: initiator completed */
|
||||
#define WLC_E_PROXD_COLLECT_ERROR 10 /* used by both initiator and target */
|
||||
#define WLC_E_PROXD_NAN_EVENT 11 /* used by both initiator and target */
|
||||
#define WLC_E_PROXD_TS_RESULTS 12 /* used by: initiator completed */
|
||||
|
||||
/* proxd_event data */
|
||||
typedef struct ftm_sample {
|
||||
uint32 value; /* RTT in ns */
|
||||
int8 rssi; /* RSSI */
|
||||
} ftm_sample_t;
|
||||
|
||||
typedef struct ts_sample {
|
||||
uint32 t1;
|
||||
uint32 t2;
|
||||
uint32 t3;
|
||||
uint32 t4;
|
||||
} ts_sample_t;
|
||||
|
||||
typedef BWL_PRE_PACKED_STRUCT struct proxd_event_data {
|
||||
uint16 ver; /* version */
|
||||
uint16 mode; /* mode: target/initiator */
|
||||
uint16 method; /* method: rssi/TOF/AOA */
|
||||
uint8 err_code; /* error classification */
|
||||
uint8 TOF_type; /* one way or two way TOF */
|
||||
uint8 OFDM_frame_type; /* legacy or VHT */
|
||||
uint8 bandwidth; /* Bandwidth is 20, 40,80, MHZ */
|
||||
struct ether_addr peer_mac; /* (e.g for tgt:initiator's */
|
||||
uint32 distance; /* dst to tgt, units meter */
|
||||
uint32 meanrtt; /* mean delta */
|
||||
uint32 modertt; /* Mode delta */
|
||||
uint32 medianrtt; /* median RTT */
|
||||
uint32 sdrtt; /* Standard deviation of RTT */
|
||||
int32 gdcalcresult; /* Software or Hardware Kind of redundant, but if */
|
||||
/* frame type is VHT, then we should do it by hardware */
|
||||
int16 avg_rssi; /* avg rssi accroos the ftm frames */
|
||||
int16 validfrmcnt; /* Firmware's valid frame counts */
|
||||
int32 peer_router_info; /* Peer router information if available in TLV, */
|
||||
/* We will add this field later */
|
||||
int32 var1; /* average of group delay */
|
||||
int32 var2; /* average of threshold crossing */
|
||||
int32 var3; /* difference between group delay and threshold crossing */
|
||||
/* raw Fine Time Measurements (ftm) data */
|
||||
uint16 ftm_unit; /* ftm cnt resolution in picoseconds , 6250ps - default */
|
||||
uint16 ftm_cnt; /* num of rtd measurments/length in the ftm buffer */
|
||||
ftm_sample_t ftm_buff[1]; /* 1 ... ftm_cnt */
|
||||
} BWL_POST_PACKED_STRUCT wl_proxd_event_data_t;
|
||||
|
||||
typedef BWL_PRE_PACKED_STRUCT struct proxd_event_ts_results {
|
||||
uint16 ver; /* version */
|
||||
uint16 mode; /* mode: target/initiator */
|
||||
uint16 method; /* method: rssi/TOF/AOA */
|
||||
uint8 err_code; /* error classification */
|
||||
uint8 TOF_type; /* one way or two way TOF */
|
||||
uint16 ts_cnt; /* number of timestamp measurements */
|
||||
ts_sample_t ts_buff[1]; /* Timestamps */
|
||||
} BWL_POST_PACKED_STRUCT wl_proxd_event_ts_results_t;
|
||||
|
||||
|
||||
/* Video Traffic Interference Monitor Event */
|
||||
#define INTFER_EVENT_VERSION 1
|
||||
#define INTFER_STREAM_TYPE_NONTCP 1
|
||||
#define INTFER_STREAM_TYPE_TCP 2
|
||||
#define WLINTFER_STATS_NSMPLS 4
|
||||
typedef struct wl_intfer_event {
|
||||
uint16 version; /* version */
|
||||
uint16 status; /* status */
|
||||
uint8 txfail_histo[WLINTFER_STATS_NSMPLS]; /* txfail histo */
|
||||
} wl_intfer_event_t;
|
||||
|
||||
#define RRM_EVENT_VERSION 0
|
||||
typedef struct wl_rrm_event {
|
||||
int16 version;
|
||||
int16 len;
|
||||
int16 cat; /* Category */
|
||||
int16 subevent;
|
||||
char payload[1]; /* Measurement payload */
|
||||
} wl_rrm_event_t;
|
||||
|
||||
|
||||
/* WLC_E_PSTA_PRIMARY_INTF_IND event data */
|
||||
typedef struct wl_psta_primary_intf_event {
|
||||
struct ether_addr prim_ea; /* primary intf ether addr */
|
||||
} wl_psta_primary_intf_event_t;
|
||||
|
||||
/* WLC_E_DPSTA_INTF_IND event data */
|
||||
typedef enum {
|
||||
WL_INTF_PSTA = 1,
|
||||
WL_INTF_DWDS = 2
|
||||
} wl_dpsta_intf_type;
|
||||
|
||||
typedef struct wl_dpsta_intf_event {
|
||||
wl_dpsta_intf_type intf_type; /* dwds/psta intf register */
|
||||
} wl_dpsta_intf_event_t;
|
||||
|
||||
/* ********** NAN protocol events/subevents ********** */
|
||||
#define NAN_EVENT_BUFFER_SIZE 512 /* max size */
|
||||
/* NAN Events sent by firmware */
|
||||
|
||||
/*
|
||||
* If you make changes to this enum, dont forget to update the mask (if need be).
|
||||
*/
|
||||
typedef enum wl_nan_events {
|
||||
WL_NAN_EVENT_START = 1, /* NAN cluster started */
|
||||
WL_NAN_EVENT_JOIN = 2, /* To be deprecated */
|
||||
WL_NAN_EVENT_ROLE = 3, /* Role changed */
|
||||
WL_NAN_EVENT_SCAN_COMPLETE = 4, /* To be deprecated */
|
||||
WL_NAN_EVENT_DISCOVERY_RESULT = 5, /* Subscribe Received */
|
||||
WL_NAN_EVENT_REPLIED = 6, /* Publish Sent */
|
||||
WL_NAN_EVENT_TERMINATED = 7, /* sub / pub is terminated */
|
||||
WL_NAN_EVENT_RECEIVE = 8, /* Follow up Received */
|
||||
WL_NAN_EVENT_STATUS_CHG = 9, /* change in nan_mac status */
|
||||
WL_NAN_EVENT_MERGE = 10, /* Merged to a NAN cluster */
|
||||
WL_NAN_EVENT_STOP = 11, /* To be deprecated */
|
||||
WL_NAN_EVENT_P2P = 12, /* Unused */
|
||||
WL_NAN_EVENT_WINDOW_BEGIN_P2P = 13, /* Unused */
|
||||
WL_NAN_EVENT_WINDOW_BEGIN_MESH = 14, /* Unused */
|
||||
WL_NAN_EVENT_WINDOW_BEGIN_IBSS = 15, /* Unused */
|
||||
WL_NAN_EVENT_WINDOW_BEGIN_RANGING = 16, /* Unused */
|
||||
WL_NAN_EVENT_POST_DISC = 17, /* Event for post discovery data */
|
||||
WL_NAN_EVENT_DATA_IF_ADD = 18, /* Unused */
|
||||
WL_NAN_EVENT_DATA_PEER_ADD = 19, /* Event for peer add */
|
||||
/* nan 2.0 */
|
||||
/* Will be removed after source code is committed. */
|
||||
WL_NAN_EVENT_DATA_IND = 20,
|
||||
WL_NAN_EVENT_PEER_DATAPATH_IND = 20, /* Incoming DP req */
|
||||
/* Will be removed after source code is committed. */
|
||||
WL_NAN_EVENT_DATA_CONF = 21,
|
||||
WL_NAN_EVENT_DATAPATH_ESTB = 21, /* DP Established */
|
||||
WL_NAN_EVENT_SDF_RX = 22, /* SDF payload */
|
||||
WL_NAN_EVENT_DATAPATH_END = 23, /* DP Terminate recvd */
|
||||
/* Below event needs to be removed after source code is committed. */
|
||||
WL_NAN_EVENT_DATA_END = 23,
|
||||
WL_NAN_EVENT_BCN_RX = 24, /* received beacon payload */
|
||||
WL_NAN_EVENT_PEER_DATAPATH_RESP = 25, /* Peer's DP response */
|
||||
WL_NAN_EVENT_PEER_DATAPATH_CONF = 26, /* Peer's DP confirm */
|
||||
WL_NAN_EVENT_RNG_REQ_IND = 27, /* Range Request */
|
||||
WL_NAN_EVENT_RNG_RPT_IND = 28, /* Range Report */
|
||||
WL_NAN_EVENT_RNG_TERM_IND = 29, /* Range Termination */
|
||||
WL_NAN_EVENT_PEER_DATAPATH_SEC_INST = 30, /* Peer's DP sec install */
|
||||
WL_NAN_EVENT_TXS = 31, /* for tx status of follow-up and SDFs */
|
||||
WL_NAN_EVENT_INVALID /* delimiter for max value */
|
||||
} nan_app_events_e;
|
||||
|
||||
#define NAN_EV_MASK(ev) \
|
||||
(1 << (ev - 1))
|
||||
#define IS_NAN_EVT_ON(var, evt) ((var & (1 << (evt-1))) != 0)
|
||||
/* ******************* end of NAN section *************** */
|
||||
|
||||
/* WLC_E_ULP event data */
|
||||
#define WL_ULP_EVENT_VERSION 1
|
||||
#define WL_ULP_DISABLE_CONSOLE 1 /* Disable console message on ULP entry */
|
||||
#define WL_ULP_UCODE_DOWNLOAD 2 /* Download ULP ucode file */
|
||||
|
||||
typedef struct wl_ulp_event {
|
||||
uint16 version;
|
||||
uint16 ulp_dongle_action;
|
||||
} wl_ulp_event_t;
|
||||
|
||||
/* TCP keepalive event data */
|
||||
typedef BWL_PRE_PACKED_STRUCT struct wl_event_tko {
|
||||
uint8 index; /* TCP connection index, 0 to max-1 */
|
||||
uint8 pad[3]; /* 4-byte struct alignment */
|
||||
} BWL_POST_PACKED_STRUCT wl_event_tko_t;
|
||||
|
||||
typedef struct {
|
||||
uint8 radar_type; /* one of RADAR_TYPE_XXX */
|
||||
uint16 min_pw; /* minimum pulse-width (usec * 20) */
|
||||
uint16 max_pw; /* maximum pulse-width (usec * 20) */
|
||||
uint16 min_pri; /* minimum pulse repetition interval (usec) */
|
||||
uint16 max_pri; /* maximum pulse repetition interval (usec) */
|
||||
uint16 subband; /* subband/frequency */
|
||||
} radar_detected_event_info_t;
|
||||
typedef struct wl_event_radar_detect_data {
|
||||
|
||||
uint32 version;
|
||||
uint16 current_chanspec; /* chanspec on which the radar is recieved */
|
||||
uint16 target_chanspec; /* Target chanspec after detection of radar on current_chanspec */
|
||||
radar_detected_event_info_t radar_info[2];
|
||||
} wl_event_radar_detect_data_t;
|
||||
|
||||
|
||||
#define WL_EVENT_MODESW_VER_1 1
|
||||
#define WL_EVENT_MODESW_VER_CURRENT WL_EVENT_MODESW_VER_1
|
||||
|
||||
#define WL_E_MODESW_FLAG_MASK_DEVICE 0x01u /* mask of device: belongs to local or peer */
|
||||
#define WL_E_MODESW_FLAG_MASK_FROM 0x02u /* mask of origin: firmware or user */
|
||||
#define WL_E_MODESW_FLAG_MASK_STATE 0x0Cu /* mask of state: modesw progress state */
|
||||
|
||||
#define WL_E_MODESW_FLAG_DEVICE_LOCAL 0x00u /* flag - device: info is about self/local */
|
||||
#define WL_E_MODESW_FLAG_DEVICE_PEER 0x01u /* flag - device: info is about peer */
|
||||
|
||||
#define WL_E_MODESW_FLAG_FROM_FIRMWARE 0x00u /* flag - from: request is from firmware */
|
||||
#define WL_E_MODESW_FLAG_FROM_USER 0x02u /* flag - from: request is from user/iov */
|
||||
|
||||
#define WL_E_MODESW_FLAG_STATE_REQUESTED 0x00u /* flag - state: mode switch request */
|
||||
#define WL_E_MODESW_FLAG_STATE_INITIATED 0x04u /* flag - state: switch initiated */
|
||||
#define WL_E_MODESW_FLAG_STATE_COMPLETE 0x08u /* flag - state: switch completed/success */
|
||||
#define WL_E_MODESW_FLAG_STATE_FAILURE 0x0Cu /* flag - state: failed to switch */
|
||||
|
||||
/* Get sizeof *X including variable data's length where X is pointer to wl_event_mode_switch_t */
|
||||
#define WL_E_MODESW_SIZE(X) (sizeof(*(X)) + (X)->length)
|
||||
|
||||
/* Get variable data's length where X is pointer to wl_event_mode_switch_t */
|
||||
#define WL_E_MODESW_DATA_SIZE(X) (((X)->length > sizeof(*(X))) ? ((X)->length - sizeof(*(X))) : 0)
|
||||
|
||||
#define WL_E_MODESW_REASON_UNKNOWN 0u /* reason: UNKNOWN */
|
||||
#define WL_E_MODESW_REASON_ACSD 1u /* reason: ACSD (based on events from FW */
|
||||
#define WL_E_MODESW_REASON_OBSS_DBS 2u /* reason: OBSS DBS (eg. on interference) */
|
||||
#define WL_E_MODESW_REASON_DFS 3u /* reason: DFS (eg. on subband radar) */
|
||||
#define WL_E_MODESW_REASON_DYN160 4u /* reason: DYN160 (160/2x2 - 80/4x4) */
|
||||
|
||||
/* event structure for WLC_E_MODE_SWITCH */
|
||||
typedef struct {
|
||||
uint16 version;
|
||||
uint16 length; /* size including 'data' field */
|
||||
uint16 opmode_from;
|
||||
uint16 opmode_to;
|
||||
uint32 flags; /* bit 0: peer(/local==0);
|
||||
* bit 1: user(/firmware==0);
|
||||
* bits 3,2: 00==requested, 01==initiated,
|
||||
* 10==complete, 11==failure;
|
||||
* rest: reserved
|
||||
*/
|
||||
uint16 reason; /* value 0: unknown, 1: ACSD, 2: OBSS_DBS,
|
||||
* 3: DFS, 4: DYN160, rest: reserved
|
||||
*/
|
||||
uint16 data_offset; /* offset to 'data' from beginning of this struct.
|
||||
* fields may be added between data_offset and data
|
||||
*/
|
||||
/* ADD NEW FIELDS HERE */
|
||||
uint8 data[]; /* reason specific data; could be empty */
|
||||
} wl_event_mode_switch_t;
|
||||
|
||||
/* when reason in WLC_E_MODE_SWITCH is DYN160, data will carry the following structure */
|
||||
typedef struct {
|
||||
uint16 trigger; /* value 0: MU to SU, 1: SU to MU, 2: metric_dyn160, 3:re-/assoc,
|
||||
* 4: disassoc, 5: rssi, 6: traffic, 7: interference,
|
||||
* 8: chanim_stats
|
||||
*/
|
||||
struct ether_addr sta_addr; /* causal STA's MAC address when known */
|
||||
uint16 metric_160_80; /* latest dyn160 metric */
|
||||
uint8 nss; /* NSS of the STA */
|
||||
uint8 bw; /* BW of the STA */
|
||||
int8 rssi; /* RSSI of the STA */
|
||||
uint8 traffic; /* internal metric of traffic */
|
||||
} wl_event_mode_switch_dyn160;
|
||||
|
||||
#define WL_EVENT_FBT_VER_1 1
|
||||
|
||||
#define WL_E_FBT_TYPE_FBT_OTD_AUTH 1
|
||||
#define WL_E_FBT_TYPE_FBT_OTA_AUTH 2
|
||||
|
||||
/* event structure for WLC_E_FBT */
|
||||
typedef struct {
|
||||
uint16 version;
|
||||
uint16 length; /* size including 'data' field */
|
||||
uint16 type; /* value 0: unknown, 1: FBT OTD Auth Req */
|
||||
uint16 data_offset; /* offset to 'data' from beginning of this struct.
|
||||
* fields may be added between data_offset and data
|
||||
*/
|
||||
/* ADD NEW FIELDS HERE */
|
||||
uint8 data[]; /* type specific data; could be empty */
|
||||
} wl_event_fbt_t;
|
||||
|
||||
/* TWT Setup Completion is designed to notify the user of TWT Setup process
|
||||
* status. When 'status' field is value of BCME_OK, the user must check the
|
||||
* 'setup_cmd' field value in 'wl_twt_sdesc_t' structure that at the end of
|
||||
* the event data to see the response from the TWT Responding STA; when
|
||||
* 'status' field is value of BCME_ERROR or non BCME_OK, user must not use
|
||||
* anything from 'wl_twt_sdesc_t' structure as it is the TWT Requesting STA's
|
||||
* own TWT parameter.
|
||||
*/
|
||||
|
||||
#define WL_TWT_SETUP_CPLT_VER 0
|
||||
|
||||
/* TWT Setup Completion event data */
|
||||
typedef struct wl_twt_setup_cplt {
|
||||
uint16 version;
|
||||
uint16 length; /* the byte count of fields from 'dialog' onwards */
|
||||
uint8 dialog; /* the dialog token user supplied to the TWT setup API */
|
||||
uint8 pad[3];
|
||||
int32 status;
|
||||
/* wl_twt_sdesc_t desc; - defined in wlioctl.h */
|
||||
} wl_twt_setup_cplt_t;
|
||||
|
||||
#define WL_INVALID_IE_EVENT_VERSION 0
|
||||
|
||||
/* Invalid IE Event data */
|
||||
typedef struct wl_invalid_ie_event {
|
||||
uint16 version;
|
||||
uint16 len; /* Length of the invalid IE copy */
|
||||
uint16 type; /* Type/subtype of the frame which contains the invalid IE */
|
||||
uint16 error; /* error code of the wrong IE, defined in ie_error_code_t */
|
||||
uint8 ie[]; /* Variable length buffer for the invalid IE copy */
|
||||
} wl_invalid_ie_event_t;
|
||||
|
||||
/* Fixed header portion of Invalid IE Event */
|
||||
typedef struct wl_invalid_ie_event_hdr {
|
||||
uint16 version;
|
||||
uint16 len; /* Length of the invalid IE copy */
|
||||
uint16 type; /* Type/subtype of the frame which contains the invalid IE */
|
||||
uint16 error; /* error code of the wrong IE, defined in ie_error_code_t */
|
||||
/* var length IE data follows */
|
||||
} wl_invalid_ie_event_hdr_t;
|
||||
|
||||
typedef enum ie_error_code {
|
||||
IE_ERROR_OUT_OF_RANGE = 0x01
|
||||
} ie_error_code_t;
|
||||
|
||||
/* This marks the end of a packed structure section. */
|
||||
#include <packed_section_end.h>
|
||||
|
||||
/* reason of channel switch */
|
||||
typedef enum {
|
||||
CHANSW_DFS = 10, /* channel switch due to DFS module */
|
||||
CHANSW_HOMECH_REQ = 14, /* channel switch due to HOME Channel Request */
|
||||
CHANSW_STA = 15, /* channel switch due to STA */
|
||||
CHANSW_SOFTAP = 16, /* channel switch due to SodtAP */
|
||||
CHANSW_AIBSS = 17, /* channel switch due to AIBSS */
|
||||
CHANSW_NAN = 18, /* channel switch due to NAN */
|
||||
CHANSW_NAN_DISC = 19, /* channel switch due to NAN Disc */
|
||||
CHANSW_NAN_SCHED = 20, /* channel switch due to NAN Sched */
|
||||
CHANSW_AWDL_AW = 21, /* channel switch due to AWDL aw */
|
||||
CHANSW_AWDL_SYNC = 22, /* channel switch due to AWDL sync */
|
||||
CHANSW_AWDL_CAL = 23, /* channel switch due to AWDL Cal */
|
||||
CHANSW_AWDL_PSF = 24, /* channel switch due to AWDL PSF */
|
||||
CHANSW_AWDL_OOB_AF = 25, /* channel switch due to AWDL OOB action frame */
|
||||
CHANSW_TDLS = 26, /* channel switch due to TDLS */
|
||||
CHANSW_PROXD = 27, /* channel switch due to PROXD */
|
||||
CHANSW_MAX_NUMBER = 28 /* max channel switch reason */
|
||||
} wl_chansw_reason_t;
|
||||
|
||||
#define CHANSW_REASON(reason) (1 << reason)
|
||||
|
||||
#define EVENT_AGGR_DATA_HDR_LEN 8
|
||||
|
||||
typedef struct event_aggr_data {
|
||||
uint16 num_events; /* No of events aggregated */
|
||||
uint16 len; /* length of the aggregated events, excludes padding */
|
||||
uint8 pad[4]; /* Padding to make aggr event packet header aligned
|
||||
* on 64-bit boundary, for a 64-bit host system.
|
||||
*/
|
||||
uint8 data[]; /* Aggregate buffer containing Events */
|
||||
} event_aggr_data_t;
|
||||
|
||||
|
||||
/* WLC_E_TVPM_MITIGATION event structure version */
|
||||
#define WL_TVPM_MITIGATION_VERSION 1
|
||||
|
||||
/* TVPM mitigation on/off status bits */
|
||||
#define WL_TVPM_MITIGATION_TXDC 0x1
|
||||
#define WL_TVPM_MITIGATION_TXPOWER 0x2
|
||||
#define WL_TVPM_MITIGATION_TXCHAINS 0x4
|
||||
|
||||
/* Event structure for WLC_E_TVPM_MITIGATION */
|
||||
typedef struct wl_event_tvpm_mitigation {
|
||||
uint16 version; /* structure version */
|
||||
uint16 length; /* length of this structure */
|
||||
uint32 timestamp_ms; /* millisecond timestamp */
|
||||
uint8 slice; /* slice number */
|
||||
uint8 pad;
|
||||
uint16 on_off; /* mitigation status bits */
|
||||
} wl_event_tvpm_mitigation_t;
|
||||
|
||||
#endif /* _BCMEVENT_H_ */
|
|
@ -0,0 +1,249 @@
|
|||
/*
|
||||
* Fundamental constants relating to IP Protocol
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: bcmip.h 700076 2017-05-17 14:42:22Z $
|
||||
*/
|
||||
|
||||
#ifndef _bcmip_h_
|
||||
#define _bcmip_h_
|
||||
|
||||
#ifndef _TYPEDEFS_H_
|
||||
#include <typedefs.h>
|
||||
#endif
|
||||
|
||||
/* This marks the start of a packed structure section. */
|
||||
#include <packed_section_start.h>
|
||||
|
||||
|
||||
/* IPV4 and IPV6 common */
|
||||
#define IP_VER_OFFSET 0x0 /* offset to version field */
|
||||
#define IP_VER_MASK 0xf0 /* version mask */
|
||||
#define IP_VER_SHIFT 4 /* version shift */
|
||||
#define IP_VER_4 4 /* version number for IPV4 */
|
||||
#define IP_VER_6 6 /* version number for IPV6 */
|
||||
|
||||
#define IP_VER(ip_body) \
|
||||
((((uint8 *)(ip_body))[IP_VER_OFFSET] & IP_VER_MASK) >> IP_VER_SHIFT)
|
||||
|
||||
#define IP_PROT_ICMP 0x1 /* ICMP protocol */
|
||||
#define IP_PROT_IGMP 0x2 /* IGMP protocol */
|
||||
#define IP_PROT_TCP 0x6 /* TCP protocol */
|
||||
#define IP_PROT_UDP 0x11 /* UDP protocol type */
|
||||
#define IP_PROT_GRE 0x2f /* GRE protocol type */
|
||||
#define IP_PROT_ICMP6 0x3a /* ICMPv6 protocol type */
|
||||
|
||||
/* IPV4 field offsets */
|
||||
#define IPV4_VER_HL_OFFSET 0 /* version and ihl byte offset */
|
||||
#define IPV4_TOS_OFFSET 1 /* type of service offset */
|
||||
#define IPV4_PKTLEN_OFFSET 2 /* packet length offset */
|
||||
#define IPV4_PKTFLAG_OFFSET 6 /* more-frag,dont-frag flag offset */
|
||||
#define IPV4_PROT_OFFSET 9 /* protocol type offset */
|
||||
#define IPV4_CHKSUM_OFFSET 10 /* IP header checksum offset */
|
||||
#define IPV4_SRC_IP_OFFSET 12 /* src IP addr offset */
|
||||
#define IPV4_DEST_IP_OFFSET 16 /* dest IP addr offset */
|
||||
#define IPV4_OPTIONS_OFFSET 20 /* IP options offset */
|
||||
#define IPV4_MIN_HEADER_LEN 20 /* Minimum size for an IP header (no options) */
|
||||
|
||||
/* IPV4 field decodes */
|
||||
#define IPV4_VER_MASK 0xf0 /* IPV4 version mask */
|
||||
#define IPV4_VER_SHIFT 4 /* IPV4 version shift */
|
||||
|
||||
#define IPV4_HLEN_MASK 0x0f /* IPV4 header length mask */
|
||||
#define IPV4_HLEN(ipv4_body) (4 * (((uint8 *)(ipv4_body))[IPV4_VER_HL_OFFSET] & IPV4_HLEN_MASK))
|
||||
|
||||
#define IPV4_ADDR_LEN 4 /* IPV4 address length */
|
||||
|
||||
#define IPV4_ADDR_NULL(a) ((((uint8 *)(a))[0] | ((uint8 *)(a))[1] | \
|
||||
((uint8 *)(a))[2] | ((uint8 *)(a))[3]) == 0)
|
||||
|
||||
#define IPV4_ADDR_BCAST(a) ((((uint8 *)(a))[0] & ((uint8 *)(a))[1] & \
|
||||
((uint8 *)(a))[2] & ((uint8 *)(a))[3]) == 0xff)
|
||||
|
||||
#define IPV4_TOS_DSCP_MASK 0xfc /* DiffServ codepoint mask */
|
||||
#define IPV4_TOS_DSCP_SHIFT 2 /* DiffServ codepoint shift */
|
||||
|
||||
#define IPV4_TOS(ipv4_body) (((uint8 *)(ipv4_body))[IPV4_TOS_OFFSET])
|
||||
|
||||
#define IPV4_TOS_PREC_MASK 0xe0 /* Historical precedence mask */
|
||||
#define IPV4_TOS_PREC_SHIFT 5 /* Historical precedence shift */
|
||||
|
||||
#define IPV4_TOS_LOWDELAY 0x10 /* Lowest delay requested */
|
||||
#define IPV4_TOS_THROUGHPUT 0x8 /* Best throughput requested */
|
||||
#define IPV4_TOS_RELIABILITY 0x4 /* Most reliable delivery requested */
|
||||
|
||||
#define IPV4_TOS_ROUTINE 0
|
||||
#define IPV4_TOS_PRIORITY 1
|
||||
#define IPV4_TOS_IMMEDIATE 2
|
||||
#define IPV4_TOS_FLASH 3
|
||||
#define IPV4_TOS_FLASHOVERRIDE 4
|
||||
#define IPV4_TOS_CRITICAL 5
|
||||
#define IPV4_TOS_INETWORK_CTRL 6
|
||||
#define IPV4_TOS_NETWORK_CTRL 7
|
||||
|
||||
#define IPV4_PROT(ipv4_body) (((uint8 *)(ipv4_body))[IPV4_PROT_OFFSET])
|
||||
|
||||
#define IPV4_FRAG_RESV 0x8000 /* Reserved */
|
||||
#define IPV4_FRAG_DONT 0x4000 /* Don't fragment */
|
||||
#define IPV4_FRAG_MORE 0x2000 /* More fragments */
|
||||
#define IPV4_FRAG_OFFSET_MASK 0x1fff /* Fragment offset */
|
||||
|
||||
#define IPV4_ADDR_STR_LEN 16 /* Max IP address length in string format */
|
||||
|
||||
/* IPV4 packet formats */
|
||||
BWL_PRE_PACKED_STRUCT struct ipv4_addr {
|
||||
uint8 addr[IPV4_ADDR_LEN];
|
||||
} BWL_POST_PACKED_STRUCT;
|
||||
|
||||
BWL_PRE_PACKED_STRUCT struct ipv4_hdr {
|
||||
uint8 version_ihl; /* Version and Internet Header Length */
|
||||
uint8 tos; /* Type Of Service */
|
||||
uint16 tot_len; /* Number of bytes in packet (max 65535) */
|
||||
uint16 id;
|
||||
uint16 frag; /* 3 flag bits and fragment offset */
|
||||
uint8 ttl; /* Time To Live */
|
||||
uint8 prot; /* Protocol */
|
||||
uint16 hdr_chksum; /* IP header checksum */
|
||||
uint8 src_ip[IPV4_ADDR_LEN]; /* Source IP Address */
|
||||
uint8 dst_ip[IPV4_ADDR_LEN]; /* Destination IP Address */
|
||||
} BWL_POST_PACKED_STRUCT;
|
||||
|
||||
/* IPV6 field offsets */
|
||||
#define IPV6_PAYLOAD_LEN_OFFSET 4 /* payload length offset */
|
||||
#define IPV6_NEXT_HDR_OFFSET 6 /* next header/protocol offset */
|
||||
#define IPV6_HOP_LIMIT_OFFSET 7 /* hop limit offset */
|
||||
#define IPV6_SRC_IP_OFFSET 8 /* src IP addr offset */
|
||||
#define IPV6_DEST_IP_OFFSET 24 /* dst IP addr offset */
|
||||
|
||||
/* IPV6 field decodes */
|
||||
#define IPV6_TRAFFIC_CLASS(ipv6_body) \
|
||||
(((((uint8 *)(ipv6_body))[0] & 0x0f) << 4) | \
|
||||
((((uint8 *)(ipv6_body))[1] & 0xf0) >> 4))
|
||||
|
||||
#define IPV6_FLOW_LABEL(ipv6_body) \
|
||||
(((((uint8 *)(ipv6_body))[1] & 0x0f) << 16) | \
|
||||
(((uint8 *)(ipv6_body))[2] << 8) | \
|
||||
(((uint8 *)(ipv6_body))[3]))
|
||||
|
||||
#define IPV6_PAYLOAD_LEN(ipv6_body) \
|
||||
((((uint8 *)(ipv6_body))[IPV6_PAYLOAD_LEN_OFFSET + 0] << 8) | \
|
||||
((uint8 *)(ipv6_body))[IPV6_PAYLOAD_LEN_OFFSET + 1])
|
||||
|
||||
#define IPV6_NEXT_HDR(ipv6_body) \
|
||||
(((uint8 *)(ipv6_body))[IPV6_NEXT_HDR_OFFSET])
|
||||
|
||||
#define IPV6_PROT(ipv6_body) IPV6_NEXT_HDR(ipv6_body)
|
||||
|
||||
#define IPV6_ADDR_LEN 16 /* IPV6 address length */
|
||||
|
||||
/* IPV4 TOS or IPV6 Traffic Classifier or 0 */
|
||||
#define IP_TOS46(ip_body) \
|
||||
(IP_VER(ip_body) == IP_VER_4 ? IPV4_TOS(ip_body) : \
|
||||
IP_VER(ip_body) == IP_VER_6 ? IPV6_TRAFFIC_CLASS(ip_body) : 0)
|
||||
|
||||
#define IP_DSCP46(ip_body) (IP_TOS46(ip_body) >> IPV4_TOS_DSCP_SHIFT);
|
||||
|
||||
/* IPV4 or IPV6 Protocol Classifier or 0 */
|
||||
#define IP_PROT46(ip_body) \
|
||||
(IP_VER(ip_body) == IP_VER_4 ? IPV4_PROT(ip_body) : \
|
||||
IP_VER(ip_body) == IP_VER_6 ? IPV6_PROT(ip_body) : 0)
|
||||
|
||||
/* IPV6 extension headers (options) */
|
||||
#define IPV6_EXTHDR_HOP 0
|
||||
#define IPV6_EXTHDR_ROUTING 43
|
||||
#define IPV6_EXTHDR_FRAGMENT 44
|
||||
#define IPV6_EXTHDR_AUTH 51
|
||||
#define IPV6_EXTHDR_NONE 59
|
||||
#define IPV6_EXTHDR_DEST 60
|
||||
|
||||
#define IPV6_EXTHDR(prot) (((prot) == IPV6_EXTHDR_HOP) || \
|
||||
((prot) == IPV6_EXTHDR_ROUTING) || \
|
||||
((prot) == IPV6_EXTHDR_FRAGMENT) || \
|
||||
((prot) == IPV6_EXTHDR_AUTH) || \
|
||||
((prot) == IPV6_EXTHDR_NONE) || \
|
||||
((prot) == IPV6_EXTHDR_DEST))
|
||||
|
||||
#define IPV6_MIN_HLEN 40
|
||||
|
||||
#define IPV6_EXTHDR_LEN(eh) ((((struct ipv6_exthdr *)(eh))->hdrlen + 1) << 3)
|
||||
|
||||
BWL_PRE_PACKED_STRUCT struct ipv6_exthdr {
|
||||
uint8 nexthdr;
|
||||
uint8 hdrlen;
|
||||
} BWL_POST_PACKED_STRUCT;
|
||||
|
||||
BWL_PRE_PACKED_STRUCT struct ipv6_exthdr_frag {
|
||||
uint8 nexthdr;
|
||||
uint8 rsvd;
|
||||
uint16 frag_off;
|
||||
uint32 ident;
|
||||
} BWL_POST_PACKED_STRUCT;
|
||||
|
||||
static INLINE int32
|
||||
ipv6_exthdr_len(uint8 *h, uint8 *proto)
|
||||
{
|
||||
uint16 len = 0, hlen;
|
||||
struct ipv6_exthdr *eh = (struct ipv6_exthdr *)h;
|
||||
|
||||
while (IPV6_EXTHDR(eh->nexthdr)) {
|
||||
if (eh->nexthdr == IPV6_EXTHDR_NONE)
|
||||
return -1;
|
||||
else if (eh->nexthdr == IPV6_EXTHDR_FRAGMENT)
|
||||
hlen = 8;
|
||||
else if (eh->nexthdr == IPV6_EXTHDR_AUTH)
|
||||
hlen = (eh->hdrlen + 2) << 2;
|
||||
else
|
||||
hlen = IPV6_EXTHDR_LEN(eh);
|
||||
|
||||
len += hlen;
|
||||
eh = (struct ipv6_exthdr *)(h + len);
|
||||
}
|
||||
|
||||
*proto = eh->nexthdr;
|
||||
return len;
|
||||
}
|
||||
|
||||
#define IPV4_ISMULTI(a) (((a) & 0xf0000000) == 0xe0000000)
|
||||
|
||||
#define IPV4_MCAST_TO_ETHER_MCAST(ipv4, ether) \
|
||||
{ \
|
||||
ether[0] = 0x01; \
|
||||
ether[1] = 0x00; \
|
||||
ether[2] = 0x5E; \
|
||||
ether[3] = (ipv4 & 0x7f0000) >> 16; \
|
||||
ether[4] = (ipv4 & 0xff00) >> 8; \
|
||||
ether[5] = (ipv4 & 0xff); \
|
||||
}
|
||||
|
||||
/* This marks the end of a packed structure section. */
|
||||
#include <packed_section_end.h>
|
||||
|
||||
#define IPV4_ADDR_STR "%d.%d.%d.%d"
|
||||
#define IPV4_ADDR_TO_STR(addr) ((uint32)addr & 0xff000000) >> 24, \
|
||||
((uint32)addr & 0x00ff0000) >> 16, \
|
||||
((uint32)addr & 0x0000ff00) >> 8, \
|
||||
((uint32)addr & 0x000000ff)
|
||||
|
||||
#endif /* _bcmip_h_ */
|
|
@ -0,0 +1,163 @@
|
|||
/*
|
||||
* Fundamental constants relating to Neighbor Discovery Protocol
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: bcmipv6.h 700076 2017-05-17 14:42:22Z $
|
||||
*/
|
||||
|
||||
#ifndef _bcmipv6_h_
|
||||
#define _bcmipv6_h_
|
||||
|
||||
#ifndef _TYPEDEFS_H_
|
||||
#include <typedefs.h>
|
||||
#endif
|
||||
|
||||
/* This marks the start of a packed structure section. */
|
||||
#include <packed_section_start.h>
|
||||
|
||||
/* Extension headers */
|
||||
#define IPV6_EXT_HOP 0
|
||||
#define IPV6_EXT_ROUTE 43
|
||||
#define IPV6_EXT_FRAG 44
|
||||
#define IPV6_EXT_DEST 60
|
||||
#define IPV6_EXT_ESEC 50
|
||||
#define IPV6_EXT_AUTH 51
|
||||
|
||||
/* Minimum size (extension header "word" length) */
|
||||
#define IPV6_EXT_WORD 8
|
||||
|
||||
/* Offsets for most extension headers */
|
||||
#define IPV6_EXT_NEXTHDR 0
|
||||
#define IPV6_EXT_HDRLEN 1
|
||||
|
||||
/* Constants specific to fragmentation header */
|
||||
#define IPV6_FRAG_MORE_MASK 0x0001
|
||||
#define IPV6_FRAG_MORE_SHIFT 0
|
||||
#define IPV6_FRAG_OFFS_MASK 0xfff8
|
||||
#define IPV6_FRAG_OFFS_SHIFT 3
|
||||
|
||||
/* For icmpv6 */
|
||||
#define ICMPV6_HEADER_TYPE 0x3A
|
||||
#define ICMPV6_PKT_TYPE_RA 134
|
||||
#define ICMPV6_PKT_TYPE_NS 135
|
||||
#define ICMPV6_PKT_TYPE_NA 136
|
||||
|
||||
#define ICMPV6_ND_OPT_TYPE_TARGET_MAC 2
|
||||
#define ICMPV6_ND_OPT_TYPE_SRC_MAC 1
|
||||
|
||||
#define ICMPV6_ND_OPT_LEN_LINKADDR 1
|
||||
|
||||
#define ICMPV6_ND_OPT_LEN_LINKADDR 1
|
||||
|
||||
#define IPV6_VERSION 6
|
||||
#define IPV6_HOP_LIMIT 255
|
||||
|
||||
#define IPV6_ADDR_NULL(a) ((a[0] | a[1] | a[2] | a[3] | a[4] | \
|
||||
a[5] | a[6] | a[7] | a[8] | a[9] | \
|
||||
a[10] | a[11] | a[12] | a[13] | \
|
||||
a[14] | a[15]) == 0)
|
||||
|
||||
#define IPV6_ADDR_LOCAL(a) (((a[0] == 0xfe) && (a[1] & 0x80))? TRUE: FALSE)
|
||||
|
||||
/* IPV6 address */
|
||||
BWL_PRE_PACKED_STRUCT struct ipv6_addr {
|
||||
uint8 addr[16];
|
||||
} BWL_POST_PACKED_STRUCT;
|
||||
|
||||
|
||||
/* ICMPV6 Header */
|
||||
BWL_PRE_PACKED_STRUCT struct icmp6_hdr {
|
||||
uint8 icmp6_type;
|
||||
uint8 icmp6_code;
|
||||
uint16 icmp6_cksum;
|
||||
BWL_PRE_PACKED_STRUCT union {
|
||||
uint32 reserved;
|
||||
BWL_PRE_PACKED_STRUCT struct nd_advt {
|
||||
uint32 reserved1:5,
|
||||
override:1,
|
||||
solicited:1,
|
||||
router:1,
|
||||
reserved2:24;
|
||||
} BWL_POST_PACKED_STRUCT nd_advt;
|
||||
} BWL_POST_PACKED_STRUCT opt;
|
||||
} BWL_POST_PACKED_STRUCT;
|
||||
|
||||
/* Ipv6 Header Format */
|
||||
BWL_PRE_PACKED_STRUCT struct ipv6_hdr {
|
||||
uint8 priority:4,
|
||||
version:4;
|
||||
uint8 flow_lbl[3];
|
||||
uint16 payload_len;
|
||||
uint8 nexthdr;
|
||||
uint8 hop_limit;
|
||||
struct ipv6_addr saddr;
|
||||
struct ipv6_addr daddr;
|
||||
} BWL_POST_PACKED_STRUCT;
|
||||
|
||||
/* Neighbor Advertisement/Solicitation Packet Structure */
|
||||
BWL_PRE_PACKED_STRUCT struct bcm_nd_msg {
|
||||
struct icmp6_hdr icmph;
|
||||
struct ipv6_addr target;
|
||||
} BWL_POST_PACKED_STRUCT;
|
||||
|
||||
|
||||
/* Neighibor Solicitation/Advertisement Optional Structure */
|
||||
BWL_PRE_PACKED_STRUCT struct nd_msg_opt {
|
||||
uint8 type;
|
||||
uint8 len;
|
||||
uint8 mac_addr[ETHER_ADDR_LEN];
|
||||
} BWL_POST_PACKED_STRUCT;
|
||||
|
||||
/* Ipv6 Fragmentation Header */
|
||||
BWL_PRE_PACKED_STRUCT struct ipv6_frag {
|
||||
uint8 nexthdr;
|
||||
uint8 reserved;
|
||||
uint16 frag_offset;
|
||||
uint32 ident;
|
||||
} BWL_POST_PACKED_STRUCT;
|
||||
|
||||
/* This marks the end of a packed structure section. */
|
||||
#include <packed_section_end.h>
|
||||
|
||||
static const struct ipv6_addr all_node_ipv6_maddr = {
|
||||
{ 0xff, 0x2, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 1
|
||||
}};
|
||||
|
||||
#define IPV6_ISMULTI(a) (a[0] == 0xff)
|
||||
|
||||
#define IPV6_MCAST_TO_ETHER_MCAST(ipv6, ether) \
|
||||
{ \
|
||||
ether[0] = 0x33; \
|
||||
ether[1] = 0x33; \
|
||||
ether[2] = ipv6[12]; \
|
||||
ether[3] = ipv6[13]; \
|
||||
ether[4] = ipv6[14]; \
|
||||
ether[5] = ipv6[15]; \
|
||||
}
|
||||
|
||||
#endif /* !defined(_bcmipv6_h_) */
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,329 @@
|
|||
/*
|
||||
* NVRAM variable manipulation
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: bcmnvram.h 613043 2016-01-16 00:24:13Z $
|
||||
*/
|
||||
|
||||
#ifndef _bcmnvram_h_
|
||||
#define _bcmnvram_h_
|
||||
|
||||
#ifndef _LANGUAGE_ASSEMBLY
|
||||
|
||||
#include <typedefs.h>
|
||||
#include <bcmdefs.h>
|
||||
|
||||
struct nvram_header {
|
||||
uint32 magic;
|
||||
uint32 len;
|
||||
uint32 crc_ver_init; /* 0:7 crc, 8:15 ver, 16:31 sdram_init */
|
||||
uint32 config_refresh; /* 0:15 sdram_config, 16:31 sdram_refresh */
|
||||
uint32 config_ncdl; /* ncdl values for memc */
|
||||
};
|
||||
|
||||
struct nvram_tuple {
|
||||
char *name;
|
||||
char *value;
|
||||
struct nvram_tuple *next;
|
||||
};
|
||||
|
||||
/*
|
||||
* Get default value for an NVRAM variable
|
||||
*/
|
||||
extern char *nvram_default_get(const char *name);
|
||||
/*
|
||||
* validate/restore all per-interface related variables
|
||||
*/
|
||||
extern void nvram_validate_all(char *prefix, bool restore);
|
||||
|
||||
/*
|
||||
* restore specific per-interface variable
|
||||
*/
|
||||
extern void nvram_restore_var(char *prefix, char *name);
|
||||
|
||||
/*
|
||||
* Initialize NVRAM access. May be unnecessary or undefined on certain
|
||||
* platforms.
|
||||
*/
|
||||
extern int nvram_init(void *sih);
|
||||
extern int nvram_deinit(void *sih);
|
||||
|
||||
|
||||
/*
|
||||
* Append a chunk of nvram variables to the global list
|
||||
*/
|
||||
extern int nvram_append(void *si, char *vars, uint varsz);
|
||||
|
||||
extern void nvram_get_global_vars(char **varlst, uint *varsz);
|
||||
|
||||
|
||||
/*
|
||||
* Check for reset button press for restoring factory defaults.
|
||||
*/
|
||||
extern int nvram_reset(void *sih);
|
||||
|
||||
/*
|
||||
* Disable NVRAM access. May be unnecessary or undefined on certain
|
||||
* platforms.
|
||||
*/
|
||||
extern void nvram_exit(void *sih);
|
||||
|
||||
/*
|
||||
* Get the value of an NVRAM variable. The pointer returned may be
|
||||
* invalid after a set.
|
||||
* @param name name of variable to get
|
||||
* @return value of variable or NULL if undefined
|
||||
*/
|
||||
extern char * nvram_get(const char *name);
|
||||
|
||||
/*
|
||||
* Get the value of an NVRAM variable. The pointer returned may be
|
||||
* invalid after a set.
|
||||
* @param name name of variable to get
|
||||
* @param bit bit value to get
|
||||
* @return value of variable or NULL if undefined
|
||||
*/
|
||||
extern char * nvram_get_bitflag(const char *name, const int bit);
|
||||
|
||||
/*
|
||||
* Read the reset GPIO value from the nvram and set the GPIO
|
||||
* as input
|
||||
*/
|
||||
extern int nvram_resetgpio_init(void *sih);
|
||||
|
||||
/*
|
||||
* Get the value of an NVRAM variable.
|
||||
* @param name name of variable to get
|
||||
* @return value of variable or NUL if undefined
|
||||
*/
|
||||
static INLINE char *
|
||||
nvram_safe_get(const char *name)
|
||||
{
|
||||
char *p = nvram_get(name);
|
||||
return p ? p : "";
|
||||
}
|
||||
|
||||
/*
|
||||
* Match an NVRAM variable.
|
||||
* @param name name of variable to match
|
||||
* @param match value to compare against value of variable
|
||||
* @return TRUE if variable is defined and its value is string equal
|
||||
* to match or FALSE otherwise
|
||||
*/
|
||||
static INLINE int
|
||||
nvram_match(const char *name, const char *match)
|
||||
{
|
||||
const char *value = nvram_get(name);
|
||||
|
||||
/* In nvramstubs.c builds, nvram_get() is defined as returning zero,
|
||||
* so the return line below never executes the strcmp(),
|
||||
* resulting in 'match' being an unused parameter.
|
||||
* Make a ref to 'match' to quiet the compiler warning.
|
||||
*/
|
||||
|
||||
BCM_REFERENCE(match);
|
||||
|
||||
return (value && !strcmp(value, match));
|
||||
}
|
||||
|
||||
/*
|
||||
* Match an NVRAM variable.
|
||||
* @param name name of variable to match
|
||||
* @param bit bit value to get
|
||||
* @param match value to compare against value of variable
|
||||
* @return TRUE if variable is defined and its value is string equal
|
||||
* to match or FALSE otherwise
|
||||
*/
|
||||
static INLINE int
|
||||
nvram_match_bitflag(const char *name, const int bit, const char *match)
|
||||
{
|
||||
const char *value = nvram_get_bitflag(name, bit);
|
||||
BCM_REFERENCE(match);
|
||||
return (value && !strcmp(value, match));
|
||||
}
|
||||
|
||||
/*
|
||||
* Inversely match an NVRAM variable.
|
||||
* @param name name of variable to match
|
||||
* @param match value to compare against value of variable
|
||||
* @return TRUE if variable is defined and its value is not string
|
||||
* equal to invmatch or FALSE otherwise
|
||||
*/
|
||||
static INLINE int
|
||||
nvram_invmatch(const char *name, const char *invmatch)
|
||||
{
|
||||
const char *value = nvram_get(name);
|
||||
|
||||
/* In nvramstubs.c builds, nvram_get() is defined as returning zero,
|
||||
* so the return line below never executes the strcmp(),
|
||||
* resulting in 'invmatch' being an unused parameter.
|
||||
* Make a ref to 'invmatch' to quiet the compiler warning.
|
||||
*/
|
||||
|
||||
BCM_REFERENCE(invmatch);
|
||||
|
||||
return (value && strcmp(value, invmatch));
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the value of an NVRAM variable. The name and value strings are
|
||||
* copied into private storage. Pointers to previously set values
|
||||
* may become invalid. The new value may be immediately
|
||||
* retrieved but will not be permanently stored until a commit.
|
||||
* @param name name of variable to set
|
||||
* @param value value of variable
|
||||
* @return 0 on success and errno on failure
|
||||
*/
|
||||
extern int nvram_set(const char *name, const char *value);
|
||||
|
||||
/*
|
||||
* Set the value of an NVRAM variable. The name and value strings are
|
||||
* copied into private storage. Pointers to previously set values
|
||||
* may become invalid. The new value may be immediately
|
||||
* retrieved but will not be permanently stored until a commit.
|
||||
* @param name name of variable to set
|
||||
* @param bit bit value to set
|
||||
* @param value value of variable
|
||||
* @return 0 on success and errno on failure
|
||||
*/
|
||||
extern int nvram_set_bitflag(const char *name, const int bit, const int value);
|
||||
/*
|
||||
* Unset an NVRAM variable. Pointers to previously set values
|
||||
* remain valid until a set.
|
||||
* @param name name of variable to unset
|
||||
* @return 0 on success and errno on failure
|
||||
* NOTE: use nvram_commit to commit this change to flash.
|
||||
*/
|
||||
extern int nvram_unset(const char *name);
|
||||
|
||||
/*
|
||||
* Commit NVRAM variables to permanent storage. All pointers to values
|
||||
* may be invalid after a commit.
|
||||
* NVRAM values are undefined after a commit.
|
||||
* @param nvram_corrupt true to corrupt nvram, false otherwise.
|
||||
* @return 0 on success and errno on failure
|
||||
*/
|
||||
extern int nvram_commit_internal(bool nvram_corrupt);
|
||||
|
||||
/*
|
||||
* Commit NVRAM variables to permanent storage. All pointers to values
|
||||
* may be invalid after a commit.
|
||||
* NVRAM values are undefined after a commit.
|
||||
* @return 0 on success and errno on failure
|
||||
*/
|
||||
extern int nvram_commit(void);
|
||||
|
||||
/*
|
||||
* Get all NVRAM variables (format name=value\0 ... \0\0).
|
||||
* @param buf buffer to store variables
|
||||
* @param count size of buffer in bytes
|
||||
* @return 0 on success and errno on failure
|
||||
*/
|
||||
extern int nvram_getall(char *nvram_buf, int count);
|
||||
|
||||
/*
|
||||
* returns the crc value of the nvram
|
||||
* @param nvh nvram header pointer
|
||||
*/
|
||||
uint8 nvram_calc_crc(struct nvram_header * nvh);
|
||||
|
||||
extern int nvram_space;
|
||||
#endif /* _LANGUAGE_ASSEMBLY */
|
||||
|
||||
/* The NVRAM version number stored as an NVRAM variable */
|
||||
#define NVRAM_SOFTWARE_VERSION "1"
|
||||
|
||||
#define NVRAM_MAGIC 0x48534C46 /* 'FLSH' */
|
||||
#define NVRAM_CLEAR_MAGIC 0x0
|
||||
#define NVRAM_INVALID_MAGIC 0xFFFFFFFF
|
||||
#define NVRAM_VERSION 1
|
||||
#define NVRAM_HEADER_SIZE 20
|
||||
/* This definition is for precommit staging, and will be removed */
|
||||
#define NVRAM_SPACE 0x8000
|
||||
/* For CFE builds this gets passed in thru the makefile */
|
||||
#ifndef MAX_NVRAM_SPACE
|
||||
#define MAX_NVRAM_SPACE 0x10000
|
||||
#endif
|
||||
#define DEF_NVRAM_SPACE 0x8000
|
||||
#define ROM_ENVRAM_SPACE 0x1000
|
||||
#define NVRAM_LZMA_MAGIC 0x4c5a4d41 /* 'LZMA' */
|
||||
|
||||
#define NVRAM_MAX_VALUE_LEN 255
|
||||
#define NVRAM_MAX_PARAM_LEN 64
|
||||
|
||||
#define NVRAM_CRC_START_POSITION 9 /* magic, len, crc8 to be skipped */
|
||||
#define NVRAM_CRC_VER_MASK 0xffffff00 /* for crc_ver_init */
|
||||
|
||||
/* Offsets to embedded nvram area */
|
||||
#define NVRAM_START_COMPRESSED 0x400
|
||||
#define NVRAM_START 0x1000
|
||||
|
||||
#define BCM_JUMBO_NVRAM_DELIMIT '\n'
|
||||
#define BCM_JUMBO_START "Broadcom Jumbo Nvram file"
|
||||
|
||||
|
||||
#if (defined(FAILSAFE_UPGRADE) || defined(CONFIG_FAILSAFE_UPGRADE) || \
|
||||
defined(__CONFIG_FAILSAFE_UPGRADE_SUPPORT__))
|
||||
#define IMAGE_SIZE "image_size"
|
||||
#define BOOTPARTITION "bootpartition"
|
||||
#define IMAGE_BOOT BOOTPARTITION
|
||||
#define PARTIALBOOTS "partialboots"
|
||||
#define MAXPARTIALBOOTS "maxpartialboots"
|
||||
#define IMAGE_1ST_FLASH_TRX "flash0.trx"
|
||||
#define IMAGE_1ST_FLASH_OS "flash0.os"
|
||||
#define IMAGE_2ND_FLASH_TRX "flash0.trx2"
|
||||
#define IMAGE_2ND_FLASH_OS "flash0.os2"
|
||||
#define IMAGE_FIRST_OFFSET "image_first_offset"
|
||||
#define IMAGE_SECOND_OFFSET "image_second_offset"
|
||||
#define LINUX_FIRST "linux"
|
||||
#define LINUX_SECOND "linux2"
|
||||
#endif
|
||||
|
||||
#if (defined(DUAL_IMAGE) || defined(CONFIG_DUAL_IMAGE) || \
|
||||
defined(__CONFIG_DUAL_IMAGE_FLASH_SUPPORT__))
|
||||
/* Shared by all: CFE, Linux Kernel, and Ap */
|
||||
#define IMAGE_BOOT "image_boot"
|
||||
#define BOOTPARTITION IMAGE_BOOT
|
||||
/* CFE variables */
|
||||
#define IMAGE_1ST_FLASH_TRX "flash0.trx"
|
||||
#define IMAGE_1ST_FLASH_OS "flash0.os"
|
||||
#define IMAGE_2ND_FLASH_TRX "flash0.trx2"
|
||||
#define IMAGE_2ND_FLASH_OS "flash0.os2"
|
||||
#define IMAGE_SIZE "image_size"
|
||||
|
||||
/* CFE and Linux Kernel shared variables */
|
||||
#define IMAGE_FIRST_OFFSET "image_first_offset"
|
||||
#define IMAGE_SECOND_OFFSET "image_second_offset"
|
||||
|
||||
/* Linux application variables */
|
||||
#define LINUX_FIRST "linux"
|
||||
#define LINUX_SECOND "linux2"
|
||||
#define POLICY_TOGGLE "toggle"
|
||||
#define LINUX_PART_TO_FLASH "linux_to_flash"
|
||||
#define LINUX_FLASH_POLICY "linux_flash_policy"
|
||||
|
||||
#endif /* defined(DUAL_IMAGE||CONFIG_DUAL_IMAGE)||__CONFIG_DUAL_IMAGE_FLASH_SUPPORT__ */
|
||||
|
||||
#endif /* _bcmnvram_h_ */
|
|
@ -0,0 +1,440 @@
|
|||
/*
|
||||
* Broadcom PCIE
|
||||
* Software-specific definitions shared between device and host side
|
||||
* Explains the shared area between host and dongle
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: bcmpcie.h 678914 2017-01-11 15:34:26Z $
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _bcmpcie_h_
|
||||
#define _bcmpcie_h_
|
||||
|
||||
#include <bcmutils.h>
|
||||
|
||||
#define ADDR_64(x) (x.addr)
|
||||
#define HIGH_ADDR_32(x) ((uint32) (((sh_addr_t) x).high_addr))
|
||||
#define LOW_ADDR_32(x) ((uint32) (((sh_addr_t) x).low_addr))
|
||||
|
||||
typedef struct {
|
||||
uint32 low_addr;
|
||||
uint32 high_addr;
|
||||
} sh_addr_t;
|
||||
|
||||
|
||||
/* May be overridden by 43xxxxx-roml.mk */
|
||||
#if !defined(BCMPCIE_MAX_TX_FLOWS)
|
||||
#define BCMPCIE_MAX_TX_FLOWS 40
|
||||
#endif /* ! BCMPCIE_MAX_TX_FLOWS */
|
||||
|
||||
#define PCIE_SHARED_VERSION_7 0x00007
|
||||
#define PCIE_SHARED_VERSION_6 0x00006 /* rev6 is compatible with rev 5 */
|
||||
#define PCIE_SHARED_VERSION_5 0x00005 /* rev6 is compatible with rev 5 */
|
||||
/**
|
||||
* Feature flags enabled in dongle. Advertised by dongle to DHD via the PCIe Shared structure that
|
||||
* is located in device memory.
|
||||
*/
|
||||
#define PCIE_SHARED_VERSION PCIE_SHARED_VERSION_7
|
||||
#define PCIE_SHARED_VERSION_MASK 0x000FF
|
||||
#define PCIE_SHARED_ASSERT_BUILT 0x00100
|
||||
#define PCIE_SHARED_ASSERT 0x00200
|
||||
#define PCIE_SHARED_TRAP 0x00400
|
||||
#define PCIE_SHARED_IN_BRPT 0x00800
|
||||
#define PCIE_SHARED_SET_BRPT 0x01000
|
||||
#define PCIE_SHARED_PENDING_BRPT 0x02000
|
||||
/* BCMPCIE_SUPPORT_TX_PUSH_RING 0x04000 obsolete */
|
||||
#define PCIE_SHARED_EVT_SEQNUM 0x08000
|
||||
#define PCIE_SHARED_DMA_INDEX 0x10000
|
||||
|
||||
/* WAR: D11 txstatus through unused status field of PCIe completion header */
|
||||
#define PCIE_SHARED_D2H_D11_TX_STATUS 0x40000000 /* using flags2 in shared area */
|
||||
#define PCIE_SHARED_H2D_D11_TX_STATUS 0x80000000 /* using flags2 in shared area */
|
||||
|
||||
/**
|
||||
* There are host types where a device interrupt can 'race ahead' of data written by the device into
|
||||
* host memory. The dongle can avoid this condition using a variety of techniques (read barrier,
|
||||
* using PCIe Message Signalled Interrupts, or by using the PCIE_DMA_INDEX feature). Unfortunately
|
||||
* these techniques have drawbacks on router platforms. For these platforms, it was decided to not
|
||||
* avoid the condition, but to detect the condition instead and act on it.
|
||||
* D2H M2M DMA Complete Sync mechanism: Modulo-253-SeqNum or XORCSUM
|
||||
*/
|
||||
#define PCIE_SHARED_D2H_SYNC_SEQNUM 0x20000
|
||||
#define PCIE_SHARED_D2H_SYNC_XORCSUM 0x40000
|
||||
#define PCIE_SHARED_D2H_SYNC_MODE_MASK \
|
||||
(PCIE_SHARED_D2H_SYNC_SEQNUM | PCIE_SHARED_D2H_SYNC_XORCSUM)
|
||||
#define PCIE_SHARED_IDLE_FLOW_RING 0x80000
|
||||
#define PCIE_SHARED_2BYTE_INDICES 0x100000
|
||||
|
||||
#define PCIE_SHARED2_EXTENDED_TRAP_DATA 0x00000001 /* using flags2 in shared area */
|
||||
|
||||
/* dongle supports fatal buf log collection */
|
||||
#define PCIE_SHARED_FATAL_LOGBUG_VALID 0x200000
|
||||
|
||||
/* Implicit DMA with corerev 19 and after */
|
||||
#define PCIE_SHARED_IDMA 0x400000
|
||||
|
||||
/* MSI support */
|
||||
#define PCIE_SHARED_D2H_MSI_MULTI_MSG 0x800000
|
||||
|
||||
/* IFRM with corerev 19 and after */
|
||||
#define PCIE_SHARED_IFRM 0x1000000
|
||||
|
||||
/**
|
||||
* From Rev6 and above, suspend/resume can be done using two handshake methods.
|
||||
* 1. Using ctrl post/ctrl cmpl messages (Default rev6)
|
||||
* 2. Using Mailbox data (old method as used in rev5)
|
||||
* This shared flag indicates whether to overide rev6 default method and use mailbox for
|
||||
* suspend/resume.
|
||||
*/
|
||||
#define PCIE_SHARED_USE_MAILBOX 0x2000000
|
||||
|
||||
/* Firmware compiled for mfgbuild purposes */
|
||||
#define PCIE_SHARED_MFGBUILD_FW 0x4000000
|
||||
|
||||
/* Firmware could use DB0 value as host timestamp */
|
||||
#define PCIE_SHARED_TIMESTAMP_DB0 0x8000000
|
||||
/* Firmware could use Hostready (IPC rev7) */
|
||||
#define PCIE_SHARED_HOSTRDY_SUPPORT 0x10000000
|
||||
|
||||
/* When set, Firmwar does not support OOB Device Wake based DS protocol */
|
||||
#define PCIE_SHARED_NO_OOB_DW 0x20000000
|
||||
|
||||
/* When set, Firmwar supports Inband DS protocol */
|
||||
#define PCIE_SHARED_INBAND_DS 0x40000000
|
||||
|
||||
/* Implicit DMA WAR for 4347B0 PCIe memory retention */
|
||||
#define PCIE_SHARED_IDMA_RETENTION_DS 0x80000000
|
||||
|
||||
#define PCIE_SHARED_D2H_MAGIC 0xFEDCBA09
|
||||
#define PCIE_SHARED_H2D_MAGIC 0x12345678
|
||||
|
||||
/**
|
||||
* Message rings convey messages between host and device. They are unidirectional, and are located
|
||||
* in host memory.
|
||||
*
|
||||
* This is the minimal set of message rings, known as 'common message rings':
|
||||
*/
|
||||
#define BCMPCIE_H2D_MSGRING_CONTROL_SUBMIT 0
|
||||
#define BCMPCIE_H2D_MSGRING_RXPOST_SUBMIT 1
|
||||
#define BCMPCIE_D2H_MSGRING_CONTROL_COMPLETE 2
|
||||
#define BCMPCIE_D2H_MSGRING_TX_COMPLETE 3
|
||||
#define BCMPCIE_D2H_MSGRING_RX_COMPLETE 4
|
||||
#define BCMPCIE_COMMON_MSGRING_MAX_ID 4
|
||||
|
||||
#define BCMPCIE_H2D_COMMON_MSGRINGS 2
|
||||
#define BCMPCIE_D2H_COMMON_MSGRINGS 3
|
||||
#define BCMPCIE_COMMON_MSGRINGS 5
|
||||
|
||||
#define BCMPCIE_H2D_MSGRINGS(max_tx_flows) \
|
||||
(BCMPCIE_H2D_COMMON_MSGRINGS + (max_tx_flows))
|
||||
|
||||
/* different ring types */
|
||||
#define BCMPCIE_H2D_RING_TYPE_CTRL_SUBMIT 0x1
|
||||
#define BCMPCIE_H2D_RING_TYPE_TXFLOW_RING 0x2
|
||||
#define BCMPCIE_H2D_RING_TYPE_RXBUFPOST 0x3
|
||||
#define BCMPCIE_H2D_RING_TYPE_TXSUBMIT 0x4
|
||||
#define BCMPCIE_H2D_RING_TYPE_DBGBUF_SUBMIT 0x5
|
||||
|
||||
#define BCMPCIE_D2H_RING_TYPE_CTRL_CPL 0x1
|
||||
#define BCMPCIE_D2H_RING_TYPE_TX_CPL 0x2
|
||||
#define BCMPCIE_D2H_RING_TYPE_RX_CPL 0x3
|
||||
#define BCMPCIE_D2H_RING_TYPE_DBGBUF_CPL 0x4
|
||||
#define BCMPCIE_D2H_RING_TYPE_AC_RX_COMPLETE 0x5
|
||||
|
||||
/**
|
||||
* H2D and D2H, WR and RD index, are maintained in the following arrays:
|
||||
* - Array of all H2D WR Indices
|
||||
* - Array of all H2D RD Indices
|
||||
* - Array of all D2H WR Indices
|
||||
* - Array of all D2H RD Indices
|
||||
*
|
||||
* The offset of the WR or RD indexes (for common rings) in these arrays are
|
||||
* listed below. Arrays ARE NOT indexed by a ring's id.
|
||||
*
|
||||
* D2H common rings WR and RD index start from 0, even though their ringids
|
||||
* start from BCMPCIE_H2D_COMMON_MSGRINGS
|
||||
*/
|
||||
|
||||
#define BCMPCIE_H2D_RING_IDX(h2d_ring_id) (h2d_ring_id)
|
||||
|
||||
enum h2dring_idx {
|
||||
/* H2D common rings */
|
||||
BCMPCIE_H2D_MSGRING_CONTROL_SUBMIT_IDX =
|
||||
BCMPCIE_H2D_RING_IDX(BCMPCIE_H2D_MSGRING_CONTROL_SUBMIT),
|
||||
BCMPCIE_H2D_MSGRING_RXPOST_SUBMIT_IDX =
|
||||
BCMPCIE_H2D_RING_IDX(BCMPCIE_H2D_MSGRING_RXPOST_SUBMIT),
|
||||
|
||||
/* First TxPost's WR or RD index starts after all H2D common rings */
|
||||
BCMPCIE_H2D_MSGRING_TXFLOW_IDX_START =
|
||||
BCMPCIE_H2D_RING_IDX(BCMPCIE_H2D_COMMON_MSGRINGS)
|
||||
};
|
||||
|
||||
#define BCMPCIE_D2H_RING_IDX(d2h_ring_id) \
|
||||
((d2h_ring_id) - BCMPCIE_H2D_COMMON_MSGRINGS)
|
||||
|
||||
enum d2hring_idx {
|
||||
/* D2H Common Rings */
|
||||
BCMPCIE_D2H_MSGRING_CONTROL_COMPLETE_IDX =
|
||||
BCMPCIE_D2H_RING_IDX(BCMPCIE_D2H_MSGRING_CONTROL_COMPLETE),
|
||||
BCMPCIE_D2H_MSGRING_TX_COMPLETE_IDX =
|
||||
BCMPCIE_D2H_RING_IDX(BCMPCIE_D2H_MSGRING_TX_COMPLETE),
|
||||
BCMPCIE_D2H_MSGRING_RX_COMPLETE_IDX =
|
||||
BCMPCIE_D2H_RING_IDX(BCMPCIE_D2H_MSGRING_RX_COMPLETE)
|
||||
};
|
||||
|
||||
/**
|
||||
* Macros for managing arrays of RD WR indices:
|
||||
* rw_index_sz:
|
||||
* - in dongle, rw_index_sz is known at compile time
|
||||
* - in host/DHD, rw_index_sz is derived from advertized pci_shared flags
|
||||
*
|
||||
* ring_idx: See h2dring_idx and d2hring_idx
|
||||
*/
|
||||
|
||||
/** Offset of a RD or WR index in H2D or D2H indices array */
|
||||
#define BCMPCIE_RW_INDEX_OFFSET(rw_index_sz, ring_idx) \
|
||||
((rw_index_sz) * (ring_idx))
|
||||
|
||||
/** Fetch the address of RD or WR index in H2D or D2H indices array */
|
||||
#define BCMPCIE_RW_INDEX_ADDR(indices_array_base, rw_index_sz, ring_idx) \
|
||||
(void *)((uint32)(indices_array_base) + \
|
||||
BCMPCIE_RW_INDEX_OFFSET((rw_index_sz), (ring_idx)))
|
||||
|
||||
/** H2D DMA Indices array size: given max flow rings */
|
||||
#define BCMPCIE_H2D_RW_INDEX_ARRAY_SZ(rw_index_sz, max_tx_flows) \
|
||||
((rw_index_sz) * BCMPCIE_H2D_MSGRINGS(max_tx_flows))
|
||||
|
||||
/** D2H DMA Indices array size */
|
||||
#define BCMPCIE_D2H_RW_INDEX_ARRAY_SZ(rw_index_sz) \
|
||||
((rw_index_sz) * BCMPCIE_D2H_COMMON_MSGRINGS)
|
||||
|
||||
/**
|
||||
* This type is used by a 'message buffer' (which is a FIFO for messages). Message buffers are used
|
||||
* for host<->device communication and are instantiated on both sides. ring_mem_t is instantiated
|
||||
* both in host as well as device memory.
|
||||
*/
|
||||
typedef struct ring_mem {
|
||||
uint16 idx; /* ring id */
|
||||
uint8 type;
|
||||
uint8 rsvd;
|
||||
uint16 max_item; /* Max number of items in flow ring */
|
||||
uint16 len_items; /* Items are fixed size. Length in bytes of one item */
|
||||
sh_addr_t base_addr; /* 64 bits address, either in host or device memory */
|
||||
} ring_mem_t;
|
||||
|
||||
|
||||
/**
|
||||
* Per flow ring, information is maintained in device memory, eg at what address the ringmem and
|
||||
* ringstate are located. The flow ring itself can be instantiated in either host or device memory.
|
||||
*
|
||||
* Perhaps this type should be renamed to make clear that it resides in device memory only.
|
||||
*/
|
||||
typedef struct ring_info {
|
||||
uint32 ringmem_ptr; /* ring mem location in dongle memory */
|
||||
|
||||
/* Following arrays are indexed using h2dring_idx and d2hring_idx, and not
|
||||
* by a ringid.
|
||||
*/
|
||||
|
||||
/* 32bit ptr to arrays of WR or RD indices for all rings in dongle memory */
|
||||
uint32 h2d_w_idx_ptr; /* Array of all H2D ring's WR indices */
|
||||
uint32 h2d_r_idx_ptr; /* Array of all H2D ring's RD indices */
|
||||
uint32 d2h_w_idx_ptr; /* Array of all D2H ring's WR indices */
|
||||
uint32 d2h_r_idx_ptr; /* Array of all D2H ring's RD indices */
|
||||
|
||||
/* PCIE_DMA_INDEX feature: Dongle uses mem2mem DMA to sync arrays in host.
|
||||
* Host may directly fetch WR and RD indices from these host-side arrays.
|
||||
*
|
||||
* 64bit ptr to arrays of WR or RD indices for all rings in host memory.
|
||||
*/
|
||||
sh_addr_t h2d_w_idx_hostaddr; /* Array of all H2D ring's WR indices */
|
||||
sh_addr_t h2d_r_idx_hostaddr; /* Array of all H2D ring's RD indices */
|
||||
sh_addr_t d2h_w_idx_hostaddr; /* Array of all D2H ring's WR indices */
|
||||
sh_addr_t d2h_r_idx_hostaddr; /* Array of all D2H ring's RD indices */
|
||||
|
||||
uint16 max_tx_flowrings; /* maximum number of H2D rings: common + flow */
|
||||
uint16 max_submission_queues; /* maximum number of H2D rings: common + flow */
|
||||
uint16 max_completion_rings; /* maximum number of H2D rings: common + flow */
|
||||
uint16 max_vdevs; /* max number of virtual interfaces supported */
|
||||
|
||||
sh_addr_t ifrm_w_idx_hostaddr; /* Array of all H2D ring's WR indices for IFRM */
|
||||
} ring_info_t;
|
||||
|
||||
/**
|
||||
* A structure located in TCM that is shared between host and device, primarily used during
|
||||
* initialization.
|
||||
*/
|
||||
typedef struct {
|
||||
/** shared area version captured at flags 7:0 */
|
||||
uint32 flags;
|
||||
|
||||
uint32 trap_addr;
|
||||
uint32 assert_exp_addr;
|
||||
uint32 assert_file_addr;
|
||||
uint32 assert_line;
|
||||
uint32 console_addr; /**< Address of hnd_cons_t */
|
||||
|
||||
uint32 msgtrace_addr;
|
||||
|
||||
uint32 fwid;
|
||||
|
||||
/* Used for debug/flow control */
|
||||
uint16 total_lfrag_pkt_cnt;
|
||||
uint16 max_host_rxbufs; /* rsvd in spec */
|
||||
|
||||
uint32 dma_rxoffset; /* rsvd in spec */
|
||||
|
||||
/** these will be used for sleep request/ack, d3 req/ack */
|
||||
uint32 h2d_mb_data_ptr;
|
||||
uint32 d2h_mb_data_ptr;
|
||||
|
||||
/* information pertinent to host IPC/msgbuf channels */
|
||||
/** location in the TCM memory which has the ring_info */
|
||||
uint32 rings_info_ptr;
|
||||
|
||||
/** block of host memory for the scratch buffer */
|
||||
uint32 host_dma_scratch_buffer_len;
|
||||
sh_addr_t host_dma_scratch_buffer;
|
||||
|
||||
/** block of host memory for the dongle to push the status into */
|
||||
uint32 device_rings_stsblk_len;
|
||||
sh_addr_t device_rings_stsblk;
|
||||
|
||||
uint32 buzz_dbg_ptr; /* BUZZZ state format strings and trace buffer */
|
||||
|
||||
/* rev6 compatible changes */
|
||||
uint32 flags2;
|
||||
uint32 host_cap;
|
||||
|
||||
/* location in the host address space to write trap indication.
|
||||
* At this point for the current rev of the spec, firmware will
|
||||
* support only indications to 32 bit host addresses.
|
||||
*/
|
||||
sh_addr_t host_trap_addr;
|
||||
|
||||
/* location for host fatal error log buffer start address */
|
||||
uint32 device_fatal_logbuf_start;
|
||||
|
||||
/* location in host memory for offloaded modules */
|
||||
sh_addr_t hoffload_addr;
|
||||
} pciedev_shared_t;
|
||||
|
||||
extern pciedev_shared_t pciedev_shared;
|
||||
|
||||
/* host capabilities */
|
||||
#define HOSTCAP_PCIEAPI_VERSION_MASK 0x000000FF
|
||||
#define HOSTCAP_H2D_VALID_PHASE 0x00000100
|
||||
#define HOSTCAP_H2D_ENABLE_TRAP_ON_BADPHASE 0x00000200
|
||||
#define HOSTCAP_H2D_ENABLE_HOSTRDY 0x00000400
|
||||
#define HOSTCAP_DB0_TIMESTAMP 0x00000800
|
||||
#define HOSTCAP_DS_NO_OOB_DW 0x00001000
|
||||
#define HOSTCAP_DS_INBAND_DW 0x00002000
|
||||
#define HOSTCAP_H2D_IDMA 0x00004000
|
||||
#define HOSTCAP_H2D_IFRM 0x00008000
|
||||
#define HOSTCAP_H2D_DAR 0x00010000
|
||||
#define HOSTCAP_EXTENDED_TRAP_DATA 0x00020000
|
||||
#define HOSTCAP_TXSTATUS_METADATA 0x00040000
|
||||
|
||||
/**
|
||||
* Mailboxes notify a remote party that an event took place, using interrupts. They use hardware
|
||||
* support.
|
||||
*/
|
||||
|
||||
/* H2D mail box Data */
|
||||
#define H2D_HOST_D3_INFORM 0x00000001
|
||||
#define H2D_HOST_DS_ACK 0x00000002
|
||||
#define H2D_HOST_DS_NAK 0x00000004
|
||||
#define H2D_HOST_CONS_INT 0x80000000 /**< h2d int for console cmds */
|
||||
#define H2D_FW_TRAP 0x20000000 /**< h2d force TRAP */
|
||||
#define H2D_HOST_D0_INFORM_IN_USE 0x00000008
|
||||
#define H2D_HOST_D0_INFORM 0x00000010
|
||||
#define H2D_HOST_IDMA_INITED 0x00000080
|
||||
#define H2DMB_DS_HOST_SLEEP_INFORM H2D_HOST_D3_INFORM
|
||||
#define H2DMB_DS_DEVICE_SLEEP_ACK H2D_HOST_DS_ACK
|
||||
#define H2DMB_DS_DEVICE_SLEEP_NAK H2D_HOST_DS_NAK
|
||||
#define H2DMB_D0_INFORM_IN_USE H2D_HOST_D0_INFORM_IN_USE
|
||||
#define H2DMB_D0_INFORM H2D_HOST_D0_INFORM
|
||||
#define H2DMB_DS_ACTIVE 0x00000020
|
||||
#define H2DMB_DS_DEVICE_WAKE 0x00000040
|
||||
#define H2DMB_FW_TRAP H2D_FW_TRAP
|
||||
#define H2DMB_HOST_CONS_INT H2D_HOST_CONS_INT
|
||||
#define H2DMB_DS_DEVICE_WAKE_ASSERT H2DMB_DS_DEVICE_WAKE
|
||||
#define H2DMB_DS_DEVICE_WAKE_DEASSERT H2DMB_DS_ACTIVE
|
||||
|
||||
/* D2H mail box Data */
|
||||
#define D2H_DEV_D3_ACK 0x00000001
|
||||
#define D2H_DEV_DS_ENTER_REQ 0x00000002
|
||||
#define D2H_DEV_DS_EXIT_NOTE 0x00000004
|
||||
#define D2H_DEV_FWHALT 0x10000000
|
||||
#define D2H_DEV_EXT_TRAP_DATA 0x20000000
|
||||
#define D2H_DEV_IDMA_INITED 0x00000010
|
||||
#define D2H_FWTRAP_MASK 0x0000001F /* Adding maskbits for TRAP information */
|
||||
#define D2HMB_DS_HOST_SLEEP_ACK D2H_DEV_D3_ACK
|
||||
#define D2HMB_DS_DEVICE_SLEEP_ENTER_REQ D2H_DEV_DS_ENTER_REQ
|
||||
#define D2HMB_DS_DEVICE_SLEEP_EXIT D2H_DEV_DS_EXIT_NOTE
|
||||
#define D2HMB_DS_HOST_SLEEP_EXIT_ACK 0x00000008
|
||||
#define D2HMB_FWHALT D2H_DEV_FWHALT
|
||||
#define D2H_DEV_MB_MASK (D2H_DEV_D3_ACK | D2H_DEV_DS_ENTER_REQ | \
|
||||
D2H_DEV_DS_EXIT_NOTE | D2H_DEV_IDMA_INITED | D2H_DEV_FWHALT | \
|
||||
D2H_FWTRAP_MASK | D2H_DEV_EXT_TRAP_DATA)
|
||||
#define D2H_DEV_MB_INVALIDATED(x) ((!x) || (x & ~D2H_DEV_MB_MASK))
|
||||
|
||||
|
||||
/** These macro's operate on type 'inuse_lclbuf_pool_t' and are used by firmware only */
|
||||
#define NEXTTXP(i, d) ((((i)+1) >= (d)) ? 0 : ((i)+1))
|
||||
#define NTXPACTIVE(r, w, d) (((r) <= (w)) ? ((w)-(r)) : ((d)-(r)+(w)))
|
||||
#define NTXPAVAIL(r, w, d) (((d) - NTXPACTIVE((r), (w), (d))) > 1)
|
||||
|
||||
/* Function can be used to notify host of FW halt */
|
||||
#define READ_AVAIL_SPACE(w, r, d) \
|
||||
((w >= r) ? (w - r) : (d - r))
|
||||
|
||||
#define WRITE_SPACE_AVAIL_CONTINUOUS(r, w, d) ((w >= r) ? (d - w) : (r - w))
|
||||
#define WRITE_SPACE_AVAIL(r, w, d) (d - (NTXPACTIVE(r, w, d)) - 1)
|
||||
#define CHECK_WRITE_SPACE(r, w, d) \
|
||||
((r) > (w)) ? ((r) - (w) - 1) : ((r) == 0 || (w) == 0) ? ((d) - (w) - 1) : ((d) - (w))
|
||||
#define CHECK_NOWRITE_SPACE(r, w, d) \
|
||||
(((r) == (w) + 1) || (((r) == 0) && ((w) == ((d) - 1))))
|
||||
|
||||
|
||||
#define WRT_PEND(x) ((x)->wr_pending)
|
||||
#define DNGL_RING_WPTR(msgbuf) (*((msgbuf)->tcm_rs_w_ptr)) /**< advanced by producer */
|
||||
#define BCMMSGBUF_RING_SET_W_PTR(msgbuf, a) (DNGL_RING_WPTR(msgbuf) = (a))
|
||||
|
||||
#define DNGL_RING_RPTR(msgbuf) (*((msgbuf)->tcm_rs_r_ptr)) /**< advanced by consumer */
|
||||
#define BCMMSGBUF_RING_SET_R_PTR(msgbuf, a) (DNGL_RING_RPTR(msgbuf) = (a))
|
||||
|
||||
#define MODULO_RING_IDX(x, y) ((x) % (y)->bitmap_size)
|
||||
|
||||
#define RING_READ_PTR(x) ((x)->ringstate->r_offset)
|
||||
#define RING_WRITE_PTR(x) ((x)->ringstate->w_offset)
|
||||
#define RING_START_PTR(x) ((x)->ringmem->base_addr.low_addr)
|
||||
#define RING_MAX_ITEM(x) ((x)->ringmem->max_item)
|
||||
#define RING_LEN_ITEMS(x) ((x)->ringmem->len_items)
|
||||
#define HOST_RING_BASE(x) ((x)->dma_buf.va)
|
||||
#define HOST_RING_END(x) ((uint8 *)HOST_RING_BASE((x)) + \
|
||||
((RING_MAX_ITEM((x))-1)*RING_LEN_ITEMS((x))))
|
||||
#endif /* _bcmpcie_h_ */
|
|
@ -0,0 +1,184 @@
|
|||
/*
|
||||
* Broadcom PCI-SPI Host Controller Register Definitions
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: bcmpcispi.h 514727 2014-11-12 03:02:48Z $
|
||||
*/
|
||||
#ifndef _BCM_PCI_SPI_H
|
||||
#define _BCM_PCI_SPI_H
|
||||
|
||||
/* cpp contortions to concatenate w/arg prescan */
|
||||
#ifndef PAD
|
||||
#define _PADLINE(line) pad ## line
|
||||
#define _XSTR(line) _PADLINE(line)
|
||||
#define PAD _XSTR(__LINE__)
|
||||
#endif /* PAD */
|
||||
|
||||
|
||||
typedef volatile struct {
|
||||
uint32 spih_ctrl; /* 0x00 SPI Control Register */
|
||||
uint32 spih_stat; /* 0x04 SPI Status Register */
|
||||
uint32 spih_data; /* 0x08 SPI Data Register, 32-bits wide */
|
||||
uint32 spih_ext; /* 0x0C SPI Extension Register */
|
||||
uint32 PAD[4]; /* 0x10-0x1F PADDING */
|
||||
|
||||
uint32 spih_gpio_ctrl; /* 0x20 SPI GPIO Control Register */
|
||||
uint32 spih_gpio_data; /* 0x24 SPI GPIO Data Register */
|
||||
uint32 PAD[6]; /* 0x28-0x3F PADDING */
|
||||
|
||||
uint32 spih_int_edge; /* 0x40 SPI Interrupt Edge Register (0=Level, 1=Edge) */
|
||||
uint32 spih_int_pol; /* 0x44 SPI Interrupt Polarity Register (0=Active Low, */
|
||||
/* 1=Active High) */
|
||||
uint32 spih_int_mask; /* 0x48 SPI Interrupt Mask */
|
||||
uint32 spih_int_status; /* 0x4C SPI Interrupt Status */
|
||||
uint32 PAD[4]; /* 0x50-0x5F PADDING */
|
||||
|
||||
uint32 spih_hex_disp; /* 0x60 SPI 4-digit hex display value */
|
||||
uint32 spih_current_ma; /* 0x64 SPI SD card current consumption in mA */
|
||||
uint32 PAD[1]; /* 0x68 PADDING */
|
||||
uint32 spih_disp_sel; /* 0x6c SPI 4-digit hex display mode select (1=current) */
|
||||
uint32 PAD[4]; /* 0x70-0x7F PADDING */
|
||||
uint32 PAD[8]; /* 0x80-0x9F PADDING */
|
||||
uint32 PAD[8]; /* 0xA0-0xBF PADDING */
|
||||
uint32 spih_pll_ctrl; /* 0xC0 PLL Control Register */
|
||||
uint32 spih_pll_status; /* 0xC4 PLL Status Register */
|
||||
uint32 spih_xtal_freq; /* 0xC8 External Clock Frequency in units of 10000Hz */
|
||||
uint32 spih_clk_count; /* 0xCC External Clock Count Register */
|
||||
|
||||
} spih_regs_t;
|
||||
|
||||
typedef volatile struct {
|
||||
uint32 cfg_space[0x40]; /* 0x000-0x0FF PCI Configuration Space (Read Only) */
|
||||
uint32 P_IMG_CTRL0; /* 0x100 PCI Image0 Control Register */
|
||||
|
||||
uint32 P_BA0; /* 0x104 32 R/W PCI Image0 Base Address register */
|
||||
uint32 P_AM0; /* 0x108 32 R/W PCI Image0 Address Mask register */
|
||||
uint32 P_TA0; /* 0x10C 32 R/W PCI Image0 Translation Address register */
|
||||
uint32 P_IMG_CTRL1; /* 0x110 32 R/W PCI Image1 Control register */
|
||||
uint32 P_BA1; /* 0x114 32 R/W PCI Image1 Base Address register */
|
||||
uint32 P_AM1; /* 0x118 32 R/W PCI Image1 Address Mask register */
|
||||
uint32 P_TA1; /* 0x11C 32 R/W PCI Image1 Translation Address register */
|
||||
uint32 P_IMG_CTRL2; /* 0x120 32 R/W PCI Image2 Control register */
|
||||
uint32 P_BA2; /* 0x124 32 R/W PCI Image2 Base Address register */
|
||||
uint32 P_AM2; /* 0x128 32 R/W PCI Image2 Address Mask register */
|
||||
uint32 P_TA2; /* 0x12C 32 R/W PCI Image2 Translation Address register */
|
||||
uint32 P_IMG_CTRL3; /* 0x130 32 R/W PCI Image3 Control register */
|
||||
uint32 P_BA3; /* 0x134 32 R/W PCI Image3 Base Address register */
|
||||
uint32 P_AM3; /* 0x138 32 R/W PCI Image3 Address Mask register */
|
||||
uint32 P_TA3; /* 0x13C 32 R/W PCI Image3 Translation Address register */
|
||||
uint32 P_IMG_CTRL4; /* 0x140 32 R/W PCI Image4 Control register */
|
||||
uint32 P_BA4; /* 0x144 32 R/W PCI Image4 Base Address register */
|
||||
uint32 P_AM4; /* 0x148 32 R/W PCI Image4 Address Mask register */
|
||||
uint32 P_TA4; /* 0x14C 32 R/W PCI Image4 Translation Address register */
|
||||
uint32 P_IMG_CTRL5; /* 0x150 32 R/W PCI Image5 Control register */
|
||||
uint32 P_BA5; /* 0x154 32 R/W PCI Image5 Base Address register */
|
||||
uint32 P_AM5; /* 0x158 32 R/W PCI Image5 Address Mask register */
|
||||
uint32 P_TA5; /* 0x15C 32 R/W PCI Image5 Translation Address register */
|
||||
uint32 P_ERR_CS; /* 0x160 32 R/W PCI Error Control and Status register */
|
||||
uint32 P_ERR_ADDR; /* 0x164 32 R PCI Erroneous Address register */
|
||||
uint32 P_ERR_DATA; /* 0x168 32 R PCI Erroneous Data register */
|
||||
|
||||
uint32 PAD[5]; /* 0x16C-0x17F PADDING */
|
||||
|
||||
uint32 WB_CONF_SPC_BAR; /* 0x180 32 R WISHBONE Configuration Space Base Address */
|
||||
uint32 W_IMG_CTRL1; /* 0x184 32 R/W WISHBONE Image1 Control register */
|
||||
uint32 W_BA1; /* 0x188 32 R/W WISHBONE Image1 Base Address register */
|
||||
uint32 W_AM1; /* 0x18C 32 R/W WISHBONE Image1 Address Mask register */
|
||||
uint32 W_TA1; /* 0x190 32 R/W WISHBONE Image1 Translation Address reg */
|
||||
uint32 W_IMG_CTRL2; /* 0x194 32 R/W WISHBONE Image2 Control register */
|
||||
uint32 W_BA2; /* 0x198 32 R/W WISHBONE Image2 Base Address register */
|
||||
uint32 W_AM2; /* 0x19C 32 R/W WISHBONE Image2 Address Mask register */
|
||||
uint32 W_TA2; /* 0x1A0 32 R/W WISHBONE Image2 Translation Address reg */
|
||||
uint32 W_IMG_CTRL3; /* 0x1A4 32 R/W WISHBONE Image3 Control register */
|
||||
uint32 W_BA3; /* 0x1A8 32 R/W WISHBONE Image3 Base Address register */
|
||||
uint32 W_AM3; /* 0x1AC 32 R/W WISHBONE Image3 Address Mask register */
|
||||
uint32 W_TA3; /* 0x1B0 32 R/W WISHBONE Image3 Translation Address reg */
|
||||
uint32 W_IMG_CTRL4; /* 0x1B4 32 R/W WISHBONE Image4 Control register */
|
||||
uint32 W_BA4; /* 0x1B8 32 R/W WISHBONE Image4 Base Address register */
|
||||
uint32 W_AM4; /* 0x1BC 32 R/W WISHBONE Image4 Address Mask register */
|
||||
uint32 W_TA4; /* 0x1C0 32 R/W WISHBONE Image4 Translation Address reg */
|
||||
uint32 W_IMG_CTRL5; /* 0x1C4 32 R/W WISHBONE Image5 Control register */
|
||||
uint32 W_BA5; /* 0x1C8 32 R/W WISHBONE Image5 Base Address register */
|
||||
uint32 W_AM5; /* 0x1CC 32 R/W WISHBONE Image5 Address Mask register */
|
||||
uint32 W_TA5; /* 0x1D0 32 R/W WISHBONE Image5 Translation Address reg */
|
||||
uint32 W_ERR_CS; /* 0x1D4 32 R/W WISHBONE Error Control and Status reg */
|
||||
uint32 W_ERR_ADDR; /* 0x1D8 32 R WISHBONE Erroneous Address register */
|
||||
uint32 W_ERR_DATA; /* 0x1DC 32 R WISHBONE Erroneous Data register */
|
||||
uint32 CNF_ADDR; /* 0x1E0 32 R/W Configuration Cycle register */
|
||||
uint32 CNF_DATA; /* 0x1E4 32 R/W Configuration Cycle Generation Data reg */
|
||||
|
||||
uint32 INT_ACK; /* 0x1E8 32 R Interrupt Acknowledge register */
|
||||
uint32 ICR; /* 0x1EC 32 R/W Interrupt Control register */
|
||||
uint32 ISR; /* 0x1F0 32 R/W Interrupt Status register */
|
||||
} spih_pciregs_t;
|
||||
|
||||
/*
|
||||
* PCI Core interrupt enable and status bit definitions.
|
||||
*/
|
||||
|
||||
/* PCI Core ICR Register bit definitions */
|
||||
#define PCI_INT_PROP_EN (1 << 0) /* Interrupt Propagation Enable */
|
||||
#define PCI_WB_ERR_INT_EN (1 << 1) /* Wishbone Error Interrupt Enable */
|
||||
#define PCI_PCI_ERR_INT_EN (1 << 2) /* PCI Error Interrupt Enable */
|
||||
#define PCI_PAR_ERR_INT_EN (1 << 3) /* Parity Error Interrupt Enable */
|
||||
#define PCI_SYS_ERR_INT_EN (1 << 4) /* System Error Interrupt Enable */
|
||||
#define PCI_SOFTWARE_RESET (1U << 31) /* Software reset of the PCI Core. */
|
||||
|
||||
|
||||
/* PCI Core ISR Register bit definitions */
|
||||
#define PCI_INT_PROP_ST (1 << 0) /* Interrupt Propagation Status */
|
||||
#define PCI_WB_ERR_INT_ST (1 << 1) /* Wishbone Error Interrupt Status */
|
||||
#define PCI_PCI_ERR_INT_ST (1 << 2) /* PCI Error Interrupt Status */
|
||||
#define PCI_PAR_ERR_INT_ST (1 << 3) /* Parity Error Interrupt Status */
|
||||
#define PCI_SYS_ERR_INT_ST (1 << 4) /* System Error Interrupt Status */
|
||||
|
||||
|
||||
/* Registers on the Wishbone bus */
|
||||
#define SPIH_CTLR_INTR (1 << 0) /* SPI Host Controller Core Interrupt */
|
||||
#define SPIH_DEV_INTR (1 << 1) /* SPI Device Interrupt */
|
||||
#define SPIH_WFIFO_INTR (1 << 2) /* SPI Tx FIFO Empty Intr (FPGA Rev >= 8) */
|
||||
|
||||
/* GPIO Bit definitions */
|
||||
#define SPIH_CS (1 << 0) /* SPI Chip Select (active low) */
|
||||
#define SPIH_SLOT_POWER (1 << 1) /* SD Card Slot Power Enable */
|
||||
#define SPIH_CARD_DETECT (1 << 2) /* SD Card Detect */
|
||||
|
||||
/* SPI Status Register Bit definitions */
|
||||
#define SPIH_STATE_MASK 0x30 /* SPI Transfer State Machine state mask */
|
||||
#define SPIH_STATE_SHIFT 4 /* SPI Transfer State Machine state shift */
|
||||
#define SPIH_WFFULL (1 << 3) /* SPI Write FIFO Full */
|
||||
#define SPIH_WFEMPTY (1 << 2) /* SPI Write FIFO Empty */
|
||||
#define SPIH_RFFULL (1 << 1) /* SPI Read FIFO Full */
|
||||
#define SPIH_RFEMPTY (1 << 0) /* SPI Read FIFO Empty */
|
||||
|
||||
#define SPIH_EXT_CLK (1U << 31) /* Use External Clock as PLL Clock source. */
|
||||
|
||||
#define SPIH_PLL_NO_CLK (1 << 1) /* Set to 1 if the PLL's input clock is lost. */
|
||||
#define SPIH_PLL_LOCKED (1 << 3) /* Set to 1 when the PLL is locked. */
|
||||
|
||||
/* Spin bit loop bound check */
|
||||
#define SPI_SPIN_BOUND 0xf4240 /* 1 million */
|
||||
|
||||
#endif /* _BCM_PCI_SPI_H */
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Performance counters software interface.
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: bcmperf.h 514727 2014-11-12 03:02:48Z $
|
||||
*/
|
||||
/* essai */
|
||||
#ifndef _BCMPERF_H_
|
||||
#define _BCMPERF_H_
|
||||
/* get cache hits and misses */
|
||||
#define BCMPERF_ENABLE_INSTRCOUNT()
|
||||
#define BCMPERF_ENABLE_ICACHE_MISS()
|
||||
#define BCMPERF_ENABLE_ICACHE_HIT()
|
||||
#define BCMPERF_GETICACHE_MISS(x) ((x) = 0)
|
||||
#define BCMPERF_GETICACHE_HIT(x) ((x) = 0)
|
||||
#define BCMPERF_GETINSTRCOUNT(x) ((x) = 0)
|
||||
#endif /* _BCMPERF_H_ */
|
|
@ -0,0 +1,173 @@
|
|||
/*
|
||||
* Definitions for API from sdio common code (bcmsdh) to individual
|
||||
* host controller drivers.
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: bcmsdbus.h 644725 2016-06-21 12:26:04Z $
|
||||
*/
|
||||
|
||||
#ifndef _sdio_api_h_
|
||||
#define _sdio_api_h_
|
||||
|
||||
#if defined(BT_OVER_SDIO)
|
||||
#include <linux/mmc/sdio_func.h>
|
||||
#endif /* defined (BT_OVER_SDIO) */
|
||||
|
||||
|
||||
#define SDIOH_API_RC_SUCCESS (0x00)
|
||||
#define SDIOH_API_RC_FAIL (0x01)
|
||||
#define SDIOH_API_SUCCESS(status) (status == 0)
|
||||
|
||||
#define SDIOH_READ 0 /* Read request */
|
||||
#define SDIOH_WRITE 1 /* Write request */
|
||||
|
||||
#define SDIOH_DATA_FIX 0 /* Fixed addressing */
|
||||
#define SDIOH_DATA_INC 1 /* Incremental addressing */
|
||||
|
||||
#define SDIOH_CMD_TYPE_NORMAL 0 /* Normal command */
|
||||
#define SDIOH_CMD_TYPE_APPEND 1 /* Append command */
|
||||
#define SDIOH_CMD_TYPE_CUTTHRU 2 /* Cut-through command */
|
||||
|
||||
#define SDIOH_DATA_PIO 0 /* PIO mode */
|
||||
#define SDIOH_DATA_DMA 1 /* DMA mode */
|
||||
|
||||
/* Max number of glommed pkts */
|
||||
#ifdef CUSTOM_MAX_TXGLOM_SIZE
|
||||
#define SDPCM_MAXGLOM_SIZE CUSTOM_MAX_TXGLOM_SIZE
|
||||
#else
|
||||
#define SDPCM_MAXGLOM_SIZE 36
|
||||
#endif /* CUSTOM_MAX_TXGLOM_SIZE */
|
||||
|
||||
#define SDPCM_TXGLOM_CPY 0 /* SDIO 2.0 should use copy mode */
|
||||
#define SDPCM_TXGLOM_MDESC 1 /* SDIO 3.0 should use multi-desc mode */
|
||||
|
||||
#ifdef CUSTOM_DEF_TXGLOM_SIZE
|
||||
#define SDPCM_DEFGLOM_SIZE CUSTOM_DEF_TXGLOM_SIZE
|
||||
#else
|
||||
#define SDPCM_DEFGLOM_SIZE SDPCM_MAXGLOM_SIZE
|
||||
#endif /* CUSTOM_DEF_TXGLOM_SIZE */
|
||||
|
||||
#if SDPCM_DEFGLOM_SIZE > SDPCM_MAXGLOM_SIZE
|
||||
#warning "SDPCM_DEFGLOM_SIZE cannot be higher than SDPCM_MAXGLOM_SIZE!!"
|
||||
#undef SDPCM_DEFGLOM_SIZE
|
||||
#define SDPCM_DEFGLOM_SIZE SDPCM_MAXGLOM_SIZE
|
||||
#endif
|
||||
|
||||
#ifdef PKT_STATICS
|
||||
typedef struct pkt_statics {
|
||||
uint16 event_count;
|
||||
uint32 event_size;
|
||||
uint16 ctrl_count;
|
||||
uint32 ctrl_size;
|
||||
uint32 data_count;
|
||||
uint32 data_size;
|
||||
uint32 glom_cnt[SDPCM_MAXGLOM_SIZE];
|
||||
uint16 glom_max;
|
||||
uint16 glom_count;
|
||||
uint32 glom_size;
|
||||
uint16 test_count;
|
||||
uint32 test_size;
|
||||
} pkt_statics_t;
|
||||
#endif
|
||||
|
||||
typedef int SDIOH_API_RC;
|
||||
|
||||
/* SDio Host structure */
|
||||
typedef struct sdioh_info sdioh_info_t;
|
||||
|
||||
/* callback function, taking one arg */
|
||||
typedef void (*sdioh_cb_fn_t)(void *);
|
||||
#if defined(BT_OVER_SDIO)
|
||||
extern
|
||||
void sdioh_sdmmc_card_enable_func_f3(sdioh_info_t *sd, struct sdio_func *func);
|
||||
#endif /* defined (BT_OVER_SDIO) */
|
||||
|
||||
extern SDIOH_API_RC sdioh_interrupt_register(sdioh_info_t *si, sdioh_cb_fn_t fn, void *argh);
|
||||
extern SDIOH_API_RC sdioh_interrupt_deregister(sdioh_info_t *si);
|
||||
|
||||
/* query whether SD interrupt is enabled or not */
|
||||
extern SDIOH_API_RC sdioh_interrupt_query(sdioh_info_t *si, bool *onoff);
|
||||
|
||||
/* enable or disable SD interrupt */
|
||||
extern SDIOH_API_RC sdioh_interrupt_set(sdioh_info_t *si, bool enable_disable);
|
||||
|
||||
#if defined(DHD_DEBUG)
|
||||
extern bool sdioh_interrupt_pending(sdioh_info_t *si);
|
||||
#endif
|
||||
|
||||
/* read or write one byte using cmd52 */
|
||||
extern SDIOH_API_RC sdioh_request_byte(sdioh_info_t *si, uint rw, uint fnc, uint addr, uint8 *byte);
|
||||
|
||||
/* read or write 2/4 bytes using cmd53 */
|
||||
extern SDIOH_API_RC sdioh_request_word(sdioh_info_t *si, uint cmd_type, uint rw, uint fnc,
|
||||
uint addr, uint32 *word, uint nbyte);
|
||||
|
||||
/* read or write any buffer using cmd53 */
|
||||
extern SDIOH_API_RC sdioh_request_buffer(sdioh_info_t *si, uint pio_dma, uint fix_inc,
|
||||
uint rw, uint fnc_num, uint32 addr, uint regwidth, uint32 buflen, uint8 *buffer,
|
||||
void *pkt);
|
||||
|
||||
/* get cis data */
|
||||
extern SDIOH_API_RC sdioh_cis_read(sdioh_info_t *si, uint fuc, uint8 *cis, uint32 length);
|
||||
extern SDIOH_API_RC sdioh_cisaddr_read(sdioh_info_t *sd, uint func, uint8 *cisd, uint32 offset);
|
||||
|
||||
extern SDIOH_API_RC sdioh_cfg_read(sdioh_info_t *si, uint fuc, uint32 addr, uint8 *data);
|
||||
extern SDIOH_API_RC sdioh_cfg_write(sdioh_info_t *si, uint fuc, uint32 addr, uint8 *data);
|
||||
|
||||
/* query number of io functions */
|
||||
extern uint sdioh_query_iofnum(sdioh_info_t *si);
|
||||
|
||||
/* handle iovars */
|
||||
extern int sdioh_iovar_op(sdioh_info_t *si, const char *name,
|
||||
void *params, int plen, void *arg, int len, bool set);
|
||||
|
||||
/* Issue abort to the specified function and clear controller as needed */
|
||||
extern int sdioh_abort(sdioh_info_t *si, uint fnc);
|
||||
|
||||
/* Start and Stop SDIO without re-enumerating the SD card. */
|
||||
extern int sdioh_start(sdioh_info_t *si, int stage);
|
||||
extern int sdioh_stop(sdioh_info_t *si);
|
||||
|
||||
/* Wait system lock free */
|
||||
extern int sdioh_waitlockfree(sdioh_info_t *si);
|
||||
|
||||
/* Reset and re-initialize the device */
|
||||
extern int sdioh_sdio_reset(sdioh_info_t *si);
|
||||
|
||||
|
||||
|
||||
#if defined(BCMSDIOH_STD)
|
||||
#define SDIOH_SLEEP_ENABLED
|
||||
#endif
|
||||
extern SDIOH_API_RC sdioh_sleep(sdioh_info_t *si, bool enab);
|
||||
|
||||
/* GPIO support */
|
||||
extern SDIOH_API_RC sdioh_gpio_init(sdioh_info_t *sd);
|
||||
extern bool sdioh_gpioin(sdioh_info_t *sd, uint32 gpio);
|
||||
extern SDIOH_API_RC sdioh_gpioouten(sdioh_info_t *sd, uint32 gpio);
|
||||
extern SDIOH_API_RC sdioh_gpioout(sdioh_info_t *sd, uint32 gpio, bool enab);
|
||||
extern uint sdioh_set_mode(sdioh_info_t *sd, uint mode);
|
||||
|
||||
#endif /* _sdio_api_h_ */
|
|
@ -0,0 +1,273 @@
|
|||
/*
|
||||
* SDIO host client driver interface of Broadcom HNBU
|
||||
* export functions to client drivers
|
||||
* abstract OS and BUS specific details of SDIO
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: bcmsdh.h 698895 2017-05-11 02:55:17Z $
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file bcmsdh.h
|
||||
*/
|
||||
|
||||
#ifndef _bcmsdh_h_
|
||||
#define _bcmsdh_h_
|
||||
|
||||
#define BCMSDH_ERROR_VAL 0x0001 /* Error */
|
||||
#define BCMSDH_INFO_VAL 0x0002 /* Info */
|
||||
extern const uint bcmsdh_msglevel;
|
||||
|
||||
#define BCMSDH_ERROR(x) printf x
|
||||
#define BCMSDH_INFO(x)
|
||||
|
||||
#if defined(BCMSDIO) && (defined(BCMSDIOH_STD) || defined(BCMSDIOH_BCM) || \
|
||||
defined(BCMSDIOH_SPI))
|
||||
#define BCMSDH_ADAPTER
|
||||
#endif /* BCMSDIO && (BCMSDIOH_STD || BCMSDIOH_BCM || BCMSDIOH_SPI) */
|
||||
|
||||
/* forward declarations */
|
||||
typedef struct bcmsdh_info bcmsdh_info_t;
|
||||
typedef void (*bcmsdh_cb_fn_t)(void *);
|
||||
|
||||
|
||||
#if defined(BT_OVER_SDIO)
|
||||
typedef enum {
|
||||
NO_HANG_STATE = 0,
|
||||
HANG_START_STATE = 1,
|
||||
HANG_RECOVERY_STATE = 2
|
||||
} dhd_hang_state_t;
|
||||
#endif
|
||||
|
||||
extern bcmsdh_info_t *bcmsdh_attach(osl_t *osh, void *sdioh, ulong *regsva);
|
||||
/**
|
||||
* BCMSDH API context
|
||||
*/
|
||||
struct bcmsdh_info
|
||||
{
|
||||
bool init_success; /* underlying driver successfully attached */
|
||||
void *sdioh; /* handler for sdioh */
|
||||
uint32 vendevid; /* Target Vendor and Device ID on SD bus */
|
||||
osl_t *osh;
|
||||
bool regfail; /* Save status of last reg_read/reg_write call */
|
||||
uint32 sbwad; /* Save backplane window address */
|
||||
void *os_cxt; /* Pointer to per-OS private data */
|
||||
bool force_sbwad_calc; /* forces calculation of sbwad instead of using cached value */
|
||||
#ifdef DHD_WAKE_STATUS
|
||||
unsigned int total_wake_count;
|
||||
int pkt_wake;
|
||||
#endif /* DHD_WAKE_STATUS */
|
||||
};
|
||||
|
||||
/* Detach - freeup resources allocated in attach */
|
||||
extern int bcmsdh_detach(osl_t *osh, void *sdh);
|
||||
|
||||
/* Query if SD device interrupts are enabled */
|
||||
extern bool bcmsdh_intr_query(void *sdh);
|
||||
|
||||
/* Enable/disable SD interrupt */
|
||||
extern int bcmsdh_intr_enable(void *sdh);
|
||||
extern int bcmsdh_intr_disable(void *sdh);
|
||||
|
||||
/* Register/deregister device interrupt handler. */
|
||||
extern int bcmsdh_intr_reg(void *sdh, bcmsdh_cb_fn_t fn, void *argh);
|
||||
extern int bcmsdh_intr_dereg(void *sdh);
|
||||
/* Enable/disable SD card interrupt forward */
|
||||
extern void bcmsdh_intr_forward(void *sdh, bool pass);
|
||||
|
||||
#if defined(DHD_DEBUG)
|
||||
/* Query pending interrupt status from the host controller */
|
||||
extern bool bcmsdh_intr_pending(void *sdh);
|
||||
#endif
|
||||
|
||||
/* Register a callback to be called if and when bcmsdh detects
|
||||
* device removal. No-op in the case of non-removable/hardwired devices.
|
||||
*/
|
||||
extern int bcmsdh_devremove_reg(void *sdh, bcmsdh_cb_fn_t fn, void *argh);
|
||||
|
||||
/* Access SDIO address space (e.g. CCCR) using CMD52 (single-byte interface).
|
||||
* fn: function number
|
||||
* addr: unmodified SDIO-space address
|
||||
* data: data byte to write
|
||||
* err: pointer to error code (or NULL)
|
||||
*/
|
||||
extern uint8 bcmsdh_cfg_read(void *sdh, uint func, uint32 addr, int *err);
|
||||
extern void bcmsdh_cfg_write(void *sdh, uint func, uint32 addr, uint8 data, int *err);
|
||||
|
||||
/* Read/Write 4bytes from/to cfg space */
|
||||
extern uint32 bcmsdh_cfg_read_word(void *sdh, uint fnc_num, uint32 addr, int *err);
|
||||
extern void bcmsdh_cfg_write_word(void *sdh, uint fnc_num, uint32 addr, uint32 data, int *err);
|
||||
|
||||
/* Read CIS content for specified function.
|
||||
* fn: function whose CIS is being requested (0 is common CIS)
|
||||
* cis: pointer to memory location to place results
|
||||
* length: number of bytes to read
|
||||
* Internally, this routine uses the values from the cis base regs (0x9-0xB)
|
||||
* to form an SDIO-space address to read the data from.
|
||||
*/
|
||||
extern int bcmsdh_cis_read(void *sdh, uint func, uint8 *cis, uint length);
|
||||
extern int bcmsdh_cisaddr_read(void *sdh, uint func, uint8 *cisd, uint offset);
|
||||
|
||||
/* Synchronous access to device (client) core registers via CMD53 to F1.
|
||||
* addr: backplane address (i.e. >= regsva from attach)
|
||||
* size: register width in bytes (2 or 4)
|
||||
* data: data for register write
|
||||
*/
|
||||
extern uint32 bcmsdh_reg_read(void *sdh, uintptr addr, uint size);
|
||||
extern uint32 bcmsdh_reg_write(void *sdh, uintptr addr, uint size, uint32 data);
|
||||
|
||||
/* set sb address window */
|
||||
extern int bcmsdhsdio_set_sbaddr_window(void *sdh, uint32 address, bool force_set);
|
||||
|
||||
/* Indicate if last reg read/write failed */
|
||||
extern bool bcmsdh_regfail(void *sdh);
|
||||
|
||||
/* Buffer transfer to/from device (client) core via cmd53.
|
||||
* fn: function number
|
||||
* addr: backplane address (i.e. >= regsva from attach)
|
||||
* flags: backplane width, address increment, sync/async
|
||||
* buf: pointer to memory data buffer
|
||||
* nbytes: number of bytes to transfer to/from buf
|
||||
* pkt: pointer to packet associated with buf (if any)
|
||||
* complete: callback function for command completion (async only)
|
||||
* handle: handle for completion callback (first arg in callback)
|
||||
* Returns 0 or error code.
|
||||
* NOTE: Async operation is not currently supported.
|
||||
*/
|
||||
typedef void (*bcmsdh_cmplt_fn_t)(void *handle, int status, bool sync_waiting);
|
||||
extern int bcmsdh_send_buf(void *sdh, uint32 addr, uint fn, uint flags,
|
||||
uint8 *buf, uint nbytes, void *pkt,
|
||||
bcmsdh_cmplt_fn_t complete_fn, void *handle);
|
||||
extern int bcmsdh_recv_buf(void *sdh, uint32 addr, uint fn, uint flags,
|
||||
uint8 *buf, uint nbytes, void *pkt,
|
||||
bcmsdh_cmplt_fn_t complete_fn, void *handle);
|
||||
|
||||
extern void bcmsdh_glom_post(void *sdh, uint8 *frame, void *pkt, uint len);
|
||||
extern void bcmsdh_glom_clear(void *sdh);
|
||||
extern uint bcmsdh_set_mode(void *sdh, uint mode);
|
||||
extern bool bcmsdh_glom_enabled(void);
|
||||
/* Flags bits */
|
||||
#define SDIO_REQ_4BYTE 0x1 /* Four-byte target (backplane) width (vs. two-byte) */
|
||||
#define SDIO_REQ_FIXED 0x2 /* Fixed address (FIFO) (vs. incrementing address) */
|
||||
#define SDIO_REQ_ASYNC 0x4 /* Async request (vs. sync request) */
|
||||
#define SDIO_BYTE_MODE 0x8 /* Byte mode request(non-block mode) */
|
||||
|
||||
/* Pending (non-error) return code */
|
||||
#define BCME_PENDING 1
|
||||
|
||||
/* Read/write to memory block (F1, no FIFO) via CMD53 (sync only).
|
||||
* rw: read or write (0/1)
|
||||
* addr: direct SDIO address
|
||||
* buf: pointer to memory data buffer
|
||||
* nbytes: number of bytes to transfer to/from buf
|
||||
* Returns 0 or error code.
|
||||
*/
|
||||
extern int bcmsdh_rwdata(void *sdh, uint rw, uint32 addr, uint8 *buf, uint nbytes);
|
||||
|
||||
/* Issue an abort to the specified function */
|
||||
extern int bcmsdh_abort(void *sdh, uint fn);
|
||||
|
||||
/* Start SDIO Host Controller communication */
|
||||
extern int bcmsdh_start(void *sdh, int stage);
|
||||
|
||||
/* Stop SDIO Host Controller communication */
|
||||
extern int bcmsdh_stop(void *sdh);
|
||||
|
||||
/* Wait system lock free */
|
||||
extern int bcmsdh_waitlockfree(void *sdh);
|
||||
|
||||
/* Returns the "Device ID" of target device on the SDIO bus. */
|
||||
extern int bcmsdh_query_device(void *sdh);
|
||||
|
||||
/* Returns the number of IO functions reported by the device */
|
||||
extern uint bcmsdh_query_iofnum(void *sdh);
|
||||
|
||||
/* Miscellaneous knob tweaker. */
|
||||
extern int bcmsdh_iovar_op(void *sdh, const char *name,
|
||||
void *params, int plen, void *arg, int len, bool set);
|
||||
|
||||
/* Reset and reinitialize the device */
|
||||
extern int bcmsdh_reset(bcmsdh_info_t *sdh);
|
||||
|
||||
/* helper functions */
|
||||
|
||||
/* callback functions */
|
||||
typedef struct {
|
||||
/* probe the device */
|
||||
void *(*probe)(uint16 vend_id, uint16 dev_id, uint16 bus, uint16 slot,
|
||||
uint16 func, uint bustype, void * regsva, osl_t * osh,
|
||||
void * param);
|
||||
/* remove the device */
|
||||
void (*remove)(void *context);
|
||||
/* can we suspend now */
|
||||
int (*suspend)(void *context);
|
||||
/* resume from suspend */
|
||||
int (*resume)(void *context);
|
||||
} bcmsdh_driver_t;
|
||||
|
||||
/* platform specific/high level functions */
|
||||
extern int bcmsdh_register(bcmsdh_driver_t *driver);
|
||||
extern void bcmsdh_unregister(void);
|
||||
extern bool bcmsdh_chipmatch(uint16 vendor, uint16 device);
|
||||
extern void bcmsdh_device_remove(void * sdh);
|
||||
|
||||
extern int bcmsdh_reg_sdio_notify(void* semaphore);
|
||||
extern void bcmsdh_unreg_sdio_notify(void);
|
||||
|
||||
#if defined(OOB_INTR_ONLY)
|
||||
extern int bcmsdh_oob_intr_register(bcmsdh_info_t *bcmsdh, bcmsdh_cb_fn_t oob_irq_handler,
|
||||
void* oob_irq_handler_context);
|
||||
extern void bcmsdh_oob_intr_unregister(bcmsdh_info_t *sdh);
|
||||
extern void bcmsdh_oob_intr_set(bcmsdh_info_t *sdh, bool enable);
|
||||
#endif
|
||||
extern void bcmsdh_dev_pm_stay_awake(bcmsdh_info_t *sdh);
|
||||
extern void bcmsdh_dev_relax(bcmsdh_info_t *sdh);
|
||||
extern bool bcmsdh_dev_pm_enabled(bcmsdh_info_t *sdh);
|
||||
|
||||
int bcmsdh_suspend(bcmsdh_info_t *bcmsdh);
|
||||
int bcmsdh_resume(bcmsdh_info_t *bcmsdh);
|
||||
|
||||
/* Function to pass device-status bits to DHD. */
|
||||
extern uint32 bcmsdh_get_dstatus(void *sdh);
|
||||
|
||||
/* Function to return current window addr */
|
||||
extern uint32 bcmsdh_cur_sbwad(void *sdh);
|
||||
|
||||
/* function to force sbwad calculation instead of using cached value */
|
||||
extern void bcmsdh_force_sbwad_calc(void *sdh, bool force);
|
||||
|
||||
/* Function to pass chipid and rev to lower layers for controlling pr's */
|
||||
extern void bcmsdh_chipinfo(void *sdh, uint32 chip, uint32 chiprev);
|
||||
|
||||
|
||||
extern int bcmsdh_sleep(void *sdh, bool enab);
|
||||
|
||||
/* GPIO support */
|
||||
extern int bcmsdh_gpio_init(void *sd);
|
||||
extern bool bcmsdh_gpioin(void *sd, uint32 gpio);
|
||||
extern int bcmsdh_gpioouten(void *sd, uint32 gpio);
|
||||
extern int bcmsdh_gpioout(void *sd, uint32 gpio, bool enab);
|
||||
|
||||
#endif /* _bcmsdh_h_ */
|
|
@ -0,0 +1,129 @@
|
|||
/*
|
||||
* BCMSDH Function Driver for the native SDIO/MMC driver in the Linux Kernel
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Proprietary,Open:>>
|
||||
*
|
||||
* $Id: bcmsdh_sdmmc.h 687253 2017-02-28 09:33:36Z $
|
||||
*/
|
||||
|
||||
#ifndef __BCMSDH_SDMMC_H__
|
||||
#define __BCMSDH_SDMMC_H__
|
||||
|
||||
#define sd_err(x) do { if (sd_msglevel & SDH_ERROR_VAL) printf x; } while (0)
|
||||
#define sd_trace(x) do { if (sd_msglevel & SDH_TRACE_VAL) printf x; } while (0)
|
||||
#define sd_info(x) do { if (sd_msglevel & SDH_INFO_VAL) printf x; } while (0)
|
||||
#define sd_debug(x) do { if (sd_msglevel & SDH_DEBUG_VAL) printf x; } while (0)
|
||||
#define sd_data(x) do { if (sd_msglevel & SDH_DATA_VAL) printf x; } while (0)
|
||||
#define sd_ctrl(x) do { if (sd_msglevel & SDH_CTRL_VAL) printf x; } while (0)
|
||||
#define sd_cost(x) do { if (sd_msglevel & SDH_COST_VAL) printf x; } while (0)
|
||||
|
||||
#define sd_sync_dma(sd, read, nbytes)
|
||||
#define sd_init_dma(sd)
|
||||
#define sd_ack_intr(sd)
|
||||
#define sd_wakeup(sd);
|
||||
|
||||
#define sd_log(x)
|
||||
|
||||
#define SDIOH_ASSERT(exp) \
|
||||
do { if (!(exp)) \
|
||||
printf("!!!ASSERT fail: file %s lines %d", __FILE__, __LINE__); \
|
||||
} while (0)
|
||||
|
||||
#define BLOCK_SIZE_4318 64
|
||||
#define BLOCK_SIZE_4328 512
|
||||
|
||||
/* internal return code */
|
||||
#define SUCCESS 0
|
||||
#define ERROR 1
|
||||
|
||||
/* private bus modes */
|
||||
#define SDIOH_MODE_SD4 2
|
||||
#define CLIENT_INTR 0x100 /* Get rid of this! */
|
||||
#define SDIOH_SDMMC_MAX_SG_ENTRIES (SDPCM_MAXGLOM_SIZE + 2)
|
||||
|
||||
struct sdioh_info {
|
||||
osl_t *osh; /* osh handler */
|
||||
void *bcmsdh; /* upper layer handle */
|
||||
bool client_intr_enabled; /* interrupt connnected flag */
|
||||
bool intr_handler_valid; /* client driver interrupt handler valid */
|
||||
sdioh_cb_fn_t intr_handler; /* registered interrupt handler */
|
||||
void *intr_handler_arg; /* argument to call interrupt handler */
|
||||
uint16 intmask; /* Current active interrupts */
|
||||
|
||||
int intrcount; /* Client interrupts */
|
||||
bool sd_use_dma; /* DMA on CMD53 */
|
||||
bool sd_blockmode; /* sd_blockmode == FALSE => 64 Byte Cmd 53s. */
|
||||
/* Must be on for sd_multiblock to be effective */
|
||||
bool use_client_ints; /* If this is false, make sure to restore */
|
||||
int sd_mode; /* SD1/SD4/SPI */
|
||||
int client_block_size[SDIOD_MAX_IOFUNCS]; /* Blocksize */
|
||||
uint8 num_funcs; /* Supported funcs on client */
|
||||
uint32 com_cis_ptr;
|
||||
uint32 func_cis_ptr[SDIOD_MAX_IOFUNCS];
|
||||
bool use_rxchain;
|
||||
struct scatterlist sg_list[SDIOH_SDMMC_MAX_SG_ENTRIES];
|
||||
struct sdio_func fake_func0;
|
||||
struct sdio_func *func[SDIOD_MAX_IOFUNCS];
|
||||
uint sd_clk_rate;
|
||||
uint txglom_mode; /* Txglom mode: 0 - copy, 1 - multi-descriptor */
|
||||
};
|
||||
|
||||
/************************************************************
|
||||
* Internal interfaces: per-port references into bcmsdh_sdmmc.c
|
||||
*/
|
||||
|
||||
/* Global message bits */
|
||||
extern uint sd_msglevel;
|
||||
|
||||
/* OS-independent interrupt handler */
|
||||
extern bool check_client_intr(sdioh_info_t *sd);
|
||||
|
||||
/* Core interrupt enable/disable of device interrupts */
|
||||
extern void sdioh_sdmmc_devintr_on(sdioh_info_t *sd);
|
||||
extern void sdioh_sdmmc_devintr_off(sdioh_info_t *sd);
|
||||
|
||||
|
||||
/**************************************************************
|
||||
* Internal interfaces: bcmsdh_sdmmc.c references to per-port code
|
||||
*/
|
||||
|
||||
/* Register mapping routines */
|
||||
extern uint32 *sdioh_sdmmc_reg_map(osl_t *osh, int32 addr, int size);
|
||||
extern void sdioh_sdmmc_reg_unmap(osl_t *osh, int32 addr, int size);
|
||||
|
||||
/* Interrupt (de)registration routines */
|
||||
extern int sdioh_sdmmc_register_irq(sdioh_info_t *sd, uint irq);
|
||||
extern void sdioh_sdmmc_free_irq(uint irq, sdioh_info_t *sd);
|
||||
|
||||
extern sdioh_info_t *sdioh_attach(osl_t *osh, struct sdio_func *func);
|
||||
extern SDIOH_API_RC sdioh_detach(osl_t *osh, sdioh_info_t *sd);
|
||||
|
||||
#ifdef GLOBAL_SDMMC_INSTANCE
|
||||
typedef struct _BCMSDH_SDMMC_INSTANCE {
|
||||
sdioh_info_t *sd;
|
||||
struct sdio_func *func[SDIOD_MAX_IOFUNCS];
|
||||
} BCMSDH_SDMMC_INSTANCE, *PBCMSDH_SDMMC_INSTANCE;
|
||||
#endif
|
||||
|
||||
#endif /* __BCMSDH_SDMMC_H__ */
|
|
@ -0,0 +1,301 @@
|
|||
/*
|
||||
* Broadcom SDIO/PCMCIA
|
||||
* Software-specific definitions shared between device and host side
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: bcmsdpcm.h 614070 2016-01-21 00:55:57Z $
|
||||
*/
|
||||
|
||||
#ifndef _bcmsdpcm_h_
|
||||
#define _bcmsdpcm_h_
|
||||
|
||||
/*
|
||||
* Software allocation of To SB Mailbox resources
|
||||
*/
|
||||
|
||||
/* intstatus bits */
|
||||
#define I_SMB_NAK I_SMB_SW0 /* To SB Mailbox Frame NAK */
|
||||
#define I_SMB_INT_ACK I_SMB_SW1 /* To SB Mailbox Host Interrupt ACK */
|
||||
#define I_SMB_USE_OOB I_SMB_SW2 /* To SB Mailbox Use OOB Wakeup */
|
||||
#define I_SMB_DEV_INT I_SMB_SW3 /* To SB Mailbox Miscellaneous Interrupt */
|
||||
|
||||
#define I_TOSBMAIL (I_SMB_NAK | I_SMB_INT_ACK | I_SMB_USE_OOB | I_SMB_DEV_INT)
|
||||
|
||||
/* tosbmailbox bits corresponding to intstatus bits */
|
||||
#define SMB_NAK (1 << 0) /* To SB Mailbox Frame NAK */
|
||||
#define SMB_INT_ACK (1 << 1) /* To SB Mailbox Host Interrupt ACK */
|
||||
#define SMB_USE_OOB (1 << 2) /* To SB Mailbox Use OOB Wakeup */
|
||||
#define SMB_DEV_INT (1 << 3) /* To SB Mailbox Miscellaneous Interrupt */
|
||||
#define SMB_MASK 0x0000000f /* To SB Mailbox Mask */
|
||||
|
||||
/* tosbmailboxdata */
|
||||
|
||||
#ifdef DS_PROT
|
||||
/* Bit msgs for custom deep sleep protocol */
|
||||
#define SMB_DATA_D3INFORM 0x100 /* host announcing D3 entry */
|
||||
#define SMB_DATA_DSACK 0x200 /* host acking a deepsleep request */
|
||||
#define SMB_DATA_DSNACK 0x400 /* host nacking a deepsleep request */
|
||||
#endif /* DS_PROT */
|
||||
|
||||
#define SMB_DATA_VERSION_MASK 0x00ff0000 /* host protocol version (sent with F2 enable) */
|
||||
#define SMB_DATA_VERSION_SHIFT 16 /* host protocol version (sent with F2 enable) */
|
||||
|
||||
/*
|
||||
* Software allocation of To Host Mailbox resources
|
||||
*/
|
||||
|
||||
/* intstatus bits */
|
||||
#define I_HMB_INT_ACK I_HMB_SW0 /* To Host Mailbox Dev Interrupt ACK */
|
||||
#define I_HMB_FC_STATE I_HMB_SW0 /* To Host Mailbox Flow Control State */
|
||||
#define I_HMB_FC_CHANGE I_HMB_SW1 /* To Host Mailbox Flow Control State Changed */
|
||||
#define I_HMB_FRAME_IND I_HMB_SW2 /* To Host Mailbox Frame Indication */
|
||||
#define I_HMB_HOST_INT I_HMB_SW3 /* To Host Mailbox Miscellaneous Interrupt */
|
||||
|
||||
#define I_TOHOSTMAIL (I_HMB_INT_ACK | I_HMB_FRAME_IND | I_HMB_HOST_INT)
|
||||
|
||||
/* tohostmailbox bits corresponding to intstatus bits */
|
||||
#define HMB_INT_ACK (1 << 0) /* To Host Mailbox Dev Interrupt ACK */
|
||||
#define HMB_FRAME_IND (1 << 2) /* To Host Mailbox Frame Indication */
|
||||
#define HMB_HOST_INT (1 << 3) /* To Host Mailbox Miscellaneous Interrupt */
|
||||
#define HMB_MASK 0x0000000f /* To Host Mailbox Mask */
|
||||
|
||||
/* tohostmailboxdata */
|
||||
#define HMB_DATA_NAKHANDLED 0x01 /* we're ready to retransmit NAK'd frame to host */
|
||||
#define HMB_DATA_DEVREADY 0x02 /* we're ready to to talk to host after enable */
|
||||
#define HMB_DATA_FC 0x04 /* per prio flowcontrol update flag to host */
|
||||
#define HMB_DATA_FWREADY 0x08 /* firmware is ready for protocol activity */
|
||||
#define HMB_DATA_FWHALT 0x10 /* firmware has halted operation */
|
||||
|
||||
#ifdef DS_PROT
|
||||
/* Bit msgs for custom deep sleep protocol */
|
||||
#define HMB_DATA_DSREQ 0x100 /* firmware requesting deepsleep entry */
|
||||
#define HMB_DATA_DSEXIT 0x200 /* firmware announcing deepsleep exit */
|
||||
#define HMB_DATA_D3ACK 0x400 /* firmware acking a D3 notice from host */
|
||||
#define HMB_DATA_D3EXIT 0x800 /* firmware announcing D3 exit */
|
||||
#define HMB_DATA_DSPROT_MASK 0xf00
|
||||
#endif /* DS_PROT */
|
||||
|
||||
|
||||
#define HMB_DATA_FCDATA_MASK 0xff000000 /* per prio flowcontrol data */
|
||||
#define HMB_DATA_FCDATA_SHIFT 24 /* per prio flowcontrol data */
|
||||
|
||||
#define HMB_DATA_VERSION_MASK 0x00ff0000 /* device protocol version (with devready) */
|
||||
#define HMB_DATA_VERSION_SHIFT 16 /* device protocol version (with devready) */
|
||||
|
||||
/*
|
||||
* Software-defined protocol header
|
||||
*/
|
||||
|
||||
/* Current protocol version */
|
||||
#define SDPCM_PROT_VERSION 4
|
||||
|
||||
/* SW frame header */
|
||||
#define SDPCM_SEQUENCE_MASK 0x000000ff /* Sequence Number Mask */
|
||||
#define SDPCM_PACKET_SEQUENCE(p) (((uint8 *)p)[0] & 0xff) /* p starts w/SW Header */
|
||||
|
||||
#define SDPCM_CHANNEL_MASK 0x00000f00 /* Channel Number Mask */
|
||||
#define SDPCM_CHANNEL_SHIFT 8 /* Channel Number Shift */
|
||||
#define SDPCM_PACKET_CHANNEL(p) (((uint8 *)p)[1] & 0x0f) /* p starts w/SW Header */
|
||||
|
||||
#define SDPCM_FLAGS_MASK 0x0000f000 /* Mask of flag bits */
|
||||
#define SDPCM_FLAGS_SHIFT 12 /* Flag bits shift */
|
||||
#define SDPCM_PACKET_FLAGS(p) ((((uint8 *)p)[1] & 0xf0) >> 4) /* p starts w/SW Header */
|
||||
|
||||
/* Next Read Len: lookahead length of next frame, in 16-byte units (rounded up) */
|
||||
#define SDPCM_NEXTLEN_MASK 0x00ff0000 /* Next Read Len Mask */
|
||||
#define SDPCM_NEXTLEN_SHIFT 16 /* Next Read Len Shift */
|
||||
#define SDPCM_NEXTLEN_VALUE(p) ((((uint8 *)p)[2] & 0xff) << 4) /* p starts w/SW Header */
|
||||
#define SDPCM_NEXTLEN_OFFSET 2
|
||||
|
||||
/* Data Offset from SOF (HW Tag, SW Tag, Pad) */
|
||||
#define SDPCM_DOFFSET_OFFSET 3 /* Data Offset */
|
||||
#define SDPCM_DOFFSET_VALUE(p) (((uint8 *)p)[SDPCM_DOFFSET_OFFSET] & 0xff)
|
||||
#define SDPCM_DOFFSET_MASK 0xff000000
|
||||
#define SDPCM_DOFFSET_SHIFT 24
|
||||
|
||||
#define SDPCM_FCMASK_OFFSET 4 /* Flow control */
|
||||
#define SDPCM_FCMASK_VALUE(p) (((uint8 *)p)[SDPCM_FCMASK_OFFSET ] & 0xff)
|
||||
#define SDPCM_WINDOW_OFFSET 5 /* Credit based fc */
|
||||
#define SDPCM_WINDOW_VALUE(p) (((uint8 *)p)[SDPCM_WINDOW_OFFSET] & 0xff)
|
||||
#define SDPCM_VERSION_OFFSET 6 /* Version # */
|
||||
#define SDPCM_VERSION_VALUE(p) (((uint8 *)p)[SDPCM_VERSION_OFFSET] & 0xff)
|
||||
#define SDPCM_UNUSED_OFFSET 7 /* Spare */
|
||||
#define SDPCM_UNUSED_VALUE(p) (((uint8 *)p)[SDPCM_UNUSED_OFFSET] & 0xff)
|
||||
|
||||
#define SDPCM_SWHEADER_LEN 8 /* SW header is 64 bits */
|
||||
|
||||
/* logical channel numbers */
|
||||
#define SDPCM_CONTROL_CHANNEL 0 /* Control Request/Response Channel Id */
|
||||
#define SDPCM_EVENT_CHANNEL 1 /* Asyc Event Indication Channel Id */
|
||||
#define SDPCM_DATA_CHANNEL 2 /* Data Xmit/Recv Channel Id */
|
||||
#define SDPCM_GLOM_CHANNEL 3 /* For coalesced packets (superframes) */
|
||||
#define SDPCM_TEST_CHANNEL 15 /* Reserved for test/debug packets */
|
||||
#define SDPCM_MAX_CHANNEL 15
|
||||
|
||||
#define SDPCM_SEQUENCE_WRAP 256 /* wrap-around val for eight-bit frame seq number */
|
||||
|
||||
#define SDPCM_FLAG_RESVD0 0x01
|
||||
#define SDPCM_FLAG_RESVD1 0x02
|
||||
#define SDPCM_FLAG_GSPI_TXENAB 0x04
|
||||
#define SDPCM_FLAG_GLOMDESC 0x08 /* Superframe descriptor mask */
|
||||
|
||||
/* For GLOM_CHANNEL frames, use a flag to indicate descriptor frame */
|
||||
#define SDPCM_GLOMDESC_FLAG (SDPCM_FLAG_GLOMDESC << SDPCM_FLAGS_SHIFT)
|
||||
|
||||
#define SDPCM_GLOMDESC(p) (((uint8 *)p)[1] & 0x80)
|
||||
|
||||
/* For TEST_CHANNEL packets, define another 4-byte header */
|
||||
#define SDPCM_TEST_HDRLEN 4 /* Generally: Cmd(1), Ext(1), Len(2);
|
||||
* Semantics of Ext byte depend on command.
|
||||
* Len is current or requested frame length, not
|
||||
* including test header; sent little-endian.
|
||||
*/
|
||||
#define SDPCM_TEST_PKT_CNT_FLD_LEN 4 /* Packet count filed legth */
|
||||
#define SDPCM_TEST_DISCARD 0x01 /* Receiver discards. Ext is a pattern id. */
|
||||
#define SDPCM_TEST_ECHOREQ 0x02 /* Echo request. Ext is a pattern id. */
|
||||
#define SDPCM_TEST_ECHORSP 0x03 /* Echo response. Ext is a pattern id. */
|
||||
#define SDPCM_TEST_BURST 0x04 /* Receiver to send a burst. Ext is a frame count
|
||||
* (Backward compatabilty) Set frame count in a
|
||||
* 4 byte filed adjacent to the HDR
|
||||
*/
|
||||
#define SDPCM_TEST_SEND 0x05 /* Receiver sets send mode. Ext is boolean on/off
|
||||
* Set frame count in a 4 byte filed adjacent to
|
||||
* the HDR
|
||||
*/
|
||||
|
||||
/* Handy macro for filling in datagen packets with a pattern */
|
||||
#define SDPCM_TEST_FILL(byteno, id) ((uint8)(id + byteno))
|
||||
|
||||
/*
|
||||
* Software counters (first part matches hardware counters)
|
||||
*/
|
||||
|
||||
typedef volatile struct {
|
||||
uint32 cmd52rd; /* Cmd52RdCount, SDIO: cmd52 reads */
|
||||
uint32 cmd52wr; /* Cmd52WrCount, SDIO: cmd52 writes */
|
||||
uint32 cmd53rd; /* Cmd53RdCount, SDIO: cmd53 reads */
|
||||
uint32 cmd53wr; /* Cmd53WrCount, SDIO: cmd53 writes */
|
||||
uint32 abort; /* AbortCount, SDIO: aborts */
|
||||
uint32 datacrcerror; /* DataCrcErrorCount, SDIO: frames w/CRC error */
|
||||
uint32 rdoutofsync; /* RdOutOfSyncCount, SDIO/PCMCIA: Rd Frm out of sync */
|
||||
uint32 wroutofsync; /* RdOutOfSyncCount, SDIO/PCMCIA: Wr Frm out of sync */
|
||||
uint32 writebusy; /* WriteBusyCount, SDIO: device asserted "busy" */
|
||||
uint32 readwait; /* ReadWaitCount, SDIO: no data ready for a read cmd */
|
||||
uint32 readterm; /* ReadTermCount, SDIO: read frame termination cmds */
|
||||
uint32 writeterm; /* WriteTermCount, SDIO: write frames termination cmds */
|
||||
uint32 rxdescuflo; /* receive descriptor underflows */
|
||||
uint32 rxfifooflo; /* receive fifo overflows */
|
||||
uint32 txfifouflo; /* transmit fifo underflows */
|
||||
uint32 runt; /* runt (too short) frames recv'd from bus */
|
||||
uint32 badlen; /* frame's rxh len does not match its hw tag len */
|
||||
uint32 badcksum; /* frame's hw tag chksum doesn't agree with len value */
|
||||
uint32 seqbreak; /* break in sequence # space from one rx frame to the next */
|
||||
uint32 rxfcrc; /* frame rx header indicates crc error */
|
||||
uint32 rxfwoos; /* frame rx header indicates write out of sync */
|
||||
uint32 rxfwft; /* frame rx header indicates write frame termination */
|
||||
uint32 rxfabort; /* frame rx header indicates frame aborted */
|
||||
uint32 woosint; /* write out of sync interrupt */
|
||||
uint32 roosint; /* read out of sync interrupt */
|
||||
uint32 rftermint; /* read frame terminate interrupt */
|
||||
uint32 wftermint; /* write frame terminate interrupt */
|
||||
} sdpcmd_cnt_t;
|
||||
|
||||
/*
|
||||
* Register Access Macros
|
||||
*/
|
||||
|
||||
#define SDIODREV_IS(var, val) ((var) == (val))
|
||||
#define SDIODREV_GE(var, val) ((var) >= (val))
|
||||
#define SDIODREV_GT(var, val) ((var) > (val))
|
||||
#define SDIODREV_LT(var, val) ((var) < (val))
|
||||
#define SDIODREV_LE(var, val) ((var) <= (val))
|
||||
|
||||
#define SDIODDMAREG32(h, dir, chnl) \
|
||||
((dir) == DMA_TX ? \
|
||||
(void *)(uintptr)&((h)->regs->dma.sdiod32.dma32regs[chnl].xmt) : \
|
||||
(void *)(uintptr)&((h)->regs->dma.sdiod32.dma32regs[chnl].rcv))
|
||||
|
||||
#define SDIODDMAREG64(h, dir, chnl) \
|
||||
((dir) == DMA_TX ? \
|
||||
(void *)(uintptr)&((h)->regs->dma.sdiod64.dma64regs[chnl].xmt) : \
|
||||
(void *)(uintptr)&((h)->regs->dma.sdiod64.dma64regs[chnl].rcv))
|
||||
|
||||
#define SDIODDMAREG(h, dir, chnl) \
|
||||
(SDIODREV_LT((h)->corerev, 1) ? \
|
||||
SDIODDMAREG32((h), (dir), (chnl)) : \
|
||||
SDIODDMAREG64((h), (dir), (chnl)))
|
||||
|
||||
#define PCMDDMAREG(h, dir, chnl) \
|
||||
((dir) == DMA_TX ? \
|
||||
(void *)(uintptr)&((h)->regs->dma.pcm32.dmaregs.xmt) : \
|
||||
(void *)(uintptr)&((h)->regs->dma.pcm32.dmaregs.rcv))
|
||||
|
||||
#define SDPCMDMAREG(h, dir, chnl, coreid) \
|
||||
((coreid) == SDIOD_CORE_ID ? \
|
||||
SDIODDMAREG(h, dir, chnl) : \
|
||||
PCMDDMAREG(h, dir, chnl))
|
||||
|
||||
#define SDIODFIFOREG(h, corerev) \
|
||||
(SDIODREV_LT((corerev), 1) ? \
|
||||
((dma32diag_t *)(uintptr)&((h)->regs->dma.sdiod32.dmafifo)) : \
|
||||
((dma32diag_t *)(uintptr)&((h)->regs->dma.sdiod64.dmafifo)))
|
||||
|
||||
#define PCMDFIFOREG(h) \
|
||||
((dma32diag_t *)(uintptr)&((h)->regs->dma.pcm32.dmafifo))
|
||||
|
||||
#define SDPCMFIFOREG(h, coreid, corerev) \
|
||||
((coreid) == SDIOD_CORE_ID ? \
|
||||
SDIODFIFOREG(h, corerev) : \
|
||||
PCMDFIFOREG(h))
|
||||
|
||||
/*
|
||||
* Shared structure between dongle and the host.
|
||||
* The structure contains pointers to trap or assert information.
|
||||
*/
|
||||
#define SDPCM_SHARED_VERSION 0x0001
|
||||
#define SDPCM_SHARED_VERSION_MASK 0x00FF
|
||||
#define SDPCM_SHARED_ASSERT_BUILT 0x0100
|
||||
#define SDPCM_SHARED_ASSERT 0x0200
|
||||
#define SDPCM_SHARED_TRAP 0x0400
|
||||
#define SDPCM_SHARED_IN_BRPT 0x0800
|
||||
#define SDPCM_SHARED_SET_BRPT 0x1000
|
||||
#define SDPCM_SHARED_PENDING_BRPT 0x2000
|
||||
#define SDPCM_SHARED_FATAL_LOGBUF_VALID 0x100000
|
||||
|
||||
typedef struct {
|
||||
uint32 flags;
|
||||
uint32 trap_addr;
|
||||
uint32 assert_exp_addr;
|
||||
uint32 assert_file_addr;
|
||||
uint32 assert_line;
|
||||
uint32 console_addr; /* Address of hnd_cons_t */
|
||||
uint32 msgtrace_addr;
|
||||
uint32 fwid;
|
||||
uint32 device_fatal_logbuf_start;
|
||||
} sdpcm_shared_t;
|
||||
|
||||
extern sdpcm_shared_t sdpcm_shared;
|
||||
|
||||
#endif /* _bcmsdpcm_h_ */
|
|
@ -0,0 +1,138 @@
|
|||
/*
|
||||
* SD-SPI Protocol Conversion - BCMSDH->SPI Translation Layer
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: bcmsdspi.h 514727 2014-11-12 03:02:48Z $
|
||||
*/
|
||||
#ifndef _BCM_SD_SPI_H
|
||||
#define _BCM_SD_SPI_H
|
||||
|
||||
/* global msglevel for debug messages - bitvals come from sdiovar.h */
|
||||
|
||||
#define sd_err(x)
|
||||
#define sd_trace(x)
|
||||
#define sd_info(x)
|
||||
#define sd_debug(x)
|
||||
#define sd_data(x)
|
||||
#define sd_ctrl(x)
|
||||
|
||||
#define sd_log(x)
|
||||
|
||||
#define SDIOH_ASSERT(exp) \
|
||||
do { if (!(exp)) \
|
||||
printf("!!!ASSERT fail: file %s lines %d", __FILE__, __LINE__); \
|
||||
} while (0)
|
||||
|
||||
#define BLOCK_SIZE_4318 64
|
||||
#define BLOCK_SIZE_4328 512
|
||||
|
||||
/* internal return code */
|
||||
#define SUCCESS 0
|
||||
#undef ERROR
|
||||
#define ERROR 1
|
||||
|
||||
/* private bus modes */
|
||||
#define SDIOH_MODE_SPI 0
|
||||
|
||||
#define USE_BLOCKMODE 0x2 /* Block mode can be single block or multi */
|
||||
#define USE_MULTIBLOCK 0x4
|
||||
|
||||
struct sdioh_info {
|
||||
uint cfg_bar; /* pci cfg address for bar */
|
||||
uint32 caps; /* cached value of capabilities reg */
|
||||
uint bar0; /* BAR0 for PCI Device */
|
||||
osl_t *osh; /* osh handler */
|
||||
void *controller; /* Pointer to SPI Controller's private data struct */
|
||||
|
||||
uint lockcount; /* nest count of sdspi_lock() calls */
|
||||
bool client_intr_enabled; /* interrupt connnected flag */
|
||||
bool intr_handler_valid; /* client driver interrupt handler valid */
|
||||
sdioh_cb_fn_t intr_handler; /* registered interrupt handler */
|
||||
void *intr_handler_arg; /* argument to call interrupt handler */
|
||||
bool initialized; /* card initialized */
|
||||
uint32 target_dev; /* Target device ID */
|
||||
uint32 intmask; /* Current active interrupts */
|
||||
void *sdos_info; /* Pointer to per-OS private data */
|
||||
|
||||
uint32 controller_type; /* Host controller type */
|
||||
uint8 version; /* Host Controller Spec Compliance Version */
|
||||
uint irq; /* Client irq */
|
||||
uint32 intrcount; /* Client interrupts */
|
||||
uint32 local_intrcount; /* Controller interrupts */
|
||||
bool host_init_done; /* Controller initted */
|
||||
bool card_init_done; /* Client SDIO interface initted */
|
||||
bool polled_mode; /* polling for command completion */
|
||||
|
||||
bool sd_use_dma; /* DMA on CMD53 */
|
||||
bool sd_blockmode; /* sd_blockmode == FALSE => 64 Byte Cmd 53s. */
|
||||
/* Must be on for sd_multiblock to be effective */
|
||||
bool use_client_ints; /* If this is false, make sure to restore */
|
||||
bool got_hcint; /* Host Controller interrupt. */
|
||||
/* polling hack in wl_linux.c:wl_timer() */
|
||||
int adapter_slot; /* Maybe dealing with multiple slots/controllers */
|
||||
int sd_mode; /* SD1/SD4/SPI */
|
||||
int client_block_size[SDIOD_MAX_IOFUNCS]; /* Blocksize */
|
||||
uint32 data_xfer_count; /* Current register transfer size */
|
||||
uint32 cmd53_wr_data; /* Used to pass CMD53 write data */
|
||||
uint32 card_response; /* Used to pass back response status byte */
|
||||
uint32 card_rsp_data; /* Used to pass back response data word */
|
||||
uint16 card_rca; /* Current Address */
|
||||
uint8 num_funcs; /* Supported funcs on client */
|
||||
uint32 com_cis_ptr;
|
||||
uint32 func_cis_ptr[SDIOD_MAX_IOFUNCS];
|
||||
void *dma_buf;
|
||||
ulong dma_phys;
|
||||
int r_cnt; /* rx count */
|
||||
int t_cnt; /* tx_count */
|
||||
};
|
||||
|
||||
/************************************************************
|
||||
* Internal interfaces: per-port references into bcmsdspi.c
|
||||
*/
|
||||
|
||||
/* Global message bits */
|
||||
extern uint sd_msglevel;
|
||||
|
||||
/**************************************************************
|
||||
* Internal interfaces: bcmsdspi.c references to per-port code
|
||||
*/
|
||||
|
||||
/* Register mapping routines */
|
||||
extern uint32 *spi_reg_map(osl_t *osh, uintptr addr, int size);
|
||||
extern void spi_reg_unmap(osl_t *osh, uintptr addr, int size);
|
||||
|
||||
/* Interrupt (de)registration routines */
|
||||
extern int spi_register_irq(sdioh_info_t *sd, uint irq);
|
||||
extern void spi_free_irq(uint irq, sdioh_info_t *sd);
|
||||
|
||||
/* OS-specific interrupt wrappers (atomic interrupt enable/disable) */
|
||||
extern void spi_lock(sdioh_info_t *sd);
|
||||
extern void spi_unlock(sdioh_info_t *sd);
|
||||
|
||||
/* Allocate/init/free per-OS private data */
|
||||
extern int spi_osinit(sdioh_info_t *sd);
|
||||
extern void spi_osfree(sdioh_info_t *sd);
|
||||
|
||||
#endif /* _BCM_SD_SPI_H */
|
|
@ -0,0 +1,285 @@
|
|||
/*
|
||||
* 'Standard' SDIO HOST CONTROLLER driver
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: bcmsdstd.h 514727 2014-11-12 03:02:48Z $
|
||||
*/
|
||||
#ifndef _BCM_SD_STD_H
|
||||
#define _BCM_SD_STD_H
|
||||
|
||||
/* global msglevel for debug messages - bitvals come from sdiovar.h */
|
||||
#define sd_err(x) do { if (sd_msglevel & SDH_ERROR_VAL) printf x; } while (0)
|
||||
#define sd_trace(x)
|
||||
#define sd_info(x)
|
||||
#define sd_debug(x)
|
||||
#define sd_data(x)
|
||||
#define sd_ctrl(x)
|
||||
#define sd_dma(x)
|
||||
|
||||
#define sd_sync_dma(sd, read, nbytes)
|
||||
#define sd_init_dma(sd)
|
||||
#define sd_ack_intr(sd)
|
||||
#define sd_wakeup(sd);
|
||||
/* Allocate/init/free per-OS private data */
|
||||
extern int sdstd_osinit(sdioh_info_t *sd);
|
||||
extern void sdstd_osfree(sdioh_info_t *sd);
|
||||
|
||||
#define sd_log(x)
|
||||
|
||||
#define SDIOH_ASSERT(exp) \
|
||||
do { if (!(exp)) \
|
||||
printf("!!!ASSERT fail: file %s lines %d", __FILE__, __LINE__); \
|
||||
} while (0)
|
||||
|
||||
#define BLOCK_SIZE_4318 64
|
||||
#define BLOCK_SIZE_4328 512
|
||||
|
||||
/* internal return code */
|
||||
#define SUCCESS 0
|
||||
#define ERROR 1
|
||||
|
||||
/* private bus modes */
|
||||
#define SDIOH_MODE_SPI 0
|
||||
#define SDIOH_MODE_SD1 1
|
||||
#define SDIOH_MODE_SD4 2
|
||||
|
||||
#define MAX_SLOTS 6 /* For PCI: Only 6 BAR entries => 6 slots */
|
||||
#define SDIOH_REG_WINSZ 0x100 /* Number of registers in Standard Host Controller */
|
||||
|
||||
#define SDIOH_TYPE_ARASAN_HDK 1
|
||||
#define SDIOH_TYPE_BCM27XX 2
|
||||
#define SDIOH_TYPE_TI_PCIXX21 4 /* TI PCIxx21 Standard Host Controller */
|
||||
#define SDIOH_TYPE_RICOH_R5C822 5 /* Ricoh Co Ltd R5C822 SD/SDIO/MMC/MS/MSPro Host Adapter */
|
||||
#define SDIOH_TYPE_JMICRON 6 /* JMicron Standard SDIO Host Controller */
|
||||
|
||||
/* For linux, allow yielding for dongle */
|
||||
#define BCMSDYIELD
|
||||
|
||||
/* Expected card status value for CMD7 */
|
||||
#define SDIOH_CMD7_EXP_STATUS 0x00001E00
|
||||
|
||||
#define RETRIES_LARGE 100000
|
||||
#define sdstd_os_yield(sd) do {} while (0)
|
||||
#define RETRIES_SMALL 100
|
||||
|
||||
|
||||
#define USE_BLOCKMODE 0x2 /* Block mode can be single block or multi */
|
||||
#define USE_MULTIBLOCK 0x4
|
||||
|
||||
#define USE_FIFO 0x8 /* Fifo vs non-fifo */
|
||||
|
||||
#define CLIENT_INTR 0x100 /* Get rid of this! */
|
||||
|
||||
#define HC_INTR_RETUNING 0x1000
|
||||
|
||||
|
||||
#ifdef BCMSDIOH_TXGLOM
|
||||
/* Total glom pkt can not exceed 64K
|
||||
* need one more slot for glom padding packet
|
||||
*/
|
||||
#define SDIOH_MAXGLOM_SIZE (40+1)
|
||||
|
||||
typedef struct glom_buf {
|
||||
uint32 count; /* Total number of pkts queued */
|
||||
void *dma_buf_arr[SDIOH_MAXGLOM_SIZE]; /* Frame address */
|
||||
ulong dma_phys_arr[SDIOH_MAXGLOM_SIZE]; /* DMA_MAPed address of frames */
|
||||
uint16 nbytes[SDIOH_MAXGLOM_SIZE]; /* Size of each frame */
|
||||
} glom_buf_t;
|
||||
#endif
|
||||
|
||||
struct sdioh_info {
|
||||
uint cfg_bar; /* pci cfg address for bar */
|
||||
uint32 caps; /* cached value of capabilities reg */
|
||||
uint32 curr_caps; /* max current capabilities reg */
|
||||
|
||||
osl_t *osh; /* osh handler */
|
||||
volatile char *mem_space; /* pci device memory va */
|
||||
uint lockcount; /* nest count of sdstd_lock() calls */
|
||||
bool client_intr_enabled; /* interrupt connnected flag */
|
||||
bool intr_handler_valid; /* client driver interrupt handler valid */
|
||||
sdioh_cb_fn_t intr_handler; /* registered interrupt handler */
|
||||
void *intr_handler_arg; /* argument to call interrupt handler */
|
||||
bool initialized; /* card initialized */
|
||||
uint target_dev; /* Target device ID */
|
||||
uint16 intmask; /* Current active interrupts */
|
||||
void *sdos_info; /* Pointer to per-OS private data */
|
||||
void *bcmsdh; /* handler to upper layer stack (bcmsdh) */
|
||||
|
||||
uint32 controller_type; /* Host controller type */
|
||||
uint8 version; /* Host Controller Spec Compliance Version */
|
||||
uint irq; /* Client irq */
|
||||
int intrcount; /* Client interrupts */
|
||||
int local_intrcount; /* Controller interrupts */
|
||||
bool host_init_done; /* Controller initted */
|
||||
bool card_init_done; /* Client SDIO interface initted */
|
||||
bool polled_mode; /* polling for command completion */
|
||||
|
||||
bool sd_blockmode; /* sd_blockmode == FALSE => 64 Byte Cmd 53s. */
|
||||
/* Must be on for sd_multiblock to be effective */
|
||||
bool use_client_ints; /* If this is false, make sure to restore */
|
||||
/* polling hack in wl_linux.c:wl_timer() */
|
||||
int adapter_slot; /* Maybe dealing with multiple slots/controllers */
|
||||
int sd_mode; /* SD1/SD4/SPI */
|
||||
int client_block_size[SDIOD_MAX_IOFUNCS]; /* Blocksize */
|
||||
uint32 data_xfer_count; /* Current transfer */
|
||||
uint16 card_rca; /* Current Address */
|
||||
int8 sd_dma_mode; /* DMA Mode (PIO, SDMA, ... ADMA2) on CMD53 */
|
||||
uint8 num_funcs; /* Supported funcs on client */
|
||||
uint32 com_cis_ptr;
|
||||
uint32 func_cis_ptr[SDIOD_MAX_IOFUNCS];
|
||||
void *dma_buf; /* DMA Buffer virtual address */
|
||||
ulong dma_phys; /* DMA Buffer physical address */
|
||||
void *adma2_dscr_buf; /* ADMA2 Descriptor Buffer virtual address */
|
||||
ulong adma2_dscr_phys; /* ADMA2 Descriptor Buffer physical address */
|
||||
|
||||
/* adjustments needed to make the dma align properly */
|
||||
void *dma_start_buf;
|
||||
ulong dma_start_phys;
|
||||
uint alloced_dma_size;
|
||||
void *adma2_dscr_start_buf;
|
||||
ulong adma2_dscr_start_phys;
|
||||
uint alloced_adma2_dscr_size;
|
||||
|
||||
int r_cnt; /* rx count */
|
||||
int t_cnt; /* tx_count */
|
||||
bool got_hcint; /* local interrupt flag */
|
||||
uint16 last_intrstatus; /* to cache intrstatus */
|
||||
int host_UHSISupported; /* whether UHSI is supported for HC. */
|
||||
int card_UHSI_voltage_Supported; /* whether UHSI is supported for
|
||||
* Card in terms of Voltage [1.8 or 3.3].
|
||||
*/
|
||||
int global_UHSI_Supp; /* type of UHSI support in both host and card.
|
||||
* HOST_SDR_UNSUPP: capabilities not supported/matched
|
||||
* HOST_SDR_12_25: SDR12 and SDR25 supported
|
||||
* HOST_SDR_50_104_DDR: one of SDR50/SDR104 or DDR50 supptd
|
||||
*/
|
||||
volatile int sd3_dat_state; /* data transfer state used for retuning check */
|
||||
volatile int sd3_tun_state; /* tuning state used for retuning check */
|
||||
bool sd3_tuning_reqd; /* tuning requirement parameter */
|
||||
uint32 caps3; /* cached value of 32 MSbits capabilities reg (SDIO 3.0) */
|
||||
#ifdef BCMSDIOH_TXGLOM
|
||||
glom_buf_t glom_info; /* pkt information used for glomming */
|
||||
uint txglom_mode; /* Txglom mode: 0 - copy, 1 - multi-descriptor */
|
||||
#endif
|
||||
};
|
||||
|
||||
#define DMA_MODE_NONE 0
|
||||
#define DMA_MODE_SDMA 1
|
||||
#define DMA_MODE_ADMA1 2
|
||||
#define DMA_MODE_ADMA2 3
|
||||
#define DMA_MODE_ADMA2_64 4
|
||||
#define DMA_MODE_AUTO -1
|
||||
|
||||
#define USE_DMA(sd) ((bool)((sd->sd_dma_mode > 0) ? TRUE : FALSE))
|
||||
|
||||
/* States for Tuning and corr data */
|
||||
#define TUNING_IDLE 0
|
||||
#define TUNING_START 1
|
||||
#define TUNING_START_AFTER_DAT 2
|
||||
#define TUNING_ONGOING 3
|
||||
|
||||
#define DATA_TRANSFER_IDLE 0
|
||||
#define DATA_TRANSFER_ONGOING 1
|
||||
|
||||
#define CHECK_TUNING_PRE_DATA 1
|
||||
#define CHECK_TUNING_POST_DATA 2
|
||||
|
||||
|
||||
#ifdef DHD_DEBUG
|
||||
#define SD_DHD_DISABLE_PERIODIC_TUNING 0x01
|
||||
#define SD_DHD_ENABLE_PERIODIC_TUNING 0x00
|
||||
#endif
|
||||
|
||||
|
||||
/************************************************************
|
||||
* Internal interfaces: per-port references into bcmsdstd.c
|
||||
*/
|
||||
|
||||
/* Global message bits */
|
||||
extern uint sd_msglevel;
|
||||
|
||||
/* OS-independent interrupt handler */
|
||||
extern bool check_client_intr(sdioh_info_t *sd);
|
||||
|
||||
/* Core interrupt enable/disable of device interrupts */
|
||||
extern void sdstd_devintr_on(sdioh_info_t *sd);
|
||||
extern void sdstd_devintr_off(sdioh_info_t *sd);
|
||||
|
||||
/* Enable/disable interrupts for local controller events */
|
||||
extern void sdstd_intrs_on(sdioh_info_t *sd, uint16 norm, uint16 err);
|
||||
extern void sdstd_intrs_off(sdioh_info_t *sd, uint16 norm, uint16 err);
|
||||
|
||||
/* Wait for specified interrupt and error bits to be set */
|
||||
extern void sdstd_spinbits(sdioh_info_t *sd, uint16 norm, uint16 err);
|
||||
|
||||
|
||||
/**************************************************************
|
||||
* Internal interfaces: bcmsdstd.c references to per-port code
|
||||
*/
|
||||
|
||||
/* Register mapping routines */
|
||||
extern uint32 *sdstd_reg_map(osl_t *osh, ulong addr, int size);
|
||||
extern void sdstd_reg_unmap(osl_t *osh, ulong addr, int size);
|
||||
|
||||
/* Interrupt (de)registration routines */
|
||||
extern int sdstd_register_irq(sdioh_info_t *sd, uint irq);
|
||||
extern void sdstd_free_irq(uint irq, sdioh_info_t *sd);
|
||||
|
||||
/* OS-specific interrupt wrappers (atomic interrupt enable/disable) */
|
||||
extern void sdstd_lock(sdioh_info_t *sd);
|
||||
extern void sdstd_unlock(sdioh_info_t *sd);
|
||||
extern void sdstd_waitlockfree(sdioh_info_t *sd);
|
||||
|
||||
/* OS-specific wrappers for safe concurrent register access */
|
||||
extern void sdstd_os_lock_irqsave(sdioh_info_t *sd, ulong* flags);
|
||||
extern void sdstd_os_unlock_irqrestore(sdioh_info_t *sd, ulong* flags);
|
||||
|
||||
/* OS-specific wait-for-interrupt-or-status */
|
||||
extern int sdstd_waitbits(sdioh_info_t *sd, uint16 norm, uint16 err, bool yield, uint16 *bits);
|
||||
|
||||
/* used by bcmsdstd_linux [implemented in sdstd] */
|
||||
extern void sdstd_3_enable_retuning_int(sdioh_info_t *sd);
|
||||
extern void sdstd_3_disable_retuning_int(sdioh_info_t *sd);
|
||||
extern bool sdstd_3_is_retuning_int_set(sdioh_info_t *sd);
|
||||
extern void sdstd_3_check_and_do_tuning(sdioh_info_t *sd, int tuning_param);
|
||||
extern bool sdstd_3_check_and_set_retuning(sdioh_info_t *sd);
|
||||
extern int sdstd_3_get_tune_state(sdioh_info_t *sd);
|
||||
extern int sdstd_3_get_data_state(sdioh_info_t *sd);
|
||||
extern void sdstd_3_set_tune_state(sdioh_info_t *sd, int state);
|
||||
extern void sdstd_3_set_data_state(sdioh_info_t *sd, int state);
|
||||
extern uint8 sdstd_3_get_tuning_exp(sdioh_info_t *sd);
|
||||
extern uint32 sdstd_3_get_uhsi_clkmode(sdioh_info_t *sd);
|
||||
extern int sdstd_3_clk_tuning(sdioh_info_t *sd, uint32 sd3ClkMode);
|
||||
|
||||
/* used by sdstd [implemented in bcmsdstd_linux/ndis] */
|
||||
extern void sdstd_3_start_tuning(sdioh_info_t *sd);
|
||||
extern void sdstd_3_osinit_tuning(sdioh_info_t *sd);
|
||||
extern void sdstd_3_osclean_tuning(sdioh_info_t *sd);
|
||||
|
||||
extern void sdstd_enable_disable_periodic_timer(sdioh_info_t * sd, uint val);
|
||||
|
||||
extern sdioh_info_t *sdioh_attach(osl_t *osh, void *bar0, uint irq);
|
||||
extern SDIOH_API_RC sdioh_detach(osl_t *osh, sdioh_info_t *sd);
|
||||
#endif /* _BCM_SD_STD_H */
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Broadcom SPI Low-Level Hardware Driver API
|
||||
*
|
||||
* Copyright (C) 1999-2017, Broadcom Corporation
|
||||
*
|
||||
* Unless you and Broadcom execute a separate written software license
|
||||
* agreement governing use of this software, this software is licensed to you
|
||||
* under the terms of the GNU General Public License version 2 (the "GPL"),
|
||||
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
|
||||
* following added to such license:
|
||||
*
|
||||
* As a special exception, the copyright holders of this software give you
|
||||
* permission to link this software with independent modules, and to copy and
|
||||
* distribute the resulting executable under terms of your choice, provided that
|
||||
* you also meet, for each linked independent module, the terms and conditions of
|
||||
* the license of that module. An independent module is a module which is not
|
||||
* derived from this software. The special exception does not apply to any
|
||||
* modifications of the software.
|
||||
*
|
||||
* Notwithstanding the above, under no circumstances may you combine this
|
||||
* software in any way with any other Broadcom software provided under a license
|
||||
* other than the GPL, without Broadcom's express prior written consent.
|
||||
*
|
||||
*
|
||||
* <<Broadcom-WL-IPTag/Open:>>
|
||||
*
|
||||
* $Id: bcmspi.h 514727 2014-11-12 03:02:48Z $
|
||||
*/
|
||||
#ifndef _BCM_SPI_H
|
||||
#define _BCM_SPI_H
|
||||
|
||||
extern void spi_devintr_off(sdioh_info_t *sd);
|
||||
extern void spi_devintr_on(sdioh_info_t *sd);
|
||||
extern bool spi_start_clock(sdioh_info_t *sd, uint16 new_sd_divisor);
|
||||
extern bool spi_controller_highspeed_mode(sdioh_info_t *sd, bool hsmode);
|
||||
extern bool spi_check_client_intr(sdioh_info_t *sd, int *is_dev_intr);
|
||||
extern bool spi_hw_attach(sdioh_info_t *sd);
|
||||
extern bool spi_hw_detach(sdioh_info_t *sd);
|
||||
extern void spi_sendrecv(sdioh_info_t *sd, uint8 *msg_out, uint8 *msg_in, int msglen);
|
||||
extern void spi_spinbits(sdioh_info_t *sd);
|
||||
extern void spi_waitbits(sdioh_info_t *sd, bool yield);
|
||||
|
||||
#endif /* _BCM_SPI_H */
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue