Commit Graph

59753 Commits

Author SHA1 Message Date
Augustin Cavalier
187a2c6ce7 XHCI: Completely overhaul endpoint configuration logic.
The code as it was before was very hard to follow and incorrect in
a number of corner cases, as well as not being very clear about what
the TODOs were.

It now follows the spec much more closely (especially in interval
computation) and contains more details on where it is still lacking.

This probably does not fix much (if anything) as is, but it paves the
way for future isochronous support.
2019-03-08 20:40:12 -05:00
Jérôme Duval
9ba45ef924 Update libroot stubs. 2019-03-08 23:12:05 +01:00
Jérôme Duval
ba56d0a513 pthread: add pthread_getattr_np.
non standard extension, but widely available to obtain attributes for a thread.
also provides an alias for pthread_getattr_np which is the bsd equivalent.

Change-Id: I26ef8245ed2537186f48c8b8bdf3e42b03e70892
Reviewed-on: https://review.haiku-os.org/c/1172
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-03-08 19:50:45 +00:00
Jérôme Duval
901c3d44b0 pthread: implement pthread_attr_[get|set]stack.
remove pthread_attr_[get|set]stackaddr from unimplemented functions.

Change-Id: I58807e86c75a189a576639ae1b2e4505a63700a5
Reviewed-on: https://review.haiku-os.org/c/1152
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-03-07 16:55:14 +00:00
Jérôme Duval
29ec639a6d ltrace: implement x86_64 arch specifics.
fix trace build on x86_64

Change-Id: I205bd9eee03efea9e298c2877cc0a6440770caf0
Reviewed-on: https://review.haiku-os.org/c/1148
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-03-07 02:51:50 +00:00
François Revol
f82b4294d8 urlwrapper: add support for binary plist webloc files
Quite hardcoded but it works.

We only support URLs shorter than 256 bytes as it's the only samples I have.
2019-03-06 04:54:56 +01:00
François Revol
ee55f593fd mime_db: Add text/x-webloc
Also try to match the binary plist for the examples I have here.
2019-03-06 04:19:52 +01:00
Murai Takashi
5f48948f7f Roster: Fix PVS 460
Replace do...while(false) loop with while(true)... loop,
so that 'continue' at line 1968 can continue loop.

Change-Id: I4d64ff2699ad0837f29d49c63b683b134c4ccc1e
Reviewed-on: https://review.haiku-os.org/c/1149
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Reviewed-by: Barrett17 <b.vitruvio@gmail.com>
2019-03-05 22:39:24 +00:00
Jérôme Duval
9e1ce8ed92 kernel: tweak USER_SIZE.
Change-Id: Id0a4ad785bbd195e425dd32ca891dc4525bb3e18
Reviewed-on: https://review.haiku-os.org/c/1151
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-03-05 22:38:49 +00:00
Augustin Cavalier
57608a81c5 XHCI: Fix a race condition in request submission.
See inline comments. At least in brief testing I couldn't cause the
USB-HID stalls anymore, but they were very intermittent for me anyway.
But it was doubtless the case that the logic as it was before was
very much incorrect.
2019-03-05 13:08:03 -05:00
Augustin Cavalier
2df3446676 XHCI: Allocate one physical chunk for all buffers if possible.
Besides calling the allocator fewer times, this also helps break up
the size classes we are allocating chunks from, reducing memory pressure.

As most transfers are smaller than 128KB, this is a major performance
optimization for them.
2019-03-05 12:24:37 -05:00
Augustin Cavalier
ee0d30cff9 XHCI: Fix fencepost logic error in _LinkDescriptorForPipe.
See inline comment. This is very subtle stuff...

