summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSantosh Sivaraj <santosh@fossix.org>2019-01-18 09:22:12 +0530
committerStewart Smith <stewart@linux.ibm.com>2019-02-25 21:59:03 -0600
commit3ac2db0a83e70bb7768c64b3fbf480e326c07d10 (patch)
tree49a3807f0fdd86aa595c8bc35555ab39ea277c16 /include
parent647dc4aff7b6a9cbfe2338ae354246650e476bf1 (diff)
downloadtalos-skiboot-3ac2db0a83e70bb7768c64b3fbf480e326c07d10.tar.gz
talos-skiboot-3ac2db0a83e70bb7768c64b3fbf480e326c07d10.zip
flash: Add support for async decompression
Implement a standard API for decompressing images using the existing method found in the IMC code. This patch also standardizes error codes and does the decompression asynchronously. The IMC decompress() function is refactored to decompress blobs/images as a separate CPU job. 'xz_decompress_start()' starts the decompression in a newly created CPU job; while 'wait_xz_decompress()' waits for the job to complete. The IMC code will be first user for the new APIs; whose implementation is provided as reference in the next patch. Signed-off-by: Santosh Sivaraj <santosh@fossix.org> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Diffstat (limited to 'include')
-rw-r--r--include/skiboot.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/include/skiboot.h b/include/skiboot.h
index 6da62233..e828b158 100644
--- a/include/skiboot.h
+++ b/include/skiboot.h
@@ -236,6 +236,40 @@ extern void flash_fw_version_preload(void);
extern void flash_dt_add_fw_version(void);
extern const char *flash_map_resource_name(enum resource_id id);
+/*
+ * Decompression routines
+ *
+ * The below structure members are needed for the xz library routines,
+ * src: Source address (The compressed binary)
+ * src_size: Source size
+ * dst: Destination address (The memory area where the `src` will be
+ * decompressed)
+ * dst_size: Destination size
+ */
+struct xz_decompress {
+ void *dst;
+ void *src;
+ size_t dst_size;
+ size_t src_size;
+ /* The status of the decompress process:
+ - OPAL_PARTIAL: if the job is in progress
+ - OPAL_SUCCESS: if the job is successful
+ - OPAL_NO_MEM: memory allocation failure
+ - OPAL_PARAMETER: If any of the above (src, dst..) are invalid or
+ if xz decompress fails. In which case the caller should check the
+ xz_error for failure reason.
+ */
+ int status;
+ int xz_error;
+ /* The decompression job, this will be freed if the caller uses
+ * `wait_xz_decompression` function, in any other case its the
+ * responsibility of caller to free the allocation job. */
+ struct cpu_job *job;
+};
+
+extern void xz_start_decompress(struct xz_decompress *);
+extern void wait_xz_decompress(struct xz_decompress *);
+
/* NVRAM support */
extern void nvram_init(void);
extern void nvram_read_complete(bool success);
OpenPOWER on IntegriCloud