linux/drivers/bus/fsl-mc/fsl-mc-bus.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Freescale Management Complex (MC) bus driver
 *
 * Copyright (C) 2014-2016 Freescale Semiconductor, Inc.
 * Copyright 2019-2020 NXP
 * Author: German Rivera <[email protected]>
 *
 */

#define pr_fmt(fmt)

#include <linux/module.h>
#include <linux/of_device.h>
#include <linux/of_address.h>
#include <linux/ioport.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/limits.h>
#include <linux/bitops.h>
#include <linux/dma-mapping.h>
#include <linux/acpi.h>
#include <linux/iommu.h>
#include <linux/dma-map-ops.h>

#include "fsl-mc-private.h"

/*
 * Default DMA mask for devices on a fsl-mc bus
 */
#define FSL_MC_DEFAULT_DMA_MASK

static struct fsl_mc_version mc_version;

/**
 * struct fsl_mc - Private data of a "fsl,qoriq-mc" platform device
 * @root_mc_bus_dev: fsl-mc device representing the root DPRC
 * @num_translation_ranges: number of entries in addr_translation_ranges
 * @translation_ranges: array of bus to system address translation ranges
 * @fsl_mc_regs: base address of register bank
 */
struct fsl_mc {};

/**
 * struct fsl_mc_addr_translation_range - bus to system address translation
 * range
 * @mc_region_type: Type of MC region for the range being translated
 * @start_mc_offset: Start MC offset of the range being translated
 * @end_mc_offset: MC offset of the first byte after the range (last MC
 * offset of the range is end_mc_offset - 1)
 * @start_phys_addr: system physical address corresponding to start_mc_addr
 */
struct fsl_mc_addr_translation_range {};

#define FSL_MC_GCR1
#define GCR1_P1_STOP
#define GCR1_P2_STOP

#define FSL_MC_FAPR
#define MC_FAPR_PL
#define MC_FAPR_BMT

static phys_addr_t mc_portal_base_phys_addr;

/**
 * fsl_mc_bus_match - device to driver matching callback
 * @dev: the fsl-mc device to match against
 * @drv: the device driver to search for matching fsl-mc object type
 * structures
 *
 * Returns 1 on success, 0 otherwise.
 */
static int fsl_mc_bus_match(struct device *dev, const struct device_driver *drv)
{}

/*
 * fsl_mc_bus_uevent - callback invoked when a device is added
 */
static int fsl_mc_bus_uevent(const struct device *dev, struct kobj_uevent_env *env)
{}

static int fsl_mc_dma_configure(struct device *dev)
{}

static void fsl_mc_dma_cleanup(struct device *dev)
{}

static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
			     char *buf)
{}
static DEVICE_ATTR_RO(modalias);

static ssize_t driver_override_store(struct device *dev,
				     struct device_attribute *attr,
				     const char *buf, size_t count)
{}

