Changeset 4d0f97d in mainline


Ignore:
Timestamp:
2010-07-16T14:23:41Z (14 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.

Files:
9 added
26 edited

Legend:

Unmodified
Added
Removed
  • HelenOS.config

    raa0d227 r4d0f97d  
    5858
    5959% Machine type
     60@ "gta02" GTA02 / Neo FreeRunner
    6061@ "testarm" GXEmul Testarm
    6162@ "integratorcp" Integratorcp
     
    389390% Output device class
    390391@ "generic" Monitor or serial line
    391 ! [PLATFORM=arm32&MACHINE=integratorcp] CONFIG_HID_OUT (choice)
     392! [PLATFORM=arm32&(MACHINE=gta02|MACHINE=integratorcp)] CONFIG_HID_OUT (choice)
    392393
    393394% Output device class
     
    436437% Support for NS16550 controller
    437438! [(CONFIG_HID_IN=generic|CONFIG_HID_IN=serial)&PLATFORM=ia64&MACHINE=i460GX] CONFIG_NS16550 (y/n)
     439
     440% Support for Samsung S3C24XX on-chip UART
     441! [(CONFIG_HID_OUT=generic|CONFIG_HID_OUT=serial)&PLATFORM=arm32&MACHINE=gta02] CONFIG_S3C24XX_UART (y/n)
    438442
    439443% Support for Z8530 controller
  • boot/Makefile

    raa0d227 r4d0f97d  
    7272
    7373clean_dist:
    74         rm -f $(INITRD).fs $(INITRD).img $(COMPS_H) $(COMPS_C) $(LINK) *.co
     74        rm -f $(INITRD).fs $(INITRD).img $(COMPS_H) $(COMPS_C) $(LINK) $(LINK).comp *.co
    7575        rm -f $(USPACE_PATH)/dist/srv/*
    7676        rm -f $(USPACE_PATH)/dist/app/*
  • boot/Makefile.build

    raa0d227 r4d0f97d  
    106106        $(LD) -N $(LFLAGS) -T $(LINK) -M -Map $(MAP) -o $@ $(COMPONENT_OBJECTS) $(OBJECTS)
    107107
     108$(LINK): $(LINK).comp $(DEPEND)
     109        $(GCC) $(DEFS) $(GCC_CFLAGS) -D__ASM__ -D__LINKER__ -E -x c $(LINK).comp | grep -v "^\#" > $(LINK)
     110
    108111%.o: %.S $(DEPEND)
    109112        $(CC) $(DEFS) $(CFLAGS) -D__ASM__ -c $< -o $@
  • boot/Makefile.common

    raa0d227 r4d0f97d  
    5555MKTMPFS = $(TOOLS_PATH)/mktmpfs.py
    5656MKFAT = $(TOOLS_PATH)/mkfat.py
     57MKUIMAGE = $(TOOLS_PATH)/mkuimage.py
    5758
    5859JOBFILE = $(ROOT_PATH)/tools/jobfile.py
  • boot/arch/arm32/Makefile.inc

    raa0d227 r4d0f97d  
    2727#
    2828
     29ifeq ($(MACHINE), gta02)
     30        BOOT_OUTPUT = image.boot
     31        POST_OUTPUT = $(ROOT_PATH)/uImage.bin
     32        POSTBUILD = Makefile.uboot
     33endif
     34
    2935BFD_NAME = elf32-littlearm
    3036BFD_OUTPUT = $(BFD_NAME)
  • boot/arch/arm32/_link.ld.in

    raa0d227 r4d0f97d  
     1#include <arch/arch.h>
     2
    13ENTRY(start)
    24
    35SECTIONS {
    4         . = 0x0000;
     6        . = BOOT_BASE;
    57        .text : {
    68                *(BOOTSTRAP);
    79                *(.text);
    810        }
    9         . = 0x8000;
     11        . = BOOT_BASE + 0x8000;
    1012        .data : {
    1113                *(BOOTPT);      /* bootstrap page table */
  • boot/arch/arm32/include/arch.h

    raa0d227 r4d0f97d  
    3636#define PTL0_ENTRY_SIZE  4
    3737
    38 #define BOOT_OFFSET  0xa00000
     38/*
     39 * Address where the boot stage image starts (beginning of usable physical
     40 * memory).
     41 */
     42#ifdef MACHINE_gta02
     43#define BOOT_BASE       0x30008000
     44#else
     45#define BOOT_BASE       0x00000000
     46#endif
     47
     48#define BOOT_OFFSET     (BOOT_BASE + 0xa00000)
    3949
    4050#ifndef __ASM__
  • boot/arch/arm32/include/main.h

    raa0d227 r4d0f97d  
    11/*
    22 * Copyright (c) 2007 Michal Kebrt
     3 * Copyright (c) 2010 Jiri Svoboda
    34 * All rights reserved.
    45 *
     
    3839
    3940/** Address where characters to be printed are expected. */
    40 #ifdef MACHINE_testarm
    41         #define VIDEORAM_ADDRESS  0x10000000
    42 #endif
    4341
    44 #ifdef MACHINE_integratorcp
    45         #define VIDEORAM_ADDRESS  0x16000000
    46 #endif
     42/** GTA02 serial console UART register addresses.
     43 *
     44 * This is UART channel 2 of the S3C24xx CPU
     45 */
     46#define GTA02_SCONS_UTRSTAT     0x50008010
     47#define GTA02_SCONS_UTXH        0x50008020
     48
     49/* Bits in UTXH register */
     50#define S3C24XX_UTXH_TX_EMPTY   0x00000004
     51
     52
     53/** GXemul testarm serial console output register */
     54#define TESTARM_SCONS_ADDR      0x10000000
     55
     56/** IntegratorCP serial console output register */
     57#define ICP_SCONS_ADDR          0x16000000
    4758
    4859extern void bootstrap(void);
  • boot/arch/arm32/src/putchar.c

    raa0d227 r4d0f97d  
    22 * Copyright (c) 2007 Michal Kebrt
    33 * Copyright (c) 2009 Vineeth Pillai
     4 * Copyright (c) 2010 Jiri Svoboda
    45 * All rights reserved.
    56 *
     
    4041#include <str.h>
    4142
     43#ifdef MACHINE_gta02
     44
     45/** Send a byte to the gta02 serial console.
     46 *
     47 * @param byte          Byte to send.
     48 */
     49static void scons_sendb_gta02(uint8_t byte)
     50{
     51        volatile uint32_t *utrstat;
     52        volatile uint32_t *utxh;
     53
     54        utrstat = (volatile uint32_t *) GTA02_SCONS_UTRSTAT;
     55        utxh    = (volatile uint32_t *) GTA02_SCONS_UTXH;
     56
     57        /* Wait until transmitter is empty. */
     58        while ((*utrstat & S3C24XX_UTXH_TX_EMPTY) == 0)
     59                ;
     60
     61        /* Transmit byte. */
     62        *utxh = (uint32_t) byte;
     63}
     64
     65#endif
     66
     67#ifdef MACHINE_testarm
     68
     69/** Send a byte to the GXemul testarm serial console.
     70 *
     71 * @param byte          Byte to send.
     72 */
     73static void scons_sendb_testarm(uint8_t byte)
     74{
     75        *((volatile uint8_t *) TESTARM_SCONS_ADDR) = byte;
     76}
     77
     78#endif
     79
     80#ifdef MACHINE_integratorcp
     81
     82/** Send a byte to the IntegratorCP serial console.
     83 *
     84 * @param byte          Byte to send.
     85 */
     86static void scons_sendb_icp(uint8_t byte)
     87{
     88        *((volatile uint8_t *) ICP_SCONS_ADDR) = byte;
     89}
     90
     91#endif
     92
     93/** Send a byte to the serial console.
     94 *
     95 * @param byte          Byte to send.
     96 */
     97static void scons_sendb(uint8_t byte)
     98{
     99#ifdef MACHINE_gta02
     100        scons_sendb_gta02(byte);
     101#endif
     102#ifdef MACHINE_testarm
     103        scons_sendb_testarm(byte);
     104#endif
     105#ifdef MACHINE_integratorcp
     106        scons_sendb_icp(byte);
     107#endif
     108}
     109
     110/** Display a character
     111 *
     112 * @param ch    Character to display
     113 */
    42114void putchar(const wchar_t ch)
    43115{
    44116        if (ch == '\n')
    45                 *((volatile char *) VIDEORAM_ADDRESS) = '\r';
    46        
     117                scons_sendb('\r');
     118
    47119        if (ascii_check(ch))
    48                 *((volatile char *) VIDEORAM_ADDRESS) = ch;
     120                scons_sendb((uint8_t) ch);
    49121        else
    50                 *((volatile char *) VIDEORAM_ADDRESS) = U_SPECIAL;
     122                scons_sendb(U_SPECIAL);
    51123}
    52124
  • 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 += \
  • tools/pack.py

    raa0d227 r4d0f97d  
    191191        link_in.close()
    192192       
    193         link_out = file(os.path.join(arch_path, LINK), "w")
     193        link_out = file(os.path.join(arch_path, "%s.comp" % LINK), "w")
    194194        link_out.write(template.replace("[[COMPONENTS]]", "\n".join(link_ctx)))
    195195        link_out.close()
  • uspace/srv/hid/kbd/Makefile

    raa0d227 r4d0f97d  
    5858
    5959ifeq ($(UARCH),arm32)
     60        ifeq ($(MACHINE),gta02)
     61                SOURCES += \
     62                        port/dummy.c \
     63                        ctl/pc.c
     64        endif
    6065        ifeq ($(MACHINE),testarm)
    6166                SOURCES += \
Note: See TracChangeset for help on using the changeset viewer.