arm: Redesign mainboard and SoC hooks for bootblock
This patch makes some slight changes to the way bootblock_cpu_init() and bootblock_mainboard_init() are used on ARM. Experience has shown that nearly every board needs either one or both of these hooks, so having explicit Kconfigs for them has become unwieldy. Instead, this patch implements them as a weak symbol that can be overridden by mainboard/SoC code, as the more recent arm64_soc_init() is also doing. Since the whole concept of a single "CPU" on ARM systems has kinda died out, rename bootblock_cpu_init() to bootblock_soc_init(). (This had already been done on Storm/ipq806x, which is now adjusted to directly use the generic hook.) Also add a proper license header to bootblock_common.h that was somehow missing. Leaving non-ARM32 architectures out for now, since they are still using the really old and weird x86 model of directly including a file. These architectures should also eventually be aligned with the cleaner ARM32 model as they mature. BRANCH=None BUG=chrome-os-partner:32123 TEST=Booted on Pinky. Compiled for Storm and confirmed in the disassembly that bootblock_soc_init() is still compiled in and called right before the (now no-op) bootblock_mainboard_init(). Change-Id: I57013b99c3af455cc3d7e78f344888d27ffb8d79 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/231940 Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
parent
df295d0432
commit
257aaee9e3
14 changed files with 37 additions and 99 deletions
|
|
@ -281,14 +281,6 @@ source src/soc/Kconfig
|
|||
|
||||
endmenu
|
||||
|
||||
config CPU_HAS_BOOTBLOCK_INIT
|
||||
bool
|
||||
default n
|
||||
|
||||
config MAINBOARD_HAS_BOOTBLOCK_INIT
|
||||
bool
|
||||
default n
|
||||
|
||||
source src/device/Kconfig
|
||||
|
||||
menu "Generic Drivers"
|
||||
|
|
|
|||
|
|
@ -26,12 +26,15 @@
|
|||
#include <cbfs.h>
|
||||
#include <console/console.h>
|
||||
|
||||
__attribute__((weak)) void bootblock_soc_init(void) { /* do nothing */ }
|
||||
__attribute__((weak)) void bootblock_mainboard_init(void) { /* do nothing */ }
|
||||
|
||||
void main(void)
|
||||
{
|
||||
const char *stage_name = "fallback/romstage";
|
||||
void *entry;
|
||||
|
||||
bootblock_cpu_init();
|
||||
bootblock_soc_init();
|
||||
bootblock_mainboard_init();
|
||||
|
||||
if (CONFIG_BOOTBLOCK_CONSOLE) {
|
||||
|
|
|
|||
|
|
@ -27,11 +27,14 @@
|
|||
#include <console/console.h>
|
||||
#include <vendorcode/google/chromeos/chromeos.h>
|
||||
|
||||
__attribute__((weak)) void bootblock_soc_init(void) { /* do nothing */ }
|
||||
__attribute__((weak)) void bootblock_mainboard_init(void) { /* do nothing */ }
|
||||
|
||||
void main(void)
|
||||
{
|
||||
void *entry = (void *)-1;
|
||||
|
||||
bootblock_cpu_init();
|
||||
bootblock_soc_init();
|
||||
bootblock_mainboard_init();
|
||||
|
||||
if (CONFIG_BOOTBLOCK_CONSOLE) {
|
||||
|
|
|
|||
|
|
@ -1,17 +1,27 @@
|
|||
#if CONFIG_CPU_HAS_BOOTBLOCK_INIT
|
||||
void bootblock_cpu_init(void);
|
||||
#else
|
||||
static void __attribute__((unused)) bootblock_cpu_init(void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* This file is part of the coreboot project.
|
||||
*
|
||||
* Copyright 2014 Google Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#if CONFIG_MAINBOARD_HAS_BOOTBLOCK_INIT
|
||||
#ifndef __ARCH_BOOTBLOCK_COMMON_H
|
||||
#define __ARCH_BOOTBLOCK_COMMON_H
|
||||
|
||||
/* These are defined as weak no-ops that can be overridden by mainboard/SoC. */
|
||||
void bootblock_mainboard_init(void);
|
||||
#else
|
||||
static void __attribute__((unused)) bootblock_mainboard_init(void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
void bootblock_soc_init(void);
|
||||
|
||||
#endif /* __ARCH_BOOTBLOCK_COMMON_H */
|
||||
|
|
|
|||
|
|
@ -6,10 +6,5 @@ config CPU_ARMLTD_ARMV8
|
|||
|
||||
if CPU_ARMLTD_ARMV8
|
||||
|
||||
config BOOTBLOCK_CPU_INIT
|
||||
string
|
||||
default "cpu/armltd/armv8/bootblock.c"
|
||||
help
|
||||
CPU/SoC-specific bootblock code.
|
||||
endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1,17 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2013 Google, Inc.
|
||||
*
|
||||
* This software is licensed under the terms of the GNU General Public
|
||||
* License version 2, as published by the Free Software Foundation, and
|
||||
* may be copied, distributed, and modified under those terms.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
void bootblock_cpu_init(void);
|
||||
void bootblock_cpu_init(void)
|
||||
{
|
||||
}
|
||||
|
|
@ -8,10 +8,4 @@ config CPU_ARMLTD_CORTEX_A9
|
|||
|
||||
if CPU_ARMLTD_CORTEX_A9
|
||||
|
||||
config BOOTBLOCK_CPU_INIT
|
||||
string
|
||||
default "cpu/armltd/cortex-a9/bootblock.c"
|
||||
help
|
||||
CPU/SoC-specific bootblock code.
|
||||
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -1,17 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2013 Google, Inc.
|
||||
*
|
||||
* This software is licensed under the terms of the GNU General Public
|
||||
* License version 2, as published by the Free Software Foundation, and
|
||||
* may be copied, distributed, and modified under those terms.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
void bootblock_cpu_init(void);
|
||||
void bootblock_cpu_init(void)
|
||||
{
|
||||
}
|
||||
|
|
@ -17,7 +17,6 @@
|
|||
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
##
|
||||
|
||||
bootblock-y += bootblock.c
|
||||
bootblock-y += cdp.c
|
||||
|
||||
romstage-y += romstage.c
|
||||
|
|
|
|||
|
|
@ -1,25 +0,0 @@
|
|||
/*
|
||||
* This file is part of the coreboot project.
|
||||
*
|
||||
* Copyright 2014 Google Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <bootblock_common.h>
|
||||
|
||||
void bootblock_mainboard_init(void)
|
||||
{
|
||||
bootblock_soc_init();
|
||||
}
|
||||
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include <bootblock_common.h>
|
||||
|
||||
void bootblock_cpu_init(void)
|
||||
void bootblock_soc_init(void)
|
||||
{
|
||||
/* TODO: I assume this is a placeholder. If it's not really needed delete it. */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
#include <symbols.h>
|
||||
#include <timestamp.h>
|
||||
|
||||
void bootblock_cpu_init(void)
|
||||
void bootblock_soc_init(void)
|
||||
{
|
||||
rk3288_init_timer();
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#include <soc/clk.h>
|
||||
#include <soc/wakeup.h>
|
||||
|
||||
void bootblock_cpu_init(void)
|
||||
void bootblock_soc_init(void)
|
||||
{
|
||||
/* kick off the multi-core timer.
|
||||
* We want to do this as early as we can.
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
#define SRAM_SIZE 1
|
||||
#define SRAM_END (SRAM_START + SRAM_SIZE) /* plus one... */
|
||||
|
||||
void bootblock_cpu_init(void)
|
||||
void bootblock_soc_init(void)
|
||||
{
|
||||
/* kick off the multi-core timer.
|
||||
* We want to do this as early as we can.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue