Hi,
Here are some PCI and PCI Hotplug patches for 2.6.10. All of these have
been in the past few -mm releases.
Highlights include:
- start of typesafe pci power states
- loads of little bug fixes.
Please pull from:
bk://kernel.bkbits.net/gregkh/linux/pci-2.6
thanks,
greg k-h
p.s. I'll send these as patches in response to this email to lkml for
those who want to see them.
MAINTAINERS | 44 +
arch/i386/pci/fixup.c | 4
arch/i386/pci/irq.c | 8
arch/i386/pci/pci.h | 2
drivers/media/video/bttv-driver.c | 10
drivers/net/3c59x.c | 16
drivers/net/8139cp.c | 12
drivers/net/8139too.c | 5
drivers/net/amd8111e.c | 32 -
drivers/net/e100.c | 8
drivers/net/eepro100.c | 16
drivers/net/pci-skeleton.c | 4
drivers/net/sis900.c | 14
drivers/net/starfire.c | 4
drivers/net/typhoon.c | 9
drivers/net/via-rhine.c | 4
drivers/net/via-velocity.c | 64 +-
drivers/pci/hotplug/acpiphp_ibm.c | 2
drivers/pci/hotplug/cpci_hotplug_pci.c | 2
drivers/pci/hotplug/cpcihp_generic.c | 2
drivers/pci/hotplug/cpqphp_pci.c | 30 -
drivers/pci/hotplug/fakephp.c | 2
drivers/pci/hotplug/ibmphp.h | 2
drivers/pci/hotplug/ibmphp_core.c | 830 +++++++++++++++++----------------
drivers/pci/hotplug/ibmphp_pci.c | 56 +-
drivers/pci/hotplug/shpchp.h | 2
drivers/pci/pci.c | 67 ++
drivers/pci/probe.c | 56 ++
drivers/pci/quirks.c | 14
drivers/pci/setup-bus.c | 9
drivers/pci/setup-irq.c | 3
include/linux/pci.h | 34 +
32 files changed, 807 insertions(+), 560 deletions(-)
-----
<macro:mips.com>:
o PCI: PCI early fixup missing bits
Adrian Bunk:
o PCI Hotplug: drivers/pci/hotplug/ : simply use MODULE
o PCI: arch/i386/pci/: make some code static
David Howells:
o PCI: Make pci_set_power_state() check register version
Domen Puncer:
o hotplug/acpiphp_ibm: module_param fix
Greg Kroah-Hartman:
o PCI Hotplug: remove my old email address
o PCI: fix bttv-driver "cleanup" that called an incorrect function
o PCI: fix typo on previous pci_set_power_state() patch for hte sis900 driver
o PCI: fix up function calls for CONFIG_PCI=N
Maciej W. Rozycki:
o PCI: Don't touch BARs of host bridges
Matthew Wilcox:
o PCI: Software visible configuration request retry status
o PCI: cope with duplicate bus numbers better
Pavel Machek:
o PCI: fix sparse warnings in drivers/net/* and bttv
o PCI: clean up state usage in pci core
o PCI: add prototype for pci_choose_state()
o PCI: add pci_choose_state()
o PCI: Cleanup PCI power states
Randy Dunlap:
o cpqphp: reduce stack usage
Rolf Eike Beer:
o PCI Hotplug: don't check pointer before kalling kfree in ibmphp_pci.c
o PCI Hotplug: use PCI_DEVFN in ibmphp_pci.c
o PCI Hotplug: Remove unneeded kmalloc casts from ibmphp_pci.c
o PCI Hotplug: ibmphp_core.c: useless casts
o PCI Hotplug: ibmphp_core.c: coding style
Thomas Gleixner:
o PCI: Fix debug statement
Bah, subject should say "for 2.6.10" not "-rc2". Sorry about that,
these are all merged against your latest -bk tree anyway.
thanks,
greg k-h
ChangeSet 1.1938.447.6, 2004/12/16 16:14:27-08:00, [email protected]
[PATCH] PCI: cope with duplicate bus numbers better
Make pci_scan_bridge() a little more robust in the presence of broken
firmware.
Signed-off-by: Matthew Wilcox <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
drivers/pci/probe.c | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletion(-)
diff -Nru a/drivers/pci/probe.c b/drivers/pci/probe.c
--- a/drivers/pci/probe.c 2005-01-10 09:04:01 -08:00
+++ b/drivers/pci/probe.c 2005-01-10 09:04:01 -08:00
@@ -375,6 +375,17 @@
if (pass)
return max;
busnr = (buses >> 8) & 0xFF;
+
+ /*
+ * If we already got to this bus through a different bridge,
+ * ignore it. This can happen with the i450NX chipset.
+ */
+ if (pci_find_bus(pci_domain_nr(bus), busnr)) {
+ printk(KERN_INFO "PCI: Bus %04x:%02x already known\n",
+ pci_domain_nr(bus), busnr);
+ return max;
+ }
+
child = pci_alloc_child_bus(bus, dev, busnr);
if (!child)
return max;
@@ -785,7 +796,7 @@
if (pci_find_bus(pci_domain_nr(b), bus)) {
/* If we already got to this bus through a different bridge, ignore it */
- DBG("PCI: Bus %02x already known\n", bus);
+ DBG("PCI: Bus %04:%02x already known\n", pci_domain_nr(b), bus);
goto err_out;
}
list_add_tail(&b->node, &pci_root_buses);
ChangeSet 1.1938.447.5, 2004/12/16 15:59:38-08:00, [email protected]
[PATCH] PCI Hotplug: ibmphp_core.c: useless casts
this patch removes some useless casts to and from (void *) as well as a cast
where a (struct pci_bus *) is cast to a (struct pci_bus *).
Signed-off-by: Rolf Eike Beer <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
drivers/pci/hotplug/ibmphp_core.c | 42 ++++++++++++++++----------------------
1 files changed, 18 insertions(+), 24 deletions(-)
diff -Nru a/drivers/pci/hotplug/ibmphp_core.c b/drivers/pci/hotplug/ibmphp_core.c
--- a/drivers/pci/hotplug/ibmphp_core.c 2005-01-10 09:04:42 -08:00
+++ b/drivers/pci/hotplug/ibmphp_core.c 2005-01-10 09:04:42 -08:00
@@ -260,7 +260,7 @@
break;
}
if (rc == 0) {
- pslot = (struct slot *) hotplug_slot->private;
+ pslot = hotplug_slot->private;
if (pslot)
rc = ibmphp_hpc_writeslot(pslot, cmd);
else
@@ -286,10 +286,9 @@
ibmphp_lock_operations();
if (hotplug_slot && value) {
- pslot = (struct slot *) hotplug_slot->private;
+ pslot = hotplug_slot->private;
if (pslot) {
- memcpy((void *) &myslot, (void *) pslot,
- sizeof(struct slot));
+ memcpy(&myslot, pslot, sizeof(struct slot));
rc = ibmphp_hpc_readslot(pslot, READ_SLOTSTATUS,
&(myslot.status));
if (!rc)
@@ -317,10 +316,9 @@
(ulong) hotplug_slot, (ulong) value);
ibmphp_lock_operations();
if (hotplug_slot && value) {
- pslot = (struct slot *) hotplug_slot->private;
+ pslot = hotplug_slot->private;
if (pslot) {
- memcpy((void *) &myslot, (void *) pslot,
- sizeof(struct slot));
+ memcpy(&myslot, pslot, sizeof(struct slot));
rc = ibmphp_hpc_readslot(pslot, READ_SLOTSTATUS,
&(myslot.status));
if (!rc)
@@ -345,10 +343,9 @@
(ulong) hotplug_slot, (ulong) value);
ibmphp_lock_operations();
if (hotplug_slot && value) {
- pslot = (struct slot *) hotplug_slot->private;
+ pslot = hotplug_slot->private;
if (pslot) {
- memcpy((void *) &myslot, (void *) pslot,
- sizeof(struct slot));
+ memcpy(&myslot, pslot, sizeof(struct slot));
rc = ibmphp_hpc_readslot(pslot, READ_SLOTSTATUS,
&(myslot.status));
if (!rc)
@@ -373,10 +370,9 @@
(ulong) hotplug_slot, (ulong) value);
ibmphp_lock_operations();
if (hotplug_slot && value) {
- pslot = (struct slot *) hotplug_slot->private;
+ pslot = hotplug_slot->private;
if (pslot) {
- memcpy((void *) &myslot, (void *) pslot,
- sizeof(struct slot));
+ memcpy(&myslot, pslot, sizeof(struct slot));
rc = ibmphp_hpc_readslot(pslot, READ_SLOTSTATUS,
&(myslot.status));
if (!rc) {
@@ -406,7 +402,7 @@
ibmphp_lock_operations();
if (hotplug_slot && value) {
- pslot = (struct slot *) hotplug_slot->private;
+ pslot = hotplug_slot->private;
if (pslot) {
rc = 0;
mode = pslot->supported_bus_mode;
@@ -446,7 +442,7 @@
ibmphp_lock_operations();
if (hotplug_slot && value) {
- pslot = (struct slot *) hotplug_slot->private;
+ pslot = hotplug_slot->private;
if (pslot) {
rc = get_cur_bus_info(&pslot);
if (!rc) {
@@ -494,10 +490,9 @@
ibmphp_lock_operations();
if (hotplug_slot && value) {
- pslot = (struct slot *) hotplug_slot->private;
+ pslot = hotplug_slot->private;
if (pslot) {
- memcpy((void *) &myslot, (void *) pslot,
- sizeof(struct slot));
+ memcpy(&myslot, pslot, sizeof(struct slot));
rc = ibmphp_hpc_readslot(pslot, READ_SLOTSTATUS,
&(myslot.status));
@@ -530,7 +525,7 @@
ibmphp_lock_operations();
if (hotplug_slot) {
- pslot = (struct slot *) hotplug_slot->private;
+ pslot = hotplug_slot->private;
if (pslot) {
rc = 0;
snprintf(value, 100, "Bus %x", pslot->bus);
@@ -851,8 +846,7 @@
}
if (!(flag) && (func->dev->hdr_type == PCI_HEADER_TYPE_BRIDGE)) {
pci_read_config_byte(func->dev, PCI_SECONDARY_BUS, &bus);
- child = (struct pci_bus *) pci_add_new_bus(func->dev->bus,
- (func->dev), bus);
+ child = pci_add_new_bus(func->dev->bus, func->dev, bus);
pci_do_scan_bus(child);
}
@@ -1058,7 +1052,7 @@
ibmphp_lock_operations();
debug("ENABLING SLOT........\n");
- slot_cur = (struct slot *) hs->private;
+ slot_cur = hs->private;
if ((rc = validate(slot_cur, ENABLE))) {
err("validate function failed\n");
@@ -1147,7 +1141,7 @@
goto error_power;
}
- slot_cur->func = (struct pci_func *) kmalloc(sizeof(struct pci_func), GFP_KERNEL);
+ slot_cur->func = kmalloc(sizeof(struct pci_func), GFP_KERNEL);
if (!slot_cur->func) {
/* We cannot do update_slot_info here, since no memory for
* kmalloc n.e.ways, and update_slot_info allocates some */
@@ -1258,7 +1252,7 @@
if (slot_cur->func == NULL) {
/* We need this for fncs's that were there on bootup */
- slot_cur->func = (struct pci_func *) kmalloc(sizeof(struct pci_func), GFP_KERNEL);
+ slot_cur->func = kmalloc(sizeof(struct pci_func), GFP_KERNEL);
if (!slot_cur->func) {
err("out of system memory\n");
rc = -ENOMEM;
ChangeSet 1.1938.447.10, 2004/12/17 14:02:40-08:00, [email protected]
[PATCH] PCI: fix up function calls for CONFIG_PCI=N
Signed-off-by: Greg Kroah-Hartman <[email protected]>
include/linux/pci.h | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff -Nru a/include/linux/pci.h b/include/linux/pci.h
--- a/include/linux/pci.h 2005-01-10 09:01:43 -08:00
+++ b/include/linux/pci.h 2005-01-10 09:01:43 -08:00
@@ -933,8 +933,8 @@
/* Power management related routines */
static inline int pci_save_state(struct pci_dev *dev) { return 0; }
static inline int pci_restore_state(struct pci_dev *dev) { return 0; }
-static inline int pci_set_power_state(struct pci_dev *dev, int state) { return 0; }
-static inline int pci_enable_wake(struct pci_dev *dev, u32 state, int enable) { return 0; }
+static inline int pci_set_power_state(struct pci_dev *dev, pci_power_t state) { return 0; }
+static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable) { return 0; }
#define isa_bridge ((struct pci_dev *)NULL)
ChangeSet 1.1938.439.47, 2005/01/07 10:33:57-08:00, [email protected]
[PATCH] PCI Hotplug: don't check pointer before kalling kfree in ibmphp_pci.c
Calling kfree() with a NULL pointer is no error so we don't need this check.
Signed-off-by: Rolf Eike Beer <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
drivers/pci/hotplug/ibmphp_pci.c | 3 +--
1 files changed, 1 insertion(+), 2 deletions(-)
diff -Nru a/drivers/pci/hotplug/ibmphp_pci.c b/drivers/pci/hotplug/ibmphp_pci.c
--- a/drivers/pci/hotplug/ibmphp_pci.c 2005-01-10 08:58:38 -08:00
+++ b/drivers/pci/hotplug/ibmphp_pci.c 2005-01-10 08:58:38 -08:00
@@ -1062,8 +1062,7 @@
}
error:
- if (amount_needed)
- kfree (amount_needed);
+ kfree(amount_needed);
if (pfmem)
ibmphp_remove_resource (pfmem);
if (io)
ChangeSet 1.1938.447.1, 2004/12/16 15:58:28-08:00, [email protected]
[PATCH] PCI: Fix debug statement
Make the debug of setup-irq.c compile and work again
Signed-off-by: Thomas Gleixner <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
drivers/pci/setup-irq.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletion(-)
diff -Nru a/drivers/pci/setup-irq.c b/drivers/pci/setup-irq.c
--- a/drivers/pci/setup-irq.c 2005-01-10 09:06:59 -08:00
+++ b/drivers/pci/setup-irq.c 2005-01-10 09:06:59 -08:00
@@ -53,7 +53,8 @@
irq = 0;
dev->irq = irq;
- DBGC((KERN_ERR "PCI fixup irq: (%s) got %d\n", dev->dev.name, dev->irq));
+ DBGC((KERN_ERR "PCI fixup irq: (%s) got %d\n",
+ dev->dev.kobj.name, dev->irq));
/* Always tell the device, so the driver knows what is
the real IRQ to use; the device does not use it. */
ChangeSet 1.1938.439.45, 2005/01/07 10:33:06-08:00, [email protected]
[PATCH] PCI Hotplug: Remove unneeded kmalloc casts from ibmphp_pci.c
this patch removes some unneeded casts from ibmphp_pci.c that cast the result
of kmalloc to some pointer type. It also uses "sizeof(*result)" instead of
"sizeof(type_of_result)".
Signed-off-by: Rolf Eike Beer <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
drivers/pci/hotplug/ibmphp_pci.c | 30 +++++++++++++++---------------
1 files changed, 15 insertions(+), 15 deletions(-)
diff -Nru a/drivers/pci/hotplug/ibmphp_pci.c b/drivers/pci/hotplug/ibmphp_pci.c
--- a/drivers/pci/hotplug/ibmphp_pci.c 2005-01-10 08:59:03 -08:00
+++ b/drivers/pci/hotplug/ibmphp_pci.c 2005-01-10 08:59:03 -08:00
@@ -164,7 +164,7 @@
cleanup_count = 6;
goto error;
}
- newfunc = (struct pci_func *) kmalloc (sizeof (struct pci_func), GFP_KERNEL);
+ newfunc = kmalloc(sizeof(*newfunc), GFP_KERNEL);
if (!newfunc) {
err ("out of system memory\n");
return -ENOMEM;
@@ -203,7 +203,7 @@
flag = FALSE;
for (i = 0; i < 32; i++) {
if (func->devices[i]) {
- newfunc = (struct pci_func *) kmalloc (sizeof (struct pci_func), GFP_KERNEL);
+ newfunc = kmalloc(sizeof(*newfunc), GFP_KERNEL);
if (!newfunc) {
err ("out of system memory\n");
return -ENOMEM;
@@ -232,7 +232,7 @@
}
}
- newfunc = (struct pci_func *) kmalloc (sizeof (struct pci_func), GFP_KERNEL);
+ newfunc = kmalloc(sizeof(*newfunc), GFP_KERNEL);
if (!newfunc) {
err ("out of system memory\n");
return -ENOMEM;
@@ -279,7 +279,7 @@
for (i = 0; i < 32; i++) {
if (func->devices[i]) {
debug ("inside for loop, device is %x\n", i);
- newfunc = (struct pci_func *) kmalloc (sizeof (struct pci_func), GFP_KERNEL);
+ newfunc = kmalloc(sizeof(*newfunc), GFP_KERNEL);
if (!newfunc) {
err (" out of system memory\n");
return -ENOMEM;
@@ -459,7 +459,7 @@
ibmphp_add_resource (pfmem[count]);
func->pfmem[count] = pfmem[count];
} else {
- mem_tmp = kmalloc (sizeof (struct resource_node), GFP_KERNEL);
+ mem_tmp = kmalloc(sizeof(*mem_tmp), GFP_KERNEL);
if (!mem_tmp) {
err ("out of system memory\n");
kfree (pfmem[count]);
@@ -724,7 +724,7 @@
ibmphp_add_resource (bus_pfmem[count]);
func->pfmem[count] = bus_pfmem[count];
} else {
- mem_tmp = kmalloc (sizeof (struct resource_node), GFP_KERNEL);
+ mem_tmp = kmalloc(sizeof(*mem_tmp), GFP_KERNEL);
if (!mem_tmp) {
err ("out of system memory\n");
retval = -ENOMEM;
@@ -836,7 +836,7 @@
flag_io = TRUE;
} else {
debug ("it wants %x IO behind the bridge\n", amount_needed->io);
- io = kmalloc (sizeof (struct resource_node), GFP_KERNEL);
+ io = kmalloc(sizeof(*io), GFP_KERNEL);
if (!io) {
err ("out of system memory\n");
@@ -860,7 +860,7 @@
flag_mem = TRUE;
} else {
debug ("it wants %x memory behind the bridge\n", amount_needed->mem);
- mem = kmalloc (sizeof (struct resource_node), GFP_KERNEL);
+ mem = kmalloc(sizeof(*mem), GFP_KERNEL);
if (!mem) {
err ("out of system memory\n");
retval = -ENOMEM;
@@ -883,7 +883,7 @@
flag_pfmem = TRUE;
} else {
debug ("it wants %x pfmemory behind the bridge\n", amount_needed->pfmem);
- pfmem = kmalloc (sizeof (struct resource_node), GFP_KERNEL);
+ pfmem = kmalloc(sizeof(*pfmem), GFP_KERNEL);
if (!pfmem) {
err ("out of system memory\n");
retval = -ENOMEM;
@@ -899,7 +899,7 @@
ibmphp_add_resource (pfmem);
flag_pfmem = TRUE;
} else {
- mem_tmp = kmalloc (sizeof (struct resource_node), GFP_KERNEL);
+ mem_tmp = kmalloc(sizeof(*mem_tmp), GFP_KERNEL);
if (!mem_tmp) {
err ("out of system memory\n");
retval = -ENOMEM;
@@ -931,7 +931,7 @@
*/
bus = ibmphp_find_res_bus (sec_number);
if (!bus) {
- bus = kmalloc (sizeof (struct bus_node), GFP_KERNEL);
+ bus = kmalloc(sizeof(*bus), GFP_KERNEL);
if (!bus) {
err ("out of system memory\n");
retval = -ENOMEM;
@@ -1107,7 +1107,7 @@
};
struct res_needed *amount;
- amount = kmalloc (sizeof (struct res_needed), GFP_KERNEL);
+ amount = kmalloc(sizeof(*amount), GFP_KERNEL);
if (amount == NULL)
return NULL;
memset (amount, 0, sizeof (struct res_needed));
@@ -1680,7 +1680,7 @@
list_add (&bus->bus_list, &cur_bus->bus_list);
}
if (io) {
- io_range = kmalloc (sizeof (struct range_node), GFP_KERNEL);
+ io_range = kmalloc(sizeof(*io_range), GFP_KERNEL);
if (!io_range) {
err ("out of system memory\n");
return -ENOMEM;
@@ -1693,7 +1693,7 @@
bus->rangeIO = io_range;
}
if (mem) {
- mem_range = kmalloc (sizeof (struct range_node), GFP_KERNEL);
+ mem_range = kmalloc(sizeof(*mem_range), GFP_KERNEL);
if (!mem_range) {
err ("out of system memory\n");
return -ENOMEM;
@@ -1706,7 +1706,7 @@
bus->rangeMem = mem_range;
}
if (pfmem) {
- pfmem_range = kmalloc (sizeof (struct range_node), GFP_KERNEL);
+ pfmem_range = kmalloc(sizeof(*pfmem_range), GFP_KERNEL);
if (!pfmem_range) {
err ("out of system memory\n");
return -ENOMEM;
ChangeSet 1.1938.447.4, 2004/12/16 15:59:19-08:00, [email protected]
[PATCH] PCI Hotplug: ibmphp_core.c: coding style
this is a cleanup patch for ibmphp_core.c. It does not change anything, it
only wraps long lines and removes spaces before opening braces of funtions.
Signed-off-by: Rolf Eike Beer <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
drivers/pci/hotplug/ibmphp_core.c | 788 ++++++++++++++++++++------------------
1 files changed, 432 insertions(+), 356 deletions(-)
diff -Nru a/drivers/pci/hotplug/ibmphp_core.c b/drivers/pci/hotplug/ibmphp_core.c
--- a/drivers/pci/hotplug/ibmphp_core.c 2005-01-10 09:05:15 -08:00
+++ b/drivers/pci/hotplug/ibmphp_core.c 2005-01-10 09:05:15 -08:00
@@ -59,7 +59,8 @@
struct pci_bus *ibmphp_pci_bus;
static int max_slots;
-static int irqs[16]; /* PIC mode IRQ's we're using so far (in case MPS tables don't provide default info for empty slots */
+static int irqs[16]; /* PIC mode IRQ's we're using so far (in case MPS
+ * tables don't provide default info for empty slots */
static int init_flag;
@@ -71,36 +72,40 @@
return get_max_adapter_speed_1 (hs, value, 1);
}
*/
-static inline int get_cur_bus_info (struct slot **sl)
+static inline int get_cur_bus_info(struct slot **sl)
{
int rc = 1;
struct slot * slot_cur = *sl;
- debug ("options = %x\n", slot_cur->ctrl->options);
- debug ("revision = %x\n", slot_cur->ctrl->revision);
+ debug("options = %x\n", slot_cur->ctrl->options);
+ debug("revision = %x\n", slot_cur->ctrl->revision);
- if (READ_BUS_STATUS (slot_cur->ctrl))
- rc = ibmphp_hpc_readslot (slot_cur, READ_BUSSTATUS, NULL);
+ if (READ_BUS_STATUS(slot_cur->ctrl))
+ rc = ibmphp_hpc_readslot(slot_cur, READ_BUSSTATUS, NULL);
if (rc)
return rc;
- slot_cur->bus_on->current_speed = CURRENT_BUS_SPEED (slot_cur->busstatus);
- if (READ_BUS_MODE (slot_cur->ctrl))
- slot_cur->bus_on->current_bus_mode = CURRENT_BUS_MODE (slot_cur->busstatus);
+ slot_cur->bus_on->current_speed = CURRENT_BUS_SPEED(slot_cur->busstatus);
+ if (READ_BUS_MODE(slot_cur->ctrl))
+ slot_cur->bus_on->current_bus_mode =
+ CURRENT_BUS_MODE(slot_cur->busstatus);
else
slot_cur->bus_on->current_bus_mode = 0xFF;
- debug ("busstatus = %x, bus_speed = %x, bus_mode = %x\n", slot_cur->busstatus, slot_cur->bus_on->current_speed, slot_cur->bus_on->current_bus_mode);
+ debug("busstatus = %x, bus_speed = %x, bus_mode = %x\n",
+ slot_cur->busstatus,
+ slot_cur->bus_on->current_speed,
+ slot_cur->bus_on->current_bus_mode);
*sl = slot_cur;
return 0;
}
-static inline int slot_update (struct slot **sl)
+static inline int slot_update(struct slot **sl)
{
int rc;
- rc = ibmphp_hpc_readslot (*sl, READ_ALLSTAT, NULL);
+ rc = ibmphp_hpc_readslot(*sl, READ_ALLSTAT, NULL);
if (rc)
return rc;
if (!init_flag)
@@ -114,10 +119,10 @@
struct list_head * tmp;
u8 slot_count = 0;
- list_for_each (tmp, &ibmphp_slot_head) {
- slot_cur = list_entry (tmp, struct slot, ibm_slot_list);
+ list_for_each(tmp, &ibmphp_slot_head) {
+ slot_cur = list_entry(tmp, struct slot, ibm_slot_list);
/* sometimes the hot-pluggable slots start with 4 (not always from 1) */
- slot_count = max (slot_count, slot_cur->number);
+ slot_count = max(slot_count, slot_cur->number);
}
return slot_count;
}
@@ -128,46 +133,61 @@
* Parameters: struct slot
* Returns 0 or errors
*/
-int ibmphp_init_devno (struct slot **cur_slot)
+int ibmphp_init_devno(struct slot **cur_slot)
{
struct irq_routing_table *rtable;
int len;
int loop;
int i;
- rtable = pcibios_get_irq_routing_table ();
+ rtable = pcibios_get_irq_routing_table();
if (!rtable) {
- err ("no BIOS routing table...\n");
+ err("no BIOS routing table...\n");
return -ENOMEM;
}
- len = (rtable->size - sizeof (struct irq_routing_table)) / sizeof (struct irq_info);
+ len = (rtable->size - sizeof(struct irq_routing_table)) /
+ sizeof(struct irq_info);
if (!len)
return -1;
for (loop = 0; loop < len; loop++) {
if ((*cur_slot)->number == rtable->slots[loop].slot) {
if ((*cur_slot)->bus == rtable->slots[loop].bus) {
- (*cur_slot)->device = PCI_SLOT (rtable->slots[loop].devfn);
+ (*cur_slot)->device = PCI_SLOT(rtable->slots[loop].devfn);
for (i = 0; i < 4; i++)
- (*cur_slot)->irq[i] = IO_APIC_get_PCI_irq_vector ((int) (*cur_slot)->bus, (int) (*cur_slot)->device, i);
+ (*cur_slot)->irq[i] = IO_APIC_get_PCI_irq_vector((int) (*cur_slot)->bus,
+ (int) (*cur_slot)->device, i);
- debug ("(*cur_slot)->irq[0] = %x\n", (*cur_slot)->irq[0]);
- debug ("(*cur_slot)->irq[1] = %x\n", (*cur_slot)->irq[1]);
- debug ("(*cur_slot)->irq[2] = %x\n", (*cur_slot)->irq[2]);
- debug ("(*cur_slot)->irq[3] = %x\n", (*cur_slot)->irq[3]);
-
- debug ("rtable->exlusive_irqs = %x\n", rtable->exclusive_irqs);
- debug ("rtable->slots[loop].irq[0].bitmap = %x\n", rtable->slots[loop].irq[0].bitmap);
- debug ("rtable->slots[loop].irq[1].bitmap = %x\n", rtable->slots[loop].irq[1].bitmap);
- debug ("rtable->slots[loop].irq[2].bitmap = %x\n", rtable->slots[loop].irq[2].bitmap);
- debug ("rtable->slots[loop].irq[3].bitmap = %x\n", rtable->slots[loop].irq[3].bitmap);
-
- debug ("rtable->slots[loop].irq[0].link= %x\n", rtable->slots[loop].irq[0].link);
- debug ("rtable->slots[loop].irq[1].link = %x\n", rtable->slots[loop].irq[1].link);
- debug ("rtable->slots[loop].irq[2].link = %x\n", rtable->slots[loop].irq[2].link);
- debug ("rtable->slots[loop].irq[3].link = %x\n", rtable->slots[loop].irq[3].link);
- debug ("end of init_devno\n");
+ debug("(*cur_slot)->irq[0] = %x\n",
+ (*cur_slot)->irq[0]);
+ debug("(*cur_slot)->irq[1] = %x\n",
+ (*cur_slot)->irq[1]);
+ debug("(*cur_slot)->irq[2] = %x\n",
+ (*cur_slot)->irq[2]);
+ debug("(*cur_slot)->irq[3] = %x\n",
+ (*cur_slot)->irq[3]);
+
+ debug("rtable->exlusive_irqs = %x\n",
+ rtable->exclusive_irqs);
+ debug("rtable->slots[loop].irq[0].bitmap = %x\n",
+ rtable->slots[loop].irq[0].bitmap);
+ debug("rtable->slots[loop].irq[1].bitmap = %x\n",
+ rtable->slots[loop].irq[1].bitmap);
+ debug("rtable->slots[loop].irq[2].bitmap = %x\n",
+ rtable->slots[loop].irq[2].bitmap);
+ debug("rtable->slots[loop].irq[3].bitmap = %x\n",
+ rtable->slots[loop].irq[3].bitmap);
+
+ debug("rtable->slots[loop].irq[0].link = %x\n",
+ rtable->slots[loop].irq[0].link);
+ debug("rtable->slots[loop].irq[1].link = %x\n",
+ rtable->slots[loop].irq[1].link);
+ debug("rtable->slots[loop].irq[2].link = %x\n",
+ rtable->slots[loop].irq[2].link);
+ debug("rtable->slots[loop].irq[3].link = %x\n",
+ rtable->slots[loop].irq[3].link);
+ debug("end of init_devno\n");
return 0;
}
}
@@ -176,49 +196,50 @@
return -1;
}
-static inline int power_on (struct slot *slot_cur)
+static inline int power_on(struct slot *slot_cur)
{
u8 cmd = HPC_SLOT_ON;
int retval;
- retval = ibmphp_hpc_writeslot (slot_cur, cmd);
+ retval = ibmphp_hpc_writeslot(slot_cur, cmd);
if (retval) {
- err ("power on failed\n");
+ err("power on failed\n");
return retval;
}
- if (CTLR_RESULT (slot_cur->ctrl->status)) {
- err ("command not completed successfully in power_on\n");
+ if (CTLR_RESULT(slot_cur->ctrl->status)) {
+ err("command not completed successfully in power_on\n");
return -EIO;
}
msleep(3000); /* For ServeRAID cards, and some 66 PCI */
return 0;
}
-static inline int power_off (struct slot *slot_cur)
+static inline int power_off(struct slot *slot_cur)
{
u8 cmd = HPC_SLOT_OFF;
int retval;
- retval = ibmphp_hpc_writeslot (slot_cur, cmd);
+ retval = ibmphp_hpc_writeslot(slot_cur, cmd);
if (retval) {
- err ("power off failed\n");
+ err("power off failed\n");
return retval;
}
- if (CTLR_RESULT (slot_cur->ctrl->status)) {
- err ("command not completed successfully in power_off\n");
+ if (CTLR_RESULT(slot_cur->ctrl->status)) {
+ err("command not completed successfully in power_off\n");
retval = -EIO;
}
return retval;
}
-static int set_attention_status (struct hotplug_slot *hotplug_slot, u8 value)
+static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 value)
{
int rc = 0;
struct slot *pslot;
u8 cmd;
- debug ("set_attention_status - Entry hotplug_slot[%lx] value[%x]\n", (ulong) hotplug_slot, value);
- ibmphp_lock_operations ();
+ debug("set_attention_status - Entry hotplug_slot[%lx] value[%x]\n",
+ (ulong) hotplug_slot, value);
+ ibmphp_lock_operations();
cmd = 0x00; // avoid compiler warning
if (hotplug_slot) {
@@ -234,7 +255,8 @@
break;
default:
rc = -ENODEV;
- err ("set_attention_status - Error : invalid input [%x]\n", value);
+ err("set_attention_status - Error : invalid input [%x]\n",
+ value);
break;
}
if (rc == 0) {
@@ -247,101 +269,118 @@
} else
rc = -ENODEV;
- ibmphp_unlock_operations ();
+ ibmphp_unlock_operations();
- debug ("set_attention_status - Exit rc[%d]\n", rc);
+ debug("set_attention_status - Exit rc[%d]\n", rc);
return rc;
}
-static int get_attention_status (struct hotplug_slot *hotplug_slot, u8 * value)
+static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 * value)
{
int rc = -ENODEV;
struct slot *pslot;
struct slot myslot;
- debug ("get_attention_status - Entry hotplug_slot[%lx] pvalue[%lx]\n", (ulong) hotplug_slot, (ulong) value);
+ debug("get_attention_status - Entry hotplug_slot[%lx] pvalue[%lx]\n",
+ (ulong) hotplug_slot, (ulong) value);
- ibmphp_lock_operations ();
+ ibmphp_lock_operations();
if (hotplug_slot && value) {
pslot = (struct slot *) hotplug_slot->private;
if (pslot) {
- memcpy ((void *) &myslot, (void *) pslot, sizeof (struct slot));
- rc = ibmphp_hpc_readslot(pslot, READ_SLOTSTATUS, &(myslot.status));
+ memcpy((void *) &myslot, (void *) pslot,
+ sizeof(struct slot));
+ rc = ibmphp_hpc_readslot(pslot, READ_SLOTSTATUS,
+ &(myslot.status));
if (!rc)
- rc = ibmphp_hpc_readslot(pslot, READ_EXTSLOTSTATUS, &(myslot.ext_status));
+ rc = ibmphp_hpc_readslot(pslot,
+ READ_EXTSLOTSTATUS,
+ &(myslot.ext_status));
if (!rc)
- *value = SLOT_ATTN (myslot.status, myslot.ext_status);
+ *value = SLOT_ATTN(myslot.status,
+ myslot.ext_status);
}
}
- ibmphp_unlock_operations ();
+ ibmphp_unlock_operations();
debug("get_attention_status - Exit rc[%d] value[%x]\n", rc, *value);
return rc;
}
-static int get_latch_status (struct hotplug_slot *hotplug_slot, u8 * value)
+static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 * value)
{
int rc = -ENODEV;
struct slot *pslot;
struct slot myslot;
- debug ("get_latch_status - Entry hotplug_slot[%lx] pvalue[%lx]\n", (ulong) hotplug_slot, (ulong) value);
- ibmphp_lock_operations ();
+ debug("get_latch_status - Entry hotplug_slot[%lx] pvalue[%lx]\n",
+ (ulong) hotplug_slot, (ulong) value);
+ ibmphp_lock_operations();
if (hotplug_slot && value) {
pslot = (struct slot *) hotplug_slot->private;
if (pslot) {
- memcpy ((void *) &myslot, (void *) pslot, sizeof (struct slot));
- rc = ibmphp_hpc_readslot(pslot, READ_SLOTSTATUS, &(myslot.status));
+ memcpy((void *) &myslot, (void *) pslot,
+ sizeof(struct slot));
+ rc = ibmphp_hpc_readslot(pslot, READ_SLOTSTATUS,
+ &(myslot.status));
if (!rc)
- *value = SLOT_LATCH (myslot.status);
+ *value = SLOT_LATCH(myslot.status);
}
}
- ibmphp_unlock_operations ();
- debug("get_latch_status - Exit rc[%d] rc[%x] value[%x]\n", rc, rc, *value);
+ ibmphp_unlock_operations();
+ debug("get_latch_status - Exit rc[%d] rc[%x] value[%x]\n",
+ rc, rc, *value);
return rc;
}
-static int get_power_status (struct hotplug_slot *hotplug_slot, u8 * value)
+static int get_power_status(struct hotplug_slot *hotplug_slot, u8 * value)
{
int rc = -ENODEV;
struct slot *pslot;
struct slot myslot;
- debug ("get_power_status - Entry hotplug_slot[%lx] pvalue[%lx]\n", (ulong) hotplug_slot, (ulong) value);
- ibmphp_lock_operations ();
+ debug("get_power_status - Entry hotplug_slot[%lx] pvalue[%lx]\n",
+ (ulong) hotplug_slot, (ulong) value);
+ ibmphp_lock_operations();
if (hotplug_slot && value) {
pslot = (struct slot *) hotplug_slot->private;
if (pslot) {
- memcpy ((void *) &myslot, (void *) pslot, sizeof (struct slot));
- rc = ibmphp_hpc_readslot(pslot, READ_SLOTSTATUS, &(myslot.status));
+ memcpy((void *) &myslot, (void *) pslot,
+ sizeof(struct slot));
+ rc = ibmphp_hpc_readslot(pslot, READ_SLOTSTATUS,
+ &(myslot.status));
if (!rc)
- *value = SLOT_PWRGD (myslot.status);
+ *value = SLOT_PWRGD(myslot.status);
}
}
- ibmphp_unlock_operations ();
- debug("get_power_status - Exit rc[%d] rc[%x] value[%x]\n", rc, rc, *value);
+ ibmphp_unlock_operations();
+ debug("get_power_status - Exit rc[%d] rc[%x] value[%x]\n",
+ rc, rc, *value);
return rc;
}
-static int get_adapter_present (struct hotplug_slot *hotplug_slot, u8 * value)
+static int get_adapter_present(struct hotplug_slot *hotplug_slot, u8 * value)
{
int rc = -ENODEV;
struct slot *pslot;
u8 present;
struct slot myslot;
- debug ("get_adapter_status - Entry hotplug_slot[%lx] pvalue[%lx]\n", (ulong) hotplug_slot, (ulong) value);
- ibmphp_lock_operations ();
+ debug("get_adapter_status - Entry hotplug_slot[%lx] pvalue[%lx]\n",
+ (ulong) hotplug_slot, (ulong) value);
+ ibmphp_lock_operations();
if (hotplug_slot && value) {
pslot = (struct slot *) hotplug_slot->private;
if (pslot) {
- memcpy ((void *) &myslot, (void *) pslot, sizeof (struct slot));
- rc = ibmphp_hpc_readslot(pslot, READ_SLOTSTATUS, &(myslot.status));
+ memcpy((void *) &myslot, (void *) pslot,
+ sizeof(struct slot));
+ rc = ibmphp_hpc_readslot(pslot, READ_SLOTSTATUS,
+ &(myslot.status));
if (!rc) {
- present = SLOT_PRESENT (myslot.status);
+ present = SLOT_PRESENT(myslot.status);
if (present == HPC_SLOT_EMPTY)
*value = 0;
else
@@ -350,21 +389,21 @@
}
}
- ibmphp_unlock_operations ();
+ ibmphp_unlock_operations();
debug("get_adapter_present - Exit rc[%d] value[%x]\n", rc, *value);
return rc;
}
-static int get_max_bus_speed (struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value)
+static int get_max_bus_speed(struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value)
{
int rc = -ENODEV;
struct slot *pslot;
u8 mode = 0;
- debug ("%s - Entry hotplug_slot[%p] pvalue[%p]\n", __FUNCTION__,
+ debug("%s - Entry hotplug_slot[%p] pvalue[%p]\n", __FUNCTION__,
hotplug_slot, value);
- ibmphp_lock_operations ();
+ ibmphp_lock_operations();
if (hotplug_slot && value) {
pslot = (struct slot *) hotplug_slot->private;
@@ -390,26 +429,26 @@
}
}
- ibmphp_unlock_operations ();
- debug ("%s - Exit rc[%d] value[%x]\n", __FUNCTION__, rc, *value);
+ ibmphp_unlock_operations();
+ debug("%s - Exit rc[%d] value[%x]\n", __FUNCTION__, rc, *value);
return rc;
}
-static int get_cur_bus_speed (struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value)
+static int get_cur_bus_speed(struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value)
{
int rc = -ENODEV;
struct slot *pslot;
u8 mode = 0;
- debug ("%s - Entry hotplug_slot[%p] pvalue[%p]\n", __FUNCTION__,
+ debug("%s - Entry hotplug_slot[%p] pvalue[%p]\n", __FUNCTION__,
hotplug_slot, value);
- ibmphp_lock_operations ();
+ ibmphp_lock_operations();
if (hotplug_slot && value) {
pslot = (struct slot *) hotplug_slot->private;
if (pslot) {
- rc = get_cur_bus_info (&pslot);
+ rc = get_cur_bus_info(&pslot);
if (!rc) {
mode = pslot->bus_on->current_bus_mode;
*value = pslot->bus_on->current_speed;
@@ -436,121 +475,130 @@
}
}
- ibmphp_unlock_operations ();
- debug ("%s - Exit rc[%d] value[%x]\n", __FUNCTION__, rc, *value);
+ ibmphp_unlock_operations();
+ debug("%s - Exit rc[%d] value[%x]\n", __FUNCTION__, rc, *value);
return rc;
}
+
/*
-static int get_max_adapter_speed_1 (struct hotplug_slot *hotplug_slot, u8 * value, u8 flag)
+static int get_max_adapter_speed_1(struct hotplug_slot *hotplug_slot, u8 * value, u8 flag)
{
int rc = -ENODEV;
struct slot *pslot;
struct slot myslot;
- debug ("get_max_adapter_speed_1 - Entry hotplug_slot[%lx] pvalue[%lx]\n", (ulong)hotplug_slot, (ulong) value);
+ debug("get_max_adapter_speed_1 - Entry hotplug_slot[%lx] pvalue[%lx]\n",
+ (ulong)hotplug_slot, (ulong) value);
if (flag)
- ibmphp_lock_operations ();
+ ibmphp_lock_operations();
if (hotplug_slot && value) {
pslot = (struct slot *) hotplug_slot->private;
if (pslot) {
- memcpy ((void *) &myslot, (void *) pslot, sizeof (struct slot));
- rc = ibmphp_hpc_readslot(pslot, READ_SLOTSTATUS, &(myslot.status));
-
- if (!(SLOT_LATCH (myslot.status)) && (SLOT_PRESENT (myslot.status))) {
- rc = ibmphp_hpc_readslot(pslot, READ_EXTSLOTSTATUS, &(myslot.ext_status));
+ memcpy((void *) &myslot, (void *) pslot,
+ sizeof(struct slot));
+ rc = ibmphp_hpc_readslot(pslot, READ_SLOTSTATUS,
+ &(myslot.status));
+
+ if (!(SLOT_LATCH (myslot.status)) &&
+ (SLOT_PRESENT (myslot.status))) {
+ rc = ibmphp_hpc_readslot(pslot,
+ READ_EXTSLOTSTATUS,
+ &(myslot.ext_status));
if (!rc)
- *value = SLOT_SPEED (myslot.ext_status);
+ *value = SLOT_SPEED(myslot.ext_status);
} else
*value = MAX_ADAPTER_NONE;
}
}
if (flag)
- ibmphp_unlock_operations ();
+ ibmphp_unlock_operations();
debug("get_max_adapter_speed_1 - Exit rc[%d] value[%x]\n", rc, *value);
return rc;
}
-static int get_bus_name (struct hotplug_slot *hotplug_slot, char * value)
+static int get_bus_name(struct hotplug_slot *hotplug_slot, char * value)
{
int rc = -ENODEV;
struct slot *pslot = NULL;
- debug ("get_bus_name - Entry hotplug_slot[%lx]\n", (ulong)hotplug_slot);
+ debug("get_bus_name - Entry hotplug_slot[%lx]\n", (ulong)hotplug_slot);
- ibmphp_lock_operations ();
+ ibmphp_lock_operations();
if (hotplug_slot) {
pslot = (struct slot *) hotplug_slot->private;
if (pslot) {
rc = 0;
- snprintf (value, 100, "Bus %x", pslot->bus);
+ snprintf(value, 100, "Bus %x", pslot->bus);
}
} else
rc = -ENODEV;
- ibmphp_unlock_operations ();
- debug ("get_bus_name - Exit rc[%d] value[%x]\n", rc, *value);
+ ibmphp_unlock_operations();
+ debug("get_bus_name - Exit rc[%d] value[%x]\n", rc, *value);
return rc;
}
*/
-/*******************************************************************************
+/****************************************************************************
* This routine will initialize the ops data structure used in the validate
* function. It will also power off empty slots that are powered on since BIOS
* leaves those on, albeit disconnected
- ******************************************************************************/
-static int __init init_ops (void)
+ ****************************************************************************/
+static int __init init_ops(void)
{
struct slot *slot_cur;
struct list_head *tmp;
int retval;
int rc;
- list_for_each (tmp, &ibmphp_slot_head) {
- slot_cur = list_entry (tmp, struct slot, ibm_slot_list);
+ list_for_each(tmp, &ibmphp_slot_head) {
+ slot_cur = list_entry(tmp, struct slot, ibm_slot_list);
if (!slot_cur)
return -ENODEV;
- debug ("BEFORE GETTING SLOT STATUS, slot # %x\n", slot_cur->number);
+ debug("BEFORE GETTING SLOT STATUS, slot # %x\n",
+ slot_cur->number);
if (slot_cur->ctrl->revision == 0xFF)
- if (get_ctrl_revision (slot_cur, &slot_cur->ctrl->revision))
+ if (get_ctrl_revision(slot_cur,
+ &slot_cur->ctrl->revision))
return -1;
if (slot_cur->bus_on->current_speed == 0xFF)
- if (get_cur_bus_info (&slot_cur))
+ if (get_cur_bus_info(&slot_cur))
return -1;
if (slot_cur->ctrl->options == 0xFF)
- if (get_hpc_options (slot_cur, &slot_cur->ctrl->options))
+ if (get_hpc_options(slot_cur, &slot_cur->ctrl->options))
return -1;
- retval = slot_update (&slot_cur);
+ retval = slot_update(&slot_cur);
if (retval)
return retval;
- debug ("status = %x\n", slot_cur->status);
- debug ("ext_status = %x\n", slot_cur->ext_status);
- debug ("SLOT_POWER = %x\n", SLOT_POWER (slot_cur->status));
- debug ("SLOT_PRESENT = %x\n", SLOT_PRESENT (slot_cur->status));
- debug ("SLOT_LATCH = %x\n", SLOT_LATCH (slot_cur->status));
-
- if ((SLOT_PWRGD (slot_cur->status)) &&
- !(SLOT_PRESENT (slot_cur->status)) &&
- !(SLOT_LATCH (slot_cur->status))) {
- debug ("BEFORE POWER OFF COMMAND\n");
- rc = power_off (slot_cur);
+ debug("status = %x\n", slot_cur->status);
+ debug("ext_status = %x\n", slot_cur->ext_status);
+ debug("SLOT_POWER = %x\n", SLOT_POWER(slot_cur->status));
+ debug("SLOT_PRESENT = %x\n", SLOT_PRESENT(slot_cur->status));
+ debug("SLOT_LATCH = %x\n", SLOT_LATCH(slot_cur->status));
+
+ if ((SLOT_PWRGD(slot_cur->status)) &&
+ !(SLOT_PRESENT(slot_cur->status)) &&
+ !(SLOT_LATCH(slot_cur->status))) {
+ debug("BEFORE POWER OFF COMMAND\n");
+ rc = power_off(slot_cur);
if (rc)
return rc;
- /* retval = slot_update (&slot_cur);
+ /* retval = slot_update(&slot_cur);
* if (retval)
* return retval;
- * ibmphp_update_slot_info (slot_cur);
+ * ibmphp_update_slot_info(slot_cur);
*/
}
}
@@ -563,7 +611,7 @@
* Parameters: slot, operation
* Returns: 0 or error codes
*/
-static int validate (struct slot *slot_cur, int opn)
+static int validate(struct slot *slot_cur, int opn)
{
int number;
int retval;
@@ -573,89 +621,91 @@
number = slot_cur->number;
if ((number > max_slots) || (number < 0))
return -EBADSLT;
- debug ("slot_number in validate is %d\n", slot_cur->number);
+ debug("slot_number in validate is %d\n", slot_cur->number);
- retval = slot_update (&slot_cur);
+ retval = slot_update(&slot_cur);
if (retval)
return retval;
switch (opn) {
case ENABLE:
- if (!(SLOT_PWRGD (slot_cur->status)) &&
- (SLOT_PRESENT (slot_cur->status)) &&
- !(SLOT_LATCH (slot_cur->status)))
+ if (!(SLOT_PWRGD(slot_cur->status)) &&
+ (SLOT_PRESENT(slot_cur->status)) &&
+ !(SLOT_LATCH(slot_cur->status)))
return 0;
break;
case DISABLE:
- if ((SLOT_PWRGD (slot_cur->status)) &&
- (SLOT_PRESENT (slot_cur->status)) &&
- !(SLOT_LATCH (slot_cur->status)))
+ if ((SLOT_PWRGD(slot_cur->status)) &&
+ (SLOT_PRESENT(slot_cur->status)) &&
+ !(SLOT_LATCH(slot_cur->status)))
return 0;
break;
default:
break;
}
- err ("validate failed....\n");
+ err("validate failed....\n");
return -EINVAL;
}
-/********************************************************************************
+/****************************************************************************
* This routine is for updating the data structures in the hotplug core
* Parameters: struct slot
* Returns: 0 or error
- *******************************************************************************/
-int ibmphp_update_slot_info (struct slot *slot_cur)
+ ****************************************************************************/
+int ibmphp_update_slot_info(struct slot *slot_cur)
{
struct hotplug_slot_info *info;
int rc;
u8 bus_speed;
u8 mode;
- info = kmalloc (sizeof (struct hotplug_slot_info), GFP_KERNEL);
+ info = kmalloc(sizeof(struct hotplug_slot_info), GFP_KERNEL);
if (!info) {
- err ("out of system memory\n");
+ err("out of system memory\n");
return -ENOMEM;
}
- info->power_status = SLOT_PWRGD (slot_cur->status);
- info->attention_status = SLOT_ATTN (slot_cur->status, slot_cur->ext_status);
- info->latch_status = SLOT_LATCH (slot_cur->status);
- if (!SLOT_PRESENT (slot_cur->status)) {
+ info->power_status = SLOT_PWRGD(slot_cur->status);
+ info->attention_status = SLOT_ATTN(slot_cur->status,
+ slot_cur->ext_status);
+ info->latch_status = SLOT_LATCH(slot_cur->status);
+ if (!SLOT_PRESENT(slot_cur->status)) {
info->adapter_status = 0;
-// info->max_adapter_speed_status = MAX_ADAPTER_NONE;
+/* info->max_adapter_speed_status = MAX_ADAPTER_NONE; */
} else {
info->adapter_status = 1;
-// get_max_adapter_speed_1 (slot_cur->hotplug_slot, &info->max_adapter_speed_status, 0);
+/* get_max_adapter_speed_1(slot_cur->hotplug_slot,
+ &info->max_adapter_speed_status, 0); */
}
bus_speed = slot_cur->bus_on->current_speed;
mode = slot_cur->bus_on->current_bus_mode;
switch (bus_speed) {
- case BUS_SPEED_33:
- break;
- case BUS_SPEED_66:
- if (mode == BUS_MODE_PCIX)
+ case BUS_SPEED_33:
+ break;
+ case BUS_SPEED_66:
+ if (mode == BUS_MODE_PCIX)
+ bus_speed += 0x01;
+ else if (mode == BUS_MODE_PCI)
+ ;
+ else
+ bus_speed = PCI_SPEED_UNKNOWN;
+ break;
+ case BUS_SPEED_100:
+ case BUS_SPEED_133:
bus_speed += 0x01;
- else if (mode == BUS_MODE_PCI)
- ;
- else
+ break;
+ default:
bus_speed = PCI_SPEED_UNKNOWN;
- break;
- case BUS_SPEED_100:
- case BUS_SPEED_133:
- bus_speed += 0x01;
- break;
- default:
- bus_speed = PCI_SPEED_UNKNOWN;
}
info->cur_bus_speed = bus_speed;
info->max_bus_speed = slot_cur->hotplug_slot->info->max_bus_speed;
// To do: bus_names
- rc = pci_hp_change_slot_info (slot_cur->hotplug_slot, info);
- kfree (info);
+ rc = pci_hp_change_slot_info(slot_cur->hotplug_slot, info);
+ kfree(info);
return rc;
}
@@ -665,17 +715,19 @@
* is called from visit routines
******************************************************************************/
-static struct pci_func *ibm_slot_find (u8 busno, u8 device, u8 function)
+static struct pci_func *ibm_slot_find(u8 busno, u8 device, u8 function)
{
struct pci_func *func_cur;
struct slot *slot_cur;
struct list_head * tmp;
- list_for_each (tmp, &ibmphp_slot_head) {
- slot_cur = list_entry (tmp, struct slot, ibm_slot_list);
+ list_for_each(tmp, &ibmphp_slot_head) {
+ slot_cur = list_entry(tmp, struct slot, ibm_slot_list);
if (slot_cur->func) {
func_cur = slot_cur->func;
while (func_cur) {
- if ((func_cur->busno == busno) && (func_cur->device == device) && (func_cur->function == function))
+ if ((func_cur->busno == busno) &&
+ (func_cur->device == device) &&
+ (func_cur->function == function))
return func_cur;
func_cur = func_cur->next;
}
@@ -689,19 +741,19 @@
* the pointers to pci_func, bus, hotplug_slot, controller,
* and deregistering from the hotplug core
*************************************************************/
-static void free_slots (void)
+static void free_slots(void)
{
struct slot *slot_cur;
struct list_head * tmp;
struct list_head * next;
- debug ("%s -- enter\n", __FUNCTION__);
+ debug("%s -- enter\n", __FUNCTION__);
- list_for_each_safe (tmp, next, &ibmphp_slot_head) {
- slot_cur = list_entry (tmp, struct slot, ibm_slot_list);
- pci_hp_deregister (slot_cur->hotplug_slot);
+ list_for_each_safe(tmp, next, &ibmphp_slot_head) {
+ slot_cur = list_entry(tmp, struct slot, ibm_slot_list);
+ pci_hp_deregister(slot_cur->hotplug_slot);
}
- debug ("%s -- exit\n", __FUNCTION__);
+ debug("%s -- exit\n", __FUNCTION__);
}
static void ibm_unconfigure_device(struct pci_func *func)
@@ -710,7 +762,8 @@
u8 j;
debug("inside %s\n", __FUNCTION__);
- debug("func->device = %x, func->function = %x\n", func->device, func->function);
+ debug("func->device = %x, func->function = %x\n",
+ func->device, func->function);
debug("func->device << 3 | 0x0 = %x\n", func->device << 3 | 0x0);
for (j = 0; j < 0x08; j++) {
@@ -725,25 +778,24 @@
* getting bus entries, here we manually add those primary
* bus entries to kernel bus structure whenever apply
*/
-
-static u8 bus_structure_fixup (u8 busno)
+static u8 bus_structure_fixup(u8 busno)
{
struct pci_bus *bus;
struct pci_dev *dev;
u16 l;
- if (pci_find_bus(0, busno) || !(ibmphp_find_same_bus_num (busno)))
+ if (pci_find_bus(0, busno) || !(ibmphp_find_same_bus_num(busno)))
return 1;
- bus = kmalloc (sizeof (*bus), GFP_KERNEL);
+ bus = kmalloc(sizeof(*bus), GFP_KERNEL);
if (!bus) {
- err ("%s - out of memory\n", __FUNCTION__);
+ err("%s - out of memory\n", __FUNCTION__);
return 1;
}
- dev = kmalloc (sizeof (*dev), GFP_KERNEL);
+ dev = kmalloc(sizeof(*dev), GFP_KERNEL);
if (!dev) {
- kfree (bus);
- err ("%s - out of memory\n", __FUNCTION__);
+ kfree(bus);
+ err("%s - out of memory\n", __FUNCTION__);
return 1;
}
@@ -751,50 +803,57 @@
bus->ops = ibmphp_pci_bus->ops;
dev->bus = bus;
for (dev->devfn = 0; dev->devfn < 256; dev->devfn += 8) {
- if (!pci_read_config_word (dev, PCI_VENDOR_ID, &l) && l != 0x0000 && l != 0xffff) {
- debug ("%s - Inside bus_struture_fixup()\n", __FUNCTION__);
- pci_scan_bus (busno, ibmphp_pci_bus->ops, NULL);
+ if (!pci_read_config_word(dev, PCI_VENDOR_ID, &l) &&
+ (l != 0x0000) && (l != 0xffff)) {
+ debug("%s - Inside bus_struture_fixup()\n",
+ __FUNCTION__);
+ pci_scan_bus(busno, ibmphp_pci_bus->ops, NULL);
break;
}
}
- kfree (dev);
- kfree (bus);
+ kfree(dev);
+ kfree(bus);
return 0;
}
-static int ibm_configure_device (struct pci_func *func)
+static int ibm_configure_device(struct pci_func *func)
{
unsigned char bus;
struct pci_bus *child;
int num;
- int flag = 0; /* this is to make sure we don't double scan the bus, for bridged devices primarily */
+ int flag = 0; /* this is to make sure we don't double scan the bus,
+ for bridged devices primarily */
- if (!(bus_structure_fixup (func->busno)))
+ if (!(bus_structure_fixup(func->busno)))
flag = 1;
if (func->dev == NULL)
- func->dev = pci_find_slot (func->busno, PCI_DEVFN(func->device, func->function));
+ func->dev = pci_find_slot(func->busno,
+ PCI_DEVFN(func->device, func->function));
if (func->dev == NULL) {
struct pci_bus *bus = pci_find_bus(0, func->busno);
if (!bus)
return 0;
- num = pci_scan_slot(bus, PCI_DEVFN(func->device, func->function));
+ num = pci_scan_slot(bus,
+ PCI_DEVFN(func->device, func->function));
if (num)
pci_bus_add_devices(bus);
- func->dev = pci_find_slot(func->busno, PCI_DEVFN(func->device, func->function));
+ func->dev = pci_find_slot(func->busno,
+ PCI_DEVFN(func->device, func->function));
if (func->dev == NULL) {
- err ("ERROR... : pci_dev still NULL\n");
+ err("ERROR... : pci_dev still NULL\n");
return 0;
}
}
if (!(flag) && (func->dev->hdr_type == PCI_HEADER_TYPE_BRIDGE)) {
- pci_read_config_byte (func->dev, PCI_SECONDARY_BUS, &bus);
- child = (struct pci_bus *) pci_add_new_bus (func->dev->bus, (func->dev), bus);
- pci_do_scan_bus (child);
+ pci_read_config_byte(func->dev, PCI_SECONDARY_BUS, &bus);
+ child = (struct pci_bus *) pci_add_new_bus(func->dev->bus,
+ (func->dev), bus);
+ pci_do_scan_bus(child);
}
return 0;
@@ -803,7 +862,7 @@
/*******************************************************
* Returns whether the bus is empty or not
*******************************************************/
-static int is_bus_empty (struct slot * slot_cur)
+static int is_bus_empty(struct slot * slot_cur)
{
int rc;
struct slot * tmp_slot;
@@ -814,13 +873,14 @@
i++;
continue;
}
- tmp_slot = ibmphp_get_slot_from_physical_num (i);
+ tmp_slot = ibmphp_get_slot_from_physical_num(i);
if (!tmp_slot)
return 0;
- rc = slot_update (&tmp_slot);
+ rc = slot_update(&tmp_slot);
if (rc)
return 0;
- if (SLOT_PRESENT (tmp_slot->status) && SLOT_PWRGD (tmp_slot->status))
+ if (SLOT_PRESENT(tmp_slot->status) &&
+ SLOT_PWRGD(tmp_slot->status))
return 0;
i++;
}
@@ -833,7 +893,7 @@
* Parameters: slot
* Returns: bus is set (0) or error code
***********************************************************/
-static int set_bus (struct slot * slot_cur)
+static int set_bus(struct slot * slot_cur)
{
int rc;
u8 speed;
@@ -844,22 +904,23 @@
{ },
};
- debug ("%s - entry slot # %d\n", __FUNCTION__, slot_cur->number);
- if (SET_BUS_STATUS (slot_cur->ctrl) && is_bus_empty (slot_cur)) {
- rc = slot_update (&slot_cur);
+ debug("%s - entry slot # %d\n", __FUNCTION__, slot_cur->number);
+ if (SET_BUS_STATUS(slot_cur->ctrl) && is_bus_empty(slot_cur)) {
+ rc = slot_update(&slot_cur);
if (rc)
return rc;
- speed = SLOT_SPEED (slot_cur->ext_status);
- debug ("ext_status = %x, speed = %x\n", slot_cur->ext_status, speed);
+ speed = SLOT_SPEED(slot_cur->ext_status);
+ debug("ext_status = %x, speed = %x\n", slot_cur->ext_status, speed);
switch (speed) {
case HPC_SLOT_SPEED_33:
cmd = HPC_BUS_33CONVMODE;
break;
case HPC_SLOT_SPEED_66:
- if (SLOT_PCIX (slot_cur->ext_status)) {
- if ((slot_cur->supported_speed >= BUS_SPEED_66) && (slot_cur->supported_bus_mode == BUS_MODE_PCIX))
+ if (SLOT_PCIX(slot_cur->ext_status)) {
+ if ((slot_cur->supported_speed >= BUS_SPEED_66) &&
+ (slot_cur->supported_bus_mode == BUS_MODE_PCIX))
cmd = HPC_BUS_66PCIXMODE;
- else if (!SLOT_BUS_MODE (slot_cur->ext_status))
+ else if (!SLOT_BUS_MODE(slot_cur->ext_status))
/* if max slot/bus capability is 66 pci
and there's no bus mode mismatch, then
the adapter supports 66 pci */
@@ -890,33 +951,35 @@
case BUS_SPEED_133:
/* This is to take care of the bug in CIOBX chip */
if (pci_dev_present(ciobx))
- ibmphp_hpc_writeslot (slot_cur, HPC_BUS_100PCIXMODE);
+ ibmphp_hpc_writeslot(slot_cur,
+ HPC_BUS_100PCIXMODE);
cmd = HPC_BUS_133PCIXMODE;
break;
default:
- err ("Wrong bus speed\n");
+ err("Wrong bus speed\n");
return -ENODEV;
}
break;
default:
- err ("wrong slot speed\n");
+ err("wrong slot speed\n");
return -ENODEV;
}
- debug ("setting bus speed for slot %d, cmd %x\n", slot_cur->number, cmd);
- retval = ibmphp_hpc_writeslot (slot_cur, cmd);
+ debug("setting bus speed for slot %d, cmd %x\n",
+ slot_cur->number, cmd);
+ retval = ibmphp_hpc_writeslot(slot_cur, cmd);
if (retval) {
- err ("setting bus speed failed\n");
+ err("setting bus speed failed\n");
return retval;
}
- if (CTLR_RESULT (slot_cur->ctrl->status)) {
- err ("command not completed successfully in set_bus\n");
+ if (CTLR_RESULT(slot_cur->ctrl->status)) {
+ err("command not completed successfully in set_bus\n");
return -EIO;
}
}
/* This is for x440, once Brandon fixes the firmware,
will not need this delay */
msleep(1000);
- debug ("%s -Exit\n", __FUNCTION__);
+ debug("%s -Exit\n", __FUNCTION__);
return 0;
}
@@ -927,7 +990,7 @@
* Parameters: slot
* Returns: 0 = no limitations, -EINVAL = exceeded limitations on the bus
*/
-static int check_limitations (struct slot *slot_cur)
+static int check_limitations(struct slot *slot_cur)
{
u8 i;
struct slot * tmp_slot;
@@ -935,13 +998,14 @@
u8 limitation = 0;
for (i = slot_cur->bus_on->slot_min; i <= slot_cur->bus_on->slot_max; i++) {
- tmp_slot = ibmphp_get_slot_from_physical_num (i);
+ tmp_slot = ibmphp_get_slot_from_physical_num(i);
if (!tmp_slot)
return -ENODEV;
- if ((SLOT_PWRGD (tmp_slot->status)) && !(SLOT_CONNECT (tmp_slot->status)))
+ if ((SLOT_PWRGD(tmp_slot->status)) &&
+ !(SLOT_CONNECT(tmp_slot->status)))
count++;
}
- get_cur_bus_info (&slot_cur);
+ get_cur_bus_info(&slot_cur);
switch (slot_cur->bus_on->current_speed) {
case BUS_SPEED_33:
limitation = slot_cur->bus_on->slots_at_33_conv;
@@ -965,17 +1029,17 @@
return 0;
}
-static inline void print_card_capability (struct slot *slot_cur)
+static inline void print_card_capability(struct slot *slot_cur)
{
- info ("capability of the card is ");
+ info("capability of the card is ");
if ((slot_cur->ext_status & CARD_INFO) == PCIX133)
- info (" 133 MHz PCI-X\n");
+ info(" 133 MHz PCI-X\n");
else if ((slot_cur->ext_status & CARD_INFO) == PCIX66)
- info (" 66 MHz PCI-X\n");
+ info(" 66 MHz PCI-X\n");
else if ((slot_cur->ext_status & CARD_INFO) == PCI66)
- info (" 66 MHz PCI\n");
+ info(" 66 MHz PCI\n");
else
- info (" 33 MHz PCI\n");
+ info(" 33 MHz PCI\n");
}
@@ -984,118 +1048,128 @@
* Parameters: hotplug_slot
* Returns: 0 or failure codes
*/
-static int enable_slot (struct hotplug_slot *hs)
+static int enable_slot(struct hotplug_slot *hs)
{
int rc, i, rcpr;
struct slot *slot_cur;
u8 function;
struct pci_func *tmp_func;
- ibmphp_lock_operations ();
+ ibmphp_lock_operations();
- debug ("ENABLING SLOT........\n");
+ debug("ENABLING SLOT........\n");
slot_cur = (struct slot *) hs->private;
- if ((rc = validate (slot_cur, ENABLE))) {
- err ("validate function failed\n");
+ if ((rc = validate(slot_cur, ENABLE))) {
+ err("validate function failed\n");
goto error_nopower;
}
- attn_LED_blink (slot_cur);
+ attn_LED_blink(slot_cur);
- rc = set_bus (slot_cur);
+ rc = set_bus(slot_cur);
if (rc) {
- err ("was not able to set the bus\n");
+ err("was not able to set the bus\n");
goto error_nopower;
}
/*-----------------debugging------------------------------*/
- get_cur_bus_info (&slot_cur);
- debug ("the current bus speed right after set_bus = %x\n", slot_cur->bus_on->current_speed);
+ get_cur_bus_info(&slot_cur);
+ debug("the current bus speed right after set_bus = %x\n",
+ slot_cur->bus_on->current_speed);
/*----------------------------------------------------------*/
- rc = check_limitations (slot_cur);
+ rc = check_limitations(slot_cur);
if (rc) {
- err ("Adding this card exceeds the limitations of this bus.\n");
- err ("(i.e., >1 133MHz cards running on same bus, or "
+ err("Adding this card exceeds the limitations of this bus.\n");
+ err("(i.e., >1 133MHz cards running on same bus, or "
">2 66 PCI cards running on same bus\n.");
- err ("Try hot-adding into another bus\n");
+ err("Try hot-adding into another bus\n");
rc = -EINVAL;
goto error_nopower;
}
- rc = power_on (slot_cur);
+ rc = power_on(slot_cur);
if (rc) {
- err ("something wrong when powering up... please see below for details\n");
+ err("something wrong when powering up... please see below for details\n");
/* need to turn off before on, otherwise, blinking overwrites */
attn_off(slot_cur);
- attn_on (slot_cur);
- if (slot_update (&slot_cur)) {
- attn_off (slot_cur);
- attn_on (slot_cur);
+ attn_on(slot_cur);
+ if (slot_update(&slot_cur)) {
+ attn_off(slot_cur);
+ attn_on(slot_cur);
rc = -ENODEV;
goto exit;
}
/* Check to see the error of why it failed */
- if ((SLOT_POWER (slot_cur->status)) && !(SLOT_PWRGD (slot_cur->status)))
- err ("power fault occurred trying to power up\n");
- else if (SLOT_BUS_SPEED (slot_cur->status)) {
- err ("bus speed mismatch occurred. please check current bus speed and card capability\n");
- print_card_capability (slot_cur);
- } else if (SLOT_BUS_MODE (slot_cur->ext_status)) {
- err ("bus mode mismatch occurred. please check current bus mode and card capability\n");
- print_card_capability (slot_cur);
+ if ((SLOT_POWER(slot_cur->status)) &&
+ !(SLOT_PWRGD(slot_cur->status)))
+ err("power fault occurred trying to power up\n");
+ else if (SLOT_BUS_SPEED(slot_cur->status)) {
+ err("bus speed mismatch occurred. please check "
+ "current bus speed and card capability\n");
+ print_card_capability(slot_cur);
+ } else if (SLOT_BUS_MODE(slot_cur->ext_status)) {
+ err("bus mode mismatch occurred. please check "
+ "current bus mode and card capability\n");
+ print_card_capability(slot_cur);
}
- ibmphp_update_slot_info (slot_cur);
+ ibmphp_update_slot_info(slot_cur);
goto exit;
}
- debug ("after power_on\n");
+ debug("after power_on\n");
/*-----------------------debugging---------------------------*/
- get_cur_bus_info (&slot_cur);
- debug ("the current bus speed right after power_on = %x\n", slot_cur->bus_on->current_speed);
+ get_cur_bus_info(&slot_cur);
+ debug("the current bus speed right after power_on = %x\n",
+ slot_cur->bus_on->current_speed);
/*----------------------------------------------------------*/
- rc = slot_update (&slot_cur);
+ rc = slot_update(&slot_cur);
if (rc)
goto error_power;
rc = -EINVAL;
- if (SLOT_POWER (slot_cur->status) && !(SLOT_PWRGD (slot_cur->status))) {
- err ("power fault occurred trying to power up...\n");
+ if (SLOT_POWER(slot_cur->status) && !(SLOT_PWRGD(slot_cur->status))) {
+ err("power fault occurred trying to power up...\n");
goto error_power;
}
- if (SLOT_POWER (slot_cur->status) && (SLOT_BUS_SPEED (slot_cur->status))) {
- err ("bus speed mismatch occurred. please check current bus speed and card capability\n");
- print_card_capability (slot_cur);
+ if (SLOT_POWER(slot_cur->status) && (SLOT_BUS_SPEED(slot_cur->status))) {
+ err("bus speed mismatch occurred. please check current bus "
+ "speed and card capability\n");
+ print_card_capability(slot_cur);
goto error_power;
}
- /* Don't think this case will happen after above checks... but just in case, for paranoia sake */
- if (!(SLOT_POWER (slot_cur->status))) {
- err ("power on failed...\n");
+ /* Don't think this case will happen after above checks...
+ * but just in case, for paranoia sake */
+ if (!(SLOT_POWER(slot_cur->status))) {
+ err("power on failed...\n");
goto error_power;
}
- slot_cur->func = (struct pci_func *) kmalloc (sizeof (struct pci_func), GFP_KERNEL);
+ slot_cur->func = (struct pci_func *) kmalloc(sizeof(struct pci_func), GFP_KERNEL);
if (!slot_cur->func) {
/* We cannot do update_slot_info here, since no memory for
* kmalloc n.e.ways, and update_slot_info allocates some */
- err ("out of system memory\n");
+ err("out of system memory\n");
rc = -ENOMEM;
goto error_power;
}
- memset (slot_cur->func, 0, sizeof (struct pci_func));
+ memset(slot_cur->func, 0, sizeof(struct pci_func));
slot_cur->func->busno = slot_cur->bus;
slot_cur->func->device = slot_cur->device;
for (i = 0; i < 4; i++)
slot_cur->func->irq[i] = slot_cur->irq[i];
- debug ("b4 configure_card, slot_cur->bus = %x, slot_cur->device = %x\n", slot_cur->bus, slot_cur->device);
+ debug("b4 configure_card, slot_cur->bus = %x, slot_cur->device = %x\n",
+ slot_cur->bus, slot_cur->device);
- if (ibmphp_configure_card (slot_cur->func, slot_cur->number)) {
- err ("configure_card was unsuccessful...\n");
- ibmphp_unconfigure_card (&slot_cur, 1); /* true because don't need to actually deallocate resources, just remove references */
- debug ("after unconfigure_card\n");
+ if (ibmphp_configure_card(slot_cur->func, slot_cur->number)) {
+ err("configure_card was unsuccessful...\n");
+ /* true because don't need to actually deallocate resources,
+ * just remove references */
+ ibmphp_unconfigure_card(&slot_cur, 1);
+ debug("after unconfigure_card\n");
slot_cur->func = NULL;
rc = -ENOMEM;
goto error_power;
@@ -1103,38 +1177,39 @@
function = 0x00;
do {
- tmp_func = ibm_slot_find (slot_cur->bus, slot_cur->func->device, function++);
+ tmp_func = ibm_slot_find(slot_cur->bus, slot_cur->func->device,
+ function++);
if (tmp_func && !(tmp_func->dev))
- ibm_configure_device (tmp_func);
+ ibm_configure_device(tmp_func);
} while (tmp_func);
- attn_off (slot_cur);
- if (slot_update (&slot_cur)) {
+ attn_off(slot_cur);
+ if (slot_update(&slot_cur)) {
rc = -EFAULT;
goto exit;
}
- ibmphp_print_test ();
- rc = ibmphp_update_slot_info (slot_cur);
+ ibmphp_print_test();
+ rc = ibmphp_update_slot_info(slot_cur);
exit:
ibmphp_unlock_operations();
return rc;
error_nopower:
- attn_off (slot_cur); /* need to turn off if was blinking b4 */
- attn_on (slot_cur);
+ attn_off(slot_cur); /* need to turn off if was blinking b4 */
+ attn_on(slot_cur);
error_cont:
- rcpr = slot_update (&slot_cur);
+ rcpr = slot_update(&slot_cur);
if (rcpr) {
rc = rcpr;
goto exit;
}
- ibmphp_update_slot_info (slot_cur);
+ ibmphp_update_slot_info(slot_cur);
goto exit;
error_power:
- attn_off (slot_cur); /* need to turn off if was blinking b4 */
- attn_on (slot_cur);
- rcpr = power_off (slot_cur);
+ attn_off(slot_cur); /* need to turn off if was blinking b4 */
+ attn_on(slot_cur);
+ rcpr = power_off(slot_cur);
if (rcpr) {
rc = rcpr;
goto exit;
@@ -1148,7 +1223,7 @@
* OUTPUT: SUCCESS 0 ; FAILURE: UNCONFIGURE , VALIDATE *
DISABLE POWER , *
**************************************************************/
-static int ibmphp_disable_slot (struct hotplug_slot *hotplug_slot)
+static int ibmphp_disable_slot(struct hotplug_slot *hotplug_slot)
{
struct slot *slot = hotplug_slot->private;
int rc;
@@ -1159,12 +1234,12 @@
return rc;
}
-int ibmphp_do_disable_slot (struct slot *slot_cur)
+int ibmphp_do_disable_slot(struct slot *slot_cur)
{
int rc;
u8 flag;
- debug ("DISABLING SLOT...\n");
+ debug("DISABLING SLOT...\n");
if ((slot_cur == NULL) || (slot_cur->ctrl == NULL)) {
return -ENODEV;
@@ -1174,21 +1249,22 @@
slot_cur->flag = TRUE;
if (flag == TRUE) {
- rc = validate (slot_cur, DISABLE); /* checking if powered off already & valid slot # */
+ rc = validate(slot_cur, DISABLE);
+ /* checking if powered off already & valid slot # */
if (rc)
goto error;
}
- attn_LED_blink (slot_cur);
+ attn_LED_blink(slot_cur);
if (slot_cur->func == NULL) {
/* We need this for fncs's that were there on bootup */
- slot_cur->func = (struct pci_func *) kmalloc (sizeof (struct pci_func), GFP_KERNEL);
+ slot_cur->func = (struct pci_func *) kmalloc(sizeof(struct pci_func), GFP_KERNEL);
if (!slot_cur->func) {
- err ("out of system memory\n");
+ err("out of system memory\n");
rc = -ENOMEM;
goto error;
}
- memset (slot_cur->func, 0, sizeof (struct pci_func));
+ memset(slot_cur->func, 0, sizeof(struct pci_func));
slot_cur->func->busno = slot_cur->bus;
slot_cur->func->device = slot_cur->device;
}
@@ -1202,42 +1278,42 @@
lists at least */
if (!flag) {
- attn_off (slot_cur);
+ attn_off(slot_cur);
return 0;
}
- rc = ibmphp_unconfigure_card (&slot_cur, 0);
+ rc = ibmphp_unconfigure_card(&slot_cur, 0);
slot_cur->func = NULL;
- debug ("in disable_slot. after unconfigure_card\n");
+ debug("in disable_slot. after unconfigure_card\n");
if (rc) {
- err ("could not unconfigure card.\n");
+ err("could not unconfigure card.\n");
goto error;
}
- rc = ibmphp_hpc_writeslot (slot_cur, HPC_SLOT_OFF);
+ rc = ibmphp_hpc_writeslot(slot_cur, HPC_SLOT_OFF);
if (rc)
goto error;
- attn_off (slot_cur);
- rc = slot_update (&slot_cur);
+ attn_off(slot_cur);
+ rc = slot_update(&slot_cur);
if (rc)
goto exit;
- rc = ibmphp_update_slot_info (slot_cur);
- ibmphp_print_test ();
+ rc = ibmphp_update_slot_info(slot_cur);
+ ibmphp_print_test();
exit:
return rc;
error:
/* Need to turn off if was blinking b4 */
- attn_off (slot_cur);
- attn_on (slot_cur);
- if (slot_update (&slot_cur)) {
+ attn_off(slot_cur);
+ attn_on(slot_cur);
+ if (slot_update(&slot_cur)) {
rc = -EFAULT;
goto exit;
}
if (flag)
- ibmphp_update_slot_info (slot_cur);
+ ibmphp_update_slot_info(slot_cur);
goto exit;
}
@@ -1258,22 +1334,22 @@
*/
};
-static void ibmphp_unload (void)
+static void ibmphp_unload(void)
{
- free_slots ();
- debug ("after slots\n");
- ibmphp_free_resources ();
- debug ("after resources\n");
- ibmphp_free_bus_info_queue ();
- debug ("after bus info\n");
- ibmphp_free_ebda_hpc_queue ();
- debug ("after ebda hpc\n");
- ibmphp_free_ebda_pci_rsrc_queue ();
- debug ("after ebda pci rsrc\n");
- kfree (ibmphp_pci_bus);
+ free_slots();
+ debug("after slots\n");
+ ibmphp_free_resources();
+ debug("after resources\n");
+ ibmphp_free_bus_info_queue();
+ debug("after bus info\n");
+ ibmphp_free_ebda_hpc_queue();
+ debug("after ebda hpc\n");
+ ibmphp_free_ebda_pci_rsrc_queue();
+ debug("after ebda pci rsrc\n");
+ kfree(ibmphp_pci_bus);
}
-static int __init ibmphp_init (void)
+static int __init ibmphp_init(void)
{
struct pci_bus *bus;
int i = 0;
@@ -1281,50 +1357,50 @@
init_flag = 1;
- info (DRIVER_DESC " version: " DRIVER_VERSION "\n");
+ info(DRIVER_DESC " version: " DRIVER_VERSION "\n");
- ibmphp_pci_bus = kmalloc (sizeof (*ibmphp_pci_bus), GFP_KERNEL);
+ ibmphp_pci_bus = kmalloc(sizeof(*ibmphp_pci_bus), GFP_KERNEL);
if (!ibmphp_pci_bus) {
- err ("out of memory\n");
+ err("out of memory\n");
rc = -ENOMEM;
goto exit;
}
bus = pci_find_bus(0, 0);
if (!bus) {
- err ("Can't find the root pci bus, can not continue\n");
+ err("Can't find the root pci bus, can not continue\n");
rc = -ENODEV;
goto error;
}
- memcpy (ibmphp_pci_bus, bus, sizeof (*ibmphp_pci_bus));
+ memcpy(ibmphp_pci_bus, bus, sizeof(*ibmphp_pci_bus));
ibmphp_debug = debug;
- ibmphp_hpc_initvars ();
+ ibmphp_hpc_initvars();
for (i = 0; i < 16; i++)
irqs[i] = 0;
- if ((rc = ibmphp_access_ebda ()))
+ if ((rc = ibmphp_access_ebda()))
goto error;
- debug ("after ibmphp_access_ebda ()\n");
+ debug("after ibmphp_access_ebda()\n");
- if ((rc = ibmphp_rsrc_init ()))
+ if ((rc = ibmphp_rsrc_init()))
goto error;
- debug ("AFTER Resource & EBDA INITIALIZATIONS\n");
+ debug("AFTER Resource & EBDA INITIALIZATIONS\n");
- max_slots = get_max_slots ();
+ max_slots = get_max_slots();
- if ((rc = ibmphp_register_pci ()))
+ if ((rc = ibmphp_register_pci()))
goto error;
- if (init_ops ()) {
+ if (init_ops()) {
rc = -ENODEV;
goto error;
}
- ibmphp_print_test ();
- if ((rc = ibmphp_hpc_start_poll_thread ())) {
+ ibmphp_print_test();
+ if ((rc = ibmphp_hpc_start_poll_thread())) {
goto error;
}
@@ -1336,17 +1412,17 @@
return rc;
error:
- ibmphp_unload ();
+ ibmphp_unload();
goto exit;
}
-static void __exit ibmphp_exit (void)
+static void __exit ibmphp_exit(void)
{
- ibmphp_hpc_stop_poll_thread ();
- debug ("after polling\n");
- ibmphp_unload ();
- debug ("done\n");
+ ibmphp_hpc_stop_poll_thread();
+ debug("after polling\n");
+ ibmphp_unload();
+ debug("done\n");
}
-module_init (ibmphp_init);
-module_exit (ibmphp_exit);
+module_init(ibmphp_init);
+module_exit(ibmphp_exit);
ChangeSet 1.1938.447.18, 2004/12/22 09:46:15-08:00, [email protected]
PCI: fix bttv-driver "cleanup" that called an incorrect function.
Signed-off-by: Greg Kroah-Hartman <[email protected]>
drivers/media/video/bttv-driver.c | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)
diff -Nru a/drivers/media/video/bttv-driver.c b/drivers/media/video/bttv-driver.c
--- a/drivers/media/video/bttv-driver.c 2005-01-10 08:59:42 -08:00
+++ b/drivers/media/video/bttv-driver.c 2005-01-10 08:59:42 -08:00
@@ -3942,7 +3942,7 @@
/* save pci state */
pci_save_state(pci_dev);
- if (0 != pci_set_power_state(pci_dev, device_to_pci_power(pci_dev, state))) {
+ if (0 != pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state))) {
pci_disable_device(pci_dev);
btv->state.disabled = 1;
}
ChangeSet 1.1938.447.3, 2004/12/16 15:59:03-08:00, [email protected]
[PATCH] PCI Hotplug: drivers/pci/hotplug/ : simply use MODULE
The patch below lets five files under drivers/pci/hotplug/ simply use
MODULE to check whether they are compiled as part of a module.
MODULE is the common idiom for checking whether a file is built as part
of a module.
In theory, my patch shouldn't have made any difference, but if you look
closely, the previous #if's in cpcihp_generic.c and cpci_hotplug_pci.c
weren't correct.
Signed-off-by: Adrian Bunk <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
drivers/pci/hotplug/cpci_hotplug_pci.c | 2 +-
drivers/pci/hotplug/cpcihp_generic.c | 2 +-
drivers/pci/hotplug/fakephp.c | 2 +-
drivers/pci/hotplug/ibmphp.h | 2 +-
drivers/pci/hotplug/shpchp.h | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff -Nru a/drivers/pci/hotplug/cpci_hotplug_pci.c b/drivers/pci/hotplug/cpci_hotplug_pci.c
--- a/drivers/pci/hotplug/cpci_hotplug_pci.c 2005-01-10 09:05:51 -08:00
+++ b/drivers/pci/hotplug/cpci_hotplug_pci.c 2005-01-10 09:05:51 -08:00
@@ -32,7 +32,7 @@
#include "pci_hotplug.h"
#include "cpci_hotplug.h"
-#if !defined(CONFIG_HOTPLUG_CPCI_MODULE)
+#if !defined(MODULE)
#define MY_NAME "cpci_hotplug"
#else
#define MY_NAME THIS_MODULE->name
diff -Nru a/drivers/pci/hotplug/cpcihp_generic.c b/drivers/pci/hotplug/cpcihp_generic.c
--- a/drivers/pci/hotplug/cpcihp_generic.c 2005-01-10 09:05:51 -08:00
+++ b/drivers/pci/hotplug/cpcihp_generic.c 2005-01-10 09:05:51 -08:00
@@ -45,7 +45,7 @@
#define DRIVER_AUTHOR "Scott Murray <[email protected]>"
#define DRIVER_DESC "Generic port I/O CompactPCI Hot Plug Driver"
-#if !defined(CONFIG_HOTPLUG_CPCI_GENERIC_MODULE)
+#if !defined(MODULE)
#define MY_NAME "cpcihp_generic"
#else
#define MY_NAME THIS_MODULE->name
diff -Nru a/drivers/pci/hotplug/fakephp.c b/drivers/pci/hotplug/fakephp.c
--- a/drivers/pci/hotplug/fakephp.c 2005-01-10 09:05:51 -08:00
+++ b/drivers/pci/hotplug/fakephp.c 2005-01-10 09:05:51 -08:00
@@ -40,7 +40,7 @@
#include "pci_hotplug.h"
#include "../pci.h"
-#if !defined(CONFIG_HOTPLUG_PCI_FAKE_MODULE)
+#if !defined(MODULE)
#define MY_NAME "fakephp"
#else
#define MY_NAME THIS_MODULE->name
diff -Nru a/drivers/pci/hotplug/ibmphp.h b/drivers/pci/hotplug/ibmphp.h
--- a/drivers/pci/hotplug/ibmphp.h 2005-01-10 09:05:51 -08:00
+++ b/drivers/pci/hotplug/ibmphp.h 2005-01-10 09:05:51 -08:00
@@ -34,7 +34,7 @@
extern int ibmphp_debug;
-#if !defined(CONFIG_HOTPLUG_PCI_IBM_MODULE)
+#if !defined(MODULE)
#define MY_NAME "ibmphpd"
#else
#define MY_NAME THIS_MODULE->name
diff -Nru a/drivers/pci/hotplug/shpchp.h b/drivers/pci/hotplug/shpchp.h
--- a/drivers/pci/hotplug/shpchp.h 2005-01-10 09:05:51 -08:00
+++ b/drivers/pci/hotplug/shpchp.h 2005-01-10 09:05:51 -08:00
@@ -36,7 +36,7 @@
#include <asm/io.h>
#include "pci_hotplug.h"
-#if !defined(CONFIG_HOTPLUG_PCI_SHPC_MODULE)
+#if !defined(MODULE)
#define MY_NAME "shpchp"
#else
#define MY_NAME THIS_MODULE->name
ChangeSet 1.1938.439.48, 2005/01/09 23:00:42-08:00, [email protected]
PCI Hotplug: remove my old email address
Signed-off-by: Greg Kroah-Hartman <[email protected]>
MAINTAINERS | 1 -
1 files changed, 1 deletion(-)
diff -Nru a/MAINTAINERS b/MAINTAINERS
--- a/MAINTAINERS 2005-01-10 08:58:28 -08:00
+++ b/MAINTAINERS 2005-01-10 08:58:28 -08:00
@@ -1713,7 +1713,6 @@
PCI HOTPLUG CORE
P: Greg Kroah-Hartman
M: [email protected]
-M: [email protected]
S: Supported
PCI HOTPLUG COMPAQ DRIVER
ChangeSet 1.1938.447.9, 2004/12/17 14:01:35-08:00, [email protected]
[PATCH] PCI: Cleanup PCI power states
> > > > This is step 0 before adding type-safety to PCI layer... It introduces
> > > > constants and uses them to clean driver up. I'd like this to go in
> > > > now, so that I can convert drivers during 2.6.10... Please apply,
Okay, here it is, slightly expanded version. It actually makes use of
newly defined type for type-checking purposes; still no code changes.
From: Pavel Machek <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
drivers/pci/pci.c | 8 ++++----
include/linux/pci.h | 14 +++++++++++---
2 files changed, 15 insertions(+), 7 deletions(-)
diff -Nru a/drivers/pci/pci.c b/drivers/pci/pci.c
--- a/drivers/pci/pci.c 2005-01-10 09:02:17 -08:00
+++ b/drivers/pci/pci.c 2005-01-10 09:02:17 -08:00
@@ -229,7 +229,7 @@
/**
* pci_set_power_state - Set the power state of a PCI device
* @dev: PCI device to be suspended
- * @state: Power state we're entering
+ * @state: PCI power state (D0, D1, D2, D3hot, D3cold) we're entering
*
* Transition a device to a new power state, using the Power Management
* Capabilities in the device's config space.
@@ -242,7 +242,7 @@
*/
int
-pci_set_power_state(struct pci_dev *dev, int state)
+pci_set_power_state(struct pci_dev *dev, pci_power_t state)
{
int pm;
u16 pmcsr, pmc;
@@ -354,7 +354,7 @@
{
int err;
- pci_set_power_state(dev, 0);
+ pci_set_power_state(dev, PCI_D0);
if ((err = pcibios_enable_device(dev, bars)) < 0)
return err;
return 0;
@@ -428,7 +428,7 @@
* 0 if operation is successful.
*
*/
-int pci_enable_wake(struct pci_dev *dev, u32 state, int enable)
+int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable)
{
int pm;
u16 value;
diff -Nru a/include/linux/pci.h b/include/linux/pci.h
--- a/include/linux/pci.h 2005-01-10 09:02:17 -08:00
+++ b/include/linux/pci.h 2005-01-10 09:02:17 -08:00
@@ -480,6 +480,14 @@
#define DEVICE_COUNT_COMPATIBLE 4
#define DEVICE_COUNT_RESOURCE 12
+typedef int __bitwise pci_power_t;
+
+#define PCI_D0 ((pci_power_t __force) 0)
+#define PCI_D1 ((pci_power_t __force) 1)
+#define PCI_D2 ((pci_power_t __force) 2)
+#define PCI_D3hot ((pci_power_t __force) 3)
+#define PCI_D3cold ((pci_power_t __force) 4)
+
/*
* The pci_dev structure is used to describe PCI devices.
*/
@@ -508,7 +516,7 @@
this if your device has broken DMA
or supports 64-bit transfers. */
- u32 current_state; /* Current operating state. In ACPI-speak,
+ pci_power_t current_state; /* Current operating state. In ACPI-speak,
this is D0-D3, D0 being fully functional,
and D3 being off. */
@@ -797,8 +805,8 @@
/* Power management related routines */
int pci_save_state(struct pci_dev *dev);
int pci_restore_state(struct pci_dev *dev);
-int pci_set_power_state(struct pci_dev *dev, int state);
-int pci_enable_wake(struct pci_dev *dev, u32 state, int enable);
+int pci_set_power_state(struct pci_dev *dev, pci_power_t state);
+int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable);
/* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */
void pci_bus_assign_resources(struct pci_bus *bus);
ChangeSet 1.1938.447.13, 2004/12/21 11:57:56-08:00, [email protected]
[PATCH] PCI: add prototype for pci_choose_state()
This adds missing prototype for pci_choose_state.
Signed-off-by: Pavel Machek <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
include/linux/pci.h | 2 ++
1 files changed, 2 insertions(+)
diff -Nru a/include/linux/pci.h b/include/linux/pci.h
--- a/include/linux/pci.h 2005-01-10 09:00:36 -08:00
+++ b/include/linux/pci.h 2005-01-10 09:00:36 -08:00
@@ -806,6 +806,7 @@
int pci_save_state(struct pci_dev *dev);
int pci_restore_state(struct pci_dev *dev);
int pci_set_power_state(struct pci_dev *dev, pci_power_t state);
+pci_power_t pci_choose_state(struct pci_dev *dev, u32 state);
int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable);
/* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */
@@ -934,6 +935,7 @@
static inline int pci_save_state(struct pci_dev *dev) { return 0; }
static inline int pci_restore_state(struct pci_dev *dev) { return 0; }
static inline int pci_set_power_state(struct pci_dev *dev, pci_power_t state) { return 0; }
+static inline pci_power_t pci_choose_state(struct pci_dev *dev, u32 state) { return PCI_D0; }
static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable) { return 0; }
#define isa_bridge ((struct pci_dev *)NULL)
ChangeSet 1.1938.439.46, 2005/01/07 10:33:32-08:00, [email protected]
[PATCH] PCI Hotplug: use PCI_DEVFN in ibmphp_pci.c
This patch changes ibmphp_pci.c to use the PCI_DEVFN makro where possible
instead of doing the match itself.
Signed-off-by: Rolf Eike Beer <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
drivers/pci/hotplug/ibmphp_pci.c | 23 ++++++++++++++---------
1 files changed, 14 insertions(+), 9 deletions(-)
diff -Nru a/drivers/pci/hotplug/ibmphp_pci.c b/drivers/pci/hotplug/ibmphp_pci.c
--- a/drivers/pci/hotplug/ibmphp_pci.c 2005-01-10 08:58:49 -08:00
+++ b/drivers/pci/hotplug/ibmphp_pci.c 2005-01-10 08:58:49 -08:00
@@ -414,7 +414,7 @@
memset (io[count], 0, sizeof (struct resource_node));
io[count]->type = IO;
io[count]->busno = func->busno;
- io[count]->devfunc = ((func->device << 3) | (func->function & 0x7));
+ io[count]->devfunc = PCI_DEVFN(func->device, func->function);
io[count]->len = len[count];
if (ibmphp_check_resource(io[count], 0) == 0) {
ibmphp_add_resource (io[count]);
@@ -452,7 +452,8 @@
memset (pfmem[count], 0, sizeof (struct resource_node));
pfmem[count]->type = PFMEM;
pfmem[count]->busno = func->busno;
- pfmem[count]->devfunc = ((func->device << 3) | (func->function & 0x7));
+ pfmem[count]->devfunc = PCI_DEVFN(func->device,
+ func->function);
pfmem[count]->len = len[count];
pfmem[count]->fromMem = FALSE;
if (ibmphp_check_resource (pfmem[count], 0) == 0) {
@@ -519,7 +520,8 @@
memset (mem[count], 0, sizeof (struct resource_node));
mem[count]->type = MEM;
mem[count]->busno = func->busno;
- mem[count]->devfunc = ((func->device << 3) | (func->function & 0x7));
+ mem[count]->devfunc = PCI_DEVFN(func->device,
+ func->function);
mem[count]->len = len[count];
if (ibmphp_check_resource (mem[count], 0) == 0) {
ibmphp_add_resource (mem[count]);
@@ -685,7 +687,8 @@
memset (bus_io[count], 0, sizeof (struct resource_node));
bus_io[count]->type = IO;
bus_io[count]->busno = func->busno;
- bus_io[count]->devfunc = ((func->device << 3) | (func->function & 0x7));
+ bus_io[count]->devfunc = PCI_DEVFN(func->device,
+ func->function);
bus_io[count]->len = len[count];
if (ibmphp_check_resource (bus_io[count], 0) == 0) {
ibmphp_add_resource (bus_io[count]);
@@ -717,7 +720,8 @@
memset (bus_pfmem[count], 0, sizeof (struct resource_node));
bus_pfmem[count]->type = PFMEM;
bus_pfmem[count]->busno = func->busno;
- bus_pfmem[count]->devfunc = ((func->device << 3) | (func->function & 0x7));
+ bus_pfmem[count]->devfunc = PCI_DEVFN(func->device,
+ func->function);
bus_pfmem[count]->len = len[count];
bus_pfmem[count]->fromMem = FALSE;
if (ibmphp_check_resource (bus_pfmem[count], 0) == 0) {
@@ -775,7 +779,8 @@
memset (bus_mem[count], 0, sizeof (struct resource_node));
bus_mem[count]->type = MEM;
bus_mem[count]->busno = func->busno;
- bus_mem[count]->devfunc = ((func->device << 3) | (func->function & 0x7));
+ bus_mem[count]->devfunc = PCI_DEVFN(func->device,
+ func->function);
bus_mem[count]->len = len[count];
if (ibmphp_check_resource (bus_mem[count], 0) == 0) {
ibmphp_add_resource (bus_mem[count]);
@@ -846,7 +851,7 @@
memset (io, 0, sizeof (struct resource_node));
io->type = IO;
io->busno = func->busno;
- io->devfunc = ((func->device << 3) | (func->function & 0x7));
+ io->devfunc = PCI_DEVFN(func->device, func->function);
io->len = amount_needed->io;
if (ibmphp_check_resource (io, 1) == 0) {
debug ("were we able to add io\n");
@@ -869,7 +874,7 @@
memset (mem, 0, sizeof (struct resource_node));
mem->type = MEM;
mem->busno = func->busno;
- mem->devfunc = ((func->device << 3) | (func->function & 0x7));
+ mem->devfunc = PCI_DEVFN(func->device, func->function);
mem->len = amount_needed->mem;
if (ibmphp_check_resource (mem, 1) == 0) {
ibmphp_add_resource (mem);
@@ -892,7 +897,7 @@
memset (pfmem, 0, sizeof (struct resource_node));
pfmem->type = PFMEM;
pfmem->busno = func->busno;
- pfmem->devfunc = ((func->device << 3) | (func->function & 0x7));
+ pfmem->devfunc = PCI_DEVFN(func->device, func->function);
pfmem->len = amount_needed->pfmem;
pfmem->fromMem = FALSE;
if (ibmphp_check_resource (pfmem, 1) == 0) {
ChangeSet 1.1938.447.8, 2004/12/17 13:44:31-08:00, [email protected]
[PATCH] PCI: Don't touch BARs of host bridges
BARs of host bridges often have special meaning and AFAIK are best left
to be setup by the firmware or system-specific startup code and kept
intact by the generic resource handler. For example a couple of host
bridges used for MIPS processors interpret BARs as target-mode decoders
for accessing host memory by PCI masters (which is quite reasonable).
For them it's desirable to keep their decoded address range overlapping
with the host RAM for simplicity if nothing else (I can imagine running
out of address space with lots of memory and 32-bit PCI with no DAC
support in the participating devices).
This is already the case with the i386 and ppc platform-specific PCI
resource allocators. Please consider the following change for the generic
allocator. Currently we have a pile of hacks implemented for host bridges
to be left untouched and I'd be pleased to remove them.
From: "Maciej W. Rozycki" <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
drivers/pci/setup-bus.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff -Nru a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
--- a/drivers/pci/setup-bus.c 2005-01-10 09:02:52 -08:00
+++ b/drivers/pci/setup-bus.c 2005-01-10 09:02:52 -08:00
@@ -57,8 +57,13 @@
list_for_each_entry(dev, &bus->devices, bus_list) {
u16 class = dev->class >> 8;
- if (class == PCI_CLASS_DISPLAY_VGA
- || class == PCI_CLASS_NOT_DEFINED_VGA)
+ /* Don't touch classless devices and host bridges. */
+ if (class == PCI_CLASS_NOT_DEFINED ||
+ class == PCI_CLASS_BRIDGE_HOST)
+ continue;
+
+ if (class == PCI_CLASS_DISPLAY_VGA ||
+ class == PCI_CLASS_NOT_DEFINED_VGA)
bus->bridge_ctl |= PCI_BRIDGE_CTL_VGA;
pdev_sort_resources(dev, &head);
ChangeSet 1.1938.447.7, 2004/12/17 13:44:10-08:00, [email protected]
[PATCH] PCI: Make pci_set_power_state() check register version
The attached patch makes pci_set_power_state() check the PM register version
and ignore non-version 2 registers. Trampling on earlier version PM registers
such as are sported by the Promise 20269 IDE card can cause the system to
hang.
Signed-Off-By: David Howells <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
drivers/pci/pci.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff -Nru a/drivers/pci/pci.c b/drivers/pci/pci.c
--- a/drivers/pci/pci.c 2005-01-10 09:03:28 -08:00
+++ b/drivers/pci/pci.c 2005-01-10 09:03:28 -08:00
@@ -245,7 +245,7 @@
pci_set_power_state(struct pci_dev *dev, int state)
{
int pm;
- u16 pmcsr;
+ u16 pmcsr, pmc;
/* bound the state we're entering */
if (state > 3) state = 3;
@@ -265,10 +265,16 @@
/* abort if the device doesn't support PM capabilities */
if (!pm) return -EIO;
+ pci_read_config_word(dev,pm + PCI_PM_PMC,&pmc);
+ if ((pmc & PCI_PM_CAP_VER_MASK) != 2) {
+ printk(KERN_WARNING
+ "PCI: %s has unsupported PM cap regs version (%u)\n",
+ dev->slot_name, pmc & PCI_PM_CAP_VER_MASK);
+ return -EIO;
+ }
+
/* check if this device supports the desired state */
if (state == 1 || state == 2) {
- u16 pmc;
- pci_read_config_word(dev,pm + PCI_PM_PMC,&pmc);
if (state == 1 && !(pmc & PCI_PM_CAP_D1)) return -EIO;
else if (state == 2 && !(pmc & PCI_PM_CAP_D2)) return -EIO;
}
ChangeSet 1.1938.447.15, 2004/12/21 16:47:28-08:00, [email protected]
[PATCH] PCI: fix sparse warnings in drivers/net/* and bttv
This should fix sparse warnings in drivers/net/* and bttv.
Signed-off-by: Pavel Machek <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
drivers/media/video/bttv-driver.c | 4 ++--
drivers/net/3c59x.c | 8 ++++----
drivers/net/8139cp.c | 6 +++---
drivers/net/8139too.c | 4 ++--
drivers/net/amd8111e.c | 16 ++++++++--------
drivers/net/e100.c | 4 ++--
drivers/net/eepro100.c | 8 ++++----
drivers/net/pci-skeleton.c | 4 ++--
drivers/net/sis900.c | 4 ++--
drivers/net/starfire.c | 2 +-
drivers/net/typhoon.c | 6 +++---
drivers/net/via-rhine.c | 2 +-
drivers/net/via-velocity.c | 32 ++++++++++++++++----------------
13 files changed, 50 insertions(+), 50 deletions(-)
diff -Nru a/drivers/media/video/bttv-driver.c b/drivers/media/video/bttv-driver.c
--- a/drivers/media/video/bttv-driver.c 2005-01-10 09:00:13 -08:00
+++ b/drivers/media/video/bttv-driver.c 2005-01-10 09:00:13 -08:00
@@ -3942,7 +3942,7 @@
/* save pci state */
pci_save_state(pci_dev);
- if (0 != pci_set_power_state(pci_dev, state)) {
+ if (0 != pci_set_power_state(pci_dev, device_to_pci_power(pci_dev, state))) {
pci_disable_device(pci_dev);
btv->state.disabled = 1;
}
@@ -3961,7 +3961,7 @@
pci_enable_device(pci_dev);
btv->state.disabled = 0;
}
- pci_set_power_state(pci_dev, 0);
+ pci_set_power_state(pci_dev, PCI_D0);
pci_restore_state(pci_dev);
/* restore bt878 state */
diff -Nru a/drivers/net/3c59x.c b/drivers/net/3c59x.c
--- a/drivers/net/3c59x.c 2005-01-10 09:00:13 -08:00
+++ b/drivers/net/3c59x.c 2005-01-10 09:00:13 -08:00
@@ -1549,7 +1549,7 @@
int i;
if (VORTEX_PCI(vp) && vp->enable_wol) {
- pci_set_power_state(VORTEX_PCI(vp), 0); /* Go active */
+ pci_set_power_state(VORTEX_PCI(vp), PCI_D0); /* Go active */
pci_restore_state(VORTEX_PCI(vp));
}
@@ -2941,7 +2941,7 @@
/* The kernel core really should have pci_get_power_state() */
if(state != 0)
- pci_set_power_state(VORTEX_PCI(vp), 0);
+ pci_set_power_state(VORTEX_PCI(vp), PCI_D0);
err = vortex_do_ioctl(dev, rq, cmd);
if(state != 0)
pci_set_power_state(VORTEX_PCI(vp), state);
@@ -3140,7 +3140,7 @@
/* Change the power state to D3; RxEnable doesn't take effect. */
pci_enable_wake(VORTEX_PCI(vp), 0, 1);
- pci_set_power_state(VORTEX_PCI(vp), 3);
+ pci_set_power_state(VORTEX_PCI(vp), PCI_D3hot);
}
@@ -3163,7 +3163,7 @@
unregister_netdev(dev);
if (VORTEX_PCI(vp) && vp->enable_wol) {
- pci_set_power_state(VORTEX_PCI(vp), 0); /* Go active */
+ pci_set_power_state(VORTEX_PCI(vp), PCI_D0); /* Go active */
if (vp->pm_state_valid)
pci_restore_state(VORTEX_PCI(vp));
}
diff -Nru a/drivers/net/8139cp.c b/drivers/net/8139cp.c
--- a/drivers/net/8139cp.c 2005-01-10 09:00:13 -08:00
+++ b/drivers/net/8139cp.c 2005-01-10 09:00:13 -08:00
@@ -1623,7 +1623,7 @@
static void cp_set_d3_state (struct cp_private *cp)
{
pci_enable_wake (cp->pdev, 0, 1); /* Enable PME# generation */
- pci_set_power_state (cp->pdev, 3);
+ pci_set_power_state (cp->pdev, PCI_D3hot);
}
static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
@@ -1813,7 +1813,7 @@
BUG();
unregister_netdev(dev);
iounmap(cp->regs);
- if (cp->wol_enabled) pci_set_power_state (pdev, 0);
+ if (cp->wol_enabled) pci_set_power_state (pdev, PCI_D0);
pci_release_regions(pdev);
pci_clear_mwi(pdev);
pci_disable_device(pdev);
@@ -1863,7 +1863,7 @@
netif_device_attach (dev);
if (cp->pdev && cp->wol_enabled) {
- pci_set_power_state (cp->pdev, 0);
+ pci_set_power_state (cp->pdev, PCI_D0);
pci_restore_state (cp->pdev);
}
diff -Nru a/drivers/net/8139too.c b/drivers/net/8139too.c
--- a/drivers/net/8139too.c 2005-01-10 09:00:13 -08:00
+++ b/drivers/net/8139too.c 2005-01-10 09:00:13 -08:00
@@ -2607,7 +2607,7 @@
spin_unlock_irqrestore (&tp->lock, flags);
- pci_set_power_state (pdev, 3);
+ pci_set_power_state (pdev, PCI_D3hot);
return 0;
}
@@ -2620,7 +2620,7 @@
pci_restore_state (pdev);
if (!netif_running (dev))
return 0;
- pci_set_power_state (pdev, 0);
+ pci_set_power_state (pdev, PCI_D0);
rtl8139_init_ring (dev);
rtl8139_hw_start (dev);
netif_device_attach (dev);
diff -Nru a/drivers/net/amd8111e.c b/drivers/net/amd8111e.c
--- a/drivers/net/amd8111e.c 2005-01-10 09:00:13 -08:00
+++ b/drivers/net/amd8111e.c 2005-01-10 09:00:13 -08:00
@@ -1826,17 +1826,17 @@
if(lp->options & OPTION_WAKE_PHY_ENABLE)
amd8111e_enable_link_change(lp);
- pci_enable_wake(pci_dev, 3, 1);
- pci_enable_wake(pci_dev, 4, 1); /* D3 cold */
+ pci_enable_wake(pci_dev, PCI_D3hot, 1);
+ pci_enable_wake(pci_dev, PCI_D3cold, 1);
}
else{
- pci_enable_wake(pci_dev, 3, 0);
- pci_enable_wake(pci_dev, 4, 0); /* 4 == D3 cold */
+ pci_enable_wake(pci_dev, PCI_D3hot, 0);
+ pci_enable_wake(pci_dev, PCI_D3cold, 0);
}
pci_save_state(pci_dev);
- pci_set_power_state(pci_dev, 3);
+ pci_set_power_state(pci_dev, PCI_D3hot);
return 0;
}
@@ -1848,11 +1848,11 @@
if (!netif_running(dev))
return 0;
- pci_set_power_state(pci_dev, 0);
+ pci_set_power_state(pci_dev, PCI_D0);
pci_restore_state(pci_dev);
- pci_enable_wake(pci_dev, 3, 0);
- pci_enable_wake(pci_dev, 4, 0); /* D3 cold */
+ pci_enable_wake(pci_dev, PCI_D3hot, 0);
+ pci_enable_wake(pci_dev, PCI_D3cold, 0); /* D3 cold */
netif_device_attach(dev);
diff -Nru a/drivers/net/e100.c b/drivers/net/e100.c
--- a/drivers/net/e100.c 2005-01-10 09:00:13 -08:00
+++ b/drivers/net/e100.c 2005-01-10 09:00:13 -08:00
@@ -2326,7 +2326,7 @@
pci_save_state(pdev);
pci_enable_wake(pdev, state, nic->flags & (wol_magic | e100_asf(nic)));
pci_disable_device(pdev);
- pci_set_power_state(pdev, state);
+ pci_set_power_state(pdev, pci_choose_state(pdev, state));
return 0;
}
@@ -2336,7 +2336,7 @@
struct net_device *netdev = pci_get_drvdata(pdev);
struct nic *nic = netdev_priv(netdev);
- pci_set_power_state(pdev, 0);
+ pci_set_power_state(pdev, PCI_D0);
pci_restore_state(pdev);
e100_hw_init(nic);
diff -Nru a/drivers/net/eepro100.c b/drivers/net/eepro100.c
--- a/drivers/net/eepro100.c 2005-01-10 09:00:13 -08:00
+++ b/drivers/net/eepro100.c 2005-01-10 09:00:13 -08:00
@@ -1014,7 +1014,7 @@
if (netif_msg_ifup(sp))
printk(KERN_DEBUG "%s: speedo_open() irq %d.\n", dev->name, dev->irq);
- pci_set_power_state(sp->pdev, 0);
+ pci_set_power_state(sp->pdev, PCI_D0);
/* Set up the Tx queue early.. */
sp->cur_tx = 0;
@@ -1963,7 +1963,7 @@
if (netif_msg_ifdown(sp))
printk(KERN_DEBUG "%s: %d multicast blocks dropped.\n", dev->name, i);
- pci_set_power_state(sp->pdev, 2);
+ pci_set_power_state(sp->pdev, PCI_D2);
return 0;
}
@@ -2088,7 +2088,7 @@
access from the timeout handler.
They are currently serialized only with MDIO access from the
timer routine. 2000/05/09 SAW */
- saved_acpi = pci_set_power_state(sp->pdev, 0);
+ saved_acpi = pci_set_power_state(sp->pdev, PCI_D0);
t = del_timer_sync(&sp->timer);
data->val_out = mdio_read(dev, data->phy_id & 0x1f, data->reg_num & 0x1f);
if (t)
@@ -2099,7 +2099,7 @@
case SIOCSMIIREG: /* Write MII PHY register. */
if (!capable(CAP_NET_ADMIN))
return -EPERM;
- saved_acpi = pci_set_power_state(sp->pdev, 0);
+ saved_acpi = pci_set_power_state(sp->pdev, PCI_D0);
t = del_timer_sync(&sp->timer);
mdio_write(dev, data->phy_id, data->reg_num, data->val_in);
if (t)
diff -Nru a/drivers/net/pci-skeleton.c b/drivers/net/pci-skeleton.c
--- a/drivers/net/pci-skeleton.c 2005-01-10 09:00:13 -08:00
+++ b/drivers/net/pci-skeleton.c 2005-01-10 09:00:13 -08:00
@@ -1921,7 +1921,7 @@
spin_unlock_irqrestore (&tp->lock, flags);
pci_save_state (pdev);
- pci_set_power_state (pdev, 3);
+ pci_set_power_state (pdev, PCI_D3hot);
return 0;
}
@@ -1934,7 +1934,7 @@
if (!netif_running(dev))
return 0;
- pci_set_power_state (pdev, 0);
+ pci_set_power_state (pdev, PCI_D0);
pci_restore_state (pdev);
netif_device_attach (dev);
netdrv_hw_start (dev);
diff -Nru a/drivers/net/sis900.c b/drivers/net/sis900.c
--- a/drivers/net/sis900.c 2005-01-10 09:00:13 -08:00
+++ b/drivers/net/sis900.c 2005-01-10 09:00:13 -08:00
@@ -2238,7 +2238,7 @@
/* Stop the chip's Tx and Rx Status Machine */
outl(RxDIS | TxDIS | inl(ioaddr + cr), ioaddr + cr);
- pci_set_power_state(pci_dev, 3);
+ pci_set_power_state(pci_dev, PCI_D3);
pci_save_state(pci_dev);
return 0;
@@ -2253,7 +2253,7 @@
if(!netif_running(net_dev))
return 0;
pci_restore_state(pci_dev);
- pci_set_power_state(pci_dev, 0);
+ pci_set_power_state(pci_dev, PCI_D0);
sis900_init_rxfilter(net_dev);
diff -Nru a/drivers/net/starfire.c b/drivers/net/starfire.c
--- a/drivers/net/starfire.c 2005-01-10 09:00:13 -08:00
+++ b/drivers/net/starfire.c 2005-01-10 09:00:13 -08:00
@@ -2159,7 +2159,7 @@
/* XXX: add wakeup code -- requires firmware for MagicPacket */
- pci_set_power_state(pdev, 3); /* go to sleep in D3 mode */
+ pci_set_power_state(pdev, PCI_D3hot); /* go to sleep in D3 mode */
pci_disable_device(pdev);
iounmap((char *)dev->base_addr);
diff -Nru a/drivers/net/typhoon.c b/drivers/net/typhoon.c
--- a/drivers/net/typhoon.c 2005-01-10 09:00:13 -08:00
+++ b/drivers/net/typhoon.c 2005-01-10 09:00:13 -08:00
@@ -1890,7 +1890,7 @@
pci_enable_wake(tp->pdev, state, 1);
pci_disable_device(pdev);
- return pci_set_power_state(pdev, state);
+ return pci_set_power_state(pdev, pci_choose_state(pdev, state));
}
static int
@@ -1899,7 +1899,7 @@
struct pci_dev *pdev = tp->pdev;
void __iomem *ioaddr = tp->ioaddr;
- pci_set_power_state(pdev, 0);
+ pci_set_power_state(pdev, PCI_D0);
pci_restore_state(pdev);
/* Post 2.x.x versions of the Sleep Image require a reset before
@@ -2553,7 +2553,7 @@
struct typhoon *tp = netdev_priv(dev);
unregister_netdev(dev);
- pci_set_power_state(pdev, 0);
+ pci_set_power_state(pdev, PCI_D0);
pci_restore_state(pdev);
typhoon_reset(tp->ioaddr, NoWait);
iounmap(tp->ioaddr);
diff -Nru a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c
--- a/drivers/net/via-rhine.c 2005-01-10 09:00:13 -08:00
+++ b/drivers/net/via-rhine.c 2005-01-10 09:00:13 -08:00
@@ -1974,7 +1974,7 @@
if (request_irq(dev->irq, rhine_interrupt, SA_SHIRQ, dev->name, dev))
printk(KERN_ERR "via-rhine %s: request_irq failed\n", dev->name);
- ret = pci_set_power_state(pdev, 0);
+ ret = pci_set_power_state(pdev, PCI_D0);
if (debug > 1)
printk(KERN_INFO "%s: Entering power state D0 %s (%d).\n",
dev->name, ret ? "failed" : "succeeded", ret);
diff -Nru a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
--- a/drivers/net/via-velocity.c 2005-01-10 09:00:13 -08:00
+++ b/drivers/net/via-velocity.c 2005-01-10 09:00:13 -08:00
@@ -804,7 +804,7 @@
/* and leave the chip powered down */
- pci_set_power_state(pdev, 3);
+ pci_set_power_state(pdev, PCI_D3hot);
#ifdef CONFIG_PM
{
unsigned long flags;
@@ -1742,7 +1742,7 @@
goto err_free_rd_ring;
/* Ensure chip is running */
- pci_set_power_state(vptr->pdev, 0);
+ pci_set_power_state(vptr->pdev, PCI_D0);
velocity_init_registers(vptr, VELOCITY_INIT_COLD);
@@ -1750,7 +1750,7 @@
dev->name, dev);
if (ret < 0) {
/* Power down the chip */
- pci_set_power_state(vptr->pdev, 3);
+ pci_set_power_state(vptr->pdev, PCI_D3hot);
goto err_free_td_ring;
}
@@ -1868,7 +1868,7 @@
free_irq(dev->irq, dev);
/* Power down the chip */
- pci_set_power_state(vptr->pdev, 3);
+ pci_set_power_state(vptr->pdev, PCI_D3hot);
/* Free the resources */
velocity_free_td_ring(vptr);
@@ -2194,8 +2194,8 @@
/* If we are asked for information and the device is power
saving then we need to bring the device back up to talk to it */
- if(!netif_running(dev))
- pci_set_power_state(vptr->pdev, 0);
+ if (!netif_running(dev))
+ pci_set_power_state(vptr->pdev, PCI_D0);
switch (cmd) {
case SIOCGMIIPHY: /* Get address of MII PHY in use. */
@@ -2207,8 +2207,8 @@
default:
ret = -EOPNOTSUPP;
}
- if(!netif_running(dev))
- pci_set_power_state(vptr->pdev, 3);
+ if (!netif_running(dev))
+ pci_set_power_state(vptr->pdev, PCI_D3hot);
return ret;
@@ -2818,8 +2818,8 @@
static int velocity_ethtool_up(struct net_device *dev)
{
struct velocity_info *vptr = dev->priv;
- if(!netif_running(dev))
- pci_set_power_state(vptr->pdev, 0);
+ if (!netif_running(dev))
+ pci_set_power_state(vptr->pdev, PCI_D0);
return 0;
}
@@ -2834,8 +2834,8 @@
static void velocity_ethtool_down(struct net_device *dev)
{
struct velocity_info *vptr = dev->priv;
- if(!netif_running(dev))
- pci_set_power_state(vptr->pdev, 3);
+ if (!netif_running(dev))
+ pci_set_power_state(vptr->pdev, PCI_D3hot);
}
static int velocity_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
@@ -3229,15 +3229,15 @@
velocity_shutdown(vptr);
velocity_set_wol(vptr);
pci_enable_wake(pdev, 3, 1);
- pci_set_power_state(pdev, 3);
+ pci_set_power_state(pdev, PCI_D3hot);
} else {
velocity_save_context(vptr, &vptr->context);
velocity_shutdown(vptr);
pci_disable_device(pdev);
- pci_set_power_state(pdev, state);
+ pci_set_power_state(pdev, pci_choose_state(pdev, state));
}
#else
- pci_set_power_state(pdev, state);
+ pci_set_power_state(pdev, pci_choose_state(pdev, state));
#endif
spin_unlock_irqrestore(&vptr->lock, flags);
return 0;
@@ -3252,7 +3252,7 @@
if(!netif_running(vptr->dev))
return 0;
- pci_set_power_state(pdev, 0);
+ pci_set_power_state(pdev, PCI_D0);
pci_enable_wake(pdev, 0, 0);
pci_restore_state(pdev);
ChangeSet 1.1938.447.11, 2004/12/17 14:03:28-08:00, [email protected]
[PATCH] PCI: add pci_choose_state()
Could this go to "after 2.6.10 tree", too? It is a helper that
converts system state into PCI state. We really do not want to have
this copied into every driver, because it will need to change when
system state gets type-checked / expanded to struct.
From: Pavel Machek <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
drivers/pci/pci.c | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+)
diff -Nru a/drivers/pci/pci.c b/drivers/pci/pci.c
--- a/drivers/pci/pci.c 2005-01-10 09:01:09 -08:00
+++ b/drivers/pci/pci.c 2005-01-10 09:01:09 -08:00
@@ -306,6 +306,30 @@
}
/**
+ * pci_choose_state - Choose the power state of a PCI device
+ * @dev: PCI device to be suspended
+ * @state: target sleep state for the whole system
+ *
+ * Returns PCI power state suitable for given device and given system
+ * message.
+ */
+
+pci_power_t pci_choose_state(struct pci_dev *dev, u32 state)
+{
+ if (!pci_find_capability(dev, PCI_CAP_ID_PM))
+ return PCI_D0;
+
+ switch (state) {
+ case 0: return PCI_D0;
+ case 2: return PCI_D2;
+ case 3: return PCI_D3hot;
+ default: BUG();
+ }
+}
+
+EXPORT_SYMBOL(pci_choose_state);
+
+/**
* pci_save_state - save the PCI configuration space of a device before suspending
* @dev: - PCI device that we're dealing with
* @buffer: - buffer to hold config space context
ChangeSet 1.1938.447.2, 2004/12/16 15:58:45-08:00, [email protected]
[PATCH] PCI: arch/i386/pci/: make some code static
The patch below makes some needlessly global code static.
Signed-off-by: Adrian Bunk <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
arch/i386/pci/fixup.c | 4 ++--
arch/i386/pci/irq.c | 4 +++-
arch/i386/pci/pci.h | 2 --
3 files changed, 5 insertions(+), 5 deletions(-)
diff -Nru a/arch/i386/pci/fixup.c b/arch/i386/pci/fixup.c
--- a/arch/i386/pci/fixup.c 2005-01-10 09:06:25 -08:00
+++ b/arch/i386/pci/fixup.c 2005-01-10 09:06:25 -08:00
@@ -282,7 +282,7 @@
return raw_pci_ops->write(0, bus->number, devfn, where, size, value);
}
-struct pci_ops quirk_pcie_aspm_ops = {
+static struct pci_ops quirk_pcie_aspm_ops = {
.read = quirk_pcie_aspm_read,
.write = quirk_pcie_aspm_write,
};
@@ -295,7 +295,7 @@
* the root port in an array for fast indexing. Replace the bus ops
* with the modified one.
*/
-void pcie_rootport_aspm_quirk(struct pci_dev *pdev)
+static void pcie_rootport_aspm_quirk(struct pci_dev *pdev)
{
int cap_base, i;
struct pci_bus *pbus;
diff -Nru a/arch/i386/pci/irq.c b/arch/i386/pci/irq.c
--- a/arch/i386/pci/irq.c 2005-01-10 09:06:25 -08:00
+++ b/arch/i386/pci/irq.c 2005-01-10 09:06:25 -08:00
@@ -29,6 +29,8 @@
static struct irq_routing_table *pirq_table;
+static int pirq_enable_irq(struct pci_dev *dev);
+
/*
* Never use: 0, 1, 2 (timer, keyboard, and cascade)
* Avoid using: 13, 14 and 15 (FP error and IDE).
@@ -1019,7 +1021,7 @@
pirq_penalize_isa_irq(irq);
}
-int pirq_enable_irq(struct pci_dev *dev)
+static int pirq_enable_irq(struct pci_dev *dev)
{
u8 pin;
extern int interrupt_line_quirk;
diff -Nru a/arch/i386/pci/pci.h b/arch/i386/pci/pci.h
--- a/arch/i386/pci/pci.h 2005-01-10 09:06:25 -08:00
+++ b/arch/i386/pci/pci.h 2005-01-10 09:06:25 -08:00
@@ -71,6 +71,4 @@
extern int pcibios_scanned;
extern spinlock_t pci_config_lock;
-int pirq_enable_irq(struct pci_dev *dev);
-
extern int (*pcibios_enable_irq)(struct pci_dev *dev);
ChangeSet 1.1938.447.17, 2004/12/22 08:51:13-08:00, [email protected]
PCI: fix typo on previous pci_set_power_state() patch for hte sis900 driver.
Signed-off-by: Greg Kroah-Hartman <[email protected]>
drivers/net/sis900.c | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)
diff -Nru a/drivers/net/sis900.c b/drivers/net/sis900.c
--- a/drivers/net/sis900.c 2005-01-10 08:59:53 -08:00
+++ b/drivers/net/sis900.c 2005-01-10 08:59:53 -08:00
@@ -2238,7 +2238,7 @@
/* Stop the chip's Tx and Rx Status Machine */
outl(RxDIS | TxDIS | inl(ioaddr + cr), ioaddr + cr);
- pci_set_power_state(pci_dev, PCI_D3);
+ pci_set_power_state(pci_dev, PCI_D3hot);
pci_save_state(pci_dev);
return 0;
ChangeSet 1.1938.447.16, 2004/12/21 16:48:08-08:00, [email protected]
[PATCH] cpqphp: reduce stack usage
Reduce local stack usage in cpqhp_set_irq()
from 1028 bytes to 12 bytes (on x86-32).
This was the 16th largest offender according to my
recent 'make checkstack' run (and 2 other patches
for large ones have recently been submitted).
Signed-off-by: Randy Dunlap <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
drivers/pci/hotplug/cpqphp_pci.c | 30 +++++++++++++++++++++---------
1 files changed, 21 insertions(+), 9 deletions(-)
diff -Nru a/drivers/pci/hotplug/cpqphp_pci.c b/drivers/pci/hotplug/cpqphp_pci.c
--- a/drivers/pci/hotplug/cpqphp_pci.c 2005-01-10 09:00:02 -08:00
+++ b/drivers/pci/hotplug/cpqphp_pci.c 2005-01-10 09:00:02 -08:00
@@ -151,18 +151,29 @@
*/
int cpqhp_set_irq (u8 bus_num, u8 dev_num, u8 int_pin, u8 irq_num)
{
- int rc;
- u16 temp_word;
- struct pci_dev fakedev;
- struct pci_bus fakebus;
+ int rc = 0;
if (cpqhp_legacy_mode) {
- fakedev.devfn = dev_num << 3;
- fakedev.bus = &fakebus;
- fakebus.number = bus_num;
+ struct pci_dev *fakedev;
+ struct pci_bus *fakebus;
+ u16 temp_word;
+
+ fakedev = kmalloc(sizeof(*fakedev), GFP_KERNEL);
+ fakebus = kmalloc(sizeof(*fakebus), GFP_KERNEL);
+ if (!fakedev || !fakebus) {
+ kfree(fakedev);
+ kfree(fakebus);
+ return -ENOMEM;
+ }
+
+ fakedev->devfn = dev_num << 3;
+ fakedev->bus = fakebus;
+ fakebus->number = bus_num;
dbg("%s: dev %d, bus %d, pin %d, num %d\n",
__FUNCTION__, dev_num, bus_num, int_pin, irq_num);
- rc = pcibios_set_irq_routing(&fakedev, int_pin - 0x0a, irq_num);
+ rc = pcibios_set_irq_routing(fakedev, int_pin - 0x0a, irq_num);
+ kfree(fakedev);
+ kfree(fakebus);
dbg("%s: rc %d\n", __FUNCTION__, rc);
if (!rc)
return !rc;
@@ -176,9 +187,10 @@
// This should only be for x86 as it sets the Edge Level Control Register
outb((u8) (temp_word & 0xFF), 0x4d0);
outb((u8) ((temp_word & 0xFF00) >> 8), 0x4d1);
+ rc = 0;
}
- return 0;
+ return rc;
}
ChangeSet 1.1938.447.14, 2004/12/21 16:21:25-08:00, [email protected]
[PATCH] PCI: clean up state usage in pci core
> Now, care to send patches to fix up all of the new sparse warnings in
> the drivers/pci/* directory?
This should reduce number of warnings in pci.c. It will still warn on
comparison (because we are using __bitwise, but in fact we want
something like "this is unique but arithmetic is still ok"), but that
probably needs to be fixed in sparse.
Also killed "function does not return anything" warning.
Signed-off-by: Pavel Machek <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
drivers/pci/pci.c | 23 ++++++++++++++---------
1 files changed, 14 insertions(+), 9 deletions(-)
diff -Nru a/drivers/pci/pci.c b/drivers/pci/pci.c
--- a/drivers/pci/pci.c 2005-01-10 09:00:25 -08:00
+++ b/drivers/pci/pci.c 2005-01-10 09:00:25 -08:00
@@ -248,13 +248,14 @@
u16 pmcsr, pmc;
/* bound the state we're entering */
- if (state > 3) state = 3;
+ if (state > PCI_D3hot)
+ state = PCI_D3hot;
/* Validate current state:
* Can enter D0 from any state, but if we can only go deeper
* to sleep if we're already in a low power state
*/
- if (state > 0 && dev->current_state > state)
+ if (state != PCI_D0 && dev->current_state > state)
return -EINVAL;
else if (dev->current_state == state)
return 0; /* we're already there */
@@ -263,7 +264,8 @@
pm = pci_find_capability(dev, PCI_CAP_ID_PM);
/* abort if the device doesn't support PM capabilities */
- if (!pm) return -EIO;
+ if (!pm)
+ return -EIO;
pci_read_config_word(dev,pm + PCI_PM_PMC,&pmc);
if ((pmc & PCI_PM_CAP_VER_MASK) != 2) {
@@ -274,16 +276,18 @@
}
/* check if this device supports the desired state */
- if (state == 1 || state == 2) {
- if (state == 1 && !(pmc & PCI_PM_CAP_D1)) return -EIO;
- else if (state == 2 && !(pmc & PCI_PM_CAP_D2)) return -EIO;
+ if (state == PCI_D1 || state == PCI_D2) {
+ if (state == PCI_D1 && !(pmc & PCI_PM_CAP_D1))
+ return -EIO;
+ else if (state == PCI_D2 && !(pmc & PCI_PM_CAP_D2))
+ return -EIO;
}
/* If we're in D3, force entire word to 0.
* This doesn't affect PME_Status, disables PME_En, and
* sets PowerState to 0.
*/
- if (dev->current_state >= 3)
+ if (dev->current_state >= PCI_D3hot)
pmcsr = 0;
else {
pci_read_config_word(dev, pm + PCI_PM_CTRL, &pmcsr);
@@ -296,9 +300,9 @@
/* Mandatory power management transition delays */
/* see PCI PM 1.1 5.6.1 table 18 */
- if(state == 3 || dev->current_state == 3)
+ if (state == PCI_D3hot || dev->current_state == PCI_D3hot)
msleep(10);
- else if(state == 2 || dev->current_state == 2)
+ else if (state == PCI_D2 || dev->current_state == PCI_D2)
udelay(200);
dev->current_state = state;
@@ -325,6 +329,7 @@
case 3: return PCI_D3hot;
default: BUG();
}
+ return PCI_D0;
}
EXPORT_SYMBOL(pci_choose_state);
ChangeSet 1.1938.447.12, 2004/12/17 15:43:58-08:00, [email protected]
[PATCH] PCI: PCI early fixup missing bits
A few bits seem to be missing for PCI early fixup to work -- the
pci_fixup_device() helper ignores fixups of the pci_fixup_early type.
Also the local class variable needs to be refreshed after performing the
fixups for they can change dev->class.
Signed-off-by: Maciej W. Rozycki <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
patch-mips-2.6.10-rc2-20041124-pci_fixup_early-1
drivers/pci/probe.c | 1 +
drivers/pci/quirks.c | 7 +++++++
2 files changed, 8 insertions(+)
diff -Nru a/drivers/pci/probe.c b/drivers/pci/probe.c
--- a/drivers/pci/probe.c 2005-01-10 09:00:47 -08:00
+++ b/drivers/pci/probe.c 2005-01-10 09:00:47 -08:00
@@ -501,6 +501,7 @@
/* Early fixups, before probing the BARs */
pci_fixup_device(pci_fixup_early, dev);
+ class = dev->class >> 8;
switch (dev->hdr_type) { /* header type */
case PCI_HEADER_TYPE_NORMAL: /* standard header */
diff -Nru a/drivers/pci/quirks.c b/drivers/pci/quirks.c
--- a/drivers/pci/quirks.c 2005-01-10 09:00:47 -08:00
+++ b/drivers/pci/quirks.c 2005-01-10 09:00:47 -08:00
@@ -1237,6 +1237,8 @@
}
}
+extern struct pci_fixup __start_pci_fixups_early[];
+extern struct pci_fixup __end_pci_fixups_early[];
extern struct pci_fixup __start_pci_fixups_header[];
extern struct pci_fixup __end_pci_fixups_header[];
extern struct pci_fixup __start_pci_fixups_final[];
@@ -1250,6 +1252,11 @@
struct pci_fixup *start, *end;
switch(pass) {
+ case pci_fixup_early:
+ start = __start_pci_fixups_early;
+ end = __end_pci_fixups_early;
+ break;
+
case pci_fixup_header:
start = __start_pci_fixups_header;
end = __end_pci_fixups_header;
ChangeSet 1.1938.439.44, 2005/01/07 10:32:39-08:00, [email protected]
[PATCH] hotplug/acpiphp_ibm: module_param fix
File permissins should be octal number.
Signed-off-by: Domen Puncer <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
drivers/pci/hotplug/acpiphp_ibm.c | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)
diff -Nru a/drivers/pci/hotplug/acpiphp_ibm.c b/drivers/pci/hotplug/acpiphp_ibm.c
--- a/drivers/pci/hotplug/acpiphp_ibm.c 2005-01-10 08:59:18 -08:00
+++ b/drivers/pci/hotplug/acpiphp_ibm.c 2005-01-10 08:59:18 -08:00
@@ -47,7 +47,7 @@
MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL");
MODULE_VERSION(DRIVER_VERSION);
-module_param(debug, bool, 644);
+module_param(debug, bool, 0644);
MODULE_PARM_DESC(debug, " Debugging mode enabled or not");
#define MY_NAME "acpiphp_ibm"
ChangeSet 1.1938.447.19, 2004/12/22 10:11:27-08:00, [email protected]
[PATCH] PCI: Software visible configuration request retry status
PCI Express allows cards to return "Configuration Request Retry" if they're
not ready to handle accesses to configuration space. The PCI Express 1.0a
specification says that the Root Complex should retry the access. ECN 27
http://www.pcisig.com/specifications/pciexpress/ECN_CRS_Software_Visibility_No27.pdf
allows software to handle the CRS.
Signed-off-by: Matthew Wilcox <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
drivers/pci/probe.c | 42 +++++++++++++++++++++++++++++++++++++++---
include/linux/pci.h | 14 ++++++++++++++
2 files changed, 53 insertions(+), 3 deletions(-)
diff -Nru a/drivers/pci/probe.c b/drivers/pci/probe.c
--- a/drivers/pci/probe.c 2005-01-10 08:59:29 -08:00
+++ b/drivers/pci/probe.c 2005-01-10 08:59:29 -08:00
@@ -2,6 +2,7 @@
* probe.c - PCI detection and setup code
*/
+#include <linux/delay.h>
#include <linux/init.h>
#include <linux/pci.h>
#include <linux/slab.h>
@@ -336,6 +337,22 @@
return child;
}
+static void pci_enable_crs(struct pci_dev *dev)
+{
+ u16 cap, rpctl;
+ int rpcap = pci_find_capability(dev, PCI_CAP_ID_EXP);
+ if (!rpcap)
+ return;
+
+ pci_read_config_word(dev, rpcap + PCI_CAP_FLAGS, &cap);
+ if (((cap & PCI_EXP_FLAGS_TYPE) >> 4) != PCI_EXP_TYPE_ROOT_PORT)
+ return;
+
+ pci_read_config_word(dev, rpcap + PCI_EXP_RTCTL, &rpctl);
+ rpctl |= PCI_EXP_RTCTL_CRSSVE;
+ pci_write_config_word(dev, rpcap + PCI_EXP_RTCTL, rpctl);
+}
+
unsigned int __devinit pci_scan_child_bus(struct pci_bus *bus);
/*
@@ -366,6 +383,8 @@
pci_write_config_word(dev, PCI_BRIDGE_CONTROL,
bctl & ~PCI_BRIDGE_CTL_MASTER_ABORT);
+ pci_enable_crs(dev);
+
if ((buses & 0xffff00) && !pcibios_assign_all_busses() && !is_cardbus) {
unsigned int cmax, busnr;
/*
@@ -614,9 +633,7 @@
struct pci_dev *dev;
u32 l;
u8 hdr_type;
-
- if (pci_bus_read_config_byte(bus, devfn, PCI_HEADER_TYPE, &hdr_type))
- return NULL;
+ int delay = 1;
if (pci_bus_read_config_dword(bus, devfn, PCI_VENDOR_ID, &l))
return NULL;
@@ -624,6 +641,25 @@
/* some broken boards return 0 or ~0 if a slot is empty: */
if (l == 0xffffffff || l == 0x00000000 ||
l == 0x0000ffff || l == 0xffff0000)
+ return NULL;
+
+ /* Configuration request Retry Status */
+ while (l == 0xffff0001) {
+ msleep(delay);
+ delay *= 2;
+ if (pci_bus_read_config_dword(bus, devfn, PCI_VENDOR_ID, &l))
+ return NULL;
+ /* Card hasn't responded in 60 seconds? Must be stuck. */
+ if (delay > 60 * 1000) {
+ printk(KERN_WARNING "Device %04x:%02x:%02x.%d not "
+ "responding\n", pci_domain_nr(bus),
+ bus->number, PCI_SLOT(devfn),
+ PCI_FUNC(devfn));
+ return NULL;
+ }
+ }
+
+ if (pci_bus_read_config_byte(bus, devfn, PCI_HEADER_TYPE, &hdr_type))
return NULL;
dev = kmalloc(sizeof(struct pci_dev), GFP_KERNEL);
diff -Nru a/include/linux/pci.h b/include/linux/pci.h
--- a/include/linux/pci.h 2005-01-10 08:59:29 -08:00
+++ b/include/linux/pci.h 2005-01-10 08:59:29 -08:00
@@ -364,6 +364,20 @@
#define PCI_EXP_DEVSTA_URD 0x08 /* Unsupported Request Detected */
#define PCI_EXP_DEVSTA_AUXPD 0x10 /* AUX Power Detected */
#define PCI_EXP_DEVSTA_TRPND 0x20 /* Transactions Pending */
+#define PCI_EXP_LNKCAP 12 /* Link Capabilities */
+#define PCI_EXP_LNKCTL 16 /* Link Control */
+#define PCI_EXP_LNKSTA 18 /* Link Status */
+#define PCI_EXP_SLTCAP 20 /* Slot Capabilities */
+#define PCI_EXP_SLTCTL 24 /* Slot Control */
+#define PCI_EXP_SLTSTA 26 /* Slot Status */
+#define PCI_EXP_RTCTL 28 /* Root Control */
+#define PCI_EXP_RTCTL_SECEE 0x01 /* System Error on Correctable Error */
+#define PCI_EXP_RTCTL_SENFEE 0x02 /* System Error on Non-Fatal Error */
+#define PCI_EXP_RTCTL_SEFEE 0x04 /* System Error on Fatal Error */
+#define PCI_EXP_RTCTL_PMEIE 0x08 /* PME Interrupt Enable */
+#define PCI_EXP_RTCTL_CRSSVE 0x10 /* CRS Software Visibility Enable */
+#define PCI_EXP_RTCAP 30 /* Root Capabilities */
+#define PCI_EXP_RTSTA 32 /* Root Status */
/* Extended Capabilities (PCI-X 2.0 and Express) */
#define PCI_EXT_CAP_ID(header) (header & 0x0000ffff)
On Tue, Jan 11, 2005 at 02:39:02PM -0800, Matt Mackall wrote:
> On Mon, Jan 10, 2005 at 09:20:55AM -0800, Greg KH wrote:
> > ChangeSet 1.1938.439.44, 2005/01/07 10:32:39-08:00, [email protected]
> >
> > [PATCH] hotplug/acpiphp_ibm: module_param fix
> >
> > File permissins should be octal number.
>
> > -module_param(debug, bool, 644);
> > +module_param(debug, bool, 0644);
>
> Perhaps the sysfs code could do:
>
> /* did we forget to write in octal? */
> BUG_ON(mode > 0666 || mode & 0111);
I think the whole tree has now been audited. Mistakes from now on are
the developer who did the change's fault (like all other kernel bugs...)
thanks,
greg k-h
On Mon, Jan 10, 2005 at 09:20:55AM -0800, Greg KH wrote:
> ChangeSet 1.1938.439.44, 2005/01/07 10:32:39-08:00, [email protected]
>
> [PATCH] hotplug/acpiphp_ibm: module_param fix
>
> File permissins should be octal number.
> -module_param(debug, bool, 644);
> +module_param(debug, bool, 0644);
Perhaps the sysfs code could do:
/* did we forget to write in octal? */
BUG_ON(mode > 0666 || mode & 0111);
--
Mathematics is the supreme nostalgia of our time.
On 11/01/05 14:44 -0800, Greg KH wrote:
> On Tue, Jan 11, 2005 at 02:39:02PM -0800, Matt Mackall wrote:
> > On Mon, Jan 10, 2005 at 09:20:55AM -0800, Greg KH wrote:
> > > ChangeSet 1.1938.439.44, 2005/01/07 10:32:39-08:00, [email protected]
> > >
> > > [PATCH] hotplug/acpiphp_ibm: module_param fix
> > >
> > > File permissins should be octal number.
> >
> > > -module_param(debug, bool, 644);
> > > +module_param(debug, bool, 0644);
> >
> > Perhaps the sysfs code could do:
> >
> > /* did we forget to write in octal? */
> > BUG_ON(mode > 0666 || mode & 0111);
Some drivers assumed last parameter is default value, so this wouldn't
help in all cases :-)
>
> I think the whole tree has now been audited. Mistakes from now on are
> the developer who did the change's fault (like all other kernel bugs...)
I think I checked all of them.
Domen