ata_slave_link_init - initialize slave link
2. SYNOPSIS ▲
int ata_slave_link_init(struct ata_port * ap );
3. ARGUMENTS ▲
port to initialize slave link for
4. DESCRIPTION ▲
Create and initialize slave link for ap. This enables slave link handling on the port.
In libata, a port contains links and a link contains devices. There is single host link but if a PMP is attached to it, there can be multiple fan-out links. On SATA, thereAqs usually a single device connected to a link but PATA and SATA controllers emulating TF based interface can have two - master and slave.
However, there are a few controllers which donAqt fit into this abstraction too well - SATA controllers which emulate TF interface with both master and slave devices but also have separate SCR register sets for each device. These controllers need separate links for physical link handling (e.g. onlineness, link speed) but should be treated like a traditional M/S controller for everything else (e.g. command issue, softreset).
slave_link is libataAqs way of handling this class of controllers without impacting core layer too much. For anything other than physical link handling, the default host link is used for both master and slave. For physical link handling, separate ap->slave_link is used. All dirty details are implemented inside libata core layer. From LLDAqs POV, the only difference is that prereset, hardreset and postreset are called once more for the slave link, so the reset sequence looks like the following.
prereset(M) -> prereset(S) -> hardreset(M) -> hardreset(S) -> softreset(M) -> postreset(M) -> postreset(S)
Note that softreset is called only for the master. Softreset resets both M/S by definition, so SRST on master should handle both (the standard method will work just fine).
5. LOCKING ▲
Should be called before host is registered.
6. RETURNS ▲
0 on success, -errno on failure.
7. AUTHOR ▲
8. COPYRIGHT ▲