summaryrefslogtreecommitdiff
path: root/disk/part_toc.h
blob: fbe7624ba560d352849ebd4e89b9245547603557 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
 * Copyright (C) ST-Ericsson SA 2010
 * Author: Peter Nessrup <peter.nessrup@stericsson.com> for
 * ST-Ericsson.
 * License terms: GNU General Public License (GPL), version 2.
 */
#ifndef _DISK_PART_TOC_H
#define _DISK_PART_TOC_H

#define SUPPORTED_SECTOR_SIZE	512
#define TOC_MAGIC		"ISSW"
#define TOC_ID_NO_ENTRY	"\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
#define TOC_MAX_ENTRIES		(SUPPORTED_SECTOR_SIZE/sizeof(toc_entry_t))
#define MAX_NUM_TOCS		4
#define TOC_BOOT_IMAGE_SIZE	(0x20000 / SUPPORTED_SECTOR_SIZE)
#define NO_TOC			-1
#define TOC_ID_LENGTH		12

/* Sub TOC identifier in the 'flags' field is 'ST' */
#define FLAGS_SUB_TOC		0x00005354
#define FLAGS_PARTITION		0x00000001

typedef struct __attribute__ ((__packed__)) {
	u32 offset;
	u32 size;
	u32 flags;
	u32 align;
	u32 loadaddr;
	u8  id[TOC_ID_LENGTH];
} toc_entry_t;

typedef struct {
	u8  id[TOC_ID_LENGTH];
	u32 num_items;
	u32 location;
	u32 cached_section;
	toc_entry_t cache[TOC_MAX_ENTRIES];
} subtoc_t;

typedef struct {
	u32 start;
	u32 size;
	u8  name[12];
	u32 cfg_offset;
	u32 type;
	u32 unused;
} toc_part_entry_t;
#endif	/* _DISK_PART_TOC_H */