OSDev.org

The Place to Start for Operating System Developers
It is currently Wed Dec 01, 2021 7:17 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Problems finding drive size with ATA Identify
PostPosted: Tue May 11, 2021 1:55 am 
Offline

Joined: Tue May 11, 2021 1:34 am
Posts: 2
A brief overview; I am using AHCI to write a driver and am currently stuck on trying to get the connected drives size. I can read and write to a drive, but it would be very helpful to know the size of the drive.

When I test my driver on real hardware with a 250GB drive the ATA identify command returns the max sector amount(137GB) as if it is a 28-bit LBA drive. And this is returned in words 230-233 "extended # of user addressable sectors" not in the 28-bit sector amount words(60-61). Also the 28-bit sector amount words(60-61) show 0x0007000. The last place for sector amount(100-103) shows 0. I know my drive has 48-bit support and the BIOS confirms this by showing the proper drive size. Also the drive was in this laptop before and completely functional in a Windows Vista installation.

The other interesting thing is that I noticed is the "48-bit address feature set is supported" bit in word 83 is set but the "48-bit address feature set is supported" in word 86 is not set. To me this means that it is supported but not enabled since 83 is labeled as features supported and 86 is labeled as features enabled.

I couldn't find any information about enabling 48-bit lba and decided to just ask this question on here. Does anyone know if there is a way to enable 48-bit lba or does anyone have an idea of what might be going on here?


Top
 Profile  
 
 Post subject: Re: Problems finding drive size with ATA Identify
PostPosted: Tue May 11, 2021 8:50 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 3487
There's no way to disable 48-bit LBA. If the drive supports it, it's always enabled. My guess is it's some kind of memory corruption bug, since those values are all nonsense.

Have you tried dumping the whole IDENTIFY DEVICE data and comparing against what you see in another OS? (Using hdparm --Iraw/--Istdin under Linux, for example.)


Top
 Profile  
 
 Post subject: Re: Problems finding drive size with ATA Identify
PostPosted: Wed May 12, 2021 3:02 am 
Offline

Joined: Tue May 11, 2021 1:34 am
Posts: 2
Thank you for the hdparm tip, I did not know about it. When running it I do get the correct number for everything.

I compared it's raw output to my raw output and they match exactly except for a couple nibbles that were slightly different. I think my structure must either be messed up or I am indexing words incorrectly.

Either way thank you so much showing me how to see the expected data compared to what I get. I think I can solve this issue now.


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 25 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