Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1317526 > unrolled thread
| Started by | Lu Baolu <baolu.lu@linux.intel.com> |
|---|---|
| First post | 2016-01-26 05:20 +0100 |
| Last post | 2016-01-26 07:50 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH v6 09/12] x86: early_printk: add USB3 debug port earlyprintk support Lu Baolu <baolu.lu@linux.intel.com> - 2016-01-26 05:20 +0100
Re: [PATCH v6 09/12] x86: early_printk: add USB3 debug port earlyprintk support kbuild test robot <lkp@intel.com> - 2016-01-26 07:50 +0100
| From | Lu Baolu <baolu.lu@linux.intel.com> |
|---|---|
| Date | 2016-01-26 05:20 +0100 |
| Subject | [PATCH v6 09/12] x86: early_printk: add USB3 debug port earlyprintk support |
| Message-ID | <qV3gK-680-19@gated-at.bofh.it> |
Add support for early printk by writing debug messages to the USB3
debug port. Users can use this type of early printk by specifying
kernel parameter of "earlyprintk=xdbc". This gives users a chance
of providing debug output.
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
---
Documentation/kernel-parameters.txt | 1 +
arch/x86/kernel/early_printk.c | 5 +++++
drivers/usb/early/xhci-dbc.c | 43 +++++++++++++++++++++++++++++++++++++
include/linux/usb/xhci-dbc.h | 5 +++++
4 files changed, 54 insertions(+)
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 87d40a7..460dc73 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -1067,6 +1067,7 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
earlyprintk=ttySn[,baudrate]
earlyprintk=dbgp[debugController#]
earlyprintk=pciserial,bus:device.function[,baudrate]
+ earlyprintk=xdbc[xhciController#]
earlyprintk is useful when the kernel crashes before
the normal console is initialized. It is not enabled by
diff --git a/arch/x86/kernel/early_printk.c b/arch/x86/kernel/early_printk.c
index 21bf924..ba4c471 100644
--- a/arch/x86/kernel/early_printk.c
+++ b/arch/x86/kernel/early_printk.c
@@ -17,6 +17,7 @@
#include <asm/intel-mid.h>
#include <asm/pgtable.h>
#include <linux/usb/ehci_def.h>
+#include <linux/usb/xhci-dbc.h>
#include <linux/efi.h>
#include <asm/efi.h>
#include <asm/pci_x86.h>
@@ -373,6 +374,10 @@ static int __init setup_early_printk(char *buf)
if (!strncmp(buf, "dbgp", 4) && !early_dbgp_init(buf + 4))
early_console_register(&early_dbgp_console, keep);
#endif
+#ifdef CONFIG_EARLY_PRINTK_XDBC
+ if (!strncmp(buf, "xdbc", 4) && !early_xdbc_init(buf + 4))
+ early_console_register(&early_xdbc_console, keep);
+#endif
#ifdef CONFIG_HVC_XEN
if (!strncmp(buf, "xen", 3))
early_console_register(&xenboot_console, keep);
diff --git a/drivers/usb/early/xhci-dbc.c b/drivers/usb/early/xhci-dbc.c
index 344d93e..6c24ba0 100644
--- a/drivers/usb/early/xhci-dbc.c
+++ b/drivers/usb/early/xhci-dbc.c
@@ -10,6 +10,7 @@
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
+#include <linux/console.h>
#include <linux/pci_regs.h>
#include <linux/pci_ids.h>
#include <linux/bootmem.h>
@@ -1319,3 +1320,45 @@ int xdbc_bulk_write(const char *bytes, int size)
return ret;
}
+
+/*
+ * Start a bulk-in or bulk-out transfer, wait until transfer completion
+ * or error. Return the count of actually transferred bytes or error.
+ */
+static void early_xdbc_write(struct console *con, const char *str, u32 n)
+{
+ int chunk, ret;
+ static char buf[XDBC_MAX_PACKET];
+ int use_cr = 0;
+
+ if (!xdbcp->xdbc_reg)
+ return;
+ memset(buf, 0, XDBC_MAX_PACKET);
+ while (n > 0) {
+ for (chunk = 0; chunk < XDBC_MAX_PACKET && n > 0;
+ str++, chunk++, n--) {
+ if (!use_cr && *str == '\n') {
+ use_cr = 1;
+ buf[chunk] = '\r';
+ str--;
+ n++;
+ continue;
+ }
+ if (use_cr)
+ use_cr = 0;
+ buf[chunk] = *str;
+ }
+ if (chunk > 0) {
+ ret = xdbc_bulk_write(buf, chunk);
+ if (ret < 0)
+ break;
+ }
+ }
+}
+
+struct console early_xdbc_console = {
+ .name = "earlyxdbc",
+ .write = early_xdbc_write,
+ .flags = CON_PRINTBUFFER,
+ .index = -1,
+};
diff --git a/include/linux/usb/xhci-dbc.h b/include/linux/usb/xhci-dbc.h
index 289ba58..a556eb8 100644
--- a/include/linux/usb/xhci-dbc.h
+++ b/include/linux/usb/xhci-dbc.h
@@ -216,4 +216,9 @@ struct xdbc_state {
#define xdbc_read64(regs) xhci_read_64(NULL, (regs))
#define xdbc_write64(val, regs) xhci_write_64(NULL, (val), (regs))
+#ifdef CONFIG_EARLY_PRINTK_XDBC
+extern int early_xdbc_init(char *s);
+extern struct console early_xdbc_console;
+#endif /* CONFIG_EARLY_PRINTK_XDBC */
+
#endif /* __LINUX_XHCI_DBC_H */
--
2.1.4
[toc] | [next] | [standalone]
| From | kbuild test robot <lkp@intel.com> |
|---|---|
| Date | 2016-01-26 07:50 +0100 |
| Subject | Re: [PATCH v6 09/12] x86: early_printk: add USB3 debug port earlyprintk support |
| Message-ID | <qV5BT-8fo-13@gated-at.bofh.it> |
| In reply to | #1317526 |
[Multipart message — attachments visible in raw view] — view raw
Hi Lu,
[auto build test ERROR on usb/usb-testing]
[also build test ERROR on v4.5-rc1 next-20160125]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]
url: https://github.com/0day-ci/linux/commits/Lu-Baolu/usb-early-add-support-for-early-printk-through-USB3-debug-port/20160126-122049
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: x86_64-randconfig-h0-01261334 (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All errors (new ones prefixed by >>):
arch/x86/built-in.o: In function `setup_early_printk':
>> early_printk.c:(.init.text+0xceba): undefined reference to `early_xdbc_init'
>> early_printk.c:(.init.text+0xcec8): undefined reference to `early_xdbc_console'
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web