summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/powerpc
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2003-04-10 16:35:33 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2003-04-10 16:35:33 +0000
commit0d6849e76a7da35135a6f50ed8520ce643519f8e (patch)
tree951098f3629cb54e035daa5a5781d3586a8dbb0a /c/src/lib/libbsp/powerpc
parent2003-04-10 Joel Sherrill <joel@OARcorp.com> (diff)
downloadrtems-0d6849e76a7da35135a6f50ed8520ce643519f8e.tar.bz2
2003-04-10 Till Straumann <strauman@slac.stanford.edu>
PR 379/bsps * console/polled_io.c: libcpu provides 'printk' already. Therefore, the implementation in this file was removed (still used for the bootloader, though). It now provides BSP_output_char() for libcpu's printk(). * console/uart.c, console/uart.h: BSP_output_char_via_serial() prototype changed to match the BSP_output_char_function_type. Note that the motorola BSPs use polled-io for the output_char routine, not the uart.c version. The latter can be used be other BSPs however (e.g. SVGM). * console/console.c, console/consoleIo.h, console/polled_io.c, irq/irq_init.c, openpic/openpic.c, pci/detect_raven_bridge.c: Unfortunately, the supported 'printk' format string subset of the polled-io and libcpu implementations are different - hence, a few format strings in the ppc/shared BSP were changed.
Diffstat (limited to 'c/src/lib/libbsp/powerpc')
-rw-r--r--c/src/lib/libbsp/powerpc/shared/ChangeLog18
-rw-r--r--c/src/lib/libbsp/powerpc/shared/console/console.c3
-rw-r--r--c/src/lib/libbsp/powerpc/shared/console/consoleIo.h1
-rw-r--r--c/src/lib/libbsp/powerpc/shared/console/polled_io.c30
-rw-r--r--c/src/lib/libbsp/powerpc/shared/console/uart.c2
-rw-r--r--c/src/lib/libbsp/powerpc/shared/console/uart.h2
-rw-r--r--c/src/lib/libbsp/powerpc/shared/irq/irq_init.c1
-rw-r--r--c/src/lib/libbsp/powerpc/shared/openpic/openpic.c5
-rw-r--r--c/src/lib/libbsp/powerpc/shared/pci/detect_raven_bridge.c2
9 files changed, 49 insertions, 15 deletions
diff --git a/c/src/lib/libbsp/powerpc/shared/ChangeLog b/c/src/lib/libbsp/powerpc/shared/ChangeLog
index c03f4ae3bd..b1b0cc1525 100644
--- a/c/src/lib/libbsp/powerpc/shared/ChangeLog
+++ b/c/src/lib/libbsp/powerpc/shared/ChangeLog
@@ -1,3 +1,21 @@
+2003-04-10 Till Straumann <strauman@slac.stanford.edu>
+
+ PR 379/bsps
+ * console/polled_io.c: libcpu provides 'printk' already.
+ Therefore, the implementation in this file was removed (still
+ used for the bootloader, though). It now provides BSP_output_char()
+ for libcpu's printk().
+ * console/uart.c, console/uart.h: BSP_output_char_via_serial()
+ prototype changed to match the BSP_output_char_function_type. Note
+ that the motorola BSPs use polled-io for the output_char routine, not
+ the uart.c version. The latter can be used be other BSPs however
+ (e.g. SVGM).
+ * console/console.c, console/consoleIo.h, console/polled_io.c,
+ irq/irq_init.c, openpic/openpic.c, pci/detect_raven_bridge.c:
+ Unfortunately, the supported 'printk' format string subset of the
+ polled-io and libcpu implementations are different - hence, a few
+ format strings in the ppc/shared BSP were changed.
+
2003-04-10 Joel Sherrill <joel@OARcorp.com>
PR 383/bsps
diff --git a/c/src/lib/libbsp/powerpc/shared/console/console.c b/c/src/lib/libbsp/powerpc/shared/console/console.c
index 4fcef5a2a9..d42883e52b 100644
--- a/c/src/lib/libbsp/powerpc/shared/console/console.c
+++ b/c/src/lib/libbsp/powerpc/shared/console/console.c
@@ -34,7 +34,6 @@ extern int close(int fd);
#include <rtems/libio.h>
#include <termios.h>
#include <bsp/uart.h>
-#include <bsp/consoleIo.h>
#include <rtems/bspIo.h> /* printk */
/* Definitions for BSPConsolePort */
@@ -120,7 +119,7 @@ console_initialize(rtems_device_major_number major,
status = rtems_io_register_name ((nm=ttyS[minor].name), major, minor);
if ( RTEMS_SUCCESSFUL==status && BSPConsolePort == minor)
{
- printk("Registering /dev/console as minor %i (==%s)\n",
+ printk("Registering /dev/console as minor %d (==%s)\n",
minor,
ttyS[minor].name);
/* also register an alias */
diff --git a/c/src/lib/libbsp/powerpc/shared/console/consoleIo.h b/c/src/lib/libbsp/powerpc/shared/console/consoleIo.h
index 50ad0428a4..220b5ee8cd 100644
--- a/c/src/lib/libbsp/powerpc/shared/console/consoleIo.h
+++ b/c/src/lib/libbsp/powerpc/shared/console/consoleIo.h
@@ -33,6 +33,7 @@ extern board_memory_map *ptr_mem_map;
extern int select_console(ioType t);
/* extern int printk(const char *, ...) __attribute__((format(printf, 1, 2))); */
extern void debug_putc(const unsigned char c);
+extern void debug_putc_onlcr(const char c);
extern int debug_getc(void);
extern int debug_tstc(void);
int kbdreset(void);
diff --git a/c/src/lib/libbsp/powerpc/shared/console/polled_io.c b/c/src/lib/libbsp/powerpc/shared/console/polled_io.c
index edc1f06f0a..51802e5ce8 100644
--- a/c/src/lib/libbsp/powerpc/shared/console/polled_io.c
+++ b/c/src/lib/libbsp/powerpc/shared/console/polled_io.c
@@ -43,13 +43,18 @@
extern void boot_udelay();
void * __palloc(u_long);
void pfree(void *);
-
+#else
+#include <rtems/bspIo.h>
#endif
typedef unsigned long long u64;
typedef long long s64;
typedef unsigned int u32;
+#ifndef __BOOT__
+BSP_output_char_function_type BSP_output_char = debug_putc_onlcr;
+#endif
+
#ifdef USE_KBD_SUPPORT
unsigned short plain_map[NR_KEYS] = {
0xf200, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036,
@@ -430,6 +435,15 @@ void debug_putc(const u_char c)
curIo->putc(c);
}
+/* const char arg to be compatible with BSP_output_char decl. */
+void
+debug_putc_onlcr(const char c)
+{
+ if ('\n'==c)
+ debug_putc('\r');
+ debug_putc(c);
+}
+
int debug_getc(void)
{
return curIo->getc();
@@ -440,8 +454,6 @@ int debug_tstc(void)
return curIo->tstc();
}
-
-
#define vidmem ((__io_ptr)(ptr_mem_map->isa_mem_base+0xb8000))
void vacuum_putc(u_char c) {
@@ -528,9 +540,7 @@ void puts(const u_char *s)
char c;
while ( ( c = *s++ ) != '\0' ) {
- debug_putc(c);
- if ( c == '\n' )
- debug_putc('\r');
+ debug_putc_onlcr((const char)c);
}
}
@@ -875,6 +885,10 @@ int select_console(ioType t) {
#define is_digit(c) ((c) >= '0' && (c) <= '9')
+/* provide this for the bootloader only; otherwise
+ * use libcpu implementation
+ */
+#if defined(__BOOT__)
static int skip_atoi(const char **s)
{
int i=0;
@@ -903,6 +917,8 @@ int printk(const char *fmt, ...) {
return i;
}
+#endif
+
/* Necessary to avoid including a library, and GCC won't do this inline. */
#define div10(num, rmd) \
do { u32 t1, t2, t3; \
@@ -942,6 +958,7 @@ do { u32 t1, t2, t3; \
#define LONG 64 /* long argument */
#define LLONG 128 /* 64 bit argument */
+#if defined(__BOOT__)
static char * number(char * str, int size, int type, u64 num)
{
char fill,sign,tmp[24];
@@ -1107,3 +1124,4 @@ int k_vsprintf(char *buf, const char *fmt, va_list args)
*str = '\0';
return str-buf;
}
+#endif
diff --git a/c/src/lib/libbsp/powerpc/shared/console/uart.c b/c/src/lib/libbsp/powerpc/shared/console/uart.c
index bbaa1b5382..5bdf8e110b 100644
--- a/c/src/lib/libbsp/powerpc/shared/console/uart.c
+++ b/c/src/lib/libbsp/powerpc/shared/console/uart.c
@@ -411,7 +411,7 @@ BSP_uart_polled_write(int uart, int val)
}
void
-BSP_output_char_via_serial(int val)
+BSP_output_char_via_serial(const char val)
{
BSP_uart_polled_write(BSPConsolePort, val);
if (val == '\n') BSP_uart_polled_write(BSPConsolePort,'\r');
diff --git a/c/src/lib/libbsp/powerpc/shared/console/uart.h b/c/src/lib/libbsp/powerpc/shared/console/uart.h
index 98399bf500..e1b2dae37a 100644
--- a/c/src/lib/libbsp/powerpc/shared/console/uart.h
+++ b/c/src/lib/libbsp/powerpc/shared/console/uart.h
@@ -35,7 +35,7 @@ int BSP_uart_get_break_cb(int uart, rtems_libio_ioctl_args_t *arg);
int BSP_uart_set_break_cb(int uart, rtems_libio_ioctl_args_t *arg);
extern unsigned BSP_poll_char_via_serial(void);
-extern void BSP_output_char_via_serial(int val);
+extern void BSP_output_char_via_serial(const char val);
extern int BSPConsolePort;
extern int BSPBaseBaud;
diff --git a/c/src/lib/libbsp/powerpc/shared/irq/irq_init.c b/c/src/lib/libbsp/powerpc/shared/irq/irq_init.c
index 1abb8a48a8..bdbbfe63cf 100644
--- a/c/src/lib/libbsp/powerpc/shared/irq/irq_init.c
+++ b/c/src/lib/libbsp/powerpc/shared/irq/irq_init.c
@@ -18,7 +18,6 @@
* $Id$
*/
-#include <bsp/consoleIo.h>
#include <libcpu/io.h>
#include <libcpu/spr.h>
#include <bsp/pci.h>
diff --git a/c/src/lib/libbsp/powerpc/shared/openpic/openpic.c b/c/src/lib/libbsp/powerpc/shared/openpic/openpic.c
index 22da8cac66..1a923d78ce 100644
--- a/c/src/lib/libbsp/powerpc/shared/openpic/openpic.c
+++ b/c/src/lib/libbsp/powerpc/shared/openpic/openpic.c
@@ -23,7 +23,6 @@
#include <rtems/bspIo.h>
#include <bsp/openpic.h>
#include <bsp/pci.h>
-#include <bsp/consoleIo.h>
#include <libcpu/io.h>
#include <libcpu/byteorder.h>
#include <bsp.h>
@@ -69,7 +68,7 @@ static unsigned int NumSources;
printk("openpic.c:%d: illegal priority %d\n", __LINE__, pri);
#define check_arg_irq(irq) \
if (irq < 0 || irq >= NumSources) \
- printk("openpic.c:%d: illegal irq %d from %p,[%p],[[%p]]\n", \
+ printk("openpic.c:%d: illegal irq %d from 0x%08x,[0x%08x],[[0x%08x]]\n", \
__LINE__, irq, __builtin_return_address(0), \
__builtin_return_address(1), __builtin_return_address(2) \
);
@@ -222,7 +221,7 @@ void openpic_init(int main_pic, unsigned char *polarities, unsigned char *senses
break;
}
}
- printk("OpenPIC Version %s (%d CPUs and %d IRQ sources) at %p\n", version,
+ printk("OpenPIC Version %s (%d CPUs and %d IRQ sources) at 0x%08x\n", version,
NumProcessors, NumSources, OpenPIC);
printk("OpenPIC Vendor %d (%s), Device %d (%s), Stepping %d\n", vendorid,
diff --git a/c/src/lib/libbsp/powerpc/shared/pci/detect_raven_bridge.c b/c/src/lib/libbsp/powerpc/shared/pci/detect_raven_bridge.c
index fdb4eb49e7..249aaa390f 100644
--- a/c/src/lib/libbsp/powerpc/shared/pci/detect_raven_bridge.c
+++ b/c/src/lib/libbsp/powerpc/shared/pci/detect_raven_bridge.c
@@ -102,7 +102,7 @@ void detect_host_bridge()
printk("Raven MPIC is accessed via memory Space Access at address : %x\n", tmp);
#endif
OpenPIC=(volatile struct OpenPIC *) (tmp + PREP_ISA_MEM_BASE);
- printk("OpenPIC found at %p.\n",
+ printk("OpenPIC found at %x.\n",
OpenPIC);
}
}