Commit Graph

9649 Commits

Author SHA1 Message Date
David Karoly af90bfd3bb boot/efi: introduce arch_convert_kernel_args
Change-Id: Iabb321564d6733c6cf481ec2548fa287e308ae89
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4796
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-12-17 08:58:57 +00:00
X512 8ca0f03d0c riscv64/smp: Implement multi-processor support
* Working under qemu smp 1,2+
* Working on SiFive Unmatched
* x86_64 efi not broken by smp_boot_other_cpus change

Change-Id: I32ebc17913e46ed082be9ade8f56448bbf12f16e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4705
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2021-12-12 15:35:24 +00:00
David Karoly 354655e136 boot/efi/dtb: implement interrupt controller detection
Change-Id: I045a94c5bcb7c16297bc6fdd1fa2981e5b3f3a62
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4756
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-12-07 10:58:24 +00:00
Jérôme Duval 09a8f74d70 intel_extreme: add PCH definitions for some platforms
Change-Id: Id91f8fb526825cc62cd4288bee4a6d08dfd6654a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4764
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2021-12-07 08:32:49 +00:00
Rudolf Cornelissen 9ef22aa9d7 intel_extreme:DP links on sky- upto/incl coffeelake are now done (refclk detection added) 2021-12-07 00:42:42 +00:00
Rudolf Cornelissen c80ea54975 intel_extreme: PLLs post skylake work differently again. Refclk update. 2021-12-05 16:56:15 +00:00
Rudolf Cornelissen d60c7e010c intel_extreme: for gen9.5 added new portF to DDI scan. add ID dump in kerneldriver. 2021-12-05 12:47:05 +00:00
Rudolf Cornelissen 77b2dd17df intel_extreme: added DDI link colordepth detection, may fix ticket #17439 2021-12-04 23:24:50 +00:00
Augustin Cavalier 3c2597393c kernel/int: Allow arch_int_assign_to_cpu to make its own decisions.
For now this is used on RISCV64 to indicate that interrupts will always
be on CPU 0. However, in the future, some architectures may want
or require interrupts to be "steered" in various ways, and this
also paves the way for that.

Change-Id: Iec79870cf5c4898d102d0e624de19602271ae772
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4721
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2021-12-03 22:36:47 +00:00
David Karoly 1f46427d16 kernel/arch/arm: introduce virtual_ranges_to_keep
Change-Id: I36b8b871a103f2be87c600fc0b0a12f7ceff0ae4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4743
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-12-02 08:16:31 +00:00
David Karoly a722fbfc45 kernel/arch/arm: enable 8250 generic and OMAP UART drivers
Change-Id: I45396eada2e9088b27df7fb9522d07e8ac223fd5
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4741
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-12-02 08:16:31 +00:00
Jérôme Duval 3fedf64872 intel_extreme: enable KabyLake
Change-Id: I81d04fdf8305efcc9250cfb975dd3466ebcb4058
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4740
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2021-11-30 08:06:56 +00:00
Kacper Kasper 66aae93087 intel_extreme: enable CoffeeLake
Change-Id: Id73c88d0815259fa7a8027f757ac430818492b1e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4739
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2021-11-30 08:06:56 +00:00
Augustin Cavalier 02077ffc42 kernel/condition_variable: Atomicize ConditionVariableEntry and drop the lock.
Before 2019, the entire ConditionVariable system was "giant"-locked:
that is, there was a single global lock that all ConditionVariable
and ConditionVariableEntry operations had to pass through. This of
course was not very performant on multicore systems and when
ConditionVariables see significant use, so I reworked it then to have
more granular locking.

Those patches took a number of attempts to get right, as having two
objects in separate threads that can each access the other not turn
into a deadlock or use-after-free is not easy to say the least,
and the ultimate solution I came up with erased most of the performance
gains I initially saw on the first (partially broken) patchsets.

So I have wanted to revisit this and see if there was a better way
even since then. Recently there have been a few reports of
ConditionVariable-related panics (apparently double unlocks),
notably #16894, and so that was reason enough to actually revisit
this code and see if a better solution could be found.

Well, I think I have come up with one: after this commit, Entries
no longer have their own lock, and instead accesses to Entry members
are almost always atomic; and there is now a case where we spin inside
Variable::_NotifyLocked as well as one in Entry::_RemoveFromVariable.

This leads to somewhat simpler code (no more lock/unlock dance in Notify),
though it is significantly more difficult to understand the nuances of it,
so I have left a sizable number of comments explaining the intricacies
of the new logic.

Note: I initially tried 1000 for "tries", but on a few instances I did see
the panic hit, strangely. I don't think the code that is waited on can
be reasonably reduced any further, so I have just increased the limit to
10000 (which is still well below what spinlocks use.) Hopefully this suffices.

Quick benchmark, x86, compiling HaikuDepot and the mime_db in VMware, 2 cores:
before:
real    0m23.627s
user    0m25.152s
sys     0m7.319s

after:
real    0m23.962s
user    0m25.229s
sys     0m7.330s

Though I occasionally I saw sys times as low as 7.171s, so this seems
to be at least not a regression if not a definitive improvement.

Change-Id: Id042947976885cd5c1433cc4290bdf41b01ed10e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4727
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2021-11-30 02:18:27 +00:00
Kacper Kasper fe9ab0f353 intel_gart: add support for Gen8+ GPUs
Change-Id: I8b84e278f33542c359fc0d783f571e06ebc89b2a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4737
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Rudolf Cornelissen <rudhaiku@gmail.com>
2021-11-29 18:14:21 +00:00
Rudolf Cornelissen 03ed104900 intel_extreme: enabled all known skylake gfx cards since they are pgm'd now 2021-11-26 23:52:15 +00:00
Rudolf Cornelissen 39e05c7d01 intel_extreme: skylake PLL works, all outputs fully functional. 2021-11-25 22:41:48 +00:00
Augustin Cavalier 2532a28785 Avoid using unions for LongDirEntry.
GCC still assumes that the dirent has no data past the end for some
scenarios here and still mis-optimizes things. Therefore, drop the
usages of unions altogether, and instead use a casted character array.

Additionally, use B_FILE_NAME_LENGTH for the array, not B_PATH_NAME_LENGTH,
and make sure to add 1 for the NULL terminator.
2021-11-23 16:36:18 -05:00
Augustin Cavalier 8be37ed439 kernel/smp: Avoid casting spinlocks, which are structures.
The lock entry is the first thing in the struct, so this is a no-op
change, but it is safer to do in case of changes, of course.

Spinlocks have been structures for quite a long time, so this was
probably just missed in the conversion.
2021-11-23 13:52:44 -05:00
Augustin Cavalier ba3ee26af0 WindowInfo: Use char[0] for FLA instead of char[1].
This is a private structure, so despite being an ABI break,
it should not cause any problems.
2021-11-23 13:50:45 -05:00
Rudolf Cornelissen efde34c2fc intel_extreme: add haswell/skylake PLL calcs, no functional change yet. 2021-11-22 11:14:36 +00:00
Jérôme Duval 4106e3f146 kernel/x86: rework get_frequency_for
we don't sample if the last sample is too recent and use the cached result.

Change-Id: I17ed29bda7fe7276f1a4148b3e1985c9d32ae032
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4101
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-11-22 07:21:04 +00:00
Jérôme Duval 7c2c355f17 kernel: add frequency in cpu_info
use this in sysinfo.

Change-Id: I270ef1ab18c27c4804cb0cca2cb5088a17162636
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3214
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-11-22 07:20:25 +00:00
Augustin Cavalier afcfd3c5d5 BeBuild: Remove B_ALWAYS_INLINE.
This file should ideally contain only those things needed
across all system headers, even POSIX ones, and all other
declarations (B_* ones especially) should go in SupportDefs.h.
However, as nothing but riscv64 uses this right now, I've just
moved it to there.
2021-11-18 16:35:05 -05:00
Augustin Cavalier 7db2616c44 dirent: Use an actual flexible-length array for d_name.
GCC 11 treats [1] as a fixed-length array and not a flexible-length
array, and so some things that used direct strcmp("..", ent->d_name),
for instance, would be optimized out as being always unequal,
which was the cause of #17389. Using a real FLA informs GCC that
there is going to be more than one byte of data, and thus this
fixes that bug.

BeOS used [1] and not [0], possibly because it had to deal with
compilers (MetroWerks? Early GCC2?) that did not support FLAs.
GCC 2.95 does, using [0], and GCC 4 does, using [], so we can go
with that here.

(I did try using [0] for both, which seems to be OK with GCC 11,
but GCC 8 throws errors when d_name is dereferenced directly
as being-out-of-bounds. So, we have to use the #if here and give
newer GCC the [] syntax and not [0] to avoid that problem.)

The real question probably is whether or not we should backport
some variant of these changes to R1/beta3, as software at HaikuPorts
very well may run in to the same issue. (The alternative workaround
is to compile with -O1 and not -O2 for any affected software.) But
maybe this is an argument for keeping with the beta4 schedule of
this coming January...
2021-11-18 16:34:03 -05:00
Augustin Cavalier 9d242fb955 file_systems & Tracker: Do not assume sizeof(dirent) contains 1 byte for the name.
At present, it does, but that is an oddity we have preserved from BeOS
that the next commit is going to remove. (This commit thus wastes 1 byte
without the following one.)

Most changes are pretty straightforward: only a +1 is needed,
and a few removed from sizing calculations. Some filesystems like UDF
originally passed back the length with the \0 included, so they have
been adjusted further. UFS2 had some other sizing problems which are also
corrected in this commit.
2021-11-18 16:24:04 -05:00
Augustin Cavalier 8f03af00f8 Storage: Rework LongDirEntry to be a union.
Our dirent structure is "slim": it has a flexible-length array at the
end which must be allocated to whatever size the consumer wants. However,
we use [1] there and not [0] or [], which meant GCC thought it was not
a flexible-length array, and so it optimized various string accesses
that it assumed must be always false. Among these was BDirectory's
check for "." and "..", and so that resulted in infinite loops.

When changing our dirent structure to a proper FLA instead of [1],
GCC then throws errors on LongDirEntry as it has data "after" the
FLA; which is what we want, but there is no way to tell GCC that.
So now we use a union instead, which is the proper way to statically
allocate a FLA.

This is part of #17389, but the real fix requires changing our dirent
structure, which is coming in a separate commit.
2021-11-18 16:00:23 -05:00
Augustin Cavalier 9cc1718212 libbe_build: Fix build on non-Haiku platforms.
Probably should have tested that before pushing.
2021-11-18 15:42:17 -05:00
Augustin Cavalier ec21dc91b1 libbe_build: Synchronize Directory.cpp with the main one.
The set_dir_fd code appears to be libbe_build specific, so that
and accompanying logic is preserved.
2021-11-18 12:13:47 -05:00
Augustin Cavalier 28c8a16a5a libbe_build: Synchronize Node.cpp with the main one.
Mostly formatting changes with a few minor bugfixes it appears.
2021-11-18 11:18:49 -05:00
Augustin Cavalier e4f18add74 Game & Print Kits: Fix GCC 11 warnings. 2021-11-17 18:45:58 -05:00
Augustin Cavalier 7ec1bedeed features.h: Define _DEFAULT_SOURCE when _GNU_SOURCE is defined.
As suggested by PulkoMandy. This was done before my commits yesterday,
but those just reverted patches that had only been in since May,
so it's not clear how much this is actually needed. Nonetheless
it seems like the more correct thing to do.
2021-11-17 13:55:50 -05:00
Augustin Cavalier 1e541d3127 stdlib.h: Remove guards around aligned_alloc.
While FreeBSD and glibc feature-guard it, they also feature-guard
a lot of other things that we don't, and musl does not guard it,
so it seems more than safe enough to leave it unguarded.

Fixes compilation errors with GCC 11. (The other possible solution
was including features.h in more places, but this seems simpler.)
2021-11-16 15:13:29 -05:00
Augustin Cavalier 3bdd837e4e BeBuild: Expand compatibility to GCC 12.
Since we are currently in the process of upgrading to GCC 11, it makes
sense to change this header before we actually need to.
2021-11-16 15:12:58 -05:00
Augustin Cavalier 68a13ed5c3 features.h: Clean up ISOC11 definitions.
* Do not define it merely when _GNU_SOURCE is defined, that is not needed.
 * Scale back __cplusplus check to 201103L, just like the BSDs do.
2021-11-16 15:11:44 -05:00
Rudolf Cornelissen ae7d733d42 intel_extreme: skylake/DDI. all displays can set resolution now, no refresh on digital panels yet (DPLL still missing) 2021-11-16 00:39:49 +00:00
Rudolf Cornelissen 0eb2bf0e66 intel_extreme: skylake/DDI improvements. no resolution changing possible yet (missing DPLL code yet) 2021-11-14 23:16:44 +00:00
Coldfirex 2ca1376080 Mass updating of OpenBeOS text to Haiku
No functional code altered.

https://dev.haiku-os.org/ticket/17197

Change-Id: I75cc74f6be0ad968fd77c31fbe5b0f650a6fe9e0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4364
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-11-07 10:00:35 +00:00
Alexander von Gluck IV 4b5c7fe7e1 system/boot: add optional alignment to kernel_args_malloc
* A few things need alignment, instead of forcing them all
  to align themselves, support alignment of the kernel_args
* Default of 1 is "no alignment"

Change-Id: Iff05dcec8adaa963c8444d701464ea11616062f6
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4698
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-11-07 09:58:15 +00:00
Alexander von Gluck IV c9d6d52b03 libfdt: Upgrade to 1.6.1 plus a few commits
* Catch errors and report them in bus parsing code
* Align the FDT kernel_arg to 8-bytes
* we still choose BSD-2-clause :-)

Change-Id: If2a88b7f131025ff1c1a2d903ed52f039e5bbcb5
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4694
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2021-11-07 09:58:15 +00:00
Rudolf Cornelissen 661732341f intel_extreme: haswell and skylake DDI EDID support added, modesetting not finished yet. 2021-11-02 20:04:37 +00:00
Adrien Destugues 4492fde7bf intel_extreme: reduce use of display_mode where display_timing is enough
In most cases we don't need to use the complete display_mode struct and
we just need the timings. This will avoid future confusion between the
virtual width/height and the actual display timings, if we implement
scrolling someday.

Change-Id: I6c4430b84130b956a47ea0a01afb0843f5a34fd2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4665
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2021-10-27 14:33:46 +00:00
Augustin Cavalier a89813083e ZstdCompressionAlgorithm: 22 is now "best" in libzstd.
Ideally we would use ZSTD_MAX_CLEVEL, but we cannot use zstd headers
in here...
2021-10-26 16:47:50 -04:00
Rudolf Cornelissen 994794f2d4 intel extreme: skylake sets color, base and address, no resolution and refresh yet 2021-10-23 17:13:43 +00:00
Augustin Cavalier f638102196 Remove conditions for HOST_PLATFORM=msys.
It never really worked beyond the most basic of commands
and required a lot of hacks, and these days WSL should be used instead.
2021-10-22 17:03:44 -04:00
Augustin Cavalier e8ab10abd6 Fix return type of video_text_console_init. 2021-10-22 15:10:53 -04:00
Augustin Cavalier 5e43707307 bootloader: Refactor console functions into the VFS ConsoleNode class.
This way it becomes much easier to write multiple console implementations
in one bootloader.

Tested for bios_ia32 and efi.

Change-Id: I67134f5c3de109b15d46898864ba7f51c6592afc
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4642
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2021-10-22 19:02:06 +00:00
Augustin Cavalier 0d66d8d486 boot_loader: Add a video_text_console for potential use by bootloaders.
This uses the frame buffer console that KDL uses. It needs some work,
though, as the frame_buffer_console colors system is not quite compatible.
2021-10-22 10:43:27 -04:00
John Scipione 02ad92185d Network: Sort network menu items w/o deleting
* Delete dropped out networks.
* Add in newly discovered networks.
* Add static (aka class) compare method to WirelessNetworkMenuItem
  that is used to sort items by signal strength descending.

Add == operator to wireless_network struct to determine if
existing items have a known network attached.

Remove the non-network items from the menu, save them, sort
network menu items, then add non-network items back into the
menu.

Update NetworkStatus preflet to use same compare method as Network
preflet. signal_strength_compare function had a bool return value
instead of int which worked to sort items the first time, but does
not work on successive compares.

By not deleting and recreating the menu items each Pulse(),
the Network preflet no longer crashes on update. The menu flashes
on update still but doesn't crash.

Fixes #12024

Change-Id: Ie5b22cea4e66350b9c5df8e3b8de266ede50ad6d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4243
Reviewed-by: John Scipione <jscipione@gmail.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
2021-10-22 08:12:05 +00:00
John Scipione 0a53cbb3b9 BMenu: Add SortItems(), SwapItems() and MoveItem()
... methods which call the respective methods in BList.

These convinience methods allow you to sort a menu of menu items
via a compare function, swap two menu items, or move a menu item
to a new index. Update items layout if menu is open.

Previously there was no easy way to rearrange menu items in a menu.

Change-Id: Ice3d6e5404e895196d8bd32d696dce7c55bd72d4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4296
Reviewed-by: John Scipione <jscipione@gmail.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2021-10-22 08:12:05 +00:00