Re: [U-Boot] ** Can't read Driver Desriptor Block **
On 09/04/2017 05:59 AM, Bin Meng wrote: > Hi Heinrich, > > On Fri, Sep 1, 2017 at 1:24 AM, Heinrich Schuchardt> wrote: >> On 08/31/2017 02:55 PM, Bin Meng wrote: >>> Hi Simon, >>> >>> On Thu, Aug 31, 2017 at 8:52 PM, Simon Glass wrote: Hi Bin, On 31 August 2017 at 10:53, Bin Meng wrote: > Hi Heinrich, > > On Thu, Aug 31, 2017 at 5:19 AM, Heinrich Schuchardt > wrote: >> On 08/30/2017 06:37 AM, Heinrich Schuchardt wrote: >>> >>> >>> On 08/30/2017 03:54 AM, Bin Meng wrote: Hi Heinrich, On Wed, Aug 30, 2017 at 4:26 AM, Heinrich Schuchardt wrote: > Hello Simon, > > U-Boot HEAD qemu-86_defconfig cannot discover an IDE disk with one FAT > partition in qemu-system-x86_64. > > By bisection I found this patch. > > b7c6baef2891ce8978cbfddb66e944943473ac21 > x86: Convert MMC to driver model > > With this patch I get > > IDE: Bus 0: OK Bus 1: OK > Device 0: Model: QEMU HARDDISK Firm: 2.5+ Ser#: QM1 > Type: Hard Disk > Supports 48-bit addressing > Capacity: 128.0 MB = 0.1 GB (262144 x 512) > ** Can't read Driver Desriptor Block ** > Device 1: not available > Device 2: Model: QEMU Firm: 2.5+ Ser#: QEMU DVD-ROM > Type: Removable CD ROM > Capacity: not available > Device 3: not available > > => ide info > => > > Without the patch I get=> ide info > Device 0: Model: QEMU HARDDISK Firm: 2.5+ Ser#: QM1 > Type: Hard Disk > Supports 48-bit addressing > Capacity: 128.0 MB = 0.1 GB (262144 x 512) > Device 2: Model: QEMU Firm: 2.5+ Ser#: QEMU DVD-ROM > Type: Removable CD ROM > Capacity: not available > > I think we observe two independent errors here: > > - The hard disk Device 0 is not read. > - The ide command stops at the first device that is not available. > > I guess only the first is caused by your patch. Both logs look fine to me. The "Can't read Driver Desriptor Block" comes from part_mac.c. Did you verify the actual IDE read/write fails with current HEAD? Regards, Bin >>> >>> Hello Bin, >>> >>> I have not checked block level read but used the shell commands for >>> testing. >>> >>> Before the patch I can read the directory of the drive: >>> >>> => ide info >>> Device 0: Model: QEMU HARDDISK Firm: 2.5+ Ser#: QM1 >>> Type: Hard Disk >>> Supports 48-bit addressing >>> Capacity: 128.0 MB = 0.1 GB (262144 x 512) >>> Device 2: Model: QEMU Firm: 2.5+ Ser#: QEMU DVD-ROM >>> Type: Removable CD ROM >>> Capacity: not available >>> => fat2ls ide 0:1 >>> Unknown command 'fat2ls' - try 'help' >>> => fatls ide 0:1 >>>164768 snp.efi >>> 0 file1 >>> 0 file2 >>> >>> >>> After the patch (including HEAD) I cannot read the directory and cannot >>> load the file snp.efi either: >>> >>> => ide info >>> => fatls ide 0:1 >>> ** Bad device ide 0 ** >>> => >>> => fatls mmc 0:1 >>> ** Bad device mmc 0 ** >>> >>> >>> In both cases I have loaded the same image with: >>> >>> export BUILD_ROM=y >>> make distclean && make qemu-x86_defconfig && make -j6 >>> >>> qemu-system-x86_64 -m 1G -bios u-boot.rom -nographic \ >>> -netdev \ >>> user,id=eth0,tftp=tftp,net=192.168.76.0/24,dhcpstart=192.168.76.9 \ >>> -device e1000,netdev=eth0 -machine pc-i440fx-2.8 -hda img >>> >>> Best regards >>> >>> Heinrich >>> >> >> Hello Bin, hello Simon, >> >> I think the bug is in functions ide_init (drivers/block/ide.c). >> >> Platform X86 implies CONFIG_BLK=y. >> >> So we should initialize ide_dev_desc[i].bdev. >> >> We don't, so blk_dread fails after finding no read operation with ENOSYS >> when called from part_test_dos. >> >> The following comment in include/blk.h confirms that bdev has to be >> filled: >> >> #if CONFIG_IS_ENABLED(BLK) >> /* >> * For now we have a few functions which take struct blk_desc as a >> * parameter. This field allows them to look up the associated >> * device. Once these functions are removed we can drop this field. >> */ >> struct udevice *bdev; >> #else >> >> I assume that we have the same issue in in __sata_initialize >>
[U-Boot] [next PATCH v2 1/2] ARM: mvebu: Add SoC IDs for Marvell's integrated CPUs
These SoCs are network packet processors (switch chips) with integrated ARMv7 cores. They share a great deal of commonality with the Armada-XP CPUs. Signed-off-by: Chris Packham--- There are actually a number of IDs for these chips, probably a dozen in total. I haven't enumerated them all in this patch, the 98DX4251, 98DX3336 and 98DX3236 are the base versions in their respective ranges. These 3 IDs also happen to suit my immediate need but I can add the additional ones in an follow up patch or a re-roll of this one. Changes in v2: - none arch/arm/mach-mvebu/cpu.c | 14 ++ arch/arm/mach-mvebu/include/mach/cpu.h | 1 + arch/arm/mach-mvebu/include/mach/soc.h | 3 +++ 3 files changed, 18 insertions(+) diff --git a/arch/arm/mach-mvebu/cpu.c b/arch/arm/mach-mvebu/cpu.c index 14457317ce76..f7f83bfa3655 100644 --- a/arch/arm/mach-mvebu/cpu.c +++ b/arch/arm/mach-mvebu/cpu.c @@ -62,6 +62,11 @@ int mvebu_soc_family(void) case SOC_88F6820_ID: case SOC_88F6828_ID: return MVEBU_SOC_A38X; + + case SOC_98DX3236_ID: + case SOC_98DX3336_ID: + case SOC_98DX4251_ID: + return MVEBU_SOC_MSYS; } return MVEBU_SOC_UNKNOWN; @@ -208,6 +213,15 @@ int print_cpuinfo(void) case SOC_88F6828_ID: puts("MV88F6828-"); break; + case SOC_98DX3236_ID: + puts("98DX3236-"); + break; + case SOC_98DX3336_ID: + puts("98DX3336-"); + break; + case SOC_98DX4251_ID: + puts("98DX4251-"); + break; default: puts("Unknown-"); break; diff --git a/arch/arm/mach-mvebu/include/mach/cpu.h b/arch/arm/mach-mvebu/include/mach/cpu.h index d241eea9568d..b67b77ae0df4 100644 --- a/arch/arm/mach-mvebu/include/mach/cpu.h +++ b/arch/arm/mach-mvebu/include/mach/cpu.h @@ -65,6 +65,7 @@ enum { MVEBU_SOC_AXP, MVEBU_SOC_A375, MVEBU_SOC_A38X, + MVEBU_SOC_MSYS, MVEBU_SOC_UNKNOWN, }; diff --git a/arch/arm/mach-mvebu/include/mach/soc.h b/arch/arm/mach-mvebu/include/mach/soc.h index 0900e4008c12..cdd64fb28527 100644 --- a/arch/arm/mach-mvebu/include/mach/soc.h +++ b/arch/arm/mach-mvebu/include/mach/soc.h @@ -18,6 +18,9 @@ #define SOC_88F6810_ID 0x6810 #define SOC_88F6820_ID 0x6820 #define SOC_88F6828_ID 0x6828 +#define SOC_98DX3236_ID0xf410 +#define SOC_98DX3336_ID0xf400 +#define SOC_98DX4251_ID0xfc00 /* A375 revisions */ #define MV_88F67XX_A0_ID 0x3 -- 2.14.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [next PATCH v2 2/2] ARM: mvebu: add additional information to board_add_ram_info()
From: Joshua ScottDisplay more information about the current RAM configuration. With these changes the output on a 88F6820 board is SoC: MV88F6820-A0 at 1600 MHz DRAM: 2 GiB (800 MHz, 32-bit, ECC not enabled) Signed-off-by: Joshua Scott Signed-off-by: Chris Packham --- One of the hardware designers at $dayjob expressed a desire to keep track of various tweaks to the DDR setup during hardware debugging sessions. This is the result. I've based this on what is available for the fsl platforms. It might be nice to add a few more things but I'm concious of keeping the information relevant and succinct. Changes in v2: - A375 and A38x have 16/32b DDR bus arch/arm/mach-mvebu/dram.c | 45 + 1 file changed, 45 insertions(+) diff --git a/arch/arm/mach-mvebu/dram.c b/arch/arm/mach-mvebu/dram.c index e3f304c36683..55e9ad726a88 100644 --- a/arch/arm/mach-mvebu/dram.c +++ b/arch/arm/mach-mvebu/dram.c @@ -216,6 +216,35 @@ static int ecc_enabled(void) return 0; } + +/* Return the width of the DRAM bus, or 0 for unknown. */ +static int bus_width(void) +{ + int full_width = 0; + + if (reg_read(REG_SDRAM_CONFIG_ADDR) & (1 << REG_SDRAM_CONFIG_WIDTH_OFFS)) + full_width = 1; + + switch (mvebu_soc_family()) { + case MVEBU_SOC_AXP: + return full_width ? 64 : 32; + break; + case MVEBU_SOC_A375: + case MVEBU_SOC_A38X: + case MVEBU_SOC_MSYS: + return full_width ? 32 : 16; + default: + return 0; + } +} + +static int cycle_mode(void) +{ + int val = reg_read(REG_DUNIT_CTRL_LOW_ADDR); + + return (val >> REG_DUNIT_CTRL_LOW_2T_OFFS) & REG_DUNIT_CTRL_LOW_2T_MASK; +} + #else static void dram_ecc_scrubbing(void) { @@ -295,10 +324,26 @@ int dram_init_banksize(void) void board_add_ram_info(int use_default) { struct sar_freq_modes sar_freq; + int mode; + int width; get_sar_freq(_freq); printf(" (%d MHz, ", sar_freq.d_clk); + width = bus_width(); + if (width) + printf("%d-bit, ", width); + + mode = cycle_mode(); + /* Mode 0 = Single cycle +* Mode 1 = Two cycles (2T) +* Mode 2 = Three cycles (3T) +*/ + if (mode == 1) + printf("2T, "); + if (mode == 2) + printf("3T, "); + if (ecc_enabled()) printf("ECC"); else -- 2.14.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v3 1/1] usb: gadget: g_dnl: Sync internal SN variable with env
Hello Lukasz, Am 02.09.2017 um 13:08 schrieb Łukasz Majewski: Hi Heiko, Would you find some time and run this patch through your test setup? Thanks in advance. Of course, as it is automated ;-) Okay, I had to add an oneliner, to say tbot, which patchwork patch it has to download... for the records see [1]. Here the results for the smartweb board (in short, my dfu test are working with this patch): http://xeidos.ddns.net/tests/test_db_auslesen.php#408 Logs: http://xeidos.ddns.net/tbot/id_408/html_log.html Especially the steps: (download patchwork patch, check with checkpatch, apply to mainline): http://xeidos.ddns.net/tbot/id_408/html_log.html#92 http://xeidos.ddns.net/tbot/id_408/html_log.html#95 http://xeidos.ddns.net/tbot/id_408/html_log.html#98 and the dfu test: http://xeidos.ddns.net/tbot/id_408/html_log.html#398 http://xeidos.ddns.net/tbot/id_408/html_log.html#409 http://xeidos.ddns.net/tbot/id_408/html_log.html#413 http://xeidos.ddns.net/tbot/id_408/html_log.html#417 My browser (firefox) seems to have problems with jumping to the correct "id"s in the html file ... Hope you can find the logs, if not, look into the raw logfile: http://xeidos.ddns.net/tbot/id_408/tbot.txt but this is not very comfortable ... So, please add my: Tested-by: Heiko Schocherbye, Heiko [1] tbot patch for adding a patchworkpatch root@raspberrypi:/home/pi/data/tbot# git diff diff --git a/config/smartweb.py b/config/smartweb.py index 72a7972..98c8e0f 100644 --- a/config/smartweb.py +++ b/config/smartweb.py @@ -37,6 +37,8 @@ tc_workfd_apply_patchwork_patches_list_hand = [ ] tc_workfd_apply_patchwork_patches_blacklist = ['204183', '561384'] +tc_workfd_apply_patchwork_patches_list = ['808671'] + uboot_get_parameter_file_list = ['.config', 'include/configs/smartweb.h', 'arch/arm/mach-at91/include/mach/at91sam9260.h'] tc_workfd_set_toolchain_arch = 'arm' root@raspberrypi:/home/pi/data/tbot# -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 01/19] configs: Add FPGA loadfs config for Arria 10
On Rab, 2017-08-30 at 10:45 +0200, Marek Vasut wrote: > On 08/30/2017 07:59 AM, Chee, Tien Fong wrote: > > > > On Sel, 2017-08-29 at 13:51 +0200, Marek Vasut wrote: > > > > > > On 08/29/2017 12:45 PM, tien.fong.c...@intel.com wrote: > > > > > > > > > > > > From: Tien Fong Chee> > > > > > > > This config allow FPGA design loaded from FAT fs to FPGA > > > > manager. > > > > > > > > Signed-off-by: Tien Fong Chee > > > > --- > > > > configs/socfpga_arria10_defconfig |1 + > > > > 1 files changed, 1 insertions(+), 0 deletions(-) > > > > > > > > diff --git a/configs/socfpga_arria10_defconfig > > > > b/configs/socfpga_arria10_defconfig > > > > index 53ab66f..d555743 100644 > > > > --- a/configs/socfpga_arria10_defconfig > > > > +++ b/configs/socfpga_arria10_defconfig > > > > @@ -29,3 +29,4 @@ CONFIG_DWAPB_GPIO=y > > > > CONFIG_DM_MMC=y > > > > CONFIG_SYS_NS16550=y > > > > CONFIG_USE_TINY_PRINTF=y > > > > +CONFIG_CMD_FPGA_LOADFS=y > > > You should enable stuff only after you add the necessary support > > > bits > > > ... > > > > > I enabled it as early as possible, because i would like to use > > compiling for detecting any code errors while adding the > > neccesssary > > support bits. I can rearrange the patches sequence. > > > Except you enable feature which cannot work, so this is wrong. If you > need this for debugging purposes, great, but in the series it should > go > after the groundwork is laid. > Okay, i will reorder the series of patches. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 3/4] block: ide: Don't bother to create BLK device if no CDROM inserted
When there is no CDROM inserted, the block size is zero hence there is no need to create a BLK device for it. Signed-off-by: Bin Meng--- drivers/block/ide.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/block/ide.c b/drivers/block/ide.c index 58b295e..8125ff8 100644 --- a/drivers/block/ide.c +++ b/drivers/block/ide.c @@ -1197,6 +1197,13 @@ static int ide_probe(struct udevice *udev) blksz = ide_dev_desc[i].blksz; size = blksz * ide_dev_desc[i].lba; + + /* +* With CDROM, if there is no CD inserted, blksz will +* be zero, don't bother to create IDE block device. +*/ + if (!blksz) + continue; ret = blk_create_devicef(udev, "ide_blk", name, IF_TYPE_IDE, i, blksz, size, _dev); -- 2.9.2 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 2/4] block: ide: Fix block read/write with driver model
This converts the IDE driver to driver model so that block read and write are fully functional. Fixes: b7c6baef ("x86: Convert MMC to driver model") Reported-by: Heinrich SchuchardtSigned-off-by: Bin Meng --- drivers/block/ide.c| 68 ++ include/dm/uclass-id.h | 1 + 2 files changed, 69 insertions(+) diff --git a/drivers/block/ide.c b/drivers/block/ide.c index ce51153..58b295e 100644 --- a/drivers/block/ide.c +++ b/drivers/block/ide.c @@ -827,12 +827,20 @@ void ide_init(void) ide_ident(_dev_desc[i]); dev_print(_dev_desc[i]); +#ifndef CONFIG_BLK if ((ide_dev_desc[i].lba > 0) && (ide_dev_desc[i].blksz > 0)) { /* initialize partition type */ part_init(_dev_desc[i]); } +#endif } WATCHDOG_RESET(); + +#ifdef CONFIG_BLK + struct udevice *dev; + + uclass_first_device(UCLASS_IDE, ); +#endif } /* We only need to swap data if we are running on a big endian cpu. */ @@ -1147,6 +1155,21 @@ int ide_device_present(int dev) #endif #ifdef CONFIG_BLK +static int ide_blk_probe(struct udevice *udev) +{ + struct blk_desc *desc = dev_get_uclass_platdata(udev); + int devnum = desc->devnum; + + /* fill in device vendor/product/rev strings */ + strncpy(desc->vendor, ide_dev_desc[devnum].vendor, BLK_VEN_SIZE); + strncpy(desc->product, ide_dev_desc[devnum].product, BLK_PRD_SIZE); + strncpy(desc->revision, ide_dev_desc[devnum].revision, BLK_REV_SIZE); + + part_init(desc); + + return 0; +} + static const struct blk_ops ide_blk_ops = { .read = ide_read, .write = ide_write, @@ -1156,6 +1179,51 @@ U_BOOT_DRIVER(ide_blk) = { .name = "ide_blk", .id = UCLASS_BLK, .ops= _blk_ops, + .probe = ide_blk_probe, +}; + +static int ide_probe(struct udevice *udev) +{ + struct udevice *blk_dev; + char name[20]; + int blksz; + lbaint_t size; + int i; + int ret; + + for (i = 0; i < CONFIG_SYS_IDE_MAXDEVICE; i++) { + if (ide_dev_desc[i].type != DEV_TYPE_UNKNOWN) { + sprintf(name, "blk#%d", i); + + blksz = ide_dev_desc[i].blksz; + size = blksz * ide_dev_desc[i].lba; + ret = blk_create_devicef(udev, "ide_blk", name, +IF_TYPE_IDE, i, +blksz, size, _dev); + if (ret) + return ret; + } + } + + return 0; +} + +U_BOOT_DRIVER(ide) = { + .name = "ide", + .id = UCLASS_IDE, + .probe = ide_probe, +}; + +struct pci_device_id ide_supported[] = { + { PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_IDE << 8, 0x00) }, + { } +}; + +U_BOOT_PCI_DEVICE(ide, ide_supported); + +UCLASS_DRIVER(ide) = { + .name = "ide", + .id = UCLASS_IDE, }; #else U_BOOT_LEGACY_BLK(ide) = { diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h index 1a50199..3fc2083 100644 --- a/include/dm/uclass-id.h +++ b/include/dm/uclass-id.h @@ -41,6 +41,7 @@ enum uclass_id { UCLASS_I2C_EEPROM, /* I2C EEPROM device */ UCLASS_I2C_GENERIC, /* Generic I2C device */ UCLASS_I2C_MUX, /* I2C multiplexer */ + UCLASS_IDE, /* IDE device */ UCLASS_IRQ, /* Interrupt controller */ UCLASS_KEYBOARD,/* Keyboard input device */ UCLASS_LED, /* Light-emitting diode (LED) */ -- 2.9.2 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] ** Can't read Driver Desriptor Block **
Hi Heinrich, On Fri, Sep 1, 2017 at 1:24 AM, Heinrich Schuchardtwrote: > On 08/31/2017 02:55 PM, Bin Meng wrote: >> Hi Simon, >> >> On Thu, Aug 31, 2017 at 8:52 PM, Simon Glass wrote: >>> Hi Bin, >>> >>> On 31 August 2017 at 10:53, Bin Meng wrote: Hi Heinrich, On Thu, Aug 31, 2017 at 5:19 AM, Heinrich Schuchardt wrote: > On 08/30/2017 06:37 AM, Heinrich Schuchardt wrote: >> >> >> On 08/30/2017 03:54 AM, Bin Meng wrote: >>> Hi Heinrich, >>> >>> On Wed, Aug 30, 2017 at 4:26 AM, Heinrich Schuchardt >>> wrote: Hello Simon, U-Boot HEAD qemu-86_defconfig cannot discover an IDE disk with one FAT partition in qemu-system-x86_64. By bisection I found this patch. b7c6baef2891ce8978cbfddb66e944943473ac21 x86: Convert MMC to driver model With this patch I get IDE: Bus 0: OK Bus 1: OK Device 0: Model: QEMU HARDDISK Firm: 2.5+ Ser#: QM1 Type: Hard Disk Supports 48-bit addressing Capacity: 128.0 MB = 0.1 GB (262144 x 512) ** Can't read Driver Desriptor Block ** Device 1: not available Device 2: Model: QEMU Firm: 2.5+ Ser#: QEMU DVD-ROM Type: Removable CD ROM Capacity: not available Device 3: not available => ide info => Without the patch I get=> ide info Device 0: Model: QEMU HARDDISK Firm: 2.5+ Ser#: QM1 Type: Hard Disk Supports 48-bit addressing Capacity: 128.0 MB = 0.1 GB (262144 x 512) Device 2: Model: QEMU Firm: 2.5+ Ser#: QEMU DVD-ROM Type: Removable CD ROM Capacity: not available I think we observe two independent errors here: - The hard disk Device 0 is not read. - The ide command stops at the first device that is not available. I guess only the first is caused by your patch. >>> >>> Both logs look fine to me. The "Can't read Driver Desriptor Block" >>> comes from part_mac.c. Did you verify the actual IDE read/write fails >>> with current HEAD? >>> >>> Regards, >>> Bin >>> >> >> Hello Bin, >> >> I have not checked block level read but used the shell commands for >> testing. >> >> Before the patch I can read the directory of the drive: >> >> => ide info >> Device 0: Model: QEMU HARDDISK Firm: 2.5+ Ser#: QM1 >> Type: Hard Disk >> Supports 48-bit addressing >> Capacity: 128.0 MB = 0.1 GB (262144 x 512) >> Device 2: Model: QEMU Firm: 2.5+ Ser#: QEMU DVD-ROM >> Type: Removable CD ROM >> Capacity: not available >> => fat2ls ide 0:1 >> Unknown command 'fat2ls' - try 'help' >> => fatls ide 0:1 >>164768 snp.efi >> 0 file1 >> 0 file2 >> >> >> After the patch (including HEAD) I cannot read the directory and cannot >> load the file snp.efi either: >> >> => ide info >> => fatls ide 0:1 >> ** Bad device ide 0 ** >> => >> => fatls mmc 0:1 >> ** Bad device mmc 0 ** >> >> >> In both cases I have loaded the same image with: >> >> export BUILD_ROM=y >> make distclean && make qemu-x86_defconfig && make -j6 >> >> qemu-system-x86_64 -m 1G -bios u-boot.rom -nographic \ >> -netdev \ >> user,id=eth0,tftp=tftp,net=192.168.76.0/24,dhcpstart=192.168.76.9 \ >> -device e1000,netdev=eth0 -machine pc-i440fx-2.8 -hda img >> >> Best regards >> >> Heinrich >> > > Hello Bin, hello Simon, > > I think the bug is in functions ide_init (drivers/block/ide.c). > > Platform X86 implies CONFIG_BLK=y. > > So we should initialize ide_dev_desc[i].bdev. > > We don't, so blk_dread fails after finding no read operation with ENOSYS > when called from part_test_dos. > > The following comment in include/blk.h confirms that bdev has to be > filled: > > #if CONFIG_IS_ENABLED(BLK) > /* > * For now we have a few functions which take struct blk_desc as a > * parameter. This field allows them to look up the associated > * device. Once these functions are removed we can drop this field. > */ > struct udevice *bdev; > #else > > I assume that we have the same issue in in __sata_initialize > (drivers/ata/sata.c) but have not tested. > Thanks for the testing! Simon, are you going to fix this? >>> >>> I am not going to race you to it, if you are thinking of fixing it. I
[U-Boot] [PATCH 4/4] cmd: ide: Make the first device the default one
At present the IDE device number is initialized to -1, which means we cannot type "ide read" command before setting the device number via "ide device #". For convenience, let's set the first device as the default one. Signed-off-by: Bin Meng--- cmd/ide.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/ide.c b/cmd/ide.c index e3c3242..bdb5980 100644 --- a/cmd/ide.c +++ b/cmd/ide.c @@ -30,7 +30,7 @@ #endif /* Current I/O Device */ -static int curr_device = -1; +static int curr_device; int do_ide(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) { -- 2.9.2 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 1/4] blk: Use macros for block device vendor/product/rev string size
So far these are using magic numbers. Replace them with macros. Signed-off-by: Bin Meng--- include/blk.h | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/include/blk.h b/include/blk.h index a106f9c..fced138 100644 --- a/include/blk.h +++ b/include/blk.h @@ -36,6 +36,10 @@ enum if_type { IF_TYPE_COUNT, /* Number of interface types */ }; +#define BLK_VEN_SIZE 41 +#define BLK_PRD_SIZE 21 +#define BLK_REV_SIZE 9 + /* * With driver model (CONFIG_BLK) this is uclass platform data, accessible * with dev_get_uclass_platdata(dev) @@ -60,9 +64,9 @@ struct blk_desc { lbaint_tlba;/* number of blocks */ unsigned long blksz; /* block size */ int log2blksz; /* for convenience: log2(blksz) */ - charvendor[40+1]; /* IDE model, SCSI Vendor */ - charproduct[20+1]; /* IDE Serial no, SCSI product */ - charrevision[8+1]; /* firmware revision */ + charvendor[BLK_VEN_SIZE]; /* device vendor string */ + charproduct[BLK_PRD_SIZE]; /* device product number */ + charrevision[BLK_REV_SIZE]; /* firmware revision */ #if CONFIG_IS_ENABLED(BLK) /* * For now we have a few functions which take struct blk_desc as a -- 2.9.2 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 3/3] armv8: ls1088a: Enable PCIe in defconfigs
From: Hou ZhiqiangEnabled PCIe support and PCI command feature. Signed-off-by: Hou Zhiqiang --- configs/ls1088aqds_qspi_defconfig| 4 configs/ls1088aqds_sdcard_qspi_defconfig | 4 configs/ls1088ardb_qspi_defconfig| 4 configs/ls1088ardb_sdcard_qspi_defconfig | 4 include/configs/ls1088a_common.h | 4 5 files changed, 20 insertions(+) diff --git a/configs/ls1088aqds_qspi_defconfig b/configs/ls1088aqds_qspi_defconfig index 6fff149fb6..4b0d604fa0 100644 --- a/configs/ls1088aqds_qspi_defconfig +++ b/configs/ls1088aqds_qspi_defconfig @@ -22,6 +22,10 @@ CONFIG_DM=y CONFIG_SPI_FLASH=y CONFIG_NETDEVICES=y CONFIG_E1000=y +CONFIG_PCI=y +CONFIG_DM_PCI=y +CONFIG_DM_PCI_COMPAT=y +CONFIG_PCIE_LAYERSCAPE=y CONFIG_SYS_NS16550=y CONFIG_FSL_DSPI=y CONFIG_EFI_LOADER_BOUNCE_BUFFER=y diff --git a/configs/ls1088aqds_sdcard_qspi_defconfig b/configs/ls1088aqds_sdcard_qspi_defconfig index 95d86274bd..4a8a89bba3 100644 --- a/configs/ls1088aqds_sdcard_qspi_defconfig +++ b/configs/ls1088aqds_sdcard_qspi_defconfig @@ -23,6 +23,10 @@ CONFIG_DM=y CONFIG_SPI_FLASH=y CONFIG_NETDEVICES=y CONFIG_E1000=y +CONFIG_PCI=y +CONFIG_DM_PCI=y +CONFIG_DM_PCI_COMPAT=y +CONFIG_PCIE_LAYERSCAPE=y CONFIG_SYS_NS16550=y CONFIG_FSL_DSPI=y CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y diff --git a/configs/ls1088ardb_qspi_defconfig b/configs/ls1088ardb_qspi_defconfig index 33e41247e6..2d5a134261 100644 --- a/configs/ls1088ardb_qspi_defconfig +++ b/configs/ls1088ardb_qspi_defconfig @@ -22,6 +22,10 @@ CONFIG_DM=y CONFIG_SPI_FLASH=y CONFIG_NETDEVICES=y CONFIG_E1000=y +CONFIG_PCI=y +CONFIG_DM_PCI=y +CONFIG_DM_PCI_COMPAT=y +CONFIG_PCIE_LAYERSCAPE=y CONFIG_SYS_NS16550=y CONFIG_FSL_DSPI=y CONFIG_EFI_LOADER_BOUNCE_BUFFER=y diff --git a/configs/ls1088ardb_sdcard_qspi_defconfig b/configs/ls1088ardb_sdcard_qspi_defconfig index c226bc1782..7d3b00be0e 100644 --- a/configs/ls1088ardb_sdcard_qspi_defconfig +++ b/configs/ls1088ardb_sdcard_qspi_defconfig @@ -23,6 +23,10 @@ CONFIG_DM=y CONFIG_SPI_FLASH=y CONFIG_NETDEVICES=y CONFIG_E1000=y +CONFIG_PCI=y +CONFIG_DM_PCI=y +CONFIG_DM_PCI_COMPAT=y +CONFIG_PCIE_LAYERSCAPE=y CONFIG_SYS_NS16550=y CONFIG_FSL_DSPI=y CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y diff --git a/include/configs/ls1088a_common.h b/include/configs/ls1088a_common.h index b79db5a3ae..16187ac386 100644 --- a/include/configs/ls1088a_common.h +++ b/include/configs/ls1088a_common.h @@ -50,6 +50,10 @@ */ #define CPU_RELEASE_ADDR secondary_boot_func +#ifdef CONFIG_PCI +#define CONFIG_CMD_PCI +#endif + /* Size of malloc() pool */ #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 2048 * 1024) -- 2.14.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 1/3] armv8: ls1088a: fix the MMU table for pcie config space
From: Hou ZhiqiangThe pcie config space of ls1088a is different from ls2080a. Signed-off-by: Hou Zhiqiang --- arch/arm/include/asm/arch-fsl-layerscape/immap_lsch3.h | 6 ++ 1 file changed, 6 insertions(+) diff --git a/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch3.h b/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch3.h index ffc5fa2636..7cae17246d 100644 --- a/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch3.h +++ b/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch3.h @@ -107,10 +107,16 @@ #define CONFIG_SYS_PCIE2_ADDR (CONFIG_SYS_IMMR + 0x250) #define CONFIG_SYS_PCIE3_ADDR (CONFIG_SYS_IMMR + 0x260) #define CONFIG_SYS_PCIE4_ADDR (CONFIG_SYS_IMMR + 0x270) +#ifdef CONFIG_ARCH_LS1088A +#define CONFIG_SYS_PCIE1_PHYS_ADDR 0x20ULL +#define CONFIG_SYS_PCIE2_PHYS_ADDR 0x28ULL +#define CONFIG_SYS_PCIE3_PHYS_ADDR 0x30ULL +#else #define CONFIG_SYS_PCIE1_PHYS_ADDR 0x10ULL #define CONFIG_SYS_PCIE2_PHYS_ADDR 0x12ULL #define CONFIG_SYS_PCIE3_PHYS_ADDR 0x14ULL #define CONFIG_SYS_PCIE4_PHYS_ADDR 0x16ULL +#endif /* Device Configuration */ #define DCFG_BASE 0x01e0 -- 2.14.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 2/3] armv8: ls1088a: add PCIe dts node
From: Hou ZhiqiangSigned-off-by: Hou Zhiqiang --- arch/arm/dts/fsl-ls1088a.dtsi | 48 +++ 1 file changed, 48 insertions(+) diff --git a/arch/arm/dts/fsl-ls1088a.dtsi b/arch/arm/dts/fsl-ls1088a.dtsi index 421d2de799..d943a9efa3 100644 --- a/arch/arm/dts/fsl-ls1088a.dtsi +++ b/arch/arm/dts/fsl-ls1088a.dtsi @@ -75,4 +75,52 @@ reg-names = "QuadSPI", "QuadSPI-memory"; num-cs = <4>; }; + + pcie@340 { + compatible = "fsl,ls-pcie", "snps,dw-pcie"; + reg = <0x00 0x0340 0x0 0x8 /* dbi registers */ + 0x00 0x0348 0x0 0x8 /* lut registers */ + 0x00 0x034c 0x0 0x4 /* pf controls registers */ + 0x20 0x 0x0 0x2>; /* configuration space */ + reg-names = "dbi", "lut", "ctrl", "config"; + #address-cells = <3>; + #size-cells = <2>; + device_type = "pci"; + num-lanes = <4>; + bus-range = <0x0 0xff>; + ranges = <0x8100 0x0 0x 0x20 0x0002 0x0 0x0001 /* downstream I/O */ + 0x8200 0x0 0x4000 0x20 0x4000 0x0 0x4000>; /* non-prefetchable memory */ + }; + + pcie@350 { + compatible = "fsl,ls-pcie", "snps,dw-pcie"; + reg = <0x00 0x0350 0x0 0x8 /* dbi registers */ + 0x00 0x0358 0x0 0x8 /* lut registers */ + 0x00 0x035c 0x0 0x4 /* pf controls registers */ + 0x28 0x 0x0 0x2>; /* configuration space */ + reg-names = "dbi", "lut", "ctrl", "config"; + #address-cells = <3>; + #size-cells = <2>; + device_type = "pci"; + num-lanes = <4>; + bus-range = <0x0 0xff>; + ranges = <0x8100 0x0 0x 0x28 0x0002 0x0 0x0001 /* downstream I/O */ + 0x8200 0x0 0x4000 0x28 0x4000 0x0 0x4000>; /* non-prefetchable memory */ + }; + + pcie@360 { + compatible = "fsl,ls-pcie", "snps,dw-pcie"; + reg = <0x00 0x0360 0x0 0x8 /* dbi registers */ + 0x00 0x0368 0x0 0x8 /* lut registers */ + 0x00 0x036c 0x0 0x4 /* pf controls registers */ + 0x30 0x 0x0 0x2>; /* configuration space */ + reg-names = "dbi", "lut", "ctrl", "config"; + #address-cells = <3>; + #size-cells = <2>; + device_type = "pci"; + num-lanes = <8>; + bus-range = <0x0 0xff>; + ranges = <0x8100 0x0 0x 0x30 0x0002 0x0 0x0001 /* downstream I/O */ + 0x8200 0x0 0x4000 0x30 0x4000 0x0 0x4000>; /* non-prefetchable memory */ + }; }; -- 2.14.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 0/3] armv8: ls1088a: add pcie support
From: Hou ZhiqiangThis patch set depends on ls1088a platform support patchs: http://patchwork.ozlabs.org/patch/800408/ http://patchwork.ozlabs.org/patch/800410/ http://patchwork.ozlabs.org/patch/800409/ http://patchwork.ozlabs.org/patch/803037/ http://patchwork.ozlabs.org/patch/803038/ http://patchwork.ozlabs.org/project/uboot/list/?series=792 http://patchwork.ozlabs.org/project/uboot/list/?series=797 Hou Zhiqiang (3): armv8: ls1088a: fix the MMU table for pcie config space armv8: ls1088a: add PCIe dts node armv8: ls1088a: Enable PCIe in defconfigs arch/arm/dts/fsl-ls1088a.dtsi | 48 ++ .../include/asm/arch-fsl-layerscape/immap_lsch3.h | 6 +++ configs/ls1088aqds_qspi_defconfig | 4 ++ configs/ls1088aqds_sdcard_qspi_defconfig | 4 ++ configs/ls1088ardb_qspi_defconfig | 4 ++ configs/ls1088ardb_sdcard_qspi_defconfig | 4 ++ include/configs/ls1088a_common.h | 4 ++ 7 files changed, 74 insertions(+) -- 2.14.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 2/2] tools: .gitignore: Add libfdt related files
Some files are generated during libfdt build. Ignore them. Signed-off-by: Bin Meng--- tools/.gitignore | 4 1 file changed, 4 insertions(+) diff --git a/tools/.gitignore b/tools/.gitignore index 6a487d2..5293d44 100644 --- a/tools/.gitignore +++ b/tools/.gitignore @@ -1,3 +1,4 @@ +/_libfdt.so /atmel_pmecc_params /bin2header /bmp_logo @@ -16,6 +17,9 @@ /img2srec /kwboot /lib/ +/libfdt.py +/libfdt.pyc +/libfdt_wrap.c /mips-relocs /mkenvimage /mkexynosspl -- 2.9.2 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 1/2] tools: .gitignore: Sort in alphabetical order
These are currently out of alphabetical order. Signed-off-by: Bin Meng--- tools/.gitignore | 19 +-- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/tools/.gitignore b/tools/.gitignore index ac0c979..6a487d2 100644 --- a/tools/.gitignore +++ b/tools/.gitignore @@ -1,31 +1,30 @@ /atmel_pmecc_params /bin2header /bmp_logo +/common/ +/dumpimage +/easylogo/easylogo /envcrc /fdtgrep /fit_check_sign /fit_info +/gdb/gdbcont +/gdb/gdbsend /gen_eth_addr /gen_ethaddr_crc /ifdtool /img2srec /kwboot -/dumpimage +/lib/ /mips-relocs /mkenvimage -/mkimage /mkexynosspl -/mxsboot +/mkimage /mksunxiboot -/sunxi-spl-image-builder +/mxsboot /ncb /proftool /relocate-rela +/sunxi-spl-image-builder /ubsha1 /xway-swap-bytes -/easylogo/easylogo -/gdb/gdbcont -/gdb/gdbsend - -/lib/ -/common/ -- 2.9.2 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2] part: mac: Suppress the error message after reading ddb
Change to use 'debug' to output the error message if it fails to read the driver descriptor block. Signed-off-by: Bin Meng--- Changes in v2: - rebase on top of u-boot/master disk/part_mac.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/disk/part_mac.c b/disk/part_mac.c index d597dcf..e31bc90 100644 --- a/disk/part_mac.c +++ b/disk/part_mac.c @@ -159,15 +159,11 @@ static int part_mac_read_ddb(struct blk_desc *dev_desc, mac_driver_desc_t *ddb_p) { if (blk_dread(dev_desc, 0, 1, (ulong *)ddb_p) != 1) { - printf("** Can't read Driver Descriptor Block **\n"); + debug("** Can't read Driver Descriptor Block **\n"); return (-1); } if (ddb_p->signature != MAC_DRIVER_MAGIC) { -#if 0 - printf ("** Bad Signature: expected 0x%04x, got 0x%04x\n", - MAC_DRIVER_MAGIC, ddb_p->signature); -#endif return (-1); } return (0); -- 2.9.2 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [U-Boot, 2/2] Makefile: Suppress output of python libfdt build command
On Sun, Sep 03, 2017 at 04:37:49AM -0700, Bin Meng wrote: > This should not be printed by default. Prefix it with $(Q). > > Fixes ee95d10b: ("fdt: Build the new python libfdt module") > Signed-off-by: Bin MengApplied to u-boot/master, thanks! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [U-Boot, 3/3] nvme: Remove dead codes in nvme_setup_io_queues()
On Sat, Sep 02, 2017 at 08:15:37AM -0700, Bin Meng wrote: > Execution cannot reach this statement: "nr_io_queues = result;" > > Reported-by: Coverity (CID: 166731) > Signed-off-by: Bin Meng> Reviewed-by: Tom Rini Applied to u-boot/master, thanks! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [U-Boot,3/3] block: Drop the ftide020 driver
On Sat, Sep 02, 2017 at 08:43:54AM -0700, Bin Meng wrote: > This is not used in U-Boot. > > Signed-off-by: Bin MengApplied to u-boot/master, thanks! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [U-Boot,1/2] Makefile: Quiesce libfdt build
On Sun, Sep 03, 2017 at 04:37:48AM -0700, Bin Meng wrote: > Since commit 3809e302 "Makefile: honor PYTHON configuration properly", > the build commands of libfdt are printed while previously were not. > > This adds the missing '--quiet' back. > > Signed-off-by: Bin MengApplied to u-boot/master, thanks! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [U-Boot,1/1] disk: part: fix typo
On Tue, Aug 29, 2017 at 06:36:59PM +0200, Heinrich Schuchardt wrote: > %s/Desriptor/Descriptor/g > > Fix lines over 80 characters with said typo. > > Signed-off-by: Heinrich SchuchardtApplied to u-boot/master, thanks! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] bch: don't use __BSD_VISIBLE to test for fls
On Sun, Aug 27, 2017 at 08:45:14PM +1000, Jonathan Gray wrote: > Commit 4ecc988301bc8e981e6d7538c57cdb3aa82f7c1d assumes fls is in libc > if __BSD_VISIBLE is defined. This appears to only be true on FreeBSD > and DragonFlyBSD. OpenBSD defines __BSD_VISIBLE and does not have fls > in strings.h/libc. > > Switch the test for __BSD_VISIBLE to one for __DragonFly__ and > __FreeBSD__ to unbreak the build on OpenBSD. > > Signed-off-by: Jonathan GrayApplied to u-boot/master, thanks! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [U-Boot, 2/3] nvme: Fix potential sign extension issue in nvme_blk_rw()
On Sat, Sep 02, 2017 at 08:15:36AM -0700, Bin Meng wrote: > "lbas" with type "u16" (16 bits, unsigned) is promoted in > "lbas << ns->lba_shift" to type "int" (32 bits, signed), then > sign-extended to type "unsigned long long" (64 bits, unsigned). > If "lbas << ns->lba_shift" is greater than 0x7FFF, the upper > bits of the result will all be 1. > > Fix it by casting "lbas" to "u32". > > Reported-by: Coverity (CID: 166730) > Signed-off-by: Bin Meng> Reviewed-by: Tom Rini Applied to u-boot/master, thanks! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] fix: fw_env: Prevent writing error message on special files, which don't support fsync
On Sun, Aug 27, 2017 at 01:46:22PM +0200, Lukasz Majewski wrote: > According to fsync specification [1] some special files (e.g., a pipe, FIFO, > or socket) don't support synchronization and return either EROFS or EINVAL. > > On the linux side the sys_fsync -> do_fsync() checks if the requested file > has f_op->fsync defined. If not it returns EINVAL [2]. > > This commit prevents writing error messages for files (devices), which > do not support fsync(). > > [1] - http://man7.org/linux/man-pages/man2/fsync.2.html > [2] - http://elixir.free-electrons.com/linux/v4.13-rc6/source/fs/sync.c#L183 > > Signed-off-by: Lukasz Majewski> Acked-by: Michael Heimpold Applied to u-boot/master, thanks! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [U-Boot, 3/8] include/config_fallbacks.h: change fallback for CONFIG_SYS_PBSIZE
On Wed, Aug 23, 2017 at 10:59:01PM +0200, Thomas Petazzoni wrote: > Most of the platforms are using CONFIG_SYS_CBSIZE + > sizeof(CONFIG_SYS_PROMPT) + 16 as their value for CONFIG_SYS_PBSIZE, > so let's adopt this for the fallback value of CONFIG_SYS_PBSIZE. > > This will allow us to drop an explicit definition of CONFIG_SYS_PBSIZE > from a large number of platforms. > > Signed-off-by: Thomas Petazzoni> Reviewed-by: Tom Rini Applied to u-boot/master, thanks! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [U-Boot, 8/8] include/configs: remove numerous CONFIG_SYS_BARGSIZE definitions
On Wed, Aug 23, 2017 at 10:59:06PM +0200, Thomas Petazzoni wrote: > This commit removes definitions of CONFIG_SYS_BARGSIZE defined to be > equal to CONFIG_SYS_CBSIZE in numerous configuration files. > > We remove such definitions in two situations: > Applied to u-boot/master, thanks! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [U-Boot, 4/8] include/configs: drop default definitions of CONFIG_SYS_PBSIZE
On Wed, Aug 23, 2017 at 10:59:02PM +0200, Thomas Petazzoni wrote: > Now that the fallback value of CONFIG_SYS_PBSIZE in > include/config_fallbacks.h has been adjusted, remove its definition > from a large number of board configuration files. > > Signed-off-by: Thomas Petazzoni> Reviewed-by: Tom Rini Applied to u-boot/master, thanks! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [U-Boot,2/3] block: ide: Drop CONFIG_IDE_LED
On Sat, Sep 02, 2017 at 08:43:53AM -0700, Bin Meng wrote: > This is actually not used. Drop it. > > Signed-off-by: Bin MengApplied to u-boot/master, thanks! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [U-Boot, 1/8] include/config_fallbacks.h: add default for CONFIG_SYS_CBSIZE
On Wed, Aug 23, 2017 at 10:58:59PM +0200, Thomas Petazzoni wrote: > CONFIG_SYS_CBSIZE contains the buffer size for input for the > console. The vast majority of platforms define them to some reasonable > value (256, 512 or 1024 bytes), and it is quite annoying to repeat > this definition for all platforms while it isn't really HW-related. > > Therefore, let's provide a sane fallback value in config_fallbacks.h, > so that platforms can rely on it instead of having to explicitly > define it. > > We use 1024 when KGDB is enabled, and 256 otherwise, which is what the > majority of the platforms are doing. > > Signed-off-by: Thomas Petazzoni> Reviewed-by: Tom Rini Applied to u-boot/master, thanks! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [U-Boot, 1/3] block: ide: Drop CONFIG_IDE_INIT_POSTRESET
On Sat, Sep 02, 2017 at 08:43:52AM -0700, Bin Meng wrote: > This is not referenced anywhere. Drop it. > > Signed-off-by: Bin MengApplied to u-boot/master, thanks! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [U-Boot, v3] omap3: evm: Fixes for CONFIG_NAND, SPL_OS_BOOT, USB, and environment
On Sat, Sep 02, 2017 at 05:43:05PM -0500, Derald D. Woods wrote: Applied to u-boot/master, thanks! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [U-Boot, 5/8] include/config_fallbacks.h: add default for CONFIG_SYS_MAXARGS
On Wed, Aug 23, 2017 at 10:59:03PM +0200, Thomas Petazzoni wrote: > CONFIG_SYS_MAXARGS contains the maximum number of arguments accepted > by U-Boot commands. Since the vast majority of the platforms define it > to 16, it makes sense to have a default definition to 16, which will > allow to remove this definition from a significant number of > platforms. > > It will allow to remove the default definition from 216 platform .h > files, leaving only 56 platforms with non-default values (15, 24, 32, > 48, 64, 96, 128 or 256). > > Signed-off-by: Thomas Petazzoni> Reviewed-by: Tom Rini Applied to u-boot/master, thanks! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [U-Boot, 2/8] include/configs: remove CONFIG_SYS_CBSIZE when the default value is used
On Wed, Aug 23, 2017 at 10:59:00PM +0200, Thomas Petazzoni wrote: > Now that include/config_fallbacks.h define a sane fallback for > CONFIG_SYS_CBSIZE, we can drop the definition of this constant in all > configurations that were using the default value. > > Signed-off-by: Thomas Petazzoni> Reviewed-by: Tom Rini Applied to u-boot/master, thanks! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [U-Boot,4/4] part: efi: Disable overlap check
On Wed, Aug 23, 2017 at 04:01:33PM +0200, Maxime Ripard wrote: > The current code checks that no partitions overlap with the GPT partition > table using the offset of the first LBA usable for that partition. > > This works fine, unless you have a partition entry that is further away > than it usually is and you want to create partitions in the gap between the > GPT header and the GPT partition entries, for example to reflash a > bootloader that needs to be set there. > > Rework the test to something a bit smarter that checks whether a partition > would overlap with either the GPT header or the partition entries, no > matter where it is on the disk. > > Partitions that do not have a start LBA specified will still start at the > first LBA usable set in the GPT header, to avoid weird behaviours. > > Signed-off-by: Maxime Ripard> Reviewed-by: Tom Rini Applied to u-boot/master, thanks! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [U-Boot, 6/8] include/configs: drop default definitions of CONFIG_SYS_MAXARGS
On Wed, Aug 23, 2017 at 10:59:04PM +0200, Thomas Petazzoni wrote: > Now that include/config_fallbacks.h define a sane fallback for > CONFIG_SYS_MAXARGS, we can drop the definition of this constant in all > configurations that were using the default value. > > Signed-off-by: Thomas Petazzoni> Reviewed-by: Tom Rini Applied to u-boot/master, thanks! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [U-Boot,1/3] nvme: Fix wrong ndev->queues memset
On Sat, Sep 02, 2017 at 08:15:35AM -0700, Bin Meng wrote: > memset() was given a sizeof(NVME_Q_NUM * sizeof(struct nvme_queue *) > to clear, which is wrong. > > Reported-by: Coverity (CID: 166729) > Signed-off-by: Bin Meng> Reviewed-by: Tom Rini Applied to u-boot/master, thanks! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [U-Boot, 7/8] include/configs: remove default values of CONFIG_SYS_BARGSIZE
On Wed, Aug 23, 2017 at 10:59:05PM +0200, Thomas Petazzoni wrote: > CONFIG_SYS_BARGSIZE is already defined to 512 in common/image.c when > not defined. Therefore, there is no point in having board > configuration files define it to 512. > > Signed-off-by: Thomas Petazzoni> Reviewed-by: Tom Rini Applied to u-boot/master, thanks! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [U-Boot, 2/4] part: efi: rework the partition start and size in gpt_fill_pte
On Wed, Aug 23, 2017 at 04:01:31PM +0200, Maxime Ripard wrote: > The start variable is only used inside a loop, and is never affected inside > it, so it's a purely local variable. > > In the same way the partition size is accessed several times, so we can > store it in a variable. > > Signed-off-by: Maxime Ripard> Reviewed-by: Tom Rini Applied to u-boot/master, thanks! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [U-Boot, 3/4] part: efi: make gpt_fill_pte take the device descriptor
On Wed, Aug 23, 2017 at 04:01:32PM +0200, Maxime Ripard wrote: > The gpt_fill_pte will need to access the device block size. Let's pass the > device descriptor as an argument. > > Signed-off-by: Maxime Ripard> Reviewed-by: Tom Rini Applied to u-boot/master, thanks! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [U-Boot,1/4] part: efi: Fix offset
On Wed, Aug 23, 2017 at 04:01:30PM +0200, Maxime Ripard wrote: > Both the config option and the DT options specify the offset to set the GPT > at in bytes, yet the code treats those values as block numbers. > > Fix that. > > Signed-off-by: Maxime Ripard> Reviewed-by: Tom Rini > Reviewed-by: Philipp Tomsich Applied to u-boot/master, thanks! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 1/9] lib: Add CRC32-C
Hi Łukasz, the Castagnoli CRC32 algorithm just uses different polynomial. Perhaps I should generalize the original CRC32. Marek On Sun, 3 Sep 2017 17:47:28 +0200 Łukasz Majewskiwrote: > Hi Marek, > > > This is needed for BTRFS. > > > > Signed-off-by: Marek Behun > > > > create mode 100644 lib/crc32c.c > > Excuse me my ignorance, but in u-boot we already have: > ./lib/crc32.c > > is the crc32c algorithm a different one from venerable crc32? > > > > > > diff --git a/include/u-boot/crc.h b/include/u-boot/crc.h > > index 6764d58bab..6d08f5df98 100644 > > --- a/include/u-boot/crc.h > > +++ b/include/u-boot/crc.h > > @@ -28,4 +28,8 @@ uint32_t crc32_no_comp (uint32_t, const unsigned > > char *, uint); void crc32_wd_buf(const unsigned char *input, uint > > ilen, unsigned char *output, uint chunk_sz); > > > > +/* lib/crc32c.c */ > > +void crc32c_init(uint32_t *, uint32_t); > > +uint32_t crc32c_cal(uint32_t, const char *, int, uint32_t *); > > + > > #endif /* _UBOOT_CRC_H */ > > diff --git a/lib/Kconfig b/lib/Kconfig > > index fe337acaeb..29e55dbe1d 100644 > > --- a/lib/Kconfig > > +++ b/lib/Kconfig > > @@ -146,6 +146,9 @@ config SHA_PROG_HW_ACCEL > > config MD5 > > bool > > > > +config CRC32C > > + bool > > + > > endmenu > > > > menu "Compression Support" > > diff --git a/lib/Makefile b/lib/Makefile > > index 2eef1eb80e..a58ce0f815 100644 > > --- a/lib/Makefile > > +++ b/lib/Makefile > > @@ -67,6 +67,7 @@ obj-y += display_options.o > > CFLAGS_display_options.o := $(if > > $(BUILD_TAG),-DBUILD_TAG='"$(BUILD_TAG)"') obj-$(CONFIG_BCH) += > > bch.o obj-y += crc32.o > > +obj-$(CONFIG_CRC32C) += crc32c.o > > obj-y += ctype.o > > obj-y += div64.o > > obj-y += hang.o > > diff --git a/lib/crc32c.c b/lib/crc32c.c > > new file mode 100644 > > index 00..322c08ff5d > > --- /dev/null > > +++ b/lib/crc32c.c > > @@ -0,0 +1,38 @@ > > +/* > > + * Copied from Linux kernel crypto/crc32c.c > > + * Copyright (c) 2004 Cisco Systems, Inc. > > + * Copyright (c) 2008 Herbert Xu > > + * > > + * This program is free software; you can redistribute it and/or > > modify it > > + * under the terms of the GNU General Public License as published > > by the Free > > + * Software Foundation; either version 2 of the License, or (at > > your option) > > + * any later version. > > + * SPDX-License-Identifier:GPL-2.0+ > > + */ > > + > > +#include > > +#include > > + > > +uint32_t crc32c_cal(uint32_t crc, const char *data, int length, > > + uint32_t *crc32c_table) > > +{ > > + while (length--) > > + crc = crc32c_table[(u8)(crc ^ *data++)] ^ (crc >> > > 8); + > > + return crc; > > +} > > + > > +void crc32c_init(uint32_t *crc32c_table, uint32_t pol) > > +{ > > + int i, j; > > + uint32_t v; > > + const uint32_t poly = pol; /* Bit-reflected CRC32C > > polynomial */ + > > + for (i = 0; i < 256; i++) { > > + v = i; > > + for (j = 0; j < 8; j++) > > + v = (v >> 1) ^ ((v & 1) ? poly : 0); > > + > > + crc32c_table[i] = v; > > + } > > +} > > > > ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] crypto/fsl: fix obj-yy in Makefile
On Sun, Sep 3, 2017 at 2:17 PM, Clemens Gruberwrote: > When enabling CONFIG_CMD_BLOB and/or CONFIG_CMD_DEKBLOB, the build fails > with a linker error: > ... > LD u-boot > arch/arm/mach-imx/built-in.o: In function `blob_encap_dek': > /home/clemens/dev/u-boot/arch/arm/mach-imx/cmd_dek.c:46: undefined > reference to `blob_dek' > > This is due to an error in the Makefile, resulting in obj-yy/obj-yn/.. > and fsl_blob.o is therefore not linked. > > Fix it by splitting it up into two obj-y lines. > > Signed-off-by: Clemens Gruber Reviewed-by: Fabio Estevam ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] crypto/fsl: fix obj-yy in Makefile
When enabling CONFIG_CMD_BLOB and/or CONFIG_CMD_DEKBLOB, the build fails with a linker error: ... LD u-boot arch/arm/mach-imx/built-in.o: In function `blob_encap_dek': /home/clemens/dev/u-boot/arch/arm/mach-imx/cmd_dek.c:46: undefined reference to `blob_dek' This is due to an error in the Makefile, resulting in obj-yy/obj-yn/.. and fsl_blob.o is therefore not linked. Fix it by splitting it up into two obj-y lines. Signed-off-by: Clemens Gruber--- drivers/crypto/fsl/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/fsl/Makefile b/drivers/crypto/fsl/Makefile index fd736cf3be..ea878e1822 100644 --- a/drivers/crypto/fsl/Makefile +++ b/drivers/crypto/fsl/Makefile @@ -6,5 +6,6 @@ obj-y += sec.o obj-$(CONFIG_FSL_CAAM) += jr.o fsl_hash.o jobdesc.o error.o -obj-$(CONFIG_CMD_BLOB)$(CONFIG_CMD_DEKBLOB) += fsl_blob.o +obj-$(CONFIG_CMD_BLOB) += fsl_blob.o +obj-$(CONFIG_CMD_DEKBLOB) += fsl_blob.o obj-$(CONFIG_RSA_FREESCALE_EXP) += fsl_rsa.o -- 2.14.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 1/1] scripts/Makefile.lib: remove overridden target $(obj)/helloworld.so:
On 09/03/2017 02:19 PM, Alexander Graf wrote: > > > On 03.09.17 08:17, Heinrich Schuchardt wrote: >> The target >> $(obj)/helloworld.so: >> exists twice in Makefile.lib. >> >> If you add an echo command to each of the two recipes you get >> warnings like: >> >> scripts/Makefile.lib:383: warning: >> overriding recipe for target 'drivers/power/battery/helloworld.so' >> scripts/Makefile.lib:379: warning: >> ignoring old recipe for target 'drivers/power/battery/helloworld.so' >> >> This patch removes the obsolete target. >> >> Signed-off-by: Heinrich Schuchardt>> --- >> Hello Alex, >> >> could you, please, review the change as it relates to EFI. > > My Makefile foo isn't quite as good as it should be, but doesn't the > existing code simply add another dependency to the required build chain? > But the value given as "dependency" is not a valid target: $ make arch/x86/lib/elf_ia32_efi.lds make: Nothing to be done for 'arch/x86/lib/elf_ia32_efi.lds'. So the line removed by the patch is just bogus. But as it is overridden it is not executed. Regards Heinrich > > Alex > >> >> Best regards >> >> Heinrich >> --- >> scripts/Makefile.lib | 2 -- >> 1 file changed, 2 deletions(-) >> >> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib >> index 9ce47b4d22..7f97e8ebf3 100644 >> --- a/scripts/Makefile.lib >> +++ b/scripts/Makefile.lib >> @@ -375,8 +375,6 @@ cmd_efi_ld = $(LD) -nostdlib -znocombreloc -T >> $(EFI_LDS_PATH) -shared \ >> EFI_LDS_PATH = $(srctree)/arch/$(ARCH)/lib/$(EFI_LDS) >> -$(obj)/helloworld.so: $(EFI_LDS_PATH) >> - >> $(obj)/helloworld.so: $(obj)/helloworld.o >> arch/$(ARCH)/lib/$(EFI_CRT0) \ >> arch/$(ARCH)/lib/$(EFI_RELOC) >> $(call cmd,efi_ld) >> > ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 1/8] fs/fat: split out helper to init fsdata
On 09/03/2017 05:47 PM, Rob Clark wrote: On Sun, Sep 3, 2017 at 10:52 AM, Łukasz Majewskiwrote: On 09/02/2017 06:37 PM, Rob Clark wrote: Want to re-use this in fat dirent iterator in next patch. Signed-off-by: Rob Clark Reviewed-by: Łukasz Majewski thanks btw, is there some way to make get_maintainers.pl to find your @denx.de address instead of the @samsung address which bounces? (Sorry, I hadn't realized you had a new addr, so you were missed from CC on some of the patches, I think.) I've updated git-mailrc entry (about which I've forgotten). However, get_maintainer looks for people making changes to the file(s) to which patch is applied. Hence, you see my old address. BR, -R -- Best regards, Lukasz Majewski -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] git: mailrc: Update e-mail address
Signed-off-by: Lukasz Majewski--- doc/git-mailrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/git-mailrc b/doc/git-mailrc index af10a3d..556db0a 100644 --- a/doc/git-mailrc +++ b/doc/git-mailrc @@ -31,7 +31,7 @@ alias jhersh Joe Hershberger alias jwrdegoede Hans de Goede alias kimphill Kim Phillips alias luka Luka Perkov -alias lukma Lukasz Majewski +alias lukma Lukasz Majewski alias macpaulMacpaul Lin alias marex Marek Vasut alias masahiro Masahiro Yamada -- 2.1.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 1/9] lib: Add CRC32-C
Hi Marek, This is needed for BTRFS. Signed-off-by: Marek Behuncreate mode 100644 lib/crc32c.c Excuse me my ignorance, but in u-boot we already have: ./lib/crc32.c is the crc32c algorithm a different one from venerable crc32? diff --git a/include/u-boot/crc.h b/include/u-boot/crc.h index 6764d58bab..6d08f5df98 100644 --- a/include/u-boot/crc.h +++ b/include/u-boot/crc.h @@ -28,4 +28,8 @@ uint32_t crc32_no_comp (uint32_t, const unsigned char *, uint); void crc32_wd_buf(const unsigned char *input, uint ilen, unsigned char *output, uint chunk_sz); +/* lib/crc32c.c */ +void crc32c_init(uint32_t *, uint32_t); +uint32_t crc32c_cal(uint32_t, const char *, int, uint32_t *); + #endif /* _UBOOT_CRC_H */ diff --git a/lib/Kconfig b/lib/Kconfig index fe337acaeb..29e55dbe1d 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -146,6 +146,9 @@ config SHA_PROG_HW_ACCEL config MD5 bool +config CRC32C + bool + endmenu menu "Compression Support" diff --git a/lib/Makefile b/lib/Makefile index 2eef1eb80e..a58ce0f815 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -67,6 +67,7 @@ obj-y += display_options.o CFLAGS_display_options.o := $(if $(BUILD_TAG),-DBUILD_TAG='"$(BUILD_TAG)"') obj-$(CONFIG_BCH) += bch.o obj-y += crc32.o +obj-$(CONFIG_CRC32C) += crc32c.o obj-y += ctype.o obj-y += div64.o obj-y += hang.o diff --git a/lib/crc32c.c b/lib/crc32c.c new file mode 100644 index 00..322c08ff5d --- /dev/null +++ b/lib/crc32c.c @@ -0,0 +1,38 @@ +/* + * Copied from Linux kernel crypto/crc32c.c + * Copyright (c) 2004 Cisco Systems, Inc. + * Copyright (c) 2008 Herbert Xu + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * SPDX-License-Identifier:GPL-2.0+ + */ + +#include +#include + +uint32_t crc32c_cal(uint32_t crc, const char *data, int length, + uint32_t *crc32c_table) +{ + while (length--) + crc = crc32c_table[(u8)(crc ^ *data++)] ^ (crc >> 8); + + return crc; +} + +void crc32c_init(uint32_t *crc32c_table, uint32_t pol) +{ + int i, j; + uint32_t v; + const uint32_t poly = pol; /* Bit-reflected CRC32C polynomial */ + + for (i = 0; i < 256; i++) { + v = i; + for (j = 0; j < 8; j++) + v = (v >> 1) ^ ((v & 1) ? poly : 0); + + crc32c_table[i] = v; + } +} -- Best regards, Lukasz Majewski -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 1/8] fs/fat: split out helper to init fsdata
On Sun, Sep 3, 2017 at 10:52 AM, Łukasz Majewskiwrote: > On 09/02/2017 06:37 PM, Rob Clark wrote: >> >> Want to re-use this in fat dirent iterator in next patch. >> >> Signed-off-by: Rob Clark > > > Reviewed-by: Łukasz Majewski > thanks btw, is there some way to make get_maintainers.pl to find your @denx.de address instead of the @samsung address which bounces? (Sorry, I hadn't realized you had a new addr, so you were missed from CC on some of the patches, I think.) BR, -R ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 1/1] scripts/Makefile.lib: remove overridden target $(obj)/helloworld.so:
On 09/03/2017 02:19 PM, Alexander Graf wrote: > > > On 03.09.17 08:17, Heinrich Schuchardt wrote: >> The target >> $(obj)/helloworld.so: >> exists twice in Makefile.lib. >> >> If you add an echo command to each of the two recipes you get >> warnings like: >> >> scripts/Makefile.lib:383: warning: >> overriding recipe for target 'drivers/power/battery/helloworld.so' >> scripts/Makefile.lib:379: warning: >> ignoring old recipe for target 'drivers/power/battery/helloworld.so' >> >> This patch removes the obsolete target. >> >> Signed-off-by: Heinrich Schuchardt>> --- >> Hello Alex, >> >> could you, please, review the change as it relates to EFI. > > My Makefile foo isn't quite as good as it should be, but doesn't the > existing code simply add another dependency to the required build chain? > The target is overridden so why should the dependency be executed? https://www.gnu.org/software/make/manual/html_node/Overriding-Makefiles.html says: "However, it is invalid for two makefiles to give different recipes for the same target. I guess this will be valid for a single makefile too." If you think the dependency is necessary, I can add it to the remaining target. Is this what you prefer? Regards Heinrich > > Alex > >> >> Best regards >> >> Heinrich >> --- >> scripts/Makefile.lib | 2 -- >> 1 file changed, 2 deletions(-) >> >> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib >> index 9ce47b4d22..7f97e8ebf3 100644 >> --- a/scripts/Makefile.lib >> +++ b/scripts/Makefile.lib >> @@ -375,8 +375,6 @@ cmd_efi_ld = $(LD) -nostdlib -znocombreloc -T >> $(EFI_LDS_PATH) -shared \ >> EFI_LDS_PATH = $(srctree)/arch/$(ARCH)/lib/$(EFI_LDS) >> -$(obj)/helloworld.so: $(EFI_LDS_PATH) >> - >> $(obj)/helloworld.so: $(obj)/helloworld.o >> arch/$(ARCH)/lib/$(EFI_CRT0) \ >> arch/$(ARCH)/lib/$(EFI_RELOC) >> $(call cmd,efi_ld) >> > ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [RFC] toradex: imx6: Move g_dnl_bind_fixup() into common SPL code
On 09/03/2017 04:56 PM, Fabio Estevam wrote: From: Fabio EstevamInstead of having every board file to add its own g_dnl_bind_fixup() implementation, move it to the common imx6 SPL code. Reviewed-by: Łukasz Majewski Signed-off-by: Fabio Estevam --- Stefan, I don't have access to Toradex board to test it, hence marking it as RFC. I have tested it with imx6q-sabresd and it works fine on this board. arch/arm/mach-imx/spl.c | 10 ++ board/toradex/apalis_imx6/apalis_imx6.c | 13 - board/toradex/colibri_imx6/colibri_imx6.c | 13 - board/toradex/common/tdx-common.c | 13 - 4 files changed, 10 insertions(+), 39 deletions(-) diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c index 8e8e2f7..e350bc9 100644 --- a/arch/arm/mach-imx/spl.c +++ b/arch/arm/mach-imx/spl.c @@ -14,6 +14,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -86,6 +87,15 @@ u32 spl_boot_device(void) } return BOOT_DEVICE_NONE; } + +#ifdef CONFIG_SPL_USB_GADGET_SUPPORT +int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name) +{ + put_unaligned(CONFIG_G_DNL_PRODUCT_NUM + 0xfff, >idProduct); + + return 0; +} +#endif #endif #if defined(CONFIG_SPL_MMC_SUPPORT) diff --git a/board/toradex/apalis_imx6/apalis_imx6.c b/board/toradex/apalis_imx6/apalis_imx6.c index ebc6c12..628a61d 100644 --- a/board/toradex/apalis_imx6/apalis_imx6.c +++ b/board/toradex/apalis_imx6/apalis_imx6.c @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include @@ -1224,18 +1223,6 @@ void reset_cpu(ulong addr) { } -#ifdef CONFIG_SPL_USB_GADGET_SUPPORT -int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name) -{ - unsigned short usb_pid; - - usb_pid = TORADEX_USB_PRODUCT_NUM_OFFSET + 0xfff; - put_unaligned(usb_pid, >idProduct); - - return 0; -} -#endif - #endif static struct mxc_serial_platdata mxc_serial_plat = { diff --git a/board/toradex/colibri_imx6/colibri_imx6.c b/board/toradex/colibri_imx6/colibri_imx6.c index 669d912..756e3f3 100644 --- a/board/toradex/colibri_imx6/colibri_imx6.c +++ b/board/toradex/colibri_imx6/colibri_imx6.c @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include @@ -1108,18 +1107,6 @@ void reset_cpu(ulong addr) { } -#ifdef CONFIG_SPL_USB_GADGET_SUPPORT -int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name) -{ - unsigned short usb_pid; - - usb_pid = TORADEX_USB_PRODUCT_NUM_OFFSET + 0xfff; - put_unaligned(usb_pid, >idProduct); - - return 0; -} -#endif - #endif static struct mxc_serial_platdata mxc_serial_plat = { diff --git a/board/toradex/common/tdx-common.c b/board/toradex/common/tdx-common.c index b4e4727..a7efeb8 100644 --- a/board/toradex/common/tdx-common.c +++ b/board/toradex/common/tdx-common.c @@ -5,7 +5,6 @@ */ #include -#include #include #include "tdx-cfg-block.h" @@ -109,18 +108,6 @@ int show_board_info(void) return 0; } -#ifdef CONFIG_USB_GADGET_DOWNLOAD -int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name) -{ - unsigned short usb_pid; - - usb_pid = TORADEX_USB_PRODUCT_NUM_OFFSET + tdx_hw_tag.prodid; - put_unaligned(usb_pid, >idProduct); - - return 0; -} -#endif - #if defined(CONFIG_OF_LIBFDT) int ft_common_board_setup(void *blob, bd_t *bd) { -- Best regards, Lukasz Majewski -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 8/8] fs/fat: fix case for FAT shortnames
On 09/02/2017 06:38 PM, Rob Clark wrote: Noticed when comparing our output to linux. There are some lcase bits which control whether filename and/or extension should be downcase'd. Reviewed-by: Łukasz MajewskiSigned-off-by: Rob Clark --- fs/fat/fat.c | 17 - fs/fat/fat_write.c | 4 ++-- include/fat.h | 3 +++ 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/fs/fat/fat.c b/fs/fat/fat.c index fc3106aacb..ccbf7ba1c8 100644 --- a/fs/fat/fat.c +++ b/fs/fat/fat.c @@ -29,11 +29,13 @@ static const int vfat_enabled = 0; #endif /* - * Convert a string to lowercase. + * Convert a string to lowercase. Converts at most 'len' characters, + * 'len' may be larger than the length of 'str' if 'str' is NULL + * terminated. */ -static void downcase(char *str) +static void downcase(char *str, size_t len) { - while (*str != '\0') { + while (*str != '\0' && len--) { *str = tolower(*str); str++; } @@ -131,10 +133,16 @@ static void get_name(dir_entry *dirent, char *s_name) ptr = s_name; while (*ptr && *ptr != ' ') ptr++; + if (dirent->lcase & CASE_LOWER_BASE) + downcase(s_name, (unsigned)(ptr - s_name)); if (dirent->ext[0] && dirent->ext[0] != ' ') { + char *ext; + *ptr = '.'; - ptr++; + ext = ++ptr; memcpy(ptr, dirent->ext, 3); + if (dirent->lcase & CASE_LOWER_EXT) + downcase(ext, 3); ptr[3] = '\0'; while (*ptr && *ptr != ' ') ptr++; @@ -144,7 +152,6 @@ static void get_name(dir_entry *dirent, char *s_name) *s_name = '\0'; else if (*s_name == aRING) *s_name = DELETED_FLAG; - downcase(s_name); } static int flush_dirty_fat_buffer(fsdata *mydata); diff --git a/fs/fat/fat_write.c b/fs/fat/fat_write.c index 4ca024c208..655ad4ec84 100644 --- a/fs/fat/fat_write.c +++ b/fs/fat/fat_write.c @@ -345,7 +345,7 @@ get_long_file_name(fsdata *mydata, int curclust, __u8 *cluster, *l_name = '\0'; else if (*l_name == aRING) *l_name = DELETED_FLAG; - downcase(l_name); + downcase(l_name, ~0); /* Return the real directory entry */ *retdent = realdent; @@ -981,7 +981,7 @@ static int do_fat_write(const char *filename, void *buffer, loff_t size, memcpy(l_filename, filename, name_len); l_filename[name_len] = 0; /* terminate the string */ - downcase(l_filename); + downcase(l_filename, ~0); startsect = mydata->rootdir_sect; retdent = find_directory_entry(mydata, startsect, diff --git a/include/fat.h b/include/fat.h index b2d4b952fd..5e4924316a 100644 --- a/include/fat.h +++ b/include/fat.h @@ -128,6 +128,9 @@ typedef struct volume_info /* Boot sign comes last, 2 bytes */ } volume_info; +#define CASE_LOWER_BASE 8 /* base is lower case */ +#define CASE_LOWER_EXT 16 /* extension is lower case */ + typedef struct dir_entry { charname[8],ext[3]; /* Name and extension */ __u8attr; /* Attribute bits */ -- Best regards, Lukasz Majewski -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 7/8] fat/fs: move ls to generic implementation
On 09/02/2017 06:38 PM, Rob Clark wrote: Add a generic implementation of 'ls' using opendir/readdir/closedir, and replace fat's custom implementation. Other filesystems should move to the generic implementation after they add opendir/readdir/closedir support. Reviewed-by: Łukasz MajewskiSigned-off-by: Rob Clark --- fs/fat/fat.c | 32 fs/fs.c | 35 +-- include/fat.h | 5 - 3 files changed, 37 insertions(+), 35 deletions(-) diff --git a/fs/fat/fat.c b/fs/fat/fat.c index d30ef3903b..fc3106aacb 100644 --- a/fs/fat/fat.c +++ b/fs/fat/fat.c @@ -1002,38 +1002,6 @@ int file_fat_detectfs(void) return 0; } -int file_fat_ls(const char *dir) -{ - fsdata fsdata; - fat_itr itrblock, *itr = - int files = 0, dirs = 0; - int ret; - - ret = fat_itr_root(itr, ); - if (ret) - return ret; - - ret = fat_itr_resolve(itr, dir, TYPE_DIR); - if (ret) - return ret; - - while (fat_itr_next(itr)) { - if (fat_itr_isdir(itr)) { - printf("%s/\n", itr->name); - dirs++; - } else { - printf(" %8u %s\n", - FAT2CPU32(itr->dent->size), - itr->name); - files++; - } - } - - printf("\n%d file(s), %d dir(s)\n\n", files, dirs); - - return 0; -} - int fat_exists(const char *filename) { fsdata fsdata; diff --git a/fs/fs.c b/fs/fs.c index 441c880654..716c223ec6 100644 --- a/fs/fs.c +++ b/fs/fs.c @@ -37,6 +37,35 @@ static inline int fs_ls_unsupported(const char *dirname) return -1; } +/* generic implementation of ls in terms of opendir/readdir/closedir */ +__maybe_unused +static int fs_ls_generic(const char *dirname) +{ + FS_DIR *dirp; + struct fs_dirent *dent; + int files = 0, dirs = 0; + + dirp = fs_opendir(dirname); + if (!dirp) + return -errno; + + while ((dent = fs_readdir(dirp))) { + if (dent->type == FS_DT_DIR) { + printf("%s/\n", dent->name); + dirs++; + } else { + printf(" %8lld %s\n", dent->size, dent->name); + files++; + } + } + + fs_closedir(dirp); + + printf("\n%d file(s), %d dir(s)\n\n", files, dirs); + + return 0; +} + static inline int fs_exists_unsupported(const char *filename) { return 0; @@ -111,7 +140,7 @@ static struct fstype_info fstypes[] = { .null_dev_desc_ok = false, .probe = fat_set_blk_dev, .close = fat_close, - .ls = file_fat_ls, + .ls = fs_ls_generic, .exists = fat_exists, .size = fat_size, .read = fat_read_file, @@ -121,7 +150,9 @@ static struct fstype_info fstypes[] = { .write = fs_write_unsupported, #endif .uuid = fs_uuid_unsupported, - .opendir = fs_opendir_unsupported, + .opendir = fat_opendir, + .readdir = fat_readdir, + .closedir = fat_closedir, }, #endif #ifdef CONFIG_FS_EXT4 diff --git a/include/fat.h b/include/fat.h index 1e8bc44e9a..b2d4b952fd 100644 --- a/include/fat.h +++ b/include/fat.h @@ -11,6 +11,7 @@ #define _FAT_H_ #include +#include #define CONFIG_SUPPORT_VFAT /* Maximum Long File Name length supported here is 128 UTF-16 code units */ @@ -172,7 +173,6 @@ typedef struct { } fsdata; int file_fat_detectfs(void); -int file_fat_ls(const char *dir); int fat_exists(const char *filename); int fat_size(const char *filename, loff_t *size); int file_fat_read_at(const char *filename, loff_t pos, void *buffer, @@ -185,5 +185,8 @@ int file_fat_write(const char *filename, void *buf, loff_t offset, loff_t len, loff_t *actwrite); int fat_read_file(const char *filename, void *buf, loff_t offset, loff_t len, loff_t *actread); +int fat_opendir(const char *filename, FS_DIR **dirp); +int fat_readdir(FS_DIR *dirp); +void fat_closedir(FS_DIR *dirp); void fat_close(void); #endif /* _FAT_H_ */ -- Best regards, Lukasz Majewski -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 5/8] fs/fat: implement opendir/readdir/closedir
On 09/02/2017 06:38 PM, Rob Clark wrote: Implement the readdir interface using the directory iterators. Reviewed-by: Łukasz MajewskiSigned-off-by: Rob Clark --- fs/fat/fat.c | 56 1 file changed, 56 insertions(+) diff --git a/fs/fat/fat.c b/fs/fat/fat.c index 3193290434..d30ef3903b 100644 --- a/fs/fat/fat.c +++ b/fs/fat/fat.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -1119,6 +1120,61 @@ int fat_read_file(const char *filename, void *buf, loff_t offset, loff_t len, return ret; } +typedef struct { + FS_DIR parent; + fsdata fsdata; + fat_itr itr; +} fat_dir; + +int fat_opendir(const char *filename, FS_DIR **dirp) +{ + fat_dir *dir = malloc(sizeof(*dir)); + int ret; + + if (!dir) + return -ENOMEM; + + ret = fat_itr_root(>itr, >fsdata); + if (ret) + goto fail; + + ret = fat_itr_resolve(>itr, filename, TYPE_DIR); + if (ret) + goto fail; + + *dirp = (FS_DIR *)dir; + return 0; + +fail: + free(dir); + return ret; +} + +int fat_readdir(FS_DIR *dirp) +{ + fat_dir *dir = (fat_dir *)dirp; + struct fs_dirent *dent = >dirent; + + if (!fat_itr_next(>itr)) + return -ENOENT; + + strcpy(dent->name, dir->itr.name); + if (fat_itr_isdir(>itr)) { + dent->type = FS_DT_DIR; + } else { + dent->type = FS_DT_REG; + dent->size = FAT2CPU32(dir->itr.dent->size); + } + + return 0; +} + +void fat_closedir(FS_DIR *dirp) +{ + fat_dir *dir = (fat_dir *)dirp; + free(dir); +} + void fat_close(void) { } -- Best regards, Lukasz Majewski -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 4/8] fs: add fs_readdir()
On 09/02/2017 06:37 PM, Rob Clark wrote: Needed to support efi file protocol. The fallback.efi loader wants to be able to read the contents of the /EFI directory to find an OS to boot. Modelled after POSIX opendir()/readdir()/closedir(). Unlike the other fs APIs, this is stateful (ie. state is held in the FS_DIR "directory stream"), to avoid re-traversing of the directory structure at each step. The directory stream must be released with closedir() when it is no longer needed. Reviewed-by: Łukasz MajewskiSigned-off-by: Rob Clark --- disk/part.c| 31 fs/fs.c| 91 ++ include/fs.h | 55 +++ include/part.h | 4 +++ 4 files changed, 169 insertions(+), 12 deletions(-) diff --git a/disk/part.c b/disk/part.c index c67fdacc79..aa9183d696 100644 --- a/disk/part.c +++ b/disk/part.c @@ -331,6 +331,24 @@ int part_get_info(struct blk_desc *dev_desc, int part, return -1; } +int part_get_info_whole_disk(struct blk_desc *dev_desc, disk_partition_t *info) +{ + info->start = 0; + info->size = dev_desc->lba; + info->blksz = dev_desc->blksz; + info->bootable = 0; + strcpy((char *)info->type, BOOT_PART_TYPE); + strcpy((char *)info->name, "Whole Disk"); +#if CONFIG_IS_ENABLED(PARTITION_UUIDS) + info->uuid[0] = 0; +#endif +#ifdef CONFIG_PARTITION_TYPE_GUID + info->type_guid[0] = 0; +#endif + + return 0; +} + int blk_get_device_by_str(const char *ifname, const char *dev_hwpart_str, struct blk_desc **dev_desc) { @@ -523,18 +541,7 @@ int blk_get_device_part_str(const char *ifname, const char *dev_part_str, (*dev_desc)->log2blksz = LOG2((*dev_desc)->blksz); - info->start = 0; - info->size = (*dev_desc)->lba; - info->blksz = (*dev_desc)->blksz; - info->bootable = 0; - strcpy((char *)info->type, BOOT_PART_TYPE); - strcpy((char *)info->name, "Whole Disk"); -#if CONFIG_IS_ENABLED(PARTITION_UUIDS) - info->uuid[0] = 0; -#endif -#ifdef CONFIG_PARTITION_TYPE_GUID - info->type_guid[0] = 0; -#endif + part_get_info_whole_disk(*dev_desc, info); ret = 0; goto cleanup; diff --git a/fs/fs.c b/fs/fs.c index 13cd3626c6..441c880654 100644 --- a/fs/fs.c +++ b/fs/fs.c @@ -21,6 +21,7 @@ DECLARE_GLOBAL_DATA_PTR; static struct blk_desc *fs_dev_desc; +static int fs_dev_part; static disk_partition_t fs_partition; static int fs_type = FS_TYPE_ANY; @@ -69,6 +70,11 @@ static inline int fs_uuid_unsupported(char *uuid_str) return -1; } +static inline int fs_opendir_unsupported(const char *filename, FS_DIR **dirp) +{ + return -EACCES; +} + struct fstype_info { int fstype; char *name; @@ -92,6 +98,9 @@ struct fstype_info { loff_t len, loff_t *actwrite); void (*close)(void); int (*uuid)(char *uuid_str); + int (*opendir)(const char *filename, FS_DIR **dirp); + int (*readdir)(FS_DIR *dirp); + void (*closedir)(FS_DIR *dirp); }; static struct fstype_info fstypes[] = { @@ -112,6 +121,7 @@ static struct fstype_info fstypes[] = { .write = fs_write_unsupported, #endif .uuid = fs_uuid_unsupported, + .opendir = fs_opendir_unsupported, }, #endif #ifdef CONFIG_FS_EXT4 @@ -131,6 +141,7 @@ static struct fstype_info fstypes[] = { .write = fs_write_unsupported, #endif .uuid = ext4fs_uuid, + .opendir = fs_opendir_unsupported, }, #endif #ifdef CONFIG_SANDBOX @@ -146,6 +157,7 @@ static struct fstype_info fstypes[] = { .read = fs_read_sandbox, .write = fs_write_sandbox, .uuid = fs_uuid_unsupported, + .opendir = fs_opendir_unsupported, }, #endif #ifdef CONFIG_CMD_UBIFS @@ -161,6 +173,7 @@ static struct fstype_info fstypes[] = { .read = ubifs_read, .write = fs_write_unsupported, .uuid = fs_uuid_unsupported, + .opendir = fs_opendir_unsupported, }, #endif { @@ -175,6 +188,7 @@ static struct fstype_info fstypes[] = { .read = fs_read_unsupported, .write = fs_write_unsupported, .uuid = fs_uuid_unsupported, + .opendir = fs_opendir_unsupported, }, }; @@ -228,6 +242,31 @@ int fs_set_blk_dev(const char *ifname, const char *dev_part_str, int fstype) if (!info->probe(fs_dev_desc, _partition)) { fs_type = info->fstype; + fs_dev_part = part; + return 0; + } + } + + return -1; +} + +/* set current blk device w/ blk_desc +
Re: [U-Boot] [PATCH v2 3/8] fat/fs: convert to directory iterators
On 09/02/2017 06:37 PM, Rob Clark wrote: And drop a whole lot of ugly code! +1 Reviewed-by: Łukasz MajewskiSigned-off-by: Rob Clark --- fs/fat/fat.c | 723 ++ include/fat.h | 6 - 2 files changed, 75 insertions(+), 654 deletions(-) diff --git a/fs/fat/fat.c b/fs/fat/fat.c index c72d6ca931..3193290434 100644 --- a/fs/fat/fat.c +++ b/fs/fat/fat.c @@ -119,22 +119,6 @@ int fat_register_device(struct blk_desc *dev_desc, int part_no) } /* - * Get the first occurence of a directory delimiter ('/' or '\') in a string. - * Return index into string if found, -1 otherwise. - */ -static int dirdelim(char *str) -{ - char *start = str; - - while (*str != '\0') { - if (ISDIRDELIM(*str)) - return str - start; - str++; - } - return -1; -} - -/* * Extract zero terminated short name from a directory entry. */ static void get_name(dir_entry *dirent, char *s_name) @@ -468,95 +452,6 @@ static int slot2str(dir_slot *slotptr, char *l_name, int *idx) return 0; } -/* - * Extract the full long filename starting at 'retdent' (which is really - * a slot) into 'l_name'. If successful also copy the real directory entry - * into 'retdent' - * Return 0 on success, -1 otherwise. - */ -static int -get_vfatname(fsdata *mydata, int curclust, __u8 *cluster, -dir_entry *retdent, char *l_name) -{ - dir_entry *realdent; - dir_slot *slotptr = (dir_slot *)retdent; - __u8 *buflimit = cluster + mydata->sect_size * ((curclust == 0) ? - PREFETCH_BLOCKS : - mydata->clust_size); - __u8 counter = (slotptr->id & ~LAST_LONG_ENTRY_MASK) & 0xff; - int idx = 0; - - if (counter > VFAT_MAXSEQ) { - debug("Error: VFAT name is too long\n"); - return -1; - } - - while ((__u8 *)slotptr < buflimit) { - if (counter == 0) - break; - if (((slotptr->id & ~LAST_LONG_ENTRY_MASK) & 0xff) != counter) - return -1; - slotptr++; - counter--; - } - - if ((__u8 *)slotptr >= buflimit) { - dir_slot *slotptr2; - - if (curclust == 0) - return -1; - curclust = get_fatent(mydata, curclust); - if (CHECK_CLUST(curclust, mydata->fatsize)) { - debug("curclust: 0x%x\n", curclust); - printf("Invalid FAT entry\n"); - return -1; - } - - if (get_cluster(mydata, curclust, get_contents_vfatname_block, - mydata->clust_size * mydata->sect_size) != 0) { - debug("Error: reading directory block\n"); - return -1; - } - - slotptr2 = (dir_slot *)get_contents_vfatname_block; - while (counter > 0) { - if (((slotptr2->id & ~LAST_LONG_ENTRY_MASK) - & 0xff) != counter) - return -1; - slotptr2++; - counter--; - } - - /* Save the real directory entry */ - realdent = (dir_entry *)slotptr2; - while ((__u8 *)slotptr2 > get_contents_vfatname_block) { - slotptr2--; - slot2str(slotptr2, l_name, ); - } - } else { - /* Save the real directory entry */ - realdent = (dir_entry *)slotptr; - } - - do { - slotptr--; - if (slot2str(slotptr, l_name, )) - break; - } while (!(slotptr->id & LAST_LONG_ENTRY_MASK)); - - l_name[idx] = '\0'; - if (*l_name == DELETED_FLAG) - *l_name = '\0'; - else if (*l_name == aRING) - *l_name = DELETED_FLAG; - downcase(l_name); - - /* Return the real directory entry */ - memcpy(retdent, realdent, sizeof(dir_entry)); - - return 0; -} - /* Calculate short name checksum */ static __u8 mkcksum(const char name[8], const char ext[3]) { @@ -572,170 +467,11 @@ static __u8 mkcksum(const char name[8], const char ext[3]) return ret; } -/* - * Get the directory entry associated with 'filename' from the directory - * starting at 'startsect' - */ +// These should probably DIAF.. __u8 get_dentfromdir_block[MAX_CLUSTSIZE] __aligned(ARCH_DMA_MINALIGN); - -static dir_entry *get_dentfromdir(fsdata *mydata, int startsect, - char *filename, dir_entry *retdent, - int dols) -{ - __u16 prevcksum = 0x; - __u32
Re: [U-Boot] [PATCH v2 2/8] fs/fat: introduce new director iterators
On 09/02/2017 06:37 PM, Rob Clark wrote: Untangle directory traversal into a simple iterator, to replace the existing multi-purpose do_fat_read_at() + get_dentfromdir(). Signed-off-by: Rob ClarkReviewed-by: Łukasz Majewski --- fs/fat/fat.c | 326 +++ 1 file changed, 326 insertions(+) diff --git a/fs/fat/fat.c b/fs/fat/fat.c index e1c0a15dc7..c72d6ca931 100644 --- a/fs/fat/fat.c +++ b/fs/fat/fat.c @@ -1245,6 +1245,332 @@ exit: return ret; } + +/* + * Directory iterator, to simplify filesystem traversal + */ + +typedef struct { + fsdata*fsdata; + unsigned cursect; + dir_entry *dent; + intremaining; /* remaining dent's in current cluster */ + intlast_cluster; + intis_root; + + /* current iterator position values: */ + char l_name[VFAT_MAXLEN_BYTES]; + char s_name[14]; + char *name; /* l_name if there is one, else s_name */ + + u8 block[MAX_CLUSTSIZE] __aligned(ARCH_DMA_MINALIGN); +} fat_itr; + +static int fat_itr_isdir(fat_itr *itr); + +/** + * fat_itr_root() - initialize an iterator to start at the root + * directory + * + * @itr: iterator to initialize + * @fsdata: filesystem data for the partition + * @return 0 on success, else -errno + */ +static int fat_itr_root(fat_itr *itr, fsdata *fsdata) +{ + if (get_fs_info(fsdata)) + return -ENXIO; + + itr->fsdata = fsdata; + itr->cursect = fsdata->rootdir_sect; + itr->dent = NULL; + itr->remaining = 0; + itr->last_cluster = 0; + itr->is_root = 1; + + return 0; +} + +/** + * fat_itr_child() - initialize an iterator to descend into a sub- + * directory + * + * Initializes 'itr' to iterate the contents of the directory at + * the current cursor position of 'parent'. It is an error to + * call this if the current cursor of 'parent' is pointing at a + * regular file. + * + * Note that 'itr' and 'parent' can be the same pointer if you do + * not need to preserve 'parent' after this call, which is useful + * for traversing directory structure to resolve a file/directory. + * + * @itr: iterator to initialize + * @parent: the iterator pointing at a directory entry in the + *parent directory of the directory to iterate + */ +static void fat_itr_child(fat_itr *itr, fat_itr *parent) +{ + fsdata *mydata = parent->fsdata; /* for silly macros */ + unsigned clustnum = START(parent->dent); + + assert(fat_itr_isdir(parent)); + + itr->fsdata = parent->fsdata; + if (clustnum > 0) { + itr->cursect = itr->fsdata->data_begin + + (clustnum * itr->fsdata->clust_size); + } else { + itr->cursect = parent->fsdata->rootdir_sect; + } + itr->dent = NULL; + itr->remaining = 0; + itr->last_cluster = 0; + itr->is_root = 0; +} + +static void *next_cluster(fat_itr *itr) +{ + fsdata *mydata = itr->fsdata; /* for silly macros */ + int ret; + + /* have we reached the end? */ + if (itr->last_cluster) + return NULL; + + debug("FAT read(sect=%d), clust_size=%d, DIRENTSPERBLOCK=%zd\n", + itr->cursect, itr->fsdata->clust_size, DIRENTSPERBLOCK); + + /* +* NOTE: do_fat_read_at() had complicated logic to deal w/ +* vfat names that span multiple clusters in the fat16 case, +* which get_dentfromdir() probably also needed (and was +* missing). And not entirely sure what fat32 didn't have +* the same issue.. We solve that by only caring about one +* dent at a time and iteratively constructing the vfat long +* name. +*/ + ret = disk_read(itr->cursect, itr->fsdata->clust_size, + itr->block); + if (ret < 0) { + debug("Error: reading block\n"); + return NULL; + } + + if (itr->is_root && itr->fsdata->fatsize != 32) { + itr->cursect++; + if (itr->cursect - itr->fsdata->rootdir_sect >= + itr->fsdata->rootdir_size) { + debug("cursect: 0x%x\n", itr->cursect); + itr->last_cluster = 1; + } + } else { + itr->cursect = get_fatent(itr->fsdata, itr->cursect); + if (CHECK_CLUST(itr->cursect, itr->fsdata->fatsize)) { + debug("cursect: 0x%x\n", itr->cursect); + itr->last_cluster = 1; + } + } + + return itr->block; +} + +static dir_entry *next_dent(fat_itr *itr) +{ + if (itr->remaining == 0) { + struct dir_entry *dent = next_cluster(itr); + + /* have we reached the last cluster? */ + if (!dent) + return NULL; + +
[U-Boot] [PATCH 6/9] fs: btrfs: Add single-device read-only BTRFS implementation
This adds the proper implementation for the BTRFS filesystem. The implementation currently supports only read-only mode and the filesystem can be only on a single device. Checksums of data chunks is unimplemented. Compression is implemented (ZLIB + LZO). Signed-off-by: Marek Behuncreate mode 100644 fs/btrfs/btrfs.h create mode 100644 fs/btrfs/chunk-map.c create mode 100644 fs/btrfs/compression.c create mode 100644 fs/btrfs/ctree.c create mode 100644 fs/btrfs/dev.c create mode 100644 fs/btrfs/dir-item.c create mode 100644 fs/btrfs/extent-io.c create mode 100644 fs/btrfs/hash.c create mode 100644 fs/btrfs/inode.c create mode 100644 fs/btrfs/root.c create mode 100644 fs/btrfs/subvolume.c create mode 100644 fs/btrfs/super.c diff --git a/fs/btrfs/btrfs.h b/fs/btrfs/btrfs.h new file mode 100644 index 00..4247cbbb09 --- /dev/null +++ b/fs/btrfs/btrfs.h @@ -0,0 +1,89 @@ +/* + * BTRFS filesystem implementation for U-Boot + * + * 2017 Marek Behun, CZ.NIC, marek.be...@nic.cz + * + * SPDX-License-Identifier:GPL-2.0+ + */ + +#ifndef __BTRFS_BTRFS_H__ +#define __BTRFS_BTRFS_H__ + +#include +#include "conv-funcs.h" + +struct btrfs_info { + struct btrfs_super_block sb; + struct btrfs_root_backup *root_backup; + + struct btrfs_root tree_root; + struct btrfs_root fs_root; + struct btrfs_root chunk_root; + + struct rb_root chunks_root; +}; + +extern struct btrfs_info btrfs_info; + +/* hash.c */ +void btrfs_hash_init(void); +u32 btrfs_crc32c(u32, const void *, size_t); +u32 btrfs_csum_data(char *, u32, size_t); +void btrfs_csum_final(u32, void *); + +static inline u64 btrfs_name_hash(const char *name, int len) +{ + return btrfs_crc32c((u32) ~1, name, len); +} + +/* dev.c */ +extern struct blk_desc *btrfs_blk_desc; +extern disk_partition_t *btrfs_part_info; + +int btrfs_devread(u64, int, void *); + +/* chunk-map.c */ +u64 btrfs_map_logical_to_physical(u64); +int btrfs_chunk_map_init(void); +void btrfs_chunk_map_exit(void); +int btrfs_read_chunk_tree(void); + +/* compression.c */ +u32 btrfs_decompress(u8 type, const char *, u32, char *, u32); + +/* super.c */ +int btrfs_read_superblock(void); + +/* dir-item.c */ +typedef int (*btrfs_readdir_callback_t)(const struct btrfs_root *, + struct btrfs_dir_item *); + +int btrfs_lookup_dir_item(const struct btrfs_root *, u64, const char *, int, + struct btrfs_dir_item *); +int btrfs_readdir(const struct btrfs_root *, u64, btrfs_readdir_callback_t); + +/* root.c */ +int btrfs_find_root(u64, struct btrfs_root *, struct btrfs_root_item *); +u64 btrfs_lookup_root_ref(u64, struct btrfs_root_ref *, char *); + +/* inode.c */ +u64 btrfs_lookup_inode_ref(struct btrfs_root *, u64, struct btrfs_inode_ref *, + char *); +int btrfs_lookup_inode(const struct btrfs_root *, struct btrfs_key *, + struct btrfs_inode_item *, struct btrfs_root *); +int btrfs_readlink(const struct btrfs_root *, u64, char *); +u64 btrfs_lookup_path(struct btrfs_root *, u64, const char *, u8 *, + struct btrfs_inode_item *, int); +u64 btrfs_file_read(const struct btrfs_root *, u64, u64, u64, char *); + +/* subvolume.c */ +u64 btrfs_get_default_subvol_objectid(void); + +/* extent-io.c */ +u64 btrfs_read_extent_inline(struct btrfs_path *, + struct btrfs_file_extent_item *, u64, u64, + char *); +u64 btrfs_read_extent_reg(struct btrfs_path *, struct btrfs_file_extent_item *, + u64, u64, char *); + +#endif /* !__BTRFS_BTRFS_H__ */ diff --git a/fs/btrfs/chunk-map.c b/fs/btrfs/chunk-map.c new file mode 100644 index 00..48407f3331 --- /dev/null +++ b/fs/btrfs/chunk-map.c @@ -0,0 +1,178 @@ +/* + * BTRFS filesystem implementation for U-Boot + * + * 2017 Marek Behun, CZ.NIC, marek.be...@nic.cz + * + * SPDX-License-Identifier:GPL-2.0+ + */ + +#include "btrfs.h" +#include + +struct chunk_map_item { + struct rb_node node; + u64 logical; + u64 length; + u64 physical; +}; + +static int add_chunk_mapping(struct btrfs_key *key, struct btrfs_chunk *chunk) +{ + struct btrfs_stripe *stripe; + u64 block_profile = chunk->type & BTRFS_BLOCK_GROUP_PROFILE_MASK; + struct rb_node **new = &(btrfs_info.chunks_root.rb_node), *prnt = NULL; + struct chunk_map_item *map_item; + + if (block_profile && block_profile != BTRFS_BLOCK_GROUP_DUP) { + printf("%s: unsupported chunk profile %llu\n", __func__, + block_profile); + return -1; + } else if (!chunk->length) { + printf("%s: zero length chunk\n", __func__); + return -1; + } + + stripe = >stripe; + btrfs_stripe_to_cpu(stripe); + + while (*new) { + struct chunk_map_item *this; + + this = rb_entry(*new, struct
[U-Boot] [PATCH 9/9] mvebu: turris_omnia: Add CONFIG_CMD_BTRFS to defconfig
Signed-off-by: Marek Behundiff --git a/configs/turris_omnia_defconfig b/configs/turris_omnia_defconfig index a3834acb96..9a456e67aa 100644 --- a/configs/turris_omnia_defconfig +++ b/configs/turris_omnia_defconfig @@ -26,6 +26,7 @@ CONFIG_CMD_USB=y CONFIG_CMD_TFTPPUT=y CONFIG_CMD_CACHE=y CONFIG_CMD_TIME=y +CONFIG_CMD_BTRFS=y # CONFIG_SPL_PARTITION_UUIDS is not set CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SPL_OF_TRANSLATE=y -- 2.13.5 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 8/9] cmd: Add the 'btrsubvol' command to list BTRFS subvolumes
Signed-off-by: Marek Behuncreate mode 100644 cmd/btrfs.c diff --git a/cmd/Kconfig b/cmd/Kconfig index d6d130edfa..77623052c4 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -1311,6 +1311,16 @@ config CMD_CROS_EC endmenu menu "Filesystem commands" +config CMD_BTRFS + bool "Enable the 'btrsubvol' command" + select FS_BTRFS + help + This enables the 'btrsubvol' command to list subvolumes + of a BTRFS filesystem. There are no special commands for + listing BTRFS directories or loading BTRFS files - this + can be done by the generic 'fs' commands (see CMD_FS_GENERIC) + when BTRFS is enabled (see FS_BTRFS). + config CMD_CBFS bool "Enable the 'cbfs' command" depends on FS_CBFS diff --git a/cmd/Makefile b/cmd/Makefile index 2a5b8ce825..2b0444d5b7 100644 --- a/cmd/Makefile +++ b/cmd/Makefile @@ -27,6 +27,7 @@ obj-$(CONFIG_CMD_BOOTMENU) += bootmenu.o obj-$(CONFIG_CMD_BOOTSTAGE) += bootstage.o obj-$(CONFIG_CMD_BOOTZ) += bootz.o obj-$(CONFIG_CMD_BOOTI) += booti.o +obj-$(CONFIG_CMD_BTRFS) += btrfs.o obj-$(CONFIG_CMD_CACHE) += cache.o obj-$(CONFIG_CMD_CBFS) += cbfs.o obj-$(CONFIG_CMD_CLK) += clk.o diff --git a/cmd/btrfs.c b/cmd/btrfs.c new file mode 100644 index 00..3f4f1b782b --- /dev/null +++ b/cmd/btrfs.c @@ -0,0 +1,28 @@ +/* + * 2017 by Marek Behun + * + * SPDX-License-Identifier:GPL-2.0+ + */ + +#include +#include +#include +#include + +int do_btrsubvol(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) +{ + if (argc != 3) + return CMD_RET_USAGE; + + if (fs_set_blk_dev(argv[1], argv[2], FS_TYPE_BTRFS)) + return 1; + + btrfs_list_subvols(); + return 0; +} + +U_BOOT_CMD(btrsubvol, 3, 1, do_btrsubvol, + "list subvolumes of a BTRFS filesystem", + " \n" + " - List subvolumes of a BTRFS filesystem." +) -- 2.13.5 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 4/9] fs: btrfs: Add btrfs_tree.h and ctree.h from Linux (and modified)
Add btrfs_tree.h and ctree.h from Linux which contains constants and structures for the BTRFS filesystem. Signed-off-by: Marek Behuncreate mode 100644 fs/btrfs/btrfs_tree.h create mode 100644 fs/btrfs/ctree.h diff --git a/fs/btrfs/btrfs_tree.h b/fs/btrfs/btrfs_tree.h new file mode 100644 index 00..f171b24288 --- /dev/null +++ b/fs/btrfs/btrfs_tree.h @@ -0,0 +1,766 @@ +/* + * From linux/include/uapi/linux/btrfs_tree.h + * + * SPDX-License-Identifier:GPL-2.0+ + */ + +#ifndef __BTRFS_BTRFS_TREE_H__ +#define __BTRFS_BTRFS_TREE_H__ + +#include + +#define BTRFS_VOL_NAME_MAX 255 +#define BTRFS_NAME_MAX 255 +#define BTRFS_LABEL_SIZE 256 +#define BTRFS_FSID_SIZE 16 +#define BTRFS_UUID_SIZE 16 + +/* + * This header contains the structure definitions and constants used + * by file system objects that can be retrieved using + * the BTRFS_IOC_SEARCH_TREE ioctl. That means basically anything that + * is needed to describe a leaf node's key or item contents. + */ + +/* holds pointers to all of the tree roots */ +#define BTRFS_ROOT_TREE_OBJECTID 1ULL + +/* stores information about which extents are in use, and reference counts */ +#define BTRFS_EXTENT_TREE_OBJECTID 2ULL + +/* + * chunk tree stores translations from logical -> physical block numbering + * the super block points to the chunk tree + */ +#define BTRFS_CHUNK_TREE_OBJECTID 3ULL + +/* + * stores information about which areas of a given device are in use. + * one per device. The tree of tree roots points to the device tree + */ +#define BTRFS_DEV_TREE_OBJECTID 4ULL + +/* one per subvolume, storing files and directories */ +#define BTRFS_FS_TREE_OBJECTID 5ULL + +/* directory objectid inside the root tree */ +#define BTRFS_ROOT_TREE_DIR_OBJECTID 6ULL + +/* holds checksums of all the data extents */ +#define BTRFS_CSUM_TREE_OBJECTID 7ULL + +/* holds quota configuration and tracking */ +#define BTRFS_QUOTA_TREE_OBJECTID 8ULL + +/* for storing items that use the BTRFS_UUID_KEY* types */ +#define BTRFS_UUID_TREE_OBJECTID 9ULL + +/* tracks free space in block groups. */ +#define BTRFS_FREE_SPACE_TREE_OBJECTID 10ULL + +/* device stats in the device tree */ +#define BTRFS_DEV_STATS_OBJECTID 0ULL + +/* for storing balance parameters in the root tree */ +#define BTRFS_BALANCE_OBJECTID -4ULL + +/* orhpan objectid for tracking unlinked/truncated files */ +#define BTRFS_ORPHAN_OBJECTID -5ULL + +/* does write ahead logging to speed up fsyncs */ +#define BTRFS_TREE_LOG_OBJECTID -6ULL +#define BTRFS_TREE_LOG_FIXUP_OBJECTID -7ULL + +/* for space balancing */ +#define BTRFS_TREE_RELOC_OBJECTID -8ULL +#define BTRFS_DATA_RELOC_TREE_OBJECTID -9ULL + +/* + * extent checksums all have this objectid + * this allows them to share the logging tree + * for fsyncs + */ +#define BTRFS_EXTENT_CSUM_OBJECTID -10ULL + +/* For storing free space cache */ +#define BTRFS_FREE_SPACE_OBJECTID -11ULL + +/* + * The inode number assigned to the special inode for storing + * free ino cache + */ +#define BTRFS_FREE_INO_OBJECTID -12ULL + +/* dummy objectid represents multiple objectids */ +#define BTRFS_MULTIPLE_OBJECTIDS -255ULL + +/* + * All files have objectids in this range. + */ +#define BTRFS_FIRST_FREE_OBJECTID 256ULL +#define BTRFS_LAST_FREE_OBJECTID -256ULL +#define BTRFS_FIRST_CHUNK_TREE_OBJECTID 256ULL + + +/* + * the device items go into the chunk tree. The key is in the form + * [ 1 BTRFS_DEV_ITEM_KEY device_id ] + */ +#define BTRFS_DEV_ITEMS_OBJECTID 1ULL + +#define BTRFS_BTREE_INODE_OBJECTID 1 + +#define BTRFS_EMPTY_SUBVOL_DIR_OBJECTID 2 + +#define BTRFS_DEV_REPLACE_DEVID 0ULL + +/* + * inode items have the data typically returned from stat and store other + * info about object characteristics. There is one for every file and dir in + * the FS + */ +#define BTRFS_INODE_ITEM_KEY 1 +#define BTRFS_INODE_REF_KEY12 +#define BTRFS_INODE_EXTREF_KEY 13 +#define BTRFS_XATTR_ITEM_KEY 24 +#define BTRFS_ORPHAN_ITEM_KEY 48 +/* reserve 2-15 close to the inode for later flexibility */ + +/* + * dir items are the name -> inode pointers in a directory. There is one + * for every name in a directory. + */ +#define BTRFS_DIR_LOG_ITEM_KEY 60 +#define BTRFS_DIR_LOG_INDEX_KEY 72 +#define BTRFS_DIR_ITEM_KEY 84 +#define BTRFS_DIR_INDEX_KEY96 +/* + * extent data is for file data + */ +#define BTRFS_EXTENT_DATA_KEY 108 + +/* + * extent csums are stored in a separate tree and hold csums for + * an entire extent on disk. + */ +#define BTRFS_EXTENT_CSUM_KEY 128 + +/* + * root items point to tree roots. They are typically in the root + * tree used by the super block to find all the other trees + */ +#define BTRFS_ROOT_ITEM_KEY132 + +/* + * root backrefs tie subvols and snapshots to the directory entries that + * reference them + */ +#define BTRFS_ROOT_BACKREF_KEY 144 + +/* + * root refs make a fast index for listing all of the snapshots and + * subvolumes referenced by a given root. They point directly to the +
[U-Boot] [PATCH 7/9] fs: btrfs: Add U-Boot fs handlers.
Signed-off-by: Marek Behuncreate mode 100644 fs/btrfs/Kconfig create mode 100644 fs/btrfs/Makefile create mode 100644 fs/btrfs/btrfs.c create mode 100644 include/btrfs.h diff --git a/fs/Kconfig b/fs/Kconfig index e6803ac8cb..1cb9831be8 100644 --- a/fs/Kconfig +++ b/fs/Kconfig @@ -4,6 +4,8 @@ menu "File systems" +source "fs/btrfs/Kconfig" + source "fs/cbfs/Kconfig" source "fs/ext4/Kconfig" diff --git a/fs/Makefile b/fs/Makefile index e5bf0df26f..84d1d30f09 100644 --- a/fs/Makefile +++ b/fs/Makefile @@ -12,6 +12,7 @@ obj-$(CONFIG_SPL_EXT_SUPPORT) += ext4/ else obj-y += fs.o fs_internal.o +obj-$(CONFIG_FS_BTRFS) += btrfs/ obj-$(CONFIG_FS_CBFS) += cbfs/ obj-$(CONFIG_CMD_CRAMFS) += cramfs/ obj-$(CONFIG_FS_EXT4) += ext4/ diff --git a/fs/btrfs/Kconfig b/fs/btrfs/Kconfig new file mode 100644 index 00..22909d9fcc --- /dev/null +++ b/fs/btrfs/Kconfig @@ -0,0 +1,9 @@ +config FS_BTRFS + bool "Enable BTRFS filesystem support" + select CRC32C + select LZO + select RBTREE + help + This provides a single-device read-only BTRFS support. BTRFS is a + next-generation Linux file system based on the copy-on-write + principle. diff --git a/fs/btrfs/Makefile b/fs/btrfs/Makefile new file mode 100644 index 00..01731557e6 --- /dev/null +++ b/fs/btrfs/Makefile @@ -0,0 +1,8 @@ +# +# 2017 Marek Behun, CZ.NIC, marek.be...@nic.cz +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y := btrfs.o chunk-map.o compression.o ctree.o dev.o dir-item.o \ + extent-io.o hash.o inode.o root.o subvolume.o super.o diff --git a/fs/btrfs/btrfs.c b/fs/btrfs/btrfs.c new file mode 100644 index 00..4140e2bc20 --- /dev/null +++ b/fs/btrfs/btrfs.c @@ -0,0 +1,227 @@ +/* + * BTRFS filesystem implementation for U-Boot + * + * 2017 Marek Behun, CZ.NIC, marek.be...@nic.cz + * + * SPDX-License-Identifier:GPL-2.0+ + */ + +#include "btrfs.h" +#include +#include +#include + +struct btrfs_info btrfs_info; + +static int readdir_callback(const struct btrfs_root *root, + struct btrfs_dir_item *item) +{ + static const char typestr[BTRFS_FT_MAX][4] = { + [BTRFS_FT_UNKNOWN] = " ? ", + [BTRFS_FT_REG_FILE] = " ", + [BTRFS_FT_DIR] = "DIR", + [BTRFS_FT_CHRDEV] = "CHR", + [BTRFS_FT_BLKDEV] = "BLK", + [BTRFS_FT_FIFO] = "FIF", + [BTRFS_FT_SOCK] = "SCK", + [BTRFS_FT_SYMLINK] = "SYM", + [BTRFS_FT_XATTR]= " ? ", + }; + struct btrfs_inode_item inode; + const char *name = (const char *) (item + 1); + char filetime[32], *target = NULL; + time_t mtime; + + if (btrfs_lookup_inode(root, >location, , NULL)) { + printf("%s: Cannot find inode item for directory entry %.*s!\n", + __func__, item->name_len, name); + return 0; + } + + mtime = inode.mtime.sec; + ctime_r(, filetime); + + if (item->type == BTRFS_FT_SYMLINK) { + target = malloc(min(inode.size + 1, + (u64) btrfs_info.sb.sectorsize)); + + if (target && btrfs_readlink(root, item->location.objectid, +target)) { + free(target); + target = NULL; + } + + if (!target) + printf("%s: Cannot read symlink target!\n", __func__); + } + + printf("<%s> ", typestr[item->type]); + if (item->type == BTRFS_FT_CHRDEV || item->type == BTRFS_FT_BLKDEV) + printf("%4u,%5u ", (unsigned int) (inode.rdev >> 20), + (unsigned int) (inode.rdev & 0xf)); + else + printf("%10llu ", inode.size); + + printf("%24.24s %.*s", filetime, item->name_len, name); + + if (item->type == BTRFS_FT_SYMLINK) { + printf(" -> %s", target ? target : "?"); + if (target) + free(target); + } + + printf("\n"); + + return 0; +} + +int btrfs_probe(struct blk_desc *fs_dev_desc, disk_partition_t *fs_partition) +{ + btrfs_blk_desc = fs_dev_desc; + btrfs_part_info = fs_partition; + + memset(_info, 0, sizeof(btrfs_info)); + + btrfs_hash_init(); + if (btrfs_read_superblock()) + return -1; + + if (btrfs_chunk_map_init()) { + printf("%s: failed to init chunk map\n", __func__); + return -1; + } + + btrfs_info.tree_root.objectid = 0; + btrfs_info.tree_root.bytenr = btrfs_info.sb.root; + btrfs_info.chunk_root.objectid = 0; + btrfs_info.chunk_root.bytenr = btrfs_info.sb.chunk_root; + + if (btrfs_read_chunk_tree()) { + printf("%s: failed to read chunk tree\n", __func__); +
[U-Boot] [PATCH 1/9] lib: Add CRC32-C
This is needed for BTRFS. Signed-off-by: Marek Behuncreate mode 100644 lib/crc32c.c diff --git a/include/u-boot/crc.h b/include/u-boot/crc.h index 6764d58bab..6d08f5df98 100644 --- a/include/u-boot/crc.h +++ b/include/u-boot/crc.h @@ -28,4 +28,8 @@ uint32_t crc32_no_comp (uint32_t, const unsigned char *, uint); void crc32_wd_buf(const unsigned char *input, uint ilen, unsigned char *output, uint chunk_sz); +/* lib/crc32c.c */ +void crc32c_init(uint32_t *, uint32_t); +uint32_t crc32c_cal(uint32_t, const char *, int, uint32_t *); + #endif /* _UBOOT_CRC_H */ diff --git a/lib/Kconfig b/lib/Kconfig index fe337acaeb..29e55dbe1d 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -146,6 +146,9 @@ config SHA_PROG_HW_ACCEL config MD5 bool +config CRC32C + bool + endmenu menu "Compression Support" diff --git a/lib/Makefile b/lib/Makefile index 2eef1eb80e..a58ce0f815 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -67,6 +67,7 @@ obj-y += display_options.o CFLAGS_display_options.o := $(if $(BUILD_TAG),-DBUILD_TAG='"$(BUILD_TAG)"') obj-$(CONFIG_BCH) += bch.o obj-y += crc32.o +obj-$(CONFIG_CRC32C) += crc32c.o obj-y += ctype.o obj-y += div64.o obj-y += hang.o diff --git a/lib/crc32c.c b/lib/crc32c.c new file mode 100644 index 00..322c08ff5d --- /dev/null +++ b/lib/crc32c.c @@ -0,0 +1,38 @@ +/* + * Copied from Linux kernel crypto/crc32c.c + * Copyright (c) 2004 Cisco Systems, Inc. + * Copyright (c) 2008 Herbert Xu + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * SPDX-License-Identifier:GPL-2.0+ + */ + +#include +#include + +uint32_t crc32c_cal(uint32_t crc, const char *data, int length, + uint32_t *crc32c_table) +{ + while (length--) + crc = crc32c_table[(u8)(crc ^ *data++)] ^ (crc >> 8); + + return crc; +} + +void crc32c_init(uint32_t *crc32c_table, uint32_t pol) +{ + int i, j; + uint32_t v; + const uint32_t poly = pol; /* Bit-reflected CRC32C polynomial */ + + for (i = 0; i < 256; i++) { + v = i; + for (j = 0; j < 8; j++) + v = (v >> 1) ^ ((v & 1) ? poly : 0); + + crc32c_table[i] = v; + } +} -- 2.13.5 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 2/9] fs: Create a common fs_devread for ext4/reiserfs/zfs
The ext4, reiserfs and zfs filesystems all have their own implementation of the same function, *_devread. Generalize this function into fs_devread and put the code into fs/fs_internal.c. Signed-off-by: Marek Behuncreate mode 100644 fs/fs_internal.c create mode 100644 include/fs_internal.h diff --git a/fs/Makefile b/fs/Makefile index 5770f41c0b..e5bf0df26f 100644 --- a/fs/Makefile +++ b/fs/Makefile @@ -10,7 +10,7 @@ ifdef CONFIG_SPL_BUILD obj-$(CONFIG_SPL_FAT_SUPPORT) += fat/ obj-$(CONFIG_SPL_EXT_SUPPORT) += ext4/ else -obj-y += fs.o +obj-y += fs.o fs_internal.o obj-$(CONFIG_FS_CBFS) += cbfs/ obj-$(CONFIG_CMD_CRAMFS) += cramfs/ diff --git a/fs/ext4/dev.c b/fs/ext4/dev.c index ae2ba6a901..f04fa08f64 100644 --- a/fs/ext4/dev.c +++ b/fs/ext4/dev.c @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include "ext4_common.h" @@ -47,85 +47,11 @@ void ext4fs_set_blk_dev(struct blk_desc *rbdd, disk_partition_t *info) get_fs()->dev_desc->log2blksz; } -int ext4fs_devread(lbaint_t sector, int byte_offset, int byte_len, char *buf) +int ext4fs_devread(lbaint_t sector, int byte_offset, int byte_len, + char *buffer) { - unsigned block_len; - int log2blksz = ext4fs_blk_desc->log2blksz; - ALLOC_CACHE_ALIGN_BUFFER(char, sec_buf, (ext4fs_blk_desc ? -ext4fs_blk_desc->blksz : -0)); - if (ext4fs_blk_desc == NULL) { - printf("** Invalid Block Device Descriptor (NULL)\n"); - return 0; - } - - /* Check partition boundaries */ - if ((sector + ((byte_offset + byte_len - 1) >> log2blksz)) - >= part_info->size) { - printf("%s read outside partition " LBAFU "\n", __func__, - sector); - return 0; - } - - /* Get the read to the beginning of a partition */ - sector += byte_offset >> log2blksz; - byte_offset &= ext4fs_blk_desc->blksz - 1; - - debug(" <" LBAFU ", %d, %d>\n", sector, byte_offset, byte_len); - - if (byte_offset != 0) { - int readlen; - /* read first part which isn't aligned with start of sector */ - if (blk_dread(ext4fs_blk_desc, part_info->start + sector, 1, - (void *)sec_buf) != 1) { - printf(" ** ext2fs_devread() read error **\n"); - return 0; - } - readlen = min((int)ext4fs_blk_desc->blksz - byte_offset, - byte_len); - memcpy(buf, sec_buf + byte_offset, readlen); - buf += readlen; - byte_len -= readlen; - sector++; - } - - if (byte_len == 0) - return 1; - - /* read sector aligned part */ - block_len = byte_len & ~(ext4fs_blk_desc->blksz - 1); - - if (block_len == 0) { - ALLOC_CACHE_ALIGN_BUFFER(u8, p, ext4fs_blk_desc->blksz); - - block_len = ext4fs_blk_desc->blksz; - blk_dread(ext4fs_blk_desc, part_info->start + sector, 1, - (void *)p); - memcpy(buf, p, byte_len); - return 1; - } - - if (blk_dread(ext4fs_blk_desc, part_info->start + sector, - block_len >> log2blksz, (void *)buf) != - block_len >> log2blksz) { - printf(" ** %s read error - block\n", __func__); - return 0; - } - block_len = byte_len & ~(ext4fs_blk_desc->blksz - 1); - buf += block_len; - byte_len -= block_len; - sector += block_len / ext4fs_blk_desc->blksz; - - if (byte_len != 0) { - /* read rest of data which are not in whole sector */ - if (blk_dread(ext4fs_blk_desc, part_info->start + sector, 1, - (void *)sec_buf) != 1) { - printf("* %s read error - last part\n", __func__); - return 0; - } - memcpy(buf, sec_buf, byte_len); - } - return 1; + return fs_devread(get_fs()->dev_desc, part_info, sector, byte_offset, + byte_len, buffer); } int ext4_read_superblock(char *buffer) diff --git a/fs/fs_internal.c b/fs/fs_internal.c new file mode 100644 index 00..58b441030c --- /dev/null +++ b/fs/fs_internal.c @@ -0,0 +1,92 @@ +/* + * 2017 by Marek Behun + * + * Derived from code in ext4/dev.c, which was based on reiserfs/dev.c + * + * SPDX-License-Identifier:GPL-2.0 + */ + +#include +#include +#include +#include + +int fs_devread(struct blk_desc *blk, disk_partition_t *partition, + lbaint_t sector, int byte_offset, int byte_len, char *buf) +{ +
[U-Boot] [PATCH 5/9] fs: btrfs: Add disk-to-cpu and cpu-to-disk conversion functions
BTRFS on disk structures are stored in Little Endian. Add functions to convert this structures to cpu and to disk format. On Little Endian hosts, these functions do nothing. On Big Endian the CALL_MACRO_FROM_EACH from variadic-macro.h is used to define all the members for each structure on which cpu_to_le* or le*_to_cpu is to be called. Signed-off-by: Marek Behuncreate mode 100644 fs/btrfs/conv-funcs.h diff --git a/fs/btrfs/conv-funcs.h b/fs/btrfs/conv-funcs.h new file mode 100644 index 00..f2e7944e4e --- /dev/null +++ b/fs/btrfs/conv-funcs.h @@ -0,0 +1,176 @@ +/* + * Functions to convert BTRFS structures from disk to CPU endianness and back. + * + * 2017 Marek Behun, CZ.NIC, marek.be...@nic.cz + * + * SPDX-License-Identifier:GPL-2.0+ + */ + +#ifndef __BTRFS_CONV_FUNCS_H__ +#define __BTRFS_CONV_FUNCS_H__ + +#include "ctree.h" +#include +#include + +/* We are using variadic macros and C11 _Generic to achieve compact code. + + We want to define macro DEFINE_CONV(x, ...), where the first argument is the + name of the structure for which it shall define conversion functions (the + names of the functions shall be x_to_cpu and x_to_disk), and the other + arguments are names of the members on which the functions shall do + endianness conversion. */ + +#if defined(__LITTLE_ENDIAN) + +/* If the target machine is little endian, the conversion functions do + nothing, since the on disk format is little endian. */ + +# define DEFINE_CONV(n,...)\ + static inline struct n *n##_to_disk(struct n * r) \ + { \ + return r; \ + } \ + static inline struct n *n##_to_cpu(struct n * r)\ + { \ + return r; \ + } + +# define DEFINE_CONV_ALT(n,a,...) \ + static inline struct n *n##_to_disk_##a(struct n * r) \ + { \ + return r; \ + } \ + static inline struct n *n##_to_cpu_##a(struct n * r)\ + { \ + return r; \ + } + +#else /* !defined(__LITTLE_ENDIAN) */ + +/* Some structures contain not only scalar members, but compound types as well + (for example, struct btrfs_inode_item contains members of type struct + btrfs_timespec. + + For these members we want to call the conversion function recursively, so + first we declare the functions taking pointers to this types (these function + will be defined later by the DEFINE_CONV macro) and then we define + correspond functions taking non-pointers, so that they can be used in the + expansion of the _Generic. */ +# define DEFINE_CONV_FOR_STRUCT(n) \ + static inline struct n * n##_to_disk(struct n *); \ + static inline struct n * n##_to_cpu(struct n *);\ + static inline struct n n##_to_disk_v(struct n x) { \ + return *n##_to_disk();\ + } \ + static inline struct n n##_to_cpu_v(struct n x) { \ + return *n##_to_cpu(); \ + } + +DEFINE_CONV_FOR_STRUCT(btrfs_key) +DEFINE_CONV_FOR_STRUCT(btrfs_stripe) +DEFINE_CONV_FOR_STRUCT(btrfs_timespec) +DEFINE_CONV_FOR_STRUCT(btrfs_inode_item) +DEFINE_CONV_FOR_STRUCT(btrfs_root_backup) +DEFINE_CONV_FOR_STRUCT(btrfs_dev_item) + +/* Now define the _Generic for both CPU to LE and LE to CPU */ +# define DEFINE_CONV_CPU_TO_LE(x) \ + (d->x) = _Generic((d->x), \ + __u16: cpu_to_le16, \ + __u32: cpu_to_le32, \ + __u64: cpu_to_le64, \ + struct btrfs_key: btrfs_key_to_disk_v, \ + struct btrfs_stripe: btrfs_stripe_to_disk_v,\ + struct btrfs_timespec: btrfs_timespec_to_disk_v,\ + struct btrfs_inode_item: btrfs_inode_item_to_disk_v,\ + struct btrfs_root_backup: btrfs_root_backup_to_disk_v, \ + struct btrfs_dev_item: btrfs_dev_item_to_disk_v \ + )((d->x)); + +# define DEFINE_CONV_LE_TO_CPU(x) \ + (d->x) = _Generic((d->x), \ + __u16: le16_to_cpu,
[U-Boot] [PATCH 0/9] Add single-device read-only BTRFS support
This is the first version of patches for adding a single-device read-only BTRFS support to U-Boot. Compression (zlib/lzo) is supported. Data checksumming is unimplemented. The code was tested on the Turris Omnia router, where BTRFS is used as the main filesystem from which kernel and device-tree are loaded. The first patch adds the CRC32-C hash routine. The second patch generalizes the ext4fs_devread, reiserfs_devread and zfs_devread functions into one fs_devread and puts it into fs/fs_internal.c. The third patch creates a header variadic-macro.h containing a variadic macro CALL_MACRO_FOR_EACH, which expands to a call to the macro specified by the first argument to all its subsequent arguments. This is used in my code for defining functions to convert the BTRFS data structures to/from CPU/disk format. The fourth patch adds the btrfs_tree.h and ctree.h files containing constants and structures definitions for BTRFS from Linux. The fifth patch adds the code for conversion of BTRFS data structures to/from CPU/disk format. The sixth patch adds the proper BTRFS code. The seventh patch adds U-Boot fs handlers. The eighth patch adds the 'btrsubvol' command to list BTRFS subvolumes. The nineth patch adds CONFIG_CMD_BTRFS into the defconfig for Turris Omnia. Tested-by: Marek BehunSigned-off-by: Marek Behun ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 3/9] include: Add a variadic macro to call a callback for all arguments
Add a header variadic-macro.h which defines the CALL_MACRO_FOR_EACH marco. This macro can be used as follows: #define TEST(x) CALL_MACRO_FOR_EACH(TEST, a, b, c, d) This will expand to TEST(a) TEST(b) TEST(c) TEST(d) The nice thing is that CALL_MACRO_FOR_EACH is a variadic macro, thus the number of arguments can vary (although it has an upper limit - in this implementation 32 arguments). Signed-off-by: Marek Behuncreate mode 100644 include/u-boot/variadic-macro.h diff --git a/include/u-boot/variadic-macro.h b/include/u-boot/variadic-macro.h new file mode 100644 index 00..922beafcea --- /dev/null +++ b/include/u-boot/variadic-macro.h @@ -0,0 +1,59 @@ +/* + * Helper for work with variadic macros + * + * 2017 Marek Behun, CZ.NIC, marek.be...@nic.cz + * + * SPDX-License-Identifier:GPL-2.0+ + */ + +#ifndef __VARIADIC_MACRO_H__ +#define __VARIADIC_MACRO_H__ + +#define _VM_GET_NTH_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, \ + _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, \ + _28, _29, _30, _31, _32, N, ...) N + +#define _VM_HELP_0(_call, ...) +#define _VM_HELP_1(_call, x, ...) _call(x) +#define _VM_HELP_2(_call, x, ...) _call(x) _VM_HELP_1(_call, __VA_ARGS__) +#define _VM_HELP_3(_call, x, ...) _call(x) _VM_HELP_2(_call, __VA_ARGS__) +#define _VM_HELP_4(_call, x, ...) _call(x) _VM_HELP_3(_call, __VA_ARGS__) +#define _VM_HELP_5(_call, x, ...) _call(x) _VM_HELP_4(_call, __VA_ARGS__) +#define _VM_HELP_6(_call, x, ...) _call(x) _VM_HELP_5(_call, __VA_ARGS__) +#define _VM_HELP_7(_call, x, ...) _call(x) _VM_HELP_6(_call, __VA_ARGS__) +#define _VM_HELP_8(_call, x, ...) _call(x) _VM_HELP_7(_call, __VA_ARGS__) +#define _VM_HELP_9(_call, x, ...) _call(x) _VM_HELP_8(_call, __VA_ARGS__) +#define _VM_HELP_10(_call, x, ...) _call(x) _VM_HELP_9(_call, __VA_ARGS__) +#define _VM_HELP_11(_call, x, ...) _call(x) _VM_HELP_10(_call, __VA_ARGS__) +#define _VM_HELP_12(_call, x, ...) _call(x) _VM_HELP_11(_call, __VA_ARGS__) +#define _VM_HELP_13(_call, x, ...) _call(x) _VM_HELP_12(_call, __VA_ARGS__) +#define _VM_HELP_14(_call, x, ...) _call(x) _VM_HELP_13(_call, __VA_ARGS__) +#define _VM_HELP_15(_call, x, ...) _call(x) _VM_HELP_14(_call, __VA_ARGS__) +#define _VM_HELP_16(_call, x, ...) _call(x) _VM_HELP_15(_call, __VA_ARGS__) +#define _VM_HELP_17(_call, x, ...) _call(x) _VM_HELP_16(_call, __VA_ARGS__) +#define _VM_HELP_18(_call, x, ...) _call(x) _VM_HELP_17(_call, __VA_ARGS__) +#define _VM_HELP_19(_call, x, ...) _call(x) _VM_HELP_18(_call, __VA_ARGS__) +#define _VM_HELP_20(_call, x, ...) _call(x) _VM_HELP_19(_call, __VA_ARGS__) +#define _VM_HELP_21(_call, x, ...) _call(x) _VM_HELP_20(_call, __VA_ARGS__) +#define _VM_HELP_22(_call, x, ...) _call(x) _VM_HELP_21(_call, __VA_ARGS__) +#define _VM_HELP_23(_call, x, ...) _call(x) _VM_HELP_22(_call, __VA_ARGS__) +#define _VM_HELP_24(_call, x, ...) _call(x) _VM_HELP_23(_call, __VA_ARGS__) +#define _VM_HELP_25(_call, x, ...) _call(x) _VM_HELP_24(_call, __VA_ARGS__) +#define _VM_HELP_26(_call, x, ...) _call(x) _VM_HELP_25(_call, __VA_ARGS__) +#define _VM_HELP_27(_call, x, ...) _call(x) _VM_HELP_26(_call, __VA_ARGS__) +#define _VM_HELP_28(_call, x, ...) _call(x) _VM_HELP_27(_call, __VA_ARGS__) +#define _VM_HELP_29(_call, x, ...) _call(x) _VM_HELP_28(_call, __VA_ARGS__) +#define _VM_HELP_30(_call, x, ...) _call(x) _VM_HELP_29(_call, __VA_ARGS__) +#define _VM_HELP_31(_call, x, ...) _call(x) _VM_HELP_30(_call, __VA_ARGS__) + +#define CALL_MACRO_FOR_EACH(x, ...) \ + _VM_GET_NTH_ARG("", ##__VA_ARGS__, _VM_HELP_31, _VM_HELP_30, \ + _VM_HELP_29, _VM_HELP_28, _VM_HELP_27, _VM_HELP_26, _VM_HELP_25, \ + _VM_HELP_24, _VM_HELP_23, _VM_HELP_22, _VM_HELP_21, _VM_HELP_20, \ + _VM_HELP_19, _VM_HELP_18, _VM_HELP_17, _VM_HELP_16, _VM_HELP_15, \ + _VM_HELP_14, _VM_HELP_13, _VM_HELP_12, _VM_HELP_11, _VM_HELP_10, \ + _VM_HELP_9, _VM_HELP_8, _VM_HELP_7, _VM_HELP_6, _VM_HELP_5, \ + _VM_HELP_4, _VM_HELP_3, _VM_HELP_2, _VM_HELP_1, \ + _VM_HELP_0)(x, __VA_ARGS__) + +#endif /* __VARIADIC_MACRO_H__ */ -- 2.13.5 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [RFC] toradex: imx6: Move g_dnl_bind_fixup() into common SPL code
From: Fabio EstevamInstead of having every board file to add its own g_dnl_bind_fixup() implementation, move it to the common imx6 SPL code. Signed-off-by: Fabio Estevam --- Stefan, I don't have access to Toradex board to test it, hence marking it as RFC. I have tested it with imx6q-sabresd and it works fine on this board. arch/arm/mach-imx/spl.c | 10 ++ board/toradex/apalis_imx6/apalis_imx6.c | 13 - board/toradex/colibri_imx6/colibri_imx6.c | 13 - board/toradex/common/tdx-common.c | 13 - 4 files changed, 10 insertions(+), 39 deletions(-) diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c index 8e8e2f7..e350bc9 100644 --- a/arch/arm/mach-imx/spl.c +++ b/arch/arm/mach-imx/spl.c @@ -14,6 +14,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -86,6 +87,15 @@ u32 spl_boot_device(void) } return BOOT_DEVICE_NONE; } + +#ifdef CONFIG_SPL_USB_GADGET_SUPPORT +int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name) +{ + put_unaligned(CONFIG_G_DNL_PRODUCT_NUM + 0xfff, >idProduct); + + return 0; +} +#endif #endif #if defined(CONFIG_SPL_MMC_SUPPORT) diff --git a/board/toradex/apalis_imx6/apalis_imx6.c b/board/toradex/apalis_imx6/apalis_imx6.c index ebc6c12..628a61d 100644 --- a/board/toradex/apalis_imx6/apalis_imx6.c +++ b/board/toradex/apalis_imx6/apalis_imx6.c @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include @@ -1224,18 +1223,6 @@ void reset_cpu(ulong addr) { } -#ifdef CONFIG_SPL_USB_GADGET_SUPPORT -int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name) -{ - unsigned short usb_pid; - - usb_pid = TORADEX_USB_PRODUCT_NUM_OFFSET + 0xfff; - put_unaligned(usb_pid, >idProduct); - - return 0; -} -#endif - #endif static struct mxc_serial_platdata mxc_serial_plat = { diff --git a/board/toradex/colibri_imx6/colibri_imx6.c b/board/toradex/colibri_imx6/colibri_imx6.c index 669d912..756e3f3 100644 --- a/board/toradex/colibri_imx6/colibri_imx6.c +++ b/board/toradex/colibri_imx6/colibri_imx6.c @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include @@ -1108,18 +1107,6 @@ void reset_cpu(ulong addr) { } -#ifdef CONFIG_SPL_USB_GADGET_SUPPORT -int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name) -{ - unsigned short usb_pid; - - usb_pid = TORADEX_USB_PRODUCT_NUM_OFFSET + 0xfff; - put_unaligned(usb_pid, >idProduct); - - return 0; -} -#endif - #endif static struct mxc_serial_platdata mxc_serial_plat = { diff --git a/board/toradex/common/tdx-common.c b/board/toradex/common/tdx-common.c index b4e4727..a7efeb8 100644 --- a/board/toradex/common/tdx-common.c +++ b/board/toradex/common/tdx-common.c @@ -5,7 +5,6 @@ */ #include -#include #include #include "tdx-cfg-block.h" @@ -109,18 +108,6 @@ int show_board_info(void) return 0; } -#ifdef CONFIG_USB_GADGET_DOWNLOAD -int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name) -{ - unsigned short usb_pid; - - usb_pid = TORADEX_USB_PRODUCT_NUM_OFFSET + tdx_hw_tag.prodid; - put_unaligned(usb_pid, >idProduct); - - return 0; -} -#endif - #if defined(CONFIG_OF_LIBFDT) int ft_common_board_setup(void *blob, bd_t *bd) { -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 1/8] fs/fat: split out helper to init fsdata
On 09/02/2017 06:37 PM, Rob Clark wrote: Want to re-use this in fat dirent iterator in next patch. Signed-off-by: Rob ClarkReviewed-by: Łukasz Majewski --- fs/fat/fat.c | 73 +++ include/fat.h | 1 + 2 files changed, 44 insertions(+), 30 deletions(-) diff --git a/fs/fat/fat.c b/fs/fat/fat.c index 465a6875ed..e1c0a15dc7 100644 --- a/fs/fat/fat.c +++ b/fs/fat/fat.c @@ -808,35 +808,17 @@ exit: return ret; } -__u8 do_fat_read_at_block[MAX_CLUSTSIZE] - __aligned(ARCH_DMA_MINALIGN); - -int do_fat_read_at(const char *filename, loff_t pos, void *buffer, - loff_t maxsize, int dols, int dogetsize, loff_t *size) +static int get_fs_info(fsdata *mydata) { - char fnamecopy[2048]; boot_sector bs; volume_info volinfo; - fsdata datablock; - fsdata *mydata = - dir_entry *dentptr = NULL; - __u16 prevcksum = 0x; - char *subname = ""; - __u32 cursect; - int idx, isdir = 0; - int files = 0, dirs = 0; - int ret = -1; - int firsttime; __u32 root_cluster = 0; - __u32 read_blk; - int rootdir_size = 0; - int buffer_blk_cnt; - int do_read; - __u8 *dir_ptr; + int ret; - if (read_bootsectandvi(, , >fatsize)) { + ret = read_bootsectandvi(, , >fatsize); + if (ret) { debug("Error: reading boot sector\n"); - return -1; + return ret; } if (mydata->fatsize == 32) { @@ -848,8 +830,7 @@ int do_fat_read_at(const char *filename, loff_t pos, void *buffer, mydata->fat_sect = bs.reserved; - cursect = mydata->rootdir_sect - = mydata->fat_sect + mydata->fatlength * bs.fats; + mydata->rootdir_sect = mydata->fat_sect + mydata->fatlength * bs.fats; mydata->sect_size = (bs.sector_size[1] << 8) + bs.sector_size[0]; mydata->clust_size = bs.cluster_size; @@ -863,12 +844,12 @@ int do_fat_read_at(const char *filename, loff_t pos, void *buffer, mydata->data_begin = mydata->rootdir_sect - (mydata->clust_size * 2); } else { - rootdir_size = ((bs.dir_entries[1] * (int)256 + -bs.dir_entries[0]) * -sizeof(dir_entry)) / -mydata->sect_size; + mydata->rootdir_size = ((bs.dir_entries[1] * (int)256 + +bs.dir_entries[0]) * +sizeof(dir_entry)) / +mydata->sect_size; mydata->data_begin = mydata->rootdir_sect + - rootdir_size - + mydata->rootdir_size - (mydata->clust_size * 2); } @@ -893,6 +874,38 @@ int do_fat_read_at(const char *filename, loff_t pos, void *buffer, debug("Sector size: %d, cluster size: %d\n", mydata->sect_size, mydata->clust_size); + return 0; +} + +__u8 do_fat_read_at_block[MAX_CLUSTSIZE] + __aligned(ARCH_DMA_MINALIGN); + +int do_fat_read_at(const char *filename, loff_t pos, void *buffer, + loff_t maxsize, int dols, int dogetsize, loff_t *size) +{ + char fnamecopy[2048]; + fsdata datablock; + fsdata *mydata = + dir_entry *dentptr = NULL; + __u16 prevcksum = 0x; + char *subname = ""; + __u32 cursect; + int idx, isdir = 0; + int files = 0, dirs = 0; + int ret = -1; + int firsttime; + __u32 root_cluster = 0; + __u32 read_blk; + int rootdir_size = 0; + int buffer_blk_cnt; + int do_read; + __u8 *dir_ptr; + + if (get_fs_info(mydata)) + return -1; + + cursect = mydata->rootdir_sect; + /* "cwd" is always the root... */ while (ISDIRDELIM(*filename)) filename++; diff --git a/include/fat.h b/include/fat.h index 71879f01ca..6d3fc8e4a6 100644 --- a/include/fat.h +++ b/include/fat.h @@ -174,6 +174,7 @@ typedef struct { __u16 clust_size; /* Size of clusters in sectors */ int data_begin; /* The sector of the first cluster, can be negative */ int fatbufnum; /* Used by get_fatent, init to -1 */ + int rootdir_size; } fsdata; typedef int (file_detectfs_func)(void); -- Best regards, Lukasz Majewski -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] Configs: Rename MTDIDS_DEFAULT and MTDPARTS_DEFAULT
There is already an entry in Kconfig with 'CONFIG_' prepended. This patch renames them to match CONFIG_MTDIDS_DEFAULT and CONFIG_MTDPARTS_DEFAULT to make the migration to Kconfig easier in the future. Signed-off-by: Adam Forddiff --git a/include/configs/BSC9131RDB.h b/include/configs/BSC9131RDB.h index 19c772c..fa872b8 100644 --- a/include/configs/BSC9131RDB.h +++ b/include/configs/BSC9131RDB.h @@ -325,8 +325,8 @@ extern unsigned long get_sdram_size(void); */ #define CONFIG_MTD_DEVICE #define CONFIG_MTD_PARTITIONS -#define MTDIDS_DEFAULT "nand0=ff80.flash," -#define MTDPARTS_DEFAULT "mtdparts=ff80.flash:1m(uboot)," \ +#define CONFIG_MTDIDS_DEFAULT "nand0=ff80.flash," +#define CONFIG_MTDPARTS_DEFAULT "mtdparts=ff80.flash:1m(uboot)," \ "8m(kernel),512k(dtb),-(fs)" /* diff --git a/include/configs/BSC9132QDS.h b/include/configs/BSC9132QDS.h index 92ff88b..a62498c 100644 --- a/include/configs/BSC9132QDS.h +++ b/include/configs/BSC9132QDS.h @@ -544,8 +544,8 @@ combinations. this should be removed later #define CONFIG_MTD_DEVICE #define CONFIG_MTD_PARTITIONS #define CONFIG_FLASH_CFI_MTD -#define MTDIDS_DEFAULT "nor0=8800.nor,nand0=ff80.flash," -#define MTDPARTS_DEFAULT "mtdparts=8800.nor:256k(dtb),7m(kernel)," \ +#define CONFIG_MTDIDS_DEFAULT "nor0=8800.nor,nand0=ff80.flash," +#define CONFIG_MTDPARTS_DEFAULT "mtdparts=8800.nor:256k(dtb),7m(kernel)," \ "55m(fs),1m(uboot);ff80.flash:1m(uboot)," \ "8m(kernel),512k(dtb),-(fs)" #endif diff --git a/include/configs/M54418TWR.h b/include/configs/M54418TWR.h index 66a17f2..71bb72f 100644 --- a/include/configs/M54418TWR.h +++ b/include/configs/M54418TWR.h @@ -305,9 +305,9 @@ #define CONFIG_JFFS2_DEV "nand0" #define CONFIG_JFFS2_PART_OFFSET (0x80) #define CONFIG_MTD_DEVICE -#define MTDIDS_DEFAULT "nand0=m54418twr.nand" +#define CONFIG_MTDIDS_DEFAULT "nand0=m54418twr.nand" -#define MTDPARTS_DEFAULT "mtdparts=m54418twr.nand:1m(data)," \ +#define CONFIG_MTDPARTS_DEFAULT"mtdparts=m54418twr.nand:1m(data)," \ "7m(kernel)," \ "-(rootfs)" @@ -316,8 +316,8 @@ #ifdef CONFIG_CMD_UBI #define CONFIG_MTD_DEVICE /* needed for mtdparts command */ #define CONFIG_MTD_PARTITIONS /* mtdparts and UBI support */ -#define MTDIDS_DEFAULT "nand0=NAND" -#define MTDPARTS_DEFAULT "mtdparts=NAND:1m(u-boot)," \ +#define CONFIG_MTDIDS_DEFAULT "nand0=NAND" +#define CONFIG_MTDPARTS_DEFAULT"mtdparts=NAND:1m(u-boot)," \ "-(ubi)" #endif /* Cache Configuration */ diff --git a/include/configs/MPC8313ERDB.h b/include/configs/MPC8313ERDB.h index 3a031a8..7add27a 100644 --- a/include/configs/MPC8313ERDB.h +++ b/include/configs/MPC8313ERDB.h @@ -259,8 +259,8 @@ #define CONFIG_MTD_DEVICE #define CONFIG_MTD_PARTITION -#define MTDIDS_DEFAULT "nand0=e280.flash" -#define MTDPARTS_DEFAULT \ +#define CONFIG_MTDIDS_DEFAULT "nand0=e280.flash" +#define CONFIG_MTDPARTS_DEFAULT\ "mtdparts=e280.flash:512k(uboot),128k(env),6m@1m(kernel),-(fs)" #define CONFIG_SYS_MAX_NAND_DEVICE 1 diff --git a/include/configs/MPC8315ERDB.h b/include/configs/MPC8315ERDB.h index e2cc815..dd58b28 100644 --- a/include/configs/MPC8315ERDB.h +++ b/include/configs/MPC8315ERDB.h @@ -235,8 +235,8 @@ #define CONFIG_MTD_DEVICE #define CONFIG_MTD_PARTITION -#define MTDIDS_DEFAULT "nand0=e060.flash" -#define MTDPARTS_DEFAULT \ +#define CONFIG_MTDIDS_DEFAULT "nand0=e060.flash" +#define CONFIG_MTDPARTS_DEFAULT\ "mtdparts=e060.flash:512k(uboot),128k(env),6m@1m(kernel),-(fs)" #define CONFIG_SYS_MAX_NAND_DEVICE 1 diff --git a/include/configs/P1010RDB.h b/include/configs/P1010RDB.h index c19339b..beca7ee 100644 --- a/include/configs/P1010RDB.h +++ b/include/configs/P1010RDB.h @@ -352,8 +352,8 @@ extern unsigned long get_sdram_size(void); #define CONFIG_MTD_DEVICE #define CONFIG_MTD_PARTITION -#define MTDIDS_DEFAULT "nand0=ff80.flash" -#define MTDPARTS_DEFAULT \ +#define CONFIG_MTDIDS_DEFAULT "nand0=ff80.flash" +#define CONFIG_MTDPARTS_DEFAULT\ "mtdparts=ff80.flash:2m(uboot-env),1m(dtb),5m(kernel),56m(fs),-(usr)" #define CONFIG_SYS_NAND_CSPR (CSPR_PHYS_ADDR(CONFIG_SYS_NAND_BASE_PHYS) \ diff --git a/include/configs/P1022DS.h b/include/configs/P1022DS.h index 8c83f2d..d86aa30 100644 --- a/include/configs/P1022DS.h +++ b/include/configs/P1022DS.h @@ -533,13 +533,13 @@ #define CONFIG_MTD_PARTITIONS #define CONFIG_FLASH_CFI_MTD #ifdef CONFIG_PHYS_64BIT -#define MTDIDS_DEFAULT
[U-Boot] [PATCH 2/2] Convert CONFIG_SYS_NAND_ECCSIZE et al to Kconfig
This converts the following to Kconfig: CONFIG_SYS_NAND_ECCSIZE CONFIG_SYS_NAND_ECCBYTES CONFIG_SYS_NAND_ECCSTEPS CONFIG_SYS_NAND_MAX_ECCPOS CONFIG_SYS_NAND_MAX_OOBFREE Signed-off-by: Adam Ford--- README | 4 arch/arm/include/asm/arch-lpc32xx/config.h | 2 -- configs/B4420QDS_NAND_defconfig | 2 ++ configs/B4420QDS_SPIFLASH_defconfig | 2 ++ configs/B4420QDS_defconfig | 2 ++ configs/B4860QDS_NAND_defconfig | 2 ++ configs/B4860QDS_SECURE_BOOT_defconfig | 2 ++ configs/B4860QDS_SPIFLASH_defconfig | 2 ++ configs/B4860QDS_SRIO_PCIE_BOOT_defconfig| 2 ++ configs/B4860QDS_defconfig | 2 ++ configs/CHIP_pro_defconfig | 1 + configs/MPC8572DS_36BIT_defconfig| 2 ++ configs/MPC8572DS_defconfig | 2 ++ configs/P1022DS_36BIT_NAND_defconfig | 2 ++ configs/P1022DS_36BIT_SDCARD_defconfig | 2 ++ configs/P1022DS_36BIT_SPIFLASH_defconfig | 2 ++ configs/P1022DS_36BIT_defconfig | 2 ++ configs/P1022DS_NAND_defconfig | 2 ++ configs/P1022DS_SDCARD_defconfig | 2 ++ configs/P1022DS_SPIFLASH_defconfig | 2 ++ configs/P1022DS_defconfig| 2 ++ configs/T4160QDS_NAND_defconfig | 2 ++ configs/T4160QDS_SDCARD_defconfig| 2 ++ configs/T4160QDS_SECURE_BOOT_defconfig | 2 ++ configs/T4160QDS_defconfig | 2 ++ configs/T4160RDB_defconfig | 2 ++ configs/T4240QDS_NAND_defconfig | 2 ++ configs/T4240QDS_SDCARD_defconfig| 2 ++ configs/T4240QDS_SECURE_BOOT_defconfig | 2 ++ configs/T4240QDS_SRIO_PCIE_BOOT_defconfig| 2 ++ configs/T4240QDS_defconfig | 2 ++ configs/T4240RDB_SDCARD_defconfig| 2 ++ configs/T4240RDB_defconfig | 2 ++ configs/am335x_baltos_defconfig | 1 + configs/am335x_evm_defconfig | 1 + configs/am335x_evm_nor_defconfig | 1 + configs/am335x_evm_usbspl_defconfig | 1 + configs/am335x_hs_evm_defconfig | 1 + configs/am335x_igep003x_defconfig| 1 + configs/am3517_crane_defconfig | 1 + configs/am3517_evm_defconfig | 3 +++ configs/am43xx_evm_defconfig | 1 + configs/am43xx_evm_ethboot_defconfig | 1 + configs/am43xx_evm_usbhost_boot_defconfig| 1 + configs/am43xx_hs_evm_defconfig | 1 + configs/at91sam9m10g45ek_nandflash_defconfig | 2 ++ configs/axm_defconfig| 2 ++ configs/brppt1_nand_defconfig| 1 + configs/cairo_defconfig | 1 + configs/chiliboard_defconfig | 1 + configs/cm_t335_defconfig| 1 + configs/cm_t35_defconfig | 1 + configs/cm_t43_defconfig | 1 + configs/corvus_defconfig | 2 ++ configs/devkit3250_defconfig | 2 ++ configs/devkit8000_defconfig | 1 + configs/draco_defconfig | 2 ++ configs/eco5pk_defconfig | 2 ++ configs/etamin_defconfig | 2 ++ configs/igep0032_defconfig | 1 + configs/igep00x0_defconfig | 1 + configs/ipam390_defconfig| 1 + configs/ls2080a_simu_defconfig | 2 ++ configs/ls2080aqds_SECURE_BOOT_defconfig | 2 ++ configs/ls2080aqds_defconfig | 2 ++ configs/ls2080aqds_nand_defconfig| 2 ++ configs/ls2080aqds_qspi_defconfig| 2 ++ configs/ls2080aqds_sdcard_defconfig | 2 ++ configs/ls2080ardb_SECURE_BOOT_defconfig | 2 ++ configs/ls2080ardb_defconfig | 2 ++ configs/ls2080ardb_nand_defconfig| 2 ++ configs/mcx_defconfig| 2 ++ configs/mt_ventoux_defconfig | 2 ++ configs/omap3_beagle_defconfig | 1 + configs/omap3_evm_defconfig | 1 + configs/omap3_ha_defconfig | 1 + configs/omap3_logic_defconfig| 3 +++ configs/omap3_overo_defconfig| 2 ++ configs/omapl138_lcdk_defconfig | 1 + configs/pengwyn_defconfig| 2 ++ configs/pxm2_defconfig | 2 ++ configs/rastaban_defconfig | 2 ++ configs/rut_defconfig| 2 ++ configs/smartweb_defconfig | 2 ++ configs/tao3530_defconfig| 1 + configs/taurus_defconfig | 2 ++ configs/thuban_defconfig | 2 ++ configs/ti816x_evm_defconfig | 1 + configs/tricorder_defconfig
[U-Boot] [PATCH 1/2] Fix boards missing CONFIG_NAND after Kconfig migration
Several boards need CONFIG_NAND in order to migrate additional settings to Kconfig. These configs include: SYS_NAND_ECCSIZE, SYS_NAND_ECCBYTES, SYS_NAND_ECCSTEPS, SYS_NAND_MAX_ECCPOS, and SYS_NAND_MAX_OOBFREE Fixes 5bbc265becbe ("Convert CONFIG_NAND to Kconfig") Signed-off-by: Adam Ford--- configs/B4420QDS_SPIFLASH_defconfig | 1 + configs/B4420QDS_defconfig | 1 + configs/B4860QDS_SECURE_BOOT_defconfig | 1 + configs/B4860QDS_SPIFLASH_defconfig | 1 + configs/B4860QDS_SRIO_PCIE_BOOT_defconfig| 1 + configs/B4860QDS_defconfig | 1 + configs/MPC8572DS_36BIT_defconfig| 1 + configs/MPC8572DS_defconfig | 1 + configs/P1022DS_36BIT_SDCARD_defconfig | 1 + configs/P1022DS_36BIT_SPIFLASH_defconfig | 1 + configs/P1022DS_36BIT_defconfig | 1 + configs/P1022DS_SDCARD_defconfig | 1 + configs/P1022DS_SPIFLASH_defconfig | 1 + configs/P1022DS_defconfig| 1 + configs/T4160QDS_SDCARD_defconfig| 1 + configs/T4160QDS_SECURE_BOOT_defconfig | 1 + configs/T4160QDS_defconfig | 1 + configs/T4160RDB_defconfig | 1 + configs/T4240QDS_SDCARD_defconfig| 1 + configs/T4240QDS_SECURE_BOOT_defconfig | 1 + configs/T4240QDS_SRIO_PCIE_BOOT_defconfig| 1 + configs/T4240QDS_defconfig | 1 + configs/T4240RDB_SDCARD_defconfig| 1 + configs/T4240RDB_defconfig | 1 + configs/am3517_crane_defconfig | 1 + configs/at91sam9m10g45ek_nandflash_defconfig | 1 + configs/axm_defconfig| 1 + configs/cm_t35_defconfig | 1 + configs/corvus_defconfig | 1 + configs/devkit3250_defconfig | 1 + configs/ipam390_defconfig| 1 + configs/ls2080a_simu_defconfig | 1 + configs/ls2080aqds_SECURE_BOOT_defconfig | 1 + configs/ls2080aqds_defconfig | 1 + configs/ls2080aqds_qspi_defconfig| 1 + configs/ls2080aqds_sdcard_defconfig | 1 + configs/ls2080ardb_SECURE_BOOT_defconfig | 1 + configs/ls2080ardb_defconfig | 1 + configs/omap3_evm_defconfig | 1 + configs/omap3_ha_defconfig | 1 + configs/smartweb_defconfig | 1 + configs/tao3530_defconfig| 1 + configs/taurus_defconfig | 1 + configs/tricorder_defconfig | 1 + configs/tricorder_flash_defconfig| 1 + 45 files changed, 45 insertions(+) diff --git a/configs/B4420QDS_SPIFLASH_defconfig b/configs/B4420QDS_SPIFLASH_defconfig index 6e37669..b6583d2 100644 --- a/configs/B4420QDS_SPIFLASH_defconfig +++ b/configs/B4420QDS_SPIFLASH_defconfig @@ -22,6 +22,7 @@ CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_FSL_CAAM=y # CONFIG_MMC is not set CONFIG_MTD_NOR_FLASH=y +CONFIG_NAND=y CONFIG_SPI_FLASH=y CONFIG_SPI_FLASH_SST=y CONFIG_PHYLIB=y diff --git a/configs/B4420QDS_defconfig b/configs/B4420QDS_defconfig index beeaa82..95f4fb2 100644 --- a/configs/B4420QDS_defconfig +++ b/configs/B4420QDS_defconfig @@ -21,6 +21,7 @@ CONFIG_ENV_IS_IN_FLASH=y CONFIG_FSL_CAAM=y # CONFIG_MMC is not set CONFIG_MTD_NOR_FLASH=y +CONFIG_NAND=y CONFIG_SPI_FLASH=y CONFIG_SPI_FLASH_SST=y CONFIG_PHYLIB=y diff --git a/configs/B4860QDS_SECURE_BOOT_defconfig b/configs/B4860QDS_SECURE_BOOT_defconfig index f756d00..ddf26db 100644 --- a/configs/B4860QDS_SECURE_BOOT_defconfig +++ b/configs/B4860QDS_SECURE_BOOT_defconfig @@ -22,6 +22,7 @@ CONFIG_CMD_EXT2=y CONFIG_DM=y # CONFIG_MMC is not set CONFIG_MTD_NOR_FLASH=y +CONFIG_NAND=y CONFIG_SPI_FLASH=y CONFIG_SPI_FLASH_SST=y CONFIG_PHYLIB=y diff --git a/configs/B4860QDS_SPIFLASH_defconfig b/configs/B4860QDS_SPIFLASH_defconfig index e9a4a07..3eb9b3a 100644 --- a/configs/B4860QDS_SPIFLASH_defconfig +++ b/configs/B4860QDS_SPIFLASH_defconfig @@ -22,6 +22,7 @@ CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_FSL_CAAM=y # CONFIG_MMC is not set CONFIG_MTD_NOR_FLASH=y +CONFIG_NAND=y CONFIG_SPI_FLASH=y CONFIG_SPI_FLASH_SST=y CONFIG_PHYLIB=y diff --git a/configs/B4860QDS_SRIO_PCIE_BOOT_defconfig b/configs/B4860QDS_SRIO_PCIE_BOOT_defconfig index e89b132..600e055 100644 --- a/configs/B4860QDS_SRIO_PCIE_BOOT_defconfig +++ b/configs/B4860QDS_SRIO_PCIE_BOOT_defconfig @@ -23,6 +23,7 @@ CONFIG_CMD_EXT2=y CONFIG_ENV_IS_IN_REMOTE=y CONFIG_FSL_CAAM=y # CONFIG_MMC is not set +CONFIG_NAND=y CONFIG_SPI_FLASH=y CONFIG_SPI_FLASH_SST=y CONFIG_PHYLIB=y diff --git a/configs/B4860QDS_defconfig b/configs/B4860QDS_defconfig index 5a22a8b..995808f 100644 --- a/configs/B4860QDS_defconfig +++ b/configs/B4860QDS_defconfig @@ -21,6 +21,7 @@ CONFIG_ENV_IS_IN_FLASH=y CONFIG_FSL_CAAM=y # CONFIG_MMC is not set CONFIG_MTD_NOR_FLASH=y +CONFIG_NAND=y CONFIG_SPI_FLASH=y CONFIG_SPI_FLASH_SST=y CONFIG_PHYLIB=y diff --git
[U-Boot] [PATCH] mvebu: turris_omnia: Only set eth?addr env if CONFIG_CMD_NET
Otherwise the linking will fail since eth_env_set_enetaddr cannot be found. Signed-off-by: Marek Behun--- board/CZ.NIC/turris_omnia/turris_omnia.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c index af66837909..7db3b8ff3b 100644 --- a/board/CZ.NIC/turris_omnia/turris_omnia.c +++ b/board/CZ.NIC/turris_omnia/turris_omnia.c @@ -470,6 +470,7 @@ out: return 0; } +#if defined(CONFIG_ATSHA204A) && defined(CONFIG_CMD_NET) static void increment_mac(u8 *mac) { int i; @@ -480,10 +481,11 @@ static void increment_mac(u8 *mac) break; } } +#endif int misc_init_r(void) { -#ifdef CONFIG_ATSHA204A +#if defined(CONFIG_ATSHA204A) && defined(CONFIG_CMD_NET) int err; struct udevice *dev = get_atsha204a_dev(); u8 mac0[4], mac1[4], mac[6]; -- 2.13.5 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 1/1] scripts/Makefile.lib: remove overridden target $(obj)/helloworld.so:
On 03.09.17 08:17, Heinrich Schuchardt wrote: The target $(obj)/helloworld.so: exists twice in Makefile.lib. If you add an echo command to each of the two recipes you get warnings like: scripts/Makefile.lib:383: warning: overriding recipe for target 'drivers/power/battery/helloworld.so' scripts/Makefile.lib:379: warning: ignoring old recipe for target 'drivers/power/battery/helloworld.so' This patch removes the obsolete target. Signed-off-by: Heinrich Schuchardt--- Hello Alex, could you, please, review the change as it relates to EFI. My Makefile foo isn't quite as good as it should be, but doesn't the existing code simply add another dependency to the required build chain? Alex Best regards Heinrich --- scripts/Makefile.lib | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 9ce47b4d22..7f97e8ebf3 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -375,8 +375,6 @@ cmd_efi_ld = $(LD) -nostdlib -znocombreloc -T $(EFI_LDS_PATH) -shared \ EFI_LDS_PATH = $(srctree)/arch/$(ARCH)/lib/$(EFI_LDS) -$(obj)/helloworld.so: $(EFI_LDS_PATH) - $(obj)/helloworld.so: $(obj)/helloworld.o arch/$(ARCH)/lib/$(EFI_CRT0) \ arch/$(ARCH)/lib/$(EFI_RELOC) $(call cmd,efi_ld) ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] efi_loader: Fix efi_exit gd clobbering
Commit f494950b (efi_loader: call __efi_exit_check in efi_exit) added a call to __efi_exit_check inside efi_exit to account for the fact that we're exiting the efi_exit function via a longjmp call. However, __efi_exit_check also swizzles gd to the application gd while the longjmp will put us back into EFI context, so we need the efi (u-boot) gd. This patch fixes that up by explicitly setting gd back to efi_gd before doing the longjmp. It also adds a few comments on why it does that. Signed-off-by: Alexander Graf--- lib/efi_loader/efi_boottime.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index 99c5a6ee0c..90e9ead7b2 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -798,8 +798,15 @@ static efi_status_t EFIAPI efi_exit(efi_handle_t image_handle, EFI_ENTRY("%p, %ld, %ld, %p", image_handle, exit_status, exit_data_size, exit_data); + /* Make sure entry/exit counts for EFI world cross-overs match */ __efi_exit_check(); + /* +* But longjmp out with the U-Boot gd, not the application's, as +* the other end is a setjmp call inside EFI context. +*/ + efi_restore_gd(); + loaded_image_info->exit_status = exit_status; longjmp(_image_info->exit_jmp, 1); -- 2.12.3 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 2/2] Makefile: Suppress output of python libfdt build command
This should not be printed by default. Prefix it with $(Q). Fixes ee95d10b: ("fdt: Build the new python libfdt module") Signed-off-by: Bin Meng--- tools/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/Makefile b/tools/Makefile index 5605fa7..a0db19d 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -131,8 +131,8 @@ fit_check_sign-objs := $(dumpimage-mkimage-objs) fit_check_sign.o # all three files in $(obj)/tools: _libfdt.so, libfdt.py and libfdt_wrap.c # The latter is a temporary file which we could actually remove. tools/_libfdt.so: $(LIBFDT_SRCS) $(LIBFDT_SWIG) - cp $(LIBFDT_SWIG) tools/. - unset CC; \ + $(Q)cp $(LIBFDT_SWIG) tools/. + $(Q)unset CC; \ unset CROSS_COMPILE; \ LDFLAGS="$(HOSTLDFLAGS)" CFLAGS= VERSION="u-boot-$(UBOOTVERSION)" \ CPPFLAGS="$(_hostc_flags)" OBJDIR=tools \ -- 2.9.2 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 1/2] Makefile: Quiesce libfdt build
Since commit 3809e302 "Makefile: honor PYTHON configuration properly", the build commands of libfdt are printed while previously were not. This adds the missing '--quiet' back. Signed-off-by: Bin Meng--- tools/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/Makefile b/tools/Makefile index 086c533..5605fa7 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -138,7 +138,7 @@ tools/_libfdt.so: $(LIBFDT_SRCS) $(LIBFDT_SWIG) CPPFLAGS="$(_hostc_flags)" OBJDIR=tools \ SOURCES="$(LIBFDT_SRCS) tools/libfdt.i" \ SWIG_OPTS="-I$(srctree)/lib/libfdt -I$(srctree)/lib" \ - $(PYTHON) $(libfdt_tree)/pylibfdt/setup.py build_ext \ + $(PYTHON) $(libfdt_tree)/pylibfdt/setup.py --quiet build_ext \ --build-lib tools ifneq ($(CONFIG_MX23)$(CONFIG_MX28),) -- 2.9.2 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] Please pull u-boot-x86
On Sat, Sep 02, 2017 at 11:56:45PM +0800, Bin Meng wrote: > Hi Tom, > > These are some bug fixes for v2017.09. > > The following changes since commit 6ef2f90108e2cf101d931c71ea7904f2b6301641: > > Convert CONFIG_BCH to Kconfig (2017-09-01 20:45:26 -0400) > > are available in the git repository at: > > git://git.denx.de/u-boot-x86.git > > for you to fetch changes up to f04034cba4c2351da5b54ae36f5a30e3ccfce1cc: > > x86: theadorable-x86-common: Remove "ip=dhcp" from default > environment (2017-09-02 23:49:34 +0800) > Applied to u-boot/master, thanks! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v1 2/2] x86: edison: Bring ACPI minimal support to the board
On Wed, Aug 30, 2017 at 11:04 PM, Andy Shevchenkowrote: > This board is based on Intel Tangier SoC (Intel Merrifield platform) > and may utilize ACPI powerfulness. > > Bring minimum support by appending initial DSDT table for it. > > Note, the addresses for generated tables are carefully chosen to avoid > any conflicts with existing shadowed BIOS data. The user have somewhat > like ~31 kB available for compiled ACPI tables that ought to be enough. > > Signed-off-by: Andy Shevchenko > --- > board/intel/edison/.gitignore | 3 +++ > board/intel/edison/Kconfig| 6 ++ > board/intel/edison/Makefile | 1 + > board/intel/edison/dsdt.asl | 13 + > include/configs/edison.h | 3 +++ > 5 files changed, 26 insertions(+) > create mode 100644 board/intel/edison/.gitignore > create mode 100644 board/intel/edison/dsdt.asl > Reviewed-by: Bin Meng ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v1 1/2] x86: tangier: Enable ACPI support for Intel Tangier
Hi Andy, On Wed, Aug 30, 2017 at 11:04 PM, Andy Shevchenkowrote: > Intel Tangier SoC is a part of Intel Merrifield platform which doesn't > utilize ACPI by default. Here is an attempt to unleash ACPI flexibility > power on Intel Merrifield based platforms. > > The change brings minimum support of the devices that found on > Intel Merrifield based end user device. > > Signed-off-by: Andy Shevchenko > --- > arch/x86/cpu/tangier/Makefile | 1 + > arch/x86/cpu/tangier/acpi.c| 86 ++ > .../include/asm/arch-tangier/acpi/global_nvs.asl | 16 ++ > .../x86/include/asm/arch-tangier/acpi/platform.asl | 31 +++ > .../include/asm/arch-tangier/acpi/southcluster.asl | 306 > + > arch/x86/include/asm/arch-tangier/global_nvs.h | 22 ++ > 6 files changed, 462 insertions(+) > create mode 100644 arch/x86/cpu/tangier/acpi.c > create mode 100644 arch/x86/include/asm/arch-tangier/acpi/global_nvs.asl > create mode 100644 arch/x86/include/asm/arch-tangier/acpi/platform.asl > create mode 100644 arch/x86/include/asm/arch-tangier/acpi/southcluster.asl > create mode 100644 arch/x86/include/asm/arch-tangier/global_nvs.h > Generally it looks good. Some comments below. > diff --git a/arch/x86/cpu/tangier/Makefile b/arch/x86/cpu/tangier/Makefile > index d146b3f5c2..92cfa555ed 100644 > --- a/arch/x86/cpu/tangier/Makefile > +++ b/arch/x86/cpu/tangier/Makefile > @@ -5,3 +5,4 @@ > # > > obj-y += car.o tangier.o sdram.o > +obj-$(CONFIG_GENERATE_ACPI_TABLE) += acpi.o > diff --git a/arch/x86/cpu/tangier/acpi.c b/arch/x86/cpu/tangier/acpi.c > new file mode 100644 > index 00..fb15ce40ad > --- /dev/null > +++ b/arch/x86/cpu/tangier/acpi.c > @@ -0,0 +1,86 @@ > +/* > + * Copyright (c) 2017 Intel Corporation > + * > + * Partially based on acpi.c for other x86 platforms > + * > + * SPDX-License-Identifier:GPL-2.0+ > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +void acpi_create_fadt(struct acpi_fadt *fadt, struct acpi_facs *facs, > + void *dsdt) > +{ > + struct acpi_table_header *header = &(fadt->header); > + > + memset((void *)fadt, 0, sizeof(struct acpi_fadt)); > + > + acpi_fill_header(header, "FACP"); > + header->length = sizeof(struct acpi_fadt); > + header->revision = 6; > + > + fadt->firmware_ctrl = (u32)facs; > + fadt->dsdt = (u32)dsdt; > + fadt->preferred_pm_profile = ACPI_PM_UNSPECIFIED; > + > + fadt->iapc_boot_arch = ACPI_FADT_VGA_NOT_PRESENT | > + ACPI_FADT_NO_PCIE_ASPM_CONTROL; > + fadt->flags = > + ACPI_FADT_WBINVD | > + ACPI_FADT_POWER_BUTTON | ACPI_FADT_SLEEP_BUTTON | > + ACPI_FADT_SEALED_CASE | ACPI_FADT_HEADLESS | > + ACPI_FADT_HW_REDUCED_ACPI; > + > + fadt->minor_revision = 2; > + > + fadt->x_firmware_ctl_l = (u32)facs; > + fadt->x_firmware_ctl_h = 0; > + fadt->x_dsdt_l = (u32)dsdt; > + fadt->x_dsdt_h = 0; > + > + header->checksum = table_compute_checksum(fadt, header->length); > +} > + > +u32 acpi_fill_madt(u32 current) > +{ > + current += acpi_create_madt_lapics(current); > + > + current += acpi_create_madt_ioapic((struct acpi_madt_ioapic *)current, > + io_apic_read(IO_APIC_ID) >> 24, IO_APIC_ADDR, 0); > + > + return current; > +} > + > +u32 acpi_fill_mcfg(u32 current) > +{ > + current += acpi_create_mcfg_mmconfig > + ((struct acpi_mcfg_mmconfig *)current, > + 0x3f50, 0x0, 0x0, 0x0); What is 0x3f50? Can we define something in asm/arch/iomap.h (like Baytrail) and use it here? And I see the end_bus_number is set to zero here, why? Is this table a faked one? How about completely drop this table? Does Linux boot without this table? > + > + return current; > +} > + > +void acpi_create_gnvs(struct acpi_global_nvs *gnvs) > +{ > + struct udevice *dev; > + int ret; > + > + /* at least we have one processor */ > + gnvs->pcnt = 1; > + > + /* override the processor count with actual number */ > + ret = uclass_find_first_device(UCLASS_CPU, ); > + if (ret == 0 && dev != NULL) { > + ret = cpu_get_count(dev); > + if (ret > 0) > + gnvs->pcnt = ret; > + } > +} > diff --git a/arch/x86/include/asm/arch-tangier/acpi/global_nvs.asl > b/arch/x86/include/asm/arch-tangier/acpi/global_nvs.asl > new file mode 100644 > index 00..84fffbe140 > --- /dev/null > +++ b/arch/x86/include/asm/arch-tangier/acpi/global_nvs.asl > @@ -0,0 +1,16 @@ > +/* > + * Copyright (c) 2017 Intel Corporation > + * > + * Partially based on global_nvs.asl for other x86 platforms > + * > + * SPDX-License-Identifier:GPL-2.0+ > + */ >
[U-Boot] [PATCH 1/1] scripts/Makefile.lib: remove overridden target $(obj)/helloworld.so:
The target $(obj)/helloworld.so: exists twice in Makefile.lib. If you add an echo command to each of the two recipes you get warnings like: scripts/Makefile.lib:383: warning: overriding recipe for target 'drivers/power/battery/helloworld.so' scripts/Makefile.lib:379: warning: ignoring old recipe for target 'drivers/power/battery/helloworld.so' This patch removes the obsolete target. Signed-off-by: Heinrich Schuchardt--- Hello Alex, could you, please, review the change as it relates to EFI. Best regards Heinrich --- scripts/Makefile.lib | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 9ce47b4d22..7f97e8ebf3 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -375,8 +375,6 @@ cmd_efi_ld = $(LD) -nostdlib -znocombreloc -T $(EFI_LDS_PATH) -shared \ EFI_LDS_PATH = $(srctree)/arch/$(ARCH)/lib/$(EFI_LDS) -$(obj)/helloworld.so: $(EFI_LDS_PATH) - $(obj)/helloworld.so: $(obj)/helloworld.o arch/$(ARCH)/lib/$(EFI_CRT0) \ arch/$(ARCH)/lib/$(EFI_RELOC) $(call cmd,efi_ld) -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot