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