apple_smc: add thermal governor and PROCHOT override
When the SMC asserts PROCHOT# due to disconnected sensors or absent
battery, the driver now detects this at attach, clears BD_PROCHOT in
MSR 0x1FC, and takes over fan control from the SMC failsafe. A kernel
thread implements a linear fan curve between configurable temperature
thresholds with hysteresis and rate-limited ramp-down.
New sysctls expose scheduled wake time (CLWK), S5 power-on timer
(G3AO/G3WD), AC wake delay (AUWT), display brightness (DPBR),
chassis state (ENV0), and software thermal throttle disable (STFD).
The raw key interface is no longer gated behind APPLE_SMC_DEBUG.
Temperature description table expanded to ~170 entries.
reboot(8): Fix openlog(3) calls
LOG_CONS was OR'd into the facility argument instead of logopt, leaving
logopt as 0. The correct call is openlog(ident, LOG_CONS, LOG_AUTH),
as shutdown(8) and init(8) already do.
Signed-off-by: Ricardo Branco <rbranco at suse.de>
GitHub-PR: #37
reboot(8): Fix openlog(3) calls
LOG_CONS was OR'd into the facility argument instead of logopt, leaving
logopt as 0. The correct call is openlog(ident, LOG_CONS, LOG_AUTH),
as shutdown(8) and init(8) already do.
Signed-off-by: Ricardo Branco <rbranco at suse.de>
GitHub-PR: #37
libthread_xu: Link with '-z nodelete'; unloading it is unsafe
Loading libthread_xu has irreversible process-wide effects:
* rtld lazily rebinds libc weak pthread stubs (e.g. _spinlock) to
the strong definitions in this library. There is no mechanism to
undo GOT bindings on dlclose(), so after an unload libc keeps
calling into the unmapped region.
* __isthreaded stays set -- the library cannot prove that no other
threads exist, so it cannot safely clear it -- which keeps the
libc malloc on the locked path through the dangling _spinlock
pointer.
* _thr_signal_init() installs signal handlers pointing into the
library, and _thr_signal_deinit() is empty, so signal delivery
after an unload also jumps into unmapped memory.
Consequently a program that dlopen()s a dependency chain pulling in
[42 lines not shown]
contrib/bmake: Adjust documentation of our custom variables
* Improve the markup styles a bit.
* Move the postition to the end of bmake builtin variables.
make(1): Refactor Makefile
* Include ${srcdir}/VERSION for _MAKE_VERSION instead of hardcoding it.
* Clean up CFLAGS; remove unused ones.
* Move a few variables from CFLAGS to COPTS.main.c where they're only
used.
* Remove other obsolete COPTS.*.
make(1): Undefine USE_EMALLOC to avoid libutil dependency
With USE_EMALLOC undefined, util.h becomes unused and thus remove it.
This improves the zrj's commit ee2cba8aae8c6b2ce0b6c6fc150e61c1736c64e8.
make(1): Directly install vendor's make.1
The vendor's bmake.1 man page intends for the portable bmake
distribution. So just install the vendor's make.1 instead of using
bmake.1.
contrib/bmake: Remove obsolete custom variable '.MAKE.BUILT.BY'
This custom variable was initially added in commit 673bdc16bff3eec8 to
help resolve a C++ ABI change between gcc47 and gcc50. Since the
removal of gcc47 (commit 0f44b32a8fb34e5f), this variable became
obsolete and unused.
vendor/bmake: Add back LICENSE and VERSION
* Keep LICENSE for vendor software, keeping consistent with other vendor
softwares.
* VERSION can be included in the Makefile to avoid hardcoding the
version there.
kernel/apple_ir: Add Apple IR receiver driver.
USB HID driver for Apple IR receivers found in Mac computers
(2006-2011 era). Uses the u4b USB stack with interrupt transfers
and delivers key events through evdev.
Supports Apple Remote (proprietary 5-byte protocol) and generic NEC
IR remotes. Synthetic key-up events are generated via a 125ms callout
since the hardware sends no release reports.
Add UQ_HID_IGNORE quirks for all Apple IR receiver product IDs so
uhid(4) does not claim the device first. DragonFly's newbus probe
short-circuits on a 0 return, so the quirk is necessary to prevent
uhid's class-wide HID match from winning.
kernel/apple_smc: Table-drive sysctl registration and collapse duplicate handlers.
Replace fanminspeed/fanmaxspeed/fantargetspeed with single fanrw handler
using key index packed in arg2 bits [15:8]. Collapse sms_x/y/z, light
left/right, and mssd/mssp wrappers into table-indexed handlers. Table-drive
per-fan and system-state sysctl registration loops.
hammer2: factor out directory mtime update in vnops
Add hammer2_update_dir_mtime() for the repeated mtime/ctime update
pattern used after directory-modifying operations. Easier to maintain
and document in one place.
hammer: factor out blockmap layer CRC verification
Add hammer_verify_layer1_crc() and hammer_verify_layer2_crc() helpers
for the double-check-under-lock CRC pattern used across all blockmap
functions. Easier to maintain and document in one place.