Commit 799d6046 authored by Paul Mackerras's avatar Paul Mackerras

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