Console init revamp.

Console init revamp.

Post by David Woodhous » Thu, 07 Nov 2002 18:40:08



This removes all the #ifdef'd calls to initialise individual consoles in
con_init(), and replaces them with a mechanism akin to initcalls.

I've fixed all the vmlinux.lds.S files except uCLinux. Greg, how about some
appropriate #includes to reduce the duplication there?

===== drivers/char/tty_io.c 1.44 vs edited =====
--- 1.44/drivers/char/tty_io.c  Sat Oct 12 02:12:11 2002
+++ edited/drivers/char/tty_io.c        Wed Nov  6 16:18:58 2002
@@ -112,7 +112,15 @@
 #define TTY_PARANOIA_CHECK 1
 #define CHECK_TTY_COUNT 1

-struct termios tty_std_termios;                /* for the benefit of tty drivers  */
+struct termios tty_std_termios = {     /* for the benefit of tty drivers  */
+       .c_iflag = ICRNL | IXON,
+       .c_oflag = OPOST | ONLCR,
+       .c_cflag = B38400 | CS8 | CREAD | HUPCL,
+       .c_lflag = ISIG | ICANON | ECHO | ECHOE | ECHOK |
+                  ECHOCTL | ECHOKE | IEXTEN,
+       .c_cc = INIT_C_CC
+};
+
 LIST_HEAD(tty_drivers);                        /* linked list of tty drivers */
 struct tty_ldisc ldiscs[NR_LDISCS];    /* line disc dispatch table     */

@@ -140,24 +148,12 @@
              unsigned int cmd, unsigned long arg);
 static int tty_fasync(int fd, struct file * filp, int on);
 extern int vme_scc_init (void);
-extern long vme_scc_console_init(void);
 extern int serial167_init(void);
-extern long serial167_console_init(void);
-extern void console_8xx_init(void);
 extern int rs_8xx_init(void);
-extern void mac_scc_console_init(void);
-extern void hwc_console_init(void);
 extern void hwc_tty_init(void);
-extern void con3215_init(void);
 extern void tty3215_init(void);
-extern void tub3270_con_init(void);
 extern void tub3270_init(void);
-extern void uart_console_init(void);
-extern void sgi_serial_console_init(void);
-extern void sci_console_init(void);
-extern void tx3912_console_init(void);
 extern void tx3912_rs_init(void);
-extern void hvc_console_init(void);

 #ifndef MIN
 #define MIN(a,b)       ((a) < (b) ? (a) : (b))
