Commit Graph

26 Commits

Author SHA1 Message Date
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
Gordon Bergling
68c0bd3e3f amdsbwd(4): Fix a typo in a source code comment
- s/accross/across/

MFC after:	3 days
2022-06-04 11:26:44 +02:00
John Baldwin
83a273efce dev/amd*: Remove unused devclass arguments to DRIVER_MODULE. 2022-05-09 12:22:00 -07:00
Andriy Gapon
cca0d3bbd8 amdsbwd: always enable watchdog register decoding
This seems to be required even if the watchdog is accessed via the common
MMIO space.

Tested on:
- Ryzen 3 3200U APU;
- Ryzen 7 5800X CPU with X570 chipset.

MFC after:	2 weeks
2021-12-13 13:36:50 +02:00
Mateusz Guzik
e492d18c3c amd*: clean up empty lines in .c and .h files 2020-09-01 21:39:19 +00:00
Konstantin Belousov
decf9c5ff6 amdsbwd, intpm: Add Hygon Dhyana support.
Initialize the FCH SMBus controller for Hygon Dhyana CPU.
Set the vendor of the FCH description via the exact CPU vendor.

Submitted by:	Pu Wen <puwen@hygon.cn>
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D23558
2020-02-13 19:09:24 +00:00
Conrad Meyer
e2e050c8ef Extract eventfilter declarations to sys/_eventfilter.h
This allows replacing "sys/eventfilter.h" includes with "sys/_eventfilter.h"
in other header files (e.g., sys/{bus,conf,cpu}.h) and reduces header
pollution substantially.

EVENTHANDLER_DECLARE and EVENTHANDLER_LIST_DECLAREs were moved out of .c
files into appropriate headers (e.g., sys/proc.h, powernv/opal.h).

As a side effect of reduced header pollution, many .c files and headers no
longer contain needed definitions.  The remainder of the patch addresses
adding appropriate includes to fix those files.

LOCK_DEBUG and LOCK_FILE_LINE_ARG are moved to sys/_lock.h, as required by
sys/mutex.h since r326106 (but silently protected by header pollution prior
to this change).

No functional change (intended).  Of course, any out of tree modules that
relied on header pollution for sys/eventhandler.h, sys/lock.h, or
sys/mutex.h inclusion need to be fixed.  __FreeBSD_version has been bumped.
2019-05-20 00:38:23 +00:00
Andriy Gapon
34577ddb15 amdsbwd: fix reboot status reporting
Originally, I overlooked that PMIO register 0xc0 has a dual personality.
It can either be S5/Reset Status register or Misc. Fix register (aka
debug status register).  The mode is controlled by bit 2 in PMIO
register 0xc4.  Apparently there are register programming requirements
for the second personality, so many BIOSes leave the register, after
programming it, in that mode.  So, we need to switch the register to the
correct mode.

