/*
* IBM PowerPC Virtual I/O Infrastructure Support.
*
* Copyright (c) 2003,2008 IBM Corp.
* Dave Engebretsen engebret@us.ibm.com
* Santiago Leon santil@us.ibm.com
* Hollis Blanchard <hollisb@us.ibm.com>
* Stephen Rothwell
* Robert Jennings <rcjenn@us.ibm.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
#include <linux/types.h>
#include <linux/device.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/console.h>
#include <linux/module.h>
#include <linux/mm.h>
#include <linux/dma-mapping.h>
#include <linux/kobject.h>
#include <asm/iommu.h>
#include <asm/dma.h>
#include <asm/vio.h>
#include <asm/prom.h>
#include <asm/firmware.h>
#include <asm/tce.h>
#include <asm/abs_addr.h>
#include <asm/page.h>
#include <asm/hvcall.h>
#include <asm/iseries/vio.h>
#include <asm/iseries/hv_types.h>
#include <asm/iseries/hv_lp_config.h>
#include <asm/iseries/hv_call_xm.h>
#include <asm/iseries/iommu.h>
static struct bus_type vio_bus_type;
static struct vio_dev vio_bus_device = { /* fake "parent" device */
.name = "vio",
.type = "",
.dev.init_name = "vio",
.dev.bus = &vio_bus_type,
};
#ifdef CONFIG_PPC_SMLPAR
/**
* vio_cmo_pool - A pool of IO memory for CMO use
*
* @size: The size of the pool in bytes
* @free: The amount of free memory in the pool
*/
struct vio_cmo_pool {
size_t size;
size_t free;
};
/* How many ms to delay queued balance work */
#define VIO_CMO_BALANCE_DELAY 100
/* Portion out IO memory to CMO devices by this chunk size */
#define VIO_CMO_BALANCE_CHUNK 131072
/**
* vio_cmo_dev_entry - A device that is CMO-enabled and requires entitlement
*
* @vio_dev: struct vio_dev pointer
* @list: pointer to other devices on bus that are being tracked
*/
struct vio_cmo_dev_entry {
struct vio_dev *viodev;
struct list_head