From 445d621dd0fda149e2d3045e01062ebbec494b57 Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Wed, 12 Nov 2014 22:39:47 +0100 Subject: [PATCH] boot/loader: Autoload XHCI support (xhci.ko). This should help with issues people were having when trying to boot a DragonFly USB IMG from a thumb drive plugged into a USB 3 port. --- nrelease/root/README.USB | 19 +++++++++++------ sys/boot/common/help.common | 25 +++++++++++++++++++++- sys/boot/common/loader.8 | 11 +++++++++- sys/boot/dloader/cmds.c | 1 + sys/boot/dloader/dloader.menu | 33 ++++++++++++++++++++--------- sys/boot/pc32/libi386/i386_module.c | 12 +++++++++++ sys/boot/pc32/loader/main.c | 3 +++ 7 files changed, 86 insertions(+), 18 deletions(-) diff --git a/nrelease/root/README.USB b/nrelease/root/README.USB index 6ecddcd3ea..2903f7b77d 100644 --- a/nrelease/root/README.USB +++ b/nrelease/root/README.USB @@ -2,14 +2,21 @@ DRAGONFLY 'Live CD' README.USB When booting from 'Live CD', the USB subsystem is activated by the - default boot. This includes the primary USB, OHCI and EHCI drivers. - On some systems it might be needed to not start EHCI driver (for USB 2.0) - to be able to run DragonFly, this is done by: + default boot. This includes the primary USB, OHCI, EHCI and XHCI + drivers. On some systems it might be needed to not start the EHCI + driver (for USB 2.0) or XHCI driver (for USB 3.0) to be able to run + DragonFly. This is done by: + + For EHCI + ======== - 'unset ehci_load' in loader prompt, or - choosing 'safe mode' in boot prompt, or - - 'set hint.ehci.0.disabled=0' in /boot/loader.conf - To enable USBD after installing on a hard disk, simply set - usbd_enable="YES" in /etc/rc.conf. + For XHCI + ======== + + - 'unset xhci_load' in loader prompt, or + - choosing 'safe mode' in boot prompt, or + - 'set hint.xhci.0.disabled=0' in /boot/loader.conf diff --git a/sys/boot/common/help.common b/sys/boot/common/help.common index 935371a3ea..62088ae8cc 100644 --- a/sys/boot/common/help.common +++ b/sys/boot/common/help.common @@ -38,7 +38,12 @@ lunset ehci_load set hint.ehci.0.disabled=1 - For more information on ACPI, AHCI and EHCI use `help' on these topics. + If needed, disable the XHCI driver with: + + lunset xhci_load + set hint.xhci.0.disabled=1 + + For more information on ACPI, AHCI, EHCI and XHCI use `help' on these topics. ################################################################################ # T= DAssign value to variable @@ -164,6 +169,24 @@ See ehci.4 man page (on booted system) for full description. +################################################################################ +# TXHCI DControl XHCI module behaviour + + $xhci_load + + The XHCI driver provides support for the USB Enhanched Host Controller + Interface, which is used by USB 2.0 controllers. + + The XHCI kernel module is by default loaded automatically. + + If the xhci_load variable is set, the XHCI module will be loaded. + The XHCI driver can be disabled with: + + lunset xhci_load + set hint.xhci.0.disabled=1 + + See xhci.4 man page (on booted system) for full description. + ################################################################################ # Tload DLoad a kernel or module diff --git a/sys/boot/common/loader.8 b/sys/boot/common/loader.8 index 83d545c40e..524ca87ded 100644 --- a/sys/boot/common/loader.8 +++ b/sys/boot/common/loader.8 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD: src/sys/boot/common/loader.8,v 1.57 2003/06/29 20:57:55 brueffer Exp $ .\" -.Dd October 21, 2012 +.Dd November 12, 2014 .Dt LOADER 8 .Os .Sh NAME @@ -524,6 +524,14 @@ To disable automatic loading of the EHCI module use: .Pp .Dl lunset ehci_load .Dl set hint.ehci.0.disabled=1 +.It Va xhci_load +Used for handling automatic loading of the +.Xr xhci 4 +module. +To disable automatic loading of the XHCI module use: +.Pp +.Dl lunset xhci_load +.Dl set hint.xhci.0.disabled=1 .It Va init_chroot Directory .Xr init 8 @@ -843,6 +851,7 @@ boot kernel .Xr libstand 3 , .Xr acpi 4 , .Xr ehci 4 , +.Xr xhci 4 , .Xr loader.conf 5 , .Xr tuning 7 , .Xr boot 8 , diff --git a/sys/boot/dloader/cmds.c b/sys/boot/dloader/cmds.c index 687dd60f9c..8f8ea5ac4d 100644 --- a/sys/boot/dloader/cmds.c +++ b/sys/boot/dloader/cmds.c @@ -94,6 +94,7 @@ static char *kenv_vars[] = { "prompt", "rootdev", "root_disk_unit", + "xhci_load", NULL }; diff --git a/sys/boot/dloader/dloader.menu b/sys/boot/dloader/dloader.menu index 9c2365e791..9c768fb5cb 100644 --- a/sys/boot/dloader/dloader.menu +++ b/sys/boot/dloader/dloader.menu @@ -27,6 +27,7 @@ set module_path=";modules" acpi_load="YES" ahci_load="YES" ehci_load="YES" +xhci_load="YES" ifset default_kernel # already selected a kernel @@ -41,8 +42,9 @@ menuadd cd ${base}${default_kernel} menuadd optinclude loader.conf menuadd optinclude loader.conf.local menuadd lunsetif acpi_load hint.acpi.0.disabled -menuadd lunsetif ehci_load hint.ehci.0.disabled menuadd lunsetif ahci_load hint.ahci.disabled +menuadd lunsetif ehci_load hint.ehci.0.disabled +menuadd lunsetif xhci_load hint.xhci.0.disabled menuadd loadall menuadd boot @@ -53,14 +55,17 @@ menuadd optinclude loader.conf.local menuadd set hint.acpi.0.disabled=1 menuadd set loader.acpi_disabled_by_user=1 menuadd set hint.ehci.0.disabled=1 +menuadd set hint.xhci.0.disabled=1 menuadd set loader.ehci_disabled_by_user=1 +menuadd set loader.xhci_disabled_by_user=1 menuadd set hw.ata.ata_dma=0 menuadd set hw.ata.atapi_dma=0 menuadd set hw.ata.wc=0 menuadd set hw.eisa_slots=0 menuadd lunsetif acpi_load hint.acpi.0.disabled -menuadd lunsetif ehci_load hint.ehci.0.disabled menuadd lunsetif ahci_load hint.ahci.disabled +menuadd lunsetif ehci_load hint.ehci.0.disabled +menuadd lunsetif xhci_load hint.xhci.0.disabled menuadd loadall menuadd boot menuadd set autoboot_delay=NO @@ -71,8 +76,9 @@ menuadd optinclude loader.conf menuadd optinclude loader.conf.local menuadd set hint.ahci.disabled=YES menuadd lunsetif acpi_load hint.acpi.0.disabled -menuadd lunsetif ehci_load hint.ehci.0.disabled menuadd lunsetif ahci_load hint.ahci.disabled +menuadd lunsetif ehci_load hint.ehci.0.disabled +menuadd lunsetif xhci_load hint.xhci.0.disabled menuadd loadall menuadd boot menuadd set autoboot_delay=NO @@ -84,8 +90,9 @@ menuadd optinclude loader.conf.local menuadd set hint.acpi.0.disabled=1 menuadd set loader.acpi_disabled_by_user=1 menuadd lunsetif acpi_load hint.acpi.0.disabled -menuadd lunsetif ehci_load hint.ehci.0.disabled menuadd lunsetif ahci_load hint.ahci.disabled +menuadd lunsetif ehci_load hint.ehci.0.disabled +menuadd lunsetif xhci_load hint.xhci.0.disabled menuadd loadall menuadd boot menuadd set autoboot_delay=NO @@ -100,8 +107,9 @@ menuadd cd ${base}kernel.alt menuadd optinclude loader.conf menuadd optinclude loader.conf.local menuadd lunsetif acpi_load hint.acpi.0.disabled -menuadd lunsetif ehci_load hint.ehci.0.disabled menuadd lunsetif ahci_load hint.ahci.disabled +menuadd lunsetif ehci_load hint.ehci.0.disabled +menuadd lunsetif xhci_load hint.xhci.0.disabled menuadd loadall menuadd boot menuadd set autoboot_delay=NO @@ -113,8 +121,9 @@ menuadd cd ${base}kernel.bak menuadd optinclude loader.conf menuadd optinclude loader.conf.local menuadd lunsetif acpi_load hint.acpi.0.disabled -menuadd lunsetif ehci_load hint.ehci.0.disabled menuadd lunsetif ahci_load hint.ahci.disabled +menuadd lunsetif ehci_load hint.ehci.0.disabled +menuadd lunsetif xhci_load hint.xhci.0.disabled menuadd loadall menuadd boot menuadd set autoboot_delay=NO @@ -126,8 +135,9 @@ menuadd cd ${base}kernel.old menuadd optinclude loader.conf menuadd optinclude loader.conf.local menuadd lunsetif acpi_load hint.acpi.0.disabled -menuadd lunsetif ehci_load hint.ehci.0.disabled menuadd lunsetif ahci_load hint.ahci.disabled +menuadd lunsetif ehci_load hint.ehci.0.disabled +menuadd lunsetif xhci_load hint.xhci.0.disabled menuadd loadall menuadd boot menuadd set autoboot_delay=NO @@ -139,8 +149,9 @@ menuadd optinclude loader.conf menuadd optinclude loader.conf.local menuadd set boot_single="YES" menuadd lunsetif acpi_load hint.acpi.0.disabled -menuadd lunsetif ehci_load hint.ehci.0.disabled menuadd lunsetif ahci_load hint.ahci.disabled +menuadd lunsetif ehci_load hint.ehci.0.disabled +menuadd lunsetif xhci_load hint.xhci.0.disabled menuadd initrd.img_load="YES" menuadd initrd.img_type="md_image" menuadd set vfs.root.mountfrom="ufs:md0s0" @@ -155,8 +166,9 @@ menuadd optinclude loader.conf menuadd optinclude loader.conf.local menuadd set boot_single="YES" menuadd lunsetif acpi_load hint.acpi.0.disabled -menuadd lunsetif ehci_load hint.ehci.0.disabled menuadd lunsetif ahci_load hint.ahci.disabled +menuadd lunsetif ehci_load hint.ehci.0.disabled +menuadd lunsetif xhci_load hint.xhci.0.disabled menuadd loadall menuadd boot menuadd set autoboot_delay=NO @@ -167,8 +179,9 @@ menuadd optinclude loader.conf menuadd optinclude loader.conf.local menuadd set boot_verbose=YES menuadd lunsetif acpi_load hint.acpi.0.disabled -menuadd lunsetif ehci_load hint.ehci.0.disabled menuadd lunsetif ahci_load hint.ahci.disabled +menuadd lunsetif ehci_load hint.ehci.0.disabled +menuadd lunsetif xhci_load hint.xhci.0.disabled menuadd loadall menuadd boot menuadd set autoboot_delay=NO diff --git a/sys/boot/pc32/libi386/i386_module.c b/sys/boot/pc32/libi386/i386_module.c index f2676eff1c..6b31dd5063 100644 --- a/sys/boot/pc32/libi386/i386_module.c +++ b/sys/boot/pc32/libi386/i386_module.c @@ -75,5 +75,17 @@ i386_autoload(void) printf("EHCI autoload failed - %s\n", strerror(error)); } + disabled = 0; + rv = getenv("hint.xhci.0.disabled"); + if (rv != NULL && strncmp(rv, "0", 1) != 0) { + disabled = 1; + } + + if (getenv("xhci_load") && (!disabled)) { + error = mod_load("xhci", NULL, 0, NULL); + if (error != 0) + printf("XHCI autoload failed - %s\n", strerror(error)); + } + return(0); } diff --git a/sys/boot/pc32/loader/main.c b/sys/boot/pc32/loader/main.c index 41cccbcf8c..9e6c64982d 100644 --- a/sys/boot/pc32/loader/main.c +++ b/sys/boot/pc32/loader/main.c @@ -245,6 +245,9 @@ main(void) /* enable EHCI */ setenv("ehci_load", "YES", 1); + /* enable XHCI */ + setenv("xhci_load", "YES", 1); + printf("\n"); printf("%s, Revision %s\n", bootprog_name, bootprog_rev); printf("(%s, %s)\n", bootprog_maker, bootprog_date); -- 2.41.0