wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 1 | #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 Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 11 | * SPDX-License-Identifier: GPL-2.0+ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 12 | */ |
| 13 | |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 14 | #include <linux/list.h> |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 15 | |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 16 | /* mtd device types */ |
Kyungmin Park | 2538374 | 2008-08-27 14:45:20 +0900 | [diff] [blame] | 17 | #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") |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 23 | |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 24 | struct 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 */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 29 | }; |
| 30 | |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 31 | struct part_info { |
| 32 | struct list_head link; |
| 33 | char *name; /* partition name */ |
| 34 | u8 auto_name; /* set to 1 for generated name */ |
| 35 | u32 size; /* total size of the partition */ |
| 36 | u32 offset; /* offset within device */ |
| 37 | void *jffs2_priv; /* used internaly by jffs2 */ |
| 38 | u32 mask_flags; /* kernel MTD mask flags */ |
Ilya Yanok | 85cceb5 | 2008-11-13 19:49:32 +0300 | [diff] [blame] | 39 | u32 sector_size; /* size of sector */ |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 40 | struct mtd_device *dev; /* parent device */ |
| 41 | }; |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 42 | |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 43 | struct mtdids { |
| 44 | struct list_head link; |
| 45 | u8 type; /* device type */ |
| 46 | u8 num; /* device number */ |
| 47 | u32 size; /* device size */ |
| 48 | char *mtd_id; /* linux kernel device id */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 49 | }; |
| 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 Park | ad7ae36 | 2008-11-19 16:32:36 +0100 | [diff] [blame] | 63 | /* common/cmd_jffs2.c */ |
| 64 | extern int mtdparts_init(void); |
| 65 | extern int find_dev_and_part(const char *id, struct mtd_device **dev, |
| 66 | u8 *part_num, struct part_info **part); |
Anatolij Gustschin | 6c44c38 | 2010-03-16 17:10:05 +0100 | [diff] [blame] | 67 | extern struct mtd_device *device_find(u8 type, u8 num); |
Kyungmin Park | ad7ae36 | 2008-11-19 16:32:36 +0100 | [diff] [blame] | 68 | |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 69 | #endif /* load_kernel_h */ |