Add driver for ASIX AX88178a and AX88179 Ethernet interface.

Ported from OpenBSD.
This commit is contained in:
nonaka 2013-10-26 09:16:19 +00:00
parent 66743a6785
commit 87abaea977
16 changed files with 2043 additions and 17 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: mi,v 1.1441 2013/10/26 08:23:38 mbalmer Exp $
# $NetBSD: mi,v 1.1442 2013/10/26 09:16:19 nonaka Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@ -876,6 +876,7 @@
./usr/share/man/cat4/auvitek.0 man-sys-catman .cat
./usr/share/man/cat4/awi.0 man-sys-catman .cat
./usr/share/man/cat4/axe.0 man-sys-catman .cat
./usr/share/man/cat4/axen.0 man-sys-catman .cat
./usr/share/man/cat4/az.0 man-sys-catman .cat
./usr/share/man/cat4/azalia.0 man-sys-catman .cat
./usr/share/man/cat4/battery_pmu.0 man-sys-catman .cat
@ -3863,6 +3864,7 @@
./usr/share/man/html4/auvitek.html man-sys-htmlman html
./usr/share/man/html4/awi.html man-sys-htmlman html
./usr/share/man/html4/axe.html man-sys-htmlman html
./usr/share/man/html4/axen.html man-sys-htmlman html
./usr/share/man/html4/az.html man-sys-htmlman html
./usr/share/man/html4/azalia.html man-sys-htmlman html
./usr/share/man/html4/battery_pmu.html man-sys-htmlman html
@ -6614,6 +6616,7 @@
./usr/share/man/man4/auvitek.4 man-sys-man .man
./usr/share/man/man4/awi.4 man-sys-man .man
./usr/share/man/man4/axe.4 man-sys-man .man
./usr/share/man/man4/axen.4 man-sys-man .man
./usr/share/man/man4/az.4 man-sys-man .man
./usr/share/man/man4/azalia.4 man-sys-man .man
./usr/share/man/man4/battery_pmu.4 man-sys-man .man

View File

@ -1,4 +1,4 @@
# $NetBSD: mi,v 1.52 2013/08/11 22:29:03 joerg Exp $
# $NetBSD: mi,v 1.53 2013/10/26 09:16:19 nonaka Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@ -78,6 +78,8 @@
./@MODULEDIR@/hfs/hfs.kmod base-kernel-modules kmod
./@MODULEDIR@/if_axe base-kernel-modules kmod
./@MODULEDIR@/if_axe/if_axe.kmod base-kernel-modules kmod
./@MODULEDIR@/if_axen base-kernel-modules kmod
./@MODULEDIR@/if_axen/if_axen.kmod base-kernel-modules kmod
./@MODULEDIR@/if_npflog base-kernel-modules kmod
./@MODULEDIR@/if_npflog/if_npflog.kmod base-kernel-modules kmod
./@MODULEDIR@/iic base-kernel-modules kmod

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.605 2013/10/24 21:55:00 mbalmer Exp $
# $NetBSD: Makefile,v 1.606 2013/10/26 09:16:19 nonaka Exp $
# @(#)Makefile 8.1 (Berkeley) 6/18/93
MAN= aac.4 ac97.4 acardide.4 aceride.4 acphy.4 \
@ -70,9 +70,9 @@ MAN= aac.4 ac97.4 acardide.4 aceride.4 acphy.4 \
zero.4 zstty.4 zyd.4
# USB devices
MAN+= atu.4 aubtfwl.4 aue.4 axe.4 cdce.4 cue.4 ehci.4 kue.4 ohci.4 slhci.4 \
stuirda.4 u3g.4 uatp.4 uaudio.4 uberry.4 ubsa.4 ubt.4 uchcom.4 ucom.4 \
ucycom.4 udav.4 udsbr.4 uftdi.4 ugen.4 ugensa.4 uhci.4 uhid.4 \
MAN+= atu.4 aubtfwl.4 aue.4 axe.4 axen.4 cdce.4 cue.4 ehci.4 kue.4 ohci.4 \
slhci.4 stuirda.4 u3g.4 uatp.4 uaudio.4 uberry.4 ubsa.4 ubt.4 uchcom.4 \
ucom.4 ucycom.4 udav.4 udsbr.4 uftdi.4 ugen.4 ugensa.4 uhci.4 uhid.4 \
uhidev.4 uhmodem.4 uhso.4 uipaq.4 uirda.4 ukbd.4 ukyopon.4 ulpt.4 \
umass.4 umct.4 umidi.4 umodem.4 ums.4 upgt.4 upl.4 uplcom.4 \
urio.4 url.4 urndis.4 urtw.4 urtwn.4 \

95
share/man/man4/axen.4 Normal file
View File

@ -0,0 +1,95 @@
.\" $NetBSD: axen.4,v 1.1 2013/10/26 09:16:19 nonaka Exp $
.\" $OpenBSD: axen.4,v 1.2 2013/10/07 07:18:36 jmc Exp $
.\"
.\" Copyright (c) 2013 Yojiro UO <yuo@nui.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: October 26 2013 $
.Dt AXEN 4
.Os
.Sh NAME
.Nm axen
.Nd ASIX Electronics AX88178a/AX88179 10/100/Gigabit USB Ethernet device
.Sh SYNOPSIS
.Cd "axen* at uhub? port ?"
.Cd "rgephy* at mii?"
.Sh DESCRIPTION
The
.Nm
driver provides support for USB Ethernet adapters based on the ASIX
Electronics AX88178a and AX88779 USB 2.0 chipsets
(potentially the AX88779 supports USB 3.0, but there is currently no xhci support in
.Nx ) ,
including the following:
.Pp
.Bl -tag -width Ds -offset indent -compact
.It Kurotoshiko GbE-USB3.0
.It Logitec LAN-GTJU3
.It Shanghai Donya DN-84327
.El
.Pp
The
.Nm
driver supports the following media types:
.Bl -tag -width "autoselect"
.It autoselect
Enable autoselection of the media type and options (this is the default).
The user can manually override the autoselected mode by adding media
options to the appropriate
.Xr ifconfig.if 5
file.
.It 10baseT
Set 10Mbps operation.
.It 100baseTX
Set 100Mbps (Fast Ethernet) operation.
.It 1000baseT
Set 1000Mbps (Gigabit Ethernet) operation.
.El
.Pp
For more information on configuring this device, see
.Xr ifconfig 8 .
.Sh DIAGNOSTICS
.Bl -diag
.It "axen%d: watchdog timeout"
A packet was queued for transmission and a transmit command was
issued, however the device failed to acknowledge the transmission
before a timeout expired.
.El
.Sh SEE ALSO
.Xr arp 4 ,
.Xr mii 4 ,
.Xr netintro 4 ,
.Xr rgephy 4 ,
.Xr usb 4 ,
.Xr ifconfig.if 5 ,
.Xr ifconfig 8
.Sh HISTORY
The
.Nm
device driver first appeared in
.Ox 5.4 ,
and in
.Nx 7.0 .
.Sh AUTHORS
.An -nosplit
The
.Nm
driver was written by
.An Yojiro UO Aq Mt yuo@nui.org
for
.Ox
and ported to
.Nx
by
.An NONAKA Kimihiro Aq Mt nonaka@NetBSD.org .

View File

@ -1,6 +1,6 @@
.\" $OpenBSD: rgephy.4,v 1.3 2004/09/30 19:59:25 mickey Exp $
.\"
.\" $NetBSD: rgephy.4,v 1.1 2006/03/25 17:38:34 xtraeme Exp $
.\" $NetBSD: rgephy.4,v 1.2 2013/10/26 09:16:19 nonaka Exp $
.\"
.\" Copyright (c) 2004 Peter Valchev <pvalchev@openbsd.org>
.\"
@ -30,6 +30,7 @@ The
driver supports the internal PHY found on Realtek 8169S/8110S
Ethernet adapters.
.Sh SEE ALSO
.Xr axen 4 ,
.Xr ifmedia 4 ,
.Xr intro 4 ,
.Xr mii 4 ,

View File

@ -1,4 +1,4 @@
.\" $NetBSD: usb.4,v 1.101 2013/05/28 12:24:24 kiyohara Exp $
.\" $NetBSD: usb.4,v 1.102 2013/10/26 09:16:19 nonaka Exp $
.\"
.\" Copyright (c) 1999-2012 The NetBSD Foundation, Inc.
.\" All rights reserved.
@ -127,6 +127,8 @@ Mass Storage Devices, e.g., external disk drives
ADMtek AN986/ADM8511 Pegasus family 10/100 USB Ethernet device
.It Xr axe 4
ASIX Electronics AX88172/AX88178/AX88772 10/100/Gigabit USB Ethernet device
.It Xr axen 4
ASIX Electronics AX88178a/AX88179 10/100/Gigabit USB Ethernet device
.It Xr cdce 4
USB Communication Device Class Ethernet device
.It Xr cue 4

View File

@ -1,4 +1,4 @@
# $NetBSD: GENERIC,v 1.380 2013/10/23 17:22:49 matt Exp $
# $NetBSD: GENERIC,v 1.381 2013/10/26 09:16:20 nonaka Exp $
#
# GENERIC machine description file
#
@ -22,7 +22,7 @@ include "arch/amd64/conf/std.amd64"
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
#ident "GENERIC-$Revision: 1.380 $"
#ident "GENERIC-$Revision: 1.381 $"
maxusers 64 # estimated number of users
@ -915,6 +915,7 @@ cir* at irmce?
# USB Ethernet adapters
aue* at uhub? port ? # ADMtek AN986 Pegasus based adapters
axe* at uhub? port ? # ASIX AX88172 based adapters
axen* at uhub? port ? # ASIX AX88178a/AX88179 based adapters
cdce* at uhub? port ? # CDC, Ethernet Networking Control Model
cue* at uhub? port ? # CATC USB-EL1201A based adapters
kue* at uhub? port ? # Kawasaki LSI KL5KUSB101B based adapters

View File

@ -1,4 +1,4 @@
# $NetBSD: ALL,v 1.363 2013/09/14 00:42:21 jakllsch Exp $
# $NetBSD: ALL,v 1.364 2013/10/26 09:16:20 nonaka Exp $
# From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
#
# ALL machine description file
@ -17,7 +17,7 @@ include "arch/i386/conf/std.i386"
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
#ident "ALL-$Revision: 1.363 $"
#ident "ALL-$Revision: 1.364 $"
maxusers 64 # estimated number of users
@ -1293,6 +1293,7 @@ cir* at irmce?
# USB Ethernet adapters
aue* at uhub? port ? # ADMtek AN986 Pegasus based adapters
axe* at uhub? port ? # ASIX AX88172 based adapters
axen* at uhub? port ? # ASIX AX88178a/AX88179 based adapters
cdce* at uhub? port ? # CDC, Ethernet Networking Control Model
cue* at uhub? port ? # CATC USB-EL1201A based adapters
kue* at uhub? port ? # Kawasaki LSI KL5KUSB101B based adapters

View File

@ -1,4 +1,4 @@
# $NetBSD: GENERIC,v 1.1097 2013/10/23 17:26:08 matt Exp $
# $NetBSD: GENERIC,v 1.1098 2013/10/26 09:16:20 nonaka Exp $
#
# GENERIC machine description file
#
@ -22,7 +22,7 @@ include "arch/i386/conf/std.i386"
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
#ident "GENERIC-$Revision: 1.1097 $"
#ident "GENERIC-$Revision: 1.1098 $"
maxusers 64 # estimated number of users
@ -1233,6 +1233,7 @@ cir* at irmce?
# USB Ethernet adapters
aue* at uhub? port ? # ADMtek AN986 Pegasus based adapters
axe* at uhub? port ? # ASIX AX88172 based adapters
axen* at uhub? port ? # ASIX AX88178a/AX88179 based adapters
cdce* at uhub? port ? # CDC, Ethernet Networking Control Model
cue* at uhub? port ? # CATC USB-EL1201A based adapters
kue* at uhub? port ? # Kawasaki LSI KL5KUSB101B based adapters

