Commit Graph

59833 Commits

Author SHA1 Message Date
Murai Takashi
be6c334335 STXTTranslator: Fix dead initialization
* Fix dead initialization at line 596. Pointed out
  by clang static analyzer.
* As a result, 'BMallocIO encodingIO' at line 524
  becomes unused, so delete it and header.

Change-Id: Ia62184fe0682a2eedeee42a513faccabdd3d1b59
Reviewed-on: https://review.haiku-os.org/c/1079
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-02-23 16:02:13 +00:00
Augustin Cavalier
88180e2f80 XHCI: Allow commands to time out after 1s instead of stalling forever.
This seems to occur when trying to stop endpoints in certain scenarios,
at least.
2019-02-22 17:14:23 -05:00
Augustin Cavalier
358dd70e16 XHCI: Initialize all fields during endpoint setup.
As we reuse memory on a device for endpoints, this is potentially a
functional change.
2019-02-22 17:12:03 -05:00
Augustin Cavalier
c4db8aba7b XHCI: Delete the device in FreeDevice() before tearing down internal state.
We don't properly tear down endpoints, etc. yet, but when we do, this will
be important as the device destructors are what tells us to do that.
2019-02-22 17:09:09 -05:00
Augustin Cavalier
1464b156f7 XHCI: Minor non-functional cleanups. 2019-02-22 17:08:10 -05:00
Augustin Cavalier
da8c1a9a40 USB: Don't loop endlessly waiting for a physical buffer.
This is used quite a lot in critical transfer paths, so we don't
want to lock things up if no buffers are available for whatever reason.
Wait 2 seconds, and if we didn't get anything by then, return B_NO_MEMORY.

Possibly fixes or helps with certain USB-related lockups.
2019-02-22 13:32:27 -05:00
Augustin Cavalier
7b53b3c2e4 XHCI: Don't compute the error code twice.
No functional change.
2019-02-22 13:32:27 -05:00
Augustin Cavalier
c409803d6f XHCI: Refactoring and fixes to SubmitControlRequest.
* Rearrange some basic setup to be more towards the top of the function,
   so we have less things to tear down upon failures.
 * Don't double-initialize qwtrb0 of the Setup Stage (no functional change.)
 * Rework Data Stage initialization considerably:
   - TD_SIZE refers to the number of remaining TRBs in this TD. As we only
     use 1 TRB for the Data Stage TD at present, this should be 0, not 1.
   - Actually copy data for outbound transfers. (This code does get hit,
     so I'm not sure how it wasn't a problem previously.)
 * Initialize the first quadbit of the Status Stage. (Potentially a
   functional change.)
 * Set the TRB_3_DIR bit on the Status Stage correctly as per the spec.
   (See inline comment.)

Device initialization seems to behave much more smoothly now; at least on
my hardware, the "error Parameter" doesn't happen anymore, and of course
anything depending on outbound Control transfers will now work correctly.
I now get much better speeds from usb_disk, but I still see usb_hid stalls
after this patch.
2019-02-22 13:32:26 -05:00
Jérôme Duval
14263044aa exfat: avoid overflow in Volume::ClusterToBlock(). 2019-02-22 18:38:52 +01:00
Augustin Cavalier
a54fc27a11 XHCI: Check the device object initialized successfully before adding it.
Fixes various NULL dereferences in other parts of the USB stack
when the XHCI controller is not behaving quite as expected.

Possibly related to #13403.
2019-02-22 01:23:08 -05:00
Augustin Cavalier
c7f186b23f XHCI: Make some errors more descriptive.
Also contains some minor coding style cleanup.
2019-02-22 00:39:36 -05:00
Augustin Cavalier
aa5cb68bc6 kernel/fs: NULL is a valid buffer to pass to ioctl().
Another bug exposed by hrev52905. Discovered because Expander was
not displaying archive contents anymore.
2019-02-21 22:12:32 -05:00
Augustin Cavalier
60497373d0 USB: Pack the usb_request_data struct.
We really should not be writing raw structs out to devices
for endianness' sake, but that's currently what *all* the
USB bus drivers do with this struct. So, add the _PACKED flag
to ensure it's always precisely 8 bytes.

