From 4b518f44d7f964357482c23a16ab69444c8b3a9c Mon Sep 17 00:00:00 2001 From: Takuya ASADA <syuu@cloudius-systems.com> Date: Thu, 24 Apr 2014 23:41:20 +0900 Subject: [PATCH] Move Console class to console namespace Signed-off-by: Takuya ASADA <syuu@cloudius-systems.com> Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com> --- arch/x64/debug-console.cc | 4 ++++ drivers/console.hh | 4 ++-- drivers/debug-console.hh | 3 +++ drivers/isa-serial.cc | 4 ++++ drivers/isa-serial.hh | 4 ++++ drivers/kbd.hh | 1 - drivers/vga.cc | 4 ++++ drivers/vga.hh | 4 ++++ 8 files changed, 25 insertions(+), 3 deletions(-) diff --git a/arch/x64/debug-console.cc b/arch/x64/debug-console.cc index adf10a360..fb740146b 100644 --- a/arch/x64/debug-console.cc +++ b/arch/x64/debug-console.cc @@ -8,6 +8,8 @@ #include <drivers/debug-console.hh> #include "processor.hh" +namespace console { + // Write to the serial port if the console is not yet initialized. Because we // are just dumping output, no initialization is necessary. We take advantage // of the fact that we are running on virtual hardware that probably does not @@ -63,3 +65,5 @@ bool debug_console::input_ready() return _impl && _impl->input_ready(); } } + +} diff --git a/drivers/console.hh b/drivers/console.hh index 16b0c04bd..32e50be45 100644 --- a/drivers/console.hh +++ b/drivers/console.hh @@ -10,6 +10,8 @@ #include <boost/format.hpp> +namespace console { + class Console { public: virtual ~Console() {} @@ -18,8 +20,6 @@ public: virtual char readch() = 0; }; -namespace console { - void write(const char *msg, size_t len); void write_ll(const char *msg, size_t len); void console_init(bool use_vga); diff --git a/drivers/debug-console.hh b/drivers/debug-console.hh index 64a2243b4..c9ec16666 100644 --- a/drivers/debug-console.hh +++ b/drivers/debug-console.hh @@ -15,6 +15,8 @@ // Wrap a Console with a spinlock, used for debugging // (we can't use a mutex, since we might want to debug the scheduler) +namespace console { + class debug_console : public Console { public: void set_impl(Console* impl); @@ -28,5 +30,6 @@ private: spinlock _lock; }; +} #endif /* DEBUG_CONSOLE_HH_ */ diff --git a/drivers/isa-serial.cc b/drivers/isa-serial.cc index 248ee8009..2a2b7f994 100644 --- a/drivers/isa-serial.cc +++ b/drivers/isa-serial.cc @@ -8,6 +8,8 @@ #include "isa-serial.hh" #include <string.h> +namespace console { + IsaSerialConsole::IsaSerialConsole(sched::thread* poll_thread, const termios *tio) : _irq(4, [=] { poll_thread->wake(); }), _tio(tio) { @@ -77,3 +79,5 @@ void IsaSerialConsole::reset() { // bit, but interestingly VMWare does, so we must set it. pci::outb(MCR_AUX_OUTPUT_2, ioport + MCR_ADDRESS); } + +} diff --git a/drivers/isa-serial.hh b/drivers/isa-serial.hh index 1791ee12a..0b374686e 100644 --- a/drivers/isa-serial.hh +++ b/drivers/isa-serial.hh @@ -14,6 +14,8 @@ #include <osv/interrupt.hh> #include <termios.h> +namespace console { + class IsaSerialConsole : public Console { public: explicit IsaSerialConsole(sched::thread* consumer, const termios *tio); @@ -62,4 +64,6 @@ private: void writeByte(const char letter); }; +} + #endif diff --git a/drivers/kbd.hh b/drivers/kbd.hh index 8a8affa2f..64f6eae67 100644 --- a/drivers/kbd.hh +++ b/drivers/kbd.hh @@ -10,7 +10,6 @@ #include "console.hh" #include <osv/interrupt.hh> -#include <termios.h> enum modifiers { MOD_SHIFT = 1<<0, diff --git a/drivers/vga.cc b/drivers/vga.cc index 917a0e2d9..fb2cc6cfb 100644 --- a/drivers/vga.cc +++ b/drivers/vga.cc @@ -8,6 +8,8 @@ #include "vga.hh" #include <osv/mmu.hh> +namespace console { + volatile unsigned short * const VGAConsole::_buffer = reinterpret_cast<volatile unsigned short *>(mmu::phys_mem + 0xb8000); @@ -189,3 +191,5 @@ char VGAConsole::readch() return 0; } } + +} diff --git a/drivers/vga.hh b/drivers/vga.hh index 438cf52b5..aba358ae4 100644 --- a/drivers/vga.hh +++ b/drivers/vga.hh @@ -15,6 +15,8 @@ #include "libtsm/libtsm.hh" #include <queue> +namespace console { + class VGAConsole : public Console { public: explicit VGAConsole(sched::thread* consumer, const termios *tio); @@ -51,4 +53,6 @@ private: bool _offset_dirty; }; +} + #endif -- GitLab