libbsd ofwbus activate resources issue

Sichen Zhao zsc19940506 at outlook.com
Sat Jul 1 14:05:52 UTC 2017


Hi,

When i mount device module such as ti_scm, usb via simplebus not nexus, i got an error:

*** LIBBSD MEDIA 1 TEST ***                                                     
nexus0: <RTEMS Nexus device>                                                    
ofwbus0: <Open Firmware Device Tree> on nexus0                                  
simplebus0: <Flattened device tree simple bus> on ofwbus0                       
simplebus1: <Flattened device tree simple bus> on simplebus0                    
simplebus2: <Flattened device tree simple bus> mem 0x210000-0x211fff on simpleb1
ti_scm0: <TI Control Module> mem 0-0x7ff on simplebus2                          
ti_scm0: could not allocate resources                                           
device_attach: ti_scm0 attach returned 6       


I use gdb to debug it:

(gdb) bt
#0  _bsd_kobj_error_method () at ../../freebsd/sys/kern/subr_kobj.c:97
#1  0x8002763c in BUS_ACTIVATE_RESOURCE (_r=0x804fddd0, _rid=<optimized out>, _type=3, _child=0x804fd7a0, _dev=0x804f8dd8) at ../../rtemsbsd/include/rtems/bsd/local/bus_if.h:339
#2  _bsd_bus_activate_resource (dev=dev at entry=0x804fd7a0, type=type at entry=3, rid=<optimized out>, r=r at entry=0x804fddd0) at ../../freebsd/sys/kern/subr_bus.c:4504
#3  0x800034f4 in ofwbus_alloc_resource (bus=0x804f7428, child=0x804fd7a0, type=3, rid=0x804019ac <am335x_prcm_spec+4>, start=9224063442842802440, end=1155530752, count=1155547135, flags=2) at ../../freebsd/sys/dev/ofw/ofwbus.c:229
#4  0x800274d4 in BUS_ALLOC_RESOURCE (_flags=<optimized out>, _count=1, _end=18446744073709551615, _start=0, _rid=0x804019ac <am335x_prcm_spec+4>, _type=<optimized out>, _child=<optimized out>, _dev=<optimized out>)
    at ../../rtemsbsd/include/rtems/bsd/local/bus_if.h:310
