diff options
author | Per Fogelstrom <pefo@cvs.openbsd.org> | 2004-08-09 14:57:27 +0000 |
---|---|---|
committer | Per Fogelstrom <pefo@cvs.openbsd.org> | 2004-08-09 14:57:27 +0000 |
commit | 742d43747326c808a6f441af721d78525f69f4a8 (patch) | |
tree | df270ec266f214aeb803b1ee29decdc03b1da0aa /sys/arch | |
parent | ac8a30a6ca44a9d5f639c96c1c8fb2cf08ca1677 (diff) |
Big cleanup. Removed some unused obsolete stuff and fixed copyrights
on some files. Arcbios support is now in, thus detects memorysize and cpu
clock frequency.
Diffstat (limited to 'sys/arch')
39 files changed, 297 insertions, 640 deletions
diff --git a/sys/arch/mips64/conf/files.mips64 b/sys/arch/mips64/conf/files.mips64 index c67836f6251..44683523c52 100644 --- a/sys/arch/mips64/conf/files.mips64 +++ b/sys/arch/mips64/conf/files.mips64 @@ -1,12 +1,12 @@ -# $OpenBSD: files.mips64,v 1.1 2004/08/06 20:56:01 pefo Exp $ +# $OpenBSD: files.mips64,v 1.2 2004/08/09 14:57:26 pefo Exp $ -file arch/mips64/mips64/cpu_ecoff.c file arch/mips64/mips64/disksubr.c file arch/mips64/mips64/mem.c file arch/mips64/mips64/process_machdep.c file arch/mips64/mips64/sys_machdep.c file arch/mips64/mips64/vm_machdep.c +file arch/mips64/mips64/arcbios.c arcbios file arch/mips64/mips64/clock.c file arch/mips64/mips64/cpu.c file arch/mips64/mips64/busdma.c diff --git a/sys/arch/mips64/include/arcbios.h b/sys/arch/mips64/include/arcbios.h index d5084a2b987..bb6bb2411b4 100644 --- a/sys/arch/mips64/include/arcbios.h +++ b/sys/arch/mips64/include/arcbios.h @@ -1,4 +1,4 @@ -/* $OpenBSD: arcbios.h,v 1.1 2004/08/08 21:51:36 pefo Exp $ */ +/* $OpenBSD: arcbios.h,v 1.2 2004/08/09 14:57:26 pefo Exp $ */ /*- * Copyright (c) 1996 M. Warner Losh. All rights reserved. * @@ -356,11 +356,11 @@ void bios_display_info(int *, int *, int *, int *); int Bios_Load(void); int Bios_Invoke(void); int Bios_Execute(void); -int Bios_Halt(void); -int Bios_PowerDown(void); -int Bios_Restart(void); -int Bios_Reboot(void); -int Bios_EnterInteractiveMode(void); +void Bios_Halt(void); +void Bios_PowerDown(void); +void Bios_Restart(void); +void Bios_Reboot(void); +void Bios_EnterInteractiveMode(void); int Bios_GetPeer(void); arc_config_t *Bios_GetChild(arc_config_t *); int Bios_GetParent(void); @@ -381,11 +381,11 @@ int Bios_GetReadStatus(void); int Bios_Write(int, char *, int, int *); int Bios_Seek(void); int Bios_Mount(void); -int Bios_GetEnvironmentVariable(void); +char *Bios_GetEnvironmentVariable(const char *); int Bios_SetEnvironmentVariable(void); int Bios_GetFileInformation(void); int Bios_SetFileInformation(void); -int Bios_FlushAllCaches(void); +void Bios_FlushAllCaches(void); int Bios_TestUnicodeCharacter(void); arc_dsp_stat_t *Bios_GetDisplayStatus(int); diff --git a/sys/arch/mips64/include/cpu.h b/sys/arch/mips64/include/cpu.h index c3172d4639a..117c8aa194f 100644 --- a/sys/arch/mips64/include/cpu.h +++ b/sys/arch/mips64/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.1 2004/08/06 20:56:01 pefo Exp $ */ +/* $OpenBSD: cpu.h,v 1.2 2004/08/09 14:57:26 pefo Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -357,25 +357,6 @@ int want_resched; /* resched() was called */ -/* - * CPU identification, from PRID register. - */ -union cpuprid { - int cpuprid; - struct { -#if BYTE_ORDER == BIG_ENDIAN - u_int pad1:16; /* reserved */ - u_int cp_imp:8; /* implementation identifier */ - u_int cp_majrev:4; /* major revision identifier */ - u_int cp_minrev:4; /* minor revision identifier */ -#else - u_int cp_minrev:4; /* minor revision identifier */ - u_int cp_majrev:4; /* major revision identifier */ - u_int cp_imp:8; /* implementation identifier */ - u_int pad1:16; /* reserved */ -#endif - } cpu; -}; #endif /* !_LOCORE */ #endif /* _KERNEL */ @@ -439,8 +420,6 @@ union cpuprid { #define MIPS_VR5400 0x54 /* NEC Vr5400 FPU ISA IV+ */ #if defined(_KERNEL) && !defined(_LOCORE) -union cpuprid cpu_id; -union cpuprid fpu_id; u_int CpuPrimaryInstCacheSize; u_int CpuPrimaryInstCacheLSize; @@ -463,6 +442,8 @@ struct user; void tlb_set_wired(int); void tlb_set_pid(int); +u_int cp0_get_prid(void); +u_int cp1_get_prid(void); u_int cp0_get_count(void); void cp0_set_compare(u_int); diff --git a/sys/arch/mips64/include/dlfcn.h b/sys/arch/mips64/include/dlfcn.h deleted file mode 100644 index f242fcdc055..00000000000 --- a/sys/arch/mips64/include/dlfcn.h +++ /dev/null @@ -1,61 +0,0 @@ -/* $OpenBSD: dlfcn.h,v 1.1 2004/08/06 20:56:01 pefo Exp $ */ - -/* - * Copyright (c) 1998 Per Fogelstrom, Opsycon AB - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed under OpenBSD by - * Per Fogelstrom, Opsycon AB, Sweden. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -#ifndef _MIPS_DLFCN_H_ -#define _MIPS_DLFCN_H_ - -#include <sys/cdefs.h> - -__BEGIN_DECLS -extern void *dlopen __P((const char *, int)); -extern int dlclose __P((void *)); -extern void *dlsym __P((void *, const char *)); -extern int dlctl __P((void *, int, void *)); -extern const char *dlerror __P((void)); -__END_DECLS - -/* - * dlopen() modes. - */ -#define DL_LAZY 1 /* Resolve when called */ -#define DL_NOW 2 /* Resolve immediatly */ - -/* - * dlctl() commands. - */ - -#define DL_DUMP_MAP 99 - - -#endif /* !_MIPS_DLFCN_H_ */ diff --git a/sys/arch/mips64/include/ecoff_machdep.h b/sys/arch/mips64/include/ecoff_machdep.h deleted file mode 100644 index 1de7eeadc6d..00000000000 --- a/sys/arch/mips64/include/ecoff_machdep.h +++ /dev/null @@ -1,98 +0,0 @@ -/* $OpenBSD: ecoff_machdep.h,v 1.1 2004/08/06 20:56:01 pefo Exp $ */ -/* $NetBSD: ecoff.h,v 1.4 1995/06/16 02:07:33 mellon Exp $ */ - -/* - * Copyright (c) 1994 Adam Glass - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Adam Glass. - * 4. The name of the Author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY Adam Glass ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL Adam Glass BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _MIPS_ECOFF_H_ -#define _MIPS_ECOFF_H_ - -#define ECOFF_LDPGSZ 4096 - -#define ECOFF_PAD - -#define ECOFF_MACHDEP \ - u_long ea_gprmask; \ - u_long ea_cprmask[4]; \ - u_long ea_gp_value - -#define ECOFF_MAGIC_MIPSEL 0x0162 -#define ECOFF_BADMAG(ex) ((ex)->f.f_magic != ECOFF_MAGIC_MIPSEL) - -#define ECOFF_SEGMENT_ALIGNMENT(ep) ((ep)->a.vstamp < 23 ? 8 : 16) - -struct ecoff_symhdr { - int16_t sh_magic; - int16_t sh_vstamp; - int32_t sh_linemax; - int32_t sh_densenummax; - int32_t sh_procmax; - int32_t sh_lsymmax; - int32_t sh_optsymmax; - int32_t sh_auxxymmax; - int32_t sh_lstrmax; - int32_t sh_estrmax; - int32_t sh_fdmax; - int32_t sh_rfdmax; - int32_t sh_esymmax; - long sh_linesize; - long sh_lineoff; - long sh_densenumoff; - long sh_procoff; - long sh_lsymoff; - long sh_optsymoff; - long sh_auxsymoff; - long sh_lstroff; - long sh_estroff; - long sh_fdoff; - long sh_rfdoff; - long sh_esymoff; -}; -/* Some day they will make up their minds.... */ -#define esymMax sh_esymmax -#define cbExtOffset sh_esymoff -#define cbSsExtOffset sh_estroff - -struct ecoff_extsym { - long es_value; - int es_strindex; - unsigned es_type:6; - unsigned es_class:5; - unsigned :1; - unsigned es_symauxindex:20; - unsigned es_jmptbl:1; - unsigned es_cmain:1; - unsigned es_weakext:1; - unsigned :29; - int es_indexfld; -}; - -#endif /* !_MIPS_ECOFF_H_ */ diff --git a/sys/arch/mips64/include/exception.h b/sys/arch/mips64/include/exception.h index fdfd2c05ab7..3fd4792f7b5 100644 --- a/sys/arch/mips64/include/exception.h +++ b/sys/arch/mips64/include/exception.h @@ -1,4 +1,4 @@ -/* $OpenBSD: exception.h,v 1.1 2004/08/06 20:56:01 pefo Exp $ */ +/* $OpenBSD: exception.h,v 1.2 2004/08/09 14:57:26 pefo Exp $ */ /* * Copyright (c) 1998-2003 Opsycon AB (www.opsycon.se) @@ -11,11 +11,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Opsycon AB, Sweden. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED diff --git a/sys/arch/mips64/include/frame.h b/sys/arch/mips64/include/frame.h index 4176328349a..21bb05b7940 100644 --- a/sys/arch/mips64/include/frame.h +++ b/sys/arch/mips64/include/frame.h @@ -1,4 +1,4 @@ -/* $OpenBSD: frame.h,v 1.1 2004/08/06 20:56:01 pefo Exp $ */ +/* $OpenBSD: frame.h,v 1.2 2004/08/09 14:57:26 pefo Exp $ */ /* * Copyright (c) 1998-2003 Opsycon AB (www.opsycon.se) @@ -11,11 +11,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Opsycon AB, Sweden. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED diff --git a/sys/arch/mips64/include/memconf.h b/sys/arch/mips64/include/memconf.h index 16a4201516b..1ad9c8b48a5 100644 --- a/sys/arch/mips64/include/memconf.h +++ b/sys/arch/mips64/include/memconf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: memconf.h,v 1.1 2004/08/06 20:56:02 pefo Exp $ */ +/* $OpenBSD: memconf.h,v 1.2 2004/08/09 14:57:26 pefo Exp $ */ /* * Copyright (c) 1996 Per Fogelstrom @@ -12,11 +12,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Per Fogelstrom. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES @@ -37,14 +32,14 @@ #ifndef _MIPS_MEMCONF_H_ #define _MIPS_MEMCONF_H_ -struct mem_descriptor { - paddr_t mem_start; - psize_t mem_size; +struct phys_mem_desc { + u_int32_t mem_first_page; + u_int32_t mem_last_page; }; #ifdef _KERNEL #define MAXMEMSEGS 16 -extern struct mem_descriptor mem_layout[]; +extern struct phys_mem_desc mem_layout[]; #endif #endif /* !_MIPS_MEMCONF_H_ */ diff --git a/sys/arch/mips64/include/pio.h b/sys/arch/mips64/include/pio.h index 9ac0f842b4e..e8253b69c63 100644 --- a/sys/arch/mips64/include/pio.h +++ b/sys/arch/mips64/include/pio.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pio.h,v 1.1 2004/08/06 20:56:02 pefo Exp $ */ +/* $OpenBSD: pio.h,v 1.2 2004/08/09 14:57:26 pefo Exp $ */ /* * Copyright (c) 2001-2003 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -11,11 +11,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Opsycon AB, Sweden. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED diff --git a/sys/arch/mips64/include/regnum.h b/sys/arch/mips64/include/regnum.h index 296016dc01b..0de6f8e9f7f 100644 --- a/sys/arch/mips64/include/regnum.h +++ b/sys/arch/mips64/include/regnum.h @@ -1,4 +1,4 @@ -/* $OpenBSD: regnum.h,v 1.1 2004/08/06 20:56:02 pefo Exp $ */ +/* $OpenBSD: regnum.h,v 1.2 2004/08/09 14:57:26 pefo Exp $ */ /* * Copyright (c) 2001-2002 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -11,11 +11,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Opsycon AB, Sweden. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED diff --git a/sys/arch/mips64/include/types.h b/sys/arch/mips64/include/types.h index 947e3a75374..9107f33dc96 100644 --- a/sys/arch/mips64/include/types.h +++ b/sys/arch/mips64/include/types.h @@ -1,4 +1,4 @@ -/* $OpenBSD: types.h,v 1.1 2004/08/06 20:56:02 pefo Exp $ */ +/* $OpenBSD: types.h,v 1.2 2004/08/09 14:57:26 pefo Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -85,8 +85,6 @@ typedef int32_t register_t; typedef int32_t f_register_t; #endif -#define __SWAP_BROKEN - #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) typedef struct label_t { register_t val[14]; diff --git a/sys/arch/mips64/mips64/arcbios.c b/sys/arch/mips64/mips64/arcbios.c index 5e122a08a26..d9291a0f0ee 100644 --- a/sys/arch/mips64/mips64/arcbios.c +++ b/sys/arch/mips64/mips64/arcbios.c @@ -1,4 +1,4 @@ -/* $OpenBSD: arcbios.c,v 1.1 2004/08/08 21:51:36 pefo Exp $ */ +/* $OpenBSD: arcbios.c,v 1.2 2004/08/09 14:57:26 pefo Exp $ */ /*- * Copyright (c) 1996 M. Warner Losh. All rights reserved. * Copyright (c) 1996-2004 Opsycon AB. All rights reserved. @@ -41,6 +41,7 @@ arc_param_blk_t *bios_base = ArcBiosBase; extern int physmem; /* Total physical memory size */ +extern int rsvdmem; /* Total reserved memory size */ void bios_configure_memory(void); int bios_get_system_type(void); @@ -185,7 +186,6 @@ bios_configure_memory() struct phys_mem_desc *m; vaddr_t seg_start, seg_end; int i; - char str[100]; descr = (arc_mem_t *)Bios_GetMemoryDescriptor(descr); while(descr != 0) { @@ -197,12 +197,6 @@ bios_configure_memory() case BadMemory: /* Have no use for theese */ break; -#if 0 - case ExeceptionBlock: - case SystemParameterBlock: - case FirmwareTemporary: - case FirmwarePermanent: -#endif case FreeMemory: case FreeContigous: physmem += descr->PageCount; @@ -227,7 +221,15 @@ bios_configure_memory() } break; - case LoadedProgram: /* This is the loaded kernel */ + case ExeceptionBlock: + case SystemParameterBlock: + case FirmwareTemporary: + case FirmwarePermanent: + rsvdmem += descr->PageCount; + physmem += descr->PageCount; + break; + + case LoadedProgram: /* Count this into total memory */ physmem += descr->PageCount; break; @@ -239,6 +241,7 @@ bios_configure_memory() #ifdef DEBUG_MEM_LAYOUT for ( i = 0; i < MAXMEMSEGS; i++) { + char str[100]; if (mem_layout[i].mem_first_page) { snprintf(str, sizeof(str), "MEM %d, 0x%x to 0x%x\n",i, mem_layout[i].mem_first_page * 4096, diff --git a/sys/arch/mips64/mips64/busdma.c b/sys/arch/mips64/mips64/busdma.c index bbfc5fea450..02c4396794c 100644 --- a/sys/arch/mips64/mips64/busdma.c +++ b/sys/arch/mips64/mips64/busdma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: busdma.c,v 1.2 2004/08/06 22:11:54 pefo Exp $ */ +/* $OpenBSD: busdma.c,v 1.3 2004/08/09 14:57:26 pefo Exp $ */ /* * Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -11,11 +11,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Opsycon AB, Sweden. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED diff --git a/sys/arch/mips64/mips64/cache_r5k.S b/sys/arch/mips64/mips64/cache_r5k.S index 26d3ee00679..334b5859550 100644 --- a/sys/arch/mips64/mips64/cache_r5k.S +++ b/sys/arch/mips64/mips64/cache_r5k.S @@ -1,4 +1,4 @@ -/* $OpenBSD: cache_r5k.S,v 1.2 2004/08/07 14:48:26 pefo Exp $ */ +/* $OpenBSD: cache_r5k.S,v 1.3 2004/08/09 14:57:26 pefo Exp $ */ /* * Copyright (c) 1998-2004 Opsycon AB (www.opsycon.se) @@ -160,7 +160,6 @@ * CpuNWayCache is set to 0 for direct mapped caches, 2 for two way * caches and 4 for four way caches. This primarily indicates the * primary cache associativity. - * cpu_id is set for later decision testing. * * Allocation: * t4, t5 t6 used to hold I and D set size and Alias mask. @@ -171,7 +170,6 @@ LEAF(Mips5k_ConfigCache) .set noreorder mfc0 v1, COP_0_PRID # read processor ID register mfc0 v0, COP_0_CONFIG # Get configuration register - sw v1, cpu_id # save PRID register srl t1, v0, 9 # Get I cache size. and t1, 3 diff --git a/sys/arch/mips64/mips64/clock.c b/sys/arch/mips64/mips64/clock.c index e7c9ed03dea..b936920b2ea 100644 --- a/sys/arch/mips64/mips64/clock.c +++ b/sys/arch/mips64/mips64/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.1 2004/08/06 20:56:03 pefo Exp $ */ +/* $OpenBSD: clock.c,v 1.2 2004/08/09 14:57:26 pefo Exp $ */ /* * Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -134,7 +134,7 @@ clock_int5_init(struct clock_softc *sc) int s; s = splclock(); - cpu_counter_interval = sys_config.cpu.clock / (hz * 2); + cpu_counter_interval = sys_config.cpu[0].clock / (hz * 2); cpu_counter_last = cp0_get_count() + cpu_counter_interval * 4; cp0_set_compare(cpu_counter_last); splx(s); @@ -201,7 +201,7 @@ delay(int n) int p, c; p = cp0_get_count(); - dly = (sys_config.cpu.clock / 1000000) * n / 2; + dly = (sys_config.cpu[0].clock / 1000000) * n / 2; while (dly > 0) { c = cp0_get_count(); dly -= c - p; @@ -219,7 +219,7 @@ nanodelay(int n) int p, c; p = cp0_get_count(); - dly = ((sys_config.cpu.clock * n) / 1000000000) / 2; + dly = ((sys_config.cpu[0].clock * n) / 1000000000) / 2; while (dly > 0) { c = cp0_get_count(); dly -= c - p; diff --git a/sys/arch/mips64/mips64/context.S b/sys/arch/mips64/mips64/context.S index dd84d71fbfb..fdb0b4b7a18 100644 --- a/sys/arch/mips64/mips64/context.S +++ b/sys/arch/mips64/mips64/context.S @@ -1,4 +1,4 @@ -/* $OpenBSD: context.S,v 1.1 2004/08/06 20:56:03 pefo Exp $ */ +/* $OpenBSD: context.S,v 1.2 2004/08/09 14:57:26 pefo Exp $ */ /* * Copyright (c) 2002-2003 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -11,11 +11,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Opsycon AB, Sweden. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED diff --git a/sys/arch/mips64/mips64/cp0access.S b/sys/arch/mips64/mips64/cp0access.S index 5e2d226e342..d789cf1a9e3 100644 --- a/sys/arch/mips64/mips64/cp0access.S +++ b/sys/arch/mips64/mips64/cp0access.S @@ -1,4 +1,4 @@ -/* $OpenBSD: cp0access.S,v 1.1 2004/08/06 20:56:03 pefo Exp $ */ +/* $OpenBSD: cp0access.S,v 1.2 2004/08/09 14:57:26 pefo Exp $ */ /* * Copyright (c) 2001-2003 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -11,11 +11,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Opsycon AB, Sweden. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED @@ -171,6 +166,12 @@ LEAF(setsr) move v0, a0 END(setsr) +LEAF(cp0_get_prid) + mfc0 v0, COP_0_PRID + j ra + nop +END(cp0_get_prid) + LEAF(cp0_get_count) mfc0 v0, COP_0_COUNT j ra diff --git a/sys/arch/mips64/mips64/cpu.c b/sys/arch/mips64/mips64/cpu.c index cb7ebf5f4a1..5e4dad6af54 100644 --- a/sys/arch/mips64/mips64/cpu.c +++ b/sys/arch/mips64/mips64/cpu.c @@ -1,7 +1,7 @@ -/* $OpenBSD: cpu.c,v 1.1 2004/08/06 20:56:03 pefo Exp $ */ +/* $OpenBSD: cpu.c,v 1.2 2004/08/09 14:57:26 pefo Exp $ */ /* - * Copyright (c) 1997-2003 Opsycon AB (www.opsycon.se) + * Copyright (c) 1997-2004 Opsycon AB (www.opsycon.se) * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -11,11 +11,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Opsycon AB, Sweden. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED @@ -42,9 +37,8 @@ #include <machine/autoconf.h> -/* Definition of the driver for autoconfig. */ -static int cpumatch(struct device *, void *, void *); -static void cpuattach(struct device *, struct device *, void *); +int cpumatch(struct device *, void *, void *); +void cpuattach(struct device *, struct device *, void *); int cpu_is_rm7k = 0; @@ -55,31 +49,32 @@ struct cfdriver cpu_cd = { NULL, "cpu", DV_DULL, NULL, 0 }; -static int -cpumatch(parent, cfdata, aux) - struct device *parent; - void *cfdata; - void *aux; +int +cpumatch(struct device *parent, void *match, void *aux) { + struct cfdata *cf = match; struct confargs *ca = aux; /* make sure that we're looking for a CPU. */ if (strcmp(ca->ca_name, cpu_cd.cd_name) != 0) - return (0); + return 0; + if (cf->cf_unit >= MAX_CPUS) + return 0; - return (20); /* Make CPU probe first */ + return 20; /* Make CPU probe first */ } -static void +void cpuattach(parent, dev, aux) struct device *parent; struct device *dev; void *aux; { + int cpuno = dev->dv_unit; printf(": "); - switch(sys_config.cpu.type) { + switch(sys_config.cpu[cpuno].type) { case MIPS_R4000: if(CpuPrimaryInstCacheSize == 16384) @@ -112,7 +107,7 @@ cpuattach(parent, dev, aux) printf("PMC-Sierra RM52X0 CPU"); break; case MIPS_RM7000: - if(sys_config.cpu.vers_maj < 2) { + if(sys_config.cpu[cpuno].vers_maj < 2) { printf("PMC-Sierra RM7000 CPU"); } else { @@ -124,13 +119,14 @@ cpuattach(parent, dev, aux) printf("PMC-Sierra RM9000 CPU"); break; default: - printf("Unknown CPU type (0x%x)",sys_config.cpu.type); + printf("Unknown CPU type (0x%x)",sys_config.cpu[cpuno].type); break; } - printf(" Rev. %d.%d with ", sys_config.cpu.vers_maj, sys_config.cpu.vers_min); + printf(" Rev. %d.%d with ", sys_config.cpu[cpuno].vers_maj, + sys_config.cpu[cpuno].vers_min); - switch(fpu_id.cpu.cp_imp) { + switch(sys_config.cpu[cpuno].fptype) { case MIPS_SOFT: printf("Software emulation float"); @@ -164,14 +160,14 @@ cpuattach(parent, dev, aux) break; case MIPS_UNKF1: default: - printf("Unknown FPU type (0x%x)", fpu_id.cpu.cp_imp); + printf("Unknown FPU type (0x%x)", sys_config.cpu[cpuno].fptype); break; } - printf(" Rev. %d.%d", fpu_id.cpu.cp_majrev, fpu_id.cpu.cp_minrev); + printf(" Rev. %d.%d", sys_config.cpu[cpuno].fpvers_maj, + sys_config.cpu[cpuno].fpvers_min); printf("\n"); - printf(" CPU clock %dMhz\n",sys_config.cpu.clock/1000000); - printf(" L1 Cache: I size %dkb(%d line),", + printf("cpu%d: L1 Cache: I size %dkb(%d line),", cpuno, CpuPrimaryInstCacheSize / 1024, CpuPrimaryInstCacheLSize); printf(" D size %dkb(%d line), ", @@ -189,53 +185,55 @@ cpuattach(parent, dev, aux) break; } if(CpuSecondaryCacheSize != 0) { - switch(fpu_id.cpu.cp_imp) { + switch(sys_config.cpu[cpuno].type) { case MIPS_RM7000: - printf(" L2 Cache: Size %dkb, four way\n", - CpuSecondaryCacheSize / 1024); + case MIPS_RM9000: + printf("cpu%d: L2 Cache: Size %dkb, four way\n", + cpuno, CpuSecondaryCacheSize / 1024); break; default: - printf(" L2 Cache: Size %dkb, direct mapped\n", - CpuSecondaryCacheSize / 1024); + printf("cpu%d: L2 Cache: Size %dkb, direct mapped\n", + cpuno, CpuSecondaryCacheSize / 1024); break; } } if(CpuTertiaryCacheSize != 0) { - printf(" L3 Cache: Size %dkb, direct mapped\n", - CpuTertiaryCacheSize / 1024); + printf("cpu%d: L3 Cache: Size %dkb, direct mapped\n", + cpuno, CpuTertiaryCacheSize / 1024); } #ifdef DEBUG - printf("\tSetsize %d:%d\n", CpuPrimaryInstSetSize, CpuPrimaryDataSetSize); - printf("\tAlias mask 0x%x\n", CpuCacheAliasMask); - printf("\tConfig Register %x\n",CpuConfigRegister); - printf("\tCache type %x\n", CpuCacheType); - if(fpu_id.cpu.cp_imp == MIPS_RM7000) { + printf("cpu%d: Setsize %d:%d\n", cpuno, + CpuPrimaryInstSetSize, CpuPrimaryDataSetSize); + printf("cpu%d: Alias mask 0x%x\n", cpuno, CpuCacheAliasMask); + printf("cpu%d: Config Register %x\n", cpuno, CpuConfigRegister); + printf("cpu%d: Cache type %x\n", cpuno, CpuCacheType); + if(fpu_id.cpu[cpuno].cp_imp == MIPS_RM7000) { u_int tmp; tmp = CpuConfigRegister; - printf("\t\t\t"); + printf("cpu%d: ", cpuno); printf("K0 = %1d ",0x7 & tmp); printf("SE = %1d ",0x1 & (tmp>>3)); printf("DB = %1d ",0x1 & (tmp>>4)); printf("IB = %1d\n",0x1 & (tmp>>5)); - printf("\t\t\t"); + printf("cpu%d: ", cpuno); printf("DC = %1d ",0x7 & (tmp>>6)); printf("IC = %1d ",0x7 & (tmp>>9)); printf("TE = %1d ",0x1 & (tmp>>12)); printf("EB = %1d\n",0x1 & (tmp>>13)); - printf("\t\t\t"); + printf("cpu%d: ", cpuno); printf("EM = %1d ",0x1 & (tmp>>14)); printf("BE = %1d ",0x1 & (tmp>>15)); printf("TC = %1d ",0x1 & (tmp>>17)); printf("EW = %1d\n",0x3 & (tmp>>18)); - printf("\t\t\t"); + printf("cpu%d: ", cpuno); printf("TS = %1d ",0x3 & (tmp>>20)); printf("EP = %1d ",0xf & (tmp>>24)); printf("EC = %1d ",0x7 & (tmp>>28)); printf("SC = %1d\n",0x1 & (tmp>>31)); } - printf("\tStatus Register %x\n",CpuStatusRegister); + printf("cpu%d: Status Register %x\n", cpuno, CpuStatusRegister); #endif } diff --git a/sys/arch/mips64/mips64/cpu_ecoff.c b/sys/arch/mips64/mips64/cpu_ecoff.c deleted file mode 100644 index b9731837fca..00000000000 --- a/sys/arch/mips64/mips64/cpu_ecoff.c +++ /dev/null @@ -1,95 +0,0 @@ -/* $OpenBSD: cpu_ecoff.c,v 1.1 2004/08/06 20:56:03 pefo Exp $ */ - -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by Ralph - * Campbell. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)machdep.c 8.3 (Berkeley) 1/12/94 - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/proc.h> -#include <sys/malloc.h> -#include <sys/vnode.h> -#include <sys/exec.h> -#include <sys/resourcevar.h> - -#include <machine/frame.h> - -#if defined(_KERN_DO_ECOFF) -#include <sys/exec_ecoff.h> - -void cpu_exec_ecoff_setregs __P((struct proc *, struct exec_package *, - u_long, register_t *)); -void -cpu_exec_ecoff_setregs(p, pack, stack, retval) - struct proc *p; - struct exec_package *pack; - u_long stack; - register_t *retval; -{ - struct ecoff_aouthdr *eap; - - setregs(p, pack, stack, retval); - eap = (struct ecoff_aouthdr *) - ((caddr_t)pack->ep_hdr + sizeof(struct ecoff_filehdr)); -#if defined(pmax) - p->p_md.md_regs[GP] = eap->ea_gp_value; -#else - p->p_md.md_regs->gp = eap->ea_gp_value; -#endif -} - -/* - * cpu_exec_ecoff_hook(): - * cpu-dependent ECOFF format hook for execve(). - * - * Do any machine-dependent diddling of the exec package when doing ECOFF. - * - */ -int -cpu_exec_ecoff_hook(p, epp) - struct proc *p; - struct exec_package *epp; -{ -#ifdef COMPAT_ULTRIX - extern struct emul emul_ultrix; - - epp->ep_emul = &emul_ultrix; -#endif - return 0; -} - -#endif /* _KERN_DO_ECOFF */ diff --git a/sys/arch/mips64/mips64/db_machdep.c b/sys/arch/mips64/mips64/db_machdep.c index da13380f195..335ed736796 100644 --- a/sys/arch/mips64/mips64/db_machdep.c +++ b/sys/arch/mips64/mips64/db_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db_machdep.c,v 1.1 2004/08/06 20:56:03 pefo Exp $ */ +/* $OpenBSD: db_machdep.c,v 1.2 2004/08/09 14:57:26 pefo Exp $ */ /* * Copyright (c) 1998-2003 Opsycon AB (www.opsycon.se) @@ -11,11 +11,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Opsycon AB, Sweden. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED @@ -573,10 +568,10 @@ char *attr[] = { if(have_addr && addr < 256) { pid = addr; tlbno = 0; - count = sys_config.cpu.tlbsize; + count = sys_config.cpu[0].tlbsize; } } else if (m[0] == 'c') { - last = sys_config.cpu.tlbsize; + last = sys_config.cpu[0].tlbsize; for (tlbno = 0; tlbno < last; tlbno++) { tlb_read(tlbno, &tlb); for (check = tlbno + 1; check < last; check++) { @@ -592,17 +587,17 @@ if ((tlbp.tlb_hi == tlb.tlb_hi && (tlb.tlb_lo0 & PG_V || tlb.tlb_lo1 & PG_V)) || } return; } else { - if(have_addr && addr < sys_config.cpu.tlbsize) { + if(have_addr && addr < sys_config.cpu[0].tlbsize) { tlbno = addr; } else { tlbno = 0; - count = sys_config.cpu.tlbsize; + count = sys_config.cpu[0].tlbsize; } } last = tlbno + count; - for (; tlbno < sys_config.cpu.tlbsize && tlbno < last; tlbno++) { + for (; tlbno < sys_config.cpu[0].tlbsize && tlbno < last; tlbno++) { tlb_read(tlbno, &tlb); if (pid >= 0 && (tlb.tlb_hi & 0xff) != pid) diff --git a/sys/arch/mips64/mips64/exception.S b/sys/arch/mips64/mips64/exception.S index 61d20a8fba7..cd61b7ac8de 100644 --- a/sys/arch/mips64/mips64/exception.S +++ b/sys/arch/mips64/mips64/exception.S @@ -1,4 +1,4 @@ -/* $OpenBSD: exception.S,v 1.1 2004/08/06 20:56:03 pefo Exp $ */ +/* $OpenBSD: exception.S,v 1.2 2004/08/09 14:57:26 pefo Exp $ */ /* * Copyright (c) 2002-2003 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -11,11 +11,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Opsycon AB, Sweden. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED @@ -142,7 +137,7 @@ u_exception_table: .globl exception exception: .set noat -#if 0 +#ifdef TLB_TRACE dmfc0 k0, COP_0_EXC_PC PTR_L k1, tlbtrcptr PTR_S k0, 0(k1) diff --git a/sys/arch/mips64/mips64/interrupt.c b/sys/arch/mips64/mips64/interrupt.c index 9a47f98d504..b2d3ba6ae87 100644 --- a/sys/arch/mips64/mips64/interrupt.c +++ b/sys/arch/mips64/mips64/interrupt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: interrupt.c,v 1.1 2004/08/06 20:56:03 pefo Exp $ */ +/* $OpenBSD: interrupt.c,v 1.2 2004/08/09 14:57:26 pefo Exp $ */ /* * Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -11,11 +11,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Opsycon AB, Sweden. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED diff --git a/sys/arch/mips64/mips64/lcore_access.S b/sys/arch/mips64/mips64/lcore_access.S index 05c4df8e454..84b3497b103 100644 --- a/sys/arch/mips64/mips64/lcore_access.S +++ b/sys/arch/mips64/mips64/lcore_access.S @@ -1,4 +1,4 @@ -/* $OpenBSD: lcore_access.S,v 1.2 2004/08/08 14:21:27 pefo Exp $ */ +/* $OpenBSD: lcore_access.S,v 1.3 2004/08/09 14:57:26 pefo Exp $ */ /* * Copyright (c) 2001-2003 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -11,11 +11,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Opsycon AB, Sweden. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED diff --git a/sys/arch/mips64/mips64/lcore_ddb.S b/sys/arch/mips64/mips64/lcore_ddb.S index 45241f13a48..090bdf9add9 100644 --- a/sys/arch/mips64/mips64/lcore_ddb.S +++ b/sys/arch/mips64/mips64/lcore_ddb.S @@ -1,4 +1,4 @@ -/* $OpenBSD: lcore_ddb.S,v 1.1 2004/08/06 20:56:03 pefo Exp $ */ +/* $OpenBSD: lcore_ddb.S,v 1.2 2004/08/09 14:57:26 pefo Exp $ */ /* * Copyright (c) 2001-2003 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -11,11 +11,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Opsycon AB, Sweden. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED diff --git a/sys/arch/mips64/mips64/lcore_float.S b/sys/arch/mips64/mips64/lcore_float.S index d9f03e7cd51..2a639ef91c4 100644 --- a/sys/arch/mips64/mips64/lcore_float.S +++ b/sys/arch/mips64/mips64/lcore_float.S @@ -1,4 +1,4 @@ -/* $OpenBSD: lcore_float.S,v 1.1 2004/08/06 20:56:03 pefo Exp $ */ +/* $OpenBSD: lcore_float.S,v 1.2 2004/08/09 14:57:26 pefo Exp $ */ /* * Copyright (c) 2001-2003 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -11,11 +11,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Opsycon AB, Sweden. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED @@ -517,3 +512,37 @@ FPReturn: j ra PTR_ADDU sp, sp, FRAMESZ(CF_SZ) END(MipsFPTrap) + +/*---------------------------------------------------------------------------- + * + * cp1_get_prid + * + * Get the floating point co-processor id. + * + * cp1_get_prid(void) + * + * Results: + * FPC_ID + * + * Side effects: + * None. + * + *---------------------------------------------------------------------------- + */ +LEAF(cp1_get_prid) + mfc0 v1, COP_0_STATUS_REG + li a0, SR_COP_1_BIT + or v1, a0 + mtc0 v1, COP_0_STATUS_REG + nop + nop + nop + nop + cfc1 v0, FPC_ID + xor v1, a0 + mtc0 v1, COP_0_STATUS_REG + ITLBNOPFIX + jr ra + nop +END(cp1_get_prid) + diff --git a/sys/arch/mips64/mips64/mainbus.c b/sys/arch/mips64/mips64/mainbus.c index 02e4841e2cc..f9e21face6d 100644 --- a/sys/arch/mips64/mips64/mainbus.c +++ b/sys/arch/mips64/mips64/mainbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mainbus.c,v 1.1 2004/08/06 20:56:03 pefo Exp $ */ +/* $OpenBSD: mainbus.c,v 1.2 2004/08/09 14:57:26 pefo Exp $ */ /* * Copyright (c) 2001-2003 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -11,11 +11,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Opsycon AB, Sweden. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED diff --git a/sys/arch/mips64/mips64/mem.c b/sys/arch/mips64/mips64/mem.c index 47320f2fdc6..7508e4b524b 100644 --- a/sys/arch/mips64/mips64/mem.c +++ b/sys/arch/mips64/mips64/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.1 2004/08/06 20:56:03 pefo Exp $ */ +/* $OpenBSD: mem.c,v 1.2 2004/08/09 14:57:26 pefo Exp $ */ /* $NetBSD: mem.c,v 1.6 1995/04/10 11:55:03 mycroft Exp $ */ /* @@ -65,7 +65,6 @@ static int ap_open_count = 0; extern int allowaperture; #endif -extern vaddr_t avail_end; caddr_t zeropage; #define mmread mmrw @@ -155,11 +154,8 @@ mmrw(dev, uio, flags) c = min(iov->iov_len, MAXPHYS); if (v < KSEG0_BASE) return (EFAULT); - if (v + c > PHYS_TO_KSEG0(avail_end + - sizeof (struct msgbuf)) && - (v < VM_MIN_KERNEL_ADDRESS || - !uvm_kernacc((caddr_t)v, c, - uio->uio_rw == UIO_READ ? B_READ : B_WRITE))) + if (!uvm_kernacc((caddr_t)v, c, + uio->uio_rw == UIO_READ ? B_READ : B_WRITE)) return (EFAULT); error = uiomove((caddr_t)v, c, uio); diff --git a/sys/arch/mips64/mips64/pmap.c b/sys/arch/mips64/mips64/pmap.c index c522ffad4c1..b22fd69ef8f 100644 --- a/sys/arch/mips64/mips64/pmap.c +++ b/sys/arch/mips64/mips64/pmap.c @@ -1,7 +1,7 @@ -/* $OpenBSD: pmap.c,v 1.1 2004/08/06 20:56:03 pefo Exp $ */ +/* $OpenBSD: pmap.c,v 1.2 2004/08/09 14:57:26 pefo Exp $ */ /* - * Copyright (c) 2001-2003 Opsycon AB (www.opsycon.se / www.opsycon.com) + * Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -11,11 +11,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Opsycon AB, Sweden. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED @@ -191,7 +186,7 @@ pmap_bootstrap() */ i = 0; for( n = 0; n < MAXMEMSEGS; n++) { - i += mem_layout[n].mem_size; + i += mem_layout[n].mem_last_page - mem_layout[n].mem_first_page + 1; } pv_table = (struct pv_entry *)uvm_pageboot_alloc(sizeof(struct pv_entry) * i); @@ -1491,7 +1486,7 @@ pmap_alloc_tlbpid(p) if (pmap->pm_tlbgen != tlbpid_gen) { id = tlbpid_cnt; if (id >= VMNUM_PIDS) { - tlb_flush(sys_config.cpu.tlbsize); + tlb_flush(sys_config.cpu[0].tlbsize); /* reserve tlbpid_gen == 0 to alway mean invalid */ if (++tlbpid_gen == 0) tlbpid_gen = 1; diff --git a/sys/arch/mips64/mips64/sendsig.c b/sys/arch/mips64/mips64/sendsig.c index 01442baf648..b026cfa3103 100644 --- a/sys/arch/mips64/mips64/sendsig.c +++ b/sys/arch/mips64/mips64/sendsig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sendsig.c,v 1.1 2004/08/06 20:56:03 pefo Exp $ */ +/* $OpenBSD: sendsig.c,v 1.2 2004/08/09 14:57:26 pefo Exp $ */ /* * Copyright (c) 1990 The Regents of the University of California. @@ -47,11 +47,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Opsycon AB, Sweden. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED diff --git a/sys/arch/mips64/mips64/tlbhandler.S b/sys/arch/mips64/mips64/tlbhandler.S index cd7ef33e076..e96e69d6e5f 100644 --- a/sys/arch/mips64/mips64/tlbhandler.S +++ b/sys/arch/mips64/mips64/tlbhandler.S @@ -1,4 +1,4 @@ -/* $OpenBSD: tlbhandler.S,v 1.1 2004/08/06 20:56:03 pefo Exp $ */ +/* $OpenBSD: tlbhandler.S,v 1.2 2004/08/09 14:57:26 pefo Exp $ */ /* * Copyright (c) 1995-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -59,7 +59,7 @@ .globl tlb_miss /* 0xffffffff80000000 */ .set noat tlb_miss: -#if 0 +#ifdef TLB_TRACE dmfc0 k0, COP_0_EXC_PC PTR_L k1, tlbtrcptr PTR_S k0, 0(k1) diff --git a/sys/arch/sgi/conf/GENERIC b/sys/arch/sgi/conf/GENERIC index 61c5166da71..615907237b2 100644 --- a/sys/arch/sgi/conf/GENERIC +++ b/sys/arch/sgi/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.2 2004/08/09 10:19:50 miod Exp $ +# $OpenBSD: GENERIC,v 1.3 2004/08/09 14:57:26 pefo Exp $ # machine sgi mips64 @@ -13,7 +13,7 @@ makeoption ISALEV="-mips2 -D_MIPS_ISA=_MIPS_ISA_MIPS2" makeoption ENDIAN="-EB" # MD options -option NATIVE_ELF # Systems uses ELF as native format +option ARCBIOS # We use arcbios for FW comminication. #option COMPAT_O32 # Mips o32 ABI compat #option DB_ELFSIZE=32 diff --git a/sys/arch/sgi/conf/RAMDISK b/sys/arch/sgi/conf/RAMDISK index 827b7784f86..bff460c258c 100644 --- a/sys/arch/sgi/conf/RAMDISK +++ b/sys/arch/sgi/conf/RAMDISK @@ -1,4 +1,4 @@ -# $OpenBSD: RAMDISK,v 1.2 2004/08/09 10:19:50 miod Exp $ +# $OpenBSD: RAMDISK,v 1.3 2004/08/09 14:57:26 pefo Exp $ # machine sgi mips64 @@ -15,7 +15,7 @@ makeoption ENDIAN="-EB" option SWAPPAGER # swap pager (anonymous and swap space) option DEVPAGER # device pager (mapped devices) -option NATIVE_ELF # Systems uses ELF as native format +option ARCBIOS # Systems uses ARC firmware. option DIAGNOSTIC # extra kernel debugging checks #option DEBUG # extra kernel debugging support diff --git a/sys/arch/sgi/include/autoconf.h b/sys/arch/sgi/include/autoconf.h index 8761e9ac4da..046b369c77c 100644 --- a/sys/arch/sgi/include/autoconf.h +++ b/sys/arch/sgi/include/autoconf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.h,v 1.1 2004/08/06 21:12:18 pefo Exp $ */ +/* $OpenBSD: autoconf.h,v 1.2 2004/08/09 14:57:26 pefo Exp $ */ /* * Copyright (c) 2001-2003 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -43,20 +43,24 @@ /* * Structure holding all misc config information. */ +#define MAX_CPUS 4 struct sys_rec { int system_type; struct { - u_int32_t type; - u_int32_t vers_maj; - u_int32_t vers_min; + u_int16_t type; + u_int8_t vers_maj; + u_int8_t vers_min; + u_int16_t fptype; + u_int8_t fpvers_maj; + u_int8_t fpvers_min; u_int32_t clock; u_int32_t clock_bus; u_int32_t tlbsize; u_int32_t tlbwired; u_int32_t cfg_reg; u_int32_t stat_reg; - } cpu; + } cpu[MAX_CPUS]; struct mips_bus_space local; struct mips_bus_space isa_io; struct mips_bus_space isa_mem; diff --git a/sys/arch/sgi/include/dlfcn.h b/sys/arch/sgi/include/dlfcn.h deleted file mode 100644 index 815cef633e1..00000000000 --- a/sys/arch/sgi/include/dlfcn.h +++ /dev/null @@ -1,5 +0,0 @@ -/* $OpenBSD: dlfcn.h,v 1.1 2004/08/06 21:12:19 pefo Exp $ */ - -/* Use Mips generic include file */ - -#include <mips64/dlfcn.h> diff --git a/sys/arch/sgi/include/exec.h b/sys/arch/sgi/include/exec.h index 256af3ea9dd..75242789a88 100644 --- a/sys/arch/sgi/include/exec.h +++ b/sys/arch/sgi/include/exec.h @@ -1,4 +1,4 @@ -/* $OpenBSD: exec.h,v 1.1 2004/08/06 21:12:19 pefo Exp $ */ +/* $OpenBSD: exec.h,v 1.2 2004/08/09 14:57:26 pefo Exp $ */ /* * Copyright (c) 1996-2003 Per Fogelstrom @@ -56,7 +56,6 @@ #define _NLIST_DO_ELF #define _NLIST_DO_ECOFF -#define _KERN_DO_ECOFF /* XXX obsolete */ #define _KERN_DO_ELF #if defined(_LP64) #define _KERN_DO_ELF64 diff --git a/sys/arch/sgi/localbus/crimebus.h b/sys/arch/sgi/localbus/crimebus.h index ca4fabd0167..23cb9894bab 100644 --- a/sys/arch/sgi/localbus/crimebus.h +++ b/sys/arch/sgi/localbus/crimebus.h @@ -48,6 +48,46 @@ #define CRIME_INT_SOFT 0x0020 #define CRIME_INT_HARD 0x0028 +/* + * CRIME_INT_STAT and CRIME_INT_MASK mapping. + */ +#define CRIME_INT_VIDEO_IN_1 0x00000001 /* Video in 1 */ +#define CRIME_INT_VIDEO_IN_2 0x00000002 /* Video in 2 */ +#define CRIME_INT_VIDEO_OUT 0x00000004 /* Video out */ +#define CRIME_INT_MACE_ETHER 0x00000008 /* Mace ethernet NIC */ +#define CRIME_INT_SUPER_IO 0x00000010 /* Super I/O sub interrupt */ +#define CRIME_INT_SUB_MISC 0x00000020 /* Misc ??? */ +#define CRIME_INT_SUB_AUDIO 0x00000040 /* Audio sub interrupt */ +#define CRIME_INT_PCI_BRIDGE 0x00000080 /* PCI bridge errors */ +#define CRIME_INT_PCI_SCSI_0 0x00000100 /* AIC SCSI controller 0 */ +#define CRIME_INT_PCI_SCSI_1 0x00000200 /* AIC SCSI controller 1 */ +#define CRIME_INT_PCI_SLOT_0 0x00000400 /* PCI expansion slot 0 */ +#define CRIME_INT_PCI_SLOT_1 0x00000800 /* PCI expansion slot 1 */ +#define CRIME_INT_PCI_SLOT_2 0x00001000 /* PCI expansion slot 2 */ +#define CRIME_INT_PCI_SHARE_0 0x00002000 /* PCI shared 0 */ +#define CRIME_INT_PCI_SHARE_1 0x00004000 /* PCI shared 1 */ +#define CRIME_INT_PCI_SHARE_2 0x00008000 /* PCI shared 2 */ +#define CRIME_INT_GBE_0 0x00010000 /* GBE0 (E) */ +#define CRIME_INT_GBE_1 0x00020000 /* GBE1 (E) */ +#define CRIME_INT_GBE_2 0x00040000 /* GBE2 (E) */ +#define CRIME_INT_GBE_3 0x00080000 /* GBE3 (E) */ +#define CRIME_INT_CPU_ERR 0x00100000 /* CPU Errors */ +#define CRIME_INT_MEM_ERR 0x00200000 /* MEMORY Errors */ +#define CRIME_INT_RE_EDGE_EMPTY 0x00400000 /* RE */ +#define CRIME_INT_RE_EDGE_FULL 0x00800000 /* RE */ +#define CRIME_INT_RE_EDGE_IDLE 0x01000000 /* RE */ +#define CRIME_INT_RE_LEVL_EMPTY 0x02000000 /* RE */ +#define CRIME_INT_RE_LEVL_FULL 0x04000000 /* RE */ +#define CRIME_INT_RE_LEVL_IDLE 0x08000000 /* RE */ +#define CRIME_INT_SOFT_0 0x10000000 /* ??? */ +#define CRIME_INT_SOFT_1 0x20000000 /* ??? */ +#define CRIME_INT_SOFT_2 0x40000000 /* ??? */ +#define CRIME_INT_VICE 0x80000000 /* ??? */ + + +/* + * Watchdog? + */ #define CRIME_KICK_DOG 0x0030 #define CRIME_TIMER 0x0038 diff --git a/sys/arch/sgi/localbus/macebus.h b/sys/arch/sgi/localbus/macebus.h index d5a3438ebc3..e3675f3e11b 100644 --- a/sys/arch/sgi/localbus/macebus.h +++ b/sys/arch/sgi/localbus/macebus.h @@ -91,6 +91,18 @@ #define MACE_ISA_MISC_RLED_OFF 0x0010 /* Turns off RED LED */ #define MACE_ISA_MISC_GLED_OFF 0x0020 /* Turns off GREEN LED */ +/* MACE_ISA_INT_* definitions */ +#define MACE_ISA_INT_AUDIO 0x000000ff /* Audio ints */ +#define MACE_ISA_INT_RTC 0x00000100 /* RTC */ +#define MACE_ISA_INT_KBD 0x00000200 /* Keyboard */ +#define MACE_ISA_INT_KBD_POLL 0x00000400 /* Keyboard polled */ +#define MACE_ISA_INT_MOUSE 0x00000800 /* Mouse */ +#define MACE_ISA_INT_MOUSE_POLL 0x00001000 /* Mouse polled */ +#define MACE_ISA_INT_TIMER 0x0000e000 /* Timer/counter compare */ +#define MACE_ISA_INT_PARALLEL 0x000f0000 /* Parallel port */ +#define MACE_ISA_INT_SERIAL_1 0x03f00000 /* Serial port 1 */ +#define MACE_ISA_INT_SERIAL_2 0xfc000000 /* Serial port 2 */ + /* ISA Periferials */ #define MACE_ISA_EPP_OFFS (MACE_ISAX_OFFS+0x00000000) diff --git a/sys/arch/sgi/sgi/locore.S b/sys/arch/sgi/sgi/locore.S index 913cae7148e..de33a8a78ad 100644 --- a/sys/arch/sgi/sgi/locore.S +++ b/sys/arch/sgi/sgi/locore.S @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.S,v 1.1 2004/08/06 21:12:19 pefo Exp $ */ +/* $OpenBSD: locore.S,v 1.2 2004/08/09 14:57:26 pefo Exp $ */ /* * Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -61,17 +61,6 @@ start: sw zero, CF_RA_OFFS(sp) # Zero out old ra for debugger move sp, v0 # switch to new stack - li t0, SR_COP_1_BIT # Disable interrupts and - mtc0 t0, COP_0_STATUS_REG # enable the fp coprocessor - nop - nop # wait for new status to - nop - nop - nop # wait for new status to - nop # to be effective - nop - cfc1 t1, FPC_ID # read FPU ID register - sw t1, fpu_id # save FPU ID register jal main # main(regs) move a0, zero PANIC("Startup failed!") diff --git a/sys/arch/sgi/sgi/machdep.c b/sys/arch/sgi/sgi/machdep.c index febbfe36895..4a680f2f5f7 100644 --- a/sys/arch/sgi/sgi/machdep.c +++ b/sys/arch/sgi/sgi/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.1 2004/08/06 21:12:19 pefo Exp $ */ +/* $OpenBSD: machdep.c,v 1.2 2004/08/09 14:57:26 pefo Exp $ */ /* * Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -78,6 +78,7 @@ #include <dev/cons.h> +#include <mips64/arcbios.h> #include <mips64/archtype.h> #include <machine/bus.h> @@ -85,8 +86,8 @@ extern struct consdev *cn_tab; extern char kernel_text[]; -extern void makebootdev __P((char *)); -extern void stacktrace __P((void)); +extern void makebootdev(char *); +extern void stacktrace(void); /* the following is used externally (sysctl_hw) */ char machine[] = MACHINE; /* machine "architecture" */ @@ -124,6 +125,7 @@ register_t tlbtrcptr; int msgbufmapped; /* set when safe to use msgbuf */ int physmem; /* max supported memory, changes to actual */ +int rsvdmem; /* reserved memory not usable */ int ncpu = 1; /* At least one cpu in the system */ struct user *proc0paddr; struct user *curprocpaddr; @@ -139,16 +141,14 @@ caddr_t ssym; caddr_t esym; caddr_t ekern; -struct mem_descriptor mem_layout[MAXMEMSEGS]; -vaddr_t avail_end; /* PA of last available physical page */ +struct phys_mem_desc mem_layout[MAXMEMSEGS]; -caddr_t mips_init __P((int, int32_t *, int32_t *)); +caddr_t mips_init(int, int32_t *); void initcpu(void); void dumpsys(void); void dumpconf(void); caddr_t allocsys(caddr_t); -static char *getenv(char *env); static void dobootopts(char *cp); static void get_eth_hw_addr(char *, char *); static int atoi(char *, int); @@ -167,7 +167,7 @@ int my_endian = 0; */ caddr_t -mips_init(int argc, int32_t *argv, int32_t *envv) +mips_init(int argc, int32_t *argv) { char *cp; char *arg0; @@ -182,9 +182,14 @@ mips_init(int argc, int32_t *argv, int32_t *envv) extern char exception[], e_exception[]; /* + * Clean up any mess. + */ + Bios_FlushAllCaches(); + + /* * Clear the compiled BSS segment in OpenBSD code */ - bzero(edata, (int)end - (int)edata); + bzero(edata, end-edata); /* * Reserve symol table space. If invalid pointers no table. @@ -202,18 +207,15 @@ mips_init(int argc, int32_t *argv, int32_t *envv) } /* - * Point environment for getenv() lookups. + * Initialize the system type and set up memory layout */ - environment = envv; + bios_ident(); /* * Determine system type and set up configuration record data. */ - sys_config.system_type = -1; - cp = getenv("systype"); -/*XXX*/ cp = "moosehead"; - if(cp && strncasecmp("moosehead", cp, 9) == 0) { - sys_config.system_type = SGI_O2; + if (sys_config.system_type == SGI_O2) { + bios_putstring("Found SGI-IP32, setting up.\n"); strlcpy(cpu_model, "SGI O2", sizeof(cpu_model)); sys_config.cons_ioaddr[0] = 0x00390000; /*XXX*/ sys_config.cons_ioaddr[1] = 0x00398000; /*XXX*/ @@ -229,28 +231,13 @@ mips_init(int argc, int32_t *argv, int32_t *envv) #endif sys_config.pci_mem[0].bus_base_dma = 0x00000000;/*XXX*/ sys_config.pci_mem[0].bus_reverse = my_endian; - sys_config.cpu.tlbwired = 3; - } - - /* - * Determine CPU clock frequency for timer and delay setup - */ - if(getenv("cpuclock") != 0) { - sys_config.cpu.clock = atoi(getenv("cpuclock"), 10); - } - else { - sys_config.cpu.clock = 180000000; /* Reasonable default */ + sys_config.cpu[0].tlbwired = 2; + sys_config.cpu[0].clock = 200000000; /* Reasonable default */ + } else { + bios_putstring("Unsupported system!!!\n"); + while(1); } - /* - * Initialize virtual memory system. - */ - if(getenv("memsize") != 0) { - physmem = atop(atoi(getenv("memsize"), 10) * 1024 *1024); - } - else { - physmem = atop(1024 * 1024 * 64); /* Reasonable default */ - } #if 0 #if defined(DDB) || defined(DEBUG) physmem = atop(1024 * 1024 * 256); @@ -264,36 +251,45 @@ mips_init(int argc, int32_t *argv, int32_t *envv) #endif #endif - /* Set pagesize to enable use of page macros and functions */ + /* + * Use cpufrequency from bios to start with. + */ + cp = Bios_GetEnvironmentVariable("cpufreq"); + if (cp) { + i = atoi(cp, 10); + if (i > 100) + sys_config.cpu[0].clock = i * 1000000; + } + + /* + * Set pagesize to enable use of page macros and functions. + * Commit available memory to UVM system + */ uvmexp.pagesize = 4096; uvm_setpagesize(); - /* Build up memory description and commit to UVM system */ - mem_layout[0].mem_start = atop(0x20000); /* Skip int vectors */ - mem_layout[0].mem_size = atop(KSEG0_TO_PHYS(kernel_text)); - mem_layout[0].mem_size -= mem_layout[0].mem_start; - - mem_layout[1].mem_start = atop(round_page(KSEG0_TO_PHYS((long)ekern))); - mem_layout[1].mem_size = physmem - mem_layout[1].mem_start; + for(i = 0; i < MAXMEMSEGS && mem_layout[i].mem_first_page != 0; i++) { + vaddr_t fp, lp; + u_int32_t lastkernpage = atop(ekern); - avail_end = ptoa(physmem); + fp = mem_layout[i].mem_first_page; + lp = mem_layout[i].mem_last_page - 1; - for(i = 1; i < MAXMEMSEGS && mem_layout[i].mem_size != 0; i++) { - vaddr_t fp, lp; + /* Account for expansion from kernel symbol table */ + if (fp < lastkernpage && lp >= lastkernpage) + fp = lastkernpage + 1; - fp = mem_layout[i].mem_start; - lp = mem_layout[i].mem_start + mem_layout[i].mem_size; - uvm_page_physload(fp, lp, fp, lp, VM_FREELIST_DEFAULT); + if (fp <= lp) + uvm_page_physload(fp, lp, fp, lp, VM_FREELIST_DEFAULT); } /* * Figure out where we was booted from. */ -argc = 0; if(argc > 1) arg0 = (char *)(long)argv[1]; else - arg0 = getenv("bootdev"); + arg0 = Bios_GetEnvironmentVariable("bootdev"); if(arg0 == 0) arg0 = "unknown"; @@ -310,8 +306,8 @@ argc = 0; boothowto = RB_SINGLE | RB_ASKNAME; #endif /* RAMDISK_HOOKS */ - get_eth_hw_addr(getenv("ethaddr"), eth_hw_addr); - dobootopts(getenv("osloadoptions")); + get_eth_hw_addr(Bios_GetEnvironmentVariable("ethaddr"), eth_hw_addr); + dobootopts(Bios_GetEnvironmentVariable("osloadoptions")); /* Check any extra arguments which override. */ for(i = 2; i < argc; i++) { @@ -321,62 +317,41 @@ argc = 0; } /* Check l3cache size and disable (hard) if non present. */ - if(getenv("l3cache") != 0) { - i = atoi(getenv("l3cache"), 10); + if(Bios_GetEnvironmentVariable("l3cache") != 0) { + i = atoi(Bios_GetEnvironmentVariable("l3cache"), 10); CpuTertiaryCacheSize = 1024 * 1024 * i; } else { CpuTertiaryCacheSize = 0; } - if(CpuTertiaryCacheSize == 0) { - CpuExternalCacheOn = 0; /* No L3 detected */ - } else { - CpuExternalCacheOn = 1; - } - - cp = getenv("ecache_on"); - if(cp && (*cp == 0 || *cp == 'n' || *cp == 'N')) { - CpuExternalCacheOn = 0; /* Override config setting */ - } - - cp = getenv("ocache_on"); - if(cp && (*cp == 0 || *cp == 'n' || *cp == 'N')) { - CpuOnboardCacheOn = 0; /* Override HW setting */ - } else { - CpuOnboardCacheOn = 1; - } - sys_config.cpu.cfg_reg = Mips_ConfigCache(); - sys_config.cpu.type = cpu_id.cpu.cp_imp; - sys_config.cpu.vers_maj = cpu_id.cpu.cp_majrev; - sys_config.cpu.vers_min = cpu_id.cpu.cp_minrev; + sys_config.cpu[0].cfg_reg = Mips_ConfigCache(); + sys_config.cpu[0].type = (cp0_get_prid() >> 8) & 0xff; + sys_config.cpu[0].vers_maj = (cp0_get_prid() >> 4) & 0x0f; + sys_config.cpu[0].vers_min = cp0_get_prid() & 0x0f; + sys_config.cpu[0].fptype = (cp1_get_prid() >> 8) & 0xff; + sys_config.cpu[0].fpvers_maj = (cp1_get_prid() >> 4) & 0x0f; + sys_config.cpu[0].fpvers_min = cp1_get_prid() & 0x0f; /* * Configure TLB. */ - switch(sys_config.cpu.type) { + switch(sys_config.cpu[0].type) { case MIPS_RM7000: - if(sys_config.cpu.vers_maj < 2) { - sys_config.cpu.tlbsize = 48; + if(sys_config.cpu[0].vers_maj < 2) { + sys_config.cpu[0].tlbsize = 48; } else { - sys_config.cpu.tlbsize = 64; + sys_config.cpu[0].tlbsize = 64; } break; default: - sys_config.cpu.tlbsize = 48; + sys_config.cpu[0].tlbsize = 48; break; } - if(getenv("tlbwired")) { - i = atoi(getenv("tlbwired"), 10); - if((i < sys_config.cpu.tlbwired) || (i >= sys_config.cpu.tlbsize)) { - } else { - sys_config.cpu.tlbwired = i; - } - } tlb_set_wired(0); - tlb_flush(sys_config.cpu.tlbsize); - tlb_set_wired(sys_config.cpu.tlbwired); + tlb_flush(sys_config.cpu[0].tlbsize); + tlb_set_wired(sys_config.cpu[0].tlbwired); /* * Set up some fixed mappings. These are so frequently @@ -408,14 +383,9 @@ argc = 0; /* * Get a console, very early but after initial mapping setup. */ + bios_putstring("Initial setup done, switching console.\n\n"); consinit(); - if (sys_config.system_type < 0) { - printf("'systype' = '%s' not known!\n", cp ? cp : "NULL"); - panic("unidentified system"); - } - - /* * Allocate U page(s) for proc[0], pm_tlbpid 1. */ @@ -452,13 +422,7 @@ argc = 0; } bcopy(exception, (char *)CACHE_ERR_EXC_VEC, e_exception - exception); - - /* - * Keep PMON2000 exceptions if requested. - */ - if(!getenv("pmonexept")) { - bcopy(exception, (char *)GEN_EXC_VEC, e_exception - exception); - } + bcopy(exception, (char *)GEN_EXC_VEC, e_exception - exception); #ifdef DDB db_machine_init(); @@ -547,30 +511,6 @@ allocsys(caddr_t v) /* - * Return a pointer to the given environment variable. - */ -static char * -getenv(envname) - char *envname; -{ - int32_t *env = environment; - char *envp; - int i; - -return(NULL); - i = strlen(envname); - - while(*env) { - envp = (char *)(long)*env; - if(strncasecmp(envname, envp, i) == 0 && envp[i] == '=') { - return(&envp[i+1]); - } - env++; - } - return(NULL); -} - -/* * Decode boot options. */ static void @@ -654,6 +594,7 @@ cpu_startup() */ printf(version); printf("real mem = %d\n", ptoa(physmem)); + printf("rsvd mem = %d\n", ptoa(rsvdmem)); /* * Allocate virtual address space for file I/O buffers. @@ -858,22 +799,24 @@ boot(howto) (void) splhigh(); /* extreme priority */ if (howto & RB_HALT) { - printf("System halted.\n"); - if(sys_config.system_type == ALGOR_P5064 && howto & RB_POWERDOWN) { - printf("Shutting off!\n"); - *(int *)(0xffffffffbffa000c) = 1; + if (howto & RB_POWERDOWN) { + printf("System Power Down.\n"); + delay(1000000); + Bios_PowerDown(); + } else { + printf("System Halt.\n"); + delay(1000000); + Bios_EnterInteractiveMode(); } + printf("Didn't want to die!!! Reset manually.\n"); while(1); /* Forever */ - } - else { + } else { if (howto & RB_DUMP) dumpsys(); printf("System restart.\n"); -#if defined(LP64) - __asm__(" li $2, 0xffffffff80010100; jr $2; nop\n"); -#else - __asm__(" li $2, 0x80010100; jr $2; nop\n"); -#endif + delay(1000000); + Bios_Reboot(); + printf("Restart failed!!! Reset manually.\n"); while(1); /* Forever */ } /*NOTREACHED*/ |