This one really has me stumped...
I'm trying to trace through some of the kernel code to understand why I can't access eMMC.
I put a dump_stack() call at the top of the function sdhci_add_host() (in drivers/mmc/host/sdhci.c kernel=3.11.4).
When I boot up, I get a stack trace that looks something like this...
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.11.4 #22
Backtrace:
[<80011ddc>] (dump_backtrace+0x0/0x10c) from [<80011f78>] (show_stack+0x18/0x1c)
r6:bfba82c0 r5:bfba82c0 r4:00000000 r3:00000000
[<80011f60>] (show_stack+0x0/0x1c) from [<80548398>] (dump_stack+0x80/0x9c)
[<80548318>] (dump_stack+0x0/0x9c) from [<8040d388>] (sdhci_add_host+0x24/0xbb4)
r4:bfb21d10 r3:00000000
[<8040d364>] (sdhci_add_host+0x0/0xbb4) from [<8040ef4c>] (sdhci_esdhc_imx_probe+0x28c/0x560)
[<8040ecc0>] (sdhci_esdhc_imx_probe+0x0/0x560) from [<802f8740>] (platform_drv_probe+0x20/0x24)
r8:80705e38 r7:80756c38 r6:00000000 r5:bf981e10 r4:807b2178
[<802f8720>] (platform_drv_probe+0x0/0x24) from [<802f739c>] (driver_probe_device+0x10c/0x224)
[<802f7290>] (driver_probe_device+0x0/0x224) from [<802f7548>] (__driver_attach+0x94/0x98)
r7:00000000 r6:bf981e44 r5:80756c38 r4:bf981e10
[<802f74b4>] (__driver_attach+0x0/0x98) from [<802f58a8>] (bus_for_each_dev+0x5c/0x90)
r6:802f74b4 r5:80756c38 r4:00000000 r3:bf83c85c
[<802f584c>] (bus_for_each_dev+0x0/0x90) from [<802f6e90>] (driver_attach+0x20/0x28)
r6:80746068 r5:bfb21c80 r4:80756c38
[<802f6e70>] (driver_attach+0x0/0x28) from [<802f6a08>] (bus_add_driver+0xdc/0x238)
[<802f692c>] (bus_add_driver+0x0/0x238) from [<802f7a6c>] (driver_register+0x80/0x154)
r8:80705e38 r7:806e746c r6:80762800 r5:00000006 r4:80756c38
[<802f79ec>] (driver_register+0x0/0x154) from [<802f8964>] (__platform_driver_register+0x50/0x64)
[<802f8914>] (__platform_driver_register+0x0/0x64) from [<80705e50>] (sdhci_esdhc_imx_driver_init+0x18/0x20)
[<80705e38>] (sdhci_esdhc_imx_driver_init+0x0/0x20) from [<80008798>] (do_one_initcall+0xf4/0x154)
[<800086a4>] (do_one_initcall+0x0/0x154) from [<806e7c24>] (kernel_init_freeable+0x104/0x1d0)
[<806e7b20>] (kernel_init_freeable+0x0/0x1d0) from [<805441f8>] (kernel_init+0x10/0xec)
[<805441e8>] (kernel_init+0x0/0xec) from [<8000e8b8>] (ret_from_fork+0x14/0x3c)
r4:00000000 r3:ffffffff
Referring to the stack trace, I see that the function sdhci_esdhc_imx_driver_init is called, so I tried to look at that code in the kernel...
Its not there; yet it does show up in the System.map (and several other .o) files. Then I thought maybe my browser wasn't showing
me the function, so I did a brute force find/grep on the whole tree...
First I did it on the tree that I had built and it showed me that the function name was in several .o files and also in the System.map file...
find . -type f -exec grep -l sdhci_esdhc_imx_driver_init {} \;
./drivers/built-in.o
./drivers/mmc/host/built-in.o
./drivers/mmc/host/sdhci-esdhc-imx.o
./drivers/mmc/built-in.o
./System.map
./.tmp_vmlinux1
./.tmp_System.map
./vmlinux.o
./.tmp_vmlinux2
./vmlinux
then I did it on a clean source tree and it came back empty.
Whats up with that? How can the function exist symbolically but not be in the source code somewhere?
Ed
Solved! Go to Solution.
Hi, Sutter
The sdhci_esdhc_imx_driver_init is wrapped in module_platform_driver(sdhci_esdhc_imx_driver); of drivers/mmc/host/sdhci-esdhc-imx.c, see below:
include/linux/platform_device.h:
208 #define module_platform_driver(__platform_driver) \
209 module_driver(__platform_driver, platform_driver_register, \
210 platform_driver_unregister)
include/linux/device.h:
1138 #define module_driver(__driver, __register, __unregister, ...) \
1139 static int __init __driver##_init(void) \
1140 { \
1141 return __register(&(__driver) , ##__VA_ARGS__); \
1142 } \
1143 module_init(__driver##_init); \
Hi, Sutter
The sdhci_esdhc_imx_driver_init is wrapped in module_platform_driver(sdhci_esdhc_imx_driver); of drivers/mmc/host/sdhci-esdhc-imx.c, see below:
include/linux/platform_device.h:
208 #define module_platform_driver(__platform_driver) \
209 module_driver(__platform_driver, platform_driver_register, \
210 platform_driver_unregister)
include/linux/device.h:
1138 #define module_driver(__driver, __register, __unregister, ...) \
1139 static int __init __driver##_init(void) \
1140 { \
1141 return __register(&(__driver) , ##__VA_ARGS__); \
1142 } \
1143 module_init(__driver##_init); \
Ok, i see.
Thanks!