Conversation
|
@ghaerr I did some initial testing as requested. I used a 4096MB Verbatim (CF0) and a 16MB Nikon card (CF1).
Both cards in 16-bit mode (notice the CAPability words and CHS): Both cards in 8-bit mode (notice the CAPability words and CHS): If you're happy, I can do some further work to try and get both working, maybe detect 8-bit transfers (still thinking about this) and push to this PR? |
|
Please comment out total=0 in the sanity checks, so that we can see the messages, but still execute the code. I am unable to compile at this moment. I will use the github actions builds. I found my xtide+cf card. |
|
@fhendrikx you use |
That's the new remapping code, presumably. |
|
Hello @fhendrikx, Thanks for your testing! Very strange results with CAP word changing in 8-bit mode, but happy to hear initial reports of 8-bit mode working. I've been unable to test anything in 8-bit or real hardware since I'm only using QEMU at the moment, and its ATA emulation seems a bit incomplete. I went backwards to the ATA ACS-1 spec where the CHS capability words were valid, they're technically obsolete in ACS-3+, but I added them because QEMU allows communication with the ATA interface even when no hard drive is attached, which then seems to return random data. I have no problem with deleting most of the sanity checks, but it would be nice if we found one that worked for both hard drives attached with QEMU (for my continued testing and maintenance) as well as the more modern CF cards. Perhaps look at the sector size ATA_INFO_SECTSIZE, is that 512 on your device? Without additional checks, we're dependent on the single 0x200 bit in word 49 ATA_INFO_CAPS as to whether to accept a device or not, which I felt a bit lacking.
That'd be great, thanks! I'm unable to test any 8-bit modes, so that will help a lot. Please push any improvements you can make and we'll commit before I make any other changes (such as working when XMS enabled, etc).
Yes, @toncho11, that's the new "overlay" capability I discussed here. While the actual ATA CF device is /dev/cf0, for Solo/86 /dev/hda is overlaid on top of /dev/cf0, which allows for Solo/86 users for which CF is their internal mass media to use /dev/hda much like modern laptop users use /dev/hda for internal flash drives. This feature can be turned on later for other ELKS systems/users that may want to do the same thing. It's not on by default since many ELKS users will want to use /dev/hda for BIOS access to an actual hard drive. |
|
@ghaerr Can we make the sanity checks non blocking for now? |
Sure - I just pushed a commit with total=0 commented out for your testing. |
|
I used |
Can you take a screenshot of the boot screen? We need to see the various cf: messages at startup to determine what is happening. It sounds like both ATA-CF drives failed the current init code. |
On your system (and all systems other than Solo/86 at the moment), /dev/hda1 is the BIOS-addressed first partition of the first hard drive. Is that also the same as the XT-IDE-addressable CF card on your system?
Partitions aren't supported with the ATA CF driver yet. If you try to mount a partition, it won't say "no such device", but the mount will fail with another message. So that's not the problem yet.
The ATA CF driver is defaulting to address 0x1F0. This would need to be changed in include/arch/ata.h. 0x300 is normally the I/O address for an NE2K network card. |
|
So it should be like that: |
|
@ghaerr Can you please add the above code with base address = 0x300. This will allow me to test. |
Yes, if you need 0x300 instead of 0x1F0 for your hardware. Is that standard for XT-IDE? @fhendrikx or I can make the change and add ATA_BASE_PORT to ata.h after getting the current PR working on Solo/86 hardware in 8-bit mode. |
|
XT-IDE has switches on the card where you can configure 8 port addresses. |
Partitions definitely won't work.
Let's check more into this before changing the base address, since the standard ATA driver address is 0x1F0. We need to understand why yours is set to 0x300, which of course is also in the way of your NIC. We will update ata.h as described so that it is easy to change the base address however. |
|
It is clear why. The creators of XT-IDE wanted to use another port address that is not in conflict with the standard IDE 0x1F0 for compatibility reasons. Hopefully this is the only required change. Register-Level Mapping (Base + N Style)
|
I've got the hood open... so I'll put that in shortly. |
|
@ghaerr That change has been made, but github won't let me push to your repo directly (since that PR only exists on this copy of the elks repo). |
|
Shall I commit this right now, and then then have you make changes from there with a new PR of your own? |
|
Sure, that works too... |
There's only a single GitHub master repo - how is it that is in fact the problem? I'm not very git-knowledgable, are there other ways to enable pushing to an open Github PR? |
|
On your project, Settings > Collaborators (I believe). |
|
In any case @fhendrikx, thanks for your testing. Please feel free to open another PR and add whatever fixes/enhancements you'd like for an improved ATA CF driver that hopefully will also work on @toncho11's Amstradt. I'll postpone any other additions until after that. I'd like to see the ATA identify code essentially duplicated in ata_cf_open, so that CF cards can be hot-swapped when not mounted. You're welcome to add that too, if you like, otherwise I'll take a pass at it afterwards. |
Thank you... will have a crack at all of that. |
|
I made the change in: #2349 |
|
Right, a PR with the requested changes is ready.
Probably worth noting that my 8-bit tests on Solo/86 were successful... creating new FAT32 F/S, copying files, umount/remount, executing stuff, etc. I did however spot two possible bugs, where mount and df seem to think in 1K blocks. For example, mount claims we have 7806M of space, when in reality we only have half of that: Ditto df: |
Hmmm, mkfat's argument is supposed to be in 1K blocks, so it would seem that the FAT mount and df displays are correct, but possibly the cf0: size= value is incorrect. We don't really need to report size in sectors in the cf0: display. And since the number of sectors would be twice that of the number of blocks, the real culprit is "total >> 1" should actually be "total << 1" in the ATA CF driver. I would suggest remove sectors= completely and just showing blocks. BTW, the boot screen kernel messages generally don't use '=' signs when showing numbers, but just a space, trying to make the display more easily readable. Perhaps just change the display to something like: |
Ok, will have a look tomorrow. Will fix it in the PR.
Ok, no worries. Will fix that too |
Oops - I now remember why I don't use the term "blocks" anymore - it's potentially ambiguous between meaning 512 vs 1024 bytes. I recommend changing the cf0: display to something like: This is pretty much what the display was originally.
I think the calculations were also correct in the version prior to your PR also. Of course, the ATA driver keeps track of sectors internally since block requests are sector-numbered, but we report sizes in 1K increments, not sectors or "blocks". |





Adds block device overlay concept, described in #2305 (comment).
For now, the driver tries to set 8-bit read/write ATA transfers if the ATA chip supports it. This is untested since QEMU doesn't support 8-bit transfers.
@fhendrikx, if you could test this on Solo/86, that would be great. This could possibly also work on @toncho11's Amstradt, but the 8-bit code is completely untested. The boot screen now shows more data from the ATA identify information buffer, for debugging purposes.
Currently, the ATA-CF (now /dev/cf0) driver only works with CF cards inserted at boot time; the at_init() code will be moved in a later commit to the driver open code so that CF cards can be swapped when not mounted.