Index: trunk/src/sh_kern.c
===================================================================
--- trunk/src/sh_kern.c	(revision 221)
+++ trunk/src/sh_kern.c	(revision 223)
@@ -86,4 +86,8 @@
     N_("kernelcheckidt"),
     sh_kern_set_idt
+  },
+  {
+    N_("kernelcheckpci"),
+    sh_kern_set_pci
   },
   {
@@ -120,4 +124,5 @@
 static int     ShKernDelay    = 100; /* milliseconds */
 static int     ShKernIDT      = S_TRUE;
+static int     ShKernPCI      = S_TRUE;
 
 /* The address of system_call
@@ -979,16 +984,25 @@
        */
       fd = open ( pcipath, O_RDWR );
-      do {
-	status = write( fd, "1", 1 );
-      } while (status < 0 && errno == EINTR);
-      close ( fd );
-
-      check_rom(pcipath, name);
-
-      fd = open ( pcipath, O_RDWR );
-      do {
-	status = write( fd, "0", 1 );
-      } while (status < 0 && errno == EINTR);
-      close ( fd );
+      if (fd)
+	{
+	  do {
+	    status = write( fd, "1", 1 );
+	  } while (status < 0 && errno == EINTR);
+	  close ( fd );
+
+	  if (status > 0)
+	    {
+	      check_rom(pcipath, name);
+	      
+	      fd = open ( pcipath, O_RDWR );
+	      if (fd)
+		{
+		  do {
+		    status = write( fd, "0", 1 );
+		  } while (status < 0 && errno == EINTR);
+		  close ( fd );
+		}
+	    }
+	}
     }
   return;
@@ -1001,4 +1015,7 @@
   DIR * df;
   struct dirent * entry;
+
+  if (ShKernPCI != S_TRUE)
+    return;
 
   sl_strlcpy(pci_dir, SYS_BUS_PCI, sizeof(pci_dir));
@@ -1028,4 +1045,5 @@
       closedir(df);
     }
+  return;
 }
 
@@ -1930,4 +1948,12 @@
 }
 
+int sh_kern_set_pci (const char * c)
+{
+  int i;
+  SL_ENTER(_("sh_kern_set_pci"));
+  i = sh_util_flagval(c, &ShKernPCI);
+  SL_RETURN(i, _("sh_kern_set_pci"));
+}
+
 int sh_kern_set_sc_addr (const char * c)
 {
