]> mj.ucw.cz Git - pciutils.git/blob - lib/i386-io-sunos.h
CXL3.0: Add DVSEC CXLCtrl3 and missing CXLCtl2
[pciutils.git] / lib / 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.
8  */
9
10 #include <sys/sysi86.h>
11 #include <sys/psw.h>
12
13 static int
14 intel_setup_io(struct pci_access *a UNUSED)
15 {
16   return (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0) ? 0 : 1;
17 }
18
19 static inline void
20 intel_cleanup_io(struct pci_access *a UNUSED)
21 {
22   /* FIXME: How to switch off I/O port access? */
23 }
24
25 static inline u8
26 inb (u16 port)
27 {
28   u8 v;
29   __asm__ __volatile__ ("inb (%w1)":"=a" (v):"Nd" (port));
30   return v;
31 }
32
33 static inline u16
34 inw (u16 port)
35 {
36   u16 v;
37   __asm__ __volatile__ ("inw (%w1)":"=a" (v):"Nd" (port));
38   return v;
39 }
40
41 static inline u32
42 inl (u16 port)
43 {
44   u32 v;
45   __asm__ __volatile__ ("inl (%w1)":"=a" (v):"Nd" (port));
46   return v;
47 }
48
49 static inline void
50 outb (u8 value, u16 port)
51 {
52   __asm__ __volatile__ ("outb (%w1)": :"a" (value), "Nd" (port));
53 }
54
55 static inline void
56 outw (u16 value, u16 port)
57 {
58   __asm__ __volatile__ ("outw (%w1)": :"a" (value), "Nd" (port));
59 }
60
61 static inline void
62 outl (u32 value, u16 port)
63 {
64   __asm__ __volatile__ ("outl (%w1)": :"a" (value), "Nd" (port));
65 }
66
67 static inline void intel_io_lock(void)
68 {
69 }
70
71 static inline void intel_io_unlock(void)
72 {
73 }