aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel
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/kernel
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/kernel')
-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
15 files changed, 91 insertions, 156 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;