version 1.13, 2017/08/24 11:33:28 |
version 1.17, 2017/12/13 00:22:24 |
Line 36 __KERNEL_RCSID(0, "$NetBSD$"); |
|
Line 36 __KERNEL_RCSID(0, "$NetBSD$"); |
|
#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 71 __KERNEL_RCSID(0, "$NetBSD$"); |
|
Line 73 __KERNEL_RCSID(0, "$NetBSD$"); |
|
|
|
#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 |
#ifdef MEMORY_DISK_DYNAMIC |
#include <dev/md.h> |
#include <dev/md.h> |
#endif |
#endif |
Line 102 static void fdt_device_register(device_t |
|
Line 108 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 struct boot_physmem bp_lowgig = { |
|
.bp_pages = (KERNEL_VM_BASE - KERNEL_BASE) / NBPG, |
|
.bp_freelist = VM_FREELIST_ISADMA, |
|
.bp_flags = 0 |
|
}; |
|
#endif |
|
|
|
#ifdef VERBOSE_INIT_ARM |
#ifdef VERBOSE_INIT_ARM |
static void |
static void |
fdt_putchar(char c) |
fdt_putchar(char c) |
Line 177 fdt_get_memory(uint64_t *paddr, uint64_t |
|
Line 175 fdt_get_memory(uint64_t *paddr, uint64_t |
|
} |
} |
} |
} |
|
|
static void |
void |
fdt_add_reserved_memory_range(uint64_t addr, uint64_t size) |
fdt_add_reserved_memory_range(uint64_t addr, uint64_t size) |
{ |
{ |
int error; |
int error; |
Line 228 fdt_build_bootconfig(uint64_t mem_addr, |
|
Line 226 fdt_build_bootconfig(uint64_t mem_addr, |
|
struct extent_region *er; |
struct extent_region *er; |
uint64_t addr, size; |
uint64_t addr, size; |
int index, error; |
int index, error; |
|
|
fdt_memory_ext = extent_create("FDT Memory", mem_addr, max_addr, |
fdt_memory_ext = extent_create("FDT Memory", mem_addr, max_addr, |
fdt_memory_ext_storage, sizeof(fdt_memory_ext_storage), EX_EARLY); |
fdt_memory_ext_storage, sizeof(fdt_memory_ext_storage), EX_EARLY); |
|
|
Line 366 initarm(void *arg) |
|
Line 364 initarm(void *arg) |
|
DPRINT(" devmap"); |
DPRINT(" devmap"); |
pmap_devmap_register(plat->devmap()); |
pmap_devmap_register(plat->devmap()); |
|
|
DPRINT(" bootstrap"); |
|
plat->bootstrap(); |
|
|
|
/* Heads up ... Setup the CPU / MMU / TLB functions. */ |
/* Heads up ... Setup the CPU / MMU / TLB functions. */ |
DPRINT(" cpufunc"); |
DPRINT(" cpufunc"); |
if (set_cpufuncs()) |
if (set_cpufuncs()) |
panic("cpu not recognized!"); |
panic("cpu not recognized!"); |
|
|
|
DPRINT(" bootstrap"); |
|
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. |
Line 422 initarm(void *arg) |
|
Line 420 initarm(void *arg) |
|
#ifndef PMAP_NEED_ALLOC_POOLPAGE |
#ifndef PMAP_NEED_ALLOC_POOLPAGE |
if (memory_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) (memory_size >> 20), |
__func__, (unsigned long) (memory_size >> 20), |
(KERNEL_VM_BASE - KERNEL_BASE) >> 20); |
(KERNEL_VM_BASE - KERNEL_BASE) >> 20); |
memory_size = KERNEL_VM_BASE - KERNEL_BASE; |
memory_size = KERNEL_VM_BASE - KERNEL_BASE; |
} |
} |
Line 434 initarm(void *arg) |
|
Line 432 initarm(void *arg) |
|
/* Parse ramdisk info */ |
/* Parse ramdisk info */ |
fdt_probe_initrd(&initrd_start, &initrd_end); |
fdt_probe_initrd(&initrd_start, &initrd_end); |
|
|
/* Populate bootconfig structure for the benefit of pmap.c. */ |
/* |
|
* Populate bootconfig structure for the benefit of |
|
* dodumpsys |
|
*/ |
fdt_build_bootconfig(memory_addr, memory_size); |
fdt_build_bootconfig(memory_addr, memory_size); |
|
|
arm32_bootmem_init(bootconfig.dram[0].address, memory_size, |
arm32_bootmem_init(memory_addr, memory_size, KERNEL_BASE_PHYS); |
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); |
|
|
Line 446 initarm(void *arg) |
|
Line 446 initarm(void *arg) |
|
|
|
parse_mi_bootargs(boot_args); |
parse_mi_bootargs(boot_args); |
|
|
|
#define MAX_PHYSMEM 16 |
|
static struct boot_physmem fdt_physmem[MAX_PHYSMEM]; |
|
int nfdt_physmem = 0; |
|
struct extent_region *er; |
|
|
|
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 PMAP_NEED_ALLOC_POOLPAGE |
#ifdef PMAP_NEED_ALLOC_POOLPAGE |
bp_lowgig.bp_start = memory_addr / NBPG; |
if (atop(memory_size) > bp->bp_pages) { |
if (atop(ram_size) > bp_lowgig.bp_pages) { |
arm_poolpage_vmfreelist = VM_FREELIST_DIRECTMAP; |
arm_poolpage_vmfreelist = bp_lowgig.bp_freelist; |
bp->bp_freelist = VM_FREELIST_DIRECTMAP; |
return initarm_common(KERNEL_VM_BASE, KERNEL_VM_SIZE, |
} |
&bp_lowgig, 1); |
|
} |
|
#endif |
#endif |
|
} |
|
|
return initarm_common(KERNEL_VM_BASE, KERNEL_VM_SIZE, NULL, 0); |
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; |
} |
} |
|
|