aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ia64/uv
diff options
context:
space:
mode:
Diffstat (limited to 'arch/ia64/uv')
-rw-r--r--arch/ia64/uv/Makefile12
-rw-r--r--arch/ia64/uv/kernel/Makefile13
-rw-r--r--arch/ia64/uv/kernel/machvec.c11
-rw-r--r--arch/ia64/uv/kernel/setup.c110
4 files changed, 146 insertions, 0 deletions
diff --git a/arch/ia64/uv/Makefile b/arch/ia64/uv/Makefile
new file mode 100644
index 000000000000..aa9f91947c49
--- /dev/null
+++ b/arch/ia64/uv/Makefile
@@ -0,0 +1,12 @@
1# arch/ia64/uv/Makefile
2#
3# This file is subject to the terms and conditions of the GNU General Public
4# License. See the file "COPYING" in the main directory of this archive
5# for more details.
6#
7# Copyright (C) 2008 Silicon Graphics, Inc. All Rights Reserved.
8#
9# Makefile for the sn uv subplatform
10#
11
12obj-y += kernel/
diff --git a/arch/ia64/uv/kernel/Makefile b/arch/ia64/uv/kernel/Makefile
new file mode 100644
index 000000000000..8d92b4684d8e
--- /dev/null
+++ b/arch/ia64/uv/kernel/Makefile
@@ -0,0 +1,13 @@
1# arch/ia64/uv/kernel/Makefile
2#
3# This file is subject to the terms and conditions of the GNU General Public
4# License. See the file "COPYING" in the main directory of this archive
5# for more details.
6#
7# Copyright (C) 2008 Silicon Graphics, Inc. All Rights Reserved.
8#
9
10EXTRA_CFLAGS += -Iarch/ia64/sn/include
11
12obj-y += setup.o
13obj-$(CONFIG_IA64_GENERIC) += machvec.o
diff --git a/arch/ia64/uv/kernel/machvec.c b/arch/ia64/uv/kernel/machvec.c
new file mode 100644
index 000000000000..50737a9dca74
--- /dev/null
+++ b/arch/ia64/uv/kernel/machvec.c
@@ -0,0 +1,11 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (c) 2008 Silicon Graphics, Inc. All Rights Reserved.
7 */
8
9#define MACHVEC_PLATFORM_NAME uv
10#define MACHVEC_PLATFORM_HEADER <asm/machvec_uv.h>
11#include <asm/machvec_init.h>
diff --git a/arch/ia64/uv/kernel/setup.c b/arch/ia64/uv/kernel/setup.c
new file mode 100644
index 000000000000..cf5f28ae96c4
--- /dev/null
+++ b/arch/ia64/uv/kernel/setup.c
@@ -0,0 +1,110 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * SGI UV Core Functions
7 *
8 * Copyright (C) 2008 Silicon Graphics, Inc. All rights reserved.
9 */
10
11#include <linux/module.h>
12#include <linux/percpu.h>
13#include <asm/sn/simulator.h>
14#include <asm/uv/uv_mmrs.h>
15#include <asm/uv/uv_hub.h>
16
17DEFINE_PER_CPU(struct uv_hub_info_s, __uv_hub_info);
18EXPORT_PER_CPU_SYMBOL_GPL(__uv_hub_info);
19
20#ifdef CONFIG_IA64_SGI_UV
21int sn_prom_type;
22#endif
23
24struct redir_addr {
25 unsigned long redirect;
26 unsigned long alias;
27};
28
29#define DEST_SHIFT UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_0_MMR_DEST_BASE_SHFT
30
31static __initdata struct redir_addr redir_addrs[] = {
32 {UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_0_MMR, UVH_SI_ALIAS0_OVERLAY_CONFIG},
33 {UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_1_MMR, UVH_SI_ALIAS1_OVERLAY_CONFIG},
34 {UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_2_MMR, UVH_SI_ALIAS2_OVERLAY_CONFIG},
35};
36
37static __init void get_lowmem_redirect(unsigned long *base, unsigned long *size)
38{
39 union uvh_si_alias0_overlay_config_u alias;
40 union uvh_rh_gam_alias210_redirect_config_2_mmr_u redirect;
41 int i;
42
43 for (i = 0; i < ARRAY_SIZE(redir_addrs); i++) {
44 alias.v = uv_read_local_mmr(redir_addrs[i].alias);
45 if (alias.s.base == 0) {
46 *size = (1UL << alias.s.m_alias);
47 redirect.v = uv_read_local_mmr(redir_addrs[i].redirect);
48 *base = (unsigned long)redirect.s.dest_base << DEST_SHIFT;
49 return;
50 }
51 }
52 BUG();
53}
54
55void __init uv_setup(char **cmdline_p)
56{
57 union uvh_si_addr_map_config_u m_n_config;
58 union uvh_node_id_u node_id;
59 unsigned long gnode_upper;
60 int nid, cpu, m_val, n_val;
61 unsigned long mmr_base, lowmem_redir_base, lowmem_redir_size;
62
63 if (IS_MEDUSA()) {
64 lowmem_redir_base = 0;
65 lowmem_redir_size = 0;
66 node_id.v = 0;
67 m_n_config.s.m_skt = 37;
68 m_n_config.s.n_skt = 0;
69 mmr_base = 0;
70#if 0
71 /* Need BIOS calls - TDB */
72 if (!ia64_sn_is_fake_prom())
73 sn_prom_type = 1;
74 else
75#endif
76 sn_prom_type = 2;
77 printk(KERN_INFO "Running on medusa with %s PROM\n",
78 (sn_prom_type == 1) ? "real" : "fake");
79 } else {
80 get_lowmem_redirect(&lowmem_redir_base, &lowmem_redir_size);
81 node_id.v = uv_read_local_mmr(UVH_NODE_ID);
82 m_n_config.v = uv_read_local_mmr(UVH_SI_ADDR_MAP_CONFIG);
83 mmr_base =
84 uv_read_local_mmr(UVH_RH_GAM_MMR_OVERLAY_CONFIG_MMR) &
85 ~UV_MMR_ENABLE;
86 }
87
88 m_val = m_n_config.s.m_skt;
89 n_val = m_n_config.s.n_skt;
90 printk(KERN_DEBUG "UV: global MMR base 0x%lx\n", mmr_base);
91
92 gnode_upper = (((unsigned long)node_id.s.node_id) &
93 ~((1 << n_val) - 1)) << m_val;
94
95 for_each_present_cpu(cpu) {
96 nid = cpu_to_node(cpu);
97 uv_cpu_hub_info(cpu)->lowmem_remap_base = lowmem_redir_base;
98 uv_cpu_hub_info(cpu)->lowmem_remap_top =
99 lowmem_redir_base + lowmem_redir_size;
100 uv_cpu_hub_info(cpu)->m_val = m_val;
101 uv_cpu_hub_info(cpu)->n_val = m_val;
102 uv_cpu_hub_info(cpu)->pnode_mask = (1 << n_val) -1;
103 uv_cpu_hub_info(cpu)->gpa_mask = (1 << (m_val + n_val)) - 1;
104 uv_cpu_hub_info(cpu)->gnode_upper = gnode_upper;
105 uv_cpu_hub_info(cpu)->global_mmr_base = mmr_base;
106 uv_cpu_hub_info(cpu)->coherency_domain_number = 0;/* ZZZ */
107 printk(KERN_DEBUG "UV cpu %d, nid %d\n", cpu, nid);
108 }
109}
110