Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/gasket/gasket_page_table.h
- This file was added.
| /* | |||||
| * Copyright (c) 2026 Abdelkader Boudih <freebsd@seuros.com> | |||||
| * | |||||
| * SPDX-License-Identifier: BSD-2-Clause | |||||
| */ | |||||
| #ifndef _DEV_GASKET_GASKET_PAGE_TABLE_H_ | |||||
| #define _DEV_GASKET_GASKET_PAGE_TABLE_H_ | |||||
| #include <sys/types.h> | |||||
| #include <sys/bus.h> | |||||
| #include <vm/vm.h> | |||||
| #include <dev/gasket/gasket.h> | |||||
| struct gasket_page_table; | |||||
| enum gasket_map_kind { | |||||
| GASKET_MAP_NONE = 0, | |||||
| GASKET_MAP_HOST, /* pinned user page, released on unmap */ | |||||
| GASKET_MAP_COHERENT, /* driver's coherent buffer, not ours to free */ | |||||
| }; | |||||
| int gasket_page_table_init(device_t dev, struct resource *csr, | |||||
| const struct gasket_page_table_config *cfg, | |||||
| struct gasket_page_table **ptp); | |||||
| void gasket_page_table_free(struct gasket_page_table *pt); | |||||
| /* On success the entries own the pages and the array is cleared. */ | |||||
| int gasket_page_table_map(struct gasket_page_table *pt, | |||||
| vm_offset_t host_addr, uint64_t dev_addr, size_t size, int prot, | |||||
| enum gasket_map_kind kind, vm_ooffset_t coh_off, vm_page_t *pages); | |||||
| int gasket_page_table_unmap(struct gasket_page_table *pt, uint64_t dev_addr, | |||||
| size_t size); | |||||
| void gasket_page_table_unmap_all(struct gasket_page_table *pt); | |||||
| int gasket_page_table_partition(struct gasket_page_table *pt, | |||||
| u_int num_simple); | |||||
| void gasket_page_table_set_coherent(struct gasket_page_table *pt, | |||||
| const vm_paddr_t *pages, u_int npages, bus_addr_t bus); | |||||
| void gasket_page_table_unmap_coherent(struct gasket_page_table *pt); | |||||
| u_int gasket_page_table_num_entries(struct gasket_page_table *pt); | |||||
| u_int gasket_page_table_num_simple_entries(struct gasket_page_table *pt); | |||||
| /* Larger than the entry count: each extended entry covers a subtable. */ | |||||
| u_int gasket_page_table_max_pages(struct gasket_page_table *pt); | |||||
| u_int gasket_page_table_num_active_pages(struct gasket_page_table *pt); | |||||
| #endif /* _DEV_GASKET_GASKET_PAGE_TABLE_H_ */ | |||||