Changeset View
Changeset View
Standalone View
Standalone View
sys/arm64/arm64/machdep.c
Show First 20 Lines • Show All 97 Lines • ▼ Show 20 Lines | |||||
#ifdef FDT | #ifdef FDT | ||||
#include <dev/fdt/fdt_common.h> | #include <dev/fdt/fdt_common.h> | ||||
#include <dev/ofw/openfirm.h> | #include <dev/ofw/openfirm.h> | ||||
#endif | #endif | ||||
static void get_fpcontext(struct thread *td, mcontext_t *mcp); | static void get_fpcontext(struct thread *td, mcontext_t *mcp); | ||||
static void set_fpcontext(struct thread *td, mcontext_t *mcp); | static void set_fpcontext(struct thread *td, mcontext_t *mcp); | ||||
enum arm64_bus arm64_bus_method = ARM64_BUS_NONE; | enum firmware_types firmware_type = FW_NONE; | ||||
struct pcpu __pcpu[MAXCPU]; | struct pcpu __pcpu[MAXCPU]; | ||||
static struct trapframe proc0_tf; | static struct trapframe proc0_tf; | ||||
int early_boot = 1; | int early_boot = 1; | ||||
int cold = 1; | int cold = 1; | ||||
static int boot_el; | static int boot_el; | ||||
▲ Show 20 Lines • Show All 1,079 Lines • ▼ Show 20 Lines | #endif | ||||
env = kern_getenv("kern.cfg.order"); | env = kern_getenv("kern.cfg.order"); | ||||
if (env != NULL) { | if (env != NULL) { | ||||
order = env; | order = env; | ||||
while (order != NULL) { | while (order != NULL) { | ||||
if (has_acpi && | if (has_acpi && | ||||
strncmp(order, "acpi", 4) == 0 && | strncmp(order, "acpi", 4) == 0 && | ||||
(order[4] == ',' || order[4] == '\0')) { | (order[4] == ',' || order[4] == '\0')) { | ||||
arm64_bus_method = ARM64_BUS_ACPI; | firmware_type = FW_UEFI; | ||||
break; | break; | ||||
} | } | ||||
if (has_fdt && | if (has_fdt && | ||||
strncmp(order, "fdt", 3) == 0 && | strncmp(order, "fdt", 3) == 0 && | ||||
(order[3] == ',' || order[3] == '\0')) { | (order[3] == ',' || order[3] == '\0')) { | ||||
arm64_bus_method = ARM64_BUS_FDT; | firmware_type = FW_DEVTREE; | ||||
break; | break; | ||||
} | } | ||||
order = strchr(order, ','); | order = strchr(order, ','); | ||||
} | } | ||||
freeenv(env); | freeenv(env); | ||||
/* If we set the bus method it is valid */ | /* If we set the bus method it is valid */ | ||||
if (arm64_bus_method != ARM64_BUS_NONE) | if (firmware_type != FW_NONE) | ||||
return (true); | return (true); | ||||
} | } | ||||
/* If no order or an invalid order was set use the default */ | /* If no order or an invalid order was set use the default */ | ||||
if (arm64_bus_method == ARM64_BUS_NONE) { | if (firmware_type == FW_NONE) { | ||||
if (has_fdt) | if (has_fdt) | ||||
arm64_bus_method = ARM64_BUS_FDT; | firmware_type = FW_DEVTREE; | ||||
else if (has_acpi) | else if (has_acpi) | ||||
arm64_bus_method = ARM64_BUS_ACPI; | firmware_type = FW_UEFI; | ||||
} | } | ||||
/* | /* | ||||
* If no option was set the default is valid, otherwise we are | * If no option was set the default is valid, otherwise we are | ||||
* setting one to get cninit() working, then calling panic to tell | * setting one to get cninit() working, then calling panic to tell | ||||
* the user about the invalid bus setup. | * the user about the invalid bus setup. | ||||
*/ | */ | ||||
return (env == NULL); | return (env == NULL); | ||||
▲ Show 20 Lines • Show All 185 Lines • ▼ Show 20 Lines | #endif | ||||
kcsan_cpu_init(0); | kcsan_cpu_init(0); | ||||
env = kern_getenv("kernelname"); | env = kern_getenv("kernelname"); | ||||
if (env != NULL) | if (env != NULL) | ||||
strlcpy(kernelname, env, sizeof(kernelname)); | strlcpy(kernelname, env, sizeof(kernelname)); | ||||
#ifdef FDT | #ifdef FDT | ||||
if (arm64_bus_method == ARM64_BUS_FDT) { | if (firmware_type == FW_DEVTREE) { | ||||
root = OF_finddevice("/"); | root = OF_finddevice("/"); | ||||
if (OF_getprop(root, "freebsd,dts-version", dts_version, sizeof(dts_version)) > 0) { | if (OF_getprop(root, "freebsd,dts-version", dts_version, sizeof(dts_version)) > 0) { | ||||
if (strcmp(LINUX_DTS_VERSION, dts_version) != 0) | if (strcmp(LINUX_DTS_VERSION, dts_version) != 0) | ||||
printf("WARNING: DTB version is %s while kernel expects %s, " | printf("WARNING: DTB version is %s while kernel expects %s, " | ||||
"please update the DTB in the ESP\n", | "please update the DTB in the ESP\n", | ||||
dts_version, | dts_version, | ||||
LINUX_DTS_VERSION); | LINUX_DTS_VERSION); | ||||
} else { | } else { | ||||
▲ Show 20 Lines • Show All 125 Lines • Show Last 20 Lines |