Commit graph

74 commits

Author SHA1 Message Date
Kristof Provost 8ecb749425 ichsmb: add Cedar Fork PCI id
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2024-02-10 02:14:27 +01:00
Andriy Gapon cbf7c81b60 ichsmb: fix block read operation
First of all and unlike I2C, it's not the master that dictates how many
bytes to read in block read operation.  It's the device that informs the
master how many bytes it's sending back.

Thus, for ichsmb_bread() the count parameter is purely an output
parameter.  The code has been changed to reflect that.
The sanity checking of the response length is now done once it (the
first byte of the response) is received.

While here, handling of ICH_HST_STA_FAILED status bit has been added.
Plus some code style improvements and some new code comments in the
vicinity of the changed code.
2024-01-28 14:54:19 +02:00
Dmitry Luhtionov cb494408d8 ichsmb(4): Add PCI ID for Intel Ice Lake SMBus controller
MFC after:	2 weeks
2023-12-19 23:32:01 +03: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
Reid Linnemann f0c9703301 sys/dev/ichsmb: Silence unhandled SMBALERT device_printfs
The ichsmb driver does not actually handle SMBALERT, other than by logging the
first 16 occurences of the ICH_HST_STA_SMBALERT_STS_SMBALERT status
flag. Because the SMBALERT is not acknowledged by the host, clearing it in the
host status register does not appear to work as long as some slave device is
pulling the SMBALERT line low, at least for C2000 chips. As a result, if a slave
device does pull SMBALERT low the interrupt handler will always loop its maximum
of 16 times attempting to clear all status register flags and device_printf the
status register. The result is the kernel message buffer is littered with these
device_printfs at every interrupt.

To remedy the problem, the ICH_HST_STA_SMBALERT_STS flag is zeroed in the read
host status register value, just as with ICH_HST_STA_INUSE_STS and
ICH_HST_STA_HOST_BUSY. This allows the loop to break when no other flags that
must be handled are set in the host status register. Additionally, because the
SMBALERT is not actually handled the SMBALERT logging is omitted as it has no
actual function at this time.

Reviewed by:	imp
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D39966
2023-06-26 10:29:34 +02:00
John Baldwin dfee3204c9 ichsmb/imcsmb/intpm/ismt: Remove unused devclass arguments to DRIVER_MODULE. 2022-05-09 12:22:02 -07:00
John Baldwin c6d3976514 Remove unused smbus_devclass. 2022-05-06 15:39:30 -07:00
John Baldwin 87445068f9 Remove check for __CC_SUPPORTS___FUNC__.
__func__ is part of C99.

PR:		263102 (exp-run)
Reviewed by:	brooks, imp, emaste
Differential Revision:	https://reviews.freebsd.org/D34801
2022-04-12 10:06:04 -07:00
Alexander Motin f29f6b2e1f ichsmb: Add PCI IDs for Intel Alder Lake SMBus controller
Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after:	2 weeks
2021-11-24 13:07:58 -05:00
Vladimir Kondratyev fb451895fb ichsmb: Add PCI ID for Intel Gemini Lake SMBus controller
Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after:	2 weeks
2021-04-14 03:58:07 +03:00
Neel Chauhan a94d15af26 ichsmb: Add PCI IDs for Intel Comet Lake and Tiger Lake
Reviewed by:		manu
Differential Revision:	https://reviews.freebsd.org/D27859
MFC after:		2 weeks
2021-03-27 14:08:34 -07:00
Emmanuel Vadot 48c13e5270 ichsmb_pci: convert to pci_device_table / add PCI_PNP_INFO
Submitted by:	Greg V <greg@unrelenting.technology>
Reviewed by:	mav
Differential Revision:	https://reviews.freebsd.org/D25260
2020-10-01 16:55:01 +00:00
Warner Losh b832a7e505 Create new wrapper function: bus_delayed_attach_children()
Delay the attachment of children, when requested, until after interrutps are
running. This is often needed to allow children to run transactions on i2c or
spi busses. It's a common enough idiom that it will be useful to have its own
wrapper.

