diff options
Diffstat (limited to 'drivers/ide/ide-dma.c')
-rw-r--r-- | drivers/ide/ide-dma.c | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index a5612eadc306..f9c91752f275 100644 --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c | |||
@@ -245,12 +245,11 @@ static unsigned int ide_get_mode_mask(ide_drive_t *drive, u8 base, u8 req_mode) | |||
245 | case XFER_UDMA_0: | 245 | case XFER_UDMA_0: |
246 | if ((id[ATA_ID_FIELD_VALID] & 4) == 0) | 246 | if ((id[ATA_ID_FIELD_VALID] & 4) == 0) |
247 | break; | 247 | break; |
248 | 248 | mask = id[ATA_ID_UDMA_MODES]; | |
249 | if (port_ops && port_ops->udma_filter) | 249 | if (port_ops && port_ops->udma_filter) |
250 | mask = port_ops->udma_filter(drive); | 250 | mask &= port_ops->udma_filter(drive); |
251 | else | 251 | else |
252 | mask = hwif->ultra_mask; | 252 | mask &= hwif->ultra_mask; |
253 | mask &= id[ATA_ID_UDMA_MODES]; | ||
254 | 253 | ||
255 | /* | 254 | /* |
256 | * avoid false cable warning from eighty_ninty_three() | 255 | * avoid false cable warning from eighty_ninty_three() |
@@ -261,18 +260,15 @@ static unsigned int ide_get_mode_mask(ide_drive_t *drive, u8 base, u8 req_mode) | |||
261 | } | 260 | } |
262 | break; | 261 | break; |
263 | case XFER_MW_DMA_0: | 262 | case XFER_MW_DMA_0: |
264 | if ((id[ATA_ID_FIELD_VALID] & 2) == 0) | 263 | mask = id[ATA_ID_MWDMA_MODES]; |
265 | break; | ||
266 | if (port_ops && port_ops->mdma_filter) | 264 | if (port_ops && port_ops->mdma_filter) |
267 | mask = port_ops->mdma_filter(drive); | 265 | mask &= port_ops->mdma_filter(drive); |
268 | else | 266 | else |
269 | mask = hwif->mwdma_mask; | 267 | mask &= hwif->mwdma_mask; |
270 | mask &= id[ATA_ID_MWDMA_MODES]; | ||
271 | break; | 268 | break; |
272 | case XFER_SW_DMA_0: | 269 | case XFER_SW_DMA_0: |
273 | if (id[ATA_ID_FIELD_VALID] & 2) { | 270 | mask = id[ATA_ID_SWDMA_MODES]; |
274 | mask = id[ATA_ID_SWDMA_MODES] & hwif->swdma_mask; | 271 | if (!(mask & ATA_SWDMA2) && (id[ATA_ID_OLD_DMA_MODES] >> 8)) { |
275 | } else if (id[ATA_ID_OLD_DMA_MODES] >> 8) { | ||
276 | u8 mode = id[ATA_ID_OLD_DMA_MODES] >> 8; | 272 | u8 mode = id[ATA_ID_OLD_DMA_MODES] >> 8; |
277 | 273 | ||
278 | /* | 274 | /* |
@@ -280,8 +276,9 @@ static unsigned int ide_get_mode_mask(ide_drive_t *drive, u8 base, u8 req_mode) | |||
280 | * (the maximum allowed mode is XFER_SW_DMA_2) | 276 | * (the maximum allowed mode is XFER_SW_DMA_2) |
281 | */ | 277 | */ |
282 | if (mode <= 2) | 278 | if (mode <= 2) |
283 | mask = ((2 << mode) - 1) & hwif->swdma_mask; | 279 | mask = (2 << mode) - 1; |
284 | } | 280 | } |
281 | mask &= hwif->swdma_mask; | ||
285 | break; | 282 | break; |
286 | default: | 283 | default: |
287 | BUG(); | 284 | BUG(); |
@@ -398,11 +395,10 @@ int ide_id_dma_bug(ide_drive_t *drive) | |||
398 | if ((id[ATA_ID_UDMA_MODES] >> 8) && | 395 | if ((id[ATA_ID_UDMA_MODES] >> 8) && |
399 | (id[ATA_ID_MWDMA_MODES] >> 8)) | 396 | (id[ATA_ID_MWDMA_MODES] >> 8)) |
400 | goto err_out; | 397 | goto err_out; |
401 | } else if (id[ATA_ID_FIELD_VALID] & 2) { | 398 | } else if ((id[ATA_ID_MWDMA_MODES] >> 8) && |
402 | if ((id[ATA_ID_MWDMA_MODES] >> 8) && | 399 | (id[ATA_ID_SWDMA_MODES] >> 8)) |
403 | (id[ATA_ID_SWDMA_MODES] >> 8)) | 400 | goto err_out; |
404 | goto err_out; | 401 | |
405 | } | ||
406 | return 0; | 402 | return 0; |
407 | err_out: | 403 | err_out: |
408 | printk(KERN_ERR "%s: bad DMA info in identify block\n", drive->name); | 404 | printk(KERN_ERR "%s: bad DMA info in identify block\n", drive->name); |