/*
* PCI / PCI-X / PCI-Express support for 4xx parts
*
* Copyright 2007 Ben. Herrenschmidt <benh@kernel.crashing.org>, IBM Corp.
*
* Most PCI Express code is coming from Stefan Roese implementation for
* arch/ppc in the Denx tree, slightly reworked by me.
*
* Copyright 2007 DENX Software Engineering, Stefan Roese <sr@denx.de>
*
* Some of that comes itself from a previous implementation for 440SPE only
* by Roland Dreier:
*
* Copyright (c) 2005 Cisco Systems. All rights reserved.
* Roland Dreier <rolandd@cisco.com>
*
*/
#include <linux/kernel.h>
#include <linux/pci.h>
#include <linux/init.h>
#include <linux/of.h>
#include <linux/bootmem.h>
#include <linux/delay.h>
#include <asm/io.h>
#include <asm/pci-bridge.h>
#include <asm/machdep.h>
#include <asm/dcr.h>
#include <asm/dcr-regs.h>
#include "ppc4xx_pci.h"
static int dma_offset_set;
/* Move that to a useable header */
extern unsigned long total_memory;
#define U64_TO_U32_LOW(val) ((u32)((val) & 0x00000000ffffffffULL))
#define U64_TO_U32_HIGH(val) ((u32)((val) >> 32))
#ifdef CONFIG_RESOURCES_64BIT
#define RES_TO_U32_LOW(val) U64_TO_U32_LOW(val)
#define RES_TO_U32_HIGH(val) U64_TO_U32_HIGH(val)
#else
#define RES_TO_U32_LOW(val) (val)
#define RES_TO_U32_HIGH(val) (0)
#endif
static void fixup_ppc4xx_pci_bridge(struct pci_dev *dev)
{
struct pci_controller *hose;
int i;
if (dev->devfn != 0 || dev->bus->self != NULL)
return;
hose = pci_bus_to_host(dev->bus);
if (hose == NULL)
return;
if (!of_device_is_compatible(