baytrail: fix HAVE_REFCODE_BLOB build errors

When building HAVE_REFCODE_BLOB there are a couple of errors. One
is a failure building !CHROME_OS. The other is from a header
change where console_tx_byte() was declared.

Change-Id: Ia912902e8276d13b8e1716aa16c57b111579a03d
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: http://review.coreboot.org/9141
Tested-by: build bot (Jenkins)
Reviewed-by: Duncan Laurie <dlaurie@google.com>
This commit is contained in:
Aaron Durbin 2015-03-27 20:53:30 -05:00 committed by Aaron Durbin
parent 42bab14a12
commit 43b7db7df0
1 changed files with 28 additions and 22 deletions

View File

@ -21,10 +21,13 @@
#include <arch/acpi.h> #include <arch/acpi.h>
#include <cbmem.h> #include <cbmem.h>
#include <console/console.h> #include <console/console.h>
#include <console/streams.h>
#include <cpu/x86/tsc.h> #include <cpu/x86/tsc.h>
#include <rmodule.h> #include <rmodule.h>
#include <ramstage_cache.h> #include <ramstage_cache.h>
#if IS_ENABLED(CONFIG_CHROMEOS)
#include <vendorcode/google/chromeos/vboot_handoff.h> #include <vendorcode/google/chromeos/vboot_handoff.h>
#endif
#include <baytrail/ramstage.h> #include <baytrail/ramstage.h>
#include <baytrail/efi_wrapper.h> #include <baytrail/efi_wrapper.h>
@ -97,10 +100,24 @@ static void cache_refcode(const struct rmod_stage_load *rsl)
memcpy(&c->program[0], (void *)c->load_address, c->size); memcpy(&c->program[0], (void *)c->load_address, c->size);
} }
static int load_refcode_from_vboot(struct rmod_stage_load *refcode, #if IS_ENABLED(CONFIG_CHROMEOS)
struct cbfs_stage *stage) static int load_refcode_from_vboot(struct rmod_stage_load *refcode)
{ {
struct vboot_handoff *vboot_handoff;
const struct firmware_component *fwc;
struct cbfs_stage *stage;
vboot_handoff = cbmem_find(CBMEM_ID_VBOOT_HANDOFF);
fwc = &vboot_handoff->components[CONFIG_VBOOT_REFCODE_INDEX];
if (vboot_handoff == NULL ||
vboot_handoff->selected_firmware == VB_SELECT_FIRMWARE_READONLY ||
CONFIG_VBOOT_REFCODE_INDEX >= MAX_PARSED_FW_COMPONENTS ||
fwc->size == 0 || fwc->address == 0)
return -1;
printk(BIOS_DEBUG, "refcode loading from vboot rw area.\n"); printk(BIOS_DEBUG, "refcode loading from vboot rw area.\n");
stage = (void *)(uintptr_t)fwc->address;
if (rmodule_stage_load(refcode, stage) || refcode->entry == NULL) { if (rmodule_stage_load(refcode, stage) || refcode->entry == NULL) {
printk(BIOS_DEBUG, "Error loading reference code.\n"); printk(BIOS_DEBUG, "Error loading reference code.\n");
@ -108,6 +125,12 @@ static int load_refcode_from_vboot(struct rmod_stage_load *refcode,
} }
return 0; return 0;
} }
#else
static int load_refcode_from_vboot(struct rmod_stage_load *refcode)
{
return -1;
}
#endif
static int load_refcode_from_cbfs(struct rmod_stage_load *refcode) static int load_refcode_from_cbfs(struct rmod_stage_load *refcode)
{ {
@ -123,34 +146,17 @@ static int load_refcode_from_cbfs(struct rmod_stage_load *refcode)
static efi_wrapper_entry_t load_reference_code(void) static efi_wrapper_entry_t load_reference_code(void)
{ {
struct vboot_handoff *vboot_handoff;
const struct firmware_component *fwc;
struct rmod_stage_load refcode = { struct rmod_stage_load refcode = {
.cbmem_id = CBMEM_ID_REFCODE, .cbmem_id = CBMEM_ID_REFCODE,
.name = CONFIG_CBFS_PREFIX "/refcode", .name = CONFIG_CBFS_PREFIX "/refcode",
}; };
int ret;
if (acpi_is_wakeup_s3()) { if (acpi_is_wakeup_s3()) {
return load_refcode_from_cache(); return load_refcode_from_cache();
} }
vboot_handoff = cbmem_find(CBMEM_ID_VBOOT_HANDOFF); if (load_refcode_from_vboot(&refcode) ||
fwc = &vboot_handoff->components[CONFIG_VBOOT_REFCODE_INDEX]; load_refcode_from_cbfs(&refcode))
if (vboot_handoff == NULL ||
vboot_handoff->selected_firmware == VB_SELECT_FIRMWARE_READONLY ||
CONFIG_VBOOT_REFCODE_INDEX >= MAX_PARSED_FW_COMPONENTS ||
fwc->size == 0 || fwc->address == 0) {
ret = load_refcode_from_cbfs(&refcode);
} else {
ret = load_refcode_from_vboot(&refcode, (void *)fwc->address);
if (ret < 0)
ret = load_refcode_from_cbfs(&refcode);
}
if (ret < 0)
return NULL; return NULL;
/* Cache loaded reference code. */ /* Cache loaded reference code. */