| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | .\" $NetBSD: usbnet.9,v 1.11 2020/03/20 08:02:55 wiz Exp $ | | 1 | .\" $NetBSD: usbnet.9,v 1.12 2020/08/09 09:20:30 mrg Exp $ |
2 | .\" | | 2 | .\" |
3 | .\" Copyright (c) 2019 Matthew R. Green | | 3 | .\" Copyright (c) 2019 Matthew R. Green |
4 | .\" All rights reserved. | | 4 | .\" All rights reserved. |
5 | .\" | | 5 | .\" |
6 | .\" Redistribution and use in source and binary forms, with or without | | 6 | .\" Redistribution and use in source and binary forms, with or without |
7 | .\" modification, are permitted provided that the following conditions | | 7 | .\" modification, are permitted provided that the following conditions |
8 | .\" are met: | | 8 | .\" are met: |
9 | .\" 1. Redistributions of source code must retain the above copyright | | 9 | .\" 1. Redistributions of source code must retain the above copyright |
10 | .\" notice, this list of conditions and the following disclaimer. | | 10 | .\" notice, this list of conditions and the following disclaimer. |
11 | .\" 2. Redistributions in binary form must reproduce the above copyright | | 11 | .\" 2. Redistributions in binary form must reproduce the above copyright |
12 | .\" notice, this list of conditions and the following disclaimer in the | | 12 | .\" notice, this list of conditions and the following disclaimer in the |
13 | .\" documentation and/or other materials provided with the distribution. | | 13 | .\" documentation and/or other materials provided with the distribution. |
14 | .\" 3. The name of the author may not be used to endorse or promote products | | 14 | .\" 3. The name of the author may not be used to endorse or promote products |
| @@ -570,28 +570,28 @@ members, and the | | | @@ -570,28 +570,28 @@ members, and the |
570 | .Fn uno_stop , | | 570 | .Fn uno_stop , |
571 | .Fn uno_init , | | 571 | .Fn uno_init , |
572 | .Fn uno_tx_prepare , | | 572 | .Fn uno_tx_prepare , |
573 | and | | 573 | and |
574 | .Fn uno_rx_loop | | 574 | .Fn uno_rx_loop |
575 | callbacks of | | 575 | callbacks of |
576 | .Va usbnet_ops . | | 576 | .Va usbnet_ops . |
577 | .Pp | | 577 | .Pp |
578 | Typically, the device attach routine will fill in members of the | | 578 | Typically, the device attach routine will fill in members of the |
579 | .Va usbnet | | 579 | .Va usbnet |
580 | structure, as listed in | | 580 | structure, as listed in |
581 | .Sx AUTOCONFIGURATION . | | 581 | .Sx AUTOCONFIGURATION . |
582 | The | | 582 | The |
583 | .Fn un_ed | | 583 | .Dv un_ed |
584 | member should have the | | 584 | array should have the |
585 | .Dv USBNET_ENDPT_RX | | 585 | .Dv USBNET_ENDPT_RX |
586 | and | | 586 | and |
587 | .Dv USBNET_ENDPT_TX | | 587 | .Dv USBNET_ENDPT_TX |
588 | array entries filled in, and optionally the | | 588 | array entries filled in, and optionally the |
589 | .Dv USBNET_ENDPT_INTR | | 589 | .Dv USBNET_ENDPT_INTR |
590 | entry filled in if applicable. | | 590 | entry filled in if applicable. |
591 | .Pp | | 591 | .Pp |
592 | The optional | | 592 | The optional |
593 | .Fn uno_stop | | 593 | .Fn uno_stop |
594 | callback performs device-specific operations to shutdown the | | 594 | callback performs device-specific operations to shutdown the |
595 | transmit or receive handling. | | 595 | transmit or receive handling. |
596 | .Fn uno_stop | | 596 | .Fn uno_stop |
597 | will be called with the usbnet lock held. | | 597 | will be called with the usbnet lock held. |
| @@ -662,26 +662,27 @@ For devices that have MII support these | | | @@ -662,26 +662,27 @@ For devices that have MII support these |
662 | must be provided: | | 662 | must be provided: |
663 | .Bl -tag -width 4n | | 663 | .Bl -tag -width 4n |
664 | .It uno_read_reg | | 664 | .It uno_read_reg |
665 | Read an MII register for a particular PHY. | | 665 | Read an MII register for a particular PHY. |
666 | Returns standard | | 666 | Returns standard |
667 | .Xr errno 2 . | | 667 | .Xr errno 2 . |
668 | .It uno_write_reg | | 668 | .It uno_write_reg |
669 | Write an MII register for a particular PHY. | | 669 | Write an MII register for a particular PHY. |
670 | Returns standard | | 670 | Returns standard |
671 | .Xr errno 2 . | | 671 | .Xr errno 2 . |
672 | .It uno_statchg | | 672 | .It uno_statchg |
673 | Handle a status change event for this interface. | | 673 | Handle a status change event for this interface. |
674 | .El | | 674 | .El |
| | | 675 | .Pp |
675 | The read and write callbacks are called with the core lock held. | | 676 | The read and write callbacks are called with the core lock held. |
676 | See | | 677 | See |
677 | .Fn usbnet_lock_mii | | 678 | .Fn usbnet_lock_mii |
678 | and | | 679 | and |
679 | .Fn usbnet_unlock_mii . | | 680 | .Fn usbnet_unlock_mii . |
680 | .Sh INTERRUPT PIPE | | 681 | .Sh INTERRUPT PIPE |
681 | The interrupt specific callback, | | 682 | The interrupt specific callback, |
682 | .Dq uno_intr , | | 683 | .Dq uno_intr , |
683 | is an optional callback that can be called periodically, registered by | | 684 | is an optional callback that can be called periodically, registered by |
684 | .Nm | | 685 | .Nm |
685 | using the | | 686 | using the |
686 | .Fn usbd_open_pipe_intr | | 687 | .Fn usbd_open_pipe_intr |
687 | function (instead of the | | 688 | function (instead of the |
| @@ -795,27 +796,27 @@ routine can use the default handling wit | | | @@ -795,27 +796,27 @@ routine can use the default handling wit |
795 | device specific programming (multicast filters, etc.), which can be | | 796 | device specific programming (multicast filters, etc.), which can be |
796 | empty, or, the override ioctl can be used for heavier requirements. | | 797 | empty, or, the override ioctl can be used for heavier requirements. |
797 | The device | | 798 | The device |
798 | .Dq stop | | 799 | .Dq stop |
799 | routine is replaced with a simple call that turns off the | | 800 | routine is replaced with a simple call that turns off the |
800 | device-specific transmitter and receiver if necessary, as the | | 801 | device-specific transmitter and receiver if necessary, as the |
801 | framework handles pipes and transfers and buffers. | | 802 | framework handles pipes and transfers and buffers. |
802 | .It Device locking | | 803 | .It Device locking |
803 | The | | 804 | The |
804 | .Nm | | 805 | .Nm |
805 | framework provides three locks for the system: core lock, | | 806 | framework provides three locks for the system: core lock, |
806 | receive lock, and transmit lock. | | 807 | receive lock, and transmit lock. |
807 | The normal locking order | | 808 | The normal locking order |
808 | for these locks is ifnet lock -> usbnet core lock -> usbnet rxlock -> usbne | | 809 | for these locks is ifnet lock -> usbnet core lock -> usbnet rxlock -> usbnet |
809 | txlock, or, ifnet lock -> usbnet core lock. | | 810 | txlock, or, ifnet lock -> usbnet core lock. |
810 | Also note that the core lock may be taken when the ifnet lock is not | | 811 | Also note that the core lock may be taken when the ifnet lock is not |
811 | held. | | 812 | held. |
812 | .It MII handling | | 813 | .It MII handling |
813 | For devices with MII support the three normal callbacks | | 814 | For devices with MII support the three normal callbacks |
814 | .Pq read, write, and status change | | 815 | .Pq read, write, and status change |
815 | must be converted to | | 816 | must be converted to |
816 | .Va usbnet . | | 817 | .Va usbnet . |
817 | These functions are called with the core lock is held | | 818 | These functions are called with the core lock is held |
818 | .Po | | 819 | .Po |
819 | see | | 820 | see |
820 | .Dq Fn usbnet_isowned_core | | 821 | .Dq Fn usbnet_isowned_core |
821 | .Pc , | | 822 | .Pc , |