aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/sgi-xp/xpc_partition.c
diff options
context:
space:
mode:
authorDean Nelson <dcn@sgi.com>2008-05-12 17:02:02 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-05-13 11:02:23 -0400
commit65c17b801e03e40acdca0cd34e8eb1b8a347b539 (patch)
treefe5c5ccb73604d6cbd88525f930b50b8435a71a7 /drivers/misc/sgi-xp/xpc_partition.c
parent0cf942d75a6acfa11a41f63330d8780901eda4af (diff)
drivers/misc/sgi-xp: clean up return values
Make XP return values more generic to XP and not so tied to XPC by changing enum xpc_retval to xp_retval, along with changing return value prefixes from xpc to xp. Also, cleanup a comment block that referenced some of these return values as well as the handling of BTE related return values. Signed-off-by: Dean Nelson <dcn@sgi.com> Acked-by: Robin Holt <holt@sgi.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/misc/sgi-xp/xpc_partition.c')
-rw-r--r--drivers/misc/sgi-xp/xpc_partition.c64
1 files changed, 32 insertions, 32 deletions
diff --git a/drivers/misc/sgi-xp/xpc_partition.c b/drivers/misc/sgi-xp/xpc_partition.c
index acd3fd4285d7..d9b462ea29d7 100644
--- a/drivers/misc/sgi-xp/xpc_partition.c
+++ b/drivers/misc/sgi-xp/xpc_partition.c
@@ -444,7 +444,7 @@ xpc_check_remote_hb(void)
444 (remote_vars->heartbeat_offline == 0)) || 444 (remote_vars->heartbeat_offline == 0)) ||
445 !xpc_hb_allowed(sn_partition_id, remote_vars)) { 445 !xpc_hb_allowed(sn_partition_id, remote_vars)) {
446 446
447 XPC_DEACTIVATE_PARTITION(part, xpcNoHeartbeat); 447 XPC_DEACTIVATE_PARTITION(part, xpNoHeartbeat);
448 continue; 448 continue;
449 } 449 }
450 450
@@ -459,7 +459,7 @@ xpc_check_remote_hb(void)
459 * is large enough to contain a copy of their reserved page header and 459 * is large enough to contain a copy of their reserved page header and
460 * part_nasids mask. 460 * part_nasids mask.
461 */ 461 */
462static enum xpc_retval 462static enum xp_retval
463xpc_get_remote_rp(int nasid, u64 *discovered_nasids, 463xpc_get_remote_rp(int nasid, u64 *discovered_nasids,
464 struct xpc_rsvd_page *remote_rp, u64 *remote_rp_pa) 464 struct xpc_rsvd_page *remote_rp, u64 *remote_rp_pa)
465{ 465{
@@ -469,7 +469,7 @@ xpc_get_remote_rp(int nasid, u64 *discovered_nasids,
469 469
470 *remote_rp_pa = xpc_get_rsvd_page_pa(nasid); 470 *remote_rp_pa = xpc_get_rsvd_page_pa(nasid);
471 if (*remote_rp_pa == 0) 471 if (*remote_rp_pa == 0)
472 return xpcNoRsvdPageAddr; 472 return xpNoRsvdPageAddr;
473 473
474 /* pull over the reserved page header and part_nasids mask */ 474 /* pull over the reserved page header and part_nasids mask */
475 bres = xp_bte_copy(*remote_rp_pa, (u64)remote_rp, 475 bres = xp_bte_copy(*remote_rp_pa, (u64)remote_rp,
@@ -489,18 +489,18 @@ xpc_get_remote_rp(int nasid, u64 *discovered_nasids,
489 489
490 if (remote_rp->partid < 1 || 490 if (remote_rp->partid < 1 ||
491 remote_rp->partid > (XP_MAX_PARTITIONS - 1)) { 491 remote_rp->partid > (XP_MAX_PARTITIONS - 1)) {
492 return xpcInvalidPartid; 492 return xpInvalidPartid;
493 } 493 }
494 494
495 if (remote_rp->partid == sn_partition_id) 495 if (remote_rp->partid == sn_partition_id)
496 return xpcLocalPartid; 496 return xpLocalPartid;
497 497
498 if (XPC_VERSION_MAJOR(remote_rp->version) != 498 if (XPC_VERSION_MAJOR(remote_rp->version) !=
499 XPC_VERSION_MAJOR(XPC_RP_VERSION)) { 499 XPC_VERSION_MAJOR(XPC_RP_VERSION)) {
500 return xpcBadVersion; 500 return xpBadVersion;
501 } 501 }
502 502
503 return xpcSuccess; 503 return xpSuccess;
504} 504}
505 505
506/* 506/*
@@ -509,13 +509,13 @@ xpc_get_remote_rp(int nasid, u64 *discovered_nasids,
509 * remote_vars points to a buffer that is cacheline aligned for BTE copies and 509 * remote_vars points to a buffer that is cacheline aligned for BTE copies and
510 * assumed to be of size XPC_RP_VARS_SIZE. 510 * assumed to be of size XPC_RP_VARS_SIZE.
511 */ 511 */
512static enum xpc_retval 512static enum xp_retval
513xpc_get_remote_vars(u64 remote_vars_pa, struct xpc_vars *remote_vars) 513xpc_get_remote_vars(u64 remote_vars_pa, struct xpc_vars *remote_vars)
514{ 514{
515 int bres; 515 int bres;
516 516
517 if (remote_vars_pa == 0) 517 if (remote_vars_pa == 0)
518 return xpcVarsNotSet; 518 return xpVarsNotSet;
519 519
520 /* pull over the cross partition variables */ 520 /* pull over the cross partition variables */
521 bres = xp_bte_copy(remote_vars_pa, (u64)remote_vars, XPC_RP_VARS_SIZE, 521 bres = xp_bte_copy(remote_vars_pa, (u64)remote_vars, XPC_RP_VARS_SIZE,
@@ -525,10 +525,10 @@ xpc_get_remote_vars(u64 remote_vars_pa, struct xpc_vars *remote_vars)
525 525
526 if (XPC_VERSION_MAJOR(remote_vars->version) != 526 if (XPC_VERSION_MAJOR(remote_vars->version) !=
527 XPC_VERSION_MAJOR(XPC_V_VERSION)) { 527 XPC_VERSION_MAJOR(XPC_V_VERSION)) {
528 return xpcBadVersion; 528 return xpBadVersion;
529 } 529 }
530 530
531 return xpcSuccess; 531 return xpSuccess;
532} 532}
533 533
534/* 534/*
@@ -606,14 +606,14 @@ xpc_identify_act_IRQ_req(int nasid)
606 struct timespec remote_rp_stamp = { 0, 0 }; 606 struct timespec remote_rp_stamp = { 0, 0 };
607 partid_t partid; 607 partid_t partid;
608 struct xpc_partition *part; 608 struct xpc_partition *part;
609 enum xpc_retval ret; 609 enum xp_retval ret;
610 610
611 /* pull over the reserved page structure */ 611 /* pull over the reserved page structure */
612 612
613 remote_rp = (struct xpc_rsvd_page *)xpc_remote_copy_buffer; 613 remote_rp = (struct xpc_rsvd_page *)xpc_remote_copy_buffer;
614 614
615 ret = xpc_get_remote_rp(nasid, NULL, remote_rp, &remote_rp_pa); 615 ret = xpc_get_remote_rp(nasid, NULL, remote_rp, &remote_rp_pa);
616 if (ret != xpcSuccess) { 616 if (ret != xpSuccess) {
617 dev_warn(xpc_part, "unable to get reserved page from nasid %d, " 617 dev_warn(xpc_part, "unable to get reserved page from nasid %d, "
618 "which sent interrupt, reason=%d\n", nasid, ret); 618 "which sent interrupt, reason=%d\n", nasid, ret);
619 return; 619 return;
@@ -632,7 +632,7 @@ xpc_identify_act_IRQ_req(int nasid)
632 remote_vars = (struct xpc_vars *)xpc_remote_copy_buffer; 632 remote_vars = (struct xpc_vars *)xpc_remote_copy_buffer;
633 633
634 ret = xpc_get_remote_vars(remote_vars_pa, remote_vars); 634 ret = xpc_get_remote_vars(remote_vars_pa, remote_vars);
635 if (ret != xpcSuccess) { 635 if (ret != xpSuccess) {
636 636
637 dev_warn(xpc_part, "unable to get XPC variables from nasid %d, " 637 dev_warn(xpc_part, "unable to get XPC variables from nasid %d, "
638 "which sent interrupt, reason=%d\n", nasid, ret); 638 "which sent interrupt, reason=%d\n", nasid, ret);
@@ -699,7 +699,7 @@ xpc_identify_act_IRQ_req(int nasid)
699 &remote_rp_stamp, remote_rp_pa, 699 &remote_rp_stamp, remote_rp_pa,
700 remote_vars_pa, remote_vars); 700 remote_vars_pa, remote_vars);
701 part->reactivate_nasid = nasid; 701 part->reactivate_nasid = nasid;
702 XPC_DEACTIVATE_PARTITION(part, xpcReactivating); 702 XPC_DEACTIVATE_PARTITION(part, xpReactivating);
703 return; 703 return;
704 } 704 }
705 705
@@ -754,11 +754,11 @@ xpc_identify_act_IRQ_req(int nasid)
754 754
755 if (reactivate) { 755 if (reactivate) {
756 part->reactivate_nasid = nasid; 756 part->reactivate_nasid = nasid;
757 XPC_DEACTIVATE_PARTITION(part, xpcReactivating); 757 XPC_DEACTIVATE_PARTITION(part, xpReactivating);
758 758
759 } else if (XPC_SUPPORTS_DISENGAGE_REQUEST(part->remote_vars_version) && 759 } else if (XPC_SUPPORTS_DISENGAGE_REQUEST(part->remote_vars_version) &&
760 xpc_partition_disengage_requested(1UL << partid)) { 760 xpc_partition_disengage_requested(1UL << partid)) {
761 XPC_DEACTIVATE_PARTITION(part, xpcOtherGoingDown); 761 XPC_DEACTIVATE_PARTITION(part, xpOtherGoingDown);
762 } 762 }
763} 763}
764 764
@@ -870,20 +870,20 @@ xpc_partition_disengaged(struct xpc_partition *part)
870/* 870/*
871 * Mark specified partition as active. 871 * Mark specified partition as active.
872 */ 872 */
873enum xpc_retval 873enum xp_retval
874xpc_mark_partition_active(struct xpc_partition *part) 874xpc_mark_partition_active(struct xpc_partition *part)
875{ 875{
876 unsigned long irq_flags; 876 unsigned long irq_flags;
877 enum xpc_retval ret; 877 enum xp_retval ret;
878 878
879 dev_dbg(xpc_part, "setting partition %d to ACTIVE\n", XPC_PARTID(part)); 879 dev_dbg(xpc_part, "setting partition %d to ACTIVE\n", XPC_PARTID(part));
880 880
881 spin_lock_irqsave(&part->act_lock, irq_flags); 881 spin_lock_irqsave(&part->act_lock, irq_flags);
882 if (part->act_state == XPC_P_ACTIVATING) { 882 if (part->act_state == XPC_P_ACTIVATING) {
883 part->act_state = XPC_P_ACTIVE; 883 part->act_state = XPC_P_ACTIVE;
884 ret = xpcSuccess; 884 ret = xpSuccess;
885 } else { 885 } else {
886 DBUG_ON(part->reason == xpcSuccess); 886 DBUG_ON(part->reason == xpSuccess);
887 ret = part->reason; 887 ret = part->reason;
888 } 888 }
889 spin_unlock_irqrestore(&part->act_lock, irq_flags); 889 spin_unlock_irqrestore(&part->act_lock, irq_flags);
@@ -896,7 +896,7 @@ xpc_mark_partition_active(struct xpc_partition *part)
896 */ 896 */
897void 897void
898xpc_deactivate_partition(const int line, struct xpc_partition *part, 898xpc_deactivate_partition(const int line, struct xpc_partition *part,
899 enum xpc_retval reason) 899 enum xp_retval reason)
900{ 900{
901 unsigned long irq_flags; 901 unsigned long irq_flags;
902 902
@@ -905,15 +905,15 @@ xpc_deactivate_partition(const int line, struct xpc_partition *part,
905 if (part->act_state == XPC_P_INACTIVE) { 905 if (part->act_state == XPC_P_INACTIVE) {
906 XPC_SET_REASON(part, reason, line); 906 XPC_SET_REASON(part, reason, line);
907 spin_unlock_irqrestore(&part->act_lock, irq_flags); 907 spin_unlock_irqrestore(&part->act_lock, irq_flags);
908 if (reason == xpcReactivating) { 908 if (reason == xpReactivating) {
909 /* we interrupt ourselves to reactivate partition */ 909 /* we interrupt ourselves to reactivate partition */
910 xpc_IPI_send_reactivate(part); 910 xpc_IPI_send_reactivate(part);
911 } 911 }
912 return; 912 return;
913 } 913 }
914 if (part->act_state == XPC_P_DEACTIVATING) { 914 if (part->act_state == XPC_P_DEACTIVATING) {
915 if ((part->reason == xpcUnloading && reason != xpcUnloading) || 915 if ((part->reason == xpUnloading && reason != xpUnloading) ||
916 reason == xpcReactivating) { 916 reason == xpReactivating) {
917 XPC_SET_REASON(part, reason, line); 917 XPC_SET_REASON(part, reason, line);
918 } 918 }
919 spin_unlock_irqrestore(&part->act_lock, irq_flags); 919 spin_unlock_irqrestore(&part->act_lock, irq_flags);
@@ -985,7 +985,7 @@ xpc_discovery(void)
985 partid_t partid; 985 partid_t partid;
986 struct xpc_partition *part; 986 struct xpc_partition *part;
987 u64 *discovered_nasids; 987 u64 *discovered_nasids;
988 enum xpc_retval ret; 988 enum xp_retval ret;
989 989
990 remote_rp = xpc_kmalloc_cacheline_aligned(XPC_RP_HEADER_SIZE + 990 remote_rp = xpc_kmalloc_cacheline_aligned(XPC_RP_HEADER_SIZE +
991 xp_nasid_mask_bytes, 991 xp_nasid_mask_bytes,
@@ -1063,12 +1063,12 @@ xpc_discovery(void)
1063 1063
1064 ret = xpc_get_remote_rp(nasid, discovered_nasids, 1064 ret = xpc_get_remote_rp(nasid, discovered_nasids,
1065 remote_rp, &remote_rp_pa); 1065 remote_rp, &remote_rp_pa);
1066 if (ret != xpcSuccess) { 1066 if (ret != xpSuccess) {
1067 dev_dbg(xpc_part, "unable to get reserved page " 1067 dev_dbg(xpc_part, "unable to get reserved page "
1068 "from nasid %d, reason=%d\n", nasid, 1068 "from nasid %d, reason=%d\n", nasid,
1069 ret); 1069 ret);
1070 1070
1071 if (ret == xpcLocalPartid) 1071 if (ret == xpLocalPartid)
1072 break; 1072 break;
1073 1073
1074 continue; 1074 continue;
@@ -1082,7 +1082,7 @@ xpc_discovery(void)
1082 /* pull over the cross partition variables */ 1082 /* pull over the cross partition variables */
1083 1083
1084 ret = xpc_get_remote_vars(remote_vars_pa, remote_vars); 1084 ret = xpc_get_remote_vars(remote_vars_pa, remote_vars);
1085 if (ret != xpcSuccess) { 1085 if (ret != xpSuccess) {
1086 dev_dbg(xpc_part, "unable to get XPC variables " 1086 dev_dbg(xpc_part, "unable to get XPC variables "
1087 "from nasid %d, reason=%d\n", nasid, 1087 "from nasid %d, reason=%d\n", nasid,
1088 ret); 1088 ret);
@@ -1116,7 +1116,7 @@ xpc_discovery(void)
1116 "register xp_addr region 0x%016lx\n", 1116 "register xp_addr region 0x%016lx\n",
1117 partid, remote_vars->amos_page_pa); 1117 partid, remote_vars->amos_page_pa);
1118 1118
1119 XPC_SET_REASON(part, xpcPhysAddrRegFailed, 1119 XPC_SET_REASON(part, xpPhysAddrRegFailed,
1120 __LINE__); 1120 __LINE__);
1121 break; 1121 break;
1122 } 1122 }
@@ -1151,7 +1151,7 @@ xpc_discovery(void)
1151 * Given a partid, get the nasids owned by that partition from the 1151 * Given a partid, get the nasids owned by that partition from the
1152 * remote partition's reserved page. 1152 * remote partition's reserved page.
1153 */ 1153 */
1154enum xpc_retval 1154enum xp_retval
1155xpc_initiate_partid_to_nasids(partid_t partid, void *nasid_mask) 1155xpc_initiate_partid_to_nasids(partid_t partid, void *nasid_mask)
1156{ 1156{
1157 struct xpc_partition *part; 1157 struct xpc_partition *part;
@@ -1160,7 +1160,7 @@ xpc_initiate_partid_to_nasids(partid_t partid, void *nasid_mask)
1160 1160
1161 part = &xpc_partitions[partid]; 1161 part = &xpc_partitions[partid];
1162 if (part->remote_rp_pa == 0) 1162 if (part->remote_rp_pa == 0)
1163 return xpcPartitionDown; 1163 return xpPartitionDown;
1164 1164
1165 memset(nasid_mask, 0, XP_NASID_MASK_BYTES); 1165 memset(nasid_mask, 0, XP_NASID_MASK_BYTES);
1166 1166