1/** 2 * \file 3 * \brief Struct definition for the boot param struct supplied by the 4 * K1OM boot loader 5 */ 6 7/* 8 * Copyright (c) 2013 ETH Zurich. 9 * All rights reserved. 10 * 11 * This file is distributed under the terms in the attached LICENSE file. 12 * If you do not find this file, copies can be found by writing to: 13 * ETH Zurich D-INFK, Universitaetstrasse 6, CH-8092 Zurich. Attn: Systems Group. 14 * 15 * This is adapted from the Linux kernel (kernel.org) 16 * 17 */ 18 19/* 20 * linux/include/linux/edd.h 21 * Copyright (C) 2002, 2003, 2004 Dell Inc. 22 * by Matt Domsch <Matt_Domsch@dell.com> 23 * 24 * structures and definitions for the int 13h, ax={41,48}h 25 * BIOS Enhanced Disk Drive Services 26 * This is based on the T13 group document D1572 Revision 0 (August 14 2002) 27 * available at http://www.t13.org/docs2002/d1572r0.pdf. It is 28 * very similar to D1484 Revision 3 http://www.t13.org/docs2002/d1484r3.pdf 29 * 30 * In a nutshell, arch/{i386,x86_64}/boot/setup.S populates a scratch 31 * table in the boot_params that contains a list of BIOS-enumerated 32 * boot devices. 33 * In arch/{i386,x86_64}/kernel/setup.c, this information is 34 * transferred into the edd structure, and in drivers/firmware/edd.c, that 35 * information is used to identify BIOS boot disk. The code in setup.S 36 * is very sensitive to the size of these structures. 37 * 38 * This program is free software; you can redistribute it and/or modify 39 * it under the terms of the GNU General Public License v2.0 as published by 40 * the Free Software Foundation 41 * 42 * This program is distributed in the hope that it will be useful, 43 * but WITHOUT ANY WARRANTY; without even the implied warranty of 44 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 45 * GNU General Public License for more details. 46 * 47 */ 48#ifndef KERNEL_EDD_H 49#define KERNEL_EDD_H 50 51 52#define EDDNR 0x1e9 /* addr of number of edd_info structs at EDDBUF 53 in boot_params - treat this as 1 byte */ 54#define EDDBUF 0xd00 /* addr of edd_info structs in boot_params */ 55#define EDDMAXNR 6 /* number of edd_info structs starting at EDDBUF */ 56#define EDDEXTSIZE 8 /* change these if you muck with the structures */ 57#define EDDPARMSIZE 74 58#define CHECKEXTENSIONSPRESENT 0x41 59#define GETDEVICEPARAMETERS 0x48 60#define LEGACYGETDEVICEPARAMETERS 0x08 61#define EDDMAGIC1 0x55AA 62#define EDDMAGIC2 0xAA55 63 64 65#define READ_SECTORS 0x02 /* int13 AH=0x02 is READ_SECTORS command */ 66#define EDD_MBR_SIG_OFFSET 0x1B8 /* offset of signature in the MBR */ 67#define EDD_MBR_SIG_BUF 0x290 /* addr in boot params */ 68#define EDD_MBR_SIG_MAX 16 /* max number of signatures to store */ 69#define EDD_MBR_SIG_NR_BUF 0x1ea /* addr of number of MBR signtaures at EDD_MBR_SIG_BUF 70 in boot_params - treat this as 1 byte */ 71 72#ifndef __ASSEMBLY__ 73 74#define EDD_EXT_FIXED_DISK_ACCESS (1 << 0) 75#define EDD_EXT_DEVICE_LOCKING_AND_EJECTING (1 << 1) 76#define EDD_EXT_ENHANCED_DISK_DRIVE_SUPPORT (1 << 2) 77#define EDD_EXT_64BIT_EXTENSIONS (1 << 3) 78 79#define EDD_INFO_DMA_BOUNDARY_ERROR_TRANSPARENT (1 << 0) 80#define EDD_INFO_GEOMETRY_VALID (1 << 1) 81#define EDD_INFO_REMOVABLE (1 << 2) 82#define EDD_INFO_WRITE_VERIFY (1 << 3) 83#define EDD_INFO_MEDIA_CHANGE_NOTIFICATION (1 << 4) 84#define EDD_INFO_LOCKABLE (1 << 5) 85#define EDD_INFO_NO_MEDIA_PRESENT (1 << 6) 86#define EDD_INFO_USE_INT13_FN50 (1 << 7) 87 88struct edd_device_params { 89 uint16_t length; 90 uint16_t info_flags; 91 uint32_t num_default_cylinders; 92 uint32_t num_default_heads; 93 uint32_t sectors_per_track; 94 uint64_t number_of_sectors; 95 uint16_t bytes_per_sector; 96 uint32_t dpte_ptr; /* 0xFFFFFFFF for our purposes */ 97 uint16_t key; /* = 0xBEDD */ 98 uint8_t device_path_info_length; /* = 44 */ 99 uint8_t reserved2; 100 uint16_t reserved3; 101 uint8_t host_bus_type[4]; 102 uint8_t interface_type[8]; 103 union { 104 struct { 105 uint16_t base_address; 106 uint16_t reserved1; 107 uint32_t reserved2; 108 } __attribute__ ((packed)) isa; 109 struct { 110 uint8_t bus; 111 uint8_t slot; 112 uint8_t function; 113 uint8_t channel; 114 uint32_t reserved; 115 } __attribute__ ((packed)) pci; 116 /* pcix is same as pci */ 117 struct { 118 uint64_t reserved; 119 } __attribute__ ((packed)) ibnd; 120 struct { 121 uint64_t reserved; 122 } __attribute__ ((packed)) xprs; 123 struct { 124 uint64_t reserved; 125 } __attribute__ ((packed)) htpt; 126 struct { 127 uint64_t reserved; 128 } __attribute__ ((packed)) unknown; 129 } interface_path; 130 union { 131 struct { 132 uint8_t device; 133 uint8_t reserved1; 134 uint16_t reserved2; 135 uint32_t reserved3; 136 uint64_t reserved4; 137 } __attribute__ ((packed)) ata; 138 struct { 139 uint8_t device; 140 uint8_t lun; 141 uint8_t reserved1; 142 uint8_t reserved2; 143 uint32_t reserved3; 144 uint64_t reserved4; 145 } __attribute__ ((packed)) atapi; 146 struct { 147 uint16_t id; 148 uint64_t lun; 149 uint16_t reserved1; 150 uint32_t reserved2; 151 } __attribute__ ((packed)) scsi; 152 struct { 153 uint64_t serial_number; 154 uint64_t reserved; 155 } __attribute__ ((packed)) usb; 156 struct { 157 uint64_t eui; 158 uint64_t reserved; 159 } __attribute__ ((packed)) i1394; 160 struct { 161 uint64_t wwid; 162 uint64_t lun; 163 } __attribute__ ((packed)) fibre; 164 struct { 165 uint64_t identity_tag; 166 uint64_t reserved; 167 } __attribute__ ((packed)) i2o; 168 struct { 169 uint32_t array_number; 170 uint32_t reserved1; 171 uint64_t reserved2; 172 } __attribute__ ((packed)) raid; 173 struct { 174 uint8_t device; 175 uint8_t reserved1; 176 uint16_t reserved2; 177 uint32_t reserved3; 178 uint64_t reserved4; 179 } __attribute__ ((packed)) sata; 180 struct { 181 uint64_t reserved1; 182 uint64_t reserved2; 183 } __attribute__ ((packed)) unknown; 184 } device_path; 185 uint8_t reserved4; 186 uint8_t checksum; 187} __attribute__ ((packed)); 188 189struct edd_info { 190 uint8_t device; 191 uint8_t version; 192 uint16_t interface_support; 193 uint16_t legacy_max_cylinder; 194 uint8_t legacy_max_head; 195 uint8_t legacy_sectors_per_track; 196 struct edd_device_params params; 197} __attribute__ ((packed)); 198 199struct edd { 200 unsigned int mbr_signature[EDD_MBR_SIG_MAX]; 201 struct edd_info edd_info[EDDMAXNR]; 202 unsigned char mbr_signature_nr; 203 unsigned char edd_info_nr; 204}; 205 206#endif /*!__ASSEMBLY__ */ 207 208#endif /* KERNEL_EDD_H */ 209 210