callout_io_map(), callout_io_map_indirect()


uintptr_t callout_io_map(unsigned size, 
                         paddr_t phys);

uintptr_t callout_io_map_indirect(unsigned size, 
                                  paddr_t *phys);


Same as mmap_device_io() in the C library — provide access to an I/O port on the x86 (for other systems, callout_io_map() is the same as callout_memory_map_indirect()) at a given physical address for a given size.

The difference between callout_io_map() and callout_io_map_indirect() is the second argument: callout_io_map() takes a paddr_t, but callout_io_map_indirect() takes a pointer to a paddr_t. Using the indirect form makes it easier for you to accomodate 32- and 64-bit addresses.

The return value is for use in the CPU's equivalent of in/out instructions (regular moves on all but the x86). The value is for use in any kernel callouts (i.e. they live beyond the end of the startup program and are maintained by the OS while running).