PowerPC: _IO_BASE & friends
Till Straumann
strauman at SLAC.Stanford.EDU
Wed Jan 9 00:29:16 UTC 2002
Joel, I'd like to bring up an issue we talked about
a while ago, namely the definitions of
_IO_BASE etc. by libcpu/io.h.
>> Something else that bothers me are the definitions
>>
>> #define _IO_BASE PREP_ISA_IO_BASE
>> #define _ISA_MEM_BASE PREP_ISA_MEM_BASE
>> #define PCI_DRAM_OFFSET PREP_PCI_DRAM_OFFSET
>>
>> found in lib/libcpu/powerpc/shared/include/io.h
>>
>> This should be the business of the BSP rather than
>> the CPU library's!
>>
>Sounds reasonable to me also. Could these be provided
>by the linker script? This is the most flexible and avoids
>the use of macros.
>
> -- joel
>
>> -- Till
These are my thoughts:
defining in bsp.h:
+ more efficient
+ more transparent
- existing code needs to be modified (include bsp.h in addition to
libcpu/io.h)
- macros should be avoided if possible
linkcmds:
+ no macro needed
+ existing source code needs no modification
- less efficient ("lis ry, _IO_BASE at ha; ori ry,ry,_IO_BASE at la; add
rx,rx,ry";
using a macro expands to "addis rx,rx,_IO_BASE at ha")
- less transparent (hard to figure out for a reader where the symbol
is defined)
Going beyond _IO_BASE and _ISA_MEM_BASE: should there be a standard
way for rtems providing memory map info? How can an application or a
driver
figure out how to address a PCI or a VME location?
An example:
The mvme23xx BSP maps all PCI memory space into ISA memory. Hence,
to address a particular device on the mvme23xx, I use _ISA_MEM_BASE
+ pci_addr.
However, on a CHRP platform, PCI memory and ISA memory are disjoint.
There,
I might have to use pci_addr to address the same device. This makes it
complicated to port a driver between different RTEMS BSPs.
Worst of all, e.g. the libchip/dec21140 driver uses PREP_ISA_MEM_BASE to
address
pci memory space :-( which works fine on the mvme23xx but is likely
to fail if I try to use this driver for a PMC module on a different
board.
IMO, there is some work to be done in this area :-)
Comments?
-- Till.
More information about the users
mailing list