@@ -2157,82 +2153,24 @@
  */
 void __init console_init(void)
 {
+       initcall_t *call;
+
        /* Setup the default TTY line discipline. */
-       memset(ldiscs, 0, sizeof(ldiscs));
        (void) tty_register_ldisc(N_TTY, &tty_ldisc_N_TTY);

        /*
-        * Set up the standard termios.  Individual tty drivers may
-        * deviate from this; this is used as a template.
-        */
-       memset(&tty_std_termios, 0, sizeof(struct termios));
-       memcpy(tty_std_termios.c_cc, INIT_C_CC, NCCS);
-       tty_std_termios.c_iflag = ICRNL | IXON;
-       tty_std_termios.c_oflag = OPOST | ONLCR;
-       tty_std_termios.c_cflag = B38400 | CS8 | CREAD | HUPCL;
-       tty_std_termios.c_lflag = ISIG | ICANON | ECHO | ECHOE | ECHOK |
-               ECHOCTL | ECHOKE | IEXTEN;
-
-       /*
         * set up the console device so that later boot sequences can
         * inform about problems etc..
         */
 #ifdef CONFIG_EARLY_PRINTK
        disable_early_printk();
 #endif
-#ifdef CONFIG_VT
-       con_init();
-#endif
-#ifdef CONFIG_AU1000_SERIAL_CONSOLE
-       au1000_serial_console_init();
-#endif
-#ifdef CONFIG_SERIAL_CONSOLE
-#if (defined(CONFIG_8xx) || defined(CONFIG_8260))
-       console_8xx_init();
-#elif defined(CONFIG_MAC_SERIAL)
-       mac_scc_console_init();
-#elif defined(CONFIG_PARISC)
-       pdc_console_init();
-#elif defined(CONFIG_SERIAL)
-       serial_console_init();
-#endif /* CONFIG_8xx */
-#ifdef CONFIG_SGI_SERIAL
-       sgi_serial_console_init();
-#endif
-#if defined(CONFIG_MVME162_SCC) || defined(CONFIG_BVME6000_SCC) || defined(CONFIG_MVME147_SCC)
-       vme_scc_console_init();
-#endif
-#if defined(CONFIG_SERIAL167)
-       serial167_console_init();
-#endif
-#if defined(CONFIG_SH_SCI)
-       sci_console_init();
-#endif
-#endif
-#ifdef CONFIG_TN3270_CONSOLE
-       tub3270_con_init();
-#endif
-#ifdef CONFIG_TN3215
-       con3215_init();
-#endif
-#ifdef CONFIG_HWC
-        hwc_console_init();
-#endif
-#ifdef CONFIG_STDIO_CONSOLE
-       stdio_console_init();
-#endif
-#ifdef CONFIG_SERIAL_CORE_CONSOLE
-       uart_console_init();
-#endif
-#ifdef CONFIG_ARC_CONSOLE
-       arc_console_init();
-#endif
-#ifdef CONFIG_SERIAL_TX3912_CONSOLE
-       tx3912_console_init();
-#endif
-#ifdef CONFIG_HVC_CONSOLE
-       hvc_console_init();
-#endif
+
+       call = &__con_initcall_start;
+       while (call < &__con_initcall_end) {
+               (*call)();
+               call++;
+       };
 }

 static struct tty_driver dev_tty_driver, dev_syscons_driver;
===== drivers/serial/core.c 1.17 vs edited =====
--- 1.17/drivers/serial/core.c  Sat Nov  2 16:52:24 2002
+++ edited/drivers/serial/core.c        Wed Nov  6 16:19:03 2002
@@ -1827,42 +1827,6 @@

        return 0;
 }
-
-extern void ambauart_console_init(void);
-extern void anakin_console_init(void);
-extern void clps711xuart_console_init(void);
-extern void rs285_console_init(void);
-extern void sa1100_rs_console_init(void);
-extern void serial8250_console_init(void);
-extern void uart00_console_init(void);
-
-/*
- * Central "initialise all serial consoles" container.  Needs to be killed.
- */
-void __init uart_console_init(void)
-{
-#ifdef CONFIG_SERIAL_AMBA_CONSOLE
-       ambauart_console_init();
-#endif
-#ifdef CONFIG_SERIAL_ANAKIN_CONSOLE
-       anakin_console_init();
-#endif
-#ifdef CONFIG_SERIAL_CLPS711X_CONSOLE
-       clps711xuart_console_init();
-#endif
-#ifdef CONFIG_SERIAL_21285_CONSOLE
-       rs285_console_init();
-#endif
-#ifdef CONFIG_SERIAL_SA1100_CONSOLE
-       sa1100_rs_console_init();
-#endif
-#ifdef CONFIG_SERIAL_8250_CONSOLE
-       serial8250_console_init();
-#endif
-#ifdef CONFIG_SERIAL_UART00_CONSOLE
-       uart00_console_init();
-#endif
-}
 #endif /* CONFIG_SERIAL_CORE_CONSOLE */

 #ifdef CONFIG_PM
===== drivers/char/amiserial.c 1.10 vs edited =====
--- 1.10/drivers/char/amiserial.c       Mon Jul 22 14:42:36 2002
+++ edited/drivers/char/amiserial.c     Wed Nov  6 16:18:57 2002
@@ -2322,10 +2322,11 @@
 /*
  *     Register console.
  */
-void __init serial_console_init(void)
+static void __init amiserial_console_init(void)
 {
        register_console(&sercons);
 }
+console_initcall(amiserial_console_init);
 #endif

 MODULE_LICENSE("GPL");
===== drivers/char/decserial.c 1.2 vs edited =====
--- 1.2/drivers/char/decserial.c        Tue Feb  5 07:45:05 2002
+++ edited/drivers/char/decserial.c     Wed Nov  6 16:18:57 2002
@@ -75,7 +75,7 @@
 /* serial_console_init handles the special case of starting
  *   up the console on the serial port
  */
