]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
Merge branch 'common-devel' into uboot-merge
authorLothar Waßmann <LW@KARO-electronics.de>
Wed, 5 Mar 2014 14:34:40 +0000 (15:34 +0100)
committerLothar Waßmann <LW@KARO-electronics.de>
Wed, 5 Mar 2014 14:34:40 +0000 (15:34 +0100)
arch/arm/lib/interrupts.c
common/cmd_gpt.c
common/cmd_mmc.c
common/lcd.c
disk/part_efi.c
tools/elftosb/common/stdafx.h

index 849a37a490d31182eb955c12661abe7c993ff5c9..787dceb93d0841ea8b407777eefb60ee64405f30 100644 (file)
@@ -107,11 +107,12 @@ void show_regs (struct pt_regs *regs)
        "UK12_32",      "UK13_32",      "UK14_32",      "SYS_32",
        };
 
-       flags = condition_codes (regs);
+       flags = condition_codes(regs);
 
-       printf ("pc : [<%08lx>]    lr : [<%08lx>]\n"
+       printf ("pc : [<%08lx>] (pre-reloc: [<%08lx>]) lr : [<%08lx>]\n"
                "sp : %08lx  ip : %08lx  fp : %08lx\n",
-               instruction_pointer (regs),
+               instruction_pointer(regs),
+               instruction_pointer(regs) - gd->reloc_off,
                regs->ARM_lr, regs->ARM_sp, regs->ARM_ip, regs->ARM_fp);
        printf ("r10: %08lx  r9 : %08lx  r8 : %08lx\n",
                regs->ARM_r10, regs->ARM_r9, regs->ARM_r8);
index 06767aa5e5045f831183c93804f60049da33f626..d8c6b431586e1887e66cb63a548e2ba8cd17b46a 100644 (file)
@@ -119,6 +119,7 @@ static int set_gpt_info(block_dev_desc_t *dev_desc,
        char *val, *p;
        int p_count;
        disk_partition_t *parts;
+       char *guid_str;
        int errno = 0;
        uint64_t size_ll, start_ll;
 
@@ -135,16 +136,20 @@ static int set_gpt_info(block_dev_desc_t *dev_desc,
        tok = strsep(&s, ";");
        val = extract_val(tok, "uuid_disk");
        if (!val) {
-               free(str);
-               return -2;
+               errno = -2;
+               goto free_str;
        }
-       if (extract_env(val, &p))
-               p = val;
-       *str_disk_guid = strdup(p);
+       if (extract_env(val, &p) == 0)
+               guid_str = strdup(p);
+       else
+               guid_str = strdup(val);
+
        free(val);
 
-       if (strlen(s) == 0)
-               return -3;
+       if (strlen(s) == 0) {
+               errno = -3;
+               goto free_guid;
+       }
 
        i = strlen(s) - 1;
        if (s[i] == ';')
@@ -222,16 +227,23 @@ static int set_gpt_info(block_dev_desc_t *dev_desc,
                }
        }
 
+       *str_disk_guid = guid_str;
        *parts_count = p_count;
        *partitions = parts;
        free(str);
 
        return 0;
+
 err:
-       free(str);
-       free(*str_disk_guid);
        free(parts);
+free_guid:
+       free(guid_str);
+free_str:
+       free(str);
 
+       *str_disk_guid = NULL;
+       *parts_count = 0;
+       *partitions = NULL;
        return errno;
 }
 
index 1cdeb443fcc5474498832bb1ebf7269b4f54319a..c9c1a19791956e2385f837888ef03dddf5b1cb8f 100644 (file)
@@ -32,7 +32,7 @@ int do_mmc (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
                if (mmc_legacy_init(dev) != 0) {
                        puts("No MMC card found\n");
-                       return 1;
+                       return CMD_RET_FAILURE;
                }
 
                curr_device = dev;
@@ -41,14 +41,14 @@ int do_mmc (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                if (argc == 2) {
                        if (curr_device < 0) {
                                puts("No MMC device available\n");
-                               return 1;
+                               return CMD_RET_FAILURE;
                        }
                } else if (argc == 3) {
                        dev = (int)simple_strtoul(argv[2], NULL, 10);
 
 #ifdef CONFIG_SYS_MMC_SET_DEV
                        if (mmc_set_dev(dev) != 0)
-                               return 1;
+                               return CMD_RET_FAILURE;
 #endif
                        curr_device = dev;
                } else {
@@ -60,7 +60,7 @@ int do_mmc (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                return CMD_RET_USAGE;
        }
 
-       return 0;
+       return CMD_RET_SUCCESS;
 }
 
 U_BOOT_CMD(
@@ -108,7 +108,7 @@ static int do_mmcinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                        curr_device = 0;
                else {
                        puts("No MMC device available\n");
-                       return 1;
+                       return CMD_RET_FAILURE;
                }
        }
 
@@ -118,10 +118,10 @@ static int do_mmcinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                mmc_init(mmc);
 
                print_mmcinfo(mmc);
-               return 0;
+               return CMD_RET_SUCCESS;
        } else {
                printf("no mmc device at slot %x\n", curr_device);
-               return 1;
+               return CMD_RET_FAILURE;
        }
 }
 
@@ -138,25 +138,20 @@ static int boot_part_access(struct mmc *mmc, u8 ack, u8 part_num, u8 access)
        err = mmc_boot_part_access(mmc, ack, part_num, access);
 
        if ((err == 0) && (access != 0)) {
-               printf("\t\t\t!!!Notice!!!\n");
+               printf("Notice!\n");
 
-               printf("!You must close EMMC boot Partition");
-               printf("after all images are written\n");
-
-               printf("!EMMC boot partition has continuity");
-               printf("at image writing time.\n");
-
-               printf("!So, do not close the boot partition");
-               printf("before all images are written.\n");
-               return 0;
+               printf("You must close EMMC boot Partition after all images are written\n");
+               printf("EMMC boot partition has continuity at image writing time.\n");
+               printf("So, do not close the boot partition before all images are written.\n");
+               return CMD_RET_SUCCESS;
        } else if ((err == 0) && (access == 0))
-               return 0;
+               return CMD_RET_SUCCESS;
        else if ((err != 0) && (access != 0)) {
                printf("EMMC boot partition-%d OPEN Failed.\n", part_num);
-               return 1;
+               return CMD_RET_FAILURE;
        } else {
                printf("EMMC boot partition-%d CLOSE Failed.\n", part_num);
-               return 1;
+               return CMD_RET_FAILURE;
        }
 }
 #endif
