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

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