aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug/ibmphp_core.c
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2013-11-14 13:28:18 -0500
committerBjorn Helgaas <bhelgaas@google.com>2013-11-14 13:28:18 -0500
commitf7625980f5820edd1a73536e1a03bcbc1f889fec (patch)
tree145e76f39b3e1d08d3e7a48a0993c0cd59088cc6 /drivers/pci/hotplug/ibmphp_core.c
parent4fbf888accb39af423f271111d44e8186f053723 (diff)
PCI: Fix whitespace, capitalization, and spelling errors
Fix whitespace, capitalization, and spelling errors. No functional change. I know "busses" is not an error, but "buses" was more common, so I used it consistently. Signed-off-by: Marta Rybczynska <rybczynska@gmail.com> (pci_reset_bridge_secondary_bus()) Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/pci/hotplug/ibmphp_core.c')
-rw-r--r--drivers/pci/hotplug/ibmphp_core.c109
1 files changed, 55 insertions, 54 deletions
diff --git a/drivers/pci/hotplug/ibmphp_core.c b/drivers/pci/hotplug/ibmphp_core.c
index cbd72d81d253..efdc13adbe41 100644
--- a/drivers/pci/hotplug/ibmphp_core.c
+++ b/drivers/pci/hotplug/ibmphp_core.c
@@ -58,7 +58,7 @@ MODULE_DESCRIPTION (DRIVER_DESC);
58struct pci_bus *ibmphp_pci_bus; 58struct pci_bus *ibmphp_pci_bus;
59static int max_slots; 59static int max_slots;
60 60
61static int irqs[16]; /* PIC mode IRQ's we're using so far (in case MPS 61static int irqs[16]; /* PIC mode IRQs we're using so far (in case MPS
62 * tables don't provide default info for empty slots */ 62 * tables don't provide default info for empty slots */
63 63
64static int init_flag; 64static int init_flag;
@@ -71,20 +71,20 @@ static inline int get_max_adapter_speed (struct hotplug_slot *hs, u8 *value)
71 return get_max_adapter_speed_1 (hs, value, 1); 71 return get_max_adapter_speed_1 (hs, value, 1);
72} 72}
73*/ 73*/
74static inline int get_cur_bus_info(struct slot **sl) 74static inline int get_cur_bus_info(struct slot **sl)
75{ 75{
76 int rc = 1; 76 int rc = 1;
77 struct slot * slot_cur = *sl; 77 struct slot * slot_cur = *sl;
78 78
79 debug("options = %x\n", slot_cur->ctrl->options); 79 debug("options = %x\n", slot_cur->ctrl->options);
80 debug("revision = %x\n", slot_cur->ctrl->revision); 80 debug("revision = %x\n", slot_cur->ctrl->revision);
81 81
82 if (READ_BUS_STATUS(slot_cur->ctrl)) 82 if (READ_BUS_STATUS(slot_cur->ctrl))
83 rc = ibmphp_hpc_readslot(slot_cur, READ_BUSSTATUS, NULL); 83 rc = ibmphp_hpc_readslot(slot_cur, READ_BUSSTATUS, NULL);
84 84
85 if (rc) 85 if (rc)
86 return rc; 86 return rc;
87 87
88 slot_cur->bus_on->current_speed = CURRENT_BUS_SPEED(slot_cur->busstatus); 88 slot_cur->bus_on->current_speed = CURRENT_BUS_SPEED(slot_cur->busstatus);
89 if (READ_BUS_MODE(slot_cur->ctrl)) 89 if (READ_BUS_MODE(slot_cur->ctrl))
90 slot_cur->bus_on->current_bus_mode = 90 slot_cur->bus_on->current_bus_mode =
@@ -96,7 +96,7 @@ static inline int get_cur_bus_info(struct slot **sl)
96 slot_cur->busstatus, 96 slot_cur->busstatus,
97 slot_cur->bus_on->current_speed, 97 slot_cur->bus_on->current_speed,
98 slot_cur->bus_on->current_bus_mode); 98 slot_cur->bus_on->current_bus_mode);
99 99
100 *sl = slot_cur; 100 *sl = slot_cur;
101 return 0; 101 return 0;
102} 102}
@@ -104,8 +104,8 @@ static inline int get_cur_bus_info(struct slot **sl)
104static inline int slot_update(struct slot **sl) 104static inline int slot_update(struct slot **sl)
105{ 105{
106 int rc; 106 int rc;
107 rc = ibmphp_hpc_readslot(*sl, READ_ALLSTAT, NULL); 107 rc = ibmphp_hpc_readslot(*sl, READ_ALLSTAT, NULL);
108 if (rc) 108 if (rc)
109 return rc; 109 return rc;
110 if (!init_flag) 110 if (!init_flag)
111 rc = get_cur_bus_info(sl); 111 rc = get_cur_bus_info(sl);
@@ -172,7 +172,7 @@ int ibmphp_init_devno(struct slot **cur_slot)
172 debug("(*cur_slot)->irq[3] = %x\n", 172 debug("(*cur_slot)->irq[3] = %x\n",
173 (*cur_slot)->irq[3]); 173 (*cur_slot)->irq[3]);
174 174
175 debug("rtable->exlusive_irqs = %x\n", 175 debug("rtable->exclusive_irqs = %x\n",
176 rtable->exclusive_irqs); 176 rtable->exclusive_irqs);
177 debug("rtable->slots[loop].irq[0].bitmap = %x\n", 177 debug("rtable->slots[loop].irq[0].bitmap = %x\n",
178 rtable->slots[loop].irq[0].bitmap); 178 rtable->slots[loop].irq[0].bitmap);
@@ -271,7 +271,7 @@ static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 value)
271 else 271 else
272 rc = -ENODEV; 272 rc = -ENODEV;
273 } 273 }
274 } else 274 } else
275 rc = -ENODEV; 275 rc = -ENODEV;
276 276
277 ibmphp_unlock_operations(); 277 ibmphp_unlock_operations();
@@ -288,7 +288,7 @@ static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 * value)
288 288
289 debug("get_attention_status - Entry hotplug_slot[%lx] pvalue[%lx]\n", 289 debug("get_attention_status - Entry hotplug_slot[%lx] pvalue[%lx]\n",
290 (ulong) hotplug_slot, (ulong) value); 290 (ulong) hotplug_slot, (ulong) value);
291 291
292 ibmphp_lock_operations(); 292 ibmphp_lock_operations();
293 if (hotplug_slot) { 293 if (hotplug_slot) {
294 pslot = hotplug_slot->private; 294 pslot = hotplug_slot->private;
@@ -406,14 +406,14 @@ static int get_max_bus_speed(struct slot *slot)
406 406
407 ibmphp_lock_operations(); 407 ibmphp_lock_operations();
408 mode = slot->supported_bus_mode; 408 mode = slot->supported_bus_mode;
409 speed = slot->supported_speed; 409 speed = slot->supported_speed;
410 ibmphp_unlock_operations(); 410 ibmphp_unlock_operations();
411 411
412 switch (speed) { 412 switch (speed) {
413 case BUS_SPEED_33: 413 case BUS_SPEED_33:
414 break; 414 break;
415 case BUS_SPEED_66: 415 case BUS_SPEED_66:
416 if (mode == BUS_MODE_PCIX) 416 if (mode == BUS_MODE_PCIX)
417 speed += 0x01; 417 speed += 0x01;
418 break; 418 break;
419 case BUS_SPEED_100: 419 case BUS_SPEED_100:
@@ -515,13 +515,13 @@ static int __init init_ops(void)
515 515
516 debug("BEFORE GETTING SLOT STATUS, slot # %x\n", 516 debug("BEFORE GETTING SLOT STATUS, slot # %x\n",
517 slot_cur->number); 517 slot_cur->number);
518 if (slot_cur->ctrl->revision == 0xFF) 518 if (slot_cur->ctrl->revision == 0xFF)
519 if (get_ctrl_revision(slot_cur, 519 if (get_ctrl_revision(slot_cur,
520 &slot_cur->ctrl->revision)) 520 &slot_cur->ctrl->revision))
521 return -1; 521 return -1;
522 522
523 if (slot_cur->bus_on->current_speed == 0xFF) 523 if (slot_cur->bus_on->current_speed == 0xFF)
524 if (get_cur_bus_info(&slot_cur)) 524 if (get_cur_bus_info(&slot_cur))
525 return -1; 525 return -1;
526 get_max_bus_speed(slot_cur); 526 get_max_bus_speed(slot_cur);
527 527
@@ -539,8 +539,8 @@ static int __init init_ops(void)
539 debug("SLOT_PRESENT = %x\n", SLOT_PRESENT(slot_cur->status)); 539 debug("SLOT_PRESENT = %x\n", SLOT_PRESENT(slot_cur->status));
540 debug("SLOT_LATCH = %x\n", SLOT_LATCH(slot_cur->status)); 540 debug("SLOT_LATCH = %x\n", SLOT_LATCH(slot_cur->status));
541 541
542 if ((SLOT_PWRGD(slot_cur->status)) && 542 if ((SLOT_PWRGD(slot_cur->status)) &&
543 !(SLOT_PRESENT(slot_cur->status)) && 543 !(SLOT_PRESENT(slot_cur->status)) &&
544 !(SLOT_LATCH(slot_cur->status))) { 544 !(SLOT_LATCH(slot_cur->status))) {
545 debug("BEFORE POWER OFF COMMAND\n"); 545 debug("BEFORE POWER OFF COMMAND\n");
546 rc = power_off(slot_cur); 546 rc = power_off(slot_cur);
@@ -581,13 +581,13 @@ static int validate(struct slot *slot_cur, int opn)
581 581
582 switch (opn) { 582 switch (opn) {
583 case ENABLE: 583 case ENABLE:
584 if (!(SLOT_PWRGD(slot_cur->status)) && 584 if (!(SLOT_PWRGD(slot_cur->status)) &&
585 (SLOT_PRESENT(slot_cur->status)) && 585 (SLOT_PRESENT(slot_cur->status)) &&
586 !(SLOT_LATCH(slot_cur->status))) 586 !(SLOT_LATCH(slot_cur->status)))
587 return 0; 587 return 0;
588 break; 588 break;
589 case DISABLE: 589 case DISABLE:
590 if ((SLOT_PWRGD(slot_cur->status)) && 590 if ((SLOT_PWRGD(slot_cur->status)) &&
591 (SLOT_PRESENT(slot_cur->status)) && 591 (SLOT_PRESENT(slot_cur->status)) &&
592 !(SLOT_LATCH(slot_cur->status))) 592 !(SLOT_LATCH(slot_cur->status)))
593 return 0; 593 return 0;
@@ -617,7 +617,7 @@ int ibmphp_update_slot_info(struct slot *slot_cur)
617 err("out of system memory\n"); 617 err("out of system memory\n");
618 return -ENOMEM; 618 return -ENOMEM;
619 } 619 }
620 620
621 info->power_status = SLOT_PWRGD(slot_cur->status); 621 info->power_status = SLOT_PWRGD(slot_cur->status);
622 info->attention_status = SLOT_ATTN(slot_cur->status, 622 info->attention_status = SLOT_ATTN(slot_cur->status,
623 slot_cur->ext_status); 623 slot_cur->ext_status);
@@ -638,7 +638,7 @@ int ibmphp_update_slot_info(struct slot *slot_cur)
638 case BUS_SPEED_33: 638 case BUS_SPEED_33:
639 break; 639 break;
640 case BUS_SPEED_66: 640 case BUS_SPEED_66:
641 if (mode == BUS_MODE_PCIX) 641 if (mode == BUS_MODE_PCIX)
642 bus_speed += 0x01; 642 bus_speed += 0x01;
643 else if (mode == BUS_MODE_PCI) 643 else if (mode == BUS_MODE_PCI)
644 ; 644 ;
@@ -654,8 +654,8 @@ int ibmphp_update_slot_info(struct slot *slot_cur)
654 } 654 }
655 655
656 bus->cur_bus_speed = bus_speed; 656 bus->cur_bus_speed = bus_speed;
657 // To do: bus_names 657 // To do: bus_names
658 658
659 rc = pci_hp_change_slot_info(slot_cur->hotplug_slot, info); 659 rc = pci_hp_change_slot_info(slot_cur->hotplug_slot, info);
660 kfree(info); 660 kfree(info);
661 return rc; 661 return rc;
@@ -729,8 +729,8 @@ static void ibm_unconfigure_device(struct pci_func *func)
729} 729}
730 730
731/* 731/*
732 * The following function is to fix kernel bug regarding 732 * The following function is to fix kernel bug regarding
733 * getting bus entries, here we manually add those primary 733 * getting bus entries, here we manually add those primary
734 * bus entries to kernel bus structure whenever apply 734 * bus entries to kernel bus structure whenever apply
735 */ 735 */
736static u8 bus_structure_fixup(u8 busno) 736static u8 bus_structure_fixup(u8 busno)
@@ -814,7 +814,7 @@ static int ibm_configure_device(struct pci_func *func)
814} 814}
815 815
816/******************************************************* 816/*******************************************************
817 * Returns whether the bus is empty or not 817 * Returns whether the bus is empty or not
818 *******************************************************/ 818 *******************************************************/
819static int is_bus_empty(struct slot * slot_cur) 819static int is_bus_empty(struct slot * slot_cur)
820{ 820{
@@ -842,7 +842,7 @@ static int is_bus_empty(struct slot * slot_cur)
842} 842}
843 843
844/*********************************************************** 844/***********************************************************
845 * If the HPC permits and the bus currently empty, tries to set the 845 * If the HPC permits and the bus currently empty, tries to set the
846 * bus speed and mode at the maximum card and bus capability 846 * bus speed and mode at the maximum card and bus capability
847 * Parameters: slot 847 * Parameters: slot
848 * Returns: bus is set (0) or error code 848 * Returns: bus is set (0) or error code
@@ -856,7 +856,7 @@ static int set_bus(struct slot * slot_cur)
856 static struct pci_device_id ciobx[] = { 856 static struct pci_device_id ciobx[] = {
857 { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, 0x0101) }, 857 { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, 0x0101) },
858 { }, 858 { },
859 }; 859 };
860 860
861 debug("%s - entry slot # %d\n", __func__, slot_cur->number); 861 debug("%s - entry slot # %d\n", __func__, slot_cur->number);
862 if (SET_BUS_STATUS(slot_cur->ctrl) && is_bus_empty(slot_cur)) { 862 if (SET_BUS_STATUS(slot_cur->ctrl) && is_bus_empty(slot_cur)) {
@@ -877,7 +877,7 @@ static int set_bus(struct slot * slot_cur)
877 else if (!SLOT_BUS_MODE(slot_cur->ext_status)) 877 else if (!SLOT_BUS_MODE(slot_cur->ext_status))
878 /* if max slot/bus capability is 66 pci 878 /* if max slot/bus capability is 66 pci
879 and there's no bus mode mismatch, then 879 and there's no bus mode mismatch, then
880 the adapter supports 66 pci */ 880 the adapter supports 66 pci */
881 cmd = HPC_BUS_66CONVMODE; 881 cmd = HPC_BUS_66CONVMODE;
882 else 882 else
883 cmd = HPC_BUS_33CONVMODE; 883 cmd = HPC_BUS_33CONVMODE;
@@ -930,7 +930,7 @@ static int set_bus(struct slot * slot_cur)
930 return -EIO; 930 return -EIO;
931 } 931 }
932 } 932 }
933 /* This is for x440, once Brandon fixes the firmware, 933 /* This is for x440, once Brandon fixes the firmware,
934 will not need this delay */ 934 will not need this delay */
935 msleep(1000); 935 msleep(1000);
936 debug("%s -Exit\n", __func__); 936 debug("%s -Exit\n", __func__);
@@ -938,9 +938,9 @@ static int set_bus(struct slot * slot_cur)
938} 938}
939 939
940/* This routine checks the bus limitations that the slot is on from the BIOS. 940/* This routine checks the bus limitations that the slot is on from the BIOS.
941 * This is used in deciding whether or not to power up the slot. 941 * This is used in deciding whether or not to power up the slot.
942 * (electrical/spec limitations. For example, >1 133 MHz or >2 66 PCI cards on 942 * (electrical/spec limitations. For example, >1 133 MHz or >2 66 PCI cards on
943 * same bus) 943 * same bus)
944 * Parameters: slot 944 * Parameters: slot
945 * Returns: 0 = no limitations, -EINVAL = exceeded limitations on the bus 945 * Returns: 0 = no limitations, -EINVAL = exceeded limitations on the bus
946 */ 946 */
@@ -986,7 +986,7 @@ static int check_limitations(struct slot *slot_cur)
986static inline void print_card_capability(struct slot *slot_cur) 986static inline void print_card_capability(struct slot *slot_cur)
987{ 987{
988 info("capability of the card is "); 988 info("capability of the card is ");
989 if ((slot_cur->ext_status & CARD_INFO) == PCIX133) 989 if ((slot_cur->ext_status & CARD_INFO) == PCIX133)
990 info(" 133 MHz PCI-X\n"); 990 info(" 133 MHz PCI-X\n");
991 else if ((slot_cur->ext_status & CARD_INFO) == PCIX66) 991 else if ((slot_cur->ext_status & CARD_INFO) == PCIX66)
992 info(" 66 MHz PCI-X\n"); 992 info(" 66 MHz PCI-X\n");
@@ -1020,7 +1020,7 @@ static int enable_slot(struct hotplug_slot *hs)
1020 } 1020 }
1021 1021
1022 attn_LED_blink(slot_cur); 1022 attn_LED_blink(slot_cur);
1023 1023
1024 rc = set_bus(slot_cur); 1024 rc = set_bus(slot_cur);
1025 if (rc) { 1025 if (rc) {
1026 err("was not able to set the bus\n"); 1026 err("was not able to set the bus\n");
@@ -1082,7 +1082,7 @@ static int enable_slot(struct hotplug_slot *hs)
1082 rc = slot_update(&slot_cur); 1082 rc = slot_update(&slot_cur);
1083 if (rc) 1083 if (rc)
1084 goto error_power; 1084 goto error_power;
1085 1085
1086 rc = -EINVAL; 1086 rc = -EINVAL;
1087 if (SLOT_POWER(slot_cur->status) && !(SLOT_PWRGD(slot_cur->status))) { 1087 if (SLOT_POWER(slot_cur->status) && !(SLOT_PWRGD(slot_cur->status))) {
1088 err("power fault occurred trying to power up...\n"); 1088 err("power fault occurred trying to power up...\n");
@@ -1093,7 +1093,7 @@ static int enable_slot(struct hotplug_slot *hs)
1093 "speed and card capability\n"); 1093 "speed and card capability\n");
1094 print_card_capability(slot_cur); 1094 print_card_capability(slot_cur);
1095 goto error_power; 1095 goto error_power;
1096 } 1096 }
1097 /* Don't think this case will happen after above checks... 1097 /* Don't think this case will happen after above checks...
1098 * but just in case, for paranoia sake */ 1098 * but just in case, for paranoia sake */
1099 if (!(SLOT_POWER(slot_cur->status))) { 1099 if (!(SLOT_POWER(slot_cur->status))) {
@@ -1144,7 +1144,7 @@ static int enable_slot(struct hotplug_slot *hs)
1144 ibmphp_print_test(); 1144 ibmphp_print_test();
1145 rc = ibmphp_update_slot_info(slot_cur); 1145 rc = ibmphp_update_slot_info(slot_cur);
1146exit: 1146exit:
1147 ibmphp_unlock_operations(); 1147 ibmphp_unlock_operations();
1148 return rc; 1148 return rc;
1149 1149
1150error_nopower: 1150error_nopower:
@@ -1180,7 +1180,7 @@ static int ibmphp_disable_slot(struct hotplug_slot *hotplug_slot)
1180{ 1180{
1181 struct slot *slot = hotplug_slot->private; 1181 struct slot *slot = hotplug_slot->private;
1182 int rc; 1182 int rc;
1183 1183
1184 ibmphp_lock_operations(); 1184 ibmphp_lock_operations();
1185 rc = ibmphp_do_disable_slot(slot); 1185 rc = ibmphp_do_disable_slot(slot);
1186 ibmphp_unlock_operations(); 1186 ibmphp_unlock_operations();
@@ -1192,12 +1192,12 @@ int ibmphp_do_disable_slot(struct slot *slot_cur)
1192 int rc; 1192 int rc;
1193 u8 flag; 1193 u8 flag;
1194 1194
1195 debug("DISABLING SLOT...\n"); 1195 debug("DISABLING SLOT...\n");
1196 1196
1197 if ((slot_cur == NULL) || (slot_cur->ctrl == NULL)) { 1197 if ((slot_cur == NULL) || (slot_cur->ctrl == NULL)) {
1198 return -ENODEV; 1198 return -ENODEV;
1199 } 1199 }
1200 1200
1201 flag = slot_cur->flag; 1201 flag = slot_cur->flag;
1202 slot_cur->flag = 1; 1202 slot_cur->flag = 1;
1203 1203
@@ -1210,7 +1210,7 @@ int ibmphp_do_disable_slot(struct slot *slot_cur)
1210 attn_LED_blink(slot_cur); 1210 attn_LED_blink(slot_cur);
1211 1211
1212 if (slot_cur->func == NULL) { 1212 if (slot_cur->func == NULL) {
1213 /* We need this for fncs's that were there on bootup */ 1213 /* We need this for functions that were there on bootup */
1214 slot_cur->func = kzalloc(sizeof(struct pci_func), GFP_KERNEL); 1214 slot_cur->func = kzalloc(sizeof(struct pci_func), GFP_KERNEL);
1215 if (!slot_cur->func) { 1215 if (!slot_cur->func) {
1216 err("out of system memory\n"); 1216 err("out of system memory\n");
@@ -1222,12 +1222,13 @@ int ibmphp_do_disable_slot(struct slot *slot_cur)
1222 } 1222 }
1223 1223
1224 ibm_unconfigure_device(slot_cur->func); 1224 ibm_unconfigure_device(slot_cur->func);
1225 1225
1226 /* If we got here from latch suddenly opening on operating card or 1226 /*
1227 a power fault, there's no power to the card, so cannot 1227 * If we got here from latch suddenly opening on operating card or
1228 read from it to determine what resources it occupied. This operation 1228 * a power fault, there's no power to the card, so cannot
1229 is forbidden anyhow. The best we can do is remove it from kernel 1229 * read from it to determine what resources it occupied. This operation
1230 lists at least */ 1230 * is forbidden anyhow. The best we can do is remove it from kernel
1231 * lists at least */
1231 1232
1232 if (!flag) { 1233 if (!flag) {
1233 attn_off(slot_cur); 1234 attn_off(slot_cur);
@@ -1264,7 +1265,7 @@ error:
1264 rc = -EFAULT; 1265 rc = -EFAULT;
1265 goto exit; 1266 goto exit;
1266 } 1267 }
1267 if (flag) 1268 if (flag)
1268 ibmphp_update_slot_info(slot_cur); 1269 ibmphp_update_slot_info(slot_cur);
1269 goto exit; 1270 goto exit;
1270} 1271}
@@ -1339,7 +1340,7 @@ static int __init ibmphp_init(void)
1339 debug("AFTER Resource & EBDA INITIALIZATIONS\n"); 1340 debug("AFTER Resource & EBDA INITIALIZATIONS\n");
1340 1341
1341 max_slots = get_max_slots(); 1342 max_slots = get_max_slots();
1342 1343
1343 if ((rc = ibmphp_register_pci())) 1344 if ((rc = ibmphp_register_pci()))
1344 goto error; 1345 goto error;
1345 1346