Commit Graph

64570 Commits

Author SHA1 Message Date
Augustin Cavalier
7ac9dc6612 freebsd_network: Use a dedicated USB mutex instead of &Giant.
Fixes #17804.
2022-06-20 13:02:32 -04:00
Jérôme Duval
177a801206 kernel: fix trace build for fd.cpp and fifo.cpp
Change-Id: I12b2e85926ae63eaba5c077343cdaa2362cf8af1
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5391
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-06-20 15:29:43 +00:00
PulkoMandy
a3d84aba73 ps2: improve tracing
Change-Id: I3991e1974ac4af2ba00d692284bfcf00e5b4cc84
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5386
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-06-20 02:48:03 +00:00
PulkoMandy
d2837c97b7 Interface kit: allow get_key_repeat_{rate,delay} to fail
These functions should return an error if the input_server is not
running. They still give the default value in this case, but they now
return an error code.

Change-Id: I706cded7c780d913d4f36164596b2b7794db6f22
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5385
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-06-20 02:48:03 +00:00
PulkoMandy
81f9c26a70 Input server: remove some dead code
This does nothing, keep the TODO but remove the useless code.

Change-Id: I14611289e1153e406ff7dec93729bceedef7d9af
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5384
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-06-20 02:48:03 +00:00
PulkoMandy
3f18d506fa Input preferences: remove dead code
The old keyboard preferences used to save its window position in the
keyboard_settings file. The new Input preferences does not, but part of
the code had not been removed yet so it would still open the file (and
then do nothing with it)

Change-Id: Ic5e1d6bd6a8452bd779dc73872148d5c32ab12e5
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5383
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-06-20 02:48:03 +00:00
Alexander von Gluck IV
774c33c2a7 radeon_hd: Drop unused overlay, cursor registers
* Also drop unused vblank semaphore storage
* Spotted by X512. These are from intel_extreme
  which was used as a base *ages* ago.

Change-Id: I2a6baaa4849baeb8c8cf10e2046d0fbe10c3a356
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5389
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2022-06-20 02:46:55 +00:00
PulkoMandy
ea56f5e0be kernel: replace Spleen font with an enlarged version of the original KDL font
Recently we introduced Spleen as a larger font for KDL for high
resolution displays. However, it looks quite different from our original
font. I designed an enlarged version of our original font (designed by
Brian J. Swetland and also found in NewOS, LK and Fuchsia) to use
instead.

Change-Id: I10872e407d45b906f8b6c7ba44b2f993dcd19bff
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5382
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2022-06-19 08:38:46 +00:00
Javier Steinaker
702ff4212d NetworkStatus: do not show non-present interfaces
Used explicit type declaration instead of auto and old style
map erase() function to (hopefully) make it compatible with gcc2 builds.

Change-Id: I8314665a3a3468f11bcac11367ee69d9a3ed2a05
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5380
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2022-06-19 08:32:53 +00:00
Mashijams
9c4a46b318 xfs : version 5 superblock, checksum header file
- Implemented version 5 superblock fields and necessary macros.

- Checksum functions are implemented which will be used for crc verification and crc updates.

- fssh_kernal_priv.h ROUNDDOWN macro definition is consistent with kernal.h definition.

Change-Id: I49b7c939bfd3ea1bffc85b3db42bc678dcce75cd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5350
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2022-06-18 08:32:18 +00:00
Augustin Cavalier
ac2215ca09 ifconfig: Place generic options at the end of the media types list.
Otherwise we will get "Auto-select" even if something more specific
applies, e.g. in the case of IFM_IEEE80211 at least.

Fixes media type detection for OpenBSD drivers.
2022-06-15 21:07:50 -04:00
Augustin Cavalier
07b1a21775 EHCI: Do not ignore status of PrepareKernelAccess.
May help with #17799.
2022-06-14 15:26:27 -04:00
Augustin Cavalier
d621ee6564 freebsd_network: Move up Giant ownership during attach.
device_attach can be recursed for MIIbus drivers, so avoid the complexity
and lock Giant from init_drivers() instead.
2022-06-14 00:34:46 -04:00
Augustin Cavalier
c6c03b01c3 freebsd_network: Validate ranges but not alignment when coalescing in bus_dma. 2022-06-14 00:30:14 -04:00
Augustin Cavalier
e206b2f350 freebsd_network: Always hold the "Giant" lock during attaches.
Reduces patches to OpenBSD drivers slightly, and could potentially
help with some of the KDLs.
2022-06-13 23:57:37 -04:00
Augustin Cavalier
e6da31ae5d idualwifi7260: Add error to panic message.
Should help with diagnosing the KDLs seen in #14298.
2022-06-13 23:21:14 -04:00
Augustin Cavalier
73d88d4ee6 ifconfig: Add basic IEEE 802.11 media types to the list.
This requires using the FreeBSD if_media.h (for now, anyway)
and adding a subtype_mask to the data structures. But this
does work.

