aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/ata
Commit message (Collapse)AuthorAgeFilesLines
* Update PCI drivers to no longer look at the MEMIO-enabled bit in the PCIScott Long2013-08-121-4/+1
| | | | | | | | | | | | | | | | | | | | 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
* Add missing NULL check after malloc(M_NOWAIT).Alexander Motin2013-07-251-0/+4
| | | | | | | Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com> Notes: svn path=/head/; revision=253644
* Add new Coleto Creek device support: SATA, SMBus, and Watchdog devices.Jack F Vogel2013-07-192-0/+7
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=253475
* Add test for SATA registers writability and skip using them if it failed.Alexander Motin2013-06-251-5/+30
| | | | | | | | | | | | | There are some systems reported, where PCI BAR(5), used for SATA registers access, is present, but not functional. Attempt to use it brakes devices detection logic. Try to detect those cases on attach by setting and testing some bits in SControl register. If bits are unsettable, fallback to legacy ATA without hot-plug detection, speed control/reporting, etc. MFC after: 2 weeks Notes: svn path=/head/; revision=252203
* Pass proper memory type to free() in ata_ali_chipinit().Alexander Motin2013-06-181-1/+1
| | | | | | | | Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com> MFC after: 1 week Notes: svn path=/head/; revision=251945
* Fix several typosEitan Adler2013-05-121-1/+1
| | | | | | | | | PR: kern/176054 Submitted by: Christoph Mallon <christoph.mallon@gmx.de> MFC after: 3 days Notes: svn path=/head/; revision=250576
* Usnure that PCI bus BIS_GET_DMA_TAG() method sees the actual PCIKonstantin Belousov2013-04-141-0/+8
| | | | | | | | | | | | | | device which makes the request for dma tag, instead of some descendant of the PCI device, by creating a pass-through trampoline for vga_pci and ata_pci buses. Sponsored by: The FreeBSD Foundation Suggested by: jhb Discussed with: jhb, mav MFC after: 1 week Notes: svn path=/head/; revision=249476
* - With the demise of !ATA_CAM, ATA_STATIC_ID is the only ata(4) relatedMarius Strobl2013-04-0631-35/+3
| | | | | | | | | | | | option left but actually consumed by ada(4), so move it to opt_ada.h and get rid of opt_ata.h. - Fix stand-alone build of atacore(4) by adding opt_cam.h. - Use __FBSDID. - Use DEVMETHOD_END. - Use NULL instead of 0 for pointers. Notes: svn path=/head/; revision=249213
* - Make ata_str2mode() static, it's not used outside of ata-all.c.Marius Strobl2013-04-064-195/+153
| | | | | | | | | | | | | - Move ata_timeout() to ata-all.c so we don't need to expose both this function and ata_cam_end_transaction() but only the former. - Move ata_cmd2str() from ata-queue.c to ata-all.c so we can get rid of the former. - Add some missing prototypes. MFC after: 3 days Notes: svn path=/head/; revision=249203
* Remove some more remnants of !ATA_CAM.Marius Strobl2013-04-061-11/+0
| | | | Notes: svn path=/head/; revision=249202
* Unbreak ATA_NO_48BIT_DMA with ATA_CAM by treating 48-bit DMA as anMarius Strobl2013-04-061-7/+23
| | | | | | | | | | optional property with PATA transport. Reviewed by: mav MFC after: 3 days Notes: svn path=/head/; revision=249199
* Remove all legacy ATA code parts, not used since options ATA_CAM enabled inAlexander Motin2013-04-0428-13814/+2
| | | | | | | | | | | | most kernels before FreeBSD 9.0. Remove such modules and respective kernel options: atadisk, ataraid, atapicd, atapifd, atapist, atapicam. Remove the atacontrol utility and some man pages. Remove useless now options ATA_CAM. No objections: current@, stable@ MFC after: never Notes: svn path=/head/; revision=249083
* Since ATA_CAM mode has no implemented support for serializing access to theAlexander Motin2013-04-032-6/+22
| | | | | | | | | | | | different ATA channels, required for acard and pc98 ATA controllers, block access to second channels of both, hoping that one working channel is better then none. I have an idea how that support could be implemented, but I have no hardware to work on that. MFC after: 1 week Notes: svn path=/head/; revision=249062
* Add some more ATA_CAM ifdefs.Alexander Motin2013-04-032-7/+15
| | | | | | | | Submitted by: marius (partially) MFC after: 1 week Notes: svn path=/head/; revision=249052
* Integrate Efika MX project back to home.Aleksandr Rybalko2013-03-201-0/+238
| | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=248557
* Fix command timeout caused by data underrun during fetching ATAPI senseAlexander Motin2013-02-223-1/+3
| | | | | | | | | | | data, introduced by r246713. There are two places where ata_request is filled in ATA_CAM: ata_cam_begin_transaction() and ata_cam_request_sense(). In the first case DMA should be done for addresses from the CCB. In second case, DMA should be done to the different address, the address of the sense buffer inside the CCB structure itself. Notes: svn path=/head/; revision=247165
* Reform the busdma API so that new types may be added without modifyingKonstantin Belousov2013-02-122-10/+11
| | | | | | | | | | | | | | | | | | | | | | | | every architecture's busdma_machdep.c. It is done by unifying the bus_dmamap_load_buffer() routines so that they may be called from MI code. The MD busdma is then given a chance to do any final processing in the complete() callback. The cam changes unify the bus_dmamap_load* handling in cam drivers. The arm and mips implementations are updated to track virtual addresses for sync(). Previously this was done in a type specific way. Now it is done in a generic way by recording the list of virtuals in the map. Submitted by: jeff (sponsored by EMC/Isilon) Reviewed by: kan (previous version), scottl, mjacob (isp(4), no objections for target mode changes) Discussed with: ian (arm changes) Tested by: marius (sparc64), mips (jmallet), isci(4) on x86 (jharris), amd64 (Fabian Keil <freebsd-listen@fabiankeil.de>) Notes: svn path=/head/; revision=246713
* Improve r238673 to additionally allow for odd-aligned buffers asMarius Strobl2013-02-022-10/+49
| | | | | | | | | | | | passed in by smartd of smartmontools. While at it, hint the compiler that 32-bit PIO is the most likely case (idea from Linux) and use bus_{read,write}_stream_2(9) instead of bus_{read,write}_multi_stream_2(9) for single count reads/writes. MFC after: 1 week Notes: svn path=/head/; revision=246257
* In case somebody still use it, fix legacy ataraid(4) to work on combinedAlexander Motin2013-01-151-1/+2
| | | | | | | | | | PATA+AHCI controllers, such as JMicron JMB363. PR: kern/159271 MFC after: 1 week Notes: svn path=/head/; revision=245446
* Add Intel Lynx Point PCH SATA Controller Device IDsJack F Vogel2013-01-022-0/+25
| | | | Notes: svn path=/head/; revision=244983
* Add IDs for SATA controllers on AMD Hudson-2 series chipsets.Alexander Motin2012-12-122-0/+12
| | | | | | | | | | I am not exactly sure about the naming due to lack of specs on AMD site, but it is better to have some identification then none at all. MFC after: 1 month Notes: svn path=/head/; revision=244146
* Remove duplicate const specifiers in many drivers (I hope I got all ofDimitry Andric2012-11-0517-18/+18
| | | | | | | | | | | | | | | | | | | | | | | them, please let me know if not). Most of these are of the form: static const struct bzzt_type { [...list of members...] } const bzzt_devs[] = { [...list of initializers...] }; The second const is unnecessary, as arrays cannot be modified anyway, and if the elements are const, the whole thing is const automatically (e.g. it is placed in .rodata). I have verified this does not change the binary output of a full kernel build (except for build timestamps embedded in the object files). Reviewed by: yongari, marius MFC after: 1 week Notes: svn path=/head/; revision=242625
* Only four specific ATA PIO commands transfer several sectors per DRQ blockAlexander Motin2012-11-011-2/+10
| | | | | | | | | (interrupt). All other ATA PIO commands transfer one sector or 512 bytes at one time. Hardcode these exceptions in ata(4) with ATA_CAM option. This fixes timeout of READ LOG EXT command used by `smartctl -x /dev/adaX`. Notes: svn path=/head/; revision=242422
* Implement CAM_ATAIO_NEEDRESULT (fetching full set of result registers) forAlexander Motin2012-10-265-6/+21
| | | | | | | | | | ata(4) driver in ATA_CAM mode. That slighty improves error reporting and also should fix `smartctl -l scterc /dev/adaX` operation. MFC after: 3 weeks Notes: svn path=/head/; revision=242156
* Add checks for ata_sata_scr_read() return statuses. It is mostly to silenceAlexander Motin2012-10-101-3/+5
| | | | | | | Clang Static Analyzer warnings as errors there are usually unlikely. Notes: svn path=/head/; revision=241402
* Fix build without `options ATA_CAM`, broken by r241144.Alexander Motin2012-10-031-0/+4
| | | | Notes: svn path=/head/; revision=241160
* Implement SATA revision (speed) control for legacy SATA controller forAlexander Motin2012-10-023-4/+27
| | | | | | | | | | both boot (via loader tunables) and run-time (via `camcontrol negotiate`). Tested to work at least on NVIDIA MCP55 chipset. H/w provided by: glebius Notes: svn path=/head/; revision=241144
* Remove bogus break statements.Kevin Lo2012-09-181-1/+0
| | | | | | | Obtained from: DragonFly Notes: svn path=/head/; revision=240627
* Add IDs for JMicron JMB360/JMB362 AHCI SATA controllers.Alexander Motin2012-08-302-0/+2
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=239907
* Use 16bit PIO instead of 32bit in case of misaligned buffer.Alexander Motin2012-07-211-18/+14
| | | | | | | It fixes kernel panic during CD write with cdrecord on sparc64. Notes: svn path=/head/; revision=238673
* Fix typo in bzero length argument during sense fetching.Alexander Motin2012-07-211-1/+1
| | | | | | | | | For me it at least fixed CD burning in PIO mode. MFC after: 3 days Notes: svn path=/head/; revision=238666
* Remove variables which are initialized but never used thereafterEitan Adler2012-07-071-4/+0
| | | | | | | | | | reported by gcc46 warning Approved by: cperciva MFC after: 1 week Notes: svn path=/head/; revision=238203
* - As a baind-aid, disable ATAPI DMA when using ATA_CAM for these controllersMarius Strobl2012-06-141-2/+5
| | | | | | | | | | | as well as it causes the kernel to hang during boot. Reported and tested by: Kevin Oberman - Use NULL instead of 0 for a pointer. MFC after: 3 days Notes: svn path=/head/; revision=237107
* Partially revert r236666:Alexander Motin2012-06-101-1/+1
| | | | | | | | | | | | | | Return PROTO_ATA protocol in response to XPT_PATH_INQ. smartmontools uses it to identify ATA devices and I don't know any other place now where it is important. It could probably use XPT_GDEV_TYPE instead for more accurate protocol information, but let it live for now. Reported by: matthew MFC after: 3 days Notes: svn path=/head/; revision=236847
* ATA/SATA controllers have no idea about protocol of the connected deviceAlexander Motin2012-06-061-2/+2
| | | | | | | | | | until transport will do some probe actions (at least soft reset). Make ATA/SATA SIMs to not report bogus and confusing PROTO_ATA protocol. Make ATA/SATA transport to fill that gap by reporting protocol to SIM with XPT_SET_TRAN_SETTINGS and patching XPT_GET_TRAN_SETTINGS results if needed. Notes: svn path=/head/; revision=236666
* Make legacy ATA to not call device_add_child() with unit number butAlexander Motin2012-05-281-1/+1
| | | | | | | | | without driver name. This fixed legacy ATA breakage by r235978. MFC after: 1 week Notes: svn path=/head/; revision=236184
* Add two functions xpt_batch_start() and xpt_batch_done() to the CAM SIM KPIAlexander Motin2012-05-121-0/+2
| | | | | | | | | | | | to allow drivers to handle request completion directly without passing them to the CAM SWI thread removing extra context switch. Modify all ATA/SATA drivers to use them. Reviewed by: gibbs, ken MFC after: 2 weeks Notes: svn path=/head/; revision=235333
* - First pass at const'ifying ata(4) as appropriate.Marius Strobl2012-03-2132-124/+138
| | | | | | | | | | - Use DEVMETHOD_END. - Use NULL instead of 0 for pointers MFC after: 1 week Notes: svn path=/head/; revision=233282
* Remove remnants of ATA_LOCKING uses in the ATA_CAM case and wrap itMarius Strobl2012-03-216-7/+94
| | | | | | | | | | | | | | | | | | along with functions, SYSCTLs and tunables that are not used with ATA_CAM in #ifndef ATA_CAM, similar to the existing #ifdef'ed ATA_CAM code for the other way around. This makes it easier to understand which parts of ata(4) actually are used in the new world order and to later on remove the !ATA_CAM bits. It also makes it obvious that there is something fishy with the C-bus front-end as well as in the ATP850 support, as these used ATA_LOCKING which is defunct in the ATA_CAM case. When fixing the former, ATA_LOCKING probably needs to be brought back in some form or other. Reviewed by: mav MFC after: 1 week Notes: svn path=/head/; revision=233274
* Fix names of some Marvell SATA chips. It looks like chips with proprietaryAlexander Motin2012-03-023-16/+16
| | | | | | | | | | | interface supported by mvs(4) are 88SX, while AHCI-like chips are 88SE. PR: kern/165271 Submitted by: Jia-Shiun Li <jiashiun@gmail.com> MFC after: 1 week Notes: svn path=/head/; revision=232380
* Fix panic after "WARNING - ATA_IDENTIFY taskqueue timeout"Ed Maste2012-02-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | | When performing a firmware upgrade via atacontrol[1] the subsequent command may time out producing the error message above. When this happens the callout could still be active, and the system would then panic due to a destroyed semaphore. Instead, ensure that the callout is done first, via callout_drain. Note that this fix applies to the "old" ata(4) and so isn't applicable to the default configuration in HEAD. It is still applicable to stable/8. [1] http://lists.freebsd.org/pipermail/freebsd-current/2012-January/031122.html Submitted by: Nima Misaghian Reviewed by: rstone, attilio, mav Obtained from: SVOS MFC after: 3 days Notes: svn path=/head/; revision=231573
* Using ATA_CAM along with ATAPI DMA causes data corruption with ALI_NEWMarius Strobl2012-01-272-0/+8
| | | | | | | | | and CMD controllers for reasons unknown so disable it. PR: 164226 Notes: svn path=/head/; revision=230627
* Convert files to UTF-8Ulrich Spörlein2012-01-1545-48/+48
| | | | Notes: svn path=/head/; revision=230132
* Add the CAM Target Layer (CTL).Kenneth D. Merry2012-01-121-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | CTL is a disk and processor device emulation subsystem originally written for Copan Systems under Linux starting in 2003. It has been shipping in Copan (now SGI) products since 2005. It was ported to FreeBSD in 2008, and thanks to an agreement between SGI (who acquired Copan's assets in 2010) and Spectra Logic in 2010, CTL is available under a BSD-style license. The intent behind the agreement was that Spectra would work to get CTL into the FreeBSD tree. Some CTL features: - Disk and processor device emulation. - Tagged queueing - SCSI task attribute support (ordered, head of queue, simple tags) - SCSI implicit command ordering support. (e.g. if a read follows a mode select, the read will be blocked until the mode select completes.) - Full task management support (abort, LUN reset, target reset, etc.) - Support for multiple ports - Support for multiple simultaneous initiators - Support for multiple simultaneous backing stores - Persistent reservation support - Mode sense/select support - Error injection support - High Availability support (1) - All I/O handled in-kernel, no userland context switch overhead. (1) HA Support is just an API stub, and needs much more to be fully functional. ctl.c: The core of CTL. Command handlers and processing, character driver, and HA support are here. ctl.h: Basic function declarations and data structures. ctl_backend.c, ctl_backend.h: The basic CTL backend API. ctl_backend_block.c, ctl_backend_block.h: The block and file backend. This allows for using a disk or a file as the backing store for a LUN. Multiple threads are started to do I/O to the backing device, primarily because the VFS API requires that to get any concurrency. ctl_backend_ramdisk.c: A "fake" ramdisk backend. It only allocates a small amount of memory to act as a source and sink for reads and writes from an initiator. Therefore it cannot be used for any real data, but it can be used to test for throughput. It can also be used to test initiators' support for extremely large LUNs. ctl_cmd_table.c: This is a table with all 256 possible SCSI opcodes, and command handler functions defined for supported opcodes. ctl_debug.h: Debugging support. ctl_error.c, ctl_error.h: CTL-specific wrappers around the CAM sense building functions. ctl_frontend.c, ctl_frontend.h: These files define the basic CTL frontend port API. ctl_frontend_cam_sim.c: This is a CTL frontend port that is also a CAM SIM. This frontend allows for using CTL without any target-capable hardware. So any LUNs you create in CTL are visible in CAM via this port. ctl_frontend_internal.c, ctl_frontend_internal.h: This is a frontend port written for Copan to do some system-specific tasks that required sending commands into CTL from inside the kernel. This isn't entirely relevant to FreeBSD in general, but can perhaps be repurposed. ctl_ha.h: This is a stubbed-out High Availability API. Much more is needed for full HA support. See the comments in the header and the description of what is needed in the README.ctl.txt file for more details. ctl_io.h: This defines most of the core CTL I/O structures. union ctl_io is conceptually very similar to CAM's union ccb. ctl_ioctl.h: This defines all ioctls available through the CTL character device, and the data structures needed for those ioctls. ctl_mem_pool.c, ctl_mem_pool.h: Generic memory pool implementation used by the internal frontend. ctl_private.h: Private data structres (e.g. CTL softc) and function prototypes. This also includes the SCSI vendor and product names used by CTL. ctl_scsi_all.c, ctl_scsi_all.h: CTL wrappers around CAM sense printing functions. ctl_ser_table.c: Command serialization table. This defines what happens when one type of command is followed by another type of command. ctl_util.c, ctl_util.h: CTL utility functions, primarily designed to be used from userland. See ctladm for the primary consumer of these functions. These include CDB building functions. scsi_ctl.c: CAM target peripheral driver and CTL frontend port. This is the path into CTL for commands from target-capable hardware/SIMs. README.ctl.txt: CTL code features, roadmap, to-do list. usr.sbin/Makefile: Add ctladm. ctladm/Makefile, ctladm/ctladm.8, ctladm/ctladm.c, ctladm/ctladm.h, ctladm/util.c: ctladm(8) is the CTL management utility. It fills a role similar to camcontrol(8). It allow configuring LUNs, issuing commands, injecting errors and various other control functions. usr.bin/Makefile: Add ctlstat. ctlstat/Makefile ctlstat/ctlstat.8, ctlstat/ctlstat.c: ctlstat(8) fills a role similar to iostat(8). It reports I/O statistics for CTL. sys/conf/files: Add CTL files. sys/conf/NOTES: Add device ctl. sys/cam/scsi_all.h: To conform to more recent specs, the inquiry CDB length field is now 2 bytes long. Add several mode page definitions for CTL. sys/cam/scsi_all.c: Handle the new 2 byte inquiry length. sys/dev/ciss/ciss.c, sys/dev/ata/atapi-cam.c, sys/cam/scsi/scsi_targ_bh.c, scsi_target/scsi_cmds.c, mlxcontrol/interface.c: Update for 2 byte inquiry length field. scsi_da.h: Add versions of the format and rigid disk pages that are in a more reasonable format for CTL. amd64/conf/GENERIC, i386/conf/GENERIC, ia64/conf/GENERIC, sparc64/conf/GENERIC: Add device ctl. i386/conf/PAE: The CTL frontend SIM at least does not compile cleanly on PAE. Sponsored by: Copan Systems, SGI and Spectra Logic MFC after: 1 month Notes: svn path=/head/; revision=229997
* Add 0x2826 device ID for C600 (Patsburg) SATA controller in RAID mode.Jim Harris2012-01-062-0/+2
| | | | | | | | Reviewed by: mav Approved by: scottl Notes: svn path=/head/; revision=229671
* Use strchr() and strrchr().Ed Schouten2012-01-021-2/+2
| | | | | | | | | | | It seems strchr() and strrchr() are used more often than index() and rindex(). Therefore, simply migrate all kernel code to use it. For the XFS code, remove an empty line to make the code identical to the code in the Linux kernel. Notes: svn path=/head/; revision=229272
* Add PCI IDs for the Intel ICH9M SATA controllers.Alexander Motin2011-12-142-0/+8
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=228497
* Add hw.ahci.force tunable to control whether AHCI drivers should attachAlexander Motin2011-12-022-2/+26
| | | | | | | | | | | | | to known AHCI-capable chips (AMD/NVIDIA), configured for legacy emulation. Enabled by default to get additional performance and functionality of AHCI when it can't be enabled by BIOS. Can be disabled to honor BIOS settings if needed for some reason. MFC after: 1 month Notes: svn path=/head/; revision=228200
* Rename device_delete_all_children() into device_delete_children().Hans Petter Selasky2011-11-222-2/+2
| | | | | | | | Suggested by: jhb @ and marius @ MFC after: 1 week Notes: svn path=/head/; revision=227849
* Move the device_delete_all_children() function from usb_util.cHans Petter Selasky2011-11-192-15/+3
| | | | | | | | | | | to kern/subr_bus.c. Simplify this function so that it no longer depends on malloc() to execute. Identify a few other places where it makes sense to use device_delete_all_children(). MFC after: 1 week Notes: svn path=/head/; revision=227701