-void __init serial_console_init(void)
+static void __init decserial_console_init(void)
 {
 #if defined(CONFIG_ZS) && defined(CONFIG_DZ)
     if (IOASIC)
@@ -94,5 +94,6 @@

 #endif
 }
+console_initcall(decserial_console_init);

 #endif
===== drivers/char/hvc_console.c 1.9 vs edited =====
--- 1.9/drivers/char/hvc_console.c      Sun Sep 15 19:35:38 2002
+++ edited/drivers/char/hvc_console.c   Wed Nov  6 16:18:57 2002
@@ -348,11 +348,12 @@
        index:          -1,
 };

-int __init hvc_console_init(void)
+static int __init hvc_console_init(void)
 {
        register_console(&hvc_con_driver);
        return 0;
 }
+console_initcall(hvc_console_init);

 module_init(hvc_init);
 module_exit(hvc_exit);
===== drivers/char/serial167.c 1.12 vs edited =====
--- 1.12/drivers/char/serial167.c       Mon Oct  7 19:39:20 2002
+++ edited/drivers/char/serial167.c     Wed Nov  6 16:18:58 2002
@@ -2836,7 +2836,7 @@
 };

-void __init serial167_console_init(void)
+static void __init serial167_console_init(void)
 {
        if (vme_brdtype == VME_TYPE_MVME166 ||
                        vme_brdtype == VME_TYPE_MVME167 ||
@@ -2845,6 +2845,7 @@
                register_console(&sercons);
        }
 }
+console_initcall(serial167_console_init);

 #ifdef CONFIG_REMOTE_DEBUG
 void putDebugChar (int c)
===== drivers/char/serial_tx3912.c 1.6 vs edited =====
--- 1.6/drivers/char/serial_tx3912.c    Tue Sep 10 10:10:44 2002
+++ edited/drivers/char/serial_tx3912.c Wed Nov  6 16:18:58 2002
@@ -1054,9 +1054,10 @@
        index:    -1
 };

-void __init tx3912_console_init(void)
+static void __init tx3912_console_init(void)
 {
        register_console(&sercons);
 }
+console_initcall(tx3912_console_init);

 #endif
===== drivers/char/sh-sci.c 1.11 vs edited =====
--- 1.11/drivers/char/sh-sci.c  Tue Oct  1 17:10:55 2002
+++ edited/drivers/char/sh-sci.c        Wed Nov  6 16:18:58 2002
@@ -1275,7 +1275,7 @@
 extern void sh_console_unregister (void);
 #endif

-void __init sci_console_init(void)
+static void __init sci_console_init(void)
 {
        register_console(&sercons);
 #ifdef CONFIG_SH_EARLY_PRINTK
@@ -1285,4 +1285,6 @@
        sh_console_unregister();
 #endif
 }
+console_initcall(sci_console_init);
+
 #endif /* CONFIG_SERIAL_CONSOLE */
===== drivers/char/vme_scc.c 1.8 vs edited =====
--- 1.8/drivers/char/vme_scc.c  Tue Oct 22 21:51:04 2002
+++ edited/drivers/char/vme_scc.c       Wed Nov  6 16:18:58 2002
@@ -1103,7 +1103,7 @@
 };

-void __init vme_scc_console_init(void)
+static void __init vme_scc_console_init(void)
 {
        if (vme_brdtype == VME_TYPE_MVME147 ||
                        vme_brdtype == VME_TYPE_MVME162 ||
@@ -1112,4 +1112,4 @@
                        vme_brdtype == VME_TYPE_BVME6000)
                register_console(&sercons);
 }
-
+console_initcall(vme_scc_console_init);
===== drivers/char/vt.c 1.20 vs edited =====
--- 1.20/drivers/char/vt.c      Tue Oct  1 17:56:05 2002
+++ edited/drivers/char/vt.c    Wed Nov  6 16:18:58 2002
@@ -2435,7 +2435,7 @@
 struct tty_driver console_driver;
 static int console_refcount;

