Commit Graph
100 Commits
Author SHA1 Message Date
Jérôme Duval 4df4b48fc6 configure & build: make use of 64-bit libgcc and libsupc++ for EFI/x86_64
Change-Id: I7636530d927843d155b9d7dada2db4f67c875290
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5139
Reviewed-by: Adrien Destugues <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2022-03-25 09:51:39 +00:00
Jérôme Duval 06c5115cf0 btrfs: check status before the flags
Flags() uses fItem.
should help with #14486

Change-Id: I2593280f92e9843a2d57d66bf9b793748fb14f3d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5141
Reviewed-by: Adrien Destugues <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2022-03-23 15:52:34 +00:00
Jérôme Duval 69cab3d4f6 intel_extreme: remove gen8 interrupt handler on exit
should fix #17535

Change-Id: I09d62090c68bd50494ca168d92d3df7b0c6fd0b4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5138
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2022-03-23 09:29:07 +00:00
Jérôme Duval 168f941be5 kernel/x86_64: align the stack before calling user_debug_pre_syscall
Fixes #17531

Change-Id: Ia406ca15438bb2b432e9ebbe9f6db074f973af95
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5113
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2022-03-21 19:24:20 +00:00
Jérôme Duval c0ab9f51b2 intel_extreme: handle generic DTD block found in the VBT
Change-Id: Id27180b3a33778d4da66ab45b330839ae90c6382
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5110
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
2022-03-17 07:24:11 +00:00
Jérôme Duval d5137e7776 intel_extreme: find VBT in OpRegion version 2.0 and from 2.1
we check the OpRegion version and use the rvda pointer when available.
from 2.1 the pointer is relative.

Change-Id: I64d8aea65368aa3c5597f63a2b96b6a430e04315
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5109
Reviewed-by: Jérôme Duval <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2022-03-17 07:24:11 +00:00
Jérôme Duval f37f79066c intel_extreme: add IDs for Jasper Lake
tested with Acer Swift SF114-34
2022-03-15 16:51:13 +01:00
Jérôme Duval 39dae8ee4e radeon_hd: handle 64-bit PCI BARs 2022-03-14 16:36:23 +01:00
Jérôme Duval 7a5f5dc504 intel_extreme: handle 64-bit PCI BARs 2022-03-14 16:19:51 +01:00
Jérôme Duval d9df712ebc intel_gart: handle 64-bit PCI BARs 2022-03-14 16:19:51 +01:00
Jérôme Duval 86e5dd70f6 glibc: add missing prototypes in wchar.h
fixes #17636

Change-Id: Iab9db947abf9b13d840fb94d2095f1c42f1c4051
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5077
Reviewed-by: Adrien Destugues <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2022-03-09 08:56:41 +00:00
Jérôme Duval 62dbe4d6c9 intel_extreme: map with kernel permissions only. 2022-03-07 12:03:10 +01:00
Jérôme Duval da6065015f intel_extreme: enable power on init
could be necessary on laptop with multiple graphics cards

Change-Id: I38040a4d83be62904b0154d75890ef00b2a878b0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4978
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
2022-02-21 07:42:57 +00:00
Jérôme Duval 50507c9527 PCI/x86: try ACPI Root pointer from boot loader
to find the RSDP, also try to find it in the EBDA area.
Fix trace build.

Change-Id: I94c3fbec9ea97b9187bf6b2c634298f6ae5b413c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4981
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2022-02-19 19:59:54 +00:00
Jérôme Duval b50868d0d6 hda: enable power on init
Change-Id: I96b6084a40270aa8007b916a35e54b1fc3b26b39
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4977
Reviewed-by: waddlesplash <[email protected]>
2022-02-19 08:19:24 +00:00
Jérôme Duval cba67843b0 pci: add set_powerstate and get_powerstate legacy hooks
Change-Id: I827112ffb1a65ada99605671b112d8fd0e6db4b5
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4976
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2022-02-19 08:19:24 +00:00
Jérôme Duval d96e266b70 POSIX: introduce pthread_rwlock_clockrdlock and pthread_rwlock_clockwrlock
will appear in the next version: https://www.opengroup.org/austin/docs/austin_1110.pdf

Change-Id: I83ef657dce54c223e2dc0c207fce17d9238f7115
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4970
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2022-02-18 21:27:06 +00:00
Jérôme Duval e41d4bd102 POSIX: introduce pthread_mutex_clocklock
will appear in the next version: https://www.opengroup.org/austin/docs/austin_1110.pdf

Change-Id: Id4553754494d6594f159356a73534c3cc9900184
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4969
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2022-02-18 21:27:06 +00:00
Jérôme Duval ceb7b7612a POSIX: introduce pthread_cond_clockwait
will appear in the next version: https://www.opengroup.org/austin/docs/austin_1110.pdf

Change-Id: I964968b81533c43ae95380bff79c8ec423d0a665
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4967
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2022-02-18 21:27:06 +00:00
Jérôme Duval a866e2d902 POSIX: introduce sem_clockwait
will appear in the next version: https://www.opengroup.org/austin/docs/austin_1110.pdf

Change-Id: Iee3faf23647aa5244ad316fe1c3d825592483935
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4966
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2022-02-18 21:27:06 +00:00
Jérôme Duval 32f411b9ab hda: detect some audio devices per device ID
as it's possible they use the audio class_sub instead of hd_audio.
* also power up the audio function, this seems required on Jasper Lake.
* tested on Acer Swift 1 SF114-34.

Change-Id: I603018b1b973e7884aa99a58be1c24e568f2d5ae
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4928
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2022-02-04 05:40:11 +00:00
Jérôme Duval f9e868fc8f sdhci: accomodate 64-bit PCI BARs
* init works better with this. it doesn't work yet, but at least the boot
isn't completely borked.
* also fix the infinite loop in SoftwareReset() to timeout after 100ms.

Change-Id: I76dac8360eaf3575adf7d0b3bf3e2b72daeedb21
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4923
Reviewed-by: waddlesplash <[email protected]>
2022-01-31 17:49:19 +00:00
Jérôme Duval 971ad09095 pch_i2c: bail out if BAR isn't configured
Change-Id: If271dc01bade8a5fcf28c7a3e734d573c0008b04
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4883
Reviewed-by: Adrien Destugues <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2022-01-24 17:01:23 +00:00
Jérôme Duval 5f8b4d4d2e framebuffer: handle 64-bit PCI BARs
Change-Id: I634f2a75fe80da99063b98a255d14953cd1a361f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4880
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2022-01-22 20:32:10 +00:00
Jérôme Duval de65a7b6b3 Update pci.ids and usb.ids
Change-Id: I99190ec9ddda1913a8bdb104c463a3c9e9fbbe81
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4879
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
2022-01-22 14:40:08 +00:00
Jérôme Duval a010d38b6e hda: remove invalid product entries for intel
A few invalid ones were introduced in 2071dc2

Change-Id: Icbe5bb4aafd9d6e03ec4175c10eccdb2e65465d7
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4874
Reviewed-by: Alex von Gluck IV <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2022-01-20 05:34:18 +00:00
Jérôme Duval a4c7f6c623 acpi_thermal: fix previous commit
sorry for the noise

Change-Id: Ic696f48b87d017492e054641c2b9c61a910fed0b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4871
Reviewed-by: Jérôme Duval <[email protected]>
2022-01-18 08:59:39 +00:00
Jérôme Duval 9a7f2c2459 Terminal: add support for mouse press/release events in Extended/SGR 1006 mode
fixes #17532

Change-Id: Ic9f19ace5c728b6823caa5ce8ec35dc35d244220
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4867
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2022-01-15 14:18:41 +00:00
Jérôme Duval 0a408dfcad radeon_hd: find out rom size if loading from PCI ROM BAR
* only the rom gets copied.
* tested by smallstepforman in #17377
* fix warnings.

Change-Id: Id4803d5c5a8bcab685f687c6af0292c945813ec6
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4855
Reviewed-by: Jérôme Duval <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2022-01-12 05:39:40 +00:00
Jérôme Duval a7115745f2 POSIX/C11: add timespec_get()
Change-Id: I746e32f3a463bf2c7b03097c625901d54cf2b8eb
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4853
Reviewed-by: Rene Gollent <[email protected]>
2022-01-10 14:46:27 +00:00
Jérôme Duval 80753344fe radeon_hd: fetch vbios from ACPI VFCT when available
check that the correct BIOS is found with the device and PCI ids.
make the allocated rom area bigger like Linux, otherwise page faults occur.

Change-Id: Iae6ff1c8dfd81ea16c20e73d511f9a0a96f9b071
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4844
Reviewed-by: Alex von Gluck IV <[email protected]>
2022-01-03 22:36:20 +00:00
Jérôme Duval 82bdd31024 ext2: the offset still can be equal to the block size with metacsum
fix assert check for _CheckBlock()

Change-Id: Ibf0052a24e4b2fbcfff1e4a10d556cc4e6a6b103
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4843
Reviewed-by: waddlesplash <[email protected]>
2022-01-03 21:09:38 +00:00
Jérôme Duval 50a4c18678 kernel/xsi_semaphore: set otime when semop() succeeds
used by PR_OpenSemaphore in NSPR to check the creator inited.

Change-Id: I626c6ab0d50896c94224718ca4fa0788f74ae27a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4824
Reviewed-by: waddlesplash <[email protected]>
2021-12-18 21:14:39 +00:00
Jérôme Duval 101dc0ba83 strace: fix revents output for poll syscall
each poll_fd struct should be checked, valid when not -1 and revents not zero.

Change-Id: Ia624ad1369ad1a6066c9970a47cfac63fa773702
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4821
Reviewed-by: waddlesplash <[email protected]>
2021-12-17 20:40:55 +00:00
Jérôme Duval 3285dcae22 tcp: reset receive.low_water_mark when nothing to read anymore
the socket interface module checks the receive.low_water_mark to automatically
notify a read event. available_data will be zero, thus enabling the notification.

fixes the test poll_nm in NSPR.

Change-Id: I5354faec439df96671506550cdb144a45f6082b1
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4820
Reviewed-by: waddlesplash <[email protected]>
2021-12-17 20:40:55 +00:00
Jérôme Duval d057f0aedd lgtm.yml: disable Wformat-diag when building gcc
LGTM seems to provide GCC 9.2, for which the flag -Wformat-diag is falsely
detected as supported.

Change-Id: I95a5946d9c6cd2af73e85070973f855fba3fcc39
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4786
Reviewed-by: Jérôme Duval <[email protected]>
2021-12-14 06:06:41 +00:00
Jérôme Duval 17e8767959 intel_extreme: define bdb header values, check panel type.
Change-Id: I2e5b61da9aecc11be13178a0b48211d172454d94
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4773
Reviewed-by: Adrien Destugues <[email protected]>
2021-12-11 13:30:20 +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 <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
2021-12-07 08:32:49 +00:00
Jérôme Duval 949005a59b strace: handle parallel syscalls on different threads
If a thread executes a system call and meanwhile a different thread calls another one, then
the ongoing call is marked as unfinished. When the call returns it will be marked as resumed.

* remove PreSyscall, now unused.

Change-Id: Iea45b866be2c40568d766c2ed3cc73e34b9d1293
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4765
Reviewed-by: waddlesplash <[email protected]>
2021-12-06 17:22:50 +00:00
Jérôme Duval 39782e55fa strace: support trace for poll() and select()
in the case of poll(), the events should be printed before the actual syscall,
and the revents after, while taking in account the return value.
thus B_DEBUGGER_MESSAGE_PRE_SYSCALL needs to be enabled and handled.
the attribute "preSyscall" is added to identify such syscalls, and the parameters
are identified with the attribute "inOut".

Change-Id: I390643ea176c720738c5ec4fc75a3a4c7125a3cd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4763
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2021-12-06 03:07:41 +00:00
Jérôme Duval c53f760dfe strace: add some constants ioctl from sys/ioctl.h
Change-Id: I100f715f899435c6a9bce775d95da6f755ba55c6
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4762
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2021-12-06 03:07:41 +00:00
Jérôme Duval 9dcb1b7ff7 intel_extreme: added IDs for ASUS laptop in ticket #15392
also for Acer Aspire F5-573G from https://bsd-hardware.info/?probe=240171b234

Change-Id: Id3c83d3039736fa749f0411889c081e447bd0444
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4750
Reviewed-by: Jérôme Duval <[email protected]>
2021-12-01 13:02:42 +00:00
Jérôme Duval befbf01515 intel_extreme: implement get_preferred_mode for vbt on mobile
this avoids searching in edid information in this case.

Change-Id: I330341f089f71cd5de657a6630b5414d02db771f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4749
Reviewed-by: Jérôme Duval <[email protected]>
2021-12-01 13:02:42 +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 <[email protected]>
2021-11-30 08:06:56 +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 <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
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 <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
2021-11-22 07:20:25 +00:00
Jérôme Duval cdd2ed5a77 kernel/x86: CPUID leaf 0x1f is a preferred superset to leaf 0x0b
Intel recommends first checking for the existence of CPUID leaf 1FH before using leaf 0BH.

Change-Id: Iba677186521e086fa06bcc4fe42eaed4ba030e6d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4719
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2021-11-11 07:53:23 +00:00
Jérôme Duval f78b75b15d Terminal: handle color queries
this allows apps like vim to select a color scheme based on a dark or light background.

Change-Id: Ia9f98d2373523a8b5fa379225a1c906ae075edf7
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4693
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
2021-11-06 17:34:48 +00:00
Jérôme Duval fe3e5f05a1 Terminal: accept more notations for colors
Change-Id: Iaf6008305de8ef0111f7006e36da507d40c8a47a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4688
Reviewed-by: Adrien Destugues <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2021-11-06 17:34:48 +00:00
Jérôme Duval 91e93cb7c4 Terminal: handle cursor-color
Change-Id: I73071880c84c713ee3efec40f6ac824364157b83
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4685
Reviewed-by: Jérôme Duval <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2021-11-04 06:46:01 +00:00
Jérôme Duval b7a1261eef pci: support 64-bit BAR addressing for MSI-X memory mappings
Change-Id: I463de6aeb45d34e68e888a7648546acddb3fd57a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4613
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
2021-10-20 14:03:08 +00:00
Jérôme Duval f0a567c451 tcp: combine timestamp and sack_permitted options when possible
any ordering is legal, but some devices don't cope with what we do.
thus we reorder sack_permitted before timestamp, this doesn't cost us anything.
noticed by Sikk: https://dev.haiku-os.org/ticket/13681#comment:11

Change-Id: Ic2e1589945dd74e3034a653427a2ff45626b3a76
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4598
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
2021-10-19 19:27:42 +00:00
Jérôme Duval 52b4ed6028 Errors.h: add ENOTRECOVERABLE and EOWNERDEAD from POSIX
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html
Change-Id: I3c0a08d447c897b3caba8d365f8e5dbab7869f18
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4573
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
2021-10-16 08:23:28 +00:00
Jérôme Duval f89943d822 build/x86: also test the stack protector on x86 secondary arch
on x86, gcc emits a local reference to __stack_chk_fail_local
which can only be provided by a static library. as we don't have
a libroot_nonshared, we use libgcc from gcc, in which libssp_nonshared
was merged, from version 8.3.0_2019_05_24-11.

Change-Id: I22bf26dec5c1fe69a3915a923bd716a494f846ce
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4564
Reviewed-by: Jérôme Duval <[email protected]>
2021-10-14 19:42:07 +00:00
Jérôme Duval 3f8482c472 kernel/x86_64: remove lfence after swapgs on syscall entry and exit
in a syscall, swapgs is always executed and can't be speculatively executed or bypassed.
it's also not needed on exception/interrupt exit, only on exception/interrupt entry.
follow-up on commit 84f6e2d39f by waddlesplash

