From 11a788f88e4fb83f6d687c41d56a1024ed96dfb3 Mon Sep 17 00:00:00 2001 From: kieron <kieron@6dbc8c32-bb84-406f-8558-d1cf31a0ab0c> Date: Mon, 22 May 2017 15:30:02 +0000 Subject: [PATCH] fdsfds git-svn-id: https://spexeah.com:8443/svn/Asuro@192 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c --- src/driver/PCI.pas | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/src/driver/PCI.pas b/src/driver/PCI.pas index 18140937..8ac8bc77 100644 --- a/src/driver/PCI.pas +++ b/src/driver/PCI.pas @@ -273,24 +273,35 @@ begin isDevice := 1; end; -function read8(bus : uint8; slot : uint8; func : uint8; offset : uint8; part : uint8) : uint8; -begin - loadConfig(bus, slot, func, offset); - read8 := (inl($CFC) shr (part)) and $FF; -end; - -function read16(bus : uint8; slot : uint8; func : uint8; offset : uint8; part : uint8) : uint16; -begin - loadConfig(bus, slot, func, offset); - read16 := (inl($CFC) shr (part * 2)) and $FFFF; -end; - function read32(bus : uint8; slot : uint8; func : uint8; offset : uint8) : uint32; begin loadConfig(bus, slot, func, offset); read32 := inl($CFC); end; +function read16(bus : uint8; slot : uint8; func : uint8; offset : uint8; part : uint8) : uint16; +var + input : uint32; + +begin + input:= read32(bus, slot, func, offset); + read16:= (input SHL (part * 16)) and $0000FFFF; + //loadConfig(bus, slot, func, offset); + //read16 := (inw($CFC) shr (part * 16)) and $FFFF; +end; + +function read8(bus : uint8; slot : uint8; func : uint8; offset : uint8; part : uint8) : uint8; +var + input : uint32; + +begin + //loadConfig(bus, slot, func, offset); + //read8 := (inb($CFC) shr (part * 8)) and $FF; + input:= read32(bus, slot, func, offset); + read8:= (input SHL (part * 8)) and $000000FF; +end; + + function read_device_config(bus : uint8; slot : uint8; func : uint8; offset : uint8) : TPCI_Device; var tmp : TPCI_Device;