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