Rev 3593 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3593 | Rev 3665 | ||
---|---|---|---|
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 | bootinfo->hello_configured=1; |
|
- | 241 | ||
- | 242 | ||
- | 243 | bootinfo->memmap_items=0; |
|
- | 244 | ||
- | 245 | for(i=0;i<no_entryes;i++) |
|
- | 246 | { |
|
- | 247 | ||
- | 248 | unsigned int type=*((unsigned int *)(mds+i*descsize+MEM_MAP_DESCRIPTOR_OFFSET_TYPE)); |
|
- | 249 | unsigned long long base=*((unsigned long long *)(mds+i*descsize+MEM_MAP_DESCRIPTOR_OFFSET_BASE)); |
|
- | 250 | unsigned long long pages=*((unsigned long long *)(mds+i*descsize+MEM_MAP_DESCRIPTOR_OFFSET_PAGES)); |
|
- | 251 | ||
- | 252 | ||
- | 253 | ||
- | 254 | switch (type) |
|
- | 255 | { |
|
- | 256 | case EfiConventionalMemory: |
|
- | 257 | bootinfo->memmap[bootinfo->memmap_items].type=EFI_MEMMAP_FREE_MEM; |
|
- | 258 | bootinfo->memmap[bootinfo->memmap_items].base=base; |
|
- | 259 | bootinfo->memmap[bootinfo->memmap_items].size=pages*EFI_PAGE_SIZE; |
|
- | 260 | bootinfo->memmap_items++; |
|
- | 261 | break; |
|
- | 262 | case EfiMemoryMappedIO: |
|
- | 263 | bootinfo->memmap[bootinfo->memmap_items].type=EFI_MEMMAP_IO; |
|
- | 264 | bootinfo->memmap[bootinfo->memmap_items].base=base; |
|
- | 265 | bootinfo->memmap[bootinfo->memmap_items].size=pages*EFI_PAGE_SIZE; |
|
- | 266 | bootinfo->memmap_items++; |
|
- | 267 | break; |
|
- | 268 | case EfiMemoryMappedIOPortSpace: |
|
- | 269 | bootinfo->memmap[bootinfo->memmap_items].type=EFI_MEMMAP_IO_PORTS; |
|
- | 270 | bootinfo->memmap[bootinfo->memmap_items].base=base; |
|
- | 271 | bootinfo->memmap[bootinfo->memmap_items].size=pages*EFI_PAGE_SIZE; |
|
- | 272 | bootinfo->memmap_items++; |
|
- | 273 | break; |
|
- | 274 | ||
- | 275 | default : |
|
- | 276 | break; |
|
- | 277 | } |
|
- | 278 | ||
- | 279 | ||
- | 280 | ||
- | 281 | ||
- | 282 | ||
- | 283 | } |
|
- | 284 | ||
- | 285 | ||
230 | 286 | ||
231 | //Run Kernel |
287 | //Run Kernel |
232 | asm volatile( |
288 | asm volatile( |
233 | "nop.i 0x00 ;;\n" |
289 | "nop.i 0x00 ;;\n" |
234 | "movl r15 = 0x4400000 ;;\n" |
290 | "movl r15 = 0x4400000 ;;\n" |