Reviewed by: ian
Differential Revision: https://reviews.freebsd.org/D21465
2019-12-13 19:39:33 +00:00
Yuri Pankov 2051169a4f ichsmb: defer smbus attach until interrupts are available
This fixes a "timed sleep before timers are working" panic seen
while attaching jedec_dimm(4) instances too early in the boot.

Submitted by:	ian
Reviewed by:	hselasky
Differential Revision:	https://reviews.freebsd.org/D21452
2019-08-29 12:49:21 +00:00
Alexander Motin abb7ac4d18 Add some Cannon Lake chipset IDs.
Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after:	2 weeks
2019-03-20 17:27:00 +00:00
Gavin Atkinson 3f4760c8e1 Add IDs for several missing Intel SMBus controllers.
Obtained from:	Data sheets, Linux defines, local hardware
MFH:		2 weeks
2017-04-02 11:36:25 +00:00
Gavin Atkinson 255bba06cf ichsmb: switch device_probe() from a large case statement to a lookup table.
The case statement was getting unmanageably large, and I'm about to add
several more devices to it.

MFC after:	2 weeks
2017-03-29 23:13:04 +00:00
Gavin Atkinson 44f3702036 Remove #define PCIS_SERIALBUS_SMBUS_PROGIF, unused since r200091 2017-03-28 21:54:36 +00:00
Alexander Motin 2b064d4653 Add some device IDs found in my new laptop. 2016-11-09 08:57:59 +00:00
Justin Hibbits c47476d7e6 Migrate many bus_alloc_resource() calls to bus_alloc_resource_anywhere().
Most calls to bus_alloc_resource() use "anywhere" as the range, with a given
count.  Migrate these to use the new bus_alloc_resource_anywhere() API.

Reviewed by:	jhb
Differential Revision:	https://reviews.freebsd.org/D5370
2016-02-27 03:38:01 +00:00
Eric van Gyzen bb51c27943 ichsmb: add PCI device ID for Intel Sunrise Point-H SMBus controller
MFC after:	3 days
Sponsored by:	Dell Inc.
2016-02-16 02:23:39 +00:00
Rui Paulo d2f56f2e3d ichsmb: add Intel Wellsburg device ID.
Submitted by:	Michael Allen <mallen pi-coral.com>
MFC after:	1 week
Sponsored by:	Pi-Coral, Inc.
2015-06-10 22:39:10 +00:00
Rui Paulo e505494683 ichsmb: remove whitespace. 2015-06-10 22:37:09 +00:00
Takanori Watanabe 7a4864d1bb Add Lynx-Point LP smbus controller ID. 2015-04-24 07:24:31 +00:00
Rui Paulo 63f9a9fa26 ichsmb: add a device id for the Wildcat Point-LP.
MFC after:	1 week
2015-04-06 06:02:58 +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
Alexander Motin f00fac180f Add ID for Intel Avoton SMBus controller. 2013-11-15 13:19:15 +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
Jack F Vogel cf40e447b9 Add Intel Lynx Point PCH SMBus Device IDs 2013-01-02 22:01:26 +00:00
Marius Strobl 4b7ec27007 - There's no need to overwrite the default device method with the default
one. Interestingly, these are actually the default for quite some time
  (bus_generic_driver_added(9) since r52045 and bus_generic_print_child(9)
  since r52045) but even recently added device drivers do this unnecessarily.
  Discussed with: jhb, marcel
- While at it, use DEVMETHOD_END.
  Discussed with: jhb
- Also while at it, use __FBSDID.
2011-11-22 21:28:20 +00:00
Attilio Rao 2d49ef5934 Revert r224736 as the introduced value was already present.
Reported by:	tinderbox, pluknet
Approved by:	re (kib)
2011-08-09 20:55:54 +00:00
Attilio Rao b1f0f5b76e Add the PCI ID for the PCH DH89xxCC on ichsmb as got from Linux counterpart.
Sponsored by:	Sandvine Incorporated
Reviewed by:	emaste, rstone
Approved by:	re (bz)
MFC after:	3 days
2011-08-09 16:42:31 +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
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
Jack F Vogel dce8a362df Add support for Intel Cougar Point SMBus controller.
MFC afer 1 week
2010-08-27 23:24:08 +00:00
Andriy Gapon ac2703ea39 ichsmb: add another pci id
This is SMBus controller found in Intel Platform Controller Hub (PCH),
which is a general name that refers to Intel 5 Series chipsets and
3400 Series chipsets.

Submitted by:	Dmitry S. Luhtionov <mitya@cabletv.dp.ua>
MFC after:	3 days
2009-12-16 12:25:27 +00:00
Andriy Gapon 5e6d0a234e ichsmb: drop default attachment to generic smbus hardware
Attach only to devices known to be supported.
This change overrided and undoes r200053.

Suggested by:	jhb
MFC after:	2 weeks (only to stable/8)
2009-12-04 05:45:46 +00:00
Andriy Gapon 86439baac2 ichsmb: try attaching only to intel hardware in the default case
Ideally we should attempt attaching only to known supported devices.
But I am not sure that we have all supported PCI IDs already listed,
and I am too young to die, err, I don't want to take the heat from
causing a trouble to someone.

MFC after:	1 week
X-ToDo:		drop the default case
2009-12-03 08:11:20 +00:00
Andriy Gapon d93b49b38c ichsmb: add pci ids for some newer supported hardware
Submitted by:	Dmitry S. Luhtionov <mitya@cabletv.dp.ua>
MFC after:	5 days
2009-12-03 08:01:29 +00:00
John Baldwin bb6bb7fe1b - Change ichsmb(4) to follow the format of all the other smbus controllers
for slave addressing by using left-adjusted slave addresses (i.e.
  xxxxxxx0b).
- Require the low bit of the slave address to always be zero in smb(4) to
  help catch broken applications.
- Adjust some code in the IPMI driver to not convert the slave address for
  SSIF to a right-adjusted address.  I (or possibly ambrisko@) added this in
  the past to (unknowingly) work around the bug in ichsmb(4).

Submitted by:	 Andriy Gapon <avg of icyb.net.ua> (1,2)
MFC after:	1 month
2009-02-03 16:14:37 +00:00
John Baldwin 32d8ea8423 - Use bus_foo() rather than bus_space_foo() and remove bus space tag/handle
from softc.
- Mark interrupt handlers MPSAFE as these drivers have been locked for a
  while.
2008-06-06 18:29:56 +00:00
Remko Lodder 1b72425ab3 Add the Intel 82801FB (ICH6) SMBus controller and the
Intel 82801GB (ICH7) SMBus controller.

PR:		85106 [1]
PR:		99663 [2]
Approved by:	imp (mentor), jhb
Submitted by:	Oliver Fromme <olli at lurza.secnetix dot de>, [1]
		Arthur Hartwig <arthur dot hartwig at nokia dot com>, [1]
		Lowell Gilbert <lgfbsd at be-well dot ilk dot org> [2]@
MFC After:	3 days
2007-11-26 19:54:54 +00:00
Paolo Pisati ef544f6312 o break newbus api: add a new argument of type driver_filter_t to
bus_setup_intr()

o add an int return code to all fast handlers

o retire INTR_FAST/IH_FAST

For more info: http://docs.freebsd.org/cgi/getmsg.cgi?fetch=465712+0+current/freebsd-current

Reviewed by: many
Approved by: re@
2007-02-23 12:19:07 +00:00
John Baldwin 234093730d Add a device ID for the 631xESB/6321ESB SMBus controller.
Submitted by:	Reed A. Cartwright <reed scit.us>
2007-01-11 21:13:27 +00:00
John Baldwin 85064e683c Various updates to most of the smbus(4) drivers:
- Use printf() and device_printf() instead of log() in ichsmb(4).
- Create the mutex sooner during ichsmb(4) attach.
- Attach the interrupt handler later during ichsmb(4) attach to avoid
  races.
- Don't try to set PCIM_CMD_PORTEN in ichsmb(4) attach as the PCI bus
  driver does this already.
