Release 4.13 arch/ia64/pci/pci.c
  
  
  
/*
 * pci.c - Low-Level PCI Access in IA-64
 *
 * Derived from bios32.c of i386 tree.
 *
 * (c) Copyright 2002, 2005 Hewlett-Packard Development Company, L.P.
 *      David Mosberger-Tang <davidm@hpl.hp.com>
 *      Bjorn Helgaas <bjorn.helgaas@hp.com>
 * Copyright (C) 2004 Silicon Graphics, Inc.
 *
 * Note: Above list of copyright holders is incomplete...
 */
#include <linux/acpi.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/pci.h>
#include <linux/pci-acpi.h>
#include <linux/init.h>
#include <linux/ioport.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/bootmem.h>
#include <linux/export.h>
#include <asm/machvec.h>
#include <asm/page.h>
#include <asm/io.h>
#include <asm/sal.h>
#include <asm/smp.h>
#include <asm/irq.h>
#include <asm/hw_irq.h>
/*
 * Low-level SAL-based PCI configuration access functions. Note that SAL
 * calls are already serialized (via sal_lock), so we don't need another
 * synchronization mechanism here.
 */
#define PCI_SAL_ADDRESS(seg, bus, devfn, reg)		\
	(((u64) seg << 24) | (bus << 16) | (devfn << 8) | (reg))
/* SAL 3.2 adds support for extended config space. */
#define PCI_SAL_EXT_ADDRESS(seg, bus, devfn, reg)	\
	(((u64) seg << 28) | (bus << 20) | (devfn << 12) | (reg))
