Chinaunix首页 | 论坛 | 博客

Go

  • 博客访问: 226511
  • 博文数量: 67
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 783
  • 用 户 组: 普通用户
  • 注册时间: 2013-10-12 16:29
文章分类

全部博文(67)

文章存档

2015年(1)

2014年(47)

2013年(19)

我的朋友

分类: LINUX

2014-08-28 12:22:22

原创:kylin_zeng  http://blog.chinaunix.net/uid/23795897.html
转载请尊重别人的辛苦劳动,请标明出处。

一、出错打出来的oops。
 [kylin dbg]:gpio_direction_output..
[   22.677734] [kylin dbg]:gpio_set_value 
[   22.677758] Unable to handle kernel NULL pointer dereference at virtual address 00000040
[   22.677768] pgd = d407c000
[   22.677774] [00000040] *pgd=00000000
[   22.677784] Internal error: Oops: 5 [#1] PREEMPT
[   22.677796] CPU: 0    Tainted: P        WC   (3.0.8+ #17)
[   22.677819] PC is at __gpio_set_value+0x2c/0x68      //这句话是表示出错时运行的函数出错。
                                                                                        gpio_set_value(gpio->gpio_id, sensitive);出错了
[   22.677836] LR is at wifi_gpio_operate+0xa8/0xdc      // 重点就是这两句,这句话是lr,出错时运行的函数名称。
                                                                                    在这个函数里面:int wifi_gpio_operate(struct wifi_power *gpio, int flag)

可以定位到错误的位置,但是如果用__gpio_set_value定位的话,因为已经进入到了无数个字函数,所以比较难看出谁调用它的。所以用LR 先看它的上一个函数在哪里:
 LR is at wifi_gpio_operate+0xa8/0xdc   
1、
运行make menuconfig之后选中,kernel hacking->Kernel debugging->Compile the kernel with debug info
这样编译出来的vmlinux就带调试符号了。
2、vi System.map,找到 wifi_gpio_operate的位置: c0686790 T wifi_gpio_operate 
3、加上偏移量:c0686790+0xa8=C0686838
4、执行.
./prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-gdb  vmlinux
(gdb) b * 0xC0686838
Breakpoint 1 at 0xc0686838: file drivers/net/wireless/rtl8188EUS/os_dep/linux/wifi_power_ops.c, line 68.
5、vi drivers/net/wireless/rtl8188EUS/os_dep/linux/wifi_power_ops.c 
64          KYLIN_ZENG_DBG("gpio_direction_output..\n");
65         gpio_direction_output(gpio->gpio_id, sensitive);
66          KYLIN_ZENG_DBG("gpio_set_value \n");
67         gpio_set_value(gpio->gpio_id, sensitive);   //  在这个67行出错了。
68          KYLIN_ZENG_DBG("KYLIN: free \n");


 [   22.677846] pc : []    lr : []    psr: 80000013
[   22.677851] sp : d4113f00  ip : 60000013  fp : 60346c74
[   22.677858] r10: 00000000  r9 : d4112000  r8 : c0433b44
[   22.677866] r7 : 400f105d  r6 : 00000000  r5 : 00000022  r4 : 00000000
[   22.677875] r3 : 00000198  r2 : c0b75000  r1 : 00000000  r0 : 00000022
[   22.677885] Flags: Nzcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
[   22.677895] Control: 10c5387d  Table: 7407c019  DAC: 00000015
[   22.677902] 
[   22.677905] PC: 0xc05a6aa4:
[   22.677909] 6aa4  e30123b0 e1560002 1affff98 e3a00000 e28dd014 e8bd8ff0 c0b75000 c097475b
[   22.677924] 6ac4  c0968563 c09732be c09732cc c09732d3 c09674ee c09732db c097bec3 c098a605
[   22.677939] 6ae4  c09732e7 c09732eb c097fba6 c0963983 c09732ef e3510001 e92d4070 e1a06001
[   22.677954] 6b04  e1a05000 88bd8070 e3500f69 28bd8070 e3a0300c e59f2038 e0030093 e7924003
[   22.677969] 6b24  e5d43040 e3130001 0a000002 e59f0024 e3001671 ebfaa8a4 e5941034 e1a02006
[   22.677984] 6b44  e1a00004 e0611005 e1a0e00f e594f024 e8bd8070 c0b75000 c097330b e3500f69
[   22.677999] 6b64  e92d4070 e1a05000 23e00000 28bd8070 e3a0300c e59f2040 e0030593 e7924003
[   22.678014] 6b84  e5d43040 e3130001 0a000002 e59f002c e3001658 ebfaa88c e5943018 e3530000
[   22.678029] 
[   22.678032] LR: 0xc06867b8:
[   22.678036] 67b8  e3530001 1a000002 e5940004 e5d41008 ebf6e086 e3550001 e5d4500a 12655001
[   22.678051] 67d8  e5d43000 e3530002 1a000003 e5d40009 e6ef1075 ebffffba ea000014 e5d40009
[   22.678065] 67f8  e3a01000 ebfc82ec e3500000 0a000001 e59f0048 eb07cc8d e59f0044 eb07cc8b
[   22.678080] 6818  e5d40009 e1a01005 ebfc81c5 e59f0034 eb07cc86 e5d40009 e1a01005 ebfc80af
[   22.678095] 6838  e59f0024 eb07cc81 e5d40009 ebfc843a e59f0018 eb07cc7d e3a00000 e8bd8070
[   22.678110] 6858  c09aaaf4 c09aab18 c09aab40 c09aab60 c09aab80 e92d4010 e305040c e34c00a3
[   22.678125] 6878  e3a01000 ebffffc3 e3a00005 ebf755f9 ebffff94 e3a00000 e8bd8010 e92d4010
[   22.678140] 6898  e30a0bb0 e34c009a eb07cc68 ebfffff0 e8bd8010 e92d4010 e5903140 e3530000
[   22.678155] 
[   22.678158] SP: 0xd4113e80:
[   22.678162] 3e80  c0ad7ac8 60000013 d5afc94c 2020205b 362e3232 33373737 00205d34 00000005
[   22.678177] 3ea0  d4113ec8 ffffffff d4113eec 00000000 400f105d c04334ec 00000022 00000000
[   22.678191] 3ec0  c0b75000 00000198 00000000 00000022 00000000 400f105d c0433b44 d4112000
[   22.678205] 3ee0  00000000 60346c74 60000013 d4113f00 c0686838 c05a6b24 80000013 ffffffff
[   22.678220] 3f00  c0a3540c 00000000 d4113f44 c0686838 bf0f0140 00000000 d4113f44 c0686880
[   22.678235] 3f20  bf0f0140 c0686744 bf0f0140 c0675208 bf0f0140 c0675214 bf0f0140 c047fe5c
[   22.678249] 3f40  00000000 6e616c77 c046e800 65726854 352d6461 00000037 00000000 00000000
[   22.678264] 3f60  00000000 00000000 00000000 d4113f90 60346bd8 400f0561 000000a2 00433b44
[   22.678279] 
[   22.678282] R2: 0xc0b74f80:
[   22.678286] 4f80  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   22.678299] 4fa0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   22.678313] 4fc0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   22.678326] 4fe0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   22.678340] 5000  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   22.678353] 5020  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   22.678366] 5040  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   22.678380] 5060  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   22.678394] 
[   22.678397] R8: 0xc0433ac4:
[   22.678401] 3ac4  e31a0c01 1a000008 e3570f5e e24fef46 3798f107 e28d1008 e3a08000 e357080f
[   22.678416] 3ae4  e2270000 2a000da9 ea00deac e1a02007 e28d1008 e3a00000 eb00045f e28fe014
[   22.678431] 3b04  e1a07000 e28d1008 e3570f5e 3891000f 3798f107 eaffffef e5ad0008 e1a02007
[   22.678446] 3b24  e1a0100d e3a00001 eb000453 eaffffba e320f000 e320f000 e320f000 c0a130e4
[   22.678461] 3b44  c045cb78 c0454eb8 c043414c c04bd96c c04bd764 c04bb870 c04bb3e0 c046b5a4
[   22.678475] 3b64  c04bb888 c04c9f34 c04ca09c c043415c c04bc158 c046b5a4 c04ca474 c04bc060
[   22.678490] 3b84  c047c6e0 c046b5a4 c046b5a4 c04bc8f8 c045bd08 c04d9a18 c046b5a4 c047c678
[   22.678505] 3ba4  c047c438 c046b5a4 c045b044 c046b5a4 c046b5a4 c045cd0c c046b5a4 c046b5a4
[   22.678521] 
[   22.678523] R9: 0xd4111f80:
[   22.678527] 1f80  00000008 56efa5b0 ffffffff 00000000 000000fc c0433b44 d4110000 00000000
[   22.678542] 1fa0  60846c74 c04339c0 56efa5b0 ffffffff 000000a4 60846b00 00000010 ffffffff
[   22.678556] 1fc0  56efa5b0 ffffffff 00000000 000000fc 00000000 00000014 56efa5c4 60846c74
[   22.678571] 1fe0  400d2ff0 60846ab8 400ce795 40041298 20000010 000000a4 00000000 00000000
[   22.678585] 2000  00000000 00000002 00000000 d4118800 c0a1c194 00000000 00000015 d4118800
[   22.678599] 2020  d4112000 c0a1b700 d49ab000 000001c0 d4ae9380 d4ae9b00 d4113e44 d4113e10
[   22.678614] 2040  c087a054 00000000 00000000 00000000 00000000 00000000 01010000 00000000
[   22.678628] 2060  60346f00 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   22.678644] Process Thread-57 (pid: 293, stack limit = 0xd41122f0)
[   22.678653] Stack: (0xd4113f00 to 0xd4114000)
[   22.678665] 3f00: c0a3540c 00000000 d4113f44 c0686838 bf0f0140 00000000 d4113f44 c0686880
[   22.678679] 3f20: bf0f0140 c0686744 bf0f0140 c0675208 bf0f0140 c0675214 bf0f0140 c047fe5c
[   22.678693] 3f40: 00000000 6e616c77 c046e800 65726854 352d6461 00000037 00000000 00000000
[   22.678706] 3f60: 00000000 00000000 00000000 d4113f90 60346bd8 400f0561 000000a2 00433b44
[   22.678720] 3f80: bf0f0140 00000880 d4113f8c 00000000 00000000 ffffffff 400f105d 0000000a
[   22.678733] 3fa0: 00000081 c04339c0 ffffffff 400f105d 400f105d 00000880 00000000 0bebc200
[   22.678747] 3fc0: ffffffff 400f105d 0000000a 00000081 40083a4c 57f91fb0 56ece018 60346c74
[   22.678761] 3fe0: 400f2f40 60346bc8 400ee49b 400411c4 20000010 400f105d 756fe821 756fec21
[   22.678786] [] (__gpio_set_value+0x2c/0x68) from [] (wifi_gpio_operate+0xa8/0xdc)
[   22.678804] [] (wifi_gpio_operate+0xa8/0xdc) from [] (wifi_turn_off_card+0x14/0x28)
[   22.678821] [] (wifi_turn_off_card+0x14/0x28) from [] (wifi_deactivate_usb+0x8/0x18)
[   22.678842] [] (wifi_deactivate_usb+0x8/0x18) from [] (mv88w8686_if_sdio_exit_module+0x38/0x3c)
[   22.678860] [] (mv88w8686_if_sdio_exit_module+0x38/0x3c) from [] (rockchip_wifi_exit_module+0x8/0xc)
[   22.678884] [] (rockchip_wifi_exit_module+0x8/0xc) from [] (sys_delete_module+0x1e8/0x25c)
[   22.678906] [] (sys_delete_module+0x1e8/0x25c) from [] (ret_fast_syscall+0x0/0x30)
[   22.678921] Code: e3a0300c e59f2038 e0030093 e7924003 (e5d43040) 

