Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / arch / hpcmips / stand / pbsdboot / systeminfo.c
blob14d02eef9a90c001a9c8433e034ecd45f8f0a08d
1 /* $NetBSD: systeminfo.c,v 1.2 1999/09/26 12:46:58 takemura Exp $ */
3 /*
4 * Copyright (c) 1999, by UCHIYAMA Yasushi
5 * All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. The name of the developer may NOT be used to endorse or promote products
13 * derived from this software without specific prior written permission.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
28 #include <pbsdboot.h>
29 #include <machine/platid_mask.h>
30 #if 0
31 #define PROCESSOR_LEVEL_R4000 4
32 #define PROCESSOR_LEVEL_R3000 3
33 #define PROCESSOR_REVMAJOR_VR41XX 0x0c
34 #define PROCESSOR_REVMAJOR_TX39XX 0x22
35 #endif
37 struct system_info system_info;
39 static void dump_archinfo(SYSTEM_INFO*);
41 int
42 set_system_info(platid_t *platid)
44 SYSTEM_INFO info;
46 * Set machine dependent information.
48 GetSystemInfo(&info);
49 if (platid_match(platid, &platid_mask_CPU_MIPS)) {
50 if (platid_match(platid, &platid_mask_CPU_MIPS_VR_41XX)) {
51 vr41xx_init(&info);
52 } else
53 if (platid_match(platid, &platid_mask_CPU_MIPS_TX)) {
54 tx39xx_init(&info);
55 } else {
56 dump_archinfo(&info);
57 return 0;
59 } else {
60 dump_archinfo(&info);
61 return 0;
64 #if 0
65 switch (info.wProcessorArchitecture) {
66 default:
67 dump_archinfo(&info);
68 return 0;
69 break;
70 case PROCESSOR_ARCHITECTURE_MIPS:
71 switch (info.wProcessorLevel) {
72 default:
73 dump_archinfo(&info);
74 return 0;
75 break;
76 case PROCESSOR_LEVEL_R4000:
77 switch (info.wProcessorRevision >> 8) {
78 default:
79 dump_archinfo(&info);
80 return 0;
81 break;
82 case PROCESSOR_REVMAJOR_VR41XX:
83 vr41xx_init(&info);
84 break;
86 break;
87 case PROCESSOR_LEVEL_R3000:
88 switch (info.wProcessorRevision >> 8) {
89 default:
90 dump_archinfo(&info);
91 return 0;
92 break;
93 case PROCESSOR_REVMAJOR_TX39XX:
94 tx39xx_init(&info);
95 break;
97 break;
99 break;
100 case PROCESSOR_ARCHITECTURE_SHx:
101 dump_archinfo(&info);
102 return 0;
103 break;
104 case PROCESSOR_ARCHITECTURE_ARM:
105 dump_archinfo(&info);
106 return 0;
107 break;
109 #endif
111 if (system_info.si_asmcodelen > (signed)system_info.si_pagesize) {
112 msg_printf(MSG_ERROR, whoami,
113 TEXT("asmcodelen=%d > pagesize=%d\n"),
114 system_info.si_asmcodelen,
115 system_info.si_pagesize);
116 return 0;
119 return 1;
122 static void
123 dump_archinfo(SYSTEM_INFO *info)
125 msg_printf(MSG_ERROR, whoami, TEXT("Unsupported CPU\n"));
126 #if 0
127 msg_printf(MSG_ERROR, whoami,
128 TEXT("Unknown machine ARCHITECTURE %#x, LEVEL %#x REVISION %#x.\n LCD(%dx%d)\n"),
129 info->wProcessorArchitecture, info->wProcessorLevel,
130 info->wProcessorRevision,
131 GetSystemMetrics(SM_CXSCREEN),
132 GetSystemMetrics(SM_CYSCREEN));
133 #endif