diff options
| author | Bjorn Helgaas <bhelgaas@google.com> | 2013-12-18 16:04:29 -0500 |
|---|---|---|
| committer | Bjorn Helgaas <bhelgaas@google.com> | 2013-12-18 16:04:29 -0500 |
| commit | a737f76baee3d44cb25285986812e9cd97fd6002 (patch) | |
| tree | cca60bf6d4ec750b744838babfc733eaa3bebd02 | |
| parent | 765147f85a79aba1ba2a45b42eee00e63f783bc9 (diff) | |
| parent | af9ab791e34147952a8b97c998fa257d8292c5d6 (diff) | |
Merge branch 'pci/pciehp' into next
* pci/pciehp:
PCI: pciehp: Move Attention & Power Indicator support tests to accessors
PCI: pciehp: Use symbolic constants for Slot Control fields
PCI: pciehp: Use symbolic constants, not hard-coded bitmask
PCI: pciehp: Simplify "Power Fault Detected" checking/clearing
PCI: pciehp: Announce slot capabilities (slot #, button, LEDs, etc)
PCI: pciehp: Make various functions void since they can't fail
PCI: pciehp: Remove error checks when accessing PCIe Capability
PCI: pciehp: Drop pciehp_readw()/pciehp_writew() wrappers
| -rw-r--r-- | drivers/pci/hotplug/pciehp.h | 14 | ||||
| -rw-r--r-- | drivers/pci/hotplug/pciehp_core.c | 15 | ||||
| -rw-r--r-- | drivers/pci/hotplug/pciehp_ctrl.c | 90 | ||||
| -rw-r--r-- | drivers/pci/hotplug/pciehp_hpc.c | 380 | ||||
| -rw-r--r-- | drivers/pci/hotplug/pciehp_pci.c | 6 | ||||
| -rw-r--r-- | include/uapi/linux/pci_regs.h | 8 |
6 files changed, 185 insertions, 328 deletions
diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h index 21e865ded1dc..ffe6a6b336cf 100644 --- a/drivers/pci/hotplug/pciehp.h +++ b/drivers/pci/hotplug/pciehp.h | |||
| @@ -140,15 +140,15 @@ struct controller *pcie_init(struct pcie_device *dev); | |||
| 140 | int pcie_init_notification(struct controller *ctrl); | 140 | int pcie_init_notification(struct controller *ctrl); |
| 141 | int pciehp_enable_slot(struct slot *p_slot); | 141 | int pciehp_enable_slot(struct slot *p_slot); |
| 142 | int pciehp_disable_slot(struct slot *p_slot); | 142 | int pciehp_disable_slot(struct slot *p_slot); |
| 143 | int pcie_enable_notification(struct controller *ctrl); | 143 | void pcie_enable_notification(struct controller *ctrl); |
| 144 | int pciehp_power_on_slot(struct slot *slot); | 144 | int pciehp_power_on_slot(struct slot *slot); |
| 145 | int pciehp_power_off_slot(struct slot *slot); | 145 | void pciehp_power_off_slot(struct slot *slot); |
| 146 | int pciehp_get_power_status(struct slot *slot, u8 *status); | 146 | void pciehp_get_power_status(struct slot *slot, u8 *status); |
| 147 | int pciehp_get_attention_status(struct slot *slot, u8 *status); | 147 | void pciehp_get_attention_status(struct slot *slot, u8 *status); |
| 148 | 148 | ||
| 149 | int pciehp_set_attention_status(struct slot *slot, u8 status); | 149 | void pciehp_set_attention_status(struct slot *slot, u8 status); |
| 150 | int pciehp_get_latch_status(struct slot *slot, u8 *status); | 150 | void pciehp_get_latch_status(struct slot *slot, u8 *status); |
| 151 | int pciehp_get_adapter_status(struct slot *slot, u8 *status); | 151 | void pciehp_get_adapter_status(struct slot *slot, u8 *status); |
| 152 | int pciehp_query_power_fault(struct slot *slot); | 152 | int pciehp_query_power_fault(struct slot *slot); |
| 153 | void pciehp_green_led_on(struct slot *slot); | 153 | void pciehp_green_led_on(struct slot *slot); |
| 154 | void pciehp_green_led_off(struct slot *slot); | 154 | void pciehp_green_led_off(struct slot *slot); |
diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c index bbd48bbe4e9b..143a389d81fa 100644 --- a/drivers/pci/hotplug/pciehp_core.c +++ b/drivers/pci/hotplug/pciehp_core.c | |||
| @@ -160,7 +160,8 @@ static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 status) | |||
| 160 | ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", | 160 | ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", |
| 161 | __func__, slot_name(slot)); | 161 | __func__, slot_name(slot)); |
| 162 | 162 | ||
| 163 | return pciehp_set_attention_status(slot, status); | 163 | pciehp_set_attention_status(slot, status); |
| 164 | return 0; | ||
| 164 | } | 165 | } |
| 165 | 166 | ||
| 166 | 167 | ||
| @@ -192,7 +193,8 @@ static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value) | |||
| 192 | ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", | 193 | ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", |
| 193 | __func__, slot_name(slot)); | 194 | __func__, slot_name(slot)); |
| 194 | 195 | ||
| 195 | return pciehp_get_power_status(slot, value); | 196 | pciehp_get_power_status(slot, value); |
| 197 | return 0; | ||
| 196 | } | 198 | } |
| 197 | 199 | ||
| 198 | static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value) | 200 | static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value) |
| @@ -202,7 +204,8 @@ static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value) | |||
| 202 | ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", | 204 | ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", |
| 203 | __func__, slot_name(slot)); | 205 | __func__, slot_name(slot)); |
| 204 | 206 | ||
| 205 | return pciehp_get_attention_status(slot, value); | 207 | pciehp_get_attention_status(slot, value); |
| 208 | return 0; | ||
| 206 | } | 209 | } |
| 207 | 210 | ||
| 208 | static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value) | 211 | static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value) |
| @@ -212,7 +215,8 @@ static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value) | |||
| 212 | ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", | 215 | ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", |
| 213 | __func__, slot_name(slot)); | 216 | __func__, slot_name(slot)); |
| 214 | 217 | ||
| 215 | return pciehp_get_latch_status(slot, value); | 218 | pciehp_get_latch_status(slot, value); |
| 219 | return 0; | ||
| 216 | } | 220 | } |
| 217 | 221 | ||
| 218 | static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value) | 222 | static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value) |
| @@ -222,7 +226,8 @@ static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value) | |||
| 222 | ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", | 226 | ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", |
| 223 | __func__, slot_name(slot)); | 227 | __func__, slot_name(slot)); |
| 224 | 228 | ||
| 225 | return pciehp_get_adapter_status(slot, value); | 229 | pciehp_get_adapter_status(slot, value); |
| 230 | return 0; | ||
| 226 | } | 231 | } |
| 227 | 232 | ||
| 228 | static int reset_slot(struct hotplug_slot *hotplug_slot, int probe) | 233 | static int reset_slot(struct hotplug_slot *hotplug_slot, int probe) |
diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c index 38f018679175..50628487597d 100644 --- a/drivers/pci/hotplug/pciehp_ctrl.c +++ b/drivers/pci/hotplug/pciehp_ctrl.c | |||
| @@ -158,11 +158,8 @@ static void set_slot_off(struct controller *ctrl, struct slot * pslot) | |||
| 158 | { | 158 | { |
| 159 | /* turn off slot, turn on Amber LED, turn off Green LED if supported*/ | 159 | /* turn off slot, turn on Amber LED, turn off Green LED if supported*/ |
| 160 | if (POWER_CTRL(ctrl)) { | 160 | if (POWER_CTRL(ctrl)) { |
| 161 | if (pciehp_power_off_slot(pslot)) { | 161 | pciehp_power_off_slot(pslot); |
| 162 | ctrl_err(ctrl, | 162 | |
| 163 | "Issue of Slot Power Off command failed\n"); | ||
| 164 | return; | ||
| 165 | } | ||
| 166 | /* | 163 | /* |
| 167 | * After turning power off, we must wait for at least 1 second | 164 | * After turning power off, we must wait for at least 1 second |
| 168 | * before taking any action that relies on power having been | 165 | * before taking any action that relies on power having been |
| @@ -171,16 +168,8 @@ static void set_slot_off(struct controller *ctrl, struct slot * pslot) | |||
| 171 | msleep(1000); | 168 | msleep(1000); |
| 172 | } | 169 | } |
| 173 | 170 | ||
| 174 | if (PWR_LED(ctrl)) | 171 | pciehp_green_led_off(pslot); |
| 175 | pciehp_green_led_off(pslot); | 172 | pciehp_set_attention_status(pslot, 1); |
| 176 | |||
| 177 | if (ATTN_LED(ctrl)) { | ||
| 178 | if (pciehp_set_attention_status(pslot, 1)) { | ||
| 179 | ctrl_err(ctrl, | ||
| 180 | "Issue of Set Attention Led command failed\n"); | ||
| 181 | return; | ||
| 182 | } | ||
| 183 | } | ||
| 184 | } | 173 | } |
| 185 | 174 | ||
| 186 | /** | 175 | /** |
| @@ -203,8 +192,7 @@ static int board_added(struct slot *p_slot) | |||
| 203 | return retval; | 192 | return retval; |
| 204 | } | 193 | } |
| 205 | 194 | ||
| 206 | if (PWR_LED(ctrl)) | 195 | pciehp_green_led_blink(p_slot); |
| 207 | pciehp_green_led_blink(p_slot); | ||
| 208 | 196 | ||
| 209 | /* Check link training status */ | 197 | /* Check link training status */ |
| 210 | retval = pciehp_check_link_status(ctrl); | 198 | retval = pciehp_check_link_status(ctrl); |
| @@ -227,9 +215,7 @@ static int board_added(struct slot *p_slot) | |||
| 227 | goto err_exit; | 215 | goto err_exit; |
| 228 | } | 216 | } |
| 229 | 217 | ||
| 230 | if (PWR_LED(ctrl)) | 218 | pciehp_green_led_on(p_slot); |
| 231 | pciehp_green_led_on(p_slot); | ||
| 232 | |||
| 233 | return 0; | 219 | return 0; |
| 234 | 220 | ||
| 235 | err_exit: | 221 | err_exit: |
| @@ -243,7 +229,7 @@ err_exit: | |||
| 243 | */ | 229 | */ |
| 244 | static int remove_board(struct slot *p_slot) | 230 | static int remove_board(struct slot *p_slot) |
| 245 | { | 231 | { |
| 246 | int retval = 0; | 232 | int retval; |
| 247 | struct controller *ctrl = p_slot->ctrl; | 233 | struct controller *ctrl = p_slot->ctrl; |
| 248 | 234 | ||
| 249 | retval = pciehp_unconfigure_device(p_slot); | 235 | retval = pciehp_unconfigure_device(p_slot); |
| @@ -251,13 +237,8 @@ static int remove_board(struct slot *p_slot) | |||
| 251 | return retval; | 237 | return retval; |
| 252 | 238 | ||
| 253 | if (POWER_CTRL(ctrl)) { | 239 | if (POWER_CTRL(ctrl)) { |
| 254 | /* power off slot */ | 240 | pciehp_power_off_slot(p_slot); |
| 255 | retval = pciehp_power_off_slot(p_slot); | 241 | |
| 256 | if (retval) { | ||
| 257 | ctrl_err(ctrl, | ||
| 258 | "Issue of Slot Disable command failed\n"); | ||
| 259 | return retval; | ||
