Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to Support Wavlan and Airport

1 view
Skip to first unread message

Lin, I-Jong

unread,
Jun 29, 2000, 3:00:00 AM6/29/00
to
Okey-dokey, guys n' gals,

I've created a patch for PCMCIA-CS package 3.1.17 (available at
sourceforge.net) so that it supports the Wavelan card in LinuxPPC. Since
the Wavelan card is the commerical version of the airport card, the airport
card (in theory) should also be supported. I've included the patch in a
e-mail attachment and in plain text below.

So the directions are as follows:

1. Download the PCMCIA-CS 3.1.17 package from sourceforge.net
2. Uncompress the tar-ball
3. Apply the patch
4. Follow the directions for installation of PCMCIA 3.1.17
5. Edit the /etc/pcmica/configs.opt file

make sure the system resource lines, say:

include port 0x100-0x4ff, port 0x1000-0x17ff
include memory 0x80000000-0x80ffffff


for my airport wireless LAN, I need to put in this line,
substituting the ??? with the network name that you set
w/ the Airport 1.1 Software:

module "wvlan_cs" opts "port_type=1 network_name=???"

6. Start the PCMCIA daemon

As usual, I make no guarentees 'bout any unintended
consequences, loss of life, limb, pecuniary interest, etc., etc.
But it works on my Powerbook G3 (Lombard) with a Gold Wavelan
card with an Airport Base Station as ethernet bridge and dial-out
server.

Finally, many thanks to Harald Roelle for the previous patch
and Jean Tourrilhes for general consultation.

I hope you have a happy wireless network now.

I-Jong

P.S. Mr. Harald Roelle, could you put this patch on a web site and let
people know where to get it?
P.P.S. I don't know if this patch fixes the problems with Airport 1.2,
because I think I fixed some sort of problem with the firmware update.

-------------Patch Below----------------------
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 <an...@fasta.fh-dortmund.de>
* http://www.fasta.fh-dortmund.de/users/andy/wvlan/
*
+ * Byteorder patches for LinuxPPC v0.3
+ * by Harald Roelle <har...@roelle.com>
+ *
+ * Manual Update of LinuxPPC Patch
+ * by I-Jong Lin <ijon...@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

pcmcia-cs-3.1.17-for-ppc.patch

Benjamin Herrenschmidt

unread,
Jun 30, 2000, 3:00:00 AM6/30/00
to

On Thu, Jun 29, 2000, Lin, I-Jong <ijon...@exch.hpl.hp.com> wrote:

>
>I've created a patch for PCMCIA-CS package 3.1.17 (available at
>sourceforge.net) so that it supports the Wavelan card in LinuxPPC. Since
>the Wavelan card is the commerical version of the airport card, the airport
>card (in theory) should also be supported. I've included the patch in a
>e-mail attachment and in plain text below.

Unfortunately, the airport card is not plugged in a real PCMCIA bridge,
but in a custom port provided by Apple ASIC. So in order to work, it
requires some messing with various ASIC undocumented registers that
control some PCMCIA-like signals to enable power, clock, etc... to the card.

I'm currently messing with those. Unfortunately, I don't have any PCMCIA
documentation (it's expensive), so if someone here could give me a quick
explanation on how card type and voltage probe works on PCMCIA, this
would help me figure out how I should (manually) manipulate those ASIC
GPIO bits.

Ben.


** Sent via the linuxppc-user mail list. See http://lists.linuxppc.org/


C. Michael McCallum

unread,
Jun 30, 2000, 3:00:00 AM6/30/00
to

* Benjamin Herrenschmidt (bh...@calva.net) [000630 03:53]:

>
> On Thu, Jun 29, 2000, Lin, I-Jong <ijon...@exch.hpl.hp.com> wrote:
>
> >
> >I've created a patch for PCMCIA-CS package 3.1.17 (available at
> >sourceforge.net) so that it supports the Wavelan card in LinuxPPC. Since
> >the Wavelan card is the commerical version of the airport card, the airport
> >card (in theory) should also be supported. I've included the patch in a
> >e-mail attachment and in plain text below.
>
> Unfortunately, the airport card is not plugged in a real PCMCIA bridge,
> but in a custom port provided by Apple ASIC. So in order to work, it
> requires some messing with various ASIC undocumented registers that
> control some PCMCIA-like signals to enable power, clock, etc... to the card.
>

Ben, this is true for *all* PBs or just the Pismo (2000)? I was about to
try this, but I won't bother if it works for say, Wallstreets and Lombards.
I still have a Wallstreet, and a Wavelan card for it, but I don't think
my wife would appreciate me putting linux back on it....

What I am gathering from this discussion is that it worked for I-Jong
because he has a Lombard, and the (external) PCMCIA bus is different than
the AirPort internal bus in a Pismo.

Cheers,

Mike

--
C. Michael McCallum | Better living through thermodynamics
Associate Professor |
Chemistry, UOP | (209) 946-2393 | fax (209) 946-2607
mmcc...@uop.edu | http://onsager.cop.uop.edu/mccallum

0 new messages