Merge branch 'u-boot-ti/master' into 'u-boot-arm/master'
authorAlbert ARIBAUD <albert.u.boot@aribaud.net>
Sat, 13 Apr 2013 07:39:29 +0000 (09:39 +0200)
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>
Sat, 13 Apr 2013 07:39:29 +0000 (09:39 +0200)
272 files changed:
MAKEALL
Makefile
README
api/api_display.c
arch/arm/cpu/arm926ejs/spear/spear600.c
arch/arm/cpu/arm926ejs/spear/spl_boot.c
arch/arm/cpu/pxa/Makefile
arch/blackfin/include/asm/posix_types.h
arch/m68k/lib/interrupts.c
arch/nds32/lib/interrupts.c
arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c
arch/powerpc/cpu/mpc8xx/Makefile
arch/powerpc/cpu/mpc8xxx/fdt.c
arch/powerpc/cpu/ppc4xx/44x_spd_ddr.c
arch/powerpc/cpu/ppc4xx/44x_spd_ddr2.c
arch/powerpc/cpu/ppc4xx/denali_spd_ddr2.c
arch/powerpc/lib/ticks.S
board/LEOX/elpt860/u-boot.lds.debug
board/Marvell/common/memory.c
board/Marvell/db64360/mpsc.c
board/Marvell/db64360/mv_eth.h
board/Marvell/db64460/mpsc.c
board/Marvell/db64460/mv_eth.h
board/Marvell/include/core.h
board/RPXClassic/u-boot.lds.debug
board/RPXlite/u-boot.lds.debug
board/RPXlite_dw/u-boot.lds.debug
board/ait/cam_enc_4xx/cam_enc_4xx.c
board/amcc/bamboo/bamboo.c
board/amcc/bamboo/bamboo.h
board/amcc/yucca/yucca.c
board/bf533-ezkit/flash-defines.h
board/bf533-ezkit/flash.c
board/bf533-stamp/video.h
board/cm_t35/cm_t35.c
board/cm_t35/display.c
board/cogent/u-boot.lds.debug
board/cray/L1/u-boot.lds.debug
board/eltec/mhpc/u-boot.lds.debug
board/emk/top860/u-boot.lds.debug
board/esd/common/lcd.c
board/esd/common/lcd.h
board/esd/cpci750/mpsc.c
board/esd/cpci750/mv_eth.h
board/esd/dasa_sim/cmd_dasa_sim.c
board/esd/pmc440/fpga.c
board/evb64260/eth_addrtbl.c
board/flagadm/u-boot.lds.debug
board/gen860t/fpga.c
board/genietv/u-boot.lds.debug
board/hermes/u-boot.lds.debug
board/hymod/u-boot.lds.debug
board/icu862/u-boot.lds.debug
board/ip860/u-boot.lds.debug
board/ivm/u-boot.lds.debug
board/kup/kup4k/u-boot.lds.debug
board/kup/kup4x/u-boot.lds.debug
board/lwmon/u-boot.lds.debug
board/matrix_vision/mvblx/mvblx.c
board/mbx8xx/u-boot.lds.debug
board/mcc200/lcd.c
board/mousse/flash.c
board/mousse/u-boot.lds.ram
board/mousse/u-boot.lds.rom
board/mpl/common/isa.c
board/mpl/mip405/mip405.c
board/mpl/pip405/pip405.c
board/mpl/pip405/u-boot.lds.debug
board/netphone/u-boot.lds.debug
board/netta/u-boot.lds.debug
board/netta2/u-boot.lds.debug
board/netvia/u-boot.lds.debug
board/nx823/u-boot.lds.debug
board/prodrive/p3mx/mpsc.c
board/prodrive/p3mx/mv_eth.h
board/quantum/u-boot.lds.debug
board/sacsng/clkinit.c
board/sacsng/clkinit.h
board/sandburst/karef/u-boot.lds.debug
board/sandburst/metrobox/u-boot.lds.debug
board/spd8xx/u-boot.lds.debug
board/spear/x600/fpga.c
board/stx/stxxtc/u-boot.lds.debug
board/svm_sc8xx/u-boot.lds.debug
board/teejet/mt_ventoux/mt_ventoux.c
board/w7o/u-boot.lds.debug
board/xes/xpedite1000/u-boot.lds.debug
common/Makefile
common/bedbug.c
common/board_f.c
common/cmd_bedbug.c
common/cmd_bootmenu.c [new file with mode: 0644]
common/cmd_fdc.c
common/cmd_mmc.c
common/cmd_mtdparts.c
common/cmd_nand.c
common/cmd_nvedit.c
common/cmd_pxe.c
common/cmd_scsi.c
common/cmd_sf.c
common/cmd_test.c
common/cmd_ubi.c
common/dlmalloc.c
common/dlmalloc.src
common/env_nand.c
common/env_ubi.c [new file with mode: 0644]
common/lcd.c
common/menu.c
disk/part_efi.c
doc/README.bootmenu [new file with mode: 0644]
doc/README.fdt-control
doc/README.menu
drivers/bios_emulator/atibios.c
drivers/bios_emulator/besys.c
drivers/bios_emulator/bios.c
drivers/bios_emulator/include/biosemu.h
drivers/bios_emulator/x86emu/debug.c
drivers/block/ahci.c
drivers/block/sata_dwc.c
drivers/block/sata_dwc.h
drivers/block/sym53c8xx.c
drivers/dfu/Makefile
drivers/dfu/dfu.c
drivers/dfu/dfu_mmc.c
drivers/dfu/dfu_nand.c [new file with mode: 0644]
drivers/fpga/ACEX1K.c
drivers/fpga/altera.c
drivers/fpga/cyclon2.c
drivers/fpga/lattice.c
drivers/fpga/spartan2.c
drivers/fpga/spartan3.c
drivers/fpga/virtex2.c
drivers/fpga/xilinx.c
drivers/mtd/cfi_flash.c
drivers/mtd/mtdpart.c
drivers/mtd/nand/mxc_nand.c
drivers/mtd/nand/nand_util.c
drivers/mtd/ubi/build.c
drivers/mtd/ubi/ubi.h
drivers/mtd/ubi/wl.c
drivers/net/armada100_fec.c
drivers/net/armada100_fec.h
drivers/net/e1000.c
drivers/net/e1000.h
drivers/net/e1000_spi.c
drivers/net/ne2000_base.h
drivers/net/npe/IxEthAcc.c
drivers/net/npe/IxEthAccCommon.c
drivers/net/npe/IxEthAccDataPlane.c
drivers/net/npe/IxEthAccMac.c
drivers/net/npe/IxEthDBAPI.c
drivers/net/npe/IxEthDBAPISupport.c
drivers/net/npe/IxEthDBCore.c
drivers/net/npe/IxEthDBEvents.c
drivers/net/npe/IxEthDBFeatures.c
drivers/net/npe/IxEthDBFirewall.c
drivers/net/npe/IxEthDBLearning.c
drivers/net/npe/IxEthDBNPEAdaptor.c
drivers/net/npe/IxEthDBPortUpdate.c
drivers/net/npe/IxEthDBReports.c
drivers/net/npe/IxEthDBSearch.c
drivers/net/npe/IxEthDBSpanningTree.c
drivers/net/npe/IxEthDBUtil.c
drivers/net/npe/IxEthDBVlan.c
drivers/net/npe/IxEthMii.c
drivers/net/npe/IxFeatureCtrl.c
drivers/net/npe/IxNpeDl.c
drivers/net/npe/IxNpeDlImageMgr.c
drivers/net/npe/IxNpeDlNpeMgr.c
drivers/net/npe/IxNpeMh.c
drivers/net/npe/IxNpeMhConfig.c
drivers/net/npe/IxNpeMhSend.c
drivers/net/npe/IxOsalOsSemaphore.c
drivers/net/npe/IxQMgrDispatcher.c
drivers/net/npe/IxQMgrInit.c
drivers/net/npe/IxQMgrQCfg.c
drivers/net/npe/include/IxAtmdAccCtrl.h
drivers/net/npe/include/IxEthAcc_p.h
drivers/net/npe/include/IxEthDB.h
drivers/net/npe/include/IxEthDB_p.h
drivers/net/npe/include/IxEthMii.h
drivers/net/npe/include/IxFeatureCtrl.h
drivers/net/npe/include/IxHssAcc.h
drivers/net/npe/include/IxNpeDl.h
drivers/net/npe/include/IxNpeDlNpeMgrUtils_p.h
drivers/net/npe/include/IxNpeDlNpeMgr_p.h
drivers/net/npe/include/IxNpeMhConfig_p.h
drivers/net/npe/include/IxOsal.h
drivers/net/npe/include/IxOsalTypes.h
drivers/net/npe/include/IxPerfProfAcc.h
drivers/net/npe/include/IxQMgrAqmIf_p.h
drivers/net/npe/include/IxSspAcc.h
drivers/net/npe/include/IxTimeSyncAcc.h
drivers/net/npe/npe.c
drivers/rtc/ds1374.c
drivers/serial/usbtty.c
drivers/spi/ich.c
drivers/usb/musb-new/linux-compat.h
drivers/video/Makefile
drivers/video/amba.c [deleted file]
drivers/video/atmel_hlcdfb.c
drivers/video/atmel_lcdfb.c
drivers/video/bcm2835.c
drivers/video/cfb_console.c
drivers/video/exynos_fb.c
drivers/video/mpc8xx_lcd.c [moved from arch/powerpc/cpu/mpc8xx/lcd.c with 92% similarity]
drivers/video/pxa_lcd.c [moved from arch/arm/cpu/pxa/pxafb.c with 93% similarity]
drivers/video/tegra.c
dts/Makefile
fs/ext4/ext4_common.h
fs/ext4/ext4_journal.c
fs/ubifs/ubifs.h
include/ansi.h [new file with mode: 0644]
include/at91rm9200_net.h
include/bedbug/ppc.h
include/configs/R360MPI.h
include/configs/RBC823.h
include/configs/RPXlite_DW.h
include/configs/RRvision.h
include/configs/TQM823L.h
include/configs/TQM823M.h
include/configs/VCMA9.h
include/configs/am335x_evm.h
include/configs/integrator-common.h
include/configs/lubbock.h
include/configs/lwmon.h
include/configs/nokia_rx51.h
include/configs/palmld.h
include/configs/palmtc.h
include/configs/pxa255_idp.h
include/configs/svm_sc8xx.h
include/configs/v37.h
include/configs/zipitz2.h
include/dfu.h
include/environment.h
include/fpga.h
include/galileo/core.h
include/lcd.h
include/linux/mtd/nand.h
include/linux/types.h
include/linux/usb/gadget.h
include/malloc.h
include/menu.h
include/mtd/cfi_flash.h
include/nand.h
include/scsi.h
include/sym53c8xx.h
include/ubi_uboot.h
include/usbdevice.h
include/xyzModem.h
tools/buildman/.gitignore [new file with mode: 0644]
tools/buildman/README [new file with mode: 0644]
tools/buildman/board.py [new file with mode: 0644]
tools/buildman/bsettings.py [new file with mode: 0644]
tools/buildman/builder.py [new file with mode: 0644]
tools/buildman/buildman [new symlink]
tools/buildman/buildman.py [new file with mode: 0755]
tools/buildman/control.py [new file with mode: 0644]
tools/buildman/test.py [new file with mode: 0644]
tools/buildman/toolchain.py [new file with mode: 0644]
tools/env/fw_env.c
tools/patman/README
tools/patman/checkpatch.py
tools/patman/command.py
tools/patman/commit.py
tools/patman/cros_subprocess.py [new file with mode: 0644]
tools/patman/gitutil.py
tools/patman/patchstream.py
tools/patman/patman.py
tools/patman/series.py
tools/patman/terminal.py
tools/patman/test.py

diff --git a/MAKEALL b/MAKEALL
index 91fa495ea7f43ce2b7edb6ca6ca5b8d0d8ebd643..2737eab234affa33ec3d603e7203be931c488e69 100755 (executable)
--- a/MAKEALL
+++ b/MAKEALL
@@ -664,7 +664,7 @@ build_target() {
        export BUILD_DIR="${output_dir}"
 
        target_arch=$(get_target_arch ${target})
-       eval cross_toolchain=\$CROSS_COMPILE_${target_arch^^}
+       eval cross_toolchain=\$CROSS_COMPILE_`echo $target_arch | tr '[:lower:]' '[:upper:]'`
        if [ "${cross_toolchain}" ] ; then
            MAKE="make CROSS_COMPILE=${cross_toolchain}"
        elif [ "${CROSS_COMPILE}" ] ; then
index e0f2c86ae757f23775c9592ade1f1cfc8a484f06..84b0c43440d0a55ef5b8db3f6735cd7359301077 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -24,7 +24,7 @@
 VERSION = 2013
 PATCHLEVEL = 04
 SUBLEVEL =
-EXTRAVERSION = -rc1
+EXTRAVERSION = -rc2
 ifneq "$(SUBLEVEL)" ""
 U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
 else
@@ -402,8 +402,10 @@ ALL-y += $(obj)u-boot.srec $(obj)u-boot.bin $(obj)System.map
 ALL-$(CONFIG_NAND_U_BOOT) += $(obj)u-boot-nand.bin
 ALL-$(CONFIG_ONENAND_U_BOOT) += $(obj)u-boot-onenand.bin
 ALL-$(CONFIG_SPL) += $(obj)spl/u-boot-spl.bin
-ALL-$(CONFIG_SPL) += $(obj)$(subst ",,$(CONFIG_SPL_TARGET))
 ALL-$(CONFIG_OF_SEPARATE) += $(obj)u-boot.dtb $(obj)u-boot-dtb.bin
+ifneq ($(CONFIG_SPL_TARGET),)
+ALL-$(CONFIG_SPL) += $(obj)$(subst ",,$(CONFIG_SPL_TARGET))
+endif
 
 # enable combined SPL/u-boot/dtb rules for tegra
 ifneq ($(CONFIG_TEGRA),)
diff --git a/README b/README
index 6272853993205496cf8cd1a6176e54e48badca21..14c83f4bb1796698e3a88b192a390395c51febeb 100644 (file)
--- a/README
+++ b/README
@@ -496,6 +496,13 @@ The following options need to be configured:
                exists, unlike the similar options in the Linux kernel. Do not
                set these options unless they apply!
 
+- CPU timer options:
+               CONFIG_SYS_HZ
+
+               The frequency of the timer returned by get_timer().
+               get_timer() must operate in milliseconds and this CONFIG
+               option must be set to 1000.
+
 - Linux Kernel Interface:
                CONFIG_CLOCKS_IN_MHZ
 
@@ -1329,6 +1336,29 @@ The following options need to be configured:
                        CONFIG_SH_MMCIF_CLK
                        Define the clock frequency for MMCIF
 
+- USB Device Firmware Update (DFU) class support:
+               CONFIG_DFU_FUNCTION
+               This enables the USB portion of the DFU USB class
+
+               CONFIG_CMD_DFU
+               This enables the command "dfu" which is used to have
+               U-Boot create a DFU class device via USB.  This command
+               requires that the "dfu_alt_info" environment variable be
+               set and define the alt settings to expose to the host.
+
+               CONFIG_DFU_MMC
+               This enables support for exposing (e)MMC devices via DFU.
+
+               CONFIG_DFU_NAND
+               This enables support for exposing NAND devices via DFU.
+
+               CONFIG_SYS_DFU_MAX_FILE_SIZE
+               When updating files rather than the raw storage device,
+               we use a static buffer to copy the file into and then write
+               the buffer once we've been given the whole file.  Define
+               this to the maximum filesize (in bytes) for the buffer.
+               Default is 4 MiB if undefined.
+
 - Journaling Flash filesystem support:
                CONFIG_JFFS2_NAND, CONFIG_JFFS2_NAND_OFF, CONFIG_JFFS2_NAND_SIZE,
                CONFIG_JFFS2_NAND_DEV
@@ -1930,15 +1960,15 @@ CBFS (Coreboot Filesystem) support
 
                I2C_READ
 
-               Code that returns TRUE if the I2C data line is high,
-               FALSE if it is low.
+               Code that returns true if the I2C data line is high,
+               false if it is low.
 
                eg: #define I2C_READ ((immr->im_cpm.cp_pbdat & PB_SDA) != 0)
 
                I2C_SDA(bit)
 
-               If <bit> is TRUE, sets the I2C data line high. If it
-               is FALSE, it clears it (low).
+               If <bit> is true, sets the I2C data line high. If it
+               is false, it clears it (low).
 
                eg: #define I2C_SDA(bit) \
                        if(bit) immr->im_cpm.cp_pbdat |=  PB_SDA; \
@@ -1946,8 +1976,8 @@ CBFS (Coreboot Filesystem) support
 
                I2C_SCL(bit)
 
-               If <bit> is TRUE, sets the I2C clock line high. If it
-               is FALSE, it clears it (low).
+               If <bit> is true, sets the I2C clock line high. If it
+               is false, it clears it (low).
 
                eg: #define I2C_SCL(bit) \
                        if(bit) immr->im_cpm.cp_pbdat |=  PB_SCL; \
@@ -2768,6 +2798,32 @@ FIT uImage format:
                Adds the MTD partitioning infrastructure from the Linux
                kernel. Needed for UBI support.
 
+- UBI support
+               CONFIG_CMD_UBI
+
+               Adds commands for interacting with MTD partitions formatted
+               with the UBI flash translation layer
+
+               Requires also defining CONFIG_RBTREE
+
+               CONFIG_UBI_SILENCE_MSG
+
+               Make the verbose messages from UBI stop printing.  This leaves
+               warnings and errors enabled.
+
+- UBIFS support
+               CONFIG_CMD_UBIFS
+
+               Adds commands for interacting with UBI volumes formatted as
+               UBIFS.  UBIFS is read-only in u-boot.
+
+               Requires UBI support as well as CONFIG_LZO
+
+               CONFIG_UBIFS_SILENCE_MSG
+
+               Make the verbose messages from UBIFS stop printing.  This leaves
+               warnings and errors enabled.
+
 - SPL framework
                CONFIG_SPL
                Enable building of SPL globally.
@@ -3487,6 +3543,33 @@ but it can not erase, write this NOR flash by SRIO or PCIE interface.
        environment. If redundant environment is used, it will be copied to
        CONFIG_NAND_ENV_DST + CONFIG_ENV_SIZE.
 
+- CONFIG_ENV_IS_IN_UBI:
+
+       Define this if you have an UBI volume that you want to use for the
+       environment.  This has the benefit of wear-leveling the environment
+       accesses, which is important on NAND.
+
+       - CONFIG_ENV_UBI_PART:
+
+         Define this to a string that is the mtd partition containing the UBI.
+
+       - CONFIG_ENV_UBI_VOLUME:
+
+         Define this to the name of the volume that you want to store the
+         environment in.
+
+       - CONFIG_ENV_UBI_VOLUME_REDUND:
+
+         Define this to the name of another volume to store a second copy of
+         the environment in.  This will enable redundant environments in UBI.
+         It is assumed that both volumes are in the same MTD partition.
+
+       - CONFIG_UBI_SILENCE_MSG
+       - CONFIG_UBIFS_SILENCE_MSG
+
+         You will probably want to define these to avoid a really noisy system
+         when storing the env in UBI.
+
 - CONFIG_SYS_SPI_INIT_OFFSET
 
        Defines offset to the initial SPI buffer area in DPRAM. The
index 643917088f9b74135b6b8efd4276bc494437e28b..c167db7b14849cd5de3125280291889006dc17cf 100644 (file)
@@ -45,8 +45,8 @@ int display_get_info(int type, struct display_info *di)
        case DISPLAY_TYPE_LCD:
                di->pixel_width  = panel_info.vl_col;
                di->pixel_height = panel_info.vl_row;
-               di->screen_rows = CONSOLE_ROWS;
-               di->screen_cols = CONSOLE_COLS;
+               di->screen_rows = lcd_get_screen_rows();
+               di->screen_cols = lcd_get_screen_columns();
                break;
 #endif
        }
index ff52131b093cb35844025bd95c8f27c9b2ef62d0..9f0c1d189914ad8c3b0fe8b4214aa3fae71c912d 100644 (file)
@@ -28,9 +28,6 @@
 #include <asm/arch/spr_misc.h>
 #include <asm/arch/spr_defs.h>
 
-#define FALSE                          0
-#define TRUE                           (!FALSE)
-
 static void sel_1v8(void)
 {
        struct misc_regs *misc_p = (struct misc_regs *)CONFIG_SPEAR_MISCBASE;
@@ -133,8 +130,8 @@ void soc_init(void)
 /*
  * xxx_boot_selected:
  *
- * return TRUE if the particular booting option is selected
- * return FALSE otherwise
+ * return true if the particular booting option is selected
+ * return false otherwise
  */
 static u32 read_bootstrap(void)
 {
@@ -150,18 +147,18 @@ int snor_boot_selected(void)
                /* Check whether SNOR boot is selected */
                if ((bootstrap & CONFIG_SPEAR_ONLYSNORBOOT) ==
                        CONFIG_SPEAR_ONLYSNORBOOT)
-                       return TRUE;
+                       return true;
 
                if ((bootstrap & CONFIG_SPEAR_NORNANDBOOT) ==
                        CONFIG_SPEAR_NORNAND8BOOT)
-                       return TRUE;
+                       return true;
 
                if ((bootstrap & CONFIG_SPEAR_NORNANDBOOT) ==
                        CONFIG_SPEAR_NORNAND16BOOT)
-                       return TRUE;
+                       return true;
        }
 
-       return FALSE;
+       return false;
 }
 
 int nand_boot_selected(void)
@@ -172,20 +169,20 @@ int nand_boot_selected(void)
                /* Check whether NAND boot is selected */
                if ((bootstrap & CONFIG_SPEAR_NORNANDBOOT) ==
                        CONFIG_SPEAR_NORNAND8BOOT)
-                       return TRUE;
+                       return true;
 
                if ((bootstrap & CONFIG_SPEAR_NORNANDBOOT) ==
                        CONFIG_SPEAR_NORNAND16BOOT)
-                       return TRUE;
+                       return true;
        }
 
-       return FALSE;
+       return false;
 }
 
 int pnor_boot_selected(void)
 {
        /* Parallel NOR boot is not selected in any SPEAr600 revision */
-       return FALSE;
+       return false;
 }
 
 int usb_boot_selected(void)
@@ -195,39 +192,39 @@ int usb_boot_selected(void)
        if (USB_BOOT_SUPPORTED) {
                /* Check whether USB boot is selected */
                if (!(bootstrap & CONFIG_SPEAR_USBBOOT))
-                       return TRUE;
+                       return true;
        }
 
-       return FALSE;
+       return false;
 }
 
 int tftp_boot_selected(void)
 {
        /* TFTP boot is not selected in any SPEAr600 revision */
-       return FALSE;
+       return false;
 }
 
 int uart_boot_selected(void)
 {
        /* UART boot is not selected in any SPEAr600 revision */
-       return FALSE;
+       return false;
 }
 
 int spi_boot_selected(void)
 {
        /* SPI boot is not selected in any SPEAr600 revision */
-       return FALSE;
+       return false;
 }
 
 int i2c_boot_selected(void)
 {
        /* I2C boot is not selected in any SPEAr600 revision */
-       return FALSE;
+       return false;
 }
 
 int mmc_boot_selected(void)
 {
-       return FALSE;
+       return false;
 }
 
 void plat_late_init(void)