- Add locking to alpm(4), amdpm(4), amdsmb(4), intsmb(4), nfsmb(4), and
  viapm(4).
- Axe ALPM_SMBIO_BASE_ADDR, it's not really safe to write arbitrary values
  into BARs, and the PCI bus layer will allocate resources now if needed.
- Merge intpm(4) and intsmb(4) into just intsmb(4).  Previously, intpm(4)
  attached to the PCI device and created an intsmb(4) child.  Now,
  intsmb(4) just attaches to PCI directly.
- Change several intsmb functions to take a softc instead of a device_t
  to make things simpler.
2007-01-11 19:56:24 +00:00
John Baldwin 7048a99c30 Minor overhaul of SMBus support:
- Change smbus_callback() to pass a void * rather than caddr_t.
- Change smbus_bread() to pass a pointer to the count and have it be an
  in/out parameter.  The input is the size of the buffer (same as before),
  but on return it will contain the actual amount of data read back from
  the bus.  Note that this value may be larger than the input value.  It
  is up to the caller to treat this as an error if desired.
- Change the SMB_BREAD ioctl to write out the updated struct smbcmd which
  will contain the actual number of bytes read in the 'count' field.  To
  preserve the previous ABI, the old ioctl value is mapped to SMB_OLD_BREAD
  which doesn't copy the updated smbcmd back out to userland.  I doubt anyone
  actually used the old BREAD anyway as it was rediculous to do a bulk-read
  but not tell the using program how much data was actually read.
- Make the smbus driver and devclass public in the smbus module and
  push all the DRIVER_MODULE()'s for attaching the smbus driver to
  various foosmb drivers out into the foosmb modules.  This makes all
  the foosmb logic centralized and allows new foosmb modules to be
  self-contained w/o having to hack smbus.c everytime a new smbus driver
  is added.
- Add a new SMB_EINVAL error bit and use it in place of EINVAL to return
  an error for bad arguments (such as invalid counts for bread and bwrite).
- Map SMB bus error bits to EIO in smbus_error().
- Make the smbus driver call bus_generic_probe() and require child drivers
  such as smb(4) to create device_t's via identify routines.  Previously,
  smbus just created one anonymous device during attach, and if you had
  multiple drivers that could attach it was just random chance as to which
  driver got to probe for the sole device_t first.
- Add a mutex to the smbus(4) softc and use it in place of dummy splhigh()
  to protect the 'owner' field and perform necessary synchronization for
  smbus_request_bus() and smbus_release_bus().
- Change the bread() and bwrite() methods of alpm(4), amdpm(4), and
  viapm(4) to only perform a single transaction and not try to use a
  loop of multiple transactions for a large request.  The framing and
  commands to use for a large transaction depend on the upper-layer
  protocol (such as SSIF for IPMI over SMBus) from what I can tell, and the
  smb(4) driver never allowed bulk read/writes of more than 32-bytes
  anyway.  The other smb drivers only performed single transactions.
- Fix buffer overflows in the bread() methods of ichsmb(4), alpm(4),
  amdpm(4), amdsmb(4), intpm(4), and nfsmb(4).
- Use SMB_xxx errors in viapm(4).
- Destroy ichsmb(4)'s mutex after bus_generic_detach() to avoid problems
  from child devices making smb upcalls that would use the mutex during
  their detach methods.

MFC after:	1 week
Reviewed by:	jmg (mostly)
2006-09-11 20:52:41 +00:00
Brian Somers 0d10741255 This signal handling code is worse than a no-op. If a
signal is received during the msleep, the msleep is retried
indefinitely as it just keeps returning ERESTART because of
the pending signal.

Instead, just don't PCATCH - the signal can wait.

Sponsored by:	Sophos/ActiveState
2006-01-03 17:01:43 +00:00
Brian Somers fa6e2680c0 Make ichsmb unloadable.
It seems that the unload problems were due to a dodgy sc->smb usage and a
missing mtx_destroy().

Sponsored by:	ActiveState/Sophos
MFC after:	3 weeks
2005-07-29 00:20:50 +00:00