I didn't manage to trigger this in my brief testing, and the USB-HID
stall during USB Disk access is still not very difficult to reproduce.
So, this doesn't seem to have been the issue.
2019-03-05 01:14:33 -05:00
Augustin Cavalier
bae7f6d5dd XHCI: Completely rewrite Transfer Descriptor and related logic.
This is essentially a complete rewrite of the way TDs work, and a
significant change to how "normal" requests are submitted. In summation:
 * There is now no such thing as a "descriptor chain". This was a concept
   mostly carried over from EHCI and previous controllers that does not
   really map to XHCI properly, as one "transfer descriptor" can contain
   as many TRBs as are necessary to complete the transfer.

   What we were really doing before was setting up multiple TRB sequences
   owned by our xhci_td structure, and then linking them together with the
   CHAIN bit set on each TRB, which in XHCI terms is *one* descriptor,
   not multiple ones as we had it, and we were allocating the same amount
   of memory anyway, so we might as well do it all in one structure.

   So now xhci_td does not have a fixed size of TRBs, but rather a dynamic
   one, and thus also a dynamic number of buffers. As part of this refactor,
   xhci_td is now a data structure for our own use only, and so it is allocated
   from the normal heap instead of as physical memory, and TRBs separately.
 * Removing the distinction between "descriptor" and "descriptor chain" greatly
   simplifies quite a lot of logic related to transfer handling, especially
   in WriteDescriptor and ReadDescriptor, which no longer need to handle
   writing to buffers across xhci_td boundaries.
 * There is now a proper split between "trb_count" and "trb_used". The former
   is the actual number of TRBs allocated in the data structure; the latter
   is the number presently used in said data structure. This clarifies
   quite a lot of code.

As part of this refactor, a number of other related issues were also cleaned up:
 * TRB buffer sizes are now hard-coded to be 4x the Max Packet Size for the
   given pipe. Previously they were 64KB, which is much larger than the spec
   suggests. As we now size them exactly this way, we can set the endpoint's
   Average TRB Length to this value also, which allows the controller to
   better schedule transfers for us. This logic can probably be cleaned up
   further in the future, even.
 * We now write the "TD Size" field of Normal transfers (i.e. packet count,
   not TRB count) properly, as it is now much easier to compute based on
   our new TRB sizing logic.
 * We now record the Max Packet Size for the endpoint in the endpoint
   structure. (This will probably be more useful when we are dealing
   with isochronous transfers later on.)
 * Write the last cycle bit in _LinkDescriptorForPipe after everything else
   has been written. This probably does not affect anything too seriously,
   but it is technically more correct.
 * Added section & page references to the specification in various comments.
 * Added more error checking where applicable.

Some things still to be done that I noticed while working on this change:
 * When we use a single large buffer and manually segment it rather than
   calling AllocateChunk() for each one, there is a massive performance
   gain (I saw 50MB/s -> 95MB/s in testing on some USB devices.) However,
   we can't do this unconditionally, as the stack doesn't allocate physical
   chunks larger than 32 * B_PAGE_SIZE, which is a problem for some filesystems
   which can read/write in chunks of 1MB. I'll implement this in a later commit.
 * Setting the IOC bit on the last TRB in a transfer is acceptable to find
   out when the transfer is finished, but it isn't enough to get a proper
   tally of how much data was transfered. This is what Event Status TRBs
   are for; we should implement them.
 * _LinkDescriptorForPipe has an overflow condition. I'll fix that in the
   next commit.

Tested on a ThinkPad E550 (Intel Broadwell) with usb_disk and usb_hid.
2019-03-05 00:35:51 -05:00
Augustin Cavalier
dc9a81f0d4 XHCI: Partially fix TD size computation.
Previously we were sending the hardware completely garbage values,
as CreateDescriptorChain clobbered the trbCount value it had set
by using it to determine how many more TRBs it needed to allocate,
and so it usually returned with the value set to 0.

Then SubmitNormalRequest() would immediately subtract 1, causing it
to become negative, and the loop would continue doing this, which also
violated the spec's notice that the field should be 31 if its "true
value" was >= 31, and of course 0 for the last TRB in the transfer.

The spec also says this should be the number of packets remaining, not
the number of TRBs remaining, which we also do not obey; but that
will be a problem for another time, so just add a TODO.
2019-03-04 17:37:01 -05:00
Augustin Cavalier
10230c7ab1 XHCI: Reorder some functions and tweak class definition.
No functional change intended (some methods are now private,
but nothing outside this class used them, so no change.)
2019-03-04 16:47:53 -05:00
Augustin Cavalier
a40a4c0d39 XHCI: Don't try to submit transfers to non-existent endpoints.
Fixes #12929. The underlying issue that caused it still remains, though.
2019-03-04 15:37:38 -05:00
Augustin Cavalier
6b4d0adcd0 XHCI: Clear the device struct after tearing down its state.
This clears out the area_ids, the pointers to them, and a variety
of other state information that will be invalid following the
deletion of the device.

