Author: marius
Date: Fri Nov 19 17:24:03 2010
New Revision: 215537
URL: http://svn.freebsd.org/changeset/base/215537

Log:
  MFC: r176965
  
  Any driver that relies on its parent to set the devclass has no way to
  know if has siblings that need an actual probe.  Introduce a specail
  return value called BUS_PROBE_NOOWILDCARD.  If the driver returns
  this, the probe is only successful for devices that have had a
  specific devclass set for them.
  
  Reviewed by: current@, jhb@, grehan@

Modified:
  stable/7/sys/kern/subr_bus.c
  stable/7/sys/sys/bus.h
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/kern/subr_bus.c
==============================================================================
--- stable/7/sys/kern/subr_bus.c        Fri Nov 19 17:11:12 2010        
(r215536)
+++ stable/7/sys/kern/subr_bus.c        Fri Nov 19 17:24:03 2010        
(r215537)
@@ -1788,6 +1788,14 @@ device_probe_child(device_t dev, device_
                         * of pri for the first match.
                         */
                        if (best == NULL || result > pri) {
+                               /*
+                                * Probes that return BUS_PROBE_NOWILDCARD
+                                * or lower only match when they are set
+                                * in stone by the parent bus.
+                                */
+                               if (result <= BUS_PROBE_NOWILDCARD &&
+                                   child->flags & DF_WILDCARD)
+                                       continue;
                                best = dl;
                                pri = result;
                                continue;

Modified: stable/7/sys/sys/bus.h
==============================================================================
--- stable/7/sys/sys/bus.h      Fri Nov 19 17:11:12 2010        (r215536)
+++ stable/7/sys/sys/bus.h      Fri Nov 19 17:24:03 2010        (r215537)
@@ -503,7 +503,10 @@ void       bus_data_generation_update(void);
  * is for drivers that wish to have a generic form and a specialized form,
  * like is done with the pci bus and the acpi pci bus.  BUS_PROBE_HOOVER is
  * for those busses that implement a generic device place-holder for devices on
- * the bus that have no more specific driver for them (aka ugen).
+ * the bus that have no more specific river for them (aka ugen).
+ * BUS_PROBE_NOWILDCARD or lower means that the device isn't really bidding
+ * for a device node, but accepts only devices that its parent has told it
+ * use this driver.
  */
 #define BUS_PROBE_SPECIFIC     0       /* Only I can use this device */
 #define BUS_PROBE_VENDOR       (-10)   /* Vendor supplied driver */
@@ -511,6 +514,7 @@ void        bus_data_generation_update(void);
 #define BUS_PROBE_LOW_PRIORITY (-40)   /* Older, less desirable drivers */
 #define BUS_PROBE_GENERIC      (-100)  /* generic driver for dev */
 #define BUS_PROBE_HOOVER       (-500)  /* Generic dev for all devs on bus */
+#define BUS_PROBE_NOWILDCARD   (-2000000000) /* No wildcard device matches */
 
 /**
  * Shorthand for constructing method tables.
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to