BusEnum2 and a Minor Bug Fix
- by Kate Moss' Open Space
The default root bus driver, BusEnum, enumerate and active drivers one by one in synchronized manner. It is not only slowing the boot time but in the even if any of driver's init function (XXX_init) get hanged, the whole system won't boot at all.
There is a sample of enhanced root bus driver, BusEnum2, on the http://msdn.microsoft.com/en-us/library/dd187254.aspx
The page provides the sample code and the detail explanation of the design concept.
With multi-threaded BusEnum2 on CE7 with SMP enabled system, the scalability is even more significant. Since you have more than one processor and it can load drivers in parallel!
Everything looks good so far, except to there is a small bug in the sample code.
Fortunately, it is easy to fix. But hard to trace if you ever enc outer it!
The BUSENUM2 flag only defined in BUSENUM2\BUSDEF\sources but not in BUSENUM2\BUSENUM\sources.
The DeviceFolder is implemented in BUSENUM2\BUSDEF but the instance is created in BUSENUM2\BUSENUM\busenum.cpp, so the result is it allocates less memory than actual need.
Add
CDEFINES=$(CDEFINES) -DBUSENUM2
into BUSENUM2\BUSENUM\sources and the problem fixed!