part.h 6.6 KB
Newer Older
W
wdenk 已提交
1
/*
2
 * (C) Copyright 2000-2004
W
wdenk 已提交
3 4 5 6 7 8 9 10 11 12 13 14
 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
 *
 * See file CREDITS for list of people who contributed to this
 * project.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of
 * the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
W
wdenk 已提交
16 17 18 19 20 21 22 23 24
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 * MA 02111-1307 USA
 */
#ifndef _PART_H
#define _PART_H
25

W
wdenk 已提交
26
#include <ide.h>
W
wdenk 已提交
27 28

typedef struct block_dev_desc {
29
	int		if_type;	/* type of the interface */
30 31
	int		dev;		/* device number */
	unsigned char	part_type;	/* partition type */
32 33 34 35 36 37 38
	unsigned char	target;		/* target SCSI ID */
	unsigned char	lun;		/* target LUN */
	unsigned char	type;		/* device type */
	unsigned char	removable;	/* removable device */
#ifdef CONFIG_LBA48
	unsigned char	lba48;		/* device can use 48bit addr (ATA/ATAPI v7) */
#endif
39
	lbaint_t	lba;		/* number of blocks */
40
	unsigned long	blksz;		/* block size */
41
	char		vendor [40+1];	/* IDE model, SCSI Vendor */
M
Marcel Ziswiler 已提交
42 43
	char		product[20+1];	/* IDE Serial no, SCSI product */
	char		revision[8+1];	/* firmware revision */
44 45
	unsigned long	(*block_read)(int dev,
				      unsigned long start,
W
wdenk 已提交
46
				      lbaint_t blkcnt,
47
				      void *buffer);
48 49 50 51
	unsigned long	(*block_write)(int dev,
				       unsigned long start,
				       lbaint_t blkcnt,
				       const void *buffer);
52 53 54
	unsigned long   (*block_erase)(int dev,
				       unsigned long start,
				       lbaint_t blkcnt);
55
	void		*priv;		/* driver private struct pointer */
W
wdenk 已提交
56
}block_dev_desc_t;
57

W
wdenk 已提交
58
/* Interface types: */
59 60
#define IF_TYPE_UNKNOWN		0
#define IF_TYPE_IDE		1
W
wdenk 已提交
61 62
#define IF_TYPE_SCSI		2
#define IF_TYPE_ATAPI		3
63 64
#define IF_TYPE_USB		4
#define IF_TYPE_DOC		5
W
wdenk 已提交
65
#define IF_TYPE_MMC		6
S
stefano babic 已提交
66
#define IF_TYPE_SD		7
67
#define IF_TYPE_SATA		8
68

W
wdenk 已提交
69
/* Part types */
70
#define PART_TYPE_UNKNOWN	0x00
W
wdenk 已提交
71 72 73
#define PART_TYPE_MAC		0x01
#define PART_TYPE_DOS		0x02
#define PART_TYPE_ISO		0x03
74
#define PART_TYPE_AMIGA		0x04
75
#define PART_TYPE_EFI		0x05
W
wdenk 已提交
76

77 78 79 80 81 82
/*
 * Type string for U-Boot bootable partitions
 */
#define BOOT_PART_TYPE	"U-Boot"	/* primary boot partition type	*/
#define BOOT_PART_COMP	"PPCBoot"	/* PPCBoot compatibility type	*/

W
wdenk 已提交
83
/* device types */
84 85
#define DEV_TYPE_UNKNOWN	0xff	/* not connected */
#define DEV_TYPE_HARDDISK	0x00	/* harddisk */
86 87 88
#define DEV_TYPE_TAPE		0x01	/* Tape */
#define DEV_TYPE_CDROM		0x05	/* CD-ROM */
#define DEV_TYPE_OPDISK		0x07	/* optical disk */
W
wdenk 已提交
89

90
typedef struct disk_partition {
W
wdenk 已提交
91 92 93 94 95
	ulong	start;		/* # of first block in partition	*/
	ulong	size;		/* number of blocks in partition	*/
	ulong	blksz;		/* block size in bytes			*/
	uchar	name[32];	/* partition name			*/
	uchar	type[32];	/* string type description		*/
96
	int	bootable;	/* Active/Bootable flag is set		*/
97 98 99
#ifdef CONFIG_PARTITION_UUIDS
	char	uuid[37];	/* filesystem UUID as string, if exists	*/
#endif
W
wdenk 已提交
100 101
} disk_partition_t;

