155 TBool foundSwap = EFalse; |
155 TBool foundSwap = EFalse; |
156 |
156 |
157 BGAHSMMCPTN_PI_STR *partitionTable = (BGAHSMMCPTN_PI_STR*)(&iIntBuf[0]); |
157 BGAHSMMCPTN_PI_STR *partitionTable = (BGAHSMMCPTN_PI_STR*)(&iIntBuf[0]); |
158 |
158 |
159 // Verify that this is the Nokia partition table |
159 // Verify that this is the Nokia partition table |
160 if( memcompare( (TUint8*)&(partitionTable->id[0]), sizeof(BGAHSMMCPTN_PI_ID), (TUint8*)BGAHSMMCPTN_PI_ID, sizeof(BGAHSMMCPTN_PI_ID)) == 0 ) |
160 if( memcompare( (TUint8*)&(partitionTable->iId[0]), sizeof(BGAHSMMCPTN_PI_ID), (TUint8*)BGAHSMMCPTN_PI_ID, sizeof(BGAHSMMCPTN_PI_ID)) == 0 ) |
161 { |
161 { |
162 __KTRACE_OPT(KPBUSDRV, Kern::Printf("Nokia partition structure found")); |
162 __KTRACE_OPT(KPBUSDRV, Kern::Printf("Nokia partition structure found")); |
163 __KTRACE_OPT(KPBUSDRV, Kern::Printf("partitionTable->id..............: %s", partitionTable->id )); |
163 __KTRACE_OPT(KPBUSDRV, Kern::Printf("partitionTable->id..............: %s", partitionTable->iId )); |
164 __KTRACE_OPT(KPBUSDRV, Kern::Printf("partitionTable->sector_size.....: %d = 0x%x", partitionTable->sector_size, partitionTable->sector_size)); |
164 __KTRACE_OPT(KPBUSDRV, Kern::Printf("partitionTable->sector_size.....: %d = 0x%x", partitionTable->iSector_size, partitionTable->iSector_size)); |
165 __KTRACE_OPT(KPBUSDRV, Kern::Printf("partitionTable->major_ver.......: %d", partitionTable->major_ver)); |
165 __KTRACE_OPT(KPBUSDRV, Kern::Printf("partitionTable->major_ver.......: %d", partitionTable->iMajor_ver)); |
166 __KTRACE_OPT(KPBUSDRV, Kern::Printf("partitionTable->minor_ver.......: %d", partitionTable->minor_ver)); |
166 __KTRACE_OPT(KPBUSDRV, Kern::Printf("partitionTable->minor_ver.......: %d", partitionTable->iMinor_ver)); |
167 __KTRACE_OPT(KPBUSDRV, Kern::Printf("partitionTable->partition_amount: %d", partitionTable->partition_amount)); |
167 __KTRACE_OPT(KPBUSDRV, Kern::Printf("partitionTable->partition_amount: %d", partitionTable->iPartition_amount)); |
168 |
168 |
169 for( TUint8 index = 0; (index < partitionTable->partition_amount) && (index < BGAHSMMCPTN_LAST_DRIVE); index++ ) |
169 |
170 { |
170 TUint8 PartitionType = 0; |
171 if( (partitionTable->partitions[index].size > 0) && |
171 // Check Supported Version is present |
172 ( PartitionIsFAT(partitionTable->partitions[index].partition_id) || |
172 if (partitionTable->iMajor_ver <= BGAHSMMCPTN_PI_VER_MAJOR) |
173 PartitionIsFAT32(partitionTable->partitions[index].partition_id) || |
173 { |
174 (KPartitionTypePagedData == partitionTable->partitions[index].partition_id && !foundSwap) ) ) |
174 for( TUint8 index = 0; (index < partitionTable->iPartition_amount) && (index < BGAHSMMCPTN_LAST_DRIVE); index++ ) |
175 { |
175 { |
176 iPartitionInfo->iEntry[partitionCount].iPartitionType = partitionTable->partitions[index].partition_id; |
176 if (partitionTable->iMinor_ver >= BGAHSMMCPTN_PART_TYPE_SUPP_VER_MINOR) |
177 iPartitionInfo->iEntry[partitionCount].iPartitionBaseAddr = (Int64) partitionTable->partitions[index].start_sector << KDiskSectorShift; |
177 PartitionType = partitionTable->iPartitions[index].iPartition_type; |
178 iPartitionInfo->iEntry[partitionCount].iPartitionLen = (Int64) partitionTable->partitions[index].size << KDiskSectorShift; |
178 else |
179 iPartitionAttributes[partitionCount] = partitionTable->partitions[index].partition_attributes; |
179 PartitionType = partitionTable->iPartitions[index].iPartition_id; |
180 |
180 |
181 __KTRACE_OPT(KPBUSDRV, Kern::Printf("Registering partition #%d:", partitionCount)); |
181 if( (partitionTable->iPartitions[index].iSize > 0) && |
182 __KTRACE_OPT(KPBUSDRV, Kern::Printf("partitionCount....: %d", partitionCount)); |
182 ( PartitionIsFAT(PartitionType) || |
183 __KTRACE_OPT(KPBUSDRV, Kern::Printf("startSector.......: 0x%x", partitionTable->partitions[index].start_sector )); |
183 PartitionIsFAT32(PartitionType) || |
184 __KTRACE_OPT(KPBUSDRV, Kern::Printf("iPartitionBaseAddr: 0x%lx (sectors: %d)", iPartitionInfo->iEntry[partitionCount].iPartitionBaseAddr, (TUint32)(iPartitionInfo->iEntry[partitionCount].iPartitionBaseAddr >> KDiskSectorShift))); |
184 (KPartitionTypePagedData == PartitionType && !foundSwap) ) ) |
185 __KTRACE_OPT(KPBUSDRV, Kern::Printf("size..............: 0x%lx", partitionTable->partitions[index].size )); |
185 { |
186 __KTRACE_OPT(KPBUSDRV, Kern::Printf("iPartitionLen.....: 0x%lx (sectors: %d)", iPartitionInfo->iEntry[partitionCount].iPartitionLen, iPartitionInfo->iEntry[partitionCount].iPartitionLen >> KDiskSectorShift)); |
186 iPartitionInfo->iEntry[partitionCount].iPartitionType = PartitionType; |
187 __KTRACE_OPT(KPBUSDRV, Kern::Printf("iPartitionType....: %d", iPartitionInfo->iEntry[partitionCount].iPartitionType)); |
187 iPartitionInfo->iEntry[partitionCount].iPartitionBaseAddr = (Int64) partitionTable->iPartitions[index].iStart_sector << KDiskSectorShift; |
188 __KTRACE_OPT(KPBUSDRV, Kern::Printf("iPartitionAttribs.: 0x%x", iPartitionAttributes[partitionCount])); |
188 iPartitionInfo->iEntry[partitionCount].iPartitionLen = (Int64) partitionTable->iPartitions[index].iSize << KDiskSectorShift; |
189 __KTRACE_OPT(KPBUSDRV, Kern::Printf(" ")); |
189 iPartitionAttributes[partitionCount] = partitionTable->iPartitions[index].iPartition_attributes; |
190 |
190 |
191 if(KPartitionTypePagedData == partitionTable->partitions[index].partition_id) |
191 __KTRACE_OPT(KPBUSDRV, Kern::Printf("Registering partition #%d:", partitionCount)); |
192 { |
192 __KTRACE_OPT(KPBUSDRV, Kern::Printf("partitionCount....: %d", partitionCount)); |
193 foundSwap = ETrue; |
193 __KTRACE_OPT(KPBUSDRV, Kern::Printf("startSector.......: 0x%x", partitionTable->iPartitions[index].iStart_sector )); |
194 } |
194 __KTRACE_OPT(KPBUSDRV, Kern::Printf("iPartitionBaseAddr: 0x%lx (sectors: %d)", iPartitionInfo->iEntry[partitionCount].iPartitionBaseAddr, (TUint32)(iPartitionInfo->iEntry[partitionCount].iPartitionBaseAddr >> KDiskSectorShift))); |
195 |
195 __KTRACE_OPT(KPBUSDRV, Kern::Printf("size..............: 0x%lx", partitionTable->iPartitions[index].iSize )); |
196 partitionCount++; |
196 __KTRACE_OPT(KPBUSDRV, Kern::Printf("iPartitionLen.....: 0x%lx (sectors: %d)", iPartitionInfo->iEntry[partitionCount].iPartitionLen, iPartitionInfo->iEntry[partitionCount].iPartitionLen >> KDiskSectorShift)); |
197 } |
197 __KTRACE_OPT(KPBUSDRV, Kern::Printf("iPartitionType....: %d", iPartitionInfo->iEntry[partitionCount].iPartitionType)); |
198 } |
198 __KTRACE_OPT(KPBUSDRV, Kern::Printf("iPartitionAttribs.: 0x%x", iPartitionAttributes[partitionCount])); |
199 } |
199 __KTRACE_OPT(KPBUSDRV, Kern::Printf(" ")); |
|
200 |
|
201 if(KPartitionTypePagedData == PartitionType) |
|
202 { |
|
203 foundSwap = ETrue; |
|
204 } |
|
205 |
|
206 partitionCount++; |
|
207 } |
|
208 } |
|
209 } |
|
210 } |
200 |
211 |
201 // Validate partition address boundaries |
212 // Validate partition address boundaries |
202 if(partitionCount == 0) |
213 if(partitionCount == 0) |
203 { |
214 { |
204 __KTRACE_OPT(KPBUSDRV, Kern::Printf("Mmc: No supported partitions found!")); |
215 __KTRACE_OPT(KPBUSDRV, Kern::Printf("Mmc: No supported partitions found!")); |