From f530bd2c71777c0f554b94d405627688497be35e Mon Sep 17 00:00:00 2001
From: asami <asami@FreeBSD.org>
Date: Wed, 13 Nov 1996 02:00:17 +0000
Subject: [PATCH] Another round of resync and some added sound support.

sys/pc98/i386/machdep.c: sync with i386/i386/machdep.c
sys/pc98/conf/options.pc98: sync with i386/conf/options.i386

sys/i386/isa/sound: DMA auto initialize mode support for PC98.
contributed by: Akio Morita <amorita@bird.scphys.kyoto-u.ac.jp>

Definite 2.2 material, I believe.

Submitted by:	The FreeBSD (98) Development Team
---
 sys/conf/options.pc98         |  3 +--
 sys/i386/isa/sound/ad1848.c   |  4 ----
 sys/i386/isa/sound/local.h    |  5 +++++
 sys/i386/isa/sound/pas2_pcm.c |  4 ----
 sys/i386/isa/sound/sb16_dsp.c |  4 ----
 sys/pc98/conf/options.pc98    |  3 +--
 sys/pc98/i386/machdep.c       | 20 ++++++++------------
 sys/pc98/pc98/machdep.c       | 20 ++++++++------------
 8 files changed, 23 insertions(+), 40 deletions(-)

diff --git a/sys/conf/options.pc98 b/sys/conf/options.pc98
index e9cca8e22f13..0d622c9bdc70 100644
--- a/sys/conf/options.pc98
+++ b/sys/conf/options.pc98
@@ -1,4 +1,4 @@
-#	$Id: options.pc98,v 1.8 1996/10/30 22:39:32 asami Exp $
+#	$Id: options.pc98,v 1.9 1996/11/02 10:38:48 asami Exp $
 BOUNCEPAGES		opt_bounce.h
 USER_LDT
 MATH_EMULATE		opt_math_emulate.h
@@ -42,7 +42,6 @@ I486_CPU		opt_cpu.h
 I586_CPU		opt_cpu.h
 I686_CPU		opt_cpu.h
 
-I586_FAST_BCOPY		opt_temporary.h
 I586_OPTIMIZED_BCOPY	opt_temporary.h
 I586_OPTIMIZED_BZERO	opt_temporary.h
 
