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] Reworked the use of lowmem DMASEG in xd and floppy driver + more #103

Merged
merged 3 commits into from
Nov 10, 2024

Conversation

Mellvik
Copy link
Owner

@Mellvik Mellvik commented Nov 7, 2024

This PR introduces the new scheme for allocating bounce buffers and floppy cache from low memory/DMASEG - discussed in ghaerr/elks#2091 and #88. The new DMASEG map has a bounce buffer for xd drives (XT class) or Lance ethernet (AT class) at the bottom, then a bounce buffer for the directfd driver, handling both DMA wraps and XMS bouncing. Then the floppy sector cache if configured. This means - for the directfd driver - that the cache and the bounce buffer are permanently separated and that the cache may be configured completely out of the code by setting the CONFIG_FLOPPY_CACHE value to 0 in menuconfig. For 386+ systems that don't need or benefit from the cache, this is meaningful memory saved.

Other changes to the directfd driver:

  • A fix for the case that autconfig would fail on all (that is two) formats and loop endlessly. It will now try all (still 2) formats a few times, then fail.
  • While it is possible to set the size of the FLOPPY cache to any number in menuconfig, the max is now 7k (14 sectors), adjusted if necessary in config.h. As before, the actual size and the configured cache memory is reported at boot time - unless configured to 0.
  • fdcache= in /bootopts may now be set to 0 and the cache will be disabled in the driver. Functionally this is similar to the way it worked before (when the bounce buffer and the cache were integrated), but then the 'turn-off' value was 1 to accommodate the bounce buffer, not 0.

Also in this PR is an update to the xd.c driver to work in the changes to the bounce buffer setup in config.h. These changes have not been tested yet for lack of working hardware. Further:

  • Added DEBUG_RAW in debug.h and changed debug statements in fs/block_dev.c accordingly. debug.h has had a number of other additions too, part of a process to improve the debug tooling in TLVC.
  • Some cleanups.

@ghaerr
Copy link

ghaerr commented Nov 9, 2024

This means - for the directfd driver - that the cache and the bounce buffer are permanently separated

Earlier, you had mentioned that it was probably OK keep the DF bounce buffer and track cache overlapped and invalidate the cache when an XMS/DMA buffer was needed, rather than permanently allocate another 1K for the separate bounce buffer.
Did that assumption change, or is there another reason the DF bounce and cache are permanently separated?

@Mellvik
Copy link
Owner Author

Mellvik commented Nov 9, 2024

It's a result of our thorough and very useful discussions. Simplicity won. The ability to eliminate the caching code entirely when not needed wasn't in the plan, but was a welcome benefit. It has been an interesting journey!

@Mellvik Mellvik merged commit 1d9dcef into master Nov 10, 2024
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