| OLD | NEW |
| 1 /* | 1 //------------------------------------------------------------------------------ |
| 2 * | 2 // Copyright (c) 2004-2010 Atheros Communications Inc. |
| 3 * Copyright (c) 2004-2010 Atheros Communications Inc. | 3 // All rights reserved. |
| 4 * All rights reserved. | |
| 5 * | |
| 6 * | |
| 7 // This program is free software; you can redistribute it and/or modify | |
| 8 // it under the terms of the GNU General Public License version 2 as | |
| 9 // published by the Free Software Foundation; | |
| 10 // | 4 // |
| 11 // Software distributed under the License is distributed on an "AS | 5 // |
| 12 // IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or | 6 // |
| 13 // implied. See the License for the specific language governing | 7 // Permission to use, copy, modify, and/or distribute this software for any |
| 14 // rights and limitations under the License. | 8 // purpose with or without fee is hereby granted, provided that the above |
| 9 // copyright notice and this permission notice appear in all copies. |
| 10 // |
| 11 // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 12 // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
| 13 // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
| 14 // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 15 // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
| 16 // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 17 // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 15 // | 18 // |
| 16 // | 19 // |
| 17 * | 20 // |
| 18 */ | 21 // Author(s): ="Atheros" |
| 22 //------------------------------------------------------------------------------ |
| 19 | 23 |
| 20 #include "ar6000_drv.h" | 24 #include "ar6000_drv.h" |
| 21 #include "ieee80211_ioctl.h" | 25 #include "ieee80211_ioctl.h" |
| 22 #include "ar6kap_common.h" | 26 #include "ar6kap_common.h" |
| 23 #include "targaddrs.h" | 27 #include "targaddrs.h" |
| 24 #include "a_hci.h" | 28 #include "a_hci.h" |
| 25 #include "wlan_config.h" | 29 #include "wlan_config.h" |
| 26 | 30 |
| 27 extern int enablerssicompensation; | 31 extern int enablerssicompensation; |
| 28 A_UINT32 tcmdRxFreq; | 32 A_UINT32 tcmdRxFreq; |
| (...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 820 | 824 |
| 821 up(&ar->arSem); | 825 up(&ar->arSem); |
| 822 | 826 |
| 823 return ret; | 827 return ret; |
| 824 } | 828 } |
| 825 | 829 |
| 826 static int | 830 static int |
| 827 ar6000_ioctl_get_ap_stats(struct net_device *dev, struct ifreq *rq) | 831 ar6000_ioctl_get_ap_stats(struct net_device *dev, struct ifreq *rq) |
| 828 { | 832 { |
| 829 AR_SOFTC_T *ar = (AR_SOFTC_T *)ar6k_priv(dev); | 833 AR_SOFTC_T *ar = (AR_SOFTC_T *)ar6k_priv(dev); |
| 830 WMI_AP_MODE_STAT cmd; | 834 A_UINT32 action; /* Allocating only the desired space on the frame. Declarin
g is as a WMI_AP_MODE_STAT variable results in exceeding the compiler imposed li
mit on the maximum frame size */ |
| 831 WMI_AP_MODE_STAT *pStats = &ar->arAPStats; | 835 WMI_AP_MODE_STAT *pStats = &ar->arAPStats; |
| 832 int ret = 0; | 836 int ret = 0; |
| 833 | 837 |
| 834 if (ar->arWmiReady == FALSE) { | 838 if (ar->arWmiReady == FALSE) { |
| 835 return -EIO; | 839 return -EIO; |
| 836 } | 840 } |
| 837 if (copy_from_user(&cmd, (char *)((unsigned int*)rq->ifr_data + 1), | 841 if (copy_from_user(&action, (char *)((unsigned int*)rq->ifr_data + 1), |
| 838 sizeof(cmd))) | 842 sizeof(A_UINT32))) |
| 839 { | 843 { |
| 840 return -EFAULT; | 844 return -EFAULT; |
| 841 } | 845 } |
| 842 if (cmd.action == AP_CLEAR_STATS) { | 846 if (action == AP_CLEAR_STATS) { |
| 843 A_UINT8 i; | 847 A_UINT8 i; |
| 844 AR6000_SPIN_LOCK(&ar->arLock, 0); | 848 AR6000_SPIN_LOCK(&ar->arLock, 0); |
| 845 for(i = 0; i < AP_MAX_NUM_STA; i++) { | 849 for(i = 0; i < AP_MAX_NUM_STA; i++) { |
| 846 pStats->sta[i].tx_bytes = 0; | 850 pStats->sta[i].tx_bytes = 0; |
| 847 pStats->sta[i].tx_pkts = 0; | 851 pStats->sta[i].tx_pkts = 0; |
| 848 pStats->sta[i].tx_error = 0; | 852 pStats->sta[i].tx_error = 0; |
| 849 pStats->sta[i].tx_discard = 0; | 853 pStats->sta[i].tx_discard = 0; |
| 850 pStats->sta[i].rx_bytes = 0; | 854 pStats->sta[i].rx_bytes = 0; |
| 851 pStats->sta[i].rx_pkts = 0; | 855 pStats->sta[i].rx_pkts = 0; |
| 852 pStats->sta[i].rx_error = 0; | 856 pStats->sta[i].rx_error = 0; |
| (...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1786 break; | 1790 break; |
| 1787 } | 1791 } |
| 1788 #ifdef USER_KEYS | 1792 #ifdef USER_KEYS |
| 1789 ar->user_saved_keys.keyType = keyType; | 1793 ar->user_saved_keys.keyType = keyType; |
| 1790 #endif | 1794 #endif |
| 1791 if (IEEE80211_CIPHER_CCKM_KRK != ik->ik_type) { | 1795 if (IEEE80211_CIPHER_CCKM_KRK != ik->ik_type) { |
| 1792 if (NONE_CRYPT == keyType) { | 1796 if (NONE_CRYPT == keyType) { |
| 1793 return -EIO; | 1797 return -EIO; |
| 1794 } | 1798 } |
| 1795 | 1799 |
| 1796 if (WEP_CRYPT == keyType) { | 1800 if ((WEP_CRYPT == keyType)&&(!ar->arConnected)) { |
| 1797 int index = ik->ik_keyix; | 1801 int index = ik->ik_keyix; |
| 1798 | 1802 |
| 1799 if (!IEEE80211_IS_VALID_WEP_CIPHER_LEN(ik->ik_keylen)) { | 1803 if (!IEEE80211_IS_VALID_WEP_CIPHER_LEN(ik->ik_keylen)) { |
| 1800 return -EIO; | 1804 return -EIO; |
| 1801 } | 1805 } |
| 1802 | 1806 |
| 1803 A_MEMZERO(ar->arWepKeyList[index].arKey, | 1807 A_MEMZERO(ar->arWepKeyList[index].arKey, |
| 1804 sizeof(ar->arWepKeyList[index].arKey)); | 1808 sizeof(ar->arWepKeyList[index].arKey)); |
| 1805 A_MEMCPY(ar->arWepKeyList[index].arKey, ik->ik_keydata, ik->ik_keyle
n); | 1809 A_MEMCPY(ar->arWepKeyList[index].arKey, ik->ik_keydata, ik->ik_keyle
n); |
| 1806 ar->arWepKeyList[index].arKeyLen = ik->ik_keylen; | 1810 ar->arWepKeyList[index].arKeyLen = ik->ik_keylen; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1863 dev_hold(dev); | 1867 dev_hold(dev); |
| 1864 rtnl_unlock(); | 1868 rtnl_unlock(); |
| 1865 | 1869 |
| 1866 if (cmd == AR6000_IOCTL_EXTENDED) { | 1870 if (cmd == AR6000_IOCTL_EXTENDED) { |
| 1867 /* | 1871 /* |
| 1868 * This allows for many more wireless ioctls than would otherwise | 1872 * This allows for many more wireless ioctls than would otherwise |
| 1869 * be available. Applications embed the actual ioctl command in | 1873 * be available. Applications embed the actual ioctl command in |
| 1870 * the first word of the parameter block, and use the command | 1874 * the first word of the parameter block, and use the command |
| 1871 * AR6000_IOCTL_EXTENDED_CMD on the ioctl call. | 1875 * AR6000_IOCTL_EXTENDED_CMD on the ioctl call. |
| 1872 */ | 1876 */ |
| 1873 get_user(cmd, (int *)rq->ifr_data); | 1877 » if (get_user(cmd, (int *)rq->ifr_data)) { |
| 1878 » ret = -EFAULT; |
| 1879 » goto ioctl_done; |
| 1880 » } |
| 1874 userdata = (char *)(((unsigned int *)rq->ifr_data)+1); | 1881 userdata = (char *)(((unsigned int *)rq->ifr_data)+1); |
| 1875 if(is_xioctl_allowed(ar->arNextMode, cmd) != A_OK) { | 1882 if(is_xioctl_allowed(ar->arNextMode, cmd) != A_OK) { |
| 1876 A_PRINTF("xioctl: cmd=%d not allowed in this mode\n",cmd); | 1883 A_PRINTF("xioctl: cmd=%d not allowed in this mode\n",cmd); |
| 1877 ret = -EOPNOTSUPP; | 1884 ret = -EOPNOTSUPP; |
| 1878 goto ioctl_done; | 1885 goto ioctl_done; |
| 1879 } | 1886 } |
| 1880 } else { | 1887 } else { |
| 1881 A_STATUS ret = is_iwioctl_allowed(ar->arNextMode, cmd); | 1888 A_STATUS ret = is_iwioctl_allowed(ar->arNextMode, cmd); |
| 1882 if(ret == A_ENOTSUP) { | 1889 if(ret == A_ENOTSUP) { |
| 1883 A_PRINTF("iwioctl: cmd=0x%x not allowed in this mode\n", cmd); | 1890 A_PRINTF("iwioctl: cmd=0x%x not allowed in this mode\n", cmd); |
| 1884 ret = -EOPNOTSUPP; | 1891 ret = -EOPNOTSUPP; |
| 1885 goto ioctl_done; | 1892 goto ioctl_done; |
| 1886 } else if (ret == A_ERROR) { | 1893 } else if (ret == A_ERROR) { |
| 1887 /* It is not our ioctl (out of range ioctl) */ | 1894 /* It is not our ioctl (out of range ioctl) */ |
| 1888 ret = -EOPNOTSUPP; | 1895 ret = -EOPNOTSUPP; |
| 1889 goto ioctl_done; | 1896 goto ioctl_done; |
| 1890 } | 1897 } |
| 1891 userdata = (char *)rq->ifr_data; | 1898 userdata = (char *)rq->ifr_data; |
| 1892 } | 1899 } |
| 1893 | 1900 |
| 1894 if ((ar->arWlanState == WLAN_DISABLED) && | 1901 if ((ar->arWlanState == WLAN_DISABLED) && |
| 1895 ((cmd != AR6000_XIOCTRL_WMI_SET_WLAN_STATE) && | 1902 ((cmd != AR6000_XIOCTRL_WMI_SET_WLAN_STATE) && |
| 1896 (cmd != AR6000_XIOCTL_GET_WLAN_SLEEP_STATE) && | 1903 (cmd != AR6000_XIOCTL_GET_WLAN_SLEEP_STATE) && |
| 1897 (cmd != AR6000_XIOCTL_DIAG_READ) && | 1904 (cmd != AR6000_XIOCTL_DIAG_READ) && |
| 1898 (cmd != AR6000_XIOCTL_DIAG_WRITE) && | 1905 (cmd != AR6000_XIOCTL_DIAG_WRITE) && |
| 1906 (cmd != AR6000_XIOCTL_SET_BT_HW_POWER_STATE) && |
| 1907 (cmd != AR6000_XIOCTL_GET_BT_HW_POWER_STATE) && |
| 1908 (cmd != AR6000_XIOCTL_ADD_AP_INTERFACE) && |
| 1909 (cmd != AR6000_XIOCTL_REMOVE_AP_INTERFACE) && |
| 1899 (cmd != AR6000_IOCTL_WMI_GETREV))) | 1910 (cmd != AR6000_IOCTL_WMI_GETREV))) |
| 1900 { | 1911 { |
| 1901 ret = -EIO; | 1912 ret = -EIO; |
| 1902 goto ioctl_done; | 1913 goto ioctl_done; |
| 1903 } | 1914 } |
| 1904 | 1915 |
| 1905 ret = 0; | 1916 ret = 0; |
| 1906 switch(cmd) | 1917 switch(cmd) |
| 1907 { | 1918 { |
| 1908 case IEEE80211_IOCTL_SETPARAM: | 1919 case IEEE80211_IOCTL_SETPARAM: |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1998 goto ioctl_done; | 2009 goto ioctl_done; |
| 1999 } | 2010 } |
| 2000 } | 2011 } |
| 2001 break; | 2012 break; |
| 2002 } | 2013 } |
| 2003 #ifdef CONFIG_HOST_TCMD_SUPPORT | 2014 #ifdef CONFIG_HOST_TCMD_SUPPORT |
| 2004 case AR6000_XIOCTL_TCMD_CONT_TX: | 2015 case AR6000_XIOCTL_TCMD_CONT_TX: |
| 2005 { | 2016 { |
| 2006 TCMD_CONT_TX txCmd; | 2017 TCMD_CONT_TX txCmd; |
| 2007 | 2018 |
| 2008 if (ar->tcmdPm == TCMD_PM_SLEEP) { | 2019 if ((ar->tcmdPm == TCMD_PM_SLEEP) || |
| 2020 (ar->tcmdPm == TCMD_PM_DEEPSLEEP)) |
| 2021 { |
| 2009 A_PRINTF("Can NOT send tx tcmd when target is asleep! \n"); | 2022 A_PRINTF("Can NOT send tx tcmd when target is asleep! \n"); |
| 2010 ret = -EFAULT; | 2023 ret = -EFAULT; |
| 2011 goto ioctl_done; | 2024 goto ioctl_done; |
| 2012 } | 2025 } |
| 2013 | 2026 |
| 2014 if(copy_from_user(&txCmd, userdata, sizeof(TCMD_CONT_TX))) { | 2027 if(copy_from_user(&txCmd, userdata, sizeof(TCMD_CONT_TX))) { |
| 2015 ret = -EFAULT; | 2028 ret = -EFAULT; |
| 2016 goto ioctl_done; | 2029 goto ioctl_done; |
| 2017 } else { | 2030 } else { |
| 2018 wmi_test_cmd(ar->arWmi,(A_UINT8 *)&txCmd, sizeof(TCMD_CONT_T
X)); | 2031 wmi_test_cmd(ar->arWmi,(A_UINT8 *)&txCmd, sizeof(TCMD_CONT_T
X)); |
| 2019 } | 2032 } |
| 2020 } | 2033 } |
| 2021 break; | 2034 break; |
| 2022 case AR6000_XIOCTL_TCMD_CONT_RX: | 2035 case AR6000_XIOCTL_TCMD_CONT_RX: |
| 2023 { | 2036 { |
| 2024 TCMD_CONT_RX rxCmd; | 2037 TCMD_CONT_RX rxCmd; |
| 2025 | 2038 |
| 2026 if (ar->tcmdPm == TCMD_PM_SLEEP) { | 2039 if ((ar->tcmdPm == TCMD_PM_SLEEP) || |
| 2040 (ar->tcmdPm == TCMD_PM_DEEPSLEEP)) |
| 2041 { |
| 2027 A_PRINTF("Can NOT send rx tcmd when target is asleep! \n"); | 2042 A_PRINTF("Can NOT send rx tcmd when target is asleep! \n"); |
| 2028 ret = -EFAULT; | 2043 ret = -EFAULT; |
| 2029 goto ioctl_done; | 2044 goto ioctl_done; |
| 2030 } | 2045 } |
| 2031 if(copy_from_user(&rxCmd, userdata, sizeof(TCMD_CONT_RX))) { | 2046 if(copy_from_user(&rxCmd, userdata, sizeof(TCMD_CONT_RX))) { |
| 2032 ret = -EFAULT; | 2047 ret = -EFAULT; |
| 2033 goto ioctl_done; | 2048 goto ioctl_done; |
| 2034 } | 2049 } |
| 2035 | 2050 |
| 2036 switch(rxCmd.act) | 2051 switch(rxCmd.act) |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2075 ret = ar6000_init(dev); | 2090 ret = ar6000_init(dev); |
| 2076 rtnl_unlock(); | 2091 rtnl_unlock(); |
| 2077 } | 2092 } |
| 2078 else | 2093 else |
| 2079 { | 2094 { |
| 2080 ret = BMIDone(hifDevice); | 2095 ret = BMIDone(hifDevice); |
| 2081 } | 2096 } |
| 2082 break; | 2097 break; |
| 2083 | 2098 |
| 2084 case AR6000_XIOCTL_BMI_READ_MEMORY: | 2099 case AR6000_XIOCTL_BMI_READ_MEMORY: |
| 2085 get_user(address, (unsigned int *)userdata); | 2100 » if (get_user(address, (unsigned int *)userdata) || |
| 2086 get_user(length, (unsigned int *)userdata + 1); | 2101 » » get_user(length, (unsigned int *)userdata + 1)) { |
| 2102 » » ret = -EFAULT; |
| 2103 » » break; |
| 2104 » } |
| 2105 |
| 2087 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Read Memory (address: 0x%x, length:
%d)\n", | 2106 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Read Memory (address: 0x%x, length:
%d)\n", |
| 2088 address, length)); | 2107 address, length)); |
| 2089 if ((buffer = (unsigned char *)A_MALLOC(length)) != NULL) { | 2108 if ((buffer = (unsigned char *)A_MALLOC(length)) != NULL) { |
| 2090 A_MEMZERO(buffer, length); | 2109 A_MEMZERO(buffer, length); |
| 2091 ret = BMIReadMemory(hifDevice, address, buffer, length); | 2110 ret = BMIReadMemory(hifDevice, address, buffer, length); |
| 2092 if (copy_to_user(rq->ifr_data, buffer, length)) { | 2111 if (copy_to_user(rq->ifr_data, buffer, length)) { |
| 2093 ret = -EFAULT; | 2112 ret = -EFAULT; |
| 2094 } | 2113 } |
| 2095 A_FREE(buffer); | 2114 A_FREE(buffer); |
| 2096 } else { | 2115 } else { |
| 2097 ret = -ENOMEM; | 2116 ret = -ENOMEM; |
| 2098 } | 2117 } |
| 2099 break; | 2118 break; |
| 2100 | 2119 |
| 2101 case AR6000_XIOCTL_BMI_WRITE_MEMORY: | 2120 case AR6000_XIOCTL_BMI_WRITE_MEMORY: |
| 2102 get_user(address, (unsigned int *)userdata); | 2121 » if (get_user(address, (unsigned int *)userdata) || |
| 2103 get_user(length, (unsigned int *)userdata + 1); | 2122 » » get_user(length, (unsigned int *)userdata + 1)) { |
| 2123 » » ret = -EFAULT; |
| 2124 » » break; |
| 2125 » } |
| 2104 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Write Memory (address: 0x%x, length
: %d)\n", | 2126 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Write Memory (address: 0x%x, length
: %d)\n", |
| 2105 address, length)); | 2127 address, length)); |
| 2106 if ((buffer = (unsigned char *)A_MALLOC(length)) != NULL) { | 2128 if ((buffer = (unsigned char *)A_MALLOC(length)) != NULL) { |
| 2107 A_MEMZERO(buffer, length); | 2129 A_MEMZERO(buffer, length); |
| 2108 if (copy_from_user(buffer, &userdata[sizeof(address) + | 2130 if (copy_from_user(buffer, &userdata[sizeof(address) + |
| 2109 sizeof(length)], length)) | 2131 sizeof(length)], length)) |
| 2110 { | 2132 { |
| 2111 ret = -EFAULT; | 2133 ret = -EFAULT; |
| 2112 } else { | 2134 } else { |
| 2113 ret = BMIWriteMemory(hifDevice, address, buffer, length); | 2135 ret = BMIWriteMemory(hifDevice, address, buffer, length); |
| 2114 } | 2136 } |
| 2115 A_FREE(buffer); | 2137 A_FREE(buffer); |
| 2116 } else { | 2138 } else { |
| 2117 ret = -ENOMEM; | 2139 ret = -ENOMEM; |
| 2118 } | 2140 } |
| 2119 break; | 2141 break; |
| 2120 | 2142 |
| 2121 case AR6000_XIOCTL_BMI_TEST: | 2143 case AR6000_XIOCTL_BMI_TEST: |
| 2122 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("No longer supported\n")); | 2144 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("No longer supported\n")); |
| 2123 ret = -EOPNOTSUPP; | 2145 ret = -EOPNOTSUPP; |
| 2124 break; | 2146 break; |
| 2125 | 2147 |
| 2126 case AR6000_XIOCTL_BMI_EXECUTE: | 2148 case AR6000_XIOCTL_BMI_EXECUTE: |
| 2127 get_user(address, (unsigned int *)userdata); | 2149 » if (get_user(address, (unsigned int *)userdata) || |
| 2128 get_user(param, (unsigned int *)userdata + 1); | 2150 » » get_user(param, (unsigned int *)userdata + 1)) { |
| 2151 » » ret = -EFAULT; |
| 2152 » » break; |
| 2153 » } |
| 2129 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Execute (address: 0x%x, param: %d)\
n", | 2154 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Execute (address: 0x%x, param: %d)\
n", |
| 2130 address, param)); | 2155 address, param)); |
| 2131 ret = BMIExecute(hifDevice, address, (A_UINT32*)¶m); | 2156 ret = BMIExecute(hifDevice, address, (A_UINT32*)¶m); |
| 2132 put_user(param, (unsigned int *)rq->ifr_data); /* return value */ | 2157 » /* return value */ |
| 2158 » if (put_user(param, (unsigned int *)rq->ifr_data)) { |
| 2159 » » ret = -EFAULT; |
| 2160 » » break; |
| 2161 » } |
| 2133 break; | 2162 break; |
| 2134 | 2163 |
| 2135 case AR6000_XIOCTL_BMI_SET_APP_START: | 2164 case AR6000_XIOCTL_BMI_SET_APP_START: |
| 2136 get_user(address, (unsigned int *)userdata); | 2165 » if (get_user(address, (unsigned int *)userdata)) { |
| 2166 » » ret = -EFAULT; |
| 2167 » » break; |
| 2168 » } |
| 2137 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Set App Start (address: 0x%x)\n", a
ddress)); | 2169 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Set App Start (address: 0x%x)\n", a
ddress)); |
| 2138 ret = BMISetAppStart(hifDevice, address); | 2170 ret = BMISetAppStart(hifDevice, address); |
| 2139 break; | 2171 break; |
| 2140 | 2172 |
| 2141 case AR6000_XIOCTL_BMI_READ_SOC_REGISTER: | 2173 case AR6000_XIOCTL_BMI_READ_SOC_REGISTER: |
| 2142 get_user(address, (unsigned int *)userdata); | 2174 » if (get_user(address, (unsigned int *)userdata)) { |
| 2175 » » ret = -EFAULT; |
| 2176 » » break; |
| 2177 » } |
| 2143 ret = BMIReadSOCRegister(hifDevice, address, (A_UINT32*)¶m); | 2178 ret = BMIReadSOCRegister(hifDevice, address, (A_UINT32*)¶m); |
| 2144 put_user(param, (unsigned int *)rq->ifr_data); /* return value */ | 2179 » /* return value */ |
| 2180 » if (put_user(param, (unsigned int *)rq->ifr_data)) { |
| 2181 » » ret = -EFAULT; |
| 2182 » » break; |
| 2183 » } |
| 2145 break; | 2184 break; |
| 2146 | 2185 |
| 2147 case AR6000_XIOCTL_BMI_WRITE_SOC_REGISTER: | 2186 case AR6000_XIOCTL_BMI_WRITE_SOC_REGISTER: |
| 2148 get_user(address, (unsigned int *)userdata); | 2187 » if (get_user(address, (unsigned int *)userdata) || |
| 2149 get_user(param, (unsigned int *)userdata + 1); | 2188 » » get_user(param, (unsigned int *)userdata + 1)) { |
| 2189 » » ret = -EFAULT; |
| 2190 » » break; |
| 2191 » } |
| 2150 ret = BMIWriteSOCRegister(hifDevice, address, param); | 2192 ret = BMIWriteSOCRegister(hifDevice, address, param); |
| 2151 break; | 2193 break; |
| 2152 | 2194 |
| 2153 #ifdef HTC_RAW_INTERFACE | 2195 #ifdef HTC_RAW_INTERFACE |
| 2154 case AR6000_XIOCTL_HTC_RAW_OPEN: | 2196 case AR6000_XIOCTL_HTC_RAW_OPEN: |
| 2155 ret = A_OK; | 2197 ret = A_OK; |
| 2156 if (!arRawIfEnabled(ar)) { | 2198 if (!arRawIfEnabled(ar)) { |
| 2157 /* make sure block size is set in case the target was reset sinc
e last | 2199 /* make sure block size is set in case the target was reset sinc
e last |
| 2158 * BMI phase (i.e. flashup downloads) */ | 2200 * BMI phase (i.e. flashup downloads) */ |
| 2159 ret = ar6000_set_htc_params(ar->arHifDevice, | 2201 ret = ar6000_set_htc_params(ar->arHifDevice, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 2177 ret = ar6000_htc_raw_close(ar); | 2219 ret = ar6000_htc_raw_close(ar); |
| 2178 arRawIfEnabled(ar) = FALSE; | 2220 arRawIfEnabled(ar) = FALSE; |
| 2179 } else { | 2221 } else { |
| 2180 ret = A_ERROR; | 2222 ret = A_ERROR; |
| 2181 } | 2223 } |
| 2182 break; | 2224 break; |
| 2183 | 2225 |
| 2184 case AR6000_XIOCTL_HTC_RAW_READ: | 2226 case AR6000_XIOCTL_HTC_RAW_READ: |
| 2185 if (arRawIfEnabled(ar)) { | 2227 if (arRawIfEnabled(ar)) { |
| 2186 unsigned int streamID; | 2228 unsigned int streamID; |
| 2187 get_user(streamID, (unsigned int *)userdata); | 2229 » » if (get_user(streamID, (unsigned int *)userdata) || |
| 2188 get_user(length, (unsigned int *)userdata + 1); | 2230 » » get_user(length, (unsigned int *)userdata + 1)) { |
| 2231 » » ret = -EFAULT; |
| 2232 » » break; |
| 2233 » » } |
| 2189 buffer = (unsigned char*)rq->ifr_data + sizeof(length); | 2234 buffer = (unsigned char*)rq->ifr_data + sizeof(length); |
| 2190 ret = ar6000_htc_raw_read(ar, (HTC_RAW_STREAM_ID)streamID, | 2235 ret = ar6000_htc_raw_read(ar, (HTC_RAW_STREAM_ID)streamID, |
| 2191 (char*)buffer, length); | 2236 (char*)buffer, length); |
| 2192 put_user(ret, (unsigned int *)rq->ifr_data); | 2237 » » if (put_user(ret, (unsigned int *)rq->ifr_data)) { |
| 2238 » » ret = -EFAULT; |
| 2239 » » break; |
| 2240 » » } |
| 2193 } else { | 2241 } else { |
| 2194 ret = A_ERROR; | 2242 ret = A_ERROR; |
| 2195 } | 2243 } |
| 2196 break; | 2244 break; |
| 2197 | 2245 |
| 2198 case AR6000_XIOCTL_HTC_RAW_WRITE: | 2246 case AR6000_XIOCTL_HTC_RAW_WRITE: |
| 2199 if (arRawIfEnabled(ar)) { | 2247 if (arRawIfEnabled(ar)) { |
| 2200 unsigned int streamID; | 2248 unsigned int streamID; |
| 2201 get_user(streamID, (unsigned int *)userdata); | 2249 » » if (get_user(streamID, (unsigned int *)userdata) || |
| 2202 get_user(length, (unsigned int *)userdata + 1); | 2250 » » get_user(length, (unsigned int *)userdata + 1)) { |
| 2251 » » ret = -EFAULT; |
| 2252 » » break; |
| 2253 » » } |
| 2203 buffer = (unsigned char*)userdata + sizeof(streamID) + sizeof(le
ngth); | 2254 buffer = (unsigned char*)userdata + sizeof(streamID) + sizeof(le
ngth); |
| 2204 ret = ar6000_htc_raw_write(ar, (HTC_RAW_STREAM_ID)streamID, | 2255 ret = ar6000_htc_raw_write(ar, (HTC_RAW_STREAM_ID)streamID, |
| 2205 (char*)buffer, length); | 2256 (char*)buffer, length); |
| 2206 put_user(ret, (unsigned int *)rq->ifr_data); | 2257 » » if (put_user(ret, (unsigned int *)rq->ifr_data)) { |
| 2258 » » ret = -EFAULT; |
| 2259 » » break; |
| 2260 » » } |
| 2207 } else { | 2261 } else { |
| 2208 ret = A_ERROR; | 2262 ret = A_ERROR; |
| 2209 } | 2263 } |
| 2210 break; | 2264 break; |
| 2211 #endif /* HTC_RAW_INTERFACE */ | 2265 #endif /* HTC_RAW_INTERFACE */ |
| 2212 | 2266 |
| 2213 case AR6000_XIOCTL_BMI_LZ_STREAM_START: | 2267 case AR6000_XIOCTL_BMI_LZ_STREAM_START: |
| 2214 get_user(address, (unsigned int *)userdata); | 2268 » if (get_user(address, (unsigned int *)userdata)) { |
| 2269 » » ret = -EFAULT; |
| 2270 » » break; |
| 2271 » } |
| 2215 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Start Compressed Stream (address: 0
x%x)\n", address)); | 2272 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Start Compressed Stream (address: 0
x%x)\n", address)); |
| 2216 ret = BMILZStreamStart(hifDevice, address); | 2273 ret = BMILZStreamStart(hifDevice, address); |
| 2217 break; | 2274 break; |
| 2218 | 2275 |
| 2219 case AR6000_XIOCTL_BMI_LZ_DATA: | 2276 case AR6000_XIOCTL_BMI_LZ_DATA: |
| 2220 get_user(length, (unsigned int *)userdata); | 2277 » if (get_user(length, (unsigned int *)userdata)) { |
| 2278 » » ret = -EFAULT; |
| 2279 » » break; |
| 2280 » } |
| 2221 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Send Compressed Data (length: %d)\n
", length)); | 2281 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Send Compressed Data (length: %d)\n
", length)); |
| 2222 if ((buffer = (unsigned char *)A_MALLOC(length)) != NULL) { | 2282 if ((buffer = (unsigned char *)A_MALLOC(length)) != NULL) { |
| 2223 A_MEMZERO(buffer, length); | 2283 A_MEMZERO(buffer, length); |
| 2224 if (copy_from_user(buffer, &userdata[sizeof(length)], length)) | 2284 if (copy_from_user(buffer, &userdata[sizeof(length)], length)) |
| 2225 { | 2285 { |
| 2226 ret = -EFAULT; | 2286 ret = -EFAULT; |
| 2227 } else { | 2287 } else { |
| 2228 ret = BMILZData(hifDevice, buffer, length); | 2288 ret = BMILZData(hifDevice, buffer, length); |
| 2229 } | 2289 } |
| 2230 A_FREE(buffer); | 2290 A_FREE(buffer); |
| 2231 } else { | 2291 } else { |
| 2232 ret = -ENOMEM; | 2292 ret = -ENOMEM; |
| 2233 } | 2293 } |
| 2234 break; | 2294 break; |
| 2235 | 2295 |
| 2236 #if defined(CONFIG_TARGET_PROFILE_SUPPORT) | 2296 #if defined(CONFIG_TARGET_PROFILE_SUPPORT) |
| 2237 /* | 2297 /* |
| 2238 * Optional support for Target-side profiling. | 2298 * Optional support for Target-side profiling. |
| 2239 * Not needed in production. | 2299 * Not needed in production. |
| 2240 */ | 2300 */ |
| 2241 | 2301 |
| 2242 /* Configure Target-side profiling */ | 2302 /* Configure Target-side profiling */ |
| 2243 case AR6000_XIOCTL_PROF_CFG: | 2303 case AR6000_XIOCTL_PROF_CFG: |
| 2244 { | 2304 { |
| 2245 A_UINT32 period; | 2305 A_UINT32 period; |
| 2246 A_UINT32 nbins; | 2306 A_UINT32 nbins; |
| 2247 get_user(period, (unsigned int *)userdata); | 2307 » if (get_user(period, (unsigned int *)userdata) || |
| 2248 get_user(nbins, (unsigned int *)userdata + 1); | 2308 » » get_user(nbins, (unsigned int *)userdata + 1)) { |
| 2309 » » ret = -EFAULT; |
| 2310 » » break; |
| 2311 » } |
| 2249 | 2312 |
| 2250 if (wmi_prof_cfg_cmd(ar->arWmi, period, nbins) != A_OK) { | 2313 if (wmi_prof_cfg_cmd(ar->arWmi, period, nbins) != A_OK) { |
| 2251 ret = -EIO; | 2314 ret = -EIO; |
| 2252 } | 2315 } |
| 2253 | 2316 |
| 2254 break; | 2317 break; |
| 2255 } | 2318 } |
| 2256 | 2319 |
| 2257 /* Start a profiling bucket/bin at the specified address */ | 2320 /* Start a profiling bucket/bin at the specified address */ |
| 2258 case AR6000_XIOCTL_PROF_ADDR_SET: | 2321 case AR6000_XIOCTL_PROF_ADDR_SET: |
| 2259 { | 2322 { |
| 2260 A_UINT32 addr; | 2323 A_UINT32 addr; |
| 2261 get_user(addr, (unsigned int *)userdata); | 2324 » if (get_user(addr, (unsigned int *)userdata)) { |
| 2325 » » ret = -EFAULT; |
| 2326 » » break; |
| 2327 » } |
| 2262 | 2328 |
| 2263 if (wmi_prof_addr_set_cmd(ar->arWmi, addr) != A_OK) { | 2329 if (wmi_prof_addr_set_cmd(ar->arWmi, addr) != A_OK) { |
| 2264 ret = -EIO; | 2330 ret = -EIO; |
| 2265 } | 2331 } |
| 2266 | 2332 |
| 2267 break; | 2333 break; |
| 2268 } | 2334 } |
| 2269 | 2335 |
| 2270 /* START Target-side profiling */ | 2336 /* START Target-side profiling */ |
| 2271 case AR6000_XIOCTL_PROF_START: | 2337 case AR6000_XIOCTL_PROF_START: |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2501 } else { | 2567 } else { |
| 2502 if (wmi_bssfilter_cmd(ar->arWmi, filt.bssFilter, filt.ieMask) | 2568 if (wmi_bssfilter_cmd(ar->arWmi, filt.bssFilter, filt.ieMask) |
| 2503 != A_OK) { | 2569 != A_OK) { |
| 2504 ret = -EIO; | 2570 ret = -EIO; |
| 2505 } else { | 2571 } else { |
| 2506 ar->arUserBssFilter = param; | 2572 ar->arUserBssFilter = param; |
| 2507 } | 2573 } |
| 2508 } | 2574 } |
| 2509 break; | 2575 break; |
| 2510 } | 2576 } |
| 2577 |
| 2511 case AR6000_IOCTL_WMI_SET_SNRTHRESHOLD: | 2578 case AR6000_IOCTL_WMI_SET_SNRTHRESHOLD: |
| 2512 { | 2579 { |
| 2513 ret = ar6000_ioctl_set_snr_threshold(dev, rq); | 2580 ret = ar6000_ioctl_set_snr_threshold(dev, rq); |
| 2514 break; | 2581 break; |
| 2515 } | 2582 } |
| 2516 case AR6000_XIOCTL_WMI_SET_RSSITHRESHOLD: | 2583 case AR6000_XIOCTL_WMI_SET_RSSITHRESHOLD: |
| 2517 { | 2584 { |
| 2518 ret = ar6000_ioctl_set_rssi_threshold(dev, rq); | 2585 ret = ar6000_ioctl_set_rssi_threshold(dev, rq); |
| 2519 break; | 2586 break; |
| 2520 } | 2587 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2552 { | 2619 { |
| 2553 ret = -EIO; | 2620 ret = -EIO; |
| 2554 } | 2621 } |
| 2555 } | 2622 } |
| 2556 | 2623 |
| 2557 break; | 2624 break; |
| 2558 } | 2625 } |
| 2559 case AR6000_XIOCTL_WMI_SET_RTS: | 2626 case AR6000_XIOCTL_WMI_SET_RTS: |
| 2560 { | 2627 { |
| 2561 WMI_SET_RTS_CMD rtsCmd; | 2628 WMI_SET_RTS_CMD rtsCmd; |
| 2562 | |
| 2563 if (ar->arWmiReady == FALSE) { | 2629 if (ar->arWmiReady == FALSE) { |
| 2564 ret = -EIO; | 2630 ret = -EIO; |
| 2565 } else if (copy_from_user(&rtsCmd, userdata, | 2631 } else if (copy_from_user(&rtsCmd, userdata, |
| 2566 sizeof(rtsCmd))) | 2632 sizeof(rtsCmd))) |
| 2567 { | 2633 { |
| 2568 ret = -EFAULT; | 2634 ret = -EFAULT; |
| 2569 } else { | 2635 } else { |
| 2570 ar->arRTS = rtsCmd.threshold; | 2636 ar->arRTS = rtsCmd.threshold; |
| 2571 if (wmi_set_rts_cmd(ar->arWmi, rtsCmd.threshold) | 2637 if (wmi_set_rts_cmd(ar->arWmi, rtsCmd.threshold) |
| 2572 != A_OK) | 2638 != A_OK) |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2637 ret = ar6000_ioctl_set_error_report_bitmask(dev, rq); | 2703 ret = ar6000_ioctl_set_error_report_bitmask(dev, rq); |
| 2638 break; | 2704 break; |
| 2639 } | 2705 } |
| 2640 case AR6000_IOCTL_WMI_SET_ASSOC_INFO: | 2706 case AR6000_IOCTL_WMI_SET_ASSOC_INFO: |
| 2641 { | 2707 { |
| 2642 WMI_SET_ASSOC_INFO_CMD cmd; | 2708 WMI_SET_ASSOC_INFO_CMD cmd; |
| 2643 A_UINT8 assocInfo[WMI_MAX_ASSOC_INFO_LEN]; | 2709 A_UINT8 assocInfo[WMI_MAX_ASSOC_INFO_LEN]; |
| 2644 | 2710 |
| 2645 if (ar->arWmiReady == FALSE) { | 2711 if (ar->arWmiReady == FALSE) { |
| 2646 ret = -EIO; | 2712 ret = -EIO; |
| 2647 } else { | 2713 » » break; |
| 2648 get_user(cmd.ieType, userdata); | 2714 » } |
| 2649 if (cmd.ieType >= WMI_MAX_ASSOC_INFO_TYPE) { | 2715 |
| 2650 ret = -EIO; | 2716 » if (get_user(cmd.ieType, userdata)) { |
| 2651 } else { | 2717 » » ret = -EFAULT; |
| 2652 get_user(cmd.bufferSize, userdata + 1); | 2718 » » break; |
| 2653 if (cmd.bufferSize > WMI_MAX_ASSOC_INFO_LEN) { | 2719 » } |
| 2654 ret = -EFAULT; | 2720 » if (cmd.ieType >= WMI_MAX_ASSOC_INFO_TYPE) { |
| 2655 break; | 2721 » » ret = -EIO; |
| 2656 } | 2722 » » break; |
| 2657 if (copy_from_user(assocInfo, userdata + 2, | 2723 » } |
| 2658 cmd.bufferSize)) | 2724 |
| 2659 { | 2725 » if (get_user(cmd.bufferSize, userdata + 1) || |
| 2660 ret = -EFAULT; | 2726 » » (cmd.bufferSize > WMI_MAX_ASSOC_INFO_LEN) || |
| 2661 } else { | 2727 » » copy_from_user(assocInfo, userdata + 2, cmd.bufferSize)) { |
| 2662 if (wmi_associnfo_cmd(ar->arWmi, cmd.ieType, | 2728 » » ret = -EFAULT; |
| 2663 cmd.bufferSize, | 2729 » » break; |
| 2664 assocInfo) != A_OK) | 2730 » } |
| 2665 { | 2731 » if (wmi_associnfo_cmd(ar->arWmi, cmd.ieType, |
| 2666 ret = -EIO; | 2732 » » » » cmd.bufferSize, assocInfo) != A_OK) { |
| 2667 } | 2733 » » ret = -EIO; |
| 2668 } | 2734 » » break; |
| 2669 } | 2735 » } |
| 2670 } | |
| 2671 break; | 2736 break; |
| 2672 } | 2737 } |
| 2673 case AR6000_IOCTL_WMI_SET_ACCESS_PARAMS: | 2738 case AR6000_IOCTL_WMI_SET_ACCESS_PARAMS: |
| 2674 { | 2739 { |
| 2675 ret = ar6000_ioctl_set_access_params(dev, rq); | 2740 ret = ar6000_ioctl_set_access_params(dev, rq); |
| 2676 break; | 2741 break; |
| 2677 } | 2742 } |
| 2678 case AR6000_IOCTL_WMI_SET_DISC_TIMEOUT: | 2743 case AR6000_IOCTL_WMI_SET_DISC_TIMEOUT: |
| 2679 { | 2744 { |
| 2680 ret = ar6000_ioctl_set_disconnect_timeout(dev, rq); | 2745 ret = ar6000_ioctl_set_disconnect_timeout(dev, rq); |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3193 break; | 3258 break; |
| 3194 case AR6000_XIOCTRL_WMI_SET_POWERSAVE_TIMERS: | 3259 case AR6000_XIOCTRL_WMI_SET_POWERSAVE_TIMERS: |
| 3195 ret = ar6000_ioctl_set_powersave_timers(dev, userdata); | 3260 ret = ar6000_ioctl_set_powersave_timers(dev, userdata); |
| 3196 break; | 3261 break; |
| 3197 case AR6000_XIOCTRL_WMI_GET_POWER_MODE: | 3262 case AR6000_XIOCTRL_WMI_GET_POWER_MODE: |
| 3198 ret = ar6000_ioctl_get_power_mode(dev, rq); | 3263 ret = ar6000_ioctl_get_power_mode(dev, rq); |
| 3199 break; | 3264 break; |
| 3200 case AR6000_XIOCTRL_WMI_SET_WLAN_STATE: | 3265 case AR6000_XIOCTRL_WMI_SET_WLAN_STATE: |
| 3201 { | 3266 { |
| 3202 AR6000_WLAN_STATE state; | 3267 AR6000_WLAN_STATE state; |
| 3203 get_user(state, (unsigned int *)userdata); | 3268 » if (get_user(state, (unsigned int *)userdata)) |
| 3204 if (ar6000_set_wlan_state(ar, state)!=A_OK) { | 3269 » » ret = -EFAULT; |
| 3270 » else if (ar6000_set_wlan_state(ar, state) != A_OK) |
| 3205 ret = -EIO; | 3271 ret = -EIO; |
| 3206 } | |
| 3207 break; | 3272 break; |
| 3208 } | 3273 } |
| 3209 case AR6000_XIOCTL_WMI_GET_ROAM_DATA: | 3274 case AR6000_XIOCTL_WMI_GET_ROAM_DATA: |
| 3210 ret = ar6000_ioctl_get_roam_data(dev, rq); | 3275 ret = ar6000_ioctl_get_roam_data(dev, rq); |
| 3211 break; | 3276 break; |
| 3212 | 3277 |
| 3213 case AR6000_XIOCTL_WMI_SET_BT_STATUS: | 3278 case AR6000_XIOCTL_WMI_SET_BT_STATUS: |
| 3214 ret = ar6000_xioctl_set_bt_status_cmd(dev, userdata); | 3279 ret = ar6000_xioctl_set_bt_status_cmd(dev, userdata); |
| 3215 break; | 3280 break; |
| 3216 | 3281 |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3407 if (wmi_set_reassocmode_cmd(ar->arWmi, setReassocMode.mode) != A
_OK) | 3472 if (wmi_set_reassocmode_cmd(ar->arWmi, setReassocMode.mode) != A
_OK) |
| 3408 { | 3473 { |
| 3409 ret = -EIO; | 3474 ret = -EIO; |
| 3410 } | 3475 } |
| 3411 } | 3476 } |
| 3412 break; | 3477 break; |
| 3413 } | 3478 } |
| 3414 case AR6000_XIOCTL_DIAG_READ: | 3479 case AR6000_XIOCTL_DIAG_READ: |
| 3415 { | 3480 { |
| 3416 A_UINT32 addr, data; | 3481 A_UINT32 addr, data; |
| 3417 get_user(addr, (unsigned int *)userdata); | 3482 » if (get_user(addr, (unsigned int *)userdata)) { |
| 3483 » » ret = -EFAULT; |
| 3484 » » break; |
| 3485 » } |
| 3418 addr = TARG_VTOP(ar->arTargetType, addr); | 3486 addr = TARG_VTOP(ar->arTargetType, addr); |
| 3419 if (ar6000_ReadRegDiag(ar->arHifDevice, &addr, &data) != A_OK) { | 3487 if (ar6000_ReadRegDiag(ar->arHifDevice, &addr, &data) != A_OK) { |
| 3420 ret = -EIO; | 3488 ret = -EIO; |
| 3421 } | 3489 } |
| 3422 put_user(data, (unsigned int *)userdata + 1); | 3490 » if (put_user(data, (unsigned int *)userdata + 1)) { |
| 3491 » » ret = -EFAULT; |
| 3492 » » break; |
| 3493 » } |
| 3423 break; | 3494 break; |
| 3424 } | 3495 } |
| 3425 case AR6000_XIOCTL_DIAG_WRITE: | 3496 case AR6000_XIOCTL_DIAG_WRITE: |
| 3426 { | 3497 { |
| 3427 A_UINT32 addr, data; | 3498 A_UINT32 addr, data; |
| 3428 get_user(addr, (unsigned int *)userdata); | 3499 » if (get_user(addr, (unsigned int *)userdata) || |
| 3429 get_user(data, (unsigned int *)userdata + 1); | 3500 » » get_user(data, (unsigned int *)userdata + 1)) { |
| 3501 » » ret = -EFAULT; |
| 3502 » » break; |
| 3503 » } |
| 3430 addr = TARG_VTOP(ar->arTargetType, addr); | 3504 addr = TARG_VTOP(ar->arTargetType, addr); |
| 3431 if (ar6000_WriteRegDiag(ar->arHifDevice, &addr, &data) != A_OK) { | 3505 if (ar6000_WriteRegDiag(ar->arHifDevice, &addr, &data) != A_OK) { |
| 3432 ret = -EIO; | 3506 ret = -EIO; |
| 3433 } | 3507 } |
| 3434 break; | 3508 break; |
| 3435 } | 3509 } |
| 3436 case AR6000_XIOCTL_WMI_SET_KEEPALIVE: | 3510 case AR6000_XIOCTL_WMI_SET_KEEPALIVE: |
| 3437 { | 3511 { |
| 3438 WMI_SET_KEEPALIVE_CMD setKeepAlive; | 3512 WMI_SET_KEEPALIVE_CMD setKeepAlive; |
| 3439 if (ar->arWmiReady == FALSE) { | 3513 if (ar->arWmiReady == FALSE) { |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3573 case AR6000_XIOCTL_WMI_SET_APPIE: | 3647 case AR6000_XIOCTL_WMI_SET_APPIE: |
| 3574 { | 3648 { |
| 3575 WMI_SET_APPIE_CMD appIEcmd; | 3649 WMI_SET_APPIE_CMD appIEcmd; |
| 3576 A_UINT8 appIeInfo[IEEE80211_APPIE_FRAME_MAX_LEN]; | 3650 A_UINT8 appIeInfo[IEEE80211_APPIE_FRAME_MAX_LEN]; |
| 3577 A_UINT32 fType,ieLen; | 3651 A_UINT32 fType,ieLen; |
| 3578 | 3652 |
| 3579 if (ar->arWmiReady == FALSE) { | 3653 if (ar->arWmiReady == FALSE) { |
| 3580 ret = -EIO; | 3654 ret = -EIO; |
| 3581 goto ioctl_done; | 3655 goto ioctl_done; |
| 3582 } | 3656 } |
| 3583 get_user(fType, (A_UINT32 *)userdata); | 3657 » if (get_user(fType, (A_UINT32 *)userdata)) { |
| 3658 » » ret = -EFAULT; |
| 3659 » » break; |
| 3660 » } |
| 3584 appIEcmd.mgmtFrmType = fType; | 3661 appIEcmd.mgmtFrmType = fType; |
| 3585 if (appIEcmd.mgmtFrmType >= IEEE80211_APPIE_NUM_OF_FRAME) { | 3662 if (appIEcmd.mgmtFrmType >= IEEE80211_APPIE_NUM_OF_FRAME) { |
| 3586 ret = -EIO; | 3663 ret = -EIO; |
| 3587 } else { | 3664 } else { |
| 3588 get_user(ieLen, (A_UINT32 *)(userdata + 4)); | 3665 » » if (get_user(ieLen, (A_UINT32 *)(userdata + 4))) { |
| 3666 » » ret = -EFAULT; |
| 3667 » » break; |
| 3668 » » } |
| 3589 appIEcmd.ieLen = ieLen; | 3669 appIEcmd.ieLen = ieLen; |
| 3590 A_PRINTF("WPSIE: Type-%d, Len-%d\n",appIEcmd.mgmtFrmType, appIEc
md.ieLen); | 3670 A_PRINTF("WPSIE: Type-%d, Len-%d\n",appIEcmd.mgmtFrmType, appIEc
md.ieLen); |
| 3591 if (appIEcmd.ieLen > IEEE80211_APPIE_FRAME_MAX_LEN) { | 3671 if (appIEcmd.ieLen > IEEE80211_APPIE_FRAME_MAX_LEN) { |
| 3592 ret = -EIO; | 3672 ret = -EIO; |
| 3593 break; | 3673 break; |
| 3594 } | 3674 } |
| 3595 if (copy_from_user(appIeInfo, userdata + 8, appIEcmd.ieLen)) { | 3675 if (copy_from_user(appIeInfo, userdata + 8, appIEcmd.ieLen)) { |
| 3596 ret = -EFAULT; | 3676 ret = -EFAULT; |
| 3597 } else { | 3677 } else { |
| 3598 if (wmi_set_appie_cmd(ar->arWmi, appIEcmd.mgmtFrmType, | 3678 if (wmi_set_appie_cmd(ar->arWmi, appIEcmd.mgmtFrmType, |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3650 break; | 3730 break; |
| 3651 } | 3731 } |
| 3652 case AR6000_XIOCTL_BMI_ROMPATCH_INSTALL: | 3732 case AR6000_XIOCTL_BMI_ROMPATCH_INSTALL: |
| 3653 { | 3733 { |
| 3654 A_UINT32 ROM_addr; | 3734 A_UINT32 ROM_addr; |
| 3655 A_UINT32 RAM_addr; | 3735 A_UINT32 RAM_addr; |
| 3656 A_UINT32 nbytes; | 3736 A_UINT32 nbytes; |
| 3657 A_UINT32 do_activate; | 3737 A_UINT32 do_activate; |
| 3658 A_UINT32 rompatch_id; | 3738 A_UINT32 rompatch_id; |
| 3659 | 3739 |
| 3660 get_user(ROM_addr, (A_UINT32 *)userdata); | 3740 » if (get_user(ROM_addr, (A_UINT32 *)userdata) || |
| 3661 get_user(RAM_addr, (A_UINT32 *)userdata + 1); | 3741 » » get_user(RAM_addr, (A_UINT32 *)userdata + 1) || |
| 3662 get_user(nbytes, (A_UINT32 *)userdata + 2); | 3742 » » get_user(nbytes, (A_UINT32 *)userdata + 2) || |
| 3663 get_user(do_activate, (A_UINT32 *)userdata + 3); | 3743 » » get_user(do_activate, (A_UINT32 *)userdata + 3)) { |
| 3744 » » ret = -EFAULT; |
| 3745 » » break; |
| 3746 » } |
| 3664 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Install rompatch from ROM: 0x%x to
RAM: 0x%x length: %d\n", | 3747 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Install rompatch from ROM: 0x%x to
RAM: 0x%x length: %d\n", |
| 3665 ROM_addr, RAM_addr, nbytes)); | 3748 ROM_addr, RAM_addr, nbytes)); |
| 3666 ret = BMIrompatchInstall(hifDevice, ROM_addr, RAM_addr, | 3749 ret = BMIrompatchInstall(hifDevice, ROM_addr, RAM_addr, |
| 3667 nbytes, do_activate, &rompatch_id); | 3750 nbytes, do_activate, &rompatch_id); |
| 3668 if (ret == A_OK) { | 3751 if (ret == A_OK) { |
| 3669 put_user(rompatch_id, (unsigned int *)rq->ifr_data); /* return v
alue */ | 3752 » » /* return value */ |
| 3753 » » if (put_user(rompatch_id, (unsigned int *)rq->ifr_data)) { |
| 3754 » » ret = -EFAULT; |
| 3755 » » break; |
| 3756 » » } |
| 3670 } | 3757 } |
| 3671 break; | 3758 break; |
| 3672 } | 3759 } |
| 3673 | 3760 |
| 3674 case AR6000_XIOCTL_BMI_ROMPATCH_UNINSTALL: | 3761 case AR6000_XIOCTL_BMI_ROMPATCH_UNINSTALL: |
| 3675 { | 3762 { |
| 3676 A_UINT32 rompatch_id; | 3763 A_UINT32 rompatch_id; |
| 3677 | 3764 |
| 3678 get_user(rompatch_id, (A_UINT32 *)userdata); | 3765 » if (get_user(rompatch_id, (A_UINT32 *)userdata)) { |
| 3766 » » ret = -EFAULT; |
| 3767 » » break; |
| 3768 » } |
| 3679 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("UNinstall rompatch_id %d\n", rompat
ch_id)); | 3769 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("UNinstall rompatch_id %d\n", rompat
ch_id)); |
| 3680 ret = BMIrompatchUninstall(hifDevice, rompatch_id); | 3770 ret = BMIrompatchUninstall(hifDevice, rompatch_id); |
| 3681 break; | 3771 break; |
| 3682 } | 3772 } |
| 3683 | 3773 |
| 3684 case AR6000_XIOCTL_BMI_ROMPATCH_ACTIVATE: | 3774 case AR6000_XIOCTL_BMI_ROMPATCH_ACTIVATE: |
| 3685 case AR6000_XIOCTL_BMI_ROMPATCH_DEACTIVATE: | 3775 case AR6000_XIOCTL_BMI_ROMPATCH_DEACTIVATE: |
| 3686 { | 3776 { |
| 3687 A_UINT32 rompatch_count; | 3777 A_UINT32 rompatch_count; |
| 3688 | 3778 |
| 3689 get_user(rompatch_count, (A_UINT32 *)userdata); | 3779 » if (get_user(rompatch_count, (A_UINT32 *)userdata)) { |
| 3780 » » ret = -EFAULT; |
| 3781 » » break; |
| 3782 » } |
| 3690 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Change rompatch activation count=%d
\n", rompatch_count)); | 3783 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Change rompatch activation count=%d
\n", rompatch_count)); |
| 3691 length = sizeof(A_UINT32) * rompatch_count; | 3784 length = sizeof(A_UINT32) * rompatch_count; |
| 3692 if ((buffer = (unsigned char *)A_MALLOC(length)) != NULL) { | 3785 if ((buffer = (unsigned char *)A_MALLOC(length)) != NULL) { |
| 3693 A_MEMZERO(buffer, length); | 3786 A_MEMZERO(buffer, length); |
| 3694 if (copy_from_user(buffer, &userdata[sizeof(rompatch_count)], le
ngth)) | 3787 if (copy_from_user(buffer, &userdata[sizeof(rompatch_count)], le
ngth)) |
| 3695 { | 3788 { |
| 3696 ret = -EFAULT; | 3789 ret = -EFAULT; |
| 3697 } else { | 3790 } else { |
| 3698 if (cmd == AR6000_XIOCTL_BMI_ROMPATCH_ACTIVATE) { | 3791 if (cmd == AR6000_XIOCTL_BMI_ROMPATCH_ACTIVATE) { |
| 3699 ret = BMIrompatchActivate(hifDevice, rompatch_count, (A_
UINT32 *)buffer); | 3792 ret = BMIrompatchActivate(hifDevice, rompatch_count, (A_
UINT32 *)buffer); |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3843 if (wmi_del_wow_pattern_cmd(ar->arWmi, | 3936 if (wmi_del_wow_pattern_cmd(ar->arWmi, |
| 3844 &delWowPattern) != A_OK) | 3937 &delWowPattern) != A_OK) |
| 3845 { | 3938 { |
| 3846 ret = -EIO; | 3939 ret = -EIO; |
| 3847 } | 3940 } |
| 3848 } | 3941 } |
| 3849 break; | 3942 break; |
| 3850 } | 3943 } |
| 3851 case AR6000_XIOCTL_DUMP_HTC_CREDIT_STATE: | 3944 case AR6000_XIOCTL_DUMP_HTC_CREDIT_STATE: |
| 3852 if (ar->arHtcTarget != NULL) { | 3945 if (ar->arHtcTarget != NULL) { |
| 3946 #ifdef ATH_DEBUG_MODULE |
| 3853 HTCDumpCreditStates(ar->arHtcTarget); | 3947 HTCDumpCreditStates(ar->arHtcTarget); |
| 3948 #endif /* ATH_DEBUG_MODULE */ |
| 3854 #ifdef HTC_EP_STAT_PROFILING | 3949 #ifdef HTC_EP_STAT_PROFILING |
| 3855 { | 3950 { |
| 3856 HTC_ENDPOINT_STATS stats; | 3951 HTC_ENDPOINT_STATS stats; |
| 3857 int i; | 3952 int i; |
| 3858 | 3953 |
| 3859 for (i = 0; i < 5; i++) { | 3954 for (i = 0; i < 5; i++) { |
| 3860 if (HTCGetEndpointStatistics(ar->arHtcTarget, | 3955 if (HTCGetEndpointStatistics(ar->arHtcTarget, |
| 3861 i, | 3956 i, |
| 3862 HTC_EP_STAT_SAMPLE_AND_CLEA
R, | 3957 HTC_EP_STAT_SAMPLE_AND_CLEA
R, |
| 3863 &stats)) { | 3958 &stats)) { |
| (...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4446 } else if(copy_to_user((WMI_BEACON_INT_CMD *)rq->ifr_data, | 4541 } else if(copy_to_user((WMI_BEACON_INT_CMD *)rq->ifr_data, |
| 4447 &bi, sizeof(WMI_BEACON_INT_CMD))) { | 4542 &bi, sizeof(WMI_BEACON_INT_CMD))) { |
| 4448 ret = -EFAULT; | 4543 ret = -EFAULT; |
| 4449 } | 4544 } |
| 4450 break; | 4545 break; |
| 4451 } | 4546 } |
| 4452 case AR6000_XIOCTL_AP_GET_RTS: | 4547 case AR6000_XIOCTL_AP_GET_RTS: |
| 4453 { | 4548 { |
| 4454 WMI_SET_RTS_CMD rts; | 4549 WMI_SET_RTS_CMD rts; |
| 4455 rts.threshold = ar->arRTS; | 4550 rts.threshold = ar->arRTS; |
| 4456 | 4551 » |
| 4457 if (ar->arWmiReady == FALSE) { | 4552 if (ar->arWmiReady == FALSE) { |
| 4458 ret = -EIO; | 4553 ret = -EIO; |
| 4459 } else if(copy_to_user((WMI_SET_RTS_CMD *)rq->ifr_data, | 4554 } else if(copy_to_user((WMI_SET_RTS_CMD *)rq->ifr_data, |
| 4460 &rts, sizeof(WMI_SET_RTS_CMD))) { | 4555 &rts, sizeof(WMI_SET_RTS_CMD))) { |
| 4461 ret = -EFAULT; | 4556 ret = -EFAULT; |
| 4462 } | 4557 } |
| 4463 break; | 4558 break; |
| 4464 } | 4559 } |
| 4465 case AR6000_XIOCTL_FETCH_TARGET_REGS: | 4560 case AR6000_XIOCTL_FETCH_TARGET_REGS: |
| 4466 { | 4561 { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 4497 wmiSleepEvent.sleepState = WMI_REPORT_SLEEP_STATUS_IS_AWAKE; | 4592 wmiSleepEvent.sleepState = WMI_REPORT_SLEEP_STATUS_IS_AWAKE; |
| 4498 } else { | 4593 } else { |
| 4499 wmiSleepEvent.sleepState = WMI_REPORT_SLEEP_STATUS_IS_DEEP_SLEEP
; | 4594 wmiSleepEvent.sleepState = WMI_REPORT_SLEEP_STATUS_IS_DEEP_SLEEP
; |
| 4500 } | 4595 } |
| 4501 rq->ifr_ifru.ifru_ivalue = ar->arWlanState; /* return value */ | 4596 rq->ifr_ifru.ifru_ivalue = ar->arWlanState; /* return value */ |
| 4502 | 4597 |
| 4503 ar6000_send_event_to_app(ar, WMI_REPORT_SLEEP_STATE_EVENTID, (A_UINT
8*)&wmiSleepEvent, | 4598 ar6000_send_event_to_app(ar, WMI_REPORT_SLEEP_STATE_EVENTID, (A_UINT
8*)&wmiSleepEvent, |
| 4504 sizeof(WMI_REPORT_SLEEP_STATE_EVENTID)); | 4599 sizeof(WMI_REPORT_SLEEP_STATE_EVENTID)); |
| 4505 break; | 4600 break; |
| 4506 } | 4601 } |
| 4602 #ifdef CONFIG_PM |
| 4603 case AR6000_XIOCTL_SET_BT_HW_POWER_STATE: |
| 4604 { |
| 4605 unsigned int state; |
| 4606 if (get_user(state, (unsigned int *)userdata)) { |
| 4607 ret = -EFAULT; |
| 4608 break; |
| 4609 } |
| 4610 if (ar6000_set_bt_hw_state(ar, state)!=A_OK) { |
| 4611 ret = -EIO; |
| 4612 } |
| 4613 } |
| 4614 break; |
| 4615 case AR6000_XIOCTL_GET_BT_HW_POWER_STATE: |
| 4616 rq->ifr_ifru.ifru_ivalue = !ar->arBTOff; /* return value */ |
| 4617 break; |
| 4618 #endif |
| 4619 |
| 4620 case AR6000_XIOCTL_WMI_SET_TX_SGI_PARAM: |
| 4621 { |
| 4622 WMI_SET_TX_SGI_PARAM_CMD SGICmd; |
| 4623 |
| 4624 if (ar->arWmiReady == FALSE) { |
| 4625 ret = -EIO; |
| 4626 } else if (copy_from_user(&SGICmd, userdata, |
| 4627 sizeof(SGICmd))){ |
| 4628 ret = -EFAULT; |
| 4629 } else{ |
| 4630 if (wmi_SGI_cmd(ar->arWmi, SGICmd.sgiMask, SGICmd.sgiPERThr
eshold) != A_OK) { |
| 4631 ret = -EIO; |
| 4632 } |
| 4633 |
| 4634 } |
| 4635 break; |
| 4636 } |
| 4637 |
| 4638 case AR6000_XIOCTL_ADD_AP_INTERFACE: |
| 4639 #ifdef CONFIG_AP_VIRTUAL_ADAPTER_SUPPORT |
| 4640 { |
| 4641 char ap_ifname[IFNAMSIZ] = {0,}; |
| 4642 if (copy_from_user(ap_ifname, userdata, IFNAMSIZ)) { |
| 4643 ret = -EFAULT; |
| 4644 } else { |
| 4645 if (ar6000_add_ap_interface(ar, ap_ifname) != A_OK) { |
| 4646 ret = -EIO; |
| 4647 } |
| 4648 } |
| 4649 } |
| 4650 #else |
| 4651 ret = -EOPNOTSUPP; |
| 4652 #endif |
| 4653 break; |
| 4654 case AR6000_XIOCTL_REMOVE_AP_INTERFACE: |
| 4655 #ifdef CONFIG_AP_VIRTUAL_ADAPTER_SUPPORT |
| 4656 if (ar6000_remove_ap_interface(ar) != A_OK) { |
| 4657 ret = -EIO; |
| 4658 } |
| 4659 #else |
| 4660 ret = -EOPNOTSUPP; |
| 4661 #endif |
| 4662 break; |
| 4663 |
| 4507 default: | 4664 default: |
| 4508 ret = -EOPNOTSUPP; | 4665 ret = -EOPNOTSUPP; |
| 4509 } | 4666 } |
| 4510 | 4667 |
| 4511 ioctl_done: | 4668 ioctl_done: |
| 4512 rtnl_lock(); /* restore rtnl state */ | 4669 rtnl_lock(); /* restore rtnl state */ |
| 4513 dev_put(dev); | 4670 dev_put(dev); |
| 4514 | 4671 |
| 4515 return ret; | 4672 return ret; |
| 4516 } | 4673 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4567 return 0; | 4724 return 0; |
| 4568 | 4725 |
| 4569 A_MEMZERO(a->acl_mac[acl->index],ATH_MAC_LEN); | 4726 A_MEMZERO(a->acl_mac[acl->index],ATH_MAC_LEN); |
| 4570 a->index = a->index & ~(1 << acl->index); | 4727 a->index = a->index & ~(1 << acl->index); |
| 4571 a->wildcard[acl->index] = 0; | 4728 a->wildcard[acl->index] = 0; |
| 4572 return 1; | 4729 return 1; |
| 4573 } | 4730 } |
| 4574 | 4731 |
| 4575 return 0; | 4732 return 0; |
| 4576 } | 4733 } |
| OLD | NEW |