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