aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/cris/ide-cris.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-28 17:44:36 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-28 17:44:36 -0400
commit9567b349f7e7dd7e2483db99ee8e4a6fe0caca38 (patch)
tree29abab829b52a451567f8da4280d101fafa44527 /drivers/ide/cris/ide-cris.c
parent92d3ab27e8fd23d1a9dc3b69d17b2afb83e5c6f5 (diff)
ide: merge ->atapi_*put_bytes and ->ata_*put_data methods
* Merge ->atapi_{in,out}put_bytes and ->ata_{in,out}put_data methods into new ->{in,out}put_data methods which take number of bytes to transfer as an argument and always do padding. While at it: * Use 'hwif' or 'drive->hwif' instead of 'HWIF(drive)'. There should be no functional changes caused by this patch (all users of ->ata_{in,out}put_data methods were using multiply-of-4 word counts). Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/cris/ide-cris.c')
-rw-r--r--drivers/ide/cris/ide-cris.c52
1 files changed, 15 insertions, 37 deletions
diff --git a/drivers/ide/cris/ide-cris.c b/drivers/ide/cris/ide-cris.c
index aa263df76569..72ff63ed5f2b 100644
--- a/drivers/ide/cris/ide-cris.c
+++ b/drivers/ide/cris/ide-cris.c
@@ -673,12 +673,8 @@ cris_ide_inb(unsigned long reg)
673 return (unsigned char)cris_ide_inw(reg); 673 return (unsigned char)cris_ide_inw(reg);
674} 674}
675 675
676static void cris_ide_input_data(ide_drive_t *, struct request *, 676static void cris_input_data(ide_drive_t *, struct request *, void *, unsigned);
677 void *, unsigned int); 677static void cris_output_data(ide_drive_t *, struct request *, void *, unsigned);
678static void cris_ide_output_data(ide_drive_t *, struct request *,
679 void *, unsigned int);
680static void cris_atapi_input_bytes(ide_drive_t *drive, void *, unsigned int);
681static void cris_atapi_output_bytes(ide_drive_t *drive, void *, unsigned int);
682 678
683static void cris_dma_host_set(ide_drive_t *drive, int on) 679static void cris_dma_host_set(ide_drive_t *drive, int on)
684{ 680{
@@ -816,10 +812,9 @@ static int __init init_e100_ide(void)
816 ide_init_port_data(hwif, hwif->index); 812 ide_init_port_data(hwif, hwif->index);
817 ide_init_port_hw(hwif, &hw); 813 ide_init_port_hw(hwif, &hw);
818 814
819 hwif->ata_input_data = &cris_ide_input_data; 815 hwif->input_data = cris_input_data;
820 hwif->ata_output_data = &cris_ide_output_data; 816 hwif->output_data = cris_output_data;
821 hwif->atapi_input_bytes = &cris_atapi_input_bytes; 817
822 hwif->atapi_output_bytes = &cris_atapi_output_bytes;
823 hwif->OUTB = &cris_ide_outb; 818 hwif->OUTB = &cris_ide_outb;
824 hwif->OUTW = &cris_ide_outw; 819 hwif->OUTW = &cris_ide_outw;
825 hwif->OUTBSYNC = &cris_ide_outbsync; 820 hwif->OUTBSYNC = &cris_ide_outbsync;
@@ -849,17 +844,16 @@ static int __init init_e100_ide(void)
849static cris_dma_descr_type mydescr __attribute__ ((__aligned__(16))); 844static cris_dma_descr_type mydescr __attribute__ ((__aligned__(16)));
850 845
851/* 846/*
852 * The following routines are mainly used by the ATAPI drivers. 847 * This is used for most PIO data transfers *from* the IDE interface
853 * 848 *
854 * These routines will round up any request for an odd number of bytes, 849 * These routines will round up any request for an odd number of bytes,
855 * so if an odd bytecount is specified, be sure that there's at least one 850 * so if an odd bytecount is specified, be sure that there's at least one
856 * extra byte allocated for the buffer. 851 * extra byte allocated for the buffer.
857 */ 852 */
858static void 853static void cris_input_data(ide_drive_t *drive, struct request *rq,
859cris_atapi_input_bytes (ide_drive_t *drive, void *buffer, unsigned int bytecount) 854 void *buffer, unsigned int bytecount)
860{ 855{
861 D(printk("atapi_input_bytes, buffer 0x%x, count %d\n", 856 D(printk("input_data, buffer 0x%x, count %d\n", buffer, bytecount));
862 buffer, bytecount));
863 857
864 if(bytecount & 1) { 858 if(bytecount & 1) {
865 printk("warning, odd bytecount in cdrom_in_bytes = %d.\n", bytecount); 859 printk("warning, odd bytecount in cdrom_in_bytes = %d.\n", bytecount);
@@ -877,11 +871,13 @@ cris_atapi_input_bytes (ide_drive_t *drive, void *buffer, unsigned int bytecount
877 LED_DISK_READ(0); 871 LED_DISK_READ(0);
878} 872}
879 873
880static void 874/*
881cris_atapi_output_bytes (ide_drive_t *drive, void *buffer, unsigned int bytecount) 875 * This is used for most PIO data transfers *to* the IDE interface
876 */
877static void cris_output_data(ide_drive_t *drive, struct request *rq,
878 void *buffer, unsigned int bytecount)
882{ 879{
883 D(printk("atapi_output_bytes, buffer 0x%x, count %d\n", 880 D(printk("output_data, buffer 0x%x, count %d\n", buffer, bytecount));
884 buffer, bytecount));
885 881
886 if(bytecount & 1) { 882 if(bytecount & 1) {
887 printk("odd bytecount %d in atapi_out_bytes!\n", bytecount); 883 printk("odd bytecount %d in atapi_out_bytes!\n", bytecount);
@@ -899,24 +895,6 @@ cris_atapi_output_bytes (ide_drive_t *drive, void *buffer, unsigned int bytecoun
899 LED_DISK_WRITE(0); 895 LED_DISK_WRITE(0);
900} 896}
901 897
902/*
903 * This is used for most PIO data transfers *from* the IDE interface
904 */
905static void cris_ide_input_data(ide_drive_t *drive, struct request *rq,
906 void *buffer, unsigned int wcount)
907{
908 cris_atapi_input_bytes(drive, buffer, wcount << 2);
909}
910
911/*
912 * This is used for most PIO data transfers *to* the IDE interface
913 */
914static void cris_ide_output_data(ide_drive_t *drive, struct request *,
915 void *buffer, unsigned int wcount)
916{
917 cris_atapi_output_bytes(drive, buffer, wcount << 2);
918}
919
920/* we only have one DMA channel on the chip for ATA, so we can keep these statically */ 898/* we only have one DMA channel on the chip for ATA, so we can keep these statically */
921static cris_dma_descr_type ata_descrs[MAX_DMA_DESCRS] __attribute__ ((__aligned__(16))); 899static cris_dma_descr_type ata_descrs[MAX_DMA_DESCRS] __attribute__ ((__aligned__(16)));
922static unsigned int ata_tot_size; 900static unsigned int ata_tot_size;