__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<!DOCTYPE html>
<html lang="en" data-content_root="../">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Universal Flash Storage — The Linux Kernel documentation</title>
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="../_static/alabaster.css?v=3918102e" />
<script src="../_static/documentation_options.js?v=5929fcd5"></script>
<script src="../_static/doctools.js?v=9bcbadda"></script>
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="Driver for Western Digital WD7193, WD7197 and WD7296 SCSI cards" href="wd719x.html" />
<link rel="prev" title="tcm_qla2xxx Driver Notes" href="tcm_qla2xxx.html" />
<link rel="stylesheet" href="../_static/custom.css" type="text/css" />
</head><body>
<div class="document">
<div class="sphinxsidebar" role="navigation" aria-label="Main">
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="../index.html">
<img class="logo" src="../_static/logo.svg" alt="Logo of The Linux Kernel"/>
</a></p>
<h1 class="logo"><a href="../index.html">The Linux Kernel</a></h1>
<p class="blurb">6.18.50</p>
<search id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="Go" />
</form>
</div>
</search>
<script>document.getElementById('searchbox').style.display = "block"</script>
<p>
<h3 class="kernel-toc-contents">Contents</h3>
<input type="checkbox" class="kernel-toc-toggle" id = "kernel-toc-toggle" checked>
<label class="kernel-toc-title" for="kernel-toc-toggle"></label>
<div class="kerneltoc" id="kerneltoc">
<ul>
<li class="toctree-l1"><a class="reference internal" href="../process/development-process.html">Development process</a></li>
<li class="toctree-l1"><a class="reference internal" href="../process/submitting-patches.html">Submitting patches</a></li>
<li class="toctree-l1"><a class="reference internal" href="../process/code-of-conduct.html">Code of conduct</a></li>
<li class="toctree-l1"><a class="reference internal" href="../maintainer/index.html">Maintainer handbook</a></li>
<li class="toctree-l1"><a class="reference internal" href="../process/index.html">All development-process docs</a></li>
</ul>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../core-api/index.html">Core API</a></li>
<li class="toctree-l1"><a class="reference internal" href="../driver-api/index.html">Driver APIs</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../subsystem-apis.html">Subsystems</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../subsystem-apis.html#core-subsystems">Core subsystems</a></li>
<li class="toctree-l2"><a class="reference internal" href="../subsystem-apis.html#human-interfaces">Human interfaces</a></li>
<li class="toctree-l2"><a class="reference internal" href="../subsystem-apis.html#networking-interfaces">Networking interfaces</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../subsystem-apis.html#storage-interfaces">Storage interfaces</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="../filesystems/index.html">Filesystems in the Linux kernel</a></li>
<li class="toctree-l3"><a class="reference internal" href="../block/index.html">Block</a></li>
<li class="toctree-l3"><a class="reference internal" href="../cdrom/index.html">CD-ROM</a></li>
<li class="toctree-l3 current"><a class="reference internal" href="index.html">SCSI Subsystem</a></li>
<li class="toctree-l3"><a class="reference internal" href="../target/index.html">TCM Virtual Device</a></li>
<li class="toctree-l3"><a class="reference internal" href="../nvme/index.html">NVMe Subsystem</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../subsystem-apis.html#other-subsystems">Other subsystems</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../locking/index.html">Locking</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../process/license-rules.html">Licensing rules</a></li>
<li class="toctree-l1"><a class="reference internal" href="../doc-guide/index.html">Writing documentation</a></li>
<li class="toctree-l1"><a class="reference internal" href="../dev-tools/index.html">Development tools</a></li>
<li class="toctree-l1"><a class="reference internal" href="../dev-tools/testing-overview.html">Testing guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../kernel-hacking/index.html">Hacking guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../trace/index.html">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../fault-injection/index.html">Fault injection</a></li>
<li class="toctree-l1"><a class="reference internal" href="../livepatch/index.html">Livepatching</a></li>
<li class="toctree-l1"><a class="reference internal" href="../rust/index.html">Rust</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../admin-guide/index.html">Administration</a></li>
<li class="toctree-l1"><a class="reference internal" href="../kbuild/index.html">Build system</a></li>
<li class="toctree-l1"><a class="reference internal" href="../admin-guide/reporting-issues.html">Reporting issues</a></li>
<li class="toctree-l1"><a class="reference internal" href="../tools/index.html">Userspace tools</a></li>
<li class="toctree-l1"><a class="reference internal" href="../userspace-api/index.html">Userspace API</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../firmware-guide/index.html">Firmware</a></li>
<li class="toctree-l1"><a class="reference internal" href="../devicetree/index.html">Firmware and Devicetree</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../arch/index.html">CPU architectures</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../staging/index.html">Unsorted documentation</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../translations/index.html">Translations</a></li>
</ul>
</div>
<script type="text/javascript"> <!--
var sbar = document.getElementsByClassName("sphinxsidebar")[0];
let currents = document.getElementsByClassName("current")
if (currents.length) {
sbar.scrollTop = currents[currents.length - 1].offsetTop;
}
--> </script>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/scsi/ufs.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
</div>
</div>
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<section id="universal-flash-storage">
<h1>Universal Flash Storage<a class="headerlink" href="#universal-flash-storage" title="Link to this heading">¶</a></h1>
<section id="overview">
<h2>1. Overview<a class="headerlink" href="#overview" title="Link to this heading">¶</a></h2>
<p>Universal Flash Storage (UFS) is a storage specification for flash devices.
It aims to provide a universal storage interface for both
embedded and removable flash memory-based storage in mobile
devices such as smart phones and tablet computers. The specification
is defined by JEDEC Solid State Technology Association. UFS is based
on the MIPI M-PHY physical layer standard. UFS uses MIPI M-PHY as the
physical layer and MIPI Unipro as the link layer.</p>
<p>The main goals of UFS are to provide:</p>
<blockquote>
<div><ul>
<li><p>Optimized performance:</p>
<p>For UFS version 1.0 and 1.1 the target performance is as follows:</p>
<ul class="simple">
<li><p>Support for Gear1 is mandatory (rate A: 1248Mbps, rate B: 1457.6Mbps)</p></li>
<li><p>Support for Gear2 is optional (rate A: 2496Mbps, rate B: 2915.2Mbps)</p></li>
</ul>
<p>Future version of the standard,</p>
<ul class="simple">
<li><p>Gear3 (rate A: 4992Mbps, rate B: 5830.4Mbps)</p></li>
</ul>
</li>
<li><p>Low power consumption</p></li>
<li><p>High random IOPs and low latency</p></li>
</ul>
</div></blockquote>
</section>
<section id="ufs-architecture-overview">
<h2>2. UFS Architecture Overview<a class="headerlink" href="#ufs-architecture-overview" title="Link to this heading">¶</a></h2>
<p>UFS has a layered communication architecture which is based on SCSI
SAM-5 architectural model.</p>
<p>UFS communication architecture consists of the following layers.</p>
<section id="application-layer">
<h3>2.1 Application Layer<a class="headerlink" href="#application-layer" title="Link to this heading">¶</a></h3>
<blockquote>
<div><p>The Application layer is composed of the UFS command set layer (UCS),
Task Manager and Device manager. The UFS interface is designed to be
protocol agnostic, however SCSI has been selected as a baseline
protocol for versions 1.0 and 1.1 of the UFS protocol layer.</p>
<p>UFS supports a subset of SCSI commands defined by SPC-4 and SBC-3.</p>
<ul class="simple">
<li><dl class="simple">
<dt>UCS:</dt><dd><p>It handles SCSI commands supported by UFS specification.</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>Task manager:</dt><dd><p>It handles task management functions defined by the
UFS which are meant for command queue control.</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>Device manager:</dt><dd><p>It handles device level operations and device
configuration operations. Device level operations mainly involve
device power management operations and commands to Interconnect
layers. Device level configurations involve handling of query
requests which are used to modify and retrieve configuration
information of the device.</p>
</dd>
</dl>
</li>
</ul>
</div></blockquote>
</section>
<section id="ufs-transport-protocol-utp-layer">
<h3>2.2 UFS Transport Protocol (UTP) layer<a class="headerlink" href="#ufs-transport-protocol-utp-layer" title="Link to this heading">¶</a></h3>
<blockquote>
<div><p>The UTP layer provides services for
the higher layers through Service Access Points. UTP defines 3
service access points for higher layers.</p>
<ul class="simple">
<li><p>UDM_SAP: Device manager service access point is exposed to device
manager for device level operations. These device level operations
are done through query requests.</p></li>
<li><p>UTP_CMD_SAP: Command service access point is exposed to UFS command
set layer (UCS) to transport commands.</p></li>
<li><p>UTP_TM_SAP: Task management service access point is exposed to task
manager to transport task management functions.</p></li>
</ul>
<p>UTP transports messages through UFS protocol information unit (UPIU).</p>
</div></blockquote>
</section>
<section id="ufs-interconnect-uic-layer">
<h3>2.3 UFS Interconnect (UIC) Layer<a class="headerlink" href="#ufs-interconnect-uic-layer" title="Link to this heading">¶</a></h3>
<blockquote>
<div><p>UIC is the lowest layer of the UFS layered architecture. It handles
the connection between UFS host and UFS device. UIC consists of
MIPI UniPro and MIPI M-PHY. UIC provides 2 service access points
to upper layer:</p>
<ul class="simple">
<li><p>UIC_SAP: To transport UPIU between UFS host and UFS device.</p></li>
<li><p>UIO_SAP: To issue commands to Unipro layers.</p></li>
</ul>
</div></blockquote>
</section>
</section>
<section id="ufshcd-overview">
<h2>3. UFSHCD Overview<a class="headerlink" href="#ufshcd-overview" title="Link to this heading">¶</a></h2>
<p>The UFS host controller driver is based on the Linux SCSI Framework.
UFSHCD is a low-level device driver which acts as an interface between
the SCSI Midlayer and PCIe-based UFS host controllers.</p>
<p>The current UFSHCD implementation supports the following functionality:</p>
<section id="ufs-controller-initialization">
<h3>3.1 UFS controller initialization<a class="headerlink" href="#ufs-controller-initialization" title="Link to this heading">¶</a></h3>
<blockquote>
<div><p>The initialization module brings the UFS host controller to active state
and prepares the controller to transfer commands/responses between
UFSHCD and UFS device.</p>
</div></blockquote>
</section>
<section id="utp-transfer-requests">
<h3>3.2 UTP Transfer requests<a class="headerlink" href="#utp-transfer-requests" title="Link to this heading">¶</a></h3>
<blockquote>
<div><p>Transfer request handling module of UFSHCD receives SCSI commands
from the SCSI Midlayer, forms UPIUs and issues the UPIUs to the UFS Host
controller. Also, the module decodes responses received from the UFS
host controller in the form of UPIUs and intimates the SCSI Midlayer
of the status of the command.</p>
</div></blockquote>
</section>
<section id="ufs-error-handling">
<h3>3.3 UFS error handling<a class="headerlink" href="#ufs-error-handling" title="Link to this heading">¶</a></h3>
<blockquote>
<div><p>Error handling module handles Host controller fatal errors,
Device fatal errors and UIC interconnect layer-related errors.</p>
</div></blockquote>
</section>
<section id="scsi-error-handling">
<h3>3.4 SCSI Error handling<a class="headerlink" href="#scsi-error-handling" title="Link to this heading">¶</a></h3>
<blockquote>
<div><p>This is done through UFSHCD SCSI error handling routines registered
with the SCSI Midlayer. Examples of some of the error handling commands
issues by the SCSI Midlayer are Abort task, LUN reset and host reset.
UFSHCD Routines to perform these tasks are registered with
SCSI Midlayer through .eh_abort_handler, .eh_device_reset_handler and
.eh_host_reset_handler.</p>
</div></blockquote>
<p>In this version of UFSHCD, Query requests and power management
functionality are not implemented.</p>
</section>
</section>
<section id="bsg-support">
<h2>4. BSG Support<a class="headerlink" href="#bsg-support" title="Link to this heading">¶</a></h2>
<p>This transport driver supports exchanging UFS protocol information units
(UPIUs) with a UFS device. Typically, user space will allocate
<code class="xref c c-struct broken_xref docutils literal notranslate"><span class="pre">struct</span> <span class="pre">ufs_bsg_request</span></code> and <code class="xref c c-struct broken_xref docutils literal notranslate"><span class="pre">struct</span> <span class="pre">ufs_bsg_reply</span></code> (see ufs_bsg.h) as
request_upiu and reply_upiu respectively. Filling those UPIUs should
be done in accordance with JEDEC spec UFS2.1 paragraph 10.7.
<em>Caveat emptor</em>: The driver makes no further input validations and sends the
UPIU to the device as it is. Open the bsg device in /dev/ufs-bsg and
send SG_IO with the applicable sg_io_v4:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>io_hdr_v4.guard = 'Q';
io_hdr_v4.protocol = BSG_PROTOCOL_SCSI;
io_hdr_v4.subprotocol = BSG_SUB_PROTOCOL_SCSI_TRANSPORT;
io_hdr_v4.response = (__u64)reply_upiu;
io_hdr_v4.max_response_len = reply_len;
io_hdr_v4.request_len = request_len;
io_hdr_v4.request = (__u64)request_upiu;
if (dir == SG_DXFER_TO_DEV) {
io_hdr_v4.dout_xfer_len = (uint32_t)byte_cnt;
io_hdr_v4.dout_xferp = (uintptr_t)(__u64)buff;
} else {
io_hdr_v4.din_xfer_len = (uint32_t)byte_cnt;
io_hdr_v4.din_xferp = (uintptr_t)(__u64)buff;
}
</pre></div>
</div>
<p>If you wish to read or write a descriptor, use the appropriate xferp of
sg_io_v4.</p>
<p>The userspace tool that interacts with the ufs-bsg endpoint and uses its
UPIU-based protocol is available at:</p>
<blockquote>
<div><p><a class="reference external" href="https://github.com/westerndigitalcorporation/ufs-tool">https://github.com/westerndigitalcorporation/ufs-tool</a></p>
</div></blockquote>
<p>For more detailed information about the tool and its supported
features, please see the tool’s README.</p>
<p>UFS specifications can be found at:</p>
<ul class="simple">
<li><p>UFS - <a class="reference external" href="http://www.jedec.org/sites/default/files/docs/JESD220.pdf">http://www.jedec.org/sites/default/files/docs/JESD220.pdf</a></p></li>
<li><p>UFSHCI - <a class="reference external" href="http://www.jedec.org/sites/default/files/docs/JESD223.pdf">http://www.jedec.org/sites/default/files/docs/JESD223.pdf</a></p></li>
</ul>
</section>
<section id="ufs-reference-clock-frequency-configuration">
<h2>5. UFS Reference Clock Frequency configuration<a class="headerlink" href="#ufs-reference-clock-frequency-configuration" title="Link to this heading">¶</a></h2>
<p>Devicetree can define a clock named “ref_clk” under the UFS controller node
to specify the intended reference clock frequency for the UFS storage
parts. ACPI-based system can specify the frequency using ACPI
Device-Specific Data property named “ref-clk-freq”. In both ways the value
is interpreted as frequency in Hz and must match one of the values given in
the UFS specification. UFS subsystem will attempt to read the value when
executing common controller initialization. If the value is available, UFS
subsystem will ensure the bRefClkFreq attribute of the UFS storage device is
set accordingly and will modify it if there is a mismatch.</p>
</section>
</section>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
©The kernel development community.
|
Powered by <a href="https://www.sphinx-doc.org/">Sphinx 8.1.3</a>
& <a href="https://alabaster.readthedocs.io">Alabaster 0.7.16</a>
|
<a href="../_sources/scsi/ufs.rst.txt"
rel="nofollow">Page source</a>
</div>
</body>
</html>| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| scsi_transport_srp | Folder | 0755 |
|
|
| 53c700.html | File | 14.24 KB | 0644 |
|
| BusLogic.html | File | 40.51 KB | 0644 |
|
| FlashPoint.html | File | 17.51 KB | 0644 |
|
| NinjaSCSI.html | File | 14.65 KB | 0644 |
|
| aacraid.html | File | 24.06 KB | 0644 |
|
| advansys.html | File | 22.78 KB | 0644 |
|
| aha152x.html | File | 17.97 KB | 0644 |
|
| aic79xx.html | File | 39.05 KB | 0644 |
|
| aic7xxx.html | File | 39.95 KB | 0644 |
|
| arcmsr_spec.html | File | 47.74 KB | 0644 |
|
| bfa.html | File | 13.08 KB | 0644 |
|
| bnx2fc.html | File | 11.76 KB | 0644 |
|
| cxgb3i.html | File | 12.03 KB | 0644 |
|
| dc395x.html | File | 13.48 KB | 0644 |
|
| dpti.html | File | 12.29 KB | 0644 |
|
| g_NCR5380.html | File | 12.35 KB | 0644 |
|
| hpsa.html | File | 14.53 KB | 0644 |
|
| hptiop.html | File | 19.61 KB | 0644 |
|
| index.html | File | 13.43 KB | 0644 |
|
| libsas.html | File | 27.98 KB | 0644 |
|
| link_power_management_policy.html | File | 8.92 KB | 0644 |
|
| lpfc.html | File | 11.34 KB | 0644 |
|
| megaraid.html | File | 11.93 KB | 0644 |
|
| ncr53c8xx.html | File | 115.22 KB | 0644 |
|
| ppa.html | File | 8.8 KB | 0644 |
|
| qlogicfas.html | File | 11.85 KB | 0644 |
|
| scsi-changer.html | File | 16.8 KB | 0644 |
|
| scsi-generic.html | File | 13.62 KB | 0644 |
|
| scsi-parameters.html | File | 11.93 KB | 0644 |
|
| scsi.html | File | 10.65 KB | 0644 |
|
| scsi_eh.html | File | 36.79 KB | 0644 |
|
| scsi_fc_transport.html | File | 38.88 KB | 0644 |
|
| scsi_mid_low_api.html | File | 71.01 KB | 0644 |
|
| sd-parameters.html | File | 9.52 KB | 0644 |
|
| smartpqi.html | File | 11.98 KB | 0644 |
|
| st.html | File | 41.47 KB | 0644 |
|
| sym53c500_cs.html | File | 9.4 KB | 0644 |
|
| sym53c8xx_2.html | File | 66.19 KB | 0644 |
|
| tcm_qla2xxx.html | File | 9.28 KB | 0644 |
|
| ufs.html | File | 17.85 KB | 0644 |
|
| wd719x.html | File | 9.04 KB | 0644 |
|