-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can someone maybe write a general Linux driver "porting guide"? #111
Comments
Also @crazii, would it be a good idea to replace the older drivers (the ones that you ported from the Mpxplay project) with Linux drivers as well? It would put possible license concerns to rest (since the Linux drivers are pure GPLv2), and also those drivers are better maintained and more actively developed, since a lot more people work on the Linux kernel than on Mpxplay. And also, it might simplify the code in SBEMU if you don't have different drivers ported from different projects. (Although the Mpxplay drivers already appeared to use Linux driver headers, if I remember correctly.) |
Yes the code between Linux source and mpxplay needs reconciliation, that is planned, but not quite sure when. |
@volkertb
For no.2 and the card detection part of no. 1, you can just declare the PCI IDs and use the functions in For the card initialization part of no. 1, you just need to find the function or functions in the Linux driver that does what you want, and call them. No. 3 would normally be done for you by the SBEMU or mpxplay code, and you would just need to figure out how to get the value of the PCM playback pointer.
For No. 4, the Linux driver should have an interrupt handler, so you just call that. For No. 5, you should first find out how to get some sound out at a fixed volume, and find how to set the volume later. The Linux drivers are called from intermediate mpxplay type drivers located in
|
Thank you @jiyunomegami! So if I understand correctly:
Have I understood that correctly? I started porting and integrating the Linux virtio sound driver in SBEMU, and so far, this all seems to make sense. I will undoubtedly have questions as I work on this, but thanks for giving me the necessary pointers to get started on this! 🙂 |
Yes. There is one thing that I only hinted at, when writing about card initialization. |
Question for both @jiyunomegami and @crazii :
Would it be possible to write a general "porting" guide for Linux drivers?
I'd like to try my hand at porting a Linux driver over to SBEMU.
I've looked into it before, but quickly got overwhelmed by all the header files referencing other header files, with required defines and such, and it was not easy to figure out what sources needed to be included and what sources needed to be stubbed or replaced. @jiyunomegami Since you were successful with porting some drivers to SBEMU already, I was wondering if you could summarize the common steps in some kind of document or guide that other (somewhat less experienced) C programmers could use to port more drivers over. In such a document, we would probably only have to focus on PCI devices, at least for the time being.
Specifically, I'm thinking about porting over the virtio-snd driver. This is in fact a paravirtualized sound driver that does not directly support any existing physical sound device, but which allows the sound output from SBEMU to be directed to a hyvervisor that supports the VirtIO Sound device (notably QEMU), when run in a DOS session in a VM instance. I know that support for actual host hardware is the real focus of SBEMU, but I'd still like to do this for a multitude of reasons:
I'll take a look at the Linux drivers that were already ported. But in the meantime, maybe you and perhaps also others can help me documenting the porting process. I wouldn't mind taking the lead on such documentation as I go.
If I have any specific questions about Linux driver porting as I work on this, I'll ask them in this thread.
Thanks!
The text was updated successfully, but these errors were encountered: