Commit graph

63 commits

Author SHA1 Message Date
Warner Losh fdafd315ad sys: Automated cleanup of cdefs and other formatting
Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by:		Netflix
2023-11-26 22:24:00 -07:00
Warner Losh 685dc743dc sys: Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2023-08-16 11:54:36 -06:00
Warner Losh 95ee2897e9 sys: Remove $FreeBSD$: two-line .h pattern
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
2023-08-16 11:54:11 -06:00
Warner Losh 4d846d260e spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with:		pfg
MFC After:		3 days
Sponsored by:		Netflix
2023-05-12 10:44:03 -06:00
Adrian Chadd 2e9d05fd68 asmc: Add support for 10 byte light sensor payloads; MacBookAir6,1
The later macbook models use a different packet payload for the light
sensors:

* There's only one, done in the camera
* It's a 4 byte sensor value, not a 2 byte value
* It's in a 10 byte payload.

So, this adds support for that and flips it on for the MacbookAir6,2.

It also adds support for MacBookAir6,1 as that now works fine here.

Tested - MacBookAir6,1 and 6,2

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D38365
2023-02-08 04:06:16 +00:00
Adrian Chadd ffc58e2ca3 asmc: Add MacbookAir6,2
Add in the zones for my MacbookAir6,2, a 2013 Macbook Air.

Tested - said Macbook Air 2013.  Thermal Zones and keyboard backlight
control works fine.

Differential Revision: https://reviews.freebsd.org/D38073
Approved by: jrtc27
2023-01-21 04:34:31 +00:00
Michael Gmelin 638937d466 asmc: Add support for MacBook5,5
This is a slightly refined version of a patch[0] by FreeBSD Forums
user "tmcclean".

[0]https://forums.freebsd.org/threads/success-installing-freebsd-13-0-on-macbook-pro-5-5.80458/

Reviewed by:	adrian, emaste, imp
Differential Revision:	https://reviews.freebsd.org/D37900
MFC after:	1 month
2023-01-06 20:11:56 +01:00
ed crowe 3416f5cde7 asmc: Add support for MacBookPro6,2
Modify asmc_sms_printintr() to be silent when the ambient light sensor
interrupt fires on this model, since the messages can otherwise fill up
the dmesg.

PR:		265005
Reviewed by:	markj
MFC after:	2 weeks
2022-07-25 11:43:56 -04:00
John Baldwin 867864a2fb asmc: Remove unused devclass argument to DRIVER_MODULE. 2022-05-09 12:22:00 -07:00
Adam S dc484aed0a asmc: Update Mac Pro 6 sensor definitions
- Make descriptions a bit more human-friendly.
- Don't attempt to probe fan safe speeds, this model does not provide
  one.

PR:		260781
MFC after:	2 weeks
2022-05-09 08:56:39 -04:00
Trev 601abb300c asmc: Add support for Macmini 5,1 (2011) and 5,3 and 7,1 (2014) models
PR:		262456
MFC after:	2 weeks
2022-05-04 11:31:01 -04:00
Mark Johnston a31b0c0c47 asmc: Style
MFC after:	2 weeks
2022-05-04 11:31:01 -04:00
Daniel W. Delâtre 79291c9baf asmc: Add support for MacBook Pro 9,1 (mid 2012)
PR:		261981
MFC after:	2 weeks
2022-05-04 11:31:01 -04:00
Mark Johnston 27d4c6f86e asmc: Make the model table const and local to asmc.c
No functional change intended.

MFC after:	2 weeks
2022-05-04 11:31:01 -04:00
Adam S 7d5fef1837 asmc: Add support for MacPro 6,1 (2013)
PR:		260781
MFC after:	2 weeks
2022-05-04 11:31:01 -04:00
Mark Johnston 308340cce2 asmc: Add support for MacBook Air 4,1 and 4,2 (2011)
PR:		218574
Submitted by:	NapoleonWils0n <t43InvisibleMan@gmail.com>
Submitted by:	John Hay <john@sanren.ac.za>
MFC after:	2 weeks
2022-05-04 11:30:47 -04:00
Mateusz Guzik e02d0cab7b asmc: plug set-but-not-unused vars
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-12-10 11:45:36 +00:00
Mateusz Guzik 721b3402b6 asmc: clean up empty lines in .c and .h files 2020-09-01 21:40:30 +00:00
Mark Johnston 9c325393d5 asmc(4): Handle errors from asmc_key_read() properly.
asmc_key_read() returns only 0 and 1, some callers were checking
incorrectly for failure.

