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

This commit is contained in:
aaron 2017-10-27 07:45:02 +00:00
parent ad922cf3ad
commit 9a962277a8
3 changed files with 28 additions and 24 deletions

View File

@ -7,14 +7,12 @@
* Contributors: * Contributors:
************************************************ } ************************************************ }
unit AHCI unit AHCI;
interface interface
uses uses
system,
util, util,
isr46,
PCI, PCI,
drivertypes; drivertypes;
@ -23,10 +21,14 @@ type
//Struct hell //Struct hell
TFIS_Type = ( TFIS_Type = (
REG_H2D, REG_D2H, REG_H2D = $27,
DMA_ACT, DMA_SETUP, REG_D2H = $34,
DATA, BIST, DMA_ACT = $39,
PIO_SETUP, DEV_BITS DMA_SETUP = $41,
DATA = $46,
BIST = $58,
PIO_SETUP = $5F,
DEV_BITS = $A0
); );
TFIS_REG_H2D = bitpacked record TFIS_REG_H2D = bitpacked record
@ -81,23 +83,23 @@ type
data : ^uint32; data : ^uint32;
end; end;
TFIS_PIO_Setup bitpakced record // TFIS_PIO_Setup = bitpacked record
end; // end;
TFIS_DMA_Setup bitpacked record // TFIS_DMA_Setup = bitpacked record
end; // end;
THBA_Memory bitpacked record // THBA_Memory = bitpacked record
end; // end;
THBA_Port bitpacked record // THBA_Port = bitpacked record
end; // end;
THBA_FIS bitpacked record // THBA_FIS = bitpacked record
end; // end;
var var
PCI_Devices : array [0..31] of TPCI_Device; PCI_Devices : TDeviceArray;
procedure init(); procedure init();
@ -107,7 +109,7 @@ procedure init();
var var
count : uint16; count : uint16;
begin begin
PCI_Devices := PCI.getDeviceInfo(1, 6, @count); //PCI_Devices := PCI.getDeviceInfo(1, 6, @count);
end; end;
end. end.

View File

@ -19,8 +19,6 @@ uses
type type
deviceArray = array[0..31] of TPCI_Device;
TPCI_Device_Bridge = bitpacked record TPCI_Device_Bridge = bitpacked record
device_id : uint16; device_id : uint16;
vendor_id : uint16; vendor_id : uint16;
@ -71,7 +69,7 @@ var
procedure init(); procedure init();
procedure scanBus(bus : uint8); procedure scanBus(bus : uint8);
function loadDeviceConfig(bus : uint8; slot : uint8; func : uint8) : boolean; function loadDeviceConfig(bus : uint8; slot : uint8; func : uint8) : boolean;
function getDeviceInfo(class_code : uint8; subclass_code : uint8; var count : uint32) : deviceArray; //(Will in future)returns TPCI_DEVICE.vendor_id := 0xFFFF if no device found. function getDeviceInfo(class_code : uint8; subclass_code : uint8; prog_if : uint8; var count : uint32) : TdeviceArray; //(Will in future)returns TPCI_DEVICE.vendor_id := 0xFFFF if no device found.
implementation implementation
@ -311,7 +309,7 @@ begin
end; end;
function getDeviceInfo(class_code : uint8; subclass_code : uint8; var count : uint32) : deviceArray; function getDeviceInfo(class_code : uint8; subclass_code : uint8; prog_if : uint8; var count : uint32) : TDeviceArray;
var var
i : uint16; i : uint16;
devices_out : array[0..31] of TPCI_Device; devices_out : array[0..31] of TPCI_Device;
@ -319,7 +317,7 @@ var
begin begin
count := 0; count := 0;
for i:=0 to device_count do begin for i:=0 to device_count do begin
if (devices[i].class_code = class_code) and (devices[i].subclass_class = subclass_code) then begin if (devices[i].class_code = class_code) and (devices[i].subclass_class = subclass_code) and (devices[i].prog_if = prog_if) then begin
devices_out[i] := devices[i]; //prog_if devices_out[i] := devices[i]; //prog_if
count := count + 1; count := count + 1;
end; end;

View File

@ -12,6 +12,7 @@ interface
type type
TPCI_Device = bitpacked record TPCI_Device = bitpacked record
device_id : uint16; device_id : uint16;
vendor_id : uint16; vendor_id : uint16;
@ -45,6 +46,9 @@ type
interrupt_line : uint8; interrupt_line : uint8;
end; end;
TDeviceArray = array[0..31] of TPCI_Device;
implementation implementation