[PATCH v2 6/7] grub-core/bus/usb: Add xhci support

2020-12-06 Thread Patrick Rudolph
Add support for xHCI USB controllers. The code is based on seabios implementation, but has been heavily modified to match grubs internals. Changes done in version 2: * Code cleanup * Code style fixes * Don't leak memory buffers * Compile without warnings * Add more defines * Add more helper functi

[PATCH v2 7/7] grub-core/bus/usb/usbhub: Add xHCI non root hub support

2020-12-06 Thread Patrick Rudolph
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 --- grub-core/bus/usb/usbhub.c | 40 -- include/grub/usbdesc.h | 1 + include/gr

[PATCH v2 3/7] usbtrans: Set default maximum packet size

2020-12-06 Thread Patrick Rudolph
Set the maximum packet size to 512 for SuperSpeed devices. Signed-off-by: Patrick Rudolph --- grub-core/bus/usb/usbtrans.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/grub-core/bus/usb/usbtrans.c b/grub-core/bus/usb/usbtrans.c index 85f081fff..72eb9b598 100644 --- a/

[PATCH v2 4/7] grub-core/bus/usb: Add function pointer for attach/detach events

2020-12-06 Thread Patrick Rudolph
The xHCI code needs to be called for attaching or detaching a device. Introduce two functions pointers and call it from the USB hub code. Will be used in future commits, currently this doesn't change any functionality. Signed-off-by: Patrick Rudolph --- grub-core/bus/usb/ehci.c | 2 ++ grub-

[PATCH v2 5/7] grub-core/bus/usb/usbhub: Add new private fields for xHCI controller

2020-12-06 Thread Patrick Rudolph
Store the root port number, the route, consisting out of the port ID in each nibble, and a pointer to driver private data. Signed-off-by: Patrick Rudolph --- grub-core/bus/usb/usbhub.c | 14 ++ include/grub/usb.h | 5 + 2 files changed, 15 insertions(+), 4 deletions(-)

[PATCH v2 2/7] usb: Add enum for xHCI

2020-12-06 Thread Patrick Rudolph
Will be used in future patches. Signed-off-by: Patrick Rudolph --- include/grub/usb.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/grub/usb.h b/include/grub/usb.h index 0527a3e2b..f65ac4f5d 100644 --- a/include/grub/usb.h +++ b/include/grub/usb.h @@ -47,7 +47,8 @

[PATCH v2 1/7] grub-core/bus/usb: Parse SuperSpeed companion descriptors

2020-12-06 Thread Patrick Rudolph
Parse the SS_ENDPOINT_COMPANION descriptor, which is only present on USB 3.0 capable devices and xHCI controllers. Make the descendp an array of pointers to the endpoint descriptor as it's no longer an continous array. Signed-off-by: Patrick Rudolph --- grub-core/bus/usb/serial/common.c | 2 +-

[PATCH v2 0/7] Add xHCI USB support

2020-12-06 Thread Patrick Rudolph
Add basic support for xHCI USB controllers and non root xHCI hubs. The motivation is to use this code on platforms that do not provide user input by runtime services (like BIOS or UEFI platform) do. This is the case when GRUB is used as coreboot payload for example. The code is based on seabios im

[ANNOUNCEMENT] FOSDEM 2021 Open Source Firmware, BMC and Bootloader Devroom Call for Participation

2020-12-06 Thread Daniel Kiper
Hi, The Open Source Firmware, BMC and Bootloader devroom will take place on Sunday, 7th February 2021 at FOSDEM, virtual. Call for Participation -- We are opening the call for participation to our devroom, with the deadline for talk proposals set to Sunday, 20th December 2020

Re: [PATCH v7 17/17] luks2: Use grub_log2ull to calculate log_sector_size and improve readability

2020-12-06 Thread Patrick Steinhardt
On Fri, Dec 04, 2020 at 10:43:46AM -0600, Glenn Washburn wrote: > Reviewed-by: Daniel Kiper > Signed-off-by: Glenn Washburn > --- > grub-core/disk/luks2.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/grub-core/disk/luks2.c b/grub-core/disk/luks2.c > index 2335ded77

Re: [PATCH v7 15/17] mips: Enable __clzdi2()

