Advertisement
Guest User

Untitled

a guest
Apr 7th, 2010
389
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 268.94 KB | None | 0 0
  1. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/aiutils.c /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/aiutils.c
  2. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/aiutils.c 2010-04-06 22:12:45.000000000 +0200
  3. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/aiutils.c 2010-04-07 00:34:09.000000000 +0200
  4. @@ -2,7 +2,7 @@
  5. * Misc utility routines for accessing chip-specific features
  6. * of the SiliconBackplane-based Broadcom chips.
  7. *
  8. - * Copyright (C) 1999-2009, Broadcom Corporation
  9. + * Copyright (C) 1999-2010, Broadcom Corporation
  10. *
  11. * Unless you and Broadcom execute a separate written software license
  12. * agreement governing use of this software, this software is licensed to you
  13. Binärdateien /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/aiutils.o and /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/aiutils.o sind verschieden.
  14. Binärdateien /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/bcm4329.ko and /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/bcm4329.ko sind verschieden.
  15. Binärdateien /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/bcm4329.o and /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/bcm4329.o sind verschieden.
  16. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/bcmpcispi.c /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/bcmpcispi.c
  17. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/bcmpcispi.c 2010-04-06 22:12:45.000000000 +0200
  18. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/bcmpcispi.c 2010-04-07 00:34:09.000000000 +0200
  19. @@ -1,7 +1,7 @@
  20. /*
  21. * Broadcom SPI over PCI-SPI Host Controller, low-level hardware driver
  22. *
  23. - * Copyright (C) 1999-2009, Broadcom Corporation
  24. + * Copyright (C) 1999-2010, Broadcom Corporation
  25. *
  26. * Unless you and Broadcom execute a separate written software license
  27. * agreement governing use of this software, this software is licensed to you
  28. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/bcmsdh.c /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/bcmsdh.c
  29. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/bcmsdh.c 2010-04-06 22:12:45.000000000 +0200
  30. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/bcmsdh.c 2010-04-07 00:34:09.000000000 +0200
  31. @@ -2,7 +2,7 @@
  32. * BCMSDH interface glue
  33. * implement bcmsdh API for SDIOH driver
  34. *
  35. - * Copyright (C) 1999-2009, Broadcom Corporation
  36. + * Copyright (C) 1999-2010, Broadcom Corporation
  37. *
  38. * Unless you and Broadcom execute a separate written software license
  39. * agreement governing use of this software, this software is licensed to you
  40. @@ -22,7 +22,7 @@
  41. * software in any way with any other Broadcom software provided under a license
  42. * other than the GPL, without Broadcom's express prior written consent.
  43. *
  44. - * $Id: bcmsdh.c,v 1.35.2.1.4.8.6.11 2009/10/20 09:48:20 Exp $
  45. + * $Id: bcmsdh.c,v 1.35.2.1.4.8.6.12 2009/11/04 20:36:52 Exp $
  46. */
  47. /* ****************** BCMSDH Interface Functions *************************** */
  48.  
  49. @@ -40,9 +40,6 @@
  50.  
  51. #include <sdio.h> /* sdio spec */
  52.  
  53. -/* Defines number of access retries to configuration registers */
  54. -#define SDIOH_API_ACCESS_RETRY_LIMIT 2
  55. -
  56. const uint bcmsdh_msglevel = BCMSDH_ERROR_VAL;
  57.  
  58.  
  59. @@ -59,7 +56,6 @@
  60. bcmsdh_info_t * l_bcmsdh = NULL;
  61.  
  62. #if defined(OOB_INTR_ONLY) && defined(HW_OOB)
  63. -
  64. extern int
  65. sdioh_enable_hw_oob_intr(void *sdioh, bool enable);
  66.  
  67. @@ -68,7 +64,6 @@
  68. {
  69. sdioh_enable_hw_oob_intr(sdh->sdioh, enable);
  70. }
  71. -
  72. #endif
  73.  
  74. bcmsdh_info_t *
  75. @@ -210,9 +205,6 @@
  76. {
  77. bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
  78. SDIOH_API_RC status;
  79. -#ifdef SDIOH_API_ACCESS_RETRY_LIMIT
  80. - int32 retry = 0;
  81. -#endif
  82. uint8 data = 0;
  83.  
  84. if (!bcmsdh)
  85. @@ -220,15 +212,7 @@
  86.  
  87. ASSERT(bcmsdh->init_success);
  88.  
  89. -#ifdef SDIOH_API_ACCESS_RETRY_LIMIT
  90. - do {
  91. - if (retry) /* wait for 1 ms till bus get settled down */
  92. - OSL_DELAY(1000);
  93. -#endif
  94. status = sdioh_cfg_read(bcmsdh->sdioh, fnc_num, addr, (uint8 *)&data);
  95. -#ifdef SDIOH_API_ACCESS_RETRY_LIMIT
  96. - } while (!SDIOH_API_SUCCESS(status) && (retry++ < SDIOH_API_ACCESS_RETRY_LIMIT));
  97. -#endif
  98. if (err)
  99. *err = (SDIOH_API_SUCCESS(status) ? 0 : BCME_SDIO_ERROR);
  100.  
  101. @@ -243,24 +227,13 @@
  102. {
  103. bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
  104. SDIOH_API_RC status;
  105. -#ifdef SDIOH_API_ACCESS_RETRY_LIMIT
  106. - int32 retry = 0;
  107. -#endif
  108.  
  109. if (!bcmsdh)
  110. bcmsdh = l_bcmsdh;
  111.  
  112. ASSERT(bcmsdh->init_success);
  113.  
  114. -#ifdef SDIOH_API_ACCESS_RETRY_LIMIT
  115. - do {
  116. - if (retry) /* wait for 1 ms till bus get settled down */
  117. - OSL_DELAY(1000);
  118. -#endif
  119. status = sdioh_cfg_write(bcmsdh->sdioh, fnc_num, addr, (uint8 *)&data);
  120. -#ifdef SDIOH_API_ACCESS_RETRY_LIMIT
  121. - } while (!SDIOH_API_SUCCESS(status) && (retry++ < SDIOH_API_ACCESS_RETRY_LIMIT));
  122. -#endif
  123. if (err)
  124. *err = SDIOH_API_SUCCESS(status) ? 0 : BCME_SDIO_ERROR;
  125.  
  126. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/bcmsdh_linux.c /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/bcmsdh_linux.c
  127. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/bcmsdh_linux.c 2010-04-06 22:12:45.000000000 +0200
  128. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/bcmsdh_linux.c 2010-04-07 00:34:09.000000000 +0200
  129. @@ -1,7 +1,7 @@
  130. /*
  131. * SDIO access interface for drivers - linux specific (pci only)
  132. *
  133. - * Copyright (C) 1999-2009, Broadcom Corporation
  134. + * Copyright (C) 1999-2010, Broadcom Corporation
  135. *
  136. * Unless you and Broadcom execute a separate written software license
  137. * agreement governing use of this software, this software is licensed to you
  138. @@ -21,7 +21,7 @@
  139. * software in any way with any other Broadcom software provided under a license
  140. * other than the GPL, without Broadcom's express prior written consent.
  141. *
  142. - * $Id: bcmsdh_linux.c,v 1.42.10.10.2.8 2009/10/15 22:48:28 Exp $
  143. + * $Id: bcmsdh_linux.c,v 1.42.10.10.2.12 2010/03/10 03:09:48 Exp $
  144. */
  145.  
  146. /**
  147. @@ -75,7 +75,7 @@
  148. bcmsdh_info_t *sdh; /* SDIO Host Controller handle */
  149. void *ch;
  150. unsigned int oob_irq;
  151. - unsigned long oob_flags;
  152. + unsigned long oob_flags; /* OOB Host specifiction as edge and etc */
  153. };
  154. static bcmsdh_hc_t *sdhcinfo = NULL;
  155.  
  156. @@ -176,7 +176,7 @@
  157. #endif /* BCMLXSDMMC */
  158. int irq = 0;
  159. uint32 vendevid;
  160. - unsigned long irq_flags = IRQF_TRIGGER_FALLING;
  161. + unsigned long irq_flags = 0;
  162.  
  163. #if !defined(BCMLXSDMMC) && defined(BCMPLATFORM_BUS)
  164. pdev = to_platform_device(dev);
  165. @@ -187,6 +187,7 @@
  166. #endif /* BCMLXSDMMC */
  167.  
  168. #if defined(OOB_INTR_ONLY)
  169. + irq_flags = IRQF_TRIGGER_FALLING;
  170. irq = dhd_customer_oob_irq_map(&irq_flags);
  171. if (irq < 0) {
  172. SDLX_MSG(("%s: Host irq is not defined\n", __FUNCTION__));
  173. @@ -334,6 +335,18 @@
  174. };
  175.  
  176.  
  177. +extern uint sd_pci_slot; /* Force detection to a particular PCI */
  178. + /* slot only . Allows for having multiple */
  179. + /* WL devices at once in a PC */
  180. + /* Only one instance of dhd will be */
  181. + /* useable at a time */
  182. + /* Upper word is bus number, */
  183. + /* lower word is slot number */
  184. + /* Default value of 0xFFFFffff turns this */
  185. + /* off */
  186. +module_param(sd_pci_slot, uint, 0);
  187. +
  188. +
  189. /**
  190. * Detect supported SDIO Host Controller and attach if found.
  191. *
  192. @@ -349,6 +362,26 @@
  193. bcmsdh_info_t *sdh = NULL;
  194. int rc;
  195.  
  196. + if (sd_pci_slot != 0xFFFFffff) {
  197. + if (pdev->bus->number != (sd_pci_slot>>16) ||
  198. + PCI_SLOT(pdev->devfn) != (sd_pci_slot&0xffff)) {
  199. + SDLX_MSG(("%s: %s: bus %X, slot %X, vend %X, dev %X\n",
  200. + __FUNCTION__,
  201. + bcmsdh_chipmatch(pdev->vendor, pdev->device)
  202. + ?"Found compatible SDIOHC"
  203. + :"Probing unknown device",
  204. + pdev->bus->number, PCI_SLOT(pdev->devfn), pdev->vendor,
  205. + pdev->device));
  206. + return -ENODEV;
  207. + }
  208. + SDLX_MSG(("%s: %s: bus %X, slot %X, vendor %X, device %X (good PCI location)\n",
  209. + __FUNCTION__,
  210. + bcmsdh_chipmatch(pdev->vendor, pdev->device)
  211. + ?"Using compatible SDIOHC"
  212. + :"WARNING, forced use of unkown device",
  213. + pdev->bus->number, PCI_SLOT(pdev->devfn), pdev->vendor, pdev->device));
  214. + }
  215. +
  216. if ((pdev->vendor == VENDOR_TI) && ((pdev->device == PCIXX21_FLASHMEDIA_ID) ||
  217. (pdev->device == PCIXX21_FLASHMEDIA0_ID))) {
  218. uint32 config_reg;
  219. @@ -539,7 +572,7 @@
  220. {
  221. dhd_pub_t *dhdp;
  222.  
  223. - dhdp = (dhd_pub_t *)sdhcinfo->dev->driver_data;
  224. + dhdp = (dhd_pub_t *)dev_get_drvdata(sdhcinfo->dev);
  225.  
  226. if (dhdp == NULL) {
  227. disable_irq(sdhcinfo->oob_irq);
  228. @@ -547,6 +580,8 @@
  229. return IRQ_HANDLED;
  230. }
  231.  
  232. + WAKE_LOCK_TIMEOUT(dhdp, WAKE_LOCK_TMOUT, 25);
  233. +
  234. dhdsdio_isr((void *)dhdp->bus);
  235.  
  236. return IRQ_HANDLED;
  237. @@ -558,7 +593,8 @@
  238.  
  239. SDLX_MSG(("%s Enter\n", __FUNCTION__));
  240.  
  241. - sdhcinfo->dev->driver_data = dhdp;
  242. + dev_set_drvdata(sdhcinfo->dev, dhdp);
  243. +
  244.  
  245. /* Refer to customer Host IRQ docs about proper irqflags definition */
  246. error = request_irq(sdhcinfo->oob_irq, wlan_oob_irq, sdhcinfo->oob_flags,
  247. Binärdateien /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/bcmsdh_linux.o and /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/bcmsdh_linux.o sind verschieden.
  248. Binärdateien /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/bcmsdh.o and /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/bcmsdh.o sind verschieden.
  249. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/bcmsdh_sdmmc.c /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/bcmsdh_sdmmc.c
  250. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/bcmsdh_sdmmc.c 2010-04-06 22:12:45.000000000 +0200
  251. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/bcmsdh_sdmmc.c 2010-04-07 00:34:09.000000000 +0200
  252. @@ -1,7 +1,7 @@
  253. /*
  254. * BCMSDH Function Driver for the native SDIO/MMC driver in the Linux Kernel
  255. *
  256. - * Copyright (C) 1999-2009, Broadcom Corporation
  257. + * Copyright (C) 1999-2010, Broadcom Corporation
  258. *
  259. * Unless you and Broadcom execute a separate written software license
  260. * agreement governing use of this software, this software is licensed to you
  261. @@ -21,7 +21,7 @@
  262. * software in any way with any other Broadcom software provided under a license
  263. * other than the GPL, without Broadcom's express prior written consent.
  264. *
  265. - * $Id: bcmsdh_sdmmc.c,v 1.1.2.5.6.27 2009/10/28 19:42:29 Exp $
  266. + * $Id: bcmsdh_sdmmc.c,v 1.1.2.5.6.29 2010/03/19 17:16:08 Exp $
  267. */
  268. #include <typedefs.h>
  269.  
  270. @@ -211,26 +211,29 @@
  271. }
  272.  
  273. #if defined(OOB_INTR_ONLY) && defined(HW_OOB)
  274. -#define _SDIO_CCCR_IENx 0x04 /* Function/Master Interrupt Enable */
  275.  
  276. extern SDIOH_API_RC
  277. -sdioh_enable_func_intr(uint32 func)
  278. +sdioh_enable_func_intr(void)
  279. {
  280. uint8 reg;
  281. int err;
  282.  
  283. if (gInstance->func[0]) {
  284. sdio_claim_host(gInstance->func[0]);
  285. - reg = sdio_readb(gInstance->func[0], _SDIO_CCCR_IENx, &err);
  286. +
  287. + reg = sdio_readb(gInstance->func[0], SDIOD_CCCR_INTEN, &err);
  288. if (err) {
  289. sd_err(("%s: error for read SDIO_CCCR_IENx : 0x%x\n", __FUNCTION__, err));
  290. sdio_release_host(gInstance->func[0]);
  291. return SDIOH_API_RC_FAIL;
  292. }
  293. - reg |= 1 << func; /* enable function-x interrupt */
  294. - reg |= 1; /* Master interrupt enable */
  295. - sdio_writeb(gInstance->func[0], reg, _SDIO_CCCR_IENx, &err);
  296. +
  297. + /* Enable F1 and F2 interrupts, set master enable */
  298. + reg |= (INTR_CTL_FUNC1_EN | INTR_CTL_FUNC2_EN | INTR_CTL_MASTER_EN);
  299. +
  300. + sdio_writeb(gInstance->func[0], reg, SDIOD_CCCR_INTEN, &err);
  301. sdio_release_host(gInstance->func[0]);
  302. +
  303. if (err) {
  304. sd_err(("%s: error for write SDIO_CCCR_IENx : 0x%x\n", __FUNCTION__, err));
  305. return SDIOH_API_RC_FAIL;
  306. @@ -238,28 +241,29 @@
  307. }
  308.  
  309. return SDIOH_API_RC_SUCCESS;
  310. -
  311. }
  312.  
  313. extern SDIOH_API_RC
  314. -sdioh_disable_func_intr(uint32 func)
  315. +sdioh_disable_func_intr(void)
  316. {
  317. uint8 reg;
  318. int err;
  319.  
  320. if (gInstance->func[0]) {
  321. sdio_claim_host(gInstance->func[0]);
  322. - reg = sdio_readb(gInstance->func[0], _SDIO_CCCR_IENx, &err);
  323. + reg = sdio_readb(gInstance->func[0], SDIOD_CCCR_INTEN, &err);
  324. if (err) {
  325. sd_err(("%s: error for read SDIO_CCCR_IENx : 0x%x\n", __FUNCTION__, err));
  326. sdio_release_host(gInstance->func[0]);
  327. return SDIOH_API_RC_FAIL;
  328. }
  329. - reg &= ~(1 << func);
  330. +
  331. + reg &= ~(INTR_CTL_FUNC1_EN | INTR_CTL_FUNC2_EN);
  332. /* Disable master interrupt with the last function interrupt */
  333. if (!(reg & 0xFE))
  334. reg = 0;
  335. - sdio_writeb(gInstance->func[0], reg, _SDIO_CCCR_IENx, &err);
  336. + sdio_writeb(gInstance->func[0], reg, SDIOD_CCCR_INTEN, &err);
  337. +
  338. sdio_release_host(gInstance->func[0]);
  339. if (err) {
  340. sd_err(("%s: error for write SDIO_CCCR_IENx : 0x%x\n", __FUNCTION__, err));
  341. @@ -267,7 +271,6 @@
  342. }
  343. }
  344. return SDIOH_API_RC_SUCCESS;
  345. -
  346. }
  347. #endif /* defined(OOB_INTR_ONLY) && defined(HW_OOB) */
  348.  
  349. @@ -298,7 +301,7 @@
  350. sdio_release_host(gInstance->func[1]);
  351. }
  352. #elif defined(HW_OOB)
  353. - sdioh_enable_func_intr(2);
  354. + sdioh_enable_func_intr();
  355. #endif /* defined(OOB_INTR_ONLY) */
  356. return SDIOH_API_RC_SUCCESS;
  357. }
  358. @@ -328,7 +331,7 @@
  359. sd->intr_handler = NULL;
  360. sd->intr_handler_arg = NULL;
  361. #elif defined(HW_OOB)
  362. - sdioh_disable_func_intr(2);
  363. + sdioh_disable_func_intr();
  364. #endif /* !defined(OOB_INTR_ONLY) */
  365. return SDIOH_API_RC_SUCCESS;
  366. }
  367. @@ -678,7 +681,6 @@
  368. }
  369. #endif /* defined(OOB_INTR_ONLY) && defined(HW_OOB) */
  370.  
  371. -
  372. extern SDIOH_API_RC
  373. sdioh_cfg_read(sdioh_info_t *sd, uint fnc_num, uint32 addr, uint8 *data)
  374. {
  375. @@ -794,8 +796,7 @@
  376. * depending upon MMC driver change.
  377. * As of this time, this is temporaray one
  378. */
  379. - sdio_f0_writeb(gInstance->func[func], *byte,
  380. - regaddr, &err_ret);
  381. + sdio_writeb(gInstance->func[func], *byte, regaddr, &err_ret);
  382. sdio_release_host(gInstance->func[func]);
  383. }
  384. #endif /* MMC_SDIO_ABORT */
  385. @@ -1066,13 +1067,11 @@
  386. extern int
  387. sdioh_abort(sdioh_info_t *sd, uint func)
  388. {
  389. - char t_func = (char) func;
  390. -
  391. sd_trace(("%s: Enter\n", __FUNCTION__));
  392.  
  393. #if defined(MMC_SDIO_ABORT)
  394. /* issue abort cmd52 command through F1 */
  395. - sdioh_request_byte(sd, SD_IO_OP_WRITE, SDIO_FUNC_0, SDIOD_CCCR_IOABORT, &t_func);
  396. + sdioh_request_byte(sd, SD_IO_OP_WRITE, SDIO_FUNC_0, SDIOD_CCCR_IOABORT, (uint8 *)&func);
  397. #endif /* defined(MMC_SDIO_ABORT) */
  398.  
  399. sd_trace(("%s: Exit\n", __FUNCTION__));
  400. @@ -1260,7 +1259,7 @@
  401. sdio_release_host(gInstance->func[0]);
  402. #else /* defined(OOB_INTR_ONLY) */
  403. #if defined(HW_OOB)
  404. - sdioh_enable_func_intr(2);
  405. + sdioh_enable_func_intr();
  406. #endif
  407. bcmsdh_oob_intr_set(TRUE);
  408. #endif /* !defined(OOB_INTR_ONLY) */
  409. @@ -1289,7 +1288,7 @@
  410. sdio_release_host(gInstance->func[0]);
  411. #else /* defined(OOB_INTR_ONLY) */
  412. #if defined(HW_OOB)
  413. - sdioh_disable_func_intr(2);
  414. + sdioh_disable_func_intr();
  415. #endif
  416. bcmsdh_oob_intr_set(FALSE);
  417. #endif /* !defined(OOB_INTR_ONLY) */
  418. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/bcmsdh_sdmmc_linux.c /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/bcmsdh_sdmmc_linux.c
  419. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/bcmsdh_sdmmc_linux.c 2010-04-06 22:12:45.000000000 +0200
  420. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/bcmsdh_sdmmc_linux.c 2010-04-07 00:34:09.000000000 +0200
  421. @@ -1,7 +1,7 @@
  422. /*
  423. * BCMSDH Function Driver for the native SDIO/MMC driver in the Linux Kernel
  424. *
  425. - * Copyright (C) 1999-2009, Broadcom Corporation
  426. + * Copyright (C) 1999-2010, Broadcom Corporation
  427. *
  428. * Unless you and Broadcom execute a separate written software license
  429. * agreement governing use of this software, this software is licensed to you
  430. @@ -21,7 +21,7 @@
  431. * software in any way with any other Broadcom software provided under a license
  432. * other than the GPL, without Broadcom's express prior written consent.
  433. *
  434. - * $Id: bcmsdh_sdmmc_linux.c,v 1.1.2.5.6.10 2009/10/14 04:32:13 Exp $
  435. + * $Id: bcmsdh_sdmmc_linux.c,v 1.1.2.5.6.13 2010/04/01 03:53:52 Exp $
  436. */
  437.  
  438. #include <typedefs.h>
  439. @@ -51,7 +51,6 @@
  440.  
  441. #include <dhd_dbg.h>
  442.  
  443. -
  444. extern void sdioh_sdmmc_devintr_off(sdioh_info_t *sd);
  445. extern void sdioh_sdmmc_devintr_on(sdioh_info_t *sd);
  446.  
  447. @@ -76,11 +75,11 @@
  448. extern int bcmsdh_remove(struct device *dev);
  449. struct device sdmmc_dev;
  450.  
  451. -
  452. static int bcmsdh_sdmmc_probe(struct sdio_func *func,
  453. const struct sdio_device_id *id)
  454. {
  455. int ret = 0;
  456. + static struct sdio_func sdio_func_0;
  457. sd_trace(("bcmsdh_sdmmc: %s Enter\n", __FUNCTION__));
  458. sd_trace(("sdio_bcmsdh: func->class=%x\n", func->class));
  459. sd_trace(("sdio_vendor: 0x%04x\n", func->vendor));
  460. @@ -88,8 +87,9 @@
  461. sd_trace(("Function#: 0x%04x\n", func->num));
  462.  
  463. if (func->num == 1) {
  464. - /* Keep a copy of F1's 'func' in F0, just in case... */
  465. - gInstance->func[0] = func;
  466. + sdio_func_0.num = 0;
  467. + sdio_func_0.card = func->card;
  468. + gInstance->func[0] = &sdio_func_0;
  469. if(func->device == 0x4) { /* 4318 */
  470. gInstance->func[2] = NULL;
  471. sd_trace(("NIC found, calling bcmsdh_probe...\n"));
  472. @@ -121,7 +121,6 @@
  473. }
  474. }
  475.  
  476. -
  477. /* devices we support, null terminated */
  478. static const struct sdio_device_id bcmsdh_sdmmc_ids[] = {
  479. { SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4325) },
  480. @@ -169,13 +168,6 @@
  481. sdos = (struct sdos_info *)sd->sdos_info;
  482. MFREE(sd->osh, sdos, sizeof(struct sdos_info));
  483. }
  484. -#if defined(OOB_INTR_ONLY)
  485. -int
  486. -sdioh_mmc_irq(int irq)
  487. -{
  488. - return (MSM_GPIO_TO_INT(irq));
  489. -}
  490. -#endif /* defined(OOB_INTR_ONLY) */
  491.  
  492. /* Interrupt enable/disable */
  493. SDIOH_API_RC
  494. Binärdateien /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/bcmsdh_sdmmc_linux.o and /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/bcmsdh_sdmmc_linux.o sind verschieden.
  495. Binärdateien /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/bcmsdh_sdmmc.o and /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/bcmsdh_sdmmc.o sind verschieden.
  496. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/.bcmsdh_sdmmc.o.cmd /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/.bcmsdh_sdmmc.o.cmd
  497. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/.bcmsdh_sdmmc.o.cmd 2010-04-07 00:19:28.000000000 +0200
  498. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/.bcmsdh_sdmmc.o.cmd 2010-04-07 00:49:55.000000000 +0200
  499. @@ -521,12 +521,15 @@
  500. include/linux/mmc/sdio_ids.h \
  501. drivers/net/wireless/bcm4329/dngl_stats.h \
  502. drivers/net/wireless/bcm4329/dhd.h \
  503. + $(wildcard include/config/has/wakelock.h) \
  504. include/linux/etherdevice.h \
  505. include/linux/ethtool.h \
  506. /media/Development/android/linux-msm/arch/arm/include/asm/unaligned.h \
  507. include/linux/unaligned/le_byteshift.h \
  508. include/linux/unaligned/be_byteshift.h \
  509. include/linux/unaligned/generic.h \
  510. + include/linux/wakelock.h \
  511. + $(wildcard include/config/wakelock/stat.h) \
  512. drivers/net/wireless/bcm4329/include/wlioctl.h \
  513. $(wildcard include/config/item.h) \
  514. drivers/net/wireless/bcm4329/include/proto/ethernet.h \
  515. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/bcmsdspi.c /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/bcmsdspi.c
  516. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/bcmsdspi.c 2010-04-06 22:12:45.000000000 +0200
  517. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/bcmsdspi.c 2010-04-07 00:34:09.000000000 +0200
  518. @@ -1,7 +1,7 @@
  519. /*
  520. * Broadcom BCMSDH to SPI Protocol Conversion Layer
  521. *
  522. - * Copyright (C) 1999-2009, Broadcom Corporation
  523. + * Copyright (C) 1999-2010, Broadcom Corporation
  524. *
  525. * Unless you and Broadcom execute a separate written software license
  526. * agreement governing use of this software, this software is licensed to you
  527. @@ -21,7 +21,7 @@
  528. * software in any way with any other Broadcom software provided under a license
  529. * other than the GPL, without Broadcom's express prior written consent.
  530. *
  531. - * $Id: bcmsdspi.c,v 1.14.4.2.4.4.6.4 2009/04/13 19:18:36 Exp $
  532. + * $Id: bcmsdspi.c,v 1.14.4.2.4.4.6.5 2010/03/10 03:09:48 Exp $
  533. */
  534.  
  535. #include <typedefs.h>
  536. @@ -57,6 +57,7 @@
  537. uint sd_power = 1; /* Default to SD Slot powered ON */
  538. uint sd_clock = 1; /* Default to SD Clock turned ON */
  539. uint sd_crc = 0; /* Default to SPI CRC Check turned OFF */
  540. +uint sd_pci_slot = 0xFFFFffff; /* Used to force selection of a particular PCI slot */
  541.  
  542. uint sd_toctl = 7;
  543.  
  544. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/bcmsdspi_linux.c /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/bcmsdspi_linux.c
  545. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/bcmsdspi_linux.c 2010-04-06 22:12:45.000000000 +0200
  546. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/bcmsdspi_linux.c 2010-04-07 00:34:09.000000000 +0200
  547. @@ -1,7 +1,7 @@
  548. /*
  549. * Broadcom SPI Host Controller Driver - Linux Per-port
  550. *
  551. - * Copyright (C) 1999-2009, Broadcom Corporation
  552. + * Copyright (C) 1999-2010, Broadcom Corporation
  553. *
  554. * Unless you and Broadcom execute a separate written software license
  555. * agreement governing use of this software, this software is licensed to you
  556. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/bcmsdstd.c /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/bcmsdstd.c
  557. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/bcmsdstd.c 2010-04-06 22:12:45.000000000 +0200
  558. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/bcmsdstd.c 2010-04-07 00:34:09.000000000 +0200
  559. @@ -1,7 +1,7 @@
  560. /*
  561. * 'Standard' SDIO HOST CONTROLLER driver
  562. *
  563. - * Copyright (C) 1999-2009, Broadcom Corporation
  564. + * Copyright (C) 1999-2010, Broadcom Corporation
  565. *
  566. * Unless you and Broadcom execute a separate written software license
  567. * agreement governing use of this software, this software is licensed to you
  568. @@ -21,7 +21,7 @@
  569. * software in any way with any other Broadcom software provided under a license
  570. * other than the GPL, without Broadcom's express prior written consent.
  571. *
  572. - * $Id: bcmsdstd.c,v 1.64.4.1.4.4.2.14 2009/10/08 20:05:30 Exp $
  573. + * $Id: bcmsdstd.c,v 1.64.4.1.4.4.2.17 2010/03/10 03:09:48 Exp $
  574. */
  575.  
  576. #include <typedefs.h>
  577. @@ -38,7 +38,8 @@
  578. #include <pcicfg.h>
  579.  
  580.  
  581. -#define SD_PAGE 4096
  582. +#define SD_PAGE_BITS 12
  583. +#define SD_PAGE (1 << SD_PAGE_BITS)
  584.  
  585. #include <bcmsdstd.h>
  586.  
  587. @@ -58,16 +59,21 @@
  588.  
  589. uint sd_power = 1; /* Default to SD Slot powered ON */
  590. uint sd_clock = 1; /* Default to SD Clock turned ON */
  591. +uint sd_pci_slot = 0xFFFFffff; /* Used to force selection of a particular PCI slot */
  592. +uint8 sd_dma_mode = DMA_MODE_SDMA; /* Default to SDMA for now */
  593.  
  594. uint sd_toctl = 7;
  595.  
  596. static bool trap_errs = FALSE;
  597.  
  598. +static const char *dma_mode_description[] = { "PIO", "SDMA", "ADMA1", "32b ADMA2", "64b ADMA2" };
  599. +
  600. /* Prototypes */
  601. static bool sdstd_start_clock(sdioh_info_t *sd, uint16 divisor);
  602. static bool sdstd_start_power(sdioh_info_t *sd);
  603. static bool sdstd_bus_width(sdioh_info_t *sd, int width);
  604. static int sdstd_set_highspeed_mode(sdioh_info_t *sd, bool HSMode);
  605. +static int sdstd_set_dma_mode(sdioh_info_t *sd, int8 dma_mode);
  606. static int sdstd_card_enablefuncs(sdioh_info_t *sd);
  607. static void sdstd_cmd_getrsp(sdioh_info_t *sd, uint32 *rsp_buffer, int count);
  608. static int sdstd_cmd_issue(sdioh_info_t *sd, bool use_dma, uint32 cmd, uint32 arg);
  609. @@ -84,6 +90,14 @@
  610. static int set_client_block_size(sdioh_info_t *sd, int func, int blocksize);
  611. static void sd_map_dma(sdioh_info_t * sd);
  612. static void sd_unmap_dma(sdioh_info_t * sd);
  613. +static void sd_clear_adma_dscr_buf(sdioh_info_t *sd);
  614. +static void sd_fill_dma_data_buf(sdioh_info_t *sd, uint8 data);
  615. +static void sd_create_adma_descriptor(sdioh_info_t *sd,
  616. + uint32 index, uint32 addr_phys,
  617. + uint16 length, uint16 flags);
  618. +static void sd_dump_adma_dscr(sdioh_info_t *sd);
  619. +static void sdstd_dumpregs(sdioh_info_t *sd);
  620. +
  621.  
  622. /*
  623. * Private register access routines.
  624. @@ -205,15 +219,10 @@
  625. /* Set defaults */
  626. sd->sd_blockmode = TRUE;
  627. sd->use_client_ints = TRUE;
  628. - sd->sd_use_dma = TRUE;
  629. + sd->sd_dma_mode = sd_dma_mode;
  630.  
  631. if (!sd->sd_blockmode)
  632. - sd->sd_use_dma = 0;
  633. -
  634. - if (sd->sd_use_dma) {
  635. - OSL_DMADDRWIDTH(osh, 32);
  636. - sd_map_dma(sd);
  637. - }
  638. + sd->sd_dma_mode = DMA_MODE_NONE;
  639.  
  640. if (sdstd_driver_init(sd) != SUCCESS) {
  641. /* If host CPU was reset without resetting SD bus or
  642. @@ -234,6 +243,11 @@
  643. }
  644. }
  645.  
  646. + OSL_DMADDRWIDTH(osh, 32);
  647. +
  648. + /* Always map DMA buffers, so we can switch between DMA modes. */
  649. + sd_map_dma(sd);
  650. +
  651. if (sdstd_register_irq(sd, irq) != SUCCESS) {
  652. sd_err(("%s: sdstd_register_irq() failed for irq = %d\n", __FUNCTION__, irq));
  653. sdstd_free_irq(sd->irq, sd);
  654. @@ -344,7 +358,7 @@
  655. {"sd_msglevel", IOV_MSGLEVEL, 0, IOVT_UINT32, 0 },
  656. {"sd_blockmode", IOV_BLOCKMODE, 0, IOVT_BOOL, 0 },
  657. {"sd_blocksize", IOV_BLOCKSIZE, 0, IOVT_UINT32, 0 }, /* ((fn << 16) | size) */
  658. - {"sd_dma", IOV_DMA, 0, IOVT_BOOL, 0 },
  659. + {"sd_dma", IOV_DMA, 0, IOVT_UINT32, 0 },
  660. #ifdef BCMSDYIELD
  661. {"sd_yieldcpu", IOV_YIELDCPU, 0, IOVT_BOOL, 0 },
  662. {"sd_minyield", IOV_MINYIELD, 0, IOVT_UINT32, 0 },
  663. @@ -429,7 +443,7 @@
  664. si->sd_blockmode = (bool)int_val;
  665. /* Haven't figured out how to make non-block mode with DMA */
  666. if (!si->sd_blockmode)
  667. - si->sd_use_dma = 0;
  668. + si->sd_dma_mode = DMA_MODE_NONE;
  669. break;
  670.  
  671. #ifdef BCMSDYIELD
  672. @@ -503,12 +517,13 @@
  673. }
  674.  
  675. case IOV_GVAL(IOV_DMA):
  676. - int_val = (int32)si->sd_use_dma;
  677. + int_val = (int32)si->sd_dma_mode;
  678. bcopy(&int_val, arg, val_size);
  679. break;
  680.  
  681. case IOV_SVAL(IOV_DMA):
  682. - si->sd_use_dma = (bool)int_val;
  683. + si->sd_dma_mode = (char)int_val;
  684. + sdstd_set_dma_mode(si, si->sd_dma_mode);
  685. break;
  686.  
  687. case IOV_GVAL(IOV_USEINTS):
  688. @@ -764,7 +779,7 @@
  689. cmd_arg = SFIELD(cmd_arg, CMD52_RAW, 0);
  690. cmd_arg = SFIELD(cmd_arg, CMD52_DATA, rw == SDIOH_READ ? 0 : *byte);
  691.  
  692. - if ((status = sdstd_cmd_issue(sd, sd->sd_use_dma, SDIOH_CMD_52, cmd_arg)) != SUCCESS) {
  693. + if ((status = sdstd_cmd_issue(sd, USE_DMA(sd), SDIOH_CMD_52, cmd_arg)) != SUCCESS) {
  694. sdstd_unlock(sd);
  695. return status;
  696. }
  697. @@ -821,6 +836,7 @@
  698. bool fifo = (fix_inc == SDIOH_DATA_FIX);
  699. uint8 *localbuf = NULL, *tmpbuf = NULL;
  700. uint tmplen = 0;
  701. + bool local_blockmode = sd->sd_blockmode;
  702.  
  703. sdstd_lock(sd);
  704.  
  705. @@ -838,7 +854,7 @@
  706. * Both: leftovers are handled last (will be sent via bytemode).
  707. */
  708. while (buflen > 0) {
  709. - if (sd->sd_blockmode) {
  710. + if (local_blockmode) {
  711. /* Max xfer is Page size */
  712. len = MIN(SD_PAGE, buflen);
  713.  
  714. @@ -870,7 +886,7 @@
  715. return SDIOH_API_RC_FAIL;
  716. }
  717.  
  718. - if (sd->sd_blockmode) {
  719. + if (local_blockmode) {
  720. if ((func == SDIO_FUNC_1) && ((tmplen % 4) == 3) && (rw == SDIOH_WRITE)) {
  721. if (localbuf)
  722. MFREE(sd->osh, localbuf, len);
  723. @@ -952,6 +968,11 @@
  724. if (GFIELD(plain_intstatus, INTSTAT_CMD_COMPLETE)) {
  725. sd_err(("SDSTD_ABORT: CMD COMPLETE SET BEFORE COMMAND GIVEN!!!\n"));
  726. }
  727. + if (GFIELD(plain_intstatus, INTSTAT_CARD_REMOVAL)) {
  728. + sd_err(("SDSTD_ABORT: INTSTAT_CARD_REMOVAL\n"));
  729. + err = BCME_NODEVICE;
  730. + goto done;
  731. + }
  732. }
  733.  
  734. /* Issue the command */
  735. @@ -1060,6 +1081,9 @@
  736. }
  737.  
  738. done:
  739. + if (err == BCME_NODEVICE)
  740. + return err;
  741. +
  742. sdstd_wreg8(sd, SD_SoftwareReset,
  743. SFIELD(SFIELD(0, SW_RESET_DAT, 1), SW_RESET_CMD, 1));
  744.  
  745. @@ -1200,6 +1224,7 @@
  746.  
  747. /* A reset should reset bus back to 1 bit mode */
  748. sd->sd_mode = SDIOH_MODE_SD1;
  749. + sdstd_set_dma_mode(sd, sd->sd_dma_mode);
  750. }
  751. sdstd_unlock(sd);
  752. return TRUE;
  753. @@ -1324,7 +1349,8 @@
  754. num_slots = 1;
  755. first_bar = 0;
  756.  
  757. - sd->sd_blockmode = FALSE;
  758. + /* Controller supports ADMA2, so turn it on here. */
  759. + sd->sd_dma_mode = DMA_MODE_ADMA2;
  760. }
  761.  
  762. /* Map in each slot on the board and query it to see if a
  763. @@ -1401,22 +1427,17 @@
  764. sd->caps = sdstd_rreg(sd, SD_Capabilities); /* Cache this for later use */
  765. sd->curr_caps = sdstd_rreg(sd, SD_MaxCurCap);
  766.  
  767. - if (!GFIELD(sd->caps, CAP_DMA)) {
  768. - sd_err(("SD HOST CAPS: No SDMA Support! Disabling DMA\n"));
  769. - sd->sd_use_dma = FALSE;
  770. - sd->sd_blockmode = FALSE;
  771. - }
  772. + sdstd_set_dma_mode(sd, sd->sd_dma_mode);
  773.  
  774.  
  775. sdstd_reset(sd, 1, 0);
  776.  
  777. /* Read SD4/SD1 mode */
  778. if ((reg8 = sdstd_rreg8(sd, SD_HostCntrl))) {
  779. - if (reg8 & SD4_MODE)
  780. + if (reg8 & SD4_MODE) {
  781. sd_err(("%s: Host cntrlr already in 4 bit mode: 0x%x\n",
  782. __FUNCTION__, reg8));
  783. - else
  784. - sd_err(("%s: Error! reg 0x28 should be 0 = 0x%x\n", __FUNCTION__, reg8));
  785. + }
  786. }
  787.  
  788. /* Default power on mode is SD1 */
  789. @@ -1440,7 +1461,7 @@
  790. retries = CMD5_RETRIES;
  791. do {
  792. *cmd_rsp = 0;
  793. - if ((status = sdstd_cmd_issue(sd, sd->sd_use_dma, SDIOH_CMD_5, *cmd_arg))
  794. + if ((status = sdstd_cmd_issue(sd, USE_DMA(sd), SDIOH_CMD_5, *cmd_arg))
  795. != SUCCESS) {
  796. sd_err(("%s: CMD5 failed\n", __FUNCTION__));
  797. return status;
  798. @@ -1496,7 +1517,7 @@
  799. /* In SPI mode, issue CMD0 first */
  800. if (sd->sd_mode == SDIOH_MODE_SPI) {
  801. cmd_arg = 0;
  802. - if ((status = sdstd_cmd_issue(sd, sd->sd_use_dma, SDIOH_CMD_0, cmd_arg))
  803. + if ((status = sdstd_cmd_issue(sd, USE_DMA(sd), SDIOH_CMD_0, cmd_arg))
  804. != SUCCESS) {
  805. sd_err(("BCMSDIOH: cardinit: CMD0 failed!\n"));
  806. return status;
  807. @@ -1508,7 +1529,7 @@
  808.  
  809. /* Card is operational. Ask it to send an RCA */
  810. cmd_arg = 0;
  811. - if ((status = sdstd_cmd_issue(sd, sd->sd_use_dma, SDIOH_CMD_3, cmd_arg))
  812. + if ((status = sdstd_cmd_issue(sd, USE_DMA(sd), SDIOH_CMD_3, cmd_arg))
  813. != SUCCESS) {
  814. sd_err(("%s: CMD3 failed!\n", __FUNCTION__));
  815. return status;
  816. @@ -1534,7 +1555,7 @@
  817.  
  818. /* Select the card */
  819. cmd_arg = SFIELD(0, CMD7_RCA, sd->card_rca);
  820. - if ((status = sdstd_cmd_issue(sd, sd->sd_use_dma, SDIOH_CMD_7, cmd_arg))
  821. + if ((status = sdstd_cmd_issue(sd, USE_DMA(sd), SDIOH_CMD_7, cmd_arg))
  822. != SUCCESS) {
  823. sd_err(("%s: CMD7 failed!\n", __FUNCTION__));
  824. return status;
  825. @@ -1656,6 +1677,86 @@
  826. return BCME_OK;
  827. }
  828.  
  829. +/* Select DMA Mode:
  830. + * If dma_mode == DMA_MODE_AUTO, pick the "best" mode.
  831. + * Otherwise, pick the selected mode if supported.
  832. + * If not supported, use PIO mode.
  833. + */
  834. +static int
  835. +sdstd_set_dma_mode(sdioh_info_t *sd, int8 dma_mode)
  836. +{
  837. + uint8 reg8, dma_sel_bits = SDIOH_SDMA_MODE;
  838. + int8 prev_dma_mode = sd->sd_dma_mode;
  839. +
  840. + switch (prev_dma_mode) {
  841. + case DMA_MODE_AUTO:
  842. + sd_dma(("%s: Selecting best DMA mode supported by controller.\n",
  843. + __FUNCTION__));
  844. + if (GFIELD(sd->caps, CAP_ADMA2)) {
  845. + sd->sd_dma_mode = DMA_MODE_ADMA2;
  846. + dma_sel_bits = SDIOH_ADMA2_MODE;
  847. + } else if (GFIELD(sd->caps, CAP_ADMA1)) {
  848. + sd->sd_dma_mode = DMA_MODE_ADMA1;
  849. + dma_sel_bits = SDIOH_ADMA1_MODE;
  850. + } else if (GFIELD(sd->caps, CAP_DMA)) {
  851. + sd->sd_dma_mode = DMA_MODE_SDMA;
  852. + } else {
  853. + sd->sd_dma_mode = DMA_MODE_NONE;
  854. + }
  855. + break;
  856. + case DMA_MODE_NONE:
  857. + sd->sd_dma_mode = DMA_MODE_NONE;
  858. + break;
  859. + case DMA_MODE_SDMA:
  860. + if (GFIELD(sd->caps, CAP_DMA)) {
  861. + sd->sd_dma_mode = DMA_MODE_SDMA;
  862. + } else {
  863. + sd_err(("%s: SDMA not supported by controller.\n", __FUNCTION__));
  864. + sd->sd_dma_mode = DMA_MODE_NONE;
  865. + }
  866. + break;
  867. + case DMA_MODE_ADMA1:
  868. + if (GFIELD(sd->caps, CAP_ADMA1)) {
  869. + sd->sd_dma_mode = DMA_MODE_ADMA1;
  870. + dma_sel_bits = SDIOH_ADMA1_MODE;
  871. + } else {
  872. + sd_err(("%s: ADMA1 not supported by controller.\n", __FUNCTION__));
  873. + sd->sd_dma_mode = DMA_MODE_NONE;
  874. + }
  875. + break;
  876. + case DMA_MODE_ADMA2:
  877. + if (GFIELD(sd->caps, CAP_ADMA2)) {
  878. + sd->sd_dma_mode = DMA_MODE_ADMA2;
  879. + dma_sel_bits = SDIOH_ADMA2_MODE;
  880. + } else {
  881. + sd_err(("%s: ADMA2 not supported by controller.\n", __FUNCTION__));
  882. + sd->sd_dma_mode = DMA_MODE_NONE;
  883. + }
  884. + break;
  885. + case DMA_MODE_ADMA2_64:
  886. + sd_err(("%s: 64b ADMA2 not supported by driver.\n", __FUNCTION__));
  887. + sd->sd_dma_mode = DMA_MODE_NONE;
  888. + break;
  889. + default:
  890. + sd_err(("%s: Unsupported DMA Mode %d requested.\n", __FUNCTION__,
  891. + prev_dma_mode));
  892. + sd->sd_dma_mode = DMA_MODE_NONE;
  893. + break;
  894. + }
  895. +
  896. + /* clear SysAddr, only used for SDMA */
  897. + sdstd_wreg(sd, SD_SysAddr, 0);
  898. +
  899. + sd_err(("%s: %s mode selected.\n", __FUNCTION__, dma_mode_description[sd->sd_dma_mode]));
  900. +
  901. + reg8 = sdstd_rreg8(sd, SD_HostCntrl);
  902. + reg8 = SFIELD(reg8, HOST_DMA_SEL, dma_sel_bits);
  903. + sdstd_wreg8(sd, SD_HostCntrl, reg8);
  904. + sd_dma(("%s: SD_HostCntrl=0x%02x\n", __FUNCTION__, reg8));
  905. +
  906. + return BCME_OK;
  907. +}
  908. +
  909.  
  910. bool
  911. sdstd_start_clock(sdioh_info_t *sd, uint16 new_sd_divisor)
  912. @@ -1942,7 +2043,7 @@
  913. cmd_arg = SFIELD(cmd_arg, CMD52_RAW, 0);
  914. cmd_arg = SFIELD(cmd_arg, CMD52_DATA, 0);
  915.  
  916. - if ((status = sdstd_cmd_issue(sd, sd->sd_use_dma, SDIOH_CMD_52, cmd_arg))
  917. + if ((status = sdstd_cmd_issue(sd, USE_DMA(sd), SDIOH_CMD_52, cmd_arg))
  918. != SUCCESS)
  919. return status;
  920.  
  921. @@ -1973,7 +2074,7 @@
  922. /* sdstd_cmd_issue() returns with the command complete bit
  923. * in the ISR already cleared
  924. */
  925. - if ((status = sdstd_cmd_issue(sd, sd->sd_use_dma, SDIOH_CMD_53, cmd_arg))
  926. + if ((status = sdstd_cmd_issue(sd, USE_DMA(sd), SDIOH_CMD_53, cmd_arg))
  927. != SUCCESS)
  928. return status;
  929.  
  930. @@ -2115,7 +2216,7 @@
  931. cmd_arg = SFIELD(cmd_arg, CMD52_RW_FLAG, SDIOH_XFER_TYPE_WRITE);
  932. cmd_arg = SFIELD(cmd_arg, CMD52_RAW, 0);
  933. cmd_arg = SFIELD(cmd_arg, CMD52_DATA, data & 0xff);
  934. - if ((status = sdstd_cmd_issue(sd, sd->sd_use_dma, SDIOH_CMD_52, cmd_arg))
  935. + if ((status = sdstd_cmd_issue(sd, USE_DMA(sd), SDIOH_CMD_52, cmd_arg))
  936. != SUCCESS)
  937. return status;
  938.  
  939. @@ -2138,7 +2239,7 @@
  940. /* sdstd_cmd_issue() returns with the command complete bit
  941. * in the ISR already cleared
  942. */
  943. - if ((status = sdstd_cmd_issue(sd, sd->sd_use_dma, SDIOH_CMD_53, cmd_arg))
  944. + if ((status = sdstd_cmd_issue(sd, USE_DMA(sd), SDIOH_CMD_53, cmd_arg))
  945. != SUCCESS)
  946. return status;
  947.  
  948. @@ -2338,7 +2439,7 @@
  949. cmd_reg = SFIELD(cmd_reg, CMD_TYPE, CMD_TYPE_NORMAL);
  950. cmd_reg = SFIELD(cmd_reg, CMD_INDEX, cmd);
  951.  
  952. - use_dma = sdioh_info->sd_use_dma && GFIELD(cmd_arg, CMD53_BLK_MODE);
  953. + use_dma = USE_DMA(sdioh_info) && GFIELD(cmd_arg, CMD53_BLK_MODE);
  954.  
  955. if (GFIELD(cmd_arg, CMD53_BLK_MODE)) {
  956. uint16 blocksize;
  957. @@ -2347,22 +2448,46 @@
  958.  
  959. ASSERT(sdioh_info->sd_blockmode);
  960.  
  961. + func = GFIELD(cmd_arg, CMD53_FUNCTION);
  962. + blocksize = MIN((int)sdioh_info->data_xfer_count,
  963. + sdioh_info->client_block_size[func]);
  964. + blockcount = GFIELD(cmd_arg, CMD53_BYTE_BLK_CNT);
  965. +
  966. /* data_xfer_cnt is already setup so that for multiblock mode,
  967. * it is the entire buffer length. For non-block or single block,
  968. * it is < 64 bytes
  969. */
  970. if (use_dma) {
  971. - sd_info(("%s: Previous SysAddr reg was 0x%x now 0x%x\n",
  972. - __FUNCTION__, sdstd_rreg(sdioh_info, SD_SysAddr),
  973. - (uint32)sdioh_info->dma_phys));
  974. + switch (sdioh_info->sd_dma_mode) {
  975. + case DMA_MODE_SDMA:
  976. + sd_dma(("%s: SDMA: SysAddr reg was 0x%x now 0x%x\n",
  977. + __FUNCTION__, sdstd_rreg(sdioh_info, SD_SysAddr),
  978. + (uint32)sdioh_info->dma_phys));
  979. sdstd_wreg(sdioh_info, SD_SysAddr, sdioh_info->dma_phys);
  980. + break;
  981. + case DMA_MODE_ADMA1:
  982. + case DMA_MODE_ADMA2:
  983. + sd_dma(("%s: ADMA: Using ADMA\n", __FUNCTION__));
  984. + sd_create_adma_descriptor(sdioh_info, 0,
  985. + sdioh_info->dma_phys, blockcount*blocksize,
  986. + ADMA2_ATTRIBUTE_VALID | ADMA2_ATTRIBUTE_END |
  987. + ADMA2_ATTRIBUTE_INT | ADMA2_ATTRIBUTE_ACT_TRAN);
  988. + /* Dump descriptor if DMA debugging is enabled. */
  989. + if (sd_msglevel & SDH_DMA_VAL) {
  990. + sd_dump_adma_dscr(sdioh_info);
  991. + }
  992. +
  993. + sdstd_wreg(sdioh_info, SD_ADMA_SysAddr,
  994. + sdioh_info->adma2_dscr_phys);
  995. + break;
  996. + default:
  997. + sd_err(("%s: unsupported DMA mode %d.\n",
  998. + __FUNCTION__, sdioh_info->sd_dma_mode));
  999. + break;
  1000. + }
  1001. }
  1002. - func = GFIELD(cmd_arg, CMD53_FUNCTION);
  1003. - blocksize = MIN((int)sdioh_info->data_xfer_count,
  1004. - sdioh_info->client_block_size[func]);
  1005. - blockcount = GFIELD(cmd_arg, CMD53_BYTE_BLK_CNT);
  1006.  
  1007. - sd_trace(("%s: Writing Block count %d, block size %d bytes\n",
  1008. + sd_trace(("%s: Setting block count %d, block size %d bytes\n",
  1009. __FUNCTION__, blockcount, blocksize));
  1010. sdstd_wreg16(sdioh_info, SD_BlockSize, blocksize);
  1011. sdstd_wreg16(sdioh_info, SD_BlockCount, blockcount);
  1012. @@ -2464,6 +2589,7 @@
  1013. if (sdioh_info->polled_mode) {
  1014. uint16 int_reg = 0;
  1015. int retries = RETRIES_LARGE;
  1016. +
  1017. do {
  1018. int_reg = sdstd_rreg16(sdioh_info, SD_IntrStatus);
  1019. } while (--retries &&
  1020. @@ -2532,7 +2658,7 @@
  1021. if (read) sd->r_cnt++; else sd->t_cnt++;
  1022.  
  1023. local_blockmode = sd->sd_blockmode;
  1024. - local_dma = sd->sd_use_dma;
  1025. + local_dma = USE_DMA(sd);
  1026.  
  1027. /* Don't bother with block mode on small xfers */
  1028. if (nbytes < sd->client_block_size[func]) {
  1029. @@ -2635,6 +2761,7 @@
  1030. __FUNCTION__, read ? "Read" : "Write", int_reg,
  1031. sdstd_rreg16(sd, SD_ErrorIntrStatus),
  1032. sdstd_rreg(sd, SD_PresentState)));
  1033. + sdstd_dumpregs(sd);
  1034. sdstd_check_errs(sd, SDIOH_CMD_53, cmd_arg);
  1035. return (ERROR);
  1036. }
  1037. @@ -2723,6 +2850,7 @@
  1038. sdstd_rreg(sd, SD_PresentState), int_reg,
  1039. sdstd_rreg16(sd, SD_ErrorIntrStatus), nbytes,
  1040. sd->r_cnt, sd->t_cnt));
  1041. + sdstd_dumpregs(sd);
  1042. return ERROR;
  1043. }
  1044.  
  1045. @@ -2793,18 +2921,210 @@
  1046. static void
  1047. sd_map_dma(sdioh_info_t * sd)
  1048. {
  1049. - if (sd->sd_use_dma == FALSE)
  1050. - return;
  1051. - if ((sd->dma_buf = DMA_ALLOC_CONSISTENT(sd->osh, SD_PAGE, &sd->dma_phys,
  1052. - 0x12, 12)) == NULL) {
  1053. +
  1054. + void *va;
  1055. +
  1056. + if ((va = DMA_ALLOC_CONSISTENT(sd->osh, SD_PAGE,
  1057. + &sd->dma_start_phys, 0x12, 12)) == NULL) {
  1058. + sd->sd_dma_mode = DMA_MODE_NONE;
  1059. + sd->dma_start_buf = 0;
  1060. + sd->dma_buf = (void *)0;
  1061. + sd->dma_phys = 0;
  1062. + sd->alloced_dma_size = SD_PAGE;
  1063. sd_err(("%s: DMA_ALLOC failed. Disabling DMA support.\n", __FUNCTION__));
  1064. - sd->sd_use_dma = FALSE;
  1065. + } else {
  1066. + sd->dma_start_buf = va;
  1067. + sd->dma_buf = (void *)ROUNDUP((uintptr)va, SD_PAGE);
  1068. + sd->dma_phys = ROUNDUP((sd->dma_start_phys), SD_PAGE);
  1069. + sd->alloced_dma_size = SD_PAGE;
  1070. + sd_err(("%s: Mapped DMA Buffer %dbytes @virt/phys: %p/0x%lx\n",
  1071. + __FUNCTION__, sd->alloced_dma_size, sd->dma_buf, sd->dma_phys));
  1072. + sd_fill_dma_data_buf(sd, 0xA5);
  1073. + }
  1074. +
  1075. + if ((va = DMA_ALLOC_CONSISTENT(sd->osh, SD_PAGE,
  1076. + &sd->adma2_dscr_start_phys, 0x12, 12)) == NULL) {
  1077. + sd->sd_dma_mode = DMA_MODE_NONE;
  1078. + sd->adma2_dscr_start_buf = 0;
  1079. + sd->adma2_dscr_buf = (void *)0;
  1080. + sd->adma2_dscr_phys = 0;
  1081. + sd->alloced_adma2_dscr_size = 0;
  1082. + sd_err(("%s: DMA_ALLOC failed for descriptor buffer. "
  1083. + "Disabling DMA support.\n", __FUNCTION__));
  1084. + } else {
  1085. + sd->adma2_dscr_start_buf = va;
  1086. + sd->adma2_dscr_buf = (void *)ROUNDUP((uintptr)va, SD_PAGE);
  1087. + sd->adma2_dscr_phys = ROUNDUP((sd->adma2_dscr_start_phys), SD_PAGE);
  1088. + sd->alloced_adma2_dscr_size = SD_PAGE;
  1089. }
  1090. +
  1091. + sd_err(("%s: Mapped ADMA2 Descriptor Buffer %dbytes @virt/phys: %p/0x%lx\n",
  1092. + __FUNCTION__, sd->alloced_adma2_dscr_size, sd->adma2_dscr_buf,
  1093. + sd->adma2_dscr_phys));
  1094. + sd_clear_adma_dscr_buf(sd);
  1095. }
  1096. +
  1097. static void
  1098. sd_unmap_dma(sdioh_info_t * sd)
  1099. {
  1100. - if (sd->sd_use_dma == FALSE)
  1101. - return;
  1102. - DMA_FREE_CONSISTENT(sd->osh, sd->dma_buf, SD_PAGE, sd->dma_phys, 0x12);
  1103. + if (sd->dma_start_buf) {
  1104. + DMA_FREE_CONSISTENT(sd->osh, sd->dma_start_buf, sd->alloced_dma_size,
  1105. + sd->dma_start_phys, 0x12);
  1106. + }
  1107. +
  1108. + if (sd->adma2_dscr_start_buf) {
  1109. + DMA_FREE_CONSISTENT(sd->osh, sd->adma2_dscr_start_buf, sd->alloced_adma2_dscr_size,
  1110. + sd->adma2_dscr_start_phys, 0x12);
  1111. + }
  1112. +}
  1113. +
  1114. +static void sd_clear_adma_dscr_buf(sdioh_info_t *sd)
  1115. +{
  1116. + bzero((char *)sd->adma2_dscr_buf, SD_PAGE);
  1117. + sd_dump_adma_dscr(sd);
  1118. +}
  1119. +
  1120. +static void sd_fill_dma_data_buf(sdioh_info_t *sd, uint8 data)
  1121. +{
  1122. + memset((char *)sd->dma_buf, data, SD_PAGE);
  1123. +}
  1124. +
  1125. +
  1126. +static void sd_create_adma_descriptor(sdioh_info_t *sd, uint32 index,
  1127. + uint32 addr_phys, uint16 length, uint16 flags)
  1128. +{
  1129. + adma2_dscr_32b_t *adma2_dscr_table;
  1130. + adma1_dscr_t *adma1_dscr_table;
  1131. +
  1132. + adma2_dscr_table = sd->adma2_dscr_buf;
  1133. + adma1_dscr_table = sd->adma2_dscr_buf;
  1134. +
  1135. + switch (sd->sd_dma_mode) {
  1136. + case DMA_MODE_ADMA2:
  1137. + sd_dma(("%s: creating ADMA2 descriptor for index %d\n",
  1138. + __FUNCTION__, index));
  1139. +
  1140. + adma2_dscr_table[index].phys_addr = addr_phys;
  1141. + adma2_dscr_table[index].len_attr = length << 16;
  1142. + adma2_dscr_table[index].len_attr |= flags;
  1143. + break;
  1144. + case DMA_MODE_ADMA1:
  1145. + /* ADMA1 requires two descriptors, one for len
  1146. + * and the other for data transfer
  1147. + */
  1148. + index <<= 1;
  1149. +
  1150. + sd_dma(("%s: creating ADMA1 descriptor for index %d\n",
  1151. + __FUNCTION__, index));
  1152. +
  1153. + adma1_dscr_table[index].phys_addr_attr = length << 12;
  1154. + adma1_dscr_table[index].phys_addr_attr |= (ADMA1_ATTRIBUTE_ACT_SET |
  1155. + ADMA2_ATTRIBUTE_VALID);
  1156. + adma1_dscr_table[index+1].phys_addr_attr = addr_phys & 0xFFFFF000;
  1157. + adma1_dscr_table[index+1].phys_addr_attr |= (flags & 0x3f);
  1158. + break;
  1159. + default:
  1160. + sd_err(("%s: cannot create ADMA descriptor for DMA mode %d\n",
  1161. + __FUNCTION__, sd->sd_dma_mode));
  1162. + break;
  1163. + }
  1164. +}
  1165. +
  1166. +
  1167. +static void sd_dump_adma_dscr(sdioh_info_t *sd)
  1168. +{
  1169. + adma2_dscr_32b_t *adma2_dscr_table;
  1170. + adma1_dscr_t *adma1_dscr_table;
  1171. + uint32 i = 0;
  1172. + uint16 flags;
  1173. + char flags_str[32];
  1174. +
  1175. + ASSERT(sd->adma2_dscr_buf != NULL);
  1176. +
  1177. + adma2_dscr_table = sd->adma2_dscr_buf;
  1178. + adma1_dscr_table = sd->adma2_dscr_buf;
  1179. +
  1180. + switch (sd->sd_dma_mode) {
  1181. + case DMA_MODE_ADMA2:
  1182. + sd_err(("ADMA2 Descriptor Table (%dbytes) @virt/phys: %p/0x%lx\n",
  1183. + SD_PAGE, sd->adma2_dscr_buf, sd->adma2_dscr_phys));
  1184. + sd_err((" #[Descr VA ] Buffer PA | Len | Flags (5:4 2 1 0)"
  1185. + " |\n"));
  1186. + while (adma2_dscr_table->len_attr & ADMA2_ATTRIBUTE_VALID) {
  1187. + flags = adma2_dscr_table->len_attr & 0xFFFF;
  1188. + sprintf(flags_str, "%s%s%s%s",
  1189. + ((flags & ADMA2_ATTRIBUTE_ACT_LINK) ==
  1190. + ADMA2_ATTRIBUTE_ACT_LINK) ? "LINK " :
  1191. + ((flags & ADMA2_ATTRIBUTE_ACT_LINK) ==
  1192. + ADMA2_ATTRIBUTE_ACT_TRAN) ? "TRAN " :
  1193. + ((flags & ADMA2_ATTRIBUTE_ACT_LINK) ==
  1194. + ADMA2_ATTRIBUTE_ACT_NOP) ? "NOP " : "RSV ",
  1195. + (flags & ADMA2_ATTRIBUTE_INT ? "INT " : " "),
  1196. + (flags & ADMA2_ATTRIBUTE_END ? "END " : " "),
  1197. + (flags & ADMA2_ATTRIBUTE_VALID ? "VALID" : ""));
  1198. + sd_err(("%2d[0x%p]: 0x%08x | 0x%04x | 0x%04x (%s) |\n",
  1199. + i, adma2_dscr_table, adma2_dscr_table->phys_addr,
  1200. + adma2_dscr_table->len_attr >> 16, flags, flags_str));
  1201. + i++;
  1202. +
  1203. + /* Follow LINK descriptors or skip to next. */
  1204. + if ((flags & ADMA2_ATTRIBUTE_ACT_LINK) ==
  1205. + ADMA2_ATTRIBUTE_ACT_LINK) {
  1206. + adma2_dscr_table = phys_to_virt(
  1207. + adma2_dscr_table->phys_addr);
  1208. + } else {
  1209. + adma2_dscr_table++;
  1210. + }
  1211. +
  1212. + }
  1213. + break;
  1214. + case DMA_MODE_ADMA1:
  1215. + sd_err(("ADMA1 Descriptor Table (%dbytes) @virt/phys: %p/0x%lx\n",
  1216. + SD_PAGE, sd->adma2_dscr_buf, sd->adma2_dscr_phys));
  1217. + sd_err((" #[Descr VA ] Buffer PA | Flags (5:4 2 1 0) |\n"));
  1218. +
  1219. + for (i = 0; adma1_dscr_table->phys_addr_attr & ADMA2_ATTRIBUTE_VALID; i++) {
  1220. + flags = adma1_dscr_table->phys_addr_attr & 0x3F;
  1221. + sprintf(flags_str, "%s%s%s%s",
  1222. + ((flags & ADMA2_ATTRIBUTE_ACT_LINK) ==
  1223. + ADMA2_ATTRIBUTE_ACT_LINK) ? "LINK " :
  1224. + ((flags & ADMA2_ATTRIBUTE_ACT_LINK) ==
  1225. + ADMA2_ATTRIBUTE_ACT_TRAN) ? "TRAN " :
  1226. + ((flags & ADMA2_ATTRIBUTE_ACT_LINK) ==
  1227. + ADMA2_ATTRIBUTE_ACT_NOP) ? "NOP " : "SET ",
  1228. + (flags & ADMA2_ATTRIBUTE_INT ? "INT " : " "),
  1229. + (flags & ADMA2_ATTRIBUTE_END ? "END " : " "),
  1230. + (flags & ADMA2_ATTRIBUTE_VALID ? "VALID" : ""));
  1231. + sd_err(("%2d[0x%p]: 0x%08x | 0x%04x | (%s) |\n",
  1232. + i, adma1_dscr_table,
  1233. + adma1_dscr_table->phys_addr_attr & 0xFFFFF000,
  1234. + flags, flags_str));
  1235. +
  1236. + /* Follow LINK descriptors or skip to next. */
  1237. + if ((flags & ADMA2_ATTRIBUTE_ACT_LINK) ==
  1238. + ADMA2_ATTRIBUTE_ACT_LINK) {
  1239. + adma1_dscr_table = phys_to_virt(
  1240. + adma1_dscr_table->phys_addr_attr & 0xFFFFF000);
  1241. + } else {
  1242. + adma1_dscr_table++;
  1243. + }
  1244. + }
  1245. + break;
  1246. + default:
  1247. + sd_err(("Unknown DMA Descriptor Table Format.\n"));
  1248. + break;
  1249. + }
  1250. +}
  1251. +
  1252. +static void sdstd_dumpregs(sdioh_info_t *sd)
  1253. +{
  1254. + sd_err(("IntrStatus: 0x%04x ErrorIntrStatus 0x%04x\n",
  1255. + sdstd_rreg16(sd, SD_IntrStatus),
  1256. + sdstd_rreg16(sd, SD_ErrorIntrStatus)));
  1257. + sd_err(("IntrStatusEnable: 0x%04x ErrorIntrStatusEnable 0x%04x\n",
  1258. + sdstd_rreg16(sd, SD_IntrStatusEnable),
  1259. + sdstd_rreg16(sd, SD_ErrorIntrStatusEnable)));
  1260. + sd_err(("IntrSignalEnable: 0x%04x ErrorIntrSignalEnable 0x%04x\n",
  1261. + sdstd_rreg16(sd, SD_IntrSignalEnable),
  1262. + sdstd_rreg16(sd, SD_ErrorIntrSignalEnable)));
  1263. }
  1264. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/bcmsdstd_linux.c /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/bcmsdstd_linux.c
  1265. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/bcmsdstd_linux.c 2010-04-06 22:12:45.000000000 +0200
  1266. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/bcmsdstd_linux.c 2010-04-07 00:34:09.000000000 +0200
  1267. @@ -1,7 +1,7 @@
  1268. /*
  1269. * 'Standard' SDIO HOST CONTROLLER driver - linux portion
  1270. *
  1271. - * Copyright (C) 1999-2009, Broadcom Corporation
  1272. + * Copyright (C) 1999-2010, Broadcom Corporation
  1273. *
  1274. * Unless you and Broadcom execute a separate written software license
  1275. * agreement governing use of this software, this software is licensed to you
  1276. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/bcmutils.c /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/bcmutils.c
  1277. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/bcmutils.c 2010-04-06 22:12:45.000000000 +0200
  1278. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/bcmutils.c 2010-04-07 00:34:09.000000000 +0200
  1279. @@ -1,7 +1,7 @@
  1280. /*
  1281. * Driver O/S-independent utility routines
  1282. *
  1283. - * Copyright (C) 1999-2009, Broadcom Corporation
  1284. + * Copyright (C) 1999-2010, Broadcom Corporation
  1285. *
  1286. * Unless you and Broadcom execute a separate written software license
  1287. * agreement governing use of this software, this software is licensed to you
  1288. @@ -20,7 +20,7 @@
  1289. * Notwithstanding the above, under no circumstances may you combine this
  1290. * software in any way with any other Broadcom software provided under a license
  1291. * other than the GPL, without Broadcom's express prior written consent.
  1292. - * $Id: bcmutils.c,v 1.210.4.5.2.4.6.16 2009/10/28 18:25:42 Exp $
  1293. + * $Id: bcmutils.c,v 1.210.4.5.2.4.6.17 2009/11/17 02:20:12 Exp $
  1294. */
  1295.  
  1296. #include <typedefs.h>
  1297. Binärdateien /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/bcmutils.o and /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/bcmutils.o sind verschieden.
  1298. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/bcmwifi.c /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/bcmwifi.c
  1299. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/bcmwifi.c 2010-04-06 22:12:45.000000000 +0200
  1300. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/bcmwifi.c 2010-04-07 00:34:09.000000000 +0200
  1301. @@ -3,7 +3,7 @@
  1302. * Contents are wifi-specific, used by any kernel or app-level
  1303. * software that might want wifi things as it grows.
  1304. *
  1305. - * Copyright (C) 1999-2009, Broadcom Corporation
  1306. + * Copyright (C) 1999-2010, Broadcom Corporation
  1307. *
  1308. * Unless you and Broadcom execute a separate written software license
  1309. * agreement governing use of this software, this software is licensed to you
  1310. Binärdateien /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/bcmwifi.o and /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/bcmwifi.o sind verschieden.
  1311. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/dhd_bus.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/dhd_bus.h
  1312. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/dhd_bus.h 2010-04-06 22:12:45.000000000 +0200
  1313. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/dhd_bus.h 2010-04-07 00:34:09.000000000 +0200
  1314. @@ -4,7 +4,7 @@
  1315. * Provides type definitions and function prototypes used to link the
  1316. * DHD OS, bus, and protocol modules.
  1317. *
  1318. - * Copyright (C) 1999-2009, Broadcom Corporation
  1319. + * Copyright (C) 1999-2010, Broadcom Corporation
  1320. *
  1321. * Unless you and Broadcom execute a separate written software license
  1322. * agreement governing use of this software, this software is licensed to you
  1323. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/dhd_cdc.c /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/dhd_cdc.c
  1324. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/dhd_cdc.c 2010-04-06 22:12:45.000000000 +0200
  1325. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/dhd_cdc.c 2010-04-07 00:34:09.000000000 +0200
  1326. @@ -1,7 +1,7 @@
  1327. /*
  1328. * DHD Protocol Module for CDC and BDC.
  1329. *
  1330. - * Copyright (C) 1999-2009, Broadcom Corporation
  1331. + * Copyright (C) 1999-2010, Broadcom Corporation
  1332. *
  1333. * Unless you and Broadcom execute a separate written software license
  1334. * agreement governing use of this software, this software is licensed to you
  1335. @@ -21,7 +21,7 @@
  1336. * software in any way with any other Broadcom software provided under a license
  1337. * other than the GPL, without Broadcom's express prior written consent.
  1338. *
  1339. - * $Id: dhd_cdc.c,v 1.22.4.2.4.7.2.30 2009/10/28 21:38:04 Exp $
  1340. + * $Id: dhd_cdc.c,v 1.22.4.2.4.7.2.35 2010/03/26 05:54:12 Exp $
  1341. *
  1342. * BDC is like CDC, except it includes a header for data packets to convey
  1343. * packet priority over the bus, and flags (e.g. to indicate checksum status
  1344. @@ -73,12 +73,9 @@
  1345. {
  1346. dhd_prot_t *prot = dhd->prot;
  1347. int len = ltoh32(prot->msg.len) + sizeof(cdc_ioctl_t);
  1348. - int ret;
  1349.  
  1350. DHD_TRACE(("%s: Enter\n", __FUNCTION__));
  1351.  
  1352. - dhd_os_wake_lock(dhd);
  1353. -
  1354. /* NOTE : cdc->msg.len holds the desired length of the buffer to be
  1355. * returned. Only up to CDC_MAX_MSG_SIZE of this buffer area
  1356. * is actually sent to the dongle
  1357. @@ -87,9 +84,7 @@
  1358. len = CDC_MAX_MSG_SIZE;
  1359.  
  1360. /* Send request */
  1361. - ret = dhd_bus_txctl(dhd->bus, (uchar*)&prot->msg, len);
  1362. - dhd_os_wake_unlock(dhd);
  1363. - return ret;
  1364. + return dhd_bus_txctl(dhd->bus, (uchar*)&prot->msg, len);
  1365. }
  1366.  
  1367. static int
  1368. @@ -141,9 +136,9 @@
  1369.  
  1370. msg->cmd = htol32(cmd);
  1371. msg->len = htol32(len);
  1372. - flags = (++prot->reqid << CDCF_IOC_ID_SHIFT);
  1373. - msg->flags = htol32(flags);
  1374. + msg->flags = (++prot->reqid << CDCF_IOC_ID_SHIFT);
  1375. CDC_SET_IF_IDX(msg, ifidx);
  1376. + msg->flags = htol32(msg->flags);
  1377.  
  1378. if (buf)
  1379. memcpy(prot->buf, buf, len);
  1380. @@ -208,9 +203,9 @@
  1381.  
  1382. msg->cmd = htol32(cmd);
  1383. msg->len = htol32(len);
  1384. - flags = (++prot->reqid << CDCF_IOC_ID_SHIFT) | CDCF_IOC_SET;
  1385. - msg->flags |= htol32(flags);
  1386. + msg->flags = (++prot->reqid << CDCF_IOC_ID_SHIFT) | CDCF_IOC_SET;
  1387. CDC_SET_IF_IDX(msg, ifidx);
  1388. + msg->flags |= htol32(msg->flags);
  1389.  
  1390. if (buf)
  1391. memcpy(prot->buf, buf, len);
  1392. @@ -288,7 +283,6 @@
  1393. ret = 0;
  1394. else {
  1395. cdc_ioctl_t *msg = &prot->msg;
  1396. - CDC_SET_IF_IDX(msg, ifidx);
  1397. ioc->needed = ltoh32(msg->len); /* len == needed when set/query fails from dongle */
  1398. }
  1399.  
  1400. @@ -634,7 +628,7 @@
  1401. if ((ret = dhdcdc_query_ioctl(dhd, 0, WLC_GET_VAR, iovbuf, sizeof(iovbuf))) < 0) {
  1402. DHD_ERROR(("%s: can't get MAC address , error=%d\n", __FUNCTION__, ret));
  1403. dhd_os_proto_unblock(dhd);
  1404. - return -BCME_NOTUP;
  1405. + return BCME_NOTUP;
  1406. }
  1407. memcpy(dhd->mac.octet, iovbuf, ETHER_ADDR_LEN);
  1408.  
  1409. @@ -737,7 +731,7 @@
  1410. (char *) &pkt_filterp->u.pattern.mask_and_pattern[mask_size]));
  1411.  
  1412. if (mask_size != pattern_size) {
  1413. - printk("Mask and pattern not the same size\n");
  1414. + DHD_ERROR(("Mask and pattern not the same size\n"));
  1415. dhd_os_proto_unblock(dhd);
  1416. return -EINVAL;
  1417. }
  1418. @@ -758,8 +752,8 @@
  1419. /* set mode to allow pattern */
  1420. bcm_mkiovar("pkt_filter_mode", (char *)&filter_mode, 4, iovbuf, sizeof(iovbuf));
  1421. dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, sizeof(iovbuf));
  1422. -
  1423. dhd_os_proto_unblock(dhd);
  1424. +
  1425. return 0;
  1426. }
  1427.  
  1428. Binärdateien /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/dhd_cdc.o and /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/dhd_cdc.o sind verschieden.
  1429. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/.dhd_cdc.o.cmd /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/.dhd_cdc.o.cmd
  1430. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/.dhd_cdc.o.cmd 2010-04-07 00:19:28.000000000 +0200
  1431. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/.dhd_cdc.o.cmd 2010-04-07 00:49:54.000000000 +0200
  1432. @@ -515,12 +515,15 @@
  1433. drivers/net/wireless/bcm4329/include/bcmendian.h \
  1434. drivers/net/wireless/bcm4329/dngl_stats.h \
  1435. drivers/net/wireless/bcm4329/dhd.h \
  1436. + $(wildcard include/config/has/wakelock.h) \
  1437. include/linux/etherdevice.h \
  1438. include/linux/ethtool.h \
  1439. /media/Development/android/linux-msm/arch/arm/include/asm/unaligned.h \
  1440. include/linux/unaligned/le_byteshift.h \
  1441. include/linux/unaligned/be_byteshift.h \
  1442. include/linux/unaligned/generic.h \
  1443. + include/linux/wakelock.h \
  1444. + $(wildcard include/config/wakelock/stat.h) \
  1445. drivers/net/wireless/bcm4329/include/wlioctl.h \
  1446. $(wildcard include/config/item.h) \
  1447. drivers/net/wireless/bcm4329/include/proto/bcmeth.h \
  1448. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/dhd_common.c /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/dhd_common.c
  1449. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/dhd_common.c 2010-04-06 22:12:45.000000000 +0200
  1450. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/dhd_common.c 2010-04-07 00:34:09.000000000 +0200
  1451. @@ -1,7 +1,7 @@
  1452. /*
  1453. * Broadcom Dongle Host Driver (DHD), common DHD core.
  1454. *
  1455. - * Copyright (C) 1999-2009, Broadcom Corporation
  1456. + * Copyright (C) 1999-2010, Broadcom Corporation
  1457. *
  1458. * Unless you and Broadcom execute a separate written software license
  1459. * agreement governing use of this software, this software is licensed to you
  1460. @@ -21,7 +21,7 @@
  1461. * software in any way with any other Broadcom software provided under a license
  1462. * other than the GPL, without Broadcom's express prior written consent.
  1463. *
  1464. - * $Id: dhd_common.c,v 1.5.6.8.2.6.6.37 2009/10/22 14:47:18 Exp $
  1465. + * $Id: dhd_common.c,v 1.5.6.8.2.6.6.41 2010/02/24 01:52:41 Exp $
  1466. */
  1467. #include <typedefs.h>
  1468. #include <osl.h>
  1469. @@ -79,7 +79,7 @@
  1470. {"version", IOV_VERSION, 0, IOVT_BUFFER, sizeof(dhd_version) },
  1471. #ifdef DHD_DEBUG
  1472. {"msglevel", IOV_MSGLEVEL, 0, IOVT_UINT32, 0 },
  1473. -#endif
  1474. +#endif /* DHD_DEBUG */
  1475. {"bcmerrorstr", IOV_BCMERRORSTR, 0, IOVT_BUFFER, BCME_STRLEN },
  1476. {"bcmerror", IOV_BCMERROR, 0, IOVT_INT8, 0 },
  1477. {"wdtick", IOV_WDTICK, 0, IOVT_UINT32, 0 },
  1478. @@ -101,16 +101,8 @@
  1479. * first time that the driver is initialized vs subsequent initializations.
  1480. */
  1481. dhd_msg_level = DHD_ERROR_VAL;
  1482. -#ifdef CONFIG_BCM4329_FW_PATH
  1483. - strncpy(fw_path, CONFIG_BCM4329_FW_PATH, MOD_PARAM_PATHLEN-1);
  1484. -#else
  1485. fw_path[0] = '\0';
  1486. -#endif
  1487. -#ifdef CONFIG_BCM4329_NVRAM_PATH
  1488. - strncpy(nv_path, CONFIG_BCM4329_NVRAM_PATH, MOD_PARAM_PATHLEN-1);
  1489. -#else
  1490. nv_path[0] = '\0';
  1491. -#endif
  1492. }
  1493.  
  1494. static int
  1495. @@ -197,6 +189,7 @@
  1496. dhd_msg_level = int_val;
  1497. break;
  1498.  
  1499. +
  1500. case IOV_GVAL(IOV_BCMERRORSTR):
  1501. strncpy((char *)arg, bcmerrorstr(dhd_pub->bcmerror), BCME_STRLEN);
  1502. ((char *)arg)[BCME_STRLEN - 1] = 0x00;
  1503. @@ -553,6 +546,8 @@
  1504. event_name = event_names[i].event_name;
  1505. }
  1506.  
  1507. + DHD_EVENT(("EVENT: %s, event ID = %d\n", event_name, event_type));
  1508. +
  1509. if (flags & WLC_EVENT_MSG_LINK)
  1510. link = TRUE;
  1511. if (flags & WLC_EVENT_MSG_GROUP)
  1512. @@ -891,3 +886,25 @@
  1513. evt->datalen = ntoh32(evt->datalen);
  1514. evt->version = ntoh16(evt->version);
  1515. }
  1516. +
  1517. +void print_buf(void *pbuf, int len, int bytes_per_line)
  1518. +{
  1519. + int i, j = 0;
  1520. + unsigned char *buf = pbuf;
  1521. +
  1522. + if (bytes_per_line == 0) {
  1523. + bytes_per_line = len;
  1524. + }
  1525. +
  1526. + for (i = 0; i < len; i++) {
  1527. + printf("%2.2x", *buf++);
  1528. + j++;
  1529. + if (j == bytes_per_line) {
  1530. + printf("\n");
  1531. + j = 0;
  1532. + } else {
  1533. + printf(":");
  1534. + }
  1535. + }
  1536. + printf("\n");
  1537. +}
  1538. Binärdateien /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/dhd_common.o and /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/dhd_common.o sind verschieden.
  1539. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/.dhd_common.o.cmd /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/.dhd_common.o.cmd
  1540. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/.dhd_common.o.cmd 2010-04-07 00:19:20.000000000 +0200
  1541. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/.dhd_common.o.cmd 2010-04-07 00:49:46.000000000 +0200
  1542. @@ -2,8 +2,6 @@
  1543.  
  1544. deps_drivers/net/wireless/bcm4329/dhd_common.o := \
  1545. drivers/net/wireless/bcm4329/dhd_common.c \
  1546. - $(wildcard include/config/bcm4329/fw/path.h) \
  1547. - $(wildcard include/config/bcm4329/nvram/path.h) \
  1548. drivers/net/wireless/bcm4329/include/typedefs.h \
  1549. include/linux/version.h \
  1550. include/linux/types.h \
  1551. @@ -514,12 +512,15 @@
  1552. drivers/net/wireless/bcm4329/include/bcmendian.h \
  1553. drivers/net/wireless/bcm4329/dngl_stats.h \
  1554. drivers/net/wireless/bcm4329/dhd.h \
  1555. + $(wildcard include/config/has/wakelock.h) \
  1556. include/linux/etherdevice.h \
  1557. include/linux/ethtool.h \
  1558. /media/Development/android/linux-msm/arch/arm/include/asm/unaligned.h \
  1559. include/linux/unaligned/le_byteshift.h \
  1560. include/linux/unaligned/be_byteshift.h \
  1561. include/linux/unaligned/generic.h \
  1562. + include/linux/wakelock.h \
  1563. + $(wildcard include/config/wakelock/stat.h) \
  1564. drivers/net/wireless/bcm4329/include/wlioctl.h \
  1565. $(wildcard include/config/item.h) \
  1566. drivers/net/wireless/bcm4329/include/proto/ethernet.h \
  1567. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/dhd_custom_gpio.c /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/dhd_custom_gpio.c
  1568. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/dhd_custom_gpio.c 2010-04-06 22:12:45.000000000 +0200
  1569. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/dhd_custom_gpio.c 2010-04-07 00:34:09.000000000 +0200
  1570. @@ -1,6 +1,6 @@
  1571. /*
  1572. * Customer code to add GPIO control during WLAN start/stop
  1573. -* Copyright (C) 1999-2009, Broadcom Corporation
  1574. +* Copyright (C) 1999-2010, Broadcom Corporation
  1575. *
  1576. * Unless you and Broadcom execute a separate written software license
  1577. * agreement governing use of this software, this software is licensed to you
  1578. @@ -20,7 +20,7 @@
  1579. * software in any way with any other Broadcom software provided under a license
  1580. * other than the GPL, without Broadcom's express prior written consent.
  1581. *
  1582. -* $Id: dhd_custom_gpio.c,v 1.1.4.3 2009/10/14 04:29:34 Exp $
  1583. +* $Id: dhd_custom_gpio.c,v 1.1.4.6 2010/02/19 22:56:49 Exp $
  1584. */
  1585.  
  1586.  
  1587. @@ -42,11 +42,10 @@
  1588. extern void bcm_wlan_power_off(int);
  1589. extern void bcm_wlan_power_on(int);
  1590. #endif /* CUSTOMER_HW */
  1591. -
  1592. #ifdef CUSTOMER_HW2
  1593. int wifi_set_carddetect(int on);
  1594. -extern int wifi_set_power(int on, unsigned long msec);
  1595. -extern int wifi_get_irq_number(unsigned long *irq_flags_ptr);
  1596. +int wifi_set_power(int on, unsigned long msec);
  1597. +int wifi_get_irq_number(unsigned long *irq_flags_ptr);
  1598. #endif
  1599.  
  1600. #if defined(OOB_INTR_ONLY)
  1601. @@ -55,6 +54,10 @@
  1602. extern int sdioh_mmc_irq(int irq);
  1603. #endif /* (BCMLXSDMMC) */
  1604.  
  1605. +#ifdef CUSTOMER_HW3
  1606. +#include <mach/gpio.h>
  1607. +#endif
  1608. +
  1609. /* Customer specific Host GPIO defintion */
  1610. static int dhd_oob_gpio_num = -1; /* GG 19 */
  1611.  
  1612. @@ -63,10 +66,12 @@
  1613.  
  1614. int dhd_customer_oob_irq_map(unsigned long *irq_flags_ptr)
  1615. {
  1616. - int host_oob_irq;
  1617. -#if defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC)
  1618. + int host_oob_irq = 0;
  1619. +
  1620. +#ifdef CUSTOMER_HW2
  1621. host_oob_irq = wifi_get_irq_number(irq_flags_ptr);
  1622. -#else
  1623. +
  1624. +#else /* for NOT CUSTOMER_HW2 */
  1625. #if defined(CUSTOM_OOB_GPIO_NUM)
  1626. if (dhd_oob_gpio_num < 0) {
  1627. dhd_oob_gpio_num = CUSTOM_OOB_GPIO_NUM;
  1628. @@ -74,17 +79,23 @@
  1629. #endif
  1630. *irq_flags_ptr = IRQF_TRIGGER_FALLING;
  1631. if (dhd_oob_gpio_num < 0) {
  1632. - WL_ERROR(("%s: ERROR customer specific Host GPIO is NOT defined \n", \
  1633. - __FUNCTION__));
  1634. + WL_ERROR(("%s: ERROR customer specific Host GPIO is NOT defined \n",
  1635. + __FUNCTION__));
  1636. return (dhd_oob_gpio_num);
  1637. }
  1638.  
  1639. - WL_ERROR(("%s: customer specific Host GPIO number is (%d)\n", \
  1640. + WL_ERROR(("%s: customer specific Host GPIO number is (%d)\n",
  1641. __FUNCTION__, dhd_oob_gpio_num));
  1642.  
  1643. - /* TODO : move it mmc specific code */
  1644. - host_oob_irq = sdioh_mmc_irq(dhd_oob_gpio_num);
  1645. -#endif
  1646. +#if defined CUSTOMER_HW
  1647. + host_oob_irq = MSM_GPIO_TO_INT(dhd_oob_gpio_num);
  1648. +#elif defined CUSTOMER_HW3
  1649. + gpio_request(dhd_oob_gpio_num, "oob irq");
  1650. + host_oob_irq = gpio_to_irq(dhd_oob_gpio_num);
  1651. + gpio_direction_input(dhd_oob_gpio_num);
  1652. +#endif /* CUSTOMER_HW */
  1653. +#endif /* CUSTOMER_HW2 */
  1654. +
  1655. return (host_oob_irq);
  1656. }
  1657. #endif /* defined(OOB_INTR_ONLY) */
  1658. @@ -100,8 +111,7 @@
  1659. #ifdef CUSTOMER_HW
  1660. bcm_wlan_power_off(2);
  1661. #endif /* CUSTOMER_HW */
  1662. -#if defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC)
  1663. -
  1664. +#ifdef CUSTOMER_HW2
  1665. wifi_set_power(0, 0);
  1666. #endif
  1667. WL_ERROR(("=========== WLAN placed in RESET ========\n"));
  1668. @@ -113,7 +123,7 @@
  1669. #ifdef CUSTOMER_HW
  1670. bcm_wlan_power_on(2);
  1671. #endif /* CUSTOMER_HW */
  1672. -#if defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC)
  1673. +#ifdef CUSTOMER_HW2
  1674. wifi_set_power(1, 0);
  1675. #endif
  1676. WL_ERROR(("=========== WLAN going back to live ========\n"));
  1677. @@ -122,7 +132,7 @@
  1678. case WLAN_POWER_OFF:
  1679. WL_TRACE(("%s: call customer specific GPIO to turn off WL_REG_ON\n",
  1680. __FUNCTION__));
  1681. -#if (defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC)) || defined(CUSTOMER_HW)
  1682. +#ifdef CUSTOMER_HW
  1683. bcm_wlan_power_off(1);
  1684. #endif /* CUSTOMER_HW */
  1685. break;
  1686. @@ -130,7 +140,7 @@
  1687. case WLAN_POWER_ON:
  1688. WL_TRACE(("%s: call customer specific GPIO to turn on WL_REG_ON\n",
  1689. __FUNCTION__));
  1690. -#if (defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC)) || defined(CUSTOMER_HW)
  1691. +#ifdef CUSTOMER_HW
  1692. bcm_wlan_power_on(1);
  1693. #endif /* CUSTOMER_HW */
  1694. /* Lets customer power to get stable */
  1695. Binärdateien /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/dhd_custom_gpio.o and /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/dhd_custom_gpio.o sind verschieden.
  1696. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/.dhd_custom_gpio.o.cmd /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/.dhd_custom_gpio.o.cmd
  1697. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/.dhd_custom_gpio.o.cmd 2010-04-07 00:19:20.000000000 +0200
  1698. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/.dhd_custom_gpio.o.cmd 2010-04-07 00:49:46.000000000 +0200
  1699. @@ -2,7 +2,6 @@
  1700.  
  1701. deps_drivers/net/wireless/bcm4329/dhd_custom_gpio.o := \
  1702. drivers/net/wireless/bcm4329/dhd_custom_gpio.c \
  1703. - $(wildcard include/config/wifi/control/func.h) \
  1704. drivers/net/wireless/bcm4329/include/typedefs.h \
  1705. include/linux/version.h \
  1706. include/linux/types.h \
  1707. @@ -511,12 +510,15 @@
  1708. drivers/net/wireless/bcm4329/include/bcmutils.h \
  1709. drivers/net/wireless/bcm4329/dngl_stats.h \
  1710. drivers/net/wireless/bcm4329/dhd.h \
  1711. + $(wildcard include/config/has/wakelock.h) \
  1712. include/linux/etherdevice.h \
  1713. include/linux/ethtool.h \
  1714. /media/Development/android/linux-msm/arch/arm/include/asm/unaligned.h \
  1715. include/linux/unaligned/le_byteshift.h \
  1716. include/linux/unaligned/be_byteshift.h \
  1717. include/linux/unaligned/generic.h \
  1718. + include/linux/wakelock.h \
  1719. + $(wildcard include/config/wakelock/stat.h) \
  1720. drivers/net/wireless/bcm4329/include/wlioctl.h \
  1721. $(wildcard include/config/item.h) \
  1722. drivers/net/wireless/bcm4329/include/proto/ethernet.h \
  1723. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/dhd_dbg.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/dhd_dbg.h
  1724. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/dhd_dbg.h 2010-04-06 22:12:45.000000000 +0200
  1725. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/dhd_dbg.h 2010-04-07 00:34:09.000000000 +0200
  1726. @@ -1,7 +1,7 @@
  1727. /*
  1728. * Debug/trace/assert driver definitions for Dongle Host Driver.
  1729. *
  1730. - * Copyright (C) 1999-2009, Broadcom Corporation
  1731. + * Copyright (C) 1999-2010, Broadcom Corporation
  1732. *
  1733. * Unless you and Broadcom execute a separate written software license
  1734. * agreement governing use of this software, this software is licensed to you
  1735. @@ -21,7 +21,7 @@
  1736. * software in any way with any other Broadcom software provided under a license
  1737. * other than the GPL, without Broadcom's express prior written consent.
  1738. *
  1739. - * $Id: dhd_dbg.h,v 1.5.6.2.4.2.14.2 2009/05/20 19:41:53 Exp $
  1740. + * $Id: dhd_dbg.h,v 1.5.6.2.4.2.14.6 2010/02/23 05:36:53 Exp $
  1741. */
  1742.  
  1743. #ifndef _dhd_dbg_
  1744. @@ -29,7 +29,8 @@
  1745.  
  1746. #ifdef DHD_DEBUG
  1747.  
  1748. -#define DHD_ERROR(args) do {if (dhd_msg_level & DHD_ERROR_VAL) printf args;} while (0)
  1749. +#define DHD_ERROR(args) do {if ((dhd_msg_level & DHD_ERROR_VAL) && (net_ratelimit())) \
  1750. + printf args;} while (0)
  1751. #define DHD_TRACE(args) do {if (dhd_msg_level & DHD_TRACE_VAL) printf args;} while (0)
  1752. #define DHD_INFO(args) do {if (dhd_msg_level & DHD_INFO_VAL) printf args;} while (0)
  1753. #define DHD_DATA(args) do {if (dhd_msg_level & DHD_DATA_VAL) printf args;} while (0)
  1754. @@ -57,7 +58,7 @@
  1755.  
  1756. #else /* DHD_DEBUG */
  1757.  
  1758. -#define DHD_ERROR(args) printk args
  1759. +#define DHD_ERROR(args) do {if (net_ratelimit()) printf args;} while (0)
  1760. #define DHD_TRACE(args)
  1761. #define DHD_INFO(args)
  1762. #define DHD_DATA(args)
  1763. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/dhd.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/dhd.h
  1764. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/dhd.h 2010-04-06 22:12:45.000000000 +0200
  1765. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/dhd.h 2010-04-07 00:34:09.000000000 +0200
  1766. @@ -4,7 +4,7 @@
  1767. * Provides type definitions and function prototypes used to link the
  1768. * DHD OS, bus, and protocol modules.
  1769. *
  1770. - * Copyright (C) 1999-2009, Broadcom Corporation
  1771. + * Copyright (C) 1999-2010, Broadcom Corporation
  1772. *
  1773. * Unless you and Broadcom execute a separate written software license
  1774. * agreement governing use of this software, this software is licensed to you
  1775. @@ -24,7 +24,7 @@
  1776. * software in any way with any other Broadcom software provided under a license
  1777. * other than the GPL, without Broadcom's express prior written consent.
  1778. *
  1779. - * $Id: dhd.h,v 1.32.4.7.2.4.14.25 2009/10/27 04:41:56 Exp $
  1780. + * $Id: dhd.h,v 1.32.4.7.2.4.14.29 2010/02/23 06:58:21 Exp $
  1781. */
  1782.  
  1783. /****************
  1784. @@ -46,23 +46,21 @@
  1785. #include <linux/ethtool.h>
  1786. #include <asm/uaccess.h>
  1787. #include <asm/unaligned.h>
  1788. -
  1789. +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_HAS_WAKELOCK)
  1790. +#include <linux/wakelock.h>
  1791. +#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined (CONFIG_HAS_WAKELOCK) */
  1792. /* The kernel threading is sdio-specific */
  1793. #else /* LINUX */
  1794. #define ENOMEM 1
  1795. -#define EFAULT 2
  1796. +#define EFAULT 2
  1797. #define EINVAL 3
  1798. -#define EIO 4
  1799. +#define EIO 4
  1800. #define ETIMEDOUT 5
  1801. -#define ERESTARTSYS 6
  1802. +#define ERESTARTSYS 6
  1803. #endif /* LINUX */
  1804.  
  1805. #include <wlioctl.h>
  1806.  
  1807. -#ifdef NDIS60
  1808. -#include <wdf.h>
  1809. -#include <WdfMiniport.h>
  1810. -#endif /* NDIS60 */
  1811.  
  1812. /* Forward decls */
  1813. struct dhd_bus;
  1814. @@ -147,18 +145,11 @@
  1815. int dongle_error;
  1816.  
  1817. uint8 country_code[WLC_CNTRY_BUF_SZ];
  1818. +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_HAS_WAKELOCK)
  1819. + struct wake_lock wakelock[WAKE_LOCK_MAX];
  1820. +#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined (CONFIG_HAS_WAKELOCK) */
  1821. } dhd_pub_t;
  1822.  
  1823. -#ifdef NDIS60
  1824. -
  1825. -typedef struct _wdf_device_info {
  1826. - dhd_pub_t *dhd;
  1827. -} wdf_device_info_t;
  1828. -
  1829. -WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(wdf_device_info_t, dhd_get_wdf_device_info)
  1830. -
  1831. -
  1832. -#endif /* NDIS60 */
  1833.  
  1834. #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_PM_SLEEP)
  1835.  
  1836. @@ -166,7 +157,7 @@
  1837. #define _DHD_PM_RESUME_WAIT(a, b) do {\
  1838. int retry = 0; \
  1839. while (dhd_mmc_suspend && retry++ != b) { \
  1840. - wait_event_interruptible_timeout(a, FALSE, HZ/100); \
  1841. + wait_event_timeout(a, FALSE, HZ/100); \
  1842. } \
  1843. } while (0)
  1844. #define DHD_PM_RESUME_WAIT(a) _DHD_PM_RESUME_WAIT(a, 30)
  1845. @@ -178,7 +169,7 @@
  1846. #define SPINWAIT_SLEEP(a, exp, us) do { \
  1847. uint countdown = (us) + 9; \
  1848. while ((exp) && (countdown >= 10)) { \
  1849. - wait_event_interruptible_timeout(a, FALSE, HZ/100); \
  1850. + wait_event_timeout(a, FALSE, HZ/100); \
  1851. countdown -= 10; \
  1852. } \
  1853. } while (0)
  1854. @@ -203,11 +194,41 @@
  1855. #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_PM_SLEEP) */
  1856. #define DHD_IF_VIF 0x01 /* Virtual IF (Hidden from user) */
  1857.  
  1858. -/* Wakelock Functions */
  1859. -extern int dhd_os_wake_lock(dhd_pub_t *pub);
  1860. -extern int dhd_os_wake_unlock(dhd_pub_t *pub);
  1861. -extern int dhd_os_wake_lock_timeout(dhd_pub_t *pub);
  1862. -extern int dhd_os_wake_lock_timeout_enable(dhd_pub_t *pub);
  1863. +inline static void WAKE_LOCK_INIT(dhd_pub_t * dhdp, int index, char * y)
  1864. +{
  1865. +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_HAS_WAKELOCK)
  1866. + wake_lock_init(&dhdp->wakelock[index], WAKE_LOCK_SUSPEND, y);
  1867. +#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined (CONFIG_HAS_WAKELOCK) */
  1868. +}
  1869. +
  1870. +inline static void WAKE_LOCK(dhd_pub_t * dhdp, int index)
  1871. +{
  1872. +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_HAS_WAKELOCK)
  1873. + wake_lock(&dhdp->wakelock[index]);
  1874. +#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined (CONFIG_HAS_WAKELOCK) */
  1875. +}
  1876. +
  1877. +inline static void WAKE_UNLOCK(dhd_pub_t * dhdp, int index)
  1878. +{
  1879. +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_HAS_WAKELOCK)
  1880. + wake_unlock(&dhdp->wakelock[index]);
  1881. +#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined (CONFIG_HAS_WAKELOCK) */
  1882. +}
  1883. +
  1884. +inline static void WAKE_LOCK_TIMEOUT(dhd_pub_t * dhdp, int index, long time)
  1885. +{
  1886. +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_HAS_WAKELOCK)
  1887. + wake_lock_timeout(&dhdp->wakelock[index], time);
  1888. +#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined (CONFIG_HAS_WAKELOCK) */
  1889. +}
  1890. +
  1891. +inline static void WAKE_LOCK_DESTROY(dhd_pub_t * dhdp, int index)
  1892. +{
  1893. +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_HAS_WAKELOCK)
  1894. + wake_lock_destroy(&dhdp->wakelock[index]);
  1895. +#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined (CONFIG_HAS_WAKELOCK) */
  1896. +}
  1897. +
  1898.  
  1899. typedef struct dhd_if_event {
  1900. uint8 ifidx;
  1901. @@ -275,6 +296,8 @@
  1902. extern void dhd_os_sdlock_sndup_rxq(dhd_pub_t * pub);
  1903. extern void dhd_customer_gpio_wlan_ctrl(int onoff);
  1904. extern void dhd_os_sdunlock_sndup_rxq(dhd_pub_t * pub);
  1905. +extern void dhd_os_sdlock_eventq(dhd_pub_t * pub);
  1906. +extern void dhd_os_sdunlock_eventq(dhd_pub_t * pub);
  1907. #if defined(OOB_INTR_ONLY)
  1908. extern int dhd_customer_oob_irq_map(unsigned long *irq_flags_ptr);
  1909. #endif /* defined(OOB_INTR_ONLY) */
  1910. @@ -321,6 +344,7 @@
  1911. extern uint dhd_bus_status(dhd_pub_t *dhdp);
  1912. extern int dhd_bus_start(dhd_pub_t *dhdp);
  1913.  
  1914. +extern void print_buf(void *pbuf, int len, int bytes_per_line);
  1915.  
  1916.  
  1917. typedef enum cust_gpio_modes {
  1918. @@ -329,6 +353,7 @@
  1919. WLAN_POWER_ON,
  1920. WLAN_POWER_OFF
  1921. } cust_gpio_modes_t;
  1922. +extern int wl_iw_iscan_set_scan_broadcast_prep(struct net_device *dev, uint flag);
  1923. /*
  1924. * Insmod parameters for debug/test
  1925. */
  1926. @@ -337,6 +362,10 @@
  1927. extern uint dhd_watchdog_ms;
  1928.  
  1929.  
  1930. +#if defined(DHD_DEBUG)
  1931. +extern uint wl_msg_level;
  1932. +#endif /* DHD_DEBUG */
  1933. +
  1934. /* Use interrupts */
  1935. extern uint dhd_intr;
  1936.  
  1937. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/dhd_linux.c /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/dhd_linux.c
  1938. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/dhd_linux.c 2010-04-06 22:12:45.000000000 +0200
  1939. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/dhd_linux.c 2010-04-07 00:34:09.000000000 +0200
  1940. @@ -2,7 +2,7 @@
  1941. * Broadcom Dongle Host Driver (DHD), Linux-specific network interface
  1942. * Basically selected code segments from usb-cdc.c and usb-rndis.c
  1943. *
  1944. - * Copyright (C) 1999-2009, Broadcom Corporation
  1945. + * Copyright (C) 1999-2010, Broadcom Corporation
  1946. *
  1947. * Unless you and Broadcom execute a separate written software license
  1948. * agreement governing use of this software, this software is licensed to you
  1949. @@ -22,7 +22,7 @@
  1950. * software in any way with any other Broadcom software provided under a license
  1951. * other than the GPL, without Broadcom's express prior written consent.
  1952. *
  1953. - * $Id: dhd_linux.c,v 1.65.4.9.2.12.2.46 2009/10/28 10:35:11 Exp $
  1954. + * $Id: dhd_linux.c,v 1.65.4.9.2.12.2.66 2010/04/01 17:01:25 Exp $
  1955. */
  1956.  
  1957. #ifdef CONFIG_WIFI_CONTROL_FUNC
  1958. @@ -57,11 +57,8 @@
  1959. #include <dhd_bus.h>
  1960. #include <dhd_proto.h>
  1961. #include <dhd_dbg.h>
  1962. -#include <wl_iw.h>
  1963. -#ifdef CONFIG_HAS_WAKELOCK
  1964. -#include <linux/wakelock.h>
  1965. -#endif
  1966. -#include <linux/freezer.h>
  1967. +
  1968. +
  1969. #if defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC)
  1970. #include <linux/wifi_tiwlan.h>
  1971.  
  1972. @@ -115,13 +112,12 @@
  1973. mdelay(msec);
  1974. return 0;
  1975. }
  1976. -
  1977. static int wifi_probe(struct platform_device *pdev)
  1978. {
  1979. struct wifi_platform_data *wifi_ctrl =
  1980. (struct wifi_platform_data *)(pdev->dev.platform_data);
  1981.  
  1982. - DHD_TRACE(("## %s\n", __FUNCTION__));
  1983. + printk("## %s\n", __FUNCTION__);
  1984. wifi_irqres = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "bcm4329_wlan_irq");
  1985. wifi_control_data = wifi_ctrl;
  1986.  
  1987. @@ -137,7 +133,7 @@
  1988. struct wifi_platform_data *wifi_ctrl =
  1989. (struct wifi_platform_data *)(pdev->dev.platform_data);
  1990.  
  1991. - DHD_TRACE(("## %s\n", __FUNCTION__));
  1992. + printk("## %s\n", __FUNCTION__);
  1993. wifi_control_data = wifi_ctrl;
  1994.  
  1995. wifi_set_carddetect(0); /* CardDetect (1->0) */
  1996. @@ -154,7 +150,7 @@
  1997. static int wifi_resume(struct platform_device *pdev)
  1998. {
  1999. DHD_TRACE(("##> %s\n", __FUNCTION__));
  2000. - return 0;
  2001. + return 0;
  2002. }
  2003.  
  2004. static struct platform_driver wifi_device = {
  2005. @@ -203,9 +199,9 @@
  2006. #endif /* LINUX_VERSION_CODE == KERNEL_VERSION(2, 6, 15) */
  2007.  
  2008. /* Linux wireless extension support */
  2009. -#ifdef CONFIG_WIRELESS_EXT
  2010. +#if defined(CONFIG_WIRELESS_EXT)
  2011. #include <wl_iw.h>
  2012. -#endif /* CONFIG_WIRELESS_EXT */
  2013. +#endif
  2014.  
  2015. #if defined(CONFIG_HAS_EARLYSUSPEND)
  2016. #include <linux/earlysuspend.h>
  2017. @@ -228,9 +224,9 @@
  2018.  
  2019. /* Local private structure (extension of pub) */
  2020. typedef struct dhd_info {
  2021. -#ifdef CONFIG_WIRELESS_EXT
  2022. +#if defined(CONFIG_WIRELESS_EXT)
  2023. wl_iw_t iw; /* wireless extensions state (must be first) */
  2024. -#endif /* CONFIG_WIRELESS_EXT */
  2025. +#endif
  2026.  
  2027. dhd_pub_t pub;
  2028.  
  2029. @@ -254,15 +250,6 @@
  2030. struct semaphore dpc_sem;
  2031. struct completion dpc_exited;
  2032.  
  2033. - /* Wakelocks */
  2034. -#ifdef CONFIG_HAS_WAKELOCK
  2035. - struct wake_lock wl_wifi; /* Wifi wakelock */
  2036. - struct wake_lock wl_rxwake; /* Wifi rx wakelock */
  2037. -#endif
  2038. - spinlock_t wl_lock;
  2039. - int wl_count;
  2040. - int wl_packet;
  2041. -
  2042. /* Thread to issue ioctl for multicast */
  2043. long sysioc_pid;
  2044. struct semaphore sysioc_sem;
  2045. @@ -286,6 +273,7 @@
  2046.  
  2047. #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && 1
  2048. struct semaphore dhd_registration_sem;
  2049. +#define DHD_REGISTRATION_TIMEOUT 8000 /* msec : allowed time to finished dhd registration */
  2050. #endif
  2051. /* load firmware and/or nvram values from the filesystem */
  2052. module_param_string(firmware_path, firmware_path, MOD_PARAM_PATHLEN, 0);
  2053. @@ -315,6 +303,10 @@
  2054. extern int dhd_dongle_memsize;
  2055. module_param(dhd_dongle_memsize, int, 0);
  2056.  
  2057. +/* Network inteface name */
  2058. +char iface_name[IFNAMSIZ];
  2059. +module_param_string(iface_name, iface_name, IFNAMSIZ, 0);
  2060. +
  2061. #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0))
  2062. #define DAEMONIZE(a) daemonize(a); \
  2063. allow_signal(SIGKILL); \
  2064. @@ -391,9 +383,9 @@
  2065. ;
  2066.  
  2067.  
  2068. -#ifdef CONFIG_WIRELESS_EXT
  2069. +#if defined(CONFIG_WIRELESS_EXT)
  2070. struct iw_statistics *dhd_get_wireless_stats(struct net_device *dev);
  2071. -#endif /* CONFIG_WIRELESS_EXT */
  2072. +#endif
  2073.  
  2074. static void dhd_dpc(ulong data);
  2075. /* forward decl */
  2076. @@ -410,7 +402,7 @@
  2077. static int dhd_wl_host_event(dhd_info_t *dhd, int *ifidx, void *pktdata,
  2078. wl_event_msg_t *event_ptr, void **data_ptr);
  2079.  
  2080. -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_PM_SLEEP)
  2081. +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_PM_SLEEP) && 1
  2082. static int dhd_sleep_pm_callback(struct notifier_block *nfb, unsigned long action, void *ignored)
  2083. {
  2084. switch (action)
  2085. @@ -434,6 +426,7 @@
  2086. extern int register_pm_notifier(struct notifier_block *nb);
  2087. extern int unregister_pm_notifier(struct notifier_block *nb);
  2088. #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_PM_SLEEP) */
  2089. + /* && defined(DHD_GPL) */
  2090.  
  2091.  
  2092. #if defined(CONFIG_HAS_EARLYSUSPEND)
  2093. @@ -692,6 +685,7 @@
  2094. wl_ioctl_t ioc;
  2095. int ret;
  2096.  
  2097. + DHD_TRACE(("%s enter\n", __FUNCTION__));
  2098. if (!bcm_mkiovar("cur_etheraddr", (char*)addr, ETHER_ADDR_LEN, buf, 32)) {
  2099. DHD_ERROR(("%s: mkiovar failed for cur_etheraddr\n", dhd_ifname(&dhd->pub, ifidx)));
  2100. return -1;
  2101. @@ -712,11 +706,15 @@
  2102. return ret;
  2103. }
  2104.  
  2105. +#ifdef SOFTAP
  2106. +extern struct net_device *ap_net_dev;
  2107. +#endif
  2108. +
  2109. static void
  2110. dhd_op_if(dhd_if_t *ifp)
  2111. {
  2112. dhd_info_t *dhd;
  2113. - int ret = 0;
  2114. + int ret = 0, err = 0;
  2115.  
  2116. ASSERT(ifp && ifp->info && ifp->idx); /* Virtual interfaces only */
  2117.  
  2118. @@ -731,6 +729,8 @@
  2119. * in case we missed the WLC_E_IF_DEL event.
  2120. */
  2121. if (ifp->net != NULL) {
  2122. + DHD_ERROR(("%s: ERROR: netdev:%s already exists, try free & unregister \n",
  2123. + __FUNCTION__, ifp->net->name));
  2124. netif_stop_queue(ifp->net);
  2125. unregister_netdev(ifp->net);
  2126. free_netdev(ifp->net);
  2127. @@ -743,15 +743,29 @@
  2128. if (ret == 0) {
  2129. strcpy(ifp->net->name, ifp->name);
  2130. memcpy(netdev_priv(ifp->net), &dhd, sizeof(dhd));
  2131. - if (dhd_net_attach(&dhd->pub, ifp->idx) != 0) {
  2132. - DHD_ERROR(("%s: dhd_net_attach failed\n", __FUNCTION__));
  2133. + if ((err = dhd_net_attach(&dhd->pub, ifp->idx)) != 0) {
  2134. + DHD_ERROR(("%s: dhd_net_attach failed, err %d\n",
  2135. + __FUNCTION__, err));
  2136. ret = -EOPNOTSUPP;
  2137. - } else
  2138. + } else {
  2139. +#ifdef SOFTAP
  2140. + /* semaphore that the soft AP CODE waits on */
  2141. + extern struct semaphore ap_eth_sema;
  2142. +
  2143. + /* save ptr to wl0.1 netdev for use in wl_iw.c */
  2144. + ap_net_dev = ifp->net;
  2145. + /* signal to the SOFTAP 'sleeper' thread, wl0.1 is ready */
  2146. + up(&ap_eth_sema);
  2147. +#endif
  2148. + DHD_TRACE(("\n ==== pid:%x, net_device for if:%s created ===\n\n",
  2149. + current->pid, ifp->net->name));
  2150. ifp->state = 0;
  2151. + }
  2152. }
  2153. break;
  2154. case WLC_E_IF_DEL:
  2155. if (ifp->net != NULL) {
  2156. + DHD_TRACE(("\n%s: got 'WLC_E_IF_DEL' state\n", __FUNCTION__));
  2157. netif_stop_queue(ifp->net);
  2158. unregister_netdev(ifp->net);
  2159. ret = DHD_DEL_IF; /* Make sure the free_netdev() is called */
  2160. @@ -764,10 +778,15 @@
  2161. }
  2162.  
  2163. if (ret < 0) {
  2164. - if (ifp->net)
  2165. + if (ifp->net) {
  2166. free_netdev(ifp->net);
  2167. + }
  2168. dhd->iflist[ifp->idx] = NULL;
  2169. MFREE(dhd->pub.osh, ifp, sizeof(*ifp));
  2170. +#ifdef SOFTAP
  2171. + if (ifp->net == ap_net_dev)
  2172. + ap_net_dev = NULL; /* NULL SOFTAP global wl0.1 as well */
  2173. +#endif /* SOFTAP */
  2174. }
  2175. }
  2176.  
  2177. @@ -776,17 +795,41 @@
  2178. {
  2179. dhd_info_t *dhd = (dhd_info_t *)data;
  2180. int i;
  2181. -
  2182. - set_freezable();
  2183. +#ifdef SOFTAP
  2184. + bool in_ap = FALSE;
  2185. +#endif
  2186.  
  2187. DAEMONIZE("dhd_sysioc");
  2188.  
  2189. while (down_interruptible(&dhd->sysioc_sem) == 0) {
  2190. - dhd_os_wake_lock(&dhd->pub);
  2191. for (i = 0; i < DHD_MAX_IFS; i++) {
  2192. if (dhd->iflist[i]) {
  2193. +#ifdef SOFTAP
  2194. + in_ap = (ap_net_dev != NULL);
  2195. +#endif /* SOFTAP */
  2196. if (dhd->iflist[i]->state)
  2197. dhd_op_if(dhd->iflist[i]);
  2198. +#ifdef SOFTAP
  2199. + if (dhd->iflist[i] == NULL) {
  2200. + DHD_TRACE(("\n\n %s: interface %d just been removed,"
  2201. + "!\n\n", __FUNCTION__, i));
  2202. + continue;
  2203. + }
  2204. +
  2205. + if (in_ap && dhd->set_macaddress) {
  2206. + DHD_TRACE(("attempt to set MAC for %s in AP Mode,"
  2207. + "blocked. \n", dhd->iflist[i]->net->name));
  2208. + dhd->set_macaddress = FALSE;
  2209. + continue;
  2210. + }
  2211. +
  2212. + if (in_ap && dhd->set_multicast) {
  2213. + DHD_TRACE(("attempt to set MULTICAST list for %s"
  2214. + "in AP Mode, blocked. \n", dhd->iflist[i]->net->name));
  2215. + dhd->set_multicast = FALSE;
  2216. + continue;
  2217. + }
  2218. +#endif /* SOFTAP */
  2219. if (dhd->set_multicast) {
  2220. dhd->set_multicast = FALSE;
  2221. _dhd_set_multicast_list(dhd, i);
  2222. @@ -797,7 +840,6 @@
  2223. }
  2224. }
  2225. }
  2226. - dhd_os_wake_unlock(&dhd->pub);
  2227. }
  2228. complete_and_exit(&dhd->sysioc_exited, 0);
  2229. }
  2230. @@ -871,6 +913,7 @@
  2231. #ifdef BCMDBUS
  2232. ret = dbus_send_pkt(dhdp->dbus, pktbuf, NULL /* pktinfo */);
  2233. #else
  2234. + WAKE_LOCK_TIMEOUT(dhdp, WAKE_LOCK_TMOUT, 25);
  2235. ret = dhd_bus_txdata(dhdp->bus, pktbuf);
  2236. #endif /* BCMDBUS */
  2237.  
  2238. @@ -889,7 +932,8 @@
  2239.  
  2240. /* Reject if down */
  2241. if (!dhd->pub.up || (dhd->pub.busstate == DHD_BUS_DOWN)) {
  2242. - DHD_ERROR(("%s: xmit rejected due to dhd bus down status \n", __FUNCTION__));
  2243. + DHD_ERROR(("%s: xmit rejected pub.up=%d busstate=%d \n",
  2244. + __FUNCTION__, dhd->pub.up, dhd->pub.busstate));
  2245. netif_stop_queue(net);
  2246. return -ENODEV;
  2247. }
  2248. @@ -897,6 +941,7 @@
  2249. ifidx = dhd_net2idx(dhd, net);
  2250. if (ifidx == DHD_BAD_IF) {
  2251. DHD_ERROR(("%s: bad ifidx %d\n", __FUNCTION__, ifidx));
  2252. + netif_stop_queue(net);
  2253. return -ENODEV;
  2254. }
  2255.  
  2256. @@ -1051,7 +1096,6 @@
  2257. #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) */
  2258. }
  2259. }
  2260. - dhd_os_wake_lock_timeout_enable(dhdp);
  2261. }
  2262.  
  2263. void
  2264. @@ -1118,6 +1162,7 @@
  2265. dhd_watchdog_thread(void *data)
  2266. {
  2267. dhd_info_t *dhd = (dhd_info_t *)data;
  2268. + WAKE_LOCK_INIT(&dhd->pub, WAKE_LOCK_WATCHDOG, "dhd_watchdog_thread");
  2269.  
  2270. /* This thread doesn't need any user-level access,
  2271. * so get rid of all our resources
  2272. @@ -1131,17 +1176,17 @@
  2273. }
  2274. #endif /* DHD_SCHED */
  2275.  
  2276. - set_freezable();
  2277. -
  2278. DAEMONIZE("dhd_watchdog");
  2279.  
  2280. /* Run until signal received */
  2281. while (1) {
  2282. if (down_interruptible (&dhd->watchdog_sem) == 0) {
  2283. - dhd_os_wake_lock(&dhd->pub);
  2284. - /* Call the bus module watchdog */
  2285. - dhd_bus_watchdog(&dhd->pub);
  2286. -
  2287. + if (dhd->pub.dongle_reset == FALSE) {
  2288. + WAKE_LOCK(&dhd->pub, WAKE_LOCK_WATCHDOG);
  2289. + /* Call the bus module watchdog */
  2290. + dhd_bus_watchdog(&dhd->pub);
  2291. + WAKE_UNLOCK(&dhd->pub, WAKE_LOCK_WATCHDOG);
  2292. + }
  2293. /* Count the tick for reference */
  2294. dhd->pub.tickcnt++;
  2295.  
  2296. @@ -1149,12 +1194,12 @@
  2297. if (dhd->wd_timer_valid) {
  2298. mod_timer(&dhd->timer, jiffies + dhd_watchdog_ms * HZ / 1000);
  2299. }
  2300. - dhd_os_wake_unlock(&dhd->pub);
  2301. }
  2302. else
  2303. break;
  2304. }
  2305.  
  2306. + WAKE_LOCK_DESTROY(&dhd->pub, WAKE_LOCK_WATCHDOG);
  2307. complete_and_exit(&dhd->watchdog_exited, 0);
  2308. }
  2309.  
  2310. @@ -1175,12 +1220,8 @@
  2311. dhd->pub.tickcnt++;
  2312.  
  2313. /* Reschedule the watchdog */
  2314. -#if defined(CONTINUOUS_WATCHDOG)
  2315. - mod_timer(&dhd->timer, jiffies + dhd_watchdog_ms * HZ / 1000);
  2316. -#else
  2317. if (dhd->wd_timer_valid)
  2318. mod_timer(&dhd->timer, jiffies + dhd_watchdog_ms * HZ / 1000);
  2319. -#endif /* defined(CONTINUOUS_WATCHDOG) */
  2320. }
  2321.  
  2322. static int
  2323. @@ -1188,6 +1229,7 @@
  2324. {
  2325. dhd_info_t *dhd = (dhd_info_t *)data;
  2326.  
  2327. + WAKE_LOCK_INIT(&dhd->pub, WAKE_LOCK_DPC, "dhd_dpc_thread");
  2328. /* This thread doesn't need any user-level access,
  2329. * so get rid of all our resources
  2330. */
  2331. @@ -1200,8 +1242,6 @@
  2332. }
  2333. #endif /* DHD_SCHED */
  2334.  
  2335. - set_freezable();
  2336. -
  2337. DAEMONIZE("dhd_dpc");
  2338.  
  2339. /* Run until signal received */
  2340. @@ -1209,21 +1249,22 @@
  2341. if (down_interruptible(&dhd->dpc_sem) == 0) {
  2342. /* Call bus dpc unless it indicated down (then clean stop) */
  2343. if (dhd->pub.busstate != DHD_BUS_DOWN) {
  2344. + WAKE_LOCK(&dhd->pub, WAKE_LOCK_DPC);
  2345. if (dhd_bus_dpc(dhd->pub.bus)) {
  2346. up(&dhd->dpc_sem);
  2347. + WAKE_LOCK_TIMEOUT(&dhd->pub, WAKE_LOCK_TMOUT, 25);
  2348. }
  2349. - else {
  2350. - dhd_os_wake_unlock(&dhd->pub);
  2351. - }
  2352. + WAKE_UNLOCK(&dhd->pub, WAKE_LOCK_DPC);
  2353. } else {
  2354. dhd_bus_stop(dhd->pub.bus, TRUE);
  2355. - dhd_os_wake_unlock(&dhd->pub);
  2356. }
  2357. }
  2358. else
  2359. break;
  2360. }
  2361.  
  2362. + WAKE_LOCK_DESTROY(&dhd->pub, WAKE_LOCK_DPC);
  2363. +
  2364. complete_and_exit(&dhd->dpc_exited, 0);
  2365. }
  2366.  
  2367. @@ -1248,7 +1289,6 @@
  2368. {
  2369. dhd_info_t *dhd = (dhd_info_t *)dhdp->info;
  2370.  
  2371. - dhd_os_wake_lock(dhdp);
  2372. if (dhd->dpc_pid >= 0) {
  2373. up(&dhd->dpc_sem);
  2374. return;
  2375. @@ -1473,16 +1513,17 @@
  2376.  
  2377. ifidx = dhd_net2idx(dhd, net);
  2378. DHD_TRACE(("%s: ifidx %d, cmd 0x%04x\n", __FUNCTION__, ifidx, cmd));
  2379. +
  2380. if (ifidx == DHD_BAD_IF)
  2381. return -1;
  2382.  
  2383. -#ifdef CONFIG_WIRELESS_EXT
  2384. +#if defined(CONFIG_WIRELESS_EXT)
  2385. /* linux wireless extensions */
  2386. if ((cmd >= SIOCIWFIRST) && (cmd <= SIOCIWLAST)) {
  2387. /* may recurse, do NOT lock */
  2388. return wl_iw_ioctl(net, ifr, cmd);
  2389. }
  2390. -#endif /* CONFIG_WIRELESS_EXT */
  2391. +#endif
  2392.  
  2393. #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 4, 2)
  2394. if (cmd == SIOCETHTOOL)
  2395. @@ -1542,8 +1583,9 @@
  2396. }
  2397.  
  2398. /* send to dongle (must be up, and wl) */
  2399. - if (!dhd->pub.up || (dhd->pub.busstate != DHD_BUS_DATA)) {
  2400. - DHD_TRACE(("DONGLE_DOWN\n"));
  2401. + if (
  2402. + (dhd->pub.busstate != DHD_BUS_DATA)) {
  2403. + DHD_ERROR(("%s DONGLE_DOWN,__FUNCTION__\n", __FUNCTION__));
  2404. bcmerror = BCME_DONGLE_DOWN;
  2405. goto done;
  2406. }
  2407. @@ -1564,9 +1606,13 @@
  2408. if (is_set_key_cmd) {
  2409. dhd_wait_pend8021x(net);
  2410. }
  2411. + WAKE_LOCK_INIT(&dhd->pub, WAKE_LOCK_IOCTL, "dhd_ioctl_entry");
  2412. + WAKE_LOCK(&dhd->pub, WAKE_LOCK_IOCTL);
  2413.  
  2414. bcmerror = dhd_prot_ioctl(&dhd->pub, ifidx, (wl_ioctl_t *)&ioc, buf, buflen);
  2415.  
  2416. + WAKE_UNLOCK(&dhd->pub, WAKE_LOCK_IOCTL);
  2417. + WAKE_LOCK_DESTROY(&dhd->pub, WAKE_LOCK_IOCTL);
  2418. done:
  2419. if (!bcmerror && buf && ioc.buf) {
  2420. if (copy_to_user(ioc.buf, buf, buflen))
  2421. @@ -1586,7 +1632,6 @@
  2422. dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(net);
  2423.  
  2424. DHD_TRACE(("%s: Enter\n", __FUNCTION__));
  2425. -
  2426. if (dhd->pub.up == 0) {
  2427. return 0;
  2428. }
  2429. @@ -1609,16 +1654,15 @@
  2430. #ifdef TOE
  2431. uint32 toe_ol;
  2432. #endif
  2433. - int ifidx;
  2434. + int ifidx = dhd_net2idx(dhd, net);
  2435.  
  2436. - wl_control_wl_start(net); /* start if needed */
  2437. -
  2438. - ifidx = dhd_net2idx(dhd, net);
  2439. DHD_TRACE(("%s: ifidx %d\n", __FUNCTION__, ifidx));
  2440.  
  2441. - ASSERT(ifidx == 0);
  2442. + /* ASSERT(ifidx == 0); */
  2443.  
  2444. - atomic_set(&dhd->pend_8021x_cnt, 0);
  2445. + if (ifidx == 0) { /* do it only for primary eth0 */
  2446. +
  2447. + atomic_set(&dhd->pend_8021x_cnt, 0);
  2448.  
  2449. memcpy(net->dev_addr, dhd->pub.mac.octet, ETHER_ADDR_LEN);
  2450.  
  2451. @@ -1629,11 +1673,12 @@
  2452. else
  2453. dhd->iflist[ifidx]->net->features &= ~NETIF_F_IP_CSUM;
  2454. #endif
  2455. -
  2456. + }
  2457. /* Allow transmit calls */
  2458. netif_start_queue(net);
  2459. dhd->pub.up = 1;
  2460.  
  2461. +
  2462. OLD_MOD_INC_USE_COUNT;
  2463. return 0;
  2464. }
  2465. @@ -1744,11 +1789,26 @@
  2466. memcpy(netdev_priv(net), &dhd, sizeof(dhd));
  2467. dhd->pub.osh = osh;
  2468.  
  2469. + /* Set network interface name if it was provided as module parameter */
  2470. + if (iface_name[0]) {
  2471. + int len;
  2472. + char ch;
  2473. + strncpy(net->name, iface_name, IFNAMSIZ);
  2474. + net->name[IFNAMSIZ - 1] = 0;
  2475. + len = strlen(net->name);
  2476. + ch = net->name[len - 1];
  2477. + if ((ch > '9' || ch < '0') && (len < IFNAMSIZ - 2))
  2478. + strcat(net->name, "%d");
  2479. + }
  2480. +
  2481. if (dhd_add_if(dhd, 0, (void *)net, net->name, NULL, 0, 0) == DHD_BAD_IF)
  2482. goto fail;
  2483.  
  2484. +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31))
  2485. net->open = NULL;
  2486. -
  2487. +#else
  2488. + net->netdev_ops = NULL;
  2489. +#endif
  2490. init_MUTEX(&dhd->proto_sem);
  2491. /* Initialize other structure content */
  2492. init_waitqueue_head(&dhd->ioctl_resp_wait);
  2493. @@ -1758,15 +1818,6 @@
  2494. spin_lock_init(&dhd->sdlock);
  2495. spin_lock_init(&dhd->txqlock);
  2496.  
  2497. - /* Initialize Wakelock stuff */
  2498. - spin_lock_init(&dhd->wl_lock);
  2499. - dhd->wl_count = 0;
  2500. - dhd->wl_packet = 0;
  2501. -#ifdef CONFIG_HAS_WAKELOCK
  2502. - wake_lock_init(&dhd->wl_wifi, WAKE_LOCK_SUSPEND, "wlan_wake");
  2503. - wake_lock_init(&dhd->wl_rxwake, WAKE_LOCK_SUSPEND, "wlan_rx_wake");
  2504. -#endif
  2505. -
  2506. /* Link to info module */
  2507. dhd->pub.info = dhd;
  2508.  
  2509. @@ -1779,13 +1830,14 @@
  2510. DHD_ERROR(("dhd_prot_attach failed\n"));
  2511. goto fail;
  2512. }
  2513. -#ifdef CONFIG_WIRELESS_EXT
  2514. +#if defined(CONFIG_WIRELESS_EXT)
  2515. /* Attach and link in the iw */
  2516. if (wl_iw_attach(net, (void *)&dhd->pub) != 0) {
  2517. DHD_ERROR(("wl_iw_attach failed\n"));
  2518. goto fail;
  2519. }
  2520. -#endif
  2521. +#endif
  2522. +
  2523.  
  2524. /* Set up the watchdog timer */
  2525. init_timer(&dhd->timer);
  2526. @@ -1837,9 +1889,13 @@
  2527. #if defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC)
  2528. g_bus = bus;
  2529. #endif
  2530. -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_PM_SLEEP)
  2531. +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_PM_SLEEP) && 1
  2532. register_pm_notifier(&dhd_sleep_pm_notifier);
  2533. #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_PM_SLEEP) */
  2534. + /* && defined(DHD_GPL) */
  2535. + /* Init lock suspend to prevent kernel going to suspend */
  2536. + WAKE_LOCK_INIT(&dhd->pub, WAKE_LOCK_TMOUT, "dhd_wake_lock");
  2537. + WAKE_LOCK_INIT(&dhd->pub, WAKE_LOCK_LINK_DOWN_TMOUT, "dhd_wake_lock_link_dw_event");
  2538.  
  2539. #ifdef CONFIG_HAS_EARLYSUSPEND
  2540. dhd->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN + 20;
  2541. @@ -1872,12 +1928,19 @@
  2542.  
  2543. /* try to download image and nvram to the dongle */
  2544. if (dhd->pub.busstate == DHD_BUS_DOWN) {
  2545. + WAKE_LOCK_INIT(dhdp, WAKE_LOCK_DOWNLOAD, "dhd_bus_start");
  2546. + WAKE_LOCK(dhdp, WAKE_LOCK_DOWNLOAD);
  2547. if (!(dhd_bus_download_firmware(dhd->pub.bus, dhd->pub.osh,
  2548. fw_path, nv_path))) {
  2549. DHD_ERROR(("%s: dhdsdio_probe_download failed. firmware = %s nvram = %s\n",
  2550. __FUNCTION__, fw_path, nv_path));
  2551. + WAKE_UNLOCK(dhdp, WAKE_LOCK_DOWNLOAD);
  2552. + WAKE_LOCK_DESTROY(dhdp, WAKE_LOCK_DOWNLOAD);
  2553. return -1;
  2554. }
  2555. +
  2556. + WAKE_UNLOCK(dhdp, WAKE_LOCK_DOWNLOAD);
  2557. + WAKE_LOCK_DESTROY(dhdp, WAKE_LOCK_DOWNLOAD);
  2558. }
  2559.  
  2560. /* Start the watchdog timer */
  2561. @@ -1892,7 +1955,7 @@
  2562. #if defined(OOB_INTR_ONLY)
  2563. /* Host registration for OOB interrupt */
  2564. if (bcmsdh_register_oob_intr(dhdp)) {
  2565. - del_timer_sync(&dhd->timer);
  2566. + del_timer(&dhd->timer);
  2567. dhd->wd_timer_valid = FALSE;
  2568. DHD_ERROR(("%s Host failed to resgister for OOB\n", __FUNCTION__));
  2569. return -ENODEV;
  2570. @@ -1904,7 +1967,7 @@
  2571.  
  2572. /* If bus is not ready, can't come up */
  2573. if (dhd->pub.busstate != DHD_BUS_DATA) {
  2574. - del_timer_sync(&dhd->timer);
  2575. + del_timer(&dhd->timer);
  2576. dhd->wd_timer_valid = FALSE;
  2577. DHD_ERROR(("%s failed bus is not ready\n", __FUNCTION__));
  2578. return -ENODEV;
  2579. @@ -1941,6 +2004,25 @@
  2580. return ret;
  2581. }
  2582.  
  2583. +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31))
  2584. +static struct net_device_ops dhd_ops_pri = {
  2585. + .ndo_open = dhd_open,
  2586. + .ndo_stop = dhd_stop,
  2587. + .ndo_get_stats = dhd_get_stats,
  2588. + .ndo_do_ioctl = dhd_ioctl_entry,
  2589. + .ndo_start_xmit = dhd_start_xmit,
  2590. + .ndo_set_mac_address = dhd_set_mac_address,
  2591. + .ndo_set_multicast_list = dhd_set_multicast_list
  2592. +};
  2593. +
  2594. +static struct net_device_ops dhd_ops_virt = {
  2595. + .ndo_get_stats = dhd_get_stats,
  2596. + .ndo_do_ioctl = dhd_ioctl_entry,
  2597. + .ndo_start_xmit = dhd_start_xmit,
  2598. + .ndo_set_mac_address = dhd_set_mac_address,
  2599. + .ndo_set_multicast_list = dhd_set_multicast_list
  2600. +};
  2601. +#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31)) */
  2602. int
  2603. dhd_net_attach(dhd_pub_t *dhdp, int ifidx)
  2604. {
  2605. @@ -1951,30 +2033,47 @@
  2606. DHD_TRACE(("%s: ifidx %d\n", __FUNCTION__, ifidx));
  2607.  
  2608. ASSERT(dhd && dhd->iflist[ifidx]);
  2609. - ASSERT(dhd->iflist[ifidx]->net);
  2610. - ASSERT(!dhd->iflist[ifidx]->net->open);
  2611.  
  2612. - /* Ok, link into the network layer... */
  2613. net = dhd->iflist[ifidx]->net;
  2614. - if (ifidx == 0) {
  2615. - /*
  2616. - * device functions for the primary interface only
  2617. - */
  2618. - net->open = dhd_open;
  2619. - net->stop = dhd_stop;
  2620. - } else {
  2621. - net->open = net->stop = NULL;
  2622. - /*
  2623. - * We have to use the primary MAC for virtual interfaces
  2624. - */
  2625. - memcpy(temp_addr, dhd->iflist[ifidx]->mac_addr, ETHER_ADDR_LEN);
  2626. - }
  2627. + ASSERT(net);
  2628. +
  2629. +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31))
  2630. + ASSERT(!net->open);
  2631. net->get_stats = dhd_get_stats;
  2632. net->do_ioctl = dhd_ioctl_entry;
  2633. net->hard_start_xmit = dhd_start_xmit;
  2634. - net->hard_header_len = ETH_HLEN + dhd->pub.hdrlen;
  2635. net->set_mac_address = dhd_set_mac_address;
  2636. net->set_multicast_list = dhd_set_multicast_list;
  2637. + net->open = net->stop = NULL;
  2638. +#else
  2639. + ASSERT(!net->netdev_ops);
  2640. + net->netdev_ops = &dhd_ops_virt;
  2641. +#endif
  2642. +
  2643. +
  2644. +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31))
  2645. + net->open = dhd_open;
  2646. + net->stop = dhd_stop;
  2647. +#else
  2648. + net->netdev_ops = &dhd_ops_pri;
  2649. +#endif
  2650. +
  2651. + /*
  2652. + * We have to use the primary MAC for virtual interfaces
  2653. + */
  2654. + if (ifidx != 0) {
  2655. + /* for virtual interfaces use the primary MAC */
  2656. + memcpy(temp_addr, dhd->pub.mac.octet, ETHER_ADDR_LEN);
  2657. +
  2658. + }
  2659. +
  2660. + if (ifidx == 1) {
  2661. + DHD_TRACE(("%s ACCESS POINT MAC: \n", __FUNCTION__));
  2662. + /* ACCESSPOINT INTERFACE CASE */
  2663. + temp_addr[0] |= 0X02; /* set bit 2 , - Locally Administered address */
  2664. +
  2665. + }
  2666. + net->hard_header_len = ETH_HLEN + dhd->pub.hdrlen;
  2667. #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24)
  2668. net->ethtool_ops = &dhd_ethtool_ops;
  2669. #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) */
  2670. @@ -1988,18 +2087,26 @@
  2671. #endif /* WIRELESS_EXT > 12 */
  2672. #endif /* CONFIG_WIRELESS_EXT */
  2673.  
  2674. +
  2675. dhd->pub.rxsz = net->mtu + net->hard_header_len + dhd->pub.hdrlen;
  2676.  
  2677. memcpy(net->dev_addr, temp_addr, ETHER_ADDR_LEN);
  2678.  
  2679. if (register_netdev(net) != 0) {
  2680. - DHD_ERROR(("couldn't register the net device\n"));
  2681. + DHD_ERROR(("%s: couldn't register the net device\n", __FUNCTION__));
  2682. goto fail;
  2683. }
  2684.  
  2685. printf("%s: Broadcom Dongle Host Driver mac=%.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n", net->name,
  2686. dhd->pub.mac.octet[0], dhd->pub.mac.octet[1], dhd->pub.mac.octet[2],
  2687. dhd->pub.mac.octet[3], dhd->pub.mac.octet[4], dhd->pub.mac.octet[5]);
  2688. +#ifdef SOFTAP
  2689. + if (ifidx == 0)
  2690. + /* Don't call for SOFTAP Interface in SOFTAP MODE */
  2691. + wl_iw_iscan_set_scan_broadcast_prep(net, 1);
  2692. +#else
  2693. + wl_iw_iscan_set_scan_broadcast_prep(net, 1);
  2694. +#endif /* SOFTAP */
  2695.  
  2696. #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && 1
  2697. up(&dhd_registration_sem);
  2698. @@ -2007,7 +2114,11 @@
  2699. return 0;
  2700.  
  2701. fail:
  2702. +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31)
  2703. net->open = NULL;
  2704. +#else
  2705. + net->netdev_ops = NULL;
  2706. +#endif
  2707. return BCME_ERROR;
  2708. }
  2709.  
  2710. @@ -2031,7 +2142,7 @@
  2711. #endif /* defined(OOB_INTR_ONLY) */
  2712.  
  2713. /* Clear the watchdog timer */
  2714. - del_timer_sync(&dhd->timer);
  2715. + del_timer(&dhd->timer);
  2716. dhd->wd_timer_valid = FALSE;
  2717. }
  2718. }
  2719. @@ -2053,14 +2164,6 @@
  2720. #if defined(CONFIG_HAS_EARLYSUSPEND)
  2721. unregister_early_suspend(&dhd->early_suspend);
  2722. #endif /* defined(CONFIG_HAS_EARLYSUSPEND) */
  2723. -#ifdef CONFIG_WIRELESS_EXT
  2724. - /* Attach and link in the iw */
  2725. - wl_iw_detach();
  2726. -#endif
  2727. - if (dhd->sysioc_pid >= 0) {
  2728. - KILL_PROC(dhd->sysioc_pid, SIGTERM);
  2729. - wait_for_completion(&dhd->sysioc_exited);
  2730. - }
  2731.  
  2732. for (i = 1; i < DHD_MAX_IFS; i++)
  2733. if (dhd->iflist[i])
  2734. @@ -2068,43 +2171,71 @@
  2735.  
  2736. ifp = dhd->iflist[0];
  2737. ASSERT(ifp);
  2738. +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31))
  2739. if (ifp->net->open) {
  2740. +#else
  2741. + if (ifp->net->netdev_ops == &dhd_ops_pri) {
  2742. +#endif
  2743. dhd_stop(ifp->net);
  2744. unregister_netdev(ifp->net);
  2745. }
  2746.  
  2747. - if (dhd->watchdog_pid >= 0)
  2748. - {
  2749. - KILL_PROC(dhd->watchdog_pid, SIGTERM);
  2750. - wait_for_completion(&dhd->watchdog_exited);
  2751. - }
  2752.  
  2753. - if (dhd->dpc_pid >= 0)
  2754. - {
  2755. - KILL_PROC(dhd->dpc_pid, SIGTERM);
  2756. - wait_for_completion(&dhd->dpc_exited);
  2757. - }
  2758. - else
  2759. - tasklet_kill(&dhd->tasklet);
  2760. + if (dhd->watchdog_pid >= 0)
  2761. + {
  2762. + KILL_PROC(dhd->watchdog_pid, SIGTERM);
  2763. + wait_for_completion(&dhd->watchdog_exited);
  2764. + }
  2765.  
  2766. - dhd_bus_detach(dhdp);
  2767. + if (dhd->dpc_pid >= 0)
  2768. + {
  2769. + KILL_PROC(dhd->dpc_pid, SIGTERM);
  2770. + wait_for_completion(&dhd->dpc_exited);
  2771. + }
  2772. + else
  2773. + tasklet_kill(&dhd->tasklet);
  2774. +
  2775. + if (dhd->sysioc_pid >= 0) {
  2776. + KILL_PROC(dhd->sysioc_pid, SIGTERM);
  2777. + wait_for_completion(&dhd->sysioc_exited);
  2778. + }
  2779.  
  2780. - if (dhdp->prot)
  2781. - dhd_prot_detach(dhdp);
  2782. + dhd_bus_detach(dhdp);
  2783.  
  2784. -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_PM_SLEEP)
  2785. - unregister_pm_notifier(&dhd_sleep_pm_notifier);
  2786. -#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_PM_SLEEP) */
  2787. - free_netdev(ifp->net);
  2788. -#ifdef CONFIG_HAS_WAKELOCK
  2789. - wake_lock_destroy(&dhd->wl_wifi);
  2790. - wake_lock_destroy(&dhd->wl_rxwake);
  2791. + if (dhdp->prot)
  2792. + dhd_prot_detach(dhdp);
  2793. +
  2794. +#if defined(CONFIG_WIRELESS_EXT)
  2795. + /* Attach and link in the iw */
  2796. + wl_iw_detach();
  2797. #endif
  2798. - MFREE(dhd->pub.osh, ifp, sizeof(*ifp));
  2799. - MFREE(dhd->pub.osh, dhd, sizeof(*dhd));
  2800. - }
  2801. +
  2802. +
  2803. +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_PM_SLEEP) && 1
  2804. + unregister_pm_notifier(&dhd_sleep_pm_notifier);
  2805. +#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_PM_SLEEP) */
  2806. + /* && defined(DHD_GPL) */
  2807. + WAKE_LOCK_DESTROY(dhdp, WAKE_LOCK_TMOUT);
  2808. + WAKE_LOCK_DESTROY(dhdp, WAKE_LOCK_LINK_DOWN_TMOUT);
  2809. + free_netdev(ifp->net);
  2810. + MFREE(dhd->pub.osh, ifp, sizeof(*ifp));
  2811. + MFREE(dhd->pub.osh, dhd, sizeof(*dhd));
  2812. }
  2813. }
  2814. +}
  2815. +static void __exit
  2816. +dhd_module_cleanup(void)
  2817. +{
  2818. + DHD_TRACE(("%s: Enter\n", __FUNCTION__));
  2819. +
  2820. + dhd_bus_unregister();
  2821. +#if defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC)
  2822. + wifi_del_dev();
  2823. +#endif
  2824. + /* Call customer gpio to turn off power with WL_REG_ON signal */
  2825. + dhd_customer_gpio_wlan_ctrl(WLAN_POWER_OFF);
  2826. +}
  2827. +
  2828.  
  2829. static int __init
  2830. dhd_module_init(void)
  2831. @@ -2126,7 +2257,6 @@
  2832. DHD_ERROR(("Invalid module parameters.\n"));
  2833. return -EINVAL;
  2834. } while (0);
  2835. -
  2836. /* Call customer gpio to turn on power with WL_REG_ON signal */
  2837. dhd_customer_gpio_wlan_ctrl(WLAN_POWER_ON);
  2838.  
  2839. @@ -2136,18 +2266,19 @@
  2840. error = wifi_add_dev();
  2841. if (error) {
  2842. DHD_ERROR(("%s: platform_driver_register failed\n", __FUNCTION__));
  2843. - goto fail_0;
  2844. + goto faild;
  2845. }
  2846.  
  2847. /* Waiting callback after platform_driver_register is done or exit with error */
  2848. - if (down_timeout(&wifi_control_sem, msecs_to_jiffies(5000)) != 0) {
  2849. - error = -EINVAL;
  2850. - DHD_ERROR(("%s: platform_driver_register timeout\n", __FUNCTION__));
  2851. - goto fail_1;
  2852. + if (down_timeout(&wifi_control_sem, msecs_to_jiffies(1000)) != 0) {
  2853. + printk("%s: platform_driver_register timeout\n", __FUNCTION__);
  2854. + /* renove device */
  2855. + wifi_del_dev();
  2856. + goto faild;
  2857. }
  2858. #endif /* #if defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC) */
  2859.  
  2860. -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
  2861. +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && 1
  2862. sema_init(&dhd_registration_sem, 0);
  2863. #endif
  2864.  
  2865. @@ -2157,51 +2288,28 @@
  2866. printf("\n%s\n", dhd_version);
  2867. else {
  2868. DHD_ERROR(("%s: sdio_register_driver failed\n", __FUNCTION__));
  2869. - goto fail_1;
  2870. + goto faild;
  2871. }
  2872. -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
  2873. +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && 1
  2874. /*
  2875. * Wait till MMC sdio_register_driver callback called and made driver attach.
  2876. * It's needed to make sync up exit from dhd insmod and
  2877. * Kernel MMC sdio device callback registration
  2878. */
  2879. - if (down_timeout(&dhd_registration_sem, msecs_to_jiffies(10000)) != 0) {
  2880. + if (down_timeout(&dhd_registration_sem, msecs_to_jiffies(DHD_REGISTRATION_TIMEOUT)) != 0) {
  2881. error = -EINVAL;
  2882. DHD_ERROR(("%s: sdio_register_driver timeout\n", __FUNCTION__));
  2883. - goto fail_2;
  2884. + dhd_bus_unregister();
  2885. }
  2886. #endif
  2887. return error;
  2888. -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
  2889. -fail_2:
  2890. - dhd_bus_unregister();
  2891. -#endif
  2892. -fail_1:
  2893. -#if defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC)
  2894. - wifi_del_dev();
  2895. -fail_0:
  2896. -#endif /* defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC) */
  2897.  
  2898. - /* Call customer gpio to turn off power with WL_REG_ON signal */
  2899. +faild:
  2900. + /* turn off power and exit */
  2901. dhd_customer_gpio_wlan_ctrl(WLAN_POWER_OFF);
  2902. -
  2903. - return error;
  2904. + return -EINVAL;
  2905. }
  2906.  
  2907. -static void __exit
  2908. -dhd_module_cleanup(void)
  2909. -{
  2910. - DHD_TRACE(("%s: Enter\n", __FUNCTION__));
  2911. -
  2912. - dhd_bus_unregister();
  2913. -#if defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC)
  2914. - wifi_del_dev();
  2915. -#endif
  2916. - /* Call customer gpio to turn off power with WL_REG_ON signal */
  2917. - dhd_customer_gpio_wlan_ctrl(WLAN_POWER_OFF);
  2918. -}
  2919. -
  2920. -
  2921. module_init(dhd_module_init);
  2922. module_exit(dhd_module_cleanup);
  2923.  
  2924. @@ -2217,7 +2325,6 @@
  2925. down(&dhd->proto_sem);
  2926. return 1;
  2927. }
  2928. -
  2929. return 0;
  2930. }
  2931.  
  2932. @@ -2288,36 +2395,38 @@
  2933. dhd_os_wd_timer(void *bus, uint wdtick)
  2934. {
  2935. dhd_pub_t *pub = bus;
  2936. - dhd_info_t *dhd = (dhd_info_t *)pub->info;
  2937. -
  2938. -#if !defined(CONTINUOUS_WATCHDOG)
  2939. static uint save_dhd_watchdog_ms = 0;
  2940. -#endif /* !defined(CONTINUOUS_WATCHDOG) */
  2941. -
  2942. -#if defined(CONTINUOUS_WATCHDOG)
  2943. - dhd_watchdog_ms = (uint)wdtick;
  2944. - mod_timer(&dhd->timer, jiffies + dhd_watchdog_ms * HZ / 1000);
  2945. + dhd_info_t *dhd = (dhd_info_t *)pub->info;
  2946.  
  2947. - dhd->wd_timer_valid = TRUE;
  2948. -#else
  2949. /* Totally stop the timer */
  2950. if (!wdtick && dhd->wd_timer_valid == TRUE) {
  2951. - del_timer_sync(&dhd->timer);
  2952. + del_timer(&dhd->timer);
  2953. dhd->wd_timer_valid = FALSE;
  2954. save_dhd_watchdog_ms = wdtick;
  2955. return;
  2956. }
  2957.  
  2958. if (wdtick) {
  2959. - dhd_watchdog_ms = (uint)wdtick;
  2960. + dhd_watchdog_ms = (uint) wdtick;
  2961. + if (save_dhd_watchdog_ms != dhd_watchdog_ms) {
  2962.  
  2963. - /* Re arm the timer, at last watchdog period */
  2964. - mod_timer(&dhd->timer, jiffies + dhd_watchdog_ms * HZ / 1000);
  2965. + if (dhd->wd_timer_valid == TRUE)
  2966. + /* Stop timer and restart at new value */
  2967. + del_timer(&dhd->timer);
  2968. +
  2969. + /* Create timer again when watchdog period is
  2970. + dynamically changed or in the first instance
  2971. + */
  2972. + dhd->timer.expires = jiffies + dhd_watchdog_ms * HZ / 1000;
  2973. + add_timer(&dhd->timer);
  2974. + } else {
  2975. + /* Re arm the timer, at last watchdog period */
  2976. + mod_timer(&dhd->timer, jiffies + dhd_watchdog_ms * HZ / 1000);
  2977. + }
  2978.  
  2979. dhd->wd_timer_valid = TRUE;
  2980. save_dhd_watchdog_ms = wdtick;
  2981. }
  2982. -#endif /* defined(CONTINUTOUS_WATCHDOG) */
  2983. }
  2984.  
  2985. void *
  2986. @@ -2372,7 +2481,7 @@
  2987. if (dhd->threads_only)
  2988. down(&dhd->sdsem);
  2989. else
  2990. - spin_lock_bh(&dhd->sdlock);
  2991. + spin_lock_bh(&dhd->sdlock);
  2992. }
  2993.  
  2994. void
  2995. @@ -2385,7 +2494,7 @@
  2996. if (dhd->threads_only)
  2997. up(&dhd->sdsem);
  2998. else
  2999. - spin_unlock_bh(&dhd->sdlock);
  3000. + spin_unlock_bh(&dhd->sdlock);
  3001. }
  3002.  
  3003. void
  3004. @@ -2449,7 +2558,7 @@
  3005. #endif /* #if defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC) */
  3006. }
  3007. #endif /* DHD_USE_STATIC_BUF */
  3008. -#ifdef CONFIG_WIRELESS_EXT
  3009. +#if defined(CONFIG_WIRELESS_EXT)
  3010. struct iw_statistics *
  3011. dhd_get_wireless_stats(struct net_device *dev)
  3012. {
  3013. @@ -2463,7 +2572,7 @@
  3014. else
  3015. return NULL;
  3016. }
  3017. -#endif /* CONFIG_WIRELESS_EXT */
  3018. +#endif
  3019.  
  3020. static int
  3021. dhd_wl_host_event(dhd_info_t *dhd, int *ifidx, void *pktdata,
  3022. @@ -2477,11 +2586,12 @@
  3023. if (bcmerror != BCME_OK)
  3024. return (bcmerror);
  3025.  
  3026. -#ifdef CONFIG_WIRELESS_EXT
  3027. +#if defined(CONFIG_WIRELESS_EXT)
  3028. ASSERT(dhd->iflist[*ifidx] != NULL);
  3029.  
  3030. wl_iw_event(dhd->iflist[*ifidx]->net, event, *data);
  3031. -#endif /* CONFIG_WIRELESS_EXT */
  3032. +#endif
  3033. +
  3034.  
  3035. return (bcmerror);
  3036. }
  3037. @@ -2521,16 +2631,15 @@
  3038. {
  3039. dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev);
  3040.  
  3041. - /* Turning off watchdog */
  3042. - if (flag)
  3043. - dhd_os_wd_timer(&dhd->pub, 0);
  3044. + /* Turning off watchdog */
  3045. + if (flag)
  3046. + dhd_os_wd_timer(&dhd->pub, 0);
  3047.  
  3048. dhd_bus_devreset(&dhd->pub, flag);
  3049.  
  3050. - /* Turning on watchdog back */
  3051. - if (!flag)
  3052. - dhd_os_wd_timer(&dhd->pub, dhd_watchdog_ms);
  3053. -
  3054. + /* Turning on watchdog back */
  3055. + if (!flag)
  3056. + dhd_os_wd_timer(&dhd->pub, dhd_watchdog_ms);
  3057. DHD_ERROR(("%s: WLAN OFF DONE\n", __FUNCTION__));
  3058.  
  3059. return 1;
  3060. @@ -2571,120 +2680,3 @@
  3061. }
  3062. return pend;
  3063. }
  3064. -
  3065. -int dhd_os_wake_lock_timeout(dhd_pub_t *pub)
  3066. -{
  3067. - dhd_info_t *dhd = (dhd_info_t *)(pub->info);
  3068. - unsigned long flags;
  3069. - int ret = 0;
  3070. -
  3071. - if (dhd) {
  3072. - spin_lock_irqsave(&dhd->wl_lock, flags);
  3073. - ret = dhd->wl_packet;
  3074. -#ifdef CONFIG_HAS_WAKELOCK
  3075. - if (dhd->wl_packet)
  3076. - wake_lock_timeout(&dhd->wl_rxwake, (HZ >> 1));
  3077. -#endif
  3078. - dhd->wl_packet = 0;
  3079. - spin_unlock_irqrestore(&dhd->wl_lock, flags);
  3080. - }
  3081. - /* printk("%s: %d\n", __FUNCTION__, ret); */
  3082. - return ret;
  3083. -}
  3084. -
  3085. -int net_os_wake_lock_timeout(struct net_device *dev)
  3086. -{
  3087. - dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev);
  3088. - int ret = 0;
  3089. -
  3090. - if (dhd)
  3091. - ret = dhd_os_wake_lock_timeout(&dhd->pub);
  3092. - return ret;
  3093. -}
  3094. -
  3095. -int dhd_os_wake_lock_timeout_enable(dhd_pub_t *pub)
  3096. -{
  3097. - dhd_info_t *dhd = (dhd_info_t *)(pub->info);
  3098. - unsigned long flags;
  3099. -
  3100. - if (dhd) {
  3101. - spin_lock_irqsave(&dhd->wl_lock, flags);
  3102. - dhd->wl_packet = 1;
  3103. - spin_unlock_irqrestore(&dhd->wl_lock, flags);
  3104. - }
  3105. - /* printk("%s\n",__func__); */
  3106. - return 0;
  3107. -}
  3108. -
  3109. -int net_os_wake_lock_timeout_enable(struct net_device *dev)
  3110. -{
  3111. - dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev);
  3112. - int ret = 0;
  3113. -
  3114. - if (dhd)
  3115. - ret = dhd_os_wake_lock_timeout_enable(&dhd->pub);
  3116. - return ret;
  3117. -}
  3118. -
  3119. -int dhd_os_wake_lock(dhd_pub_t *pub)
  3120. -{
  3121. - dhd_info_t *dhd = (dhd_info_t *)(pub->info);
  3122. - unsigned long flags;
  3123. - int ret = 0;
  3124. -
  3125. - if (dhd) {
  3126. - spin_lock_irqsave(&dhd->wl_lock, flags);
  3127. -#ifdef CONFIG_HAS_WAKELOCK
  3128. - if (!dhd->wl_count)
  3129. - wake_lock(&dhd->wl_wifi);
  3130. -#endif
  3131. - dhd->wl_count++;
  3132. - ret = dhd->wl_count;
  3133. - spin_unlock_irqrestore(&dhd->wl_lock, flags);
  3134. - }
  3135. - /* printk("%s: %d\n", __FUNCTION__, ret); */
  3136. - return ret;
  3137. -}
  3138. -
  3139. -int net_os_wake_lock(struct net_device *dev)
  3140. -{
  3141. - dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev);
  3142. - int ret = 0;
  3143. -
  3144. - if (dhd)
  3145. - ret = dhd_os_wake_lock(&dhd->pub);
  3146. - return ret;
  3147. -}
  3148. -
  3149. -int dhd_os_wake_unlock(dhd_pub_t *pub)
  3150. -{
  3151. - dhd_info_t *dhd = (dhd_info_t *)(pub->info);
  3152. - unsigned long flags;
  3153. - int ret = 0;
  3154. -
  3155. - dhd_os_wake_lock_timeout(pub);
  3156. - if (dhd) {
  3157. - spin_lock_irqsave(&dhd->wl_lock, flags);
  3158. - if (dhd->wl_count) {
  3159. - dhd->wl_count--;
  3160. -#ifdef CONFIG_HAS_WAKELOCK
  3161. - if (!dhd->wl_count)
  3162. - wake_unlock(&dhd->wl_wifi);
  3163. -#endif
  3164. - ret = dhd->wl_count;
  3165. - }
  3166. - spin_unlock_irqrestore(&dhd->wl_lock, flags);
  3167. - }
  3168. - /* printk("%s: %d\n", __FUNCTION__, ret); */
  3169. - return ret;
  3170. -}
  3171. -
  3172. -int net_os_wake_unlock(struct net_device *dev)
  3173. -{
  3174. - dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev);
  3175. - int ret = 0;
  3176. -
  3177. - if (dhd)
  3178. - ret = dhd_os_wake_unlock(&dhd->pub);
  3179. - return ret;
  3180. -}
  3181. Binärdateien /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/dhd_linux.o and /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/dhd_linux.o sind verschieden.
  3182. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/.dhd_linux.o.cmd /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/.dhd_linux.o.cmd
  3183. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/.dhd_linux.o.cmd 2010-04-07 00:19:18.000000000 +0200
  3184. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/.dhd_linux.o.cmd 2010-04-07 00:49:44.000000000 +0200
  3185. @@ -3,7 +3,6 @@
  3186. deps_drivers/net/wireless/bcm4329/dhd_linux.o := \
  3187. drivers/net/wireless/bcm4329/dhd_linux.c \
  3188. $(wildcard include/config/wifi/control/func.h) \
  3189. - $(wildcard include/config/has/wakelock.h) \
  3190. $(wildcard include/config/pm/sleep.h) \
  3191. $(wildcard include/config/wireless/ext.h) \
  3192. $(wildcard include/config/has/earlysuspend.h) \
  3193. @@ -546,6 +545,9 @@
  3194. drivers/net/wireless/bcm4329/include/packed_section_end.h \
  3195. drivers/net/wireless/bcm4329/dngl_stats.h \
  3196. drivers/net/wireless/bcm4329/dhd.h \
  3197. + $(wildcard include/config/has/wakelock.h) \
  3198. + include/linux/wakelock.h \
  3199. + $(wildcard include/config/wakelock/stat.h) \
  3200. drivers/net/wireless/bcm4329/include/wlioctl.h \
  3201. $(wildcard include/config/item.h) \
  3202. drivers/net/wireless/bcm4329/include/proto/bcmeth.h \
  3203. @@ -557,12 +559,6 @@
  3204. drivers/net/wireless/bcm4329/dhd_proto.h \
  3205. drivers/net/wireless/bcm4329/include/dhdioctl.h \
  3206. drivers/net/wireless/bcm4329/dhd_dbg.h \
  3207. - drivers/net/wireless/bcm4329/wl_iw.h \
  3208. - include/linux/wireless.h \
  3209. - include/net/iw_handler.h \
  3210. - include/linux/wakelock.h \
  3211. - $(wildcard include/config/wakelock/stat.h) \
  3212. - include/linux/freezer.h \
  3213. include/linux/suspend.h \
  3214. $(wildcard include/config/frv.h) \
  3215. $(wildcard include/config/ppc32.h) \
  3216. @@ -572,6 +568,9 @@
  3217. include/linux/swap.h \
  3218. include/linux/memcontrol.h \
  3219. $(wildcard include/config/cgroup/mem/cont.h) \
  3220. + drivers/net/wireless/bcm4329/wl_iw.h \
  3221. + include/linux/wireless.h \
  3222. + include/net/iw_handler.h \
  3223. include/linux/earlysuspend.h \
  3224.  
  3225. drivers/net/wireless/bcm4329/dhd_linux.o: $(deps_drivers/net/wireless/bcm4329/dhd_linux.o)
  3226. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/dhd_linux_sched.c /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/dhd_linux_sched.c
  3227. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/dhd_linux_sched.c 2010-04-06 22:12:45.000000000 +0200
  3228. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/dhd_linux_sched.c 2010-04-07 00:34:09.000000000 +0200
  3229. @@ -1,7 +1,7 @@
  3230. /*
  3231. * Expose some of the kernel scheduler routines
  3232. *
  3233. - * Copyright (C) 1999-2009, Broadcom Corporation
  3234. + * Copyright (C) 1999-2010, Broadcom Corporation
  3235. *
  3236. * Unless you and Broadcom execute a separate written software license
  3237. * agreement governing use of this software, this software is licensed to you
  3238. Binärdateien /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/dhd_linux_sched.o and /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/dhd_linux_sched.o sind verschieden.
  3239. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/dhd_proto.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/dhd_proto.h
  3240. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/dhd_proto.h 2010-04-06 22:12:45.000000000 +0200
  3241. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/dhd_proto.h 2010-04-07 00:34:09.000000000 +0200
  3242. @@ -4,7 +4,7 @@
  3243. * Provides type definitions and function prototypes used to link the
  3244. * DHD OS, bus, and protocol modules.
  3245. *
  3246. - * Copyright (C) 1999-2009, Broadcom Corporation
  3247. + * Copyright (C) 1999-2010, Broadcom Corporation
  3248. *
  3249. * Unless you and Broadcom execute a separate written software license
  3250. * agreement governing use of this software, this software is licensed to you
  3251. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/dhd_sdio.c /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/dhd_sdio.c
  3252. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/dhd_sdio.c 2010-04-06 22:12:45.000000000 +0200
  3253. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/dhd_sdio.c 2010-04-07 00:34:09.000000000 +0200
  3254. @@ -1,7 +1,7 @@
  3255. /*
  3256. * DHD Bus Module for SDIO
  3257. *
  3258. - * Copyright (C) 1999-2009, Broadcom Corporation
  3259. + * Copyright (C) 1999-2010, Broadcom Corporation
  3260. *
  3261. * Unless you and Broadcom execute a separate written software license
  3262. * agreement governing use of this software, this software is licensed to you
  3263. @@ -21,7 +21,7 @@
  3264. * software in any way with any other Broadcom software provided under a license
  3265. * other than the GPL, without Broadcom's express prior written consent.
  3266. *
  3267. - * $Id: dhd_sdio.c,v 1.157.2.27.2.33.2.89 2009/10/28 05:49:40 Exp $
  3268. + * $Id: dhd_sdio.c,v 1.157.2.27.2.33.2.102 2010/03/30 02:22:02 Exp $
  3269. */
  3270.  
  3271. #include <typedefs.h>
  3272. @@ -293,10 +293,8 @@
  3273. /* Deferred transmit */
  3274. const uint dhd_deferred_tx = 1;
  3275.  
  3276. -#if !defined(CONTINUOUS_WATCHDOG)
  3277. extern uint dhd_watchdog_ms;
  3278. extern void dhd_os_wd_timer(void *bus, uint wdtick);
  3279. -#endif /* !defined(CONTINUOUS_WATCHDOG) */
  3280.  
  3281. /* Tx/Rx bounds */
  3282. uint dhd_txbound;
  3283. @@ -514,9 +512,6 @@
  3284.  
  3285. /* Go to pending and await interrupt if appropriate */
  3286. if (!SBSDIO_CLKAV(clkctl, bus->alp_only) && pendok) {
  3287. - DHD_INFO(("CLKCTL: set PENDING\n"));
  3288. - bus->clkstate = CLK_PENDING;
  3289. -
  3290. /* Allow only clock-available interrupt */
  3291. devctl = bcmsdh_cfg_read(sdh, SDIO_FUNC_1, SBSDIO_DEVICE_CTL, &err);
  3292. if (err) {
  3293. @@ -527,6 +522,8 @@
  3294.  
  3295. devctl |= SBSDIO_DEVCTL_CA_INT_ONLY;
  3296. bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_DEVICE_CTL, devctl, &err);
  3297. + DHD_INFO(("CLKCTL: set PENDING\n"));
  3298. + bus->clkstate = CLK_PENDING;
  3299. return BCME_OK;
  3300. } else if (bus->clkstate == CLK_PENDING) {
  3301. /* Cancel CA-only interrupt filter */
  3302. @@ -692,12 +689,9 @@
  3303.  
  3304. /* Early exit if we're already there */
  3305. if (bus->clkstate == target) {
  3306. - if (target == CLK_AVAIL) {
  3307. -#if !defined(CONTINUOUS_WATCHDOG)
  3308. + if (target == CLK_AVAIL)
  3309. dhd_os_wd_timer(bus->dhd, dhd_watchdog_ms);
  3310. -#endif /* !defined(CONTINUOUS_WATCHDOG) */
  3311. bus->activity = TRUE;
  3312. - }
  3313. return BCME_OK;
  3314. }
  3315.  
  3316. @@ -708,9 +702,7 @@
  3317. dhdsdio_sdclk(bus, TRUE);
  3318. /* Now request HT Avail on the backplane */
  3319. dhdsdio_htclk(bus, TRUE, pendok);
  3320. -#if !defined(CONTINUOUS_WATCHDOG)
  3321. dhd_os_wd_timer(bus->dhd, dhd_watchdog_ms);
  3322. -#endif /* !defined(CONTINUOUS_WATCHDOG) */
  3323. bus->activity = TRUE;
  3324. break;
  3325.  
  3326. @@ -723,9 +715,7 @@
  3327. else
  3328. DHD_ERROR(("dhdsdio_clkctl: request for %d -> %d\n",
  3329. bus->clkstate, target));
  3330. -#if !defined(CONTINUOUS_WATCHDOG)
  3331. dhd_os_wd_timer(bus->dhd, dhd_watchdog_ms);
  3332. -#endif /* !defined(CONTINUOUS_WATCHDOG) */
  3333. break;
  3334.  
  3335. case CLK_NONE:
  3336. @@ -734,9 +724,7 @@
  3337. dhdsdio_htclk(bus, FALSE, FALSE);
  3338. /* Now remove the SD clock */
  3339. dhdsdio_sdclk(bus, FALSE);
  3340. -#if !defined(CONTINUOUS_WATCHDOG)
  3341. dhd_os_wd_timer(bus->dhd, 0);
  3342. -#endif /* !defined(CONTINUOUS_WATCHDOG) */
  3343. break;
  3344. }
  3345. #ifdef DHD_DEBUG
  3346. @@ -858,7 +846,7 @@
  3347.  
  3348. /* Turn off our contribution to the HT clock request */
  3349. dhdsdio_clkctl(bus, CLK_SDONLY, FALSE);
  3350. -#endif /* defined(HW_OOB) */
  3351. +#endif /* !defined(HW_OOB) */
  3352. }
  3353. #endif /* defined(OOB_INTR_ONLY) */
  3354.  
  3355. @@ -1597,11 +1585,6 @@
  3356. uint32 sdaddr;
  3357. uint dsize;
  3358.  
  3359. - if (size % 4) {
  3360. - size += 3;
  3361. - size &= 0xFFFFFFFC;
  3362. - }
  3363. -
  3364. /* Determine initial transfer parameters */
  3365. sdaddr = address & SBSDIO_SB_OFT_ADDR_MASK;
  3366. if ((sdaddr + size) & SBSDIO_SBWINDOW_MASK)
  3367. @@ -3768,8 +3751,9 @@
  3368. if (err) {
  3369. DHD_ERROR(("%s: error reading DEVCTL: %d\n", __FUNCTION__, err));
  3370. bus->dhd->busstate = DHD_BUS_DOWN;
  3371. + } else {
  3372. + ASSERT(devctl & SBSDIO_DEVCTL_CA_INT_ONLY);
  3373. }
  3374. - ASSERT(devctl & SBSDIO_DEVCTL_CA_INT_ONLY);
  3375. #endif /* DHD_DEBUG */
  3376.  
  3377. /* Read CSR, if clock on switch to AVAIL, else ignore */
  3378. @@ -3943,8 +3927,8 @@
  3379. /* Resched if events or tx frames are pending, else await next interrupt */
  3380. /* On failed register access, all bets are off: no resched or interrupts */
  3381. if ((bus->dhd->busstate == DHD_BUS_DOWN) || bcmsdh_regfail(sdh)) {
  3382. - DHD_ERROR(("%s: failed backplane access over SDIO, halting operation\n",
  3383. - __FUNCTION__));
  3384. + DHD_ERROR(("%s: failed backplane access over SDIO, halting operation %d \n",
  3385. + __FUNCTION__, bcmsdh_regfail(sdh)));
  3386. bus->dhd->busstate = DHD_BUS_DOWN;
  3387. bus->intstatus = 0;
  3388. } else if (bus->clkstate == CLK_PENDING) {
  3389. @@ -3989,7 +3973,13 @@
  3390. dhdsdio_isr(void *arg)
  3391. {
  3392. dhd_bus_t *bus = (dhd_bus_t*)arg;
  3393. - bcmsdh_info_t *sdh = bus->sdh;
  3394. + bcmsdh_info_t *sdh;
  3395. +
  3396. + if (!bus) {
  3397. + DHD_ERROR(("%s : bus is null pointer , exit \n", __FUNCTION__));
  3398. + return;
  3399. + }
  3400. + sdh = bus->sdh;
  3401.  
  3402. if (bus->dhd->busstate == DHD_BUS_DOWN) {
  3403. DHD_ERROR(("%s : bus is down. we have nothing to do\n", __FUNCTION__));
  3404. @@ -4020,14 +4010,13 @@
  3405.  
  3406. #if defined(SDIO_ISR_THREAD)
  3407. DHD_TRACE(("Calling dhdsdio_dpc() from %s\n", __FUNCTION__));
  3408. - dhd_os_wake_lock(bus->dhd);
  3409. while (dhdsdio_dpc(bus));
  3410. - dhd_os_wake_unlock(bus->dhd);
  3411. #else
  3412. bus->dpc_sched = TRUE;
  3413. dhd_sched_dpc(bus->dhd);
  3414. #endif
  3415.  
  3416. +
  3417. }
  3418.  
  3419. #ifdef SDTEST
  3420. @@ -4537,12 +4526,13 @@
  3421.  
  3422.  
  3423. /* if firmware path present try to download and bring up bus */
  3424. - if ((ret = dhd_bus_start(bus->dhd)) == -1) {
  3425. - DHD_TRACE(("%s: warning : check if firmware was provided\n", __FUNCTION__));
  3426. - }
  3427. - else if (ret == BCME_NOTUP) {
  3428. - DHD_ERROR(("%s: dongle is not responding\n", __FUNCTION__));
  3429. + if ((ret = dhd_bus_start(bus->dhd)) != 0) {
  3430. + DHD_ERROR(("%s: failed\n", __FUNCTION__));
  3431. goto fail;
  3432. + if (ret == BCME_NOTUP) {
  3433. + DHD_ERROR(("%s: dongle is not responding\n", __FUNCTION__));
  3434. + goto fail;
  3435. + }
  3436. }
  3437. /* Ok, have the per-port tell the stack we're open for business */
  3438. if (dhd_net_attach(bus->dhd, 0) != 0) {
  3439. @@ -4843,6 +4833,7 @@
  3440.  
  3441. ret = dhdsdio_download_firmware(bus, osh, bus->sdh);
  3442.  
  3443. +
  3444. return ret;
  3445. }
  3446.  
  3447. @@ -4852,13 +4843,12 @@
  3448. bool ret;
  3449.  
  3450. /* Download the firmware */
  3451. - dhd_os_wake_lock(bus->dhd);
  3452. dhdsdio_clkctl(bus, CLK_AVAIL, FALSE);
  3453.  
  3454. ret = _dhdsdio_download_firmware(bus) == 0;
  3455.  
  3456. dhdsdio_clkctl(bus, CLK_SDONLY, FALSE);
  3457. - dhd_os_wake_unlock(bus->dhd);
  3458. +
  3459. return ret;
  3460. }
  3461.  
  3462. @@ -4872,6 +4862,10 @@
  3463. ASSERT(osh);
  3464.  
  3465.  
  3466. + /* De-register interrupt handler */
  3467. + bcmsdh_intr_disable(bus->sdh);
  3468. + bcmsdh_intr_dereg(bus->sdh);
  3469. +
  3470. if (bus->dhd) {
  3471.  
  3472. dhdsdio_release_dongle(bus, osh);
  3473. @@ -4882,9 +4876,6 @@
  3474.  
  3475. dhdsdio_release_malloc(bus, osh);
  3476.  
  3477. - /* De-register interrupt handler */
  3478. - bcmsdh_intr_dereg(bus->sdh);
  3479. -
  3480.  
  3481. MFREE(osh, bus, sizeof(dhd_bus_t));
  3482. }
  3483. @@ -5379,8 +5370,8 @@
  3484. /* Force flow control as protection when stop come before ifconfig_down */
  3485. dhd_txflowcontrol(bus->dhd, 0, ON);
  3486. #endif /* !defined(IGNORE_ETH0_DOWN) */
  3487. - dhd_os_proto_block(dhdp);
  3488. /* save country settinng if was pre-setup with priv ioctl */
  3489. + dhd_os_proto_block(dhdp);
  3490. dhdcdc_query_ioctl(bus->dhd, 0, WLC_GET_COUNTRY,
  3491. bus->dhd->country_code, sizeof(bus->dhd->country_code));
  3492. dhd_os_proto_unblock(dhdp);
  3493. Binärdateien /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/dhd_sdio.o and /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/dhd_sdio.o sind verschieden.
  3494. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/.dhd_sdio.o.cmd /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/.dhd_sdio.o.cmd
  3495. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/.dhd_sdio.o.cmd 2010-04-07 00:19:27.000000000 +0200
  3496. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/.dhd_sdio.o.cmd 2010-04-07 00:49:53.000000000 +0200
  3497. @@ -531,12 +531,15 @@
  3498. drivers/net/wireless/bcm4329/include/proto/wpa.h \
  3499. drivers/net/wireless/bcm4329/dngl_stats.h \
  3500. drivers/net/wireless/bcm4329/dhd.h \
  3501. + $(wildcard include/config/has/wakelock.h) \
  3502. include/linux/etherdevice.h \
  3503. include/linux/ethtool.h \
  3504. /media/Development/android/linux-msm/arch/arm/include/asm/unaligned.h \
  3505. include/linux/unaligned/le_byteshift.h \
  3506. include/linux/unaligned/be_byteshift.h \
  3507. include/linux/unaligned/generic.h \
  3508. + include/linux/wakelock.h \
  3509. + $(wildcard include/config/wakelock/stat.h) \
  3510. drivers/net/wireless/bcm4329/include/wlioctl.h \
  3511. $(wildcard include/config/item.h) \
  3512. drivers/net/wireless/bcm4329/include/proto/bcmeth.h \
  3513. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/dngl_stats.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/dngl_stats.h
  3514. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/dngl_stats.h 2010-04-06 22:12:45.000000000 +0200
  3515. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/dngl_stats.h 2010-04-07 00:34:09.000000000 +0200
  3516. @@ -2,7 +2,7 @@
  3517. * Common stats definitions for clients of dongle
  3518. * ports
  3519. *
  3520. - * Copyright (C) 1999-2009, Broadcom Corporation
  3521. + * Copyright (C) 1999-2010, Broadcom Corporation
  3522. *
  3523. * Unless you and Broadcom execute a separate written software license
  3524. * agreement governing use of this software, this software is licensed to you
  3525. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/hndpmu.c /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/hndpmu.c
  3526. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/hndpmu.c 2010-04-06 22:12:45.000000000 +0200
  3527. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/hndpmu.c 2010-04-07 00:34:09.000000000 +0200
  3528. @@ -2,7 +2,7 @@
  3529. * Misc utility routines for accessing PMU corerev specific features
  3530. * of the SiliconBackplane-based Broadcom chips.
  3531. *
  3532. - * Copyright (C) 1999-2009, Broadcom Corporation
  3533. + * Copyright (C) 1999-2010, Broadcom Corporation
  3534. *
  3535. * Unless you and Broadcom execute a separate written software license
  3536. * agreement governing use of this software, this software is licensed to you
  3537. @@ -22,7 +22,7 @@
  3538. * software in any way with any other Broadcom software provided under a license
  3539. * other than the GPL, without Broadcom's express prior written consent.
  3540. *
  3541. - * $Id: hndpmu.c,v 1.95.2.17.4.11.2.50 2009/10/26 14:45:51 Exp $
  3542. + * $Id: hndpmu.c,v 1.95.2.17.4.11.2.58 2010/03/10 21:36:44 Exp $
  3543. */
  3544.  
  3545. #include <typedefs.h>
  3546. Binärdateien /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/hndpmu.o and /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/hndpmu.o sind verschieden.
  3547. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/aidmp.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/aidmp.h
  3548. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/aidmp.h 2010-04-06 22:12:45.000000000 +0200
  3549. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/aidmp.h 2010-04-07 00:34:09.000000000 +0200
  3550. @@ -1,7 +1,7 @@
  3551. /*
  3552. * Broadcom AMBA Interconnect definitions.
  3553. *
  3554. - * Copyright (C) 1999-2009, Broadcom Corporation
  3555. + * Copyright (C) 1999-2010, Broadcom Corporation
  3556. *
  3557. * Unless you and Broadcom execute a separate written software license
  3558. * agreement governing use of this software, this software is licensed to you
  3559. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/bcmcdc.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/bcmcdc.h
  3560. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/bcmcdc.h 2010-04-06 22:12:45.000000000 +0200
  3561. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/bcmcdc.h 2010-04-07 00:34:09.000000000 +0200
  3562. @@ -4,7 +4,7 @@
  3563. *
  3564. * Definitions subject to change without notice.
  3565. *
  3566. - * Copyright (C) 1999-2009, Broadcom Corporation
  3567. + * Copyright (C) 1999-2010, Broadcom Corporation
  3568. *
  3569. * Unless you and Broadcom execute a separate written software license
  3570. * agreement governing use of this software, this software is licensed to you
  3571. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/bcmdefs.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/bcmdefs.h
  3572. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/bcmdefs.h 2010-04-06 22:12:45.000000000 +0200
  3573. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/bcmdefs.h 2010-04-07 00:34:09.000000000 +0200
  3574. @@ -1,7 +1,7 @@
  3575. /*
  3576. * Misc system wide definitions
  3577. *
  3578. - * Copyright (C) 1999-2009, Broadcom Corporation
  3579. + * Copyright (C) 1999-2010, Broadcom Corporation
  3580. *
  3581. * Unless you and Broadcom execute a separate written software license
  3582. * agreement governing use of this software, this software is licensed to you
  3583. @@ -20,7 +20,7 @@
  3584. * Notwithstanding the above, under no circumstances may you combine this
  3585. * software in any way with any other Broadcom software provided under a license
  3586. * other than the GPL, without Broadcom's express prior written consent.
  3587. - * $Id: bcmdefs.h,v 13.38.4.10.2.7.6.10 2009/07/03 08:20:51 Exp $
  3588. + * $Id: bcmdefs.h,v 13.38.4.10.2.7.6.11 2010/02/01 05:51:55 Exp $
  3589. */
  3590.  
  3591.  
  3592. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/bcmdevs.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/bcmdevs.h
  3593. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/bcmdevs.h 2010-04-06 22:12:45.000000000 +0200
  3594. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/bcmdevs.h 2010-04-07 00:34:09.000000000 +0200
  3595. @@ -1,7 +1,7 @@
  3596. /*
  3597. * Broadcom device-specific manifest constants.
  3598. *
  3599. - * Copyright (C) 1999-2009, Broadcom Corporation
  3600. + * Copyright (C) 1999-2010, Broadcom Corporation
  3601. *
  3602. * Unless you and Broadcom execute a separate written software license
  3603. * agreement governing use of this software, this software is licensed to you
  3604. @@ -21,7 +21,7 @@
  3605. * software in any way with any other Broadcom software provided under a license
  3606. * other than the GPL, without Broadcom's express prior written consent.
  3607. *
  3608. - * $Id: bcmdevs.h,v 13.172.4.5.4.10.2.19 2009/09/18 23:51:17 Exp $
  3609. + * $Id: bcmdevs.h,v 13.172.4.5.4.10.2.31 2010/03/20 00:16:30 Exp $
  3610. */
  3611.  
  3612.  
  3613. @@ -58,6 +58,7 @@
  3614. #define BCM4329_D11NDUAL_ID 0x432e
  3615. #define BCM4329_D11N2G_ID 0x432f
  3616. #define BCM4329_D11N5G_ID 0x4330
  3617. +#define BCM4336_D11N_ID 0x4343
  3618. #define BCM4315_D11DUAL_ID 0x4334
  3619. #define BCM4315_D11G_ID 0x4335
  3620. #define BCM4315_D11A_ID 0x4336
  3621. @@ -90,6 +91,7 @@
  3622. #define BCM4325_CHIP_ID 0x4325
  3623. #define BCM4328_CHIP_ID 0x4328
  3624. #define BCM4329_CHIP_ID 0x4329
  3625. +#define BCM4336_CHIP_ID 0x4336
  3626. #define BCM4402_CHIP_ID 0x4402
  3627. #define BCM4704_CHIP_ID 0x4704
  3628. #define BCM4710_CHIP_ID 0x4710
  3629. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/bcmendian.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/bcmendian.h
  3630. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/bcmendian.h 2010-04-06 22:12:45.000000000 +0200
  3631. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/bcmendian.h 2010-04-07 00:34:09.000000000 +0200
  3632. @@ -1,7 +1,7 @@
  3633. /*
  3634. * Byte order utilities
  3635. *
  3636. - * Copyright (C) 1999-2009, Broadcom Corporation
  3637. + * Copyright (C) 1999-2010, Broadcom Corporation
  3638. *
  3639. * Unless you and Broadcom execute a separate written software license
  3640. * agreement governing use of this software, this software is licensed to you
  3641. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/bcmpcispi.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/bcmpcispi.h
  3642. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/bcmpcispi.h 2010-04-06 22:12:45.000000000 +0200
  3643. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/bcmpcispi.h 2010-04-07 00:34:09.000000000 +0200
  3644. @@ -1,7 +1,7 @@
  3645. /*
  3646. * Broadcom PCI-SPI Host Controller Register Definitions
  3647. *
  3648. - * Copyright (C) 1999-2009, Broadcom Corporation
  3649. + * Copyright (C) 1999-2010, Broadcom Corporation
  3650. *
  3651. * Unless you and Broadcom execute a separate written software license
  3652. * agreement governing use of this software, this software is licensed to you
  3653. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/bcmperf.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/bcmperf.h
  3654. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/bcmperf.h 2010-04-06 22:12:45.000000000 +0200
  3655. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/bcmperf.h 2010-04-07 00:34:09.000000000 +0200
  3656. @@ -1,7 +1,7 @@
  3657. /*
  3658. * Performance counters software interface.
  3659. *
  3660. - * Copyright (C) 1999-2009, Broadcom Corporation
  3661. + * Copyright (C) 1999-2010, Broadcom Corporation
  3662. *
  3663. * Unless you and Broadcom execute a separate written software license
  3664. * agreement governing use of this software, this software is licensed to you
  3665. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/bcmsdbus.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/bcmsdbus.h
  3666. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/bcmsdbus.h 2010-04-06 22:12:45.000000000 +0200
  3667. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/bcmsdbus.h 2010-04-07 00:34:09.000000000 +0200
  3668. @@ -2,7 +2,7 @@
  3669. * Definitions for API from sdio common code (bcmsdh) to individual
  3670. * host controller drivers.
  3671. *
  3672. - * Copyright (C) 1999-2009, Broadcom Corporation
  3673. + * Copyright (C) 1999-2010, Broadcom Corporation
  3674. *
  3675. * Unless you and Broadcom execute a separate written software license
  3676. * agreement governing use of this software, this software is licensed to you
  3677. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/bcmsdh.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/bcmsdh.h
  3678. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/bcmsdh.h 2010-04-06 22:12:45.000000000 +0200
  3679. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/bcmsdh.h 2010-04-07 00:34:09.000000000 +0200
  3680. @@ -3,7 +3,7 @@
  3681. * export functions to client drivers
  3682. * abstract OS and BUS specific details of SDIO
  3683. *
  3684. - * Copyright (C) 1999-2009, Broadcom Corporation
  3685. + * Copyright (C) 1999-2010, Broadcom Corporation
  3686. *
  3687. * Unless you and Broadcom execute a separate written software license
  3688. * agreement governing use of this software, this software is licensed to you
  3689. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/bcmsdh_sdmmc.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/bcmsdh_sdmmc.h
  3690. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/bcmsdh_sdmmc.h 2010-04-06 22:12:45.000000000 +0200
  3691. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/bcmsdh_sdmmc.h 2010-04-07 00:34:09.000000000 +0200
  3692. @@ -1,7 +1,7 @@
  3693. /*
  3694. * BCMSDH Function Driver for the native SDIO/MMC driver in the Linux Kernel
  3695. *
  3696. - * Copyright (C) 1999-2009, Broadcom Corporation
  3697. + * Copyright (C) 1999-2010, Broadcom Corporation
  3698. *
  3699. * Unless you and Broadcom execute a separate written software license
  3700. * agreement governing use of this software, this software is licensed to you
  3701. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/bcmsdpcm.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/bcmsdpcm.h
  3702. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/bcmsdpcm.h 2010-04-06 22:12:45.000000000 +0200
  3703. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/bcmsdpcm.h 2010-04-07 00:34:09.000000000 +0200
  3704. @@ -2,7 +2,7 @@
  3705. * Broadcom SDIO/PCMCIA
  3706. * Software-specific definitions shared between device and host side
  3707. *
  3708. - * Copyright (C) 1999-2009, Broadcom Corporation
  3709. + * Copyright (C) 1999-2010, Broadcom Corporation
  3710. *
  3711. * Unless you and Broadcom execute a separate written software license
  3712. * agreement governing use of this software, this software is licensed to you
  3713. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/bcmsdspi.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/bcmsdspi.h
  3714. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/bcmsdspi.h 2010-04-06 22:12:45.000000000 +0200
  3715. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/bcmsdspi.h 2010-04-07 00:34:09.000000000 +0200
  3716. @@ -1,7 +1,7 @@
  3717. /*
  3718. * SD-SPI Protocol Conversion - BCMSDH->SPI Translation Layer
  3719. *
  3720. - * Copyright (C) 1999-2009, Broadcom Corporation
  3721. + * Copyright (C) 1999-2010, Broadcom Corporation
  3722. *
  3723. * Unless you and Broadcom execute a separate written software license
  3724. * agreement governing use of this software, this software is licensed to you
  3725. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/bcmsdstd.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/bcmsdstd.h
  3726. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/bcmsdstd.h 2010-04-06 22:12:45.000000000 +0200
  3727. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/bcmsdstd.h 2010-04-07 00:34:09.000000000 +0200
  3728. @@ -1,7 +1,7 @@
  3729. /*
  3730. * 'Standard' SDIO HOST CONTROLLER driver
  3731. *
  3732. - * Copyright (C) 1999-2009, Broadcom Corporation
  3733. + * Copyright (C) 1999-2010, Broadcom Corporation
  3734. *
  3735. * Unless you and Broadcom execute a separate written software license
  3736. * agreement governing use of this software, this software is licensed to you
  3737. @@ -21,17 +21,18 @@
  3738. * software in any way with any other Broadcom software provided under a license
  3739. * other than the GPL, without Broadcom's express prior written consent.
  3740. *
  3741. - * $Id: bcmsdstd.h,v 13.16.18.1.16.2 2008/09/30 17:14:16 Exp $
  3742. + * $Id: bcmsdstd.h,v 13.16.18.1.16.3 2009/12/10 01:09:23 Exp $
  3743. */
  3744.  
  3745. /* global msglevel for debug messages - bitvals come from sdiovar.h */
  3746.  
  3747. -#define sd_err(x)
  3748. +#define sd_err(x) do { if (sd_msglevel & SDH_ERROR_VAL) printf x; } while (0)
  3749. #define sd_trace(x)
  3750. #define sd_info(x)
  3751. #define sd_debug(x)
  3752. #define sd_data(x)
  3753. #define sd_ctrl(x)
  3754. +#define sd_dma(x)
  3755.  
  3756. #define sd_sync_dma(sd, read, nbytes)
  3757. #define sd_init_dma(sd)
  3758. @@ -78,8 +79,6 @@
  3759. #define RETRIES_LARGE 100000
  3760. #define RETRIES_SMALL 100
  3761.  
  3762. -#define USE_PIO 0x0 /* DMA or PIO */
  3763. -#define USE_DMA 0x1
  3764.  
  3765. #define USE_BLOCKMODE 0x2 /* Block mode can be single block or multi */
  3766. #define USE_MULTIBLOCK 0x4
  3767. @@ -115,7 +114,6 @@
  3768. bool card_init_done; /* Client SDIO interface initted */
  3769. bool polled_mode; /* polling for command completion */
  3770.  
  3771. - bool sd_use_dma; /* DMA on CMD53 */
  3772. bool sd_blockmode; /* sd_blockmode == FALSE => 64 Byte Cmd 53s. */
  3773. /* Must be on for sd_multiblock to be effective */
  3774. bool use_client_ints; /* If this is false, make sure to restore */
  3775. @@ -125,17 +123,64 @@
  3776. int client_block_size[SDIOD_MAX_IOFUNCS]; /* Blocksize */
  3777. uint32 data_xfer_count; /* Current transfer */
  3778. uint16 card_rca; /* Current Address */
  3779. + int8 sd_dma_mode; /* DMA Mode (PIO, SDMA, ... ADMA2) on CMD53 */
  3780. uint8 num_funcs; /* Supported funcs on client */
  3781. uint32 com_cis_ptr;
  3782. uint32 func_cis_ptr[SDIOD_MAX_IOFUNCS];
  3783. - void *dma_buf;
  3784. - ulong dma_phys;
  3785. + void *dma_buf; /* DMA Buffer virtual address */
  3786. + ulong dma_phys; /* DMA Buffer physical address */
  3787. + void *adma2_dscr_buf; /* ADMA2 Descriptor Buffer virtual address */
  3788. + ulong adma2_dscr_phys; /* ADMA2 Descriptor Buffer physical address */
  3789. +
  3790. + /* adjustments needed to make the dma align properly */
  3791. + void *dma_start_buf;
  3792. + ulong dma_start_phys;
  3793. + uint alloced_dma_size;
  3794. + void *adma2_dscr_start_buf;
  3795. + ulong adma2_dscr_start_phys;
  3796. + uint alloced_adma2_dscr_size;
  3797. +
  3798. int r_cnt; /* rx count */
  3799. int t_cnt; /* tx_count */
  3800. bool got_hcint; /* local interrupt flag */
  3801. uint16 last_intrstatus; /* to cache intrstatus */
  3802. };
  3803.  
  3804. +#define DMA_MODE_NONE 0
  3805. +#define DMA_MODE_SDMA 1
  3806. +#define DMA_MODE_ADMA1 2
  3807. +#define DMA_MODE_ADMA2 3
  3808. +#define DMA_MODE_ADMA2_64 4
  3809. +#define DMA_MODE_AUTO -1
  3810. +
  3811. +#define USE_DMA(sd) ((bool)((sd->sd_dma_mode > 0) ? TRUE : FALSE))
  3812. +
  3813. +/* SDIO Host Control Register DMA Mode Definitions */
  3814. +#define SDIOH_SDMA_MODE 0
  3815. +#define SDIOH_ADMA1_MODE 1
  3816. +#define SDIOH_ADMA2_MODE 2
  3817. +#define SDIOH_ADMA2_64_MODE 3
  3818. +
  3819. +#define ADMA2_ATTRIBUTE_VALID (1 << 0) /* ADMA Descriptor line valid */
  3820. +#define ADMA2_ATTRIBUTE_END (1 << 1) /* End of Descriptor */
  3821. +#define ADMA2_ATTRIBUTE_INT (1 << 2) /* Interrupt when line is done */
  3822. +#define ADMA2_ATTRIBUTE_ACT_NOP (0 << 4) /* Skip current line, go to next. */
  3823. +#define ADMA2_ATTRIBUTE_ACT_RSV (1 << 4) /* Same as NOP */
  3824. +#define ADMA1_ATTRIBUTE_ACT_SET (1 << 4) /* ADMA1 Only - set transfer length */
  3825. +#define ADMA2_ATTRIBUTE_ACT_TRAN (2 << 4) /* Transfer Data of one descriptor line. */
  3826. +#define ADMA2_ATTRIBUTE_ACT_LINK (3 << 4) /* Link Descriptor */
  3827. +
  3828. +/* ADMA2 Descriptor Table Entry for 32-bit Address */
  3829. +typedef struct adma2_dscr_32b {
  3830. + uint32 len_attr;
  3831. + uint32 phys_addr;
  3832. +} adma2_dscr_32b_t;
  3833. +
  3834. +/* ADMA1 Descriptor Table Entry */
  3835. +typedef struct adma1_dscr {
  3836. + uint32 phys_addr_attr;
  3837. +} adma1_dscr_t;
  3838. +
  3839. /************************************************************
  3840. * Internal interfaces: per-port references into bcmsdstd.c
  3841. */
  3842. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/bcmspi.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/bcmspi.h
  3843. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/bcmspi.h 2010-04-06 22:12:45.000000000 +0200
  3844. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/bcmspi.h 2010-04-07 00:34:09.000000000 +0200
  3845. @@ -1,7 +1,7 @@
  3846. /*
  3847. * Broadcom SPI Low-Level Hardware Driver API
  3848. *
  3849. - * Copyright (C) 1999-2009, Broadcom Corporation
  3850. + * Copyright (C) 1999-2010, Broadcom Corporation
  3851. *
  3852. * Unless you and Broadcom execute a separate written software license
  3853. * agreement governing use of this software, this software is licensed to you
  3854. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/bcmutils.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/bcmutils.h
  3855. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/bcmutils.h 2010-04-06 22:12:45.000000000 +0200
  3856. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/bcmutils.h 2010-04-07 00:34:09.000000000 +0200
  3857. @@ -1,7 +1,7 @@
  3858. /*
  3859. * Misc useful os-independent macros and functions.
  3860. *
  3861. - * Copyright (C) 1999-2009, Broadcom Corporation
  3862. + * Copyright (C) 1999-2010, Broadcom Corporation
  3863. *
  3864. * Unless you and Broadcom execute a separate written software license
  3865. * agreement governing use of this software, this software is licensed to you
  3866. @@ -20,7 +20,7 @@
  3867. * Notwithstanding the above, under no circumstances may you combine this
  3868. * software in any way with any other Broadcom software provided under a license
  3869. * other than the GPL, without Broadcom's express prior written consent.
  3870. - * $Id: bcmutils.h,v 13.184.4.6.2.1.18.22 2009/10/28 18:25:39 Exp $
  3871. + * $Id: bcmutils.h,v 13.184.4.6.2.1.18.24 2009/12/10 20:19:19 Exp $
  3872. */
  3873.  
  3874.  
  3875. @@ -338,8 +338,11 @@
  3876. #define BCME_NOT_WME_ASSOCIATION -34
  3877. #define BCME_SDIO_ERROR -35
  3878. #define BCME_DONGLE_DOWN -36
  3879. -#define BCME_VERSION -37
  3880. -#define BCME_UNFINISHED -38
  3881. +#define BCME_VERSION -37
  3882. +#define BCME_TXFAIL -38
  3883. +#define BCME_RXFAIL -39
  3884. +#define BCME_NODEVICE -40
  3885. +#define BCME_UNFINISHED -41
  3886. #define BCME_LAST BCME_UNFINISHED
  3887.  
  3888.  
  3889. @@ -381,8 +384,11 @@
  3890. "Not WME Association", \
  3891. "SDIO Bus Error", \
  3892. "Dongle Not Accessible", \
  3893. - "Incorrect version", \
  3894. - "Command not finished" \
  3895. + "Incorrect version", \
  3896. + "TX Failure", \
  3897. + "RX Failure", \
  3898. + "Device Not Present", \
  3899. + "Command not finished", \
  3900. }
  3901.  
  3902. #ifndef ABS
  3903. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/bcmwifi.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/bcmwifi.h
  3904. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/bcmwifi.h 2010-04-06 22:12:45.000000000 +0200
  3905. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/bcmwifi.h 2010-04-07 00:34:09.000000000 +0200
  3906. @@ -3,7 +3,7 @@
  3907. * This header file housing the define and function prototype use by
  3908. * both the wl driver, tools & Apps.
  3909. *
  3910. - * Copyright (C) 1999-2009, Broadcom Corporation
  3911. + * Copyright (C) 1999-2010, Broadcom Corporation
  3912. *
  3913. * Unless you and Broadcom execute a separate written software license
  3914. * agreement governing use of this software, this software is licensed to you
  3915. @@ -22,7 +22,7 @@
  3916. * Notwithstanding the above, under no circumstances may you combine this
  3917. * software in any way with any other Broadcom software provided under a license
  3918. * other than the GPL, without Broadcom's express prior written consent.
  3919. - * $Id: bcmwifi.h,v 1.15.30.1 2009/08/15 00:51:27 Exp $
  3920. + * $Id: bcmwifi.h,v 1.15.30.4 2010/03/10 20:10:52 Exp $
  3921. */
  3922.  
  3923.  
  3924. @@ -39,6 +39,7 @@
  3925. #define CH_EWA_VALID 0x04
  3926. #define CH_20MHZ_APART 4
  3927. #define CH_10MHZ_APART 2
  3928. +#define CH_5MHZ_APART 1
  3929. #define CH_MAX_2G_CHANNEL 14
  3930. #define WLC_MAX_2G_CHANNEL CH_MAX_2G_CHANNEL
  3931. #define MAXCHANNEL 224
  3932. @@ -113,6 +114,11 @@
  3933. #define CHSPEC_SB_NONE(chspec) ((chspec & WL_CHANSPEC_CTL_SB_MASK) == WL_CHANSPEC_CTL_SB_NONE)
  3934. #define CHSPEC_SB_UPPER(chspec) ((chspec & WL_CHANSPEC_CTL_SB_MASK) == WL_CHANSPEC_CTL_SB_UPPER)
  3935. #define CHSPEC_SB_LOWER(chspec) ((chspec & WL_CHANSPEC_CTL_SB_MASK) == WL_CHANSPEC_CTL_SB_LOWER)
  3936. +#define CHSPEC_CTL_CHAN(chspec) ((CHSPEC_SB_LOWER(chspec)) ? \
  3937. + (LOWER_20_SB(((chspec) & WL_CHANSPEC_CHAN_MASK))) : \
  3938. + (UPPER_20_SB(((chspec) & WL_CHANSPEC_CHAN_MASK))))
  3939. +
  3940. +#define CHSPEC2WLC_BAND(chspec) (CHSPEC_IS5G((chspec))? WLC_BAND_5G: WLC_BAND_2G)
  3941.  
  3942. #define CHANSPEC_STR_LEN 8
  3943.  
  3944. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/dhdioctl.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/dhdioctl.h
  3945. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/dhdioctl.h 2010-04-06 22:12:45.000000000 +0200
  3946. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/dhdioctl.h 2010-04-07 00:34:09.000000000 +0200
  3947. @@ -5,7 +5,7 @@
  3948. *
  3949. * Definitions subject to change without notice.
  3950. *
  3951. - * Copyright (C) 1999-2009, Broadcom Corporation
  3952. + * Copyright (C) 1999-2010, Broadcom Corporation
  3953. *
  3954. * Unless you and Broadcom execute a separate written software license
  3955. * agreement governing use of this software, this software is licensed to you
  3956. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/epivers.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/epivers.h
  3957. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/epivers.h 2010-04-06 22:12:45.000000000 +0200
  3958. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/epivers.h 2010-04-07 00:34:09.000000000 +0200
  3959. @@ -1,5 +1,5 @@
  3960. /*
  3961. - * Copyright (C) 1999-2009, Broadcom Corporation
  3962. + * Copyright (C) 1999-2010, Broadcom Corporation
  3963. *
  3964. * Unless you and Broadcom execute a separate written software license
  3965. * agreement governing use of this software, this software is licensed to you
  3966. @@ -31,18 +31,18 @@
  3967.  
  3968. #define EPI_MINOR_VERSION 218
  3969.  
  3970. -#define EPI_RC_NUMBER 161
  3971. +#define EPI_RC_NUMBER 209
  3972.  
  3973. #define EPI_INCREMENTAL_NUMBER 0
  3974.  
  3975. #define EPI_BUILD_NUMBER 0
  3976.  
  3977. -#define EPI_VERSION 4, 218, 161, 0
  3978. +#define EPI_VERSION 4, 218, 209, 0
  3979.  
  3980. -#define EPI_VERSION_NUM 0x04daa100
  3981. +#define EPI_VERSION_NUM 0x04dad100
  3982.  
  3983.  
  3984. -#define EPI_VERSION_STR "4.218.161.0"
  3985. -#define EPI_ROUTER_VERSION_STR "4.219.161.0"
  3986. +#define EPI_VERSION_STR "4.218.209.0"
  3987. +#define EPI_ROUTER_VERSION_STR "4.219.209.0"
  3988.  
  3989. #endif
  3990. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/hndpmu.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/hndpmu.h
  3991. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/hndpmu.h 2010-04-06 22:12:45.000000000 +0200
  3992. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/hndpmu.h 2010-04-07 00:34:09.000000000 +0200
  3993. @@ -1,7 +1,7 @@
  3994. /*
  3995. * HND SiliconBackplane PMU support.
  3996. *
  3997. - * Copyright (C) 1999-2009, Broadcom Corporation
  3998. + * Copyright (C) 1999-2010, Broadcom Corporation
  3999. *
  4000. * Unless you and Broadcom execute a separate written software license
  4001. * agreement governing use of this software, this software is licensed to you
  4002. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/hndsoc.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/hndsoc.h
  4003. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/hndsoc.h 2010-04-06 22:12:45.000000000 +0200
  4004. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/hndsoc.h 2010-04-07 00:34:09.000000000 +0200
  4005. @@ -1,7 +1,7 @@
  4006. /*
  4007. * Broadcom HND chip & on-chip-interconnect-related definitions.
  4008. *
  4009. - * Copyright (C) 1999-2009, Broadcom Corporation
  4010. + * Copyright (C) 1999-2010, Broadcom Corporation
  4011. *
  4012. * Unless you and Broadcom execute a separate written software license
  4013. * agreement governing use of this software, this software is licensed to you
  4014. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/linux_osl.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/linux_osl.h
  4015. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/linux_osl.h 2010-04-06 22:12:45.000000000 +0200
  4016. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/linux_osl.h 2010-04-07 00:34:09.000000000 +0200
  4017. @@ -1,7 +1,7 @@
  4018. /*
  4019. * Linux OS Independent Layer
  4020. *
  4021. - * Copyright (C) 1999-2009, Broadcom Corporation
  4022. + * Copyright (C) 1999-2010, Broadcom Corporation
  4023. *
  4024. * Unless you and Broadcom execute a separate written software license
  4025. * agreement governing use of this software, this software is licensed to you
  4026. @@ -21,7 +21,7 @@
  4027. * software in any way with any other Broadcom software provided under a license
  4028. * other than the GPL, without Broadcom's express prior written consent.
  4029. *
  4030. - * $Id: linux_osl.h,v 13.131.30.5 2009/10/27 04:42:45 Exp $
  4031. + * $Id: linux_osl.h,v 13.131.30.6 2010/03/26 21:34:29 Exp $
  4032. */
  4033.  
  4034.  
  4035. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/linuxver.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/linuxver.h
  4036. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/linuxver.h 2010-04-06 22:12:45.000000000 +0200
  4037. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/linuxver.h 2010-04-07 00:34:09.000000000 +0200
  4038. @@ -2,7 +2,7 @@
  4039. * Linux-specific abstractions to gain some independence from linux kernel versions.
  4040. * Pave over some 2.2 versus 2.4 versus 2.6 kernel differences.
  4041. *
  4042. - * Copyright (C) 1999-2009, Broadcom Corporation
  4043. + * Copyright (C) 1999-2010, Broadcom Corporation
  4044. *
  4045. * Unless you and Broadcom execute a separate written software license
  4046. * agreement governing use of this software, this software is licensed to you
  4047. @@ -22,7 +22,7 @@
  4048. * software in any way with any other Broadcom software provided under a license
  4049. * other than the GPL, without Broadcom's express prior written consent.
  4050. *
  4051. - * $Id: linuxver.h,v 13.38.8.1.8.3 2009/06/19 04:42:45 Exp $
  4052. + * $Id: linuxver.h,v 13.38.8.1.8.5 2010/02/04 13:47:16 Exp $
  4053. */
  4054.  
  4055.  
  4056. @@ -425,7 +425,18 @@
  4057. #define CHECKSUM_HW CHECKSUM_PARTIAL
  4058. #endif
  4059.  
  4060. -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
  4061. +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31))
  4062. +#define KILL_PROC(nr, sig) \
  4063. +{ \
  4064. +struct task_struct *tsk; \
  4065. +struct pid *pid; \
  4066. +pid = find_get_pid((pid_t)nr); \
  4067. +tsk = pid_task(pid, PIDTYPE_PID); \
  4068. +if (tsk) send_sig(sig, tsk, 1); \
  4069. +}
  4070. +#else
  4071. +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && (LINUX_VERSION_CODE <= \
  4072. + KERNEL_VERSION(2, 6, 30))
  4073. #define KILL_PROC(pid, sig) \
  4074. { \
  4075. struct task_struct *tsk; \
  4076. @@ -438,6 +449,7 @@
  4077. kill_proc(pid, sig, 1); \
  4078. }
  4079. #endif
  4080. +#endif
  4081.  
  4082. #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0))
  4083. #define netdev_priv(dev) dev->priv
  4084. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/miniopt.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/miniopt.h
  4085. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/miniopt.h 2010-04-06 22:12:45.000000000 +0200
  4086. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/miniopt.h 2010-04-07 00:34:09.000000000 +0200
  4087. @@ -1,7 +1,7 @@
  4088. /*
  4089. * Command line options parser.
  4090. *
  4091. - * Copyright (C) 1999-2009, Broadcom Corporation
  4092. + * Copyright (C) 1999-2010, Broadcom Corporation
  4093. *
  4094. * Unless you and Broadcom execute a separate written software license
  4095. * agreement governing use of this software, this software is licensed to you
  4096. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/msgtrace.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/msgtrace.h
  4097. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/msgtrace.h 2010-04-06 22:12:45.000000000 +0200
  4098. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/msgtrace.h 2010-04-07 00:34:09.000000000 +0200
  4099. @@ -1,7 +1,7 @@
  4100. /*
  4101. * Trace messages sent over HBUS
  4102. *
  4103. - * Copyright (C) 1999-2009, Broadcom Corporation
  4104. + * Copyright (C) 1999-2010, Broadcom Corporation
  4105. *
  4106. * Unless you and Broadcom execute a separate written software license
  4107. * agreement governing use of this software, this software is licensed to you
  4108. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/osl.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/osl.h
  4109. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/osl.h 2010-04-06 22:12:45.000000000 +0200
  4110. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/osl.h 2010-04-07 00:34:09.000000000 +0200
  4111. @@ -1,7 +1,7 @@
  4112. /*
  4113. * OS Abstraction Layer
  4114. *
  4115. - * Copyright (C) 1999-2009, Broadcom Corporation
  4116. + * Copyright (C) 1999-2010, Broadcom Corporation
  4117. *
  4118. * Unless you and Broadcom execute a separate written software license
  4119. * agreement governing use of this software, this software is licensed to you
  4120. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/packed_section_end.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/packed_section_end.h
  4121. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/packed_section_end.h 2010-04-06 22:12:45.000000000 +0200
  4122. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/packed_section_end.h 2010-04-07 00:34:09.000000000 +0200
  4123. @@ -15,7 +15,7 @@
  4124. * #include <packed_section_end.h>
  4125. *
  4126. *
  4127. - * Copyright (C) 1999-2009, Broadcom Corporation
  4128. + * Copyright (C) 1999-2010, Broadcom Corporation
  4129. *
  4130. * Unless you and Broadcom execute a separate written software license
  4131. * agreement governing use of this software, this software is licensed to you
  4132. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/packed_section_start.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/packed_section_start.h
  4133. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/packed_section_start.h 2010-04-06 22:12:45.000000000 +0200
  4134. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/packed_section_start.h 2010-04-07 00:34:09.000000000 +0200
  4135. @@ -15,7 +15,7 @@
  4136. * #include <packed_section_end.h>
  4137. *
  4138. *
  4139. - * Copyright (C) 1999-2009, Broadcom Corporation
  4140. + * Copyright (C) 1999-2010, Broadcom Corporation
  4141. *
  4142. * Unless you and Broadcom execute a separate written software license
  4143. * agreement governing use of this software, this software is licensed to you
  4144. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/pcicfg.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/pcicfg.h
  4145. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/pcicfg.h 2010-04-06 22:12:45.000000000 +0200
  4146. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/pcicfg.h 2010-04-07 00:34:09.000000000 +0200
  4147. @@ -1,7 +1,7 @@
  4148. /*
  4149. * pcicfg.h: PCI configuration constants and structures.
  4150. *
  4151. - * Copyright (C) 1999-2009, Broadcom Corporation
  4152. + * Copyright (C) 1999-2010, Broadcom Corporation
  4153. *
  4154. * Unless you and Broadcom execute a separate written software license
  4155. * agreement governing use of this software, this software is licensed to you
  4156. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/proto/802.11e.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/proto/802.11e.h
  4157. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/proto/802.11e.h 2010-04-06 22:12:45.000000000 +0200
  4158. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/proto/802.11e.h 2010-04-07 00:34:09.000000000 +0200
  4159. @@ -1,7 +1,7 @@
  4160. /*
  4161. * 802.11e protocol header file
  4162. *
  4163. - * Copyright (C) 1999-2009, Broadcom Corporation
  4164. + * Copyright (C) 1999-2010, Broadcom Corporation
  4165. *
  4166. * Unless you and Broadcom execute a separate written software license
  4167. * agreement governing use of this software, this software is licensed to you
  4168. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/proto/802.11.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/proto/802.11.h
  4169. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/proto/802.11.h 2010-04-06 22:12:45.000000000 +0200
  4170. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/proto/802.11.h 2010-04-07 00:34:09.000000000 +0200
  4171. @@ -1,5 +1,5 @@
  4172. /*
  4173. - * Copyright (C) 1999-2009, Broadcom Corporation
  4174. + * Copyright (C) 1999-2010, Broadcom Corporation
  4175. *
  4176. * Unless you and Broadcom execute a separate written software license
  4177. * agreement governing use of this software, this software is licensed to you
  4178. @@ -21,7 +21,7 @@
  4179. *
  4180. * Fundamental types and constants relating to 802.11
  4181. *
  4182. - * $Id: 802.11.h,v 9.219.4.1.4.5.6.10 2009/07/09 10:15:09 Exp $
  4183. + * $Id: 802.11.h,v 9.219.4.1.4.5.6.11 2010/02/09 13:23:26 Exp $
  4184. */
  4185.  
  4186.  
  4187. @@ -361,15 +361,25 @@
  4188. dot11_brcm_extch_ie_t extch_ie;
  4189. } BWL_POST_PACKED_STRUCT;
  4190.  
  4191. -
  4192. -BWL_PRE_PACKED_STRUCT struct dot11_ext_csa {
  4193. - uint8 id;
  4194. - uint8 len;
  4195. +BWL_PRE_PACKED_STRUCT struct dot11_csa_body {
  4196. uint8 mode;
  4197. uint8 reg;
  4198. uint8 channel;
  4199. uint8 count;
  4200. } BWL_POST_PACKED_STRUCT;
  4201. +
  4202. +
  4203. +BWL_PRE_PACKED_STRUCT struct dot11_ext_csa {
  4204. + uint8 id;
  4205. + uint8 len;
  4206. + struct dot11_csa_body b;
  4207. +} BWL_POST_PACKED_STRUCT;
  4208. +
  4209. +BWL_PRE_PACKED_STRUCT struct dot11y_action_ext_csa {
  4210. + uint8 category;
  4211. + uint8 action;
  4212. + struct dot11_csa_body b;
  4213. +} BWL_POST_PACKED_STRUCT;
  4214. typedef struct dot11_ext_csa dot11_ext_csa_ie_t;
  4215. #define DOT11_EXT_CSA_IE_LEN 4
  4216.  
  4217. @@ -1025,7 +1035,8 @@
  4218. #define DOT11_ACTION_ID_HT_MIMO_PS 1
  4219.  
  4220.  
  4221. -#define DOT11_ACTION_ID_BSS_COEX_MNG 0
  4222. +#define DOT11_PUB_ACTION_BSS_COEX_MNG 0
  4223. +#define DOT11_PUB_ACTION_CHANNEL_SWITCH 4
  4224.  
  4225.  
  4226. #define DOT11_BA_ACTION_ADDBA_REQ 0
  4227. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/proto/802.1d.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/proto/802.1d.h
  4228. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/proto/802.1d.h 2010-04-06 22:12:45.000000000 +0200
  4229. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/proto/802.1d.h 2010-04-07 00:34:09.000000000 +0200
  4230. @@ -1,5 +1,5 @@
  4231. /*
  4232. - * Copyright (C) 1999-2009, Broadcom Corporation
  4233. + * Copyright (C) 1999-2010, Broadcom Corporation
  4234. *
  4235. * Unless you and Broadcom execute a separate written software license
  4236. * agreement governing use of this software, this software is licensed to you
  4237. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/proto/bcmeth.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/proto/bcmeth.h
  4238. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/proto/bcmeth.h 2010-04-06 22:12:45.000000000 +0200
  4239. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/proto/bcmeth.h 2010-04-07 00:34:09.000000000 +0200
  4240. @@ -1,7 +1,7 @@
  4241. /*
  4242. * Broadcom Ethernettype protocol definitions
  4243. *
  4244. - * Copyright (C) 1999-2009, Broadcom Corporation
  4245. + * Copyright (C) 1999-2010, Broadcom Corporation
  4246. *
  4247. * Unless you and Broadcom execute a separate written software license
  4248. * agreement governing use of this software, this software is licensed to you
  4249. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/proto/bcmevent.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/proto/bcmevent.h
  4250. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/proto/bcmevent.h 2010-04-06 22:12:45.000000000 +0200
  4251. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/proto/bcmevent.h 2010-04-07 00:34:09.000000000 +0200
  4252. @@ -1,7 +1,7 @@
  4253. /*
  4254. * Broadcom Event protocol definitions
  4255. *
  4256. - * Copyright (C) 1999-2009, Broadcom Corporation
  4257. + * Copyright (C) 1999-2010, Broadcom Corporation
  4258. *
  4259. * Unless you and Broadcom execute a separate written software license
  4260. * agreement governing use of this software, this software is licensed to you
  4261. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/proto/bcmip.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/proto/bcmip.h
  4262. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/proto/bcmip.h 2010-04-06 22:12:45.000000000 +0200
  4263. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/proto/bcmip.h 2010-04-07 00:34:09.000000000 +0200
  4264. @@ -1,5 +1,5 @@
  4265. /*
  4266. - * Copyright (C) 1999-2009, Broadcom Corporation
  4267. + * Copyright (C) 1999-2010, Broadcom Corporation
  4268. *
  4269. * Unless you and Broadcom execute a separate written software license
  4270. * agreement governing use of this software, this software is licensed to you
  4271. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/proto/ethernet.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/proto/ethernet.h
  4272. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/proto/ethernet.h 2010-04-06 22:12:45.000000000 +0200
  4273. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/proto/ethernet.h 2010-04-07 00:34:09.000000000 +0200
  4274. @@ -1,7 +1,7 @@
  4275. /*
  4276. * From FreeBSD 2.2.7: Fundamental constants relating to ethernet.
  4277. *
  4278. - * Copyright (C) 1999-2009, Broadcom Corporation
  4279. + * Copyright (C) 1999-2010, Broadcom Corporation
  4280. *
  4281. * Unless you and Broadcom execute a separate written software license
  4282. * agreement governing use of this software, this software is licensed to you
  4283. @@ -21,7 +21,7 @@
  4284. * software in any way with any other Broadcom software provided under a license
  4285. * other than the GPL, without Broadcom's express prior written consent.
  4286. *
  4287. - * $Id: ethernet.h,v 9.45.56.3 2009/08/15 00:51:27 Exp $
  4288. + * $Id: ethernet.h,v 9.45.56.5 2010/02/22 22:04:36 Exp $
  4289. */
  4290.  
  4291.  
  4292. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/proto/sdspi.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/proto/sdspi.h
  4293. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/proto/sdspi.h 2010-04-06 22:12:45.000000000 +0200
  4294. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/proto/sdspi.h 2010-04-07 00:34:09.000000000 +0200
  4295. @@ -1,7 +1,7 @@
  4296. /*
  4297. * SD-SPI Protocol Standard
  4298. *
  4299. - * Copyright (C) 1999-2009, Broadcom Corporation
  4300. + * Copyright (C) 1999-2010, Broadcom Corporation
  4301. *
  4302. * Unless you and Broadcom execute a separate written software license
  4303. * agreement governing use of this software, this software is licensed to you
  4304. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/proto/vlan.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/proto/vlan.h
  4305. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/proto/vlan.h 2010-04-06 22:12:45.000000000 +0200
  4306. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/proto/vlan.h 2010-04-07 00:34:09.000000000 +0200
  4307. @@ -1,7 +1,7 @@
  4308. /*
  4309. * 802.1Q VLAN protocol definitions
  4310. *
  4311. - * Copyright (C) 1999-2009, Broadcom Corporation
  4312. + * Copyright (C) 1999-2010, Broadcom Corporation
  4313. *
  4314. * Unless you and Broadcom execute a separate written software license
  4315. * agreement governing use of this software, this software is licensed to you
  4316. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/proto/wpa.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/proto/wpa.h
  4317. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/proto/wpa.h 2010-04-06 22:12:45.000000000 +0200
  4318. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/proto/wpa.h 2010-04-07 00:34:09.000000000 +0200
  4319. @@ -1,7 +1,7 @@
  4320. /*
  4321. * Fundamental types and constants relating to WPA
  4322. *
  4323. - * Copyright (C) 1999-2009, Broadcom Corporation
  4324. + * Copyright (C) 1999-2010, Broadcom Corporation
  4325. *
  4326. * Unless you and Broadcom execute a separate written software license
  4327. * agreement governing use of this software, this software is licensed to you
  4328. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/sbchipc.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/sbchipc.h
  4329. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/sbchipc.h 2010-04-06 22:12:45.000000000 +0200
  4330. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/sbchipc.h 2010-04-07 00:34:09.000000000 +0200
  4331. @@ -7,7 +7,7 @@
  4332. *
  4333. * $Id: sbchipc.h,v 13.103.2.5.4.5.2.9 2009/07/03 14:23:21 Exp $
  4334. *
  4335. - * Copyright (C) 1999-2009, Broadcom Corporation
  4336. + * Copyright (C) 1999-2010, Broadcom Corporation
  4337. *
  4338. * Unless you and Broadcom execute a separate written software license
  4339. * agreement governing use of this software, this software is licensed to you
  4340. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/sbconfig.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/sbconfig.h
  4341. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/sbconfig.h 2010-04-06 22:12:45.000000000 +0200
  4342. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/sbconfig.h 2010-04-07 00:34:09.000000000 +0200
  4343. @@ -1,7 +1,7 @@
  4344. /*
  4345. * Broadcom SiliconBackplane hardware register definitions.
  4346. *
  4347. - * Copyright (C) 1999-2009, Broadcom Corporation
  4348. + * Copyright (C) 1999-2010, Broadcom Corporation
  4349. *
  4350. * Unless you and Broadcom execute a separate written software license
  4351. * agreement governing use of this software, this software is licensed to you
  4352. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/sbhnddma.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/sbhnddma.h
  4353. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/sbhnddma.h 2010-04-06 22:12:45.000000000 +0200
  4354. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/sbhnddma.h 2010-04-07 00:34:09.000000000 +0200
  4355. @@ -2,7 +2,7 @@
  4356. * Generic Broadcom Home Networking Division (HND) DMA engine HW interface
  4357. * This supports the following chips: BCM42xx, 44xx, 47xx .
  4358. *
  4359. - * Copyright (C) 1999-2009, Broadcom Corporation
  4360. + * Copyright (C) 1999-2010, Broadcom Corporation
  4361. *
  4362. * Unless you and Broadcom execute a separate written software license
  4363. * agreement governing use of this software, this software is licensed to you
  4364. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/sbpcmcia.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/sbpcmcia.h
  4365. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/sbpcmcia.h 2010-04-06 22:12:45.000000000 +0200
  4366. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/sbpcmcia.h 2010-04-07 00:34:09.000000000 +0200
  4367. @@ -1,7 +1,7 @@
  4368. /*
  4369. * BCM43XX Sonics SiliconBackplane PCMCIA core hardware definitions.
  4370. *
  4371. - * Copyright (C) 1999-2009, Broadcom Corporation
  4372. + * Copyright (C) 1999-2010, Broadcom Corporation
  4373. *
  4374. * Unless you and Broadcom execute a separate written software license
  4375. * agreement governing use of this software, this software is licensed to you
  4376. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/sbsdio.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/sbsdio.h
  4377. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/sbsdio.h 2010-04-06 22:12:45.000000000 +0200
  4378. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/sbsdio.h 2010-04-07 00:34:09.000000000 +0200
  4379. @@ -4,7 +4,7 @@
  4380. *
  4381. * SDIO core support 1bit, 4 bit SDIO mode as well as SPI mode.
  4382. *
  4383. - * Copyright (C) 1999-2009, Broadcom Corporation
  4384. + * Copyright (C) 1999-2010, Broadcom Corporation
  4385. *
  4386. * Unless you and Broadcom execute a separate written software license
  4387. * agreement governing use of this software, this software is licensed to you
  4388. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/sbsdpcmdev.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/sbsdpcmdev.h
  4389. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/sbsdpcmdev.h 2010-04-06 22:12:45.000000000 +0200
  4390. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/sbsdpcmdev.h 2010-04-07 00:34:09.000000000 +0200
  4391. @@ -1,7 +1,7 @@
  4392. /*
  4393. * Broadcom SiliconBackplane SDIO/PCMCIA hardware-specific device core support
  4394. *
  4395. - * Copyright (C) 1999-2009, Broadcom Corporation
  4396. + * Copyright (C) 1999-2010, Broadcom Corporation
  4397. *
  4398. * Unless you and Broadcom execute a separate written software license
  4399. * agreement governing use of this software, this software is licensed to you
  4400. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/sbsocram.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/sbsocram.h
  4401. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/sbsocram.h 2010-04-06 22:12:45.000000000 +0200
  4402. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/sbsocram.h 2010-04-07 00:34:09.000000000 +0200
  4403. @@ -1,7 +1,7 @@
  4404. /*
  4405. * BCM47XX Sonics SiliconBackplane embedded ram core
  4406. *
  4407. - * Copyright (C) 1999-2009, Broadcom Corporation
  4408. + * Copyright (C) 1999-2010, Broadcom Corporation
  4409. *
  4410. * Unless you and Broadcom execute a separate written software license
  4411. * agreement governing use of this software, this software is licensed to you
  4412. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/sdio.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/sdio.h
  4413. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/sdio.h 2010-04-06 22:12:45.000000000 +0200
  4414. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/sdio.h 2010-04-07 00:34:09.000000000 +0200
  4415. @@ -2,7 +2,7 @@
  4416. * SDIO spec header file
  4417. * Protocol and standard (common) device definitions
  4418. *
  4419. - * Copyright (C) 1999-2009, Broadcom Corporation
  4420. + * Copyright (C) 1999-2010, Broadcom Corporation
  4421. *
  4422. * Unless you and Broadcom execute a separate written software license
  4423. * agreement governing use of this software, this software is licensed to you
  4424. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/sdioh.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/sdioh.h
  4425. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/sdioh.h 2010-04-06 22:12:45.000000000 +0200
  4426. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/sdioh.h 2010-04-07 00:34:09.000000000 +0200
  4427. @@ -2,7 +2,7 @@
  4428. * SDIO Host Controller Spec header file
  4429. * Register map and definitions for the Standard Host Controller
  4430. *
  4431. - * Copyright (C) 1999-2009, Broadcom Corporation
  4432. + * Copyright (C) 1999-2010, Broadcom Corporation
  4433. *
  4434. * Unless you and Broadcom execute a separate written software license
  4435. * agreement governing use of this software, this software is licensed to you
  4436. @@ -22,7 +22,7 @@
  4437. * software in any way with any other Broadcom software provided under a license
  4438. * other than the GPL, without Broadcom's express prior written consent.
  4439. *
  4440. - * $Id: sdioh.h,v 13.13.18.1.16.2 2009/07/28 17:54:46 Exp $
  4441. + * $Id: sdioh.h,v 13.13.18.1.16.3 2009/12/08 22:34:21 Exp $
  4442. */
  4443.  
  4444. #ifndef _SDIOH_H
  4445. @@ -64,6 +64,7 @@
  4446. #define SD_Capabilities_Reserved 0x044
  4447. #define SD_MaxCurCap 0x048
  4448. #define SD_MaxCurCap_Reserved 0x04C
  4449. +#define SD_ADMA_SysAddr 0x58
  4450. #define SD_SlotInterruptStatus 0x0FC
  4451. #define SD_HostControllerVersion 0x0FE
  4452.  
  4453. @@ -81,6 +82,8 @@
  4454. #define CAP_MAXBLOCK_S 16
  4455. #define CAP_ADMA2_M BITFIELD_MASK(1)
  4456. #define CAP_ADMA2_S 19
  4457. +#define CAP_ADMA1_M BITFIELD_MASK(1)
  4458. +#define CAP_ADMA1_S 20
  4459. #define CAP_HIGHSPEED_M BITFIELD_MASK(1)
  4460. #define CAP_HIGHSPEED_S 21
  4461. #define CAP_DMA_M BITFIELD_MASK(1)
  4462. @@ -191,6 +194,8 @@
  4463. #define HOST_DATA_WIDTH_M BITFIELD_MASK(1) /* Bit 1 4 bit enable */
  4464. #define HOST_DATA_WIDTH_S 1
  4465. #define HOST_HI_SPEED_EN_M BITFIELD_MASK(1) /* Bit 2 High speed vs low speed */
  4466. +#define HOST_DMA_SEL_S 3
  4467. +#define HOST_DMA_SEL_M BITFIELD_MASK(2) /* Bit 4:3 DMA Select */
  4468. #define HOST_HI_SPEED_EN_S 2
  4469.  
  4470. /* misc defines */
  4471. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/sdiovar.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/sdiovar.h
  4472. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/sdiovar.h 2010-04-06 22:12:45.000000000 +0200
  4473. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/sdiovar.h 2010-04-07 00:34:09.000000000 +0200
  4474. @@ -2,7 +2,7 @@
  4475. * Structure used by apps whose drivers access SDIO drivers.
  4476. * Pulled out separately so dhdu and wlu can both use it.
  4477. *
  4478. - * Copyright (C) 1999-2009, Broadcom Corporation
  4479. + * Copyright (C) 1999-2010, Broadcom Corporation
  4480. *
  4481. * Unless you and Broadcom execute a separate written software license
  4482. * agreement governing use of this software, this software is licensed to you
  4483. @@ -22,7 +22,7 @@
  4484. * software in any way with any other Broadcom software provided under a license
  4485. * other than the GPL, without Broadcom's express prior written consent.
  4486. *
  4487. - * $Id: sdiovar.h,v 13.5.14.2.16.1 2008/11/20 00:51:32 Exp $
  4488. + * $Id: sdiovar.h,v 13.5.14.2.16.2 2009/12/08 22:34:21 Exp $
  4489. */
  4490.  
  4491. #ifndef _sdiovar_h_
  4492. @@ -48,6 +48,7 @@
  4493. #define SDH_DATA_VAL 0x0010 /* Data */
  4494. #define SDH_CTRL_VAL 0x0020 /* Control Regs */
  4495. #define SDH_LOG_VAL 0x0040 /* Enable bcmlog */
  4496. +#define SDH_DMA_VAL 0x0080 /* DMA */
  4497.  
  4498. #define NUM_PREV_TRANSACTIONS 16
  4499.  
  4500. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/siutils.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/siutils.h
  4501. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/siutils.h 2010-04-06 22:12:45.000000000 +0200
  4502. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/siutils.h 2010-04-07 00:34:09.000000000 +0200
  4503. @@ -2,7 +2,7 @@
  4504. * Misc utility routines for accessing the SOC Interconnects
  4505. * of Broadcom HNBU chips.
  4506. *
  4507. - * Copyright (C) 1999-2009, Broadcom Corporation
  4508. + * Copyright (C) 1999-2010, Broadcom Corporation
  4509. *
  4510. * Unless you and Broadcom execute a separate written software license
  4511. * agreement governing use of this software, this software is licensed to you
  4512. @@ -22,7 +22,7 @@
  4513. * software in any way with any other Broadcom software provided under a license
  4514. * other than the GPL, without Broadcom's express prior written consent.
  4515. *
  4516. - * $Id: siutils.h,v 13.197.4.2.4.3.8.12 2009/09/22 13:28:16 Exp $
  4517. + * $Id: siutils.h,v 13.197.4.2.4.3.8.14 2010/03/19 18:31:43 Exp $
  4518. */
  4519.  
  4520.  
  4521. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/trxhdr.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/trxhdr.h
  4522. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/trxhdr.h 2010-04-06 22:12:45.000000000 +0200
  4523. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/trxhdr.h 2010-04-07 00:34:09.000000000 +0200
  4524. @@ -1,7 +1,7 @@
  4525. /*
  4526. * TRX image file header format.
  4527. *
  4528. - * Copyright (C) 1999-2009, Broadcom Corporation
  4529. + * Copyright (C) 1999-2010, Broadcom Corporation
  4530. *
  4531. * Unless you and Broadcom execute a separate written software license
  4532. * agreement governing use of this software, this software is licensed to you
  4533. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/typedefs.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/typedefs.h
  4534. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/typedefs.h 2010-04-06 22:12:45.000000000 +0200
  4535. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/typedefs.h 2010-04-07 00:34:09.000000000 +0200
  4536. @@ -1,5 +1,5 @@
  4537. /*
  4538. - * Copyright (C) 1999-2009, Broadcom Corporation
  4539. + * Copyright (C) 1999-2010, Broadcom Corporation
  4540. *
  4541. * Unless you and Broadcom execute a separate written software license
  4542. * agreement governing use of this software, this software is licensed to you
  4543. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/wlioctl.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/wlioctl.h
  4544. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/include/wlioctl.h 2010-04-06 22:12:45.000000000 +0200
  4545. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/include/wlioctl.h 2010-04-07 00:34:09.000000000 +0200
  4546. @@ -4,7 +4,7 @@
  4547. *
  4548. * Definitions subject to change without notice.
  4549. *
  4550. - * Copyright (C) 1999-2009, Broadcom Corporation
  4551. + * Copyright (C) 1999-2010, Broadcom Corporation
  4552. *
  4553. * Unless you and Broadcom execute a separate written software license
  4554. * agreement governing use of this software, this software is licensed to you
  4555. @@ -24,7 +24,7 @@
  4556. * software in any way with any other Broadcom software provided under a license
  4557. * other than the GPL, without Broadcom's express prior written consent.
  4558. *
  4559. - * $Id: wlioctl.h,v 1.601.4.15.2.14.2.53 2009/10/27 06:18:20 Exp $
  4560. + * $Id: wlioctl.h,v 1.601.4.15.2.14.2.59 2010/02/09 13:23:22 Exp $
  4561. */
  4562.  
  4563.  
  4564. @@ -186,6 +186,7 @@
  4565. #define WL_SCAN_RESULTS_PARTIAL 1
  4566. #define WL_SCAN_RESULTS_PENDING 2
  4567. #define WL_SCAN_RESULTS_ABORTED 3
  4568. +#define WL_SCAN_RESULTS_NO_MEM 4
  4569.  
  4570. #define ESCAN_REQ_VERSION 1
  4571.  
  4572. @@ -1598,6 +1599,12 @@
  4573. #define WL_COEX_40MHZ_INTOLERANT 0x02
  4574. #define WL_COEX_WIDTH20 0x04
  4575.  
  4576. +typedef struct wl_action_obss_coex_req {
  4577. + uint8 info;
  4578. + uint8 num;
  4579. + uint8 ch_list[1];
  4580. +} wl_action_obss_coex_req_t;
  4581. +
  4582.  
  4583. #define MAX_RSSI_LEVELS 8
  4584.  
  4585. @@ -1613,6 +1620,39 @@
  4586.  
  4587.  
  4588.  
  4589. +#define WLFEATURE_DISABLE_11N 0x00000001
  4590. +#define WLFEATURE_DISABLE_11N_STBC_TX 0x00000002
  4591. +#define WLFEATURE_DISABLE_11N_STBC_RX 0x00000004
  4592. +#define WLFEATURE_DISABLE_11N_SGI_TX 0x00000008
  4593. +#define WLFEATURE_DISABLE_11N_SGI_RX 0x00000010
  4594. +#define WLFEATURE_DISABLE_11N_AMPDU_TX 0x00000020
  4595. +#define WLFEATURE_DISABLE_11N_AMPDU_RX 0x00000040
  4596. +#define WLFEATURE_DISABLE_11N_GF 0x00000080
  4597. +
  4598. +
  4599. +
  4600. +#include <packed_section_end.h>
  4601. +
  4602. +
  4603. +#include <packed_section_start.h>
  4604. +
  4605. +
  4606. +typedef BWL_PRE_PACKED_STRUCT struct sta_prbreq_wps_ie_hdr {
  4607. + struct ether_addr staAddr;
  4608. + uint16 ieLen;
  4609. +} BWL_POST_PACKED_STRUCT sta_prbreq_wps_ie_hdr_t;
  4610. +
  4611. +typedef BWL_PRE_PACKED_STRUCT struct sta_prbreq_wps_ie_data {
  4612. + sta_prbreq_wps_ie_hdr_t hdr;
  4613. + uint8 ieData[1];
  4614. +} BWL_POST_PACKED_STRUCT sta_prbreq_wps_ie_data_t;
  4615. +
  4616. +typedef BWL_PRE_PACKED_STRUCT struct sta_prbreq_wps_ie_list {
  4617. + uint32 totLen;
  4618. + uint8 ieDataList[1];
  4619. +} BWL_POST_PACKED_STRUCT sta_prbreq_wps_ie_list_t;
  4620. +
  4621. +
  4622. #include <packed_section_end.h>
  4623.  
  4624. #endif
  4625. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/linux_osl.c /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/linux_osl.c
  4626. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/linux_osl.c 2010-04-06 22:12:45.000000000 +0200
  4627. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/linux_osl.c 2010-04-07 00:34:09.000000000 +0200
  4628. @@ -1,7 +1,7 @@
  4629. /*
  4630. * Linux OS Independent Layer
  4631. *
  4632. - * Copyright (C) 1999-2009, Broadcom Corporation
  4633. + * Copyright (C) 1999-2010, Broadcom Corporation
  4634. *
  4635. * Unless you and Broadcom execute a separate written software license
  4636. * agreement governing use of this software, this software is licensed to you
  4637. @@ -21,7 +21,7 @@
  4638. * software in any way with any other Broadcom software provided under a license
  4639. * other than the GPL, without Broadcom's express prior written consent.
  4640. *
  4641. - * $Id: linux_osl.c,v 1.125.12.3.8.5 2009/10/27 04:43:04 Exp $
  4642. + * $Id: linux_osl.c,v 1.125.12.3.8.6 2009/12/09 01:29:03 Exp $
  4643. */
  4644.  
  4645.  
  4646. @@ -81,7 +81,7 @@
  4647. bcm_mem_link_t *dbgmem_list;
  4648. };
  4649.  
  4650. -static int16 linuxbcmerrormap[] = \
  4651. +static int16 linuxbcmerrormap[] =
  4652. { 0,
  4653. -EINVAL,
  4654. -EINVAL,
  4655. @@ -120,13 +120,16 @@
  4656. -EIO,
  4657. -ENODEV,
  4658. -EINVAL,
  4659. - -EINVAL
  4660. + -EIO,
  4661. + -EIO,
  4662. + -EINVAL,
  4663. + -EINVAL,
  4664.  
  4665.  
  4666.  
  4667. -#if BCME_LAST != -38
  4668. +#if BCME_LAST != -41
  4669. #error "You need to add a OS error translation in the linuxbcmerrormap \
  4670. - for new error code defined in bcmuitls.h"
  4671. + for new error code defined in bcmutils.h"
  4672. #endif
  4673. };
  4674.  
  4675. @@ -148,10 +151,8 @@
  4676. osl_attach(void *pdev, uint bustype, bool pkttag)
  4677. {
  4678. osl_t *osh;
  4679. - gfp_t flags;
  4680.  
  4681. - flags = (in_atomic()) ? GFP_ATOMIC : GFP_KERNEL;
  4682. - osh = kmalloc(sizeof(osl_t), flags);
  4683. + osh = kmalloc(sizeof(osl_t), GFP_ATOMIC);
  4684. ASSERT(osh);
  4685.  
  4686. bzero(osh, sizeof(osl_t));
  4687. @@ -192,9 +193,9 @@
  4688. STATIC_BUF_TOTAL_LEN))) {
  4689. printk("can not alloc static buf!\n");
  4690. }
  4691. - else {
  4692. - /* printk("alloc static buf at %x!\n", (unsigned int)bcm_static_buf); */
  4693. - }
  4694. + else
  4695. + printk("alloc static buf at %x!\n", (unsigned int)bcm_static_buf);
  4696. +
  4697.  
  4698. init_MUTEX(&bcm_static_buf->static_sem);
  4699.  
  4700. @@ -452,8 +453,8 @@
  4701. osl_malloc(osl_t *osh, uint size)
  4702. {
  4703. void *addr;
  4704. - gfp_t flags;
  4705.  
  4706. +
  4707. if (osh)
  4708. ASSERT(osh->magic == OS_HANDLE_MAGIC);
  4709.  
  4710. @@ -490,8 +491,8 @@
  4711. }
  4712. original:
  4713. #endif
  4714. - flags = (in_atomic()) ? GFP_ATOMIC : GFP_KERNEL;
  4715. - if ((addr = kmalloc(size, flags)) == NULL) {
  4716. +
  4717. + if ((addr = kmalloc(size, GFP_ATOMIC)) == NULL) {
  4718. if (osh)
  4719. osh->failed++;
  4720. return (NULL);
  4721. @@ -603,10 +604,8 @@
  4722. osl_pktdup(osl_t *osh, void *skb)
  4723. {
  4724. void * p;
  4725. - gfp_t flags;
  4726.  
  4727. - flags = (in_atomic()) ? GFP_ATOMIC : GFP_KERNEL;
  4728. - if ((p = skb_clone((struct sk_buff*)skb, flags)) == NULL)
  4729. + if ((p = skb_clone((struct sk_buff*)skb, GFP_ATOMIC)) == NULL)
  4730. return NULL;
  4731.  
  4732.  
  4733. Binärdateien /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/linux_osl.o and /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/linux_osl.o sind verschieden.
  4734. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/miniopt.c /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/miniopt.c
  4735. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/miniopt.c 2010-04-06 22:12:45.000000000 +0200
  4736. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/miniopt.c 2010-04-07 00:34:09.000000000 +0200
  4737. @@ -1,7 +1,7 @@
  4738. /*
  4739. * Description.
  4740. *
  4741. - * Copyright (C) 1999-2009, Broadcom Corporation
  4742. + * Copyright (C) 1999-2010, Broadcom Corporation
  4743. *
  4744. * Unless you and Broadcom execute a separate written software license
  4745. * agreement governing use of this software, this software is licensed to you
  4746. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/sbutils.c /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/sbutils.c
  4747. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/sbutils.c 2010-04-06 22:12:45.000000000 +0200
  4748. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/sbutils.c 2010-04-07 00:34:09.000000000 +0200
  4749. @@ -2,7 +2,7 @@
  4750. * Misc utility routines for accessing chip-specific features
  4751. * of the SiliconBackplane-based Broadcom chips.
  4752. *
  4753. - * Copyright (C) 1999-2009, Broadcom Corporation
  4754. + * Copyright (C) 1999-2010, Broadcom Corporation
  4755. *
  4756. * Unless you and Broadcom execute a separate written software license
  4757. * agreement governing use of this software, this software is licensed to you
  4758. Binärdateien /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/sbutils.o and /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/sbutils.o sind verschieden.
  4759. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/siutils.c /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/siutils.c
  4760. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/siutils.c 2010-04-06 22:12:45.000000000 +0200
  4761. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/siutils.c 2010-04-07 00:34:09.000000000 +0200
  4762. @@ -2,7 +2,7 @@
  4763. * Misc utility routines for accessing chip-specific features
  4764. * of the SiliconBackplane-based Broadcom chips.
  4765. *
  4766. - * Copyright (C) 1999-2009, Broadcom Corporation
  4767. + * Copyright (C) 1999-2010, Broadcom Corporation
  4768. *
  4769. * Unless you and Broadcom execute a separate written software license
  4770. * agreement governing use of this software, this software is licensed to you
  4771. @@ -22,7 +22,7 @@
  4772. * software in any way with any other Broadcom software provided under a license
  4773. * other than the GPL, without Broadcom's express prior written consent.
  4774. *
  4775. - * $Id: siutils.c,v 1.662.4.4.4.16.4.25 2009/09/22 13:32:03 Exp $
  4776. + * $Id: siutils.c,v 1.662.4.4.4.16.4.26 2010/02/01 05:51:56 Exp $
  4777. */
  4778.  
  4779. #include <typedefs.h>
  4780. @@ -1036,7 +1036,7 @@
  4781. sdpregs = (sdpcmd_regs_t *)si_setcore(sih, SDIOD_CORE_ID, 0);
  4782. ASSERT(sdpregs);
  4783.  
  4784. - SI_MSG(("si_sdio_init: For PCMCIA/SDIO Corerev %d, enable ints from core %d " \
  4785. + SI_MSG(("si_sdio_init: For PCMCIA/SDIO Corerev %d, enable ints from core %d "
  4786. "through SD core %d (%p)\n",
  4787. sih->buscorerev, idx, sii->curidx, sdpregs));
  4788.  
  4789. Binärdateien /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/siutils.o and /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/siutils.o sind verschieden.
  4790. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/siutils_priv.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/siutils_priv.h
  4791. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/siutils_priv.h 2010-04-06 22:12:45.000000000 +0200
  4792. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/siutils_priv.h 2010-04-07 00:34:09.000000000 +0200
  4793. @@ -1,7 +1,7 @@
  4794. /*
  4795. * Include file private to the SOC Interconnect support files.
  4796. *
  4797. - * Copyright (C) 1999-2009, Broadcom Corporation
  4798. + * Copyright (C) 1999-2010, Broadcom Corporation
  4799. *
  4800. * Unless you and Broadcom execute a separate written software license
  4801. * agreement governing use of this software, this software is licensed to you
  4802. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/wl_iw.c /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/wl_iw.c
  4803. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/wl_iw.c 2010-04-06 22:12:45.000000000 +0200
  4804. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/wl_iw.c 2010-04-07 00:34:09.000000000 +0200
  4805. @@ -1,7 +1,7 @@
  4806. /*
  4807. * Linux Wireless Extensions support
  4808. *
  4809. - * Copyright (C) 1999-2009, Broadcom Corporation
  4810. + * Copyright (C) 1999-2010, Broadcom Corporation
  4811. *
  4812. * Unless you and Broadcom execute a separate written software license
  4813. * agreement governing use of this software, this software is licensed to you
  4814. @@ -21,7 +21,7 @@
  4815. * software in any way with any other Broadcom software provided under a license
  4816. * other than the GPL, without Broadcom's express prior written consent.
  4817. *
  4818. - * $Id: wl_iw.c,v 1.51.4.9.2.6.4.57 2009/10/27 04:43:46 Exp $
  4819. + * $Id: wl_iw.c,v 1.51.4.9.2.6.4.90 2010/03/31 18:03:04 Exp $
  4820. */
  4821.  
  4822.  
  4823. @@ -48,21 +48,33 @@
  4824. #include <proto/ethernet.h>
  4825. #include <dngl_stats.h>
  4826. #include <dhd.h>
  4827. -#define WL_ERROR(x)
  4828. +#define WL_ERROR(x) printf x
  4829. #define WL_TRACE(x)
  4830. #define WL_ASSOC(x)
  4831. #define WL_INFORM(x)
  4832. #define WL_WSEC(x)
  4833. -#define WL_TRACE_PMK(x)
  4834.  
  4835. #include <wl_iw.h>
  4836.  
  4837. +
  4838. +
  4839. +#define IW_WSEC_ENABLED(wsec) ((wsec) & (WEP_ENABLED | TKIP_ENABLED | AES_ENABLED))
  4840. +
  4841. #include <linux/rtnetlink.h>
  4842. -#include <linux/mutex.h>
  4843.  
  4844. #define WL_IW_USE_ISCAN 1
  4845. #define ENABLE_ACTIVE_PASSIVE_SCAN_SUPPRESS 1
  4846.  
  4847. +#if defined(SOFTAP)
  4848. +#define WL_SOFTAP(x) printk x
  4849. +static struct net_device *priv_dev;
  4850. +static bool ap_cfg_running = FALSE;
  4851. +static bool ap_fw_loaded = FALSE;
  4852. +static int ap_mode = 0;
  4853. +struct net_device *ap_net_dev = NULL;
  4854. +struct semaphore ap_eth_sema;
  4855. +static int wl_iw_set_ap_security(struct net_device *dev, struct ap_profile *ap);
  4856. +#endif
  4857.  
  4858. #define WL_IW_IOCTL_CALL(func_call) \
  4859. do { \
  4860. @@ -70,7 +82,6 @@
  4861. } while (0)
  4862.  
  4863. static int g_onoff = G_WLAN_SET_ON;
  4864. -static struct mutex wl_start_lock;
  4865.  
  4866. extern bool wl_iw_conn_status_str(uint32 event_type, uint32 status,
  4867. uint32 reason, char* stringBuf, uint buflen);
  4868. @@ -113,11 +124,13 @@
  4869. #endif
  4870.  
  4871. static void *g_scan = NULL;
  4872. -static uint g_scan_specified_ssid;
  4873. +static volatile uint g_scan_specified_ssid;
  4874. +static wlc_ssid_t g_specific_ssid;
  4875.  
  4876. static wlc_ssid_t g_ssid;
  4877.  
  4878. -wl_iw_ss_cache_ctrl_t g_ss_cache_ctrl;
  4879. +static wl_iw_ss_cache_ctrl_t g_ss_cache_ctrl;
  4880. +static volatile uint g_first_broadcast_scan;
  4881.  
  4882.  
  4883. #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0))
  4884. @@ -134,11 +147,13 @@
  4885. #endif
  4886.  
  4887. #if defined(WL_IW_USE_ISCAN)
  4888. -
  4889. -static wlc_ssid_t g_specific_ssid; /* chache specific ssid request */
  4890. +static void wl_iw_free_ss_cache(void);
  4891. +static int wl_iw_run_ss_cache_timer(int kick_off);
  4892. +int wl_iw_iscan_set_scan_broadcast_prep(struct net_device *dev, uint flag);
  4893. #define ISCAN_STATE_IDLE 0
  4894. #define ISCAN_STATE_SCANING 1
  4895.  
  4896. +
  4897. #define WLC_IW_ISCAN_MAXLEN 2048
  4898. typedef struct iscan_buf {
  4899. struct iscan_buf * next;
  4900. @@ -163,7 +178,7 @@
  4901.  
  4902. char ioctlbuf[WLC_IOCTL_SMLEN];
  4903. } iscan_info_t;
  4904. -
  4905. +#define COEX_DHCP 1
  4906. static void wl_iw_bt_flag_set(struct net_device *dev, bool set);
  4907. static void wl_iw_bt_release(void);
  4908.  
  4909. @@ -258,31 +273,35 @@
  4910. struct ifreq ifr;
  4911. wl_ioctl_t ioc;
  4912. mm_segment_t fs;
  4913. - int ret = -EINVAL;
  4914. -
  4915. - if (g_onoff == G_WLAN_SET_ON) {
  4916. - memset(&ioc, 0, sizeof(ioc));
  4917. - ioc.cmd = cmd;
  4918. - ioc.buf = arg;
  4919. - ioc.len = len;
  4920. -
  4921. - strcpy(ifr.ifr_name, dev->name);
  4922. - ifr.ifr_data = (caddr_t) &ioc;
  4923. -
  4924. - ret = dev_open(dev);
  4925. - if (ret) {
  4926. - WL_ERROR(("%s: Error dev_open: %d\n", __func__, ret));
  4927. - return ret;
  4928. - }
  4929. + int ret = -1;
  4930.  
  4931. - fs = get_fs();
  4932. - set_fs(get_ds());
  4933. - ret = dev->do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
  4934. - set_fs(fs);
  4935. - }
  4936. - else {
  4937. - WL_TRACE(("%s: call after driver stop\n", __FUNCTION__));
  4938. + if (!dev) {
  4939. + WL_ERROR(("%s: dev is null\n", __FUNCTION__));
  4940. + return ret;
  4941. }
  4942. +
  4943. + WL_TRACE(("\n%s, PID:%x: send Local IOCTL -> dhd: cmd:0x%x, buf:%p, len:%d ,\n",
  4944. + __FUNCTION__, current->pid, cmd, arg, len));
  4945. + memset(&ioc, 0, sizeof(ioc));
  4946. + ioc.cmd = cmd;
  4947. + ioc.buf = arg;
  4948. + ioc.len = len;
  4949. +
  4950. + strcpy(ifr.ifr_name, dev->name);
  4951. + ifr.ifr_data = (caddr_t) &ioc;
  4952. +
  4953. +
  4954. + dev_open(dev);
  4955. +
  4956. + fs = get_fs();
  4957. + set_fs(get_ds());
  4958. +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31)
  4959. + ret = dev->do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
  4960. +#else
  4961. + ret = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
  4962. +#endif
  4963. + set_fs(fs);
  4964. +
  4965. return ret;
  4966. }
  4967.  
  4968. @@ -372,7 +391,11 @@
  4969. char *name,
  4970. char *buf, int len)
  4971. {
  4972. +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31)
  4973. char ioctlbuf[MAX_WLIW_IOCTL_LEN];
  4974. +#else
  4975. + static char ioctlbuf[MAX_WLIW_IOCTL_LEN];
  4976. +#endif
  4977. uint buflen;
  4978.  
  4979. buflen = bcm_mkiovar(name, buf, len, ioctlbuf, sizeof(ioctlbuf));
  4980. @@ -380,7 +403,7 @@
  4981.  
  4982. return (dev_wlc_ioctl(dev, WLC_SET_VAR, ioctlbuf, buflen));
  4983. }
  4984. -#endif
  4985. +#endif
  4986.  
  4987.  
  4988. static int
  4989. @@ -389,9 +412,12 @@
  4990. char *name,
  4991. char *buf, int buflen)
  4992. {
  4993. +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31)
  4994. char ioctlbuf[MAX_WLIW_IOCTL_LEN];
  4995. +#else
  4996. + static char ioctlbuf[MAX_WLIW_IOCTL_LEN];
  4997. +#endif
  4998. int error;
  4999. -
  5000. uint len;
  5001.  
  5002. len = bcm_mkiovar(name, NULL, 0, ioctlbuf, sizeof(ioctlbuf));
  5003. @@ -529,9 +555,9 @@
  5004. int country_offset;
  5005. int country_code_size;
  5006.  
  5007. - WL_TRACE(("%s\n", __FUNCTION__));
  5008. memset(country_code, 0, sizeof(country_code));
  5009.  
  5010. +
  5011. country_offset = strcspn(extra, " ");
  5012. country_code_size = strlen(extra) - country_offset;
  5013.  
  5014. @@ -713,15 +739,14 @@
  5015. )
  5016. {
  5017. static int rssi = 0;
  5018. + static wlc_ssid_t ssid = {0};
  5019. int error = 0;
  5020. - wlc_ssid_t ssid;
  5021. char *p = extra;
  5022. static char ssidbuf[SSID_FMT_BUF_LEN];
  5023. scb_val_t scb_val;
  5024.  
  5025. - scb_val.val = 0;
  5026. + bzero(&scb_val, sizeof(scb_val_t));
  5027.  
  5028. - bzero(&ssid, sizeof(ssid));
  5029. if (g_onoff == G_WLAN_SET_ON) {
  5030. error = dev_wlc_ioctl(dev, WLC_GET_RSSI, &scb_val, sizeof(scb_val_t));
  5031. rssi = dtoh32(scb_val.val);
  5032. @@ -731,10 +756,6 @@
  5033. ssid.SSID_len = dtoh32(ssid.SSID_len);
  5034. }
  5035.  
  5036. - if (!ssid.SSID_len) {
  5037. - return 0;
  5038. - }
  5039. -
  5040. wl_format_ssid(ssidbuf, ssid.SSID, dtoh32(ssid.SSID_len));
  5041. p += snprintf(p, MAX_WX_STRING, "%s rssi %d ", ssidbuf, rssi);
  5042. wrqu->data.length = p - extra + 1;
  5043. @@ -765,18 +786,18 @@
  5044. return 0;
  5045. }
  5046.  
  5047. -#ifdef WL_IW_USE_THREAD_WL_OFF
  5048. static int
  5049. _wl_control_sysioc_thread_wl_off(void *data)
  5050. {
  5051. struct wl_ctrl *wl_ctl = (struct wl_ctrl *)data;
  5052.  
  5053. + wl_iw_t *iw = *(wl_iw_t **)netdev_priv(wl_ctl->dev);
  5054. DAEMONIZE("wlcontrol_sysioc");
  5055.  
  5056. WL_TRACE(("%s Entered\n", __FUNCTION__));
  5057. - net_os_wake_lock(wl_ctl->dev);
  5058.  
  5059. - mutex_lock(&wl_start_lock);
  5060. + WAKE_LOCK_INIT(iw->pub, WAKE_LOCK_OFF, "sysioc_thread_wl_off");
  5061. + WAKE_LOCK(iw->pub, WAKE_LOCK_OFF);
  5062. while (down_interruptible(&wl_ctl->timer_sem) == 0) {
  5063.  
  5064. WL_TRACE(("%s Turning off wifi dev\n", __FUNCTION__));
  5065. @@ -789,6 +810,17 @@
  5066.  
  5067. dhd_dev_reset(wl_ctl->dev, 1);
  5068.  
  5069. +#if defined(WL_IW_USE_ISCAN)
  5070. +
  5071. + wl_iw_free_ss_cache();
  5072. + wl_iw_run_ss_cache_timer(0);
  5073. + memset(g_scan, 0, G_SCAN_RESULTS);
  5074. +
  5075. + g_ss_cache_ctrl.m_link_down = 1;
  5076. + g_scan_specified_ssid = 0;
  5077. +
  5078. + g_first_broadcast_scan = BROADCAST_SCAN_FIRST_IDLE;
  5079. +#endif
  5080. #if defined(BCMLXSDMMC)
  5081. sdioh_stop(NULL);
  5082. #endif
  5083. @@ -797,50 +829,17 @@
  5084.  
  5085. wl_iw_send_priv_event(wl_ctl->dev, "STOP");
  5086.  
  5087. - net_os_wake_lock_timeout_enable(wl_ctl->dev);
  5088. break;
  5089. }
  5090. - mutex_unlock(&wl_start_lock);
  5091. +
  5092. WL_TRACE(("%s Exited\n", __FUNCTION__));
  5093. - net_os_wake_unlock(wl_ctl->dev);
  5094. + WAKE_UNLOCK(iw->pub, WAKE_LOCK_OFF);
  5095. + WAKE_LOCK_DESTROY(iw->pub, WAKE_LOCK_OFF);
  5096.  
  5097. complete_and_exit(&wl_ctl->sysioc_exited, 0);
  5098. KILL_PROC(wl_ctl->sysioc_pid, SIGTERM);
  5099. }
  5100. -#endif
  5101. -
  5102. -int
  5103. -wl_control_wl_start(struct net_device *dev)
  5104. -{
  5105. - int ret = 0;
  5106. -
  5107. - WL_TRACE(("Enter %s \n", __FUNCTION__));
  5108. -
  5109. - mutex_lock(&wl_start_lock);
  5110. - if (g_onoff == G_WLAN_SET_OFF) {
  5111. - dhd_customer_gpio_wlan_ctrl(WLAN_RESET_ON);
  5112. -
  5113. -#if defined(BCMLXSDMMC)
  5114. - sdioh_start(NULL, 0);
  5115. -#endif
  5116. -
  5117. - dhd_dev_reset(dev, 0);
  5118. -
  5119. -#if defined(BCMLXSDMMC)
  5120. - sdioh_start(NULL, 1);
  5121. -#endif
  5122. -
  5123. - dhd_dev_init_ioctl(dev);
  5124. -
  5125. - g_onoff = G_WLAN_SET_ON;
  5126. - }
  5127. - WL_TRACE(("Exited %s \n", __FUNCTION__));
  5128. -
  5129. - mutex_unlock(&wl_start_lock);
  5130. - return ret;
  5131. -}
  5132.  
  5133. -#ifdef WL_IW_USE_THREAD_WL_OFF
  5134. static void
  5135. wl_iw_stop_timerfunc(ulong data)
  5136. {
  5137. @@ -848,11 +847,10 @@
  5138.  
  5139. WL_TRACE(("%s\n", __FUNCTION__));
  5140.  
  5141. - del_timer_sync(wl_ctl->timer);
  5142. + del_timer(wl_ctl->timer);
  5143.  
  5144. up(&wl_ctl->timer_sem);
  5145. }
  5146. -#endif
  5147.  
  5148. static int
  5149. wl_iw_control_wl_off(
  5150. @@ -861,18 +859,24 @@
  5151. )
  5152. {
  5153. int ret = 0;
  5154. -#ifdef WL_IW_USE_THREAD_WL_OFF
  5155. static struct wl_ctrl ctl;
  5156. static struct timer_list timer;
  5157. -#endif
  5158. +
  5159. WL_TRACE(("Enter %s\n", __FUNCTION__));
  5160.  
  5161. -#ifdef WL_IW_USE_THREAD_WL_OFF
  5162. +#ifdef SOFTAP
  5163. + ap_mode = 0;
  5164. + ap_cfg_running = FALSE;
  5165. +#endif
  5166. +
  5167. +
  5168. +
  5169. ctl.timer = &timer;
  5170. ctl.dev = dev;
  5171. sema_init(&ctl.timer_sem, 0);
  5172. init_completion(&ctl.sysioc_exited);
  5173.  
  5174. +
  5175. ctl.sysioc_pid = kernel_thread(_wl_control_sysioc_thread_wl_off, &ctl, 0);
  5176.  
  5177. timer.data = (ulong)&ctl;
  5178. @@ -880,28 +884,7 @@
  5179. init_timer(&timer);
  5180. timer.expires = jiffies + 2000 * HZ / 1000;
  5181. add_timer(&timer);
  5182. -#else
  5183. - mutex_lock(&wl_start_lock);
  5184. - if (g_onoff == G_WLAN_SET_ON) {
  5185. - g_onoff = G_WLAN_SET_OFF;
  5186. -#if defined(WL_IW_USE_ISCAN)
  5187. - g_iscan->iscan_state = ISCAN_STATE_IDLE;
  5188. -#endif
  5189. -
  5190. - dhd_dev_reset(dev, 1);
  5191. -
  5192. -#if defined(BCMLXSDMMC)
  5193. - sdioh_stop(NULL);
  5194. -#endif
  5195. -
  5196. - dhd_customer_gpio_wlan_ctrl(WLAN_RESET_OFF);
  5197. -
  5198. - wl_iw_send_priv_event(dev, "STOP");
  5199.  
  5200. - net_os_wake_lock_timeout_enable(dev);
  5201. - }
  5202. - mutex_unlock(&wl_start_lock);
  5203. -#endif
  5204. WL_TRACE(("Exited %s\n", __FUNCTION__));
  5205.  
  5206. return ret;
  5207. @@ -917,17 +900,347 @@
  5208.  
  5209. WL_TRACE(("Enter %s \n", __FUNCTION__));
  5210.  
  5211. - ret = wl_control_wl_start(dev);
  5212. + if (g_onoff == G_WLAN_SET_OFF) {
  5213. + dhd_customer_gpio_wlan_ctrl(WLAN_RESET_ON);
  5214. +
  5215. +#if defined(BCMLXSDMMC)
  5216. + sdioh_start(NULL, 0);
  5217. +#endif
  5218. +
  5219. + dhd_dev_reset(dev, 0);
  5220. +
  5221. +#if defined(BCMLXSDMMC)
  5222. + sdioh_start(NULL, 1);
  5223. +#endif
  5224. +
  5225. + dhd_dev_init_ioctl(dev);
  5226. +
  5227. + g_onoff = G_WLAN_SET_ON;
  5228. + }
  5229.  
  5230. wl_iw_send_priv_event(dev, "START");
  5231.  
  5232. - net_os_wake_lock_timeout_enable(dev);
  5233. +#ifdef SOFTAP
  5234. + if (!ap_fw_loaded) {
  5235. + wl_iw_iscan_set_scan_broadcast_prep(dev, 0);
  5236. + }
  5237. +#else
  5238. + wl_iw_iscan_set_scan_broadcast_prep(dev, 0);
  5239. +#endif
  5240. +
  5241.  
  5242. WL_TRACE(("Exited %s \n", __FUNCTION__));
  5243.  
  5244. return ret;
  5245. }
  5246.  
  5247. +#ifdef SOFTAP
  5248. +static struct ap_profile my_ap;
  5249. +static int set_ap_cfg(struct net_device *dev, struct ap_profile *ap);
  5250. +static int get_assoc_sta_list(struct net_device *dev, char *buf, int len);
  5251. +static int set_ap_mac_list(struct net_device *dev, char *buf);
  5252. +
  5253. +#define PTYPE_STRING 0
  5254. +#define PTYPE_INTDEC 1
  5255. +#define PTYPE_INTHEX 2
  5256. +#define PTYPE_STR_HEX 3
  5257. +int get_parmeter_from_string(
  5258. + char **str_ptr, const char *token, int param_type, void *dst, int param_max_len);
  5259. +
  5260. +#endif
  5261. +
  5262. +int hex2num(char c)
  5263. +{
  5264. + if (c >= '0' && c <= '9')
  5265. + return c - '0';
  5266. + if (c >= 'a' && c <= 'f')
  5267. + return c - 'a' + 10;
  5268. + if (c >= 'A' && c <= 'F')
  5269. + return c - 'A' + 10;
  5270. + return -1;
  5271. +}
  5272. +
  5273. +int hex2byte(const char *hex)
  5274. +{
  5275. + int a, b;
  5276. + a = hex2num(*hex++);
  5277. + if (a < 0)
  5278. + return -1;
  5279. + b = hex2num(*hex++);
  5280. + if (b < 0)
  5281. + return -1;
  5282. + return (a << 4) | b;
  5283. +}
  5284. +
  5285. +
  5286. +
  5287. +int hstr_2_buf(const char *txt, u8 *buf, int len)
  5288. +{
  5289. + int i;
  5290. +
  5291. + for (i = 0; i < len; i++) {
  5292. + int a, b;
  5293. +
  5294. + a = hex2num(*txt++);
  5295. + if (a < 0)
  5296. + return -1;
  5297. + b = hex2num(*txt++);
  5298. + if (b < 0)
  5299. + return -1;
  5300. + *buf++ = (a << 4) | b;
  5301. + }
  5302. +
  5303. + return 0;
  5304. +}
  5305. +
  5306. +#ifdef SOFTAP
  5307. +int init_ap_profile_from_string(char *param_str, struct ap_profile *ap_cfg)
  5308. +{
  5309. + char *str_ptr = param_str;
  5310. + char sub_cmd[16];
  5311. + int ret = 0;
  5312. +
  5313. + memset(sub_cmd, 0, sizeof(sub_cmd));
  5314. + memset(ap_cfg, 0, sizeof(struct ap_profile));
  5315. +
  5316. +
  5317. + if (get_parmeter_from_string(&str_ptr, "ASCII_CMD=",
  5318. + PTYPE_STRING, sub_cmd, SSID_LEN) != 0) {
  5319. + return -1;
  5320. + }
  5321. + if (strncmp(sub_cmd, "AP_CFG", 6)) {
  5322. + WL_ERROR(("ERROR: sub_cmd:%s != 'AP_CFG'!\n", sub_cmd));
  5323. + return -1;
  5324. + }
  5325. +
  5326. +
  5327. +
  5328. + ret = get_parmeter_from_string(&str_ptr, "SSID=", PTYPE_STRING, ap_cfg->ssid, SSID_LEN);
  5329. +
  5330. + ret |= get_parmeter_from_string(&str_ptr, "SEC=", PTYPE_STRING, ap_cfg->sec, SEC_LEN);
  5331. +
  5332. + ret |= get_parmeter_from_string(&str_ptr, "KEY=", PTYPE_STRING, ap_cfg->key, KEY_LEN);
  5333. +
  5334. + ret |= get_parmeter_from_string(&str_ptr, "CHANNEL=", PTYPE_INTDEC, &ap_cfg->channel, 5);
  5335. +
  5336. + ret |= get_parmeter_from_string(&str_ptr, "PREAMBLE=", PTYPE_INTDEC, &ap_cfg->preamble, 5);
  5337. +
  5338. + ret |= get_parmeter_from_string(&str_ptr, "MAX_SCB=", PTYPE_INTDEC, &ap_cfg->max_scb, 5);
  5339. +
  5340. + return ret;
  5341. +}
  5342. +#endif
  5343. +
  5344. +
  5345. +
  5346. +#ifdef SOFTAP
  5347. +static int iwpriv_set_ap_config(struct net_device *dev,
  5348. + struct iw_request_info *info,
  5349. + union iwreq_data *wrqu,
  5350. + char *ext)
  5351. +{
  5352. + int res = 0;
  5353. + char *extra = NULL;
  5354. + struct ap_profile *ap_cfg = &my_ap;
  5355. +
  5356. + WL_TRACE(("> Got IWPRIV SET_AP IOCTL: info->cmd:%x, info->flags:%x, u.data:%p, u.len:%d\n",
  5357. + info->cmd, info->flags,
  5358. + wrqu->data.pointer, wrqu->data.length));
  5359. +
  5360. +
  5361. + if (wrqu->data.length != 0) {
  5362. +
  5363. + char *str_ptr;
  5364. +
  5365. + if (!(extra = kmalloc(wrqu->data.length+1, GFP_KERNEL)))
  5366. + return -ENOMEM;
  5367. +
  5368. + if (copy_from_user(extra, wrqu->data.pointer, wrqu->data.length)) {
  5369. + kfree(extra);
  5370. + return -EFAULT;
  5371. + }
  5372. +
  5373. + extra[wrqu->data.length] = 0;
  5374. + WL_SOFTAP((" Got str param in iw_point:\n %s\n", extra));
  5375. +
  5376. + memset(ap_cfg, 0, sizeof(struct ap_profile));
  5377. +
  5378. +
  5379. +
  5380. + str_ptr = extra;
  5381. +
  5382. + init_ap_profile_from_string(extra, ap_cfg);
  5383. +
  5384. + } else {
  5385. +
  5386. + WL_ERROR(("IWPRIV argument len = 0 \n"));
  5387. + return -1;
  5388. + }
  5389. +
  5390. +
  5391. + res |= set_ap_cfg(dev, ap_cfg);
  5392. + kfree(extra);
  5393. +
  5394. + return res;
  5395. +}
  5396. +#endif
  5397. +
  5398. +
  5399. +
  5400. +#ifdef SOFTAP
  5401. +static int iwpriv_get_assoc_list(struct net_device *dev,
  5402. + struct iw_request_info *info,
  5403. + union iwreq_data *p_iwrq,
  5404. + char *extra)
  5405. +{
  5406. + int i, ret = 0;
  5407. + char mac_buf[256];
  5408. + struct maclist *sta_maclist = (struct maclist *)mac_buf;
  5409. +
  5410. + char mac_lst[256];
  5411. + char *p_mac_str;
  5412. +
  5413. + WL_TRACE(("\n %s: IWPRIV IOCTL: cmd:%hx, flags:%hx, extra:%p, iwp.len:%d, \
  5414. + iwp.len:%p, iwp.flags:%x \n", __FUNCTION__, info->cmd, info->flags, \
  5415. + extra, p_iwrq->data.length, p_iwrq->data.pointer, p_iwrq->data.flags));
  5416. +
  5417. + WL_SOFTAP(("extra:%s\n", extra));
  5418. + print_buf((u8 *)p_iwrq, 16, 0);
  5419. +
  5420. + memset(sta_maclist, 0, sizeof(mac_buf));
  5421. +
  5422. + sta_maclist->count = 8;
  5423. +
  5424. + WL_TRACE((" net device:%s, buf_sz:%d\n", dev->name, sizeof(mac_buf)));
  5425. + get_assoc_sta_list(dev, mac_buf, 256);
  5426. + WL_TRACE((" got %d stations\n", sta_maclist->count));
  5427. +
  5428. +
  5429. + memset(mac_lst, 0, sizeof(mac_lst));
  5430. + p_mac_str = mac_lst;
  5431. +
  5432. + for (i = 0; i < 8; i++) {
  5433. + struct ether_addr * id = &sta_maclist->ea[i];
  5434. +
  5435. + WL_SOFTAP(("dhd_drv>> sta_mac[%d] :", i));
  5436. + print_buf((unsigned char *)&sta_maclist->ea[i], 6, 0);
  5437. +
  5438. +
  5439. + p_mac_str += snprintf(p_mac_str, MAX_WX_STRING,
  5440. + "Mac[%d]=%02X:%02X:%02X:%02X:%02X:%02X\n", i,
  5441. + id->octet[0], id->octet[1], id->octet[2],
  5442. + id->octet[3], id->octet[4], id->octet[5]);
  5443. +
  5444. + }
  5445. +
  5446. + p_iwrq->data.length = strlen(mac_lst);
  5447. +
  5448. + WL_TRACE(("u.pointer:%p\n", p_iwrq->data.pointer));
  5449. + WL_TRACE(("resulting str:\n%s \n len:%d\n\n", mac_lst, p_iwrq->data.length));
  5450. +
  5451. + if (p_iwrq->data.length) {
  5452. + if (copy_to_user(p_iwrq->data.pointer, mac_lst, p_iwrq->data.length)) {
  5453. + WL_ERROR(("%s: Can't copy to user\n", __FUNCTION__));
  5454. + return -EFAULT;
  5455. + }
  5456. + }
  5457. +
  5458. + WL_TRACE(("Exited %s \n", __FUNCTION__));
  5459. + return ret;
  5460. +}
  5461. +#endif
  5462. +
  5463. +
  5464. +#ifdef SOFTAP
  5465. +static int iwpriv_set_mac_filters(struct net_device *dev,
  5466. + struct iw_request_info *info,
  5467. + union iwreq_data *wrqu,
  5468. + char *ext)
  5469. +{
  5470. +
  5471. + int i, ret = -1;
  5472. + char * extra = NULL;
  5473. + u8 macfilt[8][6];
  5474. + int mac_cnt = 0;
  5475. + char sub_cmd[16];
  5476. +
  5477. + WL_TRACE((">>> Got IWPRIV SET_MAC_FILTER IOCTL: info->cmd:%x, \
  5478. + info->flags:%x, u.data:%p, u.len:%d\n",
  5479. + info->cmd, info->flags,
  5480. + wrqu->data.pointer, wrqu->data.length));
  5481. +
  5482. + if (wrqu->data.length != 0) {
  5483. +
  5484. + char *str_ptr;
  5485. +
  5486. + if (!(extra = kmalloc(wrqu->data.length+1, GFP_KERNEL)))
  5487. + return -ENOMEM;
  5488. +
  5489. + if (copy_from_user(extra, wrqu->data.pointer, wrqu->data.length)) {
  5490. + kfree(extra);
  5491. + return -EFAULT;
  5492. + }
  5493. +
  5494. + extra[wrqu->data.length] = 0;
  5495. + WL_SOFTAP((" Got parameter string in iw_point:\n %s \n", extra));
  5496. +
  5497. + memset(macfilt, 0, sizeof(macfilt));
  5498. + memset(sub_cmd, 0, sizeof(sub_cmd));
  5499. +
  5500. +
  5501. + str_ptr = extra;
  5502. +
  5503. +
  5504. + if (get_parmeter_from_string(&str_ptr, "ASCII_CMD=", PTYPE_STRING, sub_cmd, 15) != 0) {
  5505. + goto exit_proc;
  5506. + }
  5507. +
  5508. +#define MAC_FILT_MAX 8
  5509. +
  5510. + if (strncmp(sub_cmd, "MAC_FLT_W", strlen("MAC_FLT_W"))) {
  5511. + WL_ERROR(("ERROR: sub_cmd:%s != 'MAC_FLT_W'!\n", sub_cmd));
  5512. + goto exit_proc;
  5513. + }
  5514. +
  5515. + if (get_parmeter_from_string(&str_ptr, "MAC_CNT=",
  5516. + PTYPE_INTDEC, &mac_cnt, 4) != 0) {
  5517. + WL_ERROR(("ERROR: MAC_CNT param is missing \n"));
  5518. + goto exit_proc;
  5519. + }
  5520. +
  5521. + if (mac_cnt > MAC_FILT_MAX) {
  5522. + WL_ERROR(("ERROR: number of MAC filters > MAX\n"));
  5523. + goto exit_proc;
  5524. + }
  5525. +
  5526. + for (i=0; i< mac_cnt; i++)
  5527. + if (get_parmeter_from_string(&str_ptr, "MAC=",
  5528. + PTYPE_STR_HEX, macfilt[i], 12) != 0) {
  5529. + WL_ERROR(("ERROR: MAC_filter[%d] is missing !\n", i));
  5530. + goto exit_proc;
  5531. + }
  5532. +
  5533. + for (i = 0; i < mac_cnt; i++) {
  5534. + WL_SOFTAP(("mac_filt[%d]:", i));
  5535. + print_buf(macfilt[i], 6, 0);
  5536. + }
  5537. +
  5538. +
  5539. + wrqu->data.pointer = NULL;
  5540. + wrqu->data.length = 0;
  5541. + ret = 0;
  5542. +
  5543. + } else {
  5544. +
  5545. + WL_ERROR(("IWPRIV argument len is 0\n"));
  5546. + return -1;
  5547. + }
  5548. +
  5549. + exit_proc:
  5550. + kfree(extra);
  5551. + return ret;
  5552. +}
  5553. +#endif
  5554.  
  5555. #endif
  5556.  
  5557. @@ -938,8 +1251,10 @@
  5558. __u16 flags;
  5559. };
  5560.  
  5561. -typedef int (*iw_handler)(struct net_device *dev, struct iw_request_info *info,
  5562. - void *wrqu, char *extra);
  5563. +typedef int (*iw_handler)(struct net_device *dev,
  5564. + struct iw_request_info *info,
  5565. + void *wrqu,
  5566. + char *extra);
  5567. #endif
  5568.  
  5569. static int
  5570. @@ -966,7 +1281,7 @@
  5571.  
  5572. bzero(&bssid, sizeof(struct sockaddr));
  5573. if ((error = dev_wlc_ioctl(dev, WLC_REASSOC, &bssid, ETHER_ADDR_LEN))) {
  5574. - WL_ERROR(("Invalid ioctl data.\n"));
  5575. + WL_ERROR(("%s: WLC_REASSOC to %s failed \n", __FUNCTION__, ssid.SSID));
  5576. return error;
  5577. }
  5578.  
  5579. @@ -999,7 +1314,14 @@
  5580. int error, chan;
  5581. uint sf = 0;
  5582.  
  5583. - WL_TRACE(("%s: SIOCSIWFREQ\n", dev->name));
  5584. + WL_TRACE(("\n %s %s: SIOCSIWFREQ\n", __FUNCTION__, dev->name));
  5585. +
  5586. +#if defined(SOFTAP)
  5587. + if (ap_cfg_running) {
  5588. + WL_TRACE(("%s:>> not executed, 'SOFT_AP is active' \n", __FUNCTION__));
  5589. + return 0;
  5590. + }
  5591. +#endif
  5592.  
  5593.  
  5594. if (fwrq->e == 0 && fwrq->m < MAXCHANNEL) {
  5595. @@ -1511,7 +1833,12 @@
  5596. list->buflen = dtoh32(list->buflen);
  5597. list->version = dtoh32(list->version);
  5598. list->count = dtoh32(list->count);
  5599. - ASSERT(list->version == WL_BSS_INFO_VERSION);
  5600. + if (list->version != WL_BSS_INFO_VERSION) {
  5601. + WL_ERROR(("%s : list->version %d != WL_BSS_INFO_VERSION\n", \
  5602. + __FUNCTION__, list->version));
  5603. + kfree(list);
  5604. + return -EINVAL;
  5605. + }
  5606.  
  5607. for (i = 0, dwrq->length = 0; i < list->count && dwrq->length < IW_MAX_AP; i++) {
  5608. bi = bi ? (wl_bss_info_t *)((uintptr)bi + dtoh32(bi->length)) : list->bss_info;
  5609. @@ -1581,7 +1908,11 @@
  5610.  
  5611. while (buf) {
  5612. list = &((wl_iscan_results_t*)buf->iscan_buf)->results;
  5613. - ASSERT(list->version == WL_BSS_INFO_VERSION);
  5614. + if (list->version != WL_BSS_INFO_VERSION) {
  5615. + WL_ERROR(("%s : list->version %d != WL_BSS_INFO_VERSION\n", \
  5616. + __FUNCTION__, list->version));
  5617. + return -EINVAL;
  5618. + }
  5619.  
  5620. bi = NULL;
  5621. for (i = 0, dwrq->length = 0; i < list->count && dwrq->length < IW_MAX_AP; i++) {
  5622. @@ -1719,8 +2050,11 @@
  5623. }
  5624. else {
  5625. buf = kmalloc(sizeof(iscan_buf_t), GFP_KERNEL);
  5626. - if (!buf)
  5627. - return WL_SCAN_RESULTS_ABORTED;
  5628. + if (!buf) {
  5629. + WL_ERROR(("%s can't alloc iscan_buf_t : going to abort currect iscan\n", \
  5630. + __FUNCTION__));
  5631. + return WL_SCAN_RESULTS_NO_MEM;
  5632. + }
  5633. buf->next = NULL;
  5634. if (!iscan->list_hdr)
  5635. iscan->list_hdr = buf;
  5636. @@ -1760,27 +2094,30 @@
  5637.  
  5638. static void wl_iw_force_specific_scan(iscan_info_t *iscan)
  5639. {
  5640. - WL_TRACE(("### Force Specific SCAN for %s\n", g_specific_ssid.SSID));
  5641. + WL_TRACE(("%s force Specific SCAN for %s\n", __FUNCTION__, g_specific_ssid.SSID));
  5642. #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
  5643. rtnl_lock();
  5644. #endif
  5645. +
  5646. (void) dev_wlc_ioctl(iscan->dev, WLC_SCAN, &g_specific_ssid, sizeof(g_specific_ssid));
  5647. +
  5648. #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
  5649. rtnl_unlock();
  5650. #endif
  5651. }
  5652. -
  5653. static void wl_iw_send_scan_complete(iscan_info_t *iscan)
  5654. {
  5655. #ifndef SANDGATE2G
  5656. union iwreq_data wrqu;
  5657. - char extra[IW_CUSTOM_MAX + 1];
  5658.  
  5659. - memset(&wrqu, 0, sizeof(wrqu));
  5660. - memset(extra, 0, sizeof(extra));
  5661. - wireless_send_event(iscan->dev, SIOCGIWSCAN, &wrqu, extra);
  5662. - WL_TRACE(("Send Event SCAN complete\n"));
  5663. -#endif
  5664. + memset(&wrqu, 0, sizeof(wrqu));
  5665. +
  5666. +
  5667. + wireless_send_event(iscan->dev, SIOCGIWSCAN, &wrqu, NULL);
  5668. + if (g_first_broadcast_scan == BROADCAST_SCAN_FIRST_STARTED)
  5669. + g_first_broadcast_scan = BROADCAST_SCAN_FIRST_RESULT_READY;
  5670. + WL_TRACE(("Send Event ISCAN complete\n"));
  5671. +#endif
  5672. }
  5673. static int
  5674. _iscan_sysioc_thread(void *data)
  5675. @@ -1788,17 +2125,21 @@
  5676. uint32 status;
  5677. iscan_info_t *iscan = (iscan_info_t *)data;
  5678. static bool iscan_pass_abort = FALSE;
  5679. -
  5680. DAEMONIZE("iscan_sysioc");
  5681.  
  5682. status = WL_SCAN_RESULTS_PARTIAL;
  5683. while (down_interruptible(&iscan->sysioc_sem) == 0) {
  5684.  
  5685. - net_os_wake_lock(iscan->dev);
  5686. -
  5687. +#if defined(SOFTAP)
  5688. +
  5689. + if (ap_cfg_running) {
  5690. + WL_TRACE(("%s skipping SCAN ops in AP mode !!!\n", __FUNCTION__));
  5691. + continue;
  5692. + }
  5693. +#endif
  5694. if (iscan->timer_on) {
  5695. + del_timer(&iscan->timer);
  5696. iscan->timer_on = 0;
  5697. - del_timer_sync(&iscan->timer);
  5698. }
  5699.  
  5700. #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
  5701. @@ -1808,9 +2149,8 @@
  5702. #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
  5703. rtnl_unlock();
  5704. #endif
  5705. -
  5706. - if (g_scan_specified_ssid && (iscan_pass_abort == TRUE)) {
  5707. - WL_TRACE(("%s Get results from specific scan sttaus=%d\n", __FUNCTION__, status));
  5708. + if (g_scan_specified_ssid && (iscan_pass_abort == TRUE)) {
  5709. + WL_TRACE(("%s Get results from specific scan status=%d\n", __FUNCTION__, status));
  5710. wl_iw_send_scan_complete(iscan);
  5711. iscan_pass_abort = FALSE;
  5712. status = -1;
  5713. @@ -1822,12 +2162,12 @@
  5714. #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
  5715. rtnl_lock();
  5716. #endif
  5717. -
  5718. +
  5719. wl_iw_iscan(iscan, NULL, WL_SCAN_ACTION_CONTINUE);
  5720. #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
  5721. rtnl_unlock();
  5722. #endif
  5723. -
  5724. +
  5725. mod_timer(&iscan->timer, jiffies + iscan->timer_ms*HZ/1000);
  5726. iscan->timer_on = 1;
  5727. break;
  5728. @@ -1838,7 +2178,7 @@
  5729. break;
  5730. case WL_SCAN_RESULTS_PENDING:
  5731. WL_TRACE(("iscanresults pending\n"));
  5732. -
  5733. +
  5734. mod_timer(&iscan->timer, jiffies + iscan->timer_ms*HZ/1000);
  5735. iscan->timer_on = 1;
  5736. break;
  5737. @@ -1852,35 +2192,51 @@
  5738. wl_iw_force_specific_scan(iscan);
  5739. }
  5740. break;
  5741. + case WL_SCAN_RESULTS_NO_MEM:
  5742. + WL_TRACE(("iscanresults can't alloc memory: skip\n"));
  5743. + iscan->iscan_state = ISCAN_STATE_IDLE;
  5744. + break;
  5745. default:
  5746. WL_TRACE(("iscanresults returned unknown status %d\n", status));
  5747. break;
  5748. - }
  5749. -
  5750. - net_os_wake_unlock(iscan->dev);
  5751. + }
  5752. }
  5753.  
  5754. if (iscan->timer_on) {
  5755. + del_timer(&iscan->timer);
  5756. iscan->timer_on = 0;
  5757. - del_timer_sync(&iscan->timer);
  5758. }
  5759. -
  5760. complete_and_exit(&iscan->sysioc_exited, 0);
  5761. }
  5762. #endif
  5763.  
  5764.  
  5765. +static void
  5766. +wl_iw_set_ss_cache_timer_flag(void)
  5767. +{
  5768. + g_ss_cache_ctrl.m_timer_expired = 1;
  5769. + WL_TRACE(("%s called\n", __FUNCTION__));
  5770. +}
  5771.  
  5772. -void
  5773. +static int
  5774. wl_iw_init_ss_cache_ctrl(void)
  5775. {
  5776. + WL_TRACE(("%s :\n", __FUNCTION__));
  5777. g_ss_cache_ctrl.m_prev_scan_mode = 0;
  5778. g_ss_cache_ctrl.m_cons_br_scan_cnt = 0;
  5779. g_ss_cache_ctrl.m_cache_head = NULL;
  5780. g_ss_cache_ctrl.m_link_down = 0;
  5781. g_ss_cache_ctrl.m_timer_expired = 0;
  5782. - g_ss_cache_ctrl.m_timer = NULL;
  5783. memset(g_ss_cache_ctrl.m_active_bssid, 0, ETHER_ADDR_LEN);
  5784. +
  5785. + g_ss_cache_ctrl.m_timer = kmalloc(sizeof(struct timer_list), GFP_KERNEL);
  5786. + if (!g_ss_cache_ctrl.m_timer) {
  5787. + return -ENOMEM;
  5788. + }
  5789. + g_ss_cache_ctrl.m_timer->function = (void *)wl_iw_set_ss_cache_timer_flag;
  5790. + init_timer(g_ss_cache_ctrl.m_timer);
  5791. +
  5792. + return 0;
  5793. }
  5794.  
  5795.  
  5796. @@ -1905,12 +2261,6 @@
  5797. *spec_scan_head = NULL;
  5798. }
  5799.  
  5800. -static void
  5801. -wl_iw_set_ss_cache_timer_flag(void)
  5802. -{
  5803. - g_ss_cache_ctrl.m_timer_expired = 1;
  5804. - WL_TRACE(("%s called\n", __FUNCTION__));
  5805. -}
  5806.  
  5807.  
  5808. static int
  5809. @@ -1920,24 +2270,15 @@
  5810.  
  5811. timer = &g_ss_cache_ctrl.m_timer;
  5812.  
  5813. - if (kick_off) {
  5814. - *timer = kmalloc(sizeof(struct timer_list), GFP_KERNEL);
  5815. - if (!(*timer)) {
  5816. - return -ENOMEM;
  5817. - }
  5818. - (*timer)->function = (void *)wl_iw_set_ss_cache_timer_flag;
  5819. - init_timer(*timer);
  5820. - (*timer)->expires = jiffies + 30000 * HZ / 1000;
  5821. - add_timer(*timer);
  5822. - WL_TRACE(("%s : timer starts \n", __FUNCTION__));
  5823. - }
  5824. - else {
  5825. - if (*timer) {
  5826. + if (*timer) {
  5827. + if (kick_off) {
  5828. + (*timer)->expires = jiffies + 30000 * HZ / 1000;
  5829. + add_timer(*timer);
  5830. + WL_TRACE(("%s : timer starts \n", __FUNCTION__));
  5831. + } else {
  5832. del_timer_sync(*timer);
  5833. - kfree(*timer);
  5834. - *timer = NULL;
  5835. + WL_TRACE(("%s : timer stops \n", __FUNCTION__));
  5836. }
  5837. - WL_TRACE(("%s : timer stops \n", __FUNCTION__));
  5838. }
  5839.  
  5840. return 0;
  5841. @@ -1947,8 +2288,12 @@
  5842. void
  5843. wl_iw_release_ss_cache_ctrl(void)
  5844. {
  5845. + WL_TRACE(("%s :\n", __FUNCTION__));
  5846. wl_iw_free_ss_cache();
  5847. wl_iw_run_ss_cache_timer(0);
  5848. + if (g_ss_cache_ctrl.m_timer) {
  5849. + kfree(g_ss_cache_ctrl.m_timer);
  5850. + }
  5851. }
  5852.  
  5853.  
  5854. @@ -2012,7 +2357,7 @@
  5855.  
  5856. bi = bi ? (wl_bss_info_t *)((uintptr)bi + dtoh32(bi->length)) : ss_list->bss_info;
  5857.  
  5858. - WL_TRACE(("%s : %dth SSID %s\n", __FUNCTION__, i, bi->SSID));
  5859. + WL_TRACE(("%s : find %d with specific SSID %s\n", __FUNCTION__, i, bi->SSID));
  5860. for (;node;) {
  5861. if (!memcmp(&node->bss_info->BSSID, &bi->BSSID, ETHER_ADDR_LEN)) {
  5862.  
  5863. @@ -2066,12 +2411,13 @@
  5864. node = g_ss_cache_ctrl.m_cache_head;
  5865. for (;node;) {
  5866. list_merge = (wl_scan_results_t *)node;
  5867. - WL_TRACE(("%s: Bcast APs list=%d\n", __FUNCTION__, list_merge->count));
  5868. + WL_TRACE(("%s: Cached Specific APs list=%d\n", __FUNCTION__, list_merge->count));
  5869. if (buflen_from_user - *merged_len > 0) {
  5870. *merged_len += (__u16) wl_iw_get_scan_prep(list_merge, info,
  5871. extra + *merged_len, buflen_from_user - *merged_len);
  5872. }
  5873. else {
  5874. + WL_TRACE(("%s: exit with break\n", __FUNCTION__));
  5875. break;
  5876. }
  5877. node = node->next;
  5878. @@ -2123,7 +2469,16 @@
  5879. char *extra
  5880. )
  5881. {
  5882. - WL_TRACE(("%s: SIOCSIWSCAN\n", dev->name));
  5883. + int error;
  5884. + WL_TRACE(("\n:%s dev:%s: SIOCSIWSCAN : SCAN\n", __FUNCTION__, dev->name));
  5885. +
  5886. +#if defined(SOFTAP)
  5887. +
  5888. + if (ap_cfg_running) {
  5889. + WL_TRACE(("\n>%s: Not executed, reason -'SOFTAP is active'\n", __FUNCTION__));
  5890. + return 0;
  5891. + }
  5892. +#endif
  5893.  
  5894.  
  5895. if (g_onoff == G_WLAN_SET_OFF)
  5896. @@ -2131,28 +2486,98 @@
  5897.  
  5898.  
  5899. memset(&g_specific_ssid, 0, sizeof(g_specific_ssid));
  5900. - g_scan_specified_ssid = 0;
  5901. +#ifndef WL_IW_USE_ISCAN
  5902. +
  5903. + g_scan_specified_ssid = 0;
  5904. +#endif
  5905.  
  5906. #if WIRELESS_EXT > 17
  5907.  
  5908. if (wrqu->data.length == sizeof(struct iw_scan_req)) {
  5909. if (wrqu->data.flags & IW_SCAN_THIS_ESSID) {
  5910. struct iw_scan_req *req = (struct iw_scan_req *)extra;
  5911. - g_specific_ssid.SSID_len = MIN(sizeof(g_specific_ssid.SSID), req->essid_len);
  5912. - memcpy(g_specific_ssid.SSID, req->essid, g_specific_ssid.SSID_len);
  5913. - g_specific_ssid.SSID_len = htod32(g_specific_ssid.SSID_len);
  5914. - g_scan_specified_ssid = 1;
  5915. - WL_TRACE(("Specific scan ssid=%s len=%d\n", g_specific_ssid.SSID, g_specific_ssid.SSID_len));
  5916. + if (g_first_broadcast_scan != BROADCAST_SCAN_FIRST_RESULT_CONSUMED) {
  5917. +
  5918. + WL_TRACE(("%s Ignoring SC %s first BC is not done = %d\n", \
  5919. + __FUNCTION__, req->essid, \
  5920. + g_first_broadcast_scan));
  5921. + return -EBUSY;
  5922. + }
  5923. + if (g_scan_specified_ssid) {
  5924. + WL_TRACE(("%s Specific SCAN is not done ignore scan for = %s \n", \
  5925. + __FUNCTION__, req->essid));
  5926. +
  5927. + return -EBUSY;
  5928. + }
  5929. + else {
  5930. + g_specific_ssid.SSID_len = MIN(sizeof(g_specific_ssid.SSID), \
  5931. + req->essid_len);
  5932. + memcpy(g_specific_ssid.SSID, req->essid, g_specific_ssid.SSID_len);
  5933. + g_specific_ssid.SSID_len = htod32(g_specific_ssid.SSID_len);
  5934. + g_scan_specified_ssid = 1;
  5935. + WL_TRACE(("### Specific scan ssid=%s len=%d\n", \
  5936. + g_specific_ssid.SSID, g_specific_ssid.SSID_len));
  5937. + }
  5938. }
  5939. }
  5940. -#endif
  5941. +#endif
  5942.  
  5943. - (void) dev_wlc_ioctl(dev, WLC_SCAN, &g_specific_ssid, sizeof(g_specific_ssid));
  5944. + if ((error = dev_wlc_ioctl(dev, WLC_SCAN, &g_specific_ssid, sizeof(g_specific_ssid)))) {
  5945. + WL_TRACE(("#### Set SCAN for %s failed with %d\n", g_specific_ssid.SSID, error));
  5946. +
  5947. + g_scan_specified_ssid = 0;
  5948. + return -EBUSY;
  5949. + }
  5950.  
  5951. return 0;
  5952. }
  5953.  
  5954. #ifdef WL_IW_USE_ISCAN
  5955. +int
  5956. +wl_iw_iscan_set_scan_broadcast_prep(struct net_device *dev, uint flag)
  5957. +{
  5958. + wlc_ssid_t ssid;
  5959. + iscan_info_t *iscan = g_iscan;
  5960. +
  5961. +
  5962. + if (g_first_broadcast_scan == BROADCAST_SCAN_FIRST_IDLE) {
  5963. + g_first_broadcast_scan = BROADCAST_SCAN_FIRST_STARTED;
  5964. + WL_TRACE(("%s: First Brodcast scan was forced\n", __FUNCTION__));
  5965. + }
  5966. + else if (g_first_broadcast_scan == BROADCAST_SCAN_FIRST_STARTED) {
  5967. + WL_TRACE(("%s: ignore ISCAN request first BS is not done yet\n", __FUNCTION__));
  5968. + return 0;
  5969. + }
  5970. +
  5971. +
  5972. + memset(&ssid, 0, sizeof(ssid));
  5973. +
  5974. + iscan->list_cur = iscan->list_hdr;
  5975. + iscan->iscan_state = ISCAN_STATE_SCANING;
  5976. +
  5977. +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
  5978. + if (flag)
  5979. + rtnl_lock();
  5980. +#endif
  5981. +
  5982. + dev_wlc_ioctl(dev, WLC_SET_PASSIVE_SCAN, &iscan->scan_flag, sizeof(iscan->scan_flag));
  5983. + wl_iw_set_event_mask(dev);
  5984. +
  5985. + WL_TRACE(("+++: Set Broadcast ISCAN\n"));
  5986. +
  5987. + wl_iw_iscan(iscan, &ssid, WL_SCAN_ACTION_START);
  5988. +
  5989. +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
  5990. + if (flag)
  5991. + rtnl_unlock();
  5992. +#endif
  5993. +
  5994. + mod_timer(&iscan->timer, jiffies + iscan->timer_ms*HZ/1000);
  5995. +
  5996. + iscan->timer_on = 1;
  5997. +
  5998. + return 0;
  5999. +}
  6000. static int
  6001. wl_iw_iscan_set_scan(
  6002. struct net_device *dev,
  6003. @@ -2164,48 +2589,68 @@
  6004. wlc_ssid_t ssid;
  6005. iscan_info_t *iscan = g_iscan;
  6006.  
  6007. - WL_TRACE(("%s: SIOCSIWSCAN\n", dev->name));
  6008. + WL_TRACE(("%s: SIOCSIWSCAN : ISCAN\n", dev->name));
  6009.  
  6010.  
  6011. - if (g_onoff == G_WLAN_SET_OFF)
  6012. +#if defined(SOFTAP)
  6013. + if (ap_cfg_running) {
  6014. + WL_TRACE(("\n>%s: Not executed, reason -'SOFTAP is active'\n", __FUNCTION__));
  6015. + return 0;
  6016. + }
  6017. +#endif
  6018. +
  6019. + if (g_onoff == G_WLAN_SET_OFF) {
  6020. + WL_TRACE(("%s: driver is not up yet after START\n", __FUNCTION__));
  6021. return 0;
  6022. + }
  6023.  
  6024.  
  6025. if ((!iscan) || (iscan->sysioc_pid < 0)) {
  6026. + WL_TRACE(("%s use backup if iscan thread is not successful\n", \
  6027. + __FUNCTION__));
  6028. return wl_iw_set_scan(dev, info, wrqu, extra);
  6029. }
  6030. - if (iscan->iscan_state == ISCAN_STATE_SCANING) {
  6031. - return 0;
  6032. +
  6033. + if (g_scan_specified_ssid) {
  6034. + WL_TRACE(("%s Specific SCAN already running ignoring BC scan\n", \
  6035. + __FUNCTION__));
  6036. + return EBUSY;
  6037. }
  6038.  
  6039.  
  6040. memset(&ssid, 0, sizeof(ssid));
  6041.  
  6042. - g_scan_specified_ssid = 0;
  6043. #if WIRELESS_EXT > 17
  6044.  
  6045. if (wrqu->data.length == sizeof(struct iw_scan_req)) {
  6046. if (wrqu->data.flags & IW_SCAN_THIS_ESSID) {
  6047. int as = 0;
  6048. struct iw_scan_req *req = (struct iw_scan_req *)extra;
  6049. + if (g_first_broadcast_scan < BROADCAST_SCAN_FIRST_RESULT_CONSUMED) {
  6050. +
  6051. + WL_TRACE(("%s First ISCAN in progress : ignoring SC = %s\n", \
  6052. + __FUNCTION__, req->essid));
  6053. + return -EBUSY;
  6054. + }
  6055. ssid.SSID_len = MIN(sizeof(ssid.SSID), req->essid_len);
  6056. memcpy(ssid.SSID, req->essid, ssid.SSID_len);
  6057. ssid.SSID_len = htod32(ssid.SSID_len);
  6058. - g_scan_specified_ssid = 1;
  6059. - (void) dev_wlc_ioctl(dev, WLC_SET_PASSIVE_SCAN, &as, sizeof(as));
  6060. + dev_wlc_ioctl(dev, WLC_SET_PASSIVE_SCAN, &as, sizeof(as));
  6061. + wl_iw_set_event_mask(dev);
  6062. return wl_iw_set_scan(dev, info, wrqu, extra);
  6063. }
  6064. + else {
  6065. + g_scan_specified_ssid = 0;
  6066. +
  6067. + if (iscan->iscan_state == ISCAN_STATE_SCANING) {
  6068. + WL_TRACE(("%s ISCAN already in progress \n", __FUNCTION__));
  6069. + return 0;
  6070. + }
  6071. + }
  6072. }
  6073. #endif
  6074.  
  6075. - iscan->list_cur = iscan->list_hdr;
  6076. - iscan->iscan_state = ISCAN_STATE_SCANING;
  6077. - (void) dev_wlc_ioctl(dev, WLC_SET_PASSIVE_SCAN,
  6078. - &iscan->scan_flag, sizeof(iscan->scan_flag));
  6079. - wl_iw_set_event_mask(dev);
  6080. - wl_iw_iscan(iscan, &ssid, WL_SCAN_ACTION_START);
  6081. - mod_timer(&iscan->timer, jiffies + iscan->timer_ms*HZ/1000);
  6082. - iscan->timer_on = 1;
  6083. + wl_iw_iscan_set_scan_broadcast_prep(dev, 0);
  6084.  
  6085. return 0;
  6086. }
  6087. @@ -2329,10 +2774,16 @@
  6088.  
  6089. for (i = 0; i < list->count && i < IW_MAX_AP; i++)
  6090. {
  6091. - ASSERT(list->version == WL_BSS_INFO_VERSION);
  6092. + if (list->version != WL_BSS_INFO_VERSION) {
  6093. + WL_ERROR(("%s : list->version %d != WL_BSS_INFO_VERSION\n", \
  6094. + __FUNCTION__, list->version));
  6095. + return ret;
  6096. + }
  6097.  
  6098. bi = bi ? (wl_bss_info_t *)((uintptr)bi + dtoh32(bi->length)) : list->bss_info;
  6099.  
  6100. + WL_TRACE(("%s : %s\n", __FUNCTION__, bi->SSID));
  6101. +
  6102.  
  6103. iwe.cmd = SIOCGIWAP;
  6104. iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
  6105. @@ -2383,13 +2834,14 @@
  6106.  
  6107.  
  6108. if (bi->rateset.count) {
  6109. - if (((event - extra) + IW_EV_LCP_LEN) <= (int)end) {
  6110. + if (((event -extra) + IW_EV_LCP_LEN) <= (uintptr)end) {
  6111. value = event + IW_EV_LCP_LEN;
  6112. iwe.cmd = SIOCGIWRATE;
  6113. -
  6114. +
  6115. iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0;
  6116. for (j = 0; j < bi->rateset.count && j < IW_MAX_BITRATES; j++) {
  6117. - iwe.u.bitrate.value = (bi->rateset.rates[j] & 0x7f) * 500000;
  6118. + iwe.u.bitrate.value =
  6119. + (bi->rateset.rates[j] & 0x7f) * 500000;
  6120. value = IWE_STREAM_ADD_VALUE(info, event, value, end, &iwe,
  6121. IW_EV_PARAM_LEN);
  6122. }
  6123. @@ -2425,7 +2877,8 @@
  6124. #if defined(WL_IW_USE_ISCAN)
  6125. iscan_info_t *iscan = g_iscan;
  6126. iscan_buf_t * p_buf;
  6127. -#endif
  6128. + uint32 counter = 0;
  6129. +#endif
  6130.  
  6131. WL_TRACE(("%s: buflen_from_user %d: \n", dev->name, buflen_from_user));
  6132.  
  6133. @@ -2466,6 +2919,7 @@
  6134. list = kmalloc(len, GFP_KERNEL);
  6135. if (!list) {
  6136. WL_TRACE(("%s: wl_iw_get_scan return -ENOMEM\n", dev->name));
  6137. + g_scan_specified_ssid = 0;
  6138. return -ENOMEM;
  6139. }
  6140. }
  6141. @@ -2473,7 +2927,7 @@
  6142. memset(list, 0, len);
  6143. list->buflen = htod32(len);
  6144. if ((error = dev_wlc_ioctl(dev, WLC_SCAN_RESULTS, list, len))) {
  6145. - WL_TRACE(("%s: %s : Scan_results too big %d\n", dev->name, __FUNCTION__, len));
  6146. + WL_TRACE(("%s: %s : Scan_results ERROR %d\n", dev->name, __FUNCTION__, len));
  6147. dwrq->length = len;
  6148. if (g_scan_specified_ssid)
  6149. kfree(list);
  6150. @@ -2483,11 +2937,14 @@
  6151. list->version = dtoh32(list->version);
  6152. list->count = dtoh32(list->count);
  6153.  
  6154. +
  6155. if (list->version != WL_BSS_INFO_VERSION) {
  6156. - WL_ERROR(("%s : list->version %d != WL_BSS_INFO_VERSION\n",
  6157. - __FUNCTION__, list->version));
  6158. - if (g_scan_specified_ssid)
  6159. + WL_ERROR(("%s : list->version %d != WL_BSS_INFO_VERSION\n", \
  6160. + __FUNCTION__, list->version));
  6161. + if (g_scan_specified_ssid) {
  6162. + g_scan_specified_ssid = 0;
  6163. kfree(list);
  6164. + }
  6165. return -EINVAL;
  6166. }
  6167.  
  6168. @@ -2498,20 +2955,24 @@
  6169. }
  6170.  
  6171. #if defined(WL_IW_USE_ISCAN)
  6172. + if (g_scan_specified_ssid)
  6173. + WL_TRACE(("%s: Specified scan APs from scan=%d\n", __FUNCTION__, list->count));
  6174. p_buf = iscan->list_hdr;
  6175.  
  6176. while (p_buf != iscan->list_cur) {
  6177. list_merge = &((wl_iscan_results_t*)p_buf->iscan_buf)->results;
  6178. WL_TRACE(("%s: Bcast APs list=%d\n", __FUNCTION__, list_merge->count));
  6179. + counter += list_merge->count;
  6180. if (list_merge->count > 0)
  6181. len_ret += (__u16) wl_iw_get_scan_prep(list_merge, info,
  6182. - extra+len_ret, buflen_from_user -len_ret);
  6183. + extra+len_ret, buflen_from_user -len_ret);
  6184. p_buf = p_buf->next;
  6185. }
  6186. + WL_TRACE(("%s merged with total Bcast APs=%d\n", __FUNCTION__, counter));
  6187. #else
  6188. list_merge = (wl_scan_results_t *) g_scan;
  6189. len_ret = (__u16) wl_iw_get_scan_prep(list_merge, info, extra, buflen_from_user);
  6190. -#endif
  6191. +#endif
  6192. if (g_ss_cache_ctrl.m_link_down) {
  6193.  
  6194. wl_iw_delete_bss_from_ss_cache(g_ss_cache_ctrl.m_active_bssid);
  6195. @@ -2522,7 +2983,10 @@
  6196. wl_iw_run_ss_cache_timer(0);
  6197. wl_iw_run_ss_cache_timer(1);
  6198.  
  6199. -
  6200. +#if defined(WL_IW_USE_ISCAN)
  6201. +
  6202. + g_scan_specified_ssid = 0;
  6203. +#endif
  6204.  
  6205. if ((len_ret + WE_ADD_EVENT_FIX) < buflen_from_user)
  6206. len = len_ret;
  6207. @@ -2555,16 +3019,28 @@
  6208. __u16 merged_len = 0;
  6209. uint buflen_from_user = dwrq->length;
  6210.  
  6211. -
  6212. WL_TRACE(("%s %s buflen_from_user %d:\n", dev->name, __FUNCTION__, dwrq->length));
  6213.  
  6214. +#if defined(SOFTAP)
  6215. + if (ap_cfg_running) {
  6216. + WL_TRACE(("%s: Not executed, reason -'SOFTAP is active'\n", __FUNCTION__));
  6217. + return -EINVAL;
  6218. + }
  6219. +#endif
  6220. +
  6221. if (!extra) {
  6222. - WL_TRACE(("%s: SIOCGIWSCAN GET bad parameter\n", dev->name));
  6223. + WL_TRACE(("%s: INVALID SIOCGIWSCAN GET bad parameter\n", dev->name));
  6224. return -EINVAL;
  6225. }
  6226.  
  6227. + if (g_first_broadcast_scan < BROADCAST_SCAN_FIRST_RESULT_READY) {
  6228. + WL_TRACE(("%s %s: first ISCAN results are NOT ready yet \n", \
  6229. + dev->name, __FUNCTION__));
  6230. + return -EAGAIN;
  6231. + }
  6232.  
  6233. if ((!iscan) || (iscan->sysioc_pid < 0)) {
  6234. + WL_TRACE(("%ssysioc_pid\n", __FUNCTION__));
  6235. return wl_iw_get_scan(dev, info, dwrq, extra);
  6236. }
  6237.  
  6238. @@ -2598,11 +3074,12 @@
  6239. while (p_buf != iscan->list_cur) {
  6240. list = &((wl_iscan_results_t*)p_buf->iscan_buf)->results;
  6241.  
  6242. - counter += list->count;
  6243. + counter += list->count;
  6244.  
  6245. if (list->version != WL_BSS_INFO_VERSION) {
  6246. - WL_ERROR(("list->version %d != WL_BSS_INFO_VERSION\n", list->version));
  6247. - return -EINVAL; /* if WL_BSS_INFO_VERSION is corrupted iscan results are garbage */
  6248. + WL_ERROR(("%s : list->version %d != WL_BSS_INFO_VERSION\n", \
  6249. + __FUNCTION__, list->version));
  6250. + return -EINVAL;
  6251. }
  6252.  
  6253. bi = NULL;
  6254. @@ -2692,9 +3169,15 @@
  6255. dwrq->length += merged_len;
  6256. wl_iw_run_ss_cache_timer(0);
  6257. wl_iw_run_ss_cache_timer(1);
  6258. +
  6259. + g_first_broadcast_scan = BROADCAST_SCAN_FIRST_RESULT_CONSUMED;
  6260.  
  6261. WL_TRACE(("%s return to WE %d bytes APs=%d\n", __FUNCTION__, dwrq->length, counter));
  6262.  
  6263. +
  6264. + if (!dwrq->length)
  6265. + return -EAGAIN;
  6266. +
  6267. return 0;
  6268. }
  6269. #endif
  6270. @@ -2714,6 +3197,8 @@
  6271.  
  6272. memset(&g_ssid, 0, sizeof(g_ssid));
  6273.  
  6274. + CHECK_EXTRA_FOR_NULL(extra);
  6275. +
  6276. if (dwrq->length && extra) {
  6277. #if WIRELESS_EXT > 20
  6278. g_ssid.SSID_len = MIN(sizeof(g_ssid.SSID), dwrq->length);
  6279. @@ -2729,6 +3214,7 @@
  6280. if ((error = dev_wlc_ioctl(dev, WLC_SET_SSID, &g_ssid, sizeof(g_ssid))))
  6281. return error;
  6282.  
  6283. + WL_TRACE(("%s: join SSID=%s\n", __FUNCTION__, g_ssid.SSID));
  6284. return 0;
  6285. }
  6286.  
  6287. @@ -3350,6 +3836,11 @@
  6288. char *extra
  6289. )
  6290. {
  6291. +
  6292. + WL_TRACE(("%s: SIOCSIWGENIE\n", dev->name));
  6293. +
  6294. + CHECK_EXTRA_FOR_NULL(extra);
  6295. +
  6296. dev_wlc_bufvar_set(dev, "wpaie", extra, iwp->length);
  6297.  
  6298. return 0;
  6299. @@ -3383,6 +3874,8 @@
  6300.  
  6301. WL_TRACE(("%s: SIOCSIWENCODEEXT\n", dev->name));
  6302.  
  6303. + CHECK_EXTRA_FOR_NULL(extra);
  6304. +
  6305. memset(&key, 0, sizeof(key));
  6306. iwe = (struct iw_encode_ext *)extra;
  6307.  
  6308. @@ -3495,14 +3988,18 @@
  6309. {
  6310. struct iw_pmksa *iwpmksa;
  6311. uint i;
  6312. + int ret = 0;
  6313. char eabuf[ETHER_ADDR_STR_LEN];
  6314.  
  6315. - WL_TRACE_PMK(("%s: SIOCSIWPMKSA\n", dev->name));
  6316. + WL_WSEC(("%s: SIOCSIWPMKSA\n", dev->name));
  6317. +
  6318. + CHECK_EXTRA_FOR_NULL(extra);
  6319. +
  6320. iwpmksa = (struct iw_pmksa *)extra;
  6321. bzero((char *)eabuf, ETHER_ADDR_STR_LEN);
  6322.  
  6323. if (iwpmksa->cmd == IW_PMKSA_FLUSH) {
  6324. - WL_TRACE_PMK(("wl_iw_set_pmksa - IW_PMKSA_FLUSH\n"));
  6325. + WL_WSEC(("wl_iw_set_pmksa - IW_PMKSA_FLUSH\n"));
  6326. bzero((char *)&pmkid_list, sizeof(pmkid_list));
  6327. }
  6328.  
  6329. @@ -3512,15 +4009,16 @@
  6330. uint j;
  6331. pmkidptr = &pmkid;
  6332.  
  6333. - bcopy(&iwpmksa->bssid.sa_data[0], &pmkidptr->pmkid[0].BSSID, ETHER_ADDR_LEN);
  6334. + bcopy(&iwpmksa->bssid.sa_data[0], &pmkidptr->pmkid[0].BSSID, \
  6335. + ETHER_ADDR_LEN);
  6336. bcopy(&iwpmksa->pmkid[0], &pmkidptr->pmkid[0].PMKID, WPA2_PMKID_LEN);
  6337.  
  6338. - WL_TRACE_PMK(("wl_iw_set_pmksa,IW_PMKSA_REMOVE - PMKID: %s = ",
  6339. + WL_WSEC(("wl_iw_set_pmksa,IW_PMKSA_REMOVE - PMKID: %s = ",
  6340. bcm_ether_ntoa(&pmkidptr->pmkid[0].BSSID,
  6341. eabuf)));
  6342. for (j = 0; j < WPA2_PMKID_LEN; j++)
  6343. - WL_TRACE_PMK(("%02x ", pmkidptr->pmkid[0].PMKID[j]));
  6344. - WL_TRACE_PMK(("\n"));
  6345. + WL_WSEC(("%02x ", pmkidptr->pmkid[0].PMKID[j]));
  6346. + WL_WSEC(("\n"));
  6347. }
  6348.  
  6349. for (i = 0; i < pmkid_list.pmkids.npmkid; i++)
  6350. @@ -3540,6 +4038,8 @@
  6351. }
  6352. pmkid_list.pmkids.npmkid--;
  6353. }
  6354. + else
  6355. + ret = -EINVAL;
  6356. }
  6357.  
  6358. else if (iwpmksa->cmd == IW_PMKSA_ADD) {
  6359. @@ -3556,32 +4056,36 @@
  6360. if (i == pmkid_list.pmkids.npmkid)
  6361. pmkid_list.pmkids.npmkid++;
  6362. }
  6363. + else
  6364. + ret = -EINVAL;
  6365. {
  6366. uint j;
  6367. uint k;
  6368. k = pmkid_list.pmkids.npmkid;
  6369. - WL_TRACE_PMK(("wl_iw_set_pmksa,IW_PMKSA_ADD - PMKID: %s = ",
  6370. + WL_WSEC(("wl_iw_set_pmksa,IW_PMKSA_ADD - PMKID: %s = ",
  6371. bcm_ether_ntoa(&pmkid_list.pmkids.pmkid[k].BSSID,
  6372. eabuf)));
  6373. for (j = 0; j < WPA2_PMKID_LEN; j++)
  6374. - WL_TRACE_PMK(("%02x ", pmkid_list.pmkids.pmkid[k].PMKID[j]));
  6375. - WL_TRACE_PMK(("\n"));
  6376. + WL_WSEC(("%02x ", pmkid_list.pmkids.pmkid[k].PMKID[j]));
  6377. + WL_WSEC(("\n"));
  6378. }
  6379. }
  6380. - WL_TRACE_PMK(("PRINTING pmkid LIST - No of elements %d\n", pmkid_list.pmkids.npmkid));
  6381. + WL_WSEC(("PRINTING pmkid LIST - No of elements %d\n", pmkid_list.pmkids.npmkid));
  6382. for (i = 0; i < pmkid_list.pmkids.npmkid; i++) {
  6383. uint j;
  6384. - WL_TRACE_PMK(("PMKID[%d]: %s = ", i,
  6385. + WL_WSEC(("PMKID[%d]: %s = ", i,
  6386. bcm_ether_ntoa(&pmkid_list.pmkids.pmkid[i].BSSID,
  6387. eabuf)));
  6388. for (j = 0; j < WPA2_PMKID_LEN; j++)
  6389. - WL_TRACE_PMK(("%02x ", pmkid_list.pmkids.pmkid[i].PMKID[j]));
  6390. - WL_TRACE_PMK(("\n"));
  6391. + WL_WSEC(("%02x ", pmkid_list.pmkids.pmkid[i].PMKID[j]));
  6392. + WL_WSEC(("\n"));
  6393. }
  6394. - WL_TRACE_PMK(("\n"));
  6395. + WL_WSEC(("\n"));
  6396.  
  6397. - dev_wlc_bufvar_set(dev, "pmkid_info", (char *)&pmkid_list, sizeof(pmkid_list));
  6398. - return 0;
  6399. + if (!ret)
  6400. + ret = dev_wlc_bufvar_set(dev, "pmkid_info", (char *)&pmkid_list, \
  6401. + sizeof(pmkid_list));
  6402. + return ret;
  6403. }
  6404. #endif
  6405. #endif
  6406. @@ -3614,6 +4118,13 @@
  6407.  
  6408. WL_TRACE(("%s: SIOCSIWAUTH\n", dev->name));
  6409.  
  6410. +#if defined(SOFTAP)
  6411. + if (ap_cfg_running) {
  6412. + WL_TRACE(("%s: Not executed, reason -'SOFTAP is active'\n", __FUNCTION__));
  6413. + return 0;
  6414. + }
  6415. +#endif
  6416. +
  6417. paramid = vwrq->flags & IW_AUTH_INDEX;
  6418. paramval = vwrq->value;
  6419.  
  6420. @@ -3655,6 +4166,20 @@
  6421. val |= iw->pwsec;
  6422. }
  6423.  
  6424. + if (iw->privacy_invoked && !val) {
  6425. + WL_WSEC(("%s: %s: 'Privacy invoked' TRUE but clearing wsec, assuming "
  6426. + "we're a WPS enrollee\n", dev->name, __FUNCTION__));
  6427. + if ((error = dev_wlc_intvar_set(dev, "is_WPS_enrollee", TRUE))) {
  6428. + WL_WSEC(("Failed to set iovar is_WPS_enrollee\n"));
  6429. + return error;
  6430. + }
  6431. + } else if (val) {
  6432. + if ((error = dev_wlc_intvar_set(dev, "is_WPS_enrollee", FALSE))) {
  6433. + WL_WSEC(("Failed to clear iovar is_WPS_enrollee\n"));
  6434. + return error;
  6435. + }
  6436. + }
  6437. +
  6438. if ((error = dev_wlc_intvar_set(dev, "wsec", val)))
  6439. return error;
  6440.  
  6441. @@ -3681,6 +4206,7 @@
  6442. WL_INFORM(("%s: %d: setting wpa_auth to %d\n", __FUNCTION__, __LINE__, val));
  6443. if ((error = dev_wlc_intvar_set(dev, "wpa_auth", val)))
  6444. return error;
  6445. +
  6446. break;
  6447. case IW_AUTH_TKIP_COUNTERMEASURES:
  6448. dev_wlc_bufvar_set(dev, "tkip_countermeasures", (char *)&paramval, 1);
  6449. @@ -3733,9 +4259,36 @@
  6450. WL_INFORM(("%s: IW_AUTH_ROAMING_CONTROL\n", __FUNCTION__));
  6451.  
  6452. break;
  6453. - case IW_AUTH_PRIVACY_INVOKED:
  6454. - WL_INFORM(("%s: IW_AUTH_PRIVACY_INVOKED\n", __FUNCTION__));
  6455. + case IW_AUTH_PRIVACY_INVOKED: {
  6456. + int wsec;
  6457. +
  6458. + if (paramval == 0) {
  6459. + iw->privacy_invoked = FALSE;
  6460. + if ((error = dev_wlc_intvar_set(dev, "is_WPS_enrollee", FALSE))) {
  6461. + WL_WSEC(("Failed to clear iovar is_WPS_enrollee\n"));
  6462. + return error;
  6463. + }
  6464. + } else {
  6465. + iw->privacy_invoked = TRUE;
  6466. + if ((error = dev_wlc_intvar_get(dev, "wsec", &wsec)))
  6467. + return error;
  6468. +
  6469. + if (!(IW_WSEC_ENABLED(wsec))) {
  6470. +
  6471. +
  6472. + if ((error = dev_wlc_intvar_set(dev, "is_WPS_enrollee", TRUE))) {
  6473. + WL_WSEC(("Failed to set iovar is_WPS_enrollee\n"));
  6474. + return error;
  6475. + }
  6476. + } else {
  6477. + if ((error = dev_wlc_intvar_set(dev, "is_WPS_enrollee", FALSE))) {
  6478. + WL_WSEC(("Failed to clear iovar is_WPS_enrollee\n"));
  6479. + return error;
  6480. + }
  6481. + }
  6482. + }
  6483. break;
  6484. + }
  6485. #endif
  6486. default:
  6487. break;
  6488. @@ -3844,8 +4397,9 @@
  6489.  
  6490. break;
  6491. case IW_AUTH_PRIVACY_INVOKED:
  6492. - WL_ERROR(("%s: IW_AUTH_PRIVACY_INVOKED\n", __FUNCTION__));
  6493. + paramval = iw->privacy_invoked;
  6494. break;
  6495. +
  6496. #endif
  6497. }
  6498. vwrq->value = paramval;
  6499. @@ -3854,54 +4408,1001 @@
  6500. #endif
  6501.  
  6502.  
  6503. +#ifdef SOFTAP
  6504.  
  6505. +static int ap_macmode = MACLIST_MODE_DISABLED;
  6506. +static struct mflist ap_black_list;
  6507. static int
  6508. -wl_iw_set_priv(
  6509. - struct net_device *dev,
  6510. - struct iw_request_info *info,
  6511. - struct iw_point *dwrq,
  6512. - char *ext
  6513. -)
  6514. +wl_iw_parse_wep(char *keystr, wl_wsec_key_t *key)
  6515. {
  6516. - int ret = 0;
  6517. - char * extra;
  6518. -
  6519. - if (!(extra = kmalloc(dwrq->length, GFP_KERNEL)))
  6520. - return -ENOMEM;
  6521. -
  6522. - if (copy_from_user(extra, dwrq->pointer, dwrq->length)) {
  6523. - kfree(extra);
  6524. - return -EFAULT;
  6525. + char hex[] = "XX";
  6526. + unsigned char *data = key->data;
  6527. +
  6528. + switch (strlen(keystr)) {
  6529. + case 5:
  6530. + case 13:
  6531. + case 16:
  6532. + key->len = strlen(keystr);
  6533. + memcpy(data, keystr, key->len + 1);
  6534. + break;
  6535. + case 12:
  6536. + case 28:
  6537. + case 34:
  6538. + case 66:
  6539. +
  6540. + if (!strnicmp(keystr, "0x", 2))
  6541. + keystr += 2;
  6542. + else
  6543. + return -1;
  6544. +
  6545. + case 10:
  6546. + case 26:
  6547. + case 32:
  6548. + case 64:
  6549. + key->len = strlen(keystr) / 2;
  6550. + while (*keystr) {
  6551. + strncpy(hex, keystr, 2);
  6552. + *data++ = (char) bcm_strtoul(hex, NULL, 16);
  6553. + keystr += 2;
  6554. + }
  6555. + break;
  6556. + default:
  6557. + return -1;
  6558. }
  6559.  
  6560. - WL_TRACE(("%s: SIOCSIWPRIV requst = %s\n",
  6561. - dev->name, extra));
  6562. + switch (key->len) {
  6563. + case 5:
  6564. + key->algo = CRYPTO_ALGO_WEP1;
  6565. + break;
  6566. + case 13:
  6567. + key->algo = CRYPTO_ALGO_WEP128;
  6568. + break;
  6569. + case 16:
  6570. +
  6571. + key->algo = CRYPTO_ALGO_AES_CCM;
  6572. + break;
  6573. + case 32:
  6574. + key->algo = CRYPTO_ALGO_TKIP;
  6575. + break;
  6576. + default:
  6577. + return -1;
  6578. + }
  6579.  
  6580. - net_os_wake_lock(dev);
  6581.  
  6582. - if (dwrq->length && extra) {
  6583. - if (strnicmp(extra, "START", strlen("START")) == 0) {
  6584. - wl_iw_control_wl_on(dev, info);
  6585. - WL_TRACE(("%s, Received regular START command\n", __FUNCTION__));
  6586. - }
  6587. + key->flags |= WL_PRIMARY_KEY;
  6588.  
  6589. - if (g_onoff == G_WLAN_SET_OFF) {
  6590. - WL_TRACE(("%s, missing START, Fail\n", __FUNCTION__));
  6591. - kfree(extra);
  6592. - net_os_wake_unlock(dev);
  6593. - return -EFAULT;
  6594. - }
  6595. + return 0;
  6596. +}
  6597. +
  6598. +#ifdef EXT_WPA_CRYPTO
  6599. +#define SHA1HashSize 20
  6600. +extern void pbkdf2_sha1(const char *passphrase, const char *ssid, size_t ssid_len, \
  6601. + int iterations, u8 *buf, size_t buflen);
  6602.  
  6603. - if (strnicmp(extra, "SCAN-ACTIVE", strlen("SCAN-ACTIVE")) == 0) {
  6604. -#ifdef ENABLE_ACTIVE_PASSIVE_SCAN_SUPPRESS
  6605. - WL_TRACE(("%s: active scan setting supppressed\n", dev->name));
  6606. #else
  6607. - ret = wl_iw_set_active_scan(dev, info, (union iwreq_data *)dwrq, extra);
  6608. +
  6609. +#define SHA1HashSize 20
  6610. +int pbkdf2_sha1(const char *passphrase, const char *ssid, size_t ssid_len, \
  6611. + int iterations, u8 *buf, size_t buflen)
  6612. +{
  6613. + WL_ERROR(("WARNING: %s is not implemented !!!\n", __FUNCTION__));
  6614. + return -1;
  6615. +}
  6616. +
  6617. #endif
  6618. - }
  6619. - else if (strnicmp(extra, "SCAN-PASSIVE", strlen("SCAN-PASSIVE")) == 0)
  6620. +
  6621. +int dev_iw_write_cfg1_bss_var(struct net_device *dev, int val)
  6622. +{
  6623. + struct {
  6624. + int cfg;
  6625. + int val;
  6626. + } bss_setbuf;
  6627. +
  6628. + int bss_set_res;
  6629. + char smbuf[WLC_IOCTL_SMLEN];
  6630. + memset(smbuf, 0, sizeof(smbuf));
  6631. +
  6632. + bss_setbuf.cfg = 1;
  6633. + bss_setbuf.val = val;
  6634. +
  6635. + bss_set_res = dev_iw_iovar_setbuf(dev, "bss",
  6636. + &bss_setbuf, sizeof(bss_setbuf), smbuf, sizeof(smbuf));
  6637. + WL_TRACE(("\n:%s: bss_set_result:%d\n", __FUNCTION__, bss_set_res));
  6638. +
  6639. + return bss_set_res;
  6640. +}
  6641. +
  6642. +static int wl_bssiovar_mkbuf(
  6643. + const char *iovar,
  6644. + int bssidx,
  6645. + void *param,
  6646. + int paramlen,
  6647. + void *bufptr,
  6648. + int buflen,
  6649. + int *perr)
  6650. +{
  6651. + const char *prefix = "bsscfg:";
  6652. + int8* p;
  6653. + uint prefixlen;
  6654. + uint namelen;
  6655. + uint iolen;
  6656. +
  6657. + prefixlen = strlen(prefix);
  6658. + namelen = strlen(iovar) + 1;
  6659. + iolen = prefixlen + namelen + sizeof(int) + paramlen;
  6660. +
  6661. +
  6662. + if (buflen < 0 || iolen > (uint)buflen) {
  6663. + *perr = BCME_BUFTOOSHORT;
  6664. + return 0;
  6665. + }
  6666. +
  6667. + p = (int8*)bufptr;
  6668. +
  6669. +
  6670. + memcpy(p, prefix, prefixlen);
  6671. + p += prefixlen;
  6672. +
  6673. +
  6674. + memcpy(p, iovar, namelen);
  6675. + p += namelen;
  6676. +
  6677. +
  6678. + bssidx = htod32(bssidx);
  6679. + memcpy(p, &bssidx, sizeof(int32));
  6680. + p += sizeof(int32);
  6681. +
  6682. +
  6683. + if (paramlen)
  6684. + memcpy(p, param, paramlen);
  6685. +
  6686. + *perr = 0;
  6687. + return iolen;
  6688. +}
  6689. +
  6690. +
  6691. +
  6692. +
  6693. +int get_user_params(char *user_params, struct iw_point *dwrq)
  6694. +{
  6695. + int ret = 0;
  6696. +
  6697. + if (copy_from_user(user_params, dwrq->pointer, dwrq->length)) {
  6698. + WL_ERROR(("\n%s: no user params: uptr:%p, ulen:%d\n",
  6699. + __FUNCTION__, dwrq->pointer, dwrq->length));
  6700. + return -EFAULT;
  6701. + }
  6702. +
  6703. + WL_TRACE(("\n%s: iwpriv user params:%s\n", __FUNCTION__, user_params));
  6704. +
  6705. + return ret;
  6706. +}
  6707. +
  6708. +
  6709. +#ifdef SOFTAP
  6710. +
  6711. +
  6712. +static int thr_wait_for_2nd_eth_dev(void *data)
  6713. +{
  6714. +
  6715. + DAEMONIZE("wl0_eth_wthread");
  6716. +
  6717. + WL_TRACE(("\n>%s threda started:, PID:%x\n", __FUNCTION__, current->pid));
  6718. +
  6719. + if (down_timeout(&ap_eth_sema, msecs_to_jiffies(5000)) != 0) {
  6720. + WL_ERROR(("\n%s: sap_eth_sema timeout \n", __FUNCTION__));
  6721. + return -1;
  6722. + }
  6723. +
  6724. + if (!ap_net_dev) {
  6725. + WL_ERROR((" ap_net_dev is null !!!"));
  6726. + return -1;
  6727. + }
  6728. +
  6729. + WL_TRACE(("\n>%s: Thread:'softap ethdev IF:%s is detected !!!'\n\n",
  6730. + __FUNCTION__, ap_net_dev->name));
  6731. +
  6732. + ap_mode = 1;
  6733. + ap_cfg_running = TRUE;
  6734. +
  6735. + bcm_mdelay(500);
  6736. +
  6737. +
  6738. + wl_iw_send_priv_event(priv_dev, "ASCII_CMD=AP_BSS_START");
  6739. +
  6740. + WL_TRACE(("\n>%s, thread completed\n", __FUNCTION__));
  6741. +
  6742. + return 0;
  6743. +}
  6744. +
  6745. +
  6746. +static int set_ap_cfg(struct net_device *dev, struct ap_profile *ap)
  6747. +{
  6748. + int updown = 0;
  6749. + int channel = 0;
  6750. +
  6751. + wlc_ssid_t ap_ssid;
  6752. + wlc_ssid_t null_ssid;
  6753. + int max_assoc = 8;
  6754. + int mpc = 0;
  6755. +
  6756. + int res = 0;
  6757. + int apsta_var = 0;
  6758. + int iolen = 0;
  6759. + int mkvar_err = 0;
  6760. + int bsscfg_index = 1;
  6761. + char buf[WLC_IOCTL_SMLEN];
  6762. +
  6763. + ap_mode = 0;
  6764. +
  6765. + memset(&null_ssid, 0, sizeof(wlc_ssid_t));
  6766. + WL_SOFTAP(("wl_iw: set ap profile:\n"));
  6767. + WL_SOFTAP((" ssid = '%s'\n", ap->ssid));
  6768. + WL_SOFTAP((" security = '%s'\n", ap->sec));
  6769. + if (ap->key[0] != '\0')
  6770. + WL_SOFTAP((" key = '%s'\n", ap->key));
  6771. + WL_SOFTAP((" channel = %d\n", ap->channel));
  6772. + WL_SOFTAP((" max scb = %d\n", ap->max_scb));
  6773. +
  6774. +
  6775. + if (!ap_cfg_running) {
  6776. +
  6777. +
  6778. + sema_init(&ap_eth_sema, 0);
  6779. +
  6780. + mpc = 0;
  6781. + res |= dev_wlc_intvar_set(dev, "mpc", mpc);
  6782. +
  6783. + updown = 0;
  6784. + res |= dev_wlc_ioctl(dev, WLC_DOWN, &updown, sizeof(updown));
  6785. +
  6786. +
  6787. +#ifdef AP_ONLY
  6788. +
  6789. + apsta_var = 0;
  6790. + res | = dev_wlc_ioctl(dev, WLC_SET_AP, &apsta_var, sizeof(apsta_var));
  6791. +
  6792. + apsta_var = 1;
  6793. + res |= dev_wlc_ioctl(dev, WLC_SET_AP, &apsta_var, sizeof(apsta_var));
  6794. + res |= dev_wlc_ioctl(dev, WLC_GET_AP, &apsta_var, sizeof(apsta_var));
  6795. +#else
  6796. +
  6797. + apsta_var = 1;
  6798. + iolen = wl_bssiovar_mkbuf("apsta",
  6799. + bsscfg_index, &apsta_var, sizeof(apsta_var)+4,
  6800. + buf, sizeof(buf), &mkvar_err);
  6801. + ASSERT(iolen);
  6802. + res |= dev_wlc_ioctl(dev, WLC_SET_VAR, buf, iolen);
  6803. + WL_TRACE(("\n>in %s: apsta set result: %d \n", __FUNCTION__, res));
  6804. +#endif
  6805. +
  6806. + updown = 1;
  6807. + res |= dev_wlc_ioctl(dev, WLC_UP, &updown, sizeof(updown));
  6808. + WL_TRACE(("\n:%s >>>> dev_wlc_ioctl(WLC_UP) updown:%d, \n", __FUNCTION__, updown));
  6809. +
  6810. + } else {
  6811. +
  6812. + res |= dev_iw_write_cfg1_bss_var(dev, 0);
  6813. + }
  6814. +
  6815. +
  6816. + if (ap->channel == 0) {
  6817. + int chosen = 0;
  6818. + wl_uint32_list_t request;
  6819. + int rescan = 0;
  6820. + int retry = 0;
  6821. + int ret = 0;
  6822. + res |= dev_wlc_ioctl(dev, WLC_UP, &updown, sizeof(updown));
  6823. + res |= dev_wlc_ioctl(dev, WLC_SET_SSID, &null_ssid, sizeof(null_ssid));
  6824. +
  6825. + auto_channel_retry:
  6826. + request.count = htod32(0);
  6827. + ret = dev_wlc_ioctl(dev, WLC_START_CHANNEL_SEL, &request, sizeof(request));
  6828. + if (ret < 0) {
  6829. + WL_ERROR(("can't start auto channel scan\n"));
  6830. + return -1;
  6831. + }
  6832. +
  6833. + get_channel_retry:
  6834. + bcm_mdelay(500);
  6835. +
  6836. + ret = dev_wlc_ioctl(dev, WLC_GET_CHANNEL_SEL, &chosen, sizeof(chosen));
  6837. + if (ret < 0 || dtoh32(chosen) == 0) {
  6838. + if (retry++ < 3)
  6839. + goto get_channel_retry;
  6840. + else {
  6841. + WL_ERROR(("can't get auto channel sel, err = %d, \
  6842. + chosen = %d\n", ret, chosen));
  6843. + return -1;
  6844. + }
  6845. + }
  6846. + if ((chosen == 1) && (!rescan++))
  6847. + goto auto_channel_retry;
  6848. + WL_SOFTAP(("Set auto channel = %d\n", chosen));
  6849. + ap->channel = chosen;
  6850. + dev_wlc_ioctl(dev, WLC_DOWN, &updown, sizeof(updown));
  6851. + }
  6852. +
  6853. + channel = ap->channel;
  6854. + res |= dev_wlc_ioctl(dev, WLC_SET_CHANNEL, &channel, sizeof(channel));
  6855. +
  6856. + if (!ap_cfg_running) {
  6857. + updown = 0;
  6858. + res |= dev_wlc_ioctl(dev, WLC_UP, &updown, sizeof(updown));
  6859. + }
  6860. +
  6861. + max_assoc = ap->max_scb;
  6862. + res |= dev_wlc_intvar_set(dev, "maxassoc", max_assoc);
  6863. +
  6864. + ap_ssid.SSID_len = strlen(ap->ssid);
  6865. + strncpy(ap_ssid.SSID, ap->ssid, ap_ssid.SSID_len);
  6866. +
  6867. +
  6868. + iolen = wl_bssiovar_mkbuf("ssid", bsscfg_index, (char *)(&ap_ssid),
  6869. + ap_ssid.SSID_len+4, buf, sizeof(buf), &mkvar_err);
  6870. + ASSERT(iolen);
  6871. + res |= dev_wlc_ioctl(dev, WLC_SET_VAR, buf, iolen);
  6872. +
  6873. + if (res != 0) {
  6874. + WL_ERROR(("ERROR:%d in:%s, Security & BSS reconfiguration is skipped\n", \
  6875. + res, __FUNCTION__));
  6876. + return res;
  6877. + }
  6878. + if (!ap_cfg_running) {
  6879. +
  6880. + kernel_thread(thr_wait_for_2nd_eth_dev, 0, 0);
  6881. + } else {
  6882. +
  6883. +
  6884. + if (ap_net_dev == NULL) {
  6885. + WL_ERROR(("%s ERROR: ap_net_dev is NULL !!!\n", __FUNCTION__));
  6886. + return -1;
  6887. + }
  6888. +
  6889. + WL_TRACE(("%s: %s Configure security & restart AP bss \n", \
  6890. + __FUNCTION__, ap_net_dev->name));
  6891. +
  6892. +
  6893. + res |= wl_iw_set_ap_security(ap_net_dev, &my_ap);
  6894. +
  6895. +
  6896. + res |= dev_iw_write_cfg1_bss_var(dev, 1);
  6897. + }
  6898. +
  6899. + return res;
  6900. +}
  6901. +#endif
  6902. +
  6903. +
  6904. +
  6905. +static int wl_iw_set_ap_security(struct net_device *dev, struct ap_profile *ap)
  6906. +{
  6907. + int wsec = 0;
  6908. + int wpa_auth = 0;
  6909. + int res = 0;
  6910. + int i;
  6911. + char *ptr;
  6912. +
  6913. + WL_SOFTAP(("\nsetting SOFTAP security mode:\n"));
  6914. + WL_SOFTAP(("wl_iw: set ap profile:\n"));
  6915. + WL_SOFTAP((" ssid = '%s'\n", ap->ssid));
  6916. + WL_SOFTAP((" security = '%s'\n", ap->sec));
  6917. + if (ap->key[0] != '\0')
  6918. + WL_SOFTAP((" key = '%s'\n", ap->key));
  6919. + WL_SOFTAP((" channel = %d\n", ap->channel));
  6920. + WL_SOFTAP((" max scb = %d\n", ap->max_scb));
  6921. +
  6922. +
  6923. + if (strnicmp(ap->sec, "open", strlen("open")) == 0) {
  6924. +
  6925. +
  6926. + wsec = 0;
  6927. + res = dev_wlc_intvar_set(dev, "wsec", wsec);
  6928. + wpa_auth = WPA_AUTH_DISABLED;
  6929. + res |= dev_wlc_intvar_set(dev, "wpa_auth", wpa_auth);
  6930. +
  6931. + WL_SOFTAP(("=====================\n"));
  6932. + WL_SOFTAP((" wsec & wpa_auth set 'OPEN', result:&d %d\n", res));
  6933. + WL_SOFTAP(("=====================\n"));
  6934. +
  6935. + } else if (strnicmp(ap->sec, "wep", strlen("wep")) == 0) {
  6936. +
  6937. +
  6938. + wl_wsec_key_t key;
  6939. + memset(&key, 0, sizeof(key));
  6940. +
  6941. + wsec = WEP_ENABLED;
  6942. + res = dev_wlc_intvar_set(dev, "wsec", wsec);
  6943. +
  6944. + key.index = 0;
  6945. + if (wl_iw_parse_wep(ap->key, &key)) {
  6946. + WL_SOFTAP(("wep key parse err!\n"));
  6947. + return -1;
  6948. + }
  6949. +
  6950. + key.index = htod32(key.index);
  6951. + key.len = htod32(key.len);
  6952. + key.algo = htod32(key.algo);
  6953. + key.flags = htod32(key.flags);
  6954. +
  6955. + res |= dev_wlc_ioctl(dev, WLC_SET_KEY, &key, sizeof(key));
  6956. +
  6957. + wpa_auth = WPA_AUTH_DISABLED;
  6958. + res |= dev_wlc_intvar_set(dev, "wpa_auth", wpa_auth);
  6959. +
  6960. + WL_SOFTAP(("=====================\n"));
  6961. + WL_SOFTAP((" wsec & auth set 'WEP', result:&d %d\n", res));
  6962. + WL_SOFTAP(("=====================\n"));
  6963. +
  6964. + } else if (strnicmp(ap->sec, "wpa2-psk", strlen("wpa2-psk")) == 0) {
  6965. +
  6966. +
  6967. +
  6968. + wsec_pmk_t psk;
  6969. + size_t key_len;
  6970. +
  6971. + wsec = AES_ENABLED;
  6972. + dev_wlc_intvar_set(dev, "wsec", wsec);
  6973. +
  6974. + key_len = strlen(ap->key);
  6975. + if (key_len < WSEC_MIN_PSK_LEN || key_len > WSEC_MAX_PSK_LEN) {
  6976. + WL_SOFTAP(("passphrase must be between %d and %d characters long\n",
  6977. + WSEC_MIN_PSK_LEN, WSEC_MAX_PSK_LEN));
  6978. + return -1;
  6979. + }
  6980. +
  6981. +
  6982. + if (key_len < WSEC_MAX_PSK_LEN) {
  6983. + unsigned char output[2*SHA1HashSize];
  6984. + char key_str_buf[WSEC_MAX_PSK_LEN+1];
  6985. +
  6986. +
  6987. + memset(output, 0, sizeof(output));
  6988. + pbkdf2_sha1(ap->key, ap->ssid, strlen(ap->ssid), 4096, output, 32);
  6989. +
  6990. + ptr = key_str_buf;
  6991. + for (i = 0; i < (WSEC_MAX_PSK_LEN/8); i++) {
  6992. +
  6993. + sprintf(ptr, "%02x%02x%02x%02x", (uint)output[i*4], \
  6994. + (uint)output[i*4+1], (uint)output[i*4+2], \
  6995. + (uint)output[i*4+3]);
  6996. + ptr += 8;
  6997. + }
  6998. + WL_SOFTAP(("%s: passphase = %s\n", __FUNCTION__, key_str_buf));
  6999. +
  7000. + psk.key_len = htod16((ushort)WSEC_MAX_PSK_LEN);
  7001. + memcpy(psk.key, key_str_buf, psk.key_len);
  7002. + } else {
  7003. + psk.key_len = htod16((ushort) key_len);
  7004. + memcpy(psk.key, ap->key, key_len);
  7005. + }
  7006. + psk.flags = htod16(WSEC_PASSPHRASE);
  7007. + dev_wlc_ioctl(dev, WLC_SET_WSEC_PMK, &psk, sizeof(psk));
  7008. +
  7009. + wpa_auth = WPA2_AUTH_PSK;
  7010. + dev_wlc_intvar_set(dev, "wpa_auth", wpa_auth);
  7011. +
  7012. + } else if (strnicmp(ap->sec, "wpa-psk", strlen("wpa-psk")) == 0) {
  7013. +
  7014. +
  7015. + wsec_pmk_t psk;
  7016. + size_t key_len;
  7017. +
  7018. + wsec = TKIP_ENABLED;
  7019. + res = dev_wlc_intvar_set(dev, "wsec", wsec);
  7020. +
  7021. + key_len = strlen(ap->key);
  7022. + if (key_len < WSEC_MIN_PSK_LEN || key_len > WSEC_MAX_PSK_LEN) {
  7023. + WL_SOFTAP(("passphrase must be between %d and %d characters long\n",
  7024. + WSEC_MIN_PSK_LEN, WSEC_MAX_PSK_LEN));
  7025. + return -1;
  7026. + }
  7027. +
  7028. +
  7029. + if (key_len < WSEC_MAX_PSK_LEN) {
  7030. + unsigned char output[2*SHA1HashSize];
  7031. + char key_str_buf[WSEC_MAX_PSK_LEN+1];
  7032. +
  7033. + WL_SOFTAP(("%s: do passhash...\n", __FUNCTION__));
  7034. +
  7035. + pbkdf2_sha1(ap->key, ap->ssid, strlen(ap->ssid), 4096, output, 32);
  7036. +
  7037. + ptr = key_str_buf;
  7038. + for (i = 0; i < (WSEC_MAX_PSK_LEN/8); i++) {
  7039. + WL_SOFTAP(("[%02d]: %08x\n", i, *((unsigned int*)&output[i*4])));
  7040. +
  7041. + sprintf(ptr, "%02x%02x%02x%02x", (uint)output[i*4], \
  7042. + (uint)output[i*4+1], (uint)output[i*4+2], \
  7043. + (uint)output[i*4+3]);
  7044. + ptr += 8;
  7045. + }
  7046. + printk("%s: passphase = %s\n", __FUNCTION__, key_str_buf);
  7047. +
  7048. + psk.key_len = htod16((ushort)WSEC_MAX_PSK_LEN);
  7049. + memcpy(psk.key, key_str_buf, psk.key_len);
  7050. + } else {
  7051. + psk.key_len = htod16((ushort) key_len);
  7052. + memcpy(psk.key, ap->key, key_len);
  7053. + }
  7054. +
  7055. + psk.flags = htod16(WSEC_PASSPHRASE);
  7056. + res |= dev_wlc_ioctl(dev, WLC_SET_WSEC_PMK, &psk, sizeof(psk));
  7057. +
  7058. + wpa_auth = WPA_AUTH_PSK;
  7059. + res |= dev_wlc_intvar_set(dev, "wpa_auth", wpa_auth);
  7060. +
  7061. + WL_SOFTAP((" wsec & auth set 'wpa-psk' (TKIP), result:&d %d\n", res));
  7062. + }
  7063. +
  7064. + return res;
  7065. +}
  7066. +
  7067. +
  7068. +
  7069. +int get_parmeter_from_string(
  7070. + char **str_ptr, const char *token,
  7071. + int param_type, void *dst, int param_max_len)
  7072. +{
  7073. + char int_str[7] = "0";
  7074. + int parm_str_len;
  7075. + char *param_str_begin;
  7076. + char *param_str_end;
  7077. + char *orig_str = *str_ptr;
  7078. +
  7079. + if (!strncmp(*str_ptr, token, strlen(token))) {
  7080. +
  7081. + strsep(str_ptr, "=,");
  7082. + param_str_begin = *str_ptr;
  7083. + strsep(str_ptr, "=,");
  7084. +
  7085. + if (*str_ptr == NULL) {
  7086. +
  7087. + parm_str_len = strlen(param_str_begin);
  7088. + } else {
  7089. + param_str_end = *str_ptr-1;
  7090. + parm_str_len = param_str_end - param_str_begin;
  7091. + }
  7092. +
  7093. + WL_TRACE((" 'token:%s', len:%d, ", token, parm_str_len));
  7094. +
  7095. + if (parm_str_len > param_max_len) {
  7096. + WL_TRACE((" WARNING: extracted param len:%d is > MAX:%d\n",
  7097. + parm_str_len, param_max_len));
  7098. +
  7099. + parm_str_len = param_max_len;
  7100. + }
  7101. +
  7102. + switch (param_type) {
  7103. +
  7104. + case PTYPE_INTDEC: {
  7105. +
  7106. + int *pdst_int = dst;
  7107. + char *eptr;
  7108. + if (parm_str_len > sizeof(int_str))
  7109. + parm_str_len = sizeof(int_str);
  7110. +
  7111. + memcpy(int_str, param_str_begin, parm_str_len);
  7112. +
  7113. + *pdst_int = simple_strtoul(int_str, &eptr, 10);
  7114. +
  7115. + WL_TRACE((" written as integer:%d\n", *pdst_int));
  7116. + }
  7117. + break;
  7118. + case PTYPE_STR_HEX: {
  7119. + u8 *buf = dst;
  7120. +
  7121. + param_max_len = param_max_len >> 1;
  7122. + hstr_2_buf(param_str_begin, buf, param_max_len);
  7123. + print_buf(buf, param_max_len, 0);
  7124. + }
  7125. + break;
  7126. + default:
  7127. +
  7128. + memcpy(dst, param_str_begin, parm_str_len);
  7129. + *((char *)dst + parm_str_len) = 0;
  7130. + WL_TRACE((" written as a string:%s\n", (char *)dst));
  7131. + break;
  7132. +
  7133. + }
  7134. +
  7135. + return 0;
  7136. + } else {
  7137. + WL_ERROR(("\n %s: ERROR: can't find token:%s in str:%s \n",
  7138. + __FUNCTION__, token, orig_str));
  7139. +
  7140. + return -1;
  7141. + }
  7142. +}
  7143. +
  7144. +
  7145. +int wl_iw_softap_deassoc_stations(struct net_device *dev)
  7146. +{
  7147. + int i;
  7148. + int res = 0;
  7149. +
  7150. + char mac_buf[128] = {0};
  7151. + struct maclist *assoc_maclist = (struct maclist *) mac_buf;
  7152. +
  7153. + memset(assoc_maclist, 0, sizeof(mac_buf));
  7154. + assoc_maclist->count = 8;
  7155. +
  7156. + res = dev_wlc_ioctl(dev, WLC_GET_ASSOCLIST, assoc_maclist, 128);
  7157. + if (res != 0) {
  7158. +
  7159. + WL_SOFTAP((" Error:%d in :%s, Couldn't get ASSOC List\n", res, __FUNCTION__));
  7160. + return res;
  7161. + }
  7162. +
  7163. +
  7164. + if (assoc_maclist->count)
  7165. + for (i = 0; i < assoc_maclist->count; i++) {
  7166. + scb_val_t scbval;
  7167. + scbval.val = htod32(1);
  7168. +
  7169. + bcopy(&assoc_maclist->ea[i], &scbval.ea, ETHER_ADDR_LEN);
  7170. +
  7171. + WL_SOFTAP(("deauth STA:%d \n", i));
  7172. + res |= dev_wlc_ioctl(dev, WLC_SCB_DEAUTHENTICATE_FOR_REASON,
  7173. + &scbval, sizeof(scb_val_t));
  7174. +
  7175. + } else WL_SOFTAP((" STA ASSOC list is empty\n"));
  7176. +
  7177. +
  7178. + if (res != 0)
  7179. + WL_SOFTAP((" Error:%d in :%s\n", res, __FUNCTION__));
  7180. + return res;
  7181. +}
  7182. +
  7183. +static int iwpriv_softap_stop(struct net_device *dev,
  7184. + struct iw_request_info *info,
  7185. + union iwreq_data *wrqu,
  7186. + char *ext)
  7187. +{
  7188. + int res = 0;
  7189. +
  7190. + WL_SOFTAP(("got iwpriv AP_BSS_STOP \n"));
  7191. +
  7192. + if ((!dev) && (!ap_net_dev)) {
  7193. + WL_ERROR(("%s: dev is null\n", __FUNCTION__));
  7194. + return res;
  7195. + }
  7196. +
  7197. + res |= wl_iw_softap_deassoc_stations(ap_net_dev);
  7198. +
  7199. + bcm_mdelay(200);
  7200. +
  7201. + res |= dev_iw_write_cfg1_bss_var(dev, 2);
  7202. +
  7203. + wrqu->data.length = 0;
  7204. + ap_mode = 0;
  7205. + ap_cfg_running = FALSE;
  7206. +
  7207. + return res;
  7208. +}
  7209. +
  7210. +
  7211. +
  7212. +static int iwpriv_fw_reload(struct net_device *dev,
  7213. + struct iw_request_info *info,
  7214. + union iwreq_data *wrqu,
  7215. + char *ext)
  7216. +{
  7217. +
  7218. + int ret = -1;
  7219. + char extra[256];
  7220. + char *fwstr = fw_path ;
  7221. +
  7222. + WL_SOFTAP(("current firmware_path[]=%s\n", fwstr));
  7223. +
  7224. + WL_TRACE((">Got FW_RELOAD cmd:"
  7225. + "info->cmd:%x, info->flags:%x, u.data:%p, u.len:%d, \
  7226. + fw_path:%p, len:%d \n",
  7227. + info->cmd, info->flags,
  7228. + wrqu->data.pointer, wrqu->data.length, fwstr, strlen(fwstr)));
  7229. +
  7230. +
  7231. + if ((wrqu->data.length > 4) && (wrqu->data.length < sizeof(extra))) {
  7232. +
  7233. + char *str_ptr;
  7234. +
  7235. + if (copy_from_user(extra, wrqu->data.pointer, wrqu->data.length)) {
  7236. + ret = -EFAULT;
  7237. + goto exit_proc;
  7238. + }
  7239. +
  7240. +
  7241. + extra[wrqu->data.length] = 8;
  7242. + str_ptr = extra;
  7243. +
  7244. + if (get_parmeter_from_string(&str_ptr, "FW_PATH=", PTYPE_STRING, fwstr, 255) != 0) {
  7245. + WL_ERROR(("Error: extracting FW_PATH='' string\n"));
  7246. + goto exit_proc;
  7247. + }
  7248. +
  7249. + if (strstr(fwstr, "apsta") != NULL) {
  7250. + WL_SOFTAP(("GOT APSTA FIRMWARE\n"));
  7251. + ap_fw_loaded = TRUE;
  7252. + } else {
  7253. + WL_SOFTAP(("GOT STA FIRMWARE\n"));
  7254. + ap_fw_loaded = FALSE;
  7255. + }
  7256. +
  7257. + WL_SOFTAP(("SET firmware_path[]=%s , str_p:%p\n", fwstr, fwstr));
  7258. + ret = 0;
  7259. + } else {
  7260. + WL_ERROR(("Error: ivalid param len:%d\n", wrqu->data.length));
  7261. + }
  7262. +
  7263. +exit_proc:
  7264. + return ret;
  7265. +}
  7266. +#ifdef SOFTAP
  7267. +static int iwpriv_wpasupp_loop_tst(struct net_device *dev,
  7268. + struct iw_request_info *info,
  7269. + union iwreq_data *wrqu,
  7270. + char *ext)
  7271. +{
  7272. + int res = 0;
  7273. + char *params = NULL;
  7274. +
  7275. + WL_TRACE((">Got IWPRIV wp_supp loopback cmd test:"
  7276. + "info->cmd:%x, info->flags:%x, u.data:%p, u.len:%d\n",
  7277. + info->cmd, info->flags,
  7278. + wrqu->data.pointer, wrqu->data.length));
  7279. +
  7280. + if (wrqu->data.length != 0) {
  7281. +
  7282. + if (!(params = kmalloc(wrqu->data.length+1, GFP_KERNEL)))
  7283. + return -ENOMEM;
  7284. +
  7285. +
  7286. + if (copy_from_user(params, wrqu->data.pointer, wrqu->data.length)) {
  7287. + kfree(params);
  7288. + return -EFAULT;
  7289. + }
  7290. +
  7291. + params[wrqu->data.length] = 0;
  7292. + WL_SOFTAP(("\n>> copied from user:\n %s\n", params));
  7293. + } else {
  7294. + WL_ERROR(("ERROR param length is 0\n"));
  7295. + return -EFAULT;
  7296. + }
  7297. +
  7298. +
  7299. + res = wl_iw_send_priv_event(dev, params);
  7300. + kfree(params);
  7301. +
  7302. + return res;
  7303. +}
  7304. +#endif
  7305. +
  7306. +
  7307. +static int
  7308. + iwpriv_en_ap_bss(
  7309. + struct net_device *dev,
  7310. + struct iw_request_info *info,
  7311. + void *wrqu,
  7312. + char *extra)
  7313. +{
  7314. + int res = 0;
  7315. + WL_TRACE(("%s: rcvd IWPRIV IOCTL: for dev:%s\n", __FUNCTION__, dev->name));
  7316. +
  7317. +
  7318. + if (wl_iw_set_ap_security(dev, &my_ap) != 0) {
  7319. + WL_ERROR(("!!!!:ERROR setting SOFTAP security in :%s\n", __FUNCTION__));
  7320. + };
  7321. +
  7322. +
  7323. + dev_iw_write_cfg1_bss_var(dev, 1);
  7324. + return res;
  7325. +}
  7326. +
  7327. +static int
  7328. +get_assoc_sta_list(struct net_device *dev, char *buf, int len)
  7329. +{
  7330. +
  7331. + WL_TRACE(("calling dev_wlc_ioctl(dev:%p, cmd:%d, buf:%p, len:%d)\n",
  7332. + dev, WLC_GET_ASSOCLIST, buf, len));
  7333. +
  7334. + dev_wlc_ioctl(dev, WLC_GET_ASSOCLIST, buf, len);
  7335. +
  7336. + return 0;
  7337. +}
  7338. +
  7339. +
  7340. +static int
  7341. +set_ap_mac_list(struct net_device *dev, char *buf)
  7342. +{
  7343. + struct mac_list_set *mac_list_set = (struct mac_list_set *)buf;
  7344. + struct maclist *white_maclist = (struct maclist *)&mac_list_set->white_list;
  7345. + struct maclist *black_maclist = (struct maclist *)&mac_list_set->black_list;
  7346. + int mac_mode = mac_list_set->mode;
  7347. + int length;
  7348. + int i;
  7349. +
  7350. + ap_macmode = mac_mode;
  7351. + if (mac_mode == MACLIST_MODE_DISABLED) {
  7352. +
  7353. + bzero(&ap_black_list, sizeof(struct mflist));
  7354. +
  7355. +
  7356. + dev_wlc_ioctl(dev, WLC_SET_MACMODE, &mac_mode, sizeof(mac_mode));
  7357. + } else {
  7358. + scb_val_t scbval;
  7359. + char mac_buf[256] = {0};
  7360. + struct maclist *assoc_maclist = (struct maclist *) mac_buf;
  7361. +
  7362. + mac_mode = MACLIST_MODE_ALLOW;
  7363. +
  7364. + dev_wlc_ioctl(dev, WLC_SET_MACMODE, &mac_mode, sizeof(mac_mode));
  7365. +
  7366. +
  7367. + length = sizeof(white_maclist->count)+white_maclist->count*ETHER_ADDR_LEN;
  7368. + dev_wlc_ioctl(dev, WLC_SET_MACLIST, white_maclist, length);
  7369. + WL_SOFTAP(("White List, length %d:\n", length));
  7370. + for (i = 0; i < white_maclist->count; i++)
  7371. + WL_SOFTAP(("mac %d: %02X:%02X:%02X:%02X:%02X:%02X\n",
  7372. + i, white_maclist->ea[i].octet[0], white_maclist->ea[i].octet[1], \
  7373. + white_maclist->ea[i].octet[2], \
  7374. + white_maclist->ea[i].octet[3], white_maclist->ea[i].octet[4], \
  7375. + white_maclist->ea[i].octet[5]));
  7376. +
  7377. +
  7378. + bcopy(black_maclist, &ap_black_list, sizeof(ap_black_list));
  7379. +
  7380. + WL_SOFTAP(("Black List, size %d:\n", sizeof(ap_black_list)));
  7381. + for (i = 0; i < ap_black_list.count; i++)
  7382. + WL_SOFTAP(("mac %d: %02X:%02X:%02X:%02X:%02X:%02X\n",
  7383. + i, ap_black_list.ea[i].octet[0], ap_black_list.ea[i].octet[1], \
  7384. + ap_black_list.ea[i].octet[2], \
  7385. + ap_black_list.ea[i].octet[3], \
  7386. + ap_black_list.ea[i].octet[4], ap_black_list.ea[i].octet[5]));
  7387. +
  7388. +
  7389. + dev_wlc_ioctl(dev, WLC_GET_ASSOCLIST, assoc_maclist, 256);
  7390. + if (assoc_maclist->count) {
  7391. + int j;
  7392. + for (i = 0; i < assoc_maclist->count; i++) {
  7393. + for (j = 0; j < white_maclist->count; j++) {
  7394. + if (!bcmp(&assoc_maclist->ea[i], &white_maclist->ea[j], \
  7395. + ETHER_ADDR_LEN)) {
  7396. + WL_SOFTAP(("match allow, let it be\n"));
  7397. + break;
  7398. + }
  7399. + }
  7400. + if (j == white_maclist->count) {
  7401. + WL_SOFTAP(("match black, deauth it\n"));
  7402. + scbval.val = htod32(1);
  7403. + bcopy(&assoc_maclist->ea[i], &scbval.ea, \
  7404. + ETHER_ADDR_LEN);
  7405. + dev_wlc_ioctl(dev, \
  7406. + WLC_SCB_DEAUTHENTICATE_FOR_REASON, &scbval,
  7407. + sizeof(scb_val_t));
  7408. + }
  7409. + }
  7410. + }
  7411. + }
  7412. + return 0;
  7413. +}
  7414. +#endif
  7415. +
  7416. +
  7417. +#ifdef SOFTAP
  7418. +int set_macfilt_from_string(struct mflist *pmflist, char **param_str)
  7419. +{
  7420. + return 0;
  7421. +}
  7422. +#endif
  7423. +
  7424. +
  7425. +#ifdef SOFTAP
  7426. +#define PARAM_OFFSET PROFILE_OFFSET
  7427. +
  7428. +int wl_iw_process_private_ascii_cmd(
  7429. + struct net_device *dev,
  7430. + struct iw_request_info *info,
  7431. + union iwreq_data *dwrq,
  7432. + char *cmd_str)
  7433. +{
  7434. + int ret = 0;
  7435. + char *sub_cmd = cmd_str + PROFILE_OFFSET + strlen("ASCII_CMD=");
  7436. +
  7437. + WL_SOFTAP(("\n %s: ASCII_CMD: offs_0:%s, offset_32:\n'%s'\n",
  7438. + __FUNCTION__, cmd_str, cmd_str + PROFILE_OFFSET));
  7439. +
  7440. + if (strnicmp(sub_cmd, "AP_CFG", strlen("AP_CFG")) == 0) {
  7441. +
  7442. + WL_SOFTAP((" AP_CFG \n"));
  7443. +
  7444. + ap_mode = 0;
  7445. +
  7446. +
  7447. + if (init_ap_profile_from_string(cmd_str+PROFILE_OFFSET, &my_ap) != 0) {
  7448. + WL_ERROR(("ERROR: SoftAP CFG prams !\n"));
  7449. + ret = -1;
  7450. + } else {
  7451. + set_ap_cfg(dev, &my_ap);
  7452. + }
  7453. +
  7454. + } else if (strnicmp(sub_cmd, "AP_BSS_START", strlen("AP_BSS_START")) == 0) {
  7455. +
  7456. + WL_SOFTAP(("\n SOFTAP - ENABLE BSS \n"));
  7457. +
  7458. +
  7459. + WL_SOFTAP(("\n!!! got 'WL_AP_EN_BSS' from WPA supplicant, dev:%s\n", dev->name));
  7460. +
  7461. + if (ap_net_dev == NULL) {
  7462. + printf("\n ERROR: SOFTAP net_dev* is NULL !!!\n");
  7463. + } else {
  7464. +
  7465. + iwpriv_en_ap_bss(ap_net_dev, info, dwrq, cmd_str);
  7466. + }
  7467. +
  7468. + } else if (strnicmp(sub_cmd, "ASSOC_LST", strlen("ASSOC_LST")) == 0) {
  7469. +
  7470. +
  7471. +
  7472. + } else if (strnicmp(sub_cmd, "AP_BSS_STOP", strlen("AP_BSS_STOP")) == 0) {
  7473. +
  7474. + WL_SOFTAP((" \n temp DOWN SOFTAP\n"));
  7475. + ret = dev_iw_write_cfg1_bss_var(dev, 0);
  7476. + }
  7477. +
  7478. + return ret;
  7479. +
  7480. +}
  7481. +#endif
  7482. +static int wl_iw_set_priv(
  7483. + struct net_device *dev,
  7484. + struct iw_request_info *info,
  7485. + struct iw_point *dwrq,
  7486. + char *ext
  7487. +)
  7488. +{
  7489. + int ret = 0;
  7490. + char * extra;
  7491. +
  7492. + wl_iw_t *iw = *(wl_iw_t **)netdev_priv(dev);
  7493. + if (!(extra = kmalloc(dwrq->length, GFP_KERNEL)))
  7494. + return -ENOMEM;
  7495. +
  7496. + if (copy_from_user(extra, dwrq->pointer, dwrq->length)) {
  7497. + kfree(extra);
  7498. + return -EFAULT;
  7499. + }
  7500. +
  7501. + WL_TRACE(("%s: SIOCSIWPRIV request %s, info->cmd:%x, info->flags:%d\n dwrq->length:%d",
  7502. + dev->name, extra, info->cmd, info->flags, dwrq->length));
  7503. +
  7504. +
  7505. + if (dwrq->length && extra) {
  7506. + WAKE_LOCK_INIT(iw->pub, WAKE_LOCK_PRIV, "wl_iw_set_priv");
  7507. + WAKE_LOCK(iw->pub, WAKE_LOCK_PRIV);
  7508. +
  7509. + if (g_onoff == G_WLAN_SET_OFF) {
  7510. + if (strnicmp(extra, "START", strlen("START")) != 0) {
  7511. + WL_ERROR(("%s First IOCTL after stop is NOT START \n", \
  7512. + __FUNCTION__));
  7513. + WAKE_UNLOCK(iw->pub, WAKE_LOCK_PRIV);
  7514. + WAKE_LOCK_DESTROY(iw->pub, WAKE_LOCK_PRIV);
  7515. + kfree(extra);
  7516. + return -EFAULT;
  7517. + } else {
  7518. + wl_iw_control_wl_on(dev, info);
  7519. + WL_TRACE(("%s, Received regular START command\n", __FUNCTION__));
  7520. + }
  7521. + }
  7522. +
  7523. + if (strnicmp(extra, "SCAN-ACTIVE", strlen("SCAN-ACTIVE")) == 0) {
  7524. +#ifdef ENABLE_ACTIVE_PASSIVE_SCAN_SUPPRESS
  7525. + WL_TRACE(("%s: active scan setting suppressed\n", dev->name));
  7526. +#else
  7527. + ret = wl_iw_set_active_scan(dev, info, (union iwreq_data *)dwrq, extra);
  7528. +#endif
  7529. + }
  7530. + else if (strnicmp(extra, "SCAN-PASSIVE", strlen("SCAN-PASSIVE")) == 0)
  7531. #ifdef ENABLE_ACTIVE_PASSIVE_SCAN_SUPPRESS
  7532. - WL_TRACE(("%s: passive scan setting supppressed\n", dev->name));
  7533. + WL_TRACE(("%s: passive scan setting suppressed\n", dev->name));
  7534. #else
  7535. ret = wl_iw_set_passive_scan(dev, info, (union iwreq_data *)dwrq, extra);
  7536. #endif
  7537. @@ -3917,15 +5418,25 @@
  7538. ret = wl_iw_control_wl_off(dev, info);
  7539. else if (strnicmp(extra, "POWERMODE", strlen("POWERMODE")) == 0)
  7540. ret = wl_iw_set_btcoex_dhcp(dev, info, (union iwreq_data *)dwrq, extra);
  7541. +#ifdef SOFTAP
  7542. + else if (strnicmp(extra, "ASCII_CMD", strlen("ASCII_CMD")) == 0) {
  7543. +
  7544. + wl_iw_process_private_ascii_cmd(dev, info, (union iwreq_data *)dwrq, extra);
  7545. + }
  7546. + else if (strnicmp(extra, "AP_MAC_LIST_SET", strlen("AP_MAC_LIST_SET")) == 0) {
  7547. + WL_SOFTAP(("penguin, set AP_MAC_LIST_SET\n"));
  7548. + set_ap_mac_list(dev, (extra + PROFILE_OFFSET));
  7549. + }
  7550. +#endif
  7551. else {
  7552. snprintf(extra, MAX_WX_STRING, "OK");
  7553. dwrq->length = strlen("OK") + 1;
  7554. - WL_TRACE(("Unkown PRIVATE command , ignored\n"));
  7555. + WL_ERROR(("Unkown PRIVATE command , ignored\n"));
  7556. }
  7557. + WAKE_UNLOCK(iw->pub, WAKE_LOCK_PRIV);
  7558. + WAKE_LOCK_DESTROY(iw->pub, WAKE_LOCK_PRIV);
  7559. }
  7560.  
  7561. - net_os_wake_unlock(dev);
  7562. -
  7563. if (extra) {
  7564. if (copy_to_user(dwrq->pointer, extra, dwrq->length)) {
  7565. kfree(extra);
  7566. @@ -4036,11 +5547,41 @@
  7567. NULL,
  7568. (iw_handler)wl_iw_control_wl_off,
  7569. NULL,
  7570. - (iw_handler)wl_iw_control_wl_on
  7571. + (iw_handler)wl_iw_control_wl_on,
  7572. +#ifdef SOFTAP
  7573. +
  7574. +
  7575. + NULL,
  7576. + (iw_handler)iwpriv_set_ap_config,
  7577. +
  7578. +
  7579. +
  7580. + NULL,
  7581. + (iw_handler)iwpriv_get_assoc_list,
  7582. +
  7583. +
  7584. + NULL,
  7585. + (iw_handler)iwpriv_set_mac_filters,
  7586. +
  7587. +
  7588. + NULL,
  7589. + (iw_handler)iwpriv_en_ap_bss,
  7590. +
  7591. +
  7592. + NULL,
  7593. + (iw_handler)iwpriv_wpasupp_loop_tst,
  7594. +
  7595. + NULL,
  7596. + (iw_handler)iwpriv_softap_stop,
  7597. +
  7598. + NULL,
  7599. + (iw_handler)iwpriv_fw_reload
  7600. +#endif
  7601. };
  7602.  
  7603. -static const struct iw_priv_args wl_iw_priv_args[] = {
  7604. - {
  7605. +static const struct iw_priv_args wl_iw_priv_args[] =
  7606. +{
  7607. + {
  7608. WL_IW_SET_ACTIVE_SCAN,
  7609. 0,
  7610. IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_WX_STRING,
  7611. @@ -4081,8 +5622,60 @@
  7612. 0,
  7613. IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_WX_STRING,
  7614. "START"
  7615. - }
  7616. -};
  7617. + },
  7618. +
  7619. +#ifdef SOFTAP
  7620. +
  7621. +
  7622. + {
  7623. + WL_SET_AP_CFG,
  7624. + IW_PRIV_TYPE_CHAR | 256,
  7625. + 0,
  7626. + "AP_SET_CFG"
  7627. + },
  7628. +
  7629. + {
  7630. + WL_AP_STA_LIST,
  7631. + 0,
  7632. + IW_PRIV_TYPE_CHAR | 0,
  7633. + "AP_GET_STA_LIST"
  7634. + },
  7635. +
  7636. + {
  7637. + WL_AP_MAC_FLTR,
  7638. + IW_PRIV_TYPE_CHAR | 256,
  7639. + IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 0,
  7640. + "AP_SET_MAC_FLTR"
  7641. + },
  7642. +
  7643. + {
  7644. + WL_AP_BSS_START,
  7645. + 0,
  7646. + IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_WX_STRING,
  7647. + "AP_BSS_START"
  7648. + },
  7649. +
  7650. + {
  7651. + AP_LPB_CMD,
  7652. + IW_PRIV_TYPE_CHAR | 256,
  7653. + IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 0,
  7654. + "AP_LPB_CMD"
  7655. + },
  7656. +
  7657. + {
  7658. + WL_AP_STOP,
  7659. + IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 0,
  7660. + IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 0,
  7661. + "AP_BSS_STOP"
  7662. + },
  7663. + {
  7664. + WL_FW_RELOAD,
  7665. + IW_PRIV_TYPE_CHAR | 256,
  7666. + IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 0,
  7667. + "WL_FW_RELOAD"
  7668. + },
  7669. +#endif
  7670. + };
  7671.  
  7672. const struct iw_handler_def wl_iw_handler_def =
  7673. {
  7674. @@ -4099,8 +5692,9 @@
  7675. };
  7676. #endif
  7677.  
  7678. -int
  7679. -wl_iw_ioctl(
  7680. +
  7681. +
  7682. +int wl_iw_ioctl(
  7683. struct net_device *dev,
  7684. struct ifreq *rq,
  7685. int cmd
  7686. @@ -4112,10 +5706,13 @@
  7687. char *extra = NULL;
  7688. int token_size = 1, max_tokens = 0, ret = 0;
  7689.  
  7690. + WL_TRACE(("\n%s, cmd:%x alled via dhd->do_ioctl()entry point\n", __FUNCTION__, cmd));
  7691. if (cmd < SIOCIWFIRST ||
  7692. IW_IOCTL_IDX(cmd) >= ARRAYSIZE(wl_iw_handler) ||
  7693. - !(handler = wl_iw_handler[IW_IOCTL_IDX(cmd)]))
  7694. - return -EOPNOTSUPP;
  7695. + !(handler = wl_iw_handler[IW_IOCTL_IDX(cmd)])) {
  7696. + WL_ERROR(("%s: error in cmd=%x : not supported\n", __FUNCTION__, cmd));
  7697. + return -EOPNOTSUPP;
  7698. + }
  7699.  
  7700. switch (cmd) {
  7701.  
  7702. @@ -4132,11 +5729,12 @@
  7703. case SIOCSIWENCODEEXT:
  7704. case SIOCGIWENCODEEXT:
  7705. #endif
  7706. - max_tokens = IW_ENCODING_TOKEN_MAX;
  7707. + max_tokens = wrq->u.data.length;
  7708. break;
  7709.  
  7710. case SIOCGIWRANGE:
  7711. - max_tokens = sizeof(struct iw_range);
  7712. +
  7713. + max_tokens = sizeof(struct iw_range) + 500;
  7714. break;
  7715.  
  7716. case SIOCGIWAPLIST:
  7717. @@ -4165,15 +5763,21 @@
  7718. max_tokens = IW_MAX_SPY;
  7719. break;
  7720.  
  7721. +#if WIRELESS_EXT > 17
  7722. + case SIOCSIWPMKSA:
  7723. + case SIOCSIWGENIE:
  7724. +#endif
  7725. case SIOCSIWPRIV:
  7726. max_tokens = wrq->u.data.length;
  7727. break;
  7728. }
  7729.  
  7730. if (max_tokens && wrq->u.data.pointer) {
  7731. - if (wrq->u.data.length > max_tokens)
  7732. + if (wrq->u.data.length > max_tokens) {
  7733. + WL_ERROR(("%s: error in cmd=%x wrq->u.data.length=%d > max_tokens=%d\n", \
  7734. + __FUNCTION__, cmd, wrq->u.data.length, max_tokens));
  7735. return -E2BIG;
  7736. -
  7737. + }
  7738. if (!(extra = kmalloc(max_tokens * token_size, GFP_KERNEL)))
  7739. return -ENOMEM;
  7740.  
  7741. @@ -4312,12 +5916,56 @@
  7742. uint16 flags = ntoh16(e->flags);
  7743. uint32 datalen = ntoh32(e->datalen);
  7744. uint32 status = ntoh32(e->status);
  7745. - uint32 toto;
  7746. + wl_iw_t *iw;
  7747. + uint32 toto;
  7748.  
  7749. memset(&wrqu, 0, sizeof(wrqu));
  7750. memset(extra, 0, sizeof(extra));
  7751. + iw = 0;
  7752. +
  7753. + if (!dev) {
  7754. + WL_ERROR(("%s: dev is null\n", __FUNCTION__));
  7755. + return;
  7756. + }
  7757. +
  7758. + iw = *(wl_iw_t **)netdev_priv(dev);
  7759. +
  7760. + WL_TRACE(("%s: dev=%s event=%d \n", __FUNCTION__, dev->name, event_type));
  7761.  
  7762. +
  7763. switch (event_type) {
  7764. +#if defined(SOFTAP)
  7765. + case WLC_E_PRUNE:
  7766. + if (ap_mode) {
  7767. + char *macaddr = (char *)&e->addr;
  7768. + WL_SOFTAP(("PRUNE received, %02X:%02X:%02X:%02X:%02X:%02X!\n",
  7769. + macaddr[0], macaddr[1], macaddr[2], macaddr[3], \
  7770. + macaddr[4], macaddr[5]));
  7771. +
  7772. +
  7773. + if (ap_macmode)
  7774. + {
  7775. + int i;
  7776. + for (i = 0; i < ap_black_list.count; i++) {
  7777. + if (!bcmp(macaddr, &ap_black_list.ea[i], \
  7778. + sizeof(struct ether_addr))) {
  7779. + WL_SOFTAP(("mac in black list, ignore it\n"));
  7780. + break;
  7781. + }
  7782. + }
  7783. +
  7784. + if (i == ap_black_list.count) {
  7785. +
  7786. + char mac_buf[32] = {0};
  7787. + sprintf(mac_buf, "STA_BLOCK %02X:%02X:%02X:%02X:%02X:%02X",
  7788. + macaddr[0], macaddr[1], macaddr[2],
  7789. + macaddr[3], macaddr[4], macaddr[5]);
  7790. + wl_iw_send_priv_event(priv_dev, mac_buf);
  7791. + }
  7792. + }
  7793. + }
  7794. + break;
  7795. +#endif
  7796. case WLC_E_TXFAIL:
  7797. cmd = IWEVTXDROP;
  7798. memcpy(wrqu.addr.sa_data, &e->addr, ETHER_ADDR_LEN);
  7799. @@ -4327,12 +5975,26 @@
  7800. case WLC_E_JOIN:
  7801. case WLC_E_ASSOC_IND:
  7802. case WLC_E_REASSOC_IND:
  7803. +#if defined(SOFTAP)
  7804. + WL_SOFTAP(("STA connect received %d\n", event_type));
  7805. + if (ap_mode) {
  7806. + wl_iw_send_priv_event(priv_dev, "STA_JOIN");
  7807. + return;
  7808. + }
  7809. +#endif
  7810. memcpy(wrqu.addr.sa_data, &e->addr, ETHER_ADDR_LEN);
  7811. wrqu.addr.sa_family = ARPHRD_ETHER;
  7812. cmd = IWEVREGISTERED;
  7813. break;
  7814. case WLC_E_DEAUTH_IND:
  7815. case WLC_E_DISASSOC_IND:
  7816. +#if defined(SOFTAP)
  7817. + WL_SOFTAP(("STA disconnect received %d\n", event_type));
  7818. + if (ap_mode) {
  7819. + wl_iw_send_priv_event(priv_dev, "STA_LEAVE");
  7820. + return;
  7821. + }
  7822. +#endif
  7823. cmd = SIOCGIWAP;
  7824. bzero(wrqu.addr.sa_data, ETHER_ADDR_LEN);
  7825. wrqu.addr.sa_family = ARPHRD_ETHER;
  7826. @@ -4344,11 +6006,23 @@
  7827. if (!(flags & WLC_EVENT_MSG_LINK)) {
  7828.  
  7829.  
  7830. +#ifdef SOFTAP
  7831. + if (ap_mode && !strncmp(dev->name, "wl0.1", 5)) {
  7832. +
  7833. + WL_SOFTAP(("AP DOWN %d\n", event_type));
  7834. + wl_iw_send_priv_event(priv_dev, "AP_DOWN");
  7835. + } else {
  7836. + WL_TRACE(("STA_Link Down\n"));
  7837. g_ss_cache_ctrl.m_link_down = 1;
  7838. + }
  7839. +#else
  7840. + g_ss_cache_ctrl.m_link_down = 1;
  7841. +#endif
  7842. WL_TRACE(("Link Down\n"));
  7843.  
  7844. bzero(wrqu.addr.sa_data, ETHER_ADDR_LEN);
  7845. bzero(&extra, ETHER_ADDR_LEN);
  7846. + WAKE_LOCK_TIMEOUT(iw->pub, WAKE_LOCK_LINK_DOWN_TMOUT, 20 * HZ);
  7847. }
  7848. else {
  7849.  
  7850. @@ -4356,6 +6030,17 @@
  7851. g_ss_cache_ctrl.m_link_down = 0;
  7852.  
  7853. memcpy(g_ss_cache_ctrl.m_active_bssid, &e->addr, ETHER_ADDR_LEN);
  7854. +#ifdef SOFTAP
  7855. +
  7856. + if (ap_mode && !strncmp(dev->name, "wl0.1", 5)) {
  7857. +
  7858. + WL_SOFTAP(("AP UP %d\n", event_type));
  7859. + wl_iw_send_priv_event(priv_dev, "AP_UP");
  7860. + } else {
  7861. + WL_TRACE(("STA_LINK_UP\n"));
  7862. + }
  7863. +#else
  7864. +#endif
  7865. WL_TRACE(("Link UP\n"));
  7866.  
  7867. }
  7868. @@ -4367,7 +6052,7 @@
  7869. wrqu.data.length = datalen + 1;
  7870. extra[0] = WLC_E_ACTION_FRAME;
  7871. memcpy(&extra[1], data, datalen);
  7872. - printf("WLC_E_ACTION_FRAME len %d \n", wrqu.data.length);
  7873. + WL_TRACE(("WLC_E_ACTION_FRAME len %d \n", wrqu.data.length));
  7874. }
  7875. break;
  7876.  
  7877. @@ -4446,7 +6131,7 @@
  7878. wrqu.data.length = strlen(extra);
  7879. WL_TRACE(("Event WLC_E_SCAN_COMPLETE\n"));
  7880. #endif
  7881. - break;
  7882. + break;
  7883.  
  7884. default:
  7885.  
  7886. @@ -4454,8 +6139,8 @@
  7887. break;
  7888. }
  7889. #ifndef SANDGATE2G
  7890. - if (cmd)
  7891. - wireless_send_event(dev, cmd, &wrqu, extra);
  7892. + if (cmd)
  7893. + wireless_send_event(dev, cmd, &wrqu, extra);
  7894. #endif
  7895.  
  7896. #if WIRELESS_EXT > 14
  7897. @@ -4486,14 +6171,14 @@
  7898. goto done;
  7899.  
  7900. phy_noise = dtoh32(phy_noise);
  7901. - WL_TRACE(("wl_iw_get_wireless_stats phy noise=%d\n *****", phy_noise));
  7902. + WL_TRACE(("wl_iw_get_wireless_stats phy noise=%d\n", phy_noise));
  7903.  
  7904. scb_val.val = 0;
  7905. if ((res = dev_wlc_ioctl(dev, WLC_GET_RSSI, &scb_val, sizeof(scb_val_t))))
  7906. goto done;
  7907.  
  7908. rssi = dtoh32(scb_val.val);
  7909. - WL_TRACE(("wl_iw_get_wireless_stats rssi=%d ****** \n", rssi));
  7910. + WL_TRACE(("wl_iw_get_wireless_stats rssi=%d\n", rssi));
  7911. if (rssi <= WL_IW_RSSI_NO_SIGNAL)
  7912. wstats->qual.qual = 0;
  7913. else if (rssi <= WL_IW_RSSI_VERY_LOW)
  7914. @@ -4517,13 +6202,13 @@
  7915. #endif
  7916.  
  7917. #if WIRELESS_EXT > 11
  7918. - WL_TRACE(("wl_iw_get_wireless_stats counters=%d\n *****", (int)sizeof(wl_cnt_t)));
  7919. + WL_TRACE(("wl_iw_get_wireless_stats counters=%d\n", (int)sizeof(wl_cnt_t)));
  7920.  
  7921. memset(&cnt, 0, sizeof(wl_cnt_t));
  7922. res = dev_wlc_bufvar_get(dev, "counters", (char *)&cnt, sizeof(wl_cnt_t));
  7923. if (res)
  7924. {
  7925. - WL_ERROR(("wl_iw_get_wireless_stats counters failed error=%d ****** \n", res));
  7926. + WL_ERROR(("wl_iw_get_wireless_stats counters failed error=%d\n", res));
  7927. goto done;
  7928. }
  7929.  
  7930. @@ -4600,19 +6285,17 @@
  7931. DAEMONIZE("dhcp_sysioc");
  7932.  
  7933. while (down_interruptible(&g_bt->bt_sem) == 0) {
  7934. -
  7935. - net_os_wake_lock(g_bt->dev);
  7936. -
  7937. if (g_bt->timer_on) {
  7938. + del_timer(&g_bt->timer);
  7939. g_bt->timer_on = 0;
  7940. - del_timer_sync(&g_bt->timer);
  7941. }
  7942.  
  7943. switch (g_bt->bt_state) {
  7944. case BT_DHCP_START:
  7945.  
  7946. g_bt->bt_state = BT_DHCP_OPPORTUNITY_WINDOW;
  7947. - mod_timer(&g_bt->timer, jiffies + BT_DHCP_OPPORTUNITY_WINDOW_TIEM*HZ/1000);
  7948. + mod_timer(&g_bt->timer, jiffies + \
  7949. + BT_DHCP_OPPORTUNITY_WINDOW_TIEM*HZ/1000);
  7950. g_bt->timer_on = 1;
  7951. break;
  7952. case BT_DHCP_OPPORTUNITY_WINDOW:
  7953. @@ -4641,15 +6324,12 @@
  7954. g_bt->timer_on = 0;
  7955. break;
  7956. }
  7957. -
  7958. - net_os_wake_unlock(g_bt->dev);
  7959. }
  7960.  
  7961. if (g_bt->timer_on) {
  7962. + del_timer(&g_bt->timer);
  7963. g_bt->timer_on = 0;
  7964. - del_timer_sync(&g_bt->timer);
  7965. }
  7966. -
  7967. complete_and_exit(&g_bt->bt_exited, 0);
  7968. }
  7969.  
  7970. @@ -4720,6 +6400,7 @@
  7971. g_iscan = iscan;
  7972. iscan->dev = dev;
  7973. iscan->iscan_state = ISCAN_STATE_IDLE;
  7974. + g_first_broadcast_scan = BROADCAST_SCAN_FIRST_IDLE;
  7975. g_iscan->scan_flag = 0;
  7976.  
  7977.  
  7978. @@ -4734,7 +6415,6 @@
  7979. if (iscan->sysioc_pid < 0)
  7980. return -ENOMEM;
  7981. #endif
  7982. - mutex_init(&wl_start_lock);
  7983.  
  7984. iw = *(wl_iw_t **)netdev_priv(dev);
  7985. iw->pub = (dhd_pub_t *)dhdp;
  7986. @@ -4748,10 +6428,16 @@
  7987. memset(g_scan, 0, G_SCAN_RESULTS);
  7988. g_scan_specified_ssid = 0;
  7989.  
  7990. +
  7991. wl_iw_init_ss_cache_ctrl();
  7992.  
  7993. wl_iw_bt_init(dev);
  7994.  
  7995. +#ifdef SOFTAP
  7996. + priv_dev = dev;
  7997. +#endif
  7998. +
  7999. +
  8000. return 0;
  8001. }
  8002.  
  8003. @@ -4784,5 +6470,12 @@
  8004. wl_iw_release_ss_cache_ctrl();
  8005. wl_iw_bt_release();
  8006.  
  8007. +#ifdef SOFTAP
  8008. + if (ap_mode) {
  8009. + WL_TRACE(("\n%s AP is going down\n", __FUNCTION__));
  8010. +
  8011. + wl_iw_send_priv_event(priv_dev, "AP_DOWN");
  8012. + }
  8013. +#endif
  8014.  
  8015. }
  8016. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/wl_iw.h /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/wl_iw.h
  8017. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/wl_iw.h 2010-04-06 22:12:45.000000000 +0200
  8018. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/wl_iw.h 2010-04-07 00:34:09.000000000 +0200
  8019. @@ -1,7 +1,7 @@
  8020. /*
  8021. * Linux Wireless Extensions support
  8022. *
  8023. - * Copyright (C) 1999-2009, Broadcom Corporation
  8024. + * Copyright (C) 1999-2010, Broadcom Corporation
  8025. *
  8026. * Unless you and Broadcom execute a separate written software license
  8027. * agreement governing use of this software, this software is licensed to you
  8028. @@ -21,7 +21,7 @@
  8029. * software in any way with any other Broadcom software provided under a license
  8030. * other than the GPL, without Broadcom's express prior written consent.
  8031. *
  8032. - * $Id: wl_iw.h,v 1.5.34.1.6.9 2009/10/14 04:27:31 Exp $
  8033. + * $Id: wl_iw.h,v 1.5.34.1.6.15 2010/03/29 23:51:17 Exp $
  8034. */
  8035.  
  8036.  
  8037. @@ -34,6 +34,8 @@
  8038. #include <proto/ethernet.h>
  8039. #include <wlioctl.h>
  8040.  
  8041. +#define SOFTAP 1
  8042. +
  8043.  
  8044. #define WL_IW_RSSI_MINVAL -200
  8045. #define WL_IW_RSSI_NO_SIGNAL -91
  8046. @@ -53,11 +55,26 @@
  8047. #define WL_IW_SET_STOP (SIOCIWFIRSTPRIV+11)
  8048. #define WL_IW_SET_START (SIOCIWFIRSTPRIV+13)
  8049.  
  8050. +
  8051. +#define WL_SET_AP_CFG (SIOCIWFIRSTPRIV+15)
  8052. +#define WL_AP_STA_LIST (SIOCIWFIRSTPRIV+17)
  8053. +#define WL_AP_MAC_FLTR (SIOCIWFIRSTPRIV+19)
  8054. +#define WL_AP_BSS_START (SIOCIWFIRSTPRIV+21)
  8055. +#define AP_LPB_CMD (SIOCIWFIRSTPRIV+23)
  8056. +#define WL_AP_STOP (SIOCIWFIRSTPRIV+25)
  8057. +#define WL_FW_RELOAD (SIOCIWFIRSTPRIV+27)
  8058. +#define WL_AP_SPARE2 (SIOCIWFIRSTPRIV+29)
  8059. +#define WL_AP_SPARE3 (SIOCIWFIRSTPRIV+31)
  8060. #define G_SCAN_RESULTS 8*1024
  8061. #define WE_ADD_EVENT_FIX 0x80
  8062. #define G_WLAN_SET_ON 0
  8063. #define G_WLAN_SET_OFF 1
  8064.  
  8065. +#define CHECK_EXTRA_FOR_NULL(extra) \
  8066. +if (!extra) { \
  8067. + WL_ERROR(("%s: error : extra is null pointer\n", __FUNCTION__)); \
  8068. + return -EINVAL; \
  8069. +}
  8070.  
  8071. typedef struct wl_iw {
  8072. char nickname[IW_ESSID_MAX_SIZE];
  8073. @@ -67,6 +84,7 @@
  8074. int spy_num;
  8075. uint32 pwsec;
  8076. uint32 gwsec;
  8077. + bool privacy_invoked;
  8078.  
  8079. struct ether_addr spy_addr[IW_MAX_SPY];
  8080. struct iw_quality spy_qual[IW_MAX_SPY];
  8081. @@ -106,8 +124,41 @@
  8082. uint m_cons_br_scan_cnt;
  8083. struct timer_list *m_timer;
  8084. } wl_iw_ss_cache_ctrl_t;
  8085. +typedef enum broadcast_first_scan {
  8086. + BROADCAST_SCAN_FIRST_IDLE = 0,
  8087. + BROADCAST_SCAN_FIRST_STARTED,
  8088. + BROADCAST_SCAN_FIRST_RESULT_READY,
  8089. + BROADCAST_SCAN_FIRST_RESULT_CONSUMED
  8090. +} broadcast_first_scan_t;
  8091. +#ifdef SOFTAP
  8092. +#define SSID_LEN 33
  8093. +#define SEC_LEN 16
  8094. +#define KEY_LEN 65
  8095. +#define PROFILE_OFFSET 32
  8096. +struct ap_profile {
  8097. + uint8 ssid[SSID_LEN];
  8098. + uint8 sec[SEC_LEN];
  8099. + uint8 key[KEY_LEN];
  8100. + uint32 channel;
  8101. + uint32 preamble;
  8102. + uint32 max_scb;
  8103. +};
  8104.  
  8105.  
  8106. +#define MACLIST_MODE_DISABLED 0
  8107. +#define MACLIST_MODE_ENABLED 1
  8108. +#define MACLIST_MODE_ALLOW 2
  8109. +struct mflist {
  8110. + uint count;
  8111. + struct ether_addr ea[16];
  8112. +};
  8113. +struct mac_list_set {
  8114. + uint32 mode;
  8115. + struct mflist white_list;
  8116. + struct mflist black_list;
  8117. +};
  8118. +#endif
  8119. +
  8120. #if WIRELESS_EXT > 12
  8121. #include <net/iw_handler.h>
  8122. extern const struct iw_handler_def wl_iw_handler_def;
  8123. @@ -118,12 +169,6 @@
  8124. extern int wl_iw_get_wireless_stats(struct net_device *dev, struct iw_statistics *wstats);
  8125. int wl_iw_attach(struct net_device *dev, void * dhdp);
  8126. void wl_iw_detach(void);
  8127. -int wl_control_wl_start(struct net_device *dev);
  8128. -
  8129. -extern int net_os_wake_lock(struct net_device *dev);
  8130. -extern int net_os_wake_unlock(struct net_device *dev);
  8131. -extern int net_os_wake_lock_timeout(struct net_device *dev);
  8132. -extern int net_os_wake_lock_timeout_enable(struct net_device *dev);
  8133.  
  8134. #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
  8135. #define IWE_STREAM_ADD_EVENT(info, stream, ends, iwe, extra) \
  8136. Binärdateien /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/wl_iw.o and /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/wl_iw.o sind verschieden.
  8137. diff -ur /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/.wl_iw.o.cmd /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/.wl_iw.o.cmd
  8138. --- /media/Development/android/linux-msm/drivers/net/wireless/bcm4329_old/.wl_iw.o.cmd 2010-04-07 00:19:22.000000000 +0200
  8139. +++ /media/Development/android/linux-msm/drivers/net/wireless/bcm4329/.wl_iw.o.cmd 2010-04-07 00:49:49.000000000 +0200
  8140. @@ -515,12 +515,15 @@
  8141. include/linux/if_arp.h \
  8142. drivers/net/wireless/bcm4329/dngl_stats.h \
  8143. drivers/net/wireless/bcm4329/dhd.h \
  8144. + $(wildcard include/config/has/wakelock.h) \
  8145. include/linux/etherdevice.h \
  8146. include/linux/ethtool.h \
  8147. /media/Development/android/linux-msm/arch/arm/include/asm/unaligned.h \
  8148. include/linux/unaligned/le_byteshift.h \
  8149. include/linux/unaligned/be_byteshift.h \
  8150. include/linux/unaligned/generic.h \
  8151. + include/linux/wakelock.h \
  8152. + $(wildcard include/config/wakelock/stat.h) \
  8153. drivers/net/wireless/bcm4329/include/wlioctl.h \
  8154. $(wildcard include/config/item.h) \
  8155. drivers/net/wireless/bcm4329/include/proto/bcmeth.h \
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement