Subject: Re: kern/32032: axe/ukphy combo does not work on big-endian machines
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: Garrett D'Amore <garrett_damore@tadpole.com>
List: netbsd-bugs
Date: 11/09/2005 23:11:02
The following reply was made to PR kern/32032; it has been noted by GNATS.

From: "Garrett D'Amore" <garrett_damore@tadpole.com>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/32032: axe/ukphy combo does not work on big-endian machines
Date: Wed, 09 Nov 2005 15:10:50 -0800

 This is a multi-part message in MIME format.
 --------------010003080803010108000200
 Content-Type: text/plain; charset=ISO-8859-1; format=flowed
 Content-Transfer-Encoding: 7bit
 
 The attached patch fixes it:
 
 
 --------------010003080803010108000200
 Content-Type: text/plain;
  name="diff"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline;
  filename="diff"
 
 Index: sys/dev/usb/if_axe.c
 ===================================================================
 RCS file: /net/projects/meteor/cvs/netbsd/src/sys/dev/usb/if_axe.c,v
 retrieving revision 1.1.1.1
 diff -u -r1.1.1.1 if_axe.c
 --- sys/dev/usb/if_axe.c	9 Nov 2005 14:17:30 -0000	1.1.1.1
 +++ sys/dev/usb/if_axe.c	9 Nov 2005 23:10:26 -0000
 @@ -286,7 +286,7 @@
  	if (val)
  		sc->axe_phyaddrs[0] = phy;
  
 -	return (val);
 +	return (le16toh(val));
  }
  
  Static void
 @@ -298,6 +298,7 @@
  	if (sc->axe_dying)
  		return;
  
 +	val = htole32(val);
  	axe_lock_mii(sc);
  	axe_cmd(sc, AXE_CMD_MII_OPMODE_SW, 0, 0, NULL);
  	err = axe_cmd(sc, AXE_CMD_MII_WRITE_REG, reg, phy, (void *)&val);
 @@ -379,6 +380,7 @@
  	ifp = GET_IFP(sc);
  
  	axe_cmd(sc, AXE_CMD_RXCTL_READ, 0, 0, (void *)&rxmode);
 +	rxmode = le16toh(rxmode);
  
  	if (ifp->if_flags & IFF_ALLMULTI || ifp->if_flags & IFF_PROMISC) {
  	allmulti:
 @@ -1231,6 +1233,7 @@
  
  				axe_cmd(sc, AXE_CMD_RXCTL_READ,
  					0, 0, (void *)&rxmode);
 +				rxmode = le16toh(rxmode);
  				rxmode |= AXE_RXCMD_PROMISC;
  				axe_cmd(sc, AXE_CMD_RXCTL_WRITE,
  					0, rxmode, NULL);
 @@ -1241,6 +1244,7 @@
  			    sc->axe_if_flags & IFF_PROMISC) {
  				axe_cmd(sc, AXE_CMD_RXCTL_READ,
  					0, 0, (void *)&rxmode);
 +				rxmode = le16toh(rxmode);
  				rxmode &= ~AXE_RXCMD_PROMISC;
  				axe_cmd(sc, AXE_CMD_RXCTL_WRITE,
  					0, rxmode, NULL);
 
 --------------010003080803010108000200--