| .. | .. |
|---|
| 1 | | -/* SPDX-License-Identifier: GPL-2.0 */ |
|---|
| 2 | 1 | /* |
|---|
| 3 | 2 | * DHD Protocol Module for CDC and BDC. |
|---|
| 4 | 3 | * |
|---|
| 5 | | - * Copyright (C) 1999-2019, Broadcom Corporation |
|---|
| 6 | | - * |
|---|
| 4 | + * Portions of this code are copyright (c) 2022 Cypress Semiconductor Corporation |
|---|
| 5 | + * |
|---|
| 6 | + * Copyright (C) 1999-2017, Broadcom Corporation |
|---|
| 7 | + * |
|---|
| 7 | 8 | * Unless you and Broadcom execute a separate written software license |
|---|
| 8 | 9 | * agreement governing use of this software, this software is licensed to you |
|---|
| 9 | 10 | * under the terms of the GNU General Public License version 2 (the "GPL"), |
|---|
| 10 | 11 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the |
|---|
| 11 | 12 | * following added to such license: |
|---|
| 12 | | - * |
|---|
| 13 | + * |
|---|
| 13 | 14 | * As a special exception, the copyright holders of this software give you |
|---|
| 14 | 15 | * permission to link this software with independent modules, and to copy and |
|---|
| 15 | 16 | * distribute the resulting executable under terms of your choice, provided that |
|---|
| .. | .. |
|---|
| 17 | 18 | * the license of that module. An independent module is a module which is not |
|---|
| 18 | 19 | * derived from this software. The special exception does not apply to any |
|---|
| 19 | 20 | * modifications of the software. |
|---|
| 20 | | - * |
|---|
| 21 | + * |
|---|
| 21 | 22 | * Notwithstanding the above, under no circumstances may you combine this |
|---|
| 22 | 23 | * software in any way with any other Broadcom software provided under a license |
|---|
| 23 | 24 | * other than the GPL, without Broadcom's express prior written consent. |
|---|
| .. | .. |
|---|
| 25 | 26 | * |
|---|
| 26 | 27 | * <<Broadcom-WL-IPTag/Open:>> |
|---|
| 27 | 28 | * |
|---|
| 28 | | - * $Id: dhd_cdc.c 708487 2018-10-31 05:33:14Z $ |
|---|
| 29 | + * $Id: dhd_cdc.c 692135 2017-03-26 17:19:39Z $ |
|---|
| 29 | 30 | * |
|---|
| 30 | 31 | * BDC is like CDC, except it includes a header for data packets to convey |
|---|
| 31 | 32 | * packet priority over the bus, and flags (e.g. to indicate checksum status |
|---|
| .. | .. |
|---|
| 42 | 43 | #include <dngl_stats.h> |
|---|
| 43 | 44 | #include <dhd.h> |
|---|
| 44 | 45 | #include <dhd_proto.h> |
|---|
| 45 | | -#ifdef BCMDBUS |
|---|
| 46 | | -#include <dbus.h> |
|---|
| 47 | | -#else |
|---|
| 48 | 46 | #include <dhd_bus.h> |
|---|
| 49 | | -#endif /* BCMDBUS */ |
|---|
| 50 | 47 | #include <dhd_dbg.h> |
|---|
| 51 | | - |
|---|
| 52 | 48 | |
|---|
| 53 | 49 | #ifdef PROP_TXSTATUS |
|---|
| 54 | 50 | #include <wlfc_proto.h> |
|---|
| 55 | 51 | #include <dhd_wlfc.h> |
|---|
| 56 | | -#endif |
|---|
| 57 | | - |
|---|
| 58 | | -#ifdef LOAD_DHD_WITH_FW_ALIVE |
|---|
| 59 | | -#include <dhd_chip_info.h> |
|---|
| 60 | | -#endif |
|---|
| 52 | +#endif // endif |
|---|
| 61 | 53 | |
|---|
| 62 | 54 | #ifdef DHD_ULP |
|---|
| 63 | 55 | #include <dhd_ulp.h> |
|---|
| 64 | 56 | #endif /* DHD_ULP */ |
|---|
| 65 | | - |
|---|
| 66 | 57 | |
|---|
| 67 | 58 | #define RETRIES 2 /* # of retries to retrieve matching ioctl response */ |
|---|
| 68 | 59 | #define BUS_HEADER_LEN (24+DHD_SDALIGN) /* Must be at least SDPCM_RESERVE |
|---|
| .. | .. |
|---|
| 77 | 68 | uint16 reqid; |
|---|
| 78 | 69 | uint8 pending; |
|---|
| 79 | 70 | uint32 lastcmd; |
|---|
| 80 | | -#ifdef BCMDBUS |
|---|
| 81 | | - uint ctl_completed; |
|---|
| 82 | | -#endif |
|---|
| 83 | 71 | uint8 bus_header[BUS_HEADER_LEN]; |
|---|
| 84 | 72 | cdc_ioctl_t msg; |
|---|
| 85 | 73 | unsigned char buf[WLC_IOCTL_MAXLEN + ROUND_UP_MARGIN]; |
|---|
| 86 | 74 | } dhd_prot_t; |
|---|
| 87 | 75 | |
|---|
| 88 | | -#if defined(BCMDBUS) |
|---|
| 89 | | -extern int dhd_dbus_txdata(dhd_pub_t *dhdp, void *pktbuf); |
|---|
| 90 | | -#endif |
|---|
| 76 | +uint16 |
|---|
| 77 | +dhd_prot_get_ioctl_trans_id(dhd_pub_t *dhdp) |
|---|
| 78 | +{ |
|---|
| 79 | + /* SDIO does not have ioctl_trans_id yet, so return -1 */ |
|---|
| 80 | + return -1; |
|---|
| 81 | +} |
|---|
| 91 | 82 | |
|---|
| 92 | 83 | static int |
|---|
| 93 | 84 | dhdcdc_msg(dhd_pub_t *dhd) |
|---|
| 94 | 85 | { |
|---|
| 95 | | -#ifdef BCMDBUS |
|---|
| 96 | | - int timeout = 0; |
|---|
| 97 | | -#endif /* BCMDBUS */ |
|---|
| 98 | 86 | int err = 0; |
|---|
| 99 | 87 | dhd_prot_t *prot = dhd->prot; |
|---|
| 100 | 88 | int len = ltoh32(prot->msg.len) + sizeof(cdc_ioctl_t); |
|---|
| .. | .. |
|---|
| 111 | 99 | len = CDC_MAX_MSG_SIZE; |
|---|
| 112 | 100 | |
|---|
| 113 | 101 | /* Send request */ |
|---|
| 114 | | -#ifdef BCMDBUS |
|---|
| 115 | | - DHD_OS_IOCTL_RESP_LOCK(dhd); |
|---|
| 116 | | - prot->ctl_completed = FALSE; |
|---|
| 117 | | - err = dbus_send_ctl(dhd->dbus, (void *)&prot->msg, len); |
|---|
| 118 | | - if (err) { |
|---|
| 119 | | - DHD_ERROR(("dbus_send_ctl error=0x%x\n", err)); |
|---|
| 120 | | - DHD_OS_IOCTL_RESP_UNLOCK(dhd); |
|---|
| 121 | | - DHD_OS_WAKE_UNLOCK(dhd); |
|---|
| 122 | | - return err; |
|---|
| 123 | | - } |
|---|
| 124 | | -#else |
|---|
| 125 | 102 | err = dhd_bus_txctl(dhd->bus, (uchar*)&prot->msg, len); |
|---|
| 126 | | -#endif |
|---|
| 127 | 103 | |
|---|
| 128 | | -#ifdef BCMDBUS |
|---|
| 129 | | - timeout = dhd_os_ioctl_resp_wait(dhd, &prot->ctl_completed); |
|---|
| 130 | | - if ((!timeout) || (!prot->ctl_completed)) { |
|---|
| 131 | | - DHD_ERROR(("Txctl timeout %d ctl_completed %d\n", |
|---|
| 132 | | - timeout, prot->ctl_completed)); |
|---|
| 133 | | - DHD_ERROR(("Txctl wait timed out\n")); |
|---|
| 134 | | - err = -1; |
|---|
| 135 | | - } |
|---|
| 136 | | - DHD_OS_IOCTL_RESP_UNLOCK(dhd); |
|---|
| 137 | | -#endif |
|---|
| 138 | | -#if defined(BCMDBUS) && defined(INTR_EP_ENABLE) |
|---|
| 139 | | - /* If the ctl write is successfully completed, wait for an acknowledgement |
|---|
| 140 | | - * that indicates that it is now ok to do ctl read from the dongle |
|---|
| 141 | | - */ |
|---|
| 142 | | - if (err != -1) { |
|---|
| 143 | | - DHD_OS_IOCTL_RESP_LOCK(dhd); |
|---|
| 144 | | - prot->ctl_completed = FALSE; |
|---|
| 145 | | - if (dbus_poll_intr(dhd->dbus)) { |
|---|
| 146 | | - DHD_ERROR(("dbus_poll_intr not submitted\n")); |
|---|
| 147 | | - } else { |
|---|
| 148 | | - /* interrupt polling is sucessfully submitted. Wait for dongle to send |
|---|
| 149 | | - * interrupt |
|---|
| 150 | | - */ |
|---|
| 151 | | - timeout = dhd_os_ioctl_resp_wait(dhd, &prot->ctl_completed); |
|---|
| 152 | | - if (!timeout) { |
|---|
| 153 | | - DHD_ERROR(("intr poll wait timed out\n")); |
|---|
| 154 | | - } |
|---|
| 155 | | - } |
|---|
| 156 | | - DHD_OS_IOCTL_RESP_UNLOCK(dhd); |
|---|
| 157 | | - } |
|---|
| 158 | | -#endif /* defined(BCMDBUS) && defined(INTR_EP_ENABLE) */ |
|---|
| 159 | 104 | DHD_OS_WAKE_UNLOCK(dhd); |
|---|
| 160 | 105 | return err; |
|---|
| 161 | 106 | } |
|---|
| .. | .. |
|---|
| 163 | 108 | static int |
|---|
| 164 | 109 | dhdcdc_cmplt(dhd_pub_t *dhd, uint32 id, uint32 len) |
|---|
| 165 | 110 | { |
|---|
| 166 | | -#ifdef BCMDBUS |
|---|
| 167 | | - int timeout = 0; |
|---|
| 168 | | -#endif /* BCMDBUS */ |
|---|
| 169 | 111 | int ret; |
|---|
| 170 | 112 | int cdc_len = len + sizeof(cdc_ioctl_t); |
|---|
| 171 | 113 | dhd_prot_t *prot = dhd->prot; |
|---|
| 172 | 114 | |
|---|
| 173 | 115 | DHD_TRACE(("%s: Enter\n", __FUNCTION__)); |
|---|
| 174 | 116 | |
|---|
| 175 | | - |
|---|
| 176 | 117 | do { |
|---|
| 177 | | -#ifdef BCMDBUS |
|---|
| 178 | | - DHD_OS_IOCTL_RESP_LOCK(dhd); |
|---|
| 179 | | - prot->ctl_completed = FALSE; |
|---|
| 180 | | - ret = dbus_recv_ctl(dhd->dbus, (uchar*)&prot->msg, cdc_len); |
|---|
| 181 | | - if (ret) { |
|---|
| 182 | | - DHD_ERROR(("dbus_recv_ctl error=0x%x(%d)\n", ret, ret)); |
|---|
| 183 | | - DHD_OS_IOCTL_RESP_UNLOCK(dhd); |
|---|
| 184 | | - goto done; |
|---|
| 185 | | - } |
|---|
| 186 | | - timeout = dhd_os_ioctl_resp_wait(dhd, &prot->ctl_completed); |
|---|
| 187 | | - if ((!timeout) || (!prot->ctl_completed)) { |
|---|
| 188 | | - DHD_ERROR(("Rxctl timeout %d ctl_completed %d\n", |
|---|
| 189 | | - timeout, prot->ctl_completed)); |
|---|
| 190 | | - ret = -1; |
|---|
| 191 | | - DHD_OS_IOCTL_RESP_UNLOCK(dhd); |
|---|
| 192 | | - |
|---|
| 193 | | - goto done; |
|---|
| 194 | | - } |
|---|
| 195 | | - DHD_OS_IOCTL_RESP_UNLOCK(dhd); |
|---|
| 196 | | - |
|---|
| 197 | | - ret = cdc_len; |
|---|
| 198 | | -#else |
|---|
| 199 | 118 | ret = dhd_bus_rxctl(dhd->bus, (uchar*)&prot->msg, cdc_len); |
|---|
| 200 | | -#endif /* BCMDBUS */ |
|---|
| 201 | 119 | if (ret < 0) |
|---|
| 202 | 120 | break; |
|---|
| 203 | 121 | } while (CDC_IOC_ID(ltoh32(prot->msg.flags)) != id); |
|---|
| 204 | 122 | |
|---|
| 205 | | - |
|---|
| 206 | | -#ifdef BCMDBUS |
|---|
| 207 | | -done: |
|---|
| 208 | | -#endif /* BCMDBUS */ |
|---|
| 209 | 123 | return ret; |
|---|
| 210 | 124 | } |
|---|
| 211 | 125 | |
|---|
| .. | .. |
|---|
| 219 | 133 | |
|---|
| 220 | 134 | DHD_TRACE(("%s: Enter\n", __FUNCTION__)); |
|---|
| 221 | 135 | DHD_CTL(("%s: cmd %d len %d\n", __FUNCTION__, cmd, len)); |
|---|
| 222 | | - |
|---|
| 223 | 136 | |
|---|
| 224 | 137 | /* Respond "bcmerror" and "bcmerrorstr" with local cache */ |
|---|
| 225 | 138 | if (cmd == WLC_GET_VAR && buf) |
|---|
| .. | .. |
|---|
| 238 | 151 | |
|---|
| 239 | 152 | memset(msg, 0, sizeof(cdc_ioctl_t)); |
|---|
| 240 | 153 | |
|---|
| 154 | +#ifdef BCMSPI |
|---|
| 155 | + /* 11bit gSPI bus allows 2048bytes of max-data. We restrict 'len' |
|---|
| 156 | + * value which is 8Kbytes for various 'get' commands to 2000. 48 bytes are |
|---|
| 157 | + * left for sw headers and misc. |
|---|
| 158 | + */ |
|---|
| 159 | + |
|---|
| 160 | + if (len > 2000) { |
|---|
| 161 | + DHD_ERROR(("dhdcdc_query_ioctl: len is truncated to 2000 bytes\n")); |
|---|
| 162 | + len = 2000; |
|---|
| 163 | + } |
|---|
| 164 | +#ifdef BCMQT |
|---|
| 165 | + /* WAR: packet length limited for SPI host issue in FIFO mode on Zebu */ |
|---|
| 166 | + if (len > 460) { |
|---|
| 167 | + DHD_ERROR(("len is truncated to 460 bytes on Zebu\n")); |
|---|
| 168 | + len = 460; |
|---|
| 169 | + } |
|---|
| 170 | +#endif /* BCMQT */ |
|---|
| 171 | +#endif /* BCMSPI */ |
|---|
| 241 | 172 | msg->cmd = htol32(cmd); |
|---|
| 242 | 173 | msg->len = htol32(len); |
|---|
| 243 | 174 | msg->flags = (++prot->reqid << CDCF_IOC_ID_SHIFT); |
|---|
| .. | .. |
|---|
| 293 | 224 | return ret; |
|---|
| 294 | 225 | } |
|---|
| 295 | 226 | |
|---|
| 227 | +#ifdef DHD_PM_CONTROL_FROM_FILE |
|---|
| 228 | +extern bool g_pm_control; |
|---|
| 229 | +#endif /* DHD_PM_CONTROL_FROM_FILE */ |
|---|
| 296 | 230 | |
|---|
| 297 | 231 | static int |
|---|
| 298 | 232 | dhdcdc_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len, uint8 action) |
|---|
| .. | .. |
|---|
| 317 | 251 | return -EIO; |
|---|
| 318 | 252 | } |
|---|
| 319 | 253 | |
|---|
| 254 | + if (cmd == WLC_SET_PM) { |
|---|
| 255 | +#ifdef DHD_PM_CONTROL_FROM_FILE |
|---|
| 256 | + if (g_pm_control == TRUE) { |
|---|
| 257 | + DHD_ERROR(("%s: SET PM ignored!(Requested:%d)\n", |
|---|
| 258 | + __FUNCTION__, buf ? *(char *)buf : 0)); |
|---|
| 259 | + goto done; |
|---|
| 260 | + } |
|---|
| 261 | +#endif /* DHD_PM_CONTROL_FROM_FILE */ |
|---|
| 262 | +#if defined(WLAIBSS) |
|---|
| 263 | + if (dhd->op_mode == DHD_FLAG_IBSS_MODE) { |
|---|
| 264 | + DHD_ERROR(("%s: SET PM ignored for IBSS!(Requested:%d)\n", |
|---|
| 265 | + __FUNCTION__, buf ? *(char *)buf : 0)); |
|---|
| 266 | + goto done; |
|---|
| 267 | + } |
|---|
| 268 | +#endif /* WLAIBSS */ |
|---|
| 269 | + DHD_TRACE_HW4(("%s: SET PM to %d\n", __FUNCTION__, buf ? *(char *)buf : 0)); |
|---|
| 270 | + } |
|---|
| 271 | + |
|---|
| 320 | 272 | memset(msg, 0, sizeof(cdc_ioctl_t)); |
|---|
| 321 | 273 | |
|---|
| 322 | 274 | msg->cmd = htol32(cmd); |
|---|
| .. | .. |
|---|
| 332 | 284 | memcpy(prot->buf, buf, len); |
|---|
| 333 | 285 | |
|---|
| 334 | 286 | #ifdef DHD_ULP |
|---|
| 335 | | - if (buf && (!strncmp(buf, "wowl_force", sizeof("wowl_force")) || |
|---|
| 336 | | - !strncmp(buf, "ulp", sizeof("ulp")))) { |
|---|
| 287 | + if (buf && (!strncmp(buf, "ulp", sizeof("ulp")))) { |
|---|
| 337 | 288 | /* force all the writes after this point to NOT to use cached sbwad value */ |
|---|
| 338 | 289 | dhd_ulp_disable_cached_sbwad(dhd); |
|---|
| 339 | 290 | } |
|---|
| .. | .. |
|---|
| 375 | 326 | return ret; |
|---|
| 376 | 327 | } |
|---|
| 377 | 328 | |
|---|
| 378 | | -#ifdef BCMDBUS |
|---|
| 379 | | -int |
|---|
| 380 | | -dhd_prot_ctl_complete(dhd_pub_t *dhd) |
|---|
| 381 | | -{ |
|---|
| 382 | | - dhd_prot_t *prot; |
|---|
| 383 | | - |
|---|
| 384 | | - if (dhd == NULL) |
|---|
| 385 | | - return BCME_ERROR; |
|---|
| 386 | | - |
|---|
| 387 | | - prot = dhd->prot; |
|---|
| 388 | | - |
|---|
| 389 | | - ASSERT(prot); |
|---|
| 390 | | - DHD_OS_IOCTL_RESP_LOCK(dhd); |
|---|
| 391 | | - prot->ctl_completed = TRUE; |
|---|
| 392 | | - dhd_os_ioctl_resp_wake(dhd); |
|---|
| 393 | | - DHD_OS_IOCTL_RESP_UNLOCK(dhd); |
|---|
| 394 | | - return 0; |
|---|
| 395 | | -} |
|---|
| 396 | | -#endif /* BCMDBUS */ |
|---|
| 397 | | - |
|---|
| 398 | 329 | int |
|---|
| 399 | 330 | dhd_prot_ioctl(dhd_pub_t *dhd, int ifidx, wl_ioctl_t * ioc, void * buf, int len) |
|---|
| 400 | 331 | { |
|---|
| .. | .. |
|---|
| 403 | 334 | uint8 action; |
|---|
| 404 | 335 | |
|---|
| 405 | 336 | if ((dhd->busstate == DHD_BUS_DOWN) || dhd->hang_was_sent) { |
|---|
| 406 | | - DHD_ERROR(("%s : bus is down. we have nothing to do\n", __FUNCTION__)); |
|---|
| 337 | + DHD_ERROR(("%s : bus is down. we have nothing to do - bs: %d, has: %d\n", |
|---|
| 338 | + __FUNCTION__, dhd->busstate, dhd->hang_was_sent)); |
|---|
| 407 | 339 | goto done; |
|---|
| 408 | 340 | } |
|---|
| 409 | 341 | |
|---|
| .. | .. |
|---|
| 419 | 351 | ioc->cmd, (unsigned long)ioc->cmd, prot->lastcmd, |
|---|
| 420 | 352 | (unsigned long)prot->lastcmd)); |
|---|
| 421 | 353 | if ((ioc->cmd == WLC_SET_VAR) || (ioc->cmd == WLC_GET_VAR)) { |
|---|
| 422 | | - DHD_TRACE(("iovar cmd=%s\n", (char*)buf)); |
|---|
| 354 | + DHD_TRACE(("iovar cmd=%s\n", buf ? (char*)buf : "\0")); |
|---|
| 423 | 355 | } |
|---|
| 424 | 356 | goto done; |
|---|
| 425 | 357 | } |
|---|
| .. | .. |
|---|
| 477 | 409 | bcm_bprintf(strbuf, "Protocol CDC: reqid %d\n", dhdp->prot->reqid); |
|---|
| 478 | 410 | #ifdef PROP_TXSTATUS |
|---|
| 479 | 411 | dhd_wlfc_dump(dhdp, strbuf); |
|---|
| 480 | | -#endif |
|---|
| 412 | +#endif // endif |
|---|
| 481 | 413 | } |
|---|
| 482 | 414 | |
|---|
| 483 | 415 | /* The FreeBSD PKTPUSH could change the packet buf pinter |
|---|
| .. | .. |
|---|
| 504 | 436 | if (PKTSUMNEEDED(PKTBUF)) |
|---|
| 505 | 437 | h->flags |= BDC_FLAG_SUM_NEEDED; |
|---|
| 506 | 438 | |
|---|
| 507 | | - |
|---|
| 508 | 439 | h->priority = (PKTPRIO(PKTBUF) & BDC_PRIORITY_MASK); |
|---|
| 509 | 440 | h->flags2 = 0; |
|---|
| 510 | 441 | h->dataOffset = 0; |
|---|
| .. | .. |
|---|
| 520 | 451 | #ifdef BDC |
|---|
| 521 | 452 | /* Length of BDC(+WLFC) headers pushed */ |
|---|
| 522 | 453 | hdrlen = BDC_HEADER_LEN + (((struct bdc_header *)PKTBUF)->dataOffset * 4); |
|---|
| 523 | | -#endif |
|---|
| 454 | +#endif // endif |
|---|
| 524 | 455 | return hdrlen; |
|---|
| 525 | 456 | } |
|---|
| 526 | 457 | |
|---|
| .. | .. |
|---|
| 530 | 461 | { |
|---|
| 531 | 462 | #ifdef BDC |
|---|
| 532 | 463 | struct bdc_header *h; |
|---|
| 533 | | -#endif |
|---|
| 464 | +#endif // endif |
|---|
| 534 | 465 | uint8 data_offset = 0; |
|---|
| 535 | 466 | |
|---|
| 536 | 467 | DHD_TRACE(("%s: Enter\n", __FUNCTION__)); |
|---|
| .. | .. |
|---|
| 577 | 508 | PKTPULL(dhd->osh, pktbuf, BDC_HEADER_LEN); |
|---|
| 578 | 509 | #endif /* BDC */ |
|---|
| 579 | 510 | |
|---|
| 580 | | - |
|---|
| 581 | 511 | #ifdef PROP_TXSTATUS |
|---|
| 582 | 512 | if (!DHD_PKTTAG_PKTDIR(PKTTAG(pktbuf))) { |
|---|
| 583 | 513 | /* |
|---|
| .. | .. |
|---|
| 586 | 516 | dhd_wlfc_parse_header_info(dhd, pktbuf, (data_offset << 2), |
|---|
| 587 | 517 | reorder_buf_info, reorder_info_len); |
|---|
| 588 | 518 | |
|---|
| 589 | | -#ifdef BCMDBUS |
|---|
| 590 | | -#ifndef DHD_WLFC_THREAD |
|---|
| 591 | | - dhd_wlfc_commit_packets(dhd, |
|---|
| 592 | | - (f_commitpkt_t)dhd_dbus_txdata, (void *)dhd, NULL, FALSE); |
|---|
| 593 | | -#endif /* DHD_WLFC_THREAD */ |
|---|
| 594 | | -#endif /* BCMDBUS */ |
|---|
| 595 | 519 | } |
|---|
| 596 | 520 | #endif /* PROP_TXSTATUS */ |
|---|
| 597 | 521 | |
|---|
| .. | .. |
|---|
| 599 | 523 | PKTPULL(dhd->osh, pktbuf, (data_offset << 2)); |
|---|
| 600 | 524 | return 0; |
|---|
| 601 | 525 | } |
|---|
| 602 | | - |
|---|
| 603 | 526 | |
|---|
| 604 | 527 | int |
|---|
| 605 | 528 | dhd_prot_attach(dhd_pub_t *dhd) |
|---|
| .. | .. |
|---|
| 621 | 544 | dhd->prot = cdc; |
|---|
| 622 | 545 | #ifdef BDC |
|---|
| 623 | 546 | dhd->hdrlen += BDC_HEADER_LEN; |
|---|
| 624 | | -#endif |
|---|
| 547 | +#endif // endif |
|---|
| 625 | 548 | dhd->maxctl = WLC_IOCTL_MAXLEN + sizeof(cdc_ioctl_t) + ROUND_UP_MARGIN; |
|---|
| 626 | 549 | return 0; |
|---|
| 627 | 550 | |
|---|
| .. | .. |
|---|
| 637 | 560 | { |
|---|
| 638 | 561 | #ifdef PROP_TXSTATUS |
|---|
| 639 | 562 | dhd_wlfc_deinit(dhd); |
|---|
| 640 | | -#endif |
|---|
| 563 | +#endif // endif |
|---|
| 641 | 564 | DHD_OS_PREFREE(dhd, dhd->prot, sizeof(dhd_prot_t)); |
|---|
| 642 | 565 | dhd->prot = NULL; |
|---|
| 643 | 566 | } |
|---|
| .. | .. |
|---|
| 661 | 584 | { |
|---|
| 662 | 585 | int ret = 0; |
|---|
| 663 | 586 | wlc_rev_info_t revinfo; |
|---|
| 587 | +#ifndef OEM_ANDROID |
|---|
| 588 | + char buf[128]; |
|---|
| 589 | +#endif /* OEM_ANDROID */ |
|---|
| 664 | 590 | DHD_TRACE(("%s: Enter\n", __FUNCTION__)); |
|---|
| 665 | 591 | |
|---|
| 666 | | -#ifdef LOAD_DHD_WITH_FW_ALIVE |
|---|
| 667 | | - if(alive == FW_ALIVE_MAGIC) { |
|---|
| 668 | | - ret = dhd_preinit_ioctls_alive(dhd); |
|---|
| 669 | | - } else |
|---|
| 670 | | -#endif /* LOAD_DHD_WITH_FW_ALIVE */ |
|---|
| 671 | | - { |
|---|
| 672 | | - /* Get the device rev info */ |
|---|
| 673 | | - memset(&revinfo, 0, sizeof(revinfo)); |
|---|
| 674 | | - ret = dhd_wl_ioctl_cmd(dhd, WLC_GET_REVINFO, &revinfo, sizeof(revinfo), FALSE, 0); |
|---|
| 675 | | - if (ret < 0) |
|---|
| 676 | | - goto done; |
|---|
| 592 | +#ifndef OEM_ANDROID |
|---|
| 593 | + /* Get the device MAC address */ |
|---|
| 594 | + strcpy(buf, "cur_etheraddr"); |
|---|
| 595 | + ret = dhd_wl_ioctl_cmd(dhd, WLC_GET_VAR, buf, sizeof(buf), FALSE, 0); |
|---|
| 596 | + if (ret < 0) |
|---|
| 597 | + goto done; |
|---|
| 598 | + memcpy(dhd->mac.octet, buf, ETHER_ADDR_LEN); |
|---|
| 599 | +#endif /* OEM_ANDROID */ |
|---|
| 600 | +#ifdef DHD_FW_COREDUMP |
|---|
| 601 | + /* Check the memdump capability */ |
|---|
| 602 | + dhd_get_memdump_info(dhd); |
|---|
| 603 | +#endif /* DHD_FW_COREDUMP */ |
|---|
| 677 | 604 | |
|---|
| 678 | | -#if defined(BCMDBUS) && defined(BCMDHDUSB) |
|---|
| 679 | | - /* dbus_set_revinfo(dhd->dbus, revinfo.chipnum, revinfo.chiprev); */ |
|---|
| 680 | | -#endif /* BCMDBUS && BCMDHDUSB */ |
|---|
| 605 | +#ifdef BCMASSERT_LOG |
|---|
| 606 | + dhd_get_assert_info(dhd); |
|---|
| 607 | +#endif /* BCMASSERT_LOG */ |
|---|
| 681 | 608 | |
|---|
| 682 | | - dhd_process_cid_mac(dhd, TRUE); |
|---|
| 609 | + /* Get the device rev info */ |
|---|
| 610 | + memset(&revinfo, 0, sizeof(revinfo)); |
|---|
| 611 | + ret = dhd_wl_ioctl_cmd(dhd, WLC_GET_REVINFO, &revinfo, sizeof(revinfo), FALSE, 0); |
|---|
| 612 | + if (ret < 0) |
|---|
| 613 | + goto done; |
|---|
| 683 | 614 | |
|---|
| 684 | | - ret = dhd_preinit_ioctls(dhd); |
|---|
| 685 | | - if (!ret) |
|---|
| 686 | | - dhd_process_cid_mac(dhd, FALSE); |
|---|
| 687 | | - } |
|---|
| 615 | + DHD_SSSR_DUMP_INIT(dhd); |
|---|
| 616 | + |
|---|
| 617 | + dhd_process_cid_mac(dhd, TRUE); |
|---|
| 618 | + ret = dhd_preinit_ioctls(dhd); |
|---|
| 619 | + dhd_process_cid_mac(dhd, FALSE); |
|---|
| 688 | 620 | |
|---|
| 689 | 621 | /* Always assumes wl for now */ |
|---|
| 690 | 622 | dhd->iswl = TRUE; |
|---|
| .. | .. |
|---|
| 703 | 635 | { |
|---|
| 704 | 636 | /* Nothing to do for CDC */ |
|---|
| 705 | 637 | } |
|---|
| 706 | | - |
|---|
| 707 | 638 | |
|---|
| 708 | 639 | static void |
|---|
| 709 | 640 | dhd_get_hostreorder_pkts(void *osh, struct reorder_info *ptr, void **pkt, |
|---|
| .. | .. |
|---|
| 849 | 780 | else if (flags & WLHOST_REORDERDATA_CURIDX_VALID) { |
|---|
| 850 | 781 | cur_idx = reorder_info_buf[WLHOST_REORDERDATA_CURIDX_OFFSET]; |
|---|
| 851 | 782 | exp_idx = reorder_info_buf[WLHOST_REORDERDATA_EXPIDX_OFFSET]; |
|---|
| 852 | | - |
|---|
| 853 | 783 | |
|---|
| 854 | 784 | if ((exp_idx == ptr->exp_idx) && (cur_idx != ptr->exp_idx)) { |
|---|
| 855 | 785 | /* still in the current hole */ |
|---|