Commit Graph

293682 Commits

Author SHA1 Message Date
msaitoh 2612a28064 QEMU e1000's PHY code doesn't implement register 16. Do workaround.
- Marvell 88E1[01]11 (and many other Marvell PHYs) have the Fiber/Copper
   auto selection feature. Our makphy(4) implement it but QEMU doesn't.
   If it fails, a garbage data is used in the attach function and unexpected
   media may be used. Fix this behavior by checking the return value of
   PHY_READ(MAKPHY_ESSR). If the access failed, the media is regarded
   as copper only. It's just a cosmetic change. It's not affected to the
   packet processing.
2021-12-28 06:35:37 +00:00
msaitoh 3401d1f8f2 QEMU e1000's PHY code doesn't implement page 0 register 15. Do workaround.
- The BMSR register bit 8 (BMSR_EXTSTAT) denote the existence of page 0
   register 15. qemu's e1000 sets BMSR_EXTSTAT but the access to register 15
   fails. It doesn't conforms to the IEEE standard. Our makphy automatically
   check the existence of 1000BASE-T or 1000BASE-SX by accessing the register
   15. If the access failed, neither 1000BASE-T nor 1000BASE-SX is set to
   the ability(mii_extcapabilities). Set EXTSR_1000TFDX and EXTSR_1000THDX
   if the access failed in the attach function. It's just a cosmetic change.
   It's not affected to the packet processing.
2021-12-28 06:34:40 +00:00
rillig e6db57e4b1 make: remove redundant local variable
The variable name 'end' suggested pointing to the end of the string, but
instead it pointed to the last possible starting position of the word to
be searched.  Remove this possible misunderstanding.

No functional change.
2021-12-28 01:27:37 +00:00
rillig c604dc9b17 make: clean up stylistically
No binary change.
2021-12-28 01:20:24 +00:00
rillig f329a60c1a make: constify cached_realpath
No binary change.
2021-12-28 01:11:36 +00:00
rillig 5467d03499 tests/make: clean up after test 'opt-debug-file' 2021-12-28 01:04:03 +00:00
rillig 1ed2b64416 tests/make: document inconsistencies between '!=' and '::!='
Found while trying to make the error messages from Cmd_Exec more
detailed.
2021-12-28 00:56:16 +00:00
simonb 16ba9b01e7 In biosdisk_findpartition() check if part_name isn't NULL before
assigning *part_name.

Thanks to manu@ for the pointer.
2021-12-28 00:37:16 +00:00
simonb 314f8da246 Fix a tyop. 2021-12-28 00:34:30 +00:00
rillig 0ce8241610 make: clean up Cmd_Exec
Renaming savederr to saved_errno makes the comment redundant.

Group the conditions for setting errfmt, retaining their relative order.

No functional change.
2021-12-27 23:44:06 +00:00
rillig ca80611ac0 make: reduce indentation of Cmd_Exec
No functional change.
2021-12-27 23:19:41 +00:00
rillig 48bc374a2e make: free the names of the makefiles in cleanup mode
Since parse.c 1.576 from 2021-12-13 the filenames from opts.makefiles no
longer end up in the GNodes, they are copied by Str_Intern.
2021-12-27 23:11:55 +00:00
rillig 0b37d6eba5 make: merge local variables holding the path to the object directory
This is a similar pattern as in the other situations where a string is
fed through Var_Subst.  In this case though, the unexpanded string may
need to be freed, therefore the FStr_Done that is not needed in the
other places.

No functional change.
2021-12-27 23:06:19 +00:00
andvar c54cdfdc0c fix few typos in comments. 2021-12-27 23:04:19 +00:00
rillig e4149aebc4 make: prevent out-of-bounds read for debug log file name
Even though the name of the debug log file currently only occurs in
strings of the form '-dFname' or '-dF+name', the code for replacing '%d'
with the PID accesses the passed string out of bounds.  That's not a
problem in practice but looks suspicious anyway.
2021-12-27 22:57:26 +00:00
riastradh 4a85b256a6 cgd(4): Fix criterion for detach when wedgies are held.
The somewhat confusingly named DK_BUSY(dksc, pmask) answers the
following question:

        Suppose I hold either the character or the block device (but
        not both) of all of the partitions in pmask.  Is anyone else
        using the disk, rendering it unsafe to detach?

This is useful for ioctls like CGDIOCCLR and VNDIOCCLR, which must be
issued on open file descriptors for the disk, so the question cannot
simply be answered by testing whether dk_openmask != 0.

