PCI: Host/PCI Bridge HeaderTyp == 0?
Posted: Thu Nov 26, 2009 9:01 am
Hello,
I am experimenting with the PCI-Bus. So far I can enumerate Bus 0.
On Bochs I get one Host to PCI Bridge, one PCI to ISA Bridge and one
VGA Card(Cirrus). If I search for anything on Bus 1, 2, ... I get nothing.
That's clear: I didn't tell each Bridge the primary, secondary and last bus number.
So the first Bridge I think is the Host to PCI bridge. But she returns a zero as header type.
So there is no field for the bus numbers. Should I trust the Classcode or the Headertype?
My Code for reading and writing PCI:
Testing Classcode:
And am I right, if I say every Perihperal can be accessed through PCI? DMA controller, PIC, PIT,
just everything. The only reason why we can access them with Ports too, is that the BIOS
initializes every PCI-device and set the standard I/O-Ports, right?
best regards
sebihepp
I am experimenting with the PCI-Bus. So far I can enumerate Bus 0.
On Bochs I get one Host to PCI Bridge, one PCI to ISA Bridge and one
VGA Card(Cirrus). If I search for anything on Bus 1, 2, ... I get nothing.
That's clear: I didn't tell each Bridge the primary, secondary and last bus number.
So the first Bridge I think is the Host to PCI bridge. But she returns a zero as header type.
So there is no field for the bus numbers. Should I trust the Classcode or the Headertype?
My Code for reading and writing PCI:
Code: Select all
volatile unsigned int ReadPCI(unsigned char pBus, unsigned char pDevice,
unsigned char pRegister)
{
outl(0xCF8, 0x80000000 | (pBus << 16) | ((pDevice & 0x0F) << 11) |
(0 << 8) | pRegister);
return inl(0xCFC);
}
volatile void WritePCI(unsigned char pBus, unsigned char pDevice,
unsigned char pRegister, unsigned int pValue)
{
outl(0xCF8, 0x80000000 | (pBus << 16) | ((pDevice & 0x0F) << 11) |
(0 << 8) | pRegister);
outl(0xCFC, pValue);
}
Code: Select all
if ((unsigned int)((ReadPCI(Bus, Device, 0x0C) >> 16) &
0x7F) == (unsigned int)0x00) {
just everything. The only reason why we can access them with Ports too, is that the BIOS
initializes every PCI-device and set the standard I/O-Ports, right?
best regards
sebihepp