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

This commit is contained in:
aaron 2018-04-05 16:01:04 +00:00
parent 4325dc4a61
commit 8dff8e60e1
2 changed files with 27 additions and 31 deletions

View File

@ -224,8 +224,8 @@ 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) : boolean; function read(port : uint8; startl : uint32; starth : uint32; count : uint32; buf : PuInt32) : boolean;
function write(port : uint8; startl : uint32; starth : uint32; count : uint32; buf : PuInt16) : boolean; function write(port : uint8; startl : uint32; starth : uint32; count : uint32; buf : PuInt32) : boolean;
function find_cmd_slot(port : uint8) : uint32; function find_cmd_slot(port : uint8) : uint32;
implementation implementation
@ -315,7 +315,7 @@ begin
enable_cmd(port); enable_cmd(port);
end; end;
function read(port : uint8; startl : uint32; starth : uint32; count : uint32; buf : PuInt16) : boolean; function read(port : uint8; startl : uint32; starth : uint32; count : uint32; buf : PuInt32) : boolean;
var var
pport : PHBA_PORT; pport : PHBA_PORT;
slot : uint32; slot : uint32;
@ -345,13 +345,15 @@ begin
memset(uint32(cmdTable), 0, sizeof(TCommand_Table) + (cmdheader^.PRDTL-1) * sizeof(TPRD_Entry)); memset(uint32(cmdTable), 0, sizeof(TCommand_Table) + (cmdheader^.PRDTL-1) * sizeof(TPRD_Entry));
console.writestringln('4'); console.writestringln('4');
for i:= 0 to cmdHeader^.PRDTL do begin if cmdHeader^.PRDTL > 0 then begin
for i:= 0 to cmdHeader^.PRDTL -1 do begin
cmdTable^.prdt[i].data_base_address := uint32(buf); cmdTable^.prdt[i].data_base_address := uint32(buf);
cmdTable^.prdt[i].data_byte_count := 8*1024-1; cmdTable^.prdt[i].data_byte_count := 8*1024-1;
cmdTable^.prdt[i].interrupt_oc := true; cmdTable^.prdt[i].interrupt_oc := true;
buf += 4*1024; buf += 4*1024;
count -= 16; count -= 16;
end; end;
end;
console.writestringln('5'); console.writestringln('5');
cmdTable^.prdt[i].data_base_address := uint32(buf); cmdTable^.prdt[i].data_base_address := uint32(buf);
@ -411,7 +413,7 @@ begin
exit; exit;
end; end;
function write(port : uint8; startl : uint32; starth : uint32; count : uint32; buf : PuInt16) : boolean; function write(port : uint8; startl : uint32; starth : uint32; count : uint32; buf : PuInt32) : boolean;
var var
pport : PHBA_PORT; pport : PHBA_PORT;
slot : uint32; slot : uint32;
@ -438,33 +440,27 @@ begin
console.writestringln('3'); console.writestringln('3');
cmdTable := @cmdheader^.ctba; cmdTable := @cmdheader^.ctba;
new_page_at_address(uint32(cmdTable)); new_page_at_address(uint32(cmdTable));
new_page_at_address(uint32(@cmdTable^.prdt));
memset(uint32(cmdTable), 0, sizeof(TCommand_Table) + (cmdheader^.PRDTL-1) * sizeof(TPRD_Entry)); memset(uint32(cmdTable), 0, sizeof(TCommand_Table) + (cmdheader^.PRDTL-1) * sizeof(TPRD_Entry));
console.writestringln('4'); console.writestringln('4');
console.writestring('PRDTL: '); console.writestring('PRDTL: ');
console.writeintln(cmdHeader^.PRDTL); console.writeintln(cmdHeader^.PRDTL);
//psleep(1000); if cmdHeader^.PRDTL > 0 then begin
for i:= 0 to cmdHeader^.PRDTL do begin for i:= 0 to cmdHeader^.PRDTL -1 do begin
console.writestringln('4.1');
cmdTable^.prdt[i].data_base_address := uint32(buf); cmdTable^.prdt[i].data_base_address := uint32(buf);
console.writestringln('4.2');
cmdTable^.prdt[i].data_byte_count := 8*1024-1; cmdTable^.prdt[i].data_byte_count := 8*1024-1;
console.writestringln('4.3');
cmdTable^.prdt[i].interrupt_oc := true; cmdTable^.prdt[i].interrupt_oc := true;
console.writestringln('4.4');
buf += 4*1024; buf += 4*1024;
console.writestringln('4.5');
count -= 16; count -= 16;
console.writestring('PRDTL: '); end;
console.writeintln(cmdHeader^.PRDTL);
console.writestring('i: ');
console.writeintln(i);
//psleep(1000);
end; end;
console.writestringln('5'); console.writestringln('5');
cmdTable^.prdt[i].data_base_address := uint32(buf); cmdTable^.prdt[i].data_base_address := uint32(buf);
console.writestringln('5.1');
cmdTable^.prdt[i].data_byte_count := (count shl 9)-1; cmdTable^.prdt[i].data_byte_count := (count shl 9)-1;
console.writestringln('5.2');
cmdTable^.prdt[i].interrupt_oc := true; cmdTable^.prdt[i].interrupt_oc := true;
console.writestringln('6'); console.writestringln('6');

View File

@ -70,7 +70,7 @@ var
cEIP : uint32; cEIP : uint32;
temp : uint32; temp : uint32;
atmp : puint16; atmp : puint32;
begin begin
multibootinfo:= mbinfo; multibootinfo:= mbinfo;
@ -130,15 +130,15 @@ begin
console.writestring('AHCI TEST'); console.writestring('AHCI TEST');
console.writestringln('A'); console.writestringln('A');
atmp:= puint16(kalloc(sizeof(uint16))); atmp:= puint32(kalloc(sizeof(1024*128)));
console.writestringln('B'); console.writestringln('B');
atmp^ := 4242; atmp^ := 4242;
console.writestringln('C'); console.writestringln('C');
AHCI.write(0, $5, $1, 1, atmp); AHCI.write(0, $5, $1, 32, atmp);
console.writestringln('D'); console.writestringln('D');
atmp^ := 365; atmp^ := 365;
console.writestringln('E'); console.writestringln('E');
AHCI.read(0, $5, $1, 1, atmp); AHCI.read(0, $5, $1, 32, atmp);
console.writestringln('F'); console.writestringln('F');
console.writeint(atmp^); console.writeint(atmp^);
console.writestringln('G'); console.writestringln('G');