xref: /netbsd/sys/arch/zaurus/stand/zboot/disk.h (revision 6550d01e)
1 /*	$NetBSD: disk.h,v 1.1 2009/03/02 09:33:02 nonaka Exp $	*/
2 /*	$OpenBSD: disk.h,v 1.1 2005/05/24 20:38:20 uwe Exp $	*/
3 
4 /*
5  * Copyright (c) 1997 Tobias Weingartner
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  * SUCH DAMAGE.
28  *
29  */
30 
31 #ifndef _STAND_DISK_H
32 #define _STAND_DISK_H
33 
34 #include <sys/disklabel.h>
35 #include <sys/queue.h>
36 
37 #define	MAXDEVNAME	16
38 
39 /* XXX snatched from <i386/biosdev.h> */
40 #if 1
41 /* Info about disk from the bios, plus the mapping from
42  * BIOS numbers to BSD major (driver?) number.
43  *
44  * Also, do not bother with BIOSN*() macros, just parcel
45  * the info out, and use it like this.  This makes for less
46  * of a dependance on BIOSN*() macros having to be the same
47  * across /boot, /bsd, and userland.
48  */
49 #define	BOOTARG_DISKINFO 1
50 typedef struct _bios_diskinfo {
51 	/* BIOS section */
52 	int bios_number;	/* BIOS number of drive (or -1) */
53 
54 	/* Misc. flags */
55 	uint32_t flags;
56 #define BDI_INVALID	0x00000001	/* I/O error during checksumming */
57 #define BDI_GOODLABEL	0x00000002	/* Had SCSI or ST506/ESDI disklabel */
58 #define BDI_BADLABEL	0x00000004	/* Had another disklabel */
59 #define BDI_EL_TORITO	0x00000008	/* 2,048-byte sectors */
60 #define BDI_PICKED	0x80000000	/* kernel-only: cksum matched */
61 } bios_diskinfo_t;
62 
63 #define	BOOTARG_CKSUMLEN 3		/* uint32_t */
64 #endif /* 1 */
65 
66 /* All the info on a disk we've found */
67 struct diskinfo {
68 	bios_diskinfo_t bios_info;
69 	struct disklabel disklabel;
70 	char devname[MAXDEVNAME];
71 
72 	TAILQ_ENTRY(diskinfo) list;
73 };
74 TAILQ_HEAD(disklist_lh, diskinfo);
75 
76 /* diskprobe.c */
77 void diskprobe(char *buf, size_t bufsiz);
78 struct diskinfo *dkdevice(const char *, uint);
79 int bios_devname(int, char *, int);
80 void bios_devpath(int, int, char *);
81 char *bios_getdiskinfo(int, bios_diskinfo_t *);
82 int bios_getdospart(bios_diskinfo_t *);
83 char *bios_getdisklabel(bios_diskinfo_t *, struct disklabel *);
84 void dump_diskinfo(void);
85 
86 #endif /* _STAND_DISK_H */
87