summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2020-07-01 11:11:09 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2020-07-11 06:14:04 +0200
commita61317abe6661d304d770d9fa6af2328f6a67867 (patch)
tree76db6052d52b03e6e2fcdd981c8a50ee21e733a9
parent666643cb2459390dfd0ed8f9fe5565d10b32806f (diff)
downloadbarebox-a61317abe6661d304d770d9fa6af2328f6a67867.tar.gz
barebox-a61317abe6661d304d770d9fa6af2328f6a67867.tar.xz
pbl: add block I/O API
We already have some PBL MCI implementations in barebox, but none are used for chainloading a barebox from a file system. There are some SoCs that would benefit from this however: At least the Zynq, AT91, SoCFPGA and TI SoCs. In preparation for supporting first stage boot on these where it's customary for both the BootROM and first stage bootloader to load the follow-up stage from FAT, add a very basic block I/O API that MCI drivers can implement. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--include/pbl.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/pbl.h b/include/pbl.h
index f84ed3b7bf..83a058075d 100644
--- a/include/pbl.h
+++ b/include/pbl.h
@@ -6,6 +6,8 @@
#ifndef __PBL_H__
#define __PBL_H__
+#include <linux/types.h>
+
extern unsigned long free_mem_ptr;
extern unsigned long free_mem_end_ptr;
@@ -13,6 +15,18 @@ void pbl_barebox_uncompress(void *dest, void *compressed_start, unsigned int len
#ifdef __PBL__
#define IN_PBL 1
+
+struct pbl_bio {
+ void *priv;
+ int (*read)(struct pbl_bio *bio, off_t block_off, void *buf, unsigned nblocks);
+};
+
+static inline int pbl_bio_read(struct pbl_bio *bio, off_t block_off,
+ void *buf, unsigned nblocks)
+{
+ return bio->read(bio, block_off, buf, nblocks);
+}
+
#else
#define IN_PBL 0
#endif