OSDev.org
https://forum.osdev.org/

IDE-ATA Problem
https://forum.osdev.org/viewtopic.php?f=1&t=37306
Page 1 of 1

Author:  SanderR [ Fri Oct 02, 2020 3:33 pm ]
Post subject:  IDE-ATA Problem

Hello everyone!

I have a problem.
I wrote a IDE driver with the tutorials found on the osdev wiki, my can be found here: https://github.com/AdeRegt/SanderOSUSB/ ... /dev/ide.c
When the driver is initialised, it does detect the filesystem on a disk, my filesystem detection code: https://github.com/AdeRegt/SanderOSUSB/ ... l/fs/mbr.c
I decided to add a custom filesystem: https://github.com/AdeRegt/SanderOSUSB/ ... l/fs/sfs.c

The IDE-ATAPI works perfectly.
The IDE-ATA doesnt:
The system initialises the IDE-ATA, this seems to go OK
The system detects the filesystem, this goes OK
The system initialises the filesystem, this goes OK
The system wants to load sectors stored in a buffer, gotten from the filesystem. this does not go OK.
The data in the buffer is OK, but it is somehow unable to read sectors. the 0x1f7 port returns a 0xff when checking the status and does not read any sector.

Does anyone knows what is wrong?

Author:  Klakap [ Sat Oct 03, 2020 7:51 am ]
Post subject:  Re: IDE-ATA Problem

Emulators(especially QEMU) took really long time for reading/writing sectors with ATA (only some first sectors are faster). On real hardware is your waitng time enough, but in emulators you should wait some miliseconds.And you must acknowledge interrupt by reading from status port(0x1F7/0x177).

Author:  BenLunt [ Sat Oct 03, 2020 7:40 pm ]
Post subject:  Re: IDE-ATA Problem

SanderR wrote:
Hello everyone!

I have a problem.
I wrote a IDE driver with the tutorials found on the osdev wiki, my can be found here: https://github.com/AdeRegt/SanderOSUSB/ ... /dev/ide.c
When the driver is initialised, it does detect the filesystem on a disk, my filesystem detection code: https://github.com/AdeRegt/SanderOSUSB/ ... l/fs/mbr.c
I decided to add a custom filesystem: https://github.com/AdeRegt/SanderOSUSB/ ... l/fs/sfs.c

The IDE-ATAPI works perfectly.
The IDE-ATA doesnt:
The system initialises the IDE-ATA, this seems to go OK
The system detects the filesystem, this goes OK
The system initialises the filesystem, this goes OK
The system wants to load sectors stored in a buffer, gotten from the filesystem. this does not go OK.
The data in the buffer is OK, but it is somehow unable to read sectors. the 0x1f7 port returns a 0xff when checking the status and does not read any sector.

Does anyone knows what is wrong?

I interpret this as your ATA code actually does read some sectors, Yes? It must read some sectors if it found the file system on the disk.
However, the last line states that it does not read any sectors at all.

Please be more specific. If the ATA driver does read sectors, which it would have to do to correctly read in the partition to detect the file system, but then it doesn't read other times?

Ben
- http://www.fysnet.net/media_storage_devices.htm

Author:  bloodline [ Sun Oct 04, 2020 1:02 am ]
Post subject:  Re: IDE-ATA Problem

Hi,

I’m planning to write an ATA driver sometime soon, once I get a good handle on how the hardware works I’ll look over your code and see if I can spot any issues.

But my first question is how have you created the disk with your custom FS?

Author:  bloodline [ Tue Oct 13, 2020 10:19 am ]
Post subject:  Re: IDE-ATA Problem

I would also note that your mbr_entry type doesn’t use the __packed__ attribute which means the compiler might be adding alignment bytes to make access quicker, so the types won’t align with your on disk structures.

Author:  SanderR [ Tue Oct 13, 2020 3:18 pm ]
Post subject:  Re: IDE-ATA Problem

Hello,

Thank you for your answers.
I discovered I had a git branch with a working base so I restored parts of this file.
The old code had bugs but I was able to solve them by the advices you guys told me. Thank you.
I was not exactly sure where the bugs in the new system was comming from.

For the filesystem: I opened my virtual harddisk (VHD) with my hexeditor and in this way designed the filesystem base.
This system works well enough. This is the filesystemdriver link: https://github.com/AdeRegt/SanderOSUSB/ ... l/fs/sfs.c
This is the ide driver link: https://github.com/AdeRegt/SanderOSUSB/ ... /dev/ide.c

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/