summaryrefslogtreecommitdiffstats
path: root/src/include/kernel/devicesegment.H
blob: 5fc63819b1398ecf03ac8c5a26dd9e3448dc851d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef __KERNEL_DEVICESEGMENT_H
#define __KERNEL_DEVICESEGMENT_H

#include <kernel/segment.H>

class DeviceSegment : public Segment
{
    public:
        DeviceSegment() : Segment(0x020000000000ull) 
            { 
                for (int i = 0; i < MMIO_MAP_DEVICES; i++)
                    iv_mmioMap[i] = 0;
            };
        ~DeviceSegment() {};

        static void init();
        
        bool handlePageFault(task_t* i_task, uint64_t i_addr);

        static void* mmioMap(void* ra, size_t pages); // to be deprecated.
        static int mmioUnmap(void* ea, size_t pages); // to be deprecated.

    private:
        enum { MMIO_MAP_DEVICES = 32 };
        uint64_t iv_mmioMap[MMIO_MAP_DEVICES];

        void _init();

        void* _mmioMap(void* ra, size_t pages);
        int _mmioUnmap(void* ea, size_t pages);
};

#endif
OpenPOWER on IntegriCloud