Code: Select all
Initializing Bochs Graphics Adapter...
Bochs Graphics Adaptor detected.
Setting Video mode...
PCI Data: 12378086 Config address used: 80000000
PCI Data: 70008086 Config address used: 80000800
Here is the code for the BGA driver and pci list:
Code: Select all
void bgaInit()
{
printf("Initializing Bochs Graphics Adapter...\n\n");
//To write an index/data pair to one of the BGA registers, first write its index value to the 16-bit IO-port VBE_DISPI_IOPORT_INDEX (0x01CE), followed by writing the data value to the 16-bit IO-port VBE_DISPI_IOPORT_DATA (0x01CF).
outw(VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_ID);
unsigned short bga_avail = 0;
bga_avail = inw(VBE_DISPI_IOPORT_DATA);
if(bga_avail < 0xB0C4)
{
printf("You are using an outdated version of the Bochs VGA Bios or are not using a VM with BGA. Please download the latest version of Bochs, or the latest Bochs VGA Bios.\n");
return;
} else {
printf("Bochs Graphics Adaptor detected.\nSetting Video mode...\n");
}
outw(VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_ENABLE);
outw(VBE_DISPI_IOPORT_DATA, VBE_DISPI_DISABLED);
outw(VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_XRES);
outw(VBE_DISPI_IOPORT_DATA, 800);
outw(VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_YRES);
outw(VBE_DISPI_IOPORT_DATA, 600);
outw(VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_BPP);
outw(VBE_DISPI_IOPORT_DATA, VBE_DISPI_BPP_24);
//outw(VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_ENABLE);
//outw(VBE_DISPI_IOPORT_DATA, VBE_DISPI_ENABLED | VBE_DISPI_LFB_ENABLED);
unsigned long bus = 0, device = 0;
for(; bus < 256; bus++)
{
for(device = 0; device < 32; device++)
{
unsigned long pci_addr = 0x80000000 | (bus << 16) | (device << 11);
outd(0xCF8, pci_addr);
unsigned long pci_data = ind(0xCFC);
if((pci_data & 0xFFFF) != 0xFFFF)
printf("PCI Data: %.8X Config address used: %.8X\n", pci_data, pci_addr);
unsigned long pci_hdr = pci_addr | ((0x0C & 0x3F)<< 2);
outd(0xCF8, pci_hdr);
unsigned long header_type = ind(0xCFC);
header_type = (header_type >> 16) & 0x80;
if(header_type != 0)
{
for(unsigned long i = 1; i < 8; i++)
{
unsigned long pci_id = pci_addr | ((i * 7) << 7);
outd(0xCF8, pci_id);
pci_data = ind(0xCFC);
if((pci_data & 0xFFFF) == 0xFFFF)
break;
printf(" PCI Data: %.8X Config address used: %.8X\n", pci_data, pci_id);
}
}
}
}
}