diff options
author | Alan Cox <alan@redhat.com> | 2009-03-24 06:22:25 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2009-03-24 22:45:37 -0400 |
commit | c0f2ee34a5a0b79fd98d965ad8ae765d4639bfa5 (patch) | |
tree | a638baaabe74b10923d709586a0ae96fabd53023 /drivers/ata | |
parent | 140d6fed71a659f39f0b130b6ac8f8d28600bf60 (diff) |
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>
Diffstat (limited to 'drivers/ata')
-rw-r--r-- | drivers/ata/pata_sc1200.c | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/drivers/ata/pata_sc1200.c b/drivers/ata/pata_sc1200.c index 36a0c3593297..f49814d6fd2e 100644 --- a/drivers/ata/pata_sc1200.c +++ b/drivers/ata/pata_sc1200.c | |||
@@ -2,7 +2,6 @@ | |||
2 | * New ATA layer SC1200 driver Alan Cox <alan@lxorguk.ukuu.org.uk> | 2 | * New ATA layer SC1200 driver Alan Cox <alan@lxorguk.ukuu.org.uk> |
3 | * | 3 | * |
4 | * TODO: Mode selection filtering | 4 | * TODO: Mode selection filtering |
5 | * TODO: Can't enable second channel until ATA core has serialize | ||
6 | * TODO: Needs custom DMA cleanup code | 5 | * TODO: Needs custom DMA cleanup code |
7 | * | 6 | * |
8 | * Based very heavily on | 7 | * Based very heavily on |
@@ -178,6 +177,31 @@ static unsigned int sc1200_qc_issue(struct ata_queued_cmd *qc) | |||
178 | return ata_sff_qc_issue(qc); | 177 | return ata_sff_qc_issue(qc); |
179 | } | 178 | } |
180 | 179 | ||
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 | |||
181 | static struct scsi_host_template sc1200_sht = { | 205 | static struct scsi_host_template sc1200_sht = { |
182 | ATA_BMDMA_SHT(DRV_NAME), | 206 | ATA_BMDMA_SHT(DRV_NAME), |
183 | .sg_tablesize = LIBATA_DUMB_MAX_PRD, | 207 | .sg_tablesize = LIBATA_DUMB_MAX_PRD, |
@@ -187,6 +211,7 @@ static struct ata_port_operations sc1200_port_ops = { | |||
187 | .inherits = &ata_bmdma_port_ops, | 211 | .inherits = &ata_bmdma_port_ops, |
188 | .qc_prep = ata_sff_dumb_qc_prep, | 212 | .qc_prep = ata_sff_dumb_qc_prep, |
189 | .qc_issue = sc1200_qc_issue, | 213 | .qc_issue = sc1200_qc_issue, |
214 | .qc_defer = sc1200_qc_defer, | ||
190 | .cable_detect = ata_cable_40wire, | 215 | .cable_detect = ata_cable_40wire, |
191 | .set_piomode = sc1200_set_piomode, | 216 | .set_piomode = sc1200_set_piomode, |
192 | .set_dmamode = sc1200_set_dmamode, | 217 | .set_dmamode = sc1200_set_dmamode, |
@@ -211,7 +236,7 @@ static int sc1200_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
211 | .port_ops = &sc1200_port_ops | 236 | .port_ops = &sc1200_port_ops |
212 | }; | 237 | }; |
213 | /* Can't enable port 2 yet, see top comments */ | 238 | /* 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, }; |
215 | 240 | ||
216 | return ata_pci_sff_init_one(dev, ppi, &sc1200_sht, NULL); | 241 | return ata_pci_sff_init_one(dev, ppi, &sc1200_sht, NULL); |
217 | } | 242 | } |