diff options
author | Tejun Heo <htejun@gmail.com> | 2007-08-06 05:36:23 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-10-12 14:55:31 -0400 |
commit | cc0680a580b5be81a1ca321b58f8e9b80b5c1052 (patch) | |
tree | 57454cdfdc9890f4e8d9f532e9cd240c7361951f /drivers/ata/ahci.c | |
parent | 955e57dfde4ff75e4d7329ac7a3d645b16015309 (diff) |
libata-link: linkify reset
Make reset methods and related functions deal with ata_link instead of
ata_port.
* ata_do_reset()
* ata_eh_reset()
* all prereset/reset/postreset methods and related functions
This patch introduces no behavior change.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/ahci.c')
-rw-r--r-- | drivers/ata/ahci.c | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 6e5f69a3a0c2..e38ae12d0148 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -1042,9 +1042,10 @@ static int ahci_exec_polled_cmd(struct ata_port *ap, int pmp, | |||
1042 | return 0; | 1042 | return 0; |
1043 | } | 1043 | } |
1044 | 1044 | ||
1045 | static int ahci_do_softreset(struct ata_port *ap, unsigned int *class, | 1045 | static int ahci_do_softreset(struct ata_link *link, unsigned int *class, |
1046 | int pmp, unsigned long deadline) | 1046 | int pmp, unsigned long deadline) |
1047 | { | 1047 | { |
1048 | struct ata_port *ap = link->ap; | ||
1048 | const char *reason = NULL; | 1049 | const char *reason = NULL; |
1049 | unsigned long now, msecs; | 1050 | unsigned long now, msecs; |
1050 | struct ata_taskfile tf; | 1051 | struct ata_taskfile tf; |
@@ -1052,7 +1053,7 @@ static int ahci_do_softreset(struct ata_port *ap, unsigned int *class, | |||
1052 | 1053 | ||
1053 | DPRINTK("ENTER\n"); | 1054 | DPRINTK("ENTER\n"); |
1054 | 1055 | ||
1055 | if (ata_link_offline(&ap->link)) { | 1056 | if (ata_link_offline(link)) { |
1056 | DPRINTK("PHY reports no device\n"); | 1057 | DPRINTK("PHY reports no device\n"); |
1057 | *class = ATA_DEV_NONE; | 1058 | *class = ATA_DEV_NONE; |
1058 | return 0; | 1059 | return 0; |
@@ -1061,10 +1062,10 @@ static int ahci_do_softreset(struct ata_port *ap, unsigned int *class, | |||
1061 | /* prepare for SRST (AHCI-1.1 10.4.1) */ | 1062 | /* prepare for SRST (AHCI-1.1 10.4.1) */ |
1062 | rc = ahci_kick_engine(ap, 1); | 1063 | rc = ahci_kick_engine(ap, 1); |
1063 | if (rc) | 1064 | if (rc) |
1064 | ata_port_printk(ap, KERN_WARNING, | 1065 | ata_link_printk(link, KERN_WARNING, |
1065 | "failed to reset engine (errno=%d)", rc); | 1066 | "failed to reset engine (errno=%d)", rc); |
1066 | 1067 | ||
1067 | ata_tf_init(ap->link.device, &tf); | 1068 | ata_tf_init(link->device, &tf); |
1068 | 1069 | ||
1069 | /* issue the first D2H Register FIS */ | 1070 | /* issue the first D2H Register FIS */ |
1070 | msecs = 0; | 1071 | msecs = 0; |
@@ -1109,19 +1110,20 @@ static int ahci_do_softreset(struct ata_port *ap, unsigned int *class, | |||
1109 | return 0; | 1110 | return 0; |
1110 | 1111 | ||
1111 | fail: | 1112 | fail: |
1112 | ata_port_printk(ap, KERN_ERR, "softreset failed (%s)\n", reason); | 1113 | ata_link_printk(link, KERN_ERR, "softreset failed (%s)\n", reason); |
1113 | return rc; | 1114 | return rc; |
1114 | } | 1115 | } |
1115 | 1116 | ||
1116 | static int ahci_softreset(struct ata_port *ap, unsigned int *class, | 1117 | static int ahci_softreset(struct ata_link *link, unsigned int *class, |
1117 | unsigned long deadline) | 1118 | unsigned long deadline) |
1118 | { | 1119 | { |
1119 | return ahci_do_softreset(ap, class, 0, deadline); | 1120 | return ahci_do_softreset(link, class, 0, deadline); |
1120 | } | 1121 | } |
1121 | 1122 | ||
1122 | static int ahci_hardreset(struct ata_port *ap, unsigned int *class, | 1123 | static int ahci_hardreset(struct ata_link *link, unsigned int *class, |
1123 | unsigned long deadline) | 1124 | unsigned long deadline) |
1124 | { | 1125 | { |
1126 | struct ata_port *ap = link->ap; | ||
1125 | struct ahci_port_priv *pp = ap->private_data; | 1127 | struct ahci_port_priv *pp = ap->private_data; |
1126 | u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG; | 1128 | u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG; |
1127 | struct ata_taskfile tf; | 1129 | struct ata_taskfile tf; |
@@ -1132,15 +1134,15 @@ static int ahci_hardreset(struct ata_port *ap, unsigned int *class, | |||
1132 | ahci_stop_engine(ap); | 1134 | ahci_stop_engine(ap); |
1133 | 1135 | ||
1134 | /* clear D2H reception area to properly wait for D2H FIS */ | 1136 | /* clear D2H reception area to properly wait for D2H FIS */ |
1135 | ata_tf_init(ap->link.device, &tf); | 1137 | ata_tf_init(link->device, &tf); |
1136 | tf.command = 0x80; | 1138 | tf.command = 0x80; |
1137 | ata_tf_to_fis(&tf, 0, 0, d2h_fis); | 1139 | ata_tf_to_fis(&tf, 0, 0, d2h_fis); |
1138 | 1140 | ||
1139 | rc = sata_std_hardreset(ap, class, deadline); | 1141 | rc = sata_std_hardreset(link, class, deadline); |
1140 | 1142 | ||
1141 | ahci_start_engine(ap); | 1143 | ahci_start_engine(ap); |
1142 | 1144 | ||
1143 | if (rc == 0 && ata_link_online(&ap->link)) | 1145 | if (rc == 0 && ata_link_online(link)) |
1144 | *class = ahci_dev_classify(ap); | 1146 | *class = ahci_dev_classify(ap); |
1145 | if (*class == ATA_DEV_UNKNOWN) | 1147 | if (*class == ATA_DEV_UNKNOWN) |
1146 | *class = ATA_DEV_NONE; | 1148 | *class = ATA_DEV_NONE; |
@@ -1149,9 +1151,10 @@ static int ahci_hardreset(struct ata_port *ap, unsigned int *class, | |||
1149 | return rc; | 1151 | return rc; |
1150 | } | 1152 | } |
1151 | 1153 | ||
1152 | static int ahci_vt8251_hardreset(struct ata_port *ap, unsigned int *class, | 1154 | static int ahci_vt8251_hardreset(struct ata_link *link, unsigned int *class, |
1153 | unsigned long deadline) | 1155 | unsigned long deadline) |
1154 | { | 1156 | { |
1157 | struct ata_port *ap = link->ap; | ||
1155 | u32 serror; | 1158 | u32 serror; |
1156 | int rc; | 1159 | int rc; |
1157 | 1160 | ||
@@ -1159,7 +1162,7 @@ static int ahci_vt8251_hardreset(struct ata_port *ap, unsigned int *class, | |||
1159 | 1162 | ||
1160 | ahci_stop_engine(ap); | 1163 | ahci_stop_engine(ap); |
1161 | 1164 | ||
1162 | rc = sata_port_hardreset(ap, sata_ehc_deb_timing(&ap->link.eh_context), | 1165 | rc = sata_link_hardreset(link, sata_ehc_deb_timing(&link->eh_context), |
1163 | deadline); | 1166 | deadline); |
1164 | 1167 | ||
1165 | /* vt8251 needs SError cleared for the port to operate */ | 1168 | /* vt8251 needs SError cleared for the port to operate */ |
@@ -1176,12 +1179,13 @@ static int ahci_vt8251_hardreset(struct ata_port *ap, unsigned int *class, | |||
1176 | return rc ?: -EAGAIN; | 1179 | return rc ?: -EAGAIN; |
1177 | } | 1180 | } |
1178 | 1181 | ||
1179 | static void ahci_postreset(struct ata_port *ap, unsigned int *class) | 1182 | static void ahci_postreset(struct ata_link *link, unsigned int *class) |
1180 | { | 1183 | { |
1184 | struct ata_port *ap = link->ap; | ||
1181 | void __iomem *port_mmio = ahci_port_base(ap); | 1185 | void __iomem *port_mmio = ahci_port_base(ap); |
1182 | u32 new_tmp, tmp; | 1186 | u32 new_tmp, tmp; |
1183 | 1187 | ||
1184 | ata_std_postreset(ap, class); | 1188 | ata_std_postreset(link, class); |
1185 | 1189 | ||
1186 | /* Make sure port's ATAPI bit is set appropriately */ | 1190 | /* Make sure port's ATAPI bit is set appropriately */ |
1187 | new_tmp = tmp = readl(port_mmio + PORT_CMD); | 1191 | new_tmp = tmp = readl(port_mmio + PORT_CMD); |