NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
kern/49181: i386 Kernel compilation error (warning -> error) if no PCIBIOSVERBOSE
>Number: 49181
>Category: kern
>Synopsis: i386 Kernel compilation error (warning -> error) if no
>PCIBIOSVERBOSE
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Sep 07 23:35:00 +0000 2014
>Originator: Robert Elz
>Release: NetBSD 7_BETA (i386)
>Organization:
Prince of Songkla University
>Environment:
System: NetBSD munnari.OZ.AU 6.99.30 NetBSD 6.99.30 (MUNNARI-DomU) #0: Mon Feb
3 19:19:20 ICT 2014
kre%onyx.coe.psu.ac.th@localhost:/usr/obj/current/kernels/amd64/MUNNARI-DomU
amd64
Architecture: x86_64
Machine: amd64
>Description:
If PCIBIOSVERBOSE is not set in the kernel config, then ...
/release/7/src/sys/arch/i386/pci/pci_intr_fixup.c: In function 'pciintr_do_heade
r_fixup':
/release/7/src/sys/arch/i386/pci/pci_intr_fixup.c:669:17: error: variable 'id' s
et but not used [-Werror=unused-but-set-variable]
pcireg_t intr, id;
^
cc1: all warnings being treated as errors
That's because "id" is used only inside a section of code
that is $ifdef PCIBIOSVERBOSE (though it is set unconditionally)>
>How-To-Repeat:
Attempt to build a NetBSD 7_BETA kernel with a kernel config file
that disables PCIBIOSVERBOSE (the same happens on current,
I might have reported that one before, but if so, it was obviously
not fixed -- if I didn't report it, apologies).
>Fix:
For my NetBSD 7 kernel sources, I just added this ludicrous piece of
code (a stupid solution to a truly stupid problem -- who really cares
if a variable is set but not used... at least if we know why that's
being done and it isn't just an accident)
Index: pci_intr_fixup.c
===================================================================
RCS file: /cvsroot/NetBSD/src/sys/arch/i386/pci/pci_intr_fixup.c,v
retrieving revision 1.49
diff -u -r1.49 pci_intr_fixup.c
--- pci_intr_fixup.c 1 Jul 2011 17:37:26 -0000 1.49
+++ pci_intr_fixup.c 7 Sep 2014 23:24:07 -0000
@@ -719,6 +719,9 @@
PCIBIOS_PRINTV((" %3d", l->irq));
PCIBIOS_PRINTV((" %d ", l->fixup_stage));
}
+#else
+ if (id == (pcireg_t)7)
+ printf("Lucky 7!\n");
#endif
/*
And no, there's nothing at all special about 7 (except that
I do not expect id to ever have that value).
In my current kernel sources, I handle it like this ...
Index: pci_intr_fixup.c
===================================================================
RCS file: /cvsroot/NetBSD/src/sys/arch/i386/pci/pci_intr_fixup.c,v
retrieving revision 1.49
diff -u -r1.49 pci_intr_fixup.c
--- pci_intr_fixup.c 1 Jul 2011 17:37:26 -0000 1.49
+++ pci_intr_fixup.c 19 Apr 2014 16:37:10 -0000
@@ -666,10 +666,15 @@
struct pciintr_link_map *l;
int pin, irq, link;
int bus, device, function;
- pcireg_t intr, id;
+ pcireg_t intr;
+#ifdef PCIBIOSVERBOSE
+ pcireg_t id;
+#endif
pci_decompose_tag(pc, tag, &bus, &device, &function);
+#ifdef PCIBIOSVERBOSE
id = pci_conf_read(pc, tag, PCI_ID_REG);
+#endif
intr = pci_conf_read(pc, tag, PCI_INTERRUPT_REG);
pin = PCI_INTERRUPT_PIN(intr);
That's riskier, as it is no longer calling pci_conf_read(),
which could potentially have some side effects (and perhaps
only on some systems, so that I have not seen any ill effects
from running kernels compiled that way doesn't mean no-one
ever will.)
Home |
Main Index |
Thread Index |
Old Index