index f2f9a4974e98eea2fd599b6ab0c03d2ada6c430a..3e2953c933f2dee1aa598196cbaeb71cf57a90dc 100644 (file)
@@ -120,7 +120,7 @@ u32 spl_boot(void)
        /*
         * All the supported booting devices are listed here. Each of
         * the booting type supported by the platform would define the
-        * macro xxx_BOOT_SUPPORTED to TRUE.
+        * macro xxx_BOOT_SUPPORTED to true.
         */
 
        if (SNOR_BOOT_SUPPORTED && snor_boot_selected()) {
index e08883256064622d0642cec0915d54cc3bb7b77f..9f63c3401b7192f58baec9ebf6fec09aff93f44c 100644 (file)
@@ -33,7 +33,6 @@ COBJS-$(CONFIG_CPU_PXA27X)    = pxa2xx.o
 COBJS-y        += cpuinfo.o
 
 COBJS  = $(COBJS-y)
-COBJS  += pxafb.o
 COBJS  += timer.o
 COBJS  += usb.o
 
index 000ffe52cab701440eda7ba0f79959e16b6b6505..1f28b36707b0153e57ae7da1110e9e807836a8a9 100644 (file)
@@ -61,9 +61,6 @@ typedef unsigned int __kernel_gid32_t;
 typedef unsigned short __kernel_old_uid_t;
 typedef unsigned short __kernel_old_gid_t;
 
-#define BOOL_WAS_DEFINED
-typedef enum { false = 0, true = 1 } bool;
-
 #ifdef __GNUC__
 typedef long long __kernel_loff_t;
 #endif
index 133494f6dcc3268ed8e62d1924570cefbf656e9c..9751db4393bd5d44eecdf5bd63ef51eda7a70a70 100644 (file)
@@ -96,7 +96,7 @@ int disable_interrupts (void)
        sr = get_sr ();
        set_sr (sr | 0x0700);
 
-       return ((sr & 0x0700) == 0);    /* return TRUE, if interrupts were enabled before */
+       return ((sr & 0x0700) == 0);    /* return true, if interrupts were enabled before */
 }
 
 void int_handler (struct pt_regs *fp)
index ca8c227b05fe7192385863635519e151bff31bf5..b4d0adc58f5869f8ac2f2ff3398b577c94656259 100644 (file)
@@ -59,7 +59,7 @@ void enable_interrupts(void)
 
 /*
  * disable interrupts
- * Return TRUE if GIE is enabled before we disable it.
+ * Return true if GIE is enabled before we disable it.
  */
 int disable_interrupts(void)
 {
index 5495dc59eef868aaa3d90af882c6df23ae506646..825a29238db2b5fad6e69d8e5cbdb5f612434a12 100644 (file)
@@ -513,7 +513,7 @@ void fsl_serdes_init(void)
        size_t arglen;
 #endif
 #ifdef CONFIG_SYS_P4080_ERRATUM_SERDES_A001
-       int need_serdes_a001;   /* TRUE == need work-around for SERDES A001 */
+       int need_serdes_a001;   /* true == need work-around for SERDES A001 */
 #endif
 #ifdef CONFIG_SYS_P4080_ERRATUM_SERDES8
        char buffer[HWCONFIG_BUFFER_SIZE];
index 0d1a12c45827a26b8e77ab2f1cf1f79f75a7bd96..ef10e2d027764ece3f6ab23f9299c5093e2cea44 100644 (file)
@@ -37,7 +37,6 @@ COBJS-y       += fec.o
 COBJS-$(CONFIG_OF_LIBFDT) += fdt.o
 COBJS-y        += i2c.o
 COBJS-y        += interrupts.o
-COBJS-y        += lcd.o
 COBJS-y        += scc.o
 COBJS-y        += serial.o
 COBJS-y        += speed.o
index 284709428d9c5c6907b43ac0a8b7e8e8bb183cb0..2db90455f60acab33bb4484ba7b8e431303281e2 100644 (file)
@@ -167,6 +167,11 @@ void fdt_fixup_dr_usb(void *blob, bd_t *bd)
                                }
                        }
 
+                       if (mode_idx < 0 || phy_idx < 0) {
+                               puts("ERROR: wrong usb mode/phy defined!!\n");
+                               return;
+                       }
+
                        dr_mode_type = modes[mode_idx];
                        dr_phy_type = phys[phy_idx];
 
