Rev 3597 | Rev 3675 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3597 | Rev 3623 | ||
---|---|---|---|
Line 3... | Line 3... | ||
3 | 3 | ||
4 | #include <../../../../../../kernel/arch/ia64/include/bootinfo.h> |
4 | #include <../../../../../../kernel/arch/ia64/include/bootinfo.h> |
5 | 5 | ||
6 | #define KERNEL_LOAD_ADDRESS 0x4400000 |
6 | #define KERNEL_LOAD_ADDRESS 0x4400000 |
7 | 7 | ||
- | 8 | #define MEM_MAP_DESCRIPTOR_OFFSET_TYPE 0 |
|
- | 9 | #define MEM_MAP_DESCRIPTOR_OFFSET_BASE 8 |
|
- | 10 | #define MEM_MAP_DESCRIPTOR_OFFSET_PAGES 24 |
|
- | 11 | ||
- | 12 | ||
- | 13 | ||
8 | //Link image as a data array into hello - usefull with network boot |
14 | //Link image as a data array into hello - usefull with network boot |
9 | //#define IMAGE_LINKED |
15 | #define IMAGE_LINKED |
10 | 16 | ||
11 | bootinfo_t *bootinfo=(bootinfo_t *)BOOTINFO_ADDRESS; |
17 | bootinfo_t *bootinfo=(bootinfo_t *)BOOTINFO_ADDRESS; |
12 | 18 | ||
13 | 19 | ||
14 | #ifdef IMAGE_LINKED |
20 | #ifdef IMAGE_LINKED |
Line 175... | Line 181... | ||
175 | LibGetSalIpiBlock(&sapic); |
181 | LibGetSalIpiBlock(&sapic); |
176 | Print (L"SAPIC:%X\n", sapic); |
182 | Print (L"SAPIC:%X\n", sapic); |
177 | //bootinfo->sapic=sapic; |
183 | //bootinfo->sapic=sapic; |
178 | 184 | ||
179 | 185 | ||
180 | int wakeup_intno; |
186 | UINT64 wakeup_intno; |
181 | wakeup_intno=0xf0; |
187 | LibGetSalWakeupVector(&wakeup_intno); |
182 | Print (L"WAKEUP INTNO:%X\n", wakeup_intno); |
188 | Print (L"WAKEUP INTNO:%X\n", wakeup_intno); |
183 | //bootinfo->wakeup_intno=wakeup_intno; |
- | |
184 | 189 | ||
185 | 190 | ||
186 | 191 | ||
187 | 192 | ||
188 | 193 | ||
189 | { |
- | |
190 | UINTN cookie; |
194 | UINTN cookie; |
191 | void *p=(void *)KERNEL_LOAD_ADDRESS; |
195 | void *p=(void *)KERNEL_LOAD_ADDRESS; |
192 | UINTN mapsize,descsize; |
196 | UINTN mapsize,descsize; |
193 | UINT32 desver; |
197 | UINT32 desver; |
194 | EFI_STATUS status; |
198 | EFI_STATUS status; |
195 | EFI_MEMORY_DESCRIPTOR emd[1024]; |
- | |
196 | 199 | ||
197 | 200 | ||
198 | mapsize=1024*sizeof(emd); |
- | |
199 | 201 | ||
200 | status=BS->AllocatePages(AllocateAnyPages,EfiLoaderData,/*(HOSSize>>12)+1*/ 1,p); |
202 | status=BS->AllocatePages(AllocateAnyPages,EfiLoaderData,/*(HOSSize>>12)+1*/ 1,p); |
201 | if(EFI_ERROR(status)){ |
203 | if(EFI_ERROR(status)){ |
202 | Print(L"Error 0\n"); |
204 | Print(L"Error 0\n"); |
203 | if(status == EFI_OUT_OF_RESOURCES) Print(L"EFI_OUT_OF_RESOURCES\n"); |
205 | if(status == EFI_OUT_OF_RESOURCES) Print(L"EFI_OUT_OF_RESOURCES\n"); |
204 | if(status == EFI_INVALID_PARAMETER) Print(L"EFI_INVALID_PARAMETER\n"); |
206 | if(status == EFI_INVALID_PARAMETER) Print(L"EFI_INVALID_PARAMETER\n"); |
205 | if(status == EFI_NOT_FOUND) Print(L"EFI_NOT_FOUND\n"); |
207 | if(status == EFI_NOT_FOUND) Print(L"EFI_NOT_FOUND\n"); |
206 | return EFI_SUCCESS; |
208 | return EFI_SUCCESS; |
207 | } |
209 | } |
208 | 210 | ||
- | 211 | UINTN no_entryes; |
|
- | 212 | void * mds; |
|
209 | status=BS->GetMemoryMap(&mapsize,emd,&cookie,&descsize,&desver); |
213 | mds=LibMemoryMap(&no_entryes,&cookie,&descsize,&desver); |
- | 214 | ||
210 | if(EFI_ERROR(status)){ |
215 | for(i=0;i<no_entryes;i++) |
211 | Print(L"Error 1\n"); |
216 | { |
- | 217 | ||
- | 218 | unsigned int type=*((unsigned int *)(mds+i*descsize+MEM_MAP_DESCRIPTOR_OFFSET_TYPE)); |
|
- | 219 | unsigned long long base=*((unsigned long long *)(mds+i*descsize+MEM_MAP_DESCRIPTOR_OFFSET_BASE)); |
|
- | 220 | unsigned long long pages=*((unsigned long long *)(mds+i*descsize+MEM_MAP_DESCRIPTOR_OFFSET_PAGES)); |
|
212 | return EFI_SUCCESS; |
221 | Print(L"T:%02d %016llX %016llX\n",type,base,pages*EFI_PAGE_SIZE); |
- | 222 | ||
213 | } |
223 | } |
214 | status=BS->ExitBootServices(image,cookie); |
224 | status=BS->ExitBootServices(image,cookie); |
215 | if(EFI_ERROR(status)){ |
225 | if(EFI_ERROR(status)){ |
216 | Print(L"Error 2\n"); |
226 | Print(L"Error 2\n"); |
217 | return EFI_SUCCESS; |
227 | return EFI_SUCCESS; |
218 | } |
228 | } |
219 | 229 | ||
220 | } |
230 | |
221 | int a; |
231 | int a; |
222 | 232 | ||
223 | for(a=0;a<HOSSize;a++){ |
233 | for(a=0;a<HOSSize;a++){ |
224 | ((char *)(0x4400000))[a]=HOS[a]; |
234 | ((char *)(0x4400000))[a]=HOS[a]; |
225 | } |
235 | } |
226 | bootinfo->sapic=(unsigned long *)sapic; |
236 | bootinfo->sapic=(unsigned long *)sapic; |
227 | bootinfo->wakeup_intno=wakeup_intno; |
237 | bootinfo->wakeup_intno=wakeup_intno; |
228 | bootinfo->sys_freq=sys_freq; |
238 | bootinfo->sys_freq=sys_freq; |
229 | bootinfo->freq_scale=freq_scale; |
239 | bootinfo->freq_scale=freq_scale; |
- | 240 | ||
- | 241 | ||
- | 242 | bootinfo->memmap_items=0; |
|
- | 243 | ||
- | 244 | for(i=0;i<no_entryes;i++) |
|
- | 245 | { |
|
- | 246 | ||
- | 247 | unsigned int type=*((unsigned int *)(mds+i*descsize+MEM_MAP_DESCRIPTOR_OFFSET_TYPE)); |
|
- | 248 | unsigned long long base=*((unsigned long long *)(mds+i*descsize+MEM_MAP_DESCRIPTOR_OFFSET_BASE)); |
|
- | 249 | unsigned long long pages=*((unsigned long long *)(mds+i*descsize+MEM_MAP_DESCRIPTOR_OFFSET_PAGES)); |
|
- | 250 | ||
- | 251 | ||
- | 252 | ||
- | 253 | switch (type) |
|
- | 254 | { |
|
- | 255 | case EfiConventionalMemory: |
|
- | 256 | bootinfo->memmap[bootinfo->memmap_items].type=EFI_MEMMAP_FREE_MEM; |
|
- | 257 | bootinfo->memmap[bootinfo->memmap_items].base=base; |
|
- | 258 | bootinfo->memmap[bootinfo->memmap_items].size=pages*EFI_PAGE_SIZE; |
|
- | 259 | bootinfo->memmap_items++; |
|
- | 260 | break; |
|
- | 261 | case EfiMemoryMappedIO: |
|
- | 262 | bootinfo->memmap[bootinfo->memmap_items].type=EFI_MEMMAP_IO; |
|
- | 263 | bootinfo->memmap[bootinfo->memmap_items].base=base; |
|
- | 264 | bootinfo->memmap[bootinfo->memmap_items].size=pages*EFI_PAGE_SIZE; |
|
- | 265 | bootinfo->memmap_items++; |
|
- | 266 | break; |
|
- | 267 | case EfiMemoryMappedIOPortSpace: |
|
- | 268 | bootinfo->memmap[bootinfo->memmap_items].type=EFI_MEMMAP_IO_PORTS; |
|
- | 269 | bootinfo->memmap[bootinfo->memmap_items].base=base; |
|
- | 270 | bootinfo->memmap[bootinfo->memmap_items].size=pages*EFI_PAGE_SIZE; |
|
- | 271 | bootinfo->memmap_items++; |
|
- | 272 | break; |
|
- | 273 | ||
- | 274 | default : |
|
- | 275 | break; |
|
- | 276 | } |
|
- | 277 | ||
- | 278 | ||
- | 279 | ||
- | 280 | ||
- | 281 | ||
- | 282 | } |
|
- | 283 | ||
- | 284 | ||
230 | 285 | ||
231 | //Run Kernel |
286 | //Run Kernel |
232 | asm volatile( |
287 | asm volatile( |
233 | "nop.i 0x00 ;;\n" |
288 | "nop.i 0x00 ;;\n" |
234 | "movl r15 = 0x4400000 ;;\n" |
289 | "movl r15 = 0x4400000 ;;\n" |