From: miod Date: Mon, 6 Feb 2023 11:16:22 +0000 (+0000) Subject: Unifdef -U _PMAP_MAY_USE_PROM_CONSOLE. This code hasn't been needed in years X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=67a77ffea4bdba7474323384d6fc4cd00778032b;p=openbsd Unifdef -U _PMAP_MAY_USE_PROM_CONSOLE. This code hasn't been needed in years since the TC machines have switched to the MI zstty code. --- diff --git a/sys/arch/alpha/alpha/conf.c b/sys/arch/alpha/alpha/conf.c index c8ee409f250..1b03bff8c0b 100644 --- a/sys/arch/alpha/alpha/conf.c +++ b/sys/arch/alpha/alpha/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.92 2022/10/15 10:12:12 jsg Exp $ */ +/* $OpenBSD: conf.c,v 1.93 2023/02/06 11:16:22 miod Exp $ */ /* $NetBSD: conf.c,v 1.16 1996/10/18 21:26:57 cgd Exp $ */ /*- @@ -101,7 +101,6 @@ cdev_decl(spkr); #include "bio.h" #include "lpt.h" cdev_decl(lpt); -cdev_decl(prom); /* XXX XXX XXX */ cdev_decl(wd); cdev_decl(fd); #include "cy.h" @@ -154,7 +153,7 @@ struct cdevsw cdevsw[] = cdev_notdef(), /* 20 */ cdev_notdef(), /* 21 */ cdev_notdef(), /* 22 */ - cdev_tty_init(1,prom), /* 23: XXX prom console */ + cdev_notdef(), /* 23 reserved for PROM console */ cdev_audio_init(NAUDIO,audio), /* 24: generic audio I/O */ cdev_wsdisplay_init(NWSDISPLAY,wsdisplay), /* 25: workstation console */ cdev_tty_init(NCOM,com), /* 26: ns16550 UART */ diff --git a/sys/arch/alpha/alpha/machdep.c b/sys/arch/alpha/alpha/machdep.c index cbb9abb34e7..5a35dc4484f 100644 --- a/sys/arch/alpha/alpha/machdep.c +++ b/sys/arch/alpha/alpha/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.200 2023/01/02 19:09:17 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.201 2023/02/06 11:16:22 miod Exp $ */ /* $NetBSD: machdep.c,v 1.210 2000/06/01 17:12:38 thorpej Exp $ */ /*- @@ -387,12 +387,6 @@ nobootinfo: #endif /* NO MORE FIRMWARE ACCESS ALLOWED */ -#ifdef _PMAP_MAY_USE_PROM_CONSOLE - /* - * XXX (unless _PMAP_MAY_USE_PROM_CONSOLE is defined and - * XXX pmap_uses_prom_console() evaluates to non-zero.) - */ -#endif #ifndef SMALL_KERNEL /* @@ -506,14 +500,6 @@ nobootinfo: * software use. We must determine if this cluster * holds the kernel. */ -#ifdef _PMAP_MAY_USE_PROM_CONSOLE - /* - * XXX If the kernel uses the PROM console, we only use the - * XXX memory after the kernel in the first system segment, - * XXX to avoid clobbering prom mapping, data, etc. - */ - if (!pmap_uses_prom_console() || physmem == 0) { -#endif /* _PMAP_MAY_USE_PROM_CONSOLE */ physmem += memc->mddt_pg_cnt; pfn0 = memc->mddt_pfn; pfn1 = memc->mddt_pfn + memc->mddt_pg_cnt; @@ -525,9 +511,6 @@ nobootinfo: #if 0 printf("Cluster %d contains kernel\n", i); #endif -#ifdef _PMAP_MAY_USE_PROM_CONSOLE - if (!pmap_uses_prom_console()) { -#endif /* _PMAP_MAY_USE_PROM_CONSOLE */ if (pfn0 < kernstartpfn) { /* * There is a chunk before the kernel. @@ -539,9 +522,6 @@ nobootinfo: uvm_page_physload(pfn0, kernstartpfn, pfn0, kernstartpfn, 0); } -#ifdef _PMAP_MAY_USE_PROM_CONSOLE - } -#endif /* _PMAP_MAY_USE_PROM_CONSOLE */ if (kernendpfn < pfn1) { /* * There is a chunk after the kernel. @@ -563,9 +543,6 @@ nobootinfo: #endif uvm_page_physload(pfn0, pfn1, pfn0, pfn1, 0); } -#ifdef _PMAP_MAY_USE_PROM_CONSOLE - } -#endif /* _PMAP_MAY_USE_PROM_CONSOLE */ } #ifdef DEBUG @@ -773,15 +750,10 @@ nobootinfo: void consinit() { - /* * Everything related to console initialization is done * in alpha_init(). */ -#if defined(DIAGNOSTIC) && defined(_PMAP_MAY_USE_PROM_CONSOLE) - printf("consinit: %susing prom console\n", - pmap_uses_prom_console() ? "" : "not "); -#endif } void diff --git a/sys/arch/alpha/alpha/pmap.c b/sys/arch/alpha/alpha/pmap.c index f5aa43110fb..1a2a1ac3807 100644 --- a/sys/arch/alpha/alpha/pmap.c +++ b/sys/arch/alpha/alpha/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.88 2022/09/12 19:35:20 miod Exp $ */ +/* $OpenBSD: pmap.c,v 1.89 2023/02/06 11:16:22 miod Exp $ */ /* $NetBSD: pmap.c,v 1.154 2000/12/07 22:18:55 thorpej Exp $ */ /*- @@ -149,7 +149,7 @@ #include #include -#if defined(_PMAP_MAY_USE_PROM_CONSOLE) || defined(MULTIPROCESSOR) +#if defined(MULTIPROCESSOR) #include #endif @@ -785,27 +785,6 @@ pmap_bootstrap(paddr_t ptaddr, u_int maxasn, u_long ncpuids) kernel_lev1map[l1pte_index(VPTBASE)] = pte; VPT = (pt_entry_t *)VPTBASE; -#ifdef _PMAP_MAY_USE_PROM_CONSOLE - { - extern pt_entry_t prom_pte; /* XXX */ - extern int prom_mapped; /* XXX */ - - if (pmap_uses_prom_console()) { - /* - * XXX Save old PTE so we can remap the PROM, if - * XXX necessary. - */ - prom_pte = *(pt_entry_t *)ptaddr & ~PG_ASM; - } - prom_mapped = 0; - - /* - * Actually, this code lies. The prom is still mapped, and will - * remain so until the context switch after alpha_init() returns. - */ - } -#endif - /* * Set up level 2 page table. */ @@ -915,21 +894,6 @@ pmap_bootstrap(paddr_t ptaddr, u_int maxasn, u_long ncpuids) (1UL << cpu_number())); } -#ifdef _PMAP_MAY_USE_PROM_CONSOLE -int -pmap_uses_prom_console(void) -{ - -#if defined(NEW_SCC_DRIVER) - return (cputype == ST_DEC_21000); -#else - return (cputype == ST_DEC_21000 - || cputype == ST_DEC_3000_300 - || cputype == ST_DEC_3000_500); -#endif /* NEW_SCC_DRIVER */ -} -#endif /* _PMAP_MAY_USE_PROM_CONSOLE */ - /* * pmap_steal_memory: [ INTERFACE ] * diff --git a/sys/arch/alpha/alpha/prom.c b/sys/arch/alpha/alpha/prom.c index 88b5a5049ea..d0bcb6a9a77 100644 --- a/sys/arch/alpha/alpha/prom.c +++ b/sys/arch/alpha/alpha/prom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: prom.c,v 1.16 2014/12/18 10:50:02 dlg Exp $ */ +/* $OpenBSD: prom.c,v 1.17 2023/02/06 11:16:22 miod Exp $ */ /* $NetBSD: prom.c,v 1.39 2000/03/06 21:36:05 thorpej Exp $ */ /* @@ -54,26 +54,6 @@ struct mutex prom_lock = MUTEX_INITIALIZER(IPL_HIGH); void prom_enter(void); void prom_leave(void); -#ifdef _PMAP_MAY_USE_PROM_CONSOLE -int prom_mapped = 1; /* Is PROM still mapped? */ - -pt_entry_t prom_pte, saved_pte[1]; /* XXX */ -static pt_entry_t *prom_lev1map(void); - -static pt_entry_t * -prom_lev1map() -{ - struct alpha_pcb *apcb; - - /* - * Find the level 1 map that we're currently running on. - */ - apcb = (struct alpha_pcb *)ALPHA_PHYS_TO_K0SEG(curpcb); - - return ((pt_entry_t *)ALPHA_PHYS_TO_K0SEG(apcb->apcb_ptbr << PGSHIFT)); -} -#endif /* _PMAP_MAY_USE_PROM_CONSOLE */ - void init_prom_interface(struct rpb *rpb) { @@ -99,68 +79,18 @@ init_bootstrap_console() cn_tab = &promcons; } -#ifdef _PMAP_MAY_USE_PROM_CONSOLE -static void prom_cache_sync(void); -#endif - void prom_enter(void) { mtx_enter(&prom_lock); - -#ifdef _PMAP_MAY_USE_PROM_CONSOLE - /* - * If we have not yet switched out of the PROM's context - * (i.e. the first one after alpha_init()), then the PROM - * is still mapped, regardless of the `prom_mapped' setting. - */ - if (prom_mapped == 0 && curpcb != 0) { - if (!pmap_uses_prom_console()) - panic("prom_enter"); - { - pt_entry_t *lev1map; - - lev1map = prom_lev1map(); /* XXX */ - saved_pte[0] = lev1map[0]; /* XXX */ - lev1map[0] = prom_pte; /* XXX */ - } - prom_cache_sync(); /* XXX */ - } -#endif } void prom_leave(void) { -#ifdef _PMAP_MAY_USE_PROM_CONSOLE - /* - * See comment above. - */ - if (prom_mapped == 0 && curpcb != 0) { - if (!pmap_uses_prom_console()) - panic("prom_leave"); - { - pt_entry_t *lev1map; - - lev1map = prom_lev1map(); /* XXX */ - lev1map[0] = saved_pte[0]; /* XXX */ - } - prom_cache_sync(); /* XXX */ - } -#endif - mtx_leave(&prom_lock); } -#ifdef _PMAP_MAY_USE_PROM_CONSOLE -static void -prom_cache_sync(void) -{ - ALPHA_TBIA(); - alpha_pal_imb(); -} -#endif - /* * promcnputc: * @@ -206,26 +136,6 @@ promcngetc(dev_t dev) } } -/* - * promcnlookc: - * - * See if prom has a real char and pass it back. - */ -int -promcnlookc(dev_t dev, char *cp) -{ - prom_return_t ret; - - prom_enter(); - ret.bits = prom_getc(alpha_console); - prom_leave(); - if (ret.u.status == 0 || ret.u.status == 1) { - *cp = ret.u.retval; - return 1; - } else - return 0; -} - int prom_getenv(int id, char *buf, int len) { diff --git a/sys/arch/alpha/alpha/promcons.c b/sys/arch/alpha/alpha/promcons.c deleted file mode 100644 index 9efabd3bf1c..00000000000 --- a/sys/arch/alpha/alpha/promcons.c +++ /dev/null @@ -1,235 +0,0 @@ -/* $OpenBSD: promcons.c,v 1.19 2018/02/19 08:59:52 mpi Exp $ */ -/* $NetBSD: promcons.c,v 1.5 1996/11/13 22:20:55 cgd Exp $ */ - -/* - * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include - -static struct tty *prom_tty[1]; -static struct timeout prom_to; - -void promstart(struct tty *); -void promtimeout(void *); -int promparam(struct tty *, struct termios *); -cdev_decl(prom); -cons_decl(prom); - -int -promopen(dev, flag, mode, p) - dev_t dev; - int flag, mode; - struct proc *p; -{ - int unit = minor(dev); - struct tty *tp; - int s; - int error = 0, setuptimeout = 0; - - if (unit >= 1) - return ENXIO; - - s = spltty(); - - if (prom_tty[unit] == NULL) { - tp = prom_tty[unit] = ttymalloc(0); - } else - tp = prom_tty[unit]; - - tp->t_oproc = promstart; - tp->t_param = promparam; - tp->t_dev = dev; - if ((tp->t_state & TS_ISOPEN) == 0) { - tp->t_state |= TS_WOPEN|TS_CARR_ON; - ttychars(tp); - tp->t_iflag = TTYDEF_IFLAG; - tp->t_oflag = TTYDEF_OFLAG; - tp->t_cflag = TTYDEF_CFLAG|CLOCAL; - tp->t_lflag = TTYDEF_LFLAG; - tp->t_ispeed = tp->t_ospeed = 9600; - ttsetwater(tp); - - setuptimeout = 1; - } else if (tp->t_state&TS_XCLUDE && suser(p) != 0) { - splx(s); - return EBUSY; - } - - splx(s); - - error = (*linesw[tp->t_line].l_open)(dev, tp, p); - if (error == 0 && setuptimeout) { - timeout_set(&prom_to, promtimeout, tp); - timeout_add(&prom_to, 1); - } - return error; -} - -int -promclose(dev, flag, mode, p) - dev_t dev; - int flag, mode; - struct proc *p; -{ - int unit = minor(dev); - struct tty *tp = prom_tty[unit]; - - timeout_del(&prom_to); - (*linesw[tp->t_line].l_close)(tp, flag, p); - ttyclose(tp); - return 0; -} - -int -promread(dev, uio, flag) - dev_t dev; - struct uio *uio; - int flag; -{ - struct tty *tp = prom_tty[minor(dev)]; - - return ((*linesw[tp->t_line].l_read)(tp, uio, flag)); -} - -int -promwrite(dev, uio, flag) - dev_t dev; - struct uio *uio; - int flag; -{ - struct tty *tp = prom_tty[minor(dev)]; - - return ((*linesw[tp->t_line].l_write)(tp, uio, flag)); -} - -int -promioctl(dev, cmd, data, flag, p) - dev_t dev; - u_long cmd; - caddr_t data; - int flag; - struct proc *p; -{ - int unit = minor(dev); - struct tty *tp = prom_tty[unit]; - int error; - - error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p); - if (error >= 0) - return error; - error = ttioctl(tp, cmd, data, flag, p); - if (error >= 0) - return error; - - return ENOTTY; -} - -int -promparam(tp, t) - struct tty *tp; - struct termios *t; -{ - - return 0; -} - -void -promstart(tp) - struct tty *tp; -{ - int s; - - s = spltty(); - if (tp->t_state & (TS_TTSTOP | TS_BUSY)) - goto out; - ttwakeupwr(tp); - tp->t_state |= TS_BUSY; - while (tp->t_outq.c_cc != 0) - promcnputc(tp->t_dev, getc(&tp->t_outq)); - tp->t_state &= ~TS_BUSY; -out: - splx(s); -} - -/* - * Stop output on a line. - */ -int -promstop(tp, flag) - struct tty *tp; - int flag; -{ - int s; - - s = spltty(); - if (tp->t_state & TS_BUSY) - if ((tp->t_state & TS_TTSTOP) == 0) - tp->t_state |= TS_FLUSH; - splx(s); - return 0; -} - -void -promtimeout(v) - void *v; -{ - struct tty *tp = v; - u_char c; - - while (promcnlookc(tp->t_dev, &c)) { - if (tp->t_state & TS_ISOPEN) - (*linesw[tp->t_line].l_rint)(c, tp); - } - timeout_add(&prom_to, 1); -} - -struct tty * -promtty(dev) - dev_t dev; -{ - - if (minor(dev) != 0) - panic("promtty: bogus"); - - return prom_tty[0]; -} diff --git a/sys/arch/alpha/conf/files.alpha b/sys/arch/alpha/conf/files.alpha index 41998a2e3b4..8a450d06962 100644 --- a/sys/arch/alpha/conf/files.alpha +++ b/sys/arch/alpha/conf/files.alpha @@ -1,4 +1,4 @@ -# $OpenBSD: files.alpha,v 1.107 2018/02/14 23:51:49 jsg Exp $ +# $OpenBSD: files.alpha,v 1.108 2023/02/06 11:16:22 miod Exp $ # $NetBSD: files.alpha,v 1.32 1996/11/25 04:03:21 cgd Exp $ # # alpha-specific configuration info @@ -300,9 +300,6 @@ file arch/alpha/dev/bus_dma.c file arch/alpha/alpha/in_cksum.c -# XXX -file arch/alpha/alpha/promcons.c - # XXX file arch/alpha/alpha/cpuconf.c file arch/alpha/alpha/dec_2100_a50.c dec_2100_a50 diff --git a/sys/arch/alpha/include/pmap.h b/sys/arch/alpha/include/pmap.h index 6747096c5a6..0269bd3d06e 100644 --- a/sys/arch/alpha/include/pmap.h +++ b/sys/arch/alpha/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.43 2023/01/31 15:18:54 deraadt Exp $ */ +/* $OpenBSD: pmap.h,v 1.44 2023/02/06 11:16:22 miod Exp $ */ /* $NetBSD: pmap.h,v 1.37 2000/11/19 03:16:35 thorpej Exp $ */ /*- @@ -137,18 +137,6 @@ typedef struct pv_entry { #define PG_PMAP_MOD PG_PMAP0 /* modified */ #define PG_PMAP_REF PG_PMAP1 /* referenced */ -#if defined(NEW_SCC_DRIVER) -#if defined(DEC_KN8AE) -#define _PMAP_MAY_USE_PROM_CONSOLE -#endif -#else /* ! NEW_SCC_DRIVER */ -#if defined(DEC_3000_300) \ - || defined(DEC_3000_500) \ - || defined(DEC_KN8AE) /* XXX */ -#define _PMAP_MAY_USE_PROM_CONSOLE /* XXX */ -#endif /* XXX */ -#endif /* NEW_SCC_DRIVER */ - #if defined(MULTIPROCESSOR) void pmap_tlb_shootdown(pmap_t, vaddr_t, pt_entry_t, u_long *); void pmap_tlb_shootnow(u_long); @@ -195,9 +183,6 @@ paddr_t vtophys(vaddr_t); /* Machine-specific functions. */ void pmap_bootstrap(paddr_t ptaddr, u_int maxasn, u_long ncpuids); int pmap_emulate_reference(struct proc *p, vaddr_t v, int user, int type); -#ifdef _PMAP_MAY_USE_PROM_CONSOLE -int pmap_uses_prom_console(void); -#endif #define pmap_pte_pa(pte) (PG_PFNUM(*(pte)) << PAGE_SHIFT) #define pmap_pte_prot(pte) (*(pte) & PG_PROT) diff --git a/sys/arch/alpha/include/prom.h b/sys/arch/alpha/include/prom.h index 9c7d4bcb9f8..7b504814dbc 100644 --- a/sys/arch/alpha/include/prom.h +++ b/sys/arch/alpha/include/prom.h @@ -1,4 +1,4 @@ -/* $OpenBSD: prom.h,v 1.11 2023/01/16 18:41:53 deraadt Exp $ */ +/* $OpenBSD: prom.h,v 1.12 2023/02/06 11:16:22 miod Exp $ */ /* $NetBSD: prom.h,v 1.12 2000/06/08 03:10:06 thorpej Exp $ */ /* @@ -114,7 +114,6 @@ void hwrpb_restart_setup(void); #if defined(_KERNEL) || defined(_STANDALONE) void promcnputc(dev_t, int); int promcngetc(dev_t); -int promcnlookc(dev_t, char *); u_int64_t prom_dispatch(u_int64_t, u_int64_t, u_int64_t, u_int64_t, u_int64_t);