summaryrefslogtreecommitdiff
path: root/sys/arch/macppc
AgeCommit message (Collapse)Author
12 daysCast atomic_load_int(9) to signed int when loading `securelevel'.Vitaliy Makkoveev
The return value of atomic_load_int(9) is unsigned so needs a cast, otherwise securelevel=-1 gets misrepresented. From Paul Fertser.
2024-11-07Remove OF_package_to_path(). This routine used to be needed by the OFWMiod Vallat
devices (ofnet, etc) for the VI board in the before-macppc days which nobody remembers, and has never been needed for anything on macs.
2024-11-05Apply the changes in sys/lib/libsa/alloc.c 1.13 to the other copies of thatMiod Vallat
file modified to use OpenFirmware routines: ``Make the freelist best fit code a tiny bit smarter to not use a block if half or more would be wasted. Causes more effective re-use of blocks.'' Bump bootloader version in the unlikely case this misbehaves on some machines.
2024-11-05The MI boot code used to have an infinite loop trying to boot the kernel,Miod Vallat
which got limited to at most two tries 26 years ago for the 2.3 release, but the documentation was never updated to match this change. Do it now. Reported by Nir Lichtman on tech@, file forgotten in previous commit
2024-11-01In macppc ofwboot, sync instruction cache before entering kernelGeorge Koehler
My PowerBook G4 had some old code in its instruction cache when it jumped into OpenBSD's kernel. If I got unlucky with a reordered kernel, it would trip over the old code, trap into ddb, and fail to boot. The same kernel would boot fine on a different macppc with different firmware. This problem is rare; I got unlucky only twice, on 2022-04-26 and 2024-07-01. This fix tells ofwboot to invalidate the instruction cache for the loaded kernel before jumping there. Adapted from NetBSD src/sys/arch/macppc/stand/ofwboot/boot.c
2024-10-28Unlock KERN_ALLOWKMEM. The `allowkmem' is atomically accessed integer.Vitaliy Makkoveev
Also use atomic_load_int(9) to load `securelevel'. sysctl_securelevel() is mp-safe, but will be under kernel lock until all existing `securelevel' loading became mp-safe too. ok mpi
2024-10-24Change macppc's ci_idepth from -1 to 0 when no interruptsGeorge Koehler
Now curcpu()->ci_idepth == 0 would work on macppc as it does on powerpc64 and other archs, by checking that we aren't in an interrupt. This also makes macppc's splassert_check() less different. locore.S checks for the 1st interrupt when it increments ci_idepth. Using -1 for no interrupts had saved an instruction, as "addic." was short for "addi; cmpwi". Using 0, it now does "cmpwi; addi" to compare ci_idepth with 0 before incrementing it. ok mpi@
2024-10-22put opening { on same line as struct nameJonathan Gray
ok claudio@
2024-10-22Rename `ci_intrdepth' to `ci_idepth'.Martin Pieuchot
ok gkoehler@, jsg@
2024-10-21remove unneeded includesJonathan Gray
2024-09-06spelling; ok mglocker@Jonathan Gray
2024-09-04Fix some spelling.Marcus Glocker
Input and ok jmc@, jsg@
2024-08-28splnet() not needed in activate functionTheo de Raadt
ok gkoehler
2024-08-07crank to 7.6-beta, release date is vagueTheo de Raadt
2024-07-21Export basic HWCAP bits to let applications detect Altivec on powerpcJeremie Courreges-Anglas
Input from miod@ and gkoehler@, tests & ok gkoehler@
2024-07-14Add missing <machine/elf.h> for compound arches.Miod Vallat
The spice^Wkernel must flow^Wbuild.
2024-07-11umoddi3.c is now needed for libzTheo de Raadt
2024-06-23If an ioctl(2) request isn't implemented we should return ENOTTY.Mark Kettenis
ok deraadt@
2024-06-11remove drm prototypes duplicating those in sys/conf.hJonathan Gray
2024-06-11remove kbd/ms prototypes with no matching functionsJonathan Gray
2024-05-29indent with tabs not spaces; from jon@elytron.openbsd.amsterdamJonathan Gray
2024-05-28Garbage collect sleep_abort(); it doesn't do anything useful anymore.Mark Kettenis
ok deraadt@, mlarkin@
2024-05-22remove prototypes with no matching function and externs with no varJonathan Gray
2024-04-14with empty body loops, put final semicolon on a new line for readabilityJonathan Gray
ok bluhm@ jca@
2024-04-13correct indentationJonathan Gray
no functional change, found by smatch warnings ok miod@ bluhm@
2024-03-03Fix awacs(4) audio on some iMac G3 modelsGeorge Koehler
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.
2024-02-17move to 7.5-betaTheo de Raadt
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@