From e78c98cbeaa9a7560997f073d4f6bdd22dc9170a Mon Sep 17 00:00:00 2001 From: miod Date: Fri, 29 Mar 2024 21:06:14 +0000 Subject: [PATCH] Remove dead defines, prototypes and data, and duplicate or misleading comments. ok claudio@ kettenis@ --- sys/arch/sparc64/include/autoconf.h | 6 +-- sys/arch/sparc64/include/conf.h | 31 +-------------- sys/arch/sparc64/include/cpu.h | 15 +------ sys/arch/sparc64/include/idprom.h | 7 +--- sys/arch/sparc64/include/pte.h | 55 +------------------------- sys/arch/sparc64/include/vmparam.h | 7 +--- sys/arch/sparc64/sparc64/clock.c | 7 +--- sys/arch/sparc64/sparc64/locore.s | 15 ++----- sys/arch/sparc64/sparc64/machdep.c | 30 +------------- sys/arch/sparc64/sparc64/ofw_machdep.c | 10 +---- sys/arch/sparc64/sparc64/pmap.c | 3 +- sys/arch/sparc64/sparc64/trap.c | 32 +-------------- 12 files changed, 16 insertions(+), 202 deletions(-) diff --git a/sys/arch/sparc64/include/autoconf.h b/sys/arch/sparc64/include/autoconf.h index 382e358bd26..e19caf8d429 100644 --- a/sys/arch/sparc64/include/autoconf.h +++ b/sys/arch/sparc64/include/autoconf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.h,v 1.18 2008/06/26 05:42:13 ray Exp $ */ +/* $OpenBSD: autoconf.h,v 1.19 2024/03/29 21:06:14 miod Exp $ */ /* $NetBSD: autoconf.h,v 1.10 2001/07/24 19:32:11 eeh Exp $ */ /*- @@ -146,15 +146,11 @@ struct bootpath { }; struct bootpath *bootpath_store(int, struct bootpath *); -/* Establish a mountroot_hook, for benefit of floppy drive, mostly. */ -void mountroot_hook_establish(void (*)(struct device *), struct device *); - void bootstrap(int); int firstchild(int); int nextsibling(int); void callrom(void); struct device *getdevunit(char *, int); -void *findzs(int); int romgetcursoraddr(int **, int **); int findroot(void); int findnode(int, const char *); diff --git a/sys/arch/sparc64/include/conf.h b/sys/arch/sparc64/include/conf.h index cc9f8a06cea..1410e31c036 100644 --- a/sys/arch/sparc64/include/conf.h +++ b/sys/arch/sparc64/include/conf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.h,v 1.27 2022/06/28 14:43:50 visa Exp $ */ +/* $OpenBSD: conf.h,v 1.28 2024/03/29 21:06:14 miod Exp $ */ /* $NetBSD: conf.h,v 1.9 2001/03/26 12:33:26 lukem Exp $ */ /*- @@ -67,41 +67,14 @@ cdev_decl(vdsp); 0, (dev_type_mmap((*))) enodev, \ 0, 0, dev_init(c,n,kqfilter) } -cdev_decl(cn); - cdev_decl(zs); bdev_decl(fd); cdev_decl(fd); -cdev_decl(fb); - -cdev_decl(ms); - -cdev_decl(kbd); -cdev_decl(kd); - -cdev_decl(bwtwo); - -cdev_decl(cgtwo); - -cdev_decl(cgthree); - -cdev_decl(cgfour); - -cdev_decl(cgsix); - -cdev_decl(cgeight); - -cdev_decl(tcx); - -cdev_decl(cgfourteen); - cdev_decl(bpp); cdev_decl(lpt); -cdev_decl(scsibus); - bdev_decl(wd); cdev_decl(wd); @@ -126,5 +99,3 @@ cdev_decl(sbpp); dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \ dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) nullop, \ 0, (dev_type_mmap((*))) enodev, 0, 0, seltrue_kqfilter } - -cdev_decl(bpp); diff --git a/sys/arch/sparc64/include/cpu.h b/sys/arch/sparc64/include/cpu.h index 07e5962f394..c770e703ce0 100644 --- a/sys/arch/sparc64/include/cpu.h +++ b/sys/arch/sparc64/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.104 2024/02/25 19:15:50 cheloha Exp $ */ +/* $OpenBSD: cpu.h,v 1.105 2024/03/29 21:06:14 miod Exp $ */ /* $NetBSD: cpu.h,v 1.28 2001/06/14 22:56:58 thorpej Exp $ */ /* @@ -311,13 +311,11 @@ void signotify(struct proc *); /* cpu.c */ int cpu_myid(void); /* machdep.c */ -int ldcontrolb(caddr_t); void dumpconf(void); caddr_t reserve_dumppages(caddr_t); /* clock.c */ struct timeval; int clockintr(void *);/* level 10 (clock) interrupt code */ -int statintr(void *); /* level 14 (statclock) interrupt code */ /* locore.s */ struct fpstate; void savefpstate(struct fpstate *); @@ -330,10 +328,6 @@ void proc_trampoline(void); struct pcb; void snapshot(struct pcb *); struct frame *getfp(void); -int xldcontrolb(caddr_t, struct pcb *); -void copywords(const void *, void *, size_t); -void qcopy(const void *, void *, size_t); -void qzero(void *, size_t); void switchtoctx(int); /* trap.c */ void pmap_unuse_final(struct proc *); @@ -341,10 +335,6 @@ int rwindow_save(struct proc *); /* vm_machdep.c */ void fpusave_cpu(struct cpu_info *, int); void fpusave_proc(struct proc *, int); -/* cons.c */ -int cnrom(void); -/* zs.c */ -void zsconsole(struct tty *, int, int, void (**)(struct tty *, int)); /* fb.c */ void fb_unblank(void); /* ltc.c */ @@ -374,9 +364,6 @@ struct trapvec { }; extern struct trapvec trapbase[]; /* the 256 vectors */ -extern void wzero(void *, u_int); -extern void wcopy(const void *, void *, u_int); - struct blink_led { void (*bl_func)(void *, int); void *bl_arg; diff --git a/sys/arch/sparc64/include/idprom.h b/sys/arch/sparc64/include/idprom.h index f51b37a0a8f..aef7b99482b 100644 --- a/sys/arch/sparc64/include/idprom.h +++ b/sys/arch/sparc64/include/idprom.h @@ -1,4 +1,4 @@ -/* $OpenBSD: idprom.h,v 1.2 2001/08/20 20:23:52 jason Exp $ */ +/* $OpenBSD: idprom.h,v 1.3 2024/03/29 21:06:14 miod Exp $ */ /* $NetBSD: idprom.h,v 1.2 1998/09/05 23:57:26 eeh Exp $ */ /* @@ -49,9 +49,4 @@ struct idprom { char id_undef[16]; /* undefined */ }; -#define ID_SUN4_100 0x22 -#define ID_SUN4_200 0x21 -#define ID_SUN4_300 0x23 -#define ID_SUN4_400 0x24 - #define IDPROM_VERSION 1 diff --git a/sys/arch/sparc64/include/pte.h b/sys/arch/sparc64/include/pte.h index 69728745934..07c862dcbae 100644 --- a/sys/arch/sparc64/include/pte.h +++ b/sys/arch/sparc64/include/pte.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pte.h,v 1.15 2013/03/31 17:07:03 deraadt Exp $ */ +/* $OpenBSD: pte.h,v 1.16 2024/03/29 21:06:14 miod Exp $ */ /* $NetBSD: pte.h,v 1.7 2001/07/31 06:55:46 eeh Exp $ */ /* @@ -27,36 +27,6 @@ #ifndef _MACHINE_PTE_H_ #define _MACHINE_PTE_H_ -/* - * Address translation works as follows: - * - ** - * For sun4u: - * - * Take your pick; it's all S/W anyway. We'll start by emulating a sun4. - * Oh, here's the sun4u TTE for reference: - * - * struct sun4u_tte { - * u_int64 tag_g:1, (global flag) - * tag_ctxt:15, (context for mapping) - * tag_unassigned:6, - * tag_va:42; (virtual address bits<63:22>) - * u_int64 data_v:1, (valid bit) - * data_size:2, (page size [8K*8**]) - * data_nfo:1, (no-fault only) - * data_ie:1, (invert endianness [inefficient]) - * data_soft2:2, (reserved for S/W) - * data_pa:36, (physical address) - * data_soft:6, (reserved for S/W) - * data_lock:1, (lock into TLB) - * data_cacheable:2, (cacheability control) - * data_e:1, (explicit accesses only) - * data_priv:1, (privileged page) - * data_w:1, (writeable) - * data_g:1; (same as tag_g) - * }; - */ - /* virtual address to virtual page number */ #define VA_SUN4U_VPG(va) (((int)(va) >> 13) & 31) @@ -76,13 +46,8 @@ #ifndef _LOCORE /* * This is the spitfire TTE. - * - * We could use bitmasks and shifts to construct this if - * we had a 64-bit compiler w/64-bit longs. Otherwise it's - * a real pain to do this in C. */ -#if 0 -/* We don't use bitfields anyway. */ +#if 0 /* We don't use bitfields anyway. */ struct sun4u_tag_fields { u_int64_t tag_g:1, /* global flag */ tag_ctxt:15, /* context for mapping */ @@ -236,20 +201,4 @@ void smp_tlb_flush_ctx(int); ((priv)?SUN4V_TLB_P:0LL)|((write)?SUN4V_TLB_W:0LL)|((g)?SUN4V_TLB_G:0LL)|\ ((ie)?SUN4V_TLB_IE:0LL)) - -#define MMU_CACHE_VIRT 0x3 -#define MMU_CACHE_PHYS 0x2 -#define MMU_CACHE_NONE 0x0 - -/* This needs to be updated for sun4u IOMMUs */ -/* - * IOMMU PTE bits. - */ -#define IOPTE_PPN_MASK 0x07ffff00 -#define IOPTE_PPN_SHIFT 8 -#define IOPTE_RSVD 0x000000f1 -#define IOPTE_WRITE 0x00000004 -#define IOPTE_VALID 0x00000002 - #endif /* _MACHINE_PTE_H_ */ - diff --git a/sys/arch/sparc64/include/vmparam.h b/sys/arch/sparc64/include/vmparam.h index a7a4a4bd593..3182cf3394c 100644 --- a/sys/arch/sparc64/include/vmparam.h +++ b/sys/arch/sparc64/include/vmparam.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmparam.h,v 1.34 2023/03/19 20:32:13 kettenis Exp $ */ +/* $OpenBSD: vmparam.h,v 1.35 2024/03/29 21:06:14 miod Exp $ */ /* $NetBSD: vmparam.h,v 1.18 2001/05/01 02:19:19 thorpej Exp $ */ /* @@ -121,9 +121,4 @@ #define VM_PHYSSEG_STRAT VM_PSTRAT_BSEARCH #define VM_PHYSSEG_NOADD /* can't add RAM after vm_mem_init */ -#if defined (_KERNEL) && !defined(_LOCORE) -struct vm_map; -vaddr_t dvma_mapin(struct vm_map *, vaddr_t, int, int); -void dvma_mapout(vaddr_t, vaddr_t, int); -#endif #endif diff --git a/sys/arch/sparc64/sparc64/clock.c b/sys/arch/sparc64/sparc64/clock.c index 5dbec5b023d..92c52adfbc5 100644 --- a/sys/arch/sparc64/sparc64/clock.c +++ b/sys/arch/sparc64/sparc64/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.82 2023/09/17 14:50:51 cheloha Exp $ */ +/* $OpenBSD: clock.c,v 1.83 2024/03/29 21:06:14 miod Exp $ */ /* $NetBSD: clock.c,v 1.41 2001/07/24 19:29:25 eeh Exp $ */ /* @@ -207,13 +207,8 @@ extern todr_chip_handle_t todr_handle; static struct idprom *idprom; int clock_bus_wenable(struct todr_chip_handle *, int); -struct chiptime; void myetheraddr(u_char *); struct idprom *getidprom(void); -int chiptotime(int, int, int, int, int, int); -void timetochip(struct chiptime *); - -int timerblurb = 10; /* Guess a value; used before clock is attached */ /* * The OPENPROM calls the clock the "eeprom", so we have to have our diff --git a/sys/arch/sparc64/sparc64/locore.s b/sys/arch/sparc64/sparc64/locore.s index a92c987562d..0ed5e4af914 100644 --- a/sys/arch/sparc64/sparc64/locore.s +++ b/sys/arch/sparc64/sparc64/locore.s @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.s,v 1.204 2023/12/12 07:37:21 deraadt Exp $ */ +/* $OpenBSD: locore.s,v 1.205 2024/03/29 21:06:14 miod Exp $ */ /* $NetBSD: locore.s,v 1.137 2001/08/13 06:10:10 jdolecek Exp $ */ /* @@ -515,7 +515,7 @@ cold: TA32 .endm - .macro DMMU_PROT dprot + .macro DMMU_PROT ba,a,pt %xcc, dmmu_write_fault nop TA32 @@ -756,7 +756,7 @@ ufast_IMMU_miss: ! 064 = fast instr access MMU miss ufast_DMMU_miss: ! 068 = fast data access MMU miss DMMU_MISS 7 ufast_DMMU_protection: ! 06c = fast data access MMU protection - DMMU_PROT udprot + DMMU_PROT UTRAP 0x070 ! Implementation dependent traps UTRAP 0x071; UTRAP 0x072; UTRAP 0x073; UTRAP 0x074; UTRAP 0x075; UTRAP 0x076 UTRAP 0x077; UTRAP 0x078; UTRAP 0x079; UTRAP 0x07a; UTRAP 0x07b; UTRAP 0x07c @@ -916,7 +916,7 @@ kfast_IMMU_miss: ! 064 = fast instr access MMU miss kfast_DMMU_miss: ! 068 = fast data access MMU miss DMMU_MISS 10 kfast_DMMU_protection: ! 06c = fast data access MMU protection - DMMU_PROT kdprot + DMMU_PROT UTRAP 0x070 ! Implementation dependent traps UTRAP 0x071; UTRAP 0x072; UTRAP 0x073; UTRAP 0x074; UTRAP 0x075; UTRAP 0x076 UTRAP 0x077; UTRAP 0x078; UTRAP 0x079; UTRAP 0x07a; UTRAP 0x07b; UTRAP 0x07c @@ -1402,13 +1402,6 @@ panic_red: * * Essentially we need to be able to write re-entrant code w/no stack. */ - .data -trap_setup_msg: - .asciz "TRAP_SETUP: tt=%x osp=%x nsp=%x tl=%x tpc=%x\n" - _ALIGN -intr_setup_msg: - .asciz "INTR_SETUP: tt=%x osp=%x nsp=%x tl=%x tpc=%x\n" - _ALIGN .text .macro TRAP_SETUP stackspace diff --git a/sys/arch/sparc64/sparc64/machdep.c b/sys/arch/sparc64/sparc64/machdep.c index 135cf08c58f..7942fcd6ab0 100644 --- a/sys/arch/sparc64/sparc64/machdep.c +++ b/sys/arch/sparc64/sparc64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.209 2024/03/07 15:01:53 claudio Exp $ */ +/* $OpenBSD: machdep.c,v 1.210 2024/03/29 21:06:14 miod Exp $ */ /* $NetBSD: machdep.c,v 1.108 2001/07/24 19:30:14 eeh Exp $ */ /*- @@ -821,34 +821,6 @@ printf("starting dump, blkno %lld\n", (long long)blkno); } } -void trapdump(struct trapframe *); -/* - * dump out a trapframe. - */ -void -trapdump(struct trapframe *tf) -{ - printf("TRAPFRAME: tstate=%llx pc=%llx npc=%llx y=%x\n", - (unsigned long long)tf->tf_tstate, (unsigned long long)tf->tf_pc, - (unsigned long long)tf->tf_npc, (unsigned)tf->tf_y); - printf("%%g1-7: %llx %llx %llx %llx %llx %llx %llx\n", - (unsigned long long)tf->tf_global[1], - (unsigned long long)tf->tf_global[2], - (unsigned long long)tf->tf_global[3], - (unsigned long long)tf->tf_global[4], - (unsigned long long)tf->tf_global[5], - (unsigned long long)tf->tf_global[6], - (unsigned long long)tf->tf_global[7]); - printf("%%o0-7: %llx %llx %llx %llx\n %llx %llx %llx %llx\n", - (unsigned long long)tf->tf_out[0], - (unsigned long long)tf->tf_out[1], - (unsigned long long)tf->tf_out[2], - (unsigned long long)tf->tf_out[3], - (unsigned long long)tf->tf_out[4], - (unsigned long long)tf->tf_out[5], - (unsigned long long)tf->tf_out[6], - (unsigned long long)tf->tf_out[7]); -} /* * get the fp and dump the stack as best we can. don't leave the * current stack page diff --git a/sys/arch/sparc64/sparc64/ofw_machdep.c b/sys/arch/sparc64/sparc64/ofw_machdep.c index 7833e38c867..ba6f23e072f 100644 --- a/sys/arch/sparc64/sparc64/ofw_machdep.c +++ b/sys/arch/sparc64/sparc64/ofw_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ofw_machdep.c,v 1.36 2022/10/17 18:49:06 kettenis Exp $ */ +/* $OpenBSD: ofw_machdep.c,v 1.37 2024/03/29 21:06:14 miod Exp $ */ /* $NetBSD: ofw_machdep.c,v 1.16 2001/07/20 00:07:14 eeh Exp $ */ /* @@ -47,10 +47,6 @@ #include -#if defined(FFS) && defined(CD9660) -#include -#endif - /* * Note that stdarg.h and the ANSI style va_start macro is used for both * ANSI and traditional C compilers. @@ -59,10 +55,6 @@ #include -int vsprintf(char *, const char *, va_list); - -void dk_cleanup(void); - static u_int mmuh = -1, memh = -1; static u_int get_mmu_handle(void); diff --git a/sys/arch/sparc64/sparc64/pmap.c b/sys/arch/sparc64/sparc64/pmap.c index d6060d4f729..2845fa45148 100644 --- a/sys/arch/sparc64/sparc64/pmap.c +++ b/sys/arch/sparc64/sparc64/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.111 2023/04/13 15:23:22 miod Exp $ */ +/* $OpenBSD: pmap.c,v 1.112 2024/03/29 21:06:14 miod Exp $ */ /* $NetBSD: pmap.c,v 1.107 2001/08/31 16:47:41 eeh Exp $ */ /* * @@ -116,7 +116,6 @@ void pmap_page_cache(struct pmap *pm, paddr_t pa, int mode); void pmap_bootstrap_cpu(paddr_t); -void pmap_pinit(struct pmap *); void pmap_release(struct pmap *); pv_entry_t pa_to_pvh(paddr_t); diff --git a/sys/arch/sparc64/sparc64/trap.c b/sys/arch/sparc64/sparc64/trap.c index a2116f085a9..35599c48b71 100644 --- a/sys/arch/sparc64/sparc64/trap.c +++ b/sys/arch/sparc64/sparc64/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.119 2024/01/11 19:16:27 miod Exp $ */ +/* $OpenBSD: trap.c,v 1.120 2024/03/29 21:06:14 miod Exp $ */ /* $NetBSD: trap.c,v 1.73 2001/08/09 01:03:01 eeh Exp $ */ /* @@ -80,36 +80,6 @@ #include #include -#ifndef offsetof -#define offsetof(s, f) ((int)&((s *)0)->f) -#endif - -/* trapstats */ -int trapstats = 0; -int protfix = 0; -int udmiss = 0; /* Number of normal/nucleus data/text miss/protection faults */ -int udhit = 0; -int udprot = 0; -int utmiss = 0; -int kdmiss = 0; -int kdhit = 0; -int kdprot = 0; -int ktmiss = 0; -int iveccnt = 0; /* number if normal/nucleus interrupt/interrupt vector faults */ -int uintrcnt = 0; -int kiveccnt = 0; -int kintrcnt = 0; -int intristk = 0; /* interrupts when already on intrstack */ -int intrpoll = 0; /* interrupts not using vector lists */ -int wfill = 0; -int kwfill = 0; -int wspill = 0; -int wspillskip = 0; -int rftucnt = 0; -int rftuld = 0; -int rftudone = 0; -int rftkcnt[5] = { 0, 0, 0, 0, 0 }; - /* * Initial FPU state is all registers == all 1s, everything else == all 0s. * This makes every floating point register a signalling NaN, with sign bit -- 2.20.1