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