aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/sgi-xp/xpc_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc/sgi-xp/xpc_main.c')
-rw-r--r--drivers/misc/sgi-xp/xpc_main.c49
1 files changed, 25 insertions, 24 deletions
diff --git a/drivers/misc/sgi-xp/xpc_main.c b/drivers/misc/sgi-xp/xpc_main.c
index e7ff9e1670f6..f7478cc3572d 100644
--- a/drivers/misc/sgi-xp/xpc_main.c
+++ b/drivers/misc/sgi-xp/xpc_main.c
@@ -43,19 +43,13 @@
43 * 43 *
44 */ 44 */
45 45
46#include <linux/kernel.h>
47#include <linux/module.h> 46#include <linux/module.h>
48#include <linux/init.h> 47#include <linux/sysctl.h>
49#include <linux/cache.h> 48#include <linux/device.h>
50#include <linux/interrupt.h>
51#include <linux/delay.h> 49#include <linux/delay.h>
52#include <linux/reboot.h> 50#include <linux/reboot.h>
53#include <linux/completion.h>
54#include <linux/kdebug.h> 51#include <linux/kdebug.h>
55#include <linux/kthread.h> 52#include <linux/kthread.h>
56#include <linux/uaccess.h>
57#include <asm/sn/intr.h>
58#include <asm/sn/sn_sal.h>
59#include "xpc.h" 53#include "xpc.h"
60 54
61/* define two XPC debug device structures to be used with dev_dbg() et al */ 55/* define two XPC debug device structures to be used with dev_dbg() et al */
@@ -175,6 +169,8 @@ static struct notifier_block xpc_die_notifier = {
175 .notifier_call = xpc_system_die, 169 .notifier_call = xpc_system_die,
176}; 170};
177 171
172enum xp_retval (*xpc_get_partition_rsvd_page_pa) (u64 buf, u64 *cookie,
173 u64 *paddr, size_t *len);
178enum xp_retval (*xpc_rsvd_page_init) (struct xpc_rsvd_page *rp); 174enum xp_retval (*xpc_rsvd_page_init) (struct xpc_rsvd_page *rp);
179void (*xpc_heartbeat_init) (void); 175void (*xpc_heartbeat_init) (void);
180void (*xpc_heartbeat_exit) (void); 176void (*xpc_heartbeat_exit) (void);
@@ -920,7 +916,8 @@ xpc_die_deactivate(void)
920 struct xpc_partition *part; 916 struct xpc_partition *part;
921 short partid; 917 short partid;
922 int any_engaged; 918 int any_engaged;
923 long time, printmsg_time, disengage_timeout; 919 long keep_waiting;
920 long wait_to_print;
924 921
925 /* keep xpc_hb_checker thread from doing anything (just in case) */ 922 /* keep xpc_hb_checker thread from doing anything (just in case) */
926 xpc_exiting = 1; 923 xpc_exiting = 1;
@@ -937,16 +934,17 @@ xpc_die_deactivate(void)
937 } 934 }
938 } 935 }
939 936
940 time = rtc_time();
941 printmsg_time = time +
942 (XPC_DEACTIVATE_PRINTMSG_INTERVAL * sn_rtc_cycles_per_second);
943 disengage_timeout = time +
944 (xpc_disengage_timelimit * sn_rtc_cycles_per_second);
945
946 /* 937 /*
947 * Though we requested that all other partitions deactivate from us, 938 * Though we requested that all other partitions deactivate from us,
948 * we only wait until they've all disengaged. 939 * we only wait until they've all disengaged or we've reached the
940 * defined timelimit.
941 *
942 * Given that one iteration through the following while-loop takes
943 * approximately 200 microseconds, calculate the #of loops to take
944 * before bailing and the #of loops before printing a waiting message.
949 */ 945 */
946 keep_waiting = xpc_disengage_timelimit * 1000 * 5;
947 wait_to_print = XPC_DEACTIVATE_PRINTMSG_INTERVAL * 1000 * 5;
950 948
951 while (1) { 949 while (1) {
952 any_engaged = xpc_any_partition_engaged(); 950 any_engaged = xpc_any_partition_engaged();
@@ -955,8 +953,7 @@ xpc_die_deactivate(void)
955 break; 953 break;
956 } 954 }
957 955
958 time = rtc_time(); 956 if (!keep_waiting--) {
959 if (time >= disengage_timeout) {
960 for (partid = 0; partid < xp_max_npartitions; 957 for (partid = 0; partid < xp_max_npartitions;
961 partid++) { 958 partid++) {
962 if (xpc_partition_engaged(partid)) { 959 if (xpc_partition_engaged(partid)) {
@@ -968,15 +965,15 @@ xpc_die_deactivate(void)
968 break; 965 break;
969 } 966 }
970 967
971 if (time >= printmsg_time) { 968 if (!wait_to_print--) {
972 dev_info(xpc_part, "waiting for remote partitions to " 969 dev_info(xpc_part, "waiting for remote partitions to "
973 "deactivate, timeout in %ld seconds\n", 970 "deactivate, timeout in %ld seconds\n",
974 (disengage_timeout - time) / 971 keep_waiting / (1000 * 5));
975 sn_rtc_cycles_per_second); 972 wait_to_print = XPC_DEACTIVATE_PRINTMSG_INTERVAL *
976 printmsg_time = time + 973 1000 * 5;
977 (XPC_DEACTIVATE_PRINTMSG_INTERVAL *
978 sn_rtc_cycles_per_second);
979 } 974 }
975
976 udelay(200);
980 } 977 }
981} 978}
982 979
@@ -991,6 +988,7 @@ xpc_die_deactivate(void)
991static int 988static int
992xpc_system_die(struct notifier_block *nb, unsigned long event, void *unused) 989xpc_system_die(struct notifier_block *nb, unsigned long event, void *unused)
993{ 990{
991#ifdef CONFIG_IA64 /* !!! temporary kludge */
994 switch (event) { 992 switch (event) {
995 case DIE_MACHINE_RESTART: 993 case DIE_MACHINE_RESTART:
996 case DIE_MACHINE_HALT: 994 case DIE_MACHINE_HALT:
@@ -1019,6 +1017,9 @@ xpc_system_die(struct notifier_block *nb, unsigned long event, void *unused)
1019 xpc_online_heartbeat(); 1017 xpc_online_heartbeat();
1020 break; 1018 break;
1021 } 1019 }
1020#else
1021 xpc_die_deactivate();
1022#endif
1022 1023
1023 return NOTIFY_DONE; 1024 return NOTIFY_DONE;
1024} 1025}