AHCI HBA appears to be doing absolutely nothing
Posted: Fri Mar 18, 2022 9:53 am
I've been fighting my AHCI driver for...months, honestly, and I'm at a total loss. I am able to find the HBA on the PCI bus and read ABAR5 to get the base address of the HBA. I can read and set a bunch of registers, but when I try to set a register that is supposed to actually do something nothing happens. I'll explain:
I am developing an x86 operating system and running it on Virtualbox.
When doing a minimal setup, I understand that I need to follow the steps in this post: viewtopic.php?f=1&t=40969 (I actually figured out most of that from the docs, but some stuff I didn't know). Specifically, I:
1. Enable AHCI mode by setting GHC.AE
2. It appears that I do NOT have bios handoff enabled (The entirety of HBA's CAP2 register is 0, meaning I have no bios handoff ability?)
3. I set all ports to idle by clearing ST and FRE, and waiting for CR and FR to change. Interestingly, either these are already zero or they are being reset, because this part works
4. Now we get to the problem. If I try to perform an HBA reset by setting GHC.HR to 1, it never becomes 0 again. It hangs. If I ignore this (that is, if I don't do the reset), then trying to reset anything else fails. For example, I can't reset Px.SERR by writing all 1s and waiting for it to clear because it never clears.
I have no idea what I did or didn't do to make the HBA just straight up not respond. I'd expect that a bunch of error bits would be set or something but I see *no changes at all*. I can see the changes I make (so if I set a bit then print the register that bit is set), but it appears that the HBA does nothing with those settings.
Any thoughts?
I am developing an x86 operating system and running it on Virtualbox.
When doing a minimal setup, I understand that I need to follow the steps in this post: viewtopic.php?f=1&t=40969 (I actually figured out most of that from the docs, but some stuff I didn't know). Specifically, I:
1. Enable AHCI mode by setting GHC.AE
2. It appears that I do NOT have bios handoff enabled (The entirety of HBA's CAP2 register is 0, meaning I have no bios handoff ability?)
3. I set all ports to idle by clearing ST and FRE, and waiting for CR and FR to change. Interestingly, either these are already zero or they are being reset, because this part works
4. Now we get to the problem. If I try to perform an HBA reset by setting GHC.HR to 1, it never becomes 0 again. It hangs. If I ignore this (that is, if I don't do the reset), then trying to reset anything else fails. For example, I can't reset Px.SERR by writing all 1s and waiting for it to clear because it never clears.
I have no idea what I did or didn't do to make the HBA just straight up not respond. I'd expect that a bunch of error bits would be set or something but I see *no changes at all*. I can see the changes I make (so if I set a bit then print the register that bit is set), but it appears that the HBA does nothing with those settings.
Any thoughts?