# PCIExpress to CF adapter cannot be recognized

## davidshen84

Hi,

I have a PCI-Express to CF adapter which works well in Windows 7. And my gentoo works well with a PCI-Express to SD adapter, so I think my kernel is configured correctly to work with PCI-Express card.

But when I plug in the CF adapter, nothing happens, nothing in dmesg, nothing in /var/log/message. If I plug in the adapter before boot, I see below message:

```
kernel: [   22.766698] ata1.00: configured for UDMA/133

kernel: [   22.766702] ata1: EH complete
```

But I won't see it if I plug in after the system is boot. I tried to enable pci hotplug support, but does not seem to resolve the issue. Since my CF card is the only UDMA/133 device I can think of that my system have, I think this message refers to my CF card.

----------

## Aquous

Does it work when you boot the Gentoo Live DVD?

----------

## davidshen84

Sorry, I do not have a Gentoo live DVD. Actually I know the adapter will not work in Ubuntu 10.10, but it works in Ubuntu 9.04. I even logged a bug in Ubuntu, and they said a drive is missing, and it seems they do not want to fix it  :Sad: 

----------

## Aquous

That's... odd. Got a linky to that Ubuntu bug?

----------

## davidshen84

Here's the link: http://goo.gl/fgcMk

I found my old Gentoo 10.x amd64 Live DVD, here's what I found:

1. the card cannot be recognized after the system boot;

2. the card can be recognized if plugged in before system boot, and it is even been recognized before my hdd.

here's the /var/log/message snippet:

```

ata1: PATA max UDMA/100 cmd 0x7020 ctl 0x7014 bmdma 0x7000 irq 19

ata2: PATA max UDMA/100 cmd 0x7018 ctl 0x7010 bmdma 0x7008 irq 19

ata1.00: CFA: [b]TRANSCEND[/b], 20080820, max UDMA/66

ata1.00: 15662304 sectors, multi 0: LBA 

ata1.00: limited to UDMA/33 due to 40-wire cable

ata1.00: configured for UDMA/33

scsi 0:0:0:0: Direct-Access     ATA      TRANSCEND        2008 PQ: 0 ANSI: 5

sd 0:0:0:0: [sda] 15662304 512-byte hardware sectors: (8.01 GB/7.46 GiB)

sd 0:0:0:0: [sda] Write Protect is off

sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00

sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA

sda: sda1

sd 0:0:0:0: [sda] Attached SCSI disk

```

Now my question is what module/drive do I need to recognize this device? How to enable hot plug-in?

----------

## Aquous

Some quick googling turned up this - http://misterd77.blogspot.com/2007/12/how-to-scan-scsi-bus-with-26-kernel.html - does that help?

----------

## pigeon768

What's the output from 'lspci -v'?

----------

## roarinelk

enable the "pata_pcmcia" driver.  and post the lspci output with the adapter plugged in.

----------

## davidshen84

I do not have Fiber Channel compiled in my kernel, so I cannot see that device file. Is a CF card a Fiber Channel SCSI device?

I pasted my lspci -vvv output at http://pastebin.com/Qarf25Ua, please take a look. There's a couple devices claiming using the 'pcieport' kernel module, but I do not think they refer to my CF card or the adapter. The only thing that looks suspicious is the one on the line 624 in the pastbin.

```

05:00.0 IDE interface: JMicron Technology Corp. JMB368 IDE controller (prog-if 85 [Master SecO PriO])

        Subsystem: JMicron Technology Corp. JMB368 IDE controller

```

I googled the 'JMicron' company, they produce SATA and PCI-E related chips/devices. Many be this is my adapter?

----------

## roarinelk

well, seems easy enough:  enable the "pata_jmicron" (JMicron PATA support  in kernel config)  ATA driver.

Although you also have a cardbus bridge, so enable "pata_pcmcia" ("PCMCIA PATA support") as well, just

to be safe.

CF cards are standard IDE devices; the first SSDs so to speak :)

----------

## davidshen84

Yes, enable pata_jmicron the problem. The device works if I plug it in before the system boot. But this only solve half of the problem. The device still does not support hot plug-in. I read this post http://rackerhacker.com/2009/04/23/re-scan-the-scsi-bus-in-linux-after-hot-swapping-a-drive/. It helps me re-scan the SCSI device, but the block device will not be recognized. Re-scanning give below message:

```
[ 1233.310482] ata9: soft resetting link

[ 1233.461204] ata9: EH complete

[ 1245.758246] ata8: soft resetting link

[ 1245.909109] ata8: EH complete

```

And strangely, there are two on them...

----------

## davidshen84

I also tried the rescan-scsi-bus.sh script, but does not work. It seems the scsi part works fine. It is just that the CF card cannot be recognized after re-scan...

----------

## roarinelk

post a full .config and dmesg (boot without the adapter, then insert it and post the dmesg) please.  I suspect for express card you need to enable some pci hotplug drivers/features.

----------

## davidshen84

Thanks roarinelk, PCI-E hot plug module is the key. Actually I have tried PCI hot plug earlier, but I did not notice there's another module called 'pciehp'...Thanks to all you guys  :Smile: 

----------

