Solved linuxkpi / i915 driver development question

Not sure, whether I should send this to the mailing list instead... here goes nothing.

I'm working on/attempting to upgrade drm-kmod - at least for i915. This leads me to missing iosys_map functionality in linuxkpi. After reading the linux kernel docs, FreeBSD driver development documentation and browsing the mailing list archive, I figure I could give this a try but would like to get some feedback first.

I'm thinking that this functionality could be represented in a wrapper within FreeBSD via bus_alloc_resource/bus_map_resource for device memory, regular memcpy for the system memory.

Huh, writing this out, makes me realize this likely needs to stick in the driver module, because the mapping to the device registered memory wouldn't work outside...

Still, I'm wondering whether I'm misreading what iosys_map does - this looks like a simple/stupid union that points to either mapped device memory or a pointer to kernel memory? Then again, if it's such a simple thing, I'd think this would already by in linuxkpi?

Anyone got any better ideas, how to wrap the functionality or maybe got some example project, that's already done it? Am I going at it the right way - are those bus_* methods the right ones to use? I've also seen pmap*, but from what I read, this isn't the right tool for the job?
 
Answering to myself: I believe, this works easier than I thought. I simply took the original include file and and made a couple exclusions.
There is no memset_io et al in FreeBSD; they are already redefined as memset or memcpy - so that should address that quite nicely. Lets hope this works in practice and not just theory of compiling.
 
Glad you found the answer. Just so you know, there is a method others have used to upgrade the drivers where they add the patches from Linux and work from there (scripts in the drm-kmod repo). That way, the history from Linux is also preserved. You can usually get some help/discuss this on FreeBSDDesktop on Gitter (which is bridged to the #freebsd-xorg IRC Channel).

Good luck!
 
Back
Top