SD card not triggering PCI backend after boot

problem description:

When an SD card is inserted before/at boot time, everything works fine, meaning recognized by kernel and mounted to userspace.

When an SD card is inserted after boot time, the kernel doesn’t ‘see’ the hardware change, so udev is not triggered, so no block device /dev/mmcblk0{p1}, so nothing to mount.

This behavior is not openSuSE specific, when booting SystemRescueCD-2.0.1, the same behavior is noticed.

SD card inserted after booting:

linux-j60s:~ # hal-device | grep mmc
linux-j60s:~ #


linux-j60s:~ # lspci
00:00.0 Host bridge: Intel Corporation 2nd Generation Core Processor Family DRAM Controller (rev 09)
00:01.0 PCI bridge: Intel Corporation 2nd Generation Core Processor Family PCI Express Root Port (rev 09)
00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)
00:16.0 Communication controller: Intel Corporation 6 Series Chipset Family MEI Controller #1 (rev 04)
00:1a.0 USB Controller: Intel Corporation 6 Series Chipset Family USB Enhanced Host Controller #2 (rev 05)
00:1b.0 Audio device: Intel Corporation 6 Series Chipset Family High Definition Audio Controller (rev 05)
00:1c.0 PCI bridge: Intel Corporation 6 Series Chipset Family PCI Express Root Port 1 (rev b5)
00:1c.1 PCI bridge: Intel Corporation 6 Series Chipset Family PCI Express Root Port 2 (rev b5)
00:1c.3 PCI bridge: Intel Corporation 6 Series Chipset Family PCI Express Root Port 4 (rev b5)
00:1c.4 PCI bridge: Intel Corporation 6 Series Chipset Family PCI Express Root Port 5 (rev b5)
00:1c.5 PCI bridge: Intel Corporation 6 Series Chipset Family PCI Express Root Port 6 (rev b5)
00:1d.0 USB Controller: Intel Corporation 6 Series Chipset Family USB Enhanced Host Controller #1 (rev 05)
00:1f.0 ISA bridge: Intel Corporation HM67 Express Chipset Family LPC Controller (rev 05)
00:1f.2 SATA controller: Intel Corporation 6 Series Chipset Family 6 port SATA AHCI Controller (rev 05)
00:1f.3 SMBus: Intel Corporation 6 Series Chipset Family SMBus Controller (rev 05)
01:00.0 VGA compatible controller: nVidia Corporation Device 0dd6 (rev a1)
03:00.0 Network controller: Intel Corporation Centrino Wireless-N 1000
04:00.0 USB Controller: NEC Corporation uPD720200 USB 3.0 Host Controller (rev 04)
0a:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 06)


SD card inserted before booting:

linux-j60s:~ # hal-device | grep mmc
  block.device = '/dev/mmcblk0p1'  (string)
  linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:1c.4/0000:05:00.2/mmc_host/mmc0/mmc0:bc0a/block/mmcblk0/mmcblk0p1'  (string)
  linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:1c.4/0000:05:00.2/mmc_host/mmc0/mmc0:bc0a/block/mmcblk0'  (string)
  info.parent = '/org/freedesktop/Hal/devices/pci_197b_2391_mmc_host'  (string)
  block.device = '/dev/mmcblk0'  (string)
2: udi = '/org/freedesktop/Hal/devices/pci_197b_2391_mmc_host_mmc_card_rca48138'
  mmc.oem = 'Unknown (21316)'  (string)
  mmc.date = '10/2007'  (string)
  mmc.hwrev = 8  (0x8)  (int)
  mmc.fwrev = 0  (0x0)  (int)
  mmc.serial = 273449327  (0x104c816f)  (int)
  linux.subsystem = 'mmc'  (string)
  info.udi = '/org/freedesktop/Hal/devices/pci_197b_2391_mmc_host_mmc_card_rca48138'  (string)
  info.subsystem = 'mmc'  (string)
  linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:1c.4/0000:05:00.2/mmc_host/mmc0/mmc0:bc0a'  (string)
  info.parent = '/org/freedesktop/Hal/devices/pci_197b_2391_mmc_host'  (string)
  info.linux.driver = 'mmcblk'  (string)
  mmc.rca = 48138  (0xbc0a)  (int)
  mmc.cid = '035344534430314780104c816f007a00'  (string)
  mmc.csd = '002600325f5983c8befbcfff92404000'  (string)
  mmc.type = 'SD'  (string)
  mmc.scr = '0225000000000000'  (string)
  mmc.vendor = 'Unknown (3)'  (string)
