summaryrefslogtreecommitdiff
path: root/src/lrmi/common_io.c
blob: 3c61ef1c0fa789e42f6524d86ddc3bcb9b3a1167 (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#include <inttypes.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>

#include "libx86.h"
#include "common.h"
#include "common_helper.h"

extern xf86Int10InfoPtr Int10Current;

uint8_t
x_inb(uint16_t port)
{
    uint8_t val;

    val = inb_local(Int10Current->ioBase + port);
    return val;
}

uint16_t
x_inw(uint16_t port)
{
    uint16_t val;

    val = inw_local(Int10Current->ioBase + port);

    return val;
}

uint32_t
x_inl(uint16_t port)
{
    uint32_t val;

    val = inl_local(Int10Current->ioBase + port);
    return val;
}

void
x_outl(uint16_t port, uint32_t val)
{
    outl_local(Int10Current->ioBase + port, val);
}

void
x_outb(uint16_t port, uint8_t val)
{
    outb_local(Int10Current->ioBase + port, val);
}

void
x_outw(uint16_t port, uint16_t val)
{
    outw_local(Int10Current->ioBase + port, val);
}

static uint8_t
Mem_rb(uint32_t addr)
{
    return (*Int10Current->mem->rb)(Int10Current, addr);
}

static uint16_t
Mem_rw(uint32_t addr)
{
    return (*Int10Current->mem->rw)(Int10Current, addr);
}

#if 0
static uint32_t
Mem_rl(uint32_t addr)
{
    return (*Int10Current->mem->rl)(Int10Current, addr);
}

static void
Mem_wb(uint32_t addr, uint8_t val)
{
    (*Int10Current->mem->wb)(Int10Current, addr, val);
}

static void
Mem_ww(uint32_t addr, uint16_t val)
{
    (*Int10Current->mem->ww)(Int10Current, addr, val);
}

static void
Mem_wl(uint32_t addr, uint32_t val)
{
    (*Int10Current->mem->wl)(Int10Current, addr, val);
}
#endif