summaryrefslogtreecommitdiffstats
path: root/commands/mem.c
Commit message (Collapse)AuthorAgeFilesLines
* commands: mem: Fix compiler warningSascha Hauer2018-11-191-2/+2
| | | | | | | | resource_size_t may be 32bit on several architectures, so explicitly do a 64bit comparison to avoid "warning: comparison of distinct pointer types lacks a cast". Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* commands: mem: truncate mem device size to fit the loff_t file sizeLucas Stach2018-11-071-1/+2
| | | | | | | | | | On 64bit arches the file covering the whole address space is larger than what can be represented in the loff_t type (s64) used for the file size. Thus the size of this device is interpreted as negative in a lot of places. Fix this by truncating the size to fit the file size type. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* rename file_operations -> cdev_operationsSascha Hauer2018-04-061-1/+1
| | | | | | | | Linux also has struct file_operations which are something different. Rename our file_operations to cdev_operations which better matches what we have. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* commands: exit on invalid optionEnrico Jorns2016-09-161-1/+1
| | | | | | | | | | Barebox commands should not perform any action and return 0 if an invalid parameter was given. This might cause undetected unintended behvaior when calling commands with wrong options, either manually or from a script. Signed-off-by: Enrico Jorns <ejo@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* libfile: move open_and_lseek() to libfileSascha Hauer2016-04-151-23/+0
| | | | | | | libfile is a collection of helpers for handling files. open_and_lseek() is a perfect match for this, so move it there. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mem commands: suppport parsing 'q' optionSascha Hauer2015-05-281-0/+3
| | | | | | Add 64bit ('q', for quad) support to mem_parse_options Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* commands/mem.c: drop non used DEVMEMJean-Christophe PLAGNIOL-VILLARD2013-05-081-2/+0
| | | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* memory commands: separate into one file per commandSascha Hauer2013-04-171-432/+0
| | | | | | | | | | Normally in commands we have one file per command which is named like the command itself. The memory commands are an exception to this. This patch changes this by separating the memory commands. This also has the effect that the memory commands can now be selected individually. Along the way we add some Kconfig help text for the commmands. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* memory commands: make rw_buf globalSascha Hauer2013-04-171-9/+9
| | | | | | | | The rw_buf is used by several memory commands. Make it global since we want to split the memory commands into separate files. Also rename it to mem_rw_buf. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* memory commands: cleanup initializationSascha Hauer2013-04-171-8/+3
| | | | | | | - return -ENOMEM instead of -1 - return the result of platform_driver_register Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Use a common define for RW_BUF_SIZESascha Hauer2013-04-171-1/+0
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* memory commands: move memory_display to separate fileSascha Hauer2013-04-171-68/+0
| | | | | | | | memory_display is a function which should generally be available. Currently it depends on memory command support being compiled in, so move the function to a separate file. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* memory commands: export common functionsSascha Hauer2013-04-171-2/+6
| | | | | | | The memory commands all use open_and_lseek and mem_parse_options. Export them to be able to split the memory commands into separate files. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* commands: mw: add the '-x' option (swap bytes)Antony Pavlov2012-11-261-2/+7
| | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* commands: md: add the '-x' option (swap bytes)Antony Pavlov2012-11-261-7/+17
| | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mem: add the swab (swap bytes) option to memory_display()Antony Pavlov2012-11-261-4/+13
| | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* switch all platform_bus device/driver registering to ↵Jean-Christophe PLAGNIOL-VILLARD2012-10-041-1/+1
| | | | | | | | platform_driver/device_register now register_driver and register_device are for bus only usage. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* Treewide: remove address of the Free Software FoundationSascha Hauer2012-09-171-4/+0
| | | | | | | The FSF address has changed in the past. Instead of updating it each time the address changes, just drop it completely treewide. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* commands: memset: fix help messageAntony Pavlov2012-08-091-3/+2
| | | | | | | | memset has no '-s' option so remove related help string. Also this patch makes the command's description more clear. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mem md: make md -s /dev/something work againSascha Hauer2012-08-011-2/+3
| | | | | | | | | | | | | | | | | | | | | | Since |commit d22b85a203aea20a2b2618f5f457fe96c502868d |Author: Sascha Hauer <s.hauer@pengutronix.de> |Date: Wed Jul 4 23:41:13 2012 +0200 | | mem md: bail out without arguments | | Without arguments the 'md' command defaults to show address 0 which | likely results in a NULL pointer exception, so only three keystrokes | are necessary to crash barebox. Show usage instead if 'md' is invoked | without arguments, so that it at least requires an address to be given | to crash barebox. This increases the stability of barebox by 66%. Hurray! barebox does not crash any longer when a plain 'md' without additional arguments is exectuted. However, doing a 'md -s /dev/nor0' was a standard usecase which now does not work anymore. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mem md: bail out without argumentsSascha Hauer2012-07-051-0/+2
| | | | | | | | | | Without arguments the 'md' command defaults to show address 0 which likely results in a NULL pointer exception, so only three keystrokes are necessary to crash barebox. Show usage instead if 'md' is invoked without arguments, so that it at least requires an address to be given to crash barebox. This increases the stability of barebox by 66%. Hurray! Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/resource-size'Sascha Hauer2012-07-021-1/+1
|\ | | | | | | | | | | Conflicts: drivers/base/resource.c fs/fs.c
| * resource: store 'end' instead of 'size' in struct resourceSascha Hauer2012-07-011-1/+1
| | | | | | | | | | | | | | | | | | | | Storing the size instead of the resource end in struct resource was a mistake. 'size' ranges from 0 to UINT[32|64]_MAX + 1 which obviously leads to problems. 'end' on the other hand will never exceed UINT[32|64]_MAX. Also this way we can express a iomem region covering the whole address space. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/devnull'Sascha Hauer2012-07-021-29/+0
|\ \ | | | | | | | | | | | | Conflicts: commands/mem.c
| * | Move /dev/zero to separate unitAlexander Shiyan2012-06-301-29/+0
| |/ | | | | | | | | | | | | | | | | This patch allows to present "/dev/zero" always in system and not depending of mem-command. Standard files allow to test other memory devices, not only "mem", such as NOR, NAND, MCI-devices e.t.c. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | memory commands: Make 64bit capableSascha Hauer2012-06-301-20/+19
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | make memory display 64bit capableSascha Hauer2012-06-301-2/+2
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | make parse_area_spec arguments loff_tSascha Hauer2012-06-301-2/+2
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | use loff_t for file offsetsSascha Hauer2012-06-301-1/+1
|/ | | | | | | This is a first step for 64bit file support: Make the file sizes/offsets 64bit. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* lseek: return -1 instead of -errnoSascha Hauer2012-05-181-2/+2
| | | | | | | | | | The patch making errno a positive value has another bug: lseek was switched to return -errno instead of -1. This does not work since we can lseek we can address the whole 4G address space, have of which has a negative offset when interpreted as a signed integer. Let lseek return -1 on failure again instead. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Make errno a positive valueSascha Hauer2012-05-141-6/+4
| | | | | | | | | Normally errno contains a positive error value. A certain unnamed developer mixed this up while implementing U-Boot-v2. Also, normally errno is never set to zero by any library function. This patch fixes this. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* commands: remove struct command pointer from commandsSascha Hauer2012-02-271-5/+5
| | | | | | This is unused in all commands and thus can be removed. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Fix spelling of "omitted"; found by lintianLoïc Minier2011-10-141-1/+1
| | | | | Signed-off-by: Loïc Minier <loic.minier@linaro.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* memcpy command: allow to interruptSascha Hauer2011-08-031-0/+3
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* add a add_mem_device functionSascha Hauer2011-07-181-24/+8
| | | | | | | | | | | Add a helper function for boards to register their memory devices. This makes the board code smaller and also helps getting rid of map_base and struct memory_platform_data. And switch all of the memory to it Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* mem: replace DEVFS_RDWR by IORESOURCE_MEM_WRITEABLEJean-Christophe PLAGNIOL-VILLARD2011-07-181-1/+1
| | | | | | | we keep struct memory_platform_data for now on we will switch off the memories resources to struct resource Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* memcpy command: do not set read/write sizeSascha Hauer2011-04-041-1/+1
| | | | | | | The memcpy command can be much faster if we do not copy in byte mode. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* commands/mem.c: make locally used function staticSascha Hauer2010-10-211-1/+1
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* driver: use id as -1 for auto assigned idJean-Christophe PLAGNIOL-VILLARD2010-09-201-0/+1
| | | | | | | | before if you specify id = 0 the next available id will be taken otherwise fail if already registered now as in linux we use -1 Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'next'Sascha Hauer2010-08-301-1/+3
|\
| * mw: fix help textBaruch Siach2010-08-061-1/+3
| | | | | | | | | | Signed-off-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | md: fix help textBaruch Siach2010-08-041-1/+0
|/ | | | | Signed-off-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* memcpy cmd: Do not expect to read/write the whole chunk at onceSascha Hauer2010-06-241-11/+19
| | | | | | | read() does not necessarily return the number of bytes we want to read, so deal with less bytes. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* remove typedef cmd_tbl_t and replace it with struct commandSascha Hauer2010-02-011-5/+5
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* rename U-Boot-v2 project to bareboxSascha Hauer2009-12-151-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | This has been done with the following script: find -path ./.git -prune -o -type f -print0 | xargs -0 -r sed -i \ -e 's/u2boot/barebox/g' \ -e 's/U2Boot/barebox/g' \ -e 's/U-boot V2/barebox/g' \ -e 's/u-boot v2/barebox/g' \ -e 's/U-Boot V2/barebox/g' \ -e 's/U-Boot-v2/barebox/g' \ -e 's/U_BOOT/BAREBOX/g' \ -e 's/UBOOT/BAREBOX/g' \ -e 's/uboot/barebox/g' \ -e 's/u-boot/barebox/g' \ -e 's/u_boot/barebox/g' \ -e 's/U-Boot/barebox/g' \ -e 's/U-boot/barebox/g' \ -e 's/U-BOOT/barebox/g' find -path ./.git -prune -o \( -name "*u-boot*" -o -name "*uboot*" -o -name "*u_boot*" \) -print0 | \ xargs -0 -r rename 's/u[-_]?boot/barebox/' It needs some manual fixup following in the next patch Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* commands: remove maxargsSascha Hauer2009-10-191-5/+0
| | | | | | | No need to check for maximum argument counts. The commands are safe to be called with more arguments, so lets safe some bytes. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* call getopt_reset only onceSascha Hauer2009-10-191-2/+0
| | | | | | | instead of calling getopt_reset in each command, call it only once before calling the command. Signed-off-by: Sascha Hauer <sha@pengutronix.de>
* commands: return COMMAND_ERROR_USAGESascha Hauer2009-10-191-16/+8
| | | | | | | instead of calling u_boot_cmd_usage in each command to safe space. Signed-off-by: Sascha Hauer <sha@pengutronix.de>
* add memset command to u-bootSascha Hauer2009-07-311-0/+68
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* implement /dev/zeroSascha Hauer2009-07-301-0/+28
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>