git-svn-id: https://spexeah.com:8443/svn/Asuro@269 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
parent
3814785a54
commit
6be02440e2
@ -14,7 +14,9 @@
|
|||||||
uses
|
uses
|
||||||
system,
|
system,
|
||||||
util,
|
util,
|
||||||
isr46;
|
isr46,
|
||||||
|
PCI,
|
||||||
|
drivertypes;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -27,7 +29,7 @@
|
|||||||
PIO_SETUP, DEV_BITS
|
PIO_SETUP, DEV_BITS
|
||||||
);
|
);
|
||||||
|
|
||||||
TFIS_REG_H2D bitpacked record
|
TFIS_REG_H2D = bitpacked record
|
||||||
fis_type : uint8;
|
fis_type : uint8;
|
||||||
port_mult : UBit4;
|
port_mult : UBit4;
|
||||||
rsv0 : UBit3;
|
rsv0 : UBit3;
|
||||||
@ -49,7 +51,7 @@
|
|||||||
rsvl : uint32;
|
rsvl : uint32;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TFIS_REG_D2H bitpacked record
|
TFIS_REG_D2H = bitpacked record
|
||||||
fis_type : uint8;
|
fis_type : uint8;
|
||||||
port_mult : UBit4;
|
port_mult : UBit4;
|
||||||
rsv0 : UBit2;
|
rsv0 : UBit2;
|
||||||
@ -71,7 +73,7 @@
|
|||||||
rsv4 : uint32;
|
rsv4 : uint32;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TFIS_Data bitpacked record
|
TFIS_Data = bitpacked record
|
||||||
fis_type : uint8;
|
fis_type : uint8;
|
||||||
port_mult : UBit4;
|
port_mult : UBit4;
|
||||||
rsv0 : UBit4;
|
rsv0 : UBit4;
|
||||||
@ -95,7 +97,17 @@
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
|
PCI_Devices : array [0..31] of TPCI_Device;
|
||||||
|
|
||||||
|
procedure init();
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
procedure init();
|
||||||
|
var
|
||||||
|
count : uint16;
|
||||||
|
begin
|
||||||
|
PCI_Devices := PCI.getDeviceInfo(1, 6, @count);
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
@ -18,6 +18,9 @@ uses
|
|||||||
ATA;
|
ATA;
|
||||||
|
|
||||||
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;
|
||||||
@ -63,12 +66,13 @@ var
|
|||||||
|
|
||||||
device_count : uint16;
|
device_count : uint16;
|
||||||
bus_count : uint8 = 1;
|
bus_count : uint8 = 1;
|
||||||
|
get_device_count : uint8;
|
||||||
|
|
||||||
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) : TPCI_Device; //returns TPCI_DEVICE.vendor_id := 0xFFFF if no device found.
|
function getDeviceInfo(class_code : uint8; subclass_code : uint8; count : intptr) : deviceArray; //(Will in future)returns TPCI_DEVICE.vendor_id := 0xFFFF if no device found.
|
||||||
//TODO KEIRON HOW SHOULD I RETUNR MULTIPLE DEVICE IN A NICE WAY
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
procedure init();
|
procedure init();
|
||||||
@ -78,8 +82,6 @@ begin
|
|||||||
console.writestringln('PCI: INIT BEGIN.');
|
console.writestringln('PCI: INIT BEGIN.');
|
||||||
console.writestringln('PCI: Scanning Bus: 0');
|
console.writestringln('PCI: Scanning Bus: 0');
|
||||||
scanBus(0);
|
scanBus(0);
|
||||||
scanbus(1);
|
|
||||||
scanbus(2);
|
|
||||||
|
|
||||||
//while unscanned busses scan busses
|
//while unscanned busses scan busses
|
||||||
current_bus := 1;
|
current_bus := 1;
|
||||||
@ -292,18 +294,34 @@ begin
|
|||||||
console.writestring(' ');
|
console.writestring(' ');
|
||||||
console.writehex(device.device_id);
|
console.writehex(device.device_id);
|
||||||
console.writestring(' ');
|
console.writestring(' ');
|
||||||
console.writehex(device.vendor_id);
|
|
||||||
console.writestring(' ');
|
|
||||||
console.writehex(device.class_code);
|
console.writehex(device.class_code);
|
||||||
console.writestring(' ');
|
console.writestring(' ');
|
||||||
console.writehexln(device.subclass_class);
|
console.writehex(device.subclass_class);
|
||||||
|
console.writestring(' ');
|
||||||
|
console.writehexln(device.prog_if);
|
||||||
|
|
||||||
devices[device_count] := device;
|
devices[device_count] := device;
|
||||||
device_count := device_count + 1;
|
device_count := device_count + 1;
|
||||||
|
|
||||||
|
//if device.class_code = 1 then ata.init(device);
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function getDeviceInfo(class_code : uint8; subclass_code : uint8) : TPCI_Device;
|
function getDeviceInfo(class_code : uint8; subclass_code : uint8; count : intptr) : deviceArray;
|
||||||
begin end;
|
var
|
||||||
|
i : uint16;
|
||||||
|
devices_out : array[0..31] of TPCI_Device;
|
||||||
|
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
|
||||||
|
devices_out[i] := devices[i]; //prog_if
|
||||||
|
count^ := count^ + 1;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
getDeviceInfo := devices_out;
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
@ -118,12 +118,6 @@ begin
|
|||||||
mouse.init();
|
mouse.init();
|
||||||
console.writestringln('DRIVERS: INIT END.');
|
console.writestringln('DRIVERS: INIT END.');
|
||||||
|
|
||||||
//temp := 8294;
|
|
||||||
//ata.write(uint32(@temp), 10, 4);
|
|
||||||
//temp := 1234;
|
|
||||||
//ata.read(uint32(@temp), 10, 4);
|
|
||||||
//console.writeintln(temp);
|
|
||||||
|
|
||||||
console.writestringln('');
|
console.writestringln('');
|
||||||
console.setdefaultattribute(console.combinecolors(Green, Black));
|
console.setdefaultattribute(console.combinecolors(Green, Black));
|
||||||
console.writestringln('Asuro Booted Correctly!');
|
console.writestringln('Asuro Booted Correctly!');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user