main.c (181398) | main.c (182020) |
---|---|
1/*- 2 * Initial implementation: 3 * Copyright (c) 2001 Robert Drehmel 4 * All rights reserved. 5 * 6 * As long as the above copyright statement and this notice remain 7 * unchanged, you can do what ever you want with this file. 8 */ 9 10#include <sys/cdefs.h> | 1/*- 2 * Initial implementation: 3 * Copyright (c) 2001 Robert Drehmel 4 * All rights reserved. 5 * 6 * As long as the above copyright statement and this notice remain 7 * unchanged, you can do what ever you want with this file. 8 */ 9 10#include <sys/cdefs.h> |
11__FBSDID("$FreeBSD: head/sys/boot/sparc64/loader/main.c 181398 2008-08-07 22:46:25Z marius $"); | 11__FBSDID("$FreeBSD: head/sys/boot/sparc64/loader/main.c 182020 2008-08-22 20:28:19Z marius $"); 12 |
12/* 13 * FreeBSD/sparc64 kernel loader - machine dependent part 14 * 15 * - implements copyin and readin functions that map kernel 16 * pages on demand. The machine independent code does not 17 * know the size of the kernel early enough to pre-enter 18 * TTEs and install just one 4MB mapping seemed to limiting 19 * to me. 20 */ 21 22#include <stand.h> 23#include <sys/exec.h> 24#include <sys/param.h> 25#include <sys/queue.h> 26#include <sys/linker.h> 27#include <sys/types.h> 28 29#include <vm/vm.h> 30#include <machine/asi.h> | 13/* 14 * FreeBSD/sparc64 kernel loader - machine dependent part 15 * 16 * - implements copyin and readin functions that map kernel 17 * pages on demand. The machine independent code does not 18 * know the size of the kernel early enough to pre-enter 19 * TTEs and install just one 4MB mapping seemed to limiting 20 * to me. 21 */ 22 23#include <stand.h> 24#include <sys/exec.h> 25#include <sys/param.h> 26#include <sys/queue.h> 27#include <sys/linker.h> 28#include <sys/types.h> 29 30#include <vm/vm.h> 31#include <machine/asi.h> |
31#include <machine/atomic.h> | |
32#include <machine/cpufunc.h> 33#include <machine/elf.h> 34#include <machine/lsu.h> 35#include <machine/metadata.h> 36#include <machine/tte.h> 37#include <machine/tlb.h> 38#include <machine/upa.h> 39 --- 393 unchanged lines hidden (view full) --- 433 curkva = va + len; 434 435 pa = (vm_offset_t)-1; 436 len += va & PAGE_MASK_4M; 437 va &= ~PAGE_MASK_4M; 438 while (len) { 439 if (dtlb_va_to_pa_sun4u(va) == (vm_offset_t)-1 || 440 itlb_va_to_pa_sun4u(va) == (vm_offset_t)-1) { | 32#include <machine/cpufunc.h> 33#include <machine/elf.h> 34#include <machine/lsu.h> 35#include <machine/metadata.h> 36#include <machine/tte.h> 37#include <machine/tlb.h> 38#include <machine/upa.h> 39 --- 393 unchanged lines hidden (view full) --- 433 curkva = va + len; 434 435 pa = (vm_offset_t)-1; 436 len += va & PAGE_MASK_4M; 437 va &= ~PAGE_MASK_4M; 438 while (len) { 439 if (dtlb_va_to_pa_sun4u(va) == (vm_offset_t)-1 || 440 itlb_va_to_pa_sun4u(va) == (vm_offset_t)-1) { |
441 /* Allocate a physical page, claim the virtual area */ | 441 /* Allocate a physical page, claim the virtual area. */ |
442 if (pa == (vm_offset_t)-1) { 443 pa = alloc_phys(PAGE_SIZE_4M, PAGE_SIZE_4M); 444 if (pa == (vm_offset_t)-1) 445 panic("%s: out of memory", __func__); 446 mva = claim_virt(va, PAGE_SIZE_4M, 0); 447 if (mva != va) 448 panic("%s: can't claim virtual page " 449 "(wanted %#lx, got %#lx)", 450 __func__, va, mva); | 442 if (pa == (vm_offset_t)-1) { 443 pa = alloc_phys(PAGE_SIZE_4M, PAGE_SIZE_4M); 444 if (pa == (vm_offset_t)-1) 445 panic("%s: out of memory", __func__); 446 mva = claim_virt(va, PAGE_SIZE_4M, 0); 447 if (mva != va) 448 panic("%s: can't claim virtual page " 449 "(wanted %#lx, got %#lx)", 450 __func__, va, mva); |
451 /* The mappings may have changed, be paranoid. */ | 451 /* 452 * The mappings may have changed, be paranoid. 453 */ |
452 continue; 453 } 454 /* 455 * Actually, we can only allocate two pages less at 456 * most (depending on the kernel TSB size). 457 */ 458 if (dtlb_slot >= dtlb_slot_max) 459 panic("%s: out of dtlb_slots", __func__); --- 88 unchanged lines hidden (view full) --- 548 &cpu, sizeof(cpu)) == -1) 549 panic("%s: can't get portid", __func__); 550 if (cpu == bootcpu) 551 break; 552 } 553 } 554 if (cpu != bootcpu) 555 panic("%s: no node for bootcpu?!?!", __func__); | 454 continue; 455 } 456 /* 457 * Actually, we can only allocate two pages less at 458 * most (depending on the kernel TSB size). 459 */ 460 if (dtlb_slot >= dtlb_slot_max) 461 panic("%s: out of dtlb_slots", __func__); --- 88 unchanged lines hidden (view full) --- 550 &cpu, sizeof(cpu)) == -1) 551 panic("%s: can't get portid", __func__); 552 if (cpu == bootcpu) 553 break; 554 } 555 } 556 if (cpu != bootcpu) 557 panic("%s: no node for bootcpu?!?!", __func__); |
558 |
|
556 if (OF_getprop(child, "#dtlb-entries", &dtlb_slot_max, 557 sizeof(dtlb_slot_max)) == -1 || 558 OF_getprop(child, "#itlb-entries", &itlb_slot_max, 559 sizeof(itlb_slot_max)) == -1) 560 panic("%s: can't get TLB slot max.", __func__); 561 dtlb_store = malloc(dtlb_slot_max * sizeof(*dtlb_store)); 562 itlb_store = malloc(itlb_slot_max * sizeof(*itlb_store)); 563 if (dtlb_store == NULL || itlb_store == NULL) --- 11 unchanged lines hidden (view full) --- 575int 576main(int (*openfirm)(void *)) 577{ 578 char bootpath[64]; 579 char compatible[32]; 580 struct devsw **dp; 581 582 /* | 559 if (OF_getprop(child, "#dtlb-entries", &dtlb_slot_max, 560 sizeof(dtlb_slot_max)) == -1 || 561 OF_getprop(child, "#itlb-entries", &itlb_slot_max, 562 sizeof(itlb_slot_max)) == -1) 563 panic("%s: can't get TLB slot max.", __func__); 564 dtlb_store = malloc(dtlb_slot_max * sizeof(*dtlb_store)); 565 itlb_store = malloc(itlb_slot_max * sizeof(*itlb_store)); 566 if (dtlb_store == NULL || itlb_store == NULL) --- 11 unchanged lines hidden (view full) --- 578int 579main(int (*openfirm)(void *)) 580{ 581 char bootpath[64]; 582 char compatible[32]; 583 struct devsw **dp; 584 585 /* |
583 * Tell the Open Firmware functions where they find the ofw gate. | 586 * Tell the Open Firmware functions where they find the OFW gate. |
584 */ 585 OF_init(openfirm); 586 587 archsw.arch_getdev = ofw_getdev; 588 archsw.arch_copyin = sparc64_copyin; 589 archsw.arch_copyout = ofw_copyout; 590 archsw.arch_readin = sparc64_readin; 591 archsw.arch_autoload = sparc64_autoload; --- 140 unchanged lines hidden --- | 587 */ 588 OF_init(openfirm); 589 590 archsw.arch_getdev = ofw_getdev; 591 archsw.arch_copyin = sparc64_copyin; 592 archsw.arch_copyout = ofw_copyout; 593 archsw.arch_readin = sparc64_readin; 594 archsw.arch_autoload = sparc64_autoload; --- 140 unchanged lines hidden --- |