2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
7 * Reserved. This file contains Original Code and/or Modifications of
8 * Original Code as defined in and that are subject to the Apple Public
9 * Source License Version 1.1 (the "License"). You may not use this file
10 * except in compliance with the License. Please obtain a copy of the
11 * License at http://www.apple.com/publicsource and read it before using
14 * The Original Code and all software distributed under the License are
15 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE OR NON- INFRINGEMENT. Please see the
19 * License for the specific language governing rights and limitations
22 * @APPLE_LICENSE_HEADER_END@
26 #ifndef __LIBSAIO_SAIO_TYPES_H
27 #define __LIBSAIO_SAIO_TYPES_H
29 #include <sys/reboot.h>
30 #include <sys/types.h>
33 #include <pexpert/i386/boot.h>
36 #define DEBUG_DISK(x) printf x
45 typedef unsigned long entry_t
;
48 unsigned int sectors
:8;
50 unsigned int cylinders
:16;
53 struct driveParameters
{
70 typedef struct BootVolume
* BVRef
;
71 typedef struct BootVolume
* CICell
;
73 typedef long (*FSInit
)(CICell ih
);
74 typedef long (*FSLoadFile
)(CICell ih
, char * filePath
);
75 typedef long (*FSGetDirEntry
)(CICell ih
, char * dirPath
, long * dirIndex
,
76 char ** name
, long * flags
, long * time
);
77 typedef void (*BVGetDescription
)(CICell ih
, char * str
, long strMaxLen
);
80 unsigned int i_flgs
; /* see F_* below */
81 unsigned int i_offset
; /* seek byte offset in file */
82 int i_filesize
; /* size of file */
83 char * i_buf
; /* file load address */
86 #define F_READ 0x1 /* file opened for reading */
87 #define F_WRITE 0x2 /* file opened for writing */
88 #define F_ALLOC 0x4 /* buffer allocated */
89 #define F_FILE 0x8 /* file instead of device */
90 #define F_NBSF 0x10 /* no bad sector forwarding */
91 #define F_SSI 0x40 /* set skip sector inhibit */
92 #define F_MEM 0x80 /* memory instead of file or device */
95 char * dir_path
; /* directory path */
96 long dir_index
; /* directory entry index */
97 BVRef dir_bvr
; /* volume reference */
103 BVRef next
; /* list linkage pointer */
104 int biosdev
; /* BIOS device number */
105 int type
; /* device type (floppy, hd, network) */
106 unsigned int flags
; /* attribute flags */
107 BVGetDescription description
; /* BVGetDescription function */
108 int part_no
; /* partition number (1 based) */
109 unsigned int part_boff
; /* partition block offset */
110 unsigned int part_type
; /* partition type */
111 unsigned int fs_boff
; /* 1st block # of next read */
112 FSLoadFile fs_loadfile
; /* FSLoadFile function */
113 FSGetDirEntry fs_getdirentry
; /* FSGetDirEntry function */
114 unsigned int bps
; /* bytes per sector for this device */
115 char name
[BVSTRLEN
]; /* (name of partition) */
116 char type_name
[BVSTRLEN
]; /* (type of partition, eg. Apple_HFS) */
121 kBVFlagPrimary
= 0x01,
122 kBVFlagNativeBoot
= 0x02,
123 kBVFlagForeignBoot
= 0x04
127 kBIOSDevTypeFloppy
= 0x00,
128 kBIOSDevTypeHardDrive
= 0x80,
129 kBIOSDevTypeNetwork
= 0xE0,
130 kBIOSDevUnitMask
= 0x0F,
131 kBIOSDevTypeMask
= 0xF0,
135 //#define BIOS_DEV_TYPE(d) ((d) & kBIOSDevTypeMask)
136 #define BIOS_DEV_UNIT(bvr) ((bvr)->biosdev - (bvr)->type)
139 * KernBootStruct device types.
149 #define max(a,b) ((a) > (b) ? (a) : (b))
153 #define min(a,b) ((a) < (b) ? (a) : (b))
156 #define MAKEKERNDEV(t, u, p) MAKEBOOTDEV(t, 0, 0, u, p)
159 kNetworkDeviceType
= kBIOSDevTypeNetwork
,
160 kBlockDeviceType
= kBIOSDevTypeHardDrive
163 #endif /* !__LIBSAIO_SAIO_TYPES_H */