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
D: National Language Support
D: Linux Internationalization Project
D: German Localization for Linux and GNU software
S: Helenenstrasse 18
S: 65183 Wiesbaden
S: Kriemhildring 12a
S: 65795 Hattersheim am Main
S: Germany
N: Christoph Hellwig
......
......@@ -897,7 +897,7 @@ static int __init pcibios_irq_init(void)
{
DBG("PCI: IRQ init\n");
if (pcibios_enable_irq)
if (pcibios_enable_irq || raw_pci_ops == NULL)
return 0;
pirq_table = pirq_find_routing_table();
......
......@@ -47,7 +47,6 @@
#define info(format, arg...) printk(KERN_INFO "%s: " format, MY_NAME , ## arg)
#define warn(format, arg...) printk(KERN_WARNING "%s: " format, MY_NAME , ## arg)
#define SLOT_MAGIC 0x67267322
/* name size which is used for entries in pcihpfs */
#define SLOT_NAME_SIZE KOBJ_NAME_LEN /* {_SUN} */
......@@ -59,7 +58,6 @@ struct pci_resource;
* struct slot - slot information for each *physical* slot
*/
struct slot {
u32 magic;
u8 number;
struct hotplug_slot *hotplug_slot;
struct list_head slot_list;
......@@ -220,9 +218,7 @@ extern void acpiphp_glue_exit (void);
extern int acpiphp_get_num_slots (void);
extern struct acpiphp_slot *get_slot_from_id (int id);
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_disable_slot (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);
/* acpiphp_res.c */
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_with_base (struct pci_resource **head, u64 base, u32 size);
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 *);
* 4. ..
*
*/
static int is_ejectable (acpi_handle handle)
static int is_ejectable(acpi_handle handle)
{
acpi_status status;
acpi_handle tmp;
......@@ -919,6 +919,48 @@ static unsigned int get_slot_status(struct acpiphp_slot *slot)
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
......@@ -1113,6 +1155,8 @@ void __exit acpiphp_glue_exit(void)
kfree(bridge);
}
acpi_pci_unregister_driver(&acpi_pci_hp_driver);
}
......@@ -1138,13 +1182,14 @@ int __init acpiphp_get_num_slots(void)
}
#if 0
/**
* acpiphp_for_each_slot - call function for each slot
* @fn: 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 acpiphp_bridge *bridge;
......@@ -1163,7 +1208,7 @@ int acpiphp_for_each_slot(acpiphp_callback fn, void *data)
err_exit:
return retval;
}
#endif
/* search matching slot from id */
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! */
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;
}
......@@ -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 disabled: 0
......
......@@ -105,7 +105,7 @@ static int sort_by_size(struct pci_resource **head)
return 0;
}
#if 0
/*
* 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)
return 0;
}
#endif
/**
* 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
}
#if 0
/**
* get_max_resource - get the largest resource
*
......@@ -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
* 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 *temp;
......@@ -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 */
return NULL;
}
#endif
/**
* get_resource - get resource (mem, pfmem)
......
......@@ -40,9 +40,7 @@
#define HS_CSR_EIM 0x0002
#define HS_CSR_DHA 0x0001
#define SLOT_MAGIC 0x67267322
struct slot {
u32 magic;
u8 number;
unsigned int devfn;
struct pci_bus *bus;
......@@ -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_adapter_status(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_check_and_clear_ins(struct slot * slot);
extern int cpci_check_ext(struct slot * slot);
......
......@@ -40,11 +40,7 @@
#define DRIVER_AUTHOR "Scott Murray <scottm@somanetworks.com>"
#define DRIVER_DESC "CompactPCI Hot Plug Core"
#if !defined(CONFIG_HOTPLUG_CPCI_MODULE)
#define MY_NAME "cpci_hotplug"
#else
#define MY_NAME THIS_MODULE->name
#endif
#define dbg(format, arg...) \
do { \
......@@ -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 get_power_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 = {
.owner = THIS_MODULE,
.enable_slot = enable_slot,
.disable_slot = disable_slot,
.set_attention_status = set_attention_status,
.hardware_test = NULL,
.get_power_status = get_power_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
update_latch_status(struct hotplug_slot *hotplug_slot, u8 value)
{
struct hotplug_slot_info info;
if(!(hotplug_slot && hotplug_slot->info))
return -EINVAL;
memcpy(&info, hotplug_slot->info, sizeof(struct hotplug_slot_info));
info.latch_status = value;
return pci_hp_change_slot_info(hotplug_slot, &info);
......@@ -138,8 +92,6 @@ update_adapter_status(struct hotplug_slot *hotplug_slot, u8 value)
{
struct hotplug_slot_info info;
if(!(hotplug_slot && hotplug_slot->info))
return -EINVAL;
memcpy(&info, hotplug_slot->info, sizeof(struct hotplug_slot_info));
info.adapter_status = value;
return pci_hp_change_slot_info(hotplug_slot, &info);
......@@ -148,12 +100,9 @@ update_adapter_status(struct hotplug_slot *hotplug_slot, u8 value)
static int
enable_slot(struct hotplug_slot *hotplug_slot)
{
struct slot *slot = get_slot(hotplug_slot, __FUNCTION__);
struct slot *slot = hotplug_slot->private;
int retval = 0;
if(slot == NULL)
return -ENODEV;
dbg("%s - physical_slot = %s", __FUNCTION__, hotplug_slot->name);
if(controller->ops->set_power) {
......@@ -166,12 +115,9 @@ enable_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 = hotplug_slot->private;
int retval = 0;
if(slot == NULL)
return -ENODEV;
dbg("%s - physical_slot = %s", __FUNCTION__, hotplug_slot->name);
/* Unconfigure device */
......@@ -220,10 +166,8 @@ cpci_get_power_status(struct slot *slot)
static int
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);
return 0;
}
......@@ -231,10 +175,8 @@ get_power_status(struct hotplug_slot *hotplug_slot, u8 * value)
static int
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);
return 0;
}
......@@ -242,48 +184,12 @@ get_attention_status(struct hotplug_slot *hotplug_slot, u8 * value)
static int
set_attention_status(struct hotplug_slot *hotplug_slot, u8 status)
{
struct slot *slot = get_slot(hotplug_slot, __FUNCTION__);
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;
return cpci_set_attention_status(hotplug_slot->private, status);
}
static void release_slot(struct hotplug_slot *hotplug_slot)
{
struct slot *slot = get_slot(hotplug_slot, __FUNCTION__);
if(slot == NULL)
return;
struct slot *slot = hotplug_slot->private;
kfree(slot->hotplug_slot->info);
kfree(slot->hotplug_slot->name);
......@@ -306,15 +212,12 @@ cpci_hp_register_bus(struct pci_bus *bus, u8 first, u8 last)
struct hotplug_slot *hotplug_slot;
struct hotplug_slot_info *info;
char *name;
int status = 0;
int status = -ENOMEM;
int i;
if(!(controller && bus)) {
return -ENODEV;
}
if(last < first) {
return -EINVAL;
}
/*
* 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)
*/
for (i = first; i <= last; ++i) {
slot = kmalloc(sizeof (struct slot), GFP_KERNEL);
if(!slot)
return -ENOMEM;
if (!slot)
goto error;
memset(slot, 0, sizeof (struct slot));
hotplug_slot =
kmalloc(sizeof (struct hotplug_slot), GFP_KERNEL);
if(!hotplug_slot) {
kfree(slot);
return -ENOMEM;
}
if (!hotplug_slot)
goto error_slot;
memset(hotplug_slot, 0, sizeof (struct hotplug_slot));
slot->hotplug_slot = hotplug_slot;
info = kmalloc(sizeof (struct hotplug_slot_info), GFP_KERNEL);
if(!info) {
kfree(hotplug_slot);
kfree(slot);
return -ENOMEM;
}
if (!info)
goto error_hpslot;
memset(info, 0, sizeof (struct hotplug_slot_info));
hotplug_slot->info = info;
name = kmalloc(SLOT_NAME_SIZE, GFP_KERNEL);
if(!name) {
kfree(info);
kfree(hotplug_slot);
kfree(slot);
return -ENOMEM;
}
if (!name)
goto error_info;
hotplug_slot->name = name;
slot->magic = SLOT_MAGIC;
slot->bus = bus;
slot->number = i;
slot->devfn = PCI_DEVFN(i, 0);
......@@ -373,13 +266,9 @@ cpci_hp_register_bus(struct pci_bus *bus, u8 first, u8 last)
dbg("registering slot %s", slot->hotplug_slot->name);
status = pci_hp_register(slot->hotplug_slot);
if(status) {
if (status) {
err("pci_hp_register failed with error %d", status);
kfree(info);
kfree(name);
kfree(hotplug_slot);
kfree(slot);
return status;
goto error_name;
}
/* Add slot to our internal list */
......@@ -388,6 +277,16 @@ cpci_hp_register_bus(struct pci_bus *bus, u8 first, u8 last)
slots++;
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;
}
......@@ -399,10 +298,6 @@ cpci_hp_unregister_bus(struct pci_bus *bus)
struct list_head *next;
int status;
if(!bus) {
return -ENODEV;
}
spin_lock(&list_lock);
if(!slots) {
spin_unlock(&list_lock);
......@@ -428,7 +323,7 @@ cpci_hp_unregister_bus(struct pci_bus *bus)
}
/* This is the interrupt mode interrupt handler */
irqreturn_t
static irqreturn_t
cpci_hp_intr(int irq, void *data, struct pt_regs *regs)
{
dbg("entered cpci_hp_intr");
......@@ -891,7 +786,6 @@ cpci_hotplug_exit(void)
cleanup_slots();
}
EXPORT_SYMBOL_GPL(cpci_hp_register_controller);
EXPORT_SYMBOL_GPL(cpci_hp_unregister_controller);
EXPORT_SYMBOL_GPL(cpci_hp_register_bus);
......
......@@ -127,6 +127,7 @@ u16 cpci_get_hs_csr(struct slot* slot)
return hs_csr;
}
#if 0
u16 cpci_set_hs_csr(struct slot* slot, u16 hs_csr)
{
int hs_cap;
......@@ -156,6 +157,7 @@ u16 cpci_set_hs_csr(struct slot* slot, u16 hs_csr)
}
return new_hs_csr;
}
#endif
int cpci_check_and_clear_ins(struct slot* slot)
{
......
......@@ -76,73 +76,6 @@ static u8 enum_mask;
static struct cpci_hp_controller_ops generic_hpc_ops;
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)
{
char* str;
......
......@@ -32,6 +32,7 @@
#include <linux/config.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/errno.h>
#include <linux/pci.h>
......@@ -42,11 +43,7 @@
#define DRIVER_AUTHOR "Scott Murray <scottm@somanetworks.com>"
#define DRIVER_DESC "ZT5550 CompactPCI Hot Plug Driver"
#if !defined(CONFIG_HOTPLUG_PCI_CPCI_ZT5550_MODULE)
#define MY_NAME "cpcihp_zt5550"
#else
#define MY_NAME THIS_MODULE->name
#endif
#define dbg(format, arg...) \
do { \
......@@ -175,7 +172,7 @@ static int zt5550_hc_enable_irq(void)
return 0;
}
int zt5550_hc_disable_irq(void)
static int zt5550_hc_disable_irq(void)
{
u8 reg;
......@@ -301,7 +298,7 @@ module_exit(zt5550_exit);
MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL");
MODULE_PARM(debug, "i");
module_param(debug, bool, 644);
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");
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -271,7 +271,6 @@ struct bus_info {
***********************************************************/
extern struct list_head ibmphp_ebda_pci_rsrc_head;
extern struct list_head ibmphp_slot_head;
extern struct list_head ibmphp_res_head;
/***********************************************************
* FUNCTION PROTOTYPES *
***********************************************************/
......@@ -754,7 +753,6 @@ struct controller {
/* Functions */
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_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);
......
......@@ -1146,7 +1146,7 @@ static int enable_slot (struct hotplug_slot *hs)
* OUTPUT: SUCCESS 0 ; FAILURE: UNCONFIGURE , VALIDATE *
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;
int rc;
......
......@@ -45,7 +45,6 @@ static void fix_resources (struct bus_node *);
static struct bus_node *find_bus_wprev (u8, struct bus_node **, u8);
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)
{
......
......@@ -29,6 +29,7 @@
#include <linux/config.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/list.h>
......@@ -45,11 +46,7 @@
#include "pci_hotplug.h"
#if !defined(CONFIG_HOTPLUG_PCI_MODULE)
#define MY_NAME "pci_hotplug"
#else
#define MY_NAME THIS_MODULE->name
#endif
#define MY_NAME "pci_hotplug"
#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)
......@@ -704,7 +701,7 @@ module_exit(pci_hotplug_exit);
MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL");
MODULE_PARM(debug, "i");
module_param(debug, bool, 644);
MODULE_PARM_DESC(debug, "Debugging mode enabled or not");
EXPORT_SYMBOL_GPL(pci_hotplug_slots_subsys);
......
......@@ -35,11 +35,7 @@
#include <asm/io.h>
#include "pci_hotplug.h"
#if !defined(CONFIG_HOTPLUG_PCI_PCIE_MODULE)
#define MY_NAME "pciehp"
#else
#define MY_NAME THIS_MODULE->name
#endif
#define MY_NAME "pciehp"
extern int pciehp_poll_mode;
extern int pciehp_poll_time;
......@@ -72,9 +68,7 @@ struct pci_func {
struct pci_dev* pci_dev;
};
#define SLOT_MAGIC 0x67267321
struct slot {
u32 magic;
struct slot *next;
u8 bus;
u8 device;
......@@ -108,7 +102,7 @@ struct event_info {
struct controller {
struct controller *next;
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 slot_num_inc; /* 1 or -1 */
struct pci_resource *mem_head;
......@@ -191,7 +185,7 @@ struct resource_lists {
#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_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_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"
......@@ -202,7 +196,6 @@ struct resource_lists {
extern void pciehp_create_ctrl_files (struct controller *ctrl);
/* controller functions */
extern void pciehp_pushbutton_thread (unsigned long event_pointer);
extern int pciehprm_find_available_resources (struct controller *ctrl);
extern int pciehp_event_start_thread (void);
extern void pciehp_event_stop_thread (void);
......@@ -239,47 +232,10 @@ extern struct pci_func *pciehp_slot_list[256];
/* Inline functions */
/* 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)
static inline struct slot *pciehp_find_slot(struct controller *ctrl, u8 device)
{
struct slot *p_slot, *tmp_slot = NULL;
if (!ctrl)
return NULL;
p_slot = ctrl->slot;
dbg("p_slot = %p\n", p_slot);
......@@ -294,10 +250,10 @@ static inline struct slot *pciehp_find_slot (struct controller *ctrl, u8 device)
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;
......@@ -345,7 +301,7 @@ enum php_ctlr_type {
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 switch_change_callback,
php_intr_callback_t presence_change_callback,
......@@ -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 */
int pcie_get_ctlr_slot_config( struct controller *ctrl,
int pcie_get_ctlr_slot_config(struct controller *ctrl,
int *num_ctlr_slots,
int *first_device_num,
int *physical_slot_num,
......@@ -361,8 +317,8 @@ int pcie_get_ctlr_slot_config( struct controller *ctrl,
int *flags);
struct hpc_ops {
int (*power_on_slot ) (struct slot *slot);
int (*power_off_slot ) (struct slot *slot);
int (*power_on_slot) (struct slot *slot);
int (*power_off_slot) (struct slot *slot);
int (*get_power_status) (struct slot *slot, u8 *status);
int (*get_attention_status) (struct slot *slot, u8 *status);
int (*set_attention_status) (struct slot *slot, u8 status);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -37,7 +37,6 @@
int pciehprm_init(enum php_ctlr_type ct);
void pciehprm_cleanup(void);
int pciehprm_print_pirt(void);
void *pciehprm_get_slot(struct slot *slot);
int pciehprm_find_available_resources(struct controller *ctrl);
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);
......
......@@ -1301,6 +1301,7 @@ static struct acpi_php_slot * get_acpi_slot (
}
#if 0
void * pciehprm_get_slot(struct slot *slot)
{
struct acpi_bridge *ab = acpi_bridges_head;
......@@ -1312,6 +1313,7 @@ void * pciehprm_get_slot(struct slot *slot)
return (void *)aps;
}
#endif
static void pciehprm_dump_func_res( struct pci_func *fun)
{
......
......@@ -52,11 +52,6 @@ int pciehprm_print_pirt(void)
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)
{
......
This diff is collapsed.
......@@ -47,15 +47,13 @@ static struct device_node *find_php_slot_vio_node(char *drc_name)
{
struct device_node *child;
struct device_node *parent = of_find_node_by_name(NULL, "vdevice");
char *loc_code;
if (!parent)
return NULL;
for (child = of_get_next_child(parent, NULL);
child; child = of_get_next_child(parent, child)) {
char *loc_code;
loc_code = get_property(child, "ibm,loc-code", NULL);
if (loc_code && !strcmp(loc_code, drc_name))
return child;
......@@ -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)
{
struct device_node *dn = find_php_slot_pci_node(drc_name);
struct pci_dev *bridge_dev;
if (!dn)
return -ENODEV;
bridge_dev = slot->bridge;
if (!bridge_dev) {
printk(KERN_ERR "%s: unexpected null bridge device\n",
......@@ -359,6 +353,12 @@ int dlpar_remove_slot(char *drc_name)
if (down_interruptible(&rpadlpar_sem))
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);
if (!slot) {
rc = -EINVAL;
......
......@@ -62,8 +62,6 @@ extern int debug;
#define info(format, arg...) printk(KERN_INFO "%s: " format, MY_NAME , ## arg)
#define warn(format, arg...) printk(KERN_WARNING "%s: " format, MY_NAME , ## arg)
#define SLOT_MAGIC 0x67267322
/* slot types */
#define VIO_DEV 1
#define PCI_DEV 2
......@@ -79,7 +77,6 @@ extern int debug;
* struct slot - slot information for each *physical* slot
*/
struct slot {
u32 magic;
int state;
u32 index;
u32 type;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -94,6 +94,7 @@ int register_vio_slot(struct device_node *dn)
slot->state = NOT_CONFIGURED;
if (setup_vio_hotplug_slot_info(slot))
goto exit_rc;
strcpy(slot->name, slot->dev.vio_dev->dev.bus_id);
info("%s: registered VIO device[name=%s vio_dev=%p]\n",
__FUNCTION__, slot->name, slot->dev.vio_dev);
rc = register_slot(slot);
......
......@@ -205,7 +205,6 @@ struct resource_lists {
extern void shpchp_create_ctrl_files (struct controller *ctrl);
/* controller functions */
extern void shpchp_pushbutton_thread(unsigned long event_pointer);
extern int shpchprm_find_available_resources(struct controller *ctrl);
extern int shpchp_event_start_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 @@
int shpchprm_init(enum php_ctlr_type ct);
void shpchprm_cleanup(void);
int shpchprm_print_pirt(void);
void *shpchprm_get_slot(struct slot *slot);
int shpchprm_find_available_resources(struct controller *ctrl);
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);
......
......@@ -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_php_slot *aps = get_acpi_slot (ab, slot->number);
......@@ -1310,6 +1311,7 @@ void * shpchprm_get_slot(struct slot *slot)
return (void *)aps;
}
#endif
static void shpchprm_dump_func_res( struct pci_func *fun)
{
......
......@@ -55,11 +55,6 @@ int shpchprm_print_pirt()
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 offset = devnum - ctrl->slot_device_offset;
......
......@@ -51,11 +51,6 @@ int shpchprm_print_pirt(void)
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 offset = devnum - ctrl->slot_device_offset;
......
......@@ -640,7 +640,7 @@ pci_generic_prep_mwi(struct pci_dev *dev)
if (cacheline_size == pci_cache_line_size)
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));
return -EINVAL;
......
This diff is collapsed.
......@@ -193,7 +193,7 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child)
return;
if (dev->transparent) {
printk("Transparent bridge - %s\n", pci_name(dev));
printk(KERN_INFO "PCI: Transparent bridge - %s\n", pci_name(dev));
for(i = 0; i < PCI_BUS_NUM_RESOURCES; i++)
child->resource[i] = child->parent->resource[i];
return;
......
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