[Fw_Os_Forum] USB Media Path in the Boot Option's device path - inconsistency with USB port parent numbering

Karen Gabrielyan karen.gabrielyan at fixmestick.com
Sun Feb 5 15:53:08 EST 2017


I'm observing strange behavior with USB Media Path protocol when using it
in a UEFI boot option, so would much appreciate any advise one this.
The problem I see is in USB port numbering when creating UEFI boot options
(BootXXXX) that have USB Media Path as part of the device path.

My objective is to make computer boot into Linux OS that is flashed on a
USB stick. The USB device structure conforms to UEFI spec, with properly
signed EFI image being located in the \EFI\BOOT\BOOTx64.EFI location on a
bootable FAT32 partition of the USB drive. The proper signing of the EFI
file is there to ensure that the OS would not be rejected by SecureBoot.

I see strange behavior where the *USB Parent Port Number* within USB Media
Path is being interpreted differently on different computers (with
different or sometimes same BIOS vendors).
On some machines passing 0-based port number makes the PC properly boot
into my USB-Device Path-based boot option.
And on other PC-s only the 1-based port numbering works properly.

The UEFI spec says that the last two fields of the USB Device Path are the
* USB **Parent **Port Number* and the *Interface *respectively.  I attached
the portion of spec as an image to this email. USB Device Paths
  Table 58. USB Device Path
  Mnemonic                | Byte Offset | Byte Length | Description

 Type             |      0      |      1      |  Type 3 – Messaging Device
Sub-Type           |      1      |      1      |  Sub-Type 5 – USB
Length            |      2      |      2      |  Length of this structure
in bytes. Length is 6 bytes.
USB Parent Port Number     |      4      |      1      |  USB Parent Port
Interface          |      5      |      1      |  USB Interface Number

The spec does not specify whether the *USB Parent Port Number* (the port
number within parent USB hub) is 0-based or 1-based.
The examples that follow this section in the spec indicate that port number
being 0-based.

I'm pretty certain of behavior, as I've forced computers to boot into my
USB-based OS through USB multiple ports on multiple USB host controllers.
We tried the behavior on PC-s that have varying number of USB controllers,
different number of USB hubs between USB device and the controller.
And even with cases where there were multiple USB hubs involved in the full
device path, the port numbers of entire USB hub chain had to be wither
0-based or 1-based.

PciRoot(0)/PCI(x,y/USB(1,0)/USB(3,0)/USB(2,0) - in this example all USB
components had to have 1-based ports for boot option to load my OS.
PciRoot(0)/PCI(x,y/USB(0,0)/(1,0) - and here all USB components had to have
0-based ports for my OS to load properly.

I need to find a reliable way to boot into the operating system from USB
device which I know resides on specific USB controller/port/hub.
And our product requires this to work consistently on different models of
UEFI-based computers.
But this 0-based vs 1-based USB Parent Port numbering throws off the logic
of our software.

Can anyone help out with what's at play here with USB port numbers?
Is the port numbering supposed to be strict, or any UEFI vendor is free to
choose their how to interpret it?

Thanks and regards,
Karen Gabrielyan

[image: Inline image 1]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mailman.uefi.org/pipermail/fw_os_forum/attachments/20170205/a058542e/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 79625 bytes
Desc: not available
URL: <http://lists.mailman.uefi.org/pipermail/fw_os_forum/attachments/20170205/a058542e/attachment-0001.png>

More information about the Fw_os_forum mailing list