@@ -173,7 +168,7 @@ static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                        curr_device = 0;
                else {
                        puts("No MMC device available\n");
-                       return 1;
+                       return CMD_RET_FAILURE;
                }
        }
 
@@ -186,15 +181,15 @@ static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                mmc = find_mmc_device(curr_device);
                if (!mmc) {
                        printf("no mmc device at slot %x\n", curr_device);
-                       return 1;
+                       return CMD_RET_FAILURE;
                }
 
                mmc->has_init = 0;
 
                if (mmc_init(mmc))
-                       return 1;
+                       return CMD_RET_FAILURE;
                else
-                       return 0;
+                       return CMD_RET_SUCCESS;
        } else if (strncmp(argv[1], "part", 4) == 0) {
                block_dev_desc_t *mmc_dev;
                struct mmc *mmc;
@@ -205,23 +200,23 @@ static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                mmc = find_mmc_device(curr_device);
                if (!mmc) {
                        printf("no mmc device at slot %x\n", curr_device);
-                       return 1;
+                       return CMD_RET_FAILURE;
                }
                mmc_init(mmc);
                mmc_dev = mmc_get_dev(curr_device);
                if (mmc_dev != NULL &&
                                mmc_dev->type != DEV_TYPE_UNKNOWN) {
                        print_part(mmc_dev);
-                       return 0;
+                       return CMD_RET_SUCCESS;
                }
 
                puts("get mmc type error!\n");
-               return 1;
+               return CMD_RET_FAILURE;
        } else if (strcmp(argv[1], "list") == 0) {
                if (argc != 2)
                        return CMD_RET_USAGE;
                print_mmc_devices('\n');
-               return 0;
+               return CMD_RET_SUCCESS;
        } else if (strcmp(argv[1], "dev") == 0) {
                int dev, part = -1;
                struct mmc *mmc;
@@ -236,7 +231,7 @@ static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                        if (part > PART_ACCESS_MASK) {
                                printf("#part_num shouldn't be larger"
                                        " than %d\n", PART_ACCESS_MASK);
-                               return 1;
+                               return CMD_RET_FAILURE;
                        }
                } else
                        return CMD_RET_USAGE;
@@ -244,7 +239,7 @@ static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                mmc = find_mmc_device(dev);
                if (!mmc) {
                        printf("no mmc device at slot %x\n", dev);
-                       return 1;
+                       return CMD_RET_FAILURE;
                }
 
                mmc_init(mmc);
