libata: Report PIO/DMA status when overriding set_mode
PATCH 1/1 libata: Report PIO/DMA status when overriding set_mode
Currently we don't report PIO/DMA information in the case we are using firmware mode setup by drivers, or where the value is meaningless. Even when we don't know the mode, or the mode is meaningless it would be nice to report PIO or DMA and to keep stylistic consistency. For MW/UDMA we can report the actual firmware set mode and we add a helper for this.
This patch for now is just a proposal for comment
(and while we could guess the PIO mode by playing with the command registers and timing them I don't think its worth it)
drivers/ata/ata_generic.c +2 -2
@@ -90,10 +90,10 @@/* We do need the right mode information for DMA or PIO and this comes from the current configuration flags */ if (dma_enabled & (1 << (5 + i))) { - dev->xfer_mode =XFER_MW_DMA_0 ; - dev->xfer_shift =ATA_SHIFT_MWDMA ; +ata_id_to_dma_mode (dev,XFER_MW_DMA_0 ); dev->flags &= ~ATA_DFLAG_PIO ; }else { +ata_dev_printk (dev,KERN_INFO ,"configured for PIO\n" ); dev->xfer_mode =XFER_PIO_0 ; dev->xfer_shift =ATA_SHIFT_PIO ; dev->flags |=ATA_DFLAG_PIO ;
drivers/ata/libata-core.c +43 -0
55 lines not on this page · raw message
drivers/ata/pata_it821x.c +2 -0
@@ -503,10 +503,12 @@/* We do need the right mode information for DMA or PIO and this comes from the current configuration flags */ if (dma_enabled & (1 << (5 + i))) { +ata_dev_printk (dev,KERN_INFO ,"configured for PIO\n" ); dev->xfer_mode =XFER_MW_DMA_0 ; dev->xfer_shift =ATA_SHIFT_MWDMA ; dev->flags &= ~ATA_DFLAG_PIO ; }else { +ata_dev_printk (dev,KERN_INFO ,"configured for DMA\n" ); dev->xfer_mode =XFER_PIO_0 ; dev->xfer_shift =ATA_SHIFT_PIO ; dev->flags |=ATA_DFLAG_PIO ;
drivers/ata/pata_platform.c +1 -0
@@ -43,6 +43,7 @@ dev->pio_mode = dev->xfer_mode =XFER_PIO_0 ; dev->xfer_shift =ATA_SHIFT_PIO ; dev->flags |=ATA_DFLAG_PIO ; +ata_dev_printk (dev,KERN_INFO ,"configured for PIO\n" ); } }return 0 ;
drivers/ata/pata_rz1000.c +1 -0
@@ -71,6 +71,7 @@ dev->xfer_mode =XFER_PIO_0 ; dev->xfer_shift =ATA_SHIFT_PIO ; dev->flags |=ATA_DFLAG_PIO ; +ata_dev_printk (dev,KERN_INFO ,"configured for PIO\n" ); } }return 0 ;
include/linux/libata.h +1 -0
@@ -795,6 +796,7 @@ unsigned int ofs, unsigned int len);extern void ata_id_c_string (const u16 *id,unsigned char *s,unsigned int ofs,unsigned int len); +extern void ata_id_to_dma_mode (struct ata_device *dev,u8 unknown);extern unsigned long ata_device_blacklisted (const struct ata_device *dev);extern void ata_bmdma_setup (struct ata_queued_cmd *qc);extern void ata_bmdma_start (struct ata_queued_cmd *qc);
Quoted 6 lines · Alan
Currently we don't report PIO/DMA information in the case we are using firmware mode setup by drivers, or where the value is meaningless. Even when we don't know the mode, or the mode is meaningless it would be nice to report PIO or DMA and to keep stylistic consistency. For MW/UDMA we can report the actual firmware set mode and we add a helper for this.
Quoted 6 lines
This patch for now is just a proposal for comment
(and while we could guess the PIO mode by playing with the command registers and timing them I don't think its worth it)
Signed-off-by Alan Cox <[email protected]>
Looks good to me.
Dropped, since you say it's just a proposal
Jeff