]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
[PATCH] powerpc: merge code values for identifying platforms
authorPaul Mackerras <paulus@samba.org>
Thu, 10 Nov 2005 02:37:51 +0000 (13:37 +1100)
committerPaul Mackerras <paulus@samba.org>
Thu, 10 Nov 2005 02:37:51 +0000 (13:37 +1100)
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>
44 files changed:
arch/powerpc/kernel/asm-offsets.c
arch/powerpc/kernel/head_64.S
arch/powerpc/kernel/paca.c
arch/powerpc/kernel/ppc_ksyms.c
arch/powerpc/kernel/prom.c
arch/powerpc/kernel/prom_init.c
arch/powerpc/kernel/rtas-proc.c
arch/powerpc/kernel/rtas.c
arch/powerpc/kernel/setup-common.c
arch/powerpc/kernel/setup_32.c
arch/powerpc/kernel/setup_64.c
arch/powerpc/kernel/smp.c
arch/powerpc/kernel/sys_ppc32.c
arch/powerpc/kernel/time.c
arch/powerpc/kernel/traps.c
arch/powerpc/mm/hash_utils_64.c
arch/powerpc/mm/stab.c
arch/powerpc/oprofile/op_model_power4.c
arch/powerpc/platforms/iseries/setup.c
arch/powerpc/platforms/pseries/eeh.c
arch/powerpc/platforms/pseries/iommu.c
arch/powerpc/platforms/pseries/pci.c
arch/powerpc/platforms/pseries/reconfig.c
arch/powerpc/platforms/pseries/rtasd.c
arch/powerpc/platforms/pseries/setup.c
arch/powerpc/platforms/pseries/smp.c
arch/powerpc/platforms/pseries/xics.c
arch/ppc/kernel/ppc_ksyms.c
arch/ppc/kernel/setup.c
arch/ppc64/kernel/asm-offsets.c
arch/ppc64/kernel/head.S
arch/ppc64/kernel/idle.c
arch/ppc64/kernel/lparcfg.c
arch/ppc64/kernel/nvram.c
arch/ppc64/kernel/pci.c
arch/ppc64/kernel/proc_ppc64.c
arch/ppc64/kernel/prom.c
arch/ppc64/kernel/prom_init.c
arch/ppc64/kernel/vdso.c
include/asm-powerpc/firmware.h
include/asm-powerpc/processor.h
include/asm-powerpc/reg.h
include/asm-powerpc/systemcfg.h [moved from include/asm-ppc64/systemcfg.h with 96% similarity]
include/asm-ppc64/mmu.h

index b75757251994ec925617658e0eb7d3e3415b3f99..8793102711a8faa7f24ac5ad2c31468e6d46e5de 100644 (file)
@@ -106,7 +106,6 @@ int main(void)
        DEFINE(ICACHEL1LINESIZE, offsetof(struct ppc64_caches, iline_size));
        DEFINE(ICACHEL1LOGLINESIZE, offsetof(struct ppc64_caches, log_iline_size));
        DEFINE(ICACHEL1LINESPERPAGE, offsetof(struct ppc64_caches, ilines_per_page));
-       DEFINE(PLATFORM, offsetof(struct systemcfg, platform));
        DEFINE(PLATFORM_LPAR, PLATFORM_LPAR);
 
        /* paca */
index 16ab40daa73852b1f8665888edc882cd69d6997b..8a8bf79ef0449605fa6ea36152f927d6de854e57 100644 (file)
@@ -28,7 +28,6 @@
 #include <asm/reg.h>
 #include <asm/page.h>
 #include <asm/mmu.h>
-#include <asm/systemcfg.h>
 #include <asm/ppc_asm.h>
 #include <asm/asm-offsets.h>
 #include <asm/bug.h>
@@ -1697,25 +1696,14 @@ _GLOBAL(pmac_secondary_start)
  *   SPRG3 = paca virtual address
  */
 _GLOBAL(__secondary_start)
+       /* Set thread priority to MEDIUM */
+       HMT_MEDIUM
 
-       HMT_MEDIUM                      /* Set thread priority to MEDIUM */
-
+       /* Load TOC */
        ld      r2,PACATOC(r13)
-       li      r6,0
-       stb     r6,PACAPROCENABLED(r13)
-
-#ifndef CONFIG_PPC_ISERIES
-       /* Initialize the page table pointer register. */
-       LOADADDR(r6,_SDR1)
-       ld      r6,0(r6)                /* get the value of _SDR1        */
-       mtspr   SPRN_SDR1,r6                    /* set the htab location         */
-#endif
-       /* Initialize the first segment table (or SLB) entry             */
-       ld      r3,PACASTABVIRT(r13)    /* get addr of segment table     */
-BEGIN_FTR_SECTION
-       bl      .stab_initialize
-END_FTR_SECTION_IFCLR(CPU_FTR_SLB)
-       bl      .slb_initialize
+
+       /* Do early setup for that CPU (stab, slb, hash table pointer) */
+       bl      .early_setup_secondary
 
        /* Initialize the kernel stack.  Just a repeat for iSeries.      */
        LOADADDR(r3,current_set)
@@ -1724,37 +1712,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_SLB)
        addi    r1,r1,THREAD_SIZE-STACK_FRAME_OVERHEAD
        std     r1,PACAKSAVE(r13)
 
-       ld      r3,PACASTABREAL(r13)    /* get raddr of segment table    */
-       ori     r4,r3,1                 /* turn on valid bit             */
-
-#ifdef CONFIG_PPC_ISERIES
-       li      r0,-1                   /* hypervisor call */
-       li      r3,1
-       sldi    r3,r3,63                /* 0x8000000000000000 */
-       ori     r3,r3,4                 /* 0x8000000000000004 */
-       sc                              /* HvCall_setASR */
-#else
-       /* set the ASR */
-       ld      r3,systemcfg@got(r2)    /* r3 = ptr to systemcfg         */
-       ld      r3,0(r3)
-       lwz     r3,PLATFORM(r3)         /* r3 = platform flags           */
-       andi.   r3,r3,PLATFORM_LPAR     /* Test if bit 0 is set (LPAR bit) */
-       beq     98f                     /* branch if result is 0  */
-       mfspr   r3,SPRN_PVR
-       srwi    r3,r3,16
-       cmpwi   r3,0x37                 /* SStar  */
-       beq     97f
-       cmpwi   r3,0x36                 /* IStar  */
-       beq     97f
-       cmpwi   r3,0x34                 /* Pulsar */
-       bne     98f
-97:    li      r3,H_SET_ASR            /* hcall = H_SET_ASR */
-       HVSC                            /* Invoking hcall */
-       b       99f
-98:                                    /* !(rpa hypervisor) || !(star)  */
-       mtasr   r4                      /* set the stab location         */
-99:
-#endif
+       /* Clear backchain so we get nice backtraces */
        li      r7,0
        mtlr    r7
 
@@ -1777,6 +1735,7 @@ _GLOBAL(start_secondary_prolog)
        li      r3,0
        std     r3,0(r1)                /* Zero the stack frame pointer */
        bl      .start_secondary
+       b       .
 #endif
 
 /*
@@ -1896,40 +1855,6 @@ _STATIC(start_here_multiplatform)
        mr      r3,r31
        bl      .early_setup
 
-       /* set the ASR */
-       ld      r3,PACASTABREAL(r13)
-       ori     r4,r3,1                 /* turn on valid bit             */
-       ld      r3,systemcfg@got(r2)    /* r3 = ptr to systemcfg */
-       ld      r3,0(r3)
-       lwz     r3,PLATFORM(r3)         /* r3 = platform flags */
-       andi.   r3,r3,PLATFORM_LPAR     /* Test if bit 0 is set (LPAR bit) */
-       beq     98f                     /* branch if result is 0  */
-       mfspr   r3,SPRN_PVR
-       srwi    r3,r3,16
-       cmpwi   r3,0x37                 /* SStar */
-       beq     97f
-       cmpwi   r3,0x36                 /* IStar  */
-       beq     97f
-       cmpwi   r3,0x34                 /* Pulsar */
-       bne     98f
-97:    li      r3,H_SET_ASR            /* hcall = H_SET_ASR */
-       HVSC                            /* Invoking hcall */
-       b       99f
-98:                                    /* !(rpa hypervisor) || !(star) */
-       mtasr   r4                      /* set the stab location        */
-99:
-       /* Set SDR1 (hash table pointer) */
-       ld      r3,systemcfg@got(r2)    /* r3 = ptr to systemcfg */
-       ld      r3,0(r3)
-       lwz     r3,PLATFORM(r3)         /* r3 = platform flags */
-       /* Test if bit 0 is set (LPAR bit) */
-       andi.   r3,r3,PLATFORM_LPAR
-       bne     98f                     /* branch if result is !0  */
-       LOADADDR(r6,_SDR1)              /* Only if NOT LPAR */
-       add     r6,r6,r26
-       ld      r6,0(r6)                /* get the value of _SDR1 */
-       mtspr   SPRN_SDR1,r6                    /* set the htab location  */
-98: 
        LOADADDR(r3,.start_here_common)
        SET_REG_TO_CONST(r4, MSR_KERNEL)
        mtspr   SPRN_SRR0,r3