Instead, DK_BUSY breaks the question into the following criteria:

        1. Are there any _other_ partitions than those in pmask open
           at all?  If so, it must be someone else, since I only hold
           partitions in pmask -- hence the disk is busy.

        2. Are any of the partitions in pmask open _both_ as a block
           device _and_ as a character device?  If so, it must be
           someone else, since I only hold _either_ the character
           _or_ the block device open but not both -- hence the disk
           is busy.

When config_detach_all runs at shutdown time, it tries to detach
cgd(4), which has DVF_DETACH_SHUTDOWN; this is important so we submit
queued writes to the underlying disk and wait for them to complete
with dk_drain.

If cgd(4) has any dk wedges with file systems mounted still
configured on it, it isn't ready to detach yet.  But asking
DK_BUSY(dksc, 1 << RAW_PART) returns false, because the dk wedges
only hold RAW_PART open as a block device -- so if nobody has
RAW_PART open as a character device, or any other partitions open,
cgd_detach blithely goes on its way to forcibly detach the wedges.

Instead, ask DK_BUSY(dksc, 0), because the caller -- cgd_detach
issued by config_detach_all -- does not, in fact, hold any partitions
open, so it doesn't need to work around them like ioctl(CGDIOCCLR)
does.  Fixes hang in zfs on dk on cgd during shutdown (and probably
also zfs on cgd without any intervening dk but I haven't tested).

(This change might have the side effect that `drvctl -d cgdN' doesn't
work, but I don't care.)

XXX pullup-9
XXX pullup-8 (...-7, -6, -5...)
2021-12-27 22:57:19 +00:00
rillig 069962538c make: remove usage message if the debug file cannot be opened
Since a non-writable file is not a syntax error, there is no point in
showing the usage in this situation.  Showing the usage may have been a
copy-and-paste mistake from a few lines below, when this option was
added back in main.c 1.133 from 2006-10-15.
2021-12-27 22:22:48 +00:00
rillig 0ad1c33dcd tests/make: cover a debug log file that cannot be opened 2021-12-27 22:04:20 +00:00
rillig 9756129355 make: narrow down the return type of ReadMakefile
No functional change.
2021-12-27 21:27:25 +00:00
rillig 80048f6c39 make: rename local variables to be simpler
No binary change.
2021-12-27 21:21:17 +00:00
rillig b1c34aa60f make: clean up 'explode'
Breaking out of the first 'for' loop was unnecessarily complicated.  The
call to strlen was not necessary since f already pointed at the end of
the string.

No functional change.
2021-12-27 20:59:59 +00:00
rillig 443ab0ca6f tests/make: test MAKEFLAGS in POSIX mode
This test covers the function 'explode' in main.c, the case in which the
flags are actually expanded.
2021-12-27 20:17:35 +00:00
rillig b77845afac make: replace __func__ with actual strings
Make is supposed to be C90-compatible, and __func__ is from C99.

No functional change.
2021-12-27 19:06:07 +00:00
rillig 4e16c2d814 make: clean up comments 2021-12-27 18:54:19 +00:00
rillig 2d7f7c37dc make: remove unnecessary words from command line options
Several years ago, the command line options were individual global
variables.  The global variable could therefore not be named 'silent'
since that would have conflicted with local variables of the same name.
After moving the global variable to the namespace 'struct CmdOpts',
there is no conflict anymore.

There doesn't seem to be any risk of naming collisions for the names
'touch' and 'query'.

No functional change.
2021-12-27 18:26:22 +00:00
rillig 2a65bef432 make: rename eunlink to unlink_file
The name eunlink suggested a relation with the similarly named functions
emalloc or esnprintf, but that was misleading.  Instead, unlink_file
works like unlink, except that it refuses to remove an empty directory.

No functional change.
2021-12-27 17:18:57 +00:00
riastradh b7d09065cc linux: Fix copypasto in comment. 2021-12-27 14:57:30 +00:00
riastradh b47ee0a433 i915: Fix timeout return value of i915_request_wait.
For some reason this returns ETIME, not ETIMEDOUT or 0 like most
other wait-with-timeout things in Linux.
2021-12-27 13:29:15 +00:00
riastradh 879b0e1791 i915: Factor a little out of #ifdef NetBSD.
Doesn't really reduce diff but slightly reduces danger of bad merge.
2021-12-27 13:29:04 +00:00
riastradh 64e814cc17 i915: Omit diff now that TASK_INTERRUPTIBLE is defined. 2021-12-27 13:28:52 +00:00
riastradh 863e4af79b drm: Define TASK_INTERRUPTIBLE so we can reduce diffs a little. 2021-12-27 13:28:41 +00:00
simonb 0637ed7691 Revert rev 1.12 of devopen.c. This had the unintented side effect
of breaking opens on non-root filesystems (eg trying to open/read
"esp:/EFI/NetBSD/boot.cfg" on the EFI system partition).

Ok manu@.  Original problem to be re-addressed.
2021-12-27 12:19:27 +00:00
riastradh 1b83323c0b i915: Disable message citing firmware URL.
Not very helpful for users; helpful only for developers maintaining
the gpufw set, who can find it by searching the source of the
message.  (Also it was missing a newline which is very confusing!)
2021-12-27 11:06:49 +00:00
riastradh eb4fc0114b linux: Define mb/wmb/rmb as mfence/sfence/lfence on i386 too.
Not the same as membar_*; drm uses mb to order special instructions
like clflush which require mfence for ordering.
2021-12-27 10:41:57 +00:00
riastradh d3bb989fb1 sys: Skip suspendsched on cpu_reboot if we're in ddb.
If we're in ddb, the scheduler and all other CPUs are quiesced
anyway.  But suspendsched will try to take an adaptive lock, which
causes it to crash and re-enter ddb, which isn't very useful for
rebooting.
2021-12-26 21:33:48 +00:00
riastradh aa96afee19 i915: Unifdef cnp_enable/disable_backlight.
Not sure why this was ifdef'd out in the first place!  Appears to
have been a mistake in merge.
2021-12-26 21:00:51 +00:00
riastradh a81d59292b drm: Fix locking around accurate vblank counts.
- Make drm_crtc_accurate_vblank_count require the caller to hold the
  event lock, rather than take it internally.

- Fix locking around drm_crtc_accurate_vblank_count and related
  operations in amdgpu and nouveau interrupt handlers.

- Use drm_crtc_vblank_put_locked, not drm_crtc_vblank_put, when we
  already hold the event lock.

PR kern/56557
2021-12-26 21:00:14 +00:00
christos f8e4e6f39e Add clang's optnone attribute. 2021-12-26 18:16:41 +00:00
andvar ca8f8e9eb0 namei(9): s/operatoins/operations/ 2021-12-26 16:41:09 +00:00
riastradh f48e2d7782 drm: Allow ww_mutex_lock after ww_acquire_done if we already hold it.
In other words, if ww_mutex_lock would return -EALREADY, that's OK and
does not warrant an assertion.

PR kern/56557
2021-12-26 16:14:34 +00:00
andvar e590e6c9f3 fix various typos, mainly in comments. 2021-12-26 16:08:19 +00:00
rillig 2b9d699f00 mixerctl: add colon after 'Usage', add space after comma 2021-12-26 15:36:49 +00:00
jmcneill 86e4d8c787 acpi: ohci: Match "generic-ohci" compatible string 2021-12-26 14:35:03 +00:00
jmcneill 1ff08d8ecc acpi: Support DT link device ID
The PRP0001 device ID is used to tell the OS to match a driver against
the "compatible" _DSD property. Make acpi_compatible_match aware of this
special device ID and match device compatible entries against the
compatible property when applicable.
2021-12-26 14:34:39 +00:00
skrll a05da69046 port-arm/50563: pool allocator corruption due to __MUTEX_PRIVATE
This file has moved on somewhat since the PR was raised, but nevertheless
let's add the CTASSERT "just in case".
2021-12-26 08:41:29 +00:00
pgoyette 4eb53ee9e8 Once again things have grown, so the install image allocation size
needs to be bumped.

XXX There's gotta be a better way to maintain this!  :-)
2021-12-26 03:07:06 +00:00
mlelstv 9e53e1415d Add support for a read-only edid attribute that shows the result of
WSDISPLAYIO_GET_EDID.

Uses code from sys/dev/videomode to parse and print the edid data.
2021-12-25 13:54:13 +00:00
rillig 70804612dd lint: don't try to trick mathematics by defining ZERO to a nonzero value
No binary change.
2021-12-25 13:51:42 +00:00
mlelstv 08b20cda6b Make re-usuable to userland. The vesagtf standalone build is #if'd out for now. 2021-12-25 13:51:31 +00:00
riastradh 630a5cc129 ukbd(4): Wait for callouts and blinking to complete in detach.
This detach routine (and whole driver) has got a lotta other
problems, but let's fix 'em one at a time...
2021-12-25 13:41:12 +00:00