Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 36023
b: refs/heads/master
c: 60a6c37
h: refs/heads/master
i:
  36021: d086bec
  36019: 82f1b74
  36015: aa0f799
v: v3
  • Loading branch information
Atsushi Nemoto authored and Ralf Baechle committed Sep 27, 2006
1 parent b5d0aff commit 090fc68
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 18 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7fdeb048141b363a23b8cf6f6a226d74aca4d724
refs/heads/master: 60a6c3777ec607c5b19df9eac35088db4e142a6b
62 changes: 45 additions & 17 deletions trunk/arch/mips/kernel/cpu-probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,40 @@ static void r3081_wait(void)

static void r39xx_wait(void)
{
unsigned long cfg = read_c0_conf();
write_c0_conf(cfg | TX39_CONF_HALT);
local_irq_disable();
if (!need_resched())
write_c0_conf(read_c0_conf() | TX39_CONF_HALT);
local_irq_enable();
}

/*
* There is a race when WAIT instruction executed with interrupt
* enabled.
* But it is implementation-dependent wheter the pipelie restarts when
* a non-enabled interrupt is requested.
*/
static void r4k_wait(void)
{
__asm__(".set\tmips3\n\t"
"wait\n\t"
".set\tmips0");
__asm__(" .set mips3 \n"
" wait \n"
" .set mips0 \n");
}

/*
* This variant is preferable as it allows testing need_resched and going to
* sleep depending on the outcome atomically. Unfortunately the "It is
* implementation-dependent whether the pipeline restarts when a non-enabled
* interrupt is requested" restriction in the MIPS32/MIPS64 architecture makes
* using this version a gamble.
*/
static void r4k_wait_irqoff(void)
{
local_irq_disable();
if (!need_resched())
__asm__(" .set mips3 \n"
" wait \n"
" .set mips0 \n");
local_irq_enable();
}

/* The Au1xxx wait is available only if using 32khz counter or
Expand All @@ -56,17 +81,17 @@ int allow_au1k_wait;
static void au1k_wait(void)
{
/* using the wait instruction makes CP0 counter unusable */
__asm__(".set mips3\n\t"
"cache 0x14, 0(%0)\n\t"
"cache 0x14, 32(%0)\n\t"
"sync\n\t"
"nop\n\t"
"wait\n\t"
"nop\n\t"
"nop\n\t"
"nop\n\t"
"nop\n\t"
".set mips0\n\t"
__asm__(" .set mips3 \n"
" cache 0x14, 0(%0) \n"
" cache 0x14, 32(%0) \n"
" sync \n"
" nop \n"
" wait \n"
" nop \n"
" nop \n"
" nop \n"
" nop \n"
" .set mips0 \n"
: : "r" (au1k_wait));
}

Expand Down Expand Up @@ -111,7 +136,6 @@ static inline void check_wait(void)
case CPU_NEVADA:
case CPU_RM7000:
case CPU_RM9000:
case CPU_TX49XX:
case CPU_4KC:
case CPU_4KEC:
case CPU_4KSC:
Expand All @@ -125,6 +149,10 @@ static inline void check_wait(void)
cpu_wait = r4k_wait;
printk(" available.\n");
break;
case CPU_TX49XX:
cpu_wait = r4k_wait_irqoff;
printk(" available.\n");
break;
case CPU_AU1000:
case CPU_AU1100:
case CPU_AU1500:
Expand Down

0 comments on commit 090fc68

Please sign in to comment.