Turns #12929 from a use-after-free into a NULL dereference panic.
2019-03-04 14:54:08 -05:00
Augustin Cavalier
1533bd88b1 XHCI: Style cleanup and dead code removal.
No functional change (besides some tweaked tracing) intended.
2019-03-04 14:42:12 -05:00
Augustin Cavalier
3fe76c19f5 Terminal: Enable bold text by default.
It was removed before because bold text rendering was partially
broken. Now that Terminal uses fractional widths for character
sizes, we can restore it by default.

This matches the behavior of virtually all Linux terminal emulators
(they also appear to make bold text brighter.)
2019-03-04 14:19:11 -05:00
Augustin Cavalier
251892c136 BuildSetup: Remove unused big-endian host detection.
Nothing references it anywhere. Also add "arm64" to 64-bit
detection (which is used.)
2019-03-04 13:37:56 -05:00
Augustin Cavalier
bef99ce584 freebsd_network: Fix debug build. 2019-03-04 12:49:26 -05:00
Augustin Cavalier
8aa8345a68 boot/bios_ia32: Remove the unused flat_buffer field.
Suggested by korli in #11019. We pass this struct directly to the
BIOS, so pack it while we are here.

Checked against GRUB (it also does not have this field.)

Change-Id: I9a2708c44ff48fd702175053f2889443d6f7a003
Reviewed-on: https://review.haiku-os.org/c/1145
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-03-04 16:38:49 +00:00
Augustin Cavalier
dedf24f757 kernel: Don't load modules from non-packaged under "disable user add-ons".
This matches the behavior of the "new-style" module system.
Part of #14361.
2019-03-03 17:20:53 -05:00
Augustin Cavalier
ee735d1b33 PackageKit: Fix BPackageInfoAttributeValue::Clear for GCC2.
These are simple structs, so hopefully GCC8 will be OK with us
memsetting them. We can't use the standard = {} route because
GCC2 does not support that.
2019-03-03 17:04:22 -05:00
Augustin Cavalier
3e57265251 ArchitectureRules: -Wno-error=cast-align is only valid for GCC4+. 2019-03-03 16:52:11 -05:00
Augustin Cavalier
2b20049687 configure: Check for python the same way we check for sha256.
Avoids printing an extra line to stdout that users don't really
need to see.
2019-03-03 16:50:29 -05:00
Murai Takashi
74d9e19df9 apps/tv: Fix -Werror=class-memaccess
Fix -Werror=class-memaccess, pointed by gcc8.
* Remove unneed memset() at line 300, since constructor of
  media_format already runs memset().
* Replace other memset() with media_format.Clear().
* Remove trailing tabs.

Change-Id: I3207842603208b33a77cfd88de7a8a0e52fb2d72
Reviewed-on: https://review.haiku-os.org/c/1116
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-03-03 21:08:10 +00:00
Murai Takashi
752ec5c625 Package kit: Fix -Werror=class-memaccess
Initialize each class members instead of memset()
for clearing PackageInfoAttributeValue.
Pointed out by gcc8.

Change-Id: I8bdb328e2271e49e840b1294dba9cca544805e72
Reviewed-on: https://review.haiku-os.org/c/1114
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-03-03 21:07:42 +00:00
sushilhub
e573a0cfad src/apps/codycam: fixes missing break statement
* added break statement

Change-Id: I148c2e6666fda393eb30d509c25578d141f8dbac
Reviewed-on: https://review.haiku-os.org/c/1128
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-03-03 21:01:58 +00:00
PulkoMandy
6823ced505 Add some notes about the sparc architecture.
Change-Id: I2fd042981d2771abdedcd3648e2eeb6e06db4253
Reviewed-on: https://review.haiku-os.org/c/1142
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-03-03 21:01:12 +00:00
PulkoMandy
8bdd63fe5d Synchronize sysdep.h with current glibc
So that I can more easily import sparc headers from it.

NO_UNDERSCORES is gone and is now always the default.
Some previously arch-specific defines are now valid for all platforms.

Change-Id: If9876b241719559bdcb5cd9d8b1dc97e5e3d96b3
Reviewed-on: https://review.haiku-os.org/c/1141
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-03-03 21:01:12 +00:00
PulkoMandy
a7c23bb4a9 kernel/arch/sparc: stubs to get the kernel to link
Add empty implementation of timer, elf, vm, debugger support, to let the
kernel link.

Also add the kernel linker script.

Change-Id: If0795fa6554aea3df1ee544c25cc4832634ffd78
Reviewed-on: https://review.haiku-os.org/c/1108
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-03-03 20:56:20 +00:00
PulkoMandy
e6c9be767b sparc: interrupt management functions
Change-Id: Icc689cc0cc0075fbccdad23f77cfa53b1f32df3c
Reviewed-on: https://review.haiku-os.org/c/1107
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-03-03 20:56:20 +00:00
PulkoMandy
c1566b1555 sparc: more platform headers
Previous commit adding these was merged very quickly, so here's one
more...

Change-Id: I23c424db7631db1f0ec48e2d0ae47c8409ae6af2
Reviewed-on: https://review.haiku-os.org/c/1088
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-03-03 20:56:20 +00:00
PulkoMandy
c5769c4f6b Make -Wcast-align only a warning
On x86 and x86_64, this warning is never emitted because it is perfectly
fine to do unaligned access. On sparc, such accesses are not supported
by the hardware and will generate a SIGBUS. This must be caught by a
trap handler, and the unaligned access performed there, slowly, using
byte by byte access.

However, making this a Werror is annoying because it will trigger
everytime one casts a byte pointer to something larger, even when
alignment is actually preserved. So, removing all such warnings would be
nearly impossible (for example, just for the mergesort function, there
is a whole GSoC project for it at FreeBSD).

Keep it as a warning for now. The warning can be silenced by using
BytePointer, if desired. We should also investigate where the SIGBUS
trap is triggered a lot and consider improving the alignment of data
where possible.

Change-Id: I6b90025e8c6d69ef1ccda3c10eee270ccc1ebd29
Reviewed-on: https://review.haiku-os.org/c/1103
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-03-03 20:56:20 +00:00
PulkoMandy
5f49c55851 m68k: simplify a Jamfile.
I'm copypasting a lot from this, so I may as well clean it up while I'm
at it.

Change-Id: I9288c087abbf95475f980b5539f2fd19fad7f775
Reviewed-on: https://review.haiku-os.org/c/1136
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-03-03 20:56:20 +00:00
Niels Sascha Reedijk
d7b8d76a78 BSD headers: remove _BSD_SOURCE feature gate for sysexits.h
During the compilation of LLVM version 8, the build failed because it depends
on a constant in this file. In hrev49042 all BSD headers were feature-gated by
_BSD_SOURCE. This is not done (for this file) in glibc and (obviously) not in
BSD's libc.

Since this is not common practise, I would propose removing the feature gate
for this header file, as it would mean that we would have to upstream patches
for ports of other software that depends on the availability of these
constants.

Change-Id: I486f0c2e87eff489ce92d03589a6299ef1be6ca5
Reviewed-on: https://review.haiku-os.org/c/1144
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-03-03 20:49:19 +00:00
Andrew Lindesay
52a61976d4 pkgman: fix for syntax (help)
The tool "pkgman" was not showing it's help text
and this seems to be somehow related to the
initialization of constants such as
"kCommandCategoryPackages"; these values seems to
be coming through as empty-string for some reason.
I am changing those to be "#define" of regular
C-Strings and this seems to resolve the problem.
These values only seem to be used to group the
possible commands for production of the syntax or
help text - there do not seem to be any deeper
impacts beyond that functionality.

Change-Id: If9cd61462cd7f1f1b5ab2ece521bb3f00a1ba246
Reviewed-on: https://review.haiku-os.org/c/1139
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-03-03 20:24:54 +00:00
Greg Crain
695f50f6cc XHCI: Adjust timeouts in WaitOpBits.
Operations that succeed should not take longer; ones that fail will.

Should get rid of ControllerReset() failed CMD_HCRST.

Change-Id: I4981a319bd64a076f2f404214a96d9909f0676de
Reviewed-on: https://review.haiku-os.org/c/1135
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-03-03 17:41:49 +00:00
Jérôme Duval
2e1e3f0d75 runtime_loader: fix failures in the test suite.
* use --no-as-needed on Linux as the default changed some time ago.
* adjust LD_LIBRARY_PATH/LIBRARY_PATH to load in the current directory.
* fix some builds of program with compile_lib.

Only dlopen_lookup_next1 fails on Ubuntu 18.04.02 x86_64.

Change-Id: I6ecf70f742f67ab24d7d00fa615baa209634d02c
Reviewed-on: https://review.haiku-os.org/c/1140
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-03-03 17:39:45 +00:00
Andrew Lindesay
17dc34acd6 HaikuDepot: Build Configure for Python
Some operating systems only ship with Python 3 and the
binary for this is 'python3' instead of 'python' which
causes the Jam build process to fail because it expects
to find 'python'.  This change will mean that the
configure process will detect this case and configure
the build to use the correct binary name.

Fixes #14938

Change-Id: I30cd0df828792715a54d760b86dd79aee04e2b2f
Reviewed-on: https://review.haiku-os.org/c/1134
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-03-03 07:49:25 +00:00
Andrew Lindesay
c91b716e09 HaikuDepot : Generate Sources -Fix Build
In recent changes to HD's build files to generate
some sources at build-time there was a problem
with builds that were configured to run with some
element of concurrency.  In this change, the steps
that should be in sequence are done with shell
commands to avoid race conditions.

Change-Id: I5b6fb4907d8ea5f3ca90de956ecce322cd89c685
Reviewed-on: https://review.haiku-os.org/c/1130
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-03-02 16:43:33 +00:00
François Revol
2c73537c43 Add a catarea bin tool
Untouched as of 2004, can be useful sometimes.
2019-03-02 13:37:23 +01:00
PulkoMandy
d3a6abe920 sparc: freebsd_network defines
Change-Id: Ib668c69d6b506c6efaeb50d0a3e4784f836ce61a
Reviewed-on: https://review.haiku-os.org/c/1105
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-03-01 11:55:38 +00:00
PulkoMandy
167f096576 sparc: update gcc package in HaikuPortsCross
Use the latest version of the compiler for bootstrap.

Change-Id: I43639b560de2d4f3dc3fed48c3d4bd32a544cb57
Reviewed-on: https://review.haiku-os.org/c/1104
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2019-03-01 11:54:55 +00:00
Zach Dykstra
579b9cd9b9 Adjust the magic incantations to fix spacing
This is my first commit, so bear with me if I've violated any standards here!

I've bumped a few offsets to fix text clipping in the Get Info window. The proper
long-term fix is to recreate this window with the layout library, but that's
a substantially larger job.

Patch set 1
Before: https://i.imgur.com/S7Pl5Qv.png
After: https://i.imgur.com/bd3H1Kw.png

Patch set 3
French: https://i.imgur.com/rpmUb5T.png
German: https://i.imgur.com/ca9DecW.png
Portuguese: https://i.imgur.com/dE8sKFI.png

The font size in the Permissions drop-down is fixed. I had previously bumped it to
12, to be inline with the default font size present in a new Haiku install. However,
that produced text clipping for French and other locales. I reverted it back to 10,
and now longer strings fit as-is.

Change-Id: I7f4412b10074c76eb5b023a231bdb6b230c8f35a
Reviewed-on: https://review.haiku-os.org/c/1073
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-02-28 19:10:12 +00:00
Murai Takashi
1f0635d227 Game Kit: Fix -Werror=class-memaccess
Replace memset() with media_format.Clear() to fix
-Werror=class-memaccess, pointed by gcc8.

Change-Id: I87a72ac06947e90c468deda6bf6d7bb3b5fb4003
Reviewed-on: https://review.haiku-os.org/c/1113
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-02-28 18:58:46 +00:00
Murai Takashi
88d7c7740a media-add-ons/usb_webcam: Fix -Wclass-memaccess
Remove memset(), since WebCamAddOn()::FillDefaultFlavorInfo()
at next line sets all flavor_info members except _reserved_[].

Change-Id: I41b4297a79303b61ccea914133b268b118b0d968
Reviewed-on: https://review.haiku-os.org/c/1118
Reviewed-by: Barrett17 <b.vitruvio@gmail.com>
2019-02-27 23:10:33 +00:00
Jérôme Duval
1d3959edfb exfat: checks cluster values.
also use the size of the node for Size(), instead of the valid size.
2019-02-26 23:08:53 +01:00
Alexander von Gluck IV
1b3684f86a HaikuPortsCross/riscv64: Fix packages for gcc
Change-Id: I220076059a9ee69411384a595e7b56db61c74655
2019-02-26 14:17:57 -06:00