2014-01-01 11:03:15 +00:00
|
|
|
/* Copyright (C) 1996-2014 Free Software Foundation, Inc.
|
1996-11-15 04:08:00 +00:00
|
|
|
This file is part of the GNU C Library.
|
|
|
|
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
2001-07-06 04:56:23 +00:00
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
1996-11-15 04:08:00 +00:00
|
|
|
|
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2001-07-06 04:56:23 +00:00
|
|
|
Lesser General Public License for more details.
|
1996-11-15 04:08:00 +00:00
|
|
|
|
2001-07-06 04:56:23 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
2012-03-09 23:56:38 +00:00
|
|
|
License along with the GNU C Library. If not, see
|
|
|
|
<http://www.gnu.org/licenses/>. */
|
1996-09-05 02:48:53 +00:00
|
|
|
|
|
|
|
#ifndef _SYS_IO_H
|
|
|
|
|
|
|
|
#define _SYS_IO_H 1
|
|
|
|
#include <features.h>
|
|
|
|
|
|
|
|
__BEGIN_DECLS
|
|
|
|
|
|
|
|
/* If TURN_ON is TRUE, request for permission to do direct i/o on the
|
|
|
|
port numbers in the range [FROM,FROM+NUM-1]. Otherwise, turn I/O
|
|
|
|
permission off for that range. This call requires root privileges.
|
|
|
|
|
|
|
|
Portability note: not all Linux platforms support this call. Most
|
|
|
|
platforms based on the PC I/O architecture probably will, however.
|
|
|
|
E.g., Linux/Alpha for Alpha PCs supports this. */
|
1999-12-29 17:50:32 +00:00
|
|
|
extern int ioperm (unsigned long int __from, unsigned long int __num,
|
|
|
|
int __turn_on) __THROW;
|
1996-09-05 02:48:53 +00:00
|
|
|
|
|
|
|
/* Set the I/O privilege level to LEVEL. If LEVEL>3, permission to
|
|
|
|
access any I/O port is granted. This call requires root
|
|
|
|
privileges. */
|
1999-12-29 17:50:32 +00:00
|
|
|
extern int iopl (int __level) __THROW;
|
1996-09-05 02:48:53 +00:00
|
|
|
|
|
|
|
/* Return the physical address of the DENSE I/O memory or NULL if none
|
|
|
|
is available (e.g. on a jensen). */
|
1999-12-29 17:50:32 +00:00
|
|
|
extern unsigned long int _bus_base (void) __THROW __attribute__ ((const));
|
|
|
|
extern unsigned long int bus_base (void) __THROW __attribute__ ((const));
|
1996-09-05 02:48:53 +00:00
|
|
|
|
|
|
|
/* Return the physical address of the SPARSE I/O memory. */
|
1999-12-29 17:50:32 +00:00
|
|
|
extern unsigned long _bus_base_sparse (void) __THROW __attribute__ ((const));
|
|
|
|
extern unsigned long bus_base_sparse (void) __THROW __attribute__ ((const));
|
1996-09-05 02:48:53 +00:00
|
|
|
|
|
|
|
/* Return the HAE shift used by the SPARSE I/O memory. */
|
1999-12-29 17:50:32 +00:00
|
|
|
extern int _hae_shift (void) __THROW __attribute__ ((const));
|
|
|
|
extern int hae_shift (void) __THROW __attribute__ ((const));
|
1996-09-05 02:48:53 +00:00
|
|
|
|
* sysdeps/unix/sysv/linux/alpha/Makefile (sysdep_routines):
Kill sethae.
* sysdeps/unix/sysv/linux/alpha/Versions: Add pciconfig_iobase.
* sysdeps/unix/sysv/linux/alpha/ioperm.c (all address constants):
Use physical addresses not KSEG addresses.
(io_system): Add PYXIS.
(io): Remove hae.reg, sys, hae_shift.
(stb_mb, stw_mb, stl_mb, __sethae): New.
(inline_outb, inline_outw, inline_outl): Don't set hae.
(inline_inb, inline_inw, inline_inl): Likewise.
(dense_sethae): New null function.
(struct cpuinfo_data): New.
(process_cpuinfo): Use local and stack variables, not static.
Move readlink check here from init_iosys.
(init_iosys): Use __pciconfig_iobase first. Know SX and LX as PYXIS.
(_iopl): Simplify.
(_hae_shift): Calculate it here.
* sysdeps/unix/sysv/linux/alpha/syscalls.list: Remove sethae,
add pciconfig_iobase.
2000-03-20 20:23:05 +00:00
|
|
|
/* Previous three are deprecated in favour of the following, which
|
|
|
|
knows about multiple PCI "hoses". Provide the PCI bus and dfn
|
|
|
|
numbers just as to pciconfig_read/write. */
|
|
|
|
|
|
|
|
enum __pciconfig_iobase_which
|
|
|
|
{
|
|
|
|
IOBASE_HOSE = 0, /* Return hose index. */
|
|
|
|
IOBASE_SPARSE_MEM = 1, /* Return physical memory addresses. */
|
|
|
|
IOBASE_DENSE_MEM = 2,
|
|
|
|
IOBASE_SPARSE_IO = 3,
|
|
|
|
IOBASE_DENSE_IO = 4
|
|
|
|
};
|
|
|
|
|
|
|
|
extern long pciconfig_iobase(enum __pciconfig_iobase_which __which,
|
|
|
|
unsigned long int __bus,
|
|
|
|
unsigned long int __dfn)
|
|
|
|
__THROW __attribute__ ((const));
|
|
|
|
|
1996-11-28 04:16:09 +00:00
|
|
|
/* Access PCI space protected from machine checks. */
|
1999-12-29 17:50:32 +00:00
|
|
|
extern int pciconfig_read (unsigned long int __bus,
|
|
|
|
unsigned long int __dfn,
|
|
|
|
unsigned long int __off,
|
|
|
|
unsigned long int __len,
|
|
|
|
unsigned char *__buf) __THROW;
|
|
|
|
|
|
|
|
extern int pciconfig_write (unsigned long int __bus,
|
|
|
|
unsigned long int __dfn,
|
|
|
|
unsigned long int __off,
|
|
|
|
unsigned long int __len,
|
|
|
|
unsigned char *__buf) __THROW;
|
1996-11-28 04:16:09 +00:00
|
|
|
|
2000-01-23 08:53:21 +00:00
|
|
|
/* Userspace declarations. */
|
|
|
|
extern unsigned int inb (unsigned long __port) __THROW;
|
|
|
|
extern unsigned int inw (unsigned long __port) __THROW;
|
|
|
|
extern unsigned int inl (unsigned long __port) __THROW;
|
|
|
|
extern void outb (unsigned char __b, unsigned long __port) __THROW;
|
|
|
|
extern void outw (unsigned short __w, unsigned long __port) __THROW;
|
|
|
|
extern void outl (unsigned int __l, unsigned long __port) __THROW;
|
|
|
|
|
1996-09-05 02:48:53 +00:00
|
|
|
__END_DECLS
|
|
|
|
|
|
|
|
#endif /* _SYS_IO_H */
|