PCI: Make current and maximum bus speeds part of the PCI core
Move the max_bus_speed and cur_bus_speed into the pci_bus. Expose the values through the PCI slot driver instead of the hotplug slot driver. Update all the hotplug drivers to use the pci_bus instead of their own data structures. Signed-off-by: Matthew Wilcox <willy@linux.intel.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
This commit is contained in:
committed by
Jesse Barnes
parent
536c8cb49e
commit
3749c51ac6
@ -583,30 +583,6 @@ static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int get_max_bus_speed (struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value)
|
||||
{
|
||||
struct slot *slot = hotplug_slot->private;
|
||||
struct controller *ctrl = slot->ctrl;
|
||||
|
||||
dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
|
||||
|
||||
*value = ctrl->speed_capability;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int get_cur_bus_speed (struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value)
|
||||
{
|
||||
struct slot *slot = hotplug_slot->private;
|
||||
struct controller *ctrl = slot->ctrl;
|
||||
|
||||
dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
|
||||
|
||||
*value = ctrl->speed;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct hotplug_slot_ops cpqphp_hotplug_slot_ops = {
|
||||
.set_attention_status = set_attention_status,
|
||||
.enable_slot = process_SI,
|
||||
@ -616,8 +592,6 @@ static struct hotplug_slot_ops cpqphp_hotplug_slot_ops = {
|
||||
.get_attention_status = get_attention_status,
|
||||
.get_latch_status = get_latch_status,
|
||||
.get_adapter_status = get_adapter_status,
|
||||
.get_max_bus_speed = get_max_bus_speed,
|
||||
.get_cur_bus_speed = get_cur_bus_speed,
|
||||
};
|
||||
|
||||
#define SLOT_NAME_SIZE 10
|
||||
@ -629,6 +603,7 @@ static int ctrl_slot_setup(struct controller *ctrl,
|
||||
struct slot *slot;
|
||||
struct hotplug_slot *hotplug_slot;
|
||||
struct hotplug_slot_info *hotplug_slot_info;
|
||||
struct pci_bus *bus = ctrl->pci_bus;
|
||||
u8 number_of_slots;
|
||||
u8 slot_device;
|
||||
u8 slot_number;
|
||||
@ -694,7 +669,7 @@ static int ctrl_slot_setup(struct controller *ctrl,
|
||||
slot->capabilities |= PCISLOT_64_BIT_SUPPORTED;
|
||||
if (is_slot66mhz(slot))
|
||||
slot->capabilities |= PCISLOT_66_MHZ_SUPPORTED;
|
||||
if (ctrl->speed == PCI_SPEED_66MHz)
|
||||
if (bus->cur_bus_speed == PCI_SPEED_66MHz)
|
||||
slot->capabilities |= PCISLOT_66_MHZ_OPERATION;
|
||||
|
||||
ctrl_slot =
|
||||
@ -844,6 +819,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
u32 rc;
|
||||
struct controller *ctrl;
|
||||
struct pci_func *func;
|
||||
struct pci_bus *bus;
|
||||
int err;
|
||||
|
||||
err = pci_enable_device(pdev);
|
||||
@ -852,6 +828,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
pci_name(pdev), err);
|
||||
return err;
|
||||
}
|
||||
bus = pdev->subordinate;
|
||||
|
||||
/* Need to read VID early b/c it's used to differentiate CPQ and INTC
|
||||
* discovery
|
||||
@ -929,22 +906,22 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
pci_read_config_byte(pdev, 0x41, &bus_cap);
|
||||
if (bus_cap & 0x80) {
|
||||
dbg("bus max supports 133MHz PCI-X\n");
|
||||
ctrl->speed_capability = PCI_SPEED_133MHz_PCIX;
|
||||
bus->max_bus_speed = PCI_SPEED_133MHz_PCIX;
|
||||
break;
|
||||
}
|
||||
if (bus_cap & 0x40) {
|
||||
dbg("bus max supports 100MHz PCI-X\n");
|
||||
ctrl->speed_capability = PCI_SPEED_100MHz_PCIX;
|
||||
bus->max_bus_speed = PCI_SPEED_100MHz_PCIX;
|
||||
break;
|
||||
}
|
||||
if (bus_cap & 20) {
|
||||
dbg("bus max supports 66MHz PCI-X\n");
|
||||
ctrl->speed_capability = PCI_SPEED_66MHz_PCIX;
|
||||
bus->max_bus_speed = PCI_SPEED_66MHz_PCIX;
|
||||
break;
|
||||
}
|
||||
if (bus_cap & 10) {
|
||||
dbg("bus max supports 66MHz PCI\n");
|
||||
ctrl->speed_capability = PCI_SPEED_66MHz;
|
||||
bus->max_bus_speed = PCI_SPEED_66MHz;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -955,7 +932,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
case PCI_SUB_HPC_ID:
|
||||
/* Original 6500/7000 implementation */
|
||||
ctrl->slot_switch_type = 1;
|
||||
ctrl->speed_capability = PCI_SPEED_33MHz;
|
||||
bus->max_bus_speed = PCI_SPEED_33MHz;
|
||||
ctrl->push_button = 0;
|
||||
ctrl->pci_config_space = 1;
|
||||
ctrl->defeature_PHP = 1;
|
||||
@ -966,7 +943,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
/* First Pushbutton implementation */
|
||||
ctrl->push_flag = 1;
|
||||
ctrl->slot_switch_type = 1;
|
||||
ctrl->speed_capability = PCI_SPEED_33MHz;
|
||||
bus->max_bus_speed = PCI_SPEED_33MHz;
|
||||
ctrl->push_button = 1;
|
||||
ctrl->pci_config_space = 1;
|
||||
ctrl->defeature_PHP = 1;
|
||||
@ -976,7 +953,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
case PCI_SUB_HPC_ID_INTC:
|
||||
/* Third party (6500/7000) */
|
||||
ctrl->slot_switch_type = 1;
|
||||
ctrl->speed_capability = PCI_SPEED_33MHz;
|
||||
bus->max_bus_speed = PCI_SPEED_33MHz;
|
||||
ctrl->push_button = 0;
|
||||
ctrl->pci_config_space = 1;
|
||||
ctrl->defeature_PHP = 1;
|
||||
@ -987,7 +964,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
/* First 66 Mhz implementation */
|
||||
ctrl->push_flag = 1;
|
||||
ctrl->slot_switch_type = 1;
|
||||
ctrl->speed_capability = PCI_SPEED_66MHz;
|
||||
bus->max_bus_speed = PCI_SPEED_66MHz;
|
||||
ctrl->push_button = 1;
|
||||
ctrl->pci_config_space = 1;
|
||||
ctrl->defeature_PHP = 1;
|
||||
@ -998,7 +975,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
/* First PCI-X implementation, 100MHz */
|
||||
ctrl->push_flag = 1;
|
||||
ctrl->slot_switch_type = 1;
|
||||
ctrl->speed_capability = PCI_SPEED_100MHz_PCIX;
|
||||
bus->max_bus_speed = PCI_SPEED_100MHz_PCIX;
|
||||
ctrl->push_button = 1;
|
||||
ctrl->pci_config_space = 1;
|
||||
ctrl->defeature_PHP = 1;
|
||||
@ -1015,9 +992,9 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
case PCI_VENDOR_ID_INTEL:
|
||||
/* Check for speed capability (0=33, 1=66) */
|
||||
if (subsystem_deviceid & 0x0001)
|
||||
ctrl->speed_capability = PCI_SPEED_66MHz;
|
||||
bus->max_bus_speed = PCI_SPEED_66MHz;
|
||||
else
|
||||
ctrl->speed_capability = PCI_SPEED_33MHz;
|
||||
bus->max_bus_speed = PCI_SPEED_33MHz;
|
||||
|
||||
/* Check for push button */
|
||||
if (subsystem_deviceid & 0x0002)
|
||||
@ -1079,7 +1056,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
pdev->bus->number);
|
||||
|
||||
dbg("Hotplug controller capabilities:\n");
|
||||
dbg(" speed_capability %d\n", ctrl->speed_capability);
|
||||
dbg(" speed_capability %d\n", bus->max_bus_speed);
|
||||
dbg(" slot_switch_type %s\n", ctrl->slot_switch_type ?
|
||||
"switch present" : "no switch");
|
||||
dbg(" defeature_PHP %s\n", ctrl->defeature_PHP ?
|
||||
@ -1142,7 +1119,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
}
|
||||
|
||||
/* Check for 66Mhz operation */
|
||||
ctrl->speed = get_controller_speed(ctrl);
|
||||
bus->cur_bus_speed = get_controller_speed(ctrl);
|
||||
|
||||
|
||||
/********************************************************
|
||||
|
Reference in New Issue
Block a user