Commit Graph
7068 Commits
Author SHA1 Message Date
Jérôme Duval 08bc0cc9ca device_manager: add find_child_node
to find a node in the hierarchy.

Change-Id: Iee858f21ce134569bf25fccbef9fe18ea8787e9d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2419
Reviewed-by: Jérôme Duval <[email protected]>
2020-04-10 11:25:39 +00:00
Jérôme Duval 39a7a69b07 boot_loader: add missing stubs
u_boot build still broken

Change-Id: Iba93ce7bf0d5c30a95ff98420a2e419eb28bb398
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2412
Reviewed-by: Adrien Destugues <[email protected]>
2020-03-23 18:29:56 +00:00
Jérôme Duval 0dbbeede37 kernel: map signal processing/data acquisition in the device manager
Change-Id: I1ef8b1d2c26a7dcf04956e6ca3c591d480c881a0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2387
Reviewed-by: Adrien Destugues <[email protected]>
2020-03-23 15:38:52 +00:00
Jérôme Duval 11f8b65a79 boot_loader: load intel microcode update data file
Previous version of the patch was broken by the EFI refactoring.

Change-Id: I6dd125100b22b2461c531bfd8f81b3dd28e2b751
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2409
Reviewed-by: Jérôme Duval <[email protected]>
2020-03-23 15:33:34 +00:00
waddlesplash 6f857fa9fb Revert "boot_loader: load intel microcode update data file"
This reverts commit a732059324.

It broke the build on most boot platforms (including EFI.)
2020-03-23 10:09:21 -04:00
Jérôme Duval a732059324 boot_loader: load intel microcode update data file
Change-Id: I323a57cc0b1f05ad7b60b6a141d068a3e618ee4d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2263
Reviewed-by: Adrien Destugues <[email protected]>
2020-03-23 06:16:28 +00:00
X512 39be4f89f5 Fix clang warning string-plus-int
Clang message: error: adding 'size_t' (aka 'unsigned long') to a string
does not append to the string

Change-Id: Ice854f584e92917aca6821d5ec2352fc4e38f2f0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2395
Reviewed-by: waddlesplash <[email protected]>
2020-03-23 01:30:23 +00:00
X512 668ecf4f09 Kernel: fix operator priority warning
Pointed by clang.

Change-Id: I16aa242c94abdf1fa22c4651e63c8c236e6c1a82
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2393
Reviewed-by: John Scipione <[email protected]>
2020-03-23 01:30:23 +00:00
X512 1e3d4cf78c Kernel: remove dead code
area->name is a fixed array inside struct, not pointer, so it should
be never be NULL.

Pointed by clang.

Change-Id: Ic8930450cb8461eef158bc854f214eb47d92ce22
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2391
Reviewed-by: Jérôme Duval <[email protected]>
2020-03-23 01:30:23 +00:00
X512 77f5125586 Fix double extern "C" pointed by clang.
Change-Id: Ie595dd99d01149868a4f60354ef89fa861cf856b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2389
Reviewed-by: waddlesplash <[email protected]>
2020-03-23 01:30:23 +00:00
PulkoMandy 18da5c3042 Bootloader log: check for buffer overflow
We could overflow the in-memory log. The bounds check was there for BIOS
already but was missing in EFI and openfirmware. Could fix some crashes
when there is lots of loging.
2020-03-21 18:30:25 +01:00
PulkoMandy 99195e3c36 bootloader ethernet: fix tracing 2020-03-21 18:30:25 +01:00
Augustin Cavalier cbb517abfd kernel/vfs: Replace the mount mutex with a rw_lock.
Since the entry_cache operations go through the mount lock,
this may considerably speed up parallel entry cache operations.

Change-Id: Ib2f841e288eb593ee3f795922103459c77764c22
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2362
Reviewed-by: waddlesplash <[email protected]>
2020-03-18 21:54:38 +00:00
PulkoMandy a207d7b35b bootloader: reduce verbosity
- Disable tracing where it's not needed by default
- Convert some drpintf to TRACE statements
- Comment some dprintf out completely in files that don't have a TRACE
  macro.

Change-Id: I1f6062bce74bcf1dbf77bf7bccadeeb12a4df46c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2370
Reviewed-by: waddlesplash <[email protected]>
2020-03-16 22:33:13 +00:00
PulkoMandy ae5a068f62 openfirmware: implement the in-memory log
We should probably make this code more platform-generic, the
implementation is very similar to the EFI one.

