Remove the tracing from the AP startup. The AP is known

to start and the tracing can interfere with AP startup.
Instead, use the available space in the reset vector
for the initial stack.
This commit is contained in:
marcel 2008-09-16 01:05:54 +00:00
parent 5e985b386a
commit 1e7ba9e4d7
5 changed files with 12 additions and 91 deletions

View File

@ -604,14 +604,11 @@ om_cmp(const void *a, const void *b)
}
void
pmap_cpu_bootstrap(volatile uint32_t *trcp, int ap)
pmap_cpu_bootstrap(int ap)
{
u_int sdr;
int i;
trcp[0] = 0x1000;
trcp[1] = (uint32_t)&pmap_cpu_bootstrap;
if (ap) {
__asm __volatile("mtdbatu 0,%0" :: "r"(battable[0].batu));
__asm __volatile("mtdbatl 0,%0" :: "r"(battable[0].batl));
@ -621,14 +618,10 @@ pmap_cpu_bootstrap(volatile uint32_t *trcp, int ap)
isync();
}
trcp[0] = 0x1001;
__asm __volatile("mtdbatu 1,%0" :: "r"(battable[8].batu));
__asm __volatile("mtdbatl 1,%0" :: "r"(battable[8].batl));
isync();
trcp[0] = 0x1002;
__asm __volatile("mtibatu 1,%0" :: "r"(0));
__asm __volatile("mtdbatu 2,%0" :: "r"(0));
__asm __volatile("mtibatu 2,%0" :: "r"(0));
@ -636,29 +629,18 @@ pmap_cpu_bootstrap(volatile uint32_t *trcp, int ap)
__asm __volatile("mtibatu 3,%0" :: "r"(0));
isync();
trcp[0] = 0x1003;
for (i = 0; i < 16; i++)
mtsrin(i << ADDR_SR_SHFT, EMPTY_SEGMENT);
trcp[0] = 0x1004;
__asm __volatile("mtsr %0,%1" :: "n"(KERNEL_SR), "r"(KERNEL_SEGMENT));
__asm __volatile("mtsr %0,%1" :: "n"(KERNEL2_SR), "r"(KERNEL2_SEGMENT));
__asm __volatile("sync");
trcp[0] = 0x1005;
sdr = (u_int)moea_pteg_table | (moea_pteg_mask >> 10);
__asm __volatile("mtsdr1 %0" :: "r"(sdr));
isync();
trcp[0] = 0x1006;
trcp[1] = sdr;
tlbia();
trcp[0] = 0x1007;
}
void
@ -669,7 +651,6 @@ moea_bootstrap(mmu_t mmup, vm_offset_t kernelstart, vm_offset_t kernelend)
int sz;
int i, j;
int ofw_mappings;
uint32_t trace[2];
vm_size_t size, physsz, hwphyssz;
vm_offset_t pa, va, off;
@ -898,7 +879,7 @@ moea_bootstrap(mmu_t mmup, vm_offset_t kernelstart, vm_offset_t kernelend)
kernel_pmap->pm_sr[KERNEL2_SR] = KERNEL2_SEGMENT;
kernel_pmap->pm_active = ~0;
pmap_cpu_bootstrap(trace, 0);
pmap_cpu_bootstrap(0);
pmap_bootstrapped++;

View File

