Use local TLB_UNLOCKED marker instead of MTX_UNOWNED for Book-E PowerPC trap

routines.

This unbreaks Book-E build after the recent machine/mutex.h removal.

While there move tlb_*lock() prototypes to machine/tlb.h.

Submitted by:	jhb
This commit is contained in:
raj 2010-11-11 13:35:23 +00:00
parent 54af98ea87
commit 2222bc72a4
4 changed files with 11 additions and 7 deletions

View File

@ -453,7 +453,7 @@ cpu_pcpu_init(struct pcpu *pcpu, int cpuid, size_t sz)
ptr = &tlb0_miss_locks[cpuid * words_per_gran];
pcpu->pc_booke_tlb_lock = ptr;
*ptr = MTX_UNOWNED;
*ptr = TLB_UNLOCKED;
*(ptr + 1) = 0; /* recurse counter */
#endif
}

View File

@ -162,8 +162,6 @@ unsigned int kernel_ptbls; /* Number of KVA ptbls. */
#define PMAP_REMOVE_DONE(pmap) \
((pmap) != kernel_pmap && (pmap)->pm_stats.resident_count == 0)
extern void tlb_lock(uint32_t *);
extern void tlb_unlock(uint32_t *);
extern void tid_flush(tlbtid_t);
/**************************************************************************/

View File

@ -330,7 +330,7 @@
lwz %r22, PC_BOOKE_TLB_LOCK(%r20); \
\
1: lwarx %r23, 0, %r22; \
cmpwi %r23, MTX_UNOWNED; \
cmpwi %r23, TLB_UNLOCKED; \
beq 2f; \
\
/* check if this is recursion */ \
@ -364,7 +364,7 @@
msync; \
\
/* release the lock */ \
li %r23, MTX_UNOWNED; \
li %r23, TLB_UNLOCKED; \
stw %r23, 0(%r22); \
1: isync; \
msync
@ -860,7 +860,7 @@ ENTRY(tlb_lock)
GET_CPUINFO(%r5)
lwz %r5, PC_CURTHREAD(%r5)
1: lwarx %r4, 0, %r3
cmpwi %r4, MTX_UNOWNED
cmpwi %r4, TLB_UNLOCKED
bne 1b
stwcx. %r5, 0, %r3
bne- 1b
@ -871,11 +871,12 @@ ENTRY(tlb_lock)
ENTRY(tlb_unlock)
isync
msync
li %r4, MTX_UNOWNED
li %r4, TLB_UNLOCKED
stw %r4, 0(%r3)
isync
msync
blr
/*
* TLB miss spin locks. For each CPU we have a reservation granule (32 bytes);
* only a single word from this granule will actually be used as a spin lock

View File

@ -129,6 +129,8 @@
#define TID_MAX 255
#define TID_NONE -1
#define TLB_UNLOCKED 0
#if !defined(LOCORE)
typedef struct tlb_entry {
uint32_t mas1;
@ -146,6 +148,9 @@ void tlb1_init(vm_offset_t);
void tlb1_print_entries(void);
void tlb1_print_tlbentries(void);
void tlb_lock(uint32_t *);
void tlb_unlock(uint32_t *);
#endif /* !LOCORE */
#endif /* _MACHINE_TLB_H_ */