Re: [PATCH v4 03/16] [loongson] early_printk: add new implmentation

Wu Zhangjin
2009-07-06T14:01:12Z

On Mon, 2009-07-06 at 11:43 +0100, Ralf Baechle wrote:
> On Thu, Jul 02, 2009 at 11:20:20PM +0800, Wu Zhangjin wrote:
>
> > +#include <asm/mips-boards/bonito64.h>
> > +
> > +#define UART_BASE (BONITO_PCIIO_BASE + 0x3f8)
> > +
> > +#define PORT(base, offset) (u8 *)(base + offset)
> > +
> > +static inline unsigned int serial_in(phys_addr_t base, int offset)
> > +{
> > + return readb(PORT(base, offset));
> > +}
> > +
> > +static inline void serial_out(phys_addr_t base, int offset, int value)
> > +{
> > + writeb(value, PORT(base, offset));
>
> Why not inb(0x3f8, + offset) rsp. outb()?
>

because yeeloong laptop use the serial port of cpu, which have different
base address: 0x1ff000000 + 0x3f8, to share the same source code between
yeeloong, fuloong2f(0x1fd00000 + 0x2f8) and fuloong2e(0x1fd00000 +
0x3f8), I use PORT(base, offset) here and use readb/writeb instead of
inb/outb. so, here is only a preparation for future yeeloong2f support.

> > +}
> > +
> > +void prom_putchar(char c)
> > +{
> > + phys_addr_t uart_base =
> > + (phys_addr_t) ioremap_nocache(UART_BASE, 8);
>
> ioremap_nocache returns a virtual address, not a physical address, so
> this type should probably be unsigned char *.
>

okay, I will change it.

Thanks!
Wu Zhangjin