aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/ahci
Commit message (Collapse)AuthorAgeFilesLines
* Add basic support for Freescale LX2160A SoC.Michal Meloun2020-12-051-48/+185
| | | | | | | All peripherals but the network processor are supported. Notes: svn path=/head/; revision=368369
* Make MAXPHYS tunable. Bump MAXPHYS to 1M.Konstantin Belousov2020-11-283-17/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace MAXPHYS by runtime variable maxphys. It is initialized from MAXPHYS by default, but can be also adjusted with the tunable kern.maxphys. Make b_pages[] array in struct buf flexible. Size b_pages[] for buffer cache buffers exactly to atop(maxbcachebuf) (currently it is sized to atop(MAXPHYS)), and b_pages[] for pbufs is sized to atop(maxphys) + 1. The +1 for pbufs allow several pbuf consumers, among them vmapbuf(), to use unaligned buffers still sized to maxphys, esp. when such buffers come from userspace (*). Overall, we save significant amount of otherwise wasted memory in b_pages[] for buffer cache buffers, while bumping MAXPHYS to desired high value. Eliminate all direct uses of the MAXPHYS constant in kernel and driver sources, except a place which initialize maxphys. Some random (and arguably weird) uses of MAXPHYS, e.g. in linuxolator, are converted straight. Some drivers, which use MAXPHYS to size embeded structures, get private MAXPHYS-like constant; their convertion is out of scope for this work. Changes to cam/, dev/ahci, dev/ata, dev/mpr, dev/mpt, dev/mvs, dev/siis, where either submitted by, or based on changes by mav. Suggested by: mav (*) Reviewed by: imp, mav, imp, mckusick, scottl (intermediate versions) Tested by: pho Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D27225 Notes: svn path=/head/; revision=368124
* Fix stupid math mistake in r366922.Alexander Motin2020-11-211-1/+1
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=367915
* Add icc (Isochronous Command Completion) ccb_ataio field.Alexander Motin2020-11-021-6/+8
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=367261
* Move the iommu stubs to a generic place, so they are available on all theRuslan Bukin2020-10-231-4/+0
| | | | | | | | | | | | | | | platforms. This allows to not depend on the IOMMU macro in AHCI driver. Requested by: kib Suggested by: andrew Reviewed by: kib Sponsored by: Innovate DSbD Differential Revision: https://reviews.freebsd.org/D26887 Notes: svn path=/head/; revision=366980
* Pass lower 3 bits of sector_count for FPDMA commands.Alexander Motin2020-10-221-3/+3
| | | | | | | | | | When this code was written those bits were N/A, but now the lowest bit is Rebuild Assist Recovery Control (RARC). MFC after: 1 month Notes: svn path=/head/; revision=366922
* Fix build: only set iommu buswide flag if IOMMU code is included.Ruslan Bukin2020-10-191-0/+4
| | | | | | | Sponsored by: Innovate DSbD Notes: svn path=/head/; revision=366865
* Add IOMMU_BUSWIDE ahci quirk.Ruslan Bukin2020-10-192-14/+42
| | | | | | | | | | | | | | | | | | | | | | Some controllers use PCI function 1 as the requester ID for DMA transfers, but the controllers are not PCI multifunction. Set the iommu buswide flag for them. This should instruct an IOMMU driver to use the same translation rule for all the devices and functions of a bus. This was discovered on the ARM Neoverse N1 System Development Platform (ARM N1SDP). Bug reference: https://bugzilla.kernel.org/show_bug.cgi?id=42679 Reported by: andrew Reviewed by: kib, mav Sponsored by: Innovate DSbD Differential Revision: https://reviews.freebsd.org/D26857 Notes: svn path=/head/; revision=366863
* ahci_generic: add quirk for NXP0004 (NXP Layerscape LX2160A)Emmanuel Vadot2020-09-301-0/+17
| | | | | | | | | | | | | | | This fixes this error : (aprobe3:ahcich3:0:15:0): NOP FLUSHQUEUE. ACB: 00 00 00 00 00 00 00 00 00 00 00 00 (aprobe3:ahcich3:0:15:0): CAM status: Command timeout (aprobe3:ahcich3:0:15:0): Error 5, Retries exhausted Submitted by: Greg V <greg@unrelenting.technology> Reviewed by: imp, mav MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D25157 Notes: svn path=/head/; revision=366295
* ahci: clean up empty lines in .c and .h filesMateusz Guzik2020-09-013-4/+0
| | | | Notes: svn path=/head/; revision=365104
* Add Intel Apollo Lake AHCI ID.Alexander Motin2020-08-061-0/+1
| | | | | | | | Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com> MFC after: 1 week Notes: svn path=/head/; revision=363955
* Limit AHCI to only one MSI if more is not needed.Alexander Motin2020-06-051-1/+5
| | | | | | | | | | | | | | | | My AMD Ryzen system has 4 AHCI controllers, each supporting 16 MSI vectors. Since two of the controllers have only one SATA port, limit to single MSI saves system 30 interrupt vectors for free. It may be possible to also limit number of MSI vectors to 4 and 8 for the other two controllers, but according to the AHCI specification after that controllers may revert to only one vector, that would be a bigger loss to risk. MFC after: 2 weeks Notes: svn path=/head/; revision=361816
* Introduce a driver for NXP LS1046A SoC AHCI.Marcin Wojtas2020-05-251-0/+287
| | | | | | | | | | | | | | Implement support for AHCI controller found in NXP QorIQ Layerscape SoCs. Submitted by: Artur Rojek <ar@semihalf.com> Reviewed by: manu Obtained from: Semihalf Sponsored by: Alstom Group Differential Revision: https://reviews.freebsd.org/D24466 Notes: svn path=/head/; revision=361464
* Add support for AHCI BIOS/OS Handoff.Alexander Motin2020-04-012-0/+27
| | | | | | | | | | | | This allows clean handoff from BIOS implementing some asynchronous I/O to the OS AHCI driver. During attach driver declares OS ownership request and waits from 25ms to 2s for BIOS to complete operation and release the hardware. MFC after: 2 weeks Notes: svn path=/head/; revision=359500
* Add ID for JMicron JMB582/JMB585 AHCI controller.Alexander Motin2020-04-011-0/+2
| | | | | | | | | | | | JMB582 has 2 6Gbps SATA ports and PCIe 3.0 x1. JMB585 has 5 6Gbps SATA ports and PCIe 3.0 x2. Both chips support AHCI v1.31, Port Multiplier with FBS and 8 MSI vectors. MFC after: 2 weeks Notes: svn path=/head/; revision=359499
* Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)Pawel Biernacki2020-02-261-2/+2
| | | | | | | | | | | | | | | | | | | 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
* Add Hygon PCI ID and description for AHCI SATA controller.Alexander Motin2020-02-141-0/+1
| | | | | | | | | Submitted by: Pu Wen <puwen@hygon.cn> MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D23556 Notes: svn path=/head/; revision=357919
* Use a void * argument to callout handlers instead of timeout_t casts.John Baldwin2019-12-051-5/+6
| | | | | | | | Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D22684 Notes: svn path=/head/; revision=355426
* Add some IDs of Intel Wildcat Point-LP.Alexander Motin2019-11-261-0/+4
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=355113
* Fix AHCI Enclosure Management, broken by r351356.Alexander Motin2019-08-282-20/+24
| | | | | | | | ivars value of -1 was used to distinguish EM device, and r351356 left some wrong checks for it. Give EM device separate flag there instead. Notes: svn path=/head/; revision=351589
* Create a AHCI attachment for nvme.Warner Losh2019-08-213-5/+82
| | | | | | | | | | | | | | | | | | | | | | | | | Intel has created RST and many laptops from vendors like Lenovo and Asus. It's a mechanism for creating multiple boot devices under windows. It effectively hides the nvme drive inside of the ahci controller. The details are supposed to be a trade secret. However, there's a reverse engineered Linux driver, and this implements similar operations to allow nvme drives to attach. The ahci driver attaches nvme children that proxy the remapped resources to the child. nvme_ahci is just like nvme_pci, except it doesn't do the PCI specific things. That's moved into ahci where appropriate. When the nvme drive is remapped, MSI-x interrupts aren't forwarded (the linux driver doesn't know how to use this either). INTx interrupts are used instead. This is suboptimal, but usually sufficient for the laptops these parts are in. This is based loosely on https://www.spinics.net/lists/linux-ide/msg53364.html submitted, but not accepted by, Linux. It was written by Dan Williams. These changes were written from scratch by Olivier Houchard. Submitted by: cognet@ (Olivier Houchard) Notes: svn path=/head/; revision=351356
* Improve AHCI Enclosure Management and SES interoperation.Alexander Motin2019-06-233-36/+145
| | | | | | | | | | | | | | | | | | | | | | | | Since SES specs do not define mechanism to map enclosure slots to SATA disks, AHCI EM code I written many years ago appeared quite useless, that always bugged me. I was thinking whether it was a good idea, but if LSI HBAs do that, why I shouldn't? This change introduces simple non-standard mechanism for the mapping into both AHCI EM and SES code, that makes AHCI EM on capable controllers (most of Intel's) a first-class SES citizen, allowing it to report disk physical path to GEOM, show devices inserted into each enclosure slot in `sesutil map` and `getencstat`, control locate and fault LEDs for specific devices with `sesutil locate adaX on` and `sesutil fault adaX on`, etc. I've successfully tested this on Supermicro X10DRH-i motherboard connected with sideband cable of its S-SATA Mini-SAS connector to SAS815TQ backplane. It can indicate with LEDs Locate, Fault and Rebuild/Remap SES statuses for each disk identical to real SES of Supermicro SAS2 backplanes. MFC after: 2 weeks Notes: svn path=/head/; revision=349321
* ahci: Check if bus is cache-coherentEmmanuel Vadot2019-05-101-0/+7
| | | | | | | | | | | | We do this for FDT systems but not for ACPI ones. Check the presence of the _CCA attribute. Sponsored by: Ampere Computing, LLC Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D20144 Notes: svn path=/head/; revision=347440
* Add some Cannon Lake chipset IDs.Alexander Motin2019-03-201-0/+2
| | | | | | | | Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com> MFC after: 2 weeks Notes: svn path=/head/; revision=345333
* Fix use of busdma(9) KPI in ahci(4).Konstantin Belousov2019-01-071-16/+24
| | | | | | | | | | | | | | | Use BUS_DMA_NOWAIT for loads at initialization time. Report actual numeric error code if any problem occurs at the initialization. Reported and tested by: pho Reviewed by: mav Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D18741 Notes: svn path=/head/; revision=342826
* Remove questionable initialization for ICH8M, rely on BIOS to properlyXin LI2018-12-111-4/+1
| | | | | | | | | | | | | | | | | | | | | | initialize the controller. According to the datasheet, the old code checks if port 2 (P2E, 0x4) was the only enabled port (except port 0, which was ignored by mask 0xfe), and issue a write to the PCS register to disable all but port 0, right before ahci_ctlr_reset. Some other operating systems would issue a port enable to all ports, but since the current code only does the special initialization for ICH8M, it entirely and rely on BIOS to do the right thing (the alternative would be https://reviews.freebsd.org/D18300?id=50922 , should we see reports that we really need to do it). Reviewed by: mav MFC after: 3 months Differential Revision: https://reviews.freebsd.org/D18300 Notes: svn path=/head/; revision=341811
* Implement ability to turn on/off PHYs for AHCI devices.Warner Losh2018-11-032-3/+49
| | | | | | | | | | | | | | | | | | As part of Chuck's work on fixing kernel crashes caused by disk I/O errors, it is useful to be able to trigger various kinds of errors. This patch allows causing an AHCI-attached disk to disappear, by having the driver keep the PHY disabled when the driver would otherwise enable the PHY. It also allows making the disk reappear by having the driver go back to setting the PHY enable/disable state as it normal would and simulating the hardware event that causes a bus rescan. Submitted by: Chuck Silvers Sponsored by: Netflix, Inc Differential Revision: https://reviews.freebsd.org/D16043 Notes: svn path=/head/; revision=340092
* - Add quirk for Samsung on Mac Mini 7,1Martin Wilke2018-11-021-0/+1
| | | | | | | | | | | | PR: 201676 Submitted by: Ruben Kerkhof Approved by: araujo (mentor) Obtained from: TrueOS Sponsored by: iXsystems Inc. Differential Revision: https://review.freebsd.org/D17815 Notes: svn path=/head/; revision=340041
* Reapply, with minor tweaks, r338025, from the original commit:Warner Losh2018-09-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Back out r338035 until Warner is finished churning GSoC PNP patchesConrad Meyer2018-08-191-1/+1
| | | | | | | | | | 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
* Remove unused and easy to misuse PNP macro parameterConrad Meyer2018-08-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fixed endianess issue in AHCI driverLeandro Lupori2018-07-271-3/+5
| | | | | | | | | | | | | There were some bits that were being set in cmd_flags (a field of AHCI's command list structure) after cmd_flags was converted to little endian. On a big endian host, such as PowerPC, this would set the wrong bits. This was preventing AHCI driver from working on these hosts. Reviewed by: jhibbits Approved by: jhibbits (mentor) Notes: svn path=/head/; revision=336760
* Add PCI IDs for AMD X370 AHCI and XHCI.Mark Johnston2018-07-121-1/+2
| | | | | | | | | Submitted by: Greg V <greg@unrelenting.technology> MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D15398 Notes: svn path=/head/; revision=336225
* Add PNP info to the PCI attachment of the ahci driverWarner Losh2018-06-131-0/+3
| | | | | | | | | | | | Mark the PNP table, but still need to handle the CLASS / SUBCLASS / REVID matching. Reviewed by: imp, chuck Submitted by: Lakhan Shiva Kamireddy <lakhanshiva@gmail.com> Sponsored by: Google, Inc. (GSoC 2018) Notes: svn path=/head/; revision=335079
* Fix kernel modules names for Marvell armv7Marcin Wojtas2018-04-031-2/+2
| | | | | | | | | | | | | | | | Two modules with the same name cannot be loaded, so Marvell specific drivers cannot have the same name as the generic drivers. Files with the same name, even in different folders overlaps their .o files, so in order to prepare for supporting Marvell platforms in GENERIC armv7 config, modify conflicting names. Submitted by: Rafal Kozik <rk@semihalf.com> Obtained from: Semihalf Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D14743 Notes: svn path=/head/; revision=331966
* Add AHCI/XHCI device IDs found on AMD 1950X+X399 systemConrad Meyer2017-12-291-0/+1
| | | | | | | | | A follow-up to r327094. Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=327364
* Add AHCI/XHCI device IDs found on AMD Ryzen+B350 system.Alexander Motin2017-12-221-0/+1
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=327094
* sys/dev: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-273-0/+6
| | | | | | | | | | | | | | | 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
* Add some PCI IDs found on AMD Epyc system.Alexander Motin2017-11-091-0/+5
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=325571
* Define a single instance of ahci_devclass and reference it from all theIan Lepore2017-10-024-2/+6
| | | | | | | | | | | attachment code for various SOCs and busses. Remove all the static and should-have-been-static and named-differently instances of it. This should eliminate the recently-grown build warnings about multiple definitions when building arm kernels. Notes: svn path=/head/; revision=324186
* Add support for AHCI in Armada 3700Marcin Wojtas2017-09-091-3/+4
| | | | | | | | | | | | This patch simply AHCI generic driver by extending compatible list. Submitted by: Patryk Duda <pdk@semihalf.com> Obtained from: Semihalf Sponsored by: Semihalf Differential Revision: https://reviews.freebsd.org/D12254 Notes: svn path=/head/; revision=323356
* Missing remanant of 322309.Alexander Motin2017-08-091-1/+1
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=322316
* Use "Ibex Peak" codename for "5 Series/3400 Series" chipsets.Alexander Motin2017-08-091-6/+6
| | | | | | | | | This is shorter and unifies naming with later chipsets. MFC after: 1 week Notes: svn path=/head/; revision=322309
* Add new Intel Lewisburg and Union Point chipset PCI IDs.Alexander Motin2017-08-091-11/+23
| | | | | | | | | While there, polish some old AHCI ones, since they are still reused. MFC after: 1 week Notes: svn path=/head/; revision=322308
* Add some device IDs for Intel Denverton SoCs.Alexander Motin2017-06-211-0/+20
| | | | Notes: svn path=/head/; revision=320178
* Check if the device is marked as dma-coherent in the FDT, and if so, letOlivier Houchard2017-04-263-1/+7
| | | | | | | | | | busdma know, so that on architectures where dma isn't always coherent, we know we don't have to write-back/invalidates cachelines on DMA operations. Reviewed by: andrew, mav Notes: svn path=/head/; revision=317441
* Block FPDMA TRIM for ASMedia HBAs.Alexander Motin2017-04-183-11/+15
| | | | | | | | | | Experiments show FPDMA TRIM command timeouts on ASMedia HBAs, while the same SSDs working fine on Intel HBAs. MFC after: 2 weeks Notes: svn path=/head/; revision=317080
* Remove dead mentions of CAM target mode APIs from drivers.Alexander Motin2017-02-191-4/+0
| | | | | | | This makes grepping kernel for target mode implementation much easier. Notes: svn path=/head/; revision=313949
* Partially workaround ASMedia HBA error recovery.Alexander Motin2017-01-253-13/+26
| | | | | | | | | | | | Taking closer look on my ASM1062 I found that it has bunch of issues around error recovery: reported wrong CCS, failed commands reported as completed, READ LOG EXT times out after NCQ error. This patch workarounds first two problems, that were making ATAPI devices close to unusable on these HBAs. MFC after: 2 weeks Notes: svn path=/head/; revision=312767
* Extend AHCI_Q_BIT_STRING after adding new quirk for softWojciech Macek2017-01-251-1/+2
| | | | | | | | | | | | | | | reset delay Adding new quirk (AHCI_Q_MRVL_SR_DEL) requires according extention of AHCI_Q_BIT_STRING. Submitted by: Marcin Wojtas <mw@semihalf.com> Obtained from: Semihalf Sponsored by: Stormshield Reviewed by: wma Notes: svn path=/head/; revision=312751