Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/atari Allocalte enough reserved ST-RAM to make the ...
details: https://anonhg.NetBSD.org/src/rev/a094e4ced49c
branches: trunk
changeset: 368135:a094e4ced49c
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Sat Jun 25 13:17:04 2022 +0000
description:
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 9fff58c2ee71 -r a094e4ced49c sys/arch/atari/atari/atari_init.c
--- a/sys/arch/atari/atari/atari_init.c Sat Jun 25 12:41:55 2022 +0000
+++ b/sys/arch/atari/atari/atari_init.c Sat Jun 25 13:17:04 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: atari_init.c,v 1.104 2022/05/24 06:28:00 andvar Exp $ */
+/* $NetBSD: atari_init.c,v 1.105 2022/06/25 13:17:04 tsutsui Exp $ */
/*
* Copyright (c) 1995 Leo Weppelman
@@ -33,12 +33,13 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: atari_init.c,v 1.104 2022/05/24 06:28:00 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atari_init.c,v 1.105 2022/06/25 13:17:04 tsutsui 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 9fff58c2ee71 -r a094e4ced49c sys/arch/atari/conf/GENERIC.in
--- a/sys/arch/atari/conf/GENERIC.in Sat Jun 25 12:41:55 2022 +0000
+++ b/sys/arch/atari/conf/GENERIC.in Sat Jun 25 13:17:04 2022 +0000
@@ -1,5 +1,5 @@
#
-# $NetBSD: GENERIC.in,v 1.122 2022/06/12 06:54:32 tsutsui Exp $
+# $NetBSD: GENERIC.in,v 1.123 2022/06/25 13:17:04 tsutsui Exp $
#
# Generic atari
#
@@ -207,7 +207,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 9fff58c2ee71 -r a094e4ced49c sys/arch/atari/conf/files.atari
--- a/sys/arch/atari/conf/files.atari Sat Jun 25 12:41:55 2022 +0000
+++ b/sys/arch/atari/conf/files.atari Sat Jun 25 13:17:04 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.124 2022/06/25 13:17:04 tsutsui 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