I'm finding the documentation for accessing device memory/registers in Solaris cryptic to say the least; I'd welcome some clarification. I'd like to map device register, memory, and PCI Config space into driver memory space and access it like memory. The Solaris documentation implies this can't be done, but I find that hard to believe.

Chapter 7 of Writing Device Drivers says that device memory/registers must be mapped in using ddi_regs_map_setup() then accessed using the ddi_getX/ddi_putX routines. These access routines can look after ordering and endianness for me. There is no option offered for me to just access the regions as mapped memory and deal with any such issues myself.

However, later chapters explain how I can support mapping device memory/registers to user space in response to an mmap() call, so it seems that user processes are allowed to access device memory/registers as memory. Hard to believe that user processes are allowed to do it while kernel drivers aren't, but that's what the book says.

Things get yet more cryptic and puzzling in the 'Alternate Device Access Interfaces' section later in Chapter 7. This says that there are alternative ways of accessing devices which work in specific configurations if I don't mind reduced portability. For memory mapped devices, the ddi_getX and ddi_putX can be used as alternatives to the standard device access interfaces. Since those ARE the standard interfaces, this paragraph appears to be nonsense; I suspect this is meant to cover what I'm looking for, but is hopelessly confused.

This section goes on to talk about special functions for accessing I/O space and PCI Configuration Space, mentioning alternative routines which appear to be analogous to the standard routines, and have to be used in the same ways as the standard routines. Why would I use these alternatives which reduce my portability when they don't appear to be any easier or more convenient to use than the standard fully-portable routines? I must be missing something here as well.

In summary: my device has memory, registers, and config space which appear in the processors' physical memory map. Does Solaris support mapping these into kernel memory and accessing them like memory? I'll look after any size/alignment/ordering/endian problems myself. If this is supported, how do I do it and is there any documentation anywhere which covers it?

Many Thanks,
                 jjf
_______________________________________________
driver-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/driver-discuss

Reply via email to