console: add EHCI debug port based serial console
RFC PATCH 3/8 console: add EHCI debug port based serial console
Low level hardware interface pieces adapted from Linux.
For setup information, see Linux'es Documentation/x86/earlyprintk.txt and/or http://www.coreboot.org/EHCI_Debug_Port.
docs/misc/xen-command-line.markdown +9 -1
@@ -244,7 +244,7 @@ A typical setup for most situations migh Specify the size of the console ring buffer. ### console -> `= List of [ vga | com1[H,L] | com2[H,L] | none ]` +> `= List of [ vga | com1[H,L] | com2[H,L] | dbgp | none ]` > Default: `console=com1,vga`
@@ -260,6 +260,8 @@ the converse; transmitted and received c cleared. This allows a single port to be shared by two subsystems (e.g. console and debugger). +`dbgp` indicates that Xen should use a USB debug port. + `none` indicates that Xen should not use a console. This option only makes sense on its own.
@@ -352,6 +354,12 @@ combination with the `low_crashinfo` com ### credit2\_load\_window\_shift > `= <integer>` +### dbgp +> `= ehci[ <integer> | @pci<bus>:<slot>.<func> ]` + +Specify the USB controller to use, either by instance number (when going +over the PCI busses sequentially) or by PCI device (must be on segment 0). + ### debug\_stack\_lines > `= <integer>`
xen/arch/x86/Rules.mk +1 -0
@@ -7,6 +7,7 @@ HAS_CPUFREQ := y HAS_PCI := y HAS_PASSTHROUGH := y HAS_NS16550 := y +HAS_EHCI := y HAS_KEXEC := y HAS_GDBSX := y xenoprof := y
xen/arch/x86/physdev.c +14 -0
@@ -8,6 +8,7 @@#include <xen/event.h> #include <xen/guest_access.h> #include <xen/iocap.h> +#include <xen/serial.h> #include <asm/current.h> #include <asm/io_apic.h> #include <asm/msi.h>
@@ -722,6 +723,19 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_Hbreak ; } + +case PHYSDEVOP_dbgp_op: { +struct physdev_dbgp_op op; + +if ( !IS_PRIV (v->domain) ) + ret = -EPERM ; +else if (copy_from_guest (&op, arg,1 ) ) + ret = -EFAULT ; +else + ret =dbgp_op (&op); +break ; + } +default : ret = -ENOSYS ;break ;
xen/arch/x86/setup.c +1 -0
@@ -606,6 +606,7 @@ void __init __start_xen(unsigned long mb ns16550.io_base =0x2f8 ; ns16550.irq =3 ;ns16550_init (1 , &ns16550); +ehci_dbgp_init ();console_init_preirq ();printk ("Bootloader: %s\n" , loader);
xen/drivers/char/Makefile +1 -0
@@ -1,4 +1,5 @@ obj-y += console.o obj-$(HAS_NS16550) += ns16550.o obj-$(HAS_PL011) += pl011.o +obj-$(HAS_EHCI) += ehci-dbgp.o obj-y += serial.o
xen/drivers/char/ehci-dbgp.c new file +1577 -0
1,577 lines not on this page · raw message
xen/drivers/char/serial.c +8 -0
@@ -265,6 +265,14 @@ int __init serial_parse_handle(char *con {int handle; +if ( !strncmp (conf,"dbgp" ,4 ) && (!conf[4 ] || conf[4 ] ==',' ) ) + { +if ( !com[SERHND_DBGP ].driver ) + goto fail; + +return SERHND_DBGP |SERHND_COOKED ; + } +if (strncmp (conf,"com" ,3 ) ) goto fail;
xen/include/asm-x86/fixmap.h +9 -1
@@ -36,7 +36,15 @@* from the end of virtual memory backwards. */ enum fixed_addresses { -FIX_RESERVED ,/* Index 0 is reserved since fix_to_virt(0) > FIXADDR_TOP. */ +/* Index 0 is reserved since fix_to_virt(0) == FIXADDR_TOP. */ +FIX_RESERVED , +/* +* Indexes using the page tables set up before entering __start_xen() +* must be among the first (L1_PAGETABLE_ENTRIES - 1) entries. +* These are generally those needed by the various console drivers. +*/ +FIX_EHCI_DBGP , +/* Everything else should go further down. */ #ifdef __i386__FIX_PAE_HIGHMEM_0 ,FIX_PAE_HIGHMEM_END =FIX_PAE_HIGHMEM_0 +NR_CPUS -1 ,
xen/include/public/physdev.h +18 -0
@@ -312,6 +312,24 @@ struct physdev_pci_device {typedef struct physdev_pci_device physdev_pci_device_t ;DEFINE_XEN_GUEST_HANDLE (physdev_pci_device_t); +#define PHYSDEVOP_DBGP_RESET_PREPARE 1 +#define PHYSDEVOP_DBGP_RESET_DONE 2 + +#define PHYSDEVOP_DBGP_BUS_UNKNOWN 0 +#define PHYSDEVOP_DBGP_BUS_PCI 1 + +#define PHYSDEVOP_dbgp_op 29 +struct physdev_dbgp_op { +/* IN */ +uint8_t op; +uint8_t bus; +union { +struct physdev_pci_device pci; + } u; +}; +typedef struct physdev_dbgp_op physdev_dbgp_op_t ; +DEFINE_XEN_GUEST_HANDLE (physdev_dbgp_op_t); +/* * Notify that some PIRQ-bound event channels have been unmasked. * ** This command is obsolete since interface version 0x00030202 and is **
xen/include/xen/serial.h +6 -1
@@ -69,9 +69,10 @@ struct uart_driver { };/* 'Serial handles' are composed from the following fields. */ -#define SERHND_IDX (3<<0)/* COM1 or COM2? */ +#define SERHND_IDX (3<<0)/* COM1, COM2, or DBGP? */ # define SERHND_COM1 (0<<0)# define SERHND_COM2 (1<<0) +# define SERHND_DBGP (2<<0)#define SERHND_HI (1<<2)/* Mux/demux each transferred char by MSB. */ #define SERHND_LO (1<<3)/* Ditto, except that the MSB is cleared. */ #define SERHND_COOKED (1<<4)/* Newline/carriage-return translation? */
@@ -142,9 +143,13 @@ struct ns16550_defaults {unsigned long io_base;/* default io_base address */ };void ns16550_init (int index,struct ns16550_defaults *defaults); +void ehci_dbgp_init (void );void pl011_init (int index,unsigned long register_base_address); +struct physdev_dbgp_op ; +int dbgp_op (const struct physdev_dbgp_op *); +/* Baud rate was pre-configured before invoking the UART driver. */ #define BAUD_AUTO (-1)
console: add EHCI debug port based serial console
Low level hardware interface pieces adapted from Linux.
For setup information, see Linux'es Documentation/x86/earlyprintk.txt and/or http://www.coreboot.org/EHCI_Debug_Port.
docs/misc/xen-command-line.markdown +9 -1
@@ -244,7 +244,7 @@ A typical setup for most situations migh Specify the size of the console ring buffer. ### console -> `= List of [ vga | com1[H,L] | com2[H,L] | none ]` +> `= List of [ vga | com1[H,L] | com2[H,L] | dbgp | none ]` > Default: `console=com1,vga`
@@ -260,6 +260,8 @@ the converse; transmitted and received c cleared. This allows a single port to be shared by two subsystems (e.g. console and debugger). +`dbgp` indicates that Xen should use a USB debug port. + `none` indicates that Xen should not use a console. This option only makes sense on its own.
@@ -352,6 +354,12 @@ combination with the `low_crashinfo` com ### credit2\_load\_window\_shift > `= <integer>` +### dbgp +> `= ehci[ <integer> | @pci<bus>:<slot>.<func> ]` + +Specify the USB controller to use, either by instance number (when going +over the PCI busses sequentially) or by PCI device (must be on segment 0). + ### debug\_stack\_lines > `= <integer>`
xen/arch/x86/Rules.mk +1 -0
@@ -7,6 +7,7 @@ HAS_CPUFREQ := y HAS_PCI := y HAS_PASSTHROUGH := y HAS_NS16550 := y +HAS_EHCI := y HAS_KEXEC := y HAS_GDBSX := y xenoprof := y
xen/arch/x86/physdev.c +14 -0
@@ -8,6 +8,7 @@#include <xen/event.h> #include <xen/guest_access.h> #include <xen/iocap.h> +#include <xen/serial.h> #include <asm/current.h> #include <asm/io_apic.h> #include <asm/msi.h>
@@ -722,6 +723,19 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_Hbreak ; } + +case PHYSDEVOP_dbgp_op: { +struct physdev_dbgp_op op; + +if ( !IS_PRIV (v->domain) ) + ret = -EPERM ; +else if (copy_from_guest (&op, arg,1 ) ) + ret = -EFAULT ; +else + ret =dbgp_op (&op); +break ; + } +default : ret = -ENOSYS ;break ;
xen/arch/x86/setup.c +1 -0
@@ -606,6 +606,7 @@ void __init __start_xen(unsigned long mb ns16550.io_base =0x2f8 ; ns16550.irq =3 ;ns16550_init (1 , &ns16550); +ehci_dbgp_init ();console_init_preirq ();printk ("Bootloader: %s\n" , loader);
xen/drivers/char/Makefile +1 -0
@@ -1,4 +1,5 @@ obj-y += console.o obj-$(HAS_NS16550) += ns16550.o obj-$(HAS_PL011) += pl011.o +obj-$(HAS_EHCI) += ehci-dbgp.o obj-y += serial.o
xen/drivers/char/ehci-dbgp.c new file +1577 -0
1,199 lines not on this page · raw message
xen/drivers/char/serial.c +8 -0
Lines of this file are not shown. View the raw message.
xen/include/asm-x86/fixmap.h +9 -1
Lines of this file are not shown. View the raw message.
xen/include/public/physdev.h +18 -0
Lines of this file are not shown. View the raw message.
xen/include/xen/serial.h +6 -1
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Part of the diff is not shown here. View the raw message.