Date: Mon, 16 Dec 2019 21:34:58 +0000 (UTC) From: Warner Losh <imp@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355823 - in head/sys/dev: exca pccbb Message-ID: <201912162134.xBGLYwhP096816@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201912162134.xBGLYwhP096816>