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

This commit is contained in:
aaron 2017-05-22 14:49:12 +00:00
parent c7c8300405
commit f3edcff711

View File

@ -112,7 +112,7 @@ type
always_0 : boolean; always_0 : boolean;
end; end;
TPCI_Device = bitpacked record TPCI_Device = packed record
device_id : uint16; device_id : uint16;
vendor_id : uint16; vendor_id : uint16;
status : uint16; status : uint16;
@ -195,7 +195,7 @@ function get_vendor_ID(bus : uint8; slot : uint8; func : uint8; offset : uint8)
function isDevice(bus : uint8; slot : uint8; func : uint8; offset : uint8) : ubit2; function isDevice(bus : uint8; slot : uint8; func : uint8; offset : uint8) : ubit2;
function read8(bus : uint8; slot : uint8; func : uint8; offset : uint8; part : uint8) : uint8; function read8(bus : uint8; slot : uint8; func : uint8; offset : uint8; part : uint8) : uint8;
function read16(bus : uint8; slot : uint8; func : uint8; offset : uint8; part : ubit2) : uint16; function read16(bus : uint8; slot : uint8; func : uint8; offset : uint8; part : uint8) : uint16;
function read32(bus : uint8; slot : uint8; func : uint8; offset : uint8) : uint32; function read32(bus : uint8; slot : uint8; func : uint8; offset : uint8) : uint32;
function read_device_config(bus : uint8; slot : uint8; func : uint8; offset : uint8) : TPCI_Device; function read_device_config(bus : uint8; slot : uint8; func : uint8; offset : uint8) : TPCI_Device;
@ -228,7 +228,7 @@ begin
// packet.always_0 := $0; // packet.always_0 := $0;
packetI := ($1 shl 31); packetI := ($1 shl 31);
packetI := packetI or (bus shl 17); 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);
@ -275,14 +275,14 @@ end;
function read8(bus : uint8; slot : uint8; func : uint8; offset : uint8; part : uint8) : uint8; function read8(bus : uint8; slot : uint8; func : uint8; offset : uint8; part : uint8) : uint8;
begin begin
loadConfig(bus, slot, func, offset); loadConfig(bus, slot, func, offset + part);
read8 := (inb($CFC) shl (part * 8)) and $FF; read8 := inb($CFC);
end; end;
function read16(bus : uint8; slot : uint8; func : uint8; offset : uint8; part : ubit2) : uint16; function read16(bus : uint8; slot : uint8; func : uint8; offset : uint8; part : uint8) : uint16;
begin begin
loadConfig(bus, slot, func, offset); loadConfig(bus, slot, func, offset + part);
read16 := (inw($CFC) shl (part * 16)) and $FFFF; read16 := inw($CFC);
end; end;
function read32(bus : uint8; slot : uint8; func : uint8; offset : uint8) : uint32; function read32(bus : uint8; slot : uint8; func : uint8; offset : uint8) : uint32;
@ -304,20 +304,20 @@ begin
// end; // end;
tmp.device_id := read16(bus, slot, func, offset, 1); tmp.device_id := read16(bus, slot, func, offset, 2);
tmp.vendor_id := read16(bus, slot, func, offset, 0); tmp.vendor_id := read16(bus, slot, func, offset, 0);
offset := offset + $04; offset := $04;
tmp.status := read16(bus, slot, func, offset, 1); tmp.status := read16(bus, slot, func, offset, 2);
tmp.command := read16(bus, slot, func, offset, 0); tmp.command := read16(bus, slot, func, offset, 0);
offset := offset + $04; offset := $08;
tmp.class_code := read8(bus, slot, func, offset, 3); tmp.class_code := read8(bus, slot, func, offset, 3);
tmp.subclass_class := read8(bus, slot, func, offset, 2); tmp.subclass_class := read8(bus, slot, func, offset, 2);
tmp.prog_if := read8(bus, slot, func, offset, 1); tmp.prog_if := read8(bus, slot, func, offset, 1);
tmp.revision_id := read8(bus, slot, func, offset, 0); tmp.revision_id := read8(bus, slot, func, offset, 0);
offset := offset + $04; offset := $0C;
tmp.BIST := read8(bus, slot, func, offset, 3); tmp.BIST := read8(bus, slot, func, offset, 3);
tmp.header_type := read8(bus, slot, func, offset, 2); tmp.header_type := read8(bus, slot, func, offset, 2);
tmp.latency_timer := read8(bus, slot, func, offset, 1); tmp.latency_timer := read8(bus, slot, func, offset, 1);
@ -340,14 +340,14 @@ begin
tmp.CIS_pointer := read32(bus, slot, func, offset); tmp.CIS_pointer := read32(bus, slot, func, offset);
offset := offset + $04; offset := offset + $04;
tmp.subsystem_id := read16(bus, slot, func, offset, 1); tmp.subsystem_id := read16(bus, slot, func, offset, 2);
tmp.subsystem_vid := read16(bus, slot, func, offset, 0); tmp.subsystem_vid := read16(bus, slot, func, offset, 0);
offset := offset + $04; offset := offset + $04;
tmp.exp_rom_addr := read32(bus, slot, func, offset); tmp.exp_rom_addr := read32(bus, slot, func, offset);
offset := offset + $04; offset := offset + $04;
tmp.reserved0 := read16(bus, slot, func, offset, 1); tmp.reserved0 := read16(bus, slot, func, offset, 3);
tmp.reserved1 := read8(bus, slot, func, offset, 1); tmp.reserved1 := read8(bus, slot, func, offset, 1);
tmp.capabilities := read8(bus, slot, func, offset, 0); tmp.capabilities := read8(bus, slot, func, offset, 0);