Ticket #379: ppc-sharedbsp-libcpuprintk.diff

File ppc-sharedbsp-libcpuprintk.diff, 8.3 KB (added by strauman, on 12/03/06 at 13:31:12)

ppc-sharedbsp-libcpuprintk.diff

Line 
1Index: c/src/lib/libbsp/powerpc/shared/console/console.c
2===================================================================
3RCS file: /afs/slac/g/spear/cvsrep/rtems/src-20030128/c/src/lib/libbsp/powerpc/shared/console/console.c,v
4retrieving revision 1.8
5retrieving revision 1.9
6diff -c -r1.8 -r1.9
7*** c/src/lib/libbsp/powerpc/shared/console/console.c   12 Feb 2003 22:08:27 -0000      1.8
8--- c/src/lib/libbsp/powerpc/shared/console/console.c   21 Mar 2003 21:00:23 -0000      1.9
9***************
10*** 120,126 ****
11          status = rtems_io_register_name ((nm=ttyS[minor].name), major, minor);
12          if ( RTEMS_SUCCESSFUL==status && BSPConsolePort == minor)
13                {
14!                 printk("Registering /dev/console as minor %i (==%s)\n",
15                                                        minor,
16                                                        ttyS[minor].name);
17                  /* also register an alias */
18--- 120,126 ----
19          status = rtems_io_register_name ((nm=ttyS[minor].name), major, minor);
20          if ( RTEMS_SUCCESSFUL==status && BSPConsolePort == minor)
21                {
22!                 printk("Registering /dev/console as minor %d (==%s)\n",
23                                                        minor,
24                                                        ttyS[minor].name);
25                  /* also register an alias */
26Index: c/src/lib/libbsp/powerpc/shared/console/consoleIo.h
27===================================================================
28RCS file: /afs/slac/g/spear/cvsrep/rtems/src-20030128/c/src/lib/libbsp/powerpc/shared/console/consoleIo.h,v
29retrieving revision 1.5
30retrieving revision 1.6
31diff -c -r1.5 -r1.6
32*** c/src/lib/libbsp/powerpc/shared/console/consoleIo.h 6 Feb 2003 22:52:54 -0000       1.5
33--- c/src/lib/libbsp/powerpc/shared/console/consoleIo.h 21 Mar 2003 21:00:23 -0000      1.6
34***************
35*** 33,38 ****
36--- 33,39 ----
37  extern int select_console(ioType t);
38  /* extern int printk(const char *, ...) __attribute__((format(printf, 1, 2))); */
39  extern void debug_putc(const unsigned char c);
40+ extern void debug_putc_onlcr(const char c);
41  extern int debug_getc(void);
42  extern int debug_tstc(void);
43  int kbdreset(void);
44Index: c/src/lib/libbsp/powerpc/shared/console/polled_io.c
45===================================================================
46RCS file: /afs/slac/g/spear/cvsrep/rtems/src-20030128/c/src/lib/libbsp/powerpc/shared/console/polled_io.c,v
47retrieving revision 1.6
48retrieving revision 1.7
49diff -c -r1.6 -r1.7
50*** c/src/lib/libbsp/powerpc/shared/console/polled_io.c 30 Jan 2003 00:48:52 -0000      1.6
51--- c/src/lib/libbsp/powerpc/shared/console/polled_io.c 21 Mar 2003 21:00:23 -0000      1.7
52***************
53*** 43,55 ****
54  extern void boot_udelay();
55  void * __palloc(u_long);
56  void  pfree(void *);
57!
58  #endif
59 
60  typedef unsigned long long u64;
61  typedef long long s64;
62  typedef unsigned int u32;
63 
64  #ifdef USE_KBD_SUPPORT
65  unsigned short plain_map[NR_KEYS] = {
66        0xf200, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036,
67--- 43,60 ----
68  extern void boot_udelay();
69  void * __palloc(u_long);
70  void  pfree(void *);
71! #else
72! #include <rtems/bspIo.h>
73  #endif
74 
75  typedef unsigned long long u64;
76  typedef long long s64;
77  typedef unsigned int u32;
78 
79+ #ifndef __BOOT__
80+ BSP_output_char_function_type BSP_output_char = debug_putc_onlcr;
81+ #endif
82+
83  #ifdef USE_KBD_SUPPORT
84  unsigned short plain_map[NR_KEYS] = {
85        0xf200, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036,
86***************
87*** 430,435 ****
88--- 435,449 ----
89    curIo->putc(c);
90  }
91 
92+ /* const char arg to be compatible with BSP_output_char decl. */
93+ void
94+ debug_putc_onlcr(const char c)
95+ {
96+       if ('\n'==c)
97+               debug_putc('\r');
98+       debug_putc(c);
99+ }
100+
101  int debug_getc(void)
102  {
103    return curIo->getc();
104***************
105*** 440,447 ****
106    return curIo->tstc();
107  }
108 
109-
110-
111  #define vidmem ((__io_ptr)(ptr_mem_map->isa_mem_base+0xb8000))
112 
113  void vacuum_putc(u_char c) {
114--- 454,459 ----
115***************
116*** 528,536 ****
117          char c;
118 
119          while ( ( c = *s++ ) != '\0' ) {
120!                 debug_putc(c);
121!                 if ( c == '\n' )
122!                         debug_putc('\r');
123          }
124  }
125 
126--- 540,546 ----
127          char c;
128 
129          while ( ( c = *s++ ) != '\0' ) {
130!                               debug_putc_onlcr((const char)c);
131          }
132  }
133 
134***************
135*** 875,880 ****
136--- 885,894 ----
137  #define is_digit(c)   ((c) >= '0' && (c) <= '9')
138 
139 
140+ /* provide this for the bootloader only; otherwise
141+  * use libcpu implementation
142+  */
143+ #if defined(__BOOT__)
144  static int skip_atoi(const char **s)
145  {
146        int i=0;
147***************
148*** 903,908 ****
149--- 917,924 ----
150        return  i;
151  }
152 
153+ #endif
154+
155  /* Necessary to avoid including a library, and GCC won't do this inline. */
156  #define div10(num, rmd)                                                        \
157  do {  u32 t1, t2, t3;                                                  \
158***************
159*** 942,947 ****
160--- 958,964 ----
161  #define LONG  64              /* long argument */
162  #define LLONG 128             /* 64 bit argument */
163 
164+ #if defined(__BOOT__)
165  static char * number(char * str, int size, int type, u64 num)
166  {
167        char fill,sign,tmp[24];
168***************
169*** 1107,1109 ****
170--- 1124,1127 ----
171        *str = '\0';
172        return str-buf;
173  }
174+ #endif
175Index: c/src/lib/libbsp/powerpc/shared/console/uart.c
176===================================================================
177RCS file: /afs/slac/g/spear/cvsrep/rtems/src-20030128/c/src/lib/libbsp/powerpc/shared/console/uart.c,v
178retrieving revision 1.6
179retrieving revision 1.7
180diff -c -r1.6 -r1.7
181*** c/src/lib/libbsp/powerpc/shared/console/uart.c      12 Feb 2003 22:08:27 -0000      1.6
182--- c/src/lib/libbsp/powerpc/shared/console/uart.c      21 Mar 2003 21:00:23 -0000      1.7
183***************
184*** 411,417 ****
185  }
186 
187  void
188! BSP_output_char_via_serial(int val)
189  {
190    BSP_uart_polled_write(BSPConsolePort, val);
191    if (val == '\n') BSP_uart_polled_write(BSPConsolePort,'\r');
192--- 411,417 ----
193  }
194 
195  void
196! BSP_output_char_via_serial(const char val)
197  {
198    BSP_uart_polled_write(BSPConsolePort, val);
199    if (val == '\n') BSP_uart_polled_write(BSPConsolePort,'\r');
200Index: c/src/lib/libbsp/powerpc/shared/console/uart.h
201===================================================================
202RCS file: /afs/slac/g/spear/cvsrep/rtems/src-20030128/c/src/lib/libbsp/powerpc/shared/console/uart.h,v
203retrieving revision 1.3
204retrieving revision 1.4
205diff -c -r1.3 -r1.4
206*** c/src/lib/libbsp/powerpc/shared/console/uart.h      8 May 2002 22:36:28 -0000       1.3
207--- c/src/lib/libbsp/powerpc/shared/console/uart.h      21 Mar 2003 21:00:23 -0000      1.4
208***************
209*** 35,41 ****
210  int  BSP_uart_set_break_cb(int uart, rtems_libio_ioctl_args_t *arg);
211 
212  extern unsigned BSP_poll_char_via_serial(void);
213! extern void BSP_output_char_via_serial(int val);
214  extern int BSPConsolePort;
215  extern int BSPBaseBaud;
216 
217--- 35,41 ----
218  int  BSP_uart_set_break_cb(int uart, rtems_libio_ioctl_args_t *arg);
219 
220  extern unsigned BSP_poll_char_via_serial(void);
221! extern void BSP_output_char_via_serial(const char val);
222  extern int BSPConsolePort;
223  extern int BSPBaseBaud;
224 
225Index: c/src/lib/libbsp/powerpc/shared/openpic/openpic.c
226===================================================================
227RCS file: /afs/slac/g/spear/cvsrep/rtems/src-20030128/c/src/lib/libbsp/powerpc/shared/openpic/openpic.c,v
228retrieving revision 1.5
229retrieving revision 1.6
230diff -c -r1.5 -r1.6
231*** c/src/lib/libbsp/powerpc/shared/openpic/openpic.c   21 Feb 2003 22:41:24 -0000      1.5
232--- c/src/lib/libbsp/powerpc/shared/openpic/openpic.c   21 Mar 2003 21:00:27 -0000      1.6
233***************
234*** 69,75 ****
235        printk("openpic.c:%d: illegal priority %d\n", __LINE__, pri);
236  #define check_arg_irq(irq) \
237      if (irq < 0 || irq >= NumSources) \
238!       printk("openpic.c:%d: illegal irq %d from %p,[%p],[[%p]]\n", \
239               __LINE__, irq, __builtin_return_address(0), \
240               __builtin_return_address(1), __builtin_return_address(2) \
241               );
242--- 69,75 ----
243        printk("openpic.c:%d: illegal priority %d\n", __LINE__, pri);
244  #define check_arg_irq(irq) \
245      if (irq < 0 || irq >= NumSources) \
246!       printk("openpic.c:%d: illegal irq %d from 0x%08x,[0x%08x],[[0x%08x]]\n", \
247               __LINE__, irq, __builtin_return_address(0), \
248               __builtin_return_address(1), __builtin_return_address(2) \
249               );
250***************
251*** 222,228 ****
252                break;
253        }
254      }
255!     printk("OpenPIC Version %s (%d CPUs and %d IRQ sources) at %p\n", version,
256           NumProcessors, NumSources, OpenPIC);
257 
258      printk("OpenPIC Vendor %d (%s), Device %d (%s), Stepping %d\n", vendorid,
259--- 222,228 ----
260                break;
261        }
262      }
263!     printk("OpenPIC Version %s (%d CPUs and %d IRQ sources) at 0x%08x\n", version,
264           NumProcessors, NumSources, OpenPIC);
265 
266      printk("OpenPIC Vendor %d (%s), Device %d (%s), Stepping %d\n", vendorid,