version 1.7, 2017/06/11 20:25:07 |
version 1.25, 2018/07/17 00:38:27 |
|
|
__KERNEL_RCSID(0, "$NetBSD$"); |
__KERNEL_RCSID(0, "$NetBSD$"); |
|
|
#include "opt_machdep.h" |
#include "opt_machdep.h" |
|
#include "opt_bootconfig.h" |
#include "opt_ddb.h" |
#include "opt_ddb.h" |
#include "opt_md.h" |
#include "opt_md.h" |
#include "opt_arm_debug.h" |
#include "opt_arm_debug.h" |
#include "opt_multiprocessor.h" |
#include "opt_multiprocessor.h" |
#include "opt_cpuoptions.h" |
#include "opt_cpuoptions.h" |
|
|
|
#include "ukbd.h" |
|
|
#include <sys/param.h> |
#include <sys/param.h> |
#include <sys/systm.h> |
#include <sys/systm.h> |
#include <sys/bus.h> |
#include <sys/bus.h> |
Line 50 __KERNEL_RCSID(0, "$NetBSD$"); |
|
Line 53 __KERNEL_RCSID(0, "$NetBSD$"); |
|
#include <sys/proc.h> |
#include <sys/proc.h> |
#include <sys/reboot.h> |
#include <sys/reboot.h> |
#include <sys/termios.h> |
#include <sys/termios.h> |
|
#include <sys/extent.h> |
|
|
|
#include <dev/cons.h> |
#include <uvm/uvm_extern.h> |
#include <uvm/uvm_extern.h> |
|
|
#include <sys/conf.h> |
#include <sys/conf.h> |
Line 61 __KERNEL_RCSID(0, "$NetBSD$"); |
|
Line 66 __KERNEL_RCSID(0, "$NetBSD$"); |
|
|
|
#include <machine/bootconfig.h> |
#include <machine/bootconfig.h> |
#include <arm/armreg.h> |
#include <arm/armreg.h> |
#include <arm/undefined.h> |
|
|
|
|
#include <arm/cpufunc.h> |
|
#ifdef __aarch64__ |
|
#include <aarch64/machdep.h> |
|
#else |
#include <arm/arm32/machdep.h> |
#include <arm/arm32/machdep.h> |
|
#endif |
|
|
|
|
#include <evbarm/include/autoconf.h> |
#include <evbarm/include/autoconf.h> |
#include <evbarm/fdt/platform.h> |
#include <evbarm/fdt/platform.h> |
|
|
#include <arm/fdt/arm_fdtvar.h> |
#include <arm/fdt/arm_fdtvar.h> |
|
|
|
#if NUKBD > 0 |
|
#include <dev/usb/ukbdvar.h> |
|
#endif |
|
|
|
#ifdef MEMORY_DISK_DYNAMIC |
|
#include <dev/md.h> |
|
#endif |
|
|
#ifndef FDT_MAX_BOOT_STRING |
#ifndef FDT_MAX_BOOT_STRING |
#define FDT_MAX_BOOT_STRING 1024 |
#define FDT_MAX_BOOT_STRING 1024 |
#endif |
#endif |
Line 77 __KERNEL_RCSID(0, "$NetBSD$"); |
|
Line 95 __KERNEL_RCSID(0, "$NetBSD$"); |
|
BootConfig bootconfig; |
BootConfig bootconfig; |
char bootargs[FDT_MAX_BOOT_STRING] = ""; |
char bootargs[FDT_MAX_BOOT_STRING] = ""; |
char *boot_args = NULL; |
char *boot_args = NULL; |
u_int uboot_args[4] = { 0 }; /* filled in by xxx_start.S (not in bss) */ |
/* |
|
* filled in by xxx_start.S (must not be in bss) |
|
*/ |
|
unsigned long uboot_args[4] = { 0 }; |
|
const uint8_t *fdt_addr_r = (const uint8_t *)0xdeadc0de; |
|
|
|
static char fdt_memory_ext_storage[EXTENT_FIXED_STORAGE_SIZE(DRAM_BLOCKS)]; |
|
static struct extent *fdt_memory_ext; |
|
|
|
static uint64_t initrd_start, initrd_end; |
|
|
#include <libfdt.h> |
#include <libfdt.h> |
#include <dev/fdt/fdtvar.h> |
#include <dev/fdt/fdtvar.h> |
#define FDT_BUF_SIZE (128*1024) |
#define FDT_BUF_SIZE (256*1024) |
static uint8_t fdt_data[FDT_BUF_SIZE]; |
static uint8_t fdt_data[FDT_BUF_SIZE]; |
|
|
extern char KERNEL_BASE_phys[]; |
extern char KERNEL_BASE_phys[]; |
Line 92 static void fdt_device_register(device_t |
|
Line 119 static void fdt_device_register(device_t |
|
static void fdt_reset(void); |
static void fdt_reset(void); |
static void fdt_powerdown(void); |
static void fdt_powerdown(void); |
|
|
#ifdef PMAP_NEED_ALLOC_POOLPAGE |
static dev_type_cnputc(earlyconsputc); |
static struct boot_physmem bp_lowgig = { |
static dev_type_cngetc(earlyconsgetc); |
.bp_pages = (KERNEL_VM_BASE - KERNEL_BASE) / NBPG, |
|
.bp_freelist = VM_FREELIST_ISADMA, |
static struct consdev earlycons = { |
.bp_flags = 0 |
.cn_putc = earlyconsputc, |
|
.cn_getc = earlyconsgetc, |
|
.cn_pollc = nullcnpollc, |
}; |
}; |
#endif |
|
|
|
#ifdef VERBOSE_INIT_ARM |
|
static void |
static void |
fdt_putchar(char c) |
fdt_putchar(char c) |
{ |
{ |
const struct arm_platform *plat = arm_fdt_platform(); |
const struct arm_platform *plat = arm_fdt_platform(); |
if (plat && plat->early_putchar) |
if (plat && plat->early_putchar) { |
plat->early_putchar(c); |
plat->early_putchar(c); |
|
} |
|
#ifdef EARLYCONS |
|
else { |
|
#define PLATFORM_EARLY_PUTCHAR ___CONCAT(EARLYCONS, _platform_early_putchar) |
|
void PLATFORM_EARLY_PUTCHAR(char); |
|
PLATFORM_EARLY_PUTCHAR(c); |
|
} |
|
#endif |
} |
} |
|
|
static void |
static void |
fdt_putstr(const char *s) |
earlyconsputc(dev_t dev, int c) |
{ |
{ |
for (const char *p = s; *p; p++) |
fdt_putchar(c); |
fdt_putchar(*p); |
|
} |
} |
|
|
static void |
static int |
fdt_printn(u_int n, int base) |
earlyconsgetc(dev_t dev) |
{ |
{ |
char *p, buf[(sizeof(u_int) * NBBY / 3) + 1 + 2 /* ALT + SIGN */]; |
return 0; /* XXX */ |
|
|
p = buf; |
|
do { |
|
*p++ = hexdigits[n % base]; |
|
} while (n /= base); |
|
|
|
do { |
|
fdt_putchar(*--p); |
|
} while (p > buf); |
|
} |
} |
#define DPRINTF(...) printf(__VA_ARGS__) |
|
#define DPRINT(x) fdt_putstr(x) |
#ifdef VERBOSE_INIT_ARM |
#define DPRINTN(x,b) fdt_printn((x), (b)) |
#define DPRINTF(...) printf(__VA_ARGS__) |
#else |
#else |
#define DPRINTF(...) |
#define DPRINTF(...) |
#define DPRINT(x) |
|
#define DPRINTN(x,b) |
|
#endif |
#endif |
|
|
/* |
/* |
* Get the first physically contiguous region of memory. |
* ARM: Get the first physically contiguous region of memory. |
|
* ARM64: Get all of physical memory, including holes. |
*/ |
*/ |
static void |
static void |
fdt_get_memory(uint64_t *paddr, uint64_t *psize) |
fdt_get_memory(uint64_t *pstart, uint64_t *pend) |
{ |
{ |
const int memory = OF_finddevice("/memory"); |
const int memory = OF_finddevice("/memory"); |
uint64_t cur_addr, cur_size; |
uint64_t cur_addr, cur_size; |
int index; |
int index; |
|
|
/* Assume the first entry is the start of memory */ |
/* Assume the first entry is the start of memory */ |
if (fdtbus_get_reg64(memory, 0, paddr, psize) != 0) |
if (fdtbus_get_reg64(memory, 0, &cur_addr, &cur_size) != 0) |
panic("Cannot determine memory size"); |
panic("Cannot determine memory size"); |
|
|
|
*pstart = cur_addr; |
|
*pend = cur_addr + cur_size; |
|
|
DPRINTF("FDT /memory [%d] @ 0x%" PRIx64 " size 0x%" PRIx64 "\n", |
DPRINTF("FDT /memory [%d] @ 0x%" PRIx64 " size 0x%" PRIx64 "\n", |
0, *paddr, *psize); |
0, *pstart, *pend - *pstart); |
|
|
/* If subsequent entries follow the previous one, append them. */ |
|
for (index = 1; |
for (index = 1; |
fdtbus_get_reg64(memory, index, &cur_addr, &cur_size) == 0; |
fdtbus_get_reg64(memory, index, &cur_addr, &cur_size) == 0; |
index++) { |
index++) { |
DPRINTF("FDT /memory [%d] @ 0x%" PRIx64 " size 0x%" PRIx64 "\n", |
DPRINTF("FDT /memory [%d] @ 0x%" PRIx64 " size 0x%" PRIx64 "\n", |
index, cur_addr, cur_size); |
index, cur_addr, cur_size); |
if (*paddr + *psize == cur_addr) |
|
*psize += cur_size; |
#ifdef __aarch64__ |
|
if (cur_addr + cur_size > *pend) |
|
*pend = cur_addr + cur_size; |
|
#else |
|
/* If subsequent entries follow the previous, append them. */ |
|
if (*pend == cur_addr) |
|
*pend = cur_addr + cur_size; |
|
#endif |
|
} |
|
} |
|
|
|
void |
|
fdt_add_reserved_memory_range(uint64_t addr, uint64_t size) |
|
{ |
|
uint64_t start = trunc_page(addr); |
|
uint64_t end = round_page(addr + size); |
|
|
|
int error = extent_free(fdt_memory_ext, start, |
|
end - start, EX_NOWAIT); |
|
if (error != 0) |
|
printf("MEM ERROR: res %" PRIx64 "-%" PRIx64 " failed: %d\n", |
|
start, end, error); |
|
else |
|
DPRINTF("MEM: res %" PRIx64 "-%" PRIx64 "\n", start, end); |
|
} |
|
|
|
/* |
|
* Exclude memory ranges from memory config from the device tree |
|
*/ |
|
static void |
|
fdt_add_reserved_memory(uint64_t max_addr) |
|
{ |
|
uint64_t addr, size; |
|
int index, error; |
|
|
|
const int num = fdt_num_mem_rsv(fdtbus_get_data()); |
|
for (index = 0; index <= num; index++) { |
|
error = fdt_get_mem_rsv(fdtbus_get_data(), index, |
|
&addr, &size); |
|
if (error != 0 || size == 0) |
|
continue; |
|
if (addr >= max_addr) |
|
continue; |
|
if (addr + size > max_addr) |
|
size = max_addr - addr; |
|
fdt_add_reserved_memory_range(addr, size); |
|
} |
|
} |
|
|
|
/* |
|
* Define usable memory regions. |
|
*/ |
|
static void |
|
fdt_build_bootconfig(uint64_t mem_start, uint64_t mem_end) |
|
{ |
|
const int memory = OF_finddevice("/memory"); |
|
BootConfig *bc = &bootconfig; |
|
struct extent_region *er; |
|
uint64_t addr, size; |
|
int index, error; |
|
|
|
fdt_memory_ext = extent_create("FDT Memory", mem_start, mem_end, |
|
fdt_memory_ext_storage, sizeof(fdt_memory_ext_storage), EX_EARLY); |
|
|
|
for (index = 0; |
|
fdtbus_get_reg64(memory, index, &addr, &size) == 0; |
|
index++) { |
|
if (addr >= mem_end || size == 0) |
|
continue; |
|
if (addr + size > mem_end) |
|
size = mem_end - addr; |
|
|
|
error = extent_alloc_region(fdt_memory_ext, addr, size, |
|
EX_NOWAIT); |
|
if (error != 0) |
|
printf("MEM ERROR: add %" PRIx64 "-%" PRIx64 " failed: %d\n", |
|
addr, addr + size, error); |
|
DPRINTF("MEM: add %" PRIx64 "-%" PRIx64 "\n", addr, addr + size); |
|
} |
|
|
|
fdt_add_reserved_memory(mem_end); |
|
|
|
const uint64_t initrd_size = initrd_end - initrd_start; |
|
if (initrd_size > 0) |
|
fdt_add_reserved_memory_range(initrd_start, initrd_size); |
|
|
|
DPRINTF("Usable memory:\n"); |
|
bc->dramblocks = 0; |
|
LIST_FOREACH(er, &fdt_memory_ext->ex_regions, er_link) { |
|
DPRINTF(" %lx - %lx\n", er->er_start, er->er_end); |
|
bc->dram[bc->dramblocks].address = er->er_start; |
|
bc->dram[bc->dramblocks].pages = |
|
(er->er_end - er->er_start) / PAGE_SIZE; |
|
bc->dramblocks++; |
|
} |
|
} |
|
|
|
static void |
|
fdt_probe_initrd(uint64_t *pstart, uint64_t *pend) |
|
{ |
|
*pstart = *pend = 0; |
|
|
|
#ifdef MEMORY_DISK_DYNAMIC |
|
const int chosen = OF_finddevice("/chosen"); |
|
if (chosen < 0) |
|
return; |
|
|
|
int len; |
|
const void *start_data = fdtbus_get_prop(chosen, |
|
"linux,initrd-start", &len); |
|
const void *end_data = fdtbus_get_prop(chosen, |
|
"linux,initrd-end", NULL); |
|
if (start_data == NULL || end_data == NULL) |
|
return; |
|
|
|
switch (len) { |
|
case 4: |
|
*pstart = be32dec(start_data); |
|
*pend = be32dec(end_data); |
|
break; |
|
case 8: |
|
*pstart = be64dec(start_data); |
|
*pend = be64dec(end_data); |
|
break; |
|
default: |
|
printf("Unsupported len %d for /chosen/initrd-start\n", len); |
|
return; |
|
} |
|
#endif |
|
} |
|
|
|
static void |
|
fdt_setup_initrd(void) |
|
{ |
|
#ifdef MEMORY_DISK_DYNAMIC |
|
const uint64_t initrd_size = initrd_end - initrd_start; |
|
paddr_t startpa = trunc_page(initrd_start); |
|
paddr_t endpa = round_page(initrd_end); |
|
paddr_t pa; |
|
vaddr_t va; |
|
void *md_start; |
|
|
|
if (initrd_size == 0) |
|
return; |
|
|
|
va = uvm_km_alloc(kernel_map, initrd_size, 0, |
|
UVM_KMF_VAONLY | UVM_KMF_NOWAIT); |
|
if (va == 0) { |
|
printf("Failed to allocate VA for initrd\n"); |
|
return; |
} |
} |
|
|
|
md_start = (void *)va; |
|
|
|
for (pa = startpa; pa < endpa; pa += PAGE_SIZE, va += PAGE_SIZE) |
|
pmap_kenter_pa(va, pa, VM_PROT_READ|VM_PROT_WRITE, 0); |
|
pmap_update(pmap_kernel()); |
|
|
|
md_root_setconf(md_start, initrd_size); |
|
#endif |
} |
} |
|
|
|
u_int initarm(void *arg); |
|
|
u_int |
u_int |
initarm(void *arg) |
initarm(void *arg) |
{ |
{ |
const struct arm_platform *plat; |
const struct arm_platform *plat; |
uint64_t memory_addr, memory_size; |
uint64_t memory_start, memory_end; |
psize_t ram_size = 0; |
|
|
/* set temporally to work printf()/panic() even before consinit() */ |
|
cn_tab = &earlycons; |
|
|
/* Load FDT */ |
/* Load FDT */ |
const uint8_t *fdt_addr_r = (const uint8_t *)uboot_args[2]; |
|
int error = fdt_check_header(fdt_addr_r); |
int error = fdt_check_header(fdt_addr_r); |
if (error == 0) { |
if (error == 0) { |
error = fdt_move(fdt_addr_r, fdt_data, sizeof(fdt_data)); |
error = fdt_move(fdt_addr_r, fdt_data, sizeof(fdt_data)); |
Line 192 initarm(void *arg) |
|
Line 379 initarm(void *arg) |
|
panic("Kernel does not support this device"); |
panic("Kernel does not support this device"); |
|
|
/* Early console may be available, announce ourselves. */ |
/* Early console may be available, announce ourselves. */ |
DPRINT("FDT<"); |
DPRINTF("FDT<%p>\n", fdt_addr_r); |
DPRINTN((uintptr_t)fdt_addr_r, 16); |
|
DPRINT(">"); |
|
|
|
const int chosen = OF_finddevice("/chosen"); |
const int chosen = OF_finddevice("/chosen"); |
if (chosen >= 0) |
if (chosen >= 0) |
OF_getprop(chosen, "bootargs", bootargs, sizeof(bootargs)); |
OF_getprop(chosen, "bootargs", bootargs, sizeof(bootargs)); |
boot_args = bootargs; |
boot_args = bootargs; |
|
|
DPRINT(" devmap"); |
DPRINTF("devmap\n"); |
pmap_devmap_register(plat->devmap()); |
pmap_devmap_register(plat->devmap()); |
|
#ifdef __aarch64__ |
DPRINT(" bootstrap"); |
pmap_devmap_bootstrap(plat->devmap()); |
plat->bootstrap(); |
#endif |
|
|
/* Heads up ... Setup the CPU / MMU / TLB functions. */ |
/* Heads up ... Setup the CPU / MMU / TLB functions. */ |
DPRINT(" cpufunc"); |
DPRINTF("cpufunc\n"); |
if (set_cpufuncs()) |
if (set_cpufuncs()) |
panic("cpu not recognized!"); |
panic("cpu not recognized!"); |
|
|
|
DPRINTF("bootstrap\n"); |
|
plat->bootstrap(); |
|
|
/* |
/* |
* If stdout-path is specified on the command line, override the |
* If stdout-path is specified on the command line, override the |
* value in /chosen/stdout-path before initializing console. |
* value in /chosen/stdout-path before initializing console. |
*/ |
*/ |
fdt_update_stdout_path(); |
fdt_update_stdout_path(); |
|
|
DPRINT(" consinit"); |
DPRINTF("consinit "); |
consinit(); |
consinit(); |
|
DPRINTF("ok\n"); |
|
|
DPRINTF(" ok\n"); |
DPRINTF("uboot: args %#lx, %#lx, %#lx, %#lx\n", |
|
|
DPRINTF("uboot: args %#x, %#x, %#x, %#x\n", |
|
uboot_args[0], uboot_args[1], uboot_args[2], uboot_args[3]); |
uboot_args[0], uboot_args[1], uboot_args[2], uboot_args[3]); |
|
|
cpu_reset_address = fdt_reset; |
cpu_reset_address = fdt_reset; |
Line 238 initarm(void *arg) |
|
Line 425 initarm(void *arg) |
|
parse_mi_bootargs(mi_bootargs); |
parse_mi_bootargs(mi_bootargs); |
#endif |
#endif |
|
|
|
#ifndef __aarch64__ |
DPRINTF("KERNEL_BASE=0x%x, " |
DPRINTF("KERNEL_BASE=0x%x, " |
"KERNEL_VM_BASE=0x%x, " |
"KERNEL_VM_BASE=0x%x, " |
"KERNEL_VM_BASE - KERNEL_BASE=0x%x, " |
"KERNEL_VM_BASE - KERNEL_BASE=0x%x, " |
Line 246 initarm(void *arg) |
|
Line 434 initarm(void *arg) |
|
KERNEL_VM_BASE, |
KERNEL_VM_BASE, |
KERNEL_VM_BASE - KERNEL_BASE, |
KERNEL_VM_BASE - KERNEL_BASE, |
KERNEL_BASE_VOFFSET); |
KERNEL_BASE_VOFFSET); |
|
#endif |
|
|
fdt_get_memory(&memory_addr, &memory_size); |
fdt_get_memory(&memory_start, &memory_end); |
|
|
#if !defined(_LP64) |
#if !defined(_LP64) |
/* Cannot map memory above 4GB */ |
/* Cannot map memory above 4GB */ |
if (memory_addr + memory_size > 0x100000000) |
if (memory_end >= 0x100000000ULL) |
memory_size = 0x100000000 - memory_addr; |
memory_end = 0x100000000ULL - PAGE_SIZE; |
#endif |
|
|
|
ram_size = (bus_size_t)memory_size; |
uint64_t memory_size = memory_end - memory_start; |
|
#endif |
|
|
|
#ifndef __aarch64__ |
#ifdef __HAVE_MM_MD_DIRECT_MAPPED_PHYS |
#ifdef __HAVE_MM_MD_DIRECT_MAPPED_PHYS |
const bool mapallmem_p = true; |
const bool mapallmem_p = true; |
#ifndef PMAP_NEED_ALLOC_POOLPAGE |
#ifndef PMAP_NEED_ALLOC_POOLPAGE |
if (ram_size > KERNEL_VM_BASE - KERNEL_BASE) { |
if (memory_size > KERNEL_VM_BASE - KERNEL_BASE) { |
DPRINTF("%s: dropping RAM size from %luMB to %uMB\n", |
DPRINTF("%s: dropping RAM size from %luMB to %uMB\n", |
__func__, (unsigned long) (ram_size >> 20), |
__func__, (unsigned long) (memory_size >> 20), |
(KERNEL_VM_BASE - KERNEL_BASE) >> 20); |
(KERNEL_VM_BASE - KERNEL_BASE) >> 20); |
ram_size = KERNEL_VM_BASE - KERNEL_BASE; |
memory_size = KERNEL_VM_BASE - KERNEL_BASE; |
} |
} |
#endif |
#endif |
#else |
#else |
const bool mapallmem_p = false; |
const bool mapallmem_p = false; |
#endif |
#endif |
|
#endif |
|
|
|
/* Parse ramdisk info */ |
|
fdt_probe_initrd(&initrd_start, &initrd_end); |
|
|
|
/* |
|
* Populate bootconfig structure for the benefit of |
|
* dodumpsys |
|
*/ |
|
fdt_build_bootconfig(memory_start, memory_end); |
|
|
|
#ifdef __aarch64__ |
|
extern char __kernel_text[]; |
|
extern char _end[]; |
|
|
|
vaddr_t kernstart = trunc_page((vaddr_t)__kernel_text); |
|
vaddr_t kernend = round_page((vaddr_t)_end); |
|
|
|
paddr_t kernstart_phys = KERN_VTOPHYS(kernstart); |
|
paddr_t kernend_phys = KERN_VTOPHYS(kernend); |
|
|
/* Fake bootconfig structure for the benefit of pmap.c. */ |
DPRINTF("%s: kernel phys start %lx end %lx\n", __func__, kernstart_phys, kernend_phys); |
bootconfig.dramblocks = 1; |
|
bootconfig.dram[0].address = (bus_addr_t)memory_addr; |
|
bootconfig.dram[0].pages = ram_size / PAGE_SIZE; |
|
|
|
arm32_bootmem_init(bootconfig.dram[0].address, ram_size, |
fdt_add_reserved_memory_range(kernstart_phys, |
KERNEL_BASE_PHYS); |
kernend_phys - kernstart_phys); |
|
#else |
|
arm32_bootmem_init(memory_start, memory_size, KERNEL_BASE_PHYS); |
arm32_kernel_vm_init(KERNEL_VM_BASE, ARM_VECTORS_HIGH, 0, |
arm32_kernel_vm_init(KERNEL_VM_BASE, ARM_VECTORS_HIGH, 0, |
plat->devmap(), mapallmem_p); |
plat->devmap(), mapallmem_p); |
|
#endif |
|
|
DPRINTF("bootargs: %s\n", bootargs); |
DPRINTF("bootargs: %s\n", bootargs); |
|
|
parse_mi_bootargs(boot_args); |
parse_mi_bootargs(boot_args); |
|
|
#ifdef PMAP_NEED_ALLOC_POOLPAGE |
#define MAX_PHYSMEM 16 |
bp_lowgig.bp_start = memory_addr / NBPG; |
static struct boot_physmem fdt_physmem[MAX_PHYSMEM]; |
if (atop(ram_size) > bp_lowgig.bp_pages) { |
int nfdt_physmem = 0; |
arm_poolpage_vmfreelist = bp_lowgig.bp_freelist; |
struct extent_region *er; |
return initarm_common(KERNEL_VM_BASE, KERNEL_VM_SIZE, |
|
&bp_lowgig, 1); |
LIST_FOREACH(er, &fdt_memory_ext->ex_regions, er_link) { |
} |
DPRINTF(" %lx - %lx\n", er->er_start, er->er_end); |
|
struct boot_physmem *bp = &fdt_physmem[nfdt_physmem++]; |
|
|
|
KASSERT(nfdt_physmem <= MAX_PHYSMEM); |
|
bp->bp_start = atop(er->er_start); |
|
bp->bp_pages = atop(er->er_end - er->er_start); |
|
bp->bp_freelist = VM_FREELIST_DEFAULT; |
|
|
|
#ifdef _LP64 |
|
if (er->er_end > 0x100000000) |
|
bp->bp_freelist = VM_FREELIST_HIGHMEM; |
#endif |
#endif |
|
|
return initarm_common(KERNEL_VM_BASE, KERNEL_VM_SIZE, NULL, 0); |
#ifdef PMAP_NEED_ALLOC_POOLPAGE |
|
if (atop(memory_size) > bp->bp_pages) { |
|
arm_poolpage_vmfreelist = VM_FREELIST_DIRECTMAP; |
|
bp->bp_freelist = VM_FREELIST_DIRECTMAP; |
|
} |
|
#endif |
|
} |
|
|
|
return initarm_common(KERNEL_VM_BASE, KERNEL_VM_SIZE, fdt_physmem, |
|
nfdt_physmem); |
} |
} |
|
|
static void |
static void |
|
|
|
|
cons->consinit(&faa, uart_freq); |
cons->consinit(&faa, uart_freq); |
|
|
|
#if NUKBD > 0 |
|
ukbd_cnattach(); /* allow USB keyboard to become console */ |
|
#endif |
|
|
initialized = true; |
initialized = true; |
} |
} |
|
|
Line 360 fdt_device_register(device_t self, void |
|
Line 592 fdt_device_register(device_t self, void |
|
{ |
{ |
const struct arm_platform *plat = arm_fdt_platform(); |
const struct arm_platform *plat = arm_fdt_platform(); |
|
|
|
if (device_is_a(self, "armfdt")) |
|
fdt_setup_initrd(); |
|
|
if (plat && plat->device_register) |
if (plat && plat->device_register) |
plat->device_register(self, aux); |
plat->device_register(self, aux); |
} |
} |