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

View File

@ -19,8 +19,6 @@ uses
type
deviceArray = array[0..31] of TPCI_Device;
TPCI_Device_Bridge = bitpacked record
device_id : uint16;
vendor_id : uint16;
@ -71,7 +69,7 @@ var
procedure init();
procedure scanBus(bus : uint8);
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
@ -311,7 +309,7 @@ begin
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
i : uint16;
devices_out : array[0..31] of TPCI_Device;
@ -319,7 +317,7 @@ var
begin
count := 0;
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
count := count + 1;
end;

View File

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