2005-04-16 22:20:36 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2001 Allan Trautman, IBM Corporation
|
|
|
|
*
|
|
|
|
* iSeries specific routines for PCI.
|
2005-09-27 16:50:25 +00:00
|
|
|
*
|
2005-04-16 22:20:36 +00:00
|
|
|
* Based on code from pci.c and iSeries_pci.c 32bit
|
|
|
|
*
|
|
|
|
* 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.
|
2005-09-27 16:50:25 +00:00
|
|
|
*
|
2005-04-16 22:20:36 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2005-09-27 16:50:25 +00:00
|
|
|
*
|
2005-04-16 22:20:36 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
#include <linux/kernel.h>
|
2005-09-27 16:50:25 +00:00
|
|
|
#include <linux/list.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
#include <linux/string.h>
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/pci.h>
|
|
|
|
|
|
|
|
#include <asm/io.h>
|
|
|
|
#include <asm/irq.h>
|
|
|
|
#include <asm/prom.h>
|
|
|
|
#include <asm/machdep.h>
|
|
|
|
#include <asm/pci-bridge.h>
|
|
|
|
#include <asm/iommu.h>
|
2005-10-14 04:51:42 +00:00
|
|
|
#include <asm/abs_addr.h>
|
2006-09-21 08:00:00 +00:00
|
|
|
#include <asm/firmware.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-11-02 00:41:12 +00:00
|
|
|
#include <asm/iseries/hv_call_xm.h>
|
2005-11-02 04:10:38 +00:00
|
|
|
#include <asm/iseries/mf.h>
|
2006-04-27 07:23:32 +00:00
|
|
|
#include <asm/iseries/iommu.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-09-27 16:50:25 +00:00
|
|
|
#include <asm/ppc-pci.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-09-28 13:37:01 +00:00
|
|
|
#include "irq.h"
|
2005-10-14 04:51:42 +00:00
|
|
|
#include "pci.h"
|
2005-10-14 07:16:17 +00:00
|
|
|
#include "call_pci.h"
|
2005-09-28 13:37:01 +00:00
|
|
|
|
2007-12-06 14:48:14 +00:00
|
|
|
#define PCI_RETRY_MAX 3
|
|
|
|
static int limit_pci_retries = 1; /* Set Retry Error on. */
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Table defines
|
|
|
|
* Each Entry size is 4 MB * 1024 Entries = 4GB I/O address space.
|
|
|
|
*/
|
|
|
|
#define IOMM_TABLE_MAX_ENTRIES 1024
|
|
|
|
#define IOMM_TABLE_ENTRY_SIZE 0x0000000000400000UL
|
|
|
|
#define BASE_IO_MEMORY 0xE000000000000000UL
|
|
|
|
|
2006-05-19 06:42:49 +00:00
|
|
|
static unsigned long max_io_memory = BASE_IO_MEMORY;
|
2005-04-16 22:20:36 +00:00
|
|
|
static long current_iomm_table_entry;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Lookup Tables.
|
|
|
|
*/
|
2006-05-19 06:42:49 +00:00
|
|
|
static struct device_node *iomm_table[IOMM_TABLE_MAX_ENTRIES];
|
|
|
|
static u8 iobar_table[IOMM_TABLE_MAX_ENTRIES];
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2006-05-19 06:42:49 +00:00
|
|
|
static const char pci_io_text[] = "iSeries PCI I/O";
|
2005-04-16 22:20:36 +00:00
|
|
|
static DEFINE_SPINLOCK(iomm_table_lock);
|
|
|
|
|
2007-12-06 14:55:50 +00:00
|
|
|
/*
|
|
|
|
* Generate a Direct Select Address for the Hypervisor
|
|
|
|
*/
|
|
|
|
static inline u64 iseries_ds_addr(struct device_node *node)
|
|
|
|
{
|
|
|
|
struct pci_dn *pdn = PCI_DN(node);
|
|
|
|
|
|
|
|
return ((u64)pdn->busno << 48) + ((u64)pdn->bussubno << 40)
|
|
|
|
+ ((u64)0x10 << 32);
|
|
|
|
}
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/*
|
|
|
|
* iomm_table_allocate_entry
|
|
|
|
*
|
|
|
|
* Adds pci_dev entry in address translation table
|
|
|
|
*
|
|
|
|
* - Allocates the number of entries required in table base on BAR
|
|
|
|
* size.
|
|
|
|
* - Allocates starting at BASE_IO_MEMORY and increases.
|
|
|
|
* - The size is round up to be a multiple of entry size.
|
|
|
|
* - CurrentIndex is incremented to keep track of the last entry.
|
|
|
|
* - Builds the resource entry for allocated BARs.
|
|
|
|
*/
|
2007-11-19 06:03:59 +00:00
|
|
|
static void __init iomm_table_allocate_entry(struct pci_dev *dev, int bar_num)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
|
|
|
struct resource *bar_res = &dev->resource[bar_num];
|
|
|
|
long bar_size = pci_resource_len(dev, bar_num);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* No space to allocate, quick exit, skip Allocation.
|
|
|
|
*/
|
|
|
|
if (bar_size == 0)
|
|
|
|
return;
|
|
|
|
/*
|
|
|
|
* Set Resource values.
|
|
|
|
*/
|
|
|
|
spin_lock(&iomm_table_lock);
|
|
|
|
bar_res->name = pci_io_text;
|
2006-05-19 06:42:49 +00:00
|
|
|
bar_res->start = BASE_IO_MEMORY +
|
2005-04-16 22:20:36 +00:00
|
|
|
IOMM_TABLE_ENTRY_SIZE * current_iomm_table_entry;
|
|
|
|
bar_res->end = bar_res->start + bar_size - 1;
|
|
|
|
/*
|
|
|
|
* Allocate the number of table entries needed for BAR.
|
|
|
|
*/
|
|
|
|
while (bar_size > 0 ) {
|
|
|
|
iomm_table[current_iomm_table_entry] = dev->sysdata;
|
|
|
|
iobar_table[current_iomm_table_entry] = bar_num;
|
|
|
|
bar_size -= IOMM_TABLE_ENTRY_SIZE;
|
|
|
|
++current_iomm_table_entry;
|
|
|
|
}
|
|
|
|
max_io_memory = BASE_IO_MEMORY +
|
2006-05-19 06:42:49 +00:00
|
|
|
IOMM_TABLE_ENTRY_SIZE * current_iomm_table_entry;
|
2005-04-16 22:20:36 +00:00
|
|
|
spin_unlock(&iomm_table_lock);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* allocate_device_bars
|
|
|
|
*
|
|
|
|
* - Allocates ALL pci_dev BAR's and updates the resources with the
|
|
|
|
* BAR value. BARS with zero length will have the resources
|
|
|
|
* The HvCallPci_getBarParms is used to get the size of the BAR
|
|
|
|
* space. It calls iomm_table_allocate_entry to allocate
|
|
|
|
* each entry.
|
|
|
|
* - Loops through The Bar resources(0 - 5) including the ROM
|
|
|
|
* is resource(6).
|
|
|
|
*/
|
2007-11-19 06:03:59 +00:00
|
|
|
static void __init allocate_device_bars(struct pci_dev *dev)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
|
|
|
int bar_num;
|
|
|
|
|
2006-05-19 06:42:49 +00:00
|
|
|
for (bar_num = 0; bar_num <= PCI_ROM_RESOURCE; ++bar_num)
|
2005-04-16 22:20:36 +00:00
|
|
|
iomm_table_allocate_entry(dev, bar_num);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Log error information to system console.
|
|
|
|
* Filter out the device not there errors.
|
|
|
|
* PCI: EADs Connect Failed 0x18.58.10 Rc: 0x00xx
|
|
|
|
* PCI: Read Vendor Failed 0x18.58.10 Rc: 0x00xx
|
|
|
|
* PCI: Connect Bus Unit Failed 0x18.58.10 Rc: 0x00xx
|
|
|
|
*/
|
2007-12-06 14:49:27 +00:00
|
|
|
static void pci_log_error(char *error, int bus, int subbus,
|
|
|
|
int agent, int hv_res)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2007-12-06 14:49:27 +00:00
|
|
|
if (hv_res == 0x0302)
|
2005-04-16 22:20:36 +00:00
|
|
|
return;
|
|
|
|
printk(KERN_ERR "PCI: %s Failed: 0x%02X.%02X.%02X Rc: 0x%04X",
|
2007-12-06 14:49:27 +00:00
|
|
|
error, bus, subbus, agent, hv_res);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2007-12-06 14:46:40 +00:00
|
|
|
/*
|
|
|
|
* Look down the chain to find the matching Device Device
|
|
|
|
*/
|
2007-12-06 14:49:27 +00:00
|
|
|
static struct device_node *find_device_node(int bus, int devfn)
|
2007-12-06 14:46:40 +00:00
|
|
|
{
|
|
|
|
struct device_node *node;
|
|
|
|
|
|
|
|
for (node = NULL; (node = of_find_all_nodes(node)); ) {
|
|
|
|
struct pci_dn *pdn = PCI_DN(node);
|
|
|
|
|
|
|
|
if (pdn && (bus == pdn->busno) && (devfn == pdn->devfn))
|
|
|
|
return node;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/*
|
2005-09-27 16:50:25 +00:00
|
|
|
* iSeries_pci_final_fixup(void)
|
2005-04-16 22:20:36 +00:00
|
|
|
*/
|
|
|
|
void __init iSeries_pci_final_fixup(void)
|
|
|
|
{
|
|
|
|
struct pci_dev *pdev = NULL;
|
2005-09-28 04:40:40 +00:00
|
|
|
struct device_node *node;
|
2007-12-06 14:49:27 +00:00
|
|
|
int num_dev = 0;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* Fix up at the device node and pci_dev relationship */
|
|
|
|
mf_display_src(0xC9000100);
|
|
|
|
|
|
|
|
printk("pcibios_final_fixup\n");
|
|
|
|
for_each_pci_dev(pdev) {
|
2007-12-06 14:51:48 +00:00
|
|
|
const u32 *agent;
|
2007-12-06 14:56:55 +00:00
|
|
|
const u32 *sub_bus;
|
2007-12-06 14:58:01 +00:00
|
|
|
unsigned char bus = pdev->bus->number;
|
2007-12-06 14:51:48 +00:00
|
|
|
|
2007-12-06 14:58:01 +00:00
|
|
|
node = find_device_node(bus, pdev->devfn);
|
|
|
|
printk("pci dev %p (%x.%x), node %p\n", pdev, bus,
|
|
|
|
pdev->devfn, node);
|
2007-12-06 14:51:48 +00:00
|
|
|
if (!node) {
|
|
|
|
printk("PCI: Device Tree not found for 0x%016lX\n",
|
|
|
|
(unsigned long)pdev);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
agent = of_get_property(node, "linux,agent-id", NULL);
|
2007-12-06 14:56:55 +00:00
|
|
|
sub_bus = of_get_property(node, "linux,subbus", NULL);
|
2007-12-06 14:58:01 +00:00
|
|
|
if (agent && sub_bus) {
|
|
|
|
u8 irq = iSeries_allocate_IRQ(bus, 0, *sub_bus);
|
2007-12-06 14:51:48 +00:00
|
|
|
int err;
|
|
|
|
|
2007-12-06 14:58:01 +00:00
|
|
|
err = HvCallXm_connectBusUnit(bus, *sub_bus,
|
2007-12-06 14:51:48 +00:00
|
|
|
*agent, irq);
|
|
|
|
if (err)
|
|
|
|
pci_log_error("Connect Bus Unit",
|
2007-12-06 14:58:01 +00:00
|
|
|
bus, *sub_bus, *agent, err);
|
2007-12-06 14:51:48 +00:00
|
|
|
else {
|
2007-12-06 14:58:01 +00:00
|
|
|
err = HvCallPci_configStore8(bus, *sub_bus,
|
|
|
|
*agent, PCI_INTERRUPT_LINE, irq);
|
2006-05-19 06:50:39 +00:00
|
|
|
if (err)
|
2007-12-06 14:51:48 +00:00
|
|
|
pci_log_error("PciCfgStore Irq Failed!",
|
2007-12-06 14:58:01 +00:00
|
|
|
bus, *sub_bus, *agent, err);
|
2007-12-06 14:51:48 +00:00
|
|
|
else
|
2006-05-19 06:50:39 +00:00
|
|
|
pdev->irq = irq;
|
|
|
|
}
|
2007-12-06 14:51:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
num_dev++;
|
|
|
|
pdev->sysdata = node;
|
|
|
|
PCI_DN(node)->pcidev = pdev;
|
|
|
|
allocate_device_bars(pdev);
|
2007-12-06 14:58:01 +00:00
|
|
|
iSeries_Device_Information(pdev, num_dev, bus, *sub_bus);
|
2007-12-06 14:51:48 +00:00
|
|
|
iommu_devnode_init_iSeries(pdev, node);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
iSeries_activate_IRQs();
|
|
|
|
mf_display_src(0xC9000200);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Config space read and write functions.
|
|
|
|
* For now at least, we look for the device node for the bus and devfn
|
|
|
|
* that we are asked to access. It may be possible to translate the devfn
|
|
|
|
* to a subbus and deviceid more directly.
|
|
|
|
*/
|
|
|
|
static u64 hv_cfg_read_func[4] = {
|
|
|
|
HvCallPciConfigLoad8, HvCallPciConfigLoad16,
|
|
|
|
HvCallPciConfigLoad32, HvCallPciConfigLoad32
|
|
|
|
};
|
|
|
|
|
|
|
|
static u64 hv_cfg_write_func[4] = {
|
|
|
|
HvCallPciConfigStore8, HvCallPciConfigStore16,
|
|
|
|
HvCallPciConfigStore32, HvCallPciConfigStore32
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Read PCI config space
|
|
|
|
*/
|
|
|
|
static int iSeries_pci_read_config(struct pci_bus *bus, unsigned int devfn,
|
|
|
|
int offset, int size, u32 *val)
|
|
|
|
{
|
2007-12-06 14:49:27 +00:00
|
|
|
struct device_node *node = find_device_node(bus->number, devfn);
|
2005-04-16 22:20:36 +00:00
|
|
|
u64 fn;
|
|
|
|
struct HvCallPci_LoadReturn ret;
|
|
|
|
|
|
|
|
if (node == NULL)
|
|
|
|
return PCIBIOS_DEVICE_NOT_FOUND;
|
|
|
|
if (offset > 255) {
|
|
|
|
*val = ~0;
|
|
|
|
return PCIBIOS_BAD_REGISTER_NUMBER;
|
|
|
|
}
|
|
|
|
|
|
|
|
fn = hv_cfg_read_func[(size - 1) & 3];
|
2005-10-14 06:49:58 +00:00
|
|
|
HvCall3Ret16(fn, &ret, iseries_ds_addr(node), offset, 0);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
if (ret.rc != 0) {
|
|
|
|
*val = ~0;
|
|
|
|
return PCIBIOS_DEVICE_NOT_FOUND; /* or something */
|
|
|
|
}
|
|
|
|
|
|
|
|
*val = ret.value;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Write PCI config space
|
|
|
|
*/
|
|
|
|
|
|
|
|
static int iSeries_pci_write_config(struct pci_bus *bus, unsigned int devfn,
|
|
|
|
int offset, int size, u32 val)
|
|
|
|
{
|
2007-12-06 14:49:27 +00:00
|
|
|
struct device_node *node = find_device_node(bus->number, devfn);
|
2005-04-16 22:20:36 +00:00
|
|
|
u64 fn;
|
|
|
|
u64 ret;
|
|
|
|
|
|
|
|
if (node == NULL)
|
|
|
|
return PCIBIOS_DEVICE_NOT_FOUND;
|
|
|
|
if (offset > 255)
|
|
|
|
return PCIBIOS_BAD_REGISTER_NUMBER;
|
|
|
|
|
|
|
|
fn = hv_cfg_write_func[(size - 1) & 3];
|
2005-10-14 06:49:58 +00:00
|
|
|
ret = HvCall4(fn, iseries_ds_addr(node), offset, val, 0);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
if (ret != 0)
|
|
|
|
return PCIBIOS_DEVICE_NOT_FOUND;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct pci_ops iSeries_pci_ops = {
|
|
|
|
.read = iSeries_pci_read_config,
|
|
|
|
.write = iSeries_pci_write_config
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Check Return Code
|
|
|
|
* -> On Failure, print and log information.
|
|
|
|
* Increment Retry Count, if exceeds max, panic partition.
|
|
|
|
*
|
|
|
|
* PCI: Device 23.90 ReadL I/O Error( 0): 0x1234
|
|
|
|
* PCI: Device 23.90 ReadL Retry( 1)
|
|
|
|
* PCI: Device 23.90 ReadL Retry Successful(1)
|
|
|
|
*/
|
2007-12-06 14:49:27 +00:00
|
|
|
static int check_return_code(char *type, struct device_node *dn,
|
2005-06-22 00:15:47 +00:00
|
|
|
int *retry, u64 ret)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
|
|
|
if (ret != 0) {
|
2007-12-06 14:49:27 +00:00
|
|
|
struct pci_dn *pdn = PCI_DN(dn);
|
2005-09-28 04:40:40 +00:00
|
|
|
|
2005-06-22 00:15:47 +00:00
|
|
|
(*retry)++;
|
2005-04-16 22:20:36 +00:00
|
|
|
printk("PCI: %s: Device 0x%04X:%02X I/O Error(%2d): 0x%04X\n",
|
2007-12-06 14:49:27 +00:00
|
|
|
type, pdn->busno, pdn->devfn,
|
2005-06-22 00:15:47 +00:00
|
|
|
*retry, (int)ret);
|
2005-04-16 22:20:36 +00:00
|
|
|
/*
|
|
|
|
* Bump the retry and check for retry count exceeded.
|
|
|
|
* If, Exceeded, panic the system.
|
|
|
|
*/
|
2007-12-06 14:48:14 +00:00
|
|
|
if (((*retry) > PCI_RETRY_MAX) &&
|
|
|
|
(limit_pci_retries > 0)) {
|
2005-04-16 22:20:36 +00:00
|
|
|
mf_display_src(0xB6000103);
|
2005-06-22 00:15:47 +00:00
|
|
|
panic_timeout = 0;
|
2005-04-16 22:20:36 +00:00
|
|
|
panic("PCI: Hardware I/O Error, SRC B6000103, "
|
|
|
|
"Automatic Reboot Disabled.\n");
|
|
|
|
}
|
|
|
|
return -1; /* Retry Try */
|
|
|
|
}
|
2005-06-22 00:15:47 +00:00
|
|
|
return 0;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Translate the I/O Address into a device node, bar, and bar offset.
|
|
|
|
* Note: Make sure the passed variable end up on the stack to avoid
|
|
|
|
* the exposure of being device global.
|
|
|
|
*/
|
2005-09-28 04:40:40 +00:00
|
|
|
static inline struct device_node *xlate_iomm_address(
|
2007-12-06 14:49:27 +00:00
|
|
|
const volatile void __iomem *addr,
|
2007-12-06 14:52:45 +00:00
|
|
|
u64 *dsaptr, u64 *bar_offset, const char *func)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2007-12-06 14:49:27 +00:00
|
|
|
unsigned long orig_addr;
|
|
|
|
unsigned long base_addr;
|
|
|
|
unsigned long ind;
|
|
|
|
struct device_node *dn;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2007-12-06 14:49:27 +00:00
|
|
|
orig_addr = (unsigned long __force)addr;
|
2007-12-06 14:52:45 +00:00
|
|
|
if ((orig_addr < BASE_IO_MEMORY) || (orig_addr >= max_io_memory)) {
|
|
|
|
static unsigned long last_jiffies;
|
|
|
|
static int num_printed;
|
|
|
|
|
|
|
|
if ((jiffies - last_jiffies) > 60 * HZ) {
|
|
|
|
last_jiffies = jiffies;
|
|
|
|
num_printed = 0;
|
|
|
|
}
|
|
|
|
if (num_printed++ < 10)
|
|
|
|
printk(KERN_ERR
|
|
|
|
"iSeries_%s: invalid access at IO address %p\n",
|
|
|
|
func, addr);
|
2005-04-16 22:20:36 +00:00
|
|
|
return NULL;
|
2007-12-06 14:52:45 +00:00
|
|
|
}
|
2007-12-06 14:49:27 +00:00
|
|
|
base_addr = orig_addr - BASE_IO_MEMORY;
|
|
|
|
ind = base_addr / IOMM_TABLE_ENTRY_SIZE;
|
|
|
|
dn = iomm_table[ind];
|
|
|
|
|
|
|
|
if (dn != NULL) {
|
|
|
|
int barnum = iobar_table[ind];
|
|
|
|
*dsaptr = iseries_ds_addr(dn) | (barnum << 24);
|
|
|
|
*bar_offset = base_addr % IOMM_TABLE_ENTRY_SIZE;
|
2005-04-16 22:20:36 +00:00
|
|
|
} else
|
2007-12-06 14:49:27 +00:00
|
|
|
panic("PCI: Invalid PCI IO address detected!\n");
|
|
|
|
return dn;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Read MM I/O Instructions for the iSeries
|
|
|
|
* On MM I/O error, all ones are returned and iSeries_pci_IoError is cal
|
[POWERPC] Allow hooking of PCI MMIO & PIO accessors on 64 bits
This patch reworks the way iSeries hooks on PCI IO operations (both MMIO
and PIO) and provides a generic way for other platforms to do so (we
have need to do that for various other platforms).
While reworking the IO ops, I ended up doing some spring cleaning in
io.h and eeh.h which I might want to split into 2 or 3 patches (among
others, eeh.h had a lot of useless stuff in it).
A side effect is that EEH for PIO should work now (it used to pass IO
ports down to the eeh address check functions which is bogus).
Also, new are MMIO "repeat" ops, which other archs like ARM already had,
and that we have too now: readsb, readsw, readsl, writesb, writesw,
writesl.
In the long run, I might also make EEH use the hooks instead
of wrapping at the toplevel, which would make things even cleaner and
relegate EEH completely in platforms/iseries, but we have to measure the
performance impact there (though it's really only on MMIO reads)
Since I also need to hook on ioremap, I shuffled the functions a bit
there. I introduced ioremap_flags() to use by drivers who want to pass
explicit flags to ioremap (and it can be hooked). The old __ioremap() is
still there as a low level and cannot be hooked, thus drivers who use it
should migrate unless they know they want the low level version.
The patch "arch provides generic iomap missing accessors" (should be
number 4 in this series) is a pre-requisite to provide full iomap
API support with this patch.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-11-11 06:25:10 +00:00
|
|
|
* else, data is returned in Big Endian format.
|
2005-04-16 22:20:36 +00:00
|
|
|
*/
|
2007-12-06 14:53:44 +00:00
|
|
|
static u8 iseries_readb(const volatile void __iomem *addr)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2007-12-06 14:49:27 +00:00
|
|
|
u64 bar_offset;
|
2005-04-16 22:20:36 +00:00
|
|
|
u64 dsa;
|
2005-06-22 00:15:47 +00:00
|
|
|
int retry = 0;
|
2005-04-16 22:20:36 +00:00
|
|
|
struct HvCallPci_LoadReturn ret;
|
2007-12-06 14:49:27 +00:00
|
|
|
struct device_node *dn =
|
2007-12-06 14:52:45 +00:00
|
|
|
xlate_iomm_address(addr, &dsa, &bar_offset, "read_byte");
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2007-12-06 14:52:45 +00:00
|
|
|
if (dn == NULL)
|
2005-04-16 22:20:36 +00:00
|
|
|
return 0xff;
|
|
|
|
do {
|
2007-12-06 14:49:27 +00:00
|
|
|
HvCall3Ret16(HvCallPciBarLoad8, &ret, dsa, bar_offset, 0);
|
|
|
|
} while (check_return_code("RDB", dn, &retry, ret.rc) != 0);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
[POWERPC] Allow hooking of PCI MMIO & PIO accessors on 64 bits
This patch reworks the way iSeries hooks on PCI IO operations (both MMIO
and PIO) and provides a generic way for other platforms to do so (we
have need to do that for various other platforms).
While reworking the IO ops, I ended up doing some spring cleaning in
io.h and eeh.h which I might want to split into 2 or 3 patches (among
others, eeh.h had a lot of useless stuff in it).
A side effect is that EEH for PIO should work now (it used to pass IO
ports down to the eeh address check functions which is bogus).
Also, new are MMIO "repeat" ops, which other archs like ARM already had,
and that we have too now: readsb, readsw, readsl, writesb, writesw,
writesl.
In the long run, I might also make EEH use the hooks instead
of wrapping at the toplevel, which would make things even cleaner and
relegate EEH completely in platforms/iseries, but we have to measure the
performance impact there (though it's really only on MMIO reads)
Since I also need to hook on ioremap, I shuffled the functions a bit
there. I introduced ioremap_flags() to use by drivers who want to pass
explicit flags to ioremap (and it can be hooked). The old __ioremap() is
still there as a low level and cannot be hooked, thus drivers who use it
should migrate unless they know they want the low level version.
The patch "arch provides generic iomap missing accessors" (should be
number 4 in this series) is a pre-requisite to provide full iomap
API support with this patch.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-11-11 06:25:10 +00:00
|
|
|
return ret.value;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2007-12-06 14:53:44 +00:00
|
|
|
static u16 iseries_readw_be(const volatile void __iomem *addr)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2007-12-06 14:49:27 +00:00
|
|
|
u64 bar_offset;
|
2005-04-16 22:20:36 +00:00
|
|
|
u64 dsa;
|
2005-06-22 00:15:47 +00:00
|
|
|
int retry = 0;
|
2005-04-16 22:20:36 +00:00
|
|
|
struct HvCallPci_LoadReturn ret;
|
2007-12-06 14:49:27 +00:00
|
|
|
struct device_node *dn =
|
2007-12-06 14:52:45 +00:00
|
|
|
xlate_iomm_address(addr, &dsa, &bar_offset, "read_word");
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2007-12-06 14:52:45 +00:00
|
|
|
if (dn == NULL)
|
2005-04-16 22:20:36 +00:00
|
|
|
return 0xffff;
|
|
|
|
do {
|
|
|
|
HvCall3Ret16(HvCallPciBarLoad16, &ret, dsa,
|
2007-12-06 14:49:27 +00:00
|
|
|
bar_offset, 0);
|
|
|
|
} while (check_return_code("RDW", dn, &retry, ret.rc) != 0);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
[POWERPC] Allow hooking of PCI MMIO & PIO accessors on 64 bits
This patch reworks the way iSeries hooks on PCI IO operations (both MMIO
and PIO) and provides a generic way for other platforms to do so (we
have need to do that for various other platforms).
While reworking the IO ops, I ended up doing some spring cleaning in
io.h and eeh.h which I might want to split into 2 or 3 patches (among
others, eeh.h had a lot of useless stuff in it).
A side effect is that EEH for PIO should work now (it used to pass IO
ports down to the eeh address check functions which is bogus).
Also, new are MMIO "repeat" ops, which other archs like ARM already had,
and that we have too now: readsb, readsw, readsl, writesb, writesw,
writesl.
In the long run, I might also make EEH use the hooks instead
of wrapping at the toplevel, which would make things even cleaner and
relegate EEH completely in platforms/iseries, but we have to measure the
performance impact there (though it's really only on MMIO reads)
Since I also need to hook on ioremap, I shuffled the functions a bit
there. I introduced ioremap_flags() to use by drivers who want to pass
explicit flags to ioremap (and it can be hooked). The old __ioremap() is
still there as a low level and cannot be hooked, thus drivers who use it
should migrate unless they know they want the low level version.
The patch "arch provides generic iomap missing accessors" (should be
number 4 in this series) is a pre-requisite to provide full iomap
API support with this patch.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-11-11 06:25:10 +00:00
|
|
|
return ret.value;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2007-12-06 14:53:44 +00:00
|
|
|
static u32 iseries_readl_be(const volatile void __iomem *addr)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2007-12-06 14:49:27 +00:00
|
|
|
u64 bar_offset;
|
2005-04-16 22:20:36 +00:00
|
|
|
u64 dsa;
|
2005-06-22 00:15:47 +00:00
|
|
|
int retry = 0;
|
2005-04-16 22:20:36 +00:00
|
|
|
struct HvCallPci_LoadReturn ret;
|
2007-12-06 14:49:27 +00:00
|
|
|
struct device_node *dn =
|
2007-12-06 14:52:45 +00:00
|
|
|
xlate_iomm_address(addr, &dsa, &bar_offset, "read_long");
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2007-12-06 14:52:45 +00:00
|
|
|
if (dn == NULL)
|
2005-04-16 22:20:36 +00:00
|
|
|
return 0xffffffff;
|
|
|
|
do {
|
|
|
|
HvCall3Ret16(HvCallPciBarLoad32, &ret, dsa,
|
2007-12-06 14:49:27 +00:00
|
|
|
bar_offset, 0);
|
|
|
|
} while (check_return_code("RDL", dn, &retry, ret.rc) != 0);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
[POWERPC] Allow hooking of PCI MMIO & PIO accessors on 64 bits
This patch reworks the way iSeries hooks on PCI IO operations (both MMIO
and PIO) and provides a generic way for other platforms to do so (we
have need to do that for various other platforms).
While reworking the IO ops, I ended up doing some spring cleaning in
io.h and eeh.h which I might want to split into 2 or 3 patches (among
others, eeh.h had a lot of useless stuff in it).
A side effect is that EEH for PIO should work now (it used to pass IO
ports down to the eeh address check functions which is bogus).
Also, new are MMIO "repeat" ops, which other archs like ARM already had,
and that we have too now: readsb, readsw, readsl, writesb, writesw,
writesl.
In the long run, I might also make EEH use the hooks instead
of wrapping at the toplevel, which would make things even cleaner and
relegate EEH completely in platforms/iseries, but we have to measure the
performance impact there (though it's really only on MMIO reads)
Since I also need to hook on ioremap, I shuffled the functions a bit
there. I introduced ioremap_flags() to use by drivers who want to pass
explicit flags to ioremap (and it can be hooked). The old __ioremap() is
still there as a low level and cannot be hooked, thus drivers who use it
should migrate unless they know they want the low level version.
The patch "arch provides generic iomap missing accessors" (should be
number 4 in this series) is a pre-requisite to provide full iomap
API support with this patch.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-11-11 06:25:10 +00:00
|
|
|
return ret.value;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Write MM I/O Instructions for the iSeries
|
|
|
|
*
|
|
|
|
*/
|
2007-12-06 14:53:44 +00:00
|
|
|
static void iseries_writeb(u8 data, volatile void __iomem *addr)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2007-12-06 14:49:27 +00:00
|
|
|
u64 bar_offset;
|
2005-04-16 22:20:36 +00:00
|
|
|
u64 dsa;
|
2005-06-22 00:15:47 +00:00
|
|
|
int retry = 0;
|
2005-04-16 22:20:36 +00:00
|
|
|
u64 rc;
|
2007-12-06 14:49:27 +00:00
|
|
|
struct device_node *dn =
|
2007-12-06 14:52:45 +00:00
|
|
|
xlate_iomm_address(addr, &dsa, &bar_offset, "write_byte");
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2007-12-06 14:52:45 +00:00
|
|
|
if (dn == NULL)
|
2005-04-16 22:20:36 +00:00
|
|
|
return;
|
|
|
|
do {
|
2007-12-06 14:49:27 +00:00
|
|
|
rc = HvCall4(HvCallPciBarStore8, dsa, bar_offset, data, 0);
|
|
|
|
} while (check_return_code("WWB", dn, &retry, rc) != 0);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2007-12-06 14:53:44 +00:00
|
|
|
static void iseries_writew_be(u16 data, volatile void __iomem *addr)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2007-12-06 14:49:27 +00:00
|
|
|
u64 bar_offset;
|
2005-04-16 22:20:36 +00:00
|
|
|
u64 dsa;
|
2005-06-22 00:15:47 +00:00
|
|
|
int retry = 0;
|
2005-04-16 22:20:36 +00:00
|
|
|
u64 rc;
|
2007-12-06 14:49:27 +00:00
|
|
|
struct device_node *dn =
|
2007-12-06 14:52:45 +00:00
|
|
|
xlate_iomm_address(addr, &dsa, &bar_offset, "write_word");
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2007-12-06 14:52:45 +00:00
|
|
|
if (dn == NULL)
|
2005-04-16 22:20:36 +00:00
|
|
|
return;
|
|
|
|
do {
|
2007-12-06 14:49:27 +00:00
|
|
|
rc = HvCall4(HvCallPciBarStore16, dsa, bar_offset, data, 0);
|
|
|
|
} while (check_return_code("WWW", dn, &retry, rc) != 0);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2007-12-06 14:53:44 +00:00
|
|
|
static void iseries_writel_be(u32 data, volatile void __iomem *addr)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2007-12-06 14:49:27 +00:00
|
|
|
u64 bar_offset;
|
2005-04-16 22:20:36 +00:00
|
|
|
u64 dsa;
|
2005-06-22 00:15:47 +00:00
|
|
|
int retry = 0;
|
2005-04-16 22:20:36 +00:00
|
|
|
u64 rc;
|
2007-12-06 14:49:27 +00:00
|
|
|
struct device_node *dn =
|
2007-12-06 14:52:45 +00:00
|
|
|
xlate_iomm_address(addr, &dsa, &bar_offset, "write_long");
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2007-12-06 14:52:45 +00:00
|
|
|
if (dn == NULL)
|
2005-04-16 22:20:36 +00:00
|
|
|
return;
|
|
|
|
do {
|
2007-12-06 14:49:27 +00:00
|
|
|
rc = HvCall4(HvCallPciBarStore32, dsa, bar_offset, data, 0);
|
|
|
|
} while (check_return_code("WWL", dn, &retry, rc) != 0);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
2006-09-21 08:00:00 +00:00
|
|
|
|
[POWERPC] Allow hooking of PCI MMIO & PIO accessors on 64 bits
This patch reworks the way iSeries hooks on PCI IO operations (both MMIO
and PIO) and provides a generic way for other platforms to do so (we
have need to do that for various other platforms).
While reworking the IO ops, I ended up doing some spring cleaning in
io.h and eeh.h which I might want to split into 2 or 3 patches (among
others, eeh.h had a lot of useless stuff in it).
A side effect is that EEH for PIO should work now (it used to pass IO
ports down to the eeh address check functions which is bogus).
Also, new are MMIO "repeat" ops, which other archs like ARM already had,
and that we have too now: readsb, readsw, readsl, writesb, writesw,
writesl.
In the long run, I might also make EEH use the hooks instead
of wrapping at the toplevel, which would make things even cleaner and
relegate EEH completely in platforms/iseries, but we have to measure the
performance impact there (though it's really only on MMIO reads)
Since I also need to hook on ioremap, I shuffled the functions a bit
there. I introduced ioremap_flags() to use by drivers who want to pass
explicit flags to ioremap (and it can be hooked). The old __ioremap() is
still there as a low level and cannot be hooked, thus drivers who use it
should migrate unless they know they want the low level version.
The patch "arch provides generic iomap missing accessors" (should be
number 4 in this series) is a pre-requisite to provide full iomap
API support with this patch.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-11-11 06:25:10 +00:00
|
|
|
static u16 iseries_readw(const volatile void __iomem *addr)
|
2006-09-21 08:00:00 +00:00
|
|
|
{
|
2007-12-06 14:53:44 +00:00
|
|
|
return le16_to_cpu(iseries_readw_be(addr));
|
2006-09-21 08:00:00 +00:00
|
|
|
}
|
|
|
|
|
[POWERPC] Allow hooking of PCI MMIO & PIO accessors on 64 bits
This patch reworks the way iSeries hooks on PCI IO operations (both MMIO
and PIO) and provides a generic way for other platforms to do so (we
have need to do that for various other platforms).
While reworking the IO ops, I ended up doing some spring cleaning in
io.h and eeh.h which I might want to split into 2 or 3 patches (among
others, eeh.h had a lot of useless stuff in it).
A side effect is that EEH for PIO should work now (it used to pass IO
ports down to the eeh address check functions which is bogus).
Also, new are MMIO "repeat" ops, which other archs like ARM already had,
and that we have too now: readsb, readsw, readsl, writesb, writesw,
writesl.
In the long run, I might also make EEH use the hooks instead
of wrapping at the toplevel, which would make things even cleaner and
relegate EEH completely in platforms/iseries, but we have to measure the
performance impact there (though it's really only on MMIO reads)
Since I also need to hook on ioremap, I shuffled the functions a bit
there. I introduced ioremap_flags() to use by drivers who want to pass
explicit flags to ioremap (and it can be hooked). The old __ioremap() is
still there as a low level and cannot be hooked, thus drivers who use it
should migrate unless they know they want the low level version.
The patch "arch provides generic iomap missing accessors" (should be
number 4 in this series) is a pre-requisite to provide full iomap
API support with this patch.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-11-11 06:25:10 +00:00
|
|
|
static u32 iseries_readl(const volatile void __iomem *addr)
|
2006-09-21 08:00:00 +00:00
|
|
|
{
|
2007-12-06 14:53:44 +00:00
|
|
|
return le32_to_cpu(iseries_readl_be(addr));
|
2006-09-21 08:00:00 +00:00
|
|
|
}
|
|
|
|
|
[POWERPC] Allow hooking of PCI MMIO & PIO accessors on 64 bits
This patch reworks the way iSeries hooks on PCI IO operations (both MMIO
and PIO) and provides a generic way for other platforms to do so (we
have need to do that for various other platforms).
While reworking the IO ops, I ended up doing some spring cleaning in
io.h and eeh.h which I might want to split into 2 or 3 patches (among
others, eeh.h had a lot of useless stuff in it).
A side effect is that EEH for PIO should work now (it used to pass IO
ports down to the eeh address check functions which is bogus).
Also, new are MMIO "repeat" ops, which other archs like ARM already had,
and that we have too now: readsb, readsw, readsl, writesb, writesw,
writesl.
In the long run, I might also make EEH use the hooks instead
of wrapping at the toplevel, which would make things even cleaner and
relegate EEH completely in platforms/iseries, but we have to measure the
performance impact there (though it's really only on MMIO reads)
Since I also need to hook on ioremap, I shuffled the functions a bit
there. I introduced ioremap_flags() to use by drivers who want to pass
explicit flags to ioremap (and it can be hooked). The old __ioremap() is
still there as a low level and cannot be hooked, thus drivers who use it
should migrate unless they know they want the low level version.
The patch "arch provides generic iomap missing accessors" (should be
number 4 in this series) is a pre-requisite to provide full iomap
API support with this patch.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-11-11 06:25:10 +00:00
|
|
|
static void iseries_writew(u16 data, volatile void __iomem *addr)
|
2006-09-21 08:00:00 +00:00
|
|
|
{
|
2007-12-06 14:53:44 +00:00
|
|
|
iseries_writew_be(cpu_to_le16(data), addr);
|
2006-09-21 08:00:00 +00:00
|
|
|
}
|
|
|
|
|
[POWERPC] Allow hooking of PCI MMIO & PIO accessors on 64 bits
This patch reworks the way iSeries hooks on PCI IO operations (both MMIO
and PIO) and provides a generic way for other platforms to do so (we
have need to do that for various other platforms).
While reworking the IO ops, I ended up doing some spring cleaning in
io.h and eeh.h which I might want to split into 2 or 3 patches (among
others, eeh.h had a lot of useless stuff in it).
A side effect is that EEH for PIO should work now (it used to pass IO
ports down to the eeh address check functions which is bogus).
Also, new are MMIO "repeat" ops, which other archs like ARM already had,
and that we have too now: readsb, readsw, readsl, writesb, writesw,
writesl.
In the long run, I might also make EEH use the hooks instead
of wrapping at the toplevel, which would make things even cleaner and
relegate EEH completely in platforms/iseries, but we have to measure the
performance impact there (though it's really only on MMIO reads)
Since I also need to hook on ioremap, I shuffled the functions a bit
there. I introduced ioremap_flags() to use by drivers who want to pass
explicit flags to ioremap (and it can be hooked). The old __ioremap() is
still there as a low level and cannot be hooked, thus drivers who use it
should migrate unless they know they want the low level version.
The patch "arch provides generic iomap missing accessors" (should be
number 4 in this series) is a pre-requisite to provide full iomap
API support with this patch.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-11-11 06:25:10 +00:00
|
|
|
static void iseries_writel(u32 data, volatile void __iomem *addr)
|
2006-09-21 08:00:00 +00:00
|
|
|
{
|
2007-12-06 14:53:44 +00:00
|
|
|
iseries_writel(cpu_to_le32(data), addr);
|
2006-09-21 08:00:00 +00:00
|
|
|
}
|
|
|
|
|
[POWERPC] Allow hooking of PCI MMIO & PIO accessors on 64 bits
This patch reworks the way iSeries hooks on PCI IO operations (both MMIO
and PIO) and provides a generic way for other platforms to do so (we
have need to do that for various other platforms).
While reworking the IO ops, I ended up doing some spring cleaning in
io.h and eeh.h which I might want to split into 2 or 3 patches (among
others, eeh.h had a lot of useless stuff in it).
A side effect is that EEH for PIO should work now (it used to pass IO
ports down to the eeh address check functions which is bogus).
Also, new are MMIO "repeat" ops, which other archs like ARM already had,
and that we have too now: readsb, readsw, readsl, writesb, writesw,
writesl.
In the long run, I might also make EEH use the hooks instead
of wrapping at the toplevel, which would make things even cleaner and
relegate EEH completely in platforms/iseries, but we have to measure the
performance impact there (though it's really only on MMIO reads)
Since I also need to hook on ioremap, I shuffled the functions a bit
there. I introduced ioremap_flags() to use by drivers who want to pass
explicit flags to ioremap (and it can be hooked). The old __ioremap() is
still there as a low level and cannot be hooked, thus drivers who use it
should migrate unless they know they want the low level version.
The patch "arch provides generic iomap missing accessors" (should be
number 4 in this series) is a pre-requisite to provide full iomap
API support with this patch.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-11-11 06:25:10 +00:00
|
|
|
static void iseries_readsb(const volatile void __iomem *addr, void *buf,
|
|
|
|
unsigned long count)
|
2006-09-21 08:00:00 +00:00
|
|
|
{
|
[POWERPC] Allow hooking of PCI MMIO & PIO accessors on 64 bits
This patch reworks the way iSeries hooks on PCI IO operations (both MMIO
and PIO) and provides a generic way for other platforms to do so (we
have need to do that for various other platforms).
While reworking the IO ops, I ended up doing some spring cleaning in
io.h and eeh.h which I might want to split into 2 or 3 patches (among
others, eeh.h had a lot of useless stuff in it).
A side effect is that EEH for PIO should work now (it used to pass IO
ports down to the eeh address check functions which is bogus).
Also, new are MMIO "repeat" ops, which other archs like ARM already had,
and that we have too now: readsb, readsw, readsl, writesb, writesw,
writesl.
In the long run, I might also make EEH use the hooks instead
of wrapping at the toplevel, which would make things even cleaner and
relegate EEH completely in platforms/iseries, but we have to measure the
performance impact there (though it's really only on MMIO reads)
Since I also need to hook on ioremap, I shuffled the functions a bit
there. I introduced ioremap_flags() to use by drivers who want to pass
explicit flags to ioremap (and it can be hooked). The old __ioremap() is
still there as a low level and cannot be hooked, thus drivers who use it
should migrate unless they know they want the low level version.
The patch "arch provides generic iomap missing accessors" (should be
number 4 in this series) is a pre-requisite to provide full iomap
API support with this patch.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-11-11 06:25:10 +00:00
|
|
|
u8 *dst = buf;
|
|
|
|
while(count-- > 0)
|
2007-12-06 14:53:44 +00:00
|
|
|
*(dst++) = iseries_readb(addr);
|
2006-09-21 08:00:00 +00:00
|
|
|
}
|
|
|
|
|
[POWERPC] Allow hooking of PCI MMIO & PIO accessors on 64 bits
This patch reworks the way iSeries hooks on PCI IO operations (both MMIO
and PIO) and provides a generic way for other platforms to do so (we
have need to do that for various other platforms).
While reworking the IO ops, I ended up doing some spring cleaning in
io.h and eeh.h which I might want to split into 2 or 3 patches (among
others, eeh.h had a lot of useless stuff in it).
A side effect is that EEH for PIO should work now (it used to pass IO
ports down to the eeh address check functions which is bogus).
Also, new are MMIO "repeat" ops, which other archs like ARM already had,
and that we have too now: readsb, readsw, readsl, writesb, writesw,
writesl.
In the long run, I might also make EEH use the hooks instead
of wrapping at the toplevel, which would make things even cleaner and
relegate EEH completely in platforms/iseries, but we have to measure the
performance impact there (though it's really only on MMIO reads)
Since I also need to hook on ioremap, I shuffled the functions a bit
there. I introduced ioremap_flags() to use by drivers who want to pass
explicit flags to ioremap (and it can be hooked). The old __ioremap() is
still there as a low level and cannot be hooked, thus drivers who use it
should migrate unless they know they want the low level version.
The patch "arch provides generic iomap missing accessors" (should be
number 4 in this series) is a pre-requisite to provide full iomap
API support with this patch.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-11-11 06:25:10 +00:00
|
|
|
static void iseries_readsw(const volatile void __iomem *addr, void *buf,
|
|
|
|
unsigned long count)
|
2006-09-21 08:00:00 +00:00
|
|
|
{
|
[POWERPC] Allow hooking of PCI MMIO & PIO accessors on 64 bits
This patch reworks the way iSeries hooks on PCI IO operations (both MMIO
and PIO) and provides a generic way for other platforms to do so (we
have need to do that for various other platforms).
While reworking the IO ops, I ended up doing some spring cleaning in
io.h and eeh.h which I might want to split into 2 or 3 patches (among
others, eeh.h had a lot of useless stuff in it).
A side effect is that EEH for PIO should work now (it used to pass IO
ports down to the eeh address check functions which is bogus).
Also, new are MMIO "repeat" ops, which other archs like ARM already had,
and that we have too now: readsb, readsw, readsl, writesb, writesw,
writesl.
In the long run, I might also make EEH use the hooks instead
of wrapping at the toplevel, which would make things even cleaner and
relegate EEH completely in platforms/iseries, but we have to measure the
performance impact there (though it's really only on MMIO reads)
Since I also need to hook on ioremap, I shuffled the functions a bit
there. I introduced ioremap_flags() to use by drivers who want to pass
explicit flags to ioremap (and it can be hooked). The old __ioremap() is
still there as a low level and cannot be hooked, thus drivers who use it
should migrate unless they know they want the low level version.
The patch "arch provides generic iomap missing accessors" (should be
number 4 in this series) is a pre-requisite to provide full iomap
API support with this patch.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-11-11 06:25:10 +00:00
|
|
|
u16 *dst = buf;
|
|
|
|
while(count-- > 0)
|
2007-12-06 14:53:44 +00:00
|
|
|
*(dst++) = iseries_readw_be(addr);
|
2006-09-21 08:00:00 +00:00
|
|
|
}
|
|
|
|
|
[POWERPC] Allow hooking of PCI MMIO & PIO accessors on 64 bits
This patch reworks the way iSeries hooks on PCI IO operations (both MMIO
and PIO) and provides a generic way for other platforms to do so (we
have need to do that for various other platforms).
While reworking the IO ops, I ended up doing some spring cleaning in
io.h and eeh.h which I might want to split into 2 or 3 patches (among
others, eeh.h had a lot of useless stuff in it).
A side effect is that EEH for PIO should work now (it used to pass IO
ports down to the eeh address check functions which is bogus).
Also, new are MMIO "repeat" ops, which other archs like ARM already had,
and that we have too now: readsb, readsw, readsl, writesb, writesw,
writesl.
In the long run, I might also make EEH use the hooks instead
of wrapping at the toplevel, which would make things even cleaner and
relegate EEH completely in platforms/iseries, but we have to measure the
performance impact there (though it's really only on MMIO reads)
Since I also need to hook on ioremap, I shuffled the functions a bit
there. I introduced ioremap_flags() to use by drivers who want to pass
explicit flags to ioremap (and it can be hooked). The old __ioremap() is
still there as a low level and cannot be hooked, thus drivers who use it
should migrate unless they know they want the low level version.
The patch "arch provides generic iomap missing accessors" (should be
number 4 in this series) is a pre-requisite to provide full iomap
API support with this patch.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-11-11 06:25:10 +00:00
|
|
|
static void iseries_readsl(const volatile void __iomem *addr, void *buf,
|
|
|
|
unsigned long count)
|
2006-09-21 08:00:00 +00:00
|
|
|
{
|
[POWERPC] Allow hooking of PCI MMIO & PIO accessors on 64 bits
This patch reworks the way iSeries hooks on PCI IO operations (both MMIO
and PIO) and provides a generic way for other platforms to do so (we
have need to do that for various other platforms).
While reworking the IO ops, I ended up doing some spring cleaning in
io.h and eeh.h which I might want to split into 2 or 3 patches (among
others, eeh.h had a lot of useless stuff in it).
A side effect is that EEH for PIO should work now (it used to pass IO
ports down to the eeh address check functions which is bogus).
Also, new are MMIO "repeat" ops, which other archs like ARM already had,
and that we have too now: readsb, readsw, readsl, writesb, writesw,
writesl.
In the long run, I might also make EEH use the hooks instead
of wrapping at the toplevel, which would make things even cleaner and
relegate EEH completely in platforms/iseries, but we have to measure the
performance impact there (though it's really only on MMIO reads)
Since I also need to hook on ioremap, I shuffled the functions a bit
there. I introduced ioremap_flags() to use by drivers who want to pass
explicit flags to ioremap (and it can be hooked). The old __ioremap() is
still there as a low level and cannot be hooked, thus drivers who use it
should migrate unless they know they want the low level version.
The patch "arch provides generic iomap missing accessors" (should be
number 4 in this series) is a pre-requisite to provide full iomap
API support with this patch.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-11-11 06:25:10 +00:00
|
|
|
u32 *dst = buf;
|
|
|
|
while(count-- > 0)
|
2007-12-06 14:53:44 +00:00
|
|
|
*(dst++) = iseries_readl_be(addr);
|
2006-09-21 08:00:00 +00:00
|
|
|
}
|
|
|
|
|
[POWERPC] Allow hooking of PCI MMIO & PIO accessors on 64 bits
This patch reworks the way iSeries hooks on PCI IO operations (both MMIO
and PIO) and provides a generic way for other platforms to do so (we
have need to do that for various other platforms).
While reworking the IO ops, I ended up doing some spring cleaning in
io.h and eeh.h which I might want to split into 2 or 3 patches (among
others, eeh.h had a lot of useless stuff in it).
A side effect is that EEH for PIO should work now (it used to pass IO
ports down to the eeh address check functions which is bogus).
Also, new are MMIO "repeat" ops, which other archs like ARM already had,
and that we have too now: readsb, readsw, readsl, writesb, writesw,
writesl.
In the long run, I might also make EEH use the hooks instead
of wrapping at the toplevel, which would make things even cleaner and
relegate EEH completely in platforms/iseries, but we have to measure the
performance impact there (though it's really only on MMIO reads)
Since I also need to hook on ioremap, I shuffled the functions a bit
there. I introduced ioremap_flags() to use by drivers who want to pass
explicit flags to ioremap (and it can be hooked). The old __ioremap() is
still there as a low level and cannot be hooked, thus drivers who use it
should migrate unless they know they want the low level version.
The patch "arch provides generic iomap missing accessors" (should be
number 4 in this series) is a pre-requisite to provide full iomap
API support with this patch.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-11-11 06:25:10 +00:00
|
|
|
static void iseries_writesb(volatile void __iomem *addr, const void *buf,
|
|
|
|
unsigned long count)
|
2006-09-21 08:00:00 +00:00
|
|
|
{
|
[POWERPC] Allow hooking of PCI MMIO & PIO accessors on 64 bits
This patch reworks the way iSeries hooks on PCI IO operations (both MMIO
and PIO) and provides a generic way for other platforms to do so (we
have need to do that for various other platforms).
While reworking the IO ops, I ended up doing some spring cleaning in
io.h and eeh.h which I might want to split into 2 or 3 patches (among
others, eeh.h had a lot of useless stuff in it).
A side effect is that EEH for PIO should work now (it used to pass IO
ports down to the eeh address check functions which is bogus).
Also, new are MMIO "repeat" ops, which other archs like ARM already had,
and that we have too now: readsb, readsw, readsl, writesb, writesw,
writesl.
In the long run, I might also make EEH use the hooks instead
of wrapping at the toplevel, which would make things even cleaner and
relegate EEH completely in platforms/iseries, but we have to measure the
performance impact there (though it's really only on MMIO reads)
Since I also need to hook on ioremap, I shuffled the functions a bit
there. I introduced ioremap_flags() to use by drivers who want to pass
explicit flags to ioremap (and it can be hooked). The old __ioremap() is
still there as a low level and cannot be hooked, thus drivers who use it
should migrate unless they know they want the low level version.
The patch "arch provides generic iomap missing accessors" (should be
number 4 in this series) is a pre-requisite to provide full iomap
API support with this patch.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-11-11 06:25:10 +00:00
|
|
|
const u8 *src = buf;
|
|
|
|
while(count-- > 0)
|
2007-12-06 14:53:44 +00:00
|
|
|
iseries_writeb(*(src++), addr);
|
2006-09-21 08:00:00 +00:00
|
|
|
}
|
|
|
|
|
[POWERPC] Allow hooking of PCI MMIO & PIO accessors on 64 bits
This patch reworks the way iSeries hooks on PCI IO operations (both MMIO
and PIO) and provides a generic way for other platforms to do so (we
have need to do that for various other platforms).
While reworking the IO ops, I ended up doing some spring cleaning in
io.h and eeh.h which I might want to split into 2 or 3 patches (among
others, eeh.h had a lot of useless stuff in it).
A side effect is that EEH for PIO should work now (it used to pass IO
ports down to the eeh address check functions which is bogus).
Also, new are MMIO "repeat" ops, which other archs like ARM already had,
and that we have too now: readsb, readsw, readsl, writesb, writesw,
writesl.
In the long run, I might also make EEH use the hooks instead
of wrapping at the toplevel, which would make things even cleaner and
relegate EEH completely in platforms/iseries, but we have to measure the
performance impact there (though it's really only on MMIO reads)
Since I also need to hook on ioremap, I shuffled the functions a bit
there. I introduced ioremap_flags() to use by drivers who want to pass
explicit flags to ioremap (and it can be hooked). The old __ioremap() is
still there as a low level and cannot be hooked, thus drivers who use it
should migrate unless they know they want the low level version.
The patch "arch provides generic iomap missing accessors" (should be
number 4 in this series) is a pre-requisite to provide full iomap
API support with this patch.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-11-11 06:25:10 +00:00
|
|
|
static void iseries_writesw(volatile void __iomem *addr, const void *buf,
|
|
|
|
unsigned long count)
|
2006-09-21 08:00:00 +00:00
|
|
|
{
|
[POWERPC] Allow hooking of PCI MMIO & PIO accessors on 64 bits
This patch reworks the way iSeries hooks on PCI IO operations (both MMIO
and PIO) and provides a generic way for other platforms to do so (we
have need to do that for various other platforms).
While reworking the IO ops, I ended up doing some spring cleaning in
io.h and eeh.h which I might want to split into 2 or 3 patches (among
others, eeh.h had a lot of useless stuff in it).
A side effect is that EEH for PIO should work now (it used to pass IO
ports down to the eeh address check functions which is bogus).
Also, new are MMIO "repeat" ops, which other archs like ARM already had,
and that we have too now: readsb, readsw, readsl, writesb, writesw,
writesl.
In the long run, I might also make EEH use the hooks instead
of wrapping at the toplevel, which would make things even cleaner and
relegate EEH completely in platforms/iseries, but we have to measure the
performance impact there (though it's really only on MMIO reads)
Since I also need to hook on ioremap, I shuffled the functions a bit
there. I introduced ioremap_flags() to use by drivers who want to pass
explicit flags to ioremap (and it can be hooked). The old __ioremap() is
still there as a low level and cannot be hooked, thus drivers who use it
should migrate unless they know they want the low level version.
The patch "arch provides generic iomap missing accessors" (should be
number 4 in this series) is a pre-requisite to provide full iomap
API support with this patch.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-11-11 06:25:10 +00:00
|
|
|
const u16 *src = buf;
|
|
|
|
while(count-- > 0)
|
2007-12-06 14:53:44 +00:00
|
|
|
iseries_writew_be(*(src++), addr);
|
2006-09-21 08:00:00 +00:00
|
|
|
}
|
|
|
|
|
[POWERPC] Allow hooking of PCI MMIO & PIO accessors on 64 bits
This patch reworks the way iSeries hooks on PCI IO operations (both MMIO
and PIO) and provides a generic way for other platforms to do so (we
have need to do that for various other platforms).
While reworking the IO ops, I ended up doing some spring cleaning in
io.h and eeh.h which I might want to split into 2 or 3 patches (among
others, eeh.h had a lot of useless stuff in it).
A side effect is that EEH for PIO should work now (it used to pass IO
ports down to the eeh address check functions which is bogus).
Also, new are MMIO "repeat" ops, which other archs like ARM already had,
and that we have too now: readsb, readsw, readsl, writesb, writesw,
writesl.
In the long run, I might also make EEH use the hooks instead
of wrapping at the toplevel, which would make things even cleaner and
relegate EEH completely in platforms/iseries, but we have to measure the
performance impact there (though it's really only on MMIO reads)
Since I also need to hook on ioremap, I shuffled the functions a bit
there. I introduced ioremap_flags() to use by drivers who want to pass
explicit flags to ioremap (and it can be hooked). The old __ioremap() is
still there as a low level and cannot be hooked, thus drivers who use it
should migrate unless they know they want the low level version.
The patch "arch provides generic iomap missing accessors" (should be
number 4 in this series) is a pre-requisite to provide full iomap
API support with this patch.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-11-11 06:25:10 +00:00
|
|
|
static void iseries_writesl(volatile void __iomem *addr, const void *buf,
|
|
|
|
unsigned long count)
|
2006-09-21 08:00:00 +00:00
|
|
|
{
|
[POWERPC] Allow hooking of PCI MMIO & PIO accessors on 64 bits
This patch reworks the way iSeries hooks on PCI IO operations (both MMIO
and PIO) and provides a generic way for other platforms to do so (we
have need to do that for various other platforms).
While reworking the IO ops, I ended up doing some spring cleaning in
io.h and eeh.h which I might want to split into 2 or 3 patches (among
others, eeh.h had a lot of useless stuff in it).
A side effect is that EEH for PIO should work now (it used to pass IO
ports down to the eeh address check functions which is bogus).
Also, new are MMIO "repeat" ops, which other archs like ARM already had,
and that we have too now: readsb, readsw, readsl, writesb, writesw,
writesl.
In the long run, I might also make EEH use the hooks instead
of wrapping at the toplevel, which would make things even cleaner and
relegate EEH completely in platforms/iseries, but we have to measure the
performance impact there (though it's really only on MMIO reads)
Since I also need to hook on ioremap, I shuffled the functions a bit
there. I introduced ioremap_flags() to use by drivers who want to pass
explicit flags to ioremap (and it can be hooked). The old __ioremap() is
still there as a low level and cannot be hooked, thus drivers who use it
should migrate unless they know they want the low level version.
The patch "arch provides generic iomap missing accessors" (should be
number 4 in this series) is a pre-requisite to provide full iomap
API support with this patch.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-11-11 06:25:10 +00:00
|
|
|
const u32 *src = buf;
|
|
|
|
while(count-- > 0)
|
2007-12-06 14:53:44 +00:00
|
|
|
iseries_writel_be(*(src++), addr);
|
2006-09-21 08:00:00 +00:00
|
|
|
}
|
|
|
|
|
[POWERPC] Allow hooking of PCI MMIO & PIO accessors on 64 bits
This patch reworks the way iSeries hooks on PCI IO operations (both MMIO
and PIO) and provides a generic way for other platforms to do so (we
have need to do that for various other platforms).
While reworking the IO ops, I ended up doing some spring cleaning in
io.h and eeh.h which I might want to split into 2 or 3 patches (among
others, eeh.h had a lot of useless stuff in it).
A side effect is that EEH for PIO should work now (it used to pass IO
ports down to the eeh address check functions which is bogus).
Also, new are MMIO "repeat" ops, which other archs like ARM already had,
and that we have too now: readsb, readsw, readsl, writesb, writesw,
writesl.
In the long run, I might also make EEH use the hooks instead
of wrapping at the toplevel, which would make things even cleaner and
relegate EEH completely in platforms/iseries, but we have to measure the
performance impact there (though it's really only on MMIO reads)
Since I also need to hook on ioremap, I shuffled the functions a bit
there. I introduced ioremap_flags() to use by drivers who want to pass
explicit flags to ioremap (and it can be hooked). The old __ioremap() is
still there as a low level and cannot be hooked, thus drivers who use it
should migrate unless they know they want the low level version.
The patch "arch provides generic iomap missing accessors" (should be
number 4 in this series) is a pre-requisite to provide full iomap
API support with this patch.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-11-11 06:25:10 +00:00
|
|
|
static void iseries_memset_io(volatile void __iomem *addr, int c,
|
|
|
|
unsigned long n)
|
2006-09-21 08:00:00 +00:00
|
|
|
{
|
[POWERPC] Allow hooking of PCI MMIO & PIO accessors on 64 bits
This patch reworks the way iSeries hooks on PCI IO operations (both MMIO
and PIO) and provides a generic way for other platforms to do so (we
have need to do that for various other platforms).
While reworking the IO ops, I ended up doing some spring cleaning in
io.h and eeh.h which I might want to split into 2 or 3 patches (among
others, eeh.h had a lot of useless stuff in it).
A side effect is that EEH for PIO should work now (it used to pass IO
ports down to the eeh address check functions which is bogus).
Also, new are MMIO "repeat" ops, which other archs like ARM already had,
and that we have too now: readsb, readsw, readsl, writesb, writesw,
writesl.
In the long run, I might also make EEH use the hooks instead
of wrapping at the toplevel, which would make things even cleaner and
relegate EEH completely in platforms/iseries, but we have to measure the
performance impact there (though it's really only on MMIO reads)
Since I also need to hook on ioremap, I shuffled the functions a bit
there. I introduced ioremap_flags() to use by drivers who want to pass
explicit flags to ioremap (and it can be hooked). The old __ioremap() is
still there as a low level and cannot be hooked, thus drivers who use it
should migrate unless they know they want the low level version.
The patch "arch provides generic iomap missing accessors" (should be
number 4 in this series) is a pre-requisite to provide full iomap
API support with this patch.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-11-11 06:25:10 +00:00
|
|
|
volatile char __iomem *d = addr;
|
2006-09-21 08:00:00 +00:00
|
|
|
|
[POWERPC] Allow hooking of PCI MMIO & PIO accessors on 64 bits
This patch reworks the way iSeries hooks on PCI IO operations (both MMIO
and PIO) and provides a generic way for other platforms to do so (we
have need to do that for various other platforms).
While reworking the IO ops, I ended up doing some spring cleaning in
io.h and eeh.h which I might want to split into 2 or 3 patches (among
others, eeh.h had a lot of useless stuff in it).
A side effect is that EEH for PIO should work now (it used to pass IO
ports down to the eeh address check functions which is bogus).
Also, new are MMIO "repeat" ops, which other archs like ARM already had,
and that we have too now: readsb, readsw, readsl, writesb, writesw,
writesl.
In the long run, I might also make EEH use the hooks instead
of wrapping at the toplevel, which would make things even cleaner and
relegate EEH completely in platforms/iseries, but we have to measure the
performance impact there (though it's really only on MMIO reads)
Since I also need to hook on ioremap, I shuffled the functions a bit
there. I introduced ioremap_flags() to use by drivers who want to pass
explicit flags to ioremap (and it can be hooked). The old __ioremap() is
still there as a low level and cannot be hooked, thus drivers who use it
should migrate unless they know they want the low level version.
The patch "arch provides generic iomap missing accessors" (should be
number 4 in this series) is a pre-requisite to provide full iomap
API support with this patch.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-11-11 06:25:10 +00:00
|
|
|
while (n-- > 0)
|
2007-12-06 14:53:44 +00:00
|
|
|
iseries_writeb(c, d++);
|
2006-09-21 08:00:00 +00:00
|
|
|
}
|
|
|
|
|
[POWERPC] Allow hooking of PCI MMIO & PIO accessors on 64 bits
This patch reworks the way iSeries hooks on PCI IO operations (both MMIO
and PIO) and provides a generic way for other platforms to do so (we
have need to do that for various other platforms).
While reworking the IO ops, I ended up doing some spring cleaning in
io.h and eeh.h which I might want to split into 2 or 3 patches (among
others, eeh.h had a lot of useless stuff in it).
A side effect is that EEH for PIO should work now (it used to pass IO
ports down to the eeh address check functions which is bogus).
Also, new are MMIO "repeat" ops, which other archs like ARM already had,
and that we have too now: readsb, readsw, readsl, writesb, writesw,
writesl.
In the long run, I might also make EEH use the hooks instead
of wrapping at the toplevel, which would make things even cleaner and
relegate EEH completely in platforms/iseries, but we have to measure the
performance impact there (though it's really only on MMIO reads)
Since I also need to hook on ioremap, I shuffled the functions a bit
there. I introduced ioremap_flags() to use by drivers who want to pass
explicit flags to ioremap (and it can be hooked). The old __ioremap() is
still there as a low level and cannot be hooked, thus drivers who use it
should migrate unless they know they want the low level version.
The patch "arch provides generic iomap missing accessors" (should be
number 4 in this series) is a pre-requisite to provide full iomap
API support with this patch.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-11-11 06:25:10 +00:00
|
|
|
static void iseries_memcpy_fromio(void *dest, const volatile void __iomem *src,
|
|
|
|
unsigned long n)
|
2006-09-21 08:00:00 +00:00
|
|
|
{
|
[POWERPC] Allow hooking of PCI MMIO & PIO accessors on 64 bits
This patch reworks the way iSeries hooks on PCI IO operations (both MMIO
and PIO) and provides a generic way for other platforms to do so (we
have need to do that for various other platforms).
While reworking the IO ops, I ended up doing some spring cleaning in
io.h and eeh.h which I might want to split into 2 or 3 patches (among
others, eeh.h had a lot of useless stuff in it).
A side effect is that EEH for PIO should work now (it used to pass IO
ports down to the eeh address check functions which is bogus).
Also, new are MMIO "repeat" ops, which other archs like ARM already had,
and that we have too now: readsb, readsw, readsl, writesb, writesw,
writesl.
In the long run, I might also make EEH use the hooks instead
of wrapping at the toplevel, which would make things even cleaner and
relegate EEH completely in platforms/iseries, but we have to measure the
performance impact there (though it's really only on MMIO reads)
Since I also need to hook on ioremap, I shuffled the functions a bit
there. I introduced ioremap_flags() to use by drivers who want to pass
explicit flags to ioremap (and it can be hooked). The old __ioremap() is
still there as a low level and cannot be hooked, thus drivers who use it
should migrate unless they know they want the low level version.
The patch "arch provides generic iomap missing accessors" (should be
number 4 in this series) is a pre-requisite to provide full iomap
API support with this patch.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-11-11 06:25:10 +00:00
|
|
|
char *d = dest;
|
|
|
|
const volatile char __iomem *s = src;
|
2006-09-21 08:00:00 +00:00
|
|
|
|
[POWERPC] Allow hooking of PCI MMIO & PIO accessors on 64 bits
This patch reworks the way iSeries hooks on PCI IO operations (both MMIO
and PIO) and provides a generic way for other platforms to do so (we
have need to do that for various other platforms).
While reworking the IO ops, I ended up doing some spring cleaning in
io.h and eeh.h which I might want to split into 2 or 3 patches (among
others, eeh.h had a lot of useless stuff in it).
A side effect is that EEH for PIO should work now (it used to pass IO
ports down to the eeh address check functions which is bogus).
Also, new are MMIO "repeat" ops, which other archs like ARM already had,
and that we have too now: readsb, readsw, readsl, writesb, writesw,
writesl.
In the long run, I might also make EEH use the hooks instead
of wrapping at the toplevel, which would make things even cleaner and
relegate EEH completely in platforms/iseries, but we have to measure the
performance impact there (though it's really only on MMIO reads)
Since I also need to hook on ioremap, I shuffled the functions a bit
there. I introduced ioremap_flags() to use by drivers who want to pass
explicit flags to ioremap (and it can be hooked). The old __ioremap() is
still there as a low level and cannot be hooked, thus drivers who use it
should migrate unless they know they want the low level version.
The patch "arch provides generic iomap missing accessors" (should be
number 4 in this series) is a pre-requisite to provide full iomap
API support with this patch.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-11-11 06:25:10 +00:00
|
|
|
while (n-- > 0)
|
2007-12-06 14:53:44 +00:00
|
|
|
*d++ = iseries_readb(s++);
|
2006-09-21 08:00:00 +00:00
|
|
|
}
|
|
|
|
|
[POWERPC] Allow hooking of PCI MMIO & PIO accessors on 64 bits
This patch reworks the way iSeries hooks on PCI IO operations (both MMIO
and PIO) and provides a generic way for other platforms to do so (we
have need to do that for various other platforms).
While reworking the IO ops, I ended up doing some spring cleaning in
io.h and eeh.h which I might want to split into 2 or 3 patches (among
others, eeh.h had a lot of useless stuff in it).
A side effect is that EEH for PIO should work now (it used to pass IO
ports down to the eeh address check functions which is bogus).
Also, new are MMIO "repeat" ops, which other archs like ARM already had,
and that we have too now: readsb, readsw, readsl, writesb, writesw,
writesl.
In the long run, I might also make EEH use the hooks instead
of wrapping at the toplevel, which would make things even cleaner and
relegate EEH completely in platforms/iseries, but we have to measure the
performance impact there (though it's really only on MMIO reads)
Since I also need to hook on ioremap, I shuffled the functions a bit
there. I introduced ioremap_flags() to use by drivers who want to pass
explicit flags to ioremap (and it can be hooked). The old __ioremap() is
still there as a low level and cannot be hooked, thus drivers who use it
should migrate unless they know they want the low level version.
The patch "arch provides generic iomap missing accessors" (should be
number 4 in this series) is a pre-requisite to provide full iomap
API support with this patch.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-11-11 06:25:10 +00:00
|
|
|
static void iseries_memcpy_toio(volatile void __iomem *dest, const void *src,
|
|
|
|
unsigned long n)
|
2006-09-21 08:00:00 +00:00
|
|
|
{
|
[POWERPC] Allow hooking of PCI MMIO & PIO accessors on 64 bits
This patch reworks the way iSeries hooks on PCI IO operations (both MMIO
and PIO) and provides a generic way for other platforms to do so (we
have need to do that for various other platforms).
While reworking the IO ops, I ended up doing some spring cleaning in
io.h and eeh.h which I might want to split into 2 or 3 patches (among
others, eeh.h had a lot of useless stuff in it).
A side effect is that EEH for PIO should work now (it used to pass IO
ports down to the eeh address check functions which is bogus).
Also, new are MMIO "repeat" ops, which other archs like ARM already had,
and that we have too now: readsb, readsw, readsl, writesb, writesw,
writesl.
In the long run, I might also make EEH use the hooks instead
of wrapping at the toplevel, which would make things even cleaner and
relegate EEH completely in platforms/iseries, but we have to measure the
performance impact there (though it's really only on MMIO reads)
Since I also need to hook on ioremap, I shuffled the functions a bit
there. I introduced ioremap_flags() to use by drivers who want to pass
explicit flags to ioremap (and it can be hooked). The old __ioremap() is
still there as a low level and cannot be hooked, thus drivers who use it
should migrate unless they know they want the low level version.
The patch "arch provides generic iomap missing accessors" (should be
number 4 in this series) is a pre-requisite to provide full iomap
API support with this patch.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-11-11 06:25:10 +00:00
|
|
|
const char *s = src;
|
|
|
|
volatile char __iomem *d = dest;
|
2006-09-21 08:00:00 +00:00
|
|
|
|
[POWERPC] Allow hooking of PCI MMIO & PIO accessors on 64 bits
This patch reworks the way iSeries hooks on PCI IO operations (both MMIO
and PIO) and provides a generic way for other platforms to do so (we
have need to do that for various other platforms).
While reworking the IO ops, I ended up doing some spring cleaning in
io.h and eeh.h which I might want to split into 2 or 3 patches (among
others, eeh.h had a lot of useless stuff in it).
A side effect is that EEH for PIO should work now (it used to pass IO
ports down to the eeh address check functions which is bogus).
Also, new are MMIO "repeat" ops, which other archs like ARM already had,
and that we have too now: readsb, readsw, readsl, writesb, writesw,
writesl.
In the long run, I might also make EEH use the hooks instead
of wrapping at the toplevel, which would make things even cleaner and
relegate EEH completely in platforms/iseries, but we have to measure the
performance impact there (though it's really only on MMIO reads)
Since I also need to hook on ioremap, I shuffled the functions a bit
there. I introduced ioremap_flags() to use by drivers who want to pass
explicit flags to ioremap (and it can be hooked). The old __ioremap() is
still there as a low level and cannot be hooked, thus drivers who use it
should migrate unless they know they want the low level version.
The patch "arch provides generic iomap missing accessors" (should be
number 4 in this series) is a pre-requisite to provide full iomap
API support with this patch.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-11-11 06:25:10 +00:00
|
|
|
while (n-- > 0)
|
2007-12-06 14:53:44 +00:00
|
|
|
iseries_writeb(*s++, d++);
|
2006-09-21 08:00:00 +00:00
|
|
|
}
|
|
|
|
|
[POWERPC] Allow hooking of PCI MMIO & PIO accessors on 64 bits
This patch reworks the way iSeries hooks on PCI IO operations (both MMIO
and PIO) and provides a generic way for other platforms to do so (we
have need to do that for various other platforms).
While reworking the IO ops, I ended up doing some spring cleaning in
io.h and eeh.h which I might want to split into 2 or 3 patches (among
others, eeh.h had a lot of useless stuff in it).
A side effect is that EEH for PIO should work now (it used to pass IO
ports down to the eeh address check functions which is bogus).
Also, new are MMIO "repeat" ops, which other archs like ARM already had,
and that we have too now: readsb, readsw, readsl, writesb, writesw,
writesl.
In the long run, I might also make EEH use the hooks instead
of wrapping at the toplevel, which would make things even cleaner and
relegate EEH completely in platforms/iseries, but we have to measure the
performance impact there (though it's really only on MMIO reads)
Since I also need to hook on ioremap, I shuffled the functions a bit
there. I introduced ioremap_flags() to use by drivers who want to pass
explicit flags to ioremap (and it can be hooked). The old __ioremap() is
still there as a low level and cannot be hooked, thus drivers who use it
should migrate unless they know they want the low level version.
The patch "arch provides generic iomap missing accessors" (should be
number 4 in this series) is a pre-requisite to provide full iomap
API support with this patch.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-11-11 06:25:10 +00:00
|
|
|
/* We only set MMIO ops. The default PIO ops will be default
|
|
|
|
* to the MMIO ops + pci_io_base which is 0 on iSeries as
|
|
|
|
* expected so both should work.
|
|
|
|
*
|
|
|
|
* Note that we don't implement the readq/writeq versions as
|
|
|
|
* I don't know of an HV call for doing so. Thus, the default
|
|
|
|
* operation will be used instead, which will fault a the value
|
|
|
|
* return by iSeries for MMIO addresses always hits a non mapped
|
|
|
|
* area. This is as good as the BUG() we used to have there.
|
|
|
|
*/
|
|
|
|
static struct ppc_pci_io __initdata iseries_pci_io = {
|
|
|
|
.readb = iseries_readb,
|
|
|
|
.readw = iseries_readw,
|
|
|
|
.readl = iseries_readl,
|
|
|
|
.readw_be = iseries_readw_be,
|
|
|
|
.readl_be = iseries_readl_be,
|
|
|
|
.writeb = iseries_writeb,
|
|
|
|
.writew = iseries_writew,
|
|
|
|
.writel = iseries_writel,
|
|
|
|
.writew_be = iseries_writew_be,
|
|
|
|
.writel_be = iseries_writel_be,
|
|
|
|
.readsb = iseries_readsb,
|
|
|
|
.readsw = iseries_readsw,
|
|
|
|
.readsl = iseries_readsl,
|
|
|
|
.writesb = iseries_writesb,
|
|
|
|
.writesw = iseries_writesw,
|
|
|
|
.writesl = iseries_writesl,
|
|
|
|
.memset_io = iseries_memset_io,
|
|
|
|
.memcpy_fromio = iseries_memcpy_fromio,
|
|
|
|
.memcpy_toio = iseries_memcpy_toio,
|
|
|
|
};
|
2006-09-21 08:00:00 +00:00
|
|
|
|
[POWERPC] Allow hooking of PCI MMIO & PIO accessors on 64 bits
This patch reworks the way iSeries hooks on PCI IO operations (both MMIO
and PIO) and provides a generic way for other platforms to do so (we
have need to do that for various other platforms).
While reworking the IO ops, I ended up doing some spring cleaning in
io.h and eeh.h which I might want to split into 2 or 3 patches (among
others, eeh.h had a lot of useless stuff in it).
A side effect is that EEH for PIO should work now (it used to pass IO
ports down to the eeh address check functions which is bogus).
Also, new are MMIO "repeat" ops, which other archs like ARM already had,
and that we have too now: readsb, readsw, readsl, writesb, writesw,
writesl.
In the long run, I might also make EEH use the hooks instead
of wrapping at the toplevel, which would make things even cleaner and
relegate EEH completely in platforms/iseries, but we have to measure the
performance impact there (though it's really only on MMIO reads)
Since I also need to hook on ioremap, I shuffled the functions a bit
there. I introduced ioremap_flags() to use by drivers who want to pass
explicit flags to ioremap (and it can be hooked). The old __ioremap() is
still there as a low level and cannot be hooked, thus drivers who use it
should migrate unless they know they want the low level version.
The patch "arch provides generic iomap missing accessors" (should be
number 4 in this series) is a pre-requisite to provide full iomap
API support with this patch.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-11-11 06:25:10 +00:00
|
|
|
/*
|
|
|
|
* iSeries_pcibios_init
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* This function checks for all possible system PCI host bridges that connect
|
|
|
|
* PCI buses. The system hypervisor is queried as to the guest partition
|
|
|
|
* ownership status. A pci_controller is built for any bus which is partially
|
|
|
|
* owned or fully owned by this guest partition.
|
|
|
|
*/
|
|
|
|
void __init iSeries_pcibios_init(void)
|
2006-09-21 08:00:00 +00:00
|
|
|
{
|
[POWERPC] Allow hooking of PCI MMIO & PIO accessors on 64 bits
This patch reworks the way iSeries hooks on PCI IO operations (both MMIO
and PIO) and provides a generic way for other platforms to do so (we
have need to do that for various other platforms).
While reworking the IO ops, I ended up doing some spring cleaning in
io.h and eeh.h which I might want to split into 2 or 3 patches (among
others, eeh.h had a lot of useless stuff in it).
A side effect is that EEH for PIO should work now (it used to pass IO
ports down to the eeh address check functions which is bogus).
Also, new are MMIO "repeat" ops, which other archs like ARM already had,
and that we have too now: readsb, readsw, readsl, writesb, writesw,
writesl.
In the long run, I might also make EEH use the hooks instead
of wrapping at the toplevel, which would make things even cleaner and
relegate EEH completely in platforms/iseries, but we have to measure the
performance impact there (though it's really only on MMIO reads)
Since I also need to hook on ioremap, I shuffled the functions a bit
there. I introduced ioremap_flags() to use by drivers who want to pass
explicit flags to ioremap (and it can be hooked). The old __ioremap() is
still there as a low level and cannot be hooked, thus drivers who use it
should migrate unless they know they want the low level version.
The patch "arch provides generic iomap missing accessors" (should be
number 4 in this series) is a pre-requisite to provide full iomap
API support with this patch.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-11-11 06:25:10 +00:00
|
|
|
struct pci_controller *phb;
|
|
|
|
struct device_node *root = of_find_node_by_path("/");
|
|
|
|
struct device_node *node = NULL;
|
2006-09-21 08:00:00 +00:00
|
|
|
|
[POWERPC] Allow hooking of PCI MMIO & PIO accessors on 64 bits
This patch reworks the way iSeries hooks on PCI IO operations (both MMIO
and PIO) and provides a generic way for other platforms to do so (we
have need to do that for various other platforms).
While reworking the IO ops, I ended up doing some spring cleaning in
io.h and eeh.h which I might want to split into 2 or 3 patches (among
others, eeh.h had a lot of useless stuff in it).
A side effect is that EEH for PIO should work now (it used to pass IO
ports down to the eeh address check functions which is bogus).
Also, new are MMIO "repeat" ops, which other archs like ARM already had,
and that we have too now: readsb, readsw, readsl, writesb, writesw,
writesl.
In the long run, I might also make EEH use the hooks instead
of wrapping at the toplevel, which would make things even cleaner and
relegate EEH completely in platforms/iseries, but we have to measure the
performance impact there (though it's really only on MMIO reads)
Since I also need to hook on ioremap, I shuffled the functions a bit
there. I introduced ioremap_flags() to use by drivers who want to pass
explicit flags to ioremap (and it can be hooked). The old __ioremap() is
still there as a low level and cannot be hooked, thus drivers who use it
should migrate unless they know they want the low level version.
The patch "arch provides generic iomap missing accessors" (should be
number 4 in this series) is a pre-requisite to provide full iomap
API support with this patch.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-11-11 06:25:10 +00:00
|
|
|
/* Install IO hooks */
|
|
|
|
ppc_pci_io = iseries_pci_io;
|
2006-09-21 08:00:00 +00:00
|
|
|
|
[POWERPC] Rewrite IO allocation & mapping on powerpc64
This rewrites pretty much from scratch the handling of MMIO and PIO
space allocations on powerpc64. The main goals are:
- Get rid of imalloc and use more common code where possible
- Simplify the current mess so that PIO space is allocated and
mapped in a single place for PCI bridges
- Handle allocation constraints of PIO for all bridges including
hot plugged ones within the 2GB space reserved for IO ports,
so that devices on hotplugged busses will now work with drivers
that assume IO ports fit in an int.
- Cleanup and separate tracking of the ISA space in the reserved
low 64K of IO space. No ISA -> Nothing mapped there.
I booted a cell blade with IDE on PIO and MMIO and a dual G5 so
far, that's it :-)
With this patch, all allocations are done using the code in
mm/vmalloc.c, though we use the low level __get_vm_area with
explicit start/stop constraints in order to manage separate
areas for vmalloc/vmap, ioremap, and PCI IOs.
This greatly simplifies a lot of things, as you can see in the
diffstat of that patch :-)
A new pair of functions pcibios_map/unmap_io_space() now replace
all of the previous code that used to manipulate PCI IOs space.
The allocation is done at mapping time, which is now called from
scan_phb's, just before the devices are probed (instead of after,
which is by itself a bug fix). The only other caller is the PCI
hotplug code for hot adding PCI-PCI bridges (slots).
imalloc is gone, as is the "sub-allocation" thing, but I do beleive
that hotplug should still work in the sense that the space allocation
is always done by the PHB, but if you unmap a child bus of this PHB
(which seems to be possible), then the code should properly tear
down all the HPTE mappings for that area of the PHB allocated IO space.
I now always reserve the first 64K of IO space for the bridge with
the ISA bus on it. I have moved the code for tracking ISA in a separate
file which should also make it smarter if we ever are capable of
hot unplugging or re-plugging an ISA bridge.
This should have a side effect on platforms like powermac where VGA IOs
will no longer work. This is done on purpose though as they would have
worked semi-randomly before. The idea at this point is to isolate drivers
that might need to access those and fix them by providing a proper
function to obtain an offset to the legacy IOs of a given bus.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-06-04 05:15:36 +00:00
|
|
|
/* iSeries has no IO space in the common sense, it needs to set
|
|
|
|
* the IO base to 0
|
|
|
|
*/
|
|
|
|
pci_io_base = 0;
|
|
|
|
|
[POWERPC] Allow hooking of PCI MMIO & PIO accessors on 64 bits
This patch reworks the way iSeries hooks on PCI IO operations (both MMIO
and PIO) and provides a generic way for other platforms to do so (we
have need to do that for various other platforms).
While reworking the IO ops, I ended up doing some spring cleaning in
io.h and eeh.h which I might want to split into 2 or 3 patches (among
others, eeh.h had a lot of useless stuff in it).
A side effect is that EEH for PIO should work now (it used to pass IO
ports down to the eeh address check functions which is bogus).
Also, new are MMIO "repeat" ops, which other archs like ARM already had,
and that we have too now: readsb, readsw, readsl, writesb, writesw,
writesl.
In the long run, I might also make EEH use the hooks instead
of wrapping at the toplevel, which would make things even cleaner and
relegate EEH completely in platforms/iseries, but we have to measure the
performance impact there (though it's really only on MMIO reads)
Since I also need to hook on ioremap, I shuffled the functions a bit
there. I introduced ioremap_flags() to use by drivers who want to pass
explicit flags to ioremap (and it can be hooked). The old __ioremap() is
still there as a low level and cannot be hooked, thus drivers who use it
should migrate unless they know they want the low level version.
The patch "arch provides generic iomap missing accessors" (should be
number 4 in this series) is a pre-requisite to provide full iomap
API support with this patch.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-11-11 06:25:10 +00:00
|
|
|
if (root == NULL) {
|
|
|
|
printk(KERN_CRIT "iSeries_pcibios_init: can't find root "
|
|
|
|
"of device tree\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
while ((node = of_get_next_child(root, node)) != NULL) {
|
|
|
|
HvBusNumber bus;
|
|
|
|
const u32 *busp;
|
2006-09-21 08:00:00 +00:00
|
|
|
|
[POWERPC] Allow hooking of PCI MMIO & PIO accessors on 64 bits
This patch reworks the way iSeries hooks on PCI IO operations (both MMIO
and PIO) and provides a generic way for other platforms to do so (we
have need to do that for various other platforms).
While reworking the IO ops, I ended up doing some spring cleaning in
io.h and eeh.h which I might want to split into 2 or 3 patches (among
others, eeh.h had a lot of useless stuff in it).
A side effect is that EEH for PIO should work now (it used to pass IO
ports down to the eeh address check functions which is bogus).
Also, new are MMIO "repeat" ops, which other archs like ARM already had,
and that we have too now: readsb, readsw, readsl, writesb, writesw,
writesl.
In the long run, I might also make EEH use the hooks instead
of wrapping at the toplevel, which would make things even cleaner and
relegate EEH completely in platforms/iseries, but we have to measure the
performance impact there (though it's really only on MMIO reads)
Since I also need to hook on ioremap, I shuffled the functions a bit
there. I introduced ioremap_flags() to use by drivers who want to pass
explicit flags to ioremap (and it can be hooked). The old __ioremap() is
still there as a low level and cannot be hooked, thus drivers who use it
should migrate unless they know they want the low level version.
The patch "arch provides generic iomap missing accessors" (should be
number 4 in this series) is a pre-requisite to provide full iomap
API support with this patch.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-11-11 06:25:10 +00:00
|
|
|
if ((node->type == NULL) || (strcmp(node->type, "pci") != 0))
|
|
|
|
continue;
|
2006-09-21 08:00:00 +00:00
|
|
|
|
2007-04-03 12:26:41 +00:00
|
|
|
busp = of_get_property(node, "bus-range", NULL);
|
[POWERPC] Allow hooking of PCI MMIO & PIO accessors on 64 bits
This patch reworks the way iSeries hooks on PCI IO operations (both MMIO
and PIO) and provides a generic way for other platforms to do so (we
have need to do that for various other platforms).
While reworking the IO ops, I ended up doing some spring cleaning in
io.h and eeh.h which I might want to split into 2 or 3 patches (among
others, eeh.h had a lot of useless stuff in it).
A side effect is that EEH for PIO should work now (it used to pass IO
ports down to the eeh address check functions which is bogus).
Also, new are MMIO "repeat" ops, which other archs like ARM already had,
and that we have too now: readsb, readsw, readsl, writesb, writesw,
writesl.
In the long run, I might also make EEH use the hooks instead
of wrapping at the toplevel, which would make things even cleaner and
relegate EEH completely in platforms/iseries, but we have to measure the
performance impact there (though it's really only on MMIO reads)
Since I also need to hook on ioremap, I shuffled the functions a bit
there. I introduced ioremap_flags() to use by drivers who want to pass
explicit flags to ioremap (and it can be hooked). The old __ioremap() is
still there as a low level and cannot be hooked, thus drivers who use it
should migrate unless they know they want the low level version.
The patch "arch provides generic iomap missing accessors" (should be
number 4 in this series) is a pre-requisite to provide full iomap
API support with this patch.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-11-11 06:25:10 +00:00
|
|
|
if (busp == NULL)
|
|
|
|
continue;
|
|
|
|
bus = *busp;
|
|
|
|
printk("bus %d appears to exist\n", bus);
|
|
|
|
phb = pcibios_alloc_controller(node);
|
|
|
|
if (phb == NULL)
|
|
|
|
continue;
|
2006-09-21 08:00:00 +00:00
|
|
|
|
2007-06-27 05:19:08 +00:00
|
|
|
phb->pci_mem_offset = bus;
|
[POWERPC] Allow hooking of PCI MMIO & PIO accessors on 64 bits
This patch reworks the way iSeries hooks on PCI IO operations (both MMIO
and PIO) and provides a generic way for other platforms to do so (we
have need to do that for various other platforms).
While reworking the IO ops, I ended up doing some spring cleaning in
io.h and eeh.h which I might want to split into 2 or 3 patches (among
others, eeh.h had a lot of useless stuff in it).
A side effect is that EEH for PIO should work now (it used to pass IO
ports down to the eeh address check functions which is bogus).
Also, new are MMIO "repeat" ops, which other archs like ARM already had,
and that we have too now: readsb, readsw, readsl, writesb, writesw,
writesl.
In the long run, I might also make EEH use the hooks instead
of wrapping at the toplevel, which would make things even cleaner and
relegate EEH completely in platforms/iseries, but we have to measure the
performance impact there (though it's really only on MMIO reads)
Since I also need to hook on ioremap, I shuffled the functions a bit
there. I introduced ioremap_flags() to use by drivers who want to pass
explicit flags to ioremap (and it can be hooked). The old __ioremap() is
still there as a low level and cannot be hooked, thus drivers who use it
should migrate unless they know they want the low level version.
The patch "arch provides generic iomap missing accessors" (should be
number 4 in this series) is a pre-requisite to provide full iomap
API support with this patch.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-11-11 06:25:10 +00:00
|
|
|
phb->first_busno = bus;
|
|
|
|
phb->last_busno = bus;
|
|
|
|
phb->ops = &iSeries_pci_ops;
|
|
|
|
}
|
2006-09-21 08:00:00 +00:00
|
|
|
|
[POWERPC] Allow hooking of PCI MMIO & PIO accessors on 64 bits
This patch reworks the way iSeries hooks on PCI IO operations (both MMIO
and PIO) and provides a generic way for other platforms to do so (we
have need to do that for various other platforms).
While reworking the IO ops, I ended up doing some spring cleaning in
io.h and eeh.h which I might want to split into 2 or 3 patches (among
others, eeh.h had a lot of useless stuff in it).
A side effect is that EEH for PIO should work now (it used to pass IO
ports down to the eeh address check functions which is bogus).
Also, new are MMIO "repeat" ops, which other archs like ARM already had,
and that we have too now: readsb, readsw, readsl, writesb, writesw,
writesl.
In the long run, I might also make EEH use the hooks instead
of wrapping at the toplevel, which would make things even cleaner and
relegate EEH completely in platforms/iseries, but we have to measure the
performance impact there (though it's really only on MMIO reads)
Since I also need to hook on ioremap, I shuffled the functions a bit
there. I introduced ioremap_flags() to use by drivers who want to pass
explicit flags to ioremap (and it can be hooked). The old __ioremap() is
still there as a low level and cannot be hooked, thus drivers who use it
should migrate unless they know they want the low level version.
The patch "arch provides generic iomap missing accessors" (should be
number 4 in this series) is a pre-requisite to provide full iomap
API support with this patch.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-11-11 06:25:10 +00:00
|
|
|
of_node_put(root);
|
2006-09-21 08:00:00 +00:00
|
|
|
|
[POWERPC] Allow hooking of PCI MMIO & PIO accessors on 64 bits
This patch reworks the way iSeries hooks on PCI IO operations (both MMIO
and PIO) and provides a generic way for other platforms to do so (we
have need to do that for various other platforms).
While reworking the IO ops, I ended up doing some spring cleaning in
io.h and eeh.h which I might want to split into 2 or 3 patches (among
others, eeh.h had a lot of useless stuff in it).
A side effect is that EEH for PIO should work now (it used to pass IO
ports down to the eeh address check functions which is bogus).
Also, new are MMIO "repeat" ops, which other archs like ARM already had,
and that we have too now: readsb, readsw, readsl, writesb, writesw,
writesl.
In the long run, I might also make EEH use the hooks instead
of wrapping at the toplevel, which would make things even cleaner and
relegate EEH completely in platforms/iseries, but we have to measure the
performance impact there (though it's really only on MMIO reads)
Since I also need to hook on ioremap, I shuffled the functions a bit
there. I introduced ioremap_flags() to use by drivers who want to pass
explicit flags to ioremap (and it can be hooked). The old __ioremap() is
still there as a low level and cannot be hooked, thus drivers who use it
should migrate unless they know they want the low level version.
The patch "arch provides generic iomap missing accessors" (should be
number 4 in this series) is a pre-requisite to provide full iomap
API support with this patch.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-11-11 06:25:10 +00:00
|
|
|
pci_devs_phb_init();
|
2006-09-21 08:00:00 +00:00
|
|
|
}
|
[POWERPC] Allow hooking of PCI MMIO & PIO accessors on 64 bits
This patch reworks the way iSeries hooks on PCI IO operations (both MMIO
and PIO) and provides a generic way for other platforms to do so (we
have need to do that for various other platforms).
While reworking the IO ops, I ended up doing some spring cleaning in
io.h and eeh.h which I might want to split into 2 or 3 patches (among
others, eeh.h had a lot of useless stuff in it).
A side effect is that EEH for PIO should work now (it used to pass IO
ports down to the eeh address check functions which is bogus).
Also, new are MMIO "repeat" ops, which other archs like ARM already had,
and that we have too now: readsb, readsw, readsl, writesb, writesw,
writesl.
In the long run, I might also make EEH use the hooks instead
of wrapping at the toplevel, which would make things even cleaner and
relegate EEH completely in platforms/iseries, but we have to measure the
performance impact there (though it's really only on MMIO reads)
Since I also need to hook on ioremap, I shuffled the functions a bit
there. I introduced ioremap_flags() to use by drivers who want to pass
explicit flags to ioremap (and it can be hooked). The old __ioremap() is
still there as a low level and cannot be hooked, thus drivers who use it
should migrate unless they know they want the low level version.
The patch "arch provides generic iomap missing accessors" (should be
number 4 in this series) is a pre-requisite to provide full iomap
API support with this patch.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-11-11 06:25:10 +00:00
|
|
|
|