Reading from SATA/ATA/... disks (and maybe solving my PCI is
Posted: Thu Aug 08, 2019 3:56 pm
So, some of you guys know that I was trying to get Intel HDA going. I have decided to put that to the side for now because I at least have output via the serial port and my OS desperately needs some other things before audio.
One thing my OS is pretty much useless without is IO. I have a lot of ideas for what file systems to implement -- but I can't do that without knowing how to read from and write to disks. Sadly, the OSDev wiki is sorely lacking in this department. I see projects like Coreboot have commands like FRE, ST, CLO, etc., but have absolutely no idea where this code comes from.
So I'm not only trying to understand how disk IO works (because why write a disk IO driver if I don't understand how it works?) and implement one. The problem is, I can't find any kind of guide/tutorial/whatnot on how to do that, and the specs aren't really helping.
The main resource I've been clinging onto is code. But that has its own problems: most of the hobby OS projects that are easy to read/well documented have code that can only read from disks, or the disk implementation was never completed. I haven't looked through Minix's code yet, though I really don't want a microkernel design.
Those who know of my HDA attempt also know of my PCI issue. I'd also like to attempt to solve that while I'm at it. I'm fine with hardcoding memory addresses in code for now but I really want that issue solved so its no longer something I need to worry about until I go adding PCE.
So, my questions are:
1) What would be a good resource for learning how to read from and write to AHCI/ATA disks?
2) What would be a good OS for me to use as a sort of reference guide? (Please, as little ASM as possible.)
3) Could we try and solve the PCI problem I'm having (getting right device IDs and vendor IDs and such, but not getting any other data other than basic data) during this discussion?
If 3 isn't possible, that's fine, I can post it in another thread. I'll post my PCI handling code if anyone needs a refresher or hasn't seen it yet (I need to translate it into C first).
One thing my OS is pretty much useless without is IO. I have a lot of ideas for what file systems to implement -- but I can't do that without knowing how to read from and write to disks. Sadly, the OSDev wiki is sorely lacking in this department. I see projects like Coreboot have commands like FRE, ST, CLO, etc., but have absolutely no idea where this code comes from.
So I'm not only trying to understand how disk IO works (because why write a disk IO driver if I don't understand how it works?) and implement one. The problem is, I can't find any kind of guide/tutorial/whatnot on how to do that, and the specs aren't really helping.
The main resource I've been clinging onto is code. But that has its own problems: most of the hobby OS projects that are easy to read/well documented have code that can only read from disks, or the disk implementation was never completed. I haven't looked through Minix's code yet, though I really don't want a microkernel design.
Those who know of my HDA attempt also know of my PCI issue. I'd also like to attempt to solve that while I'm at it. I'm fine with hardcoding memory addresses in code for now but I really want that issue solved so its no longer something I need to worry about until I go adding PCE.
So, my questions are:
1) What would be a good resource for learning how to read from and write to AHCI/ATA disks?
2) What would be a good OS for me to use as a sort of reference guide? (Please, as little ASM as possible.)
3) Could we try and solve the PCI problem I'm having (getting right device IDs and vendor IDs and such, but not getting any other data other than basic data) during this discussion?
If 3 isn't possible, that's fine, I can post it in another thread. I'll post my PCI handling code if anyone needs a refresher or hasn't seen it yet (I need to translate it into C first).