git-svn-id: https://spexeah.com:8443/svn/Asuro@321 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c

This commit is contained in:
aaron 2018-04-05 13:28:14 +00:00
parent ad764964fd
commit 4d644e7ae9

View File

@ -223,7 +223,7 @@ procedure enable_cmd(port : uint8);
procedure disable_cmd(port : uint8); procedure disable_cmd(port : uint8);
procedure port_rebase(port : uint8); procedure port_rebase(port : uint8);
function load(ptr:void): boolean; function load(ptr:void): boolean;
function read(port : uint8; startl : uint32; starth : uint32; count : uint32; buf : PuInt16) : uint32; function read(port : uint8; startl : uint32; starth : uint32; count : uint32; buf : PuInt16) : boolean;
function write(port : uint8; startl : uint32; starth : uint32; count : uint32; buf : PuInt16) : uint32; function write(port : uint8; startl : uint32; starth : uint32; count : uint32; buf : PuInt16) : uint32;
function find_cmd_slot(port : uint8) : uint32; function find_cmd_slot(port : uint8) : uint32;
@ -314,7 +314,7 @@ begin
enable_cmd(port); enable_cmd(port);
end; end;
function read(port : uint8; startl : uint32; starth : uint32; count : uint32; buf : PuInt16) : uint32; function read(port : uint8; startl : uint32; starth : uint32; count : uint32; buf : PuInt16) : boolean;
var var
pport : PHBA_PORT; pport : PHBA_PORT;
slot : uint32; slot : uint32;
@ -363,31 +363,35 @@ begin
cmdfis^.count_low := count and $FF; cmdfis^.count_low := count and $FF;
cmdfis^.count_high:= (count shr 8) and $FF; cmdfis^.count_high:= (count shr 8) and $FF;
{while (port^.tfd and $88) and (spin < 1000000) do begin while (pport^.tfd and $88) = $88 and spin < 1000000 do begin
spin += 1; spin += 1;
end; end;
if spin = 1000000 then begin if spin = 1000000 then begin
console.writestringln('AHCI controller: port is hung!'); console.writestringln('AHCI controller: port is hung!');
read:= false;
exit; exit;
end; end;
port^.ci := 1 shl slot; pport^.ci := 1 shl slot;
while true do begin while true do begin
if(port^.ci and (1 shl slot)) = 0 then break; if(pport^.ci and (1 shl slot)) = 0 then break;
if(port^.istat and (1 shl 30)) then begin if(pport^.istat and (1 shl 30)) then begin
console.writestringln('AHCI controller: Disk read error!'); console.writestringln('AHCI controller: Disk read error!');
read:= false;
exit; exit;
end; end;
end; end;
if(port^.istat and (1 shl 30)) then begin if(pport^.istat and (1 shl 30)) = (1 shl 30) then begin
console.writestringln('AHCI controller: Disk read error!'); console.writestringln('AHCI controller: Disk read error!');
read:= false;
exit; exit;
end; end;
exit;} read:= true;
exit;
end; end;
function write(port : uint8; startl : uint32; starth : uint32; count : uint32; buf : PuInt16) : uint32; function write(port : uint8; startl : uint32; starth : uint32; count : uint32; buf : PuInt16) : uint32;