Skip to content

Commit c0f2ee3

Browse files
Alan CoxJeff Garzik
authored andcommitted
pata_sc1200: Activate secondary channel
Implement serialize and turn on slave channel Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
1 parent 140d6fe commit c0f2ee3

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

drivers/ata/pata_sc1200.c

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
* New ATA layer SC1200 driver Alan Cox <alan@lxorguk.ukuu.org.uk>
33
*
44
* TODO: Mode selection filtering
5-
* TODO: Can't enable second channel until ATA core has serialize
65
* TODO: Needs custom DMA cleanup code
76
*
87
* Based very heavily on
@@ -178,6 +177,31 @@ static unsigned int sc1200_qc_issue(struct ata_queued_cmd *qc)
178177
return ata_sff_qc_issue(qc);
179178
}
180179

180+
/**
181+
* sc1200_qc_defer - implement serialization
182+
* @qc: command
183+
*
184+
* Serialize command issue on this controller.
185+
*/
186+
187+
static int sc1200_qc_defer(struct ata_queued_cmd *qc)
188+
{
189+
struct ata_host *host = qc->ap->host;
190+
struct ata_port *alt = host->ports[1 ^ qc->ap->port_no];
191+
int rc;
192+
193+
/* First apply the usual rules */
194+
rc = ata_std_qc_defer(qc);
195+
if (rc != 0)
196+
return rc;
197+
198+
/* Now apply serialization rules. Only allow a command if the
199+
other channel state machine is idle */
200+
if (alt && alt->qc_active)
201+
return ATA_DEFER_PORT;
202+
return 0;
203+
}
204+
181205
static struct scsi_host_template sc1200_sht = {
182206
ATA_BMDMA_SHT(DRV_NAME),
183207
.sg_tablesize = LIBATA_DUMB_MAX_PRD,
@@ -187,6 +211,7 @@ static struct ata_port_operations sc1200_port_ops = {
187211
.inherits = &ata_bmdma_port_ops,
188212
.qc_prep = ata_sff_dumb_qc_prep,
189213
.qc_issue = sc1200_qc_issue,
214+
.qc_defer = sc1200_qc_defer,
190215
.cable_detect = ata_cable_40wire,
191216
.set_piomode = sc1200_set_piomode,
192217
.set_dmamode = sc1200_set_dmamode,
@@ -211,7 +236,7 @@ static int sc1200_init_one(struct pci_dev *dev, const struct pci_device_id *id)
211236
.port_ops = &sc1200_port_ops
212237
};
213238
/* Can't enable port 2 yet, see top comments */
214-
const struct ata_port_info *ppi[] = { &info, &ata_dummy_port_info };
239+
const struct ata_port_info *ppi[] = { &info, };
215240

216241
return ata_pci_sff_init_one(dev, ppi, &sc1200_sht, NULL);
217242
}

0 commit comments

Comments
 (0)