Bug#594967: Bug #594967: [poulsbo] grub-pc Hangs After "Welcome to GRUB!"

Colin Watson cjwatson at debian.org
Mon Jan 3 00:13:01 UTC 2011


On Sun, Jan 02, 2011 at 10:41:50PM +0000, Steve McIntyre wrote:
> 1.iso:
> 
>   last bus number printed is b0
> 
> 2.iso:
> 
>   goes all the way through to bus ff and returns to a grub prompt

This is interesting and suggests a measure of coincidence.  What that
patch did was skip remaining functions on a device that doesn't
implement function 0, taking that as an indication that it doesn't
exist.  This was based on:

  http://en.wikipedia.org/wiki/PCI_configuration_space#Bus_enumeration

Vladimir, are you OK with this change to trunk?

2011-01-02  Colin Watson  <cjwatson at ubuntu.com>

	* grub-core/bus/pci.c (grub_pci_iterate): Skip remaining functions
	on devices that do not implement function 0.

=== modified file 'grub-core/bus/pci.c'
--- grub-core/bus/pci.c	2010-06-30 00:30:05 +0000
+++ grub-core/bus/pci.c	2011-01-02 17:31:32 +0000
@@ -90,7 +90,14 @@ grub_pci_iterate (grub_pci_iteratefunc_t
 
 	      /* Check if there is a device present.  */
 	      if (id >> 16 == 0xFFFF)
-		continue;
+		{
+		  if (dev.function == 0)
+		    /* Devices are required to implement function 0, so if
+		       it's missing then there is no device here.  */
+		    break;
+		  else
+		    continue;
+		}
 
 #ifdef GRUB_MACHINE_MIPS_YEELOONG
 	      /* Skip ghosts.  */

Nevertheless, I'm not confident that this will fix the problem on all
machines, so I would like to sort out the bridge handling as well.

> 3.iso: 
> 
>   grub> set debug=pci
>   grub> lspci
>   bus/pci.c:92: bus 0
>   00:00.0 8086:8100 [0600] Host Bridge
>   00:02.0 8086:8108 [0300] VGA Controller
>   00:1b.0 8086:811b [0403] Multimedia device
>   00:1c.0 8086:8110 [0604] PCI-PCI Bridge
>   00:1c.1 8086:8112 [0604] PCI-PCI Bridge
>   00:1d.0 8086:8114 [0c03] USB Controller
>   00:1d.1 8086:8115 [0c03] USB Controller
>   00:1d.2 8086:8116 [0c03] USB Controller
>   00:1d.7 8086:8117 [0c03] USB Controller [PI 20]
>   00:1f.0 8086:8119 [0601] ISA Bridge
>   00:1f.1 8086:811a [0101] IDE Controller [PI 80]
>   grub>

Whoops, I forgot to right-shift the header word.  Can you try 4.iso
instead, at the same location?  I also made it handle PCI-to-CardBus
bridges the same way as PCI-to-PCI bridges since that's what pciutils
does.

(In addition to 'set debug=pci', I'd recommend also doing 'set pager=1'
so that lspci's output will be paged.)

Thanks,

-- 
Colin Watson                                       [cjwatson at debian.org]





More information about the Pkg-grub-devel mailing list