summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/Kconfig11
-rw-r--r--arch/arm/include/asm/mach-imx/mxc_i2c.h2
-rw-r--r--arch/arm/mach-k3/am6_init.c2
-rw-r--r--arch/arm/mach-k3/j721e_init.c2
-rw-r--r--arch/arm/mach-k3/sysfw-loader.c2
-rw-r--r--arch/sandbox/cpu/Makefile2
-rw-r--r--arch/sandbox/cpu/cache.c23
-rw-r--r--arch/sandbox/cpu/start.c10
-rw-r--r--arch/sandbox/dts/test.dts25
-rw-r--r--arch/sandbox/include/asm/spi.h10
-rw-r--r--arch/sandbox/include/asm/test.h16
-rw-r--r--arch/x86/cpu/apollolake/cpu.c2
-rw-r--r--arch/x86/cpu/broadwell/cpu_full.c2
-rw-r--r--arch/x86/cpu/ivybridge/model_206ax.c2
-rw-r--r--arch/x86/cpu/mp_init.c23
-rw-r--r--arch/x86/include/asm/mp.h2
16 files changed, 99 insertions, 37 deletions
diff --git a/arch/Kconfig b/arch/Kconfig
index e8f9a9e1b7..27843cd79c 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -7,6 +7,17 @@ config HAVE_ARCH_IOREMAP
config NEEDS_MANUAL_RELOC
bool
+config LINKER_LIST_ALIGN
+ int
+ default 32 if SANDBOX
+ default 8 if ARM64 || X86
+ default 4
+ help
+ Force the each linker list to be aligned to this boundary. This
+ is required if ll_entry_get() is used, since otherwise the linker
+ may add padding into the table, thus breaking it.
+ See linker_lists.rst for full details.
+
choice
prompt "Architecture select"
default SANDBOX
diff --git a/arch/arm/include/asm/mach-imx/mxc_i2c.h b/arch/arm/include/asm/mach-imx/mxc_i2c.h
index 81fd981444..c016aa7474 100644
--- a/arch/arm/include/asm/mach-imx/mxc_i2c.h
+++ b/arch/arm/include/asm/mach-imx/mxc_i2c.h
@@ -42,7 +42,7 @@ struct mxc_i2c_bus {
/*
* board file can use this index to locate which i2c_pads_info is for
* i2c_idle_bus. When pinmux is implement, this entry can be
- * discarded. Here we do not use dev->seq, because we do not want to
+ * discarded. Here we do not use dev_seq(dev), because we do not want to
* export device to board file.
*/
int index;
diff --git a/arch/arm/mach-k3/am6_init.c b/arch/arm/mach-k3/am6_init.c
index 603834e507..0fed5aec59 100644
--- a/arch/arm/mach-k3/am6_init.c
+++ b/arch/arm/mach-k3/am6_init.c
@@ -208,7 +208,7 @@ void board_init_f(ulong dummy)
* firmware (SYSFW) image for various purposes and SYSFW depends on us
* to initialize its pin settings.
*/
- ret = uclass_find_device_by_seq(UCLASS_SERIAL, 0, true, &dev);
+ ret = uclass_find_device_by_seq(UCLASS_SERIAL, 0, &dev);
if (!ret)
pinctrl_select_state(dev, "default");
diff --git a/arch/arm/mach-k3/j721e_init.c b/arch/arm/mach-k3/j721e_init.c
index a36e4ed603..0201690f93 100644
--- a/arch/arm/mach-k3/j721e_init.c
+++ b/arch/arm/mach-k3/j721e_init.c
@@ -167,7 +167,7 @@ void board_init_f(ulong dummy)
* firmware (SYSFW) image for various purposes and SYSFW depends on us
* to initialize its pin settings.
*/
- ret = uclass_find_device_by_seq(UCLASS_SERIAL, 0, true, &dev);
+ ret = uclass_find_device_by_seq(UCLASS_SERIAL, 0, &dev);
if (!ret)
pinctrl_select_state(dev, "default");
diff --git a/arch/arm/mach-k3/sysfw-loader.c b/arch/arm/mach-k3/sysfw-loader.c
index 78c158c63f..708d9c8508 100644
--- a/arch/arm/mach-k3/sysfw-loader.c
+++ b/arch/arm/mach-k3/sysfw-loader.c
@@ -223,7 +223,7 @@ static void *k3_sysfw_get_spi_addr(void)
int ret;
ret = uclass_find_device_by_seq(UCLASS_SPI, CONFIG_SF_DEFAULT_BUS,
- true, &dev);
+ &dev);
if (ret)
return NULL;
diff --git a/arch/sandbox/cpu/Makefile b/arch/sandbox/cpu/Makefile
index bac96447d5..de7fe7f391 100644
--- a/arch/sandbox/cpu/Makefile
+++ b/arch/sandbox/cpu/Makefile
@@ -5,7 +5,7 @@
# (C) Copyright 2000-2003
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-obj-y := cpu.o state.o
+obj-y := cache.o cpu.o state.o
extra-y := start.o os.o
extra-$(CONFIG_SANDBOX_SDL) += sdl.o
obj-$(CONFIG_SPL_BUILD) += spl.o
diff --git a/arch/sandbox/cpu/cache.c b/arch/sandbox/cpu/cache.c
new file mode 100644
index 0000000000..46c62c0b44
--- /dev/null
+++ b/arch/sandbox/cpu/cache.c
@@ -0,0 +1,23 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2020, Heinrich Schuchardt <xypron.glpk@gmx.de>
+ */
+
+#include <common.h>
+#include <cpu_func.h>
+#include <asm/state.h>
+
+void flush_cache(unsigned long addr, unsigned long size)
+{
+ /* Clang uses (char *) parameters, GCC (void *) */
+ __builtin___clear_cache((void *)addr, (void *)(addr + size));
+}
+
+void invalidate_icache_all(void)
+{
+ struct sandbox_state *state = state_get_current();
+
+ /* Clang uses (char *) parameters, GCC (void *) */
+ __builtin___clear_cache((void *)state->ram_buf,
+ (void *)(state->ram_buf + state->ram_size));
+}
diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c
index f6c98545e0..fe494aef75 100644
--- a/arch/sandbox/cpu/start.c
+++ b/arch/sandbox/cpu/start.c
@@ -6,6 +6,7 @@
#include <common.h>
#include <command.h>
#include <dm/root.h>
+#include <efi_loader.h>
#include <errno.h>
#include <init.h>
#include <os.h>
@@ -406,6 +407,15 @@ void state_show(struct sandbox_state *state)
printf("\n");
}
+void __efi_runtime EFIAPI efi_reset_system(
+ enum efi_reset_type reset_type,
+ efi_status_t reset_status,
+ unsigned long data_size, void *reset_data)
+{
+ os_fd_restore();
+ os_relaunch(os_argv);
+}
+
void sandbox_reset(void)
{
/* Do this here while it still has an effect */
diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
index f3b766271d..c9b9b7b75e 100644
--- a/arch/sandbox/dts/test.dts
+++ b/arch/sandbox/dts/test.dts
@@ -33,10 +33,11 @@
testfdt6 = "/e-test";
testbus3 = "/some-bus";
testfdt0 = "/some-bus/c-test@0";
- testfdt1 = "/some-bus/c-test@1";
+ testfdt12 = "/some-bus/c-test@1";
testfdt3 = "/b-test";
testfdt5 = "/some-bus/c-test@5";
testfdt8 = "/a-test";
+ testfdtm1 = &testfdtm1;
fdt-dummy0 = "/translation-test@8000/dev@0,0";
fdt-dummy1 = "/translation-test@8000/dev@1,100";
fdt-dummy2 = "/translation-test@8000/dev@2,200";
@@ -864,13 +865,21 @@
#size-cells = <0>;
reg = <0 1>;
compatible = "sandbox,spi";
- cs-gpios = <0>, <&gpio_a 0>;
+ cs-gpios = <0>, <0>, <&gpio_a 0>;
spi.bin@0 {
reg = <0>;
compatible = "spansion,m25p16", "jedec,spi-nor";
spi-max-frequency = <40000000>;
sandbox,filename = "spi.bin";
};
+ spi.bin@1 {
+ reg = <1>;
+ compatible = "spansion,m25p16", "jedec,spi-nor";
+ spi-max-frequency = <50000000>;
+ sandbox,filename = "spi.bin";
+ spi-cpol;
+ spi-cpha;
+ };
};
syscon0: syscon@0 {
@@ -917,6 +926,18 @@
idle-state = <0xabcd>;
};
+ testfdtm0 {
+ compatible = "denx,u-boot-fdtm-test";
+ };
+
+ testfdtm1: testfdtm1 {
+ compatible = "denx,u-boot-fdtm-test";
+ };
+
+ testfdtm2 {
+ compatible = "denx,u-boot-fdtm-test";
+ };
+
timer@0 {
compatible = "sandbox,timer";
clock-frequency = <1000000>;
diff --git a/arch/sandbox/include/asm/spi.h b/arch/sandbox/include/asm/spi.h
index 98e1826e2c..e8268bbe07 100644
--- a/arch/sandbox/include/asm/spi.h
+++ b/arch/sandbox/include/asm/spi.h
@@ -32,14 +32,4 @@ struct sandbox_spi_emu_ops {
int (*xfer)(void *priv, const u8 *rx, u8 *tx, uint bytes);
};
-/*
- * Extract the bus/cs from the spi spec and return the start of the spi
- * client spec. If the bus/cs are invalid for the current config, then
- * it returns NULL.
- *
- * Example: arg="0:1:foo" will set bus to 0, cs to 1, and return "foo"
- */
-const char *sandbox_spi_parse_spec(const char *arg, unsigned long *bus,
- unsigned long *cs);
-
#endif
diff --git a/arch/sandbox/include/asm/test.h b/arch/sandbox/include/asm/test.h
index 7f99d07c47..05f66f700c 100644
--- a/arch/sandbox/include/asm/test.h
+++ b/arch/sandbox/include/asm/test.h
@@ -203,6 +203,22 @@ void sandbox_set_allow_beep(struct udevice *dev, bool allow);
int sandbox_get_beep_frequency(struct udevice *dev);
/**
+ * sandbox_spi_get_speed() - Get current speed setting of a sandbox spi bus
+ *
+ * @dev: Device to check
+ * @return current bus speed
+ */
+uint sandbox_spi_get_speed(struct udevice *dev);
+
+/**
+ * sandbox_spi_get_mode() - Get current mode setting of a sandbox spi bus
+ *
+ * @dev: Device to check
+ * @return current mode
+ */
+uint sandbox_spi_get_mode(struct udevice *dev);
+
+/**
* sandbox_get_pch_spi_protect() - Get the PCI SPI protection status
*
* @dev: Device to check
diff --git a/arch/x86/cpu/apollolake/cpu.c b/arch/x86/cpu/apollolake/cpu.c
index d37f91d1ce..328f79255f 100644
--- a/arch/x86/cpu/apollolake/cpu.c
+++ b/arch/x86/cpu/apollolake/cpu.c
@@ -63,7 +63,7 @@ static int apl_get_info(const struct udevice *dev, struct cpu_info *info)
static int acpi_cpu_fill_ssdt(const struct udevice *dev, struct acpi_ctx *ctx)
{
- uint core_id = dev->req_seq;
+ uint core_id = dev_seq(dev);
int cores_per_package;
int ret;
diff --git a/arch/x86/cpu/broadwell/cpu_full.c b/arch/x86/cpu/broadwell/cpu_full.c
index 1ff4dce0b5..ea9e98dde6 100644
--- a/arch/x86/cpu/broadwell/cpu_full.c
+++ b/arch/x86/cpu/broadwell/cpu_full.c
@@ -638,7 +638,7 @@ static int broadwell_get_count(const struct udevice *dev)
static int cpu_x86_broadwell_probe(struct udevice *dev)
{
- if (dev->seq == 0) {
+ if (dev_seq(dev) == 0) {
cpu_core_init(dev);
return broadwell_init(dev);
}
diff --git a/arch/x86/cpu/ivybridge/model_206ax.c b/arch/x86/cpu/ivybridge/model_206ax.c
index 55f7cc2b2e..598ebcdf08 100644
--- a/arch/x86/cpu/ivybridge/model_206ax.c
+++ b/arch/x86/cpu/ivybridge/model_206ax.c
@@ -425,7 +425,7 @@ static int model_206ax_get_count(const struct udevice *dev)
static int cpu_x86_model_206ax_probe(struct udevice *dev)
{
- if (dev->seq == 0)
+ if (dev_seq(dev) == 0)
model_206ax_init(dev);
return 0;
diff --git a/arch/x86/cpu/mp_init.c b/arch/x86/cpu/mp_init.c
index a0e112178d..0e61c7b5d7 100644
--- a/arch/x86/cpu/mp_init.c
+++ b/arch/x86/cpu/mp_init.c
@@ -87,7 +87,7 @@ DECLARE_GLOBAL_DATA_PTR;
* intel,apic-id = <2>;
* };
*
- * Here the 'reg' property is the CPU number and then is placed in dev->req_seq
+ * Here the 'reg' property is the CPU number and then is placed in dev_seq(cpu)
* so that we can index into ap_callbacks[] using that. The APIC ID is different
* and may not be sequential (it typically is if hyperthreading is supported).
*
@@ -135,7 +135,7 @@ struct mp_flight_plan {
*
* @func: Function to run
* @arg: Argument to pass to the function
- * @logical_cpu_number: Either a CPU number (i.e. dev->req_seq) or a special
+ * @logical_cpu_number: Either a CPU number (i.e. dev_seq(cpu) or a special
* value like MP_SELECT_BSP. It tells the AP whether it should process this
* callback
*/
@@ -152,7 +152,7 @@ static struct mp_flight_plan mp_info;
* ap_callbacks - Callback mailbox array
*
* Array of callback, one entry for each available CPU, indexed by the CPU
- * number, which is dev->req_seq. The entry for the main CPU is never used.
+ * number, which is dev_seq(cpu). The entry for the main CPU is never used.
* When this is NULL, there is no pending work for the CPU to run. When
* non-NULL it points to the mp_callback structure. This is shared between all
* CPUs, so should only be written by the main CPU.
@@ -562,7 +562,7 @@ static int get_bsp(struct udevice **devp, int *cpu_countp)
if (cpu_countp)
*cpu_countp = ret;
- return dev->req_seq >= 0 ? dev->req_seq : 0;
+ return dev_seq(dev) >= 0 ? dev_seq(dev) : 0;
}
/**
@@ -614,7 +614,7 @@ static void store_callback(struct mp_callback **slot, struct mp_callback *val)
static int run_ap_work(struct mp_callback *callback, struct udevice *bsp,
int num_cpus, uint expire_ms)
{
- int cur_cpu = bsp->req_seq;
+ int cur_cpu = dev_seq(bsp);
int num_aps = num_cpus - 1; /* number of non-BSPs to get this message */
int cpus_accepted;
ulong start;
@@ -679,7 +679,7 @@ static int ap_wait_for_instruction(struct udevice *cpu, void *unused)
if (!IS_ENABLED(CONFIG_SMP_AP_WORK))
return 0;
- per_cpu_slot = &ap_callbacks[cpu->req_seq];
+ per_cpu_slot = &ap_callbacks[dev_seq(cpu)];
while (1) {
struct mp_callback *cb = read_callback(per_cpu_slot);
@@ -694,7 +694,7 @@ static int ap_wait_for_instruction(struct udevice *cpu, void *unused)
mfence();
if (lcb.logical_cpu_number == MP_SELECT_ALL ||
lcb.logical_cpu_number == MP_SELECT_APS ||
- cpu->req_seq == lcb.logical_cpu_number)
+ dev_seq(cpu) == lcb.logical_cpu_number)
lcb.func(lcb.arg);
/* Indicate we are finished */
@@ -839,7 +839,6 @@ int mp_init(void)
int num_aps, num_cpus;
atomic_t *ap_count;
struct udevice *cpu;
- struct uclass *uc;
int ret;
if (IS_ENABLED(CONFIG_QFW)) {
@@ -848,14 +847,6 @@ int mp_init(void)
return ret;
}
- /*
- * Multiple APs are brought up simultaneously and they may get the same
- * seq num in the uclass_resolve_seq() during device_probe(). To avoid
- * this, set req_seq to the reg number in the device tree in advance.
- */
- uclass_id_foreach_dev(UCLASS_CPU, cpu, uc)
- cpu->req_seq = dev_read_u32_default(cpu, "reg", -1);
-
ret = get_bsp(&cpu, &num_cpus);
if (ret < 0) {
debug("Cannot init boot CPU: err=%d\n", ret);
diff --git a/arch/x86/include/asm/mp.h b/arch/x86/include/asm/mp.h
index 5f9b8c6564..1e4e35321d 100644
--- a/arch/x86/include/asm/mp.h
+++ b/arch/x86/include/asm/mp.h
@@ -114,7 +114,7 @@ typedef void (*mp_run_func)(void *arg);
* Running on anything other than the boot CPU is only supported if
* CONFIG_SMP_AP_WORK is enabled
*
- * @cpu_select: CPU to run on (its dev->req_seq value), or MP_SELECT_ALL for
+ * @cpu_select: CPU to run on (its dev_seq() value), or MP_SELECT_ALL for
* all, or MP_SELECT_BSP for BSP
* @func: Function to run
* @arg: Argument to pass to the function