Index: configure
===================================================================
RCS file: /sources/grub/grub/configure,v
retrieving revision 1.114
diff -u -r1.114 configure
--- configure	8 May 2005 02:51:51 -0000	1.114
+++ configure	4 Feb 2006 16:25:53 -0000
@@ -5883,7 +5883,7 @@
 
 
 
-if test "x$NET_CFLAGS" != x; then
+if true; then
   NETBOOT_SUPPORT_TRUE=
   NETBOOT_SUPPORT_FALSE='#'
 else
Index: configure.ac
===================================================================
RCS file: /sources/grub/grub/configure.ac,v
retrieving revision 1.9
diff -u -r1.9 configure.ac
--- configure.ac	8 May 2005 02:51:51 -0000	1.9
+++ configure.ac	4 Feb 2006 16:25:54 -0000
@@ -545,7 +545,8 @@
 fi
 
 dnl Check if the netboot support is turned on.
-AM_CONDITIONAL(NETBOOT_SUPPORT, test "x$NET_CFLAGS" != x)
+dnl AM_CONDITIONAL(NETBOOT_SUPPORT, test "x$NET_CFLAGS" != x)
+AM_CONDITIONAL(NETBOOT_SUPPORT, true)
 if test "x$NET_CFLAGS" != x; then
   FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_TFTP=1"
 fi
Index: netboot/pci.c
===================================================================
RCS file: /sources/grub/grub/netboot/pci.c,v
retrieving revision 1.6
diff -u -r1.6 pci.c
--- netboot/pci.c	2 Jan 2002 21:56:40 -0000	1.6
+++ netboot/pci.c	4 Feb 2006 16:25:58 -0000
@@ -33,6 +33,8 @@
 
 #define CONFIG_CMD(bus, device_fn, where)   (0x80000000 | (bus << 16) | (device_fn << 8) | (where & ~3))
 
+void pcibios_init(void) { };
+
 int pcibios_read_config_byte(unsigned int bus, unsigned int device_fn,
 			       unsigned int where, unsigned char *value)
 {
@@ -342,7 +344,7 @@
 	}
 }
 
-static void pcibios_init(void)
+void pcibios_init(void)
 {
 	union bios32 *check;
 	unsigned char sum;
Index: stage2/builtins.c
===================================================================
RCS file: /sources/grub/grub/stage2/builtins.c,v
retrieving revision 1.151
diff -u -r1.151 builtins.c
--- stage2/builtins.c	15 Feb 2005 22:05:07 -0000	1.151
+++ stage2/builtins.c	4 Feb 2006 16:26:09 -0000
@@ -4790,7 +4790,81 @@
   "Probe VBE information. If the mode number MODE is specified, show only"
   " the information about only the mode."
 };
-  
+
+
+#ifndef GRUB_UTIL
+/* PCI config register patching support */
+int pcibios_read_config_byte(unsigned int bus, unsigned int device_fn,
+			     unsigned int where, unsigned char *value);
+int pcibios_write_config_byte(unsigned int bus, unsigned int device_fn,
+			      unsigned int where, unsigned char value);
+void pcibios_init(void);
+
+static int
+pcireadconf_func (char *arg, int flags)
+{
+  unsigned int bus, func, reg, r;
+  unsigned char value;
+
+  if (! safe_parse_maxint (&arg, &bus))
+    return 1;
+
+  arg = skip_to (0, arg);
+  if (! safe_parse_maxint (&arg, &func))
+    return 1;
+
+  arg = skip_to (0, arg);
+  if (! safe_parse_maxint (&arg, &reg))
+    return 1;
+  pcibios_init();
+  r = pcibios_read_config_byte(bus,func,reg,&value);
+  grub_printf("pcireadconf return code: %d, value: 0x%x = %d\n", r, value, value);
+  return 0;
+}
+
+static struct builtin builtin_pcireadconf =
+{
+  "pcireadconf",
+  pcireadconf_func,
+  BUILTIN_CMDLINE | BUILTIN_HELP_LIST,
+  "pcireadconf BUS DEV REG",
+  "Read register from PCI config space. BUS is usually 0. "
+  "The lower 3 bits of DEV are the number of the function unit of a device. While the bits 3-7 are used for the device number"
+};
+
+static int
+pciwriteconf_func (char *arg, int flags)
+{
+  unsigned int bus, func, reg, value, r;
+  if (! safe_parse_maxint (&arg, &bus))
+    return 1;
+
+  arg = skip_to (0, arg);
+  if (! safe_parse_maxint (&arg, &func))
+    return 1;
+
+  arg = skip_to (0, arg);
+  if (! safe_parse_maxint (&arg, &reg))
+    return 1;
+  arg = skip_to (0, arg);
+  if (! safe_parse_maxint (&arg, &value))
+    return 1;
+  grub_printf("pciwriteconf: writing %x to %x %x %x\n", (unsigned char)value, bus, func, reg);
+  pcibios_init();
+  r = pcibios_write_config_byte(bus,func,reg,(unsigned char)value);
+  grub_printf("pciwriteconf: return code %d\n", r);
+  return 0;
+}
+
+static struct builtin builtin_pciwriteconf =
+{
+  "pciwriteconf",
+  pciwriteconf_func,
+  BUILTIN_CMDLINE | BUILTIN_HELP_LIST,
+  "pciwriteconf BUS FUNCTION REG VALUE",
+  "Write VALUE to REG in PCI config space"
+};
+#endif
 
 /* The table of builtin commands. Sorted in dictionary order.  */
 struct builtin *builtin_table[] =
@@ -4848,6 +4922,10 @@
   &builtin_parttype,
   &builtin_password,
   &builtin_pause,
+#ifndef GRUB_UTIL
+  &builtin_pcireadconf,
+  &builtin_pciwriteconf,
+#endif
 #ifdef GRUB_UTIL
   &builtin_quit,
 #endif /* GRUB_UTIL */
Index: stage2/cmdline.c
===================================================================
RCS file: /sources/grub/grub/stage2/cmdline.c,v
retrieving revision 1.30
diff -u -r1.30 cmdline.c
--- stage2/cmdline.c	16 Aug 2004 23:25:44 -0000	1.30
+++ stage2/cmdline.c	4 Feb 2006 16:26:09 -0000
@@ -84,8 +84,6 @@
 	  *ptr = c;
 	  return *builtin;
 	}
-      else if (ret < 0)
-	break;
     }
 
   /* Cannot find COMMAND.  */
