Changeset ff3a34b in mainline


Ignore:
Timestamp:
2007-06-01T14:15:42Z (17 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ea7890e7
Parents:
60133d0
Message:

initial merge of branches/fs
(not finished, huge cleanup is needed)

Files:
3 added
7 edited

Legend:

Unmodified
Added
Removed
  • kernel/doc/AUTHORS

    r60133d0 rff3a34b  
    55Josef Cejka <cejka@helenos.eu>
    66Sergey Bondari <bondari@helenos.eu>
     7Michal Konopa <mkonopa@seznam.cz>
    78
  • kernel/generic/include/errno.h

    r60133d0 rff3a34b  
    3838/* 1-255 are kernel error codes, 256-512 are user error codes */
    3939
     40#define EOK                     0       /* No error */
    4041#define ENOENT          -1      /* No such entry */
    4142#define ENOMEM          -2      /* Not enough memory */
  • kernel/generic/include/lib/rd.h

    r60133d0 rff3a34b  
    4141 * RAM disk version
    4242 */
    43 #define RD_VERSION      0
     43#define RD_VERSION      1
    4444
    4545/**
  • kernel/generic/src/lib/rd.c

    r60133d0 rff3a34b  
    4343#include <sysinfo/sysinfo.h>
    4444#include <ddi/ddi.h>
     45#include <print.h>
     46#include <align.h>
    4547
    4648static parea_t rd_parea;                /**< Physical memory area for rd. */
    4749
     50/**
     51 * RAM disk initialization routine. At this point, the RAM disk memory is shared
     52 * and information about the share is provided as sysinfo values to the userspace
     53 * tasks.
     54 */ 
    4855int init_rd(rd_header * header, size_t size)
    4956{
     
    7582                return RE_UNSUPPORTED;
    7683       
     84        if (dsize % FRAME_SIZE)
     85                return RE_UNSUPPORTED;
     86
    7787        if (hsize > size)
    7888                return RE_INVALID;
     
    8191                dsize = size - hsize;
    8292       
    83         rd_parea.pbase = KA2PA((void *) header + hsize);
     93        rd_parea.pbase = ALIGN_DOWN((uintptr_t) KA2PA((void *) header + hsize), FRAME_SIZE);
    8494        rd_parea.vbase = (uintptr_t) ((void *) header + hsize);
    8595        rd_parea.frames = SIZE2FRAMES(dsize);
     
    8898
    8999        sysinfo_set_item_val("rd", NULL, true);
     100        sysinfo_set_item_val("rd.header_size", NULL, hsize);   
    90101        sysinfo_set_item_val("rd.size", NULL, dsize);
    91102        sysinfo_set_item_val("rd.address.physical", NULL, (unative_t)
  • kernel/generic/src/main/kinit.c

    r60133d0 rff3a34b  
    168168                task_t *utask = task_run_program((void *) init.tasks[i].addr,
    169169                    "uspace");
     170               
    170171                if (utask) {
    171172                        /*
     
    182183                       
    183184                        if (rd != RE_OK)
    184                                 printf("Init binary %zd not used.\n", i);
     185                                printf("Init binary %zd not used, error code %d.\n", i, rd);
    185186                }
    186187        }
  • uspace/libc/include/ipc/services.h

    r60133d0 rff3a34b  
    4343#define SERVICE_CONSOLE         4
    4444#define SERVICE_RD              5
     45#define SERVICE_FS              6
    4546
    4647/* Memory area to be received from NS */
  • uspace/rd/rd.c

    r60133d0 rff3a34b  
    11/*
    2  * Copyright (c) 2006 Martin Decky
     2 * Copyright (c) 2007 Michal Konopa
     3 * Copyright (c) 2007 Martin Jelen
     4 * Copyright (c) 2007 Peter Majer
    35 * All rights reserved.
    46 *
     
    4648#include <errno.h>
    4749#include <async.h>
     50#include <stdlib.h>
     51#include <unistd.h>
     52#include <align.h>
     53#include <async.h>
     54#include <ddi.h>
     55#include <libarch/ddi.h>
     56#include <stdio.h>
     57#include "rd.h"
    4858
     59static void *rd_addr;
     60static void *fs_addr;
    4961
    5062static void rd_connection(ipc_callid_t iid, ipc_call_t *icall)
     
    5567
    5668        ipc_answer_fast(iid, 0, 0, 0);
     69        ipcarg_t offset;
    5770
    5871        while (1) {
    5972                callid = async_get_call(&call);
    6073                switch (IPC_GET_METHOD(call)) {
    61                 case IPC_M_PHONE_HUNGUP:
    62                         ipc_answer_fast(callid, 0,0,0);
    63                         return;
    64                 default:
    65                         retval = EINVAL;
     74                        case IPC_M_PHONE_HUNGUP:
     75                                ipc_answer_fast(callid, 0,0,0);
     76                                return;
     77                        case IPC_M_AS_AREA_SEND:
     78                                ipc_answer_fast(callid, 0, (uintptr_t)fs_addr, 0);
     79                                continue;
     80                        case RD_READ_BLOCK:                     
     81                                offset = IPC_GET_ARG1(call);
     82                                memcpy((void *)fs_addr, rd_addr+offset, BLOCK_SIZE);
     83                                retval = EOK;
     84                                break;
     85                        default:
     86                                retval = EINVAL;
    6687                }
    6788                ipc_answer_fast(callid, retval, 0, 0);
     
    7293static bool rd_init(void)
    7394{
     95        int retval, flags;
     96
    7497        size_t rd_size = sysinfo_value("rd.size");
    7598        void * rd_ph_addr = (void *) sysinfo_value("rd.address.physical");
     
    78101                return false;
    79102       
    80         void * rd_addr = as_get_mappable_page(rd_size);
     103        rd_addr = as_get_mappable_page(rd_size);
    81104       
    82         physmem_map(rd_ph_addr, rd_addr, ALIGN_UP(rd_size, PAGE_SIZE) >> PAGE_WIDTH, AS_AREA_READ | AS_AREA_WRITE);
     105        flags = AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE;
     106        retval = physmem_map(rd_ph_addr, rd_addr, ALIGN_UP(rd_size, PAGE_SIZE) >> PAGE_WIDTH, flags);
     107
     108        if (retval < 0)
     109                return false;
    83110       
     111        size_t fs_size = ALIGN_UP(BLOCK_SIZE * sizeof(char), PAGE_SIZE);
     112        fs_addr = as_get_mappable_page(fs_size);
     113
    84114        return true;
    85115}
    86 
    87116
    88117int main(int argc, char **argv)
Note: See TracChangeset for help on using the changeset viewer.