summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/mips64/sgi-ip27/ip27-init.c63
-rw-r--r--arch/mips64/sgi-ip27/ip27-klconfig.c123
-rw-r--r--arch/mips64/sgi-ip27/ip27-memory.c2
-rw-r--r--arch/mips64/sgi-ip27/ip27-timer.c2
-rw-r--r--include/asm-mips64/sn/arch.h9
-rw-r--r--include/asm-mips64/sn/klconfig.h6
-rw-r--r--include/asm-mips64/sn/types.h2
7 files changed, 138 insertions, 69 deletions
diff --git a/arch/mips64/sgi-ip27/ip27-init.c b/arch/mips64/sgi-ip27/ip27-init.c
index 5c0ab4062..1c4caad15 100644
--- a/arch/mips64/sgi-ip27/ip27-init.c
+++ b/arch/mips64/sgi-ip27/ip27-init.c
@@ -15,9 +15,6 @@
#include <asm/processor.h>
#include <asm/sn/launch.h>
-typedef unsigned long cpumask_t; /* into asm/sn/types.h */
-typedef unsigned long cpuid_t;
-
#define CPUMASK_CLRALL(p) (p) = 0
#define CPUMASK_SETB(p, bit) (p) |= 1 << (bit)
#define CPUMASK_CLRB(p, bit) (p) &= ~(1ULL << (bit))
@@ -57,51 +54,6 @@ int is_fine_dirmode(void)
>> NSRI_REGIONSIZE_SHFT) & REGIONSIZE_FINE);
}
-lboard_t * find_lboard_real(lboard_t *start, unsigned char brd_type)
-{
- /* Search all boards stored on this node. */
- while (start) {
- if (start->brd_type == brd_type)
- return start;
- start = KLCF_NEXT(start);
- }
- /* Didn't find it. */
- return (lboard_t *)NULL;
-}
-
-klinfo_t *find_component(lboard_t *brd, klinfo_t *kli, unsigned char struct_type)
-{
- int index, j;
-
- if (kli == (klinfo_t *)NULL) {
- index = 0;
- } else {
- for (j = 0; j < KLCF_NUM_COMPS(brd); j++)
- if (kli == KLCF_COMP(brd, j))
- break;
- index = j;
- if (index == KLCF_NUM_COMPS(brd)) {
- printk("find_component: Bad pointer: 0x%p\n", kli);
- return (klinfo_t *)NULL;
- }
- index++; /* next component */
- }
-
- for (; index < KLCF_NUM_COMPS(brd); index++) {
- kli = KLCF_COMP(brd, index);
- if (KLCF_COMP_TYPE(kli) == struct_type)
- return kli;
- }
-
- /* Didn't find it. */
- return (klinfo_t *)NULL;
-}
-
-klinfo_t *find_first_component(lboard_t *brd, unsigned char struct_type)
-{
- return find_component(brd, (klinfo_t *)NULL, struct_type);
-}
-
nasid_t get_actual_nasid(lboard_t *brd)
{
klhub_t *hub;
@@ -127,7 +79,7 @@ int do_cpumask(cnodeid_t cnode, nasid_t nasid, cpumask_t *boot_cpumask,
int cpus_found = 0;
cpuid_t cpuid;
- brd = find_lboard_real((lboard_t *)KL_CONFIG_INFO(nasid), KLTYPE_IP27);
+ brd = find_lboard((lboard_t *)KL_CONFIG_INFO(nasid), KLTYPE_IP27);
do {
acpu = (klcpu_t *)find_first_component(brd, KLSTRUCT_CPU);
@@ -148,7 +100,7 @@ int do_cpumask(cnodeid_t cnode, nasid_t nasid, cpumask_t *boot_cpumask,
}
brd = KLCF_NEXT(brd);
if (brd)
- brd = find_lboard_real(brd,KLTYPE_IP27);
+ brd = find_lboard(brd,KLTYPE_IP27);
else
break;
} while (brd);
@@ -321,12 +273,11 @@ void allowboot(void)
if (CPUMASK_TSTB(boot_cpumask, cpu)) {
num_cpus++;
- /*
- * Launch a slave into bootstrap().
- * It doesn't take an argument, and we'll
- * take care of sp and gp when we get there.
- */
-/* cputonasid/cputoslice not working yet */
+ /*
+ * Launch a slave into bootstrap().
+ * It doesn't take an argument, and we'll
+ * take care of sp and gp when we get there.
+ */
LAUNCH_SLAVE(cputonasid(cpu), cputoslice(cpu), 0, 0, 0, 0);
}
}
diff --git a/arch/mips64/sgi-ip27/ip27-klconfig.c b/arch/mips64/sgi-ip27/ip27-klconfig.c
index 54073abfd..e1ca1e19a 100644
--- a/arch/mips64/sgi-ip27/ip27-klconfig.c
+++ b/arch/mips64/sgi-ip27/ip27-klconfig.c
@@ -13,21 +13,124 @@
#include <linux/mm.h>
#include <asm/sn/klconfig.h>
+#include <asm/sn/arch.h>
+#include <asm/sn/gda.h>
-lboard_t *find_lboard(unsigned int type)
+klinfo_t *find_component(lboard_t *brd, klinfo_t *kli, unsigned char struct_type)
{
- lboard_t *b;
+ int index, j;
- for (
-b = KL_CONFIG_INFO(get_nasid());
-b;
-b = KLCF_NEXT(b)) {
- if (KLCF_REMOTE(b))
- continue; /* Skip remote boards. */
+ if (kli == (klinfo_t *)NULL) {
+ index = 0;
+ } else {
+ for (j = 0; j < KLCF_NUM_COMPS(brd); j++)
+ if (kli == KLCF_COMP(brd, j))
+ break;
+ index = j;
+ if (index == KLCF_NUM_COMPS(brd)) {
+ printk("find_component: Bad pointer: 0x%p\n", kli);
+ return (klinfo_t *)NULL;
+ }
+ index++; /* next component */
+ }
+
+ for (; index < KLCF_NUM_COMPS(brd); index++) {
+ kli = KLCF_COMP(brd, index);
+ if (KLCF_COMP_TYPE(kli) == struct_type)
+ return kli;
+ }
+
+ /* Didn't find it. */
+ return (klinfo_t *)NULL;
+}
- if (b->brd_type == type)
- return (lboard_t *) b;
+klinfo_t *find_first_component(lboard_t *brd, unsigned char struct_type)
+{
+ return find_component(brd, (klinfo_t *)NULL, struct_type);
+}
+
+lboard_t * find_lboard(lboard_t *start, unsigned char brd_type)
+{
+ /* Search all boards stored on this node. */
+ while (start) {
+ if (start->brd_type == brd_type)
+ return start;
+ start = KLCF_NEXT(start);
}
+ /* Didn't find it. */
+ return (lboard_t *)NULL;
+}
+cnodeid_t get_cpu_cnode(int cpu)
+{
+ return CPUID_TO_COMPACT_NODEID(cpu);
+}
+
+klcpu_t * nasid_slice_to_cpuinfo(nasid_t nasid, int slice)
+{
+ lboard_t *brd;
+ klcpu_t *acpu;
+
+ if (!(brd = find_lboard((lboard_t *)KL_CONFIG_INFO(nasid), KLTYPE_IP27)))
+ return (klcpu_t *)NULL;
+
+ if (!(acpu = (klcpu_t *)find_first_component(brd, KLSTRUCT_CPU)))
+ return (klcpu_t *)NULL;
+
+ do {
+ if ((acpu->cpu_info.physid) == slice)
+ return acpu;
+ } while ((acpu = (klcpu_t *)find_component(brd, (klinfo_t *)acpu,
+ KLSTRUCT_CPU)));
+ return (klcpu_t *)NULL;
+}
+
+klcpu_t * sn_get_cpuinfo(cpuid_t cpu)
+{
+ nasid_t nasid;
+ int slice;
+ klcpu_t *acpu;
+ gda_t *gdap = GDA;
+ cnodeid_t cnode;
+
+ if (!(cpu < MAXCPUS)) {
+ printk("sn_get_cpuinfo: illegal cpuid 0x%lx\n", cpu);
+ return NULL;
+ }
+
+ cnode = get_cpu_cnode(cpu);
+ if (cnode == INVALID_CNODEID)
+ return NULL;
+
+ if ((nasid = gdap->g_nasidtable[cnode]) == INVALID_NASID)
+ return NULL;
+
+ for (slice = 0; slice < CPUS_PER_NODE; slice++) {
+ acpu = nasid_slice_to_cpuinfo(nasid, slice);
+ if (acpu && acpu->cpu_info.virtid == cpu)
+ return acpu;
+ }
return NULL;
}
+
+int get_cpu_slice(cpuid_t cpu)
+{
+ klcpu_t *acpu;
+
+ if ((acpu = sn_get_cpuinfo(cpu)) == NULL)
+ return -1;
+ return acpu->cpu_info.physid;
+}
+
+void alloc_cpupda(int i)
+{
+ cnodeid_t node;
+ nasid_t nasid;
+
+ node = get_cpu_cnode(i);
+ nasid = COMPACT_TO_NASID_NODEID(node);
+
+ cputonasid(i) = nasid;
+ cputocnode(i) = node;
+ cputoslice(i) = get_cpu_slice(i);
+}
diff --git a/arch/mips64/sgi-ip27/ip27-memory.c b/arch/mips64/sgi-ip27/ip27-memory.c
index 0394d2ca0..abd0c10e1 100644
--- a/arch/mips64/sgi-ip27/ip27-memory.c
+++ b/arch/mips64/sgi-ip27/ip27-memory.c
@@ -124,7 +124,7 @@ static pfn_t slot_psize_compute(cnodeid_t node, int slot)
nasid = COMPACT_TO_NASID_NODEID(node);
/* Find the node board */
- brd = find_lboard_real((lboard_t *)KL_CONFIG_INFO(nasid), KLTYPE_IP27);
+ brd = find_lboard((lboard_t *)KL_CONFIG_INFO(nasid), KLTYPE_IP27);
if (!brd)
return 0;
diff --git a/arch/mips64/sgi-ip27/ip27-timer.c b/arch/mips64/sgi-ip27/ip27-timer.c
index 5b74fffc0..6f9abac50 100644
--- a/arch/mips64/sgi-ip27/ip27-timer.c
+++ b/arch/mips64/sgi-ip27/ip27-timer.c
@@ -258,7 +258,7 @@ void __init time_init(void)
xtime.tv_usec = 0;
/* Don't use ARCS. ARCS is fragile. Klconfig is simple and sane. */
- board = find_lboard(KLTYPE_IP27);
+ board = find_lboard(KL_CONFIG_INFO(get_nasid()), KLTYPE_IP27);
if (!board)
panic("Can't find board info for myself.");
diff --git a/include/asm-mips64/sn/arch.h b/include/asm-mips64/sn/arch.h
index 5246b040c..b4fe083d6 100644
--- a/include/asm-mips64/sn/arch.h
+++ b/include/asm-mips64/sn/arch.h
@@ -45,6 +45,9 @@ typedef u64 nic_t;
#define INVALID_PARTID (partid_t)-1
extern nasid_t get_nasid(void);
+extern cnodeid_t get_cpu_cnode(int);
+extern int get_cpu_slice(cpuid_t);
+
/*
* NO ONE should access these arrays directly. The only reason we refer to
* them here is to avoid the procedure call that would be required in the
@@ -64,6 +67,12 @@ extern nasid_t compact_to_nasid_node[MAX_COMPACT_NODES];
((nnode) >> \
(is_fine_dirmode() ? NASID_TO_FINEREG_SHFT : NASID_TO_COARSEREG_SHFT))
+#if !defined(_STANDALONE)
+extern cnodeid_t nasid_to_compact_node[MAX_NASIDS];
+extern nasid_t compact_to_nasid_node[MAX_COMPACT_NODES];
+extern cnodeid_t cpuid_to_compact_node[MAXCPUS];
+#endif
+
#if !defined(DEBUG) && (!defined(SABLE) || defined(_STANDALONE))
#define NASID_TO_COMPACT_NODEID(nnode) (nasid_to_compact_node[nnode])
diff --git a/include/asm-mips64/sn/klconfig.h b/include/asm-mips64/sn/klconfig.h
index 592ee59d3..2d2ab75ba 100644
--- a/include/asm-mips64/sn/klconfig.h
+++ b/include/asm-mips64/sn/klconfig.h
@@ -898,6 +898,10 @@ typedef union {
/* external declarations of Linux kernel functions. */
-extern lboard_t *find_lboard(unsigned int type);
+extern lboard_t *find_lboard(lboard_t *start, unsigned char type);
+extern klinfo_t *find_component(lboard_t *brd, klinfo_t *kli, unsigned char type);
+extern klinfo_t *find_first_component(lboard_t *brd, unsigned char type);
+extern klcpu_t *nasid_slice_to_cpuinfo(nasid_t, int);
+extern klcpu_t *sn_get_cpuinfo(cpuid_t cpu);
#endif /* _ASM_SN_KLCONFIG_H */
diff --git a/include/asm-mips64/sn/types.h b/include/asm-mips64/sn/types.h
index 8aa5c0172..89a2e122d 100644
--- a/include/asm-mips64/sn/types.h
+++ b/include/asm-mips64/sn/types.h
@@ -12,6 +12,8 @@
#include <linux/types.h>
+typedef unsigned long cpuid_t;
+typedef unsigned long cpumask_t;
typedef signed short nasid_t; /* node id in numa-as-id space */
typedef signed short cnodeid_t; /* node id in compact-id space */
typedef signed char partid_t; /* partition ID type */