PATCH: pciconf -a

Neel Natu neelnatu at gmail.com
Fri Jul 23 23:30:28 UTC 2010


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;


More information about the freebsd-hackers mailing list