[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 4/8] Make some PCI macros available to other files. NFC.
From: |
Jason Thorpe |
Subject: |
[PATCH 4/8] Make some PCI macros available to other files. NFC. |
Date: |
Wed, 2 Jun 2021 20:53:13 -0700 |
Move PCI_DEVFN(), PCI_BUS(), PCI_SLOT(), and PCI_FUNC() to pci.h.
Signed-off-by: Jason Thorpe <thorpej@me.com>
---
pci.c | 4 ----
pci.h | 5 +++++
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/pci.c b/pci.c
index 87a101c..ba05adb 100644
--- a/pci.c
+++ b/pci.c
@@ -31,10 +31,6 @@
#include "pci_regs.h"
-#define PCI_DEVFN(slot, func) ((((slot) & 0x1f) << 3) | ((func) & 0x07))
-#define PCI_BUS(devfn) ((devfn) >> 8)
-#define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f)
-#define PCI_FUNC(devfn) ((devfn) & 0x07)
#define PCI_SLOT_MAX 32
#define PCI_FUNC_MAX 8
#define PCI_REGION_ROM 6
diff --git a/pci.h b/pci.h
index b751c6f..b4a4f80 100644
--- a/pci.h
+++ b/pci.h
@@ -60,6 +60,11 @@ extern void pci_config_maskw(int bdf, int addr, uint16_t
off, uint16_t on);
extern int pci_next(int bdf, int *pmax);
+#define PCI_DEVFN(slot, func) ((((slot) & 0x1f) << 3) | ((func) & 0x07))
+#define PCI_BUS(devfn) ((devfn) >> 8)
+#define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f)
+#define PCI_FUNC(devfn) ((devfn) & 0x07)
+
#define foreachpci(BDF, MAX) \
for (MAX = 0x0100, BDF = pci_next(0, &MAX); \
BDF >= 0; \
--
2.30.2
- [PATCH 0/8] PALcode fixes required to run NetBSD/alpha., Jason Thorpe, 2021/06/02
- [PATCH 3/8] Fix initialization of the hwrpb.hwrpb.cpuid field., Jason Thorpe, 2021/06/02
- [PATCH 1/8] Make qemu-palcode build environment standalone. NFC., Jason Thorpe, 2021/06/02
- [PATCH 2/8] Fix delivery of unaligned access exceptions., Jason Thorpe, 2021/06/02
- [PATCH 4/8] Make some PCI macros available to other files. NFC.,
Jason Thorpe <=
- [PATCH 5/8] Fix incorrect initialization of PCI BARs., Jason Thorpe, 2021/06/02
- [PATCH 6/8] Provide interrupt mapping information in PCI config registers., Jason Thorpe, 2021/06/02
- [PATCH 7/8] Provide a Console Terminal Block in the HWRPB., Jason Thorpe, 2021/06/02