diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-12-29 14:27:36 -0500 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-12-29 14:27:36 -0500 |
commit | 702c026be87ef8374ae58122969a4b0b081ce6f2 (patch) | |
tree | d8ea68e4c85dd648d7b4ede14831dac1deac6300 /drivers/ide/ide-probe.c | |
parent | b7876a6fb6e9bf6cbcf7b40cf034aa4138d7978f (diff) |
ide: rework handling of serialized ports (v2)
* hpt366: set IDE_HFLAG_SERIALIZE in ->host_flags if needed
in init_hwif_hpt366(). Remove HPT_SERIALIZE_IO while at it.
* Set IDE_HFLAG_SERIALIZE in ->host_flags if needed in
ide_init_port().
* Convert init_irq() to use IDE_HFLAG_SERIALIZE together with
hwif->host to find out ports which need to be serialized.
* Remove no longer needed save_match() and ide_hwif_t.serialized.
v2:
* Set host's ->host_flags field instead of port's copy.
This patch should fix the incorrect grouping of port(s) from
host(s) that need serialization with port(s) that happen to use
the same IRQ(s) but are from the host(s) that don't need it.
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-probe.c')
-rw-r--r-- | drivers/ide/ide-probe.c | 50 |
1 files changed, 5 insertions, 45 deletions
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index f76c22c45086..c1cd1af2646b 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
@@ -864,31 +864,6 @@ static void ide_port_tune_devices(ide_hwif_t *hwif) | |||
864 | } | 864 | } |
865 | 865 | ||
866 | /* | 866 | /* |
867 | * save_match() is used to simplify logic in init_irq() below. | ||
868 | * | ||
869 | * A loophole here is that we may not know about a particular | ||
870 | * hwif's irq until after that hwif is actually probed/initialized.. | ||
871 | * This could be a problem for the case where an hwif is on a | ||
872 | * dual interface that requires serialization (eg. cmd640) and another | ||
873 | * hwif using one of the same irqs is initialized beforehand. | ||
874 | * | ||
875 | * This routine detects and reports such situations, but does not fix them. | ||
876 | */ | ||
877 | static void save_match(ide_hwif_t *hwif, ide_hwif_t *new, ide_hwif_t **match) | ||
878 | { | ||
879 | ide_hwif_t *m = *match; | ||
880 | |||
881 | if (m && m->hwgroup && m->hwgroup != new->hwgroup) { | ||
882 | if (!new->hwgroup) | ||
883 | return; | ||
884 | printk(KERN_WARNING "%s: potential IRQ problem with %s and %s\n", | ||
885 | hwif->name, new->name, m->name); | ||
886 | } | ||
887 | if (!m || m->irq != hwif->irq) /* don't undo a prior perfect match */ | ||
888 | *match = new; | ||
889 | } | ||
890 | |||
891 | /* | ||
892 | * init request queue | 867 | * init request queue |
893 | */ | 868 | */ |
894 | static int ide_init_queue(ide_drive_t *drive) | 869 | static int ide_init_queue(ide_drive_t *drive) |
@@ -1052,26 +1027,13 @@ static int init_irq (ide_hwif_t *hwif) | |||
1052 | mutex_lock(&ide_cfg_mtx); | 1027 | mutex_lock(&ide_cfg_mtx); |
1053 | hwif->hwgroup = NULL; | 1028 | hwif->hwgroup = NULL; |
1054 | 1029 | ||
1055 | /* | ||
1056 | * Group up with any other hwifs that share our irq(s). | ||
1057 | */ | ||
1058 | for (index = 0; index < MAX_HWIFS; index++) { | 1030 | for (index = 0; index < MAX_HWIFS; index++) { |
1059 | ide_hwif_t *h = ide_ports[index]; | 1031 | ide_hwif_t *h = ide_ports[index]; |
1060 | 1032 | ||
1061 | if (h && h->hwgroup) { /* scan only initialized ports */ | 1033 | if (h && h->hwgroup) { /* scan only initialized ports */ |
1062 | if (hwif->irq == h->irq) { | 1034 | if (hwif->host->host_flags & IDE_HFLAG_SERIALIZE) { |
1063 | if (hwif->chipset != ide_pci || | 1035 | if (hwif->host == h->host) |
1064 | h->chipset != ide_pci) { | 1036 | match = h; |
1065 | save_match(hwif, h, &match); | ||
1066 | } | ||
1067 | } | ||
1068 | if (hwif->serialized) { | ||
1069 | if (hwif->mate && hwif->mate->irq == h->irq) | ||
1070 | save_match(hwif, h, &match); | ||
1071 | } | ||
1072 | if (h->serialized) { | ||
1073 | if (h->mate && hwif->irq == h->mate->irq) | ||
1074 | save_match(hwif, h, &match); | ||
1075 | } | 1037 | } |
1076 | } | 1038 | } |
1077 | } | 1039 | } |
@@ -1437,10 +1399,8 @@ static void ide_init_port(ide_hwif_t *hwif, unsigned int port, | |||
1437 | } | 1399 | } |
1438 | 1400 | ||
1439 | if ((d->host_flags & IDE_HFLAG_SERIALIZE) || | 1401 | if ((d->host_flags & IDE_HFLAG_SERIALIZE) || |
1440 | ((d->host_flags & IDE_HFLAG_SERIALIZE_DMA) && hwif->dma_base)) { | 1402 | ((d->host_flags & IDE_HFLAG_SERIALIZE_DMA) && hwif->dma_base)) |
1441 | if (hwif->mate) | 1403 | hwif->host->host_flags |= IDE_HFLAG_SERIALIZE; |
1442 | hwif->mate->serialized = hwif->serialized = 1; | ||
1443 | } | ||
1444 | 1404 | ||
1445 | if (d->max_sectors) | 1405 | if (d->max_sectors) |
1446 | hwif->rqsize = d->max_sectors; | 1406 | hwif->rqsize = d->max_sectors; |