xref: /freebsd/sys/arm64/include/machdep.h (revision 353b6a5bcb5ae6943903b38ebcc0922b059ff8b8)
1e5acd89cSAndrew Turner /*-
2e5acd89cSAndrew Turner  * Copyright (c) 2013 Andrew Turner <andrew@freebsd.org>
3e5acd89cSAndrew Turner  * All rights reserved.
4e5acd89cSAndrew Turner  *
5e5acd89cSAndrew Turner  * Redistribution and use in source and binary forms, with or without
6e5acd89cSAndrew Turner  * modification, are permitted provided that the following conditions
7e5acd89cSAndrew Turner  * are met:
8e5acd89cSAndrew Turner  * 1. Redistributions of source code must retain the above copyright
9e5acd89cSAndrew Turner  *    notice, this list of conditions and the following disclaimer.
10e5acd89cSAndrew Turner  * 2. Redistributions in binary form must reproduce the above copyright
11e5acd89cSAndrew Turner  *    notice, this list of conditions and the following disclaimer in the
12e5acd89cSAndrew Turner  *    documentation and/or other materials provided with the distribution.
13e5acd89cSAndrew Turner  *
14e5acd89cSAndrew Turner  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15e5acd89cSAndrew Turner  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16e5acd89cSAndrew Turner  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17e5acd89cSAndrew Turner  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18e5acd89cSAndrew Turner  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19e5acd89cSAndrew Turner  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20e5acd89cSAndrew Turner  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21e5acd89cSAndrew Turner  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22e5acd89cSAndrew Turner  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23e5acd89cSAndrew Turner  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24e5acd89cSAndrew Turner  * SUCH DAMAGE.
25e5acd89cSAndrew Turner  */
26e5acd89cSAndrew Turner 
27e5acd89cSAndrew Turner #ifndef _MACHINE_MACHDEP_H_
28e5acd89cSAndrew Turner #define	_MACHINE_MACHDEP_H_
29e5acd89cSAndrew Turner 
300c4be71aSAndrew Turner #ifdef _KERNEL
310c4be71aSAndrew Turner 
32e5acd89cSAndrew Turner struct arm64_bootparams {
33e5acd89cSAndrew Turner 	vm_offset_t	modulep;
34e5acd89cSAndrew Turner 	vm_offset_t	kern_stack;
35857ab36fSAndrew Turner 	vm_paddr_t	kern_ttbr0;
36d2ae03baSKyle Evans 	uint64_t	hcr_el2;
37228b87bcSAndrew Turner 	int		boot_el;	/* EL the kernel booted from */
38228b87bcSAndrew Turner 	int		pad;
39e5acd89cSAndrew Turner };
40e5acd89cSAndrew Turner 
41698c14e1SAndrew Turner enum arm64_bus {
42698c14e1SAndrew Turner 	ARM64_BUS_NONE,
43698c14e1SAndrew Turner 	ARM64_BUS_FDT,
44698c14e1SAndrew Turner 	ARM64_BUS_ACPI,
45698c14e1SAndrew Turner };
46698c14e1SAndrew Turner 
47698c14e1SAndrew Turner extern enum arm64_bus arm64_bus_method;
48698c14e1SAndrew Turner 
49992029baSJohn Baldwin void dbg_init(void);
50228b87bcSAndrew Turner bool has_hyp(void);
51*353b6a5bSAndrew Turner bool in_vhe(void);
52e5acd89cSAndrew Turner void initarm(struct arm64_bootparams *);
535641eda2SMichal Meloun vm_offset_t parse_boot_param(struct arm64_bootparams *abp);
545641eda2SMichal Meloun #ifdef FDT
555641eda2SMichal Meloun void parse_fdt_bootargs(void);
565641eda2SMichal Meloun #endif
5723e42a83SAndrew Turner int memory_mapping_mode(vm_paddr_t pa);
584d1dd74aSWojciech Macek extern void (*pagezero)(void *);
59e5acd89cSAndrew Turner 
6048ba9b26SAndrew Turner #ifdef SOCDEV_PA
6148ba9b26SAndrew Turner /*
6248ba9b26SAndrew Turner  * The virtual address SOCDEV_PA is mapped at.
6348ba9b26SAndrew Turner  * Only valid while the early pagetables are valid.
6448ba9b26SAndrew Turner  */
6548ba9b26SAndrew Turner extern uintptr_t socdev_va;
6648ba9b26SAndrew Turner #endif
6748ba9b26SAndrew Turner 
680c4be71aSAndrew Turner #endif /* _KERNEL */
690c4be71aSAndrew Turner 
70e5acd89cSAndrew Turner #endif /* _MACHINE_MACHDEP_H_ */
71