From 368e86d9836aa044f2afb233e0445c8e4040b179 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Wed, 3 Jan 2018 16:23:46 +0100 Subject: [PATCH 01/10] configs: x86: allow to override CONFIG_BOOTCOMMAND Allow to override CONFIG_BOOTCOMMAND in .config. Signed-off-by: Heinrich Schuchardt Reviewed-by: Bin Meng --- include/configs/x86-common.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/configs/x86-common.h b/include/configs/x86-common.h index 994214ea48..e8f680f129 100644 --- a/include/configs/x86-common.h +++ b/include/configs/x86-common.h @@ -62,8 +62,10 @@ * Command line configuration. */ +#ifndef CONFIG_BOOTCOMMAND #define CONFIG_BOOTCOMMAND \ "ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000" +#endif #if defined(CONFIG_CMD_KGDB) #define CONFIG_KGDB_BAUDRATE 115200 From 3ffb33d6362b947d77ca31e8181a4954c4b7ad42 Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Wed, 10 Jan 2018 18:07:26 +0200 Subject: [PATCH 02/10] x86: tangier: Make _CRS for BTH0 Serialized to avoid warning ASL compiler warns: ASL board/intel/edison/dsdt.asl board/intel/edison/dsdt.asl.tmp 238: Method (_CRS, 0, NotSerialized) Remark 2120 - Control Method should be made Serialized ^ (due to creation of named objects within) Do as suggested by ASL compiler. Fixes: 5d8c4ebd95e2 ("x86: tangier: Add Bluetooth to ACPI table") Reported-by: Ferry Toth Signed-off-by: Andy Shevchenko Reviewed-by: Bin Meng --- arch/x86/include/asm/arch-tangier/acpi/southcluster.asl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/include/asm/arch-tangier/acpi/southcluster.asl b/arch/x86/include/asm/arch-tangier/acpi/southcluster.asl index 2b3b897c5b..5289b14957 100644 --- a/arch/x86/include/asm/arch-tangier/acpi/southcluster.asl +++ b/arch/x86/include/asm/arch-tangier/acpi/southcluster.asl @@ -284,7 +284,7 @@ Device (PCI0) Return (STA_VISIBLE) } - Method (_CRS, 0, NotSerialized) + Method (_CRS, 0, Serialized) { Name (RBUF, ResourceTemplate () { From 7b36dbdec725d507e4af64eb06a166be82e51324 Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Wed, 10 Jan 2018 19:33:10 +0200 Subject: [PATCH 03/10] x86: Fix reference to QEMU variant of write_acpi_tables() The commit eece493a7ac1 ("cmd: qfw: bring ACPI generation code into qfw core") moves ACPI related code to another file and missed an update of references in acpi_table.c. Do it now. Fixes: eece493a7ac1 ("cmd: qfw: bring ACPI generation code into qfw core") Cc: Miao Yan Signed-off-by: Andy Shevchenko Reviewed-by: Bin Meng --- arch/x86/lib/acpi_table.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c index 3eb101105b..7b33cd371e 100644 --- a/arch/x86/lib/acpi_table.c +++ b/arch/x86/lib/acpi_table.c @@ -357,8 +357,7 @@ void enter_acpi_mode(int pm1_cnt) } /* - * QEMU's version of write_acpi_tables is defined in - * arch/x86/cpu/qemu/acpi_table.c + * QEMU's version of write_acpi_tables is defined in drivers/misc/qfw.c */ ulong write_acpi_tables(ulong start) { From 378960d8c2c72c5b6be2a6cd7787cab8c3ba5abc Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Wed, 10 Jan 2018 19:40:14 +0200 Subject: [PATCH 04/10] x86: zImage: Move subarch assignment out of cmd_line check The commit 20bfac0599bd ("x86: zImage: add Intel MID platforms support") introduced an assignment of subarch field in boot parameters, though missed the right place of doing that. It doesn't matter if we have or not a kernel command line supplied, we just set that field. Although guard it by protocol version which supports it. Fixes: 20bfac0599bd ("x86: zImage: add Intel MID platforms support") Cc: Vincent Tinelli Signed-off-by: Andy Shevchenko Reviewed-by: Bin Meng --- arch/x86/lib/zimage.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/x86/lib/zimage.c b/arch/x86/lib/zimage.c index 00172dc7c1..d224db4e07 100644 --- a/arch/x86/lib/zimage.c +++ b/arch/x86/lib/zimage.c @@ -246,14 +246,15 @@ int setup_zimage(struct boot_params *setup_base, char *cmd_line, int auto_boot, hdr->setup_move_size = 0x9100; } -#if defined(CONFIG_INTEL_MID) - hdr->hardware_subarch = X86_SUBARCH_INTEL_MID; -#endif - /* build command line at COMMAND_LINE_OFFSET */ build_command_line(cmd_line, auto_boot); } +#ifdef CONFIG_INTEL_MID + if (bootproto >= 0x0207) + hdr->hardware_subarch = X86_SUBARCH_INTEL_MID; +#endif + setup_video(&setup_base->screen_info); return 0; From 3469bf4274540d1491d58e878a9edc0bdcba17ac Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Wed, 10 Jan 2018 19:40:15 +0200 Subject: [PATCH 05/10] x86: zImage: Propagate acpi_rsdp_addr to kernel via boot parameters New field acpi_rsdp_addr, which has been introduced in boot protocol v2.14 [1], in boot parameters tells kernel the exact address of RDSP ACPI table. Knowing it increases robustness of the kernel by avoiding in some cases traversal through a part of physical memory. It will slightly reduce boot time by the same reason. [1] See Linux kernel commit 2f74cbf ("x86/boot: Add the ACPI RSDP address to struct setup_header::acpi_rdsp_addr") @ https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=2f74cbf for the details. Signed-off-by: Andy Shevchenko Reviewed-by: Bin Meng [bmeng: updated the kernel commit git URL and fixed one style issue] Signed-off-by: Bin Meng --- arch/x86/include/asm/bootparam.h | 1 + arch/x86/lib/acpi_table.c | 5 +++++ arch/x86/lib/acpi_table.h | 10 ++++++++++ arch/x86/lib/zimage.c | 6 ++++++ 4 files changed, 22 insertions(+) create mode 100644 arch/x86/lib/acpi_table.h diff --git a/arch/x86/include/asm/bootparam.h b/arch/x86/include/asm/bootparam.h index 48b138c6b0..90768a99ce 100644 --- a/arch/x86/include/asm/bootparam.h +++ b/arch/x86/include/asm/bootparam.h @@ -66,6 +66,7 @@ struct setup_header { __u64 pref_address; __u32 init_size; __u32 handover_offset; + __u64 acpi_rsdp_addr; } __attribute__((packed)); struct sys_desc_table { diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c index 7b33cd371e..d3e5d2e104 100644 --- a/arch/x86/lib/acpi_table.c +++ b/arch/x86/lib/acpi_table.c @@ -20,6 +20,7 @@ #include #include #include +#include "acpi_table.h" /* * IASL compiles the dsdt entries and writes the hex values @@ -27,6 +28,9 @@ */ extern const unsigned char AmlCode[]; +/* ACPI RSDP address to be used in boot parameters */ +unsigned long acpi_rsdp_addr; + static void acpi_write_rsdp(struct acpi_rsdp *rsdp, struct acpi_rsdt *rsdt, struct acpi_xsdt *xsdt) { @@ -460,6 +464,7 @@ ulong write_acpi_tables(ulong start) debug("current = %x\n", current); + acpi_rsdp_addr = (unsigned long)rsdp; debug("ACPI: done\n"); /* Don't touch ACPI hardware on HW reduced platforms */ diff --git a/arch/x86/lib/acpi_table.h b/arch/x86/lib/acpi_table.h new file mode 100644 index 0000000000..cece5d1420 --- /dev/null +++ b/arch/x86/lib/acpi_table.h @@ -0,0 +1,10 @@ +/* + * SPDX-License-Identifier: GPL-2.0 + */ + +#ifndef _X86_LIB_ACPI_TABLES_H +#define _X86_LIB_ACPI_TABLES_H + +extern unsigned long acpi_rsdp_addr; + +#endif diff --git a/arch/x86/lib/zimage.c b/arch/x86/lib/zimage.c index d224db4e07..eae26635b1 100644 --- a/arch/x86/lib/zimage.c +++ b/arch/x86/lib/zimage.c @@ -24,6 +24,7 @@ #include #endif #include +#include "acpi_table.h" DECLARE_GLOBAL_DATA_PTR; @@ -255,6 +256,11 @@ int setup_zimage(struct boot_params *setup_base, char *cmd_line, int auto_boot, hdr->hardware_subarch = X86_SUBARCH_INTEL_MID; #endif +#ifdef CONFIG_GENERATE_ACPI_TABLE + if (bootproto >= 0x020e) + hdr->acpi_rsdp_addr = acpi_rsdp_addr; +#endif + setup_video(&setup_base->screen_info); return 0; From 45410da714a1857c9e06573159877cff98fa4129 Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Tue, 30 Jan 2018 05:01:16 -0800 Subject: [PATCH 06/10] x86: acpi: Use an API to get the ACPI RSDP table address At present the acpi_rsdp_addr variable is directly referenced in setup_zimage(). This changes to use an API for better encapsulation and extension. Signed-off-by: Bin Meng Reviewed-by: Andy Shevchenko --- arch/x86/include/asm/acpi_table.h | 9 +++++++++ arch/x86/lib/acpi_table.c | 8 ++++++-- arch/x86/lib/acpi_table.h | 10 ---------- arch/x86/lib/zimage.c | 4 ++-- 4 files changed, 17 insertions(+), 14 deletions(-) delete mode 100644 arch/x86/lib/acpi_table.h diff --git a/arch/x86/include/asm/acpi_table.h b/arch/x86/include/asm/acpi_table.h index 80038504dd..d5d77cc011 100644 --- a/arch/x86/include/asm/acpi_table.h +++ b/arch/x86/include/asm/acpi_table.h @@ -329,6 +329,15 @@ void acpi_create_gnvs(struct acpi_global_nvs *gnvs); void enter_acpi_mode(int pm1_cnt); ulong write_acpi_tables(ulong start); +/** + * acpi_get_rsdp_addr() - get ACPI RSDP table address + * + * This routine returns the ACPI RSDP table address in the system memory. + * + * @return: ACPI RSDP table address + */ +ulong acpi_get_rsdp_addr(void); + /** * acpi_find_fadt() - find ACPI FADT table in the sytem memory * diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c index d3e5d2e104..0d448cffc9 100644 --- a/arch/x86/lib/acpi_table.c +++ b/arch/x86/lib/acpi_table.c @@ -20,7 +20,6 @@ #include #include #include -#include "acpi_table.h" /* * IASL compiles the dsdt entries and writes the hex values @@ -29,7 +28,7 @@ extern const unsigned char AmlCode[]; /* ACPI RSDP address to be used in boot parameters */ -unsigned long acpi_rsdp_addr; +static ulong acpi_rsdp_addr; static void acpi_write_rsdp(struct acpi_rsdp *rsdp, struct acpi_rsdt *rsdt, struct acpi_xsdt *xsdt) @@ -480,6 +479,11 @@ ulong write_acpi_tables(ulong start) return current; } +ulong acpi_get_rsdp_addr(void) +{ + return acpi_rsdp_addr; +} + static struct acpi_rsdp *acpi_valid_rsdp(struct acpi_rsdp *rsdp) { if (strncmp((char *)rsdp, RSDP_SIG, sizeof(RSDP_SIG) - 1) != 0) diff --git a/arch/x86/lib/acpi_table.h b/arch/x86/lib/acpi_table.h deleted file mode 100644 index cece5d1420..0000000000 --- a/arch/x86/lib/acpi_table.h +++ /dev/null @@ -1,10 +0,0 @@ -/* - * SPDX-License-Identifier: GPL-2.0 - */ - -#ifndef _X86_LIB_ACPI_TABLES_H -#define _X86_LIB_ACPI_TABLES_H - -extern unsigned long acpi_rsdp_addr; - -#endif diff --git a/arch/x86/lib/zimage.c b/arch/x86/lib/zimage.c index eae26635b1..2a82bc83d6 100644 --- a/arch/x86/lib/zimage.c +++ b/arch/x86/lib/zimage.c @@ -14,6 +14,7 @@ */ #include +#include #include #include #include @@ -24,7 +25,6 @@ #include #endif #include -#include "acpi_table.h" DECLARE_GLOBAL_DATA_PTR; @@ -258,7 +258,7 @@ int setup_zimage(struct boot_params *setup_base, char *cmd_line, int auto_boot, #ifdef CONFIG_GENERATE_ACPI_TABLE if (bootproto >= 0x020e) - hdr->acpi_rsdp_addr = acpi_rsdp_addr; + hdr->acpi_rsdp_addr = acpi_get_rsdp_addr(); #endif setup_video(&setup_base->screen_info); From 2d1c661915f046d89c4618889283a4f4d3b0bde2 Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Tue, 30 Jan 2018 05:01:17 -0800 Subject: [PATCH 07/10] x86: qemu: qfw: Implement acpi_get_rsdp_addr() U-Boot on QEMU does not build ACPI table by ourself, instead it uses the prebuilt ACPI table via the qfw interface. This implements the qfw version of acpi_get_rsdp_addr() for setup_zimage(). Signed-off-by: Bin Meng Reviewed-by: Andy Shevchenko --- drivers/misc/qfw.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/misc/qfw.c b/drivers/misc/qfw.c index a8af9e0c53..9a5480349e 100644 --- a/drivers/misc/qfw.c +++ b/drivers/misc/qfw.c @@ -222,6 +222,14 @@ out: free(table_loader); return addr; } + +ulong acpi_get_rsdp_addr(void) +{ + struct fw_file *file; + + file = qemu_fwcfg_find_file("etc/acpi/rsdp"); + return file->addr; +} #endif /* Read configuration item using fw_cfg PIO interface */ From ca92ad4f6899cf37e69661f91dd49711b2ec09c7 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Wed, 24 Jan 2018 19:52:29 +0100 Subject: [PATCH 08/10] cmd/bdinfo: print relocation info on X86 For debugging U-Boot in qemu-x86 the relocation address is needed. Signed-off-by: Heinrich Schuchardt Reviewed-by: Bin Meng Tested-by: Bin Meng --- cmd/bdinfo.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index c7ebad17d1..de6fc48987 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -377,6 +377,8 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) print_bi_dram(bd); + print_num("relocaddr", gd->relocaddr); + print_num("reloc off", gd->reloc_off); #if defined(CONFIG_CMD_NET) print_eth_ip_addr(); print_mhz("ethspeed", bd->bi_ethspeed); From d0c0752addcb82fbc74c43842a58cca34d22de00 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Sat, 27 Jan 2018 15:13:47 -0500 Subject: [PATCH 09/10] x86: quark: Fix unused warnings The variable t_rfc is never used, so drop it. The variables ddr_wctl and ddr_wcmd are only used in certain manual instances, so guard their declaration by the same check as their use. Cc: Bin Meng Signed-off-by: Tom Rini Reviewed-by: Bin Meng Tested-by: Bin Meng --- arch/x86/cpu/quark/smc.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/arch/x86/cpu/quark/smc.c b/arch/x86/cpu/quark/smc.c index 3ffe92b67b..0195b56a52 100644 --- a/arch/x86/cpu/quark/smc.c +++ b/arch/x86/cpu/quark/smc.c @@ -17,15 +17,6 @@ #include "hte.h" #include "smc.h" -/* t_rfc values (in picoseconds) per density */ -static const uint32_t t_rfc[5] = { - 90000, /* 512Mb */ - 110000, /* 1Gb */ - 160000, /* 2Gb */ - 300000, /* 4Gb */ - 350000, /* 8Gb */ -}; - /* t_ck clock period in picoseconds per speed index 800, 1066, 1333 */ static const uint32_t t_ck[3] = { 2500, @@ -35,8 +26,12 @@ static const uint32_t t_ck[3] = { /* Global variables */ static const uint16_t ddr_wclk[] = {193, 158}; +#ifdef BACKUP_WCTL static const uint16_t ddr_wctl[] = {1, 217}; +#endif +#ifdef BACKUP_WCMD static const uint16_t ddr_wcmd[] = {1, 220}; +#endif #ifdef BACKUP_RCVN static const uint16_t ddr_rcvn[] = {129, 498}; From e21b04fec465c84a51ca6fc6450263e0c0953fcb Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Tue, 30 Jan 2018 13:59:03 +0100 Subject: [PATCH 10/10] x86: kconfig: Remove meaningless 'select n' 'select n' selects a constant symbol, which is meaningless and has no effect. Maybe this was meant to be a 'default n', though bool and tristate symbols already implicitly default to n. Discovered in Kconfiglib (https://github.com/ulfalizer/Kconfiglib), which does more strict checking here: kconfiglib.KconfigSyntaxError: board/google/Kconfig:34: Couldn't parse ' select n': expected nonconstant symbol Signed-off-by: Ulf Magnusson Reviewed-by: Bin Meng --- board/google/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/board/google/Kconfig b/board/google/Kconfig index e56c026ef6..766db1b449 100644 --- a/board/google/Kconfig +++ b/board/google/Kconfig @@ -31,7 +31,6 @@ config TARGET_CHROMEBOOK_LINK64 config TARGET_CHROMEBOX_PANTHER bool "Chromebox panther (not available)" - select n help Note: At present this must be used with coreboot. See README.x86 for instructions.