* PATCH: libata. BMDMA handling updates
@ 2006-03-27 17:42 Alan Cox
2006-03-29 4:17 ` Tejun Heo
2006-03-30 0:31 ` Jeff Garzik
0 siblings, 2 replies; 3+ messages in thread
From: Alan Cox @ 2006-03-27 17:42 UTC (permalink / raw)
To: linux-kernel, jgarzik
This is the minimal patch set to enable the current code to be used with
a controller following SFF (ie any PATA and early SATA controllers)
safely without crashes if there is no BMDMA area or if BMDMA is not
assigned by the BIOS for some reason.
Simplex status is recorded but not acted upon in this change, this isn't
a problem with the current drivers as none of them are for simplex
hardware. A following diff will deal with that.
The flags in the probe structure remain ->host_set_flags although Jeff
asked me to rename them, simply because the rename would break the usual
Linux rules that old code should break when there are changes. not
compile and run and then blow up/eat your computer/etc. Renaming this
later is a trivial exercise once a better name is chosen.
Alan
diff --git a/drivers/scsi/libata-bmdma.c b/drivers/scsi/libata-bmdma.c
index 95d81d8..835dff0 100644
--- a/drivers/scsi/libata-bmdma.c
+++ b/drivers/scsi/libata-bmdma.c
@@ -703,6 +703,7 @@ ata_pci_init_native_mode(struct pci_dev
struct ata_probe_ent *probe_ent =
ata_probe_ent_alloc(pci_dev_to_dev(pdev), port[0]);
int p = 0;
+ unsigned long bmdma;
if (!probe_ent)
return NULL;
@@ -716,7 +717,12 @@ ata_pci_init_native_mode(struct pci_dev
probe_ent->port[p].altstatus_addr =
probe_ent->port[p].ctl_addr =
pci_resource_start(pdev, 1) | ATA_PCI_CTL_OFS;
- probe_ent->port[p].bmdma_addr = pci_resource_start(pdev, 4);
+ bmdma = pci_resource_start(pdev, 4);
+ if (bmdma) {
+ if (inb(bmdma + 2) & 0x80)
+ probe_ent->host_set_flags |= ATA_HOST_SIMPLEX;
+ probe_ent->port[p].bmdma_addr = bmdma;
+ }
ata_std_ports(&probe_ent->port[p]);
p++;
}
@@ -726,7 +732,13 @@ ata_pci_init_native_mode(struct pci_dev
probe_ent->port[p].altstatus_addr =
probe_ent->port[p].ctl_addr =
pci_resource_start(pdev, 3) | ATA_PCI_CTL_OFS;
- probe_ent->port[p].bmdma_addr = pci_resource_start(pdev, 4) + 8;
+ bmdma = pci_resource_start(pdev, 4);
+ if (bmdma) {
+ bmdma += 8;
+ if(inb(bmdma + 2) & 0x80)
+ probe_ent->host_set_flags |= ATA_HOST_SIMPLEX;
+ probe_ent->port[p].bmdma_addr = bmdma;
+ }
ata_std_ports(&probe_ent->port[p]);
p++;
}
@@ -740,6 +752,7 @@ static struct ata_probe_ent *ata_pci_ini
struct ata_port_info *port, int port_num)
{
struct ata_probe_ent *probe_ent;
+ unsigned long bmdma;
probe_ent = ata_probe_ent_alloc(pci_dev_to_dev(pdev), port);
if (!probe_ent)
@@ -766,8 +779,13 @@ static struct ata_probe_ent *ata_pci_ini
break;
}
- probe_ent->port[0].bmdma_addr =
- pci_resource_start(pdev, 4) + 8 * port_num;
+ bmdma = pci_resource_start(pdev, 4);
+ if (bmdma != 0) {
+ bmdma += 8 * port_num;
+ probe_ent->port[0].bmdma_addr = bmdma;
+ if (inb(bmdma + 2) & 0x80)
+ probe_ent->host_set_flags |= ATA_HOST_SIMPLEX;
+ }
ata_std_ports(&probe_ent->port[0]);
return probe_ent;
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 9fcc061..26e0351 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -160,6 +161,9 @@ enum {
ATA_QCFLAG_DMAMAP = ATA_QCFLAG_SG | ATA_QCFLAG_SINGLE,
ATA_QCFLAG_EH_SCHEDULED = (1 << 5), /* EH scheduled */
+ /* host set flags */
+ ATA_HOST_SIMPLEX = (1 << 0), /* Host is simplex, one DMA channel per host_set only */
+
/* various lengths of time */
ATA_TMOUT_PIO = 30 * HZ,
ATA_TMOUT_BOOT = 30 * HZ, /* heuristic */
@@ -278,6 +282,7 @@ struct ata_probe_ent {
unsigned long irq;
unsigned int irq_flags;
unsigned long host_flags;
+ unsigned long host_set_flags;
void __iomem *mmio_base;
void *private_data;
};
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: PATCH: libata. BMDMA handling updates
2006-03-27 17:42 PATCH: libata. BMDMA handling updates Alan Cox
@ 2006-03-29 4:17 ` Tejun Heo
2006-03-30 0:31 ` Jeff Garzik
1 sibling, 0 replies; 3+ messages in thread
From: Tejun Heo @ 2006-03-29 4:17 UTC (permalink / raw)
To: Alan Cox; +Cc: linux-kernel, jgarzik
Hello, Alan.
Can you please cc linux-ide next time?
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: PATCH: libata. BMDMA handling updates
2006-03-27 17:42 PATCH: libata. BMDMA handling updates Alan Cox
2006-03-29 4:17 ` Tejun Heo
@ 2006-03-30 0:31 ` Jeff Garzik
1 sibling, 0 replies; 3+ messages in thread
From: Jeff Garzik @ 2006-03-30 0:31 UTC (permalink / raw)
To: Alan Cox; +Cc: linux-kernel
Alan Cox wrote:
> This is the minimal patch set to enable the current code to be used with
> a controller following SFF (ie any PATA and early SATA controllers)
> safely without crashes if there is no BMDMA area or if BMDMA is not
> assigned by the BIOS for some reason.
>
> Simplex status is recorded but not acted upon in this change, this isn't
> a problem with the current drivers as none of them are for simplex
> hardware. A following diff will deal with that.
>
> The flags in the probe structure remain ->host_set_flags although Jeff
> asked me to rename them, simply because the rename would break the usual
> Linux rules that old code should break when there are changes. not
> compile and run and then blow up/eat your computer/etc. Renaming this
> later is a trivial exercise once a better name is chosen.
applied
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-03-30 0:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-27 17:42 PATCH: libata. BMDMA handling updates Alan Cox
2006-03-29 4:17 ` Tejun Heo
2006-03-30 0:31 ` Jeff Garzik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox