Commit Graph
100 Commits
Author SHA1 Message Date
Augustin Cavalier 4a2e65d8ee HaikuPorts/x86_gcc2: Update. 2022-07-08 00:18:31 -04:00
Augustin Cavalier 8fdcd41eec BuildFeatures: Remove versions from libraw and libavif SONAMES. 2022-07-07 23:18:45 -04:00
Augustin Cavalier 4726114d97 HaikuPorts/x86_64: Update. 2022-07-07 22:46:07 -04:00
Augustin Cavalier 4767301e20 haiku_datatranslators: Remove libraw version specification.
update_package_dependencies should take care of this for us.
2022-07-07 22:45:45 -04:00
Augustin Cavalier 1fca581180 bootloader & kernel: Build zlib with -Wno-error=missing-prototypes.
Will be needed for some newer zlib versions.
2022-07-07 22:45:19 -04:00
Augustin Cavalier b5eee5ce22 openbsd_network: Correct return values of m_dup_pkthdr and m_tag_copy_chain.
FreeBSD's versions return 1 on success, OpenBSD's return 0.
Fixes at least some of the packet loss in OpenBSD WiFi drivers.
2022-07-07 16:41:49 -04:00
Augustin Cavalier d51cccd9a5 Revert "freebsd_network: Adjust callout_reset to drain not stop callouts."
This reverts commit 259f9a76d8.

This does not work with callouts that reschedule themselves, which is
something certain drivers indeed do.
2022-07-07 15:46:47 -04:00
Augustin Cavalier 259f9a76d8 freebsd_network: Adjust callout_reset to drain not stop callouts.
As we are going to modify func/arg, we need to be sure they are not
even executing.
2022-07-07 14:58:02 -04:00
Augustin Cavalier a73773b24e freebsd_network: Clean up struct callout.
* Remove unused flags field.
 * Rename internal members to have c_ at the beginning, like FreeBSD.
2022-07-07 14:57:23 -04:00
Augustin Cavalier af11bc7bc7 freebsd_network: Correct time_uptime.
It should be in seconds, not ticks.
2022-07-07 14:56:33 -04:00
Augustin Cavalier 93f2021912 openbsd_network: Fix return values of timeout functions.
As far as I can tell, nothing checks these, so this should not
actually make any kind of difference.

The timeout_set change is also not a functional one, either,
as callout_init with mpsafe=0 uses &Giant also.
2022-07-07 14:44:53 -04:00
Augustin Cavalier 631f505f82 freebsd_network: Fix callout_active checking in callout_stop.
We have to perform the "due" check after checking callout_active,
because due is set to -1 while the callout is actually active.
2022-07-07 14:43:27 -04:00
Augustin Cavalier fbff149ce2 openbsd_network: Refactor if_input_openbsd to use ml_dequeue.
Should not be any functional change.
2022-07-07 12:46:15 -04:00
Augustin Cavalier e3056a7eff vesa & framebuffer accelerants: Drop engine hook stubs.
We don't need to provide them after the previous commit.
2022-07-07 11:52:51 -04:00
Augustin Cavalier 2270ca94f1 app_server: Make engine accelerant hooks optional.
We don't need them here, or anywhere else for that matter, to run.
2022-07-07 11:52:00 -04:00
Augustin Cavalier 6489b77dee nvme_disk: Fix build on non-PAE 32-bit architectures. 2022-07-06 20:55:04 -04:00
Augustin Cavalier 50d29435e9 app_server: Mild cleanup to ScreenManager.
The #ifdefs for test mode are now more appropriately located.
2022-07-06 19:53:30 -04:00
Augustin Cavalier 5c3aa92735 app_server: Refactor and improve graphics device iteration.
* Do not open() devices while looping but only open() the one
   we were actually asked to open.

 * Try the VESA or Framebuffer driver even if deviceNumber is something
   other than 1.

 * Start iterating at 0 instead of 1 following loop iteration changes.

Ideally this iteration should occur a completely different way, in order
to properly support multiple graphics cards, but that's a problem for
another day.

