Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 0c91cff in mainline


Ignore:
Timestamp:
2014-08-23T22:09:41Z (6 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
master
Children:
4cb938b
Parents:
c451d22
Message:

Use the actual clock-frequency when starting decrementer.

Location:
kernel/arch/ppc32
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/ppc32/include/arch/interrupt.h

    rc451d22 r0c91cff  
    4949#define VECTOR_DTLB_MISS_STORE      15
    5050
    51 extern void start_decrementer(void);
     51extern void decrementer_start(uint32_t);
     52extern void decrementer_restart(void);
    5253extern void interrupt_init(void);
    5354extern void extint_handler(unsigned int, istate_t *);
  • kernel/arch/ppc32/src/interrupt.c

    rc451d22 r0c91cff  
    3838#include <typedefs.h>
    3939#include <arch.h>
    40 #include <time/clock.h>
    4140#include <ipc/sysipc.h>
    4241#include <arch/drivers/pic.h>
     
    4645#include <log.h>
    4746
    48 void start_decrementer(void)
     47static uint32_t decrementer_value;
     48
     49void decrementer_start(uint32_t val)
     50{
     51        decrementer_value = val;
     52        decrementer_restart();
     53}
     54
     55void decrementer_restart(void)
    4956{
    5057        asm volatile (
    5158                "mtdec %[dec]\n"
    52                 :: [dec] "r" (1000)
     59                :: [dec] "r" (decrementer_value)
    5360        );
    5461}
     
    140147static void exception_decrementer(unsigned int n, istate_t *istate)
    141148{
    142         start_decrementer();
     149        decrementer_restart();
    143150        clock();
    144151}
  • kernel/arch/ppc32/src/ppc32.c

    rc451d22 r0c91cff  
    4747#include <mm/page.h>
    4848#include <mm/km.h>
     49#include <time/clock.h>
    4950#include <abi/proc/uarg.h>
    5051#include <console/console.h>
     
    99100        interrupt_init();
    100101       
     102        ofw_tree_node_t *cpus_node;
     103        ofw_tree_node_t *cpu_node;
     104        ofw_tree_property_t *freq_prop;
     105
     106        cpus_node = ofw_tree_lookup("/cpus");
     107        if (!cpus_node)
     108                panic("Could not find cpus node.");
     109
     110        cpu_node = cpus_node->child;
     111        if (!cpu_node)
     112                panic("Could not find first cpu.");     
     113
     114        freq_prop = ofw_tree_getprop(cpu_node, "clock-frequency");
     115        if (!freq_prop)
     116                panic("Could not get frequency property.");
     117
     118        uint32_t freq;
     119        freq = *((uint32_t *) freq_prop->value);
     120
    101121        /* Start decrementer */
    102         start_decrementer();
     122        decrementer_start(freq / HZ);
    103123}
    104124
Note: See TracChangeset for help on using the changeset viewer.