summaryrefslogtreecommitdiff
path: root/firmware/drivers/ata_mmc.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/ata_mmc.c')
-rw-r--r--firmware/drivers/ata_mmc.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/firmware/drivers/ata_mmc.c b/firmware/drivers/ata_mmc.c
index a61d28cb07..d75309547f 100644
--- a/firmware/drivers/ata_mmc.c
+++ b/firmware/drivers/ata_mmc.c
@@ -608,17 +608,24 @@ static int send_single_sector(const unsigned char *buf, int timeout)
608 return ret; 608 return ret;
609} 609}
610 610
611int ata_read_sectors(unsigned long start, 611int ata_read_sectors(
612 int incount, 612#ifdef HAVE_MULTIVOLUME
613 void* inbuf) 613 int drive,
614#endif
615 unsigned long start,
616 int incount,
617 void* inbuf)
614{ 618{
615 int ret = 0; 619 int ret = 0;
616 int i; 620 int i;
617 unsigned long addr; 621 unsigned long addr;
618 unsigned char response; 622 unsigned char response;
619 void *inbuf_prev = NULL; 623 void *inbuf_prev = NULL;
620 tCardInfo *card = &card_info[current_card]; 624 tCardInfo *card;
621 625#ifdef HAVE_MULTIVOLUME
626 current_card = drive;
627#endif
628 card = &card_info[current_card];
622 addr = start * SECTOR_SIZE; 629 addr = start * SECTOR_SIZE;
623 630
624 mutex_lock(&mmc_mutex); 631 mutex_lock(&mmc_mutex);
@@ -663,7 +670,11 @@ int ata_read_sectors(unsigned long start,
663 return ret; 670 return ret;
664} 671}
665 672
666int ata_write_sectors(unsigned long start, 673int ata_write_sectors(
674#ifdef HAVE_MULTIVOLUME
675 int drive,
676#endif
677 unsigned long start,
667 int count, 678 int count,
668 const void* buf) 679 const void* buf)
669{ 680{
@@ -671,7 +682,11 @@ int ata_write_sectors(unsigned long start,
671 int i; 682 int i;
672 unsigned long addr; 683 unsigned long addr;
673 unsigned char response; 684 unsigned char response;
674 tCardInfo *card = &card_info[current_card]; 685 tCardInfo *card;
686#ifdef HAVE_MULTIVOLUME
687 current_card = drive;
688#endif
689 card = &card_info[current_card];
675 690
676 if (start == 0) 691 if (start == 0)
677 panicf("Writing on sector 0\n"); 692 panicf("Writing on sector 0\n");
@@ -733,12 +748,13 @@ extern void ata_delayed_write(unsigned long sector, const void* buf)
733 delayed_write = true; 748 delayed_write = true;
734} 749}
735 750
751/* write the delayed sector to volume 0 */
736extern void ata_flush(void) 752extern void ata_flush(void)
737{ 753{
738 if ( delayed_write ) { 754 if ( delayed_write ) {
739 DEBUGF("ata_flush()\n"); 755 DEBUGF("ata_flush()\n");
740 delayed_write = false; 756 delayed_write = false;
741 ata_write_sectors(delayed_sector_num, 1, delayed_sector); 757 ata_write_sectors(IF_MV2(0,) delayed_sector_num, 1, delayed_sector);
742 } 758 }
743} 759}
744 760