bootinfo.h revision 1.2 1 /* $NetBSD: bootinfo.h,v 1.2 1998/12/14 15:22:04 itohy 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
48 #define X68K_MAKEBOOTDEV(major, unit, part) \
49 MAKEBOOTDEV(major, 0, 0, unit, part)
50
51
52 /*
53 * for SCSI devices
54 *
55 * device major -> type (8bit)
56 * type of interface -> adaptor (4bit)
57 * unit # of interface -> controller (4bit)
58 * target SCSI ID -> unit (4bit)
59 * target LUN -> partition (3bit; bit 4:6)
60 * partition -> partition (4bit; bit 0:3)
61 *
62 * bit #7 of "partition" is reserved for future extension
63 */
64 /* major */
65 #define X68K_MAJOR_SD 4 /* SCSI disk */
66 /* X68K_MAJOR_ST 5 XXX not yet */
67 #define X68K_MAJOR_CD 7 /* SCSI CD-ROM */
68
69 /* type_if */
70 #define X68K_BOOT_SCSIIF_OLDBOOT 0 /* old boot used this value */
71 #define X68K_BOOT_SCSIIF_SPC 1 /* spc */
72 #define X68K_BOOT_SCSIIF_MHA 2 /* mha */
73
74 #define X68K_MAKESCSIBOOTDEV(major, type_if, unit_if, scsi_id, lun, part) \
75 MAKEBOOTDEV(major, type_if, unit_if, scsi_id, ((lun) << 4) | (part))
76
77 #define B_X68K_SCSI_IF(val) B_ADAPTOR(val)
78 #define B_X68K_SCSI_IF_UN(val) B_CONTROLLER(val)
79
80 #define B_X68K_SCSI_ID(val) B_UNIT(val)
81 #define B_X68K_SCSI_LUN(val) (((val) >> (B_PARTITIONSHIFT + 4)) & 07)
82
83 #define B_X68K_SCSI_PART(val) (((val) >> B_PARTITIONSHIFT) & 017)
84
85 #if 0
86 /* this bit is reserved for future extension */
87 #define B_X68K_SCSI_EXT(val) (((val) >> (B_PARTITIONSHIFT + 7)) & 01)
88 #endif
89
90
91 /*
92 * for array initialization
93 */
94
95 #define X68K_BOOT_DEV_LIST \
96 { "fd", X68K_MAJOR_FD }, \
97 { "sd", X68K_MAJOR_SD }, \
98 { "cd", X68K_MAJOR_CD }, \
99 { "md", X68K_MAJOR_MD }
100
101 #define X68K_BOOT_DEV_STRINGS \
102 NULL, NULL, "fd", NULL, "sd", NULL, NULL, "cd"
103
104 #define X68K_BOOT_DEV_IS_SCSI(major) \
105 ((major) == X68K_MAJOR_SD || \
106 (major) == X68K_MAJOR_CD)
107
108 #define X68K_BOOT_SCSIIF_LIST \
109 { "spc", X68K_BOOT_SCSIIF_SPC },\
110 { "mha", X68K_BOOT_SCSIIF_MHA }
111
112 #define X68K_BOOT_SCSIIF_STRINGS \
113 NULL, "spc", "mha"
114
115 #endif /* _X68K_BOOTINFO_H_ */
116