Change-Id: I17c9db933bfc2a81c96816dd6348d2d0c9627951
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2369
Reviewed-by: waddlesplash <[email protected]>
2020-03-16 22:33:13 +00:00
PulkoMandy 442a131da7 bootloader: additional keyboard commands
In the boot menu, tab cycles between the menu items.

In the pager for logs, j and k allow to scroll the log (vim style keys).

These allow using the pager and menu on Sun machines, where Openboot
does not manage the keyboard arrow keys. It may be possible to get more
low-level input from the keyboard openboot device, but I think it is not
worth the effort for now, especially as we would need different handling
for the local keyboard and for serial ports.

Change-Id: I5fe74eb9f7a952ae49ae3c8a6bfae6ba4a16ae07
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2368
Reviewed-by: waddlesplash <[email protected]>
2020-03-16 22:33:13 +00:00
PulkoMandy 9ebce09880 openfirmware: alternate implementation for console
If I understand the openboot specification correctly, we should not call
the forth words directly. Instead, we should rely on the
terminal-emulator package to parse ANSI escape sequences and manage the
display for us.

Unfortunately, the ANSI parser is very limited, many sequences don't
work, including the ones for colors. But we can at least have inverse
video, which is good enough to let the menu show.

I think the PowerPC console can be modified to use the same code, at
least partially. So for now I'm keeping this code in a cross-plaform
file.

Change-Id: Ie77b9ddcc18acb735c0d77cb574e28fbabd266e6
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1989
Reviewed-by: waddlesplash <[email protected]>
2020-03-16 22:33:13 +00:00
Augustin Cavalier 65920cacc0 kernel/vm: Validate user addresses do not cross the kernel/user boundary.
This protects against malicious programs trying to steal/overwrite
kernel memory by overflowing user buffers.

Note that this constitutes a behavioral change to user_strlcpy:
previously, address overflows on the "source" side would either
copy less data, or copy some data and fail anyway. Now, address
overflows on either side will always fail before any data is
copied at all.

Change-Id: I01d8b22672ab3758a9dd87b521af6fedd0487417
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2361
Reviewed-by: Adrien Destugues <[email protected]>
2020-03-16 13:11:45 +00:00
Jérôme Duval 56bb1bd5c9 kernel: load cpu microcode update if loaded by the bootloader
add optional fields for microcode in kernel_args.

Change-Id: Ic5fb54cf6c9f489a2d1cdda00f63980c11dcdaeb
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2264
Reviewed-by: Adrien Destugues <[email protected]>
2020-03-16 06:41:16 +00:00
PulkoMandy edfce7b327 openfirmware: fix dma-alloc for sparc
The dma-alloc method is in the parent node (the PCI bus), not directly
in the network device.

Change-Id: I18f6a9333f3afa78033042e75a86b00872515f2c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2359
Reviewed-by: waddlesplash <[email protected]>
2020-03-15 19:54:01 +00:00
PulkoMandy 0f33dfcce5 openfirmware: fail if IP address can't be found
Sending packets from 0.0.0.0 doesn't work quite right, so better admit
we failed.

Change-Id: Iddece4a7269abbdd8e93f0cbbc9a9e43fcbe8a69
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2358
Reviewed-by: waddlesplash <[email protected]>
2020-03-15 19:54:01 +00:00
PulkoMandy 9a515368b7 openfirmware: another way to find the MAC address
Of course Sun and Apple didn't put it at the same place...

Change-Id: I974caff7335bb25a0e8dd4f7da8bdb9a737d011e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2357
Reviewed-by: waddlesplash <[email protected]>
2020-03-15 19:54:01 +00:00
PulkoMandy 4e134b546a openfirmware: remove real_time_clock.
It is used only in the TCP loader to initialize a random TCP source port.
Since the RTC device does not exist on sparc, this is not portable. A
simple solution is to use a non-random source port, maybe based on the
powercycle count or something like that. For now, I don't need the TCP
loader, so I'll just disable this.

Change-Id: I6e279a77bb90a8b8b989f06dd9fb256156f71635
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1988
Reviewed-by: waddlesplash <[email protected]>
2020-03-15 19:54:01 +00:00
PulkoMandy 5424c3a22e sparc: workaround for Netra T1 105
The address-size property is missing, but we don't really need it.

