mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-22 22:49:30 +02:00
81dc1a7f89
NOTE: gfxterm_menu module removed, because of this change by upstream: commit ca2a91f43bf6e1df23a07c295534f871ddf2d401 Author: Glenn Washburn <development@efficientek.com> Date: Mon May 5 16:11:36 2025 -0500 tests: Disable gfxterm_menu and cmdline_cat tests This brings in the following changes from upstream: * a68a7dece loader/i386/pc/linux: Fix resource leak * de80acf36 loader/efi/linux: Unload previous Linux kernel/initrd before updating kernel size * 249db11d8 loader/efi/linux: Correctly terminate load_options member * f3b339af1 loader/efi/linux: Use sizeof() instead of constant * c2b2e0dcf loader/efi/linux: Use proper type for len variable * de4e8e2aa loader/efi/linux: Do not pass excessive size for source string * 8c8f96664 loader/efi/linux: Remove useless assignment * 8ebf155af include/grub/charset.h: Update documentation * 2f2ed28d5 Revert "lzma: Make sure we don't dereference past array" * 2539ede82 tests/util/grub-shell: Correct netboot and file_filter test failure * 8c2d4e64f normal/charset: Fix underflow and overflow in loop init * ba8eadde6 dl: Provide a fake grub_dl_set_persistent() and grub_dl_is_persistent() for the emu target * 409e72ced util/grub-protect: Correct uninit "err" variable * 5eca564b1 gnulib: Bring back the fix for resolving unused variable issue * ac1512b87 gnulib: Add patch to allow GRUB w/GCC-15 compile * db506b3b8 gnulib/regexec: Fix resource leak * bba7dd736 gnulib/regcomp: Fix resource leak * 91cb7ff6b tests/tpm2_key_protector_test: Add tests for SHA-384 PCR bank * 451e227e5 tpm2_key_protector: Dump the PCR bank for key unsealing * 11caacdb2 util/grub-protect: Fix the hash algorithm of PCR digest * ce23919ca build: Add new header files to dist to allow building from tar * e3b15bafd build: Remove extra_deps.lst from EXTRA_DIST * 40e261b89 lib/LzmaEnc: Validate "len" before subtracting * 86e8f2c4b osdep/unix/hostdisk: Fix signed integer overflow * 438f05581 disk/luks2: Add attempting to decrypt message to align with luks and geli modules * 20e6d0c4a osdep/linux/getroot: Detect DDF container similar to IMSM * b71bc0f8b fs/fshelp: Avoid possible NULL pointer deference * 272ff81cb fs/ntfs: Correct possible infinite loops/hangs * 8c95307a0 fs/ntfs: Correct possible access violations * 06914b614 fs/ntfs: Correct attribute vs attribute list validation * 0e1762c8a fs/ntfs: Correct regression with run list calculation * be303f8c1 lib/envblk: Ignore empty new lines while parsing env files * 34bd00ee2 fs/zfs: Fix another memory leak in ZFS code * ca2a91f43 tests: Disable gfxterm_menu and cmdline_cat tests Signed-off-by: Leah Rowe <leah@libreboot.org>
128 lines
4.0 KiB
Diff
128 lines
4.0 KiB
Diff
From d84ac94dc55baad9a2297980b2017cd22e4ecb3c Mon Sep 17 00:00:00 2001
|
|
From: Patrick Rudolph <patrick.rudolph@9elements.com>
|
|
Date: Mon, 7 Dec 2020 08:41:27 +0100
|
|
Subject: [PATCH 20/26] grub-core/bus/usb/usbhub: Add xHCI non root hub support
|
|
|
|
Tested on Intel PCH C246, the USB3 hub can be configured by grub.
|
|
|
|
Issues:
|
|
* USB3 devices connected behind that hub are sometimes not detected.
|
|
|
|
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
|
|
---
|
|
grub-core/bus/usb/usbhub.c | 38 +++++++++++++++++++++++++++++++++-----
|
|
include/grub/usbdesc.h | 1 +
|
|
include/grub/usbtrans.h | 4 ++++
|
|
3 files changed, 38 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/grub-core/bus/usb/usbhub.c b/grub-core/bus/usb/usbhub.c
|
|
index b4b3a1a61..e96505aa9 100644
|
|
--- a/grub-core/bus/usb/usbhub.c
|
|
+++ b/grub-core/bus/usb/usbhub.c
|
|
@@ -148,19 +148,32 @@ grub_usb_hub_add_dev (grub_usb_controller_t controller,
|
|
return dev;
|
|
}
|
|
|
|
-
|
|
+static grub_usb_err_t
|
|
+grub_usb_set_hub_depth(grub_usb_device_t dev, grub_uint8_t depth)
|
|
+{
|
|
+ return grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_OUT
|
|
+ | GRUB_USB_REQTYPE_CLASS
|
|
+ | GRUB_USB_REQTYPE_TARGET_DEV),
|
|
+ GRUB_USB_HUB_REQ_SET_HUB_DEPTH, depth,
|
|
+ 0, 0, NULL);
|
|
+}
|
|
+
|
|
static grub_usb_err_t
|
|
grub_usb_add_hub (grub_usb_device_t dev)
|
|
{
|
|
struct grub_usb_usb_hubdesc hubdesc;
|
|
grub_usb_err_t err;
|
|
+ grub_uint16_t req;
|
|
int i;
|
|
|
|
+ req = (dev->speed == GRUB_USB_SPEED_SUPER) ? GRUB_USB_DESCRIPTOR_SS_HUB :
|
|
+ GRUB_USB_DESCRIPTOR_HUB;
|
|
+
|
|
err = grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_IN
|
|
| GRUB_USB_REQTYPE_CLASS
|
|
| GRUB_USB_REQTYPE_TARGET_DEV),
|
|
- GRUB_USB_REQ_GET_DESCRIPTOR,
|
|
- (GRUB_USB_DESCRIPTOR_HUB << 8) | 0,
|
|
+ GRUB_USB_REQ_GET_DESCRIPTOR,
|
|
+ (req << 8) | 0,
|
|
0, sizeof (hubdesc), (char *) &hubdesc);
|
|
if (err)
|
|
return err;
|
|
@@ -183,6 +196,19 @@ grub_usb_add_hub (grub_usb_device_t dev)
|
|
return GRUB_USB_ERR_INTERNAL;
|
|
}
|
|
|
|
+ if (dev->speed == GRUB_USB_SPEED_SUPER)
|
|
+ {
|
|
+ grub_uint8_t depth;
|
|
+ grub_uint32_t route;
|
|
+ /* Depth maximum value is 5, but root hubs doesn't count */
|
|
+ for (depth = 0, route = dev->route; (route & 0xf) > 0; route >>= 4)
|
|
+ depth++;
|
|
+
|
|
+ err = grub_usb_set_hub_depth(dev, depth);
|
|
+ if (err)
|
|
+ return err;
|
|
+ }
|
|
+
|
|
/* Power on all Hub ports. */
|
|
for (i = 1; i <= hubdesc.portcnt; i++)
|
|
{
|
|
@@ -637,7 +663,9 @@ poll_nonroot_hub (grub_usb_device_t dev)
|
|
int split_hubaddr = 0;
|
|
|
|
/* Determine the device speed. */
|
|
- if (status & GRUB_USB_HUB_STATUS_PORT_LOWSPEED)
|
|
+ if (dev->speed == GRUB_USB_SPEED_SUPER)
|
|
+ speed = GRUB_USB_SPEED_SUPER;
|
|
+ else if (status & GRUB_USB_HUB_STATUS_PORT_LOWSPEED)
|
|
speed = GRUB_USB_SPEED_LOW;
|
|
else
|
|
{
|
|
@@ -651,7 +679,7 @@ poll_nonroot_hub (grub_usb_device_t dev)
|
|
grub_millisleep (10);
|
|
|
|
/* Find correct values for SPLIT hubport and hubaddr */
|
|
- if (speed == GRUB_USB_SPEED_HIGH)
|
|
+ if (speed == GRUB_USB_SPEED_HIGH || speed == GRUB_USB_SPEED_SUPER)
|
|
{
|
|
/* HIGH speed device needs not transaction translation */
|
|
split_hubport = 0;
|
|
diff --git a/include/grub/usbdesc.h b/include/grub/usbdesc.h
|
|
index bb2ab2e27..1697aa465 100644
|
|
--- a/include/grub/usbdesc.h
|
|
+++ b/include/grub/usbdesc.h
|
|
@@ -30,6 +30,7 @@ typedef enum {
|
|
GRUB_USB_DESCRIPTOR_ENDPOINT,
|
|
GRUB_USB_DESCRIPTOR_DEBUG = 10,
|
|
GRUB_USB_DESCRIPTOR_HUB = 0x29,
|
|
+ GRUB_USB_DESCRIPTOR_SS_HUB = 0x2a,
|
|
GRUB_USB_DESCRIPTOR_SS_ENDPOINT_COMPANION = 0x30
|
|
} grub_usb_descriptor_t;
|
|
|
|
diff --git a/include/grub/usbtrans.h b/include/grub/usbtrans.h
|
|
index 039ebed65..d6c3f71dc 100644
|
|
--- a/include/grub/usbtrans.h
|
|
+++ b/include/grub/usbtrans.h
|
|
@@ -110,6 +110,10 @@ enum
|
|
GRUB_USB_REQ_SET_INTERFACE = 0x0B,
|
|
GRUB_USB_REQ_SYNC_FRAME = 0x0C
|
|
};
|
|
+enum
|
|
+ {
|
|
+ GRUB_USB_HUB_REQ_SET_HUB_DEPTH = 0x0C,
|
|
+ };
|
|
|
|
#define GRUB_USB_FEATURE_ENDP_HALT 0x00
|
|
#define GRUB_USB_FEATURE_DEV_REMOTE_WU 0x01
|
|
--
|
|
2.39.5
|
|
|