int raw_pci_read(unsigned int seg, unsigned int bus, unsigned int devfn,
	      int reg, int len, u32 *value)
{
	u64 addr, data = 0;
	int mode, result;
	if (!value || (seg > 65535) || (bus > 255) || (devfn > 255) || (reg > 4095))
		return -EINVAL;
	if ((seg | reg) <= 255) {
		addr = PCI_SAL_ADDRESS(seg, bus, devfn, reg);
		mode = 0;
	} else if (sal_revision >= SAL_VERSION_CODE(3,2)) {
		addr = PCI_SAL_EXT_ADDRESS(seg, bus, devfn, reg);
		mode = 1;
	} else {
		return -EINVAL;
	}
	result = ia64_sal_pci_config_read(addr, mode, len, &data);
	if (result != 0)
		return -EINVAL;
	*value = (u32) data;
	return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| David Mosberger-Tang | 100 | 57.47% | 2 | 20.00% | 
| Matthew Wilcox | 26 | 14.94% | 4 | 40.00% | 
| Linus Torvalds (pre-git) | 21 | 12.07% | 1 | 10.00% | 
| Björn Helgaas | 19 | 10.92% | 1 | 10.00% | 
| Alex Williamson | 7 | 4.02% | 1 | 10.00% | 
| Tony Luck | 1 | 0.57% | 1 | 10.00% | 
| Total | 174 | 100.00% | 10 | 100.00% | 
int raw_pci_write(unsigned int seg, unsigned int bus, unsigned int devfn,
	       int reg, int len, u32 value)
{
	u64 addr;
	int mode, result;
	if ((seg > 65535) || (bus > 255) || (devfn > 255) || (reg > 4095))
		return -EINVAL;
	if ((seg | reg) <= 255) {
		addr = PCI_SAL_ADDRESS(seg, bus, devfn, reg);
		mode = 0;
	} else if (sal_revision >= SAL_VERSION_CODE(3,2)) {
		addr = PCI_SAL_EXT_ADDRESS(seg, bus, devfn, reg);
		mode = 1;
	} else {
		return -EINVAL;
	}
	result = ia64_sal_pci_config_write(addr, mode, len, value);
	if (result != 0)
		return -EINVAL;
	return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| David Mosberger-Tang | 67 | 42.68% | 2 | 25.00% | 
| Matthew Wilcox | 63 | 40.13% | 4 | 50.00% | 
| Björn Helgaas | 22 | 14.01% | 1 | 12.50% | 
| Alex Williamson | 5 | 3.18% | 1 | 12.50% | 
| Total | 157 | 100.00% | 8 | 100.00% | 
static int pci_read(struct pci_bus *bus, unsigned int devfn, int where,
							int size, u32 *value)
{
	return raw_pci_read(pci_domain_nr(bus), bus->number,
				 devfn, where, size, value);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| David Mosberger-Tang | 19 | 41.30% | 1 | 14.29% | 
| Linus Torvalds (pre-git) | 16 | 34.78% | 1 | 14.29% | 
| Hanna V. Linder | 5 | 10.87% | 1 | 14.29% | 
| Alex Williamson | 3 | 6.52% | 1 | 14.29% | 
| Matthew Wilcox | 3 | 6.52% | 3 | 42.86% | 
| Total | 46 | 100.00% | 7 | 100.00% | 
static int pci_write(struct pci_bus *bus, unsigned int devfn, int where,
							int size, u32 value)
{
	return raw_pci_write(pci_domain_nr(bus), bus->number,
				  devfn, where, size, value);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Linus Torvalds (pre-git) | 19 | 42.22% | 1 | 14.29% | 
| David Mosberger-Tang | 15 | 33.33% | 1 | 14.29% | 
| Hanna V. Linder | 5 | 11.11% | 1 | 14.29% | 
| Matthew Wilcox | 3 | 6.67% | 3 | 42.86% | 
| Alex Williamson | 3 | 6.67% | 1 | 14.29% | 
| Total | 45 | 100.00% | 7 | 100.00% | 
struct pci_ops pci_root_ops = {
	.read = pci_read,
	.write = pci_write,
};
struct pci_root_info {
	
struct acpi_pci_root_info common;
	
struct pci_controller controller;
	
struct list_head io_resources;
};
static unsigned int new_space(u64 phys_base, int sparse)
{
	u64 mmio_base;
	int i;
	if (phys_base == 0)
		return 0;	/* legacy I/O port space */
	mmio_base = (u64) ioremap(phys_base, 0);
	for (i = 0; i < num_io_spaces; i++)
		if (io_space[i].mmio_base == mmio_base &&
		    io_space[i].sparse == sparse)
			return i;
	if (num_io_spaces == MAX_IO_SPACES) {
		pr_err("PCI: Too many IO port spaces "
			"(MAX_IO_SPACES=%lu)\n", MAX_IO_SPACES);
		return ~0;
	}
	i = num_io_spaces++;
	io_space[i].mmio_base = mmio_base;
	io_space[i].sparse = sparse;
	return i;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Björn Helgaas | 106 | 86.18% | 3 | 50.00% | 
| Alex Williamson | 11 | 8.94% | 1 | 16.67% | 
| David Mosberger-Tang | 5 | 4.07% | 1 | 16.67% | 
| Yijing Wang | 1 | 0.81% | 1 | 16.67% | 
| Total | 123 | 100.00% | 6 | 100.00% | 
static int add_io_space(struct device *dev, struct pci_root_info *info,
			struct resource_entry *entry)
{
	struct resource_entry *iospace;
	struct resource *resource, *res = entry->res;
	char *name;
	unsigned long base, min, max, base_port;
	unsigned int sparse = 0, space_nr, len;
	len = strlen(info->common.name) + 32;
	iospace = resource_list_create_entry(NULL, len);
	if (!iospace) {
		dev_err(dev, "PCI: No memory for %s I/O port space\n",
			info->common.name);
		return -ENOMEM;
	}
	if (res->flags & IORESOURCE_IO_SPARSE)
		sparse = 1;
	space_nr = new_space(entry->offset, sparse);
	if (space_nr == ~0)
		goto free_resource;
	name = (char *)(iospace + 1);
	min = res->start - entry->offset;
	max = res->end - entry->offset;
	base = __pa(io_space[space_nr].mmio_base);
	base_port = IO_SPACE_BASE(space_nr);
	snprintf(name, len, "%s I/O Ports %08lx-%08lx", info->common.name,
		 base_port + min, base_port + max);
	/*
         * The SDM guarantees the legacy 0-64K space is sparse, but if the
         * mapping is done by the processor (not the bridge), ACPI may not
         * mark it as sparse.
         */
	if (space_nr == 0)
		sparse = 1;
	resource = iospace->res;
	resource->name  = name;
	resource->flags = IORESOURCE_MEM;
	resource->start = base + (sparse ? IO_SPACE_SPARSE_ENCODING(min) : min);
	resource->end   = base + (sparse ? IO_SPACE_SPARSE_ENCODING(max) : max);
	if (insert_resource(&iomem_resource, resource)) {
		dev_err(dev,
			"can't allocate host bridge io space resource  %pR\n",
			resource);
		goto free_resource;
	}
	entry->offset = base_port;
	res->start = min + base_port;
	res->end = max + base_port;
	resource_list_add_tail(iospace, &info->io_resources);
	return 0;
free_resource:
	resource_list_free_entry(iospace);
	return -ENOSPC;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Björn Helgaas | 209 | 60.06% | 2 | 25.00% | 
| Jiang Liu | 134 | 38.51% | 4 | 50.00% | 
| Yijing Wang | 3 | 0.86% | 1 | 12.50% | 
| Matthew Wilcox | 2 | 0.57% | 1 | 12.50% | 
| Total | 348 | 100.00% | 8 | 100.00% | 
/*
 * An IO port or MMIO resource assigned to a PCI host bridge may be
 * consumed by the host bridge itself or available to its child
 * bus/devices. The ACPI specification defines a bit (Producer/Consumer)
 * to tell whether the resource is consumed by the host bridge itself,
 * but firmware hasn't used that bit consistently, so we can't rely on it.
 *
 * On x86 and IA64 platforms, all IO port and MMIO resources are assumed
 * to be available to child bus/devices except one special case:
 *     IO port [0xCF8-0xCFF] is consumed by the host bridge itself
 *     to access PCI configuration space.
 *
 * So explicitly filter out PCI CFG IO ports[0xCF8-0xCFF].
 */
static bool resource_is_pcicfg_ioport(struct resource *res)
{
	return (res->flags & IORESOURCE_IO) &&
		res->start == 0xCF8 && res->end == 0xCFF;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Jiang Liu | 17 | 53.12% | 1 | 50.00% | 
| Björn Helgaas | 15 | 46.88% | 1 | 50.00% | 
| Total | 32 | 100.00% | 2 | 100.00% | 
static int pci_acpi_root_prepare_resources(struct acpi_pci_root_info *ci)
{
	struct device *dev = &ci->bridge->dev;
	struct pci_root_info *info;
	struct resource *res;
	struct resource_entry *entry, *tmp;
	int status;
	status = acpi_pci_probe_root_resources(ci);
	if (status > 0) {
		info = container_of(ci, struct pci_root_info, common);
		resource_list_for_each_entry_safe(entry, tmp, &ci->resources) {
			res = entry->res;
			if (res->flags & IORESOURCE_MEM) {
				/*
                                 * HP's firmware has a hack to work around a
                                 * Windows bug. Ignore these tiny memory ranges.
                                 */
				if (resource_size(res) <= 16) {
					resource_list_del(entry);
					insert_resource(&iomem_resource,
							entry->res);
					resource_list_add_tail(entry,
							&info->io_resources);
				}
			} else if (res->flags & IORESOURCE_IO) {
				if (resource_is_pcicfg_ioport(entry->res))
					resource_list_destroy_entry(entry);
				else if (add_io_space(dev, info, entry))
					resource_list_destroy_entry(entry);
			}
		}
	}
	return status;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Jiang Liu | 155 | 86.59% | 2 | 66.67% | 
| Björn Helgaas | 24 | 13.41% | 1 | 33.33% | 
| Total | 179 | 100.00% | 3 | 100.00% | 
static void pci_acpi_root_release_info(struct acpi_pci_root_info *ci)
{
	struct pci_root_info *info;
	struct resource_entry *entry, *tmp;
	info = container_of(ci, struct pci_root_info, common);
	resource_list_for_each_entry_safe(entry, tmp, &info->io_resources) {
		release_resource(entry->res);
		resource_list_destroy_entry(entry);
	}
	kfree(info);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Jiang Liu | 38 | 60.32% | 2 | 40.00% | 
| Björn Helgaas | 16 | 25.40% | 2 | 40.00% | 
| Yijing Wang | 9 | 14.29% | 1 | 20.00% | 
| Total | 63 | 100.00% | 5 | 100.00% | 
static struct acpi_pci_root_ops pci_acpi_root_ops = {
	.pci_ops = &pci_root_ops,
	.release_info = pci_acpi_root_release_info,
	.prepare_resources = pci_acpi_root_prepare_resources,
};
struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
{
	struct acpi_device *device = root->device;
	struct pci_root_info *info;
	info = kzalloc(sizeof(*info), GFP_KERNEL);
	if (!info) {
		dev_err(&device->dev,
			"pci_bus %04x:%02x: ignored (out of memory)\n",
			root->segment, (int)root->secondary.start);
		return NULL;
	}
	info->controller.segment = root->segment;
	info->controller.companion = device;
	info->controller.node = acpi_get_node(device->handle);
	INIT_LIST_HEAD(&info->io_resources);
	return acpi_pci_root_create(root, &pci_acpi_root_ops,
				    &info->common, &info->controller);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Jiang Liu | 52 | 40.00% | 3 | 23.08% | 
| Yijing Wang | 44 | 33.85% | 3 | 23.08% | 
| Björn Helgaas | 25 | 19.23% | 4 | 30.77% | 
| Matthew Wilcox | 5 | 3.85% | 2 | 15.38% | 
| David Mosberger-Tang | 4 | 3.08% | 1 | 7.69% | 
| Total | 130 | 100.00% | 13 | 100.00% | 
int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
{
	/*
         * We pass NULL as parent to pci_create_root_bus(), so if it is not NULL
         * here, pci_create_root_bus() has been called by someone else and
         * sysdata is likely to be different from what we expect.  Let it go in
         * that case.
         */
	if (!bridge->dev.parent) {
		struct pci_controller *controller = bridge->bus->sysdata;
		ACPI_COMPANION_SET(&bridge->dev, controller->companion);
	}
	return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Rafael J. Wysocki | 48 | 100.00% | 3 | 100.00% | 
| Total | 48 | 100.00% | 3 | 100.00% | 
void pcibios_fixup_device_resources(struct pci_dev *dev)
{
	int idx;
	if (!dev->bus)
		return;
	for (idx = 0; idx < PCI_BRIDGE_RESOURCES; idx++) {
		struct resource *r = &dev->resource[idx];
		if (!r->flags || r->parent || !r->start)
			continue;
		pci_claim_resource(dev, idx);
	}
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Yinghai Lu | 31 | 42.47% | 1 | 20.00% | 
| Rajesh Shah | 20 | 27.40% | 1 | 20.00% | 
| Tony Luck | 9 | 12.33% | 1 | 20.00% | 
| Björn Helgaas | 7 | 9.59% | 1 | 20.00% | 
| Matthew Wilcox | 6 | 8.22% | 1 | 20.00% | 
| Total | 73 | 100.00% | 5 | 100.00% | 
EXPORT_SYMBOL_GPL(pcibios_fixup_device_resources);
static void pcibios_fixup_bridge_resources(struct pci_dev *dev)
{
	int idx;
	if (!dev->bus)
		return;
	for (idx = PCI_BRIDGE_RESOURCES; idx < PCI_NUM_RESOURCES; idx++) {
		struct resource *r = &dev->resource[idx];
		if (!r->flags || r->parent || !r->start)
			continue;
		pci_claim_bridge_resource(dev, idx);
	}
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Yinghai Lu | 58 | 78.38% | 1 | 50.00% | 
| Kenji Kaneshige | 16 | 21.62% | 1 | 50.00% | 
| Total | 74 | 100.00% | 2 | 100.00% | 
/*
 *  Called after each bus is probed, but before its children are examined.
 */
void pcibios_fixup_bus(struct pci_bus *b)
{
	struct pci_dev *dev;
	if (b->self) {
		pci_read_bridge_bases(b);
		pcibios_fixup_bridge_resources(b->self);
	}
	list_for_each_entry(dev, &b->devices, bus_list)
		pcibios_fixup_device_resources(dev);
	platform_pci_fixup_bus(b);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Rajesh Shah | 12 | 22.64% | 1 | 12.50% | 
| Maximilian Attems | 11 | 20.75% | 1 | 12.50% | 
| Linus Torvalds (pre-git) | 9 | 16.98% | 1 | 12.50% | 
| Alex Williamson | 7 | 13.21% | 1 | 12.50% | 
| Björn Helgaas | 7 | 13.21% | 1 | 12.50% | 
| John Keller | 5 | 9.43% | 1 | 12.50% | 
| Greg Kroah-Hartman | 1 | 1.89% | 1 | 12.50% | 
| Kenji Kaneshige | 1 | 1.89% | 1 | 12.50% | 
| Total | 53 | 100.00% | 8 | 100.00% | 
void pcibios_add_bus(struct pci_bus *bus)
{
	acpi_pci_add_bus(bus);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Jiang Liu | 15 | 100.00% | 1 | 100.00% | 
| Total | 15 | 100.00% | 1 | 100.00% | 
void pcibios_remove_bus(struct pci_bus *bus)
{
	acpi_pci_remove_bus(bus);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Jiang Liu | 15 | 100.00% | 1 | 100.00% | 
| Total | 15 | 100.00% | 1 | 100.00% | 
void pcibios_set_master (struct pci_dev *dev)
{
	/* No special bus mastering setup handling */
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Myron Stowe | 11 | 100.00% | 1 | 100.00% | 
| Total | 11 | 100.00% | 1 | 100.00% | 
int
pcibios_enable_device (struct pci_dev *dev, int mask)
{
	int ret;
	ret = pci_enable_resources(dev, mask);
	if (ret < 0)
		return ret;
	if (!dev->msi_enabled)
		return acpi_pci_irq_enable(dev);
	return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| David Mosberger-Tang | 36 | 72.00% | 2 | 40.00% | 
| Eric W. Biedermann | 10 | 20.00% | 1 | 20.00% | 
| Linus Torvalds (pre-git) | 3 | 6.00% | 1 | 20.00% | 
| Björn Helgaas | 1 | 2.00% | 1 | 20.00% | 
| Total | 50 | 100.00% | 5 | 100.00% | 
void
pcibios_disable_device (struct pci_dev *dev)
{
	BUG_ON(atomic_read(&dev->enable_cnt));
	if (!dev->msi_enabled)
		acpi_pci_irq_disable(dev);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Kenji Kaneshige | 15 | 45.45% | 1 | 25.00% | 
| Peter Chubb | 9 | 27.27% | 1 | 25.00% | 
| Eric W. Biedermann | 7 | 21.21% | 1 | 25.00% | 
| Satoru Takeuchi | 2 | 6.06% | 1 | 25.00% | 
| Total | 33 | 100.00% | 4 | 100.00% | 
resource_size_t
pcibios_align_resource (void *data, const struct resource *res,
		        resource_size_t size, resource_size_t align)
{
	return res->start;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Linus Torvalds (pre-git) | 13 | 50.00% | 1 | 20.00% | 
| Dominik Brodowski | 9 | 34.62% | 2 | 40.00% | 
| Greg Kroah-Hartman | 2 | 7.69% | 1 | 20.00% | 
| Ivan Kokshaysky | 2 | 7.69% | 1 | 20.00% | 
| Total | 26 | 100.00% | 5 | 100.00% | 
/**
 * ia64_pci_get_legacy_mem - generic legacy mem routine
 * @bus: bus to get legacy memory base address for
 *
 * Find the base of legacy memory for @bus.  This is typically the first
 * megabyte of bus address space for @bus or is simply 0 on platforms whose
 * chipsets support legacy I/O and memory routing.  Returns the base address
 * or an error pointer if an error occurred.
 *
 * This is the ia64 generic version of this routine.  Other platforms
 * are free to override it with a machine vector.
 */
char *ia64_pci_get_legacy_mem(struct pci_bus *bus)
{
	return (char *)__IA64_UNCACHED_OFFSET;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Tony Luck | 18 | 100.00% | 1 | 100.00% | 
| Total | 18 | 100.00% | 1 | 100.00% | 
/**
 * pci_mmap_legacy_page_range - map legacy memory space to userland
 * @bus: bus whose legacy space we're mapping
 * @vma: vma passed in by mmap
 *
 * Map legacy memory space for this device back to userspace using a machine
 * vector to get the base address.
 */
int
pci_mmap_legacy_page_range(struct pci_bus *bus, struct vm_area_struct *vma,
			   enum pci_mmap_state mmap_state)
{
	unsigned long size = vma->vm_end - vma->vm_start;
	pgprot_t prot;
	char *addr;
	/* We only support mmap'ing of legacy memory space */
	if (mmap_state != pci_mmap_mem)
		return -ENOSYS;
	/*
         * Avoid attribute aliasing.  See Documentation/ia64/aliasing.txt
         * for more details.
         */
	if (!valid_mmap_phys_addr_range(vma->vm_pgoff, size))
		return -EINVAL;
	prot = phys_mem_access_prot(NULL, vma->vm_pgoff, size,
				    vma->vm_page_prot);
	addr = pci_get_legacy_mem(bus);
	if (IS_ERR(addr))
		return PTR_ERR(addr);
	vma->vm_pgoff += (unsigned long)addr >> PAGE_SHIFT;
	vma->vm_page_prot = prot;
	if (remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
			    size, vma->vm_page_prot))
		return -EAGAIN;
	return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Jesse Barnes | 83 | 55.70% | 1 | 33.33% | 
| Björn Helgaas | 51 | 34.23% | 1 | 33.33% | 
| Benjamin Herrenschmidt | 15 | 10.07% | 1 | 33.33% | 
| Total | 149 | 100.00% | 3 | 100.00% | 
/**
 * ia64_pci_legacy_read - read from legacy I/O space
 * @bus: bus to read
 * @port: legacy port value
 * @val: caller allocated storage for returned value
 * @size: number of bytes to read
 *
 * Simply reads @size bytes from @port and puts the result in @val.
 *
 * Again, this (and the write routine) are generic versions that can be
 * overridden by the platform.  This is necessary on platforms that don't
 * support legacy I/O routing or that hard fail on legacy I/O timeouts.
 */
int ia64_pci_legacy_read(struct pci_bus *bus, u16 port, u32 *val, u8 size)
{
	int ret = size;
	switch (size) {
	case 1:
		*val = inb(port);
		break;
	case 2:
		*val = inw(port);
		break;
	case 4:
		*val = inl(port);
		break;
	default:
		ret = -EINVAL;
		break;
	}
	return ret;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Jesse Barnes | 77 | 100.00% | 1 | 100.00% | 
| Total | 77 | 100.00% | 1 | 100.00% | 
/**
 * ia64_pci_legacy_write - perform a legacy I/O write
 * @bus: bus pointer
 * @port: port to write
 * @val: value to write
 * @size: number of bytes to write from @val
 *
 * Simply writes @size bytes of @val to @port.
 */
int ia64_pci_legacy_write(struct pci_bus *bus, u16 port, u32 val, u8 size)
{
	int ret = size;
	switch (size) {
	case 1:
		outb(val, port);
		break;
	case 2:
		outw(val, port);
		break;
	case 4:
		outl(val, port);
		break;
	default:
		ret = -EINVAL;
		break;
	}
	return ret;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Jesse Barnes | 71 | 97.26% | 1 | 33.33% | 
| Satoru Takeuchi | 1 | 1.37% | 1 | 33.33% | 
| Alex Williamson | 1 | 1.37% | 1 | 33.33% | 
| Total | 73 | 100.00% | 3 | 100.00% | 
/**
 * set_pci_cacheline_size - determine cacheline size for PCI devices
 *
 * We want to use the line-size of the outer-most cache.  We assume
 * that this line-size is the same for all CPUs.
 *
 * Code mostly taken from arch/ia64/kernel/palinfo.c:cache_info().
 */
static void __init set_pci_dfl_cacheline_size(void)
{
	unsigned long levels, unique_caches;
	long status;
	pal_cache_config_info_t cci;
	status = ia64_pal_cache_summary(&levels, &unique_caches);
	if (status != 0) {
		pr_err("%s: ia64_pal_cache_summary() failed "
			"(status=%ld)\n", __func__, status);
		return;
	}
	status = ia64_pal_cache_config_info(levels - 1,
				/* cache_type (data_or_unified)= */ 2, &cci);
	if (status != 0) {
		pr_err("%s: ia64_pal_cache_config_info() failed "
			"(status=%ld)\n", __func__, status);
		return;
	}
	pci_dfl_cache_line_size = (1 << cci.pcci_line_size) / 4;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| David Mosberger-Tang | 76 | 78.35% | 1 | 16.67% | 
| Matthew Wilcox | 15 | 15.46% | 2 | 33.33% | 
| Jesse Barnes | 2 | 2.06% | 1 | 16.67% | 
| Harvey Harrison | 2 | 2.06% | 1 | 16.67% | 
| Yijing Wang | 2 | 2.06% | 1 | 16.67% | 
| Total | 97 | 100.00% | 6 | 100.00% | 
u64 ia64_dma_get_required_mask(struct device *dev)
{
	u32 low_totalram = ((max_pfn - 1) << PAGE_SHIFT);
	u32 high_totalram = ((max_pfn - 1) >> (32 - PAGE_SHIFT));
	u64 mask;
	if (!high_totalram) {
		/* convert to mask just covering totalram */
		low_totalram = (1 << (fls(low_totalram) - 1));
		low_totalram += low_totalram - 1;
		mask = low_totalram;
	} else {
		high_totalram = (1 << (fls(high_totalram) - 1));
		high_totalram += high_totalram - 1;
		mask = (((u64)high_totalram) << 32) + 0xffffffff;
	}
	return mask;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| John Keller | 118 | 100.00% | 1 | 100.00% | 
| Total | 118 | 100.00% | 1 | 100.00% | 
EXPORT_SYMBOL_GPL(ia64_dma_get_required_mask);
u64 dma_get_required_mask(struct device *dev)
{
	return platform_dma_get_required_mask(dev);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| John Keller | 16 | 100.00% | 1 | 100.00% | 
| Total | 16 | 100.00% | 1 | 100.00% | 
EXPORT_SYMBOL_GPL(dma_get_required_mask);
static int __init pcibios_init(void)
{
	set_pci_dfl_cacheline_size();
	return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| David Mosberger-Tang | 9 | 60.00% | 1 | 33.33% | 
| Matthew Wilcox | 5 | 33.33% | 1 | 33.33% | 
| Jesse Barnes | 1 | 6.67% | 1 | 33.33% | 
| Total | 15 | 100.00% | 3 | 100.00% | 
subsys_initcall(pcibios_init);
Overall Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Björn Helgaas | 510 | 21.02% | 12 | 16.90% | 
| Jiang Liu | 465 | 19.17% | 5 | 7.04% | 
| David Mosberger-Tang | 354 | 14.59% | 5 | 7.04% | 
| Jesse Barnes | 237 | 9.77% | 2 | 2.82% | 
| John Keller | 157 | 6.47% | 2 | 2.82% | 
| Matthew Wilcox | 139 | 5.73% | 10 | 14.08% | 
| Linus Torvalds (pre-git) | 130 | 5.36% | 2 | 2.82% | 
| Yinghai Lu | 89 | 3.67% | 1 | 1.41% | 
| Yijing Wang | 59 | 2.43% | 3 | 4.23% | 
| Rafael J. Wysocki | 48 | 1.98% | 3 | 4.23% | 
| Alex Williamson | 40 | 1.65% | 2 | 2.82% | 
| Kenji Kaneshige | 32 | 1.32% | 2 | 2.82% | 
| Rajesh Shah | 32 | 1.32% | 2 | 2.82% | 
| Tony Luck | 29 | 1.20% | 3 | 4.23% | 
| Eric W. Biedermann | 17 | 0.70% | 1 | 1.41% | 
| Hanna V. Linder | 16 | 0.66% | 1 | 1.41% | 
| Benjamin Herrenschmidt | 15 | 0.62% | 1 | 1.41% | 
| Myron Stowe | 11 | 0.45% | 1 | 1.41% | 
| Maximilian Attems | 11 | 0.45% | 1 | 1.41% | 
| Peter Chubb | 9 | 0.37% | 1 | 1.41% | 
| Dominik Brodowski | 9 | 0.37% | 2 | 2.82% | 
| Satoru Takeuchi | 3 | 0.12% | 2 | 2.82% | 
| Andrew Morton | 3 | 0.12% | 1 | 1.41% | 
| Greg Kroah-Hartman | 3 | 0.12% | 2 | 2.82% | 
| Paul Gortmaker | 3 | 0.12% | 1 | 1.41% | 
| Ivan Kokshaysky | 2 | 0.08% | 1 | 1.41% | 
| Harvey Harrison | 2 | 0.08% | 1 | 1.41% | 
| Linus Torvalds | 1 | 0.04% | 1 | 1.41% | 
| Total | 2426 | 100.00% | 71 | 100.00% | 
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.