fail to read atapi on ahci

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
nlg
Member
Member
Posts: 40
Joined: Mon Mar 14, 2016 5:34 am

fail to read atapi on ahci

Post by nlg »

I have so far created read / write functions on disk via the ahci interface but I cannot read on an atapi disk, here is the code I use to initialize the FIS, atapi command, and command table:

Code: Select all

;préparer FIS
gs
mov byte[esi+zsata_cfis],27h     ;type de FIS: host to device
gs
mov byte[esi+zsata_cfis+1],080h   ;attribut     ????????????????????
gs
mov byte[esi+zsata_cfis+2],0A0h  ;commande  packet 
gs
mov byte[esi+zsata_cfis+3],0     ;feature 1 ????????????????? 
gs 
mov byte[esi+zsata_cfis+4],0     ;LBA  (0-7)
gs
mov word[esi+zsata_cfis+5],16   ;LBA (8-23) nombre d'octet de la commande packet
gs
mov byte[esi+zsata_cfis+7],0     ;device
gs
mov byte[esi+zsata_cfis+8],0     ;LBA (24-31)
gs
mov word[esi+zsata_cfis+9],0     ;LBA (32-47)
gs
mov byte[esi+zsata_cfis+11],0    ;feature 2
gs
mov word[esi+zsata_cfis+12],0    ;count
gs
mov byte[esi+zsata_cfis+14],0    ;ICC
gs
mov byte[esi+zsata_cfis+15],0    ;controle
gs
mov dword[esi+zsata_cfis+16],0   ;auxilliaire

gs
mov eax,[esi+zsata_msb_adresse]
gs
mov dword[esi+zsata_msb_adresse],0
and ebp,00FFFFh
bswap eax
bswap ebx
bswap ebp

gs
mov byte[esi+zsata_acmd],88h     ;commande ATAPI lecture 16
gs
mov byte[esi+zsata_acmd+1],0     ;vide
gs
mov dword[esi+zsata_acmd+2],eax  ;adresse du secteur (MSB)
gs
mov dword[esi+zsata_acmd+6],ebx  ;adresse du secteur (LSB)
gs
mov dword[esi+zsata_acmd+10],ebp ;nb de secteur
gs
mov word[esi+zsata_acmd+14],0    ;vide


;préparer table commande
gs
mov byte[esi+zsata_liste],025h ;5dword de commande+ATAPI
gs
mov byte[esi+zsata_liste+1],04h ;Clear Busy upon R_OK
gs
mov word[esi+zsata_liste+2],1 ;nombre d'entrée dans la PRDT
gs
mov dword[esi+zsata_liste+4],0 ;
mov eax,esi
add eax,100000h+zsata_cfis
gs
mov [esi+zsata_liste+8],eax     ;lsb de l'adresse de la commande
gs
mov dword[esi+zsata_liste+12],0 ;msb adresse de la commande
gs
mov dword[esi+zsata_liste+16],0 ;réservé mais on vide quand même
gs
mov dword[esi+zsata_liste+20],0
gs
mov dword[esi+zsata_liste+24],0
gs
mov dword[esi+zsata_liste+28],0
do you see something in there that seems abnormal to you?
Octocontrabass
Member
Member
Posts: 5568
Joined: Mon Mar 25, 2013 7:01 pm

Re: fail to read atapi on ahci

Post by Octocontrabass »

nlg wrote:I cannot read on an atapi disk
What happens instead of reading the disk?
nlg
Member
Member
Posts: 40
Joined: Mon Mar 14, 2016 5:34 am

Re: fail to read atapi on ahci

Post by nlg »

from what it seems to me nothing, the bit corresponding to the command in the register port command issue does not go back to zero and the transferred byte counter in PRDT remains at zero
I consider that the command failed after 2s without change, on the same device I can make an identify packet device without problem
Post Reply