linux/drivers/soc/apple/sart.c

// SPDX-License-Identifier: GPL-2.0-only OR MIT
/*
 * Apple SART device driver
 * Copyright (C) The Asahi Linux Contributors
 *
 * Apple SART is a simple address filter for some DMA transactions.
 * Regions of physical memory must be added to the SART's allow
 * list before any DMA can target these. Unlike a proper
 * IOMMU no remapping can be done and special support in the
 * consumer driver is required since not all DMA transactions of
 * a single device are subject to SART filtering.
 */

#include <linux/soc/apple/sart.h>
#include <linux/atomic.h>
#include <linux/bits.h>
#include <linux/bitfield.h>
#include <linux/device.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/types.h>

#define APPLE_SART_MAX_ENTRIES

/* This is probably a bitfield but the exact meaning of each bit is unknown. */
#define APPLE_SART_FLAGS_ALLOW

/* SARTv2 registers */
#define APPLE_SART2_CONFIG(idx)
#define APPLE_SART2_CONFIG_FLAGS
#define APPLE_SART2_CONFIG_SIZE
#define APPLE_SART2_CONFIG_SIZE_SHIFT
#define APPLE_SART2_CONFIG_SIZE_MAX

#define APPLE_SART2_PADDR(idx)
#define APPLE_SART2_PADDR_SHIFT

/* SARTv3 registers */
#define APPLE_SART3_CONFIG(idx)

#define APPLE_SART3_PADDR(idx)
#define APPLE_SART3_PADDR_SHIFT

#define APPLE_SART3_SIZE(idx)
#define APPLE_SART3_SIZE_SHIFT
#define APPLE_SART3_SIZE_MAX

struct apple_sart_ops {};

struct apple_sart {};

static void sart2_get_entry(struct apple_sart *sart, int index, u8 *flags,
			    phys_addr_t *paddr, size_t *size)
{}

static void sart2_set_entry(struct apple_sart *sart, int index, u8 flags,
			    phys_addr_t paddr_shifted, size_t size_shifted)
{}

static struct apple_sart_ops sart_ops_v2 =;

static void sart3_get_entry(struct apple_sart *sart, int index, u8 *flags,
			    phys_addr_t *paddr, size_t *size)
{}

static void sart3_set_entry(struct apple_sart *sart, int index, u8 flags,
			    phys_addr_t paddr_shifted, size_t size_shifted)
{}

static struct apple_sart_ops sart_ops_v3 =;

static int apple_sart_probe(struct platform_device *pdev)
{}

static void apple_sart_put_device(void *dev)
{}

struct apple_sart *devm_apple_sart_get(struct device *dev)
{}
EXPORT_SYMBOL_GPL();

static int sart_set_entry(struct apple_sart *sart, int index, u8 flags,
			  phys_addr_t paddr, size_t size)
{}

int apple_sart_add_allowed_region(struct apple_sart *sart, phys_addr_t paddr,
				  size_t size)
{}
EXPORT_SYMBOL_GPL();

int apple_sart_remove_allowed_region(struct apple_sart *sart, phys_addr_t paddr,
				     size_t size)
{}
EXPORT_SYMBOL_GPL();

static void apple_sart_shutdown(struct platform_device *pdev)
{}

static const struct of_device_id apple_sart_of_match[] =;
MODULE_DEVICE_TABLE(of, apple_sart_of_match);

static struct platform_driver apple_sart_driver =;
module_platform_driver();

MODULE_LICENSE();
MODULE_AUTHOR();
MODULE_DESCRIPTION();