aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/sgi-xp/xpc_partition.c
diff options
context:
space:
mode:
authorDean Nelson <dcn@sgi.com>2008-07-30 01:34:14 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-30 12:41:50 -0400
commit04de741885bc7565a28150e82c56a56e544440e6 (patch)
tree7c955e1d9dbe4c7d319818f48e22ef85113b2c2f /drivers/misc/sgi-xp/xpc_partition.c
parentea57f80c8c0e59cfc5095f7e856ce7c8e6ac2984 (diff)
sgi-xp: use standard bitops macros and functions
Change sgi-xp to use the standard bitops macros and functions instead of trying to invent its own mechanism. Signed-off-by: Dean Nelson <dcn@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.c43
1 files changed, 22 insertions, 21 deletions
diff --git a/drivers/misc/sgi-xp/xpc_partition.c b/drivers/misc/sgi-xp/xpc_partition.c
index 73a92957b800..ca6784f55970 100644
--- a/drivers/misc/sgi-xp/xpc_partition.c
+++ b/drivers/misc/sgi-xp/xpc_partition.c
@@ -31,11 +31,11 @@ int xpc_exiting;
31 31
32/* this partition's reserved page pointers */ 32/* this partition's reserved page pointers */
33struct xpc_rsvd_page *xpc_rsvd_page; 33struct xpc_rsvd_page *xpc_rsvd_page;
34static u64 *xpc_part_nasids; 34static unsigned long *xpc_part_nasids;
35u64 *xpc_mach_nasids; 35unsigned long *xpc_mach_nasids;
36 36
37static int xpc_sizeof_nasid_mask; /* actual size in bytes of nasid mask */ 37static int xpc_nasid_mask_nbytes; /* #of bytes in nasid mask */
38int xpc_nasid_mask_words; /* actual size in words of nasid mask */ 38int xpc_nasid_mask_nlongs; /* #of longs in nasid mask */
39 39
40struct xpc_partition *xpc_partitions; 40struct xpc_partition *xpc_partitions;
41 41
@@ -167,9 +167,9 @@ xpc_setup_rsvd_page(void)
167 /* SAL_version 1 didn't set the nasids_size field */ 167 /* SAL_version 1 didn't set the nasids_size field */
168 rp->SAL_nasids_size = 128; 168 rp->SAL_nasids_size = 128;
169 } 169 }
170 xpc_sizeof_nasid_mask = rp->SAL_nasids_size; 170 xpc_nasid_mask_nbytes = rp->SAL_nasids_size;
171 xpc_nasid_mask_words = DIV_ROUND_UP(xpc_sizeof_nasid_mask, 171 xpc_nasid_mask_nlongs = BITS_TO_LONGS(rp->SAL_nasids_size *
172 BYTES_PER_WORD); 172 BITS_PER_BYTE);
173 173
174 /* setup the pointers to the various items in the reserved page */ 174 /* setup the pointers to the various items in the reserved page */
175 xpc_part_nasids = XPC_RP_PART_NASIDS(rp); 175 xpc_part_nasids = XPC_RP_PART_NASIDS(rp);
@@ -199,10 +199,10 @@ xpc_setup_rsvd_page(void)
199 * part_nasids mask. 199 * part_nasids mask.
200 */ 200 */
201enum xp_retval 201enum xp_retval
202xpc_get_remote_rp(int nasid, u64 *discovered_nasids, 202xpc_get_remote_rp(int nasid, unsigned long *discovered_nasids,
203 struct xpc_rsvd_page *remote_rp, u64 *remote_rp_pa) 203 struct xpc_rsvd_page *remote_rp, u64 *remote_rp_pa)
204{ 204{
205 int i; 205 int l;
206 enum xp_retval ret; 206 enum xp_retval ret;
207 207
208 /* get the reserved page's physical address */ 208 /* get the reserved page's physical address */
@@ -213,15 +213,16 @@ xpc_get_remote_rp(int nasid, u64 *discovered_nasids,
213 213
214 /* pull over the reserved page header and part_nasids mask */ 214 /* pull over the reserved page header and part_nasids mask */
215 ret = xp_remote_memcpy(remote_rp, (void *)*remote_rp_pa, 215 ret = xp_remote_memcpy(remote_rp, (void *)*remote_rp_pa,
216 XPC_RP_HEADER_SIZE + xpc_sizeof_nasid_mask); 216 XPC_RP_HEADER_SIZE + xpc_nasid_mask_nbytes);
217 if (ret != xpSuccess) 217 if (ret != xpSuccess)
218 return ret; 218 return ret;
219 219
220 if (discovered_nasids != NULL) { 220 if (discovered_nasids != NULL) {
221 u64 *remote_part_nasids = XPC_RP_PART_NASIDS(remote_rp); 221 unsigned long *remote_part_nasids =
222 XPC_RP_PART_NASIDS(remote_rp);
222 223
223 for (i = 0; i < xpc_nasid_mask_words; i++) 224 for (l = 0; l < xpc_nasid_mask_nlongs; l++)
224 discovered_nasids[i] |= remote_part_nasids[i]; 225 discovered_nasids[l] |= remote_part_nasids[l];
225 } 226 }
226 227
227 /* see if the reserved page has been set up by XPC */ 228 /* see if the reserved page has been set up by XPC */
@@ -401,16 +402,16 @@ xpc_discovery(void)
401 int max_regions; 402 int max_regions;
402 int nasid; 403 int nasid;
403 struct xpc_rsvd_page *rp; 404 struct xpc_rsvd_page *rp;
404 u64 *discovered_nasids; 405 unsigned long *discovered_nasids;
405 enum xp_retval ret; 406 enum xp_retval ret;
406 407
407 remote_rp = xpc_kmalloc_cacheline_aligned(XPC_RP_HEADER_SIZE + 408 remote_rp = xpc_kmalloc_cacheline_aligned(XPC_RP_HEADER_SIZE +
408 xpc_sizeof_nasid_mask, 409 xpc_nasid_mask_nbytes,
409 GFP_KERNEL, &remote_rp_base); 410 GFP_KERNEL, &remote_rp_base);
410 if (remote_rp == NULL) 411 if (remote_rp == NULL)
411 return; 412 return;
412 413
413 discovered_nasids = kzalloc(sizeof(u64) * xpc_nasid_mask_words, 414 discovered_nasids = kzalloc(sizeof(long) * xpc_nasid_mask_nlongs,
414 GFP_KERNEL); 415 GFP_KERNEL);
415 if (discovered_nasids == NULL) { 416 if (discovered_nasids == NULL) {
416 kfree(remote_rp_base); 417 kfree(remote_rp_base);
@@ -453,21 +454,21 @@ xpc_discovery(void)
453 454
454 dev_dbg(xpc_part, "checking nasid %d\n", nasid); 455 dev_dbg(xpc_part, "checking nasid %d\n", nasid);
455 456
456 if (XPC_NASID_IN_ARRAY(nasid, xpc_part_nasids)) { 457 if (test_bit(nasid / 2, xpc_part_nasids)) {
457 dev_dbg(xpc_part, "PROM indicates Nasid %d is " 458 dev_dbg(xpc_part, "PROM indicates Nasid %d is "
458 "part of the local partition; skipping " 459 "part of the local partition; skipping "
459 "region\n", nasid); 460 "region\n", nasid);
460 break; 461 break;
461 } 462 }
462 463
463 if (!(XPC_NASID_IN_ARRAY(nasid, xpc_mach_nasids))) { 464 if (!(test_bit(nasid / 2, xpc_mach_nasids))) {
464 dev_dbg(xpc_part, "PROM indicates Nasid %d was " 465 dev_dbg(xpc_part, "PROM indicates Nasid %d was "
465 "not on Numa-Link network at reset\n", 466 "not on Numa-Link network at reset\n",
466 nasid); 467 nasid);
467 continue; 468 continue;
468 } 469 }
469 470
470 if (XPC_NASID_IN_ARRAY(nasid, discovered_nasids)) { 471 if (test_bit(nasid / 2, discovered_nasids)) {
471 dev_dbg(xpc_part, "Nasid %d is part of a " 472 dev_dbg(xpc_part, "Nasid %d is part of a "
472 "partition which was previously " 473 "partition which was previously "
473 "discovered\n", nasid); 474 "discovered\n", nasid);
@@ -512,10 +513,10 @@ xpc_initiate_partid_to_nasids(short partid, void *nasid_mask)
512 if (part->remote_rp_pa == 0) 513 if (part->remote_rp_pa == 0)
513 return xpPartitionDown; 514 return xpPartitionDown;
514 515
515 memset(nasid_mask, 0, xpc_sizeof_nasid_mask); 516 memset(nasid_mask, 0, xpc_nasid_mask_nbytes);
516 517
517 part_nasid_pa = (u64)XPC_RP_PART_NASIDS(part->remote_rp_pa); 518 part_nasid_pa = (u64)XPC_RP_PART_NASIDS(part->remote_rp_pa);
518 519
519 return xp_remote_memcpy(nasid_mask, (void *)part_nasid_pa, 520 return xp_remote_memcpy(nasid_mask, (void *)part_nasid_pa,
520 xpc_sizeof_nasid_mask); 521 xpc_nasid_mask_nbytes);
521} 522}