43: udi = '/org/freedesktop/Hal/devices/pci_197b_2391_mmc_host'
  linux.subsystem = 'mmc_host'  (string)
  info.category = 'mmc_host'  (string)
  info.capabilities = { 'mmc_host' } (string list)
  info.subsystem = 'mmc_host'  (string)
  linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:1c.4/0000:05:00.2/mmc_host/mmc0'  (string)
  info.udi = '/org/freedesktop/Hal/devices/pci_197b_2391_mmc_host'  (string)
  mmc_host.host = 0  (0x0)  (int)
44: udi = '/org/freedesktop/Hal/devices/leds_mmc0'
  linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:1c.4/0000:05:00.2/leds/mmc0::'  (string)
  info.udi = '/org/freedesktop/Hal/devices/leds_mmc0'  (string)
  leds.device_name = 'mmc0'  (string)


linux-j60s:~ # lspci
00:00.0 Host bridge: Intel Corporation 2nd Generation Core Processor Family DRAM Controller (rev 09)
00:01.0 PCI bridge: Intel Corporation 2nd Generation Core Processor Family PCI Express Root Port (rev 09)
00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)
00:16.0 Communication controller: Intel Corporation 6 Series Chipset Family MEI Controller #1 (rev 04)
00:1a.0 USB Controller: Intel Corporation 6 Series Chipset Family USB Enhanced Host Controller #2 (rev 05)
00:1b.0 Audio device: Intel Corporation 6 Series Chipset Family High Definition Audio Controller (rev 05)
00:1c.0 PCI bridge: Intel Corporation 6 Series Chipset Family PCI Express Root Port 1 (rev b5)
00:1c.1 PCI bridge: Intel Corporation 6 Series Chipset Family PCI Express Root Port 2 (rev b5)
00:1c.3 PCI bridge: Intel Corporation 6 Series Chipset Family PCI Express Root Port 4 (rev b5)
00:1c.4 PCI bridge: Intel Corporation 6 Series Chipset Family PCI Express Root Port 5 (rev b5)
00:1c.5 PCI bridge: Intel Corporation 6 Series Chipset Family PCI Express Root Port 6 (rev b5)
00:1d.0 USB Controller: Intel Corporation 6 Series Chipset Family USB Enhanced Host Controller #1 (rev 05)
00:1f.0 ISA bridge: Intel Corporation HM67 Express Chipset Family LPC Controller (rev 05)
00:1f.2 SATA controller: Intel Corporation 6 Series Chipset Family 6 port SATA AHCI Controller (rev 05)
00:1f.3 SMBus: Intel Corporation 6 Series Chipset Family SMBus Controller (rev 05)
01:00.0 VGA compatible controller: nVidia Corporation Device 0dd6 (rev a1)
03:00.0 Network controller: Intel Corporation Centrino Wireless-N 1000
04:00.0 USB Controller: NEC Corporation uPD720200 USB 3.0 Host Controller (rev 04)
05:00.0 System peripheral: JMicron Technology Corp. SD/MMC Host Controller (rev 30)
05:00.2 SD Host controller: JMicron Technology Corp. Standard SD Host Controller (rev 30)
05:00.3 System peripheral: JMicron Technology Corp. MS Host Controller (rev 30)
05:00.4 System peripheral: JMicron Technology Corp. xD Host Controller (rev 30)
0a:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 06)


