Stefan Reinauer (stefan.reinauer(a)coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4235
-gerrit
commit 1c5757e51089332d8c43085fca85844a46ab9509
Author: Stefan Reinauer <reinauer(a)chromium.org>
Date: Tue May 21 10:29:50 2013 -0700
libpayload: Drop PowerPC architecture
This was never completed / working and we have the working
ARMv7 port for an architecture template, so get rid of this
dead code.
Change-Id: Ic2c1267ee5546dd6e1b63220c263b2fa86c8ae33
Signed-off-by: Stefan Reinauer <reinauer(a)google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/56065
Reviewed-by: Patrick Georgi <patrick(a)georgi-clan.de>
Reviewed-by: Ronald G. Minnich <rminnich(a)chromium.org>
Commit-Queue: Stefan Reinauer <reinauer(a)chromium.org>
---
payloads/libpayload/Config.in | 5 -
payloads/libpayload/Makefile | 2 -
payloads/libpayload/Makefile.inc | 1 -
payloads/libpayload/arch/Config.in | 1 -
payloads/libpayload/arch/powerpc/Config.in | 37 -----
payloads/libpayload/arch/powerpc/Makefile.inc | 34 ----
payloads/libpayload/arch/powerpc/coreboot.c | 171 ---------------------
payloads/libpayload/arch/powerpc/exec.S | 100 ------------
payloads/libpayload/arch/powerpc/head.S | 87 -----------
payloads/libpayload/arch/powerpc/main.c | 73 ---------
payloads/libpayload/arch/powerpc/sysinfo.c | 80 ----------
payloads/libpayload/arch/powerpc/timer.c | 65 --------
payloads/libpayload/arch/powerpc/util.S | 40 -----
payloads/libpayload/arch/powerpc/virtual.c | 37 -----
payloads/libpayload/bin/lpgcc | 7 -
payloads/libpayload/include/powerpc/arch/io.h | 123 ---------------
payloads/libpayload/include/powerpc/arch/types.h | 60 --------
payloads/libpayload/include/powerpc/arch/virtual.h | 41 -----
18 files changed, 964 deletions(-)
diff --git a/payloads/libpayload/Config.in b/payloads/libpayload/Config.in
index bb5176f..ae90285 100644
--- a/payloads/libpayload/Config.in
+++ b/payloads/libpayload/Config.in
@@ -72,11 +72,6 @@ config ARCH_ARMV7
help
Support the x86 architecture
-config ARCH_POWERPC
- bool "PowerPC"
- help
- Support the PowerPC architecture
-
config ARCH_X86
bool "x86"
help
diff --git a/payloads/libpayload/Makefile b/payloads/libpayload/Makefile
index bfa1abf..a1e8dc7 100644
--- a/payloads/libpayload/Makefile
+++ b/payloads/libpayload/Makefile
@@ -92,7 +92,6 @@ include util/kconfig/Makefile
include $(HAVE_DOTCONFIG)
ARCHDIR-$(CONFIG_ARCH_ARMV7) := armv7
-ARCHDIR-$(CONFIG_ARCH_POWERPC) := powerpc
ARCHDIR-$(CONFIG_ARCH_X86) := x86
ARCH-y := $(ARCHDIR-y)
@@ -100,7 +99,6 @@ ARCH-y := $(ARCHDIR-y)
# If architecture folder name is different from GCC binutils architecture name,
# override here.
ARCH-$(CONFIG_ARCH_ARMV7) := armv7
-ARCH-$(CONFIG_ARCH_POWERPC) := powerpc
ARCH-$(CONFIG_ARCH_X86) := i386
CC := $(CC_$(ARCH-y))
diff --git a/payloads/libpayload/Makefile.inc b/payloads/libpayload/Makefile.inc
index 7f8889e..dee33bc 100644
--- a/payloads/libpayload/Makefile.inc
+++ b/payloads/libpayload/Makefile.inc
@@ -33,7 +33,6 @@ export KERNELVERSION := 0.2.0
ARCHDIR-$(CONFIG_ARCH_ARMV7) := armv7
ARCHDIR-$(CONFIG_ARCH_X86) := x86
-ARCHDIR-$(CONFIG_ARCH_POWERPC) := powerpc
DESTDIR ?= install
real-target: lib
diff --git a/payloads/libpayload/arch/Config.in b/payloads/libpayload/arch/Config.in
index ebc03c6..1049da0 100644
--- a/payloads/libpayload/arch/Config.in
+++ b/payloads/libpayload/arch/Config.in
@@ -28,5 +28,4 @@
##
source "arch/armv7/Config.in"
-source "arch/powerpc/Config.in"
source "arch/x86/Config.in"
diff --git a/payloads/libpayload/arch/powerpc/Config.in b/payloads/libpayload/arch/powerpc/Config.in
deleted file mode 100644
index f64f006..0000000
--- a/payloads/libpayload/arch/powerpc/Config.in
+++ /dev/null
@@ -1,37 +0,0 @@
-##
-## This file is part of the libpayload project.
-##
-## Copyright (c) 2012 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.
-##
-
-if ARCH_POWERPC
-
-config ARCH_SPECIFIC_OPTIONS # dummy
- def_bool y
- select BIG_ENDIAN
- select IO_ADDRESS_SPACE
-
-endif
diff --git a/payloads/libpayload/arch/powerpc/Makefile.inc b/payloads/libpayload/arch/powerpc/Makefile.inc
deleted file mode 100644
index 44ce431..0000000
--- a/payloads/libpayload/arch/powerpc/Makefile.inc
+++ /dev/null
@@ -1,34 +0,0 @@
-##
-## This file is part of the libpayload project.
-##
-## Copyright (C) 2008 Advanced Micro Devices, 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.
-##
-
-head.o-y := head.S
-libc-y += main.c sysinfo.c
-libc-y += timer.c coreboot.c util.S
-libc-y += exec.S virtual.c
-
diff --git a/payloads/libpayload/arch/powerpc/coreboot.c b/payloads/libpayload/arch/powerpc/coreboot.c
deleted file mode 100644
index 7da87ed..0000000
--- a/payloads/libpayload/arch/powerpc/coreboot.c
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * This file is part of the libpayload project.
- *
- * Copyright (C) 2008 Advanced Micro Devices, Inc.
- * Copyright (C) 2009 coresystems GmbH
- *
- * 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 <libpayload.h>
-#include <coreboot_tables.h>
-
-/*
- * Some of this is x86 specific, and the rest of it is generic. Right now,
- * since we only support x86, we'll avoid trying to make lots of infrastructure
- * we don't need. If in the future, we want to use coreboot on some other
- * architecture, then take out the generic parsing code and move it elsewhere.
- */
-
-/* === Parsing code === */
-/* This is the generic parsing code. */
-
-static void cb_parse_memory(unsigned char *ptr, struct sysinfo_t *info)
-{
- struct cb_memory *mem = (struct cb_memory *)ptr;
- int count = MEM_RANGE_COUNT(mem);
- int i;
-
- if (count > SYSINFO_MAX_MEM_RANGES)
- count = SYSINFO_MAX_MEM_RANGES;
-
- info->n_memranges = 0;
-
- for (i = 0; i < count; i++) {
- struct cb_memory_range *range =
- (struct cb_memory_range *)MEM_RANGE_PTR(mem, i);
-
-#ifdef CONFIG_MEMMAP_RAM_ONLY
- if (range->type != CB_MEM_RAM)
- continue;
-#endif
-
- info->memrange[info->n_memranges].base =
- UNPACK_CB64(range->start);
-
- info->memrange[info->n_memranges].size =
- UNPACK_CB64(range->size);
-
- info->memrange[info->n_memranges].type = range->type;
-
- info->n_memranges++;
- }
-}
-
-static void cb_parse_serial(unsigned char *ptr, struct sysinfo_t *info)
-{
- struct cb_serial *ser = (struct cb_serial *)ptr;
- if (ser->type != CB_SERIAL_TYPE_IO_MAPPED)
- return;
- info->ser_ioport = ser->baseaddr;
-}
-
-#ifdef CONFIG_NVRAM
-static void cb_parse_optiontable(unsigned char *ptr, struct sysinfo_t *info)
-{
- info->option_table = (struct cb_cmos_option_table *)ptr;
-}
-
-static void cb_parse_checksum(unsigned char *ptr, struct sysinfo_t *info)
-{
- struct cb_cmos_checksum *cmos_cksum = (struct cb_cmos_checksum *)ptr;
- info->cmos_range_start = cmos_cksum->range_start;
- info->cmos_range_end = cmos_cksum->range_end;
- info->cmos_checksum_location = cmos_cksum->location;
-}
-#endif
-
-static int cb_parse_header(void *addr, int len, struct sysinfo_t *info)
-{
- struct cb_header *header;
- unsigned char *ptr = (unsigned char *)addr;
- int i;
-
- for (i = 0; i < len; i += 16, ptr += 16) {
- header = (struct cb_header *)ptr;
- if (!strncmp((const char *)header->signature, "LBIO", 4))
- break;
- }
-
- /* We walked the entire space and didn't find anything. */
- if (i >= len)
- return -1;
-
- if (!header->table_bytes)
- return 0;
-
- /* Make sure the checksums match. */
- if (ipchksum((u16 *) header, sizeof(*header)) != 0)
- return -1;
-
- if (ipchksum((u16 *) (ptr + sizeof(*header)),
- header->table_bytes) != header->table_checksum)
- return -1;
-
- /* Now, walk the tables. */
- ptr += header->header_bytes;
-
- for (i = 0; i < header->table_entries; i++) {
- struct cb_record *rec = (struct cb_record *)ptr;
-
- /* We only care about a few tags here (maybe more later). */
- switch (rec->tag) {
- case CB_TAG_FORWARD:
- return cb_parse_header((void *)(unsigned long)((struct cb_forward *)rec)->forward, len, info);
- continue;
- case CB_TAG_MEMORY:
- cb_parse_memory(ptr, info);
- break;
- case CB_TAG_SERIAL:
- cb_parse_serial(ptr, info);
- break;
-#ifdef CONFIG_NVRAM
- case CB_TAG_CMOS_OPTION_TABLE:
- cb_parse_optiontable(ptr, info);
- break;
- case CB_TAG_OPTION_CHECKSUM:
- cb_parse_checksum(ptr, info);
- break;
-#endif
- }
-
- ptr += rec->size;
- }
-
- return 1;
-}
-
-/* == Architecture specific == */
-/* This is the x86 specific stuff. */
-
-int get_coreboot_info(struct sysinfo_t *info)
-{
- int ret = cb_parse_header(phys_to_virt(0x00000000), 0x1000, info);
-
- if (ret != 1)
- ret = cb_parse_header(phys_to_virt(0x000f0000), 0x1000, info);
-
- return (ret == 1) ? 0 : -1;
-}
diff --git a/payloads/libpayload/arch/powerpc/exec.S b/payloads/libpayload/arch/powerpc/exec.S
deleted file mode 100644
index 45672cb..0000000
--- a/payloads/libpayload/arch/powerpc/exec.S
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * This file is part of the libpayload project.
- *
- * Copyright (C) 2008 Advanced Micro Devices, 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.
- */
-
-/* calling syntax: i386_do_exec(long addr, int argc, char **argv, int *ret) */
-
-/* This implements the payload API detailed here:
- * http://www.coreboot.org/Payload_API
- */
-
-.align 4
-.text
-
-.globl powerpc_do_exec
- .type powerpc_do_exec,@function
-
-powerpc_do_exec:
-#if 0
- pushl %ebp
- movl %esp, %ebp
- pushl %eax
-
- /* Put the run address in %eax */
- movl 8(%ebp), %eax
-
- /* Save off the rest of the registers */
-
- pushl %esi
- pushl %ecx
- pushl %ebp
-
- /* Push the argc and argv pointers on to the stack */
-
- movl 12(%ebp), %esi
- movl 16(%ebp), %ecx
-
- pushl %esi
- pushl %ecx
-
- /* Move a "magic" number on the stack - the other
- * payload will use this as a clue that the argc
- * and argv are sane
- */
-
- movl $12345678, %ecx
- pushl %ecx
-
- /* Jump to the code */
- call *%eax
-
- /* %eax has the return value */
-
- /* Skip over the argc/argv stuff still on the stack */
- addl $12, %esp
-
- /* Get back %ebp */
- popl %ebp
-
- /* Get the pointer to the return value
- * and save the return value in it
- */
-
- movl 20(%ebp), %ecx
- movl %eax, (%eax)
-
- /* Get the rest of the saved registers */
- popl %ecx
- popl %esi
- popl %eax
-
- /* Restore the stack pointer */
- movl %ebp,%esp
- popl %ebp
- ret
-#endif
diff --git a/payloads/libpayload/arch/powerpc/head.S b/payloads/libpayload/arch/powerpc/head.S
deleted file mode 100644
index de6edad..0000000
--- a/payloads/libpayload/arch/powerpc/head.S
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * This file is part of the libpayload project.
- *
- * Copyright (C) 2008 Advanced Micro Devices, 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.
- */
-
- .globl _entry, _leave
- .text
- .align 4
-
-/*
- * Our entry point - assume that the CPU is in 32 bit protected mode and
- * all segments are in a flat model. That's our operating mode, so we won't
- * change anything.
- */
-_entry:
-#if 0
- call _init
-
- /* We're back - go back to the bootloader. */
- ret
- .align 4
-
-
-/*
- * This function saves off the previous stack and switches us to our
- * own execution environment.
- */
-_init:
- /* No interrupts, please. */
- cli
-
- /* Store current stack pointer. */
- movl %esp, %esi
-
- /* Store EAX and EBX */
-
- movl %eax,loader_eax
- movl %ebx,loader_ebx
-
- /* Setup new stack. */
- movl $_stack, %ebx
-
- movl %ebx, %esp
-
- /* Save old stack pointer. */
- pushl %esi
-
- /* Let's rock. */
- call start_main
-
-#endif
- /* %eax has the return value - pass it on unmolested */
-_leave:
-#if 0
- /* Get old stack pointer. */
- popl %ebx
-
- /* Restore old stack. */
- movl %ebx, %esp
-
- /* Return to the original context. */
- ret
-#endif
diff --git a/payloads/libpayload/arch/powerpc/main.c b/payloads/libpayload/arch/powerpc/main.c
deleted file mode 100644
index 9722e0c..0000000
--- a/payloads/libpayload/arch/powerpc/main.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * This file is part of the libpayload project.
- *
- * Copyright (C) 2008 Advanced Micro Devices, 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>
-
-unsigned long loader_eax; /**< The value of EAX passed from the loader */
-unsigned long loader_ebx; /**< The value of EBX passed from the loader */
-
-unsigned int main_argc; /**< The argc value to pass to main() */
-
-/** 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);
-
- /* Optionally set up the consoles. */
-#ifndef CONFIG_SKIP_CONSOLE_INIT
- console_init();
-#endif
-
- /* Gather system information. */
- lib_get_sysinfo();
-
- /*
- * 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/powerpc/sysinfo.c b/payloads/libpayload/arch/powerpc/sysinfo.c
deleted file mode 100644
index 6c1ef3f..0000000
--- a/payloads/libpayload/arch/powerpc/sysinfo.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * This file is part of the libpayload project.
- *
- * Copyright (C) 2008 Advanced Micro Devices, 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 <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,
-#ifdef CONFIG_SERIAL_CONSOLE
- .ser_ioport = CONFIG_SERIAL_IOBASE,
-#else
- .ser_ioport = 0x3f8,
-#endif
-};
-
-int lib_get_sysinfo(void)
-{
- int ret;
-
- /* Get the CPU speed (for delays). */
- lib_sysinfo.cpu_khz = get_cpu_speed();
-
-#ifdef CONFIG_MULTIBOOT
- /* Get the information from the multiboot tables,
- * if they exist */
- get_multiboot_info(&lib_sysinfo);
-#endif
-
- /* Get information from the coreboot tables,
- * if they exist */
-
- ret = get_coreboot_info(&lib_sysinfo);
-
- if (!lib_sysinfo.n_memranges) {
- /* If we can't get a good memory range, use the default. */
- lib_sysinfo.n_memranges = 2;
-
- lib_sysinfo.memrange[0].base = 0;
- lib_sysinfo.memrange[0].size = 640 * 1024;
- lib_sysinfo.memrange[0].type = CB_MEM_RAM;
-
- lib_sysinfo.memrange[1].base = 1024 * 1024;
- lib_sysinfo.memrange[1].size = 31 * 1024 * 1024;
- lib_sysinfo.memrange[1].type = CB_MEM_RAM;
- }
-
- return ret;
-}
diff --git a/payloads/libpayload/arch/powerpc/timer.c b/payloads/libpayload/arch/powerpc/timer.c
deleted file mode 100644
index fb181a4..0000000
--- a/payloads/libpayload/arch/powerpc/timer.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * This file is part of the libpayload project.
- *
- * Copyright (C) 2008 Advanced Micro Devices, 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.
- */
-
-/**
- * @file i386/timer.c
- * i386 specific timer routines
- */
-
-#include <libpayload.h>
-
-/**
- * @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)
-{
- /* FIXME */
- cpu_khz = 200 * 1024;
- return cpu_khz;
-}
-
-uint64_t timer_hz(void)
-{
- /* FIXME */
- return 0;
-}
-
-uint64_t timer_raw_value(void)
-{
- /* FIXME */
- return 0;
-}
diff --git a/payloads/libpayload/arch/powerpc/util.S b/payloads/libpayload/arch/powerpc/util.S
deleted file mode 100644
index 2905be7..0000000
--- a/payloads/libpayload/arch/powerpc/util.S
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * This file is part of the libpayload project.
- *
- * Copyright (C) 2008 Advanced Micro Devices, 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.
- */
-
- .globl halt
- .text
- .align 4
-
-/* This function puts the system into a halt. */
-halt:
-#if 0
- cli
- hlt
- jmp halt
-#endif
diff --git a/payloads/libpayload/arch/powerpc/virtual.c b/payloads/libpayload/arch/powerpc/virtual.c
deleted file mode 100644
index 6ff588c..0000000
--- a/payloads/libpayload/arch/powerpc/virtual.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * This file is part of the libpayload project.
- *
- * Copyright (C) 2008 coresystems GmbH
- *
- * 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 <unistd.h>
-
-unsigned long virtual_offset = 0;
-
-int getpagesize(void)
-{
- return 4096;
-}
diff --git a/payloads/libpayload/bin/lpgcc b/payloads/libpayload/bin/lpgcc
index f0b2417..43eb016 100755
--- a/payloads/libpayload/bin/lpgcc
+++ b/payloads/libpayload/bin/lpgcc
@@ -75,13 +75,6 @@ if [ "$CONFIG_ARCH_ARMV7" = "y" ]; then
_ARCH=armv7
fi
-if [ "$CONFIG_ARCH_POWERPC" = "y" ]; then
- _ARCHINCDIR=$_INCDIR/powerpc
- _ARCHLIBDIR=$_LIBDIR/powerpc
- _ARCHEXTRA=""
- _ARCH=powerpc
-fi
-
if [ "$CONFIG_ARCH_X86" = "y" ]; then
_ARCHINCDIR=$_INCDIR/x86
_ARCHLIBDIR=$_LIBDIR/x86
diff --git a/payloads/libpayload/include/powerpc/arch/io.h b/payloads/libpayload/include/powerpc/arch/io.h
deleted file mode 100644
index 1676a8a..0000000
--- a/payloads/libpayload/include/powerpc/arch/io.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * This file is part of the libpayload project.
- *
- * Copyright (C) 2008 Advanced Micro Devices, Inc.
- * Copyright (C) 2008-2009 coresystems GmbH
- *
- * 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.
- */
-
-#ifndef _ARCH_IO_H
-#define _ARCH_IO_H
-
-extern uint32_t isa_io_base;
-
-#define readb(_a) (*(volatile unsigned char *) (_a))
-#define readw(_a) (*(volatile unsigned short *) (_a))
-#define readl(_a) (*(volatile unsigned long *) (_a))
-
-#define writeb(_v, _a) (*(volatile unsigned char *) (_a) = (_v))
-#define writew(_v, _a) (*(volatile unsigned short *) (_a) = (_v))
-#define writel(_v, _a) (*(volatile unsigned long *) (_a) = (_v))
-
-static inline unsigned long inl(int port)
-{
- volatile unsigned char *addr = (volatile unsigned char *)(isa_io_base + port);
- unsigned long val;
- __asm__ __volatile__("lhbrx %0,0,%1; eieio":"=r"(val):
- "r"(addr), "m"(*addr));
- return val;
-}
-
-static inline unsigned short inw(int port)
-{
- volatile unsigned char *addr = (volatile unsigned char *)(isa_io_base + port);
- unsigned short val;
- __asm__ __volatile__("lwbrx %0,0,%1; eieio":"=r"(val):"r"(addr), "m"(*addr));
- return val;
-}
-
-static inline unsigned char inb(int port)
-{
- volatile unsigned char *addr = (volatile unsigned char *)(isa_io_base + port);
- unsigned char val;
- __asm__ __volatile__("lbz%U1%X1 %0,%1; eieio":"=r"(val):"m"(*addr));
- return val;
-}
-
-static inline void outl(unsigned long val, int port)
-{
- volatile unsigned char *addr = (volatile unsigned char *)(isa_io_base + port);
- __asm__ __volatile__("stb%U0%X0 %1,%0; eieio":"=m"(*addr):"r"(val));
-}
-
-static inline void outw(unsigned short val, int port)
-{
- volatile unsigned char *addr = (volatile unsigned char *)(isa_io_base + port);
- __asm__ __volatile__("sthbrx %1,0,%2; eieio":"=m"(*addr):"r"(val),"r"(addr));
-}
-
-static inline void outb(unsigned char val, int port)
-{
- volatile unsigned char *addr = (volatile unsigned char *)(isa_io_base + port);
- __asm__ __volatile__("stwbrx %1,0,%2; eieio":"=m"(*addr):"r"(val), "r"(addr));
-}
-
-static inline void outsl(int port, const void *addr, unsigned long count)
-{
- volatile unsigned char *addr = (volatile unsigned char *)(isa_io_base + port);
- //__asm__ __volatile__("rep; outsl" : "+S"(addr), "+c"(count) : "d"(port));
-}
-
-static inline void outsw(int port, const void *addr, unsigned long count)
-{
- volatile unsigned char *addr = (volatile unsigned char *)(isa_io_base + port);
- //__asm__ __volatile__("rep; outsw" : "+S"(addr), "+c"(count) : "d"(port));
-}
-
-static inline void outsb(int port, const void *addr, unsigned long count)
-{
- volatile unsigned char *addr = (volatile unsigned char *)(isa_io_base + port);
- //__asm__ __volatile__("rep; outsb" : "+S"(addr), "+c"(count) : "d"(port));
-}
-
-static inline void insl(int port, void *addr, unsigned long count)
-{
- volatile unsigned char *addr = (volatile unsigned char *)(isa_io_base + port);
- //__asm__ __volatile__("rep; insl" : "+D"(addr), "+c"(count) : "d"(port));
-}
-
-static inline void insw(int port, void *addr, unsigned long count)
-{
- volatile unsigned char *addr = (volatile unsigned char *)(isa_io_base + port);
- //__asm__ __volatile__("rep; insw" : "+D"(addr), "+c"(count) : "d"(port));
-}
-
-static inline void insb(int port, void *addr, unsigned long count)
-{
- volatile unsigned char *addr = (volatile unsigned char *)(isa_io_base + port);
- //__asm__ __volatile__("rep; insb" : "+D"(addr), "+c"(count) : "d"(port));
-}
-
-#endif
diff --git a/payloads/libpayload/include/powerpc/arch/types.h b/payloads/libpayload/include/powerpc/arch/types.h
deleted file mode 100644
index 1bd815b..0000000
--- a/payloads/libpayload/include/powerpc/arch/types.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * This file is part of the libpayload project.
- *
- * Copyright (C) 2007 Uwe Hermann <uwe(a)hermann-uwe.de>
- *
- * 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.
- */
-
-#ifndef _ARCH_TYPES_H
-#define _ARCH_TYPES_H
-
-typedef unsigned char uint8_t;
-typedef unsigned char u8;
-typedef signed char int8_t;
-typedef signed char s8;
-
-typedef unsigned short uint16_t;
-typedef unsigned short u16;
-typedef signed short int16_t;
-typedef signed short s16;
-
-typedef unsigned int uint32_t;
-typedef unsigned int u32;
-typedef signed int int32_t;
-typedef signed int s32;
-
-typedef unsigned long long uint64_t;
-typedef unsigned long long u64;
-typedef signed long long int64_t;
-typedef signed long long s64;
-
-typedef long time_t;
-typedef long suseconds_t;
-
-#ifndef NULL
-#define NULL ((void *)0)
-#endif
-
-#endif
diff --git a/payloads/libpayload/include/powerpc/arch/virtual.h b/payloads/libpayload/include/powerpc/arch/virtual.h
deleted file mode 100644
index 328c3aa..0000000
--- a/payloads/libpayload/include/powerpc/arch/virtual.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * This file is part of the libpayload project.
- *
- * Copyright (C) 2008 coresystems GmbH
- *
- * 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.
- */
-
-#ifndef _ARCH_VIRTUAL_H
-#define _ARCH_VIRTUAL_H
-
-extern unsigned long virtual_offset;
-
-#define virt_to_phys(virt) ((unsigned long) (virt) + virtual_offset)
-#define phys_to_virt(phys) ((void *) ((unsigned long) (phys) - virtual_offset))
-
-#define virt_to_bus(addr) virt_to_phys(addr)
-#define bus_to_virt(addr) phys_to_virt(addr)
-
-#endif
Stefan Reinauer (stefan.reinauer(a)coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4231
-gerrit
commit a43dfa73a1a70f080894af49241769c1cddee4a1
Author: Duncan Laurie <dlaurie(a)chromium.org>
Date: Mon Jun 10 10:41:04 2013 -0700
Clean up POST codes for Boot State machine
Now that there is a clearly defined boot state machine
we can add some useful post codes to indicate the current
point in the state machine by having it log a post code
before the execution of each state.
This removes the currently defined POST codes that were
used by hardwaremain in favor of a new contiguous range
that are defined for each boot state.
The reason for this is that the existing codes are mostly
used to indicate when something is done, which is confusing
for actual debug because POST code debugging relies on knowing
what is about to happen (to know what may be at fault) rather
than what has just finished.
One additonal change is added during device init step as this
step often does the bulk of the work, and frequently logs POST
codes itself. Therefore in order to keep better track of what
device is being initialized POST_BS_DEV_INIT is logged before
each device is initialized.
interrupted boot with reset button and
gathered the eventlog. Mosys has been extended to
decode the well-known POST codes:
26 | 2013-06-10 10:32:48 | System boot | 120
27 | 2013-06-10 10:32:48 | Last post code in previous boot | 0x75 | Device Initialize
28 | 2013-06-10 10:32:48 | Extra info from previous boot | PCI | 00:16.0
29 | 2013-06-10 10:32:48 | Reset Button
30 | 2013-06-10 10:32:48 | System Reset
Change-Id: Ida1e1129d274d28cbe8e49e4a01483e335a03d96
Signed-off-by: Duncan Laurie <dlaurie(a)chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/58106
---
src/device/device.c | 1 +
src/include/console/post_codes.h | 80 ++++++++++++++++++++++++++++++++++------
src/lib/hardwaremain.c | 13 ++++---
3 files changed, 77 insertions(+), 17 deletions(-)
diff --git a/src/device/device.c b/src/device/device.c
index dee797e..8bde663 100644
--- a/src/device/device.c
+++ b/src/device/device.c
@@ -1162,6 +1162,7 @@ static void init_link(struct bus *link)
struct bus *c_link;
for (dev = link->children; dev; dev = dev->sibling) {
+ post_code(POST_BS_DEV_INIT);
post_log_path(dev);
init_dev(dev);
}
diff --git a/src/include/console/post_codes.h b/src/include/console/post_codes.h
index 4dc3d37..df1d5e8 100644
--- a/src/include/console/post_codes.h
+++ b/src/include/console/post_codes.h
@@ -120,32 +120,88 @@
#define POST_ENABLING_CACHE 0x60
/**
- * \brief Devices have been enumerated
+ * \brief Before Device Probe
*
- * Bus scan, and device enumeration has completed.
+ * Boot State Machine: bs_pre_device()
*/
-#define POST_DEVICE_ENUMERATION_COMPLETE 0x66
+#define POST_BS_PRE_DEVICE 0x70
/**
- * \brief Devices have been configured
+ * \brief Initializing Chips
*
- * Device configuration has completed.
+ * Boot State Machine: bs_dev_init_chips()
*/
-#define POST_DEVICE_CONFIGURATION_COMPLETE 0x88
+#define POST_BS_DEV_INIT_CHIPS 0x71
/**
- * \brief Devices have been enabled
+ * \brief Starting Device Enumeration
*
- * Devices have been enabled.
+ * Boot State Machine: bs_dev_enumerate()
*/
-#define POST_DEVICES_ENABLED 0x89
+#define POST_BS_DEV_ENUMERATE 0x72
/**
- * \brief Devices have been initialized
+ * \brief Device Resource Allocatio
*
- * Devices have been initialized.
+ * Boot State Machine: bs_dev_resources()
*/
-#define POST_DEVICES_INITIALIZED 0x8a
+#define POST_BS_DEV_RESOURCES 0x73
+
+/**
+ * \brief Device Enable
+ *
+ * Boot State Machine: bs_dev_enable()
+ */
+#define POST_BS_DEV_ENABLE 0x74
+
+/**
+ * \brief Device Initialization
+ *
+ * Boot State Machine: bs_dev_init()
+ */
+#define POST_BS_DEV_INIT 0x75
+
+/**
+ * \brief After Device Probe
+ *
+ * Boot State Machine: bs_post_device()
+ */
+#define POST_BS_POST_DEVICE 0x76
+
+/**
+ * \brief OS Resume Check
+ *
+ * Boot State Machine: bs_os_resume_check()
+ */
+#define POST_BS_OS_RESUME_CHECK 0x77
+
+/**
+ * \brief OS Resume
+ *
+ * Boot State Machine: bs_os_resume()
+ */
+#define POST_BS_OS_RESUME 0x78
+
+/**
+ * \brief Write Tables
+ *
+ * Boot State Machine: bs_write_tables()
+ */
+#define POST_BS_WRITE_TABLES 0x79
+
+/**
+ * \brief Load Payload
+ *
+ * Boot State Machine: bs_payload_load()
+ */
+#define POST_BS_PAYLOAD_LOAD 0x7a
+
+/**
+ * \brief Boot Payload
+ *
+ * Boot State Machine: bs_payload_boot()
+ */
+#define POST_BS_PAYLOAD_BOOT 0x7b
/**
* \brief Entry into elf boot
diff --git a/src/lib/hardwaremain.c b/src/lib/hardwaremain.c
index 501591f..fed153b 100644
--- a/src/lib/hardwaremain.c
+++ b/src/lib/hardwaremain.c
@@ -24,6 +24,7 @@
#include <bootstate.h>
#include <console/console.h>
+#include <console/post_codes.h>
#include <version.h>
#include <device/device.h>
#include <device/pci.h>
@@ -83,6 +84,7 @@ struct boot_phase {
struct boot_state {
const char *name;
boot_state_t id;
+ u8 post_code;
struct boot_phase phases[2];
boot_state_t (*run_state)(void *arg);
void *arg;
@@ -96,6 +98,7 @@ struct boot_state {
{ \
.name = #state_, \
.id = state_, \
+ .post_code = POST_ ## state_, \
.phases = { { NULL, 0 }, { NULL, 0 } }, \
.run_state = run_func_, \
.arg = NULL, \
@@ -138,7 +141,6 @@ static boot_state_t bs_dev_enumerate(void *arg)
{
/* Find the devices we don't have hard coded knowledge about. */
dev_enumerate();
- post_code(POST_DEVICE_ENUMERATION_COMPLETE);
return BS_DEV_RESOURCES;
}
@@ -146,9 +148,9 @@ static boot_state_t bs_dev_enumerate(void *arg)
static boot_state_t bs_dev_resources(void *arg)
{
timestamp_add_now(TS_DEVICE_CONFIGURE);
+
/* Now compute and assign the bus resources. */
dev_configure();
- post_code(POST_DEVICE_CONFIGURATION_COMPLETE);
return BS_DEV_ENABLE;
}
@@ -156,9 +158,9 @@ static boot_state_t bs_dev_resources(void *arg)
static boot_state_t bs_dev_enable(void *arg)
{
timestamp_add_now(TS_DEVICE_ENABLE);
+
/* Now actually enable devices on the bus */
dev_enable();
- post_code(POST_DEVICES_ENABLED);
return BS_DEV_INIT;
}
@@ -166,9 +168,9 @@ static boot_state_t bs_dev_enable(void *arg)
static boot_state_t bs_dev_init(void *arg)
{
timestamp_add_now(TS_DEVICE_INITIALIZE);
+
/* And of course initialize devices on the bus */
dev_initialize();
- post_code(POST_DEVICES_INITIALIZED);
return BS_POST_DEVICE;
}
@@ -194,7 +196,6 @@ static boot_state_t bs_os_resume_check(void *arg)
boot_states[BS_OS_RESUME].arg = wake_vector;
return BS_OS_RESUME;
}
- post_code(0x8a);
#endif
timestamp_add_now(TS_CBMEM_POST);
@@ -376,6 +377,8 @@ static void bs_walk_state_machine(void)
bs_sample_time(state);
+ post_code(state->post_code);
+
next_id = state->run_state(state->arg);
printk(BS_DEBUG_LVL, "BS: Exiting %s state.\n", state->name);
Stefan Reinauer (stefan.reinauer(a)coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4230
-gerrit
commit 60af9d2e7e64b0a0da6bc44b1d61b5516052a986
Author: Duncan Laurie <dlaurie(a)chromium.org>
Date: Mon Jun 10 10:34:20 2013 -0700
Log device path into CMOS during probe stages
One of the most common hangs during coreboot execution
is during ramstage device init steps. Currently there
are a set of (somewhat misleading) post codes during this
phase which give some indication as to where execution
stopped, but it provides no information on what device
was actually being initialized at that point.
This uses the new CMOS "extra" log banks to store the
encoded device path of the device that is about to be
touched by coreboot. This way if the system hangs when
talking to the device there will be some indication where
to investigate next.
interrupted boot with reset button and
gathered the eventlog after several test runs:
26 | 2013-06-10 10:32:48 | System boot | 120
27 | 2013-06-10 10:32:48 | Last post code in previous boot | 0x75 | Device Initialize
28 | 2013-06-10 10:32:48 | Extra info from previous boot | PCI | 00:16.0
29 | 2013-06-10 10:32:48 | Reset Button
30 | 2013-06-10 10:32:48 | System Reset
Change-Id: I6045bd4c384358b8a4e464eb03ccad639283939c
Signed-off-by: Duncan Laurie <dlaurie(a)chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/58105
---
src/arch/x86/lib/cpu.c | 3 +++
src/console/post.c | 16 ++++++++++++++++
src/device/device.c | 17 +++++++++++++++--
src/include/console/console.h | 5 +++++
src/include/pc80/mc146818rtc.h | 2 ++
5 files changed, 41 insertions(+), 2 deletions(-)
diff --git a/src/arch/x86/lib/cpu.c b/src/arch/x86/lib/cpu.c
index bddfe1a..4a3bd96 100644
--- a/src/arch/x86/lib/cpu.c
+++ b/src/arch/x86/lib/cpu.c
@@ -256,6 +256,8 @@ void cpu_initialize(unsigned int index)
die("CPU: missing cpu device structure");
}
+ post_log_path(cpu);
+
/* Find what type of cpu we are dealing with */
identify_cpu(cpu);
printk(BIOS_DEBUG, "CPU: vendor %s device %x\n",
@@ -285,6 +287,7 @@ void cpu_initialize(unsigned int index)
cpu->initialized = 1;
cpu->ops->init(cpu);
}
+ post_log_clear();
printk(BIOS_INFO, "CPU #%d initialized\n", index);
diff --git a/src/console/post.c b/src/console/post.c
index 7488683..35cc0e8 100644
--- a/src/console/post.c
+++ b/src/console/post.c
@@ -114,6 +114,22 @@ void post_log_extra(u32 value)
spin_unlock(&cmos_post_lock);
}
+
+void post_log_path(struct device *dev)
+{
+ if (dev) {
+ /* Encode path into lower 3 bytes */
+ u32 path = dev_path_encode(dev);
+ /* Upper byte contains the log type */
+ path |= CMOS_POST_EXTRA_DEV_PATH << 24;
+ post_log_extra(path);
+ }
+}
+
+void post_log_clear(void)
+{
+ post_log_extra(0);
+}
#endif /* CONFIG_CMOS_POST_EXTRA */
#endif /* !__PRE_RAM__ */
diff --git a/src/device/device.c b/src/device/device.c
index a2a64b2..dee797e 100644
--- a/src/device/device.c
+++ b/src/device/device.c
@@ -66,10 +66,12 @@ void dev_initialize_chips(void)
/* Initialize chip if we haven't yet. */
if (dev->chip_ops && dev->chip_ops->init &&
!dev->chip_ops->initialized) {
+ post_log_path(dev);
dev->chip_ops->init(dev->chip_info);
dev->chip_ops->initialized = 1;
}
}
+ post_log_clear();
}
/**
@@ -841,8 +843,10 @@ void assign_resources(struct bus *bus)
dev_path(curdev));
continue;
}
+ post_log_path(curdev);
curdev->ops->set_resources(curdev);
}
+ post_log_clear();
printk(BIOS_SPEW, "%s assign_resources, bus %d link: %d\n",
dev_path(bus->dev), bus->secondary, bus->link_num);
}
@@ -865,14 +869,17 @@ static void enable_resources(struct bus *link)
struct bus *c_link;
for (dev = link->children; dev; dev = dev->sibling) {
- if (dev->enabled && dev->ops && dev->ops->enable_resources)
+ if (dev->enabled && dev->ops && dev->ops->enable_resources) {
+ post_log_path(dev);
dev->ops->enable_resources(dev);
+ }
}
for (dev = link->children; dev; dev = dev->sibling) {
for (c_link = dev->link_list; c_link; c_link = c_link->next)
enable_resources(c_link);
}
+ post_log_clear();
}
/**
@@ -912,6 +919,8 @@ unsigned int scan_bus(struct device *busdev, unsigned int max)
return max;
}
+ post_log_path(busdev);
+
do_scan_bus = 1;
while (do_scan_bus) {
struct bus *link;
@@ -971,6 +980,7 @@ void dev_enumerate(void)
return;
}
scan_bus(root, 0);
+ post_log_clear();
printk(BIOS_INFO, "done\n");
}
@@ -1151,8 +1161,10 @@ static void init_link(struct bus *link)
struct device *dev;
struct bus *c_link;
- for (dev = link->children; dev; dev = dev->sibling)
+ for (dev = link->children; dev; dev = dev->sibling) {
+ post_log_path(dev);
init_dev(dev);
+ }
for (dev = link->children; dev; dev = dev->sibling) {
for (c_link = dev->link_list; c_link; c_link = c_link->next)
@@ -1183,6 +1195,7 @@ void dev_initialize(void)
/* Now initialize everything. */
for (link = dev_root.link_list; link; link = link->next)
init_link(link);
+ post_log_clear();
printk(BIOS_INFO, "Devices initialized\n");
show_all_devs(BIOS_SPEW, "After init.");
diff --git a/src/include/console/console.h b/src/include/console/console.h
index e6962cc..5750b4a 100644
--- a/src/include/console/console.h
+++ b/src/include/console/console.h
@@ -74,8 +74,13 @@ void console_tx_flush(void);
void post_code(u8 value);
#if CONFIG_CMOS_POST_EXTRA
void post_log_extra(u32 value);
+struct device;
+void post_log_path(struct device *dev);
+void post_log_clear(void);
#else
#define post_log_extra(x) do {} while (0)
+#define post_log_path(x) do {} while (0)
+#define post_log_clear() do {} while (0)
#endif
/* this function is weak and can be overridden by a mainboard function. */
void mainboard_post(u8 value);
diff --git a/src/include/pc80/mc146818rtc.h b/src/include/pc80/mc146818rtc.h
index 1c3be0e..0fb06ef 100644
--- a/src/include/pc80/mc146818rtc.h
+++ b/src/include/pc80/mc146818rtc.h
@@ -212,6 +212,8 @@ static inline int get_option(void *dest __attribute__((unused)),
#define CMOS_POST_BANK_1_OFFSET (CMOS_POST_OFFSET + 2)
#define CMOS_POST_BANK_1_EXTRA (CMOS_POST_OFFSET + 7)
+#define CMOS_POST_EXTRA_DEV_PATH 0x01
+
void cmos_post_log(void);
#endif /* CONFIG_CMOS_POST */
Stefan Reinauer (stefan.reinauer(a)coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4229
-gerrit
commit 3cdbd7b49f25ca4843175d994ac659f7e20b02a3
Author: Duncan Laurie <dlaurie(a)chromium.org>
Date: Mon Jun 10 10:21:41 2013 -0700
Extend CMOS POST code logging to store extra data
This can be used to indicate sub-state within a POST
code range which can assist in debugging BIOS hangs.
For example this can be used to indicate which device
is about to be initialized so if the system hangs
while talking to that device it can be identified.
Change-Id: I2f8155155f09fe9e242ebb7204f0b5cba3a1fa1e
Signed-off-by: Duncan Laurie <dlaurie(a)chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/58104
---
src/arch/x86/include/bootblock_common.h | 4 ++++
src/console/Kconfig | 8 ++++++++
src/console/post.c | 34 +++++++++++++++++++++++++++++++++
src/include/console/console.h | 5 +++++
src/include/elog.h | 1 +
src/include/pc80/mc146818rtc.h | 9 +++++++++
6 files changed, 61 insertions(+)
diff --git a/src/arch/x86/include/bootblock_common.h b/src/arch/x86/include/bootblock_common.h
index 11fb230..4926086 100644
--- a/src/arch/x86/include/bootblock_common.h
+++ b/src/arch/x86/include/bootblock_common.h
@@ -65,6 +65,10 @@ static void cmos_post_init(void)
/* Initialize to zero */
cmos_write(0, CMOS_POST_BANK_0_OFFSET);
cmos_write(0, CMOS_POST_BANK_1_OFFSET);
+#if CONFIG_CMOS_POST_EXTRA
+ cmos_write32(CMOS_POST_BANK_0_EXTRA, 0);
+ cmos_write32(CMOS_POST_BANK_1_EXTRA, 0);
+#endif
}
cmos_write(magic, CMOS_POST_BANK_OFFSET);
diff --git a/src/console/Kconfig b/src/console/Kconfig
index d209325..c23f862 100644
--- a/src/console/Kconfig
+++ b/src/console/Kconfig
@@ -413,6 +413,14 @@ config CMOS_POST_OFFSET
If CONFIG_HAVE_OPTION_TABLE is enabled then it will use the value
defined in the mainboard option table.
+config CMOS_POST_EXTRA
+ bool "Store extra logging info into CMOS"
+ depends on CMOS_POST
+ default n
+ help
+ This will enable extra logging of work that happens between post
+ codes into CMOS for debug. This uses an additional 8 bytes of CMOS.
+
config IO_POST
bool "Send POST codes to an IO port"
depends on PC80_SYSTEM
diff --git a/src/console/post.c b/src/console/post.c
index 11c631d..7488683 100644
--- a/src/console/post.c
+++ b/src/console/post.c
@@ -25,6 +25,9 @@
#include <pc80/mc146818rtc.h>
#include <smp/spinlock.h>
#endif
+#if CONFIG_CMOS_POST_EXTRA
+#include <device/device.h>
+#endif
#include <elog.h>
/* Write POST information */
@@ -51,6 +54,9 @@ DECLARE_SPIN_LOCK(cmos_post_lock)
void cmos_post_log(void)
{
u8 code = 0;
+#if CONFIG_CMOS_POST_EXTRA
+ u32 extra = 0;
+#endif
spin_lock(&cmos_post_lock);
@@ -58,9 +64,15 @@ void cmos_post_log(void)
switch (cmos_read(CMOS_POST_BANK_OFFSET)) {
case CMOS_POST_BANK_0_MAGIC:
code = cmos_read(CMOS_POST_BANK_1_OFFSET);
+#if CONFIG_CMOS_POST_EXTRA
+ extra = cmos_read32(CMOS_POST_BANK_1_EXTRA);
+#endif
break;
case CMOS_POST_BANK_1_MAGIC:
code = cmos_read(CMOS_POST_BANK_0_OFFSET);
+#if CONFIG_CMOS_POST_EXTRA
+ extra = cmos_read32(CMOS_POST_BANK_0_EXTRA);
+#endif
break;
}
@@ -78,9 +90,31 @@ void cmos_post_log(void)
"in previous boot: 0x%02x\n", code);
#if CONFIG_ELOG
elog_add_event_word(ELOG_TYPE_LAST_POST_CODE, code);
+#if CONFIG_CMOS_POST_EXTRA
+ if (extra)
+ elog_add_event_dword(ELOG_TYPE_POST_EXTRA, extra);
+#endif
#endif
}
}
+
+#if CONFIG_CMOS_POST_EXTRA
+void post_log_extra(u32 value)
+{
+ spin_lock(&cmos_post_lock);
+
+ switch (cmos_read(CMOS_POST_BANK_OFFSET)) {
+ case CMOS_POST_BANK_0_MAGIC:
+ cmos_write32(CMOS_POST_BANK_0_EXTRA, value);
+ break;
+ case CMOS_POST_BANK_1_MAGIC:
+ cmos_write32(CMOS_POST_BANK_1_EXTRA, value);
+ break;
+ }
+
+ spin_unlock(&cmos_post_lock);
+}
+#endif /* CONFIG_CMOS_POST_EXTRA */
#endif /* !__PRE_RAM__ */
static void cmos_post_code(u8 value)
diff --git a/src/include/console/console.h b/src/include/console/console.h
index 9f347ad..e6962cc 100644
--- a/src/include/console/console.h
+++ b/src/include/console/console.h
@@ -72,6 +72,11 @@ void console_init(void);
void console_tx_byte(unsigned char byte);
void console_tx_flush(void);
void post_code(u8 value);
+#if CONFIG_CMOS_POST_EXTRA
+void post_log_extra(u32 value);
+#else
+#define post_log_extra(x) do {} while (0)
+#endif
/* this function is weak and can be overridden by a mainboard function. */
void mainboard_post(u8 value);
void __attribute__ ((noreturn)) die(const char *msg);
diff --git a/src/include/elog.h b/src/include/elog.h
index b813a10..f9b5d53 100644
--- a/src/include/elog.h
+++ b/src/include/elog.h
@@ -140,6 +140,7 @@ struct elog_event_data_me_extended {
/* Last post code from previous boot */
#define ELOG_TYPE_LAST_POST_CODE 0xa3
+#define ELOG_TYPE_POST_EXTRA 0xa6
/* EC Shutdown Reason */
#define ELOG_TYPE_EC_SHUTDOWN 0xa5
diff --git a/src/include/pc80/mc146818rtc.h b/src/include/pc80/mc146818rtc.h
index 170a433..1c3be0e 100644
--- a/src/include/pc80/mc146818rtc.h
+++ b/src/include/pc80/mc146818rtc.h
@@ -197,11 +197,20 @@ static inline int get_option(void *dest __attribute__((unused)),
# endif
#endif
+/*
+ * 0 = Bank Select Magic
+ * 1 = Bank 0 POST
+ * 2 = Bank 1 POST
+ * 3-6 = BANK 0 Extra log
+ * 7-10 = BANK 1 Extra log
+ */
#define CMOS_POST_BANK_OFFSET (CMOS_POST_OFFSET)
#define CMOS_POST_BANK_0_MAGIC 0x80
#define CMOS_POST_BANK_0_OFFSET (CMOS_POST_OFFSET + 1)
+#define CMOS_POST_BANK_0_EXTRA (CMOS_POST_OFFSET + 3)
#define CMOS_POST_BANK_1_MAGIC 0x81
#define CMOS_POST_BANK_1_OFFSET (CMOS_POST_OFFSET + 2)
+#define CMOS_POST_BANK_1_EXTRA (CMOS_POST_OFFSET + 7)
void cmos_post_log(void);
#endif /* CONFIG_CMOS_POST */
Stefan Reinauer (stefan.reinauer(a)coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4228
-gerrit
commit 5b63318e95a90f61e6fd8326e543d81f5c8e4e72
Author: Duncan Laurie <dlaurie(a)chromium.org>
Date: Mon Jun 10 09:59:17 2013 -0700
Add function to encode device path into integer
This function will encode the device path into 3
bytes of a dword which can be saved for debug.
It will be used by subsequent commit to store the
current device into CMOS for debugging BIOS hangs.
Change-Id: I3a5155ea53c8d280806e610a0f8998dbabe15f3c
Signed-off-by: Duncan Laurie <dlaurie(a)chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/58103
Reviewed-by: Aaron Durbin <adurbin(a)chromium.org>
---
src/device/device_util.c | 55 +++++++++++++++++++++++++++++++++++++++++++++
src/include/device/device.h | 1 +
2 files changed, 56 insertions(+)
diff --git a/src/device/device_util.c b/src/device/device_util.c
index d2c99e1..cad2a06 100644
--- a/src/device/device_util.c
+++ b/src/device/device_util.c
@@ -158,6 +158,61 @@ struct device *dev_find_class(unsigned int class, struct device *from)
return from;
}
+/**
+ * Encode the device path into 3 bytes for logging to CMOS.
+ *
+ * @param dev The device path to encode.
+ * @return Device path encoded into lower 3 bytes of dword.
+ */
+u32 dev_path_encode(device_t dev)
+{
+ u32 ret;
+
+ if (!dev)
+ return 0;
+
+ /* Store the device type in 3rd byte. */
+ ret = dev->path.type << 16;
+
+ /* Encode the device specific path in the low word. */
+ switch (dev->path.type) {
+ case DEVICE_PATH_ROOT:
+ break;
+ case DEVICE_PATH_PCI:
+ ret |= dev->bus->secondary << 8 | dev->path.pci.devfn;
+ break;
+ case DEVICE_PATH_PNP:
+ ret |= dev->path.pnp.port << 8 | dev->path.pnp.device;
+ break;
+ case DEVICE_PATH_I2C:
+ ret |= dev->bus->secondary << 8 | dev->path.pnp.device;
+ break;
+ case DEVICE_PATH_APIC:
+ ret |= dev->path.apic.apic_id;
+ break;
+ case DEVICE_PATH_DOMAIN:
+ ret |= dev->path.domain.domain;
+ break;
+ case DEVICE_PATH_CPU_CLUSTER:
+ ret |= dev->path.cpu_cluster.cluster;
+ break;
+ case DEVICE_PATH_CPU:
+ ret |= dev->path.cpu.id;
+ break;
+ case DEVICE_PATH_CPU_BUS:
+ ret |= dev->path.cpu_bus.id;
+ break;
+ case DEVICE_PATH_IOAPIC:
+ ret |= dev->path.ioapic.ioapic_id;
+ break;
+ case DEVICE_PATH_NONE:
+ default:
+ break;
+ }
+
+ return ret;
+}
+
/*
* Warning: This function uses a static buffer. Don't call it more than once
* from the same print statement!
diff --git a/src/include/device/device.h b/src/include/device/device.h
index fec0497..c1a2c3d 100644
--- a/src/include/device/device.h
+++ b/src/include/device/device.h
@@ -154,6 +154,7 @@ void enumerate_static_device(void);
void enumerate_static_devices(void);
const char *dev_name(device_t dev);
const char *dev_path(device_t dev);
+u32 dev_path_encode(device_t dev);
const char *bus_path(struct bus *bus);
void dev_set_enabled(device_t dev, int enable);
void disable_children(struct bus *bus);
Stefan Reinauer (stefan.reinauer(a)coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4186
-gerrit
commit 83de9da3ab9a27c43ba484c0f17105c2cd473e6c
Author: Duncan Laurie <dlaurie(a)chromium.org>
Date: Thu May 23 07:23:09 2013 -0700
elog: Check for successful flash erase in elog_shrink
A parrot device with a bad flash part has been seen to hang
in the elog_shrink code becuase the flash was not successfully
erased and it gets stuck in a loop trying to shrink the log
and then add an event.
Change-Id: I8bb13dbadd293f9d892f322e213c9255c8e9acb3
Signed-off-by: Duncan Laurie <dlaurie(a)chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/56405
Reviewed-by: Aaron Durbin <adurbin(a)chromium.org>
---
src/drivers/elog/elog.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/drivers/elog/elog.c b/src/drivers/elog/elog.c
index 6de5123..bc72e97 100644
--- a/src/drivers/elog/elog.c
+++ b/src/drivers/elog/elog.c
@@ -661,6 +661,12 @@ static int elog_shrink(void)
/* Erase flash area */
elog_flash_erase_area();
+ /* Ensure the area was successfully erased */
+ if (elog_get_flash()->next_event_offset >= CONFIG_ELOG_FULL_THRESHOLD) {
+ printk(BIOS_ERR, "ELOG: Flash area was not erased!\n");
+ return -1;
+ }
+
/* Write new flash area */
elog_prepare_empty(elog_get_flash(),
(u8*)elog_get_event_base(mem, offset),
@@ -839,7 +845,8 @@ int elog_init(void)
/* Shrink the log if we are getting too full */
if (elog_get_mem()->next_event_offset >= CONFIG_ELOG_FULL_THRESHOLD)
- elog_shrink();
+ if (elog_shrink() < 0)
+ return -1;
#if CONFIG_ELOG_BOOT_COUNT && !defined(__SMM__)
/* Log boot count event except in S3 resume */