diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-13 15:39:36 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-13 15:39:36 -0400 |
commit | 97100fc816badbbc162644cfde7ad39ae9211fb4 (patch) | |
tree | 904faf5453c2dea32fa3fde5fda230118f3effda /drivers/ide/pci | |
parent | be3c096ebdbe3c828aacb5473751a22840753eff (diff) |
ide: add device flags
Add 'unsigned long dev_flags' to ide_drive_t and convert bitfields
to IDE_DFLAG_* flags.
While at it:
- IDE_DFLAG_ADDRESSING -> IDE_DFLAG_LBA48
- fixup some comments
- remove needless g->flags zeroing from ide*_probe()
There should be no functional changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/pci')
-rw-r--r-- | drivers/ide/pci/amd74xx.c | 2 | ||||
-rw-r--r-- | drivers/ide/pci/cmd640.c | 14 | ||||
-rw-r--r-- | drivers/ide/pci/it821x.c | 2 | ||||
-rw-r--r-- | drivers/ide/pci/ns87415.c | 11 | ||||
-rw-r--r-- | drivers/ide/pci/pdc202xx_old.c | 4 | ||||
-rw-r--r-- | drivers/ide/pci/sc1200.c | 3 | ||||
-rw-r--r-- | drivers/ide/pci/trm290.c | 4 |
7 files changed, 23 insertions, 17 deletions
diff --git a/drivers/ide/pci/amd74xx.c b/drivers/ide/pci/amd74xx.c index 824471f91bf5..7dbc692c84c3 100644 --- a/drivers/ide/pci/amd74xx.c +++ b/drivers/ide/pci/amd74xx.c | |||
@@ -92,7 +92,7 @@ static void amd_set_drive(ide_drive_t *drive, const u8 speed) | |||
92 | 92 | ||
93 | ide_timing_compute(drive, speed, &t, T, UT); | 93 | ide_timing_compute(drive, speed, &t, T, UT); |
94 | 94 | ||
95 | if (peer->present) { | 95 | if (peer->dev_flags & IDE_DFLAG_PRESENT) { |
96 | ide_timing_compute(peer, peer->current_speed, &p, T, UT); | 96 | ide_timing_compute(peer, peer->current_speed, &p, T, UT); |
97 | ide_timing_merge(&p, &t, &t, IDE_TIMING_8BIT); | 97 | ide_timing_merge(&p, &t, &t, IDE_TIMING_8BIT); |
98 | } | 98 | } |
diff --git a/drivers/ide/pci/cmd640.c b/drivers/ide/pci/cmd640.c index 7f39cdb41410..d3afdffcb07a 100644 --- a/drivers/ide/pci/cmd640.c +++ b/drivers/ide/pci/cmd640.c | |||
@@ -378,13 +378,13 @@ static void __set_prefetch_mode(ide_drive_t *drive, int mode) | |||
378 | { | 378 | { |
379 | if (mode) { /* want prefetch on? */ | 379 | if (mode) { /* want prefetch on? */ |
380 | #if CMD640_PREFETCH_MASKS | 380 | #if CMD640_PREFETCH_MASKS |
381 | drive->no_unmask = 1; | 381 | drive->dev_flags |= IDE_DFLAG_NO_UNMASK; |
382 | drive->unmask = 0; | 382 | drive->dev_flags &= ~IDE_DFLAG_UNMASK; |
383 | #endif | 383 | #endif |
384 | drive->no_io_32bit = 0; | 384 | drive->dev_flags &= ~IDE_DFLAG_NO_IO_32BIT; |
385 | } else { | 385 | } else { |
386 | drive->no_unmask = 0; | 386 | drive->dev_flags &= ~IDE_DFLAG_NO_UNMASK; |
387 | drive->no_io_32bit = 1; | 387 | drive->dev_flags |= IDE_DFLAG_NO_IO_32BIT; |
388 | drive->io_32bit = 0; | 388 | drive->io_32bit = 0; |
389 | } | 389 | } |
390 | } | 390 | } |
@@ -471,7 +471,7 @@ static void program_drive_counts(ide_drive_t *drive, unsigned int index) | |||
471 | ide_drive_t *peer = &hwif->drives[!drive->select.b.unit]; | 471 | ide_drive_t *peer = &hwif->drives[!drive->select.b.unit]; |
472 | unsigned int mate = index ^ 1; | 472 | unsigned int mate = index ^ 1; |
473 | 473 | ||
474 | if (peer->present) { | 474 | if (peer->dev_flags & IDE_DFLAG_PRESENT) { |
475 | if (setup_count < setup_counts[mate]) | 475 | if (setup_count < setup_counts[mate]) |
476 | setup_count = setup_counts[mate]; | 476 | setup_count = setup_counts[mate]; |
477 | if (active_count < active_counts[mate]) | 477 | if (active_count < active_counts[mate]) |
@@ -626,7 +626,7 @@ static void cmd640_init_dev(ide_drive_t *drive) | |||
626 | */ | 626 | */ |
627 | check_prefetch(drive, i); | 627 | check_prefetch(drive, i); |
628 | printk(KERN_INFO DRV_NAME ": drive%d timings/prefetch(%s) preserved\n", | 628 | printk(KERN_INFO DRV_NAME ": drive%d timings/prefetch(%s) preserved\n", |
629 | i, drive->no_io_32bit ? "off" : "on"); | 629 | i, (drive->dev_flags & IDE_DFLAG_NO_IO_32BIT) ? "off" : "on"); |
630 | #endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ | 630 | #endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ |
631 | } | 631 | } |
632 | 632 | ||
diff --git a/drivers/ide/pci/it821x.c b/drivers/ide/pci/it821x.c index 46edd083b348..b761015ee190 100644 --- a/drivers/ide/pci/it821x.c +++ b/drivers/ide/pci/it821x.c | |||
@@ -454,7 +454,7 @@ static void it821x_quirkproc(ide_drive_t *drive) | |||
454 | * IRQ mask as we may well be in PIO (eg rev 0x10) | 454 | * IRQ mask as we may well be in PIO (eg rev 0x10) |
455 | * for now and we know unmasking is safe on this chipset. | 455 | * for now and we know unmasking is safe on this chipset. |
456 | */ | 456 | */ |
457 | drive->unmask = 1; | 457 | drive->dev_flags |= IDE_DFLAG_UNMASK; |
458 | } else { | 458 | } else { |
459 | /* | 459 | /* |
460 | * Perform fixups on smart mode. We need to "lose" some | 460 | * Perform fixups on smart mode. We need to "lose" some |
diff --git a/drivers/ide/pci/ns87415.c b/drivers/ide/pci/ns87415.c index 53bd645736d9..99e98e5e271c 100644 --- a/drivers/ide/pci/ns87415.c +++ b/drivers/ide/pci/ns87415.c | |||
@@ -137,7 +137,7 @@ static void __devinit superio_init_iops(struct hwif_s *hwif) | |||
137 | static unsigned int ns87415_count = 0, ns87415_control[MAX_HWIFS] = { 0 }; | 137 | static unsigned int ns87415_count = 0, ns87415_control[MAX_HWIFS] = { 0 }; |
138 | 138 | ||
139 | /* | 139 | /* |
140 | * This routine either enables/disables (according to drive->present) | 140 | * This routine either enables/disables (according to IDE_DFLAG_PRESENT) |
141 | * the IRQ associated with the port (HWIF(drive)), | 141 | * the IRQ associated with the port (HWIF(drive)), |
142 | * and selects either PIO or DMA handshaking for the next I/O operation. | 142 | * and selects either PIO or DMA handshaking for the next I/O operation. |
143 | */ | 143 | */ |
@@ -153,7 +153,11 @@ static void ns87415_prepare_drive (ide_drive_t *drive, unsigned int use_dma) | |||
153 | 153 | ||
154 | /* Adjust IRQ enable bit */ | 154 | /* Adjust IRQ enable bit */ |
155 | bit = 1 << (8 + hwif->channel); | 155 | bit = 1 << (8 + hwif->channel); |
156 | new = drive->present ? (new & ~bit) : (new | bit); | 156 | |
157 | if (drive->dev_flags & IDE_DFLAG_PRESENT) | ||
158 | new &= ~bit; | ||
159 | else | ||
160 | new |= bit; | ||
157 | 161 | ||
158 | /* Select PIO or DMA, DMA may only be selected for one drive/channel. */ | 162 | /* Select PIO or DMA, DMA may only be selected for one drive/channel. */ |
159 | bit = 1 << (20 + drive->select.b.unit + (hwif->channel << 1)); | 163 | bit = 1 << (20 + drive->select.b.unit + (hwif->channel << 1)); |
@@ -187,7 +191,8 @@ static void ns87415_prepare_drive (ide_drive_t *drive, unsigned int use_dma) | |||
187 | 191 | ||
188 | static void ns87415_selectproc (ide_drive_t *drive) | 192 | static void ns87415_selectproc (ide_drive_t *drive) |
189 | { | 193 | { |
190 | ns87415_prepare_drive (drive, drive->using_dma); | 194 | ns87415_prepare_drive(drive, |
195 | !!(drive->dev_flags & IDE_DFLAG_USING_DMA)); | ||
191 | } | 196 | } |
192 | 197 | ||
193 | static int ns87415_dma_end(ide_drive_t *drive) | 198 | static int ns87415_dma_end(ide_drive_t *drive) |
diff --git a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c index cb6d2a00c514..6d9240a9dcfa 100644 --- a/drivers/ide/pci/pdc202xx_old.c +++ b/drivers/ide/pci/pdc202xx_old.c | |||
@@ -168,7 +168,7 @@ static void pdc202xx_dma_start(ide_drive_t *drive) | |||
168 | { | 168 | { |
169 | if (drive->current_speed > XFER_UDMA_2) | 169 | if (drive->current_speed > XFER_UDMA_2) |
170 | pdc_old_enable_66MHz_clock(drive->hwif); | 170 | pdc_old_enable_66MHz_clock(drive->hwif); |
171 | if (drive->media != ide_disk || drive->addressing == 1) { | 171 | if (drive->media != ide_disk || (drive->dev_flags & IDE_DFLAG_LBA48)) { |
172 | struct request *rq = HWGROUP(drive)->rq; | 172 | struct request *rq = HWGROUP(drive)->rq; |
173 | ide_hwif_t *hwif = HWIF(drive); | 173 | ide_hwif_t *hwif = HWIF(drive); |
174 | unsigned long high_16 = hwif->extra_base - 16; | 174 | unsigned long high_16 = hwif->extra_base - 16; |
@@ -188,7 +188,7 @@ static void pdc202xx_dma_start(ide_drive_t *drive) | |||
188 | 188 | ||
189 | static int pdc202xx_dma_end(ide_drive_t *drive) | 189 | static int pdc202xx_dma_end(ide_drive_t *drive) |
190 | { | 190 | { |
191 | if (drive->media != ide_disk || drive->addressing == 1) { | 191 | if (drive->media != ide_disk || (drive->dev_flags & IDE_DFLAG_LBA48)) { |
192 | ide_hwif_t *hwif = HWIF(drive); | 192 | ide_hwif_t *hwif = HWIF(drive); |
193 | unsigned long high_16 = hwif->extra_base - 16; | 193 | unsigned long high_16 = hwif->extra_base - 16; |
194 | unsigned long atapi_reg = high_16 + (hwif->channel ? 0x24 : 0x20); | 194 | unsigned long atapi_reg = high_16 + (hwif->channel ? 0x24 : 0x20); |
diff --git a/drivers/ide/pci/sc1200.c b/drivers/ide/pci/sc1200.c index bdc1fed41260..50405ed6f0cb 100644 --- a/drivers/ide/pci/sc1200.c +++ b/drivers/ide/pci/sc1200.c | |||
@@ -216,7 +216,8 @@ static void sc1200_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
216 | if (mode != -1) { | 216 | if (mode != -1) { |
217 | printk("SC1200: %s: changing (U)DMA mode\n", drive->name); | 217 | printk("SC1200: %s: changing (U)DMA mode\n", drive->name); |
218 | ide_dma_off_quietly(drive); | 218 | ide_dma_off_quietly(drive); |
219 | if (ide_set_dma_mode(drive, mode) == 0 && drive->using_dma) | 219 | if (ide_set_dma_mode(drive, mode) == 0 && |
220 | (drive->dev_flags & IDE_DFLAG_USING_DMA)) | ||
220 | hwif->dma_ops->dma_host_set(drive, 1); | 221 | hwif->dma_ops->dma_host_set(drive, 1); |
221 | return; | 222 | return; |
222 | } | 223 | } |
diff --git a/drivers/ide/pci/trm290.c b/drivers/ide/pci/trm290.c index 4dfbc6a68b5b..c12ffbb28748 100644 --- a/drivers/ide/pci/trm290.c +++ b/drivers/ide/pci/trm290.c | |||
@@ -161,7 +161,7 @@ static void trm290_prepare_drive (ide_drive_t *drive, unsigned int use_dma) | |||
161 | } | 161 | } |
162 | 162 | ||
163 | /* enable IRQ if not probing */ | 163 | /* enable IRQ if not probing */ |
164 | if (drive->present) { | 164 | if (drive->dev_flags & IDE_DFLAG_PRESENT) { |
165 | reg = inw(hwif->config_data + 3); | 165 | reg = inw(hwif->config_data + 3); |
166 | reg &= 0x13; | 166 | reg &= 0x13; |
167 | reg &= ~(1 << hwif->channel); | 167 | reg &= ~(1 << hwif->channel); |
@@ -173,7 +173,7 @@ static void trm290_prepare_drive (ide_drive_t *drive, unsigned int use_dma) | |||
173 | 173 | ||
174 | static void trm290_selectproc (ide_drive_t *drive) | 174 | static void trm290_selectproc (ide_drive_t *drive) |
175 | { | 175 | { |
176 | trm290_prepare_drive(drive, drive->using_dma); | 176 | trm290_prepare_drive(drive, !!(drive->dev_flags & IDE_DFLAG_USING_DMA)); |
177 | } | 177 | } |
178 | 178 | ||
179 | static void trm290_dma_exec_cmd(ide_drive_t *drive, u8 command) | 179 | static void trm290_dma_exec_cmd(ide_drive_t *drive, u8 command) |