pata_sl82c105: dual channel support

Use qc_defer to serialize the two channels

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>

authored by Alan Cox and committed by Jeff Garzik 92ba5d02 4a537a55

+31 -2
+31 -2
drivers/ata/pata_sl82c105.c
··· 26 #include <linux/libata.h> 27 28 #define DRV_NAME "pata_sl82c105" 29 - #define DRV_VERSION "0.3.2" 30 31 enum { 32 /* ··· 206 sl82c105_set_piomode(ap, qc->dev); 207 } 208 209 static struct scsi_host_template sl82c105_sht = { 210 .module = THIS_MODULE, 211 .name = DRV_NAME, ··· 273 .bmdma_stop = sl82c105_bmdma_stop, 274 .bmdma_status = ata_bmdma_status, 275 276 .qc_prep = ata_qc_prep, 277 .qc_issue = ata_qc_issue_prot, 278 ··· 341 }; 342 /* for now use only the first port */ 343 const struct ata_port_info *ppi[] = { &info_early, 344 - &ata_dummy_port_info }; 345 u32 val; 346 int rev; 347
··· 26 #include <linux/libata.h> 27 28 #define DRV_NAME "pata_sl82c105" 29 + #define DRV_VERSION "0.3.3" 30 31 enum { 32 /* ··· 206 sl82c105_set_piomode(ap, qc->dev); 207 } 208 209 + /** 210 + * sl82c105_qc_defer - implement serialization 211 + * @qc: command 212 + * 213 + * We must issue one command per host not per channel because 214 + * of the reset bug. 215 + * 216 + * Q: is the scsi host lock sufficient ? 217 + */ 218 + 219 + static int sl82c105_qc_defer(struct ata_queued_cmd *qc) 220 + { 221 + struct ata_host *host = qc->ap->host; 222 + struct ata_port *alt = host->ports[1 ^ qc->ap->port_no]; 223 + int rc; 224 + 225 + /* First apply the usual rules */ 226 + rc = ata_std_qc_defer(qc); 227 + if (rc != 0) 228 + return rc; 229 + 230 + /* Now apply serialization rules. Only allow a command if the 231 + other channel state machine is idle */ 232 + if (alt && alt->qc_active) 233 + return ATA_DEFER_PORT; 234 + return 0; 235 + } 236 + 237 static struct scsi_host_template sl82c105_sht = { 238 .module = THIS_MODULE, 239 .name = DRV_NAME, ··· 245 .bmdma_stop = sl82c105_bmdma_stop, 246 .bmdma_status = ata_bmdma_status, 247 248 + .qc_defer = sl82c105_qc_defer, 249 .qc_prep = ata_qc_prep, 250 .qc_issue = ata_qc_issue_prot, 251 ··· 312 }; 313 /* for now use only the first port */ 314 const struct ata_port_info *ppi[] = { &info_early, 315 + NULL }; 316 u32 val; 317 int rev; 318