if_kuereg.h revision 187125
198184Sgordon/*- 278344Sobrien * Copyright (c) 1997, 1998, 1999, 2000 3156813Sru * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved. 4156813Sru * 5168283Sdes * Redistribution and use in source and binary forms, with or without 6118224Smtm * modification, are permitted provided that the following conditions 7163083Sume * are met: 8162131Semax * 1. Redistributions of source code must retain the above copyright 9118224Smtm * notice, this list of conditions and the following disclaimer. 10179566Sbrooks * 2. Redistributions in binary form must reproduce the above copyright 11118224Smtm * notice, this list of conditions and the following disclaimer in the 12148760Spjd * documentation and/or other materials provided with the distribution. 13172080Smlaier * 3. All advertising materials mentioning features or use of this software 14149053Spjd * must display the following acknowledgement: 15151245Semax * This product includes software developed by Bill Paul. 16168546Spjd * 4. Neither the name of the author nor the names of any co-contributors 17163378Sceri * may be used to endorse or promote products derived from this software 18121749Sume * without specific prior written permission. 19179315Sbz * 20118224Smtm * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND 21156808Sdes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22171871Smtm * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23160975Sdes * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD 24158722Sflz * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25127897Sfjoe * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26142962Sbrooks * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27172983Smtm * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28118224Smtm * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29158687Sphk * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 30151842Syar * THE POSSIBILITY OF SUCH DAMAGE. 31118224Smtm * 32178023Semax * $FreeBSD: user/thompsa/usb/sys/dev/usb2/ethernet/if_kue2_reg.h 184610 2008-11-04 02:31:03Z alfred $ 33118224Smtm */ 34151245Semax 35172674Snetchild/* 36118224Smtm * Definitions for the KLSI KL5KUSB101B USB to ethernet controller. 37127345Sbrooks * The KLSI part is controlled via vendor control requests, the structure 38153430Siedowse * of which depend a bit on the firmware running on the internal 39137203Sphk * microcontroller. The one exception is the 'send scan data' command, 40147682Sbrooks * which is used to load the firmware. 41118224Smtm */ 42168410Spjd 43168410Spjd#define KUE_CMD_GET_ETHER_DESCRIPTOR 0x00 44150490Swollman#define KUE_CMD_SET_MCAST_FILTERS 0x01 45156813Sru#define KUE_CMD_SET_PKT_FILTER 0x02 46150490Swollman#define KUE_CMD_GET_ETHERSTATS 0x03 47150490Swollman#define KUE_CMD_GET_GPIO 0x04 48150490Swollman#define KUE_CMD_SET_GPIO 0x05 49158115Sume#define KUE_CMD_SET_MAC 0x06 50172377Sbushman#define KUE_CMD_GET_MAC 0x07 51158115Sume#define KUE_CMD_SET_URB_SIZE 0x08 52158115Sume#define KUE_CMD_SET_SOFS 0x09 5378344Sobrien#define KUE_CMD_SET_EVEN_PKTS 0x0A 5478344Sobrien#define KUE_CMD_SEND_SCAN 0xFF 5578344Sobrien 5678344Sobrienstruct kue_ether_desc { 57 uint8_t kue_len; 58 uint8_t kue_rsvd0; 59 uint8_t kue_rsvd1; 60 uint8_t kue_macaddr[ETHER_ADDR_LEN]; 61 uint8_t kue_etherstats[4]; 62 uint8_t kue_maxseg[2]; 63 uint8_t kue_mcastfilt[2]; 64 uint8_t kue_rsvd2; 65} __packed; 66 67#define KUE_ETHERSTATS(x) UGETDW((x)->sc_desc.kue_etherstats) 68#define KUE_MAXSEG(x) UGETW((x)->sc_desc.kue_maxseg) 69#define KUE_MCFILTCNT(x) (UGETW((x)->sc_desc.kue_mcastfilt) & 0x7FFF) 70#define KUE_MCFILT_MAX (USB_ETHER_HASH_MAX / ETHER_ADDR_LEN) 71 72#define KUE_STAT_TX_OK 0x00000001 73#define KUE_STAT_RX_OK 0x00000002 74#define KUE_STAT_TX_ERR 0x00000004 75#define KUE_STAT_RX_ERR 0x00000008 76#define KUE_STAT_RX_NOBUF 0x00000010 77#define KUE_STAT_TX_UCAST_BYTES 0x00000020 78#define KUE_STAT_TX_UCAST_FRAMES 0x00000040 79#define KUE_STAT_TX_MCAST_BYTES 0x00000080 80#define KUE_STAT_TX_MCAST_FRAMES 0x00000100 81#define KUE_STAT_TX_BCAST_BYTES 0x00000200 82#define KUE_STAT_TX_BCAST_FRAMES 0x00000400 83#define KUE_STAT_RX_UCAST_BYTES 0x00000800 84#define KUE_STAT_RX_UCAST_FRAMES 0x00001000 85#define KUE_STAT_RX_MCAST_BYTES 0x00002000 86#define KUE_STAT_RX_MCAST_FRAMES 0x00004000 87#define KUE_STAT_RX_BCAST_BYTES 0x00008000 88#define KUE_STAT_RX_BCAST_FRAMES 0x00010000 89#define KUE_STAT_RX_CRCERR 0x00020000 90#define KUE_STAT_TX_QUEUE_LENGTH 0x00040000 91#define KUE_STAT_RX_ALIGNERR 0x00080000 92#define KUE_STAT_TX_SINGLECOLL 0x00100000 93#define KUE_STAT_TX_MULTICOLL 0x00200000 94#define KUE_STAT_TX_DEFERRED 0x00400000 95#define KUE_STAT_TX_MAXCOLLS 0x00800000 96#define KUE_STAT_RX_OVERRUN 0x01000000 97#define KUE_STAT_TX_UNDERRUN 0x02000000 98#define KUE_STAT_TX_SQE_ERR 0x04000000 99#define KUE_STAT_TX_CARRLOSS 0x08000000 100#define KUE_STAT_RX_LATECOLL 0x10000000 101 102#define KUE_RXFILT_PROMISC 0x0001 103#define KUE_RXFILT_ALLMULTI 0x0002 104#define KUE_RXFILT_UNICAST 0x0004 105#define KUE_RXFILT_BROADCAST 0x0008 106#define KUE_RXFILT_MULTICAST 0x0010 107 108#define KUE_TIMEOUT 1000 109#define KUE_MIN_FRAMELEN 60 110 111#define KUE_CTL_READ 0x01 112#define KUE_CTL_WRITE 0x02 113 114#define KUE_CONFIG_IDX 0 /* config number 1 */ 115#define KUE_IFACE_IDX 0 116 117/* The interrupt endpoint is currently unused by the KLSI part. */ 118#define KUE_ENDPT_MAX 4 119 120struct kue_softc { 121 void *sc_evilhack; /* XXX this pointer must be first */ 122 123 struct usb2_config_td sc_config_td; 124 struct usb2_callout sc_watchdog; 125 struct mtx sc_mtx; 126 struct kue_ether_desc sc_desc; 127 128 struct ifnet *sc_ifp; 129 device_t sc_dev; 130 struct usb2_device *sc_udev; 131 struct usb2_xfer *sc_xfer[KUE_ENDPT_MAX]; 132 133 uint32_t sc_unit; 134 135 uint16_t sc_mcfilt_max; 136 uint16_t sc_flags; 137#define KUE_FLAG_READ_STALL 0x0010 /* wait for clearing of stall */ 138#define KUE_FLAG_WRITE_STALL 0x0020 /* wait for clearing of stall */ 139#define KUE_FLAG_LL_READY 0x0040 /* Lower Layer Ready */ 140#define KUE_FLAG_HL_READY 0x0080 /* Higher Layer Ready */ 141#define KUE_FLAG_INTR_STALL 0x0100 /* wait for clearing of stall */ 142}; 143