aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug/cpqphp_core.c
diff options
context:
space:
mode:
authorMatthew Wilcox <matthew@wil.cx>2009-12-13 08:11:32 -0500
committerJesse Barnes <jbarnes@virtuousgeek.org>2010-02-22 19:15:17 -0500
commit3749c51ac6c1560aa1cb1520066bed84c6f8152a (patch)
tree3cbfb6a6d2df821e3e80ccce29ede8011b94246e /drivers/pci/hotplug/cpqphp_core.c
parent536c8cb49eccd4f753b4782e7e975ef87359cb44 (diff)
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>
Diffstat (limited to 'drivers/pci/hotplug/cpqphp_core.c')
-rw-r--r--drivers/pci/hotplug/cpqphp_core.c57
1 files changed, 17 insertions, 40 deletions
diff --git a/drivers/pci/hotplug/cpqphp_core.c b/drivers/pci/hotplug/cpqphp_core.c
index 075b4f4b6e0d..f184d1d2ecbe 100644
--- a/drivers/pci/hotplug/cpqphp_core.c
+++ b/drivers/pci/hotplug/cpqphp_core.c
@@ -583,30 +583,6 @@ static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value)
583 return 0; 583 return 0;
584} 584}
585 585
586static int get_max_bus_speed (struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value)
587{
588 struct slot *slot = hotplug_slot->private;
589 struct controller *ctrl = slot->ctrl;
590
591 dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
592
593 *value = ctrl->speed_capability;
594
595 return 0;
596}
597
598static int get_cur_bus_speed (struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value)
599{
600 struct slot *slot = hotplug_slot->private;
601 struct controller *ctrl = slot->ctrl;
602
603 dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
604
605 *value = ctrl->speed;
606
607 return 0;
608}
609
610static struct hotplug_slot_ops cpqphp_hotplug_slot_ops = { 586static struct hotplug_slot_ops cpqphp_hotplug_slot_ops = {
611 .set_attention_status = set_attention_status, 587 .set_attention_status = set_attention_status,
612 .enable_slot = process_SI, 588 .enable_slot = process_SI,
@@ -616,8 +592,6 @@ static struct hotplug_slot_ops cpqphp_hotplug_slot_ops = {
616 .get_attention_status = get_attention_status, 592 .get_attention_status = get_attention_status,
617 .get_latch_status = get_latch_status, 593 .get_latch_status = get_latch_status,
618 .get_adapter_status = get_adapter_status, 594 .get_adapter_status = get_adapter_status,
619 .get_max_bus_speed = get_max_bus_speed,
620 .get_cur_bus_speed = get_cur_bus_speed,
621}; 595};
622 596
623#define SLOT_NAME_SIZE 10 597#define SLOT_NAME_SIZE 10
@@ -629,6 +603,7 @@ static int ctrl_slot_setup(struct controller *ctrl,
629 struct slot *slot; 603 struct slot *slot;
630 struct hotplug_slot *hotplug_slot; 604 struct hotplug_slot *hotplug_slot;
631 struct hotplug_slot_info *hotplug_slot_info; 605 struct hotplug_slot_info *hotplug_slot_info;
606 struct pci_bus *bus = ctrl->pci_bus;
632 u8 number_of_slots; 607 u8 number_of_slots;
633 u8 slot_device; 608 u8 slot_device;
634 u8 slot_number; 609 u8 slot_number;
@@ -694,7 +669,7 @@ static int ctrl_slot_setup(struct controller *ctrl,
694 slot->capabilities |= PCISLOT_64_BIT_SUPPORTED; 669 slot->capabilities |= PCISLOT_64_BIT_SUPPORTED;
695 if (is_slot66mhz(slot)) 670 if (is_slot66mhz(slot))
696 slot->capabilities |= PCISLOT_66_MHZ_SUPPORTED; 671 slot->capabilities |= PCISLOT_66_MHZ_SUPPORTED;
697 if (ctrl->speed == PCI_SPEED_66MHz) 672 if (bus->cur_bus_speed == PCI_SPEED_66MHz)
698 slot->capabilities |= PCISLOT_66_MHZ_OPERATION; 673 slot->capabilities |= PCISLOT_66_MHZ_OPERATION;
699 674
700 ctrl_slot = 675 ctrl_slot =
@@ -844,6 +819,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
844 u32 rc; 819 u32 rc;
845 struct controller *ctrl; 820 struct controller *ctrl;
846 struct pci_func *func; 821 struct pci_func *func;
822 struct pci_bus *bus;
847 int err; 823 int err;
848 824
849 err = pci_enable_device(pdev); 825 err = pci_enable_device(pdev);
@@ -852,6 +828,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
852 pci_name(pdev), err); 828 pci_name(pdev), err);
853 return err; 829 return err;
854 } 830 }
831 bus = pdev->subordinate;
855 832
856 /* Need to read VID early b/c it's used to differentiate CPQ and INTC 833 /* Need to read VID early b/c it's used to differentiate CPQ and INTC
857 * discovery 834 * discovery
@@ -929,22 +906,22 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
929 pci_read_config_byte(pdev, 0x41, &bus_cap); 906 pci_read_config_byte(pdev, 0x41, &bus_cap);
930 if (bus_cap & 0x80) { 907 if (bus_cap & 0x80) {
931 dbg("bus max supports 133MHz PCI-X\n"); 908 dbg("bus max supports 133MHz PCI-X\n");
932 ctrl->speed_capability = PCI_SPEED_133MHz_PCIX; 909 bus->max_bus_speed = PCI_SPEED_133MHz_PCIX;
933 break; 910 break;
934 } 911 }
935 if (bus_cap & 0x40) { 912 if (bus_cap & 0x40) {
936 dbg("bus max supports 100MHz PCI-X\n"); 913 dbg("bus max supports 100MHz PCI-X\n");
937 ctrl->speed_capability = PCI_SPEED_100MHz_PCIX; 914 bus->max_bus_speed = PCI_SPEED_100MHz_PCIX;
938 break; 915 break;
939 } 916 }
940 if (bus_cap & 20) { 917 if (bus_cap & 20) {
941 dbg("bus max supports 66MHz PCI-X\n"); 918 dbg("bus max supports 66MHz PCI-X\n");
942 ctrl->speed_capability = PCI_SPEED_66MHz_PCIX; 919 bus->max_bus_speed = PCI_SPEED_66MHz_PCIX;
943 break; 920 break;
944 } 921 }
945 if (bus_cap & 10) { 922 if (bus_cap & 10) {
946 dbg("bus max supports 66MHz PCI\n"); 923 dbg("bus max supports 66MHz PCI\n");
947 ctrl->speed_capability = PCI_SPEED_66MHz; 924 bus->max_bus_speed = PCI_SPEED_66MHz;
948 break; 925 break;
949 } 926 }
950 927
@@ -955,7 +932,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
955 case PCI_SUB_HPC_ID: 932 case PCI_SUB_HPC_ID:
956 /* Original 6500/7000 implementation */ 933 /* Original 6500/7000 implementation */
957 ctrl->slot_switch_type = 1; 934 ctrl->slot_switch_type = 1;
958 ctrl->speed_capability = PCI_SPEED_33MHz; 935 bus->max_bus_speed = PCI_SPEED_33MHz;
959 ctrl->push_button = 0; 936 ctrl->push_button = 0;
960 ctrl->pci_config_space = 1; 937 ctrl->pci_config_space = 1;
961 ctrl->defeature_PHP = 1; 938 ctrl->defeature_PHP = 1;
@@ -966,7 +943,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
966 /* First Pushbutton implementation */ 943 /* First Pushbutton implementation */
967 ctrl->push_flag = 1; 944 ctrl->push_flag = 1;
968 ctrl->slot_switch_type = 1; 945 ctrl->slot_switch_type = 1;
969 ctrl->speed_capability = PCI_SPEED_33MHz; 946 bus->max_bus_speed = PCI_SPEED_33MHz;
970 ctrl->push_button = 1; 947 ctrl->push_button = 1;
971 ctrl->pci_config_space = 1; 948 ctrl->pci_config_space = 1;
972 ctrl->defeature_PHP = 1; 949 ctrl->defeature_PHP = 1;
@@ -976,7 +953,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
976 case PCI_SUB_HPC_ID_INTC: 953 case PCI_SUB_HPC_ID_INTC:
977 /* Third party (6500/7000) */ 954 /* Third party (6500/7000) */
978 ctrl->slot_switch_type = 1; 955 ctrl->slot_switch_type = 1;
979 ctrl->speed_capability = PCI_SPEED_33MHz; 956 bus->max_bus_speed = PCI_SPEED_33MHz;
980 ctrl->push_button = 0; 957 ctrl->push_button = 0;
981 ctrl->pci_config_space = 1; 958 ctrl->pci_config_space = 1;
982 ctrl->defeature_PHP = 1; 959 ctrl->defeature_PHP = 1;
@@ -987,7 +964,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
987 /* First 66 Mhz implementation */ 964 /* First 66 Mhz implementation */
988 ctrl->push_flag = 1; 965 ctrl->push_flag = 1;
989 ctrl->slot_switch_type = 1; 966 ctrl->slot_switch_type = 1;
990 ctrl->speed_capability = PCI_SPEED_66MHz; 967 bus->max_bus_speed = PCI_SPEED_66MHz;
991 ctrl->push_button = 1; 968 ctrl->push_button = 1;
992 ctrl->pci_config_space = 1; 969 ctrl->pci_config_space = 1;
993 ctrl->defeature_PHP = 1; 970 ctrl->defeature_PHP = 1;
@@ -998,7 +975,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
998 /* First PCI-X implementation, 100MHz */ 975 /* First PCI-X implementation, 100MHz */
999 ctrl->push_flag = 1; 976 ctrl->push_flag = 1;
1000 ctrl->slot_switch_type = 1; 977 ctrl->slot_switch_type = 1;
1001 ctrl->speed_capability = PCI_SPEED_100MHz_PCIX; 978 bus->max_bus_speed = PCI_SPEED_100MHz_PCIX;
1002 ctrl->push_button = 1; 979 ctrl->push_button = 1;
1003 ctrl->pci_config_space = 1; 980 ctrl->pci_config_space = 1;
1004 ctrl->defeature_PHP = 1; 981 ctrl->defeature_PHP = 1;
@@ -1015,9 +992,9 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1015 case PCI_VENDOR_ID_INTEL: 992 case PCI_VENDOR_ID_INTEL:
1016 /* Check for speed capability (0=33, 1=66) */ 993 /* Check for speed capability (0=33, 1=66) */
1017 if (subsystem_deviceid & 0x0001) 994 if (subsystem_deviceid & 0x0001)
1018 ctrl->speed_capability = PCI_SPEED_66MHz; 995 bus->max_bus_speed = PCI_SPEED_66MHz;
1019 else 996 else
1020 ctrl->speed_capability = PCI_SPEED_33MHz; 997 bus->max_bus_speed = PCI_SPEED_33MHz;
1021 998
1022 /* Check for push button */ 999 /* Check for push button */
1023 if (subsystem_deviceid & 0x0002) 1000 if (subsystem_deviceid & 0x0002)
@@ -1079,7 +1056,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1079 pdev->bus->number); 1056 pdev->bus->number);
1080 1057
1081 dbg("Hotplug controller capabilities:\n"); 1058 dbg("Hotplug controller capabilities:\n");
1082 dbg(" speed_capability %d\n", ctrl->speed_capability); 1059 dbg(" speed_capability %d\n", bus->max_bus_speed);
1083 dbg(" slot_switch_type %s\n", ctrl->slot_switch_type ? 1060 dbg(" slot_switch_type %s\n", ctrl->slot_switch_type ?
1084 "switch present" : "no switch"); 1061 "switch present" : "no switch");
1085 dbg(" defeature_PHP %s\n", ctrl->defeature_PHP ? 1062 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)
1142 } 1119 }
1143 1120
1144 /* Check for 66Mhz operation */ 1121 /* Check for 66Mhz operation */
1145 ctrl->speed = get_controller_speed(ctrl); 1122 bus->cur_bus_speed = get_controller_speed(ctrl);
1146 1123
1147 1124
1148 /******************************************************** 1125 /********************************************************