Changeset 4d0f97d in mainline for kernel


Ignore:
Timestamp:
2010-07-16T14:23:41Z (15 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e2650d3
Parents:
aa0d227 (diff), 24697c3 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge from lp:~jsvoboda/helenos/gta02. This adds support for the GTA02 platform. Fixes ticket #134.

Location:
kernel
Files:
6 added
15 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/arm32/Makefile.inc

    raa0d227 r4d0f97d  
    6060        arch/$(KARCH)/src/ras.c
    6161
     62ifeq ($(MACHINE),gta02)
     63        ARCH_SOURCES += arch/$(KARCH)/src/mach/gta02/gta02.c
     64endif
     65
    6266ifeq ($(MACHINE),testarm)
    6367        ARCH_SOURCES += arch/$(KARCH)/src/mach/testarm/testarm.c
  • kernel/arch/arm32/_link.ld.in

    raa0d227 r4d0f97d  
    77 */
    88
     9#ifdef MACHINE_gta02
     10#define KERNEL_LOAD_ADDRESS 0xb0a08000
     11#else
    912#define KERNEL_LOAD_ADDRESS 0x80a00000
     13#endif
    1014
    1115OUTPUT_ARCH(arm)
  • kernel/arch/arm32/include/mach/integratorcp/integratorcp.h

    raa0d227 r4d0f97d  
    103103extern void icp_cpu_halt(void);
    104104extern void icp_irq_exception(unsigned int, istate_t *);
    105 extern uintptr_t icp_get_memory_size(void);
     105extern void icp_get_memory_extents(uintptr_t *, uintptr_t *);
    106106extern void icp_frame_init(void);
    107107
    108108extern struct arm_machine_ops icp_machine_ops;
     109
     110/** Size of IntegratorCP IRQ number range (starting from 0) */
     111#define ICP_IRQ_COUNT 8
    109112
    110113#endif
  • kernel/arch/arm32/include/mach/testarm/testarm.h

    raa0d227 r4d0f97d  
    4242#include <arch/machine_func.h>
    4343
    44 /** Last interrupt number (beginning from 0) whose status is probed
    45  * from interrupt controller
    46  */
    47 #define GXEMUL_IRQC_MAX_IRQ  8
    48 #define GXEMUL_KBD_IRQ       2
    49 #define GXEMUL_TIMER_IRQ     4
     44/** Size of GXemul IRQ number range (starting from 0) */
     45#define GXEMUL_IRQ_COUNT        32
     46#define GXEMUL_KBD_IRQ          2
     47#define GXEMUL_TIMER_IRQ        4
    5048
    5149/** Timer frequency */
     
    7371extern void gxemul_cpu_halt(void);
    7472extern void gxemul_irq_exception(unsigned int, istate_t *);
    75 extern uintptr_t gxemul_get_memory_size(void);
     73extern void gxemul_get_memory_extents(uintptr_t *, uintptr_t *);
    7674extern void gxemul_frame_init(void);
    7775
  • kernel/arch/arm32/include/machine_func.h

    raa0d227 r4d0f97d  
    4747
    4848struct arm_machine_ops {
    49         void            (*machine_init)(void);
    50         void            (*machine_timer_irq_start)(void);
    51         void            (*machine_cpu_halt)(void);
    52         uintptr_t       (*machine_get_memory_size)(void);
    53         void            (*machine_irq_exception)(unsigned int, istate_t*);
    54         void            (*machine_frame_init)(void);
    55         void            (*machine_output_init)(void);
    56         void            (*machine_input_init)(void);
     49        void (*machine_init)(void);
     50        void (*machine_timer_irq_start)(void);
     51        void (*machine_cpu_halt)(void);
     52        void (*machine_get_memory_extents)(uintptr_t *, uintptr_t *);
     53        void (*machine_irq_exception)(unsigned int, istate_t *);
     54        void (*machine_frame_init)(void);
     55        void (*machine_output_init)(void);
     56        void (*machine_input_init)(void);
    5757};
    5858
     
    7474extern void machine_cpu_halt(void);
    7575
    76 
    77 /** Returns size of available memory.
     76/** Get extents of available memory.
    7877 *
    79  *  @return Size of available memory.
     78 * @param start         Place to store memory start address.
     79 * @param size          Place to store memory size.
    8080 */
    81 extern uintptr_t machine_get_memory_size(void);
    82 
     81extern void machine_get_memory_extents(uintptr_t *start, uintptr_t *size);
    8382
    8483/** Interrupt exception handler.
     
    105104extern void machine_input_init(void);
    106105
     106extern size_t machine_get_irq_count(void);
     107
    107108#endif
    108109
  • kernel/arch/arm32/include/mm/frame.h

    raa0d227 r4d0f97d  
    4646
    4747#define BOOT_PAGE_TABLE_SIZE     0x4000
    48 #define BOOT_PAGE_TABLE_ADDRESS  0x8000
     48
     49#ifdef MACHINE_gta02
     50#define BOOT_PAGE_TABLE_ADDRESS  0x30010000
     51#else
     52#define BOOT_PAGE_TABLE_ADDRESS  0x00008000
     53#endif
    4954
    5055#define BOOT_PAGE_TABLE_START_FRAME     (BOOT_PAGE_TABLE_ADDRESS >> FRAME_WIDTH)
    5156#define BOOT_PAGE_TABLE_SIZE_IN_FRAMES  (BOOT_PAGE_TABLE_SIZE >> FRAME_WIDTH)
     57
     58#ifdef MACHINE_gta02
     59#define PHYSMEM_START_ADDR      0x30008000
     60#else
     61#define PHYSMEM_START_ADDR      0x00000000
     62#endif
    5263
    5364extern uintptr_t last_frame;
  • kernel/arch/arm32/src/exc_handler.S

    raa0d227 r4d0f97d  
    9696        ldmfd r3!, {r4-r7}
    9797        stmfd r13!, {r4-r7}
    98         stmfd r13!, {r13, lr}^
     98        mov r4, r13
     99        stmfd r4, {r13, lr}^
     100        nop                     /* Cannot access r13 immediately after stm(2) */
     101        sub r13, r13, #8
    99102        stmfd r13!, {r2}
    100103
     
    137140
    138141        # return to user mode
    139         ldmfd r13!, {r13, lr}^
     142        mov r0, r13
     143        ldmfd r0, {r13, lr}^
     144        nop                     /* Cannot access r13 immediately after ldm(2) */
     145        add r13, r13, #8
    140146        b 2f
    141147
  • kernel/arch/arm32/src/interrupt.c

    raa0d227 r4d0f97d  
    4040#include <ddi/device.h>
    4141#include <interrupt.h>
    42 
    43 /** Initial size of a table holding interrupt handlers. */
    44 #define IRQ_COUNT 8
    4542
    4643/** Disable interrupts.
     
    105102void interrupt_init(void)
    106103{
    107         irq_init(IRQ_COUNT, IRQ_COUNT);
     104        size_t irq_count;
     105
     106        irq_count = machine_get_irq_count();
     107        irq_init(irq_count, irq_count);
     108
    108109        machine_timer_irq_start();
    109110}
  • kernel/arch/arm32/src/mach/integratorcp/integratorcp.c

    raa0d227 r4d0f97d  
    6060        icp_timer_irq_start,
    6161        icp_cpu_halt,
    62         icp_get_memory_size,
     62        icp_get_memory_extents,
    6363        icp_irq_exception,
    6464        icp_frame_init,
     
    214214}
    215215
    216 /** Returns the size of emulated memory.
    217  *
    218  * @return Size in bytes.
    219  */
    220 size_t icp_get_memory_size(void)
    221 {
     216/** Get extents of available memory.
     217 *
     218 * @param start         Place to store memory start address.
     219 * @param size          Place to store memory size.
     220 */
     221void icp_get_memory_extents(uintptr_t *start, uintptr_t *size)
     222{
     223        *start = 0;
     224
    222225        if (hw_map_init_called) {
    223                 return (sdram[((*(uint32_t *)icp_hw_map.sdramcr & ICP_SDRAM_MASK) >> 2)]);
     226                *size = (sdram[((*(uint32_t *)icp_hw_map.sdramcr &
     227                    ICP_SDRAM_MASK) >> 2)]);
    224228        } else {
    225                 return SDRAM_SIZE;
    226         }
    227        
     229                *size = SDRAM_SIZE;
     230        }
    228231}
    229232
  • kernel/arch/arm32/src/mach/testarm/testarm.c

    raa0d227 r4d0f97d  
    6060        gxemul_timer_irq_start,
    6161        gxemul_cpu_halt,
    62         gxemul_get_memory_size,
     62        gxemul_get_memory_extents,
    6363        gxemul_irq_exception,
    6464        gxemul_frame_init,
     
    185185}
    186186
    187 /** Returns the size of emulated memory.
    188  *
    189  * @return Size in bytes.
    190  */
    191 uintptr_t gxemul_get_memory_size(void)
    192 {
    193         return  *((uintptr_t *) (GXEMUL_MP_ADDRESS + GXEMUL_MP_MEMSIZE_OFFSET));
    194 }
    195 
     187/** Get extents of available memory.
     188 *
     189 * @param start         Place to store memory start address.
     190 * @param size          Place to store memory size.
     191 */
     192void gxemul_get_memory_extents(uintptr_t *start, uintptr_t *size)
     193{
     194        *start = 0;
     195        *size = *((uintptr_t *) (GXEMUL_MP_ADDRESS + GXEMUL_MP_MEMSIZE_OFFSET));
     196}
    196197
    197198/** Returns the mask of active interrupts. */
     
    210211        unsigned int i;
    211212
    212         for (i = 0; i < GXEMUL_IRQC_MAX_IRQ; i++) {
     213        for (i = 0; i < GXEMUL_IRQ_COUNT; i++) {
    213214                if (sources & (1 << i)) {
    214215                        irq_t *irq = irq_dispatch_and_lock(i);
  • kernel/arch/arm32/src/machine_func.c

    raa0d227 r4d0f97d  
    3939
    4040#include <arch/machine_func.h>
     41#include <arch/mach/gta02/gta02.h>
    4142#include <arch/mach/integratorcp/integratorcp.h>
    4243#include <arch/mach/testarm/testarm.h>
     
    4849void machine_ops_init(void)
    4950{
    50 #if defined(MACHINE_testarm)
     51#if defined(MACHINE_gta02)
     52        machine_ops = &gta02_machine_ops;
     53#elif defined(MACHINE_testarm)
    5154        machine_ops = &gxemul_machine_ops;
    5255#elif defined(MACHINE_integratorcp)
     
    7780}
    7881
    79 
    80 /** Returns size of available memory.
     82/** Get extents of available memory.
    8183 *
    82  *  @return Size of available memory.
     84 * @param start         Place to store memory start address.
     85 * @param size          Place to store memory size.
    8386 */
    84 uintptr_t machine_get_memory_size(void)
     87void machine_get_memory_extents(uintptr_t *start, uintptr_t *size)
    8588{
    86         return (machine_ops->machine_get_memory_size)();
     89        (machine_ops->machine_get_memory_extents)(start, size);
    8790}
    8891
     
    122125}
    123126
     127/** Get IRQ number range used by machine. */
     128size_t machine_get_irq_count(void)
     129{
     130        size_t irq_count;
     131 
     132#if defined(MACHINE_gta02)
     133        irq_count = GTA02_IRQ_COUNT;
     134#elif defined(MACHINE_testarm)
     135        irq_count = GXEMUL_IRQ_COUNT;
     136#elif defined(MACHINE_integratorcp)
     137        irq_count = ICP_IRQ_COUNT;
     138#else
     139#error Machine type not defined.
     140#endif
     141        return irq_count;
     142}
     143
    124144/** @}
    125145 */
  • kernel/arch/arm32/src/mm/frame.c

    raa0d227 r4d0f97d  
    3838#include <arch/machine_func.h>
    3939#include <config.h>
     40#include <align.h>
    4041
    4142/** Address of the last frame in the memory. */
     
    4546void frame_arch_init(void)
    4647{
    47         last_frame = machine_get_memory_size();
     48        uintptr_t mem_start, mem_size;
     49        uintptr_t first_frame;
     50        uintptr_t num_frames;
     51
     52        machine_get_memory_extents(&mem_start, &mem_size);
     53        first_frame = ALIGN_UP(mem_start, FRAME_SIZE);
     54        last_frame = ALIGN_DOWN(mem_start + mem_size, FRAME_SIZE);
     55        num_frames = (last_frame - first_frame) >> FRAME_WIDTH;
    4856       
    4957        /* All memory as one zone */
    50         zone_create(0, ADDR2PFN(last_frame),
     58        zone_create(first_frame >> FRAME_WIDTH, num_frames,
    5159            BOOT_PAGE_TABLE_START_FRAME + BOOT_PAGE_TABLE_SIZE_IN_FRAMES, 0);
    5260       
  • kernel/arch/arm32/src/mm/page.c

    raa0d227 r4d0f97d  
    5858        uintptr_t cur;
    5959        /* Kernel identity mapping */
    60         for (cur = 0; cur < last_frame; cur += FRAME_SIZE)
     60        for (cur = PHYSMEM_START_ADDR; cur < last_frame; cur += FRAME_SIZE)
    6161                page_mapping_insert(AS_KERNEL, PA2KA(cur), cur, flags);
    6262       
     
    6868#error "Only high exception vector supported now"
    6969#endif
     70        cur = ALIGN_DOWN(0x50008010, FRAME_SIZE);
     71        page_mapping_insert(AS_KERNEL, PA2KA(cur), cur, flags);
    7072
    7173        page_table_unlock(AS_KERNEL, true);
  • kernel/arch/arm32/src/userspace.c

    raa0d227 r4d0f97d  
    9797                "mov sp, %[ustate]\n"
    9898                "msr spsr_c, %[user_mode]\n"
    99                 "ldmfd sp!, {r0-r12, sp, lr}^\n"
     99                "ldmfd sp, {r0-r12, sp, lr}^\n"
     100                "nop\n"         /* Cannot access sp immediately after ldm(2) */
     101                "add sp, sp, #(15*4)\n"
    100102                "ldmfd sp!, {pc}^\n"
    101103                :: [ustate] "r" (&ustate), [user_mode] "r" (user_mode)
  • kernel/genarch/Makefile.inc

    raa0d227 r4d0f97d  
    9090endif
    9191
     92ifeq ($(CONFIG_S3C24XX_UART),y)
     93        GENARCH_SOURCES += \
     94                genarch/src/drivers/s3c24xx_uart/s3c24xx_uart.c
     95endif
     96
    9297ifeq ($(CONFIG_Z8530),y)
    9398        GENARCH_SOURCES += \
Note: See TracChangeset for help on using the changeset viewer.