|
|
bf6610 |
From 079afcfb3f9568a031ae6149438d0289e745c42b Mon Sep 17 00:00:00 2001
|
|
|
bf6610 |
From: Dan Callaghan <dcallagh@redhat.com>
|
|
|
bf6610 |
Date: Fri, 10 Jul 2015 16:33:57 +1000
|
|
|
99c779 |
Subject: [PATCH 16/26] use sysfs to find businfo for SCSI adapters (#692)
|
|
|
bf6610 |
|
|
|
bf6610 |
In spite of its name, the SCSI_IOCTL_GET_PCI ioctl will actually return
|
|
|
bf6610 |
the kernel name for the underlying SCSI adapter no matter whether it's
|
|
|
bf6610 |
on the PCI bus or not. For example an IBM VIO SCSI adapter on the vio
|
|
|
bf6610 |
bus might return 30000002 for this ioctl.
|
|
|
bf6610 |
|
|
|
bf6610 |
Since this doesn't look like a PCI bus address, the guessBusInfo()
|
|
|
bf6610 |
function would then make a bad guess, returning businfo as
|
|
|
bf6610 |
parisc@30000002 which is not right.
|
|
|
bf6610 |
|
|
|
bf6610 |
We can figure out the right businfo without guessing by looking in sysfs
|
|
|
bf6610 |
instead.
|
|
|
bf6610 |
---
|
|
|
bf6610 |
src/core/scsi.cc | 12 +++++++-----
|
|
|
bf6610 |
1 file changed, 7 insertions(+), 5 deletions(-)
|
|
|
bf6610 |
|
|
|
bf6610 |
diff --git a/src/core/scsi.cc b/src/core/scsi.cc
|
|
|
bf6610 |
index 4aaec81..229d3a2 100644
|
|
|
bf6610 |
--- a/src/core/scsi.cc
|
|
|
bf6610 |
+++ b/src/core/scsi.cc
|
|
|
99c779 |
@@ -659,9 +659,9 @@ static void scan_sg(hwNode & n)
|
|
|
bf6610 |
int sg;
|
|
|
bf6610 |
int fd = -1;
|
|
|
bf6610 |
My_sg_scsi_id m_id;
|
|
|
bf6610 |
- char slot_name[64]; // should be 16 but some 2.6 kernels require 32 bytes
|
|
|
bf6610 |
string host = "";
|
|
|
bf6610 |
string businfo = "";
|
|
|
bf6610 |
+ string adapter_businfo = "";
|
|
|
bf6610 |
hwNode *parent = NULL;
|
|
|
bf6610 |
int emulated = 0;
|
|
|
bf6610 |
bool ghostdeventry = false;
|
|
|
99c779 |
@@ -696,6 +696,9 @@ static void scan_sg(hwNode & n)
|
|
|
bf6610 |
|
|
|
bf6610 |
host = host_logicalname(m_id.host_no);
|
|
|
bf6610 |
businfo = scsi_businfo(m_id.host_no);
|
|
|
bf6610 |
+ adapter_businfo =
|
|
|
bf6610 |
+ sysfs::entry::byClass("scsi_host", host_kname(m_id.host_no))
|
|
|
bf6610 |
+ .parent().businfo();
|
|
|
bf6610 |
|
|
|
bf6610 |
hwNode device = hwNode("generic");
|
|
|
bf6610 |
|
|
|
99c779 |
@@ -752,10 +755,9 @@ static void scan_sg(hwNode & n)
|
|
|
bf6610 |
if ((m_id.scsi_type == 0) || (m_id.scsi_type == 7) || (m_id.scsi_type == 14))
|
|
|
bf6610 |
scan_disk(device);
|
|
|
bf6610 |
|
|
|
bf6610 |
- memset(slot_name, 0, sizeof(slot_name));
|
|
|
bf6610 |
- if (ioctl(fd, SCSI_IOCTL_GET_PCI, slot_name) >= 0)
|
|
|
bf6610 |
+ if (!adapter_businfo.empty())
|
|
|
bf6610 |
{
|
|
|
bf6610 |
- parent = n.findChildByBusInfo(guessBusInfo(hw::strip(slot_name)));
|
|
|
bf6610 |
+ parent = n.findChildByBusInfo(adapter_businfo);
|
|
|
bf6610 |
}
|
|
|
bf6610 |
|
|
|
bf6610 |
if (!parent)
|
|
|
99c779 |
@@ -785,7 +787,7 @@ static void scan_sg(hwNode & n)
|
|
|
bf6610 |
{
|
|
|
bf6610 |
|
|
|
bf6610 |
if(parent->getBusInfo() == "")
|
|
|
bf6610 |
- parent->setBusInfo(guessBusInfo(hw::strip(slot_name)));
|
|
|
bf6610 |
+ parent->setBusInfo(adapter_businfo);
|
|
|
bf6610 |
parent->setLogicalName(host);
|
|
|
bf6610 |
parent->claim();
|
|
|
bf6610 |
|
|
|
bf6610 |
--
|
|
|
99c779 |
2.10.2
|
|
|
bf6610 |
|