index 179948eb058079afe98f6f511ac9f7ec328ebd33..3cf2517c5f91171a46fff1ea4586064f64614c4f 100644 (file)
@@ -15,7 +15,7 @@
 #include <asm/processor.h>
 #include <asm/ptrace.h>
 #include <asm/page.h>
-
+#include <asm/systemcfg.h>
 #include <asm/lppaca.h>
 #include <asm/iseries/it_lp_queue.h>
 #include <asm/paca.h>
@@ -24,8 +24,7 @@ static union {
        struct systemcfg        data;
        u8                      page[PAGE_SIZE];
 } systemcfg_store __attribute__((__section__(".data.page.aligned")));
-struct systemcfg *systemcfg = &systemcfg_store.data;
-EXPORT_SYMBOL(systemcfg);
+struct systemcfg *_systemcfg = &systemcfg_store.data;
 
 
 /* This symbol is provided by the linker - let it fill in the paca
index 5d9fd0369aad83a292738c1f16119d12b86af5d0..5dcf4ba05ee8aa25922e444f070b264fc861e422 100644 (file)
@@ -188,9 +188,6 @@ EXPORT_SYMBOL(adb_try_handler_change);
 EXPORT_SYMBOL(cuda_request);
 EXPORT_SYMBOL(cuda_poll);
 #endif /* CONFIG_ADB_CUDA */
-#if defined(CONFIG_PPC_MULTIPLATFORM) && defined(CONFIG_PPC32)
-EXPORT_SYMBOL(_machine);
-#endif
 #ifdef CONFIG_PPC_PMAC
 EXPORT_SYMBOL(sys_ctrler);
 #endif
index 5af39f866735b4e4915090a384a1a10de7d3a7b0..1bf3642cb8598cf57419c65985a679dd30b831f4 100644 (file)
@@ -48,9 +48,6 @@
 #include <asm/machdep.h>
 #include <asm/pSeries_reconfig.h>
 #include <asm/pci-bridge.h>
-#ifdef CONFIG_PPC64
-#include <asm/systemcfg.h>
-#endif
 
 #ifdef DEBUG
 #define DBG(fmt...) printk(KERN_ERR fmt)
