8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / cmd / boot / installboot / i386 / installboot.h
blob741f1cb682da13193b1879779199d184bbac22e8
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
22 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
24 * Copyright 2016 Toomas Soome <tsoome@me.com>
27 #ifndef _INSTALLBOOT_H
28 #define _INSTALLBOOT_H
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
34 #include <sys/multiboot.h>
35 #include <sys/types.h>
37 #define SECTOR_SIZE (512)
39 /* partitioning type for device */
40 enum ig_devtype_t {
41 IG_DEV_VTOC = 0,
42 IG_DEV_MBR,
43 IG_DEV_EFI
46 /* file system type */
47 enum ig_fstype_t {
48 IG_FS_NONE = 0,
49 IG_FS_ZFS,
50 IG_FS_UFS,
51 IG_FS_PCFS
54 /* partition info for boot block location. */
55 struct stage_part {
56 char *path; /* device name */
57 int fd; /* open file descriptor */
58 int id; /* partition/slice number */
59 enum ig_devtype_t devtype; /* partitioning type */
60 enum ig_fstype_t fstype; /* none or pcfs */
61 uint64_t start; /* partition LBA */
62 uint64_t size; /* partition size */
63 uint64_t offset; /* block offset */
66 /* boot device data */
67 typedef struct _ib_device {
68 char *path; /* whole disk */
69 int fd; /* whole disk fd */
70 enum ig_devtype_t devtype;
71 struct stage_part stage; /* location of boot block */
72 struct stage_part target; /* target file system */
73 char mbr[SECTOR_SIZE];
74 } ib_device_t;
76 /* stage 2 location */
77 typedef struct _ib_bootblock {
78 char *buf;
79 char *file;
80 char *extra;
81 multiboot_header_t *mboot;
82 uint32_t mboot_off;
83 uint32_t file_size;
84 uint32_t buf_size;
85 uint32_t extra_size;
86 } ib_bootblock_t;
88 typedef struct _ib_data {
89 unsigned char stage1[SECTOR_SIZE]; /* partition boot block */
90 ib_device_t device; /* boot device */
91 ib_bootblock_t bootblock; /* stage 2 */
92 } ib_data_t;
94 #define BBLK_BLKLIST_OFF 50 /* vtoc/disk boot offset */
95 #define BBLK_ZFS_BLK_OFF 1024 /* vdev boot offset */
96 #define BBLK_ZFS_BLK_SIZE (7ULL << 19) /* vdev max boot size */
98 /* locations of MBR parts, must be reviewd if mbr code is changed */
99 #define STAGE1_BPB_OFFSET (0x3) /* technically BPB starts at 0xb */
100 #define STAGE1_BPB_SIZE (0x3b)
101 #define STAGE1_MBR_VERSION (0xfa) /* 2 bytes, not used */
102 #define STAGE1_STAGE2_SIZE (0xfc) /* 16bits */
103 #define STAGE1_STAGE2_LBA (0xfe) /* 64bits */
104 #define STAGE1_STAGE2_UUID (0x106) /* 128bits */
105 #define STAGE1_SIG (0x1b8) /* 4+2 bytes */
106 #define STAGE1_PARTTBL (0x1be) /* MBR partition table */
107 #define STAGE1_MAGIC (0x1fe) /* 0xAA55 */
108 #ifdef __cplusplus
110 #endif
112 #endif /* _INSTALLBOOT_H */