1 1.1 nonaka /* $NetBSD: disk.h,v 1.1 2009/03/02 09:33:02 nonaka Exp $ */ 2 1.1 nonaka /* $OpenBSD: disk.h,v 1.1 2005/05/24 20:38:20 uwe Exp $ */ 3 1.1 nonaka 4 1.1 nonaka /* 5 1.1 nonaka * Copyright (c) 1997 Tobias Weingartner 6 1.1 nonaka * All rights reserved. 7 1.1 nonaka * 8 1.1 nonaka * Redistribution and use in source and binary forms, with or without 9 1.1 nonaka * modification, are permitted provided that the following conditions 10 1.1 nonaka * are met: 11 1.1 nonaka * 1. Redistributions of source code must retain the above copyright 12 1.1 nonaka * notice, this list of conditions and the following disclaimer. 13 1.1 nonaka * 2. Redistributions in binary form must reproduce the above copyright 14 1.1 nonaka * notice, this list of conditions and the following disclaimer in the 15 1.1 nonaka * documentation and/or other materials provided with the distribution. 16 1.1 nonaka * 17 1.1 nonaka * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 1.1 nonaka * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 1.1 nonaka * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 1.1 nonaka * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 21 1.1 nonaka * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 1.1 nonaka * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 1.1 nonaka * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 1.1 nonaka * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 1.1 nonaka * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 1.1 nonaka * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 1.1 nonaka * SUCH DAMAGE. 28 1.1 nonaka * 29 1.1 nonaka */ 30 1.1 nonaka 31 1.1 nonaka #ifndef _STAND_DISK_H 32 1.1 nonaka #define _STAND_DISK_H 33 1.1 nonaka 34 1.1 nonaka #include <sys/disklabel.h> 35 1.1 nonaka #include <sys/queue.h> 36 1.1 nonaka 37 1.1 nonaka #define MAXDEVNAME 16 38 1.1 nonaka 39 1.1 nonaka /* XXX snatched from <i386/biosdev.h> */ 40 1.1 nonaka #if 1 41 1.1 nonaka /* Info about disk from the bios, plus the mapping from 42 1.1 nonaka * BIOS numbers to BSD major (driver?) number. 43 1.1 nonaka * 44 1.1 nonaka * Also, do not bother with BIOSN*() macros, just parcel 45 1.1 nonaka * the info out, and use it like this. This makes for less 46 1.1 nonaka * of a dependance on BIOSN*() macros having to be the same 47 1.1 nonaka * across /boot, /bsd, and userland. 48 1.1 nonaka */ 49 1.1 nonaka #define BOOTARG_DISKINFO 1 50 1.1 nonaka typedef struct _bios_diskinfo { 51 1.1 nonaka /* BIOS section */ 52 1.1 nonaka int bios_number; /* BIOS number of drive (or -1) */ 53 1.1 nonaka 54 1.1 nonaka /* Misc. flags */ 55 1.1 nonaka uint32_t flags; 56 1.1 nonaka #define BDI_INVALID 0x00000001 /* I/O error during checksumming */ 57 1.1 nonaka #define BDI_GOODLABEL 0x00000002 /* Had SCSI or ST506/ESDI disklabel */ 58 1.1 nonaka #define BDI_BADLABEL 0x00000004 /* Had another disklabel */ 59 1.1 nonaka #define BDI_EL_TORITO 0x00000008 /* 2,048-byte sectors */ 60 1.1 nonaka #define BDI_PICKED 0x80000000 /* kernel-only: cksum matched */ 61 1.1 nonaka } bios_diskinfo_t; 62 1.1 nonaka 63 1.1 nonaka #define BOOTARG_CKSUMLEN 3 /* uint32_t */ 64 1.1 nonaka #endif /* 1 */ 65 1.1 nonaka 66 1.1 nonaka /* All the info on a disk we've found */ 67 1.1 nonaka struct diskinfo { 68 1.1 nonaka bios_diskinfo_t bios_info; 69 1.1 nonaka struct disklabel disklabel; 70 1.1 nonaka char devname[MAXDEVNAME]; 71 1.1 nonaka 72 1.1 nonaka TAILQ_ENTRY(diskinfo) list; 73 1.1 nonaka }; 74 1.1 nonaka TAILQ_HEAD(disklist_lh, diskinfo); 75 1.1 nonaka 76 1.1 nonaka /* diskprobe.c */ 77 1.1 nonaka void diskprobe(char *buf, size_t bufsiz); 78 1.1 nonaka struct diskinfo *dkdevice(const char *, uint); 79 1.1 nonaka int bios_devname(int, char *, int); 80 1.1 nonaka void bios_devpath(int, int, char *); 81 1.1 nonaka char *bios_getdiskinfo(int, bios_diskinfo_t *); 82 1.1 nonaka int bios_getdospart(bios_diskinfo_t *); 83 1.1 nonaka char *bios_getdisklabel(bios_diskinfo_t *, struct disklabel *); 84 1.1 nonaka void dump_diskinfo(void); 85 1.1 nonaka 86 1.1 nonaka #endif /* _STAND_DISK_H */ 87