svn commit: r215119 - in head/sys/powerpc: booke include

Rafal Jaworowski raj at FreeBSD.org
Thu Nov 11 13:35:24 UTC 2010


Author: raj
Date: Thu Nov 11 13:35:23 2010
New Revision: 215119
URL: http://svn.freebsd.org/changeset/base/215119

Log:
  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

Modified:
  head/sys/powerpc/booke/machdep.c
  head/sys/powerpc/booke/pmap.c
  head/sys/powerpc/booke/trap_subr.S
  head/sys/powerpc/include/tlb.h

Modified: head/sys/powerpc/booke/machdep.c
==============================================================================
--- head/sys/powerpc/booke/machdep.c	Thu Nov 11 12:13:41 2010	(r215118)
+++ head/sys/powerpc/booke/machdep.c	Thu Nov 11 13:35:23 2010	(r215119)
@@ -453,7 +453,7 @@ cpu_pcpu_init(struct pcpu *pcpu, int cpu
 
 	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
 }

Modified: head/sys/powerpc/booke/pmap.c
==============================================================================
--- head/sys/powerpc/booke/pmap.c	Thu Nov 11 12:13:41 2010	(r215118)
+++ head/sys/powerpc/booke/pmap.c	Thu Nov 11 13:35:23 2010	(r215119)
@@ -162,8 +162,6 @@ unsigned int kernel_ptbls;	/* Number of 
 #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);
 
 /**************************************************************************/

Modified: head/sys/powerpc/booke/trap_subr.S
==============================================================================
--- head/sys/powerpc/booke/trap_subr.S	Thu Nov 11 12:13:41 2010	(r215118)
+++ head/sys/powerpc/booke/trap_subr.S	Thu Nov 11 13:35:23 2010	(r215119)
@@ -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

Modified: head/sys/powerpc/include/tlb.h
==============================================================================
--- head/sys/powerpc/include/tlb.h	Thu Nov 11 12:13:41 2010	(r215118)
+++ head/sys/powerpc/include/tlb.h	Thu Nov 11 13:35:23 2010	(r215119)
@@ -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_ */


More information about the svn-src-head mailing list