xref: /openbmc/u-boot/include/jffs2/load_kernel.h (revision 87a62bce)
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 #ifndef load_kernel_h
3 #define load_kernel_h
4 /*-------------------------------------------------------------------------
5  * Filename:      load_kernel.h
6  * Version:       $Id: load_kernel.h,v 1.3 2002/01/25 01:34:11 nyet Exp $
7  * Copyright:     Copyright (C) 2001, Russ Dill
8  * Author:        Russ Dill <Russ.Dill@asu.edu>
9  * Description:   header for load kernel modules
10  *-----------------------------------------------------------------------*/
11 
12 #include <linux/list.h>
13 
14 /* mtd device types */
15 #define MTD_DEV_TYPE_NOR	0x0001
16 #define MTD_DEV_TYPE_NAND	0x0002
17 #define MTD_DEV_TYPE_ONENAND	0x0004
18 
19 #define MTD_DEV_TYPE(type) ((type == MTD_DEV_TYPE_NAND) ? "nand" :	\
20 			(type == MTD_DEV_TYPE_ONENAND) ? "onenand" : "nor")
21 
22 struct mtd_device {
23 	struct list_head link;
24 	struct mtdids *id;		/* parent mtd id entry */
25 	u16 num_parts;			/* number of partitions on this device */
26 	struct list_head parts;		/* partitions */
27 };
28 
29 struct part_info {
30 	struct list_head link;
31 	char *name;			/* partition name */
32 	u8 auto_name;			/* set to 1 for generated name */
33 	u64 size;			/* total size of the partition */
34 	u64 offset;			/* offset within device */
35 	void *jffs2_priv;		/* used internaly by jffs2 */
36 	u32 mask_flags;			/* kernel MTD mask flags */
37 	u32 sector_size;		/* size of sector */
38 	struct mtd_device *dev;		/* parent device */
39 };
40 
41 struct mtdids {
42 	struct list_head link;
43 	u8 type;			/* device type */
44 	u8 num;				/* device number */
45 	u64 size;			/* device size */
46 	char *mtd_id;			/* linux kernel device id */
47 };
48 
49 #define ldr_strlen	strlen
50 #define ldr_strncmp	strncmp
51 #define ldr_memcpy	memcpy
52 #define putstr(x)	printf("%s", x)
53 #define mmalloc		malloc
54 #define UDEBUG		printf
55 
56 #define putnstr(str, size)	printf("%*.*s", size, size, str)
57 #define ldr_output_string(x)	puts(x)
58 #define putLabeledWord(x, y)	printf("%s %08x\n", x, (unsigned int)y)
59 #define led_blink(x, y, z, a)
60 
61 /* common/cmd_jffs2.c */
62 extern int mtdparts_init(void);
63 extern int find_dev_and_part(const char *id, struct mtd_device **dev,
64 				u8 *part_num, struct part_info **part);
65 extern struct mtd_device *device_find(u8 type, u8 num);
66 
67 #endif /* load_kernel_h */
68