[rtems commit] pc386: Add BSP_ENABLE_VGA BSP option

Joel Sherril joel at rtems.org
Sun Jan 4 19:45:21 UTC 2015


Module:    rtems
Branch:    master
Commit:    607c85465dc1115a0b86ff1168db8c5f670e40a7
Changeset: http://git.rtems.org/rtems/commit/?id=607c85465dc1115a0b86ff1168db8c5f670e40a7

Author:    Joel Sherrill <joel.sherrill at oarcorp.com>
Date:      Thu Dec 11 14:49:49 2014 -0600

pc386: Add BSP_ENABLE_VGA BSP option

This allows the VGA and keyboard console to be completely disabled.
It is useful on PCs without displays and prevents a very slow boot
time on the Intel Edison.

---

 c/src/lib/libbsp/i386/pc386/Makefile.am            | 38 ++++++++++++----------
 c/src/lib/libbsp/i386/pc386/configure.ac           |  5 +++
 c/src/lib/libbsp/i386/pc386/console/conscfg.c      |  7 ++++
 .../libbsp/i386/pc386/console/console_control.c    |  6 ++++
 .../lib/libbsp/i386/pc386/console/printk_support.c | 37 ++++++++++++---------
 c/src/lib/libbsp/i386/pc386/preinstall.am          | 10 +++---
 c/src/lib/libbsp/i386/pc386/start/start.S          |  2 ++
 7 files changed, 69 insertions(+), 36 deletions(-)

diff --git a/c/src/lib/libbsp/i386/pc386/Makefile.am b/c/src/lib/libbsp/i386/pc386/Makefile.am
index 42b0279..3f34485 100644
--- a/c/src/lib/libbsp/i386/pc386/Makefile.am
+++ b/c/src/lib/libbsp/i386/pc386/Makefile.am
@@ -74,14 +74,14 @@ libbsp_a_SOURCES += ../../shared/tod.c
 libbsp_a_SOURCES += ../../shared/clockdrv_shell.h
 
 include_rtemsdir = $(includedir)/rtems
-include_rtems_HEADERS = console/keyboard.h
+include_rtems_HEADERS  =
+
+if RTEMS_VGA
+include_rtems_HEADERS += console/keyboard.h
 include_rtems_HEADERS += console/kd.h
 include_rtems_HEADERS += console/ps2_drv.h
 include_rtems_HEADERS += ../../shared/console_private.h
 include_rtems_HEADERS += console/vgacons.h
-
-include_HEADERS += ../../i386/shared/comm/i386_io.h
-# console
 libbsp_a_SOURCES += console/inch.c
 libbsp_a_SOURCES += console/outch.c
 libbsp_a_SOURCES += console/defkeymap.c
@@ -92,20 +92,7 @@ libbsp_a_SOURCES += console/vgainit.c
 libbsp_a_SOURCES += console/vt.c
 libbsp_a_SOURCES += console/videoAsm.S
 libbsp_a_SOURCES += console/kbd_parser.c
-libbsp_a_SOURCES += console/serial_mouse_config.c
-libbsp_a_SOURCES += ../../i386/shared/comm/uart.c
-libbsp_a_SOURCES += ../../i386/shared/comm/tty_drv.c
-libbsp_a_SOURCES += ../../i386/shared/realmode_int/realmode_int.c
-libbsp_a_SOURCES += ../../shared/console.c
-libbsp_a_SOURCES += console/console_select.c
-libbsp_a_SOURCES += ../../shared/console_read.c
-libbsp_a_SOURCES += ../../shared/console_write.c
-libbsp_a_SOURCES += console/console_control.c
-libbsp_a_SOURCES += console/conscfg.c
-libbsp_a_SOURCES += console/printk_support.c
 libbsp_a_SOURCES += console/vgacons.c
-libbsp_a_SOURCES += console/exar17d15x.c
-libbsp_a_SOURCES += console/rtd316.c
 if USE_VBE_RM
 include_bsp_HEADERS += include/vbe3.h
 include_HEADERS += include/edid.h
@@ -118,6 +105,23 @@ else
 libbsp_a_SOURCES += console/fb_vga.c
 endif
 endif
+endif
+
+# console (non-graphics support)
+include_HEADERS += ../../i386/shared/comm/i386_io.h
+libbsp_a_SOURCES += console/serial_mouse_config.c
+libbsp_a_SOURCES += ../../i386/shared/comm/uart.c
+libbsp_a_SOURCES += ../../i386/shared/comm/tty_drv.c
+libbsp_a_SOURCES += ../../i386/shared/realmode_int/realmode_int.c
+libbsp_a_SOURCES += ../../shared/console.c
+libbsp_a_SOURCES += console/console_select.c
+libbsp_a_SOURCES += ../../shared/console_read.c
+libbsp_a_SOURCES += ../../shared/console_write.c
+libbsp_a_SOURCES += console/console_control.c
+libbsp_a_SOURCES += console/conscfg.c
+libbsp_a_SOURCES += console/printk_support.c
+libbsp_a_SOURCES += console/exar17d15x.c
+libbsp_a_SOURCES += console/rtd316.c
 
 # gdb
 libbsp_a_SOURCES += ../../i386/shared/comm/i386-stub.c
diff --git a/c/src/lib/libbsp/i386/pc386/configure.ac b/c/src/lib/libbsp/i386/pc386/configure.ac
index ec976b4..bdedb0c 100644
--- a/c/src/lib/libbsp/i386/pc386/configure.ac
+++ b/c/src/lib/libbsp/i386/pc386/configure.ac
@@ -17,6 +17,11 @@ RTEMS_PROG_CCAS
 RTEMS_CHECK_NETWORKING
 RTEMS_CHECK_SMP
 
+RTEMS_BSPOPTS_SET([BSP_ENABLE_VGA],[*],[1])
+RTEMS_BSPOPTS_HELP([BSP_ENABLE_VGA],
+[Set if the VGA and keyboard console support is enabled.])
+AM_CONDITIONAL(RTEMS_VGA,[test "$BSP_ENABLE_VGA" = "1"])
+
 RTEMS_BSPOPTS_SET([USE_COM1_AS_CONSOLE],[*],[0])
 RTEMS_BSPOPTS_HELP([USE_COM1_AS_CONSOLE],
 [Determines, whether the console will be associated with the standard
diff --git a/c/src/lib/libbsp/i386/pc386/console/conscfg.c b/c/src/lib/libbsp/i386/pc386/console/conscfg.c
index f0295ef..72ccfe3 100644
--- a/c/src/lib/libbsp/i386/pc386/console/conscfg.c
+++ b/c/src/lib/libbsp/i386/pc386/console/conscfg.c
@@ -18,12 +18,17 @@
 #include <bsp.h>
 #include <libchip/serial.h>
 #include <libchip/ns16550.h>
+#if BSP_ENABLE_VGA
 #include "vgacons.h"
+#endif
 #include <bsp/irq.h>
 #include <rtems/pci.h>
 #include <bsp/rtd316.h>
 
+#if BSP_ENABLE_VGA
 #define VGA_CONSOLE_FUNCTIONS  &vgacons_fns
+#endif
+
 #if 0
 #define COM_CONSOLE_FUNCTIONS  &ns16550_fns_polled
 #else
@@ -54,6 +59,7 @@ static void com_set_register(uint32_t addr, uint8_t i, uint8_t val)
 }
 
 console_tbl     Console_Configuration_Ports[] = {
+#if BSP_ENABLE_VGA
   {
     "/dev/vgacons",                        /* sDeviceName */
     VGA_CONSOLE,                           /* deviceType */
@@ -73,6 +79,7 @@ console_tbl     Console_Configuration_Ports[] = {
     0X0,                                   /* ulClock */
     0x0                                     /* ulIntVector -- base for port */
   },
+#endif
   {
     "/dev/com1",                           /* sDeviceName */
     SERIAL_NS16550,                        /* deviceType */
diff --git a/c/src/lib/libbsp/i386/pc386/console/console_control.c b/c/src/lib/libbsp/i386/pc386/console/console_control.c
index 4bdae45..e0201de 100644
--- a/c/src/lib/libbsp/i386/pc386/console/console_control.c
+++ b/c/src/lib/libbsp/i386/pc386/console/console_control.c
@@ -26,7 +26,9 @@
 #include <rtems/termiostypes.h>
 #include <libchip/serial.h>
 #include <rtems/mouse_parser.h>
+#if BSP_ENABLE_VGA
 #include "keyboard.h"
+#endif
 #include "../../../shared/console_private.h"
 
 /*
@@ -40,6 +42,7 @@ rtems_device_driver console_control(
   void                    * arg
 )
 {
+#if BSP_ENABLE_VGA
   rtems_libio_ioctl_args_t *args = arg;
 
   switch (args->command) {
@@ -60,4 +63,7 @@ rtems_device_driver console_control(
  
   args->ioctl_return = 0;
   return RTEMS_SUCCESSFUL;
+#else
+  return rtems_termios_ioctl (arg);
+#endif
 }
diff --git a/c/src/lib/libbsp/i386/pc386/console/printk_support.c b/c/src/lib/libbsp/i386/pc386/console/printk_support.c
index 371c720..b34e3e9 100644
--- a/c/src/lib/libbsp/i386/pc386/console/printk_support.c
+++ b/c/src/lib/libbsp/i386/pc386/console/printk_support.c
@@ -19,7 +19,9 @@
 
 #include <rtems.h>
 #include <rtems/bspIo.h>
-#include <rtems/keyboard.h>
+#if BSP_ENABLE_VGA
+  #include <rtems/keyboard.h>
+#endif
 #include <bsp.h>
 #include <libchip/serial.h>
 #include <libchip/ns16550.h>
@@ -36,27 +38,32 @@ int BSP_inch(void);
 
 void BSP_outch(char ch)
 {
-  if ( BSPPrintkPort == BSP_CONSOLE_VGA ) {
-    _IBMPC_outch( ch );
-  } else {
-    console_tbl *cptr;
+  #if BSP_ENABLE_VGA
+    if ( BSPPrintkPort == BSP_CONSOLE_VGA ) {
+      _IBMPC_outch( ch );
+      return;
+    }
+  #endif
+  console_tbl *cptr;
 
-    cptr = &Console_Configuration_Ports[BSPPrintkPort];
-    cptr->pDeviceFns->deviceWritePolled( BSPPrintkPort, ch );
-  }
+  cptr = &Console_Configuration_Ports[BSPPrintkPort];
+  cptr->pDeviceFns->deviceWritePolled( BSPPrintkPort, ch );
 }
 
 int BSP_inch(void) 
 {
   int           result;
 
-  if ( BSPPrintkPort == BSP_CONSOLE_VGA ) {
-    result = BSP_wait_polled_input();
-  } else {
-    do {
-      result = ns16550_inbyte_nonblocking_polled( BSPPrintkPort );
-    } while (result == -1);
-  }
+  #if BSP_ENABLE_VGA
+    if ( BSPPrintkPort == BSP_CONSOLE_VGA ) {
+      result = BSP_wait_polled_input();
+    } else
+  #endif
+    {
+      do {
+        result = ns16550_inbyte_nonblocking_polled( BSPPrintkPort );
+      } while (result == -1);
+    }
   return result;
 }
 
diff --git a/c/src/lib/libbsp/i386/pc386/preinstall.am b/c/src/lib/libbsp/i386/pc386/preinstall.am
index 0691429..d20cb77 100644
--- a/c/src/lib/libbsp/i386/pc386/preinstall.am
+++ b/c/src/lib/libbsp/i386/pc386/preinstall.am
@@ -123,6 +123,7 @@ $(PROJECT_INCLUDE)/rtems/$(dirstamp):
 	@: > $(PROJECT_INCLUDE)/rtems/$(dirstamp)
 PREINSTALL_DIRS += $(PROJECT_INCLUDE)/rtems/$(dirstamp)
 
+if RTEMS_VGA
 $(PROJECT_INCLUDE)/rtems/keyboard.h: console/keyboard.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
 	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/keyboard.h
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/keyboard.h
@@ -143,10 +144,6 @@ $(PROJECT_INCLUDE)/rtems/vgacons.h: console/vgacons.h $(PROJECT_INCLUDE)/rtems/$
 	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/vgacons.h
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/vgacons.h
 
-$(PROJECT_INCLUDE)/i386_io.h: ../../i386/shared/comm/i386_io.h $(PROJECT_INCLUDE)/$(dirstamp)
-	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/i386_io.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/i386_io.h
-
 if USE_VBE_RM
 $(PROJECT_INCLUDE)/bsp/vbe3.h: include/vbe3.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
 	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/vbe3.h
@@ -162,6 +159,11 @@ PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/fb_vesa.h
 
 else
 endif
+endif
+$(PROJECT_INCLUDE)/i386_io.h: ../../i386/shared/comm/i386_io.h $(PROJECT_INCLUDE)/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/i386_io.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/i386_io.h
+
 $(PROJECT_INCLUDE)/pcibios.h: ../../i386/shared/pci/pcibios.h $(PROJECT_INCLUDE)/$(dirstamp)
 	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/pcibios.h
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/pcibios.h
diff --git a/c/src/lib/libbsp/i386/pc386/start/start.S b/c/src/lib/libbsp/i386/pc386/start/start.S
index 48fe30b..51cd471 100644
--- a/c/src/lib/libbsp/i386/pc386/start/start.S
+++ b/c/src/lib/libbsp/i386/pc386/start/start.S
@@ -198,6 +198,7 @@ SYM (zero_bss):
 	repne				# while ecx != 0
 	stosl				#   clear a long in the bss
 
+#if BSP_ENABLE_VGA
 /*-------------------------------------------------------------------+
 | Initialize the video because zero_bss has cleared initVideo parameters
 | if it was called earlier
@@ -208,6 +209,7 @@ SYM (zero_bss):
 #if USE_VBE_RM
         call    vesa_realmode_bootup_init
 #endif
+#endif
 
 /*---------------------------------------------------------------------+
 | Check CPU type. Enable Cache and init coprocessor if needed.



More information about the vc mailing list