linux/drivers/pci/bus.c

// SPDX-License-Identifier: GPL-2.0
/*
 * From setup-res.c, by:
 *	Dave Rusling ([email protected])
 *	David Mosberger ([email protected])
 *	David Miller ([email protected])
 *	Ivan Kokshaysky ([email protected])
 */
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/pci.h>
#include <linux/errno.h>
#include <linux/ioport.h>
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/proc_fs.h>
#include <linux/slab.h>

#include "pci.h"

void pci_add_resource_offset(struct list_head *resources, struct resource *res,
			     resource_size_t offset)
{}
EXPORT_SYMBOL();

void pci_add_resource(struct list_head *resources, struct resource *res)
{}
EXPORT_SYMBOL();

void pci_free_resource_list(struct list_head *resources)
{}
EXPORT_SYMBOL();

void pci_bus_add_resource(struct pci_bus *bus, struct resource *res,
			  unsigned int flags)
{}

struct resource *pci_bus_resource_n(const struct pci_bus *bus, int n)
{}
EXPORT_SYMBOL_GPL();

void pci_bus_remove_resource(struct pci_bus *bus, struct resource *res)
{}

void pci_bus_remove_resources(struct pci_bus *bus)
{}

int devm_request_pci_bus_resources(struct device *dev,
				   struct list_head *resources)
{}
EXPORT_SYMBOL_GPL();

static struct pci_bus_region pci_32_bit =;
#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
static struct pci_bus_region pci_64_bit =;
static struct pci_bus_region pci_high =;
#endif

/*
 * @res contains CPU addresses.  Clip it so the corresponding bus addresses
 * on @bus are entirely within @region.  This is used to control the bus
 * addresses of resources we allocate, e.g., we may need a resource that
 * can be mapped by a 32-bit BAR.
 */
static void pci_clip_resource_to_region(struct pci_bus *bus,
					struct resource *res,
					struct pci_bus_region *region)
{}

static int pci_bus_alloc_from_region(struct pci_bus *bus, struct resource *res,
		resource_size_t size, resource_size_t align,
		resource_size_t min, unsigned long type_mask,
		resource_alignf alignf,
		void *alignf_data,
		struct pci_bus_region *region)
{}

/**
 * pci_bus_alloc_resource - allocate a resource from a parent bus
 * @bus: PCI bus
 * @res: resource to allocate
 * @size: size of resource to allocate
 * @align: alignment of resource to allocate
 * @min: minimum /proc/iomem address to allocate
 * @type_mask: IORESOURCE_* type flags
 * @alignf: resource alignment function
 * @alignf_data: data argument for resource alignment function
 *
 * Given the PCI bus a device resides on, the size, minimum address,
 * alignment and type, try to find an acceptable resource allocation
 * for a specific device resource.
 */
int pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res,
		resource_size_t size, resource_size_t align,
		resource_size_t min, unsigned long type_mask,
		resource_alignf alignf,
		void *alignf_data)
{}
EXPORT_SYMBOL();

/*
 * The @idx resource of @dev should be a PCI-PCI bridge window.  If this
 * resource fits inside a window of an upstream bridge, do nothing.  If it
 * overlaps an upstream window but extends outside it, clip the resource so
 * it fits completely inside.
 */
bool pci_bus_clip_resource(struct pci_dev *dev, int idx)
{}

void __weak pcibios_resource_survey_bus(struct pci_bus *bus) {}

void __weak pcibios_bus_add_device(struct pci_dev *pdev) {}

/**
 * pci_bus_add_device - start driver for a single device
 * @dev: device to add
 *
 * This adds add sysfs entries and start device drivers
 */
void pci_bus_add_device(struct pci_dev *dev)
{}
EXPORT_SYMBOL_GPL();

/**
 * pci_bus_add_devices - start driver for PCI devices
 * @bus: bus to check for new devices
 *
 * Start driver for PCI devices and add some sysfs entries.
 */
void pci_bus_add_devices(const struct pci_bus *bus)
{}
EXPORT_SYMBOL();

static void __pci_walk_bus(struct pci_bus *top, int (*cb)(struct pci_dev *, void *),
			   void *userdata, bool locked)
{}

/**
 *  pci_walk_bus - walk devices on/under bus, calling callback.
 *  @top: bus whose devices should be walked
 *  @cb: callback to be called for each device found
 *  @userdata: arbitrary pointer to be passed to callback
 *
 *  Walk the given bus, including any bridged devices
 *  on buses under this bus.  Call the provided callback
 *  on each device found.
 *
 *  We check the return of @cb each time. If it returns anything
 *  other than 0, we break out.
 */
void pci_walk_bus(struct pci_bus *top, int (*cb)(struct pci_dev *, void *), void *userdata)
{}
EXPORT_SYMBOL_GPL();

void pci_walk_bus_locked(struct pci_bus *top, int (*cb)(struct pci_dev *, void *), void *userdata)
{}
EXPORT_SYMBOL_GPL();

struct pci_bus *pci_bus_get(struct pci_bus *bus)
{}

void pci_bus_put(struct pci_bus *bus)
{}