Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/hpcmips Add platid_name() which retrieves the platf...



details:   https://anonhg.NetBSD.org/src/rev/5ed091fcbd21
branches:  trunk
changeset: 481796:5ed091fcbd21
user:      takemura <takemura%NetBSD.org@localhost>
date:      Sun Feb 06 08:47:03 2000 +0000

description:
Add platid_name() which retrieves the platform name.

diffstat:

 sys/arch/hpcmips/conf/files.hpcmips              |    3 +-
 sys/arch/hpcmips/hpcmips/Makefile                |   22 +-
 sys/arch/hpcmips/hpcmips/platid.c                |   23 +-
 sys/arch/hpcmips/hpcmips/platid.def              |   36 +-
 sys/arch/hpcmips/hpcmips/platid_copyright.awk    |    5 +-
 sys/arch/hpcmips/hpcmips/platid_gen/Makefile     |   35 +
 sys/arch/hpcmips/hpcmips/platid_gen/gram.y       |  216 ++++++++++
 sys/arch/hpcmips/hpcmips/platid_gen/platid_gen.c |  463 +++++++++++++++++++++++
 sys/arch/hpcmips/hpcmips/platid_gen/platid_gen.h |   49 ++
 sys/arch/hpcmips/hpcmips/platid_gen/scan.l       |  111 +++++
 sys/arch/hpcmips/hpcmips/platid_mask.c           |    7 +-
 sys/arch/hpcmips/hpcmips/platid_name.c           |  238 +++++++++++
 sys/arch/hpcmips/include/platid.h                |   10 +-
 sys/arch/hpcmips/include/platid_generated.h      |    8 +-
 sys/arch/hpcmips/include/platid_mask.h           |    6 +-
 sys/arch/hpcmips/stand/pbsdboot/pbsdboot.config  |    3 +-
 sys/arch/hpcmips/stand/pbsdboot/pbsdboot.dsp     |    4 +
 sys/arch/hpcmips/stand/pbsdboot/platid_name.c    |    1 +
 18 files changed, 1189 insertions(+), 51 deletions(-)

diffs (truncated from 1452 to 300 lines):

diff -r 00e6a1562b65 -r 5ed091fcbd21 sys/arch/hpcmips/conf/files.hpcmips
--- a/sys/arch/hpcmips/conf/files.hpcmips       Sun Feb 06 08:14:13 2000 +0000
+++ b/sys/arch/hpcmips/conf/files.hpcmips       Sun Feb 06 08:47:03 2000 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.hpcmips,v 1.20 2000/01/28 15:08:37 takemura Exp $
+#      $NetBSD: files.hpcmips,v 1.21 2000/02/06 08:47:03 takemura Exp $
 
 # maxpartitions must be first item in files.${ARCH}.
 maxpartitions 8
@@ -49,6 +49,7 @@
 file   arch/hpcmips/hpcmips/machdep.c
 file   arch/hpcmips/hpcmips/platid.c
 file   arch/hpcmips/hpcmips/platid_mask.c
+file   arch/hpcmips/hpcmips/platid_name.c
 file   arch/hpcmips/hpcmips/mainbus.c
 file   arch/hpcmips/hpcmips/bus_space.c
 #file  arch/hpcmips/hpcmips/bus_dma.c
diff -r 00e6a1562b65 -r 5ed091fcbd21 sys/arch/hpcmips/hpcmips/Makefile
--- a/sys/arch/hpcmips/hpcmips/Makefile Sun Feb 06 08:14:13 2000 +0000
+++ b/sys/arch/hpcmips/hpcmips/Makefile Sun Feb 06 08:47:03 2000 +0000
@@ -1,22 +1,9 @@
-#      $NetBSD: Makefile,v 1.2 1999/11/30 15:11:00 uch Exp $
+#      $NetBSD: Makefile,v 1.3 2000/02/06 08:47:05 takemura Exp $
 
-HDR=../include/platid_generated.h
-MASK_HDR=../include/platid_mask.h
-GENERATEDS=${HDR} ${MASK_HDR} platid_mask.c
+SUBDIR=        platid_gen
 
 HOST_CC ?= /usr/bin/cc
 
-all: $(GENERATEDS)
-
-$(GENERATEDS): platid.def platid.awk
-       awk -f platid_copyright.awk  platid.def > ${HDR}
-       awk -f platid_copyright.awk  platid.def > ${MASK_HDR}
-       awk -f platid_copyright.awk  platid.def > platid_mask.c
-       cat platid.def | \
-        sed -e 's!\([{}:=?]\)! \1 !g' -e 's|\*/| */ |' -e 's|/\*| /* |' | \
-        tr ' \t' '\n\n' | \
-        awk -f platid.awk -v out_h=${HDR} -v out_mask_h=${MASK_HDR}
-
 test: platid_test
        ./platid_test > platid_test.out
        diff  platid_test.out  platid_test.canon
