Subversion Repositories HelenOS-historic

Rev

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

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