The minidriver program most likely requires hardware access, meaning it needs to read and write hardware registers. In order to access hardware registers, the startup library provides function calls to map and unmap physical memory.
When the minidriver handler is called with MDRIVER_STARTUP_INIT, you call:
uintptr_t startup_io_map(size, phys_addr); startup_io_unmap(paddr); void * startup_memory_map(size, phys_addr); startup_memory_unmap(paddr);
After the minidriver handler is called with MDRIVER_STARTUP_PREPARE, the above functions are no longer available and your driver must use:
uintptr_t callout_io_map(size, phys_addr); void * callout_memory_map(size, phys_addr);
At different times in the boot process, some calls may or may not be available. If your driver requires hardware access, it must do the following:
The minidriver should call one of the above functions and store the pointer in the minidriver data area or in a static variable, separate from the previously stored value (ptr2). Use the stored pointer, ptr1, to do all hardware access.