Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/ia64/src/ddi/ddi.c

    r8cd680c r9d58539  
    11/*
    22 * Copyright (c) 2006 Jakub Jermar
    3  * Copyright (c) 2008 Jakub Vana
     3 * Copyright (c) 2008 Jakub vana
    44 * All rights reserved.
    55 *
     
    4747 * Interrupts are disabled and task is locked.
    4848 *
    49  * @param task   Task.
    50  * @param ioaddr Starting I/O space address.
    51  * @param size   Size of the enabled I/O range.
     49 * @param task          Task.
     50 * @param ioaddr        Starting I/O space address.
     51 * @param size          Size of the enabled I/O range.
    5252 *
    53  * @return EOK on success or an error code from errno.h.
     53 * @return 0 on success or an error code from errno.h.
    5454 */
    5555int ddi_iospace_enable_arch(task_t *task, uintptr_t ioaddr, size_t size)
    5656{
    5757        if (!task->arch.iomap) {
     58                uint8_t *map;
     59
    5860                task->arch.iomap = malloc(sizeof(bitmap_t), 0);
    59                 if (task->arch.iomap == NULL)
     61                map = malloc(BITS2BYTES(IO_MEMMAP_PAGES), 0);
     62                if(!map)
    6063                        return ENOMEM;
    61                
    62                 void *store = malloc(bitmap_size(IO_MEMMAP_PAGES), 0);
    63                 if (store == NULL)
    64                         return ENOMEM;
    65                
    66                 bitmap_initialize(task->arch.iomap, IO_MEMMAP_PAGES, store);
     64                bitmap_initialize(task->arch.iomap, map, IO_MEMMAP_PAGES);
    6765                bitmap_clear_range(task->arch.iomap, 0, IO_MEMMAP_PAGES);
    6866        }
     
    7169        size = ALIGN_UP(size + ioaddr - 4 * iopage, PORTS_PER_PAGE);
    7270        bitmap_set_range(task->arch.iomap, iopage, size / 4);
    73        
    74         return EOK;
    75 }
    7671
    77 /** Disable I/O space range for task.
    78  *
    79  * Interrupts are disabled and task is locked.
    80  *
    81  * @param task   Task.
    82  * @param ioaddr Starting I/O space address.
    83  * @param size   Size of the disabled I/O range.
    84  *
    85  * @return EOK on success or an error code from errno.h.
    86  */
    87 int ddi_iospace_disable_arch(task_t *task, uintptr_t ioaddr, size_t size)
    88 {
    89         if (!task->arch.iomap)
    90                 return EINVAL;
    91 
    92         uintptr_t iopage = ioaddr / PORTS_PER_PAGE;
    93         size = ALIGN_UP(size + ioaddr - 4 * iopage, PORTS_PER_PAGE);
    94         bitmap_clear_range(task->arch.iomap, iopage, size / 4);
    95        
    96         return EOK;
     72        return 0;
    9773}
    9874
Note: See TracChangeset for help on using the changeset viewer.