@@ -252,7 +247,7 @@ static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                        int ret;
                        if (mmc->part_config == MMCPART_NOAVAILABLE) {
                                printf("Card doesn't support part_switch\n");
-                               return 1;
+                               return CMD_RET_FAILURE;
                        }
 
                        if (part != mmc->part_num) {
@@ -271,7 +266,7 @@ static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                        printf("mmc%d(part %d) is current device\n",
                                curr_device, mmc->part_num);
 
-               return 0;
+               return CMD_RET_SUCCESS;
 #ifdef CONFIG_SUPPORT_EMMC_BOOT
        } else if ((strcmp(argv[1], "open") == 0) ||
                        (strcmp(argv[1], "close") == 0)) {
@@ -289,19 +284,19 @@ static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                mmc = find_mmc_device(dev);
                if (!mmc) {
                        printf("no mmc device at slot %x\n", dev);
-                       return 1;
+                       return CMD_RET_FAILURE;
                }
 
                if (IS_SD(mmc)) {
                        printf("SD device cannot be opened/closed\n");
-                       return 1;
+                       return CMD_RET_FAILURE;
                }
 
                if ((part_num <= 0) || (part_num > MMC_NUM_BOOT_PARTITION)) {
                        printf("Invalid boot partition number:\n");
                        printf("Boot partition number cannot be <= 0\n");
                        printf("EMMC44 supports only 2 boot partitions\n");
-                       return 1;
+                       return CMD_RET_FAILURE;
                }
 
                if (strcmp(argv[1], "open") == 0)
@@ -314,6 +309,10 @@ static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
        } else if (strcmp(argv[1], "bootpart") == 0) {
                int dev;
+
+               if (argc != 5)
+                       return CMD_RET_USAGE;
+
                dev = simple_strtoul(argv[2], NULL, 10);
 
                u32 bootsize = simple_strtoul(argv[3], NULL, 10);
@@ -321,22 +320,22 @@ static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                struct mmc *mmc = find_mmc_device(dev);
                if (!mmc) {
                        printf("no mmc device at slot %x\n", dev);
-                       return 1;
+                       return CMD_RET_FAILURE;
                }
 
                if (IS_SD(mmc)) {
                        printf("It is not a EMMC device\n");
-                       return 1;
+                       return CMD_RET_FAILURE;
                }
 
                if (0 == mmc_boot_partition_size_change(mmc,
                                                        bootsize, rpmbsize)) {
                        printf("EMMC boot partition Size %d MB\n", bootsize);
                        printf("EMMC RPMB partition Size %d MB\n", rpmbsize);
-                       return 0;
+                       return CMD_RET_SUCCESS;
                } else {
                        printf("EMMC boot partition Size change Failed.\n");
-                       return 1;
+                       return CMD_RET_FAILURE;
                }
 #endif /* CONFIG_SUPPORT_EMMC_BOOT */
        }
