xref: /freebsd/usr.sbin/bhyve/aarch64/fdt.h (revision 014d7082a2398ec39e76b5f7b1f842fc9be6c51e)
1eaff4c4fSMark Johnston /*-
2eaff4c4fSMark Johnston  * SPDX-License-Identifier: BSD-2-Clause
3eaff4c4fSMark Johnston  *
4eaff4c4fSMark Johnston  * Copyright (c) 2022 The FreeBSD Foundation
5eaff4c4fSMark Johnston  *
6eaff4c4fSMark Johnston  * This software was developed by Andrew Turner under sponsorship from
7eaff4c4fSMark Johnston  * the FreeBSD Foundation.
8eaff4c4fSMark Johnston  *
9eaff4c4fSMark Johnston  * Redistribution and use in source and binary forms, with or without
10eaff4c4fSMark Johnston  * modification, are permitted provided that the following conditions
11eaff4c4fSMark Johnston  * are met:
12eaff4c4fSMark Johnston  * 1. Redistributions of source code must retain the above copyright
13eaff4c4fSMark Johnston  *    notice, this list of conditions and the following disclaimer.
14eaff4c4fSMark Johnston  * 2. Redistributions in binary form must reproduce the above copyright
15eaff4c4fSMark Johnston  *    notice, this list of conditions and the following disclaimer in the
16eaff4c4fSMark Johnston  *    documentation and/or other materials provided with the distribution.
17eaff4c4fSMark Johnston  *
18eaff4c4fSMark Johnston  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19eaff4c4fSMark Johnston  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20eaff4c4fSMark Johnston  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21eaff4c4fSMark Johnston  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22eaff4c4fSMark Johnston  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23eaff4c4fSMark Johnston  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24eaff4c4fSMark Johnston  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25eaff4c4fSMark Johnston  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26eaff4c4fSMark Johnston  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27eaff4c4fSMark Johnston  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28eaff4c4fSMark Johnston  * SUCH DAMAGE.
29eaff4c4fSMark Johnston  */
30eaff4c4fSMark Johnston 
31eaff4c4fSMark Johnston #ifndef _FDT_H_
32eaff4c4fSMark Johnston #define	_FDT_H_
33eaff4c4fSMark Johnston 
34eaff4c4fSMark Johnston #include <sys/types.h>
35eaff4c4fSMark Johnston 
36eaff4c4fSMark Johnston struct vmctx;
37eaff4c4fSMark Johnston 
38eaff4c4fSMark Johnston int	fdt_init(struct vmctx *ctx, int ncpu, vm_paddr_t addrp,
39eaff4c4fSMark Johnston 	    vm_size_t size);
40eaff4c4fSMark Johnston void	fdt_add_gic(uint64_t dist_base, uint64_t dist_size,
41eaff4c4fSMark Johnston 	    uint64_t redist_base, uint64_t redist_size);
42eaff4c4fSMark Johnston void	fdt_add_timer(void);
430efad4acSJessica Clarke void	fdt_add_pcie(int intrs[static 4]);
44eaff4c4fSMark Johnston void	fdt_add_uart(uint64_t uart_base, uint64_t uart_size, int intr);
45*014d7082SJessica Clarke void	fdt_add_rtc(uint64_t rtc_base, uint64_t rtc_size, int intr);
46eaff4c4fSMark Johnston void	fdt_finalize(void);
47eaff4c4fSMark Johnston 
48eaff4c4fSMark Johnston #endif	/* _FDT_H_ */
49