Add platid_name() which retrieves the platform name.
This commit is contained in:
parent
dbeafc9dbe
commit
1a8f3a2b75
|
@ -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/conf.c
|
|||
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
|
||||
|
|
|
@ -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 @@ platid_test: platid.c platid_mask.c platid_test.c
|
|||
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>
|
||||
|
|
|
@ -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 @@ platid_match_sub(platid_t *platid, platid_mask_t *mask, int unknown_is_match)
|
|||
|
||||
#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");
|
||||
}
|
||||
|
|
|
@ -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 @@ MIPS {
|
|||
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 @@ Everex {
|
|||
}
|
||||
|
||||
CASIO {
|
||||
CassiopeiaE {
|
||||
CassiopeiaE " Cassiopeia" {
|
||||
EXX {
|
||||
CPU=MIPS_VR_4111 E10 E11 E15 E55
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ Victor {
|
|||
IBM {
|
||||
WorkPad {
|
||||
z50 {
|
||||
CPU=MIPS_VR_4121 2601_1AU
|
||||
CPU=MIPS_VR_4121 z5026011AU -" z50 2601 1AU"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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>
|
|
@ -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
|
||||
|
||||
%%
|
||||
|
||||
start: list { def_tree = $1; };
|
||||
|
||||
list:
|
||||
list item { LIST_ADD($1, $2); $$ = $1; } |
|
||||
/* empty */ { LIST_NEW($$); };
|
||||
|
||||
item:
|
||||
sym ':' { $$ = new_node(LABEL, 0, $1, NULL, NULL); } |
|
||||
sym '=' sym { $$ = new_node(MODIFIER, 0, $1, $3, NULL); } |
|
||||
ent { $$ = $1; }|
|
||||
'{' sub_list '}' { $$ = $2; };
|
||||
|
||||
sub_list:
|
||||
sub_list sub_item { LIST_ADD($1, $2); $$ = $1; } |
|
||||
/* empty */ { LIST_NEW($$); };
|
||||
|
||||
sub_item:
|
||||
sym '=' sym { $$ = new_node(MODIFIER, 0, $1, $3, NULL); }|
|
||||
ent { $$ = $1; } |
|
||||
'{' sub_list '}' { $$ = $2; };
|
||||
|
||||
ent : sym name_opt {
|
||||
$2->ptr1 = $1;
|
||||
/*
|
||||
if ($2->ptr2 == NULL) {
|
||||
$2->ptr2 = strdup($1);
|
||||
}
|
||||
touppers((char*)$2->ptr1);
|
||||
*/
|
||||
$$ = $2;
|
||||
};
|
||||
|
||||
name_opt:
|
||||
name_prefix NAME { $$ = new_node(ENTRY, $1, NULL, $2, NULL); } |
|
||||
name_prefix { $$ = new_node(ENTRY, $1, NULL, NULL, NULL); };
|
||||
|
||||
name_prefix:
|
||||
name_prefix '-' { $$ = $1 + 1; } |
|
||||
/* empty */ { $$ = 0; }
|
||||
|
||||
sym:
|
||||
FSYM { $$ = $1; } |
|
||||
SYM { $$ = $1; } |
|
||||
MOD { $$ = $1; };
|
||||
|
||||
%%
|
||||
|
||||
char*
|
||||
touppers(s)
|
||||
char *s;
|
||||
{
|
||||
char *p;
|
||||
|
||||
for (p = s; *p != '\0'; p++)
|
||||
*p = toupper(*p);
|
||||
return (s);
|
||||
}
|
||||
|
||||
void*
|
||||
mem_alloc(size)
|
||||
int size;
|
||||
{
|
||||
void *res;
|
||||
|
||||
if ((res = malloc(size)) == NULL) {
|
||||
fprintf(stderr, "memory allocation failed.\n");
|
||||
exit(1);
|
||||
}
|
||||
return (res);
|
||||
}
|
||||
|
||||
node_t*
|
||||
new_node(type, val, ptr1, ptr2, link)
|
||||
int type;
|
||||
int val;
|
||||
const void *ptr1, *ptr2;
|
||||
node_t *link;
|
||||
{
|
||||
node_t *res;
|
||||
|
||||
res = mem_alloc(sizeof(node_t));
|
||||
res->type = type;
|
||||
res->val = val;
|
||||
res->ptr1 = ptr1;
|
||||
res->ptr2 = ptr2;
|
||||
res->link = link;
|
||||
return (res);
|
||||
}
|
||||
|
||||
void
|
||||
dump_node(prefix, n)
|
||||
char *prefix;
|
||||
node_t* n;
|
||||
{
|
||||
char prefix2[1024];
|
||||
node_t *np;
|
||||
|
||||
sprintf(prefix2, "%s ", prefix);
|
||||
|
||||
switch (n->type) {
|
||||
case LABEL:
|
||||
printf("%s%s:\n", prefix, n->ptr1);
|
||||
break;
|
||||
case MODIFIER:
|
||||
printf("%s%s=%s\n", prefix, n->ptr1, n->ptr2);
|
||||
break;
|
||||
case ENTRY:
|
||||
if (n->val == 0)
|
||||
printf("%s%s(%s)\n", prefix, n->ptr1, n->ptr2);
|
||||
else
|
||||
printf("%s%s(-%d, %s)\n",
|
||||
prefix, n->ptr1, n->val, n->ptr2);
|
||||
break;
|
||||
case LIST:
|
||||
printf("%s{\n", prefix);
|
||||
for (np = (node_t*)n->ptr1; np; np = np->link) {
|
||||
dump_node(prefix2, np);
|
||||
}
|
||||
printf("%s}\n", prefix);
|
||||
break;
|
||||
default:
|
||||
printf("%s???\n", prefix);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
yyerror(s)
|
||||
const char *s;
|
||||
{
|
||||
extern int yyline;
|
||||
|
||||
fprintf(stderr, "%d: %s\n", yyline, s);
|
||||
}
|
|
@ -0,0 +1,463 @@
|
|||
/* $NetBSD: platid_gen.c,v 1.1 2000/02/06 08:47:13 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 <unistd.h>
|
||||
|
||||
#include "platid_gen.h"
|
||||
|
||||
/*
|
||||
* constants
|
||||
*/
|
||||
#define SEARCH_IGNORECASE (1<<0)
|
||||
|
||||
#define NMODES 2
|
||||
#define MAXNEST 4
|
||||
#define MAXLEN 1024
|
||||
|
||||
enum { FORM_GENHDR, FORM_MASK_H, FORM_MASK_C, FORM_NAME_C };
|
||||
|
||||
/*
|
||||
* data type definitions
|
||||
*/
|
||||
struct genctx_t {
|
||||
int num;
|
||||
const char *alt;
|
||||
const char *node_name[2];
|
||||
char sym[MAXLEN];
|
||||
char name[MAXLEN];
|
||||
} genctx[NMODES][MAXNEST];
|
||||
|
||||
/*
|
||||
* function prototypes
|
||||
*/
|
||||
void gen_list __P((node_t*));
|
||||
void gen_output __P((void));
|
||||
void gen_header __P((void));
|
||||
void gen_mask_h __P((void));
|
||||
void gen_mask_c __P((void));
|
||||
void gen_name_c __P((void));
|
||||
void gen_comment __P((FILE *fp));
|
||||
void enter __P((void));
|
||||
void leave __P((void));
|
||||
|
||||
/*
|
||||
* global data
|
||||
*/
|
||||
node_t* def_tree;
|
||||
int nest;
|
||||
int mode;
|
||||
FILE *fp_out;
|
||||
int form;
|
||||
int count;
|
||||
|
||||
#define MODE_INVALID -1
|
||||
#define MODE_CPU 0
|
||||
#define MODE_MACHINE 1
|
||||
char* mode_names[] = {
|
||||
"CPU", "MACHINE", NULL
|
||||
};
|
||||
#define PREFIX "PLATID"
|
||||
char* prefix_names[] = {
|
||||
"CPU", "MACH",
|
||||
};
|
||||
char* shift_names[NMODES][MAXNEST] = {
|
||||
{
|
||||
"PLATID_CPU_ARCH_SHIFT",
|
||||
"PLATID_CPU_SERIES_SHIFT",
|
||||
"PLATID_CPU_MODEL_SHIFT",
|
||||
"PLATID_CPU_SUBMODEL_SHIFT",
|
||||
},
|
||||
{
|
||||
"PLATID_VENDOR_SHIFT",
|
||||
"PLATID_SERIES_SHIFT",
|
||||
"PLATID_MODEL_SHIFT",
|
||||
"PLATID_SUBMODEL_SHIFT",
|
||||
},
|
||||
};
|
||||
|
||||
/*
|
||||
* program entry
|
||||
*/
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
int i;
|
||||
|
||||
form = FORM_GENHDR;
|
||||
fp_out = stdout;
|
||||
count = 0;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-header") == 0) {
|
||||
form = FORM_GENHDR;
|
||||
} else
|
||||
if (strcmp(argv[i], "-mask_h") == 0) {
|
||||
form = FORM_MASK_H;
|
||||
} else
|
||||
if (strcmp(argv[i], "-mask_c") == 0) {
|
||||
form = FORM_MASK_C;
|
||||
} else
|
||||
if (strcmp(argv[i], "-name_c") == 0) {
|
||||
form = FORM_NAME_C;
|
||||
} else {
|
||||
usage:
|
||||
fprintf(stderr, "usage platid_gen <option>\n");
|
||||
fprintf(stderr, " option: -header\n");
|
||||
fprintf(stderr, " -mask_h\n");
|
||||
fprintf(stderr, " -mask_c\n");
|
||||
fprintf(stderr, " -name_c\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (read_def()) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
gen_comment(fp_out);
|
||||
switch (form) {
|
||||
case FORM_GENHDR:
|
||||
break;
|
||||
case FORM_MASK_H:
|
||||
break;
|
||||
case FORM_MASK_C:
|
||||
fprintf(fp_out, "#include <machine/platid.h>\n");
|
||||
fprintf(fp_out, "#include <machine/platid_mask.h>\n");
|
||||
break;
|
||||
case FORM_NAME_C:
|
||||
fprintf(fp_out, "#include <machine/platid.h>\n");
|
||||
fprintf(fp_out, "#include <machine/platid_mask.h>\n");
|
||||
fprintf(fp_out,"struct platid_name platid_name_table[] = {\n");
|
||||
break;
|
||||
}
|
||||
|
||||
#if 0
|
||||
dump_node("", def_tree);
|
||||
#endif
|
||||
|
||||
nest = -1;
|
||||
enter(); /* XXX */
|
||||
mode = MODE_INVALID;
|
||||
genctx[MODE_CPU][nest].alt = NULL;
|
||||
genctx[MODE_MACHINE][nest].alt = NULL;
|
||||
gen_list((node_t*)def_tree->ptr1);
|
||||
|
||||
switch (form) {
|
||||
case FORM_GENHDR:
|
||||
case FORM_MASK_H:
|
||||
case FORM_MASK_C:
|
||||
break;
|
||||
case FORM_NAME_C:
|
||||
fprintf(fp_out, "};\n");
|
||||
fprintf(fp_out, "platid_name_table_size = %d;\n", count);
|
||||
break;
|
||||
}
|
||||
fclose(fp_out);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
int
|
||||
table_getnum(table, s, def, opt)
|
||||
char **table;
|
||||
char *s;
|
||||
int def;
|
||||
int opt;
|
||||
{
|
||||
int num;
|
||||
|
||||
num = 0;
|
||||
while (table[num]) {
|
||||
int diff;
|
||||
if (opt & SEARCH_IGNORECASE) {
|
||||
diff = strcmp(table[num], s);
|
||||
} else {
|
||||
diff = strcasecmp(table[num], s);
|
||||
}
|
||||
if (diff == 0) {
|
||||
return (num);
|
||||
}
|
||||
num++;
|
||||
}
|
||||
return def;
|
||||
}
|
||||
|
||||
#define GET_MODE(s) \
|
||||
table_getnum(mode_names, (s), MODE_INVALID, SEARCH_IGNORECASE)
|
||||
#define GET_ALT(s) \
|
||||
table_getnum(mode_names, (s), MODE_INVALID, SEARCH_IGNORECASE)
|
||||
|
||||
void
|
||||
enter()
|
||||
{
|
||||
nest++;
|
||||
if (MAXNEST <= nest) {
|
||||
fprintf(stderr, "too much nest\n");
|
||||
exit(1);
|
||||
}
|
||||
genctx[mode][nest].num = 0;
|
||||
genctx[mode][nest].alt = NULL;
|
||||
genctx[mode][nest].node_name[0] = NULL;
|
||||
genctx[mode][nest].node_name[1] = NULL;
|
||||
if (0 < nest) {
|
||||
genctx[mode][nest].alt = genctx[mode][nest - 1].alt;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
leave()
|
||||
{
|
||||
nest--;
|
||||
if (nest < 0) {
|
||||
fprintf(stderr, "internal error (nest=%d)\n", nest);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gen_comment(fp)
|
||||
FILE *fp;
|
||||
{
|
||||
fprintf(fp, "/*\n");
|
||||
fprintf(fp, " * Do not edit.\n");
|
||||
fprintf(fp, " * This file is automatically generated by platid.awk.\n");
|
||||
fprintf(fp, " */\n");
|
||||
}
|
||||
|
||||
gen_name(buf, ctx, nest, name, punct, ignr)
|
||||
char *buf;
|
||||
struct genctx_t ctx[];
|
||||
int nest;
|
||||
int name;
|
||||
char *punct;
|
||||
int ignr;
|
||||
{
|
||||
int i;
|
||||
buf[0] = '\0';
|
||||
for (i = 0; i <= nest; i++) {
|
||||
if (!(ignr <= i && nest != i)) {
|
||||
if (i != 0) {
|
||||
strcat(buf, punct);
|
||||
}
|
||||
strcat(buf, ctx[i].node_name[name]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gen_list(np)
|
||||
node_t* np;
|
||||
{
|
||||
int i, t;
|
||||
|
||||
for ( ; np; np = np->link) {
|
||||
switch (np->type) {
|
||||
case LABEL:
|
||||
if ((mode = GET_MODE(np->ptr1)) == MODE_INVALID) {
|
||||
fprintf(stderr, "invalid mode '%s'\n",
|
||||
np->ptr1);
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
case MODIFIER:
|
||||
t = GET_ALT(np->ptr1);
|
||||
if (t == MODE_INVALID) {
|
||||
fprintf(stderr, "unknown alternater '%s'\n",
|
||||
np->ptr1);
|
||||
exit(1);
|
||||
}
|
||||
if (t == mode) {
|
||||
fprintf(stderr,
|
||||
"invalid alternater '%s' (ignored)\n",
|
||||
np->ptr1);
|
||||
exit(1);
|
||||
}
|
||||
genctx[mode][nest].alt = np->ptr2;
|
||||
break;
|
||||
case ENTRY:
|
||||
if (np->ptr2 == NULL) {
|
||||
char buf[MAXLEN];
|
||||
sprintf(buf, "%s%s",
|
||||
nest == 0 ? "" : " ",
|
||||
np->ptr1);
|
||||
np->ptr2 = strdup(buf);
|
||||
if (nest == 3)
|
||||
np->val = 1;
|
||||
}
|
||||
touppers((char*)np->ptr1);
|
||||
|
||||
genctx[mode][nest].num++;
|
||||
genctx[mode][nest].node_name[0] = np->ptr1;
|
||||
genctx[mode][nest].node_name[1] = np->ptr2;
|
||||
gen_name(genctx[mode][nest].sym, genctx[mode],
|
||||
nest, 0, "_", nest == 3 ? 2 : nest);
|
||||
gen_name(genctx[mode][nest].name, genctx[mode],
|
||||
nest, 1, "", nest - np->val);
|
||||
gen_output();
|
||||
break;
|
||||
case LIST:
|
||||
enter();
|
||||
gen_list((node_t*)np->ptr1);
|
||||
leave();
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "internal error (type=%d)\n", np->type);
|
||||
exit(1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gen_output()
|
||||
{
|
||||
switch (form) {
|
||||
case FORM_GENHDR:
|
||||
gen_header();
|
||||
break;
|
||||
case FORM_MASK_H:
|
||||
gen_mask_h();
|
||||
break;
|
||||
case FORM_MASK_C:
|
||||
gen_mask_c();
|
||||
break;
|
||||
case FORM_NAME_C:
|
||||
gen_name_c();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* platid_generated.h
|
||||
*
|
||||
* #define PLATID_CPU_XXX_NUM 1
|
||||
* #define PLATID_CPU_XXX \
|
||||
* ((PLATID_CPU_XXX_NUM << PLATID_CPU_ARCH_SHIFT))
|
||||
* #define PLATID_CPU_XXX_YYY \
|
||||
* ((PLATID_CPU_XXX_YYY_NUM << PLATID_CPU_SERIES_SHIFT)| \
|
||||
* PLATID_CPU_XXX)
|
||||
*/
|
||||
void
|
||||
gen_header()
|
||||
{
|
||||
char *prefix = prefix_names[mode];
|
||||
char *name = genctx[mode][nest].sym;
|
||||
|
||||
fprintf(fp_out, "#define %s_%s_%s_NUM\t%d\n", PREFIX, prefix, name,
|
||||
genctx[mode][nest].num);
|
||||
fprintf(fp_out, "#define %s_%s_%s\t\\\n", PREFIX, prefix, name);
|
||||
fprintf(fp_out, " ((%s_%s_%s_NUM << %s)", PREFIX, prefix, name,
|
||||
shift_names[mode][nest]);
|
||||
if (0 < nest) {
|
||||
fprintf(fp_out, "| \\\n %s_%s_%s",
|
||||
PREFIX, prefix, genctx[mode][nest - 1].sym);
|
||||
}
|
||||
fprintf(fp_out, ")\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* platid_mask.h:
|
||||
*
|
||||
* extern platid_t platid_mask_CPU_MIPS;
|
||||
* #ifdef PLATID_DEFINE_MASK_NICKNAME
|
||||
* # define GENERIC_MIPS ((int)&platid_mask_CPU_MIPS)
|
||||
* #endif
|
||||
*/
|
||||
void
|
||||
gen_mask_h()
|
||||
{
|
||||
char *name = genctx[mode][nest].sym;
|
||||
|
||||
fprintf(fp_out, "extern platid_t platid_mask_%s_%s;\n",
|
||||
prefix_names[mode], name);
|
||||
fprintf(fp_out, "#ifdef PLATID_DEFINE_MASK_NICKNAME\n");
|
||||
fprintf(fp_out, "# define %s%s ((int)&platid_mask_%s_%s)\n",
|
||||
(mode == MODE_CPU)?"GENERIC_":"",
|
||||
name, prefix_names[mode], name);
|
||||
fprintf(fp_out, "#endif\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* platid_mask.c:
|
||||
*
|
||||
* platid_t platid_mask_CPU_MIPS = {{
|
||||
* PLATID_CPU_MIPS,
|
||||
* PLATID_WILD
|
||||
* }};
|
||||
*/
|
||||
void
|
||||
gen_mask_c()
|
||||
{
|
||||
char *name = genctx[mode][nest].sym;
|
||||
|
||||
fprintf(fp_out, "platid_t platid_mask_%s_%s = {{\n",
|
||||
prefix_names[mode], name);
|
||||
switch (mode) {
|
||||
case MODE_CPU:
|
||||
fprintf(fp_out, "\t%s_CPU_%s,\n", PREFIX, name);
|
||||
if (genctx[mode][nest].alt == NULL)
|
||||
fprintf(fp_out, "\t%s_WILD\n", PREFIX);
|
||||
else
|
||||
fprintf(fp_out, "\t%s_MACH_%s,\n", PREFIX,
|
||||
genctx[mode][nest].alt);
|
||||
break;
|
||||
case MODE_MACHINE:
|
||||
if (genctx[mode][nest].alt == NULL)
|
||||
fprintf(fp_out, "\t%s_WILD,\n", PREFIX);
|
||||
else
|
||||
fprintf(fp_out, "\t%s_CPU_%s,\n", PREFIX,
|
||||
genctx[mode][nest].alt);
|
||||
fprintf(fp_out, "\t%s_MACH_%s\n", PREFIX, name);
|
||||
break;
|
||||
}
|
||||
fprintf(fp_out, "}};\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* platid_name.c:
|
||||
*/
|
||||
void
|
||||
gen_name_c()
|
||||
{
|
||||
fprintf(fp_out, "\t{ &platid_mask_%s_%s,\n",
|
||||
prefix_names[mode], genctx[mode][nest].sym);
|
||||
fprintf(fp_out, "\t \"%s\" },\n", genctx[mode][nest].name);
|
||||
count++;
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
/* $NetBSD: platid_gen.h,v 1.1 2000/02/06 08:47:14 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.
|
||||
*
|
||||
*/
|
||||
enum { LABEL, MODIFIER, ENTRY, LIST };
|
||||
typedef struct node_s {
|
||||
int type;
|
||||
int val;
|
||||
const void *ptr1, *ptr2;
|
||||
struct node_s *link;
|
||||
} node_t;
|
||||
|
||||
extern node_t* def_tree;
|
||||
|
||||
node_t* new_node __P((int, int, const void*, const void*, node_t*));
|
||||
void* mem_alloc __P((int size));
|
||||
void dump_node __P((char *prefix, node_t* n));
|
||||
char* touppers __P((char*));
|
|
@ -0,0 +1,111 @@
|
|||
%{
|
||||
/* $NetBSD: scan.l,v 1.1 2000/02/06 08:47:16 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 <strings.h>
|
||||
#include "gram.h"
|
||||
|
||||
#include "platid_gen.h"
|
||||
|
||||
int yyline;
|
||||
char *getstr __P((char*));
|
||||
void getcomment __P((void));
|
||||
|
||||
#define yywrap() 1
|
||||
|
||||
%}
|
||||
|
||||
%%
|
||||
\"([^"]|\\\")*\" { yylval.str = getstr(yytext); return NAME; }
|
||||
[a-zA-Z][0-9a-zA-Z]* { yylval.str = strdup(yytext); return FSYM; }
|
||||
[a-zA-Z][_0-9a-zA-Z]* { yylval.str = strdup(yytext); return MOD; }
|
||||
[0-9a-zA-Z]+ { yylval.str = strdup(yytext); return SYM; }
|
||||
\n { yyline++; }
|
||||
"/*" { getcomment(); }
|
||||
[ \t]+ { /* ignored */; }
|
||||
. { return yytext[0]; }
|
||||
|
||||
%%
|
||||
|
||||
char*
|
||||
getstr(char*s)
|
||||
{
|
||||
char *res, *p, *p2;
|
||||
res = strdup(s + 1);
|
||||
for (p = p2 = res; *p != '\"'; p++) {
|
||||
if (*p == '\\') {
|
||||
*p2++ = *++p;
|
||||
} else {
|
||||
*p2++ = *p;
|
||||
}
|
||||
}
|
||||
*p2 = '\0';
|
||||
return (res);
|
||||
}
|
||||
|
||||
void
|
||||
getcomment()
|
||||
{
|
||||
int c;
|
||||
|
||||
for ( ; ; ) {
|
||||
while ( (c = input()) != '*' && c != EOF ) {
|
||||
if (c == '\n') yyline++;
|
||||
}
|
||||
if (c == '\n') yyline++;
|
||||
|
||||
if ( c == '*' ) {
|
||||
while ( (c = input()) == '*' ) {
|
||||
if (c == '\n') yyline++;
|
||||
}
|
||||
if (c == '\n') yyline++;
|
||||
if ( c == '/' )
|
||||
break; /* found the end */
|
||||
}
|
||||
|
||||
if ( c == EOF ) {
|
||||
yyerror( "EOF in comment" );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
read_def()
|
||||
{
|
||||
yyline = 1;
|
||||
def_tree = NULL;
|
||||
return yyparse();
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: platid_mask.c,v 1.15 2000/01/28 06:22:53 shin Exp $ */
|
||||
/* $Id: platid_mask.c,v 1.16 2000/02/06 08:47:07 takemura Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999
|
||||
|
@ -38,6 +38,7 @@
|
|||
* This file is automatically generated by platid.awk.
|
||||
*/
|
||||
#include <machine/platid.h>
|
||||
#include <machine/platid_mask.h>
|
||||
platid_t platid_mask_CPU_MIPS = {{
|
||||
PLATID_CPU_MIPS,
|
||||
PLATID_WILD
|
||||
|
@ -422,7 +423,7 @@ platid_t platid_mask_MACH_IBM_WORKPAD_Z50 = {{
|
|||
PLATID_WILD,
|
||||
PLATID_MACH_IBM_WORKPAD_Z50
|
||||
}};
|
||||
platid_t platid_mask_MACH_IBM_WORKPAD_2601_1AU = {{
|
||||
platid_t platid_mask_MACH_IBM_WORKPAD_Z5026011AU = {{
|
||||
PLATID_CPU_MIPS_VR_4121,
|
||||
PLATID_MACH_IBM_WORKPAD_2601_1AU
|
||||
PLATID_MACH_IBM_WORKPAD_Z5026011AU
|
||||
}};
|
||||
|
|
|
@ -0,0 +1,238 @@
|
|||
/* $Id: platid_name.c,v 1.1 2000/02/06 08:47:07 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.
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Do not edit.
|
||||
* This file is automatically generated by platid.awk.
|
||||
*/
|
||||
#include <machine/platid.h>
|
||||
#include <machine/platid_mask.h>
|
||||
struct platid_name platid_name_table[] = {
|
||||
{ &platid_mask_CPU_MIPS,
|
||||
"MIPS" },
|
||||
{ &platid_mask_CPU_MIPS_VR,
|
||||
"MIPS VR" },
|
||||
{ &platid_mask_CPU_MIPS_VR_41XX,
|
||||
"MIPS VR 41XX" },
|
||||
{ &platid_mask_CPU_MIPS_VR_4102,
|
||||
"MIPS VR 4102" },
|
||||
{ &platid_mask_CPU_MIPS_VR_4111,
|
||||
"MIPS VR 4111" },
|
||||
{ &platid_mask_CPU_MIPS_VR_4121,
|
||||
"MIPS VR 4121" },
|
||||
{ &platid_mask_CPU_MIPS_TX,
|
||||
"MIPS TX" },
|
||||
{ &platid_mask_CPU_MIPS_TX_3900,
|
||||
"MIPS TX 3900" },
|
||||
{ &platid_mask_CPU_MIPS_TX_3911,
|
||||
"MIPS TX 3911" },
|
||||
{ &platid_mask_CPU_MIPS_TX_3912,
|
||||
"MIPS TX 3912" },
|
||||
{ &platid_mask_CPU_MIPS_TX_3920,
|
||||
"MIPS TX 3920" },
|
||||
{ &platid_mask_CPU_MIPS_TX_3922,
|
||||
"MIPS TX 3922" },
|
||||
{ &platid_mask_MACH_NEC,
|
||||
"NEC" },
|
||||
{ &platid_mask_MACH_NEC_MCCS,
|
||||
"NEC MC-CS" },
|
||||
{ &platid_mask_MACH_NEC_MCCS_1X,
|
||||
"NEC MC-CS series" },
|
||||
{ &platid_mask_MACH_NEC_MCCS_11,
|
||||
"NEC MC-CS11" },
|
||||
{ &platid_mask_MACH_NEC_MCCS_12,
|
||||
"NEC MC-CS12" },
|
||||
{ &platid_mask_MACH_NEC_MCCS_13,
|
||||
"NEC MC-CS13" },
|
||||
{ &platid_mask_MACH_NEC_MCR,
|
||||
"NEC MC-R" },
|
||||
{ &platid_mask_MACH_NEC_MCR_3XX,
|
||||
"NEC MC-R300 series" },
|
||||
{ &platid_mask_MACH_NEC_MCR_300,
|
||||
"NEC MC-R300" },
|
||||
{ &platid_mask_MACH_NEC_MCR_320,
|
||||
"NEC MC-R320" },
|
||||
{ &platid_mask_MACH_NEC_MCR_FORDOCOMO,
|
||||
"NEC MobileGearII for DoCoMo" },
|
||||
{ &platid_mask_MACH_NEC_MCR_5XX,
|
||||
"NEC MC-R500 series" },
|
||||
{ &platid_mask_MACH_NEC_MCR_500,
|
||||
"NEC MC-R500" },
|
||||
{ &platid_mask_MACH_NEC_MCR_510,
|
||||
"NEC MC-R510" },
|
||||
{ &platid_mask_MACH_NEC_MCR_520,
|
||||
"NEC MC-R520" },
|
||||
{ &platid_mask_MACH_NEC_MCR_520A,
|
||||
"NEC MobilePro 770" },
|
||||
{ &platid_mask_MACH_NEC_MCR_500A,
|
||||
"NEC MobilePro 750c" },
|
||||
{ &platid_mask_MACH_NEC_MCR_530,
|
||||
"NEC MC-R530" },
|
||||
{ &platid_mask_MACH_NEC_MCR_430,
|
||||
"NEC MC-R430" },
|
||||
{ &platid_mask_MACH_NEC_MCR_7XX,
|
||||
"NEC MC-R700 series" },
|
||||
{ &platid_mask_MACH_NEC_MCR_700,
|
||||
"NEC MC-R700" },
|
||||
{ &platid_mask_MACH_NEC_MCR_700A,
|
||||
"NEC MobilePro 800" },
|
||||
{ &platid_mask_MACH_NEC_MCR_730,
|
||||
"NEC MC-R730" },
|
||||
{ &platid_mask_MACH_EVEREX,
|
||||
"Everex" },
|
||||
{ &platid_mask_MACH_EVEREX_FREESTYLE,
|
||||
"Everex Freestyle" },
|
||||
{ &platid_mask_MACH_EVEREX_FREESTYLE_AXX,
|
||||
"Everex Freestyle AXX" },
|
||||
{ &platid_mask_MACH_EVEREX_FREESTYLE_A10,
|
||||
"Everex Freestyle A10" },
|
||||
{ &platid_mask_MACH_EVEREX_FREESTYLE_A15,
|
||||
"Everex Freestyle A15" },
|
||||
{ &platid_mask_MACH_EVEREX_FREESTYLE_A20,
|
||||
"Everex Freestyle A20" },
|
||||
{ &platid_mask_MACH_CASIO,
|
||||
"CASIO" },
|
||||
{ &platid_mask_MACH_CASIO_CASSIOPEIAE,
|
||||
"CASIO Cassiopeia" },
|
||||
{ &platid_mask_MACH_CASIO_CASSIOPEIAE_EXX,
|
||||
"CASIO Cassiopeia EXX" },
|
||||
{ &platid_mask_MACH_CASIO_CASSIOPEIAE_E10,
|
||||
"CASIO Cassiopeia E10" },
|
||||
{ &platid_mask_MACH_CASIO_CASSIOPEIAE_E11,
|
||||
"CASIO Cassiopeia E11" },
|
||||
{ &platid_mask_MACH_CASIO_CASSIOPEIAE_E15,
|
||||
"CASIO Cassiopeia E15" },
|
||||
{ &platid_mask_MACH_CASIO_CASSIOPEIAE_E55,
|
||||
"CASIO Cassiopeia E55" },
|
||||
{ &platid_mask_MACH_CASIO_CASSIOPEIAE_EXXX,
|
||||
"CASIO Cassiopeia EXXX" },
|
||||
{ &platid_mask_MACH_CASIO_CASSIOPEIAE_E100,
|
||||
"CASIO Cassiopeia E100" },
|
||||
{ &platid_mask_MACH_CASIO_CASSIOPEIAE_E105,
|
||||
"CASIO Cassiopeia E105" },
|
||||
{ &platid_mask_MACH_CASIO_CASSIOPEIAE_E500,
|
||||
"CASIO Cassiopeia E500" },
|
||||
{ &platid_mask_MACH_CASIO_CASSIOPEIAE_E507,
|
||||
"CASIO Cassiopeia E507" },
|
||||
{ &platid_mask_MACH_SHARP,
|
||||
"Sharp" },
|
||||
{ &platid_mask_MACH_SHARP_TRIPAD,
|
||||
"Sharp Tripad" },
|
||||
{ &platid_mask_MACH_SHARP_TRIPAD_PV,
|
||||
"Sharp Tripad PV" },
|
||||
{ &platid_mask_MACH_SHARP_TRIPAD_PV6000,
|
||||
"Sharp Tripad PV6000" },
|
||||
{ &platid_mask_MACH_SHARP_TELIOS,
|
||||
"Sharp Telios" },
|
||||
{ &platid_mask_MACH_SHARP_TELIOS_HC,
|
||||
"Sharp Telios HC" },
|
||||
{ &platid_mask_MACH_SHARP_TELIOS_HCAJ1,
|
||||
"Sharp Telios HCAJ1" },
|
||||
{ &platid_mask_MACH_SHARP_MOBILON,
|
||||
"Sharp Mobilon" },
|
||||
{ &platid_mask_MACH_SHARP_MOBILON_HC,
|
||||
"Sharp Mobilon HC" },
|
||||
{ &platid_mask_MACH_SHARP_MOBILON_HC4100,
|
||||
"Sharp Mobilon HC4100" },
|
||||
{ &platid_mask_MACH_FUJITSU,
|
||||
"Fujitsu" },
|
||||
{ &platid_mask_MACH_FUJITSU_INTERTOP,
|
||||
"Fujitsu INTERTOP" },
|
||||
{ &platid_mask_MACH_FUJITSU_INTERTOP_ITXXX,
|
||||
"Fujitsu INTERTOP ITXXX" },
|
||||
{ &platid_mask_MACH_FUJITSU_INTERTOP_IT300,
|
||||
"Fujitsu INTERTOP IT300" },
|
||||
{ &platid_mask_MACH_FUJITSU_INTERTOP_IT310,
|
||||
"Fujitsu INTERTOP IT310" },
|
||||
{ &platid_mask_MACH_PHILIPS,
|
||||
"Philips" },
|
||||
{ &platid_mask_MACH_PHILIPS_NINO,
|
||||
"Philips Nino" },
|
||||
{ &platid_mask_MACH_PHILIPS_NINO_3XX,
|
||||
"Philips Nino 3XX" },
|
||||
{ &platid_mask_MACH_PHILIPS_NINO_312,
|
||||
"Philips Nino 312" },
|
||||
{ &platid_mask_MACH_COMPAQ,
|
||||
"Compaq" },
|
||||
{ &platid_mask_MACH_COMPAQ_C,
|
||||
"Compaq C" },
|
||||
{ &platid_mask_MACH_COMPAQ_C_8XX,
|
||||
"Compaq C 8XX" },
|
||||
{ &platid_mask_MACH_COMPAQ_C_810,
|
||||
"Compaq C 810" },
|
||||
{ &platid_mask_MACH_COMPAQ_C_201X,
|
||||
"Compaq C 201X" },
|
||||
{ &platid_mask_MACH_COMPAQ_C_2010,
|
||||
"Compaq C 2010" },
|
||||
{ &platid_mask_MACH_COMPAQ_C_2015,
|
||||
"Compaq C 2015" },
|
||||
{ &platid_mask_MACH_COMPAQ_AERO,
|
||||
"Compaq AERO" },
|
||||
{ &platid_mask_MACH_COMPAQ_AERO_15XX,
|
||||
"Compaq AERO 15XX" },
|
||||
{ &platid_mask_MACH_COMPAQ_AERO_1530,
|
||||
"Compaq AERO 1530" },
|
||||
{ &platid_mask_MACH_COMPAQ_AERO_21XX,
|
||||
"Compaq AERO 21XX" },
|
||||
{ &platid_mask_MACH_COMPAQ_AERO_2110,
|
||||
"Compaq AERO 2110" },
|
||||
{ &platid_mask_MACH_COMPAQ_AERO_2130,
|
||||
"Compaq AERO 2130" },
|
||||
{ &platid_mask_MACH_COMPAQ_AERO_2140,
|
||||
"Compaq AERO 2140" },
|
||||
{ &platid_mask_MACH_COMPAQ_PRESARIO,
|
||||
"Compaq PRESARIO" },
|
||||
{ &platid_mask_MACH_COMPAQ_PRESARIO_21X,
|
||||
"Compaq PRESARIO 21X" },
|
||||
{ &platid_mask_MACH_COMPAQ_PRESARIO_213,
|
||||
"Compaq PRESARIO 213" },
|
||||
{ &platid_mask_MACH_VICTOR,
|
||||
"Victor" },
|
||||
{ &platid_mask_MACH_VICTOR_INTERLINK,
|
||||
"Victor InterLink" },
|
||||
{ &platid_mask_MACH_VICTOR_INTERLINK_MP,
|
||||
"Victor InterLink MP" },
|
||||
{ &platid_mask_MACH_VICTOR_INTERLINK_MPC101,
|
||||
"Victor InterLink MPC101" },
|
||||
{ &platid_mask_MACH_IBM,
|
||||
"IBM" },
|
||||
{ &platid_mask_MACH_IBM_WORKPAD,
|
||||
"IBM WorkPad" },
|
||||
{ &platid_mask_MACH_IBM_WORKPAD_Z50,
|
||||
"IBM WorkPad z50" },
|
||||
{ &platid_mask_MACH_IBM_WORKPAD_Z5026011AU,
|
||||
"IBM WorkPad z50 2601 1AU" },
|
||||
};
|
||||
platid_name_table_size = 97;
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: platid.h,v 1.1.1.1 1999/09/16 12:23:23 takemura Exp $ */
|
||||
/* $NetBSD: platid.h,v 1.2 2000/02/06 08:47:17 takemura Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999
|
||||
|
@ -69,6 +69,11 @@ typedef union {
|
|||
|
||||
typedef platid_t platid_mask_t;
|
||||
|
||||
struct platid_name {
|
||||
platid_mask_t *mask;
|
||||
char *name;
|
||||
};
|
||||
|
||||
#define PLATID_FLAGS_SHIFT 0
|
||||
#define PLATID_CPU_SUBMODEL_SHIFT 8
|
||||
#define PLATID_CPU_MODEL_SHIFT 14
|
||||
|
@ -106,12 +111,15 @@ typedef platid_t platid_mask_t;
|
|||
extern platid_t platid_unknown;
|
||||
extern platid_t platid_wild;
|
||||
extern platid_t platid;
|
||||
extern struct platid_name platid_name_table[];
|
||||
extern int platid_name_table_size;
|
||||
|
||||
void platid_ntoh(platid_t *pid);
|
||||
void platid_hton(platid_t *pid);
|
||||
void platid_dump(char *name, void* pxx);
|
||||
int platid_match(platid_t *platid, platid_mask_t *mask);
|
||||
int platid_match_sub(platid_t*, platid_mask_t*, int);
|
||||
char* platid_name(platid_t *platid);
|
||||
|
||||
#define PLATID_DEREFP(pp) ((platid_t*)(pp))
|
||||
#define PLATID_DEREF(pp) (*PLATID_DEREFP(pp))
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: platid_generated.h,v 1.14 2000/01/28 06:22:54 shin Exp $ */
|
||||
/* $Id: platid_generated.h,v 1.15 2000/02/06 08:47:17 takemura Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999
|
||||
|
@ -411,7 +411,7 @@
|
|||
#define PLATID_MACH_IBM_WORKPAD_Z50 \
|
||||
((PLATID_MACH_IBM_WORKPAD_Z50_NUM << PLATID_MODEL_SHIFT)| \
|
||||
PLATID_MACH_IBM_WORKPAD)
|
||||
#define PLATID_MACH_IBM_WORKPAD_2601_1AU_NUM 1
|
||||
#define PLATID_MACH_IBM_WORKPAD_2601_1AU \
|
||||
((PLATID_MACH_IBM_WORKPAD_2601_1AU_NUM << PLATID_SUBMODEL_SHIFT)| \
|
||||
#define PLATID_MACH_IBM_WORKPAD_Z5026011AU_NUM 1
|
||||
#define PLATID_MACH_IBM_WORKPAD_Z5026011AU \
|
||||
((PLATID_MACH_IBM_WORKPAD_Z5026011AU_NUM << PLATID_SUBMODEL_SHIFT)| \
|
||||
PLATID_MACH_IBM_WORKPAD_Z50)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: platid_mask.h,v 1.14 2000/01/28 06:22:54 shin Exp $ */
|
||||
/* $Id: platid_mask.h,v 1.15 2000/02/06 08:47:18 takemura Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999
|
||||
|
@ -421,7 +421,7 @@ extern platid_t platid_mask_MACH_IBM_WORKPAD_Z50;
|
|||
#ifdef PLATID_DEFINE_MASK_NICKNAME
|
||||
# define IBM_WORKPAD_Z50 ((int)&platid_mask_MACH_IBM_WORKPAD_Z50)
|
||||
#endif
|
||||
extern platid_t platid_mask_MACH_IBM_WORKPAD_2601_1AU;
|
||||
extern platid_t platid_mask_MACH_IBM_WORKPAD_Z5026011AU;
|
||||
#ifdef PLATID_DEFINE_MASK_NICKNAME
|
||||
# define IBM_WORKPAD_2601_1AU ((int)&platid_mask_MACH_IBM_WORKPAD_2601_1AU)
|
||||
# define IBM_WORKPAD_Z5026011AU ((int)&platid_mask_MACH_IBM_WORKPAD_Z5026011AU)
|
||||
#endif
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/sh
|
||||
# $NetBSD: pbsdboot.config,v 1.4 2000/02/03 19:27:57 cgd Exp $
|
||||
# $NetBSD: pbsdboot.config,v 1.5 2000/02/06 08:47:19 takemura Exp $
|
||||
|
||||
# config file/script to generate project file (.dsp) for pbsdboot
|
||||
|
||||
|
@ -15,6 +15,7 @@ SRCFILE_LIST='
|
|||
pbsdboot.c
|
||||
platid.c
|
||||
platid_mask.c
|
||||
platid_name.c
|
||||
preference.c
|
||||
print.c
|
||||
res/pbsd.bmp
|
||||
|
|
|
@ -133,6 +133,10 @@ SOURCE=.\platid_mask.c
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\platid_name.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\preference.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
#include "../../hpcmips/platid_name.c"
|
Loading…
Reference in New Issue