From 0f1a63f0a2a773e9fa6ebb8db91bb1d2a1d22762 Mon Sep 17 00:00:00 2001 From: TomAwezome Date: Fri, 30 Dec 2022 16:26:12 -0500 Subject: [PATCH] Fix PCI write funcs val calculation. --- src/Kernel/PCI.ZC | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Kernel/PCI.ZC b/src/Kernel/PCI.ZC index 8d7c5d87..14fdfaed 100755 --- a/src/Kernel/PCI.ZC +++ b/src/Kernel/PCI.ZC @@ -69,14 +69,14 @@ U0 PCIWriteU32(I64 bus, I64 dev, I64 fun, I64 rg, I64 val) } } - U0 PCIWriteU8(I64 bus, I64 dev, I64 fun, I64 rg, I64 val) {//Write U8 in PCI configspace at bus, dev, fun, reg. if (sys_pci_services) PCIBIOSWriteU8(bus, dev, fun, rg, val); else { - PCIWriteU32(bus, dev, fun, rg, val & 0xFF); + val = PCIReadU32(bus, dev, fun, rg) & ~0xFF | val & 0xFF; + PCIWriteU32(bus, dev, fun, rg, val); } } @@ -86,7 +86,8 @@ U0 PCIWriteU16(I64 bus, I64 dev, I64 fun, I64 rg, I64 val) PCIBIOSWriteU16(bus, dev, fun, rg, val); else { - PCIWriteU32(bus, dev, fun, rg, val & 0xFFFF); + val = PCIReadU32(bus, dev, fun, rg) & ~0xFFFF | val & 0xFFFF; + PCIWriteU32(bus, dev, fun, rg, val); } }