Changes in / [fb8dcb4:e882e3a] in mainline


Ignore:
Files:
6 added
20 deleted
35 edited

Legend:

Unmodified
Added
Removed
  • HelenOS.config

    rfb8dcb4 re882e3a  
    6565@ "testarm" GXEmul Testarm
    6666@ "integratorcp" Integratorcp
    67 @ "beagleboardxm" BeogleBoard-xM
    6867! [PLATFORM=arm32] MACHINE (choice)
    6968
     
    8786! [PLATFORM=sparc64&MACHINE=generic] PROCESSOR (choice)
    8887
    89 % CPU type
    90 @ "armv4" ARMv4
    91 ! [PLATFORM=arm32&(MACHINE=gta02|MACHINE=gxemul)] PROCESSOR (choice)
    92 
    93 % CPU type
    94 @ "armv5" ARMv5
    95 ! [PLATFORM=arm32&MACHINE=integratorcp] PROCESSOR (choice)
    96 
    97 % CPU type
    98 @ "armv7" ARMv7
    99 ! [PLATFORM=arm32&MACHINE=beagleboardxm] PROCESSOR (choice)
    100 
    101 
    10288% RAM disk format
    10389@ "tmpfs" TMPFS image
     
    422408% Output device class
    423409@ "generic" Monitor or serial line
    424 ! [PLATFORM=arm32&(MACHINE=gta02|MACHINE=integratorcp|MACHINE=beagleboardxm)] CONFIG_HID_OUT (choice)
     410! [PLATFORM=arm32&(MACHINE=gta02|MACHINE=integratorcp)] CONFIG_HID_OUT (choice)
    425411
    426412% Output device class
     
    479465! [PLATFORM=arm32&MACHINE=gta02] CONFIG_S3C24XX_IRQC (y)
    480466
    481 % Support for TI AMDM37X on-chip UART
    482 ! [(CONFIG_HID_OUT=generic|CONFIG_HID_OUT=serial)&PLATFORM=arm32&MACHINE=beagleboardxm] CONFIG_AMDM37X_UART (y/n)
    483 
    484467% Support for i8042 controller
    485468! [CONFIG_PC_KBD=y] CONFIG_I8042 (y)
     
    501484
    502485% Serial line input module
    503 ! [CONFIG_DSRLNIN=y|(PLATFORM=arm32&MACHINE=gta02)|(PLATFORM=arm32&MACHINE=beagleboardxm)|(PLATFORM=ia64&MACHINE=i460GX&CONFIG_NS16550=y)|(PLATFORM=ia64&MACHINE=ski)|(PLATFORM=sparc64&PROCESSOR=sun4v)] CONFIG_SRLN (y)
     486! [CONFIG_DSRLNIN=y|(PLATFORM=arm32&MACHINE=gta02)|(PLATFORM=ia64&MACHINE=i460GX&CONFIG_NS16550=y)|(PLATFORM=ia64&MACHINE=ski)|(PLATFORM=sparc64&PROCESSOR=sun4v)] CONFIG_SRLN (y)
    504487
    505488% EGA support
  • boot/Makefile.uboot

    rfb8dcb4 re882e3a  
    4040
    4141$(POST_OUTPUT): $(BIN_OUTPUT)
    42         $(MKUIMAGE) -name "$(IMAGE_NAME)" -laddr $(LADDR) -saddr $(SADDR) $< $@
     42        $(MKUIMAGE) -name "$(IMAGE_NAME)" -laddr 0x30008000 -saddr 0x30008000 $< $@
    4343
    4444clean:
  • boot/arch/arm32/Makefile.inc

    rfb8dcb4 re882e3a  
    3030        BOOT_OUTPUT = image.boot
    3131        POST_OUTPUT = $(ROOT_PATH)/uImage.bin
    32         LADDR = 0x30008000
    33         SADDR = 0x30008000
    34         POSTBUILD = Makefile.uboot
    35 endif
    36 
    37 ifeq ($(MACHINE), beagleboardxm)
    38         BOOT_OUTPUT = image.boot
    39         POST_OUTPUT = $(ROOT_PATH)/uImage.bin
    40         LADDR = 0x80000000
    41         SADDR = 0x80000000
    4232        POSTBUILD = Makefile.uboot
    4333endif
     
    5040ENDIANESS = LE
    5141
    52 ifeq ($(MACHINE), gta02)
    5342RD_SRVS_ESSENTIAL += \
    5443        $(USPACE_PATH)/srv/hid/s3c24xx_ts/s3c24ts \
    5544        $(USPACE_PATH)/srv/hw/char/s3c24xx_uart/s3c24ser
    56 endif
    5745
    58 ifeq ($(MACHINE), gxemul)
    5946RD_SRVS_NON_ESSENTIAL += \
    6047        $(USPACE_PATH)/srv/bd/gxe_bd/gxe_bd
    61 endif
    62 
    63 RD_DRVS += \
    64         infrastructure/rootamdm37x \
    65         bus/usb/ehci \
    66         bus/usb/ohci \
    67         bus/usb/usbflbk \
    68         bus/usb/usbhub \
    69         bus/usb/usbhid \
    70         bus/usb/usbmast \
    71         bus/usb/usbmid
    7248
    7349SOURCES = \
  • boot/arch/arm32/include/arch.h

    rfb8dcb4 re882e3a  
    4242#ifdef MACHINE_gta02
    4343#define BOOT_BASE       0x30008000
    44 #elif defined MACHINE_beagleboardxm
    45 #define BOOT_BASE       0x80000000
    4644#else
    4745#define BOOT_BASE       0x00000000
     
    5048#define BOOT_OFFSET     (BOOT_BASE + 0xa00000)
    5149
    52 #ifdef MACHINE_beagleboardxm
    53         #define PA_OFFSET 0
     50#ifndef __ASM__
     51        #define PA2KA(addr)  (((uintptr_t) (addr)) + 0x80000000)
    5452#else
    55         #define PA_OFFSET 0x80000000
     53        #define PA2KA(addr)  ((addr) + 0x80000000)
    5654#endif
    57 
    58 #ifndef __ASM__
    59         #define PA2KA(addr)  (((uintptr_t) (addr)) + PA_OFFSET)
    60 #else
    61         #define PA2KA(addr)  ((addr) + PA_OFFSET)
    62 #endif
    63 
    6455
    6556#endif
  • boot/arch/arm32/include/main.h

    rfb8dcb4 re882e3a  
    4040/** Address where characters to be printed are expected. */
    4141
    42 
    43 /** BeagleBoard-xM UART register address
    44  *
    45  * This is UART3 of AM/DM37x CPU
    46  */
    47 #define BBXM_SCONS_THR          0x49020000
    48 #define BBXM_SCONS_SSR          0x49020044
    49 
    50 /* Check this bit before writing (tx fifo full) */
    51 #define BBXM_THR_FULL           0x00000001
    52 
    53 
    5442/** GTA02 serial console UART register addresses.
    5543 *
  • boot/arch/arm32/include/mm.h

    rfb8dcb4 re882e3a  
    5858        unsigned int bufferable : 1;
    5959        unsigned int cacheable : 1;
    60         unsigned int xn : 1;
     60        unsigned int impl_specific : 1;
    6161        unsigned int domain : 4;
    6262        unsigned int should_be_zero_1 : 1;
    63         unsigned int access_permission_0 : 2;
    64         unsigned int tex : 3;
    65         unsigned int access_permission_1 : 2;
    66         unsigned int non_global : 1;
    67         unsigned int should_be_zero_2 : 1;
    68         unsigned int non_secure : 1;
     63        unsigned int access_permission : 2;
     64        unsigned int should_be_zero_2 : 8;
    6965        unsigned int section_base_addr : 12;
    7066} __attribute__((packed)) pte_level0_section_t;
  • boot/arch/arm32/src/mm.c

    rfb8dcb4 re882e3a  
    5454{
    5555        pte->descriptor_type = PTE_DESCRIPTOR_SECTION;
    56         pte->bufferable = 1;
     56        pte->bufferable = 0;
    5757        pte->cacheable = 0;
    58         pte->xn = 0;
     58        pte->impl_specific = 0;
    5959        pte->domain = 0;
    6060        pte->should_be_zero_1 = 0;
    61         pte->access_permission_0 = PTE_AP_USER_NO_KERNEL_RW;
    62         pte->tex = 0;
    63         pte->access_permission_1 = 0;
    64         pte->non_global = 0;
     61        pte->access_permission = PTE_AP_USER_NO_KERNEL_RW;
    6562        pte->should_be_zero_2 = 0;
    66         pte->non_secure = 0;
    6763        pte->section_base_addr = frame;
    6864}
     
    7167static void init_boot_pt(void)
    7268{
    73         const pfn_t split_page = PTL0_ENTRIES;
     69        pfn_t split_page = 0x800;
     70       
    7471        /* Create 1:1 virtual-physical mapping (in lower 2 GB). */
    7572        pfn_t page;
     
    8178         * (upper 2 GB), physical addresses start from 0.
    8279         */
    83         /* BeagleBoard-xM (MD37x) memory starts at 2GB border,
    84          * thus mapping only lower 2GB is not not enough.
    85          * Map entire AS 1:1 instead and hope it works. */
    8680        for (page = split_page; page < PTL0_ENTRIES; page++)
    87 #ifndef MACHINE_beagleboardxm
    8881                init_ptl0_section(&boot_pt[page], page - split_page);
    89 #else
    90                 init_ptl0_section(&boot_pt[page], page);
    91 #endif
    9282       
    9383        asm volatile (
     
    10595                /* Behave as a client of domains */
    10696                "ldr r0, =0x55555555\n"
    107                 "mcr p15, 0, r0, c3, c0, 0\n"
     97                "mcr p15, 0, r0, c3, c0, 0\n" 
    10898               
    109 #ifdef PROCESSOR_armv7
    110                 /* Clean L2 cache */
    111                 "mov r12, #0x1\n"   //set up to invalidate L2
    112                 "smc #0\n"  //Call SMI monitor
    113                
    114                 /* Read Auxiliary control register */
    115                 "mrc p15, 0, r0, c1, c0, 1\n"
    116                 /* Mask to enable L2 cache */
    117                 "ldr r1, =0x00000002\n"
    118                 "orr r0, r0, r1\n"
    119                 /* Store Auxiliary control register */
    120                 "mrc p15, 0, r0, c1, c0, 1\n"
    121 #endif
    12299                /* Current settings */
    123100                "mrc p15, 0, r0, c1, c0, 0\n"
    124101               
    125 #ifdef PROCESSOR_armv7
    126                 /* Mask to enable paging, alignment and caching */
    127                 "ldr r1, =0x00000007\n"
    128 #else
    129102                /* Mask to enable paging */
    130103                "ldr r1, =0x00000001\n"
    131 #endif
    132104                "orr r0, r0, r1\n"
    133105               
  • boot/arch/arm32/src/putchar.c

    rfb8dcb4 re882e3a  
    4040#include <putchar.h>
    4141#include <str.h>
    42 
    43 #ifdef MACHINE_beagleboardxm
    44 
    45 /** Send a byte to the amdm37x serial console.
    46  *
    47  * @param byte          Byte to send.
    48  */
    49 static void scons_sendb_bbxm(uint8_t byte)
    50 {
    51         volatile uint32_t *thr =
    52             (volatile uint32_t *)BBXM_SCONS_THR;
    53         volatile uint32_t *ssr =
    54             (volatile uint32_t *)BBXM_SCONS_SSR;
    55 
    56         /* Wait until transmitter is empty. */
    57         while ((*ssr & BBXM_THR_FULL) == 1) ;
    58 
    59         /* Transmit byte. */
    60         *thr = (uint32_t) byte;
    61 }
    62 
    63 #endif
    6442
    6543#ifdef MACHINE_gta02
     
    11997static void scons_sendb(uint8_t byte)
    12098{
    121 #ifdef MACHINE_beagleboardxm
    122         scons_sendb_bbxm(byte);
    123 #endif
    12499#ifdef MACHINE_gta02
    125100        scons_sendb_gta02(byte);
  • kernel/arch/arm32/Makefile.inc

    rfb8dcb4 re882e3a  
    7373endif
    7474
    75 ifeq ($(MACHINE),beagleboardxm)
    76         ARCH_SOURCES += arch/$(KARCH)/src/mach/beagleboardxm/beagleboardxm.c
    77 endif
    78 
    7975ifeq ($(CONFIG_PL050),y)
    8076        ARCH_SOURCES += genarch/src/drivers/pl050/pl050.c
  • kernel/arch/arm32/_link.ld.in

    rfb8dcb4 re882e3a  
    99#ifdef MACHINE_gta02
    1010#define KERNEL_LOAD_ADDRESS 0xb0a08000
    11 #elif defined MACHINE_beagleboardxm
    12 #define KERNEL_LOAD_ADDRESS 0x80a00000
    1311#else
    1412#define KERNEL_LOAD_ADDRESS 0x80a00000
  • kernel/arch/arm32/include/asm.h

    rfb8dcb4 re882e3a  
    4343#include <trace.h>
    4444
    45 /** No such instruction on ARM to sleep CPU.
    46  *
    47  * ARMv7 introduced wait for event and wait for interrupt.
    48  */
     45/** No such instruction on ARM to sleep CPU. */
    4946NO_TRACE static inline void cpu_sleep(void)
    5047{
    51 #ifdef PROCESSOR_armv7
    52         asm volatile (
    53                 "wfe"::
    54         );
    55 #endif
    5648}
    5749
  • kernel/arch/arm32/include/cpu.h

    rfb8dcb4 re882e3a  
    4141
    4242
    43 /** Struct representing ARM CPU identification. */
     43/** Struct representing ARM CPU identifiaction. */
    4444typedef struct {
    4545        /** Implementator (vendor) number. */
  • kernel/arch/arm32/include/machine_func.h

    rfb8dcb4 re882e3a  
    108108extern size_t machine_get_irq_count(void);
    109109
    110 extern const char * machine_get_platform_name(void);
    111 
    112110#endif
    113111
  • kernel/arch/arm32/include/mm/frame.h

    rfb8dcb4 re882e3a  
    4848#ifdef MACHINE_gta02
    4949#define BOOT_PAGE_TABLE_ADDRESS  0x30010000
    50 #elif defined MACHINE_beagleboardxm
    51 #define BOOT_PAGE_TABLE_ADDRESS  0x80008000
    5250#else
    5351#define BOOT_PAGE_TABLE_ADDRESS  0x00008000
     
    5957#ifdef MACHINE_gta02
    6058#define PHYSMEM_START_ADDR      0x30008000
    61 #elif defined MACHINE_beagleboardxm
    62 #define PHYSMEM_START_ADDR      0x80000000
    6359#else
    6460#define PHYSMEM_START_ADDR      0x00000000
  • kernel/arch/arm32/include/mm/page.h

    rfb8dcb4 re882e3a  
    3737#define KERN_arm32_PAGE_H_
    3838
    39 #ifdef MACHINE_beagleboardxm
    40 #ifndef __ASM__
    41 #       define KA2PA(x) ((uintptr_t) (x))
    42 #       define PA2KA(x) ((uintptr_t) (x))
    43 #else
    44 #       define KA2PA(x) (x)
    45 #       define PA2KA(x) (x)
    46 #endif
    47 #else
     39#include <arch/mm/frame.h>
     40#include <mm/mm.h>
     41#include <arch/exception.h>
     42#include <trace.h>
     43
     44#define PAGE_WIDTH      FRAME_WIDTH
     45#define PAGE_SIZE       FRAME_SIZE
     46
    4847#ifndef __ASM__
    4948#       define KA2PA(x) (((uintptr_t) (x)) - 0x80000000)
     
    5352#       define PA2KA(x) ((x) + 0x80000000)
    5453#endif
     54
     55/* Number of entries in each level. */
     56#define PTL0_ENTRIES_ARCH       (1 << 12)       /* 4096 */
     57#define PTL1_ENTRIES_ARCH       0
     58#define PTL2_ENTRIES_ARCH       0
     59/* coarse page tables used (256 * 4 = 1KB per page) */
     60#define PTL3_ENTRIES_ARCH       (1 << 8)        /* 256 */
     61
     62/* Page table sizes for each level. */
     63#define PTL0_SIZE_ARCH          FOUR_FRAMES
     64#define PTL1_SIZE_ARCH          0
     65#define PTL2_SIZE_ARCH          0
     66#define PTL3_SIZE_ARCH          ONE_FRAME
     67
     68/* Macros calculating indices into page tables for each level. */
     69#define PTL0_INDEX_ARCH(vaddr)  (((vaddr) >> 20) & 0xfff)
     70#define PTL1_INDEX_ARCH(vaddr)  0
     71#define PTL2_INDEX_ARCH(vaddr)  0
     72#define PTL3_INDEX_ARCH(vaddr)  (((vaddr) >> 12) & 0x0ff)
     73
     74/* Get PTE address accessors for each level. */
     75#define GET_PTL1_ADDRESS_ARCH(ptl0, i) \
     76        ((pte_t *) ((((pte_t *)(ptl0))[(i)].l0).coarse_table_addr << 10))
     77#define GET_PTL2_ADDRESS_ARCH(ptl1, i) \
     78        (ptl1)
     79#define GET_PTL3_ADDRESS_ARCH(ptl2, i) \
     80        (ptl2)
     81#define GET_FRAME_ADDRESS_ARCH(ptl3, i) \
     82        ((uintptr_t) ((((pte_t *)(ptl3))[(i)].l1).frame_base_addr << 12))
     83
     84/* Set PTE address accessors for each level. */
     85#define SET_PTL0_ADDRESS_ARCH(ptl0) \
     86        (set_ptl0_addr((pte_t *) (ptl0)))
     87#define SET_PTL1_ADDRESS_ARCH(ptl0, i, a) \
     88        (((pte_t *) (ptl0))[(i)].l0.coarse_table_addr = (a) >> 10)
     89#define SET_PTL2_ADDRESS_ARCH(ptl1, i, a)
     90#define SET_PTL3_ADDRESS_ARCH(ptl2, i, a)
     91#define SET_FRAME_ADDRESS_ARCH(ptl3, i, a) \
     92        (((pte_t *) (ptl3))[(i)].l1.frame_base_addr = (a) >> 12)
     93
     94/* Get PTE flags accessors for each level. */
     95#define GET_PTL1_FLAGS_ARCH(ptl0, i) \
     96        get_pt_level0_flags((pte_t *) (ptl0), (size_t) (i))
     97#define GET_PTL2_FLAGS_ARCH(ptl1, i) \
     98        PAGE_PRESENT
     99#define GET_PTL3_FLAGS_ARCH(ptl2, i) \
     100        PAGE_PRESENT
     101#define GET_FRAME_FLAGS_ARCH(ptl3, i) \
     102        get_pt_level1_flags((pte_t *) (ptl3), (size_t) (i))
     103
     104/* Set PTE flags accessors for each level. */
     105#define SET_PTL1_FLAGS_ARCH(ptl0, i, x) \
     106        set_pt_level0_flags((pte_t *) (ptl0), (size_t) (i), (x))
     107#define SET_PTL2_FLAGS_ARCH(ptl1, i, x)
     108#define SET_PTL3_FLAGS_ARCH(ptl2, i, x)
     109#define SET_FRAME_FLAGS_ARCH(ptl3, i, x) \
     110        set_pt_level1_flags((pte_t *) (ptl3), (size_t) (i), (x))
     111
     112/* Macros for querying the last-level PTE entries. */
     113#define PTE_VALID_ARCH(pte) \
     114        (*((uint32_t *) (pte)) != 0)
     115#define PTE_PRESENT_ARCH(pte) \
     116        (((pte_t *) (pte))->l0.descriptor_type != 0)
     117#define PTE_GET_FRAME_ARCH(pte) \
     118        (((pte_t *) (pte))->l1.frame_base_addr << FRAME_WIDTH)
     119#define PTE_WRITABLE_ARCH(pte) \
     120        (((pte_t *) (pte))->l1.access_permission_0 == PTE_AP_USER_RW_KERNEL_RW)
     121#define PTE_EXECUTABLE_ARCH(pte) \
     122        1
     123
     124#ifndef __ASM__
     125
     126/** Level 0 page table entry. */
     127typedef struct {
     128        /* 0b01 for coarse tables, see below for details */
     129        unsigned descriptor_type : 2;
     130        unsigned impl_specific : 3;
     131        unsigned domain : 4;
     132        unsigned should_be_zero : 1;
     133
     134        /* Pointer to the coarse 2nd level page table (holding entries for small
     135         * (4KB) or large (64KB) pages. ARM also supports fine 2nd level page
     136         * tables that may hold even tiny pages (1KB) but they are bigger (4KB
     137         * per table in comparison with 1KB per the coarse table)
     138         */
     139        unsigned coarse_table_addr : 22;
     140} ATTRIBUTE_PACKED pte_level0_t;
     141
     142/** Level 1 page table entry (small (4KB) pages used). */
     143typedef struct {
     144
     145        /* 0b10 for small pages */
     146        unsigned descriptor_type : 2;
     147        unsigned bufferable : 1;
     148        unsigned cacheable : 1;
     149
     150        /* access permissions for each of 4 subparts of a page
     151         * (for each 1KB when small pages used */
     152        unsigned access_permission_0 : 2;
     153        unsigned access_permission_1 : 2;
     154        unsigned access_permission_2 : 2;
     155        unsigned access_permission_3 : 2;
     156        unsigned frame_base_addr : 20;
     157} ATTRIBUTE_PACKED pte_level1_t;
     158
     159typedef union {
     160        pte_level0_t l0;
     161        pte_level1_t l1;
     162} pte_t;
     163
     164/* Level 1 page tables access permissions */
     165
     166/** User mode: no access, privileged mode: no access. */
     167#define PTE_AP_USER_NO_KERNEL_NO        0
     168
     169/** User mode: no access, privileged mode: read/write. */
     170#define PTE_AP_USER_NO_KERNEL_RW        1
     171
     172/** User mode: read only, privileged mode: read/write. */
     173#define PTE_AP_USER_RO_KERNEL_RW        2
     174
     175/** User mode: read/write, privileged mode: read/write. */
     176#define PTE_AP_USER_RW_KERNEL_RW        3
     177
     178
     179/* pte_level0_t and pte_level1_t descriptor_type flags */
     180
     181/** pte_level0_t and pte_level1_t "not present" flag (used in descriptor_type). */
     182#define PTE_DESCRIPTOR_NOT_PRESENT      0
     183
     184/** pte_level0_t coarse page table flag (used in descriptor_type). */
     185#define PTE_DESCRIPTOR_COARSE_TABLE     1
     186
     187/** pte_level1_t small page table flag (used in descriptor type). */
     188#define PTE_DESCRIPTOR_SMALL_PAGE       2
     189
     190
     191/** Sets the address of level 0 page table.
     192 *
     193 * @param pt Pointer to the page table to set.
     194 *
     195 */
     196NO_TRACE static inline void set_ptl0_addr(pte_t *pt)
     197{
     198        asm volatile (
     199                "mcr p15, 0, %[pt], c2, c0, 0\n"
     200                :: [pt] "r" (pt)
     201        );
     202}
     203
     204
     205/** Returns level 0 page table entry flags.
     206 *
     207 * @param pt Level 0 page table.
     208 * @param i  Index of the entry to return.
     209 *
     210 */
     211NO_TRACE static inline int get_pt_level0_flags(pte_t *pt, size_t i)
     212{
     213        pte_level0_t *p = &pt[i].l0;
     214        int np = (p->descriptor_type == PTE_DESCRIPTOR_NOT_PRESENT);
     215       
     216        return (np << PAGE_PRESENT_SHIFT) | (1 << PAGE_USER_SHIFT) |
     217            (1 << PAGE_READ_SHIFT) | (1 << PAGE_WRITE_SHIFT) |
     218            (1 << PAGE_EXEC_SHIFT) | (1 << PAGE_CACHEABLE_SHIFT);
     219}
     220
     221/** Returns level 1 page table entry flags.
     222 *
     223 * @param pt Level 1 page table.
     224 * @param i  Index of the entry to return.
     225 *
     226 */
     227NO_TRACE static inline int get_pt_level1_flags(pte_t *pt, size_t i)
     228{
     229        pte_level1_t *p = &pt[i].l1;
     230       
     231        int dt = p->descriptor_type;
     232        int ap = p->access_permission_0;
     233       
     234        return ((dt == PTE_DESCRIPTOR_NOT_PRESENT) << PAGE_PRESENT_SHIFT) |
     235            ((ap == PTE_AP_USER_RO_KERNEL_RW) << PAGE_READ_SHIFT) |
     236            ((ap == PTE_AP_USER_RW_KERNEL_RW) << PAGE_READ_SHIFT) |
     237            ((ap == PTE_AP_USER_RW_KERNEL_RW) << PAGE_WRITE_SHIFT) |
     238            ((ap != PTE_AP_USER_NO_KERNEL_RW) << PAGE_USER_SHIFT) |
     239            ((ap == PTE_AP_USER_NO_KERNEL_RW) << PAGE_READ_SHIFT) |
     240            ((ap == PTE_AP_USER_NO_KERNEL_RW) << PAGE_WRITE_SHIFT) |
     241            (1 << PAGE_EXEC_SHIFT) |
     242            (p->bufferable << PAGE_CACHEABLE);
     243}
     244
     245/** Sets flags of level 0 page table entry.
     246 *
     247 * @param pt    level 0 page table
     248 * @param i     index of the entry to be changed
     249 * @param flags new flags
     250 *
     251 */
     252NO_TRACE static inline void set_pt_level0_flags(pte_t *pt, size_t i, int flags)
     253{
     254        pte_level0_t *p = &pt[i].l0;
     255       
     256        if (flags & PAGE_NOT_PRESENT) {
     257                p->descriptor_type = PTE_DESCRIPTOR_NOT_PRESENT;
     258                /*
     259                 * Ensures that the entry will be recognized as valid when
     260                 * PTE_VALID_ARCH applied.
     261                 */
     262                p->should_be_zero = 1;
     263        } else {
     264                p->descriptor_type = PTE_DESCRIPTOR_COARSE_TABLE;
     265                p->should_be_zero = 0;
     266        }
     267}
     268
     269
     270/** Sets flags of level 1 page table entry.
     271 *
     272 * We use same access rights for the whole page. When page
     273 * is not preset we store 1 in acess_rigts_3 so that at least
     274 * one bit is 1 (to mark correct page entry, see #PAGE_VALID_ARCH).
     275 *
     276 * @param pt    Level 1 page table.
     277 * @param i     Index of the entry to be changed.
     278 * @param flags New flags.
     279 *
     280 */
     281NO_TRACE static inline void set_pt_level1_flags(pte_t *pt, size_t i, int flags)
     282{
     283        pte_level1_t *p = &pt[i].l1;
     284       
     285        if (flags & PAGE_NOT_PRESENT) {
     286                p->descriptor_type = PTE_DESCRIPTOR_NOT_PRESENT;
     287                p->access_permission_3 = 1;
     288        } else {
     289                p->descriptor_type = PTE_DESCRIPTOR_SMALL_PAGE;
     290                p->access_permission_3 = p->access_permission_0;
     291        }
     292       
     293        p->cacheable = p->bufferable = (flags & PAGE_CACHEABLE) != 0;
     294       
     295        /* default access permission */
     296        p->access_permission_0 = p->access_permission_1 =
     297            p->access_permission_2 = p->access_permission_3 =
     298            PTE_AP_USER_NO_KERNEL_RW;
     299       
     300        if (flags & PAGE_USER)  {
     301                if (flags & PAGE_READ) {
     302                        p->access_permission_0 = p->access_permission_1 =
     303                            p->access_permission_2 = p->access_permission_3 =
     304                            PTE_AP_USER_RO_KERNEL_RW;
     305                }
     306                if (flags & PAGE_WRITE) {
     307                        p->access_permission_0 = p->access_permission_1 =
     308                            p->access_permission_2 = p->access_permission_3 =
     309                            PTE_AP_USER_RW_KERNEL_RW;
     310                }
     311        }
     312}
     313
     314
     315extern void page_arch_init(void);
     316
     317
     318#endif /* __ASM__ */
     319
    55320#endif
    56321
    57 #if defined(PROCESSOR_armv7)
    58 #include "page_armv7.h"
    59 #elif defined(PROCESSOR_armv4) | defined(PROCESSOR_armv5)
    60 #include "page_armv4.h"
    61 #endif
    62 
    63 #endif
    64 
    65322/** @}
    66323 */
  • kernel/arch/arm32/include/regutils.h

    rfb8dcb4 re882e3a  
    4141#define STATUS_REG_MODE_MASK         0x1f
    4242
    43 #define CP15_R1_MMU_ENABLE_BIT       (1 << 0)
    44 #define CP15_R1_ALIGNMENT_ENABLE_BIT (1 << 1)
    45 #define CP15_R1_CACHE_ENABLE_BIT     (1 << 2)
    46 #define CP15_R1_BRANCH_PREDICT_BIT   (1 << 11)
    47 #define CP15_R1_INST_CACHE_BIT       (1 << 12)
    4843#define CP15_R1_HIGH_VECTORS_BIT     (1 << 13)
    49 #define CP15_R1_ROUND_ROBIN_BIT      (1 << 14)
    50 #define CP15_R1_HA_ENABLE_BIT        (1 << 17)
    51 #define CP15_R1_WXN_BIT              (1 << 19) /* Only if virt. supported */
    52 #define CP15_R1_UWXN_BIT             (1 << 20) /* Only if virt. supported */
    53 #define CP15_R1_FI_BIT               (1 << 21)
    54 #define CP15_R1_VE_BIT               (1 << 24)
    55 #define CP15_R1_EE_BIT               (1 << 25)
    56 #define CP15_R1_NMFI_BIT             (1 << 27)
    57 #define CP15_R1_TRE_BIT              (1 << 28)
    58 #define CP15_R1_AFE_BIT              (1 << 29)
    5944
    6045/* ARM Processor Operation Modes */
  • kernel/arch/arm32/src/arm32.c

    rfb8dcb4 re882e3a  
    4949#include <str.h>
    5050#include <arch/ras.h>
    51 #include <sysinfo/sysinfo.h>
    5251
    5352/** Performs arm32-specific initialization before main_bsp() is called. */
     
    117116{
    118117        machine_input_init();
    119         const char *platform = machine_get_platform_name();
    120 
    121         sysinfo_set_item_data("platform", NULL, (void *) platform,
    122             str_size(platform));
    123118}
    124119
  • kernel/arch/arm32/src/cpu/cpu.c

    rfb8dcb4 re882e3a  
    4444/** Implementators (vendor) names */
    4545static const char *imp_data[] = {
    46         "?",                                     /* IMP_DATA_START_OFFSET */
    47         "ARM Limited",                           /* 0x41 */
    48         "", "",                                  /* 0x42 - 0x43 */
    49         "Digital Equipment Corporation",         /* 0x44 */
    50         "", "", "", "", "", "", "", "",          /* 0x45 - 0x4c */
    51         "Motorola, Freescale Semicondutor Inc.", /* 0x4d */
    52         "", "", "",                              /* 0x4e - 0x50 */
    53         "Qualcomm Inc.",                         /* 0x51 */
    54         "", "", "", "",                          /* 0x52 - 0x55 */
    55         "Marvell Semiconductor",                 /* 0x56 */
    56         "", "", "", "", "", "", "", "", "", "",  /* 0x57 - 0x60 */
    57         "", "", "", "", "", "", "", "",          /* 0x61 - 0x68 */
    58         "Intel Corporation"                      /* 0x69 */
     46        "?",                                    /* IMP_DATA_START_OFFSET */
     47        "ARM Ltd",                              /* 0x41 */
     48        "",                                     /* 0x42 */
     49        "",                                     /* 0x43 */
     50        "Digital Equipment Corporation",        /* 0x44 */
     51        "", "", "", "", "", "", "", "", "", "", /* 0x45 - 0x4e */
     52        "", "", "", "", "", "", "", "", "", "", /* 0x4f - 0x58 */
     53        "", "", "", "", "", "", "", "", "", "", /* 0x59 - 0x62 */
     54        "", "", "", "", "", "",                 /* 0x63 - 0x68 */
     55        "Intel Corporation"                     /* 0x69 */
    5956};
    6057
     
    10097void cpu_arch_init(void)
    10198{
    102 #if defined(PROCESSOR_armv7)
    103         uint32_t control_reg = 0;
    104         asm volatile (
    105                 "mrc p15, 0, %[control_reg], c1, c0"
    106                 : [control_reg] "=r" (control_reg)
    107         );
    108        
    109         /* Turn off tex remap */
    110         control_reg &= ~CP15_R1_TRE_BIT;
    111         /* Turn off accessed flag */
    112         control_reg &= ~(CP15_R1_AFE_BIT | CP15_R1_HA_ENABLE_BIT);
    113         /* Enable caching */
    114         control_reg |= CP15_R1_CACHE_ENABLE_BIT;
    115        
    116         asm volatile (
    117                 "mcr p15, 0, %[control_reg], c1, c0"
    118                 :: [control_reg] "r" (control_reg)
    119         );
    120 #endif
    12199}
    122100
     
    134112        cpu_arch_t * cpu_arch = &m->arch;
    135113
    136         const unsigned imp_offset = cpu_arch->imp_num - IMP_DATA_START_OFFSET;
    137 
    138         if (imp_offset < imp_data_length) {
     114        if ((cpu_arch->imp_num) > 0 &&
     115            (cpu_arch->imp_num < (imp_data_length + IMP_DATA_START_OFFSET))) {
    139116                vendor = imp_data[cpu_arch->imp_num - IMP_DATA_START_OFFSET];
    140117        }
    141118
    142         // TODO CPUs with arch_num == 0xf use CPUID scheme for identification
    143         if (cpu_arch->arch_num < arch_data_length) {
     119        if ((cpu_arch->arch_num) > 0 &&
     120            (cpu_arch->arch_num < arch_data_length)) {
    144121                architecture = arch_data[cpu_arch->arch_num];
    145122        }
  • kernel/arch/arm32/src/exception.c

    rfb8dcb4 re882e3a  
    120120static void high_vectors(void)
    121121{
    122         register uint32_t control_reg = 0;
     122        uint32_t control_reg;
    123123       
    124 #if defined(PROCESSOR_armv7)
    125         asm volatile (
    126                 "mrc p15, 0, %[control_reg], c1, c0"
    127                 : [control_reg] "=r" (control_reg)
    128         );
    129 #elif defined(PROCESSOR_armv4) | defined(PROCESSOR_armv5)
    130124        asm volatile (
    131125                "mrc p15, 0, %[control_reg], c1, c1"
    132126                : [control_reg] "=r" (control_reg)
    133127        );
    134 #endif
    135128       
    136129        /* switch on the high vectors bit */
    137130        control_reg |= CP15_R1_HIGH_VECTORS_BIT;
    138131       
    139 #if defined(PROCESSOR_armv7)
    140         asm volatile (
    141                 "mcr p15, 0, %[control_reg], c1, c0"
    142                 :: [control_reg] "r" (control_reg)
    143         );
    144 #elif defined(PROCESSOR_armv4) | defined(PROCESSOR_armv5)
    145132        asm volatile (
    146133                "mcr p15, 0, %[control_reg], c1, c1"
    147134                :: [control_reg] "r" (control_reg)
    148135        );
    149 #endif
    150136}
    151137#endif
  • kernel/arch/arm32/src/machine_func.c

    rfb8dcb4 re882e3a  
    4242#include <arch/mach/integratorcp/integratorcp.h>
    4343#include <arch/mach/testarm/testarm.h>
    44 #include <arch/mach/beagleboardxm/beagleboardxm.h>
    4544
    4645/** Pointer to machine_ops structure being used. */
     
    5655#elif defined(MACHINE_integratorcp)
    5756        machine_ops = &icp_machine_ops;
    58 #elif defined(MACHINE_beagleboardxm)
    59         machine_ops = &bbxm_machine_ops;
    6057#else
    6158#error Machine type not defined.
     
    134131}
    135132
    136 const char * machine_get_platform_name(void)
    137 {
    138         if (machine_ops->machine_get_platform_name)
    139                 return machine_ops->machine_get_platform_name();
    140         return NULL;
    141 }
    142133/** @}
    143134 */
  • kernel/arch/arm32/src/mm/page.c

    rfb8dcb4 re882e3a  
    5252void page_arch_init(void)
    5353{
    54         int flags = PAGE_CACHEABLE | PAGE_EXEC;
     54        int flags = PAGE_CACHEABLE;
    5555        page_mapping_operations = &pt_mapping_operations;
    5656
    5757        page_table_lock(AS_KERNEL, true);
    5858       
     59        uintptr_t cur;
     60
    5961        /* Kernel identity mapping */
    60         //FIXME: We need to consider the possibility that
    61         //identity_base > identity_size and physmem_end.
    62         //This might lead to overflow if identity_size is too big.
    63         for (uintptr_t cur = PHYSMEM_START_ADDR;
    64             cur < min(KA2PA(config.identity_base) +
    65                 config.identity_size, config.physmem_end);
     62        for (cur = PHYSMEM_START_ADDR;
     63            cur < min(config.identity_size, config.physmem_end);
    6664            cur += FRAME_SIZE)
    6765                page_mapping_insert(AS_KERNEL, PA2KA(cur), cur, flags);
  • kernel/genarch/Makefile.inc

    rfb8dcb4 re882e3a  
    101101endif
    102102
    103 ifeq ($(CONFIG_AMDM37X_UART),y)
    104         GENARCH_SOURCES += \
    105                 genarch/src/drivers/amdm37x_uart/amdm37x_uart.c
    106 endif
    107 
    108103ifeq ($(CONFIG_VIA_CUDA),y)
    109104        GENARCH_SOURCES += \
  • tools/mkuimage.py

    rfb8dcb4 re882e3a  
    120120        header.start_addr = start_addr  # Address of entry point
    121121        header.data_crc = data_crc
    122         header.os = 2                   # NetBSD
     122        header.os = 5                   # Linux
    123123        header.arch = 2                 # ARM
    124124        header.img_type = 2             # Kernel
  • uspace/Makefile

    rfb8dcb4 re882e3a  
    174174endif
    175175
    176 ifeq ($(UARCH),arm32)
    177         DIRS += \
    178                 drv/infrastructure/rootamdm37x
    179 endif
    180 
    181176## System libraries
    182177#
  • uspace/drv/bus/usb/ehci/Makefile

    rfb8dcb4 re882e3a  
    4343SOURCES = \
    4444        main.c \
    45         res.c
     45        pci.c
    4646
    4747include $(USPACE_PREFIX)/Makefile.common
  • uspace/drv/bus/usb/ehci/ehci.ma

    rfb8dcb4 re882e3a  
    1 20 usb/host=ehci
    2110 pci/class=0c&subclass=03&progif=20
  • uspace/drv/bus/usb/ehci/main.c

    rfb8dcb4 re882e3a  
    4444#include <usb/host/hcd.h>
    4545
    46 #include "res.h"
     46#include "pci.h"
    4747
    4848#define NAME "ehci"
     
    8181        int irq = 0;
    8282
    83         int ret = get_my_registers(device, &reg_base, &reg_size, &irq);
     83        int ret = pci_get_my_registers(device, &reg_base, &reg_size, &irq);
    8484        CHECK_RET_RETURN(ret,
    8585            "Failed to get memory addresses for %" PRIun ": %s.\n",
     
    8888            reg_base, reg_size, irq);
    8989
    90         ret = disable_legacy(device, reg_base, reg_size);
     90        ret = pci_disable_legacy(device, reg_base, reg_size, irq);
    9191        CHECK_RET_RETURN(ret,
    9292            "Failed to disable legacy USB: %s.\n", str_error(ret));
  • uspace/drv/bus/usb/ohci/Makefile

    rfb8dcb4 re882e3a  
    5050        ohci_batch.c \
    5151        ohci_endpoint.c \
    52         res.c \
     52        pci.c \
    5353        root_hub.c \
    5454        hw_struct/endpoint_descriptor.c \
  • uspace/drv/bus/usb/ohci/hw_struct/hcca.h

    rfb8dcb4 re882e3a  
    4646        uint16_t pad1;
    4747        uint32_t done_head;
    48         uint32_t reserved[30];
    49 } hcca_t;
     48        uint32_t reserved[29];
     49} __attribute__((packed, aligned)) hcca_t;
    5050
    5151static inline void * hcca_get(void)
  • uspace/drv/bus/usb/ohci/ohci.c

    rfb8dcb4 re882e3a  
    4242
    4343#include "ohci.h"
    44 #include "res.h"
     44#include "pci.h"
    4545#include "hc.h"
    4646
     
    180180        int irq = 0;
    181181
    182         ret = get_my_registers(device, &reg_base, &reg_size, &irq);
     182        ret = pci_get_my_registers(device, &reg_base, &reg_size, &irq);
    183183        CHECK_RET_DEST_FREE_RETURN(ret,
    184184            "Failed to get register memory addresses for %" PRIun ": %s.\n",
     
    211211        /* Try to enable interrupts */
    212212        bool interrupts = false;
    213         ret = enable_interrupts(device);
     213        ret = pci_enable_interrupts(device);
    214214        if (ret != EOK) {
    215215                usb_log_warning("Failed to enable interrupts: %s."
  • uspace/drv/bus/usb/ohci/ohci.ma

    rfb8dcb4 re882e3a  
    1 20 usb/host=ohci
    2110 pci/class=0c&subclass=03&progif=10
  • uspace/drv/bus/usb/ohci/ohci_regs.h

    rfb8dcb4 re882e3a  
    228228#define RHPS_PRSC_FLAG (1 << 20) /* port reset status change WC */
    229229#define RHPS_CHANGE_WC_MASK 0x1f0000
    230 } ohci_regs_t;
     230} __attribute__((packed)) ohci_regs_t;
    231231#endif
    232232/**
  • uspace/drv/bus/usb/uhci/Makefile

    rfb8dcb4 re882e3a  
    4444        hc.c \
    4545        main.c \
    46         res.c \
     46        pci.c \
    4747        root_hub.c \
    4848        transfer_list.c \
  • uspace/drv/bus/usb/uhci/uhci.c

    rfb8dcb4 re882e3a  
    4141
    4242#include "uhci.h"
    43 
    44 #include "res.h"
     43#include "pci.h"
     44
    4545#include "hc.h"
    4646#include "root_hub.h"
     
    4949 * and USB root hub */
    5050typedef struct uhci {
    51         /** Pointer to DDF representation of UHCI host controller */
     51        /** Pointer to DDF represenation of UHCI host controller */
    5252        ddf_fun_t *hc_fun;
    53         /** Pointer to DDF representation of UHCI root hub */
     53        /** Pointer to DDF represenation of UHCI root hub */
    5454        ddf_fun_t *rh_fun;
    5555
    56         /** Internal driver's representation of UHCI host controller */
     56        /** Internal driver's represenation of UHCI host controller */
    5757        hc_t hc;
    58         /** Internal driver's representation of UHCI root hub */
     58        /** Internal driver's represenation of UHCI root hub */
    5959        rh_t rh;
    6060} uhci_t;
     
    187187        int irq = 0;
    188188
    189         ret = get_my_registers(device, &reg_base, &reg_size, &irq);
     189        ret = pci_get_my_registers(device, &reg_base, &reg_size, &irq);
    190190        CHECK_RET_DEST_FREE_RETURN(ret,
    191191            "Failed to get I/O addresses for %" PRIun ": %s.\n",
     
    194194            (void *) reg_base, reg_size, irq);
    195195
    196         ret = disable_legacy(device);
     196        ret = pci_disable_legacy(device);
    197197        CHECK_RET_DEST_FREE_RETURN(ret,
    198198            "Failed to disable legacy USB: %s.\n", str_error(ret));
     
    220220
    221221        bool interrupts = false;
    222         ret = enable_interrupts(device);
     222        ret = pci_enable_interrupts(device);
    223223        if (ret != EOK) {
    224224                usb_log_warning("Failed to enable interrupts: %s."
  • uspace/lib/usbdev/include/usb/dev/request.h

    rfb8dcb4 re882e3a  
    9393        uint8_t request;
    9494        /** Main parameter to the request. */
    95         union __attribute__ ((packed)) {
     95        union {
    9696                uint16_t value;
    9797                /* FIXME: add #ifdefs according to host endianness */
    98                 struct __attribute__ ((packed)) {
     98                struct {
    9999                        uint8_t value_low;
    100100                        uint8_t value_high;
     
    108108        uint16_t length;
    109109} __attribute__ ((packed)) usb_device_request_setup_packet_t;
    110 
    111 int assert[(sizeof(usb_device_request_setup_packet_t) == 8) ? 1: -1];
    112110
    113111int usb_control_request_set(usb_pipe_t *,
Note: See TracChangeset for help on using the changeset viewer.