Subject: pkg/8031: kde::kcminfo should print PCI & IO ports info
To: None <gnats-bugs@gnats.netbsd.org>
From: Jaromir Dolecek <dolecek@ics.muni.cz>
List: netbsd-bugs
Date: 07/19/1999 07:50:59
>Number:         8031
>Category:       pkg
>Synopsis:       kde::kcminfo should print PCI & IO ports info
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager (NetBSD software packages system bug manager)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Jul 19 07:50:01 1999
>Last-Modified:
>Originator:     Jaromir Dolecek
>Organization:
	ICS MU, Brno, Czech Republic
>Release:        NetBSD-1.4G
>Environment:
	
System: NetBSD jdolecek.per4mance.cz 1.4G NetBSD 1.4G (JDOLECEK) #7: Mon Jul 19 14:57:19 MEST 1999 dolecek@jdolecek.per4mance.cz:/usr/src/sys/arch/i386/compile/JDOLECEK i386


>Description:
	Hubert Feyrer suggested to print the PCI & IO port info
	as well. The easy way how to do it is pretty easy, so
	I've implemented it.
>How-To-Repeat:
	obvious
>Fix:
	The I/O ports allocation should be sorted and printed
	in some prittier way. I'm not the one who will do
	it right now :)

	The way it's done right now is pretty crude, basically it's
		ports   -> grep "port 0x" /var/run/dmesg.boot
		pci     -> grep "at pci" /var/run/dmesg.boot
	I hope this won't generate some false matches.
	
	The patch also cleans up comment about who did the original
	work and properly includes <stdio.h> & <stdlib.h>
	for NULL & malloc(3) definition instead of defining it itself.

--- files/info_netbsd.cpp.orig	Mon Jul 19 14:56:34 1999
+++ files/info_netbsd.cpp	Mon Jul 19 16:04:01 1999
@@ -4,15 +4,16 @@
  * info_netbsd.cpp is part of the KDE program kcminfo.  This displays
  * various information about the NetBSD system it's running on.
  *
+ * This code is derived from code written by
+ *	Jaromir Dolecek <dolecek@ics.muni.cz>
+ *
  * CPU info code has been imported from abs's processor.cpp implementation
  * for KDE 1.0 with only minor formatting changes
- * SCSI, IRQ, Devices, Audio and Partition Info was implemented by
- * Jaromir Dolecek <dolecek@ics.muni.cz>
  */
 
 #define INFO_CPU_AVAILABLE
 #define INFO_IRQ_AVAILABLE
-#define INFO_DMA_AVAILABLE
+/* #define INFO_DMA_AVAILABLE */ /* not really available */
 #define INFO_PCI_AVAILABLE
 #define INFO_IOPORTS_AVAILABLE
 #define INFO_SOUND_AVAILABLE
@@ -31,19 +32,12 @@
 #include <sys/types.h>
 #include <sys/param.h>
 #include <sys/sysctl.h>
+#include <stdio.h>	/* for NULL */
+#include <stdlib.h>	/* for malloc(3) */
 
 #include <qfile.h>
 #include <qfontmetrics.h>
 
-/* stdio.h has NULL, but also a lot of extra cruft */
-#ifndef NULL
-#define NULL 0L
-#endif
-
-/* Again avoid the cruft in stdlib.h since malloc() isn't gonna change 
-   too often, unless someone decides to de-KNR FreeBSD */
-void    *malloc __P((size_t));
-
 typedef struct
   {
   int	string;
@@ -210,14 +204,18 @@ bool GetInfo_DMA (KTabListBox *)
   return FALSE;
 }
 
-bool GetInfo_PCI (KTabListBox *)
+bool GetInfo_PCI (KTabListBox *lbox)
 {
-  return FALSE;
+	if (!GetDmesgInfo(lbox, "at pci", NULL))
+		lbox->insertItem(i18n("No PCI devices found."));
+	return true;
 }
 
-bool GetInfo_IO_Ports (KTabListBox *)
+bool GetInfo_IO_Ports (KTabListBox *lbox)
 {
-  return FALSE;
+	if (!GetDmesgInfo(lbox, "port 0x", NULL))
+		lbox->insertItem(i18n("No device using I/O ports found."));
+	return true;
 }
 
 bool GetInfo_Sound (KTabListBox *lbox)
>Audit-Trail:
>Unformatted: