old mode 100644new mode 100755.. | .. |
---|
71 | 71 | uint16 reqid; |
---|
72 | 72 | uint8 pending; |
---|
73 | 73 | uint32 lastcmd; |
---|
| 74 | +#ifdef BCMDBUS |
---|
| 75 | + uint ctl_completed; |
---|
| 76 | +#endif /* BCMDBUS */ |
---|
74 | 77 | uint8 bus_header[BUS_HEADER_LEN]; |
---|
75 | 78 | cdc_ioctl_t msg; |
---|
76 | 79 | unsigned char buf[WLC_IOCTL_MAXLEN + ROUND_UP_MARGIN]; |
---|
.. | .. |
---|
86 | 89 | static int |
---|
87 | 90 | dhdcdc_msg(dhd_pub_t *dhd) |
---|
88 | 91 | { |
---|
| 92 | +#ifdef BCMDBUS |
---|
| 93 | + int timeout = 0; |
---|
| 94 | +#endif /* BCMDBUS */ |
---|
89 | 95 | int err = 0; |
---|
90 | 96 | dhd_prot_t *prot = dhd->prot; |
---|
91 | 97 | int len = ltoh32(prot->msg.len) + sizeof(cdc_ioctl_t); |
---|
.. | .. |
---|
102 | 108 | len = CDC_MAX_MSG_SIZE; |
---|
103 | 109 | |
---|
104 | 110 | /* Send request */ |
---|
| 111 | +#ifdef BCMDBUS |
---|
| 112 | + prot->ctl_completed = FALSE; |
---|
| 113 | + err = dbus_send_ctl(dhd->bus, (void *)&prot->msg, len); |
---|
| 114 | + if (err) { |
---|
| 115 | + DHD_ERROR(("dbus_send_ctl error=0x%x\n", err)); |
---|
| 116 | + DHD_OS_WAKE_UNLOCK(dhd); |
---|
| 117 | + return err; |
---|
| 118 | + } |
---|
| 119 | +#else |
---|
105 | 120 | err = dhd_bus_txctl(dhd->bus, (uchar*)&prot->msg, len); |
---|
| 121 | +#endif /* BCMDBUS */ |
---|
106 | 122 | |
---|
| 123 | +#ifdef BCMDBUS |
---|
| 124 | + timeout = dhd_os_ioctl_resp_wait(dhd, &prot->ctl_completed); |
---|
| 125 | + if ((!timeout) || (!prot->ctl_completed)) { |
---|
| 126 | + DHD_ERROR(("Txctl timeout %d ctl_completed %d\n", |
---|
| 127 | + timeout, prot->ctl_completed)); |
---|
| 128 | + DHD_ERROR(("Txctl wait timed out\n")); |
---|
| 129 | + err = -1; |
---|
| 130 | + } |
---|
| 131 | +#endif /* BCMDBUS */ |
---|
| 132 | +#if defined(BCMDBUS) && defined(INTR_EP_ENABLE) |
---|
| 133 | + /* If the ctl write is successfully completed, wait for an acknowledgement |
---|
| 134 | + * that indicates that it is now ok to do ctl read from the dongle |
---|
| 135 | + */ |
---|
| 136 | + if (err != -1) { |
---|
| 137 | + prot->ctl_completed = FALSE; |
---|
| 138 | + if (dbus_poll_intr(dhd->dbus)) { |
---|
| 139 | + DHD_ERROR(("dbus_poll_intr not submitted\n")); |
---|
| 140 | + } else { |
---|
| 141 | + /* interrupt polling is sucessfully submitted. Wait for dongle to send |
---|
| 142 | + * interrupt |
---|
| 143 | + */ |
---|
| 144 | + timeout = dhd_os_ioctl_resp_wait(dhd, &prot->ctl_completed); |
---|
| 145 | + if (!timeout) { |
---|
| 146 | + DHD_ERROR(("intr poll wait timed out\n")); |
---|
| 147 | + } |
---|
| 148 | + } |
---|
| 149 | + } |
---|
| 150 | +#endif /* defined(BCMDBUS) && defined(INTR_EP_ENABLE) */ |
---|
107 | 151 | DHD_OS_WAKE_UNLOCK(dhd); |
---|
108 | 152 | return err; |
---|
109 | 153 | } |
---|
.. | .. |
---|
111 | 155 | static int |
---|
112 | 156 | dhdcdc_cmplt(dhd_pub_t *dhd, uint32 id, uint32 len) |
---|
113 | 157 | { |
---|
| 158 | +#ifdef BCMDBUS |
---|
| 159 | + int timeout = 0; |
---|
| 160 | +#endif /* BCMDBUS */ |
---|
114 | 161 | int ret; |
---|
115 | 162 | int cdc_len = len + sizeof(cdc_ioctl_t); |
---|
116 | 163 | dhd_prot_t *prot = dhd->prot; |
---|
.. | .. |
---|
118 | 165 | DHD_TRACE(("%s: Enter\n", __FUNCTION__)); |
---|
119 | 166 | |
---|
120 | 167 | do { |
---|
| 168 | +#ifdef BCMDBUS |
---|
| 169 | + prot->ctl_completed = FALSE; |
---|
| 170 | + ret = dbus_recv_ctl(dhd->bus, (uchar*)&prot->msg, cdc_len); |
---|
| 171 | + if (ret) { |
---|
| 172 | + DHD_ERROR(("dbus_recv_ctl error=0x%x(%d)\n", ret, ret)); |
---|
| 173 | + goto done; |
---|
| 174 | + } |
---|
| 175 | + timeout = dhd_os_ioctl_resp_wait(dhd, &prot->ctl_completed); |
---|
| 176 | + if ((!timeout) || (!prot->ctl_completed)) { |
---|
| 177 | + DHD_ERROR(("Rxctl timeout %d ctl_completed %d\n", |
---|
| 178 | + timeout, prot->ctl_completed)); |
---|
| 179 | + ret = -ETIMEDOUT; |
---|
| 180 | + goto done; |
---|
| 181 | + } |
---|
| 182 | + |
---|
| 183 | + /* XXX FIX: Must return cdc_len, not len, because after query_ioctl() |
---|
| 184 | + * it subtracts sizeof(cdc_ioctl_t); The other approach is |
---|
| 185 | + * to have dbus_recv_ctl() return actual len. |
---|
| 186 | + */ |
---|
| 187 | + ret = cdc_len; |
---|
| 188 | +#else |
---|
121 | 189 | ret = dhd_bus_rxctl(dhd->bus, (uchar*)&prot->msg, cdc_len); |
---|
| 190 | +#endif /* BCMDBUS */ |
---|
122 | 191 | if (ret < 0) |
---|
123 | 192 | break; |
---|
124 | 193 | } while (CDC_IOC_ID(ltoh32(prot->msg.flags)) != id); |
---|
.. | .. |
---|
128 | 197 | ret = len; |
---|
129 | 198 | } |
---|
130 | 199 | |
---|
| 200 | +#ifdef BCMDBUS |
---|
| 201 | +done: |
---|
| 202 | +#endif /* BCMDBUS */ |
---|
131 | 203 | return ret; |
---|
132 | 204 | } |
---|
133 | 205 | |
---|
.. | .. |
---|
330 | 402 | done: |
---|
331 | 403 | return ret; |
---|
332 | 404 | } |
---|
| 405 | + |
---|
| 406 | +#ifdef BCMDBUS |
---|
| 407 | +int |
---|
| 408 | +dhd_prot_ctl_complete(dhd_pub_t *dhd) |
---|
| 409 | +{ |
---|
| 410 | + dhd_prot_t *prot; |
---|
| 411 | + |
---|
| 412 | + if (dhd == NULL) |
---|
| 413 | + return BCME_ERROR; |
---|
| 414 | + |
---|
| 415 | + prot = dhd->prot; |
---|
| 416 | + |
---|
| 417 | + ASSERT(prot); |
---|
| 418 | + prot->ctl_completed = TRUE; |
---|
| 419 | + dhd_os_ioctl_resp_wake(dhd); |
---|
| 420 | + return 0; |
---|
| 421 | +} |
---|
| 422 | +#endif /* BCMDBUS */ |
---|
333 | 423 | |
---|
334 | 424 | /* XXX: due to overlays this should not be called directly; call dhd_wl_ioctl() instead */ |
---|
335 | 425 | int |
---|
.. | .. |
---|
549 | 639 | PKTPULL(dhd->osh, pktbuf, (data_offset << 2)); |
---|
550 | 640 | return 0; |
---|
551 | 641 | } |
---|
552 | | - |
---|
553 | | -#ifdef DHD_LOSSLESS_ROAMING |
---|
554 | | -int dhd_update_sdio_data_prio_map(dhd_pub_t *dhdp) |
---|
555 | | -{ |
---|
556 | | - const uint8 prio2tid[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; |
---|
557 | | - |
---|
558 | | - bcopy(prio2tid, dhdp->flow_prio_map, sizeof(uint8) * NUMPRIO); |
---|
559 | | - |
---|
560 | | - return BCME_OK; |
---|
561 | | -} |
---|
562 | | -#endif // DHD_LOSSLESS_ROAMING |
---|
563 | 642 | |
---|
564 | 643 | int |
---|
565 | 644 | dhd_prot_attach(dhd_pub_t *dhd) |
---|