blob: af3fcbdee730964a8f27ac0f6456f58131ac1e36 [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
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +00007#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
Isla Mitchell751f56b2017-07-14 10:46:32 +010013#include <firmware_image_package.h>
Masahiro Yamadae3a2b312017-05-08 18:29:03 +090014#include <uuid.h>
Harry Liebelf58ad362014-01-10 18:00:33 +000015
Evan Lloyd04dc3442017-05-25 19:06:47 +010016#include "fiptool_platform.h"
17
dp-arm4972ec52016-05-25 16:20:20 +010018#define NELEM(x) (sizeof (x) / sizeof *(x))
Harry Liebelf58ad362014-01-10 18:00:33 +000019
dp-arm4972ec52016-05-25 16:20:20 +010020enum {
dp-arm90d2f0e2016-11-14 15:54:32 +000021 DO_UNSPEC = 0,
dp-arm4972ec52016-05-25 16:20:20 +010022 DO_PACK = 1,
23 DO_UNPACK = 2,
24 DO_REMOVE = 3
25};
Harry Liebelf58ad362014-01-10 18:00:33 +000026
dp-arm4972ec52016-05-25 16:20:20 +010027enum {
28 LOG_DBG,
29 LOG_WARN,
30 LOG_ERR
31};
32
dp-arm90d2f0e2016-11-14 15:54:32 +000033typedef struct image_desc {
34 uuid_t uuid;
35 char *name;
36 char *cmdline_name;
37 int action;
38 char *action_arg;
dp-armafa1efa2017-02-14 15:22:13 +000039 struct image *image;
dp-arm90d2f0e2016-11-14 15:54:32 +000040 struct image_desc *next;
41} image_desc_t;
42
dp-arm4972ec52016-05-25 16:20:20 +010043typedef struct image {
Masahiro Yamada2fe0dad2017-01-27 03:56:58 +090044 struct fip_toc_entry toc_e;
45 void *buffer;
dp-arm4972ec52016-05-25 16:20:20 +010046} image_t;
47
48typedef struct cmd {
dp-arm90d2f0e2016-11-14 15:54:32 +000049 char *name;
50 int (*handler)(int, char **);
51 void (*usage)(void);
dp-arm4972ec52016-05-25 16:20:20 +010052} cmd_t;
Harry Liebelf58ad362014-01-10 18:00:33 +000053
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +000054#endif /* FIPTOOL_H */