1/*	$NetBSD: bootinfo.h,v 1.3 1999/09/23 15:14:58 minoura Exp $	*/
2
3/*
4 * Copyright (c) 1998 ITOH, Yasufumi
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 *    notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 *    notice, this list of conditions and the following disclaimer in the
14 *    documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28#ifndef _X68K_BOOTINFO_H_
29#define _X68K_BOOTINFO_H_
30
31/*
32 *	machine dependent boot information
33 *	passed from boot loader to the NetBSD kernel
34 */
35
36/*
37 * NetBSD/x68k uses MAKEBOOTDEV() framework defined in <sys/reboot.h>
38 */
39#include <sys/reboot.h>
40
41/*
42 * for non-SCSI devices
43 */
44/* major */
45#define X68K_MAJOR_FD	2	/* floppy disk */
46#define X68K_MAJOR_MD	8	/* memory disk */
47#define X68K_MAJOR_NE	255	/* network interface: ne */
48
49#define X68K_MAKEBOOTDEV(major, unit, part) \
50	MAKEBOOTDEV(major, 0, 0, unit, part)
51
52
53/*
54 * for SCSI devices
55 *
56 * device major		-> type		(8bit)
57 * type of interface	-> adaptor	(4bit)
58 * unit # of interface	-> controller	(4bit)
59 * target SCSI ID	-> unit		(4bit)
60 * target LUN		-> partition	(3bit; bit 4:6)
61 * partition		-> partition	(4bit; bit 0:3)
62 *
63 * bit #7 of "partition" is reserved for future extension
64 */
65/* major */
66#define X68K_MAJOR_SD	4	/* SCSI disk */
67/*	X68K_MAJOR_ST	5	XXX not yet */
68#define X68K_MAJOR_CD	7	/* SCSI CD-ROM */
69
70/* type_if */
71#define X68K_BOOT_SCSIIF_OLDBOOT	0	/* old boot used this value */
72#define X68K_BOOT_SCSIIF_SPC		1	/* spc */
73#define X68K_BOOT_SCSIIF_MHA		2	/* mha */
74
75#define X68K_MAKESCSIBOOTDEV(major, type_if, unit_if, scsi_id, lun, part) \
76	MAKEBOOTDEV(major, type_if, unit_if, scsi_id, ((lun) << 4) | (part))
77
78#define B_X68K_SCSI_IF(val)	B_ADAPTOR(val)
79#define B_X68K_SCSI_IF_UN(val)	B_CONTROLLER(val)
80
81#define B_X68K_SCSI_ID(val)	B_UNIT(val)
82#define B_X68K_SCSI_LUN(val)	(((val) >> (B_PARTITIONSHIFT + 4)) & 07)
83
84#define B_X68K_SCSI_PART(val)	(((val) >> B_PARTITIONSHIFT) & 017)
85
86#if 0
87/* this bit is reserved for future extension */
88#define B_X68K_SCSI_EXT(val)	(((val) >> (B_PARTITIONSHIFT + 7)) & 01)
89#endif
90
91
92/*
93 * for array initialization
94 */
95
96#define X68K_BOOT_DEV_LIST		\
97	{ "fd", X68K_MAJOR_FD },	\
98	{ "sd", X68K_MAJOR_SD },	\
99	{ "cd", X68K_MAJOR_CD },	\
100	{ "md", X68K_MAJOR_MD }
101
102#define X68K_BOOT_DEV_STRINGS		\
103	NULL, NULL, "fd", NULL, "sd", NULL, NULL, "cd"
104
105#define X68K_BOOT_DEV_IS_SCSI(major)	\
106	((major) == X68K_MAJOR_SD ||	\
107	 (major) == X68K_MAJOR_CD)
108
109#define X68K_BOOT_SCSIIF_LIST		\
110	{ "spc", X68K_BOOT_SCSIIF_SPC },\
111	{ "mha", X68K_BOOT_SCSIIF_MHA }
112
113#define X68K_BOOT_SCSIIF_STRINGS	\
114	NULL, "spc", "mha"
115
116#define X68K_BOOT_NETIF_LIST		\
117	{ "ne", X68K_MAJOR_NE }
118
119#define X68K_BOOT_NETIF_STRINGS		\
120	"ne"
121
122#define X68K_BOOT_DEV_IS_NETIF(major)	\
123	((major) == X68K_MAJOR_NE)
124
125
126/* Kernel boot interface version */
127#define X68K_BOOTIF_VERS	0
128#define X68K_BOOTIF_VERS_COMPAT	0x4e73 /* rte instruction */
129
130#endif /* _X68K_BOOTINFO_H_ */
131