1b2441318SGreg Kroah-Hartman // SPDX-License-Identifier: GPL-2.0
2250c2277SThomas Gleixner #include <linux/console.h>
3250c2277SThomas Gleixner #include <linux/kernel.h>
4250c2277SThomas Gleixner #include <linux/init.h>
5250c2277SThomas Gleixner #include <linux/string.h>
6250c2277SThomas Gleixner #include <linux/screen_info.h>
75c05917eSYinghai Lu #include <linux/usb/ch9.h>
85c05917eSYinghai Lu #include <linux/pci_regs.h>
95c05917eSYinghai Lu #include <linux/pci_ids.h>
105c05917eSYinghai Lu #include <linux/errno.h>
1165fddcfcSMike Rapoport #include <linux/pgtable.h>
12250c2277SThomas Gleixner #include <asm/io.h>
13250c2277SThomas Gleixner #include <asm/processor.h>
14250c2277SThomas Gleixner #include <asm/fcntl.h>
1530c82645SH. Peter Anvin #include <asm/setup.h>
16250c2277SThomas Gleixner #include <xen/hvc-console.h>
175c05917eSYinghai Lu #include <asm/pci-direct.h>
185c05917eSYinghai Lu #include <asm/fixmap.h>
195c05917eSYinghai Lu #include <linux/usb/ehci_def.h>
201b5aeebfSLu Baolu #include <linux/usb/xhci-dbgp.h>
21ea9e9d80SStuart R. Anderson #include <asm/pci_x86.h>
229a163ed8SThomas Gleixner
23250c2277SThomas Gleixner /* Simple VGA output */
24250c2277SThomas Gleixner #define VGABASE (__ISA_IO_base + 0xb8000)
25250c2277SThomas Gleixner
26250c2277SThomas Gleixner static int max_ypos = 25, max_xpos = 80;
27c9cf39aeSPaolo Ciarrocchi static int current_ypos = 25, current_xpos;
28250c2277SThomas Gleixner
early_vga_write(struct console * con,const char * str,unsigned n)29250c2277SThomas Gleixner static void early_vga_write(struct console *con, const char *str, unsigned n)
30250c2277SThomas Gleixner {
31250c2277SThomas Gleixner char c;
32250c2277SThomas Gleixner int i, k, j;
33250c2277SThomas Gleixner
34250c2277SThomas Gleixner while ((c = *str++) != '\0' && n-- > 0) {
35250c2277SThomas Gleixner if (current_ypos >= max_ypos) {
36250c2277SThomas Gleixner /* scroll 1 line up */
37250c2277SThomas Gleixner for (k = 1, j = 0; k < max_ypos; k++, j++) {
38250c2277SThomas Gleixner for (i = 0; i < max_xpos; i++) {
39250c2277SThomas Gleixner writew(readw(VGABASE+2*(max_xpos*k+i)),
40250c2277SThomas Gleixner VGABASE + 2*(max_xpos*j + i));
41250c2277SThomas Gleixner }
42250c2277SThomas Gleixner }
43250c2277SThomas Gleixner for (i = 0; i < max_xpos; i++)
44250c2277SThomas Gleixner writew(0x720, VGABASE + 2*(max_xpos*j + i));
45250c2277SThomas Gleixner current_ypos = max_ypos-1;
46250c2277SThomas Gleixner }
4761eaf539SJason Wessel #ifdef CONFIG_KGDB_KDB
4861eaf539SJason Wessel if (c == '\b') {
4961eaf539SJason Wessel if (current_xpos > 0)
5061eaf539SJason Wessel current_xpos--;
5161eaf539SJason Wessel } else if (c == '\r') {
5261eaf539SJason Wessel current_xpos = 0;
5361eaf539SJason Wessel } else
5461eaf539SJason Wessel #endif
55250c2277SThomas Gleixner if (c == '\n') {
56250c2277SThomas Gleixner current_xpos = 0;
57250c2277SThomas Gleixner current_ypos++;
58250c2277SThomas Gleixner } else if (c != '\r') {
59250c2277SThomas Gleixner writew(((0x7 << 8) | (unsigned short) c),
60250c2277SThomas Gleixner VGABASE + 2*(max_xpos*current_ypos +
61250c2277SThomas Gleixner current_xpos++));
62250c2277SThomas Gleixner if (current_xpos >= max_xpos) {
63250c2277SThomas Gleixner current_xpos = 0;
64250c2277SThomas Gleixner current_ypos++;
65250c2277SThomas Gleixner }
66250c2277SThomas Gleixner }
67250c2277SThomas Gleixner }
68250c2277SThomas Gleixner }
69250c2277SThomas Gleixner
70250c2277SThomas Gleixner static struct console early_vga_console = {
71250c2277SThomas Gleixner .name = "earlyvga",
72250c2277SThomas Gleixner .write = early_vga_write,
73250c2277SThomas Gleixner .flags = CON_PRINTBUFFER,
74250c2277SThomas Gleixner .index = -1,
75250c2277SThomas Gleixner };
76250c2277SThomas Gleixner
77250c2277SThomas Gleixner /* Serial functions loosely based on a similar package from Klaus P. Gerlicher */
78250c2277SThomas Gleixner
79ea9e9d80SStuart R. Anderson static unsigned long early_serial_base = 0x3f8; /* ttyS0 */
80250c2277SThomas Gleixner
81250c2277SThomas Gleixner #define XMTRDY 0x20
82250c2277SThomas Gleixner
83250c2277SThomas Gleixner #define DLAB 0x80
84250c2277SThomas Gleixner
85250c2277SThomas Gleixner #define TXR 0 /* Transmit register (WRITE) */
86250c2277SThomas Gleixner #define RXR 0 /* Receive register (READ) */
87250c2277SThomas Gleixner #define IER 1 /* Interrupt Enable */
88250c2277SThomas Gleixner #define IIR 2 /* Interrupt ID */
89250c2277SThomas Gleixner #define FCR 2 /* FIFO control */
90250c2277SThomas Gleixner #define LCR 3 /* Line control */
91250c2277SThomas Gleixner #define MCR 4 /* Modem control */
92250c2277SThomas Gleixner #define LSR 5 /* Line Status */
93250c2277SThomas Gleixner #define MSR 6 /* Modem Status */
94250c2277SThomas Gleixner #define DLL 0 /* Divisor Latch Low */
95250c2277SThomas Gleixner #define DLH 1 /* Divisor latch High */
96250c2277SThomas Gleixner
io_serial_in(unsigned long addr,int offset)97ea9e9d80SStuart R. Anderson static unsigned int io_serial_in(unsigned long addr, int offset)
98ea9e9d80SStuart R. Anderson {
99ea9e9d80SStuart R. Anderson return inb(addr + offset);
100ea9e9d80SStuart R. Anderson }
101ea9e9d80SStuart R. Anderson
io_serial_out(unsigned long addr,int offset,int value)102ea9e9d80SStuart R. Anderson static void io_serial_out(unsigned long addr, int offset, int value)
103ea9e9d80SStuart R. Anderson {
104ea9e9d80SStuart R. Anderson outb(value, addr + offset);
105ea9e9d80SStuart R. Anderson }
106ea9e9d80SStuart R. Anderson
107ea9e9d80SStuart R. Anderson static unsigned int (*serial_in)(unsigned long addr, int offset) = io_serial_in;
108ea9e9d80SStuart R. Anderson static void (*serial_out)(unsigned long addr, int offset, int value) = io_serial_out;
109ea9e9d80SStuart R. Anderson
early_serial_putc(unsigned char ch)110250c2277SThomas Gleixner static int early_serial_putc(unsigned char ch)
111250c2277SThomas Gleixner {
112250c2277SThomas Gleixner unsigned timeout = 0xffff;
1135c05917eSYinghai Lu
114ea9e9d80SStuart R. Anderson while ((serial_in(early_serial_base, LSR) & XMTRDY) == 0 && --timeout)
115250c2277SThomas Gleixner cpu_relax();
116ea9e9d80SStuart R. Anderson serial_out(early_serial_base, TXR, ch);
117250c2277SThomas Gleixner return timeout ? 0 : -1;
118250c2277SThomas Gleixner }
119250c2277SThomas Gleixner
early_serial_write(struct console * con,const char * s,unsigned n)120250c2277SThomas Gleixner static void early_serial_write(struct console *con, const char *s, unsigned n)
121250c2277SThomas Gleixner {
122250c2277SThomas Gleixner while (*s && n-- > 0) {
123250c2277SThomas Gleixner if (*s == '\n')
124250c2277SThomas Gleixner early_serial_putc('\r');
125250c2277SThomas Gleixner early_serial_putc(*s);
126250c2277SThomas Gleixner s++;
127250c2277SThomas Gleixner }
128250c2277SThomas Gleixner }
129250c2277SThomas Gleixner
early_serial_hw_init(unsigned divisor)130ea9e9d80SStuart R. Anderson static __init void early_serial_hw_init(unsigned divisor)
131ea9e9d80SStuart R. Anderson {
132ea9e9d80SStuart R. Anderson unsigned char c;
133ea9e9d80SStuart R. Anderson
134ea9e9d80SStuart R. Anderson serial_out(early_serial_base, LCR, 0x3); /* 8n1 */
135ea9e9d80SStuart R. Anderson serial_out(early_serial_base, IER, 0); /* no interrupt */
136ea9e9d80SStuart R. Anderson serial_out(early_serial_base, FCR, 0); /* no fifo */
137ea9e9d80SStuart R. Anderson serial_out(early_serial_base, MCR, 0x3); /* DTR + RTS */
138ea9e9d80SStuart R. Anderson
139ea9e9d80SStuart R. Anderson c = serial_in(early_serial_base, LCR);
140ea9e9d80SStuart R. Anderson serial_out(early_serial_base, LCR, c | DLAB);
141ea9e9d80SStuart R. Anderson serial_out(early_serial_base, DLL, divisor & 0xff);
142ea9e9d80SStuart R. Anderson serial_out(early_serial_base, DLH, (divisor >> 8) & 0xff);
143ea9e9d80SStuart R. Anderson serial_out(early_serial_base, LCR, c & ~DLAB);
144ea9e9d80SStuart R. Anderson }
145ea9e9d80SStuart R. Anderson
146250c2277SThomas Gleixner #define DEFAULT_BAUD 9600
147250c2277SThomas Gleixner
early_serial_init(char * s)148250c2277SThomas Gleixner static __init void early_serial_init(char *s)
149250c2277SThomas Gleixner {
150250c2277SThomas Gleixner unsigned divisor;
151ea9e9d80SStuart R. Anderson unsigned long baud = DEFAULT_BAUD;
152250c2277SThomas Gleixner char *e;
153250c2277SThomas Gleixner
154250c2277SThomas Gleixner if (*s == ',')
155250c2277SThomas Gleixner ++s;
156250c2277SThomas Gleixner
157250c2277SThomas Gleixner if (*s) {
158250c2277SThomas Gleixner unsigned port;
159250c2277SThomas Gleixner if (!strncmp(s, "0x", 2)) {
160250c2277SThomas Gleixner early_serial_base = simple_strtoul(s, &e, 16);
161250c2277SThomas Gleixner } else {
16230cec979SJan Beulich static const int __initconst bases[] = { 0x3f8, 0x2f8 };
163250c2277SThomas Gleixner
164250c2277SThomas Gleixner if (!strncmp(s, "ttyS", 4))
165250c2277SThomas Gleixner s += 4;
166250c2277SThomas Gleixner port = simple_strtoul(s, &e, 10);
167250c2277SThomas Gleixner if (port > 1 || s == e)
168250c2277SThomas Gleixner port = 0;
169250c2277SThomas Gleixner early_serial_base = bases[port];
170250c2277SThomas Gleixner }
171250c2277SThomas Gleixner s += strcspn(s, ",");
172250c2277SThomas Gleixner if (*s == ',')
173250c2277SThomas Gleixner s++;
174250c2277SThomas Gleixner }
175250c2277SThomas Gleixner
176250c2277SThomas Gleixner if (*s) {
177827a82ffSSteven Rostedt baud = simple_strtoull(s, &e, 0);
178827a82ffSSteven Rostedt
179827a82ffSSteven Rostedt if (baud == 0 || s == e)
180250c2277SThomas Gleixner baud = DEFAULT_BAUD;
181250c2277SThomas Gleixner }
182250c2277SThomas Gleixner
183ea9e9d80SStuart R. Anderson /* Convert from baud to divisor value */
184250c2277SThomas Gleixner divisor = 115200 / baud;
185ea9e9d80SStuart R. Anderson
186ea9e9d80SStuart R. Anderson /* These will always be IO based ports */
187ea9e9d80SStuart R. Anderson serial_in = io_serial_in;
188ea9e9d80SStuart R. Anderson serial_out = io_serial_out;
189ea9e9d80SStuart R. Anderson
190ea9e9d80SStuart R. Anderson /* Set up the HW */
191ea9e9d80SStuart R. Anderson early_serial_hw_init(divisor);
192250c2277SThomas Gleixner }
193250c2277SThomas Gleixner
194ea9e9d80SStuart R. Anderson #ifdef CONFIG_PCI
mem32_serial_out(unsigned long addr,int offset,int value)1957f99f8b9SMark Einon static void mem32_serial_out(unsigned long addr, int offset, int value)
1967f99f8b9SMark Einon {
1973435dd08SAndy Shevchenko u32 __iomem *vaddr = (u32 __iomem *)addr;
1987f99f8b9SMark Einon /* shift implied by pointer type */
1997f99f8b9SMark Einon writel(value, vaddr + offset);
2007f99f8b9SMark Einon }
2017f99f8b9SMark Einon
mem32_serial_in(unsigned long addr,int offset)2027f99f8b9SMark Einon static unsigned int mem32_serial_in(unsigned long addr, int offset)
2037f99f8b9SMark Einon {
2043435dd08SAndy Shevchenko u32 __iomem *vaddr = (u32 __iomem *)addr;
2057f99f8b9SMark Einon /* shift implied by pointer type */
2067f99f8b9SMark Einon return readl(vaddr + offset);
2077f99f8b9SMark Einon }
2087f99f8b9SMark Einon
209ea9e9d80SStuart R. Anderson /*
210ea9e9d80SStuart R. Anderson * early_pci_serial_init()
211ea9e9d80SStuart R. Anderson *
212ea9e9d80SStuart R. Anderson * This function is invoked when the early_printk param starts with "pciserial"
213d2266bbfSFeng Tang * The rest of the param should be "[force],B:D.F,baud", where B, D & F describe
214d2266bbfSFeng Tang * the location of a PCI device that must be a UART device. "force" is optional
215d2266bbfSFeng Tang * and overrides the use of an UART device with a wrong PCI class code.
216ea9e9d80SStuart R. Anderson */
early_pci_serial_init(char * s)217ea9e9d80SStuart R. Anderson static __init void early_pci_serial_init(char *s)
218ea9e9d80SStuart R. Anderson {
219ea9e9d80SStuart R. Anderson unsigned divisor;
220ea9e9d80SStuart R. Anderson unsigned long baud = DEFAULT_BAUD;
221ea9e9d80SStuart R. Anderson u8 bus, slot, func;
2227f99f8b9SMark Einon u32 classcode, bar0;
2237f99f8b9SMark Einon u16 cmdreg;
224ea9e9d80SStuart R. Anderson char *e;
225d2266bbfSFeng Tang int force = 0;
226ea9e9d80SStuart R. Anderson
227ea9e9d80SStuart R. Anderson if (*s == ',')
228ea9e9d80SStuart R. Anderson ++s;
229ea9e9d80SStuart R. Anderson
230ea9e9d80SStuart R. Anderson if (*s == 0)
231ea9e9d80SStuart R. Anderson return;
232ea9e9d80SStuart R. Anderson
233d2266bbfSFeng Tang /* Force the use of an UART device with wrong class code */
234d2266bbfSFeng Tang if (!strncmp(s, "force,", 6)) {
235d2266bbfSFeng Tang force = 1;
236d2266bbfSFeng Tang s += 6;
237d2266bbfSFeng Tang }
238d2266bbfSFeng Tang
239d2266bbfSFeng Tang /*
240d2266bbfSFeng Tang * Part the param to get the BDF values
241d2266bbfSFeng Tang */
242ea9e9d80SStuart R. Anderson bus = (u8)simple_strtoul(s, &e, 16);
243ea9e9d80SStuart R. Anderson s = e;
244ea9e9d80SStuart R. Anderson if (*s != ':')
245ea9e9d80SStuart R. Anderson return;
246ea9e9d80SStuart R. Anderson ++s;
247ea9e9d80SStuart R. Anderson slot = (u8)simple_strtoul(s, &e, 16);
248ea9e9d80SStuart R. Anderson s = e;
249ea9e9d80SStuart R. Anderson if (*s != '.')
250ea9e9d80SStuart R. Anderson return;
251ea9e9d80SStuart R. Anderson ++s;
252ea9e9d80SStuart R. Anderson func = (u8)simple_strtoul(s, &e, 16);
253ea9e9d80SStuart R. Anderson s = e;
254ea9e9d80SStuart R. Anderson
255ea9e9d80SStuart R. Anderson /* A baud might be following */
256ea9e9d80SStuart R. Anderson if (*s == ',')
257ea9e9d80SStuart R. Anderson s++;
258ea9e9d80SStuart R. Anderson
259ea9e9d80SStuart R. Anderson /*
260d2266bbfSFeng Tang * Find the device from the BDF
261ea9e9d80SStuart R. Anderson */
262ea9e9d80SStuart R. Anderson cmdreg = read_pci_config(bus, slot, func, PCI_COMMAND);
263ea9e9d80SStuart R. Anderson classcode = read_pci_config(bus, slot, func, PCI_CLASS_REVISION);
264ea9e9d80SStuart R. Anderson bar0 = read_pci_config(bus, slot, func, PCI_BASE_ADDRESS_0);
265ea9e9d80SStuart R. Anderson
266ea9e9d80SStuart R. Anderson /*
267*bc12b70fSPeter Zijlstra * Verify it is a 16550-UART type device
268ea9e9d80SStuart R. Anderson */
269ea9e9d80SStuart R. Anderson if (((classcode >> 16 != PCI_CLASS_COMMUNICATION_MODEM) &&
270ea9e9d80SStuart R. Anderson (classcode >> 16 != PCI_CLASS_COMMUNICATION_SERIAL)) ||
271*bc12b70fSPeter Zijlstra (((classcode >> 8) & 0xff) != PCI_SERIAL_16550_COMPATIBLE)) {
272d2266bbfSFeng Tang if (!force)
273ea9e9d80SStuart R. Anderson return;
274d2266bbfSFeng Tang }
275ea9e9d80SStuart R. Anderson
276ea9e9d80SStuart R. Anderson /*
277ea9e9d80SStuart R. Anderson * Determine if it is IO or memory mapped
278ea9e9d80SStuart R. Anderson */
279*bc12b70fSPeter Zijlstra if ((bar0 & PCI_BASE_ADDRESS_SPACE) == PCI_BASE_ADDRESS_SPACE_IO) {
280ea9e9d80SStuart R. Anderson /* it is IO mapped */
281ea9e9d80SStuart R. Anderson serial_in = io_serial_in;
282ea9e9d80SStuart R. Anderson serial_out = io_serial_out;
283*bc12b70fSPeter Zijlstra early_serial_base = bar0 & PCI_BASE_ADDRESS_IO_MASK;
284ea9e9d80SStuart R. Anderson write_pci_config(bus, slot, func, PCI_COMMAND,
285ea9e9d80SStuart R. Anderson cmdreg|PCI_COMMAND_IO);
286ea9e9d80SStuart R. Anderson } else {
287ea9e9d80SStuart R. Anderson /* It is memory mapped - assume 32-bit alignment */
288ea9e9d80SStuart R. Anderson serial_in = mem32_serial_in;
289ea9e9d80SStuart R. Anderson serial_out = mem32_serial_out;
290ea9e9d80SStuart R. Anderson /* WARNING! assuming the address is always in the first 4G */
291ea9e9d80SStuart R. Anderson early_serial_base =
292*bc12b70fSPeter Zijlstra (unsigned long)early_ioremap(bar0 & PCI_BASE_ADDRESS_MEM_MASK, 0x10);
293ea9e9d80SStuart R. Anderson write_pci_config(bus, slot, func, PCI_COMMAND,
294ea9e9d80SStuart R. Anderson cmdreg|PCI_COMMAND_MEMORY);
295ea9e9d80SStuart R. Anderson }
296ea9e9d80SStuart R. Anderson
297ea9e9d80SStuart R. Anderson /*
298d2266bbfSFeng Tang * Initialize the hardware
299ea9e9d80SStuart R. Anderson */
300ea9e9d80SStuart R. Anderson if (*s) {
301ea9e9d80SStuart R. Anderson if (strcmp(s, "nocfg") == 0)
302ea9e9d80SStuart R. Anderson /* Sometimes, we want to leave the UART alone
303ea9e9d80SStuart R. Anderson * and assume the BIOS has set it up correctly.
304ea9e9d80SStuart R. Anderson * "nocfg" tells us this is the case, and we
305ea9e9d80SStuart R. Anderson * should do no more setup.
306ea9e9d80SStuart R. Anderson */
307ea9e9d80SStuart R. Anderson return;
308ea9e9d80SStuart R. Anderson if (kstrtoul(s, 0, &baud) < 0 || baud == 0)
309ea9e9d80SStuart R. Anderson baud = DEFAULT_BAUD;
310ea9e9d80SStuart R. Anderson }
311ea9e9d80SStuart R. Anderson
312ea9e9d80SStuart R. Anderson /* Convert from baud to divisor value */
313ea9e9d80SStuart R. Anderson divisor = 115200 / baud;
314ea9e9d80SStuart R. Anderson
315ea9e9d80SStuart R. Anderson /* Set up the HW */
316ea9e9d80SStuart R. Anderson early_serial_hw_init(divisor);
317ea9e9d80SStuart R. Anderson }
318ea9e9d80SStuart R. Anderson #endif
319ea9e9d80SStuart R. Anderson
320250c2277SThomas Gleixner static struct console early_serial_console = {
321250c2277SThomas Gleixner .name = "earlyser",
322250c2277SThomas Gleixner .write = early_serial_write,
323250c2277SThomas Gleixner .flags = CON_PRINTBUFFER,
324250c2277SThomas Gleixner .index = -1,
325250c2277SThomas Gleixner };
326250c2277SThomas Gleixner
early_console_register(struct console * con,int keep_early)327c368ef28SDenys Vlasenko static void early_console_register(struct console *con, int keep_early)
328c9530948SJason Wessel {
329d0380e6cSThomas Gleixner if (con->index != -1) {
330429a6e5eSJason Wessel printk(KERN_CRIT "ERROR: earlyprintk= %s already used\n",
331429a6e5eSJason Wessel con->name);
332429a6e5eSJason Wessel return;
333429a6e5eSJason Wessel }
334c9530948SJason Wessel early_console = con;
335c9530948SJason Wessel if (keep_early)
336c9530948SJason Wessel early_console->flags &= ~CON_BOOT;
337c9530948SJason Wessel else
338c9530948SJason Wessel early_console->flags |= CON_BOOT;
339c9530948SJason Wessel register_console(early_console);
340c9530948SJason Wessel }
341250c2277SThomas Gleixner
setup_early_printk(char * buf)342250c2277SThomas Gleixner static int __init setup_early_printk(char *buf)
343250c2277SThomas Gleixner {
344c9530948SJason Wessel int keep;
3455c05917eSYinghai Lu
346250c2277SThomas Gleixner if (!buf)
347250c2277SThomas Gleixner return 0;
348250c2277SThomas Gleixner
349d0380e6cSThomas Gleixner if (early_console)
350250c2277SThomas Gleixner return 0;
351250c2277SThomas Gleixner
352c9530948SJason Wessel keep = (strstr(buf, "keep") != NULL);
353250c2277SThomas Gleixner
354c9530948SJason Wessel while (*buf != '\0') {
355250c2277SThomas Gleixner if (!strncmp(buf, "serial", 6)) {
356ea3acb19SJason Wessel buf += 6;
357ea3acb19SJason Wessel early_serial_init(buf);
358c9530948SJason Wessel early_console_register(&early_serial_console, keep);
359ea3acb19SJason Wessel if (!strncmp(buf, ",ttyS", 5))
360ea3acb19SJason Wessel buf += 5;
361c9530948SJason Wessel }
362c9530948SJason Wessel if (!strncmp(buf, "ttyS", 4)) {
363c9530948SJason Wessel early_serial_init(buf + 4);
364c9530948SJason Wessel early_console_register(&early_serial_console, keep);
365c9530948SJason Wessel }
366ea9e9d80SStuart R. Anderson #ifdef CONFIG_PCI
367ea9e9d80SStuart R. Anderson if (!strncmp(buf, "pciserial", 9)) {
368ea9e9d80SStuart R. Anderson early_pci_serial_init(buf + 9);
369ea9e9d80SStuart R. Anderson early_console_register(&early_serial_console, keep);
370ea9e9d80SStuart R. Anderson buf += 9; /* Keep from match the above "serial" */
371ea9e9d80SStuart R. Anderson }
372ea9e9d80SStuart R. Anderson #endif
373c9530948SJason Wessel if (!strncmp(buf, "vga", 3) &&
374c9530948SJason Wessel boot_params.screen_info.orig_video_isVGA == 1) {
37530c82645SH. Peter Anvin max_xpos = boot_params.screen_info.orig_video_cols;
37630c82645SH. Peter Anvin max_ypos = boot_params.screen_info.orig_video_lines;
37730c82645SH. Peter Anvin current_ypos = boot_params.screen_info.orig_y;
378c9530948SJason Wessel early_console_register(&early_vga_console, keep);
379c9530948SJason Wessel }
3805c05917eSYinghai Lu #ifdef CONFIG_EARLY_PRINTK_DBGP
381c9530948SJason Wessel if (!strncmp(buf, "dbgp", 4) && !early_dbgp_init(buf + 4))
382c9530948SJason Wessel early_console_register(&early_dbgp_console, keep);
3835c05917eSYinghai Lu #endif
384250c2277SThomas Gleixner #ifdef CONFIG_HVC_XEN
385c9530948SJason Wessel if (!strncmp(buf, "xen", 3))
386c9530948SJason Wessel early_console_register(&xenboot_console, keep);
387250c2277SThomas Gleixner #endif
3881b5aeebfSLu Baolu #ifdef CONFIG_EARLY_PRINTK_USB_XDBC
3891b5aeebfSLu Baolu if (!strncmp(buf, "xdbc", 4))
390b0ae33a2SPeter Zijlstra early_xdbc_parse_parameter(buf + 4, keep);
3911b5aeebfSLu Baolu #endif
39272548e83SMatt Fleming
393c9530948SJason Wessel buf++;
394250c2277SThomas Gleixner }
395250c2277SThomas Gleixner return 0;
396250c2277SThomas Gleixner }
3975c05917eSYinghai Lu
398250c2277SThomas Gleixner early_param("earlyprintk", setup_early_printk);
399