Change-Id: Iff3de89c811d16a263eadf796a0e6eb157dbe18b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2356
Reviewed-by: waddlesplash <[email protected]>
2020-03-15 19:54:01 +00:00
PulkoMandy 6d929a001e sparc: fix boot MMU code
Apparently it worked by luck only on the Ultra60. Physical addresses for
openfirmware are on two cells (128 bits!) and we were passing only one
cell, of course this wouldn't go well. On the Ultra5 it ended up having
the heap point to unused space besides the RAM, so it was mostly reading
random data from there.

Change-Id: I4f9010013fe91a582e5daa83e6bf458703adba2b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2350
Reviewed-by: waddlesplash <[email protected]>
2020-03-15 19:54:01 +00:00
PulkoMandy 5f86d837c0 openfirmware: fix of_seek for 64bit systems
The position is on 2 cells even on 64bit systems.

Change-Id: I97f4e3fc02734c548ed23445a917a894ff548379
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2351
Reviewed-by: waddlesplash <[email protected]>
2020-03-14 19:37:59 +00:00
Augustin Cavalier 74592da9a0 headers: Remove libroot_lock.h.
Not used (the one file that included it did not actually use it),
and no longer needed with the introduction of user_mutex.
2020-03-14 15:18:01 -04:00
Alexander von Gluck IV 4f732f12a1 efi: drop fdt and fdt drivers on arm
Change-Id: I3a11e7b3aae043deb72a2dd0de543cb488d75eb6
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2336
Reviewed-by: Alex von Gluck IV <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
2020-03-10 13:10:48 +00:00
Alexander von Gluck IV 9775b1fb59 boot/efi: Revert gFDT portion of hrev53960
Change-Id: I6337aea8054840f36d41ac51cf8856eb04c0e6ba
2020-03-09 14:21:43 -05:00
Alexander von Gluck IV 9b91a310bf system/boot/efi: Tweaks to get arm efi further
* Store gFDT as a global in efi to appease non-x86
* gFDT might need refactored out of fdt bus_manager?

Change-Id: I3fb1be04ceb696677aa5476381786c36adc6fc0a
2020-03-09 11:34:47 -05:00
Alexander von Gluck IV 40c4917414 riscv64: Add missing linker scripts, fix some kernel dependencies
Change-Id: Ic63b0bbdddda629bb9bc76017a806746c983023e
2020-03-09 10:19:21 -05:00
Augustin Cavalier 1728b8c777 kernel: Rework ConditionVariableEntry destruction.
It is no longer an error to destroy a ConditionVariableEntry
that is still attached to a ConditionVariable; it will
now be implicitly detached in that case.

This makes ConditionVariableEntrys much eaiser to use
from an API standpoint.

Change-Id: I03c676d3a198aa885de733d3e1729b15f80de031
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2301
Reviewed-by: waddlesplash <[email protected]>
2020-03-07 21:27:05 +00:00
Alexander von Gluck IV a8cd19b641 system/boot: Begin factoring gFDT out of non-u-boot code
Change-Id: Ibe010c6c7ed71a20fc852ce6c72c6f32b98dfad2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2292
Reviewed-by: Alex von Gluck IV <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
2020-03-04 14:24:26 +00:00
Augustin Cavalier 58dcc29b6d runtime_loader: Fix memory leak in init_dependencies.
get_sorted_image_list allocates initList even if "count" winds up
being 0, so we need to free it in this case also.

Spotted by Coverity.
2020-03-01 18:18:47 -05:00
Alexander von Gluck IV 48064fbc41 system/boot: Unify spin design, add missing symbols to asm/ld
Change-Id: I1dd98a2243d498ec1c827f7a60385237d12a0d39
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2283
Reviewed-by: Alex von Gluck IV <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
2020-02-27 16:04:23 +00:00
Alexander von Gluck IV 82a7c7395c efi/arm: Begin stubbing out the essentials, add fdt library
* We *might* no longer need FDT knowledge in the bootloader?
* For now though, arm sources reference gFDT, so we need it.
* Need to move away from lazy gFDT and store in arch_kernel_args.
  (which is next and will be a larger commit)

Change-Id: I77cce0fc645143b78a7fd9f50ac8b96c97b5c862
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2268
Reviewed-by: Adrien Destugues <[email protected]>
2020-02-23 18:41:28 +00:00
Alexander von Gluck IV 71680f7b7d efi: Cleanup arch_mmu, drop extra arch_timer.h
Change-Id: I0d6d2f8db2bc86c08d5ba2648f1cf46d85b54a5e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2267
Reviewed-by: Adrien Destugues <[email protected]>
Reviewed-by: Alex von Gluck IV <[email protected]>
2020-02-22 22:15:08 +00:00
Alexander von Gluck IV d2986cb6d0 system/boot: More cleanup and shuffling
* arm efi additions
* cleanup some cpu headers which were oddly
  split between efi and bios_ia32
