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