-
Notifications
You must be signed in to change notification settings - Fork 0
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] Added raw driver for BIOSHD, other fixes #135
base: master
Are you sure you want to change the base?
Conversation
Nice easy enhancement there. Have you run into any issues with this? I'm trying to remember from our FDC discussions last August, but seem to remember that this was originally written assuming that the BIOS may not handle multi-track reads, even the the FDC chip always can. Do you believe any BIOSes may suffer from this limitation?
It seems that with the open/close/ioctl entry points calling the same block driver function along with requiring major char/block device numbering to be the same, and only the It seems to me that if the disk device drivers were only passed a sector number and number of sectors (which is how I rewrote ELKS block drivers in anticipation of this), as well as having either a buffer header or far address in the request struct, then the driver(s) could perform I/O without having to know anything about the upper level's use of the data. The difference between a char and block driver would be almost limited to using the buffer header and operating as a block device, vs far address and character device behavior. After I/O is complete, the same inspection of buffer header vs far address would be used to signal I/O complete, etc. I rewrote ll_rw_blk.c a long ago to pass only a rq_sector and rq_nr_sectors to the block device driver - so the ELKS drivers don't know anything about blocks, only sectors. |
Definitely a good move getting #include <linuxmt/config.h> back out of as many applications as possible (for other reasons than why you're doing it) - as otherwise those applications must be recompiled for each version of the configured kernel, which them means that an entirely new set of applications must be distributed for every kernel config, as well as hardware platform variation (IBM PC, PC-98, etc). The remaining applications that must be recompiled are handled specially in the buildimages.sh script cleanup() function. |
I don't, and I'm running tests on the original PC/XT as we speak (delayed by - incidentally - some floppy problems, physical type). My thinking is that if the XT BIOS can do it, there is no reason to think other BIOSes can not. Why would they be less powerful, this being an essentially no cost 'feature'? I'll be back on that.
I agree all the way. This is where I'm coming from (the original unix way) and this is where TLVC is heading. Unix'en had the aptly named Whether to keep the buffer header as a mechanism to communicate between the layers, is debatable. It's really convenient - in particular given the fact that raw access requires a sector buffer to handle small transfers and odd byte counts. Thanks. |
Definitely not!!! Use the request queue, that's the communications mechanism to and from disk devices! Dragging in and redefining the kernel buffer system's buffer structures when only temp 512-byte character buffer is required is total kluge.
Use
When you first started working on raw driver support over a year ago, I immediately redesigned all ELKS block drivers to be ready to accept character-style requests from the request queue (only), in anticipation. A few details remain to be worked out, such as signaling I/O complete differently, etc. But I stopped working on it after seeing the buffer header kluge code and the creation of separate "character" drivers for each physical disk device. All are unnecessary with a better design, and I didn't want to add that all to ELKS, only to remove it all again.
I am glad you've seen the light! Happy to give you any ideas but I think given your increasing knowledge and speed of writing code with the system, it will be straightforward. What I hope to gain from your work and this discussion is a shared TLVC/ELKS driver compatibility, allowing for better integration of our work to be used by other people. The world already has far too many proprietary "drivers" (think network in this case) that are unique per system, and that code has to be rewritten, time after time again (by both of us now), trying to take code from a dead system but instead having to rewrite it. We're still rewriting NIC driver code from 30 years ago (boy I wish we could use the packet driver interface in ELKS or TLVC but I stopped going down that path when I realized the internals of which are littered with INT 21h DOS sys calls for arbitrary reasons). A "driver" should depend on a single incoming data structure (e.g. the request queue), and not specialized (re)handling of the buffer system data structure (e.g. buffer header), especially when the "driver" is tasked with skipping buffer system handling altogether - the very purpose of raw devices. The purpose of the kernel buffer system is to reuse data without having to reread it; the raw device system's purpose is to force reading directly from the device and never reuse data. If a temp "buffer" is needed, heap_alloc is there for that, just as it is used in areas of the kernel. |
FWIW - track spanning is ok on xt too, but my fix is the bioshd driver was wrong, fixed now. IOW, it's a keeper. |
That's encouraging, I didn't know that. Over the years (while working on ELKS) my repeated attempts to make the case for raw access to storage devices were rejected, at times even ridiculed. One of many reasons TLVC got started in the first place.
It's all a process - as we both know from experience. And as you point out, during that process I've gathered more understanding of parts of the system I didn't know much about before. New knowledge opens new paths.
I don't know what light you're referring to :-), but I'm glad you like it! Moving towards the simplicity of the original Unix structure has always been a goal. Familiar territory. The skeleton raw drivers were always a hack, and like the buffer header 'abuse', they've served their purpose well. It's always (and I believe you've reiterated this a number of times too) easier to move ahead, improve, revise when something is working. It allows prioritizing too - and there is an endless list of improvements to be made to both systems.
Concur on that - including the strive for cross-compatibility and about the packet driver. The performance delivered by MTCP on DOS - on just about any thinkable net device is truly amazing, even if we deduct the benefit of a single tasking system.
Agreed, and that's the way it is in TLVC, most likely in ELKS too - with one exception: The drivers do buffer syncing and flushing. They should not. |
I take that back. It turns out that a COMPAQ BIOS (compact portable - the original), fails in weird ways if a floppy read spans a track boundary. So much for that. I don't think it's worth it to put more effort into this (like, there is no reason the HD IO should restrict the number of sectors per IO either, and I haven't had any problems with setting the sector limit to 255, even with MFM drives, but again it depends on the BIOS and it's too time consuming to do extensive testing. |
The final commit fixes the floppy multitrack issue by reverting to the old code if The max sectors per IO operation - 255 - for non-XT architectures is big enough to never put a practical limit on anything and cannot break anything. Even a XT class MFM drive, which would be extremely rare on an AT+ system, can transfer 256 sectors in a single operation, but no buffer on TLVC can ever exceed 64k bytes so anything above 128 is fine in this context. Also in this commit, the separate raw driver code and file has been eliminated, the file operation structure integrated into the 'real' driver. An overdue cleanup - thanks for the push @ghaerr. |
Adding exceptions for BIOS IO in all kinds of utilities became too much of a pain. Thus a raw driver for BIOS io has been added. Summary of changes:
bioshd.c
:rbioshd.c
char driver.fdcache=
bootopts setting.block_dev.c
(raw_blk_rw):