Now 802.11 media will be displayed in ifconfig and Network
preferences.
2022-06-13 22:47:30 -04:00
Augustin Cavalier
1adb712427 preferences/network: Use ifconfig's MediaTypes object instead of recompiling.
The next commit will make it depend on FreeBSD headers,
which we do not have available here.
2022-06-13 22:47:30 -04:00
Augustin Cavalier
850fc02fa2 kernel/vm: Specifiy the page as the object being waited on in VMCache.
I got a strange whole-system hang in file_cache_resize into this
function. Possibly the page was spuriously busy, perhaps it wasn't,
but not having function arguments on x86_64 in stack traces, I was
unable to deduce what page was actually being waited on.

In case it happens again, this should allow it to be debugged further
by placing the address of the vm_page structure in the thread wait
informations. (A string is not very useful here anyway.)
2022-06-13 22:43:15 -04:00
Augustin Cavalier
44fa45df3a net/if: Drop ifmediareq and just use the regular ifreq for SIOCGIFMEDIA.
This was introduced into the main API in 2010 (d72ede75fb),
but was actually only fully used for the past month (c2a9a890f3)
when SIOCGIFMEDIA was supported for all *BSD drivers and not just WiFi.
Most userland consumers of this structure did not use it correctly,
as was the case in #17770, and only worked because in the fallback case
the network stack just treated it as if it were an ifreq.

Nothing actually used the ifm_count/ifm_ulist (though tentative APIs
were exposed for it) as noted by previous commits; and the fact that
Haiku's IFM_* declarations are so spartan makes most of the returned
values unintelligible to userland without using FreeBSD compat headers.

If, in the future, we decide to implement ifmedia listing and selection
properly, that should likely be done with separate ioctls instead of
having multi-function ones like this.

This is technically an ABI break, but in practice it should not matter:
ifmediareq::ifm_current aligns with ifreq::ifr_media, so the things
that used this structure like our in-tree code did will continue to work.
Until this past May, the only other field that was usually set was
ifm_active, but in the absence of setting ifm_status all non-Haiku
consumers should ignore it completely.

The only consumer of this ioctl that I know of out of the tree,
wpa_supplicant, still works after these changes.
2022-06-13 22:31:33 -04:00
Augustin Cavalier
ecf18ba4c8 freebsd_network: Cleanup around ifmedia handling.
* Remove unused variable.

 * Use original value for IFM_AVALID, we do not need to remap this one.
   (Actually we do not need to remap IFM_ACTIVE here either, but it makes
    some things slightly easier to work with rather than remapping it
    in a different location.)
2022-06-13 20:34:05 -04:00
Augustin Cavalier
83ac9b727c network/stack: Do not invoke SIOCGIFMEDIA but just return the already-fetched media.
This functionally disables most of the functionality of the BSD-style
SIOCGIFMEDIA, but it was never used in userland (because if it had,
it would have triggered SMAP violations in the compatibility layer.)

SIOCGIFMEDIA returns BSD-style media values, which mostly overlap
with Haiku ones but have a few differences still. These are taken care
of in the compat layer by ETHER_GET_LINK_STATE, which is where this
media value comes from, but are not by SIOCGIFMEDIA which just passes
back whatever the drivers do.

