Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/hpc/stand/hpcboot rework the way to set booted-cons...



details:   https://anonhg.NetBSD.org/src/rev/64f093a8ecc0
branches:  trunk
changeset: 510155:64f093a8ecc0
user:      uch <uch%NetBSD.org@localhost>
date:      Mon May 21 15:54:25 2001 +0000

description:
rework the way to set booted-console flag.

diffstat:

 sys/arch/hpc/stand/hpcboot/console.cpp        |   8 +++-
 sys/arch/hpc/stand/hpcboot/console.h          |  11 ++--
 sys/arch/hpc/stand/hpcboot/sh3/sh_boot.cpp    |   7 ++-
 sys/arch/hpc/stand/hpcboot/sh3/sh_console.cpp |  59 +++++++++++++++++---------
 sys/arch/hpc/stand/hpcboot/sh3/sh_console.h   |   9 ++-
 5 files changed, 63 insertions(+), 31 deletions(-)

diffs (223 lines):

diff -r a4ab3f50d1b8 -r 64f093a8ecc0 sys/arch/hpc/stand/hpcboot/console.cpp
--- a/sys/arch/hpc/stand/hpcboot/console.cpp    Mon May 21 15:50:46 2001 +0000
+++ b/sys/arch/hpc/stand/hpcboot/console.cpp    Mon May 21 15:54:25 2001 +0000
@@ -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 @@
        return _instance;
 }
 
+Console::Console()
+{
+       // set default builtin console. (bicons)
+       setBootConsole(BI_CNUSE_BUILTIN);
+}
+
 void
 Console::Destroy()
 {
diff -r a4ab3f50d1b8 -r 64f093a8ecc0 sys/arch/hpc/stand/hpcboot/console.h
--- a/sys/arch/hpc/stand/hpcboot/console.h      Mon May 21 15:50:46 2001 +0000
+++ b/sys/arch/hpc/stand/hpcboot/console.h      Mon May 21 15:54:25 2001 +0000
@@ -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 @@
        BOOL _on;
 
 protected:
-       int16_t _boot_console;
-
-       Console(void) { /* NO-OP */ }
+       Console(void);
        ~Console(void) { /* NO-OP */ }
 
 public:
@@ -63,7 +62,9 @@
        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
diff -r a4ab3f50d1b8 -r 64f093a8ecc0 sys/arch/hpc/stand/hpcboot/sh3/sh_boot.cpp
--- a/sys/arch/hpc/stand/hpcboot/sh3/sh_boot.cpp        Mon May 21 15:50:46 2001 +0000
+++ b/sys/arch/hpc/stand/hpcboot/sh3/sh_boot.cpp        Mon May 21 15:54:25 2001 +0000
@@ -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 @@
        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.
diff -r a4ab3f50d1b8 -r 64f093a8ecc0 sys/arch/hpc/stand/hpcboot/sh3/sh_console.cpp
--- a/sys/arch/hpc/stand/hpcboot/sh3/sh_console.cpp     Mon May 21 15:50:46 2001 +0000
+++ b/sys/arch/hpc/stand/hpcboot/sh3/sh_console.cpp     Mon May 21 15:54:25 2001 +0000
@@ -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()
 {
+       // NO-OP
 }
 
 SHConsole *
@@ -75,28 +106,16 @@
 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;
 }
 
diff -r a4ab3f50d1b8 -r 64f093a8ecc0 sys/arch/hpc/stand/hpcboot/sh3/sh_console.h
--- a/sys/arch/hpc/stand/hpcboot/sh3/sh_console.h       Mon May 21 15:50:46 2001 +0000
+++ b/sys/arch/hpc/stand/hpcboot/sh3/sh_console.h       Mon May 21 15:54:25 2001 +0000
@@ -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 @@
        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 @@
 
        virtual BOOL init(void);
        virtual void print(const TCHAR *fmt, ...);
-       virtual int16_t getBootConsole(void) { return _boot_console; }
 };
 #endif //_HPCBOOT_SH_CONSOLE_H_



Home | Main Index | Thread Index | Old Index