MCPcopy Create free account
hub / github.com/coreboot/coreboot / set_vga_bridge_bits

Function set_vga_bridge_bits

src/device/device.c:217–283  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

215
216struct device *vga_pri = NULL;
217static void set_vga_bridge_bits(void)
218{
219 /*
220 * FIXME: Modify set_vga_bridge() so it is less PCI-centric!
221 * This function knows too much about PCI stuff, it should be just
222 * an iterator/visitor.
223 */
224
225 /* FIXME: Handle the VGA palette snooping. */
226 struct device *dev, *vga, *vga_onboard;
227 struct bus *bus;
228
229 bus = 0;
230 vga = 0;
231 vga_onboard = 0;
232
233 dev = NULL;
234 while ((dev = dev_find_class(PCI_CLASS_DISPLAY_VGA << 8, dev))) {
235 if (!dev->enabled)
236 continue;
237
238 printk(BIOS_DEBUG, "found VGA at %s\n", dev_path(dev));
239 if (dev->upstream->no_vga16) {
240 printk(BIOS_WARNING,
241 "A bridge on the path doesn't support 16-bit VGA decoding!");
242 }
243
244 if (dev->on_mainboard)
245 vga_onboard = dev;
246 else
247 vga = dev;
248
249 /* It isn't safe to enable all VGA cards. */
250 dev->command &= ~(PCI_COMMAND_MEMORY | PCI_COMMAND_IO);
251 }
252
253 if (!vga)
254 vga = vga_onboard;
255
256 if (CONFIG(ONBOARD_VGA_IS_PRIMARY) && vga_onboard)
257 vga = vga_onboard;
258
259 /* If we prefer plugin VGA over chipset VGA, the chipset might
260 want to know. */
261 if (!CONFIG(ONBOARD_VGA_IS_PRIMARY) && (vga != vga_onboard) &&
262 vga_onboard && vga_onboard->ops && vga_onboard->ops->vga_disable) {
263 printk(BIOS_DEBUG, "Use plugin graphics over integrated.\n");
264 vga_onboard->ops->vga_disable(vga_onboard);
265 }
266
267 if (vga) {
268 /* VGA is first add-on card or the only onboard VGA. */
269 printk(BIOS_DEBUG, "Setting up VGA for %s\n", dev_path(vga));
270 /* All legacy VGA cards have MEM & I/O space registers. */
271 vga->command |= (PCI_COMMAND_MEMORY | PCI_COMMAND_IO);
272 vga_pri = vga;
273 bus = vga->upstream;
274 }

Callers 1

dev_configureFunction · 0.85

Calls 3

dev_find_classFunction · 0.85
dev_pathFunction · 0.85
printkFunction · 0.50

Tested by

no test coverage detected