Commit graph

63 commits

Author SHA1 Message Date
John Baldwin 1587a9db92 pci_cfgreg: Add a PCI domain argument to the low-level register API
This commit changes the API of pci_cfgreg(read|write) to add a domain
argument (referred to as a segment in ACPI parlance) (note that this
is not the same as a NUMA domain, but something PCI-specific).  This
does not yet enable access to domains other than 0, but updates the
API to support domains.

Places that use hard-coded bus/slot/function addresses have been
updated to hardcode a domain of 0.  A few places that have the PCI
domain (segment) available such as the acpi_pcib_acpi.c Host-PCI
bridge driver pass the PCI domain.

The hpt27xx(4) and hptnr(4) drivers fail to attach to a device not on
domain 0 since they provide APIs to their binary blobs that only
permit bus/slot/function addressing.

The x86 non-ACPI PCI bus drivers all hardcode a domain of 0 as they do
not support multiple domains.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D42827
2023-11-29 10:31:47 -08:00
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
John Baldwin 86dc8398c9 ftwd/ichwd/itwd/viawd/wbwd: Remove unused devclass arguments to DRIVER_MODULE. 2022-05-09 12:22:01 -07:00
Paweł Anikiel 9da8235cc8 ichwd: add Lewisburg Super SKUs, Cannon and Comet Lake support
Cannon and Comet Lake PCHs have their PMC hidden, so when reading
the ACPI Base Address fails, we assume a default value.

Obtained from:	Semihalf
Sponsored by:	Stormshield
2021-08-26 12:04:28 +02:00
Justin Hibbits 77cb3b49b7 ichwd: Add Atom C3000 watchdog ID.
MFC after:	3 days
Sponsored by:	Juniper Networks, Inc
2020-03-24 21:28:48 +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 3e9ec69a35 ichwd: add a few assertions about tco_version
Those should ensure correctness of ichwd_find_ich_lpc_bridge() and
ichwd_find_ich_lpc_bridge() as well as make it easier for both humans
and static analyzers to see the relation between tco_version and ich and
smb variables in ichwd_identify().

Reported by:	Coverity
CID:		1396314, 1396317
MFC after:	10 days
2018-12-18 17:17:53 +00:00
Andriy Gapon 701ded4e30 ichwd: add Sunrise Point-LP ID
Submitted by:	Tetsuya Uemura <t_uemura@macome.co.jp>
Tested by:	Tetsuya Uemura <t_uemura@macome.co.jp>
MFC after:	2 weeks
Relnotes:	maybe
2018-12-14 09:30:43 +00:00
Andriy Gapon 8b65c16f6e ichwd: add support for clearing No Reboot bit in TCOv4
This is based on a patch developed by
Tetsuya Uemura <t_uemura@macome.co.jp>.
Many thanks!

Submitted by:	Tetsuya Uemura <t_uemura@macome.co.jp> (earlier version)
Tested by:	Tetsuya Uemura <t_uemura@macome.co.jp>
MFC after:	2 weeks
2018-12-14 09:28:20 +00:00
Andriy Gapon da4e7cad13 ichwd: add support for TCO watchdog timer in Lewisburg PCH (C620)
The change is based on public documents listed below as well as Linux
changes and the code developed by Kostik.

The documents:
- Intel® C620 Series Chipset Platform Controller Hub Datasheet
- Intel® 100 Series and Intel® C230 Series Chipset Family Platform
  Controller Hub (PCH) Datasheet - Volume 2 of 2

Interesting Linux commits:
- 9424693035
- 2a7a0e9bf7

The peculiarity of the new chipsets is that the watchdog resources are
configured in PCI registers of SMBus controller and Power Management
function as opposed to the LPC bridge.  I took a simplistic approach of
querying the resources from the respective PCI devices.  ichwd is still
a device on isa bus.  The PCI devices are found by their slot and
function defined in the datasheets as siblings of the upstream LPC
bridge.

There are some shortcuts and missing features.

First of all, I have not implemented the functionality required to clear
the no-reboot bit.  That would require writing to a special PCI
configuration register of a hidden / invisible PCI device after which
the device would start responding to accesses to other registers.  The
no-reboot bit was not set on my test hardware, so I decided to leave its
handling for the later time.

Also, I did not try to handle the case where the watchdog resources are
not configured by the hardware as well as the case where ACPI defined
operational region conflicts with the watchdog resources.  My test
system did not have either of those problem, so, again, I decided to
leave those cases until later.
See this Linux commit for some details of the ACPI problem:
a7ae81952c

Finally, I have added only the PCI ID found on my test system.  I think
that more IDs can be added as the change gets tested.

Tested on Dell PowerEdge R740.

PR:		222079
Reviewed by:	mav, kib
MFC after:	3 weeks
Relnotes:	maybe
Sponsored by:	Panzura
Differential Revision: https://reviews.freebsd.org/D17585
2018-10-22 14:44:44 +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
Konstantin Belousov 263f801fef Fix typo, TC0->TCO.
Submitted by:	jhb
MFC after:	1 week
2017-09-10 13:21:54 +00:00
Konstantin Belousov 8bbe154276 Add definitions of (new) bits for TCO registers from the
Lewisburg/Sunrise Point documentation.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2017-09-10 12:10:27 +00:00
Konstantin Belousov d703e54899 Style: tab after #define.
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2017-09-10 11:57:02 +00:00
Alexander Motin 40715e9ed7 Add explicit check for PCI bus to r321720.
Reported by:	jhb
MFC after:	6 days
2017-08-01 09:22:10 +00:00
Alexander Motin 26567f6924 Attach ichwd(4) only to ISA bus of the LPC bridge.
Resource allocation for parent device does not look good by itself, but
attempt to allocate them for unrelated device just does not end up good.
On Asus X99-E WS/USB3.1 system reporting ISA bridge via both PCI and ACPI
this reported to cause kernel panic on shutdown due to messed resources:
https://bugs.freenas.org/issues/25237.

MFC after:	1 week
2017-07-30 15:19:07 +00:00
Warner Losh 9417c448f8 Fixed TCO v3 tick convert
TCO v3's internal timer is stored as seconds.

Submitted by:	Denir Li <denir-li@users.noreply.github.com>
Pull Request:	https://github.com/freebsd/freebsd/pull/51
Pull Request:	https://github.com/freebsd/freebsd/pull/52
2017-03-01 05:18:43 +00:00
Alexander Motin fc6eef7aa8 Unify ichwd(4) attachment messages in dmesg.
MFC after:	2 weeks
2016-03-24 23:24:00 +00:00
Fabien Thomas 078246e50f Add ichwd TCO version 3 support (Bay Trail / Rangeley...)
Reviewed by: jhb
Obtained from: Cas-well
Sponsored by: Stormshield
2015-08-18 14:54:29 +00:00
Christian Brueffer 16858c207b Actually recognize all Intel Lynx Point devices we have device IDs for.
PR:		195851
Submitted by:	ftigeot@wolfpond.org
MFC after:	1 week
2015-07-16 11:14:59 +00:00
Alexander Motin e67f3bec39 Add bunch of PCI IDs of Intel Wildcat Point (9 Series) chipsets.
MFC after:	1 week
2014-11-26 04:23:21 +00:00
Jack F Vogel 428e286da3 Add new Coleto Creek device support: SATA, SMBus, and Watchdog devices.
MFC after: 1 week
2013-07-19 21:37:40 +00:00
Mark Johnston 784bcaa1dc Don't log a message when the watchdog is reloaded. It's not useful to do so
and these messages flood the log when bootverbose is enabled.

Approved by:	rstone (co-mentor)
2013-03-09 15:04:44 +00:00
Jack F Vogel 5531f5a148 Add support for new Intel Lynx Point PCH - Watchdog Timer Device IDs 2013-01-02 21:45:20 +00:00
John Baldwin e0636bc0ca Remove use of explicit bus space tags and handles and use methods that
operate on resource objects instead.

MFC after:	1 week
2012-01-05 16:27:32 +00:00
Xin LI cdd4eea9fc Fix a bug in ichwd(4) which prevents it from beig enabled if the new
timeout is the same timeout.

Submitted by:	Dmitrij Tejblum <tejblum yandex-team.ru>
PR:		kern/139604
MFC after:	2 weeks
Approved by:	re (kib)
2011-09-02 17:06:50 +00:00
Jack F Vogel 73e3bb6563 Chipset support for the new Intel Panther Point PCH, thanks
to Seth Heasley for preparing the changes.
2011-05-11 20:31:27 +00:00
Attilio Rao f451d23cfc Add missing bit in r221015.
Sponsored by:	Sandvine Incorporated
Reviewed by:	des
MFC after:	1 week
X-MFC:		r221015
2011-04-25 14:12:58 +00:00
Attilio Rao bb83df766c Don't assume that SMI are enabled when attaching ichwd and then do
correct unwind based on former state.

Sponsored by:	Sandvine Incorporated
Reviewed by:	des
MFC after:	1 week
2011-04-25 14:10:33 +00:00
Dag-Erling Smørgrav bffd599bc9 Whitespace nit 2011-04-25 09:18:05 +00:00
Attilio Rao d0827a169b Add some more bit definitions:
- TCO_MESSAGEx: TCO specific regs providing the ability to monitor BIOS
  bootup activity.
