public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* Question about Block IO protocol devices
@ 2022-01-28  0:34 valerij zaporogeci
  2022-01-28  1:28 ` [edk2-devel] " Andrew Fish
  0 siblings, 1 reply; 5+ messages in thread
From: valerij zaporogeci @ 2022-01-28  0:34 UTC (permalink / raw)
  To: devel

Hi, edk2. I would be glad to clarify one thing. When I request all
handles, on which Block IO protocol (BIOP) is installed (through
LocateHandleBuffer(ByProtocol), and then open Device Path protocol
(DPP) on every of them to see what devices support BIOP, I don't see
ones, that should represent the whole physical (raw) disk. In other
words, there are no devices, whose DP would end with 4.1 Type.SubType
node _and_ partition number n == 0, this is what the spec suggests as
a way of representing the whole (raw) disk (as opposite to a
partition, on which n =/= 0). Instead, I am getting BIOP instances on
devices, whose DP ends at the level before, a parent device that is,
for example, say 3.1 (Messaging.ATAPI). These are supposedly for
representing the whole (raw) disk? because there are no other thing
being that. E.g. if I have a harddisk with MBR and one partition on
it, the DP for the partition device, supporting BIOP, would be
something like:

PciRoot(0)\Pci(0, 0)\Ata(0)\HD(1, MBR, sign, start, size)

But there wouldn't be a device enumerated like:

PciRoot(0)\Pci(0, 0)\Ata(0)\HD(0,MBR, sign)

Instead, there would be one like this:

PciRoot(0)\Pci(0, 0)\Ata(0)

the question is:
what DP the specification defines to represent a whole (raw) disk?
1) the one, ending with 4.1 Type.SubType and partition number n == 0
2) the DP of the parent of any partition, residing on it, for example
the one, ending with 3.1 Type.SubType

Thank you.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [edk2-devel] Question about Block IO protocol devices
  2022-01-28  0:34 Question about Block IO protocol devices valerij zaporogeci
@ 2022-01-28  1:28 ` Andrew Fish
  2022-01-28  2:19   ` valerij zaporogeci
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Fish @ 2022-01-28  1:28 UTC (permalink / raw)
  To: devel, vlrzprgts



> On Jan 27, 2022, at 4:34 PM, valerij zaporogeci <vlrzprgts@gmail.com> wrote:
> 
> Hi, edk2. I would be glad to clarify one thing. When I request all
> handles, on which Block IO protocol (BIOP) is installed (through
> LocateHandleBuffer(ByProtocol), and then open Device Path protocol
> (DPP) on every of them to see what devices support BIOP, I don't see
> ones, that should represent the whole physical (raw) disk. In other
> words, there are no devices, whose DP would end with 4.1 Type.SubType
> node _and_ partition number n == 0, this is what the spec suggests as
> a way of representing the whole (raw) disk (as opposite to a
> partition, on which n =/= 0). Instead, I am getting BIOP instances on
> devices, whose DP ends at the level before, a parent device that is,
> for example, say 3.1 (Messaging.ATAPI). These are supposedly for
> representing the whole (raw) disk? because there are no other thing
> being that. E.g. if I have a harddisk with MBR and one partition on
> it, the DP for the partition device, supporting BIOP, would be
> something like:
> 
> PciRoot(0)\Pci(0, 0)\Ata(0)\HD(1, MBR, sign, start, size)
> 
> But there wouldn't be a device enumerated like:
> 
> PciRoot(0)\Pci(0, 0)\Ata(0)\HD(0,MBR, sign)
> 
> Instead, there would be one like this:
> 
> PciRoot(0)\Pci(0, 0)\Ata(0)
> 
> the question is:
> what DP the specification defines to represent a whole (raw) disk?
> 1) the one, ending with 4.1 Type.SubType and partition number n == 0

I see the text in table 10-49 but I don’t know of any code that makes a node for the entire disk partition. 

If you look at the BlockIO protocol the partitions that are created due to the partitions on the disk will have BlockIo->Media->LogicalPartition set to TRUE.

The partition driver produce a logical partition for each valid MBR partition:
https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c

The disk driver is going to produce a device path that points to the raw disk:
PciRoot(0)\Pci(0, 0)\Ata(0)

> 2) the DP of the parent of any partition, residing on it, for example
> the one, ending with 3.1 Type.SubType
> 

This is the raw disk as produced by the disk driver. BlockIo->Media->LogicalPartition is FALSE.

I don’t remember the use case for HD(0,MBR, sign) type of device path node? It is not for legacy BOOT as that would be a BBS entry. 

Thanks,

Andrew Fish

> Thank you.
> 
> 
> 
> 
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [edk2-devel] Question about Block IO protocol devices
  2022-01-28  1:28 ` [edk2-devel] " Andrew Fish