View File

@ -1,4 +1,4 @@
# $NetBSD: files.usb,v 1.129 2013/05/28 12:03:26 kiyohara Exp $
# $NetBSD: files.usb,v 1.130 2013/10/26 09:16:20 nonaka Exp $
#
# Config file and device description for machine-independent USB code.
# Included by ports that need it. Ports that use it must provide
@ -284,6 +284,11 @@ device axe: arp, ether, ifnet, mii, mii_phy
attach axe at usbdevif
file dev/usb/if_axe.c axe
# ASIX AX88178a and AX88179
device axen: arp, ether, ifnet, mii
attach axen at usbdevif
file dev/usb/if_axen.c axen
# DAVICOM DM9601
device udav: arp, ether, ifnet, mii, mii_phy
attach udav at usbdevif

1582
sys/dev/usb/if_axen.c Normal file

File diff suppressed because it is too large Load Diff

306
sys/dev/usb/if_axenreg.h Normal file
View File

@ -0,0 +1,306 @@
/* $NetBSD: if_axenreg.h,v 1.1 2013/10/26 09:16:20 nonaka Exp $ */
/* $OpenBSD: if_axenreg.h,v 1.1 2013/10/07 05:37:41 yuo Exp $ */
/*
* Copyright (c) 2013 Yojiro UO <yuo@openbsd.org>. All right reserved.
*
*/
/*
* Definitions for the ASIX Electronics AX88179 to ethernet controller.
*/
#define AXEN_PHY_ID 0x0003
#define AXEN_MCAST_FILTER_SIZE 8
/* unit: KB */
#define AXEN_BUFSZ_LS 8
#define AXEN_BUFSZ_HS 16
#define AXEN_BUFSZ_SS 24
#define AXEN_REV_UA1 0
#define AXEN_REV_UA2 1
/* recieve header */
/*
* +-multicast/broadcast
* | +-rx_ok
* | | ++-----L3_type (1:ipv4, 0/2:ipv6)
* pkt_len(13) | | ||+ ++-L4_type(0: icmp, 1: UDP, 4: TCP)
* |765|43210 76543210|7654 3210 7654 3210|
* |+-Drop_err |+-L4_err |+-L4_CSUM_ERR
* +--crc_err +--L3_err +--L3_CSUM_ERR
*
* ex) pkt_hdr 0x00680820
* drop_err, crc_err: none
* pkt_length = 104 byte
* 0x0820 = 0000 1000 0010 0000 => ipv4 icmp
*
* ex) pkt_hdr 0x004c8800
* drop_err, crc_err: none
* pkt_length = 76 byte
* 0x8800 = 1000 1000 0000 0000 => ipv6 mcast icmp
*
* [memo]
* 0x0820: ipv4 icmp 0000 1000 0010 0000
* 0x8820: ipv4 icmp (broadcast) 1000 1000 0010 0000
* 0x0824: ipv4 udp (nping) 0000 1000 0010 0100
* 0x0830: ipv4 tcp (ssh) 0000 1000 0011 0000
*
* 0x0800: ipv6 icmp 0000 1000 0000 0000
* 0x8800: ipv6 icmp (multicast) 1000 1000 0000 0000
* 0x8844: ipv6 UDP/MDNS mcast 1000 1000 0100 0100
* 0x0850: ipv6 tcp (ssh) 0000 1000 0101 0000
*/
#define AXEN_RXHDR_CRC_ERR (1 << 31)
#define AXEN_RXHDR_DROP_ERR (1 << 30)
#define AXEN_RXHDR_MCAST (1 << 15)
#define AXEN_RXHDR_RX_OK (1 << 11)
#define AXEN_RXHDR_L3_ERR (1 << 9)
#define AXEN_RXHDR_L4_ERR (1 << 8)
#define AXEN_RXHDR_L3CSUM_ERR (1 << 1)
#define AXEN_RXHDR_L4CSUM_ERR (1 << 0)
/* L4 packet type (3bit) */
#define AXEN_RXHDR_L4_TYPE_MASK 0x0000001c
#define AXEN_RXHDR_L4_TYPE_OFFSET 2
#define AXEN_RXHDR_L4_TYPE_ICMP 0x0
#define AXEN_RXHDR_L4_TYPE_UDP 0x1
#define AXEN_RXHDR_L4_TYPE_TCP 0x4
/* L3 packet type (2bit) */
#define AXEN_RXHDR_L3_TYPE_MASK 0x00000600
#define AXEN_RXHDR_L3_TYPE_OFFSET 5
#define AXEN_RXHDR_L3_TYPE_UNDEF 0x0
#define AXEN_RXHDR_L3_TYPE_IPV4 0x1
#define AXEN_RXHDR_L3_TYPE_IPV6 0x2
/*
* commands
*/
#define AXEN_CMD_LEN(x) (((x) & 0xF000) >> 12)
#define AXEN_CMD_DIR(x) (((x) & 0x0F00) >> 8)
#define AXEN_CMD_CMD(x) ((x) & 0x00FF)
/* ---MAC--- */
/* 1byte cmd */
#define AXEN_CMD_MAC_READ 0x1001
#define AXEN_CMD_MAC_WRITE 0x1101
#define AXEN_USB_UPLINK 0x02
#define AXEN_USB_FS 0x01
#define AXEN_USB_HS 0x02
#define AXEN_USB_SS 0x04
#define AXEN_GENERAL_STATUS 0x03
#define AXEN_GENERAL_STATUS_MASK 0x4
#define AXEN_REV0 0x0
#define AXEN_REV1 0x4
#define AXEN_UNK_05 0x05
#define AXEN_MAC_EEPROM_ADDR 0x07
#define AXEN_MAC_EEPROM_READ 0x08
#define AXEN_MAC_EEPROM_CMD 0x0a
#define AXEN_EEPROM_READ 0x04
#define AXEN_EEPROM_WRITE 0x08
#define AXEN_EEPROM_BUSY 0x10
#define AXEN_MONITOR_MODE 0x24
#define AXEN_MONITOR_NONE 0x00
#define AXEN_MONITOR_RWLC 0x02
#define AXEN_MONITOR_RWMP 0x04
#define AXEN_MONITOR_RWWF 0x08
#define AXEN_MONITOR_RW_FLAG 0x10
#define AXEN_MONITOR_PMEPOL 0x20
#define AXEN_MONITOR_PMETYPE 0x40
#define AXEN_UNK_28 0x28
#define AXEN_PHYCLK 0x33
#define AXEN_PHYCLK_BCS 0x01
#define AXEN_PHYCLK_ACS 0x02
#define AXEN_PHYCLK_ULR 0x08
#define AXEN_PHYCLK_ACSREQ 0x10
#define AXEN_RX_COE 0x34
#define AXEN_RXCOE_OFF 0x00
#define AXEN_RXCOE_IPv4 0x01
#define AXEN_RXCOE_TCPv4 0x02
#define AXEN_RXCOE_UDPv4 0x04
#define AXEN_RXCOE_ICMP 0x08
#define AXEN_RXCOE_IGMP 0x10
#define AXEN_RXCOE_TCPv6 0x20
#define AXEN_RXCOE_UDPv6 0x40
#define AXEN_RXCOE_ICMPv6 0x80
#define AXEN_TX_COE 0x35
#define AXEN_TXCOE_OFF 0x00
#define AXEN_TXCOE_IPv4 0x01
#define AXEN_TXCOE_TCPv4 0x02
#define AXEN_TXCOE_UDPv4 0x04
#define AXEN_TXCOE_ICMP 0x08
#define AXEN_TXCOE_IGMP 0x10
#define AXEN_TXCOE_TCPv6 0x20
#define AXEN_TXCOE_UDPv6 0x40
#define AXEN_TXCOE_ICMPv6 0x80
#define AXEN_PAUSE_HIGH_WATERMARK 0x54
#define AXEN_PAUSE_LOW_WATERMARK 0x55
/* 2byte cmd */
#define AXEN_CMD_MAC_READ2 0x2001
#define AXEN_CMD_MAC_WRITE2 0x2101
#define AXEN_MAC_RXCTL 0x0b
#define AXEN_RXCTL_STOP 0x0000
#define AXEN_RXCTL_PROMISC 0x0001
#define AXEN_RXCTL_ACPT_ALL_MCAST 0x0002
#define AXEN_RXCTL_HA8B 0x0004
#define AXEN_RXCTL_AUTOB 0x0008
#define AXEN_RXCTL_ACPT_BCAST 0x0010
#define AXEN_RXCTL_ACPT_PHY_MCAST 0x0020
#define AXEN_RXCTL_START 0x0080
#define AXEN_RXCTL_DROPCRCERR 0x0100
#define AXEN_RXCTL_IPE 0x0200
#define AXEN_RXCTL_TXPADCRC 0x0400
#define AXEN_MEDIUM_STATUS 0x22
#define AXEN_MEDIUM_NONE 0x0000
#define AXEN_MEDIUM_GIGA 0x0001
#define AXEN_MEDIUM_FDX 0x0002
#define AXEN_MEDIUM_ALWAYS_ONE 0x0004
#define AXEN_MEDIUM_EN_125MHZ 0x0008
#define AXEN_MEDIUM_RXFLOW_CTRL_EN 0x0010
#define AXEN_MEDIUM_TXFLOW_CTRL_EN 0x0020
#define AXEN_MEDIUM_RECV_EN 0x0100
#define AXEN_MEDIUM_PS 0x0200
#define AXEN_MEDIUM_JUMBO_EN 0x8040
#define AXEN_PHYPWR_RSTCTL 0x26
#define AXEN_PHYPWR_RSTCTL_BZ 0x0010
#define AXEN_PHYPWR_RSTCTL_IPRL 0x0020
#define AXEN_PHYPWR_RSTCTL_AUTODETACH 0x1000
#define AXEN_CMD_EEPROM_READ 0x2004
#define AXEN_EEPROM_STAT 0x43
/* 5byte cmd */
#define AXEN_CMD_MAC_SET_RXSR 0x5101
#define AXEN_RX_BULKIN_QCTRL 0x2e
/* 6byte cmd */
#define AXEN_CMD_MAC_READ_ETHER 0x6001
#define AXEN_CMD_MAC_NODE_ID 0x10
/* 8byte cmd */
#define AXEN_CMD_MAC_READ_FILTER 0x8001
#define AXEN_CMD_MAC_WRITE_FILTER 0x8101
#define AXEN_FILTER_MULTI 0x16
/* ---PHY--- */
/* 2byte cmd */
#define AXEN_CMD_MII_READ_REG 0x2002
#define AXEN_CMD_MII_WRITE_REG 0x2102
/* ========= */
#define AXEN_GPIO0_EN 0x01
#define AXEN_GPIO0 0x02
#define AXEN_GPIO1_EN 0x04
#define AXEN_GPIO1 0x08
#define AXEN_GPIO2_EN 0x10
#define AXEN_GPIO2 0x20
#define AXEN_GPIO_RELOAD_EEPROM 0x80
#define AXEN_TIMEOUT 1000
#define AXEN_RX_LIST_CNT 1
#define AXEN_TX_LIST_CNT 1
#define AXEN_CONFIG_NO 1
#define AXEN_IFACE_IDX 0
/*
* The interrupt endpoint is currently unused
* by the ASIX part.
*/
#define AXEN_ENDPT_RX 0x0
#define AXEN_ENDPT_TX 0x1
#define AXEN_ENDPT_INTR 0x2
#define AXEN_ENDPT_MAX 0x3
struct axen_type {
struct usb_devno axen_dev;
uint16_t axen_flags;
#define AX178A 0x0001 /* AX88178a */
#define AX179 0x0002 /* AX88179 */
};
struct axen_softc;
struct axen_chain {
struct axen_softc *axen_sc;
struct usbd_xfer *axen_xfer;
uint8_t *axen_buf;
int axen_accum;
int axen_idx;
};
struct axen_cdata {
struct axen_chain axen_tx_chain[AXEN_TX_LIST_CNT];
struct axen_chain axen_rx_chain[AXEN_RX_LIST_CNT];
int axen_tx_prod;
int axen_tx_cons;
int axen_tx_cnt;
int axen_rx_prod;
};
struct axen_qctrl {
uint8_t ctrl;
uint8_t timer_low;
uint8_t timer_high;
uint8_t bufsize;
uint8_t ifg;
} __packed;
struct axen_sframe_hdr {
uint32_t plen; /* packet length */
uint32_t gso;
} __packed;
struct axen_softc {
device_t axen_dev;
struct ethercom axen_ec;
struct mii_data axen_mii;
krndsource_t rnd_source;
usbd_device_handle axen_udev;
usbd_interface_handle axen_iface;
uint16_t axen_vendor;
uint16_t axen_product;
uint16_t axen_flags;
int axen_ed[AXEN_ENDPT_MAX];
struct usbd_pipe *axen_ep[AXEN_ENDPT_MAX];
int axen_if_flags;
struct axen_cdata axen_cdata;
struct callout axen_stat_ch;
int axen_refcnt;
bool axen_dying;
bool axen_attached;
struct usb_task axen_tick_task;
krwlock_t axen_mii_lock;
int axen_link;
uint8_t axen_ipgs[3];
int axen_phyno;
struct timeval axen_rx_notice;
u_int axen_bufsz;
int axen_rev;
#define sc_if axen_ec.ec_if
};
#define GET_MII(sc) (&(sc)->axen_mii)
#define GET_IFP(sc) (&(sc)->sc_if)
#define ETHER_ALIGN 2

