diff options
author | Matthew Wilcox <matthew@wil.cx> | 2009-12-13 08:11:32 -0500 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2010-02-22 19:15:17 -0500 |
commit | 3749c51ac6c1560aa1cb1520066bed84c6f8152a (patch) | |
tree | 3cbfb6a6d2df821e3e80ccce29ede8011b94246e /drivers/pci/slot.c | |
parent | 536c8cb49eccd4f753b4782e7e975ef87359cb44 (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/slot.c')
-rw-r--r-- | drivers/pci/slot.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/drivers/pci/slot.c b/drivers/pci/slot.c index 8c02b6c53bdb..6f6b8d24786a 100644 --- a/drivers/pci/slot.c +++ b/drivers/pci/slot.c | |||
@@ -47,6 +47,54 @@ static ssize_t address_read_file(struct pci_slot *slot, char *buf) | |||
47 | slot->number); | 47 | slot->number); |
48 | } | 48 | } |
49 | 49 | ||
50 | /* these strings match up with the values in pci_bus_speed */ | ||
51 | static char *pci_bus_speed_strings[] = { | ||
52 | "33 MHz PCI", /* 0x00 */ | ||
53 | "66 MHz PCI", /* 0x01 */ | ||
54 | "66 MHz PCI-X", /* 0x02 */ | ||
55 | "100 MHz PCI-X", /* 0x03 */ | ||
56 | "133 MHz PCI-X", /* 0x04 */ | ||
57 | NULL, /* 0x05 */ | ||
58 | NULL, /* 0x06 */ | ||
59 | NULL, /* 0x07 */ | ||
60 | NULL, /* 0x08 */ | ||
61 | "66 MHz PCI-X 266", /* 0x09 */ | ||
62 | "100 MHz PCI-X 266", /* 0x0a */ | ||
63 | "133 MHz PCI-X 266", /* 0x0b */ | ||
64 | NULL, /* 0x0c */ | ||
65 | NULL, /* 0x0d */ | ||
66 | NULL, /* 0x0e */ | ||
67 | NULL, /* 0x0f */ | ||
68 | NULL, /* 0x10 */ | ||
69 | "66 MHz PCI-X 533", /* 0x11 */ | ||
70 | "100 MHz PCI-X 533", /* 0x12 */ | ||
71 | "133 MHz PCI-X 533", /* 0x13 */ | ||
72 | "2.5 GT/s PCIe", /* 0x14 */ | ||
73 | "5.0 GT/s PCIe", /* 0x15 */ | ||
74 | }; | ||
75 | |||
76 | static ssize_t bus_speed_read(enum pci_bus_speed speed, char *buf) | ||
77 | { | ||
78 | const char *speed_string; | ||
79 | |||
80 | if (speed < ARRAY_SIZE(pci_bus_speed_strings)) | ||
81 | speed_string = pci_bus_speed_strings[speed]; | ||
82 | else | ||
83 | speed_string = "Unknown"; | ||
84 | |||
85 | return sprintf(buf, "%s\n", speed_string); | ||
86 | } | ||
87 | |||
88 | static ssize_t max_speed_read_file(struct pci_slot *slot, char *buf) | ||
89 | { | ||
90 | return bus_speed_read(slot->bus->max_bus_speed, buf); | ||
91 | } | ||
92 | |||
93 | static ssize_t cur_speed_read_file(struct pci_slot *slot, char *buf) | ||
94 | { | ||
95 | return bus_speed_read(slot->bus->cur_bus_speed, buf); | ||
96 | } | ||
97 | |||
50 | static void pci_slot_release(struct kobject *kobj) | 98 | static void pci_slot_release(struct kobject *kobj) |
51 | { | 99 | { |
52 | struct pci_dev *dev; | 100 | struct pci_dev *dev; |
@@ -66,9 +114,15 @@ static void pci_slot_release(struct kobject *kobj) | |||
66 | 114 | ||
67 | static struct pci_slot_attribute pci_slot_attr_address = | 115 | static struct pci_slot_attribute pci_slot_attr_address = |
68 | __ATTR(address, (S_IFREG | S_IRUGO), address_read_file, NULL); | 116 | __ATTR(address, (S_IFREG | S_IRUGO), address_read_file, NULL); |
117 | static struct pci_slot_attribute pci_slot_attr_max_speed = | ||
118 | __ATTR(max_bus_speed, (S_IFREG | S_IRUGO), max_speed_read_file, NULL); | ||
119 | static struct pci_slot_attribute pci_slot_attr_cur_speed = | ||
120 | __ATTR(cur_bus_speed, (S_IFREG | S_IRUGO), cur_speed_read_file, NULL); | ||
69 | 121 | ||
70 | static struct attribute *pci_slot_default_attrs[] = { | 122 | static struct attribute *pci_slot_default_attrs[] = { |
71 | &pci_slot_attr_address.attr, | 123 | &pci_slot_attr_address.attr, |
124 | &pci_slot_attr_max_speed.attr, | ||
125 | &pci_slot_attr_cur_speed.attr, | ||
72 | NULL, | 126 | NULL, |
73 | }; | 127 | }; |
74 | 128 | ||