summaryrefslogtreecommitdiffstats
path: root/sys-kernel/boest-v4.14.71/0006-x86-pci-add-support-for-pci-rev-net.patch
blob: e6c6f4afb3adef476a5d5401d09a16dd20f12e83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
From 2e3c43c0225f4f8e1efab833319c5472800b785c Mon Sep 17 00:00:00 2001
From: Willy Tarreau <w@1wt.eu>
Date: Wed, 2 Feb 2011 12:40:44 +0100
Subject: [PATCH 06/18] x86/pci: add support for pci=rev-net


Scan network devices in the opposite order on each bus if pci=rev-net is found.

Reviewed-by: Bertrand Jacquin <bertrand@jacquin.bzh>
Signed-off-by: Bertrand Jacquin <bertrand@jacquin.bzh>
---
 arch/x86/include/asm/pci_x86.h | 1 +
 arch/x86/pci/common.c          | 5 +++++
 drivers/pci/probe.c            | 7 ++++++-
 3 files changed, 12 insertions(+), 1 deletion(-)


diff --git a/arch/x86/include/asm/pci_x86.h b/arch/x86/include/asm/pci_x86.h
index 7a5d6695abd3..5dbc1fd39e10 100644
--- a/arch/x86/include/asm/pci_x86.h
+++ b/arch/x86/include/asm/pci_x86.h
@@ -38,6 +38,7 @@ do {						\
 #define PCI_NOASSIGN_ROMS	0x80000
 #define PCI_ROOT_NO_CRS		0x100000
 #define PCI_NOASSIGN_BARS	0x200000
+#define PCI_REV_NETWORK		0x400000
 
 extern unsigned int pci_probe;
 extern unsigned long pirq_table_addr;
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index 7a5350d08cef..c25f1e127c0c 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -19,6 +19,8 @@
 #include <asm/pci_x86.h>
 #include <asm/setup.h>

 
+extern int pci_reverse_net;
+
 unsigned int pci_probe = PCI_PROBE_BIOS | PCI_PROBE_CONF1 | PCI_PROBE_CONF2 |
 				PCI_PROBE_MMCONF;

 
@@ -600,6 +602,9 @@ char *__init pcibios_setup(char *str)
 	} else if (!strcmp(str, "routeirq")) {
 		pci_routeirq = 1;
 		return NULL;
+	} else if (!strcmp(str, "rev-net")) {
+		pci_reverse_net = 1;
+		return NULL;
 	} else if (!strcmp(str, "skip_isa_align")) {
 		pci_probe |= PCI_CAN_SKIP_ISA_ALIGN;
 		return NULL;
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index e23bfd9845b1..d361e7020a0d 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -85,6 +85,8 @@ int no_pci_devices(void)
 }
 EXPORT_SYMBOL(no_pci_devices);

 
+int pci_reverse_net;
+
 /*
  * PCI Bus Class
  */
@@ -943,7 +945,10 @@ struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev,
 	child = pci_alloc_child_bus(parent, dev, busnr);
 	if (child) {
 		down_write(&pci_bus_sem);
-		list_add_tail(&child->node, &parent->children);
+		if (pci_reverse_net && (dev->class >> 8) == PCI_CLASS_NETWORK_ETHERNET)
+			list_add(&child->node, &parent->children);
+		else
+			list_add_tail(&child->node, &parent->children);
 		up_write(&pci_bus_sem);
 	}
 	return child;