index 8a20a2b1e05befac0092c549e500ab141f2983d1..161d274dfff8ae8ee5e2c7dd1d5efa099f51d6d1 100644 (file)
@@ -88,8 +88,6 @@ void spd_ddr_init_hang (void) __attribute__((weak, alias("__spd_ddr_init_hang"))
 #define NUMMEMTESTS            8
 #define NUMMEMWORDS            8
 #define MAXBXCR                        4
-#define TRUE                   1
-#define FALSE                  0
 
 /*
  * This DDR2 setup code can dynamically setup the TLB entries for the DDR2 memory
@@ -298,7 +296,7 @@ static void get_spd_info(unsigned long *dimm_populated,
        unsigned char num_of_bytes;
        unsigned char total_size;
 
-       dimm_found = FALSE;
+       dimm_found = false;
        for (dimm_num = 0; dimm_num < num_dimm_banks; dimm_num++) {
                num_of_bytes = 0;
                total_size = 0;
@@ -307,16 +305,16 @@ static void get_spd_info(unsigned long *dimm_populated,
                total_size = spd_read(iic0_dimm_addr[dimm_num], 1);
 
                if ((num_of_bytes != 0) && (total_size != 0)) {
-                       dimm_populated[dimm_num] = TRUE;
-                       dimm_found = TRUE;
+                       dimm_populated[dimm_num] = true;
+                       dimm_found = true;
                        debug("DIMM slot %lu: populated\n", dimm_num);
                } else {
-                       dimm_populated[dimm_num] = FALSE;
+                       dimm_populated[dimm_num] = false;
                        debug("DIMM slot %lu: Not populated\n", dimm_num);
                }
        }
 
-       if (dimm_found == FALSE) {
+       if (dimm_found == false) {
                printf("ERROR - No memory installed. Install a DDR-SDRAM DIMM.\n\n");
                spd_ddr_init_hang ();
        }
@@ -330,7 +328,7 @@ static void check_mem_type(unsigned long *dimm_populated,
        unsigned char dimm_type;
 
        for (dimm_num = 0; dimm_num < num_dimm_banks; dimm_num++) {
-               if (dimm_populated[dimm_num] == TRUE) {
+               if (dimm_populated[dimm_num] == true) {
                        dimm_type = spd_read(iic0_dimm_addr[dimm_num], 2);
                        switch (dimm_type) {
                        case 7:
@@ -356,7 +354,7 @@ static void check_volt_type(unsigned long *dimm_populated,
        unsigned long voltage_type;
 
        for (dimm_num = 0; dimm_num < num_dimm_banks; dimm_num++) {
-               if (dimm_populated[dimm_num] == TRUE) {
+               if (dimm_populated[dimm_num] == true) {
                        voltage_type = spd_read(iic0_dimm_addr[dimm_num], 8);
                        if (voltage_type != 0x04) {
                                printf("ERROR: DIMM %lu with unsupported voltage level.\n",
@@ -398,12 +396,12 @@ static void program_cfg0(unsigned long *dimm_populated,
        /*
         * FIXME: assume the DDR SDRAMs in both banks are the same
         */
-       ecc_enabled = TRUE;
+       ecc_enabled = true;
        for (dimm_num = 0; dimm_num < num_dimm_banks; dimm_num++) {
-               if (dimm_populated[dimm_num] == TRUE) {
+               if (dimm_populated[dimm_num] == true) {
                        ecc = spd_read(iic0_dimm_addr[dimm_num], 11);
                        if (ecc != 0x02) {
-                               ecc_enabled = FALSE;
+                               ecc_enabled = false;
                        }
 
                        /*
@@ -437,7 +435,7 @@ static void program_cfg0(unsigned long *dimm_populated,
        /*
         * program Memory Data Error Checking
         */
-       if (ecc_enabled == TRUE) {
+       if (ecc_enabled == true) {
                cfg0 |= SDRAM_CFG0_MCHK_GEN;
        } else {
                cfg0 |= SDRAM_CFG0_MCHK_NON;
@@ -493,7 +491,7 @@ static void program_rtr(unsigned long *dimm_populated,
        bus_period_x_10 = ONE_BILLION / (sys_info.freqPLB / 10);
 
        for (dimm_num = 0;  dimm_num < num_dimm_banks; dimm_num++) {
-               if (dimm_populated[dimm_num] == TRUE) {
+               if (dimm_populated[dimm_num] == true) {
                        refresh_rate_type = 0x7F & spd_read(iic0_dimm_addr[dimm_num], 12);
                        switch (refresh_rate_type) {
                        case 0x00:
@@ -585,15 +583,15 @@ static void program_tr0(unsigned long *dimm_populated,
        t_rp_ns = 0;
        t_rcd_ns = 0;
        t_ras_ns = 0;
-       cas_2_0_available = TRUE;
-       cas_2_5_available = TRUE;
-       cas_3_0_available = TRUE;
+       cas_2_0_available = true;
+       cas_2_5_available = true;
+       cas_3_0_available = true;
        tcyc_2_0_ns_x_10 = 0;
        tcyc_2_5_ns_x_10 = 0;
        tcyc_3_0_ns_x_10 = 0;
 
        for (dimm_num = 0; dimm_num < num_dimm_banks; dimm_num++) {
-               if (dimm_populated[dimm_num] == TRUE) {
+               if (dimm_populated[dimm_num] == true) {
                        wcsbc = spd_read(iic0_dimm_addr[dimm_num], 15);
                        t_rp_ns  = spd_read(iic0_dimm_addr[dimm_num], 27) >> 2;
                        t_rcd_ns = spd_read(iic0_dimm_addr[dimm_num], 29) >> 2;
@@ -640,7 +638,7 @@ static void program_tr0(unsigned long *dimm_populated,
                                if (cas_index != 0) {
                                        cas_index++;
                                }
-                               cas_3_0_available = FALSE;
+                               cas_3_0_available = false;
                        }
 
                        if (((cas_bit & 0x08) != 0) || (cas_index < 3)) {
@@ -650,7 +648,7 @@ static void program_tr0(unsigned long *dimm_populated,
                                if (cas_index != 0) {
                                        cas_index++;
                                }
-                               cas_2_5_available = FALSE;
+                               cas_2_5_available = false;
                        }
 
                        if (((cas_bit & 0x04) != 0) || (cas_index < 3)) {
@@ -660,7 +658,7 @@ static void program_tr0(unsigned long *dimm_populated,
                                if (cas_index != 0) {
                                        cas_index++;
                                }
-                               cas_2_0_available = FALSE;
+                               cas_2_0_available = false;
                        }
 
                        break;
@@ -683,13 +681,13 @@ static void program_tr0(unsigned long *dimm_populated,
        /*
         * Program SD_CASL field
         */
-       if ((cas_2_0_available == TRUE) &&
+       if ((cas_2_0_available == true) &&
            (bus_period_x_10 >= tcyc_2_0_ns_x_10)) {
                tr0 |= SDRAM_TR0_SDCL_2_0_CLK;
-       } else if ((cas_2_5_available == TRUE) &&
+       } else if ((cas_2_5_available == true) &&
                 (bus_period_x_10 >= tcyc_2_5_ns_x_10)) {
                tr0 |= SDRAM_TR0_SDCL_2_5_CLK;
-       } else if ((cas_3_0_available == TRUE) &&
+       } else if ((cas_3_0_available == true) &&
                 (bus_period_x_10 >= tcyc_3_0_ns_x_10)) {
                tr0 |= SDRAM_TR0_SDCL_3_0_CLK;
        } else {
@@ -950,9 +948,9 @@ static void program_tr1(void)
        current_fail_length = 0;
        current_start = 0;
        rdclt_offset = 0;
-       window_found = FALSE;
-       fail_found = FALSE;
-       pass_found = FALSE;
+       window_found = false;
+       fail_found = false;
+       pass_found = false;
        debug("Starting memory test ");
 
        for (k = 0; k < NUMHALFCYCLES; k++) {
@@ -963,8 +961,8 @@ static void program_tr1(void)
                        mtsdram(SDRAM0_TR1, (tr1 | SDRAM_TR1_RDCT_ENCODE(rdclt)));
 
                        if (short_mem_test()) {
-                               if (fail_found == TRUE) {
-                                       pass_found = TRUE;
+                               if (fail_found == true) {
+                                       pass_found = true;
                                        if (current_pass_length == 0) {
                                                current_start = rdclt_offset + rdclt;
                                        }
@@ -983,10 +981,10 @@ static void program_tr1(void)
                                current_fail_length++;
 
                                if (current_fail_length >= (dly_val>>2)) {
-                                       if (fail_found == FALSE) {
-                                               fail_found = TRUE;
-                                       } else if (pass_found == TRUE) {
-                                               window_found = TRUE;
+                                       if (fail_found == false) {
+                                               fail_found = true;
+                                       } else if (pass_found == true) {
+                                               window_found = true;
                                                break;
                                        }
                                }
@@ -994,9 +992,8 @@ static void program_tr1(void)
                }
                debug(".");
 
-               if (window_found == TRUE) {
+               if (window_found == true)
                        break;
-               }
 
                tr1 = tr1 ^ SDRAM_TR1_RDCD_MASK;
                rdclt_offset += dly_val;
@@ -1006,7 +1003,7 @@ static void program_tr1(void)
        /*
         * make sure we find the window
         */
-       if (window_found == FALSE) {
+       if (window_found == false) {
                printf("ERROR: Cannot determine a common read delay.\n");
                spd_ddr_init_hang ();
        }
@@ -1115,7 +1112,7 @@ static unsigned long program_bxcr(unsigned long *dimm_populated,
        bank_base_addr = CONFIG_SYS_SDRAM_BASE;
 
        for (dimm_num = 0; dimm_num < num_dimm_banks; dimm_num++) {
-               if (dimm_populated[dimm_num] == TRUE) {
+               if (dimm_populated[dimm_num] == true) {
                        num_row_addr = spd_read(iic0_dimm_addr[dimm_num], 3);
                        num_col_addr = spd_read(iic0_dimm_addr[dimm_num], 4);
                        num_banks    = spd_read(iic0_dimm_addr[dimm_num], 5);
index 85217ea272d47c7a9f8251008f93730ee4d5a635..def7ebf7227961fbf37ac3dfe9b9cfe69c975f8d 100644 (file)
@@ -241,13 +241,6 @@ void board_add_ram_info(int use_default)
 /*-----------------------------------------------------------------------------+
  * Defines
  *-----------------------------------------------------------------------------*/
-#ifndef        TRUE
-#define TRUE           1
-#endif
-#ifndef FALSE
-#define FALSE          0
-#endif
-
 #define SDRAM_DDR1     1
 #define SDRAM_DDR2     2
 #define SDRAM_NONE     0
@@ -683,7 +676,7 @@ static void get_spd_info(unsigned long *dimm_populated,
        unsigned char num_of_bytes;
        unsigned char total_size;
 
-       dimm_found = FALSE;
+       dimm_found = false;
        for (dimm_num = 0; dimm_num < num_dimm_banks; dimm_num++) {
                num_of_bytes = 0;
                total_size = 0;
@@ -696,16 +689,16 @@ static void get_spd_info(unsigned long *dimm_populated,
                      iic0_dimm_addr[dimm_num], total_size);
 
                if ((num_of_bytes != 0) && (total_size != 0)) {
-                       dimm_populated[dimm_num] = TRUE;
-                       dimm_found = TRUE;
+                       dimm_populated[dimm_num] = true;
+                       dimm_found = true;
                        debug("DIMM slot %lu: populated\n", dimm_num);
                } else {
-                       dimm_populated[dimm_num] = FALSE;
+                       dimm_populated[dimm_num] = false;
                        debug("DIMM slot %lu: Not populated\n", dimm_num);
                }
        }
 
-       if (dimm_found == FALSE) {
+       if (dimm_found == false) {
                printf("ERROR - No memory installed. Install a DDR-SDRAM DIMM.\n\n");
                spd_ddr_init_hang ();
        }
@@ -724,7 +717,7 @@ static void check_mem_type(unsigned long *dimm_populated,
        unsigned long dimm_type;
 
        for (dimm_num = 0; dimm_num < num_dimm_banks; dimm_num++) {
-               if (dimm_populated[dimm_num] == TRUE) {
+               if (dimm_populated[dimm_num] == true) {
                        dimm_type = spd_read(iic0_dimm_addr[dimm_num], 2);
                        switch (dimm_type) {
                        case 1:
@@ -994,14 +987,14 @@ static void program_copt1(unsigned long *dimm_populated,
        unsigned long val;
 
 #ifdef CONFIG_DDR_ECC
-       ecc_enabled = TRUE;
+       ecc_enabled = true;
 #else
-       ecc_enabled = FALSE;
+       ecc_enabled = false;
 #endif
-       dimm_32bit = FALSE;
-       dimm_64bit = FALSE;
-       buf0 = FALSE;
-       buf1 = FALSE;
+       dimm_32bit = false;
+       dimm_64bit = false;
+       buf0 = false;
+       buf1 = false;
 
        /*------------------------------------------------------------------
         * Set memory controller options reg 1, SDRAM_MCOPT1.
@@ -1026,7 +1019,7 @@ static void program_copt1(unsigned long *dimm_populated,
                        /* test ecc support */
                        ecc = (unsigned long)spd_read(iic0_dimm_addr[dimm_num], 11);
                        if (ecc != 0x02) /* ecc not supported */
-                               ecc_enabled = FALSE;
+                               ecc_enabled = false;
 
                        /* test bank count */
                        bankcount = (unsigned long)spd_read(iic0_dimm_addr[dimm_num], 17);
@@ -1048,15 +1041,15 @@ static void program_copt1(unsigned long *dimm_populated,
                                if (registered == 1) { /* DDR2 always buffered */
                                        /* TODO: what about above  comments ? */
                                        mcopt1 |= SDRAM_MCOPT1_RDEN;
-                                       buf0 = TRUE;
+                                       buf0 = true;
                                } else {
                                        /* TODO: the mask 0x02 doesn't match Samsung def for byte 21. */
                                        if ((attribute & 0x02) == 0x00) {
                                                /* buffered not supported */
-                                               buf0 = FALSE;
+                                               buf0 = false;
                                        } else {
                                                mcopt1 |= SDRAM_MCOPT1_RDEN;
-                                               buf0 = TRUE;
+                                               buf0 = true;
                                        }
                                }
                        }
@@ -1068,14 +1061,14 @@ static void program_copt1(unsigned long *dimm_populated,
                                if (registered == 1) {
                                        /* DDR2 always buffered */
                                        mcopt1 |= SDRAM_MCOPT1_RDEN;
-                                       buf1 = TRUE;
+                                       buf1 = true;
                                } else {
                                        if ((attribute & 0x02) == 0x00) {
                                                /* buffered not supported */
-                                               buf1 = FALSE;
+                                               buf1 = false;
                                        } else {
                                                mcopt1 |= SDRAM_MCOPT1_RDEN;
-                                               buf1 = TRUE;
+                                               buf1 = true;
                                        }
                                }
                        }
@@ -1087,11 +1080,11 @@ static void program_copt1(unsigned long *dimm_populated,
                        switch (data_width) {
                        case 72:
                        case 64:
-                               dimm_64bit = TRUE;
+                               dimm_64bit = true;
                                break;
                        case 40:
                        case 32:
-                               dimm_32bit = TRUE;
+                               dimm_32bit = true;
                                break;
                        default:
                                printf("WARNING: Detected a DIMM with a data width of %lu bits.\n",
@@ -1110,20 +1103,19 @@ static void program_copt1(unsigned long *dimm_populated,
                }
        }
 
-       if ((dimm_64bit == TRUE) && (dimm_32bit == TRUE)) {
+       if ((dimm_64bit == true) && (dimm_32bit == true)) {
                printf("ERROR: Cannot mix 32 bit and 64 bit DDR-SDRAM DIMMs together.\n");
                spd_ddr_init_hang ();
-       }
-       else if ((dimm_64bit == TRUE) && (dimm_32bit == FALSE)) {
+       } else if ((dimm_64bit == true) && (dimm_32bit == false)) {
                mcopt1 |= SDRAM_MCOPT1_DMWD_64;
-       } else if ((dimm_64bit == FALSE) && (dimm_32bit == TRUE)) {
+       } else if ((dimm_64bit == false) && (dimm_32bit == true)) {
                mcopt1 |= SDRAM_MCOPT1_DMWD_32;
        } else {
                printf("ERROR: Please install only 32 or 64 bit DDR-SDRAM DIMMs.\n\n");
                spd_ddr_init_hang ();
        }
 
-       if (ecc_enabled == TRUE)
+       if (ecc_enabled == true)
                mcopt1 |= SDRAM_MCOPT1_MCHK_GEN;
        else
                mcopt1 |= SDRAM_MCOPT1_MCHK_NON;
@@ -1171,14 +1163,14 @@ static void program_codt(unsigned long *dimm_populated,
                        total_rank += dimm_rank;
                        total_dimm++;
                        if ((dimm_num == 0) && (total_dimm == 1))
-                               firstSlot = TRUE;
+                               firstSlot = true;
                        else
-                               firstSlot = FALSE;
+                               firstSlot = false;
                }
        }
        if (dimm_type == SDRAM_DDR2) {
                codt |= SDRAM_CODT_DQS_1_8_V_DDR2;
-               if ((total_dimm == 1) && (firstSlot == TRUE)) {
+               if ((total_dimm == 1) && (firstSlot == true)) {
                        if (total_rank == 1) {  /* PUUU */
                                codt |= CALC_ODT_R(0);
                                modt0 = CALC_ODT_W(0);
@@ -1193,7 +1185,7 @@ static void program_codt(unsigned long *dimm_populated,
                                modt2 = 0x00000000;
                                modt3 = 0x00000000;
                        }
-               } else if ((total_dimm == 1) && (firstSlot != TRUE)) {
+               } else if ((total_dimm == 1) && (firstSlot != true)) {
                        if (total_rank == 1) {  /* UUPU */
                                codt |= CALC_ODT_R(2);
                                modt0 = 0x00000000;
@@ -1467,26 +1459,26 @@ static void program_mode(unsigned long *dimm_populated,
         * the dimm modules installed.
         *-----------------------------------------------------------------*/
        t_wr_ns = 0;
-       cas_2_0_available = TRUE;
-       cas_2_5_available = TRUE;
-       cas_3_0_available = TRUE;
-       cas_4_0_available = TRUE;
-       cas_5_0_available = TRUE;
+       cas_2_0_available = true;
+       cas_2_5_available = true;
+       cas_3_0_available = true;
+       cas_4_0_available = true;
+       cas_5_0_available = true;
        max_2_0_tcyc_ns_x_100 = 10;
        max_2_5_tcyc_ns_x_100 = 10;
        max_3_0_tcyc_ns_x_100 = 10;
        max_4_0_tcyc_ns_x_100 = 10;
        max_5_0_tcyc_ns_x_100 = 10;
-       sdram_ddr1 = TRUE;
+       sdram_ddr1 = true;
 
        /* loop through all the DIMM slots on the board */
        for (dimm_num = 0; dimm_num < num_dimm_banks; dimm_num++) {
                /* If a dimm is installed in a particular slot ... */
                if (dimm_populated[dimm_num] != SDRAM_NONE) {
                        if (dimm_populated[dimm_num] == SDRAM_DDR1)
-                               sdram_ddr1 = TRUE;
+                               sdram_ddr1 = true;
                        else
-                               sdram_ddr1 = FALSE;
+                               sdram_ddr1 = false;
 
                        cas_bit = spd_read(iic0_dimm_addr[dimm_num], 18);
                        debug("cas_bit[SPD byte 18]=%02lx\n", cas_bit);
@@ -1543,7 +1535,7 @@ static void program_mode(unsigned long *dimm_populated,
                                } else {
                                        if (cas_index != 0)
                                                cas_index++;
-                                       cas_4_0_available = FALSE;
+                                       cas_4_0_available = false;
                                }
 
                                if (((cas_bit & 0x10) == 0x10) && (cas_index < 3) &&
@@ -1554,7 +1546,7 @@ static void program_mode(unsigned long *dimm_populated,
                                } else {
                                        if (cas_index != 0)
                                                cas_index++;
-                                       cas_3_0_available = FALSE;
+                                       cas_3_0_available = false;
                                }
 
                                if (((cas_bit & 0x08) == 0x08) && (cas_index < 3) &&
@@ -1565,7 +1557,7 @@ static void program_mode(unsigned long *dimm_populated,
                                } else {
                                        if (cas_index != 0)
                                                cas_index++;
-                                       cas_2_5_available = FALSE;
+                                       cas_2_5_available = false;
                                }
 
                                if (((cas_bit & 0x04) == 0x04) && (cas_index < 3) &&
@@ -1576,7 +1568,7 @@ static void program_mode(unsigned long *dimm_populated,
                                } else {
                                        if (cas_index != 0)
                                                cas_index++;
-                                       cas_2_0_available = FALSE;
+                                       cas_2_0_available = false;
                                }
                        } else {
                                /*
@@ -1592,7 +1584,7 @@ static void program_mode(unsigned long *dimm_populated,
                                } else {
                                        if (cas_index != 0)
                                                cas_index++;
-                                       cas_5_0_available = FALSE;
+                                       cas_5_0_available = false;
                                }
 
                                if (((cas_bit & 0x10) == 0x10) && (cas_index < 3) &&
@@ -1603,7 +1595,7 @@ static void program_mode(unsigned long *dimm_populated,
                                } else {
                                        if (cas_index != 0)
                                                cas_index++;
-                                       cas_4_0_available = FALSE;
+                                       cas_4_0_available = false;
                                }
 
                                if (((cas_bit & 0x08) == 0x08) && (cas_index < 3) &&
@@ -1614,7 +1606,7 @@ static void program_mode(unsigned long *dimm_populated,
                                } else {
                                        if (cas_index != 0)
                                                cas_index++;
-                                       cas_3_0_available = FALSE;
+                                       cas_3_0_available = false;
                                }
                        }
                }
@@ -1636,14 +1628,17 @@ static void program_mode(unsigned long *dimm_populated,
        debug("cycle_4_0_clk=%lu\n", cycle_4_0_clk);
        debug("cycle_5_0_clk=%lu\n", cycle_5_0_clk);
 
-       if (sdram_ddr1 == TRUE) { /* DDR1 */
-               if ((cas_2_0_available == TRUE) && (sdram_freq <= cycle_2_0_clk)) {
+       if (sdram_ddr1 == true) { /* DDR1 */
+               if ((cas_2_0_available == true) &&
+                       (sdram_freq <= cycle_2_0_clk)) {
                        mmode |= SDRAM_MMODE_DCL_DDR1_2_0_CLK;
                        *selected_cas = DDR_CAS_2;
-               } else if ((cas_2_5_available == TRUE) && (sdram_freq <= cycle_2_5_clk)) {
+               } else if ((cas_2_5_available == true) &&
+                       (sdram_freq <= cycle_2_5_clk)) {
                        mmode |= SDRAM_MMODE_DCL_DDR1_2_5_CLK;
                        *selected_cas = DDR_CAS_2_5;
-               } else if ((cas_3_0_available == TRUE) && (sdram_freq <= cycle_3_0_clk)) {
+               } else if ((cas_3_0_available == true) &&
+                       (sdram_freq <= cycle_3_0_clk)) {
                        mmode |= SDRAM_MMODE_DCL_DDR1_3_0_CLK;
                        *selected_cas = DDR_CAS_3;
                } else {
@@ -1656,13 +1651,16 @@ static void program_mode(unsigned long *dimm_populated,
                debug("cas_3_0_available=%d\n", cas_3_0_available);
                debug("cas_4_0_available=%d\n", cas_4_0_available);
                debug("cas_5_0_available=%d\n", cas_5_0_available);
-               if ((cas_3_0_available == TRUE) && (sdram_freq <= cycle_3_0_clk)) {
+               if ((cas_3_0_available == true) &&
+                       (sdram_freq <= cycle_3_0_clk)) {
                        mmode |= SDRAM_MMODE_DCL_DDR2_3_0_CLK;
                        *selected_cas = DDR_CAS_3;
-               } else if ((cas_4_0_available == TRUE) && (sdram_freq <= cycle_4_0_clk)) {
+               } else if ((cas_4_0_available == true) &&
+                       (sdram_freq <= cycle_4_0_clk)) {
                        mmode |= SDRAM_MMODE_DCL_DDR2_4_0_CLK;
                        *selected_cas = DDR_CAS_4;
-               } else if ((cas_5_0_available == TRUE) && (sdram_freq <= cycle_5_0_clk)) {
+               } else if ((cas_5_0_available == true) &&
+                       (sdram_freq <= cycle_5_0_clk)) {
                        mmode |= SDRAM_MMODE_DCL_DDR2_5_0_CLK;
                        *selected_cas = DDR_CAS_5;
                } else {
@@ -1677,7 +1675,7 @@ static void program_mode(unsigned long *dimm_populated,
                }
        }
 
-       if (sdram_ddr1 == TRUE)
+       if (sdram_ddr1 == true)
                mmode |= SDRAM_MMODE_WR_DDR1;
        else {
 
@@ -1851,16 +1849,16 @@ static void program_tr(unsigned long *dimm_populated,
        t_wpc_ns = 0;
        t_wtr_ns = 0;
        t_rpc_ns = 0;
-       sdram_ddr1 = TRUE;
+       sdram_ddr1 = true;
 
        /* loop through all the DIMM slots on the board */
        for (dimm_num = 0; dimm_num < num_dimm_banks; dimm_num++) {
                /* If a dimm is installed in a particular slot ... */
                if (dimm_populated[dimm_num] != SDRAM_NONE) {
                        if (dimm_populated[dimm_num] == SDRAM_DDR2)
-                               sdram_ddr1 = TRUE;
+                               sdram_ddr1 = true;
                        else
-                               sdram_ddr1 = FALSE;
+                               sdram_ddr1 = false;
 
                        t_rcd_ns = max(t_rcd_ns, spd_read(iic0_dimm_addr[dimm_num], 29) >> 2);
                        t_rrd_ns = max(t_rrd_ns, spd_read(iic0_dimm_addr[dimm_num], 28) >> 2);
@@ -1925,7 +1923,7 @@ static void program_tr(unsigned long *dimm_populated,
                break;
        }
 
-       if (sdram_ddr1 == TRUE) { /* DDR1 */
+       if (sdram_ddr1 == true) { /* DDR1 */
                if (sdram_freq < 200000000) {
                        sdtr2 |= SDRAM_SDTR2_WTR_1_CLK;
                        sdtr2 |= SDRAM_SDTR2_WPC_2_CLK;
@@ -2548,8 +2546,8 @@ calibration_loop:
        current_pass_length = 0;
        current_fail_length = 0;
        current_start = 0;
-       fail_found = FALSE;
-       pass_found = FALSE;
+       fail_found = false;
+       pass_found = false;
 
        /*
         * get the delay line calibration register value
@@ -2570,8 +2568,8 @@ calibration_loop:
                 * See if the rffd value passed.
                 *-----------------------------------------------------------------*/
                if (short_mem_test()) {
-                       if (fail_found == TRUE) {
-                               pass_found = TRUE;
+                       if (fail_found == true) {
+                               pass_found = true;
                                if (current_pass_length == 0)
                                        current_start = rffd;
 
@@ -2589,11 +2587,10 @@ calibration_loop:
                        current_fail_length++;
 
                        if (current_fail_length >= (dly_val >> 2)) {
-                               if (fail_found == FALSE) {
-                                       fail_found = TRUE;
-                               } else if (pass_found == TRUE) {
+                               if (fail_found == false)
+                                       fail_found = true;
+                               else if (pass_found == true)
                                        break;
-                               }
                        }
                }
        }               /* for rffd */
@@ -2618,9 +2615,9 @@ calibration_loop:
        current_pass_length = 0;
        current_fail_length = 0;
        current_start = 0;
-       window_found = FALSE;
-       fail_found = FALSE;
-       pass_found = FALSE;
+       window_found = false;
+       fail_found = false;
+       pass_found = false;
 
        for (rqfd = 0; rqfd <= SDRAM_RQDC_RQFD_MAX; rqfd++) {
                mfsdram(SDRAM_RQDC, rqdc_reg);
@@ -2635,8 +2632,8 @@ calibration_loop:
                 * See if the rffd value passed.
                 *-----------------------------------------------------------------*/
                if (short_mem_test()) {
-                       if (fail_found == TRUE) {
-                               pass_found = TRUE;
+                       if (fail_found == true) {
+                               pass_found = true;
                                if (current_pass_length == 0)
                                        current_start = rqfd;
 
@@ -2653,10 +2650,10 @@ calibration_loop:
                        current_pass_length = 0;
                        current_fail_length++;
 
-                       if (fail_found == FALSE) {
-                               fail_found = TRUE;
-                       } else if (pass_found == TRUE) {
-                               window_found = TRUE;
+                       if (fail_found == false) {
+                               fail_found = true;
+                       } else if (pass_found == true) {
+                               window_found = true;
                                break;
                        }
                }
@@ -2667,7 +2664,7 @@ calibration_loop:
        /*------------------------------------------------------------------
         * Make sure we found the valid read passing window.  Halt if not
         *-----------------------------------------------------------------*/
-       if (window_found == FALSE) {
+       if (window_found == false) {
                if (rqfd_start < SDRAM_RQDC_RQFD_MAX) {
                        putc('\b');
                        putc(slash[loopi++ % 8]);
@@ -2769,13 +2766,13 @@ static void test(void)
        mtsdram(SDRAM_MCOPT1, (val & ~SDRAM_MCOPT1_MCHK_MASK) |
                SDRAM_MCOPT1_MCHK_NON);
 
-       window_found = FALSE;
-       begin_found[0] = FALSE;
-       end_found[0] = FALSE;
-       search_end[0] = FALSE;
-       begin_found[1] = FALSE;
-       end_found[1] = FALSE;
-       search_end[1] = FALSE;
+       window_found = false;
+       begin_found[0] = false;
+       end_found[0] = false;
+       search_end[0] = false;
+       begin_found[1] = false;
+       end_found[1] = false;
+       search_end[1] = false;
 
        for (dimm_num = 0; dimm_num < MAXDIMMS; dimm_num++) {
                mfsdram(SDRAM_MB0CF + (bxcr_num << 2), bxcf[bxcr_num]);
@@ -2812,32 +2809,32 @@ static void test(void)
                         * See if the rffd value passed.
                         *-----------------------------------------------------------------*/
                        if (i < NUMMEMTESTS) {
-                               if ((end_found[dimm_num] == FALSE) &&
-                                   (search_end[dimm_num] == TRUE)) {
-                                       end_found[dimm_num] = TRUE;
+                               if ((end_found[dimm_num] == false) &&
+                                   (search_end[dimm_num] == true)) {
+                                       end_found[dimm_num] = true;
                                }
-                               if ((end_found[0] == TRUE) &&
-                                   (end_found[1] == TRUE))
+                               if ((end_found[0] == true) &&
+                                   (end_found[1] == true))
                                        break;
                        } else {
-                               if (begin_found[dimm_num] == FALSE) {
-                                       begin_found[dimm_num] = TRUE;
-                                       search_end[dimm_num] = TRUE;
+                               if (begin_found[dimm_num] == false) {
+                                       begin_found[dimm_num] = true;
+                                       search_end[dimm_num] = true;
                                }
                        }
                } else {
-                       begin_found[dimm_num] = TRUE;
-                       end_found[dimm_num] = TRUE;
+                       begin_found[dimm_num] = true;
+                       end_found[dimm_num] = true;
                }
        }
 
-       if ((begin_found[0] == TRUE) && (begin_found[1] == TRUE))
-               window_found = TRUE;
+       if ((begin_found[0] == true) && (begin_found[1] == true))
+               window_found = true;
 
        /*------------------------------------------------------------------
         * Make sure we found the valid read passing window.  Halt if not
         *-----------------------------------------------------------------*/
-       if (window_found == FALSE) {
+       if (window_found == false) {
                printf("ERROR: Cannot determine a common read delay for the "
                       "DIMM(s) installed.\n");
                spd_ddr_init_hang ();
index ce769a715627b26f886d1d16fa54cdba96806388..3ceab32e4371164d14539bc68911624e4146108a 100644 (file)
 /*-----------------------------------------------------------------------------+
  * Defines
  *-----------------------------------------------------------------------------*/
-#ifndef        TRUE
-#define TRUE           1
-#endif
-#ifndef FALSE
-#define FALSE          0
-#endif
-
 #define MAXDIMMS       2
 #define MAXRANKS       2
 
@@ -279,7 +272,7 @@ static void get_spd_info(unsigned long dimm_ranks[],
                         unsigned long num_dimm_banks)
 {
        unsigned long dimm_num;
-       unsigned long dimm_found = FALSE;
+       unsigned long dimm_found = false;
        unsigned long const max_ranks_per_dimm = (1 == num_dimm_banks) ? 2 : 1;
        unsigned char num_of_bytes;
        unsigned char total_size;
@@ -334,7 +327,7 @@ static void get_spd_info(unsigned long dimm_ranks[],
                                       "\n\n");
                                spd_ddr_init_hang();
                        }
-                       dimm_found = TRUE;
+                       dimm_found = true;
                        debug("DIMM slot %lu: populated with %lu-rank DDR2 DIMM"
                              "\n", dimm_num, ranks_on_dimm);
                        if (ranks_on_dimm > max_ranks_per_dimm) {
@@ -355,7 +348,7 @@ static void get_spd_info(unsigned long dimm_ranks[],
                        debug("DIMM slot %lu: Not populated\n", dimm_num);
                }
        }
-       if (dimm_found == FALSE) {
+       if (dimm_found == false) {
                printf("ERROR: No memory installed.\n");
                printf("Install at least one DDR2 DIMM.\n\n");
                spd_ddr_init_hang();
@@ -882,7 +875,7 @@ static void program_ddr0_22(unsigned long dimm_ranks[],
                        /* Check for ECC */
                        if (0 == (spd_read(iic0_dimm_addr[dimm_num], 11) &
                                  0x02)) {
-                               ecc_available = FALSE;
+                               ecc_available = false;
                        }
                }
        }
index 17810395b81be36d26843c69292b102d5ce78dac..63114bb0c5aab624e974cfeb6ae22db477d2db9f 100644 (file)
@@ -50,19 +50,24 @@ wait_ticks:
        stwu    r1, -16(r1)
        mflr    r0              /* save link register */
        stw     r0, 20(r1)      /* Use r0 or GDB will be unhappy */
-       mr      r7, r3          /* save tick count */
+       stw     r14, 12(r1)     /* save used registers */
+       stw     r15, 8(r1)
+       mr      r14, r3         /* save tick count */
        bl      get_ticks       /* Get start time */
 
        /* Calculate end time */
-       addc    r7, r4, r7      /* Compute end time lower */
-       addze   r6, r3          /*     and end time upper */
+       addc    r14, r4, r14    /* Compute end time lower */
+       addze   r15, r3         /*     and end time upper */
 
        WATCHDOG_RESET          /* Trigger watchdog, if needed */
 1:     bl      get_ticks       /* Get current time */
-       subfc   r4, r4, r     /* Subtract current time from end time */
-       subfe.  r3, r3, r6
+       subfc   r4, r4, r14     /* Subtract current time from end time */
+       subfe.  r3, r3, r15
        bge     1b              /* Loop until time expired */
 
-       mtlr    r0              /* restore link register */
+       lwz     r15, 8(r1)      /* restore saved registers */
+       lwz     r14, 12(r1)
+       lwz     r0, 20(r1)
        addi    r1,r1,16
+       mtlr    r0
        blr
index 92901b1b94a5226abdb941fcf319997078546c56..592d9e3195653eabf931a8794f671e34f3af2797 100644 (file)
@@ -134,6 +134,6 @@ SECTIONS
    *(.bss)
    *(COMMON)
   }
-  __bss_end__ = . ;
+  __bss_end = . ;
   PROVIDE (end = .);
 }
index 7fd635523641f76bd6e27c8c0dce81bbeef68c04..140060414258a5bc1c8659b01494cc76acdd1ca9 100644 (file)
@@ -383,7 +383,7 @@ unsigned int memoryGetDeviceWidth (DEVICE device)
 * OUTPUT:
 *       None.
 * RETURN:
-*       False for invalid size, true otherwise.
+*       false for invalid size, true otherwise.
 *
 * CAUTION: PCI_functions must be implemented later To_do !!!!!!!!!!!!!!!!!
 *
@@ -509,7 +509,7 @@ bool memoryMapBank (MEMORY_BANK bank, unsigned int bankBase,
 *       None.
 *
 * RETURN:
-*       False for invalid size, true otherwise.
+*       false for invalid size, true otherwise.
 *
 * CAUTION: PCI_functions must be implemented later To_do !!!!!!!!!!!!!!!!!
 *
@@ -624,7 +624,7 @@ bool memoryMapDeviceSpace (DEVICE device, unsigned int deviceBase,
 *       None.
 *
 * RETURN:
-*       False for invalid size, true otherwise.
+*       false for invalid size, true otherwise.
 *
 *******************************************************************************/
 bool memorySetPciWindow (PCI_MEM_WINDOW pciWindow, unsigned int pciWindowBase,
@@ -885,7 +885,7 @@ void gtMemorySetInternalSramBaseAddr (unsigned int sramBaseAddress)
 *       None.
 *
 * RETURN:
-*       False for invalid size, true otherwise.
+*       false for invalid size, true otherwise.
 *
 *******************************************************************************/
 bool memorySetProtectRegion (MEMORY_PROTECT_WINDOW window,
@@ -1380,7 +1380,7 @@ void MemoryEnableWindow (MEMORY_WINDOW window)
 * OUTPUT:
 *       None.
 * RETURN:
-*       True for a closed window, false otherwise .
+*       true for a closed window, false otherwise .
 *******************************************************************************/
 MEMORY_WINDOW_STATUS MemoryGetMemWindowStatus (MEMORY_WINDOW window)
 {
index 7ad6ae8c0edefecec5648a2c384b1b39db07e7af..9227e5cb1f0d6e93b4e1406455bd59a2205fc792 100644 (file)
@@ -966,7 +966,7 @@ static int galmpsc_set_snoop (int mpsc, int value)
 *       None.
 *
 * RETURN:
-*       True for success, false otherwise.
+*       true for success, false otherwise.
 *
 *******************************************************************************/
 
index bd8e05dafd606aa5d1df8b0df514e1f6138de09d..d7de9d9796989e0daba3baaba9f798b2575e83d8 100644 (file)
 **************************************************************************
 **************************************************************************
 *************************************************************************/
-#ifndef TRUE
-#define TRUE 1
-#endif
-#ifndef FALSE
-#define FALSE 0
-#endif
-
 /* In case not using SG on Tx, define MAX_SKB_FRAGS as 0 */
 #ifndef MAX_SKB_FRAGS
 #define MAX_SKB_FRAGS 0
index 303a63615f730ea9ae2629dd85437d60a9ab9328..45e13b8fe27f495f97e34fa960f4010923c08765 100644 (file)
@@ -966,7 +966,7 @@ static int galmpsc_set_snoop (int mpsc, int value)
 *       None.
 *
 * RETURN:
-*       True for success, false otherwise.
+*       true for success, false otherwise.
 *
 *******************************************************************************/
 
index af4e818fe8e301819313bad6a196ef084d0eb5fb..1107e959baaa3f793bf92670aceac8cca0429e1e 100644 (file)
 **************************************************************************
 **************************************************************************
 *************************************************************************/
-#ifndef TRUE
-#define TRUE 1
-#endif
-#ifndef FALSE
-#define FALSE 0
-#endif
-
 /* In case not using SG on Tx, define MAX_SKB_FRAGS as 0 */
 #ifndef MAX_SKB_FRAGS
 #define MAX_SKB_FRAGS 0
index c41343919ec4e86553e4e84a91c57eb43668b9d0..3119d0a073e0087249107742b8f36d33027be5da 100644 (file)
@@ -91,11 +91,6 @@ extern unsigned int INTERNAL_REG_BASE_ADDR;
 #define _1G            0x40000000
 #define _2G            0x80000000
 
-#ifndef        BOOL_WAS_DEFINED
-#define BOOL_WAS_DEFINED
-typedef enum _bool{false,true} bool;
-#endif
-
 /* Little to Big endian conversion macros */
 
 #ifdef LE /* Little Endian */
index e88bd977d9ec82245c03fcd978952b8ccf2a0a35..40f17e9d5fc45c2349ab64e0e2edd5843d742c79 100644 (file)
@@ -132,6 +132,6 @@ SECTIONS
    *(.bss)
    *(COMMON)
   }
-  __bss_end__ = . ;
+  __bss_end = . ;
   PROVIDE (end = .);
 }
index e88bd977d9ec82245c03fcd978952b8ccf2a0a35..40f17e9d5fc45c2349ab64e0e2edd5843d742c79 100644 (file)
@@ -132,6 +132,6 @@ SECTIONS
    *(.bss)
    *(COMMON)
   }
-  __bss_end__ = . ;
+  __bss_end = . ;
   PROVIDE (end = .);
 }
index 88c410cd9285b3c2c3c3119606911b07b2af2657..7b89b4f6a5c60b280ec33243b98ef36f8c2902e5 100644 (file)
@@ -132,6 +132,6 @@ SECTIONS
    *(.bss)
    *(COMMON)
   }
-  __bss_end__ = . ;
+  __bss_end = . ;
   PROVIDE (end = .);
 }
index 32b28f927053df95d6d3fc498dfe743808899bb0..644c445693b740936d43e8d1c6e5cfec5451ab03 100644 (file)
@@ -561,7 +561,8 @@ static char *menu_handle(struct menu_display *display)
        char *s;
        char temp[6][200];
 
-       m = menu_create(display->title, display->timeout, 1, ait_menu_print);
+       m = menu_create(display->title, display->timeout, 1, ait_menu_print,
+                       NULL, NULL);
 
        for (i = 0; display->menulist[i]; i++) {
                sprintf(key, "%d", i + 1);
index 79788a80fc60924ac71a768b72cf6ad7df5532d9..6f5d0a60a3112ff7777af8d235ddb3185d632828 100644 (file)
@@ -477,16 +477,16 @@ int is_powerpc440ep_pass1(void)
        pvr = get_pvr();
 
        if (pvr == PVR_POWERPC_440EP_PASS1)
-               return TRUE;
+               return true;
        else if (pvr == PVR_POWERPC_440EP_PASS2)
-               return FALSE;
+               return false;
        else {
                printf("brdutil error 3\n");
                for (;;)
                        ;
        }
 
-       return(FALSE);
+       return false;
 }
 
 /*----------------------------------------------------------------------------+
@@ -495,9 +495,9 @@ int is_powerpc440ep_pass1(void)
 int is_nand_selected(void)
 {
 #ifdef CONFIG_BAMBOO_NAND
-       return TRUE;
+       return true;
 #else
-       return FALSE;
+       return false;
 #endif
 }
 
@@ -507,7 +507,7 @@ int is_nand_selected(void)
 unsigned char config_on_ebc_cs4_is_small_flash(void)
 {
        /* Not implemented yet => returns constant value */
-       return TRUE;
+       return true;
 }
 
 /*----------------------------------------------------------------------------+
@@ -561,7 +561,7 @@ void ext_bus_cntlr_init(void)
        /*-------------------------------------------------------------------------+
          |  PPC440EP Pass1
          +-------------------------------------------------------------------------*/
-       if (is_powerpc440ep_pass1() == TRUE) {
+       if (is_powerpc440ep_pass1() == true) {
                switch(bootstrap_settings) {
                case SDR0_PSTRP0_BOOTSTRAP_SETTINGS0:
                        /* Default Strap Settings 0 : CPU 400 - PLB 133 - Boot EBC 8 bit 33MHz */
@@ -738,7 +738,7 @@ void ext_bus_cntlr_init(void)
                /*------------------------------------------------------------------------- */
                ebc0_cs0_bnap_value = EBC0_BNAP_SMALL_FLASH;
                ebc0_cs0_bncr_value = EBC0_BNCR_SMALL_FLASH_CS0;
-               if ((is_nand_selected()) == TRUE) {
+               if ((is_nand_selected()) == true) {
                        /* NAND Flash */
                        ebc0_cs1_bnap_value = EBC0_BNAP_NAND_FLASH;
                        ebc0_cs1_bncr_value = EBC0_BNCR_NAND_FLASH_CS1;
@@ -765,7 +765,7 @@ void ext_bus_cntlr_init(void)
                /*------------------------------------------------------------------------- */
                ebc0_cs0_bnap_value = EBC0_BNAP_LARGE_FLASH_OR_SRAM;
                ebc0_cs0_bncr_value = EBC0_BNCR_LARGE_FLASH_OR_SRAM_CS0;
-               if ((is_nand_selected()) == TRUE) {
+               if ((is_nand_selected()) == true) {
                        /* NAND Flash */
                        ebc0_cs1_bnap_value = EBC0_BNAP_NAND_FLASH;
                        ebc0_cs1_bncr_value = EBC0_BNCR_NAND_FLASH_CS1;
@@ -812,7 +812,7 @@ void ext_bus_cntlr_init(void)
                ebc0_cs0_bnap_value = 0;
                ebc0_cs0_bncr_value = 0;
 
-               if ((is_nand_selected()) == TRUE) {
+               if ((is_nand_selected()) == true) {
                        /* NAND Flash */
                        ebc0_cs1_bnap_value = EBC0_BNAP_NAND_FLASH;
                        ebc0_cs1_bncr_value = EBC0_BNCR_NAND_FLASH_CS1;
@@ -830,7 +830,7 @@ void ext_bus_cntlr_init(void)
                        ebc0_cs3_bncr_value = 0;
                }
 
-               if ((config_on_ebc_cs4_is_small_flash()) == TRUE) {
+               if ((config_on_ebc_cs4_is_small_flash()) == true) {
                        /* Small Flash */
                        ebc0_cs4_bnap_value = EBC0_BNAP_SMALL_FLASH;
                        ebc0_cs4_bncr_value = EBC0_BNCR_SMALL_FLASH_CS4;
index f2b78a94533107387053108e2d9797f830abcfad..6c49733639b5e02bd1ae9a54ec026933d0840c21 100644 (file)
 #define         PVR_POWERPC_440EP_PASS1    0x42221850
 #define         PVR_POWERPC_440EP_PASS2    0x422218D3
 
-#define TRUE 1
-#define FALSE 0
-
 #define GPIO0          0
 #define GPIO1          1
 
index 1fab794bd310bc237e4c0cfc7c5321b425fffdca..f606d920b536fd5a0176787cfc312589756a9b80 100644 (file)
@@ -47,9 +47,6 @@ void fpga_init (void);
 #define DEBUGF(fmt,args...)
 #endif
 
-#define FALSE  0
-#define TRUE   1
-
 int board_early_init_f (void)
 {
 /*----------------------------------------------------------------------------+
index eb0af947979ffb420a7ec5cd18b063133e072a44..f073c0c84be39c5825a8e66d6976518fdf9964f9 100644 (file)
@@ -32,8 +32,6 @@
 
 #define V_ULONG(a)             (*(volatile unsigned long *)( a ))
 #define V_BYTE(a)              (*(volatile unsigned char *)( a ))
-#define TRUE                   0x1
-#define FALSE                  0x0
 #define BUFFER_SIZE            0x80000
 #define NO_COMMAND             0
 #define GET_CODES              1
index ab808d86b0c3c1a5a4222af40845fc533bc11e92..e4fcd1e39d2e6c455a4ca33804c693fcc5441f22 100644 (file)
@@ -309,7 +309,7 @@ int read_flash(long nOffset, int *pnValue)
        nValue = *(volatile unsigned short *)addr;
        SSYNC();
        *pnValue = nValue;
-       return TRUE;
+       return true;
 }
 
 int poll_toggle_bit(long lOffset)
@@ -398,7 +398,7 @@ int erase_block_flash(int nBlock, unsigned long address)
        long ulSectorOff = 0x0;
 
        if ((nBlock < 0) || (nBlock > AFP_NumSectors))
-               return FALSE;
+               return false;
 
        ulSectorOff = (address - CONFIG_SYS_FLASH_BASE);
 
index 80837e2323b781159270354cc22788c8f7a64b7f..949c3d8f3f7c8d093659a838094ecb2416297a89 100644 (file)
@@ -9,9 +9,6 @@
 #define YELLOW  (0xD292D210)   /* yellow pixel pattern  */
 #define WHITE   (0xFE80FE80)   /* white pixel pattern   */
 
-#define true   1
-#define false  0
-
 typedef struct {
        unsigned int sav;
        unsigned int eav;
index 629ce4a5054e4ab4f6f65c6f88e3c24b9895247d..84c36bafb414d56004fa8de98682bd2995ab5c1d 100644 (file)
@@ -91,6 +91,7 @@ static int splash_load_from_nand(u32 bmp_load_addr)
 
        res = nand_read_skip_bad(&nand_info[nand_curr_device],
                        splash_screen_nand_offset, &bmp_header_size,
+                       NULL, nand_info[nand_curr_device].size,
                        (u_char *)bmp_load_addr);
        if (res < 0)
                return res;
@@ -103,6 +104,7 @@ static int splash_load_from_nand(u32 bmp_load_addr)
 
        return nand_read_skip_bad(&nand_info[nand_curr_device],
                        splash_screen_nand_offset, &bmp_size,
+                       NULL, nand_info[nand_curr_device].size,
                        (u_char *)bmp_load_addr);
 
 splash_address_too_high:
index 2f78bad6ea1698dc3a5b88a2a11c839097566f62..a004ea1d803206ee99f020c31b17e3b64283e6f9 100644 (file)
@@ -381,14 +381,6 @@ static enum display_type env_parse_displaytype(char *displaytype)
        return NONE;
 }
 
-int lcd_line_length;
-int lcd_color_fg;
-int lcd_color_bg;
-void *lcd_base;
-short console_col;
-short console_row;
-void *lcd_console_address;
-
 void lcd_ctrl_init(void *lcdbase)
 {
        struct prcm *prcm = (struct prcm *)PRCM_BASE;
index e88bd977d9ec82245c03fcd978952b8ccf2a0a35..40f17e9d5fc45c2349ab64e0e2edd5843d742c79 100644 (file)
@@ -132,6 +132,6 @@ SECTIONS
    *(.bss)
    *(COMMON)
   }
-  __bss_end__ = . ;
+  __bss_end = . ;
   PROVIDE (end = .);
 }
index 99cbed4b4714c285cd5251898729e40bf3fdf03d..1b45e5ea6fea0743c0571a6da4f37db0bf294374 100644 (file)
@@ -132,6 +132,6 @@ SECTIONS
    *(.bss)
    *(COMMON)
   }
-  __bss_end__ = . ;
+  __bss_end = . ;
   PROVIDE (end = .);
 }
index 614bbb20b63e5ee056bcd85ea4764ffa54b92969..a33b0a6f1a077e70d06ebd7d32d41691c3223e45 100644 (file)
@@ -132,6 +132,6 @@ SECTIONS
    *(.bss)
    *(COMMON)
   }
-  __bss_end__ = . ;
+  __bss_end = . ;
   PROVIDE (end = .);
 }
index 39807d43cc7e6a9fbefedd4600d8e9f3e119a9a5..704e8c91b5867c3d7ebb808dde395339bdc32a7c 100644 (file)
@@ -126,6 +126,6 @@ SECTIONS
    *(.bss)
    *(COMMON)
   }
-  __bss_end__ = . ;
+  __bss_end = . ;
   PROVIDE (end = .);
 }
index 3dfbf3bc913d891e5d27621691ce601a4edbd85e..1a5f6565e52a070ed322f780809386a87740e464 100644 (file)
@@ -260,7 +260,7 @@ int lcd_init(uchar *lcd_reg, uchar *lcd_mem, S1D_REGS *regs, int reg_count,
                /*
                 * Big epson detected
                 */
-               reg_byte_swap = FALSE;
+               reg_byte_swap = false;
                palette_index = 0x1e2;
                palette_value = 0x1e4;
                lcd_depth = 16;
@@ -269,7 +269,7 @@ int lcd_init(uchar *lcd_reg, uchar *lcd_mem, S1D_REGS *regs, int reg_count,
                /*
                 * Big epson detected (with register swap bug)
                 */
-               reg_byte_swap = TRUE;
+               reg_byte_swap = true;
                palette_index = 0x1e3;
                palette_value = 0x1e5;
                lcd_depth = 16;
@@ -278,7 +278,7 @@ int lcd_init(uchar *lcd_reg, uchar *lcd_mem, S1D_REGS *regs, int reg_count,
                /*
                 * Small epson detected (704)
                 */
-               reg_byte_swap = FALSE;
+               reg_byte_swap = false;
                palette_index = 0x15;
                palette_value = 0x17;
                lcd_depth = 8;
@@ -287,7 +287,7 @@ int lcd_init(uchar *lcd_reg, uchar *lcd_mem, S1D_REGS *regs, int reg_count,
                /*
                 * Small epson detected (705)
                 */
-               reg_byte_swap = FALSE;
+               reg_byte_swap = false;
                palette_index = 0x15;
                palette_value = 0x17;
                lcd_depth = 8;
@@ -300,7 +300,7 @@ int lcd_init(uchar *lcd_reg, uchar *lcd_mem, S1D_REGS *regs, int reg_count,
                        /*
                         * S1D13505 detected
                         */
-                       reg_byte_swap = TRUE;
+                       reg_byte_swap = true;
                        palette_index = 0x25;
                        palette_value = 0x27;
                        lcd_depth = 16;
index 01f6019bb2d806d617af7177b4cb430528d816fc..5c48b5ad5a03d0e6519801746054d782b586ec0b 100644 (file)
 #define LOAD_LONG(data)   SWAP_LONG(data)
 #define LOAD_SHORT(data)  SWAP_SHORT(data)
 
-#ifndef FALSE
-#define FALSE 0
-#define TRUE (!FALSE)
-#endif
-
 #define S1D_WRITE_PALETTE(p,i,r,g,b)                                   \
        {                                                               \
                out_8(&((uchar*)(p))[palette_index], (uchar)(i));       \
index c89426d085896be68a26889c0f6aa1af224beef0..4adcec078a1fe01d705dd6e4134b5ae2ffdb1131 100644 (file)
@@ -967,7 +967,7 @@ static int galmpsc_set_snoop (int mpsc, int value)
 *       None.
 *
 * RETURN:
-*       True for success, false otherwise.
+*       true for success, false otherwise.
 *
 *******************************************************************************/
 
index 3d0cb10dd5d883a05609560b3c5d9f35589d2b51..94745bcf03502446449ed733dc769a914f7f09ce 100644 (file)
 **************************************************************************
 **************************************************************************
 *************************************************************************/
-#ifndef TRUE
-#define TRUE 1
-#endif
-#ifndef FALSE
-#define FALSE 0
-#endif
-
 /* In case not using SG on Tx, define MAX_SKB_FRAGS as 0 */
 #ifndef MAX_SKB_FRAGS
 #define MAX_SKB_FRAGS 0
index 001480876245399e9fb9a43a2d74a1274bdfbde7..ccea7152c2b06193f28c0074f1309f01bdecc440 100644 (file)
 #define OK 0
 #define ERROR (-1)
 
-#define TRUE 1
-#define FALSE 0
-
-
 extern u_long pci9054_iobase;
 
 
@@ -97,7 +93,7 @@ static int PciEepromWriteLongVPD (int offs, unsigned int value)
                }
        }
 
-       return TRUE;
+       return true;
 }
 
 
index f92bbff291db3d16853603eafe981220cd53bd2e..d38cc96066d7a581adc4f3979fc8d774176f92cd 100644 (file)
@@ -113,7 +113,7 @@ void fpga_serialslave_init(void)
 {
        debug("%s:%d: Initialize serial slave interface\n", __FUNCTION__,
              __LINE__);
-       fpga_pgm_fn(FALSE, FALSE, 0);   /* make sure program pin is inactive */
+       fpga_pgm_fn(false, false, 0);   /* make sure program pin is inactive */
 }
 
 
@@ -188,7 +188,7 @@ int fpga_done_fn(int cookie)
 int fpga_pre_config_fn(int cookie)
 {
        debug("%s:%d: FPGA pre-configuration\n", __FUNCTION__, __LINE__);
-       fpga_reset(TRUE);
+       fpga_reset(true);
 
        /* release init# */
        out_be32((void*)GPIO0_OR, in_be32((void*)GPIO0_OR) | GPIO0_FPGA_FORCEINIT);
@@ -213,9 +213,9 @@ int fpga_post_config_fn(int cookie)
        /* enable PLD0..7 pins */
        out_be32((void*)GPIO1_OR, in_be32((void*)GPIO1_OR) & ~GPIO1_IOEN_N);
 
-       fpga_reset(TRUE);
+       fpga_reset(true);
        udelay (100);
-       fpga_reset(FALSE);
+       fpga_reset(false);
        udelay (100);
 
        FPGA_OUT32(&fpga->status, (gd->board_type << STATUS_HWREV_SHIFT) & STATUS_HWREV_MASK);
@@ -296,7 +296,7 @@ void ngcc_fpga_serialslave_init(void)
              __FUNCTION__, __LINE__);
 
        /* make sure program pin is inactive */
-       ngcc_fpga_pgm_fn (FALSE, FALSE, 0);
+       ngcc_fpga_pgm_fn(false, false, 0);
 }
 
 /*
@@ -382,10 +382,10 @@ int ngcc_fpga_pre_config_fn(int cookie)
        pmc440_fpga_t *fpga = (pmc440_fpga_t *)FPGA_BA;
        debug("%s:%d: FPGA pre-configuration\n", __FUNCTION__, __LINE__);
 
-       ngcc_fpga_reset(TRUE);
+       ngcc_fpga_reset(true);
        FPGA_CLRBITS(&fpga->ctrla, 0xfffffe00);
 
-       ngcc_fpga_reset(TRUE);
+       ngcc_fpga_reset(true);
        return 0;
 }
 
@@ -401,7 +401,7 @@ int ngcc_fpga_post_config_fn(int cookie)
        debug("%s:%d: NGCC FPGA post configuration\n", __FUNCTION__, __LINE__);
 
        udelay (100);
-       ngcc_fpga_reset(FALSE);
+       ngcc_fpga_reset(false);
 
        FPGA_SETBITS(&fpga->ctrla, 0x29f8c000);
 
index e8ef0e3e52ea415fc3b85a597bc3b2772171947f..8c2c17f962922f3fea57655ea4b15a15c726933d 100644 (file)
@@ -6,9 +6,6 @@
 #include "eth.h"
 #include "eth_addrtbl.h"
 
-#define TRUE 1
-#define FALSE 0
-
 #define PRINTF printf
 
 #ifdef CONFIG_GT_USE_MAC_HASH_TABLE
@@ -160,8 +157,8 @@ u32 hashTableFunction (u32 macH, u32 macL, u32 HashSize, u32 hash_mode)
  * rd   - the RD field in the address table.
  * Outputs
  * address table entry is added.
- * TRUE if success.
- * FALSE if table full
+ * true if success.
+ * false if table full
  */
 int addAddressTableEntry (u32 port, u32 macH, u32 macL, u32 rd, u32 skip)
 {
@@ -206,7 +203,7 @@ int addAddressTableEntry (u32 port, u32 macH, u32 macL, u32 rd, u32 skip)
 
        if (i == HOP_NUMBER) {
                PRINTF ("addGT64260addressTableEntry: table section is full\n");
-               return (FALSE);
+               return false;
        }
 
        /*
@@ -215,7 +212,7 @@ int addAddressTableEntry (u32 port, u32 macH, u32 macL, u32 rd, u32 skip)
        entry->hi = newHi;
        entry->lo = newLo;
        DCACHE_FLUSH_N_SYNC ((u32) entry, MAC_ENTRY_SIZE);
-       return (TRUE);
+       return true;
 }
 
 #endif /* CONFIG_GT_USE_MAC_HASH_TABLE */
index 614bbb20b63e5ee056bcd85ea4764ffa54b92969..a33b0a6f1a077e70d06ebd7d32d41691c3223e45 100644 (file)
@@ -132,6 +132,6 @@ SECTIONS
    *(.bss)
    *(COMMON)
   }
-  __bss_end__ = . ;
+  __bss_end = . ;
   PROVIDE (end = .);
 }
index d42c500ca085031011d4eb6bf2cde2d15bc51a3f..4c360096b1f0463955a417ca401fe6fbbafb12f0 100644 (file)
@@ -182,7 +182,7 @@ void fpga_selectmap_init (void)
 {
        PRINTF ("%s:%d: Initialize SelectMap interface\n", __FUNCTION__,
                __LINE__);
-       fpga_pgm_fn (FALSE, FALSE, 0);  /* make sure program pin is inactive */
+       fpga_pgm_fn(false, false, 0);   /* make sure program pin is inactive */
 }
 
 
@@ -314,7 +314,7 @@ int fpga_abort_fn (int cookie)
 int fpga_pre_config_fn (int cookie)
 {
        PRINTF ("%s:%d: FPGA pre-configuration\n", __FUNCTION__, __LINE__);
-       fpga_reset (TRUE);
+       fpga_reset(true);
        return 0;
 }
 
@@ -328,9 +328,9 @@ int fpga_post_config_fn (int cookie)
        int rc;
 
        PRINTF ("%s:%d: FPGA post configuration\n", __FUNCTION__, __LINE__);
-       fpga_reset (TRUE);
+       fpga_reset(true);
        udelay (1000);
-       fpga_reset (FALSE);
+       fpga_reset(false);
        udelay (1000);
 
        /*
index a3aeb604cc36af720aa8936c764d7c6f4e25fe9d..cc8694190285745acafe0976f1e527caad220f5d 100644 (file)
@@ -138,6 +138,6 @@ SECTIONS
   {
     common/env_embedded.o (.ppcenv)
   }
-  __bss_end__ = . ;
+  __bss_end = . ;
   PROVIDE (end = .);
 }
index 4383c492c3bf5b31577292ec80199e6973f7778d..982b0f3afadda8c6ce19550da89c2169828f3d5b 100644 (file)
@@ -132,6 +132,6 @@ SECTIONS
    *(.bss)
    *(COMMON)
   }
-  __bss_end__ = . ;
+  __bss_end = . ;
   PROVIDE (end = .);
 }
index e88bd977d9ec82245c03fcd978952b8ccf2a0a35..40f17e9d5fc45c2349ab64e0e2edd5843d742c79 100644 (file)
@@ -132,6 +132,6 @@ SECTIONS
    *(.bss)
    *(COMMON)
   }
-  __bss_end__ = . ;
+  __bss_end = . ;
   PROVIDE (end = .);
 }
index 99952885173d1908f43100f26d0de924fb736320..d5220cc6d53bcb1569bf0c9ec690f9edd9a7941d 100644 (file)
@@ -133,6 +133,6 @@ SECTIONS
    *(.bss)
    *(COMMON)
   }
-  __bss_end__ = . ;
+  __bss_end = . ;
   PROVIDE (end = .);
 }
index 0b3417753161e8a15cdc05ff26cacd89435965fc..ecc9f26e08f0fd2c5b8ad688459c139477da0713 100644 (file)
@@ -133,6 +133,6 @@ SECTIONS
    *(.bss)
    *(COMMON)
   }
-  __bss_end__ = . ;
+  __bss_end = . ;
   PROVIDE (end = .);
 }
index bae9fb28ee1aa9ddfa25b7683e3955da6252ea54..62c66d7899d8fd393c86099f9459acc53bd819bf 100644 (file)
@@ -133,6 +133,6 @@ SECTIONS
    *(.bss)
    *(COMMON)
   }
-  __bss_end__ = . ;
+  __bss_end = . ;
   PROVIDE (end = .);
 }
index 88c410cd9285b3c2c3c3119606911b07b2af2657..7b89b4f6a5c60b280ec33243b98ef36f8c2902e5 100644 (file)
@@ -132,6 +132,6 @@ SECTIONS
    *(.bss)
    *(COMMON)
   }
-  __bss_end__ = . ;
+  __bss_end = . ;
   PROVIDE (end = .);
 }
index 88c410cd9285b3c2c3c3119606911b07b2af2657..7b89b4f6a5c60b280ec33243b98ef36f8c2902e5 100644 (file)
@@ -132,6 +132,6 @@ SECTIONS
    *(.bss)
    *(COMMON)
   }
-  __bss_end__ = . ;
+  __bss_end = . ;
   PROVIDE (end = .);
 }
index 1d1b76ad7c0dd62de3e24a8085454a477413a79c..cb5ed9c339c39eb27162944fa1a3e7738e689dc0 100644 (file)
@@ -133,6 +133,6 @@ SECTIONS
    *(.bss)
    *(COMMON)
   }
-  __bss_end__ = . ;
+  __bss_end = . ;
   PROVIDE (end = .);
 }
index 49af384aaa8937fa76942b36b56c881aff6ad88e..3ea15a1c040865bdf157a2f787ed812246a816e3 100644 (file)
@@ -162,7 +162,7 @@ int board_eth_init(bd_t *bis)
 
 int overwrite_console(void)
 {
-       /* return TRUE if console should be overwritten */
+       /* return true if console should be overwritten */
        return 0;
 }
 
index 063f2cc92fa7983699354ace4cd32870129d6b07..11351176df97ecc34c99cc9b0cbc3c4eba36a20e 100644 (file)
@@ -133,6 +133,6 @@ SECTIONS
    *(.bss)
    *(COMMON)
   }
-  __bss_end__ = . ;
+  __bss_end = . ;
   PROVIDE (end = .);
 }
index 893f4b7cb8d1462e6cbeea3ffa1807fd69dc0940..24f0abddf3734089e391c802fdaeb1039ba02adb 100644 (file)
@@ -68,32 +68,12 @@ vidinfo_t panel_info = {
        LCD_WIDTH, LCD_HEIGHT, LCD_BPP
 };
 
-int lcd_line_length;
-
-int lcd_color_fg;
-int lcd_color_bg;
-
-/*
- * Frame buffer memory information
- */
-void *lcd_base;                        /* Start of framebuffer memory  */
-void *lcd_console_address;     /* Start of console buffer      */
-
-short console_col = 0;
-short console_row = 0;
 
 /*
  *  The device we use to communicate with PSoC
  */
 int serial_inited = 0;
 
-/*
- * Exported functions
- */
-void lcd_initcolregs (void);
-void lcd_ctrl_init (void *lcdbase);
-void lcd_enable (void);
-
 /*
  *  Imported functions to support the PSoC protocol
  */
@@ -156,12 +136,12 @@ void lcd_enable (void)
 
 #if !defined(SWAPPED_LCD)
        for (i=0; i<fb_size; i++) {
-               serial_putc_raw_dev (PSOC_PSC, ((char *)lcd_base)[i]);
+               serial_putc_raw_dev(PSOC_PSC, ((char *)gd->fb_base)[i]);
        }
 #else
     {
        int x, y, pwidth;
-       char *p = (char *)lcd_base;
+       char *p = (char *)gd->fb_base;
 
        pwidth = ((panel_info.vl_col+7) >> 3);
        for (y=0; y<panel_info.vl_row; y++) {
index cc405356dc609557054c5fd6b3b1bac2d5c3eedd..5f60c8dfe3e25faec37712a271eee97d29a5cd2c 100644 (file)
@@ -450,7 +450,7 @@ STATUS flashWrite (flash_dev_t * dev, int pos, char *buf, int len)
 }
 
 /*
- * flashWritable returns TRUE if a range contains all F's.
+ * flashWritable returns true if a range contains all F's.
  */
 
 STATUS flashWritable (flash_dev_t * dev, int pos, int len)
index 525565134777d29c0544d682d87b2fb2e5189e72..2055429b4b1221a932efa0b71d7640b5c0e625d7 100644 (file)
@@ -96,6 +96,6 @@ SECTIONS
     common/env_embedded.o (.ppcenv)
   } > ram
 
-  __bss_end__ = . ;
+  __bss_end = . ;
   PROVIDE (end = .);
 }
index 29a34fb9c5688cc966d28e1479159bfb89c36a27..3c7c544a5b199ab1f266eb51d7227ba799d71a01 100644 (file)
@@ -123,6 +123,6 @@ SECTIONS
    *(COMMON)
   }
 
-  __bss_end__ = . ;
+  __bss_end = . ;
   PROVIDE (end = .);
 }
index fc56153b87c79de1301a34bab14a48d1708abecb..66724edf57c87bbd60b8792734643fe75ca5a3d5 100644 (file)
 #define PRINTF(fmt,args...)
 #endif
 
-#ifndef        TRUE
-#define TRUE            1
-#endif
-#ifndef FALSE
-#define FALSE           0
-#endif
-
 #if defined(CONFIG_PIP405)
 
 extern int drv_isa_kbd_init (void);
@@ -116,9 +109,9 @@ unsigned char open_cfg_super_IO(int address)
        out8(CONFIG_SYS_ISA_IO_BASE_ADDRESS | address,0x55); /* open config */
        out8(CONFIG_SYS_ISA_IO_BASE_ADDRESS | address,0x20); /* set address to DEV ID */
        if(in8(CONFIG_SYS_ISA_IO_BASE_ADDRESS | address | 0x1)==0x40) /* ok Device ID is correct */
-               return TRUE;
+               return true;
        else
-               return FALSE;
+               return false;
 }
 
 void close_cfg_super_IO(int address)
@@ -179,7 +172,7 @@ void isa_sio_loadtable(void)
 
 void isa_sio_setup(void)
 {
-       if(open_cfg_super_IO(SIO_CFG_PORT)==TRUE)
+       if (open_cfg_super_IO(SIO_CFG_PORT) == true)
        {
                isa_sio_loadtable();
                close_cfg_super_IO(0x3F0);
index 56a84e9afab6901a97c69e0f1057788161c02fb8..89ea27600dd432dbb33140362004f1f77bbcf696 100644 (file)
@@ -77,8 +77,6 @@ DECLARE_GLOBAL_DATA_PTR;
 
 #undef SDRAM_DEBUG
 #define ENABLE_ECC /* for ecc boards */
-#define FALSE           0
-#define TRUE            1
 
 /* stdlib.h causes some compatibility problems; should fixe these! -- wd */
 #ifndef __ldiv_t_defined
@@ -771,7 +769,8 @@ int last_stage_init (void)
 
 int overwrite_console (void)
 {
-       return ((in8 (PLD_EXT_CONF_REG) & 0x1)==0);     /* return TRUE if console should be overwritten */
+       /* return true if console should be overwritten */
+       return ((in8(PLD_EXT_CONF_REG) & 0x1) == 0);
 }
 
 
index 75f57ad8ee19830c83db37042d25c5b30329b9da..b203037cf99a60867927cb7ff460ccd59866cca7 100644 (file)
@@ -36,9 +36,6 @@ DECLARE_GLOBAL_DATA_PTR;
 
 #undef SDRAM_DEBUG
 
-#define FALSE           0
-#define TRUE            1
-
 /* stdlib.h causes some compatibility problems; should fixe these! -- wd */
 #ifndef __ldiv_t_defined
 typedef struct {
@@ -700,7 +697,8 @@ int misc_init_r (void)
 
 int overwrite_console (void)
 {
-       return (in8 (CONFIG_PORT_ADDR) & 0x1);  /* return TRUE if console should be overwritten */
+       /* return true if console should be overwritten */
+       return in8(CONFIG_PORT_ADDR) & 0x1;
 }
 
 
@@ -945,7 +943,7 @@ void print_pip405_info (void)
 
 void user_led0 (unsigned char on)
 {
-       if (on == TRUE)
+       if (on == true)
                out8 (PLD_LED_USER_REG, (in8 (PLD_LED_USER_REG) | 0x1));
        else
                out8 (PLD_LED_USER_REG, (in8 (PLD_LED_USER_REG) & 0xfe));
@@ -953,7 +951,7 @@ void user_led0 (unsigned char on)
 
 void user_led1 (unsigned char on)
 {
-       if (on == TRUE)
+       if (on == true)
                out8 (PLD_LED_USER_REG, (in8 (PLD_LED_USER_REG) | 0x2));
        else
                out8 (PLD_LED_USER_REG, (in8 (PLD_LED_USER_REG) & 0xfd));
index 99cbed4b4714c285cd5251898729e40bf3fdf03d..1b45e5ea6fea0743c0571a6da4f37db0bf294374 100644 (file)
@@ -132,6 +132,6 @@ SECTIONS
    *(.bss)
    *(COMMON)
   }
-  __bss_end__ = . ;
+  __bss_end = . ;
   PROVIDE (end = .);
 }
index e1fe052c37464561897979e22d1514cd6f08f14e..5f74337b6dfb2ad20f722f36f72287927a15dd5d 100644 (file)
@@ -132,6 +132,6 @@ SECTIONS
    *(.bss)
    *(COMMON)
   }
-  __bss_end__ = . ;
+  __bss_end = . ;
   PROVIDE (end = .);
 }
index e1fe052c37464561897979e22d1514cd6f08f14e..5f74337b6dfb2ad20f722f36f72287927a15dd5d 100644 (file)
@@ -132,6 +132,6 @@ SECTIONS
    *(.bss)
    *(COMMON)
   }
-  __bss_end__ = . ;
+  __bss_end = . ;
   PROVIDE (end = .);
 }
index e1fe052c37464561897979e22d1514cd6f08f14e..5f74337b6dfb2ad20f722f36f72287927a15dd5d 100644 (file)
@@ -132,6 +132,6 @@ SECTIONS
    *(.bss)
    *(COMMON)
   }
-  __bss_end__ = . ;
+  __bss_end = . ;
   PROVIDE (end = .);
 }
index 3243fc0f36cc1c460b0865c2fad9f53bc74b188b..2fb58972c81188327333d151b159f78eb752478d 100644 (file)
@@ -132,6 +132,6 @@ SECTIONS
    *(.bss)
    *(COMMON)
   }
-  __bss_end__ = . ;
+  __bss_end = . ;
   PROVIDE (end = .);
 }
index 614bbb20b63e5ee056bcd85ea4764ffa54b92969..a33b0a6f1a077e70d06ebd7d32d41691c3223e45 100644 (file)
@@ -132,6 +132,6 @@ SECTIONS
    *(.bss)
    *(COMMON)
   }
-  __bss_end__ = . ;
+  __bss_end = . ;
   PROVIDE (end = .);
 }
index cc05b45038db7b194fe6a5e3790ec87554df7da2..c6a3af5f3eaa62543afa97dc73e273ce192bafa7 100644 (file)
@@ -962,7 +962,7 @@ static int galmpsc_set_snoop (int mpsc, int value)
 *       None.
 *
 * RETURN:
-*       True for success, false otherwise.
+*       true for success, false otherwise.
 *
 *******************************************************************************/
 
index 8cc00dc9c6194793ebc27f8c324d7698e2e97f9a..58a8cb9207608ab54e8966f307f554e30235a708 100644 (file)
 **************************************************************************
 **************************************************************************
 *************************************************************************/
-#ifndef TRUE
-#define TRUE 1
-#endif
-#ifndef FALSE
-#define FALSE 0
-#endif
-
 /* In case not using SG on Tx, define MAX_SKB_FRAGS as 0 */
 #ifndef MAX_SKB_FRAGS
 #define MAX_SKB_FRAGS 0
index abc4640eef5d015025184ceef73b6ae39a4737d5..c4cc39d36e10eb2450cec49b3cba917dfcb68b9b 100644 (file)
@@ -125,6 +125,6 @@ SECTIONS
    *(.bss)
    *(COMMON)
   }
-  __bss_end__ = . ;
+  __bss_end = . ;
   PROVIDE (end = .);
 }
index 4a7f362c5e3ab316b4a5352b28c9df33cec49a5a..3894a5c1aaf04628a2a437f46d7544bf1609df5b 100644 (file)
@@ -94,11 +94,11 @@ uint Daq_BRG_Get_Div16(uint brg)
 
      if (*brg_ptr & CPM_BRG_DIV16) {
         /* DIV16 active */
-        return (TRUE);
+        return true;
      }
      else {
         /* DIV16 inactive */
-        return (FALSE);
+        return false;
      }
 }
 
index 011638f2fa0ce3824d2ebbe68eb384d9e8fbe006..68d69db36f920b37aa0a1314edc4224602b7ddaf 100644 (file)
  * MA 02111-1307 USA
  */
 
-#ifndef FALSE
-#define FALSE 0
-#define TRUE (!FALSE)
-#endif
-
 #define SLRCLK_EN_MASK  0x00040000 /* PA13 - SLRCLK_EN*     */
 
 #define MIN_SAMPLE_RATE       4000 /* Minimum sample rate */
index 6b99f135ada4107439b33495e7d1c9c65bdeb34c..b3b365e81cfe679af2ef4fd96dfa00ad50bdb6ff 100644 (file)
@@ -141,6 +141,6 @@ SECTIONS
    *(.bss)
    *(COMMON)
   }
-  __bss_end__ = . ;
+  __bss_end = . ;
   PROVIDE (end = .);
 }
index 0b4192e8675576f74ba868820b8e56e6b4e214fe..412af14f569e9bd581bbf1112f1d5d900bd1e4ee 100644 (file)
@@ -141,6 +141,6 @@ SECTIONS
    *(.bss)
    *(COMMON)
   }
-  __bss_end__ = . ;
+  __bss_end = . ;
   PROVIDE (end = .);
 }
index 063f2cc92fa7983699354ace4cd32870129d6b07..11351176df97ecc34c99cc9b0cbc3c4eba36a20e 100644 (file)
@@ -133,6 +133,6 @@ SECTIONS
    *(.bss)
    *(COMMON)
   }
-  __bss_end__ = . ;
+  __bss_end = . ;
   PROVIDE (end = .);
 }
index 85eb31be7bc085cbbad800e0ce6db96b68dc80c6..74baa3fc40f53757a4cd46710cdd7e9319dcc960 100644 (file)
@@ -113,7 +113,7 @@ static int fpga_done_fn(int cookie)
 static int fpga_pre_config_fn(int cookie)
 {
        debug("%s:%d: FPGA pre-configuration\n", __func__, __LINE__);
-       fpga_reset(TRUE);
+       fpga_reset(true);
 
        return 0;
 }
@@ -128,9 +128,9 @@ static int fpga_post_config_fn(int cookie)
 
        debug("%s:%d: FPGA post configuration\n", __func__, __LINE__);
 
-       fpga_reset(TRUE);
+       fpga_reset(true);
        udelay(100);
-       fpga_reset(FALSE);
+       fpga_reset(false);
        udelay(100);
 
        return rc;
@@ -200,7 +200,7 @@ static Xilinx_desc fpga[CONFIG_FPGA_COUNT] = {
 static void fpga_serialslave_init(void)
 {
        debug("%s:%d: Initialize serial slave interface\n", __func__, __LINE__);
-       fpga_pgm_fn(FALSE, FALSE, 0);   /* make sure program pin is inactive */
+       fpga_pgm_fn(false, false, 0);   /* make sure program pin is inactive */
 }
 
 static int expi_setup(int freq)
index e1fe052c37464561897979e22d1514cd6f08f14e..5f74337b6dfb2ad20f722f36f72287927a15dd5d 100644 (file)
@@ -132,6 +132,6 @@ SECTIONS
    *(.bss)
    *(COMMON)
   }
-  __bss_end__ = . ;
+  __bss_end = . ;
   PROVIDE (end = .);
 }
index abc4640eef5d015025184ceef73b6ae39a4737d5..c4cc39d36e10eb2450cec49b3cba917dfcb68b9b 100644 (file)
@@ -125,6 +125,6 @@ SECTIONS
    *(.bss)
    *(COMMON)
   }
-  __bss_end__ = . ;
+  __bss_end = . ;
   PROVIDE (end = .);
 }
index d57678668be1228c7209706cc1daa00b90377479..8347cf9ce942c86870cfe02905dab1f74f63dd64 100644 (file)
@@ -179,9 +179,9 @@ int fpga_post_config_fn(int cookie)
 {
        debug("%s:%d: FPGA post-configuration\n", __func__, __LINE__);
 
-       fpga_reset(TRUE);
+       fpga_reset(true);
        udelay(100);
-       fpga_reset(FALSE);
+       fpga_reset(false);
 
        return 0;
 }
index 18b77520542cf4c72c4bef53ef0de833f1650007..5792bac94fc89b56f48292c89b74153e775af4e4 100644 (file)
@@ -132,6 +132,6 @@ SECTIONS
    *(.bss)
    *(COMMON)
   }
-  __bss_end__ = . ;
+  __bss_end = . ;
   PROVIDE (end = .);
 }
index c02581d9820f011b0fcedb5008328255a11f65c9..cb26f0dfe1f30ed080b8ef96720adbb93b881d09 100644 (file)
@@ -137,6 +137,6 @@ SECTIONS
    *(.bss)
    *(COMMON)
   }
-  __bss_end__ = . ;
+  __bss_end = . ;
   PROVIDE (end = .);
 }
index 1abf4ea794e56686c420faeab5024aa885ac7304..0e0fff1ffa30a44d2ce27d91d31956916006b3e3 100644 (file)
@@ -66,6 +66,7 @@ COBJS-$(CONFIG_ENV_IS_IN_NVRAM) += env_nvram.o
 COBJS-$(CONFIG_ENV_IS_IN_ONENAND) += env_onenand.o
 COBJS-$(CONFIG_ENV_IS_IN_SPI_FLASH) += env_sf.o
 COBJS-$(CONFIG_ENV_IS_IN_REMOTE) += env_remote.o
+COBJS-$(CONFIG_ENV_IS_IN_UBI) += env_ubi.o
 COBJS-$(CONFIG_ENV_IS_NOWHERE) += env_nowhere.o
 
 # command
@@ -75,6 +76,7 @@ COBJS-$(CONFIG_CMD_SOURCE) += cmd_source.o
 COBJS-$(CONFIG_CMD_BDI) += cmd_bdinfo.o
 COBJS-$(CONFIG_CMD_BEDBUG) += bedbug.o cmd_bedbug.o
 COBJS-$(CONFIG_CMD_BMP) += cmd_bmp.o
+COBJS-$(CONFIG_CMD_BOOTMENU) += cmd_bootmenu.o
 COBJS-$(CONFIG_CMD_BOOTLDR) += cmd_bootldr.o
 COBJS-$(CONFIG_CMD_BOOTSTAGE) += cmd_bootstage.o
 COBJS-$(CONFIG_CMD_CACHE) += cmd_cache.o
index 60109cf827d25f451e0f408217d60d02ec417e8a..42ecf61eff691db87b388b2edf96d0a7cb33c619 100644 (file)
@@ -72,7 +72,7 @@ int downstring __P ((char *));
  *                     F_INSTR         - output raw instruction.
  *                     F_LINENO        - show line # info if available.
  *
- * Returns TRUE if the area was successfully disassembled or FALSE if
+ * Returns true if the area was successfully disassembled or false if
  * a problem was encountered with accessing the memory.
  */
 
@@ -137,8 +137,8 @@ int disppc (unsigned char *memaddr, unsigned char *virtual, int num_instr,
        for (i = 0; i < num_instr; ++i, memaddr += 4, ctx.virtual += 4) {
 #ifdef USE_SOURCE_CODE
                if (ctx.flags & F_LINENO) {
-                       if ((line_info_from_addr ((Elf32_Word) ctx.virtual, filename,
-                                                                         funcname, &line_no) == TRUE) &&
+                       if ((line_info_from_addr ((Elf32_Word) ctx.virtual,
+                               filename, funcname, &line_no) == true) &&
                                ((line_no != last_line_no) ||
                                 (strcmp (last_funcname, funcname) != 0))) {
                                print_source_line (filename, funcname, line_no, pfunc);
@@ -154,15 +154,15 @@ int disppc (unsigned char *memaddr, unsigned char *virtual, int num_instr,
 #ifdef USE_SOURCE_CODE
                if (ctx.flags & F_SYMBOL) {
                        if ((symname =
-                                symbol_name_from_addr ((Elf32_Word) ctx.virtual,
-                                                                               TRUE, 0)) != 0) {
+                                symbol_name_from_addr((Elf32_Word) ctx.virtual,
+                                               true, 0)) != 0) {
                                cursym = symname;
                                symoffset = 0;
                        } else {
                                if ((cursym == 0) &&
                                        ((symname =
-                                         symbol_name_from_addr ((Elf32_Word) ctx.virtual,
-                                                                                        FALSE, &symoffset)) != 0)) {
+                                         symbol_name_from_addr((Elf32_Word) ctx.virtual,
+                                               false, &symoffset)) != 0)) {
                                        cursym = symname;
                                } else {
                                        symoffset += 4;
@@ -205,7 +205,8 @@ int disppc (unsigned char *memaddr, unsigned char *virtual, int num_instr,
                }
 
                if (((ctx.flags & F_SIMPLE) == 0) ||
-                       (ctx.op->hfunc == 0) || ((*ctx.op->hfunc) (&ctx) == FALSE)) {
+                       (ctx.op->hfunc == 0) ||
+                       ((*ctx.op->hfunc) (&ctx) == false)) {
                        sprintf (&ctx.data[ctx.datalen], "%-7s ", ctx.op->name);
                        ctx.datalen += 8;
                        print_operands (&ctx);
@@ -214,7 +215,7 @@ int disppc (unsigned char *memaddr, unsigned char *virtual, int num_instr,
                (*pfunc) (ctx.data);
        }
 
-       return TRUE;
+       return true;
 }                                                              /* disppc */
 \f
 
@@ -364,10 +365,10 @@ int print_operands (struct ppc_ctx *ctx)
  *     value           The address of an unsigned long to be filled in
  *                     with the value of the operand if it is found.  This
  *                     will only be filled in if the function returns
- *                     TRUE.  This may be passed as 0 if the value is
+ *                     true.  This may be passed as 0 if the value is
  *                     not required.
  *
- * Returns TRUE if the operand was found or FALSE if it was not.
+ * Returns true if the operand was found or false if it was not.
  */
 
 int get_operand_value (struct opcode *op, unsigned long instr,
@@ -379,7 +380,7 @@ int get_operand_value (struct opcode *op, unsigned long instr,
   /*------------------------------------------------------------*/
 
        if (field > n_operands) {
-               return FALSE;                   /* bad operand ?! */
+               return false;                   /* bad operand ?! */
        }
 
        /* Walk through the operands and list each in order */
@@ -393,10 +394,10 @@ int get_operand_value (struct opcode *op, unsigned long instr,
                if (value) {
                        *value = (instr >> opr->shift) & ((1 << opr->bits) - 1);
                }
-               return TRUE;
+               return true;
        }
 
-       return FALSE;
+       return false;
 }                                                              /* operand_value */
 \f
 
@@ -649,7 +650,7 @@ int tbr_value (char *name)
  * Arguments:
  *     ctx             A pointer to the disassembler context record.
  *
- * Returns TRUE if the simpler form was printed or FALSE if it was not.
+ * Returns true if the simpler form was printed or false if it was not.
  */
 
 int handle_bc (struct ppc_ctx *ctx)
@@ -669,33 +670,33 @@ int handle_bc (struct ppc_ctx *ctx)
 
   /*------------------------------------------------------------*/
 
-       if (get_operand_value (ctx->op, ctx->instr, O_BO, &bo) == FALSE)
-               return FALSE;
+       if (get_operand_value(ctx->op, ctx->instr, O_BO, &bo) == false)
+               return false;
 
-       if (get_operand_value (ctx->op, ctx->instr, O_BI, &bi) == FALSE)
-               return FALSE;
+       if (get_operand_value(ctx->op, ctx->instr, O_BI, &bi) == false)
+               return false;
 
        if ((bo == 12) && (bi == 0)) {
                ctx->op = &blt;
                sprintf (&ctx->data[ctx->datalen], "%-7s ", ctx->op->name);
                ctx->datalen += 8;
                print_operands (ctx);
-               return TRUE;
+               return true;
        } else if ((bo == 4) && (bi == 10)) {
                ctx->op = &bne;
                sprintf (&ctx->data[ctx->datalen], "%-7s ", ctx->op->name);
                ctx->datalen += 8;
                print_operands (ctx);
-               return TRUE;
+               return true;
        } else if ((bo == 16) && (bi == 0)) {
                ctx->op = &bdnz;
                sprintf (&ctx->data[ctx->datalen], "%-7s ", ctx->op->name);
                ctx->datalen += 8;
                print_operands (ctx);
-               return TRUE;
+               return true;
        }
 
-       return FALSE;
+       return false;
 }                                                              /* handle_blt */
 \f
 
@@ -719,7 +720,7 @@ int handle_bc (struct ppc_ctx *ctx)
  *     pfunc           The address of a function to call to print the output.
  *
  *
- * Returns TRUE if it was able to output the line info, or false if it was
+ * Returns true if it was able to output the line info, or false if it was
  * not.
  */
 
@@ -734,7 +735,7 @@ int print_source_line (char *filename, char *funcname,
        sprintf (out_buf, "%s %s(): line %d", filename, funcname, line_no);
        (*pfunc) (out_buf);
 
-       return TRUE;
+       return true;
 }                                                              /* print_source_line */
 \f
 
@@ -1039,14 +1040,14 @@ int downstring (char *s)
  * Arguments:
  *     nextaddr        The address (to be filled in) of the next
  *                     instruction to execute.  This will only be a valid
- *                     address if TRUE is returned.
+ *                     address if true is returned.
  *
  *     step_over       A flag indicating how to compute addresses for
  *                     branch statements:
- *                      TRUE  = Step over the branch (next)
- *                      FALSE = step into the branch (step)
+ *                      true  = Step over the branch (next)
+ *                      false = step into the branch (step)
  *
- * Returns TRUE if it was able to compute the address.  Returns FALSE if
+ * Returns true if it was able to compute the address.  Returns false if
  * it has a problem reading the current instruction or one of the registers.
  */
 
@@ -1075,7 +1076,7 @@ int find_next_address (unsigned char *nextaddr, int step_over,
 
        if (nextaddr == 0 || regs == 0) {
                printf ("find_next_address: bad args");
-               return FALSE;
+               return false;
        }
 
        pc = regs->nip & 0xfffffffc;
@@ -1083,7 +1084,7 @@ int find_next_address (unsigned char *nextaddr, int step_over,
 
        if ((op = find_opcode (instr)) == (struct opcode *) 0) {
                printf ("find_next_address: can't parse opcode 0x%lx", instr);
-               return FALSE;
+               return false;
        }
 
        ctr = regs->ctr;
@@ -1100,7 +1101,7 @@ int find_next_address (unsigned char *nextaddr, int step_over,
                        !get_operand_value (op, instr, O_BI, &bi) ||
                        !get_operand_value (op, instr, O_AA, &aa) ||
                        !get_operand_value (op, instr, O_LK, &lk))
-                       return FALSE;
+                       return false;
 
                if ((addr & (1 << 13)) != 0)
                        addr = addr - (1 << 14);
@@ -1116,7 +1117,7 @@ int find_next_address (unsigned char *nextaddr, int step_over,
                if (!get_operand_value (op, instr, O_LI, &addr) ||
                        !get_operand_value (op, instr, O_AA, &aa) ||
                        !get_operand_value (op, instr, O_LK, &lk))
-                       return FALSE;
+                       return false;
 
                if ((addr & (1 << 23)) != 0)
                        addr = addr - (1 << 24);
@@ -1130,7 +1131,7 @@ int find_next_address (unsigned char *nextaddr, int step_over,
                if (!get_operand_value (op, instr, O_BO, &bo) ||
                        !get_operand_value (op, instr, O_BI, &bi) ||
                        !get_operand_value (op, instr, O_LK, &lk))
-                       return FALSE;
+                       return false;
 
                addr = ctr;
                aa = 1;
@@ -1143,7 +1144,7 @@ int find_next_address (unsigned char *nextaddr, int step_over,
                if (!get_operand_value (op, instr, O_BO, &bo) ||
                        !get_operand_value (op, instr, O_BI, &bi) ||
                        !get_operand_value (op, instr, O_LK, &lk))
-                       return FALSE;
+                       return false;
 
                addr = lr;
                aa = 1;
@@ -1227,12 +1228,12 @@ int find_next_address (unsigned char *nextaddr, int step_over,
                step = next = pc + 4;
        }
 
-       if (step_over == TRUE)
+       if (step_over == true)
                *(unsigned long *) nextaddr = next;
        else
                *(unsigned long *) nextaddr = step;
 
-       return TRUE;
+       return true;
 }                                                              /* find_next_address */
 
 
index 29b49c3ab69b2f07865eaa037e5ae4a3f34c2b7c..769889123b48216df5f5f89d6e18b5ffcf5668f5 100644 (file)
@@ -788,9 +788,6 @@ static init_fnc_t init_sequence_f[] = {
        /* TODO: can we rename this to timer_init()? */
        init_timebase,
 #endif
-#if defined(CONFIG_BOARD_EARLY_INIT_F)
-       board_early_init_f,
-#endif
 #ifdef CONFIG_ARM
        timer_init,             /* initialize timer */
 #endif
index 9791423205fb43c9fd91825800a06374d4f9263d..77b6e3e88e4b72aefdf55ef79cee6c6ffa6b4428 100644 (file)
@@ -292,7 +292,7 @@ int do_bedbug_step (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
                return 1;
        }
 
-       if (!find_next_address ((unsigned char *) &addr, FALSE, bug_ctx.regs))
+       if (!find_next_address((unsigned char *) &addr, false, bug_ctx.regs))
                return 1;
 
        if (bug_ctx.set)
@@ -323,7 +323,7 @@ int do_bedbug_next (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
                return 1;
        }
 
-       if (!find_next_address ((unsigned char *) &addr, TRUE, bug_ctx.regs))
+       if (!find_next_address((unsigned char *) &addr, true, bug_ctx.regs))
                return 1;
 
        if (bug_ctx.set)
diff --git a/common/cmd_bootmenu.c b/common/cmd_bootmenu.c
new file mode 100644 (file)
index 0000000..a3cbffa
--- /dev/null
@@ -0,0 +1,517 @@
+/*
+ * (C) Copyright 2011-2013 Pali Roh├ír <pali.rohar@gmail.com>
+ *
+ * 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
+ */
+
+#include <common.h>
+#include <command.h>
+#include <ansi.h>
+#include <menu.h>
+#include <hush.h>
+#include <watchdog.h>
+#include <malloc.h>
+#include <linux/string.h>
+
+/* maximum bootmenu entries */
+#define MAX_COUNT      99
+
+/* maximal size of bootmenu env
+ *  9 = strlen("bootmenu_")
+ *  2 = strlen(MAX_COUNT)
+ *  1 = NULL term
+ */
+#define MAX_ENV_SIZE   (9 + 2 + 1)
+
+struct bootmenu_entry {
+       unsigned short int num;         /* unique number 0 .. MAX_COUNT */
+       char key[3];                    /* key identifier of number */
+       char *title;                    /* title of entry */
+       char *command;                  /* hush command of entry */
+       struct bootmenu_data *menu;     /* this bootmenu */
+       struct bootmenu_entry *next;    /* next menu entry (num+1) */
+};
+
+struct bootmenu_data {
+       int delay;                      /* delay for autoboot */
+       int active;                     /* active menu entry */
+       int count;                      /* total count of menu entries */
+       struct bootmenu_entry *first;   /* first menu entry */
+};
+
+enum bootmenu_key {
+       KEY_NONE = 0,
+       KEY_UP,
+       KEY_DOWN,
+       KEY_SELECT,
+};
+
+static char *bootmenu_getoption(unsigned short int n)
+{
+       char name[MAX_ENV_SIZE] = "bootmenu_";
+
+       if (n > MAX_COUNT)
+               return NULL;
+
+       sprintf(name + 9, "%d", n);
+       return getenv(name);
+}
+
+static void bootmenu_print_entry(void *data)
+{
+       struct bootmenu_entry *entry = data;
+       int reverse = (entry->menu->active == entry->num);
+
+       /*
+        * Move cursor to line where the entry will be drown (entry->num)
+        * First 3 lines contain bootmenu header + 1 empty line
+        */
+       printf(ANSI_CURSOR_POSITION, entry->num + 4, 1);
+
+       puts("     ");
+
+       if (reverse)
+               puts(ANSI_COLOR_REVERSE);
+
+       puts(entry->title);
+
+       if (reverse)
+               puts(ANSI_COLOR_RESET);
+}
+
+static void bootmenu_autoboot_loop(struct bootmenu_data *menu,
+                               enum bootmenu_key *key, int *esc)
+{
+       int i, c;
+
+       if (menu->delay > 0) {
+               printf(ANSI_CURSOR_POSITION, menu->count + 5, 1);
+               printf("  Hit any key to stop autoboot: %2d ", menu->delay);
+       }
+
+       while (menu->delay > 0) {
+               for (i = 0; i < 100; ++i) {
+                       if (!tstc()) {
+                               WATCHDOG_RESET();
+                               mdelay(10);
+                               continue;
+                       }
+
+                       menu->delay = -1;
+                       c = getc();
+
+                       switch (c) {
+                       case '\e':
+                               *esc = 1;
+                               *key = KEY_NONE;
+                               break;
+                       case '\r':
+                               *key = KEY_SELECT;
+                               break;
+                       default:
+                               *key = KEY_NONE;
+                               break;
+                       }
+
+                       break;
+               }
+
+               if (menu->delay < 0)
+                       break;
+
+               --menu->delay;
+               printf("\b\b\b%2d ", menu->delay);
+       }
+
+       printf(ANSI_CURSOR_POSITION, menu->count + 5, 1);
+       puts(ANSI_CLEAR_LINE);
+
+       if (menu->delay == 0)
+               *key = KEY_SELECT;
+}
+
+static void bootmenu_loop(struct bootmenu_data *menu,
+               enum bootmenu_key *key, int *esc)
+{
+       int c;
+
+       while (!tstc()) {
+               WATCHDOG_RESET();
+               mdelay(10);
+       }
+
+       c = getc();
+
+       switch (*esc) {
+       case 0:
+               /* First char of ANSI escape sequence '\e' */
+               if (c == '\e') {
+                       *esc = 1;
+                       *key = KEY_NONE;
+               }
+               break;
+       case 1:
+               /* Second char of ANSI '[' */
+               if (c == '[') {
+                       *esc = 2;
+                       *key = KEY_NONE;
+               } else {
+                       *esc = 0;
+               }
+               break;
+       case 2:
+       case 3:
+               /* Third char of ANSI (number '1') - optional */
+               if (*esc == 2 && c == '1') {
+                       *esc = 3;
+                       *key = KEY_NONE;
+                       break;
+               }
+
+               *esc = 0;
+
+               /* ANSI 'A' - key up was pressed */
+               if (c == 'A')
+                       *key = KEY_UP;
+               /* ANSI 'B' - key down was pressed */
+               else if (c == 'B')
+                       *key = KEY_DOWN;
+               /* other key was pressed */
+               else
+                       *key = KEY_NONE;
+
+               break;
+       }
+
+       /* enter key was pressed */
+       if (c == '\r')
+               *key = KEY_SELECT;
+}
+
+static char *bootmenu_choice_entry(void *data)
+{
+       struct bootmenu_data *menu = data;
+       struct bootmenu_entry *iter;
+       enum bootmenu_key key = KEY_NONE;
+       int esc = 0;
+       int i;
+
+       while (1) {
+               if (menu->delay >= 0) {
+                       /* Autoboot was not stopped */
+                       bootmenu_autoboot_loop(menu, &key, &esc);
+               } else {
+                       /* Some key was pressed, so autoboot was stopped */
+                       bootmenu_loop(menu, &key, &esc);
+               }
+
+               switch (key) {
+               case KEY_UP:
+                       if (menu->active > 0)
+                               --menu->active;
+                       /* no menu key selected, regenerate menu */
+                       return NULL;
+               case KEY_DOWN:
+                       if (menu->active < menu->count - 1)
+                               ++menu->active;
+                       /* no menu key selected, regenerate menu */
+                       return NULL;
+               case KEY_SELECT:
+                       iter = menu->first;
+                       for (i = 0; i < menu->active; ++i)
+                               iter = iter->next;
+                       return iter->key;
+               default:
+                       break;
+               }
+       }
+
+       /* never happens */
+       debug("bootmenu: this should not happen");
+       return NULL;
+}
+
+static void bootmenu_destroy(struct bootmenu_data *menu)
+{
+       struct bootmenu_entry *iter = menu->first;
+       struct bootmenu_entry *next;
+
+       while (iter) {
+               next = iter->next;
+               free(iter->title);
+               free(iter->command);
+               free(iter);
+               iter = next;
+       }
+       free(menu);
+}
+
+static struct bootmenu_data *bootmenu_create(int delay)
+{
+       unsigned short int i = 0;
+       const char *option;
+       struct bootmenu_data *menu;
+       struct bootmenu_entry *iter = NULL;
+
+       int len;
+       char *sep;
+       struct bootmenu_entry *entry;
+
+       menu = malloc(sizeof(struct bootmenu_data));
+       if (!menu)
+               return NULL;
+
+       menu->delay = delay;
+       menu->active = 0;
+       menu->first = NULL;
+
+       while ((option = bootmenu_getoption(i))) {
+               sep = strchr(option, '=');
+               if (!sep) {
+                       printf("Invalid bootmenu entry: %s\n", option);
+                       break;
+               }
+
+               entry = malloc(sizeof(struct bootmenu_entry));
+               if (!entry)
+                       goto cleanup;
+
+               len = sep-option;
+               entry->title = malloc(len + 1);
+               if (!entry->title) {
+                       free(entry);
+                       goto cleanup;
+               }
+               memcpy(entry->title, option, len);
+               entry->title[len] = 0;
+
+               len = strlen(sep + 1);
+               entry->command = malloc(len + 1);
+               if (!entry->command) {
+                       free(entry->title);
+                       free(entry);
+                       goto cleanup;
+               }
+               memcpy(entry->command, sep + 1, len);
+               entry->command[len] = 0;
+
+               sprintf(entry->key, "%d", i);
+
+               entry->num = i;
+               entry->menu = menu;
+               entry->next = NULL;
+
+               if (!iter)
+                       menu->first = entry;
+               else
+                       iter->next = entry;
+
+               iter = entry;
+               ++i;
+
+               if (i == MAX_COUNT - 1)
+                       break;
+       }
+
+       /* Add U-Boot console entry at the end */
+       if (i <= MAX_COUNT - 1) {
+               entry = malloc(sizeof(struct bootmenu_entry));
+               if (!entry)
+                       goto cleanup;
+
+               entry->title = strdup("U-Boot console");
+               if (!entry->title) {
+                       free(entry);
+                       goto cleanup;
+               }
+
+               entry->command = strdup("");
+               if (!entry->command) {
+                       free(entry->title);
+                       free(entry);
+                       goto cleanup;
+               }
+
+               sprintf(entry->key, "%d", i);
+
+               entry->num = i;
+               entry->menu = menu;
+               entry->next = NULL;
+
+               if (!iter)
+                       menu->first = entry;
+               else
+                       iter->next = entry;
+
+               iter = entry;
+               ++i;
+       }
+
+       menu->count = i;
+       return menu;
+
+cleanup:
+       bootmenu_destroy(menu);
+       return NULL;
+}
+
+static void bootmenu_show(int delay)
+{
+       int init = 0;
+       void *choice = NULL;
+       char *title = NULL;
+       char *command = NULL;
+       struct menu *menu;
+       struct bootmenu_data *bootmenu;
+       struct bootmenu_entry *iter;
+       char *option, *sep;
+
+       /* If delay is 0 do not create menu, just run first entry */
+       if (delay == 0) {
+               option = bootmenu_getoption(0);
+               if (!option) {
+                       puts("bootmenu option 0 was not found\n");
+                       return;
+               }
+               sep = strchr(option, '=');
+               if (!sep) {
+                       puts("bootmenu option 0 is invalid\n");
+                       return;
+               }
+               run_command(sep+1, 0);
+               return;
+       }
+
+       bootmenu = bootmenu_create(delay);
+       if (!bootmenu)
+               return;
+
+       menu = menu_create(NULL, bootmenu->delay, 1, bootmenu_print_entry,
+                          bootmenu_choice_entry, bootmenu);
+       if (!menu) {
+               bootmenu_destroy(bootmenu);
+               return;
+       }
+
+       for (iter = bootmenu->first; iter; iter = iter->next) {
+               if (!menu_item_add(menu, iter->key, iter))
+                       goto cleanup;
+       }
+
+       /* Default menu entry is always first */
+       menu_default_set(menu, "0");
+
+       puts(ANSI_CURSOR_HIDE);
+       puts(ANSI_CLEAR_CONSOLE);
+       printf(ANSI_CURSOR_POSITION, 1, 1);
+
+       init = 1;
+
+       if (menu_get_choice(menu, &choice)) {
+               iter = choice;
+               title = strdup(iter->title);
+               command = strdup(iter->command);
+       }
+
+cleanup:
+       menu_destroy(menu);
+       bootmenu_destroy(bootmenu);
+
+       if (init) {
+               puts(ANSI_CURSOR_SHOW);
+               puts(ANSI_CLEAR_CONSOLE);
+               printf(ANSI_CURSOR_POSITION, 1, 1);
+       }
+
+       if (title && command) {
+               debug("Starting entry '%s'\n", title);
+               free(title);
+               run_command(command, 0);
+               free(command);
+       }
+
+#ifdef CONFIG_POSTBOOTMENU
+       run_command(CONFIG_POSTBOOTMENU, 0);
+#endif
+}
+
+void menu_display_statusline(struct menu *m)
+{
+       struct bootmenu_entry *entry;
+       struct bootmenu_data *menu;
+
+       if (menu_default_choice(m, (void *)&entry) < 0)
+               return;
+
+       menu = entry->menu;
+
+       printf(ANSI_CURSOR_POSITION, 1, 1);
+       puts(ANSI_CLEAR_LINE);
+       printf(ANSI_CURSOR_POSITION, 2, 1);
+       puts("  *** U-Boot Boot Menu ***");
+       puts(ANSI_CLEAR_LINE_TO_END);
+       printf(ANSI_CURSOR_POSITION, 3, 1);
+       puts(ANSI_CLEAR_LINE);
+
+       /* First 3 lines are bootmenu header + 2 empty lines between entries */
+       printf(ANSI_CURSOR_POSITION, menu->count + 5, 1);
+       puts(ANSI_CLEAR_LINE);
+       printf(ANSI_CURSOR_POSITION, menu->count + 6, 1);
+       puts("  Press UP/DOWN to move, ENTER to select");
+       puts(ANSI_CLEAR_LINE_TO_END);
+       printf(ANSI_CURSOR_POSITION, menu->count + 7, 1);
+       puts(ANSI_CLEAR_LINE);
+}
+
+#ifdef CONFIG_MENU_SHOW
+int menu_show(int bootdelay)
+{
+       bootmenu_show(bootdelay);
+       return -1; /* -1 - abort boot and run monitor code */
+}
+#endif
+
+int do_bootmenu(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+{
+       char *delay_str = NULL;
+       int delay = 10;
+
+#if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0)
+       delay = CONFIG_BOOTDELAY;
+#endif
+
+       if (argc >= 2)
+               delay_str = argv[1];
+
+       if (!delay_str)
+               delay_str = getenv("bootmenu_delay");
+
+       if (delay_str)
+               delay = (int)simple_strtol(delay_str, NULL, 10);
+
+       bootmenu_show(delay);
+       return 0;
+}
+
+U_BOOT_CMD(
+       bootmenu, 2, 1, do_bootmenu,
+       "ANSI terminal bootmenu",
+       "[delay]\n"
+       "    - show ANSI terminal bootmenu with autoboot delay"
+);
index 66e0ef05805f01699e7f1da7fe4942003aef2e3b..dfa36901e6a88a9ffe3aa00edc37921d416050d8 100644 (file)
 #define PRINTF(fmt,args...)
 #endif
 
-#ifndef        TRUE
-#define TRUE            1
-#endif
-#ifndef FALSE
-#define FALSE           0
-#endif
-
 /*#if defined(CONFIG_CMD_DATE) */
 /*#include <rtc.h> */
 /*#endif */
@@ -214,9 +207,9 @@ int wait_for_fdc_int(void)
                timeout--;
                udelay(10);
                if(timeout==0) /* timeout occured */
-                       return FALSE;
+                       return false;
        }
-       return TRUE;
+       return true;
 }
 
 /* reads a byte from the FIFO of the FDC and checks direction and RQM bit
@@ -244,7 +237,7 @@ int fdc_need_more_output(void)
                        c=(unsigned char)read_fdc_byte();
                        printf("Error: more output: %x\n",c);
        }
-       return TRUE;
+       return true;
 }
 
 
@@ -260,10 +253,10 @@ int write_fdc_byte(unsigned char val)
                udelay(10);
                fdc_need_more_output();
                if(timeout==0) /* timeout occured */
-                       return FALSE;
+                       return false;
        }
        write_fdc_reg(FDC_FIFO,val);
-       return TRUE;
+       return true;
 }
 
 /* sets up all FDC commands and issues it to the FDC. If
@@ -344,9 +337,9 @@ int fdc_issue_cmd(FDC_COMMAND_STRUCT *pCMD,FD_GEO_STRUCT *pFG)
        }
        for(i=0;i<pCMD->cmdlen;i++) {
                /* PRINTF("write cmd%d = 0x%02X\n",i,pCMD->cmd[i]); */
-               if(write_fdc_byte(pCMD->cmd[i])==FALSE) {
+               if (write_fdc_byte(pCMD->cmd[i]) == false) {
                        PRINTF("Error: timeout while issue cmd%d\n",i);
-                       return FALSE;
+                       return false;
                }
        }
        timeout=FDC_TIME_OUT;
@@ -355,12 +348,12 @@ int fdc_issue_cmd(FDC_COMMAND_STRUCT *pCMD,FD_GEO_STRUCT *pFG)
                        timeout--;
                        if(timeout==0) {
                                PRINTF(" timeout while reading result%d MSR=0x%02X\n",i,read_fdc_reg(FDC_MSR));
-                               return FALSE;
+                               return false;
                        }
                }
                pCMD->result[i]=(unsigned char)read_fdc_byte();
        }
-       return TRUE;
+       return true;
 }
 
 /* selects the drive assigned in the cmd structur and
@@ -391,9 +384,10 @@ void stop_fdc_drive(FDC_COMMAND_STRUCT *pCMD)
 int fdc_recalibrate(FDC_COMMAND_STRUCT *pCMD,FD_GEO_STRUCT *pFG)
 {
        pCMD->cmd[COMMAND]=FDC_CMD_RECALIBRATE;
-       if(fdc_issue_cmd(pCMD,pFG)==FALSE)
-               return FALSE;
-       while(wait_for_fdc_int()!=TRUE);
+       if (fdc_issue_cmd(pCMD, pFG) == false)
+               return false;
+       while (wait_for_fdc_int() != true);
+
        pCMD->cmd[COMMAND]=FDC_CMD_SENSE_INT;
        return(fdc_issue_cmd(pCMD,pFG));
 }
@@ -403,9 +397,10 @@ int fdc_recalibrate(FDC_COMMAND_STRUCT *pCMD,FD_GEO_STRUCT *pFG)
 int fdc_seek(FDC_COMMAND_STRUCT *pCMD,FD_GEO_STRUCT *pFG)
 {
        pCMD->cmd[COMMAND]=FDC_CMD_SEEK;
-       if(fdc_issue_cmd(pCMD,pFG)==FALSE)
-               return FALSE;
-       while(wait_for_fdc_int()!=TRUE);
+       if (fdc_issue_cmd(pCMD, pFG) == false)
+               return false;
+       while (wait_for_fdc_int() != true);
+
        pCMD->cmd[COMMAND]=FDC_CMD_SENSE_INT;
        return(fdc_issue_cmd(pCMD,pFG));
 }
@@ -421,7 +416,7 @@ int fdc_terminate(FDC_COMMAND_STRUCT *pCMD)
        for(i=0;i<7;i++) {
                pCMD->result[i]=(unsigned char)read_fdc_byte();
        }
-       return TRUE;
+       return true;
 }
 
 /* reads data from FDC, seek commands are issued automatic */
@@ -440,18 +435,18 @@ int fdc_read_data(unsigned char *buffer, unsigned long blocks,FDC_COMMAND_STRUCT
        retriesrw=0;
        retriescal=0;
        offset=0;
-       if(fdc_seek(pCMD,pFG)==FALSE) {
+       if (fdc_seek(pCMD, pFG) == false) {
                stop_fdc_drive(pCMD);
                if (flags)
                        enable_interrupts();
-               return FALSE;
+               return false;
        }
        if((pCMD->result[STATUS_0]&0x20)!=0x20) {
                printf("Seek error Status: %02X\n",pCMD->result[STATUS_0]);
                stop_fdc_drive(pCMD);
                if (flags)
                        enable_interrupts();
-               return FALSE;
+               return false;
        }
        /* now determine the next seek point */
        /*      lastblk=pCMD->blnr + blocks; */
@@ -466,11 +461,11 @@ int fdc_read_data(unsigned char *buffer, unsigned long blocks,FDC_COMMAND_STRUCT
 retryrw:
                len=sect_size * readblk;
                pCMD->cmd[COMMAND]=FDC_CMD_READ;
-               if(fdc_issue_cmd(pCMD,pFG)==FALSE) {
+               if (fdc_issue_cmd(pCMD, pFG) == false) {
                        stop_fdc_drive(pCMD);
                        if (flags)
                                enable_interrupts();
-                       return FALSE;
+                       return false;
                }
                for (i=0;i<len;i++) {
                        timeout=FDC_TIME_OUT;
@@ -492,15 +487,15 @@ retryrw:
                                                        stop_fdc_drive(pCMD);
                                                        if (flags)
                                                                enable_interrupts();
-                                                       return FALSE;
+                                                       return false;
                                                }
                                                else {
                                                        PRINTF(" trying to recalibrate Try %d\n",retriescal);
-                                                       if(fdc_recalibrate(pCMD,pFG)==FALSE) {
+                                                       if (fdc_recalibrate(pCMD, pFG) == false) {
                                                                stop_fdc_drive(pCMD);
                                                                if (flags)
                                                                        enable_interrupts();
-                                                               return FALSE;
+                                                               return false;
                                                        }
                                                        retriesrw=0;
                                                        goto retrycal;
@@ -512,7 +507,7 @@ retryrw:
                                        } /* else >FDC_RW_RETRIES */
                                }/* if output */
                                timeout--;
-                       }while(TRUE);
+                       } while (true);
                } /* for len */
                /* the last sector of a track or all data has been read,
                 * we need to get the results */
@@ -530,22 +525,22 @@ retryrw:
                        readblk=blocks;
 retrycal:
                /* a seek is necessary */
-               if(fdc_seek(pCMD,pFG)==FALSE) {
+               if (fdc_seek(pCMD, pFG) == false) {
                        stop_fdc_drive(pCMD);
                        if (flags)
                                enable_interrupts();
-                       return FALSE;
+                       return false;
                }
                if((pCMD->result[STATUS_0]&0x20)!=0x20) {
                        PRINTF("Seek error Status: %02X\n",pCMD->result[STATUS_0]);
                        stop_fdc_drive(pCMD);
-                       return FALSE;
+                       return false;
                }
-       }while(TRUE); /* start over */
+       } while (true); /* start over */
        stop_fdc_drive(pCMD); /* switch off drive */
        if (flags)
                enable_interrupts();
-       return TRUE;
+       return true;
 }
 
 /* Scan all drives and check if drive is present and disk is inserted */
@@ -559,20 +554,20 @@ int fdc_check_drive(FDC_COMMAND_STRUCT *pCMD, FD_GEO_STRUCT *pFG)
                pCMD->drive=drives;
                select_fdc_drive(pCMD);
                pCMD->blnr=0; /* set to the 1st block */
-               if(fdc_recalibrate(pCMD,pFG)==FALSE)
+               if (fdc_recalibrate(pCMD, pFG) == false)
                        continue;
                if((pCMD->result[STATUS_0]&0x10)==0x10)
                        continue;
                /* ok drive connected check for disk */
                state|=(1<<drives);
                pCMD->blnr=pFG->size; /* set to the last block */
-               if(fdc_seek(pCMD,pFG)==FALSE)
+               if (fdc_seek(pCMD, pFG) == false)
                        continue;
                pCMD->blnr=0; /* set to the 1st block */
-               if(fdc_recalibrate(pCMD,pFG)==FALSE)
+               if (fdc_recalibrate(pCMD, pFG) == false)
                        continue;
                pCMD->cmd[COMMAND]=FDC_CMD_READ_ID;
-               if(fdc_issue_cmd(pCMD,pFG)==FALSE)
+               if (fdc_issue_cmd(pCMD, pFG) == false)
                        continue;
                state|=(0x10<<drives);
        }
@@ -584,7 +579,7 @@ int fdc_check_drive(FDC_COMMAND_STRUCT *pCMD, FD_GEO_STRUCT *pFG)
                        ((state&(0x10<<i))==(0x10<<i)) ? pFG->name : "");
        }
        pCMD->flags=state;
-       return TRUE;
+       return true;
 }
 
 
@@ -611,9 +606,9 @@ int fdc_setup(int drive, FDC_COMMAND_STRUCT *pCMD, FD_GEO_STRUCT *pFG)
        write_fdc_reg(FDC_CCR,pFG->rate);
        /* then initialize the DSR */
        write_fdc_reg(FDC_DSR,pFG->rate);
-       if(wait_for_fdc_int()==FALSE) {
+       if (wait_for_fdc_int() == false) {
                        PRINTF("Time Out after writing CCR\n");
-                       return FALSE;
+                       return false;
        }
        /* now issue sense Interrupt and status command
         * assuming only one drive present (drive 0) */
@@ -621,7 +616,7 @@ int fdc_setup(int drive, FDC_COMMAND_STRUCT *pCMD, FD_GEO_STRUCT *pFG)
        for(i=0;i<4;i++) {
                /* issue sense interrupt for all 4 possible drives */
                pCMD->cmd[COMMAND]=FDC_CMD_SENSE_INT;
-               if(fdc_issue_cmd(pCMD,pFG)==FALSE) {
+               if (fdc_issue_cmd(pCMD, pFG) == false) {
                        PRINTF("Sense Interrupt for drive %d failed\n",i);
                }
        }
@@ -629,24 +624,24 @@ int fdc_setup(int drive, FDC_COMMAND_STRUCT *pCMD, FD_GEO_STRUCT *pFG)
        pCMD->drive=drive;
        select_fdc_drive(pCMD);
        pCMD->cmd[COMMAND]=FDC_CMD_CONFIGURE;
-       if(fdc_issue_cmd(pCMD,pFG)==FALSE) {
+       if (fdc_issue_cmd(pCMD, pFG) == false) {
                PRINTF(" configure timeout\n");
                stop_fdc_drive(pCMD);
-               return FALSE;
+               return false;
        }
        /* issue specify command */
        pCMD->cmd[COMMAND]=FDC_CMD_SPECIFY;
-       if(fdc_issue_cmd(pCMD,pFG)==FALSE) {
+       if (fdc_issue_cmd(pCMD, pFG) == false) {
                PRINTF(" specify timeout\n");
                stop_fdc_drive(pCMD);
-               return FALSE;
+               return false;
 
        }
        /* then, we clear the reset in the DOR */
        /* fdc_check_drive(pCMD,pFG);   */
        /*      write_fdc_reg(FDC_DOR,0x04); */
 
-       return TRUE;
+       return true;
 }
 
 #if defined(CONFIG_CMD_FDOS)
@@ -664,30 +659,30 @@ int fdc_fdos_init (int drive)
        FDC_COMMAND_STRUCT *pCMD = &cmd;
 
        /* setup FDC and scan for drives  */
-       if(fdc_setup(drive,pCMD,pFG)==FALSE) {
+       if (fdc_setup(drive, pCMD, pFG) == false) {
                printf("\n** Error in setup FDC **\n");
-               return FALSE;
+               return false;
        }
-       if(fdc_check_drive(pCMD,pFG)==FALSE) {
+       if (fdc_check_drive(pCMD, pFG) == false) {
                printf("\n** Error in check_drives **\n");
-               return FALSE;
+               return false;
        }
        if((pCMD->flags&(1<<drive))==0) {
                /* drive not available */
                printf("\n** Drive %d not available **\n",drive);
-               return FALSE;
+               return false;
        }
        if((pCMD->flags&(0x10<<drive))==0) {
                /* no disk inserted */
                printf("\n** No disk inserted in drive %d **\n",drive);
-               return FALSE;
+               return false;
        }
        /* ok, we have a valid source */
        pCMD->drive=drive;
 
        /* read first block */
        pCMD->blnr=0;
-       return TRUE;
+       return true;
 }
 /**************************************************************************
 * int fdc_fdos_seek
@@ -747,11 +742,11 @@ int do_fdcboot (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                return CMD_RET_USAGE;
        }
        /* setup FDC and scan for drives  */
-       if(fdc_setup(boot_drive,pCMD,pFG)==FALSE) {
+       if (fdc_setup(boot_drive, pCMD, pFG) == false) {
                printf("\n** Error in setup FDC **\n");
                return 1;
        }
-       if(fdc_check_drive(pCMD,pFG)==FALSE) {
+       if (fdc_check_drive(pCMD, pFG) == false) {
                printf("\n** Error in check_drives **\n");
                return 1;
        }
@@ -769,7 +764,7 @@ int do_fdcboot (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
        pCMD->drive=boot_drive;
        /* read first block */
        pCMD->blnr=0;
-       if(fdc_read_data((unsigned char *)addr,1,pCMD,pFG)==FALSE) {
+       if (fdc_read_data((unsigned char *)addr, 1, pCMD, pFG) == false) {
                printf("\nRead error:");
                for(i=0;i<7;i++)
                        printf("result%d: 0x%02X\n",i,pCMD->result[i]);
@@ -801,7 +796,7 @@ int do_fdcboot (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                nrofblk++;
        printf("Loading %ld Bytes (%d blocks) at 0x%08lx..\n",imsize,nrofblk,addr);
        pCMD->blnr=0;
-       if(fdc_read_data((unsigned char *)addr,nrofblk,pCMD,pFG)==FALSE) {
+       if (fdc_read_data((unsigned char *)addr, nrofblk, pCMD, pFG) == false) {
                /* read image block */
                printf("\nRead error:");
                for(i=0;i<7;i++)
index 8c53a10315ecec188d75d87c15b67a1971e59aa7..9f3d6c575bfe2ef8c12b54d4fb1f0e42e2eacfa0 100644 (file)
@@ -164,8 +164,12 @@ static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
        }
 
        if (strcmp(argv[1], "rescan") == 0) {
-               struct mmc *mmc = find_mmc_device(curr_device);
+               struct mmc *mmc;
 
+               if (argc != 2)
+                       return CMD_RET_USAGE;
+
+               mmc = find_mmc_device(curr_device);
                if (!mmc) {
                        printf("no mmc device at slot %x\n", curr_device);
                        return 1;
@@ -179,8 +183,12 @@ static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                        return 0;
        } else if (strncmp(argv[1], "part", 4) == 0) {
                block_dev_desc_t *mmc_dev;
-               struct mmc *mmc = find_mmc_device(curr_device);
+               struct mmc *mmc;
+
+               if (argc != 2)
+                       return CMD_RET_USAGE;
 
+               mmc = find_mmc_device(curr_device);
                if (!mmc) {
                        printf("no mmc device at slot %x\n", curr_device);
                        return 1;
@@ -196,6 +204,8 @@ static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                puts("get mmc type error!\n");
                return 1;
        } else if (strcmp(argv[1], "list") == 0) {
+               if (argc != 2)
+                       return CMD_RET_USAGE;
                print_mmc_devices('\n');
                return 0;
        } else if (strcmp(argv[1], "dev") == 0) {
index 5192dee8ae23cf398a204e2dcb16c23fbb970113..1c35f9dd60531fd5e8918386036d4c3406a87624 100644 (file)
 #include <onenand_uboot.h>
 #endif
 
+DECLARE_GLOBAL_DATA_PTR;
+
 /* special size referring to all the remaining space in a partition */
 #define SIZE_REMAINING         0xFFFFFFFF
 
@@ -1537,6 +1539,7 @@ static int parse_mtdparts(const char *const mtdparts)
        const char *p = mtdparts;
        struct mtd_device *dev;
        int err = 1;
+       char tmp_parts[MTDPARTS_MAXLEN];
 
        debug("\n---parse_mtdparts---\nmtdparts = %s\n\n", p);
 
@@ -1547,7 +1550,12 @@ static int parse_mtdparts(const char *const mtdparts)
        }
 
        /* re-read 'mtdparts' variable, mtd_devices_init may be updating env */
-       p = getenv("mtdparts");
+       if (gd->flags & GD_FLG_ENV_READY) {
+               p = getenv("mtdparts");
+       } else {
+               p = tmp_parts;
+               getenv_f("mtdparts", tmp_parts, MTDPARTS_MAXLEN);
+       }
 
        if (strncmp(p, "mtdparts=", 9) != 0) {
                printf("mtdparts variable doesn't start with 'mtdparts='\n");
@@ -1705,6 +1713,7 @@ int mtdparts_init(void)
        const char *current_partition;
        int ids_changed;
        char tmp_ep[PARTITION_MAXLEN];
+       char tmp_parts[MTDPARTS_MAXLEN];
 
        debug("\n---mtdparts_init---\n");
        if (!initialized) {
@@ -1718,7 +1727,17 @@ int mtdparts_init(void)
 
        /* get variables */
        ids = getenv("mtdids");
-       parts = getenv("mtdparts");
+       /*
+        * The mtdparts variable tends to be long. If we need to access it
+        * before the env is relocated, then we need to use our own stack
+        * buffer.  gd->env_buf will be too small.
+        */
+       if (gd->flags & GD_FLG_ENV_READY) {
+               parts = getenv("mtdparts");
+       } else {
+               parts = tmp_parts;
+               getenv_f("mtdparts", tmp_parts, MTDPARTS_MAXLEN);
+       }
        current_partition = getenv("partition");
 
        /* save it for later parsing, cannot rely on current partition pointer
index 32348f37737116e8cf7563c5c8cda73d096edbfe..e9d3d3c1bf6238d20ad3abc310cbc306fab473dd 100644 (file)
@@ -137,7 +137,8 @@ static inline int str2long(const char *p, ulong *num)
        return *p != '\0' && *endptr == '\0';
 }
 
-static int get_part(const char *partname, int *idx, loff_t *off, loff_t *size)
+static int get_part(const char *partname, int *idx, loff_t *off, loff_t *size,
+               loff_t *maxsize)
 {
 #ifdef CONFIG_CMD_MTDPARTS
        struct mtd_device *dev;
@@ -160,6 +161,7 @@ static int get_part(const char *partname, int *idx, loff_t *off, loff_t *size)
 
        *off = part->offset;
        *size = part->size;
+       *maxsize = part->size;
        *idx = dev->id->num;
 
        ret = set_dev(*idx);
@@ -173,10 +175,11 @@ static int get_part(const char *partname, int *idx, loff_t *off, loff_t *size)
 #endif
 }
 
-static int arg_off(const char *arg, int *idx, loff_t *off, loff_t *maxsize)
+static int arg_off(const char *arg, int *idx, loff_t *off, loff_t *size,
+               loff_t *maxsize)
 {
        if (!str2off(arg, off))
-               return get_part(arg, idx, off, maxsize);
+               return get_part(arg, idx, off, size, maxsize);
 
        if (*off >= nand_info[*idx].size) {
                puts("Offset exceeds device limit\n");
@@ -184,36 +187,35 @@ static int arg_off(const char *arg, int *idx, loff_t *off, loff_t *maxsize)
        }
 
        *maxsize = nand_info[*idx].size - *off;
+       *size = *maxsize;
        return 0;
 }
 
 static int arg_off_size(int argc, char *const argv[], int *idx,
-                       loff_t *off, loff_t *size)
+                       loff_t *off, loff_t *size, loff_t *maxsize)
 {
        int ret;
-       loff_t maxsize = 0;
 
        if (argc == 0) {
                *off = 0;
                *size = nand_info[*idx].size;
+               *maxsize = *size;
                goto print;
        }
 
-       ret = arg_off(argv[0], idx, off, &maxsize);
+       ret = arg_off(argv[0], idx, off, size, maxsize);
        if (ret)
                return ret;
 
-       if (argc == 1) {
-               *size = maxsize;
+       if (argc == 1)
                goto print;
-       }
 
        if (!str2off(argv[1], size)) {
                printf("'%s' is not a number\n", argv[1]);
                return -1;
        }
 
-       if (*size > maxsize) {
+       if (*size > *maxsize) {
                puts("Size exceeds partition or device limit\n");
                return -1;
        }
@@ -307,7 +309,8 @@ int do_nand_env_oob(cmd_tbl_t *cmdtp, int argc, char *const argv[])
                if (argc < 3)
                        goto usage;
 
-               if (arg_off(argv[2], &idx, &addr, &maxsize)) {
+               /* We don't care about size, or maxsize. */
+               if (arg_off(argv[2], &idx, &addr, &maxsize, &maxsize)) {
                        puts("Offset or partition name expected\n");
                        return 1;
                }
@@ -426,7 +429,7 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
        int i, ret = 0;
        ulong addr;
-       loff_t off, size;
+       loff_t off, size, maxsize;
        char *cmd, *s;
        nand_info_t *nand;
 #ifdef CONFIG_SYS_NAND_QUIET
@@ -551,7 +554,8 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
                printf("\nNAND %s: ", cmd);
                /* skip first two or three arguments, look for offset and size */
-               if (arg_off_size(argc - o, argv + o, &dev, &off, &size) != 0)
+               if (arg_off_size(argc - o, argv + o, &dev, &off, &size,
+                                &maxsize) != 0)
                        return 1;
 
                nand = &nand_info[dev];
@@ -619,7 +623,7 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                if (s && !strcmp(s, ".raw")) {
                        raw = 1;
 
-                       if (arg_off(argv[3], &dev, &off, &size))
+                       if (arg_off(argv[3], &dev, &off, &size, &maxsize))
                                return 1;
 
                        if (argc > 4 && !str2long(argv[4], &pagecount)) {
@@ -635,7 +639,7 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                        rwsize = pagecount * (nand->writesize + nand->oobsize);
                } else {
                        if (arg_off_size(argc - 3, argv + 3, &dev,
-                                               &off, &size) != 0)
+                                               &off, &size, &maxsize) != 0)
                                return 1;
 
                        rwsize = size;
@@ -645,9 +649,11 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                    !strcmp(s, ".e") || !strcmp(s, ".i")) {
                        if (read)
                                ret = nand_read_skip_bad(nand, off, &rwsize,
+                                                        NULL, maxsize,
                                                         (u_char *)addr);
                        else
                                ret = nand_write_skip_bad(nand, off, &rwsize,
+                                                         NULL, maxsize,
                                                          (u_char *)addr, 0);
 #ifdef CONFIG_CMD_NAND_TRIMFFS
                } else if (!strcmp(s, ".trimffs")) {
@@ -655,8 +661,8 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                                printf("Unknown nand command suffix '%s'\n", s);
                                return 1;
                        }
-                       ret = nand_write_skip_bad(nand, off, &rwsize,
-                                               (u_char *)addr,
+                       ret = nand_write_skip_bad(nand, off, &rwsize, NULL,
+                                               maxsize, (u_char *)addr,
                                                WITH_DROP_FFS);
 #endif
 #ifdef CONFIG_CMD_NAND_YAFFS
@@ -665,9 +671,9 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                                printf("Unknown nand command suffix '%s'.\n", s);
                                return 1;
                        }
-                       ret = nand_write_skip_bad(nand, off, &rwsize,
-                                               (u_char *)addr,
-                                               WITH_INLINE_OOB);
+                       ret = nand_write_skip_bad(nand, off, &rwsize, NULL,
+                                               maxsize, (u_char *)addr,
+                                               WITH_YAFFS_OOB);
 #endif
                } else if (!strcmp(s, ".oob")) {
                        /* out-of-band data */
@@ -775,7 +781,8 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                if (s && !strcmp(s, ".allexcept"))
                        allexcept = 1;
 
-               if (arg_off_size(argc - 2, argv + 2, &dev, &off, &size) < 0)
+               if (arg_off_size(argc - 2, argv + 2, &dev, &off, &size,
+                                &maxsize) < 0)
                        return 1;
 
                if (!nand_unlock(&nand_info[dev], off, size, allexcept)) {
@@ -873,7 +880,8 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand,
        printf("\nLoading from %s, offset 0x%lx\n", nand->name, offset);
 
        cnt = nand->writesize;
-       r = nand_read_skip_bad(nand, offset, &cnt, (u_char *) addr);
+       r = nand_read_skip_bad(nand, offset, &cnt, NULL, nand->size,
+                       (u_char *)addr);
        if (r) {
                puts("** Read error\n");
                bootstage_error(BOOTSTAGE_ID_NAND_HDR_READ);
@@ -905,7 +913,8 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand,
        }
        bootstage_mark(BOOTSTAGE_ID_NAND_TYPE);
 
-       r = nand_read_skip_bad(nand, offset, &cnt, (u_char *) addr);
+       r = nand_read_skip_bad(nand, offset, &cnt, NULL, nand->size,
+                       (u_char *)addr);
        if (r) {
                puts("** Read error\n");
                bootstage_error(BOOTSTAGE_ID_NAND_READ);
index 947d6c4ed665ad156ae07e037d8010a1df805c97..afa128ece2d1ed3405f73ea1c9837adde882ddee 100644 (file)
@@ -62,9 +62,10 @@ DECLARE_GLOBAL_DATA_PTR;
        !defined(CONFIG_ENV_IS_IN_ONENAND)      && \
        !defined(CONFIG_ENV_IS_IN_SPI_FLASH)    && \
        !defined(CONFIG_ENV_IS_IN_REMOTE)       && \
+       !defined(CONFIG_ENV_IS_IN_UBI)          && \
        !defined(CONFIG_ENV_IS_NOWHERE)
 # error Define one of CONFIG_ENV_IS_IN_{EEPROM|FLASH|DATAFLASH|ONENAND|\
-SPI_FLASH|NVRAM|MMC|FAT|REMOTE} or CONFIG_ENV_IS_NOWHERE
+SPI_FLASH|NVRAM|MMC|FAT|REMOTE|UBI} or CONFIG_ENV_IS_NOWHERE
 #endif
 
 /*
@@ -273,6 +274,10 @@ int setenv(const char *varname, const char *varvalue)
 {
        const char * const argv[4] = { "setenv", varname, varvalue, NULL };
 
+       /* before import into hashtable */
+       if (!(gd->flags & GD_FLG_ENV_READY))
+               return 1;
+
        if (varvalue == NULL || varvalue[0] == '\0')
                return _do_env_set(0, 2, (char * const *)argv);
        else
index ee75db96853345f503a5b569ff720caf0a49712c..2dbd49cbd6641352786a24110e0d3646f66f7dfc 100644 (file)
@@ -1280,7 +1280,8 @@ static struct menu *pxe_menu_to_menu(struct pxe_menu *cfg)
        /*
         * Create a menu and add items for all the labels.
         */
-       m = menu_create(cfg->title, cfg->timeout, cfg->prompt, label_print);
+       m = menu_create(cfg->title, cfg->timeout, cfg->prompt, label_print,
+                       NULL, NULL);
 
        if (!m)
                return NULL;
index 266bfa6905ea64c648540c585782ae4ca9a2fffa..13b3d996f649b2b443fddcf6b5c531527d2e5ed2 100644 (file)
@@ -110,7 +110,7 @@ void scsi_scan(int mode)
                scsi_dev_desc[i].vendor[0]=0;
                scsi_dev_desc[i].product[0]=0;
                scsi_dev_desc[i].revision[0]=0;
-               scsi_dev_desc[i].removable=FALSE;
+               scsi_dev_desc[i].removable = false;
                scsi_dev_desc[i].if_type=IF_TYPE_SCSI;
                scsi_dev_desc[i].dev=i;
                scsi_dev_desc[i].part_type=PART_TYPE_UNKNOWN;
@@ -125,7 +125,7 @@ void scsi_scan(int mode)
                        pccb->pdata=(unsigned char *)&tempbuff;
                        pccb->datalen=512;
                        scsi_setup_inquiry(pccb);
-                       if(scsi_exec(pccb)!=TRUE) {
+                       if (scsi_exec(pccb) != true) {
                                if(pccb->contr_stat==SCSI_SEL_TIME_OUT) {
                                        debug ("Selection timeout ID %d\n",pccb->target);
                                        continue; /* selection timeout => assuming no device present */
@@ -139,7 +139,7 @@ void scsi_scan(int mode)
                                continue; /* skip unknown devices */
                        }
                        if((modi&0x80)==0x80) /* drive is removable */
-                               scsi_dev_desc[scsi_max_devs].removable=TRUE;
+                               scsi_dev_desc[scsi_max_devs].removable=true;
                        /* get info for this device */
                        scsi_ident_cpy((unsigned char *)&scsi_dev_desc[scsi_max_devs].vendor[0],
                                       &tempbuff[8], 8);
@@ -152,8 +152,8 @@ void scsi_scan(int mode)
 
                        pccb->datalen=0;
                        scsi_setup_test_unit_ready(pccb);
-                       if(scsi_exec(pccb)!=TRUE) {
-                               if(scsi_dev_desc[scsi_max_devs].removable==TRUE) {
+                       if (scsi_exec(pccb) != true) {
+                               if (scsi_dev_desc[scsi_max_devs].removable == true) {
                                        scsi_dev_desc[scsi_max_devs].type=perq;
                                        goto removable;
                                }
@@ -404,7 +404,7 @@ static ulong scsi_read(int device, ulong blknr, lbaint_t blkcnt, void *buffer)
                debug("scsi_read_ext: startblk " LBAF
                      ", blccnt %x buffer %lx\n",
                      start, smallblks, buf_addr);
-               if(scsi_exec(pccb)!=TRUE) {
+               if (scsi_exec(pccb) != true) {
                        scsi_print_error(pccb);
                        blkcnt-=blks;
                        break;
@@ -458,7 +458,7 @@ static ulong scsi_write(int device, ulong blknr,
                }
                debug("%s: startblk " LBAF ", blccnt %x buffer %lx\n",
                      __func__, start, smallblks, buf_addr);
-               if (scsi_exec(pccb) != TRUE) {
+               if (scsi_exec(pccb) != true) {
                        scsi_print_error(pccb);
                        blkcnt -= blks;
                        break;
@@ -521,7 +521,7 @@ int scsi_read_capacity(ccb *pccb, lbaint_t *capacity, unsigned long *blksz)
        pccb->msgout[0] = SCSI_IDENTIFY; /* NOT USED */
 
        pccb->datalen = 8;
-       if (scsi_exec(pccb) != TRUE)
+       if (scsi_exec(pccb) != true)
                return 1;
 
        *capacity = ((lbaint_t)pccb->pdata[0] << 24) |
@@ -547,7 +547,7 @@ int scsi_read_capacity(ccb *pccb, lbaint_t *capacity, unsigned long *blksz)
        pccb->msgout[0] = SCSI_IDENTIFY; /* NOT USED */
 
        pccb->datalen = 16;
-       if (scsi_exec(pccb) != TRUE)
+       if (scsi_exec(pccb) != true)
                return 1;
 
        *capacity = ((uint64_t)pccb->pdata[0] << 56) |
index 3f0d414954c3e317507b899ec61391d07b38a77b..0a17782d662c1f950029935970bf661b56387b23 100644 (file)
@@ -5,8 +5,8 @@
  * Licensed under the GPL-2 or later.
  */
 
-#include <div64.h>
 #include <common.h>
+#include <div64.h>
 #include <malloc.h>
 #include <spi_flash.h>
 
index d4ec18672e4f10d396625aff18442bf247a210fd..acc0ecf99b760c0de60b98145f41a0d4b4a066a0 100644 (file)
  * MA 02111-1307 USA
  */
 
+/*
+ * Define _STDBOOL_H here to avoid macro expansion of true and false.
+ * If the future code requires macro true or false, remove this define
+ * and undef true and false before U_BOOT_CMD. This define and comment
+ * shall be removed if change to U_BOOT_CMD is made to take string
+ * instead of stringifying it.
+ */
+#define _STDBOOL_H
+
 #include <common.h>
 #include <command.h>
 
index 35b1d31f9cde4be901bed651768cf8ca50a65d39..5ba4feb485bd40faaa9a474588006abdd0e50eb5 100644 (file)
@@ -23,6 +23,9 @@
 #include <asm/errno.h>
 #include <jffs2/load_kernel.h>
 
+#undef ubi_msg
+#define ubi_msg(fmt, ...) printf("UBI: " fmt "\n", ##__VA_ARGS__)
+
 #define DEV_TYPE_NONE          0
 #define DEV_TYPE_NAND          1
 #define DEV_TYPE_ONENAND       2
@@ -263,7 +266,7 @@ out_err:
        return err;
 }
 
-static int ubi_volume_write(char *volume, void *buf, size_t size)
+int ubi_volume_write(char *volume, void *buf, size_t size)
 {
        int err = 1;
        int rsvd_bytes = 0;
@@ -308,12 +311,10 @@ static int ubi_volume_write(char *volume, void *buf, size_t size)
                ubi_gluebi_updated(vol);
        }
 
-       printf("%d bytes written to volume %s\n", size, volume);
-
        return 0;
 }
 
-static int ubi_volume_read(char *volume, char *buf, size_t size)
+int ubi_volume_read(char *volume, char *buf, size_t size)
 {
        int err, lnum, off, len, tbuf_size;
        void *tbuf;
@@ -325,8 +326,6 @@ static int ubi_volume_read(char *volume, char *buf, size_t size)
        if (vol == NULL)
                return ENODEV;
 
-       printf("Read %d bytes from volume %s to %p\n", size, volume, buf);
-
        if (vol->updating) {
                printf("updating");
                return EBUSY;
@@ -431,26 +430,82 @@ static int ubi_dev_scan(struct mtd_info *info, char *ubidev,
        return 0;
 }
 
-static int do_ubi(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+int ubi_part(char *part_name, const char *vid_header_offset)
 {
-       size_t size = 0;
-       ulong addr = 0;
        int err = 0;
-
-       if (argc < 2)
-               return CMD_RET_USAGE;
+       char mtd_dev[16];
+       struct mtd_device *dev;
+       struct part_info *part;
+       u8 pnum;
 
        if (mtdparts_init() != 0) {
                printf("Error initializing mtdparts!\n");
                return 1;
        }
 
+#ifdef CONFIG_CMD_UBIFS
+       /*
+        * Automatically unmount UBIFS partition when user
+        * changes the UBI device. Otherwise the following
+        * UBIFS commands will crash.
+        */
+       if (ubifs_is_mounted())
+               cmd_ubifs_umount();
+#endif
+
+       /* todo: get dev number for NAND... */
+       ubi_dev.nr = 0;
+
+       /*
+        * Call ubi_exit() before re-initializing the UBI subsystem
+        */
+       if (ubi_initialized) {
+               ubi_exit();
+               del_mtd_partitions(ubi_dev.mtd_info);
+       }
+
+       /*
+        * Search the mtd device number where this partition
+        * is located
+        */
+       if (find_dev_and_part(part_name, &dev, &pnum, &part)) {
+               printf("Partition %s not found!\n", part_name);
+               return 1;
+       }
+       sprintf(mtd_dev, "%s%d", MTD_DEV_TYPE(dev->id->type), dev->id->num);
+       ubi_dev.mtd_info = get_mtd_device_nm(mtd_dev);
+       if (IS_ERR(ubi_dev.mtd_info)) {
+               printf("Partition %s not found on device %s!\n", part_name,
+                      mtd_dev);
+               return 1;
+       }
+
+       ubi_dev.selected = 1;
+
+       strcpy(ubi_dev.part_name, part_name);
+       err = ubi_dev_scan(ubi_dev.mtd_info, ubi_dev.part_name,
+                       vid_header_offset);
+       if (err) {
+               printf("UBI init error %d\n", err);
+               ubi_dev.selected = 0;
+               return err;
+       }
+
+       ubi = ubi_devices[0];
+
+       return 0;
+}
+
+static int do_ubi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+       size_t size = 0;
+       ulong addr = 0;
+
+       if (argc < 2)
+               return CMD_RET_USAGE;
+
        if (strcmp(argv[1], "part") == 0) {
-               char mtd_dev[16];
-               struct mtd_device *dev;
-               struct part_info *part;
                const char *vid_header_offset = NULL;
-               u8 pnum;
 
                /* Print current partition */
                if (argc == 2) {
@@ -467,58 +522,10 @@ static int do_ubi(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
                if (argc < 3)
                        return CMD_RET_USAGE;
 
-#ifdef CONFIG_CMD_UBIFS
-               /*
-                * Automatically unmount UBIFS partition when user
-                * changes the UBI device. Otherwise the following
-                * UBIFS commands will crash.
-                */
-               if (ubifs_is_mounted())
-                       cmd_ubifs_umount();
-#endif
-
-               /* todo: get dev number for NAND... */
-               ubi_dev.nr = 0;
-
-               /*
-                * Call ubi_exit() before re-initializing the UBI subsystem
-                */
-               if (ubi_initialized) {
-                       ubi_exit();
-                       del_mtd_partitions(ubi_dev.mtd_info);
-               }
-
-               /*
-                * Search the mtd device number where this partition
-                * is located
-                */
-               if (find_dev_and_part(argv[2], &dev, &pnum, &part)) {
-                       printf("Partition %s not found!\n", argv[2]);
-                       return 1;
-               }
-               sprintf(mtd_dev, "%s%d", MTD_DEV_TYPE(dev->id->type), dev->id->num);
-               ubi_dev.mtd_info = get_mtd_device_nm(mtd_dev);
-               if (IS_ERR(ubi_dev.mtd_info)) {
-                       printf("Partition %s not found on device %s!\n", argv[2], mtd_dev);
-                       return 1;
-               }
-
-               ubi_dev.selected = 1;
-
                if (argc > 3)
                        vid_header_offset = argv[3];
-               strcpy(ubi_dev.part_name, argv[2]);
-               err = ubi_dev_scan(ubi_dev.mtd_info, ubi_dev.part_name,
-                               vid_header_offset);
-               if (err) {
-                       printf("UBI init error %d\n", err);
-                       ubi_dev.selected = 0;
-                       return err;
-               }
-
-               ubi = ubi_devices[0];
 
-               return 0;
+               return ubi_part(argv[2], vid_header_offset);
        }
 
        if ((strcmp(argv[1], "part") != 0) && (!ubi_dev.selected)) {
@@ -571,6 +578,8 @@ static int do_ubi(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
        }
 
        if (strncmp(argv[1], "write", 5) == 0) {
+               int ret;
+
                if (argc < 5) {
                        printf("Please see usage\n");
                        return 1;
@@ -579,7 +588,13 @@ static int do_ubi(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
                addr = simple_strtoul(argv[2], NULL, 16);
                size = simple_strtoul(argv[4], NULL, 16);
 
-               return ubi_volume_write(argv[3], (void *)addr, size);
+               ret = ubi_volume_write(argv[3], (void *)addr, size);
+               if (!ret) {
+                       printf("%d bytes written to volume %s\n", size,
+                              argv[3]);
+               }
+
+               return ret;
        }
 
        if (strncmp(argv[1], "read", 4) == 0) {
@@ -597,8 +612,12 @@ static int do_ubi(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
                        argc--;
                }
 
-               if (argc == 3)
+               if (argc == 3) {
+                       printf("Read %d bytes from volume %s to %lx\n", size,
+                              argv[3], addr);
+
                        return ubi_volume_read(argv[3], (char *)addr, size);
+               }
        }
 
        printf("Please see usage\n");
index 2a9d169f92da78f291e46f9731012135e34b6c4b..3c70d5dedefad75cbf1f81cb6cbf0a004c0f113e 100644 (file)
   MORECORE_FAILURE          (default: -1)
      The value returned upon failure of MORECORE.
   MORECORE_CLEARS           (default 1)
-     True (1) if the routine mapped to MORECORE zeroes out memory (which
+     true (1) if the routine mapped to MORECORE zeroes out memory (which
      holds for sbrk).
   DEFAULT_TRIM_THRESHOLD
   DEFAULT_TOP_PAD
index 32a38bc70c6eee978d7fdc6c887ca2f5f291331e..d86acffdeabdaa0652799b68cc0a75df23577b7c 100644 (file)
   MORECORE_FAILURE          (default: -1)
      The value returned upon failure of MORECORE.
   MORECORE_CLEARS           (default 1)
-     True (1) if the routine mapped to MORECORE zeroes out memory (which
+     true (1) if the routine mapped to MORECORE zeroes out memory (which
      holds for sbrk).
   DEFAULT_TRIM_THRESHOLD
   DEFAULT_TOP_PAD
index 5b69889c02a70fc7f167eab7a04864ac3a2ebdfc..b745822be781fe3e4f14c1682032a2448e4be4f7 100644 (file)
@@ -281,7 +281,8 @@ int readenv(size_t offset, u_char *buf)
                } else {
                        char_ptr = &buf[amount_loaded];
                        if (nand_read_skip_bad(&nand_info[0], offset,
-                                              &len, char_ptr))
+                                              &len, NULL,
+                                              nand_info[0].size, char_ptr))
                                return 1;
 
                        offset += blocksize;
diff --git a/common/env_ubi.c b/common/env_ubi.c
new file mode 100644 (file)
index 0000000..1ed8b02
--- /dev/null
@@ -0,0 +1,220 @@
+/*
+ * (c) Copyright 2012 by National Instruments,
+ *        Joe Hershberger <joe.hershberger@ni.com>
+ *
+ * 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
+ */
+
+#include <common.h>
+
+#include <command.h>
+#include <environment.h>
+#include <errno.h>
+#include <malloc.h>
+#include <search.h>
+#include <ubi_uboot.h>
+#undef crc32
+
+char *env_name_spec = "UBI";
+
+env_t *env_ptr;
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int env_init(void)
+{
+       /* use default */
+       gd->env_addr = (ulong)&default_environment[0];
+       gd->env_valid = 1;
+
+       return 0;
+}
+
+#ifdef CONFIG_CMD_SAVEENV
+#ifdef CONFIG_SYS_REDUNDAND_ENVIRONMENT
+static unsigned char env_flags;
+
+int saveenv(void)
+{
+       ALLOC_CACHE_ALIGN_BUFFER(env_t, env_new, 1);
+       ssize_t len;
+       char *res;
+
+       res = (char *)&env_new->data;
+       len = hexport_r(&env_htab, '\0', 0, &res, ENV_SIZE, 0, NULL);
+       if (len < 0) {
+               error("Cannot export environment: errno = %d\n", errno);
+               return 1;
+       }
+
+       if (ubi_part(CONFIG_ENV_UBI_PART, NULL)) {
+               printf("\n** Cannot find mtd partition \"%s\"\n",
+                      CONFIG_ENV_UBI_PART);
+               return 1;
+       }
+
+       env_new->crc = crc32(0, env_new->data, ENV_SIZE);
+       env_new->flags = ++env_flags; /* increase the serial */
+
+       if (gd->env_valid == 1) {
+               puts("Writing to redundant UBI... ");
+               if (ubi_volume_write(CONFIG_ENV_UBI_VOLUME_REDUND,
+                                    (void *)env_new, CONFIG_ENV_SIZE)) {
+                       printf("\n** Unable to write env to %s:%s **\n",
+                              CONFIG_ENV_UBI_PART,
+                              CONFIG_ENV_UBI_VOLUME_REDUND);
+                       return 1;
+               }
+       } else {
+               puts("Writing to UBI... ");
+               if (ubi_volume_write(CONFIG_ENV_UBI_VOLUME,
+                                    (void *)env_new, CONFIG_ENV_SIZE)) {
+                       printf("\n** Unable to write env to %s:%s **\n",
+                              CONFIG_ENV_UBI_PART,
+                              CONFIG_ENV_UBI_VOLUME);
+                       return 1;
+               }
+       }
+
+       puts("done\n");
+
+       gd->env_valid = gd->env_valid == 2 ? 1 : 2;
+
+       return 0;
+}
+#else /* ! CONFIG_SYS_REDUNDAND_ENVIRONMENT */
+int saveenv(void)
+{
+       ALLOC_CACHE_ALIGN_BUFFER(env_t, env_new, 1);
+       ssize_t len;
+       char *res;
+
+       res = (char *)&env_new->data;
+       len = hexport_r(&env_htab, '\0', 0, &res, ENV_SIZE, 0, NULL);
+       if (len < 0) {
+               error("Cannot export environment: errno = %d\n", errno);
+               return 1;
+       }
+
+       if (ubi_part(CONFIG_ENV_UBI_PART, NULL)) {
+               printf("\n** Cannot find mtd partition \"%s\"\n",
+                      CONFIG_ENV_UBI_PART);
+               return 1;
+       }
+
+       env_new->crc = crc32(0, env_new->data, ENV_SIZE);
+
+       if (ubi_volume_write(CONFIG_ENV_UBI_VOLUME, (void *)env_new,
+                            CONFIG_ENV_SIZE)) {
+               printf("\n** Unable to write env to %s:%s **\n",
+                      CONFIG_ENV_UBI_PART, CONFIG_ENV_UBI_VOLUME);
+               return 1;
+       }
+
+       puts("done\n");
+       return 0;
+}
+#endif /* CONFIG_SYS_REDUNDAND_ENVIRONMENT */
+#endif /* CONFIG_CMD_SAVEENV */
+
+#ifdef CONFIG_SYS_REDUNDAND_ENVIRONMENT
+void env_relocate_spec(void)
+{
+       ALLOC_CACHE_ALIGN_BUFFER(char, env1_buf, CONFIG_ENV_SIZE);
+       ALLOC_CACHE_ALIGN_BUFFER(char, env2_buf, CONFIG_ENV_SIZE);
+       int crc1_ok = 0, crc2_ok = 0;
+       env_t *ep, *tmp_env1, *tmp_env2;
+
+       tmp_env1 = (env_t *)env1_buf;
+       tmp_env2 = (env_t *)env2_buf;
+
+       if (ubi_part(CONFIG_ENV_UBI_PART, NULL)) {
+               printf("\n** Cannot find mtd partition \"%s\"\n",
+                      CONFIG_ENV_UBI_PART);
+               set_default_env(NULL);
+               return;
+       }
+
+       if (ubi_volume_read(CONFIG_ENV_UBI_VOLUME, (void *)tmp_env1,
+                           CONFIG_ENV_SIZE)) {
+               printf("\n** Unable to read env from %s:%s **\n",
+                      CONFIG_ENV_UBI_PART, CONFIG_ENV_UBI_VOLUME);
+       }
+
+       if (ubi_volume_read(CONFIG_ENV_UBI_VOLUME_REDUND, (void *)tmp_env2,
+                           CONFIG_ENV_SIZE)) {
+               printf("\n** Unable to read redundant env from %s:%s **\n",
+                      CONFIG_ENV_UBI_PART, CONFIG_ENV_UBI_VOLUME_REDUND);
+       }
+
+       crc1_ok = crc32(0, tmp_env1->data, ENV_SIZE) == tmp_env1->crc;
+       crc2_ok = crc32(0, tmp_env2->data, ENV_SIZE) == tmp_env2->crc;
+
+       if (!crc1_ok && !crc2_ok) {
+               set_default_env("!bad CRC");
+               return;
+       } else if (crc1_ok && !crc2_ok) {
+               gd->env_valid = 1;
+       } else if (!crc1_ok && crc2_ok) {
+               gd->env_valid = 2;
+       } else {
+               /* both ok - check serial */
+               if (tmp_env1->flags == 255 && tmp_env2->flags == 0)
+                       gd->env_valid = 2;
+               else if (tmp_env2->flags == 255 && tmp_env1->flags == 0)
+                       gd->env_valid = 1;
+               else if (tmp_env1->flags > tmp_env2->flags)
+                       gd->env_valid = 1;
+               else if (tmp_env2->flags > tmp_env1->flags)
+                       gd->env_valid = 2;
+               else /* flags are equal - almost impossible */
+                       gd->env_valid = 1;
+       }
+
+       if (gd->env_valid == 1)
+               ep = tmp_env1;
+       else
+               ep = tmp_env2;
+
+       env_flags = ep->flags;
+       env_import((char *)ep, 0);
+}
+#else /* ! CONFIG_SYS_REDUNDAND_ENVIRONMENT */
+void env_relocate_spec(void)
+{
+       ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE);
+
+       if (ubi_part(CONFIG_ENV_UBI_PART, NULL)) {
+               printf("\n** Cannot find mtd partition \"%s\"\n",
+                      CONFIG_ENV_UBI_PART);
+               set_default_env(NULL);
+               return;
+       }
+
+       if (ubi_volume_read(CONFIG_ENV_UBI_VOLUME, (void *)&buf,
+                           CONFIG_ENV_SIZE)) {
+               printf("\n** Unable to read env from %s:%s **\n",
+                      CONFIG_ENV_UBI_PART, CONFIG_ENV_UBI_VOLUME);
+               set_default_env(NULL);
+               return;
+       }
+
+       env_import(buf, 1);
+}
+#endif /* CONFIG_SYS_REDUNDAND_ENVIRONMENT */
index 77914adbce558aca4a67607dcd3292519cf02275..edae835fb0be1e6eb1fccdbf373b42dfc588ee31 100644 (file)
 #define CONFIG_CONSOLE_SCROLL_LINES 1
 #endif
 
-DECLARE_GLOBAL_DATA_PTR;
+/************************************************************************/
+/* ** CONSOLE DEFINITIONS & FUNCTIONS                                  */
+/************************************************************************/
+#if defined(CONFIG_LCD_LOGO) && !defined(CONFIG_LCD_INFO_BELOW_LOGO)
+# define CONSOLE_ROWS          ((panel_info.vl_row-BMP_LOGO_HEIGHT) \
+                                       / VIDEO_FONT_HEIGHT)
+#else
+# define CONSOLE_ROWS          (panel_info.vl_row / VIDEO_FONT_HEIGHT)
+#endif
 
-ulong lcd_setmem (ulong addr);
+#define CONSOLE_COLS           (panel_info.vl_col / VIDEO_FONT_WIDTH)
+#define CONSOLE_ROW_SIZE       (VIDEO_FONT_HEIGHT * lcd_line_length)
+#define CONSOLE_ROW_FIRST      lcd_console_address
+#define CONSOLE_ROW_SECOND     (lcd_console_address + CONSOLE_ROW_SIZE)
+#define CONSOLE_ROW_LAST       (lcd_console_address + CONSOLE_SIZE \
+                                       - CONSOLE_ROW_SIZE)
+#define CONSOLE_SIZE           (CONSOLE_ROW_SIZE * CONSOLE_ROWS)
+#define CONSOLE_SCROLL_SIZE    (CONSOLE_SIZE - CONSOLE_ROW_SIZE)
+
+#if LCD_BPP == LCD_MONOCHROME
+# define COLOR_MASK(c)         ((c)      | (c) << 1 | (c) << 2 | (c) << 3 | \
+                                (c) << 4 | (c) << 5 | (c) << 6 | (c) << 7)
+#elif (LCD_BPP == LCD_COLOR8) || (LCD_BPP == LCD_COLOR16)
+# define COLOR_MASK(c)         (c)
+#else
+# error Unsupported LCD BPP.
+#endif
+
+DECLARE_GLOBAL_DATA_PTR;
 
 static void lcd_drawchars(ushort x, ushort y, uchar *str, int count);
 static inline void lcd_puts_xy(ushort x, ushort y, uchar *s);
@@ -93,22 +119,25 @@ static inline void lcd_putc_xy(ushort x, ushort y, uchar  c);
 
 static int lcd_init(void *lcdbase);
 
-static void *lcd_logo (void);
+static void *lcd_logo(void);
 
 static int lcd_getbgcolor(void);
 static void lcd_setfgcolor(int color);
 static void lcd_setbgcolor(int color);
 
+static int lcd_color_fg;
+static int lcd_color_bg;
+int lcd_line_length;
+
 char lcd_is_enabled = 0;
 
-static char lcd_flush_dcache;  /* 1 to flush dcache after each lcd update */
+static short console_col;
+static short console_row;
 
+static void *lcd_console_address;
+static void *lcd_base;                 /* Start of framebuffer memory  */
 
-#ifdef NOT_USED_SO_FAR
-static void lcd_getcolreg(ushort regno,
-                               ushort *red, ushort *green, ushort *blue);
-static int lcd_getfgcolor(void);
-#endif /* NOT_USED_SO_FAR */
+static char lcd_flush_dcache;  /* 1 to flush dcache after each lcd update */
 
 /************************************************************************/
 
@@ -148,7 +177,7 @@ static void console_scrollup(void)
        /* Clear the last rows */
        memset(lcd_console_address + CONSOLE_SIZE - CONSOLE_ROW_SIZE * rows,
                COLOR_MASK(lcd_color_bg),
-              CONSOLE_ROW_SIZE * rows);
+               CONSOLE_ROW_SIZE * rows);
 
        lcd_sync();
        console_row -= rows;
@@ -160,9 +189,8 @@ static inline void console_back(void)
 {
        if (--console_col < 0) {
                console_col = CONSOLE_COLS-1 ;
-               if (--console_row < 0) {
+               if (--console_row < 0)
                        console_row = 0;
-               }
        }
 
        lcd_putc_xy(console_col * VIDEO_FONT_WIDTH,
@@ -173,16 +201,13 @@ static inline void console_back(void)
 
 static inline void console_newline(void)
 {
-       ++console_row;
        console_col = 0;
 
        /* Check if we need to scroll the terminal */
-       if (console_row >= CONSOLE_ROWS) {
-               /* Scroll everything up */
+       if (++console_row >= CONSOLE_ROWS)
                console_scrollup();
-       } else {
+       else
                lcd_sync();
-       }
 }
 
 /*----------------------------------------------------------------------*/
@@ -234,9 +259,9 @@ void lcd_puts(const char *s)
                return;
        }
 
-       while (*s) {
+       while (*s)