Fixes #4303.
2022-07-06 19:52:23 -04:00
Augustin Cavalier ab8109c152 app_server: Fix build of test_app_server. 2022-07-06 18:10:14 -04:00
Augustin Cavalier a68b6c2579 app_server: Move DWindowHWInterface and ViewHWInterface to a subdirectory.
AccelerantHWInterface and the Remote engines already did this.
These are not used at all outside of test_app_server, so we do not
need to even compile them in to the regular one.
2022-07-06 17:56:12 -04:00
Augustin Cavalier 40d99076df openbsd_network: Move mbuf_list and mbuf_queue into mbuf-obsd.h. 2022-07-06 17:23:40 -04:00
Augustin Cavalier 0297582112 openbsd_network: Implement two mbuf macros in terms of FreeBSD ones. 2022-07-06 17:07:49 -04:00
Augustin Cavalier 41d93c5ed1 freebsd_network: Do not deinitialize USB if we never initialized it.
Fixes some "mutex not owned" KDLs seen on deinitialization.
2022-07-06 16:03:46 -04:00
Augustin Cavalier 19453ce798 freebsd_network: Unlock taskqueues before final destruction.
This is needed for MTX_SPIN taskqueues.
2022-07-06 16:03:46 -04:00
Augustin Cavalier f5eecfe4ea openbsd_network: Remove shadowing variable. 2022-07-06 13:42:43 -04:00
Augustin Cavalier 138d4bbd68 nvme_disk: Refactor 64-bit BAR handling into nvme_pcicfg_get_bar_addr_len.
Then invoke this function in nvme_pcicfg_map_bar instead of duplicating
the logic.
2022-07-06 13:42:43 -04:00
Augustin Cavalier d6fedd7fcf Userguide CSS: Fix banner color. 2022-07-06 12:01:20 -04:00
Augustin Cavalier 06b68f46f9 kernel/fifo: Add missing check for B_SELECT_READ in Deselect().
This should have been part of 27fda3e46f.
Fixes #17826.
2022-07-06 11:13:00 -04:00
Augustin Cavalier 6fd4a3eea9 XHCI: Set the DIR_IN bit on Status Stages even if there is no data.
The referenced section of the specification gives no indication that
the bit should not be set if there was no data; indeed it indicates
it should always be set.

This brings our behavior here in line with other OSes seem to do.

Change-Id: I86b2eb2a6a5fa3af84fd0941e0a3ec601c7037bf
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5421
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2022-07-04 17:14:45 +00:00
Augustin Cavalier e0a405d765 openbsd_network: Use the new bus_dmamap_sync_etc.
This preserves the semantics of partial syncs. Unfortunately in my
testing it does not seem to improve the packet loss I was seeing...
2022-07-01 23:16:28 -04:00
Augustin Cavalier b12b802c4d freebsd_network: Add an extended bus_dmamap_sync API for partial syncs.
To preserve proper semantics with the OpenBSD layer, this is needed.
2022-07-01 23:15:07 -04:00
Augustin Cavalier 7ff2f10462 OpenBSD wlan drivers: We cannot back out of initialization at preinit.
Otherwise we get KDLs. Fixes #17811.
2022-07-01 22:09:06 -04:00
Augustin Cavalier 27fda3e46f kernel/fifo: Properly support opening FIFOs in O_RDWR mode.
While pipe() only supports a read end and a write end, named FIFOs
are supposed to allow opening in read/write mode (which, indeed,
is something the Fish shell seems to require.)

The code that checks open_mode in the read/write routines was introduced
all the way back in 2003 (2469f26dfc).
At that time, the VFS did not do open_mode checks on FDs in the
I/O syscalls, so these doubled as permissions checks. Now, however,
the VFS does check that in common_user_io, so we can remove these
entirely and let things behave as they should.

Additionally, there is now also no reason to prevent select()ing
on both events for the same FD independent of open_mode, so
allow that too.

Change-Id: Ib3cba76d18e91b7c00d1695e8d29dd47cae06b79
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5427
Reviewed-by: waddlesplash <[email protected]>
2022-07-01 18:57:28 +00:00
Augustin Cavalier 2884a00088 ralinkwifi: Import USB modules.
Not entirely sure if these are working as they were not really tested.
But they don't seem to cause KDLs at least, so the worst that happens
is that the WiFi devices fail to work.
2022-06-29 13:17:15 -04:00
Augustin Cavalier e410069738 freebsd_network: Implement USB routines needed by Ralink USB modules.
Tested by nephele with a RT2573. The device starts and scans for networks,
but hits some USB errors probably related to buffer sizing which I'm
not quite sure what the cause of could be. More work (by someone who
owns these devices) may be required.
2022-06-29 13:16:13 -04:00
Augustin Cavalier db4df8fcf5 freebsd_network: Use the real usb_endian.h.
Turns out some FreeBSD drivers use these macros on types other
than the ones declared in this header and expect them to behave
as array accessors, so we really do have to keep the originals.
2022-06-29 13:14:47 -04:00
Augustin Cavalier 00096a9d1f USB: Add default max packet size for SuperSpeed bulk endpoints.
We already had one for High-Speed endpoints, but SuperSpeed endpoints
also have a fixed size, similar to Control endpoints.

May help with some devices failing to configure.
2022-06-29 10:36:36 -04:00
Augustin Cavalier 045f7a5f3a headers/bsd: Rewrite link_elf.h.
Include only the APIs we are (shortly) going to actually support.

