1 /* $NetBSD: systeminfo.c,v 1.2 1999/09/26 12:46:58 takemura Exp $ */
4 * Copyright (c) 1999, by UCHIYAMA Yasushi
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
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
29 #include <machine/platid_mask.h>
31 #define PROCESSOR_LEVEL_R4000 4
32 #define PROCESSOR_LEVEL_R3000 3
33 #define PROCESSOR_REVMAJOR_VR41XX 0x0c
34 #define PROCESSOR_REVMAJOR_TX39XX 0x22
37 struct system_info system_info
;
39 static void dump_archinfo(SYSTEM_INFO
*);
42 set_system_info(platid_t
*platid
)
46 * Set machine dependent information.
49 if (platid_match(platid
, &platid_mask_CPU_MIPS
)) {
50 if (platid_match(platid
, &platid_mask_CPU_MIPS_VR_41XX
)) {
53 if (platid_match(platid
, &platid_mask_CPU_MIPS_TX
)) {
65 switch (info
.wProcessorArchitecture
) {
70 case PROCESSOR_ARCHITECTURE_MIPS
:
71 switch (info
.wProcessorLevel
) {
76 case PROCESSOR_LEVEL_R4000
:
77 switch (info
.wProcessorRevision
>> 8) {
82 case PROCESSOR_REVMAJOR_VR41XX
:
87 case PROCESSOR_LEVEL_R3000
:
88 switch (info
.wProcessorRevision
>> 8) {
93 case PROCESSOR_REVMAJOR_TX39XX
:
100 case PROCESSOR_ARCHITECTURE_SHx
:
101 dump_archinfo(&info
);
104 case PROCESSOR_ARCHITECTURE_ARM
:
105 dump_archinfo(&info
);
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
);
123 dump_archinfo(SYSTEM_INFO
*info
)
125 msg_printf(MSG_ERROR
, whoami
, TEXT("Unsupported CPU\n"));
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
));