From d4028b06ffbb25e88f40c2e0e088c110e7bba791 Mon Sep 17 00:00:00 2001 From: cheloha Date: Fri, 28 Apr 2023 18:27:55 +0000 Subject: [PATCH] timer(4/sparc64): remove driver The timer(4/sparc64) driver was effectively disabled during the previous release. Nobody has come forward asking for it to be adapted to work with the new clockintr framework, so it's time to remove the driver from the tree. As of today, if you want to run OpenBSD on SPARC v9 hardware, that hardware needs to sport either %tick and %tick_compare (%asr23), or %stick (%asr24) and %stick_compare (%asr25). All Sun/Oracle SPARC v9 hardware meets these conditions, from the UltraSPARC I onward. Most HAL/Fujitsu SPARC v9 hardware meets these conditions, from the SPARC64 III onward. The only HAL/Fujitsu hardware that might not have %tick_compare are the HAL SPARC64 I and SPARC64 II, for which I can find no documentation. However, those processors are currently unsupported by OpenBSD for other reasons, so their support status is unchanged by the removal of this driver. With help from miod@. Link: https://marc.info/?l=openbsd-tech&m=167898759928206&w=2 "after unlock" deraadt@, ok mlarkin@ miod@ --- distrib/sets/lists/man/mi | 1 - share/man/man4/man4.sparc64/Makefile | 4 +- share/man/man4/man4.sparc64/timer.4 | 43 -------------- sys/arch/sparc64/conf/GENERIC | 5 +- sys/arch/sparc64/conf/RAMDISK | 3 +- sys/arch/sparc64/conf/RAMDISKU1 | 3 +- sys/arch/sparc64/conf/RAMDISKU5 | 4 +- sys/arch/sparc64/sparc64/autoconf.c | 3 +- sys/arch/sparc64/sparc64/clock.c | 79 +------------------------ sys/arch/sparc64/sparc64/locore.s | 3 +- sys/arch/sparc64/sparc64/timerreg.h | 87 ---------------------------- 11 files changed, 9 insertions(+), 226 deletions(-) delete mode 100644 share/man/man4/man4.sparc64/timer.4 delete mode 100644 sys/arch/sparc64/sparc64/timerreg.h diff --git a/distrib/sets/lists/man/mi b/distrib/sets/lists/man/mi index 7129e538ad3..3b2a0d1d1e9 100644 --- a/distrib/sets/lists/man/mi +++ b/distrib/sets/lists/man/mi @@ -1986,7 +1986,6 @@ ./usr/share/man/man4/sparc64/spif.4 ./usr/share/man/man4/sparc64/ssm.4 ./usr/share/man/man4/sparc64/tda.4 -./usr/share/man/man4/sparc64/timer.4 ./usr/share/man/man4/sparc64/tvtwo.4 ./usr/share/man/man4/sparc64/upa.4 ./usr/share/man/man4/sparc64/uperf.4 diff --git a/share/man/man4/man4.sparc64/Makefile b/share/man/man4/man4.sparc64/Makefile index a2d0b0ec7d9..8ab3b2a6aa7 100644 --- a/share/man/man4/man4.sparc64/Makefile +++ b/share/man/man4/man4.sparc64/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.82 2019/04/25 16:47:56 denis Exp $ +# $OpenBSD: Makefile,v 1.83 2023/04/28 18:27:55 cheloha Exp $ MAN= agten.4 apio.4 asio.4 audioce.4 audiocs.4 autoconf.4 auxio.4 \ bbc.4 be.4 beeper.4 bpp.4 bwtwo.4 cbus.4 central.4 cgsix.4 cgthree.4 \ @@ -9,7 +9,7 @@ MAN= agten.4 apio.4 asio.4 audioce.4 audiocs.4 autoconf.4 auxio.4 \ pcons.4 pmc.4 power.4 ppm.4 prtc.4 psycho.4 pyro.4 qe.4 qec.4 \ radeonfb.4 raptor.4 rfx.4 \ sab.4 sbbc.4 schizo.4 spif.4 ssm.4 \ - tda.4 timer.4 tvtwo.4 upa.4 uperf.4 \ + tda.4 tvtwo.4 upa.4 uperf.4 \ vbus.4 vcc.4 vcons.4 vds.4 vdsk.4 vigra.4 vldc.4 vnet.4 vpci.4 \ vrng.4 vrtc.4 vsw.4 \ xbox.4 zs.4 zx.4 diff --git a/share/man/man4/man4.sparc64/timer.4 b/share/man/man4/man4.sparc64/timer.4 deleted file mode 100644 index 900161b2d4e..00000000000 --- a/share/man/man4/man4.sparc64/timer.4 +++ /dev/null @@ -1,43 +0,0 @@ -.\" $OpenBSD: timer.4,v 1.2 2007/05/31 19:19:57 jmc Exp $ -.\" -.\" Copyright (c) 2004 Jason L. Wright (jason@thought.net) -.\" 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. -.\" -.\" 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. -.\" -.Dd $Mdocdate: May 31 2007 $ -.Dt TIMER 4 sparc64 -.Os -.Sh NAME -.Nm timer -.Nd SPARC64 Timer -.Sh SYNOPSIS -.Cd "timer* at mainbus0" -.Sh DESCRIPTION -The -.Nm -device provides support for the onboard timer on SBus based -UltraSPARC machines. -The timers are used to control various time services in the -kernel and are not user accessible. -.Sh SEE ALSO -.Xr intro 4 diff --git a/sys/arch/sparc64/conf/GENERIC b/sys/arch/sparc64/conf/GENERIC index 90497c28d24..46f927c79db 100644 --- a/sys/arch/sparc64/conf/GENERIC +++ b/sys/arch/sparc64/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.322 2022/01/02 23:14:27 jsg Exp $ +# $OpenBSD: GENERIC,v 1.323 2023/04/28 18:27:55 cheloha Exp $ # # For further information on compiling OpenBSD kernels, see the config(8) # man page. @@ -342,9 +342,6 @@ clkbrd* at fhc? ## PROM clock -- if all else failse prtc0 at mainbus0 -## Timer chip found on (some) sun4u systems. -timer* at mainbus0 - # Virtual devices for sun4v systems. vcons0 at vbus? vrtc0 at vbus? diff --git a/sys/arch/sparc64/conf/RAMDISK b/sys/arch/sparc64/conf/RAMDISK index f4d3c8f215a..66c466af46b 100644 --- a/sys/arch/sparc64/conf/RAMDISK +++ b/sys/arch/sparc64/conf/RAMDISK @@ -1,4 +1,4 @@ -# $OpenBSD: RAMDISK,v 1.126 2021/07/15 15:37:55 deraadt Exp $ +# $OpenBSD: RAMDISK,v 1.127 2023/04/28 18:27:55 cheloha Exp $ machine sparc64 maxusers 4 @@ -111,7 +111,6 @@ clock* at sbus? # Mostek clock clock* at ebus? clock0 at fhc? rtc* at ebus? # DS1287/M5819 clock -timer* at mainbus0 # Timer chip vcons0 at vbus? vrtc0 at vbus? diff --git a/sys/arch/sparc64/conf/RAMDISKU1 b/sys/arch/sparc64/conf/RAMDISKU1 index 0a9d12d8b1c..124366f38e9 100644 --- a/sys/arch/sparc64/conf/RAMDISKU1 +++ b/sys/arch/sparc64/conf/RAMDISKU1 @@ -1,4 +1,4 @@ -# $OpenBSD: RAMDISKU1,v 1.25 2020/04/02 06:07:05 otto Exp $ +# $OpenBSD: RAMDISKU1,v 1.26 2023/04/28 18:27:55 cheloha Exp $ machine sparc64 maxusers 4 @@ -23,7 +23,6 @@ cpu0 at mainbus0 sbus* at mainbus0 # Ultra 1 clock* at sbus? # Mostek clock -timer* at mainbus0 # Timer chip le* at sbus? # Lance Ethernet - AMD7990 ledma* at sbus? diff --git a/sys/arch/sparc64/conf/RAMDISKU5 b/sys/arch/sparc64/conf/RAMDISKU5 index da78db85b1c..0cdde9e468f 100644 --- a/sys/arch/sparc64/conf/RAMDISKU5 +++ b/sys/arch/sparc64/conf/RAMDISKU5 @@ -1,4 +1,4 @@ -# $OpenBSD: RAMDISKU5,v 1.22 2020/04/02 06:07:05 otto Exp $ +# $OpenBSD: RAMDISKU5,v 1.23 2023/04/28 18:27:55 cheloha Exp $ machine sparc64 maxusers 4 @@ -38,8 +38,6 @@ clock* at ebus? pcons0 at mainbus0 # PROM console -timer* at mainbus0 # Timer chip (some systems) - pciide* at pci? flags 0x0000 wd* at pciide? flags 0x0a00 atapiscsi* at pciide? diff --git a/sys/arch/sparc64/sparc64/autoconf.c b/sys/arch/sparc64/sparc64/autoconf.c index c6415f98577..3178f8fc1a1 100644 --- a/sys/arch/sparc64/sparc64/autoconf.c +++ b/sys/arch/sparc64/sparc64/autoconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.c,v 1.142 2023/03/08 04:43:07 guenther Exp $ */ +/* $OpenBSD: autoconf.c,v 1.143 2023/04/28 18:27:55 cheloha Exp $ */ /* $NetBSD: autoconf.c,v 1.51 2001/07/24 19:32:11 eeh Exp $ */ /* @@ -77,7 +77,6 @@ #include #include #include -#include #include #include diff --git a/sys/arch/sparc64/sparc64/clock.c b/sys/arch/sparc64/sparc64/clock.c index 9656d3740a1..fcb0075e88e 100644 --- a/sys/arch/sparc64/sparc64/clock.c +++ b/sys/arch/sparc64/sparc64/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.76 2023/02/04 19:19:37 cheloha Exp $ */ +/* $OpenBSD: clock.c,v 1.77 2023/04/28 18:27:55 cheloha Exp $ */ /* $NetBSD: clock.c,v 1.41 2001/07/24 19:29:25 eeh Exp $ */ /* @@ -88,7 +88,6 @@ #include #include -#include #include #include #include @@ -207,26 +206,12 @@ const struct cfattach clock_fhc_ca = { extern todr_chip_handle_t todr_handle; static struct idprom *idprom; -static int timermatch(struct device *, void *, void *); -static void timerattach(struct device *, struct device *, void *); - -struct timerreg_4u timerreg_4u; /* XXX - need more cleanup */ - -const struct cfattach timer_ca = { - sizeof(struct device), timermatch, timerattach -}; - -struct cfdriver timer_cd = { - NULL, "timer", DV_DULL -}; - 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 *); -void stopcounter(struct timer_4u *); int timerblurb = 10; /* Guess a value; used before clock is attached */ @@ -460,68 +445,6 @@ getidprom(void) return (idp); } -/* - * The sun4u OPENPROMs call the timer the "counter-timer", except for - * the lame UltraSPARC IIi PCI machines that don't have them. - */ -static int -timermatch(struct device *parent, void *cf, void *aux) -{ -#ifndef MULTIPROCESSOR - struct mainbus_attach_args *ma = aux; - - if (!timerreg_4u.t_timer || !timerreg_4u.t_clrintr) - return (strcmp("counter-timer", ma->ma_name) == 0); - else -#endif - return (0); -} - -static void -timerattach(struct device *parent, struct device *self, void *aux) -{ -#if 0 - struct mainbus_attach_args *ma = aux; - u_int *va = ma->ma_address; - - /* - * What we should have are 3 sets of registers that reside on - * different parts of SYSIO or PSYCHO. We'll use the prom - * mappings cause we can't get rid of them and set up appropriate - * pointers on the timerreg_4u structure. - */ - timerreg_4u.t_timer = (struct timer_4u *)(u_long)va[0]; - timerreg_4u.t_clrintr = (int64_t *)(u_long)va[1]; - timerreg_4u.t_mapintr = (int64_t *)(u_long)va[2]; - - /* Install the appropriate interrupt vector here */ - level10.ih_number = INTVEC(ma->ma_interrupts[0]); - level10.ih_clr = (void *)&timerreg_4u.t_clrintr[0]; - level10.ih_map = (void *)&timerreg_4u.t_mapintr[0]; - strlcpy(level10.ih_name, "clock", sizeof(level10.ih_name)); - intr_establish(10, &level10); - - level14.ih_number = INTVEC(ma->ma_interrupts[1]); - level14.ih_clr = (void *)&timerreg_4u.t_clrintr[1]; - level14.ih_map = (void *)&timerreg_4u.t_mapintr[1]; - strlcpy(level14.ih_name, "prof", sizeof(level14.ih_name)); - intr_establish(14, &level14); - - printf(" ivec 0x%llx, 0x%llx\n", INTVEC(level10.ih_number), - INTVEC(level14.ih_number)); -#endif - printf("\n"); -} - -void -stopcounter(struct timer_4u *creg) -{ - /* Stop the clock */ - volatile int discard; - discard = creg->t_limit; - creg->t_limit = 0; -} - /* * XXX this belongs elsewhere */ diff --git a/sys/arch/sparc64/sparc64/locore.s b/sys/arch/sparc64/sparc64/locore.s index 52e349ff611..88f5fe146f0 100644 --- a/sys/arch/sparc64/sparc64/locore.s +++ b/sys/arch/sparc64/sparc64/locore.s @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.s,v 1.200 2023/04/13 15:36:28 miod Exp $ */ +/* $OpenBSD: locore.s,v 1.201 2023/04/28 18:27:55 cheloha Exp $ */ /* $NetBSD: locore.s,v 1.137 2001/08/13 06:10:10 jdolecek Exp $ */ /* @@ -65,7 +65,6 @@ #include "ksyms.h" #include #include -#include #include #include #include diff --git a/sys/arch/sparc64/sparc64/timerreg.h b/sys/arch/sparc64/sparc64/timerreg.h deleted file mode 100644 index acaf896f104..00000000000 --- a/sys/arch/sparc64/sparc64/timerreg.h +++ /dev/null @@ -1,87 +0,0 @@ -/* $OpenBSD: timerreg.h,v 1.5 2007/05/29 09:54:23 sobrado Exp $ */ -/* $NetBSD: timerreg.h,v 1.3 1999/06/05 05:10:01 mrg Exp $ */ - -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * 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, Lawrence Berkeley Laboratory. - * - * 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. 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. - * - * @(#)timerreg.h 8.1 (Berkeley) 6/11/93 - */ - -/* - * These timers work in a rather peculiar fashion. Most clock counters - * run to 0 (as, e.g., on the VAX, where the ICR counts up to 0 from a - * large unsigned number). On the Sun-4c, it counts up to a limit. But - * for some reason, when it reaches the limit, it resets to 1, not 0. - * Thus, if the limit is set to 4, the counter counts like this: - * - * 1, 2, 3, 1, 2, 3, ... - * - * and if we want to divide by N we must set the limit register to N+1. - * - * Sun-4u counters/timer are similar but: - * - * - the registers have been shuffled around once again. We need - * to use offsets from the 3 addresses the ROM provides us. - * - The counters are 29 bits wide with 1us accuracy. - * - You can make them do funky things with the limit register - * - They have standard 64-bit SBus control registers. - * - * There is a problem on the Ultra5 and Ultra10. As the PCI controller - * doesn't include the timer, there are no `counter-timer' nodes here - * and so we must use %tick. - */ -#ifndef _LOCORE -struct timer_4u { - volatile int64_t t_count; /* counter reg */ - volatile int64_t t_limit; /* limit reg */ - -#define TMR_LIM_IEN 0x80000000 /* interrupt enable bit */ -#define TMR_LIM_RELOAD 0x40000000 /* reload counter to 0 */ -#define TMR_LIM_PERIODIC 0x20000000 /* reset at limit */ -#define TMR_LIM_MASK 0x1fffffff -}; - -struct timerreg_4u { - struct timer_4u *t_timer; /* There are two of them. */ - volatile int64_t *t_clrintr; /* There are two of these. */ - volatile int64_t *t_mapintr; /* Same here. */ -}; - -#endif /* _LOCORE */ - -/* Compute a limit that causes the timer to fire every n microseconds. */ -#define tmr_ustolim(n) (((n) - 1) & TMR_LIM_MASK) -- 2.20.1