Changeset ff3a34b in mainline for uspace


Ignore:
Timestamp:
2007-06-01T14:15:42Z (18 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)

Location:
uspace
Files:
3 added
2 edited

Legend:

Unmodified
Added
Removed
  • 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.