@@ -391,7 +388,7 @@ static int __devinit finish_node_interrupts(struct device_node *np,
 
 #ifdef CONFIG_PPC64
                /* We offset irq numbers for the u3 MPIC by 128 in PowerMac */
-               if (systemcfg->platform == PLATFORM_POWERMAC && ic && ic->parent) {
+               if (_machine == PLATFORM_POWERMAC && ic && ic->parent) {
                        char *name = get_property(ic->parent, "name", NULL);
                        if (name && !strcmp(name, "u3"))
                                np->intrs[intrcount].line += 128;
@@ -1161,13 +1158,9 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
        prop = (u32 *)of_get_flat_dt_prop(node, "linux,platform", NULL);
        if (prop == NULL)
                return 0;
-#ifdef CONFIG_PPC64
-       systemcfg->platform = *prop;
-#else
 #ifdef CONFIG_PPC_MULTIPLATFORM
        _machine = *prop;
 #endif
-#endif
 
 #ifdef CONFIG_PPC64
        /* check if iommu is forced on or off */
@@ -1346,9 +1339,6 @@ void __init early_init_devtree(void *params)
        of_scan_flat_dt(early_init_dt_scan_memory, NULL);
        lmb_enforce_memory_limit(memory_limit);
        lmb_analyze();
-#ifdef CONFIG_PPC64
-       systemcfg->physicalMemorySize = lmb_phys_mem_size();
-#endif
        lmb_reserve(0, __pa(klimit));
 
        DBG("Phys. mem: %lx\n", lmb_phys_mem_size());
@@ -1915,7 +1905,7 @@ static int of_finish_dynamic_node(struct device_node *node,
        /* We don't support that function on PowerMac, at least
         * not yet
         */
-       if (systemcfg->platform == PLATFORM_POWERMAC)
+       if (_machine == PLATFORM_POWERMAC)
                return -ENODEV;
 
        /* fix up new node's linux_phandle field */
@@ -1999,9 +1989,11 @@ int prom_add_property(struct device_node* np, struct property* prop)
        *next = prop;
        write_unlock(&devtree_lock);
 
+#ifdef CONFIG_PROC_DEVICETREE
        /* try to add to proc as well if it was initialized */
        if (np->pde)
                proc_device_tree_add_prop(np->pde, prop);
+#endif /* CONFIG_PROC_DEVICETREE */
 
        return 0;
 }
index 09db1bb9ec912b2a63fbc89f2ff6de40dfabd59b..4ce0105c308ea04b7be7fd88524b4c8b25fdef73 100644 (file)
@@ -117,11 +117,6 @@ int of_workarounds;
 #define prom_debug(x...)
 #endif
 
-#ifdef CONFIG_PPC32
-#define PLATFORM_POWERMAC      _MACH_Pmac
-#define PLATFORM_CHRP          _MACH_chrp
-#endif
-
 
 typedef u32 prom_arg_t;
 
@@ -2078,7 +2073,8 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4,
        /*
         * On pSeries, inform the firmware about our capabilities
         */
-       if (RELOC(of_platform) & PLATFORM_PSERIES)
+       if (RELOC(of_platform) == PLATFORM_PSERIES ||
+           RELOC(of_platform) == PLATFORM_PSERIES_LPAR)
                prom_send_capabilities();
 #endif
 
index 5bdd5b079d966359a0be76a8ff928abc0069a5f6..ae1a36449ccdd0b9e8039b1d8b73b8f92695988f 100644 (file)
@@ -259,7 +259,7 @@ static int __init proc_rtas_init(void)
 {
        struct proc_dir_entry *entry;
 
-       if (!(systemcfg->platform & PLATFORM_PSERIES))
+       if (_machine != PLATFORM_PSERIES && _machine != PLATFORM_PSERIES_LPAR)
                return 1;
 
        rtas_node = of_find_node_by_name(NULL, "rtas");
index 9d4e07f6f1ecb5e061fa6619df534fde1491cef3..4283fa33f784f930a09c9f3cb993f519bd35de67 100644 (file)
@@ -29,9 +29,6 @@
 #include <asm/delay.h>
 #include <asm/uaccess.h>
 #include <asm/lmb.h>
-#ifdef CONFIG_PPC64
-#include <asm/systemcfg.h>
-#endif
 
 struct rtas_t rtas = {
        .lock = SPIN_LOCK_UNLOCKED
@@ -671,7 +668,7 @@ void __init rtas_initialize(void)
         * the stop-self token if any
         */
 #ifdef CONFIG_PPC64
-       if (systemcfg->platform == PLATFORM_PSERIES_LPAR)
+       if (_machine == PLATFORM_PSERIES_LPAR)
                rtas_region = min(lmb.rmo_size, RTAS_INSTANTIATE_MAX);
 #endif
        rtas_rmo_buf = lmb_alloc_base(RTAS_RMOBUF_MAX, PAGE_SIZE, rtas_region);
index 17c46a2e356df1eb2b4954c19fc0c0041f78f1f2..06e4ef2156270c47fa76d0d1eb8932420480cc34 100644 (file)
@@ -33,6 +33,7 @@
 #include <asm/io.h>
 #include <asm/prom.h>
 #include <asm/processor.h>
+#include <asm/systemcfg.h>
 #include <asm/pgtable.h>
 #include <asm/smp.h>
 #include <asm/elf.h>
 #define DBG(fmt...)
 #endif
 
+#ifdef CONFIG_PPC_MULTIPLATFORM
+int _machine = 0;
+EXPORT_SYMBOL(_machine);
+#endif
+
 /*
  * This still seems to be needed... -- paulus
  */ 
@@ -513,8 +519,8 @@ void __init smp_setup_cpu_maps(void)
         * On pSeries LPAR, we need to know how many cpus
         * could possibly be added to this partition.
         */
-       if (systemcfg->platform == PLATFORM_PSERIES_LPAR &&
-                               (dn = of_find_node_by_path("/rtas"))) {
+       if (_machine == PLATFORM_PSERIES_LPAR &&
+           (dn = of_find_node_by_path("/rtas"))) {
                int num_addr_cell, num_size_cell, maxcpus;
                unsigned int *ireg;
 
@@ -558,7 +564,7 @@ void __init smp_setup_cpu_maps(void)
                        cpu_set(cpu ^ 0x1, cpu_sibling_map[cpu]);
        }
 
-       systemcfg->processorCount = num_present_cpus();
+       _systemcfg->processorCount = num_present_cpus();
 #endif /* CONFIG_PPC64 */
 }
 #endif /* CONFIG_SMP */
index 55f485f78c007810a2a23edb3d453133f378528c..f73d7681b2e958470f63ade98782e2b4baca80c0 100644 (file)
@@ -72,8 +72,6 @@ unsigned int DMA_MODE_WRITE;
 int have_of = 1;
 
 #ifdef CONFIG_PPC_MULTIPLATFORM
-int _machine = 0;
-
 extern void prep_init(void);
 extern void pmac_init(void);
 extern void chrp_init(void);
index fe39aac4f24dc76bd3cb44198c8161dcc4b84a04..be607b877a55e889614eb598eb8d1f00c1e2a748 100644 (file)
@@ -100,10 +100,9 @@ extern void udbg_init_maple_realmode(void);
 extern unsigned long klimit;
 
 extern void mm_init_ppc64(void);
-extern void stab_initialize(unsigned long stab);
-extern void htab_initialize(void);
 extern void early_init_devtree(void *flat_dt);
 extern void unflatten_device_tree(void);
+extern void check_for_initrd(void);
 
 int have_of = 1;
 int boot_cpuid = 0;
@@ -256,11 +255,10 @@ void __init early_setup(unsigned long dt_ptr)
         * Iterate all ppc_md structures until we find the proper
         * one for the current machine type
         */
-       DBG("Probing machine type for platform %x...\n",
-           systemcfg->platform);
+       DBG("Probing machine type for platform %x...\n", _machine);
 
        for (mach = machines; *mach; mach++) {
-               if ((*mach)->probe(systemcfg->platform))
+               if ((*mach)->probe(_machine))
                        break;
        }
        /* What can we do if we didn't find ? */
@@ -292,6 +290,28 @@ void __init early_setup(unsigned long dt_ptr)
        DBG(" <- early_setup()\n");
 }
 
+#ifdef CONFIG_SMP
+void early_setup_secondary(void)
+{
+       struct paca_struct *lpaca = get_paca();
+
+       /* Mark enabled in PACA */
+       lpaca->proc_enabled = 0;
+
+       /* Initialize hash table for that CPU */
+       htab_initialize_secondary();
+
+       /* Initialize STAB/SLB. We use a virtual address as it works
+        * in real mode on pSeries and we want a virutal address on
+        * iSeries anyway
+        */
+       if (cpu_has_feature(CPU_FTR_SLB))
+               slb_initialize();
+       else
+               stab_initialize(lpaca->stab_addr);
+}
+
+#endif /* CONFIG_SMP */
 
 #if defined(CONFIG_SMP) || defined(CONFIG_KEXEC)
 void smp_release_cpus(void)
@@ -317,7 +337,8 @@ void smp_release_cpus(void)
 #endif /* CONFIG_SMP || CONFIG_KEXEC */
 
 /*
- * Initialize some remaining members of the ppc64_caches and systemcfg structures
+ * Initialize some remaining members of the ppc64_caches and systemcfg
+ * structures
  * (at least until we get rid of them completely). This is mostly some
  * cache informations about the CPU that will be used by cache flush
  * routines and/or provided to userland
@@ -342,7 +363,7 @@ static void __init initialize_cache_info(void)
                        const char *dc, *ic;
 
                        /* Then read cache informations */
-                       if (systemcfg->platform == PLATFORM_POWERMAC) {
+                       if (_machine == PLATFORM_POWERMAC) {
                                dc = "d-cache-block-size";
                                ic = "i-cache-block-size";
                        } else {
@@ -362,8 +383,8 @@ static void __init initialize_cache_info(void)
                                DBG("Argh, can't find dcache properties ! "
                                    "sizep: %p, lsizep: %p\n", sizep, lsizep);
 
-                       systemcfg->dcache_size = ppc64_caches.dsize = size;
-                       systemcfg->dcache_line_size =
+                       _systemcfg->dcache_size = ppc64_caches.dsize = size;
+                       _systemcfg->dcache_line_size =
                                ppc64_caches.dline_size = lsize;
                        ppc64_caches.log_dline_size = __ilog2(lsize);
                        ppc64_caches.dlines_per_page = PAGE_SIZE / lsize;
@@ -380,8 +401,8 @@ static void __init initialize_cache_info(void)
                                DBG("Argh, can't find icache properties ! "
                                    "sizep: %p, lsizep: %p\n", sizep, lsizep);
 
-                       systemcfg->icache_size = ppc64_caches.isize = size;
-                       systemcfg->icache_line_size =
+                       _systemcfg->icache_size = ppc64_caches.isize = size;
+                       _systemcfg->icache_line_size =
                                ppc64_caches.iline_size = lsize;
                        ppc64_caches.log_iline_size = __ilog2(lsize);
                        ppc64_caches.ilines_per_page = PAGE_SIZE / lsize;
@@ -389,10 +410,12 @@ static void __init initialize_cache_info(void)
        }
 
        /* Add an eye catcher and the systemcfg layout version number */
-       strcpy(systemcfg->eye_catcher, "SYSTEMCFG:PPC64");
-       systemcfg->version.major = SYSTEMCFG_MAJOR;
-       systemcfg->version.minor = SYSTEMCFG_MINOR;
-       systemcfg->processor = mfspr(SPRN_PVR);
+       strcpy(_systemcfg->eye_catcher, "SYSTEMCFG:PPC64");
+       _systemcfg->version.major = SYSTEMCFG_MAJOR;
+       _systemcfg->version.minor = SYSTEMCFG_MINOR;
+       _systemcfg->processor = mfspr(SPRN_PVR);
+       _systemcfg->platform = _machine;
+       _systemcfg->physicalMemorySize = lmb_phys_mem_size();
 
        DBG(" <- initialize_cache_info()\n");
 }
@@ -481,10 +504,10 @@ void __init setup_system(void)
        printk("-----------------------------------------------------\n");
        printk("ppc64_pft_size                = 0x%lx\n", ppc64_pft_size);
        printk("ppc64_interrupt_controller    = 0x%ld\n", ppc64_interrupt_controller);
-       printk("systemcfg                     = 0x%p\n", systemcfg);
-       printk("systemcfg->platform           = 0x%x\n", systemcfg->platform);
-       printk("systemcfg->processorCount     = 0x%lx\n", systemcfg->processorCount);
-       printk("systemcfg->physicalMemorySize = 0x%lx\n", systemcfg->physicalMemorySize);
+       printk("systemcfg                     = 0x%p\n", _systemcfg);
+       printk("systemcfg->platform           = 0x%x\n", _systemcfg->platform);
+       printk("systemcfg->processorCount     = 0x%lx\n", _systemcfg->processorCount);
+       printk("systemcfg->physicalMemorySize = 0x%lx\n", _systemcfg->physicalMemorySize);
        printk("ppc64_caches.dcache_line_size = 0x%x\n",
                        ppc64_caches.dline_size);
        printk("ppc64_caches.icache_line_size = 0x%x\n",
@@ -566,12 +589,12 @@ void __init setup_syscall_map(void)
        for (i = 0; i < __NR_syscalls; i++) {
                if (sys_call_table[i*2] != sys_ni_syscall) {
                        count64++;
-                       systemcfg->syscall_map_64[i >> 5] |=
+                       _systemcfg->syscall_map_64[i >> 5] |=
                                0x80000000UL >> (i & 0x1f);
                }
                if (sys_call_table[i*2+1] != sys_ni_syscall) {
                        count32++;
-                       systemcfg->syscall_map_32[i >> 5] |=
+                       _systemcfg->syscall_map_32[i >> 5] |=
                                0x80000000UL >> (i & 0x1f);
                }
        }
index 5c330c3366e42e2ec500cd8fe98fbdd7c94c3bc8..7fd530898bd11c9a66beb8d13d42e91afb326124 100644 (file)
@@ -44,6 +44,7 @@
 #include <asm/cputable.h>
 #include <asm/system.h>
 #include <asm/mpic.h>
+#include <asm/systemcfg.h>
 #ifdef CONFIG_PPC64
 #include <asm/paca.h>
 #endif
@@ -368,7 +369,9 @@ int generic_cpu_disable(void)
        if (cpu == boot_cpuid)
                return -EBUSY;
 
-       systemcfg->processorCount--;
+#ifdef CONFIG_PPC64
+       _systemcfg->processorCount--;
+#endif
        cpu_clear(cpu, cpu_online_map);
        fixup_irqs(cpu_online_map);
        return 0;
index a8210ed5c686ae0e0771c3b77821fb96a4fdeeb2..9c921d1c4084484b186249eed4ab7daa2e9ce550 100644 (file)
@@ -52,7 +52,6 @@
 #include <asm/semaphore.h>
 #include <asm/time.h>
 #include <asm/mmu_context.h>
-#include <asm/systemcfg.h>
 #include <asm/ppc-pci.h>
 
 /* readdir & getdents */
index a6282b625b440203aebb48f58e59c10fb4fa1ed5..386006b3d6160d6445097b340f3a9742436e09bd 100644 (file)
@@ -271,13 +271,13 @@ static inline void update_gtod(u64 new_tb_stamp, u64 new_stamp_xsec,
         * tb_to_xs and stamp_xsec values are consistent.  If not, then it
         * loops back and reads them again until this criteria is met.
         */
-       ++(systemcfg->tb_update_count);
+       ++(_systemcfg->tb_update_count);
        smp_wmb();
-       systemcfg->tb_orig_stamp = new_tb_stamp;
-       systemcfg->stamp_xsec = new_stamp_xsec;
-       systemcfg->tb_to_xs = new_tb_to_xs;
+       _systemcfg->tb_orig_stamp = new_tb_stamp;
+       _systemcfg->stamp_xsec = new_stamp_xsec;
+       _systemcfg->tb_to_xs = new_tb_to_xs;
        smp_wmb();
-       ++(systemcfg->tb_update_count);
+       ++(_systemcfg->tb_update_count);
 #endif
 }
 
@@ -357,8 +357,9 @@ static void iSeries_tb_recal(void)
                                do_gtod.tb_ticks_per_sec = tb_ticks_per_sec;
                                tb_to_xs = divres.result_low;
                                do_gtod.varp->tb_to_xs = tb_to_xs;
-                               systemcfg->tb_ticks_per_sec = tb_ticks_per_sec;
-                               systemcfg->tb_to_xs = tb_to_xs;
+                               _systemcfg->tb_ticks_per_sec =
+                                       tb_ticks_per_sec;
+                               _systemcfg->tb_to_xs = tb_to_xs;
                        }
                        else {
                                printk( "Titan recalibrate: FAILED (difference > 4 percent)\n"
@@ -559,8 +560,8 @@ int do_settimeofday(struct timespec *tv)
        update_gtod(tb_last_jiffy, new_xsec, do_gtod.varp->tb_to_xs);
 
 #ifdef CONFIG_PPC64
-       systemcfg->tz_minuteswest = sys_tz.tz_minuteswest;
-       systemcfg->tz_dsttime = sys_tz.tz_dsttime;
+       _systemcfg->tz_minuteswest = sys_tz.tz_minuteswest;
+       _systemcfg->tz_dsttime = sys_tz.tz_dsttime;
 #endif
 
        write_sequnlock_irqrestore(&xtime_lock, flags);
@@ -711,11 +712,11 @@ void __init time_init(void)
        do_gtod.varp->tb_to_xs = tb_to_xs;
        do_gtod.tb_to_us = tb_to_us;
 #ifdef CONFIG_PPC64
-       systemcfg->tb_orig_stamp = tb_last_jiffy;
-       systemcfg->tb_update_count = 0;
-       systemcfg->tb_ticks_per_sec = tb_ticks_per_sec;
-       systemcfg->stamp_xsec = xtime.tv_sec * XSEC_PER_SEC;
-       systemcfg->tb_to_xs = tb_to_xs;
+       _systemcfg->tb_orig_stamp = tb_last_jiffy;
+       _systemcfg->tb_update_count = 0;
+       _systemcfg->tb_ticks_per_sec = tb_ticks_per_sec;
+       _systemcfg->stamp_xsec = xtime.tv_sec * XSEC_PER_SEC;
+       _systemcfg->tb_to_xs = tb_to_xs;
 #endif
 
        time_freq = 0;
index 0578f838760301d2dd7c20c1294ba5459c07e4cd..2020bb7648fbc183f2f599ac6c834a2b4d7ed3f9 100644 (file)
@@ -129,7 +129,7 @@ int die(const char *str, struct pt_regs *regs, long err)
        nl = 1;
 #endif
 #ifdef CONFIG_PPC64
-       switch (systemcfg->platform) {
+       switch (_machine) {
        case PLATFORM_PSERIES:
                printk("PSERIES ");
                nl = 1;
index c8c9c2df97e948533995ad2880e6177a2909b653..706e8a63ced93218334a227b62f5303595c27790 100644 (file)
 extern unsigned long dart_tablebase;
 #endif /* CONFIG_U3_DART */
 
+static unsigned long _SDR1;
+struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT];
+
 hpte_t *htab_address;
 unsigned long htab_hash_mask;
-unsigned long _SDR1;
-struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT];
 int mmu_linear_psize = MMU_PAGE_4K;
 int mmu_virtual_psize = MMU_PAGE_4K;
 #ifdef CONFIG_HUGETLB_PAGE
@@ -165,7 +166,7 @@ int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
                 * normal insert callback here.
                 */
 #ifdef CONFIG_PPC_ISERIES
-               if (systemcfg->platform == PLATFORM_ISERIES_LPAR)
+               if (_machine == PLATFORM_ISERIES_LPAR)
                        ret = iSeries_hpte_insert(hpteg, va,
                                                  virt_to_abs(paddr),
                                                  tmp_mode,
@@ -174,7 +175,7 @@ int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
                else
 #endif
 #ifdef CONFIG_PPC_PSERIES
-               if (systemcfg->platform & PLATFORM_LPAR)
+               if (_machine & PLATFORM_LPAR)
                        ret = pSeries_lpar_hpte_insert(hpteg, va,
                                                       virt_to_abs(paddr),
                                                       tmp_mode,
@@ -293,7 +294,7 @@ static void __init htab_init_page_sizes(void)
         * Not in the device-tree, let's fallback on known size
         * list for 16M capable GP & GR
         */
-       if ((systemcfg->platform != PLATFORM_ISERIES_LPAR) &&
+       if ((_machine != PLATFORM_ISERIES_LPAR) &&
            cpu_has_feature(CPU_FTR_16M_PAGE))
                memcpy(mmu_psize_defs, mmu_psize_defaults_gp,
                       sizeof(mmu_psize_defaults_gp));
@@ -364,7 +365,7 @@ static int __init htab_dt_scan_pftsize(unsigned long node,
 
 static unsigned long __init htab_get_table_size(void)
 {
-       unsigned long rnd_mem_size, pteg_count;
+       unsigned long mem_size, rnd_mem_size, pteg_count;
 
        /* If hash size isn't already provided by the platform, we try to
         * 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)
                return 1UL << ppc64_pft_size;
 
        /* round mem_size up to next power of 2 */
-       rnd_mem_size = 1UL << __ilog2(systemcfg->physicalMemorySize);
-       if (rnd_mem_size < systemcfg->physicalMemorySize)
+       mem_size = lmb_phys_mem_size();
+       rnd_mem_size = 1UL << __ilog2(mem_size);
+       if (rnd_mem_size < mem_size)
                rnd_mem_size <<= 1;
 
        /* # pages / 2 */
@@ -419,7 +421,7 @@ void __init htab_initialize(void)
 
        htab_hash_mask = pteg_count - 1;
 
-       if (systemcfg->platform & PLATFORM_LPAR) {
+       if (platform_is_lpar()) {
                /* Using a hypervisor which owns the htab */
                htab_address = NULL;
                _SDR1 = 0; 
@@ -440,6 +442,9 @@ void __init htab_initialize(void)
 
                /* Initialize the HPT with no entries */
                memset((void *)table, 0, htab_size_bytes);
+
+               /* Set SDR1 */
+               mtspr(SPRN_SDR1, _SDR1);
        }
 
        mode_rw = _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_COHERENT | PP_RWXX;
@@ -509,6 +514,12 @@ void __init htab_initialize(void)
 #undef KB
 #undef MB
 
+void __init htab_initialize_secondary(void)
+{
+       if (!platform_is_lpar())
+               mtspr(SPRN_SDR1, _SDR1);
+}
+
 /*
  * Called by asm hashtable.S for doing lazy icache flush
  */
index fa325dbf98fc2d14ac3be5774feafbcd3f4cd21c..cfbb4e1f966b3331e7e89dda329ae925841616d1 100644 (file)
@@ -20,6 +20,7 @@
 #include <asm/cputable.h>
 #include <asm/lmb.h>
 #include <asm/abs_addr.h>
+#include <asm/firmware.h>
 
 struct stab_entry {
        unsigned long esid_data;
@@ -256,7 +257,7 @@ void stabs_alloc(void)
 
                paca[cpu].stab_addr = newstab;
                paca[cpu].stab_real = virt_to_abs(newstab);
-               printk(KERN_DEBUG "Segment table for CPU %d at 0x%lx "
+               printk(KERN_INFO "Segment table for CPU %d at 0x%lx "
                       "virtual, 0x%lx absolute\n",
                       cpu, paca[cpu].stab_addr, paca[cpu].stab_real);
        }
@@ -270,10 +271,28 @@ void stabs_alloc(void)
 void stab_initialize(unsigned long stab)
 {
        unsigned long vsid = get_kernel_vsid(KERNELBASE);
+       unsigned long stabreal;
 
        asm volatile("isync; slbia; isync":::"memory");
        make_ste(stab, GET_ESID(KERNELBASE), vsid);
 
        /* Order update */
        asm volatile("sync":::"memory");
+
+       /* Set ASR */
+       stabreal = get_paca()->stab_real | 0x1ul;
+
+#ifdef CONFIG_PPC_ISERIES
+       if (firmware_has_feature(FW_FEATURE_ISERIES)) {
+               HvCall1(HvCallBaseSetASR, stabreal);
+               return;
+       }
+#endif /* CONFIG_PPC_ISERIES */
+#ifdef CONFIG_PPC_PSERIES
+       if (platform_is_lpar()) {
+               plpar_hcall_norets(H_SET_ASR, stabreal);
+               return;
+       }
+#endif
+       mtspr(SPRN_ASR, stabreal);
 }
index c4ee5478427b4ae322a8e1b4dd18f3600a23ce9a..e3a024e324b62f846fb11eb37c2c1059ffc5967c 100644 (file)
@@ -233,8 +233,7 @@ static unsigned long get_pc(struct pt_regs *regs)
        mmcra = mfspr(SPRN_MMCRA);
 
        /* Were we in the hypervisor? */
-       if ((systemcfg->platform == PLATFORM_PSERIES_LPAR) &&
-           (mmcra & MMCRA_SIHV))
+       if (platform_is_lpar() && (mmcra & MMCRA_SIHV))
                /* function descriptor madness */
                return *((unsigned long *)hypervisor_bucket);
 
index 7f8f0cda6a742ca7844c79259c6f5601c8d04b30..623c39aa04362847e3dd8ac614add5dba6afb6a1 100644 (file)
@@ -39,6 +39,7 @@
 #include <asm/sections.h>
 #include <asm/iommu.h>
 #include <asm/firmware.h>
+#include <asm/systemcfg.h>
 
 #include <asm/time.h>
 #include <asm/paca.h>
@@ -71,7 +72,7 @@ extern void hvlog(char *fmt, ...);
 #endif
 
 /* Function Prototypes */
-static void build_iSeries_Memory_Map(void);
+static unsigned long build_iSeries_Memory_Map(void);
 static void iseries_shared_idle(void);
 static void iseries_dedicated_idle(void);
 #ifdef CONFIG_PCI
@@ -403,9 +404,11 @@ void mschunks_alloc(unsigned long num_chunks)
  * a table used to translate Linux's physical addresses to these
  * absolute addresses.  Absolute addresses are needed when
  * communicating with the hypervisor (e.g. to build HPT entries)
+ *
+ * Returns the physical memory size
  */
 
-static void __init build_iSeries_Memory_Map(void)
+static unsigned long __init build_iSeries_Memory_Map(void)
 {
        u32 loadAreaFirstChunk, loadAreaLastChunk, loadAreaSize;
        u32 nextPhysChunk;
@@ -538,7 +541,7 @@ static void __init build_iSeries_Memory_Map(void)
         * which should be equal to
         *   nextPhysChunk
         */
-       systemcfg->physicalMemorySize = chunk_to_addr(nextPhysChunk);
+       return chunk_to_addr(nextPhysChunk);
 }
 
 /*
@@ -564,8 +567,8 @@ static void __init iSeries_setup_arch(void)
        printk("Max physical processors = %d\n",
                        itVpdAreas.xSlicMaxPhysicalProcs);
 
-       systemcfg->processor = xIoHriProcessorVpd[procIx].xPVR;
-       printk("Processor version = %x\n", systemcfg->processor);
+       _systemcfg->processor = xIoHriProcessorVpd[procIx].xPVR;
+       printk("Processor version = %x\n", _systemcfg->processor);
 }
 
 static void iSeries_show_cpuinfo(struct seq_file *m)
@@ -929,7 +932,7 @@ void dt_cpus(struct iseries_flat_dt *dt)
        dt_end_node(dt);
 }
 
-void build_flat_dt(struct iseries_flat_dt *dt)
+void build_flat_dt(struct iseries_flat_dt *dt, unsigned long phys_mem_size)
 {
        u64 tmp[2];
 
@@ -945,7 +948,7 @@ void build_flat_dt(struct iseries_flat_dt *dt)
        dt_prop_str(dt, "name", "memory");
        dt_prop_str(dt, "device_type", "memory");
        tmp[0] = 0;
-       tmp[1] = systemcfg->physicalMemorySize;
+       tmp[1] = phys_mem_size;
        dt_prop_u64_list(dt, "reg", tmp, 2);
        dt_end_node(dt);
 
@@ -965,13 +968,15 @@ void build_flat_dt(struct iseries_flat_dt *dt)
 
 void * __init iSeries_early_setup(void)
 {
+       unsigned long phys_mem_size;
+
        iSeries_fixup_klimit();
 
        /*
         * Initialize the table which translate Linux physical addresses to
         * AS/400 absolute addresses
         */
-       build_iSeries_Memory_Map();
+       phys_mem_size = build_iSeries_Memory_Map();
 
        iSeries_get_cmdline();
 
@@ -981,7 +986,7 @@ void * __init iSeries_early_setup(void)
        /* Parse early parameters, in particular mem=x */
        parse_early_param();
 
-       build_flat_dt(&iseries_dt);
+       build_flat_dt(&iseries_dt, phys_mem_size);
 
        return (void *) __pa(&iseries_dt);
 }
index b760836bb9d105f5168eb7861b2e4de450c15762..a33ba833109c5e2bfc0628af4a9179d00997be0f 100644 (file)
@@ -32,7 +32,6 @@
 #include <asm/machdep.h>
 #include <asm/ppc-pci.h>
 #include <asm/rtas.h>
-#include <asm/systemcfg.h>
 
 #undef DEBUG
 
@@ -1186,7 +1185,7 @@ static int __init eeh_init_proc(void)
 {
        struct proc_dir_entry *e;
 
-       if (systemcfg->platform & PLATFORM_PSERIES) {
+       if (platform_is_pseries()) {
                e = create_proc_entry("ppc64/eeh", 0, NULL);
                if (e)
                        e->proc_fops = &proc_eeh_operations;
index fcc50bfd43fd35d560175b89917bbc51d4c56cfb..97ba5214417f856a7371652e0df54a6863ab5085 100644 (file)
@@ -42,7 +42,6 @@
 #include <asm/machdep.h>
 #include <asm/abs_addr.h>
 #include <asm/pSeries_reconfig.h>
-#include <asm/systemcfg.h>
 #include <asm/firmware.h>
 #include <asm/tce.h>
 #include <asm/ppc-pci.h>
@@ -582,7 +581,7 @@ void iommu_init_early_pSeries(void)
                return;
        }
 
-       if (systemcfg->platform & PLATFORM_LPAR) {
+       if (platform_is_lpar()) {
                if (firmware_has_feature(FW_FEATURE_MULTITCE)) {
                        ppc_md.tce_build = tce_buildmulti_pSeriesLP;
                        ppc_md.tce_free  = tce_freemulti_pSeriesLP;
index c198656a3bb5723faae617ec52406a17a718ff02..6b0772f3569266b0e0f43bfc5ce4520270ea637b 100644 (file)
@@ -123,7 +123,7 @@ static void fixup_winbond_82c105(struct pci_dev* dev)
        int i;
        unsigned int reg;
 
-       if (!(systemcfg->platform & PLATFORM_PSERIES))
+       if (!platform_is_pseries())
                return;
 
        printk("Using INTC for W82c105 IDE controller.\n");
index d7d400339458d2e5e159bd67633bc919e8b8eed6..d8864164dbe809c85c012fe03957e96d4b398ff4 100644 (file)
@@ -408,7 +408,7 @@ static int proc_ppc64_create_ofdt(void)
 {
        struct proc_dir_entry *ent;
 
-       if (!(systemcfg->platform & PLATFORM_PSERIES))
+       if (!platform_is_pseries())
                return 0;
 
        ent = create_proc_entry("ppc64/ofdt", S_IWUSR, NULL);
index e26b0420b6ddea490c8a6fb8f81a0bd9ac351422..00cf331a1dc4dd1c53de8e72c044611f5b8a1ee2 100644 (file)
@@ -482,10 +482,12 @@ static int __init rtas_init(void)
 {
        struct proc_dir_entry *entry;
 
-       /* No RTAS, only warn if we are on a pSeries box  */
+       if (!platform_is_pseries())
+               return 0;
+
+       /* No RTAS */
        if (rtas_token("event-scan") == RTAS_UNKNOWN_SERVICE) {
-               if (systemcfg->platform & PLATFORM_PSERIES)
-                       printk(KERN_INFO "rtasd: no event-scan on system\n");
+               printk(KERN_INFO "rtasd: no event-scan on system\n");
                return 1;
        }
 
index a093a0d4dd69d15c03f7379521e7e54dae6b1f94..e94247c28d422a321def8829c0ca3db2daa8429e 100644 (file)
@@ -249,7 +249,7 @@ static void __init pSeries_setup_arch(void)
                ppc_md.idle_loop = default_idle;
        }
 
-       if (systemcfg->platform & PLATFORM_LPAR)
+       if (platform_is_lpar())
                ppc_md.enable_pmcs = pseries_lpar_enable_pmcs;
        else
                ppc_md.enable_pmcs = power4_enable_pmcs;
@@ -378,7 +378,7 @@ static void __init pSeries_init_early(void)
 
        fw_feature_init();
        
-       if (systemcfg->platform & PLATFORM_LPAR)
+       if (platform_is_lpar())
                hpte_init_lpar();
        else {
                hpte_init_native();
@@ -388,7 +388,7 @@ static void __init pSeries_init_early(void)
 
        generic_find_legacy_serial_ports(&physport, &default_speed);
 
-       if (systemcfg->platform & PLATFORM_LPAR)
+       if (platform_is_lpar())
                find_udbg_vterm();
        else if (physport) {
                /* Map the uart for udbg. */
@@ -592,7 +592,7 @@ static void pseries_shared_idle(void)
 
 static int pSeries_pci_probe_mode(struct pci_bus *bus)
 {
-       if (systemcfg->platform & PLATFORM_LPAR)
+       if (platform_is_lpar())
                return PCI_PROBE_DEVTREE;
        return PCI_PROBE_NORMAL;
 }
index 7a243e8ccd7ea254002a84d2442ab173c8c8920f..3ba794ca3288c72fbed747cf1f254fdd5c8ed59a 100644 (file)
@@ -46,6 +46,7 @@
 #include <asm/rtas.h>
 #include <asm/pSeries_reconfig.h>
 #include <asm/mpic.h>
+#include <asm/systemcfg.h>
 
 #include "plpar_wrappers.h"
 
@@ -96,7 +97,7 @@ int pSeries_cpu_disable(void)
        int cpu = smp_processor_id();
 
        cpu_clear(cpu, cpu_online_map);
-       systemcfg->processorCount--;
+       _systemcfg->processorCount--;
 
        /*fix boot_cpuid here*/
        if (cpu == boot_cpuid)
@@ -441,7 +442,7 @@ void __init smp_init_pSeries(void)
        smp_ops->cpu_die = pSeries_cpu_die;
 
        /* Processors can be added/removed only on LPAR */
-       if (systemcfg->platform == PLATFORM_PSERIES_LPAR)
+       if (platform_is_lpar())
                pSeries_reconfig_notifier_register(&pSeries_smp_nb);
 #endif
 
index 405c4f3229b363cf7cc619d9eba96aa4e465725f..72ac18067ecef58c4af36c49502e387be119d3fd 100644 (file)
@@ -545,7 +545,9 @@ nextnode:
                of_node_put(np);
        }
 
-       if (systemcfg->platform == PLATFORM_PSERIES) {
+       if (platform_is_lpar())
+               ops = &pSeriesLP_ops;
+       else {
 #ifdef CONFIG_SMP
                for_each_cpu(i) {
                        int hard_id;
@@ -561,8 +563,6 @@ nextnode:
 #else
                xics_per_cpu[0] = ioremap(intr_base, intr_size);
 #endif /* CONFIG_SMP */
-       } else if (systemcfg->platform == PLATFORM_PSERIES_LPAR) {
-               ops = &pSeriesLP_ops;
        }
 
        xics_8259_pic.enable = i8259_pic.enable;
index 307077f14936db7e12ea9a62dd13c538dc3b6c3a..66073f775193d2084ef7b629cf130f9e744c3bd3 100644 (file)
@@ -217,9 +217,6 @@ EXPORT_SYMBOL(adb_try_handler_change);
 EXPORT_SYMBOL(cuda_request);
 EXPORT_SYMBOL(cuda_poll);
 #endif /* CONFIG_ADB_CUDA */
-#ifdef CONFIG_PPC_MULTIPLATFORM
-EXPORT_SYMBOL(_machine);
-#endif
 #ifdef CONFIG_PPC_PMAC
 EXPORT_SYMBOL(sys_ctrler);
 EXPORT_SYMBOL(pmac_newworld);
index 6bcb85d2b7fd92be45bf49d1b7e9d23526c0276e..dc55e1abc45bde685741522caa14f1cfae7cfb5e 100644 (file)
@@ -76,6 +76,7 @@ unsigned int DMA_MODE_WRITE;
 
 #ifdef CONFIG_PPC_MULTIPLATFORM
 int _machine = 0;
+EXPORT_SYMBOL(_machine);
 
 extern void prep_init(unsigned long r3, unsigned long r4,
                unsigned long r5, unsigned long r6, unsigned long r7);
index bce9065da6cbea1f193477637008290b5953114c..84ab5c18ef529b66eecc3e3d25ddfc588668a510 100644 (file)
@@ -74,7 +74,6 @@ int main(void)
        DEFINE(ICACHEL1LINESIZE, offsetof(struct ppc64_caches, iline_size));
        DEFINE(ICACHEL1LOGLINESIZE, offsetof(struct ppc64_caches, log_iline_size));
        DEFINE(ICACHEL1LINESPERPAGE, offsetof(struct ppc64_caches, ilines_per_page));
-       DEFINE(PLATFORM, offsetof(struct systemcfg, platform));
        DEFINE(PLATFORM_LPAR, PLATFORM_LPAR);
 
        /* paca */
index 9e8050ea1225fa05c002328203d76ca94d82f6dc..1c869ea72d28448c45124e5e881a307e7e0d5388 100644 (file)
@@ -28,7 +28,6 @@
 #include <asm/processor.h>
 #include <asm/page.h>
 #include <asm/mmu.h>
-#include <asm/systemcfg.h>
 #include <asm/ppc_asm.h>
 #include <asm/asm-offsets.h>
 #include <asm/bug.h>
@@ -1701,21 +1700,9 @@ _GLOBAL(__secondary_start)
        HMT_MEDIUM                      /* Set thread priority to MEDIUM */
 
        ld      r2,PACATOC(r13)
-       li      r6,0
-       stb     r6,PACAPROCENABLED(r13)
-
-#ifndef CONFIG_PPC_ISERIES
-       /* Initialize the page table pointer register. */
-       LOADADDR(r6,_SDR1)
-       ld      r6,0(r6)                /* get the value of _SDR1        */
-       mtspr   SPRN_SDR1,r6                    /* set the htab location         */
-#endif
-       /* Initialize the first segment table (or SLB) entry             */
-       ld      r3,PACASTABVIRT(r13)    /* get addr of segment table     */
-BEGIN_FTR_SECTION
-       bl      .stab_initialize
-END_FTR_SECTION_IFCLR(CPU_FTR_SLB)
-       bl      .slb_initialize
+
+       /* Do early setup for that CPU */
+       bl      .early_setup_secondary
 
        /* Initialize the kernel stack.  Just a repeat for iSeries.      */
        LOADADDR(r3,current_set)
@@ -1724,37 +1711,6 @@ END_FTR_SECTION_IFCLR(CPU_FTR_SLB)
        addi    r1,r1,THREAD_SIZE-STACK_FRAME_OVERHEAD
        std     r1,PACAKSAVE(r13)
 
-       ld      r3,PACASTABREAL(r13)    /* get raddr of segment table    */
-       ori     r4,r3,1                 /* turn on valid bit             */
-
-#ifdef CONFIG_PPC_ISERIES
-       li      r0,-1                   /* hypervisor call */
-       li      r3,1
-       sldi    r3,r3,63                /* 0x8000000000000000 */
-       ori     r3,r3,4                 /* 0x8000000000000004 */
-       sc                              /* HvCall_setASR */
-#else
-       /* set the ASR */
-       ld      r3,systemcfg@got(r2)    /* r3 = ptr to systemcfg         */
-       ld      r3,0(r3)
-       lwz     r3,PLATFORM(r3)         /* r3 = platform flags           */
-       andi.   r3,r3,PLATFORM_LPAR     /* Test if bit 0 is set (LPAR bit) */
-       beq     98f                     /* branch if result is 0  */
-       mfspr   r3,SPRN_PVR
-       srwi    r3,r3,16
-       cmpwi   r3,0x37                 /* SStar  */
-       beq     97f
-       cmpwi   r3,0x36                 /* IStar  */
-       beq     97f
-       cmpwi   r3,0x34                 /* Pulsar */
-       bne     98f
-97:    li      r3,H_SET_ASR            /* hcall = H_SET_ASR */
-       HVSC                            /* Invoking hcall */
-       b       99f
-98:                                    /* !(rpa hypervisor) || !(star)  */
-       mtasr   r4                      /* set the stab location         */
-99:
-#endif
        li      r7,0
        mtlr    r7
 
@@ -1896,40 +1852,6 @@ _STATIC(start_here_multiplatform)
        mr      r3,r31
        bl      .early_setup
 
-       /* set the ASR */
-       ld      r3,PACASTABREAL(r13)
-       ori     r4,r3,1                 /* turn on valid bit             */
-       ld      r3,systemcfg@got(r2)    /* r3 = ptr to systemcfg */
-       ld      r3,0(r3)
-       lwz     r3,PLATFORM(r3)         /* r3 = platform flags */
-       andi.   r3,r3,PLATFORM_LPAR     /* Test if bit 0 is set (LPAR bit) */
-       beq     98f                     /* branch if result is 0  */
-       mfspr   r3,SPRN_PVR
-       srwi    r3,r3,16
-       cmpwi   r3,0x37                 /* SStar */
-       beq     97f
-       cmpwi   r3,0x36                 /* IStar  */
-       beq     97f
-       cmpwi   r3,0x34                 /* Pulsar */
-       bne     98f
-97:    li      r3,H_SET_ASR            /* hcall = H_SET_ASR */
-       HVSC                            /* Invoking hcall */
-       b       99f
-98:                                    /* !(rpa hypervisor) || !(star) */
-       mtasr   r4                      /* set the stab location        */
-99:
-       /* Set SDR1 (hash table pointer) */
-       ld      r3,systemcfg@got(r2)    /* r3 = ptr to systemcfg */
-       ld      r3,0(r3)
-       lwz     r3,PLATFORM(r3)         /* r3 = platform flags */
-       /* Test if bit 0 is set (LPAR bit) */
-       andi.   r3,r3,PLATFORM_LPAR
-       bne     98f                     /* branch if result is !0  */
-       LOADADDR(r6,_SDR1)              /* Only if NOT LPAR */
-       sub     r6,r6,r26
-       ld      r6,0(r6)                /* get the value of _SDR1 */
-       mtspr   SPRN_SDR1,r6                    /* set the htab location  */
-98: 
        LOADADDR(r3,.start_here_common)
        SET_REG_TO_CONST(r4, MSR_KERNEL)
        mtspr   SPRN_SRR0,r3
index 715bc0e71e0f4dbc45327ce08a59a5a1ab58a335..b879d3057ef83d5ba5287321a6d3d5550554b8d3 100644 (file)
@@ -26,7 +26,6 @@
 #include <asm/processor.h>
 #include <asm/cputable.h>
 #include <asm/time.h>
-#include <asm/systemcfg.h>
 #include <asm/machdep.h>
 #include <asm/smp.h>
 
index 3e7b2f28ec8302a4b9025a5cdde84296b9c30e7e..a80ed307515c12dc045377c0670f0f1528f1fae0 100644 (file)
@@ -35,6 +35,7 @@
 #include <asm/time.h>
 #include <asm/iseries/it_exp_vpd_panel.h>
 #include <asm/prom.h>
+#include <asm/systemcfg.h>
 
 #define MODULE_VERS "1.6"
 #define MODULE_NAME "lparcfg"
@@ -371,7 +372,7 @@ static int lparcfg_data(struct seq_file *m, void *v)
        lrdrp = (int *)get_property(rtas_node, "ibm,lrdr-capacity", NULL);
 
        if (lrdrp == NULL) {
-               partition_potential_processors = systemcfg->processorCount;
+               partition_potential_processors = _systemcfg->processorCount;
        } else {
                partition_potential_processors = *(lrdrp + 4);
        }
index 4fb1a9f5060deb66b78867755ba31c320afd71b8..c0fcd29918cec0b3fea13b26177877807f076e24 100644 (file)
@@ -31,7 +31,6 @@
 #include <asm/rtas.h>
 #include <asm/prom.h>
 #include <asm/machdep.h>
-#include <asm/systemcfg.h>
 
 #undef DEBUG_NVRAM
 
@@ -167,7 +166,7 @@ static int dev_nvram_ioctl(struct inode *inode, struct file *file,
        case IOC_NVRAM_GET_OFFSET: {
                int part, offset;
 
-               if (systemcfg->platform != PLATFORM_POWERMAC)
+               if (_machine != PLATFORM_POWERMAC)
                        return -EINVAL;
                if (copy_from_user(&part, (void __user*)arg, sizeof(part)) != 0)
                        return -EFAULT;
@@ -450,7 +449,7 @@ static int nvram_setup_partition(void)
         * in our nvram, as Apple defined partitions use pretty much
         * all of the space
         */
-       if (systemcfg->platform == PLATFORM_POWERMAC)
+       if (_machine == PLATFORM_POWERMAC)
                return -ENOSPC;
 
        /* see if we have an OS partition that meets our needs.
index 30247ff74972d3ef3a4048b3baca0d24141e5420..66698fdf059ec6f39953dfdec83f330fdb238da6 100644 (file)
@@ -1277,12 +1277,9 @@ long sys_pciconfig_iobase(long which, unsigned long in_bus,
         * G5 machines... So when something asks for bus 0 io base
         * (bus 0 is HT root), we return the AGP one instead.
         */
-#ifdef CONFIG_PPC_PMAC
-       if (systemcfg->platform == PLATFORM_POWERMAC &&
-           machine_is_compatible("MacRISC4"))
+       if (machine_is_compatible("MacRISC4"))
                if (in_bus == 0)
                        in_bus = 0xf0;
-#endif /* CONFIG_PPC_PMAC */
 
        /* That syscall isn't quite compatible with PCI domains, but it's
         * used on pre-domains setup. We return the first match
index 24e955ee9487420ac5b82945c0464aa08a80a17b..c893a11ee198c108689a99a8bc63a90f13db4de7 100644 (file)
@@ -53,7 +53,7 @@ static int __init proc_ppc64_create(void)
        if (!root)
                return 1;
 
-       if (!(systemcfg->platform & (PLATFORM_PSERIES | PLATFORM_CELL)))
+       if (!(platform_is_pseries() || _machine == PLATFORM_CELL))
                return 0;
 
        if (!proc_mkdir("rtas", root))
@@ -74,7 +74,7 @@ static int __init proc_ppc64_init(void)
        if (!pde)
                return 1;
        pde->nlink = 1;
-       pde->data = systemcfg;
+       pde->data = _systemcfg;
        pde->size = PAGE_SIZE;
        pde->proc_fops = &page_map_fops;
 
index 3402fbee62c74af1faf5ccd7013afc4199c4ce2b..fbad2c360784edaa0d181812fdf0f8af39730c7e 100644 (file)
@@ -318,7 +318,7 @@ static int __devinit finish_node_interrupts(struct device_node *np,
                }
 
                /* We offset irq numbers for the u3 MPIC by 128 in PowerMac */
-               if (systemcfg->platform == PLATFORM_POWERMAC && ic && ic->parent) {
+               if (_machine == PLATFORM_POWERMAC && ic && ic->parent) {
                        char *name = get_property(ic->parent, "name", NULL);
                        if (name && !strcmp(name, "u3"))
                                np->intrs[intrcount].line += 128;
@@ -1065,7 +1065,7 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
        prop = (u32 *)of_get_flat_dt_prop(node, "linux,platform", NULL);
        if (prop == NULL)
                return 0;
-       systemcfg->platform = *prop;
+       _machine = *prop;
 
        /* check if iommu is forced on or off */
        if (of_get_flat_dt_prop(node, "linux,iommu-off", NULL) != NULL)
@@ -1230,11 +1230,8 @@ void __init early_init_devtree(void *params)
        of_scan_flat_dt(early_init_dt_scan_memory, NULL);
        lmb_enforce_memory_limit(memory_limit);
        lmb_analyze();
-       systemcfg->physicalMemorySize = lmb_phys_mem_size();
        lmb_reserve(0, __pa(klimit));
 
-       DBG("Phys. mem: %lx\n", systemcfg->physicalMemorySize);
-
        /* Reserve LMB regions used by kernel, initrd, dt, etc... */
        early_reserve_mem();
 
@@ -1753,7 +1750,7 @@ static int of_finish_dynamic_node(struct device_node *node,
        /* We don't support that function on PowerMac, at least
         * not yet
         */
-       if (systemcfg->platform == PLATFORM_POWERMAC)
+       if (_machine == PLATFORM_POWERMAC)
                return -ENODEV;
 
        /* fix up new node's linux_phandle field */
index e4c880dab997bf9cc7baeb33efe3cd54bcca22fc..6375f40b23db8176b601b1ddb28f14993e6b5737 100644 (file)
@@ -1934,7 +1934,8 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4, unsigned long
        /*
         * On pSeries, inform the firmware about our capabilities
         */
-       if (RELOC(of_platform) & PLATFORM_PSERIES)
+       if (RELOC(of_platform) == PLATFORM_PSERIES ||
+           RELOC(of_platform) == PLATFORM_PSERIES_LPAR)
                prom_send_capabilities();
 
        /*
index 4aacf521e3e445466e4133955bfe2b5accbf09b3..1bbacac44988168e58ce2d06888f195055d2697e 100644 (file)
@@ -34,6 +34,7 @@
 #include <asm/machdep.h>
 #include <asm/cputable.h>
 #include <asm/sections.h>
+#include <asm/systemcfg.h>
 #include <asm/vdso.h>
 
 #undef DEBUG
@@ -179,7 +180,7 @@ static struct page * vdso_vma_nopage(struct vm_area_struct * vma,
         * Last page is systemcfg.
         */
        if ((vma->vm_end - address) <= PAGE_SIZE)
-               pg = virt_to_page(systemcfg);
+               pg = virt_to_page(_systemcfg);
        else
                pg = virt_to_page(vbase + offset);
 
@@ -604,7 +605,7 @@ void __init vdso_init(void)
                get_page(pg);
        }
 
-       get_page(virt_to_page(systemcfg));
+       get_page(virt_to_page(_systemcfg));
 }
 
 int in_gate_area_no_task(unsigned long addr)
index 806c142ae9ea9dfa15622514bff45b0ffcc76be9..12fabbcb04f04a7bcb7ec248c39fdbeedb0ea915 100644 (file)
@@ -43,6 +43,7 @@
 #define FW_FEATURE_ISERIES     (1UL<<21)
 
 enum {
+#ifdef CONFIG_PPC64
        FW_FEATURE_PSERIES_POSSIBLE = FW_FEATURE_PFT | FW_FEATURE_TCE |
                FW_FEATURE_SPRG0 | FW_FEATURE_DABR | FW_FEATURE_COPY |
                FW_FEATURE_ASR | FW_FEATURE_DEBUG | FW_FEATURE_TERM |
@@ -70,6 +71,11 @@ enum {
                FW_FEATURE_ISERIES_ALWAYS &
 #endif
                FW_FEATURE_POSSIBLE,
+
+#else /* CONFIG_PPC64 */
+       FW_FEATURE_POSSIBLE = 0,
+       FW_FEATURE_ALWAYS = 0,
+#endif
 };
 
 /* This is used to identify firmware features which are available
index 1dc4bf7b52b302533b2909ff688d883816cf1b9a..82e3f4e6550d8f6b5f27bd575583af7dd62f768e 100644 (file)
 #include <linux/compiler.h>
 #include <asm/ptrace.h>
 #include <asm/types.h>
-#ifdef CONFIG_PPC64
-#include <asm/systemcfg.h>
-#endif
 
-#ifdef CONFIG_PPC32
-/* 32-bit platform types */
-/* We only need to define a new _MACH_xxx for machines which are part of
- * a configuration which supports more than one type of different machine.
- * This is currently limited to CONFIG_PPC_MULTIPLATFORM and CHRP/PReP/PMac.
- * -- Tom
+/* We do _not_ want to define new machine types at all, those must die
+ * in favor of using the device-tree
+ * -- BenH.
  */
-#define _MACH_prep     0x00000001
-#define _MACH_Pmac     0x00000002      /* pmac or pmac clone (non-chrp) */
-#define _MACH_chrp     0x00000004      /* chrp machine */
 
-/* see residual.h for these */
+/* Platforms codes (to be obsoleted) */
+#define PLATFORM_PSERIES       0x0100
+#define PLATFORM_PSERIES_LPAR  0x0101
+#define PLATFORM_ISERIES_LPAR  0x0201
+#define PLATFORM_LPAR          0x0001
+#define PLATFORM_POWERMAC      0x0400
+#define PLATFORM_MAPLE         0x0500
+#define PLATFORM_PREP          0x0600
+#define PLATFORM_CHRP          0x0700
+#define PLATFORM_CELL          0x1000
+
+/* Compat platform codes for 32 bits */
+#define _MACH_prep     PLATFORM_PREP
+#define _MACH_Pmac     PLATFORM_POWERMAC
+#define _MACH_chrp     PLATFORM_CHRP
+
+/* PREP sub-platform types see residual.h for these */
 #define _PREP_Motorola 0x01    /* motorola prep */
 #define _PREP_Firm     0x02    /* firmworks prep */
 #define _PREP_IBM      0x00    /* ibm prep */
 #define _PREP_Bull     0x03    /* bull prep */
 
-/* these are arbitrary */
+/* CHRP sub-platform types. These are arbitrary */
 #define _CHRP_Motorola 0x04    /* motorola chrp, the cobra */
 #define _CHRP_IBM      0x05    /* IBM chrp, the longtrail and longtrail 2 */
 #define _CHRP_Pegasos  0x06    /* Genesi/bplan's Pegasos and Pegasos2 */
 
-#ifdef CONFIG_PPC_MULTIPLATFORM
+#define platform_is_pseries()  (_machine == PLATFORM_PSERIES || \
+                                _machine == PLATFORM_PSERIES_LPAR)
+#define platform_is_lpar()     (!!(_machine & PLATFORM_LPAR))
+
+#if defined(CONFIG_PPC_MULTIPLATFORM)
 extern int _machine;
 
+#ifdef CONFIG_PPC32
+
 /* what kind of prep workstation we are */
 extern int _prep_type;
 extern int _chrp_type;
 
 /*
  * This is used to identify the board type from a given PReP board
- * vendor. Board revision is also made available.
+ * vendor. Board revision is also made available. This will be moved
+ * elsewhere soon
  */
 extern unsigned char ucSystemType;
 extern unsigned char ucBoardRev;
 extern unsigned char ucBoardRevMaj, ucBoardRevMin;
+
+#endif /* CONFIG_PPC32 */
+
+#elif defined(CONFIG_PPC_ISERIES)
+/*
+ * iSeries is soon to become MULTIPLATFORM hopefully ...
+ */
+#define _machine CONFIG_PPC_ISERIES_LPAR
 #else
 #define _machine 0
 #endif /* CONFIG_PPC_MULTIPLATFORM */
-#endif /* CONFIG_PPC32 */
 
-#ifdef CONFIG_PPC64
-/* Platforms supported by PPC64 */
-#define PLATFORM_PSERIES      0x0100
-#define PLATFORM_PSERIES_LPAR 0x0101
-#define PLATFORM_ISERIES_LPAR 0x0201
-#define PLATFORM_LPAR         0x0001
-#define PLATFORM_POWERMAC     0x0400
-#define PLATFORM_MAPLE        0x0500
-#define PLATFORM_CELL         0x1000
-
-/* Compatibility with drivers coming from PPC32 world */
-#define _machine       (systemcfg->platform)
-#define _MACH_Pmac     PLATFORM_POWERMAC
-#endif
+
+
 
 /*
  * Default implementation of macro that returns current
index ef121f4f0bab2d82b25ea19d8f66008f9fead804..eb392d038ed7dacdaea492f65f6311494bed17cd 100644 (file)
 #define SPRN_RPA       0x3D6   /* Required Physical Address Register */
 #define SPRN_SDA       0x3BF   /* Sampled Data Address Register */
 #define SPRN_SDR1      0x019   /* MMU Hash Base Register */
+#define SPRN_ASR       0x118   /* Address Space Register */
 #define SPRN_SIA       0x3BB   /* Sampled Instruction Address Register */
 #define SPRN_SPRG0     0x110   /* Special Purpose Register General 0 */
 #define SPRN_SPRG1     0x111   /* Special Purpose Register General 1 */
similarity index 96%
rename from include/asm-ppc64/systemcfg.h
rename to include/asm-powerpc/systemcfg.h
index 9b86b53129aa881715fafca0cbc62b784d6f978f..36b5cbe466f19911d53ef88d3950790be6b9d133 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef _SYSTEMCFG_H
 #define _SYSTEMCFG_H
 
-/* 
+/*
  * Copyright (C) 2002 Peter Bergner <bergner@vnet.ibm.com>, IBM
  *
  * This program is free software; you can redistribute it and/or
@@ -12,7 +12,7 @@
 
 /* Change Activity:
  * 2002/09/30 : bergner  : Created
- * End Change Activity 
+ * End Change Activity
  */
 
 /*
@@ -56,7 +56,7 @@ struct systemcfg {
 };
 
 #ifdef __KERNEL__
-extern struct systemcfg *systemcfg;
+extern struct systemcfg *_systemcfg; /* to be renamed */
 #endif
 
 #endif /* __ASSEMBLY__ */
index d50997bace1c4160b6c0826540e3e41cd2837d45..c43d512d5902c231a713ceea663344bf2967ec67 100644 (file)
@@ -224,6 +224,8 @@ extern int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
                             unsigned long pstart, unsigned long mode,
                             int psize);
 
+extern void htab_initialize(void);
+extern void htab_initialize_secondary(void);
 extern void hpte_init_native(void);
 extern void hpte_init_lpar(void);
 extern void hpte_init_iSeries(void);
@@ -245,6 +247,7 @@ extern long iSeries_hpte_insert(unsigned long hpte_group,
 
 extern void stabs_alloc(void);
 extern void slb_initialize(void);
+extern void stab_initialize(unsigned long stab);
 
 #endif /* __ASSEMBLY__ */