forked from Imagelibrary/rtems
pc386: Add --disable-com1-com4 boot argument
This commit is contained in:
@@ -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 */
|
||||
|
||||
@@ -31,6 +31,22 @@
|
||||
#include <crt.h>
|
||||
#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
|
||||
@@ -197,6 +229,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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user