summaryrefslogtreecommitdiffstats
path: root/sys/dev/ata/ata-pci.c
Commit message (Collapse)AuthorAgeFilesLines
* Convert rman to use rman_res_t instead of u_longjhibbits2016-01-271-1/+2
| | | | | | | | | | | | | | | | | | | | Summary: Migrate to using the semi-opaque type rman_res_t to specify rman resources. For now, this is still compatible with u_long. This is step one in migrating rman to use uintmax_t for resources instead of u_long. Going forward, this could feasibly be used to specify architecture-specific definitions of resource ranges, rather than baking a specific integer type into the API. This change has been broken out to facilitate MFC'ing drivers back to 10 without breaking ABI. Reviewed By: jhb Sponsored by: Alex Perez/Inertial Computing Differential Revision: https://reviews.freebsd.org/D5075
* Update PCI drivers to no longer look at the MEMIO-enabled bit in the PCIscottl2013-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
* Usnure that PCI bus BIS_GET_DMA_TAG() method sees the actual PCIkib2013-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
* - With the demise of !ATA_CAM, ATA_STATIC_ID is the only ata(4) relatedmarius2013-04-061-1/+0
| | | | | | | | | 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.
* Remove all legacy ATA code parts, not used since options ATA_CAM enabled inmav2013-04-041-18/+0
| | | | | | | | | 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
* - First pass at const'ifying ata(4) as appropriate.marius2012-03-211-10/+10
| | | | | | | - Use DEVMETHOD_END. - Use NULL instead of 0 for pointers MFC after: 1 week
* Remove remnants of ATA_LOCKING uses in the ATA_CAM case and wrap itmarius2012-03-211-0/+4
| | | | | | | | | | | | | | | 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
* Convert files to UTF-8uqs2012-01-151-1/+1
|
* Rename device_delete_all_children() into device_delete_children().hselasky2011-11-221-1/+1
| | | | | Suggested by: jhb @ and marius @ MFC after: 1 week
* Move the device_delete_all_children() function from usb_util.chselasky2011-11-191-7/+2
| | | | | | | | 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
* In r225931 I've missed the only other driver using the pointer returnedmarius2011-11-011-4/+12
| | | | | | | | | | | | | by rman_get_virtual(9) to access device registers sparc64 currently cares about. Ideally ata(4) should just be converted to access these using bus_space(9) read/write functions instead as there's really no reason to do it the former way. However, this part of ata-siliconimage.c should go away in favor of siis(4) sooner or later anyway and I don't have the hardware to actually test the SX4 bits of ata-promise.c. Also ideally the other architectures should also properly handle the BUS_SPACE_MAP_LINEAR flag of bus_space_map(9) so this code wouldn't need to be #ifdef'ed.
* Some dmesg cosmetics:mav2011-10-241-3/+15
| | | | | | - for the legacy PCI ATA channels move channel number out of the device description, same as it is for ahci(4), siis(4) and mvs(4); - add device description for the ISA ATA channels.
* - Use mutex to serialize index/data register pair usage, whenmav2011-07-221-3/+3
| | | | | | | | | | | | accessing SATA registers. Unserialized access under heavy load caused wrong speed reporting and potentially could cause device loss. - To free memory and other resources (including above), allocated during chipinit() method call on attach, add new chipdeinit() method, called during driver detach. Submitted by: Andrew Boyer <aboyer@averesystems.com> (initial version) Approved by: re (kib) MFC after: 1 week
* Set of legacy mode SATA enchancements:mav2010-10-181-0/+1
| | | | | | | | | | | | - Implement proper combined mode decoding for Intel controllers to properly identify SATA and PATA channels and associate ATA channels with SATA ports. This fixes wrong reporting and in some cases hard resets to wrong SATA ports. - Improve SATA registers support to handle hot-plug events and potentially interface errors. For ICH5/6300ESB chipsets these registers accessible via PCI config space. For later ones they may be accessible via PCI BAR(5). - For controllers not generating interrupts on hot-plug events, implement periodic status polling. Use it to detect hot-plug on Intel and VIA controllers. Same probably could also be used for Serverworks and SIS.
* Make legacy ATA emulation detection more strict. This should fix falsemav2010-07-161-1/+2
| | | | | | | positive legacy detection and attach failure/panic for Marvell 88SX6141 controller and potentially some others. PR: kern/145064
* Improve interrupt setup errors handling.mav2010-07-161-1/+7
|
* Report ATA/SATA channel number to NewBus at location string.mav2010-05-221-0/+11
|
* Improve output for controllers that doesn't report SATA speed.mav2010-02-221-4/+8
|
* Add support for SATA part of Marvell 88SE912x controllers to ahci(4).mav2010-01-261-0/+1
| | | | | | | | | Limit early revisions from 6Gb/s to 3Gb/s by default, or they negotiate only 1.5Gbps, when 3Gb/s devices connected. Add dummy driver for PATA part of these controllers, preventing generic driver attach them. It causes system freeze when SATA controller used after PATA was touched.
* MFp4:mav2009-12-061-45/+23
| | | | | | | | | | | | | | | | | | Introduce ATA_CAM kernel option, turning ata(4) controller drivers into cam(4) interface modules. When enabled, this options deprecates all ata(4) peripheral drivers (ad, acd, ...) and interfaces and allows cam(4) drivers (ada, cd, ...) and interfaces to be natively used instead. As side effect of this, ata(4) mode setting code was completely rewritten to make controller API more strict and permit above change. While doing this, SATA revision was separated from PATA mode. It allows DMA-incapable SATA devices to operate and makes hw.ata.atapi_dma tunable work again. Also allow ata(4) controller drivers (except some specific or broken ones) to handle larger data transfers. Previous constraint of 64K was artificial and is not really required by PCI ATA BM specification or hardware. Submitted by: nwitehorn (powerpc part)
* Do not ignore device interrupt if bus mastering is still active. It ismav2009-12-051-2/+1
| | | | | | | | | | | normal in case of media read error and some ATAPI cases, when transfer size is unknown beforehand. PCI ATA BM specification tells that in case of such underrun driver should just manually stop DMA engine. DMA engine should same time guarantie that all bus mastering transfers completed at the moment of driver reads interrupt flag asserted. This change should fix interrupt storms and command timeouts in many cases. PR: kern/103602, sparc64/121539, kern/133122, kern/139654
* Change the way in which AHCI+PATA combined controllers, such as JMicronmav2009-11-161-99/+158
| | | | | | | | | | | | | | and Marvell handled. Instead of trying to attach two different drivers to single device, wrapping each call, make one of them (atajmicron, atamarvell) attach do device solely, but create child device for AHCI driver, passing it all required resources. It is quite easy, as none of resources are shared, except IRQ. As result, it: - makes drivers operation more independent and straitforward, - allows to use new ahci(4) driver with such devices, adding support for new features, such as PMP and NCQ, same time keeping legacy PATA support, - will allow to just drop old ataahci driver, when it's time come.
* MFp4:mav2009-10-311-1/+1
| | | | | | | | - Remove most of direct relations between ATA(4) peripherial and controller levels. It makes logic more transparent and is a mandatory step to wrap ATA(4) controller level into ATA-native CAM SIM. - Tune AHCI and SATA2 SiI drivers memory allocation a bit to allow bigger I/O transaction sizes without additional cost.
* Add experimental support for SATA interface power management.mav2009-04-291-0/+3
| | | | | | | | | | | | | | | | | | Feature is controlled by hint.ata.X.pm_level tunable: 0 - PM disabled, old behaviour, default. 1 - device is allowed to initiate PM state change, host is passive. 2 - host initiates PARTIAL state transition every time port is idle. 3 - host initiates SLUMBER state transition every time port is idle. PARTIAL state has up to 100us (50us for me) wakeup latency, but for my ICH8M saves 0.5W of power per drive. SLUMBER state has up to 10ms (3.5ms for me) wakeup latency, but saves 0.8W of power. Modes 2 and 3 are implemented only for AHCI driver now. Interface power management is incompatible with device presence detection (host receives no signal from drive, so unable to monitor it), so later is disabled when PM is used.
* - Give generic AHCI driver lower priority than device-specific drivers.jkim2009-04-271-3/+3
| | | | - Consistently use BUS_PROBE_GENERIC instead of -100.
* Reduce code duplication and excessive pci_get_slot() calls.jkim2009-04-271-10/+10
| | | | Reviewed by: mav
* Reduce excessive pci_get_devid() and pci_get_revid() callsjkim2009-04-271-4/+8
| | | | on the same PCI device while device probing.
* Integrate user/mav/ata branch:mav2009-03-301-1/+14
| | | | | | | | | | | Add ch_suspend/ch_resume methods for PCI controllers and implement them for AHCI. Refactor AHCI channel initialization according to it. Fix Port Multipliers operation. It is far from perfect yet, but works now. Tested with JMicron JMB363 AHCI + SiI 3726 PMP pair. Previous version was also tested with SiI 4726 PMP. Hardware sponsored by: Vitsch Electronics / VEHosting.nl
* Add type specific suspend/resume ata channel functions. Add checks to avoidmav2009-03-091-2/+24
| | | | | crash on detached channel resume. Add placeholder for possible type-specific suspend/resume routines.
* Use channel driver's attach/detach routines instead of ata_attach()/mav2009-02-191-2/+8
| | | | | | ata_detach() to implement IOCATAATTACH/IOCATADETACH ioctls. This will permit channel drivers to properly shutdown port hardware on channel detach and init it on attach.
* Quite mechanical ch_detach implementations for all atapci subdrivers.mav2009-02-191-0/+22
| | | | Some dmainit call fixes for previous commit.
* As soon as they called in only same one place (ata_pcichannel_attach()),mav2009-02-181-9/+9
| | | | | | | | join allocate() and dmainit() atapci subdriver's channel initialization methods into single ch_attach() method. As opposite to ch_attach() add new ch_detach() method to deallocate/disable channel.
* Make ch->dma.free() called symmetrically to ch->dma.alloc().mav2009-02-181-3/+0
|
* Give atapci knowledge about set of implemented AHCI ports. It is possiblemav2009-02-161-0/+3
| | | | | | to not allocate them after the recent ata channels enumeration changes. It allows to save some resources, not bother user with unexisting hardware and not check unimplemented ports status on every interrupt.
* Add initial single-vector MSI support into atapci driver.mav2009-02-151-4/+14
| | | | | | | Works fine with AHCI and theoretically other MSI capable devices. At this moment support disabled by default. To enable it, set "hint.atapci.X.msi=1" device hint.
* DEVICE_PROBE(9) claims that we must not initialize softc on probe stage.mav2009-02-141-20/+15
| | | | | | | | Move channel softc initialization from ata_XXX_probe() to ata_XXX_attach(). Instead of calculating ata channel number as position in child device list, pass it's real number directly from controller probe routine using ivars. It is simpler and IMHO more correct.
* Call ata_legacy() only once on attach and save it's result. Scanning PCImav2008-12-161-11/+19
| | | | | | configuration registers (which are not going to change) on every interrupt looks expensive, especially when interrupt is shared. Profiling shows me 3% of time spent by atapci0 on pure network load due to IRQ sharing with em0.
* This is the roumored ATA modulerisation works, and it needs a little ↵sos2008-10-091-157/+211
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | explanation. If you just config KERNEL as usual there should be no apparent changes, you'll get all chipset support code compiled in. However there is now a way to only compile in code for chipsets needed on a pr vendor basis. ATA now has the following "device" entries: atacore: ATA core functionality, always needed for any ATA setup atacard: CARDBUS support atacbus: PC98 cbus support ataisa: ISA bus support atapci: PCI bus support only generic chipset support. ataahci: AHCI support, also pulled in by some vendor modules. ataacard, ataacerlabs, ataadaptec, ataamd, ataati, atacenatek, atacypress, atacyrix, atahighpoint, ataintel, ataite, atajmicron, atamarvell, atamicron, atanational, atanetcell, atanvidia, atapromise, ataserverworks, atasiliconimage, atasis, atavia; Vendor support, ie atavia for VIA chipsets atadisk: ATA disk driver ataraid: ATA softraid driver atapicd: ATAPI cd/dvd driver atapifd: ATAPI floppy/flashdisk driver atapist: ATAPI tape driver atausb: ATA<>USB bridge atapicam: ATA<>CAM bridge This makes it possible to config a kernel with just VIA chipset support by having the following ATA lines in the kernel config file: device atacore device atapci device atavia And then you need the atadisk, atapicd etc lines in there just as usual. If you use ATA as modules loaded at boot there is few changes except the rename of the "ata" module to "atacore", things looks just as usual. However under atapci you now have a whole bunch of vendor specific drivers, that you can kldload individually depending on you needs. Drivers have the same names as used in the kernel config explained above.
* Cleanup the AHCI code a bit.sos2008-09-181-2/+27
| | | | | | Add suspend/resume for AHCI, general methods added. Inspired by: Andrey V. Elsukov
* Rearrange how to call dma.alloc() so that we have resources alloc'd when ↵sos2008-06-111-6/+1
| | | | need but also late enough to know how many to create.
* Add HW level support for the Adaptec 1420SA controller.sos2008-04-211-0/+5
|
* Go back to preallocating everything possible on init.sos2008-04-171-8/+8
| | | | | This avoids calling busdma in the request processing path which caused a traumatic performance degradation. Allocation has be postponed to after we know how many devices we possible can have on portmulitpliers to save some space.
* Dont call hw.status recursively.sos2008-04-121-1/+1
| | | | Spotted by: Marcel Moolenaar
* Add experimental support for SATA Port Multiplierssos2008-04-101-40/+41
| | | | | | | Support is working on the Silicon Image SiI3124/3132. Support is working on some AHCI chips but far from all. Remember this is WIP, so test reports and (constructive) suggestions are welcome!
* Add generic support for chipsets that say they support AHCI. This should ↵sos2007-11-181-2/+37
| | | | | | | catch new chipsets that we dont know but that we should support. Add a few new PCI id's. Misc cleanups.
* Fix treating some modern chips (mem mapped) as legacy devices.sos2007-10-261-1/+2
|
* o break newbus api: add a new argument of type driver_filter_t topiso2007-02-231-3/+7
| | | | | | | | | | | | | 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@
* Try again with supporting AHCI chipsets with partly implemented ports.sos2007-02-211-2/+5
|
* Add support for chipsets that has NULL'd BAR's for legacy ports.sos2007-02-171-9/+9
| | | | | | | This allows DMA to be used on a fine little geode system I got here and most like on lots of older systems like that. HW donated by: Paul Ghering
* Add support for the NetCell NC3000/5000 series SATA RAID cards.rink2007-02-031-0/+4
| | | | | | Reviewed by: sos Approved by: imp (mentor) MFC after: 1 week
OpenPOWER on IntegriCloud