blob: 903ad7c6a3be88ccfd206f5b81f254af64998c24 (
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
|
/*
* The PCI Library -- Access to i386 I/O ports on Solaris
*
* Copyright (c) 2003 Bill Moore <billm@eng.sun.com>
* Copyright (c) 2003--2006 Martin Mares <mj@ucw.cz>
*
* Can be freely distributed and used under the terms of the GNU GPL.
*/
#include <sys/sysi86.h>
#include <sys/psw.h>
static int
intel_setup_io(struct pci_access *a UNUSED)
{
return (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0) ? 0 : 1;
}
static inline void
intel_cleanup_io(struct pci_access *a UNUSED)
{
/* FIXME: How to switch off I/O port access? */
}
static inline u8
inb (u16 port)
{
u8 v;
__asm__ __volatile__ ("inb (%w1)":"=a" (v):"Nd" (port));
return v;
}
static inline u16
inw (u16 port)
{
u16 v;
__asm__ __volatile__ ("inw (%w1)":"=a" (v):"Nd" (port));
return v;
}
static inline u32
inl (u16 port)
{
u32 v;
__asm__ __volatile__ ("inl (%w1)":"=a" (v):"Nd" (port));
return v;
}
static inline void
outb (u8 value, u16 port)
{
__asm__ __volatile__ ("outb (%w1)": :"a" (value), "Nd" (port));
}
static inline void
outw (u16 value, u16 port)
{
__asm__ __volatile__ ("outw (%w1)": :"a" (value), "Nd" (port));
}
static inline void
outl (u32 value, u16 port)
{
__asm__ __volatile__ ("outl (%w1)": :"a" (value), "Nd" (port));
}
static inline void intel_io_lock(void)
{
}
static inline void intel_io_unlock(void)
{
}
|