二、
//函数在下面
int wifi_gpio_operate(struct wifi_power *gpio, int flag)
{
    KYLIN_ZENG_DBG("KYLIN: wifi_gpio_operate...\n");
int sensitive;

if (gpio->use_gpio == POWER_NOT_USE_GPIO)
return 0;

if (gpio->gpio_iomux == POWER_GPIO_IOMUX)
{
OS_IOMUX(gpio->iomux_name, gpio->iomux_value);
}

if (flag == GPIO_SWITCH_ON)
sensitive = gpio->sensi_level;
else
sensitive = 1 - gpio->sensi_level;

if (gpio->use_gpio == POWER_USE_EXT_GPIO)
{
wifi_extgpio_operation(gpio->gpio_id, sensitive);
}
else
{
int ret;


ret = gpio_request(gpio->gpio_id, NULL);
if (ret != 0)  //gpio5_D6
printk("Request GPIO for WIFI POWER error!\n");


KYLIN_ZENG_DBG("gpio_direction_output..\n");
gpio_direction_output(gpio->gpio_id, sensitive);
KYLIN_ZENG_DBG("gpio_set_value \n");
gpio_set_value(gpio->gpio_id, sensitive);
KYLIN_ZENG_DBG("KYLIN: free \n");


gpio_free(gpio->gpio_id);
}


    KYLIN_ZENG_DBG("KYLIN: wifi_gpio_operate end \n");
return 0;
}



阅读(823) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~