102
/* Misc _get_dev functions */
103
#ifdef CONFIG_PARTITIONS
104
block_dev_desc_t *get_dev(const char *ifname, int dev);
105
block_dev_desc_t* ide_get_dev(int dev);
106
block_dev_desc_t* sata_get_dev(int dev);
107 108 109 110
block_dev_desc_t* scsi_get_dev(int dev);
block_dev_desc_t* usb_stor_get_dev(int dev);
block_dev_desc_t* mmc_get_dev(int dev);
block_dev_desc_t* systemace_get_dev(int dev);
U
unsik Kim 已提交
111
block_dev_desc_t* mg_disk_get_dev(int dev);
112

W
wdenk 已提交
113 114 115 116 117
/* disk/part.c */
int get_partition_info (block_dev_desc_t * dev_desc, int part, disk_partition_t *info);
void print_part (block_dev_desc_t *dev_desc);
void  init_part (block_dev_desc_t *dev_desc);
void dev_print(block_dev_desc_t *dev_desc);
S
Stephen Warren 已提交
118 119
int get_device(const char *ifname, const char *dev_str,
	       block_dev_desc_t **dev_desc);
120
int get_device_and_partition(const char *ifname, const char *dev_part_str,
121
			     block_dev_desc_t **dev_desc,
122
			     disk_partition_t *info, int allow_whole_dev);
123
#else
124 125
static inline block_dev_desc_t *get_dev(const char *ifname, int dev)
{ return NULL; }
126 127 128 129 130 131 132
static inline block_dev_desc_t* ide_get_dev(int dev) { return NULL; }
static inline block_dev_desc_t* sata_get_dev(int dev) { return NULL; }
static inline block_dev_desc_t* scsi_get_dev(int dev) { return NULL; }
static inline block_dev_desc_t* usb_stor_get_dev(int dev) { return NULL; }
static inline block_dev_desc_t* mmc_get_dev(int dev) { return NULL; }
static inline block_dev_desc_t* systemace_get_dev(int dev) { return NULL; }
static inline block_dev_desc_t* mg_disk_get_dev(int dev) { return NULL; }
W
wdenk 已提交
133

134 135 136 137 138
static inline int get_partition_info (block_dev_desc_t * dev_desc, int part,
	disk_partition_t *info) { return -1; }
static inline void print_part (block_dev_desc_t *dev_desc) {}
static inline void  init_part (block_dev_desc_t *dev_desc) {}
static inline void dev_print(block_dev_desc_t *dev_desc) {}
S
Stephen Warren 已提交
139 140 141
static inline int get_device(const char *ifname, const char *dev_str,
	       block_dev_desc_t **dev_desc)
{ return -1; }
142
static inline int get_device_and_partition(const char *ifname,
143
					   const char *dev_part_str,
144
					   block_dev_desc_t **dev_desc,
145 146
					   disk_partition_t *info,
					   int allow_whole_dev)
147
{ *dev_desc = NULL; return -1; }
148
#endif
W
wdenk 已提交
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170

#ifdef CONFIG_MAC_PARTITION
/* disk/part_mac.c */
int get_partition_info_mac (block_dev_desc_t * dev_desc, int part, disk_partition_t *info);
void print_part_mac (block_dev_desc_t *dev_desc);
int   test_part_mac (block_dev_desc_t *dev_desc);
#endif

#ifdef CONFIG_DOS_PARTITION
/* disk/part_dos.c */
int get_partition_info_dos (block_dev_desc_t * dev_desc, int part, disk_partition_t *info);
void print_part_dos (block_dev_desc_t *dev_desc);
int   test_part_dos (block_dev_desc_t *dev_desc);
#endif

#ifdef CONFIG_ISO_PARTITION
/* disk/part_iso.c */
int get_partition_info_iso (block_dev_desc_t * dev_desc, int part, disk_partition_t *info);
void print_part_iso (block_dev_desc_t *dev_desc);
int   test_part_iso (block_dev_desc_t *dev_desc);
#endif

W
wdenk 已提交
171 172 173 174 175 176 177
#ifdef CONFIG_AMIGA_PARTITION
/* disk/part_amiga.c */
int get_partition_info_amiga (block_dev_desc_t * dev_desc, int part, disk_partition_t *info);
void print_part_amiga (block_dev_desc_t *dev_desc);
int   test_part_amiga (block_dev_desc_t *dev_desc);
#endif

178 179 180 181 182 183 184
#ifdef CONFIG_EFI_PARTITION
/* disk/part_efi.c */
int get_partition_info_efi (block_dev_desc_t * dev_desc, int part, disk_partition_t *info);
void print_part_efi (block_dev_desc_t *dev_desc);
int   test_part_efi (block_dev_desc_t *dev_desc);
#endif

W
wdenk 已提交
185
#endif /* _PART_H */