2020-12-06 Thread Patrick Steinhardt
On Fri, Dec 04, 2020 at 10:43:44AM -0600, Glenn Washburn wrote: > This patch is similiar to commit 9dab2f51e (sparc: Enable __clzsi2() and > __clzdi2()) but for MIPS target and __clzdi2 only, __clzsi2 was already > enabled. > > Suggested-by: Daniel Kiper > Signed-off-by: Glenn Washburn I'm not

Re: [PATCH v7 13/17] luks2: Error check segment.sector_size

2020-12-06 Thread Patrick Steinhardt
On Fri, Dec 04, 2020 at 10:43:42AM -0600, Glenn Washburn wrote: > Reviewed-by: Daniel Kiper > Signed-off-by: Glenn Washburn Reviewed-by: Patrick Steinhardt > --- > grub-core/disk/luks2.c | 11 +++ > 1 file changed, 11 insertions(+) > > diff --git a/grub-core/disk/luks2.c b/grub-core/

Re: [PATCH v7 12/17] luks2: Better error handling when setting up the cryptodisk

2020-12-06 Thread Patrick Steinhardt
On Fri, Dec 04, 2020 at 10:43:41AM -0600, Glenn Washburn wrote: > First, check to make sure that source disk has a known size. If not, print > debug message and return error. There are 4 cases where > GRUB_DISK_SIZE_UNKNOWN is set (biosdisk, obdisk, ofdisk, and uboot), and in > all those cases proc

Re: [PATCH v7 11/17] cryptodisk: Properly handle non-512 byte sized sectors

2020-12-06 Thread Patrick Steinhardt
On Fri, Dec 04, 2020 at 10:43:40AM -0600, Glenn Washburn wrote: > By default, dm-crypt internally uses an IV that corresponds to 512-byte > sectors, even when a larger sector size is specified. What this means is > that when using a larger sector size, the IV is incremented every sector. > However,

Re: [PATCH v7 00/17] Cryptodisk fixes for v2.06 redux

2020-12-06 Thread Patrick Steinhardt
On Fri, Dec 04, 2020 at 10:43:29AM -0600, Glenn Washburn wrote: > This patch series is an update to reflect changes suggested in v6. Of note, > there are a few new patches: 01, 02, and 04. > > 01: Daniel suggested to renae grub_disk_get_size to grub_disk_native_sectors > 02: Make ALIGN_UP and

Re: [PATCH v7 16/17] misc: Add grub_log2ull macro for calculating log base 2 of 64-bit integers

2020-12-06 Thread Patrick Steinhardt
On Fri, Dec 04, 2020 at 10:43:45AM -0600, Glenn Washburn wrote: > Reviewed-by: Daniel Kiper > Signed-off-by: Glenn Washburn Reviewed-by: Patrick Steinhardt > --- > include/grub/misc.h | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/include/grub/misc.h b/include/grub/misc.h > inde

Re: [PATCH v7 14/17] whitespace: convert 8 spaces to tabs

2020-12-06 Thread Patrick Steinhardt
On Fri, Dec 04, 2020 at 10:43:43AM -0600, Glenn Washburn wrote: > Reviewed-by: Daniel Kiper > Signed-off-by: Glenn Washburn Reviewed-by: Patrick Steinhardt > --- > grub-core/disk/luks2.c | 8 > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/grub-core/disk/luks2.c b

Re: [PATCH v7 07/17] luks2: Add string "index" to user strings using a json index.

2020-12-06 Thread Patrick Steinhardt
On Fri, Dec 04, 2020 at 10:43:36AM -0600, Glenn Washburn wrote: > This allows error messages to be more easily distinguishable between indexes > and slot keys. The former include the string "index" in the error/debug > string, and the later are surrounded in quotes. > > Signed-off-by: Glenn Washbu

Re: [PATCH v7 10/17] luks2: grub_cryptodisk_t->total_sectors is the max number of device native sectors

2020-12-06 Thread Patrick Steinhardt
On Fri, Dec 04, 2020 at 10:43:39AM -0600, Glenn Washburn wrote: > We need to convert the sectors from the size of the underlying device to the > cryptodisk sector size; segment.size is in bytes which need to be converted > to cryptodisk sectors as well. > > Also, removed an empty statement. > > R

