svn commit: r355823 - in head/sys/dev: exca pccbb

Warner Losh imp at FreeBSD.org
Mon Dec 16 21:34:58 UTC 2019


Author: imp
Date: Mon Dec 16 21:34:57 2019
New Revision: 355823
URL: https://svnweb.freebsd.org/changeset/base/355823

Log:
  Add slot number ivar to return which slot number the child is attached to.
  
  This will always be 0 for pccbb, but may be non-zero for other kinds of bridges,
  should they show up in the tree. Make querying it generic.

Modified:
  head/sys/dev/exca/excavar.h
  head/sys/dev/pccbb/pccbb.c

Modified: head/sys/dev/exca/excavar.h
==============================================================================
--- head/sys/dev/exca/excavar.h	Mon Dec 16 21:34:51 2019	(r355822)
+++ head/sys/dev/exca/excavar.h	Mon Dec 16 21:34:57 2019	(r355823)
@@ -151,4 +151,17 @@ exca_clrb(struct exca_softc *sc, int reg, uint8_t mask
 	exca_putb(sc, reg, exca_getb(sc, reg) & ~mask);
 }
 
+enum {
+	EXCA_IVAR_SLOT = 100,
+};
+
+#define EXCA_ACCESSOR(A, B, T)						\
+static inline int							\
+exca_get_ ## A(device_t dev, T *t)					\
+{									\
+	return BUS_READ_IVAR(device_get_parent(dev), dev,		\
+	    EXCA_IVAR_ ## B, (uintptr_t *) t);			\
+}
+
+EXCA_ACCESSOR(slot,		SLOT,			uint32_t)
 #endif /* !_SYS_DEV_EXCA_EXCAVAR_H */

Modified: head/sys/dev/pccbb/pccbb.c
==============================================================================
--- head/sys/dev/pccbb/pccbb.c	Mon Dec 16 21:34:51 2019	(r355822)
+++ head/sys/dev/pccbb/pccbb.c	Mon Dec 16 21:34:57 2019	(r355823)
@@ -1565,6 +1565,9 @@ cbb_read_ivar(device_t brdev, device_t child, int whic
 	case PCIB_IVAR_BUS:
 		*result = sc->bus.sec;
 		return (0);
+	case EXCA_IVAR_SLOT:
+		*result = 0;
+		return (0);
 	}
 	return (ENOENT);
 }
@@ -1577,6 +1580,8 @@ cbb_write_ivar(device_t brdev, device_t child, int whi
 	case PCIB_IVAR_DOMAIN:
 		return (EINVAL);
 	case PCIB_IVAR_BUS:
+		return (EINVAL);
+	case EXCA_IVAR_SLOT:
 		return (EINVAL);
 	}
 	return (ENOENT);


More information about the svn-src-all mailing list