Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F156706954
D7274.id18637.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D7274.id18637.diff
View Options
Index: sys/arm64/arm64/machdep.c
===================================================================
--- sys/arm64/arm64/machdep.c
+++ sys/arm64/arm64/machdep.c
@@ -25,6 +25,7 @@
*
*/
+#include "opt_acpi.h"
#include "opt_platform.h"
#include "opt_ddb.h"
@@ -82,11 +83,19 @@
#include <machine/vfp.h>
#endif
+#ifdef DEV_ACPI
+#include <contrib/dev/acpica/include/acpi.h>
+#include <machine/acpica_machdep.h>
+#endif
+
#ifdef FDT
#include <dev/fdt/fdt_common.h>
#include <dev/ofw/openfirm.h>
#endif
+
+enum arm64_bus arm64_bus_method = ARM64_BUS_NONE;
+
struct pcpu __pcpu[MAXCPU];
static struct trapframe proc0_tf;
@@ -796,6 +805,51 @@
#endif
static void
+bus_probe(void)
+{
+ bool has_acpi, has_fdt;
+ char *bus_order, *env;
+
+ has_acpi = has_fdt = false;
+
+#ifdef FDT
+ has_fdt = (OF_peer(0) != 0);
+#endif
+#ifdef DEV_ACPI
+ has_acpi = (acpi_find_table(ACPI_SIG_SPCR) != 0);
+#endif
+
+ env = kern_getenv("boot_order");
+ if (env != NULL) {
+ bus_order = env;
+ while (bus_order != NULL) {
+ if (has_acpi &&
+ (bus_order[4] == ',' || bus_order[4] == '\0') &&
+ strncmp(bus_order, "acpi", 4) == 0) {
+ arm64_bus_method = ARM64_BUS_ACPI;
+ break;
+ }
+ if (has_fdt &&
+ (bus_order[3] == ',' || bus_order[3] == '\0') &&
+ strncmp(bus_order, "fdt", 3) == 0) {
+ arm64_bus_method = ARM64_BUS_FDT;
+ break;
+ }
+ bus_order = strchr(bus_order, ',');
+ }
+ freeenv(env);
+ }
+ /* If no order or an invalid order was set use the default */
+ /* XXX: Should it be an error to set an invalid order? */
+ if (arm64_bus_method == ARM64_BUS_NONE) {
+ if (has_fdt)
+ arm64_bus_method = ARM64_BUS_FDT;
+ else if (has_acpi)
+ arm64_bus_method = ARM64_BUS_ACPI;
+ }
+}
+
+static void
cache_setup(void)
{
int dcache_line_shift, icache_line_shift, dczva_line_shift;
@@ -914,6 +968,8 @@
devmap_bootstrap(0, NULL);
+ bus_probe();
+
cninit();
init_proc0(abp->kern_stack);
Index: sys/arm64/arm64/mp_machdep.c
===================================================================
--- sys/arm64/arm64/mp_machdep.c
+++ sys/arm64/arm64/mp_machdep.c
@@ -52,6 +52,7 @@
#include <vm/vm_kern.h>
#include <machine/debug_monitor.h>
+#include <machine/machdep.h>
#include <machine/intr.h>
#include <machine/smp.h>
#ifdef VFP
@@ -90,13 +91,6 @@
extern struct pcpu __pcpu[];
-static enum {
- CPUS_UNKNOWN,
-#ifdef FDT
- CPUS_FDT,
-#endif
-} cpu_enum_method;
-
static device_identify_t arm64_cpu_identify;
static device_probe_t arm64_cpu_probe;
static device_attach_t arm64_cpu_attach;
@@ -502,14 +496,14 @@
CPU_SET(0, &all_cpus);
- switch(cpu_enum_method) {
+ switch(arm64_bus_method) {
#ifdef FDT
- case CPUS_FDT:
+ case ARM64_BUS_FDT:
KASSERT(cpu0 >= 0, ("Current CPU was not found"));
ofw_cpu_early_foreach(cpu_init_fdt, true);
break;
#endif
- case CPUS_UNKNOWN:
+ default:
break;
}
}
@@ -547,15 +541,17 @@
#ifdef FDT
int cores;
- cores = ofw_cpu_early_foreach(cpu_find_cpu0_fdt, false);
- if (cores > 0) {
- cores = MIN(cores, MAXCPU);
- if (bootverbose)
- printf("Found %d CPUs in the device tree\n", cores);
- mp_ncpus = cores;
- mp_maxid = cores - 1;
- cpu_enum_method = CPUS_FDT;
- return;
+ if (arm64_bus_method == ARM64_BUS_FDT) {
+ cores = ofw_cpu_early_foreach(cpu_find_cpu0_fdt, false);
+ if (cores > 0) {
+ cores = MIN(cores, MAXCPU);
+ if (bootverbose)
+ printf("Found %d CPUs in the device tree\n",
+ cores);
+ mp_ncpus = cores;
+ mp_maxid = cores - 1;
+ return;
+ }
}
#endif
Index: sys/arm64/arm64/nexus.c
===================================================================
--- sys/arm64/arm64/nexus.c
+++ sys/arm64/arm64/nexus.c
@@ -55,6 +55,7 @@
#include <sys/rman.h>
#include <sys/interrupt.h>
+#include <machine/machdep.h>
#include <machine/vmparam.h>
#include <machine/pcb.h>
#include <vm/vm.h>
@@ -411,7 +412,7 @@
nexus_fdt_probe(device_t dev)
{
- if (OF_peer(0) == 0)
+ if (arm64_bus_method != ARM64_BUS_FDT || OF_peer(0) == 0)
return (ENXIO);
device_quiet(dev);
@@ -455,7 +456,7 @@
nexus_acpi_probe(device_t dev)
{
- if (acpi_identify() != 0)
+ if (arm64_bus_method != ARM64_BUS_ACPI || acpi_identify() != 0)
return (ENXIO);
device_quiet(dev);
Index: sys/arm64/include/machdep.h
===================================================================
--- sys/arm64/include/machdep.h
+++ sys/arm64/include/machdep.h
@@ -37,6 +37,14 @@
vm_offset_t kern_l0pt; /* L1 page table for the kernel */
};
+enum arm64_bus {
+ ARM64_BUS_NONE,
+ ARM64_BUS_FDT,
+ ARM64_BUS_ACPI,
+};
+
+extern enum arm64_bus arm64_bus_method;
+
extern vm_paddr_t physmap[];
extern u_int physmap_idx;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, May 16, 7:42 PM (7 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33148516
Default Alt Text
D7274.id18637.diff (4 KB)
Attached To
Mode
D7274: Add a kernel env to select between acpi and fdt
Attached
Detach File
Event Timeline
Log In to Comment