- also put a boot failure message to LCD

- fix botched (and unused) macro
- use struct lcd_message consistently
This commit is contained in:
tsutsui 2008-05-29 14:25:00 +00:00
parent 11e4a43ad9
commit 8578fbdffa
3 changed files with 24 additions and 12 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: boot.c,v 1.16 2008/05/28 14:04:07 tsutsui Exp $ */
/* $NetBSD: boot.c,v 1.17 2008/05/29 14:25:00 tsutsui Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@ -490,6 +490,8 @@ main(unsigned int memsize)
(*entry)(memsize, BOOTINFO_MAGIC, bi_addr);
}
delay(20000);
lcd_failed();
(void)printf("Boot failed! Rebooting...\n");
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: boot.h,v 1.11 2008/05/28 14:04:07 tsutsui Exp $ */
/* $NetBSD: boot.h,v 1.12 2008/05/29 14:25:01 tsutsui Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@ -102,3 +102,4 @@ uint32_t pcicfgread(uint32_t, uint32_t);
void lcd_init(void);
void lcd_banner(void);
void lcd_loadfile(const char *);
void lcd_failed(void);

View File

@ -1,4 +1,4 @@
/* $NetBSD: lcd.c,v 1.1 2008/05/28 14:04:07 tsutsui Exp $ */
/* $NetBSD: lcd.c,v 1.2 2008/05/29 14:25:01 tsutsui Exp $ */
/*-
* Copyright (c) 2008 Izumi Tsutsui. All rights reserved.
@ -36,11 +36,10 @@
#define IREG 0x00
#define DREG 0x10
#if 0
#define CSR_READ(base, reg) \
do { \
((*(volatile uint32_t *)((base) + (reg))) >> 24) \
delay(10); \
} while (/* CONSTCOND */ 0)
(((*(volatile uint32_t *)((base) + (reg))) >> 24), delay(10))
#endif
#define CSR_WRITE(base, reg, val) \
do { \
@ -60,7 +59,14 @@ static const struct lcd_message banner_message = {
"NetBSD/cobalt ",
"Bootloader "
};
static const char load[NCOLS] = "Loading: ";
static const struct lcd_message failed_message = {
"Boot failed! ",
"Rebooting... "
};
static struct lcd_message loadfile_message = {
"Loading: ",
" "
};
static void lcd_puts(const struct lcd_message *);
@ -81,16 +87,19 @@ lcd_banner(void)
void
lcd_loadfile(const char *file)
{
struct lcd_message loadfile_message;
memset(loadfile_message.row1, ' ', NCOLS);
memcpy(loadfile_message.row1, load, min(NCOLS, strlen(load)));
memset(loadfile_message.row2, ' ', NCOLS);
memcpy(loadfile_message.row2, file, min(NCOLS, strlen(file)));
lcd_puts(&loadfile_message);
}
void
lcd_failed(void)
{
lcd_puts(&failed_message);
}
static void
lcd_puts(const struct lcd_message *message)
{