linux-j60s:~ # udevadm info -a -p $(udevadm info -q path -n /dev/mmcblk0p1)

Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device '/devices/pci0000:00/0000:00:1c.4/0000:05:00.2/mmc_host/mmc0/mmc0:bc0a/block/mmcblk0/mmcblk0p1':
    KERNEL=="mmcblk0p1"
    SUBSYSTEM=="block"
    DRIVER==""
    ATTR{partition}=="1"
    ATTR{start}=="249"
    ATTR{size}=="1983751"
    ATTR{alignment_offset}=="0"
    ATTR{discard_alignment}=="4294839808"
    ATTR{stat}=="     263      663     1969      204        0        0        0        0        0      204      204"
    ATTR{inflight}=="       0        0"

  looking at parent device '/devices/pci0000:00/0000:00:1c.4/0000:05:00.2/mmc_host/mmc0/mmc0:bc0a/block/mmcblk0':
    KERNELS=="mmcblk0"
    SUBSYSTEMS=="block"
    DRIVERS==""
    ATTRS{range}=="8"
    ATTRS{ext_range}=="8"
    ATTRS{removable}=="0"
    ATTRS{ro}=="0"
    ATTRS{size}=="1984000"
    ATTRS{alignment_offset}=="0"
    ATTRS{discard_alignment}=="0"
    ATTRS{capability}=="10"
    ATTRS{stat}=="     288      676     2273      229        0        0        0        0        0      229      229"
    ATTRS{inflight}=="       0        0"

  looking at parent device '/devices/pci0000:00/0000:00:1c.4/0000:05:00.2/mmc_host/mmc0/mmc0:bc0a':
    KERNELS=="mmc0:bc0a"
    SUBSYSTEMS=="mmc"
    DRIVERS=="mmcblk"
    ATTRS{cid}=="035344534430314780104c816f007a00"
    ATTRS{csd}=="002600325f5983c8befbcfff92404000"
    ATTRS{scr}=="0225000000000000"
    ATTRS{date}=="10/2007"
    ATTRS{erase_size}=="512"
    ATTRS{preferred_erase_size}=="4194304"
    ATTRS{fwrev}=="0x0"
    ATTRS{hwrev}=="0x8"
    ATTRS{manfid}=="0x000003"
    ATTRS{name}=="SD01G"
    ATTRS{oemid}=="0x5344"
    ATTRS{serial}=="0x104c816f"
    ATTRS{type}=="SD"

  looking at parent device '/devices/pci0000:00/0000:00:1c.4/0000:05:00.2/mmc_host/mmc0':
    KERNELS=="mmc0"
    SUBSYSTEMS=="mmc_host"
    DRIVERS==""

  looking at parent device '/devices/pci0000:00/0000:00:1c.4/0000:05:00.2':
    KERNELS=="0000:05:00.2"
    SUBSYSTEMS=="pci"
    DRIVERS=="sdhci-pci"
    ATTRS{vendor}=="0x197b"
    ATTRS{device}=="0x2391"
    ATTRS{subsystem_vendor}=="0x1028"
    ATTRS{subsystem_device}=="0x04b8"
    ATTRS{class}=="0x080501"
    ATTRS{irq}=="16"
    ATTRS{local_cpus}=="00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,0000000f"
    ATTRS{local_cpulist}=="0-3"
    ATTRS{modalias}=="pci:v0000197Bd00002391sv00001028sd000004B8bc08sc05i01"
    ATTRS{numa_node}=="-1"
    ATTRS{dma_mask_bits}=="32"
    ATTRS{consistent_dma_mask_bits}=="32"
    ATTRS{enable}=="1"
    ATTRS{broken_parity_status}=="0"
    ATTRS{msi_bus}==""
    ATTRS{microamps_requested_vmmc}=="0"

  looking at parent device '/devices/pci0000:00/0000:00:1c.4':
    KERNELS=="0000:00:1c.4"
    SUBSYSTEMS=="pci"
    DRIVERS==""
    ATTRS{vendor}=="0x8086"
    ATTRS{device}=="0x1c18"
    ATTRS{subsystem_vendor}=="0x1028"
    ATTRS{subsystem_device}=="0x04b8"
    ATTRS{class}=="0x060400"
    ATTRS{irq}=="16"
    ATTRS{local_cpus}=="00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,0000000f"
    ATTRS{local_cpulist}=="0-3"
    ATTRS{modalias}=="pci:v00008086d00001C18sv00001028sd000004B8bc06sc04i00"
    ATTRS{numa_node}=="-1"
    ATTRS{dma_mask_bits}=="32"
    ATTRS{consistent_dma_mask_bits}=="32"
    ATTRS{enable}=="1"
    ATTRS{broken_parity_status}=="0"
    ATTRS{msi_bus}=="1"

  looking at parent device '/devices/pci0000:00':
    KERNELS=="pci0000:00"
    SUBSYSTEMS==""
    DRIVERS==""


