diff --git a/sys/dev/pci/pci_host_generic.c b/sys/dev/pci/pci_host_generic.c
index 5a89a19c030d..57609a9a1ef5 100644
--- a/sys/dev/pci/pci_host_generic.c
+++ b/sys/dev/pci/pci_host_generic.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2015 Ruslan Bukin
+ * Copyright (c) 2015, 2020 Ruslan Bukin
* Copyright (c) 2014 The FreeBSD Foundation
* All rights reserved.
*
@@ -54,21 +54,6 @@ __FBSDID("$FreeBSD$");
#include "pcib_if.h"
-/* Assembling ECAM Configuration Address */
-#define PCIE_BUS_SHIFT 20
-#define PCIE_SLOT_SHIFT 15
-#define PCIE_FUNC_SHIFT 12
-#define PCIE_BUS_MASK 0xFF
-#define PCIE_SLOT_MASK 0x1F
-#define PCIE_FUNC_MASK 0x07
-#define PCIE_REG_MASK 0xFFF
-
-#define PCIE_ADDR_OFFSET(bus, slot, func, reg) \
- ((((bus) & PCIE_BUS_MASK) << PCIE_BUS_SHIFT) | \
- (((slot) & PCIE_SLOT_MASK) << PCIE_SLOT_SHIFT) | \
- (((func) & PCIE_FUNC_MASK) << PCIE_FUNC_SHIFT) | \
- ((reg) & PCIE_REG_MASK))
-
/* Forward prototypes */
static uint32_t generic_pcie_read_config(device_t dev, u_int bus, u_int slot,
diff --git a/sys/dev/pci/pci_host_generic.h b/sys/dev/pci/pci_host_generic.h
index 5feb3a6031a0..da7d9e52adc2 100644
--- a/sys/dev/pci/pci_host_generic.h
+++ b/sys/dev/pci/pci_host_generic.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015 Ruslan Bukin
+ * Copyright (c) 2015, 2020 Ruslan Bukin
* Copyright (c) 2015 The FreeBSD Foundation
* All rights reserved.
*
@@ -36,6 +36,21 @@
#include "pci_if.h"
+/* Assembling ECAM Configuration Address */
+#define PCIE_BUS_SHIFT 20
+#define PCIE_SLOT_SHIFT 15
+#define PCIE_FUNC_SHIFT 12
+#define PCIE_BUS_MASK 0xFF
+#define PCIE_SLOT_MASK 0x1F
+#define PCIE_FUNC_MASK 0x07
+#define PCIE_REG_MASK 0xFFF
+
+#define PCIE_ADDR_OFFSET(bus, slot, func, reg) \
+ ((((bus) & PCIE_BUS_MASK) << PCIE_BUS_SHIFT) | \
+ (((slot) & PCIE_SLOT_MASK) << PCIE_SLOT_SHIFT) | \
+ (((func) & PCIE_FUNC_MASK) << PCIE_FUNC_SHIFT) | \
+ ((reg) & PCIE_REG_MASK))
+
#define MAX_RANGES_TUPLES 16
#define MIN_RANGES_TUPLES 2