--- zzzz-none-000/linux-2.4.17/arch/mips/mips-boards/generic/printf.c 2001-04-14 03:26:07.000000000 +0000 +++ sangam-fb-322/linux-2.4.17/arch/mips/mips-boards/generic/printf.c 2004-11-24 13:22:35.000000000 +0000 @@ -2,6 +2,10 @@ * Carsten Langgaard, carstenl@mips.com * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved. * + * Jeff Harrell, jharrell@ti.com + * Copyright (C) 2000,2001 Texas Instruments, Inc. All rights reserved. + * + * * ######################################################################## * * This program is free software; you can distribute it and/or modify it @@ -19,7 +23,7 @@ * * ######################################################################## * - * Putting things on the screen/serial line using YAMONs facilities. + * Putting things on the screen/serial line using YAMONs (or ADAM2) facilities. * */ #include @@ -31,21 +35,53 @@ #include #include +#if defined(CONFIG_MIPS_AVALANCHE_SOC) +#include +#include + +static char ppbuf[1024]; + +void (*prom_print_str)(unsigned int out, char *s, int len); + +void setup_prom_printf(void) __init; +void setup_prom_printf(void) +{ + prom_print_str = (void *)*(unsigned int *)AVALANCHE_YAMON_PROM_PRINT_COUNT_ADDR; +} + +void prom_printf(char *fmt, ...) __init; +void prom_printf(char *fmt, ...) +{ + va_list args; + int len; + + va_start(args, fmt); + vsprintf(ppbuf, fmt, args); + len = strlen(ppbuf); + + prom_print_str(1, ppbuf, len); + + va_end(args); + return; -#ifdef CONFIG_MIPS_ATLAS -/* - * Atlas registers are memory mapped on 64-bit aligned boundaries and +} +#else /* !CONFIG_MIPS_AVALANCHE_SOC */ + + +#ifdef CONFIG_MIPS_ATLAS +/* + * Atlas registers are memory mapped on 64-bit aligned boundaries and * only word access are allowed. * When reading the UART 8 bit registers only the LSB are valid. */ unsigned int atlas_serial_in(struct async_struct *info, int offset) { - return (*(volatile unsigned int *)(info->port + mips_io_port_base + offset*8) & 0xff); + return inl(info->port + offset*8) & 0xff; } void atlas_serial_out(struct async_struct *info, int offset, int value) { - *(volatile unsigned int *)(info->port + mips_io_port_base + offset*8) = value; + outl(value, info->port + offset*8); } #define serial_in atlas_serial_in @@ -70,8 +106,8 @@ }; /* - * Hooks to fake "prom" console I/O before devices - * are fully initialized. + * Hooks to fake "prom" console I/O before devices + * are fully initialized. */ static struct async_struct prom_port_info = {0}; @@ -138,3 +174,4 @@ } restore_flags(flags); } +#endif /* CONFIG_MIPS_AVALANCHE_SOC */