Rev 534 | Rev 1705 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | jermar | 1 | /* |
319 | jermar | 2 | * Copyright (C) 2003-2004 Jakub Jermar |
1 | jermar | 3 | * All rights reserved. |
4 | * |
||
5 | * Redistribution and use in source and binary forms, with or without |
||
6 | * modification, are permitted provided that the following conditions |
||
7 | * are met: |
||
8 | * |
||
9 | * - Redistributions of source code must retain the above copyright |
||
10 | * notice, this list of conditions and the following disclaimer. |
||
11 | * - Redistributions in binary form must reproduce the above copyright |
||
12 | * notice, this list of conditions and the following disclaimer in the |
||
13 | * documentation and/or other materials provided with the distribution. |
||
14 | * - The name of the author may not be used to endorse or promote products |
||
15 | * derived from this software without specific prior written permission. |
||
16 | * |
||
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
||
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
||
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
||
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
||
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
||
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
||
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||
27 | */ |
||
28 | |||
29 | #include <arch/cpu.h> |
||
30 | #include <cpu.h> |
||
31 | |||
32 | #include <arch.h> |
||
33 | |||
34 | #include <arch/cp0.h> |
||
35 | |||
36 | #include <typedefs.h> |
||
324 | palkovsky | 37 | #include <print.h> |
1 | jermar | 38 | |
324 | palkovsky | 39 | struct data_t { |
1 | jermar | 40 | char *vendor; |
41 | char *model; |
||
324 | palkovsky | 42 | }; |
43 | |||
44 | static struct data_t imp_data[] = { |
||
125 | jermar | 45 | { "Invalid", "Invalid" }, /* 0x00 */ |
46 | { "MIPS", "R2000" }, /* 0x01 */ |
||
47 | { "MIPS", "R3000" }, /* 0x02 */ |
||
48 | { "MIPS", "R6000" }, /* 0x03 */ |
||
49 | { "MIPS", " R4000/R4400" }, /* 0x04 */ |
||
50 | { "LSI Logic", "R3000" }, /* 0x05 */ |
||
51 | { "MIPS", "R6000A" }, /* 0x06 */ |
||
52 | { "IDT", "3051/3052" }, /* 0x07 */ |
||
53 | { "Invalid", "Invalid" }, /* 0x08 */ |
||
54 | { "MIPS", "R10000/T5" }, /* 0x09 */ |
||
55 | { "MIPS", "R4200" }, /* 0x0a */ |
||
56 | { "Unknown", "Unknown" }, /* 0x0b */ |
||
57 | { "Unknown", "Unknown" }, /* 0x0c */ |
||
58 | { "Invalid", "Invalid" }, /* 0x0d */ |
||
59 | { "Invalid", "Invalid" }, /* 0x0e */ |
||
60 | { "Invalid", "Invalid" }, /* 0x0f */ |
||
61 | { "MIPS", "R8000" }, /* 0x10 */ |
||
62 | { "Invalid", "Invalid" }, /* 0x11 */ |
||
63 | { "Invalid", "Invalid" }, /* 0x12 */ |
||
64 | { "Invalid", "Invalid" }, /* 0x13 */ |
||
65 | { "Invalid", "Invalid" }, /* 0x14 */ |
||
66 | { "Invalid", "Invalid" }, /* 0x15 */ |
||
67 | { "Invalid", "Invalid" }, /* 0x16 */ |
||
68 | { "Invalid", "Invalid" }, /* 0x17 */ |
||
69 | { "Invalid", "Invalid" }, /* 0x18 */ |
||
70 | { "Invalid", "Invalid" }, /* 0x19 */ |
||
71 | { "Invalid", "Invalid" }, /* 0x1a */ |
||
72 | { "Invalid", "Invalid" }, /* 0x1b */ |
||
73 | { "Invalid", "Invalid" }, /* 0x1c */ |
||
74 | { "Invalid", "Invalid" }, /* 0x1d */ |
||
75 | { "Invalid", "Invalid" }, /* 0x1e */ |
||
76 | { "Invalid", "Invalid" }, /* 0x1f */ |
||
77 | { "QED", "R4600" }, /* 0x20 */ |
||
78 | { "Sony", "R3000" }, /* 0x21 */ |
||
79 | { "Toshiba", "R3000" }, /* 0x22 */ |
||
329 | palkovsky | 80 | { "NKK", "R3000" }, /* 0x23 */ |
81 | { NULL, NULL } |
||
1 | jermar | 82 | }; |
83 | |||
324 | palkovsky | 84 | static struct data_t imp_data80[] = { |
85 | { "MIPS", "4Kc" }, /* 0x80 */ |
||
86 | {"Invalid","Invalid"}, /* 0x81 */ |
||
87 | {"Invalid","Invalid"}, /* 0x82 */ |
||
329 | palkovsky | 88 | {"MIPS","4Km & 4Kp"}, /* 0x83 */ |
89 | { NULL, NULL} |
||
324 | palkovsky | 90 | }; |
91 | |||
1 | jermar | 92 | void cpu_arch_init(void) |
93 | { |
||
94 | } |
||
95 | |||
96 | void cpu_identify(void) |
||
97 | { |
||
15 | jermar | 98 | CPU->arch.rev_num = cp0_prid_read() & 0xff; |
99 | CPU->arch.imp_num = (cp0_prid_read() >> 8) & 0xff; |
||
1 | jermar | 100 | } |
101 | |||
102 | void cpu_print_report(cpu_t *m) |
||
103 | { |
||
324 | palkovsky | 104 | struct data_t *data; |
329 | palkovsky | 105 | int i; |
324 | palkovsky | 106 | |
107 | if (m->arch.imp_num & 0x80) { |
||
329 | palkovsky | 108 | /* Count records */ |
109 | for (i=0;imp_data80[i].vendor;i++) |
||
110 | ; |
||
610 | palkovsky | 111 | if ((m->arch.imp_num & 0x7f) >= i) { |
329 | palkovsky | 112 | printf("imp=%d\n",m->arch.imp_num); |
113 | return; |
||
114 | } |
||
324 | palkovsky | 115 | data = &imp_data80[m->arch.imp_num & 0x7f]; |
329 | palkovsky | 116 | } else { |
117 | for (i=0;imp_data[i].vendor;i++) |
||
118 | ; |
||
119 | if (m->arch.imp_num >= i) { |
||
120 | printf("imp=%d\n",m->arch.imp_num); |
||
121 | return; |
||
122 | } |
||
324 | palkovsky | 123 | data = &imp_data[m->arch.imp_num]; |
329 | palkovsky | 124 | } |
324 | palkovsky | 125 | |
1 | jermar | 126 | printf("cpu%d: %s %s (rev=%d.%d, imp=%d)\n", |
324 | palkovsky | 127 | m->id, data->vendor, data->model, m->arch.rev_num >> 4, |
128 | m->arch.rev_num & 0xf, m->arch.imp_num); |
||
1 | jermar | 129 | } |