PR:		248939
Submitted by:	Tong Zhang <ztong0001@gmail.com>
MFC after:	1 week
2020-08-27 16:34:20 +00:00
Mark Johnston e4a14ce70f asmc(4): Add support for MacBook7,1.
PR:		248693
Submitted by:	gcx61@interia.pl
MFC after:	1 week
2020-08-17 12:47:08 +00:00
Pawel Biernacki 7029da5c36 Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)
r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are
still not MPSAFE (or already are but aren’t properly marked).
Use it in preparation for a general review of all nodes.

This is non-functional change that adds annotations to SYSCTL_NODE and
SYSCTL_PROC nodes using one of the soon-to-be-required flags.

Mark all obvious cases as MPSAFE.  All entries that haven't been marked
as MPSAFE before are by default marked as NEEDGIANT

Approved by:	kib (mentor, blanket)
Commented by:	kib, gallatin, melifaro
Differential Revision:	https://reviews.freebsd.org/D23718
2020-02-26 14:26:36 +00:00
David Bright 9e33968b60 asmc: Add support for Mac mini 2,1
PR:		235798
Submitted by:	Trev <fbsdbugs4@sentry.org>
Reported by:	Trev <fbsdbugs4@sentry.org>
MFC after:	1 week
2019-02-25 21:59:01 +00:00
David Bright 9f0bfc517c asmc: Add support for Mac mini 4,1 (Mid-2010)
MFC after:	1 week
2019-01-06 23:43:12 +00:00
David Bright 98ae4866ba asmc: Patch to add MacBook Pro 9,2 support
PR:		211513
Submitted by:	William Theesfeld Jr <wtheesfeld@mailbox.org>
Reported by:	William Theesfeld Jr <wtheesfeld@mailbox.org>
MFC after:	1 week
2019-01-04 18:21:49 +00:00
David Bright 39a8ee1351 asmc: Add support for MacPro1,1
PR:		203431
Submitted by:	jjr@alisa.org & holindho@saunalahti.fi
Reported by:	jjr@alisa.org
MFC after:	1 week
2018-12-19 16:45:37 +00:00
David Bright 71b475e7dd asmc: Add support for mid-2011 Macmini 5,2
PR:		225911
Submitted by:	trev <fbsdbugs4@sentry.org>
Reported by:	trev <fbsdbugs4@sentry.org>
MFC after:	1 week
2018-12-17 17:21:45 +00:00
David Bright 09ff71d357 asmc: Add Support for Macbook Pro 8,1
PR:		217505
Submitted by:	John O. Brickley <obryan.brickley@gmail.com>, updated by Maciej Pasternacki <maciej@pasternacki.net>
Reported by:	John O. Brickley <obryan.brickley@gmail.com>
MFC after:	1 week
2018-12-12 13:43:55 +00:00
David Bright 081954d3a2 asmc: Add Support for MacBookAir 7,1 and 7,2
PR:		226172
Submitted by:	James Wright <james.wright@jigsawdezign.com>
Reported by:	James Wright <james.wright@jigsawdezign.com>
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D18396
2018-12-11 16:35:59 +00:00
Takanori Watanabe 5efca36fbd Distinguish _CID match and _HID match and make lower priority probe
when _CID match.

Reviewed by: jhb, imp
Differential Revision:https://reviews.freebsd.org/D16468
2018-10-26 00:05:46 +00:00
Conrad Meyer a0638b33f7 Yank crufty INTR_FILTER option
It was introduced to the tree in r169320 and r169321 in May 2007.

It never got much use and never became a kernel default.  The code
duplicates the default path quite a bit, with slight modifications.  Just
yank out the cruft.  Whatever goals were being aimed for can probably be met
within the existing framework, without a flag day option.

Mostly mechanical change: 'unifdef -m -UINTR_FILTER'.

Reviewed by:	mmacy
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D15546
2018-05-24 17:06:00 +00:00
Ed Maste 95320b99a5 asmc: update temperature sensor name/description
PR:		225911
Submitted by:	Trev <fbsdbugs4 at sentry.org>
MFC after:	1 week
2018-03-08 18:52:47 +00:00
Pedro F. Giffuni 718cf2ccb9 sys/dev: further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.
2017-11-27 14:52:40 +00:00
Adrian Chadd 109e2d29cc [asmc] Add support for MacBook Pro 11,2
This patch will add support for MacBookPro 11.2.
For the macros, the MBP11_* macros (for the existing MacBookPro11.3) did not
match so they have been renamed to MBP113_* and a new MBP112_* has been
added (modified copy of MBP11_*).

Some trailing whitespaces may have been removed automatically.

