]> git.ipfire.org Git - thirdparty/pciutils.git/blame - lib/i386-io-sunos.h
pciutils: Add the support for a DOS/DJGPP environment
[thirdparty/pciutils.git] / lib / i386-io-sunos.h
CommitLineData
68245cfd
MM
1/*
2 * The PCI Library -- Access to i386 I/O ports on Solaris
3 *
4 * Copyright (c) 2003 Bill Moore <billm@eng.sun.com>
9007a292 5 * Copyright (c) 2003--2006 Martin Mares <mj@ucw.cz>
68245cfd
MM
6 *
7 * Can be freely distributed and used under the terms of the GNU GPL.
8 */
9
10#include <sys/sysi86.h>
11#include <sys/psw.h>
12
68245cfd 13static int
d305d704 14intel_setup_io(struct pci_access *a UNUSED)
68245cfd 15{
9007a292 16 return (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0) ? 0 : 1;
68245cfd
MM
17}
18
9007a292 19static inline int
d305d704 20intel_cleanup_io(struct pci_access *a UNUSED)
68245cfd 21{
9007a292
MM
22 /* FIXME: How to switch off I/O port access? */
23 return 1;
68245cfd
MM
24}
25
26static inline u8
27inb (u16 port)
28{
29 u8 v;
30 __asm__ __volatile__ ("inb (%w1)":"=a" (v):"Nd" (port));
31 return v;
32}
33
34static inline u16
35inw (u16 port)
36{
37 u16 v;
38 __asm__ __volatile__ ("inw (%w1)":"=a" (v):"Nd" (port));
39 return v;
40}
41
42static inline u32
43inl (u16 port)
44{
45 u32 v;
46 __asm__ __volatile__ ("inl (%w1)":"=a" (v):"Nd" (port));
47 return v;
48}
49
50static inline void
51outb (u8 value, u16 port)
52{
53 __asm__ __volatile__ ("outb (%w1)": :"a" (value), "Nd" (port));
54}
55
56static inline void
57outw (u16 value, u16 port)
58{
59 __asm__ __volatile__ ("outw (%w1)": :"a" (value), "Nd" (port));
60}
61
62static inline void
63outl (u32 value, u16 port)
64{
65 __asm__ __volatile__ ("outl (%w1)": :"a" (value), "Nd" (port));
66}
5c5ce192
RM
67
68static inline void intel_io_lock(void)
69{
70}
71
72static inline void intel_io_unlock(void)
73{
74}