aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-12-29 14:27:36 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-12-29 14:27:36 -0500
commit702c026be87ef8374ae58122969a4b0b081ce6f2 (patch)
treed8ea68e4c85dd648d7b4ede14831dac1deac6300 /drivers/ide
parentb7876a6fb6e9bf6cbcf7b40cf034aa4138d7978f (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')
-rw-r--r--drivers/ide/hpt366.c8
-rw-r--r--drivers/ide/ide-probe.c50
2 files changed, 6 insertions, 52 deletions
diff --git a/drivers/ide/hpt366.c b/drivers/ide/hpt366.c
index f5afd46ed51c..b18e10d99d2e 100644
--- a/drivers/ide/hpt366.c
+++ b/drivers/ide/hpt366.c
@@ -135,7 +135,6 @@
135/* various tuning parameters */ 135/* various tuning parameters */
136#define HPT_RESET_STATE_ENGINE 136#define HPT_RESET_STATE_ENGINE
137#undef HPT_DELAY_INTERRUPT 137#undef HPT_DELAY_INTERRUPT
138#define HPT_SERIALIZE_IO 0
139 138
140static const char *quirk_drives[] = { 139static const char *quirk_drives[] = {
141 "QUANTUM FIREBALLlct08 08", 140 "QUANTUM FIREBALLlct08 08",
@@ -1288,7 +1287,6 @@ static u8 hpt3xx_cable_detect(ide_hwif_t *hwif)
1288static void __devinit init_hwif_hpt366(ide_hwif_t *hwif) 1287static void __devinit init_hwif_hpt366(ide_hwif_t *hwif)
1289{ 1288{
1290 struct hpt_info *info = hpt3xx_get_info(hwif->dev); 1289 struct hpt_info *info = hpt3xx_get_info(hwif->dev);
1291 int serialize = HPT_SERIALIZE_IO;
1292 u8 chip_type = info->chip_type; 1290 u8 chip_type = info->chip_type;
1293 1291
1294 /* Cache the channel's MISC. control registers' offset */ 1292 /* Cache the channel's MISC. control registers' offset */
@@ -1305,13 +1303,9 @@ static void __devinit init_hwif_hpt366(ide_hwif_t *hwif)
1305 * Clock is shared between the channels, 1303 * Clock is shared between the channels,
1306 * so we'll have to serialize them... :-( 1304 * so we'll have to serialize them... :-(
1307 */ 1305 */
1308 serialize = 1; 1306 hwif->host->host_flags |= IDE_HFLAG_SERIALIZE;
1309 hwif->rw_disk = &hpt3xxn_rw_disk; 1307 hwif->rw_disk = &hpt3xxn_rw_disk;
1310 } 1308 }
1311
1312 /* Serialize access to this device if needed */
1313 if (serialize && hwif->mate)
1314 hwif->serialized = hwif->mate->serialized = 1;
1315} 1309}
1316 1310
1317static int __devinit init_dma_hpt366(ide_hwif_t *hwif, 1311static int __devinit init_dma_hpt366(ide_hwif_t *hwif,
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 */
877static 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 */
894static int ide_init_queue(ide_drive_t *drive) 869static 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;