blob: 889b0fde58a70a7c43bf57e6c67085c5523799bc [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
Isla Mitchell99305012017-07-11 14:54:08 +010010#include <firmware_image_package.h>
11
dp-arm4972ec52016-05-25 16:20:20 +010012#include <stddef.h>
Harry Liebelf58ad362014-01-10 18:00:33 +000013#include <stdint.h>
Harry Liebelf58ad362014-01-10 18:00:33 +000014
Masahiro Yamadae3a2b312017-05-08 18:29:03 +090015#include <uuid.h>
Harry Liebelf58ad362014-01-10 18:00:33 +000016
dp-arm4972ec52016-05-25 16:20:20 +010017#define NELEM(x) (sizeof (x) / sizeof *(x))
Harry Liebelf58ad362014-01-10 18:00:33 +000018
dp-arm4972ec52016-05-25 16:20:20 +010019enum {
dp-arm90d2f0e2016-11-14 15:54:32 +000020 DO_UNSPEC = 0,
dp-arm4972ec52016-05-25 16:20:20 +010021 DO_PACK = 1,
22 DO_UNPACK = 2,
23 DO_REMOVE = 3
24};
Harry Liebelf58ad362014-01-10 18:00:33 +000025
dp-arm4972ec52016-05-25 16:20:20 +010026enum {
27 LOG_DBG,
28 LOG_WARN,
29 LOG_ERR
30};
31
dp-arm90d2f0e2016-11-14 15:54:32 +000032typedef struct image_desc {
33 uuid_t uuid;
34 char *name;
35 char *cmdline_name;
36 int action;
37 char *action_arg;
dp-armafa1efa2017-02-14 15:22:13 +000038 struct image *image;
dp-arm90d2f0e2016-11-14 15:54:32 +000039 struct image_desc *next;
40} image_desc_t;
41
dp-arm4972ec52016-05-25 16:20:20 +010042typedef struct image {
Masahiro Yamada2fe0dad2017-01-27 03:56:58 +090043 struct fip_toc_entry toc_e;
44 void *buffer;
dp-arm4972ec52016-05-25 16:20:20 +010045} image_t;
46
47typedef struct cmd {
dp-arm90d2f0e2016-11-14 15:54:32 +000048 char *name;
49 int (*handler)(int, char **);
50 void (*usage)(void);
dp-arm4972ec52016-05-25 16:20:20 +010051} cmd_t;
Harry Liebelf58ad362014-01-10 18:00:33 +000052
dp-arm4972ec52016-05-25 16:20:20 +010053#endif /* __FIPTOOL_H__ */