summaryrefslogtreecommitdiff
path: root/sys/arch/macppc
AgeCommit message (Collapse)Author
2024-01-30the clang binary never shrinks, especially since it is staticallyTheo de Raadt
linked (for performance). in this case, it grew larger than the maximum text segment size; increase that size.
2024-01-28set -fno-stack-protector in NORMAL_C_NOP, which is used to compileTheo de Raadt
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
2023-12-26Update documentation URLMiod Vallat
2023-12-12The sigtramp was calling sigreturn(2), and upon failure exit(2), whichTheo de Raadt
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?
2023-12-10Add a new label "sigcodecall" inside every sigtramp definition, directlyTheo de Raadt
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
2023-11-22Add support for keyboard backlight on Apple Powerbooks.Tobias Heider
From jon (at) elytron (dot) openbsd (dot) amsterdam ok gkoehler@
2023-10-24Normally context switches happen in mi_switch() but there are 3 casesClaudio Jeker
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@
2023-09-18crank to 7.4-betaTheo de Raadt
2023-09-17clockintr: remove clockintr_init(), clockintr_flagsScott Soule 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.
2023-09-14clockintr: replace CL_RNDSTAT with global variable statclock_is_randomizedScott Soule Cheloha
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
2023-09-06revert disabling warnings for zlib on clang >= 15Jonathan Gray
no longer needed with zlib 1.3 ok tb@
2023-08-23all platforms: separate cpu_initclocks() from cpu_startclock()Scott Soule Cheloha
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
2023-07-31Implement audio input source selection.Tobias Heider
from jon at elytron dot openbsd dot amsterdam feedback and ok miod@
2023-07-25statclock: move profil(2), GPROF code to profclock(), gmonclock()Scott Soule Cheloha
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@.
2023-07-08Adds request_sleep(), a MI way of sending the machine to sleep inTobias Heider
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@
2023-06-15all platforms, main(): call clockqueue_init() just before sched_init_cpu()Scott Soule Cheloha
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@
2023-04-13Remove intentionally undocumented pci_{io,mem}_find and convert their lastMiod Vallat
few users to pci_mapreg_info(). ok jsg@
2023-04-11fix double words in commentsJonathan Gray
feedback and ok jmc@ miod, ok millert@
2023-03-08Delete obsolete /* ARGSUSED */ lint comments.Philip Guenther
ok miod@ millert@
2023-03-04move to 7.3-betaTheo de Raadt
2023-02-23Remove dangerous user-settable "addr" variable from MI boot loader, andMiod Vallat
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.
2023-02-04macppc: dec_rearm: don't disable interrupts around atomic operationsScott Soule Cheloha
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@
2023-02-04timecounting: remove incomplete PPS supportScott Soule Cheloha
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@
2023-01-27macppc: initialize stathz, profhz as on other platformsScott Soule Cheloha
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@
2023-01-04Gordon W. Ross and Bill Studenmund agreed to rescind clause 3 and 4 inJonathan Gray
NetBSD zs.c rev 1.49 https://mail-index.netbsd.org/source-changes/2009/10/27/msg002419.html
2022-12-31Look for the first 2 mem regions, ignore the restGeorge Koehler
Some macppc nvidia graphics cards have a 3rd mem region, but nv(4) wants to mmap the 1st and 2nd regions. ok miod@
2022-12-30Neuter zlib fatal warnings when building kernels and bootloaders with clang 15Jeremie Courreges-Anglas
Disable -Wdeprecated-non-prototype instead of patching zlib. Upstream plans to drop the pre-ANSI syntax soon. ok tb@ millert@
2022-12-28Ansify, fixes clang 15 -Wdeprecated-non-prototype (fatal with -Werror)Jeremie Courreges-Anglas
ok millert@
2022-12-26send_adb_cuda() would assume the returned value of splhigh() is the macintrMiod Vallat
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.
2022-12-26Update adb_polling in akbd_cnpollc rather than akbd_cngetc; repairs ddbMiod Vallat
input on adb machines.
2022-12-08_C_LABEL() and _ASM_LABEL() are no longer useful in the "everythingPhilip Guenther
is ELF" world. Eliminate use of them in amd64, arm64, armv7, i386, macppc, mips64, and sparc64 code. ok deraadt@ jca@ krw@
2022-11-29powerpc, macppc: switch to clockintrScott Soule Cheloha
- 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@
2022-10-30Simplfity setregs() by passing it the ps_strings and switchingPhilip Guenther
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@
2022-10-26Make audio(9) get_props() optional, remove it from duplex driversKlemens Nanni
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
2022-10-25Consistently use 'proc_trampoline' as the name of the trampolinePhilip Guenther
used by cpu_fork() ok miod@ kettenis@ mpi@ deraadt@
2022-10-23Constify send/receive command tablesKlemens Nanni
Both only used for printf calls. OK gkoehler
2022-10-23Connect macppc's power button and lid to the SUSPEND stubsGeorge Koehler
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@
2022-10-21hw.power, machdep.lidaction, machdep.pwraction for macppcGeorge Koehler
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).
2022-10-21Change len in syncicache(_, len) from int to size_tGeorge Koehler
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.
2022-10-19Use C99 struct init for struct audio_hw_ifKlemens Nanni
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
2022-10-18Remove unused AUDIO_PROP_{MMAP,INDEPENDENT}Klemens Nanni
AUDIO_PROP_FULLDUPLEX is the only audio(9) in use, the other two died with commit 1cf2860827c8ca659d8097d8da94a5ae5b888c53 Author: ratchov <ratchov@openbsd.org> Date: Thu Jun 25 06:43:45 2015 +0000 Reimplement the audio driver in a simpler way, removing unused/unusable functionality. Same API and ABI except for the removed bits and no behaviour change for programs using libsndio. With help from armani@ and mpi@, thanks. but remained defined and set in drivers. and the following merely moved them when they were dead code already: commit 9215aa3dfad387bca877a805534df6dcfe8722eb Author: ratchov <ratchov@openbsd.org> Date: Wed Aug 31 07:22:43 2016 +0000 Delete unused ioctls and associated macros. Move macros that are still used internally by low-level drivers from sys/audioio.h to dev/audio_if.h instead of deleting them. None of this is used in base or ports; codesearch.debian.net only shows AUDIO_PROP_{CAPTURE,PLAYBACK} in firefox-esr, mozjs and cubeb. ratchov points out that audio_if.h and audioio.h are private interfaces and the codesearch shows SunOS and NetBSD bits (#ifdef'd out on OpenBSD). OK ratchov
2022-10-15ansiJonathan Gray
2022-10-12Remove powerpc left-oversKlemens Nanni
There since the powerpc -> macppc move/rename. KERN_AS usage disappeared in commit 5b7db11d478192c5908038bb1345e7d51cc35c8e Author: rahnds <rahnds@openbsd.org> Date: Mon May 5 16:47:15 1997 +0000 only build one version of the libraries. REAL_VIRT usage disappeared in commit 08e027d6bb9ca863bfc44a1aa6957ff3a242e2f4 Author: rahnds <rahnds@openbsd.org> Date: Thu Apr 27 12:36:29 2000 +0000 Fixes to xcoff bootloader to allow it to execute and load kernels for OpenBSD. Make agrees that these are defined but not used: $ make -p | grep -e KERN_AS -e REAL_VIRT KERN_AS = library REAL_VIRT = -v $ make -C ofwboot -p | grep -e KERN_AS -e REAL_VIRT KERN_AS = library REAL_VIRT = -v No object change. Feedback OK miod
2022-10-12Fix -Wreturn-typeKlemens Nanni
OK miod
2022-10-11Give checkdisklabel() a new parameter supplying the dev_t of theKenneth R Westerback
device whose disklabel is being checked. Within checkdisklabel() use this information to discover a device name iff (sic) the label is an obsolete version. Use the name to generate a meaningful warning message asking the user to rewrite the disklabel and thus promote it to the current version. Suggested by, feedback from and ok deraadt@
2022-09-18Define PMU_ADB_CMD and PMU_INT_ACKGeorge Koehler
Taking these definitions from NetBSD's pm_direct.h; most PMU_* commands have the same names in the BSDs and Linux. ok miod@ kettenis@
2022-09-08macppc: cpu_initclocks: install tb_timecounter before cpu_startclock()Scott Soule Cheloha
In the future, the clock interrupt code will need a real timecounter to work correctly. Nudge the tc_init(9) call for tb_timecounter up before cpu_startclock().
2022-09-05Fix file specification, zap partition bits, rectify disk naming errorsKlemens Nanni
In boot_macppc(8), the current format a) claims to support specific disk/MBR partitions which ofwboot clearly does not parse as such and b) lacks markup to make clear which optional parts can (not) be omitted in what way. Fixing both turns promdev:partition/filename options into [[promdev:]filename] [-acds] Same goes for boot(8/macppc), which has been apparently has been copied from boot(8/amd64) without accounting for all platform specific details. On amd64, biosboot(8) sees disks as 'sd' which (accidentially?) matches the kernel driver's sd(4) name; it also supports specific disklabel(5) slices, so amd64 can do 'sd0a:/bsd'. On macppc, disks show up as 'ide', 'cd' or 'hd' which stems from OpenFirmware alone, not matching the wd(4) driver's name. Also, ofwboot always boots off the 'a' label, so macppc can only do 'hd:/bsd'. Found while installing OpenBSD/macppc from CD inside QEMU but failing to boot from disk inside QEMU and consulting our manual pages for help wrt. specifying a boot device. Turns out QEMU's OpenBIOS simply cannot boot from MSDOS filesystems (thanks gkoehler), so it wouldn't work no matter what boot file specification I'd use. tests/agreement gkoehler Feedback OK miod OK tobhe OK jmc on a previous boot_macppc.8 diff
2022-09-04spellingJonathan Gray
2022-09-02Constify nam2blk[], chrtoblktbl[] and octeon devmap[].Miod Vallat
ok mpi@ millert@