Commit e55e3391 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

PCI Hotplug: added speed status to the Compaq driver.

parent b58bae0f
...@@ -305,8 +305,8 @@ struct controller { ...@@ -305,8 +305,8 @@ struct controller {
u8 first_slot; u8 first_slot;
u8 add_support; u8 add_support;
u8 push_flag; u8 push_flag;
u8 speed; /* 0 = 33MHz, 1 = 66MHz */ enum pci_bus_speed speed;
u8 speed_capability; /* 0 = 33MHz, 1 = 66MHz */ enum pci_bus_speed speed_capability;
u8 push_button; /* 0 = no pushbutton, 1 = pushbutton present */ u8 push_button; /* 0 = no pushbutton, 1 = pushbutton present */
u8 slot_switch_type; /* 0 = no switch, 1 = switch present */ u8 slot_switch_type; /* 0 = no switch, 1 = switch present */
u8 defeature_PHP; /* 0 = PHP not supported, 1 = PHP supported */ u8 defeature_PHP; /* 0 = PHP not supported, 1 = PHP supported */
...@@ -321,9 +321,6 @@ struct controller { ...@@ -321,9 +321,6 @@ struct controller {
wait_queue_head_t queue; /* sleep & wake process */ wait_queue_head_t queue; /* sleep & wake process */
}; };
#define CTRL_SPEED_33MHz 0
#define CTRL_SPEED_66MHz 1
struct irq_mapping { struct irq_mapping {
u8 barber_pole; u8 barber_pole;
u8 valid_INT; u8 valid_INT;
...@@ -635,7 +632,7 @@ static inline u8 get_controller_speed (struct controller *ctrl) ...@@ -635,7 +632,7 @@ static inline u8 get_controller_speed (struct controller *ctrl)
u16 misc; u16 misc;
misc = readw(ctrl->hpc_reg + MISC); misc = readw(ctrl->hpc_reg + MISC);
return (misc & 0x0800) ? 1 : 0; return (misc & 0x0800) ? PCI_SPEED_66MHz : PCI_SPEED_33MHz;
} }
......
...@@ -79,6 +79,8 @@ static int get_power_status (struct hotplug_slot *slot, u8 *value); ...@@ -79,6 +79,8 @@ 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_attention_status (struct hotplug_slot *slot, u8 *value);
static int get_latch_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 int get_adapter_status (struct hotplug_slot *slot, u8 *value);
static int get_max_bus_speed (struct hotplug_slot *slot, enum pci_bus_speed *value);
static int get_cur_bus_speed (struct hotplug_slot *slot, enum pci_bus_speed *value);
static struct hotplug_slot_ops cpqphp_hotplug_slot_ops = { static struct hotplug_slot_ops cpqphp_hotplug_slot_ops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
...@@ -90,6 +92,8 @@ static struct hotplug_slot_ops cpqphp_hotplug_slot_ops = { ...@@ -90,6 +92,8 @@ static struct hotplug_slot_ops cpqphp_hotplug_slot_ops = {
.get_attention_status = get_attention_status, .get_attention_status = get_attention_status,
.get_latch_status = get_latch_status, .get_latch_status = get_latch_status,
.get_adapter_status = get_adapter_status, .get_adapter_status = get_adapter_status,
.get_max_bus_speed = get_max_bus_speed,
.get_cur_bus_speed = get_cur_bus_speed,
}; };
...@@ -378,7 +382,7 @@ static int ctrl_slot_setup (struct controller * ctrl, void *smbios_start, void * ...@@ -378,7 +382,7 @@ static int ctrl_slot_setup (struct controller * ctrl, void *smbios_start, void *
new_slot->capabilities |= PCISLOT_64_BIT_SUPPORTED; new_slot->capabilities |= PCISLOT_64_BIT_SUPPORTED;
if (is_slot66mhz(new_slot)) if (is_slot66mhz(new_slot))
new_slot->capabilities |= PCISLOT_66_MHZ_SUPPORTED; new_slot->capabilities |= PCISLOT_66_MHZ_SUPPORTED;
if (ctrl->speed == 1) if (ctrl->speed == PCI_SPEED_66MHz)
new_slot->capabilities |= PCISLOT_66_MHZ_OPERATION; new_slot->capabilities |= PCISLOT_66_MHZ_OPERATION;
ctrl_slot = slot_device - (readb(ctrl->hpc_reg + SLOT_MASK) >> 4); ctrl_slot = slot_device - (readb(ctrl->hpc_reg + SLOT_MASK) >> 4);
...@@ -782,6 +786,44 @@ static int get_adapter_status (struct hotplug_slot *hotplug_slot, u8 *value) ...@@ -782,6 +786,44 @@ static int get_adapter_status (struct hotplug_slot *hotplug_slot, u8 *value)
return 0; return 0;
} }
static int get_max_bus_speed (struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value)
{
struct slot *slot = get_slot (hotplug_slot, __FUNCTION__);
struct controller *ctrl;
if (slot == NULL)
return -ENODEV;
dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
ctrl = slot->ctrl;
if (ctrl == NULL)
return -ENODEV;
*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 = get_slot (hotplug_slot, __FUNCTION__);
struct controller *ctrl;
if (slot == NULL)
return -ENODEV;
dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
ctrl = slot->ctrl;
if (ctrl == NULL)
return -ENODEV;
*value = ctrl->speed;
return 0;
}
static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{ {
u8 num_of_slots = 0; u8 num_of_slots = 0;
...@@ -853,28 +895,28 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -853,28 +895,28 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
case PCI_SUB_HPC_ID: case PCI_SUB_HPC_ID:
/* Original 6500/7000 implementation */ /* Original 6500/7000 implementation */
ctrl->slot_switch_type = 1; // Switch is present ctrl->slot_switch_type = 1; // Switch is present
ctrl->speed_capability = CTRL_SPEED_33MHz; ctrl->speed_capability = PCI_SPEED_33MHz;
ctrl->push_button = 0; // No pushbutton ctrl->push_button = 0; // No pushbutton
ctrl->pci_config_space = 1; // Index/data access to working registers 0 = not supported, 1 = supported ctrl->pci_config_space = 1; // Index/data access to working registers 0 = not supported, 1 = supported
ctrl->defeature_PHP = 1; // PHP is supported ctrl->defeature_PHP = 1; // PHP is supported
ctrl->pcix_support = 0; // PCI-X not supported ctrl->pcix_support = 0; // PCI-X not supported
ctrl->pcix_speed_capability = 0; // N/A since PCI-X not supported ctrl->pcix_speed_capability = 0; // N/A since PCI-X not supported
break; break;
case PCI_SUB_HPC_ID2: case PCI_SUB_HPC_ID2:
/* First Pushbutton implementation */ /* First Pushbutton implementation */
ctrl->push_flag = 1; ctrl->push_flag = 1;
ctrl->slot_switch_type = 1; // Switch is present ctrl->slot_switch_type = 1; // Switch is present
ctrl->speed_capability = CTRL_SPEED_33MHz; ctrl->speed_capability = PCI_SPEED_33MHz;
ctrl->push_button = 1; // Pushbutton is present ctrl->push_button = 1; // Pushbutton is present
ctrl->pci_config_space = 1; // Index/data access to working registers 0 = not supported, 1 = supported ctrl->pci_config_space = 1; // Index/data access to working registers 0 = not supported, 1 = supported
ctrl->defeature_PHP = 1; // PHP is supported ctrl->defeature_PHP = 1; // PHP is supported
ctrl->pcix_support = 0; // PCI-X not supported ctrl->pcix_support = 0; // PCI-X not supported
ctrl->pcix_speed_capability = 0; // N/A since PCI-X not supported ctrl->pcix_speed_capability = 0; // N/A since PCI-X not supported
break; break;
case PCI_SUB_HPC_ID_INTC: case PCI_SUB_HPC_ID_INTC:
/* Third party (6500/7000) */ /* Third party (6500/7000) */
ctrl->slot_switch_type = 1; // Switch is present ctrl->slot_switch_type = 1; // Switch is present
ctrl->speed_capability = CTRL_SPEED_33MHz; ctrl->speed_capability = PCI_SPEED_33MHz;
ctrl->push_button = 0; // No pushbutton ctrl->push_button = 0; // No pushbutton
ctrl->pci_config_space = 1; // Index/data access to working registers 0 = not supported, 1 = supported ctrl->pci_config_space = 1; // Index/data access to working registers 0 = not supported, 1 = supported
ctrl->defeature_PHP = 1; // PHP is supported ctrl->defeature_PHP = 1; // PHP is supported
...@@ -885,7 +927,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -885,7 +927,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
/* First 66 Mhz implementation */ /* First 66 Mhz implementation */
ctrl->push_flag = 1; ctrl->push_flag = 1;
ctrl->slot_switch_type = 1; // Switch is present ctrl->slot_switch_type = 1; // Switch is present
ctrl->speed_capability = CTRL_SPEED_66MHz; ctrl->speed_capability = PCI_SPEED_66MHz;
ctrl->push_button = 1; // Pushbutton is present ctrl->push_button = 1; // Pushbutton is present
ctrl->pci_config_space = 1; // Index/data access to working registers 0 = not supported, 1 = supported ctrl->pci_config_space = 1; // Index/data access to working registers 0 = not supported, 1 = supported
ctrl->defeature_PHP = 1; // PHP is supported ctrl->defeature_PHP = 1; // PHP is supported
...@@ -903,9 +945,9 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -903,9 +945,9 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
case PCI_VENDOR_ID_INTEL: case PCI_VENDOR_ID_INTEL:
/* Check for speed capability (0=33, 1=66) */ /* Check for speed capability (0=33, 1=66) */
if (subsystem_deviceid & 0x0001) { if (subsystem_deviceid & 0x0001) {
ctrl->speed_capability = CTRL_SPEED_66MHz; ctrl->speed_capability = PCI_SPEED_66MHz;
} else { } else {
ctrl->speed_capability = CTRL_SPEED_33MHz; ctrl->speed_capability = PCI_SPEED_33MHz;
} }
/* Check for push button */ /* Check for push button */
...@@ -982,7 +1024,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -982,7 +1024,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
info("Initializing the PCI hot plug controller residing on PCI bus %d\n", pdev->bus->number); info("Initializing the PCI hot plug controller residing on PCI bus %d\n", pdev->bus->number);
dbg ("Hotplug controller capabilities:\n"); dbg ("Hotplug controller capabilities:\n");
dbg (" speed_capability %s\n", ctrl->speed_capability == CTRL_SPEED_33MHz ? "33MHz" : "66Mhz"); dbg (" speed_capability %s\n", ctrl->speed_capability == PCI_SPEED_33MHz ? "33MHz" : "66Mhz");
dbg (" slot_switch_type %s\n", ctrl->slot_switch_type == 0 ? "no switch" : "switch present"); dbg (" slot_switch_type %s\n", ctrl->slot_switch_type == 0 ? "no switch" : "switch present");
dbg (" defeature_PHP %s\n", ctrl->defeature_PHP == 0 ? "PHP not supported" : "PHP supported"); dbg (" defeature_PHP %s\n", ctrl->defeature_PHP == 0 ? "PHP not supported" : "PHP supported");
dbg (" alternate_base_address %s\n", ctrl->alternate_base_address == 0 ? "not supported" : "supported"); dbg (" alternate_base_address %s\n", ctrl->alternate_base_address == 0 ? "not supported" : "supported");
......
...@@ -1187,7 +1187,7 @@ static u32 board_replaced(struct pci_func * func, struct controller * ctrl) ...@@ -1187,7 +1187,7 @@ static u32 board_replaced(struct pci_func * func, struct controller * ctrl)
//********************************* //*********************************
rc = CARD_FUNCTIONING; rc = CARD_FUNCTIONING;
} else { } else {
if (ctrl->speed == 1) { if (ctrl->speed == PCI_SPEED_66MHz) {
// Wait for exclusive access to hardware // Wait for exclusive access to hardware
down(&ctrl->crit_sect); down(&ctrl->crit_sect);
...@@ -1385,7 +1385,7 @@ static u32 board_added(struct pci_func * func, struct controller * ctrl) ...@@ -1385,7 +1385,7 @@ static u32 board_added(struct pci_func * func, struct controller * ctrl)
dbg("%s: func->device, slot_offset, hp_slot = %d, %d ,%d\n", dbg("%s: func->device, slot_offset, hp_slot = %d, %d ,%d\n",
__FUNCTION__, func->device, ctrl->slot_device_offset, hp_slot); __FUNCTION__, func->device, ctrl->slot_device_offset, hp_slot);
if (ctrl->speed == 1) { if (ctrl->speed == PCI_SPEED_66MHz) {
// Wait for exclusive access to hardware // Wait for exclusive access to hardware
down(&ctrl->crit_sect); down(&ctrl->crit_sect);
......
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