Currently we list PCI devices in every PCI capable architecture individually.
This is cumbersome when adding new devices and prone to failure because one
might miss out on one.

So let's instead have a generic PCI configuration file where people can throw
in their cross-platform compatible PCI devices and thus make it available to
ever architecture that supports PCI too.

Signed-off-by: Alexander Graf <ag...@suse.de>
---
 Makefile                             |   13 ++++++++++---
 create_config_mak                    |   19 +++++++++++++++++++
 default-configs/i386-softmmu.mak     |    2 ++
 default-configs/mips-softmmu.mak     |    2 ++
 default-configs/mips64-softmmu.mak   |    2 ++
 default-configs/mips64el-softmmu.mak |    2 ++
 default-configs/mipsel-softmmu.mak   |    2 ++
 default-configs/pci-devices.mak      |    2 ++
 default-configs/ppc-softmmu.mak      |    2 ++
 default-configs/ppc64-softmmu.mak    |    2 ++
 default-configs/ppcemb-softmmu.mak   |    2 ++
 default-configs/sparc64-softmmu.mak  |    2 ++
 default-configs/x86_64-softmmu.mak   |    2 ++
 13 files changed, 51 insertions(+), 3 deletions(-)
 create mode 100755 create_config_mak
 create mode 100644 default-configs/pci-devices.mak

diff --git a/Makefile b/Makefile
index 4e120a2..a4fa965 100644
--- a/Makefile
+++ b/Makefile
@@ -39,9 +39,16 @@ endif
 
 SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory)
 SUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(TARGET_DIRS))
+PCI_DEVICES_MAK=$(patsubst %, %/pci-devices.mak, $(TARGET_DIRS))
 
-config-all-devices.mak: $(SUBDIR_DEVICES_MAK)
-       $(call quiet-command,cat $(SUBDIR_DEVICES_MAK) | grep =y | sort -u > 
$@,"  GEN   $@")
+config-all-devices.mak: $(SUBDIR_DEVICES_MAK) $(PCI_DEVICES_MAK)
+       $(call quiet-command,sh $(SRC_PATH)/create_config_mak 
$(SUBDIR_DEVICES_MAK) | sort -u > $@,"  GEN   $@")
+
+%-softmmu/pci-devices.mak: default-configs/pci-devices.mak
+       $(call quiet-command,cat $< > $@, "  GEN   $@")
+
+%-user/pci-devices.mak:
+       $(call quiet-command,echo > $@, "  GEN   $@")
 
 %/config-devices.mak: default-configs/%.mak
        $(call quiet-command,cat $< > $...@.tmp, "  GEN   $@")
@@ -66,7 +73,7 @@ config-all-devices.mak: $(SUBDIR_DEVICES_MAK)
         fi
 
 defconfig:
-       rm -f config-all-devices.mak $(SUBDIR_DEVICES_MAK)
+       rm -f config-all-devices.mak $(SUBDIR_DEVICES_MAK) $(PCI_DEVICES_MAK)
 
 -include config-all-devices.mak
 
diff --git a/create_config_mak b/create_config_mak
new file mode 100755
index 0000000..3dddb95
--- /dev/null
+++ b/create_config_mak
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+echo "# Automatically generated by create_config_mak - do not modify"
+
+for CONF in "$@"; do
+  DIR=$(dirname "$CONF")
+  cat "$CONF" | while read line; do
+    case $line in
+      include*)
+        $0 $DIR/${line#* }
+        ;;
+      CONFIG_*=y)
+        name=${line%=*}
+        echo "$line"
+        ;;
+    esac
+  done
+done
+
diff --git a/default-configs/i386-softmmu.mak b/default-configs/i386-softmmu.mak
index ed00471..14d156e 100644
--- a/default-configs/i386-softmmu.mak
+++ b/default-configs/i386-softmmu.mak
@@ -23,3 +23,5 @@ CONFIG_NE2000_ISA=y
 CONFIG_PIIX_PCI=y
 CONFIG_SOUND=y
 CONFIG_VIRTIO_PCI=y
+
+include pci-devices.mak
diff --git a/default-configs/mips-softmmu.mak b/default-configs/mips-softmmu.mak
index 3d0af83..41303c9 100644
--- a/default-configs/mips-softmmu.mak
+++ b/default-configs/mips-softmmu.mak
@@ -30,3 +30,5 @@ CONFIG_DP8393X=y
 CONFIG_DS1225Y=y
 CONFIG_MIPSNET=y
 CONFIG_PFLASH_CFI01=y