View File

@ -1,4 +1,4 @@
# $NetBSD: usbdevices.config,v 1.22 2013/10/23 08:38:12 skrll Exp $
# $NetBSD: usbdevices.config,v 1.23 2013/10/26 09:16:20 nonaka Exp $
#
# This file contains all USB related configuration.
# It is suitable for inclusion in a kernel config(5) file.
@ -113,6 +113,7 @@ cir* at irmce?
# USB Ethernet adapters
aue* at uhub? port ? # ADMtek AN986 Pegasus based adapters
axe* at uhub? port ? # ASIX AX88172 based adapters
axen* at uhub? port ? # ASIX AX88178a/AX88179 based adapters
cdce* at uhub? port ? # CDC, Ethernet Networking Control Model
cue* at uhub? port ? # CATC USB-EL1201A based adapters
kue* at uhub? port ? # Kawasaki LSI KL5KUSB101B based adapters

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.119 2013/03/12 20:49:22 christos Exp $
# $NetBSD: Makefile,v 1.120 2013/10/26 09:16:20 nonaka Exp $
.include <bsd.own.mk>
@ -32,6 +32,7 @@ SUBDIR+= gpioow
SUBDIR+= gpiosim
SUBDIR+= hfs
SUBDIR+= if_axe
SUBDIR+= if_axen
SUBDIR+= if_npflog
SUBDIR+= iic
SUBDIR+= kernfs

View File

@ -0,0 +1,15 @@
# $NetBSD: Makefile,v 1.1 2013/10/26 09:16:20 nonaka Exp $
.include "../Makefile.inc"
.PATH: ${S}/dev/usb
KMOD= if_axen
IOCONF= if_axen.ioconf
SRCS= if_axen.c
WARNS= 4
CPPFLAGS+= -DINET
.include <bsd.kmodule.mk>

View File

@ -0,0 +1,10 @@
# $NetBSD: if_axen.ioconf,v 1.1 2013/10/26 09:16:20 nonaka Exp $
ioconf axen
include "conf/files"
include "dev/usb/files.usb"
pseudo-root usbdevif*
axen* at usbdevif?