Additionally, AMDSB8_WD_RST_STS was defined incorrectly as bit 13 while
it is actually bit 25 (and the register's width is 32 bits, not 16).

With this change I see the following in dmesg after a reset by the
watchdog:
amdsbwd0: ResetStatus = 0x42000000
amdsbwd0: Previous Reset was caused by Watchdog

MFC after:	2 weeks
2018-05-05 05:22:11 +00:00
Andriy Gapon
9a042dbc6e amdsbwd: add suspend and resume methods
Without the suspend method the watchdog may fire in S1 state.  Without
the resume method the watchdog is not re-enabled after returning from S3
state.  I observe this on one of my systems.

Not sure if watchdog(4) should participate in the suspend actions.
Right now everything is up to individual drivers.

MFC after:	2 weeks
2018-05-03 15:33:18 +00:00
Eitan Adler
66e77f8d1c [amdsbwd] teach amdsbwd that it has options
AMDSBWD_DEBUG was previously checked for as a #define but it was not
possible to define it

Reviewed by:	kevans
Discussed with:	kenm
2018-04-24 13:07:17 +00:00
Andriy Gapon
cf38c8c630 amdsbwd: fix handling of timeout values beyond the supported range
The driver now fully observes watchdog(9) protocol.
Previously a too large timeout was silently clamped while the correct
behavior is to disable the watchdog and leave the error as is
(i.e. to not report success).

Also, previously a too small value caused the timer to stop while the
correct behavior is to use the minimal supported value.

MFC after:	2 weeks
2018-01-10 17:35:00 +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
Andriy Gapon
b2b4f88476 the rest of changes intended to be committed in r306290
MFC after:	5 days
X-MFC with:	r306218
2016-09-24 07:59:54 +00:00
Andriy Gapon
149a5d40c9 clarify description of the 0x790b1022 / "KERNCZ"/ "CZ" device
MFC after:	5 days
X-MFC with:	r306218
2016-09-24 07:55:49 +00:00
Andriy Gapon
3673f7136a amdsbwd, intpm: unify bits specific to AMD chipsets (FCHs, southbridges)
AMD chipsets have proprietary mechanisms for dicovering resources.
Those resources are not discoverable via plug-and-play mechanisms
like PCI configuration registers or ACPI.
For this reason a chipset-specific knowledge of proprietary registers
is required.

At present there are two FreeBSD drivers that require the proprietary
resource discovery.  One is amdsbwd which is a driver for the watchdog
timer in the AMD chipsets.  The other is intpm SMBus driver when it
attaches to the newer AMD chipsets where the resources of the SMBus HBA
are not described in the regular PCI way.

In both cases the resources are discovered by accessing AMD PMIO space.
Thus, many definitions are shared between the two drivers.
This change puts those defintions into a common header file.

As an added benefit, intpm driver now supports newest FCHs built into
AMD processors of Family 15h, models 70h-7Fh and Family 16h, models
30h-3Fh.

Reviewed by:	kib
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D8004
2016-09-22 21:34:35 +00:00
Andriy Gapon
9626ccde7f amdsbwd: add support for FCH in family 16h models 30h-3Fh processors
Requested by:	Mike Tancsa <mike@sentex.net>
Tested by:	Mike Tancsa <mike@sentex.net>
MFC after:	1 week
2016-09-07 13:45:35 +00:00
Alexander Motin
bc8b0193a6 Add support for AMD FCH watchdog timers.
MFC after:	2 weeks
2016-03-29 12:19:46 +00:00
Justin Hibbits
eff83876b6 Replace several bus_alloc_resource() calls with bus_alloc_resource_any()
Most of these are BARs, and we allocate them in their entirety.  The one outlier
in this is amdsbwd, which calls bus_set_resource() prior.

Reviewed by:	jhb
Differential Revision:	https://reviews.freebsd.org/D5370 (partial)
2016-02-27 03:34:01 +00:00
Sofian Brabez
61bfd86762 Use DEVMETHOD_END macro defined in sys/bus.h instead of {0, 0} sentinel on device_method_t arrays
Reviewed by:	cognet
Approved by:	cognet
2013-01-30 18:01:20 +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
Andriy Gapon
d1817e7db7 amdsbwd: update to support SB8xx southbridges
Many thanks to Tino <tinotom@gmail.com> for drawing my attention to
this, for doing a lot of testing and providing great feedback.
Many thanks to AMD for continuing to release public specifications for
their chipsets.

PR:		kern/157568
Tested by:	Tino <tinotom@gmail.com>
MFC after:	1 week
2011-06-07 06:18:02 +00:00
Andriy Gapon
fd63f40f93 amdsbwd: fix nonsensical timeout calculations
in case when sub-second interval is being programmed

Found by:	clang static analyzer
MFC after:	4 days
2010-05-31 09:07:23 +00:00
Andriy Gapon
5022f21bd9 amdsbwd: new driver for AMD SB600/SB7xx watchdog timer
The hardware is compliant with WDRT specification, so I originally
considered including generic WDRT watchdog support, but decided
against it, because I couldn't find anyone to the code for me.
WDRT seems to be not very popular.
Besides, generic WDRT porbably requires a slightly different driver
approach.

Reviewed by:	des, gavin, rpaulo
MFC after:	3 weeks
2009-11-30 11:44:03 +00:00