1 /* $NetBSD: bootinfo.h,v 1.7 2005/02/04 22:03:53 fvdl Exp $ */ 2 3 /* 4 * Copyright (c) 1997 5 * Matthias Drochner. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 * 27 */ 28 29 #ifndef _LOCORE 30 31 struct btinfo_common { 32 int len; 33 int type; 34 }; 35 36 #define BTINFO_BOOTPATH 0 37 #define BTINFO_BOOTDISK 3 38 #define BTINFO_NETIF 4 39 #define BTINFO_CONSOLE 6 40 #define BTINFO_BIOSGEOM 7 41 #define BTINFO_SYMTAB 8 42 #define BTINFO_MEMMAP 9 43 #define BTINFO_BOOTWEDGE 10 44 45 struct btinfo_bootpath { 46 struct btinfo_common common; 47 char bootpath[80]; 48 }; 49 50 struct btinfo_bootdisk { 51 struct btinfo_common common; 52 int labelsector; /* label valid if != -1 */ 53 struct { 54 u_int16_t type, checksum; 55 char packname[16]; 56 } label; 57 int biosdev; 58 int partition; 59 }; 60 61 struct btinfo_bootwedge { 62 struct btinfo_common common; 63 int biosdev; 64 daddr_t startblk; 65 uint64_t nblks; 66 daddr_t matchblk; 67 uint64_t matchnblks; 68 uint8_t matchhash[16]; /* MD5 hash */ 69 } __attribute__((packed)); 70 71 struct btinfo_netif { 72 struct btinfo_common common; 73 char ifname[16]; 74 int bus; 75 #define BI_BUS_ISA 0 76 #define BI_BUS_PCI 1 77 union { 78 unsigned int iobase; /* ISA */ 79 unsigned int tag; /* PCI, BIOS format */ 80 } addr; 81 }; 82 83 struct btinfo_console { 84 struct btinfo_common common; 85 char devname[16]; 86 int addr; 87 int speed; 88 }; 89 90 struct btinfo_symtab { 91 struct btinfo_common common; 92 int nsym; 93 int ssym; 94 int esym; 95 }; 96 97 struct bi_memmap_entry { 98 u_int64_t addr; /* beginning of block */ /* 8 */ 99 u_int64_t size; /* size of block */ /* 8 */ 100 u_int32_t type; /* type of block */ /* 4 */ 101 } __attribute__((packed)); /* == 20 */ 102 103 #define BIM_Memory 1 /* available RAM usable by OS */ 104 #define BIM_Reserved 2 /* in use or reserved by the system */ 105 #define BIM_ACPI 3 /* ACPI Reclaim memory */ 106 #define BIM_NVS 4 /* ACPI NVS memory */ 107 108 struct btinfo_memmap { 109 struct btinfo_common common; 110 int num; 111 struct bi_memmap_entry entry[1]; /* var len */ 112 }; 113 114 #include <sys/bootblock.h> 115 116 /* 117 * Structure describing disk info as seen by the BIOS. 118 */ 119 struct bi_biosgeom_entry { 120 int sec, head, cyl; /* geometry */ 121 u_int64_t totsec; /* LBA sectors from ext int13 */ 122 int flags, dev; /* flags, BIOS device # */ 123 #define BI_GEOM_INVALID 0x000001 124 #define BI_GEOM_EXTINT13 0x000002 125 #ifdef BIOSDISK_EXT13INFO_V3 126 #define BI_GEOM_BADCKSUM 0x000004 /* v3.x checksum invalid */ 127 #define BI_GEOM_BUS_MASK 0x00ff00 /* connecting bus type */ 128 #define BI_GEOM_BUS_ISA 0x000100 129 #define BI_GEOM_BUS_PCI 0x000200 130 #define BI_GEOM_BUS_OTHER 0x00ff00 131 #define BI_GEOM_IFACE_MASK 0xff0000 /* interface type */ 132 #define BI_GEOM_IFACE_ATA 0x010000 133 #define BI_GEOM_IFACE_ATAPI 0x020000 134 #define BI_GEOM_IFACE_SCSI 0x030000 135 #define BI_GEOM_IFACE_USB 0x040000 136 #define BI_GEOM_IFACE_1394 0x050000 /* Firewire */ 137 #define BI_GEOM_IFACE_FIBRE 0x060000 /* Fibre channel */ 138 #define BI_GEOM_IFACE_OTHER 0xff0000 139 unsigned int cksum; /* MBR checksum */ 140 u_int interface_path; /* ISA iobase PCI bus/dev/fun */ 141 u_int64_t device_path; 142 int res0; /* future expansion; 0 now */ 143 #else 144 unsigned int cksum; /* MBR checksum */ 145 int res0, res1, res2, res3; /* future expansion; 0 now */ 146 #endif 147 struct mbr_partition dosparts[MBR_PART_COUNT]; /* MBR itself */ 148 } __attribute__((packed)); 149 150 struct btinfo_biosgeom { 151 struct btinfo_common common; 152 int num; 153 struct bi_biosgeom_entry disk[1]; /* var len */ 154 }; 155 156 #ifdef _KERNEL 157 void *lookup_bootinfo(int); 158 #endif 159 #endif /* _LOCORE */ 160 161 #ifdef _KERNEL 162 #define BOOTINFO_MAXSIZE 4096 163 #endif 164