X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=KernelLand%2FModules%2FStorage%2FATA%2Fmbr.c;h=eca8150820bdb0c0f72d02db6f94f9add810ca44;hb=c0793239284dc8709af59826c28b53093edd1fae;hp=a294ca81f8f70023a87070627588e93d33d9cfaa;hpb=48743e39650eb1ef988380e9d95f27fd40d3a9ce;p=tpg%2Facess2.git diff --git a/KernelLand/Modules/Storage/ATA/mbr.c b/KernelLand/Modules/Storage/ATA/mbr.c index a294ca81..eca81508 100644 --- a/KernelLand/Modules/Storage/ATA/mbr.c +++ b/KernelLand/Modules/Storage/ATA/mbr.c @@ -31,25 +31,31 @@ void ATA_ParseMBR(int Disk, tMBR *MBR) for( i = 0; i < 4; i ++ ) { if( MBR->Parts[i].SystemID == 0 ) continue; - if( MBR->Parts[i].Boot == 0x0 || MBR->Parts[i].Boot == 0x80 // LBA 28 - || MBR->Parts[i].Boot == 0x1 || MBR->Parts[i].Boot == 0x81 // LBA 48 - ) + + if( MBR->Parts[i].Boot == 0x0 || MBR->Parts[i].Boot == 0x80 ) // LBA 28 + { + base = MBR->Parts[i].LBAStart; + } + else if( MBR->Parts[i].Boot == 0x1 || MBR->Parts[i].Boot == 0x81 ) // LBA 48 { - if( MBR->Parts[i].SystemID == 0xF || MBR->Parts[i].SystemID == 5 ) { - LOG("Extended Partition at 0x%llx", MBR->Parts[i].LBAStart); - if(extendedLBA != 0) { - Warning("Disk %i has multiple extended partitions, ignoring rest", Disk); - continue; - } - extendedLBA = MBR->Parts[i].LBAStart; + base = (MBR->Parts[i].StartHi << 16) | MBR->Parts[i].LBAStart; + } + else + continue; // Invalid, don't count + + if( MBR->Parts[i].SystemID == 0xF || MBR->Parts[i].SystemID == 5 ) { + LOG("Extended Partition at 0x%llx", base); + if(extendedLBA != 0) { + Warning("Disk %i has multiple extended partitions, ignoring rest", Disk); continue; } - LOG("Primary Partition at 0x%llx", MBR->Parts[i].LBAStart); + extendedLBA = base; + } + else { + LOG("Primary Partition at 0x%llx", base); gATA_Disks[Disk].NumPartitions ++; - continue; } - // Invalid Partition, so don't count it } while(extendedLBA != 0) { @@ -73,7 +79,7 @@ void ATA_ParseMBR(int Disk, tMBR *MBR) base = MBR->Parts[i].LBAStart; len = MBR->Parts[i].LBALength; } - else if( MBR->Parts[i].Boot == 0x1 || MBR->Parts[i].Boot == 0x81 ) // LBA 58 + else if( MBR->Parts[i].Boot == 0x1 || MBR->Parts[i].Boot == 0x81 ) // LBA 48 { base = (MBR->Parts[i].StartHi << 16) | MBR->Parts[i].LBAStart; len = (MBR->Parts[i].LengthHi << 16) | MBR->Parts[i].LBALength; @@ -146,6 +152,7 @@ Uint64 ATA_MBR_int_ReadExt(int Disk, Uint64 Addr, Uint64 *Base, Uint64 *Length) ); return -1; } + base += Addr; // Addresses are relative switch(mbr.Parts[i].SystemID) {