Lines Matching refs:dp
149 #define OUTB(dp, p, v, errp, label) \
150 if ((*(errp) = usbgem_ctrl_out((dp), \
160 #define OUTW(dp, p, v, errp, label) \
161 if ((*(errp) = usbgem_ctrl_out_val((dp), \
170 #define OUTS(dp, p, buf, len, errp, label) \
171 if ((*(errp) = usbgem_ctrl_out((dp), \
181 #define INB(dp, p, vp, errp, label) \
182 if ((*(errp) = usbgem_ctrl_in_val((dp), \
191 #define INW(dp, p, vp, errp, label) \
192 if ((*(errp) = usbgem_ctrl_in_val((dp), \
201 #define INS(dp, p, buf, len, errp, label) \
202 if ((*(errp) = usbgem_ctrl_in((dp), \
218 upf_reset_chip(struct usbgem_dev *dp)
223 struct upf_dev *lp = dp->private;
225 DPRINTF(0, (CE_CONT, "!%s: %s: called", dp->name, __func__));
229 OUTB(dp, EC1, EC1_RM, &err, usberr);
232 INB(dp, EC1, &val, &err, usberr);
241 cmn_err(CE_WARN, "!%s: failed to reset: timeout", dp->name);
245 cmn_err(CE_NOTE, "!%s: %s: usberr detected", dp->name, __func__);
253 upf_init_chip(struct usbgem_dev *dp)
257 struct upf_dev *lp = dp->private;
259 DPRINTF(0, (CE_CONT, "!%s: %s: called", dp->name, __func__));
263 OUTB(dp, EC0, lp->ec[0], &err, usberr);
268 INB(dp, EC2, &lp->ec[2], &err, usberr);
271 if (dp->misc_flag & USBGEM_VLAN) {
275 OUTB(dp, EC2, lp->ec[2], &err, usberr);
278 OUTS(dp, MA, &zero64, 8, &err, usberr);
283 OUTB(dp, PAUSETIMER, 0x1f, &err, usberr);
294 OUTB(dp, RXFC, 0, &err, usberr);
298 err = upf_set_media(dp);
301 DPRINTF(2, (CE_CONT, "!%s: %s: end (success)", dp->name, __func__));
306 dp->name, __func__, err);
311 upf_start_chip(struct usbgem_dev *dp)
314 struct upf_dev *lp = dp->private;
316 DPRINTF(0, (CE_CONT, "!%s: %s: called", dp->name, __func__));
320 OUTB(dp, EC0, lp->ec[0], &err, usberr);
325 dp->name, __func__, err);
330 upf_stop_chip(struct usbgem_dev *dp)
333 struct upf_dev *lp = dp->private;
335 DPRINTF(0, (CE_CONT, "!%s: %s: called", dp->name, __func__));
339 OUTB(dp, EC0, lp->ec[0], &err, usberr);
345 dp->name, __func__, err);
350 upf_get_stats(struct usbgem_dev *dp)
357 upf_mcast_hash(struct usbgem_dev *dp, const uint8_t *addr)
364 upf_set_rx_filter(struct usbgem_dev *dp)
373 struct upf_dev *lp = dp->private;
376 dp->name, __func__, dp->rxmode, RXMODE_BITS));
382 if (dp->rxmode & RXMODE_PROMISC) {
386 } else if ((dp->rxmode & RXMODE_ALLMULTI) || dp->mc_count > 0) {
392 if (bcmp(dp->cur_addr.ether_addr_octet,
396 bcopy(dp->cur_addr.ether_addr_octet,
398 OUTS(dp, EID,
403 OUTS(dp, EC0, lp->ec, 3, &err, usberr);
406 INB(dp, EC0, ®0, &err, usberr);
407 INB(dp, EC1, ®1, &err, usberr);
408 INB(dp, EC2, ®2, &err, usberr);
411 dp->name, __func__,
417 cmn_err(CE_NOTE, "!%s: %s: usberr detected", dp->name, __func__);
422 upf_set_media(struct usbgem_dev *dp)
425 struct upf_dev *lp = dp->private;
427 DPRINTF(0, (CE_CONT, "!%s: %s: called", dp->name, __func__));
432 if (dp->full_duplex) {
437 if (dp->speed == USBGEM_SPD_100) {
442 switch (dp->flow_control) {
454 switch (dp->flow_control) {
459 OUTB(dp, ORFBFC,
464 OUTB(dp, RPNBFC_PN,
469 OUTB(dp, ORFBFC,
474 OUTB(dp, RPNBFC, 0, &err, usberr);
479 OUTB(dp, ORFBFC, 0, &err, usberr);
480 OUTB(dp, RPNBFC, 0, &err, usberr);
485 OUTS(dp, EC0, lp->ec, 2, &err, usberr);
487 dp->name, __func__, lp->ec[0], EC0_BITS, lp->ec[1], EC1_BITS));
492 cmn_err(CE_WARN, "%s: %s: failed to write ec1", dp->name, __func__);
500 upf_tx_make_packet(struct usbgem_dev *dp, mblk_t *mp)
509 DPRINTF(3, (CE_CONT, "!%s: %s: called", dp->name, __func__));
557 upf_dump_packet(struct usbgem_dev *dp, uint8_t *bp, int n)
568 upf_rx_make_packet(struct usbgem_dev *dp, mblk_t *mp)
574 struct upf_dev *lp = dp->private;
581 dp->name, ddi_get_lbolt(), __func__, len, mp->b_cont));
584 upf_dump_packet(dp, mp->b_rptr, max(6, len));
600 dp->name, __func__, rsr, RSR_BITS, len));
604 DPRINTF(0, (CE_CONT, "!%s: rsr:%b", dp->name, rsr, RSR_BITS));
606 dp->stats.frame++;
609 dp->stats.frame_too_long++;
612 dp->stats.runt++;
615 dp->stats.errrcv++;
622 dp->stats.frame_too_long++;
623 dp->stats.errrcv++;
626 dp->stats.runt++;
627 dp->stats.errrcv++;
641 upf_interrupt(struct usbgem_dev *dp, mblk_t *mp)
644 struct upf_dev *lp = dp->private;
650 dp->name, __func__, mp->b_wptr - mp->b_rptr,
655 dp->name, __func__));
656 usbgem_mii_update_link(dp);
666 upf_mii_read(struct usbgem_dev *dp, uint_t index, int *errp)
673 dp->name, __func__, index));
679 OUTB(dp, PHYA, dp->mii_phy_addr, errp, usberr);
682 OUTB(dp, PHYAC, index | PHYAC_RDPHY, errp, usberr);
685 INB(dp, PHYAC, &phyctrl, errp, usberr);
688 INW(dp, PHYD, &val, errp, usberr);
690 dp->name, __func__, val));
696 cmn_err(CE_WARN, "!%s: %s: timeout detected", dp->name, __func__);
702 "!%s: %s: usberr(%d) detected", dp->name, __func__, *errp);
707 upf_mii_write(struct usbgem_dev *dp, uint_t index, uint16_t val, int *errp)
713 dp->name, __func__, index, val));
718 OUTW(dp, PHYD, val, errp, usberr);
719 OUTB(dp, PHYA, dp->mii_phy_addr, errp, usberr);
720 OUTB(dp, PHYAC, index | PHYAC_WRPHY, errp, usberr);
723 INB(dp, PHYAC, &phyctrl, errp, usberr);
732 cmn_err(CE_WARN, "!%s: %s: timeout detected", dp->name, __func__);
738 "!%s: %s: usberr(%d) detected", dp->name, __func__, *errp);
743 upf_enable_phy(struct usbgem_dev *dp)
747 struct upf_dev *lp = dp->private;
752 INB(dp, IPHYC, &val, &err, usberr);
754 OUTB(dp, IPHYC, val, &err, usberr);
756 INB(dp, IPHYC, &val, &err, usberr);
758 dp->name, __func__, val, IPHYC_BITS));
761 OUTB(dp, IPHYC, val | IPHYC_PHYR, &err, usberr);
762 OUTB(dp, IPHYC, val, &err, usberr);
766 OUTB(dp, 0x83, 0xa5, &err, usberr);
767 INB(dp, 0x83, &val, &err, usberr);
774 dp->ugc.usbgc_mii_hw_link_detection = B_TRUE;
785 OUTB(dp, GPIO10, GPIO10_0O | GPIO10_0OE, &err, usberr);
788 OUTB(dp, GPIO10,
792 dp->ugc.usbgc_mii_hw_link_detection = B_FALSE;
798 cmn_err(CE_NOTE, "!%s: %s: usberr detected", dp->name, __func__);
803 upf_mii_probe(struct usbgem_dev *dp)
807 struct upf_dev *lp = dp->private;
810 upf_enable_phy(dp);
814 return (usbgem_mii_probe_default(dp));
818 upf_mii_init(struct usbgem_dev *dp)
822 struct upf_dev *lp = dp->private;
825 upf_enable_phy(dp);
835 val = upf_mii_read(dp, 0x1b, &err) | 0x4;
836 upf_mii_write(dp, 0x1b, val, &err);
847 upf_read_eeprom(struct usbgem_dev *dp, int index, int *errp)
855 OUTB(dp, EECTRL, 0, errp, usberr);
857 OUTB(dp, EEOFFSET, index, errp, usberr);
858 OUTB(dp, EECTRL, EECTRL_RD, errp, usberr);
861 INB(dp, EECTRL, &eectrl, errp, usberr);
863 INW(dp, EEDATA, &data, errp, usberr);
875 "!%s: %s: usberr(%d) detected", dp->name, __func__, *errp);
880 upf_eeprom_dump(struct usbgem_dev *dp, int size)
885 cmn_err(CE_CONT, "!%s: %s dump:", dp->name, __func__);
890 upf_read_eeprom(dp, i + 0, &err),
891 upf_read_eeprom(dp, i + 1, &err),
892 upf_read_eeprom(dp, i + 2, &err),
893 upf_read_eeprom(dp, i + 3, &err));
898 upf_attach_chip(struct usbgem_dev *dp)
904 struct upf_dev *lp = dp->private;
909 mac = dp->dev_addr.ether_addr_octet;
911 val = upf_read_eeprom(dp, i, &err);
921 dp->name, __func__,
924 dp->misc_flag = 0;
926 dp->misc_flag |= USBGEM_VLAN;
929 upf_eeprom_dump(dp, 0x80);
934 cmn_err(CE_WARN, "!%s: %s: usb error detected", dp->name, __func__);
948 struct usbgem_dev *dp;
1036 dp = usbgem_do_attach(dip, ugcp, lp, sizeof (struct upf_dev));
1040 if (dp != NULL) {
1051 dp = USBGEM_GET_DEV(dip);
1052 lp = dp->private;