# Problem with Xircom PCMCIA Ethernet card



## satsuma (Feb 12, 2009)

Hi,

I have the base system of FreeBSD 7.1. installed, but can't get the Xircom PCMCIA Ethernet card to work. I googled quite a lot of messages from several mailing list and groups, but none of them had a direct answer to this question. Some said that it worked on 6.* and discontinued to work in 7.0, some said that a patch from Oct 2007 would fix this (should it be in the main?) Some of the posts I found were from back 2002, so this problem is not new, but there still seems to be some mysterious things with it.

At first, my system would not even boot if the card was connected. I added


```
if_xe_load="YES"
```

in loader.conf in order to load the xe driver. This seemed to fix the problem at least in some parts, since I was able to boot the system with the Ethernet card connected. The card did not work, though. I tried the same thing with the dc driver, with the same results.

At this point the ifconfig command showed interfaces lo0 and plip0. The complete command output is attached to this message. Also the output of the dmesg -s command is attached.


After booting to another OS to use the net and then booting back to FreeBSD, the system crashed again if the card was connected. I have no idea why this is. The results seem to different if I only remove the cable, but leave the card inside, because in some cases the system only hangs at boot time, while on some cases it gives a fatal trap and makes a reboot.

The card is Xircom Realport CardBus Ethernet 10/100+modem 56 RBEM56G-100.

According to the documentation at least some the similar Xircom cards should be supported.

All help is appreciated in solving this problem. Thanks.


----------



## olivas (Apr 18, 2009)

I too have hit a problem with using a Xircom card with FreeBSD 7.x (in this case 7.2-PRERELEASE).

It looks as if cardbus has changed and no longer supports the card.

For now, here is what I get when I boot FreeBSD with the card in (or remove and re-insert it):

```
cardbus0: Unable to allocate resource to read CIS.
cardbus0: Unable to allocate resources for CIS
dc0: <Xircom X3201 10/100BaseTX> port 0x1100-0x117f mem 0x88000000-0x880007ff,0x88001000-0x880017ff irq 11 at device 0.0 on cardbus0
dc0: No station address in CIS!
device_attach: dc0 attach returned 6
```

This card worked in FreeBSD 6.2-STABLE without any issues.


----------



## richardpl (Apr 19, 2009)

Perhaps you will get better response on freebsd-stable mailing list.


----------



## git (May 9, 2009)

I had the same problem on Sony Vaio (P3-500), FreeBSD 7.2 RELEASE.  If you look around enough, you'll find that there's a patch for cardbus_cis.c for this problem (see attached).

http://www.freebsd.org/cgi/query-pr.cgi?pr=115623

*Please note that this patch didn't work for me until I disabled "PNP Aware OS" in the BIOS.* YMMV!

The short version of what has to be done (hopefully I didn't forget anything).

sysinstall -> Configure -> Distributions -> src -> All (or you can waste your time trying to figure out which sub-components will be required by trial and error).

If you use a USB key to copy over the patch you might have luck connecting it with this.


```
mkdir /mnt/usb
mount_msdosfs /dev/da0s1 /mnt/usb
```

Extract the patch


```
gunzip /mnt/usb/patch.diary.gz
```

Apply the patch


```
cd /usr/src/sys/dev/cardbus
patch < /mnt/usb/patch.diary
```

If you want to speed things up a bit, add the following line to /etc/make.conf


```
MODULES_OVERRIDE = cardbus
```

Build and install the kernel


```
cd /usr/src
make buildkernel
make installkernel
```

Reboot and you should be golden!  Again, it didn't work for me until I disabled "PNP aware OS" in the BIOS.

Here is a text copy of the patch in case the attachment doesn't work.


```
--- src/sys/dev/cardbus/cardbus_cis.c~	2007-06-08 00:03:57.000000000 -0400
+++ src/sys/dev/cardbus/cardbus_cis.c	2007-12-09 16:20:26.000000000 -0500
@@ -435,10 +435,11 @@
     struct resource *res)
 {
 	if (res != CIS_CONFIG_SPACE) {
-		bus_release_resource(child, SYS_RES_MEMORY, rid, res);
+		bus_release_resource(cbdev, SYS_RES_MEMORY, rid, res);
 		if (rid == PCIM_CIS_ASI_ROM)
 			pci_write_config(child, rid, pci_read_config(child,
 			    rid, 4) & ~PCIR_BIOS, 4);
+		PCI_DISABLE_IO(cbdev, child, SYS_RES_MEMORY);
 	}
 }

@@ -448,6 +449,8 @@
 {
 	struct resource *res;
 	uint32_t space;
+	uint32_t testval;
+	uint32_t size;

 	space = *start & PCIM_CIS_ASI_MASK;
 	switch (space) {
@@ -476,10 +479,13 @@
 		    space);
 		return (NULL);
 	}
+	pci_write_config(child, *rid, 0xffffffff, 4);
+	testval = pci_read_config(child, *rid, 4);
+	size = CARDBUS_MAPREG_MEM_SIZE(testval);

 	/* allocate the memory space to read CIS */
-	res = bus_alloc_resource(child, SYS_RES_MEMORY, rid, 0, ~0, 1,
-	    rman_make_alignment_flags(4096) | RF_ACTIVE);
+	res = bus_alloc_resource(cbdev, SYS_RES_MEMORY, rid, 0, ~0, size,
+	    rman_make_alignment_flags(size) | RF_ACTIVE);
 	if (res == NULL) {
 		device_printf(cbdev, "Unable to allocate resource "
 		    "to read CIS.\n");
@@ -488,6 +494,7 @@
 	if (*rid == PCIR_BIOS)
 		pci_write_config(child, *rid,
 		    rman_get_start(res) | PCIM_BIOS_ENABLE, 4);
+	PCI_ENABLE_IO(cbdev, child, SYS_RES_MEMORY);

 	/* Flip to the right ROM image if CIS is in ROM */
 	if (space == PCIM_CIS_ASI_ROM) {
```

NOTE: if you get an error applying the patch after a copy/paste of the above, it's probably because your browser added a space at the beginning of every line...


----------

