Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/hpc when bootinfo has no framebuffer information, do...



details:   https://anonhg.NetBSD.org/src/rev/828a40be2f56
branches:  trunk
changeset: 520080:828a40be2f56
user:      uch <uch%NetBSD.org@localhost>
date:      Wed Jan 02 12:57:49 2002 +0000

description:
when bootinfo has no framebuffer information, don't attach bicons.

diffstat:

 sys/dev/hpc/bicons.c    |  34 ++++++++++++++++++++++------------
 sys/dev/hpc/bicons.h    |   4 ++--
 sys/dev/hpc/biconsdev.c |  12 ++++--------
 3 files changed, 28 insertions(+), 22 deletions(-)

diffs (160 lines):

diff -r dc250abcf4bc -r 828a40be2f56 sys/dev/hpc/bicons.c
--- a/sys/dev/hpc/bicons.c      Wed Jan 02 12:49:43 2002 +0000
+++ b/sys/dev/hpc/bicons.c      Wed Jan 02 12:57:49 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bicons.c,v 1.4 2001/11/13 12:47:56 lukem Exp $ */
+/*     $NetBSD: bicons.c,v 1.5 2002/01/02 12:57:49 uch Exp $   */
 
 /*-
  * Copyright (c) 1999-2001
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bicons.c,v 1.4 2001/11/13 12:47:56 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bicons.c,v 1.5 2002/01/02 12:57:49 uch Exp $");
 
 #define HALF_FONT
 
@@ -69,7 +69,7 @@
 static void put_oxel_D16_0000(u_int8_t *, u_int8_t, u_int8_t);
 static void put_oxel_D16_FFFF(u_int8_t *, u_int8_t, u_int8_t);
 
-struct {
+static const struct {
        int type;
        char *name;
        void (*func)(u_int8_t *, u_int8_t, u_int8_t);
@@ -101,7 +101,7 @@
        { BIFB_D16_FFFF,        BIFBN_D16_FFFF,
          put_oxel_D16_FFFF,    0x00,   16      },
 };
-#define FB_TABLE_SIZE (sizeof(fb_table)/sizeof(*fb_table))
+#define FB_TABLE_SIZE (sizeof(fb_table) / sizeof(*fb_table))
 
 static u_int8_t        *fb_vram;
 static int16_t fb_line_bytes;
@@ -124,7 +124,7 @@
 cdev_decl(biconsdev);
 
 static int bicons_priority;
-void biconscninit(struct consdev *);
+int biconscninit(struct consdev *);
 void biconscnprobe(struct consdev *);
 void biconscnputc(dev_t, int);
 int biconscngetc(dev_t);       /* harmless place holder */
@@ -135,27 +135,35 @@
 static void bicons_puts(char *);
 static void bicons_printf(const char *, ...) __attribute__((__unused__));
 
-void
+int
 bicons_init(struct consdev *cndev)
 {
-       biconscninit(cndev);
+
+       if (biconscninit(cndev) != 0)
+               return (1);
+
        biconscnprobe(cndev);
+
+       return (0);     /* success */
 }
 
-void
+int
 biconscninit(struct consdev *cndev)
 {
        int fb_index = -1; 
 
+       if (bootinfo->fb_addr == 0) {
+               /* Bootinfo don't have frame buffer address */
+               return (1);
+       }
+
        for (fb_index = 0; fb_index < FB_TABLE_SIZE; fb_index++)
                if (fb_table[fb_index].type == bootinfo->fb_type)
                        break;
 
        if (FB_TABLE_SIZE <= fb_index || fb_index == -1) {
-               /*
-                *  Unknown frame buffer type, but what can I do ?
-                */
-               fb_index = 0;
+               /* Unknown frame buffer type, don't enable bicons. */
+               return (1);
        }
 
        fb_vram = (u_int8_t *)bootinfo->fb_addr;
@@ -177,6 +185,8 @@
        bicons_puts("builtin console type = ");
        bicons_puts(fb_table[fb_index].name);
        bicons_puts("\n");
+
+       return (0);
 }
 
 void
diff -r dc250abcf4bc -r 828a40be2f56 sys/dev/hpc/bicons.h
--- a/sys/dev/hpc/bicons.h      Wed Jan 02 12:49:43 2002 +0000
+++ b/sys/dev/hpc/bicons.h      Wed Jan 02 12:57:49 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bicons.h,v 1.2 2001/02/09 20:42:27 uch Exp $   */
+/*     $NetBSD: bicons.h,v 1.3 2002/01/02 12:57:49 uch Exp $   */
 
 /*-
  * Copyright (c) 1999-2001
@@ -34,6 +34,6 @@
  *
  */
 
-void bicons_init(struct consdev *);
+int bicons_init(struct consdev *);
 void bicons_set_priority(int);
 void bicons_putn(const char *, int);
diff -r dc250abcf4bc -r 828a40be2f56 sys/dev/hpc/biconsdev.c
--- a/sys/dev/hpc/biconsdev.c   Wed Jan 02 12:49:43 2002 +0000
+++ b/sys/dev/hpc/biconsdev.c   Wed Jan 02 12:57:49 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: biconsdev.c,v 1.3 2001/11/13 12:47:56 lukem Exp $      */
+/*     $NetBSD: biconsdev.c,v 1.4 2002/01/02 12:57:49 uch Exp $        */
 
 /*-
  * Copyright (c) 1999-2001
@@ -71,11 +71,9 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: biconsdev.c,v 1.3 2001/11/13 12:47:56 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: biconsdev.c,v 1.4 2002/01/02 12:57:49 uch Exp $");
 
 #include "biconsdev.h"
-#if NBICONSDEV > 0
-
 #include <sys/param.h>
 #include <sys/proc.h>
 #include <sys/systm.h>
@@ -99,7 +97,7 @@
 {
        struct tty *tp = &biconsdev_tty[0];
        int maj;
-       
+
        /* locate the major number */
        for (maj = 0; maj < nchrdev; maj++)
                if (cdevsw[maj].d_open == biconsdevopen)
@@ -219,7 +217,7 @@
 biconsdevpoll(dev_t dev, int events, struct proc *p)
 {
        struct tty *tp = &biconsdev_tty[0];
- 
+
        return ((*tp->t_linesw->l_poll)(tp, events, p));
 }
 
@@ -250,5 +248,3 @@
 {
 
 }
-
-#endif /* NBICONSDEV > 0 */



Home | Main Index | Thread Index | Old Index