Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/alpha/tc In tc_fb_cnattach(): match from a table, a...



details:   https://anonhg.NetBSD.org/src/rev/caccb4689f7d
branches:  trunk
changeset: 501022:caccb4689f7d
user:      ad <ad%NetBSD.org@localhost>
date:      Fri Dec 22 13:33:57 2000 +0000

description:
In tc_fb_cnattach(): match from a table, and add #ifdef'ed out glue for the
px/pxg devices.

diffstat:

 sys/arch/alpha/tc/tcasic.c |  66 ++++++++++++++++++++++++++++++++-------------
 1 files changed, 46 insertions(+), 20 deletions(-)

diffs (98 lines):

diff -r 882ca341e8de -r caccb4689f7d sys/arch/alpha/tc/tcasic.c
--- a/sys/arch/alpha/tc/tcasic.c        Fri Dec 22 13:30:32 2000 +0000
+++ b/sys/arch/alpha/tc/tcasic.c        Fri Dec 22 13:33:57 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tcasic.c,v 1.30 2000/06/05 21:47:32 thorpej Exp $ */
+/* $NetBSD: tcasic.c,v 1.31 2000/12/22 13:33:57 ad Exp $ */
 
 /*
  * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@@ -32,7 +32,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: tcasic.c,v 1.30 2000/06/05 21:47:32 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcasic.c,v 1.31 2000/12/22 13:33:57 ad Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -173,11 +173,41 @@
 
 #include "cfb.h"
 #include "sfb.h"
+#ifdef notyet
+#include "px.h"
+#include "pxg.h"
+#endif
 
-extern int     sfb_cnattach __P((tc_addr_t));
-extern int     cfb_cnattach __P((tc_addr_t));
+extern void    sfb_cnattach __P((tc_addr_t));
+extern void    cfb_cnattach __P((tc_addr_t));
+extern void    px_cnattach __P((tc_addr_t));
+extern void    pxg_cnattach __P((tc_addr_t));
 extern int     tc_checkslot __P((tc_addr_t, char *));
 
+struct cnboards {
+       const char      *cb_tcname;
+       int     (*cb_cnattach)(tc_addr_t);
+} static cnboards[] = {
+#if NSFB > 0
+       { "PMAGB-BA", sfb_cnattach },
+#endif
+#if NCFB > 0
+       { "PMAG-BA ", cfb_cnattach },
+#endif
+#ifdef notyet
+#if NPX > 0
+       { "PMAG-CA ", px_cnattach },
+#endif
+#if NPXG > 0
+       { "PMAG-DA ", pxg_cnattach },
+       { "PMAG-FA ", pxg_cnattach },
+       { "PMAG-FB ", pxg_cnattach },
+       { "PMAGB-FA", pxg_cnattach },
+       { "PMAGB-FB", pxg_cnattach },
+#endif
+#endif
+};
+
 /*
  * tc_fb_cnattach --
  *     Attempt to attach the appropriate display driver to the
@@ -188,23 +218,19 @@
        tc_addr_t tcaddr;
 {
        char tcname[TC_ROM_LLEN];
+       int i;
 
-       if (tc_badaddr(tcaddr) || (tc_checkslot(tcaddr, tcname) == 0)) {
-               return EINVAL;
-       }
+       if (tc_badaddr(tcaddr) || (tc_checkslot(tcaddr, tcname) == 0))
+               return (EINVAL);
 
-#if NSFB > 0
-       if (strncmp("PMAGB-BA", tcname, TC_ROM_LLEN) == 0) {
-               sfb_cnattach(tcaddr);
-               return 0;
-       }
-#endif
-#if NCFB > 0
-       if (strncmp("PMAG-BA ", tcname, TC_ROM_LLEN) == 0) {
-               cfb_cnattach(tcaddr);
-               return 0;
-       }
-#endif
-       return ENXIO;
+       for (i = 0; i < sizeof(cnboards) / sizeof(cnboards[0]); i++)
+               if (strncmp(tcname, cnboards[i].cb_tcname, TC_ROM_LLEN) == 0)
+                       break;
+
+       if (i == sizeof(cnboards) / sizeof(cnboards[0]))
+               return (ENXIO);
+
+       (cnboards[i].cb_cnattach)(tcaddr);
+       return (0);
 }
 #endif /* if NWSDISPLAY > 0 */



Home | Main Index | Thread Index | Old Index