^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * linux/arch/arm/kernel/isa.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright (C) 1999 Phil Blundell
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * ISA shared memory and I/O port support, and is required to support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * iopl, inb, outb and friends in userspace via glibc emulation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/stddef.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/fs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/sysctl.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/io.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) static unsigned int isa_membase, isa_portbase, isa_portshift;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) static struct ctl_table ctl_isa_vars[4] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) .procname = "membase",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) .data = &isa_membase,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) .maxlen = sizeof(isa_membase),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) .mode = 0444,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) .proc_handler = proc_dointvec,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) }, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) .procname = "portbase",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) .data = &isa_portbase,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) .maxlen = sizeof(isa_portbase),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) .mode = 0444,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) .proc_handler = proc_dointvec,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) }, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) .procname = "portshift",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) .data = &isa_portshift,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) .maxlen = sizeof(isa_portshift),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) .mode = 0444,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) .proc_handler = proc_dointvec,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) }, {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) static struct ctl_table_header *isa_sysctl_header;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) static struct ctl_table ctl_isa[2] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) .procname = "isa",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) .mode = 0555,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) .child = ctl_isa_vars,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) }, {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) static struct ctl_table ctl_bus[2] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) .procname = "bus",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) .mode = 0555,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) .child = ctl_isa,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) }, {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) void __init
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) register_isa_ports(unsigned int membase, unsigned int portbase, unsigned int portshift)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) isa_membase = membase;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) isa_portbase = portbase;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) isa_portshift = portshift;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) isa_sysctl_header = register_sysctl_table(ctl_bus);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) }