// SPDX-License-Identifier: GPL-2.0 /* * fsl-mc object allocator driver * * Copyright (C) 2013-2016 Freescale Semiconductor, Inc. * */ #include <linux/module.h> #include <linux/msi.h> #include <linux/fsl/mc.h> #include "fsl-mc-private.h" static bool __must_check fsl_mc_is_allocatable(struct fsl_mc_device *mc_dev) { … } /** * fsl_mc_resource_pool_add_device - add allocatable object to a resource * pool of a given fsl-mc bus * * @mc_bus: pointer to the fsl-mc bus * @pool_type: pool type * @mc_dev: pointer to allocatable fsl-mc device */ static int __must_check fsl_mc_resource_pool_add_device(struct fsl_mc_bus *mc_bus, enum fsl_mc_pool_type pool_type, struct fsl_mc_device *mc_dev) { … } /** * fsl_mc_resource_pool_remove_device - remove an allocatable device from a * resource pool * * @mc_dev: pointer to allocatable fsl-mc device * * It permanently removes an allocatable fsl-mc device from the resource * pool. It's an error if the device is in use. */ static int __must_check fsl_mc_resource_pool_remove_device(struct fsl_mc_device *mc_dev) { … } static const char *const fsl_mc_pool_type_strings[] = …; static int __must_check object_type_to_pool_type(const char *object_type, enum fsl_mc_pool_type *pool_type) { … } int __must_check fsl_mc_resource_allocate(struct fsl_mc_bus *mc_bus, enum fsl_mc_pool_type pool_type, struct fsl_mc_resource **new_resource) { … } EXPORT_SYMBOL_GPL(…); void fsl_mc_resource_free(struct fsl_mc_resource *resource) { … } EXPORT_SYMBOL_GPL(…); /** * fsl_mc_object_allocate - Allocates an fsl-mc object of the given * pool type from a given fsl-mc bus instance * * @mc_dev: fsl-mc device which is used in conjunction with the * allocated object * @pool_type: pool type * @new_mc_adev: pointer to area where the pointer to the allocated device * is to be returned * * Allocatable objects are always used in conjunction with some functional * device. This function allocates an object of the specified type from * the DPRC containing the functional device. * * NOTE: pool_type must be different from FSL_MC_POOL_MCP, since MC * portals are allocated using fsl_mc_portal_allocate(), instead of * this function. */ int __must_check fsl_mc_object_allocate(struct fsl_mc_device *mc_dev, enum fsl_mc_pool_type pool_type, struct fsl_mc_device **new_mc_adev) { … } EXPORT_SYMBOL_GPL(…); /** * fsl_mc_object_free - Returns an fsl-mc object to the resource * pool where it came from. * @mc_adev: Pointer to the fsl-mc device */ void fsl_mc_object_free(struct fsl_mc_device *mc_adev) { … } EXPORT_SYMBOL_GPL(…); /* * A DPRC and the devices in the DPRC all share the same GIC-ITS device * ID. A block of IRQs is pre-allocated and maintained in a pool * from which devices can allocate them when needed. */ /* * Initialize the interrupt pool associated with an fsl-mc bus. * It allocates a block of IRQs from the GIC-ITS. */ int fsl_mc_populate_irq_pool(struct fsl_mc_device *mc_bus_dev, unsigned int irq_count) { … } EXPORT_SYMBOL_GPL(…); /* * Teardown the interrupt pool associated with an fsl-mc bus. * It frees the IRQs that were allocated to the pool, back to the GIC-ITS. */ void fsl_mc_cleanup_irq_pool(struct fsl_mc_device *mc_bus_dev) { … } EXPORT_SYMBOL_GPL(…); /* * Allocate the IRQs required by a given fsl-mc device. */ int __must_check fsl_mc_allocate_irqs(struct fsl_mc_device *mc_dev) { … } EXPORT_SYMBOL_GPL(…); /* * Frees the IRQs that were allocated for an fsl-mc device. */ void fsl_mc_free_irqs(struct fsl_mc_device *mc_dev) { … } EXPORT_SYMBOL_GPL(…); void fsl_mc_init_all_resource_pools(struct fsl_mc_device *mc_bus_dev) { … } static void fsl_mc_cleanup_resource_pool(struct fsl_mc_device *mc_bus_dev, enum fsl_mc_pool_type pool_type) { … } void fsl_mc_cleanup_all_resource_pools(struct fsl_mc_device *mc_bus_dev) { … } /* * fsl_mc_allocator_probe - callback invoked when an allocatable device is * being added to the system */ static int fsl_mc_allocator_probe(struct fsl_mc_device *mc_dev) { … } /* * fsl_mc_allocator_remove - callback invoked when an allocatable device is * being removed from the system */ static void fsl_mc_allocator_remove(struct fsl_mc_device *mc_dev) { … } static const struct fsl_mc_device_id match_id_table[] = …; static struct fsl_mc_driver fsl_mc_allocator_driver = …; int __init fsl_mc_allocator_driver_init(void) { … } void fsl_mc_allocator_driver_exit(void) { … }