X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Modules%2FStorage%2FATA%2Fmbr.c;h=a294ca81f8f70023a87070627588e93d33d9cfaa;hb=4bd32b966938a9f52c22d63cac0b22d6932e585d;hp=bfb488a1b379aabf732efe1f09227fed759b0084;hpb=586a47ab9343a85c944a2cf7b27a74cf459a8423;p=tpg%2Facess2.git diff --git a/Modules/Storage/ATA/mbr.c b/Modules/Storage/ATA/mbr.c index bfb488a1..a294ca81 100644 --- a/Modules/Storage/ATA/mbr.c +++ b/Modules/Storage/ATA/mbr.c @@ -36,7 +36,7 @@ void ATA_ParseMBR(int Disk, tMBR *MBR) ) { if( MBR->Parts[i].SystemID == 0xF || MBR->Parts[i].SystemID == 5 ) { - LOG("Extended Partition"); + LOG("Extended Partition at 0x%llx", MBR->Parts[i].LBAStart); if(extendedLBA != 0) { Warning("Disk %i has multiple extended partitions, ignoring rest", Disk); continue; @@ -44,7 +44,7 @@ void ATA_ParseMBR(int Disk, tMBR *MBR) extendedLBA = MBR->Parts[i].LBAStart; continue; } - LOG("Primary Partition"); + LOG("Primary Partition at 0x%llx", MBR->Parts[i].LBAStart); gATA_Disks[Disk].NumPartitions ++; continue; @@ -54,7 +54,7 @@ void ATA_ParseMBR(int Disk, tMBR *MBR) while(extendedLBA != 0) { extendedLBA = ATA_MBR_int_ReadExt(Disk, extendedLBA, &base, &len); - if( extendedLBA == 0xFFFFFFFF ) return ; + if( extendedLBA == -1 ) break; gATA_Disks[Disk].NumPartitions ++; } LOG("gATA_Disks[Disk].NumPartitions = %i", gATA_Disks[Disk].NumPartitions); @@ -101,6 +101,7 @@ void ATA_ParseMBR(int Disk, tMBR *MBR) while(extendedLBA != 0) { extendedLBA = ATA_MBR_int_ReadExt(Disk, extendedLBA, &base, &len); + if(extendedLBA == -1) break; ATA_int_MakePartition( &gATA_Disks[Disk].Partitions[j], Disk, k, base, len ); @@ -124,7 +125,6 @@ Uint64 ATA_MBR_int_ReadExt(int Disk, Uint64 Addr, Uint64 *Base, Uint64 *Length) if( ATA_ReadDMA( Disk, Addr, 1, &mbr ) != 0 ) return -1; // Stop on Errors - for( i = 0; i < 4; i ++ ) { if( mbr.Parts[i].SystemID == 0 ) continue; @@ -140,8 +140,10 @@ Uint64 ATA_MBR_int_ReadExt(int Disk, Uint64 Addr, Uint64 *Base, Uint64 *Length) len = (mbr.Parts[i].LengthHi << 16) | mbr.Parts[i].LBALength; } else { - Warning("Unknown partition type, Disk %i 0x%llx Part %i", - Disk, Addr, i); + Log_Warning("ATA MBR", + "Unknown partition type 0x%x, Disk %i Ext 0x%llx Part %i", + mbr.Parts[i].Boot, Disk, Addr, i + ); return -1; } @@ -150,16 +152,20 @@ Uint64 ATA_MBR_int_ReadExt(int Disk, Uint64 Addr, Uint64 *Base, Uint64 *Length) case 0xF: case 0x5: if(link != 0) { - Warning("Disk %i has two forward links in the extended partition", - Disk); + Log_Warning("ATA MBR", + "Disk %i has two forward links in the extended partition", + Disk + ); return -1; } link = base; break; default: if(bFoundPart) { - Warning("Disk %i has more than one partition in the extended partition at 0x%llx", - Disk, Addr); + Warning("ATA MBR", + "Disk %i has more than one partition in the extended partition at 0x%llx", + Disk, Addr + ); return -1; } bFoundPart = 1; @@ -170,7 +176,8 @@ Uint64 ATA_MBR_int_ReadExt(int Disk, Uint64 Addr, Uint64 *Base, Uint64 *Length) } if(!bFoundPart) { - Warning("No partition in extended partiton, Disk %i 0x%llx", + Log_Warning("ATA MBR", + "No partition in extended partiton, Disk %i 0x%llx", Disk, Addr); return -1; }