1756e49c3SBenno Rice /* $NetBSD: cd9660_eltorito.h,v 1.6 2017/01/24 11:22:43 nonaka Exp $ */ 201a0f853SOlivier Houchard 31de7b4b8SPedro F. Giffuni /*- 4*b61a5730SWarner Losh * SPDX-License-Identifier: BSD-2-Clause 51de7b4b8SPedro F. Giffuni * 601a0f853SOlivier Houchard * Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan 701a0f853SOlivier Houchard * Perez-Rathke and Ram Vedam. All rights reserved. 801a0f853SOlivier Houchard * 901a0f853SOlivier Houchard * This code was written by Daniel Watt, Walter Deignan, Ryan Gabrys, 1001a0f853SOlivier Houchard * Alan Perez-Rathke and Ram Vedam. 1101a0f853SOlivier Houchard * 1201a0f853SOlivier Houchard * Redistribution and use in source and binary forms, with or 1301a0f853SOlivier Houchard * without modification, are permitted provided that the following 1401a0f853SOlivier Houchard * conditions are met: 1501a0f853SOlivier Houchard * 1. Redistributions of source code must retain the above copyright 1601a0f853SOlivier Houchard * notice, this list of conditions and the following disclaimer. 1701a0f853SOlivier Houchard * 2. Redistributions in binary form must reproduce the above 1801a0f853SOlivier Houchard * copyright notice, this list of conditions and the following 1901a0f853SOlivier Houchard * disclaimer in the documentation and/or other materials provided 2001a0f853SOlivier Houchard * with the distribution. 2101a0f853SOlivier Houchard * 2201a0f853SOlivier Houchard * THIS SOFTWARE IS PROVIDED BY DANIEL WATT, WALTER DEIGNAN, RYAN 2301a0f853SOlivier Houchard * GABRYS, ALAN PEREZ-RATHKE AND RAM VEDAM ``AS IS'' AND ANY EXPRESS OR 2401a0f853SOlivier Houchard * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 2501a0f853SOlivier Houchard * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 2601a0f853SOlivier Houchard * DISCLAIMED. IN NO EVENT SHALL DANIEL WATT, WALTER DEIGNAN, RYAN 2701a0f853SOlivier Houchard * GABRYS, ALAN PEREZ-RATHKE AND RAM VEDAM BE LIABLE FOR ANY DIRECT, INDIRECT, 2801a0f853SOlivier Houchard * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 2901a0f853SOlivier Houchard * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 3001a0f853SOlivier Houchard * USE,DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 3101a0f853SOlivier Houchard * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 3201a0f853SOlivier Houchard * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3301a0f853SOlivier Houchard * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 3401a0f853SOlivier Houchard * OF SUCH DAMAGE. 3501a0f853SOlivier Houchard * 3601a0f853SOlivier Houchard * $FreeBSD$ 3701a0f853SOlivier Houchard */ 3801a0f853SOlivier Houchard 3901a0f853SOlivier Houchard #ifndef _CD9660_ELTORITO_H_ 4001a0f853SOlivier Houchard #define _CD9660_ELTORITO_H_ 4101a0f853SOlivier Houchard 4201a0f853SOlivier Houchard /* Boot defines */ 4301a0f853SOlivier Houchard #define ET_ID "EL TORITO SPECIFICATION" 4401a0f853SOlivier Houchard #define ET_SYS_X86 0 4501a0f853SOlivier Houchard #define ET_SYS_PPC 1 4601a0f853SOlivier Houchard #define ET_SYS_MAC 2 47756e49c3SBenno Rice #define ET_SYS_EFI 0xef /* Platform ID at section header entry */ 4801a0f853SOlivier Houchard 4901a0f853SOlivier Houchard #define ET_BOOT_ENTRY_SIZE 0x20 5001a0f853SOlivier Houchard 5101a0f853SOlivier Houchard #define ET_BOOTABLE 0x88 5201a0f853SOlivier Houchard #define ET_NOT_BOOTABLE 0 5301a0f853SOlivier Houchard 5401a0f853SOlivier Houchard #define ET_MEDIA_NOEM 0 5501a0f853SOlivier Houchard #define ET_MEDIA_12FDD 1 5601a0f853SOlivier Houchard #define ET_MEDIA_144FDD 2 5701a0f853SOlivier Houchard #define ET_MEDIA_288FDD 3 5801a0f853SOlivier Houchard #define ET_MEDIA_HDD 4 5901a0f853SOlivier Houchard 6001a0f853SOlivier Houchard #define ET_INDICATOR_HEADERMORE 0x90 6101a0f853SOlivier Houchard #define ET_INDICATOR_HEADERLAST 0x91 6201a0f853SOlivier Houchard #define ET_INDICATOR_EXTENSION 0x44 6301a0f853SOlivier Houchard 6401a0f853SOlivier Houchard /*** Boot Structures ***/ 6501a0f853SOlivier Houchard 6601a0f853SOlivier Houchard typedef struct _boot_volume_descriptor { 6701a0f853SOlivier Houchard u_char boot_record_indicator [ISODCL(0x00,0x00)]; 6801a0f853SOlivier Houchard u_char identifier [ISODCL(0x01,0x05)]; 6901a0f853SOlivier Houchard u_char version [ISODCL(0x06,0x06)]; 7001a0f853SOlivier Houchard u_char boot_system_identifier [ISODCL(0x07,0x26)]; 7101a0f853SOlivier Houchard u_char unused1 [ISODCL(0x27,0x46)]; 7201a0f853SOlivier Houchard u_char boot_catalog_pointer [ISODCL(0x47,0x4A)]; 7301a0f853SOlivier Houchard u_char unused2 [ISODCL(0x4B,0x7FF)]; 7401a0f853SOlivier Houchard } boot_volume_descriptor; 7501a0f853SOlivier Houchard 7601a0f853SOlivier Houchard typedef struct _boot_catalog_validation_entry { 7701a0f853SOlivier Houchard u_char header_id [ISODCL(0x00,0x00)]; 7801a0f853SOlivier Houchard u_char platform_id [ISODCL(0x01,0x01)]; 7901a0f853SOlivier Houchard u_char reserved1 [ISODCL(0x02,0x03)]; 8001a0f853SOlivier Houchard u_char manufacturer [ISODCL(0x04,0x1B)]; 8101a0f853SOlivier Houchard u_char checksum [ISODCL(0x1C,0x1D)]; 8201a0f853SOlivier Houchard u_char key [ISODCL(0x1E,0x1F)]; 8301a0f853SOlivier Houchard } boot_catalog_validation_entry; 8401a0f853SOlivier Houchard 8501a0f853SOlivier Houchard typedef struct _boot_catalog_initial_entry { 8601a0f853SOlivier Houchard u_char boot_indicator [ISODCL(0x00,0x00)]; 8701a0f853SOlivier Houchard u_char media_type [ISODCL(0x01,0x01)]; 8801a0f853SOlivier Houchard u_char load_segment [ISODCL(0x02,0x03)]; 8901a0f853SOlivier Houchard u_char system_type [ISODCL(0x04,0x04)]; 9001a0f853SOlivier Houchard u_char unused_1 [ISODCL(0x05,0x05)]; 9101a0f853SOlivier Houchard u_char sector_count [ISODCL(0x06,0x07)]; 9201a0f853SOlivier Houchard u_char load_rba [ISODCL(0x08,0x0B)]; 9301a0f853SOlivier Houchard u_char unused_2 [ISODCL(0x0C,0x1F)]; 9401a0f853SOlivier Houchard } boot_catalog_initial_entry; 9501a0f853SOlivier Houchard 9601a0f853SOlivier Houchard #define ET_SECTION_HEADER_MORE 0x90 9701a0f853SOlivier Houchard #define ET_SECTION_HEADER_LAST 0x91 9801a0f853SOlivier Houchard 9901a0f853SOlivier Houchard typedef struct _boot_catalog_section_header { 10001a0f853SOlivier Houchard u_char header_indicator [ISODCL(0x00,0x00)]; 10101a0f853SOlivier Houchard u_char platform_id [ISODCL(0x01,0x01)]; 10201a0f853SOlivier Houchard u_char num_section_entries [ISODCL(0x02,0x03)]; 10301a0f853SOlivier Houchard u_char id_string [ISODCL(0x04,0x1F)]; 10401a0f853SOlivier Houchard } boot_catalog_section_header; 10501a0f853SOlivier Houchard 10601a0f853SOlivier Houchard typedef struct _boot_catalog_section_entry { 10701a0f853SOlivier Houchard u_char boot_indicator [ISODCL(0x00,0x00)]; 10801a0f853SOlivier Houchard u_char media_type [ISODCL(0x01,0x01)]; 10901a0f853SOlivier Houchard u_char load_segment [ISODCL(0x02,0x03)]; 11001a0f853SOlivier Houchard u_char system_type [ISODCL(0x04,0x04)]; 11101a0f853SOlivier Houchard u_char unused_1 [ISODCL(0x05,0x05)]; 11201a0f853SOlivier Houchard u_char sector_count [ISODCL(0x06,0x07)]; 11301a0f853SOlivier Houchard u_char load_rba [ISODCL(0x08,0x0B)]; 11401a0f853SOlivier Houchard u_char selection_criteria [ISODCL(0x0C,0x0C)]; 11501a0f853SOlivier Houchard u_char vendor_criteria [ISODCL(0x0D,0x1F)]; 11601a0f853SOlivier Houchard } boot_catalog_section_entry; 11701a0f853SOlivier Houchard 11801a0f853SOlivier Houchard typedef struct _boot_catalog_section_entry_extension { 11901a0f853SOlivier Houchard u_char extension_indicator [ISODCL(0x00,0x00)]; 12001a0f853SOlivier Houchard u_char flags [ISODCL(0x01,0x01)]; 12101a0f853SOlivier Houchard u_char vendor_criteria [ISODCL(0x02,0x1F)]; 12201a0f853SOlivier Houchard } boot_catalog_section_entry_extension; 12301a0f853SOlivier Houchard 12401a0f853SOlivier Houchard #define ET_ENTRY_VE 1 12501a0f853SOlivier Houchard #define ET_ENTRY_IE 2 12601a0f853SOlivier Houchard #define ET_ENTRY_SH 3 12701a0f853SOlivier Houchard #define ET_ENTRY_SE 4 12801a0f853SOlivier Houchard #define ET_ENTRY_EX 5 12901a0f853SOlivier Houchard 13001a0f853SOlivier Houchard struct boot_catalog_entry { 13101a0f853SOlivier Houchard char entry_type; 13201a0f853SOlivier Houchard union { 13301a0f853SOlivier Houchard boot_catalog_validation_entry VE; 13401a0f853SOlivier Houchard boot_catalog_initial_entry IE; 13501a0f853SOlivier Houchard boot_catalog_section_header SH; 13601a0f853SOlivier Houchard boot_catalog_section_entry SE; 13701a0f853SOlivier Houchard boot_catalog_section_entry_extension EX; 13801a0f853SOlivier Houchard } entry_data; 13901a0f853SOlivier Houchard 14001a0f853SOlivier Houchard LIST_ENTRY(boot_catalog_entry) ll_struct; 14101a0f853SOlivier Houchard }; 14201a0f853SOlivier Houchard 14301a0f853SOlivier Houchard /* Temporary structure */ 14401a0f853SOlivier Houchard struct cd9660_boot_image { 14501a0f853SOlivier Houchard char *filename; 14601a0f853SOlivier Houchard int size; 14701a0f853SOlivier Houchard int sector; /* copied to LoadRBA */ 14801a0f853SOlivier Houchard int num_sectors; 14901a0f853SOlivier Houchard unsigned int loadSegment; 15001a0f853SOlivier Houchard u_char targetMode; 15101a0f853SOlivier Houchard u_char system; 15201a0f853SOlivier Houchard u_char bootable; 153756e49c3SBenno Rice u_char platform_id; /* for section header entry */ 15401a0f853SOlivier Houchard /* 15501a0f853SOlivier Houchard * If the boot image exists in the filesystem 15601a0f853SOlivier Houchard * already, this is a pointer to that node. For the sake 15701a0f853SOlivier Houchard * of simplicity in future versions, this pointer is only 15801a0f853SOlivier Houchard * to the node in the primary volume. This SHOULD be done 15901a0f853SOlivier Houchard * via a hashtable lookup. 16001a0f853SOlivier Houchard */ 16101a0f853SOlivier Houchard struct _cd9660node *boot_image_node; 16201a0f853SOlivier Houchard TAILQ_ENTRY(cd9660_boot_image) image_list; 16301a0f853SOlivier Houchard int serialno; 16401a0f853SOlivier Houchard }; 16501a0f853SOlivier Houchard 16601a0f853SOlivier Houchard 16701a0f853SOlivier Houchard #endif /* _CD9660_ELTORITO_H_ */ 16801a0f853SOlivier Houchard 169