Page 1 of 1

Bochs VBE device not present in PCI

Posted: Sat Aug 26, 2017 6:38 am
by dborowiec10
Hello,

I am trying to set up my kernel to work with bochs VBE extension.

I have all the correct configuration in the script such as:
vgaromimage: .../VGABIOS-lgpl-latest
vga: extension=vbe

From what I understand, a device on PCI should appear with the following:
vendor_id: 0x1111, device id: 0x1234
I could then grab BAR0 and get the correct linear framebuffer address.

This works well when I run my kernel in qemu but in bochs, it does not appear.
Interestingly, when I start playing about with setting vbe resolutions and modes they all seem to be working
and the display changes its size.
It must be a bochs specific setting that Im missing or something along those lines.

Could someone point me in the right direction here?

Thanks!

Re: Bochs VBE device not present in PCI

Posted: Sat Aug 26, 2017 7:10 am
by BrightLight
There are two types of BGA: PCI and ISA. For PCI, you read the framebuffer base address from BAR0, like you said. For ISA, it is hard-coded at physical address 0xE0000000.

Re: Bochs VBE device not present in PCI

Posted: Sat Aug 26, 2017 7:39 am
by dborowiec10
Oh ok.
Can you just confirm that this is the case with bochs?
Is bochs' BGA an ISA one?
Is this why qemu lists it on PCI?

Re: Bochs VBE device not present in PCI

Posted: Sat Aug 26, 2017 8:24 am
by BrightLight
Bochs uses ISA BGA by default, but you can configure it to use a PCI BGA if you want. Of course, I don't recall the configuration options, but a quick Google search will get you decent results. QEMU uses PCI BGA when you pass option "-vga std", and by default in some builds, including the one from Ubuntu's repository.

To check the existence of BGA at all, you should use the I/O ports. Specifically, you should read the BGA version register (index 0) and make sure it contains a value in the range of 0xB0C0 to 0xB0C5, inclusive. If the BGA exists, then you can determine it is a PCI or ISA BGA by scanning the PCI devices.

Re: Bochs VBE device not present in PCI

Posted: Sat Aug 26, 2017 8:42 am
by dborowiec10
That explains a lot :)

Thanks so much!

Re: Bochs VBE device not present in PCI

Posted: Sat Aug 26, 2017 9:07 am
by dborowiec10
Btw
My searching abilities are clearly lacking :D

After a bit more thourough googling I found this: http://forum.osdev.org/viewtopic.php?f=1&p=227076
Clearly explains what you just told me.

Re: Bochs VBE device not present in PCI

Posted: Sat Aug 26, 2017 4:20 pm
by BrightLight
dborowiec10 wrote:My searching abilities are clearly lacking :D
Take that into consideration next time, instead of asking answered questions. ;)