diff options
Diffstat (limited to 'arch/parisc/mm/init.c')
| -rw-r--r-- | arch/parisc/mm/init.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c index 3796be67cd53..631712562656 100644 --- a/arch/parisc/mm/init.c +++ b/arch/parisc/mm/init.c | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | * changed by Philipp Rumpf | 6 | * changed by Philipp Rumpf |
| 7 | * Copyright 1999 Philipp Rumpf (prumpf@tux.org) | 7 | * Copyright 1999 Philipp Rumpf (prumpf@tux.org) |
| 8 | * Copyright 2004 Randolph Chung (tausq@debian.org) | 8 | * Copyright 2004 Randolph Chung (tausq@debian.org) |
| 9 | * Copyright 2006 Helge Deller (deller@gmx.de) | ||
| 9 | * | 10 | * |
| 10 | */ | 11 | */ |
| 11 | 12 | ||
| @@ -371,8 +372,8 @@ static void __init setup_bootmem(void) | |||
| 371 | 372 | ||
| 372 | void free_initmem(void) | 373 | void free_initmem(void) |
| 373 | { | 374 | { |
| 374 | unsigned long addr; | 375 | unsigned long addr, init_begin, init_end; |
| 375 | 376 | ||
| 376 | printk(KERN_INFO "Freeing unused kernel memory: "); | 377 | printk(KERN_INFO "Freeing unused kernel memory: "); |
| 377 | 378 | ||
| 378 | #ifdef CONFIG_DEBUG_KERNEL | 379 | #ifdef CONFIG_DEBUG_KERNEL |
| @@ -395,8 +396,11 @@ void free_initmem(void) | |||
| 395 | local_irq_enable(); | 396 | local_irq_enable(); |
| 396 | #endif | 397 | #endif |
| 397 | 398 | ||
| 398 | addr = (unsigned long)(&__init_begin); | 399 | /* align __init_begin and __init_end to page size, |
| 399 | for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) { | 400 | ignoring linker script where we might have tried to save RAM */ |
| 401 | init_begin = PAGE_ALIGN((unsigned long)(&__init_begin)); | ||
| 402 | init_end = PAGE_ALIGN((unsigned long)(&__init_end)); | ||
| 403 | for (addr = init_begin; addr < init_end; addr += PAGE_SIZE) { | ||
| 400 | ClearPageReserved(virt_to_page(addr)); | 404 | ClearPageReserved(virt_to_page(addr)); |
| 401 | init_page_count(virt_to_page(addr)); | 405 | init_page_count(virt_to_page(addr)); |
| 402 | free_page(addr); | 406 | free_page(addr); |
| @@ -407,7 +411,7 @@ void free_initmem(void) | |||
| 407 | /* set up a new led state on systems shipped LED State panel */ | 411 | /* set up a new led state on systems shipped LED State panel */ |
| 408 | pdc_chassis_send_status(PDC_CHASSIS_DIRECT_BCOMPLETE); | 412 | pdc_chassis_send_status(PDC_CHASSIS_DIRECT_BCOMPLETE); |
| 409 | 413 | ||
| 410 | printk("%luk freed\n", (unsigned long)(&__init_end - &__init_begin) >> 10); | 414 | printk("%luk freed\n", (init_end - init_begin) >> 10); |
| 411 | } | 415 | } |
| 412 | 416 | ||
| 413 | 417 | ||
| @@ -639,11 +643,13 @@ static void __init map_pages(unsigned long start_vaddr, unsigned long start_padd | |||
| 639 | * Map the fault vector writable so we can | 643 | * Map the fault vector writable so we can |
| 640 | * write the HPMC checksum. | 644 | * write the HPMC checksum. |
| 641 | */ | 645 | */ |
| 646 | #if defined(CONFIG_PARISC_PAGE_SIZE_4KB) | ||
| 642 | if (address >= ro_start && address < ro_end | 647 | if (address >= ro_start && address < ro_end |
| 643 | && address != fv_addr | 648 | && address != fv_addr |
| 644 | && address != gw_addr) | 649 | && address != gw_addr) |
| 645 | pte = __mk_pte(address, PAGE_KERNEL_RO); | 650 | pte = __mk_pte(address, PAGE_KERNEL_RO); |
| 646 | else | 651 | else |
| 652 | #endif | ||
| 647 | pte = __mk_pte(address, pgprot); | 653 | pte = __mk_pte(address, pgprot); |
| 648 | 654 | ||
| 649 | if (address >= end_paddr) | 655 | if (address >= end_paddr) |
| @@ -874,8 +880,7 @@ unsigned long alloc_sid(void) | |||
| 874 | flush_tlb_all(); /* flush_tlb_all() calls recycle_sids() */ | 880 | flush_tlb_all(); /* flush_tlb_all() calls recycle_sids() */ |
| 875 | spin_lock(&sid_lock); | 881 | spin_lock(&sid_lock); |
| 876 | } | 882 | } |
| 877 | if (free_space_ids == 0) | 883 | BUG_ON(free_space_ids == 0); |
| 878 | BUG(); | ||
| 879 | } | 884 | } |
| 880 | 885 | ||
| 881 | free_space_ids--; | 886 | free_space_ids--; |
| @@ -899,8 +904,7 @@ void free_sid(unsigned long spaceid) | |||
| 899 | 904 | ||
| 900 | spin_lock(&sid_lock); | 905 | spin_lock(&sid_lock); |
| 901 | 906 | ||
| 902 | if (*dirty_space_offset & (1L << index)) | 907 | BUG_ON(*dirty_space_offset & (1L << index)); /* attempt to free space id twice */ |
| 903 | BUG(); /* attempt to free space id twice */ | ||
| 904 | 908 | ||
| 905 | *dirty_space_offset |= (1L << index); | 909 | *dirty_space_offset |= (1L << index); |
| 906 | dirty_space_ids++; | 910 | dirty_space_ids++; |
| @@ -975,7 +979,7 @@ static void recycle_sids(void) | |||
| 975 | 979 | ||
| 976 | static unsigned long recycle_ndirty; | 980 | static unsigned long recycle_ndirty; |
| 977 | static unsigned long recycle_dirty_array[SID_ARRAY_SIZE]; | 981 | static unsigned long recycle_dirty_array[SID_ARRAY_SIZE]; |
| 978 | static unsigned int recycle_inuse = 0; | 982 | static unsigned int recycle_inuse; |
| 979 | 983 | ||
| 980 | void flush_tlb_all(void) | 984 | void flush_tlb_all(void) |
| 981 | { | 985 | { |
| @@ -984,9 +988,7 @@ void flush_tlb_all(void) | |||
| 984 | do_recycle = 0; | 988 | do_recycle = 0; |
| 985 | spin_lock(&sid_lock); | 989 | spin_lock(&sid_lock); |
| 986 | if (dirty_space_ids > RECYCLE_THRESHOLD) { | 990 | if (dirty_space_ids > RECYCLE_THRESHOLD) { |
| 987 | if (recycle_inuse) { | 991 | BUG_ON(recycle_inuse); /* FIXME: Use a semaphore/wait queue here */ |
| 988 | BUG(); /* FIXME: Use a semaphore/wait queue here */ | ||
| 989 | } | ||
| 990 | get_dirty_sids(&recycle_ndirty,recycle_dirty_array); | 992 | get_dirty_sids(&recycle_ndirty,recycle_dirty_array); |
| 991 | recycle_inuse++; | 993 | recycle_inuse++; |
| 992 | do_recycle++; | 994 | do_recycle++; |
