diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/Kconfig | 6 | ||||
-rw-r--r-- | common/board_f.c | 15 | ||||
-rw-r--r-- | common/board_r.c | 4 | ||||
-rw-r--r-- | common/fdt_support.c | 2 | ||||
-rw-r--r-- | common/image-fdt.c | 2 | ||||
-rw-r--r-- | common/image-fit.c | 29 | ||||
-rw-r--r-- | common/image.c | 34 | ||||
-rw-r--r-- | common/miiphyutil.c | 2 | ||||
-rw-r--r-- | common/scsi.c | 288 | ||||
-rw-r--r-- | common/spl/spl.c | 3 | ||||
-rw-r--r-- | common/spl/spl_mmc.c | 11 |
11 files changed, 217 insertions, 179 deletions
diff --git a/common/Kconfig b/common/Kconfig index 913d21a9ec5..a04ee1084fe 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -172,6 +172,12 @@ config BOOTDELAY menu "Console" +config MENU + bool + help + This is the library functionality to provide a text-based menu of + choices for the user to make choices with. + config CONSOLE_RECORD bool "Console recording" help diff --git a/common/board_f.c b/common/board_f.c index 4b7483503e2..cc8aee74f03 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -276,7 +276,7 @@ static int setup_mon_len(void) #elif defined(CONFIG_BLACKFIN) || defined(CONFIG_NIOS2) || \ defined(CONFIG_XTENSA) gd->mon_len = CONFIG_SYS_MONITOR_LEN; -#elif defined(CONFIG_NDS32) +#elif defined(CONFIG_NDS32) || defined(CONFIG_SH) gd->mon_len = (ulong)(&__bss_end) - (ulong)(&_start); #elif defined(CONFIG_SYS_MONITOR_BASE) /* TODO: use (ulong)&__bss_end - (ulong)&__text_start; ? */ @@ -619,7 +619,8 @@ static int display_new_sp(void) return 0; } -#if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_MIPS) +#if defined(CONFIG_M68K) || defined(CONFIG_MIPS) || defined(CONFIG_PPC) || \ + defined(CONFIG_SH) static int setup_board_part1(void) { bd_t *bd = gd->bd; @@ -884,7 +885,7 @@ static init_fnc_t init_sequence_f[] = { #endif #if defined(CONFIG_ARM) || defined(CONFIG_MIPS) || \ defined(CONFIG_BLACKFIN) || defined(CONFIG_NDS32) || \ - defined(CONFIG_SPARC) + defined(CONFIG_SH) || defined(CONFIG_SPARC) timer_init, /* initialize timer */ #endif #ifdef CONFIG_SYS_ALLOC_DPRAM @@ -921,7 +922,7 @@ static init_fnc_t init_sequence_f[] = { #if defined(CONFIG_MPC83xx) prt_83xx_rsr, #endif -#if defined(CONFIG_PPC) || defined(CONFIG_M68K) +#if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_SH) checkcpu, #endif print_cpuinfo, /* display cpu info (and speed) */ @@ -945,7 +946,8 @@ static init_fnc_t init_sequence_f[] = { announce_dram_init, /* TODO: unify all these dram functions? */ #if defined(CONFIG_ARM) || defined(CONFIG_X86) || defined(CONFIG_NDS32) || \ - defined(CONFIG_MICROBLAZE) || defined(CONFIG_AVR32) + defined(CONFIG_MICROBLAZE) || defined(CONFIG_AVR32) || \ + defined(CONFIG_SH) dram_init, /* configure available RAM banks */ #endif #if defined(CONFIG_MIPS) || defined(CONFIG_PPC) || defined(CONFIG_M68K) @@ -1023,7 +1025,8 @@ static init_fnc_t init_sequence_f[] = { reserve_stacks, setup_dram_config, show_dram_config, -#if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_MIPS) +#if defined(CONFIG_M68K) || defined(CONFIG_MIPS) || defined(CONFIG_PPC) || \ + defined(CONFIG_SH) setup_board_part1, #endif #if defined(CONFIG_PPC) || defined(CONFIG_M68K) diff --git a/common/board_r.c b/common/board_r.c index d959ad3c6f9..5496f45cbd9 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -191,7 +191,7 @@ static int initr_serial(void) return 0; } -#if defined(CONFIG_PPC) || defined(CONFIG_M68K) +#if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_MIPS) static int initr_trap(void) { /* @@ -807,7 +807,7 @@ init_fnc_t init_sequence_r[] = { #ifdef CONFIG_NEEDS_MANUAL_RELOC initr_manual_reloc_cmdtable, #endif -#if defined(CONFIG_PPC) || defined(CONFIG_M68K) +#if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_MIPS) initr_trap, #endif #ifdef CONFIG_ADDR_MAP diff --git a/common/fdt_support.c b/common/fdt_support.c index 0609470dfb8..c9f7019e38e 100644 --- a/common/fdt_support.c +++ b/common/fdt_support.c @@ -381,6 +381,7 @@ void do_fixup_by_compat_u32(void *fdt, const char *compat, do_fixup_by_compat(fdt, compat, prop, &tmp, 4, create); } +#ifdef CONFIG_ARCH_FIXUP_FDT_MEMORY /* * fdt_pack_reg - pack address and size array into the "reg"-suitable stream */ @@ -459,6 +460,7 @@ int fdt_fixup_memory_banks(void *blob, u64 start[], u64 size[], int banks) } return 0; } +#endif int fdt_fixup_memory(void *blob, u64 start, u64 size) { diff --git a/common/image-fdt.c b/common/image-fdt.c index 5454227fc99..e7540be8d63 100644 --- a/common/image-fdt.c +++ b/common/image-fdt.c @@ -474,12 +474,10 @@ int image_setup_libfdt(bootm_headers_t *images, void *blob, printf("ERROR: /chosen node create failed\n"); goto err; } -#ifdef CONFIG_ARCH_FIXUP_FDT if (arch_fixup_fdt(blob) < 0) { printf("ERROR: arch-specific fdt fixup failed\n"); goto err; } -#endif if (IMAGE_OF_BOARD_SETUP) { fdt_ret = ft_board_setup(blob, gd->bd); if (fdt_ret) { diff --git a/common/image-fit.c b/common/image-fit.c index 9468e519dbb..95d8bf4bb88 100644 --- a/common/image-fit.c +++ b/common/image-fit.c @@ -1513,12 +1513,6 @@ void fit_conf_print(const void *fit, int noffset, const char *p) static int fit_image_select(const void *fit, int rd_noffset, int verify) { -#if !defined(USE_HOSTCC) && defined(CONFIG_FIT_IMAGE_POST_PROCESS) - const void *data; - size_t size; - int ret; -#endif - fit_image_print(fit, rd_noffset, " "); if (verify) { @@ -1530,23 +1524,6 @@ static int fit_image_select(const void *fit, int rd_noffset, int verify) puts("OK\n"); } -#if !defined(USE_HOSTCC) && defined(CONFIG_FIT_IMAGE_POST_PROCESS) - ret = fit_image_get_data(fit, rd_noffset, &data, &size); - if (ret) - return ret; - - /* perform any post-processing on the image data */ - board_fit_image_post_process((void **)&data, &size); - - /* - * update U-Boot's understanding of the "data" property start address - * and size according to the performed post-processing - */ - ret = fdt_setprop((void *)fit, rd_noffset, FIT_DATA_PROP, data, size); - if (ret) - return ret; -#endif - return 0; } @@ -1755,6 +1732,12 @@ int fit_image_load(bootm_headers_t *images, ulong addr, bootstage_error(bootstage_id + BOOTSTAGE_SUB_GET_DATA); return -ENOENT; } + +#if !defined(USE_HOSTCC) && defined(CONFIG_FIT_IMAGE_POST_PROCESS) + /* perform any post-processing on the image data */ + board_fit_image_post_process((void **)&buf, &size); +#endif + len = (ulong)size; /* verify that image data is a proper FDT blob */ diff --git a/common/image.c b/common/image.c index 7604494a567..bd07e86701a 100644 --- a/common/image.c +++ b/common/image.c @@ -165,6 +165,7 @@ static const table_entry_t uimage_type[] = { { IH_TYPE_ZYNQIMAGE, "zynqimage", "Xilinx Zynq Boot Image" }, { IH_TYPE_ZYNQMPIMAGE, "zynqmpimage", "Xilinx ZynqMP Boot Image" }, { IH_TYPE_FPGA, "fpga", "FPGA Image" }, + { IH_TYPE_TEE, "tee", "Trusted Execution Environment Image",}, { -1, "", "", }, }; @@ -1389,6 +1390,23 @@ int boot_get_fpga(int argc, char * const argv[], bootm_headers_t *images, } #endif +static void fit_loadable_process(uint8_t img_type, + ulong img_data, + ulong img_len) +{ + int i; + const unsigned int count = + ll_entry_count(struct fit_loadable_tbl, fit_loadable); + struct fit_loadable_tbl *fit_loadable_handler = + ll_entry_start(struct fit_loadable_tbl, fit_loadable); + /* For each loadable handler */ + for (i = 0; i < count; i++, fit_loadable_handler++) + /* matching this type */ + if (fit_loadable_handler->type == img_type) + /* call that handler with this image data */ + fit_loadable_handler->handler(img_data, img_len); +} + int boot_get_loadable(int argc, char * const argv[], bootm_headers_t *images, uint8_t arch, const ulong *ld_start, ulong * const ld_len) { @@ -1407,6 +1425,7 @@ int boot_get_loadable(int argc, char * const argv[], bootm_headers_t *images, int conf_noffset; int fit_img_result; const char *uname; + uint8_t img_type; /* Check to see if the images struct has a FIT configuration */ if (!genimg_has_config(images)) { @@ -1447,6 +1466,21 @@ int boot_get_loadable(int argc, char * const argv[], bootm_headers_t *images, /* Something went wrong! */ return fit_img_result; } + + fit_img_result = fit_image_get_node(buf, uname); + if (fit_img_result < 0) { + /* Something went wrong! */ + return fit_img_result; + } + fit_img_result = fit_image_get_type(buf, + fit_img_result, + &img_type); + if (fit_img_result < 0) { + /* Something went wrong! */ + return fit_img_result; + } + + fit_loadable_process(img_type, img_data, img_len); } break; default: diff --git a/common/miiphyutil.c b/common/miiphyutil.c index d8ebb384dbf..aca18db52a0 100644 --- a/common/miiphyutil.c +++ b/common/miiphyutil.c @@ -135,7 +135,7 @@ void mdio_list_devices(void) struct phy_device *phydev = bus->phymap[i]; if (phydev) { - printf("%d - %s", i, phydev->drv->name); + printf("%x - %s", i, phydev->drv->name); if (phydev->dev) printf(" <--> %s\n", phydev->dev->name); diff --git a/common/scsi.c b/common/scsi.c index dbbf4043b22..04add624958 100644 --- a/common/scsi.c +++ b/common/scsi.c @@ -78,7 +78,8 @@ void scsi_setup_read16(ccb *pccb, lbaint_t start, unsigned long blocks) } #endif -void scsi_setup_read_ext(ccb *pccb, lbaint_t start, unsigned short blocks) +static void scsi_setup_read_ext(ccb *pccb, lbaint_t start, + unsigned short blocks) { pccb->cmd[0] = SCSI_READ10; pccb->cmd[1] = pccb->lun << 5; @@ -98,7 +99,8 @@ void scsi_setup_read_ext(ccb *pccb, lbaint_t start, unsigned short blocks) pccb->cmd[7], pccb->cmd[8]); } -void scsi_setup_write_ext(ccb *pccb, lbaint_t start, unsigned short blocks) +static void scsi_setup_write_ext(ccb *pccb, lbaint_t start, + unsigned short blocks) { pccb->cmd[0] = SCSI_WRITE10; pccb->cmd[1] = pccb->lun << 5; @@ -119,23 +121,7 @@ void scsi_setup_write_ext(ccb *pccb, lbaint_t start, unsigned short blocks) pccb->cmd[7], pccb->cmd[8]); } -void scsi_setup_read6(ccb *pccb, lbaint_t start, unsigned short blocks) -{ - pccb->cmd[0] = SCSI_READ6; - pccb->cmd[1] = pccb->lun << 5 | ((unsigned char)(start >> 16) & 0x1f); - pccb->cmd[2] = (unsigned char)(start >> 8) & 0xff; - pccb->cmd[3] = (unsigned char)start & 0xff; - pccb->cmd[4] = (unsigned char)blocks & 0xff; - pccb->cmd[5] = 0; - pccb->cmdlen = 6; - pccb->msgout[0] = SCSI_IDENTIFY; /* NOT USED */ - debug("scsi_setup_read6: cmd: %02X %02X startblk %02X%02X blccnt %02X\n", - pccb->cmd[0], pccb->cmd[1], - pccb->cmd[2], pccb->cmd[3], pccb->cmd[4]); -} - - -void scsi_setup_inquiry(ccb *pccb) +static void scsi_setup_inquiry(ccb *pccb) { pccb->cmd[0] = SCSI_INQUIRY; pccb->cmd[1] = pccb->lun << 5; @@ -161,43 +147,41 @@ static ulong scsi_read(struct blk_desc *block_dev, lbaint_t blknr, #ifdef CONFIG_BLK struct blk_desc *block_dev = dev_get_uclass_platdata(dev); #endif - int device = block_dev->devnum; lbaint_t start, blks; uintptr_t buf_addr; unsigned short smallblks = 0; ccb *pccb = (ccb *)&tempccb; - device &= 0xff; /* Setup device */ - pccb->target = scsi_dev_desc[device].target; - pccb->lun = scsi_dev_desc[device].lun; + pccb->target = block_dev->target; + pccb->lun = block_dev->lun; buf_addr = (unsigned long)buffer; start = blknr; blks = blkcnt; debug("\nscsi_read: dev %d startblk " LBAF ", blccnt " LBAF " buffer %lx\n", - device, start, blks, (unsigned long)buffer); + block_dev->devnum, start, blks, (unsigned long)buffer); do { pccb->pdata = (unsigned char *)buf_addr; #ifdef CONFIG_SYS_64BIT_LBA if (start > SCSI_LBA48_READ) { unsigned long blocks; blocks = min_t(lbaint_t, blks, SCSI_MAX_READ_BLK); - pccb->datalen = scsi_dev_desc[device].blksz * blocks; + pccb->datalen = block_dev->blksz * blocks; scsi_setup_read16(pccb, start, blocks); start += blocks; blks -= blocks; } else #endif if (blks > SCSI_MAX_READ_BLK) { - pccb->datalen = scsi_dev_desc[device].blksz * + pccb->datalen = block_dev->blksz * SCSI_MAX_READ_BLK; smallblks = SCSI_MAX_READ_BLK; scsi_setup_read_ext(pccb, start, smallblks); start += SCSI_MAX_READ_BLK; blks -= SCSI_MAX_READ_BLK; } else { - pccb->datalen = scsi_dev_desc[device].blksz * blks; + pccb->datalen = block_dev->blksz * blks; smallblks = (unsigned short)blks; scsi_setup_read_ext(pccb, start, smallblks); start += blks; @@ -236,33 +220,30 @@ static ulong scsi_write(struct blk_desc *block_dev, lbaint_t blknr, #ifdef CONFIG_BLK struct blk_desc *block_dev = dev_get_uclass_platdata(dev); #endif - int device = block_dev->devnum; lbaint_t start, blks; uintptr_t buf_addr; unsigned short smallblks; ccb *pccb = (ccb *)&tempccb; - device &= 0xff; - /* Setup device */ - pccb->target = scsi_dev_desc[device].target; - pccb->lun = scsi_dev_desc[device].lun; + pccb->target = block_dev->target; + pccb->lun = block_dev->lun; buf_addr = (unsigned long)buffer; start = blknr; blks = blkcnt; debug("\n%s: dev %d startblk " LBAF ", blccnt " LBAF " buffer %lx\n", - __func__, device, start, blks, (unsigned long)buffer); + __func__, block_dev->devnum, start, blks, (unsigned long)buffer); do { pccb->pdata = (unsigned char *)buf_addr; if (blks > SCSI_MAX_WRITE_BLK) { - pccb->datalen = (scsi_dev_desc[device].blksz * + pccb->datalen = (block_dev->blksz * SCSI_MAX_WRITE_BLK); smallblks = SCSI_MAX_WRITE_BLK; scsi_setup_write_ext(pccb, start, smallblks); start += SCSI_MAX_WRITE_BLK; blks -= SCSI_MAX_WRITE_BLK; } else { - pccb->datalen = scsi_dev_desc[device].blksz * blks; + pccb->datalen = block_dev->blksz * blks; smallblks = (unsigned short)blks; scsi_setup_write_ext(pccb, start, smallblks); start += blks; @@ -282,11 +263,6 @@ static ulong scsi_write(struct blk_desc *block_dev, lbaint_t blknr, return blkcnt; } -int scsi_get_disk_count(void) -{ - return scsi_max_devs; -} - #if defined(CONFIG_PCI) && !defined(CONFIG_SCSI_AHCI_PLAT) void scsi_init(void) { @@ -347,7 +323,8 @@ void scsi_init(void) /* copy src to dest, skipping leading and trailing blanks * and null terminate the string */ -void scsi_ident_cpy(unsigned char *dest, unsigned char *src, unsigned int len) +static void scsi_ident_cpy(unsigned char *dest, unsigned char *src, + unsigned int len) { int start, end; @@ -368,21 +345,8 @@ void scsi_ident_cpy(unsigned char *dest, unsigned char *src, unsigned int len) *dest = '\0'; } - -/* Trim trailing blanks, and NUL-terminate string - */ -void scsi_trim_trail(unsigned char *str, unsigned int len) -{ - unsigned char *p = str + len - 1; - - while (len-- > 0) { - *p-- = '\0'; - if (*p != ' ') - return; - } -} - -int scsi_read_capacity(ccb *pccb, lbaint_t *capacity, unsigned long *blksz) +static int scsi_read_capacity(ccb *pccb, lbaint_t *capacity, + unsigned long *blksz) { *capacity = 0; @@ -446,7 +410,7 @@ int scsi_read_capacity(ccb *pccb, lbaint_t *capacity, unsigned long *blksz) /* * Some setup (fill-in) routines */ -void scsi_setup_test_unit_ready(ccb *pccb) +static void scsi_setup_test_unit_ready(ccb *pccb) { pccb->cmd[0] = SCSI_TST_U_RDY; pccb->cmd[1] = pccb->lun << 5; @@ -458,103 +422,144 @@ void scsi_setup_test_unit_ready(ccb *pccb) pccb->msgout[0] = SCSI_IDENTIFY; /* NOT USED */ } -/* - * (re)-scan the scsi bus and reports scsi device info - * to the user if mode = 1 +/** + * scsi_init_dev_desc_priv - initialize only SCSI specific blk_desc properties + * + * @dev_desc: Block device description pointer + */ +static void scsi_init_dev_desc_priv(struct blk_desc *dev_desc) +{ + dev_desc->target = 0xff; + dev_desc->lun = 0xff; + dev_desc->log2blksz = + LOG2_INVALID(typeof(dev_desc->log2blksz)); + dev_desc->type = DEV_TYPE_UNKNOWN; + dev_desc->vendor[0] = 0; + dev_desc->product[0] = 0; + dev_desc->revision[0] = 0; + dev_desc->removable = false; +#ifndef CONFIG_BLK + dev_desc->block_read = scsi_read; + dev_desc->block_write = scsi_write; +#endif +} + +/** + * scsi_init_dev_desc - initialize all SCSI specific blk_desc properties + * + * @dev_desc: Block device description pointer + * @devnum: Device number + */ +static void scsi_init_dev_desc(struct blk_desc *dev_desc, int devnum) +{ + dev_desc->lba = 0; + dev_desc->blksz = 0; + dev_desc->if_type = IF_TYPE_SCSI; + dev_desc->devnum = devnum; + dev_desc->part_type = PART_TYPE_UNKNOWN; + + scsi_init_dev_desc_priv(dev_desc); +} + +/** + * scsi_detect_dev - Detect scsi device + * + * @target: target id + * @dev_desc: block device description + * + * The scsi_detect_dev detects and fills a dev_desc structure when the device is + * detected. The LUN number is taken from the struct blk_desc *dev_desc. + * + * Return: 0 on success, error value otherwise */ -void scsi_scan(int mode) +static int scsi_detect_dev(int target, struct blk_desc *dev_desc) { - unsigned char i, perq, modi, lun; + unsigned char perq, modi; lbaint_t capacity; unsigned long blksz; ccb *pccb = (ccb *)&tempccb; + pccb->target = target; + pccb->lun = dev_desc->lun; + pccb->pdata = (unsigned char *)&tempbuff; + pccb->datalen = 512; + scsi_setup_inquiry(pccb); + if (scsi_exec(pccb) != true) { + if (pccb->contr_stat == SCSI_SEL_TIME_OUT) { + /* + * selection timeout => assuming no + * device present + */ + debug("Selection timeout ID %d\n", + pccb->target); + return -ETIMEDOUT; + } + scsi_print_error(pccb); + return -ENODEV; + } + perq = tempbuff[0]; + modi = tempbuff[1]; + if ((perq & 0x1f) == 0x1f) + return -ENODEV; /* skip unknown devices */ + if ((modi & 0x80) == 0x80) /* drive is removable */ + dev_desc->removable = true; + /* get info for this device */ + scsi_ident_cpy((unsigned char *)dev_desc->vendor, + &tempbuff[8], 8); + scsi_ident_cpy((unsigned char *)dev_desc->product, + &tempbuff[16], 16); + scsi_ident_cpy((unsigned char *)dev_desc->revision, + &tempbuff[32], 4); + dev_desc->target = pccb->target; + dev_desc->lun = pccb->lun; + + pccb->datalen = 0; + scsi_setup_test_unit_ready(pccb); + if (scsi_exec(pccb) != true) { + if (dev_desc->removable) { + dev_desc->type = perq; + goto removable; + } + scsi_print_error(pccb); + return -EINVAL; + } + if (scsi_read_capacity(pccb, &capacity, &blksz)) { + scsi_print_error(pccb); + return -EINVAL; + } + dev_desc->lba = capacity; + dev_desc->blksz = blksz; + dev_desc->log2blksz = LOG2(dev_desc->blksz); + dev_desc->type = perq; + part_init(&dev_desc[0]); +removable: + return 0; +} + +/* + * (re)-scan the scsi bus and reports scsi device info + * to the user if mode = 1 + */ +int scsi_scan(int mode) +{ + unsigned char i, lun; + int ret; + if (mode == 1) printf("scanning bus for devices...\n"); - for (i = 0; i < CONFIG_SYS_SCSI_MAX_DEVICE; i++) { - scsi_dev_desc[i].target = 0xff; - scsi_dev_desc[i].lun = 0xff; - scsi_dev_desc[i].lba = 0; - scsi_dev_desc[i].blksz = 0; - scsi_dev_desc[i].log2blksz = - LOG2_INVALID(typeof(scsi_dev_desc[i].log2blksz)); - scsi_dev_desc[i].type = DEV_TYPE_UNKNOWN; - 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].if_type = IF_TYPE_SCSI; - scsi_dev_desc[i].devnum = i; - scsi_dev_desc[i].part_type = PART_TYPE_UNKNOWN; -#ifndef CONFIG_BLK - scsi_dev_desc[i].block_read = scsi_read; - scsi_dev_desc[i].block_write = scsi_write; -#endif - } + for (i = 0; i < CONFIG_SYS_SCSI_MAX_DEVICE; i++) + scsi_init_dev_desc(&scsi_dev_desc[i], i); + scsi_max_devs = 0; for (i = 0; i < CONFIG_SYS_SCSI_MAX_SCSI_ID; i++) { - pccb->target = i; for (lun = 0; lun < CONFIG_SYS_SCSI_MAX_LUN; lun++) { - pccb->lun = lun; - pccb->pdata = (unsigned char *)&tempbuff; - pccb->datalen = 512; - scsi_setup_inquiry(pccb); - if (scsi_exec(pccb) != true) { - if (pccb->contr_stat == SCSI_SEL_TIME_OUT) { - /* - * selection timeout => assuming no - * device present - */ - debug("Selection timeout ID %d\n", - pccb->target); - continue; - } - scsi_print_error(pccb); - continue; - } - perq = tempbuff[0]; - modi = tempbuff[1]; - if ((perq & 0x1f) == 0x1f) - continue; /* skip unknown devices */ - if ((modi & 0x80) == 0x80) /* drive is removable */ - 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); - scsi_ident_cpy((unsigned char *)&scsi_dev_desc - [scsi_max_devs].product[0], - &tempbuff[16], 16); - scsi_ident_cpy((unsigned char *)&scsi_dev_desc - [scsi_max_devs].revision[0], - &tempbuff[32], 4); - scsi_dev_desc[scsi_max_devs].target = pccb->target; - scsi_dev_desc[scsi_max_devs].lun = pccb->lun; - - pccb->datalen = 0; - scsi_setup_test_unit_ready(pccb); - if (scsi_exec(pccb) != true) { - if (scsi_dev_desc[scsi_max_devs].removable) { - scsi_dev_desc[scsi_max_devs].type = - perq; - goto removable; - } - scsi_print_error(pccb); - continue; - } - if (scsi_read_capacity(pccb, &capacity, &blksz)) { - scsi_print_error(pccb); + scsi_dev_desc[scsi_max_devs].lun = lun; + ret = scsi_detect_dev(i, &scsi_dev_desc[scsi_max_devs]); + if (ret) continue; - } - scsi_dev_desc[scsi_max_devs].lba = capacity; - scsi_dev_desc[scsi_max_devs].blksz = blksz; - scsi_dev_desc[scsi_max_devs].log2blksz = - LOG2(scsi_dev_desc[scsi_max_devs].blksz); - scsi_dev_desc[scsi_max_devs].type = perq; - part_init(&scsi_dev_desc[scsi_max_devs]); -removable: + if (mode == 1) { - printf(" Device %d: ", scsi_max_devs); + printf(" Device %d: ", 0); dev_print(&scsi_dev_desc[scsi_max_devs]); } /* if mode */ scsi_max_devs++; @@ -569,6 +574,7 @@ removable: #ifndef CONFIG_SPL_BUILD setenv_ulong("scsidevs", scsi_max_devs); #endif + return 0; } #ifdef CONFIG_BLK diff --git a/common/spl/spl.c b/common/spl/spl.c index 32b9f1e95cd..9bcbd09ff38 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -513,6 +513,9 @@ ulong spl_relocate_stack_gd(void) ptr = CONFIG_SPL_STACK_R_ADDR - roundup(sizeof(gd_t),16); new_gd = (gd_t *)ptr; memcpy(new_gd, (void *)gd, sizeof(gd_t)); +#if CONFIG_IS_ENABLED(DM) + dm_fixup_for_gd_move(new_gd); +#endif #if !defined(CONFIG_ARM) gd = new_gd; #endif diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c index 0b681c23de9..58b061f76ba 100644 --- a/common/spl/spl_mmc.c +++ b/common/spl/spl_mmc.c @@ -272,8 +272,8 @@ static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image, struct mmc *mmc) } #endif -static int spl_mmc_load_image(struct spl_image_info *spl_image, - struct spl_boot_device *bootdev) +int spl_mmc_load_image(struct spl_image_info *spl_image, + struct spl_boot_device *bootdev) { struct mmc *mmc = NULL; u32 boot_mode; @@ -306,7 +306,11 @@ static int spl_mmc_load_image(struct spl_image_info *spl_image, if (part == 7) part = 0; - err = blk_dselect_hwpart(mmc_get_blk_desc(mmc), part); + if (CONFIG_IS_ENABLED(MMC_TINY)) + err = mmc_switch_part(mmc, part); + else + err = blk_dselect_hwpart(mmc_get_blk_desc(mmc), part); + if (err) { #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT puts("spl: mmc partition switch failed\n"); @@ -342,7 +346,6 @@ static int spl_mmc_load_image(struct spl_image_info *spl_image, return err; break; - case MMCSD_MODE_UNDEFINED: #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT default: puts("spl: mmc: wrong boot mode\n"); |