Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Jul 2010 15:58:56 -0700
From:      Neel Natu <neelnatu@gmail.com>
To:        freebsd-hackers@freebsd.org
Subject:   PATCH: pciconf -a
Message-ID:  <AANLkTi==95KsbD9Nu3EgF24YrKAacXo=1QygG9Vfq3%2BZ@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Hi,

This patch makes "pciconf -a" do the right thing as opposed to always
failing with this message:

pciconf: ioctl(PCIOCATTACHED): Inappropriate ioctl for device

Any objections if I commit this?

best
Neel

Index: sys/dev/pci/pci_user.c
===================================================================
--- sys/dev/pci/pci_user.c	(revision 210396)
+++ sys/dev/pci/pci_user.c	(working copy)
@@ -735,6 +735,16 @@
 			bio->pbi_enabled = (value & PCIM_CMD_PORTEN) != 0;
 		error = 0;
 		break;
+	case PCIOCATTACHED:
+		error = 0;
+		io = (struct pci_io *)data;
+		pcidev = pci_find_dbsf(io->pi_sel.pc_domain, io->pi_sel.pc_bus,
+				       io->pi_sel.pc_dev, io->pi_sel.pc_func);
+		if (pcidev != NULL)
+			io->pi_data = device_is_attached(pcidev);
+		else
+			error = ENODEV;
+		break;
 	default:
 		error = ENOTTY;
 		break;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTi==95KsbD9Nu3EgF24YrKAacXo=1QygG9Vfq3%2BZ>