diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2020-10-12 08:26:10 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2020-10-13 08:45:15 +0200 |
commit | e3363cf8ff06e9f7db60cca2b89b77a62f7f3a7c (patch) | |
tree | 7651cbad56f682fd8a18ec595c7c1e8d489c454c /arch/sandbox/mach-sandbox | |
parent | 05f622f7bc5baa414e78d9ee1928f08b321f53f8 (diff) | |
download | barebox-e3363cf8ff06e9f7db60cca2b89b77a62f7f3a7c.tar.gz barebox-e3363cf8ff06e9f7db60cca2b89b77a62f7f3a7c.tar.xz |
sandbox: hostfile: unify --image and direct device tree probe
801b7cff0210 ("sandbox: hostfile: allow probing from device tree") added
initial support for probing hostfiles out of a non-fixed up device tree.
This was achieved by having the driver probe call linux_open if the device
tree node doesn't contain a valid barebox,fd property. A mmap did not
happen in that case and as such the node couldn't be used as a syscon.
Fix this by unifying the binding for hostfiles added by --image and ones
already in the device tree. Both will result in a device node with just
a barebox,filename property. On pure init level, both kinds of hostfiles
will be iterated through and filenames will be opened and mmaped.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/sandbox/mach-sandbox')
-rw-r--r-- | arch/sandbox/mach-sandbox/include/mach/hostfile.h | 2 | ||||
-rw-r--r-- | arch/sandbox/mach-sandbox/include/mach/linux.h | 3 |
2 files changed, 5 insertions, 0 deletions
diff --git a/arch/sandbox/mach-sandbox/include/mach/hostfile.h b/arch/sandbox/mach-sandbox/include/mach/hostfile.h index c3f9af97c4..3ef34bcc1c 100644 --- a/arch/sandbox/mach-sandbox/include/mach/hostfile.h +++ b/arch/sandbox/mach-sandbox/include/mach/hostfile.h @@ -8,6 +8,8 @@ struct hf_info { const char *devname; const char *filename; unsigned int is_blockdev:1; + unsigned int is_cdev:1; + unsigned int is_readonly:1; }; int barebox_register_filedev(struct hf_info *hf); diff --git a/arch/sandbox/mach-sandbox/include/mach/linux.h b/arch/sandbox/mach-sandbox/include/mach/linux.h index 1ab48e52a0..7bb022a6de 100644 --- a/arch/sandbox/mach-sandbox/include/mach/linux.h +++ b/arch/sandbox/mach-sandbox/include/mach/linux.h @@ -1,6 +1,8 @@ #ifndef __ASM_ARCH_LINUX_H #define __ASM_ARCH_LINUX_H +struct hf_info; + struct device_d; int sandbox_add_device(struct device_d *dev); @@ -11,6 +13,7 @@ int linux_register_device(const char *name, void *start, void *end); int tap_alloc(const char *dev); uint64_t linux_get_time(void); int linux_open(const char *filename, int readwrite); +int linux_open_hostfile(struct hf_info *hf); int linux_read(int fd, void *buf, size_t count); int linux_read_nonblock(int fd, void *buf, size_t count); ssize_t linux_write(int fd, const void *buf, size_t count); |