1056 /*
1057 * sync for device
1058 */
1059 (void) ddi_dma_sync(sc->sc_dma_cmd.dr_hnd, 0,
1060 sizeof (struct ipw2100_cmd), DDI_DMA_SYNC_FORDEV);
1061 (void) ddi_dma_sync(sc->sc_dma_txbd.dr_hnd,
1062 idx * sizeof (struct ipw2100_bd),
1063 sizeof (struct ipw2100_bd), DDI_DMA_SYNC_FORDEV);
1064
1065 /*
1066 * ring move forward
1067 */
1068 sc->sc_tx_cur = RING_FORWARD(sc->sc_tx_cur, 1, IPW2100_NUM_TXBD);
1069 sc->sc_tx_free--;
1070 ipw2100_csr_put32(sc, IPW2100_CSR_TX_WRITE_INDEX, sc->sc_tx_cur);
1071 mutex_exit(&sc->sc_tx_lock);
1072
1073 /*
1074 * wait for command done
1075 */
1076 clk = drv_usectohz(1000000); /* 1 second */
1077 mutex_enter(&sc->sc_ilock);
1078 while (sc->sc_done == 0) {
1079 /*
1080 * pending for the response
1081 */
1082 if (cv_reltimedwait(&sc->sc_cmd_cond, &sc->sc_ilock,
1083 clk, TR_CLOCK_TICK) < 0)
1084 break;
1085 }
1086 mutex_exit(&sc->sc_ilock);
1087
1088 IPW2100_DBG(IPW2100_DBG_RING, (sc->sc_dip, CE_CONT,
1089 "ipw2100_cmd(): cmd-done=%s\n", sc->sc_done ? "yes" : "no"));
1090
1091 if (sc->sc_done == 0)
1092 return (DDI_FAILURE);
1093
1094 return (DDI_SUCCESS);
1095 }
1096
|
1056 /*
1057 * sync for device
1058 */
1059 (void) ddi_dma_sync(sc->sc_dma_cmd.dr_hnd, 0,
1060 sizeof (struct ipw2100_cmd), DDI_DMA_SYNC_FORDEV);
1061 (void) ddi_dma_sync(sc->sc_dma_txbd.dr_hnd,
1062 idx * sizeof (struct ipw2100_bd),
1063 sizeof (struct ipw2100_bd), DDI_DMA_SYNC_FORDEV);
1064
1065 /*
1066 * ring move forward
1067 */
1068 sc->sc_tx_cur = RING_FORWARD(sc->sc_tx_cur, 1, IPW2100_NUM_TXBD);
1069 sc->sc_tx_free--;
1070 ipw2100_csr_put32(sc, IPW2100_CSR_TX_WRITE_INDEX, sc->sc_tx_cur);
1071 mutex_exit(&sc->sc_tx_lock);
1072
1073 /*
1074 * wait for command done
1075 */
1076 clk = drv_sectohz(1);
1077 mutex_enter(&sc->sc_ilock);
1078 while (sc->sc_done == 0) {
1079 /*
1080 * pending for the response
1081 */
1082 if (cv_reltimedwait(&sc->sc_cmd_cond, &sc->sc_ilock,
1083 clk, TR_CLOCK_TICK) < 0)
1084 break;
1085 }
1086 mutex_exit(&sc->sc_ilock);
1087
1088 IPW2100_DBG(IPW2100_DBG_RING, (sc->sc_dip, CE_CONT,
1089 "ipw2100_cmd(): cmd-done=%s\n", sc->sc_done ? "yes" : "no"));
1090
1091 if (sc->sc_done == 0)
1092 return (DDI_FAILURE);
1093
1094 return (DDI_SUCCESS);
1095 }
1096
|