From adc9c9c3ec7d8cba50596f691c5c1212a0ea9649 Mon Sep 17 00:00:00 2001 From: Olof Johansson Date: Wed, 22 Aug 2007 12:26:43 +1000 Subject: [PATCH] --- yaml --- r: 67259 b: refs/heads/master c: dc559f7cd5d6d11a99b6c29402b31fbb3f3a1db0 h: refs/heads/master i: 67257: f6798c7a6df01ab480861cf5c42bfc17e3c913c3 67255: f3c586795f663d326079000ecf6f0b7ade8791e2 v: v3 --- [refs] | 2 +- trunk/arch/powerpc/platforms/pasemi/setup.c | 24 ++++++++++++--------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/[refs] b/[refs] index faa621788471..b4473e822af7 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: e5d8d54db25790524da34b0143f4e0176fb7677b +refs/heads/master: dc559f7cd5d6d11a99b6c29402b31fbb3f3a1db0 diff --git a/trunk/arch/powerpc/platforms/pasemi/setup.c b/trunk/arch/powerpc/platforms/pasemi/setup.c index ffe6528048b5..05def6282f83 100644 --- a/trunk/arch/powerpc/platforms/pasemi/setup.c +++ b/trunk/arch/powerpc/platforms/pasemi/setup.c @@ -50,26 +50,30 @@ static void pas_restart(char *cmd) #ifdef CONFIG_SMP static DEFINE_SPINLOCK(timebase_lock); +static unsigned long timebase; static void __devinit pas_give_timebase(void) { - unsigned long tb; - spin_lock(&timebase_lock); mtspr(SPRN_TBCTL, TBCTL_FREEZE); - tb = mftb(); - mtspr(SPRN_TBCTL, TBCTL_UPDATE_LOWER | (tb & 0xffffffff)); - mtspr(SPRN_TBCTL, TBCTL_UPDATE_UPPER | (tb >> 32)); - mtspr(SPRN_TBCTL, TBCTL_RESTART); + isync(); + timebase = get_tb(); spin_unlock(&timebase_lock); - pr_debug("pas_give_timebase: cpu %d gave tb %lx\n", - smp_processor_id(), tb); + + while (timebase) + barrier(); + mtspr(SPRN_TBCTL, TBCTL_RESTART); } static void __devinit pas_take_timebase(void) { - pr_debug("pas_take_timebase: cpu %d has tb %lx\n", - smp_processor_id(), mftb()); + while (!timebase) + smp_rmb(); + + spin_lock(&timebase_lock); + set_tb(timebase >> 32, timebase & 0xffffffff); + timebase = 0; + spin_unlock(&timebase_lock); } struct smp_ops_t pas_smp_ops = {