Fixes #17770, at least for ethernet drivers.
2022-06-13 20:32:57 -04:00
Augustin Cavalier
b5fae38254 network/ethernet: Do not set IFM_ETHER in update_link_state.
All the drivers that support ETHER_GET_LINK_STATE set this correctly;
and more specifically, it should actually not be set on some devices
(WiFi devices, specifically). Since SIOCGIFMEDIA has always been
passed through directly to the driver if it supports it, WiFi
devices worked anyway because this value never made it to userland.
That will soon change, hence this needed to be fixed.
2022-06-13 20:24:17 -04:00
Augustin Cavalier
7de24641a4 freebsd_network: Adjust address validation in bus_dma code.
We need not (in fact, must not) revalidate addresses if we are just
going to coalesce with the previous segment; otherwise, we will incorrectly
reject buffers that are more than page-aligned.

Should fix #17798 and the new KDL in #14260.
2022-06-13 15:05:25 -04:00
Augustin Cavalier
73603a5163 freebsd_network: Clean up bus_dma code.
* Turn lastaddrp into a reference instead of a pointer.
 * Use PAGESIZE instead of B_PAGE_SIZE for consistency.
 * Rename "nsegs" variables to "seg" as it is an offset and not a count.

No functional change intended.
2022-06-13 14:54:40 -04:00
PulkoMandy
ed666fb497 usb_rndis: fix 32bit build 2022-06-11 21:33:14 +02:00
PulkoMandy
fb02142782 usb_rndis: fix handling of multiple packets in one USB transaction
I got my pointer math wrong because some things in RNDIS use uint32 as
the base, but some things are in bytes. Most of the time this would result
in an offset past the end of the USB buffer, so it would just lead to
ignoring all but the first packet. But if the first packet was small enough,
it would point somewhere still in the buffer, and we would read the wrong
data.

Fixes #17775

Change-Id: I32ec0081336b1f772d4dc3099a0ac2c691aa12f0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5377
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2022-06-11 19:03:48 +00:00
PulkoMandy
4dda1c0369 usb_rndis: use the "data offset" field instead of hardcoding it
Not sure if other phones could use another value, but it's better to
follow the spec. Also add some bounds checks with traces for now if we
see something strange.

Change-Id: I5c7bc37c4730e6a08bf0bf10fed975bf2012102e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5376
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2022-06-11 19:03:48 +00:00
Augustin Cavalier
802e16c55a freebsd_network: Add missing store of the passed buffer length.
This broke bouncing of anything not an mbuf.
Confirmed to fix #17778, and may fix other problems too.
2022-06-10 23:00:49 -04:00
Augustin Cavalier
ca76d4c336 freebsd_network: Add missing case for MCLBYTES in m_get2.
The first case is really just a standard mbuf without a cluster.
MCLBYTES should be the second case. This matches what FreeBSD does.
2022-06-10 14:33:05 -04:00
Augustin Cavalier
fe476826e7 freebsd_network: bus_size_t seems to always be no larger than void*.
FreeBSD seems to do this, too, and sets BUS_SPACE_MAXSIZE appropriately
(which it seems we already do.) Fixes 32-bit builds following previous
commits.
2022-06-10 14:06:49 -04:00
Augustin Cavalier
10f4c2bd71 Revert "nforce: Disable MTU changes."
This reverts commit 25742b78fb.

It was confirmed the MTU change introduction was unrelated to the
problems seen in this ticket.
2022-06-10 13:43:30 -04:00
Augustin Cavalier
30763b1e79 freebsd_network: Rewrite bus/vm headers to use Haiku phys_addr types directly.
Instead of redeclaring them, which it did so incorrectly on systems
with PAE in some cases. May fix problems on some 32-bit systems.
2022-06-10 13:38:08 -04:00
Augustin Cavalier
3c5b619e97 freebsd_network: Remove unneeded frees of if_l2com.
After 458c40fb27, if_l2com is not
allocated anymore, but I missed deleting these at that time.
2022-06-09 18:55:17 -04:00
Augustin Cavalier
9690b012b4 libroot/musl: Import riscv64 atomic_arch.h. 2022-06-09 18:46:09 -04:00
Augustin Cavalier
36ef2106b7 strace: Add second entry in TypeHandler for const msghdr*.
This way sendmsg's argument will also be traced.

Change-Id: I40b44ffc732d884393f944bc2b1ced7b0a551287
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5354
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2022-06-09 22:36:38 +00:00
Augustin Cavalier
3b4737b9e5 headers: Remove bsd_mem.h.
This is a holdover from BeOS. All the functions in here we declare
in other headers, so this is not needed.
2022-06-09 18:31:08 -04:00
Augustin Cavalier
0d29def7d2 kernel/lib: Adjustments to use musl's ffs implementation.
This actually has another advantage: if we can use musl sources
in the kernel POSIX support, then we can drop some of the BSD
sources that are used only in the kernel and have a different
implementation in userland (e.g. strtod) and have just one
version for both.
2022-06-09 18:29:33 -04:00
Augustin Cavalier
0afb8a1b49 Move fts.h and functions from libroot to libbsd.
These are BSD extensions, not POSIX functions. They were needed
in libroot by the previous versions of the ftw/nftw implementations,
but the musl versions do not need them, and so we can move them to
libbsd.

This is a minor ABI break, but hopefully whatever was using them
in libroot also links to libbsd. If not, that's an easy enough fix.
(These were only added to libroot in 2013.)
2022-06-09 16:30:40 -04:00
Augustin Cavalier
9b2434d26f libroot: Replace ftw/nftw implemenations with their musl counterparts.
Rewrite ftw.h to be a Haiku header instead of a BSD one while at it.
2022-06-09 16:24:11 -04:00
Augustin Cavalier
22b1d791b2 libroot: Replace getsubopt implementation with musl's.
It looks to be a bit more optimized, and one less thing for
us to have to maintain from POSIX.
2022-06-09 16:06:56 -04:00
Augustin Cavalier
092b6d4a98 libroot: Replace custom ffs implementation with musl's.
It already has a per-arch implementation or a fallback in
musl's own arch_atomic.h, which we already imported so we
might as well leverage it.
2022-06-09 16:04:11 -04:00
Augustin Cavalier
2b609f8f66 openbsd_network: Add implementation of pci_intr_map.
This is not used anywhere, but X512 will need it for testing
some things on RISC-V.
2022-06-09 15:57:48 -04:00
PulkoMandy
d13068c148 iaxwifi200: add to regular image 2022-06-09 21:26:47 +02:00
PulkoMandy
d5af5c5521 iaxwifi200: disable background scans for now
It crashes the firmware after 40 scans. The issue has been reported to
OpenBSD, until then we can leave this disabled. The consequence is that
the wifi network list will not refresh while already connected to a
network. But at least the connection remains online.
2022-06-09 21:26:47 +02:00
Augustin Cavalier
5797a8dec5 graphics/nvidia: Fix another instance of missing READ/WRITE protection flags.
Related to #17766.
2022-06-09 13:53:49 -04:00
Augustin Cavalier
0bee9ee711 openbsd_wlan: Refactor implementation of IEEE80211_IOC_SCAN_RESULTS.
* Do not allocate an equally-sized buffer for all scan results,
   but just alloca() a buffer for a single result, and copy this
   back to userland at the end of each iteration.

 * Check remaining space correctly with respect to IE data.

May fix incorrect scan results or userland memory corruptions
seen with the previous code. Also should be faster since it
does not need to allocate large kernel-side temporary buffers.
2022-06-09 13:35:48 -04:00
Augustin Cavalier
5a4ad3a00d openbsd_wlan: Print state changes if bootverbose is enabled.
This will make debugging in nightly syslogs a bit easier when things
do not work as expected.
2022-06-09 01:28:56 -04:00
Augustin Cavalier
ea7c830790 openbsd_wlan: Implement IEEE80211_IOC_MLME for leaving networks. 2022-06-09 01:28:56 -04:00
Augustin Cavalier
2f7936a683 openbsd_wlan: Add a Haiku-specific "FreeBSD-style" ioctl for joining networks.
In the long run it may make more sense to have Haiku-style ioctls for
this purpose, but since we are currently coexisting with FreeBSD-style
ioctls, just add this as another FreeBSD-style ioctl for now (we already
have two custom ones anyway.)

This ioctl pretty much just consists of the same parameters we pass
to wpa_supplicant using the Haiku-specific constants already, with one
notable difference: the PSK must be in proper WPA format, i.e. already
hashed. Hence we will submit this ioctl, for now, from our own code in
our wpa_supplicant port.

WPS is not implemented in this commit, but it could be if someone actually
needs to connect to WPS networks for some reason...

Tested and verified as working along with the wpa_supplicant changes.
2022-06-09 01:28:56 -04:00