diff options
author | Dean Nelson <dcn@sgi.com> | 2008-07-30 01:34:16 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-30 12:41:50 -0400 |
commit | 261f3b4979db88d29fc86aad9f76fbc0c2c6d21a (patch) | |
tree | 1cd1012b3ab52747a12e47f630b864d27af0bdf5 /drivers/misc/sgi-xp/xpc_partition.c | |
parent | 81fe7883d2c8a80a7145ad22f8cd8514d05412b9 (diff) |
sgi-xp: enable building of XPC/XPNET on x86_64
Get XPC/XPNET to build on x86_64. Trying to modprobe them up on a non-UV
or sn2 system will result in a -ENODEV.
Signed-off-by: Dean Nelson <dcn@sgi.com>
Cc: Jack Steiner <steiner@sgi.com>
Cc: "Luck, Tony" <tony.luck@intel.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.c | 47 |
1 files changed, 20 insertions, 27 deletions
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 | |||
71 | xpc_get_rsvd_page_pa(int nasid) | 64 | xpc_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: |