[coreboot-gerrit] New patch to review for coreboot: 7ed6f14 coreboot_table: Export mainboard id.
Vladimir Serbinenko (phcoder@gmail.com)
gerrit at coreboot.org
Fri Aug 22 23:16:21 CEST 2014
Vladimir Serbinenko (phcoder at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/6738
-gerrit
commit 7ed6f14a17fd2af5d3e14b591929f58f2bbd9cce
Author: Vladimir Serbinenko <phcoder at gmail.com>
Date: Fri Aug 22 23:16:14 2014 +0200
coreboot_table: Export mainboard id.
Change-Id: I45f36bef2f2fcabfe13a539fb4736a82995d57d4
Signed-off-by: Vladimir Serbinenko <phcoder at gmail.com>
---
src/include/boot/coreboot_tables.h | 3 +++
src/lib/coreboot_table.c | 21 +++++++++++++++++++++
src/mainboard/apple/macbook21/mainboard.c | 24 ++++++++++++++++++++++++
src/mainboard/artecgroup/dbe61/mainboard.c | 13 +++++++++++++
src/mainboard/asus/a8n_e/mainboard.c | 13 +++++++++++++
src/mainboard/iei/juki-511p/mainboard.c | 13 +++++++++++++
src/mainboard/jetway/j7f2/mainboard.c | 15 +++++++++++++++
src/mainboard/lippert/hurricane-lx/mainboard.c | 1 +
src/mainboard/pcengines/alix2d/mainboard.c | 15 +++++++++++++++
src/mainboard/via/epia-m/mainboard.c | 15 +++++++++++++++
10 files changed, 133 insertions(+)
diff --git a/src/include/boot/coreboot_tables.h b/src/include/boot/coreboot_tables.h
index db3c508..7fe2cc1 100644
--- a/src/include/boot/coreboot_tables.h
+++ b/src/include/boot/coreboot_tables.h
@@ -134,6 +134,7 @@ struct lb_mainboard {
#define LB_TAG_COMPILER 0x000b
#define LB_TAG_LINKER 0x000c
#define LB_TAG_ASSEMBLER 0x000d
+#define LB_TAG_MAINBOARD_ID 0x0025
struct lb_string {
uint32_t tag;
uint32_t size;
@@ -336,6 +337,8 @@ void lb_add_console(uint16_t consoletype, void *data);
/* Define this in mainboard.c to add board-specific table entries. */
void lb_board(struct lb_header *header);
+const char *__attribute__((weak)) lb_mainboard_id(void);
+
struct lb_record *lb_new_record(struct lb_header *header);
#endif /* COREBOOT_TABLES_H */
diff --git a/src/lib/coreboot_table.c b/src/lib/coreboot_table.c
index 9f9c453..2e78032 100644
--- a/src/lib/coreboot_table.c
+++ b/src/lib/coreboot_table.c
@@ -298,6 +298,26 @@ static void lb_strings(struct lb_header *header)
}
+/* Override if you have clones. Return value has to match board_info.txt
+ directory. */
+const char *__attribute__((weak)) lb_mainboard_id(void)
+{
+ return CONFIG_MAINBOARD_DIR;
+}
+
+static void lb_record_mainboard_id(struct lb_header *header)
+{
+ struct lb_string *rec;
+ size_t len;
+ const char *mobo;
+ rec = (struct lb_string *)lb_new_record(header);
+ mobo = lb_mainboard_id();
+ len = strlen(mobo);
+ rec->tag = LB_TAG_MAINBOARD_ID;
+ rec->size = (sizeof(*rec) + len + 1 + 3) & ~3;
+ memcpy(rec->string, mobo, len+1);
+}
+
void __attribute__((weak)) lb_board(struct lb_header *header) { /* NOOP */ }
static struct lb_forward *lb_forward(struct lb_header *header, struct lb_header *next_header)
@@ -409,6 +429,7 @@ unsigned long write_coreboot_table(
/* Record our various random string information */
lb_strings(head);
+ lb_record_mainboard_id(head);
/* Record our framebuffer */
lb_framebuffer(head);
diff --git a/src/mainboard/apple/macbook21/mainboard.c b/src/mainboard/apple/macbook21/mainboard.c
index b537f78..832d4fd 100644
--- a/src/mainboard/apple/macbook21/mainboard.c
+++ b/src/mainboard/apple/macbook21/mainboard.c
@@ -35,6 +35,8 @@
#include <smbios.h>
#include <x86emu/x86emu.h>
#include <device/azalia_device.h>
+#include <arch/cpu.h>
+#include <boot/coreboot_tables.h>
#include "hda_verb.h"
#define PANEL INT15_5F35_CL_DISPLAY_DEFAULT
@@ -74,6 +76,28 @@ int get_cst_entries(acpi_cstate_t **entries)
return 0;
}
+static int has_64bit(void)
+{
+ static int saved = -1;
+ if (saved == -1)
+ saved = (cpuid_edx(0x80000001) >> 29) & 1;
+ return saved;
+}
+
+const char *smbios_mainboard_product_name(void)
+{
+ if (has_64bit())
+ return "MacBook2,1";
+ return "MacBook1,1";
+}
+
+const char *lb_mainboard_id(void)
+{
+ if (has_64bit())
+ return "apple/macbook21";
+ return "apple/macbook11";
+}
+
static void mainboard_init(device_t dev)
{
#if CONFIG_PCI_OPTION_ROM_RUN_YABEL || CONFIG_PCI_OPTION_ROM_RUN_REALMODE
diff --git a/src/mainboard/artecgroup/dbe61/mainboard.c b/src/mainboard/artecgroup/dbe61/mainboard.c
index 692d2ab..8d9a25a 100644
--- a/src/mainboard/artecgroup/dbe61/mainboard.c
+++ b/src/mainboard/artecgroup/dbe61/mainboard.c
@@ -26,6 +26,19 @@
#include <cpu/x86/msr.h>
#include <cpu/amd/lxdef.h>
#include "southbridge/amd/cs5536/cs5536.h"
+#include <boot/coreboot_tables.h>
+
+const char *lb_mainboard_id(void)
+{
+ /* FIXME: we shouldn't rely on user choosing the right variant. */
+#if CONFIG_BOARD_ARTECGROUP_DBE61
+ return "artecgroup/dbe61";
+#elif CONFIG_BOARD_LINUTOP_LINUTOP1
+ return "linutop/linutop1";
+#else
+#error "Unknown machine"
+#endif
+}
static void init_gpio(void)
{
diff --git a/src/mainboard/asus/a8n_e/mainboard.c b/src/mainboard/asus/a8n_e/mainboard.c
new file mode 100644
index 0000000..014d6b0
--- /dev/null
+++ b/src/mainboard/asus/a8n_e/mainboard.c
@@ -0,0 +1,13 @@
+#include <boot/coreboot_tables.h>
+
+const char *lb_mainboard_id(void)
+{
+ /* FIXME: we shouldn't rely on user choosing the right variant. */
+#if CONFIG_BOARD_ASUS_A8N_E
+ return "asus/a8n_e";
+#elif CONFIG_BOARD_ASUS_A8N_SLI
+ return "asus/a8n_sli";
+#else
+#error "Unknown machine"
+#endif
+}
diff --git a/src/mainboard/iei/juki-511p/mainboard.c b/src/mainboard/iei/juki-511p/mainboard.c
new file mode 100644
index 0000000..72e3f54
--- /dev/null
+++ b/src/mainboard/iei/juki-511p/mainboard.c
@@ -0,0 +1,13 @@
+#include <boot/coreboot_tables.h>
+
+const char *lb_mainboard_id(void)
+{
+ /* FIXME: we shouldn't rely on user choosing the right variant. */
+#if CONFIG_BOARD_IEI_JUKI_511P
+ return "iei/juki-511p";
+#elif CONFIG_BOARD_IEI_ROCKY_512
+ return "iei/rocky-512";
+#else
+#error "Unknown machine"
+#endif
+}
diff --git a/src/mainboard/jetway/j7f2/mainboard.c b/src/mainboard/jetway/j7f2/mainboard.c
new file mode 100644
index 0000000..8ddd1ec
--- /dev/null
+++ b/src/mainboard/jetway/j7f2/mainboard.c
@@ -0,0 +1,15 @@
+#include <boot/coreboot_tables.h>
+
+const char *lb_mainboard_id(void)
+{
+ /* FIXME: we shouldn't rely on user choosing the right variant. */
+#if CONFIG_BOARD_JETWAY_J7F2
+ return "jetway/j7f2";
+#elif CONFIG_BOARD_BOARD_JETWAY_J7F4K1G2E
+ return "jetway/j7f4k2g2e";
+#elif CONFIG_BOARD_BOARD_JETWAY_J7F4K1G5D
+ return "jetway/j7f4k1g5d";
+#else
+#error "Unknown machine"
+#endif
+}
diff --git a/src/mainboard/lippert/hurricane-lx/mainboard.c b/src/mainboard/lippert/hurricane-lx/mainboard.c
index 56f6a0a..e1c9cdf 100644
--- a/src/mainboard/lippert/hurricane-lx/mainboard.c
+++ b/src/mainboard/lippert/hurricane-lx/mainboard.c
@@ -27,6 +27,7 @@
#include <arch/io.h>
#include <device/pci.h>
#include <device/pci_ids.h>
+#include <boot/coreboot_tables.h>
/* Bit1 switches Com1 to RS485, bit2 same for Com2. */
#if CONFIG_ONBOARD_UARTS_RS485
diff --git a/src/mainboard/pcengines/alix2d/mainboard.c b/src/mainboard/pcengines/alix2d/mainboard.c
index 3cd08c8..862a86a 100644
--- a/src/mainboard/pcengines/alix2d/mainboard.c
+++ b/src/mainboard/pcengines/alix2d/mainboard.c
@@ -19,6 +19,21 @@
#include <console/console.h>
#include <device/device.h>
+#include <boot/coreboot_tables.h>
+
+const char *lb_mainboard_id(void)
+{
+ /* FIXME: we shouldn't rely on user choosing the right variant. */
+#if CONFIG_BOARD_PCENGINES_ALIX2C
+ return "pcengines/alix2c";
+#elif CONFIG_BOARD_PCENGINES_ALIX2D
+ return "pcengines/alix2d";
+#elif CONFIG_BOARD_PCENGINES_ALIX6
+ return "pcengines/alix6";
+#else
+#error "Unknown machine"
+#endif
+}
static void init(struct device *dev)
{
diff --git a/src/mainboard/via/epia-m/mainboard.c b/src/mainboard/via/epia-m/mainboard.c
new file mode 100644
index 0000000..ed60e4c
--- /dev/null
+++ b/src/mainboard/via/epia-m/mainboard.c
@@ -0,0 +1,15 @@
+#include <boot/coreboot_tables.h>
+
+const char *lb_mainboard_id(void)
+{
+ /* FIXME: we shouldn't rely on user choosing the right variant. */
+#if CONFIG_BOARD_VIA_EPIA_M
+ return "via/epia-m";
+#elif CONFIG_BOARD_VIA_EPIA_MII
+ return "via/epia-mii";
+#elif CONFIG_BOARD_VIA_EPIA_ML
+ return "via/epia-ml";
+#else
+#error "Unknown machine"
+#endif
+}
More information about the coreboot-gerrit
mailing list