aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2005-11-09 21:37:51 -0500
committerPaul Mackerras <paulus@samba.org>2005-11-09 21:37:51 -0500
commit799d6046d3fb557006e6d7c9767fdb96479b0e0a (patch)
treefff321e3c0c0e6d1192f453aab23ad204f350851 /arch/powerpc
parent3ddfbcf19b15ccd25a0b4b2dc2e38000e08de739 (diff)
[PATCH] powerpc: merge code values for identifying platforms
This patch merges platform codes. systemcfg->platform is no longer used, systemcfg use in general is deprecated as much as possible (and renamed _systemcfg before it gets completely moved elsewhere in a future patch), _machine is now used on ppc64 along as ppc32. Platform codes aren't gone yet but we are getting a step closer. A bunch of asm code in head[_64].S is also turned into C code. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/kernel/asm-offsets.c1
-rw-r--r--arch/powerpc/kernel/head_64.S91
-rw-r--r--arch/powerpc/kernel/paca.c5
-rw-r--r--arch/powerpc/kernel/ppc_ksyms.c3
-rw-r--r--arch/powerpc/kernel/prom.c16
-rw-r--r--arch/powerpc/kernel/prom_init.c8
-rw-r--r--arch/powerpc/kernel/rtas-proc.c2
-rw-r--r--arch/powerpc/kernel/rtas.c5
-rw-r--r--arch/powerpc/kernel/setup-common.c12
-rw-r--r--arch/powerpc/kernel/setup_32.c2
-rw-r--r--arch/powerpc/kernel/setup_64.c65
-rw-r--r--arch/powerpc/kernel/smp.c5
-rw-r--r--arch/powerpc/kernel/sys_ppc32.c1
-rw-r--r--arch/powerpc/kernel/time.c29
-rw-r--r--arch/powerpc/kernel/traps.c2
-rw-r--r--arch/powerpc/mm/hash_utils_64.c29
-rw-r--r--arch/powerpc/mm/stab.c21
-rw-r--r--arch/powerpc/oprofile/op_model_power4.c3
-rw-r--r--arch/powerpc/platforms/iseries/setup.c23
-rw-r--r--arch/powerpc/platforms/pseries/eeh.c3
-rw-r--r--arch/powerpc/platforms/pseries/iommu.c3
-rw-r--r--arch/powerpc/platforms/pseries/pci.c2
-rw-r--r--arch/powerpc/platforms/pseries/reconfig.c2
-rw-r--r--arch/powerpc/platforms/pseries/rtasd.c8
-rw-r--r--arch/powerpc/platforms/pseries/setup.c8
-rw-r--r--arch/powerpc/platforms/pseries/smp.c5
-rw-r--r--arch/powerpc/platforms/pseries/xics.c6
27 files changed, 165 insertions, 195 deletions
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index b75757251994..8793102711a8 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -106,7 +106,6 @@ int main(void)
106 DEFINE(ICACHEL1LINESIZE, offsetof(struct ppc64_caches, iline_size)); 106 DEFINE(ICACHEL1LINESIZE, offsetof(struct ppc64_caches, iline_size));
107 DEFINE(ICACHEL1LOGLINESIZE, offsetof(struct ppc64_caches, log_iline_size)); 107 DEFINE(ICACHEL1LOGLINESIZE, offsetof(struct ppc64_caches, log_iline_size));
108 DEFINE(ICACHEL1LINESPERPAGE, offsetof(struct ppc64_caches, ilines_per_page)); 108 DEFINE(ICACHEL1LINESPERPAGE, offsetof(struct ppc64_caches, ilines_per_page));
109 DEFINE(PLATFORM, offsetof(struct systemcfg, platform));
110 DEFINE(PLATFORM_LPAR, PLATFORM_LPAR); 109 DEFINE(PLATFORM_LPAR, PLATFORM_LPAR);
111 110
112 /* paca */ 111 /* paca */
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index 16ab40daa738..8a8bf79ef044 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -28,7 +28,6 @@
28#include <asm/reg.h> 28#include <asm/reg.h>
29#include <asm/page.h> 29#include <asm/page.h>
30#include <asm/mmu.h> 30#include <asm/mmu.h>
31#include <asm/systemcfg.h>
32#include <asm/ppc_asm.h> 31#include <asm/ppc_asm.h>
33#include <asm/asm-offsets.h> 32#include <asm/asm-offsets.h>
34#include <asm/bug.h> 33#include <asm/bug.h>
@@ -1697,25 +1696,14 @@ _GLOBAL(pmac_secondary_start)
1697 * SPRG3 = paca virtual address 1696 * SPRG3 = paca virtual address
1698 */ 1697 */
1699_GLOBAL(__secondary_start) 1698_GLOBAL(__secondary_start)
1699 /* Set thread priority to MEDIUM */
1700 HMT_MEDIUM
1700 1701
1701 HMT_MEDIUM /* Set thread priority to MEDIUM */ 1702 /* Load TOC */
1702
1703 ld r2,PACATOC(r13) 1703 ld r2,PACATOC(r13)
1704 li r6,0 1704
1705 stb r6,PACAPROCENABLED(r13) 1705 /* Do early setup for that CPU (stab, slb, hash table pointer) */
1706 1706 bl .early_setup_secondary
1707#ifndef CONFIG_PPC_ISERIES
1708 /* Initialize the page table pointer register. */
1709 LOADADDR(r6,_SDR1)
1710 ld r6,0(r6) /* get the value of _SDR1 */
1711 mtspr SPRN_SDR1,r6 /* set the htab location */
1712#endif
1713 /* Initialize the first segment table (or SLB) entry */
1714 ld r3,PACASTABVIRT(r13) /* get addr of segment table */
1715BEGIN_FTR_SECTION
1716 bl .stab_initialize
1717END_FTR_SECTION_IFCLR(CPU_FTR_SLB)
1718 bl .slb_initialize
1719 1707
1720 /* Initialize the kernel stack. Just a repeat for iSeries. */ 1708 /* Initialize the kernel stack. Just a repeat for iSeries. */
1721 LOADADDR(r3,current_set) 1709 LOADADDR(r3,current_set)
@@ -1724,37 +1712,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_SLB)
1724 addi r1,r1,THREAD_SIZE-STACK_FRAME_OVERHEAD 1712 addi r1,r1,THREAD_SIZE-STACK_FRAME_OVERHEAD
1725 std r1,PACAKSAVE(r13) 1713 std r1,PACAKSAVE(r13)
1726 1714
1727 ld r3,PACASTABREAL(r13) /* get raddr of segment table */ 1715 /* Clear backchain so we get nice backtraces */
1728 ori r4,r3,1 /* turn on valid bit */
1729
1730#ifdef CONFIG_PPC_ISERIES
1731 li r0,-1 /* hypervisor call */
1732 li r3,1
1733 sldi r3,r3,63 /* 0x8000000000000000 */
1734 ori r3,r3,4 /* 0x8000000000000004 */
1735 sc /* HvCall_setASR */
1736#else
1737 /* set the ASR */
1738 ld r3,systemcfg@got(r2) /* r3 = ptr to systemcfg */
1739 ld r3,0(r3)
1740 lwz r3,PLATFORM(r3) /* r3 = platform flags */
1741 andi. r3,r3,PLATFORM_LPAR /* Test if bit 0 is set (LPAR bit) */
1742 beq 98f /* branch if result is 0 */
1743 mfspr r3,SPRN_PVR
1744 srwi r3,r3,16
1745 cmpwi r3,0x37 /* SStar */
1746 beq 97f
1747 cmpwi r3,0x36 /* IStar */
1748 beq 97f
1749 cmpwi r3,0x34 /* Pulsar */
1750 bne 98f
175197: li r3,H_SET_ASR /* hcall = H_SET_ASR */
1752 HVSC /* Invoking hcall */
1753 b 99f
175498: /* !(rpa hypervisor) || !(star) */
1755 mtasr r4 /* set the stab location */
175699:
1757#endif
1758 li r7,0 1716 li r7,0
1759 mtlr r7 1717 mtlr r7
1760 1718
@@ -1777,6 +1735,7 @@ _GLOBAL(start_secondary_prolog)
1777 li r3,0 1735 li r3,0
1778 std r3,0(r1) /* Zero the stack frame pointer */ 1736 std r3,0(r1) /* Zero the stack frame pointer */
1779 bl .start_secondary 1737 bl .start_secondary
1738 b .
1780#endif 1739#endif
1781 1740
1782/* 1741/*
@@ -1896,40 +1855,6 @@ _STATIC(start_here_multiplatform)
1896 mr r3,r31 1855 mr r3,r31
1897 bl .early_setup 1856 bl .early_setup
1898 1857
1899 /* set the ASR */
1900 ld r3,PACASTABREAL(r13)
1901 ori r4,r3,1 /* turn on valid bit */
1902 ld r3,systemcfg@got(r2) /* r3 = ptr to systemcfg */
1903 ld r3,0(r3)
1904 lwz r3,PLATFORM(r3) /* r3 = platform flags */
1905 andi. r3,r3,PLATFORM_LPAR /* Test if bit 0 is set (LPAR bit) */
1906 beq 98f /* branch if result is 0 */
1907 mfspr r3,SPRN_PVR
1908 srwi r3,r3,16
1909 cmpwi r3,0x37 /* SStar */
1910 beq 97f
1911 cmpwi r3,0x36 /* IStar */
1912 beq 97f
1913 cmpwi r3,0x34 /* Pulsar */
1914 bne 98f
191597: li r3,H_SET_ASR /* hcall = H_SET_ASR */
1916 HVSC /* Invoking hcall */
1917 b 99f
191898: /* !(rpa hypervisor) || !(star) */
1919 mtasr r4 /* set the stab location */
192099:
1921 /* Set SDR1 (hash table pointer) */
1922 ld r3,systemcfg@got(r2) /* r3 = ptr to systemcfg */
1923 ld r3,0(r3)
1924 lwz r3,PLATFORM(r3) /* r3 = platform flags */
1925 /* Test if bit 0 is set (LPAR bit) */
1926 andi. r3,r3,PLATFORM_LPAR
1927 bne 98f /* branch if result is !0 */
1928 LOADADDR(r6,_SDR1) /* Only if NOT LPAR */
1929 add r6,r6,r26
1930 ld r6,0(r6) /* get the value of _SDR1 */
1931 mtspr SPRN_SDR1,r6 /* set the htab location */
193298:
1933 LOADADDR(r3,.start_here_common) 1858 LOADADDR(r3,.start_here_common)
1934 SET_REG_TO_CONST(r4, MSR_KERNEL) 1859 SET_REG_TO_CONST(r4, MSR_KERNEL)
1935 mtspr SPRN_SRR0,r3 1860 mtspr SPRN_SRR0,r3
diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c
index 179948eb0580..3cf2517c5f91 100644
--- a/arch/powerpc/kernel/paca.c
+++ b/arch/powerpc/kernel/paca.c
@@ -15,7 +15,7 @@
15#include <asm/processor.h> 15#include <asm/processor.h>
16#include <asm/ptrace.h> 16#include <asm/ptrace.h>
17#include <asm/page.h> 17#include <asm/page.h>
18 18#include <asm/systemcfg.h>
19#include <asm/lppaca.h> 19#include <asm/lppaca.h>
20#include <asm/iseries/it_lp_queue.h> 20#include <asm/iseries/it_lp_queue.h>
21#include <asm/paca.h> 21#include <asm/paca.h>
@@ -24,8 +24,7 @@ static union {
24 struct systemcfg data; 24 struct systemcfg data;
25 u8 page[PAGE_SIZE]; 25 u8 page[PAGE_SIZE];
26} systemcfg_store __attribute__((__section__(".data.page.aligned"))); 26} systemcfg_store __attribute__((__section__(".data.page.aligned")));
27struct systemcfg *systemcfg = &systemcfg_store.data; 27struct systemcfg *_systemcfg = &systemcfg_store.data;
28EXPORT_SYMBOL(systemcfg);
29 28
30 29
31/* This symbol is provided by the linker - let it fill in the paca 30/* This symbol is provided by the linker - let it fill in the paca
diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c
index 5d9fd0369aad..5dcf4ba05ee8 100644
--- a/arch/powerpc/kernel/ppc_ksyms.c
+++ b/arch/powerpc/kernel/ppc_ksyms.c
@@ -188,9 +188,6 @@ EXPORT_SYMBOL(adb_try_handler_change);
188EXPORT_SYMBOL(cuda_request); 188EXPORT_SYMBOL(cuda_request);
189EXPORT_SYMBOL(cuda_poll); 189EXPORT_SYMBOL(cuda_poll);
190#endif /* CONFIG_ADB_CUDA */ 190#endif /* CONFIG_ADB_CUDA */
191#if defined(CONFIG_PPC_MULTIPLATFORM) && defined(CONFIG_PPC32)
192EXPORT_SYMBOL(_machine);
193#endif
194#ifdef CONFIG_PPC_PMAC 191#ifdef CONFIG_PPC_PMAC
195EXPORT_SYMBOL(sys_ctrler); 192EXPORT_SYMBOL(sys_ctrler);
196#endif 193#endif
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 5af39f866735..1bf3642cb859 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -48,9 +48,6 @@
48#include <asm/machdep.h> 48#include <asm/machdep.h>
49#include <asm/pSeries_reconfig.h> 49#include <asm/pSeries_reconfig.h>
50#include <asm/pci-bridge.h> 50#include <asm/pci-bridge.h>
51#ifdef CONFIG_PPC64
52#include <asm/systemcfg.h>
53#endif
54 51
55#ifdef DEBUG 52#ifdef DEBUG
56#define DBG(fmt...) printk(KERN_ERR fmt) 53#define DBG(fmt...) printk(KERN_ERR fmt)
@@ -391,7 +388,7 @@ static int __devinit finish_node_interrupts(struct device_node *np,
391 388
392#ifdef CONFIG_PPC64 389#ifdef CONFIG_PPC64
393 /* We offset irq numbers for the u3 MPIC by 128 in PowerMac */ 390 /* We offset irq numbers for the u3 MPIC by 128 in PowerMac */
394 if (systemcfg->platform == PLATFORM_POWERMAC && ic && ic->parent) { 391 if (_machine == PLATFORM_POWERMAC && ic && ic->parent) {
395 char *name = get_property(ic->parent, "name", NULL); 392 char *name = get_property(ic->parent, "name", NULL);
396 if (name && !strcmp(name, "u3")) 393 if (name && !strcmp(name, "u3"))
397 np->intrs[intrcount].line += 128; 394 np->intrs[intrcount].line += 128;
@@ -1161,13 +1158,9 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
1161 prop = (u32 *)of_get_flat_dt_prop(node, "linux,platform", NULL); 1158 prop = (u32 *)of_get_flat_dt_prop(node, "linux,platform", NULL);
1162 if (prop == NULL) 1159 if (prop == NULL)
1163 return 0; 1160 return 0;
1164#ifdef CONFIG_PPC64
1165 systemcfg->platform = *prop;
1166#else
1167#ifdef CONFIG_PPC_MULTIPLATFORM 1161#ifdef CONFIG_PPC_MULTIPLATFORM
1168 _machine = *prop; 1162 _machine = *prop;
1169#endif 1163#endif
1170#endif
1171 1164
1172#ifdef CONFIG_PPC64 1165#ifdef CONFIG_PPC64
1173 /* check if iommu is forced on or off */ 1166 /* check if iommu is forced on or off */
@@ -1346,9 +1339,6 @@ void __init early_init_devtree(void *params)
1346 of_scan_flat_dt(early_init_dt_scan_memory, NULL); 1339 of_scan_flat_dt(early_init_dt_scan_memory, NULL);
1347 lmb_enforce_memory_limit(memory_limit); 1340 lmb_enforce_memory_limit(memory_limit);
1348 lmb_analyze(); 1341 lmb_analyze();
1349#ifdef CONFIG_PPC64
1350 systemcfg->physicalMemorySize = lmb_phys_mem_size();
1351#endif
1352 lmb_reserve(0, __pa(klimit)); 1342 lmb_reserve(0, __pa(klimit));
1353 1343
1354 DBG("Phys. mem: %lx\n", lmb_phys_mem_size()); 1344 DBG("Phys. mem: %lx\n", lmb_phys_mem_size());
@@ -1915,7 +1905,7 @@ static int of_finish_dynamic_node(struct device_node *node,
1915 /* We don't support that function on PowerMac, at least 1905 /* We don't support that function on PowerMac, at least
1916 * not yet 1906 * not yet
1917 */ 1907 */
1918 if (systemcfg->platform == PLATFORM_POWERMAC) 1908 if (_machine == PLATFORM_POWERMAC)
1919 return -ENODEV; 1909 return -ENODEV;
1920 1910
1921 /* fix up new node's linux_phandle field */ 1911 /* fix up new node's linux_phandle field */
@@ -1999,9 +1989,11 @@ int prom_add_property(struct device_node* np, struct property* prop)
1999 *next = prop; 1989 *next = prop;
2000 write_unlock(&devtree_lock); 1990 write_unlock(&devtree_lock);
2001 1991
1992#ifdef CONFIG_PROC_DEVICETREE
2002 /* try to add to proc as well if it was initialized */ 1993 /* try to add to proc as well if it was initialized */
2003 if (np->pde) 1994 if (np->pde)
2004 proc_device_tree_add_prop(np->pde, prop); 1995 proc_device_tree_add_prop(np->pde, prop);
1996#endif /* CONFIG_PROC_DEVICETREE */
2005 1997
2006 return 0; 1998 return 0;
2007} 1999}
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 09db1bb9ec91..4ce0105c308e 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -117,11 +117,6 @@ int of_workarounds;
117#define prom_debug(x...) 117#define prom_debug(x...)
118#endif 118#endif
119 119
120#ifdef CONFIG_PPC32
121#define PLATFORM_POWERMAC _MACH_Pmac
122#define PLATFORM_CHRP _MACH_chrp
123#endif
124
125 120
126typedef u32 prom_arg_t; 121typedef u32 prom_arg_t;
127 122
@@ -2078,7 +2073,8 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4,
2078 /* 2073 /*
2079 * On pSeries, inform the firmware about our capabilities 2074 * On pSeries, inform the firmware about our capabilities
2080 */ 2075 */
2081 if (RELOC(of_platform) & PLATFORM_PSERIES) 2076 if (RELOC(of_platform) == PLATFORM_PSERIES ||
2077 RELOC(of_platform) == PLATFORM_PSERIES_LPAR)
2082 prom_send_capabilities(); 2078 prom_send_capabilities();
2083#endif 2079#endif
2084 2080
diff --git a/arch/powerpc/kernel/rtas-proc.c b/arch/powerpc/kernel/rtas-proc.c
index 5bdd5b079d96..ae1a36449ccd 100644
--- a/arch/powerpc/kernel/rtas-proc.c
+++ b/arch/powerpc/kernel/rtas-proc.c
@@ -259,7 +259,7 @@ static int __init proc_rtas_init(void)
259{ 259{
260 struct proc_dir_entry *entry; 260 struct proc_dir_entry *entry;
261 261
262 if (!(systemcfg->platform & PLATFORM_PSERIES)) 262 if (_machine != PLATFORM_PSERIES && _machine != PLATFORM_PSERIES_LPAR)
263 return 1; 263 return 1;
264 264
265 rtas_node = of_find_node_by_name(NULL, "rtas"); 265 rtas_node = of_find_node_by_name(NULL, "rtas");
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index 9d4e07f6f1ec..4283fa33f784 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -29,9 +29,6 @@
29#include <asm/delay.h> 29#include <asm/delay.h>
30#include <asm/uaccess.h> 30#include <asm/uaccess.h>
31#include <asm/lmb.h> 31#include <asm/lmb.h>
32#ifdef CONFIG_PPC64
33#include <asm/systemcfg.h>
34#endif
35 32
36struct rtas_t rtas = { 33struct rtas_t rtas = {
37 .lock = SPIN_LOCK_UNLOCKED 34 .lock = SPIN_LOCK_UNLOCKED
@@ -671,7 +668,7 @@ void __init rtas_initialize(void)
671 * the stop-self token if any 668 * the stop-self token if any
672 */ 669 */
673#ifdef CONFIG_PPC64 670#ifdef CONFIG_PPC64
674 if (systemcfg->platform == PLATFORM_PSERIES_LPAR) 671 if (_machine == PLATFORM_PSERIES_LPAR)
675 rtas_region = min(lmb.rmo_size, RTAS_INSTANTIATE_MAX); 672 rtas_region = min(lmb.rmo_size, RTAS_INSTANTIATE_MAX);
676#endif 673#endif
677 rtas_rmo_buf = lmb_alloc_base(RTAS_RMOBUF_MAX, PAGE_SIZE, rtas_region); 674 rtas_rmo_buf = lmb_alloc_base(RTAS_RMOBUF_MAX, PAGE_SIZE, rtas_region);
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 17c46a2e356d..06e4ef215627 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -33,6 +33,7 @@
33#include <asm/io.h> 33#include <asm/io.h>
34#include <asm/prom.h> 34#include <asm/prom.h>
35#include <asm/processor.h> 35#include <asm/processor.h>
36#include <asm/systemcfg.h>
36#include <asm/pgtable.h> 37#include <asm/pgtable.h>
37#include <asm/smp.h> 38#include <asm/smp.h>
38#include <asm/elf.h> 39#include <asm/elf.h>
@@ -63,6 +64,11 @@
63#define DBG(fmt...) 64#define DBG(fmt...)
64#endif 65#endif
65 66
67#ifdef CONFIG_PPC_MULTIPLATFORM
68int _machine = 0;
69EXPORT_SYMBOL(_machine);
70#endif
71
66/* 72/*
67 * This still seems to be needed... -- paulus 73 * This still seems to be needed... -- paulus
68 */ 74 */
@@ -513,8 +519,8 @@ void __init smp_setup_cpu_maps(void)
513 * On pSeries LPAR, we need to know how many cpus 519 * On pSeries LPAR, we need to know how many cpus
514 * could possibly be added to this partition. 520 * could possibly be added to this partition.
515 */ 521 */
516 if (systemcfg->platform == PLATFORM_PSERIES_LPAR && 522 if (_machine == PLATFORM_PSERIES_LPAR &&
517 (dn = of_find_node_by_path("/rtas"))) { 523 (dn = of_find_node_by_path("/rtas"))) {
518 int num_addr_cell, num_size_cell, maxcpus; 524 int num_addr_cell, num_size_cell, maxcpus;
519 unsigned int *ireg; 525 unsigned int *ireg;
520 526
@@ -558,7 +564,7 @@ void __init smp_setup_cpu_maps(void)
558 cpu_set(cpu ^ 0x1, cpu_sibling_map[cpu]); 564 cpu_set(cpu ^ 0x1, cpu_sibling_map[cpu]);
559 } 565 }
560 566
561 systemcfg->processorCount = num_present_cpus(); 567 _systemcfg->processorCount = num_present_cpus();
562#endif /* CONFIG_PPC64 */ 568#endif /* CONFIG_PPC64 */
563} 569}
564#endif /* CONFIG_SMP */ 570#endif /* CONFIG_SMP */
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index 55f485f78c00..f73d7681b2e9 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -72,8 +72,6 @@ unsigned int DMA_MODE_WRITE;
72int have_of = 1; 72int have_of = 1;
73 73
74#ifdef CONFIG_PPC_MULTIPLATFORM 74#ifdef CONFIG_PPC_MULTIPLATFORM
75int _machine = 0;
76
77extern void prep_init(void); 75extern void prep_init(void);
78extern void pmac_init(void); 76extern void pmac_init(void);
79extern void chrp_init(void); 77extern void chrp_init(void);
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index fe39aac4f24d..be607b877a55 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -100,10 +100,9 @@ extern void udbg_init_maple_realmode(void);
100extern unsigned long klimit; 100extern unsigned long klimit;
101 101
102extern void mm_init_ppc64(void); 102extern void mm_init_ppc64(void);
103extern void stab_initialize(unsigned long stab);
104extern void htab_initialize(void);
105extern void early_init_devtree(void *flat_dt); 103extern void early_init_devtree(void *flat_dt);
106extern void unflatten_device_tree(void); 104extern void unflatten_device_tree(void);
105extern void check_for_initrd(void);
107 106
108int have_of = 1; 107int have_of = 1;
109int boot_cpuid = 0; 108int boot_cpuid = 0;
@@ -256,11 +255,10 @@ void __init early_setup(unsigned long dt_ptr)
256 * Iterate all ppc_md structures until we find the proper 255 * Iterate all ppc_md structures until we find the proper
257 * one for the current machine type 256 * one for the current machine type
258 */ 257 */
259 DBG("Probing machine type for platform %x...\n", 258 DBG("Probing machine type for platform %x...\n", _machine);
260 systemcfg->platform);
261 259
262 for (mach = machines; *mach; mach++) { 260 for (mach = machines; *mach; mach++) {
263 if ((*mach)->probe(systemcfg->platform)) 261 if ((*mach)->probe(_machine))
264 break; 262 break;
265 } 263 }
266 /* What can we do if we didn't find ? */ 264 /* What can we do if we didn't find ? */
@@ -292,6 +290,28 @@ void __init early_setup(unsigned long dt_ptr)
292 DBG(" <- early_setup()\n"); 290 DBG(" <- early_setup()\n");
293} 291}
294 292
293#ifdef CONFIG_SMP
294void early_setup_secondary(void)
295{
296 struct paca_struct *lpaca = get_paca();
297
298 /* Mark enabled in PACA */
299 lpaca->proc_enabled = 0;
300
301 /* Initialize hash table for that CPU */
302 htab_initialize_secondary();
303
304 /* Initialize STAB/SLB. We use a virtual address as it works
305 * in real mode on pSeries and we want a virutal address on
306 * iSeries anyway
307 */
308 if (cpu_has_feature(CPU_FTR_SLB))
309 slb_initialize();
310 else
311 stab_initialize(lpaca->stab_addr);
312}
313
314#endif /* CONFIG_SMP */
295 315
296#if defined(CONFIG_SMP) || defined(CONFIG_KEXEC) 316#if defined(CONFIG_SMP) || defined(CONFIG_KEXEC)
297void smp_release_cpus(void) 317void smp_release_cpus(void)
@@ -317,7 +337,8 @@ void smp_release_cpus(void)
317#endif /* CONFIG_SMP || CONFIG_KEXEC */ 337#endif /* CONFIG_SMP || CONFIG_KEXEC */
318 338
319/* 339/*
320 * Initialize some remaining members of the ppc64_caches and systemcfg structures 340 * Initialize some remaining members of the ppc64_caches and systemcfg
341 * structures
321 * (at least until we get rid of them completely). This is mostly some 342 * (at least until we get rid of them completely). This is mostly some
322 * cache informations about the CPU that will be used by cache flush 343 * cache informations about the CPU that will be used by cache flush
323 * routines and/or provided to userland 344 * routines and/or provided to userland
@@ -342,7 +363,7 @@ static void __init initialize_cache_info(void)
342 const char *dc, *ic; 363 const char *dc, *ic;
343 364
344 /* Then read cache informations */ 365 /* Then read cache informations */
345 if (systemcfg->platform == PLATFORM_POWERMAC) { 366 if (_machine == PLATFORM_POWERMAC) {
346 dc = "d-cache-block-size"; 367 dc = "d-cache-block-size";
347 ic = "i-cache-block-size"; 368 ic = "i-cache-block-size";
348 } else { 369 } else {
@@ -362,8 +383,8 @@ static void __init initialize_cache_info(void)
362 DBG("Argh, can't find dcache properties ! " 383 DBG("Argh, can't find dcache properties ! "
363 "sizep: %p, lsizep: %p\n", sizep, lsizep); 384 "sizep: %p, lsizep: %p\n", sizep, lsizep);
364 385
365 systemcfg->dcache_size = ppc64_caches.dsize = size; 386 _systemcfg->dcache_size = ppc64_caches.dsize = size;
366 systemcfg->dcache_line_size = 387 _systemcfg->dcache_line_size =
367 ppc64_caches.dline_size = lsize; 388 ppc64_caches.dline_size = lsize;
368 ppc64_caches.log_dline_size = __ilog2(lsize); 389 ppc64_caches.log_dline_size = __ilog2(lsize);
369 ppc64_caches.dlines_per_page = PAGE_SIZE / lsize; 390 ppc64_caches.dlines_per_page = PAGE_SIZE / lsize;
@@ -380,8 +401,8 @@ static void __init initialize_cache_info(void)
380 DBG("Argh, can't find icache properties ! " 401 DBG("Argh, can't find icache properties ! "
381 "sizep: %p, lsizep: %p\n", sizep, lsizep); 402 "sizep: %p, lsizep: %p\n", sizep, lsizep);
382 403
383 systemcfg->icache_size = ppc64_caches.isize = size; 404 _systemcfg->icache_size = ppc64_caches.isize = size;
384 systemcfg->icache_line_size = 405 _systemcfg->icache_line_size =
385 ppc64_caches.iline_size = lsize; 406 ppc64_caches.iline_size = lsize;
386 ppc64_caches.log_iline_size = __ilog2(lsize); 407 ppc64_caches.log_iline_size = __ilog2(lsize);
387 ppc64_caches.ilines_per_page = PAGE_SIZE / lsize; 408 ppc64_caches.ilines_per_page = PAGE_SIZE / lsize;
@@ -389,10 +410,12 @@ static void __init initialize_cache_info(void)
389 } 410 }
390 411
391 /* Add an eye catcher and the systemcfg layout version number */ 412 /* Add an eye catcher and the systemcfg layout version number */
392 strcpy(systemcfg->eye_catcher, "SYSTEMCFG:PPC64"); 413 strcpy(_systemcfg->eye_catcher, "SYSTEMCFG:PPC64");
393 systemcfg->version.major = SYSTEMCFG_MAJOR; 414 _systemcfg->version.major = SYSTEMCFG_MAJOR;
394 systemcfg->version.minor = SYSTEMCFG_MINOR; 415 _systemcfg->version.minor = SYSTEMCFG_MINOR;
395 systemcfg->processor = mfspr(SPRN_PVR); 416 _systemcfg->processor = mfspr(SPRN_PVR);
417 _systemcfg->platform = _machine;
418 _systemcfg->physicalMemorySize = lmb_phys_mem_size();
396 419
397 DBG(" <- initialize_cache_info()\n"); 420 DBG(" <- initialize_cache_info()\n");
398} 421}
@@ -481,10 +504,10 @@ void __init setup_system(void)
481 printk("-----------------------------------------------------\n"); 504 printk("-----------------------------------------------------\n");
482 printk("ppc64_pft_size = 0x%lx\n", ppc64_pft_size); 505 printk("ppc64_pft_size = 0x%lx\n", ppc64_pft_size);
483 printk("ppc64_interrupt_controller = 0x%ld\n", ppc64_interrupt_controller); 506 printk("ppc64_interrupt_controller = 0x%ld\n", ppc64_interrupt_controller);
484 printk("systemcfg = 0x%p\n", systemcfg); 507 printk("systemcfg = 0x%p\n", _systemcfg);
485 printk("systemcfg->platform = 0x%x\n", systemcfg->platform); 508 printk("systemcfg->platform = 0x%x\n", _systemcfg->platform);
486 printk("systemcfg->processorCount = 0x%lx\n", systemcfg->processorCount); 509 printk("systemcfg->processorCount = 0x%lx\n", _systemcfg->processorCount);
487 printk("systemcfg->physicalMemorySize = 0x%lx\n", systemcfg->physicalMemorySize); 510 printk("systemcfg->physicalMemorySize = 0x%lx\n", _systemcfg->physicalMemorySize);
488 printk("ppc64_caches.dcache_line_size = 0x%x\n", 511 printk("ppc64_caches.dcache_line_size = 0x%x\n",
489 ppc64_caches.dline_size); 512 ppc64_caches.dline_size);
490 printk("ppc64_caches.icache_line_size = 0x%x\n", 513 printk("ppc64_caches.icache_line_size = 0x%x\n",
@@ -566,12 +589,12 @@ void __init setup_syscall_map(void)
566 for (i = 0; i < __NR_syscalls; i++) { 589 for (i = 0; i < __NR_syscalls; i++) {
567 if (sys_call_table[i*2] != sys_ni_syscall) { 590 if (sys_call_table[i*2] != sys_ni_syscall) {
568 count64++; 591 count64++;
569 systemcfg->syscall_map_64[i >> 5] |= 592 _systemcfg->syscall_map_64[i >> 5] |=
570 0x80000000UL >> (i & 0x1f); 593 0x80000000UL >> (i & 0x1f);
571 } 594 }
572 if (sys_call_table[i*2+1] != sys_ni_syscall) { 595 if (sys_call_table[i*2+1] != sys_ni_syscall) {
573 count32++; 596 count32++;
574 systemcfg->syscall_map_32[i >> 5] |= 597 _systemcfg->syscall_map_32[i >> 5] |=
575 0x80000000UL >> (i & 0x1f); 598 0x80000000UL >> (i & 0x1f);
576 } 599 }
577 } 600 }
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 5c330c3366e4..7fd530898bd1 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -44,6 +44,7 @@
44#include <asm/cputable.h> 44#include <asm/cputable.h>
45#include <asm/system.h> 45#include <asm/system.h>
46#include <asm/mpic.h> 46#include <asm/mpic.h>
47#include <asm/systemcfg.h>
47#ifdef CONFIG_PPC64 48#ifdef CONFIG_PPC64
48#include <asm/paca.h> 49#include <asm/paca.h>
49#endif 50#endif
@@ -368,7 +369,9 @@ int generic_cpu_disable(void)
368 if (cpu == boot_cpuid) 369 if (cpu == boot_cpuid)
369 return -EBUSY; 370 return -EBUSY;
370 371
371 systemcfg->processorCount--; 372#ifdef CONFIG_PPC64
373 _systemcfg->processorCount--;
374#endif
372 cpu_clear(cpu, cpu_online_map); 375 cpu_clear(cpu, cpu_online_map);
373 fixup_irqs(cpu_online_map); 376 fixup_irqs(cpu_online_map);
374 return 0; 377 return 0;
diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/sys_ppc32.c
index a8210ed5c686..9c921d1c4084 100644
--- a/arch/powerpc/kernel/sys_ppc32.c
+++ b/arch/powerpc/kernel/sys_ppc32.c
@@ -52,7 +52,6 @@
52#include <asm/semaphore.h> 52#include <asm/semaphore.h>
53#include <asm/time.h> 53#include <asm/time.h>
54#include <asm/mmu_context.h> 54#include <asm/mmu_context.h>
55#include <asm/systemcfg.h>
56#include <asm/ppc-pci.h> 55#include <asm/ppc-pci.h>
57 56
58/* readdir & getdents */ 57/* readdir & getdents */
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index a6282b625b44..386006b3d616 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -271,13 +271,13 @@ static inline void update_gtod(u64 new_tb_stamp, u64 new_stamp_xsec,
271 * tb_to_xs and stamp_xsec values are consistent. If not, then it 271 * tb_to_xs and stamp_xsec values are consistent. If not, then it
272 * loops back and reads them again until this criteria is met. 272 * loops back and reads them again until this criteria is met.
273 */ 273 */
274 ++(systemcfg->tb_update_count); 274 ++(_systemcfg->tb_update_count);
275 smp_wmb(); 275 smp_wmb();
276 systemcfg->tb_orig_stamp = new_tb_stamp; 276 _systemcfg->tb_orig_stamp = new_tb_stamp;
277 systemcfg->stamp_xsec = new_stamp_xsec; 277 _systemcfg->stamp_xsec = new_stamp_xsec;
278 systemcfg->tb_to_xs = new_tb_to_xs; 278 _systemcfg->tb_to_xs = new_tb_to_xs;
279 smp_wmb(); 279 smp_wmb();
280 ++(systemcfg->tb_update_count); 280 ++(_systemcfg->tb_update_count);
281#endif 281#endif
282} 282}
283 283
@@ -357,8 +357,9 @@ static void iSeries_tb_recal(void)
357 do_gtod.tb_ticks_per_sec = tb_ticks_per_sec; 357 do_gtod.tb_ticks_per_sec = tb_ticks_per_sec;
358 tb_to_xs = divres.result_low; 358 tb_to_xs = divres.result_low;
359 do_gtod.varp->tb_to_xs = tb_to_xs; 359 do_gtod.varp->tb_to_xs = tb_to_xs;
360 systemcfg->tb_ticks_per_sec = tb_ticks_per_sec; 360 _systemcfg->tb_ticks_per_sec =
361 systemcfg->tb_to_xs = tb_to_xs; 361 tb_ticks_per_sec;
362 _systemcfg->tb_to_xs = tb_to_xs;
362 } 363 }
363 else { 364 else {
364 printk( "Titan recalibrate: FAILED (difference > 4 percent)\n" 365 printk( "Titan recalibrate: FAILED (difference > 4 percent)\n"
@@ -559,8 +560,8 @@ int do_settimeofday(struct timespec *tv)
559 update_gtod(tb_last_jiffy, new_xsec, do_gtod.varp->tb_to_xs); 560 update_gtod(tb_last_jiffy, new_xsec, do_gtod.varp->tb_to_xs);
560 561
561#ifdef CONFIG_PPC64 562#ifdef CONFIG_PPC64
562 systemcfg->tz_minuteswest = sys_tz.tz_minuteswest; 563 _systemcfg->tz_minuteswest = sys_tz.tz_minuteswest;
563 systemcfg->tz_dsttime = sys_tz.tz_dsttime; 564 _systemcfg->tz_dsttime = sys_tz.tz_dsttime;
564#endif 565#endif
565 566
566 write_sequnlock_irqrestore(&xtime_lock, flags); 567 write_sequnlock_irqrestore(&xtime_lock, flags);
@@ -711,11 +712,11 @@ void __init time_init(void)
711 do_gtod.varp->tb_to_xs = tb_to_xs; 712 do_gtod.varp->tb_to_xs = tb_to_xs;
712 do_gtod.tb_to_us = tb_to_us; 713 do_gtod.tb_to_us = tb_to_us;
713#ifdef CONFIG_PPC64 714#ifdef CONFIG_PPC64
714 systemcfg->tb_orig_stamp = tb_last_jiffy; 715 _systemcfg->tb_orig_stamp = tb_last_jiffy;
715 systemcfg->tb_update_count = 0; 716 _systemcfg->tb_update_count = 0;
716 systemcfg->tb_ticks_per_sec = tb_ticks_per_sec; 717 _systemcfg->tb_ticks_per_sec = tb_ticks_per_sec;
717 systemcfg->stamp_xsec = xtime.tv_sec * XSEC_PER_SEC; 718 _systemcfg->stamp_xsec = xtime.tv_sec * XSEC_PER_SEC;
718 systemcfg->tb_to_xs = tb_to_xs; 719 _systemcfg->tb_to_xs = tb_to_xs;
719#endif 720#endif
720 721
721 time_freq = 0; 722 time_freq = 0;
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 0578f8387603..2020bb7648fb 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -129,7 +129,7 @@ int die(const char *str, struct pt_regs *regs, long err)
129 nl = 1; 129 nl = 1;
130#endif 130#endif
131#ifdef CONFIG_PPC64 131#ifdef CONFIG_PPC64
132 switch (systemcfg->platform) { 132 switch (_machine) {
133 case PLATFORM_PSERIES: 133 case PLATFORM_PSERIES:
134 printk("PSERIES "); 134 printk("PSERIES ");
135 nl = 1; 135 nl = 1;
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index c8c9c2df97e9..706e8a63ced9 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -84,10 +84,11 @@
84extern unsigned long dart_tablebase; 84extern unsigned long dart_tablebase;
85#endif /* CONFIG_U3_DART */ 85#endif /* CONFIG_U3_DART */
86 86
87static unsigned long _SDR1;
88struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT];
89
87hpte_t *htab_address; 90hpte_t *htab_address;
88unsigned long htab_hash_mask; 91unsigned long htab_hash_mask;
89unsigned long _SDR1;
90struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT];
91int mmu_linear_psize = MMU_PAGE_4K; 92int mmu_linear_psize = MMU_PAGE_4K;
92int mmu_virtual_psize = MMU_PAGE_4K; 93int mmu_virtual_psize = MMU_PAGE_4K;
93#ifdef CONFIG_HUGETLB_PAGE 94#ifdef CONFIG_HUGETLB_PAGE
@@ -165,7 +166,7 @@ int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
165 * normal insert callback here. 166 * normal insert callback here.
166 */ 167 */
167#ifdef CONFIG_PPC_ISERIES 168#ifdef CONFIG_PPC_ISERIES
168 if (systemcfg->platform == PLATFORM_ISERIES_LPAR) 169 if (_machine == PLATFORM_ISERIES_LPAR)
169 ret = iSeries_hpte_insert(hpteg, va, 170 ret = iSeries_hpte_insert(hpteg, va,
170 virt_to_abs(paddr), 171 virt_to_abs(paddr),
171 tmp_mode, 172 tmp_mode,
@@ -174,7 +175,7 @@ int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
174 else 175 else
175#endif 176#endif
176#ifdef CONFIG_PPC_PSERIES 177#ifdef CONFIG_PPC_PSERIES
177 if (systemcfg->platform & PLATFORM_LPAR) 178 if (_machine & PLATFORM_LPAR)
178 ret = pSeries_lpar_hpte_insert(hpteg, va, 179 ret = pSeries_lpar_hpte_insert(hpteg, va,
179 virt_to_abs(paddr), 180 virt_to_abs(paddr),
180 tmp_mode, 181 tmp_mode,
@@ -293,7 +294,7 @@ static void __init htab_init_page_sizes(void)
293 * Not in the device-tree, let's fallback on known size 294 * Not in the device-tree, let's fallback on known size
294 * list for 16M capable GP & GR 295 * list for 16M capable GP & GR
295 */ 296 */
296 if ((systemcfg->platform != PLATFORM_ISERIES_LPAR) && 297 if ((_machine != PLATFORM_ISERIES_LPAR) &&
297 cpu_has_feature(CPU_FTR_16M_PAGE)) 298 cpu_has_feature(CPU_FTR_16M_PAGE))
298 memcpy(mmu_psize_defs, mmu_psize_defaults_gp, 299 memcpy(mmu_psize_defs, mmu_psize_defaults_gp,
299 sizeof(mmu_psize_defaults_gp)); 300 sizeof(mmu_psize_defaults_gp));
@@ -364,7 +365,7 @@ static int __init htab_dt_scan_pftsize(unsigned long node,
364 365
365static unsigned long __init htab_get_table_size(void) 366static unsigned long __init htab_get_table_size(void)
366{ 367{
367 unsigned long rnd_mem_size, pteg_count; 368 unsigned long mem_size, rnd_mem_size, pteg_count;
368 369
369 /* If hash size isn't already provided by the platform, we try to 370 /* If hash size isn't already provided by the platform, we try to
370 * retreive it from the device-tree. If it's not there neither, we 371 * retreive it from the device-tree. If it's not there neither, we
@@ -376,8 +377,9 @@ static unsigned long __init htab_get_table_size(void)
376 return 1UL << ppc64_pft_size; 377 return 1UL << ppc64_pft_size;
377 378
378 /* round mem_size up to next power of 2 */ 379 /* round mem_size up to next power of 2 */
379 rnd_mem_size = 1UL << __ilog2(systemcfg->physicalMemorySize); 380 mem_size = lmb_phys_mem_size();
380 if (rnd_mem_size < systemcfg->physicalMemorySize) 381 rnd_mem_size = 1UL << __ilog2(mem_size);
382 if (rnd_mem_size < mem_size)
381 rnd_mem_size <<= 1; 383 rnd_mem_size <<= 1;
382 384
383 /* # pages / 2 */ 385 /* # pages / 2 */
@@ -419,7 +421,7 @@ void __init htab_initialize(void)
419 421
420 htab_hash_mask = pteg_count - 1; 422 htab_hash_mask = pteg_count - 1;
421 423
422 if (systemcfg->platform & PLATFORM_LPAR) { 424 if (platform_is_lpar()) {
423 /* Using a hypervisor which owns the htab */ 425 /* Using a hypervisor which owns the htab */
424 htab_address = NULL; 426 htab_address = NULL;
425 _SDR1 = 0; 427 _SDR1 = 0;
@@ -440,6 +442,9 @@ void __init htab_initialize(void)
440 442
441 /* Initialize the HPT with no entries */ 443 /* Initialize the HPT with no entries */
442 memset((void *)table, 0, htab_size_bytes); 444 memset((void *)table, 0, htab_size_bytes);
445
446 /* Set SDR1 */
447 mtspr(SPRN_SDR1, _SDR1);
443 } 448 }
444 449
445 mode_rw = _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_COHERENT | PP_RWXX; 450 mode_rw = _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_COHERENT | PP_RWXX;
@@ -509,6 +514,12 @@ void __init htab_initialize(void)
509#undef KB 514#undef KB
510#undef MB 515#undef MB
511 516
517void __init htab_initialize_secondary(void)
518{
519 if (!platform_is_lpar())
520 mtspr(SPRN_SDR1, _SDR1);
521}
522
512/* 523/*
513 * Called by asm hashtable.S for doing lazy icache flush 524 * Called by asm hashtable.S for doing lazy icache flush
514 */ 525 */
diff --git a/arch/powerpc/mm/stab.c b/arch/powerpc/mm/stab.c
index fa325dbf98fc..cfbb4e1f966b 100644
--- a/arch/powerpc/mm/stab.c
+++ b/arch/powerpc/mm/stab.c
@@ -20,6 +20,7 @@
20#include <asm/cputable.h> 20#include <asm/cputable.h>
21#include <asm/lmb.h> 21#include <asm/lmb.h>
22#include <asm/abs_addr.h> 22#include <asm/abs_addr.h>
23#include <asm/firmware.h>
23 24
24struct stab_entry { 25struct stab_entry {
25 unsigned long esid_data; 26 unsigned long esid_data;
@@ -256,7 +257,7 @@ void stabs_alloc(void)
256 257
257 paca[cpu].stab_addr = newstab; 258 paca[cpu].stab_addr = newstab;
258 paca[cpu].stab_real = virt_to_abs(newstab); 259 paca[cpu].stab_real = virt_to_abs(newstab);
259 printk(KERN_DEBUG "Segment table for CPU %d at 0x%lx " 260 printk(KERN_INFO "Segment table for CPU %d at 0x%lx "
260 "virtual, 0x%lx absolute\n", 261 "virtual, 0x%lx absolute\n",
261 cpu, paca[cpu].stab_addr, paca[cpu].stab_real); 262 cpu, paca[cpu].stab_addr, paca[cpu].stab_real);
262 } 263 }
@@ -270,10 +271,28 @@ void stabs_alloc(void)
270void stab_initialize(unsigned long stab) 271void stab_initialize(unsigned long stab)
271{ 272{
272 unsigned long vsid = get_kernel_vsid(KERNELBASE); 273 unsigned long vsid = get_kernel_vsid(KERNELBASE);
274 unsigned long stabreal;
273 275
274 asm volatile("isync; slbia; isync":::"memory"); 276 asm volatile("isync; slbia; isync":::"memory");
275 make_ste(stab, GET_ESID(KERNELBASE), vsid); 277 make_ste(stab, GET_ESID(KERNELBASE), vsid);
276 278
277 /* Order update */ 279 /* Order update */
278 asm volatile("sync":::"memory"); 280 asm volatile("sync":::"memory");
281
282 /* Set ASR */
283 stabreal = get_paca()->stab_real | 0x1ul;
284
285#ifdef CONFIG_PPC_ISERIES
286 if (firmware_has_feature(FW_FEATURE_ISERIES)) {
287 HvCall1(HvCallBaseSetASR, stabreal);
288 return;
289 }
290#endif /* CONFIG_PPC_ISERIES */
291#ifdef CONFIG_PPC_PSERIES
292 if (platform_is_lpar()) {
293 plpar_hcall_norets(H_SET_ASR, stabreal);
294 return;
295 }
296#endif
297 mtspr(SPRN_ASR, stabreal);
279} 298}
diff --git a/arch/powerpc/oprofile/op_model_power4.c b/arch/powerpc/oprofile/op_model_power4.c
index c4ee5478427b..e3a024e324b6 100644
--- a/arch/powerpc/oprofile/op_model_power4.c
+++ b/arch/powerpc/oprofile/op_model_power4.c
@@ -233,8 +233,7 @@ static unsigned long get_pc(struct pt_regs *regs)
233 mmcra = mfspr(SPRN_MMCRA); 233 mmcra = mfspr(SPRN_MMCRA);
234 234
235 /* Were we in the hypervisor? */ 235 /* Were we in the hypervisor? */
236 if ((systemcfg->platform == PLATFORM_PSERIES_LPAR) && 236 if (platform_is_lpar() && (mmcra & MMCRA_SIHV))
237 (mmcra & MMCRA_SIHV))
238 /* function descriptor madness */ 237 /* function descriptor madness */
239 return *((unsigned long *)hypervisor_bucket); 238 return *((unsigned long *)hypervisor_bucket);
240 239
diff --git a/arch/powerpc/platforms/iseries/setup.c b/arch/powerpc/platforms/iseries/setup.c
index 7f8f0cda6a74..623c39aa0436 100644
--- a/arch/powerpc/platforms/iseries/setup.c
+++ b/arch/powerpc/platforms/iseries/setup.c
@@ -39,6 +39,7 @@
39#include <asm/sections.h> 39#include <asm/sections.h>
40#include <asm/iommu.h> 40#include <asm/iommu.h>
41#include <asm/firmware.h> 41#include <asm/firmware.h>
42#include <asm/systemcfg.h>
42 43
43#include <asm/time.h> 44#include <asm/time.h>
44#include <asm/paca.h> 45#include <asm/paca.h>
@@ -71,7 +72,7 @@ extern void hvlog(char *fmt, ...);
71#endif 72#endif
72 73
73/* Function Prototypes */ 74/* Function Prototypes */
74static void build_iSeries_Memory_Map(void); 75static unsigned long build_iSeries_Memory_Map(void);
75static void iseries_shared_idle(void); 76static void iseries_shared_idle(void);
76static void iseries_dedicated_idle(void); 77static void iseries_dedicated_idle(void);
77#ifdef CONFIG_PCI 78#ifdef CONFIG_PCI
@@ -403,9 +404,11 @@ void mschunks_alloc(unsigned long num_chunks)
403 * a table used to translate Linux's physical addresses to these 404 * a table used to translate Linux's physical addresses to these
404 * absolute addresses. Absolute addresses are needed when 405 * absolute addresses. Absolute addresses are needed when
405 * communicating with the hypervisor (e.g. to build HPT entries) 406 * communicating with the hypervisor (e.g. to build HPT entries)
407 *
408 * Returns the physical memory size
406 */ 409 */
407 410
408static void __init build_iSeries_Memory_Map(void) 411static unsigned long __init build_iSeries_Memory_Map(void)
409{ 412{
410 u32 loadAreaFirstChunk, loadAreaLastChunk, loadAreaSize; 413 u32 loadAreaFirstChunk, loadAreaLastChunk, loadAreaSize;
411 u32 nextPhysChunk; 414 u32 nextPhysChunk;
@@ -538,7 +541,7 @@ static void __init build_iSeries_Memory_Map(void)
538 * which should be equal to 541 * which should be equal to
539 * nextPhysChunk 542 * nextPhysChunk
540 */ 543 */
541 systemcfg->physicalMemorySize = chunk_to_addr(nextPhysChunk); 544 return chunk_to_addr(nextPhysChunk);
542} 545}
543 546
544/* 547/*
@@ -564,8 +567,8 @@ static void __init iSeries_setup_arch(void)
564 printk("Max physical processors = %d\n", 567 printk("Max physical processors = %d\n",
565 itVpdAreas.xSlicMaxPhysicalProcs); 568 itVpdAreas.xSlicMaxPhysicalProcs);
566 569
567 systemcfg->processor = xIoHriProcessorVpd[procIx].xPVR; 570 _systemcfg->processor = xIoHriProcessorVpd[procIx].xPVR;
568 printk("Processor version = %x\n", systemcfg->processor); 571 printk("Processor version = %x\n", _systemcfg->processor);
569} 572}
570 573
571static void iSeries_show_cpuinfo(struct seq_file *m) 574static void iSeries_show_cpuinfo(struct seq_file *m)
@@ -929,7 +932,7 @@ void dt_cpus(struct iseries_flat_dt *dt)
929 dt_end_node(dt); 932 dt_end_node(dt);
930} 933}
931 934
932void build_flat_dt(struct iseries_flat_dt *dt) 935void build_flat_dt(struct iseries_flat_dt *dt, unsigned long phys_mem_size)
933{ 936{
934 u64 tmp[2]; 937 u64 tmp[2];
935 938
@@ -945,7 +948,7 @@ void build_flat_dt(struct iseries_flat_dt *dt)
945 dt_prop_str(dt, "name", "memory"); 948 dt_prop_str(dt, "name", "memory");
946 dt_prop_str(dt, "device_type", "memory"); 949 dt_prop_str(dt, "device_type", "memory");
947 tmp[0] = 0; 950 tmp[0] = 0;
948 tmp[1] = systemcfg->physicalMemorySize; 951 tmp[1] = phys_mem_size;
949 dt_prop_u64_list(dt, "reg", tmp, 2); 952 dt_prop_u64_list(dt, "reg", tmp, 2);
950 dt_end_node(dt); 953 dt_end_node(dt);
951 954
@@ -965,13 +968,15 @@ void build_flat_dt(struct iseries_flat_dt *dt)
965 968
966void * __init iSeries_early_setup(void) 969void * __init iSeries_early_setup(void)
967{ 970{
971 unsigned long phys_mem_size;
972
968 iSeries_fixup_klimit(); 973 iSeries_fixup_klimit();
969 974
970 /* 975 /*
971 * Initialize the table which translate Linux physical addresses to 976 * Initialize the table which translate Linux physical addresses to
972 * AS/400 absolute addresses 977 * AS/400 absolute addresses
973 */ 978 */
974 build_iSeries_Memory_Map(); 979 phys_mem_size = build_iSeries_Memory_Map();
975 980
976 iSeries_get_cmdline(); 981 iSeries_get_cmdline();
977 982
@@ -981,7 +986,7 @@ void * __init iSeries_early_setup(void)
981 /* Parse early parameters, in particular mem=x */ 986 /* Parse early parameters, in particular mem=x */
982 parse_early_param(); 987 parse_early_param();
983 988
984 build_flat_dt(&iseries_dt); 989 build_flat_dt(&iseries_dt, phys_mem_size);
985 990
986 return (void *) __pa(&iseries_dt); 991 return (void *) __pa(&iseries_dt);
987} 992}
diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/platforms/pseries/eeh.c
index b760836bb9d1..a33ba833109c 100644
--- a/arch/powerpc/platforms/pseries/eeh.c
+++ b/arch/powerpc/platforms/pseries/eeh.c
@@ -32,7 +32,6 @@
32#include <asm/machdep.h> 32#include <asm/machdep.h>
33#include <asm/ppc-pci.h> 33#include <asm/ppc-pci.h>
34#include <asm/rtas.h> 34#include <asm/rtas.h>
35#include <asm/systemcfg.h>
36 35
37#undef DEBUG 36#undef DEBUG
38 37
@@ -1186,7 +1185,7 @@ static int __init eeh_init_proc(void)
1186{ 1185{
1187 struct proc_dir_entry *e; 1186 struct proc_dir_entry *e;
1188 1187
1189 if (systemcfg->platform & PLATFORM_PSERIES) { 1188 if (platform_is_pseries()) {
1190 e = create_proc_entry("ppc64/eeh", 0, NULL); 1189 e = create_proc_entry("ppc64/eeh", 0, NULL);
1191 if (e) 1190 if (e)
1192 e->proc_fops = &proc_eeh_operations; 1191 e->proc_fops = &proc_eeh_operations;
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index fcc50bfd43fd..97ba5214417f 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -42,7 +42,6 @@
42#include <asm/machdep.h> 42#include <asm/machdep.h>
43#include <asm/abs_addr.h> 43#include <asm/abs_addr.h>
44#include <asm/pSeries_reconfig.h> 44#include <asm/pSeries_reconfig.h>
45#include <asm/systemcfg.h>
46#include <asm/firmware.h> 45#include <asm/firmware.h>
47#include <asm/tce.h> 46#include <asm/tce.h>
48#include <asm/ppc-pci.h> 47#include <asm/ppc-pci.h>
@@ -582,7 +581,7 @@ void iommu_init_early_pSeries(void)
582 return; 581 return;
583 } 582 }
584 583
585 if (systemcfg->platform & PLATFORM_LPAR) { 584 if (platform_is_lpar()) {
586 if (firmware_has_feature(FW_FEATURE_MULTITCE)) { 585 if (firmware_has_feature(FW_FEATURE_MULTITCE)) {
587 ppc_md.tce_build = tce_buildmulti_pSeriesLP; 586 ppc_md.tce_build = tce_buildmulti_pSeriesLP;
588 ppc_md.tce_free = tce_freemulti_pSeriesLP; 587 ppc_md.tce_free = tce_freemulti_pSeriesLP;
diff --git a/arch/powerpc/platforms/pseries/pci.c b/arch/powerpc/platforms/pseries/pci.c
index c198656a3bb5..6b0772f35692 100644
--- a/arch/powerpc/platforms/pseries/pci.c
+++ b/arch/powerpc/platforms/pseries/pci.c
@@ -123,7 +123,7 @@ static void fixup_winbond_82c105(struct pci_dev* dev)
123 int i; 123 int i;
124 unsigned int reg; 124 unsigned int reg;
125 125
126 if (!(systemcfg->platform & PLATFORM_PSERIES)) 126 if (!platform_is_pseries())
127 return; 127 return;
128 128
129 printk("Using INTC for W82c105 IDE controller.\n"); 129 printk("Using INTC for W82c105 IDE controller.\n");
diff --git a/arch/powerpc/platforms/pseries/reconfig.c b/arch/powerpc/platforms/pseries/reconfig.c
index d7d400339458..d8864164dbe8 100644
--- a/arch/powerpc/platforms/pseries/reconfig.c
+++ b/arch/powerpc/platforms/pseries/reconfig.c
@@ -408,7 +408,7 @@ static int proc_ppc64_create_ofdt(void)
408{ 408{
409 struct proc_dir_entry *ent; 409 struct proc_dir_entry *ent;
410 410
411 if (!(systemcfg->platform & PLATFORM_PSERIES)) 411 if (!platform_is_pseries())
412 return 0; 412 return 0;
413 413
414 ent = create_proc_entry("ppc64/ofdt", S_IWUSR, NULL); 414 ent = create_proc_entry("ppc64/ofdt", S_IWUSR, NULL);
diff --git a/arch/powerpc/platforms/pseries/rtasd.c b/arch/powerpc/platforms/pseries/rtasd.c
index e26b0420b6dd..00cf331a1dc4 100644
--- a/arch/powerpc/platforms/pseries/rtasd.c
+++ b/arch/powerpc/platforms/pseries/rtasd.c
@@ -482,10 +482,12 @@ static int __init rtas_init(void)
482{ 482{
483 struct proc_dir_entry *entry; 483 struct proc_dir_entry *entry;
484 484
485 /* No RTAS, only warn if we are on a pSeries box */ 485 if (!platform_is_pseries())
486 return 0;
487
488 /* No RTAS */
486 if (rtas_token("event-scan") == RTAS_UNKNOWN_SERVICE) { 489 if (rtas_token("event-scan") == RTAS_UNKNOWN_SERVICE) {
487 if (systemcfg->platform & PLATFORM_PSERIES) 490 printk(KERN_INFO "rtasd: no event-scan on system\n");
488 printk(KERN_INFO "rtasd: no event-scan on system\n");
489 return 1; 491 return 1;
490 } 492 }
491 493
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index a093a0d4dd69..e94247c28d42 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -249,7 +249,7 @@ static void __init pSeries_setup_arch(void)
249 ppc_md.idle_loop = default_idle; 249 ppc_md.idle_loop = default_idle;
250 } 250 }
251 251
252 if (systemcfg->platform & PLATFORM_LPAR) 252 if (platform_is_lpar())
253 ppc_md.enable_pmcs = pseries_lpar_enable_pmcs; 253 ppc_md.enable_pmcs = pseries_lpar_enable_pmcs;
254 else 254 else
255 ppc_md.enable_pmcs = power4_enable_pmcs; 255 ppc_md.enable_pmcs = power4_enable_pmcs;
@@ -378,7 +378,7 @@ static void __init pSeries_init_early(void)
378 378
379 fw_feature_init(); 379 fw_feature_init();
380 380
381 if (systemcfg->platform & PLATFORM_LPAR) 381 if (platform_is_lpar())
382 hpte_init_lpar(); 382 hpte_init_lpar();
383 else { 383 else {
384 hpte_init_native(); 384 hpte_init_native();
@@ -388,7 +388,7 @@ static void __init pSeries_init_early(void)
388 388
389 generic_find_legacy_serial_ports(&physport, &default_speed); 389 generic_find_legacy_serial_ports(&physport, &default_speed);
390 390
391 if (systemcfg->platform & PLATFORM_LPAR) 391 if (platform_is_lpar())
392 find_udbg_vterm(); 392 find_udbg_vterm();
393 else if (physport) { 393 else if (physport) {
394 /* Map the uart for udbg. */ 394 /* Map the uart for udbg. */
@@ -592,7 +592,7 @@ static void pseries_shared_idle(void)
592 592
593static int pSeries_pci_probe_mode(struct pci_bus *bus) 593static int pSeries_pci_probe_mode(struct pci_bus *bus)
594{ 594{
595 if (systemcfg->platform & PLATFORM_LPAR) 595 if (platform_is_lpar())
596 return PCI_PROBE_DEVTREE; 596 return PCI_PROBE_DEVTREE;
597 return PCI_PROBE_NORMAL; 597 return PCI_PROBE_NORMAL;
598} 598}
diff --git a/arch/powerpc/platforms/pseries/smp.c b/arch/powerpc/platforms/pseries/smp.c
index 7a243e8ccd7e..3ba794ca3288 100644
--- a/arch/powerpc/platforms/pseries/smp.c
+++ b/arch/powerpc/platforms/pseries/smp.c
@@ -46,6 +46,7 @@
46#include <asm/rtas.h> 46#include <asm/rtas.h>
47#include <asm/pSeries_reconfig.h> 47#include <asm/pSeries_reconfig.h>
48#include <asm/mpic.h> 48#include <asm/mpic.h>
49#include <asm/systemcfg.h>
49 50
50#include "plpar_wrappers.h" 51#include "plpar_wrappers.h"
51 52
@@ -96,7 +97,7 @@ int pSeries_cpu_disable(void)
96 int cpu = smp_processor_id(); 97 int cpu = smp_processor_id();
97 98
98 cpu_clear(cpu, cpu_online_map); 99 cpu_clear(cpu, cpu_online_map);
99 systemcfg->processorCount--; 100 _systemcfg->processorCount--;
100 101
101 /*fix boot_cpuid here*/ 102 /*fix boot_cpuid here*/
102 if (cpu == boot_cpuid) 103 if (cpu == boot_cpuid)
@@ -441,7 +442,7 @@ void __init smp_init_pSeries(void)
441 smp_ops->cpu_die = pSeries_cpu_die; 442 smp_ops->cpu_die = pSeries_cpu_die;
442 443
443 /* Processors can be added/removed only on LPAR */ 444 /* Processors can be added/removed only on LPAR */
444 if (systemcfg->platform == PLATFORM_PSERIES_LPAR) 445 if (platform_is_lpar())
445 pSeries_reconfig_notifier_register(&pSeries_smp_nb); 446 pSeries_reconfig_notifier_register(&pSeries_smp_nb);
446#endif 447#endif
447 448
diff --git a/arch/powerpc/platforms/pseries/xics.c b/arch/powerpc/platforms/pseries/xics.c
index 405c4f3229b3..72ac18067ece 100644
--- a/arch/powerpc/platforms/pseries/xics.c
+++ b/arch/powerpc/platforms/pseries/xics.c
@@ -545,7 +545,9 @@ nextnode:
545 of_node_put(np); 545 of_node_put(np);
546 } 546 }
547 547
548 if (systemcfg->platform == PLATFORM_PSERIES) { 548 if (platform_is_lpar())
549 ops = &pSeriesLP_ops;
550 else {
549#ifdef CONFIG_SMP 551#ifdef CONFIG_SMP
550 for_each_cpu(i) { 552 for_each_cpu(i) {
551 int hard_id; 553 int hard_id;
@@ -561,8 +563,6 @@ nextnode:
561#else 563#else
562 xics_per_cpu[0] = ioremap(intr_base, intr_size); 564 xics_per_cpu[0] = ioremap(intr_base, intr_size);
563#endif /* CONFIG_SMP */ 565#endif /* CONFIG_SMP */
564 } else if (systemcfg->platform == PLATFORM_PSERIES_LPAR) {
565 ops = &pSeriesLP_ops;
566 } 566 }
567 567
568 xics_8259_pic.enable = i8259_pic.enable; 568 xics_8259_pic.enable = i8259_pic.enable;