Date: Tue, 19 Mar 2019 15:03:20 +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: r345298 - head/sys/dev/pci Message-ID: <201903191503.x2JF3KZL077035@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: imp Date: Tue Mar 19 15:03:20 2019 New Revision: 345298 URL: https://svnweb.freebsd.org/changeset/base/345298 Log: Add comment about why we bother to use endian macros here, and why we must use bitfields. Modified: head/sys/dev/pci/pcivar.h Modified: head/sys/dev/pci/pcivar.h ============================================================================== --- head/sys/dev/pci/pcivar.h Tue Mar 19 14:34:53 2019 (r345297) +++ head/sys/dev/pci/pcivar.h Tue Mar 19 15:03:20 2019 (r345298) @@ -259,6 +259,14 @@ typedef struct { extern uint32_t pci_numdevs; +/* + * The bitfield has to be stable an match the fields below (so that + * match_flag_vendor must be bit 0) so we have to do the endian + * dance. We can't use enums or #define constants because then the + * the macros for subsetting matches wouldn't work. These tables + * are parsed by devmatch and others to connect modules with + * devices on the PCI bus. + */ struct pci_device_table { #if BYTE_ORDER == LITTLE_ENDIAN uint16_t
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201903191503.x2JF3KZL077035>