coreboot/payloads/libpayload/drivers/usb
Julius Werner f2cf732997 libpayload: usbmsc: Correctly deal with disks larger than 2TB
Disks larger than 2TB (technically disks with more than 2^32 blocks, but
for the common block size of 512 that comes out to 2TB) cannot represent
their full amount of blocks in the SCSI READ_CAPACITY(10) command used
by libpayload's USB mass storage driver. The entire driver isn't written
to support block addresses larger than 32 bits anyway.

The SCSI command has been designed in a clever way so that devices are
supposed to return the maximum value (0xffffffff) if the actual value
doesn't fit. However, our code adds one to the value (because it is
actually the address of the last block, but we want to know the number
of blocks). This makes it overflow back to 0 which is not great.

This patch caps the result before incrementing it so that the overflow
cannot occur, allowing us to at least access the first 2TB of super
large USB sticks.

Change-Id: Ic445923b7d588c4f523c4ed95a06291bc1969261
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/87506
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
2025-05-02 23:24:25 +00:00
..
dwc2.c
dwc2.h libpayload: usb: Fix spacing issues 2022-08-12 17:17:53 +00:00
dwc2_private.h
dwc2_rh.c
ehci.c libpayload: usb: Fix spacing issues 2022-08-12 17:17:53 +00:00
ehci.h libpayload: usb: Fix spacing issues 2022-08-12 17:17:53 +00:00
ehci_private.h
ehci_rh.c libpayload: usb: Fix spacing issues 2022-08-12 17:17:53 +00:00
generic_hub.c
generic_hub.h libpayload: usb: Fix spacing issues 2022-08-12 17:17:53 +00:00
Kconfig
ohci.c libpayload: usb: Fix spacing issues 2022-08-12 17:17:53 +00:00
ohci.h libpayload: usb: Fix spacing issues 2022-08-12 17:17:53 +00:00
ohci_private.h libpayload: usb: Fix spacing issues 2022-08-12 17:17:53 +00:00
ohci_rh.c libpayload: usb: Fix spacing issues 2022-08-12 17:17:53 +00:00
quirks.c
TODO
uhci.c libpayload: Add x86_64 (64-bit) support 2024-05-26 01:26:31 +00:00
uhci.h libpayload: usb: Fix spacing issues 2022-08-12 17:17:53 +00:00
uhci_private.h libpayload: usb: Fix spacing issues 2022-08-12 17:17:53 +00:00
uhci_rh.c libpayload/uhci: Re-write UHCI RH driver w/ generic_hub API 2023-06-12 17:00:28 +00:00
usb.c libpayload: usb: Fix spacing issues 2022-08-12 17:17:53 +00:00
usb_dev.c libpayload: usb: Fix spacing issues 2022-08-12 17:17:53 +00:00
usbhid.c libpayload: Add after an if conditional on the next line 2023-09-07 13:33:39 +00:00
usbhub.c libpayload: usb: Fix spacing issues 2022-08-12 17:17:53 +00:00
usbinit.c libpayload: usb: Fix spacing issues 2022-08-12 17:17:53 +00:00
usbmsc.c libpayload: usbmsc: Correctly deal with disks larger than 2TB 2025-05-02 23:24:25 +00:00
xhci.c libpayload/drivers/usb/xhci.c: Check for NULL in xhci_init 2023-06-06 21:04:25 +00:00
xhci.h libpayload: usb: Fix spacing issues 2022-08-12 17:17:53 +00:00
xhci_commands.c
xhci_debug.c
xhci_devconf.c libpayload: usb: Fix spacing issues 2022-08-12 17:17:53 +00:00
xhci_events.c
xhci_private.h libpayload: usb: Fix spacing issues 2022-08-12 17:17:53 +00:00
xhci_rh.c libpayload: usb: Fix spacing issues 2022-08-12 17:17:53 +00:00