From f07fe57a662cc941b2c7331cd42ba9f52e0e967d Mon Sep 17 00:00:00 2001 From: pefo Date: Mon, 17 Mar 1997 08:11:11 +0000 Subject: [PATCH] Serial console trouble again... --- sys/arch/arc/arc/machdep.c | 53 ++++++++++++++++++++++++++++++++------ sys/dev/ic/com.c | 11 +++++--- 2 files changed, 52 insertions(+), 12 deletions(-) diff --git a/sys/arch/arc/arc/machdep.c b/sys/arch/arc/arc/machdep.c index 98ea7203f16..4615d24396f 100644 --- a/sys/arch/arc/arc/machdep.c +++ b/sys/arch/arc/arc/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.21 1997/03/12 19:16:43 pefo Exp $ */ +/* $OpenBSD: machdep.c,v 1.22 1997/03/17 08:11:12 pefo Exp $ */ /* * Copyright (c) 1988 University of Utah. * Copyright (c) 1992, 1993 @@ -38,7 +38,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 8.3 (Berkeley) 1/12/94 - * $Id: machdep.c,v 1.21 1997/03/12 19:16:43 pefo Exp $ + * $Id: machdep.c,v 1.22 1997/03/17 08:11:12 pefo Exp $ */ /* from: Utah Hdr: machdep.c 1.63 91/04/24 */ @@ -96,11 +96,13 @@ #include #include +#if 0 #include #if NASC > 0 #include #endif +#endif extern struct consdev *cn_tab; extern char kernel_start[]; @@ -147,6 +149,7 @@ int (*Mach_splstatclock)() = splhigh; static void tlb_init_pica(); static void tlb_init_tyne(); +static int get_simm_size(int *fadr, int max); /* @@ -225,14 +228,14 @@ mips_init(argc, argv, code) strcpy(cpu_model, "Deskstation rPC44"); arc_bus.isa_io_base = 0xb0000000; /*XXX*/ arc_bus.isa_mem_base = 0xa0000000; /*XXX*/ - CONADDR = 0xa0000000+0x3f8; /* Standard PC Com0 address */ + CONADDR = 0; /* Don't screew the mouse... */ break; case DESKSTATION_TYNE: strcpy(cpu_model, "Deskstation Tyne"); arc_bus.isa_io_base = TYNE_V_ISA_IO; arc_bus.isa_mem_base = TYNE_V_ISA_MEM; - CONADDR = TYNE_V_ISA_MEM+0x3f8; /* Standard PC Com0 address */ + CONADDR = 0; /* Don't screew the mouse... */ break; case -1: /* Not identified as an ARC system. We have a couple */ @@ -253,8 +256,9 @@ mips_init(argc, argv, code) mem_layout[0].mem_start = 0; mem_layout[0].mem_size = mips_trunc_page(CACHED_TO_PHYS(kernel_start)); mem_layout[1].mem_start = CACHED_TO_PHYS((int)sysend); - mem_layout[1].mem_size = 0x800000 - (int)(CACHED_TO_PHYS(sysend)); - physmem = 8192 * 1024; + i = get_simm_size((int *)0, 128*1024*1024); + mem_layout[1].mem_size = i - (int)(CACHED_TO_PHYS(sysend)); + physmem = i; #if 0 mem_layout[2].mem_start = 0x800000; mem_layout[2].mem_size = 0x1000000; @@ -494,8 +498,6 @@ mips_init(argc, argv, code) * Clear allocated memory. */ bzero(start, sysend - start); -consinit(); -mdbpanic(); /* * Initialize the virtual memory system. @@ -570,6 +572,41 @@ tlb_init_tyne() } +/* + * Simple routine to figure out SIMM module size. + */ +static int +get_simm_size(fadr, max) + int *fadr; + int max; +{ + int msave; + int msize; + + fadr = (int *)PHYS_TO_UNCACHED(CACHED_TO_PHYS((int)fadr)); + + msize = 1024*1024; + + while(max >= msize) { + msave = fadr[0]; + fadr[0] = 0xC0DEB00F; + if(fadr[msize/4] == 0xC0DEB00F) { + fadr[0] = msave; + if(fadr[msize/4] == msave) { + break; /* Wrap around */ + } + } + fadr[0] = msave; + msize += msize; + } + if(msize <= max) { + return(msize); + } + else { + return(-1); + } +} + /* * Console initialization: called early on from main, * before vm init or startup. Do enough configuration diff --git a/sys/dev/ic/com.c b/sys/dev/ic/com.c index 9aaf899d440..ee2251969b0 100644 --- a/sys/dev/ic/com.c +++ b/sys/dev/ic/com.c @@ -1,4 +1,4 @@ -/* $OpenBSD: com.c,v 1.32 1997/03/12 20:17:37 pefo Exp $ */ +/* $OpenBSD: com.c,v 1.33 1997/03/17 08:11:11 pefo Exp $ */ /* $NetBSD: com.c,v 1.82.4.1 1996/06/02 09:08:00 mrg Exp $ */ /*- @@ -1433,9 +1433,7 @@ ohfudge: */ #include -#if NCOM_PICA -#include - extern int cputype; +#if NCOM_LOCALBUS #undef CONADDR extern int CONADDR; #endif @@ -1453,6 +1451,11 @@ comcnprobe(cp) bus_space_handle_t ioh; int found; + if(CONADDR == 0) { + cp->cn_pri = CN_DEAD; + return; + } + comconsiot = iot; if (bus_space_map(iot, CONADDR, COM_NPORTS, 0, &ioh)) { cp->cn_pri = CN_DEAD; -- 2.20.1