- TCO_NEWCENTURY: reporting RTC year roll over.
- TCO_NMI2SMI_EN, TCO_NMI_NOW: controlling SMIs conversion to NMIs and
  NMI trigger.
- SMI_GBL_EN: Enabling SMI delivery for all the northbridge controller.

MFC after:	10 days
2011-04-21 14:39:33 +00:00
Jack F Vogel bf0477b215 Support for the new Patsburg PCH chipset:
- SMBus Controller
     - SATA Controller
     - HD Audio Controller
     - Watchdog Controller

Thanks to Seth Heasley (seth.heasley@intel.com) for providing us code.

MFC after 3 days
2011-02-01 01:05:11 +00:00
Jack F Vogel d5267ede37 Support for the new DH89xxCC PCH chipset including:
- SATA controller
      - Watchdog timer
      - SMBus controller
2011-01-31 18:41:52 +00:00
Attilio Rao cb1f5a37e9 Use convenience macro for minimum and maximum value capping when
re-arming the watchdog timeout.

Sponsored by:	Sandvine Incorporated
Submitted by:	Mark Johnston <mjohnston at sandvine dot com>
Reviewed by:	des
MFC after:	10 days
2010-12-08 15:32:54 +00:00
Ed Maste 0c761ee78d Add a comment to clarify that some BIOSes may clear the hw watchdog
indicator bit, preventing us from reporting in that case.

X-MFC-with:	r215868
2010-12-07 19:18:00 +00:00
Ed Maste 84fe19c742 Fix build by correcting function name. Pointed out by dougb. 2010-11-27 00:26:19 +00:00
Attilio Rao fe4424cbbd - Advertise when the reboot came from a watchdog-induced reset.
- Fix a bug where TCO_BOOT_STS was supposed to be cleared after
  TCO_SECOND_TO_STS and not before.

Sponsored by:	Sandvine Incorporated
Submitted by:	Mark Johnston <mjohnston at sandvine dot com>
Reviewed by:	des
MFC after:	10 days
2010-11-26 15:35:08 +00:00
Jack F Vogel 6d23f8741b Add Intel Cougar Point PCH LPC Controller Device IDs
for watchdog support. Also add additional Intel Ibex
Peak (5 Series/3400 Series) PCH IDs.

MFC after a week
2010-08-28 00:09:46 +00:00
Andriy Gapon 7f5b7f2323 ichwd: correct range check for timeout value
This is similar to a fix in r189305 but for earlier ICH versions (<= 5).

Reported by:	someone via attilio
Discussed with:	des, attilio
MFC after:	1 week
2010-07-24 19:40:16 +00:00
Remko Lodder b6a18bc939 Add support for the NM10 chipset.
PR:		kern/143118
Submitted by:	Koshin sumitani <ksumitani at mui dot biglobe dot ne dot jp>
Approved by:	imp (mentor, implicit)
MFC after:	3 days
2010-01-24 10:50:20 +00:00
Ed Maste b8c05be0c1 Add H55 ID from Mike Tancsa, with minor rewording from avg@.
PR:		kern/143068
Submitted by:	Mike Tancsa (Sentex)
MFC after:	1 week
2010-01-22 16:05:10 +00:00
Andriy Gapon ede807c429 ichwd: don't attach to isa pnp device(s) by accident
Reviewed by:	imp, des
MFC after:	1 week
2009-11-07 11:41:23 +00:00
Nick Hibma 9ee1df0ce5 Don't print out a message on loading a module. 'kldload -v' and 'kldstat
| grep <modname>' can be used instead.

Put a message behind bootverbose as

	ichwd0: <Intel ICH6M watchdog timer> on isa0
	ichwd0: Intel ICH6M watchdog timer (ICH6 or equivalent)

does not make a lot of sense.

MFC after:	1 week
2009-09-10 18:33:08 +00:00
Dag-Erling Smørgrav 5f9672e15d Rename two functions to make their purpose clearer. Add tons of comments.
Generated code is identical after stripping .comment section.

Suggested by:	Andriy Gapon <avg@icyb.net.ua>
MFC after:	2 weeks
2009-03-19 12:39:13 +00:00
Andriy Gapon d38d0090c0 ichwd: correct range check for timeout value
Approved by:	jhb (mentor)
2009-03-03 15:50:24 +00:00
John Baldwin 94bf3b9f69 Add more PCI IDs including those for ICH10.
PR:		kern/126736
Submitted by:	Olivier Smedts  olivier of gid0 org
MFC after:	1 week
2008-08-25 15:23:54 +00:00
Dag-Erling Smørgrav 909a07a8cf Add support for ICH8M.
PR:		kern/119351
Submitted by:	Takeharu KATO <takeharu1219@ybb.ne.jp>
MFC after:	1 week
2008-01-07 09:46:39 +00:00