2021-01-02 19:32:25 +00:00
|
|
|
/* Copyright (C) 1992-2021 Free Software Foundation, Inc.
|
1997-01-23 04:24:10 +00:00
|
|
|
This file is part of the GNU C Library.
|
1996-03-19 19:51:34 +00:00
|
|
|
|
1997-01-23 04:24:10 +00:00
|
|
|
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-03-19 19:51:34 +00:00
|
|
|
|
1997-01-23 04:24:10 +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-03-19 19:51:34 +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
|
Prefer https to http for gnu.org and fsf.org URLs
Also, change sources.redhat.com to sourceware.org.
This patch was automatically generated by running the following shell
script, which uses GNU sed, and which avoids modifying files imported
from upstream:
sed -ri '
s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g
s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g
' \
$(find $(git ls-files) -prune -type f \
! -name '*.po' \
! -name 'ChangeLog*' \
! -path COPYING ! -path COPYING.LIB \
! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \
! -path manual/texinfo.tex ! -path scripts/config.guess \
! -path scripts/config.sub ! -path scripts/install-sh \
! -path scripts/mkinstalldirs ! -path scripts/move-if-change \
! -path INSTALL ! -path locale/programs/charmap-kw.h \
! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \
! '(' -name configure \
-execdir test -f configure.ac -o -f configure.in ';' ')' \
! '(' -name preconfigure \
-execdir test -f preconfigure.ac ';' ')' \
-print)
and then by running 'make dist-prepare' to regenerate files built
from the altered files, and then executing the following to cleanup:
chmod a+x sysdeps/unix/sysv/linux/riscv/configure
# Omit irrelevant whitespace and comment-only changes,
# perhaps from a slightly-different Autoconf version.
git checkout -f \
sysdeps/csky/configure \
sysdeps/hppa/configure \
sysdeps/riscv/configure \
sysdeps/unix/sysv/linux/csky/configure
# Omit changes that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines
git checkout -f \
sysdeps/powerpc/powerpc64/ppc-mcount.S \
sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
# Omit change that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline
git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
2019-09-07 05:40:42 +00:00
|
|
|
<https://www.gnu.org/licenses/>. */
|
1996-03-19 19:51:34 +00:00
|
|
|
|
|
|
|
/* I/O access is restricted to ISA port space (ports 0..65535).
|
1997-01-23 04:24:10 +00:00
|
|
|
Modern devices hopefully are sane enough not to put any performance
|
|
|
|
critical registers in i/o space.
|
1996-03-19 19:51:34 +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
|
|
|
On the first call to ioperm, the entire (E)ISA port space is mapped
|
|
|
|
into the virtual address space at address io.base. mprotect calls
|
|
|
|
are then used to enable/disable access to ports. Per page, there
|
|
|
|
are PAGE_SIZE>>IO_SHIFT I/O ports (e.g., 256 ports on a Low Cost Alpha
|
|
|
|
based system using 8KB pages).
|
1996-03-19 19:51:34 +00:00
|
|
|
|
1997-01-23 04:24:10 +00:00
|
|
|
Keep in mind that this code should be able to run in a 32bit address
|
|
|
|
space. It is therefore unreasonable to expect mmap'ing the entire
|
|
|
|
sparse address space would work (e.g., the Low Cost Alpha chip has an
|
|
|
|
I/O address space that's 512MB large!). */
|
1996-03-19 19:51:34 +00:00
|
|
|
|
2007-05-07 22:57:20 +00:00
|
|
|
/* Make sure the ldbu/stb asms below are not expaneded to macros. */
|
|
|
|
#ifndef __alpha_bwx__
|
|
|
|
asm(".arch ev56");
|
|
|
|
#endif
|
|
|
|
|
1996-03-19 19:51:34 +00:00
|
|
|
#include <errno.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <stdio.h>
|
1997-03-20 19:35:32 +00:00
|
|
|
#include <ctype.h>
|
1996-05-23 05:32:27 +00:00
|
|
|
#include <stdlib.h>
|
1996-03-19 19:51:34 +00:00
|
|
|
#include <string.h>
|
1996-05-23 05:32:27 +00:00
|
|
|
#include <unistd.h>
|
1996-03-19 19:51:34 +00:00
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/mman.h>
|
* 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
|
|
|
#include <sys/io.h>
|
1996-03-19 19:51:34 +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
|
|
|
#include <sysdep.h>
|
|
|
|
#include <sys/syscall.h>
|
1996-03-19 19:51:34 +00:00
|
|
|
|
1996-05-23 05:32:27 +00:00
|
|
|
#define PATH_ALPHA_SYSTYPE "/etc/alpha_systype"
|
|
|
|
#define PATH_CPUINFO "/proc/cpuinfo"
|
1996-03-19 19:51:34 +00:00
|
|
|
|
|
|
|
#define MAX_PORT 0x10000
|
* 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
|
|
|
#define vip volatile int *
|
1996-03-19 19:51:34 +00:00
|
|
|
#define vuip volatile unsigned int *
|
* 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
|
|
|
#define vusp volatile unsigned short *
|
|
|
|
#define vucp volatile unsigned char *
|
1996-03-19 19:51:34 +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
|
|
|
#define JENSEN_IO_BASE (0x300000000UL)
|
|
|
|
#define JENSEN_SPARSE_MEM (0x200000000UL)
|
1996-05-23 05:32:27 +00:00
|
|
|
|
1997-05-31 00:46:01 +00:00
|
|
|
/* With respect to the I/O architecture, APECS and LCA are identical,
|
|
|
|
so the following defines apply to LCA as well. */
|
* 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
|
|
|
#define APECS_IO_BASE (0x1c0000000UL)
|
|
|
|
#define APECS_SPARSE_MEM (0x200000000UL)
|
|
|
|
#define APECS_DENSE_MEM (0x300000000UL)
|
1996-05-23 05:32:27 +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
|
|
|
/* The same holds for CIA and PYXIS, except for PYXIS we prefer BWX. */
|
|
|
|
#define CIA_IO_BASE (0x8580000000UL)
|
|
|
|
#define CIA_SPARSE_MEM (0x8000000000UL)
|
|
|
|
#define CIA_DENSE_MEM (0x8600000000UL)
|
1996-05-23 05:32:27 +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
|
|
|
#define PYXIS_IO_BASE (0x8900000000UL)
|
|
|
|
#define PYXIS_DENSE_MEM (0x8800000000UL)
|
1996-03-19 19:51:34 +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
|
|
|
/* SABLE is EV4, GAMMA is EV5 */
|
|
|
|
#define T2_IO_BASE (0x3a0000000UL)
|
|
|
|
#define T2_SPARSE_MEM (0x200000000UL)
|
|
|
|
#define T2_DENSE_MEM (0x3c0000000UL)
|
1998-10-08 13:09:39 +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
|
|
|
#define GAMMA_IO_BASE (0x83a0000000UL)
|
|
|
|
#define GAMMA_SPARSE_MEM (0x8200000000UL)
|
|
|
|
#define GAMMA_DENSE_MEM (0x83c0000000UL)
|
1998-10-08 13:09:39 +00:00
|
|
|
|
|
|
|
/* NOTE: these are hardwired to PCI bus 0 addresses!!! */
|
* 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
|
|
|
#define MCPCIA_IO_BASE (0xf980000000UL)
|
|
|
|
#define MCPCIA_SPARSE_MEM (0xf800000000UL)
|
|
|
|
#define MCPCIA_DENSE_MEM (0xf900000000UL)
|
|
|
|
|
|
|
|
/* Tsunami and Irongate use the same offsets, at least for hose 0. */
|
|
|
|
#define TSUNAMI_IO_BASE (0x801fc000000UL)
|
|
|
|
#define TSUNAMI_DENSE_MEM (0x80000000000UL)
|
1998-10-08 13:09:39 +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
|
|
|
/* Polaris has SPARSE space, but we prefer to use only DENSE
|
|
|
|
because of some idiosyncracies in actually using SPARSE. */
|
|
|
|
#define POLARIS_IO_BASE (0xf9fc000000UL)
|
|
|
|
#define POLARIS_DENSE_MEM (0xf900000000UL)
|
1999-07-06 16:06:12 +00:00
|
|
|
|
1997-01-23 04:24:10 +00:00
|
|
|
typedef enum {
|
* 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
|
|
|
IOSYS_UNKNOWN, IOSYS_JENSEN, IOSYS_APECS, IOSYS_CIA, IOSYS_PYXIS, IOSYS_T2,
|
1999-07-06 16:06:12 +00:00
|
|
|
IOSYS_TSUNAMI, IOSYS_MCPCIA, IOSYS_GAMMA, IOSYS_POLARIS,
|
|
|
|
IOSYS_CPUDEP, IOSYS_PCIDEP
|
1996-03-19 19:51:34 +00:00
|
|
|
} iosys_t;
|
|
|
|
|
1999-07-06 16:06:12 +00:00
|
|
|
typedef enum {
|
|
|
|
IOSWIZZLE_JENSEN, IOSWIZZLE_SPARSE, IOSWIZZLE_DENSE
|
|
|
|
} ioswizzle_t;
|
|
|
|
|
1998-10-08 13:09:39 +00:00
|
|
|
static struct io_system {
|
|
|
|
unsigned long int bus_memory_base;
|
|
|
|
unsigned long int sparse_bus_mem_base;
|
|
|
|
unsigned long int bus_io_base;
|
|
|
|
} io_system[] = { /* NOTE! must match iosys_t enumeration */
|
* 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
|
|
|
/* UNKNOWN */ {0, 0, 0},
|
|
|
|
/* JENSEN */ {0, JENSEN_SPARSE_MEM, JENSEN_IO_BASE},
|
|
|
|
/* APECS */ {APECS_DENSE_MEM, APECS_SPARSE_MEM, APECS_IO_BASE},
|
|
|
|
/* CIA */ {CIA_DENSE_MEM, CIA_SPARSE_MEM, CIA_IO_BASE},
|
|
|
|
/* PYXIS */ {PYXIS_DENSE_MEM, 0, PYXIS_IO_BASE},
|
|
|
|
/* T2 */ {T2_DENSE_MEM, T2_SPARSE_MEM, T2_IO_BASE},
|
|
|
|
/* TSUNAMI */ {TSUNAMI_DENSE_MEM, 0, TSUNAMI_IO_BASE},
|
|
|
|
/* MCPCIA */ {MCPCIA_DENSE_MEM, MCPCIA_SPARSE_MEM, MCPCIA_IO_BASE},
|
|
|
|
/* GAMMA */ {GAMMA_DENSE_MEM, GAMMA_SPARSE_MEM, GAMMA_IO_BASE},
|
|
|
|
/* POLARIS */ {POLARIS_DENSE_MEM, 0, POLARIS_IO_BASE},
|
|
|
|
/* CPUDEP */ {0, 0, 0}, /* for platforms dependent on CPU type */
|
|
|
|
/* PCIDEP */ {0, 0, 0}, /* for platforms dependent on core logic */
|
1998-10-08 13:09:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform {
|
|
|
|
const char *name;
|
|
|
|
iosys_t io_sys;
|
|
|
|
} platform[] = {
|
|
|
|
{"Alcor", IOSYS_CIA},
|
|
|
|
{"Avanti", IOSYS_APECS},
|
|
|
|
{"Cabriolet", IOSYS_APECS},
|
1999-07-06 16:06:12 +00:00
|
|
|
{"EB164", IOSYS_PCIDEP},
|
1998-10-08 13:09:39 +00:00
|
|
|
{"EB64+", IOSYS_APECS},
|
|
|
|
{"EB66", IOSYS_APECS},
|
|
|
|
{"EB66P", IOSYS_APECS},
|
|
|
|
{"Jensen", IOSYS_JENSEN},
|
* 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
|
|
|
{"Miata", IOSYS_PYXIS},
|
1998-10-08 13:09:39 +00:00
|
|
|
{"Mikasa", IOSYS_CPUDEP},
|
2000-03-15 07:22:08 +00:00
|
|
|
{"Nautilus", IOSYS_TSUNAMI},
|
* 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
|
|
|
{"Noname", IOSYS_APECS},
|
|
|
|
{"Noritake", IOSYS_CPUDEP},
|
1998-10-08 13:09:39 +00:00
|
|
|
{"Rawhide", IOSYS_MCPCIA},
|
* 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
|
|
|
{"Ruffian", IOSYS_PYXIS},
|
|
|
|
{"Sable", IOSYS_CPUDEP},
|
1998-10-08 13:09:39 +00:00
|
|
|
{"Takara", IOSYS_CIA},
|
* 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
|
|
|
{"Tsunami", IOSYS_TSUNAMI},
|
|
|
|
{"XL", IOSYS_APECS},
|
1998-10-08 13:09:39 +00:00
|
|
|
};
|
|
|
|
|
1996-03-19 19:51:34 +00:00
|
|
|
struct ioswtch {
|
1997-01-23 04:24:10 +00:00
|
|
|
void (*sethae)(unsigned long int addr);
|
|
|
|
void (*outb)(unsigned char b, unsigned long int port);
|
|
|
|
void (*outw)(unsigned short b, unsigned long int port);
|
|
|
|
void (*outl)(unsigned int b, unsigned long int port);
|
|
|
|
unsigned int (*inb)(unsigned long int port);
|
|
|
|
unsigned int (*inw)(unsigned long int port);
|
|
|
|
unsigned int (*inl)(unsigned long int port);
|
1996-03-19 19:51:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct {
|
* 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
|
|
|
unsigned long int hae_cache;
|
1997-01-23 04:24:10 +00:00
|
|
|
unsigned long int base;
|
1996-03-19 19:51:34 +00:00
|
|
|
struct ioswtch * swp;
|
1997-01-23 04:24:10 +00:00
|
|
|
unsigned long int bus_memory_base;
|
|
|
|
unsigned long int sparse_bus_memory_base;
|
|
|
|
unsigned long int io_base;
|
1999-07-06 16:06:12 +00:00
|
|
|
ioswizzle_t swiz;
|
1996-03-19 19:51:34 +00:00
|
|
|
} io;
|
|
|
|
|
* 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
|
|
|
static inline void
|
|
|
|
stb_mb(unsigned char val, unsigned long addr)
|
|
|
|
{
|
|
|
|
__asm__("stb %1,%0; mb" : "=m"(*(vucp)addr) : "r"(val));
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
stw_mb(unsigned short val, unsigned long addr)
|
|
|
|
{
|
|
|
|
__asm__("stw %1,%0; mb" : "=m"(*(vusp)addr) : "r"(val));
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
stl_mb(unsigned int val, unsigned long addr)
|
|
|
|
{
|
|
|
|
__asm__("stl %1,%0; mb" : "=m"(*(vip)addr) : "r"(val));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* No need to examine error -- sethae never fails. */
|
|
|
|
static inline void
|
|
|
|
__sethae(unsigned long value)
|
|
|
|
{
|
2020-01-31 19:41:25 +00:00
|
|
|
INLINE_SYSCALL_CALL (sethae, value);
|
* 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
|
|
|
}
|
|
|
|
|
|
|
|
extern long __pciconfig_iobase(enum __pciconfig_iobase_which __which,
|
|
|
|
unsigned long int __bus,
|
|
|
|
unsigned long int __dfn);
|
1996-05-23 05:32:27 +00:00
|
|
|
|
1997-01-23 04:24:10 +00:00
|
|
|
static inline unsigned long int
|
1999-07-06 16:06:12 +00:00
|
|
|
port_to_cpu_addr (unsigned long int port, ioswizzle_t ioswiz, int size)
|
1996-03-19 19:51:34 +00:00
|
|
|
{
|
1999-07-06 16:06:12 +00:00
|
|
|
if (ioswiz == IOSWIZZLE_SPARSE)
|
* 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
|
|
|
return io.base + (port << 5) + ((size - 1) << 3);
|
1999-07-06 16:06:12 +00:00
|
|
|
else if (ioswiz == IOSWIZZLE_DENSE)
|
1998-10-08 13:09:39 +00:00
|
|
|
return port + io.base;
|
1996-05-23 05:32:27 +00:00
|
|
|
else
|
* 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
|
|
|
return io.base + (port << 7) + ((size - 1) << 5);
|
1996-03-19 19:51:34 +00:00
|
|
|
}
|
|
|
|
|
2012-03-04 20:03:59 +00:00
|
|
|
static inline __attribute__((always_inline)) void
|
1999-07-06 16:06:12 +00:00
|
|
|
inline_sethae (unsigned long int addr, ioswizzle_t ioswiz)
|
1996-03-19 19:51:34 +00:00
|
|
|
{
|
1999-07-06 16:06:12 +00:00
|
|
|
if (ioswiz == IOSWIZZLE_SPARSE)
|
1996-05-23 05:32:27 +00:00
|
|
|
{
|
1997-01-23 04:24:10 +00:00
|
|
|
unsigned long int msb;
|
1996-05-23 05:32:27 +00:00
|
|
|
|
|
|
|
/* no need to set hae if msb is 0: */
|
|
|
|
msb = addr & 0xf8000000;
|
* 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
|
|
|
if (msb && msb != io.hae_cache)
|
1996-05-23 05:32:27 +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
|
|
|
io.hae_cache = msb;
|
1996-05-23 05:32:27 +00:00
|
|
|
__sethae (msb);
|
|
|
|
}
|
1996-03-19 19:51:34 +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
|
|
|
else if (ioswiz == IOSWIZZLE_JENSEN)
|
1999-07-06 16:06:12 +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
|
|
|
/* HAE on the Jensen is bits 31:25 shifted right. */
|
1999-07-06 16:06:12 +00:00
|
|
|
addr >>= 25;
|
* 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
|
|
|
if (addr != io.hae_cache)
|
1999-07-06 16:06:12 +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
|
|
|
io.hae_cache = addr;
|
1999-07-06 16:06:12 +00:00
|
|
|
__sethae (addr);
|
|
|
|
}
|
|
|
|
}
|
1996-03-19 19:51:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
1999-07-06 16:06:12 +00:00
|
|
|
inline_outb (unsigned char b, unsigned long int port, ioswizzle_t ioswiz)
|
1996-03-19 19:51:34 +00:00
|
|
|
{
|
|
|
|
unsigned int w;
|
1999-07-06 16:06:12 +00:00
|
|
|
unsigned long int addr = port_to_cpu_addr (port, ioswiz, 1);
|
1996-03-19 19:51:34 +00:00
|
|
|
|
1998-10-13 16:25:31 +00:00
|
|
|
asm ("insbl %2,%1,%0" : "=r" (w) : "ri" (port & 0x3), "r" (b));
|
* 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
|
|
|
stl_mb(w, addr);
|
1996-03-19 19:51:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static inline void
|
1999-07-06 16:06:12 +00:00
|
|
|
inline_outw (unsigned short int b, unsigned long int port, ioswizzle_t ioswiz)
|
1996-03-19 19:51:34 +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
|
|
|
unsigned long w;
|
1999-07-06 16:06:12 +00:00
|
|
|
unsigned long int addr = port_to_cpu_addr (port, ioswiz, 2);
|
1996-03-19 19:51:34 +00:00
|
|
|
|
1998-10-13 16:25:31 +00:00
|
|
|
asm ("inswl %2,%1,%0" : "=r" (w) : "ri" (port & 0x3), "r" (b));
|
* 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
|
|
|
stl_mb(w, addr);
|
1996-03-19 19:51:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static inline void
|
1999-07-06 16:06:12 +00:00
|
|
|
inline_outl (unsigned int b, unsigned long int port, ioswizzle_t ioswiz)
|
1996-03-19 19:51:34 +00:00
|
|
|
{
|
1999-07-06 16:06:12 +00:00
|
|
|
unsigned long int addr = port_to_cpu_addr (port, ioswiz, 4);
|
1996-03-19 19:51:34 +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
|
|
|
stl_mb(b, addr);
|
1996-03-19 19:51:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static inline unsigned int
|
1999-07-06 16:06:12 +00:00
|
|
|
inline_inb (unsigned long int port, ioswizzle_t ioswiz)
|
1996-03-19 19:51:34 +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
|
|
|
unsigned long int addr = port_to_cpu_addr (port, ioswiz, 1);
|
|
|
|
int result;
|
1996-03-19 19:51:34 +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
|
|
|
result = *(vip) addr;
|
1996-03-19 19:51:34 +00:00
|
|
|
result >>= (port & 3) * 8;
|
|
|
|
return 0xffUL & result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static inline unsigned int
|
1999-07-06 16:06:12 +00:00
|
|
|
inline_inw (unsigned long int port, ioswizzle_t ioswiz)
|
1996-03-19 19:51:34 +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
|
|
|
unsigned long int addr = port_to_cpu_addr (port, ioswiz, 2);
|
|
|
|
int result;
|
1996-03-19 19:51:34 +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
|
|
|
result = *(vip) addr;
|
1996-03-19 19:51:34 +00:00
|
|
|
result >>= (port & 3) * 8;
|
|
|
|
return 0xffffUL & result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static inline unsigned int
|
1999-07-06 16:06:12 +00:00
|
|
|
inline_inl (unsigned long int port, ioswizzle_t ioswiz)
|
1996-03-19 19:51:34 +00:00
|
|
|
{
|
1999-07-06 16:06:12 +00:00
|
|
|
unsigned long int addr = port_to_cpu_addr (port, ioswiz, 4);
|
1996-03-19 19:51:34 +00:00
|
|
|
|
|
|
|
return *(vuip) addr;
|
|
|
|
}
|
|
|
|
|
1998-10-08 13:09:39 +00:00
|
|
|
/*
|
|
|
|
* Now define the inline functions for CPUs supporting byte/word insns,
|
|
|
|
* and whose core logic supports I/O space accesses utilizing them.
|
|
|
|
*
|
|
|
|
* These routines could be used by MIATA, for example, because it has
|
1999-07-06 16:06:12 +00:00
|
|
|
* and EV56 plus PYXIS, but it currently uses SPARSE anyway. This is
|
|
|
|
* also true of RX164 which used POLARIS, but we will choose to use
|
|
|
|
* these routines in that case instead of SPARSE.
|
1998-10-08 13:09:39 +00:00
|
|
|
*
|
|
|
|
* These routines are necessary for TSUNAMI/TYPHOON based platforms,
|
|
|
|
* which will have (at least) EV6.
|
|
|
|
*/
|
|
|
|
|
1999-07-06 16:06:12 +00:00
|
|
|
static inline unsigned long int
|
|
|
|
dense_port_to_cpu_addr (unsigned long int port)
|
|
|
|
{
|
|
|
|
return port + io.base;
|
|
|
|
}
|
|
|
|
|
1998-10-08 13:09:39 +00:00
|
|
|
static inline void
|
1999-07-06 16:06:12 +00:00
|
|
|
inline_bwx_outb (unsigned char b, unsigned long int port)
|
1998-10-08 13:09:39 +00:00
|
|
|
{
|
1999-07-06 16:06:12 +00:00
|
|
|
unsigned long int addr = dense_port_to_cpu_addr (port);
|
* 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
|
|
|
stb_mb (b, addr);
|
1998-10-08 13:09:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
1999-07-06 16:06:12 +00:00
|
|
|
inline_bwx_outw (unsigned short int b, unsigned long int port)
|
1998-10-08 13:09:39 +00:00
|
|
|
{
|
1999-07-06 16:06:12 +00:00
|
|
|
unsigned long int addr = dense_port_to_cpu_addr (port);
|
* 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
|
|
|
stw_mb (b, addr);
|
1998-10-08 13:09:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
1999-07-06 16:06:12 +00:00
|
|
|
inline_bwx_outl (unsigned int b, unsigned long int port)
|
1998-10-08 13:09:39 +00:00
|
|
|
{
|
1999-07-06 16:06:12 +00:00
|
|
|
unsigned long int addr = dense_port_to_cpu_addr (port);
|
* 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
|
|
|
stl_mb (b, addr);
|
1998-10-08 13:09:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline unsigned int
|
1999-07-06 16:06:12 +00:00
|
|
|
inline_bwx_inb (unsigned long int port)
|
1998-10-08 13:09:39 +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
|
|
|
unsigned long int addr = dense_port_to_cpu_addr (port);
|
|
|
|
unsigned char r;
|
1998-10-08 13:09:39 +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
|
|
|
__asm__ ("ldbu %0,%1" : "=r"(r) : "m"(*(vucp)addr));
|
|
|
|
return r;
|
1998-10-08 13:09:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline unsigned int
|
1999-07-06 16:06:12 +00:00
|
|
|
inline_bwx_inw (unsigned long int port)
|
1998-10-08 13:09:39 +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
|
|
|
unsigned long int addr = dense_port_to_cpu_addr (port);
|
|
|
|
unsigned short r;
|
1998-10-08 13:09:39 +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
|
|
|
__asm__ ("ldwu %0,%1" : "=r"(r) : "m"(*(vusp)addr));
|
|
|
|
return r;
|
1998-10-08 13:09:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline unsigned int
|
1999-07-06 16:06:12 +00:00
|
|
|
inline_bwx_inl (unsigned long int port)
|
1998-10-08 13:09:39 +00:00
|
|
|
{
|
1999-07-06 16:06:12 +00:00
|
|
|
unsigned long int addr = dense_port_to_cpu_addr (port);
|
1998-10-08 13:09:39 +00:00
|
|
|
|
|
|
|
return *(vuip) addr;
|
|
|
|
}
|
|
|
|
|
1999-07-06 16:06:12 +00:00
|
|
|
/* macros to define routines with appropriate names and functions */
|
1998-10-08 13:09:39 +00:00
|
|
|
|
1999-07-06 16:06:12 +00:00
|
|
|
/* these do either SPARSE or JENSEN swizzle */
|
|
|
|
|
|
|
|
#define DCL_SETHAE(name, ioswiz) \
|
|
|
|
static void \
|
|
|
|
name##_sethae (unsigned long int addr) \
|
|
|
|
{ \
|
|
|
|
inline_sethae (addr, IOSWIZZLE_##ioswiz); \
|
1996-03-19 19:51:34 +00:00
|
|
|
}
|
|
|
|
|
1999-07-06 16:06:12 +00:00
|
|
|
#define DCL_OUT(name, func, type, ioswiz) \
|
1996-03-19 19:51:34 +00:00
|
|
|
static void \
|
1997-01-23 04:24:10 +00:00
|
|
|
name##_##func (unsigned type b, unsigned long int addr) \
|
1996-03-19 19:51:34 +00:00
|
|
|
{ \
|
1999-07-06 16:06:12 +00:00
|
|
|
inline_##func (b, addr, IOSWIZZLE_##ioswiz); \
|
1996-03-19 19:51:34 +00:00
|
|
|
}
|
|
|
|
|
1999-07-06 16:06:12 +00:00
|
|
|
#define DCL_IN(name, func, ioswiz) \
|
1996-03-19 19:51:34 +00:00
|
|
|
static unsigned int \
|
1997-01-23 04:24:10 +00:00
|
|
|
name##_##func (unsigned long int addr) \
|
1996-03-19 19:51:34 +00:00
|
|
|
{ \
|
1999-07-06 16:06:12 +00:00
|
|
|
return inline_##func (addr, IOSWIZZLE_##ioswiz); \
|
1996-03-19 19:51:34 +00:00
|
|
|
}
|
|
|
|
|
1999-07-06 16:06:12 +00:00
|
|
|
/* these do DENSE, so no swizzle is needed */
|
1998-10-08 13:09:39 +00:00
|
|
|
|
1999-07-06 16:06:12 +00:00
|
|
|
#define DCL_OUT_BWX(name, func, type) \
|
1998-10-08 13:09:39 +00:00
|
|
|
static void \
|
|
|
|
name##_##func (unsigned type b, unsigned long int addr) \
|
|
|
|
{ \
|
1999-07-06 16:06:12 +00:00
|
|
|
inline_bwx_##func (b, addr); \
|
1998-10-08 13:09:39 +00:00
|
|
|
}
|
|
|
|
|
1999-07-06 16:06:12 +00:00
|
|
|
#define DCL_IN_BWX(name, func) \
|
1998-10-08 13:09:39 +00:00
|
|
|
static unsigned int \
|
|
|
|
name##_##func (unsigned long int addr) \
|
|
|
|
{ \
|
1999-07-06 16:06:12 +00:00
|
|
|
return inline_bwx_##func (addr); \
|
1998-10-08 13:09:39 +00:00
|
|
|
}
|
|
|
|
|
1999-07-06 16:06:12 +00:00
|
|
|
/* now declare/define the necessary routines */
|
1996-03-19 19:51:34 +00:00
|
|
|
|
|
|
|
DCL_SETHAE(jensen, JENSEN)
|
|
|
|
DCL_OUT(jensen, outb, char, JENSEN)
|
1997-01-23 04:24:10 +00:00
|
|
|
DCL_OUT(jensen, outw, short int, JENSEN)
|
1996-03-19 19:51:34 +00:00
|
|
|
DCL_OUT(jensen, outl, int, JENSEN)
|
|
|
|
DCL_IN(jensen, inb, JENSEN)
|
|
|
|
DCL_IN(jensen, inw, JENSEN)
|
|
|
|
DCL_IN(jensen, inl, JENSEN)
|
|
|
|
|
1999-07-06 16:06:12 +00:00
|
|
|
DCL_SETHAE(sparse, SPARSE)
|
|
|
|
DCL_OUT(sparse, outb, char, SPARSE)
|
|
|
|
DCL_OUT(sparse, outw, short int, SPARSE)
|
|
|
|
DCL_OUT(sparse, outl, int, SPARSE)
|
|
|
|
DCL_IN(sparse, inb, SPARSE)
|
|
|
|
DCL_IN(sparse, inw, SPARSE)
|
|
|
|
DCL_IN(sparse, inl, SPARSE)
|
|
|
|
|
* 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
|
|
|
DCL_SETHAE(dense, DENSE)
|
1999-07-06 16:06:12 +00:00
|
|
|
DCL_OUT_BWX(dense, outb, char)
|
|
|
|
DCL_OUT_BWX(dense, outw, short int)
|
|
|
|
DCL_OUT_BWX(dense, outl, int)
|
|
|
|
DCL_IN_BWX(dense, inb)
|
|
|
|
DCL_IN_BWX(dense, inw)
|
|
|
|
DCL_IN_BWX(dense, inl)
|
|
|
|
|
|
|
|
/* define the "swizzle" switch */
|
1998-10-08 13:09:39 +00:00
|
|
|
static struct ioswtch ioswtch[] = {
|
1996-03-19 19:51:34 +00:00
|
|
|
{
|
|
|
|
jensen_sethae,
|
|
|
|
jensen_outb, jensen_outw, jensen_outl,
|
|
|
|
jensen_inb, jensen_inw, jensen_inl
|
|
|
|
},
|
|
|
|
{
|
1999-07-06 16:06:12 +00:00
|
|
|
sparse_sethae,
|
|
|
|
sparse_outb, sparse_outw, sparse_outl,
|
|
|
|
sparse_inb, sparse_inw, sparse_inl
|
1998-10-08 13:09:39 +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
|
|
|
dense_sethae,
|
1999-07-06 16:06:12 +00:00
|
|
|
dense_outb, dense_outw, dense_outl,
|
|
|
|
dense_inb, dense_inw, dense_inl
|
1996-03-19 19:51:34 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
1999-10-01 16:03:15 +00:00
|
|
|
#undef DEBUG_IOPERM
|
|
|
|
|
* 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
|
|
|
/* Routine to process the /proc/cpuinfo information into the fields
|
|
|
|
that are required for correctly determining the platform parameters. */
|
1999-07-06 16:06:12 +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
|
|
|
struct cpuinfo_data
|
|
|
|
{
|
|
|
|
char systype[256]; /* system type field */
|
|
|
|
char sysvari[256]; /* system variation field */
|
|
|
|
char cpumodel[256]; /* cpu model field */
|
|
|
|
};
|
1999-07-06 16:06:12 +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
|
|
|
static inline int
|
|
|
|
process_cpuinfo(struct cpuinfo_data *data)
|
1999-07-06 16:06:12 +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
|
|
|
int got_type, got_vari, got_model;
|
1999-07-06 16:06:12 +00:00
|
|
|
char dummy[256];
|
|
|
|
FILE * fp;
|
* 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
|
|
|
int n;
|
|
|
|
|
|
|
|
data->systype[0] = 0;
|
|
|
|
data->sysvari[0] = 0;
|
|
|
|
data->cpumodel[0] = 0;
|
|
|
|
|
|
|
|
/* If there's an /etc/alpha_systype link, we're intending to override
|
|
|
|
whatever's in /proc/cpuinfo. */
|
|
|
|
n = __readlink (PATH_ALPHA_SYSTYPE, data->systype, 256 - 1);
|
|
|
|
if (n > 0)
|
|
|
|
{
|
|
|
|
data->systype[n] = '\0';
|
|
|
|
return 1;
|
|
|
|
}
|
1996-03-19 19:51:34 +00:00
|
|
|
|
2012-04-27 02:22:59 +00:00
|
|
|
fp = fopen (PATH_CPUINFO, "rce");
|
1999-07-06 16:06:12 +00:00
|
|
|
if (!fp)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
got_type = got_vari = got_model = 0;
|
|
|
|
|
|
|
|
while (1)
|
|
|
|
{
|
2012-05-30 22:54:49 +00:00
|
|
|
if (fgets_unlocked (dummy, 256, fp) == NULL)
|
* 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
|
|
|
break;
|
2019-02-26 15:01:50 +00:00
|
|
|
if (!got_type
|
|
|
|
&& sscanf (dummy, "system type : %256[^\n]\n", data->systype) == 1)
|
1999-07-06 16:06:12 +00:00
|
|
|
got_type = 1;
|
2019-02-26 15:01:50 +00:00
|
|
|
if (!got_vari
|
|
|
|
&& (sscanf (dummy, "system variation : %256[^\n]\n", data->sysvari)
|
|
|
|
== 1))
|
1999-07-06 16:06:12 +00:00
|
|
|
got_vari = 1;
|
2019-02-26 15:01:50 +00:00
|
|
|
if (!got_model
|
|
|
|
&& sscanf (dummy, "cpu model : %256[^\n]\n", data->cpumodel) == 1)
|
1999-07-06 16:06:12 +00:00
|
|
|
got_model = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
fclose (fp);
|
|
|
|
|
1999-10-01 16:03:15 +00:00
|
|
|
#ifdef DEBUG_IOPERM
|
* 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
|
|
|
fprintf(stderr, "system type: `%s'\n", data->systype);
|
|
|
|
fprintf(stderr, "system vari: `%s'\n", data->sysvari);
|
|
|
|
fprintf(stderr, "cpu model: `%s'\n", data->cpumodel);
|
1999-07-06 16:06:12 +00:00
|
|
|
#endif
|
|
|
|
|
* 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
|
|
|
return got_type + got_vari + got_model;
|
1999-07-06 16:06:12 +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
|
|
|
|
|
|
|
|
1996-05-23 05:32:27 +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
|
|
|
* Initialize I/O system.
|
1996-05-23 05:32:27 +00:00
|
|
|
*/
|
1996-03-19 19:51:34 +00:00
|
|
|
static int
|
|
|
|
init_iosys (void)
|
|
|
|
{
|
* 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
|
|
|
long addr;
|
|
|
|
int i, olderrno = errno;
|
|
|
|
struct cpuinfo_data data;
|
1996-03-19 19:51:34 +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
|
|
|
/* First try the pciconfig_iobase syscall added to 2.2.15 and 2.3.99. */
|
|
|
|
|
|
|
|
addr = __pciconfig_iobase (IOBASE_DENSE_MEM, 0, 0);
|
|
|
|
if (addr != -1)
|
1996-05-23 05:32:27 +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
|
|
|
ioswizzle_t io_swiz;
|
|
|
|
|
|
|
|
if (addr == 0)
|
|
|
|
{
|
|
|
|
/* Only Jensen doesn't have dense mem space. */
|
|
|
|
io.sparse_bus_memory_base
|
|
|
|
= io_system[IOSYS_JENSEN].sparse_bus_mem_base;
|
|
|
|
io.io_base = io_system[IOSYS_JENSEN].bus_io_base;
|
|
|
|
io_swiz = IOSWIZZLE_JENSEN;
|
|
|
|
}
|
|
|
|
else
|
1997-01-23 04:24:10 +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
|
|
|
io.bus_memory_base = addr;
|
|
|
|
|
|
|
|
addr = __pciconfig_iobase (IOBASE_DENSE_IO, 0, 0);
|
|
|
|
if (addr != 0)
|
|
|
|
{
|
|
|
|
/* The X server uses _bus_base_sparse == 0 to know that
|
|
|
|
BWX access are supported to dense mem space. This is
|
|
|
|
true of every system that supports dense io space, so
|
|
|
|
never fill in io.sparse_bus_memory_base in this case. */
|
|
|
|
io_swiz = IOSWIZZLE_DENSE;
|
|
|
|
io.io_base = addr;
|
|
|
|
}
|
|
|
|
else
|
1997-01-23 04:24:10 +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
|
|
|
io.sparse_bus_memory_base
|
|
|
|
= __pciconfig_iobase (IOBASE_SPARSE_MEM, 0, 0);
|
|
|
|
io.io_base = __pciconfig_iobase (IOBASE_SPARSE_IO, 0, 0);
|
|
|
|
io_swiz = IOSWIZZLE_SPARSE;
|
1997-01-23 04:24:10 +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
|
|
|
|
|
|
|
io.swiz = io_swiz;
|
|
|
|
io.swp = &ioswtch[io_swiz];
|
|
|
|
|
|
|
|
return 0;
|
1996-05-23 05:32:27 +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
|
|
|
/* Second, collect the contents of /etc/alpha_systype or /proc/cpuinfo. */
|
|
|
|
|
|
|
|
if (process_cpuinfo(&data) == 0)
|
|
|
|
{
|
|
|
|
/* This can happen if the format of /proc/cpuinfo changes. */
|
|
|
|
fprintf (stderr,
|
|
|
|
"ioperm.init_iosys: Unable to determine system type.\n"
|
|
|
|
"\t(May need " PATH_ALPHA_SYSTYPE " symlink?)\n");
|
|
|
|
__set_errno (ENODEV);
|
|
|
|
return -1;
|
1996-05-23 05:32:27 +00:00
|
|
|
}
|
1996-03-19 19:51:34 +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
|
|
|
/* Translate systype name into i/o system. */
|
1996-05-23 05:32:27 +00:00
|
|
|
for (i = 0; i < sizeof (platform) / sizeof (platform[0]); ++i)
|
|
|
|
{
|
* 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
|
|
|
if (strcmp (platform[i].name, data.systype) == 0)
|
1996-05-23 05:32:27 +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
|
|
|
iosys_t io_sys = platform[i].io_sys;
|
|
|
|
|
|
|
|
/* Some platforms can have either EV4 or EV5 CPUs. */
|
|
|
|
if (io_sys == IOSYS_CPUDEP)
|
1998-10-08 13:09:39 +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
|
|
|
/* SABLE or MIKASA or NORITAKE so far. */
|
1998-10-08 13:09:39 +00:00
|
|
|
if (strcmp (platform[i].name, "Sable") == 0)
|
|
|
|
{
|
* 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
|
|
|
if (strncmp (data.cpumodel, "EV4", 3) == 0)
|
|
|
|
io_sys = IOSYS_T2;
|
|
|
|
else if (strncmp (data.cpumodel, "EV5", 3) == 0)
|
|
|
|
io_sys = IOSYS_GAMMA;
|
1998-10-08 13:09:39 +00:00
|
|
|
}
|
|
|
|
else
|
* 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
|
|
|
{
|
|
|
|
/* This covers MIKASA/NORITAKE. */
|
|
|
|
if (strncmp (data.cpumodel, "EV4", 3) == 0)
|
|
|
|
io_sys = IOSYS_APECS;
|
|
|
|
else if (strncmp (data.cpumodel, "EV5", 3) == 0)
|
|
|
|
io_sys = IOSYS_CIA;
|
1998-10-08 13:09:39 +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
|
|
|
if (io_sys == IOSYS_CPUDEP)
|
1998-10-08 13:09:39 +00:00
|
|
|
{
|
|
|
|
/* This can happen if the format of /proc/cpuinfo changes.*/
|
* 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
|
|
|
fprintf (stderr, "ioperm.init_iosys: Unable to determine"
|
1998-10-08 13:09:39 +00:00
|
|
|
" CPU model.\n");
|
|
|
|
__set_errno (ENODEV);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
* 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
|
|
|
/* Some platforms can have different core logic chipsets */
|
|
|
|
if (io_sys == IOSYS_PCIDEP)
|
1999-07-06 16:06:12 +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
|
|
|
/* EB164 so far */
|
|
|
|
if (strcmp (data.systype, "EB164") == 0)
|
1999-07-06 16:06:12 +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
|
|
|
if (strncmp (data.sysvari, "RX164", 5) == 0)
|
|
|
|
io_sys = IOSYS_POLARIS;
|
|
|
|
else if (strncmp (data.sysvari, "LX164", 5) == 0
|
|
|
|
|| strncmp (data.sysvari, "SX164", 5) == 0)
|
|
|
|
io_sys = IOSYS_PYXIS;
|
1999-07-06 16:06:12 +00:00
|
|
|
else
|
* 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
|
|
|
io_sys = IOSYS_CIA;
|
1999-07-06 16:06:12 +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
|
|
|
if (io_sys == IOSYS_PCIDEP)
|
1999-07-06 16:06:12 +00:00
|
|
|
{
|
|
|
|
/* This can happen if the format of /proc/cpuinfo changes.*/
|
* 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
|
|
|
fprintf (stderr, "ioperm.init_iosys: Unable to determine"
|
1999-07-06 16:06:12 +00:00
|
|
|
" core logic chipset.\n");
|
|
|
|
__set_errno (ENODEV);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
* 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
|
|
|
io.bus_memory_base = io_system[io_sys].bus_memory_base;
|
|
|
|
io.sparse_bus_memory_base = io_system[io_sys].sparse_bus_mem_base;
|
|
|
|
io.io_base = io_system[io_sys].bus_io_base;
|
1998-10-08 13:09:39 +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
|
|
|
if (io_sys == IOSYS_JENSEN)
|
1999-07-06 16:06:12 +00:00
|
|
|
io.swiz = IOSWIZZLE_JENSEN;
|
* 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
|
|
|
else if (io_sys == IOSYS_TSUNAMI
|
|
|
|
|| io_sys == IOSYS_POLARIS
|
|
|
|
|| io_sys == IOSYS_PYXIS)
|
1999-07-06 16:06:12 +00:00
|
|
|
io.swiz = IOSWIZZLE_DENSE;
|
1996-03-19 19:51:34 +00:00
|
|
|
else
|
1999-07-06 16:06:12 +00:00
|
|
|
io.swiz = IOSWIZZLE_SPARSE;
|
|
|
|
io.swp = &ioswtch[io.swiz];
|
* 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
|
|
|
|
|
|
|
__set_errno (olderrno);
|
1996-03-19 19:51:34 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
1996-05-23 05:32:27 +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
|
|
|
__set_errno (ENODEV);
|
|
|
|
fprintf(stderr, "ioperm.init_iosys: Platform not recognized.\n"
|
|
|
|
"\t(May need " PATH_ALPHA_SYSTYPE " symlink?)\n");
|
1996-03-19 19:51:34 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int
|
1997-01-23 04:24:10 +00:00
|
|
|
_ioperm (unsigned long int from, unsigned long int num, int turn_on)
|
1996-03-19 19:51:34 +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
|
|
|
unsigned long int addr, len, pagesize = __getpagesize();
|
|
|
|
int prot;
|
1996-03-19 19:51:34 +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
|
|
|
if (!io.swp && init_iosys() < 0)
|
|
|
|
{
|
1999-10-01 16:03:15 +00:00
|
|
|
#ifdef DEBUG_IOPERM
|
* 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
|
|
|
fprintf(stderr, "ioperm: init_iosys() failed (%m)\n");
|
1999-07-06 16:06:12 +00:00
|
|
|
#endif
|
* 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
|
|
|
return -1;
|
|
|
|
}
|
1996-03-19 19:51:34 +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
|
|
|
/* This test isn't as silly as it may look like; consider overflows! */
|
1996-05-23 05:32:27 +00:00
|
|
|
if (from >= MAX_PORT || from + num > MAX_PORT)
|
|
|
|
{
|
1996-09-27 03:44:39 +00:00
|
|
|
__set_errno (EINVAL);
|
1999-10-01 16:03:15 +00:00
|
|
|
#ifdef DEBUG_IOPERM
|
1999-07-06 16:06:12 +00:00
|
|
|
fprintf(stderr, "ioperm: from/num out of range\n");
|
|
|
|
#endif
|
1996-05-23 05:32:27 +00:00
|
|
|
return -1;
|
|
|
|
}
|
1996-03-19 19:51:34 +00:00
|
|
|
|
1999-10-01 16:03:15 +00:00
|
|
|
#ifdef DEBUG_IOPERM
|
* 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
|
|
|
fprintf(stderr, "ioperm: turn_on %d io.base %ld\n", turn_on, io.base);
|
1999-07-06 16:06:12 +00:00
|
|
|
#endif
|
|
|
|
|
1996-05-23 05:32:27 +00:00
|
|
|
if (turn_on)
|
|
|
|
{
|
|
|
|
if (!io.base)
|
|
|
|
{
|
|
|
|
int fd;
|
|
|
|
|
* 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
|
|
|
io.hae_cache = 0;
|
1999-07-06 16:06:12 +00:00
|
|
|
if (io.swiz != IOSWIZZLE_DENSE)
|
* 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
|
|
|
{
|
|
|
|
/* Synchronize with hw. */
|
|
|
|
__sethae (0);
|
|
|
|
}
|
1996-05-23 05:32:27 +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
|
|
|
fd = __open ("/dev/mem", O_RDWR);
|
|
|
|
if (fd < 0)
|
|
|
|
{
|
1999-10-01 16:03:15 +00:00
|
|
|
#ifdef DEBUG_IOPERM
|
* 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
|
|
|
fprintf(stderr, "ioperm: /dev/mem open failed (%m)\n");
|
1999-07-06 16:06:12 +00:00
|
|
|
#endif
|
* 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
|
|
|
return -1;
|
|
|
|
}
|
1996-05-23 05:32:27 +00:00
|
|
|
|
1999-07-06 16:06:12 +00:00
|
|
|
addr = port_to_cpu_addr (0, io.swiz, 1);
|
|
|
|
len = port_to_cpu_addr (MAX_PORT, io.swiz, 1) - addr;
|
1996-05-23 05:32:27 +00:00
|
|
|
io.base =
|
1997-01-23 04:24:10 +00:00
|
|
|
(unsigned long int) __mmap (0, len, PROT_NONE, MAP_SHARED,
|
1998-10-08 13:09:39 +00:00
|
|
|
fd, io.io_base);
|
* 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
|
|
|
__close (fd);
|
1999-10-01 16:03:15 +00:00
|
|
|
#ifdef DEBUG_IOPERM
|
1999-07-06 16:06:12 +00:00
|
|
|
fprintf(stderr, "ioperm: mmap of len 0x%lx returned 0x%lx\n",
|
|
|
|
len, io.base);
|
|
|
|
#endif
|
1996-05-23 05:32:27 +00:00
|
|
|
if ((long) io.base == -1)
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
prot = PROT_READ | PROT_WRITE;
|
1996-03-19 19:51:34 +00:00
|
|
|
}
|
1996-05-23 05:32:27 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!io.base)
|
|
|
|
return 0; /* never was turned on... */
|
1996-03-19 19:51:34 +00:00
|
|
|
|
1996-05-23 05:32:27 +00:00
|
|
|
/* turnoff access to relevant pages: */
|
|
|
|
prot = PROT_NONE;
|
|
|
|
}
|
1999-07-06 16:06:12 +00:00
|
|
|
addr = port_to_cpu_addr (from, io.swiz, 1);
|
* 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
|
|
|
addr &= ~(pagesize - 1);
|
1999-07-06 16:06:12 +00:00
|
|
|
len = port_to_cpu_addr (from + num, io.swiz, 1) - addr;
|
* 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
|
|
|
return __mprotect ((void *) addr, len, prot);
|
1996-03-19 19:51:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int
|
* 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
|
|
|
_iopl (int level)
|
|
|
|
{
|
|
|
|
switch (level)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
case 1: case 2: case 3:
|
|
|
|
return _ioperm (0, MAX_PORT, 1);
|
|
|
|
|
|
|
|
default:
|
|
|
|
__set_errno (EINVAL);
|
|
|
|
return -1;
|
|
|
|
}
|
1996-03-19 19:51:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
1997-01-23 04:24:10 +00:00
|
|
|
_sethae (unsigned long int addr)
|
1996-03-19 19:51:34 +00:00
|
|
|
{
|
|
|
|
if (!io.swp && init_iosys () < 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
io.swp->sethae (addr);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
1997-01-23 04:24:10 +00:00
|
|
|
_outb (unsigned char b, unsigned long int port)
|
1996-03-19 19:51:34 +00:00
|
|
|
{
|
|
|
|
if (port >= MAX_PORT)
|
|
|
|
return;
|
|
|
|
|
|
|
|
io.swp->outb (b, port);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
1997-01-23 04:24:10 +00:00
|
|
|
_outw (unsigned short b, unsigned long int port)
|
1996-03-19 19:51:34 +00:00
|
|
|
{
|
|
|
|
if (port >= MAX_PORT)
|
|
|
|
return;
|
|
|
|
|
|
|
|
io.swp->outw (b, port);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
1997-01-23 04:24:10 +00:00
|
|
|
_outl (unsigned int b, unsigned long int port)
|
1996-03-19 19:51:34 +00:00
|
|
|
{
|
|
|
|
if (port >= MAX_PORT)
|
|
|
|
return;
|
|
|
|
|
|
|
|
io.swp->outl (b, port);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
unsigned int
|
1997-01-23 04:24:10 +00:00
|
|
|
_inb (unsigned long int port)
|
1996-03-19 19:51:34 +00:00
|
|
|
{
|
|
|
|
return io.swp->inb (port);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
unsigned int
|
1997-01-23 04:24:10 +00:00
|
|
|
_inw (unsigned long int port)
|
1996-03-19 19:51:34 +00:00
|
|
|
{
|
|
|
|
return io.swp->inw (port);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
unsigned int
|
1997-01-23 04:24:10 +00:00
|
|
|
_inl (unsigned long int port)
|
1996-03-19 19:51:34 +00:00
|
|
|
{
|
|
|
|
return io.swp->inl (port);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1997-01-23 04:24:10 +00:00
|
|
|
unsigned long int
|
1996-05-23 05:32:27 +00:00
|
|
|
_bus_base(void)
|
|
|
|
{
|
|
|
|
if (!io.swp && init_iosys () < 0)
|
|
|
|
return -1;
|
1996-09-05 02:48:53 +00:00
|
|
|
return io.bus_memory_base;
|
1996-05-23 05:32:27 +00:00
|
|
|
}
|
|
|
|
|
1997-01-23 04:24:10 +00:00
|
|
|
unsigned long int
|
1996-08-11 01:30:23 +00:00
|
|
|
_bus_base_sparse(void)
|
|
|
|
{
|
|
|
|
if (!io.swp && init_iosys () < 0)
|
|
|
|
return -1;
|
1996-09-05 02:48:53 +00:00
|
|
|
return io.sparse_bus_memory_base;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
_hae_shift(void)
|
|
|
|
{
|
|
|
|
if (!io.swp && init_iosys () < 0)
|
|
|
|
return -1;
|
* 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
|
|
|
if (io.swiz == IOSWIZZLE_JENSEN)
|
|
|
|
return 7;
|
|
|
|
if (io.swiz == IOSWIZZLE_SPARSE)
|
|
|
|
return 5;
|
|
|
|
return 0;
|
1996-08-11 01:30:23 +00:00
|
|
|
}
|
|
|
|
|
1996-03-19 19:51:34 +00:00
|
|
|
weak_alias (_sethae, sethae);
|
|
|
|
weak_alias (_ioperm, ioperm);
|
|
|
|
weak_alias (_iopl, iopl);
|
|
|
|
weak_alias (_inb, inb);
|
|
|
|
weak_alias (_inw, inw);
|
|
|
|
weak_alias (_inl, inl);
|
|
|
|
weak_alias (_outb, outb);
|
|
|
|
weak_alias (_outw, outw);
|
|
|
|
weak_alias (_outl, outl);
|
1996-05-23 05:32:27 +00:00
|
|
|
weak_alias (_bus_base, bus_base);
|
1996-08-11 01:30:23 +00:00
|
|
|
weak_alias (_bus_base_sparse, bus_base_sparse);
|
1996-09-05 02:48:53 +00:00
|
|
|
weak_alias (_hae_shift, hae_shift);
|