Changeset 666773c in mainline for kernel/arch/ia64/src/smp/smp.c
- Timestamp:
- 2008-12-31T15:33:29Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 9805cde
- Parents:
- d8c0dc5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/ia64/src/smp/smp.c
rd8c0dc5 r666773c 62 62 #include <print.h> 63 63 64 65 66 67 68 69 64 #ifdef CONFIG_SMP 70 71 65 72 66 extern char cpu_by_id_eid_list[256][256]; 73 67 74 75 68 static void sapic_init(void) 76 69 { 77 bootinfo->sapic=(unative_t *)(PA2KA((unative_t)(bootinfo->sapic))|FW_OFFSET); 70 bootinfo->sapic = (unative_t *)(PA2KA((unative_t)(bootinfo->sapic)) | 71 FW_OFFSET); 78 72 } 79 73 80 81 82 static void ipi_broadcast_arch_all(int ipi ) 74 static void ipi_broadcast_arch_all(int ipi) 83 75 { 84 76 int id,eid; 85 int myid, myeid;77 int myid, myeid; 86 78 87 myid=ia64_get_cpu_id(); 88 myeid=ia64_get_cpu_eid(); 89 79 myid = ia64_get_cpu_id(); 80 myeid = ia64_get_cpu_eid(); 90 81 91 for (id=0;id<256;id++)92 for (eid=0;eid<256;eid++)93 if ((id!=myid) || (eid!=myeid))94 ipi_send_ipi(id, eid,ipi);82 for (id = 0; id < 256; id++) 83 for (eid = 0; eid < 256; eid++) 84 if ((id != myid) || (eid != myeid)) 85 ipi_send_ipi(id, eid, ipi); 95 86 } 96 87 … … 100 91 int myid,myeid; 101 92 102 myid =ia64_get_cpu_id();103 myeid =ia64_get_cpu_eid();93 myid = ia64_get_cpu_id(); 94 myeid = ia64_get_cpu_eid(); 104 95 105 for(id=0;id<256;id++) 106 for(eid=0;eid<256;eid++) 107 if((id!=myid) || (eid!=myeid)) 108 if(cpu_by_id_eid_list[id][eid]) 109 ipi_send_ipi(id,eid,ipi); 110 96 for (id = 0; id < 256; id++) 97 for (eid = 0; eid < 256; eid++) 98 if ((id != myid) || (eid != myeid)) 99 if (cpu_by_id_eid_list[id][eid]) 100 ipi_send_ipi(id, eid, ipi); 111 101 } 112 113 102 114 103 void smp_init(void) 115 104 { 116 if(!bootinfo->hello_configured) return; 117 //If we have not system prepared by hello, we are not able to start AP's 118 //this means we are running on simulator 105 if (!bootinfo->hello_configured) 106 return; 107 108 /* 109 * If we have not system prepared by hello, we are not able to start 110 * AP's. This means we are running on a simulator. 111 */ 119 112 120 113 sapic_init(); 121 114 ipi_broadcast_arch_all(bootinfo->wakeup_intno); 122 115 volatile long long brk; 123 for(brk=0;brk<100LL*1024LL*1024LL;brk++); //wait a while before CPUs starts 116 for (brk = 0; brk < 100LL * 1024LL * 1024LL; brk++) 117 ; /* wait a while before CPUs starts */ 124 118 125 config.cpu_count =0;126 int id, eid;119 config.cpu_count = 0; 120 int id, eid; 127 121 128 for (id=0;id<256;id++)129 for (eid=0;eid<256;eid++)130 if (cpu_by_id_eid_list[id][eid]==1){122 for (id = 0; id < 256; id++) 123 for (eid = 0; eid < 256; eid++) 124 if (cpu_by_id_eid_list[id][eid] == 1) { 131 125 config.cpu_count++; 132 cpu_by_id_eid_list[id][eid]=2; 133 126 cpu_by_id_eid_list[id][eid] = 2; 134 127 } 135 128 } 136 137 129 138 130 void kmp(void *arg __attribute__((unused))) 139 131 { 140 132 int id,eid; 141 int myid, myeid;133 int myid, myeid; 142 134 143 myid =ia64_get_cpu_id();144 myeid =ia64_get_cpu_eid();135 myid = ia64_get_cpu_id(); 136 myeid = ia64_get_cpu_eid(); 145 137 146 for(id=0;id<256;id++) 147 for(eid=0;eid<256;eid++) 148 if((id!=myid) || (eid!=myeid)) 149 if(cpu_by_id_eid_list[id][eid]!=0){ 150 if(cpu_by_id_eid_list[id][eid]==1){ 151 printf("Found Late CPU ID:%d EDI:%d Not added to system!!!\n",id,eid); 138 for (id = 0; id < 256; id++) 139 for (eid = 0; eid < 256; eid++) 140 if ((id != myid) || (eid != myeid)) 141 if (cpu_by_id_eid_list[id][eid] != 0) { 142 if (cpu_by_id_eid_list[id][eid] == 1) { 143 printf("Found Late CPU ID:%d " 144 "EDI:%d Not added to " 145 "system!!!\n", id, eid); 152 146 continue; 153 154 cpu_by_id_eid_list[id][eid] =3;147 } 148 cpu_by_id_eid_list[id][eid] = 3; 155 149 /* 156 * There may be just one AP being initialized at 157 * the time. After it comes completely up, it is 150 * There may be just one AP being 151 * initialized at the time. After 152 * it comes completely up, it is 158 153 * supposed to wake us up. 159 154 */ 160 if (waitq_sleep_timeout(&ap_completion_wq, 1000000, 161 SYNCH_FLAGS_NONE) == ESYNCH_TIMEOUT) { 162 printf("%s: waiting for cpu ID:%d EID:%d" 163 "timed out\n", __FUNCTION__, 164 id, eid); 165 } 166 155 if (waitq_sleep_timeout( 156 &ap_completion_wq, 1000000, 157 SYNCH_FLAGS_NONE) == 158 ESYNCH_TIMEOUT) { 159 printf("%s: waiting for cpu " 160 "ID:%d EID:%d timed out\n", 161 __FUNCTION__, id, eid); 162 } 167 163 } 168 164 } 165 169 166 #endif 170 167 171 168 172 /*This is just a hack for linking with assembler - may be removed in future*/173 169 #ifndef CONFIG_SMP 170 171 /* This is just a hack for linking with assembler - may be removed in future. */ 174 172 void main_ap(void); 175 173 void main_ap(void) 176 174 { 177 while(1); 175 while(1) 176 ; 178 177 } 179 178
Note:
See TracChangeset
for help on using the changeset viewer.