@@ -26,5 +13,6 @@
        ln -sf ../../mips/include ./mips
        $(HOST_CC) -I. -DPLATID_TEST platid.c platid_mask.c platid_test.c -o $@
 
-clean::
-       rm -rf platid_test platid_test.out $(GENERATEDS) machine mips
+CLEANFILES+=   platid_test platid_test.out machine mips
+
+.include <bsd.subdir.mk>
diff -r 00e6a1562b65 -r 5ed091fcbd21 sys/arch/hpcmips/hpcmips/platid.c
--- a/sys/arch/hpcmips/hpcmips/platid.c Sun Feb 06 08:14:13 2000 +0000
+++ b/sys/arch/hpcmips/hpcmips/platid.c Sun Feb 06 08:47:03 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: platid.c,v 1.2 1999/12/23 06:26:09 takemura Exp $      */
+/*     $NetBSD: platid.c,v 1.3 2000/02/06 08:47:05 takemura Exp $      */
 
 /*-
  * Copyright (c) 1999
@@ -107,3 +107,24 @@
 
 #undef PLATID_MATCH
 }
+
+char*
+platid_name(platid_t *platid)
+{
+       int match_level;
+       struct platid_name *p, *match, *pe;
+
+       match_level = 0;
+       pe = &platid_name_table[platid_name_table_size];
+       for (p = platid_name_table; p < pe; p++) {
+               int res = platid_match(platid, p->mask);
+               if (match_level < res) {
+                       match = p;
+                       match_level = res;
+               }
+       }
+       if (0 < match_level)
+               return (match->name);
+       else
+               return ("UNKNOWN");
+}
diff -r 00e6a1562b65 -r 5ed091fcbd21 sys/arch/hpcmips/hpcmips/platid.def
--- a/sys/arch/hpcmips/hpcmips/platid.def       Sun Feb 06 08:14:13 2000 +0000
+++ b/sys/arch/hpcmips/hpcmips/platid.def       Sun Feb 06 08:47:03 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: platid.def,v 1.14 2000/01/28 06:21:49 shin Exp $       */
+/*     $NetBSD: platid.def,v 1.15 2000/02/06 08:47:05 takemura Exp $   */
 
 /*-
  * Copyright (c) 1999
@@ -63,26 +63,26 @@
 MACHINE:
 
 NEC {
-  MCCS {
-    1X {
-      CPU=MIPS_VR_4102 11 12 13
+  MCCS " MC-CS" {
+    1X " series" {
+      CPU=MIPS_VR_4102 11 -"11" 12 -"12" 13 -"13"
     }
   }
-  MCR {
+  MCR " MC-R" {
     CPU=MIPS_VR_41XX
-    3XX {
-      CPU=MIPS_VR_4111 300
-      CPU=MIPS_VR_4121 320
-      CPU=MIPS_VR_4111 forDoCoMo
+    3XX "300 series" {
+      CPU=MIPS_VR_4111 300 -"300"
+      CPU=MIPS_VR_4121 320 -"320"
+      CPU=MIPS_VR_4111 forDoCoMo --" MobileGearII for DoCoMo"
     }
-    5XX {
-      CPU=MIPS_VR_4111 500
-      CPU=MIPS_VR_4121 510 520 520A
-      CPU=MIPS_VR_4111 500A
-      CPU=MIPS_VR_4121 530 430
+    5XX "500 series" {
+      CPU=MIPS_VR_4111 500 -"500"
+      CPU=MIPS_VR_4121 510 -"510" 520 -"520" 520A --" MobilePro 770"
+      CPU=MIPS_VR_4111 500A --" MobilePro 750c"
+      CPU=MIPS_VR_4121 530 -"530" 430 -"430"
     }
-    7XX {
-      CPU=MIPS_VR_4121 700 700A 730
+    7XX "700 series" {
+      CPU=MIPS_VR_4121 700 -"700" 700A --" MobilePro 800" 730 -"730"
     }
   }
 }
@@ -98,7 +98,7 @@
 }
 
 CASIO {
-  CassiopeiaE {
+  CassiopeiaE " Cassiopeia" {
     EXX {
       CPU=MIPS_VR_4111 E10 E11 E15 E55
     }
@@ -177,7 +177,7 @@
 IBM {
   WorkPad {
     z50 {
-      CPU=MIPS_VR_4121 2601_1AU
+      CPU=MIPS_VR_4121 z5026011AU -" z50 2601 1AU"
     }
   }
 }
diff -r 00e6a1562b65 -r 5ed091fcbd21 sys/arch/hpcmips/hpcmips/platid_copyright.awk
--- a/sys/arch/hpcmips/hpcmips/platid_copyright.awk     Sun Feb 06 08:14:13 2000 +0000
+++ b/sys/arch/hpcmips/hpcmips/platid_copyright.awk     Sun Feb 06 08:47:03 2000 +0000
@@ -1,4 +1,4 @@
-#  $NetBSD: platid_copyright.awk,v 1.1.1.1 1999/09/16 12:23:21 takemura Exp $
+#  $NetBSD: platid_copyright.awk,v 1.2 2000/02/06 08:47:06 takemura Exp $
 #
 #  Copyright (c) 1999
 #         Shin Takemura and PocketBSD Project. All rights reserved.
@@ -35,7 +35,8 @@
 # 
 BEGIN{
   words = ""
-  printf("/* $Id: platid_copyright.awk,v 1.1.1.1 1999/09/16 12:23:21 takemura Exp $ */\n\n")
+  printf("/* $Id")
+  printf(": $ */\n\n")
 }
 /\/\*/,/\*\//{
   words=sprintf("%s%s\n", words, $0)
diff -r 00e6a1562b65 -r 5ed091fcbd21 sys/arch/hpcmips/hpcmips/platid_gen/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/hpcmips/hpcmips/platid_gen/Makefile      Sun Feb 06 08:47:03 2000 +0000
@@ -0,0 +1,35 @@
+#      $NetBSD: Makefile,v 1.1 2000/02/06 08:47:11 takemura Exp $
+
+GENHDR=        ../../include/platid_generated.h
+MASK_H=        ../../include/platid_mask.h
+MASK_C=        ../platid_mask.c
+NAME_C=        ../platid_name.c
+GENERATEDS=    ${GENHDR} ${MASK_H} ${MASK_C} ${NAME_C}
+
+PROG=  platid_gen
+BINDIR=        /usr/sbin
+SRCS=  platid_gen.c gram.y scan.l
+
+YFLAGS=
+YHEADER=1
+CPPFLAGS+=-I${.CURDIR} -I.
+CLEANFILES+=gram.h
+LEX=flex
+MAN=
+
+all: $(GENERATEDS)
+
+${GENHDR}: ${PROG} ../platid.def
+       awk -f ../platid_copyright.awk ../platid.def > ${.TARGET}
+       ./${PROG} -header < ../platid.def >> ${GENHDR}
+${MASK_H}: ${PROG} ../platid.def
+       awk -f ../platid_copyright.awk ../platid.def > ${.TARGET}
+       ./${PROG} -mask_h < ../platid.def >> ${MASK_H}
+${MASK_C}: ${PROG} ../platid.def
+       awk -f ../platid_copyright.awk ../platid.def > ${.TARGET}
+       ./${PROG} -mask_c < ../platid.def >> ${MASK_C}
+${NAME_C}: ${PROG} ../platid.def
+       awk -f ../platid_copyright.awk ../platid.def > ${.TARGET}
+       ./${PROG} -name_c < ../platid.def >> ${NAME_C}
+
+.include <bsd.prog.mk>
diff -r 00e6a1562b65 -r 5ed091fcbd21 sys/arch/hpcmips/hpcmips/platid_gen/gram.y
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/hpcmips/hpcmips/platid_gen/gram.y        Sun Feb 06 08:47:03 2000 +0000
@@ -0,0 +1,216 @@
+%{
+/*     $NetBSD: gram.y,v 1.1 2000/02/06 08:47:12 takemura Exp $        */
+
+/*-
+ * Copyright (c) 1999
+ *         Shin Takemura and PocketBSD Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the PocketBSD project
+ *     and its contributors.
+ * 4. Neither the name of the project nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#include <stdio.h>
+#include <strings.h>
+
+#include "platid_gen.h"
+
+#define LIST_NEW(l)    { \
+       (l) = new_node(LIST, 0, NULL, NULL, NULL); \
+}
+#define LIST_ADD(l, i) { \
+       if ((l)->ptr1 == NULL) { \
+               (l)->ptr1 = (i); \
+               (l)->ptr2 = (i); \
+       } else { \
+               ((node_t*)(l)->ptr2)->link = (i); \
+               (l)->ptr2 = (i); \
+       } \
+       (i)->link = NULL; \
+       (l)->val++; \
+}
+
+%}
+
+%union {
+       struct node_s *node;
+       const char *str;
+       int     val;
+}
+
+%token '{' '}' '=' ':'
+%token <str>FSYM
+%token <str>SYM
+%token <str>MOD
+%token <str>NAME
+
+%type <str>sym
+%type <val>name_prefix
+%type <node>name_opt
+%type <node>ent
+%type <node>sub_list
+%type <node>sub_item
+%type <node>list
+%type <node>item
+
+%%



Home | Main Index | Thread Index | Old Index