diff options
author | Dean Nelson <dcn@sgi.com> | 2008-07-30 01:34:05 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-30 12:41:49 -0400 |
commit | 908787db9b95f548270af18d83d62b9d2020ca10 (patch) | |
tree | 7fd4837accae2af478af95618357f106d04c265e /drivers/misc/sgi-xp/xpc_partition.c | |
parent | bc63d387e4f5dbbe4ea0c5ade862c38073fd7fa3 (diff) |
sgi-xp: create a common xp_remote_memcpy() function
Create a common remote memcpy function that maps to what the hardware
booted supports.
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.c | 55 |
1 files changed, 24 insertions, 31 deletions
diff --git a/drivers/misc/sgi-xp/xpc_partition.c b/drivers/misc/sgi-xp/xpc_partition.c index 02a858eddd8d..6c82f2050974 100644 --- a/drivers/misc/sgi-xp/xpc_partition.c +++ b/drivers/misc/sgi-xp/xpc_partition.c | |||
@@ -21,7 +21,6 @@ | |||
21 | #include <linux/mmzone.h> | 21 | #include <linux/mmzone.h> |
22 | #include <linux/nodemask.h> | 22 | #include <linux/nodemask.h> |
23 | #include <asm/uncached.h> | 23 | #include <asm/uncached.h> |
24 | #include <asm/sn/bte.h> | ||
25 | #include <asm/sn/intr.h> | 24 | #include <asm/sn/intr.h> |
26 | #include <asm/sn/sn_sal.h> | 25 | #include <asm/sn/sn_sal.h> |
27 | #include <asm/sn/nodepda.h> | 26 | #include <asm/sn/nodepda.h> |
@@ -92,7 +91,7 @@ xpc_kmalloc_cacheline_aligned(size_t size, gfp_t flags, void **base) | |||
92 | static u64 | 91 | static u64 |
93 | xpc_get_rsvd_page_pa(int nasid) | 92 | xpc_get_rsvd_page_pa(int nasid) |
94 | { | 93 | { |
95 | bte_result_t bte_res; | 94 | enum xp_retval ret; |
96 | s64 status; | 95 | s64 status; |
97 | u64 cookie = 0; | 96 | u64 cookie = 0; |
98 | u64 rp_pa = nasid; /* seed with nasid */ | 97 | u64 rp_pa = nasid; /* seed with nasid */ |
@@ -113,6 +112,7 @@ xpc_get_rsvd_page_pa(int nasid) | |||
113 | if (status != SALRET_MORE_PASSES) | 112 | if (status != SALRET_MORE_PASSES) |
114 | break; | 113 | break; |
115 | 114 | ||
115 | /* >>> L1_CACHE_ALIGN() is only a sn2-bte_copy requirement */ | ||
116 | if (L1_CACHE_ALIGN(len) > buf_len) { | 116 | if (L1_CACHE_ALIGN(len) > buf_len) { |
117 | kfree(buf_base); | 117 | kfree(buf_base); |
118 | buf_len = L1_CACHE_ALIGN(len); | 118 | buf_len = L1_CACHE_ALIGN(len); |
@@ -127,10 +127,9 @@ xpc_get_rsvd_page_pa(int nasid) | |||
127 | } | 127 | } |
128 | } | 128 | } |
129 | 129 | ||
130 | bte_res = xp_bte_copy(rp_pa, buf, buf_len, | 130 | ret = xp_remote_memcpy((void *)buf, (void *)rp_pa, buf_len); |
131 | (BTE_NOTIFY | BTE_WACQUIRE), NULL); | 131 | if (ret != xpSuccess) { |
132 | if (bte_res != BTE_SUCCESS) { | 132 | dev_dbg(xpc_part, "xp_remote_memcpy failed %d\n", ret); |
133 | dev_dbg(xpc_part, "xp_bte_copy failed %i\n", bte_res); | ||
134 | status = SALRET_ERROR; | 133 | status = SALRET_ERROR; |
135 | break; | 134 | break; |
136 | } | 135 | } |
@@ -398,7 +397,7 @@ xpc_check_remote_hb(void) | |||
398 | struct xpc_vars *remote_vars; | 397 | struct xpc_vars *remote_vars; |
399 | struct xpc_partition *part; | 398 | struct xpc_partition *part; |
400 | short partid; | 399 | short partid; |
401 | bte_result_t bres; | 400 | enum xp_retval ret; |
402 | 401 | ||
403 | remote_vars = (struct xpc_vars *)xpc_remote_copy_buffer; | 402 | remote_vars = (struct xpc_vars *)xpc_remote_copy_buffer; |
404 | 403 | ||
@@ -418,13 +417,11 @@ xpc_check_remote_hb(void) | |||
418 | } | 417 | } |
419 | 418 | ||
420 | /* pull the remote_hb cache line */ | 419 | /* pull the remote_hb cache line */ |
421 | bres = xp_bte_copy(part->remote_vars_pa, | 420 | ret = xp_remote_memcpy(remote_vars, |
422 | (u64)remote_vars, | 421 | (void *)part->remote_vars_pa, |
423 | XPC_RP_VARS_SIZE, | 422 | XPC_RP_VARS_SIZE); |
424 | (BTE_NOTIFY | BTE_WACQUIRE), NULL); | 423 | if (ret != xpSuccess) { |
425 | if (bres != BTE_SUCCESS) { | 424 | XPC_DEACTIVATE_PARTITION(part, ret); |
426 | XPC_DEACTIVATE_PARTITION(part, | ||
427 | xpc_map_bte_errors(bres)); | ||
428 | continue; | 425 | continue; |
429 | } | 426 | } |
430 | 427 | ||
@@ -457,7 +454,8 @@ static enum xp_retval | |||
457 | xpc_get_remote_rp(int nasid, u64 *discovered_nasids, | 454 | xpc_get_remote_rp(int nasid, u64 *discovered_nasids, |
458 | struct xpc_rsvd_page *remote_rp, u64 *remote_rp_pa) | 455 | struct xpc_rsvd_page *remote_rp, u64 *remote_rp_pa) |
459 | { | 456 | { |
460 | int bres, i; | 457 | int i; |
458 | enum xp_retval ret; | ||
461 | 459 | ||
462 | /* get the reserved page's physical address */ | 460 | /* get the reserved page's physical address */ |
463 | 461 | ||
@@ -466,11 +464,10 @@ xpc_get_remote_rp(int nasid, u64 *discovered_nasids, | |||
466 | return xpNoRsvdPageAddr; | 464 | return xpNoRsvdPageAddr; |
467 | 465 | ||
468 | /* pull over the reserved page header and part_nasids mask */ | 466 | /* pull over the reserved page header and part_nasids mask */ |
469 | bres = xp_bte_copy(*remote_rp_pa, (u64)remote_rp, | 467 | ret = xp_remote_memcpy(remote_rp, (void *)*remote_rp_pa, |
470 | XPC_RP_HEADER_SIZE + xp_nasid_mask_bytes, | 468 | XPC_RP_HEADER_SIZE + xp_nasid_mask_bytes); |
471 | (BTE_NOTIFY | BTE_WACQUIRE), NULL); | 469 | if (ret != xpSuccess) |
472 | if (bres != BTE_SUCCESS) | 470 | return ret; |
473 | return xpc_map_bte_errors(bres); | ||
474 | 471 | ||
475 | if (discovered_nasids != NULL) { | 472 | if (discovered_nasids != NULL) { |
476 | u64 *remote_part_nasids = XPC_RP_PART_NASIDS(remote_rp); | 473 | u64 *remote_part_nasids = XPC_RP_PART_NASIDS(remote_rp); |
@@ -504,16 +501,16 @@ xpc_get_remote_rp(int nasid, u64 *discovered_nasids, | |||
504 | static enum xp_retval | 501 | static enum xp_retval |
505 | xpc_get_remote_vars(u64 remote_vars_pa, struct xpc_vars *remote_vars) | 502 | xpc_get_remote_vars(u64 remote_vars_pa, struct xpc_vars *remote_vars) |
506 | { | 503 | { |
507 | int bres; | 504 | enum xp_retval ret; |
508 | 505 | ||
509 | if (remote_vars_pa == 0) | 506 | if (remote_vars_pa == 0) |
510 | return xpVarsNotSet; | 507 | return xpVarsNotSet; |
511 | 508 | ||
512 | /* pull over the cross partition variables */ | 509 | /* pull over the cross partition variables */ |
513 | bres = xp_bte_copy(remote_vars_pa, (u64)remote_vars, XPC_RP_VARS_SIZE, | 510 | ret = xp_remote_memcpy(remote_vars, (void *)remote_vars_pa, |
514 | (BTE_NOTIFY | BTE_WACQUIRE), NULL); | 511 | XPC_RP_VARS_SIZE); |
515 | if (bres != BTE_SUCCESS) | 512 | if (ret != xpSuccess) |
516 | return xpc_map_bte_errors(bres); | 513 | return ret; |
517 | 514 | ||
518 | if (XPC_VERSION_MAJOR(remote_vars->version) != | 515 | if (XPC_VERSION_MAJOR(remote_vars->version) != |
519 | XPC_VERSION_MAJOR(XPC_V_VERSION)) { | 516 | XPC_VERSION_MAJOR(XPC_V_VERSION)) { |
@@ -1148,7 +1145,6 @@ xpc_initiate_partid_to_nasids(short partid, void *nasid_mask) | |||
1148 | { | 1145 | { |
1149 | struct xpc_partition *part; | 1146 | struct xpc_partition *part; |
1150 | u64 part_nasid_pa; | 1147 | u64 part_nasid_pa; |
1151 | int bte_res; | ||
1152 | 1148 | ||
1153 | part = &xpc_partitions[partid]; | 1149 | part = &xpc_partitions[partid]; |
1154 | if (part->remote_rp_pa == 0) | 1150 | if (part->remote_rp_pa == 0) |
@@ -1158,9 +1154,6 @@ xpc_initiate_partid_to_nasids(short partid, void *nasid_mask) | |||
1158 | 1154 | ||
1159 | part_nasid_pa = (u64)XPC_RP_PART_NASIDS(part->remote_rp_pa); | 1155 | part_nasid_pa = (u64)XPC_RP_PART_NASIDS(part->remote_rp_pa); |
1160 | 1156 | ||
1161 | bte_res = xp_bte_copy(part_nasid_pa, (u64)nasid_mask, | 1157 | return xp_remote_memcpy(nasid_mask, (void *)part_nasid_pa, |
1162 | xp_nasid_mask_bytes, (BTE_NOTIFY | BTE_WACQUIRE), | 1158 | xp_nasid_mask_bytes); |
1163 | NULL); | ||
1164 | |||
1165 | return xpc_map_bte_errors(bte_res); | ||
1166 | } | 1159 | } |