Use BUS_DMA_NOWAIT for loads at initialization time.
Report actual numeric error code if any problem occurs at the initialization.
Reported by: pho
I don't think this change fix anything. As I see, this code path is called without the lock held, so locking callback is pointless. What should be added instead is BUS_DMA_NOWAIT flag to the bus_dmamap_load() calls, since the code there really expects synchronous completion. Or it require some more complicated rework to make it asynchronous.
I am really surprised that sleep happened there. How it happened? Was ahci loaded as module long in run time on some really busy system, or how?
Soon there will be much harder requirements for the i386 use of busdma to be correct. Basically, PAE is going to be turned on by default (while bus_addr_t still kept at 32bit for drivers compatibility). I found it much more painful to widen bus_addr_t.