13446Smrj /* 23446Smrj * CDDL HEADER START 33446Smrj * 43446Smrj * The contents of this file are subject to the terms of the 53446Smrj * Common Development and Distribution License (the "License"). 63446Smrj * You may not use this file except in compliance with the License. 73446Smrj * 83446Smrj * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 93446Smrj * or http://www.opensolaris.org/os/licensing. 103446Smrj * See the License for the specific language governing permissions 113446Smrj * and limitations under the License. 123446Smrj * 133446Smrj * When distributing Covered Code, include this CDDL HEADER in each 143446Smrj * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 153446Smrj * If applicable, add the following below this CDDL HEADER, with the 163446Smrj * fields enclosed by brackets "[]" replaced with your own identifying 173446Smrj * information: Portions Copyright [yyyy] [name of copyright owner] 183446Smrj * 193446Smrj * CDDL HEADER END 203446Smrj */ 213446Smrj 223446Smrj /* 23*9937SMark.Johnson@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 243446Smrj * Use is subject to license terms. 253446Smrj */ 263446Smrj 273446Smrj #ifndef _MULTIBOOT_H 283446Smrj #define _MULTIBOOT_H 293446Smrj 303446Smrj #ifdef __cplusplus 313446Smrj extern "C" { 323446Smrj #endif 333446Smrj 343446Smrj /* 353446Smrj * Definitions of structures/data for using a multiboot compliant OS loader. 363446Smrj */ 373446Smrj #define MB_HEADER_MAGIC 0x1BADB002 /* magic */ 383446Smrj #define MB_HEADER_FLAGS 0x00010003 /* flags we use */ 393446Smrj #define MB_HEADER_CHECKSUM -0x1BAEB005 /* -(magic + flag) */ 403446Smrj 413446Smrj /* 423446Smrj * passed by boot loader to kernel 433446Smrj */ 443446Smrj #define MB_BOOTLOADER_MAGIC 0x2BADB002 453446Smrj 463446Smrj #ifndef _ASM /* excluded from assembly routines */ 473446Smrj 483446Smrj #include <sys/types.h> 493446Smrj #include <sys/types32.h> 503446Smrj 513446Smrj /* 523446Smrj * The Multiboot header must be somewhere in the 1st 8K of the image that 533446Smrj * the loader loads into memory. 543446Smrj */ 553446Smrj typedef struct multiboot_header { 563446Smrj uint32_t magic; 573446Smrj uint32_t flags; 583446Smrj uint32_t checksum; 593446Smrj caddr32_t header_addr; /* use as (mutliboot_header_t *) */ 603446Smrj caddr32_t load_addr; 613446Smrj caddr32_t load_end_addr; 623446Smrj caddr32_t bss_end_addr; 633446Smrj caddr32_t entry_addr; 643446Smrj } multiboot_header_t; 653446Smrj 663446Smrj /* The section header table for ELF. */ 673446Smrj typedef struct mb_elf_shtable { 683446Smrj uint32_t num; 693446Smrj uint32_t size; 703446Smrj uint32_t addr; 713446Smrj uint32_t shndx; 723446Smrj } mb_elf_shtable_t; 733446Smrj 743446Smrj /* The module structure. */ 753446Smrj typedef struct mb_module { 763446Smrj caddr32_t mod_start; 773446Smrj caddr32_t mod_end; 783446Smrj caddr32_t mod_name; /* use as (char *) */ 793446Smrj uint32_t reserved; 803446Smrj } mb_module_t; 813446Smrj 823446Smrj /* 833446Smrj * Memory map data structure. Walked in a bizarre way - see mutltiboot 843446Smrj * documentation for example. 853446Smrj */ 863446Smrj typedef struct mb_memory_map { 873446Smrj uint32_t size; 883446Smrj uint32_t base_addr_low; 893446Smrj uint32_t base_addr_high; 903446Smrj uint32_t length_low; 913446Smrj uint32_t length_high; 923446Smrj uint32_t type; /* only value of 1 is RAM */ 933446Smrj } mb_memory_map_t; 943446Smrj 953446Smrj 963446Smrj /* 973446Smrj * The Multiboot information. This is supplied by the multiboot loader 983446Smrj * for the OS. 993446Smrj * 1003446Smrj * The flag bit fields defined what multiboot info the boot 1013446Smrj * loader (see struct multiboot_info below) supplied: 1023446Smrj * flag[0] mem_upper, mem_loader 1033446Smrj * flag[1] boot_device 1043446Smrj * flag[2] cmdline (for launching kernel) 1053446Smrj * flag[3] mods_count, mods_addr 1063446Smrj * flag[4] symbol table for a.out 1073446Smrj * flag[5] symbol table for elf 1083446Smrj * flag[6] mmap_length, mmap_addr 1093446Smrj * flag[7] drives_length, drivers_addr 1103446Smrj * flag[8] config_table 1113446Smrj * flag[9] boot_loader_name 1123446Smrj * flag[10] apm_table 1133446Smrj * flag[11] vbe_control_info 1143446Smrj * vbe_mode_info 1153446Smrj * vbe_mode 1163446Smrj * vbe_interface_seg 1173446Smrj * vbe_interface_off 1183446Smrj * vbe_interface_len 1193446Smrj */ 1203446Smrj typedef struct multiboot_info { 1213446Smrj uint32_t flags; 1223446Smrj uint32_t mem_lower; /* # of pages below 1Meg */ 1233446Smrj uint32_t mem_upper; /* # of pages above 1Meg */ 1243446Smrj uint32_t boot_device; 1253446Smrj caddr32_t cmdline; /* use as (char *) */ 1263446Smrj uint32_t mods_count; 1273446Smrj caddr32_t mods_addr; /* use as (mb_module_t *) */ 1283446Smrj mb_elf_shtable_t elf_sec; 1293446Smrj uint32_t mmap_length; 1303446Smrj caddr32_t mmap_addr; /* use as (mb_memory_map_t *) */ 1313446Smrj uint32_t drives_length; 1323446Smrj caddr32_t drives_addr; 1333446Smrj caddr32_t config_table; 1343446Smrj caddr32_t boot_loader_name; 1353446Smrj caddr32_t apm_table; 1363446Smrj uint32_t vbe_control_info; 1373446Smrj uint32_t vbe_mode_info; 1383446Smrj uint16_t vbe_mode; 1393446Smrj uint16_t vbe_interface_seg; 1403446Smrj uint16_t vbe_interface_off; 1413446Smrj uint16_t vbe_interface_len; 1423446Smrj } multiboot_info_t; 1433446Smrj 1443446Smrj /* 1453446Smrj * netinfo for Solaris diskless booting 1463446Smrj * XXX - not part of multiboot spec 1473446Smrj */ 1483446Smrj struct sol_netinfo { 1493446Smrj uint8_t sn_infotype; 1503446Smrj uint8_t sn_mactype; 1513446Smrj uint8_t sn_maclen; 1523446Smrj uint8_t sn_padding; 153*9937SMark.Johnson@Sun.COM uint32_t sn_ciaddr; 154*9937SMark.Johnson@Sun.COM uint32_t sn_siaddr; 155*9937SMark.Johnson@Sun.COM uint32_t sn_giaddr; 156*9937SMark.Johnson@Sun.COM uint32_t sn_netmask; 1573446Smrj uint8_t sn_macaddr[1]; 1583446Smrj }; 1593446Smrj 1603446Smrj /* identify bootp/dhcp reply or rarp/ifconfig */ 1613446Smrj #define SN_TYPE_BOOTP 2 1623446Smrj #define SN_TYPE_RARP 0xf0 1633446Smrj 1643446Smrj 1653446Smrj #endif /* _ASM */ 1663446Smrj 1673446Smrj 1683446Smrj #ifdef __cplusplus 1693446Smrj } 1703446Smrj #endif 1713446Smrj 1723446Smrj #endif /* _MULTIBOOT_H */ 173