The other structures and functions declared in this file were
never supported nor used anywhere in Haiku's tree.
2022-06-28 13:07:53 -04:00
Augustin Cavalier 63816858af boot/platform/u-boot: Drop ARM support.
Newer versions of u-boot support EFI natively, which is what we
have been making use of instead.

There may be some use for the "native" u-boot loader still on PowerPC,
but otherwise the EFI support is much more advanced and even in u-boot
supports as or more features than "native" loaders, so there is no
reason to keep this around.
2022-06-28 12:27:06 -04:00
Augustin Cavalier c95c5ed821 idualwifi7260: Merge patch from OpenBSD for some 9xxx devices. 2022-06-22 14:34:17 -04:00
Augustin Cavalier a928b16e36 freebsd_network: Unlock the taskqueue before waiting for threads.
Also set tq_threads to NULL to prevent double-frees.
2022-06-22 00:34:37 -04:00
Augustin Cavalier 7e1c1d3020 openbsd_network: Adjust reference-taking in bus_dmamap_load_mbuf.
dm_segs is a flexible-length array at the end of a structure.
Taking its address with & gives the same address as using it without,
however, the types are not identical in the different cases.

This should fix some warnings about incompatibile pointer types
while not changing behavior.
2022-06-21 23:23:02 -04:00
Augustin Cavalier 4b6af34c06 kernel: Move aligned_alloc to heap.cpp alongside calloc.
It is independent of whatever heap implementation is actually in use,
so it belongs in here (even if this file is probably not the right
place for such functions in the first place.)

This allows the kernel to be built once again with things other than
the default slab heap.
2022-06-21 22:59:57 -04:00
Augustin Cavalier 8e059bfa63 ralinkwifi (ral): Upgrade to FreeBSD 13.1
One new device ID.
2022-06-21 17:34:52 -04:00
Augustin Cavalier b071913066 freebsd_network & drivers: Remove need to specify FBSD_TASKQUEUES.
Instead make FBSD_TASKQUEUES a combination flag of all taskqueues,
so that if even one is needed, the init_taskqueues function will
be invoked appropriately.
2022-06-21 17:22:37 -04:00
Augustin Cavalier b4bf3ed0d5 drivers/network: Adjust all HAIKU_DRIVER_REQUIREMENTS for taskqueues.
Many of these did not need taskqueues at all. Others can hang off
the WLAN feature's implicit usage of taskqueues.
2022-06-21 17:12:29 -04:00
Augustin Cavalier 0163191229 freebsd_network: Rework taskqueues implementation.
* Use FreeBSD's queue management directly, only retaining thread
   creation and synchronization functions from Haiku.

 * Use FreeBSD's task structure declarations.

 * Use a standard non-FAST taskqueue for taskqueue_thread.

 * Rewrite header and adjust consumers as appropriate.
2022-06-21 16:17:50 -04:00
Augustin Cavalier ed20f6660f glue: Add comment that argv_save and __main_thread_id need not be set here.
But they still are so the glue code is compatible with older Haiku versions.
2022-06-21 13:16:07 -04:00
Augustin Cavalier c27c987075 freebsd_network: Fix address restriction computation in bus_dma.
The min/max usage was reversd from what it should be. This
would have led to the least restrictive restrictions being the
ones that were checked, instead of the most restrictive.
2022-06-21 12:24:04 -04:00
Augustin Cavalier 2c81f88085 freebsd_network: Clean up bus_dma restrictions implementation.
* Remove support for filters (again): they are deprecated in FreeBSD
   and no driver we have uses them. This allows the loop in the
   _validate_address function to be dropped entirely.

 * Clean up parent tag handling logic.
2022-06-21 12:24:04 -04:00
Augustin Cavalier b3dab377a9 idualwifi7260 & iaxwifi200: Enable PCI busmastering.
The FreeBSD KPIs that we emulate expect this to be done manually,
so we have to do it before we begin doing PCI access.

Fixes firmware load failures and device initialization problems
since the introduction of the OpenBSD driver replacing the FreeBSD one.
2022-06-20 17:17:20 -04:00
Augustin Cavalier 561bb7bac5 idualwifi7260 & iaxwifi200: Do not return but go to the appropriate fail.
This way, we will actually tear down what state got initialized.
2022-06-20 17:15:45 -04:00
Augustin Cavalier 22bdb7ba70 iaxwifi200: Add missing if_free_inplace on deinit.
It may make sense to place this later so that we don't need to add
another goto label, but that can be experimented with later.
2022-06-20 17:14:53 -04:00
Augustin Cavalier 891bd14810 packages/Haiku: Clean up WiFi firmware rules.
* Nothing uses the plural forms anymore, so drop them.
 * Nothing uses the "PACKAGE" field, so drop it.

