diff options
Diffstat (limited to 'firmware/common/disk.c')
-rw-r--r-- | firmware/common/disk.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/firmware/common/disk.c b/firmware/common/disk.c index b85f460a69..cfe15984f9 100644 --- a/firmware/common/disk.c +++ b/firmware/common/disk.c | |||
@@ -41,12 +41,22 @@ | |||
41 | 41 | ||
42 | static struct partinfo part[8]; | 42 | static struct partinfo part[8]; |
43 | 43 | ||
44 | struct partinfo* disk_init(void) | 44 | struct partinfo* disk_init(IF_MV_NONVOID(int drive)) |
45 | { | 45 | { |
46 | int i; | 46 | int i; |
47 | unsigned char sector[512]; | 47 | unsigned char sector[512]; |
48 | #ifdef HAVE_MULTIVOLUME | ||
49 | /* For each drive, start at a different position, in order not to destroy | ||
50 | the first entry of drive 0. | ||
51 | That one is needed to calculate config sector position. */ | ||
52 | struct partinfo* pinfo = &part[drive*4]; | ||
53 | if ((size_t)drive >= sizeof(part)/sizeof(*part)/4) | ||
54 | return NULL; /* out of space in table */ | ||
55 | #else | ||
56 | struct partinfo* pinfo = part; | ||
57 | #endif | ||
48 | 58 | ||
49 | ata_read_sectors(0,1,§or); | 59 | ata_read_sectors(IF_MV2(drive,) 0,1,§or); |
50 | 60 | ||
51 | /* check that the boot sector is initialized */ | 61 | /* check that the boot sector is initialized */ |
52 | if ( (sector[510] != 0x55) || | 62 | if ( (sector[510] != 0x55) || |
@@ -58,20 +68,20 @@ struct partinfo* disk_init(void) | |||
58 | /* parse partitions */ | 68 | /* parse partitions */ |
59 | for ( i=0; i<4; i++ ) { | 69 | for ( i=0; i<4; i++ ) { |
60 | unsigned char* ptr = sector + 0x1be + 16*i; | 70 | unsigned char* ptr = sector + 0x1be + 16*i; |
61 | part[i].type = ptr[4]; | 71 | pinfo[i].type = ptr[4]; |
62 | part[i].start = BYTES2INT32(ptr, 8); | 72 | pinfo[i].start = BYTES2INT32(ptr, 8); |
63 | part[i].size = BYTES2INT32(ptr, 12); | 73 | pinfo[i].size = BYTES2INT32(ptr, 12); |
64 | 74 | ||
65 | DEBUGF("Part%d: Type %02x, start: %08x size: %08x\n", | 75 | DEBUGF("Part%d: Type %02x, start: %08x size: %08x\n", |
66 | i,part[i].type,part[i].start,part[i].size); | 76 | i,pinfo[i].type,pinfo[i].start,pinfo[i].size); |
67 | 77 | ||
68 | /* extended? */ | 78 | /* extended? */ |
69 | if ( part[i].type == 5 ) { | 79 | if ( pinfo[i].type == 5 ) { |
70 | /* not handled yet */ | 80 | /* not handled yet */ |
71 | } | 81 | } |
72 | } | 82 | } |
73 | 83 | ||
74 | return part; | 84 | return pinfo; |
75 | } | 85 | } |
76 | 86 | ||
77 | struct partinfo* disk_partinfo(int partition) | 87 | struct partinfo* disk_partinfo(int partition) |