Trying to read a 64 sector cluster

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
digo_rp
Member
Member
Posts: 233
Joined: Sun Jun 05, 2005 11:00 pm

Trying to read a 64 sector cluster

Post by digo_rp »

Hi guys, I´m having a problem reading a 64 Sector cluster using a read function at AHCI from osdev docs,

As I can see that the most I can read is 8 sectors per cluster...

I have a 500GB harddisk on old notebook. and I format it as FAT32 using GParted.

could anyone help me please?

I don´t know how to read it that 64 sectors per cluster....

thnx so much...
Octocontrabass
Member
Member
Posts: 5587
Joined: Mon Mar 25, 2013 7:01 pm

Re: Trying to read a 64 sector cluster

Post by Octocontrabass »

I'm pretty sure AHCI can handle a lot more than 64 sectors at a time.

If it can't, then you'll have to split it up into multiple shorter requests.
digo_rp
Member
Member
Posts: 233
Joined: Sun Jun 05, 2005 11:00 pm

Re: Trying to read a 64 sector cluster

Post by digo_rp »

could you please give some direction, how can I split it in small blocks? please

when I choose to read 64 sectors it returns nothing...
digo_rp
Member
Member
Posts: 233
Joined: Sun Jun 05, 2005 11:00 pm

Re: Trying to read a 64 sector cluster

Post by digo_rp »

I found it! now I can read that 64 sectors... I made a small modification.

//
// 8K bytes (16 sectors) per PRDT
//

from below
for (int i=0; i<cmdheader->prdtl-1; i++) {
cmdtbl->prdt_entry.dba = (DWORD)buf;
cmdtbl->prdt_entry.dbc = 8*1024; // 8K bytes
cmdtbl->prdt_entry.i = 1;
buf += 4*1024; // 4K words
count -= 16; // 16 sectors
}

to below

for (int i=0; i<cmdheader->prdtl-1; i++) {
cmdtbl->prdt_entry.dba = (DWORD)buf;
cmdtbl->prdt_entry.dbc = 32*1024; // 32K bytes
cmdtbl->prdt_entry.i = 1;
buf += 16*1024; // 16K words
count -= 64; // 64 sectors
}

now i can read it...

I just put here my modifications in case help somebody.

thx a lot.
digo_rp
Member
Member
Posts: 233
Joined: Sun Jun 05, 2005 11:00 pm

Re: Trying to read a 64 sector cluster

Post by digo_rp »

I´m so sorry I forgot to put that line too

from

cmdheader->prdtl = (WORD)((count-1)>>4) + 1; // PRDT entries count

change to

cmdheader->prdtl = (WORD)((count-1)>>6) + 1; // PRDT entries count

those modifications allows you to read a 64 sectors...

thnx a lot all
Post Reply