Changes for U-Boot 0.4.5:
======================================================================
+* Implement new mechanism to export U-Boot's functions to standalone
+ applications: instead of using (PPC-specific) system calls we now
+ use a jump table; please see doc/README.standalone for details
+
+* Patch by Dave Westwood, 24 Jul 2003:
+ added support for Unity OS (a proprietary OS)
+
+* Patch by Detlev Zundel, 23 Jul 2003:
+ add "imls" command to print flash table of contents
+
+* Fix cold boot detection for log buffer reset
+
+* Return error for invalid length specifiers with "cp.X" etc.
+
+* Fix startup problem on MIPS
+
+* Allow for CONFIG_SPLASH_SCREEN even when no explicit
+ bitmap support is configured
+
+* Patch by Bill Hargen, 18 Jul 2003:
+ - fix endinaness problem in cpu/mpc824x/drivers/i2c/i2c1.c
+
+* Patch by Denis Peter, 18 Jul 2003:
+ - fix memory configuration for MIP405T
+ - fix printout of baudrate for "loadb <loadaddr> <baudrate>"
+
+* Cleanup of TQM82xx configurations; use "official" board types
+ to make selection easier.
+
* Patch by Martin Krause, 17 Jul 2003:
add delay to get I2C working with "imm" command and s3c24x0_i2c.c
gw8260 hymod IPHASE4539 MPC8260ADS \
MPC8266ADS PM826 ppmc8260 RPXsuper \
rsdproto sacsng sbc8260 SCM \
- TQM8260 \
+ TQM8260_AC TQM8260_AD TQM8260_AE \
"
#########################################################################
SCM_config: unconfig
@./mkconfig $(@:_config=) ppc mpc8260 SCM siemens
-TQM8255_config \
-TQM8260_config \
-TQM8260_L2_config \
-TQM8255_266MHz_config \
-TQM8260_266MHz_config \
-TQM8260_L2_266MHz_config \
-TQM8255_300MHz_config \
-TQM8260_300MHz_config: unconfig
- @ >include/config.h
- @if [ "$(findstring _L2_,$@)" ] ; then \
+TQM8255_AA_config \
+TQM8260_AA_config \
+TQM8260_AB_config \
+TQM8260_AC_config \
+TQM8260_AD_config \
+TQM8260_AE_config \
+TQM8260_AF_config \
+TQM8260_AG_config \
+TQM8260_AH_config \
+TQM8265_AA_config: unconfig
+ @case "$@" in \
+ TQM8255_AA_config) CTYPE=MPC8255; CFREQ=300; CACHE=no; BMODE=8260;; \
+ TQM8260_AA_config) CTYPE=MPC8260; CFREQ=200; CACHE=no; BMODE=8260;; \
+ TQM8260_AB_config) CTYPE=MPC8260; CFREQ=200; CACHE=yes; BMODE=60x;; \
+ TQM8260_AC_config) CTYPE=MPC8260; CFREQ=200; CACHE=yes; BMODE=60x;; \
+ TQM8260_AD_config) CTYPE=MPC8260; CFREQ=300; CACHE=no; BMODE=60x;; \
+ TQM8260_AE_config) CTYPE=MPC8260; CFREQ=266; CACHE=no; BMODE=8260;; \
+ TQM8260_AF_config) CTYPE=MPC8260; CFREQ=300; CACHE=no; BMODE=60x;; \
+ TQM8260_AG_config) CTYPE=MPC8260; CFREQ=300; CACHE=no; BMODE=8260;; \
+ TQM8260_AH_config) CTYPE=MPC8260; CFREQ=300; CACHE=yes; BMODE=60x;; \
+ TQM8265_AA_config) CTYPE=MPC8265; CFREQ=300; CACHE=no; BMODE=60x;; \
+ esac; \
+ >include/config.h ; \
+ if [ "$${CTYPE}" != "MPC8260" ] ; then \
+ echo "#define CONFIG_$${CTYPE}" >>include/config.h ; \
+ fi; \
+ echo "#define CONFIG_$${CFREQ}MHz" >>include/config.h ; \
+ echo "... with $${CFREQ}MHz system clock" ; \
+ if [ "$${CACHE}" == "yes" ] ; then \
echo "#define CONFIG_L2_CACHE" >>include/config.h ; \
- echo "... with L2 Cache support (60x Bus Mode)" ; \
+ echo "... with L2 Cache support" ; \
else \
echo "#undef CONFIG_L2_CACHE" >>include/config.h ; \
echo "... without L2 Cache support" ; \
+ fi; \
+ if [ "$${BMODE}" == "60x" ] ; then \
+ echo "#define CONFIG_BUSMODE_60x" >>include/config.h ; \
+ echo "... with 60x Bus Mode" ; \
+ else \
+ echo "#undef CONFIG_BUSMODE_60x" >>include/config.h ; \
+ echo "... without 60x Bus Mode" ; \
fi
- @[ -z "$(findstring _266MHz,$@)" ] || \
- { echo "#define CONFIG_266MHz" >>include/config.h ; \
- echo "... with 266MHz system clock" ; \
- }
- @[ -z "$(findstring _300MHz,$@)" ] || \
- { echo "#define CONFIG_300MHz" >>include/config.h ; \
- echo "... with 300MHz system clock" ; \
- }
- @[ -z "$(findstring TQM8255_,$@)" ] || \
- { echo "#define CONFIG_MPC8255" >>include/config.h ; }
@./mkconfig -a TQM8260 ppc mpc8260 tqm8260
atc_config: unconfig
#include <command.h>
#include <malloc.h>
#include <devices.h>
-#include <syscall.h>
#include <net.h>
#include <version.h>
#include <dtt.h>
/*
* Jump to the main U-Boot board init code
*/
- board_init_r(gd, dest_addr);
+ board_init_r((gd_t *)gd, dest_addr);
}
/* ------------------------------------------------------------------------- */
/*
* Jump to the main U-Boot board init code
*/
- board_init_r (gd, dest_addr);
+ board_init_r ((gd_t *)gd, dest_addr);
}
/* ------------------------------------------------------------------------- */
}
/* now, jump to the main U-Boot board init code */
- board_init_r (gd, dest_addr);
+ board_init_r ((gd_t *)gd, dest_addr);
/* NOTREACHED */
}
* Returns 1 if keys pressed to start the power-on long-running tests
* Called from board_init_f().
*/
-int post_hotkeys_pressed(gd_t *gd)
+int post_hotkeys_pressed(void)
{
uchar kbd_data[KEYBD_DATALEN];
uchar val;
CFG_MONITOR_BASE+monitor_flash_len-1,
&flash_info[0]);
#endif
+ /* protect reset vector */
+ flash_info[0].protect[flash_info[0].sector_count-1] = 1;
size_b1 = 0 ;
flash_info[0].size = size_b0;
#if 0
}
-int mem_test (unsigned long start, unsigned long ramsize, int quiet, int reloc)
+int mem_test (unsigned long start, unsigned long ramsize, int quiet)
{
unsigned long errors, stage;
unsigned long startaddr, size, i;
#if !defined(CONFIG_MIP405T)
{PCI_CFG_PIIX4_IDETIM, 0x80008000, 4}, /* enable Both IDE channels */
#else
- {PCI_CFG_PIIX4_IDETIM, 0x80000000, 4}, /* enable IDE channel0 */
+ {PCI_CFG_PIIX4_IDETIM, 0x00008000, 4}, /* enable IDE channel0 */
#endif
{ } /* end of device table */
};
#include <miiphy.h>
#include "../common/common_util.h"
#include <i2c.h>
+#include <rtc.h>
extern block_dev_desc_t * scsi_get_dev(int dev);
extern block_dev_desc_t * ide_get_dev(int dev);
} sdram_t;
#if defined(CONFIG_MIP405T)
const sdram_t sdram_table[] = {
- { 0x01, /* MIP405T Rev A, 64MByte -1 Board */
+ { 0x0F, /* MIP405T Rev A, 64MByte -1 Board */
3, /* Case Latenty = 3 */
3, /* trp 20ns / 7.5 ns datain[27] */
3, /* trcd 20ns /7.5 ns (datain[29]) */
6, /* tras 44ns /7.5 ns (datain[30]) */
4, /* tcpt 44 - 20ns = 24ns */
- 3, /* Address Mode = 3 (13x9x4) */
- 4, /* size value (64MByte) */
+ 2, /* Address Mode = 2 (12x9x4) */
+ 3, /* size value (32MByte) */
0}, /* ECC disabled */
{ 0xff, /* terminator */
0xff,
if((bc & 0x80)==0x80)
SDRAM_err ("U-Boot configured for a MIP405 not for a MIP405T!!!\n");
#endif
-#if !defined(CONFIG_MIP405T)
- /* since the ECC initialisation needs some time,
- * we show that we're alive
- */
- serial_puts ("\nInitializing SDRAM, Please stand by");
/* set-up the chipselect machine */
mtdcr (ebccfga, pb0cr); /* get cs0 config reg */
tmp = mfdcr (ebccfgd);
mtdcr (ebccfgd, UART1_AP);
mtdcr (ebccfga, pb3cr);
mtdcr (ebccfgd, UART1_CR);
-#endif
bc = in8 (PLD_BOARD_CFG_REG);
#ifdef SDRAM_DEBUG
serial_puts ("\nstart SDRAM Setup\n");
write_hex (i);
serial_puts (" \n");
#endif
+ /* since the ECC initialisation needs some time,
+ * we show that we're alive
+ */
+ if (sdram_table[i].ecc)
+ serial_puts ("\nInitializing SDRAM, Please stand by");
cal_val = sdram_table[i].cal - 1; /* Cas Latency */
trp_clocks = sdram_table[i].trp; /* 20ns / 7.5 ns datain[27] */
trcd_clocks = sdram_table[i].trcd; /* 20ns /7.5 ns (datain[29]) */
unsigned char bc;
bc = in8 (PLD_BOARD_CFG_REG);
*pcbrev=(bc >> 4) & 0xf;
- *var=bc & 0xf ;
+ *var=16-(bc & 0xf);
#endif
}
/* ------------------------------------------------------------------------- */
-extern int mem_test (unsigned long start, unsigned long ramsize,
- int quiet);
static int test_dram (unsigned long ramsize)
{
return (1);
}
+/* used to check if the time in RTC is valid */
+static unsigned long start;
+static struct rtc_time tm;
+
int misc_init_r (void)
{
+ /* check, if RTC is running */
+ rtc_get (&tm);
+ start=get_timer(0);
/* if MIP405 has booted from PCI, reset CCR0[24] as described in errata PCI_18 */
if (mfdcr(strap) & PSR_ROM_LOC)
mtspr(ccr0, (mfspr(ccr0) & ~0x80));
}
extern void mem_test_reloc(void);
+extern int mk_date (char *, struct rtc_time *);
int last_stage_init (void)
{
+ unsigned long stop;
+ struct rtc_time newtm;
+ unsigned char *s;
mem_test_reloc();
/* write correct LED configuration */
if (miiphy_write (0x1, 0x14, 0x2402) != 0) {
print_mip405_rev ();
show_stdio_dev ();
check_env ();
+ /* check if RTC time is valid */
+ stop=get_timer(start);
+ while(stop<1200) { /* we wait 1.2 sec to check if the RTC is running */
+ udelay(1000);
+ stop=get_timer(start);
+ }
+ rtc_get (&newtm);
+ if(tm.tm_sec==newtm.tm_sec) {
+ s=getenv("defaultdate");
+ if(!s)
+ mk_date ("010112001970", &newtm);
+ else
+ if(mk_date (s, &newtm)!=0) {
+ printf("RTC: Bad date format in defaultdate\n");
+ return 0;
+ }
+ rtc_reset ();
+ rtc_set(&newtm);
+ }
return 0;
}
printf ("SER1 uses handshakes %s\n",
(ext & 0x80) ? "DTR/DSR" : "RTS/CTS");
#else
- printf ("User Config Switch %d %d %d %d %d %d %d %d %d\n",
+ printf ("User Config Switch %d %d %d %d %d %d %d %d\n",
(ext) & 0x1, (ext >> 1) & 0x1, (ext >> 2) & 0x1,
(ext >> 3) & 0x1, (ext >> 4) & 0x1, (ext >> 5) & 0x1,
- (ext >> 6) & 0x1,(ext >> 7) & 0x1,(ext >> 8) & 0x1);
+ (ext >> 6) & 0x1,(ext >> 7) & 0x1);
#endif
printf ("IDE Reset %s\n", (ext & 0x01) ? "asserted" : "not asserted");
printf ("IRQs:\n");
/* Jump to the main U-Boot board init code
*/
- board_init_r (gd, dest_addr);
+ board_init_r ((gd_t *)gd, dest_addr);
}
int misc_init_r (void)
cmd_reginfo.o cmd_scsi.o cmd_spi.o cmd_usb.o cmd_vfd.o \
command.o console.o devices.o dlmalloc.o docecc.o \
environment.o env_common.o \
- env_flash.o env_eeprom.o env_nvram.o env_nowhere.o \
+ env_flash.o env_eeprom.o env_nvram.o env_nowhere.o exports.o \
flash.o fpga.o \
hush.o kgdb.o lists.o miiphybb.o miiphyutil.o \
s_record.o soft_i2c.o soft_spi.o spartan2.o \
#include <common.h>
#include <command.h>
#include <net.h>
-#include <syscall.h>
/* -------------------------------------------------------------------- */
int do_go (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
+#if defined(CONFIG_I386)
+ DECLARE_GLOBAL_DATA_PTR;
+#endif
ulong addr, rc;
int rcode = 0;
* pass address parameter as argv[0] (aka command name),
* and all remaining args
*/
+#if defined(CONFIG_I386)
+ /*
+ * x86 does not use a dedicated register to pass the pointer
+ * to the global_data
+ */
+ argv[0] = (char *)gd;
+#endif
rc = ((ulong (*)(int, char *[]))addr) (--argc, &argv[1]);
if (rc != 0) rcode = 1;
#if (CONFIG_COMMANDS & CFG_CMD_IMI)
static int image_info (unsigned long addr);
#endif
+
+#if (CONFIG_COMMANDS & CFG_CMD_IMLS)
+#include <flash.h>
+extern flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */
+static int do_imls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
+#endif
+
static void print_type (image_header_t *hdr);
#ifdef __I386__
#endif /* CFG_CMD_IMI */
+#if (CONFIG_COMMANDS & CFG_CMD_IMLS)
+/*-----------------------------------------------------------------------
+ * List all images found in flash.
+ */
+int do_imls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+ flash_info_t *info;
+ int i, j;
+ image_header_t *hdr;
+ ulong checksum;
+
+ for (i=0, info=&flash_info[0]; i<CFG_MAX_FLASH_BANKS; ++i, ++info) {
+ if (info->flash_id == FLASH_UNKNOWN)
+ goto next_bank;
+ for (j=0; j<CFG_MAX_FLASH_SECT; ++j) {
+
+ if (!(hdr=(image_header_t *)info->start[j]) ||
+ (ntohl(hdr->ih_magic) != IH_MAGIC))
+ goto next_sector;
+
+ /* Copy header so we can blank CRC field for re-calculation */
+ memmove (&header, (char *)hdr, sizeof(image_header_t));
+
+ checksum = ntohl(header.ih_hcrc);
+ header.ih_hcrc = 0;
+
+ if (crc32 (0, (char *)&header, sizeof(image_header_t))
+ != checksum)
+ goto next_sector;
+
+ printf ("Image at %08lX:\n", (ulong)hdr);
+ print_image_hdr( hdr );
+ putc ('\n');
+ next_sector:
+ }
+ next_bank:
+ }
+
+ return (0);
+}
+
+U_BOOT_CMD(
+ imls, 1, 1, do_imls,
+ "imls - list all images found in flash\n",
+ "\n"
+ " - Prints information about all images found at sector\n"
+ " boundaries in flash.\n"
+);
+#endif /* CFG_CMD_IMLS */
+
void
print_image_hdr (image_header_t *hdr)
{
#include <command.h>
#include <s_record.h>
#include <net.h>
-#include <syscall.h>
+#include <exports.h>
#if (CONFIG_COMMANDS & CFG_CMD_LOADS)
static int
read_record (char *buf, ulong len)
{
+ DECLARE_GLOBAL_DATA_PTR;
char *p;
char c;
}
/* Check for the console hangup (if any different from serial) */
-#ifdef CONFIG_PPC /* we don't have syscall_tbl anywhere else */
- if (syscall_tbl[SYSCALL_GETC] != serial_getc) {
+ if (gd->jt[XF_getc] != serial_getc) {
if (ctrlc()) {
return (-1);
}
}
-#endif
}
/* line too long - truncate */
printf ("## Ready for binary (kermit) download "
"to 0x%08lX at %d bps...\n",
offset,
- current_baudrate);
+ load_baudrate);
addr = load_serial_bin (offset);
if (addr == ~0) {
post_word = post_word_load();
#ifdef CONFIG_POST
/* The post routines have setup the word so we can simply test it */
- if (((post_word & 0xffff) == POST_POWERON) ||
- ((post_word & 0xffff) == POST_SLOWTEST)) {
+ if (post_word_load () & POST_COLDBOOT) {
logged_chars = log_size = log_start = 0;
*ext_tag = LOGBUFF_MAGIC;
}
return 2;
case 'l':
return 4;
+ default:
+ return -1;
}
}
return default_size;
#define DISP_LINE_LEN 16
int do_mem_md ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
- ulong addr, size, length;
+ ulong addr, length;
ulong i, nbytes, linebytes;
u_char *cp;
+ int size;
int rc = 0;
/* We use the last specified parameters, unless new ones are
/* New command specified. Check for a size specification.
* Defaults to long if no or incorrect specification.
*/
- size = cmd_get_data_size(argv[0], 4);
+ if ((size = cmd_get_data_size(argv[0], 4)) < 0)
+ return 1;
/* Address is specified since argc > 1
*/
int do_mem_mw ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
- ulong addr, size, writeval, count;
+ ulong addr, writeval, count;
+ int size;
if ((argc < 3) || (argc > 4)) {
printf ("Usage:\n%s\n", cmdtp->usage);
/* Check for size specification.
*/
- size = cmd_get_data_size(argv[0], 4);
+ if ((size = cmd_get_data_size(argv[0], 4)) < 1)
+ return 1;
/* Address is specified since argc > 1
*/
int do_mem_cmp (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
- ulong size, addr1, addr2, count, ngood;
+ ulong addr1, addr2, count, ngood;
+ int size;
int rcode = 0;
if (argc != 4) {
/* Check for size specification.
*/
- size = cmd_get_data_size(argv[0], 4);
+ if ((size = cmd_get_data_size(argv[0], 4)) < 0)
+ return 1;
addr1 = simple_strtoul(argv[1], NULL, 16);
addr1 += base_address;
int do_mem_cp ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
- ulong addr, size, dest, count;
+ ulong addr, dest, count;
+ int size;
if (argc != 4) {
printf ("Usage:\n%s\n", cmdtp->usage);
/* Check for size specification.
*/
- size = cmd_get_data_size(argv[0], 4);
+ if ((size = cmd_get_data_size(argv[0], 4)) < 0)
+ return 1;
addr = simple_strtoul(argv[1], NULL, 16);
addr += base_address;
int do_mem_loop (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
- ulong addr, size, length, i, junk;
+ ulong addr, length, i, junk;
+ int size;
volatile uint *longp;
volatile ushort *shortp;
volatile u_char *cp;
/* Check for a size spefication.
* Defaults to long if no or incorrect specification.
*/
- size = cmd_get_data_size(argv[0], 4);
+ if ((size = cmd_get_data_size(argv[0], 4)) < 0)
+ return 1;
/* Address is always specified.
*/
static int
mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char *argv[])
{
- ulong addr, size, i;
- int nbytes;
+ ulong addr, i;
+ int nbytes, size;
extern char console_buffer[];
if (argc != 2) {
/* New command specified. Check for a size specification.
* Defaults to long if no or incorrect specification.
*/
- size = cmd_get_data_size(argv[0], 4);
+ if ((size = cmd_get_data_size(argv[0], 4)) < 0)
+ return 1;
/* Address is specified since argc > 1
*/
#include <stdarg.h>
#include <malloc.h>
#include <console.h>
-#include <syscall.h>
-
-void **syscall_tbl;
+#include <exports.h>
#ifdef CONFIG_AMIGAONEG3SE
int console_changed = 0;
static int console_setfile (int file, device_t * dev)
{
+ DECLARE_GLOBAL_DATA_PTR;
int error = 0;
if (dev == NULL)
*/
switch (file) {
case stdin:
- syscall_tbl[SYSCALL_GETC] = dev->getc;
- syscall_tbl[SYSCALL_TSTC] = dev->tstc;
+ gd->jt[XF_getc] = dev->getc;
+ gd->jt[XF_tstc] = dev->tstc;
break;
case stdout:
- syscall_tbl[SYSCALL_PUTC] = dev->putc;
- syscall_tbl[SYSCALL_PUTS] = dev->puts;
- syscall_tbl[SYSCALL_PRINTF] = printf;
+ gd->jt[XF_putc] = dev->putc;
+ gd->jt[XF_puts] = dev->puts;
+ gd->jt[XF_printf] = printf;
break;
}
break;
/* Called after the relocation - use desired console functions */
int console_init_r (void)
{
+ DECLARE_GLOBAL_DATA_PTR;
char *stdinname, *stdoutname, *stderrname;
device_t *inputdev = NULL, *outputdev = NULL, *errdev = NULL;
/* set default handlers at first */
- syscall_tbl[SYSCALL_GETC] = serial_getc;
- syscall_tbl[SYSCALL_TSTC] = serial_tstc;
- syscall_tbl[SYSCALL_PUTC] = serial_putc;
- syscall_tbl[SYSCALL_PUTS] = serial_puts;
- syscall_tbl[SYSCALL_PRINTF] = serial_printf;
+ gd->jt[XF_getc] = serial_getc;
+ gd->jt[XF_tstc] = serial_tstc;
+ gd->jt[XF_putc] = serial_putc;
+ gd->jt[XF_puts] = serial_puts;
+ gd->jt[XF_printf] = serial_printf;
/* stdin stdout and stderr are in environment */
/* scan for it */
--- /dev/null
+#include <common.h>
+#include <exports.h>
+
+static void dummy(void)
+{
+}
+
+unsigned long get_version(void)
+{
+ return XF_VERSION;
+}
+
+void jumptable_init (void)
+{
+ DECLARE_GLOBAL_DATA_PTR;
+ int i;
+
+ gd->jt = (void **) malloc (XF_MAX * sizeof (void *));
+ for (i = 0; i < XF_MAX; i++)
+ gd->jt[i] = (void *) dummy;
+
+ gd->jt[XF_get_version] = (void *) get_version;
+ gd->jt[XF_malloc] = (void *) malloc;
+ gd->jt[XF_free] = (void *) free;
+ gd->jt[XF_get_timer] = (void *)get_timer;
+ gd->jt[XF_udelay] = (void *)udelay;
+#if defined(CONFIG_I386) || defined(CONFIG_PPC)
+ gd->jt[XF_install_hdlr] = (void *) irq_install_handler;
+ gd->jt[XF_free_hdlr] = (void *) irq_free_handler;
+#endif
+}
CPPFLAGS := $(DBGFLAGS) $(OPTFLAGS) $(RELFLAGS) \
-D__KERNEL__ -DTEXT_BASE=$(TEXT_BASE) \
-I$(TOPDIR)/include \
- -fno-builtin -nostdinc -isystem $(gccincdir) \
- -pipe $(PLATFORM_CPPFLAGS)
+ -fno-builtin -ffreestanding -nostdinc -isystem \
+ $(gccincdir) -pipe $(PLATFORM_CPPFLAGS)
ifdef BUILD_TAG
CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes \
STD_EXCEPTION(0x900, Decrementer, timer_interrupt)
STD_EXCEPTION(0xa00, Trap_0a, UnknownException)
STD_EXCEPTION(0xb00, Trap_0b, UnknownException)
-
- . = 0xc00
-/*
- * r0 - SYSCALL number
- * r3-... arguments
- */
-SystemCall:
- addis r11,r0,0 /* get functions table addr */
- ori r11,r11,0 /* Note: this code is patched in trap_init */
- addis r12,r0,0 /* get number of functions */
- ori r12,r12,0
-
- cmplw 0, r0, r12
- bge 1f
-
- rlwinm r0,r0,2,0,31 /* fn_addr = fn_tbl[r0] */
- add r11,r11,r0
- lwz r11,0(r11)
-
- li r20,0xd00-4 /* Get stack pointer */
- lwz r12,0(r20)
- subi r12,r12,12 /* Adjust stack pointer */
- li r0,0xc00+_end_back-SystemCall
- cmplw 0, r0, r12 /* Check stack overflow */
- bgt 1f
- stw r12,0(r20)
-
- mflr r0
- stw r0,0(r12)
- mfspr r0,SRR0
- stw r0,4(r12)
- mfspr r0,SRR1
- stw r0,8(r12)
-
- li r12,0xc00+_back-SystemCall
- mtlr r12
- mtspr SRR0,r11
-
-1: SYNC
- rfi
-
-_back:
-
- mfmsr r11 /* Disable interrupts */
- li r12,0
- ori r12,r12,MSR_EE
- andc r11,r11,r12
- SYNC /* Some chip revs need this... */
- mtmsr r11
- SYNC
-
- li r12,0xd00-4 /* restore regs */
- lwz r12,0(r12)
-
- lwz r11,0(r12)
- mtlr r11
- lwz r11,4(r12)
- mtspr SRR0,r11
- lwz r11,8(r12)
- mtspr SRR1,r11
-
- addi r12,r12,12 /* Adjust stack pointer */
- li r20,0xd00-4
- stw r12,0(r20)
-
- SYNC
- rfi
-_end_back:
-
+ STD_EXCEPTION(0xc00, SystemCall, UnknownException)
STD_EXCEPTION(0xd00, SingleStep, UnknownException)
STD_EXCEPTION(0xe00, Trap_0e, UnknownException)
*/
#include <common.h>
-#include <syscall.h>
#include <malloc.h>
#include <asm/io.h>
#include <asm/i8259.h>
static irq_desc_t irq_table[MAX_IRQ];
-
-asm(".globl syscall_entry\n" \
- "syscall_entry:\n" \
- "popl %ebx\n" /* throw away the return address, flags */ \
- "popl %ebx\n" /* and segment that the INT instruction pushed */ \
- "popl %ebx\n" /* on to the stack */ \
- "movl %eax, %ecx\n" /* load the syscall nr argument*/ \
- "movl syscall_tbl, %eax\n" /* load start of syscall table */ \
- "cmpl $(11-1), %ecx\n" /* FixMe: find a way to use NR_SYSCALLS macro here */ \
- "ja bad_syscall\n" \
- "movl (%eax, %ecx, 4), %eax\n" /* load the handler of the syscall*/ \
- "test %eax, %eax\n" /* test for null */ \
- "je bad_syscall\n" \
- "popl %ecx\n" \
- "popl %ebx\n" \
- "sti \n" \
- "jmp *%eax\n" \
-"bad_syscall: movl $0xffffffff, %eax\n" \
- "popl %ecx\n" \
- "popl %ebx\n" \
- "ret");
-
-void __attribute__ ((regparm(0))) syscall_entry(void);
-
-
asm ("irq_return:\n"
" addl $4, %esp\n"
" popa\n"
set_vector(0x2e, irq_14);
set_vector(0x2f, irq_15);
/* vectors 0x30-0x3f are reserved for irq 16-31 */
- set_vector(0x40, syscall_entry);
/* Mask all interrupts */
relocate_code:
move sp, a0 /* Set new stack pointer */
+ li t0, CFG_MONITOR_BASE
+ la t3, in_ram
+ lw t2, -12(t3) /* t2 <-- uboot_end_data */
+ move t1, a2
+
/*
* Fix GOT pointer:
*
add gp, a2 /* gp now adjusted */
sub t6, gp, t6 /* t6 <-- relocation offset */
- li t0, CFG_MONITOR_BASE
- la t3, in_ram
- lw t2, -12(t3) /* t2 <-- uboot_end_data */
- move t1, a2
-
/*
* t0 = source address
* t1 = target address
STD_EXCEPTION(0x900, Decrementer, timer_interrupt)
STD_EXCEPTION(0xa00, Trap_0a, UnknownException)
STD_EXCEPTION(0xb00, Trap_0b, UnknownException)
-
- . = 0xc00
-/*
- * r0 - SYSCALL number
- * r3-... arguments
- */
-SystemCall:
- addis r11,r0,0 /* get functions table addr */
- ori r11,r11,0 /* Note: this code is patched in trap_init */
- addis r12,r0,0 /* get number of functions */
- ori r12,r12,0
-
- cmplw 0, r0, r12
- bge 1f
-
- rlwinm r0,r0,2,0,31 /* fn_addr = fn_tbl[r0] */
- add r11,r11,r0
- lwz r11,0(r11)
-
- li r20,0xd00-4 /* Get stack pointer */
- lwz r12,0(r20)
- subi r12,r12,12 /* Adjust stack pointer */
- li r0,0xc00+_end_back-SystemCall
- cmplw 0, r0, r12 /* Check stack overflow */
- bgt 1f
- stw r12,0(r20)
-
- mflr r0
- stw r0,0(r12)
- mfspr r0,SRR0
- stw r0,4(r12)
- mfspr r0,SRR1
- stw r0,8(r12)
-
- li r12,0xc00+_back-SystemCall
- mtlr r12
- mtspr SRR0,r11
-
-1: SYNC
- rfi
-
-_back:
-
- mfmsr r11 /* Disable interrupts */
- li r12,0
- ori r12,r12,MSR_EE
- andc r11,r11,r12
- SYNC /* Some chip revs need this... */
- mtmsr r11
- SYNC
-
- li r12,0xd00-4 /* restore regs */
- lwz r12,0(r12)
-
- lwz r11,0(r12)
- mtlr r11
- lwz r11,4(r12)
- mtspr SRR0,r11
- lwz r11,8(r12)
- mtspr SRR1,r11
-
- addi r12,r12,12 /* Adjust stack pointer */
- li r20,0xd00-4
- stw r12,0(r20)
-
- SYNC
- rfi
-_end_back:
-
+ STD_EXCEPTION(0xc00, SystemCall, UnknownException)
STD_EXCEPTION(0xd00, SingleStep, UnknownException)
STD_EXCEPTION(0xe00, Trap_0e, UnknownException)
STD_EXCEPTION(0xa00, Trap_0a, UnknownException)
STD_EXCEPTION(0xb00, Trap_0b, UnknownException)
-
- . = 0xc00
-/*
- * r0 - SYSCALL number
- * r3-... arguments
- */
-SystemCall:
- addis r11,r0,0 /* get functions table addr */
- ori r11,r11,0 /* Note: this code is patched in trap_init */
- addis r12,r0,0 /* get number of functions */
- ori r12,r12,0
-
- cmplw 0, r0, r12
- bge 1f
-
- rlwinm r0,r0,2,0,31 /* fn_addr = fn_tbl[r0] */
- add r11,r11,r0
- lwz r11,0(r11)
-
- li r20,0xd00-4 /* Get stack pointer */
- lwz r12,0(r20)
- subi r12,r12,12 /* Adjust stack pointer */
- li r0,0xc00+_end_back-SystemCall
- cmplw 0, r0, r12 /* Check stack overflow */
- bgt 1f
- stw r12,0(r20)
-
- mflr r0
- stw r0,0(r12)
- mfspr r0,SRR0
- stw r0,4(r12)
- mfspr r0,SRR1
- stw r0,8(r12)
-
- li r12,0xc00+_back-SystemCall
- mtlr r12
- mtspr SRR0,r11
-
-1: SYNC
- rfi
-
-_back:
-
- mfmsr r11 /* Disable interrupts */
- li r12,0
- ori r12,r12,MSR_EE
- andc r11,r11,r12
- SYNC /* Some chip revs need this... */
- mtmsr r11
- SYNC
-
- li r12,0xd00-4 /* restore regs */
- lwz r12,0(r12)
-
- lwz r11,0(r12)
- mtlr r11
- lwz r11,4(r12)
- mtspr SRR0,r11
- lwz r11,8(r12)
- mtspr SRR1,r11
-
- addi r12,r12,12 /* Adjust stack pointer */
- li r20,0xd00-4
- stw r12,0(r20)
-
- SYNC
- rfi
-_end_back:
-
+ STD_EXCEPTION(0xc00, SystemCall, UnknownException)
STD_EXCEPTION(0xd00, SingleStep, UnknownException)
STD_EXCEPTION(0xe00, Trap_0e, UnknownException)
uchar *p;
int i;
- p = dummy_buffer;
/* fill in address in big endian order */
- for (i=0; i<alen; ++i)
- *p++ = (addr >> (i * 8)) & 0xFF;
+ for (i=alen-1; i>=0; --i) {
+ buffer[i] = addr & 0xFF;
+ addr >>= 8;
+ }
/* fill in data */
+ p = dummy_buffer + alen;
+
for (i=0; i<len; ++i)
- *p++ = *buffer;
+ *p++ = *buffer++;
status = I2C_do_buffer (0, I2C_MASTER_XMIT, chip, alen + len,
dummy_buffer, I2C_STOP, 1, I2C_NO_RESTART);
STD_EXCEPTION(EXC_OFF_DECR, Decrementer, timer_interrupt)
STD_EXCEPTION(0xa00, Trap_0a, UnknownException)
STD_EXCEPTION(0xb00, Trap_0b, UnknownException)
-
- . = 0xc00
-/*
- * r0 - SYSCALL number
- * r3-... arguments
- */
-SystemCall:
- addis r11,r0,0 /* get functions table addr */
- ori r11,r11,0 /* Note: this code is patched in trap_init */
- addis r12,r0,0 /* get number of functions */
- ori r12,r12,0
-
- cmplw 0, r0, r12
- bge 1f
-
- rlwinm r0,r0,2,0,31 /* fn_addr = fn_tbl[r0] */
- add r11,r11,r0
- lwz r11,0(r11)
-
- li r20,0xd00-4 /* Get stack pointer */
- lwz r12,0(r20)
- subi r12,r12,12 /* Adjust stack pointer */
- li r0,0xc00+_end_back-SystemCall
- cmplw 0, r0, r12 /* Check stack overflow */
- bgt 1f
- stw r12,0(r20)
-
- mflr r0
- stw r0,0(r12)
- mfspr r0,SRR0
- stw r0,4(r12)
- mfspr r0,SRR1
- stw r0,8(r12)
-
- li r12,0xc00+_back-SystemCall
- mtlr r12
- mtspr SRR0,r11
-
-1: SYNC
- rfi
-
-_back:
-
- mfmsr r11 /* Disable interrupts */
- li r12,0
- ori r12,r12,MSR_EE
- andc r11,r11,r12
- SYNC /* Some chip revs need this... */
- mtmsr r11
- SYNC
-
- li r12,0xd00-4 /* restore regs */
- lwz r12,0(r12)
-
- lwz r11,0(r12)
- mtlr r11
- lwz r11,4(r12)
- mtspr SRR0,r11
- lwz r11,8(r12)
- mtspr SRR1,r11
-
- addi r12,r12,12 /* Adjust stack pointer */
- li r20,0xd00-4
- stw r12,0(r20)
-
- SYNC
- rfi
-_end_back:
+ STD_EXCEPTION(0xc00, SystemCall, UnknownException)
STD_EXCEPTION(EXC_OFF_TRACE, SingleStep, UnknownException)
STD_EXCEPTION(0xa00, Trap_0a, UnknownException)
STD_EXCEPTION(0xb00, Trap_0b, UnknownException)
-
- . = 0xc00
-/*
- * r0 - SYSCALL number
- * r3-... arguments
- */
-SystemCall:
- addis r11,r0,0 /* get functions table addr */
- ori r11,r11,0 /* Note: this code is patched in trap_init */
- addis r12,r0,0 /* get number of functions */
- ori r12,r12,0
-
- cmplw 0, r0, r12
- bge 1f
-
- rlwinm r0,r0,2,0,31 /* fn_addr = fn_tbl[r0] */
- add r11,r11,r0
- lwz r11,0(r11)
-
- li r20,0xd00-4 /* Get stack pointer */
- lwz r12,0(r20)
- subi r12,r12,12 /* Adjust stack pointer */
- li r0,0xc00+_end_back-SystemCall
- cmplw 0, r0, r12 /* Check stack overflow */
- bgt 1f
- stw r12,0(r20)
-
- mflr r0
- stw r0,0(r12)
- mfspr r0,SRR0
- stw r0,4(r12)
- mfspr r0,SRR1
- stw r0,8(r12)
-
- li r12,0xc00+_back-SystemCall
- mtlr r12
- mtspr SRR0,r11
-
-1: SYNC
- rfi
-
-_back:
-
- mfmsr r11 /* Disable interrupts */
- li r12,0
- ori r12,r12,MSR_EE
- andc r11,r11,r12
- SYNC /* Some chip revs need this... */
- mtmsr r11
- SYNC
-
- li r12,0xd00-4 /* restore regs */
- lwz r12,0(r12)
-
- lwz r11,0(r12)
- mtlr r11
- lwz r11,4(r12)
- mtspr SRR0,r11
- lwz r11,8(r12)
- mtspr SRR1,r11
-
- addi r12,r12,12 /* Adjust stack pointer */
- li r20,0xd00-4
- stw r12,0(r20)
-
- SYNC
- rfi
-_end_back:
-
+ STD_EXCEPTION(0xc00, SystemCall, UnknownException)
STD_EXCEPTION(0xd00, SingleStep, UnknownException)
STD_EXCEPTION(0xe00, Trap_0e, UnknownException)
/* ** BITMAP DISPLAY SUPPORT -- should probably be moved elsewhere */
/************************************************************************/
-#if (CONFIG_COMMANDS & CFG_CMD_BMP)
+#if (CONFIG_COMMANDS & CFG_CMD_BMP) || defined(CONFIG_SPLASH_SCREEN)
#include <bmp_layout.h>
-#endif /* (CONFIG_COMMANDS & CFG_CMD_BMP) */
+#endif /* (CONFIG_COMMANDS & CFG_CMD_BMP) || CONFIG_SPLASH_SCREEN */
/************************************************************************/
/* ** FONT AND LOGO DATA */
}
#endif /* CONFIG_LCD_LOGO */
-#if (CONFIG_COMMANDS & CFG_CMD_BMP)
+#if (CONFIG_COMMANDS & CFG_CMD_BMP) || defined(CONFIG_SPLASH_SCREEN)
/*
* Display the BMP file located at address bmp_image.
* Only uncompressed
return (0);
}
-#endif /* (CONFIG_COMMANDS & CFG_CMD_BMP) */
+#endif /* (CONFIG_COMMANDS & CFG_CMD_BMP) || CONFIG_SPLASH_SCREEN */
/*----------------------------------------------------------------------*/
STD_EXCEPTION(0x900, Decrementer, timer_interrupt)
STD_EXCEPTION(0xa00, Trap_0a, UnknownException)
STD_EXCEPTION(0xb00, Trap_0b, UnknownException)
-
- . = 0xc00
-/*
- * r0 - SYSCALL number
- * r3-... arguments
- */
-SystemCall:
- addis r11,r0,0 /* get functions table addr */
- ori r11,r11,0 /* Note: this code is patched in trap_init */
- addis r12,r0,0 /* get number of functions */
- ori r12,r12,0
-
- cmplw 0, r0, r12
- bge 1f
-
- rlwinm r0,r0,2,0,31 /* fn_addr = fn_tbl[r0] */
- add r11,r11,r0
- lwz r11,0(r11)
-
- li r20,0xd00-4 /* Get stack pointer */
- lwz r12,0(r20)
- subi r12,r12,12 /* Adjust stack pointer */
- li r0,0xc00+_end_back-SystemCall
- cmplw 0, r0, r12 /* Check stack overflow */
- bgt 1f
- stw r12,0(r20)
-
- mflr r0
- stw r0,0(r12)
- mfspr r0,SRR0
- stw r0,4(r12)
- mfspr r0,SRR1
- stw r0,8(r12)
-
- li r12,0xc00+_back-SystemCall
- mtlr r12
- mtspr SRR0,r11
-
-1: SYNC
- rfi
-
-_back:
-
- mfmsr r11 /* Disable interrupts */
- li r12,0
- ori r12,r12,MSR_EE
- andc r11,r11,r12
- SYNC /* Some chip revs need this... */
- mtmsr r11
- SYNC
-
- li r12,0xd00-4 /* restore regs */
- lwz r12,0(r12)
-
- lwz r11,0(r12)
- mtlr r11
- lwz r11,4(r12)
- mtspr SRR0,r11
- lwz r11,8(r12)
- mtspr SRR1,r11
-
- addi r12,r12,12 /* Adjust stack pointer */
- li r20,0xd00-4
- stw r12,0(r20)
-
- SYNC
- rfi
-_end_back:
-
+ STD_EXCEPTION(0xc00, SystemCall, UnknownException)
STD_EXCEPTION(0xd00, SingleStep, UnknownException)
STD_EXCEPTION(0xe00, Trap_0e, UnknownException)
STD_EXCEPTION(0x900, Decrementer, timer_interrupt)
STD_EXCEPTION(0xa00, Trap_0a, UnknownException)
STD_EXCEPTION(0xb00, Trap_0b, UnknownException)
-
- . = 0xc00
-/*
- * r0 - SYSCALL number
- * r3-... arguments
- */
-SystemCall:
- addis r11,r0,0 /* get functions table addr */
- ori r11,r11,0 /* Note: this code is patched in trap_init */
- addis r12,r0,0 /* get number of functions */
- ori r12,r12,0
-
- cmplw 0, r0, r12
- bge 1f
-
- rlwinm r0,r0,2,0,31 /* fn_addr = fn_tbl[r0] */
- add r11,r11,r0
- lwz r11,0(r11)
-
- li r20,0xd00-4 /* Get stack pointer */
- lwz r12,0(r20)
- subi r12,r12,12 /* Adjust stack pointer */
- li r0,0xc00+_end_back-SystemCall
- cmplw 0, r0, r12 /* Check stack overflow */
- bgt 1f
- stw r12,0(r20)
-
- mflr r0
- stw r0,0(r12)
- mfspr r0,SRR0
- stw r0,4(r12)
- mfspr r0,SRR1
- stw r0,8(r12)
-
- li r12,0xc00+_back-SystemCall
- mtlr r12
- mtspr SRR0,r11
-
-1: SYNC
- rfi
-
-_back:
-
- mfmsr r11 /* Disable interrupts */
- li r12,0
- ori r12,r12,MSR_EE
- andc r11,r11,r12
- SYNC /* Some chip revs need this... */
- mtmsr r11
- SYNC
-
- li r12,0xd00-4 /* restore regs */
- lwz r12,0(r12)
-
- lwz r11,0(r12)
- mtlr r11
- lwz r11,4(r12)
- mtspr SRR0,r11
- lwz r11,8(r12)
- mtspr SRR1,r11
-
- addi r12,r12,12 /* Adjust stack pointer */
- li r20,0xd00-4
- stw r12,0(r20)
-
- SYNC
- rfi
-_end_back:
-
+ STD_EXCEPTION(0xc00, SystemCall, UnknownException)
STD_EXCEPTION(0xd00, SingleStep, UnknownException)
STD_EXCEPTION(0xe00, Trap_0e, UnknownException)
--- /dev/null
+Design Notes on Exporting U-Boot Functions to Standalone Applications:
+======================================================================
+
+1. Add a field to the global_data structure, the pointer to a jump
+ table.
+
+2. Jump table itself is allocated and filled in the same way as the
+ syscall table is (allocated with malloc() after the code has been
+ relocated to RAM); a special function, fixed to the table element
+ number 0, will be added which returns the ABI version so
+ applications can check for compatibility issues.
+
+3. It is application's responsibility to check the ABI version and
+ act accordingly.
+
+4. Pointer to the global_data is passed to the application in the
+ dedicated register that is used in the U-Boot to hold this
+ pointer. This assumes that the application is built with the same
+ register- allocation flags as the U-Boot itself. (Actually, this
+ is a requirement even now, as the 'go' command does not perform
+ any actions to protect this register against being clobbered by
+ the application).
+
+ This approach won't work on the x86 architecture. See below.
+
+5. Application now calls standard library functions like printf()
+ instead of specially prefixed names like mon_printf() as it did
+ before. Present implementation of these functions (using the
+ system calls mechanism) will be replaced with jump stubs.
+
+6. To export additional functions, the following steps will have to be
+ taken:
+
+ - Add the xxx() U-Boot function to the EXPORT_FUNC list
+ - Add initialization of the appropriate slot in the jump table
+
+7. To port to a new architecture, the appropriate stub code should be
+ provided. No other machine-dependent code is used. Once the stub
+ template is available, no additional coding is needed when
+ exporting new U-Boot functions. A pre-processor macro will be used
+ to automatically instantiate the stub definition for each exported
+ function.
+
+Note the following:
+
+- This approach uses a jump table with fixed slot allocation. That
+ said, to retain the ABI compatibility, no table reordering,
+ inserting new functions in the middle of the list or deleting
+ functions from the list is allowed. Any such action will break the
+ ABI compatibility.
+
+- The x86 architecture does not use a dedicated register to store the
+ pointer to the global_data structure. There are the following
+ approaches available:
+
+ * Pass the global_data pointer to the application in a register or
+ as an additional argument. This requires special machine-
+ dependent startup code to be compiled into the application.
+
+ * Make the x86 consistent with the rest of architectures and use a
+ dedicated register. This renders one register unusable in the
+ rest of the U-Boot code and thus increases the size of the U-Boot
+ binary and decreases it performance.
+
+The following changes will be made:
+
+- The syscall handling code will be removed.
+
+- The include/_exports.h file will be introduced, containing the list
+ of the exported functions in the following form:
+
+ EXPORT_FUNC(getc)
+ EXPORT_FUNC(tstc)
+ ...
+
+ This list will be used to assign the slot numbers in the jump
+ table, to determine the size of the jump table and to generate the
+ code for the stub functions.
+
+- The include/exports.h file will be introduced, containing the
+ prototypes of the exported functions and the assigned slot numbers.
+
+- The examples/stubs.c file will be introduced, containing the code
+ for the jump stubs for each of the exported functions.
+
+Implementation Notes on Exporting U-Boot Functions:
+===================================================
+
+1. The patch was applied against TOT as of 7/24 12:50 MEST; the
+ resulting images were tested on the following boards:
+
+ * lwmon (PowerPC)
+ * trab (ARM)
+ * inca (MIPS)
+
+ The hello_world application was loaded and executed then:
+
+ [lwmon]
+ => tftp 0x40000 /tftpboot/LWMON/hello_world.bin-avn
+ => go 0x40004
+
+ [trab]
+ TRAB # tftp 0xc100000 /tftpboot/TRAB/hello_world.bin-avn
+ TRAB # go 0xc100000
+
+ [inca]
+ INCA-IP # tftp 0x80200000 /tftpboot/INCA/hello_world.bin-avn
+ INCA-IP # go 0x80200000
+
+2. As neither of supported x86 boards can be built from the TOT
+ sources currently, the patch build was verified by manually
+ running the following command in the U-Boot top directory:
+
+ > make -C examples TOPDIR=`pwd` ARCH=i386 CROSS_COMPILE=
+
+ The rest of the code is mostly machine-independent and was not
+ verified.
+
+3. To test the x86 assembly code, a small standalone application was
+ written. It was built and run on the RedHat Linux 8.0 (x86). The
+ application performs a jump using a pointer to jump table and a
+ function's index in it.
+
+4. For the MIPS architecture, the linker script is also provided for
+ linking applications. The default linker script places the .text
+ and .data sections too far from each other so that the resulting
+ .bin files span about 256Mb in size.
+
+5. Several example applications required updating for the new API.
+ These applications relied upon the bd_t pointer being passed as
+ the 1st argument to the main function; this had changed when the
+ system calls were introduced, but apparently, these applications
+ weren't fixed at that moment. This is fixed now.
+
+6. GCC issues warnings for the 'sched' application. Since now the
+ mon_printf() function is renamed to printf(), GCC applies its
+ knowledge of the format specifiers to check the arguments,
+ complaining about ints passed as longs and vice versa. This is not
+ fixed yet.
+
+7. Only the hello_world example application was modified to make use
+ of the newly supplied get_version() function. The application now
+ prints two ABI versions, the one that the application was compiled
+ for and the other, actual ABI version.
+
+8. The following new files were added:
+ common/exports.c
+ examples/mips.lds
+ examples/stubs.c
+ include/_exports.h
+ include/exports.h
+ doc/README.standalone
+
+ The following files are no longer used and will be removed:
+ examples/syscall.S
+ include/syscall.h
#define _LINUX_STRING_H_ /* avoid unnecessary str/mem functions */
#include <common.h>
-#include <syscall.h>
+#include <exports.h>
#include <asm/io.h>
long ee_addr = ioaddr + EE_OFFSET;
if (debug > 1)
- mon_printf(" EEPROM op 0x%x: ", cmd);
+ printf(" EEPROM op 0x%x: ", cmd);
outw(EE_ENB | EE_SHIFT_CLK, ee_addr);
outw(dataval, ee_addr);
eeprom_delay(ee_addr);
if (debug > 2)
- mon_printf("%X", inw(ee_addr) & 15);
+ printf("%X", inw(ee_addr) & 15);
outw(dataval | EE_SHIFT_CLK, ee_addr);
eeprom_delay(ee_addr);
retval = (retval << 1) | ((inw(ee_addr) & EE_DATA_READ) ? 1 : 0);
/* Terminate the EEPROM access. */
outw(EE_ENB & ~EE_CS, ee_addr);
if (debug > 1)
- mon_printf(" EEPROM result is 0x%5.5x.\n", retval);
+ printf(" EEPROM result is 0x%5.5x.\n", retval);
return retval;
}
/* Poll for write finished. */
i = eeprom_busy_poll(ee_ioaddr); /* Typical 2000 ticks */
if (debug)
- mon_printf(" Write finished after %d ticks.\n", i);
+ printf(" Write finished after %d ticks.\n", i);
/* Disable programming. This command is not instantaneous, so we check
for busy before the next op. */
do_eeprom_cmd(ioaddr, (0x40 << (addr_len-4)), 3 + addr_len);
int size_test;
int i;
- mon_printf("Resetting i82559 EEPROM @ 0x%08x ... ", ioaddr);
+ printf("Resetting i82559 EEPROM @ 0x%08x ... ", ioaddr);
size_test = do_eeprom_cmd(ioaddr, (EE_READ_CMD << 8) << 16, 27);
eeprom_addr_size = (size_test & 0xffe0000) == 0xffe0000 ? 8 : 6;
for (i = 0; i < eeprom_size; i++)
if (read_eeprom(ioaddr, i, eeprom_addr_size) != eeprom[i]) {
- mon_printf("failed\n");
+ printf("failed\n");
return 1;
}
- mon_printf("done\n");
+ printf("done\n");
return 0;
}
char buf[6];
int instance;
+ app_startup(argv);
if (argc != 2) {
- mon_printf ("call with base Ethernet address\n");
+ printf ("call with base Ethernet address\n");
return 1;
}
eth_addr = gethwaddr(argv[1], buf);
if (NULL == eth_addr) {
- mon_printf ("Can not parse ethernet address\n");
+ printf ("Can not parse ethernet address\n");
return 1;
}
if (eth_addr[5] & 0x01) {
- mon_printf("Base Ethernet address must be even\n");
+ printf("Base Ethernet address must be even\n");
}
unsigned char mac[6];
int bar1 = read_config_dword(0, 6+instance, 0, 0x14);
if (! (bar1 & 1)) {
- mon_printf("ETH%d is disabled %x\n", instance, bar1);
+ printf("ETH%d is disabled %x\n", instance, bar1);
} else {
- mon_printf("ETH%d IO=0x%04x\n", instance, bar1 & ~3);
+ printf("ETH%d IO=0x%04x\n", instance, bar1 & ~3);
}
io_addr = (bar1 & (~3L));
write_config_word(0, 6+instance, 0, 4,
read_config_word(0, 6+instance, 0, 4) | 1);
- mon_printf("ETH%d CMD %04x\n", instance,
+ printf("ETH%d CMD %04x\n", instance,
read_config_word(0, 6+instance, 0, 4));
memcpy(mac, eth_addr, 6);
mac[5] += instance;
- mon_printf("got io=%04x, ha=%02x:%02x:%02x:%02x:%02x:%02x\n",
+ printf("got io=%04x, ha=%02x:%02x:%02x:%02x:%02x:%02x\n",
io_addr, mac[0], mac[1], mac[2],
mac[3], mac[4], mac[5]);
reset_eeprom(io_addr, mac);
# MA 02111-1307 USA
#
+ifeq ($(ARCH),ppc)
LOAD_ADDR = 0x40000
+endif
+
+ifeq ($(ARCH),i386)
+LOAD_ADDR = 0x40000
+endif
+
+ifeq ($(ARCH),arm)
+LOAD_ADDR = 0xc100000
+endif
+
+ifeq ($(ARCH),mips)
+LOAD_ADDR = 0x80200000 -T mips.lds
+endif
include $(TOPDIR)/config.mk
BIN += sched.bin
endif
-ifeq ($(ARCH),mips)
-SREC =
-BIN =
-endif
-
# The following example is pretty 8xx specific...
ifeq ($(CPU),mpc8xx)
SREC += timer.srec
OBJS = $(SREC:.srec=.o)
-LIB = libsyscall.a
-LIBAOBJS= syscall.o
+LIB = libstubs.a
+LIBAOBJS=
ifeq ($(ARCH),ppc)
LIBAOBJS+= $(ARCH)_longjmp.o $(ARCH)_setjmp.o
endif
-LIBCOBJS=
+LIBCOBJS= stubs.o
LIBOBJS = $(LIBAOBJS) $(LIBCOBJS)
CPPFLAGS += -I..
#define _LINUX_STRING_H_ /* avoid unnecessary str/mem functions */
#include <common.h>
-#include <syscall.h>
+#include <exports.h>
static int reset_eeprom(unsigned long ioaddr, unsigned char *hwaddr);
-int eepro100_eeprom(void)
+int eepro100_eeprom(int argc, char *argv[])
{
int ret = 0;
unsigned char hwaddr1[6] = { 0x00, 0x00, 0x02, 0x03, 0x04, 0x05 };
unsigned char hwaddr2[6] = { 0x00, 0x00, 0x02, 0x03, 0x04, 0x06 };
+ app_startup(argv);
+
#if defined(CONFIG_OXC)
ret |= reset_eeprom(0x80000000, hwaddr1);
ret |= reset_eeprom(0x81000000, hwaddr2);
long ee_addr = ioaddr + EE_OFFSET;
if (debug > 1)
- mon_printf(" EEPROM op 0x%x: ", cmd);
+ printf(" EEPROM op 0x%x: ", cmd);
outw(EE_ENB | EE_SHIFT_CLK, ee_addr);
outw(dataval, ee_addr);
eeprom_delay(ee_addr);
if (debug > 2)
- mon_printf("%X", inw(ee_addr) & 15);
+ printf("%X", inw(ee_addr) & 15);
outw(dataval | EE_SHIFT_CLK, ee_addr);
eeprom_delay(ee_addr);
retval = (retval << 1) | ((inw(ee_addr) & EE_DATA_READ) ? 1 : 0);
/* Terminate the EEPROM access. */
outw(EE_ENB & ~EE_CS, ee_addr);
if (debug > 1)
- mon_printf(" EEPROM result is 0x%5.5x.\n", retval);
+ printf(" EEPROM result is 0x%5.5x.\n", retval);
return retval;
}
/* Poll for write finished. */
i = eeprom_busy_poll(ee_ioaddr); /* Typical 2000 ticks */
if (debug)
- mon_printf(" Write finished after %d ticks.\n", i);
+ printf(" Write finished after %d ticks.\n", i);
/* Disable programming. This command is not instantaneous, so we check
for busy before the next op. */
do_eeprom_cmd(ioaddr, (0x40 << (addr_len-4)), 3 + addr_len);
int size_test;
int i;
- mon_printf("Resetting i82559 EEPROM @ 0x%08x ... ", ioaddr);
+ printf("Resetting i82559 EEPROM @ 0x%08lX ... ", ioaddr);
size_test = do_eeprom_cmd(ioaddr, (EE_READ_CMD << 8) << 16, 27);
eeprom_addr_size = (size_test & 0xffe0000) == 0xffe0000 ? 8 : 6;
for (i = 0; i < eeprom_size; i++)
if (read_eeprom(ioaddr, i, eeprom_addr_size) != eeprom[i]) {
- mon_printf("failed\n");
+ printf("failed\n");
return 1;
}
- mon_printf("done\n");
+ printf("done\n");
return 0;
}
*/
#include <common.h>
-#include <syscall.h>
+#include <exports.h>
int hello_world (int argc, char *argv[])
{
int i;
- mon_printf ("Hello World\n");
+ /* Print the ABI version */
+ app_startup(argv);
+ printf ("Example expects ABI version %d\n", XF_VERSION);
+ printf ("Actual U-Boot ABI version %d\n", (int)get_version());
- mon_printf ("argc = %d\n", argc);
+ printf ("Hello World\n");
+
+ printf ("argc = %d\n", argc);
for (i=0; i<=argc; ++i) {
- mon_printf ("argv[%d] = \"%s\"\n",
+ printf ("argv[%d] = \"%s\"\n",
i,
argv[i] ? argv[i] : "<NULL>");
}
- mon_printf ("Hit any key to exit ... ");
- while (!mon_tstc())
+ printf ("Hit any key to exit ... ");
+ while (!tstc())
;
/* consume input */
- (void) mon_getc();
+ (void) getc();
- mon_printf ("\n\n");
+ printf ("\n\n");
return (0);
}
#include <common.h>
-#include <syscall.h>
+#include <exports.h>
#define STANDALONE
#include <command.h>
#include <watchdog.h>
#else /* Standalone app of PPCBoot */
-#include <syscall.h>
-#define printf mon_printf
-#define tstc mon_tstc
-#define getc mon_getc
-#define putc mon_putc
-#define udelay mon_udelay
-#define malloc mon_malloc
#define WATCHDOG_RESET() { \
*(ushort *)(CFG_IMMR + 0x1000E) = 0x556c; \
*(ushort *)(CFG_IMMR + 0x1000E) = 0xaa39; \
#ifdef STANDALONE
int ctrlc (void)
{
- if (mon_tstc()) {
- switch (mon_getc ()) {
+ if (tstc()) {
+ switch (getc ()) {
case 0x03: /* ^C - Control C */
return 1;
default:
#endif /* STANDALONE */
#ifdef STANDALONE
-int mem_to_mem_idma2intr (bd_t * bd, int argc, char *argv[])
+int mem_to_mem_idma2intr (int argc, char *argv[])
#else
int do_idma (bd_t * bd, int argc, char *argv[])
#endif /* STANDALONE */
{
int i;
+ app_startup(argv);
dpinit_done = 0;
idma_init ();
DEBUG ("Installing dma handler\n");
- mon_install_hdlr (7, dmadone_handler, (void *) bdf);
+ install_hdlr (7, dmadone_handler, (void *) bdf);
memset ((void *) 0x100000, 'a', 512);
memset ((void *) 0x200000, 'b', 512);
}
DEBUG ("Uninstalling dma handler\n");
- mon_free_hdlr (7);
+ free_hdlr (7);
return 0;
}
--- /dev/null
+/*
+ * (C) Copyright 2003
+ * Wolfgang Denk Engineering, <wd@denx.de>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+/*
+OUTPUT_FORMAT("elf32-bigmips", "elf32-bigmips", "elf32-bigmips")
+*/
+OUTPUT_FORMAT("elf32-tradbigmips", "elf32-tradbigmips", "elf32-tradbigmips")
+OUTPUT_ARCH(mips)
+SECTIONS
+{
+ .text :
+ {
+ *(.text)
+ }
+
+ . = ALIGN(4);
+ .rodata : { *(.rodata) }
+
+ . = ALIGN(4);
+ .data : { *(.data) }
+
+ . = ALIGN(4);
+ .sdata : { *(.sdata) }
+
+ _gp = ALIGN(16);
+
+ __got_start = .;
+ .got : { *(.got) }
+ __got_end = .;
+
+ .sdata : { *(.sdata) }
+
+ . = ALIGN(4);
+ .sbss : { *(.sbss) }
+ .bss : { *(.bss) }
+}
*/
#include <common.h>
-#include <syscall.h>
+#include <exports.h>
/*
* Author: Arun Dharankar <ADharankar@ATTBI.Com>
#define PDEBUG(fmt, args...) { \
if(dbg != 0) { \
- mon_printf("[%s %d %s]: ",__FILE__,__LINE__,__FUNCTION__);\
- mon_printf(fmt, ##args); \
- mon_printf("\n"); \
+ printf("[%s %d %s]: ",__FILE__,__LINE__,__FUNCTION__);\
+ printf(fmt, ##args); \
+ printf("\n"); \
} \
}
/* An example of schedular test */
#define NUMTHREADS 7
-int sched (bd_t * bd, int ac, char *av[])
+int sched (int ac, char *av[])
{
int i, j;
int tid[NUMTHREADS];
int names[NUMTHREADS];
+ app_startup(av);
+
sched_init ();
for (i = 0; i < NUMTHREADS; i++) {
names[i] = i;
j = thread_create (testthread, (void *) &names[i]);
if (j == RC_FAILURE)
- mon_printf ("schedtest: Failed to create thread %d\n", i);
+ printf ("schedtest: Failed to create thread %d\n", i);
if (j > 0) {
- mon_printf ("schedtest: Created thread with id %d, name %d\n",
+ printf ("schedtest: Created thread with id %d, name %d\n",
j, i);
tid[i] = j;
}
}
- mon_printf ("schedtest: Threads created\n");
+ printf ("schedtest: Threads created\n");
- mon_printf ("sched_test: function=0x%08x\n", testthread);
+ printf ("sched_test: function=0x%08x\n", (unsigned)testthread);
for (i = 0; i < NUMTHREADS; i++) {
- mon_printf ("schedtest: Setting thread %d runnable\n", tid[i]);
+ printf ("schedtest: Setting thread %d runnable\n", tid[i]);
thread_start (tid[i]);
thread_yield ();
}
- mon_printf ("schedtest: Started %d threads\n", NUMTHREADS);
+ printf ("schedtest: Started %d threads\n", NUMTHREADS);
while (1) {
- mon_printf ("schedtest: Waiting for threads to complete\n");
- if (mon_tstc () && mon_getc () == 0x3) {
- mon_printf ("schedtest: Aborting threads...\n");
+ printf ("schedtest: Waiting for threads to complete\n");
+ if (tstc () && getc () == 0x3) {
+ printf ("schedtest: Aborting threads...\n");
for (i = 0; i < NUMTHREADS; i++) {
- mon_printf ("schedtest: Deleting thread %d\n", tid[i]);
+ printf ("schedtest: Deleting thread %d\n", tid[i]);
thread_delete (tid[i]);
}
return RC_SUCCESS;
j = -1;
i = thread_join (&j);
if (i == RC_FAILURE) {
- mon_printf ("schedtest: No threads pending, "
+ printf ("schedtest: No threads pending, "
"exiting schedular test\n");
return RC_SUCCESS;
}
- mon_printf ("schedtest: thread is %d returned %d\n", i, j);
+ printf ("schedtest: thread is %d returned %d\n", i, j);
thread_yield ();
}
{
int i;
- mon_printf ("testthread: Begin executing thread, myname %d, &i=0x%08x\n",
- *(int *) name, &i);
+ printf ("testthread: Begin executing thread, myname %d, &i=0x%08x\n",
+ *(int *) name, (unsigned)&i);
- mon_printf ("Thread %02d, i=%d\n", *(int *) name);
+ printf ("Thread %02d, i=%d\n", *(int *) name, i);
for (i = 0; i < 0xffff * (*(int *) name + 1); i++) {
- if (mon_tstc () && mon_getc () == 0x3) {
- mon_printf ("testthread: myname %d terminating.\n",
+ if (tstc () && getc () == 0x3) {
+ printf ("testthread: myname %d terminating.\n",
*(int *) name);
return *(int *) name + 1;
}
thread_yield ();
}
- mon_printf ("testthread: returning %d, i=0x%x\n",
+ printf ("testthread: returning %d, i=0x%x\n",
*(int *) name + 1, i);
return *(int *) name + 1;
current_tid = MASTER_THREAD;
lthreads[current_tid].state = STATE_RUNNABLE;
PDEBUG ("sched_init: master context = 0x%08x",
- lthreads[current_tid].context);
+ (unsigned)lthreads[current_tid].context);
return;
}
#define SWITCH(new) \
if(lthreads[new].state == STATE_RUNNABLE) { \
PDEBUG("thread_yield: %d match, ctx=0x%08x", \
- new, lthreads[current_tid].context); \
+ new, \
+ (unsigned)lthreads[current_tid].context); \
if(setjmp(lthreads[current_tid].context) == 0) { \
current_tid = new; \
PDEBUG("thread_yield: tid %d returns 0", \
static void thread_launcher (void)
{
PDEBUG ("thread_launcher: invoking func=0x%08x",
- lthreads[current_tid].func);
+ (unsigned)lthreads[current_tid].func);
lthreads[current_tid].retval =
lthreads[current_tid].func (lthreads[current_tid].arg);
lthreads[current_tid].state = STATE_TERMINATED;
thread_yield ();
- mon_printf ("thread_launcher: should NEVER get here!\n");
+ printf ("thread_launcher: should NEVER get here!\n");
return;
}
if (setjmp (lthreads[current_tid].context) == 0) {
lthreads[id].state = STATE_RUNNABLE;
current_tid = id;
- PDEBUG ("thread_start: to be stack=0%08x", lthreads[id].stack);
+ PDEBUG ("thread_start: to be stack=0%08x",
+ (unsigned)lthreads[id].stack);
setctxsp (<hreads[id].stack[STK_SIZE]);
thread_launcher ();
}
return RC_SUCCESS;
}
-#if 0 /* not used so far */
+#if 0 /* not used so far */
static int thread_stop (int id)
{
if (id <= MASTER_THREAD || id >= MAX_THREADS)
lthreads[id].state = STATE_STOPPED;
return RC_SUCCESS;
}
-#endif /* not used so far */
+#endif /* not used so far */
static int thread_join (int *ret)
{
--- /dev/null
+#include <exports.h>
+
+#if defined(CONFIG_I386)
+/*
+ * x86 does not have a dedicated register to store the pointer to
+ * the global_data. Thus the jump table address is stored in a
+ * global variable, but such approach does not allow for execution
+ * from flash memory. The global_data address is passed as argv[-1]
+ * to the application program.
+ */
+static void **jt;
+
+#define EXPORT_FUNC(x) \
+ asm volatile ( \
+" .globl " #x "\n" \
+#x ":\n" \
+" movl %0, %%eax\n" \
+" movl jt, %%ecx\n" \
+" jmp *(%%ecx, %%eax)\n" \
+ : : "i"(XF_ ## x * sizeof(void *)) : "eax", "ecx");
+#elif defined(CONFIG_PPC)
+/*
+ * r29 holds the pointer to the global_data, r11 is a call-clobbered
+ * register
+ */
+#define EXPORT_FUNC(x) \
+ asm volatile ( \
+" .globl " #x "\n" \
+#x ":\n" \
+" lwz %%r11, %0(%%r29)\n" \
+" lwz %%r11, %1(%%r11)\n" \
+" mtctr %%r11\n" \
+" bctr\n" \
+ : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "r11");
+#elif defined(CONFIG_ARM)
+/*
+ * r8 holds the pointer to the global_data, ip is a call-clobbered
+ * register
+ */
+#define EXPORT_FUNC(x) \
+ asm volatile ( \
+" .globl " #x "\n" \
+#x ":\n" \
+" ldr ip, [r8, %0]\n" \
+" ldr pc, [ip, %1]\n" \
+ : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "ip");
+#elif defined(CONFIG_MIPS)
+/*
+ * k0 ($26) holds the pointer to the global_data; t9 ($25) is a call-
+ * clobbered register that is also used to set gp ($26). Note that the
+ * jr instruction also executes the instruction immediately following
+ * it; however, GCC/mips generates an additional `nop' after each asm
+ * statement
+ */
+#define EXPORT_FUNC(x) \
+ asm volatile ( \
+" .globl " #x "\n" \
+#x ":\n" \
+" lw $25, %0($26)\n" \
+" lw $25, %1($25)\n" \
+" jr $25\n" \
+ : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "t9");
+#else
+#error stubs definition missing for this architecture
+#endif
+
+/* This function is necessary to prevent the compiler from
+ * generating prologue/epilogue, preparing stack frame etc.
+ * The stub functions are special, they do not use the stack
+ * frame passed to them, but pass it intact to the actual
+ * implementation. On the other hand, asm() statements with
+ * arguments can be used only inside the functions (gcc limitation)
+ */
+static void __attribute__((unused)) dummy(void)
+{
+#include <_exports.h>
+}
+
+void app_startup(char **argv)
+{
+#if defined(CONFIG_I386)
+ /* x86 does not have a dedicated register for passing global_data */
+ jt = ((gd_t *)argv[-1])->jt;
+#endif
+}
+
+#undef EXPORT_FUNC
+++ /dev/null
-#include <ppc_asm.tmpl>
-#include <ppc_defs.h>
-#include <syscall.h>
-
-#ifdef CONFIG_ARM /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
-#warning ARM version not implemented yet /* XXXXXXXXXXXXXXXXXXXXXXXXXXXX */
- .global mon_getc
- .type mon_getc,function
-mon_getc:
- .global mon_tstc
- .type mon_tstc,function
-mon_tstc:
- .global mon_putc
- .type mon_putc,function
-mon_putc:
- .global mon_puts
- .type mon_puts,function
-mon_puts:
- .global mon_printf
- .type mon_printf,function
-mon_printf:
- .global mon_install_hdlr
- .type mon_install_hdlr,function
-mon_install_hdlr:
- .global mon_free_hdlr
- .type mon_free_hdlr,function
-mon_free_hdlr:
- .global mon_malloc
- .type mon_malloc,function
-mon_malloc:
- .global mon_free
- .type mon_free,function
-mon_free:
- @ args = 0, pretend = 0, frame = 0
- @ frame_needed = 1, current_function_anonymous_args = 0
- mov ip, sp
- stmfd sp!, {fp, ip, lr, pc}
- sub fp, ip, #4
- ldmea fp, {fp, sp, pc}
-#elif defined(CONFIG_MIPS)/* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
-#warning MIPS version not implemented yet
- .global mon_getc
- .type mon_getc,function
-mon_getc:
- .global mon_tstc
- .type mon_tstc,function
-mon_tstc:
- .global mon_putc
- .type mon_putc,function
-mon_putc:
- .global mon_puts
- .type mon_puts,function
-mon_puts:
- .global mon_printf
- .type mon_printf,function
-mon_printf:
- .global mon_install_hdlr
- .type mon_install_hdlr,function
-mon_install_hdlr:
- .global mon_free_hdlr
- .type mon_free_hdlr,function
-mon_free_hdlr:
- .global mon_malloc
- .type mon_malloc,function
-mon_malloc:
- .global mon_free
- .type mon_free,function
-mon_free:
-
-#else
-
-#ifdef CONFIG_I386 /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
-#define SYMBOL_NAME(X) X
-#define SYMBOL_NAME_LABEL(X) X##:
-
-#define SYSCALL(name,n) \
- .globl SYMBOL_NAME(name) ; \
-SYMBOL_NAME_LABEL(name) ; \
- movl $n, %eax ;\
- pushl %ebx; \
- pushl %ecx; \
- int $0x40 ;\
-
-
-#endif /* CONFIG_I386 */
-
-#ifdef CONFIG_PPC
-#define SYSCALL(name,n) \
- .globl name ; \
-name: ; \
- li r0,n ; \
- sc ; \
- blr
-#endif /* CONFIG_PPC */
-
- .text
-
- /*
- * Make sure these functions are in the same order as they
- * appear in the "include/syscall.h" header file !!!
- */
-
- SYSCALL(mon_getc,SYSCALL_GETC)
- SYSCALL(mon_tstc,SYSCALL_TSTC)
- SYSCALL(mon_putc,SYSCALL_PUTC)
- SYSCALL(mon_puts,SYSCALL_PUTS)
- SYSCALL(mon_printf,SYSCALL_PRINTF)
- SYSCALL(mon_install_hdlr,SYSCALL_INSTALL_HDLR)
- SYSCALL(mon_free_hdlr,SYSCALL_FREE_HDLR)
- SYSCALL(mon_malloc,SYSCALL_MALLOC)
- SYSCALL(mon_free,SYSCALL_FREE)
- SYSCALL(mon_udelay,SYSCALL_UDELAY)
- SYSCALL(mon_get_timer,SYSCALL_GET_TIMER)
-#endif /* CONFIG_ARM XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
#include <common.h>
#include <commproc.h>
#include <mpc8xx_irq.h>
-#include <syscall.h>
+#include <exports.h>
#undef DEBUG
int c;
int running;
+ app_startup(argv);
+
/* Pointer to CPM Timer structure */
cpmtimerp = &((immap_t *) gd->bd->bi_immr_base)->im_cpmtimer;
- mon_printf ("TIMERS=0x%x\n", (unsigned) cpmtimerp);
+ printf ("TIMERS=0x%x\n", (unsigned) cpmtimerp);
/* Initialize pointers depending on which timer we use */
switch (TID_TIMER_ID) {
hwp->tgcrp = &cpmtimerp->cpmt_tgcr;
- mon_printf ("Using timer %d\n"
+ printf ("Using timer %d\n"
"tgcr @ 0x%x, tmr @ 0x%x, trr @ 0x%x,"
" tcr @ 0x%x, tcn @ 0x%x, ter @ 0x%x\n",
TID_TIMER_ID + 1,
/* clear all events */
*hwp->terp = (CPMT_EVENT_CAP | CPMT_EVENT_REF);
- mon_printf (usage);
+ printf (usage);
running = 0;
- while ((c = mon_getc()) != 'q') {
+ while ((c = getc()) != 'q') {
if (c == 'b') {
setPeriod (hwp, TIMER_PERIOD); /* Set period and start ticking */
/* Install interrupt handler (enable timer in CIMR) */
- mon_install_hdlr (hwp->cpm_vec, timer_handler, hwp);
+ install_hdlr (hwp->cpm_vec, timer_handler, hwp);
- mon_printf ("Enabling timer\n");
+ printf ("Enabling timer\n");
/* enable timer */
*hwp->tgcrp |= (CPMT_GCR_RST << TID_TIMER_ID);
running = 1;
#ifdef DEBUG
- mon_printf ("tgcr=0x%x, tmr=0x%x, trr=0x%x,"
+ printf ("tgcr=0x%x, tmr=0x%x, trr=0x%x,"
" tcr=0x%x, tcn=0x%x, ter=0x%x\n",
*hwp->tgcrp, *hwp->tmrp, *hwp->trrp,
*hwp->tcrp, *hwp->tcnp, *hwp->terp
#endif
} else if (c == 'e') {
- mon_printf ("Stopping timer\n");
+ printf ("Stopping timer\n");
*hwp->tgcrp &= ~(CPMT_GCR_MASK << TID_TIMER_ID);
running = 0;
#ifdef DEBUG
- mon_printf ("tgcr=0x%x, tmr=0x%x, trr=0x%x,"
+ printf ("tgcr=0x%x, tmr=0x%x, trr=0x%x,"
" tcr=0x%x, tcn=0x%x, ter=0x%x\n",
*hwp->tgcrp, *hwp->tmrp, *hwp->trrp,
*hwp->tcrp, *hwp->tcnp, *hwp->terp
);
#endif
/* Uninstall interrupt handler */
- mon_free_hdlr (hwp->cpm_vec);
+ free_hdlr (hwp->cpm_vec);
} else if (c == '?') {
#ifdef DEBUG
sysconf8xx_t *siup = &((immap_t *) gd->bd->bi_immr_base)->im_siu_conf;
#endif
- mon_printf ("\ntgcr=0x%x, tmr=0x%x, trr=0x%x,"
+ printf ("\ntgcr=0x%x, tmr=0x%x, trr=0x%x,"
" tcr=0x%x, tcn=0x%x, ter=0x%x\n",
*hwp->tgcrp, *hwp->tmrp, *hwp->trrp,
*hwp->tcrp, *hwp->tcnp, *hwp->terp
);
#ifdef DEBUG
- mon_printf ("SIUMCR=0x%08lx, SYPCR=0x%08lx,"
+ printf ("SIUMCR=0x%08lx, SYPCR=0x%08lx,"
" SIMASK=0x%08lx, SIPEND=0x%08lx\n",
siup->sc_siumcr,
siup->sc_sypcr,
siup->sc_sipend
);
- mon_printf ("CIMR=0x%08lx, CICR=0x%08lx, CIPR=0x%08lx\n",
+ printf ("CIMR=0x%08lx, CICR=0x%08lx, CIPR=0x%08lx\n",
cpm_icp->cpic_cimr,
cpm_icp->cpic_cicr,
cpm_icp->cpic_cipr
);
#endif
} else {
- mon_printf ("\nEnter: q - quit, b - start timer, e - stop timer, ? - get status\n");
+ printf ("\nEnter: q - quit, b - start timer, e - stop timer, ? - get status\n");
}
- mon_printf (usage);
+ printf (usage);
}
if (running) {
- mon_printf ("Stopping timer\n");
+ printf ("Stopping timer\n");
*hwp->tgcrp &= ~(CPMT_GCR_MASK << TID_TIMER_ID);
- mon_free_hdlr (hwp->cpm_vec);
+ free_hdlr (hwp->cpm_vec);
}
return (0);
unsigned short prescaler;
unsigned long ticks;
- mon_printf ("Set interval %ld us\n", interval);
+ printf ("Set interval %ld us\n", interval);
/* Warn if requesting longer period than possible */
if (interval > CPMT_MAX_INTERVAL) {
- mon_printf ("Truncate interval %ld to maximum (%d)\n",
+ printf ("Truncate interval %ld to maximum (%d)\n",
interval, CPMT_MAX_INTERVAL);
interval = CPMT_MAX_INTERVAL;
}
}
#ifdef DEBUG
- mon_printf ("clock/%d, prescale factor %d, reference %ld, ticks %ld\n",
+ printf ("clock/%d, prescale factor %d, reference %ld, ticks %ld\n",
(ticks > CPMT_MAX_TICKS) ? CPMT_CLOCK_DIV : 1,
CPMT_PRESCALER,
(ticks / CPMT_PRESCALER),
*hwp->trrp = (unsigned short) (ticks / CPMT_PRESCALER);
#ifdef DEBUG
- mon_printf ("tgcr=0x%x, tmr=0x%x, trr=0x%x,"
+ printf ("tgcr=0x%x, tmr=0x%x, trr=0x%x,"
" tcr=0x%x, tcn=0x%x, ter=0x%x\n",
*hwp->tgcrp, *hwp->tmrp, *hwp->trrp,
*hwp->tcrp, *hwp->tcnp, *hwp->terp
/* printf ("** TER1=%04x ** ", *hwp->terp); */
/* just for demonstration */
- mon_printf (".");
+ printf (".");
/* clear all possible events: Ref. and Cap. */
*hwp->terp = (CPMT_EVENT_CAP | CPMT_EVENT_REF);
--- /dev/null
+EXPORT_FUNC(get_version)
+EXPORT_FUNC(getc)
+EXPORT_FUNC(tstc)
+EXPORT_FUNC(putc)
+EXPORT_FUNC(puts)
+EXPORT_FUNC(printf)
+EXPORT_FUNC(install_hdlr)
+EXPORT_FUNC(free_hdlr)
+EXPORT_FUNC(malloc)
+EXPORT_FUNC(free)
+EXPORT_FUNC(udelay)
+EXPORT_FUNC(get_timer)
unsigned long ram_size; /* RAM size */
unsigned long reset_status; /* reset status register at boot */
#endif
+ void **jt; /* jump table */
} gd_t;
/*
#define GD_FLG_RELOC 0x00001 /* Code was relocated to RAM */
#define GD_FLG_DEVINIT 0x00002 /* Devices have been initialized */
-#define DECLARE_GLOBAL_DATA_PTR register gd_t *gd asm ("r8")
+#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r8")
#endif /* __ASM_GBL_DATA_H */
unsigned long bus_clk;
unsigned long ram_size; /* RAM size */
unsigned long reset_status; /* reset status register at boot */
+ void **jt; /* jump table */
} gd_t;
/*
unsigned long reloc_off; /* Relocation Offset */
unsigned long env_addr; /* Address of Environment struct */
unsigned long env_valid; /* Checksum of Environment valid? */
+ void **jt; /* jump table */
} gd_t;
/*
#define GD_FLG_RELOC 0x00001 /* Code was relocated to RAM */
#define GD_FLG_DEVINIT 0x00002 /* Devices have been initialized */
-#define DECLARE_GLOBAL_DATA_PTR register gd_t *gd asm ("k0")
+#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("k0")
#endif /* __ASM_GBL_DATA_H */
#ifdef CONFIG_LWMON
unsigned long kbd_status;
#endif
+ void **jt; /* jump table */
} gd_t;
/*
#define GD_FLG_DEVINIT 0x00002 /* Devices have been initialized */
#if 1
-#define DECLARE_GLOBAL_DATA_PTR register gd_t *gd asm ("r29")
+#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r29")
#else /* We could use plain global data, but the resulting code is bigger */
#define XTRN_DECLARE_GLOBAL_DATA_PTR extern
#define DECLARE_GLOBAL_DATA_PTR XTRN_DECLARE_GLOBAL_DATA_PTR \
#define _BMP_H_
typedef struct bmp_color_table_entry {
- __u8 blue;
- __u8 green;
- __u8 red;
- __u8 reserved;
-} __attribute__((packed)) bmp_color_table_entry_t;
+ __u8 blue;
+ __u8 green;
+ __u8 red;
+ __u8 reserved;
+} __attribute__ ((packed)) bmp_color_table_entry_t;
/* When accessing these fields, remember that they are stored in little
endian format, so use linux macros, e.g. le32_to_cpu(width) */
-typedef struct bmp_header {
- /* Header */
- char signature[2];
- __u32 file_size;
- __u32 reserved;
- __u32 data_offset;
- /* InfoHeader */
- __u32 size;
- __u32 width;
- __u32 height;
- __u16 planes;
- __u16 bit_count;
- __u32 compression;
- __u32 image_size;
- __u32 x_pixels_per_m;
- __u32 y_pixels_per_m;
- __u32 colors_used;
- __u32 colors_important;
- /* ColorTable */
+typedef struct bmp_header {
+ /* Header */
+ char signature[2];
+ __u32 file_size;
+ __u32 reserved;
+ __u32 data_offset;
+ /* InfoHeader */
+ __u32 size;
+ __u32 width;
+ __u32 height;
+ __u16 planes;
+ __u16 bit_count;
+ __u32 compression;
+ __u32 image_size;
+ __u32 x_pixels_per_m;
+ __u32 y_pixels_per_m;
+ __u32 colors_used;
+ __u32 colors_important;
+ /* ColorTable */
-} __attribute__((packed)) bmp_header_t;
+} __attribute__ ((packed)) bmp_header_t;
typedef struct bmp_image {
- bmp_header_t header;
- /* We use a zero sized array just as a placeholder for variable
- sized array */
- bmp_color_table_entry_t color_table[0];
+ bmp_header_t header;
+ /* We use a zero sized array just as a placeholder for variable
+ sized array */
+ bmp_color_table_entry_t color_table[0];
} bmp_image_t;
/* Data in the bmp_image is aligned to this length */
-#define BMP_DATA_ALIGN 4
+#define BMP_DATA_ALIGN 4
/* Constants for the compression field */
-#define BMP_BI_RGB 0
-#define BMP_BI_RLE8 1
-#define BMP_BI_RLE4 2
+#define BMP_BI_RGB 0
+#define BMP_BI_RLE8 1
+#define BMP_BI_RLE4 2
-#endif /* _BMP_H_ */
+#endif /* _BMP_H_ */
#define CFG_CMD_PING 0x0004000000000000U /* ping support */
#define CFG_CMD_MMC 0x0008000000000000U /* MMC support */
#define CFG_CMD_FAT 0x0010000000000000U /* FAT support */
+#define CFG_CMD_IMLS 0x0020000000000000U /* List all found images */
#define CFG_CMD_ALL 0xFFFFFFFFFFFFFFFFU /* ALL commands */
int misc_init_f (void);
int misc_init_r (void);
+/* common/exports.c */
+void jumptable_init(void);
+
/* $(BOARD)/$(BOARD).c */
void reset_phy (void);
void fdc_hw_init (void);
ulong crc32_no_comp (ulong, const unsigned char *, uint);
/* common/console.c */
-extern void **syscall_tbl;
-
int console_init_f(void); /* Before relocation; uses the serial stuff */
int console_init_r(void); /* After relocation; uses the console stuff */
int console_assign (int file, char *devname); /* Assign the console */
CFG_CMD_DATE | \
CFG_CMD_ELF | \
CFG_CMD_MII | \
+ CFG_CMD_PING | \
CFG_CMD_SAVES | \
CFG_CMD_BSP )
CFG_CMD_MII | \
CFG_CMD_SDRAM | \
CFG_CMD_DOC | \
+ CFG_CMD_PING | \
CFG_CMD_SAVES | \
CFG_CMD_BSP )
/* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */
#define CONFIG_CONS_INDEX 1
-#define REMOVE_COMMANDS ( CFG_CMD_AUTOSCRIPT | \
- CFG_CMD_LOADS | \
- CFG_CMD_ENV | \
- CFG_CMD_FLASH )
+#define REMOVE_COMMANDS ( CFG_CMD_AUTOSCRIPT | \
+ CFG_CMD_LOADS | \
+ CFG_CMD_ENV | \
+ CFG_CMD_FLASH | \
+ CFG_CMD_IMLS )
#define CONFIG_COMMANDS ( (CONFIG_CMD_DFL & ~REMOVE_COMMANDS) |\
CFG_CMD_PCI |\
#define CONFIG_TQM823L 1 /* ...on a TQM8xxL module */
#ifdef CONFIG_LCD /* with LCD controller ? */
-/* #define CONFIG_NEC_NL6648BC20 1 / * use NEC NL6648BC20 display */
+#define CONFIG_SPLASH_SCREEN /* ... with splashscreen support*/
#endif
#define CONFIG_8xx_CONS_SMC1 1 /* Console is on SMC1 */
#define CONFIG_RTC_MPC8xx /* use internal RTC of MPC8xx */
-#define CONFIG_COMMANDS ( CONFIG_CMD_DFL | \
+#ifdef CONFIG_SPLASH_SCREEN
+# define CONFIG_COMMANDS ( CONFIG_CMD_DFL | \
CFG_CMD_ASKENV | \
+ CFG_CMD_BMP | \
+ CFG_CMD_DATE | \
CFG_CMD_DHCP | \
- CFG_CMD_IDE | \
- CFG_CMD_DATE )
+ CFG_CMD_IDE )
+#else
+# define CONFIG_COMMANDS ( CONFIG_CMD_DFL | \
+ CFG_CMD_ASKENV | \
+ CFG_CMD_DATE | \
+ CFG_CMD_DHCP | \
+ CFG_CMD_IDE )
+#endif
/* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */
#include <cmd_confdefs.h>
/*
* Imported from global configuration:
- * CONFIG_L2_CACHE
+ * CONFIG_MPC8255
+ * CONFIG_MPC8265
+ * CONFIG_200MHz
* CONFIG_266MHz
* CONFIG_300MHz
- * CONFIG_MPC8255
+ * CONFIG_L2_CACHE
+ * CONFIG_BUSMODE_60x
*/
/*
#define CONFIG_TQM8260 200 /* ...on a TQM8260 module Rev.200 */
#endif
-/* Define 60x busmode only if your TQM8260 has L2 cache! */
-#ifdef CONFIG_L2_CACHE
-# define CONFIG_BUSMODE_60x 1 /* bus mode: 60x */
-#else
-# undef CONFIG_BUSMODE_60x /* bus mode: 8260 */
-#endif
-
-/* The board with 300MHz CPU doesn't have L2 cache, but works in 60x bus mode */
-#ifdef CONFIG_300MHz
-# define CONFIG_BUSMODE_60x
-#endif
-
#define CONFIG_82xx_CONS_SMC1 1 /* console on SMC1 */
#define CONFIG_BOOTDELAY 5 /* autoboot after 5 seconds */
/* system clock rate (CLKIN) - equal to the 60x and local bus speed */
-#ifdef CONFIG_MPC8255
+#if defined(CONFIG_MPC8255) || defined(CONFIG_MPC8265)
# define CONFIG_8260_CLKIN 66666666 /* in Hz */
-#else /* !CONFIG_MPC8255 */
+#else /* !CONFIG_MPC8255 && !CONFIG_MPC8265 */
# ifndef CONFIG_300MHz
# define CONFIG_8260_CLKIN 66666666 /* in Hz */
# else
*/
#define __HRCW__ALL__ (HRCW_CIP | HRCW_ISB111 | HRCW_BMS)
-#ifdef CONFIG_MPC8255
+#if defined(CONFIG_MPC8255) || defined(CONFIG_MPC8265)
# define CFG_HRCW_MASTER (__HRCW__ALL__ | HRCW_MODCK_H0111)
-#else /* ! MPC8255 */
+#else /* ! MPC8255 && !MPC8265 */
# if defined(CONFIG_266MHz)
# define CFG_HRCW_MASTER (__HRCW__ALL__ | HRCW_MODCK_H0111)
# elif defined(CONFIG_300MHz)
--- /dev/null
+#ifndef __MON_SYS_CALL_H__
+#define __MON_SYS_CALL_H__
+
+#ifndef __ASSEMBLY__
+
+#include <common.h>
+
+/* These are declarations of exported functions available in C code */
+unsigned long get_version(void);
+int getc(void);
+int tstc(void);
+void putc(const char);
+void puts(const char*);
+void printf(const char* fmt, ...);
+void install_hdlr(int, interrupt_handler_t*, void*);
+void free_hdlr(int);
+void *malloc(size_t);
+void free(void*);
+void udelay(unsigned long);
+unsigned long get_timer(unsigned long);
+
+void app_startup(char **);
+
+#endif /* ifndef __ASSEMBLY__ */
+
+enum {
+#define EXPORT_FUNC(x) XF_ ## x ,
+#include <_exports.h>
+#undef EXPORT_FUNC
+
+ XF_MAX
+};
+
+#define XF_VERSION 1
+
+#endif
#define IH_OS_U_BOOT 17 /* Firmware */
#define IH_OS_RTEMS 18 /* RTEMS */
#define IH_OS_ARTOS 19 /* ARTOS */
+#define IH_OS_UNITY 20 /* Unity OS */
/*
* CPU Architecture Codes (supported by Linux)
* "Script files" are command sequences that will be executed by
* U-Boot's command interpreter; this feature is especially
* useful when you configure U-Boot to use a real shell (hush)
- * as command interpreter.
+ * as command interpreter (=> Shell Scripts).
*/
#define IH_TYPE_INVALID 0 /* Invalid Image */
#define POST_SLOWTEST 0x04 /* test is slow, enabled by key press */
#define POST_POWERTEST 0x08 /* test runs after watchdog reset */
+#define POST_COLDBOOT 0x80 /* first boot after power-on */
+
#define POST_ROM 0x0100 /* test runs in ROM */
#define POST_RAM 0x0200 /* test runs in RAM */
#define POST_MANUAL 0x0400 /* test runs on diag command */
extern struct post_test post_list[];
extern unsigned int post_list_size;
-extern int post_hotkeys_pressed(gd_t *);
+extern int post_hotkeys_pressed(void);
#endif /* __ASSEMBLY__ */
+++ /dev/null
-#ifndef __MON_SYS_CALL_H__
-#define __MON_SYS_CALL_H__
-
-#ifndef __ASSEMBLY__
-
-#include <common.h>
-
-/* These are declarations of system calls available in C code */
-int mon_getc(void);
-int mon_tstc(void);
-void mon_putc(const char);
-void mon_puts(const char*);
-void mon_printf(const char* fmt, ...);
-void mon_install_hdlr(int, interrupt_handler_t*, void*);
-void mon_free_hdlr(int);
-void *mon_malloc(size_t);
-void mon_free(void*);
-void mon_udelay(unsigned long);
-unsigned long mon_get_timer(unsigned long);
-
-#endif /* ifndef __ASSEMBLY__ */
-
-#define NR_SYSCALLS 11 /* number of syscalls */
-
-
-/*
- * Make sure these functions are in the same order as they
- * appear in the "examples/syscall.S" file !!!
- */
-#define SYSCALL_GETC 0
-#define SYSCALL_TSTC 1
-#define SYSCALL_PUTC 2
-#define SYSCALL_PUTS 3
-#define SYSCALL_PRINTF 4
-#define SYSCALL_INSTALL_HDLR 5
-#define SYSCALL_FREE_HDLR 6
-#define SYSCALL_MALLOC 7
-#define SYSCALL_FREE 8
-#define SYSCALL_UDELAY 9
-#define SYSCALL_GET_TIMER 10
-
-#endif
#include <command.h>
#include <malloc.h>
#include <devices.h>
-#include <syscall.h>
#include <version.h>
#include <net.h>
/* Pointer is writable since we allocated a register for it */
gd = &gd_data;
- memset (gd, 0, sizeof (gd_t));
+ memset ((void *)gd, 0, sizeof (gd_t));
gd->bd = &bd_data;
memset (gd->bd, 0, sizeof (bd_t));
devices_init (); /* get the devices list going. */
- /* Syscalls are not implemented for ARM. But allocating
- * this allows the console_init routines to work without #ifdefs
- */
- syscall_tbl = (void **) malloc (NR_SYSCALLS * sizeof (void *));
+ jumptable_init ();
console_init_r (); /* fully init console as a device */
#include <devices.h>
#include <version.h>
#include <malloc.h>
-#include <syscall.h>
#include <net.h>
#include <ide.h>
#include <asm/u-boot-i386.h>
* or dropped completely,
* but let's get it working (again) first...
*/
-static void syscalls_init (void)
-{
- syscall_tbl[SYSCALL_MALLOC] = (void *) malloc;
- syscall_tbl[SYSCALL_FREE] = (void *) free;
-
- syscall_tbl[SYSCALL_INSTALL_HDLR] = (void *) irq_install_handler;
- syscall_tbl[SYSCALL_FREE_HDLR] = (void *) irq_free_handler;
-
-}
-
static int init_baudrate (void)
{
DECLARE_GLOBAL_DATA_PTR;
devices_init ();
- /* allocate syscalls table (console_init_r will fill it in */
- syscall_tbl = (void **) malloc (NR_SYSCALLS * sizeof (void *));
- memset(syscall_tbl, 0, NR_SYSCALLS * sizeof (void *));
+ jumptable_init ();
/* Initialize the console (after the relocation and devices init) */
console_init_r();
- syscalls_init();
#ifdef CONFIG_MISC_INIT_R
/* miscellaneous platform dependent initialisations */
#include <command.h>
#include <malloc.h>
#include <devices.h>
-#include <syscall.h>
#include <version.h>
#include <net.h>
#include <environment.h>
/* Pointer is writable since we allocated a register for it.
*/
gd = &gd_data;
- memset (gd, 0, sizeof (gd_t));
+ memset ((void *)gd, 0, sizeof (gd_t));
for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
if ((*init_fnc_ptr)() != 0) {
bd->bi_memsize = gd->ram_size; /* size of DRAM memory in bytes */
bd->bi_baudrate = gd->baudrate; /* Console Baudrate */
- memcpy (id, gd, sizeof (gd_t));
+ memcpy (id, (void *)gd, sizeof (gd_t));
/* On the purple board we copy the code in a special way
* in order to solve flash problems
/* Initialize devices */
devices_init ();
- /* allocate syscalls table (console_init_r will fill it in */
- syscall_tbl = (void **) malloc (NR_SYSCALLS * sizeof (void *));
+ jumptable_init ();
/* Initialize the console (after the relocation and devices init) */
console_init_r ();
#include <command.h>
#include <malloc.h>
#include <devices.h>
-#include <syscall.h>
#ifdef CONFIG_8xx
#include <mpc8xx.h>
#endif
return (buf);
}
-static void syscalls_init (void)
-{
- ulong *addr;
-
- syscall_tbl[SYSCALL_MALLOC] = (void *) malloc;
- syscall_tbl[SYSCALL_FREE] = (void *) free;
-
- syscall_tbl[SYSCALL_INSTALL_HDLR] = (void *) irq_install_handler;
- syscall_tbl[SYSCALL_FREE_HDLR] = (void *) irq_free_handler;
- syscall_tbl[SYSCALL_GET_TIMER] = (void *)get_timer;
- syscall_tbl[SYSCALL_UDELAY] = (void *)udelay;
-
- addr = (ulong *) 0xc00; /* syscall ISR addr */
-
- /* patch ISR code */
- *addr++ |= (ulong) syscall_tbl >> 16;
- *addr++ |= (ulong) syscall_tbl & 0xFFFF;
- *addr++ |= NR_SYSCALLS >> 16;
- *addr++ |= NR_SYSCALLS & 0xFFFF;
-
-#ifndef CONFIG_5XX
- flush_cache (0x0C00, 0x10);
-#endif
- /* Initialize syscalls stack pointer */
- addr = (ulong *) 0xCFC;
- *addr = (ulong)addr;
-#ifndef CONFIG_5xx
- flush_cache ((ulong)addr, 0x10);
-#endif
-}
-
/*
* All attempts to come up with a "common" initialization sequence
* that works for all boards and architectures failed: some of the
WATCHDOG_RESET();
- memcpy (id, gd, sizeof (gd_t));
+ memcpy (id, (void *)gd, sizeof (gd_t));
relocate_code (addr_sp, id, addr);
/* Initialize devices */
devices_init ();
- /* allocate syscalls table (console_init_r will fill it in */
- syscall_tbl = (void **) malloc (NR_SYSCALLS * sizeof (void *));
+ /* Initialize the jump table for applications */
+ jumptable_init ();
/* Initialize the console (after the relocation and devices init) */
console_init_r ();
-/** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **/
- syscalls_init ();
#if defined(CONFIG_CCM) || \
defined(CONFIG_COGENT) || \
{
DECLARE_GLOBAL_DATA_PTR;
int bootmode = post_bootmode_get (0);
-
- if (post_hotkeys_pressed(gd) && !(bootmode & POST_POWERTEST)) {
- bootmode = POST_SLOWTEST;
+ int newword;
+
+ if (post_hotkeys_pressed() && !(bootmode & POST_POWERTEST)) {
+ newword = BOOTMODE_MAGIC | POST_SLOWTEST;
} else if (bootmode == 0) {
- bootmode = POST_POWERON;
+ newword = BOOTMODE_MAGIC | POST_POWERON;
} else if (bootmode == POST_POWERON || bootmode == POST_SLOWTEST) {
- bootmode = POST_NORMAL;
+ newword = BOOTMODE_MAGIC | POST_NORMAL;
} else {
- return;
+ /* Use old value */
+ newword = post_word_load () & ~POST_COLDBOOT;
}
- post_word_store (BOOTMODE_MAGIC | bootmode);
+ if (bootmode == 0)
+ {
+ /* We are booting after power-on */
+ newword |= POST_COLDBOOT;
+ }
+
+ post_word_store (newword);
+
/* Reset activity record */
gd->post_log_word = 0;
}
return 0;
}
- bootmode = word & 0xFF;
+ bootmode = word & 0x7F;
if (last_test && (bootmode & POST_POWERTEST)) {
*last_test = (word >> 8) & 0xFF;
ASRC = ppcstring.S
OBJS = $(SRC:.c=.o) $(ASRC:.S=.o)
-LIB = $(TOPDIR)/examples/libsyscall.a
-LIBAOBJS= $(TOPDIR)/examples/syscall.o
-LIBCOBJS=
+LIB = $(TOPDIR)/examples/libstubs.a
+LIBAOBJS=
+LIBCOBJS= $(TOPDIR)/examples/stubs.o
LIBOBJS = $(LIBAOBJS) $(LIBCOBJS)
CPPFLAGS += -I$(TOPDIR) -I$(TOPDIR)/board/MAI/AmigaOneG3SE
if (argc == 1) { /* print info for all FLASH banks */
for (bank=0; bank <CFG_MAX_FLASH_BANKS; ++bank) {
- mon_printf ("\nBank # %ld: ", bank+1);
+ printf ("\nBank # %ld: ", bank+1);
flash_print_info (&flash_info[bank]);
}
bank = simple_strtoul(argv[1], NULL, 16);
if ((bank < 1) || (bank > CFG_MAX_FLASH_BANKS)) {
- mon_printf ("Only FLASH Banks # 1 ... # %d supported\n",
+ printf ("Only FLASH Banks # 1 ... # %d supported\n",
CFG_MAX_FLASH_BANKS);
return 1;
}
- mon_printf ("\nBank # %ld: ", bank);
+ printf ("\nBank # %ld: ", bank);
flash_print_info (&flash_info[bank-1]);
return 0;
}
int rcode = 0;
if (argc < 2) {
- mon_printf ("Usage:\n%s\n", cmdtp->usage);
+ printf ("Usage:\n%s\n", cmdtp->usage);
return 1;
}
if (strcmp(argv[1], "all") == 0) {
for (bank=1; bank<=CFG_MAX_FLASH_BANKS; ++bank) {
- mon_printf ("Erase Flash Bank # %ld ", bank);
+ printf ("Erase Flash Bank # %ld ", bank);
info = &flash_info[bank-1];
rcode = flash_erase (info, 0, info->sector_count-1);
}
if ((n = abbrev_spec(argv[1], &info, §_first, §_last)) != 0) {
if (n < 0) {
- mon_printf("Bad sector specification\n");
+ printf("Bad sector specification\n");
return 1;
}
- mon_printf ("Erase Flash Sectors %d-%d in Bank # %d ",
+ printf ("Erase Flash Sectors %d-%d in Bank # %d ",
sect_first, sect_last, (info-flash_info)+1);
rcode = flash_erase(info, sect_first, sect_last);
return rcode;
}
if (argc != 3) {
- mon_printf ("Usage:\n%s\n", cmdtp->usage);
+ printf ("Usage:\n%s\n", cmdtp->usage);
return 1;
}
if (strcmp(argv[1], "bank") == 0) {
bank = simple_strtoul(argv[2], NULL, 16);
if ((bank < 1) || (bank > CFG_MAX_FLASH_BANKS)) {
- mon_printf ("Only FLASH Banks # 1 ... # %d supported\n",
+ printf ("Only FLASH Banks # 1 ... # %d supported\n",
CFG_MAX_FLASH_BANKS);
return 1;
}
- mon_printf ("Erase Flash Bank # %ld ", bank);
+ printf ("Erase Flash Bank # %ld ", bank);
info = &flash_info[bank-1];
rcode = flash_erase (info, 0, info->sector_count-1);
return rcode;
addr_last = simple_strtoul(argv[2], NULL, 16);
if (addr_first >= addr_last) {
- mon_printf ("Usage:\n%s\n", cmdtp->usage);
+ printf ("Usage:\n%s\n", cmdtp->usage);
return 1;
}
- mon_printf ("Erase Flash from 0x%08lx to 0x%08lx ", addr_first, addr_last);
+ printf ("Erase Flash from 0x%08lx to 0x%08lx ", addr_first, addr_last);
rcode = flash_sect_erase(addr_first, addr_last);
return rcode;
}
}
}
if (erased) {
- /* mon_printf ("Erased %d sectors\n", erased); */
+ /* printf ("Erased %d sectors\n", erased); */
} else {
- mon_printf ("Error: start and/or end address"
+ printf ("Error: start and/or end address"
" not on sector boundary\n");
rcode = 1;
}
int rcode = 0;
if (argc < 3) {
- mon_printf ("Usage:\n%s\n", cmdtp->usage);
+ printf ("Usage:\n%s\n", cmdtp->usage);
return 1;
}
else if (strcmp(argv[1], "on") == 0)
p = 1;
else {
- mon_printf ("Usage:\n%s\n", cmdtp->usage);
+ printf ("Usage:\n%s\n", cmdtp->usage);
return 1;
}
if (info->flash_id == FLASH_UNKNOWN) {
continue;
}
- /*mon_printf ("%sProtect Flash Bank # %ld\n", */
+ /*printf ("%sProtect Flash Bank # %ld\n", */
/* p ? "" : "Un-", bank); */
for (i=0; i<info->sector_count; ++i) {
if ((n = abbrev_spec(argv[2], &info, §_first, §_last)) != 0) {
if (n < 0) {
- mon_printf("Bad sector specification\n");
+ printf("Bad sector specification\n");
return 1;
}
- /*mon_printf("%sProtect Flash Sectors %d-%d in Bank # %d\n", */
+ /*printf("%sProtect Flash Sectors %d-%d in Bank # %d\n", */
/* p ? "" : "Un-", sect_first, sect_last, */
/* (info-flash_info)+1); */
for (i = sect_first; i <= sect_last; i++) {
}
if (argc != 4) {
- mon_printf ("Usage:\n%s\n", cmdtp->usage);
+ printf ("Usage:\n%s\n", cmdtp->usage);
return 1;
}
if (strcmp(argv[2], "bank") == 0) {
bank = simple_strtoul(argv[3], NULL, 16);
if ((bank < 1) || (bank > CFG_MAX_FLASH_BANKS)) {
- mon_printf ("Only FLASH Banks # 1 ... # %d supported\n",
+ printf ("Only FLASH Banks # 1 ... # %d supported\n",
CFG_MAX_FLASH_BANKS);
return 1;
}
- mon_printf ("%sProtect Flash Bank # %ld\n",
+ printf ("%sProtect Flash Bank # %ld\n",
p ? "" : "Un-", bank);
info = &flash_info[bank-1];
if (info->flash_id == FLASH_UNKNOWN) {
- mon_printf ("missing or unknown FLASH type\n");
+ printf ("missing or unknown FLASH type\n");
return 1;
}
for (i=0; i<info->sector_count; ++i) {
addr_last = simple_strtoul(argv[3], NULL, 16);
if (addr_first >= addr_last) {
- mon_printf ("Usage:\n%s\n", cmdtp->usage);
+ printf ("Usage:\n%s\n", cmdtp->usage);
return 1;
}
rcode = flash_sect_protect (p, addr_first, addr_last);
}
if (protected) {
- /* mon_printf ("%sProtected %d sectors\n", */
+ /* printf ("%sProtected %d sectors\n", */
/* p ? "" : "Un-", protected); */
} else {
- mon_printf ("Error: start and/or end address"
+ printf ("Error: start and/or end address"
" not on sector boundary\n");
rcode = 1;
}
}
}
- mon_printf("\rWriting ");
- for (j=0; j<20; j++) mon_putc(177);
- mon_printf("\rWriting ");
+ printf("\rWriting ");
+ for (j=0; j<20; j++) putc(177);
+ printf("\rWriting ");
/* finally write data to flash */
for (info = info_first; info <= info_last && cnt>0; ++info) {
#undef DEBUG_FLASH
#ifdef DEBUG_FLASH
-#define DEBUGF(fmt,args...) mon_printf(fmt ,##args)
+#define DEBUGF(fmt,args...) printf(fmt ,##args)
#else
#define DEBUGF(fmt,args...)
#endif
#endif
} else {
- mon_printf ("Warning: the BOOT Flash is not initialised !");
+ printf ("Warning: the BOOT Flash is not initialised !");
}
flash_to_mem();
}
if (info->sector_count > CFG_MAX_FLASH_SECT) {
- mon_printf ("** ERROR: sector count %d > max (%d) **\n",
+ printf ("** ERROR: sector count %d > max (%d) **\n",
info->sector_count, CFG_MAX_FLASH_SECT);
info->sector_count = CFG_MAX_FLASH_SECT;
}
if (s_first < 0 || s_first > s_last) {
if (info->flash_id == FLASH_UNKNOWN) {
- mon_printf ("- missing\n");
+ printf ("- missing\n");
} else {
- mon_printf ("- no sectors to erase\n");
+ printf ("- no sectors to erase\n");
}
flash_to_mem();
return 1;
}
if (info->flash_id == FLASH_UNKNOWN) {
- mon_printf ("Can't erase unknown flash type %08lx - aborted\n",
+ printf ("Can't erase unknown flash type %08lx - aborted\n",
info->flash_id);
flash_to_mem();
return 1;
}
if (prot) {
- mon_printf ("- Warning: %d protected sectors will not be erased!\n",
+ printf ("- Warning: %d protected sectors will not be erased!\n",
prot);
} else {
- mon_printf ("");
+ printf ("");
}
l_sect = -1;
enable_interrupts();
/* wait at least 80us - let's wait 1 ms */
- mon_udelay (1000);
+ udelay (1000);
/*
* We wait for the last triggered sector
if (l_sect < 0)
goto DONE;
- start = mon_get_timer (0);
+ start = get_timer (0);
last = start;
addr = info->start[l_sect];
DEBUGF ("Start erase timeout: %d\n", CFG_FLASH_ERASE_TOUT);
while ((in8(addr) & 0x80) != 0x80) {
- if ((now = mon_get_timer(start)) > CFG_FLASH_ERASE_TOUT) {
- mon_printf ("Timeout\n");
+ if ((now = get_timer(start)) > CFG_FLASH_ERASE_TOUT) {
+ printf ("Timeout\n");
flash_reset (info->start[0]);
flash_to_mem();
return 1;
}
/* show that we're waiting */
if ((now - last) > 1000) { /* every second */
- mon_putc ('.');
+ putc ('.');
last = now;
}
iobarrier_rw();
flash_reset (info->start[0]);
flash_to_mem();
- mon_printf (" done\n");
+ printf (" done\n");
return 0;
}
wp += 4;
}
- mon_putc(219);
+ putc(219);
/*
* handle word aligned part
while (cnt >= 4) {
if (out_cnt>26214)
{
- mon_putc(219);
+ putc(219);
out_cnt = 0;
}
data = 0;
enable_interrupts();
/* data polling for D7 */
- start = mon_get_timer (0);
+ start = get_timer (0);
while ((in8(dest+i) & 0x80) != (data_ch[i] & 0x80)) {
- if (mon_get_timer(start) > CFG_FLASH_WRITE_TOUT) {
+ if (get_timer(start) > CFG_FLASH_WRITE_TOUT) {
flash_reset (addr);
flash_to_mem();
return (1);
int i;
if (info->flash_id == FLASH_UNKNOWN) {
- mon_printf ("missing or unknown FLASH type\n");
+ printf ("missing or unknown FLASH type\n");
return;
}
switch (info->flash_id & FLASH_VENDMASK) {
- case FLASH_MAN_AMD: mon_printf ("AMD "); break;
- case FLASH_MAN_FUJ: mon_printf ("FUJITSU "); break;
- case FLASH_MAN_BM: mon_printf ("BRIGHT MICRO "); break;
- case FLASH_MAN_STM: mon_printf ("SGS THOMSON "); break;
- default: mon_printf ("Unknown Vendor "); break;
+ case FLASH_MAN_AMD: printf ("AMD "); break;
+ case FLASH_MAN_FUJ: printf ("FUJITSU "); break;
+ case FLASH_MAN_BM: printf ("BRIGHT MICRO "); break;
+ case FLASH_MAN_STM: printf ("SGS THOMSON "); break;
+ default: printf ("Unknown Vendor "); break;
}
switch (info->flash_id & FLASH_TYPEMASK) {
- case FLASH_AM040: mon_printf ("29F040 or 29LV040 (4 Mbit, uniform sectors)\n");
+ case FLASH_AM040: printf ("29F040 or 29LV040 (4 Mbit, uniform sectors)\n");
break;
- case FLASH_AM400B: mon_printf ("AM29LV400B (4 Mbit, bottom boot sect)\n");
+ case FLASH_AM400B: printf ("AM29LV400B (4 Mbit, bottom boot sect)\n");
break;
- case FLASH_AM400T: mon_printf ("AM29LV400T (4 Mbit, top boot sector)\n");
+ case FLASH_AM400T: printf ("AM29LV400T (4 Mbit, top boot sector)\n");
break;
- case FLASH_AM800B: mon_printf ("AM29LV800B (8 Mbit, bottom boot sect)\n");
+ case FLASH_AM800B: printf ("AM29LV800B (8 Mbit, bottom boot sect)\n");
break;
- case FLASH_AM800T: mon_printf ("AM29LV800T (8 Mbit, top boot sector)\n");
+ case FLASH_AM800T: printf ("AM29LV800T (8 Mbit, top boot sector)\n");
break;
- case FLASH_AM160B: mon_printf ("AM29LV160B (16 Mbit, bottom boot sect)\n");
+ case FLASH_AM160B: printf ("AM29LV160B (16 Mbit, bottom boot sect)\n");
break;
- case FLASH_AM160T: mon_printf ("AM29LV160T (16 Mbit, top boot sector)\n");
+ case FLASH_AM160T: printf ("AM29LV160T (16 Mbit, top boot sector)\n");
break;
- case FLASH_AM320B: mon_printf ("AM29LV320B (32 Mbit, bottom boot sect)\n");
+ case FLASH_AM320B: printf ("AM29LV320B (32 Mbit, bottom boot sect)\n");
break;
- case FLASH_AM320T: mon_printf ("AM29LV320T (32 Mbit, top boot sector)\n");
+ case FLASH_AM320T: printf ("AM29LV320T (32 Mbit, top boot sector)\n");
break;
- default: mon_printf ("Unknown Chip Type\n");
+ default: printf ("Unknown Chip Type\n");
break;
}
if (info->size % 0x100000 == 0) {
- mon_printf (" Size: %ld MB in %d Sectors\n",
+ printf (" Size: %ld MB in %d Sectors\n",
info->size / 0x100000, info->sector_count);
} else if (info->size % 0x400 == 0) {
- mon_printf (" Size: %ld KB in %d Sectors\n",
+ printf (" Size: %ld KB in %d Sectors\n",
info->size / 0x400, info->sector_count);
} else {
- mon_printf (" Size: %ld B in %d Sectors\n",
+ printf (" Size: %ld B in %d Sectors\n",
info->size, info->sector_count);
}
- mon_printf (" Sector Start Addresses:");
+ printf (" Sector Start Addresses:");
for (i=0; i<info->sector_count; ++i) {
if ((i % 5) == 0)
- mon_printf ("\n ");
- mon_printf (" %08lX%s",
+ printf ("\n ");
+ printf (" %08lX%s",
info->start[i],
info->protect[i] ? " (RO)" : " "
);
}
- mon_printf ("\n");
+ printf ("\n");
}
char *new;
if ((s == NULL) ||
- ((new = mon_malloc (strlen(s) + 1)) == NULL) ) {
+ ((new = malloc (strlen(s) + 1)) == NULL) ) {
return NULL;
}
#include <common.h>
-#include <syscall.h>
+#include <exports.h>
extern unsigned long __dummy;
void do_reset (void);
void _main(void)
{
int i;
- mon_printf("U-Boot Firmware Updater\n\n\n");
- mon_printf("****************************************************\n"
+ printf("U-Boot Firmware Updater\n\n\n");
+ printf("****************************************************\n"
"* ATTENTION!! PLEASE READ THIS NOTICE CAREFULLY! *\n"
"****************************************************\n\n"
"This program will update your computer's firmware.\n"
"Do NOT remove the disk, reset the machine, or do\n"
"anything that might disrupt functionality. If this\n");
- mon_printf("Program fails, your computer might be unusable, and\n"
+ printf("Program fails, your computer might be unusable, and\n"
"you will need to return your board for reflashing.\n"
"If you find this too risky, remove the diskette and\n"
"switch off your machine now. Otherwise press the \n"
do
{
char x;
- while (!mon_tstc());
- x = mon_getc();
+ while (!tstc());
+ x = getc();
if (x == ' ') break;
} while (1);
i = 5;
- mon_printf("\nUpdate done. Please remove diskette.\n");
- mon_printf("The machine will automatically reset in %d seconds\n", i);
- mon_printf("You can switch off/reset now when the floppy is removed\n\n");
+ printf("\nUpdate done. Please remove diskette.\n");
+ printf("The machine will automatically reset in %d seconds\n", i);
+ printf("You can switch off/reset now when the floppy is removed\n\n");
while (i)
{
- mon_printf("Resetting in %d\r", i);
- mon_udelay(1000000);
+ printf("Resetting in %d\r", i);
+ udelay(1000000);
i--;
}
do_reset();
int rc;
flash_sect_protect(0, 0xFFF00000, 0xFFF7FFFF);
- mon_printf("Erasing ");
+ printf("Erasing ");
flash_sect_erase(0xFFF00000, 0xFFF7FFFF);
- mon_printf("Writing ");
+ printf("Writing ");
rc = flash_write((uchar *)addr, 0xFFF00000, 0x7FFFF);
- if (rc != 0) mon_printf("\nFlashing failed due to error %d\n", rc);
- else mon_printf("\ndone\n");
+ if (rc != 0) printf("\nFlashing failed due to error %d\n", rc);
+ else printf("\ndone\n");
flash_sect_protect(1, 0xFFF00000, 0xFFF7FFFF);
}