diff options
author | Jack Steiner <steiner@sgi.com> | 2010-11-30 14:55:39 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-12-22 06:31:15 -0500 |
commit | e681041388e61ecd7f99dba66b3c1db11a564d92 (patch) | |
tree | 795c713c6dc9daafc0eef767e75718ed6e57128c /arch | |
parent | 90a8a73c06cc32b609a880d48449d7083327e11a (diff) |
x86, UV: Add common uv_early_read_mmr() function for reading MMRs
Early in boot, reading MMRs from the UV hub controller require
calls to early_ioremap()/early_iounmap(). Rather than
duplicating code, add a common function to do the
map/read/unmap.
Signed-off-by: Jack Steiner <steiner@sgi.com>
LKML-Reference: <20101130195926.834804371@sgi.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kernel/apic/x2apic_uv_x.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c index c1c52c341f40..0c3675f0474f 100644 --- a/arch/x86/kernel/apic/x2apic_uv_x.c +++ b/arch/x86/kernel/apic/x2apic_uv_x.c | |||
@@ -48,6 +48,16 @@ unsigned int uv_apicid_hibits; | |||
48 | EXPORT_SYMBOL_GPL(uv_apicid_hibits); | 48 | EXPORT_SYMBOL_GPL(uv_apicid_hibits); |
49 | static DEFINE_SPINLOCK(uv_nmi_lock); | 49 | static DEFINE_SPINLOCK(uv_nmi_lock); |
50 | 50 | ||
51 | static unsigned long __init uv_early_read_mmr(unsigned long addr) | ||
52 | { | ||
53 | unsigned long val, *mmr; | ||
54 | |||
55 | mmr = early_ioremap(UV_LOCAL_MMR_BASE | addr, sizeof(*mmr)); | ||
56 | val = *mmr; | ||
57 | early_iounmap(mmr, sizeof(*mmr)); | ||
58 | return val; | ||
59 | } | ||
60 | |||
51 | static inline bool is_GRU_range(u64 start, u64 end) | 61 | static inline bool is_GRU_range(u64 start, u64 end) |
52 | { | 62 | { |
53 | return start >= gru_start_paddr && end <= gru_end_paddr; | 63 | return start >= gru_start_paddr && end <= gru_end_paddr; |
@@ -58,16 +68,12 @@ static bool uv_is_untracked_pat_range(u64 start, u64 end) | |||
58 | return is_ISA_range(start, end) || is_GRU_range(start, end); | 68 | return is_ISA_range(start, end) || is_GRU_range(start, end); |
59 | } | 69 | } |
60 | 70 | ||
61 | static int early_get_nodeid(void) | 71 | static int __init early_get_nodeid(void) |
62 | { | 72 | { |
63 | union uvh_node_id_u node_id; | 73 | union uvh_node_id_u node_id; |
64 | unsigned long *mmr; | ||
65 | |||
66 | mmr = early_ioremap(UV_LOCAL_MMR_BASE | UVH_NODE_ID, sizeof(*mmr)); | ||
67 | node_id.v = *mmr; | ||
68 | early_iounmap(mmr, sizeof(*mmr)); | ||
69 | 74 | ||
70 | /* Currently, all blades have same revision number */ | 75 | /* Currently, all blades have same revision number */ |
76 | node_id.v = uv_early_read_mmr(UVH_NODE_ID); | ||
71 | uv_min_hub_revision_id = node_id.s.revision; | 77 | uv_min_hub_revision_id = node_id.s.revision; |
72 | 78 | ||
73 | return node_id.s.node_id; | 79 | return node_id.s.node_id; |
@@ -75,11 +81,7 @@ static int early_get_nodeid(void) | |||
75 | 81 | ||
76 | static void __init early_get_apic_pnode_shift(void) | 82 | static void __init early_get_apic_pnode_shift(void) |
77 | { | 83 | { |
78 | unsigned long *mmr; | 84 | uvh_apicid.v = uv_early_read_mmr(UVH_APICID); |
79 | |||
80 | mmr = early_ioremap(UV_LOCAL_MMR_BASE | UVH_APICID, sizeof(*mmr)); | ||
81 | uvh_apicid.v = *mmr; | ||
82 | early_iounmap(mmr, sizeof(*mmr)); | ||
83 | if (!uvh_apicid.v) | 85 | if (!uvh_apicid.v) |
84 | /* | 86 | /* |
85 | * Old bios, use default value | 87 | * Old bios, use default value |
@@ -95,12 +97,8 @@ static void __init early_get_apic_pnode_shift(void) | |||
95 | static void __init uv_set_apicid_hibit(void) | 97 | static void __init uv_set_apicid_hibit(void) |
96 | { | 98 | { |
97 | union uvh_lb_target_physical_apic_id_mask_u apicid_mask; | 99 | union uvh_lb_target_physical_apic_id_mask_u apicid_mask; |
98 | unsigned long *mmr; | ||
99 | 100 | ||
100 | mmr = early_ioremap(UV_LOCAL_MMR_BASE | | 101 | apicid_mask.v = uv_early_read_mmr(UVH_LB_TARGET_PHYSICAL_APIC_ID_MASK); |
101 | UVH_LB_TARGET_PHYSICAL_APIC_ID_MASK, sizeof(*mmr)); | ||
102 | apicid_mask.v = *mmr; | ||
103 | early_iounmap(mmr, sizeof(*mmr)); | ||
104 | uv_apicid_hibits = apicid_mask.s.bit_enables & UV_APICID_HIBIT_MASK; | 102 | uv_apicid_hibits = apicid_mask.s.bit_enables & UV_APICID_HIBIT_MASK; |
105 | } | 103 | } |
106 | 104 | ||