Index: embios/trunk/storage.c |
— | — | @@ -127,8 +127,48 @@ |
128 | 128 | return storage_write_sectors(IF_MD2(drive,) start, count, buf); |
129 | 129 | } |
130 | 130 | |
| 131 | +#ifdef STORAGE_GET_INFO |
| 132 | +void storage_get_info(int drive, struct storage_info *info) |
| 133 | +{ |
131 | 134 | #ifdef CONFIG_STORAGE_MULTI |
| 135 | + int driver=(storage_drivers[drive] & DRIVER_MASK)>>DRIVER_OFFSET; |
| 136 | + int ldrive=(storage_drivers[drive] & DRIVE_MASK)>>DRIVE_OFFSET; |
| 137 | + |
| 138 | + switch(driver) |
| 139 | + { |
| 140 | +#if (CONFIG_STORAGE & STORAGE_ATA) |
| 141 | + case STORAGE_ATA: |
| 142 | + return ata_get_info(ldrive,info); |
| 143 | +#endif |
132 | 144 | |
| 145 | +#if (CONFIG_STORAGE & STORAGE_MMC) |
| 146 | + case STORAGE_MMC: |
| 147 | + return mmc_get_info(ldrive,info); |
| 148 | +#endif |
| 149 | + |
| 150 | +#if (CONFIG_STORAGE & STORAGE_SD) |
| 151 | + case STORAGE_SD: |
| 152 | + return sd_get_info(ldrive,info); |
| 153 | +#endif |
| 154 | + |
| 155 | +#if (CONFIG_STORAGE & STORAGE_NAND) |
| 156 | + case STORAGE_NAND: |
| 157 | + return nand_get_info(ldrive,info); |
| 158 | +#endif |
| 159 | + |
| 160 | +#if (CONFIG_STORAGE & STORAGE_RAMDISK) |
| 161 | + case STORAGE_RAMDISK: |
| 162 | + return ramdisk_get_info(ldrive,info); |
| 163 | +#endif |
| 164 | + } |
| 165 | +#else /* CONFIG_STORAGE_MULTI */ |
| 166 | + return STORAGE_FUNCTION(get_info)(IF_MD2(drive,)info); |
| 167 | +#endif /* CONFIG_STORAGE_MULTI */ |
| 168 | +} |
| 169 | +#endif /* STORAGE_GET_INFO */ |
| 170 | + |
| 171 | +#ifdef CONFIG_STORAGE_MULTI |
| 172 | + |
133 | 173 | int storage_num_drives(void) |
134 | 174 | { |
135 | 175 | return num_drives; |
— | — | @@ -453,42 +493,6 @@ |
454 | 494 | return max; |
455 | 495 | } |
456 | 496 | |
457 | | -#ifdef STORAGE_GET_INFO |
458 | | -void storage_get_info(int drive, struct storage_info *info) |
459 | | -{ |
460 | | - int driver=(storage_drivers[drive] & DRIVER_MASK)>>DRIVER_OFFSET; |
461 | | - int ldrive=(storage_drivers[drive] & DRIVE_MASK)>>DRIVE_OFFSET; |
462 | | - |
463 | | - switch(driver) |
464 | | - { |
465 | | -#if (CONFIG_STORAGE & STORAGE_ATA) |
466 | | - case STORAGE_ATA: |
467 | | - return ata_get_info(ldrive,info); |
468 | | -#endif |
469 | | - |
470 | | -#if (CONFIG_STORAGE & STORAGE_MMC) |
471 | | - case STORAGE_MMC: |
472 | | - return mmc_get_info(ldrive,info); |
473 | | -#endif |
474 | | - |
475 | | -#if (CONFIG_STORAGE & STORAGE_SD) |
476 | | - case STORAGE_SD: |
477 | | - return sd_get_info(ldrive,info); |
478 | | -#endif |
479 | | - |
480 | | -#if (CONFIG_STORAGE & STORAGE_NAND) |
481 | | - case STORAGE_NAND: |
482 | | - return nand_get_info(ldrive,info); |
483 | | -#endif |
484 | | - |
485 | | -#if (CONFIG_STORAGE & STORAGE_RAMDISK) |
486 | | - case STORAGE_RAMDISK: |
487 | | - return ramdisk_get_info(ldrive,info); |
488 | | -#endif |
489 | | - } |
490 | | -} |
491 | | -#endif /* STORAGE_GET_INFO */ |
492 | | - |
493 | 497 | #ifdef HAVE_HOTSWAP |
494 | 498 | bool storage_removable(int drive) |
495 | 499 | { |
Index: embios/trunk/storage.h |
— | — | @@ -25,6 +25,8 @@ |
26 | 26 | #include "global.h" |
27 | 27 | #include "mv.h" |
28 | 28 | |
| 29 | +#define STORAGE_GET_INFO |
| 30 | + |
29 | 31 | #if (CONFIG_STORAGE & STORAGE_SD) |
30 | 32 | #include "storage_sd.h" |
31 | 33 | #endif |
— | — | @@ -73,9 +75,6 @@ |
74 | 76 | #define storage_last_disk_activity() ata_last_disk_activity() |
75 | 77 | #define storage_get_identify() ata_get_identify() |
76 | 78 | |
77 | | - #ifdef STORAGE_GET_INFO |
78 | | - #define storage_get_info(drive, info) ata_get_info(IF_MD2(drive,) info) |
79 | | - #endif |
80 | 79 | #ifdef HAVE_HOTSWAP |
81 | 80 | #define storage_removable(drive) ata_removable(IF_MD(drive)) |
82 | 81 | #define storage_present(drive) ata_present(IF_MD(drive)) |
— | — | @@ -97,9 +96,6 @@ |
98 | 97 | #define storage_last_disk_activity() sd_last_disk_activity() |
99 | 98 | #define storage_get_identify() sd_get_identify() |
100 | 99 | |
101 | | - #ifdef STORAGE_GET_INFO |
102 | | - #define storage_get_info(drive, info) sd_get_info(IF_MD2(drive,) info) |
103 | | - #endif |
104 | 100 | #ifdef HAVE_HOTSWAP |
105 | 101 | #define storage_removable(drive) sd_removable(IF_MD(drive)) |
106 | 102 | #define storage_present(drive) sd_present(IF_MD(drive)) |
— | — | @@ -121,9 +117,6 @@ |
122 | 118 | #define storage_last_disk_activity() mmc_last_disk_activity() |
123 | 119 | #define storage_get_identify() mmc_get_identify() |
124 | 120 | |
125 | | - #ifdef STORAGE_GET_INFO |
126 | | - #define storage_get_info(drive, info) mmc_get_info(IF_MD2(drive,) info) |
127 | | - #endif |
128 | 121 | #ifdef HAVE_HOTSWAP |
129 | 122 | #define storage_removable(drive) mmc_removable(IF_MD(drive)) |
130 | 123 | #define storage_present(drive) mmc_present(IF_MD(drive)) |
— | — | @@ -145,9 +138,6 @@ |
146 | 139 | #define storage_last_disk_activity() nand_last_disk_activity() |
147 | 140 | #define storage_get_identify() nand_get_identify() |
148 | 141 | |
149 | | - #ifdef STORAGE_GET_INFO |
150 | | - #define storage_get_info(drive, info) nand_get_info(IF_MD2(drive,) info) |
151 | | - #endif |
152 | 142 | #ifdef HAVE_HOTSWAP |
153 | 143 | #define storage_removable(drive) nand_removable(IF_MD(drive)) |
154 | 144 | #define storage_present(drive) nand_present(IF_MD(drive)) |
— | — | @@ -169,9 +159,6 @@ |
170 | 160 | #define storage_last_disk_activity() ramdisk_last_disk_activity() |
171 | 161 | #define storage_get_identify() ramdisk_get_identify() |
172 | 162 | |
173 | | - #ifdef STORAGE_GET_INFO |
174 | | - #define storage_get_info(drive, info) ramdisk_get_info(IF_MD2(drive,) info) |
175 | | - #endif |
176 | 163 | #ifdef HAVE_HOTSWAP |
177 | 164 | #define storage_removable(drive) ramdisk_removable(IF_MD(drive)) |
178 | 165 | #define storage_present(drive) ramdisk_present(IF_MD(drive)) |
— | — | @@ -194,9 +181,6 @@ |
195 | 182 | void storage_spindown(int seconds); |
196 | 183 | long storage_last_disk_activity(void); |
197 | 184 | int storage_num_drives(void); |
198 | | -#ifdef STORAGE_GET_INFO |
199 | | -void storage_get_info(int drive, struct storage_info *info); |
200 | | -#endif |
201 | 185 | #ifdef HAVE_HOTSWAP |
202 | 186 | bool storage_removable(int drive); |
203 | 187 | bool storage_present(int drive); |
— | — | @@ -208,4 +192,7 @@ |
209 | 193 | int storage_read_sectors_md(int drive, unsigned long start, int count, void* buf); |
210 | 194 | int storage_write_sectors(IF_MD2(int drive,) unsigned long start, int count, const void* buf); |
211 | 195 | int storage_write_sectors_md(int drive, unsigned long start, int count, const void* buf); |
| 196 | +#ifdef STORAGE_GET_INFO |
| 197 | +void storage_get_info(int drive, struct storage_info *info); |
212 | 198 | #endif |
| 199 | +#endif |