Re: lspci tries to open non-existent files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jun 30, 2009 at 02:39:48PM +0200, Martin Mares wrote:
> Hi!
> 
> > Change the warning to an error; there's no point in proceeding.
> 
> Well, I have used it when debugging the bus mapper several times, so I would
> prefer keeping it as a warning. The addition of PCI_ACCESS_SYS_BUS_PCI is
> of course correct.

Fair enough.  How about this patch instead which adds a -MM option to
permit the debugging use?  I also reworded the help text for -M.


diff --git a/ls-map.c b/ls-map.c
index c812f50..e3cc041 100644
--- a/ls-map.c
+++ b/ls-map.c
@@ -161,11 +161,15 @@ map_bridges(void)
 }
 
 void
-map_the_bus(void)
+map_the_bus(int map_mode)
 {
   if (pacc->method == PCI_ACCESS_PROC_BUS_PCI ||
+      pacc->method == PCI_ACCESS_SYS_BUS_PCI ||
       pacc->method == PCI_ACCESS_DUMP)
-    printf("WARNING: Bus mapping can be reliable only with direct hardware access enabled.\n\n");
+  if (map_mode > 1)
+    pacc->warning("Bus mapping only works properly with direct hardware access");
+  else
+    pacc->error("Bus mapping only works with direct hardware access");
   bus_info = xmalloc(sizeof(struct bus_info) * 256);
   memset(bus_info, 0, sizeof(struct bus_info) * 256);
   if (filter.bus >= 0)
diff --git a/lspci.c b/lspci.c
index e453f1b..7033ef4 100644
--- a/lspci.c
+++ b/lspci.c
@@ -1005,7 +1005,7 @@ main(int argc, char **argv)
 
   pci_init(pacc);
   if (opt_map_mode)
-    map_the_bus();
+    map_the_bus(opt_map_mode);
   else
     {
       scan_devices();
diff --git a/lspci.h b/lspci.h
index c498b7c..844a800 100644
--- a/lspci.h
+++ b/lspci.h
@@ -77,4 +77,4 @@ void show_forest(void);
 
 /* ls-map.c */
 
-void map_the_bus(void);
+void map_the_bus(int map_mode);
diff --git a/lspci.man b/lspci.man
index 441bc2b..4099940 100644
--- a/lspci.man
+++ b/lspci.man
@@ -157,11 +157,14 @@ as the map of PCI ID's handled by kernel modules. By default, lspci uses
 Applies only to Linux systems with recent enough module tools.
 .TP
 .B -M
-Invoke bus mapping mode which performs a thorough scan of all PCI devices, including
-those behind misconfigured bridges etc. This option is available only to root and it
-gives meaningful results only if combined with direct hardware access mode (otherwise
-the results are identical to normal listing modes, modulo bugs in lspci). Please note
-that the bus mapper doesn't support PCI domains and scans only domain 0.
+Invoke bus mapping mode which performs a thorough scan of all PCI devices,
+including those behind misconfigured bridges, etc.  This option only works
+with a direct hardware access mode, which usually requires root privileges.
+Please note that the bus mapper only scans PCI domain 0.
+.TP
+.B -MM
+Forces bus mapping mode to try even without a direct hardware access mode.
+The results may not be very useful.
 .TP
 .B --version
 Shows

-- 
Matthew Wilcox				Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux