Marc Jones (marc.jones(a)se-eng.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/8128
-gerrit
commit 1fae97eec67c0b01eb3a0523ae5b8872d5213c07
Author: Vadim Bendebury <vbendeb(a)chromium.org>
Date: Thu Jul 10 12:49:46 2014 -0700
libpayload: improve us timer accuracy
In cases where timer clock frequency is not an integer number of
megahertz, the calculations in timer_us() lack accuracy.
This patch modifies calculations to reduce the error. The maximum
interval this calculation would support decreases, but it still is in
excess of 1844674 seconds for a timer clocked by 10 MHz, which is more
than enough.
BUG=none
TEST=manual
. verified timer accuracy using a depthcharge CLI command
Original-Change-Id: Iffb323db10e74b0ce3b4d59a56983bfee12e6805
Original-Signed-off-by: Vadim Bendebury <vbendeb(a)chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/207358
Original-Reviewed-by: David Hendricks <dhendrix(a)chromium.org>
(cherry picked from commit e1abf87d438de1a04714482d5b610671e8cc0663)
Signed-off-by: Marc Jones <marc.jones(a)se-eng.com>
Change-Id: Ia892726187ab040dd235f493c92856c15951cc06
---
payloads/libpayload/libc/time.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/payloads/libpayload/libc/time.c b/payloads/libpayload/libc/time.c
index 0d81634..8d07c4f 100644
--- a/payloads/libpayload/libc/time.c
+++ b/payloads/libpayload/libc/time.c
@@ -204,5 +204,5 @@ u64 timer_us(u64 base)
}
}
- return timer_raw_value() / (hz / 1000000) - base;
+ return (1000000 * timer_raw_value()) / hz - base;
}
Marc Jones (marc.jones(a)se-eng.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/8127
-gerrit
commit 0f0e99a8558ac858732c151371c09ecb7120b619
Author: huang lin <hl(a)rock-chips.com>
Date: Fri Jun 20 11:34:46 2014 +0800
libpayload: Add Rock Chip drivers
Add support:
1)Support driver rktimer
2)Support driver rkserial
BUG=chrome-os-partner:29778
TEST=emerge-veyron libpayload
Original-Change-Id: I2cccedf3b62883dd372842a7972e93f2ebbfb282
Original-Signed-off-by: huang lin <hl(a)rock-chips.com>
Original-Reviewed-on: https://chromium-review.googlesource.com/206184
Original-Reviewed-by: Julius Werner <jwerner(a)chromium.org>
Original-Tested-by: Julius Werner <jwerner(a)chromium.org>
Original-Commit-Queue: Julius Werner <jwerner(a)chromium.org>
(cherry picked from commit 387450d7c36b201bd177d46eb9f1d280fc043aab)
Signed-off-by: Marc Jones <marc.jones(a)se-eng.com>
Change-Id: Ia6b7a8ee2439a6f2bf7577df822d3f4f3a1e441c
---
payloads/libpayload/Config.in | 12 +++
payloads/libpayload/configs/config.arm64-generic | 1 +
payloads/libpayload/configs/defconfig | 5 +-
payloads/libpayload/configs/defconfig-arm | 4 +-
payloads/libpayload/drivers/Makefile.inc | 3 +-
payloads/libpayload/drivers/serial/rk_serial.c | 115 +++++++++++++++++++++++
payloads/libpayload/drivers/timer/rktimer.c | 44 +++++++++
7 files changed, 180 insertions(+), 4 deletions(-)
diff --git a/payloads/libpayload/Config.in b/payloads/libpayload/Config.in
index a0889c8..6c95bfa 100644
--- a/payloads/libpayload/Config.in
+++ b/payloads/libpayload/Config.in
@@ -199,6 +199,11 @@ config TEGRA_SERIAL_CONSOLE
depends on SERIAL_CONSOLE
default n
+config RK_SERIAL_CONSOLE
+ bool "Rockchip SOC serial port driver"
+ depends on SERIAL_CONSOLE
+ default n
+
config IPQ806X_SERIAL_CONSOLE
bool "IPQ806x SOC compatible serial port driver"
depends on SERIAL_CONSOLE
@@ -383,6 +388,8 @@ config TIMER_TEGRA_1US
config TIMER_IPQ806X
bool "Timer for ipq806x platforms"
+config TIMER_RK
+ bool "Timer for Rockchip"
endchoice
config TIMER_MCT_HZ
@@ -395,6 +402,11 @@ config TIMER_MCT_ADDRESS
depends on TIMER_MCT
default 0x101c0000
+config TIMER_RK_ADDRESS
+ hex "Rockchip timer base address"
+ depends on TIMER_RK
+ default 0xff810020
+
config TIMER_TEGRA_1US_ADDRESS
hex "Tegra u1s timer base address"
depends on TIMER_TEGRA_1US
diff --git a/payloads/libpayload/configs/config.arm64-generic b/payloads/libpayload/configs/config.arm64-generic
index 97d865b..c2285fe 100644
--- a/payloads/libpayload/configs/config.arm64-generic
+++ b/payloads/libpayload/configs/config.arm64-generic
@@ -48,6 +48,7 @@ CONFIG_LP_TIMER_NONE=y
# CONFIG_LP_TIMER_MCT is not set
# CONFIG_LP_TIMER_TEGRA_1US is not set
# CONFIG_LP_TIMER_IPQ806X is not set
+# CONFIG_LP_TIMER_RK is not set
CONFIG_LP_USB=y
# CONFIG_LP_USB_OHCI is not set
CONFIG_LP_USB_EHCI=y
diff --git a/payloads/libpayload/configs/defconfig b/payloads/libpayload/configs/defconfig
index 1fbd961..a09a78c 100644
--- a/payloads/libpayload/configs/defconfig
+++ b/payloads/libpayload/configs/defconfig
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
# libpayload version: 0.2.0
-# Wed Dec 31 11:36:31 2014
+# Mon Jan 5 15:27:43 2015
#
#
@@ -17,8 +17,8 @@
# Architecture Options
#
# CONFIG_LP_ARCH_ARM is not set
-# CONFIG_LP_ARCH_ARM64 is not set
CONFIG_LP_ARCH_X86=y
+# CONFIG_LP_ARCH_ARM64 is not set
# CONFIG_LP_MEMMAP_RAM_ONLY is not set
# CONFIG_LP_MULTIBOOT is not set
@@ -41,6 +41,7 @@ CONFIG_LP_SERIAL_CONSOLE=y
CONFIG_LP_8250_SERIAL_CONSOLE=y
# CONFIG_LP_S5P_SERIAL_CONSOLE is not set
# CONFIG_LP_TEGRA_SERIAL_CONSOLE is not set
+# CONFIG_LP_RK_SERIAL_CONSOLE is not set
# CONFIG_LP_IPQ806X_SERIAL_CONSOLE is not set
# CONFIG_LP_PL011_SERIAL_CONSOLE is not set
CONFIG_LP_SERIAL_IOBASE=0x3f8
diff --git a/payloads/libpayload/configs/defconfig-arm b/payloads/libpayload/configs/defconfig-arm
index 862443d..b765422 100644
--- a/payloads/libpayload/configs/defconfig-arm
+++ b/payloads/libpayload/configs/defconfig-arm
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
# libpayload version: 0.2.0
-# Mon Jan 5 15:06:15 2015
+# Mon Jan 5 15:28:18 2015
#
#
@@ -40,6 +40,7 @@ CONFIG_LP_SERIAL_CONSOLE=y
# CONFIG_LP_8250_SERIAL_CONSOLE is not set
# CONFIG_LP_S5P_SERIAL_CONSOLE is not set
# CONFIG_LP_TEGRA_SERIAL_CONSOLE is not set
+# CONFIG_LP_RK_SERIAL_CONSOLE is not set
# CONFIG_LP_IPQ806X_SERIAL_CONSOLE is not set
# CONFIG_LP_SERIAL_SET_SPEED is not set
# CONFIG_LP_SERIAL_ACS_FALLBACK is not set
@@ -59,6 +60,7 @@ CONFIG_LP_TIMER_NONE=y
# CONFIG_LP_TIMER_MCT is not set
# CONFIG_LP_TIMER_TEGRA_1US is not set
# CONFIG_LP_TIMER_IPQ806X is not set
+# CONFIG_LP_TIMER_RK is not set
CONFIG_LP_USB=y
CONFIG_LP_USB_OHCI=y
CONFIG_LP_USB_EHCI=y
diff --git a/payloads/libpayload/drivers/Makefile.inc b/payloads/libpayload/drivers/Makefile.inc
index 538a8a6..0fc2faa 100644
--- a/payloads/libpayload/drivers/Makefile.inc
+++ b/payloads/libpayload/drivers/Makefile.inc
@@ -37,7 +37,7 @@ libc-$(CONFIG_LP_8250_SERIAL_CONSOLE) += serial/8250.c
libc-$(CONFIG_LP_S5P_SERIAL_CONSOLE) += serial/s5p.c
libc-$(CONFIG_LP_TEGRA_SERIAL_CONSOLE) += serial/tegra.c
libc-$(CONFIG_LP_IPQ806X_SERIAL_CONSOLE) += serial/ipq806x.c
-
+libc-$(CONFIG_LP_RK_SERIAL_CONSOLE) += serial/rk_serial.c
libc-$(CONFIG_LP_PC_KEYBOARD) += keyboard.c
libc-$(CONFIG_LP_CBMEM_CONSOLE) += cbmem_console.c
@@ -50,6 +50,7 @@ libc-$(CONFIG_LP_TIMER_MCT) += timer/mct.c
libc-$(CONFIG_LP_TIMER_RDTSC) += timer/rdtsc.c
libc-$(CONFIG_LP_TIMER_TEGRA_1US) += timer/tegra_1us.c
libc-$(CONFIG_LP_TIMER_IPQ806X) += timer/ipq806x.c
+libc-$(CONFIG_LP_TIMER_RK) += timer/rktimer.c
# Video console drivers
libc-$(CONFIG_LP_VIDEO_CONSOLE) += video/video.c
diff --git a/payloads/libpayload/drivers/serial/rk_serial.c b/payloads/libpayload/drivers/serial/rk_serial.c
new file mode 100644
index 0000000..8c3f679
--- /dev/null
+++ b/payloads/libpayload/drivers/serial/rk_serial.c
@@ -0,0 +1,115 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2014 Rockchip Electronics
+ *
+ * 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 <libpayload-config.h>
+#include <libpayload.h>
+struct rk_uart {
+ union {
+ u32 uart_thr; /*Transmit holding register.*/
+ u32 uart_rbr; /*Receive buffer register.*/
+ u32 uart_dll; /* Divisor latch lsb.*/
+ };
+ union {
+ u32 uart_ier; /*Interrupt enable register.*/
+ u32 uart_dlh; /* Divisor latch msb.*/
+ };
+ union {
+ uint32_t uart_iir; /*Interrupt identification register.*/
+ uint32_t uart_fcr; /* FIFO control register.*/
+ };
+ u32 uart_lcr;
+ u32 uart_mcr;
+ u32 uart_lsr;
+ u32 uart_msr;
+ u32 uart_scr;
+ u32 reserved1[(0x30 - 0x20) / 4];
+ u32 uart_srbr[(0x70 - 0x30) / 4];
+ u32 uart_far;
+ u32 uart_tfr;
+ u32 uart_rfw;
+ u32 uart_usr;
+ u32 uart_tfl;
+ u32 uart_rfl;
+ u32 uart_srr;
+ u32 uart_srts;
+ u32 uart_sbcr;
+ u32 uart_sdmam;
+ u32 uart_sfe;
+ u32 uart_srt;
+ u32 uart_stet;
+ u32 uart_htx;
+ u32 uart_dmasa;
+ u32 reserver2[(0xf4 - 0xac) / 4];
+ u32 uart_cpr;
+ u32 uart_ucv;
+ u32 uart_ctr;
+};
+enum {
+ UART_LSR_DR = 0x1 << 0, /*Data ready.*/
+ UART_LSR_OE = 0x1 << 1, /*Overrun.*/
+ UART_LSR_PE = 0x1 << 2, /*Parity error.*/
+ UART_LSR_FE = 0x1 << 3, /*Framing error.*/
+ UART_LSR_BI = 0x1 << 4, /*Break.*/
+ UART_LSR_THRE = 0x1 << 5, /*Xmit holding register empty.*/
+ UART_LSR_TEMT = 0x1 << 6, /*Xmitter empty.*/
+ UART_LSR_ERR = 0x1 << 7 /* Error.*/
+};
+
+static struct rk_uart *uart_regs;
+void serial_putchar(unsigned int c)
+{
+ while (!(readl(&uart_regs->uart_lsr) & UART_LSR_THRE));
+ writel((c&0xff), &uart_regs->uart_thr);
+ if (c == '\n')
+ serial_putchar('\r');
+}
+
+int serial_havechar(void)
+{
+ uint8_t lsr = readl(&uart_regs->uart_lsr);
+ return (lsr & UART_LSR_DR) == UART_LSR_DR;
+}
+
+int serial_getchar(void)
+{
+ while (!serial_havechar());
+ return readl(&uart_regs->uart_rbr)&0xff;
+}
+
+static struct console_input_driver consin = {
+ .havekey = &serial_havechar,
+ .getchar = &serial_getchar
+};
+
+static struct console_output_driver consout = {.putchar = &serial_putchar
+};
+
+void serial_init(void)
+{
+ if (!lib_sysinfo.serial || !lib_sysinfo.serial->baseaddr)
+ return;
+
+ uart_regs = (struct rk_uart *)lib_sysinfo.serial->baseaddr;
+}
+
+void serial_console_init(void)
+{
+ serial_init();
+ console_add_input_driver(&consin);
+ console_add_output_driver(&consout);
+}
diff --git a/payloads/libpayload/drivers/timer/rktimer.c b/payloads/libpayload/drivers/timer/rktimer.c
new file mode 100644
index 0000000..1634b77
--- /dev/null
+++ b/payloads/libpayload/drivers/timer/rktimer.c
@@ -0,0 +1,44 @@
+
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2014 Rockchip Electronics
+ *
+ * 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 <arch/io.h>
+#include <libpayload.h>
+#include <stdint.h>
+struct rk_timer {
+ u32 timer_load_count0;
+ u32 timer_load_count1;
+ u32 timer_curr_value0;
+ u32 timer_curr_value1;
+ u32 timer_ctrl_reg;
+ u32 timer_int_status;
+};
+uint64_t timer_hz(void)
+{
+ return 24000000;
+}
+uint64_t timer_raw_value(void)
+{
+ uint64_t upper;
+ uint64_t lower;
+ struct rk_timer *rk_timer;
+ rk_timer = (struct rk_timer *)CONFIG_LP_TIMER_RK_ADDRESS;
+ lower = (uint64_t) rk_timer->timer_curr_value0;
+ upper = (uint64_t) rk_timer->timer_curr_value1;
+ return (upper << 32) | lower;
+}
Marc Jones (marc.jones(a)se-eng.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/8126
-gerrit
commit 3d2b4f917024a9924556e0f8c93a180ff028d609
Author: Julius Werner <jwerner(a)chromium.org>
Date: Thu Jun 12 10:28:57 2014 -0700
libpayload: Reorder default memcpy, speed up memset and memcmp
The current default memcpy first copies single bytes to align the
amount, then copies the rest as full words. In practice, the start of a
buffer is much more likely to be word-aligned then the end, and aligned
word access are usually more efficient. This patch reorders those
accesses to first copy as many full words as possible and then finish
the rest with byte accesses to optimize this common case.
This fixes a data abort when using USB on ARM without CONFIG_GPL. Due to
some limitations of how DMA memory is set up in coreboot on ARM, it
currently does not support unaligned accesses. (This could be fixed with
a more complicated patch, but it's usually not an issue... unless, of
course, your memcpy happens to be braindead).
Also add word-aligned accesses to memset and memcmp while I'm at it, and
make memcmp's return value standard's compliant.
BUG=chrome-os-partner:24957
TEST=Manual
Original-Change-Id: I2a7bcb35626a05a9a43fcfd99eb958b485d7622a
Original-Signed-off-by: Julius Werner <jwerner(a)chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/203547
Original-Reviewed-by: Stefan Reinauer <reinauer(a)chromium.org>
Original-Reviewed-by: David Hendricks <dhendrix(a)chromium.org>
(cherry picked from commit 05a64d2e107e1675cc3442e6dabe14a341e55673)
Signed-off-by: Marc Jones <marc.jones(a)se-eng.com>
Change-Id: I0030ca8a203c97587b0da31a0a5e9e11b0be050f
---
payloads/libpayload/libc/memory.c | 63 +++++++++++++++++++++++++--------------
1 file changed, 40 insertions(+), 23 deletions(-)
diff --git a/payloads/libpayload/libc/memory.c b/payloads/libpayload/libc/memory.c
index 12d7e33..aec60e4 100644
--- a/payloads/libpayload/libc/memory.c
+++ b/payloads/libpayload/libc/memory.c
@@ -35,12 +35,22 @@
static void *default_memset(void *s, int c, size_t n)
{
- char *os = s;
+ size_t i;
+ void *ret = s;
+ unsigned long w = c & 0xff;
- while (n--)
- *(os++) = c;
+ for (i = 1; i < sizeof(unsigned long); i <<= 1)
+ w = (w << (i * 8)) | w;
- return s;
+ for (i = 0; i < n / sizeof(unsigned long); i++)
+ ((unsigned long *)s)[i] = w;
+
+ s += i * sizeof(unsigned long);
+
+ for (i = 0; i < n % sizeof(unsigned long); i++)
+ ((u8 *)s)[i] = (u8)c;
+
+ return ret;
}
void *memset(void *s, int c, size_t n)
@@ -48,18 +58,17 @@ void *memset(void *s, int c, size_t n)
static void *default_memcpy(void *dst, const void *src, size_t n)
{
- int i;
+ size_t i;
void *ret = dst;
- for(i = 0; i < n % sizeof(unsigned long); i++)
- ((unsigned char *) dst)[i] = ((unsigned char *) src)[i];
+ for(i = 0; i < n / sizeof(unsigned long); i++)
+ ((unsigned long *)dst)[i] = ((unsigned long *)src)[i];
- n -= i;
- src += i;
- dst += i;
+ src += i * sizeof(unsigned long);
+ dst += i * sizeof(unsigned long);
- for(i = 0; i < n / sizeof(unsigned long); i++)
- ((unsigned long *) dst)[i] = ((unsigned long *) src)[i];
+ for(i = 0; i < n % sizeof(unsigned long); i++)
+ ((u8 *)dst)[i] = ((u8 *)src)[i];
return ret;
}
@@ -69,8 +78,7 @@ void *memcpy(void *dst, const void *src, size_t n)
static void *default_memmove(void *dst, const void *src, size_t n)
{
- int i;
- unsigned long offs;
+ size_t i, offs;
if (src > dst)
return memcpy(dst, src, n);
@@ -78,8 +86,7 @@ static void *default_memmove(void *dst, const void *src, size_t n)
offs = n - (n % sizeof(unsigned long));
for (i = (n % sizeof(unsigned long)) - 1; i >= 0; i--)
- ((unsigned char *)dst)[i + offs] =
- ((unsigned char *)src)[i + offs];
+ ((u8 *)dst)[i + offs] = ((u8 *)src)[i + offs];
for (i = n / sizeof(unsigned long) - 1; i >= 0; i--)
((unsigned long *)dst)[i] = ((unsigned long *)src)[i];
@@ -95,17 +102,27 @@ void *memmove(void *dst, const void *src, size_t n)
*
* @param s1 Pointer to the first area to compare.
* @param s2 Pointer to the second area to compare.
- * @param len Size of the first area in bytes (both must have the same length).
- * @return If len is 0, return zero. If the areas match, return zero.
- * Otherwise return non-zero.
+ * @param n Size of the first area in bytes (both must have the same length).
+ * @return If n is 0, return zero. Otherwise, return a value less than, equal
+ * to, or greater than zero if s1 is found less than, equal to, or
+ * greater than s2 respectively.
*/
-static int default_memcmp(const void *s1, const void *s2, size_t len)
+static int default_memcmp(const void *s1, const void *s2, size_t n)
{
- for (; len && *(char *)s1++ == *(char *)s2++; len--) ;
- return len;
+ size_t i;
+
+ for (i = 0; i < n / sizeof(unsigned long); i++)
+ if (((unsigned long *)s1)[i] != ((unsigned long *)s2)[i])
+ break; /* fall through to find differing byte */
+
+ for (i *= sizeof(unsigned long); i < n; i++)
+ if (((u8 *)s1)[i] != ((u8 *)s2)[i])
+ return ((u8 *)s1)[i] - ((u8 *)s2)[i];
+
+ return 0;
}
-int memcmp(const void *s1, const void *s2, size_t len)
+int memcmp(const void *s1, const void *s2, size_t n)
__attribute__((weak, alias("default_memcmp")));
Marc Jones (marc.jones(a)se-eng.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/8125
-gerrit
commit 7fb1ca843f3c00c3f50cdf43b319b0a8bbced21e
Author: Furquan Shaikh <furquan(a)google.com>
Date: Fri Jun 20 00:19:31 2014 -0700
libpayload arm64: Add gdb stub for arm64
Add stub implementation for gdb arm64 support. Currently all functions are kept
empty to enable proper compilation of depthcharge and libpayload. As we get more
clear about context management and stuff, we can add details for gdb as well.
BUG=None
BRANCH=None
TEST=Compiles successfully for rush
Original-Change-Id: I0a8729671ab0764d424c0e3d50af86433d05b1e8
Original-Signed-off-by: Furquan Shaikh <furquan(a)google.com>
Original-Reviewed-on: https://chromium-review.googlesource.com/204877
Original-Tested-by: Furquan Shaikh <furquan(a)chromium.org>
Original-Reviewed-by: Aaron Durbin <adurbin(a)chromium.org>
Original-Commit-Queue: Furquan Shaikh <furquan(a)chromium.org>
(cherry picked from commit d24e5c26b56a9882b3450b1e4988b56c3d73efd1)
Signed-off-by: Marc Jones <marc.jones(a)se-eng.com>
Change-Id: I9b7d3d7060dd827ef4a46865e0f9a2b4e063d07d
---
payloads/libpayload/arch/arm64/Makefile.inc | 2 +
payloads/libpayload/arch/arm64/gdb.c | 69 +++++++++++++++++++++++++++++
2 files changed, 71 insertions(+)
diff --git a/payloads/libpayload/arch/arm64/Makefile.inc b/payloads/libpayload/arch/arm64/Makefile.inc
index 7107d0c..bb09b8f 100644
--- a/payloads/libpayload/arch/arm64/Makefile.inc
+++ b/payloads/libpayload/arch/arm64/Makefile.inc
@@ -40,6 +40,8 @@ libc-y += cache.c cpu.S
libc-y += selfboot.c
libcbfs-$(CONFIG_LP_CBFS) += dummy_media.c
+libgdb-y += gdb.c
+
# Add other classes here when you put assembly files into them!
head.o-S-ccopts += $(arm64_asm_flags)
libc-S-ccopts += $(arm64_asm_flags)
diff --git a/payloads/libpayload/arch/arm64/gdb.c b/payloads/libpayload/arch/arm64/gdb.c
new file mode 100644
index 0000000..857272f
--- /dev/null
+++ b/payloads/libpayload/arch/arm64/gdb.c
@@ -0,0 +1,69 @@
+/*
+ * 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; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * 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 <exception.h>
+#include <gdb.h>
+#include <libpayload.h>
+
+struct gdb_regs
+{
+ u64 x[32];
+ struct fp_reg
+ {
+ u64 quad[2];
+ } __attribute__((packed)) f[32];
+ u32 fpcr;
+ u32 fpsr;
+ u32 spsr;
+} __attribute__((packed));
+
+static const u8 type_to_signal[] = {
+ [EXC_INV] = GDB_SIGILL,
+ [EXC_SYNC] = GDB_SIGTRAP,
+ [EXC_IRQ] = GDB_SIGSEGV,
+ [EXC_FIQ] = GDB_SIGSEGV,
+ [EXC_SERROR] = GDB_SIGSEGV
+};
+
+static int gdb_exception_hook(u32 type)
+{
+ return -1;
+}
+
+void gdb_arch_init(void)
+{
+ exception_install_hook(&gdb_exception_hook);
+}
+
+void gdb_arch_enter(void)
+{
+}
+
+int gdb_arch_set_single_step(int on)
+{
+ /* GDB seems to only need this on x86, ARM works fine without it. */
+ return -1;
+}
+
+void gdb_arch_encode_regs(struct gdb_message *message)
+{
+}
+
+void gdb_arch_decode_regs(int offset, struct gdb_message *message)
+{
+}
Marc Jones (marc.jones(a)se-eng.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/8124
-gerrit
commit c25b65b544007a5531b7366ad0808cd36b399476
Author: Furquan Shaikh <furquan(a)google.com>
Date: Wed Jun 18 17:01:01 2014 -0700
libpayload arm64: Add selfboot.c required by depthcharge
BUG=None
BRANCH=None
TEST=Compiles successfully
Original-Change-Id: I2569cadf2d34f7211892f100ba715486d824b921
Original-Signed-off-by: Furquan Shaikh <furquan(a)google.com>
Original-Reviewed-on: https://chromium-review.googlesource.com/204611
Original-Reviewed-by: Hung-Te Lin <hungte(a)chromium.org>
Original-Tested-by: Furquan Shaikh <furquan(a)chromium.org>
(cherry picked from commit dd9e06e41da043a48b469a011c010a10a1a3b25a)
Signed-off-by: Marc Jones <marc.jones(a)se-eng.com>
Change-Id: I37fbc8cfea0870e7167ffa47dd63fc548e18c82e
---
payloads/libpayload/arch/arm64/Makefile.inc | 1 +
payloads/libpayload/arch/arm64/selfboot.c | 34 +++++++++++++++++++++++++++++
2 files changed, 35 insertions(+)
diff --git a/payloads/libpayload/arch/arm64/Makefile.inc b/payloads/libpayload/arch/arm64/Makefile.inc
index 45582e0..7107d0c 100644
--- a/payloads/libpayload/arch/arm64/Makefile.inc
+++ b/payloads/libpayload/arch/arm64/Makefile.inc
@@ -37,6 +37,7 @@ libc-y += virtual.c
libc-y += memcpy.S memset.S memmove.S
libc-y += exception_asm.S exception.c
libc-y += cache.c cpu.S
+libc-y += selfboot.c
libcbfs-$(CONFIG_LP_CBFS) += dummy_media.c
# Add other classes here when you put assembly files into them!
diff --git a/payloads/libpayload/arch/arm64/selfboot.c b/payloads/libpayload/arch/arm64/selfboot.c
new file mode 100644
index 0000000..5c3e445
--- /dev/null
+++ b/payloads/libpayload/arch/arm64/selfboot.c
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <libpayload.h>
+
+void selfboot(void *entry)
+{
+ void (*entry_func)(void) = entry;
+ entry_func();
+}