asmc: use symbolic names with the MacPro3,1 model
Use `ASMC_LIGHT_FUNCS_DISABLED` and `ASMC_SMS_FUNCS_DISABLED` instead of
the unrolled versions of the macros.
This makes it easier to adjust the underlying macros/fields for
`struct asmc_model`.
No functional change intended.
MFC after: 1 week
(cherry picked from commit 90edc16166a6fef03d2384247d07d64656f03309)
asmc: use symbolic names with the MacPro3,1 model
Use `ASMC_LIGHT_FUNCS_DISABLED` and `ASMC_SMS_FUNCS_DISABLED` instead of
the unrolled versions of the macros.
This makes it easier to adjust the underlying macros/fields for
`struct asmc_model`.
No functional change intended.
MFC after: 1 week
(cherry picked from commit 90edc16166a6fef03d2384247d07d64656f03309)
asmc: code style modernization and minor cleanups
- Allow `ASMC_DEBUG` to be treated as a variadic macro.
- Add ellipses around `sizeof(..)` calls.
- Reindent some of the lines to better follow style(9) with line
wrapping.
A number of other clang-format changes were not taken as they are not
compatible with style(9).
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D55394
(cherry picked from commit e20e26e4e271ecb74e40d9a95ed3112ceaf9604f)
asmc: code style modernization and minor cleanups
- Allow `ASMC_DEBUG` to be treated as a variadic macro.
- Add ellipses around `sizeof(..)` calls.
- Reindent some of the lines to better follow style(9) with line
wrapping.
A number of other clang-format changes were not taken as they are not
compatible with style(9).
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D55394
(cherry picked from commit e20e26e4e271ecb74e40d9a95ed3112ceaf9604f)
[CIR] Add support for atomic-to-non-atomic cast (#193784)
This patch adds support for atomic-to-non-atomic casts in CIR.
Related to #192319 .
Assisted-by: Github Copilot / GPT-5.4
libnetbsd: add math.h and sys/time.h
- `math.h`: `isinff(..)`
- `sys/time.h`: `timespec*(x)`
These two headers are used by tests in newer snapshots of
`contrib/netbsd-tests`.
MFC after: 1 week
(cherry picked from commit 2a6c2d9c38dc421025b6c18cac68fe9965c574c0)
lib/libnetbsd: bring in `__type_m{ax,in}*` macro family
These macros are used by some of the NetBSD tests which calculate the
size of types, e.g., `__type_max(time_t)`.
This wraps up the set of macros needed in order to update to the a
netbsd-tests snapshot from this past month.
Obtained from: https://github.com/netbsd/src (55b4b44)
MFC after: 1 week
(cherry picked from commit db5344a7445f1a796bc3cacd32a46e88e3e589a7)
libnetbsd: add math.h and sys/time.h
- `math.h`: `isinff(..)`
- `sys/time.h`: `timespec*(x)`
These two headers are used by tests in newer snapshots of
`contrib/netbsd-tests`.
MFC after: 1 week
(cherry picked from commit 2a6c2d9c38dc421025b6c18cac68fe9965c574c0)
lib/libnetbsd: bring in `__type_m{ax,in}*` macro family
These macros are used by some of the NetBSD tests which calculate the
size of types, e.g., `__type_max(time_t)`.
This wraps up the set of macros needed in order to update to the a
netbsd-tests snapshot from this past month.
Obtained from: https://github.com/netbsd/src (55b4b44)
MFC after: 1 week
(cherry picked from commit db5344a7445f1a796bc3cacd32a46e88e3e589a7)
.gitignore: ignore additional unwanted files
Ignore more files generated by toolchains, e.g., `.pico`, etc. Ignore the
`.DS_Store` produced by macOS as well because all they provide is
additional file metadata that shouldn't be committed to `git`.
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D55096
(cherry picked from commit 4544f34f2d30ee63ab1eec9fa52c31bd92d457ca)
.gitignore: ignore additional unwanted files
Ignore more files generated by toolchains, e.g., `.pico`, etc. Ignore the
`.DS_Store` produced by macOS as well because all they provide is
additional file metadata that shouldn't be committed to `git`.
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D55096
(cherry picked from commit 4544f34f2d30ee63ab1eec9fa52c31bd92d457ca)
asmc: Convert driver to CTLFLAG_MPSAFE
Replace CTLFLAG_NEEDGIANT with CTLFLAG_MPSAFE for all sysctls.
The driver already uses spin mutexes (sc->sc_mtx) for hardware
access protection and does not require the Giant lock.
This improves scalability by allowing concurrent sysctl access
without Giant serialization.
Reviewed by: ngie, adrian
Differential Revision: https://reviews.freebsd.org/D54613
(cherry picked from commit 1a6bdd6266e3b53c8b6b597a77a100353b7ae13a)
asmc: Convert driver to CTLFLAG_MPSAFE
Replace CTLFLAG_NEEDGIANT with CTLFLAG_MPSAFE for all sysctls.
The driver already uses spin mutexes (sc->sc_mtx) for hardware
access protection and does not require the Giant lock.
This improves scalability by allowing concurrent sysctl access
without Giant serialization.
Reviewed by: ngie, adrian
Differential Revision: https://reviews.freebsd.org/D54613
(cherry picked from commit 1a6bdd6266e3b53c8b6b597a77a100353b7ae13a)
asmc: use `ASMC_FAN_FUNCS2` with the Macmini4,1
The Macmini4,1 model does not have "fansafespeed" support. This issue
typically manifests with messages like so:
```
asmc0: asmc_key_read for key F0Sf failed 10 times, giving up
```
Swap out `ASMC_FAN_FUNCS` with `ASMC_FAN_FUNCS2` to explicitly drop
"fansafespeed" checks in the driver for the model as it doesn't support
that hardware feature.
MFC after: 1 week
Reported by: @probonopd
Closes: https://github.com/helloSystem/ISO/issues/357
(cherry picked from commit 7b862cf8a252d80ab1fb90fa5371fd8462c7c16f)
asmc: use `ASMC_FAN_FUNCS2` with the Macmini4,1
The Macmini4,1 model does not have "fansafespeed" support. This issue
typically manifests with messages like so:
```
asmc0: asmc_key_read for key F0Sf failed 10 times, giving up
```
Swap out `ASMC_FAN_FUNCS` with `ASMC_FAN_FUNCS2` to explicitly drop
"fansafespeed" checks in the driver for the model as it doesn't support
that hardware feature.
MFC after: 1 week
Reported by: @probonopd
Closes: https://github.com/helloSystem/ISO/issues/357
(cherry picked from commit 7b862cf8a252d80ab1fb90fa5371fd8462c7c16f)
asmc: resource cleanup simplifications
This change makes `asmc_detach(..)` reentrant by setting freed resources
to known invalid values when done, and makes `asmc_attach(..)` call
`asmc_detach(..)` instead of attempting to the semi-equivalent way of
cleaning up the driver resources allocated in `asmc_detach(..)`.
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D55413
(cherry picked from commit eda36ae09dd1fab78bd377739fc5d6c65c61f5d7)
asmc: output the SMC firmware revision on attach
The SMC firmware revision can prove helpful when determining why the
behavior of a given controller varies from the maintainers' expected
behavior.
This should be a sysctl (eventually), but for now dumping out the
information via `device_printf(..)` suffices, given that only one
asmc(4) compatible device can exist in an Apple platform at any
given point in time. This will become a sysctl in the future after
additional improvements are incorporated from OpenBSD and NetBSD.
MFC after: 1 week
Obtained from: https://github.com/openbsd/src/ (sys/dev/acpi/asmc.c @ 142d064)
Differential Revision: https://reviews.freebsd.org/D55577
(cherry picked from commit e81e724358e43dcf951e244a9df9df3eaa983fe9)
chore: asmc: use designated initializers in macros
This code cleanup makes it easier for human readers to understand what each
of the fields actually represents, as well as makes it easier to modify
what the macros actually do under the covers, without introducing
potential human errors.
No functional change intended.
MFC after: 1 week
(cherry picked from commit ef1cde51032d395492caae302fedf183c58a482b)
asmc: introduce the concept of generic models
Having to enter in each of the models for Apple hardware, recompiling,
etc, is tedious. Provide generic models so end-users can leverage some
of the capabilities provided by the driver, i.e., common features like
minimal fans and lights (if present on the generic model) support.
The generic models are as follows:
- Macmini
- MacBookAir
- MacBookPro
- MacPro
This sort of follows the pattern established by the `applesmc` driver in
Linux.
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D55395
(cherry picked from commit 3023bb49e115b4149f9fc0683dabde172ecb1336)