virtual_root.c 1.6 KB

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