git-svn-id: https://spexeah.com:8443/svn/Asuro@225 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
parent
bfeadc08da
commit
f94f0d4850
@ -224,7 +224,7 @@ var
|
|||||||
|
|
||||||
procedure init();
|
procedure init();
|
||||||
procedure loadConfig(bus : uint8; slot : uint8; func : uint8; offset : uint8);
|
procedure loadConfig(bus : uint8; slot : uint8; func : uint8; offset : uint8);
|
||||||
function check_device(bus : uint8; device : uint8) : boolean;
|
function check_device(bus : uint8; device : uint8; func : uint8) : boolean;
|
||||||
|
|
||||||
function get_vendor_ID(bus : uint8; slot : uint8; func : uint8; offset : uint8) : uint16;
|
function get_vendor_ID(bus : uint8; slot : uint8; func : uint8; offset : uint8) : uint16;
|
||||||
function isDevice(bus : uint8; slot : uint8; func : uint8; offset : uint8) : ubit2;
|
function isDevice(bus : uint8; slot : uint8; func : uint8; offset : uint8) : ubit2;
|
||||||
@ -242,11 +242,12 @@ procedure init();
|
|||||||
var
|
var
|
||||||
i : uint16;
|
i : uint16;
|
||||||
ii : uint16;
|
ii : uint16;
|
||||||
|
iii : uint8;
|
||||||
begin
|
begin
|
||||||
//enumerate pci bus
|
//enumerate pci bus
|
||||||
for ii:=0 to 256 do begin
|
for ii:=0 to 256 do begin
|
||||||
for i:=0 to 31 do begin
|
for i:=0 to 31 do begin
|
||||||
check_device(ii, i);
|
check_device(ii, i, 0);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -259,29 +260,39 @@ var
|
|||||||
begin
|
begin
|
||||||
packetI := ($1 shl 31);
|
packetI := ($1 shl 31);
|
||||||
packetI := packetI or (bus shl 16);
|
packetI := packetI or (bus shl 16);
|
||||||
packetI := packetI or (slot shl 11);
|
packetI := packetI or ((slot) shl 11);
|
||||||
packetI := packetI or (func shl 8);
|
packetI := packetI or ((func) shl 8);
|
||||||
packetI := packetI or (offset shl 2);
|
packetI := packetI or ((offset) shl 2);
|
||||||
|
|
||||||
outl($CF8, uint32(packetI));
|
outl($CF8, uint32(packetI));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function check_device(bus : uint8; device : uint8) : boolean;
|
function check_device(bus : uint8; device : uint8; func : uint8) : boolean;
|
||||||
var
|
var
|
||||||
vendor_id : uint16;
|
vendor_id : uint16;
|
||||||
isDeviceb : uint8;
|
isDeviceb : uint8;
|
||||||
|
i : uint8;
|
||||||
begin
|
begin
|
||||||
|
|
||||||
vendor_id := get_vendor_ID(bus, device, 0, 0);
|
vendor_id := get_vendor_ID(bus, device, 0, 0);
|
||||||
if vendor_id = $FFFF then exit;
|
if vendor_id = $FFFF then exit;
|
||||||
|
|
||||||
isDeviceb := isDevice(bus, device, 0, 8);
|
isDeviceb := isDevice(bus, device, 0, 8);
|
||||||
if isDeviceb = 1 then begin
|
if isDeviceb >= 0 then begin
|
||||||
devices[device_count] := read_device_config(bus, device, 0, 0);
|
devices[device_count] := read_device_config(bus, device, 0, 0);
|
||||||
device_count := device_count + 1;
|
device_count := device_count + 1;
|
||||||
|
if devices[device_count - 1].header_type and $80 <> 0 then begin
|
||||||
|
for i:=0 to 8 do begin
|
||||||
|
// console.writechar(char(21));
|
||||||
|
vendor_id := get_vendor_ID(bus, device, i, 0);
|
||||||
|
//if vendor_id = $FFFF then exit(false);
|
||||||
|
devices[device_count] := read_device_config(bus, device, i, 0);
|
||||||
|
device_count := device_count + 1;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
check_device := true;
|
check_device := true;
|
||||||
end else begin
|
end else begin
|
||||||
console.writestringln('PCI: Nested bus found');
|
//console.writestringln('PCI: Nested bus found');
|
||||||
//busses[bus_count] := read_bridge_config();
|
//busses[bus_count] := read_bridge_config();
|
||||||
bus_count := bus_count + 1;
|
bus_count := bus_count + 1;
|
||||||
check_device := false;
|
check_device := false;
|
||||||
@ -406,6 +417,8 @@ begin
|
|||||||
tmp.interrupt_pin := read8(bus, slot, func, off, 1);
|
tmp.interrupt_pin := read8(bus, slot, func, off, 1);
|
||||||
tmp.interrupt_line := read8(bus, slot, func, off, 0);
|
tmp.interrupt_line := read8(bus, slot, func, off, 0);
|
||||||
|
|
||||||
|
if(tmp.vendor_id <> $FFFF) then begin
|
||||||
|
|
||||||
console.writestring('PCI: Found Device: ');
|
console.writestring('PCI: Found Device: ');
|
||||||
console.writehex(slot);
|
console.writehex(slot);
|
||||||
console.writestring(' ');
|
console.writestring(' ');
|
||||||
@ -417,6 +430,7 @@ begin
|
|||||||
console.writestring(' ');
|
console.writestring(' ');
|
||||||
console.writehexln(tmp.subclass_class);
|
console.writehexln(tmp.subclass_class);
|
||||||
|
|
||||||
|
|
||||||
if tmp.class_code = 1 then begin
|
if tmp.class_code = 1 then begin
|
||||||
console.writestringln('-Device is MASS_STORAGE_CONTROLLER ');
|
console.writestringln('-Device is MASS_STORAGE_CONTROLLER ');
|
||||||
end;
|
end;
|
||||||
@ -426,6 +440,7 @@ begin
|
|||||||
if tmp.class_code = 3 then begin
|
if tmp.class_code = 3 then begin
|
||||||
console.writestringln('-Device is DISPLAY_CONTROLLER ');
|
console.writestringln('-Device is DISPLAY_CONTROLLER ');
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
//psleep(300);
|
//psleep(300);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user