[Open-graphics] re: VGA decode on PCI
tsylla at gmail.com
Fri Aug 31 15:14:14 EDT 2007
For the simple case that has been discussed the past week or so, the
answer is also simple:
When the BIOS wants to find a VGA card, it does a PCI scan, and keeps
track of all the VGA classcode devices it finds.
The BIOS "picks one" to use. This could just be the first one it
finds, or may be based on a setup option that says which to use
preferentially. If you have 2 VGA-class cards plugged in to one PCI
bus segment, each BIOS will have some way to decide on one. For the
one that gets "picked", the BIOS turns on its IO decoders in its
command register. *all the others are left off*. Then the BIOS goes
and does the PCI expansion ROM dance for that card, and the VGA BIOS
runs and initializes. There is only one place for the VGA I/O and
memory accesses to go, since all the non-primary VGA cards have IO
Later on, an OS can go do its own PCI scan, assign real BARs to the
non-primary VGA cards (or the BIOS may have done so), and run drivers
that can talk to them.
The above case is complicated by bridges and VGA palette snooping, but
the PCI spec addresses those problems, too. It is, of course,
completely up to each BIOS vendor how complaint they are to the spec's
guidelines. Another complication for the BIOS is that it must do
whatever is necessary to make sure the VGA IO and memory accesses
actually get routed to the card it wants to use.
You can get to this answer from the PCI spec and the PCI-PCI bridge
spec, or from the Mindshare PCI book.
More information about the Open-graphics