#define pr_fmt(fmt) …
#include <linux/atomic.h>
#include <linux/bitfield.h>
#include <linux/bitops.h>
#include <linux/io-pgtable.h>
#include <linux/kernel.h>
#include <linux/sizes.h>
#include <linux/slab.h>
#include <linux/types.h>
#include <asm/barrier.h>
#include "iommu-pages.h"
#define DART1_MAX_ADDR_BITS …
#define DART_MAX_TABLES …
#define DART_LEVELS …
#define io_pgtable_to_data(x) …
#define io_pgtable_ops_to_data(x) …
#define DART_GRANULE(d) …
#define DART_PTES_PER_TABLE(d) …
#define APPLE_DART_PTE_SUBPAGE_START …
#define APPLE_DART_PTE_SUBPAGE_END …
#define APPLE_DART1_PADDR_MASK …
#define APPLE_DART2_PADDR_MASK …
#define APPLE_DART2_PADDR_SHIFT …
#define APPLE_DART1_PTE_PROT_NO_READ …
#define APPLE_DART1_PTE_PROT_NO_WRITE …
#define APPLE_DART1_PTE_PROT_SP_DIS …
#define APPLE_DART2_PTE_PROT_NO_READ …
#define APPLE_DART2_PTE_PROT_NO_WRITE …
#define APPLE_DART2_PTE_PROT_NO_CACHE …
#define APPLE_DART_PTE_VALID …
#define iopte_deref(pte, d) …
struct dart_io_pgtable { … };
dart_iopte;
static dart_iopte paddr_to_iopte(phys_addr_t paddr,
struct dart_io_pgtable *data)
{ … }
static phys_addr_t iopte_to_paddr(dart_iopte pte,
struct dart_io_pgtable *data)
{ … }
static void *__dart_alloc_pages(size_t size, gfp_t gfp)
{ … }
static int dart_init_pte(struct dart_io_pgtable *data,
unsigned long iova, phys_addr_t paddr,
dart_iopte prot, int num_entries,
dart_iopte *ptep)
{ … }
static dart_iopte dart_install_table(dart_iopte *table,
dart_iopte *ptep,
dart_iopte curr,
struct dart_io_pgtable *data)
{ … }
static int dart_get_table(struct dart_io_pgtable *data, unsigned long iova)
{ … }
static int dart_get_l1_index(struct dart_io_pgtable *data, unsigned long iova)
{ … }
static int dart_get_l2_index(struct dart_io_pgtable *data, unsigned long iova)
{ … }
static dart_iopte *dart_get_l2(struct dart_io_pgtable *data, unsigned long iova)
{ … }
static dart_iopte dart_prot_to_pte(struct dart_io_pgtable *data,
int prot)
{ … }
static int dart_map_pages(struct io_pgtable_ops *ops, unsigned long iova,
phys_addr_t paddr, size_t pgsize, size_t pgcount,
int iommu_prot, gfp_t gfp, size_t *mapped)
{ … }
static size_t dart_unmap_pages(struct io_pgtable_ops *ops, unsigned long iova,
size_t pgsize, size_t pgcount,
struct iommu_iotlb_gather *gather)
{ … }
static phys_addr_t dart_iova_to_phys(struct io_pgtable_ops *ops,
unsigned long iova)
{ … }
static struct dart_io_pgtable *
dart_alloc_pgtable(struct io_pgtable_cfg *cfg)
{ … }
static struct io_pgtable *
apple_dart_alloc_pgtable(struct io_pgtable_cfg *cfg, void *cookie)
{ … }
static void apple_dart_free_pgtable(struct io_pgtable *iop)
{ … }
struct io_pgtable_init_fns io_pgtable_apple_dart_init_fns = …;