[SOLVED] IDENTIFY OK, supports LBA48 but total LBA48 == 0

Programming, for all ages and all languages.
Post Reply
HugeCode
Member
Member
Posts: 112
Joined: Mon Dec 17, 2012 9:12 am

[SOLVED] IDENTIFY OK, supports LBA48 but total LBA48 == 0

Post by HugeCode »

Hi all. I'm currently trying to get LBA working, but I have problem.
My IDENTIFY function returns OK and word 83;bit 10 is set, so my device supports LBA48. But when I try to get total amount of LBA48 sectors (configuration words 100-103), it gives my zero. In virtual machine I have 1GB disk set (192KB used) but this field is still zero. I also tried to get amount of LBA28 sectors, but it returns me crazy value.

Does anybody know what am I doing wrong? Is there any other way for getting the size of HDD? Please help.
Last edited by HugeCode on Sat Jun 29, 2013 2:08 am, edited 1 time in total.
HugeCode
Member
Member
Posts: 112
Joined: Mon Dec 17, 2012 9:12 am

Re: IDENTIFY OK, supports LBA48 but total LBA48 == 0

Post by HugeCode »

Another interesting thing is that when I print out heads*cylinders*sectors_per_track, the value is almost same as value of total LBA28 sectors located on words 60-61. It's 2097152 for total LBA28 and 2096640 for h*c*s. Difference of these two values is 512.

????????????????????

My disk has 1GB. What are these values?
User avatar
dozniak
Member
Member
Posts: 723
Joined: Thu Jul 12, 2012 7:29 am
Location: Tallinn, Estonia

Re: IDENTIFY OK, supports LBA48 but total LBA48 == 0

Post by dozniak »

2097152*512 == 1GB
Learn to read.
HugeCode
Member
Member
Posts: 112
Joined: Mon Dec 17, 2012 9:12 am

Re: IDENTIFY OK, supports LBA48 but total LBA48 == 0

Post by HugeCode »

Yes, but why I have LBA48 avaible, but total LBA48 field is zero? And why is there difference of 512*512=256KB?
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: IDENTIFY OK, supports LBA48 but total LBA48 == 0

Post by Combuster »

the numbers correspond to 512 * 4096 and 512 * 4095, i.e. you probably have an off-by-one error in your CHS code.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
HugeCode
Member
Member
Posts: 112
Joined: Mon Dec 17, 2012 9:12 am

Re: IDENTIFY OK, supports LBA48 but total LBA48 == 0

Post by HugeCode »

And LBA48 supported but count zero?
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: IDENTIFY OK, supports LBA48 but total LBA48 == 0

Post by Combuster »

Echo-o-o.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
HugeCode
Member
Member
Posts: 112
Joined: Mon Dec 17, 2012 9:12 am

Re: IDENTIFY OK, supports LBA48 but total LBA48 == 0

Post by HugeCode »

Hmm???
User avatar
dozniak
Member
Member
Posts: 723
Joined: Thu Jul 12, 2012 7:29 am
Location: Tallinn, Estonia

Re: IDENTIFY OK, supports LBA48 but total LBA48 == 0

Post by dozniak »

Lol.
Learn to read.
HugeCode
Member
Member
Posts: 112
Joined: Mon Dec 17, 2012 9:12 am

Re: IDENTIFY OK, supports LBA48 but total LBA48 == 0

Post by HugeCode »

After a long time, I maybe found out what was the problem.
  1. I forgot on operator priority and used bitwise & so it returned 0.
  2. My CHS used number of sectors, but sectors begin on 1 (not 0). I don't think it is really my fault. It looks like VirtualBox counts also with sector 0...
Post Reply