Changeset c5ebb59 in mainline


Ignore:
Timestamp:
2011-12-08T20:17:19Z (13 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
40898df
Parents:
1adbf90 (diff), b5daa89 (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:

fix ticket #399 on ia32
(the amd64 case is probably unrelated)

Location:
uspace
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/ddi.c

    r1adbf90 rc5ebb59  
    5353}
    5454
    55 /** Map piece of physical memory to task.
     55/** Map a piece of physical memory to task.
    5656 *
    5757 * Caller of this function must have the CAP_MEM_MANAGER capability.
    5858 *
    59  * @param pf            Physical address of the starting frame.
    60  * @param vp            Virtual address of the starting page.
    61  * @param pages         Number of pages to map.
    62  * @param flags         Flags for the new address space area.
     59 * @param pf    Physical address of the starting frame.
     60 * @param vp    Virtual address of the starting page.
     61 * @param pages Number of pages to map.
     62 * @param flags Flags for the new address space area.
    6363 *
    64  * @return              0 on success, EPERM if the caller lacks the
    65  *                      CAP_MEM_MANAGER capability, ENOENT if there is no task
    66  *                      with specified ID and ENOMEM if there was some problem
    67  *                      in creating address space area.
     64 * @return EOK on success
     65 * @return EPERM if the caller lacks the CAP_MEM_MANAGER capability
     66 * @return ENOENT if there is no task with specified ID
     67 * @return ENOMEM if there was some problem in creating
     68 *         the address space area.
     69 *
    6870 */
    69 int physmem_map(void *pf, void *vp, unsigned long pages, int flags)
     71int physmem_map(void *pf, void *vp, size_t pages, unsigned int flags)
    7072{
    71         return __SYSCALL4(SYS_PHYSMEM_MAP, (sysarg_t) pf, (sysarg_t) vp, pages,
    72             flags);
     73        return __SYSCALL4(SYS_PHYSMEM_MAP, (sysarg_t) pf, (sysarg_t) vp,
     74            pages, flags);
    7375}
    7476
  • uspace/lib/c/include/ddi.h

    r1adbf90 rc5ebb59  
    4141
    4242extern int device_assign_devno(void);
    43 extern int physmem_map(void *, void *, unsigned long, int);
     43extern int physmem_map(void *, void *, size_t, unsigned int);
    4444extern int iospace_enable(task_id_t, void *, unsigned long);
    4545extern int pio_enable(void *, size_t, void **);
  • uspace/srv/bd/rd/rd.c

    r1adbf90 rc5ebb59  
    5555#include <ipc/bd.h>
    5656#include <macros.h>
    57 
    58 #define NAME "rd"
     57#include <inttypes.h>
     58
     59#define NAME  "rd"
    5960
    6061/** Pointer to the ramdisk's image */
     
    208209static bool rd_init(void)
    209210{
    210         int ret = sysinfo_get_value("rd.size", &rd_size);
    211         if ((ret != EOK) || (rd_size == 0)) {
     211        sysarg_t size;
     212        int ret = sysinfo_get_value("rd.size", &size);
     213        if ((ret != EOK) || (size == 0)) {
    212214                printf("%s: No RAM disk found\n", NAME);
    213215                return false;
    214216        }
    215217       
    216         sysarg_t rd_ph_addr;
    217         ret = sysinfo_get_value("rd.address.physical", &rd_ph_addr);
    218         if ((ret != EOK) || (rd_ph_addr == 0)) {
     218        sysarg_t addr_phys;
     219        ret = sysinfo_get_value("rd.address.physical", &addr_phys);
     220        if ((ret != EOK) || (addr_phys == 0)) {
    219221                printf("%s: Invalid RAM disk physical address\n", NAME);
    220222                return false;
    221223        }
    222224       
     225        rd_size = ALIGN_UP(size, block_size);
    223226        rd_addr = as_get_mappable_page(rd_size);
    224227       
    225         int flags = AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE;
    226         int retval = physmem_map((void *) rd_ph_addr, rd_addr,
     228        unsigned int flags =
     229            AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE;
     230        ret = physmem_map((void *) addr_phys, rd_addr,
    227231            ALIGN_UP(rd_size, PAGE_SIZE) >> PAGE_WIDTH, flags);
    228        
    229         if (retval < 0) {
     232        if (ret < 0) {
    230233                printf("%s: Error mapping RAM disk\n", NAME);
    231234                return false;
    232235        }
    233236       
    234         printf("%s: Found RAM disk at %p, %zu bytes\n", NAME,
    235             (void *) rd_ph_addr, rd_size);
    236        
    237         int rc = loc_server_register(NAME, rd_connection);
    238         if (rc < 0) {
    239                 printf("%s: Unable to register driver (%d)\n", NAME, rc);
     237        printf("%s: Found RAM disk at %p, %" PRIun " bytes\n", NAME,
     238            (void *) addr_phys, size);
     239       
     240        ret = loc_server_register(NAME, rd_connection);
     241        if (ret < 0) {
     242                printf("%s: Unable to register driver (%d)\n", NAME, ret);
    240243                return false;
    241244        }
    242245       
    243246        service_id_t service_id;
    244         if (loc_service_register("bd/initrd", &service_id) != EOK) {
     247        ret = loc_service_register("bd/initrd", &service_id);
     248        if (ret != EOK) {
    245249                printf("%s: Unable to register device service\n", NAME);
    246250                return false;
Note: See TracChangeset for help on using the changeset viewer.