Commit 5fd66b2b authored by Takayoshi Kouchi's avatar Takayoshi Kouchi Committed by Russell King

[PATCH] ACPI PCI hotplug updates

These are updates of the acpiphp driver for 2.5.
  - change debug flag from 'acpiphp_debug' to 'debug' for insmod
  - whitespace cleanup
  - message cleanup
parent 96cf7c73
......@@ -41,12 +41,12 @@
#define dbg(format, arg...) \
do { \
if (acpiphp_debug) \
printk (KERN_DEBUG "%s: " format "\n", \
printk(KERN_DEBUG "%s: " format, \
MY_NAME , ## arg); \
} while (0)
#define err(format, arg...) printk (KERN_ERR "%s: " format "\n", MY_NAME , ## arg)
#define info(format, arg...) printk (KERN_INFO "%s: " format "\n", MY_NAME , ## arg)
#define warn(format, arg...) printk (KERN_WARNING "%s: " format "\n", MY_NAME , ## arg)
#define err(format, arg...) printk(KERN_ERR "%s: " format, MY_NAME , ## arg)
#define info(format, arg...) printk(KERN_INFO "%s: " format, MY_NAME , ## arg)
#define warn(format, arg...) printk(KERN_WARNING "%s: " format, MY_NAME , ## arg)
#define SLOT_MAGIC 0x67267322
/* name size which is used for entries in pcihpfs */
......
This diff is collapsed.
This diff is collapsed.
......@@ -77,7 +77,7 @@ static int init_config_space (struct acpiphp_func *func)
if (!bar) /* This BAR is not implemented */
continue;
dbg("Device %02x.%02x BAR %d wants %x", device, function, count, bar);
dbg("Device %02x.%02x BAR %d wants %x\n", device, function, count, bar);
if (bar & PCI_BASE_ADDRESS_SPACE_IO) {
/* This is IO */
......@@ -85,7 +85,7 @@ static int init_config_space (struct acpiphp_func *func)
len = bar & 0xFFFFFFFC;
len = ~len + 1;
dbg ("len in IO %x, BAR %d", len, count);
dbg("len in IO %x, BAR %d\n", len, count);
spin_lock(&bridge->res_lock);
res = acpiphp_get_io_resource(&bridge->io_head, len);
......@@ -110,7 +110,7 @@ static int init_config_space (struct acpiphp_func *func)
len = bar & 0xFFFFFFF0;
len = ~len + 1;
dbg("len in PFMEM %x, BAR %d", len, count);
dbg("len in PFMEM %x, BAR %d\n", len, count);
spin_lock(&bridge->res_lock);
res = acpiphp_get_resource(&bridge->p_mem_head, len);
......@@ -127,7 +127,7 @@ static int init_config_space (struct acpiphp_func *func)
(u32)res->base);
if (bar & PCI_BASE_ADDRESS_MEM_TYPE_64) { /* takes up another dword */
dbg ("inside the pfmem 64 case, count %d", count);
dbg("inside the pfmem 64 case, count %d\n", count);
count += 1;
pci_bus_write_config_dword(pbus, devfn,
address[count],
......@@ -143,7 +143,7 @@ static int init_config_space (struct acpiphp_func *func)
len = bar & 0xFFFFFFF0;
len = ~len + 1;
dbg("len in MEM %x, BAR %d", len, count);
dbg("len in MEM %x, BAR %d\n", len, count);
spin_lock(&bridge->res_lock);
res = acpiphp_get_resource(&bridge->mem_head, len);
......@@ -161,7 +161,7 @@ static int init_config_space (struct acpiphp_func *func)
if (bar & PCI_BASE_ADDRESS_MEM_TYPE_64) {
/* takes up another dword */
dbg ("inside mem 64 case, reg. mem, count %d", count);
dbg("inside mem 64 case, reg. mem, count %d\n", count);
count += 1;
pci_bus_write_config_dword(pbus, devfn,
address[count],
......@@ -212,16 +212,16 @@ static int configure_pci_dev (struct pci_dev_wrapped *wrapped_dev, struct pci_bu
//pci_proc_attach_device(dev);
//pci_announce_device_to_drivers(dev);
info("Device %s configured", dev->slot_name);
info("Device %s configured\n", dev->slot_name);
return 0;
}
static int is_pci_dev_in_use (struct pci_dev* dev)
static int is_pci_dev_in_use (struct pci_dev* dev)
{
/*
* dev->driver will be set if the device is in use by a new-style
/*
* dev->driver will be set if the device is in use by a new-style
* driver -- otherwise, check the device's regions to see if any
* driver has claimed them
*/
......@@ -263,13 +263,13 @@ static int unconfigure_pci_dev_driver (struct pci_dev_wrapped *wrapped_dev, stru
{
struct pci_dev *dev = wrapped_dev->dev;
dbg("attempting removal of driver for device %s", dev->slot_name);
dbg("attempting removal of driver for device %s\n", dev->slot_name);
/* Now, remove the Linux Driver Representation */
if (dev->driver) {
if (dev->driver->remove) {
dev->driver->remove(dev);
dbg("driver was properly removed");
dbg("driver was properly removed\n");
}
dev->driver = NULL;
}
......@@ -286,7 +286,7 @@ static int unconfigure_pci_dev (struct pci_dev_wrapped *wrapped_dev, struct pci_
/* Now, remove the Linux Representation */
if (dev) {
if (pci_hp_remove_device(dev) == 0) {
info("Device %s removed", dev->slot_name);
info("Device %s removed\n", dev->slot_name);
kfree(dev); /* Now, remove */
} else {
return -1; /* problems while freeing, abort visitation */
......@@ -338,7 +338,7 @@ static int detect_used_resource (struct acpiphp_bridge *bridge, struct pci_dev *
int count;
struct pci_resource *res;
dbg("Device %s", dev->slot_name);
dbg("Device %s\n", dev->slot_name);
for (count = 0; address[count]; count++) { /* for 6 BARs */
pci_read_config_dword(dev, address[count], &bar);
......@@ -355,7 +355,7 @@ static int detect_used_resource (struct acpiphp_bridge *bridge, struct pci_dev *
len &= 0xFFFFFFFC;
len = ~len + 1;
dbg("BAR[%d] %08x - %08x (IO)", count, (u32)base, (u32)base + len - 1);
dbg("BAR[%d] %08x - %08x (IO)\n", count, (u32)base, (u32)base + len - 1);
spin_lock(&bridge->res_lock);
res = acpiphp_get_resource_with_base(&bridge->io_head, base, len);
......@@ -372,10 +372,10 @@ static int detect_used_resource (struct acpiphp_bridge *bridge, struct pci_dev *
len = ~len + 1;
if (len & PCI_BASE_ADDRESS_MEM_TYPE_64) { /* takes up another dword */
dbg ("prefetch mem 64");
dbg("prefetch mem 64\n");
count += 1;
}
dbg("BAR[%d] %08x - %08x (PMEM)", count, (u32)base, (u32)base + len - 1);
dbg("BAR[%d] %08x - %08x (PMEM)\n", count, (u32)base, (u32)base + len - 1);
spin_lock(&bridge->res_lock);
res = acpiphp_get_resource_with_base(&bridge->p_mem_head, base, len);
spin_unlock(&bridge->res_lock);
......@@ -389,10 +389,10 @@ static int detect_used_resource (struct acpiphp_bridge *bridge, struct pci_dev *
if (len & PCI_BASE_ADDRESS_MEM_TYPE_64) {
/* takes up another dword */
dbg ("mem 64");
dbg("mem 64\n");
count += 1;
}
dbg("BAR[%d] %08x - %08x (MEM)", count, (u32)base, (u32)base + len - 1);
dbg("BAR[%d] %08x - %08x (MEM)\n", count, (u32)base, (u32)base + len - 1);
spin_lock(&bridge->res_lock);
res = acpiphp_get_resource_with_base(&bridge->mem_head, base, len);
spin_unlock(&bridge->res_lock);
......@@ -414,7 +414,7 @@ static void detect_used_resource_bus(struct acpiphp_bridge *bridge, struct pci_b
struct list_head *l;
struct pci_dev *dev;
list_for_each(l, &bus->devices) {
list_for_each (l, &bus->devices) {
dev = pci_dev_b(l);
detect_used_resource(bridge, dev);
/* XXX recursive call */
......@@ -463,16 +463,16 @@ int acpiphp_init_func_resource (struct acpiphp_func *func)
struct pci_dev *dev;
dev = func->pci_dev;
dbg("Hot-pluggable device %s", dev->slot_name);
dbg("Hot-pluggable device %s\n", dev->slot_name);
for (count = 0; address[count]; count++) { /* for 6 BARs */
pci_read_config_dword (dev, address[count], &bar);
pci_read_config_dword(dev, address[count], &bar);
if (!bar) /* This BAR is not implemented */
continue;
pci_write_config_dword (dev, address[count], 0xFFFFFFFF);
pci_read_config_dword (dev, address[count], &len);
pci_write_config_dword(dev, address[count], 0xFFFFFFFF);
pci_read_config_dword(dev, address[count], &len);
if (len & PCI_BASE_ADDRESS_SPACE_IO) {
/* This is IO */
......@@ -480,7 +480,7 @@ int acpiphp_init_func_resource (struct acpiphp_func *func)
len &= 0xFFFFFFFC;
len = ~len + 1;
dbg("BAR[%d] %08x - %08x (IO)", count, (u32)base, (u32)base + len - 1);
dbg("BAR[%d] %08x - %08x (IO)\n", count, (u32)base, (u32)base + len - 1);
res = acpiphp_make_resource(base, len);
if (!res)
......@@ -499,10 +499,10 @@ int acpiphp_init_func_resource (struct acpiphp_func *func)
len = ~len + 1;
if (len & PCI_BASE_ADDRESS_MEM_TYPE_64) { /* takes up another dword */
dbg ("prefetch mem 64");
dbg("prefetch mem 64\n");
count += 1;
}
dbg("BAR[%d] %08x - %08x (PMEM)", count, (u32)base, (u32)base + len - 1);
dbg("BAR[%d] %08x - %08x (PMEM)\n", count, (u32)base, (u32)base + len - 1);
res = acpiphp_make_resource(base, len);
if (!res)
goto no_memory;
......@@ -518,10 +518,10 @@ int acpiphp_init_func_resource (struct acpiphp_func *func)
if (len & PCI_BASE_ADDRESS_MEM_TYPE_64) {
/* takes up another dword */
dbg ("mem 64");
dbg("mem 64\n");
count += 1;
}
dbg("BAR[%d] %08x - %08x (MEM)", count, (u32)base, (u32)base + len - 1);
dbg("BAR[%d] %08x - %08x (MEM)\n", count, (u32)base, (u32)base + len - 1);
res = acpiphp_make_resource(base, len);
if (!res)
goto no_memory;
......@@ -532,7 +532,7 @@ int acpiphp_init_func_resource (struct acpiphp_func *func)
}
}
pci_write_config_dword (dev, address[count], bar);
pci_write_config_dword(dev, address[count], bar);
}
#if 1
acpiphp_dump_func_resource(func);
......@@ -541,7 +541,7 @@ int acpiphp_init_func_resource (struct acpiphp_func *func)
return 0;
no_memory:
err("out of memory");
err("out of memory\n");
acpiphp_free_resource(&func->io_head);
acpiphp_free_resource(&func->mem_head);
acpiphp_free_resource(&func->p_mem_head);
......@@ -574,7 +574,7 @@ int acpiphp_configure_slot (struct acpiphp_slot *slot)
if (hdr & 0x80)
is_multi = 1;
list_for_each(l, &slot->funcs) {
list_for_each (l, &slot->funcs) {
func = list_entry(l, struct acpiphp_func, sibling);
if (is_multi || func->function == 0) {
pci_bus_read_config_dword(slot->bridge->pci_bus,
......@@ -583,7 +583,6 @@ int acpiphp_configure_slot (struct acpiphp_slot *slot)
PCI_VENDOR_ID, &dvid);
if (dvid != 0xffffffff) {
retval = init_config_space(func);
if (retval)
break;
}
......
......@@ -273,7 +273,7 @@ struct pci_resource *acpiphp_get_max_resource (struct pci_resource **head, u32 s
for (max = *head;max; max = max->next) {
/* If not big enough we could probably just bail,
/* If not big enough we could probably just bail,
instead we'll continue to the next. */
if (max->length < size)
continue;
......@@ -370,13 +370,13 @@ struct pci_resource *acpiphp_get_resource (struct pci_resource **head, u32 size)
return NULL;
for (node = *head; node; node = node->next) {
dbg("%s: req_size =%x node=%p, base=%x, length=%x",
dbg("%s: req_size =%x node=%p, base=%x, length=%x\n",
__FUNCTION__, size, node, (u32)node->base, node->length);
if (node->length < size)
continue;
if (node->base & (size - 1)) {
dbg("%s: not aligned", __FUNCTION__);
dbg("%s: not aligned\n", __FUNCTION__);
/* this one isn't base aligned properly
so we'll make a new entry and split it up */
temp_qword = (node->base | (size-1)) + 1;
......@@ -400,7 +400,7 @@ struct pci_resource *acpiphp_get_resource (struct pci_resource **head, u32 size)
/* Don't need to check if too small since we already did */
if (node->length > size) {
dbg("%s: too big", __FUNCTION__);
dbg("%s: too big\n", __FUNCTION__);
/* this one is longer than we need
so we'll make a new entry and split it up */
split_node = acpiphp_make_resource(node->base + size, node->length - size);
......@@ -415,7 +415,7 @@ struct pci_resource *acpiphp_get_resource (struct pci_resource **head, u32 size)
node->next = split_node;
} /* End of too big on top end */
dbg("%s: got one!!!", __FUNCTION__);
dbg("%s: got one!!!\n", __FUNCTION__);
/* If we got here, then it is the right size
Now take it out of the list */
if (*head == node) {
......@@ -437,7 +437,7 @@ struct pci_resource *acpiphp_get_resource (struct pci_resource **head, u32 size)
/**
* get_resource_with_base - get resource with specific base address
*
* this function
* this function
* returns the first node of "size" length located at specified base address.
* If it finds a node larger than "size" it will split it up.
*
......@@ -458,7 +458,7 @@ struct pci_resource *acpiphp_get_resource_with_base (struct pci_resource **head,
return NULL;
for (node = *head; node; node = node->next) {
dbg(": 1st req_base=%x req_size =%x node=%p, base=%x, length=%x",
dbg(": 1st req_base=%x req_size =%x node=%p, base=%x, length=%x\n",
(u32)base, size, node, (u32)node->base, node->length);
if (node->base > base)
continue;
......@@ -467,7 +467,7 @@ struct pci_resource *acpiphp_get_resource_with_base (struct pci_resource **head,
continue;
if (node->base < base) {
dbg(": split 1");
dbg(": split 1\n");
/* this one isn't base aligned properly
so we'll make a new entry and split it up */
temp_qword = base;
......@@ -489,12 +489,12 @@ struct pci_resource *acpiphp_get_resource_with_base (struct pci_resource **head,
node->next = split_node;
}
dbg(": 2nd req_base=%x req_size =%x node=%p, base=%x, length=%x",
dbg(": 2nd req_base=%x req_size =%x node=%p, base=%x, length=%x\n",
(u32)base, size, node, (u32)node->base, node->length);
/* Don't need to check if too small since we already did */
if (node->length > size) {
dbg(": split 2");
dbg(": split 2\n");
/* this one is longer than we need
so we'll make a new entry and split it up */
split_node = acpiphp_make_resource(node->base + size, node->length - size);
......@@ -509,7 +509,7 @@ struct pci_resource *acpiphp_get_resource_with_base (struct pci_resource **head,
node->next = split_node;
} /* End of too big on top end */
dbg(": got one!!!");
dbg(": got one!!!\n");
/* If we got here, then it is the right size
Now take it out of the list */
if (*head == node) {
......@@ -547,13 +547,13 @@ int acpiphp_resource_sort_and_combine (struct pci_resource **head)
if (!(*head))
return 1;
dbg("*head->next = %p",(*head)->next);
dbg("*head->next = %p\n",(*head)->next);
if (!(*head)->next)
return 0; /* only one item on the list, already sorted! */
dbg("*head->base = 0x%x",(u32)(*head)->base);
dbg("*head->next->base = 0x%x", (u32)(*head)->next->base);
dbg("*head->base = 0x%x\n",(u32)(*head)->base);
dbg("*head->next->base = 0x%x\n", (u32)(*head)->next->base);
while (out_of_order) {
out_of_order = 0;
......@@ -587,7 +587,7 @@ int acpiphp_resource_sort_and_combine (struct pci_resource **head)
while (node1 && node1->next) {
if ((node1->base + node1->length) == node1->next->base) {
/* Combine */
dbg("8..");
dbg("8..\n");
node1->length += node1->next->length;
node2 = node1->next;
node1->next = node1->next->next;
......@@ -668,7 +668,7 @@ static void dump_resource(struct pci_resource *head)
cnt = 0;
while (p) {
dbg("[%02d] %08x - %08x",
dbg("[%02d] %08x - %08x\n",
cnt++, (u32)p->base, (u32)p->base + p->length - 1);
p = p->next;
}
......@@ -676,24 +676,24 @@ static void dump_resource(struct pci_resource *head)
void acpiphp_dump_resource(struct acpiphp_bridge *bridge)
{
dbg("I/O resource:");
dbg("I/O resource:\n");
dump_resource(bridge->io_head);
dbg("MEM resource:");
dbg("MEM resource:\n");
dump_resource(bridge->mem_head);
dbg("PMEM resource:");
dbg("PMEM resource:\n");
dump_resource(bridge->p_mem_head);
dbg("BUS resource:");
dbg("BUS resource:\n");
dump_resource(bridge->bus_head);
}
void acpiphp_dump_func_resource(struct acpiphp_func *func)
{
dbg("I/O resource:");
dbg("I/O resource:\n");
dump_resource(func->io_head);
dbg("MEM resource:");
dbg("MEM resource:\n");
dump_resource(func->mem_head);
dbg("PMEM resource:");
dbg("PMEM resource:\n");
dump_resource(func->p_mem_head);
dbg("BUS resource:");
dbg("BUS resource:\n");
dump_resource(func->bus_head);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment