[rtems commit] pc386: Add --disable-com1-com4 boot argument
Joel Sherrill
joel at rtems.org
Thu Mar 10 16:45:12 UTC 2016
Module: rtems
Branch: master
Commit: 22bbb9f16589322fb979bacc79f50b02ef34f57a
Changeset: http://git.rtems.org/rtems/commit/?id=22bbb9f16589322fb979bacc79f50b02ef34f57a
Author: Joel Sherrill <joel at rtems.org>
Date: Wed Mar 9 12:48:39 2016 -0600
pc386: Add --disable-com1-com4 boot argument
---
c/src/lib/libbsp/i386/pc386/console/conscfg.c | 29 +++++++++--------
.../lib/libbsp/i386/pc386/console/console_select.c | 37 ++++++++++++++++++++++
c/src/lib/libbsp/shared/console.c | 4 +--
3 files changed, 54 insertions(+), 16 deletions(-)
diff --git a/c/src/lib/libbsp/i386/pc386/console/conscfg.c b/c/src/lib/libbsp/i386/pc386/console/conscfg.c
index d5586d7..e59498b 100644
--- a/c/src/lib/libbsp/i386/pc386/console/conscfg.c
+++ b/c/src/lib/libbsp/i386/pc386/console/conscfg.c
@@ -1,11 +1,13 @@
-/*
- * This file contains the libchip configuration information
- * to instantiate the libchip driver for the VGA console
- * and serial ports on a PC.
+/**
+ * @file
+ *
+ * This file contains the libchip configuration information
+ * to instantiate the libchip driver for the VGA console
+ * and serial ports on a PC.
*/
/*
- * COPYRIGHT (c) 1989-2014.
+ * COPYRIGHT (c) 1989-2014, 2016.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -13,8 +15,6 @@
* http://www.rtems.org/license/LICENSE.
*/
-#include <unistd.h> /* write */
-
#include <bsp.h>
#include <libchip/serial.h>
#include <libchip/ns16550.h>
@@ -23,7 +23,6 @@
#endif
#include <bsp/irq.h>
#include <rtems/pci.h>
-#include <bsp/rtd316.h>
#if BSP_ENABLE_VGA
#define VGA_CONSOLE_FUNCTIONS &vgacons_fns
@@ -49,7 +48,7 @@
static uint8_t com_get_register(uint32_t addr, uint8_t i)
{
register uint8_t val;
-
+
inport_byte( (addr + i),val );
return val;
}
@@ -58,6 +57,8 @@
{
outport_byte( (addr + i),val );
}
+
+ extern bool pc386_com1_com4_enabled(int);
#endif
#if (BSP_IS_EDISON == 1 )
@@ -68,7 +69,7 @@ console_tbl Console_Configuration_Ports[] = {
#if (BSP_IS_EDISON == 1)
{
"/dev/vgacons", /* sDeviceName */
- -1, /* deviceType */
+ -1, /* deviceType */
&edison_fns, /* pDeviceFns */
NULL, /* deviceProbe */
NULL, /* pDeviceFlow */
@@ -112,7 +113,7 @@ console_tbl Console_Configuration_Ports[] = {
"/dev/com1", /* sDeviceName */
SERIAL_NS16550, /* deviceType */
COM_CONSOLE_FUNCTIONS, /* pDeviceFns */
- NULL, /* deviceProbe, assume it is there */
+ pc386_com1_com4_enabled, /* deviceProbe */
NULL, /* pDeviceFlow */
16, /* ulMargin */
8, /* ulHysteresis */
@@ -131,7 +132,7 @@ console_tbl Console_Configuration_Ports[] = {
"/dev/com2", /* sDeviceName */
SERIAL_NS16550, /* deviceType */
COM_CONSOLE_FUNCTIONS, /* pDeviceFns */
- NULL, /* deviceProbe, assume it is there */
+ pc386_com1_com4_enabled, /* deviceProbe */
NULL, /* pDeviceFlow */
16, /* ulMargin */
8, /* ulHysteresis */
@@ -151,7 +152,7 @@ console_tbl Console_Configuration_Ports[] = {
"/dev/com3", /* sDeviceName */
SERIAL_NS16550, /* deviceType */
COM_CONSOLE_FUNCTIONS, /* pDeviceFns */
- NULL, /* deviceProbe, assume it is there */
+ pc386_com1_com4_enabled, /* deviceProbe */
NULL, /* pDeviceFlow */
16, /* ulMargin */
8, /* ulHysteresis */
@@ -171,7 +172,7 @@ console_tbl Console_Configuration_Ports[] = {
"/dev/com4", /* sDeviceName */
SERIAL_NS16550, /* deviceType */
COM_CONSOLE_FUNCTIONS, /* pDeviceFns */
- NULL, /* deviceProbe, assume it is there */
+ pc386_com1_com4_enabled, /* deviceProbe */
NULL, /* pDeviceFlow */
16, /* ulMargin */
8, /* ulHysteresis */
diff --git a/c/src/lib/libbsp/i386/pc386/console/console_select.c b/c/src/lib/libbsp/i386/pc386/console/console_select.c
index c78b4b8..1d938a1 100644
--- a/c/src/lib/libbsp/i386/pc386/console/console_select.c
+++ b/c/src/lib/libbsp/i386/pc386/console/console_select.c
@@ -32,6 +32,22 @@
#endif
/*
+ * Forward prototype
+ */
+extern bool pc386_com1_com4_enabled(int);
+
+/*
+ * This method is used to determine if COM1-COM4 are enabled based upon
+ * boot command line arguments.
+ */
+static bool are_com1_com4_enabled;
+
+bool pc386_com1_com4_enabled(int minor)
+{
+ return are_com1_com4_enabled;
+}
+
+/*
* Method to return true if the device associated with the
* minor number probs available.
*/
@@ -103,6 +119,22 @@ static bool bsp_find_console_entry(
return false;
}
+static void parse_com1_com4_enable(void)
+{
+ static const char *opt;
+
+ /*
+ * Check the command line to see if com1-com4 are disabled.
+ */
+ opt = bsp_cmdline_arg("--disable-com1-com4");
+ if ( opt ) {
+ printk( "Disable COM1-COM4 per boot argument\n" );
+ are_com1_com4_enabled = false;
+ } else {
+ are_com1_com4_enabled = true;
+ }
+}
+
static bool parse_printk_or_console(
const char *param,
rtems_device_minor_number *minor_out
@@ -198,6 +230,11 @@ void pc386_parse_console_arguments(void)
console_initialize_data();
/*
+ * Determine if COM1-COM4 were disabled.
+ */
+ parse_com1_com4_enable();
+
+ /*
* Assume that if only --console is specified, that printk() should
* follow that selection by default.
*/
diff --git a/c/src/lib/libbsp/shared/console.c b/c/src/lib/libbsp/shared/console.c
index d030065..d226172 100644
--- a/c/src/lib/libbsp/shared/console.c
+++ b/c/src/lib/libbsp/shared/console.c
@@ -117,12 +117,12 @@ void console_register_devices(
*/
Console_Port_Data = realloc(
Console_Port_Data,
- Console_Port_Count * sizeof(console_tbl *)
+ Console_Port_Count * sizeof(console_data)
);
if ( Console_Port_Data == NULL ) {
bsp_fatal( BSP_FATAL_CONSOLE_NO_MEMORY_2 );
}
- memset(&Console_Port_Data, '\0', Console_Port_Count * sizeof(console_tbl *));
+ memset(Console_Port_Data, '\0', Console_Port_Count * sizeof(console_data));
/*
* Now add the new devices at the end.
More information about the vc
mailing list