-void __init con_init(void)
+static void __init con_init(void)
 {
        const char *display_desc = NULL;
        unsigned int currcons = 0;
@@ -2484,6 +2484,7 @@
        register_console(&vt_console_driver);
 #endif
 }
+console_initcall(con_init);

 int __init vty_init(void)
 {
===== drivers/macintosh/macserial.c 1.10 vs edited =====
--- 1.10/drivers/macintosh/macserial.c  Mon Oct  7 19:39:20 2002
+++ edited/drivers/macintosh/macserial.c        Wed Nov  6 16:18:58 2002
@@ -3088,10 +3088,12 @@
 /*
  *     Register console.
  */
-void __init mac_scc_console_init(void)
+static void __init mac_scc_console_init(void)
 {
        register_console(&sercons);
 }
+console_initcall(mac_scc_console_init);
+
 #endif /* ifdef CONFIG_SERIAL_CONSOLE */

 #ifdef CONFIG_KGDB
===== drivers/s390/char/con3215.c 1.9 vs edited =====
--- 1.9/drivers/s390/char/con3215.c     Wed Oct  9 15:01:20 2002
+++ edited/drivers/s390/char/con3215.c  Wed Nov  6 16:18:59 2002
@@ -1052,7 +1052,7 @@
  * 3215 console initialization code called from console_init().
  * NOTE: This is called before kmalloc is available.
  */
-void __init ...

read more »

 
 
 

Console init revamp.

Post by g.. » Fri, 08 Nov 2002 09:40:09


Hi David,


> This removes all the #ifdef'd calls to initialise individual consoles in
> con_init(), and replaces them with a mechanism akin to initcalls.

> I've fixed all the vmlinux.lds.S files except uCLinux. Greg, how about some
> appropriate #includes to reduce the duplication there?

That has been on my todo list for a while :-)

I should have them all cleaned up into a single vmlinux.lds.S file
by end of today or tomorrow.

Regards
Greg

------------------------------------------------------------------------

SnapGear Pty Ltd                               PHONE:    +61 7 3435 2888
825 Stanley St,                                  FAX:    +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia              WEB:   www.SnapGear.com

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

Console init revamp.

Post by David Woodhous » Fri, 08 Nov 2002 09:50:05



Quote:>  That has been on my todo list for a while :-)
> I should have them all cleaned up into a single vmlinux.lds.S file by
> end of today or tomorrow.

You know, the rest of the vmlinux.lds.S files could also do with a little
#include loving, while you're at it... :)

--
dwmw2

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

Console init revamp.

Post by g.. » Fri, 08 Nov 2002 10:00:10




>> That has been on my todo list for a while :-)
>>I should have them all cleaned up into a single vmlinux.lds.S file by
>>end of today or tomorrow.

> You know, the rest of the vmlinux.lds.S files could also do with a little
> #include loving, while you're at it... :)

Hah!  I think the 28 or so we have under the m68knommu arch
outnumbers all others in the kernel sources put together :-)

Regards
Greg

------------------------------------------------------------------------

SnapGear Pty Ltd                               PHONE:    +61 7 3435 2888
825 Stanley St,                                  FAX:    +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia              WEB:   www.SnapGear.com

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

1. communication revamp from named pipes to ...

I have an application that uses "named pipes" and creation is through
"mknod".  My question is, how can I effectively emulate this process of
communication without going into the kernel (or altering the uncompiled
source )?

I would rather use sockets and for my hook that the application will
invoke instead of the nameed pipes.  Has anyone dealt with a similar
situation, and if so I would like to speak with you via email.  Btw,
the named pipes are in "/dev/fifoa" and so on.  Thanks in advance...

Thomas

2. Problems with Adaptec AHA-2740

3. Revamped dialin server setup guide

4. Why this server so slow

5. Microsoft plans software licensing revamp

6. HP 1533 Dat Tape and dump with SunOS

7. Revamped New Zealand Government Website using Linux

8. ADSL - MS to set the standard?

9. Unable to open init. console

10. Running init not from console?

11. How can I see the init information with console redirect?

12. Running init not from console?

13. no init console / no inot found