temporary resolving

running as root:

echo 1 > /sys/devices/pci0000\:00/0000\:00\:1c.4/rescan

dmesg output (from sysresccd-2.0.1):

Apr 21 23:25:07 sysresccd kernel:   268.769784] pci 0000:05:00.0: reg 10: [mem 0x00000000-0x000000ff]
Apr 21 23:25:07 sysresccd kernel:   268.769967] pci 0000:05:00.2: reg 10: [mem 0x00000000-0x000000ff]
Apr 21 23:25:07 sysresccd kernel:   268.770142] pci 0000:05:00.3: reg 10: [mem 0x00000000-0x000000ff]
Apr 21 23:25:07 sysresccd kernel:   268.770316] pci 0000:05:00.4: reg 10: [mem 0x00000000-0x000000ff]
Apr 21 23:25:07 sysresccd kernel:   268.772631] i915 0000:00:02.0: BAR 6: ??? 0x00000000 flags 0x2] has bogus alignment
Apr 21 23:25:07 sysresccd kernel:   268.772639] pci 0000:05:00.0: BAR 0: assigned [mem 0xf3100000-0xf31000ff]
Apr 21 23:25:07 sysresccd kernel:   268.772647] pci 0000:05:00.0: BAR 0: set to [mem 0xf3100000-0xf31000ff] (PCI address [0xf3100000-0xf31000ff]
Apr 21 23:25:07 sysresccd kernel:   268.772650] pci 0000:05:00.2: BAR 0: assigned [mem 0xf3100100-0xf31001ff]
Apr 21 23:25:07 sysresccd kernel:   268.772657] pci 0000:05:00.2: BAR 0: set to [mem 0xf3100100-0xf31001ff] (PCI address [0xf3100100-0xf31001ff]
Apr 21 23:25:07 sysresccd kernel:   268.772659] pci 0000:05:00.3: BAR 0: assigned [mem 0xf3100200-0xf31002ff]
Apr 21 23:25:07 sysresccd kernel:   268.772666] pci 0000:05:00.3: BAR 0: set to [mem 0xf3100200-0xf31002ff] (PCI address [0xf3100200-0xf31002ff]
Apr 21 23:25:07 sysresccd kernel:   268.772668] pci 0000:05:00.4: BAR 0: assigned [mem 0xf3100300-0xf31003ff]
Apr 21 23:25:07 sysresccd kernel:   268.772675] pci 0000:05:00.4: BAR 0: set to [mem 0xf3100300-0xf31003ff] (PCI address [0xf3100300-0xf31003ff]
Apr 21 23:25:11 sysresccd kernel:   272.961071] sdhci: Secure Digital Host Controller Interface driver
Apr 21 23:25:11 sysresccd kernel:   272.961074] sdhci: Copyright(c) Pierre Ossman
Apr 21 23:25:11 sysresccd kernel:   272.962462] sdhci-pci 0000:05:00.2: SDHCI controller found [197b:2391] (rev 30)
Apr 21 23:25:11 sysresccd kernel:   272.962487] sdhci-pci 0000:05:00.2: enabling device (0000 -> 0002)
Apr 21 23:25:11 sysresccd kernel:   272.962495] sdhci-pci 0000:05:00.2: PCI INT A -> GSI 16 (level, low) -> IRQ 16
Apr 21 23:25:11 sysresccd kernel:   272.962528] sdhci-pci 0000:05:00.2: setting latency timer to 64
Apr 21 23:25:11 sysresccd kernel:   272.962570] Registered led device: mmc0::
Apr 21 23:25:11 sysresccd kernel:   272.962614] mmc0: SDHCI controller on PCI [0000:05:00.2] using DMA
Apr 21 23:25:11 sysresccd kernel:   273.062390] mmc0: new SD card at address bc0a
Apr 21 23:25:11 sysresccd kernel:   273.065573] mmcblk0: mmc0:bc0a SD01G 968 MiB 
Apr 21 23:25:11 sysresccd kernel:   273.065667]  mmcblk0: p1


