From fa7e1c06475fefff1cb785ccc95369f383ba3e15 Mon Sep 17 00:00:00 2001 From: jsg Date: Wed, 31 Jan 2018 05:04:41 +0000 Subject: [PATCH] add pci_is_root_bus() --- sys/dev/pci/drm/drm_drv.c | 3 ++- sys/dev/pci/drm/drm_linux.h | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/sys/dev/pci/drm/drm_drv.c b/sys/dev/pci/drm/drm_drv.c index 1cefbb8e5e8..9db6ba51ca0 100644 --- a/sys/dev/pci/drm/drm_drv.c +++ b/sys/dev/pci/drm/drm_drv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: drm_drv.c,v 1.156 2018/01/30 08:17:31 jsg Exp $ */ +/* $OpenBSD: drm_drv.c,v 1.157 2018/01/31 05:04:41 jsg Exp $ */ /*- * Copyright 2007-2009 Owain G. Ainsworth * Copyright © 2008 Intel Corporation @@ -430,6 +430,7 @@ drm_attach(struct device *parent, struct device *self, void *aux) dev->pdev->bus = &dev->pdev->_bus; dev->pdev->bus->pc = da->pc; dev->pdev->bus->number = bus; + dev->pdev->bus->bridgetag = da->bridgetag; dev->pdev->devfn = PCI_DEVFN(slot, func); dev->pc = da->pc; diff --git a/sys/dev/pci/drm/drm_linux.h b/sys/dev/pci/drm/drm_linux.h index 1c7fd9fb16e..f11ac61e7a7 100644 --- a/sys/dev/pci/drm/drm_linux.h +++ b/sys/dev/pci/drm/drm_linux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: drm_linux.h,v 1.81 2018/01/31 03:26:00 jsg Exp $ */ +/* $OpenBSD: drm_linux.h,v 1.82 2018/01/31 05:04:41 jsg Exp $ */ /* * Copyright (c) 2013, 2014, 2015 Mark Kettenis * Copyright (c) 2017 Martin Pieuchot @@ -1434,6 +1434,7 @@ struct resource { struct pci_bus { pci_chipset_tag_t pc; unsigned char number; + pcitag_t *bridgetag; }; struct pci_dev { @@ -1576,6 +1577,12 @@ pci_pcie_cap(struct pci_dev *pdev) return pos; } +static inline bool +pci_is_root_bus(struct pci_bus *pbus) +{ + return (pbus->bridgetag == NULL); +} + static inline int pcie_capability_read_dword(struct pci_dev *pdev, int off, u32 *val) { -- 2.20.1