[PATCH 4/8] Add support for ordering the initialization of Nexus devices. This can be used to make sure a device is initialized before a dependant device.
Kevin Kirspel
kevin-kirspel at idexx.com
Fri Jan 27 05:32:22 UTC 2017
---
rtemsbsd/include/rtems/bsd/bsd.h | 13 ++++++++++++-
rtemsbsd/rtems/rtems-kernel-nexus.c | 12 +++++++++---
2 files changed, 21 insertions(+), 4 deletions(-)
mode change 100644 => 100755 rtemsbsd/include/rtems/bsd/bsd.h
mode change 100644 => 100755 rtemsbsd/rtems/rtems-kernel-nexus.c
diff --git a/rtemsbsd/include/rtems/bsd/bsd.h b/rtemsbsd/include/rtems/bsd/bsd.h
old mode 100644
new mode 100755
index 0968062..e356390
--- a/rtemsbsd/include/rtems/bsd/bsd.h
+++ b/rtemsbsd/include/rtems/bsd/bsd.h
@@ -63,6 +63,13 @@ typedef enum {
RTEMS_BSD_RES_MEMORY = 3
} rtems_bsd_device_resource_type;
+typedef enum {
+ RTEMS_BSD_ORDER_FIRST,
+ RTEMS_BSD_ORDER_MIDDLE,
+ RTEMS_BSD_ORDER_LAST,
+ RTEMS_BSD_ORDER_MAX
+} rtems_bsd_device_order_type;
+
typedef struct {
rtems_bsd_device_resource_type type;
unsigned long start_request;
@@ -72,15 +79,19 @@ typedef struct {
typedef struct {
const char *name;
int unit;
+ rtems_bsd_device_order_type order;
size_t resource_count;
const rtems_bsd_device_resource *resources;
const struct sysinit *driver_reference;
} rtems_bsd_device;
#define RTEMS_BSD_DEFINE_NEXUS_DEVICE(name, unit, resource_count, resources) \
+ RTEMS_BSD_DEFINE_NEXUS_DEVICE_ORDERED(name, unit, RTEMS_BSD_ORDER_MIDDLE, resource_count, resources)
+
+#define RTEMS_BSD_DEFINE_NEXUS_DEVICE_ORDERED(name, unit, order, resource_count, resources) \
extern struct sysinit SYSINIT_ENTRY_NAME(name##_nexusmodule); \
RTEMS_BSD_DEFINE_SET_ITEM(nexus, name##unit, rtems_bsd_device) = \
- { #name, unit, (resource_count), (resources), \
+ { #name, unit, order, (resource_count), (resources), \
&SYSINIT_ENTRY_NAME(name##_nexusmodule) }
rtems_status_code rtems_bsd_initialize(void);
diff --git a/rtemsbsd/rtems/rtems-kernel-nexus.c b/rtemsbsd/rtems/rtems-kernel-nexus.c
old mode 100644
new mode 100755
index 04638cc..caff30e
--- a/rtemsbsd/rtems/rtems-kernel-nexus.c
+++ b/rtemsbsd/rtems/rtems-kernel-nexus.c
@@ -78,7 +78,7 @@ SYSINIT_REFERENCE(irqs);
static int
nexus_probe(device_t dev)
{
- int err;
+ int err, index;
const rtems_bsd_device *nd;
device_set_desc(dev, "RTEMS Nexus device");
@@ -113,8 +113,14 @@ nexus_probe(device_t dev)
BSD_ASSERT(err == 0);
#endif
- SET_FOREACH(nd, nexus) {
- device_add_child(dev, nd->name, nd->unit);
+ for( index = 0; index < RTEMS_BSD_ORDER_MAX; index++ )
+ {
+ SET_FOREACH(nd, nexus) {
+ if( nd->order == (rtems_bsd_device_order_type)index )
+ {
+ device_add_child(dev, nd->name, nd->unit);
+ }
+ }
}
return (0);
--
1.9.1
More information about the devel
mailing list