@@ -254,53 +254,34 @@ static void cmd64x_clear_irq(ide_drive_t *drive)
254254 (void ) pci_write_config_byte (dev , irq_reg , irq_stat | irq_mask );
255255}
256256
257- static int cmd648_dma_test_irq ( ide_drive_t * drive )
257+ static int cmd648_test_irq ( ide_hwif_t * hwif )
258258{
259- ide_hwif_t * hwif = drive -> hwif ;
260- unsigned long base = hwif -> dma_base - ( hwif -> channel * 8 );
259+ struct pci_dev * dev = to_pci_dev ( hwif -> dev ) ;
260+ unsigned long base = pci_resource_start ( dev , 4 );
261261 u8 irq_mask = hwif -> channel ? MRDMODE_INTR_CH1 :
262262 MRDMODE_INTR_CH0 ;
263- u8 dma_stat = inb (hwif -> dma_base + ATA_DMA_STATUS );
264263 u8 mrdmode = inb (base + 1 );
265264
266- #ifdef DEBUG
267- printk ("%s: dma_stat: 0x%02x mrdmode: 0x%02x irq_mask: 0x%02x\n" ,
268- drive -> name , dma_stat , mrdmode , irq_mask );
269- #endif
270- if (!(mrdmode & irq_mask ))
271- return 0 ;
265+ pr_debug ("%s: mrdmode: 0x%02x irq_mask: 0x%02x\n" ,
266+ hwif -> name , mrdmode , irq_mask );
272267
273- /* return 1 if INTR asserted */
274- if (dma_stat & 4 )
275- return 1 ;
276-
277- return 0 ;
268+ return (mrdmode & irq_mask ) ? 1 : 0 ;
278269}
279270
280- static int cmd64x_dma_test_irq ( ide_drive_t * drive )
271+ static int cmd64x_test_irq ( ide_hwif_t * hwif )
281272{
282- ide_hwif_t * hwif = drive -> hwif ;
283273 struct pci_dev * dev = to_pci_dev (hwif -> dev );
284274 int irq_reg = hwif -> channel ? ARTTIM23 : CFR ;
285275 u8 irq_mask = hwif -> channel ? ARTTIM23_INTR_CH1 :
286276 CFR_INTR_CH0 ;
287- u8 dma_stat = inb (hwif -> dma_base + ATA_DMA_STATUS );
288277 u8 irq_stat = 0 ;
289278
290279 (void ) pci_read_config_byte (dev , irq_reg , & irq_stat );
291280
292- #ifdef DEBUG
293- printk ("%s: dma_stat: 0x%02x irq_stat: 0x%02x irq_mask: 0x%02x\n" ,
294- drive -> name , dma_stat , irq_stat , irq_mask );
295- #endif
296- if (!(irq_stat & irq_mask ))
297- return 0 ;
298-
299- /* return 1 if INTR asserted */
300- if (dma_stat & 4 )
301- return 1 ;
281+ pr_debug ("%s: irq_stat: 0x%02x irq_mask: 0x%02x\n" ,
282+ hwif -> name , irq_stat , irq_mask );
302283
303- return 0 ;
284+ return ( irq_stat & irq_mask ) ? 1 : 0 ;
304285}
305286
306287/*
@@ -366,27 +347,18 @@ static const struct ide_port_ops cmd64x_port_ops = {
366347 .set_pio_mode = cmd64x_set_pio_mode ,
367348 .set_dma_mode = cmd64x_set_dma_mode ,
368349 .clear_irq = cmd64x_clear_irq ,
350+ .test_irq = cmd64x_test_irq ,
369351 .cable_detect = cmd64x_cable_detect ,
370352};
371353
372354static const struct ide_port_ops cmd648_port_ops = {
373355 .set_pio_mode = cmd64x_set_pio_mode ,
374356 .set_dma_mode = cmd64x_set_dma_mode ,
375357 .clear_irq = cmd648_clear_irq ,
358+ .test_irq = cmd648_test_irq ,
376359 .cable_detect = cmd64x_cable_detect ,
377360};
378361
379- static const struct ide_dma_ops cmd64x_dma_ops = {
380- .dma_host_set = ide_dma_host_set ,
381- .dma_setup = ide_dma_setup ,
382- .dma_start = ide_dma_start ,
383- .dma_end = ide_dma_end ,
384- .dma_test_irq = cmd64x_dma_test_irq ,
385- .dma_lost_irq = ide_dma_lost_irq ,
386- .dma_timer_expiry = ide_dma_sff_timer_expiry ,
387- .dma_sff_read_status = ide_dma_sff_read_status ,
388- };
389-
390362static const struct ide_dma_ops cmd646_rev1_dma_ops = {
391363 .dma_host_set = ide_dma_host_set ,
392364 .dma_setup = ide_dma_setup ,
@@ -398,24 +370,12 @@ static const struct ide_dma_ops cmd646_rev1_dma_ops = {
398370 .dma_sff_read_status = ide_dma_sff_read_status ,
399371};
400372
401- static const struct ide_dma_ops cmd648_dma_ops = {
402- .dma_host_set = ide_dma_host_set ,
403- .dma_setup = ide_dma_setup ,
404- .dma_start = ide_dma_start ,
405- .dma_end = ide_dma_end ,
406- .dma_test_irq = cmd648_dma_test_irq ,
407- .dma_lost_irq = ide_dma_lost_irq ,
408- .dma_timer_expiry = ide_dma_sff_timer_expiry ,
409- .dma_sff_read_status = ide_dma_sff_read_status ,
410- };
411-
412373static const struct ide_port_info cmd64x_chipsets [] __devinitdata = {
413374 { /* 0: CMD643 */
414375 .name = DRV_NAME ,
415376 .init_chipset = init_chipset_cmd64x ,
416377 .enablebits = {{0x00 ,0x00 ,0x00 }, {0x51 ,0x08 ,0x08 }},
417378 .port_ops = & cmd64x_port_ops ,
418- .dma_ops = & cmd64x_dma_ops ,
419379 .host_flags = IDE_HFLAG_CLEAR_SIMPLEX |
420380 IDE_HFLAG_ABUSE_PREFETCH ,
421381 .pio_mask = ATA_PIO5 ,
@@ -427,7 +387,6 @@ static const struct ide_port_info cmd64x_chipsets[] __devinitdata = {
427387 .init_chipset = init_chipset_cmd64x ,
428388 .enablebits = {{0x51 ,0x04 ,0x04 }, {0x51 ,0x08 ,0x08 }},
429389 .port_ops = & cmd648_port_ops ,
430- .dma_ops = & cmd648_dma_ops ,
431390 .host_flags = IDE_HFLAG_SERIALIZE |
432391 IDE_HFLAG_ABUSE_PREFETCH ,
433392 .pio_mask = ATA_PIO5 ,
@@ -439,7 +398,6 @@ static const struct ide_port_info cmd64x_chipsets[] __devinitdata = {
439398 .init_chipset = init_chipset_cmd64x ,
440399 .enablebits = {{0x51 ,0x04 ,0x04 }, {0x51 ,0x08 ,0x08 }},
441400 .port_ops = & cmd648_port_ops ,
442- .dma_ops = & cmd648_dma_ops ,
443401 .host_flags = IDE_HFLAG_ABUSE_PREFETCH ,
444402 .pio_mask = ATA_PIO5 ,
445403 .mwdma_mask = ATA_MWDMA2 ,
@@ -450,7 +408,6 @@ static const struct ide_port_info cmd64x_chipsets[] __devinitdata = {
450408 .init_chipset = init_chipset_cmd64x ,
451409 .enablebits = {{0x51 ,0x04 ,0x04 }, {0x51 ,0x08 ,0x08 }},
452410 .port_ops = & cmd648_port_ops ,
453- .dma_ops = & cmd648_dma_ops ,
454411 .host_flags = IDE_HFLAG_ABUSE_PREFETCH ,
455412 .pio_mask = ATA_PIO5 ,
456413 .mwdma_mask = ATA_MWDMA2 ,
@@ -490,8 +447,6 @@ static int __devinit cmd64x_init_one(struct pci_dev *dev, const struct pci_devic
490447 d .port_ops = & cmd64x_port_ops ;
491448 if (dev -> revision == 1 )
492449 d .dma_ops = & cmd646_rev1_dma_ops ;
493- else
494- d .dma_ops = & cmd64x_dma_ops ;
495450 }
496451 }
497452 }
0 commit comments