mirror of
https://codeberg.org/canoeboot/cbmk.git
synced 2024-11-22 10:14:44 +00:00
8d6376e61e
Of note: upstream has made several improvements to memory management, and several fixes to file systems. User-friendly change to LUKS: if the passphrase input failed, the user is prompted again for the correct passphrase, instead of GRUB just failing. Similar to cryptsetup luksOpen behaviour under Linux. This pulls in the following changes from upstream (gnu.org): * b53ec06a1 util/grub-mkrescue: Check existence of option arguments * ab9fe8030 loader/efi/fdt: Add fdtdump command to access device tree * 0cfec355d osdep/devmapper/getroot: Unmark 2 strings for translation * f171122f0 loader/emu/linux: Fix determination of program name * 828717833 disk/cryptodisk: Fix translatable message * 9a2134a70 tests: Add test for ZFS zstd * f96df6fe9 fs/zfs/zfs: Add support for zstd compression * 55d35d628 kern/efi/mm: Detect calls to grub_efi_drop_alloc() with wrong page counts * 61f1d0a61 kern/efi/mm: Change grub_efi_allocate_pages_real() to call semantically correct free function * dc0a3a27d kern/efi/mm: Change grub_efi_mm_add_regions() to keep track of map allocation size * b990df0be tests/util/grub-fs-tester: Fix EROFS label tests in grub-fs-tester * d41c64811 tests: Switch to requiring exfatprogs from exfat-utils * c1ee4da6a tests/util/grub-shell-luks-tester: Fix detached header test getting wrong header path * c22e052fe tests/util/grub-shell: Add flexibility in QEMU firmware handling * d2fc9dfcd tests/util/grub-shell: Use pflash instead of -bios to load UEFI firmware * 88a7e64c2 tests/util/grub-shell: Print gdbinfo if on EFI platform * b8d29f114 configure: Add Debian/Ubuntu DejaVu font path * 13b315c0a term/ns8250-spcr: Add one more 16550 debug type * 8abec8e15 loader/i386/multiboot_mbi: Fix handling of errors in broken aout-kludge * d35ff2251 net/drivers/ieee1275/ofnet: Remove 200 ms timeout in get_card_packet() to reduce input latency * 86df79275 commands/efi/tpm: Re-enable measurements on confidential computing platforms * 0b4d01794 util/grub-mkpasswd-pbkdf2: Simplify the main function implementation * fa36f6376 kern/ieee1275/init: Add IEEE 1275 Radix support for KVM on Power * c464f1ec3 fs/zfs/zfs: Mark vdev_zaps_v2 and head_errlog as supported * 2ffc14ba9 types: Add missing casts in compile-time byteswaps * c6ac49120 font: Add Fedora-specific font paths * 5e8989e4e fs/bfs: Fix improper grub_free() on non-existing files * c806e4dc8 io/gzio: Properly init a table * 243682baa io/gzio: Abort early when get_byte() reads nothing * bb65d81fe cli_lock: Add build option to block command line interface * 56e58828c fs/erofs: Add tests for EROFS in grub-fs-tester * 9d603061a fs/erofs: Add support for the EROFS * 1ba39de62 safemath: Add ALIGN_UP_OVF() which checks for an overflow * d291449ba docs: Fix spelling mistakes * 6cc2e4481 util/grub.d/00_header.in: Quote background image pathname in output * f456add5f disk/lvm: GRUB fails to detect LVM volumes due to an incorrect computation of mda_end * 386b59ddb disk/cryptodisk: Allow user to retry failed passphrase * 99b4c0c38 disk/mdraid1x_linux: Prevent infinite recursion * b272ed230 efi: Fix stack protector issues * 6744840b1 build: Track explicit module dependencies in Makefile.core.def Signed-off-by: Leah Rowe <leah@libreboot.org>
127 lines
4 KiB
Diff
127 lines
4 KiB
Diff
From 127961742cf7992f6989c6e89a18ab6d8f0b297f Mon Sep 17 00:00:00 2001
|
||
From: Patrick Rudolph <patrick.rudolph@9elements.com>
|
||
Date: Thu, 3 Dec 2020 13:44:55 +0100
|
||
Subject: [PATCH 20/22] 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.2
|
||
|