Module Name: src
Committed By: mrg
Date: Sun Jan 24 07:36:54 UTC 2021
Modified Files:
src/sys/arch/sparc/dev: cons.h
src/sys/arch/sparc/include: autoconf.h cpu.h db_machdep.h intr.h pmap.h
trap.h
src/sys/arch/sparc/sparc: autoconf.c cache.c cpu.c db_interface.c
eeprom.c intr.c locore.s machdep.c memecc.c mkclock.c msiiepvar.h
oclock.c pci_fixup.c pmap.c process_machdep.c promlib.c timervar.h
trap.c
Added Files:
src/sys/arch/sparc/include: locore.h
Log Message:
avoid using 'extern <func|data>;' inside a .c file, but instead
use header files and ensure definitions are not duplicated or
are technically (if not in codegen) wrong.
To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/sparc/dev/cons.h
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/sparc/include/autoconf.h
cvs rdiff -u -r1.108 -r1.109 src/sys/arch/sparc/include/cpu.h
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/sparc/include/db_machdep.h
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/sparc/include/intr.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/sparc/include/locore.h
cvs rdiff -u -r1.95 -r1.96 src/sys/arch/sparc/include/pmap.h
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/sparc/include/trap.h
cvs rdiff -u -r1.263 -r1.264 src/sys/arch/sparc/sparc/autoconf.c
cvs rdiff -u -r1.101 -r1.102 src/sys/arch/sparc/sparc/cache.c
cvs rdiff -u -r1.258 -r1.259 src/sys/arch/sparc/sparc/cpu.c
cvs rdiff -u -r1.94 -r1.95 src/sys/arch/sparc/sparc/db_interface.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/sparc/sparc/eeprom.c \
src/sys/arch/sparc/sparc/msiiepvar.h
cvs rdiff -u -r1.126 -r1.127 src/sys/arch/sparc/sparc/intr.c
cvs rdiff -u -r1.278 -r1.279 src/sys/arch/sparc/sparc/locore.s
cvs rdiff -u -r1.335 -r1.336 src/sys/arch/sparc/sparc/machdep.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/sparc/sparc/memecc.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/sparc/sparc/mkclock.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/sparc/sparc/oclock.c \
src/sys/arch/sparc/sparc/process_machdep.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/sparc/sparc/pci_fixup.c
cvs rdiff -u -r1.372 -r1.373 src/sys/arch/sparc/sparc/pmap.c
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/sparc/sparc/promlib.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/sparc/sparc/timervar.h
cvs rdiff -u -r1.199 -r1.200 src/sys/arch/sparc/sparc/trap.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/sparc/dev/cons.h
diff -u src/sys/arch/sparc/dev/cons.h:1.5 src/sys/arch/sparc/dev/cons.h:1.6
--- src/sys/arch/sparc/dev/cons.h:1.5 Wed Nov 16 00:49:03 2005
+++ src/sys/arch/sparc/dev/cons.h Sun Jan 24 07:36:53 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: cons.h,v 1.5 2005/11/16 00:49:03 uwe Exp $ */
+/* $NetBSD: cons.h,v 1.6 2021/01/24 07:36:53 mrg Exp $ */
/*
@@ -9,6 +9,7 @@ extern int prom_stdin_node;
extern int prom_stdout_node;
extern char prom_stdin_args[];
extern char prom_stdout_args[];
+extern struct consdev consdev_prom;
#ifdef KGDB
struct zs_chanstate;
Index: src/sys/arch/sparc/include/autoconf.h
diff -u src/sys/arch/sparc/include/autoconf.h:1.49 src/sys/arch/sparc/include/autoconf.h:1.50
--- src/sys/arch/sparc/include/autoconf.h:1.49 Sun Jan 17 01:02:28 2021
+++ src/sys/arch/sparc/include/autoconf.h Sun Jan 24 07:36:54 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: autoconf.h,v 1.49 2021/01/17 01:02:28 mrg Exp $ */
+/* $NetBSD: autoconf.h,v 1.50 2021/01/24 07:36:54 mrg Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -179,5 +179,7 @@ int romgetcursoraddr(int **, int **);
/* Exported from autoconf.c for other consumers. */
extern char machine_model[100];
+extern struct sparc_bus_dma_tag mainbus_dma_tag;
+extern struct sparc_bus_space_tag mainbus_space_tag;
#endif /* !_MACHINE_AUTOCONF_H_ */
Index: src/sys/arch/sparc/include/cpu.h
diff -u src/sys/arch/sparc/include/cpu.h:1.108 src/sys/arch/sparc/include/cpu.h:1.109
--- src/sys/arch/sparc/include/cpu.h:1.108 Sat May 16 17:52:42 2020
+++ src/sys/arch/sparc/include/cpu.h Sun Jan 24 07:36:54 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.108 2020/05/16 17:52:42 ad Exp $ */
+/* $NetBSD: cpu.h,v 1.109 2021/01/24 07:36:54 mrg Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -490,6 +490,9 @@ extern int sparc_ncpus;
/* Provide %pc of a lwp */
#define LWP_PC(l) ((l)->l_md.md_tf->tf_pc)
+/* Hardware cross-call mutex */
+extern kmutex_t xpmsg_mutex;
+
/*
* Interrupt handler chains. Interrupt handlers should return 0 for
* ``not me'' or 1 (``I took care of it''). intr_establish() inserts a
Index: src/sys/arch/sparc/include/db_machdep.h
diff -u src/sys/arch/sparc/include/db_machdep.h:1.28 src/sys/arch/sparc/include/db_machdep.h:1.29
--- src/sys/arch/sparc/include/db_machdep.h:1.28 Mon Nov 6 03:47:48 2017
+++ src/sys/arch/sparc/include/db_machdep.h Sun Jan 24 07:36:54 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: db_machdep.h,v 1.28 2017/11/06 03:47:48 christos Exp $ */
+/* $NetBSD: db_machdep.h,v 1.29 2021/01/24 07:36:54 mrg Exp $ */
/*
* Mach Operating System
@@ -93,6 +93,8 @@ int db_inst_store(int inst);
bool db_inst_unconditional_flow_transfer(int inst);
db_addr_t db_branch_taken(int inst, db_addr_t pc, db_regs_t *regs);
+void ddb_suspend(struct trapframe *);
+
#define inst_trap_return(ins) db_inst_trap_return(ins)
#define inst_return(ins) db_inst_return(ins)
#define inst_call(ins) db_inst_call(ins)
Index: src/sys/arch/sparc/include/intr.h
diff -u src/sys/arch/sparc/include/intr.h:1.13 src/sys/arch/sparc/include/intr.h:1.14
--- src/sys/arch/sparc/include/intr.h:1.13 Wed Aug 21 04:17:41 2019
+++ src/sys/arch/sparc/include/intr.h Sun Jan 24 07:36:54 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: intr.h,v 1.13 2019/08/21 04:17:41 msaitoh Exp $ */
+/* $NetBSD: intr.h,v 1.14 2021/01/24 07:36:54 mrg Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -80,6 +80,8 @@ sparc_softintr_disestablish(void *cookie
* structure, which is otherwise internal to intr.c.
*/
#if defined(SUN4M) || defined(SUN4D)
+extern int (*moduleerr_handler)(void);
+extern int (*memerr_handler)(void);
extern void raise(int, int);
#if !(defined(SUN4) || defined(SUN4C))
#define sparc_softintr_schedule(cookie) raise(0, *((int *) (cookie)))
Index: src/sys/arch/sparc/include/pmap.h
diff -u src/sys/arch/sparc/include/pmap.h:1.95 src/sys/arch/sparc/include/pmap.h:1.96
--- src/sys/arch/sparc/include/pmap.h:1.95 Fri Dec 18 00:45:52 2020
+++ src/sys/arch/sparc/include/pmap.h Sun Jan 24 07:36:54 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.h,v 1.95 2020/12/18 00:45:52 mrg Exp $ */
+/* $NetBSD: pmap.h,v 1.96 2021/01/24 07:36:54 mrg Exp $ */
/*
* Copyright (c) 1996
@@ -55,6 +55,8 @@ struct vm_page;
#include <uvm/uvm_prot.h>
#include <uvm/uvm_pmap.h>
+#include <machine/promlib.h>
+
#include <sparc/pte.h>
/*
@@ -187,6 +189,12 @@ struct segmap {
#define PMAP_NULL ((pmap_t)0)
+/* Mostly private data exported for a few key consumers. */
+extern struct memarr *pmemarr;
+extern int npmemarr;
+extern vaddr_t prom_vstart;
+extern vaddr_t prom_vend;
+
/*
* Bounds on managed physical addresses. Used by (MD) users
* of uvm_pglistalloc() to provide search hints.
@@ -385,6 +393,8 @@ extern void (*pmap_protect_p)(pmap_t, va
#define tlb_flush_context_real() sta(ASI_SRMMUFP_L0, ASI_SRMMUFP, 0)
#define tlb_flush_all_real() sta(ASI_SRMMUFP_LN, ASI_SRMMUFP, 0)
+void setpte4m(vaddr_t va, int pte);
+
#endif /* SUN4M || SUN4D */
#define __HAVE_VM_PAGE_MD
Index: src/sys/arch/sparc/include/trap.h
diff -u src/sys/arch/sparc/include/trap.h:1.19 src/sys/arch/sparc/include/trap.h:1.20
--- src/sys/arch/sparc/include/trap.h:1.19 Wed Dec 19 13:57:50 2018
+++ src/sys/arch/sparc/include/trap.h Sun Jan 24 07:36:54 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.h,v 1.19 2018/12/19 13:57:50 maxv Exp $ */
+/* $NetBSD: trap.h,v 1.20 2021/01/24 07:36:54 mrg Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -133,4 +133,9 @@
#define ST_DIV0 (T_DIV0 & 0x7f)
#define ST_FLUSHWIN (T_FLUSHWIN & 0x7f)
+#if defined(_KERNEL) && !defined(_LOCORE)
+extern const char *trap_type[];
+extern struct fpstate initfpstate;
+#endif
+
#endif /* _MACHINE_TRAP_H_ */
Index: src/sys/arch/sparc/sparc/autoconf.c
diff -u src/sys/arch/sparc/sparc/autoconf.c:1.263 src/sys/arch/sparc/sparc/autoconf.c:1.264
--- src/sys/arch/sparc/sparc/autoconf.c:1.263 Sun Jan 17 01:04:58 2021
+++ src/sys/arch/sparc/sparc/autoconf.c Sun Jan 24 07:36:54 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: autoconf.c,v 1.263 2021/01/17 01:04:58 mrg Exp $ */
+/* $NetBSD: autoconf.c,v 1.264 2021/01/24 07:36:54 mrg Exp $ */
/*
* Copyright (c) 1996
@@ -48,7 +48,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.263 2021/01/17 01:04:58 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.264 2021/01/24 07:36:54 mrg Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@@ -76,6 +76,7 @@ __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v
#include <sys/boot_flag.h>
#include <sys/ksyms.h>
#include <sys/userconf.h>
+#include <sys/kgdb.h>
#include <net/if.h>
#include <net/if_ether.h>
@@ -89,6 +90,7 @@ __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v
#include <machine/promlib.h>
#include <machine/autoconf.h>
#include <machine/bootinfo.h>
+#include <machine/locore.h>
#include <sparc/sparc/memreg.h>
#include <machine/cpu.h>
@@ -96,6 +98,7 @@ __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v
#include <sparc/sparc/asm.h>
#include <sparc/sparc/cpuvar.h>
#include <sparc/sparc/timerreg.h>
+#include <sparc/dev/cons.h>
#include <dev/pci/pcireg.h>
#include <dev/pci/pcidevs.h>
@@ -120,11 +123,6 @@ __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v
* the machine.
*/
-#ifdef KGDB
-extern int kgdb_debug_panic;
-#endif
-extern void *bootinfo;
-
#if !NKSYMS && !defined(DDB) && !defined(MODULAR)
void bootinfo_relocate(void *);
#endif
@@ -300,13 +298,8 @@ static void bootstrapIIep(void);
void
bootstrap(void)
{
- extern uint8_t u0[];
- extern struct consdev consdev_prom;
-
#if NKSYMS || defined(DDB) || defined(MODULAR)
struct btinfo_symtab *bi_sym;
-#else
- extern int end[];
#endif
struct btinfo_boothowto *bi_howto;
@@ -324,7 +317,6 @@ bootstrap(void)
#if defined(SUN4M) || defined(SUN4D)
/* Switch to sparc v8 multiply/divide functions on v8 machines */
if (cpu_arch == 8) {
- extern void sparc_v8_muldiv(void);
sparc_v8_muldiv();
}
#endif /* SUN4M || SUN4D */
@@ -419,7 +411,6 @@ bootstrap4m(void)
int nvaddrs, *vaddrs, vstore[10];
u_int pte;
int i;
- extern void setpte4m(u_int, u_int);
if ((node = prom_opennode("/obio/interrupt")) == 0
&& (node = prom_finddevice("/obio/interrupt")) == 0)
@@ -489,8 +480,6 @@ bootstrap4m(void)
static void
bootstrapIIep(void)
{
- extern struct sparc_bus_space_tag mainbus_space_tag;
-
int node;
bus_space_handle_t bh;
pcireg_t id;
@@ -1121,9 +1110,6 @@ static int prom_getprop_address1(int, vo
static void
mainbus_attach(device_t parent, device_t dev, void *aux)
{
-extern struct sparc_bus_dma_tag mainbus_dma_tag;
-extern struct sparc_bus_space_tag mainbus_space_tag;
-
struct boot_special {
const char *const dev;
#define BS_EARLY 1 /* attach device early */
@@ -1991,7 +1977,6 @@ bootinfo_relocate(void *newloc)
int bi_size;
struct btinfo_common *bt;
char *cp, *dp;
- extern char *kernel_top;
if (bootinfo == NULL) {
kernel_top = newloc;
Index: src/sys/arch/sparc/sparc/cache.c
diff -u src/sys/arch/sparc/sparc/cache.c:1.101 src/sys/arch/sparc/sparc/cache.c:1.102
--- src/sys/arch/sparc/sparc/cache.c:1.101 Mon Sep 3 16:29:27 2018
+++ src/sys/arch/sparc/sparc/cache.c Sun Jan 24 07:36:54 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: cache.c,v 1.101 2018/09/03 16:29:27 riastradh Exp $ */
+/* $NetBSD: cache.c,v 1.102 2021/01/24 07:36:54 mrg Exp $ */
/*
* Copyright (c) 1996
@@ -59,7 +59,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cache.c,v 1.101 2018/09/03 16:29:27 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cache.c,v 1.102 2021/01/24 07:36:54 mrg Exp $");
#include "opt_multiprocessor.h"
#include "opt_sparc_arch.h"
@@ -72,6 +72,7 @@ __KERNEL_RCSID(0, "$NetBSD: cache.c,v 1.
#include <machine/ctlreg.h>
#include <machine/pte.h>
+#include <machine/locore.h>
#include <sparc/sparc/asm.h>
#include <sparc/sparc/cache.h>
@@ -912,8 +913,6 @@ hypersparc_cache_flush_all(void)
void
cypress_cache_flush_all(void)
{
- extern char kernel_text[];
-
char *p;
int i, ls;
@@ -1002,8 +1001,6 @@ viking_pcache_flush_page(paddr_t pa, int
}
} else {
- extern char kernel_text[];
-
/*
* Force the cache to validate its backing memory
* by displacing all cache lines with known read-only
Index: src/sys/arch/sparc/sparc/cpu.c
diff -u src/sys/arch/sparc/sparc/cpu.c:1.258 src/sys/arch/sparc/sparc/cpu.c:1.259
--- src/sys/arch/sparc/sparc/cpu.c:1.258 Sun Jan 17 01:02:28 2021
+++ src/sys/arch/sparc/sparc/cpu.c Sun Jan 24 07:36:54 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.258 2021/01/17 01:02:28 mrg Exp $ */
+/* $NetBSD: cpu.c,v 1.259 2021/01/24 07:36:54 mrg Exp $ */
/*
* Copyright (c) 1996
@@ -52,7 +52,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.258 2021/01/17 01:02:28 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.259 2021/01/24 07:36:54 mrg Exp $");
#include "opt_multiprocessor.h"
#include "opt_lockdebug.h"
@@ -82,6 +82,7 @@ __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.25
#include <machine/trap.h>
#include <machine/pcb.h>
#include <machine/pmap.h>
+#include <machine/locore.h>
#if defined(MULTIPROCESSOR) && defined(DDB)
#include <ddb/db_output.h>
@@ -662,7 +663,6 @@ cpu_init_system(void)
void
cpu_spinup(struct cpu_info *cpi)
{
- extern void cpu_hatch(void); /* in locore.s */
struct openprom_addr oa;
void *pc;
int n;
@@ -1105,7 +1105,6 @@ int hypersparc_getmid(void);
int viking_getmid(void);
#if (defined(SUN4M) && !defined(MSIIEP)) || defined(SUN4D)
-extern int (*moduleerr_handler)(void);
int viking_module_error(void);
#endif
Index: src/sys/arch/sparc/sparc/db_interface.c
diff -u src/sys/arch/sparc/sparc/db_interface.c:1.94 src/sys/arch/sparc/sparc/db_interface.c:1.95
--- src/sys/arch/sparc/sparc/db_interface.c:1.94 Fri Jul 21 20:56:10 2017
+++ src/sys/arch/sparc/sparc/db_interface.c Sun Jan 24 07:36:54 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: db_interface.c,v 1.94 2017/07/21 20:56:10 nakayama Exp $ */
+/* $NetBSD: db_interface.c,v 1.95 2021/01/24 07:36:54 mrg Exp $ */
/*
* Mach Operating System
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.94 2017/07/21 20:56:10 nakayama Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.95 2021/01/24 07:36:54 mrg Exp $");
#ifdef _KERNEL_OPT
#include "opt_ddb.h"
@@ -53,6 +53,7 @@ __KERNEL_RCSID(0, "$NetBSD: db_interface
#include <uvm/uvm.h>
#include <machine/db_machdep.h>
+#include <machine/locore.h>
#include <ddb/db_access.h>
#include <ddb/ddbvar.h>
@@ -98,7 +99,6 @@ db_read_bytes(vaddr_t addr, size_t size,
void
db_write_bytes(vaddr_t addr, size_t size, const char *data)
{
- extern char etext[];
char *dst;
dst = (char *)addr;
@@ -132,8 +132,6 @@ cpu_Debugger(void)
int db_active = 0;
-extern char *trap_type[];
-
#ifdef _KERNEL
void kdb_kbd_trap(struct trapframe *);
void db_prom_cmd(db_expr_t, bool, db_expr_t, const char *);
Index: src/sys/arch/sparc/sparc/eeprom.c
diff -u src/sys/arch/sparc/sparc/eeprom.c:1.9 src/sys/arch/sparc/sparc/eeprom.c:1.10
--- src/sys/arch/sparc/sparc/eeprom.c:1.9 Sun Jul 17 23:32:37 2011
+++ src/sys/arch/sparc/sparc/eeprom.c Sun Jan 24 07:36:54 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: eeprom.c,v 1.9 2011/07/17 23:32:37 mrg Exp $ */
+/* $NetBSD: eeprom.c,v 1.10 2021/01/24 07:36:54 mrg Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: eeprom.c,v 1.9 2011/07/17 23:32:37 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: eeprom.c,v 1.10 2021/01/24 07:36:54 mrg Exp $");
#include "opt_sparc_arch.h"
@@ -55,9 +55,6 @@ __KERNEL_RCSID(0, "$NetBSD: eeprom.c,v 1
#include <dev/clock_subr.h>
-/* Imported from clock.c: */
-extern char *eeprom_va;
-
static int eeprom_match(device_t, cfdata_t, void *);
static void eeprom_attach(device_t, device_t, void *);
Index: src/sys/arch/sparc/sparc/msiiepvar.h
diff -u src/sys/arch/sparc/sparc/msiiepvar.h:1.9 src/sys/arch/sparc/sparc/msiiepvar.h:1.10
--- src/sys/arch/sparc/sparc/msiiepvar.h:1.9 Tue Apr 16 06:57:06 2013
+++ src/sys/arch/sparc/sparc/msiiepvar.h Sun Jan 24 07:36:54 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: msiiepvar.h,v 1.9 2013/04/16 06:57:06 jdc Exp $ */
+/* $NetBSD: msiiepvar.h,v 1.10 2021/01/24 07:36:54 mrg Exp $ */
/*
* Copyright (c) 2001 Valeriy E. Ushakov
@@ -64,4 +64,7 @@ struct mspcic_pci_map {
#define IOMAP_SIZE 2
#define MEMMAP_SIZE 3
+extern struct mspcic_pci_map mspcic_pci_iomap[];
+extern struct mspcic_pci_map mspcic_pci_memmap[];
+
#endif /* _SPARC_MSIIEP_VAR_H_ */
Index: src/sys/arch/sparc/sparc/intr.c
diff -u src/sys/arch/sparc/sparc/intr.c:1.126 src/sys/arch/sparc/sparc/intr.c:1.127
--- src/sys/arch/sparc/sparc/intr.c:1.126 Sun Nov 22 03:55:33 2020
+++ src/sys/arch/sparc/sparc/intr.c Sun Jan 24 07:36:54 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: intr.c,v 1.126 2020/11/22 03:55:33 thorpej Exp $ */
+/* $NetBSD: intr.c,v 1.127 2021/01/24 07:36:54 mrg Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.126 2020/11/22 03:55:33 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.127 2021/01/24 07:36:54 mrg Exp $");
#include "opt_multiprocessor.h"
#include "opt_sparc_arch.h"
@@ -63,6 +63,7 @@ __KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.1
#include <machine/instr.h>
#include <machine/trap.h>
#include <machine/promlib.h>
+#include <machine/locore.h>
#include <sparc/sparc/asm.h>
#include <sparc/sparc/cpuvar.h>
@@ -82,8 +83,6 @@ static int intr_biglock_wrapper(void *);
void *xcall_cookie;
#endif
-extern kmutex_t xpmsg_mutex;
-
void strayintr(struct clockframe *);
#ifdef DIAGNOSTIC
void bogusintr(struct clockframe *);
@@ -565,8 +564,6 @@ ih_remove(struct intrhand **head, struct
}
static int fastvec; /* marks fast vectors (see below) */
-extern int sparc_interrupt4m[];
-extern int sparc_interrupt44c[];
#ifdef DIAGNOSTIC
static void
@@ -853,7 +850,6 @@ sparc_softintr_schedule(void *cookie)
struct softintr_cookie *sic = cookie;
if (CPU_ISSUN4M || CPU_ISSUN4D) {
#if defined(SUN4M) || defined(SUN4D)
- extern void raise(int,int);
raise(0, sic->sic_pilreq);
#endif
} else {
Index: src/sys/arch/sparc/sparc/locore.s
diff -u src/sys/arch/sparc/sparc/locore.s:1.278 src/sys/arch/sparc/sparc/locore.s:1.279
--- src/sys/arch/sparc/sparc/locore.s:1.278 Tue Jun 30 16:20:02 2020
+++ src/sys/arch/sparc/sparc/locore.s Sun Jan 24 07:36:54 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.s,v 1.278 2020/06/30 16:20:02 maxv Exp $ */
+/* $NetBSD: locore.s,v 1.279 2021/01/24 07:36:54 mrg Exp $ */
/*
* Copyright (c) 1996 Paul Kranenburg
@@ -5098,8 +5098,8 @@ Lufetchstore_fault:
/* probeget and probeset are meant to be used during autoconfiguration */
- .globl _C_LABEL(Lfsbail)
-_C_LABEL(Lfsbail):
+ .globl _C_LABEL(sparc_fsbail)
+_C_LABEL(sparc_fsbail):
st %g0, [%o2 + PCB_ONFAULT]! error in r/w, clear pcb_onfault
retl ! and return error indicator
mov -1, %o0
@@ -5116,8 +5116,8 @@ _C_LABEL(Lfsbail):
ENTRY(probeget)
! %o0 = addr, %o1 = (1,2,4)
sethi %hi(cpcb), %o2
- ld [%o2 + %lo(cpcb)], %o2 ! cpcb->pcb_onfault = Lfsbail;
- set Lfsbail, %o5
+ ld [%o2 + %lo(cpcb)], %o2 ! cpcb->pcb_onfault = sparc_fsbail;
+ set sparc_fsbail, %o5
st %o5, [%o2 + PCB_ONFAULT]
btst 1, %o1
bnz,a 0f ! if (len & 1)
@@ -5139,8 +5139,8 @@ ENTRY(probeget)
ENTRY(probeset)
! %o0 = addr, %o1 = (1,2,4), %o2 = val
sethi %hi(cpcb), %o3
- ld [%o3 + %lo(cpcb)], %o3 ! cpcb->pcb_onfault = Lfsbail;
- set Lfsbail, %o5
+ ld [%o3 + %lo(cpcb)], %o3 ! cpcb->pcb_onfault = sparc_fsbail;
+ set sparc_fsbail, %o5
st %o5, [%o3 + PCB_ONFAULT]
btst 1, %o1
bnz,a 0f ! if (len & 1)
@@ -5163,9 +5163,9 @@ ENTRY(probeset)
*/
ENTRY(xldcontrolb)
!sethi %hi(cpcb), %o2
- !ld [%o2 + %lo(cpcb)], %o2 ! cpcb->pcb_onfault = Lfsbail;
+ !ld [%o2 + %lo(cpcb)], %o2 ! cpcb->pcb_onfault = sparc_fsbail;
or %o1, %g0, %o2 ! %o2 = %o1
- set _C_LABEL(Lfsbail), %o5
+ set _C_LABEL(sparc_fsbail), %o5
st %o5, [%o2 + PCB_ONFAULT]
lduba [%o0] ASI_CONTROL, %o0 ! read
0: retl
@@ -5181,7 +5181,7 @@ ENTRY(xldcontrolb)
*/
ENTRY(fkbyte)
or %o1, %g0, %o2 ! %o2 = %o1
- set _C_LABEL(Lfsbail), %o5
+ set _C_LABEL(sparc_fsbail), %o5
st %o5, [%o2 + PCB_ONFAULT]
ldub [%o0], %o0 ! fetch the byte
retl ! made it
Index: src/sys/arch/sparc/sparc/machdep.c
diff -u src/sys/arch/sparc/sparc/machdep.c:1.335 src/sys/arch/sparc/sparc/machdep.c:1.336
--- src/sys/arch/sparc/sparc/machdep.c:1.335 Sun Nov 22 03:55:33 2020
+++ src/sys/arch/sparc/sparc/machdep.c Sun Jan 24 07:36:54 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.335 2020/11/22 03:55:33 thorpej Exp $ */
+/* $NetBSD: machdep.c,v 1.336 2021/01/24 07:36:54 mrg Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.335 2020/11/22 03:55:33 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.336 2021/01/24 07:36:54 mrg Exp $");
#include "opt_compat_netbsd.h"
#include "opt_compat_sunos.h"
@@ -139,8 +139,6 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v
#include <sparc/dev/power.h>
#endif
-extern paddr_t avail_end;
-
kmutex_t fpu_mtx;
/*
@@ -819,7 +817,6 @@ cpu_reboot(int howto, char *user_boot_st
#endif
boothowto = howto;
if ((howto & RB_NOSYNC) == 0 && waittime < 0) {
- extern struct lwp lwp0;
/* XXX protect against curlwp->p_stats.foo refs in sync() */
if (curlwp == NULL)
@@ -966,8 +963,6 @@ dumpsys(void)
int error = 0;
struct memarr *mp;
int nmem;
- extern struct memarr pmemarr[];
- extern int npmemarr;
/* copy registers to memory */
snapshot(cpuinfo.curpcb);
@@ -3123,8 +3118,6 @@ mm_md_physacc(paddr_t pa, vm_prot_t prot
int
mm_md_kernacc(void *ptr, vm_prot_t prot, bool *handled)
{
- extern vaddr_t prom_vstart;
- extern vaddr_t prom_vend;
const vaddr_t v = (vaddr_t)ptr;
*handled = (v >= MSGBUF_VA && v < MSGBUF_VA + PAGE_SIZE) ||
Index: src/sys/arch/sparc/sparc/memecc.c
diff -u src/sys/arch/sparc/sparc/memecc.c:1.17 src/sys/arch/sparc/sparc/memecc.c:1.18
--- src/sys/arch/sparc/sparc/memecc.c:1.17 Wed Jan 10 01:49:05 2018
+++ src/sys/arch/sparc/sparc/memecc.c Sun Jan 24 07:36:54 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: memecc.c,v 1.17 2018/01/10 01:49:05 mrg Exp $ */
+/* $NetBSD: memecc.c,v 1.18 2021/01/24 07:36:54 mrg Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: memecc.c,v 1.17 2018/01/10 01:49:05 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: memecc.c,v 1.18 2021/01/24 07:36:54 mrg Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -56,8 +56,6 @@ static void memecc_attach(device_t, devi
static int memecc_match(device_t, cfdata_t, void *);
static int memecc_error(void);
-extern int (*memerr_handler)(void);
-
CFATTACH_DECL_NEW(eccmemctl, sizeof(struct memecc_softc),
memecc_match, memecc_attach, NULL, NULL);
Index: src/sys/arch/sparc/sparc/mkclock.c
diff -u src/sys/arch/sparc/sparc/mkclock.c:1.19 src/sys/arch/sparc/sparc/mkclock.c:1.20
--- src/sys/arch/sparc/sparc/mkclock.c:1.19 Fri Jul 1 18:51:51 2011
+++ src/sys/arch/sparc/sparc/mkclock.c Sun Jan 24 07:36:54 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: mkclock.c,v 1.19 2011/07/01 18:51:51 dyoung Exp $ */
+/* $NetBSD: mkclock.c,v 1.20 2021/01/24 07:36:54 mrg Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mkclock.c,v 1.19 2011/07/01 18:51:51 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mkclock.c,v 1.20 2021/01/24 07:36:54 mrg Exp $");
#include "opt_sparc_arch.h"
@@ -52,6 +52,7 @@ __KERNEL_RCSID(0, "$NetBSD: mkclock.c,v
#include <machine/cpu.h>
#include <sparc/dev/bootbusvar.h>
+#include <sparc/sparc/timervar.h>
#include <dev/clock_subr.h>
#include <dev/ic/mk48txxreg.h>
@@ -82,9 +83,6 @@ CFATTACH_DECL_NEW(clock_obio, sizeof(str
CFATTACH_DECL_NEW(clock_bootbus, sizeof(struct mk48txx_softc),
clockmatch_bootbus, clockattach_bootbus, NULL, NULL);
-/* Imported from clock.c: */
-extern int (*eeprom_nvram_wenable)(int);
-
/*
* The OPENPROM calls the clock the "eeprom", so we have to have our
Index: src/sys/arch/sparc/sparc/oclock.c
diff -u src/sys/arch/sparc/sparc/oclock.c:1.20 src/sys/arch/sparc/sparc/oclock.c:1.21
--- src/sys/arch/sparc/sparc/oclock.c:1.20 Fri Jul 1 18:51:51 2011
+++ src/sys/arch/sparc/sparc/oclock.c Sun Jan 24 07:36:54 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: oclock.c,v 1.20 2011/07/01 18:51:51 dyoung Exp $ */
+/* $NetBSD: oclock.c,v 1.21 2021/01/24 07:36:54 mrg Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: oclock.c,v 1.20 2011/07/01 18:51:51 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: oclock.c,v 1.21 2021/01/24 07:36:54 mrg Exp $");
#include "opt_sparc_arch.h"
@@ -45,21 +45,17 @@ __KERNEL_RCSID(0, "$NetBSD: oclock.c,v 1
#include <sys/kernel.h>
#include <sys/device.h>
#include <sys/systm.h>
-
#include <sys/bus.h>
+
#include <machine/promlib.h>
#include <machine/autoconf.h>
+#include <sparc/sparc/timervar.h>
+
#include <dev/clock_subr.h>
#include <dev/ic/intersil7170reg.h>
#include <dev/ic/intersil7170var.h>
-/* Imported from clock.c: */
-extern int oldclk;
-extern int timerblurb;
-extern void (*timer_init)(void);
-
-
static int oclockmatch(device_t, cfdata_t, void *);
static void oclockattach(device_t, device_t, void *);
Index: src/sys/arch/sparc/sparc/process_machdep.c
diff -u src/sys/arch/sparc/sparc/process_machdep.c:1.20 src/sys/arch/sparc/sparc/process_machdep.c:1.21
--- src/sys/arch/sparc/sparc/process_machdep.c:1.20 Mon May 11 18:38:26 2020
+++ src/sys/arch/sparc/sparc/process_machdep.c Sun Jan 24 07:36:54 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: process_machdep.c,v 1.20 2020/05/11 18:38:26 kamil Exp $ */
+/* $NetBSD: process_machdep.c,v 1.21 2021/01/24 07:36:54 mrg Exp $ */
/*
* Copyright (c) 1993 The Regents of the University of California.
@@ -95,7 +95,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.20 2020/05/11 18:38:26 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.21 2021/01/24 07:36:54 mrg Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -103,10 +103,12 @@ __KERNEL_RCSID(0, "$NetBSD: process_mach
#include <sys/kernel.h>
#include <sys/proc.h>
#include <sys/vnode.h>
+#include <sys/ptrace.h>
+
#include <machine/psl.h>
#include <machine/reg.h>
#include <machine/frame.h>
-#include <sys/ptrace.h>
+#include <machine/trap.h>
int
process_read_regs(struct lwp *l, struct reg *regs)
@@ -151,8 +153,6 @@ process_set_pc(struct lwp *l, void *addr
return 0;
}
-extern struct fpstate initfpstate;
-
int
process_read_fpregs(struct lwp *l, struct fpreg *regs, size_t *sz)
{
Index: src/sys/arch/sparc/sparc/pci_fixup.c
diff -u src/sys/arch/sparc/sparc/pci_fixup.c:1.3 src/sys/arch/sparc/sparc/pci_fixup.c:1.4
--- src/sys/arch/sparc/sparc/pci_fixup.c:1.3 Sat Mar 2 14:21:19 2019
+++ src/sys/arch/sparc/sparc/pci_fixup.c Sun Jan 24 07:36:54 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_fixup.c,v 1.3 2019/03/02 14:21:19 christos Exp $ */
+/* $NetBSD: pci_fixup.c,v 1.4 2021/01/24 07:36:54 mrg Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -53,8 +53,6 @@
static void mspcic_pci_fixup(int, pcitag_t, int *, uint32_t *, uint32_t *,
uint32_t, uint32_t memtop);
-extern struct mspcic_pci_map mspcic_pci_iomap[];
-extern struct mspcic_pci_map mspcic_pci_memmap[];
/* ======================================================================
*
Index: src/sys/arch/sparc/sparc/pmap.c
diff -u src/sys/arch/sparc/sparc/pmap.c:1.372 src/sys/arch/sparc/sparc/pmap.c:1.373
--- src/sys/arch/sparc/sparc/pmap.c:1.372 Sun Jan 17 01:54:37 2021
+++ src/sys/arch/sparc/sparc/pmap.c Sun Jan 24 07:36:54 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.372 2021/01/17 01:54:37 mrg Exp $ */
+/* $NetBSD: pmap.c,v 1.373 2021/01/24 07:36:54 mrg Exp $ */
/*
* Copyright (c) 1996
@@ -56,7 +56,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.372 2021/01/17 01:54:37 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.373 2021/01/24 07:36:54 mrg Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@@ -84,6 +84,7 @@ __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.3
#include <machine/cpu.h>
#include <machine/ctlreg.h>
#include <machine/kcore.h>
+#include <machine/locore.h>
#include <sparc/sparc/asm.h>
#include <sparc/sparc/cache.h>
@@ -694,9 +695,6 @@ static inline void smp_tlb_flush_region
static inline void smp_tlb_flush_context (int ctx, u_int cpuset);
static inline void smp_tlb_flush_all (void);
-/* From locore: */
-extern void ft_tlb_flush(int va, int ctx, int lvl);
-
static inline void
smp_tlb_flush_page(int va, int ctx, u_int cpuset)
{
@@ -1128,36 +1126,36 @@ static void
pmap_page_upload(void)
{
int n;
- paddr_t start, end;
+ paddr_t pstart, pend;
/* First, the `etext gap' */
- start = PMAP_BOOTSTRAP_VA2PA(etext_gap_start);
- end = PMAP_BOOTSTRAP_VA2PA(etext_gap_end);
+ pstart = PMAP_BOOTSTRAP_VA2PA(etext_gap_start);
+ pend = PMAP_BOOTSTRAP_VA2PA(etext_gap_end);
#ifdef DIAGNOSTIC
- if (avail_start <= start)
+ if (avail_start <= pstart)
panic("pmap_page_upload: etext gap overlap: %lx < %lx",
- (u_long)avail_start, (u_long)start);
+ (u_long)avail_start, (u_long)pstart);
#endif
if (etext_gap_start < etext_gap_end) {
- vm_first_phys = start;
+ vm_first_phys = pstart;
uvm_page_physload(
- atop(start),
- atop(end),
- atop(start),
- atop(end), VM_FREELIST_DEFAULT);
+ atop(pstart),
+ atop(pend),
+ atop(pstart),
+ atop(pend), VM_FREELIST_DEFAULT);
}
for (n = 0; n < npmemarr; n++) {
- start = pmemarr[n].addr;
- end = start + pmemarr[n].len;
+ pstart = pmemarr[n].addr;
+ pend = pstart + pmemarr[n].len;
/* Update vm_{first_last}_phys */
- if (vm_first_phys > start)
- vm_first_phys = start;
- if (vm_last_phys < end)
- vm_last_phys = end;
+ if (vm_first_phys > pstart)
+ vm_first_phys = pstart;
+ if (vm_last_phys < pend)
+ vm_last_phys = pend;
/*
* Exclude any memory allocated for the kernel as computed
@@ -1166,23 +1164,23 @@ pmap_page_upload(void)
* Note that this will also exclude the `etext gap' range
* already uploaded above.
*/
- if (start < PMAP_BOOTSTRAP_VA2PA(KERNBASE)) {
+ if (pstart < PMAP_BOOTSTRAP_VA2PA(KERNBASE)) {
/*
* This segment starts below the kernel load address.
- * Chop it off at the start of the kernel.
+ * Chop it off at the pstart of the kernel.
*/
paddr_t chop = PMAP_BOOTSTRAP_VA2PA(KERNBASE);
- if (end < chop)
- chop = end;
+ if (pend < chop)
+ chop = pend;
#ifdef DEBUG
- prom_printf("bootstrap gap: start %lx, chop %lx, end %lx\n",
- start, chop, end);
+ prom_printf("bootstrap gap: pstart %lx, chop %lx, pend %lx\n",
+ pstart, chop, pend);
#endif
uvm_page_physload(
- atop(start),
+ atop(pstart),
atop(chop),
- atop(start),
+ atop(pstart),
atop(chop),
VM_FREELIST_DEFAULT);
@@ -1190,22 +1188,22 @@ pmap_page_upload(void)
* Adjust the start address to reflect the
* uploaded portion of this segment.
*/
- start = chop;
+ pstart = chop;
}
/* Skip the current kernel address range */
- if (start <= avail_start && avail_start < end)
- start = avail_start;
+ if (pstart <= avail_start && avail_start < pend)
+ pstart = avail_start;
- if (start == end)
+ if (pstart == pend)
continue;
/* Upload (the rest of) this segment */
uvm_page_physload(
- atop(start),
- atop(end),
- atop(start),
- atop(end), VM_FREELIST_DEFAULT);
+ atop(pstart),
+ atop(pend),
+ atop(pstart),
+ atop(pend), VM_FREELIST_DEFAULT);
}
#if defined(MULTIPROCESSOR)
@@ -3029,8 +3027,6 @@ void
pmap_bootstrap(int nctx, int nregion, int nsegment)
{
void *p;
- extern char etext[], kernel_data_start[];
- extern char *kernel_top;
uvmexp.pagesize = NBPG;
uvm_md_init();
@@ -3095,7 +3091,6 @@ pmap_bootstrap4_4c(void *top, int nctx,
int lastpage;
vaddr_t va;
vaddr_t p;
- extern char kernel_text[];
/*
* Compute `va2pa_offset'.
@@ -3487,36 +3482,33 @@ pmap_bootstrap4_4c(void *top, int nctx,
* set red zone at kernel base;
* enable cache on message buffer and cpuinfo.
*/
- {
- extern char etext[];
- /* Enable cache on message buffer and cpuinfo */
- for (p = KERNBASE; p < (vaddr_t)trapbase; p += NBPG)
- setpte4(p, getpte4(p) & ~PG_NC);
-
- /* Enable cache and write protext kernel text */
- for (p = (vaddr_t)trapbase; p < (vaddr_t)etext; p += NBPG)
- setpte4(p, getpte4(p) & ~(PG_NC|PG_W));
+ /* Enable cache on message buffer and cpuinfo */
+ for (p = KERNBASE; p < (vaddr_t)trapbase; p += NBPG)
+ setpte4(p, getpte4(p) & ~PG_NC);
- /*
- * Unmap the `etext gap'; it'll be made available
- * to the VM manager.
- */
- for (p = etext_gap_start; p < etext_gap_end; p += NBPG) {
- rp = &pmap_kernel()->pm_regmap[VA_VREG(p)];
- sp = &rp->rg_segmap[VA_VSEG(p)];
- sp->sg_nwired--;
- sp->sg_npte--;
- pmap_kernel()->pm_stats.resident_count--;
- sp->sg_pte[VA_VPG(p)] = 0;
- setpte4(p, 0);
- }
-
- /* Enable cache on data & bss */
- for (p = etext_gap_end; p < virtual_avail; p += NBPG)
- setpte4(p, getpte4(p) & ~PG_NC);
+ /* Enable cache and write protext kernel text */
+ for (p = (vaddr_t)trapbase; p < (vaddr_t)etext; p += NBPG)
+ setpte4(p, getpte4(p) & ~(PG_NC|PG_W));
+ /*
+ * Unmap the `etext gap'; it'll be made available
+ * to the VM manager.
+ */
+ for (p = etext_gap_start; p < etext_gap_end; p += NBPG) {
+ rp = &pmap_kernel()->pm_regmap[VA_VREG(p)];
+ sp = &rp->rg_segmap[VA_VSEG(p)];
+ sp->sg_nwired--;
+ sp->sg_npte--;
+ pmap_kernel()->pm_stats.resident_count--;
+ sp->sg_pte[VA_VPG(p)] = 0;
+ setpte4(p, 0);
}
+
+ /* Enable cache on data & bss */
+ for (p = etext_gap_end; p < virtual_avail; p += NBPG)
+ setpte4(p, getpte4(p) & ~PG_NC);
+
cpus[0] = (struct cpu_info *)CPUINFO_VA;
}
#endif
@@ -3537,8 +3529,6 @@ pmap_bootstrap4m(void *top)
unsigned int ctxtblsize;
vaddr_t pagetables_start, pagetables_end;
paddr_t pagetables_start_pa;
- extern char etext[];
- extern char kernel_text[];
vaddr_t va;
#if defined(MULTIPROCESSOR)
vsize_t off;
Index: src/sys/arch/sparc/sparc/promlib.c
diff -u src/sys/arch/sparc/sparc/promlib.c:1.46 src/sys/arch/sparc/sparc/promlib.c:1.47
--- src/sys/arch/sparc/sparc/promlib.c:1.46 Mon Sep 11 19:25:07 2017
+++ src/sys/arch/sparc/sparc/promlib.c Sun Jan 24 07:36:54 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: promlib.c,v 1.46 2017/09/11 19:25:07 palle Exp $ */
+/* $NetBSD: promlib.c,v 1.47 2021/01/24 07:36:54 mrg Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: promlib.c,v 1.46 2017/09/11 19:25:07 palle Exp $");
+__KERNEL_RCSID(0, "$NetBSD: promlib.c,v 1.47 2021/01/24 07:36:54 mrg Exp $");
#if defined(_KERNEL_OPT)
#include "opt_sparc_arch.h"
@@ -55,7 +55,9 @@ __KERNEL_RCSID(0, "$NetBSD: promlib.c,v
#include <machine/oldmon.h>
#include <machine/promlib.h>
#include <machine/ctlreg.h>
+
#include <sparc/sparc/asm.h>
+#include <sparc/sparc/cache.h>
#include <lib/libkern/libkern.h>
@@ -1105,7 +1107,6 @@ static inline void
prom_init_oldmon(void)
{
struct om_vector *oldpvec = (struct om_vector *)PROM_BASE;
- extern void sparc_noop(void);
promops.po_version = PROM_OLDMON;
promops.po_revision = oldpvec->monId[0]; /*XXX*/
@@ -1133,7 +1134,6 @@ prom_init_oldmon(void)
#ifdef SUN4
#ifndef _STANDALONE
if (oldpvec->romvecVersion >= 2) {
- extern void oldmon_w_cmd(u_long, char *);
*oldpvec->vector_cmd = oldmon_w_cmd;
}
#endif
Index: src/sys/arch/sparc/sparc/timervar.h
diff -u src/sys/arch/sparc/sparc/timervar.h:1.12 src/sys/arch/sparc/sparc/timervar.h:1.13
--- src/sys/arch/sparc/sparc/timervar.h:1.12 Sun Jan 19 00:22:33 2014
+++ src/sys/arch/sparc/sparc/timervar.h Sun Jan 24 07:36:54 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: timervar.h,v 1.12 2014/01/19 00:22:33 mrg Exp $ */
+/* $NetBSD: timervar.h,v 1.13 2021/01/24 07:36:54 mrg Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -61,7 +61,10 @@ void timerattach_obio_4m(device_t, devic
extern int statvar, statmin, statint;
extern int timerblurb;
extern void (*timer_init)(void);
-extern void tickle_tc(void);
+extern int (*eeprom_nvram_wenable)(int);
+extern int oldclk;
+extern int timerblurb;
+void tickle_tc(void);
/* Common timer attach routine in timer.c: */
void timerattach(volatile int *, volatile int *);
Index: src/sys/arch/sparc/sparc/trap.c
diff -u src/sys/arch/sparc/sparc/trap.c:1.199 src/sys/arch/sparc/sparc/trap.c:1.200
--- src/sys/arch/sparc/sparc/trap.c:1.199 Fri Aug 14 13:45:44 2020
+++ src/sys/arch/sparc/sparc/trap.c Sun Jan 24 07:36:54 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.199 2020/08/14 13:45:44 martin Exp $ */
+/* $NetBSD: trap.c,v 1.200 2021/01/24 07:36:54 mrg Exp $ */
/*
* Copyright (c) 1996
@@ -49,7 +49,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.199 2020/08/14 13:45:44 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.200 2021/01/24 07:36:54 mrg Exp $");
#include "opt_ddb.h"
#include "opt_compat_sunos.h"
@@ -78,6 +78,7 @@ __KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.1
#include <machine/pcb.h>
#include <machine/pmap.h>
#include <machine/userret.h>
+#include <machine/locore.h>
#ifdef DDB
#include <machine/db_machdep.h>
@@ -85,7 +86,7 @@ __KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.1
#include <machine/frame.h>
#endif
#ifdef COMPAT_SUNOS
-extern struct emul emul_sunos;
+#include <compat/sunos/sunos_exec.h>
#define SUNOS_MAXSADDR_SLOP (32 * 1024)
#endif
@@ -248,7 +249,6 @@ trap(unsigned type, int psr, int pc, str
#if defined(MULTIPROCESSOR)
if (type == T_DBPAUSE) {
/* XXX - deal with kgdb too */
- extern void ddb_suspend(struct trapframe *);
write_all_windows();
ddb_suspend(tf);
ADVANCE;
@@ -737,7 +737,7 @@ rwindow_save(struct lwp *l)
* the registers into the new process after the exec.
*/
void
-cpu_vmspace_exec(struct lwp *l, vaddr_t start, vaddr_t end)
+cpu_vmspace_exec(struct lwp *l, vaddr_t vstart, vaddr_t vend)
{
struct pcb *pcb = lwp_getpcb(l);
@@ -826,8 +826,6 @@ mem_access_fault(unsigned type, int ser,
}
va = trunc_page(v);
if (psr & PSR_PS) {
- extern char Lfsbail[];
-
if (type == T_TEXTFAULT) {
(void) splhigh();
snprintb(bits, sizeof(bits), SER_BITS, ser);
@@ -840,7 +838,7 @@ mem_access_fault(unsigned type, int ser,
* If this was an access that we shouldn't try to page in,
* resume at the fault handler without any action.
*/
- if (onfault == (vaddr_t)Lfsbail) {
+ if (onfault == (vaddr_t)sparc_fsbail) {
rv = EFAULT;
goto kfault;
}
@@ -1156,7 +1154,6 @@ mem_access_fault4m(unsigned type, u_int
}
if (psr & PSR_PS) {
- extern char Lfsbail[];
if (sfsr & SFSR_AT_TEXT || type == T_TEXTFAULT) {
(void) splhigh();
snprintb(bits, sizeof(bits), SFSR_BITS, sfsr);
@@ -1169,7 +1166,7 @@ mem_access_fault4m(unsigned type, u_int
* If this was an access that we shouldn't try to page in,
* resume at the fault handler without any action.
*/
- if (onfault == (vaddr_t)Lfsbail) {
+ if (onfault == (vaddr_t)sparc_fsbail) {
rv = EFAULT;
goto kfault;
}
Added files:
Index: src/sys/arch/sparc/include/locore.h
diff -u /dev/null src/sys/arch/sparc/include/locore.h:1.1
--- /dev/null Sun Jan 24 07:36:54 2021
+++ src/sys/arch/sparc/include/locore.h Sun Jan 24 07:36:54 2021
@@ -0,0 +1,56 @@
+/* $NetBSD: locore.h,v 1.1 2021/01/24 07:36:54 mrg Exp $ */
+
+/*
+ * Copyright (c) 2021 Matthew R. Green
+ * 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. 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 _SPARC_LOCORE_H_
+#define _SPARC_LOCORE_H_
+
+/*
+ * Items defined in locore or the linker scripts
+ */
+
+void ft_tlb_flush(int va, int ctx, int lvl);
+void sparc_v8_muldiv(void);
+void cpu_hatch(void);
+
+extern char etext[];
+extern char kernel_data_start[];
+extern char kernel_text[];
+extern char end[];
+extern char sparc_fsbail[];
+
+extern uint8_t u0[];
+
+extern int sparc_interrupt4m[];
+extern int sparc_interrupt44c[];
+
+extern char *kernel_top;
+extern void *bootinfo;
+
+#endif /* _SPARC_LOCORE_H_ */