summaryrefslogtreecommitdiff
path: root/src/devices/device.c
diff options
context:
space:
mode:
authorYinghai Lu <yinghailu@gmail.com>2005-01-17 21:37:12 +0000
committerYinghai Lu <yinghailu@gmail.com>2005-01-17 21:37:12 +0000
commit1f1085b433187f64f3d12961faad6e745a42c286 (patch)
treef1cc14ef4fcb4cbba459edea7e57e06f495714c5 /src/devices/device.c
parentc507e4de737108b6acb022ffd1a0b5678ea8062e (diff)
downloadcoreboot-1f1085b433187f64f3d12961faad6e745a42c286.tar.xz
linkb_to_host and addon display card override onboard card.
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1880 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'src/devices/device.c')
-rw-r--r--src/devices/device.c60
1 files changed, 35 insertions, 25 deletions
diff --git a/src/devices/device.c b/src/devices/device.c
index 40d3f5cf2d..e4e8f24344 100644
--- a/src/devices/device.c
+++ b/src/devices/device.c
@@ -363,35 +363,44 @@ void compute_allocate_resource(
}
-
#if CONFIG_CONSOLE_VGA == 1
+device_t vga_pri = 0;
static void allocate_vga_resource(void)
{
#warning "FIXME modify allocate_vga_resource so it is less pci centric!"
#warning "This function knows to much about PCI stuff, it should be just a ietrator/visitor."
/* FIXME handle the VGA pallette snooping */
- struct device *dev, *vga;
+ struct device *dev, *vga, *vga_onboard;
struct bus *bus;
bus = 0;
vga = 0;
+ vga_onboard = 0;
for (dev = all_devices; dev; dev = dev->next) {
+ if ( !dev->enabled ) continue;
if (((dev->class >> 16) == PCI_BASE_CLASS_DISPLAY) &&
((dev->class >> 8) != PCI_CLASS_DISPLAY_OTHER)) {
if (!vga) {
- printk_debug("Allocating VGA resource %s\n", dev_path(dev));
- vga = dev;
- }
- if (vga == dev) {
- /* All legacy VGA cards have MEM & I/O space registers */
- dev->command |= PCI_COMMAND_MEMORY | PCI_COMMAND_IO;
- } else {
- /* It isn't safe to enable other VGA cards */
- dev->command &= ~(PCI_COMMAND_MEMORY | PCI_COMMAND_IO);
+ if (dev->on_mainboard) {
+ vga_onboard = dev;
+ }
+ else {
+ vga = dev;
+ }
}
+ /* It isn't safe to enable other VGA cards */
+ dev->command &= ~(PCI_COMMAND_MEMORY | PCI_COMMAND_IO);
}
}
- if (vga) {
+
+ if (!vga) {
+ vga = vga_onboard;
+ }
+
+ if (vga) { // vga is first add on card or the only onboard vga
+ printk_debug("Allocating VGA resource %s\n", dev_path(vga));
+ vga->command |= (PCI_COMMAND_MEMORY | PCI_COMMAND_IO);
+ vga_pri = vga;
bus = vga->bus;
}
/* Now walk up the bridges setting the VGA enable */
@@ -402,8 +411,10 @@ static void allocate_vga_resource(void)
bus = (bus == bus->dev->bus)? 0 : bus->dev->bus;
}
}
+
#endif
+
/**
* @brief Assign the computed resources to the devices on the bus.
*
@@ -603,28 +614,27 @@ void dev_initialize(void)
printk_info("Initializing devices...\n");
#if CONFIG_CONSOLE_VGA == 1
- for (dev = all_devices; dev; dev = dev->next) {
- if ( !dev->enabled ) continue;
- if (dev->enabled && !dev->initialized &&
- dev->ops && dev->ops->init)
- {
- if( !dev->on_mainboard ) continue; // process addon card in second run
- else if( dev->rom_address!=0 ) continue; // onboard and it is assigned via MB Config.lb, process it later
- printk_debug("%s init\n", dev_path(dev));
- dev->initialized = 1;
- dev->ops->init(dev);
- }
- }
-#endif
for (dev = all_devices; dev; dev = dev->next) {
if (dev->enabled && !dev->initialized &&
dev->ops && dev->ops->init)
{
+ if( !dev->on_mainboard ) continue; // process addon card in second run
+ else if( dev->rom_address!=0 ) continue; // onboard and it is assigned via MB Config.lb, process it later
printk_debug("%s init\n", dev_path(dev));
dev->initialized = 1;
dev->ops->init(dev);
}
}
+#endif
+ for (dev = all_devices; dev; dev = dev->next) {
+ if (dev->enabled && !dev->initialized &&
+ dev->ops && dev->ops->init)
+ {
+ printk_debug("%s init\n", dev_path(dev));
+ dev->initialized = 1;
+ dev->ops->init(dev);
+ }
+ }
printk_info("Devices initialized\n");
}