Re: [PATCH v7 09/17] cryptodisk: Add macros GRUB_TYPE_U_MAX/MIN(type) to replace literals

2020-12-06 Thread Patrick Steinhardt
On Fri, Dec 04, 2020 at 10:43:38AM -0600, Glenn Washburn wrote: > Add GRUB_TYPE_U_MAX/MIN(type) macros to get the max/min values for an > unsigned number with size of type. > > Signed-off-by: Glenn Washburn > --- > grub-core/disk/cryptodisk.c | 8 > include/grub/types.h| 7 +

Re: [PATCH v7 06/17] luks2: Use more intuitive slot key instead of index in user messages

2020-12-06 Thread Patrick Steinhardt
On Fri, Dec 04, 2020 at 10:43:35AM -0600, Glenn Washburn wrote: > Use the slot key name in the json array rather than the 0 based index in the > json array for keyslots, segments, and digests. This is less confusing for > the end user. For example, say you have a LUKS2 device with a key in slot 1 >

Re: [PATCH v7 08/17] cryptodisk: Add macro GRUB_TYPE_BITS() to replace some literals

2020-12-06 Thread Patrick Steinhardt
On Fri, Dec 04, 2020 at 10:43:37AM -0600, Glenn Washburn wrote: > The new macro GRUB_TYPE_BITS(type) returns the number of bits allocated for > type. > > Signed-off-by: Glenn Washburn Reviewed-by: Patrick Steinhardt > --- > grub-core/disk/cryptodisk.c | 7 --- > include/grub/types.h

Re: [PATCH v7 05/17] luks2: Add json_slot_key member to struct grub_luks2_keyslot/segment/digest

2020-12-06 Thread Patrick Steinhardt
On Fri, Dec 04, 2020 at 10:43:34AM -0600, Glenn Washburn wrote: > This allows code using these structs to know the named key associated with > these json data structures. In the future we can use these to provide better > error messages to the user. > > Get rid of idx variable in luks2_get_keyslot

Re: [PATCH v7 04/17] luks2: Make sure all fields of output argument in luks2_parse_digest() are written to

2020-12-06 Thread Patrick Steinhardt
On Fri, Dec 04, 2020 at 10:43:33AM -0600, Glenn Washburn wrote: > We should assume that the output argument "out" is uninitialized and could > have random data. So, make sure to initialize the segments and keyslots bit > fields because potentially not all bits of those fields are written to. > Othe

Re: [PATCH v7 03/17] luks2: Remove unused argument in grub_error

2020-12-06 Thread Patrick Steinhardt
On Fri, Dec 04, 2020 at 10:43:32AM -0600, Glenn Washburn wrote: > Reviewed-by: Daniel Kiper > Signed-off-by: Glenn Washburn Reviewed-by: Patrick Steinhardt > --- > grub-core/disk/luks2.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/grub-core/disk/luks2.c b/g

Re: [PATCH v7 02/17] misc: Add parentheses around ALIGN_UP and ALIGN_DOWN arguments

2020-12-06 Thread Patrick Steinhardt
On Fri, Dec 04, 2020 at 10:43:31AM -0600, Glenn Washburn wrote: > This ensures that expected order of operations is preserved when arguments > are expressions. > > Signed-off-by: Glenn Washburn Reviewed-by: Patrick Steinhardt > --- > include/grub/misc.h | 4 ++-- > 1 file changed, 2 insertion

Re: [PATCH v7 01/17] disk: Rename grub_disk_get_size to grub_disk_native_sectors

2020-12-06 Thread Patrick Steinhardt
On Fri, Dec 04, 2020 at 10:43:30AM -0600, Glenn Washburn wrote: > The function grub_disk_get_size is confusingly named because it actually > returns a sector count where the sectors are sized in the grub native sector > size. Rename to something more appropriate. > > Suggested-by: Daniel Kiper >

Interrupt boot and display menu with `GRUB_TIMEOUT=0`?

2020-12-06 Thread Paul Menzel
Dear GRUB folks, Setting the GRUB timeout to 0 `GRUB_TIMEOUT=0` is it possible to interrupt the boot somehow for example by holding a key done? There are some posts on the WWW claiming it was once possible using the shift key [1], but it didn’t work in my tests with Debian bullseye/test