summaryrefslogtreecommitdiff
path: root/sys/dev/aacraid
AgeCommit message (Collapse)Author
2025-10-20aacraid: Migrate to use macro LINUX_IOCTL_SET to register linux ioctl handlerZhenlei Huang
Reviewed by: markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D53158
2025-06-11machine/stdarg.h -> sys/stdarg.hBrooks Davis
Switch to using sys/stdarg.h for va_list type and va_* builtins. Make an attempt to insert the include in a sensible place. Where style(9) was followed this is easy, where it was ignored, aim for the first block of sys/*.h headers and don't get too fussy or try to fix other style bugs. Reviewed by: imp Exp-run by: antoine (PR 286274) Pull Request: https://github.com/freebsd/freebsd-src/pull/1595
2025-01-02Use bus_generic_detach to detach and delete child devices during detachJohn Baldwin
This is simpler and more robust than individual calls to device_delete_child. Differential Revision: https://reviews.freebsd.org/D47972
2024-12-06Replace calls to bus_generic_attach with bus_attach_childrenJohn Baldwin
Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D47675
2024-07-24newbus: globally replace device_add_child(..., -1) with DEVICE_UNIT_ANYWarner Losh
Sponsored by: Netflix
2023-11-26sys: Automated cleanup of cdefs and other formattingWarner Losh
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-08-16sys: Remove $FreeBSD$: one-line .c patternWarner Losh
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2023-08-16sys: Remove $FreeBSD$: two-line .h patternWarner Losh
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
2023-05-12spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh
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
2022-05-06aacraid: Remove unused devclass argument to DRIVER_MODULE.John Baldwin
2021-06-21aacraid: ignore data overrun on INQUIRYLeandro Lupori
The INQUIRY command may return a CAM_DATA_RUN_ERR code, even when it succeeds. This happens during driver startup, causing the current and further inquiries to be aborted, resulting in some missing information about the controller. Reviewed by: imp Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D30843
2021-06-21aacraid: reduce max I/O size to avoid DMA issuesLeandro Lupori
Reserve one page for the DMA subsystem, that may need it when the I/O buffer is not page aligned. Without this change, writes with the maximum allowed size failed, if: - physical memory was fragmented, making it necessary to use one DMA segment for each page - the buffer to be written was not page aligned, causing the DMA subsystem to need one extra segment In the scenario above, the DMA subsystem would run out of segments, resulting in a write with no SG segments, that would fail. Reviewed by: imp MFC after: 2 weeks Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D30798
2021-01-12Convert remaining cap_rights_init users to cap_rights_init_oneMateusz Guzik
semantic patch: @@ expression rights, r; @@ - cap_rights_init(&rights, r) + cap_rights_init_one(&rights, r)
2020-09-01aacraid: clean up empty lines in .c and .h filesMateusz Guzik
Notes: svn path=/head/; revision=365095
2020-03-09[aacraid] Handle both AIF and SYNC interruptsLeandro Lupori
Without this change, if an AIF interrupt comes at the same time a SYNC command is finished, the SYNC interrupt will be lost. This happens because all interrupt bits (bellbits) are cleared, but only one of them is handled. Debugging shows that, (at least) when !sc->msi_enabled and (sc->flags & AAC_FLAGS_SYNC_MODE) is true (sync mode), both bits may be set at the same time. PR: 237463 Reviewed by: scottl Sponsored by: Eldorado Research Institute (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D23859 Notes: svn path=/head/; revision=358814
2020-03-05[aacraid] Port driver to big-endianLeandro Lupori
Port aacraid driver to big-endian (BE) hosts. The immediate goal of this change is to make it possible to use the aacraid driver on PowerPC64 machines that have Adaptec Series 8 SAS controllers. Adapters supported by this driver expect FIB contents in little-endian (LE) byte order. All FIBs have a fixed header part as well as a data part that depends on the command being issued to the controller. In this way, on BE hosts, the FIB header and all FIB data structures used in aacraid.c and aacraid_cam.c need to be converted to LE before being sent to the adapter and converted to BE when coming from it. The functions to convert each struct are on aacraid_endian.c. For little-endian (LE) targets, they are macros that expand to nothing. In some cases, when only a few fields of a large structure are used, the fields are converted inline, by the code using them. PR: 237463 Reviewed by: jhibbits Sponsored by: Eldorado Research Institute (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D23887 Notes: svn path=/head/; revision=358684
2020-03-04[aacraid] Add missing unmap call for SYNC modeLeandro Lupori
This issue was observed on a PowerPC64 machine with an Adaptec RAID Controller with PCI device ID 0x028d. After several read/write operations, the kernel was panic'ing in bus_dmamap_sync(). This was due to a missing aac_unmap_command() in the SYNC path. PR: 237463 Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D23668 Notes: svn path=/head/; revision=358613
2020-03-02[aacraid] Prevent sense data from causing a buffer overflowLeandro Lupori
This issue was observed on a PowerPC64 machine with an Adaptec RAID Controller with PCI device ID 0x028d, where sense data was causing a buffer overflow because of wrong max sense length logic. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D23667 Notes: svn path=/head/; revision=358550
2020-02-26Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)Pawel Biernacki
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
2019-12-06Remove ifdefs for FreeBSD 6, 7, 8 and 9. Assume we're past that.Warner Losh
Differential Revision: https://reviews.freebsd.org/D22539 Notes: svn path=/head/; revision=355464
2019-11-24Don't need giant for these drivers dev nodes.Warner Losh
Also, Giant isn't required to busy / unbusy a device, so drop that too while I'm here. It's not done elsewhere in the tree and in the future will likely be handled by a node lock to ensure consistency. Leave Giant in place for attach and removing childing, as that's actually still needed, even if imperfect. Remove stale comment about contigmalloc taking Giant and calling w/o the lock held. Neither of these is still true. Notes: svn path=/head/; revision=355058
2019-05-22Make aacraid(4) working on ASR8805 & ASR8402 in particular. This patchMaxim Sobolev
has been in the PR system for 5 months and then on reviews for another 5. Nobody came with any cases where it fails, while many people cried for it to be commited & merged. PR: 209468 Submitted by: Prasad B M <prasad.munirathnam@microsemi.com> Reported by: Steven Peterson <scp@mainstream.net> Approved by: scottl MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D18408 Notes: svn path=/head/; revision=348091
2018-09-26Reapply, with minor tweaks, r338025, from the original commit:Warner Losh
Remove unused and easy to misuse PNP macro parameter Inspired by r338025, just remove the element size parameter to the MODULE_PNP_INFO macro entirely. The 'table' parameter is now required to have correct pointer (or array) type. Since all invocations of the macro already had this property and the emitted PNP data continues to include the element size, there is no functional change. Mostly done with the coccinelle 'spatch' tool: $ cat modpnpsize0.cocci @normaltables@ identifier b,c; expression a,d,e; declarer MODULE_PNP_INFO; @@ MODULE_PNP_INFO(a,b,c,d, -sizeof(d[0]), e); @singletons@ identifier b,c,d; expression a; declarer MODULE_PNP_INFO; @@ MODULE_PNP_INFO(a,b,c,&d, -sizeof(d), 1); $ rg -l MODULE_PNP_INFO -- sys | \ xargs spatch --in-place --sp-file modpnpsize0.cocci (Note that coccinelle invokes diff(1) via a PATH search and expects diff to tolerate the -B flag, which BSD diff does not. So I had to link gdiff into PATH as diff to use spatch.) Tinderbox'd (-DMAKE_JUST_KERNELS). Approved by: re (glen) Notes: svn path=/head/; revision=338948
2018-08-19Back out r338035 until Warner is finished churning GSoC PNP patchesConrad Meyer
I was not aware Warner was making or planning to make forward progress in this area and have since been informed of that. It's easy to apply/reapply when churn dies down. Notes: svn path=/head/; revision=338037
2018-08-19Remove unused and easy to misuse PNP macro parameterConrad Meyer
Inspired by r338025, just remove the element size parameter to the MODULE_PNP_INFO macro entirely. The 'table' parameter is now required to have correct pointer (or array) type. Since all invocations of the macro already had this property and the emitted PNP data continues to include the element size, there is no functional change. Mostly done with the coccinelle 'spatch' tool: $ cat modpnpsize0.cocci @normaltables@ identifier b,c; expression a,d,e; declarer MODULE_PNP_INFO; @@ MODULE_PNP_INFO(a,b,c,d, -sizeof(d[0]), e); @singletons@ identifier b,c,d; expression a; declarer MODULE_PNP_INFO; @@ MODULE_PNP_INFO(a,b,c,&d, -sizeof(d), 1); $ rg -l MODULE_PNP_INFO -- sys | \ xargs spatch --in-place --sp-file modpnpsize0.cocci (Note that coccinelle invokes diff(1) via a PATH search and expects diff to tolerate the -B flag, which BSD diff does not. So I had to link gdiff into PATH as diff to use spatch.) Tinderbox'd (-DMAKE_JUST_KERNELS). Notes: svn path=/head/; revision=338035
2018-06-13Add PNP info to the PCI attachment of the aacraid driver.Warner Losh
Reviewed by: imp, chuck Submitted by: Lakhan Shiva Kamireddy <lakhanshiva@gmail.com> Sponsored by: Google, Inc. (GSoC 2018) Notes: svn path=/head/; revision=335078
2018-04-06Move most of the contents of opt_compat.h to opt_global.h.Brooks Davis
opt_compat.h is mentioned in nearly 180 files. In-progress network driver compabibility improvements may add over 100 more so this is closer to "just about everywhere" than "only some files" per the guidance in sys/conf/options. Keep COMPAT_LINUX32 in opt_compat.h as it is confined to a subset of sys/compat/linux/*.c. A fake _COMPAT_LINUX option ensure opt_compat.h is created on all architectures. Move COMPAT_LINUXKPI to opt_dontuse.h as it is only used to control the set of compiled files. Reviewed by: kib, cem, jhb, jtl Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D14941 Notes: svn path=/head/; revision=332122
2018-03-14Fix FSACTL_GET_NEXT_ADAPTER_FIB under 32-bit compat.Brooks Davis
This includes FSACTL_LNX_GET_NEXT_ADAPTER_FIB. Reviewed by: cem Obtained from: CheriBSD MFC after: 1 week Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D14672 Notes: svn path=/head/; revision=330949
2018-01-21Revert r327828, r327949, r327953, r328016-r328026, r328041:Pedro F. Giffuni
Uses of mallocarray(9). The use of mallocarray(9) has rocketed the required swap to build FreeBSD. This is likely caused by the allocation size attributes which put extra pressure on the compiler. Given that most of these checks are superfluous we have to choose better where to use mallocarray(9). We still have more uses of mallocarray(9) but hopefully this is enough to bring swap usage to a reasonable level. Reported by: wosch PR: 225197 Notes: svn path=/head/; revision=328218
2018-01-13dev: make some use of mallocarray(9).Pedro F. Giffuni
Focus on code where we are doing multiplications within malloc(9). None of these is likely to overflow, however the change is still useful as some static checkers can benefit from the allocation attributes we use for mallocarray. This initial sweep only covers malloc(9) calls with M_NOWAIT. No good reason but I started doing the changes before r327796 and at that time it was convenient to make sure the sorrounding code could handle NULL values. Notes: svn path=/head/; revision=327949
2017-11-27sys/dev: further adoption of SPDX licensing ID tags.Pedro F. Giffuni
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
2017-07-01Clean up MD pollution of bus_dma.h:Jason A. Harmening
--Remove special-case handling of sparc64 bus_dmamap* functions. Replace with a more generic mechanism that allows MD busdma implementations to generate inline mapping functions by defining WANT_INLINE_DMAMAP in <machine/bus_dma.h>. This is currently useful for sparc64, x86, and arm64, which all implement non-load dmamap operations as simple wrappers around map objects which may be bus- or device-specific. --Remove NULL-checked bus_dmamap macros. Implement the equivalent NULL checks in the inlined x86 implementation. For non-x86 platforms, these checks are a minor pessimization as those platforms do not currently allow NULL maps. NULL maps were originally allowed on arm64, which appears to have been the motivation behind adding arm[64]-specific barriers to bus_dma.h, but that support was removed in r299463. --Simplify the internal interface used by the bus_dmamap_load* variants and move it to bus_dma_internal.h --Fix some drivers that directly include sys/bus_dma.h despite the recommendations of bus_dma(9) Reviewed by: kib (previous revision), marius Differential Revision: https://reviews.freebsd.org/D10729 Notes: svn path=/head/; revision=320528
2017-06-09remove an unrelated local change from r319746Andriy Gapon
MFC after: 1 day X-MFC with: r319746 Notes: svn path=/head/; revision=319747
2017-06-09MFV r319744,r319745: 8269 dtrace stddev aggregation is normalized incorrectlyAndriy Gapon
illumos/illumos-gate@79809f9cf402f130667349b2d4007ecd65d63c6f https://github.com/illumos/illumos-gate/commit/79809f9cf402f130667349b2d4007ecd65d63c6f https://www.illumos.org/issues/8269 It seems that currently normalization of stddev aggregation is done incorrectly. We divide both the sum of values and the sum of their squares by the normalization factor. But we should divide the sum of squares by the normalization factor squared to scale the original values properly. FreeBSD note: the actual change was committed in r316853, this commit adds the test files and record merge information. Reviewed by: Bryan Cantrill <bryan@joyent.com> Approved by: Robert Mustacchi <rm@joyent.com> Author: Andriy Gapon <avg@FreeBSD.org> MFC after: 1 week Sponsored by: Panzura Notes: svn path=/head/; revision=319746
2017-03-23aacraid: rework r315083 for a clean build with and without AACRAID_DEBUGAndriy Gapon
r315083 essentially reverted r263954 which was made for a good reason, but didn't take into account AACRAID_DEBUG. Now both types of build should be clean. MFC after: 5 days No MFC to: stable/10 Notes: svn path=/head/; revision=315858
2017-03-11aacraid: fix build with AACRAID_DEBUG=2Andriy Gapon
MFC after: 10 days Notes: svn path=/head/; revision=315083
2017-01-04Always null-terminate ccb_pathinq.(sim_vid|hba_vid|dev_name)Alan Somers
The sim_vid, hba_vid, and dev_name fields of struct ccb_pathinq are fixed-length strings. AFAICT the only place they're read is in sbin/camcontrol/camcontrol.c, which assumes they'll be null-terminated. However, the kernel doesn't null-terminate them. A bunch of copy-pasted code uses strncpy to write them, and doesn't guarantee null-termination. For at least 4 drivers (mpr, mps, ciss, and hyperv), the hba_vid field actually overflows. You can see the result by doing "camcontrol negotiate da0 -v". This change null-terminates those fields everywhere they're set in the kernel. It also shortens a few strings to ensure they'll fit within the 16-character field. PR: 215474 Reported by: Coverity CID: 1009997 1010000 1010001 1010002 1010003 1010004 1010005 CID: 1331519 1010006 1215097 1010007 1288967 1010008 1306000 CID: 1211924 1010009 1010010 1010011 1010012 1010013 1010014 CID: 1147190 1010017 1010016 1010018 1216435 1010020 1010021 CID: 1010022 1009666 1018185 1010023 1010025 1010026 1010027 CID: 1010028 1010029 1010030 1010031 1010033 1018186 1018187 CID: 1010035 1010036 1010042 1010041 1010040 1010039 Reviewed by: imp, sephe, slm MFC after: 4 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D9037 Differential Revision: https://reviews.freebsd.org/D9038 Notes: svn path=/head/; revision=311305
2016-10-28Remove a PCI ID for a raid controller from Adaptec that was planned,Warner Losh
but never released. Since no real hardware was released with this ID, just drop it from the aacraid driver. This paves the path for future drivers for hardware that actually has this ID. Submitted by: Scott Benesh from Microsemi. Differential Revision: https://reviews.freebsd.org/D8377 MFC After: 3 days Notes: svn path=/head/; revision=308065
2016-05-03sys/dev: minor spelling fixes.Pedro F. Giffuni
Most affect comments, very few have user-visible effects. Notes: svn path=/head/; revision=298955
2016-04-26aacraid(4): Fix some mostly trivial buffer overrunsConrad Meyer
strcpy(3) emits a trailing nul byte, trampling fields after the intended destination. Instead, use strncpy(3), intentionally leaving these fields not nul-terminated. Reported by: Coverity CIDs: 1031024, 1305463, 1305494, 1305545 Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=298665
2016-04-19aacraid(4): Sanely copyin userland pointers and ensure that we don't getSean Bruno
anything janky from a user. (cturt) aac(4): landergriffith+freebsdbugzilla@gmail.com pointed out that aacraid(4) had the same issue and handling of pointers, so let's change that too. PR: 206573 Submitted by: cturt@hardenedbsd.org Obtained from: HardenedBSD MFC after: 1 week Notes: svn path=/head/; revision=298280
2016-04-10Cleanup unnecessary semicolons from the kernel.Pedro F. Giffuni
Found with devel/coccinelle. Notes: svn path=/head/; revision=297793
2016-02-27Migrate many bus_alloc_resource() calls to bus_alloc_resource_anywhere().Justin Hibbits
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 Notes: svn path=/head/; revision=296137
2015-03-22Remove MAXBSIZE use from drivers where it has nothing to do.Alexander Motin
In some cases limits are just not needed, in others -- DFLTPHYS is the right constant to use instead. MFC after: 1 month Notes: svn path=/head/; revision=280347
2014-03-30Remove instances of variables that were set, but never used. gcc 4.9Warner Losh
warns about these by default. Notes: svn path=/head/; revision=263954
2014-03-16Update kernel inclusions of capability.h to use capsicum.h instead; someRobert Watson
further refinement is required as some device drivers intended to be portable over FreeBSD versions rely on __FreeBSD_version to decide whether to include capability.h. MFC after: 3 weeks Notes: svn path=/head/; revision=263233
2014-01-03Wrap this debug statement in debug defines. Else, this driverSean Bruno
will refuse to load. MFC after: 2 weeks Sponsored by: Yahoo! Inc. Notes: svn path=/head/; revision=260243
2013-11-08Update aacraid to version 3.2.5.Achim Leubner
Full MSI-X interrupt support added. Timeout and reset handling reworked, firmware flash update test added. Support for drives with 4KB block size added. Changes made to avoid exposure of phys. array components by default. Approved by: scottl (mentor), emaste (co-mentor) Notes: svn path=/head/; revision=257847
2013-09-05Handle cases where capability rights are not provided.Pawel Jakub Dawidek
Reported by: kib Notes: svn path=/head/; revision=255240
2013-08-12Update PCI drivers to no longer look at the MEMIO-enabled bit in the PCIScott Long
command register. The lazy BAR allocation code in FreeBSD sometimes disables this bit when it detects a range conflict, and will re-enable it on demand when a driver allocates the BAR. Thus, the bit is no longer a reliable indication of capability, and should not be checked. This results in the elimination of a lot of code from drivers, and also gives the opportunity to simplify a lot of drivers to use a helper API to set the busmaster enable bit. This changes fixes some recent reports of disk controllers and their associated drives/enclosures disappearing during boot. Submitted by: jhb Reviewed by: jfv, marius, achadd, achim MFC after: 1 day Notes: svn path=/head/; revision=254263