Once the Marvell driver is migrated to use a package instead of the
archive, we can drop even more of this related to HAIKU_WIFI_FIRMWARE_DO_EXTRACT.
2022-06-20 13:27:13 -04:00
Augustin Cavalier 33d311a64b HaikuBootstrap: WiFi firmware rules not needed.
The WiFi firmware rules are only needed for a few very old drivers.
Any devices we are going to bootstrap on will use one of the wifi_firmwares
packages instead.
2022-06-20 13:25:58 -04:00
Augustin Cavalier 2e1033fcf1 idualwifi7260 & iaxwifi200: preinit() can fail.
This will prevent the device from even appearing in Network preferences
if firmware loading does not work.
2022-06-20 13:04:00 -04:00
Augustin Cavalier f578843da4 idualwifi7260 & iaxwifi200: Use the Haiku gDriverName instead of hardcoding.
This also will fix what name appears in the syslog.
2022-06-20 13:03:20 -04:00
Augustin Cavalier 7ac9dc6612 freebsd_network: Use a dedicated USB mutex instead of &Giant.
Fixes #17804.
2022-06-20 13:02:32 -04: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
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 <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
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
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
Augustin Cavalier 7cb5a6d24f NetworkDevice.h: Make it possible to include from _KERNEL_MODE and/or non-C++.
This file contains a set of constants and flags which are already passed
between applications, net_server, and wpa_supplicant to indicate network
security, connection modes, and a variety of other things.

As the OpenBSD net80211 stack does not need wpa_supplicant for WPA2/PSK,
it only makes sense that we would pass the same information we pass
to wpa_supplicant into the stack instead. Rather than expose yet another
set of constants and flags to userland besides the FreeBSD and these
Haiku native ones, just make it so this file can be included in the kernel,
and the constants thus used directly.
2022-06-09 01:28:56 -04:00
Augustin Cavalier bcb089f6c3 openbsd_wlan (and FreeBSD ieee80211_ioctl.h): Initial ioctl compatibility.
* Introduce IEEE80211_IOCTLS_ABBREVIATED to FreeBSD's ieee80211_ioctl.h,
   so that the FreeBSD header can be included along with the OpenBSD
   net80211 stack without triggering lots of errors, so we can use
   these structs in openbsd_wlan ieee80211_haiku.cpp.

 * Implement basic ieee80211req handling machinery. We aren't going
   to handle anything but SIOCG80211 and SIOCS80211 in this method,
   so we can simplify it a bit at the same time.

 * Implement IEEE80211_IOC_SCAN_RESULTS to return scan results from
   the OpenBSD WiFi stack in FreeBSD ioctl format.

   This change adds two minor "features" (noted with #ifdefs) to the
   OpenBSD net80211 stack: one to specify what node index to return
   when returning known nodes (scan results), as this way we do not
   have to allocate a huge buffer to store the scan results in before
   sending them back to userland, but can instead get and convert
   a single one at a time.

   (We store the converted values in kernel mode all at once, though,
    so this is not as efficient as it could be. More improvement possible.)

 * Implement IEEE80211_IOC_BSSID and IEEE80211_IOC_SSID while we are at it.
   This actually may make joining open networks possible, but I didn't
   really test it. (They are used with SIOCG80211 to see what network
   the device is currently connecting/connected to.)
2022-06-09 01:28:56 -04:00
Augustin Cavalier fba0315889 idualwifi7260 & iaxwifi200: Adaptations for FreeBSD/Haiku support.
Mostly a few #ifdefs for the dmamem API, if_alloc, probe, and attach hooks.
Basically the same changes in both drivers.

The firmware name map is not really needed anymore; the OpenBSD drivers
have unique firmware names and do not generally use ".ucode" extensions.
So just use the filenames as-is and drop the map.
2022-06-09 01:28:55 -04:00
Augustin Cavalier eb56146603 openbsd_wlan: Basic adaptations to the net80211 layer.
The stack now compiles and links. Combining this with adaptations to
the driver gets things to the point where it runs scans, but we do
not yet implement ioctls so they can be returned to userland.
2022-06-09 01:28:55 -04:00
Augustin Cavalier 27a20680c5 iaxwifi200: Import ("iwx" from OpenBSD.)
Not yet modified to build nor wired into the build yet.
2022-06-09 01:28:55 -04:00
Augustin Cavalier d87dd30a38 idualwifi7260: Delete FreeBSD driver, import OpenBSD driver.
Again not wired into the build, nor yet modified in any way.
2022-06-09 01:28:55 -04:00
Augustin Cavalier 04171cfc5c openbsd_wlan: Import OpenBSD net80211 layer and base dependencies.
Not yet wired into the build, of course.
2022-06-09 01:28:55 -04:00