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