Fucking errors.

git-svn-id: https://spexeah.com:8443/svn/Asuro@298 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
kieron 2018-04-05 09:00:39 +00:00
parent 925e1390ad
commit 9c0884e4a1
2 changed files with 29 additions and 31 deletions

View File

@ -16,7 +16,8 @@ uses
PCI, PCI,
drivertypes, drivertypes,
drivermanagement, drivermanagement,
lmemorymanager; lmemorymanager,
console;
type type
@ -160,8 +161,7 @@ type
ports : array[0..31] of THBA_Port; ports : array[0..31] of THBA_Port;
end; end;
THBAptr : ^THBA_MEM; THBAptr = ^THBA_MEM;
intptr : ^uint32;
TCommand_Header = bitpacked record TCommand_Header = bitpacked record
cfl : ubit5; cfl : ubit5;
@ -180,13 +180,6 @@ type
rsv1 : array[0..3] of uint32; rsv1 : array[0..3] of uint32;
end; end;
TCommand_Table = bitpacked record
cfis : array[0..64] of uint8;
acmd : array[0..16] of uint8;
rsv : array[0..48] of uint8;
prdt : array[0..1] of TPRD_Entry;
end;
TPRD_Entry = bitpacked record TPRD_Entry = bitpacked record
data_base_address : uint32; data_base_address : uint32;
data_bade_address_U : uint32; data_bade_address_U : uint32;
@ -196,6 +189,13 @@ type
interrupt_oc : boolean; interrupt_oc : boolean;
end; end;
TCommand_Table = bitpacked record
cfis : array[0..64] of uint8;
acmd : array[0..16] of uint8;
rsv : array[0..48] of uint8;
prdt : array[0..1] of TPRD_Entry;
end;
var var
//constants //constants
//SATA_SIG_ATA := $101; //SATA_SIG_ATA := $101;
@ -203,17 +203,17 @@ var
//STA_SIG_SEMB := $C33C0101; //STA_SIG_SEMB := $C33C0101;
//STAT_SIG_PM := $96690101; //STAT_SIG_PM := $96690101;
//other //other
ahciController : intptr; ahciController : PuInt32;
hba : THBAptr; hba : THBAptr;
sataStorageDevices : array[0..31] of intptr; sataStorageDevices : array[0..31] of PuInt32;
sataStorageDeviceCount : uint8; sataStorageDeviceCount : uint8;
procedure init(); procedure init();
procedure check_ports(); procedure check_ports();
function register_device(ptr:void): boolean; function load(ptr:void): boolean;
implementation implementation
@ -223,15 +223,16 @@ var
begin begin
console.writestringln('AHCI: STARTING INIT'); console.writestringln('AHCI: STARTING INIT');
//PCI_Devices := PCI.getDeviceInfo(1, 6, 0, count); //PCI_Devices := PCI.getDeviceInfo(1, 6, 0, count);
drivermanagement.register_driver($010600, register_device) drivermanagement.register_driver($010600, @load)
end; end;
function register_device(ptr : void) : boolean function load(ptr : void) : boolean;
begin begin
ahciController := ptr; ahciController := ptr;
hba := ahciController.address5; hba := THBAptr(PPCI_Device(ahciController)^.address5);
check_ports(); check_ports();
exit(true); load:= true;
exit;
end; end;
procedure check_ports(); procedure check_ports();
@ -239,26 +240,23 @@ var
d : uint32; d : uint32;
i : uint32; i : uint32;
ii : uint32; ii : uint32;
activePorts : array[0..32] of uint32;
begin begin
d:= 1; d:= 1;
activePorts : array[0..32] of uint32;
for i:= 0 to 31 do begin for i:= 0 to 31 do begin
if d and hba^.port_implemented != 0 then // port connected if (d > 0) and (hba^.port_implemented <> 0) then begin // port connected
begin if hba^.ports[i].ssts = 259 then begin // port in use and active
if hba^.ports[i].ssts == 259 then // port in use and active if hba^.ports[i].sig = 1 then begin //device is sata
begin
if hba^.ports[i].sig == 1 then //device is sata
begin
sataStorageDevices[sataStorageDeviceCount - 1] := @hba^.ports[i]; sataStorageDevices[sataStorageDeviceCount - 1] := @hba^.ports[i];
sataStorageDeviceCount += 1; sataStorageDeviceCount += 1;
end end;
//TODO implement other types //TODO implement other types
end end;
end end;
d := d shl 1; d := d shl 1;
end end;
end;
end
end. end.

View File

@ -12,7 +12,7 @@ interface
type type
PPCI_Device = ^TPCI_Device;
TPCI_Device = bitpacked record TPCI_Device = bitpacked record
device_id : uint16; device_id : uint16;
vendor_id : uint16; vendor_id : uint16;