2018-05-06 21:58:06 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0+ */
|
2002-11-03 00:38:21 +00:00
|
|
|
#ifndef load_kernel_h
|
|
|
|
#define load_kernel_h
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* Filename: load_kernel.h
|
|
|
|
* Version: $Id: load_kernel.h,v 1.3 2002/01/25 01:34:11 nyet Exp $
|
|
|
|
* Copyright: Copyright (C) 2001, Russ Dill
|
|
|
|
* Author: Russ Dill <Russ.Dill@asu.edu>
|
|
|
|
* Description: header for load kernel modules
|
|
|
|
*-----------------------------------------------------------------------*/
|
|
|
|
|
2005-08-07 23:03:24 +00:00
|
|
|
#include <linux/list.h>
|
2002-11-03 00:38:21 +00:00
|
|
|
|
2005-08-07 23:03:24 +00:00
|
|
|
/* mtd device types */
|
2008-08-27 05:45:20 +00:00
|
|
|
#define MTD_DEV_TYPE_NOR 0x0001
|
|
|
|
#define MTD_DEV_TYPE_NAND 0x0002
|
|
|
|
#define MTD_DEV_TYPE_ONENAND 0x0004
|
2018-09-06 07:08:45 +00:00
|
|
|
#define MTD_DEV_TYPE_SPINAND 0x0008
|
2008-08-27 05:45:20 +00:00
|
|
|
|
2018-09-06 07:08:45 +00:00
|
|
|
#define MTD_DEV_TYPE(type) (type == MTD_DEV_TYPE_NAND ? "nand" : \
|
|
|
|
(type == MTD_DEV_TYPE_NOR ? "nor" : \
|
|
|
|
(type == MTD_DEV_TYPE_ONENAND ? "onenand" : \
|
|
|
|
"spi-nand"))) \
|
2002-11-03 00:38:21 +00:00
|
|
|
|
2005-08-07 23:03:24 +00:00
|
|
|
struct mtd_device {
|
|
|
|
struct list_head link;
|
|
|
|
struct mtdids *id; /* parent mtd id entry */
|
|
|
|
u16 num_parts; /* number of partitions on this device */
|
|
|
|
struct list_head parts; /* partitions */
|
2002-11-03 00:38:21 +00:00
|
|
|
};
|
|
|
|
|
2005-08-07 23:03:24 +00:00
|
|
|
struct part_info {
|
|
|
|
struct list_head link;
|
|
|
|
char *name; /* partition name */
|
|
|
|
u8 auto_name; /* set to 1 for generated name */
|
2013-09-04 14:16:57 +00:00
|
|
|
u64 size; /* total size of the partition */
|
|
|
|
u64 offset; /* offset within device */
|
2005-08-07 23:03:24 +00:00
|
|
|
void *jffs2_priv; /* used internaly by jffs2 */
|
|
|
|
u32 mask_flags; /* kernel MTD mask flags */
|
2008-11-13 16:49:32 +00:00
|
|
|
u32 sector_size; /* size of sector */
|
2005-08-07 23:03:24 +00:00
|
|
|
struct mtd_device *dev; /* parent device */
|
|
|
|
};
|
2002-11-03 00:38:21 +00:00
|
|
|
|
2005-08-07 23:03:24 +00:00
|
|
|
struct mtdids {
|
|
|
|
struct list_head link;
|
|
|
|
u8 type; /* device type */
|
|
|
|
u8 num; /* device number */
|
2013-09-04 14:16:57 +00:00
|
|
|
u64 size; /* device size */
|
2005-08-07 23:03:24 +00:00
|
|
|
char *mtd_id; /* linux kernel device id */
|
2002-11-03 00:38:21 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#define ldr_strlen strlen
|
|
|
|
#define ldr_strncmp strncmp
|
|
|
|
#define ldr_memcpy memcpy
|
|
|
|
#define putstr(x) printf("%s", x)
|
|
|
|
#define mmalloc malloc
|
|
|
|
#define UDEBUG printf
|
|
|
|
|
|
|
|
#define putnstr(str, size) printf("%*.*s", size, size, str)
|
|
|
|
#define ldr_output_string(x) puts(x)
|
|
|
|
#define putLabeledWord(x, y) printf("%s %08x\n", x, (unsigned int)y)
|
|
|
|
#define led_blink(x, y, z, a)
|
|
|
|
|
2008-11-19 15:32:36 +00:00
|
|
|
/* common/cmd_jffs2.c */
|
|
|
|
extern int mtdparts_init(void);
|
|
|
|
extern int find_dev_and_part(const char *id, struct mtd_device **dev,
|
|
|
|
u8 *part_num, struct part_info **part);
|
2010-03-16 16:10:05 +00:00
|
|
|
extern struct mtd_device *device_find(u8 type, u8 num);
|
2008-11-19 15:32:36 +00:00
|
|
|
|
2002-11-03 00:38:21 +00:00
|
|
|
#endif /* load_kernel_h */
|