[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freebsd-hackers
Subject:    PATCH: pciconf -a
From:       Neel Natu <neelnatu () gmail ! com>
Date:       2010-07-23 22:58:56
Message-ID: AANLkTi==95KsbD9Nu3EgF24YrKAacXo=1QygG9Vfq3+Z () mail ! gmail ! com
[Download RAW message or body]

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;
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic