Stef van Os (stef.van.os(a)prodrive-technologies.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/14437
-gerrit
commit c86439f7fa29a962123757ad850c160971176a31
Author: Stef van Os <stef.van.os(a)prodrive-technologies.com>
Date: Wed Apr 20 15:22:00 2016 +0200
libpayload: time: split time.h from libpayload.h
Move time functions and prototypes from libpayload.h to time.h.
In a similar manner to other c libary headers, this change makes
porting existing applications to libpayload easier.
Change-Id: I71e27c6dddde6e77e0e9b4d7be7cd5298e03a648
Signed-off-by: Stef van Os <stef.van.os(a)prodrive-technologies.com>
---
payloads/libpayload/include/libpayload.h | 15 +---------
payloads/libpayload/include/time.h | 50 ++++++++++++++++++++++++++++++++
2 files changed, 51 insertions(+), 14 deletions(-)
diff --git a/payloads/libpayload/include/libpayload.h b/payloads/libpayload/include/libpayload.h
index 1b66bf8..b51abdf 100644
--- a/payloads/libpayload/include/libpayload.h
+++ b/payloads/libpayload/include/libpayload.h
@@ -56,6 +56,7 @@
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
+#include <time.h>
#include <arch/types.h>
#include <arch/io.h>
#include <arch/virtual.h>
@@ -354,20 +355,6 @@ u8 *sha1(const u8 *data, size_t len, u8 *buf);
/** @} */
/**
- * @defgroup time Time functions
- * @{
- */
-
-/** System time structure */
-struct timeval {
- time_t tv_sec; /**< Seconds */
- suseconds_t tv_usec; /**< Microseconds */
-};
-
-int gettimeofday(struct timeval *tv, void *tz);
-/** @} */
-
-/**
* @defgroup info System information functions
* This module contains functions that return information about the system
* @{
diff --git a/payloads/libpayload/include/time.h b/payloads/libpayload/include/time.h
new file mode 100644
index 0000000..25f476c
--- /dev/null
+++ b/payloads/libpayload/include/time.h
@@ -0,0 +1,50 @@
+/*
+ * This file is part of the libpayload project.
+ *
+ * Copyright (C) 2008 Advanced Micro Devices, Inc.
+ * Copyright (C) 2016 Prodrive Technologies
+ *
+ * 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 _TIME_H
+#define _TIME_H
+
+#include <stddef.h>
+
+/**
+ * @defgroup time Time functions
+ * @{
+ */
+
+/** System time structure */
+struct timeval {
+ time_t tv_sec; /**< Seconds */
+ suseconds_t tv_usec; /**< Microseconds */
+};
+
+int gettimeofday(struct timeval *tv, void *tz);
+/** @} */
+
+#endif
Aaron Durbin (adurbin(a)chromium.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/14431
-gerrit
commit 87d401f64a842d7893249e7f7cc8014d8a34a6c3
Author: Aaron Durbin <adurbin(a)chromium.org>
Date: Tue Apr 19 15:53:56 2016 -0500
arch/x86: clean up write_tables()
There were quite a number of #if/#endif guards in the
write_tables() code. Clean up that function by splitting
up the subcomponents into their own individual functions.
The same ordering and logic is kept maintained.
The changes also benefit the goal of using a common core
write_tables() logic so that other architectures don't
duplicate large swaths of code.
Change-Id: I93f6775d698500f25f72793cbe3fd4eb9d01a20c
Signed-off-by: Aaron Durbin <adurbin(a)chromium.org>
---
src/arch/x86/tables.c | 86 +++++++++++++++++++++++++++++++++++----------------
1 file changed, 60 insertions(+), 26 deletions(-)
diff --git a/src/arch/x86/tables.c b/src/arch/x86/tables.c
index 5780cd1..309ac16 100644
--- a/src/arch/x86/tables.c
+++ b/src/arch/x86/tables.c
@@ -28,28 +28,10 @@
#define MAX_COREBOOT_TABLE_SIZE CONFIG_COREBOOT_TABLE_SIZE
-void write_tables(void)
+static unsigned long write_pirq_table(unsigned long rom_table_end)
{
- unsigned long low_table_start, low_table_end;
- unsigned long rom_table_start, rom_table_end;
-
- /* Even if high tables are configured, some tables are copied both to
- * the low and the high area, so payloads and OSes don't need to know
- * about the high tables.
- */
unsigned long high_table_pointer;
- rom_table_start = 0xf0000;
- rom_table_end = 0xf0000;
-
- /* Start low addr at 0x500, so we don't run into conflicts with the BDA
- * in case our data structures grow beyond 0x400. Only GDT
- * and the coreboot table use low_tables.
- */
- low_table_start = 0;
- low_table_end = 0x500;
-
-#if CONFIG_GENERATE_PIRQ_TABLE
#define MAX_PIRQ_TABLE_SIZE (4 * 1024)
post_code(0x9a);
@@ -73,9 +55,13 @@ void write_tables(void)
new_high_table_pointer - high_table_pointer);
}
-#endif
+ return rom_table_end;
+}
+
+static unsigned long write_mptable(unsigned long rom_table_end)
+{
+ unsigned long high_table_pointer;
-#if CONFIG_GENERATE_MP_TABLE
#define MAX_MP_TABLE_SIZE (4 * 1024)
post_code(0x9b);
@@ -96,9 +82,14 @@ void write_tables(void)
printk(BIOS_DEBUG, "MP table: %ld bytes.\n",
new_high_table_pointer - high_table_pointer);
}
-#endif /* CONFIG_GENERATE_MP_TABLE */
-#if CONFIG_HAVE_ACPI_TABLES
+ return rom_table_end;
+}
+
+static unsigned long write_acpi_table(unsigned long rom_table_end)
+{
+ unsigned long high_table_pointer;
+
#define MAX_ACPI_SIZE (144 * 1024)
post_code(0x9c);
@@ -157,9 +148,15 @@ void write_tables(void)
rom_table_end = ALIGN(rom_table_end, 1024);
}
-#endif
+ return rom_table_end;
+}
+
+static unsigned long write_smbios_table(unsigned long rom_table_end)
+{
+ unsigned long high_table_pointer;
+
#define MAX_SMBIOS_SIZE 2048
-#if CONFIG_GENERATE_SMBIOS_TABLES
+
high_table_pointer = (unsigned long)cbmem_add(CBMEM_ID_SMBIOS, MAX_SMBIOS_SIZE);
if (high_table_pointer) {
unsigned long new_high_table_pointer;
@@ -179,7 +176,44 @@ void write_tables(void)
printk(BIOS_DEBUG, "SMBIOS size %ld bytes\n", new_rom_table_end - rom_table_end);
rom_table_end = ALIGN(new_rom_table_end, 16);
}
-#endif
+
+ return rom_table_end;
+}
+
+void write_tables(void)
+{
+ unsigned long low_table_start, low_table_end;
+ unsigned long rom_table_start, rom_table_end;
+
+ /* Even if high tables are configured, some tables are copied both to
+ * the low and the high area, so payloads and OSes don't need to know
+ * about the high tables.
+ */
+ unsigned long high_table_pointer;
+
+ rom_table_start = 0xf0000;
+ rom_table_end = 0xf0000;
+
+ /* Start low addr at 0x500, so we don't run into conflicts with the BDA
+ * in case our data structures grow beyond 0x400. Only GDT
+ * and the coreboot table use low_tables.
+ */
+ low_table_start = 0;
+ low_table_end = 0x500;
+
+ /* This table must be between 0x0f0000 and 0x100000 */
+ if (IS_ENABLED(CONFIG_GENERATE_PIRQ_TABLE))
+ rom_table_end = write_pirq_table(rom_table_end);
+
+ /* The smp table must be in 0-1K, 639K-640K, or 960K-1M */
+ if (IS_ENABLED(CONFIG_GENERATE_MP_TABLE))
+ rom_table_end = write_mptable(rom_table_end);
+
+ if (IS_ENABLED(CONFIG_HAVE_ACPI_TABLES))
+ rom_table_end = write_acpi_table(rom_table_end);
+
+ if (IS_ENABLED(CONFIG_GENERATE_SMBIOS_TABLES))
+ rom_table_end = write_smbios_table(rom_table_end);
post_code(0x9e);
the following patch was just integrated into master:
commit ae2963587603c205dfada1a7cf5b5859390ac27e
Author: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Date: Tue Apr 19 07:17:35 2016 +0300
AGESA vendorcode: Suppress maybe-uninitialized warnings
Compiling libagesa with -O2 would throws error on these.
Change-Id: I04afa42f0ac76677f859ca72f9df2e128762ad3c
Signed-off-by: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Reviewed-on: https://review.coreboot.org/14413
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter(a)users.sourceforge.net>
Reviewed-by: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
See https://review.coreboot.org/14413 for details.
-gerrit
Aaron Durbin (adurbin(a)chromium.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/14432
-gerrit
commit 3b204400cb63bca62011a5d697a9c69f22b668ed
Author: Aaron Durbin <adurbin(a)chromium.org>
Date: Tue Apr 19 16:11:22 2016 -0500
arch/x86: remove low coreboot table support
In addition to being consistent with all other architectures,
all chipsets support cbmem so the low coreboot table path is
stale and never taken. Also it's important to note the memory
written in to that low area of memory wasn't automatically
reserved unless that path was taken. To that end remove
low coreboot table support for x86.
Change-Id: Ib96338cf3024e3aa34931c53a7318f40185be34c
Signed-off-by: Aaron Durbin <adurbin(a)chromium.org>
---
src/arch/x86/tables.c | 7 ++-----
src/lib/coreboot_table.c | 15 +--------------
2 files changed, 3 insertions(+), 19 deletions(-)
diff --git a/src/arch/x86/tables.c b/src/arch/x86/tables.c
index 309ac16..b36078d 100644
--- a/src/arch/x86/tables.c
+++ b/src/arch/x86/tables.c
@@ -183,7 +183,7 @@ static unsigned long write_smbios_table(unsigned long rom_table_end)
void write_tables(void)
{
unsigned long low_table_start, low_table_end;
- unsigned long rom_table_start, rom_table_end;
+ unsigned long rom_table_end;
/* Even if high tables are configured, some tables are copied both to
* the low and the high area, so payloads and OSes don't need to know
@@ -191,7 +191,6 @@ void write_tables(void)
*/
unsigned long high_table_pointer;
- rom_table_start = 0xf0000;
rom_table_end = 0xf0000;
/* Start low addr at 0x500, so we don't run into conflicts with the BDA
@@ -242,8 +241,6 @@ void write_tables(void)
printk(BIOS_DEBUG, "coreboot table: %ld bytes.\n",
new_high_table_pointer - high_table_pointer);
} else {
- /* The coreboot table must be in 0-4K or 960K-1M */
- write_coreboot_table(low_table_start, low_table_end,
- rom_table_start, rom_table_end);
+ printk(BIOS_ERR, "Could not add CBMEM for coreboot table.\n");
}
}
diff --git a/src/lib/coreboot_table.c b/src/lib/coreboot_table.c
index 18e8b34..091ceaf 100644
--- a/src/lib/coreboot_table.c
+++ b/src/lib/coreboot_table.c
@@ -447,7 +447,7 @@ static unsigned long lb_table_fini(struct lb_header *head)
unsigned long write_coreboot_table(
unsigned long low_table_start, unsigned long low_table_end,
- unsigned long rom_table_start, unsigned long rom_table_end)
+ unsigned long rom_table_start __unused, unsigned long rom_table_end)
{
struct lb_header *head;
@@ -468,10 +468,6 @@ unsigned long write_coreboot_table(
rom_table_end);
head = lb_table_init(rom_table_end);
- rom_table_end = (unsigned long)head;
- printk(BIOS_DEBUG, "rom_table_end = 0x%08lx\n", rom_table_end);
- rom_table_end = ALIGN(rom_table_end, (64 * 1024));
- printk(BIOS_DEBUG, "... aligned to 0x%08lx\n", rom_table_end);
#if CONFIG_USE_OPTION_TABLE
{
@@ -500,15 +496,6 @@ unsigned long write_coreboot_table(
bootmem_add_range(low_table_start, size, LB_MEM_TABLE);
}
- /* Record the pirq table, acpi tables, and maybe the mptable. However,
- * these only need to be added when the rom_table is sitting below
- * 1MiB. If it isn't that means high tables are being written.
- * The code below handles high tables correctly. */
- if (rom_table_end <= (1 << 20)) {
- uint64_t size = rom_table_end - rom_table_start;
- bootmem_add_range(rom_table_start, size, LB_MEM_TABLE);
- }
-
/* No other memory areas can be added after the memory table has been
* committed as the entries won't show up in the serialize mem table. */
bootmem_write_memory_table(lb_memory(head));