Changeset View
Changeset View
Standalone View
Standalone View
sys/arm64/arm64/machdep.c
Show First 20 Lines • Show All 96 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 | ||||
enum arm64_bus arm64_bus_method = ARM64_BUS_NONE; | enum arm64_bus arm64_bus_method = ARM64_BUS_NONE; | ||||
struct pcpu __pcpu[MAXCPU]; | /* | ||||
* XXX: The .bss is assumed to be in the boot CPU NUMA domain. If not we | |||||
markj: Isn't this the same as `cpuid_to_pcpu[]` now? Do we need `__pcpu[]` at all? | |||||
* could relocate this, but will need to keep the same virtual address as | |||||
* it's reverenced by the EARLY_COUNTER macro. | |||||
*/ | |||||
struct pcpu pcpu0; | |||||
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; | ||||
struct kva_md_info kmi; | struct kva_md_info kmi; | ||||
▲ Show 20 Lines • Show All 215 Lines • ▼ Show 20 Lines | makectx(struct trapframe *tf, struct pcb *pcb) | ||||
/* NB: pcb_lr is the PC, see PC_REGS() in db_machdep.h */ | /* NB: pcb_lr is the PC, see PC_REGS() in db_machdep.h */ | ||||
pcb->pcb_lr = tf->tf_elr; | pcb->pcb_lr = tf->tf_elr; | ||||
pcb->pcb_sp = tf->tf_sp; | pcb->pcb_sp = tf->tf_sp; | ||||
} | } | ||||
static void | static void | ||||
init_proc0(vm_offset_t kstack) | init_proc0(vm_offset_t kstack) | ||||
{ | { | ||||
struct pcpu *pcpup = &__pcpu[0]; | struct pcpu *pcpup; | ||||
pcpup = cpuid_to_pcpu[0]; | |||||
MPASS(pcpup != NULL); | |||||
proc_linkup0(&proc0, &thread0); | proc_linkup0(&proc0, &thread0); | ||||
thread0.td_kstack = kstack; | thread0.td_kstack = kstack; | ||||
thread0.td_kstack_pages = KSTACK_PAGES; | thread0.td_kstack_pages = KSTACK_PAGES; | ||||
thread0.td_pcb = (struct pcb *)(thread0.td_kstack + | thread0.td_pcb = (struct pcb *)(thread0.td_kstack + | ||||
thread0.td_kstack_pages * PAGE_SIZE) - 1; | thread0.td_kstack_pages * PAGE_SIZE) - 1; | ||||
thread0.td_pcb->pcb_fpflags = 0; | thread0.td_pcb->pcb_fpflags = 0; | ||||
thread0.td_pcb->pcb_fpusaved = &thread0.td_pcb->pcb_fpustate; | thread0.td_pcb->pcb_fpusaved = &thread0.td_pcb->pcb_fpustate; | ||||
thread0.td_pcb->pcb_vfpcpu = UINT_MAX; | thread0.td_pcb->pcb_vfpcpu = UINT_MAX; | ||||
▲ Show 20 Lines • Show All 410 Lines • ▼ Show 20 Lines | #endif | ||||
/* Exclude the EFI framebuffer from our view of physical memory. */ | /* Exclude the EFI framebuffer from our view of physical memory. */ | ||||
efifb = (struct efi_fb *)preload_search_info(kmdp, | efifb = (struct efi_fb *)preload_search_info(kmdp, | ||||
MODINFO_METADATA | MODINFOMD_EFI_FB); | MODINFO_METADATA | MODINFOMD_EFI_FB); | ||||
if (efifb != NULL) | if (efifb != NULL) | ||||
physmem_exclude_region(efifb->fb_addr, efifb->fb_size, | physmem_exclude_region(efifb->fb_addr, efifb->fb_size, | ||||
EXFLAG_NOALLOC); | EXFLAG_NOALLOC); | ||||
/* Set the pcpu data, this is needed by pmap_bootstrap */ | /* Set the pcpu data, this is needed by pmap_bootstrap */ | ||||
pcpup = &__pcpu[0]; | pcpup = &pcpu0; | ||||
Not Done Inline ActionsWe assume that .bss is allocated from the domain to which the BSP belongs. That's probably true in practice though, at least amd64 makes a similar assumption when it allocates the pcpu area in pmap_bootstrap(). markj: We assume that .bss is allocated from the domain to which the BSP belongs. That's probably true… | |||||
pcpu_init(pcpup, 0, sizeof(struct pcpu)); | pcpu_init(pcpup, 0, sizeof(struct pcpu)); | ||||
/* | /* | ||||
* Set the pcpu pointer with a backup in tpidr_el1 to be | * Set the pcpu pointer with a backup in tpidr_el1 to be | ||||
* loaded when entering the kernel from userland. | * loaded when entering the kernel from userland. | ||||
*/ | */ | ||||
__asm __volatile( | __asm __volatile( | ||||
"mov x18, %0 \n" | "mov x18, %0 \n" | ||||
▲ Show 20 Lines • Show All 189 Lines • Show Last 20 Lines |
Isn't this the same as cpuid_to_pcpu[] now? Do we need __pcpu[] at all?