2006-01-15 12:05:47 +01:00
|
|
|
/*
|
|
|
|
* Common pmac/prep/chrp pci routines. -- Cort
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/pci.h>
|
|
|
|
#include <linux/delay.h>
|
|
|
|
#include <linux/string.h>
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/capability.h>
|
|
|
|
#include <linux/sched.h>
|
|
|
|
#include <linux/errno.h>
|
|
|
|
#include <linux/bootmem.h>
|
[PATCH] powerpc: fix trigger handling in the new irq code
This patch slightly reworks the new irq code to fix a small design error. I
removed the passing of the trigger to the map() calls entirely, it was not a
good idea to have one call do two different things. It also fixes a couple of
corner cases.
Mapping a linux virtual irq to a physical irq now does only that. Setting the
trigger is a different action which has a different call.
The main changes are:
- I no longer call host->ops->map() for an already mapped irq, I just return
the virtual number that was already mapped. It was called before to give an
opportunity to change the trigger, but that was causing issues as that could
happen while the interrupt was in use by a device, and because of the
trigger change, map would potentially muck around with things in a racy way.
That was causing much burden on a given's controller implementation of
map() to get it right. This is much simpler now. map() is only called on
the initial mapping of an irq, meaning that you know that this irq is _not_
being used. You can initialize the hardware if you want (though you don't
have to).
- Controllers that can handle different type of triggers (level/edge/etc...)
now implement the standard irq_chip->set_type() call as defined by the
generic code. That means that you can use the standard set_irq_type() to
configure an irq line manually if you wish or (though I don't like that
interface), pass explicit trigger flags to request_irq() as defined by the
generic kernel interfaces. Also, using those interfaces guarantees that
your controller set_type callback is called with the descriptor lock held,
thus providing locking against activity on the same interrupt (including
mask/unmask/etc...) automatically. A result is that, for example, MPIC's
own map() implementation calls irq_set_type(NONE) to configure the hardware
to the default triggers.
- To allow the above, the irq_map array entry for the new mapped interrupt
is now set before map() callback is called for the controller.
- The irq_create_of_mapping() (also used by irq_of_parse_and_map()) function
for mapping interrupts from the device-tree now also call the separate
set_irq_type(), and only does so if there is a change in the trigger type.
- While I was at it, I changed pci_read_irq_line() (which is the helper I
would expect most archs to use in their pcibios_fixup() to get the PCI
interrupt routing from the device tree) to also handle a fallback when the
DT mapping fails consisting of reading the PCI_INTERRUPT_PIN to know wether
the device has an interrupt at all, and the the PCI_INTERRUPT_LINE to get an
interrupt number from the device. That number is then mapped using the
default controller, and the trigger is set to level low. That default
behaviour works for several platforms that don't have a proper interrupt
tree like Pegasos. If it doesn't work for your platform, then either
provide a proper interrupt tree from the firmware so that fallback isn't
needed, or don't call pci_read_irq_line()
- Add back a bit that got dropped by my main rework patch for properly
clearing pending IPIs on pSeries when using a kexec
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-07-10 13:44:42 +02:00
|
|
|
#include <linux/irq.h>
|
2006-11-11 07:24:51 +01:00
|
|
|
#include <linux/list.h>
|
2007-12-21 05:52:43 +01:00
|
|
|
#include <linux/of.h>
|
include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.
percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.
http://userweb.kernel.org/~tj/misc/slabh-sweep.py
The script does the followings.
* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.
* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.
* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.
The conversion was done in the following steps.
1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.
2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.
3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.
4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.
5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.
6. percpu.h was updated not to include slab.h.
7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).
* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig
8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.
Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.
Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-24 09:04:11 +01:00
|
|
|
#include <linux/slab.h>
|
2011-07-29 08:19:31 +02:00
|
|
|
#include <linux/export.h>
|
2006-01-15 12:05:47 +01:00
|
|
|
|
|
|
|
#include <asm/processor.h>
|
|
|
|
#include <asm/io.h>
|
|
|
|
#include <asm/prom.h>
|
|
|
|
#include <asm/sections.h>
|
|
|
|
#include <asm/pci-bridge.h>
|
2009-01-08 03:19:46 +01:00
|
|
|
#include <asm/ppc-pci.h>
|
2006-01-15 12:05:47 +01:00
|
|
|
#include <asm/byteorder.h>
|
2016-12-24 20:46:01 +01:00
|
|
|
#include <linux/uaccess.h>
|
2006-01-15 12:05:47 +01:00
|
|
|
#include <asm/machdep.h>
|
|
|
|
|
|
|
|
#undef DEBUG
|
|
|
|
|
|
|
|
unsigned long isa_io_base = 0;
|
|
|
|
unsigned long pci_dram_offset = 0;
|
|
|
|
int pcibios_assign_bus_offset = 1;
|
2016-01-14 05:33:46 +01:00
|
|
|
EXPORT_SYMBOL(isa_io_base);
|
|
|
|
EXPORT_SYMBOL(pci_dram_offset);
|
2006-01-15 12:05:47 +01:00
|
|
|
|
|
|
|
void pcibios_make_OF_bus_map(void);
|
|
|
|
|
|
|
|
static void fixup_cpc710_pci64(struct pci_dev* dev);
|
|
|
|
static u8* pci_to_OF_bus_map;
|
|
|
|
|
|
|
|
/* By default, we don't re-assign bus numbers. We do this only on
|
|
|
|
* some pmacs
|
|
|
|
*/
|
2007-12-20 04:54:46 +01:00
|
|
|
static int pci_assign_all_buses;
|
2006-01-15 12:05:47 +01:00
|
|
|
|
|
|
|
static int pci_bus_count;
|
|
|
|
|
2008-10-13 19:51:46 +02:00
|
|
|
/* This will remain NULL for now, until isa-bridge.c is made common
|
|
|
|
* to both 32-bit and 64-bit.
|
|
|
|
*/
|
|
|
|
struct pci_dev *isa_bridge_pcidev;
|
|
|
|
EXPORT_SYMBOL_GPL(isa_bridge_pcidev);
|
|
|
|
|
2006-01-15 12:05:47 +01:00
|
|
|
static void
|
|
|
|
fixup_cpc710_pci64(struct pci_dev* dev)
|
|
|
|
{
|
|
|
|
/* Hide the PCI64 BARs from the kernel as their content doesn't
|
|
|
|
* fit well in the resource management
|
|
|
|
*/
|
|
|
|
dev->resource[0].start = dev->resource[0].end = 0;
|
|
|
|
dev->resource[0].flags = 0;
|
|
|
|
dev->resource[1].start = dev->resource[1].end = 0;
|
|
|
|
dev->resource[1].flags = 0;
|
|
|
|
}
|
|
|
|
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_CPC710_PCI64, fixup_cpc710_pci64);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Functions below are used on OpenFirmware machines.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
make_one_node_map(struct device_node* node, u8 pci_bus)
|
|
|
|
{
|
2006-07-12 07:35:54 +02:00
|
|
|
const int *bus_range;
|
2006-01-15 12:05:47 +01:00
|
|
|
int len;
|
|
|
|
|
|
|
|
if (pci_bus >= pci_bus_count)
|
|
|
|
return;
|
2007-04-03 14:26:41 +02:00
|
|
|
bus_range = of_get_property(node, "bus-range", &len);
|
2006-01-15 12:05:47 +01:00
|
|
|
if (bus_range == NULL || len < 2 * sizeof(int)) {
|
|
|
|
printk(KERN_WARNING "Can't get bus-range for %s, "
|
|
|
|
"assuming it starts at 0\n", node->full_name);
|
|
|
|
pci_to_OF_bus_map[pci_bus] = 0;
|
|
|
|
} else
|
|
|
|
pci_to_OF_bus_map[pci_bus] = bus_range[0];
|
|
|
|
|
2007-12-21 05:52:43 +01:00
|
|
|
for_each_child_of_node(node, node) {
|
2006-01-15 12:05:47 +01:00
|
|
|
struct pci_dev* dev;
|
2006-07-12 07:35:54 +02:00
|
|
|
const unsigned int *class_code, *reg;
|
2006-01-15 12:05:47 +01:00
|
|
|
|
2007-04-03 14:26:41 +02:00
|
|
|
class_code = of_get_property(node, "class-code", NULL);
|
2006-01-15 12:05:47 +01:00
|
|
|
if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI &&
|
|
|
|
(*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS))
|
|
|
|
continue;
|
2007-04-03 14:26:41 +02:00
|
|
|
reg = of_get_property(node, "reg", NULL);
|
2006-01-15 12:05:47 +01:00
|
|
|
if (!reg)
|
|
|
|
continue;
|
2007-04-23 15:47:59 +02:00
|
|
|
dev = pci_get_bus_and_slot(pci_bus, ((reg[0] >> 8) & 0xff));
|
|
|
|
if (!dev || !dev->subordinate) {
|
|
|
|
pci_dev_put(dev);
|
2006-01-15 12:05:47 +01:00
|
|
|
continue;
|
2007-04-23 15:47:59 +02:00
|
|
|
}
|
2006-01-15 12:05:47 +01:00
|
|
|
make_one_node_map(node, dev->subordinate->number);
|
2007-04-23 15:47:59 +02:00
|
|
|
pci_dev_put(dev);
|
2006-01-15 12:05:47 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
pcibios_make_OF_bus_map(void)
|
|
|
|
{
|
|
|
|
int i;
|
2007-06-27 20:09:43 +02:00
|
|
|
struct pci_controller *hose, *tmp;
|
2006-07-12 07:35:54 +02:00
|
|
|
struct property *map_prop;
|
2007-04-24 05:50:55 +02:00
|
|
|
struct device_node *dn;
|
2006-01-15 12:05:47 +01:00
|
|
|
|
2006-12-13 09:35:56 +01:00
|
|
|
pci_to_OF_bus_map = kmalloc(pci_bus_count, GFP_KERNEL);
|
2006-01-15 12:05:47 +01:00
|
|
|
if (!pci_to_OF_bus_map) {
|
|
|
|
printk(KERN_ERR "Can't allocate OF bus map !\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* We fill the bus map with invalid values, that helps
|
|
|
|
* debugging.
|
|
|
|
*/
|
|
|
|
for (i=0; i<pci_bus_count; i++)
|
|
|
|
pci_to_OF_bus_map[i] = 0xff;
|
|
|
|
|
|
|
|
/* For each hose, we begin searching bridges */
|
2007-06-27 20:09:43 +02:00
|
|
|
list_for_each_entry_safe(hose, tmp, &hose_list, list_node) {
|
2007-12-10 04:33:21 +01:00
|
|
|
struct device_node* node = hose->dn;
|
|
|
|
|
2006-01-15 12:05:47 +01:00
|
|
|
if (!node)
|
|
|
|
continue;
|
|
|
|
make_one_node_map(node, hose->first_busno);
|
|
|
|
}
|
2007-04-24 05:50:55 +02:00
|
|
|
dn = of_find_node_by_path("/");
|
|
|
|
map_prop = of_find_property(dn, "pci-OF-bus-map", NULL);
|
2006-07-12 07:35:54 +02:00
|
|
|
if (map_prop) {
|
|
|
|
BUG_ON(pci_bus_count > map_prop->length);
|
|
|
|
memcpy(map_prop->value, pci_to_OF_bus_map, pci_bus_count);
|
|
|
|
}
|
2007-04-24 05:50:55 +02:00
|
|
|
of_node_put(dn);
|
2006-01-15 12:05:47 +01:00
|
|
|
#ifdef DEBUG
|
|
|
|
printk("PCI->OF bus map:\n");
|
|
|
|
for (i=0; i<pci_bus_count; i++) {
|
|
|
|
if (pci_to_OF_bus_map[i] == 0xff)
|
|
|
|
continue;
|
|
|
|
printk("%d -> %d\n", i, pci_to_OF_bus_map[i]);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Returns the PCI device matching a given OF node
|
|
|
|
*/
|
2011-04-11 03:37:07 +02:00
|
|
|
int pci_device_from_OF_node(struct device_node *node, u8 *bus, u8 *devfn)
|
2006-01-15 12:05:47 +01:00
|
|
|
{
|
2011-04-11 03:37:07 +02:00
|
|
|
struct pci_dev *dev = NULL;
|
|
|
|
const __be32 *reg;
|
|
|
|
int size;
|
|
|
|
|
|
|
|
/* Check if it might have a chance to be a PCI device */
|
|
|
|
if (!pci_find_hose_for_OF_device(node))
|
2006-01-15 12:05:47 +01:00
|
|
|
return -ENODEV;
|
2011-04-11 03:37:07 +02:00
|
|
|
|
|
|
|
reg = of_get_property(node, "reg", &size);
|
|
|
|
if (!reg || size < 5 * sizeof(u32))
|
2006-01-15 12:05:47 +01:00
|
|
|
return -ENODEV;
|
2011-04-11 03:37:07 +02:00
|
|
|
|
|
|
|
*bus = (be32_to_cpup(®[0]) >> 16) & 0xff;
|
|
|
|
*devfn = (be32_to_cpup(®[0]) >> 8) & 0xff;
|
2006-01-15 12:05:47 +01:00
|
|
|
|
|
|
|
/* Ok, here we need some tweak. If we have already renumbered
|
|
|
|
* all busses, we can't rely on the OF bus number any more.
|
|
|
|
* the pci_to_OF_bus_map is not enough as several PCI busses
|
|
|
|
* may match the same OF bus number.
|
|
|
|
*/
|
|
|
|
if (!pci_to_OF_bus_map)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
for_each_pci_dev(dev)
|
|
|
|
if (pci_to_OF_bus_map[dev->bus->number] == *bus &&
|
|
|
|
dev->devfn == *devfn) {
|
|
|
|
*bus = dev->bus->number;
|
|
|
|
pci_dev_put(dev);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL(pci_device_from_OF_node);
|
|
|
|
|
|
|
|
/* We create the "pci-OF-bus-map" property now so it appears in the
|
|
|
|
* /proc device tree
|
|
|
|
*/
|
|
|
|
void __init
|
|
|
|
pci_create_OF_bus_map(void)
|
|
|
|
{
|
|
|
|
struct property* of_prop;
|
2007-04-24 05:50:55 +02:00
|
|
|
struct device_node *dn;
|
|
|
|
|
powerpc: Remove more traces of bootmem
Although we are now selecting NO_BOOTMEM, we still have some traces of
bootmem lying around. That is because even with NO_BOOTMEM there is
still a shim that converts bootmem calls into memblock calls, but
ultimately we want to remove all traces of bootmem.
Most of the patch is conversions from alloc_bootmem() to
memblock_virt_alloc(). In general a call such as:
p = (struct foo *)alloc_bootmem(x);
Becomes:
p = memblock_virt_alloc(x, 0);
We don't need the cast because memblock_virt_alloc() returns a void *.
The alignment value of zero tells memblock to use the default alignment,
which is SMP_CACHE_BYTES, the same value alloc_bootmem() uses.
We remove a number of NULL checks on the result of
memblock_virt_alloc(). That is because memblock_virt_alloc() will panic
if it can't allocate, in exactly the same way as alloc_bootmem(), so the
NULL checks are and always have been redundant.
The memory returned by memblock_virt_alloc() is already zeroed, so we
remove several memsets of the result of memblock_virt_alloc().
Finally we convert a few uses of __alloc_bootmem(x, y, MAX_DMA_ADDRESS)
to just plain memblock_virt_alloc(). We don't use memblock_alloc_base()
because MAX_DMA_ADDRESS is ~0ul on powerpc, so limiting the allocation
to that is pointless, 16XB ought to be enough for anyone.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2014-11-18 06:47:35 +01:00
|
|
|
of_prop = memblock_virt_alloc(sizeof(struct property) + 256, 0);
|
2007-04-24 05:50:55 +02:00
|
|
|
dn = of_find_node_by_path("/");
|
|
|
|
if (dn) {
|
2006-01-15 12:05:47 +01:00
|
|
|
memset(of_prop, -1, sizeof(struct property) + 256);
|
|
|
|
of_prop->name = "pci-OF-bus-map";
|
|
|
|
of_prop->length = 256;
|
2007-04-03 02:58:52 +02:00
|
|
|
of_prop->value = &of_prop[1];
|
2012-10-02 18:58:46 +02:00
|
|
|
of_add_property(dn, of_prop);
|
2007-04-24 05:50:55 +02:00
|
|
|
of_node_put(dn);
|
2006-01-15 12:05:47 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-12-21 23:04:10 +01:00
|
|
|
void pcibios_setup_phb_io_space(struct pci_controller *hose)
|
2008-10-27 20:48:29 +01:00
|
|
|
{
|
|
|
|
unsigned long io_offset;
|
|
|
|
struct resource *res = &hose->io_resource;
|
|
|
|
|
|
|
|
/* Fixup IO space offset */
|
2012-03-17 00:48:09 +01:00
|
|
|
io_offset = pcibios_io_space_offset(hose);
|
|
|
|
res->start += io_offset;
|
|
|
|
res->end += io_offset;
|
2008-10-27 20:48:29 +01:00
|
|
|
}
|
|
|
|
|
2007-12-20 04:54:53 +01:00
|
|
|
static int __init pcibios_init(void)
|
2006-01-15 12:05:47 +01:00
|
|
|
{
|
2007-06-27 20:09:43 +02:00
|
|
|
struct pci_controller *hose, *tmp;
|
|
|
|
int next_busno = 0;
|
2006-01-15 12:05:47 +01:00
|
|
|
|
|
|
|
printk(KERN_INFO "PCI: Probing PCI hardware\n");
|
|
|
|
|
2011-07-12 16:25:51 +02:00
|
|
|
if (pci_has_flag(PCI_REASSIGN_ALL_BUS))
|
2007-12-20 04:54:46 +01:00
|
|
|
pci_assign_all_buses = 1;
|
|
|
|
|
2006-01-15 12:05:47 +01:00
|
|
|
/* Scan all of the recorded PCI controllers. */
|
2007-06-27 20:09:43 +02:00
|
|
|
list_for_each_entry_safe(hose, tmp, &hose_list, list_node) {
|
2006-01-15 12:05:47 +01:00
|
|
|
if (pci_assign_all_buses)
|
|
|
|
hose->first_busno = next_busno;
|
|
|
|
hose->last_busno = 0xff;
|
2011-02-04 19:24:11 +01:00
|
|
|
pcibios_scan_phb(hose);
|
2008-10-27 20:48:29 +01:00
|
|
|
pci_bus_add_devices(hose->bus);
|
2006-01-15 12:05:47 +01:00
|
|
|
if (pci_assign_all_buses || next_busno <= hose->last_busno)
|
|
|
|
next_busno = hose->last_busno + pcibios_assign_bus_offset;
|
|
|
|
}
|
|
|
|
pci_bus_count = next_busno;
|
|
|
|
|
|
|
|
/* OpenFirmware based machines need a map of OF bus
|
|
|
|
* numbers vs. kernel bus numbers since we may have to
|
|
|
|
* remap them.
|
|
|
|
*/
|
2008-12-09 10:47:29 +01:00
|
|
|
if (pci_assign_all_buses)
|
2006-01-15 12:05:47 +01:00
|
|
|
pcibios_make_OF_bus_map();
|
|
|
|
|
2007-12-20 04:54:53 +01:00
|
|
|
/* Call common code to handle resource allocation */
|
|
|
|
pcibios_resource_survey();
|
2006-01-15 12:05:47 +01:00
|
|
|
|
|
|
|
/* Call machine dependent post-init code */
|
|
|
|
if (ppc_md.pcibios_after_init)
|
|
|
|
ppc_md.pcibios_after_init();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
subsys_initcall(pcibios_init);
|
|
|
|
|
2007-06-27 17:27:33 +02:00
|
|
|
static struct pci_controller*
|
2006-01-15 12:05:47 +01:00
|
|
|
pci_bus_to_hose(int bus)
|
|
|
|
{
|
2007-06-27 20:09:43 +02:00
|
|
|
struct pci_controller *hose, *tmp;
|
2006-01-15 12:05:47 +01:00
|
|
|
|
2007-06-27 20:09:43 +02:00
|
|
|
list_for_each_entry_safe(hose, tmp, &hose_list, list_node)
|
2006-01-15 12:05:47 +01:00
|
|
|
if (bus >= hose->first_busno && bus <= hose->last_busno)
|
|
|
|
return hose;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Provide information on locations of various I/O regions in physical
|
|
|
|
* memory. Do this on a per-card basis so that we choose the right
|
|
|
|
* root bridge.
|
|
|
|
* Note that the returned IO or memory base is a physical address
|
|
|
|
*/
|
|
|
|
|
|
|
|
long sys_pciconfig_iobase(long which, unsigned long bus, unsigned long devfn)
|
|
|
|
{
|
|
|
|
struct pci_controller* hose;
|
|
|
|
long result = -EOPNOTSUPP;
|
|
|
|
|
|
|
|
hose = pci_bus_to_hose(bus);
|
|
|
|
if (!hose)
|
|
|
|
return -ENODEV;
|
|
|
|
|
|
|
|
switch (which) {
|
|
|
|
case IOBASE_BRIDGE_NUMBER:
|
|
|
|
return (long)hose->first_busno;
|
|
|
|
case IOBASE_MEMORY:
|
2013-05-06 05:40:40 +02:00
|
|
|
return (long)hose->mem_offset[0];
|
2006-01-15 12:05:47 +01:00
|
|
|
case IOBASE_IO:
|
|
|
|
return (long)hose->io_base_phys;
|
|
|
|
case IOBASE_ISA_IO:
|
|
|
|
return (long)isa_io_base;
|
|
|
|
case IOBASE_ISA_MEM:
|
|
|
|
return (long)isa_mem_base;
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|