Annotation of embedaddon/pciutils/lib/i386-io-sunos.h, revision 1.1.1.1

1.1       misho       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 int
                     20: intel_cleanup_io(struct pci_access *a UNUSED)
                     21: {
                     22:   /* FIXME: How to switch off I/O port access? */
                     23:   return 1;
                     24: }
                     25: 
                     26: static inline u8
                     27: inb (u16 port)
                     28: {
                     29:   u8 v;
                     30:   __asm__ __volatile__ ("inb (%w1)":"=a" (v):"Nd" (port));
                     31:   return v;
                     32: }
                     33: 
                     34: static inline u16
                     35: inw (u16 port)
                     36: {
                     37:   u16 v;
                     38:   __asm__ __volatile__ ("inw (%w1)":"=a" (v):"Nd" (port));
                     39:   return v;
                     40: }
                     41: 
                     42: static inline u32
                     43: inl (u16 port)
                     44: {
                     45:   u32 v;
                     46:   __asm__ __volatile__ ("inl (%w1)":"=a" (v):"Nd" (port));
                     47:   return v;
                     48: }
                     49: 
                     50: static inline void
                     51: outb (u8 value, u16 port)
                     52: {
                     53:   __asm__ __volatile__ ("outb (%w1)": :"a" (value), "Nd" (port));
                     54: }
                     55: 
                     56: static inline void
                     57: outw (u16 value, u16 port)
                     58: {
                     59:   __asm__ __volatile__ ("outw (%w1)": :"a" (value), "Nd" (port));
                     60: }
                     61: 
                     62: static inline void
                     63: outl (u32 value, u16 port)
                     64: {
                     65:   __asm__ __volatile__ ("outl (%w1)": :"a" (value), "Nd" (port));
                     66: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>