diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/ACEX1K.c | 7 | ||||
-rw-r--r-- | common/cmd_cache.c | 8 | ||||
-rw-r--r-- | common/cmd_doc.c | 4 | ||||
-rw-r--r-- | common/cmd_elf.c | 7 | ||||
-rw-r--r-- | common/cmd_fpga.c | 3 | ||||
-rw-r--r-- | common/cmd_i2c.c | 7 | ||||
-rw-r--r-- | common/cmd_ide.c | 60 | ||||
-rw-r--r-- | common/cmd_load.c | 6 | ||||
-rw-r--r-- | common/cmd_nand.c | 4 | ||||
-rw-r--r-- | common/cmd_pcmcia.c | 7 | ||||
-rw-r--r-- | common/command.c | 11 | ||||
-rw-r--r-- | common/console.c | 10 | ||||
-rw-r--r-- | common/dlmalloc.c | 1021 | ||||
-rw-r--r-- | common/fpga.c | 7 | ||||
-rw-r--r-- | common/hush.c | 48 | ||||
-rw-r--r-- | common/lcd.c | 21 | ||||
-rw-r--r-- | common/usb_kbd.c | 369 | ||||
-rw-r--r-- | common/usb_storage.c | 13 | ||||
-rw-r--r-- | common/virtex2.c | 3 | ||||
-rw-r--r-- | common/xilinx.c | 3 | ||||
-rw-r--r-- | common/xyzModem.c | 7 |
21 files changed, 0 insertions, 1626 deletions
diff --git a/common/ACEX1K.c b/common/ACEX1K.c index 2a421e2da9..97ea6cb0f1 100644 --- a/common/ACEX1K.c +++ b/common/ACEX1K.c @@ -209,13 +209,6 @@ static int ACEX1K_ps_load (Altera_desc * desc, void *buf, size_t bsize) #endif /* Altera detects an error if INIT goes low (active) while DONE is low (inactive) */ -#if 0 /* not yet implemented */ - if ((*fn->done) (cookie) == 0 && (*fn->init) (cookie)) { - puts ("** CRC error during FPGA load.\n"); - (*fn->abort) (cookie); - return (FPGA_FAIL); - } -#endif val = data [bytecount ++ ]; i = 8; do { diff --git a/common/cmd_cache.c b/common/cmd_cache.c index 6c250bc1c0..e34815d7d9 100644 --- a/common/cmd_cache.c +++ b/common/cmd_cache.c @@ -36,10 +36,6 @@ int do_icache ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) switch (argc) { case 2: /* on / off */ switch (on_off(argv[1])) { -#if 0 /* prevented by varargs handling; FALLTROUGH is harmless, too */ - default: printf ("Usage:\n%s\n", cmdtp->usage); - return; -#endif case 0: icache_disable(); break; case 1: icache_enable (); @@ -62,10 +58,6 @@ int do_dcache ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) switch (argc) { case 2: /* on / off */ switch (on_off(argv[1])) { -#if 0 /* prevented by varargs handling; FALLTROUGH is harmless, too */ - default: printf ("Usage:\n%s\n", cmdtp->usage); - return; -#endif case 0: dcache_disable(); break; case 1: dcache_enable (); diff --git a/common/cmd_doc.c b/common/cmd_doc.c index ab37516953..9b8bb1adea 100644 --- a/common/cmd_doc.c +++ b/common/cmd_doc.c @@ -1551,10 +1551,6 @@ static inline int doccheck(unsigned long potential, unsigned long physadr) * if the ID isn't the DoC2000 or DoCMillenium ID, so we can assume * the DOC is missing */ -# if 0 - printf("Possible DiskOnChip with unknown ChipID %2.2X found at 0x%lx\n", - ChipID, physadr); -# endif #endif #ifndef DOC_PASSIVE_PROBE /* Put back the contents of the DOCControl register, in case it's not diff --git a/common/cmd_elf.c b/common/cmd_elf.c index 0e3d56f6bb..9c5d81ecae 100644 --- a/common/cmd_elf.c +++ b/common/cmd_elf.c @@ -243,13 +243,6 @@ int valid_elf_image (unsigned long addr) return 0; } -#if 0 - if (ehdr->e_machine != EM_PPC) { - printf ("## Not a PowerPC elf image at address 0x%08lx\n", - addr); - return 0; - } -#endif return 1; } diff --git a/common/cmd_fpga.c b/common/cmd_fpga.c index 3444091858..621e136862 100644 --- a/common/cmd_fpga.c +++ b/common/cmd_fpga.c @@ -33,9 +33,6 @@ #include <fpga.h> #include <malloc.h> -#if 0 -#define FPGA_DEBUG -#endif #ifdef FPGA_DEBUG #define PRINTF(fmt,args...) printf (fmt ,##args) diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c index 45cfde2eb8..b699b2cb47 100644 --- a/common/cmd_i2c.c +++ b/common/cmd_i2c.c @@ -321,13 +321,6 @@ int do_i2c_mw ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) udelay(11000); #endif -#if 0 - for (timeout = 0; timeout < 10; timeout++) { - udelay(2000); - if (i2c_probe(chip) == 0) - break; - } -#endif } return (0); diff --git a/common/cmd_ide.c b/common/cmd_ide.c index a4155029a7..aaef681630 100644 --- a/common/cmd_ide.c +++ b/common/cmd_ide.c @@ -282,20 +282,6 @@ int do_ide (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) rcode = 1; } return rcode; -#if 0 - } else if (strncmp(argv[1],"pio",4) == 0) { - int mode = (int)simple_strtoul(argv[2], NULL, 10); - - if ((mode >= 0) && (mode <= IDE_MAX_PIO_MODE)) { - puts ("\nSetting "); - pio_mode = mode; - ide_init (); - } else { - printf ("\nInvalid PIO mode %d (0 ... %d only)\n", - mode, IDE_MAX_PIO_MODE); - } - return; -#endif } printf ("Usage:\n%s\n", cmdtp->usage); @@ -1029,9 +1015,6 @@ static void ide_ident (block_dev_desc_t *dev_desc) int do_retry = 0; #endif -#if 0 - int mode, cycle_time; -#endif int device; device=dev_desc->dev; printf (" Device %d: ", device); @@ -1144,34 +1127,6 @@ static void ide_ident (block_dev_desc_t *dev_desc) else dev_desc->removable = 0; -#if 0 - /* - * Drive PIO mode autoselection - */ - mode = iop->tPIO; - - printf ("tPIO = 0x%02x = %d\n",mode, mode); - if (mode > 2) { /* 2 is maximum allowed tPIO value */ - mode = 2; - debug ("Override tPIO -> 2\n"); - } - if (iop->field_valid & 2) { /* drive implements ATA2? */ - debug ("Drive implements ATA2\n"); - if (iop->capability & 8) { /* drive supports use_iordy? */ - cycle_time = iop->eide_pio_iordy; - } else { - cycle_time = iop->eide_pio; - } - debug ("cycle time = %d\n", cycle_time); - mode = 4; - if (cycle_time > 120) mode = 3; /* 120 ns for PIO mode 4 */ - if (cycle_time > 180) mode = 2; /* 180 ns for PIO mode 3 */ - if (cycle_time > 240) mode = 1; /* 240 ns for PIO mode 4 */ - if (cycle_time > 383) mode = 0; /* 383 ns for PIO mode 4 */ - } - printf ("PIO mode to use: PIO %d\n", mode); -#endif /* 0 */ - #ifdef CONFIG_ATAPI if (dev_desc->if_type==IF_TYPE_ATAPI) { atapi_inquiry(dev_desc); @@ -1207,21 +1162,6 @@ static void ide_ident (block_dev_desc_t *dev_desc) dev_desc->type=DEV_TYPE_HARDDISK; dev_desc->blksz=ATA_BLOCKSIZE; dev_desc->lun=0; /* just to fill something in... */ - -#if 0 /* only used to test the powersaving mode, - * if enabled, the drive goes after 5 sec - * in standby mode */ - ide_outb (device, ATA_DEV_HD, ATA_LBA | ATA_DEVICE(device)); - c = ide_wait (device, IDE_TIME_OUT); - ide_outb (device, ATA_SECT_CNT, 1); - ide_outb (device, ATA_LBA_LOW, 0); - ide_outb (device, ATA_LBA_MID, 0); - ide_outb (device, ATA_LBA_HIGH, 0); - ide_outb (device, ATA_DEV_HD, ATA_LBA | ATA_DEVICE(device)); - ide_outb (device, ATA_COMMAND, 0xe3); - udelay (50); - c = ide_wait (device, IDE_TIME_OUT); /* can't take over 500 ms */ -#endif } diff --git a/common/cmd_load.c b/common/cmd_load.c index f63b8e8056..a13d3d06dd 100644 --- a/common/cmd_load.c +++ b/common/cmd_load.c @@ -842,12 +842,6 @@ static int k_recv (void) If a character less than SPACE (0x20) is received - error. */ -#if 0 - /* OLD CODE, Prior to checking sequence numbers */ - /* first have all state machines save current states */ - k_state_saved = k_state; - k_data_save (); -#endif /* get a packet */ /* wait for the starting character or ^C */ diff --git a/common/cmd_nand.c b/common/cmd_nand.c index b011b5e3de..e36ed9b7cf 100644 --- a/common/cmd_nand.c +++ b/common/cmd_nand.c @@ -629,10 +629,6 @@ U_BOOT_CMD(nboot, 4, 1, do_nandboot, #if (CONFIG_COMMANDS & CFG_CMD_NAND) #include <linux/mtd/nand_legacy.h> -#if 0 -#include <linux/mtd/nand_ids.h> -#include <jffs2/jffs2.h> -#endif #ifdef CONFIG_OMAP1510 void archflashwp(void *archdata, int wp); diff --git a/common/cmd_pcmcia.c b/common/cmd_pcmcia.c index 2eb5b26f2c..97df7a2cd5 100644 --- a/common/cmd_pcmcia.c +++ b/common/cmd_pcmcia.c @@ -352,13 +352,6 @@ int check_ide_device (int slot) /* set I/O area in config reg -> only valid for ARGOSY D5!!! */ *((uchar *)(addr + config_base)) = 1; #endif -#if 0 - printf("\n## Config_base = %04x ###\n", config_base); - printf("Configuration Option Register: %02x @ %x\n", readb(addr + config_base), addr + config_base); - printf("Card Configuration and Status Register: %02x\n", readb(addr + config_base + 2)); - printf("Pin Replacement Register Register: %02x\n", readb(addr + config_base + 4)); - printf("Socket and Copy Register: %02x\n", readb(addr + config_base + 6)); -#endif return (0); } diff --git a/common/command.c b/common/command.c index e917975a73..0d1116c2a1 100644 --- a/common/command.c +++ b/common/command.c @@ -90,14 +90,6 @@ do_test (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) if (argc < 3) return 1; -#if 0 - { - printf("test:"); - left = 1; - while (argv[left]) - printf(" %s", argv[left++]); - } -#endif last_expr = 0; left = argc - 1; ap = argv + 1; @@ -196,9 +188,6 @@ do_test (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) expr = !expr; -#if 0 - printf(": returns %d\n", expr); -#endif return expr; } diff --git a/common/console.c b/common/console.c index e9f23bec18..76b4ad071a 100644 --- a/common/console.c +++ b/common/console.c @@ -474,11 +474,6 @@ int console_init_r (void) } #endif /* CFG_CONSOLE_ENV_OVERWRITE */ -#if 0 - /* If nothing usable installed, use only the initial console */ - if ((stdio_devices[stdin] == NULL) && (stdio_devices[stdout] == NULL)) - return (0); -#endif return (0); } @@ -560,11 +555,6 @@ int console_init_r (void) setenv (stdio_names[i], stdio_devices[i]->name); } -#if 0 - /* If nothing usable installed, use only the initial console */ - if ((stdio_devices[stdin] == NULL) && (stdio_devices[stdout] == NULL)) - return (0); -#endif return (0); } diff --git a/common/dlmalloc.c b/common/dlmalloc.c index 20c206913c..968bf9d421 100644 --- a/common/dlmalloc.c +++ b/common/dlmalloc.c @@ -1,952 +1,6 @@ -#if 0 /* Moved to malloc.h */ -/* ---------- To make a malloc.h, start cutting here ------------ */ - -/* - A version of malloc/free/realloc written by Doug Lea and released to the - public domain. Send questions/comments/complaints/performance data - to dl@cs.oswego.edu - -* VERSION 2.6.6 Sun Mar 5 19:10:03 2000 Doug Lea (dl at gee) - - Note: There may be an updated version of this malloc obtainable at - ftp://g.oswego.edu/pub/misc/malloc.c - Check before installing! - -* Why use this malloc? - - This is not the fastest, most space-conserving, most portable, or - most tunable malloc ever written. However it is among the fastest - while also being among the most space-conserving, portable and tunable. - Consistent balance across these factors results in a good general-purpose - allocator. For a high-level description, see - http://g.oswego.edu/dl/html/malloc.html - -* Synopsis of public routines - - (Much fuller descriptions are contained in the program documentation below.) - - malloc(size_t n); - Return a pointer to a newly allocated chunk of at least n bytes, or null - if no space is available. - free(Void_t* p); - Release the chunk of memory pointed to by p, or no effect if p is null. - realloc(Void_t* p, size_t n); - Return a pointer to a chunk of size n that contains the same data - as does chunk p up to the minimum of (n, p's size) bytes, or null - if no space is available. The returned pointer may or may not be - the same as p. If p is null, equivalent to malloc. Unless the - #define REALLOC_ZERO_BYTES_FREES below is set, realloc with a - size argument of zero (re)allocates a minimum-sized chunk. - memalign(size_t alignment, size_t n); - Return a pointer to a newly allocated chunk of n bytes, aligned - in accord with the alignment argument, which must be a power of - two. - valloc(size_t n); - Equivalent to memalign(pagesize, n), where pagesize is the page - size of the system (or as near to this as can be figured out from - all the includes/defines below.) - pvalloc(size_t n); - Equivalent to valloc(minimum-page-that-holds(n)), that is, - round up n to nearest pagesize. - calloc(size_t unit, size_t quantity); - Returns a pointer to quantity * unit bytes, with all locations - set to zero. - cfree(Void_t* p); - Equivalent to free(p). - malloc_trim(size_t pad); - Release all but pad bytes of freed top-most memory back - to the system. Return 1 if successful, else 0. - malloc_usable_size(Void_t* p); - Report the number usable allocated bytes associated with allocated - chunk p. This may or may not report more bytes than were requested, - due to alignment and minimum size constraints. - malloc_stats(); - Prints brief summary statistics. - mallinfo() - Returns (by copy) a struct containing various summary statistics. - mallopt(int parameter_number, int parameter_value) - Changes one of the tunable parameters described below. Returns - 1 if successful in changing the parameter, else 0. - -* Vital statistics: - - Alignment: 8-byte - 8 byte alignment is currently hardwired into the design. This - seems to suffice for all current machines and C compilers. - - Assumed pointer representation: 4 or 8 bytes - Code for 8-byte pointers is untested by me but has worked - reliably by Wolfram Gloger, who contributed most of the - changes supporting this. - - Assumed size_t representation: 4 or 8 bytes - Note that size_t is allowed to be 4 bytes even if pointers are 8. - - Minimum overhead per allocated chunk: 4 or 8 bytes - Each malloced chunk has a hidden overhead of 4 bytes holding size - and status information. - - Minimum allocated size: 4-byte ptrs: 16 bytes (including 4 overhead) - 8-byte ptrs: 24/32 bytes (including, 4/8 overhead) - - When a chunk is freed, 12 (for 4byte ptrs) or 20 (for 8 byte - ptrs but 4 byte size) or 24 (for 8/8) additional bytes are - needed; 4 (8) for a trailing size field - and 8 (16) bytes for free list pointers. Thus, the minimum - allocatable size is 16/24/32 bytes. - - Even a request for zero bytes (i.e., malloc(0)) returns a - pointer to something of the minimum allocatable size. - - Maximum allocated size: 4-byte size_t: 2^31 - 8 bytes - 8-byte size_t: 2^63 - 16 bytes - - It is assumed that (possibly signed) size_t bit values suffice to - represent chunk sizes. `Possibly signed' is due to the fact - that `size_t' may be defined on a system as either a signed or - an unsigned type. To be conservative, values that would appear - as negative numbers are avoided. - Requests for sizes with a negative sign bit when the request - size is treaded as a long will return null. - - Maximum overhead wastage per allocated chunk: normally 15 bytes - - Alignnment demands, plus the minimum allocatable size restriction - make the normal worst-case wastage 15 bytes (i.e., up to 15 - more bytes will be allocated than were requested in malloc), with - two exceptions: - 1. Because requests for zero bytes allocate non-zero space, - the worst case wastage for a request of zero bytes is 24 bytes. - 2. For requests >= mmap_threshold that are serviced via - mmap(), the worst case wastage is 8 bytes plus the remainder - from a system page (the minimal mmap unit); typically 4096 bytes. - -* Limitations - - Here are some features that are NOT currently supported - - * No user-definable hooks for callbacks and the like. - * No automated mechanism for fully checking that all accesses - to malloced memory stay within their bounds. - * No support for compaction. - -* Synopsis of compile-time options: - - People have reported using previous versions of this malloc on all - versions of Unix, sometimes by tweaking some of the defines - below. It has been tested most extensively on Solaris and - Linux. It is also reported to work on WIN32 platforms. - People have also reported adapting this malloc for use in - stand-alone embedded systems. - - The implementation is in straight, hand-tuned ANSI C. Among other - consequences, it uses a lot of macros. Because of this, to be at - all usable, this code should be compiled using an optimizing compiler - (for example gcc -O2) that can simplify expressions and control - paths. - - __STD_C (default: derived from C compiler defines) - Nonzero if using ANSI-standard C compiler, a C++ compiler, or - a C compiler sufficiently close to ANSI to get away with it. - DEBUG (default: NOT defined) - Define to enable debugging. Adds fairly extensive assertion-based - checking to help track down memory errors, but noticeably slows down - execution. - REALLOC_ZERO_BYTES_FREES (default: NOT defined) - Define this if you think that realloc(p, 0) should be equivalent - to free(p). Otherwise, since malloc returns a unique pointer for - malloc(0), so does realloc(p, 0). - HAVE_MEMCPY (default: defined) - Define if you are not otherwise using ANSI STD C, but still - have memcpy and memset in your C library and want to use them. - Otherwise, simple internal versions are supplied. - USE_MEMCPY (default: 1 if HAVE_MEMCPY is defined, 0 otherwise) - Define as 1 if you want the C library versions of memset and - memcpy called in realloc and calloc (otherwise macro versions are used). - At least on some platforms, the simple macro versions usually - outperform libc versions. - HAVE_MMAP (default: defined as 1) - Define to non-zero to optionally make malloc() use mmap() to - allocate very large blocks. - HAVE_MREMAP (default: defined as 0 unless Linux libc set) - Define to non-zero to optionally make realloc() use mremap() to - reallocate very large blocks. - malloc_getpagesize (default: derived from system #includes) - Either a constant or routine call returning the system page size. - HAVE_USR_INCLUDE_MALLOC_H (default: NOT defined) - Optionally define if you are on a system with a /usr/include/malloc.h - that declares struct mallinfo. It is not at all necessary to - define this even if you do, but will ensure consistency. - INTERNAL_SIZE_T (default: size_t) - Define to a 32-bit type (probably `unsigned int') if you are on a - 64-bit machine, yet do not want or need to allow malloc requests of - greater than 2^31 to be handled. This saves space, especially for - very small chunks. - INTERNAL_LINUX_C_LIB (default: NOT defined) - Defined only when compiled as part of Linux libc. - Also note that there is some odd internal name-mangling via defines - (for example, internally, `malloc' is named `mALLOc') needed - when compiling in this case. These look funny but don't otherwise - affect anything. - WIN32 (default: undefined) - Define this on MS win (95, nt) platforms to compile in sbrk emulation. - LACKS_UNISTD_H (default: undefined if not WIN32) - Define this if your system does not have a <unistd.h>. - LACKS_SYS_PARAM_H (default: undefined if not WIN32) - Define this if your system does not have a <sys/param.h>. - MORECORE (default: sbrk) - The name of the routine to call to obtain more memory from the system. - 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 - holds for sbrk). - DEFAULT_TRIM_THRESHOLD - DEFAULT_TOP_PAD - DEFAULT_MMAP_THRESHOLD - DEFAULT_MMAP_MAX - Default values of tunable parameters (described in detail below) - controlling interaction with host system routines (sbrk, mmap, etc). - These values may also be changed dynamically via mallopt(). The - preset defaults are those that give best performance for typical - programs/systems. - USE_DL_PREFIX (default: undefined) - Prefix all public routines with the string 'dl'. Useful to - quickly avoid procedure declaration conflicts and linker symbol - conflicts with existing memory allocation routines. - - -*/ - - - - -/* Preliminaries */ - -#ifndef __STD_C -#ifdef __STDC__ -#define __STD_C 1 -#else -#if __cplusplus -#define __STD_C 1 -#else -#define __STD_C 0 -#endif /*__cplusplus*/ -#endif /*__STDC__*/ -#endif /*__STD_C*/ - -#ifndef Void_t -#if (__STD_C || defined(WIN32)) -#define Void_t void -#else -#define Void_t char -#endif -#endif /*Void_t*/ - -#if __STD_C -#include <stddef.h> /* for size_t */ -#else -#include <sys/types.h> -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#include <stdio.h> /* needed for malloc_stats */ - - -/* - Compile-time options -*/ - - -/* - Debugging: - - Because freed chunks may be overwritten with link fields, this - malloc will often die when freed memory is overwritten by user - programs. This can be very effective (albeit in an annoying way) - in helping track down dangling pointers. - - If you compile with -DDEBUG, a number of assertion checks are - enabled that will catch more memory errors. You probably won't be - able to make much sense of the actual assertion errors, but they - should help you locate incorrectly overwritten memory. The - checking is fairly extensive, and will slow down execution - noticeably. Calling malloc_stats or mallinfo with DEBUG set will - attempt to check every non-mmapped allocated and free chunk in the - course of computing the summmaries. (By nature, mmapped regions - cannot be checked very much automatically.) - - Setting DEBUG may also be helpful if you are trying to modify - this code. The assertions in the check routines spell out in more - detail the assumptions and invariants underlying the algorithms. - -*/ - -#ifdef DEBUG -#include <assert.h> -#else -#define assert(x) ((void)0) -#endif - - -/* - INTERNAL_SIZE_T is the word-size used for internal bookkeeping - of chunk sizes. On a 64-bit machine, you can reduce malloc - overhead by defining INTERNAL_SIZE_T to be a 32 bit `unsigned int' - at the expense of not being able to handle requests greater than - 2^31. This limitation is hardly ever a concern; you are encouraged - to set this. However, the default version is the same as size_t. -*/ - -#ifndef INTERNAL_SIZE_T -#define INTERNAL_SIZE_T size_t -#endif - -/* - REALLOC_ZERO_BYTES_FREES should be set if a call to - realloc with zero bytes should be the same as a call to free. - Some people think it should. Otherwise, since this malloc - returns a unique pointer for malloc(0), so does realloc(p, 0). -*/ - - -/* #define REALLOC_ZERO_BYTES_FREES */ - - -/* - WIN32 causes an emulation of sbrk to be compiled in - mmap-based options are not currently supported in WIN32. -*/ - -/* #define WIN32 */ -#ifdef WIN32 -#define MORECORE wsbrk -#define HAVE_MMAP 0 - -#define LACKS_UNISTD_H -#define LACKS_SYS_PARAM_H - -/* - Include 'windows.h' to get the necessary declarations for the - Microsoft Visual C++ data structures and routines used in the 'sbrk' - emulation. - - Define WIN32_LEAN_AND_MEAN so that only the essential Microsoft - Visual C++ header files are included. -*/ -#define WIN32_LEAN_AND_MEAN -#include <windows.h> -#endif - - -/* - HAVE_MEMCPY should be defined if you are not otherwise using - ANSI STD C, but still have memcpy and memset in your C library - and want to use them in calloc and realloc. Otherwise simple - macro versions are defined here. - - USE_MEMCPY should be defined as 1 if you actually want to - have memset and memcpy called. People report that the macro - versions are often enough faster than libc versions on many - systems that it is better to use them. - -*/ - -#define HAVE_MEMCPY - -#ifndef USE_MEMCPY -#ifdef HAVE_MEMCPY -#define USE_MEMCPY 1 -#else -#define USE_MEMCPY 0 -#endif -#endif - -#if (__STD_C || defined(HAVE_MEMCPY)) - -#if __STD_C -void* memset(void*, int, size_t); -void* memcpy(void*, const void*, size_t); -#else -#ifdef WIN32 -/* On Win32 platforms, 'memset()' and 'memcpy()' are already declared in */ -/* 'windows.h' */ -#else -Void_t* memset(); -Void_t* memcpy(); -#endif -#endif -#endif - -#if USE_MEMCPY - -/* The following macros are only invoked with (2n+1)-multiples of - INTERNAL_SIZE_T units, with a positive integer n. This is exploited - for fast inline execution when n is small. */ - -#define MALLOC_ZERO(charp, nbytes) \ -do { \ - INTERNAL_SIZE_T mzsz = (nbytes); \ - if(mzsz <= 9*sizeof(mzsz)) { \ - INTERNAL_SIZE_T* mz = (INTERNAL_SIZE_T*) (charp); \ - if(mzsz >= 5*sizeof(mzsz)) { *mz++ = 0; \ - *mz++ = 0; \ - if(mzsz >= 7*sizeof(mzsz)) { *mz++ = 0; \ - *mz++ = 0; \ - if(mzsz >= 9*sizeof(mzsz)) { *mz++ = 0; \ - *mz++ = 0; }}} \ - *mz++ = 0; \ - *mz++ = 0; \ - *mz = 0; \ - } else memset((charp), 0, mzsz); \ -} while(0) - -#define MALLOC_COPY(dest,src,nbytes) \ -do { \ - INTERNAL_SIZE_T mcsz = (nbytes); \ - if(mcsz <= 9*sizeof(mcsz)) { \ - INTERNAL_SIZE_T* mcsrc = (INTERNAL_SIZE_T*) (src); \ - INTERNAL_SIZE_T* mcdst = (INTERNAL_SIZE_T*) (dest); \ - if(mcsz >= 5*sizeof(mcsz)) { *mcdst++ = *mcsrc++; \ - *mcdst++ = *mcsrc++; \ - if(mcsz >= 7*sizeof(mcsz)) { *mcdst++ = *mcsrc++; \ - *mcdst++ = *mcsrc++; \ - if(mcsz >= 9*sizeof(mcsz)) { *mcdst++ = *mcsrc++; \ - *mcdst++ = *mcsrc++; }}} \ - *mcdst++ = *mcsrc++; \ - *mcdst++ = *mcsrc++; \ - *mcdst = *mcsrc ; \ - } else memcpy(dest, src, mcsz); \ -} while(0) - -#else /* !USE_MEMCPY */ - -/* Use Duff's device for good zeroing/copying performance. */ - -#define MALLOC_ZERO(charp, nbytes) \ -do { \ - INTERNAL_SIZE_T* mzp = (INTERNAL_SIZE_T*)(charp); \ - long mctmp = (nbytes)/sizeof(INTERNAL_SIZE_T), mcn; \ - if (mctmp < 8) mcn = 0; else { mcn = (mctmp-1)/8; mctmp %= 8; } \ - switch (mctmp) { \ - case 0: for(;;) { *mzp++ = 0; \ - case 7: *mzp++ = 0; \ - case 6: *mzp++ = 0; \ - case 5: *mzp++ = 0; \ - case 4: *mzp++ = 0; \ - case 3: *mzp++ = 0; \ - case 2: *mzp++ = 0; \ - case 1: *mzp++ = 0; if(mcn <= 0) break; mcn--; } \ - } \ -} while(0) - -#define MALLOC_COPY(dest,src,nbytes) \ -do { \ - INTERNAL_SIZE_T* mcsrc = (INTERNAL_SIZE_T*) src; \ - INTERNAL_SIZE_T* mcdst = (INTERNAL_SIZE_T*) dest; \ - long mctmp = (nbytes)/sizeof(INTERNAL_SIZE_T), mcn; \ - if (mctmp < 8) mcn = 0; else { mcn = (mctmp-1)/8; mctmp %= 8; } \ - switch (mctmp) { \ - case 0: for(;;) { *mcdst++ = *mcsrc++; \ - case 7: *mcdst++ = *mcsrc++; \ - case 6: *mcdst++ = *mcsrc++; \ - case 5: *mcdst++ = *mcsrc++; \ - case 4: *mcdst++ = *mcsrc++; \ - case 3: *mcdst++ = *mcsrc++; \ - case 2: *mcdst++ = *mcsrc++; \ - case 1: *mcdst++ = *mcsrc++; if(mcn <= 0) break; mcn--; } \ - } \ -} while(0) - -#endif - - -/* - Define HAVE_MMAP to optionally make malloc() use mmap() to - allocate very large blocks. These will be returned to the - operating system immediately after a free(). -*/ - -#ifndef HAVE_MMAP -#define HAVE_MMAP 1 -#endif - -/* - Define HAVE_MREMAP to make realloc() use mremap() to re-allocate - large blocks. This is currently only possible on Linux with - kernel versions newer than 1.3.77. -*/ - -#ifndef HAVE_MREMAP -#ifdef INTERNAL_LINUX_C_LIB -#define HAVE_MREMAP 1 -#else -#define HAVE_MREMAP 0 -#endif -#endif - -#if HAVE_MMAP - -#include <unistd.h> -#include <fcntl.h> -#include <sys/mman.h> - -#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON) -#define MAP_ANONYMOUS MAP_ANON -#endif - -#endif /* HAVE_MMAP */ - -/* - Access to system page size. To the extent possible, this malloc - manages memory from the system in page-size units. - - The following mechanics for getpagesize were adapted from - bsd/gnu getpagesize.h -*/ - -#ifndef LACKS_UNISTD_H -# include <unistd.h> -#endif - -#ifndef malloc_getpagesize -# ifdef _SC_PAGESIZE /* some SVR4 systems omit an underscore */ -# ifndef _SC_PAGE_SIZE -# define _SC_PAGE_SIZE _SC_PAGESIZE -# endif -# endif -# ifdef _SC_PAGE_SIZE -# define malloc_getpagesize sysconf(_SC_PAGE_SIZE) -# else -# if defined(BSD) || defined(DGUX) || defined(HAVE_GETPAGESIZE) - extern size_t getpagesize(); -# define malloc_getpagesize getpagesize() -# else -# ifdef WIN32 -# define malloc_getpagesize (4096) /* TBD: Use 'GetSystemInfo' instead */ -# else -# ifndef LACKS_SYS_PARAM_H -# include <sys/param.h> -# endif -# ifdef EXEC_PAGESIZE -# define malloc_getpagesize EXEC_PAGESIZE -# else -# ifdef NBPG -# ifndef CLSIZE -# define malloc_getpagesize NBPG -# else -# define malloc_getpagesize (NBPG * CLSIZE) -# endif -# else -# ifdef NBPC -# define malloc_getpagesize NBPC -# else -# ifdef PAGESIZE -# define malloc_getpagesize PAGESIZE -# else -# define malloc_getpagesize (4096) /* just guess */ -# endif -# endif -# endif -# endif -# endif -# endif -# endif -#endif - - -/* - - This version of malloc supports the standard SVID/XPG mallinfo - routine that returns a struct containing the same kind of - information you can get from malloc_stats. It should work on - any SVID/XPG compliant system that has a /usr/include/malloc.h - defining struct mallinfo. (If you'd like to install such a thing - yourself, cut out the preliminary declarations as described above - and below and save them in a malloc.h file. But there's no - compelling reason to bother to do this.) - - The main declaration needed is the mallinfo struct that is returned - (by-copy) by mallinfo(). The SVID/XPG malloinfo struct contains a - bunch of fields, most of which are not even meaningful in this - version of malloc. Some of these fields are are instead filled by - mallinfo() with other numbers that might possibly be of interest. - - HAVE_USR_INCLUDE_MALLOC_H should be set if you have a - /usr/include/malloc.h file that includes a declaration of struct - mallinfo. If so, it is included; else an SVID2/XPG2 compliant - version is declared below. These must be precisely the same for - mallinfo() to work. - -*/ - -/* #define HAVE_USR_INCLUDE_MALLOC_H */ - -#if HAVE_USR_INCLUDE_MALLOC_H -#include "/usr/include/malloc.h" -#else - -/* SVID2/XPG mallinfo structure */ - -struct mallinfo { - int arena; /* total space allocated from system */ - int ordblks; /* number of non-inuse chunks */ - int smblks; /* unused -- always zero */ - int hblks; /* number of mmapped regions */ - int hblkhd; /* total space in mmapped regions */ - int usmblks; /* unused -- always zero */ - int fsmblks; /* unused -- always zero */ - int uordblks; /* total allocated space */ - int fordblks; /* total non-inuse space */ - int keepcost; /* top-most, releasable (via malloc_trim) space */ -}; - -/* SVID2/XPG mallopt options */ - -#define M_MXFAST 1 /* UNUSED in this malloc */ -#define M_NLBLKS 2 /* UNUSED in this malloc */ -#define M_GRAIN 3 /* UNUSED in this malloc */ -#define M_KEEP 4 /* UNUSED in this malloc */ - -#endif - -/* mallopt options that actually do something */ - -#define M_TRIM_THRESHOLD -1 -#define M_TOP_PAD -2 -#define M_MMAP_THRESHOLD -3 -#define M_MMAP_MAX -4 - - -#ifndef DEFAULT_TRIM_THRESHOLD -#define DEFAULT_TRIM_THRESHOLD (128 * 1024) -#endif - -/* - M_TRIM_THRESHOLD is the maximum amount of unused top-most memory - to keep before releasing via malloc_trim in free(). - - Automatic trimming is mainly useful in long-lived programs. - Because trimming via sbrk can be slow on some systems, and can - sometimes be wasteful (in cases where programs immediately - afterward allocate more large chunks) the value should be high - enough so that your overall system performance would improve by - releasing. - - The trim threshold and the mmap control parameters (see below) - can be traded off with one another. Trimming and mmapping are - two different ways of releasing unused memory back to the - system. Between these two, it is often possible to keep - system-level demands of a long-lived program down to a bare - minimum. For example, in one test suite of sessions measuring - the XF86 X server on Linux, using a trim threshold of 128K and a - mmap threshold of 192K led to near-minimal long term resource - consumption. - - If you are using this malloc in a long-lived program, it should - pay to experiment with these values. As a rough guide, you - might set to a value close to the average size of a process - (program) running on your system. Releasing this much memory - would allow such a process to run in memory. Generally, it's - worth it to tune for trimming rather tham memory mapping when a - program undergoes phases where several large chunks are - allocated and released in ways that can reuse each other's - storage, perhaps mixed with phases where there are no such - chunks at all. And in well-behaved long-lived programs, - controlling release of large blocks via trimming versus mapping - is usually faster. - - However, in most programs, these parameters serve mainly as - protection against the system-level effects of carrying around - massive amounts of unneeded memory. Since frequent calls to - sbrk, mmap, and munmap otherwise degrade performance, the default - parameters are set to relatively high values that serve only as - safeguards. - - The default trim value is high enough to cause trimming only in - fairly extreme (by current memory consumption standards) cases. - It must be greater than page size to have any useful effect. To - disable trimming completely, you can set to (unsigned long)(-1); - - -*/ - - -#ifndef DEFAULT_TOP_PAD -#define DEFAULT_TOP_PAD (0) -#endif - -/* - M_TOP_PAD is the amount of extra `padding' space to allocate or - retain whenever sbrk is called. It is used in two ways internally: - - * When sbrk is called to extend the top of the arena to satisfy - a new malloc request, this much padding is added to the sbrk - request. - - * When malloc_trim is called automatically from free(), - it is used as the `pad' argument. - - In both cases, the actual amount of padding is rounded - so that the end of the arena is always a system page boundary. - - The main reason for using padding is to avoid calling sbrk so - often. Having even a small pad greatly reduces the likelihood - that nearly every malloc request during program start-up (or - after trimming) will invoke sbrk, which needlessly wastes - time. - - Automatic rounding-up to page-size units is normally sufficient - to avoid measurable overhead, so the default is 0. However, in - systems where sbrk is relatively slow, it can pay to increase - this value, at the expense of carrying around more memory than - the program needs. - -*/ - - -#ifndef DEFAULT_MMAP_THRESHOLD -#define DEFAULT_MMAP_THRESHOLD (128 * 1024) -#endif - -/* - - M_MMAP_THRESHOLD is the request size threshold for using mmap() - to service a request. Requests of at least this size that cannot - be allocated using already-existing space will be serviced via mmap. - (If enough normal freed space already exists it is used instead.) - - Using mmap segregates relatively large chunks of memory so that - they can be individually obtained and released from the host - system. A request serviced through mmap is never reused by any - other request (at least not directly; the system may just so - happen to remap successive requests to the same locations). - - Segregating space in this way has the benefit that mmapped space - can ALWAYS be individually released back to the system, which - helps keep the system level memory demands of a long-lived - program low. Mapped memory can never become `locked' between - other chunks, as can happen with normally allocated chunks, which - menas that even trimming via malloc_trim would not release them. - - However, it has the disadvantages that: - - 1. The space cannot be reclaimed, consolidated, and then - used to service later requests, as happens with normal chunks. - 2. It can lead to more wastage because of mmap page alignment - requirements - 3. It causes malloc performance to be more dependent on host - system memory management support routines which may vary in - implementation quality and may impose arbitrary - limitations. Generally, servicing a request via normal - malloc steps is faster than going through a system's mmap. - - All together, these considerations should lead you to use mmap - only for relatively large requests. - - -*/ - - -#ifndef DEFAULT_MMAP_MAX -#if HAVE_MMAP -#define DEFAULT_MMAP_MAX (64) -#else -#define DEFAULT_MMAP_MAX (0) -#endif -#endif - -/* - M_MMAP_MAX is the maximum number of requests to simultaneously - service using mmap. This parameter exists because: - - 1. Some systems have a limited number of internal tables for - use by mmap. - 2. In most systems, overreliance on mmap can degrade overall - performance. - 3. If a program allocates many large regions, it is probably - better off using normal sbrk-based allocation routines that - can reclaim and reallocate normal heap memory. Using a - small value allows transition into this mode after the - first few allocations. - - Setting to 0 disables all use of mmap. If HAVE_MMAP is not set, - the default value is 0, and attempts to set it to non-zero values - in mallopt will fail. -*/ - - -/* - USE_DL_PREFIX will prefix all public routines with the string 'dl'. - Useful to quickly avoid procedure declaration conflicts and linker - symbol conflicts with existing memory allocation routines. - -*/ - -/* #define USE_DL_PREFIX */ - - -/* - - Special defines for linux libc - - Except when compiled using these special defines for Linux libc - using weak aliases, this malloc is NOT designed to work in - multithreaded applications. No semaphores or other concurrency - control are provided to ensure that multiple malloc or free calls - don't run at the same time, which could be disasterous. A single - semaphore could be used across malloc, realloc, and free (which is - essentially the effect of the linux weak alias approach). It would - be hard to obtain finer granularity. - -*/ - - -#ifdef INTERNAL_LINUX_C_LIB - -#if __STD_C - -Void_t * __default_morecore_init (ptrdiff_t); -Void_t *(*__morecore)(ptrdiff_t) = __default_morecore_init; - -#else - -Void_t * __default_morecore_init (); -Void_t *(*__morecore)() = __default_morecore_init; - -#endif - -#define MORECORE (*__morecore) -#define MORECORE_FAILURE 0 -#define MORECORE_CLEARS 1 - -#else /* INTERNAL_LINUX_C_LIB */ - -#if __STD_C -extern Void_t* sbrk(ptrdiff_t); -#else -extern Void_t* sbrk(); -#endif - -#ifndef MORECORE -#define MORECORE sbrk -#endif - -#ifndef MORECORE_FAILURE -#define MORECORE_FAILURE -1 -#endif - -#ifndef MORECORE_CLEARS -#define MORECORE_CLEARS 1 -#endif - -#endif /* INTERNAL_LINUX_C_LIB */ - -#if defined(INTERNAL_LINUX_C_LIB) && defined(__ELF__) - -#define cALLOc __libc_calloc -#define fREe __libc_free -#define mALLOc __libc_malloc -#define mEMALIGn __libc_memalign -#define rEALLOc __libc_realloc -#define vALLOc __libc_valloc -#define pvALLOc __libc_pvalloc -#define mALLINFo __libc_mallinfo -#define mALLOPt __libc_mallopt - -#pragma weak calloc = __libc_calloc -#pragma weak free = __libc_free -#pragma weak cfree = __libc_free -#pragma weak malloc = __libc_malloc -#pragma weak memalign = __libc_memalign -#pragma weak realloc = __libc_realloc -#pragma weak valloc = __libc_valloc -#pragma weak pvalloc = __libc_pvalloc -#pragma weak mallinfo = __libc_mallinfo -#pragma weak mallopt = __libc_mallopt - -#else - -#ifdef USE_DL_PREFIX -#define cALLOc dlcalloc -#define fREe dlfree -#define mALLOc dlmalloc -#define mEMALIGn dlmemalign -#define rEALLOc dlrealloc -#define vALLOc dlvalloc -#define pvALLOc dlpvalloc -#define mALLINFo dlmallinfo -#define mALLOPt dlmallopt -#else /* USE_DL_PREFIX */ -#define cALLOc calloc -#define fREe free -#define mALLOc malloc -#define mEMALIGn memalign -#define rEALLOc realloc -#define vALLOc valloc -#define pvALLOc pvalloc -#define mALLINFo mallinfo -#define mALLOPt mallopt -#endif /* USE_DL_PREFIX */ - -#endif - -/* Public routines */ - -#if __STD_C - -Void_t* mALLOc(size_t); -void fREe(Void_t*); -Void_t* rEALLOc(Void_t*, size_t); -Void_t* mEMALIGn(size_t, size_t); -Void_t* vALLOc(size_t); -Void_t* pvALLOc(size_t); -Void_t* cALLOc(size_t, size_t); -void cfree(Void_t*); -int malloc_trim(size_t); -size_t malloc_usable_size(Void_t*); -void malloc_stats(); -int mALLOPt(int, int); -struct mallinfo mALLINFo(void); -#else -Void_t* mALLOc(); -void fREe(); -Void_t* rEALLOc(); -Void_t* mEMALIGn(); -Void_t* vALLOc(); -Void_t* pvALLOc(); -Void_t* cALLOc(); -void cfree(); -int malloc_trim(); -size_t malloc_usable_size(); -void malloc_stats(); -int mALLOPt(); -struct mallinfo mALLINFo(); -#endif - - -#ifdef __cplusplus -}; /* end of extern "C" */ -#endif - -/* ---------- To make a malloc.h, end cutting here ------------ */ -#else /* Moved to malloc.h */ #include <malloc.h> -#if 0 -#if __STD_C -static void malloc_update_mallinfo (void); -void malloc_stats (void); -#else -static void malloc_update_mallinfo (); -void malloc_stats(); -#endif -#endif /* 0 */ -#endif /* 0 */ /* Moved to malloc.h */ #include <common.h> DECLARE_GLOBAL_DATA_PTR; @@ -1589,9 +643,6 @@ static struct mallinfo current_mallinfo = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; /* Tracking mmaps */ -#if 0 -static unsigned int n_mmaps = 0; -#endif /* 0 */ static unsigned long mmapped_mem = 0; #if HAVE_MMAP static unsigned int max_n_mmaps = 0; @@ -1621,9 +672,6 @@ static void do_check_chunk(mchunkptr p) static void do_check_chunk(p) mchunkptr p; #endif { -#if 0 /* causes warnings because assert() is off */ - INTERNAL_SIZE_T sz = p->size & ~PREV_INUSE; -#endif /* 0 */ /* No checkable chunk is mmapped */ assert(!chunk_is_mmapped(p)); @@ -1645,9 +693,6 @@ static void do_check_free_chunk(p) mchunkptr p; #endif { INTERNAL_SIZE_T sz = p->size & ~PREV_INUSE; -#if 0 /* causes warnings because assert() is off */ - mchunkptr next = chunk_at_offset(p, sz); -#endif /* 0 */ do_check_chunk(p); @@ -1711,10 +756,6 @@ static void do_check_malloced_chunk(mchunkptr p, INTERNAL_SIZE_T s) static void do_check_malloced_chunk(p, s) mchunkptr p; INTERNAL_SIZE_T s; #endif { -#if 0 /* causes warnings because assert() is off */ - INTERNAL_SIZE_T sz = p->size & ~PREV_INUSE; - long room = sz - s; -#endif /* 0 */ do_check_inuse_chunk(p); @@ -3066,45 +2107,6 @@ size_t malloc_usable_size(mem) Void_t* mem; /* Utility to update current_mallinfo for malloc_stats and mallinfo() */ -#if 0 -static void malloc_update_mallinfo() -{ - int i; - mbinptr b; - mchunkptr p; -#ifdef DEBUG - mchunkptr q; -#endif - - INTERNAL_SIZE_T avail = chunksize(top); - int navail = ((long)(avail) >= (long)MINSIZE)? 1 : 0; - - for (i = 1; i < NAV; ++i) - { - b = bin_at(i); - for (p = last(b); p != b; p = p->bk) - { -#ifdef DEBUG - check_free_chunk(p); - for (q = next_chunk(p); - q < top && inuse(q) && (long)(chunksize(q)) >= (long)MINSIZE; - q = next_chunk(q)) - check_inuse_chunk(q); -#endif - avail += chunksize(p); - navail++; - } - } - - current_mallinfo.ordblks = navail; - current_mallinfo.uordblks = sbrked_mem - avail; - current_mallinfo.fordblks = avail; - current_mallinfo.hblks = n_mmaps; - current_mallinfo.hblkhd = mmapped_mem; - current_mallinfo.keepcost = chunksize(top); - -} -#endif /* 0 */ @@ -3123,34 +2125,11 @@ static void malloc_update_mallinfo() */ -#if 0 -void malloc_stats() -{ - malloc_update_mallinfo(); - printf("max system bytes = %10u\n", - (unsigned int)(max_total_mem)); - printf("system bytes = %10u\n", - (unsigned int)(sbrked_mem + mmapped_mem)); - printf("in use bytes = %10u\n", - (unsigned int)(current_mallinfo.uordblks + mmapped_mem)); -#if HAVE_MMAP - printf("max mmap regions = %10u\n", - (unsigned int)max_n_mmaps); -#endif -} -#endif /* 0 */ /* mallinfo returns a copy of updated current mallinfo. */ -#if 0 -struct mallinfo mALLINFo() -{ - malloc_update_mallinfo(); - return current_mallinfo; -} -#endif /* 0 */ diff --git a/common/fpga.c b/common/fpga.c index 2eff239c47..81b9bc76e0 100644 --- a/common/fpga.c +++ b/common/fpga.c @@ -31,9 +31,6 @@ #if defined(CONFIG_FPGA) -#if 0 -#define FPGA_DEBUG /* define FPGA_DEBUG to get debug messages */ -#endif /* Local definitions */ #ifndef CONFIG_MAX_FPGA_DEVICES @@ -207,10 +204,6 @@ void fpga_init( ulong reloc_off ) memset( desc_table, 0, sizeof(desc_table)); PRINTF( "%s: CONFIG_FPGA = 0x%x\n", __FUNCTION__, CONFIG_FPGA ); -#if 0 - PRINTF( "%s: CFG_FPGA_XILINX = 0x%x\n", __FUNCTION__, CFG_FPGA_XILINX ); - PRINTF( "%s: CFG_FPGA_ALTERA = 0x%x\n", __FUNCTION__, CFG_FPGA_ALTERA ); -#endif } /* fpga_count diff --git a/common/hush.c b/common/hush.c index feb5627ff2..f81fdcf0b4 100644 --- a/common/hush.c +++ b/common/hush.c @@ -118,16 +118,8 @@ extern int do_bootd (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); / /* #include <dmalloc.h> */ /* #define DEBUG_SHELL */ -#if 1 #include "busybox.h" #include "cmdedit.h" -#else -#define applet_name "hush" -#include "standalone.h" -#define hush_main main -#undef CONFIG_FEATURE_SH_FANCY_PROMPT -#define BB_BANNER -#endif #endif #define SPECIAL_VAR_SYMBOL 03 #ifndef __U_BOOT__ @@ -1480,14 +1472,6 @@ static int checkjobs(struct pipe* fg_pipe) pi->stopped_progs++; pi->progs[prognum].is_stopped = 1; -#if 0 - /* Printing this stuff is a pain, since it tends to - * overwrite the prompt an inconveinient moments. So - * don't do that. */ - if (pi->stopped_progs == pi->num_progs) { - printf("\n"JOB_STATUS_FORMAT, pi->jobid, "Stopped", pi->text); - } -#endif } } @@ -2125,18 +2109,6 @@ static int glob_needed(const char *s) return 0; } -#if 0 -static void globprint(glob_t *pglob) -{ - int i; - debug_printf("glob_t at %p:\n", pglob); - debug_printf(" gl_pathc=%d gl_pathv=%p gl_offs=%d gl_flags=%d\n", - pglob->gl_pathc, pglob->gl_pathv, pglob->gl_offs, pglob->gl_flags); - for (i=0; i<pglob->gl_pathc; i++) - debug_printf("pglob->gl_pathv[%d] = %p = %s\n", i, - pglob->gl_pathv[i], pglob->gl_pathv[i]); -} -#endif static int xglob(o_string *dest, int flags, glob_t *pglob) { @@ -2693,7 +2665,6 @@ static int redirect_opt_num(o_string *o) FILE *generate_stream_from_list(struct pipe *head) { FILE *pf; -#if 1 int pid, channel[2]; if (pipe(channel)<0) perror_msg_and_die("pipe"); pid=fork(); @@ -2705,23 +2676,12 @@ FILE *generate_stream_from_list(struct pipe *head) dup2(channel[1],1); close(channel[1]); } -#if 0 -#define SURROGATE "surrogate response" - write(1,SURROGATE,sizeof(SURROGATE)); - _exit(run_list(head)); -#else _exit(run_list_real(head)); /* leaks memory */ -#endif } debug_printf("forked child %d\n",pid); close(channel[1]); pf = fdopen(channel[0],"r"); debug_printf("pipe on FILE *%p\n",pf); -#else - free_pipe_list(head,0); - pf=popen("echo surrogate response","r"); - debug_printf("started fake pipe on FILE *%p\n",pf); -#endif return pf; } @@ -2984,14 +2944,6 @@ int parse_stream(o_string *dest, struct p_context *ctx, debug_printf("leaving parse_stream (triggered)\n"); return 0; } -#if 0 - if (ch=='\n') { - /* Yahoo! Time to run with it! */ - done_pipe(ctx,PIPE_SEQ); - run_list(ctx->list_head); - initialize_context(ctx); - } -#endif if (m!=2) switch (ch) { case '#': if (dest->length == 0 && !dest->quote) { diff --git a/common/lcd.c b/common/lcd.c index eaed2abd80..dbb5aad9d4 100644 --- a/common/lcd.c +++ b/common/lcd.c @@ -110,32 +110,11 @@ static int lcd_getfgcolor (void); static void console_scrollup (void) { -#if 1 /* Copy up rows ignoring the first one */ memcpy (CONSOLE_ROW_FIRST, CONSOLE_ROW_SECOND, CONSOLE_SCROLL_SIZE); /* Clear the last one */ memset (CONSOLE_ROW_LAST, COLOR_MASK(lcd_color_bg), CONSOLE_ROW_SIZE); -#else - /* - * Poor attempt to optimize speed by moving "long"s. - * But the code is ugly, and not a bit faster :-( - */ - ulong *t = (ulong *)CONSOLE_ROW_FIRST; - ulong *s = (ulong *)CONSOLE_ROW_SECOND; - ulong l = CONSOLE_SCROLL_SIZE / sizeof(ulong); - uchar c = lcd_color_bg & 0xFF; - ulong val= (c<<24) | (c<<16) | (c<<8) | c; - - while (l--) - *t++ = *s++; - - t = (ulong *)CONSOLE_ROW_LAST; - l = CONSOLE_ROW_SIZE / sizeof(ulong); - - while (l-- > 0) - *t++ = val; -#endif } /*----------------------------------------------------------------------*/ diff --git a/common/usb_kbd.c b/common/usb_kbd.c index 56c21660fa..5d396e32bc 100644 --- a/common/usb_kbd.c +++ b/common/usb_kbd.c @@ -355,374 +355,5 @@ static int usb_kbd_probe(struct usb_device *dev, unsigned int ifnum) } -#if 0 -struct usb_hid_descriptor { - unsigned char bLength; - unsigned char bDescriptorType; /* 0x21 for HID */ - unsigned short bcdHID; /* release number */ - unsigned char bCountryCode; - unsigned char bNumDescriptors; - unsigned char bReportDescriptorType; - unsigned short wDescriptorLength; -} __attribute__ ((packed)); - -/* - * We parse each description item into this structure. Short items data - * values are expanded to 32-bit signed int, long items contain a pointer - * into the data area. - */ - -struct hid_item { - unsigned char format; - unsigned char size; - unsigned char type; - unsigned char tag; - union { - unsigned char u8; - char s8; - unsigned short u16; - short s16; - unsigned long u32; - long s32; - unsigned char *longdata; - } data; -}; - -/* - * HID report item format - */ - -#define HID_ITEM_FORMAT_SHORT 0 -#define HID_ITEM_FORMAT_LONG 1 - -/* - * Special tag indicating long items - */ - -#define HID_ITEM_TAG_LONG 15 - - -static struct usb_hid_descriptor usb_kbd_hid_desc; - -void usb_kbd_display_hid(struct usb_hid_descriptor *hid) -{ - printf("USB_HID_DESC:\n"); - printf(" bLenght 0x%x\n",hid->bLength); - printf(" bcdHID 0x%x\n",hid->bcdHID); - printf(" bCountryCode %d\n",hid->bCountryCode); - printf(" bNumDescriptors 0x%x\n",hid->bNumDescriptors); - printf(" bReportDescriptorType 0x%x\n",hid->bReportDescriptorType); - printf(" wDescriptorLength 0x%x\n",hid->wDescriptorLength); -} - - -/* - * Fetch a report description item from the data stream. We support long - * items, though they are not used yet. - */ - -static int fetch_item(unsigned char *start,unsigned char *end, struct hid_item *item) -{ - if((end - start) > 0) { - unsigned char b = *start++; - item->type = (b >> 2) & 3; - item->tag = (b >> 4) & 15; - if (item->tag == HID_ITEM_TAG_LONG) { - item->format = HID_ITEM_FORMAT_LONG; - if ((end - start) >= 2) { - item->size = *start++; - item->tag = *start++; - if ((end - start) >= item->size) { - item->data.longdata = start; - start += item->size; - return item->size; - } - } - } else { - item->format = HID_ITEM_FORMAT_SHORT; - item->size = b & 3; - switch (item->size) { - case 0: - return item->size; - case 1: - if ((end - start) >= 1) { - item->data.u8 = *start++; - return item->size; - } - break; - case 2: - if ((end - start) >= 2) { - item->data.u16 = swap_16((unsigned short *)start); - start+=2; - return item->size; - } - case 3: - item->size++; - if ((end - start) >= 4) { - item->data.u32 = swap_32((unsigned long *)start); - start+=4; - return item->size; - } - } - } - } - return -1; -} - -/* - * HID report descriptor item type (prefix bit 2,3) - */ - -#define HID_ITEM_TYPE_MAIN 0 -#define HID_ITEM_TYPE_GLOBAL 1 -#define HID_ITEM_TYPE_LOCAL 2 -#define HID_ITEM_TYPE_RESERVED 3 -/* - * HID report descriptor main item tags - */ - -#define HID_MAIN_ITEM_TAG_INPUT 8 -#define HID_MAIN_ITEM_TAG_OUTPUT 9 -#define HID_MAIN_ITEM_TAG_FEATURE 11 -#define HID_MAIN_ITEM_TAG_BEGIN_COLLECTION 10 -#define HID_MAIN_ITEM_TAG_END_COLLECTION 12 -/* - * HID report descriptor main item contents - */ - -#define HID_MAIN_ITEM_CONSTANT 0x001 -#define HID_MAIN_ITEM_VARIABLE 0x002 -#define HID_MAIN_ITEM_RELATIVE 0x004 -#define HID_MAIN_ITEM_WRAP 0x008 -#define HID_MAIN_ITEM_NONLINEAR 0x010 -#define HID_MAIN_ITEM_NO_PREFERRED 0x020 -#define HID_MAIN_ITEM_NULL_STATE 0x040 -#define HID_MAIN_ITEM_VOLATILE 0x080 -#define HID_MAIN_ITEM_BUFFERED_BYTE 0x100 - -/* - * HID report descriptor collection item types - */ - -#define HID_COLLECTION_PHYSICAL 0 -#define HID_COLLECTION_APPLICATION 1 -#define HID_COLLECTION_LOGICAL 2 -/* - * HID report descriptor global item tags - */ - -#define HID_GLOBAL_ITEM_TAG_USAGE_PAGE 0 -#define HID_GLOBAL_ITEM_TAG_LOGICAL_MINIMUM 1 -#define HID_GLOBAL_ITEM_TAG_LOGICAL_MAXIMUM 2 -#define HID_GLOBAL_ITEM_TAG_PHYSICAL_MINIMUM 3 -#define HID_GLOBAL_ITEM_TAG_PHYSICAL_MAXIMUM 4 -#define HID_GLOBAL_ITEM_TAG_UNIT_EXPONENT 5 -#define HID_GLOBAL_ITEM_TAG_UNIT 6 -#define HID_GLOBAL_ITEM_TAG_REPORT_SIZE 7 -#define HID_GLOBAL_ITEM_TAG_REPORT_ID 8 -#define HID_GLOBAL_ITEM_TAG_REPORT_COUNT 9 -#define HID_GLOBAL_ITEM_TAG_PUSH 10 -#define HID_GLOBAL_ITEM_TAG_POP 11 - -/* - * HID report descriptor local item tags - */ - -#define HID_LOCAL_ITEM_TAG_USAGE 0 -#define HID_LOCAL_ITEM_TAG_USAGE_MINIMUM 1 -#define HID_LOCAL_ITEM_TAG_USAGE_MAXIMUM 2 -#define HID_LOCAL_ITEM_TAG_DESIGNATOR_INDEX 3 -#define HID_LOCAL_ITEM_TAG_DESIGNATOR_MINIMUM 4 -#define HID_LOCAL_ITEM_TAG_DESIGNATOR_MAXIMUM 5 -#define HID_LOCAL_ITEM_TAG_STRING_INDEX 7 -#define HID_LOCAL_ITEM_TAG_STRING_MINIMUM 8 -#define HID_LOCAL_ITEM_TAG_STRING_MAXIMUM 9 -#define HID_LOCAL_ITEM_TAG_DELIMITER 10 - - -static void usb_kbd_show_item(struct hid_item *item) -{ - switch(item->type) { - case HID_ITEM_TYPE_MAIN: - switch(item->tag) { - case HID_MAIN_ITEM_TAG_INPUT: - printf("Main Input"); - break; - case HID_MAIN_ITEM_TAG_OUTPUT: - printf("Main Output"); - break; - case HID_MAIN_ITEM_TAG_FEATURE: - printf("Main Feature"); - break; - case HID_MAIN_ITEM_TAG_BEGIN_COLLECTION: - printf("Main Begin Collection"); - break; - case HID_MAIN_ITEM_TAG_END_COLLECTION: - printf("Main End Collection"); - break; - default: - printf("Main reserved %d",item->tag); - break; - } - break; - case HID_ITEM_TYPE_GLOBAL: - switch(item->tag) { - case HID_GLOBAL_ITEM_TAG_USAGE_PAGE: - printf("- Global Usage Page"); - break; - case HID_GLOBAL_ITEM_TAG_LOGICAL_MINIMUM: - printf("- Global Logical Minimum"); - break; - case HID_GLOBAL_ITEM_TAG_LOGICAL_MAXIMUM: - printf("- Global Logical Maximum"); - break; - case HID_GLOBAL_ITEM_TAG_PHYSICAL_MINIMUM: - printf("- Global physical Minimum"); - break; - case HID_GLOBAL_ITEM_TAG_PHYSICAL_MAXIMUM: - printf("- Global physical Maximum"); - break; - case HID_GLOBAL_ITEM_TAG_UNIT_EXPONENT: - printf("- Global Unit Exponent"); - break; - case HID_GLOBAL_ITEM_TAG_UNIT: - printf("- Global Unit"); - break; - case HID_GLOBAL_ITEM_TAG_REPORT_SIZE: - printf("- Global Report Size"); - break; - case HID_GLOBAL_ITEM_TAG_REPORT_ID: - printf("- Global Report ID"); - break; - case HID_GLOBAL_ITEM_TAG_REPORT_COUNT: - printf("- Global Report Count"); - break; - case HID_GLOBAL_ITEM_TAG_PUSH: - printf("- Global Push"); - break; - case HID_GLOBAL_ITEM_TAG_POP: - printf("- Global Pop"); - break; - default: - printf("- Global reserved %d",item->tag); - break; - } - break; - case HID_ITEM_TYPE_LOCAL: - switch(item->tag) { - case HID_LOCAL_ITEM_TAG_USAGE: - printf("-- Local Usage"); - break; - case HID_LOCAL_ITEM_TAG_USAGE_MINIMUM: - printf("-- Local Usage Minimum"); - break; - case HID_LOCAL_ITEM_TAG_USAGE_MAXIMUM: - printf("-- Local Usage Maximum"); - break; - case HID_LOCAL_ITEM_TAG_DESIGNATOR_INDEX: - printf("-- Local Designator Index"); - break; - case HID_LOCAL_ITEM_TAG_DESIGNATOR_MINIMUM: - printf("-- Local Designator Minimum"); - break; - case HID_LOCAL_ITEM_TAG_DESIGNATOR_MAXIMUM: - printf("-- Local Designator Maximum"); - break; - case HID_LOCAL_ITEM_TAG_STRING_INDEX: - printf("-- Local String Index"); - break; - case HID_LOCAL_ITEM_TAG_STRING_MINIMUM: - printf("-- Local String Minimum"); - break; - case HID_LOCAL_ITEM_TAG_STRING_MAXIMUM: - printf("-- Local String Maximum"); - break; - case HID_LOCAL_ITEM_TAG_DELIMITER: - printf("-- Local Delimiter"); - break; - default: - printf("-- Local reserved %d",item->tag); - break; - } - break; - default: - printf("--- reserved %d",item->type); - break; - } - switch(item->size) { - case 1: - printf(" %d",item->data.u8); - break; - case 2: - printf(" %d",item->data.u16); - break; - case 4: - printf(" %ld",item->data.u32); - break; - } - printf("\n"); -} - - -static int usb_kbd_get_hid_desc(struct usb_device *dev) -{ - unsigned char buffer[256]; - struct usb_descriptor_header *head; - struct usb_config_descriptor *config; - int index,len,i; - unsigned char *start, *end; - struct hid_item item; - - if(usb_get_configuration_no(dev,&buffer[0],0)==-1) - return -1; - head =(struct usb_descriptor_header *)&buffer[0]; - if(head->bDescriptorType!=USB_DT_CONFIG) { - printf(" ERROR: NOT USB_CONFIG_DESC %x\n",head->bDescriptorType); - return -1; - } - index=head->bLength; - config=(struct usb_config_descriptor *)&buffer[0]; - len=swap_16(config->wTotalLength); - /* Ok the first entry must be a configuration entry, now process the others */ - head=(struct usb_descriptor_header *)&buffer[index]; - while(index+1 < len) { - if(head->bDescriptorType==USB_DT_HID) { - printf("HID desc found\n"); - memcpy(&usb_kbd_hid_desc,&buffer[index],buffer[index]); - usb_kbd_hid_desc.bcdHID=swap_16(usb_kbd_hid_desc.bcdHID); - usb_kbd_hid_desc.wDescriptorLength=swap_16(usb_kbd_hid_desc.wDescriptorLength); - usb_kbd_display_hid(&usb_kbd_hid_desc); - len=0; - break; - } - index+=head->bLength; - head=(struct usb_descriptor_header *)&buffer[index]; - } - if(len>0) - return -1; - len=usb_kbd_hid_desc.wDescriptorLength; - if((index = usb_get_class_descriptor(dev, 0, USB_DT_REPORT, 0, &buffer[0], len)) < 0) { - printf("reading report descriptor failed\n"); - return -1; - } - printf(" report descriptor (size %u, read %d)\n", len, index); - start=&buffer[0]; - end=&buffer[len]; - i=0; - do { - index=fetch_item(start,end,&item); - i+=index; - i++; - if(index>=0) - usb_kbd_show_item(&item); - - start+=index; - start++; - } while(index>=0); - -} - - -#endif #endif /* CONFIG_USB_KEYBOARD */ diff --git a/common/usb_storage.c b/common/usb_storage.c index 06ea99b2f1..e021b13471 100644 --- a/common/usb_storage.c +++ b/common/usb_storage.c @@ -1022,15 +1022,6 @@ int usb_storage_probe(struct usb_device *dev, unsigned int ifnum,struct us_data /* let's examine the device now */ iface = &dev->config.if_desc[ifnum]; -#if 0 - /* this is the place to patch some storage devices */ - USB_STOR_PRINTF("iVendor %X iProduct %X\n",dev->descriptor.idVendor,dev->descriptor.idProduct); - if ((dev->descriptor.idVendor) == 0x066b && (dev->descriptor.idProduct) == 0x0103) { - USB_STOR_PRINTF("patched for E-USB\n"); - protocol = US_PR_CB; - subclass = US_SC_UFI; /* an assumption */ - } -#endif if (dev->descriptor.bDeviceClass != 0 || iface->bInterfaceClass != USB_CLASS_MASS_STORAGE || @@ -1214,10 +1205,6 @@ int usb_stor_get_info(struct usb_device *dev,struct us_data *ss,block_dev_desc_t cap[1] = 0x200; } USB_STOR_PRINTF("Read Capacity returns: 0x%lx, 0x%lx\n",cap[0],cap[1]); -#if 0 - if(cap[0]>(0x200000 * 10)) /* greater than 10 GByte */ - cap[0]>>=16; -#endif #ifdef LITTLEENDIAN cap[0] = ((unsigned long)( (((unsigned long)(cap[0]) & (unsigned long)0x000000ffUL) << 24) | diff --git a/common/virtex2.c b/common/virtex2.c index b5dc366aad..5d98a5571a 100644 --- a/common/virtex2.c +++ b/common/virtex2.c @@ -33,9 +33,6 @@ #if (CONFIG_FPGA & (CFG_XILINX | CFG_VIRTEX2)) -#if 0 -#define FPGA_DEBUG -#endif #ifdef FPGA_DEBUG #define PRINTF(fmt,args...) printf (fmt ,##args) diff --git a/common/xilinx.c b/common/xilinx.c index e03e78cb28..b54c660a24 100644 --- a/common/xilinx.c +++ b/common/xilinx.c @@ -34,9 +34,6 @@ #if (CONFIG_FPGA & CFG_FPGA_XILINX) -#if 0 -#define FPGA_DEBUG -#endif /* Define FPGA_DEBUG to get debug printf's */ #ifdef FPGA_DEBUG diff --git a/common/xyzModem.c b/common/xyzModem.c index a209dfa4af..92a7d543e9 100644 --- a/common/xyzModem.c +++ b/common/xyzModem.c @@ -840,10 +840,3 @@ xyzModem_error (int err) /* * RedBoot interface */ -#if 0 /* SB */ -GETC_IO_FUNCS (xyzModem_io, xyzModem_stream_open, xyzModem_stream_close, - xyzModem_stream_terminate, xyzModem_stream_read, - xyzModem_error); -RedBoot_load (xmodem, xyzModem_io, false, false, xyzModem_xmodem); -RedBoot_load (ymodem, xyzModem_io, false, false, xyzModem_ymodem); -#endif |