Lines Matching refs:rtlsp

117 static void rtls_chip_stop(rtls_t *rtlsp);
118 static void rtls_chip_start(rtls_t *rtlsp);
119 static void rtls_chip_restart(rtls_t *rtlsp);
227 static uint8_t rtls_reg_get8(rtls_t *rtlsp, uint32_t reg);
230 rtls_reg_get8(rtls_t *rtlsp, uint32_t reg) in rtls_reg_get8() argument
234 addr = REG8(rtlsp->io_reg, reg); in rtls_reg_get8()
235 return (ddi_get8(rtlsp->io_handle, addr)); in rtls_reg_get8()
238 static uint16_t rtls_reg_get16(rtls_t *rtlsp, uint32_t reg);
241 rtls_reg_get16(rtls_t *rtlsp, uint32_t reg) in rtls_reg_get16() argument
245 addr = REG16(rtlsp->io_reg, reg); in rtls_reg_get16()
246 return (ddi_get16(rtlsp->io_handle, addr)); in rtls_reg_get16()
249 static uint32_t rtls_reg_get32(rtls_t *rtlsp, uint32_t reg);
252 rtls_reg_get32(rtls_t *rtlsp, uint32_t reg) in rtls_reg_get32() argument
256 addr = REG32(rtlsp->io_reg, reg); in rtls_reg_get32()
257 return (ddi_get32(rtlsp->io_handle, addr)); in rtls_reg_get32()
260 static void rtls_reg_set8(rtls_t *rtlsp, uint32_t reg, uint8_t value);
263 rtls_reg_set8(rtls_t *rtlsp, uint32_t reg, uint8_t value) in rtls_reg_set8() argument
267 addr = REG8(rtlsp->io_reg, reg); in rtls_reg_set8()
268 ddi_put8(rtlsp->io_handle, addr, value); in rtls_reg_set8()
271 static void rtls_reg_set16(rtls_t *rtlsp, uint32_t reg, uint16_t value);
274 rtls_reg_set16(rtls_t *rtlsp, uint32_t reg, uint16_t value) in rtls_reg_set16() argument
278 addr = REG16(rtlsp->io_reg, reg); in rtls_reg_set16()
279 ddi_put16(rtlsp->io_handle, addr, value); in rtls_reg_set16()
282 static void rtls_reg_set32(rtls_t *rtlsp, uint32_t reg, uint32_t value);
285 rtls_reg_set32(rtls_t *rtlsp, uint32_t reg, uint32_t value) in rtls_reg_set32() argument
289 addr = REG32(rtlsp->io_reg, reg); in rtls_reg_set32()
290 ddi_put32(rtlsp->io_handle, addr, value); in rtls_reg_set32()
338 rtls_t *rtlsp; /* Our private device info */ in rtls_attach() local
351 if ((rtlsp = ddi_get_driver_private(devinfo)) == NULL) { in rtls_attach()
354 mutex_enter(&rtlsp->rtls_io_lock); in rtls_attach()
355 mutex_enter(&rtlsp->rtls_rx_lock); in rtls_attach()
356 mutex_enter(&rtlsp->rtls_tx_lock); in rtls_attach()
363 mutex_exit(&rtlsp->rtls_tx_lock); in rtls_attach()
364 mutex_exit(&rtlsp->rtls_rx_lock); in rtls_attach()
365 mutex_exit(&rtlsp->rtls_io_lock); in rtls_attach()
374 rtls_chip_restart(rtlsp); in rtls_attach()
375 rtlsp->chip_error = B_FALSE; in rtls_attach()
376 rtlsp->tx_retry = 0; in rtls_attach()
377 rtlsp->rtls_suspended = B_FALSE; in rtls_attach()
378 mutex_exit(&rtlsp->rtls_tx_lock); in rtls_attach()
379 mutex_exit(&rtlsp->rtls_rx_lock); in rtls_attach()
380 mutex_exit(&rtlsp->rtls_io_lock); in rtls_attach()
382 mii_resume(rtlsp->mii); in rtls_attach()
384 mac_tx_update(rtlsp->mh); in rtls_attach()
447 rtlsp = kmem_zalloc(sizeof (rtls_t), KM_SLEEP); in rtls_attach()
449 ddi_set_driver_private(devinfo, rtlsp); in rtls_attach()
450 rtlsp->devinfo = devinfo; in rtls_attach()
451 rtlsp->instance = ddi_get_instance(devinfo); in rtls_attach()
456 err = ddi_regs_map_setup(devinfo, 1, &rtlsp->io_reg, in rtls_attach()
457 (offset_t)0, 0, &rtls_reg_accattr, &rtlsp->io_handle); in rtls_attach()
459 kmem_free((caddr_t)rtlsp, sizeof (rtls_t)); in rtls_attach()
467 if (rtls_alloc_bufs(rtlsp) == DDI_FAILURE) { in rtls_attach()
475 err = rtls_chip_reset(rtlsp, B_FALSE); in rtls_attach()
482 rtls_get_mac_addr(rtlsp, rtlsp->netaddr); in rtls_attach()
494 if (ddi_add_intr(devinfo, 0, &rtlsp->iblk, NULL, rtls_intr, in rtls_attach()
495 (caddr_t)rtlsp) != DDI_SUCCESS) { in rtls_attach()
500 if ((rtlsp->mii = mii_alloc(rtlsp, devinfo, &rtls_mii_ops)) == NULL) { in rtls_attach()
501 ddi_remove_intr(devinfo, 0, rtlsp->iblk); in rtls_attach()
509 mii_set_pauseable(rtlsp->mii, B_FALSE, B_FALSE); in rtls_attach()
513 ddi_remove_intr(devinfo, 0, rtlsp->iblk); in rtls_attach()
520 mutex_init(&rtlsp->rtls_io_lock, NULL, MUTEX_DRIVER, rtlsp->iblk); in rtls_attach()
521 mutex_init(&rtlsp->rtls_tx_lock, NULL, MUTEX_DRIVER, rtlsp->iblk); in rtls_attach()
522 mutex_init(&rtlsp->rtls_rx_lock, NULL, MUTEX_DRIVER, rtlsp->iblk); in rtls_attach()
529 macp->m_driver = rtlsp; in rtls_attach()
531 macp->m_src_addr = rtlsp->netaddr; in rtls_attach()
537 if (mac_register(macp, &rtlsp->mh) != 0) { in rtls_attach()
538 ddi_remove_intr(devinfo, 0, rtlsp->iblk); in rtls_attach()
539 mutex_destroy(&rtlsp->rtls_io_lock); in rtls_attach()
540 mutex_destroy(&rtlsp->rtls_tx_lock); in rtls_attach()
541 mutex_destroy(&rtlsp->rtls_rx_lock); in rtls_attach()
552 if (rtlsp->mii) in rtls_attach()
553 mii_free(rtlsp->mii); in rtls_attach()
556 ddi_regs_map_free(&rtlsp->io_handle); in rtls_attach()
557 rtls_free_bufs(rtlsp); in rtls_attach()
558 kmem_free(rtlsp, sizeof (rtls_t)); in rtls_attach()
569 rtls_t *rtlsp; /* our private device info */ in rtls_detach() local
574 if ((rtlsp = ddi_get_driver_private(devinfo)) == NULL) { in rtls_detach()
583 mii_suspend(rtlsp->mii); in rtls_detach()
585 mutex_enter(&rtlsp->rtls_io_lock); in rtls_detach()
586 mutex_enter(&rtlsp->rtls_rx_lock); in rtls_detach()
587 mutex_enter(&rtlsp->rtls_tx_lock); in rtls_detach()
589 rtlsp->rtls_suspended = B_TRUE; in rtls_detach()
590 rtls_chip_stop(rtlsp); in rtls_detach()
592 mutex_exit(&rtlsp->rtls_tx_lock); in rtls_detach()
593 mutex_exit(&rtlsp->rtls_rx_lock); in rtls_detach()
594 mutex_exit(&rtlsp->rtls_io_lock); in rtls_detach()
601 if (mac_unregister(rtlsp->mh) != 0) { in rtls_detach()
606 ddi_remove_intr(devinfo, 0, rtlsp->iblk); in rtls_detach()
608 mii_free(rtlsp->mii); in rtls_detach()
610 mutex_destroy(&rtlsp->rtls_io_lock); in rtls_detach()
611 mutex_destroy(&rtlsp->rtls_tx_lock); in rtls_detach()
612 mutex_destroy(&rtlsp->rtls_rx_lock); in rtls_detach()
614 ddi_regs_map_free(&rtlsp->io_handle); in rtls_detach()
615 rtls_free_bufs(rtlsp); in rtls_detach()
616 kmem_free(rtlsp, sizeof (rtls_t)); in rtls_detach()
634 rtls_t *rtlsp; /* our private device info */ in rtls_quiesce() local
639 if ((rtlsp = ddi_get_driver_private(devinfo)) == NULL) { in rtls_quiesce()
642 return (rtls_chip_reset(rtlsp, B_TRUE)); in rtls_quiesce()
655 rtls_t *rtlsp = (rtls_t *)arg; in rtls_m_start() local
657 mutex_enter(&rtlsp->rtls_io_lock); in rtls_m_start()
658 mutex_enter(&rtlsp->rtls_rx_lock); in rtls_m_start()
659 mutex_enter(&rtlsp->rtls_tx_lock); in rtls_m_start()
661 if (!rtlsp->rtls_suspended) in rtls_m_start()
662 rtls_chip_restart(rtlsp); in rtls_m_start()
664 rtlsp->rtls_running = B_TRUE; in rtls_m_start()
666 mutex_exit(&rtlsp->rtls_tx_lock); in rtls_m_start()
667 mutex_exit(&rtlsp->rtls_rx_lock); in rtls_m_start()
668 mutex_exit(&rtlsp->rtls_io_lock); in rtls_m_start()
672 mii_start(rtlsp->mii); in rtls_m_start()
683 rtls_t *rtlsp = (rtls_t *)arg; in rtls_m_stop() local
685 mii_stop(rtlsp->mii); in rtls_m_stop()
687 mutex_enter(&rtlsp->rtls_io_lock); in rtls_m_stop()
689 if (!rtlsp->rtls_suspended) in rtls_m_stop()
690 rtls_chip_stop(rtlsp); in rtls_m_stop()
691 rtlsp->rtls_running = B_FALSE; in rtls_m_stop()
693 mutex_exit(&rtlsp->rtls_io_lock); in rtls_m_stop()
703 rtls_t *rtlsp = arg; in rtls_m_unicst() local
705 mutex_enter(&rtlsp->rtls_io_lock); in rtls_m_unicst()
706 bcopy(macaddr, rtlsp->netaddr, ETHERADDRL); in rtls_m_unicst()
707 if (!rtlsp->rtls_suspended) in rtls_m_unicst()
708 rtls_set_mac_addr(rtlsp, rtlsp->netaddr); in rtls_m_unicst()
709 mutex_exit(&rtlsp->rtls_io_lock); in rtls_m_unicst()
721 rtls_t *rtlsp = (rtls_t *)arg; in rtls_m_multicst() local
725 mutex_enter(&rtlsp->rtls_io_lock); in rtls_m_multicst()
726 hashp = rtlsp->multi_hash; in rtls_m_multicst()
731 if (rtlsp->multicast_cnt[index]++) { in rtls_m_multicst()
732 mutex_exit(&rtlsp->rtls_io_lock); in rtls_m_multicst()
737 if (--rtlsp->multicast_cnt[index]) { in rtls_m_multicst()
738 mutex_exit(&rtlsp->rtls_io_lock); in rtls_m_multicst()
747 if (!rtlsp->rtls_suspended) { in rtls_m_multicst()
748 rtls_reg_set32(rtlsp, MULTICAST_0_REG, hashp[0]); in rtls_m_multicst()
749 rtls_reg_set32(rtlsp, MULTICAST_4_REG, hashp[1]); in rtls_m_multicst()
752 mutex_exit(&rtlsp->rtls_io_lock); in rtls_m_multicst()
796 rtls_t *rtlsp = arg; in rtls_m_promisc() local
798 mutex_enter(&rtlsp->rtls_io_lock); in rtls_m_promisc()
800 rtlsp->promisc = on; in rtls_m_promisc()
801 if (!rtlsp->rtls_suspended) { in rtls_m_promisc()
802 uint32_t val32 = rtls_reg_get32(rtlsp, RX_CONFIG_REG); in rtls_m_promisc()
808 rtls_reg_set32(rtlsp, RX_CONFIG_REG, val32); in rtls_m_promisc()
810 mutex_exit(&rtlsp->rtls_io_lock); in rtls_m_promisc()
826 rtls_t *rtlsp = arg; in rtls_m_stat() local
828 if (mii_m_getstat(rtlsp->mii, stat, val) == 0) { in rtls_m_stat()
834 *val = rtlsp->stats.ipackets; in rtls_m_stat()
837 *val = rtlsp->stats.rbytes; in rtls_m_stat()
840 *val = rtlsp->stats.opackets; in rtls_m_stat()
843 *val = rtlsp->stats.obytes; in rtls_m_stat()
846 *val = rtlsp->stats.rcv_err; in rtls_m_stat()
849 *val = rtlsp->stats.xmt_err; in rtls_m_stat()
852 *val = rtlsp->stats.multi_rcv; in rtls_m_stat()
855 *val = rtlsp->stats.brdcst_rcv; in rtls_m_stat()
858 *val = rtlsp->stats.multi_xmt; in rtls_m_stat()
861 *val = rtlsp->stats.brdcst_xmt; in rtls_m_stat()
864 *val = rtlsp->stats.underflow; in rtls_m_stat()
867 *val = rtlsp->stats.overflow; in rtls_m_stat()
870 *val = rtlsp->stats.no_rcvbuf; in rtls_m_stat()
873 *val = rtlsp->stats.collisions; in rtls_m_stat()
876 *val = rtlsp->stats.crc_err; in rtls_m_stat()
879 *val = rtlsp->stats.frame_err; in rtls_m_stat()
882 *val = rtlsp->stats.defer; in rtls_m_stat()
885 *val = rtlsp->stats.xmt_latecoll; in rtls_m_stat()
888 *val = rtlsp->stats.too_long; in rtls_m_stat()
891 *val = rtlsp->stats.in_short; in rtls_m_stat()
894 *val = rtlsp->stats.no_carrier; in rtls_m_stat()
897 *val = rtlsp->stats.firstcol; in rtls_m_stat()
900 *val = rtlsp->stats.multicol; in rtls_m_stat()
913 rtls_reg_print(rtlsp); in rtls_m_stat()
923 rtls_t *rtlsp = arg; in rtls_m_getprop() local
925 return (mii_m_getprop(rtlsp->mii, name, num, sz, val)); in rtls_m_getprop()
932 rtls_t *rtlsp = arg; in rtls_m_setprop() local
934 return (mii_m_setprop(rtlsp->mii, name, num, sz, val)); in rtls_m_setprop()
941 rtls_t *rtlsp = arg; in rtls_m_propinfo() local
943 mii_m_propinfo(rtlsp->mii, name, num, prh); in rtls_m_propinfo()
960 rtls_send(rtls_t *rtlsp, mblk_t *mp) in rtls_send() argument
968 ASSERT(rtlsp->rtls_running); in rtls_send()
970 mutex_enter(&rtlsp->rtls_tx_lock); in rtls_send()
972 if (rtlsp->rtls_suspended) { in rtls_send()
973 mutex_exit(&rtlsp->rtls_tx_lock); in rtls_send()
980 if (rtlsp->chip_error) { in rtls_send()
984 mac_name(rtlsp->mh)); in rtls_send()
986 mutex_exit(&rtlsp->rtls_tx_lock); in rtls_send()
997 if (rtls_reg_get8(rtlsp, MEDIA_STATUS_REG) & MEDIA_STATUS_LINK) { in rtls_send()
1001 mac_name(rtlsp->mh)); in rtls_send()
1003 rtlsp->stats.no_carrier++; in rtls_send()
1004 mutex_exit(&rtlsp->rtls_tx_lock); in rtls_send()
1012 cur_desc = rtlsp->tx_current_desc; in rtls_send()
1019 if (rtlsp->tx_first_loop < RTLS_MAX_TX_DESC) { in rtls_send()
1020 rtlsp->tx_first_loop++; in rtls_send()
1028 tx_status = rtls_reg_get32(rtlsp, TX_STATUS_DESC0_REG + 4 * cur_desc); in rtls_send()
1037 "%s: rtls_send: need_sched", mac_name(rtlsp->mh)); in rtls_send()
1045 if (rtlsp->tx_retry++ > RTLS_TX_RETRY_NUM) { in rtls_send()
1057 tx_status = rtls_reg_get32(rtlsp, in rtls_send()
1062 mac_name(rtlsp->mh), tx_status); in rtls_send()
1064 rtlsp->tx_retry = 0; in rtls_send()
1065 rtlsp->chip_error = B_TRUE; in rtls_send()
1066 rtlsp->stats.xmt_err++; in rtls_send()
1067 rtlsp->stats.mac_xmt_err++; in rtls_send()
1068 mutex_exit(&rtlsp->rtls_tx_lock); in rtls_send()
1073 rtlsp->stats.defer++; in rtls_send()
1074 rtlsp->need_sched = B_TRUE; in rtls_send()
1075 mutex_exit(&rtlsp->rtls_tx_lock); in rtls_send()
1087 mac_name(rtlsp->mh), tx_status); in rtls_send()
1090 rtlsp->stats.xmt_err++; in rtls_send()
1092 rtlsp->stats.underflow++; in rtls_send()
1094 rtlsp->stats.no_carrier++; in rtls_send()
1096 rtlsp->stats.xmt_latecoll++; in rtls_send()
1100 rtlsp->stats.collisions += ncc; in rtls_send()
1101 rtlsp->stats.firstcol++; in rtls_send()
1102 rtlsp->stats.multicol += ncc - 1; in rtls_send()
1109 rtlsp->tx_retry = 0; in rtls_send()
1119 mac_name(rtlsp->mh), totlen); in rtls_send()
1120 rtlsp->stats.mac_xmt_err++; in rtls_send()
1121 rtlsp->stats.xmt_err++; in rtls_send()
1123 mutex_exit(&rtlsp->rtls_tx_lock); in rtls_send()
1128 mcopymsg(mp, rtlsp->tx_buf[cur_desc]); in rtls_send()
1131 if (*rtlsp->tx_buf[cur_desc] & 0x1) { in rtls_send()
1132 uint16_t *ptr = (void *)rtlsp->tx_buf[cur_desc]; in rtls_send()
1136 rtlsp->stats.brdcst_xmt++; in rtls_send()
1138 rtlsp->stats.multi_xmt++; in rtls_send()
1141 rtlsp->stats.opackets++; in rtls_send()
1142 rtlsp->stats.obytes += totlen; in rtls_send()
1145 bzero(rtlsp->tx_buf[cur_desc] + totlen, ETHERMIN - totlen); in rtls_send()
1150 (void) ddi_dma_sync(rtlsp->dma_area_tx[cur_desc].dma_hdl, 0, totlen, in rtls_send()
1158 rtls_reg_set32(rtlsp, TX_STATUS_DESC0_REG + 4 * cur_desc, in rtls_send()
1166 rtlsp->tx_current_desc = cur_desc; in rtls_send()
1168 mutex_exit(&rtlsp->rtls_tx_lock); in rtls_send()
1179 rtls_t *rtlsp = arg; in rtls_m_tx() local
1185 if (!rtls_send(rtlsp, mp)) { in rtls_m_tx()
1200 rtls_receive(rtls_t *rtlsp) in rtls_receive() argument
1213 mutex_enter(&rtlsp->rtls_rx_lock); in rtls_receive()
1215 if (rtlsp->rtls_suspended) { in rtls_receive()
1216 mutex_exit(&rtlsp->rtls_rx_lock); in rtls_receive()
1220 while ((rtls_reg_get8(rtlsp, RT_COMMAND_REG) in rtls_receive()
1226 if (rtlsp->chip_error) { in rtls_receive()
1230 mac_name(rtlsp->mh)); in rtls_receive()
1235 cur_rx = rtlsp->cur_rx; in rtls_receive()
1236 rx_ptr = rtlsp->rx_ring + cur_rx; in rtls_receive()
1245 mac_name(rtlsp->mh)); in rtls_receive()
1259 mac_name(rtlsp->mh), rx_status, packet_len); in rtls_receive()
1266 rtlsp->stats.in_short++; in rtls_receive()
1268 rtlsp->stats.too_long++; in rtls_receive()
1270 rtlsp->stats.crc_err++; in rtls_receive()
1272 rtlsp->stats.frame_err++; in rtls_receive()
1278 rtlsp->chip_error = B_TRUE; in rtls_receive()
1279 mutex_exit(&rtlsp->rtls_rx_lock); in rtls_receive()
1306 mac_name(rtlsp->mh), packet_len, wrap_size); in rtls_receive()
1312 (void) ddi_dma_sync(rtlsp->dma_area_rx.dma_hdl, in rtls_receive()
1316 (void) ddi_dma_sync(rtlsp->dma_area_rx.dma_hdl, in rtls_receive()
1327 bcopy(rtlsp->rx_ring, mp->b_wptr, wrap_size); in rtls_receive()
1332 rtlsp->stats.ipackets++; in rtls_receive()
1334 rtlsp->stats.brdcst_rcv++; in rtls_receive()
1336 rtlsp->stats.multi_rcv++; in rtls_receive()
1337 rtlsp->stats.rbytes += packet_len; in rtls_receive()
1339 rtlsp->stats.no_rcvbuf++; in rtls_receive()
1348 (void) ddi_dma_sync(rtlsp->dma_area_rx.dma_hdl, in rtls_receive()
1357 rtlsp->stats.ipackets++; in rtls_receive()
1359 rtlsp->stats.brdcst_rcv++; in rtls_receive()
1361 rtlsp->stats.multi_rcv++; in rtls_receive()
1362 rtlsp->stats.rbytes += packet_len; in rtls_receive()
1364 rtlsp->stats.no_rcvbuf++; in rtls_receive()
1376 rtlsp->cur_rx = cur_rx; in rtls_receive()
1377 rtls_reg_set16(rtlsp, RX_CURRENT_READ_ADDR_REG, in rtls_receive()
1380 mutex_exit(&rtlsp->rtls_rx_lock); in rtls_receive()
1386 mac_rx(rtlsp->mh, NULL, head); in rtls_receive()
1397 rtls_t *rtlsp = (void *)arg; in rtls_intr() local
1402 mutex_enter(&rtlsp->rtls_io_lock); in rtls_intr()
1403 if (rtlsp->rtls_suspended) { in rtls_intr()
1404 mutex_exit(&rtlsp->rtls_io_lock); in rtls_intr()
1411 int_status = rtls_reg_get16(rtlsp, RT_INT_STATUS_REG); in rtls_intr()
1412 if (!(int_status & rtlsp->int_mask)) { in rtls_intr()
1413 mutex_exit(&rtlsp->rtls_io_lock); in rtls_intr()
1421 rtls_reg_set16(rtlsp, RT_INT_STATUS_REG, int_status); in rtls_intr()
1426 if (rtlsp->chip_error) { in rtls_intr()
1427 mutex_enter(&rtlsp->rtls_rx_lock); in rtls_intr()
1428 mutex_enter(&rtlsp->rtls_tx_lock); in rtls_intr()
1429 rtls_chip_restart(rtlsp); in rtls_intr()
1430 rtlsp->chip_error = B_FALSE; in rtls_intr()
1431 rtlsp->tx_retry = 0; in rtls_intr()
1432 mutex_exit(&rtlsp->rtls_tx_lock); in rtls_intr()
1433 mutex_exit(&rtlsp->rtls_rx_lock); in rtls_intr()
1434 mutex_exit(&rtlsp->rtls_io_lock); in rtls_intr()
1443 val32 = rtls_reg_get32(rtlsp, TX_CONFIG_REG); in rtls_intr()
1445 rtls_reg_set32(rtlsp, TX_CONFIG_REG, val32); in rtls_intr()
1446 cmn_err(CE_WARN, "%s: transmit abort!!!", mac_name(rtlsp->mh)); in rtls_intr()
1452 if (rtlsp->need_sched) { in rtls_intr()
1453 rtlsp->need_sched = B_FALSE; in rtls_intr()
1457 mutex_exit(&rtlsp->rtls_io_lock); in rtls_intr()
1464 rtlsp->stats.overflow++; in rtls_intr()
1465 rtlsp->stats.rcv_err++; in rtls_intr()
1467 rtls_receive(rtlsp); in rtls_intr()
1474 mii_check(rtlsp->mii); in rtls_intr()
1478 mac_tx_update(rtlsp->mh); in rtls_intr()
1493 rtls_alloc_dma_mem(rtls_t *rtlsp, size_t memsize, in rtls_alloc_dma_mem() argument
1502 err = ddi_dma_alloc_handle(rtlsp->devinfo, &dma_attr, in rtls_alloc_dma_mem()
1507 mac_name(rtlsp->mh), err); in rtls_alloc_dma_mem()
1521 mac_name(rtlsp->mh), err); in rtls_alloc_dma_mem()
1539 mac_name(rtlsp->mh), err); in rtls_alloc_dma_mem()
1575 rtls_alloc_bufs(rtls_t *rtlsp) in rtls_alloc_bufs() argument
1584 err = rtls_alloc_dma_mem(rtlsp, in rtls_alloc_bufs()
1588 &rtlsp->dma_area_tx[i]); in rtls_alloc_bufs()
1593 rtlsp->tx_buf[i] = (uint8_t *)rtlsp->dma_area_tx[i].mem_va; in rtls_alloc_bufs()
1599 err = rtls_alloc_dma_mem(rtlsp, in rtls_alloc_bufs()
1603 &rtlsp->dma_area_rx); in rtls_alloc_bufs()
1608 rtlsp->rx_ring = (uint8_t *)rtlsp->dma_area_rx.mem_va; in rtls_alloc_bufs()
1618 rtls_free_bufs(rtls_t *rtlsp) in rtls_free_bufs() argument
1623 rtls_free_dma_mem(&rtlsp->dma_area_tx[i]); in rtls_free_bufs()
1624 rtlsp->tx_buf[i] = NULL; in rtls_free_bufs()
1627 rtls_free_dma_mem(&rtlsp->dma_area_rx); in rtls_free_bufs()
1628 rtlsp->rx_ring = NULL; in rtls_free_bufs()
1639 rtls_chip_reset(rtls_t *rtlsp, boolean_t quiesce) in rtls_chip_reset() argument
1648 val8 = rtls_reg_get8(rtlsp, RT_COMMAND_REG); in rtls_chip_reset()
1650 rtls_reg_set8(rtlsp, RT_COMMAND_REG, val8); in rtls_chip_reset()
1655 val16 = rtls_reg_get16(rtlsp, RT_INT_MASK_REG); in rtls_chip_reset()
1656 rtls_reg_set16(rtlsp, RT_INT_MASK_REG, val16 & (~RTLS_INT_MASK_ALL)); in rtls_chip_reset()
1657 rtlsp->int_mask = RTLS_INT_MASK_NONE; in rtls_chip_reset()
1662 val16 = rtls_reg_get16(rtlsp, RT_INT_STATUS_REG); in rtls_chip_reset()
1663 rtls_reg_set16(rtlsp, RT_INT_STATUS_REG, val16); in rtls_chip_reset()
1668 val8 = rtls_reg_get8(rtlsp, RT_COMMAND_REG); in rtls_chip_reset()
1669 rtls_reg_set8(rtlsp, RT_COMMAND_REG, val8 | RT_COMMAND_RESET); in rtls_chip_reset()
1675 while (rtls_reg_get8(rtlsp, RT_COMMAND_REG) & RT_COMMAND_RESET) { in rtls_chip_reset()
1684 mac_name(rtlsp->mh)); in rtls_chip_reset()
1698 rtls_chip_init(rtls_t *rtlsp) in rtls_chip_init() argument
1707 rtlsp->cur_rx = 0; in rtls_chip_init()
1708 rtlsp->tx_current_desc = 0; in rtls_chip_init()
1709 rtlsp->tx_first_loop = 0; in rtls_chip_init()
1714 rtls_reg_set32(rtlsp, RX_BUFF_ADDR_REG, in rtls_chip_init()
1715 (ulong_t)rtlsp->dma_area_rx.cookie.dmac_address); in rtls_chip_init()
1716 rtls_reg_set32(rtlsp, TX_ADDR_DESC0_REG, in rtls_chip_init()
1717 (ulong_t)rtlsp->dma_area_tx[0].cookie.dmac_address); in rtls_chip_init()
1718 rtls_reg_set32(rtlsp, TX_ADDR_DESC1_REG, in rtls_chip_init()
1719 (ulong_t)rtlsp->dma_area_tx[1].cookie.dmac_address); in rtls_chip_init()
1720 rtls_reg_set32(rtlsp, TX_ADDR_DESC2_REG, in rtls_chip_init()
1721 (ulong_t)rtlsp->dma_area_tx[2].cookie.dmac_address); in rtls_chip_init()
1722 rtls_reg_set32(rtlsp, TX_ADDR_DESC3_REG, in rtls_chip_init()
1723 (ulong_t)rtlsp->dma_area_tx[3].cookie.dmac_address); in rtls_chip_init()
1728 val8 = rtls_reg_get8(rtlsp, RT_COMMAND_REG); in rtls_chip_init()
1729 rtls_reg_set8(rtlsp, RT_COMMAND_REG, in rtls_chip_init()
1735 val32 = rtls_reg_get32(rtlsp, TX_CONFIG_REG); in rtls_chip_init()
1737 rtls_reg_set32(rtlsp, TX_CONFIG_REG, val32 | TX_CONFIG_DEFAULT); in rtls_chip_init()
1742 val32 = rtls_reg_get32(rtlsp, RX_CONFIG_REG); in rtls_chip_init()
1744 if (rtlsp->promisc) in rtls_chip_init()
1746 rtls_reg_set32(rtlsp, RX_CONFIG_REG, val32 | RX_CONFIG_DEFAULT); in rtls_chip_init()
1751 rtls_reg_set32(rtlsp, MULTICAST_0_REG, rtlsp->multi_hash[0]); in rtls_chip_init()
1752 rtls_reg_set32(rtlsp, MULTICAST_4_REG, rtlsp->multi_hash[1]); in rtls_chip_init()
1757 rtls_set_mac_addr(rtlsp, rtlsp->netaddr); in rtls_chip_init()
1762 rtls_reg_set16(rtlsp, RX_CURRENT_READ_ADDR_REG, RX_READ_RESET_VAL); in rtls_chip_init()
1767 val16 = rtls_reg_get16(rtlsp, RT_MUL_INTSEL_REG); in rtls_chip_init()
1769 rtls_reg_set16(rtlsp, RT_MUL_INTSEL_REG, val16); in rtls_chip_init()
1776 rtls_chip_start(rtls_t *rtlsp) in rtls_chip_start() argument
1784 val8 = rtls_reg_get8(rtlsp, RT_COMMAND_REG); in rtls_chip_start()
1785 rtls_reg_set8(rtlsp, RT_COMMAND_REG, in rtls_chip_start()
1791 val16 = rtls_reg_get16(rtlsp, RT_INT_MASK_REG); in rtls_chip_start()
1792 rtls_reg_set16(rtlsp, RT_INT_MASK_REG, val16 | RTLS_INT_MASK); in rtls_chip_start()
1793 rtlsp->int_mask = RTLS_INT_MASK; in rtls_chip_start()
1800 rtls_chip_restart(rtls_t *rtlsp) in rtls_chip_restart() argument
1802 (void) rtls_chip_reset(rtlsp, B_FALSE); in rtls_chip_restart()
1803 rtls_chip_init(rtlsp); in rtls_chip_restart()
1804 rtls_chip_start(rtlsp); in rtls_chip_restart()
1811 rtls_chip_stop(rtls_t *rtlsp) in rtls_chip_stop() argument
1819 val16 = rtls_reg_get16(rtlsp, RT_INT_MASK_REG); in rtls_chip_stop()
1820 rtls_reg_set16(rtlsp, RT_INT_MASK_REG, val16 & (~RTLS_INT_MASK_ALL)); in rtls_chip_stop()
1821 rtlsp->int_mask = RTLS_INT_MASK_NONE; in rtls_chip_stop()
1826 val16 = rtls_reg_get16(rtlsp, RT_INT_STATUS_REG); in rtls_chip_stop()
1827 rtls_reg_set16(rtlsp, RT_INT_STATUS_REG, val16); in rtls_chip_stop()
1832 val8 = rtls_reg_get8(rtlsp, RT_COMMAND_REG); in rtls_chip_stop()
1834 rtls_reg_set8(rtlsp, RT_COMMAND_REG, val8); in rtls_chip_stop()
1841 rtls_get_mac_addr(rtls_t *rtlsp, uint8_t *macaddr) in rtls_get_mac_addr() argument
1848 val32 = rtls_reg_get32(rtlsp, ID_0_REG); in rtls_get_mac_addr()
1860 val32 = rtls_reg_get32(rtlsp, ID_4_REG); in rtls_get_mac_addr()
1867 rtls_set_mac_addr(rtls_t *rtlsp, const uint8_t *macaddr) in rtls_set_mac_addr() argument
1875 val8 = rtls_reg_get8(rtlsp, RT_93c46_COMMAND_REG); in rtls_set_mac_addr()
1877 rtls_reg_set8(rtlsp, RT_93c46_COMMAND_REG, val8); in rtls_set_mac_addr()
1893 rtls_reg_set32(rtlsp, ID_0_REG, val32); in rtls_set_mac_addr()
1905 val32 |= rtls_reg_get32(rtlsp, ID_4_REG) & ~0xffff; in rtls_set_mac_addr()
1906 rtls_reg_set32(rtlsp, ID_4_REG, val32); in rtls_set_mac_addr()
1912 rtls_reg_set8(rtlsp, RT_93c46_COMMAND_REG, val8); in rtls_set_mac_addr()
1918 rtls_t *rtlsp = arg; in rtls_mii_read() local
1926 val = rtls_reg_get16(rtlsp, BASIC_MODE_CONTROL_REG); in rtls_mii_read()
1929 val = rtls_reg_get16(rtlsp, BASIC_MODE_STATUS_REG); in rtls_mii_read()
1932 val = rtls_reg_get16(rtlsp, AUTO_NEGO_AD_REG); in rtls_mii_read()
1935 val = rtls_reg_get16(rtlsp, AUTO_NEGO_LP_REG); in rtls_mii_read()
1938 val = rtls_reg_get16(rtlsp, AUTO_NEGO_EXP_REG); in rtls_mii_read()
1946 val = rtls_reg_get8(rtlsp, MEDIA_STATUS_REG); in rtls_mii_read()
1960 rtls_t *rtlsp = arg; in rtls_mii_write() local
1969 val8 = rtls_reg_get8(rtlsp, RT_93c46_COMMAND_REG); in rtls_mii_write()
1971 rtls_reg_set8(rtlsp, RT_93c46_COMMAND_REG, val8); in rtls_mii_write()
1973 rtls_reg_set16(rtlsp, BASIC_MODE_CONTROL_REG, val); in rtls_mii_write()
1977 rtls_reg_set8(rtlsp, RT_93c46_COMMAND_REG, val8); in rtls_mii_write()
1981 rtls_reg_set16(rtlsp, BASIC_MODE_STATUS_REG, val); in rtls_mii_write()
1984 rtls_reg_set16(rtlsp, AUTO_NEGO_AD_REG, val); in rtls_mii_write()
1987 rtls_reg_set16(rtlsp, AUTO_NEGO_LP_REG, val); in rtls_mii_write()
1990 rtls_reg_set16(rtlsp, AUTO_NEGO_EXP_REG, val); in rtls_mii_write()
2003 rtls_t *rtlsp = arg; in rtls_mii_notify() local
2005 mac_link_update(rtlsp->mh, link); in rtls_mii_notify()
2013 rtls_reg_print(rtls_t *rtlsp) in rtls_reg_print() argument
2019 val8 = rtls_reg_get8(rtlsp, RT_COMMAND_REG); in rtls_reg_print()
2021 mac_name(rtlsp->mh), val8); in rtls_reg_print()
2024 val16 = rtls_reg_get16(rtlsp, RT_INT_STATUS_REG); in rtls_reg_print()
2026 mac_name(rtlsp->mh), val16); in rtls_reg_print()
2029 val16 = rtls_reg_get16(rtlsp, RT_INT_MASK_REG); in rtls_reg_print()
2031 mac_name(rtlsp->mh), val16); in rtls_reg_print()
2034 val32 = rtls_reg_get32(rtlsp, RX_CONFIG_REG); in rtls_reg_print()
2036 mac_name(rtlsp->mh), val32); in rtls_reg_print()
2039 val16 = rtls_reg_get16(rtlsp, TX_DESC_STAUS_REG); in rtls_reg_print()
2041 mac_name(rtlsp->mh), val16, rtlsp->tx_current_desc); in rtls_reg_print()
2044 val32 = rtls_reg_get32(rtlsp, TX_STATUS_DESC0_REG); in rtls_reg_print()
2046 mac_name(rtlsp->mh), val32); in rtls_reg_print()
2049 val32 = rtls_reg_get32(rtlsp, TX_STATUS_DESC1_REG); in rtls_reg_print()
2051 mac_name(rtlsp->mh), val32); in rtls_reg_print()
2054 val32 = rtls_reg_get32(rtlsp, TX_STATUS_DESC2_REG); in rtls_reg_print()
2056 mac_name(rtlsp->mh), val32); in rtls_reg_print()
2059 val32 = rtls_reg_get32(rtlsp, TX_STATUS_DESC3_REG); in rtls_reg_print()
2061 mac_name(rtlsp->mh), val32); in rtls_reg_print()
2065 mac_name(rtlsp->mh), in rtls_reg_print()
2066 (unsigned long long)rtlsp->stats.ipackets, in rtls_reg_print()
2067 (unsigned long long)rtlsp->stats.multi_rcv, in rtls_reg_print()
2068 (unsigned long long)rtlsp->stats.brdcst_rcv); in rtls_reg_print()