#5  _bsd_bus_alloc_resource (flags=<optimized out>, count=1, end=18446744073709551615, start=0, rid=0x804019ac <am335x_prcm_spec+4>, type=<optimized out>, dev=0x804fd7a0) at ../../freebsd/sys/kern/subr_bus.c:4473
#6  bus_alloc_resource_any (flags=<optimized out>, rid=0x804019ac <am335x_prcm_spec+4>, type=<optimized out>, dev=0x804fd7a0) at ../../freebsd/sys/sys/bus.h:544
#7  _bsd_bus_alloc_resources (dev=dev at entry=0x804fd7a0, rs=0x804f8dd8, rs at entry=0x804019a8 <am335x_prcm_spec>, res=res at entry=0x804fd908) at ../../freebsd/sys/kern/subr_bus.c:4435
#8  0x80001664 in am335x_prcm_attach (dev=0x804fd7a0) at ../../freebsd/sys/arm/ti/am335x/am335x_prcm.c:438
#9  0x80025730 in DEVICE_ATTACH (dev=0x804fd7a0) at ../../rtemsbsd/include/rtems/bsd/local/device_if.h:180
#10 _bsd_device_attach (dev=dev at entry=0x804fd7a0) at ../../freebsd/sys/kern/subr_bus.c:2947
#11 0x800265f8 in _bsd_device_probe_and_attach (dev=dev at entry=0x804fd7a0) at ../../freebsd/sys/kern/subr_bus.c:2903
#12 0x800268fc in _bsd_bus_generic_attach (dev=dev at entry=0x804f8dd8) at ../../freebsd/sys/kern/subr_bus.c:3714
#13 0x8000248c in simplebus_attach (dev=0x804f8dd8) at ../../freebsd/sys/dev/fdt/simplebus.c:164
#14 0x80025730 in DEVICE_ATTACH (dev=0x804f8dd8) at ../../rtemsbsd/include/rtems/bsd/local/device_if.h:180
#15 _bsd_device_attach (dev=dev at entry=0x804f8dd8) at ../../freebsd/sys/kern/subr_bus.c:2947
#16 0x800265f8 in _bsd_device_probe_and_attach (dev=dev at entry=0x804f8dd8) at ../../freebsd/sys/kern/subr_bus.c:2903
#17 0x800268fc in _bsd_bus_generic_attach (dev=dev at entry=0x804f84d0) at ../../freebsd/sys/kern/subr_bus.c:3714
#18 0x8000248c in simplebus_attach (dev=0x804f84d0) at ../../freebsd/sys/dev/fdt/simplebus.c:164
#19 0x80025730 in DEVICE_ATTACH (dev=0x804f84d0) at ../../rtemsbsd/include/rtems/bsd/local/device_if.h:180
#20 _bsd_device_attach (dev=dev at entry=0x804f84d0) at ../../freebsd/sys/kern/subr_bus.c:2947
#21 0x800265f8 in _bsd_device_probe_and_attach (dev=dev at entry=0x804f84d0) at ../../freebsd/sys/kern/subr_bus.c:2903
#22 0x800268fc in _bsd_bus_generic_attach (dev=dev at entry=0x804f7428) at ../../freebsd/sys/kern/subr_bus.c:3714
#23 0x80003634 in ofwbus_attach (dev=0x804f7428) at ../../freebsd/sys/dev/ofw/ofwbus.c:181
#24 0x80025730 in DEVICE_ATTACH (dev=0x804f7428) at ../../rtemsbsd/include/rtems/bsd/local/device_if.h:180
#25 _bsd_device_attach (dev=dev at entry=0x804f7428) at ../../freebsd/sys/kern/subr_bus.c:2947
#26 0x800265f8 in _bsd_device_probe_and_attach (dev=dev at entry=0x804f7428) at ../../freebsd/sys/kern/subr_bus.c:2903
#27 0x800268fc in _bsd_bus_generic_attach (dev=<optimized out>) at ../../freebsd/sys/kern/subr_bus.c:3714
#28 0x80025730 in DEVICE_ATTACH (dev=0x804f72b0) at ../../rtemsbsd/include/rtems/bsd/local/device_if.h:180
#29 _bsd_device_attach (dev=dev at entry=0x804f72b0) at ../../freebsd/sys/kern/subr_bus.c:2947
#30 0x800265f8 in _bsd_device_probe_and_attach (dev=dev at entry=0x804f72b0) at ../../freebsd/sys/kern/subr_bus.c:2903
#31 0x80026d0c in _bsd_bus_generic_new_pass (dev=0x804f3ce0) at ../../freebsd/sys/kern/subr_bus.c:4000
#32 0x800252b4 in BUS_NEW_PASS (_dev=0x804f3ce0) at ../../rtemsbsd/include/rtems/bsd/local/bus_if.h:938
#33 _bsd_bus_set_pass (pass=2147483647) at ../../freebsd/sys/kern/subr_bus.c:987
#34 0x800b8c08 in _bsd_mi_startup () at ../../freebsd/sys/kern/init_main.c:306
#35 0x80082568 in rtems_bsd_initialize () at ../../rtemsbsd/rtems/rtems-kernel-init.c:158
#36 0x800007c4 in Init (arg=<optimized out>) at ../../testsuite/include/rtems/bsd/test/default-network-init.h:271
#37 0x801899b0 in _Thread_Handler () at ../../../../../../rtems/c/src/../../cpukit/score/src/threadhandler.c:88
#38 0x80171258 in _Thread_Life_action_handler (executing=0x0, action=<optimized out>, lock_context=0x0) at ../../../../../../rtems/c/src/../../cpukit/score/src/threadrestart.c:379
#39 0x00000000 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) 


It seems error came from using a resource that should be activated. the ofwbus_activate_resource is not exist.
So whether someone has been successful in porting a driver that uses simplebus in libbsd and that uses a resource that should be activated.




Best Regards
Sichen Zhao


More information about the devel mailing list