Changeset e4ddfa8 in mainline


Ignore:
Timestamp:
2006-03-14T19:06:16Z (19 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1065603e
Parents:
edc89bd
Message:

ppc32: initial stack, memory barriers, atomic operations, stack offset fix

Files:
10 edited

Legend:

Unmodified
Added
Removed
  • arch/ppc32/include/atomic.h

    redc89bd re4ddfa8  
    3434typedef struct { volatile __u32 count; } atomic_t;
    3535
    36 /*
    37  * TODO: these are just placeholders for real implementations of atomic_inc and atomic_dec.
    38  * WARNING: the following functions cause the code to be preemption-unsafe !!!
    39  */
     36static inline void atomic_inc(atomic_t *val) {
     37        __u32 tmp;
    4038
    41 static inline void atomic_inc(atomic_t *val) {
    42         val->count++;
     39        asm __volatile__ (
     40                "1:\n"
     41                "lwarx %0, 0, %2\n"
     42                "addic %0, %0, 1\n"
     43                "stwcx. %0, 0, %2\n"
     44                "bne- 1b"
     45                : "=&r" (tmp), "=m" (val->count)
     46                : "r" (&val->count), "m" (val->count)
     47                : "cc");
    4348}
    4449
    4550static inline void atomic_dec(atomic_t *val) {
    46         val->count--;
     51        __u32 tmp;
     52
     53        asm __volatile__(
     54                "1:\n"
     55                "lwarx %0, 0, %2\n"
     56                "addic %0, %0, -1\n"
     57                "stwcx. %0, 0, %2\n"
     58                "bne- 1b"
     59                : "=&r" (tmp), "=m" (val->count)
     60                : "r" (&val->count), "m" (val->count)
     61                : "cc");
    4762}
    4863
  • arch/ppc32/include/barrier.h

    redc89bd re4ddfa8  
    3333#define CS_LEAVE_BARRIER()      __asm__ volatile ("" ::: "memory")
    3434
    35 #define memory_barrier()
    36 #define read_barrier()
    37 #define write_barrier()
     35#define memory_barrier() __asm__ volatile ("sync" ::: "memory")
     36#define read_barrier() __asm__ volatile ("sync" ::: "memory")
     37#define write_barrier() __asm__ volatile ("eieio" ::: "memory")
    3838
    3939#endif
  • arch/ppc32/include/boot/boot.h

    redc89bd re4ddfa8  
    3232#define BOOT_OFFSET             0x2000
    3333
     34/* Temporary stack size for boot process */
     35#define TEMP_STACK_SIZE 0x100
     36
    3437#endif
  • arch/ppc32/include/context.h

    redc89bd re4ddfa8  
    3434#endif
    3535
    36 #define SP_DELTA        4
     36#define SP_DELTA        8
    3737
    3838struct context {
  • arch/ppc32/include/drivers/cuda.h

    redc89bd re4ddfa8  
    3131
    3232
     33void cuda_init(void);
     34
     35
    3336#endif
  • arch/ppc32/src/boot/boot.S

    redc89bd re4ddfa8  
    3636.global kernel_image_start
    3737kernel_image_start:
     38
     39        # load temporary stack
     40       
     41        lis sp, end_stack@ha
     42        addi sp, sp, end_stack@l
    3843       
    3944        # r10 contains physical address to memmap_t
     
    7075       
    7176        b main_bsp
     77
     78.section K_DATA_START, "aw", @progbits
     79       
     80        .space TEMP_STACK_SIZE
     81end_stack:
  • arch/ppc32/src/drivers/cuda.c

    redc89bd re4ddfa8  
    4949
    5050
     51void cuda_init(void)
     52{
     53}
     54
     55
    5156static void cuda_packet(const __u8 data)
    5257{
  • arch/ppc32/src/exception.S

    redc89bd re4ddfa8  
    8585.global exc_decrementer
    8686exc_decrementer:
     87        rfi
    8788        b exc_decrementer
    8889
  • arch/ppc32/src/ppc32.c

    redc89bd re4ddfa8  
    2929#include <arch.h>
    3030#include <arch/console.h>
    31 
     31#include <arch/drivers/cuda.h>
    3232#include <arch/mm/memory_init.h>
    3333
     
    3535{
    3636        ppc32_console_init();
     37        cuda_init();
    3738}
    3839
  • generic/src/console/chardev.c

    redc89bd re4ddfa8  
    5656void chardev_push_character(chardev_t *chardev, __u8 ch)
    5757{
    58         spinlock_lock(&chardev->lock);
     58        spinlock_lock(&chardev->lock);
    5959        chardev->counter++;
    6060        if (chardev->counter == CHARDEV_BUFLEN - 1) {
     
    6262                chardev->op->suspend(chardev);
    6363        }
    64 
    65         chardev->buffer[chardev->index++] = ch;
    66         chardev->index = chardev->index % CHARDEV_BUFLEN; /* index modulo size of buffer */
    67         waitq_wakeup(&chardev->wq, WAKEUP_FIRST);
    68         spinlock_unlock(&chardev->lock);
     64       
     65        chardev->buffer[chardev->index++] = ch;
     66        chardev->index = chardev->index % CHARDEV_BUFLEN; /* index modulo size of buffer */
     67        waitq_wakeup(&chardev->wq, WAKEUP_FIRST);
     68        spinlock_unlock(&chardev->lock);
    6969}
Note: See TracChangeset for help on using the changeset viewer.