Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 53367
b: refs/heads/master
c: bf0af51
h: refs/heads/master
i:
  53365: fec5f22
  53363: c5926db
  53359: 2c5034b
v: v3
  • Loading branch information
Linas Vepstas authored and Greg Kroah-Hartman committed May 3, 2007
1 parent 166c777 commit bfc0e42
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 48 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 427310ff02e80cc80826407c0121cec3694c9e7d
refs/heads/master: bf0af511fcc856649a2a39c627828695b580d124
1 change: 0 additions & 1 deletion trunk/drivers/pci/hotplug/rpaphp.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ extern struct list_head rpaphp_slot_head;
/* rpaphp_pci.c */
extern int rpaphp_enable_pci_slot(struct slot *slot);
extern int rpaphp_register_pci_slot(struct slot *slot);
extern int rpaphp_get_pci_adapter_status(struct slot *slot, int is_init, u8 * value);
extern int rpaphp_get_sensor_state(struct slot *slot, int *state);

/* rpaphp_core.c */
Expand Down
16 changes: 13 additions & 3 deletions trunk/drivers/pci/hotplug/rpaphp_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,22 @@ static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 * value)
static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 * value)
{
struct slot *slot = (struct slot *)hotplug_slot->private;
int retval = 0;
int rc, state;

down(&rpaphp_sem);
retval = rpaphp_get_pci_adapter_status(slot, 0, value);
rc = rpaphp_get_sensor_state(slot, &state);
up(&rpaphp_sem);
return retval;

*value = NOT_VALID;
if (rc)
return rc;

if (state == EMPTY)
*value = EMPTY;
else if (state == PRESENT)
*value = slot->state;

return 0;
}

static int get_max_bus_speed(struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value)
Expand Down
59 changes: 16 additions & 43 deletions trunk/drivers/pci/hotplug/rpaphp_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,43 +64,6 @@ int rpaphp_get_sensor_state(struct slot *slot, int *state)
return rc;
}

/**
* get_pci_adapter_status - get the status of a slot
*
* 0-- slot is empty
* 1-- adapter is configured
* 2-- adapter is not configured
* 3-- not valid
*/
int rpaphp_get_pci_adapter_status(struct slot *slot, int is_init, u8 * value)
{
struct pci_bus *bus;
int state, rc;

*value = NOT_VALID;
rc = rpaphp_get_sensor_state(slot, &state);
if (rc)
goto exit;

if (state == EMPTY)
*value = EMPTY;
else if (state == PRESENT) {
if (!is_init) {
/* at run-time slot->state can be changed by */
/* config/unconfig adapter */
*value = slot->state;
} else {
bus = pcibios_find_pci_bus(slot->dn);
if (bus && !list_empty(&bus->devices))
*value = CONFIGURED;
else
*value = NOT_CONFIGURED;
}
}
exit:
return rc;
}

static void print_slot_pci_funcs(struct pci_bus *bus)
{
struct device_node *dn;
Expand Down Expand Up @@ -183,20 +146,30 @@ static int setup_pci_slot(struct slot *slot)

int rpaphp_register_pci_slot(struct slot *slot)
{
int rc, level;
int rc, level, state;
struct pci_bus *bus;
struct hotplug_slot_info *info = slot->hotplug_slot->info;

/* Find out if the power is turned on for the slot */
rc = rtas_get_power_level(slot->power_domain, &level);
if (rc)
return rc;
info->power_status = level;

rpaphp_get_pci_adapter_status(slot, 1, &info->adapter_status);
/* Figure out if there is an adapter in the slot */
info->adapter_status = NOT_VALID;
rc = rpaphp_get_sensor_state(slot, &state);
if (rc)
return rc;

if (info->adapter_status == NOT_VALID) {
err("%s: NOT_VALID: skip dn->full_name=%s\n",
__FUNCTION__, slot->dn->full_name);
return -EINVAL;
if (state == EMPTY)
info->adapter_status = EMPTY;
else if (state == PRESENT) {
bus = pcibios_find_pci_bus(slot->dn);
if (bus && !list_empty(&bus->devices))
info->adapter_status = CONFIGURED;
else
info->adapter_status = NOT_CONFIGURED;
}

if (setup_pci_slot(slot))
Expand Down

0 comments on commit bfc0e42

Please sign in to comment.