aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wilcox <matthew@wil.cx>2009-12-13 08:11:31 -0500
committerJesse Barnes <jbarnes@virtuousgeek.org>2010-02-22 19:15:17 -0500
commit536c8cb49eccd4f753b4782e7e975ef87359cb44 (patch)
tree1cc2a32b17e4eb1fc4c9b64dc4895892a2fd3d41
parentf07852d6442c46c50b59c7e2acc8a1b291f9ab6d (diff)
PCI: Unify pcie_link_speed and pci_bus_speed
These enums must not overlap anyway, since we only have a single pci_bus_speed_strings array. Use a single enum, and move it to pci.h. Add 'SPEED' to the pcie names to make it clear what they are. Signed-off-by: Matthew Wilcox <willy@linux.intel.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
-rw-r--r--drivers/pci/hotplug/pciehp_hpc.c16
-rw-r--r--include/linux/pci.h21
-rw-r--r--include/linux/pci_hotplug.h26
3 files changed, 29 insertions, 34 deletions
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
index 10040d58c8ef..6744ca1d8d01 100644
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -613,7 +613,7 @@ static irqreturn_t pcie_isr(int irq, void *dev_id)
613int pciehp_get_max_link_speed(struct slot *slot, enum pci_bus_speed *value) 613int pciehp_get_max_link_speed(struct slot *slot, enum pci_bus_speed *value)
614{ 614{
615 struct controller *ctrl = slot->ctrl; 615 struct controller *ctrl = slot->ctrl;
616 enum pcie_link_speed lnk_speed; 616 enum pci_bus_speed lnk_speed;
617 u32 lnk_cap; 617 u32 lnk_cap;
618 int retval = 0; 618 int retval = 0;
619 619
@@ -625,13 +625,13 @@ int pciehp_get_max_link_speed(struct slot *slot, enum pci_bus_speed *value)
625 625
626 switch (lnk_cap & 0x000F) { 626 switch (lnk_cap & 0x000F) {
627 case 1: 627 case 1:
628 lnk_speed = PCIE_2_5GB; 628 lnk_speed = PCIE_SPEED_2_5GT;
629 break; 629 break;
630 case 2: 630 case 2:
631 lnk_speed = PCIE_5_0GB; 631 lnk_speed = PCIE_SPEED_5_0GT;
632 break; 632 break;
633 default: 633 default:
634 lnk_speed = PCIE_LNK_SPEED_UNKNOWN; 634 lnk_speed = PCI_SPEED_UNKNOWN;
635 break; 635 break;
636 } 636 }
637 637
@@ -694,7 +694,7 @@ int pciehp_get_max_lnk_width(struct slot *slot,
694int pciehp_get_cur_link_speed(struct slot *slot, enum pci_bus_speed *value) 694int pciehp_get_cur_link_speed(struct slot *slot, enum pci_bus_speed *value)
695{ 695{
696 struct controller *ctrl = slot->ctrl; 696 struct controller *ctrl = slot->ctrl;
697 enum pcie_link_speed lnk_speed = PCI_SPEED_UNKNOWN; 697 enum pci_bus_speed lnk_speed = PCI_SPEED_UNKNOWN;
698 int retval = 0; 698 int retval = 0;
699 u16 lnk_status; 699 u16 lnk_status;
700 700
@@ -707,13 +707,13 @@ int pciehp_get_cur_link_speed(struct slot *slot, enum pci_bus_speed *value)
707 707
708 switch (lnk_status & PCI_EXP_LNKSTA_CLS) { 708 switch (lnk_status & PCI_EXP_LNKSTA_CLS) {
709 case 1: 709 case 1:
710 lnk_speed = PCIE_2_5GB; 710 lnk_speed = PCIE_SPEED_2_5GT;
711 break; 711 break;
712 case 2: 712 case 2:
713 lnk_speed = PCIE_5_0GB; 713 lnk_speed = PCIE_SPEED_5_0GT;
714 break; 714 break;
715 default: 715 default:
716 lnk_speed = PCIE_LNK_SPEED_UNKNOWN; 716 lnk_speed = PCI_SPEED_UNKNOWN;
717 break; 717 break;
718 } 718 }
719 719
diff --git a/include/linux/pci.h b/include/linux/pci.h
index c1968f464c38..d76a8a0b6b53 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -187,6 +187,27 @@ enum pci_bus_flags {
187 PCI_BUS_FLAGS_NO_MMRBC = (__force pci_bus_flags_t) 2, 187 PCI_BUS_FLAGS_NO_MMRBC = (__force pci_bus_flags_t) 2,
188}; 188};
189 189
190/* Based on the PCI Hotplug Spec, but some values are made up by us */
191enum pci_bus_speed {
192 PCI_SPEED_33MHz = 0x00,
193 PCI_SPEED_66MHz = 0x01,
194 PCI_SPEED_66MHz_PCIX = 0x02,
195 PCI_SPEED_100MHz_PCIX = 0x03,
196 PCI_SPEED_133MHz_PCIX = 0x04,
197 PCI_SPEED_66MHz_PCIX_ECC = 0x05,
198 PCI_SPEED_100MHz_PCIX_ECC = 0x06,
199 PCI_SPEED_133MHz_PCIX_ECC = 0x07,
200 PCI_SPEED_66MHz_PCIX_266 = 0x09,
201 PCI_SPEED_100MHz_PCIX_266 = 0x0a,
202 PCI_SPEED_133MHz_PCIX_266 = 0x0b,
203 PCI_SPEED_66MHz_PCIX_533 = 0x11,
204 PCI_SPEED_100MHz_PCIX_533 = 0x12,
205 PCI_SPEED_133MHz_PCIX_533 = 0x13,
206 PCIE_SPEED_2_5GT = 0x14,
207 PCIE_SPEED_5_0GT = 0x15,
208 PCI_SPEED_UNKNOWN = 0xff,
209};
210
190struct pci_cap_saved_state { 211struct pci_cap_saved_state {
191 struct hlist_node next; 212 struct hlist_node next;
192 char cap_nr; 213 char cap_nr;
diff --git a/include/linux/pci_hotplug.h b/include/linux/pci_hotplug.h
index 652ba797696d..56251ac385e9 100644
--- a/include/linux/pci_hotplug.h
+++ b/include/linux/pci_hotplug.h
@@ -28,26 +28,6 @@
28#ifndef _PCI_HOTPLUG_H 28#ifndef _PCI_HOTPLUG_H
29#define _PCI_HOTPLUG_H 29#define _PCI_HOTPLUG_H
30 30
31
32/* These values come from the PCI Hotplug Spec */
33enum pci_bus_speed {
34 PCI_SPEED_33MHz = 0x00,
35 PCI_SPEED_66MHz = 0x01,
36 PCI_SPEED_66MHz_PCIX = 0x02,
37 PCI_SPEED_100MHz_PCIX = 0x03,
38 PCI_SPEED_133MHz_PCIX = 0x04,
39 PCI_SPEED_66MHz_PCIX_ECC = 0x05,
40 PCI_SPEED_100MHz_PCIX_ECC = 0x06,
41 PCI_SPEED_133MHz_PCIX_ECC = 0x07,
42 PCI_SPEED_66MHz_PCIX_266 = 0x09,
43 PCI_SPEED_100MHz_PCIX_266 = 0x0a,
44 PCI_SPEED_133MHz_PCIX_266 = 0x0b,
45 PCI_SPEED_66MHz_PCIX_533 = 0x11,
46 PCI_SPEED_100MHz_PCIX_533 = 0x12,
47 PCI_SPEED_133MHz_PCIX_533 = 0x13,
48 PCI_SPEED_UNKNOWN = 0xff,
49};
50
51/* These values come from the PCI Express Spec */ 31/* These values come from the PCI Express Spec */
52enum pcie_link_width { 32enum pcie_link_width {
53 PCIE_LNK_WIDTH_RESRV = 0x00, 33 PCIE_LNK_WIDTH_RESRV = 0x00,
@@ -61,12 +41,6 @@ enum pcie_link_width {
61 PCIE_LNK_WIDTH_UNKNOWN = 0xFF, 41 PCIE_LNK_WIDTH_UNKNOWN = 0xFF,
62}; 42};
63 43
64enum pcie_link_speed {
65 PCIE_2_5GB = 0x14,
66 PCIE_5_0GB = 0x15,
67 PCIE_LNK_SPEED_UNKNOWN = 0xFF,
68};
69
70/** 44/**
71 * struct hotplug_slot_ops -the callbacks that the hotplug pci core can use 45 * struct hotplug_slot_ops -the callbacks that the hotplug pci core can use
72 * @owner: The module owner of this structure 46 * @owner: The module owner of this structure