Kyösti Mälkki (kyosti.malkki@gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4309
-gerrit
commit 8446a2313a81a324ae09e5ae8c54602540bcb949 Author: Kyösti Mälkki kyosti.malkki@gmail.com Date: Thu Nov 28 16:44:51 2013 +0200
ChromeOS: Move oprom_is_loaded to device
Change-Id: I7e1afd752f18e5346dabdee62e4f7ea08ada5faf Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com --- src/device/pci_device.c | 8 +------- src/include/device/device.h | 4 ++++ src/mainboard/google/bolt/chromeos.c | 2 +- src/mainboard/google/butterfly/chromeos.c | 2 +- src/mainboard/google/falco/chromeos.c | 2 +- src/mainboard/google/link/chromeos.c | 2 +- src/mainboard/google/link/i915.c | 4 +--- src/mainboard/google/parrot/chromeos.c | 2 +- src/mainboard/google/peppy/chromeos.c | 2 +- src/mainboard/google/rambi/chromeos.c | 2 +- src/mainboard/google/slippy/chromeos.c | 2 +- src/mainboard/google/slippy/gma.c | 4 +--- src/mainboard/google/stout/chromeos.c | 2 +- src/mainboard/google/stout/i915.c | 4 +--- src/mainboard/intel/baskingridge/chromeos.c | 2 +- src/mainboard/intel/emeraldlake2/chromeos.c | 2 +- src/mainboard/intel/wtm2/chromeos.c | 2 +- src/mainboard/intel/wtm2/i915.c | 4 +--- src/mainboard/lenovo/x60/i915.c | 3 +-- src/mainboard/samsung/lumpy/chromeos.c | 2 +- src/mainboard/samsung/stumpy/chromeos.c | 2 +- src/northbridge/intel/haswell/gma.c | 13 +++++++++++++ src/northbridge/intel/i945/gma.c | 4 +++- src/northbridge/intel/sandybridge/gma.c | 15 ++++++++++++++- src/vendorcode/google/chromeos/chromeos.h | 1 - 25 files changed, 54 insertions(+), 38 deletions(-)
diff --git a/src/device/pci_device.c b/src/device/pci_device.c index aa0d954..24d0552 100644 --- a/src/device/pci_device.c +++ b/src/device/pci_device.c @@ -659,10 +659,6 @@ void pci_dev_set_subsystem(struct device *dev, unsigned vendor, unsigned device) ((device & 0xffff) << 16) | (vendor & 0xffff)); }
-#if CONFIG_CHROMEOS -int oprom_is_loaded = 0; -#endif - /** Default handler: only runs the relevant PCI BIOS. */ void pci_dev_init(struct device *dev) { @@ -703,10 +699,8 @@ void pci_dev_init(struct device *dev) return;
run_bios(dev, (unsigned long)ram); -#if CONFIG_CHROMEOS - oprom_is_loaded = 1; + dev->oprom_is_loaded = 1; printk(BIOS_DEBUG, "VGA Option ROM has been loaded\n"); -#endif #endif /* CONFIG_VGA_ROM_RUN */ }
diff --git a/src/include/device/device.h b/src/include/device/device.h index dfebeaa..defed78 100644 --- a/src/include/device/device.h +++ b/src/include/device/device.h @@ -98,6 +98,8 @@ struct device { unsigned int enabled : 1; /* set if we should enable the device */ unsigned int initialized : 1; /* set if we have initialized the device */ unsigned int on_mainboard : 1; + unsigned int oprom_is_loaded : 1; + unsigned int native_init_done : 1; struct pci_irq_info pci_irq_info[4]; u8 command;
@@ -135,6 +137,8 @@ extern const char mainboard_name[]; extern uint64_t uma_memory_base; extern uint64_t uma_memory_size;
+int gfx_init_done(void); + /* Generic device interface functions */ device_t alloc_dev(struct bus *parent, struct device_path *path); void dev_initialize_chips(void); diff --git a/src/mainboard/google/bolt/chromeos.c b/src/mainboard/google/bolt/chromeos.c index 76f2c31..e244750 100644 --- a/src/mainboard/google/bolt/chromeos.c +++ b/src/mainboard/google/bolt/chromeos.c @@ -79,7 +79,7 @@ void fill_lb_gpios(struct lb_gpios *gpios) fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "lid", get_lid_switch()); fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "power", 0); - fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "oprom", oprom_is_loaded); + fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "oprom", gfx_init_done()); } #endif
diff --git a/src/mainboard/google/butterfly/chromeos.c b/src/mainboard/google/butterfly/chromeos.c index b5a645f..e571c46 100644 --- a/src/mainboard/google/butterfly/chromeos.c +++ b/src/mainboard/google/butterfly/chromeos.c @@ -93,7 +93,7 @@ void fill_lb_gpios(struct lb_gpios *gpios) /* Was VGA Option ROM loaded? */ gpios->gpios[5].port = -1; /* Indicate that this is a pseudo GPIO */ gpios->gpios[5].polarity = ACTIVE_HIGH; - gpios->gpios[5].value = oprom_is_loaded; + gpios->gpios[5].value = gfx_init_done(); strncpy((char *)gpios->gpios[5].name,"oprom", GPIO_MAX_NAME_LENGTH);
} diff --git a/src/mainboard/google/falco/chromeos.c b/src/mainboard/google/falco/chromeos.c index 51d625b..9df39b3 100644 --- a/src/mainboard/google/falco/chromeos.c +++ b/src/mainboard/google/falco/chromeos.c @@ -76,7 +76,7 @@ void fill_lb_gpios(struct lb_gpios *gpios) fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "lid", get_lid_switch()); fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "power", 0); - fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "oprom", oprom_is_loaded); + fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "oprom", gfx_init_done()); } #endif
diff --git a/src/mainboard/google/link/chromeos.c b/src/mainboard/google/link/chromeos.c index dd1606f..96d86e2 100644 --- a/src/mainboard/google/link/chromeos.c +++ b/src/mainboard/google/link/chromeos.c @@ -88,7 +88,7 @@ void fill_lb_gpios(struct lb_gpios *gpios) /* Did we load the VGA Option ROM? */ gpios->gpios[5].port = -1; /* Indicate that this is a pseudo GPIO */ gpios->gpios[5].polarity = ACTIVE_HIGH; - gpios->gpios[5].value = oprom_is_loaded; + gpios->gpios[5].value = gfx_init_done(); strncpy((char *)gpios->gpios[5].name,"oprom", GPIO_MAX_NAME_LENGTH); } #endif diff --git a/src/mainboard/google/link/i915.c b/src/mainboard/google/link/i915.c index a38760b..2b62bf4 100644 --- a/src/mainboard/google/link/i915.c +++ b/src/mainboard/google/link/i915.c @@ -58,7 +58,6 @@ static unsigned int graphics; static unsigned short addrport; static unsigned short dataport; static unsigned int physbase; -extern int oprom_is_loaded; static u32 htotal, hblank, hsync, vtotal, vblank, vsync;
const u32 link_edid_data[] = { @@ -379,6 +378,5 @@ int i915lightup(unsigned int pphysbase, unsigned int piobase, printk(BIOS_SPEW, "%ld microseconds\n", globalmicroseconds()); set_vbe_mode_info_valid(&edid, graphics); i915_init_done = 1; - oprom_is_loaded = 1; - return 0; + return i915_init_done; } diff --git a/src/mainboard/google/parrot/chromeos.c b/src/mainboard/google/parrot/chromeos.c index 6f50a79..6eea9d6 100644 --- a/src/mainboard/google/parrot/chromeos.c +++ b/src/mainboard/google/parrot/chromeos.c @@ -84,7 +84,7 @@ void fill_lb_gpios(struct lb_gpios *gpios) /* Did we load the VGA Option ROM? */ gpios->gpios[5].port = -1; /* Indicate that this is a pseudo GPIO */ gpios->gpios[5].polarity = ACTIVE_HIGH; - gpios->gpios[5].value = oprom_is_loaded; + gpios->gpios[5].value = gfx_init_done(); strncpy((char *)gpios->gpios[5].name,"oprom", GPIO_MAX_NAME_LENGTH);
} diff --git a/src/mainboard/google/peppy/chromeos.c b/src/mainboard/google/peppy/chromeos.c index 51d625b..9df39b3 100644 --- a/src/mainboard/google/peppy/chromeos.c +++ b/src/mainboard/google/peppy/chromeos.c @@ -76,7 +76,7 @@ void fill_lb_gpios(struct lb_gpios *gpios) fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "lid", get_lid_switch()); fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "power", 0); - fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "oprom", oprom_is_loaded); + fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "oprom", gfx_init_done()); } #endif
diff --git a/src/mainboard/google/rambi/chromeos.c b/src/mainboard/google/rambi/chromeos.c index f6f13ed..87402d7 100644 --- a/src/mainboard/google/rambi/chromeos.c +++ b/src/mainboard/google/rambi/chromeos.c @@ -78,7 +78,7 @@ void fill_lb_gpios(struct lb_gpios *gpios) get_developer_mode_switch()); fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "lid", get_lid_switch()); fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "power", 0); - fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "oprom", oprom_is_loaded); + fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "oprom", gfx_init_done()); } #endif
diff --git a/src/mainboard/google/slippy/chromeos.c b/src/mainboard/google/slippy/chromeos.c index 51d625b..9df39b3 100644 --- a/src/mainboard/google/slippy/chromeos.c +++ b/src/mainboard/google/slippy/chromeos.c @@ -76,7 +76,7 @@ void fill_lb_gpios(struct lb_gpios *gpios) fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "lid", get_lid_switch()); fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "power", 0); - fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "oprom", oprom_is_loaded); + fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "oprom", gfx_init_done()); } #endif
diff --git a/src/mainboard/google/slippy/gma.c b/src/mainboard/google/slippy/gma.c index e698fc9..f2f93b1 100644 --- a/src/mainboard/google/slippy/gma.c +++ b/src/mainboard/google/slippy/gma.c @@ -89,7 +89,6 @@ static unsigned int graphics; static unsigned short addrport; static unsigned short dataport; static unsigned int physbase; -extern int oprom_is_loaded;
static int ioread = 0, iowrite = 0;
@@ -462,10 +461,9 @@ int i915lightup(unsigned int pphysbase, unsigned int piobase,
set_vbe_mode_info_valid(&dp->edid, graphics); i915_init_done = 1; - oprom_is_loaded = 1; //io_i915_write32( 0x80000000,BLC_PWM_CPU_CTL2); //io_i915_write32( 0x80000000,BLC_PWM_PCH_CTL1); - return 1; + return i915_init_done;
fail: printk(BIOS_SPEW, "Graphics could not be started;"); diff --git a/src/mainboard/google/stout/chromeos.c b/src/mainboard/google/stout/chromeos.c index 7a861ec..1bb312c 100644 --- a/src/mainboard/google/stout/chromeos.c +++ b/src/mainboard/google/stout/chromeos.c @@ -85,7 +85,7 @@ void fill_lb_gpios(struct lb_gpios *gpios) /* Was VGA Option ROM loaded? */ gpios->gpios[5].port = -1; /* Indicate that this is a pseudo GPIO */ gpios->gpios[5].polarity = ACTIVE_HIGH; - gpios->gpios[5].value = oprom_is_loaded; + gpios->gpios[5].value = gfx_init_done(); strncpy((char *)gpios->gpios[5].name,"oprom", GPIO_MAX_NAME_LENGTH);
/* EC is in RW mode when it isn't in recovery mode. */ diff --git a/src/mainboard/google/stout/i915.c b/src/mainboard/google/stout/i915.c index 8085de6..4ebd567 100644 --- a/src/mainboard/google/stout/i915.c +++ b/src/mainboard/google/stout/i915.c @@ -41,7 +41,6 @@ static unsigned int graphics; static unsigned short addrport; static unsigned short dataport; static unsigned int physbase; -extern int oprom_is_loaded;
#define READ32(addr) io_i915_READ32(addr) #define WRITE32(val, addr) io_i915_WRITE32(val, addr) @@ -278,6 +277,5 @@ int i915lightup(unsigned int pphysbase, memset((void *)graphics, 0, 4520*4096); printk(BIOS_SPEW, "%ld microseconds\n", globalmicroseconds()); i915_init_done = 1; - oprom_is_loaded = 1; - return 0; + return i915_init_done; } diff --git a/src/mainboard/intel/baskingridge/chromeos.c b/src/mainboard/intel/baskingridge/chromeos.c index 6bf5116..3ff60e7 100644 --- a/src/mainboard/intel/baskingridge/chromeos.c +++ b/src/mainboard/intel/baskingridge/chromeos.c @@ -81,7 +81,7 @@ void fill_lb_gpios(struct lb_gpios *gpios) /* Did we load the VGA option ROM? */ gpios->gpios[5].port = -1; gpios->gpios[5].polarity = ACTIVE_HIGH; - gpios->gpios[5].value = oprom_is_loaded; + gpios->gpios[5].value = gfx_init_done(); strncpy((char *)gpios->gpios[5].name,"oprom", GPIO_MAX_NAME_LENGTH); } #endif diff --git a/src/mainboard/intel/emeraldlake2/chromeos.c b/src/mainboard/intel/emeraldlake2/chromeos.c index 4d998ec..806537f 100644 --- a/src/mainboard/intel/emeraldlake2/chromeos.c +++ b/src/mainboard/intel/emeraldlake2/chromeos.c @@ -80,7 +80,7 @@ void fill_lb_gpios(struct lb_gpios *gpios) /* Did we load the VGA option ROM? */ gpios->gpios[5].port = -1; gpios->gpios[5].polarity = ACTIVE_HIGH; - gpios->gpios[5].value = oprom_is_loaded; + gpios->gpios[5].value = gfx_init_done(); strncpy((char *)gpios->gpios[5].name,"oprom", GPIO_MAX_NAME_LENGTH); } #endif diff --git a/src/mainboard/intel/wtm2/chromeos.c b/src/mainboard/intel/wtm2/chromeos.c index 594b4a7..be55373 100644 --- a/src/mainboard/intel/wtm2/chromeos.c +++ b/src/mainboard/intel/wtm2/chromeos.c @@ -61,7 +61,7 @@ void fill_lb_gpios(struct lb_gpios *gpios) fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "developer", DEV_MODE_SETTING); fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "lid", 1); // force open fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "power", 0); - fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "oprom", oprom_is_loaded); + fill_lb_gpio(gpio++, -1, ACTIVE_HIGH, "oprom", gfx_init_done()); } #endif
diff --git a/src/mainboard/intel/wtm2/i915.c b/src/mainboard/intel/wtm2/i915.c index b664c35..64fa6b1 100644 --- a/src/mainboard/intel/wtm2/i915.c +++ b/src/mainboard/intel/wtm2/i915.c @@ -70,7 +70,6 @@ static unsigned int graphics; static unsigned short addrport; static unsigned short dataport; static unsigned int physbase; -extern int oprom_is_loaded;
const u32 link_edid_data[] = { 0xffffff00, 0x00ffffff, 0x0379e430, 0x00000000, @@ -220,8 +219,7 @@ int i915lightup(unsigned int pphysbase, unsigned int piobase, */
i915_init_done = 1; - oprom_is_loaded = 1; - return 1; + return i915_init_done;
fail: printk(BIOS_SPEW, "Graphics could not be started;"); diff --git a/src/mainboard/lenovo/x60/i915.c b/src/mainboard/lenovo/x60/i915.c index 4870fd8..e430d3a 100644 --- a/src/mainboard/lenovo/x60/i915.c +++ b/src/mainboard/lenovo/x60/i915.c @@ -369,5 +369,4 @@ int i915lightup(unsigned int pphysbase, unsigned int piobase,
set_vbe_mode_info_valid(&edid, graphics);
- return 0; -} + return 1;} diff --git a/src/mainboard/samsung/lumpy/chromeos.c b/src/mainboard/samsung/lumpy/chromeos.c index afbdeeb..c2b51d2 100644 --- a/src/mainboard/samsung/lumpy/chromeos.c +++ b/src/mainboard/samsung/lumpy/chromeos.c @@ -86,7 +86,7 @@ void fill_lb_gpios(struct lb_gpios *gpios) /* Did we load the VGA Option ROM? */ gpios->gpios[5].port = -1; /* Indicate that this is a pseudo GPIO */ gpios->gpios[5].polarity = ACTIVE_HIGH; - gpios->gpios[5].value = oprom_is_loaded; + gpios->gpios[5].value = gfx_init_done(); strncpy((char *)gpios->gpios[5].name,"oprom", GPIO_MAX_NAME_LENGTH); } #endif diff --git a/src/mainboard/samsung/stumpy/chromeos.c b/src/mainboard/samsung/stumpy/chromeos.c index e639fd3..0f2e094 100644 --- a/src/mainboard/samsung/stumpy/chromeos.c +++ b/src/mainboard/samsung/stumpy/chromeos.c @@ -83,7 +83,7 @@ void fill_lb_gpios(struct lb_gpios *gpios) /* Did we load the VGA Option ROM? */ gpios->gpios[5].port = -1; /* Indicate that this is a pseudo GPIO */ gpios->gpios[5].polarity = ACTIVE_HIGH; - gpios->gpios[5].value = oprom_is_loaded; + gpios->gpios[5].value = gfx_init_done(); strncpy((char *)gpios->gpios[5].name,"oprom", GPIO_MAX_NAME_LENGTH); } #endif diff --git a/src/northbridge/intel/haswell/gma.c b/src/northbridge/intel/haswell/gma.c index 2ceffe4..32a7214 100644 --- a/src/northbridge/intel/haswell/gma.c +++ b/src/northbridge/intel/haswell/gma.c @@ -119,6 +119,7 @@ u32 map_oprom_vendev(u32 vendev) return new_vendev; }
+static device_t gma_dev; static struct resource *gtt_res = NULL;
static inline u32 gtt_read(u32 reg) @@ -408,6 +409,8 @@ static void gma_func0_init(struct device *dev)
int i915lightup(u32 physbase, u32 iobase, u32 mmiobase, u32 gfx); lightup_ok = i915lightup(physbase, iobase, mmiobase, graphics_base); + if (lightup_ok) + dev->native_init_done = 1; #endif if (! lightup_ok) { printk(BIOS_SPEW, "FUI did not run; using VBIOS\n"); @@ -416,6 +419,16 @@ static void gma_func0_init(struct device *dev)
/* Post VBIOS init */ gma_pm_init_post_vbios(dev); + + if (dev->oprom_is_loaded || dev->native_init_done) + gma_dev = dev; +} + +int gfx_init_done(void) +{ + if (gma_dev) + return (gma_dev->oprom_is_loaded || gma_dev->native_init_done); + return 0; }
static void gma_set_subsystem(device_t dev, unsigned vendor, unsigned device) diff --git a/src/northbridge/intel/i945/gma.c b/src/northbridge/intel/i945/gma.c index 433152c..bdc3748 100644 --- a/src/northbridge/intel/i945/gma.c +++ b/src/northbridge/intel/i945/gma.c @@ -63,7 +63,9 @@ static void gma_func0_init(struct device *dev) );
int i915lightup(u32 physbase, u32 iobase, u32 mmiobase, u32 gfx); - i915lightup(uma_memory_base, iobase, mmiobase, graphics_base); + int lightup_ok = i915lightup(uma_memory_base, iobase, mmiobase, graphics_base); + if (lightup_ok) + dev->native_init_done = 1; #endif
} diff --git a/src/northbridge/intel/sandybridge/gma.c b/src/northbridge/intel/sandybridge/gma.c index b9a07a2..0fa5dee 100644 --- a/src/northbridge/intel/sandybridge/gma.c +++ b/src/northbridge/intel/sandybridge/gma.c @@ -330,6 +330,7 @@ u32 map_oprom_vendev(u32 vendev) return new_vendev; }
+static device_t gma_dev; static struct resource *gtt_res = NULL;
static inline u32 gtt_read(u32 reg) @@ -649,8 +650,20 @@ static void gma_func0_init(struct device *dev) graphics_base = dev->resource_list[1].base;
int i915lightup(u32 physbase, u32 iobase, u32 mmiobase, u32 gfx); - i915lightup(physbase, iobase, mmiobase, graphics_base); + int lightup_ok = i915lightup(physbase, iobase, mmiobase, graphics_base); + if (lightup_ok) + dev->native_init_done = 1; #endif + + if (dev->oprom_is_loaded || dev->native_init_done) + gma_dev = dev; +} + +int gfx_init_done(void) +{ + if (gma_dev) + return (gma_dev->oprom_is_loaded || gma_dev->native_init_done); + return 0; }
static void gma_set_subsystem(device_t dev, unsigned vendor, unsigned device) diff --git a/src/vendorcode/google/chromeos/chromeos.h b/src/vendorcode/google/chromeos/chromeos.h index 0af26dc..f6b7dee 100644 --- a/src/vendorcode/google/chromeos/chromeos.h +++ b/src/vendorcode/google/chromeos/chromeos.h @@ -34,7 +34,6 @@ void save_chromeos_gpios(void); /* functions implemented in vbnv.c: */ int get_recovery_mode_from_vbnv(void); int vboot_wants_oprom(void); -extern int oprom_is_loaded;
void read_vbnv(uint8_t *vbnv_copy); void save_vbnv(const uint8_t *vbnv_copy);