summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/i386/pc386/console/conscfg.c
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2016-04-08 18:39:38 +1000
committerChris Johns <chrisj@rtems.org>2016-05-11 11:45:01 +1000
commit014292a164b8bb5286b6c7dae7c37a469ef6f0cc (patch)
treec7343485ef520fc71f36e5cf8271e08a2c1de789 /c/src/lib/libbsp/i386/pc386/console/conscfg.c
parentbsp/qoriq: Add portal clear functions (diff)
downloadrtems-014292a164b8bb5286b6c7dae7c37a469ef6f0cc.tar.bz2
i386/pc386: Add support for the gdb stub to use available console drivers.
Move the gdb stub from the i386 UART code to use the libchip drivers. Use any ports discovered during the probes. Add gdb control to the boot command line. Change the device naming to the full device path, not a partial path. For example /dev/com1.
Diffstat (limited to 'c/src/lib/libbsp/i386/pc386/console/conscfg.c')
-rw-r--r--c/src/lib/libbsp/i386/pc386/console/conscfg.c88
1 files changed, 56 insertions, 32 deletions
diff --git a/c/src/lib/libbsp/i386/pc386/console/conscfg.c b/c/src/lib/libbsp/i386/pc386/console/conscfg.c
index 5b7ebc5d4a..82d3cf9f98 100644
--- a/c/src/lib/libbsp/i386/pc386/console/conscfg.c
+++ b/c/src/lib/libbsp/i386/pc386/console/conscfg.c
@@ -16,13 +16,14 @@
*/
#include <bsp.h>
+#include <bsp/bspimpl.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 "../../../shared/console_private.h"
#if BSP_ENABLE_VGA
#define VGA_CONSOLE_FUNCTIONS &vgacons_fns
@@ -43,7 +44,7 @@
#define COM3_BASE_IO 0x2F8
#define COM4_BASE_IO 0x2E8
- #define CLOCK_RATE (115200 * 16)
+ #define CLOCK_RATE (115200 * 16)
static uint8_t com_get_register(uint32_t addr, uint8_t i)
{
@@ -57,21 +58,26 @@
{
outport_byte( (addr + i), val );
}
-
- extern bool pc386_com1_com4_enabled(int);
#endif
#if (BSP_IS_EDISON == 1 )
extern const console_fns edison_fns;
#endif
-console_tbl Console_Configuration_Ports[] = {
-#if (BSP_IS_EDISON == 1)
+/*
+ * Default to the PC VGA console if present and configured.
+ */
+console_tbl Console_Configuration_Ports[] = {
+#if BSP_ENABLE_VGA
+ /*
+ * If present the VGA console must always be minor 0.
+ * See console_control.
+ */
{
- "/dev/com1", /* sDeviceName */
- -1, /* deviceType */
- &edison_fns, /* pDeviceFns */
- NULL, /* deviceProbe */
+ "/dev/vgacons", /* sDeviceName */
+ VGA_CONSOLE, /* deviceType */
+ VGA_CONSOLE_FUNCTIONS, /* pDeviceFns */
+ vgacons_probe, /* deviceProbe */
NULL, /* pDeviceFlow */
16, /* ulMargin */
8, /* ulHysteresis */
@@ -83,16 +89,22 @@ console_tbl Console_Configuration_Ports[] = {
NULL, /* setRegister */
NULL,/* unused */ /* getData */
NULL,/* unused */ /* setData */
- 0X0, /* ulClock */
- 0x0 /* ulIntVector -- base for port */
+ 0x0, /* ulClock */
+ 0x0 /* ulIntVector -- base for port */
},
#endif
-#if BSP_ENABLE_VGA
+};
+
+unsigned long Console_Configuration_Count =
+ (sizeof(Console_Configuration_Ports)/sizeof(console_tbl));
+
+static console_tbl Legacy_Ports[] = {
+#if (BSP_IS_EDISON == 1)
{
- "/dev/vgacons", /* sDeviceName */
- VGA_CONSOLE, /* deviceType */
- VGA_CONSOLE_FUNCTIONS, /* pDeviceFns */
- vgacons_probe, /* deviceProbe */
+ "/dev/com1", /* sDeviceName */
+ -1, /* deviceType */
+ &edison_fns, /* pDeviceFns */
+ NULL, /* deviceProbe */
NULL, /* pDeviceFlow */
16, /* ulMargin */
8, /* ulHysteresis */
@@ -104,8 +116,8 @@ console_tbl Console_Configuration_Ports[] = {
NULL, /* setRegister */
NULL,/* unused */ /* getData */
NULL,/* unused */ /* setData */
- 0X0, /* ulClock */
- 0x0 /* ulIntVector -- base for port */
+ 0x0, /* ulClock */
+ 0x0 /* ulIntVector -- base for port */
},
#endif
#if BSP_ENABLE_COM1_COM4
@@ -113,7 +125,7 @@ console_tbl Console_Configuration_Ports[] = {
"/dev/com1", /* sDeviceName */
SERIAL_NS16550, /* deviceType */
COM_CONSOLE_FUNCTIONS, /* pDeviceFns */
- pc386_com1_com4_enabled, /* deviceProbe */
+ NULL, /* deviceProbe */
NULL, /* pDeviceFlow */
16, /* ulMargin */
8, /* ulHysteresis */
@@ -132,7 +144,7 @@ console_tbl Console_Configuration_Ports[] = {
"/dev/com2", /* sDeviceName */
SERIAL_NS16550, /* deviceType */
COM_CONSOLE_FUNCTIONS, /* pDeviceFns */
- pc386_com1_com4_enabled, /* deviceProbe */
+ NULL, /* deviceProbe */
NULL, /* pDeviceFlow */
16, /* ulMargin */
8, /* ulHysteresis */
@@ -147,12 +159,11 @@ console_tbl Console_Configuration_Ports[] = {
CLOCK_RATE, /* ulClock */
BSP_UART_COM2_IRQ /* ulIntVector -- base for port */
},
-
{
"/dev/com3", /* sDeviceName */
SERIAL_NS16550, /* deviceType */
COM_CONSOLE_FUNCTIONS, /* pDeviceFns */
- pc386_com1_com4_enabled, /* deviceProbe */
+ NULL, /* deviceProbe */
NULL, /* pDeviceFlow */
16, /* ulMargin */
8, /* ulHysteresis */
@@ -167,12 +178,11 @@ console_tbl Console_Configuration_Ports[] = {
CLOCK_RATE, /* ulClock */
BSP_UART_COM3_IRQ /* ulIntVector -- base for port */
},
-
{
"/dev/com4", /* sDeviceName */
SERIAL_NS16550, /* deviceType */
COM_CONSOLE_FUNCTIONS, /* pDeviceFns */
- pc386_com1_com4_enabled, /* deviceProbe */
+ NULL, /* deviceProbe */
NULL, /* pDeviceFlow */
16, /* ulMargin */
8, /* ulHysteresis */
@@ -188,12 +198,26 @@ console_tbl Console_Configuration_Ports[] = {
BSP_UART_COM4_IRQ /* ulIntVector -- base for port */
},
#endif
-
};
-/*
- * Define a variable that contains the number of statically configured
- * console devices.
- */
-unsigned long Console_Configuration_Count = \
- (sizeof(Console_Configuration_Ports)/sizeof(console_tbl));
+#define Legacy_Port_Count \
+ (sizeof(Legacy_Ports)/sizeof(console_tbl))
+
+void legacy_uart_probe(void)
+{
+#if BSP_ENABLE_COM1_COM4
+ const char *opt;
+ /*
+ * Check the command line to see if com1-com4 are disabled.
+ */
+ opt = bsp_cmdline_arg("--disable-com1-com4");
+ if ( opt ) {
+ printk( "COM1-COM4: disabled\n" );
+ } else {
+ if (Legacy_Port_Count) {
+ printk("Legacy UART Ports: COM1-COM4\n");
+ console_register_devices( Legacy_Ports, Legacy_Port_Count );
+ }
+ }
+#endif
+}