1 1.24 mrg /* $NetBSD: if_kuereg.h,v 1.24 2019/08/16 08:51:09 mrg Exp $ */ 2 1.24 mrg 3 1.1 augustss /* 4 1.1 augustss * Copyright (c) 1997, 1998, 1999, 2000 5 1.1 augustss * Bill Paul <wpaul (at) ee.columbia.edu>. All rights reserved. 6 1.1 augustss * 7 1.1 augustss * Redistribution and use in source and binary forms, with or without 8 1.1 augustss * modification, are permitted provided that the following conditions 9 1.1 augustss * are met: 10 1.1 augustss * 1. Redistributions of source code must retain the above copyright 11 1.1 augustss * notice, this list of conditions and the following disclaimer. 12 1.1 augustss * 2. Redistributions in binary form must reproduce the above copyright 13 1.1 augustss * notice, this list of conditions and the following disclaimer in the 14 1.1 augustss * documentation and/or other materials provided with the distribution. 15 1.1 augustss * 3. All advertising materials mentioning features or use of this software 16 1.1 augustss * must display the following acknowledgement: 17 1.1 augustss * This product includes software developed by Bill Paul. 18 1.1 augustss * 4. Neither the name of the author nor the names of any co-contributors 19 1.1 augustss * may be used to endorse or promote products derived from this software 20 1.1 augustss * without specific prior written permission. 21 1.1 augustss * 22 1.1 augustss * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND 23 1.1 augustss * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24 1.1 augustss * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 1.1 augustss * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD 26 1.1 augustss * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 27 1.1 augustss * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 28 1.1 augustss * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 1.1 augustss * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 1.1 augustss * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 1.1 augustss * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 32 1.1 augustss * THE POSSIBILITY OF SUCH DAMAGE. 33 1.1 augustss * 34 1.1 augustss * $FreeBSD: src/sys/dev/usb/if_kuereg.h,v 1.2 2000/01/06 07:39:07 wpaul Exp $ 35 1.1 augustss */ 36 1.1 augustss 37 1.1 augustss /* 38 1.1 augustss * Definitions for the KLSI KL5KUSB101B USB to ethernet controller. 39 1.1 augustss * The KLSI part is controlled via vendor control requests, the structure 40 1.1 augustss * of which depend a bit on the firmware running on the internal 41 1.1 augustss * microcontroller. The one exception is the 'send scan data' command, 42 1.1 augustss * which is used to load the firmware. 43 1.1 augustss */ 44 1.1 augustss 45 1.19 riastrad #include <sys/rndsource.h> 46 1.19 riastrad 47 1.1 augustss #define KUE_CONFIG_NO 1 48 1.1 augustss #define KUE_IFACE_IDX 0 49 1.1 augustss 50 1.1 augustss #define KUE_CMD_GET_ETHER_DESCRIPTOR 0x00 51 1.1 augustss #define KUE_CMD_SET_MCAST_FILTERS 0x01 52 1.1 augustss #define KUE_CMD_SET_PKT_FILTER 0x02 53 1.1 augustss #define KUE_CMD_GET_ETHERSTATS 0x03 54 1.1 augustss #define KUE_CMD_GET_GPIO 0x04 55 1.1 augustss #define KUE_CMD_SET_GPIO 0x05 56 1.1 augustss #define KUE_CMD_SET_MAC 0x06 57 1.1 augustss #define KUE_CMD_GET_MAC 0x07 58 1.1 augustss #define KUE_CMD_SET_URB_SIZE 0x08 59 1.1 augustss #define KUE_CMD_SET_SOFS 0x09 60 1.1 augustss #define KUE_CMD_SET_EVEN_PKTS 0x0A 61 1.1 augustss #define KUE_CMD_SEND_SCAN 0xFF 62 1.1 augustss 63 1.1 augustss struct kue_ether_desc { 64 1.14 tsutsui uint8_t kue_len; 65 1.14 tsutsui uint8_t kue_rsvd0; 66 1.14 tsutsui uint8_t kue_rsvd1; 67 1.14 tsutsui uint8_t kue_macaddr[ETHER_ADDR_LEN]; 68 1.14 tsutsui uint8_t kue_etherstats[4]; 69 1.14 tsutsui uint8_t kue_maxseg[2]; 70 1.14 tsutsui uint8_t kue_mcastfilt[2]; 71 1.14 tsutsui uint8_t kue_rsvd2; 72 1.1 augustss }; 73 1.1 augustss 74 1.1 augustss #define KUE_ETHERSTATS(x) \ 75 1.12 tsutsui le32dec((x)->kue_desc.kue_etherstats) 76 1.1 augustss #define KUE_MAXSEG(x) \ 77 1.12 tsutsui le16dec((x)->kue_desc.kue_maxseg) 78 1.1 augustss #define KUE_MCFILTCNT(x) \ 79 1.12 tsutsui (le16dec((x)->kue_desc.kue_mcastfilt) & 0x7FFF) 80 1.1 augustss 81 1.1 augustss #define KUE_STAT_TX_OK 0x00000001 82 1.1 augustss #define KUE_STAT_RX_OK 0x00000002 83 1.1 augustss #define KUE_STAT_TX_ERR 0x00000004 84 1.1 augustss #define KUE_STAT_RX_ERR 0x00000008 85 1.1 augustss #define KUE_STAT_RX_NOBUF 0x00000010 86 1.1 augustss #define KUE_STAT_TX_UCAST_BYTES 0x00000020 87 1.1 augustss #define KUE_STAT_TX_UCAST_FRAMES 0x00000040 88 1.1 augustss #define KUE_STAT_TX_MCAST_BYTES 0x00000080 89 1.1 augustss #define KUE_STAT_TX_MCAST_FRAMES 0x00000100 90 1.1 augustss #define KUE_STAT_TX_BCAST_BYTES 0x00000200 91 1.1 augustss #define KUE_STAT_TX_BCAST_FRAMES 0x00000400 92 1.1 augustss #define KUE_STAT_RX_UCAST_BYTES 0x00000800 93 1.1 augustss #define KUE_STAT_RX_UCAST_FRAMES 0x00001000 94 1.1 augustss #define KUE_STAT_RX_MCAST_BYTES 0x00002000 95 1.1 augustss #define KUE_STAT_RX_MCAST_FRAMES 0x00004000 96 1.1 augustss #define KUE_STAT_RX_BCAST_BYTES 0x00008000 97 1.1 augustss #define KUE_STAT_RX_BCAST_FRAMES 0x00010000 98 1.1 augustss #define KUE_STAT_RX_CRCERR 0x00020000 99 1.1 augustss #define KUE_STAT_TX_QUEUE_LENGTH 0x00040000 100 1.1 augustss #define KUE_STAT_RX_ALIGNERR 0x00080000 101 1.1 augustss #define KUE_STAT_TX_SINGLECOLL 0x00100000 102 1.1 augustss #define KUE_STAT_TX_MULTICOLL 0x00200000 103 1.1 augustss #define KUE_STAT_TX_DEFERRED 0x00400000 104 1.1 augustss #define KUE_STAT_TX_MAXCOLLS 0x00800000 105 1.1 augustss #define KUE_STAT_RX_OVERRUN 0x01000000 106 1.1 augustss #define KUE_STAT_TX_UNDERRUN 0x02000000 107 1.1 augustss #define KUE_STAT_TX_SQE_ERR 0x04000000 108 1.1 augustss #define KUE_STAT_TX_CARRLOSS 0x08000000 109 1.1 augustss #define KUE_STAT_RX_LATECOLL 0x10000000 110 1.1 augustss 111 1.1 augustss #define KUE_RXFILT_PROMISC 0x0001 112 1.1 augustss #define KUE_RXFILT_ALLMULTI 0x0002 113 1.1 augustss #define KUE_RXFILT_UNICAST 0x0004 114 1.1 augustss #define KUE_RXFILT_BROADCAST 0x0008 115 1.1 augustss #define KUE_RXFILT_MULTICAST 0x0010 116 1.1 augustss 117 1.1 augustss #define KUE_CTL_READ 0x01 118 1.1 augustss #define KUE_CTL_WRITE 0x02 119 1.11 augustss 120 1.11 augustss #define KUE_WARM_REV 0x0202 121