Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-9]: src/sys/arch/atari Pull up following revision(s) (requested b...



details:   https://anonhg.NetBSD.org/src/rev/3221e25b844c
branches:  netbsd-9
changeset: 369987:3221e25b844c
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Sep 11 18:14:55 2022 +0000

description:
Pull up following revision(s) (requested by tsutsui in ticket #1519):

        sys/arch/atari/conf/GENERIC.in: revision 1.123
        sys/arch/atari/conf/files.atari: revision 1.124
        sys/arch/atari/atari/atari_init.c: revision 1.105

Allocalte enough reserved ST-RAM to make the old Xserver work by default.

Instead, check ST-RAM size and TT-RAM size on startup and restrict
size of reserved ST memory on lower RAM machines.

Closes PR port-atari/41002 from David Ross.

While here, make options ST_POOL_SIZE defparam'ed to make sure to
reflect config(5) changes on each build.

diffstat:

 sys/arch/atari/atari/atari_init.c |  40 +++++++++++++++++++++++++++++---------
 sys/arch/atari/conf/GENERIC.in    |   4 +-
 sys/arch/atari/conf/files.atari   |   3 +-
 3 files changed, 34 insertions(+), 13 deletions(-)

diffs (120 lines):

diff -r 7c6125447d11 -r 3221e25b844c sys/arch/atari/atari/atari_init.c
--- a/sys/arch/atari/atari/atari_init.c Sun Sep 11 18:10:23 2022 +0000
+++ b/sys/arch/atari/atari/atari_init.c Sun Sep 11 18:14:55 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atari_init.c,v 1.101 2018/02/26 15:11:12 tsutsui Exp $ */
+/*     $NetBSD: atari_init.c,v 1.101.8.1 2022/09/11 18:14:55 martin Exp $      */
 
 /*
  * Copyright (c) 1995 Leo Weppelman
@@ -33,12 +33,13 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: atari_init.c,v 1.101 2018/02/26 15:11:12 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atari_init.c,v 1.101.8.1 2022/09/11 18:14:55 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_mbtype.h"
 #include "opt_m060sp.h"
 #include "opt_m68k_arch.h"
+#include "opt_st_pool_size.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -145,18 +146,29 @@
 vaddr_t        page_zero;
 
 /*
- * Crude support for allocation in ST-ram. Currently only used to allocate
- * video ram.
+ * Simple support for allocation in ST-ram.
+ * Currently 16 bit ST-ram is required to allocate DMA buffers for SCSI and
+ * FDC transfers, and video memory for the XFree68 based Xservers.
  * The physical address is also returned because the video init needs it to
  * setup the controller at the time the vm-system is not yet operational so
  * 'kvtop()' cannot be used.
  */
+#define        ST_POOL_SIZE_MIN        24      /* for DMA bounce buffers */
 #ifndef ST_POOL_SIZE
-#define        ST_POOL_SIZE    40                      /* XXX: enough? */
+#define        ST_POOL_SIZE            56      /* Xserver requires 320KB (40 pages) */
 #endif
 
-u_long st_pool_size = ST_POOL_SIZE * PAGE_SIZE; /* Patchable   */
-u_long st_pool_virt, st_pool_phys;
+psize_t        st_pool_size = ST_POOL_SIZE * PAGE_SIZE; /* Patchable   */
+vaddr_t        st_pool_virt;
+paddr_t        st_pool_phys;
+
+/*
+ * Thresholds to restrict size of reserved ST memory to make sure
+ * the kernel at least boot even on lower memory machines.
+ * Nowadays we could assume most users have 4MB ST-RAM and 16MB TT-RAM.
+ */
+#define        STRAM_MINTHRESH         (2 * 1024 * 1024)
+#define        TTRAM_MINTHRESH         (4 * 1024 * 1024)
 
 /* I/O address space variables */
 vaddr_t        stio_addr;              /* Where the st io-area is mapped       */
@@ -284,12 +296,20 @@
 #endif
 
        /*
-        * The following is a hack. We do not know how much ST memory we
-        * really need until after configuration has finished. At this
-        * time I have no idea how to grab ST memory at that time.
+        * We do not know how much ST memory we really need until after
+        * configuration has finished, but typical users of ST memory
+        * are bounce buffers DMA against TT-RAM for SCSI and FDC,
+        * and video memory for the Xserver.
+        * If we have enough RAMs reserve ST memory including for the Xserver.
+        * Otherwise just allocate minimum one for SCSI and FDC.
+        *
         * The round_page() call is ment to correct errors made by
         * binpatching!
         */
+       if (st_pool_size > ST_POOL_SIZE_MIN * PAGE_SIZE &&
+           (stphysize <= STRAM_MINTHRESH || ttphysize <= TTRAM_MINTHRESH)) {
+               st_pool_size = ST_POOL_SIZE_MIN * PAGE_SIZE;
+       }
        st_pool_size   = m68k_round_page(st_pool_size);
        st_pool_phys   = stphysize - st_pool_size;
        stphysize      = st_pool_phys;
diff -r 7c6125447d11 -r 3221e25b844c sys/arch/atari/conf/GENERIC.in
--- a/sys/arch/atari/conf/GENERIC.in    Sun Sep 11 18:10:23 2022 +0000
+++ b/sys/arch/atari/conf/GENERIC.in    Sun Sep 11 18:14:55 2022 +0000
@@ -1,5 +1,5 @@
 #
-#      $NetBSD: GENERIC.in,v 1.118 2019/04/13 08:22:59 isaki Exp $
+#      $NetBSD: GENERIC.in,v 1.118.4.1 2022/09/11 18:14:55 martin Exp $
 #
 # Generic atari
 #
@@ -204,7 +204,7 @@
 # Atari specific options
 #
 #options       KFONT_8x8               # Use 8x8 font instead of 8x16
-options        ST_POOL_SIZE=24         # smallest that allows TT-HIGH
+options        ST_POOL_SIZE=56         # for SCSI, FDC, and Xserver
 #if defined(TT030_KERNEL) || defined(HADES_KERNEL)
 options        TT_SCSI                 # SCSI-support for TT
 options        TT_VIDEO                # Graphics support for TT
diff -r 7c6125447d11 -r 3221e25b844c sys/arch/atari/conf/files.atari
--- a/sys/arch/atari/conf/files.atari   Sun Sep 11 18:10:23 2022 +0000
+++ b/sys/arch/atari/conf/files.atari   Sun Sep 11 18:14:55 2022 +0000
@@ -1,5 +1,5 @@
 #
-#      $NetBSD: files.atari,v 1.123 2019/02/18 01:12:22 thorpej Exp $
+#      $NetBSD: files.atari,v 1.123.4.1 2022/09/11 18:14:55 martin Exp $
 
 maxpartitions 16
 
@@ -9,6 +9,7 @@
 defflag        opt_serconsole.h        SERCONSOLE
 defflag        opt_atariscsi.h         TT_SCSI FALCON_SCSI
 defparam       opt_atariscsi.h         TRY_SCSI_LINKED_COMMANDS
+defparam                               ST_POOL_SIZE
 
 defflag                opt_m060sp.h            M060SP
 defflag                                        PANICBUTTON



Home | Main Index | Thread Index | Old Index