1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>ata_slave_link_init</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="libATA Developer's Guide"><link rel="up" href="libataExt.html" title="Chapter&#160;4.&#160;libata Library"><link rel="prev" href="API-ata-host-alloc-pinfo.html" title="ata_host_alloc_pinfo"><link rel="next" href="API-ata-host-start.html" title="ata_host_start"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><span class="phrase">ata_slave_link_init</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-ata-host-alloc-pinfo.html">Prev</a>&#160;</td><th width="60%" align="center">Chapter&#160;4.&#160;libata Library</th><td width="20%" align="right">&#160;<a accesskey="n" href="API-ata-host-start.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-ata-slave-link-init"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>ata_slave_link_init &#8212; 
2     initialize slave link
3 </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">ata_slave_link_init </b>(</code></td><td>struct ata_port * <var class="pdparam">ap</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer">&#160;</div></div></div><div class="refsect1"><a name="idp1123840868"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>ap</code></em></span></dt><dd><p>
4     port to initialize slave link for
5    </p></dd></dl></div></div><div class="refsect1"><a name="idp1123842452"></a><h2>Description</h2><p>
6   Create and initialize slave link for <em class="parameter"><code>ap</code></em>.  This enables slave
7   link handling on the port.
8   </p><p>
9
10   In libata, a port contains links and a link contains devices.
11   There is single host link but if a PMP is attached to it,
12   there can be multiple fan-out links.  On SATA, there's usually
13   a single device connected to a link but PATA and SATA
14   controllers emulating TF based interface can have two - master
15   and slave.
16   </p><p>
17
18   However, there are a few controllers which don't fit into this
19   abstraction too well - SATA controllers which emulate TF
20   interface with both master and slave devices but also have
21   separate SCR register sets for each device.  These controllers
22   need separate links for physical link handling
23   (e.g. onlineness, link speed) but should be treated like a
24   traditional M/S controller for everything else (e.g. command
25   issue, softreset).
26   </p><p>
27
28   slave_link is libata's way of handling this class of
29   controllers without impacting core layer too much.  For
30   anything other than physical link handling, the default host
31   link is used for both master and slave.  For physical link
32   handling, separate <em class="parameter"><code>ap</code></em>-&gt;slave_link is used.  All dirty details
33   are implemented inside libata core layer.  From LLD's POV, the
34   only difference is that prereset, hardreset and postreset are
35   called once more for the slave link, so the reset sequence
36   looks like the following.
37   </p><p>
38
39   prereset(M) -&gt; prereset(S) -&gt; hardreset(M) -&gt; hardreset(S) -&gt;
40   softreset(M) -&gt; postreset(M) -&gt; postreset(S)
41   </p><p>
42
43   Note that softreset is called only for the master.  Softreset
44   resets both M/S by definition, so SRST on master should handle
45   both (the standard method will work just fine).
46</p></div><div class="refsect1"><a name="idp1123846484"></a><h2>LOCKING</h2><p>
47   Should be called before host is registered.
48</p></div><div class="refsect1"><a name="idp1123847116"></a><h2>RETURNS</h2><p>
49   0 on success, -errno on failure.
50</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-ata-host-alloc-pinfo.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="libataExt.html">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="API-ata-host-start.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">ata_host_alloc_pinfo</span>&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;<span class="phrase">ata_host_start</span></td></tr></table></div></body></html>
51