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

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