patch-2.4.22 linux-2.4.22/arch/ppc/kernel/pci.c
Next file: linux-2.4.22/arch/ppc/kernel/pci_auto.c
Previous file: linux-2.4.22/arch/ppc/kernel/open_pic.c
Back to the patch index
Back to the overall index
- Lines: 279
- Date:
2003-08-25 04:44:40.000000000 -0700
- Orig file:
linux-2.4.21/arch/ppc/kernel/pci.c
- Orig date:
2003-06-13 07:51:31.000000000 -0700
diff -urN linux-2.4.21/arch/ppc/kernel/pci.c linux-2.4.22/arch/ppc/kernel/pci.c
@@ -67,7 +67,7 @@
{ PCI_FIXUP_HEADER, PCI_ANY_ID, PCI_ANY_ID, pcibios_fixup_resources },
#ifdef CONFIG_ALL_PPC
/* We should add per-machine fixup support in xxx_setup.c or xxx_pci.c */
- { PCI_FIXUP_FINAL, PCI_VENDOR_ID_TI, PCI_ANY_ID, pcibios_fixup_cardbus },
+ { PCI_FIXUP_FINAL, PCI_VENDOR_ID_TI, PCI_ANY_ID, pcibios_fixup_cardbus },
#endif /* CONFIG_ALL_PPC */
{ 0 }
};
@@ -115,7 +115,7 @@
int reg;
struct pci_controller* hose = dev->sysdata;
unsigned long io_offset;
-
+
new = res->start;
res->flags &= ~IORESOURCE_UNSET;
if (hose && res->flags & IORESOURCE_IO) {
@@ -211,7 +211,7 @@
/* Enable PCI interrupt */
if (pci_read_config_byte(dev, 0x91, &val) == 0)
pci_write_config_byte(dev, 0x91, val | 0x30);
- /* Disable ISA interrupt mode */
+ /* Disable ISA interrupt mode */
if (pci_read_config_byte(dev, 0x92, &val) == 0)
pci_write_config_byte(dev, 0x92, val & ~0x06);
}
@@ -223,7 +223,7 @@
signal out the MFUNC0 pin */
if (pci_read_config_byte(dev, 0x8c, &val) == 0)
pci_write_config_byte(dev, 0x8c, (val & ~0x0f) | 2);
- /* Disable ISA interrupt mode */
+ /* Disable ISA interrupt mode */
if (pci_read_config_byte(dev, 0x92, &val) == 0)
pci_write_config_byte(dev, 0x92, val & ~0x06);
}
@@ -695,7 +695,7 @@
hose = (struct pci_controller *)alloc_bootmem(sizeof(*hose));
memset(hose, 0, sizeof(struct pci_controller));
-
+
*hose_tail = hose;
hose_tail = &hose->next;
@@ -713,7 +713,7 @@
{
int *bus_range;
int len;
-
+
if (pci_bus >= pci_bus_count)
return;
bus_range = (int *) get_property(node, "bus-range", &len);
@@ -723,11 +723,11 @@
return;
}
pci_to_OF_bus_map[pci_bus] = bus_range[0];
-
+
for (node=node->child; node != 0;node = node->sibling) {
struct pci_dev* dev;
unsigned int *class_code, *reg;
-
+
class_code = (unsigned int *) get_property(node, "class-code", 0);
if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI &&
(*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS))
@@ -741,29 +741,29 @@
make_one_node_map(node, dev->subordinate->number);
}
}
-
+
void __openfirmware
pcibios_make_OF_bus_map(void)
{
int i;
struct pci_controller* hose;
u8* of_prop_map;
-
+
pci_to_OF_bus_map = (u8*)kmalloc(pci_bus_count, GFP_KERNEL);
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 */
for(hose=hose_head; hose; hose=hose->next) {
- struct device_node* node;
+ struct device_node* node;
node = (struct device_node *)hose->arch_data;
if (!node)
continue;
@@ -779,7 +779,7 @@
continue;
printk("%d -> %d\n", i, pci_to_OF_bus_map[i]);
}
-#endif
+#endif
}
typedef int (*pci_OF_scan_iterator)(struct device_node* node, void* data);
@@ -788,10 +788,10 @@
scan_OF_pci_childs(struct device_node* node, pci_OF_scan_iterator filter, void* data)
{
struct device_node* sub_node;
-
+
for (; node != 0;node = node->sibling) {
unsigned int *class_code;
-
+
if (filter(node, data))
return node;
@@ -817,7 +817,7 @@
{
unsigned int *reg;
u8* fdata = (u8*)data;
-
+
reg = (unsigned int *) get_property(node, "reg", 0);
if (reg && ((reg[0] >> 8) & 0xff) == fdata[1]
&& ((reg[0] >> 16) & 0xff) == fdata[0])
@@ -833,7 +833,7 @@
return scan_OF_pci_childs(node, scan_OF_pci_childs_iterator, filter_data);
}
-/*
+/*
* Scans the OF tree for a device node matching a PCI device
*/
struct device_node*
@@ -842,10 +842,10 @@
struct pci_controller *hose;
struct device_node *node;
int bus;
-
+
if (!have_of)
return NULL;
-
+
/* Lookup the hose */
bus = dev->bus->number;
hose = pci_bus_to_hose(bus);
@@ -862,7 +862,7 @@
bus = pci_to_OF_bus_map[bus];
if (bus == 0xff)
return NULL;
-
+
/* Now, lookup childs of the hose */
return scan_OF_childs_for_device(node->child, bus, dev->devfn);
}
@@ -895,7 +895,7 @@
return ((void *)node == data);
}
-/*
+/*
* Returns the PCI device matching a given OF node
*/
int
@@ -904,7 +904,7 @@
unsigned int *reg;
struct pci_controller* hose;
struct pci_dev* dev;
-
+
if (!have_of)
return -ENODEV;
/* Make sure it's really a PCI device */
@@ -1038,7 +1038,7 @@
pci_create_OF_bus_map(void)
{
struct property* of_prop;
-
+
of_prop = (struct property*) alloc_bootmem(sizeof(struct property) + 256);
if (of_prop && find_path_device("/")) {
memset(of_prop, -1, sizeof(struct property) + 256);
@@ -1053,13 +1053,13 @@
/*
* This set of routines checks for PCI<->PCI bridges that have closed
* IO resources and have child devices. It tries to re-open an IO
- * window on them.
- *
+ * window on them.
+ *
* This is a _temporary_ fix to workaround a problem with Apple's OF
* closing IO windows on P2P bridges when the OF drivers of cards
* below this bridge don't claim any IO range (typically ATI or
* Adaptec).
- *
+ *
* A more complete fix would be to use drivers/pci/setup-bus.c, which
* involves a working pcibios_fixup_pbus_ranges(), some more care about
* ordering when creating the host bus resources, and maybe a few more
@@ -1075,7 +1075,7 @@
u32 l;
u16 w;
struct resource res;
-
+
res = *(bus->resource[0]);
DBG("Remapping Bus %d, bridge: %s\n", bus->number, bridge->name);
@@ -1175,7 +1175,7 @@
break;
if (parent_io >= 4)
return;
-
+
for (ln=bus->children.next; ln != &bus->children; ln=ln->next) {
struct pci_bus *b = pci_bus_b(ln);
struct pci_dev *d = b->self;
@@ -1193,7 +1193,7 @@
*/
if (tmp_res.start == 0)
tmp_res.start = 0x1000;
-
+
if (!list_empty(&b->devices) && res && res->flags == 0 &&
res != bus->resource[parent_io] &&
(d->class >> 8) == PCI_CLASS_BRIDGE_PCI &&
@@ -1222,7 +1222,7 @@
*res = tmp_res;
res->flags = IORESOURCE_IO;
res->name = b->name;
-
+
/* Find a resource in the parent where we can allocate */
for (i = 0 ; i < 4; i++) {
struct resource *r = bus->resource[i];
@@ -1233,7 +1233,7 @@
DBG("Trying to allocate from %08lx, size %08lx from parent"
" res %d: %08lx -> %08lx\n",
res->start, res->end, i, r->start, r->end);
-
+
if (allocate_resource(r, res, res->end + 1, res->start, max,
res->end + 1, NULL, NULL) < 0) {
DBG("Failed !\n");
@@ -1439,13 +1439,13 @@
if (ppc_md.pcibios_enable_device_hook)
if (ppc_md.pcibios_enable_device_hook(dev, 0))
return -EINVAL;
-
+
pci_read_config_word(dev, PCI_COMMAND, &cmd);
old_cmd = cmd;
for (idx=0; idx<6; idx++) {
if(!(mask & (1<<idx)))
continue;
-
+
r = &dev->resource[idx];
if (r->flags & IORESOURCE_UNSET) {
printk(KERN_ERR "PCI: Device %s not available because of resource collisions\n", dev->slot_name);
@@ -1709,7 +1709,7 @@
if (!hose)
return -ENODEV;
-
+
switch (which) {
case IOBASE_BRIDGE_NUMBER:
return (long)hose->first_busno;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)