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 @@ ...@@ -41,12 +41,12 @@
#define dbg(format, arg...) \ #define dbg(format, arg...) \
do { \ do { \
if (acpiphp_debug) \ if (acpiphp_debug) \
printk (KERN_DEBUG "%s: " format "\n", \ printk(KERN_DEBUG "%s: " format, \
MY_NAME , ## arg); \ MY_NAME , ## arg); \
} while (0) } while (0)
#define err(format, arg...) printk (KERN_ERR "%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 "\n", MY_NAME , ## arg) #define info(format, arg...) printk(KERN_INFO "%s: " format, MY_NAME , ## arg)
#define warn(format, arg...) printk (KERN_WARNING "%s: " format "\n", MY_NAME , ## arg) #define warn(format, arg...) printk(KERN_WARNING "%s: " format, MY_NAME , ## arg)
#define SLOT_MAGIC 0x67267322 #define SLOT_MAGIC 0x67267322
/* name size which is used for entries in pcihpfs */ /* name size which is used for entries in pcihpfs */
......
...@@ -50,6 +50,7 @@ static LIST_HEAD(slot_list); ...@@ -50,6 +50,7 @@ static LIST_HEAD(slot_list);
#define MY_NAME THIS_MODULE->name #define MY_NAME THIS_MODULE->name
#endif #endif
static int debug;
int acpiphp_debug; int acpiphp_debug;
/* local variables */ /* local variables */
...@@ -62,8 +63,8 @@ static int num_slots; ...@@ -62,8 +63,8 @@ static int num_slots;
MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC); MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_PARM(acpiphp_debug, "i"); MODULE_PARM(debug, "i");
MODULE_PARM_DESC(acpiphp_debug, "Debugging mode enabled or not"); MODULE_PARM_DESC(debug, "Debugging mode enabled or not");
static int enable_slot (struct hotplug_slot *slot); static int enable_slot (struct hotplug_slot *slot);
static int disable_slot (struct hotplug_slot *slot); static int disable_slot (struct hotplug_slot *slot);
...@@ -95,15 +96,15 @@ static struct hotplug_slot_ops acpi_hotplug_slot_ops = { ...@@ -95,15 +96,15 @@ static struct hotplug_slot_ops acpi_hotplug_slot_ops = {
static inline int slot_paranoia_check (struct slot *slot, const char *function) static inline int slot_paranoia_check (struct slot *slot, const char *function)
{ {
if (!slot) { if (!slot) {
dbg("%s - slot == NULL", function); dbg("%s - slot == NULL\n", function);
return -1; return -1;
} }
if (slot->magic != SLOT_MAGIC) { if (slot->magic != SLOT_MAGIC) {
dbg("%s - bad magic number for slot", function); dbg("%s - bad magic number for slot\n", function);
return -1; return -1;
} }
if (!slot->hotplug_slot) { if (!slot->hotplug_slot) {
dbg("%s - slot->hotplug_slot == NULL!", function); dbg("%s - slot->hotplug_slot == NULL!\n", function);
return -1; return -1;
} }
return 0; return 0;
...@@ -111,16 +112,16 @@ static inline int slot_paranoia_check (struct slot *slot, const char *function) ...@@ -111,16 +112,16 @@ static inline int slot_paranoia_check (struct slot *slot, const char *function)
static inline struct slot *get_slot (struct hotplug_slot *hotplug_slot, const char *function) static inline struct slot *get_slot (struct hotplug_slot *hotplug_slot, const char *function)
{ {
struct slot *slot; struct slot *slot;
if (!hotplug_slot) { if (!hotplug_slot) {
dbg("%s - hotplug_slot == NULL", function); dbg("%s - hotplug_slot == NULL\n", function);
return NULL; return NULL;
} }
slot = (struct slot *)hotplug_slot->private; slot = (struct slot *)hotplug_slot->private;
if (slot_paranoia_check (slot, function)) if (slot_paranoia_check(slot, function))
return NULL; return NULL;
return slot; return slot;
} }
...@@ -135,16 +136,16 @@ static inline struct slot *get_slot (struct hotplug_slot *hotplug_slot, const ch ...@@ -135,16 +136,16 @@ static inline struct slot *get_slot (struct hotplug_slot *hotplug_slot, const ch
*/ */
static int enable_slot (struct hotplug_slot *hotplug_slot) static int enable_slot (struct hotplug_slot *hotplug_slot)
{ {
struct slot *slot = get_slot (hotplug_slot, __FUNCTION__); struct slot *slot = get_slot(hotplug_slot, __FUNCTION__);
int retval = 0; int retval = 0;
if (slot == NULL) if (slot == NULL)
return -ENODEV; return -ENODEV;
dbg ("%s - physical_slot = %s", __FUNCTION__, hotplug_slot->name); dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
/* enable the specified slot */ /* enable the specified slot */
retval = acpiphp_enable_slot (slot->acpi_slot); retval = acpiphp_enable_slot(slot->acpi_slot);
return retval; return retval;
} }
...@@ -159,16 +160,16 @@ static int enable_slot (struct hotplug_slot *hotplug_slot) ...@@ -159,16 +160,16 @@ static int enable_slot (struct hotplug_slot *hotplug_slot)
*/ */
static int disable_slot (struct hotplug_slot *hotplug_slot) static int disable_slot (struct hotplug_slot *hotplug_slot)
{ {
struct slot *slot = get_slot (hotplug_slot, __FUNCTION__); struct slot *slot = get_slot(hotplug_slot, __FUNCTION__);
int retval = 0; int retval = 0;
if (slot == NULL) if (slot == NULL)
return -ENODEV; return -ENODEV;
dbg ("%s - physical_slot = %s", __FUNCTION__, hotplug_slot->name); dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
/* disable the specified slot */ /* disable the specified slot */
retval = acpiphp_disable_slot (slot->acpi_slot); retval = acpiphp_disable_slot(slot->acpi_slot);
return retval; return retval;
} }
...@@ -185,8 +186,8 @@ static int disable_slot (struct hotplug_slot *hotplug_slot) ...@@ -185,8 +186,8 @@ static int disable_slot (struct hotplug_slot *hotplug_slot)
static int set_attention_status (struct hotplug_slot *hotplug_slot, u8 status) static int set_attention_status (struct hotplug_slot *hotplug_slot, u8 status)
{ {
int retval = 0; int retval = 0;
dbg ("%s - physical_slot = %s", __FUNCTION__, hotplug_slot->name); dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
switch (status) { switch (status) {
case 0: case 0:
...@@ -213,15 +214,15 @@ static int set_attention_status (struct hotplug_slot *hotplug_slot, u8 status) ...@@ -213,15 +214,15 @@ static int set_attention_status (struct hotplug_slot *hotplug_slot, u8 status)
*/ */
static int hardware_test (struct hotplug_slot *hotplug_slot, u32 value) static int hardware_test (struct hotplug_slot *hotplug_slot, u32 value)
{ {
struct slot *slot = get_slot (hotplug_slot, __FUNCTION__); struct slot *slot = get_slot(hotplug_slot, __FUNCTION__);
int retval = 0; int retval = 0;
if (slot == NULL) if (slot == NULL)
return -ENODEV; return -ENODEV;
dbg ("%s - physical_slot = %s", __FUNCTION__, hotplug_slot->name);
err ("No hardware tests are defined for this driver"); dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
err("No hardware tests are defined for this driver\n");
retval = -ENODEV; retval = -ENODEV;
return retval; return retval;
...@@ -239,15 +240,15 @@ static int hardware_test (struct hotplug_slot *hotplug_slot, u32 value) ...@@ -239,15 +240,15 @@ static int hardware_test (struct hotplug_slot *hotplug_slot, u32 value)
*/ */
static int get_power_status (struct hotplug_slot *hotplug_slot, u8 *value) static int get_power_status (struct hotplug_slot *hotplug_slot, u8 *value)
{ {
struct slot *slot = get_slot (hotplug_slot, __FUNCTION__); struct slot *slot = get_slot(hotplug_slot, __FUNCTION__);
int retval = 0; int retval = 0;
if (slot == NULL) if (slot == NULL)
return -ENODEV; return -ENODEV;
dbg("%s - physical_slot = %s", __FUNCTION__, hotplug_slot->name);
*value = acpiphp_get_power_status (slot->acpi_slot); dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
*value = acpiphp_get_power_status(slot->acpi_slot);
return retval; return retval;
} }
...@@ -263,8 +264,8 @@ static int get_power_status (struct hotplug_slot *hotplug_slot, u8 *value) ...@@ -263,8 +264,8 @@ static int get_power_status (struct hotplug_slot *hotplug_slot, u8 *value)
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 retval = 0; int retval = 0;
dbg("%s - physical_slot = %s", __FUNCTION__, hotplug_slot->name); dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
*value = hotplug_slot->info->attention_status; *value = hotplug_slot->info->attention_status;
...@@ -283,15 +284,15 @@ static int get_attention_status (struct hotplug_slot *hotplug_slot, u8 *value) ...@@ -283,15 +284,15 @@ static int get_attention_status (struct hotplug_slot *hotplug_slot, u8 *value)
*/ */
static int get_latch_status (struct hotplug_slot *hotplug_slot, u8 *value) static int get_latch_status (struct hotplug_slot *hotplug_slot, u8 *value)
{ {
struct slot *slot = get_slot (hotplug_slot, __FUNCTION__); struct slot *slot = get_slot(hotplug_slot, __FUNCTION__);
int retval = 0; int retval = 0;
if (slot == NULL) if (slot == NULL)
return -ENODEV; return -ENODEV;
dbg("%s - physical_slot = %s", __FUNCTION__, hotplug_slot->name);
*value = acpiphp_get_latch_status (slot->acpi_slot); dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
*value = acpiphp_get_latch_status(slot->acpi_slot);
return retval; return retval;
} }
...@@ -308,15 +309,15 @@ static int get_latch_status (struct hotplug_slot *hotplug_slot, u8 *value) ...@@ -308,15 +309,15 @@ static int get_latch_status (struct hotplug_slot *hotplug_slot, u8 *value)
*/ */
static int get_adapter_status (struct hotplug_slot *hotplug_slot, u8 *value) static int get_adapter_status (struct hotplug_slot *hotplug_slot, u8 *value)
{ {
struct slot *slot = get_slot (hotplug_slot, __FUNCTION__); struct slot *slot = get_slot(hotplug_slot, __FUNCTION__);
int retval = 0; int retval = 0;
if (slot == NULL) if (slot == NULL)
return -ENODEV; return -ENODEV;
dbg("%s - physical_slot = %s", __FUNCTION__, hotplug_slot->name);
*value = acpiphp_get_adapter_status (slot->acpi_slot); dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
*value = acpiphp_get_adapter_status(slot->acpi_slot);
return retval; return retval;
} }
...@@ -325,11 +326,11 @@ static int get_adapter_status (struct hotplug_slot *hotplug_slot, u8 *value) ...@@ -325,11 +326,11 @@ static int get_adapter_status (struct hotplug_slot *hotplug_slot, u8 *value)
/* return dummy value because ACPI doesn't provide any method... */ /* return dummy value because ACPI doesn't provide any method... */
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)
{ {
struct slot *slot = get_slot (hotplug_slot, __FUNCTION__); struct slot *slot = get_slot(hotplug_slot, __FUNCTION__);
if (slot == NULL) if (slot == NULL)
return -ENODEV; return -ENODEV;
*value = PCI_SPEED_UNKNOWN; *value = PCI_SPEED_UNKNOWN;
return 0; return 0;
...@@ -339,11 +340,11 @@ static int get_max_bus_speed (struct hotplug_slot *hotplug_slot, enum pci_bus_sp ...@@ -339,11 +340,11 @@ static int get_max_bus_speed (struct hotplug_slot *hotplug_slot, enum pci_bus_sp
/* return dummy value because ACPI doesn't provide any method... */ /* return dummy value because ACPI doesn't provide any method... */
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)
{ {
struct slot *slot = get_slot (hotplug_slot, __FUNCTION__); struct slot *slot = get_slot(hotplug_slot, __FUNCTION__);
if (slot == NULL) if (slot == NULL)
return -ENODEV; return -ENODEV;
*value = PCI_SPEED_UNKNOWN; *value = PCI_SPEED_UNKNOWN;
return 0; return 0;
...@@ -375,10 +376,10 @@ static int init_acpi (void) ...@@ -375,10 +376,10 @@ static int init_acpi (void)
*/ */
static void make_slot_name (struct slot *slot) static void make_slot_name (struct slot *slot)
{ {
snprintf (slot->hotplug_slot->name, SLOT_NAME_SIZE, "ACPI%d-%02x:%02x", snprintf(slot->hotplug_slot->name, SLOT_NAME_SIZE, "ACPI%d-%02x:%02x",
slot->acpi_slot->sun, slot->acpi_slot->sun,
slot->acpi_slot->bridge->bus, slot->acpi_slot->bridge->bus,
slot->acpi_slot->device); slot->acpi_slot->device);
} }
/** /**
...@@ -392,31 +393,31 @@ static int init_slots (void) ...@@ -392,31 +393,31 @@ static int init_slots (void)
int i; int i;
for (i = 0; i < num_slots; ++i) { for (i = 0; i < num_slots; ++i) {
slot = kmalloc (sizeof (struct slot), GFP_KERNEL); slot = kmalloc(sizeof(struct slot), GFP_KERNEL);
if (!slot) if (!slot)
return -ENOMEM; return -ENOMEM;
memset(slot, 0, sizeof(struct slot)); memset(slot, 0, sizeof(struct slot));
slot->hotplug_slot = kmalloc (sizeof (struct hotplug_slot), GFP_KERNEL); slot->hotplug_slot = kmalloc(sizeof(struct hotplug_slot), GFP_KERNEL);
if (!slot->hotplug_slot) { if (!slot->hotplug_slot) {
kfree (slot); kfree(slot);
return -ENOMEM; return -ENOMEM;
} }
memset(slot->hotplug_slot, 0, sizeof (struct hotplug_slot)); memset(slot->hotplug_slot, 0, sizeof(struct hotplug_slot));
slot->hotplug_slot->info = kmalloc (sizeof (struct hotplug_slot_info), GFP_KERNEL); slot->hotplug_slot->info = kmalloc(sizeof(struct hotplug_slot_info), GFP_KERNEL);
if (!slot->hotplug_slot->info) { if (!slot->hotplug_slot->info) {
kfree (slot->hotplug_slot); kfree(slot->hotplug_slot);
kfree (slot); kfree(slot);
return -ENOMEM; return -ENOMEM;
} }
memset(slot->hotplug_slot->info, 0, sizeof (struct hotplug_slot_info)); memset(slot->hotplug_slot->info, 0, sizeof(struct hotplug_slot_info));
slot->hotplug_slot->name = kmalloc (SLOT_NAME_SIZE, GFP_KERNEL); slot->hotplug_slot->name = kmalloc(SLOT_NAME_SIZE, GFP_KERNEL);
if (!slot->hotplug_slot->name) { if (!slot->hotplug_slot->name) {
kfree (slot->hotplug_slot->info); kfree(slot->hotplug_slot->info);
kfree (slot->hotplug_slot); kfree(slot->hotplug_slot);
kfree (slot); kfree(slot);
return -ENOMEM; return -ENOMEM;
} }
...@@ -426,27 +427,27 @@ static int init_slots (void) ...@@ -426,27 +427,27 @@ static int init_slots (void)
slot->hotplug_slot->private = slot; slot->hotplug_slot->private = slot;
slot->hotplug_slot->ops = &acpi_hotplug_slot_ops; slot->hotplug_slot->ops = &acpi_hotplug_slot_ops;
slot->acpi_slot = get_slot_from_id (i); slot->acpi_slot = get_slot_from_id(i);
slot->hotplug_slot->info->power_status = acpiphp_get_power_status(slot->acpi_slot); slot->hotplug_slot->info->power_status = acpiphp_get_power_status(slot->acpi_slot);
slot->hotplug_slot->info->attention_status = acpiphp_get_attention_status(slot->acpi_slot); slot->hotplug_slot->info->attention_status = acpiphp_get_attention_status(slot->acpi_slot);
slot->hotplug_slot->info->latch_status = acpiphp_get_latch_status(slot->acpi_slot); slot->hotplug_slot->info->latch_status = acpiphp_get_latch_status(slot->acpi_slot);
slot->hotplug_slot->info->adapter_status = acpiphp_get_adapter_status(slot->acpi_slot); slot->hotplug_slot->info->adapter_status = acpiphp_get_adapter_status(slot->acpi_slot);
make_slot_name (slot); make_slot_name(slot);
retval = pci_hp_register (slot->hotplug_slot); retval = pci_hp_register(slot->hotplug_slot);
if (retval) { if (retval) {
err ("pci_hp_register failed with error %d", retval); err("pci_hp_register failed with error %d\n", retval);
kfree (slot->hotplug_slot->info); kfree(slot->hotplug_slot->info);
kfree (slot->hotplug_slot->name); kfree(slot->hotplug_slot->name);
kfree (slot->hotplug_slot); kfree(slot->hotplug_slot);
kfree (slot); kfree(slot);
return retval; return retval;
} }
/* add slot to our internal list */ /* add slot to our internal list */
list_add (&slot->slot_list, &slot_list); list_add(&slot->slot_list, &slot_list);
info("Slot [%s] registered", slot->hotplug_slot->name); info("Slot [%s] registered\n", slot->hotplug_slot->name);
} }
return retval; return retval;
...@@ -459,13 +460,13 @@ static void cleanup_slots (void) ...@@ -459,13 +460,13 @@ static void cleanup_slots (void)
struct slot *slot; struct slot *slot;
list_for_each_safe (tmp, n, &slot_list) { list_for_each_safe (tmp, n, &slot_list) {
slot = list_entry (tmp, struct slot, slot_list); slot = list_entry(tmp, struct slot, slot_list);
list_del (&slot->slot_list); list_del(&slot->slot_list);
pci_hp_deregister (slot->hotplug_slot); pci_hp_deregister(slot->hotplug_slot);
kfree (slot->hotplug_slot->info); kfree(slot->hotplug_slot->info);
kfree (slot->hotplug_slot->name); kfree(slot->hotplug_slot->name);
kfree (slot->hotplug_slot); kfree(slot->hotplug_slot);
kfree (slot); kfree(slot);
} }
return; return;
...@@ -476,7 +477,9 @@ static int __init acpiphp_init(void) ...@@ -476,7 +477,9 @@ static int __init acpiphp_init(void)
{ {
int retval; int retval;
info (DRIVER_DESC " version: " DRIVER_VERSION); info(DRIVER_DESC " version: " DRIVER_VERSION "\n");
acpiphp_debug = debug;
/* read all the ACPI info from the system */ /* read all the ACPI info from the system */
retval = init_acpi(); retval = init_acpi();
......
...@@ -153,7 +153,7 @@ register_slot (acpi_handle handle, u32 lvl, void *context, void **rv) ...@@ -153,7 +153,7 @@ register_slot (acpi_handle handle, u32 lvl, void *context, void **rv)
for (slot = bridge->slots; slot; slot = slot->next) for (slot = bridge->slots; slot; slot = slot->next)
if (slot->device == device) { if (slot->device == device) {
if (slot->sun != sun) if (slot->sun != sun)
warn("sibling found, but _SUN doesn't match!"); warn("sibling found, but _SUN doesn't match!\n");
break; break;
} }
...@@ -177,7 +177,7 @@ register_slot (acpi_handle handle, u32 lvl, void *context, void **rv) ...@@ -177,7 +177,7 @@ register_slot (acpi_handle handle, u32 lvl, void *context, void **rv)
bridge->nr_slots++; bridge->nr_slots++;
dbg("found ACPI PCI Hotplug slot at PCI %02x:%02x Slot:0x%x", dbg("found ACPI PCI Hotplug slot at PCI %02x:%02x Slot:%d\n",
slot->bridge->bus, slot->device, slot->sun); slot->bridge->bus, slot->device, slot->sun);
} }
...@@ -202,7 +202,7 @@ register_slot (acpi_handle handle, u32 lvl, void *context, void **rv) ...@@ -202,7 +202,7 @@ register_slot (acpi_handle handle, u32 lvl, void *context, void **rv)
newfunc); newfunc);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
err("failed to register interrupt notify handler"); err("failed to register interrupt notify handler\n");
return status; return status;
} }
...@@ -302,21 +302,21 @@ decode_acpi_resource (acpi_resource *resource, struct acpiphp_bridge *bridge) ...@@ -302,21 +302,21 @@ decode_acpi_resource (acpi_resource *resource, struct acpiphp_bridge *bridge)
switch (resource_type) { switch (resource_type) {
case ACPI_MEMORY_RANGE: case ACPI_MEMORY_RANGE:
if (cache_attribute == ACPI_PREFETCHABLE_MEMORY) { if (cache_attribute == ACPI_PREFETCHABLE_MEMORY) {
dbg("resource type: prefetchable memory 0x%x - 0x%x", (u32)min_address_range, (u32)max_address_range); dbg("resource type: prefetchable memory 0x%x - 0x%x\n", (u32)min_address_range, (u32)max_address_range);
res = acpiphp_make_resource(min_address_range, res = acpiphp_make_resource(min_address_range,
address_length); address_length);
if (!res) { if (!res) {
err("out of memory"); err("out of memory\n");
return; return;
} }
res->next = bridge->p_mem_head; res->next = bridge->p_mem_head;
bridge->p_mem_head = res; bridge->p_mem_head = res;
} else { } else {
dbg("resource type: memory 0x%x - 0x%x", (u32)min_address_range, (u32)max_address_range); dbg("resource type: memory 0x%x - 0x%x\n", (u32)min_address_range, (u32)max_address_range);
res = acpiphp_make_resource(min_address_range, res = acpiphp_make_resource(min_address_range,
address_length); address_length);
if (!res) { if (!res) {
err("out of memory"); err("out of memory\n");
return; return;
} }
res->next = bridge->mem_head; res->next = bridge->mem_head;
...@@ -324,22 +324,22 @@ decode_acpi_resource (acpi_resource *resource, struct acpiphp_bridge *bridge) ...@@ -324,22 +324,22 @@ decode_acpi_resource (acpi_resource *resource, struct acpiphp_bridge *bridge)
} }
break; break;
case ACPI_IO_RANGE: case ACPI_IO_RANGE:
dbg("resource type: io 0x%x - 0x%x", (u32)min_address_range, (u32)max_address_range); dbg("resource type: io 0x%x - 0x%x\n", (u32)min_address_range, (u32)max_address_range);
res = acpiphp_make_resource(min_address_range, res = acpiphp_make_resource(min_address_range,
address_length); address_length);
if (!res) { if (!res) {
err("out of memory"); err("out of memory\n");
return; return;
} }
res->next = bridge->io_head; res->next = bridge->io_head;
bridge->io_head = res; bridge->io_head = res;
break; break;
case ACPI_BUS_NUMBER_RANGE: case ACPI_BUS_NUMBER_RANGE:
dbg("resource type: bus number %d - %d", (u32)min_address_range, (u32)max_address_range); dbg("resource type: bus number %d - %d\n", (u32)min_address_range, (u32)max_address_range);
res = acpiphp_make_resource(min_address_range, res = acpiphp_make_resource(min_address_range,
address_length); address_length);
if (!res) { if (!res) {
err("out of memory"); err("out of memory\n");
return; return;
} }
res->next = bridge->bus_head; res->next = bridge->bus_head;
...@@ -356,10 +356,9 @@ decode_acpi_resource (acpi_resource *resource, struct acpiphp_bridge *bridge) ...@@ -356,10 +356,9 @@ decode_acpi_resource (acpi_resource *resource, struct acpiphp_bridge *bridge)
acpiphp_resource_sort_and_combine(&bridge->mem_head); acpiphp_resource_sort_and_combine(&bridge->mem_head);
acpiphp_resource_sort_and_combine(&bridge->p_mem_head); acpiphp_resource_sort_and_combine(&bridge->p_mem_head);
acpiphp_resource_sort_and_combine(&bridge->bus_head); acpiphp_resource_sort_and_combine(&bridge->bus_head);
#if 1
info("ACPI _CRS resource:"); dbg("ACPI _CRS resource:\n");
acpiphp_dump_resource(bridge); acpiphp_dump_resource(bridge);
#endif
} }
...@@ -368,7 +367,7 @@ static struct pci_bus *find_pci_bus(const struct list_head *list, int bus) ...@@ -368,7 +367,7 @@ static struct pci_bus *find_pci_bus(const struct list_head *list, int bus)
{ {
const struct list_head *l; const struct list_head *l;
list_for_each(l, list) { list_for_each (l, list) {
struct pci_bus *b = pci_bus_b(l); struct pci_bus *b = pci_bus_b(l);
if (b->number == bus) if (b->number == bus)
return b; return b;
...@@ -404,7 +403,7 @@ static void decode_hpp(struct acpiphp_bridge *bridge) ...@@ -404,7 +403,7 @@ static void decode_hpp(struct acpiphp_bridge *bridge)
status = acpi_evaluate_object(bridge->handle, "_HPP", NULL, &buffer); status = acpi_evaluate_object(bridge->handle, "_HPP", NULL, &buffer);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
dbg("_HPP evaluation failed"); dbg("_HPP evaluation failed\n");
return; return;
} }
...@@ -412,13 +411,13 @@ static void decode_hpp(struct acpiphp_bridge *bridge) ...@@ -412,13 +411,13 @@ static void decode_hpp(struct acpiphp_bridge *bridge)
if (!package || package->type != ACPI_TYPE_PACKAGE || if (!package || package->type != ACPI_TYPE_PACKAGE ||
package->package.count != 4 || !package->package.elements) { package->package.count != 4 || !package->package.elements) {
err("invalid _HPP object; ignoring"); err("invalid _HPP object; ignoring\n");
goto err_exit; goto err_exit;
} }
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
if (package->package.elements[i].type != ACPI_TYPE_INTEGER) { if (package->package.elements[i].type != ACPI_TYPE_INTEGER) {
err("invalid _HPP parameter type; ignoring"); err("invalid _HPP parameter type; ignoring\n");
goto err_exit; goto err_exit;
} }
} }
...@@ -428,7 +427,7 @@ static void decode_hpp(struct acpiphp_bridge *bridge) ...@@ -428,7 +427,7 @@ static void decode_hpp(struct acpiphp_bridge *bridge)
bridge->hpp.enable_SERR = package->package.elements[2].integer.value; bridge->hpp.enable_SERR = package->package.elements[2].integer.value;
bridge->hpp.enable_PERR = package->package.elements[3].integer.value; bridge->hpp.enable_PERR = package->package.elements[3].integer.value;
dbg("_HPP parameter = (%02x, %02x, %02x, %02x)", dbg("_HPP parameter = (%02x, %02x, %02x, %02x)\n",
bridge->hpp.cache_line_size, bridge->hpp.cache_line_size,
bridge->hpp.latency_timer, bridge->hpp.latency_timer,
bridge->hpp.enable_SERR, bridge->hpp.enable_SERR,
...@@ -463,15 +462,13 @@ static void init_bridge_misc (struct acpiphp_bridge *bridge) ...@@ -463,15 +462,13 @@ static void init_bridge_misc (struct acpiphp_bridge *bridge)
bridge); bridge);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
err("failed to register interrupt notify handler"); err("failed to register interrupt notify handler\n");
} }
list_add(&bridge->list, &bridge_list); list_add(&bridge->list, &bridge_list);
#if 1 dbg("Bridge resource:\n");
dbg("Bridge resource:");
acpiphp_dump_resource(bridge); acpiphp_dump_resource(bridge);
#endif
} }
...@@ -507,7 +504,7 @@ static void add_host_bridge (acpi_handle *handle, int seg, int bus) ...@@ -507,7 +504,7 @@ static void add_host_bridge (acpi_handle *handle, int seg, int bus)
status = acpi_get_current_resources(handle, &buffer); status = acpi_get_current_resources(handle, &buffer);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
err("failed to decode bridge resources"); err("failed to decode bridge resources\n");
kfree(bridge); kfree(bridge);
return; return;
} }
...@@ -535,7 +532,7 @@ static void add_p2p_bridge (acpi_handle *handle, int seg, int bus, int dev, int ...@@ -535,7 +532,7 @@ static void add_p2p_bridge (acpi_handle *handle, int seg, int bus, int dev, int
bridge = kmalloc(sizeof(struct acpiphp_bridge), GFP_KERNEL); bridge = kmalloc(sizeof(struct acpiphp_bridge), GFP_KERNEL);
if (bridge == NULL) { if (bridge == NULL) {
err("out of memory"); err("out of memory\n");
return; return;
} }
...@@ -547,14 +544,14 @@ static void add_p2p_bridge (acpi_handle *handle, int seg, int bus, int dev, int ...@@ -547,14 +544,14 @@ static void add_p2p_bridge (acpi_handle *handle, int seg, int bus, int dev, int
bridge->pci_dev = pci_find_slot(bus, PCI_DEVFN(dev, fn)); bridge->pci_dev = pci_find_slot(bus, PCI_DEVFN(dev, fn));
if (!bridge->pci_dev) { if (!bridge->pci_dev) {
err("Can't get pci_dev"); err("Can't get pci_dev\n");
kfree(bridge); kfree(bridge);
return; return;
} }
bridge->pci_bus = bridge->pci_dev->subordinate; bridge->pci_bus = bridge->pci_dev->subordinate;
if (!bridge->pci_bus) { if (!bridge->pci_bus) {
err("This is not a PCI-to-PCI bridge!"); err("This is not a PCI-to-PCI bridge!\n");
kfree(bridge); kfree(bridge);
return; return;
} }
...@@ -580,10 +577,10 @@ static void add_p2p_bridge (acpi_handle *handle, int seg, int bus, int dev, int ...@@ -580,10 +577,10 @@ static void add_p2p_bridge (acpi_handle *handle, int seg, int bus, int dev, int
limit = ((limit << 8) & 0xf000) + 0xfff; limit = ((limit << 8) & 0xf000) + 0xfff;
bridge->io_head = acpiphp_make_resource((u64)base, limit - base + 1); bridge->io_head = acpiphp_make_resource((u64)base, limit - base + 1);
if (!bridge->io_head) { if (!bridge->io_head) {
err("out of memory"); err("out of memory\n");
return; return;
} }
dbg("16bit I/O range: %04x-%04x", dbg("16bit I/O range: %04x-%04x\n",
(u32)bridge->io_head->base, (u32)bridge->io_head->base,
(u32)(bridge->io_head->base + bridge->io_head->length - 1)); (u32)(bridge->io_head->base + bridge->io_head->length - 1));
break; break;
...@@ -594,18 +591,18 @@ static void add_p2p_bridge (acpi_handle *handle, int seg, int bus, int dev, int ...@@ -594,18 +591,18 @@ static void add_p2p_bridge (acpi_handle *handle, int seg, int bus, int dev, int
limit = (((u32)tmp16 << 16) | ((limit << 8) & 0xf000)) + 0xfff; limit = (((u32)tmp16 << 16) | ((limit << 8) & 0xf000)) + 0xfff;
bridge->io_head = acpiphp_make_resource((u64)base, limit - base + 1); bridge->io_head = acpiphp_make_resource((u64)base, limit - base + 1);
if (!bridge->io_head) { if (!bridge->io_head) {
err("out of memory"); err("out of memory\n");
return; return;
} }
dbg("32bit I/O range: %08x-%08x", dbg("32bit I/O range: %08x-%08x\n",
(u32)bridge->io_head->base, (u32)bridge->io_head->base,
(u32)(bridge->io_head->base + bridge->io_head->length - 1)); (u32)(bridge->io_head->base + bridge->io_head->length - 1));
break; break;
case 0x0f: case 0x0f:
dbg("I/O space unsupported"); dbg("I/O space unsupported\n");
break; break;
default: default:
warn("Unknown I/O range type"); warn("Unknown I/O range type\n");
} }
/* Memory resources (mandatory for P2P bridge) */ /* Memory resources (mandatory for P2P bridge) */
...@@ -615,10 +612,10 @@ static void add_p2p_bridge (acpi_handle *handle, int seg, int bus, int dev, int ...@@ -615,10 +612,10 @@ static void add_p2p_bridge (acpi_handle *handle, int seg, int bus, int dev, int
limit = ((tmp16 & 0xfff0) << 16) | 0xfffff; limit = ((tmp16 & 0xfff0) << 16) | 0xfffff;
bridge->mem_head = acpiphp_make_resource((u64)base, limit - base + 1); bridge->mem_head = acpiphp_make_resource((u64)base, limit - base + 1);
if (!bridge->mem_head) { if (!bridge->mem_head) {
err("out of memory"); err("out of memory\n");
return; return;
} }
dbg("32bit Memory range: %08x-%08x", dbg("32bit Memory range: %08x-%08x\n",
(u32)bridge->mem_head->base, (u32)bridge->mem_head->base,
(u32)(bridge->mem_head->base + bridge->mem_head->length-1)); (u32)(bridge->mem_head->base + bridge->mem_head->length-1));
...@@ -634,10 +631,10 @@ static void add_p2p_bridge (acpi_handle *handle, int seg, int bus, int dev, int ...@@ -634,10 +631,10 @@ static void add_p2p_bridge (acpi_handle *handle, int seg, int bus, int dev, int
limit = ((limit & 0xfff0) << 16) | 0xfffff; limit = ((limit & 0xfff0) << 16) | 0xfffff;
bridge->p_mem_head = acpiphp_make_resource((u64)base, limit - base + 1); bridge->p_mem_head = acpiphp_make_resource((u64)base, limit - base + 1);
if (!bridge->p_mem_head) { if (!bridge->p_mem_head) {
err("out of memory"); err("out of memory\n");
return; return;
} }
dbg("32bit Prefetchable memory range: %08x-%08x", dbg("32bit Prefetchable memory range: %08x-%08x\n",
(u32)bridge->p_mem_head->base, (u32)bridge->p_mem_head->base,
(u32)(bridge->p_mem_head->base + bridge->p_mem_head->length - 1)); (u32)(bridge->p_mem_head->base + bridge->p_mem_head->length - 1));
break; break;
...@@ -649,10 +646,10 @@ static void add_p2p_bridge (acpi_handle *handle, int seg, int bus, int dev, int ...@@ -649,10 +646,10 @@ static void add_p2p_bridge (acpi_handle *handle, int seg, int bus, int dev, int
bridge->p_mem_head = acpiphp_make_resource(base64, limit64 - base64 + 1); bridge->p_mem_head = acpiphp_make_resource(base64, limit64 - base64 + 1);
if (!bridge->p_mem_head) { if (!bridge->p_mem_head) {
err("out of memory"); err("out of memory\n");
return; return;
} }
dbg("64bit Prefetchable memory range: %08x%08x-%08x%08x", dbg("64bit Prefetchable memory range: %08x%08x-%08x%08x\n",
(u32)(bridge->p_mem_head->base >> 32), (u32)(bridge->p_mem_head->base >> 32),
(u32)(bridge->p_mem_head->base & 0xffffffff), (u32)(bridge->p_mem_head->base & 0xffffffff),
(u32)((bridge->p_mem_head->base + bridge->p_mem_head->length - 1) >> 32), (u32)((bridge->p_mem_head->base + bridge->p_mem_head->length - 1) >> 32),
...@@ -661,7 +658,7 @@ static void add_p2p_bridge (acpi_handle *handle, int seg, int bus, int dev, int ...@@ -661,7 +658,7 @@ static void add_p2p_bridge (acpi_handle *handle, int seg, int bus, int dev, int
case 0x0f: case 0x0f:
break; break;
default: default:
warn("Unknown prefetchale memory type"); warn("Unknown prefetchale memory type\n");
} }
init_bridge_misc(bridge); init_bridge_misc(bridge);
...@@ -689,7 +686,7 @@ find_p2p_bridge (acpi_handle handle, u32 lvl, void *context, void **rv) ...@@ -689,7 +686,7 @@ find_p2p_bridge (acpi_handle handle, u32 lvl, void *context, void **rv)
status = acpi_evaluate_integer(handle, "_ADR", NULL, &tmp); status = acpi_evaluate_integer(handle, "_ADR", NULL, &tmp);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
dbg("%s: _ADR evaluation failure", __FUNCTION__); dbg("%s: _ADR evaluation failure\n", __FUNCTION__);
return AE_OK; return AE_OK;
} }
...@@ -706,7 +703,7 @@ find_p2p_bridge (acpi_handle handle, u32 lvl, void *context, void **rv) ...@@ -706,7 +703,7 @@ find_p2p_bridge (acpi_handle handle, u32 lvl, void *context, void **rv)
/* check if this bridge has ejectable slots */ /* check if this bridge has ejectable slots */
if (detect_ejectable_slots(handle) > 0) { if (detect_ejectable_slots(handle) > 0) {
dbg("found PCI-to-PCI bridge at PCI %02x:%02x.%d", bus, device, function); dbg("found PCI-to-PCI bridge at PCI %s\n", dev->slot_name);
add_p2p_bridge(handle, seg, bus, device, function); add_p2p_bridge(handle, seg, bus, device, function);
} }
...@@ -727,7 +724,7 @@ static int add_bridges (acpi_handle *handle) ...@@ -727,7 +724,7 @@ static int add_bridges (acpi_handle *handle)
if (ACPI_SUCCESS(status)) { if (ACPI_SUCCESS(status)) {
status = acpi_evaluate_integer(handle, "_STA", NULL, &tmp); status = acpi_evaluate_integer(handle, "_STA", NULL, &tmp);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
dbg("%s: _STA evaluation failure", __FUNCTION__); dbg("%s: _STA evaluation failure\n", __FUNCTION__);
return 0; return 0;
} }
if ((tmp & ACPI_STA_FUNCTIONING) == 0) if ((tmp & ACPI_STA_FUNCTIONING) == 0)
...@@ -746,13 +743,13 @@ static int add_bridges (acpi_handle *handle) ...@@ -746,13 +743,13 @@ static int add_bridges (acpi_handle *handle)
if (ACPI_SUCCESS(status)) { if (ACPI_SUCCESS(status)) {
bus = tmp; bus = tmp;
} else { } else {
warn("can't get bus number, assuming 0"); warn("can't get bus number, assuming 0\n");
bus = 0; bus = 0;
} }
/* check if this bridge has ejectable slots */ /* check if this bridge has ejectable slots */
if (detect_ejectable_slots(handle) > 0) { if (detect_ejectable_slots(handle) > 0) {
dbg("found PCI host-bus bridge with hot-pluggable slots"); dbg("found PCI host-bus bridge with hot-pluggable slots\n");
add_host_bridge(handle, seg, bus); add_host_bridge(handle, seg, bus);
return 0; return 0;
} }
...@@ -764,7 +761,7 @@ static int add_bridges (acpi_handle *handle) ...@@ -764,7 +761,7 @@ static int add_bridges (acpi_handle *handle)
find_p2p_bridge, &tmp, NULL); find_p2p_bridge, &tmp, NULL);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
warn("find_p2p_bridge faied (error code = 0x%x)",status); warn("find_p2p_bridge faied (error code = 0x%x)\n",status);
return 0; return 0;
} }
...@@ -782,7 +779,7 @@ find_host_bridge (acpi_handle handle, u32 lvl, void *context, void **rv) ...@@ -782,7 +779,7 @@ find_host_bridge (acpi_handle handle, u32 lvl, void *context, void **rv)
status = acpi_get_object_info(handle, &info); status = acpi_get_object_info(handle, &info);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
dbg("%s: failed to get bridge information", __FUNCTION__); dbg("%s: failed to get bridge information\n", __FUNCTION__);
return AE_OK; /* continue */ return AE_OK; /* continue */
} }
...@@ -793,7 +790,7 @@ find_host_bridge (acpi_handle handle, u32 lvl, void *context, void **rv) ...@@ -793,7 +790,7 @@ find_host_bridge (acpi_handle handle, u32 lvl, void *context, void **rv)
(info.valid & ACPI_VALID_HID) && (info.valid & ACPI_VALID_HID) &&
strcmp(info.hardware_id, ACPI_PCI_HOST_HID) == 0) { strcmp(info.hardware_id, ACPI_PCI_HOST_HID) == 0) {
acpi_get_name(handle, ACPI_SINGLE_NAME, &buffer); acpi_get_name(handle, ACPI_SINGLE_NAME, &buffer);
dbg("checking PCI-hotplug capable bridges under [%s]", objname); dbg("checking PCI-hotplug capable bridges under [%s]\n", objname);
add_bridges(handle); add_bridges(handle);
} }
return AE_OK; return AE_OK;
...@@ -811,15 +808,15 @@ static int power_on_slot (struct acpiphp_slot *slot) ...@@ -811,15 +808,15 @@ static int power_on_slot (struct acpiphp_slot *slot)
if (slot->flags & SLOT_POWEREDON) if (slot->flags & SLOT_POWEREDON)
goto err_exit; goto err_exit;
list_for_each(l, &slot->funcs) { list_for_each (l, &slot->funcs) {
func = list_entry(l, struct acpiphp_func, sibling); func = list_entry(l, struct acpiphp_func, sibling);
if (func->flags & FUNC_HAS_PS0) { if (func->flags & FUNC_HAS_PS0) {
dbg("%s: executing _PS0 on %02x:%02x.%d", __FUNCTION__, dbg("%s: executing _PS0 on %s\n", __FUNCTION__,
slot->bridge->bus, slot->device, func->function); func->pci_dev->slot_name);
status = acpi_evaluate_object(func->handle, "_PS0", NULL, NULL); status = acpi_evaluate_object(func->handle, "_PS0", NULL, NULL);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
warn("%s: _PS0 failed", __FUNCTION__); warn("%s: _PS0 failed\n", __FUNCTION__);
retval = -1; retval = -1;
goto err_exit; goto err_exit;
} }
...@@ -849,27 +846,27 @@ static int power_off_slot (struct acpiphp_slot *slot) ...@@ -849,27 +846,27 @@ static int power_off_slot (struct acpiphp_slot *slot)
if ((slot->flags & SLOT_POWEREDON) == 0) if ((slot->flags & SLOT_POWEREDON) == 0)
goto err_exit; goto err_exit;
list_for_each(l, &slot->funcs) { list_for_each (l, &slot->funcs) {
func = list_entry(l, struct acpiphp_func, sibling); func = list_entry(l, struct acpiphp_func, sibling);
if (func->flags & FUNC_HAS_PS3) { if (func->flags & FUNC_HAS_PS3) {
dbg("%s: executing _PS3 on %02x:%02x.%d", __FUNCTION__, dbg("%s: executing _PS3 on %s\n", __FUNCTION__,
slot->bridge->bus, slot->device, func->function); func->pci_dev->slot_name);
status = acpi_evaluate_object(func->handle, "_PS3", NULL, NULL); status = acpi_evaluate_object(func->handle, "_PS3", NULL, NULL);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
warn("%s: _PS3 failed", __FUNCTION__); warn("%s: _PS3 failed\n", __FUNCTION__);
retval = -1; retval = -1;
goto err_exit; goto err_exit;
} }
} }
} }
list_for_each(l, &slot->funcs) { list_for_each (l, &slot->funcs) {
func = list_entry(l, struct acpiphp_func, sibling); func = list_entry(l, struct acpiphp_func, sibling);
if (func->flags & FUNC_HAS_EJ0) { if (func->flags & FUNC_HAS_EJ0) {
dbg("%s: executing _EJ0 on %02x:%02x.%d", __FUNCTION__, dbg("%s: executing _EJ0 on %s\n", __FUNCTION__,
slot->bridge->bus, slot->device, func->function); func->pci_dev->slot_name);
/* _EJ0 method take one argument */ /* _EJ0 method take one argument */
arg_list.count = 1; arg_list.count = 1;
...@@ -879,7 +876,7 @@ static int power_off_slot (struct acpiphp_slot *slot) ...@@ -879,7 +876,7 @@ static int power_off_slot (struct acpiphp_slot *slot)
status = acpi_evaluate_object(func->handle, "_EJ0", &arg_list, NULL); status = acpi_evaluate_object(func->handle, "_EJ0", &arg_list, NULL);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
warn("%s: _EJ0 failed", __FUNCTION__); warn("%s: _EJ0 failed\n", __FUNCTION__);
retval = -1; retval = -1;
goto err_exit; goto err_exit;
} }
...@@ -919,7 +916,7 @@ static int enable_device (struct acpiphp_slot *slot) ...@@ -919,7 +916,7 @@ static int enable_device (struct acpiphp_slot *slot)
dev = pci_find_slot(slot->bridge->bus, PCI_DEVFN(slot->device, 0)); dev = pci_find_slot(slot->bridge->bus, PCI_DEVFN(slot->device, 0));
if (dev) { if (dev) {
/* This case shouldn't happen */ /* This case shouldn't happen */
err("pci_dev structure already exists."); err("pci_dev structure already exists.\n");
retval = -1; retval = -1;
goto err_exit; goto err_exit;
} }
...@@ -941,7 +938,7 @@ static int enable_device (struct acpiphp_slot *slot) ...@@ -941,7 +938,7 @@ static int enable_device (struct acpiphp_slot *slot)
dev = pci_scan_slot (&dev0); dev = pci_scan_slot (&dev0);
if (!dev) { if (!dev) {
err("No new device found"); err("No new device found\n");
retval = -1; retval = -1;
goto err_exit; goto err_exit;
} }
...@@ -953,7 +950,7 @@ static int enable_device (struct acpiphp_slot *slot) ...@@ -953,7 +950,7 @@ static int enable_device (struct acpiphp_slot *slot)
} }
/* associate pci_dev to our representation */ /* associate pci_dev to our representation */
list_for_each(l, &slot->funcs) { list_for_each (l, &slot->funcs) {
func = list_entry(l, struct acpiphp_func, sibling); func = list_entry(l, struct acpiphp_func, sibling);
func->pci_dev = pci_find_slot(slot->bridge->bus, func->pci_dev = pci_find_slot(slot->bridge->bus,
...@@ -970,10 +967,8 @@ static int enable_device (struct acpiphp_slot *slot) ...@@ -970,10 +967,8 @@ static int enable_device (struct acpiphp_slot *slot)
slot->flags |= SLOT_ENABLED; slot->flags |= SLOT_ENABLED;
#if 1 dbg("Available resources:\n");
dbg("Available resources:");
acpiphp_dump_resource(slot->bridge); acpiphp_dump_resource(slot->bridge);
#endif
err_exit: err_exit:
return retval; return retval;
...@@ -993,14 +988,14 @@ static int disable_device (struct acpiphp_slot *slot) ...@@ -993,14 +988,14 @@ static int disable_device (struct acpiphp_slot *slot)
if (!(slot->flags & SLOT_ENABLED)) if (!(slot->flags & SLOT_ENABLED))
goto err_exit; goto err_exit;
list_for_each(l, &slot->funcs) { list_for_each (l, &slot->funcs) {
func = list_entry(l, struct acpiphp_func, sibling); func = list_entry(l, struct acpiphp_func, sibling);
if (func->pci_dev) { if (func->pci_dev) {
if (acpiphp_unconfigure_function(func) == 0) { if (acpiphp_unconfigure_function(func) == 0) {
func->pci_dev = NULL; func->pci_dev = NULL;
} else { } else {
err("failed to unconfigure device"); err("failed to unconfigure device\n");
retval = -1; retval = -1;
goto err_exit; goto err_exit;
} }
...@@ -1033,7 +1028,7 @@ static unsigned int get_slot_status (struct acpiphp_slot *slot) ...@@ -1033,7 +1028,7 @@ static unsigned int get_slot_status (struct acpiphp_slot *slot)
struct list_head *l; struct list_head *l;
struct acpiphp_func *func; struct acpiphp_func *func;
list_for_each(l, &slot->funcs) { list_for_each (l, &slot->funcs) {
func = list_entry(l, struct acpiphp_func, sibling); func = list_entry(l, struct acpiphp_func, sibling);
if (func->flags & FUNC_HAS_STA) { if (func->flags & FUNC_HAS_STA) {
...@@ -1063,7 +1058,7 @@ static unsigned int get_slot_status (struct acpiphp_slot *slot) ...@@ -1063,7 +1058,7 @@ static unsigned int get_slot_status (struct acpiphp_slot *slot)
/** /**
* handle_hotplug_event_bridge - handle ACPI event on bridges * handle_hotplug_event_bridge - handle ACPI event on bridges
* *
* @handle: Notify()'ed acpi_handle * @handle: Notify()'ed acpi_handle
* @type: Notify code * @type: Notify code
* @context: pointer to acpiphp_bridge structure * @context: pointer to acpiphp_bridge structure
* *
...@@ -1084,28 +1079,28 @@ static void handle_hotplug_event_bridge (acpi_handle handle, u32 type, void *con ...@@ -1084,28 +1079,28 @@ static void handle_hotplug_event_bridge (acpi_handle handle, u32 type, void *con
switch (type) { switch (type) {
case ACPI_NOTIFY_BUS_CHECK: case ACPI_NOTIFY_BUS_CHECK:
/* bus re-enumerate */ /* bus re-enumerate */
dbg("%s: Bus check notify on %s", __FUNCTION__, objname); dbg("%s: Bus check notify on %s\n", __FUNCTION__, objname);
acpiphp_check_bridge(bridge); acpiphp_check_bridge(bridge);
break; break;
case ACPI_NOTIFY_DEVICE_CHECK: case ACPI_NOTIFY_DEVICE_CHECK:
/* device check */ /* device check */
dbg("%s: Device check notify on %s", __FUNCTION__, objname); dbg("%s: Device check notify on %s\n", __FUNCTION__, objname);
acpiphp_check_bridge(bridge); acpiphp_check_bridge(bridge);
break; break;
case ACPI_NOTIFY_DEVICE_WAKE: case ACPI_NOTIFY_DEVICE_WAKE:
/* wake event */ /* wake event */
dbg("%s: Device wake notify on %s", __FUNCTION__, objname); dbg("%s: Device wake notify on %s\n", __FUNCTION__, objname);
break; break;
case ACPI_NOTIFY_EJECT_REQUEST: case ACPI_NOTIFY_EJECT_REQUEST:
/* request device eject */ /* request device eject */
dbg("%s: Device eject notify on %s", __FUNCTION__, objname); dbg("%s: Device eject notify on %s\n", __FUNCTION__, objname);
break; break;
default: default:
warn("notify_handler: unknown event type 0x%x for %s", type, objname); warn("notify_handler: unknown event type 0x%x for %s\n", type, objname);
break; break;
} }
} }
...@@ -1114,7 +1109,7 @@ static void handle_hotplug_event_bridge (acpi_handle handle, u32 type, void *con ...@@ -1114,7 +1109,7 @@ static void handle_hotplug_event_bridge (acpi_handle handle, u32 type, void *con
/** /**
* handle_hotplug_event_func - handle ACPI event on functions (i.e. slots) * handle_hotplug_event_func - handle ACPI event on functions (i.e. slots)
* *
* @handle: Notify()'ed acpi_handle * @handle: Notify()'ed acpi_handle
* @type: Notify code * @type: Notify code
* @context: pointer to acpiphp_func structure * @context: pointer to acpiphp_func structure
* *
...@@ -1135,29 +1130,29 @@ static void handle_hotplug_event_func (acpi_handle handle, u32 type, void *conte ...@@ -1135,29 +1130,29 @@ static void handle_hotplug_event_func (acpi_handle handle, u32 type, void *conte
switch (type) { switch (type) {
case ACPI_NOTIFY_BUS_CHECK: case ACPI_NOTIFY_BUS_CHECK:
/* bus re-enumerate */ /* bus re-enumerate */
dbg("%s: Bus check notify on %s", __FUNCTION__, objname); dbg("%s: Bus check notify on %s\n", __FUNCTION__, objname);
acpiphp_enable_slot(func->slot); acpiphp_enable_slot(func->slot);
break; break;
case ACPI_NOTIFY_DEVICE_CHECK: case ACPI_NOTIFY_DEVICE_CHECK:
/* device check : re-enumerate from parent bus */ /* device check : re-enumerate from parent bus */
dbg("%s: Device check notify on %s", __FUNCTION__, objname); dbg("%s: Device check notify on %s\n", __FUNCTION__, objname);
acpiphp_check_bridge(func->slot->bridge); acpiphp_check_bridge(func->slot->bridge);
break; break;
case ACPI_NOTIFY_DEVICE_WAKE: case ACPI_NOTIFY_DEVICE_WAKE:
/* wake event */ /* wake event */
dbg("%s: Device wake notify on %s", __FUNCTION__, objname); dbg("%s: Device wake notify on %s\n", __FUNCTION__, objname);
break; break;
case ACPI_NOTIFY_EJECT_REQUEST: case ACPI_NOTIFY_EJECT_REQUEST:
/* request device eject */ /* request device eject */
dbg("%s: Device eject notify on %s", __FUNCTION__, objname); dbg("%s: Device eject notify on %s\n", __FUNCTION__, objname);
acpiphp_disable_slot(func->slot); acpiphp_disable_slot(func->slot);
break; break;
default: default:
warn("notify_handler: unknown event type 0x%x for %s", type, objname); warn("notify_handler: unknown event type 0x%x for %s\n", type, objname);
break; break;
} }
} }
...@@ -1179,7 +1174,7 @@ int acpiphp_glue_init (void) ...@@ -1179,7 +1174,7 @@ int acpiphp_glue_init (void)
NULL, NULL); NULL, NULL);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
err("%s: acpi_walk_namespace() failed", __FUNCTION__); err("%s: acpi_walk_namespace() failed\n", __FUNCTION__);
return -1; return -1;
} }
...@@ -1200,12 +1195,12 @@ void acpiphp_glue_exit (void) ...@@ -1200,12 +1195,12 @@ void acpiphp_glue_exit (void)
struct acpiphp_func *func; struct acpiphp_func *func;
acpi_status status; acpi_status status;
list_for_each_safe(l1, n1, &bridge_list) { list_for_each_safe (l1, n1, &bridge_list) {
bridge = (struct acpiphp_bridge *)l1; bridge = (struct acpiphp_bridge *)l1;
slot = bridge->slots; slot = bridge->slots;
while (slot) { while (slot) {
next = slot->next; next = slot->next;
list_for_each_safe(l2, n2, &slot->funcs) { list_for_each_safe (l2, n2, &slot->funcs) {
func = list_entry(l2, struct acpiphp_func, sibling); func = list_entry(l2, struct acpiphp_func, sibling);
acpiphp_free_resource(&func->io_head); acpiphp_free_resource(&func->io_head);
acpiphp_free_resource(&func->mem_head); acpiphp_free_resource(&func->mem_head);
...@@ -1215,7 +1210,7 @@ void acpiphp_glue_exit (void) ...@@ -1215,7 +1210,7 @@ void acpiphp_glue_exit (void)
ACPI_SYSTEM_NOTIFY, ACPI_SYSTEM_NOTIFY,
handle_hotplug_event_func); handle_hotplug_event_func);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
err("failed to remove notify handler"); err("failed to remove notify handler\n");
kfree(func); kfree(func);
} }
kfree(slot); kfree(slot);
...@@ -1224,7 +1219,7 @@ void acpiphp_glue_exit (void) ...@@ -1224,7 +1219,7 @@ void acpiphp_glue_exit (void)
status = acpi_remove_notify_handler(bridge->handle, ACPI_SYSTEM_NOTIFY, status = acpi_remove_notify_handler(bridge->handle, ACPI_SYSTEM_NOTIFY,
handle_hotplug_event_bridge); handle_hotplug_event_bridge);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
err("failed to remove notify handler"); err("failed to remove notify handler\n");
acpiphp_free_resource(&bridge->io_head); acpiphp_free_resource(&bridge->io_head);
acpiphp_free_resource(&bridge->mem_head); acpiphp_free_resource(&bridge->mem_head);
...@@ -1247,13 +1242,13 @@ int acpiphp_get_num_slots (void) ...@@ -1247,13 +1242,13 @@ int acpiphp_get_num_slots (void)
num_slots = 0; num_slots = 0;
list_for_each(node, &bridge_list) { list_for_each (node, &bridge_list) {
bridge = (struct acpiphp_bridge *)node; bridge = (struct acpiphp_bridge *)node;
dbg("Bus%d %dslot(s)", bridge->bus, bridge->nr_slots); dbg("Bus%d %dslot(s)\n", bridge->bus, bridge->nr_slots);
num_slots += bridge->nr_slots; num_slots += bridge->nr_slots;
} }
dbg("Total %dslots", num_slots); dbg("Total %dslots\n", num_slots);
return num_slots; return num_slots;
} }
...@@ -1271,7 +1266,7 @@ int acpiphp_for_each_slot(acpiphp_callback fn, void *data) ...@@ -1271,7 +1266,7 @@ int acpiphp_for_each_slot(acpiphp_callback fn, void *data)
struct acpiphp_slot *slot; struct acpiphp_slot *slot;
int retval = 0; int retval = 0;
list_for_each(node, &bridge_list) { list_for_each (node, &bridge_list) {
bridge = (struct acpiphp_bridge *)node; bridge = (struct acpiphp_bridge *)node;
for (slot = bridge->slots; slot; slot = slot->next) { for (slot = bridge->slots; slot; slot = slot->next) {
retval = fn(slot, data); retval = fn(slot, data);
...@@ -1292,7 +1287,7 @@ struct acpiphp_slot *get_slot_from_id (int id) ...@@ -1292,7 +1287,7 @@ struct acpiphp_slot *get_slot_from_id (int id)
struct acpiphp_bridge *bridge; struct acpiphp_bridge *bridge;
struct acpiphp_slot *slot; struct acpiphp_slot *slot;
list_for_each(node, &bridge_list) { list_for_each (node, &bridge_list) {
bridge = (struct acpiphp_bridge *)node; bridge = (struct acpiphp_bridge *)node;
for (slot = bridge->slots; slot; slot = slot->next) for (slot = bridge->slots; slot; slot = slot->next)
if (slot->id == id) if (slot->id == id)
...@@ -1300,7 +1295,7 @@ struct acpiphp_slot *get_slot_from_id (int id) ...@@ -1300,7 +1295,7 @@ struct acpiphp_slot *get_slot_from_id (int id)
} }
/* should never happen! */ /* should never happen! */
err("%s: no object for id %d",__FUNCTION__, id); err("%s: no object for id %d\n",__FUNCTION__, id);
return 0; return 0;
} }
...@@ -1352,7 +1347,7 @@ int acpiphp_disable_slot (struct acpiphp_slot *slot) ...@@ -1352,7 +1347,7 @@ int acpiphp_disable_slot (struct acpiphp_slot *slot)
acpiphp_resource_sort_and_combine(&slot->bridge->mem_head); acpiphp_resource_sort_and_combine(&slot->bridge->mem_head);
acpiphp_resource_sort_and_combine(&slot->bridge->p_mem_head); acpiphp_resource_sort_and_combine(&slot->bridge->p_mem_head);
acpiphp_resource_sort_and_combine(&slot->bridge->bus_head); acpiphp_resource_sort_and_combine(&slot->bridge->bus_head);
dbg("Available resources:"); dbg("Available resources:\n");
acpiphp_dump_resource(slot->bridge); acpiphp_dump_resource(slot->bridge);
err_exit: err_exit:
...@@ -1380,7 +1375,7 @@ int acpiphp_check_bridge (struct acpiphp_bridge *bridge) ...@@ -1380,7 +1375,7 @@ int acpiphp_check_bridge (struct acpiphp_bridge *bridge)
if (sta != ACPI_STA_ALL) { if (sta != ACPI_STA_ALL) {
retval = acpiphp_disable_slot(slot); retval = acpiphp_disable_slot(slot);
if (retval) { if (retval) {
err("Error occured in enabling"); err("Error occured in enabling\n");
up(&slot->crit_sect); up(&slot->crit_sect);
goto err_exit; goto err_exit;
} }
...@@ -1391,7 +1386,7 @@ int acpiphp_check_bridge (struct acpiphp_bridge *bridge) ...@@ -1391,7 +1386,7 @@ int acpiphp_check_bridge (struct acpiphp_bridge *bridge)
if (sta == ACPI_STA_ALL) { if (sta == ACPI_STA_ALL) {
retval = acpiphp_enable_slot(slot); retval = acpiphp_enable_slot(slot);
if (retval) { if (retval) {
err("Error occured in enabling"); err("Error occured in enabling\n");
up(&slot->crit_sect); up(&slot->crit_sect);
goto err_exit; goto err_exit;
} }
...@@ -1400,7 +1395,7 @@ int acpiphp_check_bridge (struct acpiphp_bridge *bridge) ...@@ -1400,7 +1395,7 @@ int acpiphp_check_bridge (struct acpiphp_bridge *bridge)
} }
} }
dbg("%s: %d enabled, %d disabled", __FUNCTION__, enabled, disabled); dbg("%s: %d enabled, %d disabled\n", __FUNCTION__, enabled, disabled);
err_exit: err_exit:
return retval; return retval;
......
...@@ -77,7 +77,7 @@ static int init_config_space (struct acpiphp_func *func) ...@@ -77,7 +77,7 @@ static int init_config_space (struct acpiphp_func *func)
if (!bar) /* This BAR is not implemented */ if (!bar) /* This BAR is not implemented */
continue; 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) { if (bar & PCI_BASE_ADDRESS_SPACE_IO) {
/* This is IO */ /* This is IO */
...@@ -85,7 +85,7 @@ static int init_config_space (struct acpiphp_func *func) ...@@ -85,7 +85,7 @@ static int init_config_space (struct acpiphp_func *func)
len = bar & 0xFFFFFFFC; len = bar & 0xFFFFFFFC;
len = ~len + 1; 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); spin_lock(&bridge->res_lock);
res = acpiphp_get_io_resource(&bridge->io_head, len); res = acpiphp_get_io_resource(&bridge->io_head, len);
...@@ -110,7 +110,7 @@ static int init_config_space (struct acpiphp_func *func) ...@@ -110,7 +110,7 @@ static int init_config_space (struct acpiphp_func *func)
len = bar & 0xFFFFFFF0; len = bar & 0xFFFFFFF0;
len = ~len + 1; 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); spin_lock(&bridge->res_lock);
res = acpiphp_get_resource(&bridge->p_mem_head, len); res = acpiphp_get_resource(&bridge->p_mem_head, len);
...@@ -127,7 +127,7 @@ static int init_config_space (struct acpiphp_func *func) ...@@ -127,7 +127,7 @@ static int init_config_space (struct acpiphp_func *func)
(u32)res->base); (u32)res->base);
if (bar & PCI_BASE_ADDRESS_MEM_TYPE_64) { /* takes up another dword */ 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; count += 1;
pci_bus_write_config_dword(pbus, devfn, pci_bus_write_config_dword(pbus, devfn,
address[count], address[count],
...@@ -143,7 +143,7 @@ static int init_config_space (struct acpiphp_func *func) ...@@ -143,7 +143,7 @@ static int init_config_space (struct acpiphp_func *func)
len = bar & 0xFFFFFFF0; len = bar & 0xFFFFFFF0;
len = ~len + 1; 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); spin_lock(&bridge->res_lock);
res = acpiphp_get_resource(&bridge->mem_head, len); res = acpiphp_get_resource(&bridge->mem_head, len);
...@@ -161,7 +161,7 @@ static int init_config_space (struct acpiphp_func *func) ...@@ -161,7 +161,7 @@ static int init_config_space (struct acpiphp_func *func)
if (bar & PCI_BASE_ADDRESS_MEM_TYPE_64) { if (bar & PCI_BASE_ADDRESS_MEM_TYPE_64) {
/* takes up another dword */ /* 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; count += 1;
pci_bus_write_config_dword(pbus, devfn, pci_bus_write_config_dword(pbus, devfn,
address[count], address[count],
...@@ -212,16 +212,16 @@ static int configure_pci_dev (struct pci_dev_wrapped *wrapped_dev, struct pci_bu ...@@ -212,16 +212,16 @@ static int configure_pci_dev (struct pci_dev_wrapped *wrapped_dev, struct pci_bu
//pci_proc_attach_device(dev); //pci_proc_attach_device(dev);
//pci_announce_device_to_drivers(dev); //pci_announce_device_to_drivers(dev);
info("Device %s configured", dev->slot_name); info("Device %s configured\n", dev->slot_name);
return 0; 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 -- otherwise, check the device's regions to see if any
* driver has claimed them * driver has claimed them
*/ */
...@@ -263,13 +263,13 @@ static int unconfigure_pci_dev_driver (struct pci_dev_wrapped *wrapped_dev, stru ...@@ -263,13 +263,13 @@ static int unconfigure_pci_dev_driver (struct pci_dev_wrapped *wrapped_dev, stru
{ {
struct pci_dev *dev = wrapped_dev->dev; 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 */ /* Now, remove the Linux Driver Representation */
if (dev->driver) { if (dev->driver) {
if (dev->driver->remove) { if (dev->driver->remove) {
dev->driver->remove(dev); dev->driver->remove(dev);
dbg("driver was properly removed"); dbg("driver was properly removed\n");
} }
dev->driver = NULL; dev->driver = NULL;
} }
...@@ -286,7 +286,7 @@ static int unconfigure_pci_dev (struct pci_dev_wrapped *wrapped_dev, struct pci_ ...@@ -286,7 +286,7 @@ static int unconfigure_pci_dev (struct pci_dev_wrapped *wrapped_dev, struct pci_
/* Now, remove the Linux Representation */ /* Now, remove the Linux Representation */
if (dev) { if (dev) {
if (pci_hp_remove_device(dev) == 0) { 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 */ kfree(dev); /* Now, remove */
} else { } else {
return -1; /* problems while freeing, abort visitation */ return -1; /* problems while freeing, abort visitation */
...@@ -338,7 +338,7 @@ static int detect_used_resource (struct acpiphp_bridge *bridge, struct pci_dev * ...@@ -338,7 +338,7 @@ static int detect_used_resource (struct acpiphp_bridge *bridge, struct pci_dev *
int count; int count;
struct pci_resource *res; 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 */ 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);
...@@ -355,7 +355,7 @@ static int detect_used_resource (struct acpiphp_bridge *bridge, struct pci_dev * ...@@ -355,7 +355,7 @@ static int detect_used_resource (struct acpiphp_bridge *bridge, struct pci_dev *
len &= 0xFFFFFFFC; len &= 0xFFFFFFFC;
len = ~len + 1; 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); spin_lock(&bridge->res_lock);
res = acpiphp_get_resource_with_base(&bridge->io_head, base, len); 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 * ...@@ -372,10 +372,10 @@ static int detect_used_resource (struct acpiphp_bridge *bridge, struct pci_dev *
len = ~len + 1; len = ~len + 1;
if (len & PCI_BASE_ADDRESS_MEM_TYPE_64) { /* takes up another dword */ if (len & PCI_BASE_ADDRESS_MEM_TYPE_64) { /* takes up another dword */
dbg ("prefetch mem 64"); dbg("prefetch mem 64\n");
count += 1; 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); spin_lock(&bridge->res_lock);
res = acpiphp_get_resource_with_base(&bridge->p_mem_head, base, len); res = acpiphp_get_resource_with_base(&bridge->p_mem_head, base, len);
spin_unlock(&bridge->res_lock); spin_unlock(&bridge->res_lock);
...@@ -389,10 +389,10 @@ static int detect_used_resource (struct acpiphp_bridge *bridge, struct pci_dev * ...@@ -389,10 +389,10 @@ static int detect_used_resource (struct acpiphp_bridge *bridge, struct pci_dev *
if (len & PCI_BASE_ADDRESS_MEM_TYPE_64) { if (len & PCI_BASE_ADDRESS_MEM_TYPE_64) {
/* takes up another dword */ /* takes up another dword */
dbg ("mem 64"); dbg("mem 64\n");
count += 1; 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); spin_lock(&bridge->res_lock);
res = acpiphp_get_resource_with_base(&bridge->mem_head, base, len); res = acpiphp_get_resource_with_base(&bridge->mem_head, base, len);
spin_unlock(&bridge->res_lock); spin_unlock(&bridge->res_lock);
...@@ -414,7 +414,7 @@ static void detect_used_resource_bus(struct acpiphp_bridge *bridge, struct pci_b ...@@ -414,7 +414,7 @@ static void detect_used_resource_bus(struct acpiphp_bridge *bridge, struct pci_b
struct list_head *l; struct list_head *l;
struct pci_dev *dev; struct pci_dev *dev;
list_for_each(l, &bus->devices) { list_for_each (l, &bus->devices) {
dev = pci_dev_b(l); dev = pci_dev_b(l);
detect_used_resource(bridge, dev); detect_used_resource(bridge, dev);
/* XXX recursive call */ /* XXX recursive call */
...@@ -463,16 +463,16 @@ int acpiphp_init_func_resource (struct acpiphp_func *func) ...@@ -463,16 +463,16 @@ int acpiphp_init_func_resource (struct acpiphp_func *func)
struct pci_dev *dev; struct pci_dev *dev;
dev = func->pci_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 */ 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 */ if (!bar) /* This BAR is not implemented */
continue; continue;
pci_write_config_dword (dev, address[count], 0xFFFFFFFF); pci_write_config_dword(dev, address[count], 0xFFFFFFFF);
pci_read_config_dword (dev, address[count], &len); pci_read_config_dword(dev, address[count], &len);
if (len & PCI_BASE_ADDRESS_SPACE_IO) { if (len & PCI_BASE_ADDRESS_SPACE_IO) {
/* This is IO */ /* This is IO */
...@@ -480,7 +480,7 @@ int acpiphp_init_func_resource (struct acpiphp_func *func) ...@@ -480,7 +480,7 @@ int acpiphp_init_func_resource (struct acpiphp_func *func)
len &= 0xFFFFFFFC; len &= 0xFFFFFFFC;
len = ~len + 1; 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); res = acpiphp_make_resource(base, len);
if (!res) if (!res)
...@@ -499,10 +499,10 @@ int acpiphp_init_func_resource (struct acpiphp_func *func) ...@@ -499,10 +499,10 @@ int acpiphp_init_func_resource (struct acpiphp_func *func)
len = ~len + 1; len = ~len + 1;
if (len & PCI_BASE_ADDRESS_MEM_TYPE_64) { /* takes up another dword */ if (len & PCI_BASE_ADDRESS_MEM_TYPE_64) { /* takes up another dword */
dbg ("prefetch mem 64"); dbg("prefetch mem 64\n");
count += 1; 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); res = acpiphp_make_resource(base, len);
if (!res) if (!res)
goto no_memory; goto no_memory;
...@@ -518,10 +518,10 @@ int acpiphp_init_func_resource (struct acpiphp_func *func) ...@@ -518,10 +518,10 @@ int acpiphp_init_func_resource (struct acpiphp_func *func)
if (len & PCI_BASE_ADDRESS_MEM_TYPE_64) { if (len & PCI_BASE_ADDRESS_MEM_TYPE_64) {
/* takes up another dword */ /* takes up another dword */
dbg ("mem 64"); dbg("mem 64\n");
count += 1; 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); res = acpiphp_make_resource(base, len);
if (!res) if (!res)
goto no_memory; goto no_memory;
...@@ -532,7 +532,7 @@ int acpiphp_init_func_resource (struct acpiphp_func *func) ...@@ -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 #if 1
acpiphp_dump_func_resource(func); acpiphp_dump_func_resource(func);
...@@ -541,7 +541,7 @@ int acpiphp_init_func_resource (struct acpiphp_func *func) ...@@ -541,7 +541,7 @@ int acpiphp_init_func_resource (struct acpiphp_func *func)
return 0; return 0;
no_memory: no_memory:
err("out of memory"); err("out of memory\n");
acpiphp_free_resource(&func->io_head); acpiphp_free_resource(&func->io_head);
acpiphp_free_resource(&func->mem_head); acpiphp_free_resource(&func->mem_head);
acpiphp_free_resource(&func->p_mem_head); acpiphp_free_resource(&func->p_mem_head);
...@@ -574,7 +574,7 @@ int acpiphp_configure_slot (struct acpiphp_slot *slot) ...@@ -574,7 +574,7 @@ int acpiphp_configure_slot (struct acpiphp_slot *slot)
if (hdr & 0x80) if (hdr & 0x80)
is_multi = 1; is_multi = 1;
list_for_each(l, &slot->funcs) { list_for_each (l, &slot->funcs) {
func = list_entry(l, struct acpiphp_func, sibling); func = list_entry(l, struct acpiphp_func, sibling);
if (is_multi || func->function == 0) { if (is_multi || func->function == 0) {
pci_bus_read_config_dword(slot->bridge->pci_bus, pci_bus_read_config_dword(slot->bridge->pci_bus,
...@@ -583,7 +583,6 @@ int acpiphp_configure_slot (struct acpiphp_slot *slot) ...@@ -583,7 +583,6 @@ int acpiphp_configure_slot (struct acpiphp_slot *slot)
PCI_VENDOR_ID, &dvid); PCI_VENDOR_ID, &dvid);
if (dvid != 0xffffffff) { if (dvid != 0xffffffff) {
retval = init_config_space(func); retval = init_config_space(func);
if (retval) if (retval)
break; break;
} }
......
...@@ -273,7 +273,7 @@ struct pci_resource *acpiphp_get_max_resource (struct pci_resource **head, u32 s ...@@ -273,7 +273,7 @@ struct pci_resource *acpiphp_get_max_resource (struct pci_resource **head, u32 s
for (max = *head;max; max = max->next) { 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. */ instead we'll continue to the next. */
if (max->length < size) if (max->length < size)
continue; continue;
...@@ -370,13 +370,13 @@ struct pci_resource *acpiphp_get_resource (struct pci_resource **head, u32 size) ...@@ -370,13 +370,13 @@ struct pci_resource *acpiphp_get_resource (struct pci_resource **head, u32 size)
return NULL; return NULL;
for (node = *head; node; node = node->next) { 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); __FUNCTION__, size, node, (u32)node->base, node->length);
if (node->length < size) if (node->length < size)
continue; continue;
if (node->base & (size - 1)) { if (node->base & (size - 1)) {
dbg("%s: not aligned", __FUNCTION__); dbg("%s: not aligned\n", __FUNCTION__);
/* this one isn't base aligned properly /* this one isn't base aligned properly
so we'll make a new entry and split it up */ so we'll make a new entry and split it up */
temp_qword = (node->base | (size-1)) + 1; temp_qword = (node->base | (size-1)) + 1;
...@@ -400,7 +400,7 @@ struct pci_resource *acpiphp_get_resource (struct pci_resource **head, u32 size) ...@@ -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 */ /* Don't need to check if too small since we already did */
if (node->length > size) { if (node->length > size) {
dbg("%s: too big", __FUNCTION__); dbg("%s: too big\n", __FUNCTION__);
/* this one is longer than we need /* this one is longer than we need
so we'll make a new entry and split it up */ so we'll make a new entry and split it up */
split_node = acpiphp_make_resource(node->base + size, node->length - size); 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) ...@@ -415,7 +415,7 @@ struct pci_resource *acpiphp_get_resource (struct pci_resource **head, u32 size)
node->next = split_node; node->next = split_node;
} /* End of too big on top end */ } /* 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 /* If we got here, then it is the right size
Now take it out of the list */ Now take it out of the list */
if (*head == node) { if (*head == node) {
...@@ -437,7 +437,7 @@ struct pci_resource *acpiphp_get_resource (struct pci_resource **head, u32 size) ...@@ -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 * 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. * 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. * 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, ...@@ -458,7 +458,7 @@ struct pci_resource *acpiphp_get_resource_with_base (struct pci_resource **head,
return NULL; return NULL;
for (node = *head; node; node = node->next) { 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); (u32)base, size, node, (u32)node->base, node->length);
if (node->base > base) if (node->base > base)
continue; continue;
...@@ -467,7 +467,7 @@ struct pci_resource *acpiphp_get_resource_with_base (struct pci_resource **head, ...@@ -467,7 +467,7 @@ struct pci_resource *acpiphp_get_resource_with_base (struct pci_resource **head,
continue; continue;
if (node->base < base) { if (node->base < base) {
dbg(": split 1"); dbg(": split 1\n");
/* this one isn't base aligned properly /* this one isn't base aligned properly
so we'll make a new entry and split it up */ so we'll make a new entry and split it up */
temp_qword = base; temp_qword = base;
...@@ -489,12 +489,12 @@ struct pci_resource *acpiphp_get_resource_with_base (struct pci_resource **head, ...@@ -489,12 +489,12 @@ struct pci_resource *acpiphp_get_resource_with_base (struct pci_resource **head,
node->next = split_node; 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); (u32)base, size, node, (u32)node->base, node->length);
/* Don't need to check if too small since we already did */ /* Don't need to check if too small since we already did */
if (node->length > size) { if (node->length > size) {
dbg(": split 2"); dbg(": split 2\n");
/* this one is longer than we need /* this one is longer than we need
so we'll make a new entry and split it up */ so we'll make a new entry and split it up */
split_node = acpiphp_make_resource(node->base + size, node->length - size); 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, ...@@ -509,7 +509,7 @@ struct pci_resource *acpiphp_get_resource_with_base (struct pci_resource **head,
node->next = split_node; node->next = split_node;
} /* End of too big on top end */ } /* End of too big on top end */
dbg(": got one!!!"); dbg(": got one!!!\n");
/* If we got here, then it is the right size /* If we got here, then it is the right size
Now take it out of the list */ Now take it out of the list */
if (*head == node) { if (*head == node) {
...@@ -547,13 +547,13 @@ int acpiphp_resource_sort_and_combine (struct pci_resource **head) ...@@ -547,13 +547,13 @@ int acpiphp_resource_sort_and_combine (struct pci_resource **head)
if (!(*head)) if (!(*head))
return 1; return 1;
dbg("*head->next = %p",(*head)->next); dbg("*head->next = %p\n",(*head)->next);
if (!(*head)->next) if (!(*head)->next)
return 0; /* only one item on the list, already sorted! */ return 0; /* only one item on the list, already sorted! */
dbg("*head->base = 0x%x",(u32)(*head)->base); dbg("*head->base = 0x%x\n",(u32)(*head)->base);
dbg("*head->next->base = 0x%x", (u32)(*head)->next->base); dbg("*head->next->base = 0x%x\n", (u32)(*head)->next->base);
while (out_of_order) { while (out_of_order) {
out_of_order = 0; out_of_order = 0;
...@@ -587,7 +587,7 @@ int acpiphp_resource_sort_and_combine (struct pci_resource **head) ...@@ -587,7 +587,7 @@ int acpiphp_resource_sort_and_combine (struct pci_resource **head)
while (node1 && node1->next) { while (node1 && node1->next) {
if ((node1->base + node1->length) == node1->next->base) { if ((node1->base + node1->length) == node1->next->base) {
/* Combine */ /* Combine */
dbg("8.."); dbg("8..\n");
node1->length += node1->next->length; node1->length += node1->next->length;
node2 = node1->next; node2 = node1->next;
node1->next = node1->next->next; node1->next = node1->next->next;
...@@ -668,7 +668,7 @@ static void dump_resource(struct pci_resource *head) ...@@ -668,7 +668,7 @@ static void dump_resource(struct pci_resource *head)
cnt = 0; cnt = 0;
while (p) { while (p) {
dbg("[%02d] %08x - %08x", dbg("[%02d] %08x - %08x\n",
cnt++, (u32)p->base, (u32)p->base + p->length - 1); cnt++, (u32)p->base, (u32)p->base + p->length - 1);
p = p->next; p = p->next;
} }
...@@ -676,24 +676,24 @@ static void dump_resource(struct pci_resource *head) ...@@ -676,24 +676,24 @@ static void dump_resource(struct pci_resource *head)
void acpiphp_dump_resource(struct acpiphp_bridge *bridge) void acpiphp_dump_resource(struct acpiphp_bridge *bridge)
{ {
dbg("I/O resource:"); dbg("I/O resource:\n");
dump_resource(bridge->io_head); dump_resource(bridge->io_head);
dbg("MEM resource:"); dbg("MEM resource:\n");
dump_resource(bridge->mem_head); dump_resource(bridge->mem_head);
dbg("PMEM resource:"); dbg("PMEM resource:\n");
dump_resource(bridge->p_mem_head); dump_resource(bridge->p_mem_head);
dbg("BUS resource:"); dbg("BUS resource:\n");
dump_resource(bridge->bus_head); dump_resource(bridge->bus_head);
} }
void acpiphp_dump_func_resource(struct acpiphp_func *func) void acpiphp_dump_func_resource(struct acpiphp_func *func)
{ {
dbg("I/O resource:"); dbg("I/O resource:\n");
dump_resource(func->io_head); dump_resource(func->io_head);
dbg("MEM resource:"); dbg("MEM resource:\n");
dump_resource(func->mem_head); dump_resource(func->mem_head);
dbg("PMEM resource:"); dbg("PMEM resource:\n");
dump_resource(func->p_mem_head); dump_resource(func->p_mem_head);
dbg("BUS resource:"); dbg("BUS resource:\n");
dump_resource(func->bus_head); 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