summaryrefslogtreecommitdiff
path: root/sys/arch
AgeCommit message (Collapse)Author
2021-12-23Fix endless loop in the interrupt handler. When iterating over eachPatrick Wildt
GPIO base register we must not replace the iterator variable with the index of the pin inside the register. ok kettenis@
2021-12-23Roll the syscalls that have an off_t argument to remove the explicit padding.Philip Guenther
Switch libc and ld.so to the generic stubs for these calls. WARNING: reboot to updated kernel before installing libc or ld.so! Time for a story... When gcc (back in 1.x days) first implemented long long, it didn't (always) pass 64bit arguments in 'aligned' registers/stack slots, with the result that argument offsets didn't match structure offsets. This affected the nine system calls that pass off_t arguments: ftruncate lseek mmap mquery pread preadv pwrite pwritev truncate To avoid having to do custom ASM wrappers for those, BSD put an explicit pad argument in so that the off_t argument would always start on a even slot and thus be naturally aligned. Thus those odd wrappers in lib/libc/sys/ that use __syscall() and pass an extra '0' argument. The ABIs for different CPUs eventually settled how things should be passed on each and gcc 2.x followed them. The only arch now where it helps is landisk, which needs to skip the last argument register if it would be the first half of a 64bit argument. So: add new syscalls without the pad argument and on landisk do that skipping directly in the syscall handler in the kernel. Keep compat support for the existing syscalls long enough for the transition. ok deraadt@
2021-12-20Make mtw(4) known to the config(8) framework.hastings
Not enabled yet. Pending firmware availability. ok stsp@ jmatthew@
2021-12-19Add an implementation for the protocol to communicate with coprocessorsMark Kettenis
running firmware based Apple's RTKit OS. Use this code to bring up the storage controller that implements Apple's flavour of NVMe. ok dlg@, patrick@
2021-12-19Enable aplmbox(4).Mark Kettenis
2021-12-18Add aplmbox(4), a driver for the mailbox that provides a communicationMark Kettenis
channel with additional cores integrated on Apple SoCs. ok patrick@
2021-12-17Disable a few warning flags that were introduced and enabled by defaultPatrick Wildt
with LLVM 13.
2021-12-16Attach com over acpi on amd64. Some hardware uses a different interruptAnton Lindqvist
assignment compared to the the legacy one supported by com over isa. This causes the console to halt once userland takes over as no interrupts are received. The actual address and irq can be read from ACPI, kettenis@ already added support for arm64 which paved the way for amd64. Some consoles that previously attached over isa are now expected to attach over acpi. Thanks to patrick@ for testing on arm64. ok kettenis@
2021-12-15typo in previousTheo de Raadt
2021-12-14delete incorrect comment about sys/cdefs.hTheo de Raadt
2021-12-14Use "rng-seed" and "kaslr-seed" properties from the device tree to mix inMark Kettenis
some extra entropy. ok deraadt@
2021-12-12remove unused variable to fix build with llvm 13Jonathan Gray
ok jca@ naddy@
2021-12-11Change compatible string to something that makes more sense.Mark Kettenis
2021-12-11remove unused variable to fix build with llvm 13; ok jca@Christian Weisgerber
2021-12-11Add support for interrupts represented by ACPI PCI Interrupt Link Devices.Mark Kettenis
This makes PCI interrupts work on QEMU's SBSA target. ok patrick@
2021-12-11Thanks to the reverse engineering efforts by Hector Martin, we now knowMark Kettenis
that we can controll the CS# pin directly from the SPI controller itself. Add support for this as future device trees will probably use this mode instead of explicitly specifying a "cs-gpios" property. ok patrick@
2021-12-11Attach apldart(4) early.Mark Kettenis
2021-12-09Make the clockpad work in "raw" mode.Mark Kettenis
ok patrick@
2021-12-09Fix cpuid leaf clamping to let through cpuid(0x15) when we have anPhilip Guenther
invariant TSC and report that correctly in the guest's cpuid(0).eax prompted by debug messages in report from Josh Grosse (josh(at)jggimi.net) ok mlarkin@
2021-12-09Add aplpmgr(4), a driver for the power management controller found onMark Kettenis
various Apple SoCs. ok patrick@
2021-12-09We only have one syscall table: inline sysent/SYS_MAXSYSCALL andPhilip Guenther
SYS_syscall as the nosys() function into the MD syscall entry routines and the SYSCALL_DEBUG support. Adjust alpha's syscall check to match the other archs. Also, make sysent const to get it into .rodata. With that, 'struct emul' is unused: delete it and all its references ok millert@
2021-12-07Delete an #if block that dates from rev 1.1 and hasn't been enabledPhilip Guenther
in those 20 years. We're unlikely to take the macppc pmap in the direction where it would apply. ok kettenis@
2021-12-07Add missing kernel unlock in error path.Anton Lindqvist
ok dv@ Reported-by: syzbot+c773ba1ce9b2d259d27f@syzkaller.appspotmail.com
2021-12-06Start to delete emulation support: since we're Just ELF, makePhilip Guenther
copyargs() return 0/1 and merge elf_copyargs() into it. Rename ep_emul_arg and ep_emul_argp to have clearer meaning and type and eliminate ep_emul_argsize as no longer necessary. Make sure ep_auxinfo (nee ep_emul_argp) is initialized as powerpc64 always uses it in setregs(). ok semarie@ deraadt@ kettenis@
2021-12-06Implement DMA address translation for "raw" loads as well.Mark Kettenis
ok patrick@
2021-12-06Implement DMA address translation for "raw" loads as well.Mark Kettenis
ok patrick@
2021-12-06zero correct var in cpu_dump()Jonathan Gray
ok guenther@ deraadt@
2021-12-04vmm(4): reload vmcs after possible sleep pointsDave Voutila
Guests running on Intel hosts that sleep on a lock might have their process moved to another cpu core by the scheduler. If this happens, the VMCS needs to be remotely cleared and locally loaded otherwise vmx instructions will fail. vmd(8) will receive a failure code and abort the guest. This change stores the current (last) cpu the process was on before attempting a function call that may sleep (e.g. uvm_fault(9)). Upon function return, perform the VMCS dance if needed. Tested with help from Mischa Pieters. OK mlarkin@
2021-12-03- support I2C connected PMIC, add "early 1" to sxitwi.SASANO Takayoshi
- support axppmic via iic ok kettenis@
2021-12-01Fix booting from an IDE block device on the Sun Blade 100. ApparentlyMark Kettenis
writing to disk using the Open Firmware interfaces is buggy and causes corruption of the disk. While it isn't entirely clear what versions of Open Firmware are affected, but it seems to only affect IDE drives. So if we detect an IDE drive, disable writing to it. This results in a small lose of bootloader functionality (bsd.upgrade loop prevention and flagging /etc/random.seed re-use) but that is better than losing the ability to run OpenBSD at all. Based on a diff by Ted Bullock (who did all the hard work of debugging this and coming up with a viable fix). ok deraadt@
2021-11-30add ixl(4)Theo de Raadt
2021-11-30enable uhid/fidoTheo de Raadt
from Ashton Fagg
2021-11-29vmm(4): bump remote vmclear spinout ticksDave Voutila
Older/slower hosts could easily hit the cap under load. Set it to the same value we use in mplock_debug. ok mlarkin@
2021-11-27free() with nullptr is OK, but not if the size is unitialized, and theTheo de Raadt
fail label is reachable before the sizes are known.
2021-11-27stop building kernels with -Wno-uninitialized on clang archsJonathan Gray
this hides real problems that could be found at build time ok kettenis@ visa@, ok sashan@ on amd64/i386
2021-11-26The IORT table usually only contains single mappings. While on the LX2K therePatrick Wildt
is a non-single mapping for the networking subsystem, we don't yet have support for it and apparently Linux has trouble with it as well. So for now we can remove the code, because it uses an uninitialized variable and there's no easy way to fix it without re-thinking the concept. The code got there in the first place because it's a copy of the same pattern in our other IOMMU code. ok jsg@
2021-11-26avoid clang -Wsometimes-uninitialized warning when DDB is not definedJonathan Gray
ok kettenis@ visa@
2021-11-26avoid clang -Wsometimes-uninitialized warning when MULTIPROCESSOR is notJonathan Gray
defined feedback from millert@, ok kettenis@, mips64 diff from and ok visa@
2021-11-23limit a variable to the scope inside #ifdef where it is usedTheo de Raadt
2021-11-22Enable iicmux(4) and pcyrtc(4).Mark Kettenis
2021-11-22Hack alert! Apple M1 systems still don't work with an MP kernel.Mark Kettenis
In order to make progress (and protect myself from things dumping cores left and right when I run sysupgrade) abuse the hw.smt mechanism to only schedule processes on the primary CPU. ok deraadt@, patrick@
2021-11-22vmm(4): copyout guest state on VM_EXIT_NONEDave Voutila
Partly related to a bug reported by kn@. We should be copying out the guest exit state (including registers) when we succesfully return from the vcpu run loop even if we don't require an emulation assist from userland/vmd(8). This condition was introduced when I removed the use of yield() and instead exit the kernel if the scheduler says we've hogged the cpu. ok mlarkin@
2021-11-19Correct the CPUID() and CPUID_LEAF() macros to not include a trailingPhilip Guenther
semicolon ok deraadt@
2021-11-14Make sure efiboot is built with RELA/REL relocations and not RELR,Philip Guenther
as self_reloc.c only handles the former. ok deraadt@ kettenis@
2021-11-13Catch up with (proposed) Linux device tree bindings.Mark Kettenis
2021-11-12Add support for controlling keyboard LEDs.Mark Kettenis
ok patrick@
2021-11-12Use a mutex to lock the bus such that we can safely access the bus fromMark Kettenis
interrupt handlers and process context. ok patrick@
2021-11-11The Apple DART has a nifty feature that allows us protection of subrangesMark Kettenis
of a page with a granularity of 32-bit words. Use this to expose just those parts of memory to devices that we want the device to see. This means that handing down a small mbuf to a network card driver no longer gives the hardware access to other mbufs in the same page. It turns out that bge(4) always does aligned 64-bit access to memory though. So round up/down to the nearest 64-bit boundary to prevent triggering an IOMMU fault. ok patrick@
2021-11-11Retire switch(4) it never really was production ready and the OpenFlowClaudio Jeker
API implemented is a deadend. OK akoshibe@ yasuoka@ deraadt@ kn@ patrick@ sthen@
2021-11-09Add gpiokeys(4) for arm64Klemens Nanni
This driver handles events triggered by GPIO keys such as lid status and power button. OK kettenis