Blame SOURCES/0005-Avoid-very-long-IDE-programming-interface-names-as-c.patch

df7b7f
From 54d6169eeaf46b220ca9a30f82cce282a304a456 Mon Sep 17 00:00:00 2001
df7b7f
From: Dan Callaghan <dcallagh@redhat.com>
df7b7f
Date: Mon, 9 Jul 2018 17:46:39 +1000
df7b7f
Subject: [PATCH 05/10] Avoid very long IDE programming interface names as
df7b7f
 capabilities
df7b7f
df7b7f
Recent versions of the PCIID database added programming interface names
df7b7f
for IDE controllers, like this:
df7b7f
df7b7f
	01  IDE interface
df7b7f
		00  ISA Compatibility mode-only controller
df7b7f
		05  PCI native mode-only controller
df7b7f
		0a  ISA Compatibility mode controller, supports both channels switched to PCI native mode
df7b7f
		0f  PCI native mode controller, supports both channels switched to ISA compatibility mode
df7b7f
		80  ISA Compatibility mode-only controller, supports bus mastering
df7b7f
		85  PCI native mode-only controller, supports bus mastering
df7b7f
		8a  ISA Compatibility mode controller, supports both channels switched to PCI native mode, supports bus mastering
df7b7f
		8f  PCI native mode controller, supports both channels switched to ISA compatibility mode, supports bus mastering
df7b7f
df7b7f
resulting in an awkwardly named capability for the IDE controller:
df7b7f
df7b7f
    <capabilities>
df7b7f
     <capability id="ide" />
df7b7f
     <capability id="pci_native_mode_controller__supports_both_channels_switched_to_isa_compatibility_mode__supports_bus_mastering" />
df7b7f
     <capability id="bus_master" >bus mastering</capability>
df7b7f
    </capabilities>
df7b7f
df7b7f
This patch adds a special case for IDE controllers to avoid using the
df7b7f
programming interface name as a capability. Instead, separate
df7b7f
capabilities are added for the possible combinations:
df7b7f
df7b7f
    <capabilities>
df7b7f
     <capability id="ide" />
df7b7f
     <capability id="isa_compat_mode" >ISA compatibility mode</capability>
df7b7f
     <capability id="pci_native_mode" >PCI native mode</capability>
df7b7f
     <capability id="bus_master" >bus mastering</capability>
df7b7f
    </capabilities>
df7b7f
df7b7f
---
df7b7f
 src/core/pci.cc | 16 +++++++++++++++-
df7b7f
 1 file changed, 15 insertions(+), 1 deletion(-)
df7b7f
df7b7f
diff --git a/src/core/pci.cc b/src/core/pci.cc
df7b7f
index 30359cc..8d60b2a 100644
df7b7f
--- a/src/core/pci.cc
df7b7f
+++ b/src/core/pci.cc
df7b7f
@@ -965,7 +965,21 @@ static hwNode *scan_pci_dev(struct pci_dev &d, hwNode & n)
df7b7f
           }
df7b7f
           device->setDescription(get_class_description(dclass));
df7b7f
 
df7b7f
-          if (moredescription != ""
df7b7f
+          if (dclass == PCI_CLASS_STORAGE_IDE)
df7b7f
+          {
df7b7f
+            // IDE programming interface names are really long and awkward,
df7b7f
+            // so don't add them as capabilities
df7b7f
+            if (progif == 0x00 || progif == 0x80)
df7b7f
+              device->addCapability("isa_compat_mode", "ISA compatibility mode");
df7b7f
+            else if (progif == 0x05 || progif == 0x85)
df7b7f
+              device->addCapability("pci_native_mode", "PCI native mode");
df7b7f
+            else if (progif == 0x0a || progif == 0x0f || progif == 0x8a || progif == 0x8f)
df7b7f
+            {
df7b7f
+              device->addCapability("isa_compat_mode", "ISA compatibility mode");
df7b7f
+              device->addCapability("pci_native_mode", "PCI native mode");
df7b7f
+            }
df7b7f
+          }
df7b7f
+          else if (moredescription != ""
df7b7f
             && moredescription != device->getDescription())
df7b7f
           {
df7b7f
             device->addCapability(moredescription);
df7b7f
-- 
df7b7f
2.17.1
df7b7f