@ -139,57 +139,36 @@ powerpc_smp_get_bsp(struct cpuref *cpuref)
}
uint32_t
cpudep_ap_bootstrap(volatile uint32_t *trcp)
cpudep_ap_bootstrap(void)
{
uint32_t hid, msr, sp;
trcp[0] = 0x2000;
trcp[1] = (uint32_t)&cpudep_ap_bootstrap;
__asm __volatile("mtsprg 0, %0" :: "r"(ap_pcpu));
__asm __volatile("sync");
trcp[0] = 0x2001;
trcp[1] = (uint32_t)pcpup;
hid = mfspr(SPR_HID0);
hid &= ~(HID0_ICE | HID0_DCE);
hid &= ~(HID0_DOZE | HID0_NAP | HID0_SLEEP);
mtspr(SPR_HID0, hid);
isync();
trcp[0] = 0x2002;
trcp[1] = hid;
hid |= HID0_ICFI | HID0_DCFI;
hid |= HID0_ICE | HID0_DCE;
mtspr(SPR_HID0, hid);
isync();
trcp[0] = 0x2003;
trcp[1] = hid;
msr = PSL_IR | PSL_DR | PSL_ME | PSL_RI;
mtmsr(msr);
isync();
trcp[0] = 0x2004;
trcp[1] = msr;
hid |= HID0_NAP | HID0_DPM;
mtspr(SPR_HID0, hid);
isync();
trcp[0] = 0x2005;
trcp[1] = hid;
pcpup->pc_curthread = pcpup->pc_idlethread;
pcpup->pc_curpcb = pcpup->pc_curthread->td_pcb;
sp = pcpup->pc_curpcb->pcb_sp;
trcp[0] = 0x2006;
trcp[1] = sp;
return (sp);
}
@ -197,9 +176,7 @@ int
powerpc_smp_start_cpu(struct pcpu *pc)
{
phandle_t cpu;
volatile uint32_t *trcp;
volatile uint8_t *rstvec;
uint32_t trace;
int res, reset, timeout;
cpu = pc->pc_hwref;
@ -207,9 +184,6 @@ powerpc_smp_start_cpu(struct pcpu *pc)
if (res < 0)
return (ENXIO);
trcp = (uint32_t *)(EXC_RST + 4);
trace = *trcp;
ap_pcpu = pc;
rstvec = (uint8_t *)(0x80000000 + reset);
@ -224,8 +198,5 @@ powerpc_smp_start_cpu(struct pcpu *pc)
while (!pc->pc_awake && timeout--)
DELAY(100);
if (!pc->pc_awake)
printf("XXX: timeout (trace=%x; data=%x)\n", trcp[0], trcp[1]);
return (0);
return ((pc->pc_awake) ? 0 : EBUSY);
}

View File

@ -238,44 +238,16 @@
CNAME(rstcode):
bl 1f
/* We use this space for tracing purposes. */
.long 0
.long 0
.space 124
1:
mflr %r2
mfmsr %r3
stw %r2,0(%r2) /* trace: 0x104 - we're here. */
stw %r3,4(%r2) /* trace data: MSR */
sync
mflr %r1
addi %r1,%r1,(124-16)@l
lis %r1,(tmpstk+TMPSTKSZ-16)@ha
addi %r1,%r1,(tmpstk+TMPSTKSZ-16)@l
addi %r3,%r2,4
stw %r3,0(%r1)
sync
stw %r3,0(%r2) /* trace: 0x108 - stack is writable */
stw %r1,4(%r2) /* trace data: SP */
sync
mr %r3,%r2
lis %r4,1@l
lis %r3,1@l
bla CNAME(pmap_cpu_bootstrap)
addi %r3,%r2,8
stw %r3,0(%r2) /* trace 0x10c - back from 1st call */
sync
mr %r3,%r2
bla CNAME(cpudep_ap_bootstrap)
mr %r1,%r3
addi %r3,%r2,12
stw %r3,0(%r2) /* trace 0x110 - back from 2nd call */
stw %r1,4(%r2) /* trace data: SP */
mr %r3,%r2
bla CNAME(machdep_ap_bootstrap)
/* Should not be reached */

View File

@ -55,9 +55,9 @@ int powerpc_smp_get_bsp(struct cpuref *);
int powerpc_smp_next_cpu(struct cpuref *);
int powerpc_smp_start_cpu(struct pcpu *);
void pmap_cpu_bootstrap(volatile uint32_t *, int);
uint32_t cpudep_ap_bootstrap(volatile uint32_t *);
void machdep_ap_bootstrap(volatile uint32_t *);
void pmap_cpu_bootstrap(int);
uint32_t cpudep_ap_bootstrap(void);
void machdep_ap_bootstrap(void);
#endif /* !LOCORE */
#endif /* _KERNEL */

View File

@ -52,12 +52,9 @@ volatile static uint32_t ap_decr;
int mp_ipi_test = 0;
void
machdep_ap_bootstrap(volatile uint32_t *trcp)
machdep_ap_bootstrap(void)
{
trcp[0] = 0x3000;
trcp[1] = (uint32_t)&machdep_ap_bootstrap;
// __asm __volatile("mtspr 1023,%0" :: "r"(PCPU_GET(cpuid)));
__asm __volatile("mfspr %0,1023" : "=r"(pcpup->pc_pir));
pcpup->pc_awake = 1;