diff options
| -rw-r--r-- | arch/parisc/Kconfig | 4 | ||||
| -rw-r--r-- | arch/parisc/kernel/cache.c | 31 | ||||
| -rw-r--r-- | arch/parisc/kernel/inventory.c | 8 | ||||
| -rw-r--r-- | arch/parisc/kernel/pacache.S | 37 | ||||
| -rw-r--r-- | arch/parisc/kernel/pci-dma.c | 2 | ||||
| -rw-r--r-- | arch/parisc/kernel/setup.c | 4 | ||||
| -rw-r--r-- | arch/parisc/kernel/time.c | 57 |
7 files changed, 57 insertions, 86 deletions
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig index 71c4a3aa3752..a14b86587013 100644 --- a/arch/parisc/Kconfig +++ b/arch/parisc/Kconfig | |||
| @@ -34,7 +34,9 @@ config PARISC | |||
| 34 | select HAVE_ARCH_HASH | 34 | select HAVE_ARCH_HASH |
| 35 | select HAVE_ARCH_SECCOMP_FILTER | 35 | select HAVE_ARCH_SECCOMP_FILTER |
| 36 | select HAVE_ARCH_TRACEHOOK | 36 | select HAVE_ARCH_TRACEHOOK |
| 37 | select HAVE_UNSTABLE_SCHED_CLOCK if (SMP || !64BIT) | 37 | select GENERIC_SCHED_CLOCK |
| 38 | select HAVE_UNSTABLE_SCHED_CLOCK if SMP | ||
| 39 | select GENERIC_CLOCKEVENTS | ||
| 38 | select ARCH_NO_COHERENT_DMA_MMAP | 40 | select ARCH_NO_COHERENT_DMA_MMAP |
| 39 | select CPU_NO_EFFICIENT_FFS | 41 | select CPU_NO_EFFICIENT_FFS |
| 40 | 42 | ||
diff --git a/arch/parisc/kernel/cache.c b/arch/parisc/kernel/cache.c index 629eb464d5ba..c263301648f3 100644 --- a/arch/parisc/kernel/cache.c +++ b/arch/parisc/kernel/cache.c | |||
| @@ -369,6 +369,7 @@ void __init parisc_setup_cache_timing(void) | |||
| 369 | { | 369 | { |
| 370 | unsigned long rangetime, alltime; | 370 | unsigned long rangetime, alltime; |
| 371 | unsigned long size, start; | 371 | unsigned long size, start; |
| 372 | unsigned long threshold; | ||
| 372 | 373 | ||
| 373 | alltime = mfctl(16); | 374 | alltime = mfctl(16); |
| 374 | flush_data_cache(); | 375 | flush_data_cache(); |
| @@ -382,17 +383,12 @@ void __init parisc_setup_cache_timing(void) | |||
| 382 | printk(KERN_DEBUG "Whole cache flush %lu cycles, flushing %lu bytes %lu cycles\n", | 383 | printk(KERN_DEBUG "Whole cache flush %lu cycles, flushing %lu bytes %lu cycles\n", |
| 383 | alltime, size, rangetime); | 384 | alltime, size, rangetime); |
| 384 | 385 | ||
| 385 | /* Racy, but if we see an intermediate value, it's ok too... */ | 386 | threshold = L1_CACHE_ALIGN(size * alltime / rangetime); |
| 386 | parisc_cache_flush_threshold = size * alltime / rangetime; | 387 | if (threshold > cache_info.dc_size) |
| 387 | 388 | threshold = cache_info.dc_size; | |
| 388 | parisc_cache_flush_threshold = L1_CACHE_ALIGN(parisc_cache_flush_threshold); | 389 | if (threshold) |
| 389 | if (!parisc_cache_flush_threshold) | 390 | parisc_cache_flush_threshold = threshold; |
| 390 | parisc_cache_flush_threshold = FLUSH_THRESHOLD; | 391 | printk(KERN_INFO "Cache flush threshold set to %lu KiB\n", |
| 391 | |||
| 392 | if (parisc_cache_flush_threshold > cache_info.dc_size) | ||
| 393 | parisc_cache_flush_threshold = cache_info.dc_size; | ||
| 394 | |||
| 395 | printk(KERN_INFO "Setting cache flush threshold to %lu kB\n", | ||
| 396 | parisc_cache_flush_threshold/1024); | 392 | parisc_cache_flush_threshold/1024); |
| 397 | 393 | ||
| 398 | /* calculate TLB flush threshold */ | 394 | /* calculate TLB flush threshold */ |
| @@ -401,7 +397,7 @@ void __init parisc_setup_cache_timing(void) | |||
| 401 | flush_tlb_all(); | 397 | flush_tlb_all(); |
| 402 | alltime = mfctl(16) - alltime; | 398 | alltime = mfctl(16) - alltime; |
| 403 | 399 | ||
| 404 | size = PAGE_SIZE; | 400 | size = 0; |
| 405 | start = (unsigned long) _text; | 401 | start = (unsigned long) _text; |
| 406 | rangetime = mfctl(16); | 402 | rangetime = mfctl(16); |
| 407 | while (start < (unsigned long) _end) { | 403 | while (start < (unsigned long) _end) { |
| @@ -414,13 +410,10 @@ void __init parisc_setup_cache_timing(void) | |||
| 414 | printk(KERN_DEBUG "Whole TLB flush %lu cycles, flushing %lu bytes %lu cycles\n", | 410 | printk(KERN_DEBUG "Whole TLB flush %lu cycles, flushing %lu bytes %lu cycles\n", |
| 415 | alltime, size, rangetime); | 411 | alltime, size, rangetime); |
| 416 | 412 | ||
| 417 | parisc_tlb_flush_threshold = size * alltime / rangetime; | 413 | threshold = PAGE_ALIGN(num_online_cpus() * size * alltime / rangetime); |
| 418 | parisc_tlb_flush_threshold *= num_online_cpus(); | 414 | if (threshold) |
| 419 | parisc_tlb_flush_threshold = PAGE_ALIGN(parisc_tlb_flush_threshold); | 415 | parisc_tlb_flush_threshold = threshold; |
| 420 | if (!parisc_tlb_flush_threshold) | 416 | printk(KERN_INFO "TLB flush threshold set to %lu KiB\n", |
| 421 | parisc_tlb_flush_threshold = FLUSH_TLB_THRESHOLD; | ||
| 422 | |||
| 423 | printk(KERN_INFO "Setting TLB flush threshold to %lu kB\n", | ||
| 424 | parisc_tlb_flush_threshold/1024); | 417 | parisc_tlb_flush_threshold/1024); |
| 425 | } | 418 | } |
| 426 | 419 | ||
diff --git a/arch/parisc/kernel/inventory.c b/arch/parisc/kernel/inventory.c index 545f9d2fe711..c05d1876d27c 100644 --- a/arch/parisc/kernel/inventory.c +++ b/arch/parisc/kernel/inventory.c | |||
| @@ -58,7 +58,7 @@ void __init setup_pdc(void) | |||
| 58 | status = pdc_system_map_find_mods(&module_result, &module_path, 0); | 58 | status = pdc_system_map_find_mods(&module_result, &module_path, 0); |
| 59 | if (status == PDC_OK) { | 59 | if (status == PDC_OK) { |
| 60 | pdc_type = PDC_TYPE_SYSTEM_MAP; | 60 | pdc_type = PDC_TYPE_SYSTEM_MAP; |
| 61 | printk("System Map.\n"); | 61 | pr_cont("System Map.\n"); |
| 62 | return; | 62 | return; |
| 63 | } | 63 | } |
| 64 | 64 | ||
| @@ -77,7 +77,7 @@ void __init setup_pdc(void) | |||
| 77 | status = pdc_pat_cell_get_number(&cell_info); | 77 | status = pdc_pat_cell_get_number(&cell_info); |
| 78 | if (status == PDC_OK) { | 78 | if (status == PDC_OK) { |
| 79 | pdc_type = PDC_TYPE_PAT; | 79 | pdc_type = PDC_TYPE_PAT; |
| 80 | printk("64 bit PAT.\n"); | 80 | pr_cont("64 bit PAT.\n"); |
| 81 | return; | 81 | return; |
| 82 | } | 82 | } |
| 83 | #endif | 83 | #endif |
| @@ -97,12 +97,12 @@ void __init setup_pdc(void) | |||
| 97 | case 0xC: /* 715/64, at least */ | 97 | case 0xC: /* 715/64, at least */ |
| 98 | 98 | ||
| 99 | pdc_type = PDC_TYPE_SNAKE; | 99 | pdc_type = PDC_TYPE_SNAKE; |
| 100 | printk("Snake.\n"); | 100 | pr_cont("Snake.\n"); |
| 101 | return; | 101 | return; |
| 102 | 102 | ||
| 103 | default: /* Everything else */ | 103 | default: /* Everything else */ |
| 104 | 104 | ||
| 105 | printk("Unsupported.\n"); | 105 | pr_cont("Unsupported.\n"); |
| 106 | panic("If this is a 64-bit machine, please try a 64-bit kernel.\n"); | 106 | panic("If this is a 64-bit machine, please try a 64-bit kernel.\n"); |
| 107 | } | 107 | } |
| 108 | } | 108 | } |
diff --git a/arch/parisc/kernel/pacache.S b/arch/parisc/kernel/pacache.S index 985e06da37f5..1b39a2acaadf 100644 --- a/arch/parisc/kernel/pacache.S +++ b/arch/parisc/kernel/pacache.S | |||
| @@ -96,7 +96,7 @@ fitmanyloop: /* Loop if LOOP >= 2 */ | |||
| 96 | 96 | ||
| 97 | fitmanymiddle: /* Loop if LOOP >= 2 */ | 97 | fitmanymiddle: /* Loop if LOOP >= 2 */ |
| 98 | addib,COND(>) -1, %r31, fitmanymiddle /* Adjusted inner loop decr */ | 98 | addib,COND(>) -1, %r31, fitmanymiddle /* Adjusted inner loop decr */ |
| 99 | pitlbe 0(%sr1, %r28) | 99 | pitlbe %r0(%sr1, %r28) |
| 100 | pitlbe,m %arg1(%sr1, %r28) /* Last pitlbe and addr adjust */ | 100 | pitlbe,m %arg1(%sr1, %r28) /* Last pitlbe and addr adjust */ |
| 101 | addib,COND(>) -1, %r29, fitmanymiddle /* Middle loop decr */ | 101 | addib,COND(>) -1, %r29, fitmanymiddle /* Middle loop decr */ |
| 102 | copy %arg3, %r31 /* Re-init inner loop count */ | 102 | copy %arg3, %r31 /* Re-init inner loop count */ |
| @@ -139,7 +139,7 @@ fdtmanyloop: /* Loop if LOOP >= 2 */ | |||
| 139 | 139 | ||
| 140 | fdtmanymiddle: /* Loop if LOOP >= 2 */ | 140 | fdtmanymiddle: /* Loop if LOOP >= 2 */ |
| 141 | addib,COND(>) -1, %r31, fdtmanymiddle /* Adjusted inner loop decr */ | 141 | addib,COND(>) -1, %r31, fdtmanymiddle /* Adjusted inner loop decr */ |
| 142 | pdtlbe 0(%sr1, %r28) | 142 | pdtlbe %r0(%sr1, %r28) |
| 143 | pdtlbe,m %arg1(%sr1, %r28) /* Last pdtlbe and addr adjust */ | 143 | pdtlbe,m %arg1(%sr1, %r28) /* Last pdtlbe and addr adjust */ |
| 144 | addib,COND(>) -1, %r29, fdtmanymiddle /* Middle loop decr */ | 144 | addib,COND(>) -1, %r29, fdtmanymiddle /* Middle loop decr */ |
| 145 | copy %arg3, %r31 /* Re-init inner loop count */ | 145 | copy %arg3, %r31 /* Re-init inner loop count */ |
| @@ -626,12 +626,12 @@ ENTRY_CFI(copy_user_page_asm) | |||
| 626 | /* Purge any old translations */ | 626 | /* Purge any old translations */ |
| 627 | 627 | ||
| 628 | #ifdef CONFIG_PA20 | 628 | #ifdef CONFIG_PA20 |
| 629 | pdtlb,l 0(%r28) | 629 | pdtlb,l %r0(%r28) |
| 630 | pdtlb,l 0(%r29) | 630 | pdtlb,l %r0(%r29) |
| 631 | #else | 631 | #else |
| 632 | tlb_lock %r20,%r21,%r22 | 632 | tlb_lock %r20,%r21,%r22 |
| 633 | pdtlb 0(%r28) | 633 | pdtlb %r0(%r28) |
| 634 | pdtlb 0(%r29) | 634 | pdtlb %r0(%r29) |
| 635 | tlb_unlock %r20,%r21,%r22 | 635 | tlb_unlock %r20,%r21,%r22 |
| 636 | #endif | 636 | #endif |
| 637 | 637 | ||
| @@ -774,10 +774,10 @@ ENTRY_CFI(clear_user_page_asm) | |||
| 774 | /* Purge any old translation */ | 774 | /* Purge any old translation */ |
| 775 | 775 | ||
| 776 | #ifdef CONFIG_PA20 | 776 | #ifdef CONFIG_PA20 |
| 777 | pdtlb,l 0(%r28) | 777 | pdtlb,l %r0(%r28) |
| 778 | #else | 778 | #else |
| 779 | tlb_lock %r20,%r21,%r22 | 779 | tlb_lock %r20,%r21,%r22 |
| 780 | pdtlb 0(%r28) | 780 | pdtlb %r0(%r28) |
| 781 | tlb_unlock %r20,%r21,%r22 | 781 | tlb_unlock %r20,%r21,%r22 |
| 782 | #endif | 782 | #endif |
| 783 | 783 | ||
| @@ -858,10 +858,10 @@ ENTRY_CFI(flush_dcache_page_asm) | |||
| 858 | /* Purge any old translation */ | 858 | /* Purge any old translation */ |
| 859 | 859 | ||
| 860 | #ifdef CONFIG_PA20 | 860 | #ifdef CONFIG_PA20 |
| 861 | pdtlb,l 0(%r28) | 861 | pdtlb,l %r0(%r28) |
| 862 | #else | 862 | #else |
| 863 | tlb_lock %r20,%r21,%r22 | 863 | tlb_lock %r20,%r21,%r22 |
| 864 | pdtlb 0(%r28) | 864 | pdtlb %r0(%r28) |
| 865 | tlb_unlock %r20,%r21,%r22 | 865 | tlb_unlock %r20,%r21,%r22 |
| 866 | #endif | 866 | #endif |
| 867 | 867 | ||
| @@ -898,10 +898,10 @@ ENTRY_CFI(flush_dcache_page_asm) | |||
| 898 | sync | 898 | sync |
| 899 | 899 | ||
| 900 | #ifdef CONFIG_PA20 | 900 | #ifdef CONFIG_PA20 |
| 901 | pdtlb,l 0(%r25) | 901 | pdtlb,l %r0(%r25) |
| 902 | #else | 902 | #else |
| 903 | tlb_lock %r20,%r21,%r22 | 903 | tlb_lock %r20,%r21,%r22 |
| 904 | pdtlb 0(%r25) | 904 | pdtlb %r0(%r25) |
| 905 | tlb_unlock %r20,%r21,%r22 | 905 | tlb_unlock %r20,%r21,%r22 |
| 906 | #endif | 906 | #endif |
| 907 | 907 | ||
| @@ -931,13 +931,18 @@ ENTRY_CFI(flush_icache_page_asm) | |||
| 931 | depwi 0, 31,PAGE_SHIFT, %r28 /* Clear any offset bits */ | 931 | depwi 0, 31,PAGE_SHIFT, %r28 /* Clear any offset bits */ |
| 932 | #endif | 932 | #endif |
| 933 | 933 | ||
| 934 | /* Purge any old translation */ | 934 | /* Purge any old translation. Note that the FIC instruction |
| 935 | * may use either the instruction or data TLB. Given that we | ||
| 936 | * have a flat address space, it's not clear which TLB will be | ||
| 937 | * used. So, we purge both entries. */ | ||
| 935 | 938 | ||
| 936 | #ifdef CONFIG_PA20 | 939 | #ifdef CONFIG_PA20 |
| 940 | pdtlb,l %r0(%r28) | ||
| 937 | pitlb,l %r0(%sr4,%r28) | 941 | pitlb,l %r0(%sr4,%r28) |
| 938 | #else | 942 | #else |
| 939 | tlb_lock %r20,%r21,%r22 | 943 | tlb_lock %r20,%r21,%r22 |
| 940 | pitlb (%sr4,%r28) | 944 | pdtlb %r0(%r28) |
| 945 | pitlb %r0(%sr4,%r28) | ||
| 941 | tlb_unlock %r20,%r21,%r22 | 946 | tlb_unlock %r20,%r21,%r22 |
| 942 | #endif | 947 | #endif |
| 943 | 948 | ||
| @@ -976,10 +981,12 @@ ENTRY_CFI(flush_icache_page_asm) | |||
| 976 | sync | 981 | sync |
| 977 | 982 | ||
| 978 | #ifdef CONFIG_PA20 | 983 | #ifdef CONFIG_PA20 |
| 984 | pdtlb,l %r0(%r28) | ||
| 979 | pitlb,l %r0(%sr4,%r25) | 985 | pitlb,l %r0(%sr4,%r25) |
| 980 | #else | 986 | #else |
| 981 | tlb_lock %r20,%r21,%r22 | 987 | tlb_lock %r20,%r21,%r22 |
| 982 | pitlb (%sr4,%r25) | 988 | pdtlb %r0(%r28) |
| 989 | pitlb %r0(%sr4,%r25) | ||
| 983 | tlb_unlock %r20,%r21,%r22 | 990 | tlb_unlock %r20,%r21,%r22 |
| 984 | #endif | 991 | #endif |
| 985 | 992 | ||
diff --git a/arch/parisc/kernel/pci-dma.c b/arch/parisc/kernel/pci-dma.c index 02d9ed0f3949..494ff6e8c88a 100644 --- a/arch/parisc/kernel/pci-dma.c +++ b/arch/parisc/kernel/pci-dma.c | |||
| @@ -95,8 +95,8 @@ static inline int map_pte_uncached(pte_t * pte, | |||
| 95 | 95 | ||
| 96 | if (!pte_none(*pte)) | 96 | if (!pte_none(*pte)) |
| 97 | printk(KERN_ERR "map_pte_uncached: page already exists\n"); | 97 | printk(KERN_ERR "map_pte_uncached: page already exists\n"); |
| 98 | set_pte(pte, __mk_pte(*paddr_ptr, PAGE_KERNEL_UNC)); | ||
| 99 | purge_tlb_start(flags); | 98 | purge_tlb_start(flags); |
| 99 | set_pte(pte, __mk_pte(*paddr_ptr, PAGE_KERNEL_UNC)); | ||
| 100 | pdtlb_kernel(orig_vaddr); | 100 | pdtlb_kernel(orig_vaddr); |
| 101 | purge_tlb_end(flags); | 101 | purge_tlb_end(flags); |
| 102 | vaddr += PAGE_SIZE; | 102 | vaddr += PAGE_SIZE; |
diff --git a/arch/parisc/kernel/setup.c b/arch/parisc/kernel/setup.c index 81d6f6391944..2e66a887788e 100644 --- a/arch/parisc/kernel/setup.c +++ b/arch/parisc/kernel/setup.c | |||
| @@ -334,6 +334,10 @@ static int __init parisc_init(void) | |||
| 334 | /* tell PDC we're Linux. Nevermind failure. */ | 334 | /* tell PDC we're Linux. Nevermind failure. */ |
| 335 | pdc_stable_write(0x40, &osid, sizeof(osid)); | 335 | pdc_stable_write(0x40, &osid, sizeof(osid)); |
| 336 | 336 | ||
| 337 | /* start with known state */ | ||
| 338 | flush_cache_all_local(); | ||
| 339 | flush_tlb_all_local(NULL); | ||
| 340 | |||
| 337 | processor_init(); | 341 | processor_init(); |
| 338 | #ifdef CONFIG_SMP | 342 | #ifdef CONFIG_SMP |
| 339 | pr_info("CPU(s): %d out of %d %s at %d.%06d MHz online\n", | 343 | pr_info("CPU(s): %d out of %d %s at %d.%06d MHz online\n", |
diff --git a/arch/parisc/kernel/time.c b/arch/parisc/kernel/time.c index 9b63b876a13a..325f30d82b64 100644 --- a/arch/parisc/kernel/time.c +++ b/arch/parisc/kernel/time.c | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
| 15 | #include <linux/rtc.h> | 15 | #include <linux/rtc.h> |
| 16 | #include <linux/sched.h> | 16 | #include <linux/sched.h> |
| 17 | #include <linux/sched_clock.h> | ||
| 17 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
| 18 | #include <linux/param.h> | 19 | #include <linux/param.h> |
| 19 | #include <linux/string.h> | 20 | #include <linux/string.h> |
| @@ -39,18 +40,6 @@ | |||
| 39 | 40 | ||
| 40 | static unsigned long clocktick __read_mostly; /* timer cycles per tick */ | 41 | static unsigned long clocktick __read_mostly; /* timer cycles per tick */ |
| 41 | 42 | ||
| 42 | #ifndef CONFIG_64BIT | ||
| 43 | /* | ||
| 44 | * The processor-internal cycle counter (Control Register 16) is used as time | ||
| 45 | * source for the sched_clock() function. This register is 64bit wide on a | ||
| 46 | * 64-bit kernel and 32bit on a 32-bit kernel. Since sched_clock() always | ||
| 47 | * requires a 64bit counter we emulate on the 32-bit kernel the higher 32bits | ||
| 48 | * with a per-cpu variable which we increase every time the counter | ||
| 49 | * wraps-around (which happens every ~4 secounds). | ||
| 50 | */ | ||
| 51 | static DEFINE_PER_CPU(unsigned long, cr16_high_32_bits); | ||
| 52 | #endif | ||
| 53 | |||
| 54 | /* | 43 | /* |
| 55 | * We keep time on PA-RISC Linux by using the Interval Timer which is | 44 | * We keep time on PA-RISC Linux by using the Interval Timer which is |
| 56 | * a pair of registers; one is read-only and one is write-only; both | 45 | * a pair of registers; one is read-only and one is write-only; both |
| @@ -121,12 +110,6 @@ irqreturn_t __irq_entry timer_interrupt(int irq, void *dev_id) | |||
| 121 | */ | 110 | */ |
| 122 | mtctl(next_tick, 16); | 111 | mtctl(next_tick, 16); |
| 123 | 112 | ||
| 124 | #if !defined(CONFIG_64BIT) | ||
| 125 | /* check for overflow on a 32bit kernel (every ~4 seconds). */ | ||
| 126 | if (unlikely(next_tick < now)) | ||
| 127 | this_cpu_inc(cr16_high_32_bits); | ||
| 128 | #endif | ||
| 129 | |||
| 130 | /* Skip one clocktick on purpose if we missed next_tick. | 113 | /* Skip one clocktick on purpose if we missed next_tick. |
| 131 | * The new CR16 must be "later" than current CR16 otherwise | 114 | * The new CR16 must be "later" than current CR16 otherwise |
| 132 | * itimer would not fire until CR16 wrapped - e.g 4 seconds | 115 | * itimer would not fire until CR16 wrapped - e.g 4 seconds |
| @@ -208,7 +191,7 @@ EXPORT_SYMBOL(profile_pc); | |||
| 208 | 191 | ||
| 209 | /* clock source code */ | 192 | /* clock source code */ |
| 210 | 193 | ||
| 211 | static cycle_t read_cr16(struct clocksource *cs) | 194 | static cycle_t notrace read_cr16(struct clocksource *cs) |
| 212 | { | 195 | { |
| 213 | return get_cycles(); | 196 | return get_cycles(); |
| 214 | } | 197 | } |
| @@ -287,26 +270,9 @@ void read_persistent_clock(struct timespec *ts) | |||
| 287 | } | 270 | } |
| 288 | 271 | ||
| 289 | 272 | ||
| 290 | /* | 273 | static u64 notrace read_cr16_sched_clock(void) |
| 291 | * sched_clock() framework | ||
| 292 | */ | ||
| 293 | |||
| 294 | static u32 cyc2ns_mul __read_mostly; | ||
| 295 | static u32 cyc2ns_shift __read_mostly; | ||
| 296 | |||
| 297 | u64 sched_clock(void) | ||
| 298 | { | 274 | { |
| 299 | u64 now; | 275 | return get_cycles(); |
| 300 | |||
| 301 | /* Get current cycle counter (Control Register 16). */ | ||
| 302 | #ifdef CONFIG_64BIT | ||
| 303 | now = mfctl(16); | ||
| 304 | #else | ||
| 305 | now = mfctl(16) + (((u64) this_cpu_read(cr16_high_32_bits)) << 32); | ||
| 306 | #endif | ||
| 307 | |||
| 308 | /* return the value in ns (cycles_2_ns) */ | ||
| 309 | return mul_u64_u32_shr(now, cyc2ns_mul, cyc2ns_shift); | ||
| 310 | } | 276 | } |
| 311 | 277 | ||
| 312 | 278 | ||
| @@ -316,17 +282,16 @@ u64 sched_clock(void) | |||
| 316 | 282 | ||
| 317 | void __init time_init(void) | 283 | void __init time_init(void) |
| 318 | { | 284 | { |
| 319 | unsigned long current_cr16_khz; | 285 | unsigned long cr16_hz; |
| 320 | 286 | ||
| 321 | current_cr16_khz = PAGE0->mem_10msec/10; /* kHz */ | ||
| 322 | clocktick = (100 * PAGE0->mem_10msec) / HZ; | 287 | clocktick = (100 * PAGE0->mem_10msec) / HZ; |
| 323 | |||
| 324 | /* calculate mult/shift values for cr16 */ | ||
| 325 | clocks_calc_mult_shift(&cyc2ns_mul, &cyc2ns_shift, current_cr16_khz, | ||
| 326 | NSEC_PER_MSEC, 0); | ||
| 327 | |||
| 328 | start_cpu_itimer(); /* get CPU 0 started */ | 288 | start_cpu_itimer(); /* get CPU 0 started */ |
| 329 | 289 | ||
| 290 | cr16_hz = 100 * PAGE0->mem_10msec; /* Hz */ | ||
| 291 | |||
| 330 | /* register at clocksource framework */ | 292 | /* register at clocksource framework */ |
| 331 | clocksource_register_khz(&clocksource_cr16, current_cr16_khz); | 293 | clocksource_register_hz(&clocksource_cr16, cr16_hz); |
| 294 | |||
| 295 | /* register as sched_clock source */ | ||
| 296 | sched_clock_register(read_cr16_sched_clock, BITS_PER_LONG, cr16_hz); | ||
| 332 | } | 297 | } |
