aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/Kconfig2
-rw-r--r--drivers/misc/sgi-xp/Makefile14
-rw-r--r--drivers/misc/sgi-xp/xp.h32
-rw-r--r--drivers/misc/sgi-xp/xp_main.c10
-rw-r--r--drivers/misc/sgi-xp/xp_sn2.c10
-rw-r--r--drivers/misc/sgi-xp/xpc.h34
-rw-r--r--drivers/misc/sgi-xp/xpc_channel.c18
-rw-r--r--drivers/misc/sgi-xp/xpc_main.c49
-rw-r--r--drivers/misc/sgi-xp/xpc_partition.c47
-rw-r--r--drivers/misc/sgi-xp/xpc_sn2.c30
-rw-r--r--drivers/misc/sgi-xp/xpc_uv.c7
-rw-r--r--drivers/misc/sgi-xp/xpnet.c28
12 files changed, 155 insertions, 126 deletions
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 4b288f43ca8a..fa50e9ede0e6 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -426,7 +426,7 @@ config ENCLOSURE_SERVICES
426 426
427config SGI_XP 427config SGI_XP
428 tristate "Support communication between SGI SSIs" 428 tristate "Support communication between SGI SSIs"
429 depends on IA64_GENERIC || IA64_SGI_SN2 429 depends on IA64_GENERIC || IA64_SGI_SN2 || IA64_SGI_UV || (X86_64 && SMP)
430 select IA64_UNCACHED_ALLOCATOR if IA64_GENERIC || IA64_SGI_SN2 430 select IA64_UNCACHED_ALLOCATOR if IA64_GENERIC || IA64_SGI_SN2
431 select GENERIC_ALLOCATOR if IA64_GENERIC || IA64_SGI_SN2 431 select GENERIC_ALLOCATOR if IA64_GENERIC || IA64_SGI_SN2
432 ---help--- 432 ---help---
diff --git a/drivers/misc/sgi-xp/Makefile b/drivers/misc/sgi-xp/Makefile
index b3eeff31ebf8..35ce28578075 100644
--- a/drivers/misc/sgi-xp/Makefile
+++ b/drivers/misc/sgi-xp/Makefile
@@ -3,11 +3,17 @@
3# 3#
4 4
5obj-$(CONFIG_SGI_XP) += xp.o 5obj-$(CONFIG_SGI_XP) += xp.o
6xp-y := xp_main.o xp_uv.o 6xp-y := xp_main.o
7xp-$(CONFIG_IA64) += xp_sn2.o xp_nofault.o 7xp-$(CONFIG_IA64_SGI_SN2) += xp_sn2.o xp_nofault.o
8xp-$(CONFIG_IA64_GENERIC) += xp_sn2.o xp_nofault.o xp_uv.o
9xp-$(CONFIG_IA64_SGI_UV) += xp_uv.o
10xp-$(CONFIG_X86_64) += xp_uv.o
8 11
9obj-$(CONFIG_SGI_XP) += xpc.o 12obj-$(CONFIG_SGI_XP) += xpc.o
10xpc-y := xpc_main.o xpc_uv.o xpc_channel.o xpc_partition.o 13xpc-y := xpc_main.o xpc_channel.o xpc_partition.o
11xpc-$(CONFIG_IA64) += xpc_sn2.o 14xpc-$(CONFIG_IA64_SGI_SN2) += xpc_sn2.o
15xpc-$(CONFIG_IA64_GENERIC) += xpc_sn2.o xpc_uv.o
16xpc-$(CONFIG_IA64_SGI_UV) += xpc_uv.o
17xpc-$(CONFIG_X86_64) += xpc_uv.o
12 18
13obj-$(CONFIG_SGI_XP) += xpnet.o 19obj-$(CONFIG_SGI_XP) += xpnet.o
diff --git a/drivers/misc/sgi-xp/xp.h b/drivers/misc/sgi-xp/xp.h
index 3054fae8b023..01bf1a2cd8ed 100644
--- a/drivers/misc/sgi-xp/xp.h
+++ b/drivers/misc/sgi-xp/xp.h
@@ -13,18 +13,17 @@
13#ifndef _DRIVERS_MISC_SGIXP_XP_H 13#ifndef _DRIVERS_MISC_SGIXP_XP_H
14#define _DRIVERS_MISC_SGIXP_XP_H 14#define _DRIVERS_MISC_SGIXP_XP_H
15 15
16#include <linux/cache.h>
17#include <linux/hardirq.h>
18#include <linux/mutex.h> 16#include <linux/mutex.h>
19#include <asm/sn/types.h> 17
20#ifdef CONFIG_IA64 18#ifdef CONFIG_IA64
21#include <asm/sn/arch.h> 19#include <asm/system.h>
20#include <asm/sn/arch.h> /* defines is_shub1() and is_shub2() */
21#define is_shub() ia64_platform_is("sn2")
22#define is_uv() ia64_platform_is("uv")
22#endif 23#endif
23 24#ifdef CONFIG_X86_64
24#ifdef USE_DBUG_ON 25#include <asm/genapic.h>
25#define DBUG_ON(condition) BUG_ON(condition) 26#define is_uv() is_uv_system()
26#else
27#define DBUG_ON(condition)
28#endif 27#endif
29 28
30#ifndef is_shub1 29#ifndef is_shub1
@@ -36,13 +35,19 @@
36#endif 35#endif
37 36
38#ifndef is_shub 37#ifndef is_shub
39#define is_shub() (is_shub1() || is_shub2()) 38#define is_shub() 0
40#endif 39#endif
41 40
42#ifndef is_uv 41#ifndef is_uv
43#define is_uv() 0 42#define is_uv() 0
44#endif 43#endif
45 44
45#ifdef USE_DBUG_ON
46#define DBUG_ON(condition) BUG_ON(condition)
47#else
48#define DBUG_ON(condition)
49#endif
50
46/* 51/*
47 * Define the maximum number of partitions the system can possibly support. 52 * Define the maximum number of partitions the system can possibly support.
48 * It is based on the maximum number of hardware partitionable regions. The 53 * It is based on the maximum number of hardware partitionable regions. The
@@ -200,7 +205,9 @@ enum xp_retval {
200 xpPayloadTooBig, /* 55: payload too large for message slot */ 205 xpPayloadTooBig, /* 55: payload too large for message slot */
201 206
202 xpUnsupported, /* 56: unsupported functionality or resource */ 207 xpUnsupported, /* 56: unsupported functionality or resource */
203 xpUnknownReason /* 57: unknown reason - must be last in enum */ 208 xpNeedMoreInfo, /* 57: more info is needed by SAL */
209
210 xpUnknownReason /* 58: unknown reason - must be last in enum */
204}; 211};
205 212
206/* 213/*
@@ -339,8 +346,11 @@ xpc_partid_to_nasids(short partid, void *nasids)
339} 346}
340 347
341extern short xp_max_npartitions; 348extern short xp_max_npartitions;
349extern short xp_partition_id;
350extern u8 xp_region_size;
342 351
343extern enum xp_retval (*xp_remote_memcpy) (void *, const void *, size_t); 352extern enum xp_retval (*xp_remote_memcpy) (void *, const void *, size_t);
353extern int (*xp_cpu_to_nasid) (int);
344 354
345extern u64 xp_nofault_PIOR_target; 355extern u64 xp_nofault_PIOR_target;
346extern int xp_nofault_PIOR(void *); 356extern int xp_nofault_PIOR(void *);
diff --git a/drivers/misc/sgi-xp/xp_main.c b/drivers/misc/sgi-xp/xp_main.c
index 9c0ce2f15ff6..c34b23fe498f 100644
--- a/drivers/misc/sgi-xp/xp_main.c
+++ b/drivers/misc/sgi-xp/xp_main.c
@@ -14,7 +14,6 @@
14 * 14 *
15 */ 15 */
16 16
17#include <linux/kernel.h>
18#include <linux/module.h> 17#include <linux/module.h>
19#include <linux/device.h> 18#include <linux/device.h>
20#include "xp.h" 19#include "xp.h"
@@ -36,9 +35,18 @@ struct device *xp = &xp_dbg_subname;
36short xp_max_npartitions; 35short xp_max_npartitions;
37EXPORT_SYMBOL_GPL(xp_max_npartitions); 36EXPORT_SYMBOL_GPL(xp_max_npartitions);
38 37
38short xp_partition_id;
39EXPORT_SYMBOL_GPL(xp_partition_id);
40
41u8 xp_region_size;
42EXPORT_SYMBOL_GPL(xp_region_size);
43
39enum xp_retval (*xp_remote_memcpy) (void *dst, const void *src, size_t len); 44enum xp_retval (*xp_remote_memcpy) (void *dst, const void *src, size_t len);
40EXPORT_SYMBOL_GPL(xp_remote_memcpy); 45EXPORT_SYMBOL_GPL(xp_remote_memcpy);
41 46
47int (*xp_cpu_to_nasid) (int cpuid);
48EXPORT_SYMBOL_GPL(xp_cpu_to_nasid);
49
42/* 50/*
43 * xpc_registrations[] keeps track of xpc_connect()'s done by the kernel-level 51 * xpc_registrations[] keeps track of xpc_connect()'s done by the kernel-level
44 * users of XPC. 52 * users of XPC.
diff --git a/drivers/misc/sgi-xp/xp_sn2.c b/drivers/misc/sgi-xp/xp_sn2.c
index baabc1cb3fee..c6a1ede7d6e6 100644
--- a/drivers/misc/sgi-xp/xp_sn2.c
+++ b/drivers/misc/sgi-xp/xp_sn2.c
@@ -12,6 +12,7 @@
12 * Architecture specific implementation of common functions. 12 * Architecture specific implementation of common functions.
13 */ 13 */
14 14
15#include <linux/module.h>
15#include <linux/device.h> 16#include <linux/device.h>
16#include <asm/sn/bte.h> 17#include <asm/sn/bte.h>
17#include <asm/sn/sn_sal.h> 18#include <asm/sn/sn_sal.h>
@@ -116,14 +117,23 @@ xp_remote_memcpy_sn2(void *vdst, const void *psrc, size_t len)
116 return xpBteCopyError; 117 return xpBteCopyError;
117} 118}
118 119
120static int
121xp_cpu_to_nasid_sn2(int cpuid)
122{
123 return cpuid_to_nasid(cpuid);
124}
125
119enum xp_retval 126enum xp_retval
120xp_init_sn2(void) 127xp_init_sn2(void)
121{ 128{
122 BUG_ON(!is_shub()); 129 BUG_ON(!is_shub());
123 130
124 xp_max_npartitions = XP_MAX_NPARTITIONS_SN2; 131 xp_max_npartitions = XP_MAX_NPARTITIONS_SN2;
132 xp_partition_id = sn_partition_id;
133 xp_region_size = sn_region_size;
125 134
126 xp_remote_memcpy = xp_remote_memcpy_sn2; 135 xp_remote_memcpy = xp_remote_memcpy_sn2;
136 xp_cpu_to_nasid = xp_cpu_to_nasid_sn2;
127 137
128 return xp_register_nofault_code_sn2(); 138 return xp_register_nofault_code_sn2();
129} 139}
diff --git a/drivers/misc/sgi-xp/xpc.h b/drivers/misc/sgi-xp/xpc.h
index e194d3140f68..96408fcf5a1e 100644
--- a/drivers/misc/sgi-xp/xpc.h
+++ b/drivers/misc/sgi-xp/xpc.h
@@ -13,17 +13,10 @@
13#ifndef _DRIVERS_MISC_SGIXP_XPC_H 13#ifndef _DRIVERS_MISC_SGIXP_XPC_H
14#define _DRIVERS_MISC_SGIXP_XPC_H 14#define _DRIVERS_MISC_SGIXP_XPC_H
15 15
16#include <linux/interrupt.h> 16#include <linux/wait.h>
17#include <linux/sysctl.h>
18#include <linux/device.h>
19#include <linux/mutex.h>
20#include <linux/completion.h> 17#include <linux/completion.h>
21#include <asm/pgtable.h> 18#include <linux/timer.h>
22#include <asm/processor.h> 19#include <linux/sched.h>
23#include <asm/sn/clksupport.h>
24#include <asm/sn/addrs.h>
25#include <asm/sn/mspec.h>
26#include <asm/sn/shub_mmr.h>
27#include "xp.h" 20#include "xp.h"
28 21
29/* 22/*
@@ -179,7 +172,8 @@ struct xpc_vars_part_sn2 {
179#define XPC_RP_HEADER_SIZE L1_CACHE_ALIGN(sizeof(struct xpc_rsvd_page)) 172#define XPC_RP_HEADER_SIZE L1_CACHE_ALIGN(sizeof(struct xpc_rsvd_page))
180#define XPC_RP_VARS_SIZE L1_CACHE_ALIGN(sizeof(struct xpc_vars_sn2)) 173#define XPC_RP_VARS_SIZE L1_CACHE_ALIGN(sizeof(struct xpc_vars_sn2))
181 174
182#define XPC_RP_PART_NASIDS(_rp) ((u64 *)((u8 *)(_rp) + XPC_RP_HEADER_SIZE)) 175#define XPC_RP_PART_NASIDS(_rp) ((unsigned long *)((u8 *)(_rp) + \
176 XPC_RP_HEADER_SIZE))
183#define XPC_RP_MACH_NASIDS(_rp) (XPC_RP_PART_NASIDS(_rp) + \ 177#define XPC_RP_MACH_NASIDS(_rp) (XPC_RP_PART_NASIDS(_rp) + \
184 xpc_nasid_mask_nlongs) 178 xpc_nasid_mask_nlongs)
185#define XPC_RP_VARS(_rp) ((struct xpc_vars_sn2 *) \ 179#define XPC_RP_VARS(_rp) ((struct xpc_vars_sn2 *) \
@@ -202,13 +196,13 @@ struct xpc_vars_part_sn2 {
202/* 196/*
203 * Define a Get/Put value pair (pointers) used with a message queue. 197 * Define a Get/Put value pair (pointers) used with a message queue.
204 */ 198 */
205struct xpc_gp { 199struct xpc_gp_sn2 {
206 s64 get; /* Get value */ 200 s64 get; /* Get value */
207 s64 put; /* Put value */ 201 s64 put; /* Put value */
208}; 202};
209 203
210#define XPC_GP_SIZE \ 204#define XPC_GP_SIZE \
211 L1_CACHE_ALIGN(sizeof(struct xpc_gp) * XPC_MAX_NCHANNELS) 205 L1_CACHE_ALIGN(sizeof(struct xpc_gp_sn2) * XPC_MAX_NCHANNELS)
212 206
213/* 207/*
214 * Define a structure that contains arguments associated with opening and 208 * Define a structure that contains arguments associated with opening and
@@ -340,10 +334,10 @@ struct xpc_channel_sn2 {
340 334
341 /* various flavors of local and remote Get/Put values */ 335 /* various flavors of local and remote Get/Put values */
342 336
343 struct xpc_gp *local_GP; /* local Get/Put values */ 337 struct xpc_gp_sn2 *local_GP; /* local Get/Put values */
344 struct xpc_gp remote_GP; /* remote Get/Put values */ 338 struct xpc_gp_sn2 remote_GP; /* remote Get/Put values */
345 struct xpc_gp w_local_GP; /* working local Get/Put values */ 339 struct xpc_gp_sn2 w_local_GP; /* working local Get/Put values */
346 struct xpc_gp w_remote_GP; /* working remote Get/Put values */ 340 struct xpc_gp_sn2 w_remote_GP; /* working remote Get/Put values */
347 s64 next_msg_to_pull; /* Put value of next msg to pull */ 341 s64 next_msg_to_pull; /* Put value of next msg to pull */
348 342
349 struct mutex msg_to_pull_mutex; /* next msg to pull serialization */ 343 struct mutex msg_to_pull_mutex; /* next msg to pull serialization */
@@ -506,9 +500,9 @@ struct xpc_partition_sn2 {
506 u8 remote_vars_version; /* version# of partition's vars */ 500 u8 remote_vars_version; /* version# of partition's vars */
507 501
508 void *local_GPs_base; /* base address of kmalloc'd space */ 502 void *local_GPs_base; /* base address of kmalloc'd space */
509 struct xpc_gp *local_GPs; /* local Get/Put values */ 503 struct xpc_gp_sn2 *local_GPs; /* local Get/Put values */
510 void *remote_GPs_base; /* base address of kmalloc'd space */ 504 void *remote_GPs_base; /* base address of kmalloc'd space */
511 struct xpc_gp *remote_GPs; /* copy of remote partition's local */ 505 struct xpc_gp_sn2 *remote_GPs; /* copy of remote partition's local */
512 /* Get/Put values */ 506 /* Get/Put values */
513 u64 remote_GPs_pa; /* phys address of remote partition's local */ 507 u64 remote_GPs_pa; /* phys address of remote partition's local */
514 /* Get/Put values */ 508 /* Get/Put values */
@@ -629,6 +623,8 @@ extern void xpc_activate_partition(struct xpc_partition *);
629extern void xpc_activate_kthreads(struct xpc_channel *, int); 623extern void xpc_activate_kthreads(struct xpc_channel *, int);
630extern void xpc_create_kthreads(struct xpc_channel *, int, int); 624extern void xpc_create_kthreads(struct xpc_channel *, int, int);
631extern void xpc_disconnect_wait(int); 625extern void xpc_disconnect_wait(int);
626extern enum xp_retval (*xpc_get_partition_rsvd_page_pa) (u64, u64 *, u64 *,
627 size_t *);
632extern enum xp_retval (*xpc_rsvd_page_init) (struct xpc_rsvd_page *); 628extern enum xp_retval (*xpc_rsvd_page_init) (struct xpc_rsvd_page *);
633extern void (*xpc_heartbeat_init) (void); 629extern void (*xpc_heartbeat_init) (void);
634extern void (*xpc_heartbeat_exit) (void); 630extern void (*xpc_heartbeat_exit) (void);
diff --git a/drivers/misc/sgi-xp/xpc_channel.c b/drivers/misc/sgi-xp/xpc_channel.c
index f1afc0a7c33f..0615efbe0070 100644
--- a/drivers/misc/sgi-xp/xpc_channel.c
+++ b/drivers/misc/sgi-xp/xpc_channel.c
@@ -14,14 +14,7 @@
14 * 14 *
15 */ 15 */
16 16
17#include <linux/kernel.h> 17#include <linux/device.h>
18#include <linux/init.h>
19#include <linux/sched.h>
20#include <linux/cache.h>
21#include <linux/interrupt.h>
22#include <linux/mutex.h>
23#include <linux/completion.h>
24#include <asm/sn/sn_sal.h>
25#include "xpc.h" 18#include "xpc.h"
26 19
27/* 20/*
@@ -373,8 +366,9 @@ again:
373 dev_dbg(xpc_chan, "XPC_CHCTL_OPENREPLY (local_msgqueue_pa=" 366 dev_dbg(xpc_chan, "XPC_CHCTL_OPENREPLY (local_msgqueue_pa="
374 "0x%lx, local_nentries=%d, remote_nentries=%d) " 367 "0x%lx, local_nentries=%d, remote_nentries=%d) "
375 "received from partid=%d, channel=%d\n", 368 "received from partid=%d, channel=%d\n",
376 args->local_msgqueue_pa, args->local_nentries, 369 (unsigned long)args->local_msgqueue_pa,
377 args->remote_nentries, ch->partid, ch->number); 370 args->local_nentries, args->remote_nentries,
371 ch->partid, ch->number);
378 372
379 if (ch->flags & (XPC_C_DISCONNECTING | XPC_C_DISCONNECTED)) { 373 if (ch->flags & (XPC_C_DISCONNECTING | XPC_C_DISCONNECTED)) {
380 spin_unlock_irqrestore(&ch->lock, irq_flags); 374 spin_unlock_irqrestore(&ch->lock, irq_flags);
@@ -940,7 +934,7 @@ xpc_deliver_msg(struct xpc_channel *ch)
940 if (ch->func != NULL) { 934 if (ch->func != NULL) {
941 dev_dbg(xpc_chan, "ch->func() called, msg=0x%p, " 935 dev_dbg(xpc_chan, "ch->func() called, msg=0x%p, "
942 "msg_number=%ld, partid=%d, channel=%d\n", 936 "msg_number=%ld, partid=%d, channel=%d\n",
943 (void *)msg, msg->number, ch->partid, 937 msg, (signed long)msg->number, ch->partid,
944 ch->number); 938 ch->number);
945 939
946 /* deliver the message to its intended recipient */ 940 /* deliver the message to its intended recipient */
@@ -949,7 +943,7 @@ xpc_deliver_msg(struct xpc_channel *ch)
949 943
950 dev_dbg(xpc_chan, "ch->func() returned, msg=0x%p, " 944 dev_dbg(xpc_chan, "ch->func() returned, msg=0x%p, "
951 "msg_number=%ld, partid=%d, channel=%d\n", 945 "msg_number=%ld, partid=%d, channel=%d\n",
952 (void *)msg, msg->number, ch->partid, 946 msg, (signed long)msg->number, ch->partid,
953 ch->number); 947 ch->number);
954 } 948 }
955 949
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}
diff --git a/drivers/misc/sgi-xp/xpc_partition.c b/drivers/misc/sgi-xp/xpc_partition.c
index 70d4a00c9723..f84d66410205 100644
--- a/drivers/misc/sgi-xp/xpc_partition.c
+++ b/drivers/misc/sgi-xp/xpc_partition.c
@@ -15,15 +15,8 @@
15 * 15 *
16 */ 16 */
17 17
18#include <linux/kernel.h> 18#include <linux/device.h>
19#include <linux/sysctl.h> 19#include <linux/hardirq.h>
20#include <linux/cache.h>
21#include <linux/mmzone.h>
22#include <linux/nodemask.h>
23#include <asm/sn/intr.h>
24#include <asm/sn/sn_sal.h>
25#include <asm/sn/nodepda.h>
26#include <asm/sn/addrs.h>
27#include "xpc.h" 20#include "xpc.h"
28 21
29/* XPC is exiting flag */ 22/* XPC is exiting flag */
@@ -71,24 +64,23 @@ static u64
71xpc_get_rsvd_page_pa(int nasid) 64xpc_get_rsvd_page_pa(int nasid)
72{ 65{
73 enum xp_retval ret; 66 enum xp_retval ret;
74 s64 status;
75 u64 cookie = 0; 67 u64 cookie = 0;
76 u64 rp_pa = nasid; /* seed with nasid */ 68 u64 rp_pa = nasid; /* seed with nasid */
77 u64 len = 0; 69 size_t len = 0;
78 u64 buf = buf; 70 u64 buf = buf;
79 u64 buf_len = 0; 71 u64 buf_len = 0;
80 void *buf_base = NULL; 72 void *buf_base = NULL;
81 73
82 while (1) { 74 while (1) {
83 75
84 status = sn_partition_reserved_page_pa(buf, &cookie, &rp_pa, 76 ret = xpc_get_partition_rsvd_page_pa(buf, &cookie, &rp_pa,
85 &len); 77 &len);
86 78
87 dev_dbg(xpc_part, "SAL returned with status=%li, cookie=" 79 dev_dbg(xpc_part, "SAL returned with ret=%d, cookie=0x%016lx, "
88 "0x%016lx, address=0x%016lx, len=0x%016lx\n", 80 "address=0x%016lx, len=0x%016lx\n", ret,
89 status, cookie, rp_pa, len); 81 (unsigned long)cookie, (unsigned long)rp_pa, len);
90 82
91 if (status != SALRET_MORE_PASSES) 83 if (ret != xpNeedMoreInfo)
92 break; 84 break;
93 85
94 /* !!! L1_CACHE_ALIGN() is only a sn2-bte_copy requirement */ 86 /* !!! L1_CACHE_ALIGN() is only a sn2-bte_copy requirement */
@@ -100,8 +92,9 @@ xpc_get_rsvd_page_pa(int nasid)
100 &buf_base); 92 &buf_base);
101 if (buf_base == NULL) { 93 if (buf_base == NULL) {
102 dev_err(xpc_part, "unable to kmalloc " 94 dev_err(xpc_part, "unable to kmalloc "
103 "len=0x%016lx\n", buf_len); 95 "len=0x%016lx\n",
104 status = SALRET_ERROR; 96 (unsigned long)buf_len);
97 ret = xpNoMemory;
105 break; 98 break;
106 } 99 }
107 } 100 }
@@ -109,17 +102,17 @@ xpc_get_rsvd_page_pa(int nasid)
109 ret = xp_remote_memcpy((void *)buf, (void *)rp_pa, buf_len); 102 ret = xp_remote_memcpy((void *)buf, (void *)rp_pa, buf_len);
110 if (ret != xpSuccess) { 103 if (ret != xpSuccess) {
111 dev_dbg(xpc_part, "xp_remote_memcpy failed %d\n", ret); 104 dev_dbg(xpc_part, "xp_remote_memcpy failed %d\n", ret);
112 status = SALRET_ERROR;
113 break; 105 break;
114 } 106 }
115 } 107 }
116 108
117 kfree(buf_base); 109 kfree(buf_base);
118 110
119 if (status != SALRET_OK) 111 if (ret != xpSuccess)
120 rp_pa = 0; 112 rp_pa = 0;
121 113
122 dev_dbg(xpc_part, "reserved page at phys address 0x%016lx\n", rp_pa); 114 dev_dbg(xpc_part, "reserved page at phys address 0x%016lx\n",
115 (unsigned long)rp_pa);
123 return rp_pa; 116 return rp_pa;
124} 117}
125 118
@@ -138,7 +131,7 @@ xpc_setup_rsvd_page(void)
138 /* get the local reserved page's address */ 131 /* get the local reserved page's address */
139 132
140 preempt_disable(); 133 preempt_disable();
141 rp_pa = xpc_get_rsvd_page_pa(cpuid_to_nasid(smp_processor_id())); 134 rp_pa = xpc_get_rsvd_page_pa(xp_cpu_to_nasid(smp_processor_id()));
142 preempt_enable(); 135 preempt_enable();
143 if (rp_pa == 0) { 136 if (rp_pa == 0) {
144 dev_err(xpc_part, "SAL failed to locate the reserved page\n"); 137 dev_err(xpc_part, "SAL failed to locate the reserved page\n");
@@ -150,7 +143,7 @@ xpc_setup_rsvd_page(void)
150 /* SAL_versions < 3 had a SAL_partid defined as a u8 */ 143 /* SAL_versions < 3 had a SAL_partid defined as a u8 */
151 rp->SAL_partid &= 0xff; 144 rp->SAL_partid &= 0xff;
152 } 145 }
153 BUG_ON(rp->SAL_partid != sn_partition_id); 146 BUG_ON(rp->SAL_partid != xp_partition_id);
154 147
155 if (rp->SAL_partid < 0 || rp->SAL_partid >= xp_max_npartitions) { 148 if (rp->SAL_partid < 0 || rp->SAL_partid >= xp_max_npartitions) {
156 dev_err(xpc_part, "the reserved page's partid of %d is outside " 149 dev_err(xpc_part, "the reserved page's partid of %d is outside "
@@ -237,11 +230,11 @@ xpc_get_remote_rp(int nasid, unsigned long *discovered_nasids,
237 /* check that both remote and local partids are valid for each side */ 230 /* check that both remote and local partids are valid for each side */
238 if (remote_rp->SAL_partid < 0 || 231 if (remote_rp->SAL_partid < 0 ||
239 remote_rp->SAL_partid >= xp_max_npartitions || 232 remote_rp->SAL_partid >= xp_max_npartitions ||
240 remote_rp->max_npartitions <= sn_partition_id) { 233 remote_rp->max_npartitions <= xp_partition_id) {
241 return xpInvalidPartid; 234 return xpInvalidPartid;
242 } 235 }
243 236
244 if (remote_rp->SAL_partid == sn_partition_id) 237 if (remote_rp->SAL_partid == xp_partition_id)
245 return xpLocalPartid; 238 return xpLocalPartid;
246 239
247 return xpSuccess; 240 return xpSuccess;
@@ -426,7 +419,7 @@ xpc_discovery(void)
426 * protection is in regards to memory, IOI and IPI. 419 * protection is in regards to memory, IOI and IPI.
427 */ 420 */
428 max_regions = 64; 421 max_regions = 64;
429 region_size = sn_region_size; 422 region_size = xp_region_size;
430 423
431 switch (region_size) { 424 switch (region_size) {
432 case 128: 425 case 128:
diff --git a/drivers/misc/sgi-xp/xpc_sn2.c b/drivers/misc/sgi-xp/xpc_sn2.c
index 4b5f69edf0d2..fde870aebcb9 100644
--- a/drivers/misc/sgi-xp/xpc_sn2.c
+++ b/drivers/misc/sgi-xp/xpc_sn2.c
@@ -13,9 +13,9 @@
13 * 13 *
14 */ 14 */
15 15
16#include <linux/kernel.h>
17#include <linux/delay.h> 16#include <linux/delay.h>
18#include <asm/uncached.h> 17#include <asm/uncached.h>
18#include <asm/sn/mspec.h>
19#include <asm/sn/sn_sal.h> 19#include <asm/sn/sn_sal.h>
20#include "xpc.h" 20#include "xpc.h"
21 21
@@ -176,7 +176,7 @@ xpc_send_IRQ_sn2(struct amo *amo, u64 flag, int nasid, int phys_cpuid,
176 176
177 local_irq_restore(irq_flags); 177 local_irq_restore(irq_flags);
178 178
179 return ((ret == 0) ? xpSuccess : xpPioReadError); 179 return (ret == 0) ? xpSuccess : xpPioReadError;
180} 180}
181 181
182static struct amo * 182static struct amo *
@@ -284,7 +284,7 @@ xpc_handle_notify_IRQ_sn2(int irq, void *dev_id)
284 short partid = (short)(u64)dev_id; 284 short partid = (short)(u64)dev_id;
285 struct xpc_partition *part = &xpc_partitions[partid]; 285 struct xpc_partition *part = &xpc_partitions[partid];
286 286
287 DBUG_ON(partid < 0 || partid >= xp_max_npartitions); 287 DBUG_ON(partid < 0 || partid >= XP_MAX_NPARTITIONS_SN2);
288 288
289 if (xpc_part_ref(part)) { 289 if (xpc_part_ref(part)) {
290 xpc_check_for_sent_chctl_flags_sn2(part); 290 xpc_check_for_sent_chctl_flags_sn2(part);
@@ -577,6 +577,25 @@ xpc_allow_amo_ops_shub_wars_1_1_sn2(void)
577} 577}
578 578
579static enum xp_retval 579static enum xp_retval
580xpc_get_partition_rsvd_page_pa_sn2(u64 buf, u64 *cookie, u64 *paddr,
581 size_t *len)
582{
583 s64 status;
584 enum xp_retval ret;
585
586 status = sn_partition_reserved_page_pa(buf, cookie, paddr, len);
587 if (status == SALRET_OK)
588 ret = xpSuccess;
589 else if (status == SALRET_MORE_PASSES)
590 ret = xpNeedMoreInfo;
591 else
592 ret = xpSalError;
593
594 return ret;
595}
596
597
598static enum xp_retval
580xpc_rsvd_page_init_sn2(struct xpc_rsvd_page *rp) 599xpc_rsvd_page_init_sn2(struct xpc_rsvd_page *rp)
581{ 600{
582 struct amo *amos_page; 601 struct amo *amos_page;
@@ -636,7 +655,7 @@ xpc_rsvd_page_init_sn2(struct xpc_rsvd_page *rp)
636 655
637 /* clear xpc_vars_part_sn2 */ 656 /* clear xpc_vars_part_sn2 */
638 memset((u64 *)xpc_vars_part_sn2, 0, sizeof(struct xpc_vars_part_sn2) * 657 memset((u64 *)xpc_vars_part_sn2, 0, sizeof(struct xpc_vars_part_sn2) *
639 xp_max_npartitions); 658 XP_MAX_NPARTITIONS_SN2);
640 659
641 /* initialize the activate IRQ related amo variables */ 660 /* initialize the activate IRQ related amo variables */
642 for (i = 0; i < xpc_nasid_mask_nlongs; i++) 661 for (i = 0; i < xpc_nasid_mask_nlongs; i++)
@@ -699,7 +718,7 @@ xpc_check_remote_hb_sn2(void)
699 718
700 remote_vars = (struct xpc_vars_sn2 *)xpc_remote_copy_buffer_sn2; 719 remote_vars = (struct xpc_vars_sn2 *)xpc_remote_copy_buffer_sn2;
701 720
702 for (partid = 0; partid < xp_max_npartitions; partid++) { 721 for (partid = 0; partid < XP_MAX_NPARTITIONS_SN2; partid++) {
703 722
704 if (xpc_exiting) 723 if (xpc_exiting)
705 break; 724 break;
@@ -2386,6 +2405,7 @@ xpc_init_sn2(void)
2386 int ret; 2405 int ret;
2387 size_t buf_size; 2406 size_t buf_size;
2388 2407
2408 xpc_get_partition_rsvd_page_pa = xpc_get_partition_rsvd_page_pa_sn2;
2389 xpc_rsvd_page_init = xpc_rsvd_page_init_sn2; 2409 xpc_rsvd_page_init = xpc_rsvd_page_init_sn2;
2390 xpc_increment_heartbeat = xpc_increment_heartbeat_sn2; 2410 xpc_increment_heartbeat = xpc_increment_heartbeat_sn2;
2391 xpc_offline_heartbeat = xpc_offline_heartbeat_sn2; 2411 xpc_offline_heartbeat = xpc_offline_heartbeat_sn2;
diff --git a/drivers/misc/sgi-xp/xpc_uv.c b/drivers/misc/sgi-xp/xpc_uv.c
index 2aec1dfbb3db..232867aa6929 100644
--- a/drivers/misc/sgi-xp/xpc_uv.c
+++ b/drivers/misc/sgi-xp/xpc_uv.c
@@ -14,11 +14,8 @@
14 */ 14 */
15 15
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17 17#include <asm/uv/uv_hub.h>
18/* !!! #include <gru/grukservices.h> */ 18#include "../sgi-gru/grukservices.h"
19/* !!! uv_gpa() is defined in <gru/grukservices.h> */
20#define uv_gpa(_a) ((unsigned long)_a)
21
22#include "xpc.h" 19#include "xpc.h"
23 20
24static DECLARE_BITMAP(xpc_heartbeating_to_mask_uv, XP_MAX_NPARTITIONS_UV); 21static DECLARE_BITMAP(xpc_heartbeating_to_mask_uv, XP_MAX_NPARTITIONS_UV);
diff --git a/drivers/misc/sgi-xp/xpnet.c b/drivers/misc/sgi-xp/xpnet.c
index 07c89c4e2c25..49385f441705 100644
--- a/drivers/misc/sgi-xp/xpnet.c
+++ b/drivers/misc/sgi-xp/xpnet.c
@@ -21,17 +21,8 @@
21 */ 21 */
22 22
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/kernel.h>
25#include <linux/init.h>
26#include <linux/ioport.h>
27#include <linux/netdevice.h> 24#include <linux/netdevice.h>
28#include <linux/etherdevice.h> 25#include <linux/etherdevice.h>
29#include <linux/delay.h>
30#include <linux/ethtool.h>
31#include <linux/mii.h>
32#include <linux/smp.h>
33#include <linux/string.h>
34#include <asm/atomic.h>
35#include "xp.h" 26#include "xp.h"
36 27
37/* 28/*
@@ -175,8 +166,9 @@ xpnet_receive(short partid, int channel, struct xpnet_message *msg)
175 166
176 return; 167 return;
177 } 168 }
178 dev_dbg(xpnet, "received 0x%lx, %d, %d, %d\n", msg->buf_pa, msg->size, 169 dev_dbg(xpnet, "received 0x%lx, %d, %d, %d\n",
179 msg->leadin_ignore, msg->tailout_ignore); 170 (unsigned long)msg->buf_pa, msg->size, msg->leadin_ignore,
171 msg->tailout_ignore);
180 172
181 /* reserve an extra cache line */ 173 /* reserve an extra cache line */
182 skb = dev_alloc_skb(msg->size + L1_CACHE_BYTES); 174 skb = dev_alloc_skb(msg->size + L1_CACHE_BYTES);
@@ -320,8 +312,10 @@ xpnet_dev_open(struct net_device *dev)
320 312
321 dev_dbg(xpnet, "calling xpc_connect(%d, 0x%p, NULL, %ld, %ld, %ld, " 313 dev_dbg(xpnet, "calling xpc_connect(%d, 0x%p, NULL, %ld, %ld, %ld, "
322 "%ld)\n", XPC_NET_CHANNEL, xpnet_connection_activity, 314 "%ld)\n", XPC_NET_CHANNEL, xpnet_connection_activity,
323 XPNET_MSG_SIZE, XPNET_MSG_NENTRIES, XPNET_MAX_KTHREADS, 315 (unsigned long)XPNET_MSG_SIZE,
324 XPNET_MAX_IDLE_KTHREADS); 316 (unsigned long)XPNET_MSG_NENTRIES,
317 (unsigned long)XPNET_MAX_KTHREADS,
318 (unsigned long)XPNET_MAX_IDLE_KTHREADS);
325 319
326 ret = xpc_connect(XPC_NET_CHANNEL, xpnet_connection_activity, NULL, 320 ret = xpc_connect(XPC_NET_CHANNEL, xpnet_connection_activity, NULL,
327 XPNET_MSG_SIZE, XPNET_MSG_NENTRIES, 321 XPNET_MSG_SIZE, XPNET_MSG_NENTRIES,
@@ -439,8 +433,8 @@ xpnet_send(struct sk_buff *skb, struct xpnet_pending_msg *queued_msg,
439 dev_dbg(xpnet, "sending XPC message to %d:%d\n" 433 dev_dbg(xpnet, "sending XPC message to %d:%d\n"
440 KERN_DEBUG "msg->buf_pa=0x%lx, msg->size=%u, " 434 KERN_DEBUG "msg->buf_pa=0x%lx, msg->size=%u, "
441 "msg->leadin_ignore=%u, msg->tailout_ignore=%u\n", 435 "msg->leadin_ignore=%u, msg->tailout_ignore=%u\n",
442 dest_partid, XPC_NET_CHANNEL, msg->buf_pa, msg->size, 436 dest_partid, XPC_NET_CHANNEL, (unsigned long)msg->buf_pa,
443 msg->leadin_ignore, msg->tailout_ignore); 437 msg->size, msg->leadin_ignore, msg->tailout_ignore);
444 438
445 atomic_inc(&queued_msg->use_count); 439 atomic_inc(&queued_msg->use_count);
446 440
@@ -602,8 +596,8 @@ xpnet_init(void)
602 */ 596 */
603 xpnet_device->dev_addr[0] = 0x02; /* locally administered, no OUI */ 597 xpnet_device->dev_addr[0] = 0x02; /* locally administered, no OUI */
604 598
605 xpnet_device->dev_addr[XPNET_PARTID_OCTET + 1] = sn_partition_id; 599 xpnet_device->dev_addr[XPNET_PARTID_OCTET + 1] = xp_partition_id;
606 xpnet_device->dev_addr[XPNET_PARTID_OCTET + 0] = (sn_partition_id >> 8); 600 xpnet_device->dev_addr[XPNET_PARTID_OCTET + 0] = (xp_partition_id >> 8);
607 601
608 /* 602 /*
609 * ether_setup() sets this to a multicast device. We are 603 * ether_setup() sets this to a multicast device. We are