xref: /netbsd/sys/arch/arm/include/arm32/machdep.h (revision 8e0436a0)
1 /* $NetBSD: machdep.h,v 1.15 2012/09/01 12:05:09 martin Exp $ */
2 
3 #ifndef _ARM32_BOOT_MACHDEP_H_
4 #define _ARM32_BOOT_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 #ifdef IPKDB
15 #define UND_STACK_SIZE	2
16 #else
17 #define UND_STACK_SIZE	1
18 #endif
19 #endif
20 #ifndef FIQ_STACK_SIZE
21 #define FIQ_STACK_SIZE	1
22 #endif
23 
24 
25 extern void (*cpu_reset_address)(void);
26 extern paddr_t cpu_reset_address_paddr;
27 
28 extern u_int data_abort_handler_address;
29 extern u_int prefetch_abort_handler_address;
30 // extern u_int undefined_handler_address;
31 #define	undefined_handler_address (curcpu()->ci_undefsave[2])
32 
33 /*
34  * Physical / virtual address structure. In a number of places (particularly
35  * during bootstrapping) we need to keep track of the physical and virtual
36  * addresses of various pages
37  */
38 typedef struct pv_addr {
39 	SLIST_ENTRY(pv_addr) pv_list;
40 	paddr_t pv_pa;
41 	vaddr_t pv_va;
42 	vsize_t pv_size;
43 	uint8_t pv_cache;
44 	uint8_t pv_prot;
45 } pv_addr_t;
46 typedef SLIST_HEAD(, pv_addr) pv_addrqh_t;
47 
48 struct bootmem_info {
49 	paddr_t bmi_start;
50 	paddr_t bmi_kernelstart;
51 	paddr_t bmi_kernelend;
52 	paddr_t bmi_end;
53 	pv_addrqh_t bmi_freechunks;
54 	pv_addrqh_t bmi_chunks;		/* sorted list of memory to be mapped */
55 	pv_addr_t bmi_freeblocks[4];
56 	/*
57 	 * These need to be static for pmap's kernel_pt list.
58 	 */
59 	pv_addr_t bmi_vector_l2pt;
60 	pv_addr_t bmi_io_l2pt;
61 	pv_addr_t bmi_l2pts[16];
62 	u_int bmi_freepages;
63 	u_int bmi_nfreeblocks;
64 };
65 
66 extern struct bootmem_info bootmem_info;
67 
68 extern char *booted_kernel;
69 
70 extern volatile uint32_t arm_cpu_hatched;
71 extern uint32_t arm_cpu_mbox;
72 extern u_int arm_cpu_max;
73 
74 /* misc prototypes used by the many arm machdeps */
75 void cortex_pmc_ccnt_init(void);
76 void cpu_hatch(struct cpu_info *, cpuid_t, void (*)(struct cpu_info *));
77 void halt(void);
78 void parse_mi_bootargs(char *);
79 void data_abort_handler(trapframe_t *);
80 void prefetch_abort_handler(trapframe_t *);
81 void undefinedinstruction_bounce(trapframe_t *);
82 void dumpsys(void);
83 
84 /*
85  * note that we use void *as all the platforms have different ideas on what
86  * the structure is
87  */
88 u_int initarm(void *);
89 struct pmap_devmap;
90 struct boot_physmem;
91 void arm32_bootmem_init(paddr_t memstart, psize_t memsize, paddr_t kernelstart);
92 void arm32_kernel_vm_init(vaddr_t kvm_base, vaddr_t vectors,
93 	vaddr_t iovbase /* (can be zero) */,
94 	const struct pmap_devmap *devmap, bool mapallmem_p);
95 vaddr_t initarm_common(vaddr_t kvm_base, vsize_t kvm_size,
96         const struct boot_physmem *bp, size_t nbp);
97 
98 
99 /* from arm/arm32/intr.c */
100 void dosoftints(void);
101 void set_spl_masks(void);
102 #ifdef DIAGNOSTIC
103 void dump_spl_masks(void);
104 #endif
105 #endif
106