Commit 3b2b54d3 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman Committed by Deepak Saxena

PCI Hotplug: clean up a lot of global symbols that do not need to be.

parent 6e8c2276
......@@ -218,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);
......@@ -239,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);
......
......@@ -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
......@@ -1140,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;
......@@ -1165,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)
......@@ -1244,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)
......
......@@ -84,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);
......
......@@ -323,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");
......
......@@ -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)
{
......
......@@ -172,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;
......
......@@ -431,7 +431,6 @@ extern int cpqhp_return_board_resources (struct pci_func * func, struct resource
extern void cpqhp_destroy_resource_list (struct resource_lists * resources);
extern int cpqhp_configure_device (struct controller* ctrl, struct pci_func* func);
extern int cpqhp_unconfigure_device (struct pci_func* func);
extern struct slot *cpqhp_find_slot (struct controller *ctrl, u8 device);
/* Global variables */
extern int cpqhp_debug;
......
......@@ -142,7 +142,7 @@ static u8 handle_switch_change(u8 change, struct controller * ctrl)
* @ctrl: scan lots of this controller
* @device: the device id to find
*/
struct slot *cpqhp_find_slot(struct controller *ctrl, u8 device)
static struct slot *cpqhp_find_slot(struct controller *ctrl, u8 device)
{
struct slot *slot = ctrl->slot;
......@@ -2226,7 +2226,7 @@ int cpqhp_process_SS(struct controller *ctrl, struct pci_func *func)
* @num_of_slots: number of slots to use
* @direction: 1 to start from the left side, 0 to start right.
*/
void switch_leds(struct controller *ctrl, const int num_of_slots,
static void switch_leds(struct controller *ctrl, const int num_of_slots,
u32 *work_LED, const int direction)
{
int loop;
......
......@@ -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)
{
......
......@@ -196,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);
......
......@@ -1395,6 +1395,81 @@ static void pushbutton_helper_thread(unsigned long data)
}
/**
* pciehp_pushbutton_thread
*
* Scheduled procedure to handle blocking stuff for the pushbuttons
* Handles all pending events and exits.
*
*/
static void pciehp_pushbutton_thread(unsigned long slot)
{
struct slot *p_slot = (struct slot *) slot;
u8 getstatus;
int rc;
pushbutton_pending = 0;
if (!p_slot) {
dbg("%s: Error! slot NULL\n", __FUNCTION__);
return;
}
p_slot->hpc_ops->get_power_status(p_slot, &getstatus);
if (getstatus) {
p_slot->state = POWEROFF_STATE;
dbg("In power_down_board, b:d(%x:%x)\n", p_slot->bus, p_slot->device);
if (pciehp_disable_slot(p_slot)) {
/* Wait for exclusive access to hardware */
down(&p_slot->ctrl->crit_sect);
/* Turn on the Attention LED */
rc = p_slot->hpc_ops->set_attention_status(p_slot, 1);
if (rc) {
err("%s: Issue of Set Atten Indicator On command failed\n", __FUNCTION__);
return;
}
/* Wait for the command to complete */
wait_for_ctrl_irq (p_slot->ctrl);
/* Done with exclusive hardware access */
up(&p_slot->ctrl->crit_sect);
}
p_slot->state = STATIC_STATE;
} else {
p_slot->state = POWERON_STATE;
dbg("In add_board, b:d(%x:%x)\n", p_slot->bus, p_slot->device);
if (pciehp_enable_slot(p_slot)) {
/* Wait for exclusive access to hardware */
down(&p_slot->ctrl->crit_sect);
/* Turn off the green LED */
rc = p_slot->hpc_ops->set_attention_status(p_slot, 1);
if (rc) {
err("%s: Issue of Set Atten Indicator On command failed\n", __FUNCTION__);
return;
}
/* Wait for the command to complete */
wait_for_ctrl_irq (p_slot->ctrl);
p_slot->hpc_ops->green_led_off(p_slot);
/* Wait for the command to complete */
wait_for_ctrl_irq (p_slot->ctrl);
/* Done with exclusive hardware access */
up(&p_slot->ctrl->crit_sect);
}
p_slot->state = STATIC_STATE;
}
return;
}
/* this is the main worker thread */
static int event_thread(void* data)
{
......@@ -1608,81 +1683,6 @@ static void interrupt_event_handler(struct controller *ctrl)
}
/**
* pciehp_pushbutton_thread
*
* Scheduled procedure to handle blocking stuff for the pushbuttons
* Handles all pending events and exits.
*
*/
void pciehp_pushbutton_thread(unsigned long slot)
{
struct slot *p_slot = (struct slot *) slot;
u8 getstatus;
int rc;
pushbutton_pending = 0;
if (!p_slot) {
dbg("%s: Error! slot NULL\n", __FUNCTION__);
return;
}
p_slot->hpc_ops->get_power_status(p_slot, &getstatus);
if (getstatus) {
p_slot->state = POWEROFF_STATE;
dbg("In power_down_board, b:d(%x:%x)\n", p_slot->bus, p_slot->device);
if (pciehp_disable_slot(p_slot)) {
/* Wait for exclusive access to hardware */
down(&p_slot->ctrl->crit_sect);
/* Turn on the Attention LED */
rc = p_slot->hpc_ops->set_attention_status(p_slot, 1);
if (rc) {
err("%s: Issue of Set Atten Indicator On command failed\n", __FUNCTION__);
return;
}
/* Wait for the command to complete */
wait_for_ctrl_irq (p_slot->ctrl);
/* Done with exclusive hardware access */
up(&p_slot->ctrl->crit_sect);
}
p_slot->state = STATIC_STATE;
} else {
p_slot->state = POWERON_STATE;
dbg("In add_board, b:d(%x:%x)\n", p_slot->bus, p_slot->device);
if (pciehp_enable_slot(p_slot)) {
/* Wait for exclusive access to hardware */
down(&p_slot->ctrl->crit_sect);
/* Turn off the green LED */
rc = p_slot->hpc_ops->set_attention_status(p_slot, 1);
if (rc) {
err("%s: Issue of Set Atten Indicator On command failed\n", __FUNCTION__);
return;
}
/* Wait for the command to complete */
wait_for_ctrl_irq (p_slot->ctrl);
p_slot->hpc_ops->green_led_off(p_slot);
/* Wait for the command to complete */
wait_for_ctrl_irq (p_slot->ctrl);
/* Done with exclusive hardware access */
up(&p_slot->ctrl->crit_sect);
}
p_slot->state = STATIC_STATE;
}
return;
}
int pciehp_enable_slot(struct slot *p_slot)
{
u8 getstatus = 0;
......
......@@ -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)
{
......
......@@ -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);
......
......@@ -1796,6 +1796,81 @@ static void pushbutton_helper_thread (unsigned long data)
}
/**
* shpchp_pushbutton_thread
*
* Scheduled procedure to handle blocking stuff for the pushbuttons
* Handles all pending events and exits.
*
*/
static void shpchp_pushbutton_thread (unsigned long slot)
{
struct slot *p_slot = (struct slot *) slot;
u8 getstatus;
int rc;
pushbutton_pending = 0;
if (!p_slot) {
dbg("%s: Error! slot NULL\n", __FUNCTION__);
return;
}
p_slot->hpc_ops->get_power_status(p_slot, &getstatus);
if (getstatus) {
p_slot->state = POWEROFF_STATE;
dbg("In power_down_board, b:d(%x:%x)\n", p_slot->bus, p_slot->device);
if (shpchp_disable_slot(p_slot)) {
/* Wait for exclusive access to hardware */
down(&p_slot->ctrl->crit_sect);
/* Turn on the Attention LED */
rc = p_slot->hpc_ops->set_attention_status(p_slot, 1);
if (rc) {
err("%s: Issue of Set Atten Indicator On command failed\n", __FUNCTION__);
return;
}
/* Wait for the command to complete */
wait_for_ctrl_irq (p_slot->ctrl);
/* Done with exclusive hardware access */
up(&p_slot->ctrl->crit_sect);
}
p_slot->state = STATIC_STATE;
} else {
p_slot->state = POWERON_STATE;
dbg("In add_board, b:d(%x:%x)\n", p_slot->bus, p_slot->device);
if (shpchp_enable_slot(p_slot)) {
/* Wait for exclusive access to hardware */
down(&p_slot->ctrl->crit_sect);
/* Turn off the green LED */
rc = p_slot->hpc_ops->set_attention_status(p_slot, 1);
if (rc) {
err("%s: Issue of Set Atten Indicator On command failed\n", __FUNCTION__);
return;
}
/* Wait for the command to complete */
wait_for_ctrl_irq (p_slot->ctrl);
p_slot->hpc_ops->green_led_off(p_slot);
/* Wait for the command to complete */
wait_for_ctrl_irq (p_slot->ctrl);
/* Done with exclusive hardware access */
up(&p_slot->ctrl->crit_sect);
}
p_slot->state = STATIC_STATE;
}
return;
}
/* this is the main worker thread */
static int event_thread(void* data)
{
......@@ -2012,81 +2087,6 @@ static void interrupt_event_handler(struct controller *ctrl)
}
/**
* shpchp_pushbutton_thread
*
* Scheduled procedure to handle blocking stuff for the pushbuttons
* Handles all pending events and exits.
*
*/
void shpchp_pushbutton_thread (unsigned long slot)
{
struct slot *p_slot = (struct slot *) slot;
u8 getstatus;
int rc;
pushbutton_pending = 0;
if (!p_slot) {
dbg("%s: Error! slot NULL\n", __FUNCTION__);
return;
}
p_slot->hpc_ops->get_power_status(p_slot, &getstatus);
if (getstatus) {
p_slot->state = POWEROFF_STATE;
dbg("In power_down_board, b:d(%x:%x)\n", p_slot->bus, p_slot->device);
if (shpchp_disable_slot(p_slot)) {
/* Wait for exclusive access to hardware */
down(&p_slot->ctrl->crit_sect);
/* Turn on the Attention LED */
rc = p_slot->hpc_ops->set_attention_status(p_slot, 1);
if (rc) {
err("%s: Issue of Set Atten Indicator On command failed\n", __FUNCTION__);
return;
}
/* Wait for the command to complete */
wait_for_ctrl_irq (p_slot->ctrl);
/* Done with exclusive hardware access */
up(&p_slot->ctrl->crit_sect);
}
p_slot->state = STATIC_STATE;
} else {
p_slot->state = POWERON_STATE;
dbg("In add_board, b:d(%x:%x)\n", p_slot->bus, p_slot->device);
if (shpchp_enable_slot(p_slot)) {
/* Wait for exclusive access to hardware */
down(&p_slot->ctrl->crit_sect);
/* Turn off the green LED */
rc = p_slot->hpc_ops->set_attention_status(p_slot, 1);
if (rc) {
err("%s: Issue of Set Atten Indicator On command failed\n", __FUNCTION__);
return;
}
/* Wait for the command to complete */
wait_for_ctrl_irq (p_slot->ctrl);
p_slot->hpc_ops->green_led_off(p_slot);
/* Wait for the command to complete */
wait_for_ctrl_irq (p_slot->ctrl);
/* Done with exclusive hardware access */
up(&p_slot->ctrl->crit_sect);
}
p_slot->state = STATIC_STATE;
}
return;
}
int shpchp_enable_slot (struct slot *p_slot)
{
u8 getstatus = 0;
......
......@@ -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;
......
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