blob: dd0d23fa52a48fafab5ea2d29c56c9771ef8afc0 [file] [log] [blame]
wdenkfe8c2802002-11-03 00:38:21 +00001#ifndef load_kernel_h
2#define load_kernel_h
3/*-------------------------------------------------------------------------
4 * Filename: load_kernel.h
5 * Version: $Id: load_kernel.h,v 1.3 2002/01/25 01:34:11 nyet Exp $
6 * Copyright: Copyright (C) 2001, Russ Dill
7 * Author: Russ Dill <Russ.Dill@asu.edu>
8 * Description: header for load kernel modules
9 *-----------------------------------------------------------------------*/
10/*
Wolfgang Denk1a459662013-07-08 09:37:19 +020011 * SPDX-License-Identifier: GPL-2.0+
wdenkfe8c2802002-11-03 00:38:21 +000012 */
13
Wolfgang Denk700a0c62005-08-08 01:03:24 +020014#include <linux/list.h>
wdenkfe8c2802002-11-03 00:38:21 +000015
Wolfgang Denk700a0c62005-08-08 01:03:24 +020016/* mtd device types */
Kyungmin Park1a7f8cc2008-08-27 14:45:20 +090017#define MTD_DEV_TYPE_NOR 0x0001
18#define MTD_DEV_TYPE_NAND 0x0002
19#define MTD_DEV_TYPE_ONENAND 0x0004
20
21#define MTD_DEV_TYPE(type) ((type == MTD_DEV_TYPE_NAND) ? "nand" : \
22 (type == MTD_DEV_TYPE_ONENAND) ? "onenand" : "nor")
wdenkfe8c2802002-11-03 00:38:21 +000023
Wolfgang Denk700a0c62005-08-08 01:03:24 +020024struct mtd_device {
25 struct list_head link;
26 struct mtdids *id; /* parent mtd id entry */
27 u16 num_parts; /* number of partitions on this device */
28 struct list_head parts; /* partitions */
wdenkfe8c2802002-11-03 00:38:21 +000029};
30
Wolfgang Denk700a0c62005-08-08 01:03:24 +020031struct part_info {
32 struct list_head link;
33 char *name; /* partition name */
34 u8 auto_name; /* set to 1 for generated name */
Paul Burton39ac3442013-09-04 15:16:57 +010035 u64 size; /* total size of the partition */
36 u64 offset; /* offset within device */
Wolfgang Denk700a0c62005-08-08 01:03:24 +020037 void *jffs2_priv; /* used internaly by jffs2 */
38 u32 mask_flags; /* kernel MTD mask flags */
Ilya Yanoke0b55322008-11-13 19:49:32 +030039 u32 sector_size; /* size of sector */
Wolfgang Denk700a0c62005-08-08 01:03:24 +020040 struct mtd_device *dev; /* parent device */
41};
wdenkfe8c2802002-11-03 00:38:21 +000042
Wolfgang Denk700a0c62005-08-08 01:03:24 +020043struct mtdids {
44 struct list_head link;
45 u8 type; /* device type */
46 u8 num; /* device number */
Paul Burton39ac3442013-09-04 15:16:57 +010047 u64 size; /* device size */
Wolfgang Denk700a0c62005-08-08 01:03:24 +020048 char *mtd_id; /* linux kernel device id */
wdenkfe8c2802002-11-03 00:38:21 +000049};
50
51#define ldr_strlen strlen
52#define ldr_strncmp strncmp
53#define ldr_memcpy memcpy
54#define putstr(x) printf("%s", x)
55#define mmalloc malloc
56#define UDEBUG printf
57
58#define putnstr(str, size) printf("%*.*s", size, size, str)
59#define ldr_output_string(x) puts(x)
60#define putLabeledWord(x, y) printf("%s %08x\n", x, (unsigned int)y)
61#define led_blink(x, y, z, a)
62
Kyungmin Park7e6ee7a2008-11-19 16:32:36 +010063/* common/cmd_jffs2.c */
64extern int mtdparts_init(void);
65extern int find_dev_and_part(const char *id, struct mtd_device **dev,
66 u8 *part_num, struct part_info **part);
Anatolij Gustschin3c950e22010-03-16 17:10:05 +010067extern struct mtd_device *device_find(u8 type, u8 num);
Kyungmin Park7e6ee7a2008-11-19 16:32:36 +010068
wdenkfe8c2802002-11-03 00:38:21 +000069#endif /* load_kernel_h */