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]
22 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright 2016 Nexenta Systems, Inc. All rights reserved.
26 #ifndef _INSTALLGRUB_H
27 #define _INSTALLGRUB_H
33 #include <sys/multiboot.h>
34 #include "./../common/bblk_einfo.h"
36 #define SECTOR_SIZE (512)
38 typedef struct _device_data
{
46 uint64_t start_sector
;
47 char boot_sector
[SECTOR_SIZE
];
50 typedef struct _stage2_data
{
54 multiboot_header_t
*mboot
;
59 uint32_t first_sector
;
60 uint32_t pcfs_first_sectors
[2];
63 typedef struct _ig_data
{
64 char stage1_buf
[SECTOR_SIZE
];
70 IG_DEV_X86BOOTPAR
= 1,
75 #define is_bootpar(type) (type == IG_DEV_X86BOOTPAR)
76 #define is_efi(type) (type == IG_DEV_EFI)
78 #define STAGE2_MEMADDR (0x8000) /* loading addr of stage2 */
80 #define STAGE1_BPB_OFFSET (0x3)
81 #define STAGE1_BPB_SIZE (0x3B)
82 #define STAGE1_BOOT_DRIVE (0x40)
83 #define STAGE1_FORCE_LBA (0x41)
84 #define STAGE1_STAGE2_ADDRESS (0x42)
85 #define STAGE1_STAGE2_SECTOR (0x44)
86 #define STAGE1_STAGE2_SEGMENT (0x48)
88 #define STAGE2_BLOCKLIST (SECTOR_SIZE - 0x8)
89 #define STAGE2_INSTALLPART (SECTOR_SIZE + 0x8)
90 #define STAGE2_FORCE_LBA (SECTOR_SIZE + 0x11)
91 #define STAGE2_BLKOFF(type) \
92 (is_efi(type) ? 1024 : 50) /* offset from start of part */
95 * Maximum size of stage2 on EFI-labeled disks. Must not be larger than
96 * VDEV_BOOT_SIZE, defined in usr/src/uts/common/fs/zfs/sys/vdev_impl.h
98 #define STAGE2_MAXSIZE (1ULL << 19)
104 #endif /* _INSTALLGRUB_H */