PR:		kern/214836
Obtained from:	Johannes Lundberg <johannes@brilliantservice.co.jp
2017-02-17 18:49:18 +00:00
Adrian Chadd 31ae3b070d [asmc] Add support for MacBookPro5,1
Tested by:	Johannes Lundberg <johannes@brilliantservice.co.jp>
PR:		kern/209179
Submitted by:	Thomas Brierley <tomxor@gmail.com>
2016-05-03 17:11:33 +00:00
Pedro F. Giffuni 453130d9bf sys/dev: minor spelling fixes.
Most affect comments, very few have user-visible effects.
2016-05-03 03:41:25 +00:00
Adrian Chadd 108e307680 [asmc] add support for more models and restore keyboard backlight after resume.
This patch adds support for restoring backlight after resume and adds models
Macbook3,1
MacbookAir5,1
MacbookAir5,2

It also incorporates fixes for bug #175260, bug #203610 and bug #203512
so those can be closed if this patch is applied.

PR:		kern/209156
PR: kern/175260
PR: kern/203610
PR: kern/203512
Submitted by:	Johannes Lundberg <johannes@brilliantservice.co.jp>
2016-05-02 19:15:16 +00:00
Ulrich Spörlein 623534d683 Fix undefined behavior when using asmc_fan_getstring()
It was returning a pointer to stack-allocated memory, so make the
allocation at the caller instead.

Found by:	clang static analyzer
Coverity:	CID 1245774
Reviewed by:	ed, rpaulo
Review URL:	https://reviews.freebsd.org/D4740
2016-01-05 10:25:22 +00:00
Hans Petter Selasky 0e1152fcc2 The SYSCTL data pointers can come from userspace and must not be
directly accessed. Although this will work on some platforms, it can
throw an exception if the pointer is invalid and then panic the kernel.

Add a missing SYSCTL_IN() of "SCTP_BASE_STATS" structure.

MFC after:	3 days
Sponsored by:	Mellanox Technologies
2014-10-28 12:00:39 +00:00
Davide Italiano 2be111bf7d Follow up to r225617. In order to maximize the re-usability of kernel code
in userland rename in-kernel getenv()/setenv() to kern_setenv()/kern_getenv().
This fixes a namespace collision with libc symbols.

Submitted by:   kmacy
Tested by:      make universe
2014-10-16 18:04:43 +00:00
Rui Paulo 447666f08b Improvements to asmc(4):
1. changed the code so that 2**16 keys are supported
2. changed the number of possible fans in a system from 2 to 6
3. added write support for some fan sysctls
4. added a new sysctl which shows the ID of the fan
5. added four more apple models with their temperature keys
6. changed the maxnumber of temperature keys from 36 to 80
7. replaced several fixed buf sizes to sizeof buf

Obtained from:	Denis Ahrens denis at h3q.com
MFC after:	4 weeks
2014-09-22 16:20:38 +00:00
Gavin Atkinson 764442e03d Add support to asmc(4) for Macmini 3,1.
PR:		190195
Submitted by:	fbsdbugs2 sentry.org
MFC after:	1 week
Relnotes:	yes
2014-07-05 21:34:37 +00:00
Roman Divacky 46c7655029 Give device_printf format string to pacify clang warning. 2012-11-09 14:58:26 +00:00
Eitan Adler a8de37b024 This isn't functionally identical. In some cases a hint to disable
unit 0 would in fact disable all units.

This reverts r241856

Approved by: cperciva (implicit)
2012-10-22 13:06:09 +00:00
Eitan Adler 76b7512247 Now that device disabling is generic, remove extraneous code from the
device drivers that used to provide this feature.

Reviewed by:	des
Approved by:	cperciva
MFC after:	1 week
2012-10-22 03:41:14 +00:00
Rui Paulo f17bca8261 Use %zu for size_t.
Fix printf format string (again)

Pointed out by:	bde, ed
2009-09-14 21:33:00 +00:00
Rui Paulo b660846ed8 Fix previous commit. I got it backwards.
MFC after:	1 week
2009-09-14 16:16:07 +00:00
Rui Paulo e1311070b0 Fix printf format string in asmc_key_dump().
Spotted by:	tinderbox
MFC after:	1 week
2009-09-14 15:53:30 +00:00
Rui Paulo 1269f4d431 Make the sudden motion sensor work on older models and add a bit of
debugging.

Submitted by:	Christoph Langguth <christoph at rosenkeller.org>
MFC after:	1 week
2009-09-14 11:46:43 +00:00
Rui Paulo 3471c35ded Make dev.asmc.N.light.control writable by everyone.
Submitted by:	Patrick Lamaiziere <patfbsd at davenulle.org>
MFC after:	1 week
2009-08-23 09:58:06 +00:00
Rui Paulo be80e49a01 Add support for MacBook4,1.
Submitted by:	Christoph Langguth <christoph at rosenkeller.org>
MFC after:	2 weeks
Approved by:	re (kib)
2009-06-26 10:23:17 +00:00