Home | History | Annotate | Line # | Download | only in lib
biosdisk_ll.h revision 1.4
      1 /*	$NetBSD: biosdisk_ll.h,v 1.4 1999/03/08 00:09:25 fvdl Exp $	 */
      2 
      3 /*
      4  * Copyright (c) 1996
      5  * 	Matthias Drochner.  All rights reserved.
      6  * Copyright (c) 1996
      7  * 	Perry E. Metzger.  All rights reserved.
      8  *
      9  * Redistribution and use in source and binary forms, with or without
     10  * modification, are permitted provided that the following conditions
     11  * are met:
     12  * 1. Redistributions of source code must retain the above copyright
     13  *    notice, this list of conditions and the following disclaimer.
     14  * 2. Redistributions in binary form must reproduce the above copyright
     15  *    notice, this list of conditions and the following disclaimer in the
     16  *    documentation and/or other materials provided with the distribution.
     17  * 3. All advertising materials mentioning features or use of this software
     18  *    must display the following acknowledgements:
     19  *	This product includes software developed for the NetBSD Project
     20  *	by Matthias Drochner.
     21  *	This product includes software developed for the NetBSD Project
     22  *	by Perry E. Metzger.
     23  * 4. The names of the authors may not be used to endorse or promote products
     24  *    derived from this software without specific prior written permission.
     25  *
     26  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     27  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     28  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     29  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     30  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     31  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     32  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     33  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     34  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     35  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     36  */
     37 
     38 /*
     39  * shared by bootsector startup (bootsectmain) and biosdisk.c needs lowlevel
     40  * parts from bios_disk.S
     41  */
     42 
     43 /*
     44  * Beware that bios_disk.S relies on the offsets of the structure
     45  * members.
     46  */
     47 struct biosdisk_ll {
     48 	int             dev;		/* BIOS device number */
     49 	int             sec, head, cyl;	/* geometry */
     50 	int		flags;		/* see below */
     51 };
     52 #define	BIOSDISK_EXT13	1		/* BIOS supports int13 extension */
     53 
     54 #if __GNUC__ == 2 && __GNUC_MINOR__ < 7
     55 #pragma pack(1)
     56 #endif
     57 
     58 /*
     59  * Version 1.x drive parameters from int13 extensions. Should be supported
     60  * by every BIOS that supports the extensions.
     61  */
     62 
     63 struct biosdisk_ext13info {
     64 	u_int16_t	size;		/* size of buffer, set on call */
     65 	u_int16_t	flags;		/* flags, see below */
     66 	u_int32_t	cyl;		/* # of physical cylinders */
     67 	u_int32_t	head;		/* # of physical heads */
     68 	u_int32_t	sec;		/* # of physical sectors per track */
     69 	u_int64_t	totsec;		/* total number of sectors */
     70 	u_int16_t	sbytes;		/* # of bytes per sector */
     71 } __attribute__((packed));
     72 
     73 #if __GNUC__ == 2 && __GNUC_MINOR__ < 7
     74 #pragma pack(4)
     75 #endif
     76 
     77 #define BIOSDISK_SECSIZE 512
     78 
     79 int set_geometry __P((struct biosdisk_ll *, struct biosdisk_ext13info *));
     80 int readsects   __P((struct biosdisk_ll *, int, int, char *, int));
     81