OSDev.org

The Place to Start for Operating System Developers
It is currently Wed Nov 25, 2020 10:21 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: IDE-ATA Problem
PostPosted: Fri Oct 02, 2020 3:33 pm 
Offline
Member
Member

Joined: Tue Aug 30, 2016 1:31 pm
Posts: 41
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?


Top
 Profile  
 
 Post subject: Re: IDE-ATA Problem
PostPosted: Sat Oct 03, 2020 7:51 am 
Offline
Member
Member

Joined: Sat Mar 10, 2018 10:16 am
Posts: 176
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).


Top
 Profile  
 
 Post subject: Re: IDE-ATA Problem
PostPosted: Sat Oct 03, 2020 7:40 pm 
Offline
Member
Member
User avatar

Joined: Sat Nov 22, 2014 6:33 pm
Posts: 744
Location: USA
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


Top
 Profile  
 
 Post subject: Re: IDE-ATA Problem
PostPosted: Sun Oct 04, 2020 1:02 am 
Offline
Member
Member
User avatar

Joined: Tue Sep 15, 2020 8:07 am
Posts: 155
Location: London, UK
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?

_________________
Building a single address space Microkernel, as used in embedded applications, for the desktop... Download latest build bootable Disk Image: https://github.com/h5n1xp/CuriOS/blob/main/disk.img.zip


Top
 Profile  
 
 Post subject: Re: IDE-ATA Problem
PostPosted: Tue Oct 13, 2020 10:19 am 
Offline
Member
Member
User avatar

Joined: Tue Sep 15, 2020 8:07 am
Posts: 155
Location: London, UK
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.

_________________
Building a single address space Microkernel, as used in embedded applications, for the desktop... Download latest build bootable Disk Image: https://github.com/h5n1xp/CuriOS/blob/main/disk.img.zip


Top
 Profile  
 
 Post subject: Re: IDE-ATA Problem
PostPosted: Tue Oct 13, 2020 3:18 pm 
Offline
Member
Member

Joined: Tue Aug 30, 2016 1:31 pm
Posts: 41
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 13 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group