Skip to content

Commit d5a2aa2

Browse files
author
David S. Miller
committed
[SPARC64] sunhv: Bug fixes.
Add udelay to polling console write loop, and increment the loop limit. Name the device "ttyHV" and pass that to add_preferred_console() when we're using hypervisor console. Kill sunhv_console_setup(), it's empty. Handle the case where we don't want to use hypervisor console. (ie. we have a head attached to a sun4v machine) Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 5259d5b commit d5a2aa2

File tree

2 files changed

+11
-15
lines changed

2 files changed

+11
-15
lines changed

arch/sparc64/kernel/setup.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,7 @@ static int __init set_preferred_console(void)
410410
* value anyways...
411411
*/
412412
serial_console = 4;
413+
return add_preferred_console("ttyHV", 0, NULL);
413414
} else {
414415
prom_printf("Inconsistent console: "
415416
"input %d, output %d\n",

drivers/serial/sunhv.c

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -360,14 +360,15 @@ static struct uart_port *sunhv_port;
360360
static inline void sunhv_console_putchar(struct uart_port *port, char c)
361361
{
362362
unsigned long flags;
363-
int limit = 10000;
363+
int limit = 1000000;
364364

365365
spin_lock_irqsave(&port->lock, flags);
366366

367367
while (limit-- > 0) {
368368
long status = hypervisor_con_putchar(c);
369369
if (status == HV_EOK)
370370
break;
371+
udelay(2);
371372
}
372373

373374
spin_unlock_irqrestore(&port->lock, flags);
@@ -385,28 +386,23 @@ static void sunhv_console_write(struct console *con, const char *s, unsigned n)
385386
}
386387
}
387388

388-
static int sunhv_console_setup(struct console *con, char *options)
389-
{
390-
return 0;
391-
}
392-
393389
static struct console sunhv_console = {
394-
.name = "ttyS",
390+
.name = "ttyHV",
395391
.write = sunhv_console_write,
396392
.device = uart_console_device,
397-
.setup = sunhv_console_setup,
398393
.flags = CON_PRINTBUFFER,
399394
.index = -1,
400395
.data = &sunhv_reg,
401396
};
402397

403-
static void __init sunhv_console_init(void)
398+
static inline struct console *SUNHV_CONSOLE(void)
404399
{
405400
if (con_is_present())
406-
return;
401+
return NULL;
407402

408403
sunhv_console.index = 0;
409-
register_console(&sunhv_console);
404+
405+
return &sunhv_console;
410406
}
411407

412408
static int __init hv_console_compatible(char *buf, int len)
@@ -496,7 +492,6 @@ static int __init sunhv_init(void)
496492

497493
sunhv_reg.minor = sunserial_current_minor;
498494
sunhv_reg.nr = 1;
499-
sunhv_reg.cons = &sunhv_console;
500495

501496
ret = uart_register_driver(&sunhv_reg);
502497
if (ret < 0) {
@@ -506,11 +501,11 @@ static int __init sunhv_init(void)
506501
return ret;
507502
}
508503

509-
sunhv_port = port;
510-
511504
sunserial_current_minor += 1;
512505

513-
sunhv_console_init();
506+
sunhv_reg.cons = SUNHV_CONSOLE();
507+
508+
sunhv_port = port;
514509

515510
uart_add_one_port(&sunhv_reg, port);
516511

0 commit comments

Comments
 (0)