Commit Graph

59398 Commits

Author SHA1 Message Date
François Revol
b98f12a601 freebsd_network: use proper BAR size in bus_alloc_mem_resource
This time we use the pci_info directly, it avoids a possible race with
PCI config regs, and we already have the value there anyway.

Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
One crucial fix by me: check if size == 0. This avoids the deadlock
seen in #14795.
2019-01-05 14:45:54 -05:00
Augustin Cavalier
a29a8f98ed drivers/network: Mark all FreeBSD ethernet drivers as upgraded to 12. 2019-01-04 21:16:00 -05:00
Augustin Cavalier
eababbb4cf drivers/network: Upgrade sis900, syskonnect, via_rhine, vt612x to FreeBSD 12.
No real functional change.
2019-01-04 21:15:15 -05:00
Augustin Cavalier
6d2ae71f16 drivers/network: Upgrade rtl8139, rtl81xx to FreeBSD 12.
Includes some logic fixes to Haiku-specific code in the MII drivers,
and one new chipset supported by the rtl81xx MII driver. Otherwise,
no major functional change.
2019-01-04 21:13:33 -05:00
Augustin Cavalier
2b5a056e03 drivers/network: Upgrade jmicron2x0, marvell_yukon, nforce, pcnet, rdc to FreeBSD 12.
No real functional change in these.
2019-01-04 21:12:24 -05:00
Augustin Cavalier
2afe8644cf freebsd_network: Restore the hard-coded 128KB physical map size.
mmu_man changed this to be dynamically computed based on the BAR size.
It seems his computation was somehow incorrect, as it tries to allocate
a very large region here which deadlocks in the physical memory mapper.
Restoring this to 128KB un-breaks the new ipro1000 driver on more
recent hardware.

"Fixes" #14795.
2019-01-04 18:07:11 -05:00
Augustin Cavalier
a381a48f86 ipro1000: Always use DELAY() for microsecond pauses (on Haiku.)
pause() has granularity of "hz", which on FreeBSD and in our compat layer
is defined to be 1000 (so, 1ms.) As "safe_pause_us" is used copoiously
throughout startup code, this meant that (1) startup takes 100-1000x longer
than it needed to (this driver seems to most commonly delay for 10us),
and (2) this could in theory block the boot for multiple minutes if one
got particularly unlucky with the scheduler.

Probably helps with or even outright fixes #14795.
2019-01-04 17:06:22 -05:00
Augustin Cavalier
046ae71e48 EFI: Handle "Escape" scancode properly.
This should fix the Escape key being non-functional in the EFI loader
menus, which is pretty annoying when one is drilling through lots of
menus to blacklist files...
2019-01-04 16:52:42 -05:00
Rob Gill
6086986d30 kernel/x86: additional msr and cpuid items
Adds SSBD and L1TF related items

Change-Id: Iccea2bb9e057e0d011a18609212f175f9b5e678d
Reviewed-on: https://review.haiku-os.org/825
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2019-01-04 19:06:05 +00:00
Rob Gill
3987287dc6 bin/sysinfo: bugfix & update
Fixed bug where incorrect value of ECX passed when determining L2 cache

Updated cache/TLB identification
Updated CPU flags

Change-Id: I086f8bf7f86cba0d65e45450c74ec6e11e6bec2e
Reviewed-on: https://review.haiku-os.org/824
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2019-01-04 19:05:49 +00:00
Augustin Cavalier
189ed5d806 freebsd_iflib: Get the thread_id from the thread* indirectly.
This is needed on 64-bit.
2019-01-03 23:43:20 -05:00
Augustin Cavalier
3a031789fe freebsd_network: Add a missed method ID.
Some less-used drivers (e.g. marvell_yukon) need this.
2019-01-03 21:20:37 -05:00
Augustin Cavalier
8084e7c566 freebsd_network: Add cast so mbuf.h can be included as C++.
It is, as ieee80211_haiku is a C++ file.
2019-01-03 21:20:36 -05:00
Augustin Cavalier
67a0cb89e6 ipro1000: Upgrade to FreeBSD 12.
Thanks to AGMS for helping test on real hardware!
2019-01-03 21:20:36 -05:00
Augustin Cavalier
db4f8332f0 freebsd_network: Reinstate _fbsd_init_hardware and refactor probing.
Previously we just probed and then immediately attached if any devices
were found, after all initialization was done. Now we cannot do that,
as after calling SYSINIT() on certain drivers (e.g. the new ipro1000
driver), certain threads will be created that there is no good way
of tearing down.

Fortunately, it is valid to call probe() on a device before SYSINIT()
(and most other things) have been initialized, and so now we do that
in init_hardware, and then init_driver is called only if we've found
devices we support.

While we're at it, also call pci->reserve_device, which will mark us as
the driver handling said device and prevent other drivers from
using it.
2019-01-03 21:20:36 -05:00
Augustin Cavalier
83c8026372 freebsd_iflib: Import.
This is the iflib from FreeBSD 12.0 with a few select patches from
FreeBSD trunk applied (and a lot of #ifdef __HAIKU__s, as you can see.)

There are certain things it adds to SYSINIT that can't be un-initialized
(like the grouptaskqueues), and so rather than adding this to every
driver unnecessarily, a separate .a for it makes the most sense.
2019-01-03 21:20:36 -05:00
Augustin Cavalier
fd41233b07 freebsd_iflib: Import compatibility files.
These are the portions of "freebsd_iflib.a" that I've written and
do not come from FreeBSD. As the import of iflib itself will be
quite large, having a separate commit for these made sense.
2019-01-03 21:20:35 -05:00
Augustin Cavalier
81acff62c6 freebsd_network: Handle published conditions with timeout 0.
Previously, since we passed B_RELATIVE_TIMEOUT unconditionally,
a timeout of 0 would mean that it would return as soon as there was
CPU time available (so, usually, instantly.) This usually was not
a "problem" in that it caused broken behavior, but it would result
in exceptionally high CPU usage.

At first I implemented this correctly (i.e. a timeout of 0 will block
until explicitly woken up) but then discovered that our implementation
of these functions creates subtle race conditions compared to their
FreeBSD counterparts, and so to avoid deadlocks, a timeout of 1 second
is imposed. For situations where there are deadlocks due to race
conditions, this will make them painfully obvious (e.g. all network
transfers stalling for a second every 2-3 seconds or so.)
2019-01-03 21:20:35 -05:00
Augustin Cavalier
a029a69c55 freebsd_network: Properly align mbuf members. 2019-01-03 21:20:35 -05:00
Augustin Cavalier
6ef670c379 freebsd_network: Consolidate and unify SMP-related definitions.
Previously I implemented "curcpu" as ipro1000 used it, independent
of all the other SMP functions, as an optimization. Now, iflib
wants to use these functions all together, so they have to produce
consistent results.
2019-01-03 21:20:35 -05:00
Augustin Cavalier
8582775421 freebsd_network: Implement m_cljget without mbuf.
This returns an ext_buf that can be attached to an mbuf later,
which is something iflib does.
2019-01-03 21:20:34 -05:00
Augustin Cavalier
a9116ea8db freebsd_network: Add an "id" field to struct device_method.
"const char* name" is alright for the compat layer's needs to
identify functions, as we only scan the method table once and
copy the function pointers to a struct of function pointers.

iflib doesn't use a function pointer struct, though, and expects
to have the KOBJ system for function lookups, and that depends
on integer-based method IDs for fast lookups. So now every
method gets an integer ID as well as a name (and iflib's method
IDs are in the list of method IDs already.)
2019-01-03 21:20:34 -05:00
Augustin Cavalier
c25e20c5f9 freebsd_network: Add device_register hook as a recognized hook.
iflib-based drivers use it.
2019-01-03 21:20:34 -05:00
Augustin Cavalier
da60a673b6 freebsd_network: Implement SYSINIT.
Based on the already-existing linkersets framework, which seems to
work pretty well for the atheroswifi driver, so it should work for
this case also.
2019-01-03 21:20:34 -05:00
Augustin Cavalier
8267c19341 freebsd_network: Lots of additions and modifications for iflib. 2019-01-03 21:20:34 -05:00
Augustin Cavalier
88c3c4fa49 freebsd11_wlan: Disable sysinits.
These are currently no-ops; but soon enough they won't be...
2019-01-03 21:20:33 -05:00
Augustin Cavalier
92d70a24ca freebsd_network: Fix and implement some mbuf functions.
Spotted while reviewing the code during iflib porting.
2019-01-03 21:20:33 -05:00
JackBurton79
fe55edcaf4 Terminal: Font width can be a fractional value, so we need to use a float.
Adapt other code accordingly. Minimum changes to fix ticket #11478
In theory also font height could be fractional, so we might need to
review other parts of the code.

Change-Id: Idbdbe38193ca5a32b3d09c7cf9accfc917760cae
Reviewed-on: https://review.haiku-os.org/821
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
2019-01-03 21:27:27 +00:00
PulkoMandy
4c1d9cf74e Fix "since" entries in BPropertyInfo.
These methods and fields are missing from the R4 and R5 Be Book, but are
mentionned in the R4 release notes and present in the R5 headers.

Change-Id: I4de8298449bd66e0ee7fe0b52690552916314123
Reviewed-on: https://review.haiku-os.org/820
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-01-03 19:09:22 +00:00
Stephan Aßmus
f8550e541b Added two DrawStringDry() versions for obtaining pen location only
When recording into a BPicture (ServerPicture, actually), one cannot
simply record the commands only, when the drawing itself would modify
state. This affects all drawing commands that change the pen location.
Therefore it is necessary to have a way to "dry-run" drawing a string
in order to know the pen location that would result. This is what
these two new methods help achieve.

Change-Id: Ic399a5513f18c12c16c0ab10a55e768c1b30e4e0
Reviewed-on: https://review.haiku-os.org/816
Reviewed-by: Rene Gollent <rene@gollent.com>
2019-01-03 18:19:02 +00:00
Michael Lotz
6990ae7b84 Installer: Fix use-after-free of target directory name.
When CopyEngine::_CopyFolder() would recursively call itself, the
fCurrentTargetFolder would be set to the entry name of that directory.
When this returned, this was never reset to the parent directory name
and would eventually use a freed string when the BEntry was reused
for the next entry.
2019-01-03 14:08:59 +01:00
Stephan Aßmus
f10faf61ac Change DrawString() and add StrokeLine() to reveal wrong pen-position
Change-Id: Iec584657741f2bb682bff557dcd3b733a9166c7c
Reviewed-on: https://review.haiku-os.org/815
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-01-02 21:21:52 +00:00
Stephan Aßmus
1876ba00cd DrawState: Return mask from ReadFontFromLink()
When changing the font state, a uin16 mask at the beginning of the
commands encodes which font parameters are transmitted in the link
data. Return this mask, so that one can know what parameters have
changed in the DrawState's ServerFont.

Change-Id: I52a9a665aac8eb0e6505193eba32c4b137846c78
Reviewed-on: https://review.haiku-os.org/814
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-01-02 21:21:52 +00:00
Michael Lotz
ddb1ff5587 kernel/x86_64: Fix overwriting the GDT/IDT by each CPU.
The constructor calls for GlobalDescriptorTable and
InterruptDescriptorTable were run on each CPU, each time clearing out
any changes already done on other CPUs.

For the IDT this didn't matter as the result would always be the same.
In case of the GDT the result would surprisingly be mostly hidden. The
used GDT entries are for the double fault stacks (which is rarely hit),
the user TLS (which will only be used in compat mode) and the TSS which
is immediately cached in the task register.

The clearing of the GDT allowed for a tiny window of time between
setting up the entry for the TSS and it actually being loaded (and
cached) in the task register. When this happened, the load of the TR
caused a not present fault, which at this point leads to a tripple
fault and reset due to no fault handlers being installed yet.

Fixes #14659.

Change-Id: I6e5c00d412ab17c3ef05740ba71228e6ca266c1e
Reviewed-on: https://review.haiku-os.org/810
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2019-01-02 16:27:53 +00:00
Michael Lotz
22ca923f71 kernel/x86_64: Fix descriptor index off-by-one in assert.
This was apparently copied from GlobalDescriptorTable::SetTSS() which
needs two table entries and therefore checks for index + 1. For the
SetUserTLS case this isn't needed and would cause aborts when reaching
the maximum CPU count (64 currently).

Change-Id: I27bd777fedadbd3740ac8c791199ec9300b06327
Reviewed-on: https://review.haiku-os.org/809
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-01-02 00:22:14 +00:00
Michael Lotz
44a1cfb8d8 kernel/x86: Reimplement locking for early boot message output.
The normal locking uses spinlocks that require getting at the current
CPU, which in turn needs a current thread set. This has not been set up
at this point and would simply cause tripple faults.

Use manual locking using atomic ops instead.

Change-Id: Ica894389330ef481eec84b667234139746ac4a46
Reviewed-on: https://review.haiku-os.org/808
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-01-02 00:22:14 +00:00
Adrien Destugues
d52d36aa5d open: don't print "invalid argument" when opening an URL.
Reset the error code.

Change-Id: I5b58c3082f5758d4cbca8c9706048e3414f939c9
Reviewed-on: https://review.haiku-os.org/807
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-01-01 17:48:29 +00:00
Humdinger
b02e6250e9 Mail: fix layout when resending
When resending a mail, don't put the To-field in the second column
after the From-field as it's done for incoming mail. To- and From-field
are the same layout as for creating a new mail.

Use the member fResending instead of the parameter "resending" the
THeaderView was called with.

Initialize fCcControl in ctor.
2018-12-30 10:39:33 +01:00
Michael Lotz
02f41b1a74 app_server: Cleanup argument checks to use boolean expressions. 2018-12-29 00:52:05 +01:00
Michael Lotz
3752309050 app_server: Cleanup error check logic to be more consistent.
Some of these only returned generic errors.
2018-12-29 00:52:05 +01:00
Michael Lotz
8071db3259 app_server: Add char limit to GlyphLayoutEngine::LayoutGlyphs().
Many of the consumers fill in data into preallocated arrays. Some of
them already ignored values past the array size manually, some didn't.

Add a maxChar argument and set it from the incoming array sizes for
the various consumer cases.
2018-12-29 00:52:05 +01:00
Michael Lotz
64a11edb02 app_server: Make more use of BStackOrHeapArray.
Variable length arrays on the stack are always risky when the length
is indeterminate as they can easily overflow the stack. Replace their
use by BStackOrHeapArray, fixes #6354.

Also replace most other dynamic allocations by BStackOrHeapArray as
it is more convenient and may avoid unnecessary dynamic allocations.

Add allocation checks and early returns to all places while at it.
2018-12-29 00:52:05 +01:00
Michael Lotz
22ce55254f app_server: Fix invalid cast of int32 to size_t array.
Make ServerFont::GetBoundingBoxesForStrings() use size_t.
2018-12-29 00:52:05 +01:00
Michael Lotz
9dad3fb4b0 app_server: Style and comment cleanup, no functional change. 2018-12-29 00:52:05 +01:00
Barrett17
e7933432e9 BCodecRoster: Remove MakeFormatFor
* I want to introduce a new way for plugins to
register for a format. Supporting the old FormatManager is
too painful at this point and not worth the effort.
2018-12-28 23:01:02 +01:00
Barrett17
fa911df6e6 Move FormatManager back to the media_kit
* We don't aim to replicate this functionality. I don't
think this will be useful at all in future iterations.
Originally I planned to rewrite it on top of the new
BMediaFormat, but now I am of the hopinion this is
greatly unneeded.
2018-12-28 22:55:25 +01:00
Barrett17
49a4b18141 media_server: Clean unused gFormatManager object 2018-12-28 22:24:07 +01:00
Barrett17
f3e317617f Move GetNextEncoder implementations to BCodecRoster 2018-12-28 22:24:07 +01:00
Barrett17
708de94fde MetaData: Add doxygen brief 2018-12-28 22:24:07 +01:00
Augustin Cavalier
0c3e5b9745 ipro100: Upgrade to FreeBSD 12. 2018-12-27 16:55:48 -05:00