From 9a962277a86f05e2cd9b845549ae14f3f99224d8 Mon Sep 17 00:00:00 2001 From: aaron Date: Fri, 27 Oct 2017 07:45:02 +0000 Subject: [PATCH] git-svn-id: https://spexeah.com:8443/svn/Asuro@273 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c --- src/driver/AHCI.pas | 40 ++++++++++++++++++++------------------ src/driver/PCI.pas | 8 +++----- src/driver/drivertypes.pas | 4 ++++ 3 files changed, 28 insertions(+), 24 deletions(-) diff --git a/src/driver/AHCI.pas b/src/driver/AHCI.pas index 655763af..3774c772 100644 --- a/src/driver/AHCI.pas +++ b/src/driver/AHCI.pas @@ -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. \ No newline at end of file diff --git a/src/driver/PCI.pas b/src/driver/PCI.pas index 87947dd4..04125f55 100644 --- a/src/driver/PCI.pas +++ b/src/driver/PCI.pas @@ -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; diff --git a/src/driver/drivertypes.pas b/src/driver/drivertypes.pas index 5f244cc1..35226dd4 100644 --- a/src/driver/drivertypes.pas +++ b/src/driver/drivertypes.pas @@ -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