^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Virtual EISA root driver.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Acts as a placeholder if we don't have a proper EISA bridge.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * (C) 2003 Marc Zyngier <maz@wild-wind.fr.eu.org>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/eisa.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/moduleparam.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)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #if defined(CONFIG_ALPHA_JENSEN) || defined(CONFIG_EISA_VLB_PRIMING)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #define EISA_FORCE_PROBE_DEFAULT 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #define EISA_FORCE_PROBE_DEFAULT 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) static int force_probe = EISA_FORCE_PROBE_DEFAULT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) static void virtual_eisa_release (struct device *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) /* The default EISA device parent (virtual root device).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) * Now use a platform device, since that's the obvious choice. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) static struct platform_device eisa_root_dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) .name = "eisa",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) .id = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) .release = virtual_eisa_release,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) static struct eisa_root_device eisa_bus_root = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) .dev = &eisa_root_dev.dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) .bus_base_addr = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) .res = &ioport_resource,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) .slots = EISA_MAX_SLOTS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) .dma_mask = 0xffffffff,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) static void virtual_eisa_release (struct device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) /* nothing really to do here */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) static int __init virtual_eisa_root_init (void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) int r;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) if ((r = platform_device_register (&eisa_root_dev)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) return r;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) eisa_bus_root.force_probe = force_probe;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) dev_set_drvdata(&eisa_root_dev.dev, &eisa_bus_root);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) if (eisa_root_register (&eisa_bus_root)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) /* A real bridge may have been registered before
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) * us. So quietly unregister. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) platform_device_unregister (&eisa_root_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) return -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) module_param (force_probe, int, 0444);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) device_initcall (virtual_eisa_root_init);