Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 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 | *-----------------------------------------------------------------------*/ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 11 | |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 12 | #include <linux/list.h> |
Tom Rini | dec7ea0 | 2024-05-20 13:35:03 -0600 | [diff] [blame] | 13 | #include <linux/string.h> |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 14 | |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 15 | /* mtd device types */ |
Kyungmin Park | 2538374 | 2008-08-27 14:45:20 +0900 | [diff] [blame] | 16 | #define MTD_DEV_TYPE_NOR 0x0001 |
| 17 | #define MTD_DEV_TYPE_NAND 0x0002 |
| 18 | #define MTD_DEV_TYPE_ONENAND 0x0004 |
Miquel Raynal | ceb9cae | 2018-09-06 09:08:45 +0200 | [diff] [blame] | 19 | #define MTD_DEV_TYPE_SPINAND 0x0008 |
Kyungmin Park | 2538374 | 2008-08-27 14:45:20 +0900 | [diff] [blame] | 20 | |
Miquel Raynal | ceb9cae | 2018-09-06 09:08:45 +0200 | [diff] [blame] | 21 | #define MTD_DEV_TYPE(type) (type == MTD_DEV_TYPE_NAND ? "nand" : \ |
| 22 | (type == MTD_DEV_TYPE_NOR ? "nor" : \ |
| 23 | (type == MTD_DEV_TYPE_ONENAND ? "onenand" : \ |
| 24 | "spi-nand"))) \ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 25 | |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 26 | struct mtd_device { |
| 27 | struct list_head link; |
| 28 | struct mtdids *id; /* parent mtd id entry */ |
| 29 | u16 num_parts; /* number of partitions on this device */ |
| 30 | struct list_head parts; /* partitions */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 31 | }; |
| 32 | |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 33 | struct part_info { |
| 34 | struct list_head link; |
| 35 | char *name; /* partition name */ |
| 36 | u8 auto_name; /* set to 1 for generated name */ |
Paul Burton | 5f578df | 2013-09-04 15:16:57 +0100 | [diff] [blame] | 37 | u64 size; /* total size of the partition */ |
| 38 | u64 offset; /* offset within device */ |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 39 | void *jffs2_priv; /* used internaly by jffs2 */ |
| 40 | u32 mask_flags; /* kernel MTD mask flags */ |
Ilya Yanok | 85cceb5 | 2008-11-13 19:49:32 +0300 | [diff] [blame] | 41 | u32 sector_size; /* size of sector */ |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 42 | struct mtd_device *dev; /* parent device */ |
| 43 | }; |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 44 | |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 45 | struct mtdids { |
| 46 | struct list_head link; |
| 47 | u8 type; /* device type */ |
| 48 | u8 num; /* device number */ |
Paul Burton | 5f578df | 2013-09-04 15:16:57 +0100 | [diff] [blame] | 49 | u64 size; /* device size */ |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 50 | char *mtd_id; /* linux kernel device id */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 51 | }; |
| 52 | |
| 53 | #define ldr_strlen strlen |
| 54 | #define ldr_strncmp strncmp |
| 55 | #define ldr_memcpy memcpy |
| 56 | #define putstr(x) printf("%s", x) |
| 57 | #define mmalloc malloc |
| 58 | #define UDEBUG printf |
| 59 | |
| 60 | #define putnstr(str, size) printf("%*.*s", size, size, str) |
| 61 | #define ldr_output_string(x) puts(x) |
| 62 | #define putLabeledWord(x, y) printf("%s %08x\n", x, (unsigned int)y) |
| 63 | #define led_blink(x, y, z, a) |
| 64 | |
Kyungmin Park | ad7ae36 | 2008-11-19 16:32:36 +0100 | [diff] [blame] | 65 | /* common/cmd_jffs2.c */ |
| 66 | extern int mtdparts_init(void); |
| 67 | extern int find_dev_and_part(const char *id, struct mtd_device **dev, |
| 68 | u8 *part_num, struct part_info **part); |
Anatolij Gustschin | 6c44c38 | 2010-03-16 17:10:05 +0100 | [diff] [blame] | 69 | extern struct mtd_device *device_find(u8 type, u8 num); |
Kyungmin Park | ad7ae36 | 2008-11-19 16:32:36 +0100 | [diff] [blame] | 70 | |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 71 | #endif /* load_kernel_h */ |