[Midnightbsd-cvs] src [12379] trunk/sys/sys/module.h: Sync with FreeBSD 11-stable

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sun Feb 16 17:36:13 EST 2020


Revision: 12379
          http://svnweb.midnightbsd.org/src/?rev=12379
Author:   laffer1
Date:     2020-02-16 17:36:13 -0500 (Sun, 16 Feb 2020)
Log Message:
-----------
Sync with FreeBSD 11-stable

Modified Paths:
--------------
    trunk/sys/sys/module.h

Modified: trunk/sys/sys/module.h
===================================================================
--- trunk/sys/sys/module.h	2020-02-16 22:35:10 UTC (rev 12378)
+++ trunk/sys/sys/module.h	2020-02-16 22:36:13 UTC (rev 12379)
@@ -24,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: stable/10/sys/sys/module.h 298493 2016-04-22 21:38:37Z emaste $
+ * $FreeBSD: stable/11/sys/sys/module.h 331722 2018-03-29 02:50:57Z eadler $
  */
 
 #ifndef _SYS_MODULE_H_
@@ -72,7 +72,7 @@
 } modspecific_t;
 
 /*
- * Module dependency declarartion
+ * Module dependency declaration
  */
 struct mod_depend {
 	int	md_ver_minimum;
@@ -90,10 +90,19 @@
 struct mod_metadata {
 	int		md_version;	/* structure version MDTV_* */
 	int		md_type;	/* type of entry MDT_* */
-	void		*md_data;	/* specific data */
+	const void	*md_data;	/* specific data */
 	const char	*md_cval;	/* common string label */
 };
 
+struct mod_pnp_match_info 
+{
+	const char *descr;	/* Description of the table */
+	const char *bus;	/* Name of the bus for this table */
+	const void *table;	/* Pointer to pnp table */
+	int entry_len;		/* Length of each entry in the table (may be */
+				/*   longer than descr describes). */
+	int num_entry;		/* Number of entries in the table */
+};
 #ifdef	_KERNEL
 
 #include <sys/linker_set.h>
@@ -156,6 +165,44 @@
 	MODULE_METADATA(_##module##_version, MDT_VERSION,		\
 	    &_##module##_version, #module)
 
+/**
+ * Generic macros to create pnp info hints that modules may export
+ * to allow external tools to parse their internal device tables
+ * to make an informed guess about what driver(s) to load.
+ */
+#define	MODULE_PNP_INFO(d, b, unique, t, l, n)				\
+	static const struct mod_pnp_match_info _module_pnp_##b##_##unique = {	\
+		.descr = d,						\
+		.bus = #b,						\
+		.table = t,						\
+		.entry_len = l,						\
+		.num_entry = n						\
+	};								\
+	MODULE_METADATA(_md_##b##_pnpinfo_##unique, MDT_PNP_INFO,	\
+	    &_module_pnp_##b##_##unique, #b);
+/**
+ * descr is a string that describes each entry in the table. The general
+ * form is (TYPE:pnp_name[/pnp_name];)*
+ * where TYPE is one of the following:
+ *	U8	uint8_t element
+ *	V8	like U8 and 0xff means match any
+ *	G16	uint16_t element, any value >= matches
+ *	L16	uint16_t element, any value <= matches
+ *	M16	uint16_t element, mask of which of the following fields to use.
+ *	U16	uint16_t element
+ *	V16	like U16 and 0xffff means match any
+ *	U32	uint32_t element
+ *	V32	like U32 and 0xffffffff means match any
+ *	W32	Two 16-bit values with first pnp_name in LSW and second in MSW.
+ *	Z	pointer to a string to match exactly
+ *	D	like Z, but is the string passed to device_set_descr()
+ *	P	A pointer that should be ignored
+ *	E	EISA PNP Identifier (in binary, but bus publishes string)
+ *	K	Key for whole table. pnp_name=value. must be last, if present.
+ *
+ * The pnp_name "#" is reserved for other fields that should be ignored.
+ */
+
 extern struct sx modules_sx;
 
 #define	MOD_XLOCK	sx_xlock(&modules_sx)



More information about the Midnightbsd-cvs mailing list