Skip to content

Commit

Permalink
powerpc: Merge 32-bit CHRP support.
Browse files Browse the repository at this point in the history
SMP still needs more work but UP gets as far as starting userspace
at least.  This uses the 64-bit-style code for spinning up the cpus.

Signed-off-by: Paul Mackerras <paulus@samba.org>
  • Loading branch information
Paul Mackerras committed Oct 26, 2005
1 parent 303d72a commit bbd0abd
Show file tree
Hide file tree
Showing 12 changed files with 1,256 additions and 37 deletions.
2 changes: 1 addition & 1 deletion arch/powerpc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ config U3_DART
default n

config MPIC
depends on PPC_PSERIES || PPC_PMAC || PPC_MAPLE
depends on PPC_PSERIES || PPC_PMAC || PPC_MAPLE || PPC_CHRP
bool
default y

Expand Down
9 changes: 8 additions & 1 deletion arch/powerpc/kernel/head_32.S
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ turn_on_mmu:
.globl __secondary_hold
__secondary_hold:
/* tell the master we're here */
stw r3,4(0)
stw r3,__secondary_hold_acknowledge@l(0)
#ifdef CONFIG_SMP
100: lwz r4,0(0)
/* wait until we're told to start */
Expand All @@ -220,6 +220,13 @@ __secondary_hold:
b .
#endif /* CONFIG_SMP */

.globl __secondary_hold_spinloop
__secondary_hold_spinloop:
.long 0
.globl __secondary_hold_acknowledge
__secondary_hold_acknowledge:
.long -1

/*
* Exception entry code. This code runs with address translation
* turned off, i.e. using physical addresses.
Expand Down
54 changes: 23 additions & 31 deletions arch/powerpc/kernel/prom_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -1155,9 +1155,18 @@ static void __init prom_initialize_tce_table(void)
*
* -- Cort
*/
extern void __secondary_hold(void);
extern unsigned long __secondary_hold_spinloop;
extern unsigned long __secondary_hold_acknowledge;

/*
* We want to reference the copy of __secondary_hold_* in the
* 0 - 0x100 address range
*/
#define LOW_ADDR(x) (((unsigned long) &(x)) & 0xff)

static void __init prom_hold_cpus(void)
{
#ifdef CONFIG_PPC64
unsigned long i;
unsigned int reg;
phandle node;
Expand All @@ -1166,20 +1175,18 @@ static void __init prom_hold_cpus(void)
unsigned int interrupt_server[MAX_CPU_THREADS];
unsigned int cpu_threads, hw_cpu_num;
int propsize;
extern void __secondary_hold(void);
extern unsigned long __secondary_hold_spinloop;
extern unsigned long __secondary_hold_acknowledge;
struct prom_t *_prom = &RELOC(prom);
unsigned long *spinloop
= (void *) __pa(&__secondary_hold_spinloop);
= (void *) LOW_ADDR(__secondary_hold_spinloop);
unsigned long *acknowledge
= (void *) __pa(&__secondary_hold_acknowledge);
= (void *) LOW_ADDR(__secondary_hold_acknowledge);
#ifdef CONFIG_PPC64
/* __secondary_hold is actually a descriptor, not the text address */
unsigned long secondary_hold
= __pa(*PTRRELOC((unsigned long *)__secondary_hold));
#else
unsigned long secondary_hold = __pa(&__secondary_hold);
unsigned long secondary_hold = LOW_ADDR(__secondary_hold);
#endif
struct prom_t *_prom = &RELOC(prom);

prom_debug("prom_hold_cpus: start...\n");
prom_debug(" 1) spinloop = 0x%x\n", (unsigned long)spinloop);
Expand All @@ -1197,9 +1204,8 @@ static void __init prom_hold_cpus(void)
*spinloop = 0;

#ifdef CONFIG_HMT
for (i = 0; i < NR_CPUS; i++) {
for (i = 0; i < NR_CPUS; i++)
RELOC(hmt_thread_data)[i].pir = 0xdeadbeef;
}
#endif
/* look for cpus */
for (node = 0; prom_next_node(&node); ) {
Expand Down Expand Up @@ -1250,34 +1256,22 @@ static void __init prom_hold_cpus(void)
call_prom("start-cpu", 3, 0, node,
secondary_hold, reg);

for ( i = 0 ; (i < 100000000) &&
(*acknowledge == ((unsigned long)-1)); i++ )
for (i = 0; (i < 100000000) &&
(*acknowledge == ((unsigned long)-1)); i++ )
mb();

if (*acknowledge == reg) {
if (*acknowledge == reg)
prom_printf("done\n");
/* We have to get every CPU out of OF,
* even if we never start it. */
if (cpuid >= NR_CPUS)
goto next;
} else {
else
prom_printf("failed: %x\n", *acknowledge);
}
}
#ifdef CONFIG_SMP
else
prom_printf("%x : boot cpu %x\n", cpuid, reg);
#endif
next:
#ifdef CONFIG_SMP
/* Init paca for secondary threads. They start later. */
for (i=1; i < cpu_threads; i++) {
cpuid++;
if (cpuid >= NR_CPUS)
continue;
}
#endif /* CONFIG_SMP */
cpuid++;

/* Reserve cpu #s for secondary threads. They start later. */
cpuid += cpu_threads;
}
#ifdef CONFIG_HMT
/* Only enable HMT on processors that provide support. */
Expand Down Expand Up @@ -1311,7 +1305,6 @@ static void __init prom_hold_cpus(void)
") exceeded: ignoring extras\n");

prom_debug("prom_hold_cpus: end...\n");
#endif
}


Expand Down Expand Up @@ -1940,7 +1933,6 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4,
unsigned long r6, unsigned long r7)
{
struct prom_t *_prom;
extern char _stext[];
unsigned long hdr;
u32 getprop_rval;
unsigned long offset = reloc_offset();
Expand Down
4 changes: 4 additions & 0 deletions arch/powerpc/kernel/setup_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ extern void power4_idle(void);
boot_infos_t *boot_infos;
struct ide_machdep_calls ppc_ide_md;

/* XXX should go elsewhere */
int __irq_offset_value;
EXPORT_SYMBOL(__irq_offset_value);

/* Used with the BI_MEMSIZE bootinfo parameter to store the memory
size value reported by the boot loader. */
unsigned long boot_mem_size;
Expand Down
1 change: 1 addition & 0 deletions arch/powerpc/platforms/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ ifeq ($(CONFIG_PPC64),y)
obj-$(CONFIG_PPC_PMAC) += powermac/
endif
endif
obj-$(CONFIG_PPC_CHRP) += chrp/
obj-$(CONFIG_4xx) += 4xx/
obj-$(CONFIG_85xx) += 85xx/
obj-$(CONFIG_PPC_PSERIES) += pseries/
Expand Down
3 changes: 3 additions & 0 deletions arch/powerpc/platforms/chrp/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
obj-y += setup.o time.o pegasos_eth.o
obj-$(CONFIG_PCI) += pci.o
obj-$(CONFIG_SMP) += smp.o
Loading

0 comments on commit bbd0abd

Please sign in to comment.