* Move calculate_cpu_conversion_factor over to
  arch_timer since it is timerish, and x86 only
* Drop some duplicated code from efi start. Move
  hpet init code into efi timer/hpet code

Change-Id: Ia4264a5690ba8c09417b06788febc4f572f111ce
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2259
Reviewed-by: Alex von Gluck IV <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
2020-02-22 14:37:45 +00:00
Alexander von Gluck IV 957f468cc1 efi/mmu: ensure sNextVirtualAddress is valid on 32-bit platforms
Change-Id: I1c762410860ac7a27cfc78345de3226e36195aba
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2258
Reviewed-by: Adrien Destugues <[email protected]>
2020-02-21 17:03:27 +00:00
Alexander von Gluck IV 04f1baa771 EFI: Make our haiku_loader architecture agnostic
* This is the bulk of the work. Anything else should be
  minor cleanups and tweaking.
* riscv64 isn't a viable EFI platform yet.. just acting
  as a stand-in to test a non-x86 EFI haiku_loader

Change-Id: Ib03de81e2b562e693987b86d7b4318209fb1c792
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2256
Reviewed-by: Alex von Gluck IV <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
2020-02-21 14:29:22 +00:00
Augustin Cavalier 46ab6b2917 kernel/debug: Zero-initialize droppedEvents.
There is a case where NextBuffer can return B_OK without initializing
droppedEvents, so make sure we do that here.
2020-02-20 12:11:09 -05:00
Augustin Cavalier 5d08e3a5b9 runtime_loader: Combine and correct term function invocations.
In d49942867b (part of hrev52813),
I moved invocation of the TERM_BEFORE/TERM_AFTER functions to
runtime_loader. Unfortunately, I only updated one location where
they should be invoked, and runtime_loader had two.

After this commit, there is one function that they are called from,
which is itself invoked from the appropriate places.

Noted by ttcoder & mmlr in #14047.
2020-02-17 17:07:39 -05:00
Jérôme Duval 073e295aa6 kernel/x86: stores cpu number in TSC_AUX if rdtscp is available
On modern x86, one can use __rdtscp to get the current cpu in userland.

Change-Id: I1767e379606230a75e4622637c7a5aed9cdf9ab0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2248
Reviewed-by: Adrien Destugues <[email protected]>
2020-02-17 17:26:39 +00:00
Jérôme Duval 1a836b9e04 kernel: x86: add some more cpuid flags.
Change-Id: If81c8e38c4e5a8347b5818440a7516298be585bc
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2242
Reviewed-by: Jérôme Duval <[email protected]>
2020-02-14 14:25:43 +00:00
Alexander von Gluck IV d38ba84d44 efi: Add quirks for some unicorn Apple EFI protocols
* grub and linux do the same thing.
* Based on MIT code here:
  https://github.com/0xbb/apple_set_os.efi/blob/master/apple_set_os.c

Change-Id: I299b3721197c5cdd4406d313d8769d4923f7edb4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2239
Reviewed-by: Adrien Destugues <[email protected]>
2020-02-12 14:30:58 +00:00
waddlesplash 90bf90fac5 kernel: Move memset of KPath buffer to after NULL check. 2020-02-10 22:20:19 -05:00
Augustin Cavalier 299279610c kernel/vfs: Add some missing initializations and BStackOrHeapArray.
Part of #14961.
2020-02-09 18:22:57 -05:00
Augustin Cavalier d29d80ebe2 kernel: Initialize allocated KPath buffers to 0.
KPaths are most commonly used in the VFS syscall paths,
and so they are typically user_memcpy'd to/from userland.
In the "to" case this is not really necessary (but it should
be so small of a performance difference as to not matter),
but in the "from" case, we must always clear the buffer
we received from the allocator, so as not to leak information
to userland.

Part of #14961.
2020-02-09 18:17:01 -05:00
Augustin Cavalier 3a63d1efff EFI: Restore the previous logic for BOOT_VOLUME_BOOTED_FROM_IMAGE.
Fixes booting from USB drives on my machine after previous changes.
2020-02-08 16:00:40 -05:00
Augustin Cavalier 7e8263e589 libroot/stdio: Use the proper macros for isnan/isinf. 2020-02-08 12:58:09 -05:00