Lines Matching +full:ac +full:- +full:link
1 // SPDX-License-Identifier: GPL-2.0-only
10 * interfaces to user-space.
13 * - ata_port
14 * - ata_link
15 * - ata_device
16 * Each port has a link object. Each link can have up to two devices for PATA
38 #include "libata-transport.h"
71 tdev_to_device((dev)->parent)
76 tdev_to_link((dev)->parent)
81 tdev_to_port((dev)->parent)
205 return scnprintf(buf, 20, format_string, cast ap->field); \
214 /* We want the port_no sysfs attibute to start at 1 (ap->port_no starts at 0) */
223 ata_host_put(ap->host); in ata_tport_release()
227 * ata_is_port -- check if a struct device represents a ATA port
235 return dev->release == ata_tport_release; in ata_is_port()
243 return &ata_scsi_transport_template->host_attrs.ac == cont; in ata_tport_match()
247 * ata_tport_delete -- remove ATA PORT
250 * Removes the specified ATA PORT. Remove the associated link as well.
254 struct device *dev = &ap->tdev; in ata_tport_delete()
256 ata_tlink_delete(&ap->link); in ata_tport_delete()
269 /** ata_tport_add - initialize a transport ATA port structure
283 struct device *dev = &ap->tdev; in ata_tport_add()
286 if (ap->flags & ATA_FLAG_SAS_HOST) in ata_tport_add()
287 dev->type = &ata_port_sas_type; in ata_tport_add()
289 dev->type = &ata_port_type; in ata_tport_add()
291 dev->parent = parent; in ata_tport_add()
292 ata_host_get(ap->host); in ata_tport_add()
293 dev->release = ata_tport_release; in ata_tport_add()
294 dev_set_name(dev, "ata%d", ap->print_id); in ata_tport_add()
312 error = ata_tlink_add(&ap->link); in ata_tport_add()
331 * ata_port_classify - determine device type based on ATA-spec signature
372 return get_ata_##title##_names(ata_dev->field, buf); \
392 return scnprintf(buf, 20, format_string, cast ata_dev->field); \
413 seconds = div_u64_rem(ent->timestamp, HZ, &rem); in ata_show_ering()
414 arg->written += sprintf(arg->buf + arg->written, in ata_show_ering()
417 arg->written += get_ata_err_names(ent->err_mask, in ata_show_ering()
418 arg->buf + arg->written); in ata_show_ering()
429 ata_ering_map(&ata_dev->ering, ata_show_ering, &arg); in show_ata_dev_ering()
443 if (ata_dev->class == ATA_DEV_PMP) in show_ata_dev_id()
447 ata_dev->id[i], in show_ata_dev_id()
462 if (ata_dev->class != ATA_DEV_PMP) in show_ata_dev_gscr()
466 ata_dev->gscr[i], in show_ata_dev_gscr()
470 buf[written-1] = '\n'; in show_ata_dev_gscr()
483 if (!ata_id_has_trim(ata_dev->id)) in show_ata_dev_trim()
485 else if (ata_dev->quirks & ATA_QUIRK_NOTRIM) in show_ata_dev_trim()
487 else if (ata_dev->quirks & ATA_QUIRK_NO_NCQ_TRIM) in show_ata_dev_trim()
507 * ata_is_ata_dev -- check if a struct device represents a ATA device
515 return dev->release == ata_tdev_release; in ata_is_ata_dev()
525 return &i->dev_attr_cont.ac == cont; in ata_tdev_match()
529 * ata_tdev_free -- free an ATA transport device
540 transport_destroy_device(&dev->tdev); in ata_tdev_free()
541 put_device(&dev->tdev); in ata_tdev_free()
545 * ata_tdev_delete -- remove an ATA transport device
552 struct device *dev = &ata_dev->tdev; in ata_tdev_delete()
560 * ata_tdev_add -- initialize an ATA transport device
564 * device tree below the ATA link device it belongs to.
570 struct device *dev = &ata_dev->tdev; in ata_tdev_add()
571 struct ata_link *link = ata_dev->link; in ata_tdev_add() local
572 struct ata_port *ap = link->ap; in ata_tdev_add()
576 dev->parent = &link->tdev; in ata_tdev_add()
577 dev->release = ata_tdev_release; in ata_tdev_add()
578 if (ata_is_host_link(link)) in ata_tdev_add()
579 dev_set_name(dev, "dev%d.%d", ap->print_id,ata_dev->devno); in ata_tdev_add()
581 dev_set_name(dev, "dev%d.%d.0", ap->print_id, link->pmp); in ata_tdev_add()
603 * ATA link attributes
615 struct ata_link *link = transport_class_to_link(dev); \
618 sata_spd_string(format(link->field))); \
637 * ata_is_link -- check if a struct device represents a ATA link
641 * true if the device represents a ATA link, false otherwise
645 return dev->release == ata_tlink_release; in ata_is_link()
655 return &i->link_attr_cont.ac == cont; in ata_tlink_match()
659 * ata_tlink_delete -- remove an ATA link transport device
660 * @link: struct ata_link owning the link transport device to remove
662 * Removes the link transport device of the specified ATA link. This also
663 * removes the ATA device(s) associated with the link as well.
665 void ata_tlink_delete(struct ata_link *link) in ata_tlink_delete() argument
667 struct device *dev = &link->tdev; in ata_tlink_delete()
670 ata_for_each_dev(ata_dev, link, ALL) { in ata_tlink_delete()
681 * ata_tlink_add -- initialize an ATA link transport device
682 * @link: struct ata_link owning the link transport device to initialize
684 * Initialize an ATA link transport device for sysfs. It will be added in the
689 int ata_tlink_add(struct ata_link *link) in ata_tlink_add() argument
691 struct device *dev = &link->tdev; in ata_tlink_add()
692 struct ata_port *ap = link->ap; in ata_tlink_add()
697 dev->parent = &ap->tdev; in ata_tlink_add()
698 dev->release = ata_tlink_release; in ata_tlink_add()
699 if (ata_is_host_link(link)) in ata_tlink_add()
700 dev_set_name(dev, "link%d", ap->print_id); in ata_tlink_add()
702 dev_set_name(dev, "link%d.%d", ap->print_id, link->pmp); in ata_tlink_add()
715 ata_for_each_dev(ata_dev, link, ALL) { in ata_tlink_add()
722 while (--ata_dev >= link->device) in ata_tlink_add()
738 i->private_##attrb[count] = dev_attr_##field; \
739 i->private_##attrb[count].attr.mode = perm; \
740 i->attrb[count] = &i->private_##attrb[count]; \
754 * ata_attach_transport -- instantiate ATA transport template
765 i->t.eh_strategy_handler = ata_scsi_error; in ata_attach_transport()
766 i->t.user_scan = ata_scsi_user_scan; in ata_attach_transport()
768 i->t.host_attrs.ac.attrs = &i->port_attrs[0]; in ata_attach_transport()
769 i->t.host_attrs.ac.class = &ata_port_class.class; in ata_attach_transport()
770 i->t.host_attrs.ac.match = ata_tport_match; in ata_attach_transport()
771 transport_container_register(&i->t.host_attrs); in ata_attach_transport()
773 i->link_attr_cont.ac.class = &ata_link_class.class; in ata_attach_transport()
774 i->link_attr_cont.ac.attrs = &i->link_attrs[0]; in ata_attach_transport()
775 i->link_attr_cont.ac.match = ata_tlink_match; in ata_attach_transport()
776 transport_container_register(&i->link_attr_cont); in ata_attach_transport()
778 i->dev_attr_cont.ac.class = &ata_dev_class.class; in ata_attach_transport()
779 i->dev_attr_cont.ac.attrs = &i->dev_attrs[0]; in ata_attach_transport()
780 i->dev_attr_cont.ac.match = ata_tdev_match; in ata_attach_transport()
781 transport_container_register(&i->dev_attr_cont); in ata_attach_transport()
788 i->port_attrs[count] = NULL; in ata_attach_transport()
795 i->link_attrs[count] = NULL; in ata_attach_transport()
808 i->dev_attrs[count] = NULL; in ata_attach_transport()
810 return &i->t; in ata_attach_transport()
814 * ata_release_transport -- release ATA transport template instance
821 transport_container_unregister(&i->t.host_attrs); in ata_release_transport()
822 transport_container_unregister(&i->link_attr_cont); in ata_release_transport()
823 transport_container_unregister(&i->dev_attr_cont); in ata_release_transport()