Skip to contentSkip to conversation

r2074 broke ata module

PATCH Ward Vandewege 2 participants 4 messages Apr 15, 2009 – Apr 17, 2009

lore
Share & tools
lore
#0 lore raw

Hi there,

I tried to use the ata module today in combination with grub2's coreboot code, but found that it broke in r2074, specifically by this hunk:

------------------------------------------------------------------------

grub/pci.h +2 -2
@@ -36,8 +36,8 @@
 #define  GRUB_PCI_ADDR_IO_MASK		~0x03
 
 typedef grub_uint32_t grub_pci_id_t;
-typedef int (*grub_pci_iteratefunc_t) (int bus, int device, int func,
-				       grub_pci_id_t pciid);
+typedef int NESTED_FUNC_ATTR (*grub_pci_iteratefunc_t)
+     (int bus, int device, int func, grub_pci_id_t pciid);
 typedef grub_uint32_t grub_pci_address_t;
 
 grub_pci_address_t EXPORT_FUNC(grub_pci_make_address) (int bus, int device,

------------------------------------------------------------------------

Reverting that hunk fixes ata for me. The symptom of a broken ata module is that it does not see any ATA disks.

I'm testing on qemu, and start qemu like this:

qemu -m 1024 -serial stdio -L qemu-cbv2-grub2/ -hda path-to-image

Up to r2073, that image shows up as ata0, from r2074 it's simply not detected.

Thoughts?

Thanks,
Ward.

#1 lore raw
Quoted 4 lines · Ward Vandewege

Hi there,

I tried to use the ata module today in combination with grub2's coreboot code, but found that it broke in r2074, specifically by this hunk:

Actually, I was looking at the warnings, and it looks like the warnings about grub_pci_iterate() are directly related to this problem.

This patch should help.

ata.c +1 -1
Index: disk/ata.c
===================================================================
@@ -375,7 +375,7 @@
   return 0;
 }
 
-static int
+static int NESTED_FUNC_ATTR
 grub_ata_pciinit (int bus, int device, int func,
 		  grub_pci_id_t pciid __attribute__((unused)))
 {
usb/ohci.c +3 -2
Index: bus/usb/ohci.c
===================================================================
@@ -112,8 +112,9 @@
 
 /* Iterate over all PCI devices.  Determine if a device is an OHCI
    controller.  If this is the case, initialize it.  */
-static int grub_ohci_pci_iter (int bus, int device, int func,
-			       grub_pci_id_t pciid __attribute__((unused)))
+static int NESTED_FUNC_ATTR
+grub_ohci_pci_iter (int bus, int device, int func,
+		    grub_pci_id_t pciid __attribute__((unused)))
 {
   grub_uint32_t class;
   grub_uint32_t subclass;
usb/uhci.c +3 -2
Index: bus/usb/uhci.c
===================================================================
@@ -137,8 +137,9 @@
 
 /* Iterate over all PCI devices.  Determine if a device is an UHCI
    controller.  If this is the case, initialize it.  */
-static int grub_uhci_pci_iter (int bus, int device, int func,
-			       grub_pci_id_t pciid __attribute__((unused)))
+static int NESTED_FUNC_ATTR
+grub_uhci_pci_iter (int bus, int device, int func,
+		    grub_pci_id_t pciid __attribute__((unused)))
 {
   grub_uint32_t class;
   grub_uint32_t subclass;
lspci.c +1 -1
Index: commands/lspci.c
===================================================================
@@ -114,7 +114,7 @@
   return 0;
 }
 
-static int
+static int NESTED_FUNC_ATTR
 grub_lspci_iter (int bus, int dev, int func, grub_pci_id_t pciid)
 {
   grub_uint32_t class;
Signature · 2 lines
Regards,
Pavel Roskin
#2 lore raw
Quoted 10 lines · Pavel Roskin
Quoted 4 lines · Ward Vandewege

Hi there,

I tried to use the ata module today in combination with grub2's coreboot code, but found that it broke in r2074, specifically by this hunk:

Actually, I was looking at the warnings, and it looks like the warnings about grub_pci_iterate() are directly related to this problem.

This patch should help.

Confirmed, this fixes ata for me.

Thanks!
Ward.

#3 lore raw
Quoted 7 lines · Ward Vandewege
Quoted 6 lines · Pavel Roskin
Quoted 4 lines · Ward Vandewege

Hi there,

I tried to use the ata module today in combination with grub2's coreboot code, but found that it broke in r2074, specifically by this hunk:

Quoted 6 lines
Quoted 4 lines

Actually, I was looking at the warnings, and it looks like the warnings about grub_pci_iterate() are directly related to this problem.

This patch should help.

Confirmed, this fixes ata for me.

Committed.

Signature · 2 lines
Regards,
Pavel Roskin