Rev 3675 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3675 | Rev 4377 | ||
---|---|---|---|
Line 31... | Line 31... | ||
31 | */ |
31 | */ |
32 | /** @file |
32 | /** @file |
33 | */ |
33 | */ |
34 | 34 | ||
35 | #include <arch.h> |
35 | #include <arch.h> |
36 | #include <arch/ski/ski.h> |
36 | #include <arch/drivers/ski.h> |
37 | #include <arch/drivers/it.h> |
37 | #include <arch/drivers/it.h> |
38 | #include <arch/interrupt.h> |
38 | #include <arch/interrupt.h> |
39 | #include <arch/barrier.h> |
39 | #include <arch/barrier.h> |
40 | #include <arch/asm.h> |
40 | #include <arch/asm.h> |
41 | #include <arch/register.h> |
41 | #include <arch/register.h> |
Line 49... | Line 49... | ||
49 | #include <console/console.h> |
49 | #include <console/console.h> |
50 | #include <proc/uarg.h> |
50 | #include <proc/uarg.h> |
51 | #include <syscall/syscall.h> |
51 | #include <syscall/syscall.h> |
52 | #include <ddi/irq.h> |
52 | #include <ddi/irq.h> |
53 | #include <ddi/device.h> |
53 | #include <ddi/device.h> |
54 | #include <arch/drivers/ega.h> |
- | |
55 | #include <arch/bootinfo.h> |
54 | #include <arch/bootinfo.h> |
56 | #include <genarch/kbd/i8042.h> |
- | |
57 | #include <genarch/kbd/ns16550.h> |
- | |
58 | #include <smp/smp.h> |
55 | #include <smp/smp.h> |
59 | #include <smp/ipi.h> |
56 | #include <smp/ipi.h> |
60 | #include <arch/atomic.h> |
57 | #include <arch/atomic.h> |
61 | #include <panic.h> |
58 | #include <panic.h> |
62 | #include <print.h> |
59 | #include <print.h> |
63 | 60 | ||
64 | - | ||
65 | - | ||
66 | - | ||
67 | - | ||
68 | - | ||
69 | #ifdef CONFIG_SMP |
61 | #ifdef CONFIG_SMP |
70 | 62 | ||
71 | - | ||
72 | extern char cpu_by_id_eid_list[256][256]; |
63 | extern char cpu_by_id_eid_list[256][256]; |
73 | 64 | ||
74 | - | ||
75 | static void sapic_init(void) |
65 | static void sapic_init(void) |
76 | { |
66 | { |
77 | bootinfo->sapic=(unative_t *)(PA2KA((unative_t)(bootinfo->sapic))|FW_OFFSET); |
67 | bootinfo->sapic = (unative_t *)(PA2KA((unative_t)(bootinfo->sapic)) | |
- | 68 | FW_OFFSET); |
|
78 | } |
69 | } |
79 | 70 | ||
80 | - | ||
81 | - | ||
82 | static void ipi_broadcast_arch_all(int ipi ) |
71 | static void ipi_broadcast_arch_all(int ipi) |
83 | { |
72 | { |
84 | int id,eid; |
73 | int id, eid; |
85 | int myid,myeid; |
74 | int myid, myeid; |
86 | 75 | ||
87 | myid=ia64_get_cpu_id(); |
76 | myid = ia64_get_cpu_id(); |
88 | myeid=ia64_get_cpu_eid(); |
77 | myeid = ia64_get_cpu_eid(); |
89 | - | ||
90 | 78 | ||
91 | for(id=0;id<256;id++) |
79 | for (id = 0; id < 256; id++) |
92 | for(eid=0;eid<256;eid++) |
80 | for (eid = 0; eid < 256; eid++) |
93 | if((id!=myid) || (eid!=myeid)) |
81 | if ((id != myid) || (eid != myeid)) |
94 | ipi_send_ipi(id,eid,ipi); |
82 | ipi_send_ipi(id, eid, ipi); |
95 | } |
83 | } |
96 | 84 | ||
97 | void ipi_broadcast_arch(int ipi ) |
85 | void ipi_broadcast_arch(int ipi ) |
98 | { |
86 | { |
99 | int id,eid; |
87 | int id, eid; |
100 | int myid,myeid; |
88 | int myid, myeid; |
101 | 89 | ||
102 | myid=ia64_get_cpu_id(); |
90 | myid = ia64_get_cpu_id(); |
103 | myeid=ia64_get_cpu_eid(); |
91 | myeid = ia64_get_cpu_eid(); |
104 | - | ||
105 | //printf("Sending ipi %d on %d\n",ipi,CPU->id); |
- | |
106 | for(id=0;id<256;id++) |
- | |
107 | for(eid=0;eid<256;eid++) |
- | |
108 | if((id!=myid) || (eid!=myeid)) |
- | |
109 | if(cpu_by_id_eid_list[id][eid]) |
- | |
110 | ipi_send_ipi(id,eid,ipi); |
- | |
111 | 92 | ||
- | 93 | for (id = 0; id < 256; id++) |
|
- | 94 | for (eid = 0; eid < 256; eid++) |
|
- | 95 | if ((id != myid) || (eid != myeid)) |
|
- | 96 | if (cpu_by_id_eid_list[id][eid]) |
|
- | 97 | ipi_send_ipi(id, eid, ipi); |
|
112 | } |
98 | } |
113 | 99 | ||
114 | - | ||
115 | void smp_init(void) |
100 | void smp_init(void) |
116 | { |
101 | { |
117 | if(!bootinfo->hello_configured) return; |
102 | if (!bootinfo->hello_configured) |
- | 103 | return; |
|
- | 104 | ||
- | 105 | /* |
|
118 | //If we have not system prepared by hello, we are not able to start AP's |
106 | * If we have not got system prepared by hello, we are not able to start |
119 | //this means we are running on simulator |
107 | * AP's. This means we are running on a simulator. |
- | 108 | */ |
|
120 | 109 | ||
121 | sapic_init(); |
110 | sapic_init(); |
122 | ipi_broadcast_arch_all(bootinfo->wakeup_intno); |
111 | ipi_broadcast_arch_all(bootinfo->wakeup_intno); |
123 | volatile long long brk; |
112 | volatile long long brk; |
124 | for(brk=0;brk<100LL*1024LL*1024LL;brk++); //wait a while before CPUs starts |
113 | for (brk = 0; brk < 100LL * 1024LL * 1024LL; brk++) |
- | 114 | ; /* wait a while before CPUs starts */ |
|
125 | 115 | ||
126 | config.cpu_count=0; |
116 | config.cpu_count = 0; |
127 | int id,eid; |
117 | int id, eid; |
128 | 118 | ||
129 | for(id=0;id<256;id++) |
119 | for (id = 0; id < 256; id++) |
130 | for(eid=0;eid<256;eid++) |
120 | for (eid = 0; eid < 256; eid++) |
131 | if(cpu_by_id_eid_list[id][eid]==1){ |
121 | if (cpu_by_id_eid_list[id][eid] == 1) { |
132 | config.cpu_count++; |
122 | config.cpu_count++; |
133 | cpu_by_id_eid_list[id][eid]=2; |
123 | cpu_by_id_eid_list[id][eid] = 2; |
134 | - | ||
135 | } |
124 | } |
136 | } |
125 | } |
137 | 126 | ||
138 | - | ||
139 | void kmp(void *arg __attribute__((unused))) |
127 | void kmp(void *arg __attribute__((unused))) |
140 | { |
128 | { |
141 | int id,eid; |
129 | int id, eid; |
142 | int myid,myeid; |
130 | int myid, myeid; |
143 | 131 | ||
144 | myid=ia64_get_cpu_id(); |
132 | myid = ia64_get_cpu_id(); |
145 | myeid=ia64_get_cpu_eid(); |
133 | myeid = ia64_get_cpu_eid(); |
146 | 134 | ||
147 | for(id=0;id<256;id++) |
135 | for (id = 0; id < 256; id++) |
148 | for(eid=0;eid<256;eid++) |
136 | for (eid = 0; eid < 256; eid++) |
149 | if((id!=myid) || (eid!=myeid)) |
137 | if ((id != myid) || (eid != myeid)) |
150 | if(cpu_by_id_eid_list[id][eid]!=0){ |
138 | if (cpu_by_id_eid_list[id][eid] != 0) { |
151 | if(cpu_by_id_eid_list[id][eid]==1){ |
139 | if (cpu_by_id_eid_list[id][eid] == 1) { |
152 | - | ||
153 | //config.cpu_count++; |
140 | printf("Found Late CPU ID:%d " |
154 | //cpu_by_id_eid_list[id][eid]=2; |
141 | "EDI:%d Not added to " |
155 | printf("Found Late CPU ID:%d EDI:%d Not added to system!!!\n",id,eid); |
142 | "system!!!\n", id, eid); |
156 | continue; |
143 | continue; |
157 | } |
144 | } |
158 | cpu_by_id_eid_list[id][eid]=3; |
145 | cpu_by_id_eid_list[id][eid] = 3; |
159 | /* |
146 | /* |
160 | * There may be just one AP being initialized at |
147 | * There may be just one AP being |
- | 148 | * initialized at the time. After |
|
161 | * the time. After it comes completely up, it is |
149 | * it comes completely up, it is |
162 | * supposed to wake us up. |
150 | * supposed to wake us up. |
163 | */ |
151 | */ |
- | 152 | if (waitq_sleep_timeout( |
|
164 | if (waitq_sleep_timeout(&ap_completion_wq, 1000000, |
153 | &ap_completion_wq, 1000000, |
165 | SYNCH_FLAGS_NONE) == ESYNCH_TIMEOUT) { |
154 | SYNCH_FLAGS_NONE) == |
- | 155 | ESYNCH_TIMEOUT) { |
|
166 | printf("%s: waiting for cpu ID:%d EID:%d" |
156 | printf("%s: waiting for cpu " |
167 | "timed out\n", __FUNCTION__, |
157 | "ID:%d EID:%d timed out\n", |
168 | id, eid); |
158 | __FUNCTION__, id, eid); |
169 | } |
159 | } |
170 | - | ||
171 | } |
160 | } |
172 | } |
161 | } |
173 | #endif |
- | |
174 | - | ||
175 | - | ||
176 | /*This is just a hack for linking with assembler - may be removed in future*/ |
- | |
177 | #ifndef CONFIG_SMP |
- | |
178 | void main_ap(void); |
- | |
179 | void main_ap(void) |
- | |
180 | { |
- | |
181 | while(1); |
- | |
182 | } |
- | |
183 | 162 | ||
184 | #endif |
163 | #endif |
185 | 164 | ||
186 | /** @} |
165 | /** @} |
187 | */ |
166 | */ |