Subversion Repositories HelenOS-historic

Rev

Rev 1705 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1705 Rev 1780
Line 53... Line 53...
53
 * @param ioaddr Startign I/O space address.
53
 * @param ioaddr Startign I/O space address.
54
 * @param size Size of the enabled I/O range.
54
 * @param size Size of the enabled I/O range.
55
 *
55
 *
56
 * @return 0 on success or an error code from errno.h.
56
 * @return 0 on success or an error code from errno.h.
57
 */
57
 */
58
int ddi_iospace_enable_arch(task_t *task, __address ioaddr, size_t size)
58
int ddi_iospace_enable_arch(task_t *task, uintptr_t ioaddr, size_t size)
59
{
59
{
60
    count_t bits;
60
    count_t bits;
61
 
61
 
62
    bits = ioaddr + size;
62
    bits = ioaddr + size;
63
    if (bits > IO_PORTS)
63
    if (bits > IO_PORTS)
64
        return ENOENT;
64
        return ENOENT;
65
 
65
 
66
    if (task->arch.iomap.bits < bits) {
66
    if (task->arch.iomap.bits < bits) {
67
        bitmap_t oldiomap;
67
        bitmap_t oldiomap;
68
        __u8 *newmap;
68
        uint8_t *newmap;
69
   
69
   
70
        /*
70
        /*
71
         * The I/O permission bitmap is too small and needs to be grown.
71
         * The I/O permission bitmap is too small and needs to be grown.
72
         */
72
         */
73
       
73
       
74
        newmap = (__u8 *) malloc(BITS2BYTES(bits), FRAME_ATOMIC);
74
        newmap = (uint8_t *) malloc(BITS2BYTES(bits), FRAME_ATOMIC);
75
        if (!newmap)
75
        if (!newmap)
76
            return ENOMEM;
76
            return ENOMEM;
77
       
77
       
78
        bitmap_initialize(&oldiomap, task->arch.iomap.map, task->arch.iomap.bits);
78
        bitmap_initialize(&oldiomap, task->arch.iomap.map, task->arch.iomap.bits);
79
        bitmap_initialize(&task->arch.iomap, newmap, bits);
79
        bitmap_initialize(&task->arch.iomap, newmap, bits);