+
+include pci-devices.mak
diff --git a/default-configs/mips64-softmmu.mak 
b/default-configs/mips64-softmmu.mak
index 0030de4..5920d28 100644
--- a/default-configs/mips64-softmmu.mak
+++ b/default-configs/mips64-softmmu.mak
@@ -30,3 +30,5 @@ CONFIG_DP8393X=y
 CONFIG_DS1225Y=y
 CONFIG_MIPSNET=y
 CONFIG_PFLASH_CFI01=y
+
+include pci-devices.mak
diff --git a/default-configs/mips64el-softmmu.mak 
b/default-configs/mips64el-softmmu.mak
index fa2a3ff..9724b33 100644
--- a/default-configs/mips64el-softmmu.mak
+++ b/default-configs/mips64el-softmmu.mak
@@ -32,3 +32,5 @@ CONFIG_DS1225Y=y
 CONFIG_MIPSNET=y
 CONFIG_PFLASH_CFI01=y
 CONFIG_FULONG=y
+
+include pci-devices.mak
diff --git a/default-configs/mipsel-softmmu.mak 
b/default-configs/mipsel-softmmu.mak
index 238b73a..8587baf 100644
--- a/default-configs/mipsel-softmmu.mak
+++ b/default-configs/mipsel-softmmu.mak
@@ -30,3 +30,5 @@ CONFIG_DP8393X=y
 CONFIG_DS1225Y=y
 CONFIG_MIPSNET=y
 CONFIG_PFLASH_CFI01=y
+
+include pci-devices.mak
diff --git a/default-configs/pci-devices.mak b/default-configs/pci-devices.mak
new file mode 100644
index 0000000..b3a55bf
--- /dev/null
+++ b/default-configs/pci-devices.mak
@@ -0,0 +1,2 @@
+# Default configuration options for PCI capable machines
+
diff --git a/default-configs/ppc-softmmu.mak b/default-configs/ppc-softmmu.mak
index 940f4bf..732db30 100644
--- a/default-configs/ppc-softmmu.mak
+++ b/default-configs/ppc-softmmu.mak
@@ -35,3 +35,5 @@ CONFIG_VIRTIO_PCI=y
 CONFIG_PFLASH_CFI01=y
 CONFIG_PFLASH_CFI02=y
 CONFIG_PTIMER=y
+
+include pci-devices.mak
diff --git a/default-configs/ppc64-softmmu.mak 
b/default-configs/ppc64-softmmu.mak
index e1bc6b8..b98bf88 100644
--- a/default-configs/ppc64-softmmu.mak
+++ b/default-configs/ppc64-softmmu.mak
@@ -35,3 +35,5 @@ CONFIG_VIRTIO_PCI=y
 CONFIG_PFLASH_CFI01=y
 CONFIG_PFLASH_CFI02=y
 CONFIG_PTIMER=y
+
+include pci-devices.mak
diff --git a/default-configs/ppcemb-softmmu.mak 
b/default-configs/ppcemb-softmmu.mak
index 8f1cc09..02e1fec 100644
--- a/default-configs/ppcemb-softmmu.mak
+++ b/default-configs/ppcemb-softmmu.mak
@@ -35,3 +35,5 @@ CONFIG_VIRTIO_PCI=y
 CONFIG_PFLASH_CFI01=y
 CONFIG_PFLASH_CFI02=y
 CONFIG_PTIMER=y
+
+include pci-devices.mak
diff --git a/default-configs/sparc64-softmmu.mak 
b/default-configs/sparc64-softmmu.mak
index 1cc3f13..810d1c5 100644
--- a/default-configs/sparc64-softmmu.mak
+++ b/default-configs/sparc64-softmmu.mak
@@ -14,3 +14,5 @@ CONFIG_IDE_PCI=y
 CONFIG_IDE_ISA=y
 CONFIG_IDE_CMD646=y
 CONFIG_VIRTIO_PCI=y
+
+include pci-devices.mak
diff --git a/default-configs/x86_64-softmmu.mak 
b/default-configs/x86_64-softmmu.mak
index 5183203..d2be175 100644
--- a/default-configs/x86_64-softmmu.mak
+++ b/default-configs/x86_64-softmmu.mak
@@ -23,3 +23,5 @@ CONFIG_NE2000_ISA=y
 CONFIG_PIIX_PCI=y
 CONFIG_SOUND=y
 CONFIG_VIRTIO_PCI=y
+
+include pci-devices.mak
-- 
1.6.0.2


Reply via email to