ChromeOS: Remove oprom_is_loaded

A global flag oprom_is_loaded was used to indicate to
U-boot that VGA option ROM was loaded and run, or that
native VGA init was completed on GMA device.

Implement this feature without dependency to CHROMEOS option
and replace use of global variable oprom_is_loaded with call
to gfx_get_init_done().

Change-Id: I7e1afd752f18e5346dabdee62e4f7ea08ada5faf
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: http://review.coreboot.org/4309
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@google.com>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
This commit is contained in:
Kyösti Mälkki 2013-11-28 16:44:51 +02:00
parent 926a8d1262
commit ab56b3b11c
26 changed files with 53 additions and 38 deletions

View File

@ -32,6 +32,7 @@
#include <device/device.h>
#include <device/pci.h>
#include <device/pci_ids.h>
#include <bootmode.h>
#include <delay.h>
#if CONFIG_HYPERTRANSPORT_PLUGIN_SUPPORT
#include <device/hypertransport.h>
@ -660,10 +661,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
#if CONFIG_VGA_ROM_RUN
static int should_run_oprom(struct device *dev)
{
@ -733,10 +730,8 @@ void pci_dev_init(struct device *dev)
return;
run_bios(dev, (unsigned long)ram);
#if CONFIG_CHROMEOS
oprom_is_loaded = 1;
printk(BIOS_DEBUG, "VGA Option ROM has been loaded\n");
#endif
gfx_set_init_done(1);
printk(BIOS_DEBUG, "VGA Option ROM was run\n");
#endif /* CONFIG_VGA_ROM_RUN */
}

View File

@ -23,6 +23,9 @@
int get_developer_mode_switch(void);
int get_recovery_mode_switch(void);
int gfx_get_init_done(void);
void gfx_set_init_done(int done);
#if CONFIG_BOOTMODE_STRAPS
int developer_mode_enabled(void);
int recovery_mode_enabled(void);

View File

@ -17,6 +17,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <rules.h>
#include <bootmode.h>
#if CONFIG_CHROMEOS || CONFIG_VBOOT_VERIFY_FIRMWARE
#include <vendorcode/google/chromeos/chromeos.h>
@ -61,3 +62,19 @@ int recovery_mode_enabled(void)
return 0;
}
#endif /* CONFIG_BOOTMODE_STRAPS */
#if ENV_RAMSTAGE
static int gfx_init_done = -1;
int gfx_get_init_done(void)
{
if (gfx_init_done < 0)
return 0;
return gfx_init_done;
}
void gfx_set_init_done(int done)
{
gfx_init_done = done;
}
#endif

View File

@ -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_get_init_done());
}
#endif

View File

@ -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_get_init_done();
strncpy((char *)gpios->gpios[5].name,"oprom", GPIO_MAX_NAME_LENGTH);
}

View File

@ -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_get_init_done());
}
#endif

View File

@ -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_get_init_done();
strncpy((char *)gpios->gpios[5].name,"oprom", GPIO_MAX_NAME_LENGTH);
}
#endif

View File

@ -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;
}

View File

@ -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_get_init_done();
strncpy((char *)gpios->gpios[5].name,"oprom", GPIO_MAX_NAME_LENGTH);
}

View File

@ -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_get_init_done());
}
#endif

View File

@ -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_get_init_done());
}
#endif

View File

@ -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_get_init_done());
}
#endif

View File

@ -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;");

View File

@ -82,7 +82,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_get_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. */

View File

@ -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;
}

View File

@ -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_get_init_done();
strncpy((char *)gpios->gpios[5].name,"oprom", GPIO_MAX_NAME_LENGTH);
}
#endif

View File

@ -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_get_init_done();
strncpy((char *)gpios->gpios[5].name,"oprom", GPIO_MAX_NAME_LENGTH);
}
#endif

View File

@ -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_get_init_done());
}
#endif

View File

@ -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;");

View File

@ -369,5 +369,5 @@ int i915lightup(unsigned int pphysbase, unsigned int piobase,
set_vbe_mode_info_valid(&edid, graphics);
return 0;
return 1;
}

View File

@ -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_get_init_done();
strncpy((char *)gpios->gpios[5].name,"oprom", GPIO_MAX_NAME_LENGTH);
}
#endif

View File

@ -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_get_init_done();
strncpy((char *)gpios->gpios[5].name,"oprom", GPIO_MAX_NAME_LENGTH);
}
#endif

View File

@ -19,6 +19,7 @@
#include <arch/io.h>
#include <console/console.h>
#include <bootmode.h>
#include <delay.h>
#include <device/device.h>
#include <device/pci.h>
@ -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)
gfx_set_init_done(1);
#endif
if (! lightup_ok) {
printk(BIOS_SPEW, "FUI did not run; using VBIOS\n");

View File

@ -18,6 +18,7 @@
*/
#include <console/console.h>
#include <bootmode.h>
#include <delay.h>
#include <device/device.h>
#include <device/pci.h>
@ -63,7 +64,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)
gfx_set_init_done(1);
#endif
}

View File

@ -19,6 +19,7 @@
#include <arch/io.h>
#include <console/console.h>
#include <bootmode.h>
#include <delay.h>
#include <device/device.h>
#include <device/pci.h>
@ -649,7 +650,9 @@ 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)
gfx_set_init_done(1);
#endif
}

View File

@ -33,7 +33,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);