diff -r -N -c pcmcia-cs-3.1.17/modules/Makefile pcmcia-cs-3.1.17-ppc/modules/Makefile
*** pcmcia-cs-3.1.17/modules/Makefile	Mon Jun 12 14:29:21 2000
--- pcmcia-cs-3.1.17-ppc/modules/Makefile	Thu Jun 29 15:02:40 2000
***************
*** 12,18 ****
  # critical stuff.
  
  CFLAGS = -O2 -Wall -Wstrict-prototypes -pipe
! CPPFLAGS += $(PCDEBUG) -D__KERNEL__ -DMODULE
  
  CC += $(AFLAGS) $(KFLAGS)
  
--- 12,18 ----
  # critical stuff.
  
  CFLAGS = -O2 -Wall -Wstrict-prototypes -pipe
! CPPFLAGS += $(PCDEBUG) -D__KERNEL__ -DMODULE -DUSE_SPIN_LOCKS
  
  CC += $(AFLAGS) $(KFLAGS)
  
diff -r -N -c pcmcia-cs-3.1.17/wireless/wvlan_cs.c pcmcia-cs-3.1.17-ppc/wireless/wvlan_cs.c
*** pcmcia-cs-3.1.17/wireless/wvlan_cs.c	Mon Jun  5 16:00:42 2000
--- pcmcia-cs-3.1.17-ppc/wireless/wvlan_cs.c	Thu Jun 29 14:36:40 2000
***************
*** 4,9 ****
--- 4,15 ----
   *	by Andreas Neuhaus <andy@fasta.fh-dortmund.de>
   *	http://www.fasta.fh-dortmund.de/users/andy/wvlan/
   *
+  *      Byteorder patches for LinuxPPC v0.3
+  *      by Harald Roelle <harald@roelle.com>
+  *
+  *	Manual Update of LinuxPPC Patch 
+  *	by I-Jong Lin <ijonglin@hpl.hp.com>
+  *
   *	This driver is free software; you can redistribute and/or
   *	modify it under the terms of the GNU General Public License;
   *	either version 2 of the license, or (at your option) any
***************
*** 234,239 ****
--- 240,256 ----
  
  #include "wvlan_hcf.h"
  
+ 
+ #ifdef __powerpc__
+ #include <linux/byteorder/swab.h>
+ inline void SwapBytesBlock( void* ptr, int len)
+ {
+         int l = (len)/2;
+         while ( l--) swab16s( ((unsigned short*)ptr)++);
+ }
+ #endif
+ 
+ 
  /* #define PCMCIA_DEBUG 1	// For developer only :-) */
  
  // Undefine this if you want to ignore Tx timeouts
***************
*** 307,313 ****
--- 324,335 ----
  #define TX_TIMEOUT ((4000*HZ)/1000)
  
  // Ethernet-II snap header
+ #ifdef __powerpc__ // (roelle): store it already byte swapped for ppc, saves some cycles
+ static char snap_header[] = { 0x00, 0x00, 0xaa, 0xaa, 0x00, 0x03, 0xf8, 0x00 };
+ #else
  static char snap_header[] = { 0x00, 0x00, 0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8 };
+ #endif
+ 
  
  // Valid MTU values (HCF_MAX_MSG (2304) is the max hardware frame size)
  #define WVLAN_MIN_MTU 256
***************
*** 483,488 ****
--- 505,516 ----
  	if (rc)
  		return rc;
  	l = min(len, ltv.len*2);
+ 
+ #ifdef __powerpc__
+         SwapBytesBlock( ltv.mac_addr, l+1);  
+ 		// make sure odd length gets treated right
+ #endif
+ 
  	memcpy(mac, (char *)ltv.mac_addr, l);
  	return 0;
  }
***************
*** 536,541 ****
--- 564,573 ----
  	l = min(strlen(name), ltv.len*2);
  	ltv.id[0] = l;
  	memcpy((char *) &ltv.id[1], name, l);
+ #ifdef __powerpc__ // (roelle): no reswapping needed later, we did a memcopy before
+         SwapBytesBlock( &ltv.id[1], l+1); // make sure odd length gets treated right
+ #endif
+ 
  	rc = hcf_put_info(ifbp, (LTVP) &ltv);
  	DEBUG(DEBUG_NOISY, "%s: hcf_put_info(CFG_CNF_OWN_NAME:'%s') returned 0x%x\n", dev_info, name, rc);
  	return rc;
***************
*** 575,580 ****
--- 607,616 ----
  	l = min(strlen(name), ltv.len*2);
  	ltv.id[0] = l;
  	memcpy((char *) &ltv.id[1], name, l);
+ #ifdef __powerpc__ // (roelle): no reswapping needed later, we did a memcopy before
+         SwapBytesBlock( &ltv.id[1], l+1); // make sure odd length gets treated right
+ #endif
+ 
  	rc = hcf_put_info(ifbp, (LTVP) &ltv);
  	DEBUG(DEBUG_NOISY, "%s: hcf_put_info(CFG_CNF_OWN/DESIRED_SSID:'%s') returned 0x%x\n", dev_info, name, rc);
  	return rc;
***************
*** 600,605 ****
--- 636,644 ----
  	if (ltv.id[0])
  	{
  		l = min(len, ltv.id[0]);
+ #ifdef __powerpc__
+                 SwapBytesBlock( &ltv.id[1], l+1); // make sure odd length gets treated right
+ #endif
  		memcpy(name, (char *) &ltv.id[1], l);
  	}
  	else
***************
*** 621,626 ****
--- 660,668 ----
  	if (rc)
  		return rc;
  	l = min(len, ltv.len*2);
