/* $NetBSD: cache_mipsNN.h,v 1.6 2020/07/26 08:08:41 simonb Exp $ */ /* * Copyright 2002 Wasabi Systems, Inc. * All rights reserved. * * Written by Simon Burge for Wasabi Systems, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed for the NetBSD Project by * Wasabi Systems, Inc. * 4. The name of Wasabi Systems, Inc. may not be used to endorse * or promote products derived from this software without specific prior * written permission. * * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #ifndef _MIPS_CACHE_MIPSNN_H_ #define _MIPS_CACHE_MIPSNN_H_ void mipsNN_cache_init(uint32_t, uint32_t); void mipsNN_picache_sync_all(void); void mipsNN_picache_sync_range(register_t, vsize_t); void mipsNN_picache_sync_range_index(vaddr_t, vsize_t); void mipsNN_pdcache_wbinv_all(void); void mipsNN_pdcache_wbinv_range_index(vaddr_t, vsize_t); void mipsNN_sdcache_wbinv_all(void); void mipsNN_sdcache_wbinv_range_index(vaddr_t, vsize_t); #endif /* _MIPS_CACHE_MIPSNN_H_ */ sage (Collapse)Author 2021-08-07Merge thorpej-cfargs2.thorpej 2021-06-13Don't crash on detach where interlock == NULL.mlelstv 2021-04-24Merge thorpej-cfargs branch:thorpej Simplify and make extensible the config_search() / config_found() / config_attach() interfaces: rather than having different variants for which arguments you want pass along, just have a single call that takes a variadic list of tag-value arguments. Adjust all call sites: - Simplify wherever possible; don't pass along arguments that aren't actually needed. - Don't be explicit about what interface attribute is attaching if the device only has one. (More simplification.) - Add a config_probe() function to be used in indirect configuiration situations, making is visibly easier to see when indirect config is in play, and allowing for future change in semantics. (As of now, this is just a wrapper around config_match(), but that is an implementation detail.) Remove unnecessary or redundant interface attributes where they're not needed. There are currently 5 "cfargs" defined: - CFARG_SUBMATCH (submatch function for direct config) - CFARG_SEARCH (search function for indirect config) - CFARG_IATTR (interface attribte) - CFARG_LOCATORS (locators array) - CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles) ...and a sentinel value CFARG_EOL. Add some extra sanity checking to ensure that interface attributes aren't ambiguous. Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark ports to associate those device handles with device_t instance. This will trickle trough to more places over time (need back-end for pre-OFW Sun OBP; any others?). 2020-05-24Fix races in sdmmc tasks and teach ld@sdmmc to abort xfers on detach.riastradh - Teach sdmmc_add_task to queue it only if not already queued. - Remove now-redundant logic to avoid repeated queueing elsewhere. - Teach sdmmc_del_task to wait until task has completed. - Call sdmmc_del_task in various needful places. - Replace abuse of pcq by a lock and a tailq. (pcq is multi-producer, _single_-consumer, but there are potentially multiple consumers here and really only one producer.) - Teach ld_sdmmc to abort xfers on detach. (Mechanism is kinda kludgey but it'll do for now; any effort one is tempted to spend overhauling this should be spent overhauling sdmmc to support proper asynchronous commands.) - Make sure ld_sdmmc_discard either returns failure or eventually calls ldenddiscard. XXX Currently ld_sdmmc_detach aborts xfers _before_ ldbegindetach has has committed to detaching or not. This is currently necessary to avoid a deadlock because ldbegindetach waits for xfers to drain -- which strikes me as wrong; ldbegindetach shouldn't wait for anything, and should only make the decision to commit to detaching or not so the caller can decide whether to abort xfers before we actually wait for them in ldenddetach. XXX pullup -- although this changes some kernel symbols (sdmmc_add_task and sdmmc_del_task), it shouldn't affect any existing modules; the only module that uses sdmmc is ld_sdmmc.kmod, which is `.if 0' in the build so there shouldn't be any of them floating around. 2019-10-28Add and use sdmmc_pause to avoid long-term busy waits.mlelstv Add sdio abort function. Additional error messages. Print parameters for SDIO devices. Minor cosmetics. 2019-10-23Add SDHC flags.hkenken + SDHC_FLAG_BROKEN_ADMA2_ZEROLEN Broken ADMA2 Zero length descriptor. Can't 64K Byte data transfer. + SDHC_FLAG_NO_1_8_V Support no 1.8V Supply. Disable UHS-I bus speed mode (SDR50, DDR50, SDR104). 2019-09-01From OpenBSD:mlelstv - support block length per function - add functions to read/write regions Decode (but not use) SDIO tuple in CIS. Fix locking. Add more SDIO defines (partially from version 3.0). 2018-11-06Increase kthread priority to PRI_SOFTBIO.jmcneill 2018-03-06correct whitespace in attach messagemlelstv 2017-02-17sdhc(4): hardware reset support for Intel eMMC controllernonaka 2015-12-22ignore timeouts for APP_CMD prefix as for the application command itself.mlelstv 2015-11-29Add some event counters to track transfer sizes.jmcneill 2015-08-09Send an explicit CMD12 (stop transmission) when there was an errormlelstv in multi-sector I/O. The SDHC spec has a complex flowchart describing when an explicit CMD12 is necessary, so we probably use it too often. 2015-08-09protect card detection with mutex.mlelstv 2015-08-03Add support for DDR50 transfer modes.jmcneill 2015-08-03use mutex locking for MP safety.mlelstv 2015-07-28Be more verbose about errors.mlelstv 2015-05-21sdmmc_task_thread isn't MPSAFE so instead of just wrapping the callbackjmcneill in KERNEL_LOCK/KERNEL_UNLOCK_ONE, remove KTHREAD_MPSAFE. While here, use PRI_BIO instead of PRI_NONE for the task thread priority. Since this is how all transfers are queued, and we have a 1 second timeout on the task being picked up off the queue (!), better not to rely on a PRI_NONE thread. 2015-05-20need to call lddone with splbio and kernel lock heldjmcneill 2015-02-27fix to simulate multi-segment dma transfer for pq3sdhc(4).nonaka 2014-11-16Replace callout_stop with callout_haltozaki-r In order to call callout_destroy for a callout safely, we have to ensure the function of the callout is not running and pending. To do so, we should use callout_halt, not callout_stop. Discussed with martin@ and riastradh@. 2014-03-19Add a driver for Realtek RTS5209/RTS5229 Card Reader.nonaka Ported from OpenBSD. 2013-10-12Pass the device name in, so we can debug what deferred drivers did not work.christos 2012-12-22We can't block our interrupt while sdmmc_detach_card is called, asjakllsch it can issue commands, and some host drivers have interrupt-driven command completion. Prevents assertion (or deadlock) upon detach of sdhc(4) with inserted card. 2012-12-22Revert sdmmc.c r1.18 (previous commit to this file).jakllsch It seems to have caused regressions to detaching drivers from cards at the appropriate time. DETACH_FORCE to sdmmc_card_detach really means the SD/SDIO card is gone, and can not be abused to mean that the host controller disappered. 2012-12-20Only use DETACH_FORCE as flags argument to sdmmc_card_detach when thejakllsch host controller has disappeared or is detaching. XXX should pass flags from sdmmc_detach through to the task thread ending to differentiate host controller disappearance from mere detachment. 2012-12-15It's also useful to compile-test before committing.jakllsch 2012-12-15When debugging, it's useful to know what exactly failed.jakllsch 2012-08-04Print 'Standard Function Interface Code" in sdmmc_print(), if not ↵kiyohara SD_IO_SFIC_NO_STANDARD. 2012-07-17Whitespace.skrll 2012-07-12If necessary, unload and destroy dmamap upon detach.jakllsch 2012-02-01Use "opt_sdmmc.h" for SDMMC_DEBUG, etc.matt 2012-01-26Print error if couldn't enable card.matt 2012-01-21fix my license notice.nonaka 2011-03-20if poll card detect is enabled, don't show "couldn't enable card".nonaka 2011-02-13- Don't switch MMC high-speed timing, if host controller isn't supported.nonaka - Only check EXT_CSD STRUCTURE version when CSD version is 3. - initialize width at sdmmc_function_alloc(). 2011-02-05Don't switch SD high-speed timing, if host controller isn't supported.nonaka 2010-10-07Fix read CIS. And pass to attach args the standard function interface code.kiyohara 2010-10-07Support High-Speed mode.kiyohara 2010-10-01Use DMA bounce buffer, if DMA buffer is making by multiple segments. A lotkiyohara of host controllers do not support to two or more segments. 2010-09-20Clear SMF_CARD_PRESENT, if failed to attach.kiyohara 2010-04-06- mention MMC SPI mode.nonaka - support SD 4bit bus width mode. 2009-04-21Added SD/MMC support from OpenBSD.nonaka tested on i386, amd64 at current-users ML by pgoyette@. tested on zaurus by myself.