diff options
Diffstat (limited to 'include/linux/libata.h')
-rw-r--r-- | include/linux/libata.h | 53 |
1 files changed, 47 insertions, 6 deletions
diff --git a/include/linux/libata.h b/include/linux/libata.h index bfa155789993..7a1793bd2371 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -515,6 +515,7 @@ struct ata_acpi_gtm { | |||
515 | 515 | ||
516 | struct ata_link { | 516 | struct ata_link { |
517 | struct ata_port *ap; | 517 | struct ata_port *ap; |
518 | int pmp; /* port multiplier port # */ | ||
518 | 519 | ||
519 | unsigned int active_tag; /* active tag on this link */ | 520 | unsigned int active_tag; /* active tag on this link */ |
520 | u32 sactive; /* active NCQ commands */ | 521 | u32 sactive; /* active NCQ commands */ |
@@ -563,6 +564,9 @@ struct ata_port { | |||
563 | 564 | ||
564 | struct ata_link link; /* host default link */ | 565 | struct ata_link link; /* host default link */ |
565 | 566 | ||
567 | int nr_pmp_links; /* nr of available PMP links */ | ||
568 | struct ata_link *pmp_link; /* array of PMP links */ | ||
569 | |||
566 | struct ata_port_stats stats; | 570 | struct ata_port_stats stats; |
567 | struct ata_host *host; | 571 | struct ata_host *host; |
568 | struct device *dev; | 572 | struct device *dev; |
@@ -926,11 +930,17 @@ extern void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
926 | #define ata_port_printk(ap, lv, fmt, args...) \ | 930 | #define ata_port_printk(ap, lv, fmt, args...) \ |
927 | printk(lv"ata%u: "fmt, (ap)->print_id , ##args) | 931 | printk(lv"ata%u: "fmt, (ap)->print_id , ##args) |
928 | 932 | ||
929 | #define ata_link_printk(link, lv, fmt, args...) \ | 933 | #define ata_link_printk(link, lv, fmt, args...) do { \ |
930 | printk(lv"ata%u: "fmt, (link)->ap->print_id , ##args) | 934 | if ((link)->ap->nr_pmp_links) \ |
935 | printk(lv"ata%u.%02u: "fmt, (link)->ap->print_id, \ | ||
936 | (link)->pmp , ##args); \ | ||
937 | else \ | ||
938 | printk(lv"ata%u: "fmt, (link)->ap->print_id , ##args); \ | ||
939 | } while(0) | ||
931 | 940 | ||
932 | #define ata_dev_printk(dev, lv, fmt, args...) \ | 941 | #define ata_dev_printk(dev, lv, fmt, args...) \ |
933 | printk(lv"ata%u.%02u: "fmt, (dev)->link->ap->print_id, (dev)->devno , ##args) | 942 | printk(lv"ata%u.%02u: "fmt, (dev)->link->ap->print_id, \ |
943 | (dev)->link->pmp + (dev)->devno , ##args) | ||
934 | 944 | ||
935 | /* | 945 | /* |
936 | * ata_eh_info helpers | 946 | * ata_eh_info helpers |
@@ -1039,15 +1049,46 @@ static inline unsigned int ata_dev_absent(const struct ata_device *dev) | |||
1039 | /* | 1049 | /* |
1040 | * link helpers | 1050 | * link helpers |
1041 | */ | 1051 | */ |
1052 | static inline int ata_is_host_link(const struct ata_link *link) | ||
1053 | { | ||
1054 | return link == &link->ap->link; | ||
1055 | } | ||
1056 | |||
1042 | static inline int ata_link_max_devices(const struct ata_link *link) | 1057 | static inline int ata_link_max_devices(const struct ata_link *link) |
1043 | { | 1058 | { |
1044 | if (link->ap->flags & ATA_FLAG_SLAVE_POSS) | 1059 | if (ata_is_host_link(link) && link->ap->flags & ATA_FLAG_SLAVE_POSS) |
1045 | return 2; | 1060 | return 2; |
1046 | return 1; | 1061 | return 1; |
1047 | } | 1062 | } |
1048 | 1063 | ||
1049 | #define ata_port_for_each_link(lk, ap) \ | 1064 | static inline struct ata_link *ata_port_first_link(struct ata_port *ap) |
1050 | for ((lk) = &(ap)->link; (lk); (lk) = NULL) | 1065 | { |
1066 | if (ap->nr_pmp_links) | ||
1067 | return ap->pmp_link; | ||
1068 | return &ap->link; | ||
1069 | } | ||
1070 | |||
1071 | static inline struct ata_link *ata_port_next_link(struct ata_link *link) | ||
1072 | { | ||
1073 | struct ata_port *ap = link->ap; | ||
1074 | |||
1075 | if (link == &ap->link) { | ||
1076 | if (!ap->nr_pmp_links) | ||
1077 | return NULL; | ||
1078 | return ap->pmp_link; | ||
1079 | } | ||
1080 | |||
1081 | if (++link - ap->pmp_link < ap->nr_pmp_links) | ||
1082 | return link; | ||
1083 | return NULL; | ||
1084 | } | ||
1085 | |||
1086 | #define __ata_port_for_each_link(lk, ap) \ | ||
1087 | for ((lk) = &(ap)->link; (lk); (lk) = ata_port_next_link(lk)) | ||
1088 | |||
1089 | #define ata_port_for_each_link(link, ap) \ | ||
1090 | for ((link) = ata_port_first_link(ap); (link); \ | ||
1091 | (link) = ata_port_next_link(link)) | ||
1051 | 1092 | ||
1052 | #define ata_link_for_each_dev(dev, link) \ | 1093 | #define ata_link_for_each_dev(dev, link) \ |
1053 | for ((dev) = (link)->device; \ | 1094 | for ((dev) = (link)->device; \ |