static ssize_t driver_override_show(struct device *dev,
				    struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RW(driver_override);

static struct attribute *fsl_mc_dev_attrs[] =;

ATTRIBUTE_GROUPS();

static int scan_fsl_mc_bus(struct device *dev, void *data)
{}

static ssize_t rescan_store(const struct bus_type *bus,
			    const char *buf, size_t count)
{}
static BUS_ATTR_WO(rescan);

static int fsl_mc_bus_set_autorescan(struct device *dev, void *data)
{}

static int fsl_mc_bus_get_autorescan(struct device *dev, void *data)
{}

static ssize_t autorescan_store(const struct bus_type *bus,
				const char *buf, size_t count)
{}

static ssize_t autorescan_show(const struct bus_type *bus, char *buf)
{}

static BUS_ATTR_RW(autorescan);

static struct attribute *fsl_mc_bus_attrs[] =;

ATTRIBUTE_GROUPS();

struct bus_type fsl_mc_bus_type =;
EXPORT_SYMBOL_GPL();

struct device_type fsl_mc_bus_dprc_type =;
EXPORT_SYMBOL_GPL();

struct device_type fsl_mc_bus_dpni_type =;
EXPORT_SYMBOL_GPL();

struct device_type fsl_mc_bus_dpio_type =;
EXPORT_SYMBOL_GPL();

struct device_type fsl_mc_bus_dpsw_type =;
EXPORT_SYMBOL_GPL();

struct device_type fsl_mc_bus_dpbp_type =;
EXPORT_SYMBOL_GPL();

struct device_type fsl_mc_bus_dpcon_type =;
EXPORT_SYMBOL_GPL();

struct device_type fsl_mc_bus_dpmcp_type =;
EXPORT_SYMBOL_GPL();

struct device_type fsl_mc_bus_dpmac_type =;
EXPORT_SYMBOL_GPL();

struct device_type fsl_mc_bus_dprtc_type =;
EXPORT_SYMBOL_GPL();

struct device_type fsl_mc_bus_dpseci_type =;
EXPORT_SYMBOL_GPL();

struct device_type fsl_mc_bus_dpdmux_type =;
EXPORT_SYMBOL_GPL();

struct device_type fsl_mc_bus_dpdcei_type =;
EXPORT_SYMBOL_GPL();

struct device_type fsl_mc_bus_dpaiop_type =;
EXPORT_SYMBOL_GPL();

struct device_type fsl_mc_bus_dpci_type =;
EXPORT_SYMBOL_GPL();

struct device_type fsl_mc_bus_dpdmai_type =;
EXPORT_SYMBOL_GPL();

struct device_type fsl_mc_bus_dpdbg_type =;
EXPORT_SYMBOL_GPL();

static struct device_type *fsl_mc_get_device_type(const char *type)
{}

static int fsl_mc_driver_probe(struct device *dev)
{}

static int fsl_mc_driver_remove(struct device *dev)
{}

static void fsl_mc_driver_shutdown(struct device *dev)
{}

/*
 * __fsl_mc_driver_register - registers a child device driver with the
 * MC bus
 *
 * This function is implicitly invoked from the registration function of
 * fsl_mc device drivers, which is generated by the
 * module_fsl_mc_driver() macro.
 */
int __fsl_mc_driver_register(struct fsl_mc_driver *mc_driver,
			     struct module *owner)
{}
EXPORT_SYMBOL_GPL();

/*
 * fsl_mc_driver_unregister - unregisters a device driver from the
 * MC bus
 */
void fsl_mc_driver_unregister(struct fsl_mc_driver *mc_driver)
{}
EXPORT_SYMBOL_GPL();

/**
 * mc_get_version() - Retrieves the Management Complex firmware
 *			version information
 * @mc_io:		Pointer to opaque I/O object
 * @cmd_flags:		Command flags; one or more of 'MC_CMD_FLAG_'
 * @mc_ver_info:	Returned version information structure
 *
 * Return:	'0' on Success; Error code otherwise.
 */
static int mc_get_version(struct fsl_mc_io *mc_io,
			  u32 cmd_flags,
			  struct fsl_mc_version *mc_ver_info)
{}

/**
 * fsl_mc_get_version - function to retrieve the MC f/w version information
 *
 * Return:	mc version when called after fsl-mc-bus probe; NULL otherwise.
 */
struct fsl_mc_version *fsl_mc_get_version(void)
{}
EXPORT_SYMBOL_GPL();

/*
 * fsl_mc_get_root_dprc - function to traverse to the root dprc
 */
void fsl_mc_get_root_dprc(struct device *dev,
			 struct device **root_dprc_dev)
{}

static int get_dprc_attr(struct fsl_mc_io *mc_io,
			 int container_id, struct dprc_attributes *attr)
{}

static int get_dprc_icid(struct fsl_mc_io *mc_io,
			 int container_id, u32 *icid)
{}

static int translate_mc_addr(struct fsl_mc_device *mc_dev,
			     enum dprc_region_type mc_region_type,
			     u64 mc_offset, phys_addr_t *phys_addr)
{}

static int fsl_mc_device_get_mmio_regions(struct fsl_mc_device *mc_dev,
					  struct fsl_mc_device *mc_bus_dev)
{}

/*
 * fsl_mc_is_root_dprc - function to check if a given device is a root dprc
 */
bool fsl_mc_is_root_dprc(struct device *dev)
{}

static void fsl_mc_device_release(struct device *dev)
{}

/*
 * Add a newly discovered fsl-mc device to be visible in Linux
 */
int fsl_mc_device_add(struct fsl_mc_obj_desc *obj_desc,
		      struct fsl_mc_io *mc_io,
		      struct device *parent_dev,
		      struct fsl_mc_device **new_mc_dev)
{}
EXPORT_SYMBOL_GPL();

static struct notifier_block fsl_mc_nb;

/**
 * fsl_mc_device_remove - Remove an fsl-mc device from being visible to
 * Linux
 *
 * @mc_dev: Pointer to an fsl-mc device
 */
void fsl_mc_device_remove(struct fsl_mc_device *mc_dev)
{}
EXPORT_SYMBOL_GPL();

struct fsl_mc_device *fsl_mc_get_endpoint(struct fsl_mc_device *mc_dev,
					  u16 if_id)
{}
EXPORT_SYMBOL_GPL();

static int get_mc_addr_translation_ranges(struct device *dev,
					  struct fsl_mc_addr_translation_range
						**ranges,
					  u8 *num_ranges)
{}

/*
 * fsl_mc_bus_probe - callback invoked when the root MC bus is being
 * added
 */
static int fsl_mc_bus_probe(struct platform_device *pdev)
{}

/*
 * fsl_mc_bus_remove - callback invoked when the root MC bus is being
 * removed
 */
static void fsl_mc_bus_remove(struct platform_device *pdev)
{}

static const struct of_device_id fsl_mc_bus_match_table[] =;

MODULE_DEVICE_TABLE(of, fsl_mc_bus_match_table);

static const struct acpi_device_id fsl_mc_bus_acpi_match_table[] =;
MODULE_DEVICE_TABLE(acpi, fsl_mc_bus_acpi_match_table);

static struct platform_driver fsl_mc_bus_driver =;

static int fsl_mc_bus_notifier(struct notifier_block *nb,
			       unsigned long action, void *data)
{}

static struct notifier_block fsl_mc_nb =;

static int __init fsl_mc_bus_driver_init(void)
{}
postcore_initcall(fsl_mc_bus_driver_init);