xref: /openbsd/sys/arch/arm64/dev/acpiiort.h (revision d89ec533)
1 /* $OpenBSD: acpiiort.h,v 1.4 2021/06/25 17:41:22 patrick Exp $ */
2 /*
3  * Copyright (c) 2021 Patrick Wildt <patrick@blueri.se>
4  *
5  * Permission to use, copy, modify, and distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16  */
17 
18 struct acpiiort_attach_args {
19 	struct acpi_iort_node	*aia_node;
20 	bus_space_tag_t		 aia_iot;
21 	bus_space_tag_t		 aia_memt;
22 	bus_dma_tag_t		 aia_dmat;
23 };
24 
25 struct acpiiort_smmu {
26 	SIMPLEQ_ENTRY(acpiiort_smmu) as_list;
27 	struct acpi_iort_node	*as_node;
28 	void			*as_cookie;
29 	bus_dma_tag_t		(*as_map)(void *, uint32_t,
30 				    bus_dma_tag_t);
31 	void			(*as_reserve)(void *, uint32_t,
32 				    bus_addr_t, bus_size_t);
33 };
34 
35 void acpiiort_smmu_register(struct acpiiort_smmu *);
36 bus_dma_tag_t acpiiort_smmu_map(struct acpi_iort_node *, uint32_t, bus_dma_tag_t);
37 void acpiiort_smmu_reserve_region(struct acpi_iort_node *, uint32_t, bus_addr_t, bus_size_t);
38 bus_dma_tag_t acpiiort_device_map(struct aml_node *, bus_dma_tag_t);
39