so total temporary solution (I have no kernel development experience):

su -

vi /usr/bin/rescanSDhost
#!/bin/sh
echo 1 > /sys/devices/pci0000\:00/0000\:00\:1c.4/rescan
:w

chmod 700 /usr/bin/rescanSDhost

crontab -e
* * * * * /usr/bin/rescanSDhost

/etc/init.d/cron restart


Has someone a ‘correct’ solution?

P.S. : I noticed an other forum thread from 2010, dealing with the same issue:
OpenSuse 11.3 / failure to mount sd memory card

What is reported by

dmesg|tail

Mine for reference, after inserting SD card from my camera:

 dmesg|tail
[23452.393407] scsi 7:0:0:0: Direct-Access     HP       USB20 HS-COMBO   4.82 PQ: 0 ANSI: 0
[23452.393781] sd 7:0:0:0: Attached scsi generic sg2 type 0
[23452.523363] sd 7:0:0:0: [sdb] 3842048 512-byte logical blocks: (1.96 GB/1.83 GiB)
[23452.527724] sd 7:0:0:0: [sdb] Write Protect is off
[23452.527732] sd 7:0:0:0: [sdb] Mode Sense: 23 00 00 00
[23452.527739] sd 7:0:0:0: [sdb] Assuming drive cache: write through
[23452.542426] sd 7:0:0:0: [sdb] Assuming drive cache: write through
[23452.542433]  sdb: sdb1
[23452.553706] sd 7:0:0:0: [sdb] Assuming drive cache: write through
[23452.553710] sd 7:0:0:0: [sdb] Attached SCSI removable disk

(BTW hal-device|grep mmc reports nothing).

This should show the device as well. (Mine was reported as /dev/sdb1).

sudo /sbin/fdisk -l

I’m using KDE4.6 and the device notifier handles the notification and/or mounting. (HAL is not involved now).

dmesg|tail

reports nothing unless I manually trigger the kernel to rescan the pci-bus with:

echo 1 > /sys/devices/pci0000\:00/0000\:00\:1c.4/rescan

When I’ve triggered (and only when I’ve triggered), dmesg output is as shown above and the device notifier handles the notification and/or mounting correctly.

System: Dell XPS 17 L702x | openSuSE 11.4 - GNOME | 2.6.37.1.1.2-desktop

Hmmm… I wonder if this might be due to your ACPI configuration. Do you have ‘acpi=off’, ‘acpi=noirq’, or similar in you grub kernel boot options? Maybe there are BIOS options concerning this device as well?

FWIW, an Ubuntu-based bug report concerning a JMicron device:

https://bugs.launchpad.net/ubuntu/+source/linux/+bug/703180

  • I have no special boot options defined.

  • I don’t think it is BIOS related, because I’ve tested it in Windows7, where it works as expected.

  • The Ubuntu-based bug report handles about exactly the same behaviour.

This is a bug affecting a small number of specific SD card reader devices. I would suggest you search for existing bug reports at

https://bugzilla.novell.com/index.cgi

and file a new bug report if applicable.

If it affects mainline kernels (not distro-specific), then also check out

https://bugzilla.kernel.org/