Home | History | Annotate | Line # | Download | only in arm32
machdep.h revision 1.26
      1 /* $NetBSD: machdep.h,v 1.26 2018/08/05 06:48:50 skrll Exp $ */
      2 
      3 #ifndef _ARM32_MACHDEP_H_
      4 #define _ARM32_MACHDEP_H_
      5 
      6 /* Define various stack sizes in pages */
      7 #ifndef IRQ_STACK_SIZE
      8 #define IRQ_STACK_SIZE	1
      9 #endif
     10 #ifndef ABT_STACK_SIZE
     11 #define ABT_STACK_SIZE	1
     12 #endif
     13 #ifndef UND_STACK_SIZE
     14 #define UND_STACK_SIZE	1
     15 #endif
     16 #ifndef FIQ_STACK_SIZE
     17 #define FIQ_STACK_SIZE	1
     18 #endif
     19 
     20 extern void (*cpu_reset_address)(void);
     21 extern paddr_t cpu_reset_address_paddr;
     22 
     23 extern void (*cpu_powerdown_address)(void);
     24 
     25 extern u_int data_abort_handler_address;
     26 extern u_int prefetch_abort_handler_address;
     27 // extern u_int undefined_handler_address;
     28 #define	undefined_handler_address (curcpu()->ci_undefsave[2])
     29 
     30 struct bootmem_info {
     31 	paddr_t bmi_start;
     32 	paddr_t bmi_kernelstart;
     33 	paddr_t bmi_kernelend;
     34 	paddr_t bmi_end;
     35 	pv_addrqh_t bmi_freechunks;
     36 	pv_addrqh_t bmi_chunks;		/* sorted list of memory to be mapped */
     37 	pv_addr_t bmi_freeblocks[4];
     38 	/*
     39 	 * These need to be static for pmap's kernel_pt list.
     40 	 */
     41 	pv_addr_t bmi_vector_l2pt;
     42 	pv_addr_t bmi_io_l2pt;
     43 	pv_addr_t bmi_l2pts[32];	// for large memory disks.
     44 	u_int bmi_freepages;
     45 	u_int bmi_nfreeblocks;
     46 };
     47 
     48 extern struct bootmem_info bootmem_info;
     49 
     50 extern char *booted_kernel;
     51 
     52 extern volatile uint32_t arm_cpu_hatched;
     53 extern volatile uint32_t arm_cpu_mbox;
     54 extern u_int arm_cpu_max;
     55 extern u_long kern_vtopdiff;
     56 
     57 
     58 /* misc prototypes used by the many arm machdeps */
     59 void cortex_pmc_ccnt_init(void);
     60 void cpu_hatch(struct cpu_info *, cpuid_t, void (*)(struct cpu_info *));
     61 void halt(void);
     62 void parse_mi_bootargs(char *);
     63 void data_abort_handler(trapframe_t *);
     64 void prefetch_abort_handler(trapframe_t *);
     65 void undefinedinstruction_bounce(trapframe_t *);
     66 void dumpsys(void);
     67 
     68 /*
     69  * note that we use void * as all the platforms have different ideas on what
     70  * the structure is
     71  */
     72 u_int initarm(void *);
     73 struct pmap_devmap;
     74 struct boot_physmem;
     75 
     76 static inline paddr_t
     77 aarch32_kern_vtophys(vaddr_t va)
     78 {
     79 	return va - kern_vtopdiff;
     80 }
     81 
     82 static inline vaddr_t
     83 aarch32_kern_phystov(paddr_t pa)
     84 {
     85 	return pa + kern_vtopdiff;
     86 }
     87 
     88 #define KERN_VTOPHYS(va)	aarch32_kern_vtophys(va)
     89 #define KERN_PHYSTOV(pa)	aarch32_kern_phystov(pa)
     90 
     91 void cpu_kernel_vm_init(paddr_t, psize_t);
     92 
     93 void arm32_bootmem_init(paddr_t memstart, psize_t memsize, paddr_t kernelstart);
     94 void arm32_kernel_vm_init(vaddr_t kvm_base, vaddr_t vectors,
     95 	vaddr_t iovbase /* (can be zero) */,
     96 	const struct pmap_devmap *devmap, bool mapallmem_p);
     97 vaddr_t initarm_common(vaddr_t kvm_base, vsize_t kvm_size,
     98         const struct boot_physmem *bp, size_t nbp);
     99 
    100 
    101 /* from arm/arm32/intr.c */
    102 void dosoftints(void);
    103 void set_spl_masks(void);
    104 #ifdef DIAGNOSTIC
    105 void dump_spl_masks(void);
    106 #endif
    107 #endif
    108