Commit 85f9b52e authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://kernel.bkbits.net/gregkh/linux/pci-2.6

into ppc970.osdl.org:/home/torvalds/v2.6/linux
parents 809d726d 419c049e
...@@ -1284,8 +1284,8 @@ P: 1024D/77D4FC9B F5C5 1C20 1DFC DEC3 3107 54A4 2332 ADFC 77D4 FC9B ...@@ -1284,8 +1284,8 @@ P: 1024D/77D4FC9B F5C5 1C20 1DFC DEC3 3107 54A4 2332 ADFC 77D4 FC9B
D: National Language Support D: National Language Support
D: Linux Internationalization Project D: Linux Internationalization Project
D: German Localization for Linux and GNU software D: German Localization for Linux and GNU software
S: Helenenstrasse 18 S: Kriemhildring 12a
S: 65183 Wiesbaden S: 65795 Hattersheim am Main
S: Germany S: Germany
N: Christoph Hellwig N: Christoph Hellwig
......
...@@ -897,7 +897,7 @@ static int __init pcibios_irq_init(void) ...@@ -897,7 +897,7 @@ static int __init pcibios_irq_init(void)
{ {
DBG("PCI: IRQ init\n"); DBG("PCI: IRQ init\n");
if (pcibios_enable_irq) if (pcibios_enable_irq || raw_pci_ops == NULL)
return 0; return 0;
pirq_table = pirq_find_routing_table(); pirq_table = pirq_find_routing_table();
......
...@@ -47,7 +47,6 @@ ...@@ -47,7 +47,6 @@
#define info(format, arg...) printk(KERN_INFO "%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 warn(format, arg...) printk(KERN_WARNING "%s: " format, MY_NAME , ## arg)
#define SLOT_MAGIC 0x67267322
/* name size which is used for entries in pcihpfs */ /* name size which is used for entries in pcihpfs */
#define SLOT_NAME_SIZE KOBJ_NAME_LEN /* {_SUN} */ #define SLOT_NAME_SIZE KOBJ_NAME_LEN /* {_SUN} */
...@@ -59,7 +58,6 @@ struct pci_resource; ...@@ -59,7 +58,6 @@ struct pci_resource;
* struct slot - slot information for each *physical* slot * struct slot - slot information for each *physical* slot
*/ */
struct slot { struct slot {
u32 magic;
u8 number; u8 number;
struct hotplug_slot *hotplug_slot; struct hotplug_slot *hotplug_slot;
struct list_head slot_list; struct list_head slot_list;
...@@ -220,9 +218,7 @@ extern void acpiphp_glue_exit (void); ...@@ -220,9 +218,7 @@ extern void acpiphp_glue_exit (void);
extern int acpiphp_get_num_slots (void); extern int acpiphp_get_num_slots (void);
extern struct acpiphp_slot *get_slot_from_id (int id); extern struct acpiphp_slot *get_slot_from_id (int id);
typedef int (*acpiphp_callback)(struct acpiphp_slot *slot, void *data); typedef int (*acpiphp_callback)(struct acpiphp_slot *slot, void *data);
extern int acpiphp_for_each_slot (acpiphp_callback fn, void *data);
extern int acpiphp_check_bridge (struct acpiphp_bridge *bridge);
extern int acpiphp_enable_slot (struct acpiphp_slot *slot); extern int acpiphp_enable_slot (struct acpiphp_slot *slot);
extern int acpiphp_disable_slot (struct acpiphp_slot *slot); extern int acpiphp_disable_slot (struct acpiphp_slot *slot);
extern u8 acpiphp_get_power_status (struct acpiphp_slot *slot); extern u8 acpiphp_get_power_status (struct acpiphp_slot *slot);
...@@ -241,7 +237,6 @@ extern int acpiphp_init_func_resource (struct acpiphp_func *func); ...@@ -241,7 +237,6 @@ extern int acpiphp_init_func_resource (struct acpiphp_func *func);
/* acpiphp_res.c */ /* acpiphp_res.c */
extern struct pci_resource *acpiphp_get_io_resource (struct pci_resource **head, u32 size); extern struct pci_resource *acpiphp_get_io_resource (struct pci_resource **head, u32 size);
extern struct pci_resource *acpiphp_get_max_resource (struct pci_resource **head, u32 size);
extern struct pci_resource *acpiphp_get_resource (struct pci_resource **head, u32 size); extern struct pci_resource *acpiphp_get_resource (struct pci_resource **head, u32 size);
extern struct pci_resource *acpiphp_get_resource_with_base (struct pci_resource **head, u64 base, u32 size); extern struct pci_resource *acpiphp_get_resource_with_base (struct pci_resource **head, u64 base, u32 size);
extern int acpiphp_resource_sort_and_combine (struct pci_resource **head); extern int acpiphp_resource_sort_and_combine (struct pci_resource **head);
......
This diff is collapsed.
...@@ -66,7 +66,7 @@ static void handle_hotplug_event_func (acpi_handle, u32, void *); ...@@ -66,7 +66,7 @@ static void handle_hotplug_event_func (acpi_handle, u32, void *);
* 4. .. * 4. ..
* *
*/ */
static int is_ejectable (acpi_handle handle) static int is_ejectable(acpi_handle handle)
{ {
acpi_status status; acpi_status status;
acpi_handle tmp; acpi_handle tmp;
...@@ -326,10 +326,10 @@ static void decode_hpp(struct acpiphp_bridge *bridge) ...@@ -326,10 +326,10 @@ static void decode_hpp(struct acpiphp_bridge *bridge)
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)\n", 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,
bridge->hpp.enable_PERR); bridge->hpp.enable_PERR);
bridge->flags |= BRIDGE_HAS_HPP; bridge->flags |= BRIDGE_HAS_HPP;
...@@ -919,6 +919,48 @@ static unsigned int get_slot_status(struct acpiphp_slot *slot) ...@@ -919,6 +919,48 @@ static unsigned int get_slot_status(struct acpiphp_slot *slot)
return (unsigned int)sta; return (unsigned int)sta;
} }
/**
* acpiphp_check_bridge - re-enumerate devices
*
* Iterate over all slots under this bridge and make sure that if a
* card is present they are enabled, and if not they are disabled.
*/
static int acpiphp_check_bridge(struct acpiphp_bridge *bridge)
{
struct acpiphp_slot *slot;
int retval = 0;
int enabled, disabled;
enabled = disabled = 0;
for (slot = bridge->slots; slot; slot = slot->next) {
unsigned int status = get_slot_status(slot);
if (slot->flags & SLOT_ENABLED) {
if (status == ACPI_STA_ALL)
continue;
retval = acpiphp_disable_slot(slot);
if (retval) {
err("Error occurred in disabling\n");
goto err_exit;
}
disabled++;
} else {
if (status != ACPI_STA_ALL)
continue;
retval = acpiphp_enable_slot(slot);
if (retval) {
err("Error occurred in enabling\n");
goto err_exit;
}
enabled++;
}
}
dbg("%s: %d enabled, %d disabled\n", __FUNCTION__, enabled, disabled);
err_exit:
return retval;
}
/* /*
* ACPI event handlers * ACPI event handlers
...@@ -1113,6 +1155,8 @@ void __exit acpiphp_glue_exit(void) ...@@ -1113,6 +1155,8 @@ void __exit acpiphp_glue_exit(void)
kfree(bridge); kfree(bridge);
} }
acpi_pci_unregister_driver(&acpi_pci_hp_driver);
} }
...@@ -1138,13 +1182,14 @@ int __init acpiphp_get_num_slots(void) ...@@ -1138,13 +1182,14 @@ int __init acpiphp_get_num_slots(void)
} }
#if 0
/** /**
* acpiphp_for_each_slot - call function for each slot * acpiphp_for_each_slot - call function for each slot
* @fn: callback function * @fn: callback function
* @data: context to be passed to callback function * @data: context to be passed to callback function
* *
*/ */
int acpiphp_for_each_slot(acpiphp_callback fn, void *data) static int acpiphp_for_each_slot(acpiphp_callback fn, void *data)
{ {
struct list_head *node; struct list_head *node;
struct acpiphp_bridge *bridge; struct acpiphp_bridge *bridge;
...@@ -1163,7 +1208,7 @@ int acpiphp_for_each_slot(acpiphp_callback fn, void *data) ...@@ -1163,7 +1208,7 @@ int acpiphp_for_each_slot(acpiphp_callback fn, void *data)
err_exit: err_exit:
return retval; return retval;
} }
#endif
/* search matching slot from id */ /* search matching slot from id */
struct acpiphp_slot *get_slot_from_id(int id) struct acpiphp_slot *get_slot_from_id(int id)
...@@ -1180,7 +1225,8 @@ struct acpiphp_slot *get_slot_from_id(int id) ...@@ -1180,7 +1225,8 @@ struct acpiphp_slot *get_slot_from_id(int id)
} }
/* should never happen! */ /* should never happen! */
err("%s: no object for id %d\n",__FUNCTION__, id); err("%s: no object for id %d\n", __FUNCTION__, id);
WARN_ON(1);
return 0; return 0;
} }
...@@ -1241,50 +1287,6 @@ int acpiphp_disable_slot(struct acpiphp_slot *slot) ...@@ -1241,50 +1287,6 @@ int acpiphp_disable_slot(struct acpiphp_slot *slot)
} }
/**
* acpiphp_check_bridge - re-enumerate devices
*
* Iterate over all slots under this bridge and make sure that if a
* card is present they are enabled, and if not they are disabled.
*/
int acpiphp_check_bridge(struct acpiphp_bridge *bridge)
{
struct acpiphp_slot *slot;
int retval = 0;
int enabled, disabled;
enabled = disabled = 0;
for (slot = bridge->slots; slot; slot = slot->next) {
unsigned int status = get_slot_status(slot);
if (slot->flags & SLOT_ENABLED) {
if (status == ACPI_STA_ALL)
continue;
retval = acpiphp_disable_slot(slot);
if (retval) {
err("Error occurred in disabling\n");
goto err_exit;
}
disabled++;
} else {
if (status != ACPI_STA_ALL)
continue;
retval = acpiphp_enable_slot(slot);
if (retval) {
err("Error occurred in enabling\n");
goto err_exit;
}
enabled++;
}
}
dbg("%s: %d enabled, %d disabled\n", __FUNCTION__, enabled, disabled);
err_exit:
return retval;
}
/* /*
* slot enabled: 1 * slot enabled: 1
* slot disabled: 0 * slot disabled: 0
......
...@@ -105,7 +105,7 @@ static int sort_by_size(struct pci_resource **head) ...@@ -105,7 +105,7 @@ static int sort_by_size(struct pci_resource **head)
return 0; return 0;
} }
#if 0
/* /*
* sort_by_max_size - sort nodes by their length, largest first * sort_by_max_size - sort nodes by their length, largest first
*/ */
...@@ -151,6 +151,7 @@ static int sort_by_max_size(struct pci_resource **head) ...@@ -151,6 +151,7 @@ static int sort_by_max_size(struct pci_resource **head)
return 0; return 0;
} }
#endif
/** /**
* get_io_resource - get resource for I/O ports * get_io_resource - get resource for I/O ports
...@@ -247,6 +248,7 @@ struct pci_resource *acpiphp_get_io_resource (struct pci_resource **head, u32 si ...@@ -247,6 +248,7 @@ struct pci_resource *acpiphp_get_io_resource (struct pci_resource **head, u32 si
} }
#if 0
/** /**
* get_max_resource - get the largest resource * get_max_resource - get the largest resource
* *
...@@ -254,7 +256,7 @@ struct pci_resource *acpiphp_get_io_resource (struct pci_resource **head, u32 si ...@@ -254,7 +256,7 @@ struct pci_resource *acpiphp_get_io_resource (struct pci_resource **head, u32 si
* list pointed to by head. It aligns the node on top and bottom * list pointed to by head. It aligns the node on top and bottom
* to "size" alignment before returning it. * to "size" alignment before returning it.
*/ */
struct pci_resource *acpiphp_get_max_resource (struct pci_resource **head, u32 size) static struct pci_resource *acpiphp_get_max_resource (struct pci_resource **head, u32 size)
{ {
struct pci_resource *max; struct pci_resource *max;
struct pci_resource *temp; struct pci_resource *temp;
...@@ -340,7 +342,7 @@ struct pci_resource *acpiphp_get_max_resource (struct pci_resource **head, u32 s ...@@ -340,7 +342,7 @@ struct pci_resource *acpiphp_get_max_resource (struct pci_resource **head, u32 s
/* If we get here, we couldn't find one */ /* If we get here, we couldn't find one */
return NULL; return NULL;
} }
#endif
/** /**
* get_resource - get resource (mem, pfmem) * get_resource - get resource (mem, pfmem)
......
...@@ -40,9 +40,7 @@ ...@@ -40,9 +40,7 @@
#define HS_CSR_EIM 0x0002 #define HS_CSR_EIM 0x0002
#define HS_CSR_DHA 0x0001 #define HS_CSR_DHA 0x0001
#define SLOT_MAGIC 0x67267322
struct slot { struct slot {
u32 magic;
u8 number; u8 number;
unsigned int devfn; unsigned int devfn;
struct pci_bus *bus; struct pci_bus *bus;
...@@ -86,7 +84,6 @@ extern u8 cpci_get_attention_status(struct slot *slot); ...@@ -86,7 +84,6 @@ extern u8 cpci_get_attention_status(struct slot *slot);
extern u8 cpci_get_latch_status(struct slot *slot); extern u8 cpci_get_latch_status(struct slot *slot);
extern u8 cpci_get_adapter_status(struct slot *slot); extern u8 cpci_get_adapter_status(struct slot *slot);
extern u16 cpci_get_hs_csr(struct slot * slot); extern u16 cpci_get_hs_csr(struct slot * slot);
extern u16 cpci_set_hs_csr(struct slot * slot, u16 hs_csr);
extern int cpci_set_attention_status(struct slot *slot, int status); extern int cpci_set_attention_status(struct slot *slot, int status);
extern int cpci_check_and_clear_ins(struct slot * slot); extern int cpci_check_and_clear_ins(struct slot * slot);
extern int cpci_check_ext(struct slot * slot); extern int cpci_check_ext(struct slot * slot);
......
...@@ -40,11 +40,7 @@ ...@@ -40,11 +40,7 @@
#define DRIVER_AUTHOR "Scott Murray <scottm@somanetworks.com>" #define DRIVER_AUTHOR "Scott Murray <scottm@somanetworks.com>"
#define DRIVER_DESC "CompactPCI Hot Plug Core" #define DRIVER_DESC "CompactPCI Hot Plug Core"
#if !defined(CONFIG_HOTPLUG_CPCI_MODULE)
#define MY_NAME "cpci_hotplug" #define MY_NAME "cpci_hotplug"
#else
#define MY_NAME THIS_MODULE->name
#endif
#define dbg(format, arg...) \ #define dbg(format, arg...) \
do { \ do { \
...@@ -71,63 +67,21 @@ static int disable_slot(struct hotplug_slot *slot); ...@@ -71,63 +67,21 @@ static int disable_slot(struct hotplug_slot *slot);
static int set_attention_status(struct hotplug_slot *slot, u8 value); static int set_attention_status(struct hotplug_slot *slot, u8 value);
static int get_power_status(struct hotplug_slot *slot, u8 * value); static int get_power_status(struct hotplug_slot *slot, u8 * value);
static int get_attention_status(struct hotplug_slot *slot, u8 * value); static int get_attention_status(struct hotplug_slot *slot, u8 * value);
static int get_latch_status(struct hotplug_slot *slot, u8 * value);
static int get_adapter_status(struct hotplug_slot *slot, u8 * value);
static struct hotplug_slot_ops cpci_hotplug_slot_ops = { static struct hotplug_slot_ops cpci_hotplug_slot_ops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.enable_slot = enable_slot, .enable_slot = enable_slot,
.disable_slot = disable_slot, .disable_slot = disable_slot,
.set_attention_status = set_attention_status, .set_attention_status = set_attention_status,
.hardware_test = NULL,
.get_power_status = get_power_status, .get_power_status = get_power_status,
.get_attention_status = get_attention_status, .get_attention_status = get_attention_status,
.get_latch_status = get_latch_status,
.get_adapter_status = get_adapter_status,
}; };
/* Inline functions to check the sanity of a pointer that is passed to us */
static inline int
slot_paranoia_check(struct slot *slot, const char *function)
{
if(!slot) {
dbg("%s - slot == NULL", function);
return -1;
}
if(slot->magic != SLOT_MAGIC) {
dbg("%s - bad magic number for slot", function);
return -1;
}
if(!slot->hotplug_slot) {
dbg("%s - slot->hotplug_slot == NULL!", function);
return -1;
}
return 0;
}
static inline struct slot *
get_slot(struct hotplug_slot *hotplug_slot, const char *function)
{
struct slot *slot;
if(!hotplug_slot) {
dbg("%s - hotplug_slot == NULL", function);
return NULL;
}
slot = (struct slot *) hotplug_slot->private;
if(slot_paranoia_check(slot, function))
return NULL;
return slot;
}
static int static int
update_latch_status(struct hotplug_slot *hotplug_slot, u8 value) update_latch_status(struct hotplug_slot *hotplug_slot, u8 value)
{ {
struct hotplug_slot_info info; struct hotplug_slot_info info;
if(!(hotplug_slot && hotplug_slot->info))
return -EINVAL;
memcpy(&info, hotplug_slot->info, sizeof(struct hotplug_slot_info)); memcpy(&info, hotplug_slot->info, sizeof(struct hotplug_slot_info));
info.latch_status = value; info.latch_status = value;
return pci_hp_change_slot_info(hotplug_slot, &info); return pci_hp_change_slot_info(hotplug_slot, &info);
...@@ -138,8 +92,6 @@ update_adapter_status(struct hotplug_slot *hotplug_slot, u8 value) ...@@ -138,8 +92,6 @@ update_adapter_status(struct hotplug_slot *hotplug_slot, u8 value)
{ {
struct hotplug_slot_info info; struct hotplug_slot_info info;
if(!(hotplug_slot && hotplug_slot->info))
return -EINVAL;
memcpy(&info, hotplug_slot->info, sizeof(struct hotplug_slot_info)); memcpy(&info, hotplug_slot->info, sizeof(struct hotplug_slot_info));
info.adapter_status = value; info.adapter_status = value;
return pci_hp_change_slot_info(hotplug_slot, &info); return pci_hp_change_slot_info(hotplug_slot, &info);
...@@ -148,12 +100,9 @@ update_adapter_status(struct hotplug_slot *hotplug_slot, u8 value) ...@@ -148,12 +100,9 @@ update_adapter_status(struct hotplug_slot *hotplug_slot, u8 value)
static int static int
enable_slot(struct hotplug_slot *hotplug_slot) enable_slot(struct hotplug_slot *hotplug_slot)
{ {
struct slot *slot = get_slot(hotplug_slot, __FUNCTION__); struct slot *slot = hotplug_slot->private;
int retval = 0; int retval = 0;
if(slot == NULL)
return -ENODEV;
dbg("%s - physical_slot = %s", __FUNCTION__, hotplug_slot->name); dbg("%s - physical_slot = %s", __FUNCTION__, hotplug_slot->name);
if(controller->ops->set_power) { if(controller->ops->set_power) {
...@@ -166,12 +115,9 @@ enable_slot(struct hotplug_slot *hotplug_slot) ...@@ -166,12 +115,9 @@ enable_slot(struct hotplug_slot *hotplug_slot)
static int static int
disable_slot(struct hotplug_slot *hotplug_slot) disable_slot(struct hotplug_slot *hotplug_slot)
{ {
struct slot *slot = get_slot(hotplug_slot, __FUNCTION__); struct slot *slot = hotplug_slot->private;
int retval = 0; int retval = 0;
if(slot == NULL)
return -ENODEV;
dbg("%s - physical_slot = %s", __FUNCTION__, hotplug_slot->name); dbg("%s - physical_slot = %s", __FUNCTION__, hotplug_slot->name);
/* Unconfigure device */ /* Unconfigure device */
...@@ -220,10 +166,8 @@ cpci_get_power_status(struct slot *slot) ...@@ -220,10 +166,8 @@ cpci_get_power_status(struct slot *slot)
static int static int
get_power_status(struct hotplug_slot *hotplug_slot, u8 * value) get_power_status(struct hotplug_slot *hotplug_slot, u8 * value)
{ {
struct slot *slot = get_slot(hotplug_slot, __FUNCTION__); struct slot *slot = hotplug_slot->private;
if(slot == NULL)
return -ENODEV;
*value = cpci_get_power_status(slot); *value = cpci_get_power_status(slot);
return 0; return 0;
} }
...@@ -231,10 +175,8 @@ get_power_status(struct hotplug_slot *hotplug_slot, u8 * value) ...@@ -231,10 +175,8 @@ get_power_status(struct hotplug_slot *hotplug_slot, u8 * value)
static int static int
get_attention_status(struct hotplug_slot *hotplug_slot, u8 * value) get_attention_status(struct hotplug_slot *hotplug_slot, u8 * value)
{ {
struct slot *slot = get_slot(hotplug_slot, __FUNCTION__); struct slot *slot = hotplug_slot->private;
if(slot == NULL)
return -ENODEV;
*value = cpci_get_attention_status(slot); *value = cpci_get_attention_status(slot);
return 0; return 0;
} }
...@@ -242,48 +184,12 @@ get_attention_status(struct hotplug_slot *hotplug_slot, u8 * value) ...@@ -242,48 +184,12 @@ get_attention_status(struct hotplug_slot *hotplug_slot, u8 * value)
static int static int
set_attention_status(struct hotplug_slot *hotplug_slot, u8 status) set_attention_status(struct hotplug_slot *hotplug_slot, u8 status)
{ {
struct slot *slot = get_slot(hotplug_slot, __FUNCTION__); return cpci_set_attention_status(hotplug_slot->private, status);
if(slot == NULL)
return -ENODEV;
switch (status) {
case 0:
cpci_set_attention_status(slot, 0);
break;
case 1:
default:
cpci_set_attention_status(slot, 1);
break;
}
return 0;
}
static int
get_latch_status(struct hotplug_slot *hotplug_slot, u8 * value)
{
if(hotplug_slot == NULL || hotplug_slot->info == NULL)
return -ENODEV;
*value = hotplug_slot->info->latch_status;
return 0;
}
static int
get_adapter_status(struct hotplug_slot *hotplug_slot, u8 * value)
{
if(hotplug_slot == NULL || hotplug_slot->info == NULL)
return -ENODEV;
*value = hotplug_slot->info->adapter_status;
return 0;
} }
static void release_slot(struct hotplug_slot *hotplug_slot) static void release_slot(struct hotplug_slot *hotplug_slot)
{ {
struct slot *slot = get_slot(hotplug_slot, __FUNCTION__); struct slot *slot = hotplug_slot->private;
if(slot == NULL)
return;
kfree(slot->hotplug_slot->info); kfree(slot->hotplug_slot->info);
kfree(slot->hotplug_slot->name); kfree(slot->hotplug_slot->name);
...@@ -306,15 +212,12 @@ cpci_hp_register_bus(struct pci_bus *bus, u8 first, u8 last) ...@@ -306,15 +212,12 @@ cpci_hp_register_bus(struct pci_bus *bus, u8 first, u8 last)
struct hotplug_slot *hotplug_slot; struct hotplug_slot *hotplug_slot;
struct hotplug_slot_info *info; struct hotplug_slot_info *info;
char *name; char *name;
int status = 0; int status = -ENOMEM;
int i; int i;
if(!(controller && bus)) { if(!(controller && bus)) {
return -ENODEV; return -ENODEV;
} }
if(last < first) {
return -EINVAL;
}
/* /*
* Create a structure for each slot, and register that slot * Create a structure for each slot, and register that slot
...@@ -322,38 +225,28 @@ cpci_hp_register_bus(struct pci_bus *bus, u8 first, u8 last) ...@@ -322,38 +225,28 @@ cpci_hp_register_bus(struct pci_bus *bus, u8 first, u8 last)
*/ */
for (i = first; i <= last; ++i) { for (i = first; i <= last; ++i) {
slot = kmalloc(sizeof (struct slot), GFP_KERNEL); slot = kmalloc(sizeof (struct slot), GFP_KERNEL);
if(!slot) if (!slot)
return -ENOMEM; goto error;
memset(slot, 0, sizeof (struct slot)); memset(slot, 0, sizeof (struct slot));
hotplug_slot = hotplug_slot =
kmalloc(sizeof (struct hotplug_slot), GFP_KERNEL); kmalloc(sizeof (struct hotplug_slot), GFP_KERNEL);
if(!hotplug_slot) { if (!hotplug_slot)
kfree(slot); goto error_slot;
return -ENOMEM;
}
memset(hotplug_slot, 0, sizeof (struct hotplug_slot)); memset(hotplug_slot, 0, sizeof (struct hotplug_slot));
slot->hotplug_slot = hotplug_slot; slot->hotplug_slot = hotplug_slot;
info = kmalloc(sizeof (struct hotplug_slot_info), GFP_KERNEL); info = kmalloc(sizeof (struct hotplug_slot_info), GFP_KERNEL);
if(!info) { if (!info)
kfree(hotplug_slot); goto error_hpslot;
kfree(slot);
return -ENOMEM;
}
memset(info, 0, sizeof (struct hotplug_slot_info)); memset(info, 0, sizeof (struct hotplug_slot_info));
hotplug_slot->info = info; hotplug_slot->info = info;
name = kmalloc(SLOT_NAME_SIZE, GFP_KERNEL); name = kmalloc(SLOT_NAME_SIZE, GFP_KERNEL);
if(!name) { if (!name)
kfree(info); goto error_info;
kfree(hotplug_slot);
kfree(slot);
return -ENOMEM;
}
hotplug_slot->name = name; hotplug_slot->name = name;
slot->magic = SLOT_MAGIC;
slot->bus = bus; slot->bus = bus;
slot->number = i; slot->number = i;
slot->devfn = PCI_DEVFN(i, 0); slot->devfn = PCI_DEVFN(i, 0);
...@@ -373,13 +266,9 @@ cpci_hp_register_bus(struct pci_bus *bus, u8 first, u8 last) ...@@ -373,13 +266,9 @@ cpci_hp_register_bus(struct pci_bus *bus, u8 first, u8 last)
dbg("registering slot %s", slot->hotplug_slot->name); dbg("registering slot %s", slot->hotplug_slot->name);
status = pci_hp_register(slot->hotplug_slot); status = pci_hp_register(slot->hotplug_slot);
if(status) { if (status) {
err("pci_hp_register failed with error %d", status); err("pci_hp_register failed with error %d", status);
kfree(info); goto error_name;
kfree(name);
kfree(hotplug_slot);
kfree(slot);
return status;
} }
/* Add slot to our internal list */ /* Add slot to our internal list */
...@@ -388,6 +277,16 @@ cpci_hp_register_bus(struct pci_bus *bus, u8 first, u8 last) ...@@ -388,6 +277,16 @@ cpci_hp_register_bus(struct pci_bus *bus, u8 first, u8 last)
slots++; slots++;
spin_unlock(&list_lock); spin_unlock(&list_lock);
} }
return 0;
error_name:
kfree(name);
error_info:
kfree(info);
error_hpslot:
kfree(hotplug_slot);
error_slot:
kfree(slot);
error:
return status; return status;
} }
...@@ -399,10 +298,6 @@ cpci_hp_unregister_bus(struct pci_bus *bus) ...@@ -399,10 +298,6 @@ cpci_hp_unregister_bus(struct pci_bus *bus)
struct list_head *next; struct list_head *next;
int status; int status;
if(!bus) {
return -ENODEV;
}
spin_lock(&list_lock); spin_lock(&list_lock);
if(!slots) { if(!slots) {
spin_unlock(&list_lock); spin_unlock(&list_lock);
...@@ -428,7 +323,7 @@ cpci_hp_unregister_bus(struct pci_bus *bus) ...@@ -428,7 +323,7 @@ cpci_hp_unregister_bus(struct pci_bus *bus)
} }
/* This is the interrupt mode interrupt handler */ /* This is the interrupt mode interrupt handler */
irqreturn_t static irqreturn_t
cpci_hp_intr(int irq, void *data, struct pt_regs *regs) cpci_hp_intr(int irq, void *data, struct pt_regs *regs)
{ {
dbg("entered cpci_hp_intr"); dbg("entered cpci_hp_intr");
...@@ -891,7 +786,6 @@ cpci_hotplug_exit(void) ...@@ -891,7 +786,6 @@ cpci_hotplug_exit(void)
cleanup_slots(); cleanup_slots();
} }
EXPORT_SYMBOL_GPL(cpci_hp_register_controller); EXPORT_SYMBOL_GPL(cpci_hp_register_controller);
EXPORT_SYMBOL_GPL(cpci_hp_unregister_controller); EXPORT_SYMBOL_GPL(cpci_hp_unregister_controller);
EXPORT_SYMBOL_GPL(cpci_hp_register_bus); EXPORT_SYMBOL_GPL(cpci_hp_register_bus);
......
...@@ -127,6 +127,7 @@ u16 cpci_get_hs_csr(struct slot* slot) ...@@ -127,6 +127,7 @@ u16 cpci_get_hs_csr(struct slot* slot)
return hs_csr; return hs_csr;
} }
#if 0
u16 cpci_set_hs_csr(struct slot* slot, u16 hs_csr) u16 cpci_set_hs_csr(struct slot* slot, u16 hs_csr)
{ {
int hs_cap; int hs_cap;
...@@ -156,6 +157,7 @@ u16 cpci_set_hs_csr(struct slot* slot, u16 hs_csr) ...@@ -156,6 +157,7 @@ u16 cpci_set_hs_csr(struct slot* slot, u16 hs_csr)
} }
return new_hs_csr; return new_hs_csr;
} }
#endif
int cpci_check_and_clear_ins(struct slot* slot) int cpci_check_and_clear_ins(struct slot* slot)
{ {
......
...@@ -76,73 +76,6 @@ static u8 enum_mask; ...@@ -76,73 +76,6 @@ static u8 enum_mask;
static struct cpci_hp_controller_ops generic_hpc_ops; static struct cpci_hp_controller_ops generic_hpc_ops;
static struct cpci_hp_controller generic_hpc; static struct cpci_hp_controller generic_hpc;
/* The following allows configuring the driver when it's compiled into the kernel */
#ifndef MODULE
static int __init cpcihp_generic_setup(char* str)
{
char* p;
unsigned long tmp;
if(!str)
return -EINVAL;
bridge = str;
p = strchr(str, ',');
str = p + 1;
if(!(p && *str && *p == ','))
goto setup_error;
tmp = simple_strtoul(str, &p, 0);
if(p == str || tmp > 0xff) {
err("hotplug bus first slot number out of range");
goto setup_error;
}
first_slot = (u8) tmp;
str = p + 1;
if(!(*str && *p == ','))
return -EINVAL;
tmp = simple_strtoul(str, &p, 0);
if(p == str || tmp > 0xff) {
err("hotplug bus last slot number out of range");
goto setup_error;
}
last_slot = (u8) tmp;
str = p + 1;
if(!(*str && *p == ','))
goto setup_error;
tmp = simple_strtoul(str, &p, 0);
if(p == str || tmp > 0xffff) {
err("port number out of range");
goto setup_error;
}
port = (u16) tmp;
str = p + 1;
if(!(*str && *p == ','))
goto setup_error;
tmp = simple_strtoul(str, &p, 0);
if(p == str) {
err("invalid #ENUM bit number");
goto setup_error;
}
enum_bit = (u8) tmp;
str = p + 1;
if(*str && *p == ',') {
tmp = simple_strtoul(str, &p, 0);
if(p != str)
debug = (int) tmp;
}
return 0;
setup_error:
bridge = NULL;
return -EINVAL;
}
__setup("cpcihp_generic=", cpcihp_generic_setup);
#endif
static int __init validate_parameters(void) static int __init validate_parameters(void)
{ {
char* str; char* str;
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <linux/config.h> #include <linux/config.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/pci.h> #include <linux/pci.h>
...@@ -42,11 +43,7 @@ ...@@ -42,11 +43,7 @@
#define DRIVER_AUTHOR "Scott Murray <scottm@somanetworks.com>" #define DRIVER_AUTHOR "Scott Murray <scottm@somanetworks.com>"
#define DRIVER_DESC "ZT5550 CompactPCI Hot Plug Driver" #define DRIVER_DESC "ZT5550 CompactPCI Hot Plug Driver"
#if !defined(CONFIG_HOTPLUG_PCI_CPCI_ZT5550_MODULE)
#define MY_NAME "cpcihp_zt5550" #define MY_NAME "cpcihp_zt5550"
#else
#define MY_NAME THIS_MODULE->name
#endif
#define dbg(format, arg...) \ #define dbg(format, arg...) \
do { \ do { \
...@@ -175,7 +172,7 @@ static int zt5550_hc_enable_irq(void) ...@@ -175,7 +172,7 @@ static int zt5550_hc_enable_irq(void)
return 0; return 0;
} }
int zt5550_hc_disable_irq(void) static int zt5550_hc_disable_irq(void)
{ {
u8 reg; u8 reg;
...@@ -301,7 +298,7 @@ module_exit(zt5550_exit); ...@@ -301,7 +298,7 @@ module_exit(zt5550_exit);
MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC); MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_PARM(debug, "i"); module_param(debug, bool, 644);
MODULE_PARM_DESC(debug, "Debugging mode enabled or not"); MODULE_PARM_DESC(debug, "Debugging mode enabled or not");
MODULE_PARM(poll, "i"); module_param(poll, bool, 644);
MODULE_PARM_DESC(poll, "#ENUM polling mode enabled or not"); MODULE_PARM_DESC(poll, "#ENUM polling mode enabled or not");
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -271,7 +271,6 @@ struct bus_info { ...@@ -271,7 +271,6 @@ struct bus_info {
***********************************************************/ ***********************************************************/
extern struct list_head ibmphp_ebda_pci_rsrc_head; extern struct list_head ibmphp_ebda_pci_rsrc_head;
extern struct list_head ibmphp_slot_head; extern struct list_head ibmphp_slot_head;
extern struct list_head ibmphp_res_head;
/*********************************************************** /***********************************************************
* FUNCTION PROTOTYPES * * FUNCTION PROTOTYPES *
***********************************************************/ ***********************************************************/
...@@ -754,7 +753,6 @@ struct controller { ...@@ -754,7 +753,6 @@ struct controller {
/* Functions */ /* Functions */
extern int ibmphp_init_devno (struct slot **); /* This function is called from EBDA, so we need it not be static */ extern int ibmphp_init_devno (struct slot **); /* This function is called from EBDA, so we need it not be static */
extern int ibmphp_disable_slot (struct hotplug_slot *); /* This function is called from HPC, so we need it to not be static */
extern int ibmphp_do_disable_slot (struct slot *slot_cur); extern int ibmphp_do_disable_slot (struct slot *slot_cur);
extern int ibmphp_update_slot_info (struct slot *); /* This function is called from HPC, so we need it to not be be static */ extern int ibmphp_update_slot_info (struct slot *); /* This function is called from HPC, so we need it to not be be static */
extern int ibmphp_configure_card (struct pci_func *, u8); extern int ibmphp_configure_card (struct pci_func *, u8);
......
...@@ -1146,7 +1146,7 @@ static int enable_slot (struct hotplug_slot *hs) ...@@ -1146,7 +1146,7 @@ static int enable_slot (struct hotplug_slot *hs)
* OUTPUT: SUCCESS 0 ; FAILURE: UNCONFIGURE , VALIDATE * * OUTPUT: SUCCESS 0 ; FAILURE: UNCONFIGURE , VALIDATE *
DISABLE POWER , * DISABLE POWER , *
**************************************************************/ **************************************************************/
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; struct slot *slot = hotplug_slot->private;
int rc; int rc;
......
...@@ -45,7 +45,6 @@ static void fix_resources (struct bus_node *); ...@@ -45,7 +45,6 @@ static void fix_resources (struct bus_node *);
static struct bus_node *find_bus_wprev (u8, struct bus_node **, u8); static struct bus_node *find_bus_wprev (u8, struct bus_node **, u8);
static LIST_HEAD(gbuses); static LIST_HEAD(gbuses);
LIST_HEAD(ibmphp_res_head);
static struct bus_node * __init alloc_error_bus (struct ebda_pci_rsrc * curr, u8 busno, int flag) static struct bus_node * __init alloc_error_bus (struct ebda_pci_rsrc * curr, u8 busno, int flag)
{ {
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <linux/config.h> #include <linux/config.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/list.h> #include <linux/list.h>
...@@ -45,11 +46,7 @@ ...@@ -45,11 +46,7 @@
#include "pci_hotplug.h" #include "pci_hotplug.h"
#if !defined(CONFIG_HOTPLUG_PCI_MODULE) #define MY_NAME "pci_hotplug"
#define MY_NAME "pci_hotplug"
#else
#define MY_NAME THIS_MODULE->name
#endif
#define dbg(fmt, arg...) do { if (debug) printk(KERN_DEBUG "%s: %s: " fmt , MY_NAME , __FUNCTION__ , ## arg); } while (0) #define dbg(fmt, arg...) do { if (debug) printk(KERN_DEBUG "%s: %s: " fmt , MY_NAME , __FUNCTION__ , ## arg); } while (0)
#define err(format, arg...) printk(KERN_ERR "%s: " format , MY_NAME , ## arg) #define err(format, arg...) printk(KERN_ERR "%s: " format , MY_NAME , ## arg)
...@@ -704,7 +701,7 @@ module_exit(pci_hotplug_exit); ...@@ -704,7 +701,7 @@ module_exit(pci_hotplug_exit);
MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC); MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_PARM(debug, "i"); module_param(debug, bool, 644);
MODULE_PARM_DESC(debug, "Debugging mode enabled or not"); MODULE_PARM_DESC(debug, "Debugging mode enabled or not");
EXPORT_SYMBOL_GPL(pci_hotplug_slots_subsys); EXPORT_SYMBOL_GPL(pci_hotplug_slots_subsys);
......
...@@ -35,11 +35,7 @@ ...@@ -35,11 +35,7 @@
#include <asm/io.h> #include <asm/io.h>
#include "pci_hotplug.h" #include "pci_hotplug.h"
#if !defined(CONFIG_HOTPLUG_PCI_PCIE_MODULE) #define MY_NAME "pciehp"
#define MY_NAME "pciehp"
#else
#define MY_NAME THIS_MODULE->name
#endif
extern int pciehp_poll_mode; extern int pciehp_poll_mode;
extern int pciehp_poll_time; extern int pciehp_poll_time;
...@@ -72,9 +68,7 @@ struct pci_func { ...@@ -72,9 +68,7 @@ struct pci_func {
struct pci_dev* pci_dev; struct pci_dev* pci_dev;
}; };
#define SLOT_MAGIC 0x67267321
struct slot { struct slot {
u32 magic;
struct slot *next; struct slot *next;
u8 bus; u8 bus;
u8 device; u8 device;
...@@ -108,9 +102,9 @@ struct event_info { ...@@ -108,9 +102,9 @@ struct event_info {
struct controller { struct controller {
struct controller *next; struct controller *next;
struct semaphore crit_sect; /* critical section semaphore */ struct semaphore crit_sect; /* critical section semaphore */
void * hpc_ctlr_handle; /* HPC controller handle */ void *hpc_ctlr_handle; /* HPC controller handle */
int num_slots; /* Number of slots on ctlr */ int num_slots; /* Number of slots on ctlr */
int slot_num_inc; /* 1 or -1 */ int slot_num_inc; /* 1 or -1 */
struct pci_resource *mem_head; struct pci_resource *mem_head;
struct pci_resource *p_mem_head; struct pci_resource *p_mem_head;
struct pci_resource *io_head; struct pci_resource *io_head;
...@@ -191,7 +185,7 @@ struct resource_lists { ...@@ -191,7 +185,7 @@ struct resource_lists {
#define msg_initialization_err "Initialization failure, error=%d\n" #define msg_initialization_err "Initialization failure, error=%d\n"
#define msg_HPC_rev_error "Unsupported revision of the PCI hot plug controller found.\n" #define msg_HPC_rev_error "Unsupported revision of the PCI hot plug controller found.\n"
#define msg_HPC_non_pcie "The PCI hot plug controller is not supported by this driver.\n" #define msg_HPC_non_pcie "The PCI hot plug controller is not supported by this driver.\n"
#define msg_HPC_not_supported "This system is not supported by this version of pciephd mdoule. Upgrade to a newer version of pciehpd\n" #define msg_HPC_not_supported "This system is not supported by this version of pciephd module. Upgrade to a newer version of pciehpd\n"
#define msg_unable_to_save "Unable to store PCI hot plug add resource information. This system must be rebooted before adding any PCI devices.\n" #define msg_unable_to_save "Unable to store PCI hot plug add resource information. This system must be rebooted before adding any PCI devices.\n"
#define msg_button_on "PCI slot #%d - powering on due to button press.\n" #define msg_button_on "PCI slot #%d - powering on due to button press.\n"
#define msg_button_off "PCI slot #%d - powering off due to button press.\n" #define msg_button_off "PCI slot #%d - powering off due to button press.\n"
...@@ -202,7 +196,6 @@ struct resource_lists { ...@@ -202,7 +196,6 @@ struct resource_lists {
extern void pciehp_create_ctrl_files (struct controller *ctrl); extern void pciehp_create_ctrl_files (struct controller *ctrl);
/* controller functions */ /* controller functions */
extern void pciehp_pushbutton_thread (unsigned long event_pointer);
extern int pciehprm_find_available_resources (struct controller *ctrl); extern int pciehprm_find_available_resources (struct controller *ctrl);
extern int pciehp_event_start_thread (void); extern int pciehp_event_start_thread (void);
extern void pciehp_event_stop_thread (void); extern void pciehp_event_stop_thread (void);
...@@ -239,47 +232,10 @@ extern struct pci_func *pciehp_slot_list[256]; ...@@ -239,47 +232,10 @@ extern struct pci_func *pciehp_slot_list[256];
/* Inline functions */ /* Inline functions */
static inline struct slot *pciehp_find_slot(struct controller *ctrl, u8 device)
/* Inline functions to check the sanity of a pointer that is passed to us */
static inline int slot_paranoia_check (struct slot *slot, const char *function)
{
if (!slot) {
dbg("%s - slot == NULL", function);
return -1;
}
if (slot->magic != SLOT_MAGIC) {
dbg("%s - bad magic number for slot", function);
return -1;
}
if (!slot->hotplug_slot) {
dbg("%s - slot->hotplug_slot == NULL!", function);
return -1;
}
return 0;
}
static inline struct slot *get_slot (struct hotplug_slot *hotplug_slot, const char *function)
{
struct slot *slot;
if (!hotplug_slot) {
dbg("%s - hotplug_slot == NULL\n", function);
return NULL;
}
slot = (struct slot *)hotplug_slot->private;
if (slot_paranoia_check (slot, function))
return NULL;
return slot;
}
static inline struct slot *pciehp_find_slot (struct controller *ctrl, u8 device)
{ {
struct slot *p_slot, *tmp_slot = NULL; struct slot *p_slot, *tmp_slot = NULL;
if (!ctrl)
return NULL;
p_slot = ctrl->slot; p_slot = ctrl->slot;
dbg("p_slot = %p\n", p_slot); dbg("p_slot = %p\n", p_slot);
...@@ -294,10 +250,10 @@ static inline struct slot *pciehp_find_slot (struct controller *ctrl, u8 device) ...@@ -294,10 +250,10 @@ static inline struct slot *pciehp_find_slot (struct controller *ctrl, u8 device)
p_slot = tmp_slot; p_slot = tmp_slot;
} }
return (p_slot); return p_slot;
} }
static inline int wait_for_ctrl_irq (struct controller *ctrl) static inline int wait_for_ctrl_irq(struct controller *ctrl)
{ {
int retval = 0; int retval = 0;
...@@ -345,7 +301,7 @@ enum php_ctlr_type { ...@@ -345,7 +301,7 @@ enum php_ctlr_type {
typedef u8(*php_intr_callback_t) (unsigned int change_id, void *instance_id); typedef u8(*php_intr_callback_t) (unsigned int change_id, void *instance_id);
int pcie_init( struct controller *ctrl, struct pci_dev *pdev, int pcie_init(struct controller *ctrl, struct pci_dev *pdev,
php_intr_callback_t attention_button_callback, php_intr_callback_t attention_button_callback,
php_intr_callback_t switch_change_callback, php_intr_callback_t switch_change_callback,
php_intr_callback_t presence_change_callback, php_intr_callback_t presence_change_callback,
...@@ -353,7 +309,7 @@ int pcie_init( struct controller *ctrl, struct pci_dev *pdev, ...@@ -353,7 +309,7 @@ int pcie_init( struct controller *ctrl, struct pci_dev *pdev,
/* This has no meaning for PCI Express, as there is only 1 slot per port */ /* This has no meaning for PCI Express, as there is only 1 slot per port */
int pcie_get_ctlr_slot_config( struct controller *ctrl, int pcie_get_ctlr_slot_config(struct controller *ctrl,
int *num_ctlr_slots, int *num_ctlr_slots,
int *first_device_num, int *first_device_num,
int *physical_slot_num, int *physical_slot_num,
...@@ -361,12 +317,12 @@ int pcie_get_ctlr_slot_config( struct controller *ctrl, ...@@ -361,12 +317,12 @@ int pcie_get_ctlr_slot_config( struct controller *ctrl,
int *flags); int *flags);
struct hpc_ops { struct hpc_ops {
int (*power_on_slot ) (struct slot *slot); int (*power_on_slot) (struct slot *slot);
int (*power_off_slot ) (struct slot *slot); int (*power_off_slot) (struct slot *slot);
int (*get_power_status) (struct slot *slot, u8 *status); int (*get_power_status) (struct slot *slot, u8 *status);
int (*get_attention_status) (struct slot *slot, u8 *status); int (*get_attention_status) (struct slot *slot, u8 *status);
int (*set_attention_status) (struct slot *slot, u8 status); int (*set_attention_status) (struct slot *slot, u8 status);
int (*get_latch_status) (struct slot *slot, u8 *status); int (*get_latch_status) (struct slot *slot, u8 *status);
int (*get_adapter_status) (struct slot *slot, u8 *status); int (*get_adapter_status) (struct slot *slot, u8 *status);
int (*get_max_bus_speed) (struct slot *slot, enum pci_bus_speed *speed); int (*get_max_bus_speed) (struct slot *slot, enum pci_bus_speed *speed);
...@@ -380,7 +336,7 @@ struct hpc_ops { ...@@ -380,7 +336,7 @@ struct hpc_ops {
void (*green_led_off) (struct slot *slot); void (*green_led_off) (struct slot *slot);
void (*green_led_blink) (struct slot *slot); void (*green_led_blink) (struct slot *slot);
void (*release_ctlr) (struct controller *ctrl); void (*release_ctlr) (struct controller *ctrl);
int (*check_lnk_status) (struct controller *ctrl); int (*check_lnk_status) (struct controller *ctrl);
}; };
#endif /* _PCIEHP_H */ #endif /* _PCIEHP_H */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
int pciehprm_init(enum php_ctlr_type ct); int pciehprm_init(enum php_ctlr_type ct);
void pciehprm_cleanup(void); void pciehprm_cleanup(void);
int pciehprm_print_pirt(void); int pciehprm_print_pirt(void);
void *pciehprm_get_slot(struct slot *slot);
int pciehprm_find_available_resources(struct controller *ctrl); int pciehprm_find_available_resources(struct controller *ctrl);
int pciehprm_set_hpp(struct controller *ctrl, struct pci_func *func, u8 card_type); int pciehprm_set_hpp(struct controller *ctrl, struct pci_func *func, u8 card_type);
void pciehprm_enable_card(struct controller *ctrl, struct pci_func *func, u8 card_type); void pciehprm_enable_card(struct controller *ctrl, struct pci_func *func, u8 card_type);
......
...@@ -1301,6 +1301,7 @@ static struct acpi_php_slot * get_acpi_slot ( ...@@ -1301,6 +1301,7 @@ static struct acpi_php_slot * get_acpi_slot (
} }
#if 0
void * pciehprm_get_slot(struct slot *slot) void * pciehprm_get_slot(struct slot *slot)
{ {
struct acpi_bridge *ab = acpi_bridges_head; struct acpi_bridge *ab = acpi_bridges_head;
...@@ -1312,6 +1313,7 @@ void * pciehprm_get_slot(struct slot *slot) ...@@ -1312,6 +1313,7 @@ void * pciehprm_get_slot(struct slot *slot)
return (void *)aps; return (void *)aps;
} }
#endif
static void pciehprm_dump_func_res( struct pci_func *fun) static void pciehprm_dump_func_res( struct pci_func *fun)
{ {
......
...@@ -52,11 +52,6 @@ int pciehprm_print_pirt(void) ...@@ -52,11 +52,6 @@ int pciehprm_print_pirt(void)
return 0; return 0;
} }
void * pciehprm_get_slot(struct slot *slot)
{
return NULL;
}
int pciehprm_get_physical_slot_number(struct controller *ctrl, u32 *sun, u8 busnum, u8 devnum) int pciehprm_get_physical_slot_number(struct controller *ctrl, u32 *sun, u8 busnum, u8 devnum)
{ {
......
This diff is collapsed.
...@@ -47,15 +47,13 @@ static struct device_node *find_php_slot_vio_node(char *drc_name) ...@@ -47,15 +47,13 @@ static struct device_node *find_php_slot_vio_node(char *drc_name)
{ {
struct device_node *child; struct device_node *child;
struct device_node *parent = of_find_node_by_name(NULL, "vdevice"); struct device_node *parent = of_find_node_by_name(NULL, "vdevice");
char *loc_code;
if (!parent) if (!parent)
return NULL; return NULL;
for (child = of_get_next_child(parent, NULL); for (child = of_get_next_child(parent, NULL);
child; child = of_get_next_child(parent, child)) { child; child = of_get_next_child(parent, child)) {
char *loc_code;
loc_code = get_property(child, "ibm,loc-code", NULL); loc_code = get_property(child, "ibm,loc-code", NULL);
if (loc_code && !strcmp(loc_code, drc_name)) if (loc_code && !strcmp(loc_code, drc_name))
return child; return child;
...@@ -309,12 +307,8 @@ int dlpar_remove_vio_slot(struct slot *slot, char *drc_name) ...@@ -309,12 +307,8 @@ int dlpar_remove_vio_slot(struct slot *slot, char *drc_name)
*/ */
int dlpar_remove_pci_slot(struct slot *slot, char *drc_name) int dlpar_remove_pci_slot(struct slot *slot, char *drc_name)
{ {
struct device_node *dn = find_php_slot_pci_node(drc_name);
struct pci_dev *bridge_dev; struct pci_dev *bridge_dev;
if (!dn)
return -ENODEV;
bridge_dev = slot->bridge; bridge_dev = slot->bridge;
if (!bridge_dev) { if (!bridge_dev) {
printk(KERN_ERR "%s: unexpected null bridge device\n", printk(KERN_ERR "%s: unexpected null bridge device\n",
...@@ -358,13 +352,19 @@ int dlpar_remove_slot(char *drc_name) ...@@ -358,13 +352,19 @@ int dlpar_remove_slot(char *drc_name)
if (down_interruptible(&rpadlpar_sem)) if (down_interruptible(&rpadlpar_sem))
return -ERESTARTSYS; return -ERESTARTSYS;
if (!find_php_slot_vio_node(drc_name) &&
!find_php_slot_pci_node(drc_name)) {
rc = -ENODEV;
goto exit;
}
slot = find_slot(drc_name); slot = find_slot(drc_name);
if (!slot) { if (!slot) {
rc = -EINVAL; rc = -EINVAL;
goto exit; goto exit;
} }
switch (slot->dev_type) { switch (slot->dev_type) {
case PCI_DEV: case PCI_DEV:
rc = dlpar_remove_pci_slot(slot, drc_name); rc = dlpar_remove_pci_slot(slot, drc_name);
......
...@@ -62,8 +62,6 @@ extern int debug; ...@@ -62,8 +62,6 @@ extern int debug;
#define info(format, arg...) printk(KERN_INFO "%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 warn(format, arg...) printk(KERN_WARNING "%s: " format, MY_NAME , ## arg)
#define SLOT_MAGIC 0x67267322
/* slot types */ /* slot types */
#define VIO_DEV 1 #define VIO_DEV 1
#define PCI_DEV 2 #define PCI_DEV 2
...@@ -79,7 +77,6 @@ extern int debug; ...@@ -79,7 +77,6 @@ extern int debug;
* struct slot - slot information for each *physical* slot * struct slot - slot information for each *physical* slot
*/ */
struct slot { struct slot {
u32 magic;
int state; int state;
u32 index; u32 index;
u32 type; u32 type;
......
This diff is collapsed.
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
struct pci_dev *rpaphp_find_pci_dev(struct device_node *dn) struct pci_dev *rpaphp_find_pci_dev(struct device_node *dn)
{ {
struct pci_dev *retval_dev = NULL, *dev = NULL; struct pci_dev *retval_dev = NULL, *dev;
char bus_id[BUS_ID_SIZE]; char bus_id[BUS_ID_SIZE];
sprintf(bus_id, "%04x:%02x:%02x.%d",dn->phb->global_number, sprintf(bus_id, "%04x:%02x:%02x.%d",dn->phb->global_number,
...@@ -57,9 +57,8 @@ int rpaphp_claim_resource(struct pci_dev *dev, int resource) ...@@ -57,9 +57,8 @@ int rpaphp_claim_resource(struct pci_dev *dev, int resource)
struct resource *res = &dev->resource[resource]; struct resource *res = &dev->resource[resource];
struct resource *root = pci_find_parent_resource(dev, res); struct resource *root = pci_find_parent_resource(dev, res);
char *dtype = resource < PCI_BRIDGE_RESOURCES ? "device" : "bridge"; char *dtype = resource < PCI_BRIDGE_RESOURCES ? "device" : "bridge";
int err; int err = -EINVAL;
err = -EINVAL;
if (root != NULL) { if (root != NULL) {
err = request_resource(root, res); err = request_resource(root, res);
} }
...@@ -117,8 +116,8 @@ static int rpaphp_get_sensor_state(struct slot *slot, int *state) ...@@ -117,8 +116,8 @@ static int rpaphp_get_sensor_state(struct slot *slot, int *state)
return rc; return rc;
} }
/* /**
* get_pci_adapter_status - get the status of a slot * get_pci_adapter_status - get the status of a slot
* *
* 0-- slot is empty * 0-- slot is empty
* 1-- adapter is configured * 1-- adapter is configured
...@@ -136,7 +135,7 @@ int rpaphp_get_pci_adapter_status(struct slot *slot, int is_init, u8 * value) ...@@ -136,7 +135,7 @@ int rpaphp_get_pci_adapter_status(struct slot *slot, int is_init, u8 * value)
if (state == PRESENT) { if (state == PRESENT) {
if (!is_init) if (!is_init)
/* at run-time slot->state can be changed by */ /* at run-time slot->state can be changed by */
/* config/unconfig adapter */ /* config/unconfig adapter */
*value = slot->state; *value = slot->state;
else { else {
if (!slot->dn->child) if (!slot->dn->child)
...@@ -154,7 +153,7 @@ int rpaphp_get_pci_adapter_status(struct slot *slot, int is_init, u8 * value) ...@@ -154,7 +153,7 @@ int rpaphp_get_pci_adapter_status(struct slot *slot, int is_init, u8 * value)
*value = state; *value = state;
} }
exit: exit:
return rc; return rc;
} }
...@@ -175,6 +174,7 @@ static void rpaphp_fixup_new_pci_devices(struct pci_bus *bus) ...@@ -175,6 +174,7 @@ static void rpaphp_fixup_new_pci_devices(struct pci_bus *bus)
pci_read_irq_line(dev); pci_read_irq_line(dev);
for (i = 0; i < PCI_NUM_RESOURCES; i++) { for (i = 0; i < PCI_NUM_RESOURCES; i++) {
struct resource *r = &dev->resource[i]; struct resource *r = &dev->resource[i];
if (r->parent || !r->start || !r->flags) if (r->parent || !r->start || !r->flags)
continue; continue;
rpaphp_claim_resource(dev, i); rpaphp_claim_resource(dev, i);
...@@ -183,7 +183,8 @@ static void rpaphp_fixup_new_pci_devices(struct pci_bus *bus) ...@@ -183,7 +183,8 @@ static void rpaphp_fixup_new_pci_devices(struct pci_bus *bus)
} }
} }
static void rpaphp_pci_config_device(struct pci_bus *pci_bus, struct device_node *dn) static void
rpaphp_pci_config_device(struct pci_bus *pci_bus, struct device_node *dn)
{ {
int num; int num;
...@@ -192,7 +193,6 @@ static void rpaphp_pci_config_device(struct pci_bus *pci_bus, struct device_node ...@@ -192,7 +193,6 @@ static void rpaphp_pci_config_device(struct pci_bus *pci_bus, struct device_node
rpaphp_fixup_new_pci_devices(pci_bus); rpaphp_fixup_new_pci_devices(pci_bus);
pci_bus_add_devices(pci_bus); pci_bus_add_devices(pci_bus);
} }
return;
} }
static int rpaphp_pci_config_bridge(struct pci_dev *dev, struct device_node *dn); static int rpaphp_pci_config_bridge(struct pci_dev *dev, struct device_node *dn);
...@@ -201,7 +201,8 @@ static int rpaphp_pci_config_bridge(struct pci_dev *dev, struct device_node *dn) ...@@ -201,7 +201,8 @@ static int rpaphp_pci_config_bridge(struct pci_dev *dev, struct device_node *dn)
rpaphp_pci_config_dn() will recursively configure all devices under the rpaphp_pci_config_dn() will recursively configure all devices under the
given slot->dn and return the dn's pci_dev. given slot->dn and return the dn's pci_dev.
*****************************************************************************/ *****************************************************************************/
static struct pci_dev *rpaphp_pci_config_dn(struct device_node *dn, struct pci_bus *bus) static struct pci_dev *
rpaphp_pci_config_dn(struct device_node *dn, struct pci_bus *bus)
{ {
struct device_node *local; struct device_node *local;
struct pci_dev *dev; struct pci_dev *dev;
...@@ -256,16 +257,16 @@ static struct pci_dev *rpaphp_config_pci_adapter(struct slot *slot) ...@@ -256,16 +257,16 @@ static struct pci_dev *rpaphp_config_pci_adapter(struct slot *slot)
goto exit; goto exit;
} }
eeh_add_device_early(slot->dn->child);
dev = rpaphp_pci_config_dn(slot->dn, pci_bus); dev = rpaphp_pci_config_dn(slot->dn, pci_bus);
eeh_add_device(dev); eeh_add_device_late(dev);
} else { } else {
/* slot is not enabled */ /* slot is not enabled */
err("slot doesn't have pci_dev structure\n"); err("slot doesn't have pci_dev structure\n");
dev = NULL; dev = NULL;
goto exit;
} }
exit: exit:
dbg("Exit %s: pci_dev %s\n", __FUNCTION__, dev ? "found" : "not found"); dbg("Exit %s: pci_dev %s\n", __FUNCTION__, dev ? "found" : "not found");
return dev; return dev;
} }
...@@ -304,9 +305,9 @@ static int setup_pci_hotplug_slot_info(struct slot *slot) ...@@ -304,9 +305,9 @@ static int setup_pci_hotplug_slot_info(struct slot *slot)
if (slot->hotplug_slot->info->adapter_status == NOT_VALID) { if (slot->hotplug_slot->info->adapter_status == NOT_VALID) {
dbg("%s: NOT_VALID: skip dn->full_name=%s\n", dbg("%s: NOT_VALID: skip dn->full_name=%s\n",
__FUNCTION__, slot->dn->full_name); __FUNCTION__, slot->dn->full_name);
return (-1); return -1;
} }
return (0); return 0;
} }
static int setup_pci_slot(struct slot *slot) static int setup_pci_slot(struct slot *slot)
...@@ -317,7 +318,8 @@ static int setup_pci_slot(struct slot *slot) ...@@ -317,7 +318,8 @@ static int setup_pci_slot(struct slot *slot)
dealloc_slot_struct(slot); dealloc_slot_struct(slot);
return 1; return 1;
} }
strcpy(slot->name, pci_name(slot->bridge));
/* find slot's pci_dev if it's not empty */ /* find slot's pci_dev if it's not empty */
if (slot->hotplug_slot->info->adapter_status == EMPTY) { if (slot->hotplug_slot->info->adapter_status == EMPTY) {
slot->state = EMPTY; /* slot is empty */ slot->state = EMPTY; /* slot is empty */
...@@ -353,7 +355,7 @@ int register_pci_slot(struct slot *slot) ...@@ -353,7 +355,7 @@ int register_pci_slot(struct slot *slot)
if (setup_pci_slot(slot)) if (setup_pci_slot(slot))
goto exit_rc; goto exit_rc;
rc = register_slot(slot); rc = register_slot(slot);
exit_rc: exit_rc:
if (rc) if (rc)
dealloc_slot_struct(slot); dealloc_slot_struct(slot);
return rc; return rc;
...@@ -389,7 +391,7 @@ int rpaphp_enable_pci_slot(struct slot *slot) ...@@ -389,7 +391,7 @@ int rpaphp_enable_pci_slot(struct slot *slot)
slot->state = NOT_VALID; slot->state = NOT_VALID;
retval = -EINVAL; retval = -EINVAL;
} }
exit: exit:
if (slot->state != NOT_VALID) if (slot->state != NOT_VALID)
rpaphp_set_attention_status(slot, LED_ON); rpaphp_set_attention_status(slot, LED_ON);
else else
......
This diff is collapsed.
...@@ -94,6 +94,7 @@ int register_vio_slot(struct device_node *dn) ...@@ -94,6 +94,7 @@ int register_vio_slot(struct device_node *dn)
slot->state = NOT_CONFIGURED; slot->state = NOT_CONFIGURED;
if (setup_vio_hotplug_slot_info(slot)) if (setup_vio_hotplug_slot_info(slot))
goto exit_rc; goto exit_rc;
strcpy(slot->name, slot->dev.vio_dev->dev.bus_id);
info("%s: registered VIO device[name=%s vio_dev=%p]\n", info("%s: registered VIO device[name=%s vio_dev=%p]\n",
__FUNCTION__, slot->name, slot->dev.vio_dev); __FUNCTION__, slot->name, slot->dev.vio_dev);
rc = register_slot(slot); rc = register_slot(slot);
......
...@@ -205,7 +205,6 @@ struct resource_lists { ...@@ -205,7 +205,6 @@ struct resource_lists {
extern void shpchp_create_ctrl_files (struct controller *ctrl); extern void shpchp_create_ctrl_files (struct controller *ctrl);
/* controller functions */ /* controller functions */
extern void shpchp_pushbutton_thread(unsigned long event_pointer);
extern int shpchprm_find_available_resources(struct controller *ctrl); extern int shpchprm_find_available_resources(struct controller *ctrl);
extern int shpchp_event_start_thread(void); extern int shpchp_event_start_thread(void);
extern void shpchp_event_stop_thread(void); extern void shpchp_event_stop_thread(void);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -39,7 +39,6 @@ ...@@ -39,7 +39,6 @@
int shpchprm_init(enum php_ctlr_type ct); int shpchprm_init(enum php_ctlr_type ct);
void shpchprm_cleanup(void); void shpchprm_cleanup(void);
int shpchprm_print_pirt(void); int shpchprm_print_pirt(void);
void *shpchprm_get_slot(struct slot *slot);
int shpchprm_find_available_resources(struct controller *ctrl); int shpchprm_find_available_resources(struct controller *ctrl);
int shpchprm_set_hpp(struct controller *ctrl, struct pci_func *func, u8 card_type); int shpchprm_set_hpp(struct controller *ctrl, struct pci_func *func, u8 card_type);
void shpchprm_enable_card(struct controller *ctrl, struct pci_func *func, u8 card_type); void shpchprm_enable_card(struct controller *ctrl, struct pci_func *func, u8 card_type);
......
...@@ -1299,7 +1299,8 @@ static struct acpi_php_slot * get_acpi_slot ( ...@@ -1299,7 +1299,8 @@ static struct acpi_php_slot * get_acpi_slot (
} }
void * shpchprm_get_slot(struct slot *slot) #if 0
static void * shpchprm_get_slot(struct slot *slot)
{ {
struct acpi_bridge *ab = acpi_bridges_head; struct acpi_bridge *ab = acpi_bridges_head;
struct acpi_php_slot *aps = get_acpi_slot (ab, slot->number); struct acpi_php_slot *aps = get_acpi_slot (ab, slot->number);
...@@ -1310,6 +1311,7 @@ void * shpchprm_get_slot(struct slot *slot) ...@@ -1310,6 +1311,7 @@ void * shpchprm_get_slot(struct slot *slot)
return (void *)aps; return (void *)aps;
} }
#endif
static void shpchprm_dump_func_res( struct pci_func *fun) static void shpchprm_dump_func_res( struct pci_func *fun)
{ {
......
...@@ -55,11 +55,6 @@ int shpchprm_print_pirt() ...@@ -55,11 +55,6 @@ int shpchprm_print_pirt()
return 0; return 0;
} }
void * shpchprm_get_slot(struct slot *slot)
{
return NULL;
}
int shpchprm_get_physical_slot_number(struct controller *ctrl, u32 *sun, u8 busnum, u8 devnum) int shpchprm_get_physical_slot_number(struct controller *ctrl, u32 *sun, u8 busnum, u8 devnum)
{ {
int offset = devnum - ctrl->slot_device_offset; int offset = devnum - ctrl->slot_device_offset;
......
...@@ -51,11 +51,6 @@ int shpchprm_print_pirt(void) ...@@ -51,11 +51,6 @@ int shpchprm_print_pirt(void)
return 0; return 0;
} }
void * shpchprm_get_slot(struct slot *slot)
{
return NULL;
}
int shpchprm_get_physical_slot_number(struct controller *ctrl, u32 *sun, u8 busnum, u8 devnum) int shpchprm_get_physical_slot_number(struct controller *ctrl, u32 *sun, u8 busnum, u8 devnum)
{ {
int offset = devnum - ctrl->slot_device_offset; int offset = devnum - ctrl->slot_device_offset;
......
...@@ -640,7 +640,7 @@ pci_generic_prep_mwi(struct pci_dev *dev) ...@@ -640,7 +640,7 @@ pci_generic_prep_mwi(struct pci_dev *dev)
if (cacheline_size == pci_cache_line_size) if (cacheline_size == pci_cache_line_size)
return 0; return 0;
printk(KERN_WARNING "PCI: cache line size of %d is not supported " printk(KERN_DEBUG "PCI: cache line size of %d is not supported "
"by device %s\n", pci_cache_line_size << 2, pci_name(dev)); "by device %s\n", pci_cache_line_size << 2, pci_name(dev));
return -EINVAL; return -EINVAL;
......
This diff is collapsed.
This diff is collapsed.
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