Page 1 of 1

PCI in Bochs

Posted: Fri Mar 25, 2011 10:49 pm
by AUsername
Alright, in Bochs 2.3.7, I wrote a simple PCI implementation. It gets information about various devices connected to the PCI bus.
After running Linux to get the valid PCI device information I compared it with what my PCIGetDeviceInfo() function is returning.

Everything is valid except for bus 0, card 1, function 1.
It claims that the command register is 1 when it should be 5.

My OS: http://i.imgur.com/UXEA2.png
Linux : http://i.imgur.com/PQxeN.png

It appears to be the only time that my PCIGetDeviceInfo() function refuses to work.

Code (Please, excuse the hackishness of it, in the current state, I know it's painful to look at):
http://pastebin.com/PibQKchW

Any idea what's wrong?
We're at a loss here.

Re: PCI in Bochs

Posted: Sat Mar 26, 2011 12:45 am
by Brendan
Hi,
AUsername wrote:Alright, in Bochs 2.3.7, I wrote a simple PCI implementation. It gets information about various devices connected to the PCI bus.
After running Linux to get the valid PCI device information I compared it with what my PCIGetDeviceInfo() function is returning.

Everything is valid except for bus 0, card 1, function 1.
It claims that the command register is 1 when it should be 5.
The only difference in the command register is bit 2, which is used to enable/disable the device's ability to act as a bus master. It looks like Linux enables bus mastering (and the BIOS doesn't for backward compatibility). You might have also noticed that the value for "interface" is also different for this device (in Linux its 0x80 while in yours it's 0x00), where bit 7 is used by the device to indicate that it's currently configured for bus mastering.

Basically, your code is right, but your OS doesn't enable bus mastering on this ATA controller.


Cheers,

Brendan