emulation/foundation-armv8: add support for armv8 mainboard

This is a cpu supported by the foundation emulator. This will not build
at all without my cbfstool changes.

Not that our chromiumos qemu for x86 is months behind upstream.

BUG=None
TEST=breaks no builds
BRANCH=None
Signed-off-by: Ronald G. Minnich <rminnich@google.com>

Change-Id: I0e7df1a2d3801778e83c89ff18285b026403adc0
Reviewed-on: https://chromium-review.googlesource.com/180355
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Tested-by: Ronald Minnich <rminnich@chromium.org>
Reviewed-by: Ronald Minnich <rminnich@chromium.org>
Commit-Queue: Ronald Minnich <rminnich@chromium.org>
This commit is contained in:
Ronald G. Minnich 2013-11-25 10:05:16 -08:00 committed by chrome-internal-fetch
commit 89cbd15c95
10 changed files with 378 additions and 0 deletions

View file

@ -6,6 +6,9 @@ choice
config BOARD_EMULATION_QEMU_X86
bool "QEMU x86"
config BOARD_EMULATION_FOUNDATION_ARMV8
bool "Foundation ARMV8 (may also work in qemu)"
config BOARD_EMULATION_QEMU_ARMV7
bool "QEMU armv7 (vexpress-a9)"
@ -13,6 +16,7 @@ endchoice
source "src/mainboard/emulation/qemu-x86/Kconfig"
source "src/mainboard/emulation/qemu-armv7/Kconfig"
source "src/mainboard/emulation/foundation-armv8/Kconfig"
config MAINBOARD_VENDOR
string

View file

@ -0,0 +1,106 @@
##
## This file is part of the coreboot project.
##
## 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.
if BOARD_EMULATION_FOUNDATION_ARMV8
config BOARD_SPECIFIC_OPTIONS # dummy
def_bool y
select ARCH_AARCH64
select CPU_ARMLTD_ARMV8
select HAVE_UART_MEMORY_MAPPED
select HAVE_UART_SPECIAL
select BOARD_ROMSIZE_KB_4096
config MAINBOARD_DIR
string
default emulation/foundation-armv8
config MAINBOARD_PART_NUMBER
string
default "FOUNDATION ARMV8"
config MAX_CPUS
int
default 1
config MAINBOARD_VENDOR
string
default "ARM Ltd."
config BOOTBLOCK_MAINBOARD_INIT
string
default "mainboard/emulation/foundation-armv8/bootblock.c"
config DRAM_SIZE_MB
int
default 1024
# Memory map
#
# 0xA000_0000: first instruction (called from BL3)
config BOOTBLOCK_BASE
hex
default 0xA0000000
config ID_SECTION_BASE
hex
default 0xA001f000
config ROMSTAGE_BASE
hex
default 0xA0020000
config ROMSTAGE_SIZE
hex
default 0x20000
config BOOTBLOCK_ROM_OFFSET
hex
default 0x0
config CBFS_HEADER_ROM_OFFSET
hex
default 0x0100000
config CBFS_ROM_OFFSET
hex
default 0x0110000
config IRAM_STACK
hex
default 0x0007ff00
config XIP_ROM_SIZE
hex
default ROMSTAGE_SIZE
config SYS_SDRAM_BASE
hex "SDRAM base address"
default 0x01000000
config SYS_TEXT_BASE
hex "Executable code section"
default 0x04e00000
config RAMBASE
hex
default SYS_SDRAM_BASE
# according to stefan, this is RAMBASE + 1M.
config RAMTOP
hex
default 0x01100000
endif # BOARD_EMULATION_FOUNDATION_ARMV8

View file

@ -0,0 +1,27 @@
##
## This file is part of the coreboot project.
##
## 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.
romstage-y += romstage.c
bootblock-y += media.c
romstage-y += media.c
ramstage-y += media.c
bootblock-y += timer.c
romstage-y += timer.c
ramstage-y += timer.c
bootblock-$(CONFIG_BOOTBLOCK_CONSOLE) += uart.c
romstage-$(CONFIG_EARLY_CONSOLE) += uart.c
ramstage-y += uart.c

View file

@ -0,0 +1,25 @@
/*
* This file is part of the coreboot project.
*
* 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.
*/
#include <console/console.h>
void bootblock_mainboard_init(void);
void bootblock_mainboard_init(void)
{
/* if you want a banner in the bootblock, you'll have to call
* console_init.
*/
//printk(BIOS_INFO, "\n\n\n%s: ARMv7 Emulation Started.\n", __func__);
}

View file

@ -0,0 +1,20 @@
##
## This file is part of the coreboot project.
##
## 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.
# TODO fill with Versatile Express board data in QEMU.
chip cpu/armltd/cortex-a9
chip drivers/generic/generic # I2C0 controller
device i2c 6 on end # Fake component for testing
end
end

View file

@ -0,0 +1,27 @@
/*
* This file is part of the coreboot project.
*
* 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.
*/
#include <console/console.h>
#include <device/device.h>
static void mainboard_enable(device_t dev)
{
printk(BIOS_INFO, "Enable foundation/armv8 device...\n");
}
struct chip_operations mainboard_ops = {
.enable_dev = mainboard_enable,
};

View file

@ -0,0 +1,58 @@
/*
* This file is part of the coreboot project.
*
* 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.
*/
#include <cbfs.h>
#include <string.h>
#include <console/console.h>
/* Simple memory-mapped ROM emulation. */
static int emu_rom_open(struct cbfs_media *media) {
return 0;
}
static void *emu_rom_map(struct cbfs_media *media,
size_t offset, size_t count) {
return (void*)(offset + CONFIG_BOOTBLOCK_BASE);
}
static void *emu_rom_unmap(struct cbfs_media *media, const void *address) {
return NULL;
}
static size_t emu_rom_read(struct cbfs_media *media, void *dest, size_t offset,
size_t count) {
void *ptr = emu_rom_map(media, offset, count);
memcpy(dest, ptr, count);
emu_rom_unmap(media, ptr);
return count;
}
static int emu_rom_close(struct cbfs_media *media) {
return 0;
}
int init_emu_rom_cbfs_media(struct cbfs_media *media);
int init_emu_rom_cbfs_media(struct cbfs_media *media) {
media->open = emu_rom_open;
media->close = emu_rom_close;
media->map = emu_rom_map;
media->unmap = emu_rom_unmap;
media->read = emu_rom_read;
return 0;
}
int init_default_cbfs_media(struct cbfs_media *media) {
return init_emu_rom_cbfs_media(media);
}

View file

@ -0,0 +1,29 @@
/*
* This file is part of the coreboot project.
*
* 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.
*/
#include <cbfs.h>
#include <console/console.h>
#include <arch/stages.h>
void main(void)
{
void *entry;
console_init();
entry = cbfs_load_stage(CBFS_DEFAULT_MEDIA, "fallback/coreboot_ram");
stage_exit(entry);
}

View file

@ -0,0 +1,24 @@
/*
* This file is part of the coreboot project.
*
* 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.
*/
#include <delay.h>
void udelay(unsigned int n) {
/* TODO provide delay here. */
}
int init_timer(void) {
return 0;
}

View file

@ -0,0 +1,58 @@
/*
* This file is part of the coreboot project.
*
* 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.
*/
#include <console/console.h>
#include <uart.h>
static void pl011_init_dev(void) {
}
static void pl011_uart_tx_byte(unsigned char data) {
static volatile unsigned int *uart0_address = (void *)0;
*uart0_address = (unsigned int)data;
}
static void pl011_uart_tx_flush(void) {
}
#if !defined(__PRE_RAM__)
static const struct console_driver pl011_uart_console __console = {
.init = pl011_init_dev,
.tx_byte = pl011_uart_tx_byte,
.tx_flush = pl011_uart_tx_flush,
};
uint32_t uartmem_getbaseaddr(void)
{
return 0;
}
#else
void uart_init(void)
{
pl011_init_dev();
}
void uart_tx_byte(unsigned char data)
{
pl011_uart_tx_byte(data);
}
void uart_tx_flush(void) {
pl011_uart_tx_flush();
}
#endif