IMO, The last block should be pointing to the last block of the disk.
Whereas the PartitionEndLBA should be the partition’s last block, so for
your purpose you should use the End LBA of the partition.



Thanks

Sathya



PS: My E-mail ID changed from [email protected] to
[email protected]. Please update your address book.



*From:* Nguyễn Văn Hiễn [mailto:[email protected]]
*Sent:* Tuesday, September 09, 2014 2:01 AM
*To:* [email protected]
*Subject:* [edk2] LastBlock and End LBA



Hi all,

I wrote a code segment to get the information of a SATA's partition:


//SATA devices have MediaId = 0.
if (SataBlockIo != NULL && SataBlockIo->Media->MediaId == 0) {
   if (((HARDDRIVE_DEVICE_PATH*)TmpPath)->MBRType ==
MBR_TYPE_EFI_PARTITION_TABLE_HEADER &&
                ((HARDDRIVE_DEVICE_PATH*)TmpPath)->MBRType ==
SIGNATURE_TYPE_GUID) {

        INFO ("PartitionEndLBA: %lx\n",
((HARDDRIVE_DEVICE_PATH*)TmpPath)->PartitionSize +
((HARDDRIVE_DEVICE_PATH*)TmpPath)->PartitionStart - 1);
        INFO ("LastBlock: %lx\n", SataBlockIo->Media->LastBlock);
    }
}

But LastBlock (SataBlockIo->Media->LastBlock) is not equal to End LBA
(PartitionSize + PartitionStart - 1).

I want to read/write the "last block" of a partition. Should I use
LastBlock or End LBA?



Thanks,

Hien

=================
HCMUT
[email protected]
------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce.
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to