aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/ipmi
Commit message (Collapse)AuthorAgeFilesLines
* chore: replace {0, 0} with {DEV,KOBJ}METHOD_ENDEnji Cooper2026-02-254-5/+5
| | | | | | | | | | | | | | Both of the aforementioned macros have been present in FreeBSD for well over a decade: 2009 for `KOBJMETHOD_END`; 2011 for `DEVMETHOD_END`. Adapt all hardcoded references of `{0, 0}` with `DEVMETHOD_END` and `KOBJMETHOD_END` as appropriate. This helps ensure that future adaptations to drivers following patterns documented in driver(9) can be made more easily/without issue. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D55414
* ipmi: Migrate to use macro LINUX_IOCTL_SET to register linux ioctl handlerZhenlei Huang2025-10-201-9/+1
| | | | | | Reviewed by: markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D53158
* newbus: replace leftover device unit wildcardsAhmad Khalifa2025-06-212-2/+2
| | | | | | Reviewed by: imp, jhb Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D50913
* efi: Use EDK2 EFI_GUID instead of sturct uuidWarner Losh2025-05-011-2/+1
| | | | | | | | | | | | | So, while struct uuid and EFI_GUID are quite similar (they are the same size, they have the same binary representation, etc), they aren not identical. Speciifcally, the UUID and GUID defines are slightly different and can't be swapped one for the other. Start to use EFI_GUID for all EFI tables. This will allow increased sharing with the boot laoder that already uses EDK2 variants as well as using the possibility to use the EDK2 headers we've already imported more easily. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D50037
* ipmi: fix runtime on powerpc64lePiotr Kubaj2025-03-271-0/+1
| | | | | | | | | | | | | | | Summary: OPAL runs in big-endian mode, so we need to byteswap msg_len on little-endian. MFC after: 1 week Test Plan: ipmitool lan print Reviewers: #powerpc Subscribers: imp Differential Revision: https://reviews.freebsd.org/D49530
* ipmi: fix powerpc buildGleb Smirnoff2024-10-181-3/+4
| | | | Fixes: 366d6a424e1faad9c151c5794978e218a79fbed8
* ipmi: remove timeout from the ipmi_driver_request methodGleb Smirnoff2024-10-187-31/+26
| | | | | | | | | | | | | Driver requests are done with stack allocated request. The request is put on the tailq and then we msleep(9) until kernel process processes it. If we timeout from this sleep, the kernel process may still read the request from our stack, which may already be reused by some other code. Make this sleep unbound and rely on the kernel process that does all its I/O with timouts and will eventually wake us up. Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D47179
* smbios: Add length sanity checkingWarner Losh2024-07-251-2/+2
| | | | | | | | | | | D28743 was commited, reverted and then f689cb23b2782 landed before it was recommitted. However, D28743 included an extra length check. Redo that functionality so we check both the number of entries as well as the length checks for wacky data. Sponsored by: Netflix Reviewed by: gallatin Differential Revision: https://reviews.freebsd.org/D45763
* ipmi_smbios: Only search for the BIOS signature on x86Warner Losh2024-07-251-0/+2
| | | | Sponsored by: Netflix
* newbus: replace -1 in BUS_ADD_CHILD(...-1) with DEVICE_UNIT_ANYWarner Losh2024-07-252-2/+2
| | | | Sponsored by: Netflix
* change ipmi watchdog to awlays stop when system is haltedAndriy Gapon2024-01-281-1/+5
| | | | | | | That is, wd_shutdown_countdown value is ignored when halting. A halted system should remain halted for as long as needed until a power cycle, so the watchdog should not reset the system.
* fix signature of ipmi_shutdown_eventAndriy Gapon2024-01-281-1/+1
| | | | | The function had a signature of watchdog_fn while in fact it is used as shutdown_fn.
* pci_cfgreg: Add a PCI domain argument to the low-level register APIJohn Baldwin2023-11-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | 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
* sys: Automated cleanup of cdefs and other formattingWarner Losh2023-11-2711-11/+0
| | | | | | | | | | | | | | | | 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
* ipmi_ssif: Fix typo in debug printAndrew Gallatin2023-11-141-1/+1
| | | | | | Fix a typo in a debug print that prevents compilation. Sponsored by: Netflix
* sys: Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-1612-24/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* sys: Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-161-2/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* ipmi: add Block Transfer interface supportAndrey V. Elsukov2023-06-076-32/+350
| | | | | | | | Reviewed by: ambrisko Obtained from: Yandex LLC MFC after: 2 weeks Sponsored by: Yandex LLC Differential Revision: https://reviews.freebsd.org/D40421
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-1211-11/+11
| | | | | | | | | 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
* ipmi: Remove some dead code for unsupported BMCs.John Baldwin2023-04-101-5/+1
| | | | | | Reviewed by: emaste Reported by: GCC Differential Revision: https://reviews.freebsd.org/D39351
* ipmi: use a queue for kcs driver requests when possibleChuck Silvers2022-11-013-4/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ipmi watchdog pretimeout action can trigger unintentionally in certain rare, complicated situations. What we have seen at Netflix is that the BMC can sometimes be sent a continuous stream of writes to port 0x80, and due to what is a bug or misconfiguration in the BMC software, this results in the BMC running out of memory, becoming very slow to respond to KCS requests, and eventually being rebooted by its own internal watchdog. While that is going on in the BMC, back in the host OS, a number of requests are pending in the ipmi request queue, and the kcs_loop thread is working on processing these requests. All of the KCS accesses to process those requests are timing out and eventually failing because the BMC is responding very slowly or not at all, and the kcs_loop thread is holding the IPMI_IO_LOCK the whole time that is going on. Meanwhile the watchdogd process in the host is trying to pat the BMC watchdog, and this process is sleeping waiting to get the IPMI_IO_LOCK. It's not entirely clear why the watchdogd process is sleeping for this lock, because the intention is that a thread holding the IPMI_IO_LOCK should not sleep and thus any thread that wants the lock should just spin to wait for it. My best guess is that the kcs_loop thread is spinning waiting for the BMC to respond for so long that it is eventually preempted, and during the brief interval when the kcs_loop thread is not running, the watchdogd thread notices that the lock holder is not running and sleeps. When the kcs_loop thread eventually finishes processing one request, it drops the IPMI_IO_LOCK and then immediately takes the lock again so it can process the next request in the queue. Because the watchdogd thread is sleeping at this point, the kcs_loop always wins the race to acquire the IPMI_IO_LOCK, thus starving the watchdogd thread. The callout for the watchdog pretimeout would be reset by the watchdogd thread after its request to the BMC watchdog completes, but since that request never processed, the pretimeout callout eventually fires, even though there is nothing actually wrong with the host. To prevent this saga from unfolding: - when kcs_driver_request() is called in a context where it can sleep, queue the request and let the worker thread process it rather than trying to process in the original thread. - add a new high-priority queue for driver requests, so that the watchdog patting requests will be processed as quickly as possible even if lots of application requests have already been queued. With these two changes, the watchdog pretimeout action does not trigger even if the BMC is completely out to lunch for long periods of time (as long as the watchdogd check command does not also get stuck). Sponsored by: Netflix Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D36555
* pmap_unmapdev/bios: Accept a pointer instead of a vm_offset_t.John Baldwin2022-09-221-4/+4
| | | | | | | | This matches the return type of pmap_mapdev/bios. Reviewed by: kib, markj Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D36548
* impi(4): Fix two typos in source code commentsGordon Bergling2022-09-031-2/+2
| | | | | | - s/overriden/overridden/ MFC after: 3 days
* ipmi(4): spelling fix cyle_wait -> cycle_waitEugene Grosbein2022-07-201-2/+2
| | | | | | There are no consumers of hw.ipmi.cyle_wait in our tree. Also the knob is undocumented, so it should be safe to fix its name. No MFC planned, though.
* ipmi: fix a use-after-free bug in error handlingPhilip Paeps2022-07-081-1/+2
| | | | | | | | 18db96dbfd4a09063a0abcefd51fa8d2aeb115d6 introduced a use-after-free bug in the error handling of the IPMICTL_RECEIVE_MSG ioctl. Reported by: Coverity (CID 1490456) (via vangyzen) Differential Revision: https://reviews.freebsd.org/D35605
* ipmi: do not omit lun in BMC addressesYuri2022-07-041-2/+5
| | | | | | | | | | | | | | Some systems put sensors on non-0 lun, so we should not omit it. This was the only difference with the Linux driver, where DIMM sensors could be queried, but not on FreeBSD. See this report[1] on the FreeBSD forums: https://forums.freebsd.org/threads/freebsd-cannot-get-dimm-temperature-sensor-value.85166/ Reviewed by: philip Tested by: Andrey Lanin[1] MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D35612
* ipmi: correctly handle ipmb requestsYuri2022-07-042-116/+82
| | | | | | | | | | | | | Handle IPMB requests using SEND_MSG (sent as driver request as we do not need to return anything back to userland for this) and GET_MSG (sent as usual request so we can return the data for RECEIVE_MSG ioctl) pair. This fixes fetching complete sensor data from boards (e.g. HP ProLiant DL380 Gen10). Reviewed by: philip MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D35605
* ipmi: Remove unused devclass arguments to DRIVER_MODULE.John Baldwin2022-05-097-9/+6
|
* ipmi: Use devclass_find to lookup ipmi devclass in ipmi_unload.John Baldwin2022-05-051-3/+1
| | | | Differential Revision: https://reviews.freebsd.org/D35061
* ipmi: Remove write only variables used to read form hardwareWarner Losh2022-04-061-8/+6
| | | | Sponsored by: Netflix
* ipmi: Make all sysctls also tunables.Alexander Motin2022-03-171-4/+3
| | | | MFC after: 1 week
* ipmi(4): Limit maximum watchdog pre-timeout interval.Alexander Motin2021-09-151-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
* ipmi: fix negative logic in watchdog control flagWojciech Macek2021-08-181-4/+4
| | | | Use wd_enable instead of wd_disable
* ipmi: New tunable to deactivate IPMI watchdogWojciech Macek2021-08-171-1/+4
| | | | | | | | | In case we want to use other WD than IPMI-provided, add sysctl to disable initialization. Obtained from: Semihalf Sponsored by: Stormshield Differential revision: https://reviews.freebsd.org/D31548
* ipmi(4): Add more watchdog error checks.Alexander Motin2021-07-301-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.
* ipmi: support getting address from EFIYinlong Lu2021-04-294-3/+28
| | | | | | | | | | | | | | | | The original implementation only supports getting the address from legacy BIOS (by searching for the SMBIOS_SIG pattern in a fixed address space). Try to get the SMBIOS table from EFI through efirt (EFI Runtime Services) firstly. Continue to search in the legacy BIOS if a NULL address is returned from EFI. By this way the ipmi function supports both legacy BIOS and UEFI systems. Reviewed by: dab, vangyzen MFC after: 1 week Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D30007
* ipmi,smbios: move smbios_walk_table to smbios.hGreg V2021-04-071-29/+0
| | | | | | | | | | | | This function will be used for exposing DMI info as sysctls in the smbios module (in an upcoming review). While here, add __packed to the structs. Reviewed by: dab MFC after: 1 week Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D29270
* Revert "ipmi_smbios: Deduplicate smbios entry point discovery logic"Allan Jude2021-02-234-19/+30
| | | | | | This depends on another commit that has not landed yet, and broke the build This reverts commit ba6e37e47f41484fc61cc034619267b82ddd056c.
* Revert "ipmi_smbios: remove unused smbios_cksum function"Allan Jude2021-02-231-0/+17
| | | | This reverts commit d2589dc3d56ce063b28b54df11c950c3758d9578.
* ipmi_smbios: remove unused smbios_cksum functionAllan Jude2021-02-231-17/+0
| | | | | | Sponsored By: Ampere Computing LLC Submitted By: Klara Inc. Differential Revision: https://reviews.freebsd.org/D28751
* ipmi_smbios: Deduplicate smbios entry point discovery logicAllan Jude2021-02-234-30/+19
| | | | | | | Sponsored by: Ampere Computing LLC Submitted by: Klara Inc. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D28743
* smbios: Move smbios driver out from x86 machdep codeAllan Jude2021-02-231-0/+3
| | | | | | | | | Add it to the x86 GENERIC and MINIMAL kernels Sponsored by: Ampere Computing LLC Submitted by: Klara Inc. Reviewed by: rpokala Differential Revision: https://reviews.freebsd.org/D28738
* ipmi_ssif: Fix inverted for the end of multi-part readsAllan Jude2021-02-181-1/+1
| | | | | | | | | | As per Intelligent Platform Management Interface Specification v2.0 rev. 1.1, section 12.5: SSIF Multi-part Read Transactions Sponsored by: Ampere Computing LLC Submitted by: Klara Inc. Reviewed by: manu Differential Revision: https://reviews.freebsd.org/D28749
* Convert remaining cap_rights_init users to cap_rights_init_oneMateusz Guzik2021-01-121-1/+2
| | | | | | | | | | | | | semantic patch: @@ expression rights, r; @@ - cap_rights_init(&rights, r) + cap_rights_init_one(&rights, r)
* Centralize compatability translation macros.Brooks Davis2020-04-141-5/+4
| | | | | | | | | | | | | | | | 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. Input from: cem, jhb Obtained from: CheriBSD MFC after: 2 weeks Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D24275 Notes: svn path=/head/; revision=359937
* [PowerPC64] Fix OPAL IPMI driverLeandro Lupori2020-03-261-40/+115
| | | | | | | | | | | | | | This change fixes a couple of issues with OPAL IPMI driver and implements a mechanism to detect timeouts and discard old messages left in receive queue, to avoid old messages from being confused with the reply of new ones. Reviewed by: jhibbits Sponsored by: Eldorado Research Institute (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D24185 Notes: svn path=/head/; revision=359329
* Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)Pawel Biernacki2020-02-261-1/+1
| | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=358333
* The current IPMI KCS code is waiting 100us for all transitions (roughlyJonathan T. Looney2019-06-121-34/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | between each byte either sent or received). However, most transitions actually complete in 2-3 microseconds. By polling the status register with a delay of 4us with exponential backoff, the performance of most IPMI operations is significantly improved: - A BMC update on a Supermicro x9 or x11 motherboard goes from ~1 hour to ~6-8 minutes. - An ipmitool sensor list time improves by a factor of 4. Testing showed no significant improvements on a modern server by using a lower delay. The changes should also generally reduce the total amount of CPU or I/O bandwidth used for a given IPMI operation. Submitted by: Loic Prylli <lprylli@netflix.com> Reviewed by: jhb MFC after: 2 weeks Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D20527 Notes: svn path=/head/; revision=348996
* Extract eventfilter declarations to sys/_eventfilter.hConrad Meyer2019-05-202-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=347984
* ipmi: Fixes for ipmi_opal(powernv)Justin Hibbits2019-04-021-1/+12
| | | | | | | | | | | | | | | * Crank the OPAL state machine during the receive loop, to make sure the pollers are executed * Add a proper detach function, so the module can be unloaded and reloaded at runtime. It still doesn't reliably work 100% of the time on POWER9, and it appears timing and/or cache related. It may work on POWER8 now. MFC after: 2 weeks Notes: svn path=/head/; revision=345791