Changeset 925a21e in mainline for boot


Ignore:
Timestamp:
2011-09-24T14:20:29Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5bf76c1
Parents:
867e2555 (diff), 1ab4aca (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 mainline changes.

Location:
boot
Files:
6 added
8 edited
1 moved

Legend:

Unmodified
Added
Removed
  • boot/Makefile

    r867e2555 r925a21e  
    6161                cp "$$file" "$(DIST_PATH)/lib/" ; \
    6262        done
     63ifeq ($(CONFIG_DEVEL_FILES), y)
     64        mkdir "$(DIST_PATH)/inc/c/"
     65        cp -r -L "$(USPACE_PATH)/lib/c/include/." "$(DIST_PATH)/inc/c/"
     66        cat "$(USPACE_PATH)/lib/c/arch/$(UARCH)/_link.ld" | sed 's/^STARTUP(.*)$$//g' > "$(DIST_PATH)/inc/_link.ld"
     67endif
    6368        for file in $(RD_APPS) ; do \
    6469                cp "$$file" "$(DIST_PATH)/app/" ; \
     
    9499        rm -rf $(USPACE_PATH)/dist/drv/*
    95100        rm -f $(USPACE_PATH)/dist/lib/*
     101        rm -rf $(USPACE_PATH)/dist/inc/*
    96102        rm -f $(USPACE_PATH)/dist/app/*
    97103        rm -f $(USPACE_PATH)/dist/cfg/net/*
  • boot/Makefile.common

    r867e2555 r925a21e  
    7373        $(USPACE_PATH)/srv/loader/loader \
    7474        $(USPACE_PATH)/app/init/init \
    75         $(USPACE_PATH)/srv/devmap/devmap \
     75        $(USPACE_PATH)/srv/loc/loc \
    7676        $(USPACE_PATH)/srv/bd/rd/rd \
    7777        $(USPACE_PATH)/srv/vfs/vfs
     
    9393        $(USPACE_PATH)/srv/hid/input/input \
    9494        $(USPACE_PATH)/srv/hid/console/console \
    95         $(USPACE_PATH)/srv/fs/devfs/devfs
     95        $(USPACE_PATH)/srv/fs/locfs/locfs
    9696
    9797RD_SRVS_NON_ESSENTIAL = \
     
    102102        $(USPACE_PATH)/srv/fs/tmpfs/tmpfs \
    103103        $(USPACE_PATH)/srv/fs/fat/fat \
     104        $(USPACE_PATH)/srv/fs/mfs/mfs \
     105        $(USPACE_PATH)/srv/fs/cdfs/cdfs \
     106        $(USPACE_PATH)/srv/fs/exfat/exfat \
    104107        $(USPACE_PATH)/srv/fs/ext2fs/ext2fs \
    105108        $(USPACE_PATH)/srv/taskmon/taskmon \
     
    127130RD_LIBS =
    128131
     132ifeq ($(CONFIG_DEVEL_FILES), y)
     133        RD_LIBS += \
     134                $(USPACE_PATH)/lib/c/libc.a \
     135                $(USPACE_PATH)/lib/softint/libsoftint.a \
     136                $(USPACE_PATH)/lib/softfloat/libsoftfloat.a
     137endif
     138
    129139ifeq ($(CONFIG_BUILD_SHARED_LIBS), y)
    130140        RD_LIBS += \
     
    143153        $(USPACE_PATH)/app/blkdump/blkdump \
    144154        $(USPACE_PATH)/app/bnchmark/bnchmark \
     155        $(USPACE_PATH)/app/devctl/devctl \
    145156        $(USPACE_PATH)/app/dltest/dltest \
    146157        $(USPACE_PATH)/app/dltest2/dltest2 \
     
    150161        $(USPACE_PATH)/app/kill/kill \
    151162        $(USPACE_PATH)/app/killall/killall \
     163        $(USPACE_PATH)/app/locinfo/locinfo \
    152164        $(USPACE_PATH)/app/mkfat/mkfat \
     165        $(USPACE_PATH)/app/mkmfs/mkmfs \
    153166        $(USPACE_PATH)/app/lsusb/lsusb \
    154167        $(USPACE_PATH)/app/sbi/sbi \
     168        $(USPACE_PATH)/app/sportdmp/sportdmp \
    155169        $(USPACE_PATH)/app/redir/redir \
    156170        $(USPACE_PATH)/app/taskdump/taskdump \
     
    171185        $(USPACE_PATH)/app/websrv/websrv
    172186
     187ifeq ($(CONFIG_PCC),y)
     188RD_APPS_NON_ESSENTIAL += \
     189        $(USPACE_PATH)/app/cc/cc \
     190        $(USPACE_PATH)/app/ccom/ccom \
     191        $(USPACE_PATH)/app/ccom/mkext/cc_mkext \
     192        $(USPACE_PATH)/app/cpp/cpp
     193endif
     194
     195ifeq ($(CONFIG_BINUTILS),y)
     196RD_APPS_NON_ESSENTIAL += \
     197        $(USPACE_PATH)/app/binutils/bin/as \
     198        $(USPACE_PATH)/app/binutils/bin/ld
     199endif
     200
    173201ifneq ($(CONFIG_BAREBONE),y)
    174202NET_CFG = \
  • boot/arch/ia64/Makefile.inc

    r867e2555 r925a21e  
    4545        arch/$(BARCH)/src/asm.S \
    4646        arch/$(BARCH)/src/main.c \
     47        arch/$(BARCH)/src/sal.c \
     48        arch/$(BARCH)/src/sal_asm.S \
     49        arch/$(BARCH)/src/pal.c \
     50        arch/$(BARCH)/src/pal_asm.S \
    4751        arch/$(BARCH)/src/putchar.c \
    4852        $(COMPS_C) \
     53        genarch/src/efi.c \
    4954        genarch/src/division.c \
    5055        generic/src/balloc.c \
  • boot/arch/ia64/src/main.c

    r867e2555 r925a21e  
    3535#include <arch/_components.h>
    3636#include <genarch/efi.h>
     37#include <arch/sal.h>
     38#include <arch/pal.h>
    3739#include <halt.h>
    3840#include <printf.h>
     
    117119}
    118120
    119 static void read_sal_configuration(void)
    120 {
    121         if (!bootpar) {
     121static void read_pal_configuration(void)
     122{
     123        if (bootpar) {
     124                bootinfo.freq_scale = pal_proc_freq_ratio();
     125        } else {
    122126                /* Configure default values for simulators. */
    123127                bootinfo.freq_scale = DEFAULT_FREQ_SCALE;
    124                 bootinfo.sys_freq = DEFAULT_SYS_FREQ;
     128        }
     129}
     130
     131static void read_sal_configuration(void)
     132{
     133        if (bootpar && bootpar->efi_system_table) {
     134                efi_guid_t sal_guid = SAL_SYSTEM_TABLE_GUID;
     135                sal_system_table_header_t *sal_st;
     136               
     137                sal_st = efi_vendor_table_find(
     138                    (efi_system_table_t *) bootpar->efi_system_table, sal_guid);
     139
     140                sal_system_table_parse(sal_st);
     141               
     142                bootinfo.sys_freq = sal_base_clock_frequency();
    125143        } else {
    126                 /* TODO: read the real values from SAL */
    127                 bootinfo.freq_scale = DEFAULT_FREQ_SCALE;
     144                /* Configure default values for simulators. */
    128145                bootinfo.sys_freq = DEFAULT_SYS_FREQ;
    129146        }
     
    189206        read_efi_memmap();
    190207        read_sal_configuration();
     208        read_pal_configuration();
    191209       
    192210        printf("Booting the kernel ...\n");
  • boot/arch/ia64/src/sal.c

    r867e2555 r925a21e  
    11/*
    2  * Copyright (c) 2011 Vojtech Horky
     2 * Copyright (c) 2011 Jakub Jermar
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup tester
    30  * @brief Test devman service.
    31  * @{
    32  */
    33 /**
    34  * @file
    35  */
     29#include <arch/sal.h>
     30#include <arch/types.h>
    3631
    37 #include <inttypes.h>
    38 #include <errno.h>
    39 #include <str_error.h>
    40 #include <sys/types.h>
    41 #include <async.h>
    42 #include <devman.h>
    43 #include <str.h>
    44 #include <async.h>
    45 #include <vfs/vfs.h>
    46 #include <vfs/vfs_sess.h>
    47 #include <sys/stat.h>
    48 #include <fcntl.h>
    49 #include "../tester.h"
     32static sal_ap_wakeup_desc_t *sal_ap_wakeup;
    5033
    51 #define DEVICE_CLASS "test3"
     34extern uint64_t pal_proc;
    5235
    53 const char *test_devman2(void)
     36uint64_t sal_proc = 0;
     37uint64_t sal_proc_gp = 0;
     38
     39void sal_system_table_parse(sal_system_table_header_t *sst)
    5440{
    55         size_t idx = 1;
    56         int rc = EOK;
    57         const char *err_msg = NULL;
    58         char *path = NULL;
    59         while (rc == EOK) {
    60                 rc = asprintf(&path, "/dev/class/%s\\%zu", DEVICE_CLASS, idx);
    61                 if (rc < 0) {
    62                         continue;
     41        uint8_t *cur = (uint8_t *) &sst[1];
     42        uint16_t entry;
     43
     44        for (entry = 0; entry < sst->entry_count; entry++) {
     45                switch ((sal_sst_type_t) *cur) {
     46                case SSTT_ENTRYPOINT_DESC:
     47                        pal_proc = ((sal_entrypoint_desc_t *) cur)->pal_proc;
     48                        sal_proc = ((sal_entrypoint_desc_t *) cur)->sal_proc;
     49                        sal_proc_gp = ((sal_entrypoint_desc_t *) cur)->sal_proc_gp;
     50                        cur += sizeof(sal_entrypoint_desc_t);
     51                        break;
     52                case SSTT_MEMORY_DESC:
     53                        cur += sizeof(sal_memory_desc_t);
     54                        break;
     55                case SSTT_PLATFORM_FEATURES_DESC:
     56                        cur += sizeof(sal_platform_features_desc_t);
     57                        break;
     58                case SSTT_TR_DESC:
     59                        cur += sizeof(sal_tr_desc_t);
     60                        break;
     61                case SSTT_PTC_COHERENCE_DOMAIN_DESC:
     62                        cur += sizeof(sal_ptc_coherence_domain_desc_t);
     63                        break;
     64                case SSTT_AP_WAKEUP_DESC:
     65                        sal_ap_wakeup = (sal_ap_wakeup_desc_t *) cur;
     66                        cur += sizeof(sal_ap_wakeup_desc_t);
     67                        break;
     68                default:
     69                        return;
    6370                }
    64                 int fd = open(path, O_RDONLY);
    65                 if (fd < 0) {
    66                         TPRINTF("Failed opening `%s': %s.\n",
    67                             path, str_error(fd));
    68                         rc = fd;
    69                         err_msg = "Failed opening file";
    70                         continue;
    71                 }
    72                 async_sess_t *sess = fd_session(EXCHANGE_SERIALIZE, fd);
    73                 close(fd);
    74                 if (sess == NULL) {
    75                         TPRINTF("Failed opening phone: %s.\n", str_error(errno));
    76                         rc = errno;
    77                         err_msg = "Failed opening file descriptor phone";
    78                         continue;
    79                 }
    80                 async_hangup(sess);
    81                 TPRINTF("Path `%s' okay.\n", path);
    82                 free(path);
    83                 idx++;
    84                 rc = EOK;
    8571        }
    86        
    87         if (path != NULL)
    88                 free(path);
    89        
    90         return err_msg;
    9172}
    9273
    93 /** @}
    94  */
     74uint64_t sal_base_clock_frequency(void)
     75{
     76        uint64_t freq;
     77       
     78        sal_call_1_1(SAL_FREQ_BASE, 0, &freq);
     79       
     80        return freq;
     81}
  • boot/arch/mips32/src/asm.S

    r867e2555 r925a21e  
    4444         * Setup the CP0 configuration
    4545         *  - Disable 64-bit kernel addressing mode
    46          *  - DIsable 64-bit supervisor adressing mode
     46         *  - Disable 64-bit supervisor adressing mode
    4747         *  - Disable 64-bit user addressing mode
    4848         */
  • boot/arch/mips64/src/asm.S

    r867e2555 r925a21e  
    4747         *  - Enable 64-bit user addressing mode
    4848         */
    49         dmfc0 $a0, $status
     49        mfc0 $a0, $status
    5050        ori $a0, 0x00e0
    51         dmtc0 $a0, $status
     51        mtc0 $a0, $status
    5252       
    5353        /*
  • boot/genarch/include/efi.h

    r867e2555 r925a21e  
    3030#define BOOT_EFI_H_
    3131
     32#include <arch/types.h>
     33
     34typedef struct {
     35        uint64_t signature;
     36        uint32_t revision;
     37        uint32_t header_size;
     38        uint32_t crc32;
     39        uint32_t reserved;
     40} efi_table_header_t;
     41
     42#define SAL_SYSTEM_TABLE_GUID \
     43        { \
     44                { \
     45                        0x32, 0x2d, 0x9d, 0xeb, 0x88, 0x2d, 0xd3, 0x11, \
     46                        0x9a, 0x16, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d \
     47                } \
     48        }
     49
     50typedef union {
     51        uint8_t bytes[16];
     52        struct {
     53                uint64_t low;
     54                uint64_t high;
     55        };
     56} efi_guid_t;
     57
     58typedef struct {
     59        efi_guid_t guid;
     60        void *table;
     61} efi_configuration_table_t;
     62
     63typedef struct {
     64        efi_table_header_t hdr;
     65        char *fw_vendor;
     66        uint32_t fw_revision;
     67        void *cons_in_handle;
     68        void *cons_in;
     69        void *cons_out_handle;
     70        void *cons_out;
     71        void *cons_err_handle;
     72        void *cons_err;
     73        void *runtime_services;
     74        void *boot_services;
     75        sysarg_t conf_table_entries;
     76        efi_configuration_table_t *conf_table;
     77} efi_system_table_t;
     78
    3279typedef enum {
    3380        EFI_RESERVED,
     
    57104#define EFI_PAGE_SIZE   4096
    58105
     106extern void *efi_vendor_table_find(efi_system_table_t *, efi_guid_t);
     107
    59108#endif
  • boot/generic/src/printf_core.c

    r867e2555 r925a21e  
    7070 */
    7171#define PRINT_NUMBER_BUFFER_SIZE  (64 + 5)
     72
     73/** Get signed or unsigned integer argument */
     74#define PRINTF_GET_INT_ARGUMENT(type, ap, flags) \
     75        ({ \
     76                unsigned type res; \
     77                \
     78                if ((flags) & __PRINTF_FLAG_SIGNED) { \
     79                        signed type arg = va_arg((ap), signed type); \
     80                        \
     81                        if (arg < 0) { \
     82                                res = -arg; \
     83                                (flags) |= __PRINTF_FLAG_NEGATIVE; \
     84                        } else \
     85                                res = arg; \
     86                } else \
     87                        res = va_arg((ap), unsigned type); \
     88                \
     89                res; \
     90        })
    7291
    7392/** Enumeration of possible arguments types.
     
    171190        }
    172191       
    173         return (int) (counter + 1);
     192        return (int) (counter);
    174193}
    175194
     
    698717                        size_t size;
    699718                        uint64_t number;
     719                       
    700720                        switch (qualifier) {
    701721                        case PrintfQualifierByte:
    702722                                size = sizeof(unsigned char);
    703                                 number = (uint64_t) va_arg(ap, unsigned int);
     723                                number = PRINTF_GET_INT_ARGUMENT(int, ap, flags);
    704724                                break;
    705725                        case PrintfQualifierShort:
    706726                                size = sizeof(unsigned short);
    707                                 number = (uint64_t) va_arg(ap, unsigned int);
     727                                number = PRINTF_GET_INT_ARGUMENT(int, ap, flags);
    708728                                break;
    709729                        case PrintfQualifierInt:
    710730                                size = sizeof(unsigned int);
    711                                 number = (uint64_t) va_arg(ap, unsigned int);
     731                                number = PRINTF_GET_INT_ARGUMENT(int, ap, flags);
    712732                                break;
    713733                        case PrintfQualifierLong:
    714734                                size = sizeof(unsigned long);
    715                                 number = (uint64_t) va_arg(ap, unsigned long);
     735                                number = PRINTF_GET_INT_ARGUMENT(long, ap, flags);
    716736                                break;
    717737                        case PrintfQualifierLongLong:
    718738                                size = sizeof(unsigned long long);
    719                                 number = (uint64_t) va_arg(ap, unsigned long long);
     739                                number = PRINTF_GET_INT_ARGUMENT(long long, ap, flags);
    720740                                break;
    721741                        case PrintfQualifierPointer:
     
    732752                                counter = -counter;
    733753                                goto out;
    734                         }
    735                        
    736                         if (flags & __PRINTF_FLAG_SIGNED) {
    737                                 if (number & (0x1 << (size * 8 - 1))) {
    738                                         flags |= __PRINTF_FLAG_NEGATIVE;
    739                                        
    740                                         if (size == sizeof(uint64_t)) {
    741                                                 number = -((int64_t) number);
    742                                         } else {
    743                                                 number = ~number;
    744                                                 number &=
    745                                                     ~(0xFFFFFFFFFFFFFFFFll <<
    746                                                     (size * 8));
    747                                                 number++;
    748                                         }
    749                                 }
    750754                        }
    751755                       
Note: See TracChangeset for help on using the changeset viewer.