[SOLVED] ATA PIO mode disk driver doesn't work on laptop
Posted: Mon Aug 05, 2024 5:47 am
I wrote a disk driver to read hard disk. It works on Qemu but doesn't on my laptop.
My laptop model is Asus x450vc. It is an old computer, and has two hard disks. One is Sandisk 128GB SSD connecting to the original SATA interface. This disk contains my OS code.
According to this link: https://wiki.osdev.org/ATA_PIO_Mode#ATA_Driver , I think SATA disk is an ATA-compliant drive and the ATA PIO mode disk driver should work on it.
This disk driver works on Qemu emulator but doesn't on my laptop. This is what I saw (I have tested for both primary & secondary bus, both master & slave device):
- Reading the Regular Status byte (port 0x1f7 for primary bus) gives me 0xFF, which is an invalid value. It didn't pass the Floating Bus test
- I wrote a random value to port 0x1f2. It should be the same value if I read it back. But I got 0xFF again. It didn't pass the Random value write/read test
- I performed the IDENTIFY command test on the IO port. But I got 0xFF for both Status register (0x1f7), and port 0x1f4, and port 0x1f5. Which meanings the drive is not ATA.
Source code can be found here:
https://github.com/stskyblade/StarOS/bl ... ader.S#L49
Step to reproduce:
My laptop model is Asus x450vc. It is an old computer, and has two hard disks. One is Sandisk 128GB SSD connecting to the original SATA interface. This disk contains my OS code.
According to this link: https://wiki.osdev.org/ATA_PIO_Mode#ATA_Driver , I think SATA disk is an ATA-compliant drive and the ATA PIO mode disk driver should work on it.
This disk driver works on Qemu emulator but doesn't on my laptop. This is what I saw (I have tested for both primary & secondary bus, both master & slave device):
- Reading the Regular Status byte (port 0x1f7 for primary bus) gives me 0xFF, which is an invalid value. It didn't pass the Floating Bus test
- I wrote a random value to port 0x1f2. It should be the same value if I read it back. But I got 0xFF again. It didn't pass the Random value write/read test
- I performed the IDENTIFY command test on the IO port. But I got 0xFF for both Status register (0x1f7), and port 0x1f4, and port 0x1f5. Which meanings the drive is not ATA.
Source code can be found here:
https://github.com/stskyblade/StarOS/bl ... ader.S#L49
Step to reproduce:
Code: Select all
make qemu # this will build my os, and test it on Qemu. This is OK.
make burn # Be careful: this will burn my disk image to /dev/sdb.
# insert the disk to my laptop and boot