Additionally, remove memory_chunk, as nothing uses it anymore.
2019-02-21 20:15:58 -05:00
Augustin Cavalier
03d1fd2b7e kernel/elf: Ignore PT_EH_FRAME for kernel add-ons.
We do the same thing in runtime_loader. Silences a lot
of warnings.
2019-02-21 17:06:09 -05:00
Augustin Cavalier
f564d526ab freebsd_network: Initialize some variables.
The cases where these were uninitialized are panics, but
continuable panics, so it makes sense to initialize them anyway.

Spotted by Clang.
2019-02-21 17:05:44 -05:00
Augustin Cavalier
10fbcafdf9 freebsd_iflib: Add a function declaration to nvlist.c.
Same reason as previous commit.
2019-02-21 17:05:06 -05:00
Augustin Cavalier
7b5d0b3510 freebsd_network: Reorder if_var.h slightly.
Some of the functions moved lower in this commit use functions
that were previously defined below them, which was a warning in
GCC but an error in Clang.
2019-02-21 17:04:49 -05:00
Augustin Cavalier
2fc0c84112 ArchitectureRules: Add -Wno-builtin-requires-header to Clang flags.
It warns when you try to use some standard library functions
without including the system headers, which we don't
care about as we are providing the system headers in the tree.
2019-02-21 14:04:05 -05:00
Augustin Cavalier
86dfe1d9a8 BAffineTransform: Remove "register" storage class.
Long since deprecated, and compilers can figure this out on
their own now. Fixes a lot of errors in Clang.
2019-02-21 14:03:05 -05:00
Augustin Cavalier
4dd5af2f75 build_cross_tools_gcc4: Handle $PATH having spaces in it properly.
Fixes the build of the cross tools under WSL.
2019-02-21 14:02:13 -05:00
Augustin Cavalier
5a7156f435 build_cross_tools_gcc4: Clear "missing" scripts instead of touching files.
This just stops the errors from occuring rather than trying to
rebuild the files at all. This is much cleaner, and solves
a few cases that the other method did not.
2019-02-21 14:01:40 -05:00
Barrett17
83a69e16c5 MediaExtractor and MediaWriter fix constness
* Fixes an ugly hack, where the codec was initialized in the
InitCheck and prevented the method to be const too.
2019-02-21 17:43:11 +01:00
Barrett17
2caa4ec708 codec_kit: Fix build 2019-02-21 17:36:55 +01:00
Barrett17
cb19342b80 dvd_streamer: API Update 2019-02-21 16:39:59 +01:00
Barrett17
486872713c http_streamer: API update 2019-02-21 16:39:58 +01:00
Barrett17
662583b300 MediaStreamer: Extend API to support DVD navigation
* This is a general review of the code and includes a rework
 of the sniffing API.
2019-02-21 16:39:58 +01:00
François Revol
d18fe1c54c loader: disable scaling on nvidia VESA BIOS
cf. https://patchwork.kernel.org/patch/7113461/

Change-Id: I3f564bd1037aeb4b539f495d57397446ae14e5ed
2019-02-21 05:28:56 +01:00
François Revol
38c4c8bfa9 kernel: fix mount arguments checks from userland
Since NULL is not considered a user address anymore, we must check for
it first.

This fixes the "mount: Bad address" error after hrev52905.

Change-Id: If60ea58bb81b6c35c6bf27ecfa9b29bd7a25d8aa
2019-02-21 03:14:23 +01:00
Augustin Cavalier
fe9e1e0c4f package_infos: Restore old compat version in x86_64.
The x86_64 buildmaster was only updated past the R1~beta1 version
a few weeks ago, so most packages still have a R1~alpha4_pm dependency.
Thus thus broke the build. Revert it for now so we don't do that.
2019-02-20 19:43:37 -05:00
Adrien Destugues
a6a6e3a842 Package kit: add likely-useful architectures
Required for bootstrapping them.

Change-Id: I179d8c73b08688946049bf18ff9151ef047e449b
Reviewed-on: https://review.haiku-os.org/c/1071
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-02-20 22:29:36 +00:00
Adrien Destugues
a54059b3f0 Update package_infos
- Bump year to 2019
- Adjust compat version, use alpha1 for x86 and generic packages, and
beta1 for other architectures since that's where they first appeared
(we will probably bump to beta2 for arm/sparc/ppc when we release
them for real?)

Change-Id: Ibb0968feb28731898776335eba01d34dcb758625
Reviewed-on: https://review.haiku-os.org/c/1069
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-02-20 22:29:36 +00:00
Augustin Cavalier
5fd8023312 XHCI: Disable Stop/SetTRD/Reset again.
They don't seem to particularly help, and there are reports
that this broke XHCI completely on some devices.

This reverts commit a21f7b525b.
2019-02-20 16:37:03 -05:00
Augustin Cavalier
01796e78f4 kernel/x86: Re-introduce the 1MB lower barrier.
It was removed in 2008 to make VM86 work, which is now gone.

Fixes #14911.
2019-02-20 15:37:06 -05:00
Augustin Cavalier
10aa58d7c3 kernel/vm: Make sure the base address is larger than fBase.
This is technically only a functional change following the previous
commit, which unconditionally made sure the address was larger than
the base except for B_EXACT_ADDRESS. Essentially this makes sure
that if an address is passed which is smaller than the base is
passed in, it won't immediately fail just by being too small.

Checked against BeOS (0x0 passed to create_area with B_BASE_ADDRESS
succeeds, and returns 0x2000 consistently.) This is also needed
to not break userland initialization following the next commit.
2019-02-20 15:33:32 -05:00
Augustin Cavalier
836a9548e0 kernel/vm: Remove VM86-related address space hacks.
VM86 was removed in 2012, so these are no longer needed.
The USER_BASE vs. USER_BASE_ANY distinction still seems like a
potentially useful one, though, so I've left all those changes in.
2019-02-20 13:28:25 -05:00
Augustin Cavalier
b08b51b417 BFS: Fix vising attribute runs in FileSystemVisitor.
See inline comment. Fixes "vnode refcount > 0" assert failures while
running checkfs after yesterday's commits.
2019-02-20 11:24:15 -05:00
Augustin Cavalier
13c4bc94ca kernel: Undo changes to pinned threads and blocking.
This reverts commit 58ed2965d0.
This reverts commit 055d49b1fd.

I was mistaken, it is perfectly legal to block a pinned thread.
It seems we'll need some other way to detect invalid context
switches.
2019-02-20 10:34:18 -05:00
Augustin Cavalier
055d49b1fd kernel/x86: Pin the current thread before calling interrupt handlers.
int_io_* functions do not touch the thread state, but we already have
it here as we will modify its contents later, so it makes more sense
to set this flag here.

This is mostly only relevant following the previous commit, i.e.
finding interrupt handlers that brokenly try to context-switch.
2019-02-19 21:38:15 -05:00
Augustin Cavalier
58ed2965d0 kernel: Panic on attempts to block a pinned thread.
Preventing "normal" context switches caused by a time interrupt
is the primary reason for pinning threads. "thread_block" and friends,
however, cause an explicit context switch and will not return until
another thread unblocks us.

Calling these while a thread is pinned is thus undefined behavior,
and so we should just panic in the case anyone attempts to do so.
2019-02-19 21:35:39 -05:00
Augustin Cavalier
a21f7b525b XHCI: Move and reorder Stop/SetTRD/Reset during endpoint creation.
Fixes a lot of "command failed: invalid context" errors on a variety
of devices following previous commits. Does not seem to affect much,
though.
2019-02-19 21:33:54 -05:00
Augustin Cavalier
a182f19364 USB: Properly assign IDs to USB Bus Managers (HCI drivers).
Previously they would just get -1, as the BusManager class
would request their ID before they had been added to the Stack.
Now we add them to the stack inside ::Start(), rather than letting
the individual drivers do that just after ::Start(), and then assign
the ID there directly.
2019-02-19 17:14:54 -05:00
Augustin Cavalier
d6f3954f39 XHCI: Tweak copyright header.
* List authors in alphabetical order.
 * Add myself.
 * Make first copyright year the actual year the file was created.
2019-02-19 16:41:47 -05:00
Andrew Lindesay
784aba8e2d HaikuDepot: Fix Code-Generation Jam Logic
The Jam build logic for HaikuDepot was potentially creating
a dummy file that was newer than the generated .cpp/.h files.
This then, in turn, caused the dependent .o files to be
considered needing to be re-built.  This change will ensure
that the dummy file is touched first so it is not newer than
the generated sources and also if the dummy does end up
being newer then the generated sources will be touched.

trac #14853

Change-Id: Ieefb0b2aa14bf43b7cbbdfee4228c215cad5b6fa
Reviewed-on: https://review.haiku-os.org/c/1070
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-02-19 21:34:23 +00:00
Fabiano Fidêncio
768957dca1 ImageRules: Ensure nightly builds will have a stable volume-id
Let's make the nightly builds consistent in a way that they would always
be recognized by libosinfo (and, consequently, by GNOME Boxes,
 virt-manager, virt-install, ...) by explictly using "nightly" instead
of the $(HAIKU_VERSION) when generating nightly builds.

Signed-off-by: Fabiano Fidêncio <fabiano@fidencio.org>

Change-Id: I6fc4f15be1e8e9244abf14e75308fc825f37b2e8
Reviewed-on: https://review.haiku-os.org/c/1053
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2019-02-19 19:03:25 +00:00
ahenriksson
aa7750382a bfs: split checkfs code into FileSystemVisitor and CheckVisitor
Another FileSystemVisitor implementation will be used for resizing

Change-Id: I2d5f47dcbefb4c76834487b194a99c6f5ae7de50
Reviewed-on: https://review.haiku-os.org/c/923
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2019-02-19 18:44:43 +00:00
ahenriksson
8497a2cc28 vfs: functions to change a vnode busy status and ID
The kernel version is only partially tested.

Change-Id: I9a2f6c78087154ab137eadbced99062a8a2dd688
Reviewed-on: https://review.haiku-os.org/c/918
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-02-19 18:44:43 +00:00
Adrien Destugues
518af33f33 mmc/sd: support for SD v2.0 cards
Older cards did not implement CMD8, so handle the command stalling, and
proceed with initialization (not querying about SDHC support in that
case, as per the spec).

Change-Id: Ie842effc2f99e1adf1990b3215be79db493138b5
Reviewed-on: https://review.haiku-os.org/c/1056
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-02-19 18:34:03 +00:00
Adrien Destugues
ff76d2df8e sdhci and mmc implementation
sdhci:
- Add semaphore for interrupt management
- Add basic operations (setting clock, executing a command)
- Add early initialization (clocks and power up)
- Wrap the bus in a C++ class to ease usage
- Expose API to MMC bus manager
- TODO: manage card insertion and removal interrupts
- TODO: use MSI when available

mmc_bus:
- Implements SD card management independant of the way we access the bus
  (later on different drivers can provide the same API as SDHCI)
- Worker thread to do the initialization
- Implement card initialization process up until getting an RCA from the
  card. This is the generic part to assign an ID to the card, after this
  point commands can be targetted at the specific card so it can be
  handed over to the mmc_disk driver.
- TODO: initialization for non-SDHC cards which do not reply to CMD8.

Change-Id: I71950ca3ce206378a68fa7f97c19f638183d6cdd
Reviewed-on: https://review.haiku-os.org/c/1032
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-02-19 18:33:25 +00:00
Rob Gill
1f93ed9936 Avoid use of sprintf/snprintf on same source/destination (undefined
result)

 * Altered to avoid use of sprintf/snprintf to copy between the same
   source and destination. (This is an undefined result since c99)

 * (consequential trailing whitespace removal & line length adjustment)
Change-Id: I43976af43fe99d15b6c2677c5ab05db46fd6a8c0
Reviewed-on: https://review.haiku-os.org/c/1036
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-02-19 18:32:20 +00:00
Murai Takashi
a31244d098 mail: Fix potential memory leak
Fix memory leak when realloc() failed.
Pointed out by Clang Static Analyzer.

Change-Id: I13f758c4d89275651e22785652d0880a6d5b1a8e
Reviewed-on: https://review.haiku-os.org/c/1064
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-02-19 18:31:44 +00:00