]> git.saurik.com Git - apple/xnu.git/blob - osfmk/i386/AT386/mp/mp_v1_1.c
0f58f2d5135a9e6e459732018e53893fb16f385d
[apple/xnu.git] / osfmk / i386 / AT386 / mp / mp_v1_1.c
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22 /*
23 * @OSF_COPYRIGHT@
24 */
25
26 #include <cpus.h>
27 #include <mach_rt.h>
28 #include <mach_kdb.h>
29 #include <mach_ldebug.h>
30
31 #include <i386/AT386/misc_protos.h>
32 #include <i386/AT386/mp/mp_v1_1.h>
33 #include <i386/AT386/mp/mp.h>
34 #include <i386/AT386/mp/boot.h>
35 #include <i386/apic.h>
36 #include <i386/ipl.h>
37 #include <i386/fpu.h>
38 #include <i386/pio.h>
39 #include <i386/cpuid.h>
40 #include <i386/proc_reg.h>
41 #include <i386/misc_protos.h>
42 #include <mach/mach_types.h>
43 #include <mach/kern_return.h>
44 #include <vm/vm_kern.h>
45 #include <kern/startup.h>
46 #include <kern/cpu_number.h>
47 #include <kern/cpu_data.h>
48
49 #define MP_DEBUG 1
50
51 #if MP_DEBUG
52 vm_offset_t bios_start;
53 #endif /* MP_DEBUG */
54
55 unsigned int lapic_id_initdata = 0;
56 int lapic_id = (int)&lapic_id_initdata;
57 vm_offset_t lapic_start;
58
59 void lapic_init(void);
60 int get_ncpus(void);
61 void validate_cpus(int ncpus);
62 void cpu_interrupt(int cpu);
63 void slave_boot(int cpu);
64
65 boolean_t mp_v1_1_initialized = FALSE;
66
67 void
68 mp_v1_1_init(void)
69 {
70 /*WILL BE REMOVED IN FUTURE REVISION!!! !*/
71 /* SIMPLY COMMENTED OUT FOR THE MOMENT */
72 return;
73 }
74
75 void
76 lapic_init(void)
77 {
78 }
79
80 void
81 cpu_interrupt(
82 int cpu)
83 {
84 }
85
86 #if NCPUS > 1
87 void
88 slave_boot(
89 int cpu)
90 {
91 }
92
93 void
94 start_other_cpus(void)
95 {
96 }
97
98 void
99 validate_cpus(int ncpus)
100 {
101 int i;
102 for(i=0;i<ncpus;i++)
103 machine_slot[i].is_cpu = TRUE;
104 }
105
106 int
107 get_ncpus(void)
108 {
109 return 1;
110 }
111
112 void
113 slave_machine_init(void)
114 {
115 }
116
117 #endif /* NCPUS > 1 */
118
119 #if MACH_KDB
120 #include <ddb/db_output.h>
121
122 #define TRAP_DEBUG 0 /* Must match interrupt.s and spl.s */
123
124
125 #if TRAP_DEBUG
126 #define MTRAPS 100
127 struct mp_trap_hist_struct {
128 unsigned char type;
129 unsigned char data[5];
130 } trap_hist[MTRAPS], *cur_trap_hist = trap_hist,
131 *max_trap_hist = &trap_hist[MTRAPS];
132
133 void db_trap_hist(void);
134
135 /*
136 * SPL:
137 * 1: new spl
138 * 2: old spl
139 * 3: new tpr
140 * 4: old tpr
141 * INT:
142 * 1: int vec
143 * 2: old spl
144 * 3: new spl
145 * 4: post eoi tpr
146 * 5: exit tpr
147 */
148
149 void
150 db_trap_hist(void)
151 {
152 int i,j;
153 for(i=0;i<MTRAPS;i++)
154 if (trap_hist[i].type == 1 || trap_hist[i].type == 2) {
155 db_printf("%s%s",
156 (&trap_hist[i]>=cur_trap_hist)?"*":" ",
157 (trap_hist[i].type == 1)?"SPL":"INT");
158 for(j=0;j<5;j++)
159 db_printf(" %02x", trap_hist[i].data[j]);
160 db_printf("\n");
161 }
162
163 }
164 #endif /* TRAP_DEBUG */
165
166 void db_lapic(int cpu);
167 unsigned int db_remote_read(int cpu, int reg);
168 void db_ioapic(unsigned int);
169 void kdb_console(void);
170
171 void
172 kdb_console(void)
173 {
174 }
175
176 #define BOOLP(a) ((a)?' ':'!')
177
178 static char *DM[8] = {
179 "Fixed",
180 "Lowest Priority",
181 "Invalid",
182 "Invalid",
183 "NMI",
184 "Reset",
185 "Invalid",
186 "ExtINT"};
187
188 unsigned int
189 db_remote_read(int cpu, int reg)
190 {
191 return -1;
192 }
193
194 void
195 db_lapic(int cpu)
196 {
197 }
198
199 void
200 db_ioapic(unsigned int ind)
201 {
202 }
203
204 #endif /* MACH_KDB */