From: <pi...@li...> - 2000-05-09 18:03:27
|
Hello everybody, First, thanks again to Niibe and Kaz for the modifications to binutils and gcc : now glibc compiles and works flawlessly for me. What a relief ! As some of you know already, I'm working with a 7707-based (little endian) board from Hypercom, equipped with 16M of RAM and a "debug sub-board" from Hitachi. This debug board is what I use to download the kernel and the initrd filesystem to the board (I don't have a working flash driver yet so I use a ramdisk). Also, the debug board features 8 LEDs and a 8-digit 7-segment display that one can use to help debugging without console or debugger. So, I thought I might contribute the modifications I have done to the kernel to support that specific board, as well as other "niceties". The patch at the end of this message is against the 2.3.99-pre7 kernel that is in the linuxsh CVS on sourceforge (tagged "L2_3_99_PRE7-6_AFTER: 1.4"). It provides : - additional code to arch/sh/kernel/head.S to relocate a ramdisk image at a fixed location in memory. This ramdisk is appended to the stripped kernel file and the offset from the start of the file is poked into the header. There is a little shell script called "spit_vmlinux.lin" and an accompanying program called "strtoul.c" (that has to be compiled) to generate the final file. Note that "strtoul.c" outputs 4 bytes in little-endian format. Also note that the last line of "spit_vmlinux.lin" calls a program that I have developped in-house but I can't disclose, so it needs to be commented out. TODO : recode the shell script in C, make it endian-independant and move it to arch/sh/boot - A new config entry in "processor type and features" to specify the amount of RAM on the board (in kB) - A new config entry in "kernel hacking" called "Hitachi debug sub-board LEDs tracing" : when this option is enabled, the kernel will display codes on the 7-segment display on the Hitachi sub-debug board while booting. Then, when the idle task is reached, the 8 LEDs should cycle slowly. The codes are instrumented in arch/sh/kernel/head.S, init/main.c and arch/sh/kernel/process.c. It is very useful if your kernel hangs early and you have no way to debug it or do printk's. - drivers/char/tty_io.c now output "SCI serial driver registered (major 4)" when booting - drivers/char/sh_sci.c and drivers/char/sh_sci.h have been modified for a bus clock of 30Mhz and take the clock source of the SCI into account, so that it is possible to use the full range of baudrates from 110 bps to 115200 bps. Also, "serial_console_setup()" now sets the baudrate before exiting, which is required if the kernel uses the SCI as initial console. TODO : set the bus clock automagically, or at least have an config option. Right now, it is hard-coded (yuk). - the default defconfig (arch/sh/defconfig) is for the Hypercom board I'm working on, i.e. with 16384k of RAM and the "Hitachi debug sub-board LEDs tracing" enabled by default. That's it for now. The Hitachi debug sub-board also features a serial port (completely separate from the SCI/SCIF on the processor) and a parallel port (normally used to transfer bootable images and firmware to the board). If anybody is interested, I can whip up some code to add kernel support for them. Take care ! --- Pierre-Philippe Coupard <pi...@li...> Software Engineer, Lineo, Inc. 801-426-5001 x 208 --- --8<--8<--SNIP-SNIP--8<--8<-- diff -ruN linux-2.3.99_NY/Makefile linux-2.3.99_NY+PPC/Makefile --- linux-2.3.99_NY/Makefile Sat Apr 29 09:46:02 2000 +++ linux-2.3.99_NY+PPC/Makefile Mon May 8 15:17:51 2000 @@ -5,7 +5,8 @@ KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) -ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/) +#PPC ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/) +ARCH := sh CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ else if [ -x /bin/bash ]; then echo /bin/bash; \ diff -ruN linux-2.3.99_NY/arch/sh/config.in linux-2.3.99_NY+PPC/arch/sh/config.in --- linux-2.3.99_NY/arch/sh/config.in Thu May 4 00:32:44 2000 +++ linux-2.3.99_NY+PPC/arch/sh/config.in Mon May 8 16:15:20 2000 @@ -42,6 +42,9 @@ hex 'Physical memory start address' CONFIG_MEMORY_START 08000000 hex 'I/O port offset address' CONFIG_IOPORT_START ba000000 fi +#PPC +int 'Amount of physical memory (kB)' CONFIG_MEMORY_SIZE 16384 +#\PPC endmenu mainmenu_option next_comment @@ -212,5 +215,8 @@ comment 'Kernel hacking' bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ +#PPC +bool 'Hitachi debug sub-board LEDs tracing' CONFIG_DEBUG_LEDS +#\PPC bool 'GDB Stub kernel debug' CONFIG_DEBUG_KERNEL_WITH_GDB_STUB endmenu diff -ruN linux-2.3.99_NY/arch/sh/defconfig linux-2.3.99_NY+PPC/arch/sh/defconfig --- linux-2.3.99_NY/arch/sh/defconfig Fri Apr 14 13:14:00 2000 +++ linux-2.3.99_NY+PPC/arch/sh/defconfig Mon May 8 16:27:45 2000 @@ -1,5 +1,5 @@ # -# Automatically generated make config: don't edit +# Automatically generated by make menuconfig: don't edit # CONFIG_SUPERH=y CONFIG_UID16=y @@ -7,11 +7,13 @@ # # Code maturity level options # -# CONFIG_EXPERIMENTAL is not set +CONFIG_EXPERIMENTAL=y # # Processor type and features # +CONFIG_SH_GENERIC=y +# CONFIG_SH_SOLUTION_ENGINE is not set CONFIG_CPU_SUBTYPE_SH7708=y # CONFIG_CPU_SUBTYPE_SH7709 is not set # CONFIG_CPU_SUBTYPE_SH7750 is not set @@ -19,11 +21,15 @@ # CONFIG_CPU_SH4 is not set CONFIG_LITTLE_ENDIAN=y CONFIG_MEMORY_START=0c000000 +CONFIG_IOPORT_START=ba000000 +CONFIG_MEMORY_SIZE=16384 # # Loadable module support # -# CONFIG_MODULES is not set +CONFIG_MODULES=y +# CONFIG_MODVERSIONS is not set +# CONFIG_KMOD is not set # # General setup @@ -31,11 +37,11 @@ # CONFIG_ISA is not set # CONFIG_SBUS is not set # CONFIG_NET is not set -CONFIG_CF_ENABLER=y +# CONFIG_CF_ENABLER is not set # CONFIG_PCI is not set # CONFIG_HOTPLUG is not set # CONFIG_PCMCIA is not set -# CONFIG_SYSVIPC is not set +CONFIG_SYSVIPC=y # CONFIG_BSD_PROCESS_ACCT is not set # CONFIG_SYSCTL is not set CONFIG_KCORE_ELF=y @@ -56,12 +62,9 @@ # CONFIG_PARIDE is not set # CONFIG_BLK_CPQ_DA is not set # CONFIG_BLK_DEV_DAC960 is not set - -# -# Additional Block Devices -# -# CONFIG_BLK_DEV_LOOP is not set +CONFIG_BLK_DEV_LOOP=m # CONFIG_BLK_DEV_NBD is not set +# CONFIG_BLK_DEV_LVM is not set # CONFIG_BLK_DEV_MD is not set # CONFIG_MD_LINEAR is not set # CONFIG_MD_STRIPED is not set @@ -71,35 +74,9 @@ # # ATA/IDE/MFM/RLL support # -CONFIG_IDE=y - -# -# IDE, ATA and ATAPI Block devices -# -CONFIG_BLK_DEV_IDE=y - -# -# Please see Documentation/ide.txt for help/info on IDE drives -# -# CONFIG_BLK_DEV_HD_IDE is not set -# CONFIG_BLK_DEV_HD is not set -CONFIG_BLK_DEV_IDEDISK=y -# CONFIG_IDEDISK_MULTI_MODE is not set -# CONFIG_BLK_DEV_IDECS is not set -# CONFIG_BLK_DEV_IDECD is not set -# CONFIG_BLK_DEV_IDETAPE is not set -# CONFIG_BLK_DEV_IDEFLOPPY is not set -# CONFIG_BLK_DEV_IDESCSI is not set - -# -# IDE chipset support/bugfixes -# -# CONFIG_BLK_DEV_CMD640 is not set -# CONFIG_BLK_DEV_CMD640_ENHANCED is not set -# CONFIG_BLK_DEV_ISAPNP is not set -# CONFIG_IDE_CHIPSETS is not set -# CONFIG_IDEDMA_AUTO is not set +# CONFIG_IDE is not set # CONFIG_BLK_DEV_IDE_MODES is not set +# CONFIG_BLK_DEV_HD is not set # # SCSI support @@ -114,10 +91,6 @@ CONFIG_SH_SCI_SERIAL=y # CONFIG_SH_SCIF_SERIAL is not set CONFIG_SERIAL_CONSOLE=y - -# -# Unix 98 PTY support -# # CONFIG_UNIX98_PTYS is not set # @@ -137,6 +110,7 @@ # CONFIG_VFAT_FS is not set # CONFIG_EFS_FS is not set # CONFIG_CRAMFS is not set +# CONFIG_RAMFS is not set # CONFIG_ISO9660_FS is not set # CONFIG_JOLIET is not set # CONFIG_MINIX_FS is not set @@ -175,4 +149,5 @@ # Kernel hacking # # CONFIG_MAGIC_SYSRQ is not set -CONFIG_DEBUG_KERNEL_WITH_GDB_STUB=y +CONFIG_DEBUG_LEDS=y +# CONFIG_DEBUG_KERNEL_WITH_GDB_STUB is not set diff -ruN linux-2.3.99_NY/arch/sh/kernel/Makefile linux-2.3.99_NY+PPC/arch/sh/kernel/Makefile --- linux-2.3.99_NY/arch/sh/kernel/Makefile Tue May 2 20:24:42 2000 +++ linux-2.3.99_NY+PPC/arch/sh/kernel/Makefile Mon May 8 15:13:02 2000 @@ -20,6 +20,12 @@ O_OBJS += cf-enabler.o endif +#PPC +ifdef CONFIG_DEBUG_LEDS +O_OBJS += debug_leds.o +endif +#\PPC + ifdef CONFIG_SH_GENERIC O_OBJS += io_generic.o endif diff -ruN linux-2.3.99_NY/arch/sh/kernel/debug_leds.c linux-2.3.99_NY+PPC/arch/sh/kernel/debug_leds.c --- linux-2.3.99_NY/arch/sh/kernel/debug_leds.c Wed Dec 31 17:00:00 1969 +++ linux-2.3.99_NY+PPC/arch/sh/kernel/debug_leds.c Mon May 8 15:44:27 2000 @@ -0,0 +1,23 @@ +#include "asm/debug_leds.h" + + + +/* Global vars */ +unsigned long LED_hex_val; +unsigned char LED_led_val; + + + + +/* Functions */ +void LED_display_hex_val(void) +{ + (* ((volatile unsigned long * const)(LED_HEX_DISPLAY_ADDR)))=LED_hex_val; +} + + + +void LED_display_led_val(void) +{ + (* ((volatile unsigned long * const)(LED_LED_DISPLAY_ADDR)))=LED_led_val; +} diff -ruN linux-2.3.99_NY/arch/sh/kernel/head.S linux-2.3.99_NY+PPC/arch/sh/kernel/head.S --- linux-2.3.99_NY/arch/sh/kernel/head.S Fri Apr 28 11:58:50 2000 +++ linux-2.3.99_NY+PPC/arch/sh/kernel/head.S Mon May 8 15:10:42 2000 @@ -36,12 +36,70 @@ * */ ENTRY(_stext) +/*PPC*/ +load_LED_addresses: + mov.l ledaddr,r12 + xor r13,r13 + mov.b r13,@r12 /* All leds = OFF */ + mov.l segaddr,r12 + mov.l r13,@r12 /* Displays 0 */ + bra load_LED_addresses_carry_on + nop + .balign 4 +segaddr:.long 0xa8060000 +ledaddr:.long 0xa8040000 + .balign 4 +load_LED_addresses_carry_on: +/*/PPC*/ + +/*PPC*/ add #1,r13 +/*PPC*/ mov.l r13,@r12 /* Display 1 */ + +/*PPC*/ + ! First, relocate the initrd data + mov.l rdata,r0 + add #0x10,r0 + mov.l @r0,r1 ! r1 = where the initrd data is now + add #4,r0 + mov.l @r0,r2 ! r2 = length of the initrd data + mov.l rreloc,r3 ! r3 = where the initrd data is reloc. + xor r4,r4 ! r4 = relocated bytes counter +reloc: mov.l @r1,r0 + mov.l r0,@r3 + add #4,r1 + add #4,r3 + add #4,r4 + cmp/hs r2,r4 + bf/s reloc + nop + +/*PPC*/ add #1,r13 +/*PPC*/ mov.l r13,@r12 /* Display 2 */ + + ! Poke the new address of initrd in the header + mov.l rdata,r0 + add #0x10,r0 + mov.l prreloc,r1 + mov.l r1,@r0 + +/*PPC*/ add #1,r13 +/*PPC*/ mov.l r13,@r12 /* Display 3 */ +/*\PPC*/ + ! Initialize Status Register mov.l 1f, $r0 ! MD=1, RB=0, BL=0, IMASK=0xF ldc $r0, $sr + +/*PPC*/ add #1,r13 +/*PPC*/ mov.l r13,@r12 /* Display 4 */ + ! Initialize global interrupt mask mov #0, $r0 ldc $r0, $r6_bank + +/*PPC*/ add #1,r13 +/*PPC*/ mov.l r13,@r12 /* Display 5 */ + ! mov.l 2f, $r0 mov $r0, $r15 ! Set initial r15 (stack pointer) @@ -50,6 +108,10 @@ sub $r1, $r0 ! ldc $r0, $r7_bank ! ... and init_task ! + +/*PPC*/ add #1,r13 +/*PPC*/ mov.l r13,@r12 /* Display 6 */ + #if defined(__SH4__) ! Initialize fpu mov.l 7f, $r0 @@ -60,6 +122,10 @@ mov.l 6f, $r0 jsr @$r0 nop + +/*PPC*/ add #1,r13 +/*PPC*/ mov.l r13,@r12 /* Display 7 */ + ! Clear BSS area mov.l 3f, $r1 add #4, $r1 @@ -68,6 +134,10 @@ 9: cmp/hs $r2, $r1 bf/s 9b ! while (r1 < r2) mov.l $r0,@-$r2 + +/*PPC*/ add #1,r13 +/*PPC*/ mov.l r13,@r12 /* Display 8 */ + ! Start kernel mov.l 5f, $r0 jmp @$r0 @@ -83,3 +153,9 @@ #if defined(__SH4__) 7: .long SYMBOL_NAME(fpu_init) #endif + +/*PPC*/ +rdata: .long empty_zero_page ! To find the initial ramdisk params +rreloc: .long 0x8c800000 ! Where the initrd ramdisk is relocated +prreloc:.long 0x00800000 ! Same as rreloc, in a paged environment +/*\PPC*/ diff -ruN linux-2.3.99_NY/arch/sh/kernel/process.c linux-2.3.99_NY+PPC/arch/sh/kernel/process.c --- linux-2.3.99_NY/arch/sh/kernel/process.c Fri Apr 28 11:58:50 2000 +++ linux-2.3.99_NY+PPC/arch/sh/kernel/process.c Mon May 8 15:15:03 2000 @@ -42,6 +42,12 @@ #include <linux/irq.h> +/*PPC*/ +#ifdef CONFIG_DEBUG_LEDS +#include "asm/debug_leds.h" +#endif +/*\PPC*/ + static int hlt_counter=0; #define HARD_IDLE_TIMEOUT (HZ / 3) @@ -61,12 +67,39 @@ */ void cpu_idle(void *unused) { +/*PPC*/ +#ifdef CONFIG_DEBUG_LEDS +LED_hex_val=0x200;LED_display_hex_val(); /* Displays 200 */ +LED_led_val=0x0;LED_display_led_val(); /* All leds off */ +#endif +/*\PPC*/ + /* endless idle loop with no priority at all */ +/*PPC*/ +#ifdef CONFIG_DEBUG_LEDS +/*PPC*/ LED_hex_val++;LED_display_hex_val(); /* Displays 201 */ +#endif +/*\PPC*/ init_idle(); +/*PPC*/ +#ifdef CONFIG_DEBUG_LEDS +/*PPC*/ LED_hex_val++;LED_display_hex_val(); /* Displays 202 */ +#endif +/*\PPC*/ current->priority = 0; current->counter = -100; +/*PPC*/ +#ifdef CONFIG_DEBUG_LEDS +/*PPC*/ LED_hex_val++;LED_display_hex_val(); /* Displays 203 */ +#endif +/*\PPC*/ while (1) { +/*PPC*/ +#ifdef CONFIG_DEBUG_LEDS +/*PPC*/ LED_led_val++;LED_display_led_val(); /* leds cycle a byte */ +#endif +/*\PPC*/ while (!current->need_resched) { if (hlt_counter) continue; diff -ruN linux-2.3.99_NY/arch/sh/kernel/setup.c linux-2.3.99_NY+PPC/arch/sh/kernel/setup.c --- linux-2.3.99_NY/arch/sh/kernel/setup.c Fri Apr 28 11:58:50 2000 +++ linux-2.3.99_NY+PPC/arch/sh/kernel/setup.c Mon May 8 16:20:03 2000 @@ -138,7 +138,9 @@ memory_start = (unsigned long)PAGE_OFFSET+__MEMORY_START; /* Default is 4Mbyte. */ - memory_end = (unsigned long)PAGE_OFFSET+0x00400000+__MEMORY_START; +/*PPC memory_end = (unsigned long)PAGE_OFFSET+0x00400000+__MEMORY_START;*/ +/*PPC ... 16Mbyte. */ +/*PPC*/ memory_end = (unsigned long)PAGE_OFFSET+(CONFIG_MEMORY_SIZE<<10)+__MEMORY_START; for (;;) { /* diff -ruN linux-2.3.99_NY/drivers/char/sh-sci.c linux-2.3.99_NY+PPC/drivers/char/sh-sci.c --- linux-2.3.99_NY/drivers/char/sh-sci.c Sun May 7 17:31:59 2000 +++ linux-2.3.99_NY+PPC/drivers/char/sh-sci.c Mon May 8 16:04:21 2000 @@ -115,37 +115,73 @@ static void sci_set_baud(struct sci_port *port) { int t; +/*PPC*/ int cks=0; switch (port->gs.baud) { case 0: t = -1; break; +/*PPC*/ + case 110: + t = BPS_110; + cks = CKS_BPS_110; + break; + case 150: + t = BPS_150; + cks = CKS_BPS_150; + break; + case 300: + t = BPS_300; + cks = CKS_BPS_300; + break; + case 600: + t = BPS_600; + cks = CKS_BPS_600; + break; + case 1200: + t = BPS_1200; + cks = CKS_BPS_1200; + break; +/*\PPC*/ case 2400: t = BPS_2400; +/*PPC*/ cks = CKS_BPS_2400; break; case 4800: t = BPS_4800; +/*PPC*/ cks = CKS_BPS_4800; break; case 9600: t = BPS_9600; +/*PPC*/ cks = CKS_BPS_9600; break; case 19200: t = BPS_19200; +/*PPC*/ cks = CKS_BPS_19200; break; case 38400: t = BPS_38400; +/*PPC*/ cks = CKS_BPS_38400; + break; +/*PPC*/ + case 57600: + t = BPS_57600; + cks = CKS_BPS_57600; break; +/*\PPC*/ default: printk(KERN_INFO "sci: unsupported baud rate: %d, use 115200 instead.\n", port->gs.baud); case 115200: t = BPS_115200; +/*PPC*/ cks = CKS_BPS_115200; break; } if (t > 0) { sci_setsignals (port, 1, -1); if(t >= 256) { - ctrl_out((ctrl_in(SCSMR) & ~3) | 1, SCSMR); +/*PPC ctrl_out((ctrl_in(SCSMR) & ~3) | 1, SCSMR);*/ +/*PPC*/ ctrl_out((ctrl_in(SCSMR) & ~3) | cks, SCSMR); t >>= 2; } ctrl_outb(t, SCBRR); @@ -684,8 +720,10 @@ sci_driver.type = TTY_DRIVER_TYPE_SERIAL; sci_driver.subtype = SERIAL_TYPE_NORMAL; sci_driver.init_termios = tty_std_termios; - sci_driver.init_termios.c_cflag = - B115200 | CS8 | CREAD | HUPCL | CLOCAL | CRTSCTS; +/*PPC sci_driver.init_termios.c_cflag =*/ +/*PPC B115200 | CS8 | CREAD | HUPCL | CLOCAL | CRTSCTS;*/ +/*PPC*/ sci_driver.init_termios.c_cflag = +/*PPC*/ SCI_DEFAULT_SPEED | CS8 | CREAD | HUPCL | CLOCAL; sci_driver.flags = TTY_DRIVER_REAL_RAW; sci_driver.refcount = &sci_refcount; sci_driver.table = sci_table; @@ -772,6 +810,7 @@ #ifdef CONFIG_DEBUG_KERNEL_WITH_GDB_STUB gdb_detach(); #endif +/*PPC*/ printk(KERN_ERR "SCI serial driver registered (major 4)\n"); return 0; /* Return -EIO when not detected */ } @@ -949,7 +988,8 @@ */ static int __init serial_console_setup(struct console *co, char *options) { - int baud = 115200; +/*PPC int baud = 115200;*/ +/*PPC*/ int baud = SCI_DEFAULT_SPEED_VAL; int bits = 8; int parity = 'n'; int cflag = CREAD | HUPCL | CLOCAL; @@ -1005,6 +1045,19 @@ co->cflag = cflag; /* XXX: set baud, char, and parity here. */ +/*PPC*/ + { + struct termios termios; + struct tty_struct tty; + struct sci_port port; + + termios.c_cflag=cflag; + port.gs.baud=baud; + tty.termios=&termios; + port.gs.tty=&tty; + sci_set_termios_cflag(&port); + } +/*\PPC*/ return 0; } diff -ruN linux-2.3.99_NY/drivers/char/sh-sci.h linux-2.3.99_NY+PPC/drivers/char/sh-sci.h --- linux-2.3.99_NY/drivers/char/sh-sci.h Thu May 4 21:46:04 2000 +++ linux-2.3.99_NY+PPC/drivers/char/sh-sci.h Mon May 8 15:57:05 2000 @@ -9,6 +9,9 @@ */ #include <linux/config.h> +/*PPC*/ #define SCI_DEFAULT_SPEED B9600 +/*PPC*/ #define SCI_DEFAULT_SPEED_VAL 9600 + #if defined(CONFIG_SH_SCI_SERIAL) #if defined(__sh3__) #define SCSMR (volatile unsigned char *)0xfffffe80 @@ -28,7 +31,8 @@ #define SCSPTR 0xffe0001c #endif -#define SCSCR_INIT 0x30 /* TIE=0,RIE=0,TE=1,RE=1 */ +/*PPC #define SCSCR_INIT 0x30 *//* TIE=0,RIE=0,TE=1,RE=1 */ +/*PPC*/ #define SCSCR_INIT 0x31 /* TIE=0,RIE=0,TE=1,RE=1,CKE1=0,CKE0=1*/ #define SCI_TD_E 0x80 #define SCI_RD_F 0x40 @@ -198,12 +202,12 @@ * Should we have config option for peripheral clock? * Or we get the value from time.c. */ -#if defined(__sh3__) +/*PPC #if defined(__sh3__) #if defined(CONFIG_CPU_SUBTYPE_SH7709) #define PCLK 33333333 #else -#define PCLK 14745600 /* Isn't it 15MHz? */ -#endif +#define PCLK 14745600 *//* Isn't it 15MHz? */ +/*#endif #elif defined(__SH4__) #define PCLK 33333333 #endif @@ -214,4 +218,33 @@ #define BPS_9600 SCBRR_VALUE(9600) #define BPS_19200 SCBRR_VALUE(19200) #define BPS_38400 SCBRR_VALUE(38400) -#define BPS_115200 SCBRR_VALUE(115200) +#define BPS_115200 SCBRR_VALUE(115200)*/ + +/* PPC : This table is made from the Hitachi 7707 hardware manual, with + additions from Gary Cline (Hypercom) for higher speed baudrates. It assumes + a bus clock of 30Mhz. It also specifies the clock source so that we can use + a greater range of baudrates */ +#define BPS_110 132 +#define CKS_BPS_110 3 +#define BPS_150 97 +#define CKS_BPS_150 2 +#define BPS_300 194 +#define CKS_BPS_300 2 +#define BPS_600 97 +#define CKS_BPS_600 2 +#define BPS_1200 194 +#define CKS_BPS_1200 1 +#define BPS_2400 97 +#define CKS_BPS_2400 1 +#define BPS_4800 194 +#define CKS_BPS_4800 0 +#define BPS_9600 97 +#define CKS_BPS_9600 0 +#define BPS_19200 48 +#define CKS_BPS_19200 0 +#define BPS_38400 23 +#define CKS_BPS_38400 0 +#define BPS_57600 15 +#define CKS_BPS_57600 0 +#define BPS_115200 7 +#define CKS_BPS_115200 0 Only in linux-2.3.99_NY+PPC/include: asm diff -ruN linux-2.3.99_NY/include/asm-sh/debug_leds.h linux-2.3.99_NY+PPC/include/asm-sh/debug_leds.h --- linux-2.3.99_NY/include/asm-sh/debug_leds.h Wed Dec 31 17:00:00 1969 +++ linux-2.3.99_NY+PPC/include/asm-sh/debug_leds.h Mon May 8 15:43:42 2000 @@ -0,0 +1,15 @@ +/* Addresses */ +#define LED_HEX_DISPLAY_ADDR 0xa8060000 +#define LED_LED_DISPLAY_ADDR 0xa8040000 + + + +/* Global vars */ +extern unsigned long LED_hex_val; +extern unsigned char LED_led_val; + + + +/* Function prototypes */ +void LED_display_hex_val(void); +void LED_display_led_val(void); diff -ruN linux-2.3.99_NY/init/main.c linux-2.3.99_NY+PPC/init/main.c --- linux-2.3.99_NY/init/main.c Sat Apr 29 09:46:04 2000 +++ linux-2.3.99_NY+PPC/init/main.c Mon May 8 15:43:01 2000 @@ -67,6 +67,12 @@ #include <asm/smp.h> #endif +/*PPC*/ +#ifdef CONFIG_DEBUG_LEDS +#include "asm/debug_leds.h" +#endif +/*\PPC*/ + /* * Versions of gcc older than that listed below may actually compile * and link okay, but the end product can have subtle run time bugs. @@ -512,19 +518,77 @@ { char * command_line; unsigned long mempages; + +/*PPC*/ +#ifdef CONFIG_DEBUG_LEDS +LED_hex_val=0x100;LED_display_hex_val(); /* Displays 100 */ +#endif +/*\PPC*/ + /* * Interrupts are still disabled. Do necessary setups, then * enable them */ +/*PPC*/ +#ifdef CONFIG_DEBUG_LEDS +/*PPC*/ LED_hex_val++;LED_display_hex_val(); /* Displays 101 */ +#endif +/*\PPC*/ lock_kernel(); +/*PPC*/ +#ifdef CONFIG_DEBUG_LEDS +/*PPC*/ LED_hex_val++;LED_display_hex_val(); /* Displays 102 */ +#endif +/*\PPC*/ printk(linux_banner); +/*PPC*/ +#ifdef CONFIG_DEBUG_LEDS +/*PPC*/ LED_hex_val++;LED_display_hex_val(); /* Displays 103 */ +#endif +/*\PPC*/ setup_arch(&command_line); +/*PPC*/ +#ifdef CONFIG_DEBUG_LEDS +/*PPC*/ LED_hex_val++;LED_display_hex_val(); /* Displays 104 */ +/*PPC*/ LED_hex_val++;LED_display_hex_val(); /* Displays 105 */ +#endif +/*\PPC*/ trap_init(); +/*PPC*/ +#ifdef CONFIG_DEBUG_LEDS +/*PPC*/ LED_hex_val++;LED_display_hex_val(); /* Displays 106 */ +#endif +/*\PPC*/ init_IRQ(); +/*PPC*/ +#ifdef CONFIG_DEBUG_LEDS +/*PPC*/ LED_hex_val++;LED_display_hex_val(); /* Displays 107 */ +#endif +/*\PPC*/ sched_init(); +/*PPC*/ +#ifdef CONFIG_DEBUG_LEDS +/*PPC*/ LED_hex_val++;LED_display_hex_val(); /* Displays 108 */ +#endif +/*\PPC*/ time_init(); +/*PPC*/ +#ifdef CONFIG_DEBUG_LEDS +/*PPC*/ LED_hex_val++;LED_display_hex_val(); /* Displays 109 */ +#endif +/*\PPC*/ softirq_init(); +/*PPC*/ +#ifdef CONFIG_DEBUG_LEDS +/*PPC*/ LED_hex_val++;LED_display_hex_val(); /* Displays 10A */ +#endif +/*\PPC*/ parse_options(command_line); +/*PPC*/ +#ifdef CONFIG_DEBUG_LEDS +/*PPC*/ LED_hex_val++;LED_display_hex_val(); /* Displays 10B */ +#endif +/*\PPC*/ /* * HACK ALERT! This is early. We're enabling the console before @@ -532,9 +596,19 @@ * this. But we do want output early, in case something goes wrong. */ console_init(); +/*PPC*/ +#ifdef CONFIG_DEBUG_LEDS +/*PPC*/ LED_hex_val++;LED_display_hex_val(); /* Displays 10C */ +#endif +/*\PPC*/ #ifdef CONFIG_MODULES init_modules(); #endif +/*PPC*/ +#ifdef CONFIG_DEBUG_LEDS +/*PPC*/ LED_hex_val++;LED_display_hex_val(); /* Displays 10D */ +#endif +/*\PPC*/ if (prof_shift) { unsigned int size; /* only text is profiled */ @@ -544,10 +618,30 @@ size = prof_len * sizeof(unsigned int) + PAGE_SIZE-1; prof_buffer = (unsigned int *) alloc_bootmem(size); } +/*PPC*/ +#ifdef CONFIG_DEBUG_LEDS +/*PPC*/ LED_hex_val++;LED_display_hex_val(); /* Displays 10E */ +#endif +/*\PPC*/ kmem_cache_init(); +/*PPC*/ +#ifdef CONFIG_DEBUG_LEDS +/*PPC*/ LED_hex_val++;LED_display_hex_val(); /* Displays 10F */ +#endif +/*\PPC*/ sti(); +/*PPC*/ +#ifdef CONFIG_DEBUG_LEDS +/*PPC*/ LED_hex_val++;LED_display_hex_val(); /* Displays 110 */ +#endif +/*\PPC*/ calibrate_delay(); +/*PPC*/ +#ifdef CONFIG_DEBUG_LEDS +/*PPC*/ LED_hex_val++;LED_display_hex_val(); /* Displays 111 */ +#endif +/*\PPC*/ #ifdef CONFIG_BLK_DEV_INITRD if (initrd_start && !initrd_below_start_ok && initrd_start < min_low_pfn << PAGE_SHIFT) { @@ -556,46 +650,166 @@ initrd_start = 0; } #endif +/*PPC*/ +#ifdef CONFIG_DEBUG_LEDS +/*PPC*/ LED_hex_val++;LED_display_hex_val(); /* Displays 112 */ +#endif +/*\PPC*/ mem_init(); +/*PPC*/ +#ifdef CONFIG_DEBUG_LEDS +/*PPC*/ LED_hex_val++;LED_display_hex_val(); /* Displays 113 */ +#endif +/*\PPC*/ kmem_cache_sizes_init(); +/*PPC*/ +#ifdef CONFIG_DEBUG_LEDS +/*PPC*/ LED_hex_val++;LED_display_hex_val(); /* Displays 114 */ +#endif +/*\PPC*/ #ifdef CONFIG_3215_CONSOLE con3215_activate(); #endif #ifdef CONFIG_PROC_FS proc_root_init(); #endif +/*PPC*/ +#ifdef CONFIG_DEBUG_LEDS +/*PPC*/ LED_hex_val++;LED_display_hex_val(); /* Displays 115 */ +#endif +/*\PPC*/ mempages = num_physpages; fork_init(mempages); +/*PPC*/ +#ifdef CONFIG_DEBUG_LEDS +/*PPC*/ LED_hex_val++;LED_display_hex_val(); /* Displays 116 */ +#endif +/*\PPC*/ filescache_init(); +/*PPC*/ +#ifdef CONFIG_DEBUG_LEDS +/*PPC*/ LED_hex_val++;LED_display_hex_val(); /* Displays 117 */ +#endif +/*\PPC*/ dcache_init(mempages); +/*PPC*/ +#ifdef CONFIG_DEBUG_LEDS +/*PPC*/ LED_hex_val++;LED_display_hex_val(); /* Displays 118 */ +#endif +/*\PPC*/ vma_init(); +/*PPC*/ +#ifdef CONFIG_DEBUG_LEDS +/*PPC*/ LED_hex_val++;LED_display_hex_val(); /* Displays 119 */ +#endif +/*\PPC*/ buffer_init(mempages); +/*PPC*/ +#ifdef CONFIG_DEBUG_LEDS +/*PPC*/ LED_hex_val++;LED_display_hex_val(); /* Displays 11A */ +#endif +/*\PPC*/ page_cache_init(mempages); +/*PPC*/ +#ifdef CONFIG_DEBUG_LEDS +/*PPC*/ LED_hex_val++;LED_display_hex_val(); /* Displays 11B */ +#endif +/*\PPC*/ kiobuf_setup(); +/*PPC*/ +#ifdef CONFIG_DEBUG_LEDS +/*PPC*/ LED_hex_val++;LED_display_hex_val(); /* Displays 11C */ +#endif +/*\PPC*/ signals_init(); +/*PPC*/ +#ifdef CONFIG_DEBUG_LEDS +/*PPC*/ LED_hex_val++;LED_display_hex_val(); /* Displays 11D */ +#endif +/*\PPC*/ bdev_init(); +/*PPC*/ +#ifdef CONFIG_DEBUG_LEDS +/*PPC*/ LED_hex_val++;LED_display_hex_val(); /* Displays 11E */ +#endif +/*\PPC*/ inode_init(mempages); +/*PPC*/ +#ifdef CONFIG_DEBUG_LEDS +/*PPC*/ LED_hex_val++;LED_display_hex_val(); /* Displays 11F */ +#endif +/*\PPC*/ file_table_init(); +/*PPC*/ +#ifdef CONFIG_DEBUG_LEDS +/*PPC*/ LED_hex_val++;LED_display_hex_val(); /* Displays 120 */ +#endif +/*\PPC*/ #if defined(CONFIG_SYSVIPC) ipc_init(); #endif #if defined(CONFIG_QUOTA) dquot_init_hash(); #endif +/*PPC*/ +#ifdef CONFIG_DEBUG_LEDS +/*PPC*/ LED_hex_val++;LED_display_hex_val(); /* Displays 121 */ +#endif +/*\PPC*/ check_bugs(); +/*PPC*/ +#ifdef CONFIG_DEBUG_LEDS +/*PPC*/ LED_hex_val++;LED_display_hex_val(); /* Displays 122 */ +#endif +/*\PPC*/ printk("POSIX conformance testing by UNIFIX\n"); +/*PPC*/ +#ifdef CONFIG_DEBUG_LEDS +/*PPC*/ LED_hex_val++;LED_display_hex_val(); /* Displays 123 */ +#endif +/*\PPC*/ /* * We count on the initial thread going ok * Like idlers init is an unlocked kernel thread, which will * make syscalls (and thus be locked). */ +/*PPC*/ +#ifdef CONFIG_DEBUG_LEDS +/*PPC*/ LED_hex_val++;LED_display_hex_val(); /* Displays 124 */ +#endif +/*\PPC*/ smp_init(); +/*PPC*/ +#ifdef CONFIG_DEBUG_LEDS +/*PPC*/ LED_hex_val++;LED_display_hex_val(); /* Displays 125 */ +#endif +/*\PPC*/ kernel_thread(init, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGHAND); +/*PPC*/ +#ifdef CONFIG_DEBUG_LEDS +/*PPC*/ LED_hex_val++;LED_display_hex_val(); /* Displays 126 */ +#endif +/*\PPC*/ unlock_kernel(); +/*PPC*/ +#ifdef CONFIG_DEBUG_LEDS +/*PPC*/ LED_hex_val++;LED_display_hex_val(); /* Displays 127 */ +#endif +/*\PPC*/ current->need_resched = 1; +/*PPC*/ +#ifdef CONFIG_DEBUG_LEDS +/*PPC*/ LED_hex_val++;LED_display_hex_val(); /* Displays 128 */ +#endif +/*\PPC*/ cpu_idle(); +/*PPC*/ +#ifdef CONFIG_DEBUG_LEDS +/*PPC*/ LED_hex_val++;LED_display_hex_val(); /* Displays 129 */ +#endif +/*\PPC*/ } #ifdef CONFIG_BLK_DEV_INITRD diff -ruN linux-2.3.99_NY/spit_vmlinux.lin linux-2.3.99_NY+PPC/spit_vmlinux.lin --- linux-2.3.99_NY/spit_vmlinux.lin Wed Dec 31 17:00:00 1969 +++ linux-2.3.99_NY+PPC/spit_vmlinux.lin Mon May 8 15:18:28 2000 @@ -0,0 +1,41 @@ +#!/bin/sh + +ELF_HEADER_SIZE=4096 +#LOAD_ADDRESS=0x8c015000 +#STRT_ADDRESS=0x8c016000 +LOAD_ADDRESS=0x8c001000 +STRT_ADDRESS=0x8c002000 +ROOT_FS_DEV=0x101 #/dev/ram +RAMDISK_FLAGS=0x4000 #Do load the ramdisk +INITRD_FILENAME=./initrd.gz + +#Strip out the ELF header +#PPC dd if=./vmlinux of=./vmlinux.stripped bs=${ELF_HEADER_SIZE} skip=1 +sh-pc-linux-gnu-objcopy -Obinary vmlinux vmlinux.stripped + +#Pad the kernel file so it's 4-bytes aligned +cp ./vmlinux.stripped ./vmlinux.padded +KERNEL_FILE_SIZE=`cat ./vmlinux.padded | wc -c` +let BYTES_MISSING=4-KERNEL_FILE_SIZE%4 +if [ ${BYTES_MISSING} -lt 4 ];then + dd if=/dev/zero bs=1 count=${BYTES_MISSING} >> ./vmlinux.padded + let KERNEL_FILE_SIZE=KERNEL_FILE_SIZE+BYTES_MISSING +fi + +#Calculate the start address of the initrd fs in memory +let INITRD_START=LOAD_ADDRESS+KERNEL_FILE_SIZE +#let INITRD_START=INITRD_START\&0x00ffffff +INITRD_FILE_SIZE=`cat ${INITRD_FILENAME} | wc -c` + +#Poke those values + others in the kernel's header +dd if=./vmlinux.padded of=./vmlinux+initrd bs=1 count=4 +./strtoul ${RAMDISK_FLAGS} >> ./vmlinux+initrd +./strtoul ${ROOT_FS_DEV} >> ./vmlinux+initrd +dd if=./vmlinux.padded bs=1 skip=12 count=4 >> ./vmlinux+initrd +./strtoul ${INITRD_START} >> ./vmlinux+initrd +./strtoul ${INITRD_FILE_SIZE} >> ./vmlinux+initrd +dd if=./vmlinux.padded bs=24 skip=1 >> ./vmlinux+initrd +dd if=${INITRD_FILENAME} >> ./vmlinux+initrd + +#Create the LIN file +../litools/bin2lin ./vmlinux+initrd ./vmlinux.lin ${LOAD_ADDRESS} ${STRT_ADDRESS} diff -ruN linux-2.3.99_NY/strtoul.c linux-2.3.99_NY+PPC/strtoul.c --- linux-2.3.99_NY/strtoul.c Wed Dec 31 17:00:00 1969 +++ linux-2.3.99_NY+PPC/strtoul.c Mon May 8 15:18:35 2000 @@ -0,0 +1,19 @@ +#include <stdio.h> +#include <stdlib.h> + +int main(int argc,char **argv) +{ + unsigned long val; + + if(argc!=2) + return(-1); + + val=strtoul(argv[1],NULL,0); + + printf("%c",(val & 0x000000ff)); + printf("%c",(val & 0x0000ff00) >> 8); + printf("%c",(val & 0x00ff0000) >> 16); + printf("%c",(val & 0xff000000) >> 24); + + return(0); +} --8<--8<--SNIP-SNIP--8<--8<-- |