diff options
author | Julius Werner <jwerner@chromium.org> | 2019-08-16 15:35:39 -0700 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2019-11-20 10:10:48 +0000 |
commit | f96d9051c2b39544300d35f64ce92502e1e230c0 (patch) | |
tree | 141966be0dedd056261528e55e05efde4b20b56d /payloads/libpayload | |
parent | 63c444a69b98bc8a86719699423b3273cc5759e8 (diff) | |
download | coreboot-f96d9051c2b39544300d35f64ce92502e1e230c0.tar.xz |
Remove MIPS architecture
The MIPS architecture port has been added 5+ years ago in order to
support a Chrome OS project that ended up going nowhere. No other board
has used it since and nobody is still willing or has the expertise and
hardware to maintain it. We have decided that it has become too much of
a mainenance burden and the chance of anyone ever reviving it seems too
slim at this point. This patch eliminates all MIPS code and
MIPS-specific hacks.
Change-Id: I5e49451cd055bbab0a15dcae5f53e0172e6e2ebe
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/34919
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'payloads/libpayload')
33 files changed, 2 insertions, 1809 deletions
diff --git a/payloads/libpayload/Kconfig b/payloads/libpayload/Kconfig index 97b970b0f1..d216f61dc8 100644 --- a/payloads/libpayload/Kconfig +++ b/payloads/libpayload/Kconfig @@ -114,11 +114,6 @@ config ARCH_ARM64 help Support the ARM64 architecture -config ARCH_MIPS - bool "MIPS" - help - Support the MIPS architecture - endchoice config MULTIBOOT @@ -147,12 +142,11 @@ config BASE_ADDRESS hex "Base address" default 0x04000000 if ARCH_ARM default 0x80100000 if ARCH_ARM64 - default 0x00000000 if ARCH_MIPS default 0x00100000 if ARCH_X86 help This is the base address for the payload. - If unsure, set to 0x00100000 on x86, 0x00000000 on MIPS, + If unsure, set to 0x00100000 on x86, 0x04000000 on ARM or 0x80100000 on ARM64. endmenu @@ -452,5 +446,4 @@ config IO_ADDRESS_SPACE source "arch/arm/Kconfig" source "arch/arm64/Kconfig" -source "arch/mips/Kconfig" source "arch/x86/Kconfig" diff --git a/payloads/libpayload/Makefile b/payloads/libpayload/Makefile index b1ab302794..e5f49a6701 100644 --- a/payloads/libpayload/Makefile +++ b/payloads/libpayload/Makefile @@ -95,7 +95,6 @@ include $(HAVE_DOTCONFIG) ARCHDIR-$(CONFIG_LP_ARCH_ARM) := arm ARCHDIR-$(CONFIG_LP_ARCH_ARM64) := arm64 -ARCHDIR-$(CONFIG_LP_ARCH_MIPS) := mips ARCHDIR-$(CONFIG_LP_ARCH_X86) := x86 ARCH-y := $(ARCHDIR-y) @@ -105,7 +104,6 @@ ARCH-y := $(ARCHDIR-y) ARCH-$(CONFIG_LP_ARCH_ARM) := arm ARCH-$(CONFIG_LP_ARCH_ARM64) := arm64 ARCH-$(CONFIG_LP_ARCH_X86) := x86_32 -ARCH-$(CONFIG_LP_ARCH_MIPS) := mips # Three cases where we don't need fully populated $(obj) lists: # 1. when no .config exists diff --git a/payloads/libpayload/Makefile.inc b/payloads/libpayload/Makefile.inc index 4863d3f1da..1b7986cbc6 100644 --- a/payloads/libpayload/Makefile.inc +++ b/payloads/libpayload/Makefile.inc @@ -33,7 +33,6 @@ export KERNELVERSION := 0.2.0 ARCHDIR-$(CONFIG_LP_ARCH_ARM) := arm ARCHDIR-$(CONFIG_LP_ARCH_ARM64) := arm64 -ARCHDIR-$(CONFIG_LP_ARCH_MIPS) := mips ARCHDIR-$(CONFIG_LP_ARCH_X86) := x86 DESTDIR ?= install diff --git a/payloads/libpayload/arch/mips/Kconfig b/payloads/libpayload/arch/mips/Kconfig deleted file mode 100644 index b6e326b967..0000000000 --- a/payloads/libpayload/arch/mips/Kconfig +++ /dev/null @@ -1,24 +0,0 @@ -# -# This file is part of the libpayload project. -# -# Copyright (C) 2014 Imagination Technologies -# -# 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. -# - - -if ARCH_MIPS - -config ARCH_SPECIFIC_OPTIONS # dummy - def_bool y - select LITTLE_ENDIAN - -endif diff --git a/payloads/libpayload/arch/mips/Makefile.inc b/payloads/libpayload/arch/mips/Makefile.inc deleted file mode 100644 index 2bd112f6b8..0000000000 --- a/payloads/libpayload/arch/mips/Makefile.inc +++ /dev/null @@ -1,33 +0,0 @@ -# -# This file is part of the libpayload project. -# -# Copyright (C) 2014 Imagination Technologies -# -# 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. -# - -############################################################################### -CFLAGS += -march=mips32r2 -mxgot - -head.o-y += head.S - -libc-y += cache.c -libc-y += coreboot.c -libc-y += dummy_media.c -libc-y += exception_asm.S -libc-y += exception.c -libc-y += gdb.c -libc-y += main.c -libc-y += selfboot.c -libc-y += sysinfo.c -libc-y += string.c -libc-y += timer.c -libc-y += util.S diff --git a/payloads/libpayload/arch/mips/cache.c b/payloads/libpayload/arch/mips/cache.c deleted file mode 100644 index 4338415c5f..0000000000 --- a/payloads/libpayload/arch/mips/cache.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * This file is part of the libpayload project. - * - * Copyright (C) 2014 Imagination Technologies - * - * 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. - */ - -#include <arch/cache.h> - - -void dcache_clean_all(void) -{ - /* TODO */ -} - -void dcache_invalidate_all(void) -{ - /* TODO */ -} -void dcache_clean_invalidate_all(void) -{ - /* TODO */ -} - -void tlb_invalidate_all(void) -{ - /* TODO */ -} - -unsigned int dcache_line_bytes(void) -{ - /* TO DO */ - return 0; -} - -void dcache_mmu_disable(void) -{ - /* TODO */ -} - -void dcache_mmu_enable(void) -{ - /* TODO */ -} - -void cache_sync_instructions(void) -{ - /* TODO */ -} - -void mmu_init(void) -{ - /* TODO */ -} - -void mmu_disable_range(unsigned long start_mb, unsigned long size_mb) -{ - /* TODO */ -} -void mmu_config_range(unsigned long start_mb, unsigned long size_mb, - enum dcache_policy policy) -{ - /* TODO */ -} diff --git a/payloads/libpayload/arch/mips/coreboot.c b/payloads/libpayload/arch/mips/coreboot.c deleted file mode 100644 index e2b5557cba..0000000000 --- a/payloads/libpayload/arch/mips/coreboot.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * This file is part of the libpayload project. - * - * Copyright (C) 2014 Imagination Technologies - * - * 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. - */ - -#include <libpayload-config.h> -#include <libpayload.h> -#include <coreboot_tables.h> - -/* This pointer gets set in head.S and is passed in from coreboot. */ -void *cb_header_ptr; - -static void cb_parse_dma(void *ptr) -{ - struct lb_range *dma = (struct lb_range *)ptr; - init_dma_memory(bus_to_virt(dma->range_start), dma->range_size); -} - -/* Architecture specific */ -int cb_parse_arch_specific(struct cb_record *rec, struct sysinfo_t *info) -{ - switch (rec->tag) { - case CB_TAG_DMA: - cb_parse_dma(rec); - break; - default: - return 0; - } - return 1; - -} - -int get_coreboot_info(struct sysinfo_t *info) -{ - return cb_parse_header(cb_header_ptr, 1, info); -} - -void *get_cb_header_ptr(void) -{ - return cb_header_ptr; -} diff --git a/payloads/libpayload/arch/mips/dummy_media.c b/payloads/libpayload/arch/mips/dummy_media.c deleted file mode 100644 index 112d7feec8..0000000000 --- a/payloads/libpayload/arch/mips/dummy_media.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * This file is part of the libpayload project. - * - * Copyright (C) 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. - */ -#define LIBPAYLOAD - -#include <cbfs.h> - -/* The generic cbfs code relies on the libpayload_init_default_cbfs_media - * symbol. Therefore, provide an implementation that just throws an error. */ - -int libpayload_init_default_cbfs_media(struct cbfs_media *media); - -__attribute__((weak)) int libpayload_init_default_cbfs_media( - struct cbfs_media *media) -{ - return -1; -} diff --git a/payloads/libpayload/arch/mips/exception.c b/payloads/libpayload/arch/mips/exception.c deleted file mode 100644 index e488f2e3bd..0000000000 --- a/payloads/libpayload/arch/mips/exception.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * This file is part of the libpayload project. - * - * Copyright (C) 2014 Imagination Technologies - * - * 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. - */ - -#include <arch/exception.h> -#include <exception.h> -#include <libpayload.h> -#include <stdint.h> - -u32 exception_stack[0x400] __attribute__((aligned(8))); -struct exception_state_t exception_state; - -static const char *names[EXC_COUNT] = { - [EXC_CACHE_ERROR] = "Cache error exception", - [EXC_TLB_REFILL_AND_ALL] = "TLB refill or general exception", - [EXC_INTERRUPT] = "Interrupt", - [EXC_EJTAG_DEBUG] = "EJTAG debug exception" -}; - -static void dump_exception_state(void) -{ - printf("%s exception!\n", names[exception_state_ptr->vector]); - printf("\nRegisters:\n"); - printf("ZERO:\t0x%08x\n", exception_state_ptr->regs.zero); - printf("AT:\t0x%08x\n", exception_state_ptr->regs.at); - printf("V0:\t0x%08x\n", exception_state_ptr->regs.v0); - printf("V1:\t0x%08x\n", exception_state_ptr->regs.v1); - printf("A0:\t0x%08x\n", exception_state_ptr->regs.a0); - printf("A1:\t0x%08x\n", exception_state_ptr->regs.a1); - printf("A2:\t0x%08x\n", exception_state_ptr->regs.a2); - printf("A3:\t0x%08x\n", exception_state_ptr->regs.a3); - printf("T0:\t0x%08x\n", exception_state_ptr->regs.t0); - printf("T1:\t0x%08x\n", exception_state_ptr->regs.t1); - printf("T2:\t0x%08x\n", exception_state_ptr->regs.t2); - printf("T3:\t0x%08x\n", exception_state_ptr->regs.t3); - printf("T4:\t0x%08x\n", exception_state_ptr->regs.t4); - printf("T5:\t0x%08x\n", exception_state_ptr->regs.t5); - printf("T6:\t0x%08x\n", exception_state_ptr->regs.t6); - printf("T7:\t0x%08x\n", exception_state_ptr->regs.t7); - printf("S0:\t0x%08x\n", exception_state_ptr->regs.s0); - printf("S1:\t0x%08x\n", exception_state_ptr->regs.s1); - printf("S2:\t0x%08x\n", exception_state_ptr->regs.s2); - printf("S3:\t0x%08x\n", exception_state_ptr->regs.s3); - printf("S4:\t0x%08x\n", exception_state_ptr->regs.s4); - printf("S5:\t0x%08x\n", exception_state_ptr->regs.s5); - printf("S6:\t0x%08x\n", exception_state_ptr->regs.s6); - printf("S7:\t0x%08x\n", exception_state_ptr->regs.s7); - printf("T8:\t0x%08x\n", exception_state_ptr->regs.t8); - printf("T9:\t0x%08x\n", exception_state_ptr->regs.t9); - printf("K0:\t0x%08x\n", exception_state_ptr->regs.k0); - printf("K1:\t0x%08x\n", exception_state_ptr->regs.k1); - printf("GP:\t0x%08x\n", exception_state_ptr->regs.gp); - printf("SP:\t0x%08x\n", exception_state_ptr->regs.sp); - printf("FP:\t0x%08x\n", exception_state_ptr->regs.fp); - printf("RA:\t0x%08x\n", exception_state_ptr->regs.ra); -} - -static void dump_stack(uintptr_t addr, size_t bytes) -{ - int i, j; - const int words_per_line = 8; - int words_to_print; - uint32_t *ptr = (uint32_t *) - (addr & ~(words_per_line * sizeof(*ptr) - 1)); - - printf("Dumping stack:\n"); - words_to_print = bytes/sizeof(*ptr); - for (i = words_to_print; i >= 0; i -= words_per_line) { - printf("%p: ", ptr + i); - for (j = i; j < i + words_per_line; j++) - printf("%08x ", *(ptr + j)); - printf("\n"); - } -} - - -void exception_dispatch(void) -{ - u32 vec = exception_state_ptr->vector; - die_if(vec >= EXC_COUNT || !names[vec], "Bad exception vector %u", vec); - - dump_exception_state(); - dump_stack(exception_state_ptr->regs.sp, 512); - halt(); -} - -void exception_init(void) -{ - exception_stack_end = exception_stack + ARRAY_SIZE(exception_stack); - exception_state_ptr = &exception_state; - exception_init_asm(); -} diff --git a/payloads/libpayload/arch/mips/exception_asm.S b/payloads/libpayload/arch/mips/exception_asm.S deleted file mode 100644 index 118c12d965..0000000000 --- a/payloads/libpayload/arch/mips/exception_asm.S +++ /dev/null @@ -1,200 +0,0 @@ -/* - * This file is part of the libpayload project. - * - * Copyright (C) 2014 Imagination Technologies - * - * 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. - */ - -#define STATUS_REGISTER $12,0 -#define BOOT_EXC_VECTOR_MASK (1 << 22) -#define EBASE_REGISTER $15,1 -#define EXCEPTION_BASE_MASK (0xFFFFF000) - - /* Don't reorder instructions */ - .set noreorder - .set noat - - .align 4 - .global exception_stack_end -exception_stack_end: - .word 0 - - .global exception_state_ptr -exception_state_ptr: - .word 0 - -/* Temporary variables. */ -ret_addr: - .word 0 -exception_sp: - .word 0 -vector: - .word 0 - -/* Cache error */ -.org 0x100 - li $v0, 0x0 - la $at, vector - sw $v0, 0x00($at) - b exception_common - nop - -/* TLB refill and all others */ -.org 0x180 - li $v0, 0x1 - la $at, vector - sw $v0, 0x00($at) - b exception_common - nop - -/* Interrupt */ -.org 0x200 - li $v0, 0x2 - la $at, vector - sw $v0, 0x00($at) - b exception_common - nop - -/* EJTAG debug exception */ -.org 0x480 - li $v0, 0x3 - la $at, vector - sw $v0, 0x00($at) - b exception_common - nop - -exception_common: - /* Obtain return address of exception */ - la $v0, ret_addr - sw $ra, 0x00($v0) - - /* Initialize $gp */ - bal 1f - nop - .word _gp -1: - lw $gp, 0($ra) - - la $at, exception_sp - sw $sp, 0x00($at) - lw $sp, exception_state_ptr - - /* Save all registers */ - sw $zero, 0x00($sp) - sw $at, 0x04($sp) - sw $v0, 0x08($sp) - sw $v1, 0x0C($sp) - sw $a0, 0x10($sp) - sw $a1, 0x14($sp) - sw $a2, 0x18($sp) - sw $a3, 0x1C($sp) - sw $t0, 0x20($sp) - sw $t1, 0x34($sp) - sw $t2, 0x28($sp) - sw $t3, 0x2C($sp) - sw $t4, 0x30($sp) - sw $t5, 0x34($sp) - sw $t6, 0x38($sp) - sw $t7, 0x3C($sp) - sw $s0, 0x40($sp) - sw $s1, 0x44($sp) - sw $s2, 0x48($sp) - sw $s3, 0x4C($sp) - sw $s4, 0x50($sp) - sw $s5, 0x54($sp) - sw $s6, 0x58($sp) - sw $s7, 0x5C($sp) - sw $t8, 0x60($sp) - sw $t9, 0x64($sp) - sw $k0, 0x68($sp) - sw $k1, 0x6C($sp) - sw $gp, 0x70($sp) - lw $v0, exception_sp - sw $v0, 0x74($sp) - sw $fp, 0x78($sp) - lw $v0, ret_addr - sw $v0, 0x7C($sp) - lw $v0, vector - sw $v0, 0x80($sp) - - /* Point SP to the stack for C code */ - lw $sp, exception_stack_end - /* Give control to exception dispatch */ - la $a2, exception_dispatch - jalr $a2 - nop - lw $sp, exception_state_ptr - /* Restore registers */ - lw $zero, 0x00($sp) - lw $at, 0x04($sp) - lw $v0, 0x08($sp) - lw $v1, 0x0C($sp) - lw $a0, 0x10($sp) - lw $a1, 0x14($sp) - lw $a2, 0x18($sp) - lw $a3, 0x1C($sp) - lw $t0, 0x20($sp) - lw $t1, 0x24($sp) - lw $t2, 0x28($sp) - lw $t3, 0x2C($sp) - lw $t4, 0x30($sp) - lw $t5, 0x34($sp) - lw $t6, 0x38($sp) - lw $t7, 0x3C($sp) - lw $s0, 0x40($sp) - lw $s1, 0x44($sp) - lw $s2, 0x48($sp) - lw $s3, 0x4C($sp) - lw $s4, 0x50($sp) - lw $s5, 0x54($sp) - lw $s6, 0x58($sp) - lw $s7, 0x5C($sp) - lw $t8, 0x60($sp) - lw $t9, 0x64($sp) - lw $k0, 0x68($sp) - sw $k1, 0x6C($sp) - sw $gp, 0x70($sp) - sw $fp, 0x78($sp) - sw $ra, 0x7C($sp) - /* Return */ - eret - - .global exception_init_asm -exception_init_asm: - .set push - /* Make sure boot exception vector is 1 before writing EBASE */ - mfc0 $t0, STATUS_REGISTER - li $t1, BOOT_EXC_VECTOR_MASK - or $t0, $t0, $t1 - mtc0 $t0, STATUS_REGISTER - - /*Prepare base address */ - la $t1, exception_stack_end - li $t2, EXCEPTION_BASE_MASK - and $t1, $t1, $t2 - - /* Prepare EBASE register value */ - mfc0 $t0, EBASE_REGISTER - li $t2, ~(EXCEPTION_BASE_MASK) - and $t0, $t0, $t2 - /* Filling base address */ - or $t0, $t0, $t1 - mtc0 $t0, EBASE_REGISTER - - /* Clear boot exception vector bit for EBASE value to take effect */ - mfc0 $t0, STATUS_REGISTER - li $t1, ~BOOT_EXC_VECTOR_MASK - and $t0, $t0, $t1 - mtc0 $t0, STATUS_REGISTER - - .set pop - /* Return */ - jr $ra diff --git a/payloads/libpayload/arch/mips/gdb.c b/payloads/libpayload/arch/mips/gdb.c deleted file mode 100644 index 7fd741aeb1..0000000000 --- a/payloads/libpayload/arch/mips/gdb.c +++ /dev/null @@ -1,27 +0,0 @@ -/* - * This file is part of the libpayload project. - * - * Copyright (C) 2014 Imagination Technologies - * - * 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. - */ - - -#include <gdb.h> -#include <libpayload.h> - - -void gdb_arch_init(void) -{ -} - -void gdb_arch_enter(void) -{ -} diff --git a/payloads/libpayload/arch/mips/head.S b/payloads/libpayload/arch/mips/head.S deleted file mode 100644 index 203e0ae1bf..0000000000 --- a/payloads/libpayload/arch/mips/head.S +++ /dev/null @@ -1,96 +0,0 @@ -/* - * This file is part of the libpayload project. - * - * Copyright (C) 2014 Imagination Technologies - * - * 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. - */ - -#include <arch/cpu.h> - - /* Disable interrupts and mark the kernel mode */ - .macro setup_c0_status clr - .set push - mfc0 $t0, $CP0_STATUS - or $t0, ST0_CU0 | 0x1f | \clr - xor $t0, 0x1f | \clr - mtc0 $t0, $CP0_STATUS - .set noreorder - sll $zero, 3 - .set pop - .endm - - /* Don't reorder instructions */ - .set noreorder - - .align 4 - - .global cb_header_ptr -cb_header_ptr: - .word 0 - - .global old_sp -old_sp: - .word 0 - - - .global _entry, _leave - .text - -/* Our entry point */ -_entry: - - /* - * This function saves off the previous stack and switches us to our - * own execution environment. - */ - - /* Clear watch and cause registers */ - mtc0 $zero, $CP0_WATCHLO - mtc0 $zero, $CP0_WATCHHI - mtc0 $zero, $CP0_CAUSE - - /* Disable interrupts */ - setup_c0_status 0 - - /* Don't use at in synthetic instr. */ - .set noat - - /* Init timer */ - mtc0 $zero, $CP0_COUNT - mtc0 $zero, $CP0_COMPARE - - /* Initialize $gp */ - bal 1f - nop - .word _gp -1: - lw $gp, 0($ra) - - /* Save off the location of the coreboot tables */ - la $at, cb_header_ptr - sw $a0, 0x00($at) - - /* Save old stack pointer */ - la $at, old_sp - sw $sp, 0x00($at) - - /* Setup new stack */ - la $sp, _stack - - /* Let's rock */ - la $a2, start_main - jalr $a2 - nop -_leave: - /* Restore old stack. */ - lw $sp, old_sp - /* Return to the original context. */ - eret diff --git a/payloads/libpayload/arch/mips/libpayload.ldscript b/payloads/libpayload/arch/mips/libpayload.ldscript deleted file mode 100644 index 351c2254fb..0000000000 --- a/payloads/libpayload/arch/mips/libpayload.ldscript +++ /dev/null @@ -1,86 +0,0 @@ -/* - * This file is part of the libpayload project. - * - * Copyright (C) 2014 Imagination Technologies - * - * Based on src/arch/arm/ramstage.ld: - * Written by Johan Rydberg, based on work by Daniel Kahlin. - * Rewritten by Eric Biederman - * - * 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. - */ - -OUTPUT_ARCH(mips) - -ENTRY(_entry) - -SECTIONS -{ - . = CONFIG_LP_BASE_ADDRESS; - - . = ALIGN(16); - _start = .; - - .text : { - *(.text._entry) - *(.text) - *(.text.*) - } - - .rodata : { - *(.rodata) - *(.rodata.*) - } - - .data : { - *(.data) - *(.data.*) - } - - _edata = .; - - .sdata : { - *(.srodata) - *(.sdata) - } - - _bss = .; - .bss : { - *(.sbss) - *(.sbss.*) - *(.bss) - *(.bss.*) - *(COMMON) - - /* Stack and heap */ - - . = ALIGN(16); - _heap = .; - . += CONFIG_LP_HEAP_SIZE; - . = ALIGN(16); - _eheap = .; - - _estack = .; - . += CONFIG_LP_STACK_SIZE; - . = ALIGN(16); - _stack = .; - } - _ebss = .; - - _end = .; - - /DISCARD/ : { - *(.comment) - *(.note*) - *(.reginfo) - - } -} diff --git a/payloads/libpayload/arch/mips/main.c b/payloads/libpayload/arch/mips/main.c deleted file mode 100644 index 7a71f90fa6..0000000000 --- a/payloads/libpayload/arch/mips/main.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * This file is part of the libpayload project. - * - * Copyright (C) 2014 Imagination Technologies - * - * 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. - */ - -#include <exception.h> -#include <libpayload.h> - -/* The argc value to pass to main() */ -int main_argc; -/* The argv value to pass to main() */ -char *main_argv[MAX_ARGC_COUNT]; - -/* - * This is our C entry function - set up the system - * and jump into the payload entry point. - */ -void start_main(void); -void start_main(void) -{ - extern int main(int argc, char **argv); - - /* Gather system information. */ - lib_get_sysinfo(); - - /* Optionally set up the consoles. */ -#if !CONFIG(LP_SKIP_CONSOLE_INIT) - console_init(); -#endif - - exception_init(); - /* - * Any other system init that has to happen before the - * user gets control goes here - */ - - /* - * Go to the entry point. - * In the future we may care about the return value. - */ - - (void) main(main_argc, (main_argc != 0) ? main_argv : NULL); - - /* - * Returning here will go to the _leave function to return - * us to the original context. - */ -} diff --git a/payloads/libpayload/arch/mips/selfboot.c b/payloads/libpayload/arch/mips/selfboot.c deleted file mode 100644 index c69583134c..0000000000 --- a/payloads/libpayload/arch/mips/selfboot.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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> - -extern void *cb_header_ptr; - -void selfboot(void *entry) -{ - void (*entry_func)(void *) = entry; - entry_func(cb_header_ptr); -} diff --git a/payloads/libpayload/arch/mips/string.c b/payloads/libpayload/arch/mips/string.c deleted file mode 100644 index 79cc8d260a..0000000000 --- a/payloads/libpayload/arch/mips/string.c +++ /dev/null @@ -1,77 +0,0 @@ - /* - * This file is part of the libpayload project. - * - * Copyright (C) 2014 Imagination Technologies - * - * 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. - */ - -#include <stdint.h> -#include "string.h" - -/* - * Alternative string functions to the default ones are added - * because there is no guarantee that the provided source and - * destination addresses are properly aligned; - * The default string functions work with multiple of 4 bytes - * (sizeof(unsinged long)); MIPS will use LW/SW instructions - * for these operations and if the source and destination - * addresses are not aligned it will trigger an exception. - */ - -void *memcpy(void *dest, const void *src, size_t n) -{ - u8 *ptr_d = dest; - const u8 *ptr_s = src; - size_t i; - - for (i = 0; i < n; i++) - *ptr_d++ = *ptr_s++; - - return dest; -} - -void *memmove(void *dest, const void *src, size_t n) -{ - if ((src < dest) && (dest - src < n)) { - u8 *ptr_d = dest; - const u8 *ptr_s = src; - - /* copy backwards */ - while (n--) - ptr_d[n] = ptr_s[n]; - - return dest; - } - - /* copy forwards */ - return memcpy(dest, src, n); -} - -void *memset(void *s, int c, size_t n) -{ - u8 *ptr = s; - size_t i; - - for (i = 0; i < n; i++) - *ptr++ = c; - - return s; -} - -int memcmp(const void *s1, const void *s2, size_t n) -{ - size_t i; - - for (i = 0; i < n; i++) - if (((u8 *)s1)[i] != ((u8 *)s2)[i]) - return ((u8 *)s1)[i] - ((u8 *)s2)[i]; - return 0; -} diff --git a/payloads/libpayload/arch/mips/sysinfo.c b/payloads/libpayload/arch/mips/sysinfo.c deleted file mode 100644 index 49c6c84feb..0000000000 --- a/payloads/libpayload/arch/mips/sysinfo.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * This file is part of the libpayload project. - * - * Copyright (C) 2014 Imagination Technologies - * - * 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. - */ - -#include <libpayload-config.h> -#include <libpayload.h> -#include <coreboot_tables.h> -#include <multiboot_tables.h> - -/* - * This is a global structure that is used through the library - we set it - * up initially with some dummy values - hopefully they will be overridden. - */ -struct sysinfo_t lib_sysinfo = { - .cpu_khz = 200, -}; - -int lib_get_sysinfo(void) -{ - int ret; - - /* Get the CPU speed (for delays). */ - lib_sysinfo.cpu_khz = get_cpu_speed(); - - /* Get information from the coreboot tables, - * if they exist */ - ret = get_coreboot_info(&lib_sysinfo); - - /* If we can't get a good memory range, use the default. */ - if (!lib_sysinfo.n_memranges) { - lib_sysinfo.n_memranges = 1; - lib_sysinfo.memrange[0].base = 0; - lib_sysinfo.memrange[0].size = 1024 * 1024; - lib_sysinfo.memrange[0].type = CB_MEM_RAM; - } - - return ret; -} diff --git a/payloads/libpayload/arch/mips/timer.c b/payloads/libpayload/arch/mips/timer.c deleted file mode 100644 index a066f676d1..0000000000 --- a/payloads/libpayload/arch/mips/timer.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * This file is part of the libpayload project. - * - * Copyright (C) 2014 Imagination Technologies - * - * 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. - */ - -#include <libpayload.h> -#include <arch/cpu.h> -#include <arch/io.h> - -#define PISTACHIO_CLOCK_SWITCH 0xB8144200 -#define MIPS_EXTERN_PLL_BYPASS_MASK 0x00000002 - -/** - * @ingroup arch - * Global variable containing the speed of the processor in KHz. - */ -u32 cpu_khz; - -/** - * Calculate the speed of the processor for use in delays. - * - * @return The CPU speed in kHz. - */ -unsigned int get_cpu_speed(void) -{ - if (IMG_PLATFORM_ID() != IMG_PLATFORM_ID_SILICON) - cpu_khz = 50000; /* FPGA board */ - else { - /* If MIPS PLL external bypass bit is set, it means - * that the MIPS PLL is already set up to work at a - * frequency of 550 MHz; otherwise, the crystal is - * used with a frequency of 52 MHz - */ - if (read32(PISTACHIO_CLOCK_SWITCH) & - MIPS_EXTERN_PLL_BYPASS_MASK) - cpu_khz = 550000; - else - cpu_khz = 52000; - } - - return cpu_khz; -} diff --git a/payloads/libpayload/arch/mips/util.S b/payloads/libpayload/arch/mips/util.S deleted file mode 100644 index 986a34c5d4..0000000000 --- a/payloads/libpayload/arch/mips/util.S +++ /dev/null @@ -1,22 +0,0 @@ -/* - * This file is part of the libpayload project. - * - * Copyright (C) 2014 Imagination Technologies - * - * 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. - */ - - .global halt - .text - .align 4 - .type halt, function -halt: - j halt - nop diff --git a/payloads/libpayload/bin/lpgcc b/payloads/libpayload/bin/lpgcc index b3ef342ff2..c233f82950 100755 --- a/payloads/libpayload/bin/lpgcc +++ b/payloads/libpayload/bin/lpgcc @@ -80,12 +80,6 @@ if [ "$CONFIG_LP_ARCH_ARM64" = "y" ]; then _ARCHEXTRA="" _ARCH=arm64 fi -if [ "$CONFIG_LP_ARCH_MIPS" = "y" ]; then - _ARCHINCDIR=$_INCDIR/mips - _ARCHLIBDIR=$_LIBDIR/mips - _ARCHEXTRA="" - _ARCH=mips -fi if [ "$CONFIG_LP_ARCH_X86" = "y" ]; then _ARCHINCDIR=$_INCDIR/x86 _ARCHLIBDIR=$_LIBDIR/x86 @@ -170,9 +164,7 @@ if [ $DOLINK -eq 0 ]; then $DEFAULT_CC $CMDLINE $_CFLAGS else - if [ -z "${CONFIG_LP_ARCH_MIPS}" ]; then - _LIBGCC=`$DEFAULT_CC $_ARCHEXTRA -print-libgcc-file-name` - fi + _LIBGCC=`$DEFAULT_CC $_ARCHEXTRA -print-libgcc-file-name` if [ -f $_ARCHLIBDIR/head.o ]; then HEAD_O=$_ARCHLIBDIR/head.o elif [ -f $BASE/../build/head.o ]; then diff --git a/payloads/libpayload/configs/defconfig-mips b/payloads/libpayload/configs/defconfig-mips deleted file mode 100644 index 4a0a914ac3..0000000000 --- a/payloads/libpayload/configs/defconfig-mips +++ /dev/null @@ -1,6 +0,0 @@ -CONFIG_LP_ARCH_MIPS=y -CONFIG_LP_COREBOOT_VIDEO_CONSOLE=y -CONFIG_LP_PC_KEYBOARD=y -CONFIG_LP_TIMER_IMG_PISTACHIO=y -# CONFIG_LP_USB_EHCI is not set -# CONFIG_LP_USB_XHCI is not set diff --git a/payloads/libpayload/drivers/timer/img_pistachio.c b/payloads/libpayload/drivers/timer/img_pistachio.c deleted file mode 100644 index d11c3ff283..0000000000 --- a/payloads/libpayload/drivers/timer/img_pistachio.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * This file is part of the libpayload project. - * - * Copyright (C) 2014 Imagination Technologies - * - * 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. - */ - -#include <libpayload.h> -#include <arch/cpu.h> - -uint64_t timer_hz(void) -{ - return (uint64_t)lib_sysinfo.cpu_khz * 1000; -} - -uint64_t timer_raw_value(void) -{ - static uint64_t total_ticks = 0; - uint8_t overflow = 0; - uint32_t current_ticks = read_c0_count() * 2; - - /* It assumes only one overflow happened since the last call */ - if (current_ticks <= (uint32_t)total_ticks) - overflow = 1; - /* The least significant part(32 bits) of total_ticks will always - * become equal to current ticks */ - total_ticks = (((total_ticks >> 32) + overflow) << 32) + - current_ticks; - return total_ticks; -} diff --git a/payloads/libpayload/include/mips/arch/byteorder.h b/payloads/libpayload/include/mips/arch/byteorder.h deleted file mode 100644 index 40412d232c..0000000000 --- a/payloads/libpayload/include/mips/arch/byteorder.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is part of the libpayload project. - * - * Copyright (C) 2014 Imagination Technologies - * - * 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. - */ - -#ifndef __MIPS_ARCH_BYTEORDER_H__ -#define __MIPS_ARCH_BYTEORDER_H__ - -#include <stdint.h> -#include <swab.h> - -#ifndef __ORDER_LITTLE_ENDIAN__ -#error "What endian are you!?" -#endif - -#define cpu_to_le64(x) ((uint64_t)(x)) -#define le64_to_cpu(x) ((uint64_t)(x)) -#define cpu_to_le32(x) ((uint32_t)(x)) -#define le32_to_cpu(x) ((uint32_t)(x)) -#define cpu_to_le16(x) ((uint16_t)(x)) -#define le16_to_cpu(x) ((uint16_t)(x)) -#define cpu_to_be64(x) swab64(x) -#define be64_to_cpu(x) swab64(x) -#define cpu_to_be32(x) swab32((x)) -#define be32_to_cpu(x) swab32((x)) -#define cpu_to_be16(x) swab16((x)) -#define be16_to_cpu(x) swab16((x)) - -#endif /* __MIPS_ARCH_BYTEORDER_H__ */ diff --git a/payloads/libpayload/include/mips/arch/cache.h b/payloads/libpayload/include/mips/arch/cache.h deleted file mode 100644 index e65a2a00ae..0000000000 --- a/payloads/libpayload/include/mips/arch/cache.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * This file is part of the libpayload project. - * - * Copyright (C) 2014 Imagination Technologies - * - * 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. - */ - -#ifndef __MIPS_ARCH_CACHE_H__ -#define __MIPS_ARCH_CACHE_H__ - - -#include <stddef.h> -#include <stdint.h> - - -/* - * Sync primitives - */ - -/* data memory barrier */ -static inline void dmb(void) -{ - /* TODO */ -} - -/* data sync barrier */ -static inline void dsb(void) -{ - /* TODO */ -} - -/* instruction sync barrier */ -static inline void isb(void) -{ - /* TODO */ -} - - -/* - * Cache maintenance API - */ - -/* dcache clean and invalidate all */ -void dcache_clean_invalidate_all(void); - -/* dcache clean all */ -void dcache_clean_all(void); - -/* dcache invalidate all (on current level given by CCSELR) */ -void dcache_invalidate_all(void); - -/* returns number of bytes per cache line */ -unsigned int dcache_line_bytes(void); - -/* dcache and MMU disable */ -void dcache_mmu_disable(void); - -/* dcache and MMU enable */ -void dcache_mmu_enable(void); - -/* perform all icache/dcache maintenance needed after loading new code */ -void cache_sync_instructions(void); - -/* tlb invalidate all */ -void tlb_invalidate_all(void); - -/* - * Generalized setup/init functions - */ - -/* mmu initialization (set page table address, set permissions, etc) */ -void mmu_init(void); - -enum dcache_policy { - DCACHE_OFF, - DCACHE_WRITEBACK, - DCACHE_WRITETHROUGH, -}; - -/* disable the mmu for a range. Primarily useful to lock out address 0. */ -void mmu_disable_range(unsigned long start_mb, unsigned long size_mb); -/* mmu range configuration (set dcache policy) */ -void mmu_config_range(unsigned long start_mb, unsigned long size_mb, - enum dcache_policy policy); - -#endif /* __MIPS_ARCH_CACHE_H__ */ diff --git a/payloads/libpayload/include/mips/arch/cpu.h b/payloads/libpayload/include/mips/arch/cpu.h deleted file mode 100644 index 93e42ea455..0000000000 --- a/payloads/libpayload/include/mips/arch/cpu.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * This file is part of the libpayload project. - * - * Copyright (C) 2014 Imagination Technologies - * - * 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. - * - */ - -#ifndef __MIPS_ARCH_CPU_H__ -#define __MIPS_ARCH_CPU_H__ - -/* - * Reading at this address allows to identify the platform the code is running - * on - */ - -/* - * This register holds the FPGA image version - * If we're not working on the FPGA this will be 0 - */ -#define PRIMARY_FPGA_VERSION 0xB8149060 -#define IMG_PLATFORM_ID() read32(PRIMARY_FPGA_VERSION) -#define IMG_PLATFORM_ID_FPGA 0xD1400003 /* Last FPGA image */ -#define IMG_PLATFORM_ID_SILICON 0 - -#define CP0_COUNT 9 -#define CP0_COMPARE 11 -#define CP0_STATUS 12 -#define CP0_CAUSE 13 -#define CP0_WATCHLO 18 -#define CP0_WATCHHI 19 - -/* coprocessor 0 enable */ -#define ST0_CU0 (1 << 28) -#define C0_CAUSE_DC (1 << 27) - -/*************************************************************************** - * The following section was copied from arch/mips/include/asm/mipsregs.h in - * the 3.14 kernel tree. - */ - -/* - * Macros to access the system control coprocessor - */ - -#define __read_32bit_c0_register(source, sel) \ -({ int __res; \ - if (sel == 0) \ - __asm__ __volatile__( \ - "mfc0\t%0, " #source "\n\t" \ - : "=r" (__res)); \ - else \ - __asm__ __volatile__( \ - ".set\tmips32\n\t" \ - "mfc0\t%0, " #source ", " #sel "\n\t" \ - ".set\tmips0\n\t" \ - : "=r" (__res)); \ - __res; \ -}) - -#define __write_32bit_c0_register(register, sel, value) \ -do { \ - if (sel == 0) \ - __asm__ __volatile__( \ - "mtc0\t%z0, " #register "\n\t" \ - : : "Jr" ((unsigned int)(value))); \ - else \ - __asm__ __volatile__( \ - ".set\tmips32\n\t" \ - "mtc0\t%z0, " #register ", " #sel "\n\t" \ - ".set\tmips0" \ - : : "Jr" ((unsigned int)(value))); \ -} while (0) - -/* Shortcuts to access various internal registers, keep adding as needed. */ -#define read_c0_count() __read_32bit_c0_register($9, 0) -#define write_c0_count(val) __write_32bit_c0_register($9, 0, (val)) - -#define read_c0_cause() __read_32bit_c0_register($13, 0) -#define write_c0_cause(val) __write_32bit_c0_register($13, 0, (val)) -/***************************************************************************/ - -#endif /* __MIPS_ARCH_CPU_H__ */ diff --git a/payloads/libpayload/include/mips/arch/exception.h b/payloads/libpayload/include/mips/arch/exception.h deleted file mode 100644 index 27f0b6417b..0000000000 --- a/payloads/libpayload/include/mips/arch/exception.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * This file is part of the libpayload project. - * - * Copyright (C) 2014 Imagination Technologies - * - * 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. - */ - -#ifndef __MIPS_ARCH_EXCEPTION_H__ -#define __MIPS_ARCH_EXCEPTION_H__ - -#include <stdint.h> - -void exception_init_asm(void); -void exception_dispatch(void); - -struct exception_state_t { - struct { - /* Always 0: just to keep the series complete */ - u32 zero; - /* Reserved for the assembler */ - /* TODO: is this actually needed here? */ - u32 at; - /* v0-v1: expression evaluation */ - u32 v0; - u32 v1; - /* a0-a3: Arguments */ - u32 a0; - u32 a1; - u32 a2; - u32 a3; - /* t0-t3: Temporary registers for expression evaluation */ - u32 t0; - u32 t1; - u32 t2; - u32 t3; - u32 t4; - u32 t5; - u32 t6; - u32 t7; - /* s0-s7: Saved registers */ - u32 s0; - u32 s1; - u32 s2; - u32 s3; - u32 s4; - u32 s5; - u32 s6; - u32 s7; - /* t8-t9: Temporary registers for expression evaluation */ - u32 t8; - u32 t9; - /* k0-k1: reserved for SO kernel */ - u32 k0; - u32 k1; - /* Global pointer */ - u32 gp; - /* Stack pointer */ - u32 sp; - /* Frame pointer */ - u32 fp; - /* Return address */ - u32 ra; - } regs; - u32 vector; -} __packed; - -extern struct exception_state_t *exception_state_ptr; -extern u32 *exception_stack_end; - -enum { - EXC_CACHE_ERROR = 0, - EXC_TLB_REFILL_AND_ALL = 1, - EXC_INTERRUPT = 2, - EXC_EJTAG_DEBUG = 3, - EXC_COUNT -}; - -#endif /* __MIPS_ARCH_EXCEPTION_H__ */ diff --git a/payloads/libpayload/include/mips/arch/io.h b/payloads/libpayload/include/mips/arch/io.h deleted file mode 100644 index f86f45fbd5..0000000000 --- a/payloads/libpayload/include/mips/arch/io.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * This file is part of the libpayload project. - * - * Copyright (C) 2014 Imagination Technologies - * - * Based on arch/armv7/include/arch/io.h: - * Copyright 2013 Google Inc. - * Copyright (C) 1996-2000 Russell King - * - * 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. - */ - -#ifndef __MIPS_ARCH_IO_H__ -#define __MIPS_ARCH_IO_H__ - -#include <arch/types.h> -#include <arch/cache.h> -#include <arch/byteorder.h> - -#define read8(a) (*(volatile uint8_t *) (a)) -#define read16(a) (*(volatile uint16_t *) (a)) -#define read32(a) (*(volatile uint32_t *) (a)) - -#define write8(v, a) (*(volatile uint8_t *) (a) = (v)) -#define write16(v, a) (*(volatile uint16_t *) (a) = (v)) -#define write32(v, a) (*(volatile uint32_t *) (a) = (v)) - - -/* - * Clear and set bits in one shot. These macros can be used to clear and - * set multiple bits in a register using a single call. These macros can - * also be used to set a multiple-bit bit pattern using a mask, by - * specifying the mask in the 'clear' parameter and the new bit pattern - * in the 'set' parameter. - */ - -#define out_arch(type, endian, a, v) write##type(cpu_to_##endian(v), a) -#define in_arch(type, endian, a) endian##_to_cpu(read##type(a)) - -#define readb(a) read8(a) -#define readw(a) read16(a) -#define readl(a) read32(a) - -#define inb(a) read8(a) -#define inw(a) read16(a) -#define inl(a) read32(a) - -#define writeb(v, a) write8(v, a) -#define writew(v, a) write16(v, a) -#define writel(v, a) write32(v, a) - -#define outb(v, a) write8(v, a) -#define outw(v, a) write16(v, a) -#define outl(v, a) write32(v, a) - -#endif /* __MIPS_ARCH_IO_H__ */ diff --git a/payloads/libpayload/include/mips/arch/stdint.h b/payloads/libpayload/include/mips/arch/stdint.h deleted file mode 100644 index 18fa54f531..0000000000 --- a/payloads/libpayload/include/mips/arch/stdint.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * This file is part of the libpayload project. - * - * Based on src/arch/armv7/include/stdint.h - * - * 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. - */ - -#ifndef __MIPS_STDINT_H__ -#define __MIPS_STDINT_H__ - -#if defined(__GNUC__) -#define __HAVE_LONG_LONG__ 1 -#else -#define __HAVE_LONG_LONG__ 0 -#endif - -/* Exact integral types */ -typedef unsigned char uint8_t; -typedef signed char int8_t; - -typedef unsigned short uint16_t; -typedef signed short int16_t; - -typedef unsigned int uint32_t; -typedef signed int int32_t; - -#if __HAVE_LONG_LONG__ -typedef unsigned long long uint64_t; -typedef signed long long int64_t; -#endif - -/* Small types */ -typedef unsigned char uint_least8_t; -typedef signed char int_least8_t; - -typedef unsigned short uint_least16_t; -typedef signed short int_least16_t; - -typedef unsigned int uint_least32_t; -typedef signed int int_least32_t; - -#if __HAVE_LONG_LONG__ -typedef unsigned long long uint_least64_t; -typedef signed long long int_least64_t; -#endif - -/* Fast Types */ -typedef unsigned char uint_fast8_t; -typedef signed char int_fast8_t; - -typedef unsigned int uint_fast16_t; -typedef signed int int_fast16_t; - -typedef unsigned int uint_fast32_t; -typedef signed int int_fast32_t; - -#if __HAVE_LONG_LONG__ -typedef unsigned long long uint_fast64_t; -typedef signed long long int_fast64_t; -#endif - -/* Largest integral types */ -#if __HAVE_LONG_LONG__ -typedef long long int intmax_t; -typedef unsigned long long uintmax_t; -#else -typedef long int intmax_t; -typedef unsigned long int uintmax_t; -#endif - -typedef uint8_t u8; -typedef uint16_t u16; -typedef uint32_t u32; -#if __HAVE_LONG_LONG__ -typedef uint64_t u64; -#endif -typedef int8_t s8; -typedef int16_t s16; -typedef int32_t s32; - -#undef __HAVE_LONG_LONG__ - -#endif /* __MIPS_STDINT_H__ */ diff --git a/payloads/libpayload/include/mips/arch/types.h b/payloads/libpayload/include/mips/arch/types.h deleted file mode 100644 index afa3a37e87..0000000000 --- a/payloads/libpayload/include/mips/arch/types.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * This file is part of the libpayload project. - * - * Copyright (C) 2014 Imagination Technologies - * - * Based on src/arch/armv7/include/arch/types.h - * - * 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. - */ - -#ifndef __MIPS_ARCH_TYPES_H -#define __MIPS_ARCH_TYPES_H - -#include <arch/stdint.h> - -typedef unsigned short umode_t; - -/* - * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the - * header files exported to user space - */ - -typedef __signed__ char __s8; -typedef unsigned char __u8; - -typedef __signed__ short __s16; -typedef unsigned short __u16; - -typedef __signed__ int __s32; -typedef unsigned int __u32; - -#if defined(__GNUC__) -__extension__ typedef __signed__ long long __s64; -__extension__ typedef unsigned long long __u64; -#endif - -typedef signed char s8; -typedef unsigned char u8; - -typedef signed short s16; -typedef unsigned short u16; - -typedef signed int s32; -typedef unsigned int u32; - -typedef signed long long s64; -typedef unsigned long long u64; - -#define BITS_PER_LONG 32 - -/* Dma addresses are 32-bits wide. */ - -typedef u32 dma_addr_t; - -typedef unsigned long phys_addr_t; -typedef unsigned long phys_size_t; - -typedef long time_t; -typedef long suseconds_t; - -#ifndef NULL -#define NULL ((void *)0) -#endif - -#endif /* __MIPS_ARCH_TYPES_H */ diff --git a/payloads/libpayload/include/mips/arch/virtual.h b/payloads/libpayload/include/mips/arch/virtual.h deleted file mode 100644 index da791eecdf..0000000000 --- a/payloads/libpayload/include/mips/arch/virtual.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * This file is part of the libpayload project. - * - * Copyright (C) 2014 Imagination Technologies - * - * 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. - */ - -#ifndef __MIPS_ARCH_VIRTUAL_H -#define __MIPS_ARCH_VIRTUAL_H - -#define KSEG0_BASE 0x80000000 -#define KSEG1_BASE 0xA0000000 - -#define kseg0_to_phys(virt) ((unsigned long)(virt) - KSEG0_BASE) -#define phys_to_kseg0(phys) ((void *)((unsigned long)(phys) + KSEG0_BASE)) - -#define kseg1_to_phys(virt) ((unsigned long)(virt) - KSEG1_BASE) -#define phys_to_kseg1(phys) ((void *)((unsigned long)(phys) + KSEG1_BASE)) - -#define virt_to_phys(virt) ((unsigned long)(virt)) -#define phys_to_virt(phys) ((void *)(unsigned long)(phys)) - -#define virt_to_bus(virt) kseg1_to_phys(virt) -#define bus_to_virt(phys) phys_to_kseg1(phys) - -#endif diff --git a/payloads/libpayload/libc/64bit_div.c b/payloads/libpayload/libc/64bit_div.c deleted file mode 100644 index 5cd5bc5e95..0000000000 --- a/payloads/libpayload/libc/64bit_div.c +++ /dev/null @@ -1,141 +0,0 @@ -/* - * This file is part of the libpayload project. - * - * 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-config.h> -#include <stdlib.h> - -#if !CONFIG(LP_LITTLE_ENDIAN) -#error this code is for little endian only -#endif - -union overlay64 { - uint64_t longw; - struct { - uint32_t lower; - uint32_t higher; - } words; -}; - - -uint64_t __ashldi3(uint64_t num, unsigned shift) -{ - union overlay64 output; - - output.longw = num; - if (shift >= 32) { - output.words.higher = output.words.lower << (shift - 32); - output.words.lower = 0; - } else { - if (!shift) - return num; - output.words.higher = (output.words.higher << shift) | - (output.words.lower >> (32 - shift)); - output.words.lower = output.words.lower << shift; - } - return output.longw; -} - -uint64_t __lshrdi3(uint64_t num, unsigned shift) -{ - union overlay64 output; - - output.longw = num; - if (shift >= 32) { - output.words.lower = output.words.higher >> (shift - 32); - output.words.higher = 0; - } else { - if (!shift) - return num; - output.words.lower = output.words.lower >> shift | - (output.words.higher << (32 - shift)); - output.words.higher = output.words.higher >> shift; - } - return output.longw; -} - -#define MAX_32BIT_UINT ((((uint64_t)1) << 32) - 1) - -static uint64_t _64bit_divide(uint64_t dividend, - uint64_t divider, uint64_t *rem_p) -{ - uint64_t result = 0; - - /* - * If divider is zero - let the rest of the system care about the - * exception. - */ - if (!divider) - return 1/(uint32_t)divider; - - /* As an optimization, let's not use 64 bit division unless we must. */ - if (dividend <= MAX_32BIT_UINT) { - if (divider > MAX_32BIT_UINT) { - result = 0; - if (rem_p) - *rem_p = divider; - } else { - result = (uint32_t) dividend / (uint32_t) divider; - if (rem_p) - *rem_p = (uint32_t) dividend % - (uint32_t) divider; - } - return result; - } - - while (divider <= dividend) { - uint64_t locald = divider; - uint64_t limit = __lshrdi3(dividend, 1); - int shifts = 0; - - while (locald <= limit) { - shifts++; - locald = locald + locald; - } - result |= __ashldi3(1, shifts); - dividend -= locald; - } - - if (rem_p) - *rem_p = dividend; - - return result; -} - -uint64_t __udivdi3(uint64_t num, uint64_t den) -{ - return _64bit_divide(num, den, NULL); -} - -uint64_t __umoddi3(uint64_t num, uint64_t den) -{ - uint64_t v = 0; - - _64bit_divide(num, den, &v); - return v; -} diff --git a/payloads/libpayload/libc/Makefile.inc b/payloads/libpayload/libc/Makefile.inc index edef62cc4d..348dc117ea 100644 --- a/payloads/libpayload/libc/Makefile.inc +++ b/payloads/libpayload/libc/Makefile.inc @@ -39,7 +39,3 @@ libc-$(CONFIG_LP_LIBC) += hexdump.c libc-$(CONFIG_LP_LIBC) += die.c libc-$(CONFIG_LP_LIBC) += coreboot.c libc-$(CONFIG_LP_LIBC) += fmap.c - -ifeq ($(CONFIG_LP_ARCH_MIPS),y) -libc-$(CONFIG_LP_LIBC) += 64bit_div.c -endif diff --git a/payloads/libpayload/sample/Makefile b/payloads/libpayload/sample/Makefile index 18121dfe80..b67d876efa 100644 --- a/payloads/libpayload/sample/Makefile +++ b/payloads/libpayload/sample/Makefile @@ -34,7 +34,6 @@ include ../.xcompile ARCH-$(CONFIG_LP_ARCH_ARM) := arm ARCH-$(CONFIG_LP_ARCH_X86) := x86_32 ARCH-$(CONFIG_LP_ARCH_ARM64) := arm64 -ARCH-$(CONFIG_LP_ARCH_MIPS) := mips CC := $(CC_$(ARCH-y)) AS := $(AS_$(ARCH-y)) |