Age | Commit message (Collapse) | Author |
|
ok deraadt@
|
|
|
|
|
|
|
|
ok deraadt@, mlarkin@
|
|
|
|
ok bluhm@ jca@
|
|
no functional change, found by smatch warnings
ok miod@ bluhm@
|
|
This code affects iMac G3s with a slot-loading CD drive (from late
1999 to 2001, after the older tray-loading iMac G3s, and before the
iMac G4s). Detect such iMacs by their model string (PowerMac2,1 or
PowerMac2,2 or PowerMac4,1), and configure their headphones and
internal speakers in a different way. These iMacs have 3 places to
connect headphones (2 on front, 1 on right side). They also have no
audio connection to the CD drive, so turn off the noisy CD input.
From evan (dot) jss (at) protonmail (dot) ch; I edited the code to get
the model string.
|
|
|
|
linked (for performance). in this case, it grew larger than the
maximum text segment size; increase that size.
|
|
mcount.c, in the same way that -fno-ret-protector is set (because
the default ret-protector is an "always" generator). This change
ensures there is never a stack protector prologue/epilogue in the
functions in that file, no matter what stack protector selection
algorithm is in play.
ok kettenis guenther
|
|
|
|
doesn't make sense anymore. It is better to just issue an illegal
instruction.
ok kettenis, with some misgivings about inconsistant approaches between
architectures.
In the future we could change sigreturn(2) to never return an exit code,
but always just terminate the process. We stopped this system call
from being callable ages ago with msyscall(2), and there is no stub for
it in libc.. maybe that's the next step to take?
|
|
in front of the syscall instruction. This is used to calculate the start
of the syscall for SYS_sigreturn and pinned system calls.
ok kettenis
|
|
From jon (at) elytron (dot) openbsd (dot) amsterdam
ok gkoehler@
|
|
where a switch happens outside. Cleanup these code paths and make the
machine independent.
- when a process forks (fork, tfork, kthread), the new proc needs to
somehow be scheduled for the first time. This is done by proc_trampoline.
Since proc_trampoline is machine dependent assembler code change
the MP specific proc_trampoline_mp() to proc_trampoline_mi() and make
sure it is now always called.
- cpu_hatch: when booting APs the code needs to jump to the first proc
running on that CPU. This should be the idle thread for that CPU.
- sched_exit: when a proc exits it needs to switch away from itself and
then instruct the reaper to clean up the rest. This is done by switching
to the idle loop.
Since the last two cases require a context switch to the idle proc factor
out the common code to sched_toidle() and use it in those places.
Tested by many on all archs.
OK miod@ mpi@ cheloha@
|
|
|
|
All the state initialization once done in clockintr_init() has been
moved to other parts of the kernel. It's a dead function. Remove it.
Likewise, the clockintr_flags variable no longer sports any meaningful
flags. Remove it. This frees up the CL_* flag namespace, which might
be useful to the clockintr frontend if we ever need to add behavior
flags to any of those functions.
|
|
In order to separate the statclock from the clock interrupt subsystem
we need to move all statclock state out into the broader kernel.
Start by replacing the CL_RNDSTAT flag with a new global variable,
"statclock_is_randomized", in kern_clock.c. Update all clockintr_init()
callers to set the boolean instead of passing the flag.
Thread: https://marc.info/?l=openbsd-tech&m=169428749720476&w=2
|
|
no longer needed with zlib 1.3
ok tb@
|
|
To give the primary CPU an opportunity to perform clock interrupt
preparation in a machine-independent manner we need to separate the
"initialization" parts of cpu_initclocks() from the "start the clock
interrupt" parts. Currently, cpu_initclocks() does everything all at
once, so there is no space for this MI setup.
Many platforms have more-or-less already done this separation by
implementing a separate routine named "cpu_startclock()". This patch
promotes cpu_startclock() from de facto standard to mandatory API.
- Prototype cpu_startclock() in sys/systm.h alongside cpu_initclocks().
The separation of responsibility between the two routines is a bit
fuzzy but the basic guidelines are as follows:
+ cpu_initclocks() must initialize hz, stathz, and profhz, and call
clockintr_init().
+ cpu_startclock() must call clockintr_cpu_init() and start the clock
interrupt cycle on the calling CPU.
These guidelines will shift in the future, but that's the way things
stand as of *this* commit.
- In initclocks(): first call cpu_initclocks(), then do MI setup, and
last call cpu_startclock().
- On platforms where cpu_startclock() already exists: don't call
cpu_startclock() from cpu_initclocks() anymore.
- On platforms where cpu_startclock() doesn't yet exist: implement it.
Usually this is as simple as dividing cpu_initclocks() in two.
Tested on amd64 (i8254, lapic), arm64, i386 (i8254, lapic), macppc,
mips64/octeon, and sparc64. Tested on arm/armv7 (agtimer(4)) by
phessler@ and jmatthew@. Tested on m88k/luna88k by aoyama@. Tested
on powerpc64 by gkoehler@ and mlarkin@. Tested on riscv64 by
jmatthew@.
Thread: https://marc.info/?l=openbsd-tech&m=169195251322149&w=2
|
|
from jon at elytron dot openbsd dot amsterdam
feedback and ok miod@
|
|
This patch isolates profil(2) and GPROF from statclock(). Currently,
statclock() implements both profil(2) and GPROF through a complex
mechanism involving both platform code (setstatclockrate) and the
scheduler (pscnt, psdiv, and psratio). We have a machine-independent
interface to the clock interrupt hardware now, so we no longer need to
do it this way.
- Move profil(2)-specific code from statclock() to a new clock
interrupt callback, profclock(), in subr_prof.c. Each
schedstate_percpu has its own profclock handle. The profclock is
enabled/disabled for a given CPU when it is needed by the running
thread during mi_switch() and sched_exit().
- Move GPROF-specific code from statclock() to a new clock interrupt
callback, gmonclock(), in subr_prof.c. Where available, each cpu_info
has its own gmonclock handle . The gmonclock is enabled/disabled for
a given CPU via sysctl(2) in prof_state_toggle().
- Both profclock() and gmonclock() have a fixed period, profclock_period,
that is initialized during initclocks().
- Export clockintr_advance(), clockintr_cancel(), clockintr_establish(),
and clockintr_stagger() via <sys/clockintr.h>. They have external
callers now.
- Delete pscnt, psdiv, psratio. From schedstate_percpu, also delete
spc_pscnt and spc_psdiv. The statclock frequency is not dynamic
anymore so these variables are now useless.
- Delete code/state related to the dynamic statclock frequency from
kern_clockintr.c. The statclock frequency can still be pseudo-random,
so move the contents of clockintr_statvar_init() into clockintr_init().
With input from miod@, deraadt@, and claudio@. Early revisions
cleaned up by claudio. Early revisions tested by claudio@. Tested by
cheloha@ on amd64, arm64, macppc, octeon, and sparc64 (sun4v).
Compile- and boot- tested on i386 by mlarkin@. riscv64 compilation
bugs found by mlarkin@. Tested on riscv64 by jca@. Tested on
powerpc64 by gkoehler@.
|
|
a safe thread. Support is limited to amd64, i386 and arm64 at the
moment, macppc gets only an empty stub.
feedback from kettenis@
tested by bluhm@
ok phessler@
|
|
Move the clockqueue_init() call out of clockintr_cpu_init() and up
just before the sched_init_cpu() call for a given CPU.
This will allow sched_init_cpu() to allocate clockintr handles for a
given CPU's scheduler in a later patch.
Link: https://marc.info/?l=openbsd-tech&m=168661507607622&w=2
ok kettenis@, claudio@
|
|
few users to pci_mapreg_info().
ok jsg@
|
|
feedback and ok jmc@ miod, ok millert@
|
|
ok miod@ millert@
|
|
|
|
only compile tty-related code (stty command, tty variable) on platforms
where it makes sense for the boot loader to control it, rather than the
PROM/firmware/whatever.
|
|
We don't need to disable interrupts around ppc_mtdec(). The
underlying operation, mtdec, is atomic.
Link: https://marc.info/?l=openbsd-tech&m=167494864124073&w=2
ok gkoehler@
|
|
The timecounting code has had stubs for pulse-per-second (PPS) polling
since it was imported in 2004. At this point it seems unlikely that
anyone is going to finish adding PPS support, so let's remove the stubs:
- Delete the dead tc_poll_pps() call from tc_windup().
- Remove all tc_poll_pps symbols from the kernel.
Link: https://marc.info/?l=openbsd-tech&m=167519035723210&w=2
ok miod@
|
|
Don't hardcode stathz to 100 and profhz to 1000. Instead, set stathz
to hz and profhz to (stathz * 10). This is what we do on most other
platforms.
Link: https://marc.info/?l=openbsd-tech&m=167479021815637&w=2
ok kettenis@
|
|
NetBSD zs.c rev 1.49
https://mail-index.netbsd.org/source-changes/2009/10/27/msg002419.html
|
|
Some macppc nvidia graphics cards have a 3rd mem region, but nv(4)
wants to mmap the 1st and 2nd regions.
ok miod@
|
|
Disable -Wdeprecated-non-prototype instead of patching zlib. Upstream
plans to drop the pre-ANSI syntax soon. ok tb@ millert@
|
|
ok millert@
|
|
interrupt enable register; this used to be true more than 20 years ago but
the interrupt code has changed a lot since, and it is nevertheless bad
practice from md drivers to know to much about spl*() return values.
The check should become a "spl >= IPL_TTY", but management of the
adb_polling variable is good enough to need this at all.
|
|
input on adb machines.
|
|
is ELF" world. Eliminate use of them in amd64, arm64, armv7, i386,
macppc, mips64, and sparc64 code.
ok deraadt@ jca@ krw@
|
|
- Remove powerpc-specific clock interrupt scheduling bits from cpu_info.
- Remove macppc-specific randomized statclock() bits from macppc/clock.c.
- Remove the 'stat_count' evcount. All clock interrupts are now counted
via the 'clock_count' evcount.
- Wire up dec_intrclock.
Bringup help from gkoehler@. The patch has survived five or six
kernel-release-upgrade cycles on my dual-core PowerMac3,6.
Link: https://marc.info/?l=openbsd-tech&m=166776385003520&w=2
ok gkoehler@ mlarkin@
|
|
sys_execve() to return EJUSTRETURN.
setregs() is the MD routine used by sys_execve() to set up the
thread's trapframe and PCB such that, on 'return' to userspace, it
has the register values defined by the ABI and otherwise zero. It
had to set the syscall retval[] values previously because the normal
syscall return path overwrites a couple registers with the retval[]
values. By instead returning EJUSTRETURN that and some complexity
with program-counter handling on m88k and sparc64 goes away.
Also, give setregs() add a 'struct ps_strings *arginfo' argument
so powerpc, powerpc64, and sh can directly get argc/argv/envp
values for registers instead of copyin()ing the one in userspace.
Improvements from miod@ and millert@
Testing assistance miod@, kettenis@, and aoyama@
ok miod@ kettenis@
|
|
The property bits of audio(9) are obsolete and ought to be removed
completely.
sys/dev/audio.c:audio_open() currently uses get_props() to bail out if
read *and* write was requested on a non-duplex driver.
Drivers that currently support playing but not recording need adjustment
before the API can be cleaned up.
Drivers that advertise themselves as full duplex, i.e. those that always
return AUDIO_PROP_FULLDUPLEX unconditionally in their get_props() currently
always succeed this check.
As this is the only property, losen audio_open()'s DIAGNOSTIC check and only
do the duplex check if the driver provides get_props().
This allows for simple removal of get_props() from full-duplex drivers
without adding any other code or without changing functionality.
This includes all audio drivers under sys/dev/pci/ (maestro(4) being the
only unfinished exception here).
Other drivers as well as the API change can then follow in smaller diffs.
This builds on amd64, arm64, i386, macppc and sparc64.
amd64 with azalia(4) still plays, records as well as plays and records
at the same time on my X230 as tested with
$ aucat -i play.wav [-o rec.wav]
alpha and hppa tests by miod
OK ratchov miod
|
|
used by cpu_fork()
ok miod@ kettenis@ mpi@ deraadt@
|
|
Both only used for printf calls.
OK gkoehler
|
|
A kernel with option SUSPEND now calls gosleep() if I run zzz(8),
press the power button (when machdep.pwraction=2), or close the lid
(when machdep.lidaction=1). Because gosleep() is an empty stub, the
macppc does not really suspend; it only suspends some devices and
immediately resumes.
The interrupt from the power button or the lid needs some thread
(other than systq) to call sleep_state(). Use taskq_create(9) to
create another thread.
Add a call to device_register_wakeup(). Without this call,
sleep_state() does nothing.
ok kettenis@ deraadt@
|
|
I can now use the power button to power off my macppcs running
OpenBSD. The new sysctls machdep.lidaction and machdep.pwraction act
like acpibtn(4), but we are missing code to suspend or hibernate a
macppc. Small kernels (bsd.rd) continue to ignore the power button.
adb(4) sends an environment interrupt when I unplug my PowerBook's AC
or close its lid. Rename PMU_INT_WAKEUP to PMU_INT_ENVIRONMENT like
other BSDs and Linux. Handle PMU_ENV_LID_CLOSED as a lid sensor and
PMU_ENV_AC_POWER by setting sysctl hw.power. Power buttons can either
use PMU_ENV_POWER_BUTTON or go through akbd(4); handle both kinds of
power buttons in the same way. Other models of macppc, with different
power buttons or lids, might not work yet. The lid sensor looks like,
$ sysctl hw.sensors
hw.sensors.adb0.indicator0=On (lid open)
kettenis@ warned against calling prsignal() from interrupt context,
and pointed me to task_add(9).
|
|
The powerpc64 part is under #if 0, so this change affects only macppc.
Simplify powerpc64's __syncicache (which had size_t len) and copy it
to macppc's syncicache (which had int len).
macppc was looping while ((l -= CACHELINESIZE) > 0). The loop would
be infinite if l became an unsigned type like size_t. It is simpler
to set size_t i = 0, do i += by, and loop while (i < len). It helps
that dcbst and icbi can add 2 registers, from + i.
|
|
This audio(9) struct will lose a member, but drivers init their struct quite
inconsistently, most pre-C99 style.
Use C99 style everywhere, to get rid of all annoying differences and allow
for easy member removals/additions:
- don't change current order of members
- no explicit NULL members
- no comments or blank lines
- trailing comma in last member line
GENERIC.MP builds fine with this on arm64, amd64, i386 and sparc64.
macppc and alpha build-tested by miod
OK ratchov miod
|