On Fri, Dec 16, 2011 at 4:57 PM, Mark Kettenis
<[email protected]> wrote:>> Date: Thu, 15 Dec 2011 22:21:19
-0500>> From: Brian Callahan <[email protected]>>>>> B B B On my
Lenovo ThinkPad Edge E420, when inserting an SD card into its>>
built-in card slot, I am presented with a random number of the>>
following five error messages:>> sdmmc0: can't supply bus power>>
sdmmc0: can't enable card>> sdmmc0: can't set mem RCA>> sdmmc0: can't
identify card>> sdmmc0: no functions>> Does the following diff work?>>
Index: sdhc_pci.c>
===================================================================>
RCS file: /cvs/src/sys/dev/pci/sdhc_pci.c,v> retrieving revision 1.11>
diff -u -p -r1.11 sdhc_pci.c> --- sdhc_pci.c B 31 Jul 2011 16:55:01
-0000 B B B 1.11> +++ sdhc_pci.c B 16 Dec 2011 21:53:12 -0000> @@ -98,11
+98,42 @@ sdhc_pci_attach(struct device *parent, s>> B B B B /* Some
RICOH controllers lack a capability register. */> B B B B if
(PCI_VENDOR(pa->pa_id) == PCI_VENDOR_RICOH &&> -
PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_RICOH_R5U823)> +
PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_RICOH_R5U823) {> +
reg = pci_conf_read(pa->pa_pc, pa->pa_tag, 0xf8);> + B B B B B B B reg
&= ~0x0000ff00;> + B B B B B B B reg |= 0x0000fc00;> +
pci_conf_write(pa->pa_pc, pa->pa_tag, 0xf8, reg);> +> +
reg = pci_conf_read(pa->pa_pc, pa->pa_tag, 0x150);> +
reg &= ~0x000000ff;> + B B B B B B B reg |= 0x00000010;> +
B pci_conf_write(pa->pa_pc, pa->pa_tag, 0x150, reg);> +> +
B reg = pci_conf_read(pa->pa_pc, pa->pa_tag, 0xf8);> +
reg &= ~0x0000ff00;> + B B B B B B B reg |= 0x00000000;> +
B pci_conf_write(pa->pa_pc, pa->pa_tag, 0xf8, reg);> +> +
reg = pci_conf_read(pa->pa_pc, pa->pa_tag, 0xfc);> +
reg &= ~0x000000ff;> + B B B B B B B reg |= 0x00000001;> +
B pci_conf_write(pa->pa_pc, pa->pa_tag, 0xfc, reg);> +> +
reg = pci_conf_read(pa->pa_pc, pa->pa_tag, 0xe0);> +
reg &= ~0x0000ff00;> + B B B B B B B reg |= 0x00003200;> +
B pci_conf_write(pa->pa_pc, pa->pa_tag, 0xe1, reg);> +> +
reg = pci_conf_read(pa->pa_pc, pa->pa_tag, 0xfc);> +
reg &= ~0x000000ff;> + B B B B B B B reg |= 0x00000000;> +
B pci_conf_write(pa->pa_pc, pa->pa_tag, 0xfc, reg);> +>
caps = (0x21 << SDHC_BASE_FREQ_SHIFT) |> B B B B B B B B B B B
B (0x21
<< SDHC_TIMEOUT_FREQ_SHIFT) |>
SDHC_TIMEOUT_FREQ_UNIT | SDHC_VOLTAGE_SUPP_3_3V |>
B B SDHC_DMA_SUPPORT;> + B B B }>> B B B B if (pci_intr_map(pa, &ih))
{>
B B B B B B B B printf(": can't map interrupt\n");
When I apply the diff and rebuild the kernel, I encounter the
following panic on boot (apologies if this wraps badly, I had to type
out the panic by hand):
sdhc0 at pci3 dev 0 function 0 "Ricoh 5U823 SD/MMC" rev 0x04panic:
kernel diagnostic assertion "(reg & 0x3) == 0" failed: file
"../../../../arch/amd64/pci/pci_machdep.c", line 298Stopped
at Debugger+0x5: leaveDebugger() at Debugger+0x5panic() at
panic+0xe4__assert() at __assert+0x21pci_conf_write() at
pci_conf_write+0xebsdhc_pci_attach() at
sdhc_pci_attach+0x2c0config_attach() at
config_attach+0x1d4pci_probe_device() at
pci_probe_device+0x462pci_enumerate_bus() at
pci_enumerate_bus+0xe9config_attach() at
config_attach+0x1d4ppbattach() at ppbattach+0x32fend trace frame:
0xffffffff80e36bf0, count: 0RUN AT LEAST 'trace' AND 'ps' AND INCLUDE
OUTPUT WHEN REPORTING THIS PANIC!IF RUNNING SMP, USE 'mach ddbcpu <#>'
AND 'trace' ON OTHER PROCESSORS, TOO.DO NOT EVEN BOTHER REPORTING THIS
WITHOUT INCLUDING THAT INFORMATION!
ddb{0}> psB B PID B PPID B PGRP B B UID B S B B B FLAGS B WAIT
COMMAND* B B 0 B B -1 B B B 0 B B B 0 B 7 B B B 0x200
swapper
ddb{0}> traceDebugger() at Debugger+0x5panic() at panic+0xe4__assert()
at __assert+0x21pci_conf_write() at
pci_conf_write+0xebsdhc_pci_attach() at
sdhc_pci_attach+0x2c0config_attach() at
config_attach+0x1d4pci_probe_device() at
pci_probe_device+0x462pci_enumerate_bus() at
pci_enumerate_bus+0xe9config_attach() at
config_attach+0x1d4ppbattach() at ppbattach+0x32fconfig_attach() at
config_attach+0x1d4pci_probe_device() at
pci_probe_device+0x462pci_enumerate_bus() at
pci_enumerate_bus+0xe9config_attach() at
config_attach+0x1d4mainbus_attach() at
mainbus_attach+0x153config_attach() at
config_attach+0x1d4cpu_configure() at cpu_configure+0x17main() at
main+0x405end trace frame: 0x0, count -10
Trying to switch processors with 'mach ddbcpu' hangs the machine.