improve pci logging

This commit is contained in:
copy 2016-01-01 17:49:21 +01:00
parent 31ca64ccf6
commit 33285fc520
6 changed files with 11 additions and 5 deletions

View file

@ -20,6 +20,7 @@ function ACPI(cpu)
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x01, 0x00, 0x00,
],
pci_bars: [],
name: "acpi",
};
// 00:07.0 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 08)

View file

@ -164,6 +164,7 @@ function IDEDevice(cpu, buffer, is_cd, nr, bus)
size: 0x10,
},
];
this.name = "ide" + nr;
// 00:1f.2 IDE interface: Intel Corporation 82801JI (ICH10 Family) 4 port SATA IDE Controller #1
//0x86, 0x80, 0x20, 0x3a, 0x05, 0x00, 0xb0, 0x02, 0x00, 0x8f, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00,

View file

@ -81,6 +81,7 @@ function Ne2k(cpu, bus)
size: 32,
},
];
this.name = "ne2k";
cpu.devices.pci.register_device(this);

View file

@ -217,7 +217,7 @@ PCI.prototype.pci_query = function()
dbg_line += "enabled=" + (enabled);
dbg_line += " bdf=" + h(bdf, 4);
dbg_line += " dev=" + h(dev, 4);
dbg_line += " dev=" + h(dev, 2);
dbg_line += " addr=" + h(addr, 2);
var device = this.device_spaces[bdf];
@ -273,7 +273,7 @@ PCI.prototype.pci_write = function()
var bar = device.pci_bars[bar_nr];
//dbg_log("BAR" + bar_nr + " changed to " + h(space[addr >> 2] >>> 0) + " dev=" + h(bdf >> 3, 2), LOG_PCI);
dbg_log("BAR" + bar_nr + " changed to " + h(written >>> 0) + " dev=" + h(bdf >> 3, 2), LOG_PCI);
dbg_log("BAR" + bar_nr + " exists=" + (bar ? "y" : "n") + " changed to " + h(written >>> 0) + " dev=" + h(bdf >> 3, 2) + " (" + device.name + ") ", LOG_PCI);
if(bar)
{
@ -287,17 +287,18 @@ PCI.prototype.pci_write = function()
space[addr >> 2] = device.current_bars[bar_nr];
}
dbg_log("BAR <- " + h(space[addr >> 2] >>> 0), LOG_PCI);
dbg_assert(!(bar.size & bar.size - 1));
}
else
{
space[addr >> 2] = 0;
}
dbg_log("BAR effective value: " + h(space[addr >> 2] >>> 0), LOG_PCI);
}
else
{
dbg_log("PCI write dev=" + h(bdf >> 3, 2) + " addr=" + h(addr, 4) + " value=" + h(written >>> 0, 8), LOG_PCI);
dbg_log("PCI write dev=" + h(bdf >> 3, 2) + " (" + device.name + ") " + " addr=" + h(addr, 4) + " value=" + h(written >>> 0, 8), LOG_PCI);
space[addr >> 2] = written;
}
};
@ -310,7 +311,7 @@ PCI.prototype.register_device = function(device)
var device_id = device.pci_id;
dbg_log("PCI register bdf=" + h(device_id), LOG_PCI);
dbg_log("PCI register bdf=" + h(device_id) + " (" + device.name + ")", LOG_PCI);
dbg_assert(!this.devices[device_id]);
dbg_assert(device.pci_space.length >= 64);

View file

@ -126,6 +126,7 @@ function VGAScreen(cpu, bus, vga_memory_size)
];
this.pci_id = 0x12 << 3;
this.pci_bars = [];
this.name = "vga";
cpu.devices.pci.register_device(this);

View file

@ -23,6 +23,7 @@ function VirtIO(cpu, bus, filesystem)
size: 16,
},
];
this.name = "virtio";
cpu.devices.pci.register_device(this);