Page 1 of 1

Can not use ATA PIO mode in Qemu

Posted: Thu Feb 13, 2020 4:06 am
by shore
Hi I'm following a book to write a kernel but meet problem with disk driver part of program.

My system is:
Manjaro: 18.1.5
Linux kernel: 5.5.2-1
Qemu: 4.2.0-1
I start Qemu by:

Code: Select all

qemu-system-x86_64 -machine q35 -cpu Broadwell -accel kvm -m 1G Boot.disk
I use ATA PIO mode to access disk. However, when trying to read port 0x1F1 to detect errors, it returns 255. While in Bochs or VirtualBox, it is 0. Also interrupts are not able to react.

But, keyboard and mouse are driver works fine. And when in int 13h also works.

So I'm kind of don't know what to do, and seeking for help in here.

Hope someone can help me on this. Thanks!

Re: Can not use ATA PIO mode in Qemu

Posted: Thu Feb 13, 2020 6:41 am
by Octocontrabass
shore wrote:-machine q35
The q35 machine does not include an IDE controller. Use the default "pc" machine, or write an AHCI driver.

Re: Can not use ATA PIO mode in Qemu

Posted: Mon Apr 06, 2020 2:50 am
by iProgramInCpp
I use this argument:

Code: Select all

 -drive file=%path%\build\harddrive.raw,index=0,if=ide,format=raw

Re: Can not use ATA PIO mode in Qemu

Posted: Mon Apr 06, 2020 7:19 am
by Klakap
Or try easiest

Code: Select all

-hda harddisc.img