+ #ifdef __powerpc__
+         SwapBytesBlock( ltv.mac_addr, l+1); // make sure odd length gets treated right
+ #endif
  	memcpy(mac, (char *)ltv.mac_addr, l);
  	return 0;
  }
***************
*** 726,731 ****
--- 768,776 ----
  	rc = hcf_get_info(ifbp, (LTVP) &ltv);
  	brnum = ltv.id[0];
  	memcpy(brlist, (char *) &ltv.id[1], brnum);
+ #ifdef __powerpc__
+         SwapBytesBlock( &ltv.id[1], brnum+1); // make shure odd length gets treated right
+ #endif
  	DEBUG(DEBUG_NOISY, "%s: hcf_get_info(CFG_CHANNEL_LIST):0x%x returned 0x%x\n", dev_info, brnum, rc);
  	return rc ? 0 : brnum;
  }
***************
*** 937,944 ****
--- 982,993 ----
  		rc = wvlan_hw_setthreshold(&local->ifb, ap_density, CFG_CNF_SYSTEM_SCALE);
  	if (!rc)
  		rc = wvlan_hw_setthreshold(&local->ifb, medium_reservation, CFG_RTS_THRH);
+ #ifdef __powerpc__
+ 	printk(KERN_INFO "%s: LinuxPPC Kludge, fingers crossed - IJL\n", dev_info);
+ #else
  	if (!rc)
  		rc = wvlan_hw_setthreshold(&local->ifb, frag_threshold, CFG_FRAGMENTATION_THRH);
+ #endif
  	if (!rc)
  		rc = wvlan_hw_setthreshold(&local->ifb, transmit_rate, CFG_TX_RATE_CONTROL);
  
***************
*** 2071,2085 ****
  	// HCF-light doesn't support that.
  	if (p[13] + (p[12] << 8) > 1500)
  	{
  		hcf_put_data(&local->ifb, p, 12, 0);
  		len += sizeof(snap_header);
! 		snap_header[1] = (len-0x0e) & 0xff;
! 		snap_header[0] = (char)((len-0x0e) >> 8);
  		hcf_put_data(&local->ifb, snap_header, sizeof(snap_header), 0);
  		hcf_put_data(&local->ifb, p+12, len-12-sizeof(snap_header), 0);
  	}
  	else
  		hcf_put_data(&local->ifb, p, len, 0);
  
  	// Send packet
  	rc = hcf_send(&local->ifb, 0);
--- 2120,2155 ----
  	// HCF-light doesn't support that.
  	if (p[13] + (p[12] << 8) > 1500)
  	{
+ #ifdef __powerpc__
+                 SwapBytesBlock( p, len);
+ #endif
  		hcf_put_data(&local->ifb, p, 12, 0);
  		len += sizeof(snap_header);
! #ifdef __powerpc__
!                 snap_header[0] = (len-0x0e) & 0xff;
!                 snap_header[1] = (char)((len-0x0e) >> 8);
! #else
!                 snap_header[1] = (len-0x0e) & 0xff;
!                 snap_header[0] = (char)((len-0x0e) >> 8);
! #endif
  		hcf_put_data(&local->ifb, snap_header, sizeof(snap_header), 0);
  		hcf_put_data(&local->ifb, p+12, len-12-sizeof(snap_header), 0);
  	}
  	else
+ 	{
+ #ifdef __powerpc__
+                 SwapBytesBlock( p, len);
+ #endif
  		hcf_put_data(&local->ifb, p, len, 0);
+ 	}
+ 
+ #ifdef __powerpc__ 
+         // (roelle): I dont't know if the data is needed later, so to be safe, swap it back.
+         //
+         //           Andreas: Your opinion?
+         SwapBytesBlock( p, len);
+ #endif
+ 
  
  	// Send packet
  	rc = hcf_send(&local->ifb, 0);
***************
*** 2130,2139 ****
--- 2200,2217 ----
  	{
  		hcf_get_data(&local->ifb, 0, p, 12);
  		hcf_get_data(&local->ifb, 12+sizeof(snap_header), p+12, len-12-sizeof(snap_header));
+ #ifdef __powerpc__
+                 SwapBytesBlock( p, len-sizeof(snap_header));
+ #endif
  		skb_trim(skb, len-sizeof(snap_header));
  	}
  	else
+ 	{
  		hcf_get_data(&local->ifb, 0, p, len);
+ #ifdef __powerpc__
+                 SwapBytesBlock( p, len);
+ #endif
+ 	}
  
  	skb->dev = dev;
  	skb->protocol = eth_type_trans(skb, dev);
***************
*** 2177,2182 ****
--- 2255,2263 ----
  #if defined(HISTOGRAM)
  		// We can't be clever...
  		rc = hcf_get_data(&local->ifb, HFS_Q_INFO, stats, 2);
+ #ifdef __powerpc__
+                 SwapBytesBlock( stats, 2);
+ #endif
  		DEBUG(DEBUG_NOISY, "%s: hcf_get_data(HFS_Q_INFO) returned 0x%x\n", dev_info, rc);
  #else // Therefore WIRELESS_SPY only !!!
  		memset(&stats, 0, sizeof(stats));
***************
*** 2185,2190 ****
--- 2266,2275 ----
  			if (!memcmp(srcaddr, local->spy_address[i], MAC_ADDR_SIZE))
  			{
  				rc = hcf_get_data(&local->ifb, HFS_Q_INFO, stats, 2);
+ #ifdef __powerpc__
+                                 SwapBytesBlock( stats, 2);
+ #endif
+ 
  				break;
  			}
  #endif
