aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2020-08-03 14:42:18 +0100
committerMichael Brown <mcb30@ipxe.org>2020-08-03 15:12:43 +0100
commitfd47fa8fe1a3542621d5c97af349b3ae38146585 (patch)
treef6d41f4568cea3db3fec9ec0e426a5c157579b46
parent70b1a641c543cc6d87965df93d1b48eed4e15297 (diff)
downloadipxe-fd47fa8fe1a3542621d5c97af349b3ae38146585.zip
ipxe-fd47fa8fe1a3542621d5c97af349b3ae38146585.tar.gz
ipxe-fd47fa8fe1a3542621d5c97af349b3ae38146585.tar.bz2
[efi] Match EDK2 numbering for USB ports
The various USB specifications all use one-based numbering for ports. This scheme is applied consistently across the various relevant specifications, covering both port numbers that appear on the wire (i.e. downstream hub port numbers) and port numbers that exist only logically (i.e. root hub port numbers). The UEFI specification is ambiguous about the port numbers as used for the ParentPortNumber field within a USB_DEVICE_PATH structure. As of UEFI specification version 2.8 errata B: - section 10.3.4.5 just states "USB Parent Port Number" with no indication of being zero-based or one-based - section 17.1.1 notes that for the EFI_USB2_HC_PROTOCOL, references to PortNumber parameters are zero-based for root hub ports - section 17.1.1 also mentions a TranslatorPortNumber used by EFI_USB2_HC_PROTOCOL, with no indication of being zero-based or one-based - there are no other mentions of USB port numbering schemes. Experimentation and inspection of the EDK2 codebase reveals that at least the EDK2 reference implementation will use zero-based numbering for both root and non-root hub ports when populating a USB_DEVICE_PATH structure (though will inconsistently use one-based numbering for the TranslatorPortNumber parameter). Use zero-based numbering for both root and non-root hub ports when constructing a USB_DEVICE_PATH in order to match the behaviour of the EDK2 implementation. Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rw-r--r--src/interface/efi/efi_usb.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/interface/efi/efi_usb.c b/src/interface/efi/efi_usb.c
index 48274f1..6f49b36 100644
--- a/src/interface/efi/efi_usb.c
+++ b/src/interface/efi/efi_usb.c
@@ -1100,7 +1100,7 @@ static int efi_usb_install ( struct efi_usb_device *usbdev,
usbpath->Header.Type = MESSAGING_DEVICE_PATH;
usbpath->Header.SubType = MSG_USB_DP;
usbpath->Header.Length[0] = sizeof ( *usbpath );
- usbpath->ParentPortNumber = usb->port->address;
+ usbpath->ParentPortNumber = ( usb->port->address - 1 );
}
/* Add to list of interfaces */