diff options
Diffstat (limited to 'firmware/storage.c')
-rw-r--r-- | firmware/storage.c | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/firmware/storage.c b/firmware/storage.c index 267b0b8dfb..da3e06146d 100644 --- a/firmware/storage.c +++ b/firmware/storage.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include "ata_idle_notify.h" | 23 | #include "ata_idle_notify.h" |
24 | #include "usb.h" | 24 | #include "usb.h" |
25 | #include "disk.h" | 25 | #include "disk.h" |
26 | #include "pathfuncs.h" | ||
26 | 27 | ||
27 | #ifdef CONFIG_STORAGE_MULTI | 28 | #ifdef CONFIG_STORAGE_MULTI |
28 | 29 | ||
@@ -275,21 +276,21 @@ int storage_init(void) | |||
275 | #ifdef CONFIG_STORAGE_MULTI | 276 | #ifdef CONFIG_STORAGE_MULTI |
276 | int i; | 277 | int i; |
277 | num_drives=0; | 278 | num_drives=0; |
278 | 279 | ||
279 | #if (CONFIG_STORAGE & STORAGE_ATA) | 280 | #if (CONFIG_STORAGE & STORAGE_ATA) |
280 | if ((rc=ata_init())) return rc; | 281 | if ((rc=ata_init())) return rc; |
281 | 282 | ||
282 | int ata_drives = ata_num_drives(num_drives); | 283 | int ata_drives = ata_num_drives(num_drives); |
283 | for (i=0; i<ata_drives; i++) | 284 | for (i=0; i<ata_drives; i++) |
284 | { | 285 | { |
285 | storage_drivers[num_drives++] = | 286 | storage_drivers[num_drives++] = |
286 | (STORAGE_ATA<<DRIVER_OFFSET) | (i << DRIVE_OFFSET); | 287 | (STORAGE_ATA<<DRIVER_OFFSET) | (i << DRIVE_OFFSET); |
287 | } | 288 | } |
288 | #endif | 289 | #endif |
289 | 290 | ||
290 | #if (CONFIG_STORAGE & STORAGE_MMC) | 291 | #if (CONFIG_STORAGE & STORAGE_MMC) |
291 | if ((rc=mmc_init())) return rc; | 292 | if ((rc=mmc_init())) return rc; |
292 | 293 | ||
293 | int mmc_drives = mmc_num_drives(num_drives); | 294 | int mmc_drives = mmc_num_drives(num_drives); |
294 | for (i=0; i<mmc_drives ;i++) | 295 | for (i=0; i<mmc_drives ;i++) |
295 | { | 296 | { |
@@ -300,7 +301,7 @@ int storage_init(void) | |||
300 | 301 | ||
301 | #if (CONFIG_STORAGE & STORAGE_SD) | 302 | #if (CONFIG_STORAGE & STORAGE_SD) |
302 | if ((rc=sd_init())) return rc; | 303 | if ((rc=sd_init())) return rc; |
303 | 304 | ||
304 | int sd_drives = sd_num_drives(num_drives); | 305 | int sd_drives = sd_num_drives(num_drives); |
305 | for (i=0; i<sd_drives; i++) | 306 | for (i=0; i<sd_drives; i++) |
306 | { | 307 | { |
@@ -311,7 +312,7 @@ int storage_init(void) | |||
311 | 312 | ||
312 | #if (CONFIG_STORAGE & STORAGE_NAND) | 313 | #if (CONFIG_STORAGE & STORAGE_NAND) |
313 | if ((rc=nand_init())) return rc; | 314 | if ((rc=nand_init())) return rc; |
314 | 315 | ||
315 | int nand_drives = nand_num_drives(num_drives); | 316 | int nand_drives = nand_num_drives(num_drives); |
316 | for (i=0; i<nand_drives; i++) | 317 | for (i=0; i<nand_drives; i++) |
317 | { | 318 | { |
@@ -322,7 +323,7 @@ int storage_init(void) | |||
322 | 323 | ||
323 | #if (CONFIG_STORAGE & STORAGE_RAMDISK) | 324 | #if (CONFIG_STORAGE & STORAGE_RAMDISK) |
324 | if ((rc=ramdisk_init())) return rc; | 325 | if ((rc=ramdisk_init())) return rc; |
325 | 326 | ||
326 | int ramdisk_drives = ramdisk_num_drives(num_drives); | 327 | int ramdisk_drives = ramdisk_num_drives(num_drives); |
327 | for (i=0; i<ramdisk_drives; i++) | 328 | for (i=0; i<ramdisk_drives; i++) |
328 | { | 329 | { |
@@ -334,11 +335,15 @@ int storage_init(void) | |||
334 | rc = STORAGE_FUNCTION(init)(); | 335 | rc = STORAGE_FUNCTION(init)(); |
335 | #endif /* CONFIG_STORAGE_MULTI */ | 336 | #endif /* CONFIG_STORAGE_MULTI */ |
336 | 337 | ||
338 | #ifdef HAVE_MULTIVOLUME | ||
339 | init_volume_names(); | ||
340 | #endif | ||
341 | |||
337 | storage_thread_init(); | 342 | storage_thread_init(); |
338 | return rc; | 343 | return rc; |
339 | } | 344 | } |
340 | 345 | ||
341 | int storage_read_sectors(IF_MD(int drive,) unsigned long start, int count, | 346 | int storage_read_sectors(IF_MD(int drive,) sector_t start, int count, |
342 | void* buf) | 347 | void* buf) |
343 | { | 348 | { |
344 | #ifdef CONFIG_STORAGE_MULTI | 349 | #ifdef CONFIG_STORAGE_MULTI |
@@ -380,7 +385,7 @@ int storage_read_sectors(IF_MD(int drive,) unsigned long start, int count, | |||
380 | 385 | ||
381 | } | 386 | } |
382 | 387 | ||
383 | int storage_write_sectors(IF_MD(int drive,) unsigned long start, int count, | 388 | int storage_write_sectors(IF_MD(int drive,) sector_t start, int count, |
384 | const void* buf) | 389 | const void* buf) |
385 | { | 390 | { |
386 | #ifdef CONFIG_STORAGE_MULTI | 391 | #ifdef CONFIG_STORAGE_MULTI |
@@ -520,7 +525,7 @@ bool storage_disk_is_active(void) | |||
520 | int storage_soft_reset(void) | 525 | int storage_soft_reset(void) |
521 | { | 526 | { |
522 | int rc=0; | 527 | int rc=0; |
523 | 528 | ||
524 | #if (CONFIG_STORAGE & STORAGE_ATA) | 529 | #if (CONFIG_STORAGE & STORAGE_ATA) |
525 | if ((rc=ata_soft_reset())) return rc; | 530 | if ((rc=ata_soft_reset())) return rc; |
526 | #endif | 531 | #endif |
@@ -548,7 +553,7 @@ int storage_soft_reset(void) | |||
548 | int storage_flush(void) | 553 | int storage_flush(void) |
549 | { | 554 | { |
550 | int rc=0; | 555 | int rc=0; |
551 | 556 | ||
552 | #if (CONFIG_STORAGE & STORAGE_ATA) | 557 | #if (CONFIG_STORAGE & STORAGE_ATA) |
553 | //if ((rc=ata_flush())) return rc; | 558 | //if ((rc=ata_flush())) return rc; |
554 | #endif | 559 | #endif |
@@ -648,7 +653,7 @@ long storage_last_disk_activity(void) | |||
648 | { | 653 | { |
649 | long max=0; | 654 | long max=0; |
650 | long t; | 655 | long t; |
651 | 656 | ||
652 | #if (CONFIG_STORAGE & STORAGE_ATA) | 657 | #if (CONFIG_STORAGE & STORAGE_ATA) |
653 | t=ata_last_disk_activity(); | 658 | t=ata_last_disk_activity(); |
654 | if (t>max) max=t; | 659 | if (t>max) max=t; |
@@ -681,7 +686,7 @@ int storage_spinup_time(void) | |||
681 | { | 686 | { |
682 | int max=0; | 687 | int max=0; |
683 | int t; | 688 | int t; |
684 | 689 | ||
685 | #if (CONFIG_STORAGE & STORAGE_ATA) | 690 | #if (CONFIG_STORAGE & STORAGE_ATA) |
686 | t=ata_spinup_time(); | 691 | t=ata_spinup_time(); |
687 | if (t>max) max=t; | 692 | if (t>max) max=t; |
@@ -716,7 +721,7 @@ void storage_get_info(int drive, struct storage_info *info) | |||
716 | { | 721 | { |
717 | int driver=(storage_drivers[drive] & DRIVER_MASK)>>DRIVER_OFFSET; | 722 | int driver=(storage_drivers[drive] & DRIVER_MASK)>>DRIVER_OFFSET; |
718 | int ldrive=(storage_drivers[drive] & DRIVE_MASK)>>DRIVE_OFFSET; | 723 | int ldrive=(storage_drivers[drive] & DRIVE_MASK)>>DRIVE_OFFSET; |
719 | 724 | ||
720 | switch(driver) | 725 | switch(driver) |
721 | { | 726 | { |
722 | #if (CONFIG_STORAGE & STORAGE_ATA) | 727 | #if (CONFIG_STORAGE & STORAGE_ATA) |
@@ -752,7 +757,7 @@ bool storage_removable(int drive) | |||
752 | { | 757 | { |
753 | int driver=(storage_drivers[drive] & DRIVER_MASK)>>DRIVER_OFFSET; | 758 | int driver=(storage_drivers[drive] & DRIVER_MASK)>>DRIVER_OFFSET; |
754 | int ldrive=(storage_drivers[drive] & DRIVE_MASK)>>DRIVE_OFFSET; | 759 | int ldrive=(storage_drivers[drive] & DRIVE_MASK)>>DRIVE_OFFSET; |
755 | 760 | ||
756 | switch(driver) | 761 | switch(driver) |
757 | { | 762 | { |
758 | #if (CONFIG_STORAGE & STORAGE_ATA) | 763 | #if (CONFIG_STORAGE & STORAGE_ATA) |
@@ -789,7 +794,7 @@ bool storage_present(int drive) | |||
789 | { | 794 | { |
790 | int driver=(storage_drivers[drive] & DRIVER_MASK)>>DRIVER_OFFSET; | 795 | int driver=(storage_drivers[drive] & DRIVER_MASK)>>DRIVER_OFFSET; |
791 | int ldrive=(storage_drivers[drive] & DRIVE_MASK)>>DRIVE_OFFSET; | 796 | int ldrive=(storage_drivers[drive] & DRIVE_MASK)>>DRIVE_OFFSET; |
792 | 797 | ||
793 | switch(driver) | 798 | switch(driver) |
794 | { | 799 | { |
795 | #if (CONFIG_STORAGE & STORAGE_ATA) | 800 | #if (CONFIG_STORAGE & STORAGE_ATA) |