Skip to content
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

[kernel] Use outb directly for DMA programming in DF driver #1728

Merged
merged 2 commits into from
Sep 21, 2023
Merged

Conversation

ghaerr
Copy link
Owner

@ghaerr ghaerr commented Sep 20, 2023

This uses another one of @Mellvik's ideas - that of dropping the relatively large set of DMA access routines and replacing them with programming the DMA chip directly from the DF driver. This saves ~500 bytes of kernel text and works well because no other devices use or will use DMA. (Even the HD direct driver uses programmed I/O).

The DMA programming is done within the setup_DMA routine and borrows from the simplicity found from the Minix OS source.

@Mellvik
Copy link
Contributor

Mellvik commented Sep 21, 2023

Thank you @ghaerr,

you saved me some time here! :-)

@ghaerr
Copy link
Owner Author

ghaerr commented Sep 21, 2023

@Mellvik: I added a FIXME about whether disabling interrupts is actually required during DMA setup. I haven't tested on real hardware so I didn't remove it. It is my understanding that since the kernel process won't ever be switched out and DMA is used nowhere else, the disabling is unnecessary. The only other code that can possibly run are interrupt handling routines which don't touch the DMA controller.

The code generated for the DMA setup is still a bit long and could affect fast serial in or possibly network transfers. It might be something to add to your testing list on real hardware with networking, as the less disabled interrupts the better for lost packets etc. FYI.

@ghaerr ghaerr merged commit aaba9a8 into master Sep 21, 2023
2 checks passed
@ghaerr ghaerr deleted the dma branch September 21, 2023 17:01
@Mellvik
Copy link
Contributor

Mellvik commented Sep 21, 2023

@ghaerr,
the irq disabling was experimental, removing it is most likely fine. I have more of those to look at so I'll add it to the list.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants