ide: fix UDMA/MWDMA/SWDMA masks
[PATCH] ide: fix UDMA/MWDMA/SWDMA masks
* use 0x00 instead of 0x80 to disable ->{ultra,mwdma,swdma}_mask
* add udma_mask field to ide_pci_device_t and use it to initialize ->ultra_mask in aec62xx, cmd64x, pdc202xx_{new,old} and piix drivers
* fix UDMA masks to match with chipset specific *_ratemask() (alim15x3, hpt366, serverworks and siimage drivers need UDMA mask filtering method - done in the next patch)
v2:
* piix: fix cable detection for 82801AA_1 and 82372FB_1
[ Noticed by Sergei Shtylyov <[email protected]>. ]
* cmd64x: use hwif->cds->udma_mask
[ Suggested by Sergei Shtylyov <[email protected]>. ]
* aec62xx: fix newly introduced bug - check DMA status not command register [ Noticed by Sergei Shtylyov <[email protected]>. ]
v3:
* piix: use hwif->cds->udma_mask
[ Suggested by Sergei Shtylyov <[email protected]>. ]
--- drivers/ide/ide.c | 3 - drivers/ide/pci/aec62xx.c | 19 +++++++++- drivers/ide/pci/alim15x3.c | 13 ++++++- drivers/ide/pci/cmd64x.c | 15 ++++---- drivers/ide/pci/pdc202xx_new.c | 9 ++++- drivers/ide/pci/pdc202xx_old.c | 7 +++ drivers/ide/pci/piix.c | 73 +++++++++++++++++------------------------ drivers/ide/pci/sis5513.c | 5 ++ include/linux/ide.h | 1 9 files changed, 86 insertions(+), 59 deletions(-)
drivers/ide/ide.c +0 -3
@@ -222,9 +222,6 @@ static void init_hwif_data(ide_hwif_t *h hwif->bus_state =BUSSTATE_ON ; hwif->atapi_dma =0 ;/* disable all atapi dma */ - hwif->ultra_mask =0x80 ;/* disable all ultra */ - hwif->mwdma_mask =0x80 ;/* disable all mwdma */ - hwif->swdma_mask =0x80 ;/* disable all swdma */ init_completion (&hwif->gendev_rel_comp);
drivers/ide/pci/aec62xx.c +17 -2
@@ -270,11 +270,13 @@ static unsigned int __devinit init_chipsstatic void __devinit init_hwif_aec62xx (ide_hwif_t *hwif) { +struct pci_dev *dev = hwif->pci_dev; + hwif->autodma =0 ; hwif->tuneproc = &aec62xx_tune_drive; hwif->speedproc = &aec62xx_tune_chipset; -if (hwif->pci_dev->device ==PCI_DEVICE_ID_ARTOP_ATP850UF ) +if (dev->device ==PCI_DEVICE_ID_ARTOP_ATP850UF ) hwif->serialized = hwif->channel;if (hwif->mate)
@@ -286,7 +288,15 @@ static void __devinit init_hwif_aec62xx(return ; } - hwif->ultra_mask =0x7f ; + hwif->ultra_mask = hwif->cds->udma_mask; + +/* atp865 and atp865r */ +if (hwif->ultra_mask ==0x3f ) { +/* check bit 0x10 of DMA status register */ +if (inb (pci_resource_start (dev,4 ) +2 ) &0x10 ) + hwif->ultra_mask =0x7f ;/* udma0-6 */ + } + hwif->mwdma_mask =0x07 ; hwif->swdma_mask =0x07 ;
@@ -354,6 +364,7 @@ static ide_pci_device_t aec62xx_chipsets .autodma = AUTODMA, .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, .bootable = OFF_BOARD, + .udma_mask = 0x07, /* udma0-2 */ },{ /* 1 */ .name = "AEC6260", .init_setup = init_setup_aec62xx,
@@ -363,6 +374,7 @@ static ide_pci_device_t aec62xx_chipsets .channels = 2, .autodma = NOAUTODMA, .bootable = OFF_BOARD, + .udma_mask = 0x1f, /* udma0-4 */ },{ /* 2 */ .name = "AEC6260R", .init_setup = init_setup_aec62xx,
@@ -373,6 +385,7 @@ static ide_pci_device_t aec62xx_chipsets .autodma = AUTODMA, .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, .bootable = NEVER_BOARD, + .udma_mask = 0x1f, /* udma0-4 */ },{ /* 3 */ .name = "AEC6X80", .init_setup = init_setup_aec6x80,
@@ -382,6 +395,7 @@ static ide_pci_device_t aec62xx_chipsets .channels = 2, .autodma = AUTODMA, .bootable = OFF_BOARD, + .udma_mask = 0x3f, /* udma0-5 */ },{ /* 4 */ .name = "AEC6X80R", .init_setup = init_setup_aec6x80,
@@ -392,6 +406,7 @@ static ide_pci_device_t aec62xx_chipsets .autodma = AUTODMA, .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, .bootable = OFF_BOARD, + .udma_mask = 0x3f, /* udma0-5 */ } };
drivers/ide/pci/alim15x3.c +11 -2
@@ -765,8 +765,17 @@ static void __devinit init_hwif_common_a hwif->atapi_dma =1 ; -if (m5229_revision >0x20 ) - hwif->ultra_mask =0x7f ; +if (m5229_revision <=0x20 ) + hwif->ultra_mask =0x00 ;/* no udma */ +else if (m5229_revision <0xC2 ) + hwif->ultra_mask =0x07 ;/* udma0-2 */ +else if (m5229_revision ==0xC2 || m5229_revision ==0xC3 ) + hwif->ultra_mask =0x1f ;/* udma0-4 */ +else if (m5229_revision ==0xC4 ) + hwif->ultra_mask =0x3f ;/* udma0-5 */ +else + hwif->ultra_mask =0x7f ;/* udma0-6 */ + hwif->mwdma_mask =0x07 ; hwif->swdma_mask =0x07 ;
drivers/ide/pci/cmd64x.c +8 -7
@@ -690,16 +690,13 @@ static void __devinit init_hwif_cmd64x(i hwif->atapi_dma =1 ; - hwif->ultra_mask =0x3f ; hwif->mwdma_mask =0x07 ; hwif->swdma_mask =0x07 ; -if (dev->device ==PCI_DEVICE_ID_CMD_643 ) - hwif->ultra_mask =0x80 ; -if (dev->device ==PCI_DEVICE_ID_CMD_646 ) - hwif->ultra_mask = (class_rev >0x04 ) ?0x07 :0x80 ; -if (dev->device ==PCI_DEVICE_ID_CMD_648 ) - hwif->ultra_mask =0x1f ; + hwif->ultra_mask = hwif->cds->udma_mask; + +if (dev->device ==PCI_DEVICE_ID_CMD_646 && class_rev <5 ) + hwif->ultra_mask =0x00 ; hwif->ide_dma_check = &cmd64x_config_drive_for_dma;if (!(hwif->udma_four))
@@ -733,6 +730,7 @@ static ide_pci_device_t cmd64x_chipsets[ .channels = 2, .autodma = AUTODMA, .bootable = ON_BOARD, + .udma_mask = 0x00, /* no udma */ },{ /* 1 */ .name = "CMD646", .init_chipset = init_chipset_cmd64x,
@@ -741,6 +739,7 @@ static ide_pci_device_t cmd64x_chipsets[ .autodma = AUTODMA, .enablebits = {{0x00,0x00,0x00}, {0x51,0x80,0x80}}, .bootable = ON_BOARD, + .udma_mask = 0x07, /* udma0-2 */ },{ /* 2 */ .name = "CMD648", .init_chipset = init_chipset_cmd64x,
@@ -748,6 +747,7 @@ static ide_pci_device_t cmd64x_chipsets[ .channels = 2, .autodma = AUTODMA, .bootable = ON_BOARD, + .udma_mask = 0x1f, /* udma0-4 */ },{ /* 3 */ .name = "CMD649", .init_chipset = init_chipset_cmd64x,
@@ -755,6 +755,7 @@ static ide_pci_device_t cmd64x_chipsets[ .channels = 2, .autodma = AUTODMA, .bootable = ON_BOARD, + .udma_mask = 0x3f, /* udma0-5 */ } };
drivers/ide/pci/pdc202xx_new.c +8 -1
@@ -545,7 +545,7 @@ static void __devinit init_hwif_pdc202ne hwif->drives[0 ].autotune = hwif->drives[1 ].autotune =1 ; - hwif->ultra_mask =0x7f ; + hwif->ultra_mask = hwif->cds->udma_mask; hwif->mwdma_mask =0x07 ; hwif->err_stops_fifo =1 ;
@@ -621,6 +621,7 @@ static ide_pci_device_t pdcnew_chipsets[ .channels = 2, .autodma = AUTODMA, .bootable = OFF_BOARD, + .udma_mask = 0x3f, /* udma0-5 */ },{ /* 1 */ .name = "PDC20269", .init_setup = init_setup_pdcnew,
@@ -629,6 +630,7 @@ static ide_pci_device_t pdcnew_chipsets[ .channels = 2, .autodma = AUTODMA, .bootable = OFF_BOARD, + .udma_mask = 0x7f, /* udma0-6*/ },{ /* 2 */ .name = "PDC20270", .init_setup = init_setup_pdc20270,
@@ -637,6 +639,7 @@ static ide_pci_device_t pdcnew_chipsets[ .channels = 2, .autodma = AUTODMA, .bootable = OFF_BOARD, + .udma_mask = 0x3f, /* udma0-5 */ },{ /* 3 */ .name = "PDC20271", .init_setup = init_setup_pdcnew,
@@ -645,6 +648,7 @@ static ide_pci_device_t pdcnew_chipsets[ .channels = 2, .autodma = AUTODMA, .bootable = OFF_BOARD, + .udma_mask = 0x7f, /* udma0-6*/ },{ /* 4 */ .name = "PDC20275", .init_setup = init_setup_pdcnew,
@@ -653,6 +657,7 @@ static ide_pci_device_t pdcnew_chipsets[ .channels = 2, .autodma = AUTODMA, .bootable = OFF_BOARD, + .udma_mask = 0x7f, /* udma0-6*/ },{ /* 5 */ .name = "PDC20276", .init_setup = init_setup_pdc20276,
@@ -661,6 +666,7 @@ static ide_pci_device_t pdcnew_chipsets[ .channels = 2, .autodma = AUTODMA, .bootable = OFF_BOARD, + .udma_mask = 0x7f, /* udma0-6*/ },{ /* 6 */ .name = "PDC20277", .init_setup = init_setup_pdcnew,
@@ -669,6 +675,7 @@ static ide_pci_device_t pdcnew_chipsets[ .channels = 2, .autodma = AUTODMA, .bootable = OFF_BOARD, + .udma_mask = 0x7f, /* udma0-6*/ } };
drivers/ide/pci/pdc202xx_old.c +6 -1
@@ -478,7 +478,7 @@ static void __devinit init_hwif_pdc202xx hwif->drives[0 ].autotune = hwif->drives[1 ].autotune =1 ; - hwif->ultra_mask =0x3f ; + hwif->ultra_mask = hwif->cds->udma_mask; hwif->mwdma_mask =0x07 ; hwif->swdma_mask =0x07 ; hwif->atapi_dma =1 ;
@@ -587,6 +587,7 @@ static ide_pci_device_t pdc202xx_chipset .autodma = AUTODMA, .bootable = OFF_BOARD, .extra = 16, + .udma_mask = 0x07, /* udma0-2 */ },{ /* 1 */ .name = "PDC20262", .init_setup = init_setup_pdc202ata4,
@@ -597,6 +598,7 @@ static ide_pci_device_t pdc202xx_chipset .autodma = AUTODMA, .bootable = OFF_BOARD, .extra = 48, + .udma_mask = 0x1f, /* udma0-4 */ },{ /* 2 */ .name = "PDC20263", .init_setup = init_setup_pdc202ata4,
@@ -607,6 +609,7 @@ static ide_pci_device_t pdc202xx_chipset .autodma = AUTODMA, .bootable = OFF_BOARD, .extra = 48, + .udma_mask = 0x1f, /* udma0-4 */ },{ /* 3 */ .name = "PDC20265", .init_setup = init_setup_pdc20265,
@@ -617,6 +620,7 @@ static ide_pci_device_t pdc202xx_chipset .autodma = AUTODMA, .bootable = OFF_BOARD, .extra = 48, + .udma_mask = 0x3f, /* udma0-5 */ },{ /* 4 */ .name = "PDC20267", .init_setup = init_setup_pdc202xx,
@@ -627,6 +631,7 @@ static ide_pci_device_t pdc202xx_chipset .autodma = AUTODMA, .bootable = OFF_BOARD, .extra = 48, + .udma_mask = 0x3f, /* udma0-5 */ } };
drivers/ide/pci/piix.c +31 -42
103 lines not on this page · raw message
drivers/ide/pci/sis5513.c +4 -1
@@ -858,6 +858,8 @@ static unsigned int __devinit ata66_sis5static void __devinit init_hwif_sis5513 (ide_hwif_t *hwif) { +u8 udma_rates[] = {0x00 ,0x00 ,0x07 ,0x1f ,0x3f ,0x3f ,0x7f ,0x7f }; + hwif->autodma =0 ;if (!hwif->irq)
@@ -873,7 +875,8 @@ static void __devinit init_hwif_sis5513 } hwif->atapi_dma =1 ; - hwif->ultra_mask =0x7f ; + + hwif->ultra_mask = udma_rates[chipset_family]; hwif->mwdma_mask =0x07 ; hwif->swdma_mask =0x07 ;
include/linux/ide.h +1 -0
@@ -1255,6 +1255,7 @@ typedef struct ide_pci_device_s {unsigned int extra;struct ide_pci_device_s *next;u8 flags; +u8 udma_mask; } ide_pci_device_t;extern int ide_setup_pci_device (struct pci_dev *,ide_pci_device_t *);
Hello.
Quoted 44 lines · Bartlomiej Zolnierkiewicz
[PATCH] ide: fix UDMA/MWDMA/SWDMA masks
* use
0x00instead of0x80to disable ->{ultra,mwdma,swdma}_mask
* addudma_maskfield toide_pci_device_tand use it to initialize ->ultra_mask in aec62xx, cmd64x, pdc202xx_{new,old} and piix drivers
* fix UDMA masks to match with chipset specific*_ratemask()(alim15x3, hpt366, serverworks and siimage drivers need UDMA mask filtering method - done in the next patch)v2:
* piix: fix cable detection for 82801AA_1 and 82372FB_1
[ Noticed by Sergei Shtylyov <[email protected]>. ]
* cmd64x: usehwif->cds->udma_mask
[ Suggested by Sergei Shtylyov <[email protected]>. ]
* aec62xx: fix newly introduced bug - check DMA status not command register [ Noticed by Sergei Shtylyov <[email protected]>. ]v3:
* piix: usehwif->cds->udma_mask
[ Suggested by Sergei Shtylyov <[email protected]>. ]Index:
b/drivers/ide/pci/aec62xx.c
===================================================================drivers/ide/pci/aec62xx.c +3
-1@@ -270,11 +270,13 @@ static unsigned int __devinit init_chipsstatic void __devinit init_hwif_aec62xx (ide_hwif_t *hwif) { +struct pci_dev *dev = hwif->pci_dev; + hwif->autodma =0 ; hwif->tuneproc = &aec62xx_tune_drive; hwif->speedproc = &aec62xx_tune_chipset; -if (hwif->pci_dev->device ==PCI_DEVICE_ID_ARTOP_ATP850UF ) +if (dev->device ==PCI_DEVICE_ID_ARTOP_ATP850UF ) hwif->serialized = hwif->channel;if (hwif->mate)@@ -286,7 +288,15 @@ static void __devinit init_hwif_aec62xx(return ; }
drivers/ide/pci/aec62xx.c static void __devinit init_hwif_aec62xx( · line 299
Quoted 10 lines
drivers/ide/pci/aec62xx.c +9
-1- hwif->ultra_mask =0x7f ; + hwif->ultra_mask = hwif->cds->udma_mask; + +/* atp865 and atp865r */ +if (hwif->ultra_mask ==0x3f ) { +/* check bit 0x10 of DMA status register */ +if (inb (pci_resource_start (dev,4 ) +2 ) &0x10 ) + hwif->ultra_mask =0x7f ;/* udma0-6 */ + } +
IMO, this asks to be put into init_setup_aec6x80() instead but since I'm already cleaning up that function, I'll move it there myself.
MBR, Sergei