rework the way to set booted-console flag.
This commit is contained in:
parent
3462fe5d99
commit
ed95b7ebe4
@ -1,4 +1,4 @@
|
||||
/* -*-C++-*- $NetBSD: console.cpp,v 1.5 2001/05/08 18:51:22 uch Exp $ */
|
||||
/* -*-C++-*- $NetBSD: console.cpp,v 1.6 2001/05/21 15:54:25 uch Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
@ -52,6 +52,12 @@ Console::Instance()
|
||||
return _instance;
|
||||
}
|
||||
|
||||
Console::Console()
|
||||
{
|
||||
// set default builtin console. (bicons)
|
||||
setBootConsole(BI_CNUSE_BUILTIN);
|
||||
}
|
||||
|
||||
void
|
||||
Console::Destroy()
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* -*-C++-*- $NetBSD: console.h,v 1.4 2001/04/24 19:27:59 uch Exp $ */
|
||||
/* -*-C++-*- $NetBSD: console.h,v 1.5 2001/05/21 15:54:25 uch Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
@ -45,6 +45,7 @@
|
||||
class Console {
|
||||
private:
|
||||
static Console *_instance;
|
||||
int16_t _boot_console;
|
||||
|
||||
protected:
|
||||
enum { CONSOLE_BUFSIZE = 256 };
|
||||
@ -52,9 +53,7 @@ protected:
|
||||
BOOL _on;
|
||||
|
||||
protected:
|
||||
int16_t _boot_console;
|
||||
|
||||
Console(void) { /* NO-OP */ }
|
||||
Console(void);
|
||||
~Console(void) { /* NO-OP */ }
|
||||
|
||||
public:
|
||||
@ -63,7 +62,9 @@ public:
|
||||
virtual void print(const TCHAR *fmt, ...);
|
||||
virtual BOOL init(void) { return TRUE; }
|
||||
BOOL &on(void) { return _on; }
|
||||
virtual int16_t getBootConsole(void) { return BI_CNUSE_BUILTIN; }
|
||||
|
||||
void setBootConsole(u_int16_t cnuse) { _boot_console = cnuse; }
|
||||
int16_t getBootConsole(void) const { return _boot_console; }
|
||||
};
|
||||
|
||||
class SerialConsole : public Console
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: sh_boot.cpp,v 1.3 2001/05/08 18:51:25 uch Exp $ */
|
||||
/* $NetBSD: sh_boot.cpp,v 1.4 2001/05/21 15:54:25 uch Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
@ -85,13 +85,16 @@ SHBoot::create()
|
||||
BOOL(*lock_pages)(LPVOID, DWORD, PDWORD, int);
|
||||
BOOL(*unlock_pages)(LPVOID, DWORD);
|
||||
|
||||
// Change console to serial if required.
|
||||
// Setup console. this setting is passed to kernel bootinfo.
|
||||
if (args.console == CONSOLE_SERIAL) {
|
||||
_cons = SHConsole::Instance();
|
||||
if (!_cons->init()) {
|
||||
_cons = Console::Instance();
|
||||
DPRINTF((TEXT("use LCD console instead.\n")));
|
||||
}
|
||||
} else {
|
||||
_cons = Console::Instance();
|
||||
SHConsole::selectBootConsole(*_cons, SHConsole::VIDEO);
|
||||
}
|
||||
|
||||
// Architecture dependent ops.
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* -*-C++-*- $NetBSD: sh_console.cpp,v 1.6 2001/05/08 18:51:25 uch Exp $ */
|
||||
/* -*-C++-*- $NetBSD: sh_console.cpp,v 1.7 2001/05/21 15:54:25 uch Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
@ -40,20 +40,50 @@
|
||||
#include <sh3/sh_console.h>
|
||||
#include <sh3/hd64461.h>
|
||||
|
||||
// XXX don't define here. arch/hpcsh/include/bootinfo.h
|
||||
#define BI_CNUSE_SCI 2
|
||||
#define BI_CNUSE_SCIF 3
|
||||
#define BI_CNUSE_HD64461COM 4
|
||||
#define BI_CNUSE_HD64461VIDEO 5
|
||||
|
||||
SHConsole *SHConsole::_instance = 0;
|
||||
|
||||
struct SHConsole::console_info
|
||||
SHConsole::_console_info[] = {
|
||||
{ PLATID_CPU_SH_3 , PLATID_MACH_HP , SCIFPrint , BI_CNUSE_SCIF },
|
||||
{ PLATID_CPU_SH_3_7709 , PLATID_MACH_HITACHI , HD64461COMPrint , BI_CNUSE_HD64461COM },
|
||||
{ PLATID_CPU_SH_3_7709 , PLATID_MACH_CASIO_CASSIOPEIAA_A55V , 0 , BI_CNUSE_BUILTIN },
|
||||
{ PLATID_CPU_SH_3 , PLATID_MACH_HP , SCIFPrint , BI_CNUSE_SCIF , BI_CNUSE_HD64461VIDEO},
|
||||
{ PLATID_CPU_SH_3_7709 , PLATID_MACH_HITACHI , HD64461COMPrint , BI_CNUSE_HD64461COM , BI_CNUSE_HD64461VIDEO},
|
||||
{ PLATID_CPU_SH_3_7709 , PLATID_MACH_CASIO_CASSIOPEIAA_A55V , 0 , BI_CNUSE_BUILTIN , BI_CNUSE_BUILTIN },
|
||||
{ 0, 0, 0 } // terminator.
|
||||
};
|
||||
|
||||
struct SHConsole::console_info *
|
||||
SHConsole::selectBootConsole(Console &cons, enum consoleSelect select)
|
||||
{
|
||||
struct console_info *tab = _console_info;
|
||||
platid_mask_t target, entry;
|
||||
|
||||
target.dw.dw0 = HPC_PREFERENCE.platid_hi;
|
||||
target.dw.dw1 = HPC_PREFERENCE.platid_lo;
|
||||
|
||||
// search apriori setting if any.
|
||||
for (; tab->cpu; tab++) {
|
||||
entry.dw.dw0 = tab->cpu;
|
||||
entry.dw.dw1 = tab->machine;
|
||||
if (platid_match(&target, &entry)) {
|
||||
switch (select) {
|
||||
case SERIAL:
|
||||
cons.setBootConsole(tab->serial_console);
|
||||
break;
|
||||
case VIDEO:
|
||||
cons.setBootConsole(tab->video_console);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return tab;
|
||||
}
|
||||
|
||||
SHConsole::SHConsole()
|
||||
{
|
||||
_print = 0;
|
||||
@ -61,6 +91,7 @@ SHConsole::SHConsole()
|
||||
|
||||
SHConsole::~SHConsole()
|
||||
{
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
SHConsole *
|
||||
@ -75,28 +106,16 @@ SHConsole::Instance()
|
||||
BOOL
|
||||
SHConsole::init()
|
||||
{
|
||||
struct console_info *tab = _console_info;
|
||||
platid_mask_t target, entry;
|
||||
|
||||
if (!super::init())
|
||||
return FALSE;
|
||||
|
||||
_kmode = SetKMode(1);
|
||||
|
||||
struct console_info *tab = selectBootConsole(*this, SERIAL);
|
||||
if (tab != 0)
|
||||
_print = tab->print;
|
||||
|
||||
target.dw.dw0 = HPC_PREFERENCE.platid_hi;
|
||||
target.dw.dw1 = HPC_PREFERENCE.platid_lo;
|
||||
|
||||
// search apriori setting if any.
|
||||
for (; tab->cpu; tab++) {
|
||||
entry.dw.dw0 = tab->cpu;
|
||||
entry.dw.dw1 = tab->machine;
|
||||
if (platid_match(&target, &entry)) {
|
||||
_print = tab->print;
|
||||
_boot_console = tab->boot_console;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* -*-C++-*- $NetBSD: sh_console.h,v 1.5 2001/04/24 19:28:01 uch Exp $ */
|
||||
/* -*-C++-*- $NetBSD: sh_console.h,v 1.6 2001/05/21 15:54:25 uch Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
@ -53,9 +53,13 @@ public:
|
||||
struct console_info {
|
||||
u_int32_t cpu, machine;
|
||||
print_func_t print;
|
||||
int16_t boot_console;
|
||||
int16_t serial_console;
|
||||
int16_t video_console;
|
||||
};
|
||||
static struct console_info _console_info[];
|
||||
enum consoleSelect { VIDEO, SERIAL };
|
||||
static struct console_info *selectBootConsole(Console &,
|
||||
enum consoleSelect);
|
||||
static void SCIPrint(const char *);
|
||||
static void SCIFPrint(const char *);
|
||||
static void HD64461COMPrint(const char *);
|
||||
@ -73,6 +77,5 @@ public:
|
||||
|
||||
virtual BOOL init(void);
|
||||
virtual void print(const TCHAR *fmt, ...);
|
||||
virtual int16_t getBootConsole(void) { return _boot_console; }
|
||||
};
|
||||
#endif //_HPCBOOT_SH_CONSOLE_H_
|
||||
|
Loading…
Reference in New Issue
Block a user