From 9c1609965f6c52ca5ec5c1a899bf6c16feecb2e0 Mon Sep 17 00:00:00 2001 From: ian Date: Tue, 5 Aug 2014 19:06:45 +0000 Subject: [PATCH] Add an arm option, ARM_DEVICE_MULTIPASS, used to opt-in to multi-pass device attachment on arm platforms. If this is defined, nexus attaches early in BUS_PASS_BUS, and other busses and devices attach later, in the pass number they are set up for. Without it defined, nexus attaches in BUS_PASS_DEFAULT and thus so does everything else, which is status quo. Arm platforms which use FDT data to enumerate devices have been relying on devices being attached in the exact order they're listed in the dts source file. That's one of things currently preventing us from using vendor-supplied fdt data (because then we don't control the order of the devices in the data). Multi-pass attachment can go a long way towards solving that problem by ensuring things like clock and interrupt drivers are attached before the more mundane devices that need them. The long-term goal is to have all arm fdt-based platforms using multipass. This option is a bridge to that, letting us enable it selectively as platforms are converted and tested (the alternative being to just throw a big switch and try to fight fires as they're reported). --- sys/arm/arm/nexus.c | 5 +++++ sys/conf/options.arm | 1 + 2 files changed, 6 insertions(+) diff --git a/sys/arm/arm/nexus.c b/sys/arm/arm/nexus.c index fe1261f0a416..a66fc3e0135b 100644 --- a/sys/arm/arm/nexus.c +++ b/sys/arm/arm/nexus.c @@ -125,7 +125,12 @@ static driver_t nexus_driver = { nexus_methods, 1 /* no softc */ }; +#ifdef ARM_DEVICE_MULTIPASS +EARLY_DRIVER_MODULE(nexus, root, nexus_driver, nexus_devclass, 0, 0, + BUS_PASS_BUS + BUS_PASS_ORDER_EARLY); +#else DRIVER_MODULE(nexus, root, nexus_driver, nexus_devclass, 0, 0); +#endif static int nexus_probe(device_t dev) diff --git a/sys/conf/options.arm b/sys/conf/options.arm index fd32e52e854d..545cb451650a 100644 --- a/sys/conf/options.arm +++ b/sys/conf/options.arm @@ -1,6 +1,7 @@ #$FreeBSD$ ARM9_CACHE_WRITE_THROUGH opt_global.h ARM_CACHE_LOCK_ENABLE opt_global.h +ARM_DEVICE_MULTIPASS opt_global.h ARM_KERN_DIRECTMAP opt_vm.h ARM_L2_PIPT opt_global.h ARM_MANY_BOARD opt_global.h