undefined reference to pci_io_base

Linas Vepstas linas at austin.ibm.com
Wed Aug 30 06:28:31 EST 2006

On Tue, Aug 29, 2006 at 10:34:54AM -0700, Geoff Levand wrote:
> I'm trying to understand the intended design of the inb()
> and outb() macros in asm-powerpc/io.h. They are causing
> me some grief when I set CONFIG_PCI=n:
>   drivers/built-in.o: undefined reference to `pci_io_base'
> This is coming from drivers/char/mem.c, which is always
> built in, and is referencing pci_io_base through inb()
> and outb().
> Anyway, it seems asm-powerpc/io.h has two sets of io macros,
> one set for iSeries, and one generic set for everything else.
> The problem arises because the generic macros just use the eeh
> macros in eeh.h, which in turn, directly use pci_io_base. 
> I can think of three solutions to this that work for me, but
> I'm not sure which, if any, would be the most proper.  One
> would be to just have this in io.h:
>   #if defined(CONFI_PCI)
>   extern unsigned long pci_io_base;
>   #else
>   #define pci_io_base 0
>   #endif

This makes the most sense to me; it compiles to something nice.

> Another would be to have this in some file that is always built
> in, like setup-common.c:
>   #if !defined(CONFI_PCI)
>   unsigned long pci_io_base;
>   EXPORT_SYMBOL(pci_io_base);
>   #endif

This compiles to something ugly and pointless ... 

> A third would be to have another set of io macros in io.h that
> are used when CONFIG_PCI=n.

I'm not sure that yet-another set of macros improves readabily.
Those macros are already fairly byzantine in thier inter-connections.


More information about the Linuxppc-dev mailing list