From 8b408add71e34047ba6a9895a31814a09741fbb7 Mon Sep 17 00:00:00 2001
From: Sascha Wildner <saw@online.de>
Date: Thu, 26 Nov 2015 21:56:31 +0100
Subject: [PATCH 2/3] kernel: Clean up the "deprecated" spinlock code a bit.

Some stuff was no longer used, some was i386 specific.
---
 sys/platform/pc64/include/lock.h    |  5 -----
 sys/platform/pc64/x86_64/machdep.c  | 12 ----------
 sys/platform/pc64/x86_64/spinlock.s | 44 -------------------------------------
 3 files changed, 61 deletions(-)

diff --git a/sys/platform/pc64/include/lock.h b/sys/platform/pc64/include/lock.h
index 94250c6..453f355 100644
--- a/sys/platform/pc64/include/lock.h
+++ b/sys/platform/pc64/include/lock.h
@@ -112,8 +112,6 @@ struct spinlock_deprecated {
 
 typedef struct spinlock_deprecated *spinlock_t;
 
-void	mpintr_lock(void);	/* disables int / spinlock combo */
-void	mpintr_unlock(void);
 void	com_lock(void);		/* disables int / spinlock combo */
 void	com_unlock(void);
 void	imen_lock(void);	/* disables int / spinlock combo */
@@ -121,9 +119,6 @@ void	imen_unlock(void);
 void	clock_lock(void);	/* disables int / spinlock combo */
 void	clock_unlock(void);
 
-void	spin_lock_deprecated(spinlock_t lock);
-void	spin_unlock_deprecated(spinlock_t lock);
-
 /*
  * Inline version of spinlock routines -- overrides assembly.  Only unlock
  * and init here please.
diff --git a/sys/platform/pc64/x86_64/machdep.c b/sys/platform/pc64/x86_64/machdep.c
index 7021de9..d223380 100644
--- a/sys/platform/pc64/x86_64/machdep.c
+++ b/sys/platform/pc64/x86_64/machdep.c
@@ -2617,15 +2617,6 @@ outb(u_int port, u_char data)
 /* critical region when masking or unmasking interupts */
 struct spinlock_deprecated imen_spinlock;
 
-/* critical region for old style disable_intr/enable_intr */
-struct spinlock_deprecated mpintr_spinlock;
-
-/* critical region around INTR() routines */
-struct spinlock_deprecated intr_spinlock;
-
-/* lock region used by kernel profiling */
-struct spinlock_deprecated mcount_spinlock;
-
 /* locks com (tty) data/hardware accesses: a FASTINTR() */
 struct spinlock_deprecated com_spinlock;
 
@@ -2641,9 +2632,6 @@ init_locks(void)
 	 */
 	cpu_get_initial_mplock();
 	/* DEPRECATED */
-	spin_lock_init(&mcount_spinlock);
-	spin_lock_init(&intr_spinlock);
-	spin_lock_init(&mpintr_spinlock);
 	spin_lock_init(&imen_spinlock);
 	spin_lock_init(&com_spinlock);
 	spin_lock_init(&clock_spinlock);
diff --git a/sys/platform/pc64/x86_64/spinlock.s b/sys/platform/pc64/x86_64/spinlock.s
index 2988d6b..63f781a 100644
--- a/sys/platform/pc64/x86_64/spinlock.s
+++ b/sys/platform/pc64/x86_64/spinlock.s
@@ -30,34 +30,6 @@
 #include <machine/lock.h>
 
 /*
- * The spinlock routines may only be used for low level debugging, like
- * kernel printfs, and when no other option is available such as situations
- * relating to hardware interrupt masks.  Spinlock routines should not be
- * used in interrupt service routines or in any other situation.
- *
- * NOTE: for UP the spinlock routines still disable/restore interrupts
- */
-ENTRY(spin_lock_deprecated)
-	movl	4(%esp),%edx
-	SPIN_LOCK((%edx))		/* note: %eax, %ecx tromped */
-	ret
-
-ENTRY(spin_unlock_deprecated)
-	movl	4(%esp),%edx
-	SPIN_UNLOCK((%edx))		/* note: %eax, %ecx tromped */
-	ret
-
-NON_GPROF_ENTRY(spin_lock_np)
-	movl	4(%esp),%edx
-	SPIN_LOCK((%edx))		/* note: %eax, %ecx tromped */
-	NON_GPROF_RET
-
-NON_GPROF_ENTRY(spin_unlock_np)
-	movl	4(%esp), %edx		/* get the address of the lock */
-	SPIN_UNLOCK((%edx))
-	NON_GPROF_RET
-
-/*
  * Auxillary convenience routines.  Note that these functions disable and
  * restore interrupts as well, on SMP, as performing spin locking functions.
  */
@@ -69,22 +41,6 @@ NON_GPROF_ENTRY(imen_unlock)
 	SPIN_UNLOCK(imen_spinlock)
 	NON_GPROF_RET
 
-NON_GPROF_ENTRY(intr_lock)
-	SPIN_LOCK(intr_spinlock)
-	NON_GPROF_RET
-
-NON_GPROF_ENTRY(intr_unlock)
-	SPIN_UNLOCK(intr_spinlock)
-	NON_GPROF_RET
-
-NON_GPROF_ENTRY(mpintr_lock)
-	SPIN_LOCK(mpintr_spinlock)
-	NON_GPROF_RET
-
-NON_GPROF_ENTRY(mpintr_unlock)
-	SPIN_UNLOCK(mpintr_spinlock)
-	NON_GPROF_RET
-
 NON_GPROF_ENTRY(clock_lock)
 	SPIN_LOCK(clock_spinlock)
 	NON_GPROF_RET
-- 
2.5.3

