Release 4.16 drivers/pci/hotplug/rpaphp_pci.c
// SPDX-License-Identifier: GPL-2.0+
/*
* PCI Hot Plug Controller Driver for RPA-compliant PPC64 platform.
* Copyright (C) 2003 Linda Xie <lxie@us.ibm.com>
*
* All rights reserved.
*
* Send feedback to <lxie@us.ibm.com>
*
*/
#include <linux/pci.h>
#include <linux/string.h>
#include <asm/pci-bridge.h>
#include <asm/rtas.h>
#include <asm/machdep.h>
#include "../pci.h" /* for pci_add_new_bus */
#include "rpaphp.h"
int rpaphp_get_sensor_state(struct slot *slot, int *state)
{
int rc;
int setlevel;
rc = rtas_get_sensor(DR_ENTITY_SENSE, slot->index, state);
if (rc < 0) {
if (rc == -EFAULT || rc == -EEXIST) {
dbg("%s: slot must be power up to get sensor-state\n",
__func__);
/* some slots have to be powered up
* before get-sensor will succeed.
*/
rc = rtas_set_power_level(slot->power_domain, POWER_ON,
&setlevel);
if (rc < 0) {
dbg("%s: power on slot[%s] failed rc=%d.\n",
__func__, slot->name, rc);
} else {
rc = rtas_get_sensor(DR_ENTITY_SENSE,
slot->index, state);
}
} else if (rc == -ENODEV)
info("%s: slot is unusable\n", __func__);
else
err("%s failed to get sensor state\n", __func__);
}
return rc;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linda Xie | 125 | 89.29% | 2 | 40.00% |
Paul Mackerras | 10 | 7.14% | 1 | 20.00% |
Harvey Harrison | 4 | 2.86% | 1 | 20.00% |
Björn Helgaas | 1 | 0.71% | 1 | 20.00% |
Total | 140 | 100.00% | 5 | 100.00% |
/**
* rpaphp_enable_slot - record slot state, config pci device
* @slot: target &slot
*
* Initialize values in the slot, and the hotplug_slot info
* structures to indicate if there is a pci card plugged into
* the slot. If the slot is not empty, run the pcibios routine
* to get pcibios stuff correctly set up.
*/
int rpaphp_enable_slot(struct slot *slot)
{
int rc, level, state;
struct pci_bus *bus;
struct hotplug_slot_info *info = slot->hotplug_slot->info;
info->adapter_status = NOT_VALID;
slot->state = EMPTY;
/* 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;
/* Figure out if there is an adapter in the slot */
rc = rpaphp_get_sensor_state(slot, &state);
if (rc)
return rc;
bus = pci_find_bus_by_node(slot->dn);
if (!bus) {
err("%s: no pci_bus for dn %pOF\n", __func__, slot->dn);
return -EINVAL;
}
info->adapter_status = EMPTY;
slot->bus = bus;
slot->pci_devs = &bus->devices;
/* if there's an adapter in the slot, go add the pci devices */
if (state == PRESENT) {
info->adapter_status = NOT_CONFIGURED;
slot->state = NOT_CONFIGURED;
/* non-empty slot has to have child */
if (!slot->dn->child) {
err("%s: slot[%s]'s device_node doesn't have child for adapter\n",
__func__, slot->name);
return -EINVAL;
}
if (list_empty(&bus->devices))
pci_hp_add_devices(bus);
if (!list_empty(&bus->devices)) {
info->adapter_status = CONFIGURED;
slot->state = CONFIGURED;
}
if (rpaphp_debug) {
struct pci_dev *dev;
dbg("%s: pci_devs of slot[%pOF]\n", __func__, slot->dn);
list_for_each_entry(dev, &bus->devices, bus_list)
dbg("\t%s\n", pci_name(dev));
}
}
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linas Vepstas | 175 | 64.34% | 7 | 35.00% |
Linda Xie | 58 | 21.32% | 3 | 15.00% |
John Rose | 29 | 10.66% | 4 | 20.00% |
Harvey Harrison | 3 | 1.10% | 1 | 5.00% |
Paul Mackerras | 2 | 0.74% | 1 | 5.00% |
Gavin Shan | 2 | 0.74% | 2 | 10.00% |
Rob Herring | 2 | 0.74% | 1 | 5.00% |
Kristen Carlson Accardi | 1 | 0.37% | 1 | 5.00% |
Total | 272 | 100.00% | 20 | 100.00% |
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linda Xie | 196 | 44.85% | 4 | 14.81% |
Linas Vepstas | 175 | 40.05% | 7 | 25.93% |
John Rose | 29 | 6.64% | 4 | 14.81% |
Paul Mackerras | 12 | 2.75% | 1 | 3.70% |
Harvey Harrison | 7 | 1.60% | 1 | 3.70% |
Tim Schmielau | 3 | 0.69% | 1 | 3.70% |
Olof Johansson | 3 | 0.69% | 1 | 3.70% |
David Gibson | 3 | 0.69% | 1 | 3.70% |
Björn Helgaas | 3 | 0.69% | 2 | 7.41% |
Rob Herring | 2 | 0.46% | 1 | 3.70% |
Gavin Shan | 2 | 0.46% | 2 | 7.41% |
Kristen Carlson Accardi | 1 | 0.23% | 1 | 3.70% |
Randy Dunlap | 1 | 0.23% | 1 | 3.70% |
Total | 437 | 100.00% | 27 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.