(https://github.com/freebsd/freebsd-src/commit/7aa47cace14948a7b8277a4b24a0ca9e0308990a)

Change-Id: I56de9526a1acd0075c4a12147ae782f0366dec52
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4557
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Fredrik Holmqvist <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
2021-10-09 18:54:16 +00:00
Jérôme Duval 947d3b862b app_server: handle RGB48 and RGBA64 in switches
Change-Id: I14019b3285e036eba4b73effd79d7e1b4181daeb
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4558
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
2021-10-08 15:06:07 +00:00
Jérôme Duval 65496b3a28 matrox: SMAP fixes
tested with success at least on VGA, see #16069. Thanks TmTFx and rudolfc!

Change-Id: I4183416b09216b111984658eb8b23c8f62a0e36d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2762
Reviewed-by: Jérôme Duval <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2021-10-04 15:15:22 +00:00
Jérôme Duval 407f08de29 usb_disk: fix SMAP violation for B_GET_MEDIA_STATUS ioctl
should fix #17283. To be tested.

Change-Id: If594129a6e16b50c314efa2a7bb1d18e01cdad15
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4505
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2021-10-02 15:06:29 +00:00
Jérôme Duval 08d9716a9a video_producer_demo: fix comparison warnings
Change-Id: Ibfc8780c55e229190573918a4cf1f119b5e345c6
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4504
Reviewed-by: Franck LeCodeur <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
2021-09-27 12:15:05 +00:00
Jérôme Duval bb187c91d8 interface: add colorspaces support for RGB48 and RGBA64
these colorspaces are packed as RGB or RGBA, not BGR or BGRA.
RGB48_BIG and RGBA64 only differ in the endianess of the channel the 2-byte value.

this is a big difference with RGB24_BIG and RGBA32_BIG, in which case _BIG
means the order is RGB (BGR) and not BGR (BGRA).
BGR48, BGRA64 could indeed be added, if needed.

I chose 0x11 and 0x12 arbitrarily, but given the order of channels 0x1011
and 0x1012 might make more sense. This would mean using another bit for "real"
bigendian colorspaces.

Only the color conversion to 32-bits is implemented.

Tested with the RAWTranslator modified to output 16bpp with success.

Found some references in enum AVPixelFormat in libavutil/pixfmt.h.

Change-Id: I4b023dec85d01f1e63e1b053139e5bb5d263a0e0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4468
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
2021-09-27 07:21:27 +00:00
Jérôme Duval 40793c1ef6 RAWTranslator: switch to libraw as backend when available
tested with .cr2 and .dng single pictures.

Change-Id: I9a4802300fd2afe14c085ca18faa8a1e20c52bfd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4452
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
2021-09-14 08:06:41 +00:00
Jérôme Duval cc6736afae StreamBuffer: fix Position() for read streams
the file position corresponds to the end of the buffer.

Change-Id: Ib67dcfe1f43d959777c2f6dbf84181f25a022a7c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4447
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
2021-09-13 05:53:22 +00:00
Jérôme Duval 9e511d5342 atheros813x: import patch from stable FreeBSD13
alc(4): add support for Mikrotik 10/25G NIC

The new Mikrotik 10/25G NIC is mostly compatible with AR8151 hardware,
with few exceptions:

* card supports only 32bit DMA operations
* card does not support write-one-to-clear semantics for interrupt status
  register
* MDIO operations can take longer to complete

This patch adds support for Mikrotik 10/25G NIC to the alc driver
while maintaining support for all earlier HW.

The patch was tested with FreeBSD main branch as of commit
f4b38c360e63a6e66245efedbd6c070f9c0aee55

This was tested on Intel i7-4790K system with Mikrotik 10/25G NIC.
This was tested on Intel i7-4790K system with RB44Ge (AR8151 based 4-port NIC)
to verify backwards compatibility.

PR:	256000
Submitted by:	 Gatis Peisenieks  <[email protected]>
MFC after:	1 week
Change-Id: I83cdeb24caccad15a9647a72159d979ecbd647f0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4361
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
2021-08-20 12:44:13 +00:00
Jérôme Duval b8862188f4 jmicron2x0: import patch from FreeBSD13
Revert r316820.

Despite appearing correct, r316820 breaks packet rx/tx for jme(4)
interfaces.  With 12.1 approaching, let's just revert the commit for now.

PR:		233952
Tested by:	Armin Gruner <[email protected]>
MFC after:	3 days
Change-Id: Id64b6a3c57ddae2d1915c914b1c4b1ad51410ed4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4360
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
2021-08-20 09:13:44 +00:00
Jérôme Duval 0a856fec02 iprowifi4965: import two patches from FreeBSD current
could help with #16238

1/ iwn: adjust EEPROM read timeout for Intel 4965AGN M2

Reading EEPROM from Intel 4965AGN M2 takes 60 us which was causing panic
on system startup.

2/ from https://github.com/freebsd/freebsd-src/commit/561d34d70596b455c6a513431f8ad007076f90c5
The value for field "barker_mrc" of struct iwn2030_sensitivity_limits
was obtained from linux 3.2 wireless/iwlwifi driver code (iwl-2000.c:115
.barker_corr_th_min_mrc = 390).

Change-Id: I730bd6106e0d76da89fff041672ccbc4ef607976
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4359
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
2021-08-20 08:00:39 +00:00
Jérôme Duval d7a4a01f98 usb-header.awk: Fix use of printf
Change-Id: I0f07a321ab5b896c166270b5da6f667cb47ddf26
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4279
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
2021-07-30 04:35:08 +00:00
Jérôme Duval 518f9c4e68 BCountry: check ICU version for addLikelySubtags
should help arm, riscv builds.

Change-Id: I2d626dfd28c9c4abaac15c010dd41afac410d564
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4246
Reviewed-by: Adrien Destugues <[email protected]>
2021-07-26 09:30:59 +00:00
Jérôme Duval 73ff7f2e84 boot/platform/efi: generate efi.map in the output directory
Change-Id: Iefcf347bfb815efeabffd41b71130978be596891
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4125
Reviewed-by: Fredrik Holmqvist <[email protected]>
Reviewed-by: Panagiotis Vasilopoulos <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2021-07-03 09:18:40 +00:00
Jérôme Duval 094ea67748 intel_pstates: disable Atom Silvermont and Airmont CPUs
which need special support.

Change-Id: I576f6b78dfd4d9213a7da073adf4c664aeea18b4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4120
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
2021-06-27 16:57:04 +00:00
Jérôme Duval 009a0c62cc asus-wmi: add keyboard backlight toggle support
also add fn-lock mode switch support.

Change-Id: I08738aa058e5fce2fae2ac03da2afd9fa7f894bb
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4119
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
2021-06-27 12:41:01 +00:00
Jérôme Duval 842a1538a6 ext2: fix metadata_csum for inodes
the checksum assumes the full inode block.

Change-Id: I60ef5d0b769750107b7e104709edff95beee8085
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4118
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
2021-06-27 12:41:01 +00:00
Jérôme Duval ddffdd2506 C11: define __STDC_NO_THREADS__ as threads.h is not provided
Theorically we could define __STDC_NO_THREADS__ internally in GCC, but
threads.h probably will be added in the future, and the compiler won't
notice.
Using this stdc-predef.h header and including it in GCC would solve this
nicely, and saves us from hardcoding.
The header can eventually be removed when obsolete.

Change-Id: I29aa58686e3c45449dc63e02e5a9e13a960b9090
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4097
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
2021-06-21 12:31:53 +00:00
Jérôme Duval 7d961f9746 sys/resource.h: add rusage compatibility fields, set to zero
POSIX defines this structure but specifies only two fields (which we
already implement). However, both the *BSD and Linux have agreed on
some more fields, which are often assumed to be there by applications.

The benefice of having compatibility fields is
greater as having to patch every other software at HaikuPorts.

Change-Id: Ie28ca2e348aa16b4c57eb3498eb62175100d9b9d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4083
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Niels Sascha Reedijk <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
2021-06-20 12:50:24 +00:00
Jérôme Duval c6fe367365 POSIX: introduce ppoll
will appear in the next version: https://www.opengroup.org/austin/docs/austin_1110.pdf

Change-Id: I38014ad910881df260f0ec762831491e143328c4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4099
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
2021-06-19 18:09:25 +00:00
Jérôme Duval 3f816b034d TextSearch: only grep files
fix #17012

Change-Id: Id721ec57945d9a57824ae53bf591d0e09a2b53f3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4094
Reviewed-by: Rene Gollent <[email protected]>
2021-06-15 16:22:08 +00:00
Jérôme Duval 7903bfcf8b strace: add signal name tracing
inspired by hrev23436, fix #10944

Change-Id: Ieedace86a6541a4cd1346791146a96e99d09d614
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4093
Reviewed-by: Alex von Gluck IV <[email protected]>
2021-06-15 14:34:56 +00:00
Jérôme Duval 1b0f948ea2 demangler/gcc3+: handle vendor-specific suffix
fix bug #13720

Change-Id: I3363572b88aaa674f5ee7cf69866b9f2bbb4e84c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4084
Reviewed-by: Rene Gollent <[email protected]>
Reviewed-by: Alex von Gluck IV <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2021-06-11 01:42:54 +00:00
Jérôme Duval addd392113 kernel/x86_64: clear carry, nested task and trap flags on syscall entry
this is what's generally done on other OSes.

Change-Id: I90f1a574172b8e020c9943468d2fd121e14dd062
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4047
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
2021-06-06 07:23:10 +00:00
Jérôme Duval bc5570ae60 kernel/x86: set initial user thread IOPL to zero
User threads aren't supposed to be able to adjust the interrupt flag (IF). A few
apps for instance DOSBox would just use the popf instruction and disable the
flag, expecting the change to be ignored.

Quote from the Intel manual:
"The interrupt flag (IF) is altered only when executing at a level at least as
privileged as the IOPL. If a POPF/POPFD instruction is executed with
insufficient privilege, an exception does not occur, but the privileged bits
do not change."

fix #14711

Change-Id: I0519312c1151a1dd76541f60283c6c210a5b21a6
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4046
Reviewed-by: Adrien Destugues <[email protected]>
2021-06-04 15:56:33 +00:00
Jérôme Duval d9b9a94c4f kernel/x86: disable trap and direction flag on signal handler entry
https://github.com/freebsd/freebsd-src/commit/846ac2266b625d13ce6d1fc9370c3c3cc2a960bb
https://github.com/freebsd/freebsd-src/commit/22eca0bf45fa506e27a58007cfc70f08ce4f3538
Change-Id: I19620d15372572ce4498d9145fd6b0df50f91bb9
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4043
Reviewed-by: X512 <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2021-06-04 07:39:58 +00:00
Jérôme Duval b25103cc9c kernel: generic user_memcpy() should clear_ac after the fault handler returns
the AC flag in eflags/rflags, pushed in the iframe by the CPU, is kept intact after handling the exception, since the fault handler is run with the faulted iframe and does a simple jump. The AC flag would otherwise be set until the syscall returns to userland.

Change-Id: I24f763032ab98029dd162fb411e1541586451606
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4040
Reviewed-by: Adrien Destugues <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2021-06-01 12:24:54 +00:00
Jérôme Duval 5cad57c43b Reapply "freebsd_wlan: apply net80211 commits from FreeBSD 13 except four commits"
Reason for reapply: ticket #16958 regression testing not conclusive

Change-Id: Id8fb4c865db9107a31542d1db987db9a73140f9c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4016
Reviewed-by: Jérôme Duval <[email protected]>
2021-05-28 18:14:32 +00:00
Jérôme Duval 00ba3fd01b Revert "freebsd_wlan: apply net80211 commits from FreeBSD 13 except four commits"
This reverts commit a4caca440c.

Reason for revert: idualwifi7260 works in hrev55078, not in 55091, 55099

Change-Id: Ica72c2e3d70233a5093fa7601fbf2a8fcb19021e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3937
Reviewed-by: Jérôme Duval <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2021-05-22 12:27:00 +00:00
Jérôme Duval 2b4bf3eef6 i2c_hid: driver for i2c-hid devices
This is getting more common in tablets and laptops. It replaces PS/2 for
the internal keyboard and pointing devices. This is simpler and cheaper
than using up USB ports, and also simpler than the old and quirky PS/2
protocol.

The HID spec is the same no matter what transport is used (it is also
applicable for Bluetooth). Ideally we could create a separate HID bus
manager that would handle all these devices in a generic way, but that
is a lot of work nad extra complications for uncertain gains.

For now, just move the common files to a shared directory where both
drivers can use them. As a result the files are compiled twice, which is
what we want, because currently they hardcode some device paths that
need to be different for each driver.

Change-Id: I0327f6864dd0a4372b708f7b7ecf299aa86a6ea9
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2466
Reviewed-by: Adrien Destugues <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2021-05-21 07:08:43 +00:00
Jérôme Duval 22c72a99f9 build: remove wavelanwifi from the default image
wi(4) was removed in FreeBSD 13

Change-Id: I4008dba521e6246c817668f49169db1559908824
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3957
Reviewed-by: Rene Gollent <[email protected]>
2021-05-20 21:21:39 +00:00
Jérôme Duval 65f52a5f56 build: remove the firewire support from the default image
decommissioning.

Change-Id: Ie7ccba705f7282193120241479d2ae83bd271b2c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3956
Reviewed-by: Adrien Destugues <[email protected]>
Reviewed-by: Fredrik Holmqvist <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2021-05-20 21:21:39 +00:00
Jérôme Duval 474e0be842 atheroswifi: apply commits from FreeBSD 13 except
654517304167bb4675aa14ada0a1dac9efe71c9b Convert to if_foreach_llmaddr() KPI.
5ab0c8434a7befeafbaf81e899fc23f660b64c9d ath(4) processing input packets in taskqueue.
6c3e93cb5a4aa4b8a2d8d4d326f2a7c34d3a4458 Use NET_TASK_INIT() and NET_GROUPTASK_INIT()

add extra ANI fields for the AR9300 HAL.

I'm trying to debug why reception upstairs here is so terrible and it
turns out ANI is buggy.  (Which is no surprise, ANI is always buggy.)

Tested:

* Carambola2 (AR9331), STA/AP modes

ANI fixes and preparation for userland control.

* The ani function bitmap was being badly used when determining if a command
  could be used.  In hostap modes only a couple of the ANI control parameters
  are enabled.

* The ani function bitmap was not being reset to HAL_ANI_ALL if transitioning
  from AP -> STA.

* Change mrcCckOff to mrcCck - 1 == on, rather than 1 == off.  This matches
  the API used to set the value from userland via the diagnostic API.

* Handle OFDM/CCK noise immunity level commands in ar9300_ani_control().
  These will only come from userland and it will go and program the rest of
  the ANI control parameters with the values in the ANI table.

* Ensure all of the ANI parameters can be tweaked at runtime, even if they're
  disabled.

Tested:

* carambola2 (AR9331), STA/AP modes

Fix return value check to not complain.

Compilers complain more about things, so let's keep them happy.

Extend the start PCU receive to handle resetting ANI.

One of the fun issues with scanning has been how the existing
ANI values were programmed into the hardware when channels were
changed.  If you're on a really crappy channel and ANI has made
you deaf then when you scan you continue to be deaf on all channels.

This code passes in a flag to startpcureceive which in AR5416 and later
is also used to enable ANI.  This allows it to know if it's a normal
operation or a scan operation.

This fixes my situation at home where a temporary spot of a device
going deaf due to interference starts scanning and .. can't hear
anything until I restart.

Now, this isn't the full fix - ideally:

(a) all the ANI config and per-channel information would be migrated
     to the shared HAL stuff and enabled for all of the NICs;
(b) when a station reassociates and some other error conditions
    (like missed beacons, NF calibration failures, etc) a knob
    to reset ANI parameters would likely help recovery.

But hey, I'm committing bits of code again! woo!

Tested:

* AR9344 (2G), STA operation

Fix ANI calibration during non-ACTIVE states; start poking at rate control

These are some fun issues I've found with my upstairs wifi link at such a ridiculous
low signal level (like, < 5dB.)

* Add per-station tx/rx rssi statistics, in potential preparation to use that
  in the RX rate control.

* Call the rate control on each received frame to let it potentially use
  it as a hint for what rates to potentially use.  It's a no-op right now.

* Do ANI calibration during scan as well. The ath_newstate() call was disabling the
  ANI timer and only re-enabling it during transitions to _RUN.  This has the
  unfortunate side-effect that if ANI deafened the NIC because of interference
  and it disassociated, it wouldn't be reset and the scan would never hear beacons.

The ANI configuration is stored at least globally on some HALs and per-channel
on others.  Because of this a NIC reset wouldn't help; the ANI parameters would
simply be programmed back in.

Now, I have a feeling I also need to do this during AUTH/ASSOC too and maybe,
if I'm feeling clever, I need to reset the ANI parameters on a given channel
during a transition through INIT or if the VAP is destroyed/re-created.
However for now this gets me out of the immediate weeds with connectivity
upstairs (and thus I /can/ commit); I'll keep chipping away at tidying this
stuff up in subsequent commits.

Tested:

* AR9344 (Wasp), 2G STA mode

Have the final attempted rate in 11n modes to be the lowest one.

Right now ath_rate_sample has a fixed rate schedule, rather than the minstrel_ht
style "best, good, most reliable" triplet.  So, if higher rates are tried then
it'll not fail back to a lower MCS rate in that transmission schedule.

This means that in low SNR situations it'll not easily drop to MCS0 unless enough
transmissions occur to allow rate control to eventually decide to drop; and if
it's TCP traffic it'll get slowed down because of packet loss.

It's worse for 2-stream and 3-stream rates; it doesn't ever fall back to lower
stream rates, and these higher stream rates required higher SNR to work.

So instead let's (for now?) have each of the 11n transmit rates use MCS0 as
the last attempt. ath_rate_sample will quickly see that rate succeeds more
and will move to it much quicker.

Testing:

* AR9344 (Wasp) - 2G STA mode

Fix queue bits a bit

Found by PVS Studio: duplicate assignment; add assignment of tqi_compBuf.

Submitted by:	<[email protected]>
Differential Revision:	https://reviews.freebsd.org/D20431

ath_hal: fix typo in ath_hal_printf

Fix endian macros to work in and out of kernel tree.

Yes, people shouldn't use bitfields in C for structure parsing.
If someone ever wants a cleanup task then it'd be great to remove them
from this vendor code and other places in the ar9285/ar9287 HALs.

Alas, here we are.

AH_BYTE_ORDER wasn't defined and neither were the two values it could be.
So when compiling ath_ee_print_9300 it'd default to the big endian struct
layout and get a WHOLE lot of stuff wrong.

So:

* move AH_BYTE_ORDER into ath_hal/ah.h where it can be used by everyone.
* ensure that AH_BYTE_ORDER is actually defined before using it!

This should work on both big and little endian platforms.

Add some extra data into the rate control lookup.

Right now (well, since I did this in 2011/2012) the rate control code
makes some super bad choices for 11n aggregates/rates, and it tracks
statistics even more questionably.

It's been long enough and I'm now trying to use it again daily, so let's
start by:

* telling the rate control code if it's an aggregate or not;
* being clearer about the TID - yes it can be extracted from the
  ath_buf but this way it can be overridden by the caller without
  changing the TID itself.

  (This is for doing experiments with voice/video QoS at some point..)

* Return an optional field to limit how long the aggregate is in
  microseconds.  Right now the rate control code supplies a rate table
  and the ath aggr form code will look at the rate table and limit
  the aggregate size to 4ms at the slowest rate.  Yeah, this is pretty
  terrible.

* Add some more TODO comments around handling txpower, rate and
  handling filtered frames status so if I continue to have spoons for
  this I can go poke at it.

Extend ath_rate_sample to better handle 11n rates and aggregates.

My initial rate control code was .. suboptimal.  I wanted to at least get MCS
rates sent, but it didn't do anywhere near enough to handle low signal level links
or remotely keep accurate statistics.

So, 8 years later, here's what I should've done back then.

* Firstly, I wasn't at all tracking packet sizes other than the two buckets
  (250 and 1600 bytes.)  So, extend it to include 4096, 8192, 16384, 32768 and
  65536.  I may go add 2048 at some point if I find it's useful.

  This is important for a few reasons.  First, when forming A-MPDU or AMSDU
  aggregates the frame sizes are larger, and thus the TX time calculation
  is woefully, increasingly wrong.  Secondly, the behaviour of 802.11 channels
  isn't some fixed thing, both due to channel conditions and radios themselves.
  Notably, there was some observations done a few years ago on 11n chipsets
  which noticed longer aggregates showed an increase in failed A-MPDU sub-frame
  reception as you got further along in the transmit time.  It could be due to
  a variety of things - transmitter linearity, channel conditions changing,
  frequency/phase drift, etc - but the observation was to potentially form
  shorter aggregates to improve BER.

* .. and then modify the ath TX path to report the length of the aggregate sent,
  so as the statistics kept would line up with the correct bucket.

* Then on the rate control look-up side - i was also only using the first frame
  length for an A-MPDU rate control lookup which isn't good enough here.
  So, add a new method that walks the TID software queue for that node to
  find out what the likely length of data available is.  It isn't ALL of the
  data in the queue because we'll only ever send enough data to fit inside the
  block-ack window, so limit how many bytes we return to roughly what ath_tx_form_aggr()
  would do.

* .. and cache that in the first ath_buf in the aggregate so it and the eventual
  AMPDU length can be returned to the rate control code.

* THEN, modify the rate control code to look at them both when deciding which bucket
  to attribute the sent frame on.  I'm erring on the side of caution and using the
  size bucket that the lookup is based on.

Ok, so now the rate lookups and statistics are "more correct".  However, MCS rates
are not the same as 11abg rates in that they're not a monotonically incrementing
set of faster rates and you can't assume that just because a given MCS rate fails,
the next higher one wouldn't work better or be a lower average tx time.

So, I had to do a bunch of surgery to the best rate and sample rate math.
This is the bit that's a WIP.

* First, simplify the statistics updates (update_stats()) to do a single pass on
  all rates.
* Next, make sure that each rate average tx time is updated based on /its/ failure/success.
  Eg if you sent a frame with { MCS15, MCS12, MCS8 } and MCS8 succeeded, MCS15 and MCS
  12 would have their average tx time updated for /their/ part of the transmission,
  not the whole transmission.
* Next, EWMA wasn't being fully calculated based on the /failures/ in each of the
  rate attempts.  So, if MCS15, MCS12 failed above but MCS8 didn't, then ensure
  that the statistics noted that /all/ subframes failed at those rates, rather than
  the eventual set of transmitted/sent frames.   This ensures the EWMA /and/ average
  TX time are updated correctly.
* When picking a sample rate and initial rate, probe rates aroud the current MCS
  but limit it to MCS0..7 /for all spatial streams/, rather than doing crazy things
  like hitting MCS7 and then probing MCS8 - MCS8 is basically MCS0 but two spatial
  streams.  It's a /lot/ slower than MCS7.  Also, the reverse is true - if we're at
  MCS8 then don't probe MCS7 as part of it, it's not likely to succeed.
* Fix bugs in pick_best_rate() where I was /immediately/ choosing the highest MCS
  rate if there weren't any frames yet transmitted.  I was defaulting to 25% EWMA and
  .. then each comparison would accept the higher rate.  Just skip those; sampling
  will fill in the details.

So, this seems to work a lot better.  It's not perfect; I'm still seeing a lot of
instability around higher MCS rates because there are bursts of loss/retransmissions
that aren't /too/ bad.  But i'll keep iterating over this and tidying up my hacks.

Ok, so why this still something I'm poking at? rather than porting minstrel_ht?

ath_rate_sample tries to minimise airtime, not maximise throughput.  I have
extended it with an EWMA based on sub-frame success/failures - high MCS rates
that have partially successful receptions still show super short average frame
times, but a /lot/ of retransmits have to happen for that to work.
So for MCS rates I also track this EWMA and ensure that the rates I'm choosing
don't have super crappy packet failures.  I don't mind not getting lower
peak throughput versus minstrel_ht; instead I want to see if I can make "minimise
airtime" work well.

Tested:

* AR9380, STA mode
* AR9344, STA mode
* AR9580, STA/AP mode

le oops, trim out an #if 1 that I didn't fully delete.

Cool, so now I know it's about 3 weeks between starting on freebsd coding
and breaking the build again. Queue dunce cap.

Fix logic for determining whether to bump up an MCS rate.

* Fix formatting, cause reasons;
* Put back the "and the chosen rate is within 90% of the current rate" logic;
* Ensure the best rate and the current rate aren't the same; this ...
* ... fixes the packets_since_switch[] tracking to actually conut how many
  frames since the rate switched, so now I know how stable stuff is; and
* Ensure that MCS can go up to a higher MCS at this or any other spatial stream.
  My previous quick hack attempt was doing > rather than >= so you had to go
  to both a higher root MCS rate (0..7) and spatial stream. Eg, you couldn't
  go from MCS0 (1ss) to MCS8 (2ss) this way.

The best rate and switching rate logic still have a bunch more work to do
because they're still quite touchy when it comes to average tx time but at least
now it's choosing higher rates correctly when it wants to try a higher rate.

Tested:

* AR9380, STA mode

Limit the tx schedules for A-MPDU ; don't take short retries into account and remove the requirement that the MCS rate is "higher" if we're considering a new rate.

Ok, another fun one.

* In order for reliable non-software retried higher MCS rates, the TX schedules
  (inconsistently!) use hard-coded lower rates at the end of the schedule.
  Now, hard-coded is a problem because (a) it means that aggregate formation
  is limited by the SLOWEST rate, so I never formed large AMDU frames for
  3 stream rates, and (b) if the AP disables lower rates as base rates, it
  complains about "unknown rix" every frame you transmit at that rate.

  So, for now just disable the third and fourth schedule entry for AMPDUs.
  Now I'm forming 32k and 64k aggregates for the higher density MCS rates
  much more reliably.

  It would be much nicer if the rate schedule stuff wasn't fixed but instead
  I'd just populate ath_rc_series[] when I fetch the rates.  This is all a
  holdover of ye olde pre-11n stuff and I really just need to nuke it.

  But for now, ye hack.

* The check for "is this MCS rate better" based on MCS itself is just garbage.
  It meant things like going MCS0->7 would be fine, and say 0->8->16 is fine,
  (as they're equivalent encoding but 1,2,3 spatial streams), BUT it meant
  going something like MCS7->11 would fail even though it's likely that
  MCS11 would just be better, both for EWMA/BER and throughput.

  So for now just use the average tx time.  The "right" way for this comparison
  would be to compare PHY bitrates rather than MCS / rate indexes, but I'm not
  yet there.  The bit rates ARE available in the PHY index, but honestly
  I have a lot of other cleaning up to here before I think about that.

* Don't include the RTS/CTS retry count (and thus time) into the average tx time
  caluation.  It just makes temporarily failures make the rate look bad by
  QUITE A LOT, as RTS/CTS exchanges are (a) long, and (b) mostly irrelevant
  to the actual rate being tried.  If we keep hitting RTS/CTS failures then
  there's something ELSE wrong on the channel, not our selected rate.

Fix correct status when completing frames with short failures.

My preivous logic was a bit wrong.  This caused transmissions that failed due
to a mix of short and long retries to count intermediate rates as OK if the
LONG retry count indicated some retries had made it to this intermediate rate,
but the SHORT retry count was the one that caused the whole transmit to fail.

Now status is passed in again - and this is the status for the whole transmission -
and then update_stats() does some quick math to see if the current transmission
series hit its long retry count or not before updating things as a success
or failure.

Obey the maximum frame length even when using static rates.

I wasn't enforcing the maximum packet length when using static rates
so although the driver was enforcing it itself OK, the statistics were
sometimes going into the wrong bin.

Tested:

* AR9380, STA mode

reset hardware if this particular mac bug is seen.

I have to dig into why I'm seeing it on chips as late as the AR9380 era
stuff (as it's marked as an AR5416 bug, but who knows!) but i'm seeing
aggregate TX frames complete with no blockack bit set.  So, everything
should be treated as a failure and do a hardware reset for good measure.

Tested:

* AR9380, STA mode
* AR9580 (5GHz), AP mode

Hopefully recover better-er upon RX restart on AR9380.

This is all very long-standing bug stuff that is touchy and still poorly
documented. Ok, here goes.

The basic bug:

* deleting a VAP causes the RX path (and TX path too) to be restarted
  without a full chip reset, which causes RX hangs on the AR9380 and later.
  (ie, the ones with the newer DMA engine.)

The basic fix:

* do an RX flush when stopping RX in ath_vap_delete() to match what happens
  when RX is stopped elsewhere.  This ensures any pending frames are completed
  and we restart at the right spot; it also ensures we don't push new RX buffers
  into the hardware if we're stopping receive.

The other issues I found:

* Don't bother checking the RX packet ring in the deferred read taskqueue;
  that's specifically supposed to be for completing frames rather than
  just yanking them off the receive ring.

* Cancel/drain any pending deferred read taskqueue.  This isn't done inside
  any locks so we should be super careful here.  This stops the hardware
  being reprogrammed at the same time in another thread/CPU whilst we're
  stopping RX.

* .. (yes, this should be better serialised, but that's for another day. maybe.)

* Add more debugging to trace what's going on here.

And the fun bit:

* Reinitialise the RX FIFO ONLY if we've been reset or stopped, rather than just
  reset.  I noticed that after all the above was done I was STILL seeing RXEOL.
  RXEOL isn't enabled on the AR9380 so I'd only see it if I was sending TX frames
  (ie a ping where it'd be transmitted but never received) so I was not being
  spammed by RXEOL.  So, as long as stuff is stopped, restart it.

This seems to be doing the right thing in both AP and STA modes.

What I should do next, if I ever get time:

* as I said above, serialise the receive stop/start to include taskqueues
* monitor RXEOL on the AR9380 and I keep seeing it spammed / lockups, just
  go do a full chip reset to get things back on track. It sucks, but it
  is better than nothing.

Tested:

* AR9380 AP/STA mode, adding/deleting a hostap VAP to trigger the TX/RX
  queue stop/start; whilst also running an iperf through it.  Lots of times.
  Lots.  Of.. Times.

Propagate the HAL_RESET_TYPE through to the chip reset; set it during ath_reset()

Although I added the reset type field to ath_hal_reset() years ago,
I never finished adding it both throughout the HALs and in if_ath.c.

This will eventually deprecate the ath_hal force_full_reset option
because it can be requested at the driver layer.

So:

* Teach ar5416ChipReset() and ar9300_chip_reset() about the HAL type
* Use it in ar5416Reset() and ar9300_reset() when doing a full chip reset
* Extend ath_reset() to include the HAL_RESET_TYPE parameter added in the above functions
* Use HAL_RESET_NORMAL in most calls to ath_reset()
* .. but use HAL_RESET_BBPANIC for the BB panics, and HAL_RESET_FORCE_COLD during fatal, beacon miss and other hardware related hangs.

This should be a glorified no-op outside of actual hardware issues.
I've tested things with ath_hal force_full_reset set to 1 for years now,
so I know that feature and a full reset works (albeit much slower than
a warm reset!) and it does unwedge hardware.

The eventual aim is to use this for all the places where the driver
detects a potential hang as well as if long calibration - ie, noise floor
calibration - fails to complete. That's one of the big hardware related
things that causes station mode operation to hang without easy recovery.

Differential Revision:	https://reviews.freebsd.org/D24981

Update ath_rate_sample to use the same base type as ticks.

Until net80211 grows a specific ticks type that matches the system,
manually use the same type as the kernel/net80211 'ticks' type
(signed int.)

Tested:

* AR9380, STA mode

Don't re-program the beacon timers if we miss a beacon in software-beacon STA mode.

This is something I added a few years ago to handle resyncing the beacon if
we miss a beacon or need to sync after association/reassociation/powersave.

However, if we're doing STA+AP mode (eg DWDS) then we don't want
to reprogram the beacons here; this may upset normal AP operation.
I missed checking for the sc->sc_swbmiss flag so I was reinitialising
the beacon timers after every beacon miss / TSFOOR option, and
that isn't likely good.

This plus ensuring that STA's are created with "-beacon" to disable
BMISS/TSFOOR processing will hopefully quieten some of the issues
I've seen with missed beacons / TSFOOR (out of range) interrupts
coming in when operating in STA mode.

Tested:

* AR9380/AR9580, STA+AP modes

Don't update the beacon bits from beacon frames in hostapd mode.

This logic is running the beacon receive bits in STA+AP mode on both the
STA and AP side.  The STA side sees its beacons from the BSS fine; the
AP side is seeing other beacons on the same channel but with the BSS
node for some odd reason.  (I think it's a valid reason, but I currently
forget what that valid reason is.)

So, just to be cleaner about things, don't run the nexttbtt/etc bits
at all if we're in hostap mode.  If I ever get mesh working then maybe
I'll make sure it works right on mesh+ap and mesh+sta modes.

Whilst here, log the VAP i'm being called on to make it clearer what
is going on.  I may end up adding a VAP dprintf version of this at
some point.

Tested:

* AR9380, STA (DWDS client) + hostap on the same NIC

Add KeyMiss for AR5212/AR5416 series chips.

This is a flag from the MAC that says the received packet didn't match
a keycache slot.  This isn't technically a problem as WEP keys don't
match keycache slots (they're "global" keys), but it could be useful
for tracking down CCMP decryption failures.

Right now it's a no-op - it mirrors what the AR9300 HAL does and it
just increments a counter.  But, hey, maybe one day I'll use it for
diagnosing keycache/CCMP decrypt issues.

ath: clean up empty lines in .c and .h files

replace the hard-coded magic values in if_athioctl.h with constant defines

Replace some hard-coded magic values in the ioctl stats struct with
defines.  I'm going to follow up with some more sanity checking in
the receive path that also use these values so we don't do bad
things if the hardware is (more) confused.

Don't use hard-coded values in the sanity check.

Don't use hard-coded values in the phy error and receive antenna
checks.

also remove the magic size value here for the transmit antenna statistics.

Change-Id: Ifebebef068d9abe7abfa61204dc900095bd6914c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3921
Reviewed-by: Adrien Destugues <[email protected]>
2021-05-19 04:38:47 +00:00
Jérôme Duval f1ec69628a tcp: several fixes for SACK handling:
* kMaxOptionSize: TCP header size is 60 bytes. process_options() would have
 accepted a longer header as permitted. add_options() would have possibly added
 more options or SACK entries as permitted.
* tcp_segment: reserve memory for sack entries.
* _SendQueued(): "fLastAcknowledgeSent <= fReceiveNext": also send SACK entries
 for received data when acknowledging a missing segment.
* _SendQueue(): after acknowledging, cancel the delayed acknowledgment timer.
* _Receive(): if calling Acknowledged() already triggered sending a segment
 including an acknowledgement (piggy-back), remove "immediate acknowledge"
 from the action. This helps to reduce empty ACKs for bidirectional streams.

Change-Id: I32808fbe549be0f5b25bcf4be17cd91a640b8ec4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3906
Reviewed-by: Adrien Destugues <[email protected]>
2021-05-13 08:01:27 +00:00
Jérôme Duval a939e873ba tcp: fix trace build for BufferQueue
Change-Id: Iab502bdff3da23dff74972e6c480e0784ab3f4dd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3905
Reviewed-by: Alex von Gluck IV <[email protected]>
2021-05-13 08:01:27 +00:00
Jérôme Duval 7065a89fc6 POSIX: ioctl(fd, op, arg) equals ioctl(fd, op, arg, 0)
The ioctl call cannot know the expected number of arguments
because it depends on the specific ioctl being used, and the
same value could be used to do different things by different
devices. Without knowing that, it is not safe to use va_arg
(at best a random value will be read from the stack, at worst,
it will just crash).

This changes the implementation of ioctl in two ways:
- For C++ code: a 4 argument function with default values
  for arguments 3 and 4.
- For C code: wrap arguments 3 and 4 in a struct with the
  help of a macro, providing something that behaves like the
  C++ version.

So, with this new code:
- Calling ioctl with only 3 arguments sets the 4th one to 0
- Calling ioctl with only 2 arguments sets the 3rd and 4th to 0
- Calling with 1 or 5+ arguments is a compile time error

The existing ioctl symbol is preserved for ABI compatibility.

Change-Id: I6d4d1d38fccd8cc9bd94203d3e11aeac6da8efc3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3360
Reviewed-by: Adrien Destugues <[email protected]>
2021-05-04 19:21:48 +00:00
Jérôme Duval 04be20a75a Implement stack protection support
this adds kernel & libroot stack protector hooks. it uses /dev/random in userspace.
A configure option --enable-stack-protector is added to activate -fstack-protector
on selected system components (ATM apps, kits, servers).

Change-Id: If3a2920ba9aa0a85eaff4ba6778947f8c76ade31
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3895
Reviewed-by: Adrien Destugues <[email protected]>
2021-05-03 17:52:31 +00:00
Jérôme Duval 20308ad6a7 build: follow-up for hrev54993
should help with bug #16929, untested

Change-Id: Ia7b9b6cc8e84e2377d79c0edd1c278cdf74d869b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3891
Reviewed-by: Adrien Destugues <[email protected]>
2021-04-30 10:42:21 +00:00
Jérôme Duval 45872f7f9c kernel/vm: restrict permission changes on shared file-mapped areas
a protection_max attribute is added in VMArea.
a read-only opened file already can't be mapped shared read-write at the moment,
but can later be changed to read-write with mprotect() or set_area_protection().
When creating the VMArea, the actual maximum protection is stored in the area,
so that it can be checked when needed.
this fixes a VM TODO.

Change-Id: I33b144c192034eeb059f1dede5dbef5af947280d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3804
Reviewed-by: Adrien Destugues <[email protected]>
2021-03-23 17:40:31 +00:00
Jérôme Duval 10ff9c6a14 unix: sendmsg should return EPIPE after close
https://pubs.opengroup.org/onlinepubs/9699919799/functions/sendmsg.html
"[EPIPE] ... the socket is connection-mode and is no longer connected."
Change-Id: I6728b088d2f717b769697218edf26c76c59f488e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3816
Reviewed-by: Adrien Destugues <[email protected]>
2021-03-23 07:30:36 +00:00
Jérôme Duval f0c4b0a69a unix: get a read event when read-polling a read-shutdown socket
UnixEndpoint::Receivable(): EOF means there is nothing left to read, and
the shutdown happened on the read side or the write side.

also fix x86_64 build with trace

Change-Id: I54c806f0b900591c3d441240b8f6768dfb756bad
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3808
Reviewed-by: Adrien Destugues <[email protected]>
2021-03-23 07:30:36 +00:00
Jérôme Duval 068d41df0f usb_midi: make buffers kernel-only for SMAP
also use user_memcpy in usb_midi_write().
confirmed that it fixes #16856, thanks nephele.

Change-Id: I548cd2bd5cf44f7da078745fe403cf131c4cc4b0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3806
Reviewed-by: Jérôme Duval <[email protected]>
2021-03-20 09:31:33 +00:00
Jérôme Duval 267c6a9b0d Locale: correct fix binary compatibility for BNumberFormat
fix HaikuDepot build after hrev55006

Change-Id: I3c275e1b0f23f936db448ad82639458535617d6a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3809
Reviewed-by: Jérôme Duval <[email protected]>
2021-03-20 09:30:14 +00:00
Jérôme Duval e3c3983827 Locale: fix binary compatibility for BNumberFormat
Issue: https://github.com/HaikuArchives/Album/issues/15
Change-Id: I1f8d5055f929957adb0cca20a8f6b13bcccabfab
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3807
Reviewed-by: Adrien Destugues <[email protected]>
2021-03-19 10:53:15 +00:00
Jérôme Duval b2b83ad10f runtime_loader: dlopen() should respect RPATH of the loading module
Change-Id: Ic58edb53114dfff30cc7188957cd32508fa8bd48
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3798
Reviewed-by: Jérôme Duval <[email protected]>
2021-03-18 08:19:55 +00:00
Jérôme Duval 3592432e9b utmpx.h: add ut_host for compatibility (not posix)
Change-Id: I27e8f7b6dbc29232542e3749d8e194efa2ef5209
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3799
Reviewed-by: Adrien Destugues <[email protected]>
2021-03-16 16:55:44 +00:00