@@ -364,7 +363,7 @@ static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
                if (!mmc) {
                        printf("no mmc device at slot %x\n", curr_device);
-                       return 1;
+                       return CMD_RET_FAILURE;
                }
 
                printf("\nMMC %s: dev # %d, block # %d, count %d ... ",
@@ -375,7 +374,7 @@ static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                if ((state == MMC_WRITE || state == MMC_ERASE)) {
                        if (mmc_getwp(mmc) == 1) {
                                printf("Error: card is write protected!\n");
-                               return 1;
+                               return CMD_RET_FAILURE;
                        }
                }
 
index 4d2278d3c1e4ab05ee4909db3ded2b7d30479400..36a41056f60b5976fb67c08d982d85c93fdca4fe 100644 (file)
@@ -897,6 +897,12 @@ static inline void fb_put_word(uchar **fb, uchar **from)
 #endif
 #endif /* CONFIG_BMP_16BPP */
 
+static inline bmp_color_table_entry_t *get_color_table(bmp_image_t *bmp)
+{
+       bmp_header_t *bh = &bmp->header;
+       return (void *)bmp + offsetof(bmp_header_t, size) + bh->size;
+}
+
 int lcd_display_bitmap(ulong bmp_image, int x, int y)
 {
 #if !defined(CONFIG_MCC200)
@@ -912,6 +918,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
        unsigned long pwidth = panel_info.vl_col;
        unsigned long long colors;
        unsigned bpix, bmp_bpix;
+       bmp_color_table_entry_t *cte;
 
        if (!bmp || !(bmp->header.signature[0] == 'B' &&
                bmp->header.signature[1] == 'M')) {
@@ -946,6 +953,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
        debug("Display-bmp: %lu x %lu  with %llu colors\n",
                width, height, colors);
 
+       cte = get_color_table(bmp);
 #if !defined(CONFIG_MCC200)
        /* MCC200 LCD doesn't need CMAP, supports 1bpp b&w only */
        if (bmp_bpix == 8) {
@@ -954,12 +962,11 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 
                /* Set color map */
                for (i = 0; i < colors; ++i) {
-                       bmp_color_table_entry_t cte = bmp->color_table[i];
 #if !defined(CONFIG_ATMEL_LCD)
                        ushort colreg =
-                               ( ((cte.red)   << 8) & 0xf800) |
-                               ( ((cte.green) << 3) & 0x07e0) |
-                               ( ((cte.blue)  >> 3) & 0x001f) ;
+                               ( ((cte[i].red)   << 8) & 0xf800) |
+                               ( ((cte[i].green) << 3) & 0x07e0) |
+                               ( ((cte[i].blue)  >> 3) & 0x001f) ;
 #ifdef CONFIG_SYS_INVERT_COLORS
                        *cmap = 0xffff - colreg;
 #else
@@ -971,7 +978,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
                        cmap++;
 #endif
 #else /* CONFIG_ATMEL_LCD */
-                       lcd_setcolreg(i, cte.red, cte.green, cte.blue);
+                       lcd_setcolreg(i, cte[i].red, cte[i].green, cte[i].blue);
 #endif
                }
        }
@@ -1035,9 +1042,9 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
                                        int i = *bmap++;
 
                                        fb[3] = 0; /* T */
-                                       fb[0] = bmp->color_table[i].blue;
-                                       fb[1] = bmp->color_table[i].green;
-                                       fb[2] = bmp->color_table[i].red;
+                                       fb[0] = cte[i].blue;
+                                       fb[1] = cte[i].green;
+                                       fb[2] = cte[i].red;
                                        fb += sizeof(uint32_t) / sizeof(*fb);
                                } else if (bpix == 16) {
                                        *(uint16_t *)fb = cmap_base[*(bmap++)];
index b7524d68ba05b570e2286aeb208e2e15ab030f38..09c2e1b6717ff2d7ece2b7b3c4cf8b3fa84a8f90 100644 (file)
@@ -376,7 +376,7 @@ int gpt_fill_pte(gpt_header *gpt_h, gpt_entry *gpt_e,
                        offset += partitions[i].size;
                }
                if (offset >= gpt_h->last_usable_lba) {
-                       printf("Partitions layout exceds disk size\n");
+                       printf("Partitions layout exceeds disk size\n");
                        return -1;
                }
                /* partition ending lba */
index e6bf9dd3d10c43a118e4bfd04d0a69cb5e0ed3f3..070daa2ca9e6d6c228063de4b41effc142b6af8f 100644 (file)
 
 #if defined(WIN32)
 //#include <tchar.h>
-    
+
     // define this macro for use in VC++
     #if !defined(__LITTLE_ENDIAN__)
-        #define __LITTLE_ENDIAN__ 1
+       #define __LITTLE_ENDIAN__ 1
     #endif // !defined(__LITTLE_ENDIAN__)
 #endif // defined(WIN32)
 
@@ -27,7 +27,7 @@
 // For Linux systems only, types.h only defines the signed
 // integer types.  This is not professional code.
 // Update: They are defined in the header files in the more recent version of redhat enterprise gcc.
-#include "/usr/include/sys/types.h"
+#include <sys/types.h>
 #include <stdint.h>
 //typedef unsigned long uint32_t;
 //typedef unsigned short uint16_t;
@@ -38,7 +38,7 @@
 
     // give a default endian in case one is not defined on Linux (it should be, though)
     #if !defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__)
-        #define __LITTLE_ENDIAN__ 1
+       #define __LITTLE_ENDIAN__ 1
     #endif // !defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__)
 
 #endif // defined(Linux)
@@ -46,7 +46,7 @@
 // gcc on Mac OS X
 #if defined(__GNUC__) && ( defined(__APPLE_CPP__) || defined(__APPLE_CC__) || defined(__MACOS_CLASSIC__) )
        #include <TargetConditionals.h>
-       
+
        #if defined(TARGET_RT_LITTLE_ENDIAN) && TARGET_RT_LITTLE_ENDIAN
                #if !defined(__LITTLE_ENDIAN__)
                        #define __LITTLE_ENDIAN__