blob: 4b5cdd91f22ab523385bc576722217869da55a9f [file] [log] [blame]
Harry Liebelf58ad362014-01-10 18:00:33 +00001/*
Masahiro Yamadae3a2b312017-05-08 18:29:03 +09002 * Copyright (c) 2016-2017, ARM Limited and Contributors. All rights reserved.
Harry Liebelf58ad362014-01-10 18:00:33 +00003 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Harry Liebelf58ad362014-01-10 18:00:33 +00005 */
6
dp-arm4972ec52016-05-25 16:20:20 +01007#ifndef __FIPTOOL_H__
8#define __FIPTOOL_H__
Harry Liebelf58ad362014-01-10 18:00:33 +00009
dp-arm4972ec52016-05-25 16:20:20 +010010#include <stddef.h>
Harry Liebelf58ad362014-01-10 18:00:33 +000011#include <stdint.h>
Harry Liebelf58ad362014-01-10 18:00:33 +000012
Masahiro Yamadae3a2b312017-05-08 18:29:03 +090013#include <firmware_image_package.h>
14#include <uuid.h>
Harry Liebelf58ad362014-01-10 18:00:33 +000015
dp-arm4972ec52016-05-25 16:20:20 +010016#define NELEM(x) (sizeof (x) / sizeof *(x))
Harry Liebelf58ad362014-01-10 18:00:33 +000017
dp-arm4972ec52016-05-25 16:20:20 +010018enum {
dp-arm90d2f0e2016-11-14 15:54:32 +000019 DO_UNSPEC = 0,
dp-arm4972ec52016-05-25 16:20:20 +010020 DO_PACK = 1,
21 DO_UNPACK = 2,
22 DO_REMOVE = 3
23};
Harry Liebelf58ad362014-01-10 18:00:33 +000024
dp-arm4972ec52016-05-25 16:20:20 +010025enum {
26 LOG_DBG,
27 LOG_WARN,
28 LOG_ERR
29};
30
dp-arm90d2f0e2016-11-14 15:54:32 +000031typedef struct image_desc {
32 uuid_t uuid;
33 char *name;
34 char *cmdline_name;
35 int action;
36 char *action_arg;
dp-armafa1efa2017-02-14 15:22:13 +000037 struct image *image;
dp-arm90d2f0e2016-11-14 15:54:32 +000038 struct image_desc *next;
39} image_desc_t;
40
dp-arm4972ec52016-05-25 16:20:20 +010041typedef struct image {
Masahiro Yamada2fe0dad2017-01-27 03:56:58 +090042 struct fip_toc_entry toc_e;
43 void *buffer;
dp-arm4972ec52016-05-25 16:20:20 +010044} image_t;
45
46typedef struct cmd {
dp-arm90d2f0e2016-11-14 15:54:32 +000047 char *name;
48 int (*handler)(int, char **);
49 void (*usage)(void);
dp-arm4972ec52016-05-25 16:20:20 +010050} cmd_t;
Harry Liebelf58ad362014-01-10 18:00:33 +000051
dp-arm4972ec52016-05-25 16:20:20 +010052#endif /* __FIPTOOL_H__ */