• Home
  • Raw
  • Download

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)
84 /* Device objects are always created whit link objects */
211 return scnprintf(buf, 20, format_string, cast ap->field); \
228 ata_host_put(ap->host); in ata_tport_release()
232 * ata_is_port -- check if a struct device represents a ATA port
240 return dev->release == ata_tport_release; in ata_is_port()
248 return &ata_scsi_transport_template->host_attrs.ac == cont; in ata_tport_match()
252 * ata_tport_delete -- remove ATA PORT
255 * Removes the specified ATA PORT. Remove the associated link as well.
259 struct device *dev = &ap->tdev; in ata_tport_delete()
261 ata_tlink_delete(&ap->link); in ata_tport_delete()
273 /** ata_tport_add - initialize a transport ATA port structure
287 struct device *dev = &ap->tdev; in ata_tport_add()
290 if (ap->flags & ATA_FLAG_SAS_HOST) in ata_tport_add()
291 dev->type = &ata_port_sas_type; in ata_tport_add()
293 dev->type = &ata_port_type; in ata_tport_add()
295 dev->parent = parent; in ata_tport_add()
296 ata_host_get(ap->host); in ata_tport_add()
297 dev->release = ata_tport_release; in ata_tport_add()
298 dev_set_name(dev, "ata%d", ap->print_id); in ata_tport_add()
316 error = ata_tlink_add(&ap->link); in ata_tport_add()
334 * ata_port_classify - determine device type based on ATA-spec signature
365 * ATA link attributes
374 struct ata_link *link = transport_class_to_link(dev); \
376 return sprintf(buf, "%s\n", sata_spd_string(format(link->field))); \
396 * ata_is_link -- check if a struct device represents a ATA link
400 * %1 if the device represents a ATA link, %0 else
404 return dev->release == ata_tlink_release; in ata_is_link()
413 return &i->link_attr_cont.ac == cont; in ata_tlink_match()
417 * ata_tlink_delete -- remove ATA LINK
418 * @link: ATA LINK to remove
420 * Removes the specified ATA LINK. remove associated ATA device(s) as well.
422 void ata_tlink_delete(struct ata_link *link) in ata_tlink_delete() argument
424 struct device *dev = &link->tdev; in ata_tlink_delete()
427 ata_for_each_dev(ata_dev, link, ALL) { in ata_tlink_delete()
438 * ata_tlink_add -- initialize a transport ATA link structure
439 * @link: allocated ata_link structure.
441 * Initialize an ATA LINK structure for sysfs. It will be added in the
446 int ata_tlink_add(struct ata_link *link) in ata_tlink_add() argument
448 struct device *dev = &link->tdev; in ata_tlink_add()
449 struct ata_port *ap = link->ap; in ata_tlink_add()
454 dev->parent = &ap->tdev; in ata_tlink_add()
455 dev->release = ata_tlink_release; in ata_tlink_add()
456 if (ata_is_host_link(link)) in ata_tlink_add()
457 dev_set_name(dev, "link%d", ap->print_id); in ata_tlink_add()
459 dev_set_name(dev, "link%d.%d", ap->print_id, link->pmp); in ata_tlink_add()
473 ata_for_each_dev(ata_dev, link, ALL) { in ata_tlink_add()
481 while (--ata_dev >= link->device) { in ata_tlink_add()
504 return get_ata_##title##_names(ata_dev->field, buf); \
524 return scnprintf(buf, 20, format_string, cast ata_dev->field); \
545 seconds = div_u64_rem(ent->timestamp, HZ, &rem); in ata_show_ering()
546 arg->written += sprintf(arg->buf + arg->written, in ata_show_ering()
549 arg->written += get_ata_err_names(ent->err_mask, in ata_show_ering()
550 arg->buf + arg->written); in ata_show_ering()
561 ata_ering_map(&ata_dev->ering, ata_show_ering, &arg); in show_ata_dev_ering()
575 if (ata_dev->class == ATA_DEV_PMP) in show_ata_dev_id()
579 ata_dev->id[i], in show_ata_dev_id()
594 if (ata_dev->class != ATA_DEV_PMP) in show_ata_dev_gscr()
598 ata_dev->gscr[i], in show_ata_dev_gscr()
602 buf[written-1] = '\n'; in show_ata_dev_gscr()
615 if (!ata_id_has_trim(ata_dev->id)) in show_ata_dev_trim()
617 else if (ata_dev->horkage & ATA_HORKAGE_NOTRIM) in show_ata_dev_trim()
619 else if (ata_dev->horkage & ATA_HORKAGE_NO_NCQ_TRIM) in show_ata_dev_trim()
639 * ata_is_ata_dev -- check if a struct device represents a ATA device
647 return dev->release == ata_tdev_release; in ata_is_ata_dev()
656 return &i->dev_attr_cont.ac == cont; in ata_tdev_match()
660 * ata_tdev_free -- free a ATA LINK
671 transport_destroy_device(&dev->tdev); in ata_tdev_free()
672 put_device(&dev->tdev); in ata_tdev_free()
676 * ata_tdev_delete -- remove ATA device
683 struct device *dev = &ata_dev->tdev; in ata_tdev_delete()
692 * ata_tdev_add -- initialize a transport ATA device structure.
696 * device tree below the ATA LINK device it belongs to.
702 struct device *dev = &ata_dev->tdev; in ata_tdev_add()
703 struct ata_link *link = ata_dev->link; in ata_tdev_add() local
704 struct ata_port *ap = link->ap; in ata_tdev_add()
708 dev->parent = &link->tdev; in ata_tdev_add()
709 dev->release = ata_tdev_release; in ata_tdev_add()
710 if (ata_is_host_link(link)) in ata_tdev_add()
711 dev_set_name(dev, "dev%d.%d", ap->print_id,ata_dev->devno); in ata_tdev_add()
713 dev_set_name(dev, "dev%d.%d.0", ap->print_id, link->pmp); in ata_tdev_add()
740 i->private_##attrb[count] = dev_attr_##field; \
741 i->private_##attrb[count].attr.mode = perm; \
742 i->attrb[count] = &i->private_##attrb[count]; \
756 * ata_attach_transport -- instantiate ATA transport template
767 i->t.eh_strategy_handler = ata_scsi_error; in ata_attach_transport()
768 i->t.user_scan = ata_scsi_user_scan; in ata_attach_transport()
770 i->t.host_attrs.ac.attrs = &i->port_attrs[0]; in ata_attach_transport()
771 i->t.host_attrs.ac.class = &ata_port_class.class; in ata_attach_transport()
772 i->t.host_attrs.ac.match = ata_tport_match; in ata_attach_transport()
773 transport_container_register(&i->t.host_attrs); in ata_attach_transport()
775 i->link_attr_cont.ac.class = &ata_link_class.class; in ata_attach_transport()
776 i->link_attr_cont.ac.attrs = &i->link_attrs[0]; in ata_attach_transport()
777 i->link_attr_cont.ac.match = ata_tlink_match; in ata_attach_transport()
778 transport_container_register(&i->link_attr_cont); in ata_attach_transport()
780 i->dev_attr_cont.ac.class = &ata_dev_class.class; in ata_attach_transport()
781 i->dev_attr_cont.ac.attrs = &i->dev_attrs[0]; in ata_attach_transport()
782 i->dev_attr_cont.ac.match = ata_tdev_match; in ata_attach_transport()
783 transport_container_register(&i->dev_attr_cont); in ata_attach_transport()
790 i->port_attrs[count] = NULL; in ata_attach_transport()
797 i->link_attrs[count] = NULL; in ata_attach_transport()
810 i->dev_attrs[count] = NULL; in ata_attach_transport()
812 return &i->t; in ata_attach_transport()
816 * ata_release_transport -- release ATA transport template instance
823 transport_container_unregister(&i->t.host_attrs); in ata_release_transport()
824 transport_container_unregister(&i->link_attr_cont); in ata_release_transport()
825 transport_container_unregister(&i->dev_attr_cont); in ata_release_transport()