Parent Directory
|
Revision Log
| Links to HEAD: | (view) (download) (annotate) |
| Sticky Revision: |
ata(4): Release the ioport resource if device initialization fails PR: 251346 Submitted by: janm@transactionware.com MFC after: 1 week
ata: clean up empty lines in .c and .h files
Remove sparc64 kernel support Remove all sparc64 specific files Remove all sparc64 ifdefs Removee indireeect sparc64 ifdefs
sys/dev: further adoption of SPDX licensing ID tags. 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.
Convert rman to use rman_res_t instead of u_long 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 PCI 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 PCI 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) related 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 in 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. - 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 it 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-8
Rename device_delete_all_children() into device_delete_children(). Suggested by: jhb @ and marius @ MFC after: 1 week
Move the device_delete_all_children() function from usb_util.c 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 returned 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: - 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, when 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: - 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 false positive legacy detection and attach failure/panic for Marvell 88SX6141 controller and potentially some others. PR: kern/145064
Improve interrupt setup errors handling.
Report ATA/SATA channel number to NewBus at location string.
Improve output for controllers that doesn't report SATA speed.
Add support for SATA part of Marvell 88SE912x controllers to ahci(4). 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: 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 is 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 JMicron 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: - 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. 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. - Consistently use BUS_PROBE_GENERIC instead of -100.
Reduce code duplication and excessive pci_get_slot() calls. Reviewed by: mav
Reduce excessive pci_get_devid() and pci_get_revid() calls on the same PCI device while device probing.
Integrate user/mav/ata branch: 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 avoid 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()/ 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. Some dmainit call fixes for previous commit.
As soon as they called in only same one place (ata_pcichannel_attach()), 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().
Give atapci knowledge about set of implemented AHCI ports. It is possible 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. 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. 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 PCI 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 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. 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 need but also late enough to know how many to create.
Add HW level support for the Adaptec 1420SA controller.
Go back to preallocating everything possible on init. 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. Spotted by: Marcel Moolenaar
Add experimental support for SATA Port Multipliers 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 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.
o break newbus api: add a new argument of type driver_filter_t to 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.
Add support for chipsets that has NULL'd BAR's for legacy ports. 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. Reviewed by: sos Approved by: imp (mentor) MFC after: 1 week
Remove various bits of conditional Alpha code and fixup a few comments.
Add support for the JMicron JMB363 dual SATA + single PATA controller. Documentation and HW kindly provided by JMicron.
Unbreak dump on legacy systems. Needs a more clean solution but that is more intrusive and can wait 'til after 6.1
Add support for the JMicron JMB360 SATAII controller. Thanks to JMicron for providing needed info. HW donated by: Ralf Folkerts
Do not test for DMA status on legacy ATA devices. This has the unfortunate side effect that legacy ATA controllers at irq14 and irq15 cannot share interrupts with anything else without major problems. This fixes the ATAPI DMA problems some systems/devices have seen.
Whitespace cleanup.
Add support for using DMA on dump, greatly speeds up the dump process. Add dump support in ataraid.
Get rid of the advertising clause in the copyright.
Change the probes in ATA to return a negative value on success. This allows other driver to take over if needed during probe, and allows me to distribute new drivers as modules.
Add initial support for the Marvell 88SX[56]0[48][01] series of SATA chips. Hardware donated by: Matthew Jacob Hardware donated by: Y!
Normalize a significant number of kernel malloc type names: - Prefer '_' to ' ', as it results in more easily parsed results in memory monitoring tools such as vmstat. - Remove punctuation that is incompatible with using memory type names as file names, such as '/' characters. - Disambiguate some collisions by adding subsystem prefixes to some memory types. - Generally prefer lower case to upper case. - If the same type is defined in multiple architecture directories, attempt to use the same name in additional cases. Not all instances were caught in this change, so more work is required to finish this conversion. Similar changes are required for UMA zone names.
Add support for the ATI IXP[234]00 series chipsets. HW donated by: sentex
Use the presence of ctlr->dmainit instead of r_res1 to find out when to initialise DMA.
Cleanup comments
Reshape the dma code to be a bit more flexible so it can cope with new HW that has new and different demands. Fix a few nits in former commit in this cleanup crusade. Sponsored by: pair.com
Update on the last commit, the dma* funciton needs to be called with a channel device, not an ata device, or we'll be out of luck in reset/timeout where we dont have a device.
Take newbusification one step further, ie use the device_t more consequently all way through the code down the layers, instead of the mix'n'match that resulted from the conversion done earlier. Sponsored by: pair.com
Rearrange the way the reset code is called. Prepare for different looking controllers.
Cosmetics
Fix the bug that caused SATA disks on VIA etc to fail attach.
Use the ata_suspend/resume functions instaead of the bus_generic ones. This should unbreak suspend/resume. Contributed by: Wiktor Niesiobedzki
Generalise the SATA PHY handling code so it wont be duplicated for each SATA chip. Promise and Silicon Image are the current candidates for this.
Add support for controllers that doesn't have the usual taskfile layout. No functional changes.
Add firstshot support for Acer Labs Inc SATA parts Update ALi PATA support to handle ATA133 as well
Change the ata_* methods to use a channel device instead of a controller device. This helps when there is no controller parent to a channel (PPC port).
This is the much rumoured ATA mkIII update that I've been working on.
o ATA is now fully newbus'd and split into modules.
This means that on a modern system you just load "atapci and ata"
to get the base support, and then one or more of the device
subdrivers "atadisk atapicd atapifd atapist ataraid".
All can be loaded/unloaded anytime, but for obvious reasons you
dont want to unload atadisk when you have mounted filesystems.
o The device identify part of the probe has been rewritten to fix
the problems with odd devices the old had, and to try to remove
so of the long delays some HW could provoke. Also probing is done
without the need for interrupts, making earlier probing possible.
o SATA devices can be hot inserted/removed and devices will be created/
removed in /dev accordingly.
NOTE: only supported on controllers that has this feature:
Promise and Silicon Image for now.
On other controllers the usual atacontrol detach/attach dance is
still needed.
o Support for "atomic" composite ATA requests used for RAID.
o ATA RAID support has been rewritten and and now supports these
metadata formats:
"Adaptec HostRAID"
"Highpoint V2 RocketRAID"
"Highpoint V3 RocketRAID"
"Intel MatrixRAID"
"Integrated Technology Express"
"LSILogic V2 MegaRAID"
"LSILogic V3 MegaRAID"
"Promise FastTrak"
"Silicon Image Medley"
"FreeBSD PseudoRAID"
o Update the ioctl API to match new RAID levels etc.
o Update atacontrol to know about the new RAID levels etc
NOTE: you need to recompile atacontrol with the new sys/ata.h,
make world will take care of that.
NOTE2: that rebuild is done differently from the old system as
the rebuild is now done piggybacked on read requests to the
array, so atacontrol simply starts a background "dd" to rebuild
the array.
o The reinit code has been worked over to be much more robust.
o The timeout code has been overhauled for races.
o Support of new chipsets.
o Lots of fixes for bugs found while doing the modulerization and
reviewing the old code.
Missing or changed features from current ATA:
o atapi-cd no longer has support for ATAPI changers. Todays its
much cheaper and alot faster to copy those CD images to disk
and serve them from there. Besides they dont seem to be made
anymore, maybe for that exact reason.
o ATA RAID can only read metadata from all the above metadata formats,
not write all of them (Promise and Highpoint V2 so far). This means
that arrays can be picked up from the BIOS, but they cannot be
created from FreeBSD. There is more to it than just the missing
write metadata support, those formats are not unique to a given
controller like Promise and Highpoint formats, instead they exist
for several types, and even worse, some controllers can have
different formats and its impossible to tell which one.
The outcome is that we cannot reliably create the metadata of those
formats and be sure the controller BIOS will understand it.
However write support is needed to update/fail/rebuild the arrays
properly so it sits fairly high on the TODO list.
o So far atapicam is not supported with these changes. When/if this
will change is up to the maintainer of atapi-cam so go there for
questions.
HW donated by: Webveveriet AS
HW donated by: Frode Nordahl
HW donated by: Yahoo!
HW donated by: Sentex
Patience by: Vife and my boys (and even the cats)
Add support for the ITE IT8212F controller. HW donated by: Yahoo!
Fix the PC98 lockups on boot. The interchannel locking for PC98 needed to be updated to match the rest of the locking in ATA.
Rearrange the order of I/O's in dma-start/stop, some chipsets are very picky on the order of this, especially in error situations.
DONT PANIC Only call dmainit() if there is a valid busmaster resource.
Change the order of ata_dmainit/ata_allocate in preparation of supporting new chipsets where this is needed.
Try to narrow down the race window on HW that does not have ways to poll for which channel actually pulled the irq line.
Increase robustness of SATA handling.
Fix Sii3114 support.
Do at better job at unit numbering.
Use pci_get_progif to decide if this is one of the primary/secondary channels. This also work when PCI native mode has been selected (patch for /sys/dev/pci/pci.c needed for that) since pci_get_progif uses the saved value for progif, not the one stored after we may have changed from legacy mode to native PCI mode.
Try the simplify determining what is ata0 and ata1. Remove the PCI native addressing code, it eed to be run before we even have control in the ATA driver and should be moved to the pci code.
Make the test for ATA PCI legacy addressing mode more robust. Add code (currently ifdef'd out) to allow ATA PCI native addressing. Fix the altio offset for ATA PCI devices.
Do not pre-allocate resources for BAR's on ATA MASTERDEV's thats on the standard ATA primary and secondary addresses. Reintroduce the size 1 ALTIO space so that we can have both ATA and floppies back working.
Add support for the Promise command sequencer present on all modern Promise controllers (PDC203** PDC206**). This also adds preliminary support for the Promise SX4/SX4000 but *only* as a "normal" Promise ATA controller (ATA RAID's are supported though but only RAID0, RAID1 and RAID0+1). This cuts off yet another 5-8% of the command overhead on promise controllers, making them the fastest we have ever had support for. Work is now continuing to add support for this in ATA RAID, to accellerate ATA RAID quite a bit on these controllers, and especially the SX4/SX4000 series as they have quite a few tricks in there.. This commit also adds a few fixes to the SATA code needed for proper support.
Convert callers to the new bus_alloc_resource_any(9) API. Submitted by: Mark Santcroos <marks@ripe.net> Reviewed by: imp, dfr, bde
Add support for detaching PCI controllers. This adds support for cardbus ATA/SATA controllers. I get roughly the same transfer speeds as on true PCI controllers. Nice to be able to add a couble of "real" disks to a laptop :)
Check both PORTEN and MEMEN for enabled HW.
Use UMA instead of plain malloc for getting ATA request storage. This gives +10% performance on simple tests, so definitly worth it. A few percent more could be had by not using M_ZERO'd alloc's, but we then need to clear fields all over the place to be safe, and that was deemed not worth the trouble (and it makes life dangerous).
Overhaul of the timeout/reinit framework. This should clear up most of the leftovers from the old version that really doesn't work anymore. Add a reset function for host-end of the ATA channel. This is needed for the SiI3112 in order to whack it back to reality if a device locks up the SATA interface (thereby preventing that we can reset the device). The result is that ATA now recovers from the timeouts that happens with the SiI3112A and more or less all disks based on old PATA electronics with a Marvell PATA->SATA converter. This includes lots of the popular SATA dongles and the WDC Raptor disks..
Add back the national support, this was removed by accident earlier.
This form allows you to request diffs between any two revisions of this file. For each of the two "sides" of the diff, enter a numeric revision.
| ViewVC Help | |
| Powered by ViewVC 1.1.27 |