aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/ipmi/ipmi.c
Commit message (Collapse)AuthorAgeFilesLines
* ipmi(4): Limit maximum watchdog pre-timeout interval.Alexander Motin2021-09-291-1/+2
| | | | | | | | | | | | | | Previous code by default setting pre-timeout interval to 120 seconds made impossible to set timeout interval below that, resulting in error 0xcc (Invalid data field in Request) at least on Supermicro boards. To fix that limit maximum pre-timeout interval to ~1/4 of the timeout interval, that sounds like a reasonable default: not too short to fire too late, but also not too long to give many false reports. MFC after: 2 weeks (cherry picked from commit 6c2d4404161aa2bac1c7992afbf5a763f1a6f66e)
* ipmi(4): Add more watchdog error checks.Alexander Motin2021-08-131-6/+18
| | | | | | | | | | | | | | | | Add request submission status checks before checking req->ir_compcode, otherwise it may be zero just because of initialization. Add checks for req->ir_compcode errors in ipmi_reset_watchdog() and ipmi_set_watchdog(). In first case explicitly check for 0x80, which means timer was not previously set, that I found happening after BMC cold reset. This change makes watchdog timer to recover instead of permanently ignoring reset errors after BMC reset or upgraded. MFC after: 2 weeks Sponsored by: iXsystems, Inc. (cherry picked from commit 9d3b47abbba74830661e90206cc0f692b159c432)
* MFC r359937:Brooks Davis2020-04-281-5/+4
| | | | | | | | | | | | | | | | Centralize compatability translation macros. Copy the CP, PTRIN, etc macros from freebsd32.h into a sys/abi_compat.h and replace existing definitation with includes where required. This eliminates duplicate code and allows Linux and FreeBSD compatability headers to be included in the same files. Obtained from: CheriBSD Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D24275 Notes: svn path=/stable/12/; revision=360446
* Fix a module Makefile error on amd64 so the IPMI HW interfaces are built.Doug Ambrisko2018-08-161-0/+2
| | | | | | | | When the module is being unloaded and no HW interfaces were created don't clean up. This was exposed by the amd64 module build issue. Notes: svn path=/head/; revision=337913
* sys/dev: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-271-0/+2
| | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=326255
* As a follow-on to r325378, make the shutdown timer default to 0 as well.Peter Wemm2017-11-051-1/+1
| | | | | | | | | | Otherwise an orderly shutdown will initiate a watchdog that will cause a 7 minute delayed reboot *by default*, In the freebsd.org cluster's case this often worked out be a surprise reboot a minute or two after the machine came back up. Notes: svn path=/head/; revision=325425
* Make the startup timeout 0 seconds by default rathern than 420s. ThisWarner Losh2017-11-041-1/+1
| | | | | | | | | | makes the default fail safe when watchdogd is disabled (which is also the default). Sponsored by Notes: svn path=/head/; revision=325378
* Make time we wait for a power cycle tunable.Warner Losh2017-10-261-2/+6
| | | | | | | | | | hw.ipmi.cycle_time is the time to wait for the power down phase of the ipmi power cycle before falling back to either reboot or halt. Sponsored by: Netflix Notes: svn path=/head/; revision=325025
* Various IPMI watchdog timer improvementsWarner Losh2017-10-261-6/+105
| | | | | | | | | | | | | | | | o Make hw.ipmi.on a tuneable o Changes to keep shutdown from hanging indefinitately after the wd would normally have been disabled. o Add support for setting pretimeout (which fires an interrupt some time before the actual watchdog expires) o Allow refinement of the actions to take when the watchdog expires o Allow special startup timeout to keep us from hanging in boot before watchdogd is started, but after we've loaded the kernel. Obtained From: Netflix OCA Firmware Notes: svn path=/head/; revision=325024
* Implement IPMI support for RB_POWRECYCLEWarner Losh2017-10-251-4/+61
| | | | | | | | | | | | | | | Some BMCs support power cycling the chassis via the chassis control command 2 subcommand 2 (ipmitool called it 'chassis power cycle'). If the BMC supports the chassis device, register a shutdown_final handler that sends the power cycle command if request and waits up to 10s for it to take effect. To minimize stack strain, we preallocate a ipmi request in the softc. At the moment, we're verbose about what we're doing. Sponsored by: Netflix Notes: svn path=/head/; revision=324990
* Optimize IPMI watchdog patting.Alexander Motin2016-03-221-21/+32
| | | | | | | | | | | | | | | | | | | Set watchdog timer parameters only when they really need to be changed. In other cases just restart the timer with single Reset command instead of two (Set and Reset). From one side this visually reduces amount of CPU time burned in tight loop waiting while some slow BMC configures its watchdog hardware, that seems to be much more complicated task then just resetting the timer. From another side on some BMCs those slow Set commands sometimes tend to timeout, that leads to noisy log messages and even more CPU time burned, so avoiding them can provide even bigger bonuses. MFC after: 2 weeks Notes: svn path=/head/; revision=297179
* Watchdog drivers need to support rearming the watchdog in contexts whichJohn Baldwin2015-04-241-9/+14
| | | | | | | | | | | | | | are not permitted to sleep. Only use the IPMI watchdog with backends which poll driver-initiated requests to meet this requirement. In practice this means that watchdogs will no longer be used on systems that use the SSIF backend. Differential Revision: https://reviews.freebsd.org/D2062 MFC after: 2 weeks Notes: svn path=/head/; revision=281941
* Use direct hardware access for internal requests for KCS and SMIC. InJohn Baldwin2015-02-061-51/+53
| | | | | | | | | | | | | | | | | | particular, updates to the watchdog should no longer sleep. - Add a new IPMI_IO_LOCK for low-level I/O access. Use this for kcs_polled_request() and smic_polled_request(). - Add a new backend callback "ipmi_driver_request" to handle a driver request. The new callback performs the request sychronously for KCS and SMIC. SSIF still defers the work to the worker thread since the worker thread sleeps during request processing anyway. - Allocate driver requests on the stack rather than using malloc(). Differential Revision: https://reviews.freebsd.org/D1723 Tested by: scottl MFC after: 2 weeks Notes: svn path=/head/; revision=278321
* Provide a crutch that prevents watchdog to interrupt dumpingGleb Smirnoff2013-10-311-0/+3
| | | | | | | | | | | on a box with IPMI enabled. Okay from: jhb Sponsored by: Netflix Sponsored by: Nginx, Inc. Notes: svn path=/head/; revision=257421
* Don't try to stop the IPMI watchdog timer if it is not running.John Baldwin2012-08-071-3/+4
| | | | | | | | | | | | | | Starting or stopping the IPMI watchdog is rather expensive with the current implementation as all IPMI requests are bounced via thread. This is not viable during shutdown or dumps, and this avoids headache in the common case that the watchdog is not enabled. The IPMI watchdog should probably be reworked to not use a separate thread to fix this in the case when the watchdog timer is enabled. MFC after: 2 weeks Notes: svn path=/head/; revision=239128
* Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.Ed Schouten2011-11-071-1/+2
| | | | | | | | | The SYSCTL_NODE macro defines a list that stores all child-elements of that node. If there's no SYSCTL_DECL macro anywhere else, there's no reason why it shouldn't be static. Notes: svn path=/head/; revision=227309
* Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs.Ed Schouten2011-11-071-1/+1
| | | | | | | This means that their use is restricted to a single C file. Notes: svn path=/head/; revision=227293
* Fixed firmware revision decoding:Ruslan Ermilov2011-04-141-2/+2
| | | | | | | | | | | - the major is 7-bit binary encoded - the minor is BCD encoded PR: kern/151586 MFC after: 3 days Notes: svn path=/head/; revision=220614
* - Fixed incorrect watchdog timeout setting: MSB of a 2-byteRuslan Ermilov2009-12-181-9/+20
| | | | | | | | | | | | | | | | | | | | | | | | value is obtained by dividing it by 256, not by 2550; also, one second is 10^9 nanoseconds, not 1800000000 nanoseconds. - Due to rounding error, setting watchdog to a really small timeout (<1 sec) was turning the watchdog off. It should set the watchdog to a small timeout instead. - Implemented error checking in ipmi_wd_event(), as required by watchdog(9). PR: kern/130512 Submitted by: Dmitrij Tejblum - Additionally, check that the timeout value is within the supported range, and if it's too large, act as required by watchdog(9). MFC after: 3 days Notes: svn path=/head/; revision=200666
* Fix typo where the code was missing the "IPMICTL_RECEIVE_MSG_32" conditionDavid E. O'Brien2008-11-141-1/+1
| | | | | | | test. Notes: svn path=/head/; revision=184949
* Remove hack attempt at using devfs cloning for per-file descriptor storage.John Baldwin2008-08-281-121/+34
| | | | | | | | | | | Use the much simpler cdevpriv for per-fd state and enable it. This allows multiple opens of /dev/ipmi0 (e.g. using ipmitool while ipmievd is running in the background). MFC after: 1 week Notes: svn path=/head/; revision=182322
* Revisit the watchdogs: Resetting the error to EINVAL after failing to set theNick Hibma2007-03-271-2/+0
| | | | | | | | | | | watchdog might hide the succesful arming of an earlier one. Accept that on failing to arm any watchdog (because of non-supported timeouts) EOPNOTSUPP is returned instead of the more appropriate EINVAL. MFC after: 3 days Notes: svn path=/head/; revision=167950
* o break newbus api: add a new argument of type driver_filter_t toPaolo Pisati2007-02-231-1/+1
| | | | | | | | | | | | | | | | 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@ Notes: svn path=/head/; revision=166901
* Align the interfaces for the various watchdogs and make the interfaceNick Hibma2006-12-151-17/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | behave as expected. Also: - Return an error if WD_PASSIVE is passed in to the ioctl as only WD_ACTIVE is implemented at the moment. See sys/watchdog.h for an explanation of the difference between WD_ACTIVE and WD_PASSIVE. - Remove the I_HAVE_TOTALLY_LOST_MY_SENSE_OF_HUMOR define. If you've lost your sense of humor, than don't add a define. Specific changes: i80321_wdog.c Don't roll your own passive watchdog tickle as this would defeat the purpose of an active (userland) watchdog tickle. ichwd.c / ipmi.c: WD_ACTIVE means active patting of the watchdog by a userland process, not whether the watchdog is active. See sys/watchdog.h. kern_clock.c: (software watchdog) Remove a check for WD_ACTIVE as this does not make sense here. This reverts r1.181. Notes: svn path=/head/; revision=165260
* Fix some edge cases in detach() as well as a memory leak if we fail toJohn Baldwin2006-12-061-2/+8
| | | | | | | | | | talk to the BMC. Reported by: Alexander Logvinov : ports at logvinov_com MFC after: 1 week Notes: svn path=/head/; revision=164947
* ipmi_polled_enqueue_request() is already called with the lock held, justJohn Baldwin2006-10-121-2/+2
| | | | | | | | | | | assert it rather than recursing. Reported by: mjacob Pointy hat: jhb MFC after: 3 days Notes: svn path=/head/; revision=163278
* Fix a memory leak in ipmi_unload().John Baldwin2006-09-261-1/+3
| | | | | | | | CID: 1542 Found by: Coverity Prevent Notes: svn path=/head/; revision=162664
* Update the ipmi(4) driver:John Baldwin2006-09-221-762/+663
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Split out the communication protocols into their own files and use a couple of function pointers in the softc that the commuication protocols setup in their own attach routine. - Add support for the SSIF interface (talking to IPMI over SMBus). - Add an ACPI attachment. - Add a PCI attachment that attaches to devices with the IPMI interface subclass. - Split the ISA attachment out into its own file: ipmi_isa.c. - Change the code to probe the SMBIOS table for an IPMI entry to just use pmap_mapbios() to map the table in rather than trying to setup a fake resource on an isa device and then activating the resource to map in the table. - Make bus attachments leaner by adding attach functions for each communication interface (ipmi_kcs_attach(), ipmi_smic_attach(), etc.) that setup per-interface data. - Formalize the model used by the driver to handle requests by adding an explicit struct ipmi_request object that holds the state of a given request and reply for the entire lifetime of the request. By bundling the request into an object, it is easier to add retry logic to the various communication backends (as well as eventually support BT mode which uses a slightly different message format than KCS, SMIC, and SSIF). - Add a per-softc lock and remove D_NEEDGIANT as the driver is now MPSAFE. - Add 32-bit compatibility ioctl shims so you can use a 32-bit ipmitool on FreeBSD/amd64. - Add ipmi(4) to i386 and amd64 NOTES. Submitted by: ambrisko (large portions of 2 and 3) Sponsored by: IronPort Systems, Yahoo! MFC after: 6 days Notes: svn path=/head/; revision=162562
* Since DELAY() was moved, most <machine/clock.h> #includes have beenPoul-Henning Kamp2006-05-161-1/+0
| | | | | | | unnecessary. Notes: svn path=/head/; revision=158651
* Don't conflict with the DEBUG define.Doug Ambrisko2006-02-131-1/+1
| | | | Notes: svn path=/head/; revision=155605
* Add an OpenIPMI mostly compatible driver. This driver was developedDoug Ambrisko2006-02-101-0/+1096
to work with ipmitools. It works with other tools that have an OpenIPMI driver interface. The port will need to get updated to used this. I have not implemented the IPMB mode yet so ioctl's for that don't really do much otherwise it should work like the OpenIPMI version. The ipmi.h definitions was derived from the ipmitool header file. The bus attachments are done for smbios and pci/smbios. Differences in bus probe order for modules/static are delt with. ACPI attachment should be done. This drivers registers with the watchdod(4) interface Work to do: - BT interface - IPMB mode This has been tested on Dell PE2850, PE2650 & PE850 with i386 & amd64 kernel. I will link this into the build on next week. Tom Rhodes, helped me with the man page. Sponsored by: IronPort Systems Inc. Inspired from: ipmitool & Linux Notes: svn path=/head/; revision=155517