diff --git a/sys/i386/isa/sound/ad1848.c b/sys/i386/isa/sound/ad1848.c
index 0dc546446f88..73e0edc3ff91 100644
--- a/sys/i386/isa/sound/ad1848.c
+++ b/sys/i386/isa/sound/ad1848.c
@@ -480,11 +480,7 @@ static struct audio_operations ad1848_pcm_operations[MAX_AUDIO_DEV] =
 {
   {
     "Generic AD1848 codec",
-#ifdef PC98
-	NEEDS_RESTART,
-#else
     DMA_AUTOMODE,
-#endif
     AFMT_U8,			/* Will be set later */
     NULL,
     ad1848_open,
diff --git a/sys/i386/isa/sound/local.h b/sys/i386/isa/sound/local.h
index c243e4b6f441..c500366033f8 100644
--- a/sys/i386/isa/sound/local.h
+++ b/sys/i386/isa/sound/local.h
@@ -3,7 +3,12 @@
  * $Id: local.h,v 1.11 1994/11/01 17:26:50 ache Exp
  */
 
+#ifdef PC98
+/* If a soundcard uses DMA AUTO mode, DPS_BUFFSIZE must be < 64KB. */
+#define DSP_BUFFSIZE 61440
+#else
 #define DSP_BUFFSIZE 65536
+#endif
 #define SELECTED_SOUND_OPTIONS  0xffffffff
 #define SOUND_CONFIG_DATE "Sun Feb 5 14:38:12 EST 1995"
 #define SOUND_CONFIG_BY "freebsd-hackers"
diff --git a/sys/i386/isa/sound/pas2_pcm.c b/sys/i386/isa/sound/pas2_pcm.c
index db91165355f9..97ae76cf0fc6 100644
--- a/sys/i386/isa/sound/pas2_pcm.c
+++ b/sys/i386/isa/sound/pas2_pcm.c
@@ -377,11 +377,7 @@ pas_pcm_prepare_for_output (int dev, int bsize, int bcount)
 static struct audio_operations pas_pcm_operations =
 {
   "Pro Audio Spectrum",
-#ifdef PC98
-  NEEDS_RESTART,
-#else
   DMA_AUTOMODE,
-#endif
   AFMT_U8 | AFMT_S16_LE,
   NULL,
   pas_pcm_open,
diff --git a/sys/i386/isa/sound/sb16_dsp.c b/sys/i386/isa/sound/sb16_dsp.c
index 5e84e67e2886..405777425168 100644
--- a/sys/i386/isa/sound/sb16_dsp.c
+++ b/sys/i386/isa/sound/sb16_dsp.c
@@ -84,11 +84,7 @@ static void     dsp_cleanup (void);
 static struct audio_operations sb16_dsp_operations =
 {
   "SoundBlaster 16",
-#ifdef PC98
-  NEEDS_RESTART,
-#else
   DMA_AUTOMODE,
-#endif
   AFMT_U8 | AFMT_S16_LE,
   NULL,
   sb16_dsp_open,
diff --git a/sys/pc98/conf/options.pc98 b/sys/pc98/conf/options.pc98
index e9cca8e22f13..0d622c9bdc70 100644
--- a/sys/pc98/conf/options.pc98
+++ b/sys/pc98/conf/options.pc98
@@ -1,4 +1,4 @@
-#	$Id: options.pc98,v 1.8 1996/10/30 22:39:32 asami Exp $
+#	$Id: options.pc98,v 1.9 1996/11/02 10:38:48 asami Exp $
 BOUNCEPAGES		opt_bounce.h
 USER_LDT
 MATH_EMULATE		opt_math_emulate.h
@@ -42,7 +42,6 @@ I486_CPU		opt_cpu.h
 I586_CPU		opt_cpu.h
 I686_CPU		opt_cpu.h
 
-I586_FAST_BCOPY		opt_temporary.h
 I586_OPTIMIZED_BCOPY	opt_temporary.h
 I586_OPTIMIZED_BZERO	opt_temporary.h
 
diff --git a/sys/pc98/i386/machdep.c b/sys/pc98/i386/machdep.c
index c6539d9cd66f..23e1d67dcd66 100644
--- a/sys/pc98/i386/machdep.c
+++ b/sys/pc98/i386/machdep.c
@@ -35,7 +35,7 @@
  * SUCH DAMAGE.
  *
  *	from: @(#)machdep.c	7.4 (Berkeley) 6/3/91
- *	$Id: machdep.c,v 1.11 1996/10/29 08:36:16 asami Exp $
+ *	$Id: machdep.c,v 1.12 1996/11/02 10:38:57 asami Exp $
  */
 
 #include "npx.h"
@@ -209,17 +209,6 @@ cpu_startup(dummy)
 	if (boothowto & RB_VERBOSE)
 		bootverbose++;
 
-	/*
-	 * Initialize error message buffer (at end of core).
-	 */
-
-	/* avail_end was pre-decremented in init386() to compensate */
-	for (i = 0; i < btoc(sizeof (struct msgbuf)); i++)
-		pmap_enter(pmap_kernel(), (vm_offset_t)msgbufp,
-			   avail_end + i * PAGE_SIZE,
-			   VM_PROT_ALL, TRUE);
-	msgbufmapped = 1;
-
 	/*
 	 * Good {morning,afternoon,evening,night}.
 	 */
@@ -994,6 +983,7 @@ init386(first)
 	struct region_descriptor r_gdt, r_idt;
 	int	pagesinbase, pagesinext;
 	int	target_page, pa_indx;
+	int	off;
 
 	proc0.p_addr = proc0paddr;
 
@@ -1340,6 +1330,12 @@ init386(first)
 
 	/* now running on new page tables, configured,and u/iom is accessible */
 
+	/* Map the message buffer. */
+	for (off = 0; off < round_page(sizeof(struct msgbuf)); off += PAGE_SIZE)
+		pmap_enter(kernel_pmap, (vm_offset_t)msgbufp + off,
+			   avail_end + off, VM_PROT_ALL, TRUE);
+	msgbufmapped = 1;
+
 	/* make a initial tss so microp can get interrupt stack on syscall! */
 	proc0.p_addr->u_pcb.pcb_tss.tss_esp0 = (int) kstack + UPAGES*PAGE_SIZE;
 	proc0.p_addr->u_pcb.pcb_tss.tss_ss0 = GSEL(GDATA_SEL, SEL_KPL) ;
diff --git a/sys/pc98/pc98/machdep.c b/sys/pc98/pc98/machdep.c
index c6539d9cd66f..23e1d67dcd66 100644
--- a/sys/pc98/pc98/machdep.c
+++ b/sys/pc98/pc98/machdep.c
@@ -35,7 +35,7 @@
  * SUCH DAMAGE.
  *
  *	from: @(#)machdep.c	7.4 (Berkeley) 6/3/91
- *	$Id: machdep.c,v 1.11 1996/10/29 08:36:16 asami Exp $
+ *	$Id: machdep.c,v 1.12 1996/11/02 10:38:57 asami Exp $
  */
 
 #include "npx.h"
@@ -209,17 +209,6 @@ cpu_startup(dummy)
 	if (boothowto & RB_VERBOSE)
 		bootverbose++;
 
-	/*
-	 * Initialize error message buffer (at end of core).
-	 */
-
-	/* avail_end was pre-decremented in init386() to compensate */
-	for (i = 0; i < btoc(sizeof (struct msgbuf)); i++)
-		pmap_enter(pmap_kernel(), (vm_offset_t)msgbufp,
-			   avail_end + i * PAGE_SIZE,
-			   VM_PROT_ALL, TRUE);
-	msgbufmapped = 1;
-
 	/*
 	 * Good {morning,afternoon,evening,night}.
 	 */
@@ -994,6 +983,7 @@ init386(first)
 	struct region_descriptor r_gdt, r_idt;
 	int	pagesinbase, pagesinext;
 	int	target_page, pa_indx;
+	int	off;
 
 	proc0.p_addr = proc0paddr;
 
@@ -1340,6 +1330,12 @@ init386(first)
 
 	/* now running on new page tables, configured,and u/iom is accessible */
 
+	/* Map the message buffer. */
+	for (off = 0; off < round_page(sizeof(struct msgbuf)); off += PAGE_SIZE)
+		pmap_enter(kernel_pmap, (vm_offset_t)msgbufp + off,
+			   avail_end + off, VM_PROT_ALL, TRUE);
+	msgbufmapped = 1;
+
 	/* make a initial tss so microp can get interrupt stack on syscall! */
 	proc0.p_addr->u_pcb.pcb_tss.tss_esp0 = (int) kstack + UPAGES*PAGE_SIZE;
 	proc0.p_addr->u_pcb.pcb_tss.tss_ss0 = GSEL(GDATA_SEL, SEL_KPL) ;