@ 2022-01-28  2:19   ` valerij zaporogeci
  2022-01-28  3:19     ` Andrew Fish
  0 siblings, 1 reply; 5+ messages in thread
From: valerij zaporogeci @ 2022-01-28  2:19 UTC (permalink / raw)
  To: Andrew Fish; +Cc: devel

Thank you, Andrew, for the clarification.

> I don’t remember the use case for HD(0,MBR, sign) type of device path node?

don't know, how much of usability it would have per se, but
representing a raw disk this way, would give an easier way to find
them out. because all such would end with the same 4.1 Type.SubType
and partition number. without this, a raw disk could be 3.1, or 3.25
or 3.26 or 3.29 or even 1.4 (VenHw(GUID)) or 1.1 (Pci(2, 0)) as is
with OVMF for qemu arm64.

And yet one thing. The Signature field in the 4.1 typed node for the
case of GPT for a partition device. Did I understand correctly, that
its should contain the same GUID as is in the corresponding GUID
Partition Array entry field UniquePartitionGuid for that partition?
Because one implementation (not edk2) puts as the Signature field
DiskGuid in every partition Device Path node.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [edk2-devel] Question about Block IO protocol devices
  2022-01-28  2:19   ` valerij zaporogeci
@ 2022-01-28  3:19     ` Andrew Fish
  2022-01-28  3:45       ` valerij zaporogeci
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Fish @ 2022-01-28  3:19 UTC (permalink / raw)
  To: valerij zaporogeci; +Cc: devel

[-- Attachment #1: Type: text/plain, Size: 1505 bytes --]



> On Jan 27, 2022, at 6:19 PM, valerij zaporogeci <vlrzprgts@gmail.com> wrote:
> 
> Thank you, Andrew, for the clarification.
> 
>> I don’t remember the use case for HD(0,MBR, sign) type of device path node?
> 
> don't know, how much of usability it would have per se, but
> representing a raw disk this way, would give an easier way to find
> them out. because all such would end with the same 4.1 Type.SubType
> and partition number. without this, a raw disk could be 3.1, or 3.25
> or 3.26 or 3.29 or even 1.4 (VenHw(GUID)) or 1.1 (Pci(2, 0)) as is
> with OVMF for qemu arm64.
> 

In general is it bad to assume what the disk node is going to look like. You have know idea what the transport is going to look like and how that transport enumerates disks. 

As I mentioned the BlockIO protocol instance will tell you if it is for a physical disk or partition via the BlockIo->Media->LogicalPartition member. 

> And yet one thing. The Signature field in the 4.1 typed node for the
> case of GPT for a partition device. Did I understand correctly, that
> its should contain the same GUID as is in the corresponding GUID
> Partition Array entry field UniquePartitionGuid for that partition?
> Because one implementation (not edk2) puts as the Signature field
> DiskGuid in every partition Device Path node.

Yes it is the UniquePartitionGUID
https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Universal/Disk/PartitionDxe/Gpt.c#L389

Thanks,

Andrew Fish




[-- Attachment #2: Type: text/html, Size: 2841 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [edk2-devel] Question about Block IO protocol devices
  2022-01-28  3:19     ` Andrew Fish
@ 2022-01-28  3:45       ` valerij zaporogeci
  0 siblings, 0 replies; 5+ messages in thread
From: valerij zaporogeci @ 2022-01-28  3:45 UTC (permalink / raw)
  To: Andrew Fish; +Cc: devel

Thanks again for your explanatory answers. Indeed,
BlockIo->Media->LogicalPartition is more than enough. Admittedly, I
overlooked that field. And now I can confidently tell to those
firmware writers about the bug. it's uboot cough cough. :D

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-01-28  3:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-28  0:34 Question about Block IO protocol devices valerij zaporogeci
2022-01-28  1:28 ` [edk2-devel] " Andrew Fish
2022-01-28  2:19   ` valerij zaporogeci
2022-01-28  3:19     ` Andrew Fish
2022-01-28  3:45       ` valerij zaporogeci

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox